././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1749457225.0455341 editorconfig-0.17.1/0000755000175000017500000000000015021514511012757 5ustar00honghong././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1749457063.0 editorconfig-0.17.1/COPYING0000644000175000017500000000106215021514247014017 0ustar00honghongCopyright (c) 2011-2018 EditorConfig Team, including Hong Xu and Trey Hunner editorconfig-core-py is free software. You are free to copy, modify, and/or redistribute this work under the terms of the BSD 2-clause license. See the file "LICENSE.BSD" for details. Parts of this work – the files "fnmatch.py" and "ini.py" - are derived from work with copyright held by the Python Software Foundation. You are free to copy, modify, and/or redistribute those parts under the terms of the Python Software Foundation license. See the file "LICENSE.PSF" for details. ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1749457225.0452368 editorconfig-0.17.1/EditorConfig.egg-info/0000755000175000017500000000000015021514511017025 5ustar00honghong././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1749457225.0 editorconfig-0.17.1/EditorConfig.egg-info/PKG-INFO0000644000175000017500000000744715021514511020136 0ustar00honghongMetadata-Version: 2.4 Name: EditorConfig Version: 0.17.1 Summary: EditorConfig File Locator and Interpreter for Python Author: EditorConfig Team License: PSF-2.0 Project-URL: Homepage, https://editorconfig.org/ Project-URL: Source Code, https://github.com/editorconfig/editorconfig-core-py Project-URL: Bug Tracker, https://github.com/editorconfig/editorconfig-core-py/issues Classifier: License :: OSI Approved :: Python Software Foundation License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.12 Classifier: Programming Language :: Python :: 3.13 Classifier: Programming Language :: Python :: Implementation :: PyPy Requires-Python: >=3.9 Description-Content-Type: text/x-rst License-File: LICENSE.BSD License-File: LICENSE.PSF License-File: COPYING Provides-Extra: dev Requires-Dist: mypy>=1.15; extra == "dev" Dynamic: license-file ======================== EditorConfig Python Core ======================== .. image:: https://img.shields.io/pypi/v/EditorConfig.svg :target: https://pypi.python.org/pypi/EditorConfig .. image:: https://img.shields.io/pypi/wheel/EditorConfig.svg :target: https://pypi.python.org/pypi/EditorConfig .. image:: https://img.shields.io/pypi/pyversions/EditorConfig.svg :target: https://pypi.python.org/pypi/EditorConfig .. image:: https://secure.travis-ci.org/editorconfig/editorconfig-core-py.svg?branch=master :target: http://travis-ci.org/editorconfig/editorconfig-core-py EditorConfig Python Core provides the same functionality as the `EditorConfig C Core `_. EditorConfig Python core can be used as a command line program or as an importable library. EditorConfig Project ==================== EditorConfig makes it easy to maintain the correct coding style when switching between different text editors and between different projects. The EditorConfig project maintains a file format and plugins for various text editors which allow this file format to be read and used by those editors. For information on the file format and supported text editors, see the `EditorConfig website `_. Installation ============ With setuptools:: sudo python setup.py install Getting Help ============ For help with the EditorConfig core code, please write to our `mailing list `_. Bugs and feature requests should be submitted to our `issue tracker `_. If you are writing a plugin a language that can import Python libraries, you may want to import and use the EditorConfig Python Core directly. Using as a Library ================== Basic example use of EditorConfig Python Core as a library: .. code-block:: python from editorconfig import get_properties, EditorConfigError filename = "/home/zoidberg/humans/anatomy.md" try: options = get_properties(filename) except EditorConfigError: print("Error occurred while getting EditorConfig properties") else: for key, value in options.items(): print(f"{key}={value}") For details, please take a look at the `online documentation `_. Running Test Cases ================== `Cmake `_ has to be installed first. Run the test cases using the following commands:: export PYTHONPATH=$(pwd) cmake . ctest . Use ``-DPYTHON_EXECUTABLE`` to run the tests using an alternative versions of Python (e.g. Python 3.12):: cmake -DPYTHON_EXECUTABLE=/usr/bin/python3.12 . ctest . License ======= See COPYING file for licensing details. ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1749457225.0 editorconfig-0.17.1/EditorConfig.egg-info/SOURCES.txt0000644000175000017500000000100415021514511020704 0ustar00honghongCOPYING LICENSE.BSD LICENSE.PSF MANIFEST.in README.rst pyproject.toml setup.py EditorConfig.egg-info/PKG-INFO EditorConfig.egg-info/SOURCES.txt EditorConfig.egg-info/dependency_links.txt EditorConfig.egg-info/entry_points.txt EditorConfig.egg-info/requires.txt EditorConfig.egg-info/top_level.txt editorconfig/__init__.py editorconfig/__main__.py editorconfig/exceptions.py editorconfig/fnmatch.py editorconfig/handler.py editorconfig/ini.py editorconfig/py.typed editorconfig/version.py editorconfig/versiontools.py././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1749457225.0 editorconfig-0.17.1/EditorConfig.egg-info/dependency_links.txt0000644000175000017500000000000115021514511023073 0ustar00honghong ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1749457225.0 editorconfig-0.17.1/EditorConfig.egg-info/entry_points.txt0000644000175000017500000000007415021514511022324 0ustar00honghong[console_scripts] editorconfig = editorconfig.__main__:main ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1749457225.0 editorconfig-0.17.1/EditorConfig.egg-info/requires.txt0000644000175000017500000000002215021514511021417 0ustar00honghong [dev] mypy>=1.15 ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1749457225.0 editorconfig-0.17.1/EditorConfig.egg-info/top_level.txt0000644000175000017500000000001515021514511021553 0ustar00honghongeditorconfig ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1749457063.0 editorconfig-0.17.1/LICENSE.BSD0000644000175000017500000000245215021514247014404 0ustar00honghongCopyright (c) 2011-2018 EditorConfig Team, including Hong Xu and Trey Hunner Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1749457063.0 editorconfig-0.17.1/LICENSE.PSF0000644000175000017500000002316415021514247014427 0ustar00honghongPYTHON SOFTWARE FOUNDATION LICENSE VERSION 2 -------------------------------------------- 1. This LICENSE AGREEMENT is between the Python Software Foundation ("PSF"), and the Individual or Organization ("Licensee") accessing and otherwise using this software ("Python") in source or binary form and its associated documentation. 2. Subject to the terms and conditions of this License Agreement, PSF hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, prepare derivative works, distribute, and otherwise use Python alone or in any derivative version, provided, however, that PSF's License Agreement and PSF's notice of copyright, i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Python Software Foundation; All Rights Reserved" are retained in Python alone or in any derivative version prepared by Licensee. 3. In the event Licensee prepares a derivative work that is based on or incorporates Python or any part thereof, and wants to make the derivative work available to others as provided herein, then Licensee hereby agrees to include in any such work a brief summary of the changes made to Python. 4. PSF is making Python available to Licensee on an "AS IS" basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT INFRINGE ANY THIRD PARTY RIGHTS. 5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON, OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. 6. This License Agreement will automatically terminate upon a material breach of its terms and conditions. 7. Nothing in this License Agreement shall be deemed to create any relationship of agency, partnership, or joint venture between PSF and Licensee. This License Agreement does not grant permission to use PSF trademarks or trade name in a trademark sense to endorse or promote products or services of Licensee, or any third party. 8. By copying, installing or otherwise using Python, Licensee agrees to be bound by the terms and conditions of this License Agreement. BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0 ------------------------------------------- BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1 1. This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having an office at 160 Saratoga Avenue, Santa Clara, CA 95051, and the Individual or Organization ("Licensee") accessing and otherwise using this software in source or binary form and its associated documentation ("the Software"). 2. Subject to the terms and conditions of this BeOpen Python License Agreement, BeOpen hereby grants Licensee a non-exclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, prepare derivative works, distribute, and otherwise use the Software alone or in any derivative version, provided, however, that the BeOpen Python License is retained in the Software, alone or in any derivative version prepared by Licensee. 3. BeOpen is making the Software available to Licensee on an "AS IS" basis. BEOPEN MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, BEOPEN MAKES NO AND DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE WILL NOT INFRINGE ANY THIRD PARTY RIGHTS. 4. BEOPEN SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF THE SOFTWARE FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. 5. This License Agreement will automatically terminate upon a material breach of its terms and conditions. 6. This License Agreement shall be governed by and interpreted in all respects by the law of the State of California, excluding conflict of law provisions. Nothing in this License Agreement shall be deemed to create any relationship of agency, partnership, or joint venture between BeOpen and Licensee. This License Agreement does not grant permission to use BeOpen trademarks or trade names in a trademark sense to endorse or promote products or services of Licensee, or any third party. As an exception, the "BeOpen Python" logos available at http://www.pythonlabs.com/logos.html may be used according to the permissions granted on that web page. 7. By copying, installing or otherwise using the software, Licensee agrees to be bound by the terms and conditions of this License Agreement. CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1 --------------------------------------- 1. This LICENSE AGREEMENT is between the Corporation for National Research Initiatives, having an office at 1895 Preston White Drive, Reston, VA 20191 ("CNRI"), and the Individual or Organization ("Licensee") accessing and otherwise using Python 1.6.1 software in source or binary form and its associated documentation. 2. Subject to the terms and conditions of this License Agreement, CNRI hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, prepare derivative works, distribute, and otherwise use Python 1.6.1 alone or in any derivative version, provided, however, that CNRI's License Agreement and CNRI's notice of copyright, i.e., "Copyright (c) 1995-2001 Corporation for National Research Initiatives; All Rights Reserved" are retained in Python 1.6.1 alone or in any derivative version prepared by Licensee. Alternately, in lieu of CNRI's License Agreement, Licensee may substitute the following text (omitting the quotes): "Python 1.6.1 is made available subject to the terms and conditions in CNRI's License Agreement. This Agreement together with Python 1.6.1 may be located on the Internet using the following unique, persistent identifier (known as a handle): 1895.22/1013. This Agreement may also be obtained from a proxy server on the Internet using the following URL: http://hdl.handle.net/1895.22/1013". 3. In the event Licensee prepares a derivative work that is based on or incorporates Python 1.6.1 or any part thereof, and wants to make the derivative work available to others as provided herein, then Licensee hereby agrees to include in any such work a brief summary of the changes made to Python 1.6.1. 4. CNRI is making Python 1.6.1 available to Licensee on an "AS IS" basis. CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 1.6.1 WILL NOT INFRINGE ANY THIRD PARTY RIGHTS. 5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON 1.6.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1, OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. 6. This License Agreement will automatically terminate upon a material breach of its terms and conditions. 7. This License Agreement shall be governed by the federal intellectual property law of the United States, including without limitation the federal copyright law, and, to the extent such U.S. federal law does not apply, by the law of the Commonwealth of Virginia, excluding Virginia's conflict of law provisions. Notwithstanding the foregoing, with regard to derivative works based on Python 1.6.1 that incorporate non-separable material that was previously distributed under the GNU General Public License (GPL), the law of the Commonwealth of Virginia shall govern this License Agreement only as to issues arising under or with respect to Paragraphs 4, 5, and 7 of this License Agreement. Nothing in this License Agreement shall be deemed to create any relationship of agency, partnership, or joint venture between CNRI and Licensee. This License Agreement does not grant permission to use CNRI trademarks or trade name in a trademark sense to endorse or promote products or services of Licensee, or any third party. 8. By clicking on the "ACCEPT" button where indicated, or by copying, installing or otherwise using Python 1.6.1, Licensee agrees to be bound by the terms and conditions of this License Agreement. ACCEPT CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2 -------------------------------------------------- Copyright (c) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam, The Netherlands. All rights reserved. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Stichting Mathematisch Centrum or CWI not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1749457063.0 editorconfig-0.17.1/MANIFEST.in0000644000175000017500000000006315021514247014522 0ustar00honghonginclude COPYING README.rst LICENSE.BSD LICENSE.PSF ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1749457225.0455174 editorconfig-0.17.1/PKG-INFO0000644000175000017500000000744715021514511014070 0ustar00honghongMetadata-Version: 2.4 Name: EditorConfig Version: 0.17.1 Summary: EditorConfig File Locator and Interpreter for Python Author: EditorConfig Team License: PSF-2.0 Project-URL: Homepage, https://editorconfig.org/ Project-URL: Source Code, https://github.com/editorconfig/editorconfig-core-py Project-URL: Bug Tracker, https://github.com/editorconfig/editorconfig-core-py/issues Classifier: License :: OSI Approved :: Python Software Foundation License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.12 Classifier: Programming Language :: Python :: 3.13 Classifier: Programming Language :: Python :: Implementation :: PyPy Requires-Python: >=3.9 Description-Content-Type: text/x-rst License-File: LICENSE.BSD License-File: LICENSE.PSF License-File: COPYING Provides-Extra: dev Requires-Dist: mypy>=1.15; extra == "dev" Dynamic: license-file ======================== EditorConfig Python Core ======================== .. image:: https://img.shields.io/pypi/v/EditorConfig.svg :target: https://pypi.python.org/pypi/EditorConfig .. image:: https://img.shields.io/pypi/wheel/EditorConfig.svg :target: https://pypi.python.org/pypi/EditorConfig .. image:: https://img.shields.io/pypi/pyversions/EditorConfig.svg :target: https://pypi.python.org/pypi/EditorConfig .. image:: https://secure.travis-ci.org/editorconfig/editorconfig-core-py.svg?branch=master :target: http://travis-ci.org/editorconfig/editorconfig-core-py EditorConfig Python Core provides the same functionality as the `EditorConfig C Core `_. EditorConfig Python core can be used as a command line program or as an importable library. EditorConfig Project ==================== EditorConfig makes it easy to maintain the correct coding style when switching between different text editors and between different projects. The EditorConfig project maintains a file format and plugins for various text editors which allow this file format to be read and used by those editors. For information on the file format and supported text editors, see the `EditorConfig website `_. Installation ============ With setuptools:: sudo python setup.py install Getting Help ============ For help with the EditorConfig core code, please write to our `mailing list `_. Bugs and feature requests should be submitted to our `issue tracker `_. If you are writing a plugin a language that can import Python libraries, you may want to import and use the EditorConfig Python Core directly. Using as a Library ================== Basic example use of EditorConfig Python Core as a library: .. code-block:: python from editorconfig import get_properties, EditorConfigError filename = "/home/zoidberg/humans/anatomy.md" try: options = get_properties(filename) except EditorConfigError: print("Error occurred while getting EditorConfig properties") else: for key, value in options.items(): print(f"{key}={value}") For details, please take a look at the `online documentation `_. Running Test Cases ================== `Cmake `_ has to be installed first. Run the test cases using the following commands:: export PYTHONPATH=$(pwd) cmake . ctest . Use ``-DPYTHON_EXECUTABLE`` to run the tests using an alternative versions of Python (e.g. Python 3.12):: cmake -DPYTHON_EXECUTABLE=/usr/bin/python3.12 . ctest . License ======= See COPYING file for licensing details. ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1749457063.0 editorconfig-0.17.1/README.rst0000644000175000017500000000536015021514247014460 0ustar00honghong======================== EditorConfig Python Core ======================== .. image:: https://img.shields.io/pypi/v/EditorConfig.svg :target: https://pypi.python.org/pypi/EditorConfig .. image:: https://img.shields.io/pypi/wheel/EditorConfig.svg :target: https://pypi.python.org/pypi/EditorConfig .. image:: https://img.shields.io/pypi/pyversions/EditorConfig.svg :target: https://pypi.python.org/pypi/EditorConfig .. image:: https://secure.travis-ci.org/editorconfig/editorconfig-core-py.svg?branch=master :target: http://travis-ci.org/editorconfig/editorconfig-core-py EditorConfig Python Core provides the same functionality as the `EditorConfig C Core `_. EditorConfig Python core can be used as a command line program or as an importable library. EditorConfig Project ==================== EditorConfig makes it easy to maintain the correct coding style when switching between different text editors and between different projects. The EditorConfig project maintains a file format and plugins for various text editors which allow this file format to be read and used by those editors. For information on the file format and supported text editors, see the `EditorConfig website `_. Installation ============ With setuptools:: sudo python setup.py install Getting Help ============ For help with the EditorConfig core code, please write to our `mailing list `_. Bugs and feature requests should be submitted to our `issue tracker `_. If you are writing a plugin a language that can import Python libraries, you may want to import and use the EditorConfig Python Core directly. Using as a Library ================== Basic example use of EditorConfig Python Core as a library: .. code-block:: python from editorconfig import get_properties, EditorConfigError filename = "/home/zoidberg/humans/anatomy.md" try: options = get_properties(filename) except EditorConfigError: print("Error occurred while getting EditorConfig properties") else: for key, value in options.items(): print(f"{key}={value}") For details, please take a look at the `online documentation `_. Running Test Cases ================== `Cmake `_ has to be installed first. Run the test cases using the following commands:: export PYTHONPATH=$(pwd) cmake . ctest . Use ``-DPYTHON_EXECUTABLE`` to run the tests using an alternative versions of Python (e.g. Python 3.12):: cmake -DPYTHON_EXECUTABLE=/usr/bin/python3.12 . ctest . License ======= See COPYING file for licensing details. ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1749457225.0452065 editorconfig-0.17.1/editorconfig/0000755000175000017500000000000015021514511015433 5ustar00honghong././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1749457063.0 editorconfig-0.17.1/editorconfig/__init__.py0000644000175000017500000000107315021514247017553 0ustar00honghong"""EditorConfig Python Core""" from collections import OrderedDict from editorconfig.versiontools import join_version from editorconfig.version import VERSION __all__ = ['get_properties', 'EditorConfigError', 'exceptions'] __version__ = join_version(VERSION) def get_properties(filename: str) -> OrderedDict[str, str]: """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 * ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1749457063.0 editorconfig-0.17.1/editorconfig/__main__.py0000644000175000017500000000462215021514247017537 0ustar00honghong"""EditorConfig command line interface Licensed under Simplified BSD License (see LICENSE.BSD file). """ import getopt import sys from editorconfig import __version__ from editorconfig.exceptions import ParsingError, PathError, VersionError from editorconfig.handler import EditorConfigHandler from editorconfig.version import VERSION from editorconfig.versiontools import split_version def version() -> None: print("EditorConfig Python Core Version %s" % __version__) def usage(command: str, error: bool = False) -> None: 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() -> None: command_name = sys.argv[0] try: opts, args = getopt.getopt(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': arg_tuple = split_version(arg) if arg_tuple is None: sys.exit("Invalid version number: %s" % arg) version_tuple = arg_tuple 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() ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1749457063.0 editorconfig-0.17.1/editorconfig/exceptions.py0000644000175000017500000000113515021514247020174 0ustar00honghong"""EditorConfig exception classes Licensed under Simplified BSD License (see LICENSE.BSD file). """ class EditorConfigError(Exception): """Parent class of all exceptions raised by EditorConfig""" 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""" ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1749457063.0 editorconfig-0.17.1/editorconfig/fnmatch.py0000644000175000017500000001553115021514247017440 0ustar00honghong"""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 from re import Pattern __all__ = ["fnmatch", "fnmatchcase", "translate"] _cache = {} LEFT_BRACE = re.compile( r""" (? bool: """Test whether FILENAME matches PATTERN. Patterns are Unix shell style: - ``*`` matches everything except path separator - ``**`` matches everything - ``?`` matches any single character - ``[seq]`` matches any character in seq - ``[!seq]`` matches any char not in seq - ``{s1,s2,s3}`` matches any of the strings given (separated by commas) An initial period in FILENAME is not special. Both FILENAME and PATTERN are first case-normalized if the operating system requires it. If you don't want this, use fnmatchcase(FILENAME, PATTERN). """ name = os.path.normpath(name).replace(os.sep, "/") return fnmatchcase(name, pat) def cached_translate(pat: str) -> tuple[Pattern[str], list[tuple[int, int]]]: if not pat in _cache: res, num_groups = translate(pat) regex = re.compile(res) _cache[pat] = regex, num_groups return _cache[pat] def fnmatchcase(name: str, pat: str) -> bool: """Test whether FILENAME matches PATTERN, including case. This is a version of fnmatch() which doesn't case-normalize its arguments. """ regex, num_groups = cached_translate(pat) match = regex.match(name) if not match: return False pattern_matched = True for (num, (min_num, max_num)) in zip(match.groups(), num_groups): if num[0] == '0' or not (min_num <= int(num) <= max_num): pattern_matched = False break return pattern_matched def translate(pat: str, nested: bool = False) -> tuple[str, list[tuple[int, int]]]: """Translate a shell PATTERN to a regular expression. There is no way to quote meta-characters. """ index, length = 0, len(pat) # Current index and length of pattern brace_level = 0 in_brackets = False result = '' is_escaped = False matching_braces = (len(LEFT_BRACE.findall(pat)) == len(RIGHT_BRACE.findall(pat))) numeric_groups = [] while index < length: current_char = pat[index] index += 1 if current_char == '*': pos = index if pos < length and pat[pos] == '*': result += '.*' else: result += '[^/]*' elif current_char == '?': result += '[^/]' elif current_char == '[': if in_brackets: result += '\\[' else: pos = index has_slash = False while pos < length and pat[pos] != ']': if pat[pos] == '/' and pat[pos-1] != '\\': has_slash = True break pos += 1 if has_slash: result += '\\[' + pat[index:(pos + 1)] index = pos + 1 else: if index < length and pat[index] in '!^': index += 1 result += '[^' else: result += '[' in_brackets = True elif current_char == '-': if in_brackets: result += current_char else: result += '\\' + current_char elif current_char == ']': if in_brackets and pat[index-2] == '\\': result += '\\]' else: result += current_char in_brackets = False elif current_char == '{': pos = index has_comma = False while pos < length and (pat[pos] != '}' or is_escaped): if pat[pos] == ',' and not is_escaped: has_comma = True break is_escaped = pat[pos] == '\\' and not is_escaped pos += 1 if not has_comma and pos < length: num_range = NUMERIC_RANGE.match(pat[index:pos]) if num_range: numeric_groups.append((int(num_range.group(1)), int(num_range.group(2)))) result += r"([+-]?\d+)" else: inner_result, inner_groups = translate(pat[index:pos], nested=True) result += '\\{%s\\}' % (inner_result,) numeric_groups += inner_groups index = pos + 1 elif matching_braces: result += '(?:' brace_level += 1 else: result += '\\{' elif current_char == ',': if brace_level > 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 ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1749457063.0 editorconfig-0.17.1/editorconfig/handler.py0000644000175000017500000001063515021514247017435 0ustar00honghong"""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 collections import OrderedDict from editorconfig.exceptions import PathError, VersionError from editorconfig.ini import EditorConfigParser from editorconfig.version import VERSION from editorconfig.versiontools import VersionTuple __all__ = ['EditorConfigHandler'] def get_filenames(path: str, filename: str) -> list[str]: """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: str, conf_filename: str = '.editorconfig', version: VersionTuple = VERSION): """Create EditorConfigHandler for matching given filepath""" self.filepath: str = filepath self.conf_filename: str = conf_filename self.version: VersionTuple = version self.options: OrderedDict[str, str] = OrderedDict() def get_configurations(self) -> OrderedDict[str, str]: """ 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 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) -> None: """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) -> None: """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"] ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1749457063.0 editorconfig-0.17.1/editorconfig/ini.py0000644000175000017500000001462315021514247016600 0ustar00honghong"""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, StreamReaderWriter from collections import OrderedDict from os import sep from os.path import dirname, normpath from editorconfig.exceptions import ParsingError from editorconfig.fnmatch import fnmatch __all__ = ["ParsingError", "EditorConfigParser"] 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