__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
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
else:
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)}"
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| __pycache__ | Folder | 0755 |
|
|
| _future | Folder | 0755 |
|
|
| deprecated | Folder | 0755 |
|
|
| stdlibs | Folder | 0755 |
|
|
| __init__.py | File | 374 B | 0644 |
|
| __main__.py | File | 36 B | 0644 |
|
| _version.py | File | 22 B | 0644 |
|
| api.py | File | 15.65 KB | 0644 |
|
| comments.py | File | 962 B | 0644 |
|
| core.py | File | 17.43 KB | 0644 |
|
| exceptions.py | File | 5.74 KB | 0644 |
|
| format.py | File | 4.99 KB | 0644 |
|
| hooks.py | File | 3.07 KB | 0644 |
|
| io.py | File | 2.01 KB | 0644 |
|
| literal.py | File | 3.39 KB | 0644 |
|
| logo.py | File | 388 B | 0644 |
|
| main.py | File | 35.01 KB | 0644 |
|
| output.py | File | 23.42 KB | 0644 |
|
| parse.py | File | 22.6 KB | 0644 |
|
| place.py | File | 5.04 KB | 0644 |
|
| profiles.py | File | 1.56 KB | 0644 |
|
| pylama_isort.py | File | 1.14 KB | 0644 |
|
| sections.py | File | 297 B | 0644 |
|
| settings.py | File | 27.71 KB | 0644 |
|
| setuptools_commands.py | File | 2.21 KB | 0644 |
|
| sorting.py | File | 3.16 KB | 0644 |
|
| utils.py | File | 665 B | 0644 |
|
| wrap.py | File | 5.69 KB | 0644 |
|
| wrap_modes.py | File | 10.99 KB | 0644 |
|