X7ROOT File Manager
Current Path:
/opt/cloudlinux/venv/lib/python3.11/site-packages/isort
opt
/
cloudlinux
/
venv
/
lib
/
python3.11
/
site-packages
/
isort
/
??
..
??
__init__.py
(871 B)
??
__main__.py
(36 B)
??
__pycache__
??
_vendored
??
_version.py
(72 B)
??
api.py
(25.51 KB)
??
comments.py
(933 B)
??
core.py
(22 KB)
??
deprecated
??
exceptions.py
(6.89 KB)
??
files.py
(1.55 KB)
??
format.py
(5.35 KB)
??
hooks.py
(3.26 KB)
??
identify.py
(8.18 KB)
??
io.py
(2.16 KB)
??
literal.py
(3.63 KB)
??
logo.py
(388 B)
??
main.py
(45.73 KB)
??
output.py
(27.15 KB)
??
parse.py
(24.74 KB)
??
place.py
(5.05 KB)
??
profiles.py
(2.09 KB)
??
py.typed
(0 B)
??
pylama_isort.py
(1.28 KB)
??
sections.py
(297 B)
??
settings.py
(34.75 KB)
??
setuptools_commands.py
(2.24 KB)
??
sorting.py
(4.41 KB)
??
stdlibs
??
utils.py
(2.36 KB)
??
wrap.py
(6.17 KB)
??
wrap_modes.py
(13.25 KB)
Editing: comments.py
from typing import List, Optional, Tuple def parse(line: str) -> Tuple[str, str]: """Parses import lines for comments and returns back the import statement and the associated comment. """ comment_start = line.find("#") if comment_start != -1: return (line[:comment_start], line[comment_start + 1 :].strip()) return (line, "") def add_to_line( comments: Optional[List[str]], original_string: str = "", removed: bool = False, comment_prefix: str = "", ) -> str: """Returns a string with comments added if removed is not set.""" if removed: return parse(original_string)[0] if not comments: return original_string unique_comments: List[str] = [] for comment in comments: if comment not in unique_comments: unique_comments.append(comment) return f"{parse(original_string)[0]}{comment_prefix} {'; '.join(unique_comments)}"
Upload File
Create Folder