/opt/imh-python/lib/python3.9/site-packages/isort
NameSizeModeActions
deprecated/-0755rm
stdlibs/-0755rm
_vendored/-0755rm
__pycache__/-0755rm
api.py264330644editdlrm
comments.py9330644editdlrm
core.py227030644editdlrm
exceptions.py70610644editdlrm
files.py15890644editdlrm
format.py54830644editdlrm
hooks.py33390644editdlrm
identify.py83440644editdlrm
io.py22170644editdlrm
literal.py36950644editdlrm
logo.py3880644editdlrm
main.py471340644editdlrm
output.py280300644editdlrm
parse.py255720644editdlrm
place.py51710644editdlrm
profiles.py22980644editdlrm
py.typed00644editdlrm
pylama_isort.py13080644editdlrm
sections.py2980644editdlrm
settings.py356000644editdlrm
setuptools_commands.py23560644editdlrm
sorting.py44960644editdlrm
utils.py24700644editdlrm
wrap.py63910644editdlrm
wrap_modes.py134470644editdlrm
_version.py720644editdlrm
__init__.py8720644editdlrm
__main__.py360644editdlrm
Edit: /opt/imh-python/lib/python3.9/site-packages/isort/comments.py (933B)
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)}"