@@ -159,7 +159,7 @@ interface NarrowExprOptions {
159
159
// amount to the complexity factor. Without this, the complexity
160
160
// calculation fails to take into account large numbers of non-cyclical
161
161
// flow nodes. This number is somewhat arbitrary and is tuned empirically.
162
- const flowNodeComplexityContribution = 0.05 ;
162
+ const flowNodeComplexityContribution = 0.025 ;
163
163
164
164
export class Binder extends ParseTreeWalker {
165
165
private readonly _fileInfo : AnalyzerFileInfo ;
@@ -4087,17 +4087,25 @@ export class Binder extends ParseTreeWalker {
4087
4087
// a decorator that tells us otherwise.
4088
4088
isInstanceMember = true ;
4089
4089
for ( const decorator of methodNode . d . decorators ) {
4090
+ let decoratorName : string | undefined ;
4091
+
4090
4092
if ( decorator . d . expr . nodeType === ParseNodeType . Name ) {
4091
- const decoratorName = decorator . d . expr . d . value ;
4092
-
4093
- if ( decoratorName === 'staticmethod' ) {
4094
- // A static method doesn't have a "self" or "cls" parameter.
4095
- return undefined ;
4096
- } else if ( decoratorName === 'classmethod' ) {
4097
- // A classmethod implies that the first parameter is "cls".
4098
- isInstanceMember = false ;
4099
- break ;
4100
- }
4093
+ decoratorName = decorator . d . expr . d . value ;
4094
+ } else if (
4095
+ decorator . d . expr . nodeType === ParseNodeType . MemberAccess &&
4096
+ decorator . d . expr . d . leftExpr . nodeType === ParseNodeType . Name &&
4097
+ decorator . d . expr . d . leftExpr . d . value === 'builtins'
4098
+ ) {
4099
+ decoratorName = decorator . d . expr . d . member . d . value ;
4100
+ }
4101
+
4102
+ if ( decoratorName === 'staticmethod' ) {
4103
+ // A static method doesn't have a "self" or "cls" parameter.
4104
+ return undefined ;
4105
+ } else if ( decoratorName === 'classmethod' ) {
4106
+ // A classmethod implies that the first parameter is "cls".
4107
+ isInstanceMember = false ;
4108
+ break ;
4101
4109
}
4102
4110
}
4103
4111
}
0 commit comments