././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1608697212.3936749 EditorConfig-0.12.3/0000755000175100017510000000000000000000000012704 5ustar00treytrey././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1608696434.0 EditorConfig-0.12.3/COPYING0000644000175100017510000000106200000000000013736 0ustar00treytreyCopyright (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=1608697212.3936749 EditorConfig-0.12.3/EditorConfig.egg-info/0000755000175100017510000000000000000000000016752 5ustar00treytrey././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1608697212.0 EditorConfig-0.12.3/EditorConfig.egg-info/PKG-INFO0000644000175100017510000001032000000000000020043 0ustar00treytreyMetadata-Version: 1.1 Name: EditorConfig Version: 0.12.3 Summary: EditorConfig File Locator and Interpreter for Python Home-page: http://editorconfig.org/ Author: EditorConfig Team Author-email: UNKNOWN License: python Description: ======================== 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 "%s=%s" % (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:: cmake . ctest . Use ``-DPYTHON_EXECUTABLE`` to run the tests using an alternative versions of Python (e.g. Python 3):: cmake -DPYTHON_EXECUTABLE=/usr/bin/python3 . ctest . License ======= See COPYING file for licensing details. Platform: UNKNOWN Classifier: License :: OSI Approved :: Python Software Foundation License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: Implementation :: PyPy ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1608697212.0 EditorConfig-0.12.3/EditorConfig.egg-info/SOURCES.txt0000644000175100017510000000072300000000000020640 0ustar00treytreyCOPYING LICENSE.BSD LICENSE.PSF MANIFEST.in README.rst 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/top_level.txt editorconfig/__init__.py editorconfig/__main__.py editorconfig/compat.py editorconfig/exceptions.py editorconfig/fnmatch.py editorconfig/handler.py editorconfig/ini.py editorconfig/version.py editorconfig/versiontools.py././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1608697212.0 EditorConfig-0.12.3/EditorConfig.egg-info/dependency_links.txt0000644000175100017510000000000100000000000023020 0ustar00treytrey ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1608697212.0 EditorConfig-0.12.3/EditorConfig.egg-info/entry_points.txt0000644000175100017510000000007500000000000022252 0ustar00treytrey[console_scripts] editorconfig = editorconfig.__main__:main ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1608697212.0 EditorConfig-0.12.3/EditorConfig.egg-info/top_level.txt0000644000175100017510000000001500000000000021500 0ustar00treytreyeditorconfig ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1608696434.0 EditorConfig-0.12.3/LICENSE.BSD0000644000175100017510000000245200000000000014323 0ustar00treytreyCopyright (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=1608696434.0 EditorConfig-0.12.3/LICENSE.PSF0000644000175100017510000002316400000000000014346 0ustar00treytreyPYTHON 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=1608696434.0 EditorConfig-0.12.3/MANIFEST.in0000644000175100017510000000006300000000000014441 0ustar00treytreyinclude COPYING README.rst LICENSE.BSD LICENSE.PSF ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1608697212.3936749 EditorConfig-0.12.3/PKG-INFO0000644000175100017510000001032000000000000013775 0ustar00treytreyMetadata-Version: 1.1 Name: EditorConfig Version: 0.12.3 Summary: EditorConfig File Locator and Interpreter for Python Home-page: http://editorconfig.org/ Author: EditorConfig Team Author-email: UNKNOWN License: python Description: ======================== 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 "%s=%s" % (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:: cmake . ctest . Use ``-DPYTHON_EXECUTABLE`` to run the tests using an alternative versions of Python (e.g. Python 3):: cmake -DPYTHON_EXECUTABLE=/usr/bin/python3 . ctest . License ======= See COPYING file for licensing details. Platform: UNKNOWN Classifier: License :: OSI Approved :: Python Software Foundation License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: Implementation :: PyPy ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1608696434.0 EditorConfig-0.12.3/README.rst0000644000175100017510000000532000000000000014373 0ustar00treytrey======================== 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 "%s=%s" % (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:: cmake . ctest . Use ``-DPYTHON_EXECUTABLE`` to run the tests using an alternative versions of Python (e.g. Python 3):: cmake -DPYTHON_EXECUTABLE=/usr/bin/python3 . ctest . License ======= See COPYING file for licensing details. ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1608697212.3936749 EditorConfig-0.12.3/editorconfig/0000755000175100017510000000000000000000000015360 5ustar00treytrey././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1608696434.0 EditorConfig-0.12.3/editorconfig/__init__.py0000644000175100017510000000077000000000000017475 0ustar00treytrey"""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 * ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1608696434.0 EditorConfig-0.12.3/editorconfig/__main__.py0000644000175100017510000000456700000000000017466 0ustar00treytrey"""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() ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1608696434.0 EditorConfig-0.12.3/editorconfig/compat.py0000644000175100017510000000071000000000000017213 0ustar00treytrey"""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 ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1608696434.0 EditorConfig-0.12.3/editorconfig/exceptions.py0000644000175100017510000000125100000000000020112 0ustar00treytrey"""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""" ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1608696434.0 EditorConfig-0.12.3/editorconfig/fnmatch.py0000644000175100017510000001524300000000000017357 0ustar00treytrey"""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 ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1608696434.0 EditorConfig-0.12.3/editorconfig/handler.py0000644000175100017510000001031200000000000017344 0ustar00treytrey"""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"] ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1608696434.0 EditorConfig-0.12.3/editorconfig/ini.py0000644000175100017510000001517300000000000016520 0ustar00treytrey"""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