-
Notifications
You must be signed in to change notification settings - Fork 0
xx_code
This class includes methods, used to work with strings, which include code.
This method will add indent
spaces at the beginning of each line.
Params:
-
code: str
the string to add the indent to -
indent: int
the amount of spaces to add (default4
)
Returns: the indented string
This method will try to get the amount of spaces that are used for indentation.
Param: code: str
the string to get the tab spaces from
Returns: the amount of spaces used for indentation
This method will change the amount of spaces used for indentation.
Params:
-
code: str
the string to change the tab size of -
new_tab_size: int
the amount of spaces to use for indentation -
remove_empty_lines: bool = False
whether to remove empty lines in the process
Returns: the string with the new tab size (and no empty lines if remove_empty_lines
is true)
This method will try to get all the function/method calls (JavaScript, Python, etc. style functions/methods).
Param: code: str
the string to get the function/method calls from
Returns: a list of function/method calls
This method will check if the code is likely to be JavaScript.
Params:
-
code: str
the string to check
-
funcs: list[str] = ["__", "$t", "$lang"]
the list of specific function names which can be in the string, that's likely JavaScript Returns:True
if the code is likely to be JavaScript andFalse
otherwise
★⠀Python Library by XulbuX⠀★
-
Intended Audience:
- Developers
-
License:
- OSI Approved
- MIT License
-
Operating Systems:
- Full Library: OS Independent
-
Supported Python Versions:
- Python 3.13
- Python 3.12
- Python 3.11
- Python 3.10
-
Topics:
- Libraries
- Python Modules
- Software Development