From 6d7ba58f880be618ade07f8ea080fe8c4bf8a896 Mon Sep 17 00:00:00 2001 From: cyfraeviolae Date: Wed, 3 Apr 2024 03:10:44 -0400 Subject: venv --- .../python3.11/site-packages/editorconfig/ini.py | 183 +++++++++++++++++++++ 1 file changed, 183 insertions(+) create mode 100644 venv/lib/python3.11/site-packages/editorconfig/ini.py (limited to 'venv/lib/python3.11/site-packages/editorconfig/ini.py') 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