---
source: crates/ruff_linter/src/rules/pylint/mod.rs
---
PLC0415 `import` should be at the top-level of a file
  --> import_outside_top_level.py:10:5
   |
 9 | def import_in_function():
10 |     import symtable  # [import-outside-toplevel]
   |     ^^^^^^^^^^^^^^^
11 |     import os, sys  # [import-outside-toplevel]
12 |     import time as thyme  # [import-outside-toplevel]
   |

PLC0415 `import` should be at the top-level of a file
  --> import_outside_top_level.py:11:5
   |
 9 | def import_in_function():
10 |     import symtable  # [import-outside-toplevel]
11 |     import os, sys  # [import-outside-toplevel]
   |     ^^^^^^^^^^^^^^
12 |     import time as thyme  # [import-outside-toplevel]
13 |     import random as rand, socket as sock  # [import-outside-toplevel]
   |

PLC0415 `import` should be at the top-level of a file
  --> import_outside_top_level.py:12:5
   |
10 |     import symtable  # [import-outside-toplevel]
11 |     import os, sys  # [import-outside-toplevel]
12 |     import time as thyme  # [import-outside-toplevel]
   |     ^^^^^^^^^^^^^^^^^^^^
13 |     import random as rand, socket as sock  # [import-outside-toplevel]
14 |     from collections import defaultdict # [import-outside-toplevel]
   |

PLC0415 `import` should be at the top-level of a file
  --> import_outside_top_level.py:13:5
   |
11 |     import os, sys  # [import-outside-toplevel]
12 |     import time as thyme  # [import-outside-toplevel]
13 |     import random as rand, socket as sock  # [import-outside-toplevel]
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14 |     from collections import defaultdict # [import-outside-toplevel]
15 |     from math import sin as sign, cos as cosplay  # [import-outside-toplevel]
   |

PLC0415 `import` should be at the top-level of a file
  --> import_outside_top_level.py:14:5
   |
12 |     import time as thyme  # [import-outside-toplevel]
13 |     import random as rand, socket as sock  # [import-outside-toplevel]
14 |     from collections import defaultdict # [import-outside-toplevel]
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
15 |     from math import sin as sign, cos as cosplay  # [import-outside-toplevel]
   |

PLC0415 `import` should be at the top-level of a file
  --> import_outside_top_level.py:15:5
   |
13 |     import random as rand, socket as sock  # [import-outside-toplevel]
14 |     from collections import defaultdict # [import-outside-toplevel]
15 |     from math import sin as sign, cos as cosplay  # [import-outside-toplevel]
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |

PLC0415 `import` should be at the top-level of a file
  --> import_outside_top_level.py:19:5
   |
18 | class ClassWithImports:
19 |     import tokenize  # [import-outside-toplevel]
   |     ^^^^^^^^^^^^^^^
20 |
21 |     def __init__(self):
   |

PLC0415 `import` should be at the top-level of a file
  --> import_outside_top_level.py:22:9
   |
21 |     def __init__(self):
22 |         import trace  # [import-outside-toplevel]
   |         ^^^^^^^^^^^^
   |
