From 6d7ba58f880be618ade07f8ea080fe8c4bf8a896 Mon Sep 17 00:00:00 2001 From: cyfraeviolae Date: Wed, 3 Apr 2024 03:10:44 -0400 Subject: venv --- .../site-packages/editorconfig/__init__.py | 18 ++ .../site-packages/editorconfig/__main__.py | 82 ++++++++ .../__pycache__/__init__.cpython-311.pyc | Bin 0 -> 947 bytes .../__pycache__/__main__.cpython-311.pyc | Bin 0 -> 4419 bytes .../__pycache__/compat.cpython-311.pyc | Bin 0 -> 1107 bytes .../__pycache__/exceptions.cpython-311.pyc | Bin 0 -> 1614 bytes .../__pycache__/fnmatch.cpython-311.pyc | Bin 0 -> 7505 bytes .../__pycache__/handler.cpython-311.pyc | Bin 0 -> 5119 bytes .../editorconfig/__pycache__/ini.cpython-311.pyc | Bin 0 -> 7410 bytes .../__pycache__/version.cpython-311.pyc | Bin 0 -> 228 bytes .../__pycache__/versiontools.cpython-311.pyc | Bin 0 -> 1612 bytes .../site-packages/editorconfig/compat.py | 24 +++ .../site-packages/editorconfig/exceptions.py | 27 +++ .../site-packages/editorconfig/fnmatch.py | 223 +++++++++++++++++++++ .../site-packages/editorconfig/handler.py | 127 ++++++++++++ .../python3.11/site-packages/editorconfig/ini.py | 183 +++++++++++++++++ .../site-packages/editorconfig/version.py | 1 + .../site-packages/editorconfig/versiontools.py | 35 ++++ 18 files changed, 720 insertions(+) create mode 100644 venv/lib/python3.11/site-packages/editorconfig/__init__.py create mode 100644 venv/lib/python3.11/site-packages/editorconfig/__main__.py create mode 100644 venv/lib/python3.11/site-packages/editorconfig/__pycache__/__init__.cpython-311.pyc create mode 100644 venv/lib/python3.11/site-packages/editorconfig/__pycache__/__main__.cpython-311.pyc create mode 100644 venv/lib/python3.11/site-packages/editorconfig/__pycache__/compat.cpython-311.pyc create mode 100644 venv/lib/python3.11/site-packages/editorconfig/__pycache__/exceptions.cpython-311.pyc create mode 100644 venv/lib/python3.11/site-packages/editorconfig/__pycache__/fnmatch.cpython-311.pyc create mode 100644 venv/lib/python3.11/site-packages/editorconfig/__pycache__/handler.cpython-311.pyc create mode 100644 venv/lib/python3.11/site-packages/editorconfig/__pycache__/ini.cpython-311.pyc create mode 100644 venv/lib/python3.11/site-packages/editorconfig/__pycache__/version.cpython-311.pyc create mode 100644 venv/lib/python3.11/site-packages/editorconfig/__pycache__/versiontools.cpython-311.pyc create mode 100644 venv/lib/python3.11/site-packages/editorconfig/compat.py create mode 100644 venv/lib/python3.11/site-packages/editorconfig/exceptions.py create mode 100644 venv/lib/python3.11/site-packages/editorconfig/fnmatch.py create mode 100644 venv/lib/python3.11/site-packages/editorconfig/handler.py create mode 100644 venv/lib/python3.11/site-packages/editorconfig/ini.py create mode 100644 venv/lib/python3.11/site-packages/editorconfig/version.py create mode 100644 venv/lib/python3.11/site-packages/editorconfig/versiontools.py (limited to 'venv/lib/python3.11/site-packages/editorconfig') diff --git a/venv/lib/python3.11/site-packages/editorconfig/__init__.py b/venv/lib/python3.11/site-packages/editorconfig/__init__.py new file mode 100644 index 0000000..2574ce4 --- /dev/null +++ b/venv/lib/python3.11/site-packages/editorconfig/__init__.py @@ -0,0 +1,18 @@ +"""EditorConfig Python Core""" + +from editorconfig.versiontools import join_version +from editorconfig.version import VERSION + +__all__ = ['get_properties', 'EditorConfigError', 'exceptions'] + +__version__ = join_version(VERSION) + + +def get_properties(filename): + """Locate and parse EditorConfig files for the given filename""" + handler = EditorConfigHandler(filename) + return handler.get_configurations() + + +from editorconfig.handler import EditorConfigHandler +from editorconfig.exceptions import * diff --git a/venv/lib/python3.11/site-packages/editorconfig/__main__.py b/venv/lib/python3.11/site-packages/editorconfig/__main__.py new file mode 100644 index 0000000..fc98b6f --- /dev/null +++ b/venv/lib/python3.11/site-packages/editorconfig/__main__.py @@ -0,0 +1,82 @@ +"""EditorConfig command line interface + +Licensed under Simplified BSD License (see LICENSE.BSD file). + +""" + +import getopt +import sys + +from editorconfig import VERSION, __version__ +from editorconfig.compat import force_unicode +from editorconfig.exceptions import ParsingError, PathError, VersionError +from editorconfig.handler import EditorConfigHandler +from editorconfig.versiontools import split_version + + +def version(): + print("EditorConfig Python Core Version %s" % __version__) + + +def usage(command, error=False): + if error: + out = sys.stderr + else: + out = sys.stdout + out.write("%s [OPTIONS] FILENAME\n" % command) + out.write('-f ' + 'Specify conf filename other than ".editorconfig".\n') + out.write("-b " + "Specify version (used by devs to test compatibility).\n") + out.write("-h OR --help Print this help message.\n") + out.write("-v OR --version Display version information.\n") + + +def main(): + command_name = sys.argv[0] + try: + opts, args = getopt.getopt(list(map(force_unicode, sys.argv[1:])), + "vhb:f:", ["version", "help"]) + except getopt.GetoptError as e: + print(str(e)) + usage(command_name, error=True) + sys.exit(2) + + version_tuple = VERSION + conf_filename = '.editorconfig' + + for option, arg in opts: + if option in ('-h', '--help'): + usage(command_name) + sys.exit() + if option in ('-v', '--version'): + version() + sys.exit() + if option == '-f': + conf_filename = arg + if option == '-b': + version_tuple = split_version(arg) + if version_tuple is None: + sys.exit("Invalid version number: %s" % arg) + + if len(args) < 1: + usage(command_name, error=True) + sys.exit(2) + filenames = args + multiple_files = len(args) > 1 + + for filename in filenames: + handler = EditorConfigHandler(filename, conf_filename, version_tuple) + try: + options = handler.get_configurations() + except (ParsingError, PathError, VersionError) as e: + print(str(e)) + sys.exit(2) + if multiple_files: + print("[%s]" % filename) + for key, value in options.items(): + print("%s=%s" % (key, value)) + + +if __name__ == "__main__": + main() diff --git a/venv/lib/python3.11/site-packages/editorconfig/__pycache__/__init__.cpython-311.pyc b/venv/lib/python3.11/site-packages/editorconfig/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..35f562f Binary files /dev/null and b/venv/lib/python3.11/site-packages/editorconfig/__pycache__/__init__.cpython-311.pyc differ diff --git a/venv/lib/python3.11/site-packages/editorconfig/__pycache__/__main__.cpython-311.pyc b/venv/lib/python3.11/site-packages/editorconfig/__pycache__/__main__.cpython-311.pyc new file mode 100644 index 0000000..5343829 Binary files /dev/null and b/venv/lib/python3.11/site-packages/editorconfig/__pycache__/__main__.cpython-311.pyc differ diff --git a/venv/lib/python3.11/site-packages/editorconfig/__pycache__/compat.cpython-311.pyc b/venv/lib/python3.11/site-packages/editorconfig/__pycache__/compat.cpython-311.pyc new file mode 100644 index 0000000..1686a75 Binary files /dev/null and b/venv/lib/python3.11/site-packages/editorconfig/__pycache__/compat.cpython-311.pyc differ diff --git a/venv/lib/python3.11/site-packages/editorconfig/__pycache__/exceptions.cpython-311.pyc b/venv/lib/python3.11/site-packages/editorconfig/__pycache__/exceptions.cpython-311.pyc new file mode 100644 index 0000000..511078f Binary files /dev/null and b/venv/lib/python3.11/site-packages/editorconfig/__pycache__/exceptions.cpython-311.pyc differ diff --git a/venv/lib/python3.11/site-packages/editorconfig/__pycache__/fnmatch.cpython-311.pyc b/venv/lib/python3.11/site-packages/editorconfig/__pycache__/fnmatch.cpython-311.pyc new file mode 100644 index 0000000..5d4a548 Binary files /dev/null and b/venv/lib/python3.11/site-packages/editorconfig/__pycache__/fnmatch.cpython-311.pyc differ diff --git a/venv/lib/python3.11/site-packages/editorconfig/__pycache__/handler.cpython-311.pyc b/venv/lib/python3.11/site-packages/editorconfig/__pycache__/handler.cpython-311.pyc new file mode 100644 index 0000000..8504183 Binary files /dev/null and b/venv/lib/python3.11/site-packages/editorconfig/__pycache__/handler.cpython-311.pyc differ diff --git a/venv/lib/python3.11/site-packages/editorconfig/__pycache__/ini.cpython-311.pyc b/venv/lib/python3.11/site-packages/editorconfig/__pycache__/ini.cpython-311.pyc new file mode 100644 index 0000000..65d5307 Binary files /dev/null and b/venv/lib/python3.11/site-packages/editorconfig/__pycache__/ini.cpython-311.pyc differ diff --git a/venv/lib/python3.11/site-packages/editorconfig/__pycache__/version.cpython-311.pyc b/venv/lib/python3.11/site-packages/editorconfig/__pycache__/version.cpython-311.pyc new file mode 100644 index 0000000..2f937fa Binary files /dev/null and b/venv/lib/python3.11/site-packages/editorconfig/__pycache__/version.cpython-311.pyc differ diff --git a/venv/lib/python3.11/site-packages/editorconfig/__pycache__/versiontools.cpython-311.pyc b/venv/lib/python3.11/site-packages/editorconfig/__pycache__/versiontools.cpython-311.pyc new file mode 100644 index 0000000..69373b5 Binary files /dev/null and b/venv/lib/python3.11/site-packages/editorconfig/__pycache__/versiontools.cpython-311.pyc differ diff --git a/venv/lib/python3.11/site-packages/editorconfig/compat.py b/venv/lib/python3.11/site-packages/editorconfig/compat.py new file mode 100644 index 0000000..4b9f8ca --- /dev/null +++ b/venv/lib/python3.11/site-packages/editorconfig/compat.py @@ -0,0 +1,24 @@ +"""EditorConfig Python2/Python3 compatibility utilities""" +import sys + + +__all__ = ['force_unicode', 'u'] + + +if sys.version_info[0] == 2: + text_type = unicode +else: + text_type = str + + +def force_unicode(string): + if not isinstance(string, text_type): + string = text_type(string, encoding='utf-8') + return string + + +if sys.version_info[0] == 2: + import codecs + u = lambda s: codecs.unicode_escape_decode(s)[0] +else: + u = lambda s: s diff --git a/venv/lib/python3.11/site-packages/editorconfig/exceptions.py b/venv/lib/python3.11/site-packages/editorconfig/exceptions.py new file mode 100644 index 0000000..c25f681 --- /dev/null +++ b/venv/lib/python3.11/site-packages/editorconfig/exceptions.py @@ -0,0 +1,27 @@ +"""EditorConfig exception classes + +Licensed under Simplified BSD License (see LICENSE.BSD file). + +""" + + +class EditorConfigError(Exception): + """Parent class of all exceptions raised by EditorConfig""" + + +try: + from ConfigParser import ParsingError as _ParsingError +except: + from configparser import ParsingError as _ParsingError + + +class ParsingError(_ParsingError, EditorConfigError): + """Error raised if an EditorConfig file could not be parsed""" + + +class PathError(ValueError, EditorConfigError): + """Error raised if invalid filepath is specified""" + + +class VersionError(ValueError, EditorConfigError): + """Error raised if invalid version number is specified""" diff --git a/venv/lib/python3.11/site-packages/editorconfig/fnmatch.py b/venv/lib/python3.11/site-packages/editorconfig/fnmatch.py new file mode 100644 index 0000000..76692b8 --- /dev/null +++ b/venv/lib/python3.11/site-packages/editorconfig/fnmatch.py @@ -0,0 +1,223 @@ +"""Filename matching with shell patterns. + +fnmatch(FILENAME, PATTERN) matches according to the local convention. +fnmatchcase(FILENAME, PATTERN) always takes case in account. + +The functions operate by translating the pattern into a regular +expression. They cache the compiled regular expressions for speed. + +The function translate(PATTERN) returns a regular expression +corresponding to PATTERN. (It does not compile it.) + +Based on code from fnmatch.py file distributed with Python 2.6. + +Licensed under PSF License (see LICENSE.PSF file). + +Changes to original fnmatch module: +- translate function supports ``*`` and ``**`` similarly to fnmatch C library +""" + +import os +import re + + +__all__ = ["fnmatch", "fnmatchcase", "translate"] + +_cache = {} + +LEFT_BRACE = re.compile( + r""" + + (? 0 and not is_escaped: + result += '|' + else: + result += '\\,' + elif current_char == '}': + if brace_level > 0 and not is_escaped: + result += ')' + brace_level -= 1 + else: + result += '\\}' + elif current_char == '/': + if pat[index:(index + 3)] == "**/": + result += "(?:/|/.*/)" + index += 3 + else: + result += '/' + elif current_char != '\\': + result += re.escape(current_char) + if current_char == '\\': + if is_escaped: + result += re.escape(current_char) + is_escaped = not is_escaped + else: + is_escaped = False + if not nested: + result = r'(?s)%s\Z' % result + return result, numeric_groups diff --git a/venv/lib/python3.11/site-packages/editorconfig/handler.py b/venv/lib/python3.11/site-packages/editorconfig/handler.py new file mode 100644 index 0000000..1c33c02 --- /dev/null +++ b/venv/lib/python3.11/site-packages/editorconfig/handler.py @@ -0,0 +1,127 @@ +"""EditorConfig file handler + +Provides ``EditorConfigHandler`` class for locating and parsing +EditorConfig files relevant to a given filepath. + +Licensed under Simplified BSD License (see LICENSE.BSD file). + +""" + +import os + +from editorconfig import VERSION +from editorconfig.exceptions import PathError, VersionError +from editorconfig.ini import EditorConfigParser + + +__all__ = ['EditorConfigHandler'] + + +def get_filenames(path, filename): + """Yield full filepath for filename in each directory in and above path""" + path_list = [] + while True: + path_list.append(os.path.join(path, filename)) + newpath = os.path.dirname(path) + if path == newpath: + break + path = newpath + return path_list + + +class EditorConfigHandler(object): + + """ + Allows locating and parsing of EditorConfig files for given filename + + In addition to the constructor a single public method is provided, + ``get_configurations`` which returns the EditorConfig options for + the ``filepath`` specified to the constructor. + + """ + + def __init__(self, filepath, conf_filename='.editorconfig', + version=VERSION): + """Create EditorConfigHandler for matching given filepath""" + self.filepath = filepath + self.conf_filename = conf_filename + self.version = version + self.options = None + + def get_configurations(self): + + """ + Find EditorConfig files and return all options matching filepath + + Special exceptions that may be raised by this function include: + + - ``VersionError``: self.version is invalid EditorConfig version + - ``PathError``: self.filepath is not a valid absolute filepath + - ``ParsingError``: improperly formatted EditorConfig file found + + """ + + self.check_assertions() + path, filename = os.path.split(self.filepath) + conf_files = get_filenames(path, self.conf_filename) + + # Attempt to find and parse every EditorConfig file in filetree + for filename in conf_files: + parser = EditorConfigParser(self.filepath) + parser.read(filename) + + # Merge new EditorConfig file's options into current options + old_options = self.options + self.options = parser.options + if old_options: + self.options.update(old_options) + + # Stop parsing if parsed file has a ``root = true`` option + if parser.root_file: + break + + self.preprocess_values() + return self.options + + def check_assertions(self): + + """Raise error if filepath or version have invalid values""" + + # Raise ``PathError`` if filepath isn't an absolute path + if not os.path.isabs(self.filepath): + raise PathError("Input file must be a full path name.") + + # Raise ``VersionError`` if version specified is greater than current + if self.version is not None and self.version[:3] > VERSION[:3]: + raise VersionError( + "Required version is greater than the current version.") + + def preprocess_values(self): + + """Preprocess option values for consumption by plugins""" + + opts = self.options + + # Lowercase option value for certain options + for name in ["end_of_line", "indent_style", "indent_size", + "insert_final_newline", "trim_trailing_whitespace", + "charset"]: + if name in opts: + opts[name] = opts[name].lower() + + # Set indent_size to "tab" if indent_size is unspecified and + # indent_style is set to "tab". + if (opts.get("indent_style") == "tab" and + not "indent_size" in opts and self.version >= (0, 10, 0)): + opts["indent_size"] = "tab" + + # Set tab_width to indent_size if indent_size is specified and + # tab_width is unspecified + if ("indent_size" in opts and "tab_width" not in opts and + opts["indent_size"] != "tab"): + opts["tab_width"] = opts["indent_size"] + + # Set indent_size to tab_width if indent_size is "tab" + if ("indent_size" in opts and "tab_width" in opts and + opts["indent_size"] == "tab"): + opts["indent_size"] = opts["tab_width"] diff --git a/venv/lib/python3.11/site-packages/editorconfig/ini.py b/venv/lib/python3.11/site-packages/editorconfig/ini.py new file mode 100644 index 0000000..c603d79 --- /dev/null +++ b/venv/lib/python3.11/site-packages/editorconfig/ini.py @@ -0,0 +1,183 @@ +"""EditorConfig file parser + +Based on code from ConfigParser.py file distributed with Python 2.6. + +Licensed under PSF License (see LICENSE.PSF file). + +Changes to original ConfigParser: + +- Special characters can be used in section names +- Octothorpe can be used for comments (not just at beginning of line) +- Only track INI options in sections that match target filename +- Stop parsing files with when ``root = true`` is found + +""" + +import posixpath +import re +from codecs import open +from collections import OrderedDict +from os import sep +from os.path import dirname, normpath + +from editorconfig.compat import u +from editorconfig.exceptions import ParsingError +from editorconfig.fnmatch import fnmatch + + +__all__ = ["ParsingError", "EditorConfigParser"] + +MAX_SECTION_LENGTH = 4096 +MAX_PROPERTY_LENGTH= 50 +MAX_VALUE_LENGTH = 255 + + +class EditorConfigParser(object): + + """Parser for EditorConfig-style configuration files + + Based on RawConfigParser from ConfigParser.py in Python 2.6. + """ + + # Regular expressions for parsing section headers and options. + # Allow ``]`` and escaped ``;`` and ``#`` characters in section headers + SECTCRE = re.compile( + r""" + + \s * # Optional whitespace + \[ # Opening square brace + + (?P
# One or more characters excluding + ( [^\#;] | \\\# | \\; ) + # unescaped # and ; characters + ) + + \] # Closing square brace + + """, re.VERBOSE + ) + # Regular expression for parsing option name/values. + # Allow any amount of whitespaces, followed by separator + # (either ``:`` or ``=``), followed by any amount of whitespace and then + # any characters to eol + OPTCRE = re.compile( + r""" + + \s * # Optional whitespace + (?P