@@ -2610,10 +2610,13 @@ pub enum KnownClass {
2610
2610
UnionType ,
2611
2611
GeneratorType ,
2612
2612
AsyncGeneratorType ,
2613
+ CoroutineType ,
2613
2614
// Typeshed
2614
2615
NoneType , // Part of `types` for Python >= 3.10
2615
2616
// Typing
2616
2617
Any ,
2618
+ Awaitable ,
2619
+ Generator ,
2617
2620
Deprecated ,
2618
2621
StdlibAlias ,
2619
2622
SpecialForm ,
@@ -2736,6 +2739,9 @@ impl KnownClass {
2736
2739
| Self :: NotImplementedType
2737
2740
| Self :: Staticmethod
2738
2741
| Self :: Classmethod
2742
+ | Self :: Awaitable
2743
+ | Self :: Generator
2744
+ | Self :: CoroutineType
2739
2745
| Self :: Deprecated
2740
2746
| Self :: Field
2741
2747
| Self :: KwOnly
@@ -2771,7 +2777,8 @@ impl KnownClass {
2771
2777
| Self :: Super
2772
2778
| Self :: GenericAlias
2773
2779
| Self :: Deque
2774
- | Self :: Bytes => true ,
2780
+ | Self :: Bytes
2781
+ | Self :: CoroutineType => true ,
2775
2782
2776
2783
// It doesn't really make sense to ask the question for `@final` types,
2777
2784
// since these are "more than solid bases". But we'll anyway infer a `@final`
@@ -2807,6 +2814,8 @@ impl KnownClass {
2807
2814
// with length >2, or anything that is implemented in pure Python, is not a solid base.
2808
2815
Self :: ABCMeta
2809
2816
| Self :: Any
2817
+ | Self :: Awaitable
2818
+ | Self :: Generator
2810
2819
| Self :: Enum
2811
2820
| Self :: EnumType
2812
2821
| Self :: Auto
@@ -2855,6 +2864,8 @@ impl KnownClass {
2855
2864
| KnownClass :: ExceptionGroup
2856
2865
| KnownClass :: Staticmethod
2857
2866
| KnownClass :: Classmethod
2867
+ | KnownClass :: Awaitable
2868
+ | KnownClass :: Generator
2858
2869
| KnownClass :: Deprecated
2859
2870
| KnownClass :: Super
2860
2871
| KnownClass :: Enum
@@ -2872,6 +2883,7 @@ impl KnownClass {
2872
2883
| KnownClass :: UnionType
2873
2884
| KnownClass :: GeneratorType
2874
2885
| KnownClass :: AsyncGeneratorType
2886
+ | KnownClass :: CoroutineType
2875
2887
| KnownClass :: NoneType
2876
2888
| KnownClass :: Any
2877
2889
| KnownClass :: StdlibAlias
@@ -2917,7 +2929,11 @@ impl KnownClass {
2917
2929
/// 2. It's probably more performant.
2918
2930
const fn is_protocol ( self ) -> bool {
2919
2931
match self {
2920
- Self :: SupportsIndex | Self :: Iterable | Self :: Iterator => true ,
2932
+ Self :: SupportsIndex
2933
+ | Self :: Iterable
2934
+ | Self :: Iterator
2935
+ | Self :: Awaitable
2936
+ | Self :: Generator => true ,
2921
2937
2922
2938
Self :: Any
2923
2939
| Self :: Bool
@@ -2946,6 +2962,7 @@ impl KnownClass {
2946
2962
| Self :: GenericAlias
2947
2963
| Self :: GeneratorType
2948
2964
| Self :: AsyncGeneratorType
2965
+ | Self :: CoroutineType
2949
2966
| Self :: ModuleType
2950
2967
| Self :: FunctionType
2951
2968
| Self :: MethodType
@@ -3011,6 +3028,8 @@ impl KnownClass {
3011
3028
Self :: ExceptionGroup => "ExceptionGroup" ,
3012
3029
Self :: Staticmethod => "staticmethod" ,
3013
3030
Self :: Classmethod => "classmethod" ,
3031
+ Self :: Awaitable => "Awaitable" ,
3032
+ Self :: Generator => "Generator" ,
3014
3033
Self :: Deprecated => "deprecated" ,
3015
3034
Self :: GenericAlias => "GenericAlias" ,
3016
3035
Self :: ModuleType => "ModuleType" ,
@@ -3021,6 +3040,7 @@ impl KnownClass {
3021
3040
Self :: WrapperDescriptorType => "WrapperDescriptorType" ,
3022
3041
Self :: GeneratorType => "GeneratorType" ,
3023
3042
Self :: AsyncGeneratorType => "AsyncGeneratorType" ,
3043
+ Self :: CoroutineType => "CoroutineType" ,
3024
3044
Self :: NamedTuple => "NamedTuple" ,
3025
3045
Self :: NoneType => "NoneType" ,
3026
3046
Self :: SpecialForm => "_SpecialForm" ,
@@ -3281,11 +3301,14 @@ impl KnownClass {
3281
3301
| Self :: MethodType
3282
3302
| Self :: GeneratorType
3283
3303
| Self :: AsyncGeneratorType
3304
+ | Self :: CoroutineType
3284
3305
| Self :: MethodWrapperType
3285
3306
| Self :: UnionType
3286
3307
| Self :: WrapperDescriptorType => KnownModule :: Types ,
3287
3308
Self :: NoneType => KnownModule :: Typeshed ,
3288
3309
Self :: Any
3310
+ | Self :: Awaitable
3311
+ | Self :: Generator
3289
3312
| Self :: SpecialForm
3290
3313
| Self :: TypeVar
3291
3314
| Self :: NamedTuple
@@ -3366,12 +3389,15 @@ impl KnownClass {
3366
3389
| Self :: ExceptionGroup
3367
3390
| Self :: Staticmethod
3368
3391
| Self :: Classmethod
3392
+ | Self :: Awaitable
3393
+ | Self :: Generator
3369
3394
| Self :: Deprecated
3370
3395
| Self :: GenericAlias
3371
3396
| Self :: ModuleType
3372
3397
| Self :: FunctionType
3373
3398
| Self :: GeneratorType
3374
3399
| Self :: AsyncGeneratorType
3400
+ | Self :: CoroutineType
3375
3401
| Self :: MethodType
3376
3402
| Self :: MethodWrapperType
3377
3403
| Self :: WrapperDescriptorType
@@ -3443,6 +3469,7 @@ impl KnownClass {
3443
3469
| Self :: WrapperDescriptorType
3444
3470
| Self :: GeneratorType
3445
3471
| Self :: AsyncGeneratorType
3472
+ | Self :: CoroutineType
3446
3473
| Self :: SpecialForm
3447
3474
| Self :: ChainMap
3448
3475
| Self :: Counter
@@ -3457,6 +3484,8 @@ impl KnownClass {
3457
3484
| Self :: ExceptionGroup
3458
3485
| Self :: Staticmethod
3459
3486
| Self :: Classmethod
3487
+ | Self :: Awaitable
3488
+ | Self :: Generator
3460
3489
| Self :: Deprecated
3461
3490
| Self :: TypeVar
3462
3491
| Self :: ParamSpec
@@ -3513,12 +3542,15 @@ impl KnownClass {
3513
3542
"ExceptionGroup" => Self :: ExceptionGroup ,
3514
3543
"staticmethod" => Self :: Staticmethod ,
3515
3544
"classmethod" => Self :: Classmethod ,
3545
+ "Awaitable" => Self :: Awaitable ,
3546
+ "Generator" => Self :: Generator ,
3516
3547
"deprecated" => Self :: Deprecated ,
3517
3548
"GenericAlias" => Self :: GenericAlias ,
3518
3549
"NoneType" => Self :: NoneType ,
3519
3550
"ModuleType" => Self :: ModuleType ,
3520
3551
"GeneratorType" => Self :: GeneratorType ,
3521
3552
"AsyncGeneratorType" => Self :: AsyncGeneratorType ,
3553
+ "CoroutineType" => Self :: CoroutineType ,
3522
3554
"FunctionType" => Self :: FunctionType ,
3523
3555
"MethodType" => Self :: MethodType ,
3524
3556
"UnionType" => Self :: UnionType ,
@@ -3623,6 +3655,7 @@ impl KnownClass {
3623
3655
| Self :: UnionType
3624
3656
| Self :: GeneratorType
3625
3657
| Self :: AsyncGeneratorType
3658
+ | Self :: CoroutineType
3626
3659
| Self :: WrapperDescriptorType
3627
3660
| Self :: Field
3628
3661
| Self :: KwOnly
@@ -3642,6 +3675,7 @@ impl KnownClass {
3642
3675
| Self :: Iterable
3643
3676
| Self :: Iterator
3644
3677
| Self :: NewType => matches ! ( module, KnownModule :: Typing | KnownModule :: TypingExtensions ) ,
3678
+ Self :: Awaitable | Self :: Generator => matches ! ( module, KnownModule :: Typing | KnownModule :: TypingExtensions | KnownModule :: Abc ) ,
3645
3679
Self :: Deprecated => matches ! ( module, KnownModule :: Warnings | KnownModule :: TypingExtensions ) ,
3646
3680
3647
3681
}
0 commit comments