2423 """ |
2423 """ |
2424 for subnode in node.body: |
2424 for subnode in node.body: |
2425 if not isinstance(subnode, ast.Expr): |
2425 if not isinstance(subnode, ast.Expr): |
2426 continue |
2426 continue |
2427 |
2427 |
2428 if ( |
2428 if isinstance( |
2429 isinstance( |
2429 subnode.value, |
2430 subnode.value, |
2430 (ast.List, ast.Set, ast.Dict), |
2431 (ast.List, ast.Set, ast.Dict), |
2431 ) or ( |
2432 ) |
2432 isinstance(subnode.value, ast.Constant) |
2433 or ( |
2433 and ( |
2434 isinstance(subnode.value, ast.Constant) |
2434 isinstance( |
2435 and ( |
2435 subnode.value.value, |
2436 isinstance( |
2436 (int, float, complex, bytes, bool), |
2437 subnode.value.value, |
|
2438 (int, float, complex, bytes, bool), |
|
2439 ) |
|
2440 or subnode.value.value is None |
|
2441 ) |
2437 ) |
|
2438 or subnode.value.value is None |
2442 ) |
2439 ) |
2443 ): |
2440 ): |
2444 self.violations.append((subnode, "M518")) |
2441 self.violations.append((subnode, "M518")) |
2445 |
2442 |
2446 def __checkForM519(self, node): |
2443 def __checkForM519(self, node): |