From 5ed4b162daeb7558f81b89229af02015d1f930eb Mon Sep 17 00:00:00 2001 From: "pre-commit-ci-lite[bot]" <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Date: Sat, 12 Jul 2025 08:39:04 +0000 Subject: [PATCH] [pre-commit.ci lite] apply automatic fixes --- app.py | 5 +- venv/bin/Activate.ps1 | 2 +- .../MarkupSafe-3.0.2.dist-info/METADATA | 12 +- .../MarkupSafe-3.0.2.dist-info/WHEEL | 1 - .../blinker-1.9.0.dist-info/METADATA | 1 - .../click-8.2.1.dist-info/METADATA | 1 - .../site-packages/distutils-precedence.pth | 2 +- .../flask-3.1.1.dist-info/METADATA | 1 - .../flask-3.1.1.dist-info/entry_points.txt | 1 - .../gunicorn-23.0.0.dist-info/WHEEL | 1 - .../itsdangerous-2.2.0.dist-info/METADATA | 1 - .../jinja2-3.1.6.dist-info/METADATA | 1 - .../jinja2-3.1.6.dist-info/entry_points.txt | 1 - .../packaging-25.0.dist-info/METADATA | 1 - .../pip-22.0.2.dist-info/METADATA | 2 - .../site-packages/pip-22.0.2.dist-info/WHEEL | 1 - .../pip-22.0.2.dist-info/entry_points.txt | 1 - .../pip/_vendor/chardet/big5freq.py | 1 - .../pip/_vendor/chardet/cli/__init__.py | 1 - .../pip/_vendor/chardet/escsm.py | 2 - .../pip/_vendor/chardet/euckrfreq.py | 1 - .../pip/_vendor/chardet/euctwfreq.py | 1 - .../pip/_vendor/chardet/gb2312freq.py | 1 - .../pip/_vendor/chardet/jisfreq.py | 2 - .../pip/_vendor/chardet/jpcntx.py | 2 - .../pip/_vendor/chardet/langbulgarianmodel.py | 1 - .../pip/_vendor/chardet/langgreekmodel.py | 1 - .../pip/_vendor/chardet/langhebrewmodel.py | 1 - .../pip/_vendor/chardet/langhungarianmodel.py | 1 - .../pip/_vendor/chardet/langrussianmodel.py | 1 - .../pip/_vendor/chardet/langthaimodel.py | 1 - .../pip/_vendor/chardet/langturkishmodel.py | 1 - .../site-packages/pip/_vendor/idna/compat.py | 1 - .../pip/_vendor/idna/package_data.py | 1 - .../pip/_vendor/pygments/__init__.py | 1 - .../pip/_vendor/pygments/formatters/svg.py | 14 +- .../pip/_vendor/pygments/lexers/python.py | 2 +- .../pip/_vendor/requests/sessions.py | 2 +- .../site-packages/pip/_vendor/rich/box.py | 100 ++-- .../site-packages/pip/_vendor/rich/tree.py | 8 +- .../pkg_resources/_vendor/pyparsing.py | 416 +++++++-------- .../setuptools-59.6.0.dist-info/METADATA | 2 - .../setuptools-59.6.0.dist-info/WHEEL | 58 ++- .../entry_points.txt | 473 +++++++++++++++-- .../setuptools/_distutils/cygwinccompiler.py | 493 +++--------------- 45 files changed, 840 insertions(+), 784 deletions(-) diff --git a/app.py b/app.py index 0724e83a..26a7db84 100644 --- a/app.py +++ b/app.py @@ -2,6 +2,7 @@ from flask import Flask app = Flask(__name__) -@app.route('/') + +@app.route("/") def hello(): - return '👋 Hello from Staging Environment!' + return "👋 Hello from Staging Environment!" diff --git a/venv/bin/Activate.ps1 b/venv/bin/Activate.ps1 index b49d77ba..354eb42b 100644 --- a/venv/bin/Activate.ps1 +++ b/venv/bin/Activate.ps1 @@ -44,7 +44,7 @@ command: PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser -For more information on Execution Policies: +For more information on Execution Policies: https://go.microsoft.com/fwlink/?LinkID=135170 #> diff --git a/venv/lib/python3.10/site-packages/MarkupSafe-3.0.2.dist-info/METADATA b/venv/lib/python3.10/site-packages/MarkupSafe-3.0.2.dist-info/METADATA index 82261f2a..385653f8 100644 --- a/venv/lib/python3.10/site-packages/MarkupSafe-3.0.2.dist-info/METADATA +++ b/venv/lib/python3.10/site-packages/MarkupSafe-3.0.2.dist-info/METADATA @@ -4,22 +4,22 @@ Version: 3.0.2 Summary: Safely add untrusted strings to HTML/XML markup. Maintainer-email: Pallets License: Copyright 2010 Pallets - + 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. - + 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + 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 @@ -31,7 +31,7 @@ License: Copyright 2010 Pallets 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. - + Project-URL: Donate, https://palletsprojects.com/donate Project-URL: Documentation, https://markupsafe.palletsprojects.com/ Project-URL: Changes, https://markupsafe.palletsprojects.com/changes/ diff --git a/venv/lib/python3.10/site-packages/MarkupSafe-3.0.2.dist-info/WHEEL b/venv/lib/python3.10/site-packages/MarkupSafe-3.0.2.dist-info/WHEEL index 78f844ea..b05e3fba 100644 --- a/venv/lib/python3.10/site-packages/MarkupSafe-3.0.2.dist-info/WHEEL +++ b/venv/lib/python3.10/site-packages/MarkupSafe-3.0.2.dist-info/WHEEL @@ -3,4 +3,3 @@ Generator: setuptools (75.2.0) Root-Is-Purelib: false Tag: cp310-cp310-manylinux_2_17_x86_64 Tag: cp310-cp310-manylinux2014_x86_64 - diff --git a/venv/lib/python3.10/site-packages/blinker-1.9.0.dist-info/METADATA b/venv/lib/python3.10/site-packages/blinker-1.9.0.dist-info/METADATA index 6d343f57..1857f45a 100644 --- a/venv/lib/python3.10/site-packages/blinker-1.9.0.dist-info/METADATA +++ b/venv/lib/python3.10/site-packages/blinker-1.9.0.dist-info/METADATA @@ -57,4 +57,3 @@ Round 2! This is round two. Round 3! ``` - diff --git a/venv/lib/python3.10/site-packages/click-8.2.1.dist-info/METADATA b/venv/lib/python3.10/site-packages/click-8.2.1.dist-info/METADATA index e6c05af4..da373110 100644 --- a/venv/lib/python3.10/site-packages/click-8.2.1.dist-info/METADATA +++ b/venv/lib/python3.10/site-packages/click-8.2.1.dist-info/METADATA @@ -79,4 +79,3 @@ contribute, including reporting issues, requesting features, asking or answering questions, and making PRs. [contrib]: https://palletsprojects.com/contributing/ - diff --git a/venv/lib/python3.10/site-packages/distutils-precedence.pth b/venv/lib/python3.10/site-packages/distutils-precedence.pth index 6de4198f..03f075b3 100644 --- a/venv/lib/python3.10/site-packages/distutils-precedence.pth +++ b/venv/lib/python3.10/site-packages/distutils-precedence.pth @@ -1 +1 @@ -import os; var = 'SETUPTOOLS_USE_DISTUTILS'; enabled = os.environ.get(var, 'stdlib') == 'local'; enabled and __import__('_distutils_hack').add_shim(); +import os; var = 'SETUPTOOLS_USE_DISTUTILS'; enabled = os.environ.get(var, 'stdlib') == 'local'; enabled and __import__('_distutils_hack').add_shim(); diff --git a/venv/lib/python3.10/site-packages/flask-3.1.1.dist-info/METADATA b/venv/lib/python3.10/site-packages/flask-3.1.1.dist-info/METADATA index 42ce2131..faac7136 100644 --- a/venv/lib/python3.10/site-packages/flask-3.1.1.dist-info/METADATA +++ b/venv/lib/python3.10/site-packages/flask-3.1.1.dist-info/METADATA @@ -86,4 +86,3 @@ contribute, including reporting issues, requesting features, asking or answering questions, and making PRs. [contrib]: https://palletsprojects.com/contributing/ - diff --git a/venv/lib/python3.10/site-packages/flask-3.1.1.dist-info/entry_points.txt b/venv/lib/python3.10/site-packages/flask-3.1.1.dist-info/entry_points.txt index eec6733e..94c78637 100644 --- a/venv/lib/python3.10/site-packages/flask-3.1.1.dist-info/entry_points.txt +++ b/venv/lib/python3.10/site-packages/flask-3.1.1.dist-info/entry_points.txt @@ -1,3 +1,2 @@ [console_scripts] flask=flask.cli:main - diff --git a/venv/lib/python3.10/site-packages/gunicorn-23.0.0.dist-info/WHEEL b/venv/lib/python3.10/site-packages/gunicorn-23.0.0.dist-info/WHEEL index 1a9c5358..332cef06 100644 --- a/venv/lib/python3.10/site-packages/gunicorn-23.0.0.dist-info/WHEEL +++ b/venv/lib/python3.10/site-packages/gunicorn-23.0.0.dist-info/WHEEL @@ -2,4 +2,3 @@ Wheel-Version: 1.0 Generator: setuptools (72.1.0) Root-Is-Purelib: true Tag: py3-none-any - diff --git a/venv/lib/python3.10/site-packages/itsdangerous-2.2.0.dist-info/METADATA b/venv/lib/python3.10/site-packages/itsdangerous-2.2.0.dist-info/METADATA index ddf54648..21b28996 100644 --- a/venv/lib/python3.10/site-packages/itsdangerous-2.2.0.dist-info/METADATA +++ b/venv/lib/python3.10/site-packages/itsdangerous-2.2.0.dist-info/METADATA @@ -57,4 +57,3 @@ users, and allow the maintainers to devote more time to the projects, [please donate today][]. [please donate today]: https://palletsprojects.com/donate - diff --git a/venv/lib/python3.10/site-packages/jinja2-3.1.6.dist-info/METADATA b/venv/lib/python3.10/site-packages/jinja2-3.1.6.dist-info/METADATA index ffef2ff3..e5b46824 100644 --- a/venv/lib/python3.10/site-packages/jinja2-3.1.6.dist-info/METADATA +++ b/venv/lib/python3.10/site-packages/jinja2-3.1.6.dist-info/METADATA @@ -81,4 +81,3 @@ contribute, including reporting issues, requesting features, asking or answering questions, and making PRs. [contrib]: https://palletsprojects.com/contributing/ - diff --git a/venv/lib/python3.10/site-packages/jinja2-3.1.6.dist-info/entry_points.txt b/venv/lib/python3.10/site-packages/jinja2-3.1.6.dist-info/entry_points.txt index abc3eae3..c67b1807 100644 --- a/venv/lib/python3.10/site-packages/jinja2-3.1.6.dist-info/entry_points.txt +++ b/venv/lib/python3.10/site-packages/jinja2-3.1.6.dist-info/entry_points.txt @@ -1,3 +1,2 @@ [babel.extractors] jinja2=jinja2.ext:babel_extract[i18n] - diff --git a/venv/lib/python3.10/site-packages/packaging-25.0.dist-info/METADATA b/venv/lib/python3.10/site-packages/packaging-25.0.dist-info/METADATA index 10b290a6..a6a3522f 100644 --- a/venv/lib/python3.10/site-packages/packaging-25.0.dist-info/METADATA +++ b/venv/lib/python3.10/site-packages/packaging-25.0.dist-info/METADATA @@ -102,4 +102,3 @@ Please review the ``CHANGELOG.rst`` file or the `Changelog documentation`_ for recent changes and project history. .. _`Changelog documentation`: https://packaging.pypa.io/en/latest/changelog/ - diff --git a/venv/lib/python3.10/site-packages/pip-22.0.2.dist-info/METADATA b/venv/lib/python3.10/site-packages/pip-22.0.2.dist-info/METADATA index 29392cd5..c55b0e25 100644 --- a/venv/lib/python3.10/site-packages/pip-22.0.2.dist-info/METADATA +++ b/venv/lib/python3.10/site-packages/pip-22.0.2.dist-info/METADATA @@ -88,5 +88,3 @@ rooms, and mailing lists is expected to follow the `PSF Code of Conduct`_. .. _User IRC: https://kiwiirc.com/nextclient/#ircs://irc.libera.chat:+6697/pypa .. _Development IRC: https://kiwiirc.com/nextclient/#ircs://irc.libera.chat:+6697/pypa-dev .. _PSF Code of Conduct: https://github.com/pypa/.github/blob/main/CODE_OF_CONDUCT.md - - diff --git a/venv/lib/python3.10/site-packages/pip-22.0.2.dist-info/WHEEL b/venv/lib/python3.10/site-packages/pip-22.0.2.dist-info/WHEEL index becc9a66..3cfad325 100644 --- a/venv/lib/python3.10/site-packages/pip-22.0.2.dist-info/WHEEL +++ b/venv/lib/python3.10/site-packages/pip-22.0.2.dist-info/WHEEL @@ -2,4 +2,3 @@ Wheel-Version: 1.0 Generator: bdist_wheel (0.37.1) Root-Is-Purelib: true Tag: py3-none-any - diff --git a/venv/lib/python3.10/site-packages/pip-22.0.2.dist-info/entry_points.txt b/venv/lib/python3.10/site-packages/pip-22.0.2.dist-info/entry_points.txt index c4ad5212..5367846d 100644 --- a/venv/lib/python3.10/site-packages/pip-22.0.2.dist-info/entry_points.txt +++ b/venv/lib/python3.10/site-packages/pip-22.0.2.dist-info/entry_points.txt @@ -2,4 +2,3 @@ pip = pip._internal.cli.main:main pip3 = pip._internal.cli.main:main pip3.10 = pip._internal.cli.main:main - diff --git a/venv/lib/python3.10/site-packages/pip/_vendor/chardet/big5freq.py b/venv/lib/python3.10/site-packages/pip/_vendor/chardet/big5freq.py index 38f32517..0ba64118 100644 --- a/venv/lib/python3.10/site-packages/pip/_vendor/chardet/big5freq.py +++ b/venv/lib/python3.10/site-packages/pip/_vendor/chardet/big5freq.py @@ -383,4 +383,3 @@ BIG5_CHAR_TO_FREQ_ORDER = ( 890,3669,3943,5791,1878,3798,3439,5792,2186,2358,3440,1652,5793,5794,5795, 941, # 5360 2299, 208,3546,4161,2020, 330,4438,3944,2906,2499,3799,4439,4811,5796,5797,5798, # 5376 ) - diff --git a/venv/lib/python3.10/site-packages/pip/_vendor/chardet/cli/__init__.py b/venv/lib/python3.10/site-packages/pip/_vendor/chardet/cli/__init__.py index 8b137891..e69de29b 100644 --- a/venv/lib/python3.10/site-packages/pip/_vendor/chardet/cli/__init__.py +++ b/venv/lib/python3.10/site-packages/pip/_vendor/chardet/cli/__init__.py @@ -1 +0,0 @@ - diff --git a/venv/lib/python3.10/site-packages/pip/_vendor/chardet/escsm.py b/venv/lib/python3.10/site-packages/pip/_vendor/chardet/escsm.py index 0069523a..5b9d5b89 100644 --- a/venv/lib/python3.10/site-packages/pip/_vendor/chardet/escsm.py +++ b/venv/lib/python3.10/site-packages/pip/_vendor/chardet/escsm.py @@ -242,5 +242,3 @@ ISO2022KR_SM_MODEL = {'class_table': ISO2022KR_CLS, 'char_len_table': ISO2022KR_CHAR_LEN_TABLE, 'name': "ISO-2022-KR", 'language': 'Korean'} - - diff --git a/venv/lib/python3.10/site-packages/pip/_vendor/chardet/euckrfreq.py b/venv/lib/python3.10/site-packages/pip/_vendor/chardet/euckrfreq.py index b68078cb..dadd5309 100644 --- a/venv/lib/python3.10/site-packages/pip/_vendor/chardet/euckrfreq.py +++ b/venv/lib/python3.10/site-packages/pip/_vendor/chardet/euckrfreq.py @@ -192,4 +192,3 @@ EUCKR_CHAR_TO_FREQ_ORDER = ( 2629,2630,2631, 924, 648, 863, 603,2632,2633, 934,1540, 864, 865,2634, 642,1042, 670,1190,2635,2636,2637,2638, 168,2639, 652, 873, 542,1054,1541,2640,2641,2642, # 512, 256 ) - diff --git a/venv/lib/python3.10/site-packages/pip/_vendor/chardet/euctwfreq.py b/venv/lib/python3.10/site-packages/pip/_vendor/chardet/euctwfreq.py index ed7a995a..875c6517 100644 --- a/venv/lib/python3.10/site-packages/pip/_vendor/chardet/euctwfreq.py +++ b/venv/lib/python3.10/site-packages/pip/_vendor/chardet/euctwfreq.py @@ -384,4 +384,3 @@ EUCTW_CHAR_TO_FREQ_ORDER = ( 890,3614,3864,8110,1877,3732,3402,8111,2183,2353,3403,1652,8112,8113,8114, 941, # 8086 2294, 208,3499,4057,2019, 330,4294,3865,2892,2492,3733,4295,8115,8116,8117,8118, # 8102 ) - diff --git a/venv/lib/python3.10/site-packages/pip/_vendor/chardet/gb2312freq.py b/venv/lib/python3.10/site-packages/pip/_vendor/chardet/gb2312freq.py index 697837bd..4b01434d 100644 --- a/venv/lib/python3.10/site-packages/pip/_vendor/chardet/gb2312freq.py +++ b/venv/lib/python3.10/site-packages/pip/_vendor/chardet/gb2312freq.py @@ -280,4 +280,3 @@ GB2312_CHAR_TO_FREQ_ORDER = ( 381,1638,4592,1020, 516,3214, 458, 947,4575,1432, 211,1514,2926,1865,2142, 189, 852,1221,1400,1486, 882,2299,4036, 351, 28,1122, 700,6479,6480,6481,6482,6483, #last 512 ) - diff --git a/venv/lib/python3.10/site-packages/pip/_vendor/chardet/jisfreq.py b/venv/lib/python3.10/site-packages/pip/_vendor/chardet/jisfreq.py index 83fc082b..fae844af 100644 --- a/venv/lib/python3.10/site-packages/pip/_vendor/chardet/jisfreq.py +++ b/venv/lib/python3.10/site-packages/pip/_vendor/chardet/jisfreq.py @@ -321,5 +321,3 @@ JIS_CHAR_TO_FREQ_ORDER = ( 1444,1698,2385,2251,3729,1365,2281,2235,1717,6188, 864,3841,2515, 444, 527,2767, # 4352 2922,3625, 544, 461,6189, 566, 209,2437,3398,2098,1065,2068,3331,3626,3257,2137, # 4368 #last 512 ) - - diff --git a/venv/lib/python3.10/site-packages/pip/_vendor/chardet/jpcntx.py b/venv/lib/python3.10/site-packages/pip/_vendor/chardet/jpcntx.py index 20044e4b..c4b81d5c 100644 --- a/venv/lib/python3.10/site-packages/pip/_vendor/chardet/jpcntx.py +++ b/venv/lib/python3.10/site-packages/pip/_vendor/chardet/jpcntx.py @@ -229,5 +229,3 @@ class EUCJPContextAnalysis(JapaneseContextAnalysis): return second_char - 0xA1, char_len return -1, char_len - - diff --git a/venv/lib/python3.10/site-packages/pip/_vendor/chardet/langbulgarianmodel.py b/venv/lib/python3.10/site-packages/pip/_vendor/chardet/langbulgarianmodel.py index e963a509..908209cc 100644 --- a/venv/lib/python3.10/site-packages/pip/_vendor/chardet/langbulgarianmodel.py +++ b/venv/lib/python3.10/site-packages/pip/_vendor/chardet/langbulgarianmodel.py @@ -4647,4 +4647,3 @@ WINDOWS_1251_BULGARIAN_MODEL = SingleByteCharSetModel(charset_name='windows-1251 typical_positive_ratio=0.969392, keep_ascii_letters=False, alphabet='АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЬЮЯабвгдежзийклмнопрстуфхцчшщъьюя') - diff --git a/venv/lib/python3.10/site-packages/pip/_vendor/chardet/langgreekmodel.py b/venv/lib/python3.10/site-packages/pip/_vendor/chardet/langgreekmodel.py index d99528ed..a9f6f13d 100644 --- a/venv/lib/python3.10/site-packages/pip/_vendor/chardet/langgreekmodel.py +++ b/venv/lib/python3.10/site-packages/pip/_vendor/chardet/langgreekmodel.py @@ -4395,4 +4395,3 @@ ISO_8859_7_GREEK_MODEL = SingleByteCharSetModel(charset_name='ISO-8859-7', typical_positive_ratio=0.982851, keep_ascii_letters=False, alphabet='ΆΈΉΊΌΎΏΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩάέήίαβγδεζηθικλμνξοπρςστυφχψωόύώ') - diff --git a/venv/lib/python3.10/site-packages/pip/_vendor/chardet/langhebrewmodel.py b/venv/lib/python3.10/site-packages/pip/_vendor/chardet/langhebrewmodel.py index 484c652a..3e8a8e83 100644 --- a/venv/lib/python3.10/site-packages/pip/_vendor/chardet/langhebrewmodel.py +++ b/venv/lib/python3.10/site-packages/pip/_vendor/chardet/langhebrewmodel.py @@ -4380,4 +4380,3 @@ WINDOWS_1255_HEBREW_MODEL = SingleByteCharSetModel(charset_name='windows-1255', typical_positive_ratio=0.984004, keep_ascii_letters=False, alphabet='אבגדהוזחטיךכלםמןנסעףפץצקרשתװױײ') - diff --git a/venv/lib/python3.10/site-packages/pip/_vendor/chardet/langhungarianmodel.py b/venv/lib/python3.10/site-packages/pip/_vendor/chardet/langhungarianmodel.py index bbc5cda6..4c7779bd 100644 --- a/venv/lib/python3.10/site-packages/pip/_vendor/chardet/langhungarianmodel.py +++ b/venv/lib/python3.10/site-packages/pip/_vendor/chardet/langhungarianmodel.py @@ -4647,4 +4647,3 @@ ISO_8859_2_HUNGARIAN_MODEL = SingleByteCharSetModel(charset_name='ISO-8859-2', typical_positive_ratio=0.947368, keep_ascii_letters=True, alphabet='ABCDEFGHIJKLMNOPRSTUVZabcdefghijklmnoprstuvzÁÉÍÓÖÚÜáéíóöúüŐőŰű') - diff --git a/venv/lib/python3.10/site-packages/pip/_vendor/chardet/langrussianmodel.py b/venv/lib/python3.10/site-packages/pip/_vendor/chardet/langrussianmodel.py index 5594452b..181d5992 100644 --- a/venv/lib/python3.10/site-packages/pip/_vendor/chardet/langrussianmodel.py +++ b/venv/lib/python3.10/site-packages/pip/_vendor/chardet/langrussianmodel.py @@ -5715,4 +5715,3 @@ ISO_8859_5_RUSSIAN_MODEL = SingleByteCharSetModel(charset_name='ISO-8859-5', typical_positive_ratio=0.976601, keep_ascii_letters=False, alphabet='ЁАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюяё') - diff --git a/venv/lib/python3.10/site-packages/pip/_vendor/chardet/langthaimodel.py b/venv/lib/python3.10/site-packages/pip/_vendor/chardet/langthaimodel.py index 9a37db57..fe8d17e6 100644 --- a/venv/lib/python3.10/site-packages/pip/_vendor/chardet/langthaimodel.py +++ b/venv/lib/python3.10/site-packages/pip/_vendor/chardet/langthaimodel.py @@ -4380,4 +4380,3 @@ TIS_620_THAI_MODEL = SingleByteCharSetModel(charset_name='TIS-620', typical_positive_ratio=0.926386, keep_ascii_letters=False, alphabet='กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛') - diff --git a/venv/lib/python3.10/site-packages/pip/_vendor/chardet/langturkishmodel.py b/venv/lib/python3.10/site-packages/pip/_vendor/chardet/langturkishmodel.py index 43f4230a..c28f23dc 100644 --- a/venv/lib/python3.10/site-packages/pip/_vendor/chardet/langturkishmodel.py +++ b/venv/lib/python3.10/site-packages/pip/_vendor/chardet/langturkishmodel.py @@ -4380,4 +4380,3 @@ ISO_8859_9_TURKISH_MODEL = SingleByteCharSetModel(charset_name='ISO-8859-9', typical_positive_ratio=0.97029, keep_ascii_letters=True, alphabet='ABCDEFGHIJKLMNOPRSTUVYZabcdefghijklmnoprstuvyzÂÇÎÖÛÜâçîöûüĞğİıŞş') - diff --git a/venv/lib/python3.10/site-packages/pip/_vendor/idna/compat.py b/venv/lib/python3.10/site-packages/pip/_vendor/idna/compat.py index 786e6bda..52d5b7c9 100644 --- a/venv/lib/python3.10/site-packages/pip/_vendor/idna/compat.py +++ b/venv/lib/python3.10/site-packages/pip/_vendor/idna/compat.py @@ -10,4 +10,3 @@ def ToUnicode(label: Union[bytes, bytearray]) -> str: def nameprep(s: Any) -> None: raise NotImplementedError('IDNA 2008 does not utilise nameprep protocol') - diff --git a/venv/lib/python3.10/site-packages/pip/_vendor/idna/package_data.py b/venv/lib/python3.10/site-packages/pip/_vendor/idna/package_data.py index f5ea87c1..83935d5d 100644 --- a/venv/lib/python3.10/site-packages/pip/_vendor/idna/package_data.py +++ b/venv/lib/python3.10/site-packages/pip/_vendor/idna/package_data.py @@ -1,2 +1 @@ __version__ = '3.3' - diff --git a/venv/lib/python3.10/site-packages/pip/_vendor/pygments/__init__.py b/venv/lib/python3.10/site-packages/pip/_vendor/pygments/__init__.py index 22c50b35..11aabc4f 100644 --- a/venv/lib/python3.10/site-packages/pip/_vendor/pygments/__init__.py +++ b/venv/lib/python3.10/site-packages/pip/_vendor/pygments/__init__.py @@ -80,4 +80,3 @@ def highlight(code, lexer, formatter, outfile=None): it is returned as a string. """ return format(lex(code, lexer), formatter, outfile) - diff --git a/venv/lib/python3.10/site-packages/pip/_vendor/pygments/formatters/svg.py b/venv/lib/python3.10/site-packages/pip/_vendor/pygments/formatters/svg.py index d4de51f0..c567ff5a 100644 --- a/venv/lib/python3.10/site-packages/pip/_vendor/pygments/formatters/svg.py +++ b/venv/lib/python3.10/site-packages/pip/_vendor/pygments/formatters/svg.py @@ -60,11 +60,11 @@ class SvgFormatter(Formatter): `linenostep` If set to a number n > 1, only every nth line number is printed. - + `linenowidth` Maximum width devoted to line numbers (default: ``3*ystep``, sufficient - for up to 4-digit line numbers. Increase width for longer code blocks). - + for up to 4-digit line numbers. Increase width for longer code blocks). + `xoffset` Starting offset in X direction, defaults to ``0``. @@ -132,12 +132,12 @@ class SvgFormatter(Formatter): outfile.write('\n') outfile.write('\n' % (self.fontfamily, self.fontsize)) - - counter = self.linenostart + + counter = self.linenostart counter_step = self.linenostep counter_style = self._get_style(Comment) line_x = x - + if self.linenos: if counter % counter_step == 0: outfile.write('%s' % @@ -161,7 +161,7 @@ class SvgFormatter(Formatter): if self.linenos and counter % counter_step == 0: outfile.write('%s' % (x+self.linenowidth,y,counter_style,counter)) - + counter += 1 outfile.write('' % (line_x,y)) outfile.write(tspan + parts[-1] + tspanend) diff --git a/venv/lib/python3.10/site-packages/pip/_vendor/pygments/lexers/python.py b/venv/lib/python3.10/site-packages/pip/_vendor/pygments/lexers/python.py index 0e7bab99..6286333d 100644 --- a/venv/lib/python3.10/site-packages/pip/_vendor/pygments/lexers/python.py +++ b/venv/lib/python3.10/site-packages/pip/_vendor/pygments/lexers/python.py @@ -214,7 +214,7 @@ class PythonLexer(RegexLexer): (r'(^[ \t]*)' # at beginning of line + possible indentation r'(match|case)\b' # a possible keyword r'(?![ \t]*(?:' # not followed by... - r'[:,;=^&|@~)\]}]|(?:' + # characters and keywords that mean this isn't + r'[:,;=^&|@~)\]}]|(?:' + # characters and keywords that mean this isn't r'|'.join(keyword.kwlist) + r')\b))', # pattern matching bygroups(Text, Keyword), 'soft-keywords-inner'), ], diff --git a/venv/lib/python3.10/site-packages/pip/_vendor/requests/sessions.py b/venv/lib/python3.10/site-packages/pip/_vendor/requests/sessions.py index 3f59cab9..25b65eaa 100644 --- a/venv/lib/python3.10/site-packages/pip/_vendor/requests/sessions.py +++ b/venv/lib/python3.10/site-packages/pip/_vendor/requests/sessions.py @@ -493,7 +493,7 @@ class Session(SessionRedirectMixin): ``False``, requests will accept any TLS certificate presented by the server, and will ignore hostname mismatches and/or expired certificates, which will make your application vulnerable to - man-in-the-middle (MitM) attacks. Setting verify to ``False`` + man-in-the-middle (MitM) attacks. Setting verify to ``False`` may be useful during local development or testing. :param cert: (optional) if String, path to ssl client cert file (.pem). If Tuple, ('cert', 'key') pair. diff --git a/venv/lib/python3.10/site-packages/pip/_vendor/rich/box.py b/venv/lib/python3.10/site-packages/pip/_vendor/rich/box.py index aec2926b..467ec904 100644 --- a/venv/lib/python3.10/site-packages/pip/_vendor/rich/box.py +++ b/venv/lib/python3.10/site-packages/pip/_vendor/rich/box.py @@ -248,96 +248,96 @@ SQUARE_DOUBLE_HEAD: Box = Box( MINIMAL: Box = Box( """\ - ╷ - │ + ╷ + │ ╶─┼╴ - │ + │ ╶─┼╴ ╶─┼╴ - │ - ╵ + │ + ╵ """ ) MINIMAL_HEAVY_HEAD: Box = Box( """\ - ╷ - │ + ╷ + │ ╺━┿╸ - │ + │ ╶─┼╴ ╶─┼╴ - │ - ╵ + │ + ╵ """ ) MINIMAL_DOUBLE_HEAD: Box = Box( """\ - ╷ - │ - ═╪ - │ - ─┼ - ─┼ - │ - ╵ + ╷ + │ + ═╪ + │ + ─┼ + ─┼ + │ + ╵ """ ) SIMPLE: Box = Box( """\ - - - ── - - - ── - - + + + ── + + + ── + + """ ) SIMPLE_HEAD: Box = Box( """\ - - - ── - - - - - + + + ── + + + + + """ ) SIMPLE_HEAVY: Box = Box( """\ - - - ━━ - - - ━━ - - + + + ━━ + + + ━━ + + """ ) HORIZONTALS: Box = Box( """\ - ── - - ── - - ── - ── - - ── + ── + + ── + + ── + ── + + ── """ ) diff --git a/venv/lib/python3.10/site-packages/pip/_vendor/rich/tree.py b/venv/lib/python3.10/site-packages/pip/_vendor/rich/tree.py index c5ec27da..0c20cf3f 100644 --- a/venv/lib/python3.10/site-packages/pip/_vendor/rich/tree.py +++ b/venv/lib/python3.10/site-packages/pip/_vendor/rich/tree.py @@ -214,9 +214,9 @@ if __name__ == "__main__": # pragma: no cover code = """\ class Segment(NamedTuple): - text: str = "" - style: Optional[Style] = None - is_control: bool = False + text: str = "" + style: Optional[Style] = None + is_control: bool = False """ syntax = Syntax(code, "python", theme="monokai", line_numbers=True) @@ -224,7 +224,7 @@ class Segment(NamedTuple): """\ ### example.md > Hello, World! -> +> > Markdown _all_ the things """ ) diff --git a/venv/lib/python3.10/site-packages/pkg_resources/_vendor/pyparsing.py b/venv/lib/python3.10/site-packages/pkg_resources/_vendor/pyparsing.py index cf75e1e5..396d97af 100644 --- a/venv/lib/python3.10/site-packages/pkg_resources/_vendor/pyparsing.py +++ b/venv/lib/python3.10/site-packages/pkg_resources/_vendor/pyparsing.py @@ -32,8 +32,8 @@ vs. the traditional lex/yacc approach, or the use of regular expressions. With don't need to learn a new syntax for defining grammars or matching expressions - the parsing module provides a library of classes that you use to construct the grammar directly in Python. -Here is a program to parse "Hello, World!" (or any greeting of the form -C{", !"}), built up using L{Word}, L{Literal}, and L{And} elements +Here is a program to parse "Hello, World!" (or any greeting of the form +C{", !"}), built up using L{Word}, L{Literal}, and L{And} elements (L{'+'} operator gives L{And} expressions, strings are auto-converted to L{Literal} expressions):: @@ -121,7 +121,7 @@ __all__ = [ 'MatchFirst', 'NoMatch', 'NotAny', 'OneOrMore', 'OnlyOnce', 'Optional', 'Or', 'ParseBaseException', 'ParseElementEnhance', 'ParseException', 'ParseExpression', 'ParseFatalException', 'ParseResults', 'ParseSyntaxException', 'ParserElement', 'QuotedString', 'RecursiveGrammarException', -'Regex', 'SkipTo', 'StringEnd', 'StringStart', 'Suppress', 'Token', 'TokenConverter', +'Regex', 'SkipTo', 'StringEnd', 'StringStart', 'Suppress', 'Token', 'TokenConverter', 'White', 'Word', 'WordEnd', 'WordStart', 'ZeroOrMore', 'alphanums', 'alphas', 'alphas8bit', 'anyCloseTag', 'anyOpenTag', 'cStyleComment', 'col', 'commaSeparatedList', 'commonHTMLEntity', 'countedArray', 'cppStyleComment', 'dblQuotedString', @@ -129,7 +129,7 @@ __all__ = [ 'htmlComment', 'javaStyleComment', 'line', 'lineEnd', 'lineStart', 'lineno', 'makeHTMLTags', 'makeXMLTags', 'matchOnlyAtCol', 'matchPreviousExpr', 'matchPreviousLiteral', 'nestedExpr', 'nullDebugAction', 'nums', 'oneOf', 'opAssoc', 'operatorPrecedence', 'printables', -'punc8bit', 'pythonStyleComment', 'quotedString', 'removeQuotes', 'replaceHTMLEntity', +'punc8bit', 'pythonStyleComment', 'quotedString', 'removeQuotes', 'replaceHTMLEntity', 'replaceWith', 'restOfLine', 'sglQuotedString', 'srange', 'stringEnd', 'stringStart', 'traceParseAction', 'unicodeString', 'upcaseTokens', 'withAttribute', 'indentedBlock', 'originalTextFor', 'ungroup', 'infixNotation','locatedExpr', 'withClass', @@ -179,9 +179,9 @@ else: singleArgBuiltins.append(getattr(__builtin__,fname)) except AttributeError: continue - + _generatorType = type((y for y in range(1))) - + def _xml_escape(data): """Escape &, <, >, ", ', etc. in a string of data.""" @@ -220,7 +220,7 @@ class ParseBaseException(Exception): @classmethod def _from_exception(cls, pe): """ - internal factory method to simplify creating one type of ParseException + internal factory method to simplify creating one type of ParseException from another - avoids having __init__ signature conflicts among subclasses """ return cls(pe.pstr, pe.loc, pe.msg, pe.parserElement) @@ -265,14 +265,14 @@ class ParseException(ParseBaseException): - lineno - returns the line number of the exception text - col - returns the column number of the exception text - line - returns the line containing the exception text - + Example:: try: Word(nums).setName("integer").parseString("ABC") except ParseException as pe: print(pe) print("column: {}".format(pe.col)) - + prints:: Expected integer (at char 0), (line:1, col:1) column: 1 @@ -286,7 +286,7 @@ class ParseFatalException(ParseBaseException): class ParseSyntaxException(ParseFatalException): """just like L{ParseFatalException}, but thrown internally when an - L{ErrorStop} ('-' operator) indicates that parsing is to stop + L{ErrorStop} ('-' operator) indicates that parsing is to stop immediately because an unbacktrackable syntax error has been found""" pass @@ -330,8 +330,8 @@ class ParseResults(object): Example:: integer = Word(nums) - date_str = (integer.setResultsName("year") + '/' - + integer.setResultsName("month") + '/' + date_str = (integer.setResultsName("year") + '/' + + integer.setResultsName("month") + '/' + integer.setResultsName("day")) # equivalent form: # date_str = integer("year") + '/' + integer("month") + '/' + integer("day") @@ -467,12 +467,12 @@ class ParseResults(object): def _itervalues( self ): return (self[k] for k in self._iterkeys()) - + def _iteritems( self ): return ((k, self[k]) for k in self._iterkeys()) if PY_3: - keys = _iterkeys + keys = _iterkeys """Returns an iterator of all named result keys (Python 3.x only).""" values = _itervalues @@ -498,7 +498,7 @@ class ParseResults(object): def values( self ): """Returns all named result values (as a list in Python 2.x, as an iterator in Python 3.x).""" return list(self.itervalues()) - + def items( self ): """Returns all named result key-values (as a list of tuples in Python 2.x, as an iterator in Python 3.x).""" return list(self.iteritems()) @@ -507,16 +507,16 @@ class ParseResults(object): """Since keys() returns an iterator, this method is helpful in bypassing code that looks for the existence of any defined results names.""" return bool(self.__tokdict) - + def pop( self, *args, **kwargs): """ Removes and returns item at specified index (default=C{last}). Supports both C{list} and C{dict} semantics for C{pop()}. If passed no argument or an integer argument, it will use C{list} semantics - and pop tokens from the list of parsed tokens. If passed a + and pop tokens from the list of parsed tokens. If passed a non-integer argument (most likely a string), it will use C{dict} - semantics and pop the corresponding value from any defined - results names. A second default return value argument is + semantics and pop the corresponding value from any defined + results names. A second default return value argument is supported, just as in C{dict.pop()}. Example:: @@ -549,8 +549,8 @@ class ParseResults(object): args = (args[0], v) else: raise TypeError("pop() got an unexpected keyword argument '%s'" % k) - if (isinstance(args[0], int) or - len(args) == 1 or + if (isinstance(args[0], int) or + len(args) == 1 or args[0] in self): index = args[0] ret = self[index] @@ -567,10 +567,10 @@ class ParseResults(object): C{defaultValue} is specified. Similar to C{dict.get()}. - + Example:: integer = Word(nums) - date_str = integer("year") + '/' + integer("month") + '/' + integer("day") + date_str = integer("year") + '/' + integer("month") + '/' + integer("day") result = date_str.parseString("1999/12/31") print(result.get("year")) # -> '1999' @@ -585,7 +585,7 @@ class ParseResults(object): def insert( self, index, insStr ): """ Inserts new element at location index in the list of parsed tokens. - + Similar to C{list.insert()}. Example:: @@ -608,7 +608,7 @@ class ParseResults(object): Example:: print(OneOrMore(Word(nums)).parseString("0 123 321")) # -> ['0', '123', '321'] - + # use a parse action to compute the sum of the parsed integers, and add it to the end def append_sum(tokens): tokens.append(sum(map(int, tokens))) @@ -622,7 +622,7 @@ class ParseResults(object): Example:: patt = OneOrMore(Word(alphas)) - + # use a parse action to append the reverse of the matched strings, to make a palindrome def make_palindrome(tokens): tokens.extend(reversed([t[::-1] for t in tokens])) @@ -646,7 +646,7 @@ class ParseResults(object): return self[name] except KeyError: return "" - + if name in self.__tokdict: if name not in self.__accumNames: return self.__tokdict[name][-1][0] @@ -671,7 +671,7 @@ class ParseResults(object): self[k] = v if isinstance(v[0],ParseResults): v[0].__parent = wkref(self) - + self.__toklist += other.__toklist self.__accumNames.update( other.__accumNames ) return self @@ -683,7 +683,7 @@ class ParseResults(object): else: # this may raise a TypeError - so be it return other + self - + def __repr__( self ): return "(%s, %s)" % ( repr( self.__toklist ), repr( self.__tokdict ) ) @@ -710,7 +710,7 @@ class ParseResults(object): result = patt.parseString("sldkj lsdkj sldkj") # even though the result prints in string-like form, it is actually a pyparsing ParseResults print(type(result), result) # -> ['sldkj', 'lsdkj', 'sldkj'] - + # Use asList() to create an actual list result_list = result.asList() print(type(result_list), result_list) # -> ['sldkj', 'lsdkj', 'sldkj'] @@ -724,10 +724,10 @@ class ParseResults(object): Example:: integer = Word(nums) date_str = integer("year") + '/' + integer("month") + '/' + integer("day") - + result = date_str.parseString('12/31/1999') print(type(result), repr(result)) # -> (['12', '/', '31', '/', '1999'], {'day': [('1999', 4)], 'year': [('12', 0)], 'month': [('31', 2)]}) - + result_dict = result.asDict() print(type(result_dict), repr(result_dict)) # -> {'day': '1999', 'year': '12', 'month': '31'} @@ -740,7 +740,7 @@ class ParseResults(object): item_fn = self.items else: item_fn = self.iteritems - + def toItem(obj): if isinstance(obj, ParseResults): if obj.haskeys(): @@ -749,7 +749,7 @@ class ParseResults(object): return [toItem(v) for v in obj] else: return obj - + return dict((k,toItem(v)) for k,v in item_fn()) def copy( self ): @@ -833,18 +833,18 @@ class ParseResults(object): def getName(self): r""" - Returns the results name for this token expression. Useful when several + Returns the results name for this token expression. Useful when several different expressions might match at a particular location. Example:: integer = Word(nums) ssn_expr = Regex(r"\d\d\d-\d\d-\d\d\d\d") house_number_expr = Suppress('#') + Word(nums, alphanums) - user_data = (Group(house_number_expr)("house_number") + user_data = (Group(house_number_expr)("house_number") | Group(ssn_expr)("ssn") | Group(integer)("age")) user_info = OneOrMore(user_data) - + result = user_info.parseString("22 111-22-3333 #221B") for item in result: print(item.getName(), ':', item[0]) @@ -877,7 +877,7 @@ class ParseResults(object): Example:: integer = Word(nums) date_str = integer("year") + '/' + integer("month") + '/' + integer("day") - + result = date_str.parseString('12/31/1999') print(result.dump()) prints:: @@ -910,13 +910,13 @@ class ParseResults(object): out.append("\n%s%s[%d]:\n%s%s%s" % (indent,(' '*(depth)),i,indent,(' '*(depth+1)),vv.dump(indent,depth+1) )) else: out.append("\n%s%s[%d]:\n%s%s%s" % (indent,(' '*(depth)),i,indent,(' '*(depth+1)),_ustr(vv))) - + return "".join(out) def pprint(self, *args, **kwargs): """ Pretty-printer for parsed results as a list, using the C{pprint} module. - Accepts additional positional or keyword args as defined for the + Accepts additional positional or keyword args as defined for the C{pprint.pprint} method. (U{http://docs.python.org/3/library/pprint.html#pprint.pprint}) Example:: @@ -1041,7 +1041,7 @@ def _trim_arity(func, maxargs=2): return lambda s,l,t: func(t) limit = [0] foundArity = [False] - + # traceback return data structure changed in Py3.5 - normalize back to plain tuples if system_version[:2] >= (3,5): def extract_stack(limit=0): @@ -1056,12 +1056,12 @@ def _trim_arity(func, maxargs=2): else: extract_stack = traceback.extract_stack extract_tb = traceback.extract_tb - - # synthesize what would be returned by traceback.extract_stack at the call to + + # synthesize what would be returned by traceback.extract_stack at the call to # user's parse action 'func', so that we don't incur call penalty at parse time - + LINE_DIFF = 6 - # IF ANY CODE CHANGES, EVEN JUST COMMENTS OR BLANK LINES, BETWEEN THE NEXT LINE AND + # IF ANY CODE CHANGES, EVEN JUST COMMENTS OR BLANK LINES, BETWEEN THE NEXT LINE AND # THE CALL TO FUNC INSIDE WRAPPER, LINE_DIFF MUST BE MODIFIED!!!! this_line = extract_stack(limit=2)[-1] pa_call_line_synth = (this_line[0], this_line[1]+LINE_DIFF) @@ -1092,7 +1092,7 @@ def _trim_arity(func, maxargs=2): # copy func name to wrapper for sensible debug output func_name = "" try: - func_name = getattr(func, '__name__', + func_name = getattr(func, '__name__', getattr(func, '__class__').__name__) except Exception: func_name = str(func) @@ -1113,7 +1113,7 @@ class ParserElement(object): Example:: # default whitespace chars are space, and newline OneOrMore(Word(alphas)).parseString("abc def\nghi jkl") # -> ['abc', 'def', 'ghi', 'jkl'] - + # change to just treat newline as significant ParserElement.setDefaultWhitespaceChars(" \t") OneOrMore(Word(alphas)).parseString("abc def\nghi jkl") # -> ['abc', 'def'] @@ -1124,18 +1124,18 @@ class ParserElement(object): def inlineLiteralsUsing(cls): """ Set class to be used for inclusion of string literals into a parser. - + Example:: # default literal class used is Literal integer = Word(nums) - date_str = integer("year") + '/' + integer("month") + '/' + integer("day") + date_str = integer("year") + '/' + integer("month") + '/' + integer("day") date_str.parseString("1999/12/31") # -> ['1999', '/', '12', '/', '31'] # change to Suppress ParserElement.inlineLiteralsUsing(Suppress) - date_str = integer("year") + '/' + integer("month") + '/' + integer("day") + date_str = integer("year") + '/' + integer("month") + '/' + integer("day") date_str.parseString("1999/12/31") # -> ['1999', '12', '31'] """ @@ -1168,12 +1168,12 @@ class ParserElement(object): """ Make a copy of this C{ParserElement}. Useful for defining different parse actions for the same parsing pattern, using copies of the original parse element. - + Example:: integer = Word(nums).setParseAction(lambda toks: int(toks[0])) integerK = integer.copy().addParseAction(lambda toks: toks[0]*1024) + Suppress("K") integerM = integer.copy().addParseAction(lambda toks: toks[0]*1024*1024) + Suppress("M") - + print(OneOrMore(integerK | integerM | integer).parseString("5K 100 640K 256M")) prints:: [5120, 100, 655360, 268435456] @@ -1190,7 +1190,7 @@ class ParserElement(object): def setName( self, name ): """ Define name for this expression, makes debugging and exception messages clearer. - + Example:: Word(nums).parseString("ABC") # -> Exception: Expected W:(0123...) (at char 0), (line:1, col:1) Word(nums).setName("integer").parseString("ABC") # -> Exception: Expected integer (at char 0), (line:1, col:1) @@ -1210,12 +1210,12 @@ class ParserElement(object): integer, and reference it in multiple places with different names. You can also set results names using the abbreviated syntax, - C{expr("name")} in place of C{expr.setResultsName("name")} - + C{expr("name")} in place of C{expr.setResultsName("name")} - see L{I{__call__}<__call__>}. Example:: - date_str = (integer.setResultsName("year") + '/' - + integer.setResultsName("month") + '/' + date_str = (integer.setResultsName("year") + '/' + + integer.setResultsName("month") + '/' + integer.setResultsName("day")) # equivalent form: @@ -1267,7 +1267,7 @@ class ParserElement(object): on parsing strings containing C{}s, and suggested methods to maintain a consistent view of the parsed string, the parse location, and line and column positions within the parsed string. - + Example:: integer = Word(nums) date_str = integer + '/' + integer + '/' + integer @@ -1288,7 +1288,7 @@ class ParserElement(object): def addParseAction( self, *fns, **kwargs ): """ Add one or more parse actions to expression's list of parse actions. See L{I{setParseAction}}. - + See examples in L{I{copy}}. """ self.parseAction += list(map(_trim_arity, list(fns))) @@ -1296,14 +1296,14 @@ class ParserElement(object): return self def addCondition(self, *fns, **kwargs): - """Add a boolean predicate function to expression's list of parse actions. See - L{I{setParseAction}} for function call signatures. Unlike C{setParseAction}, + """Add a boolean predicate function to expression's list of parse actions. See + L{I{setParseAction}} for function call signatures. Unlike C{setParseAction}, functions passed to C{addCondition} need to return boolean success/fail of the condition. Optional keyword arguments: - message = define a custom message to be used in the raised exception - fatal = if True, will raise ParseFatalException to stop parsing immediately; otherwise will raise ParseException - + Example:: integer = Word(nums).setParseAction(lambda toks: int(toks[0])) year_int = integer.copy() @@ -1443,7 +1443,7 @@ class ParserElement(object): return self._parse( instring, loc, doActions=False )[0] except ParseFatalException: raise ParseException( instring, loc, self.errmsg, self) - + def canParseNext(self, instring, loc): try: self.tryParse(instring, loc) @@ -1465,7 +1465,7 @@ class ParserElement(object): def clear(self): cache.clear() - + def cache_len(self): return len(cache) @@ -1577,13 +1577,13 @@ class ParserElement(object): often in many complex grammars) can immediately return a cached value, instead of re-executing parsing/validating code. Memoizing is done of both valid results and parsing exceptions. - + Parameters: - cache_size_limit - (default=C{128}) - if an integer value is provided will limit the size of the packrat cache; if None is passed, then the cache size will be unbounded; if 0 is passed, the cache will be effectively disabled. - + This speedup may break existing programs that use parse actions that have side-effects. For this reason, packrat parsing is disabled when you first import pyparsing. To activate the packrat feature, your @@ -1592,7 +1592,7 @@ class ParserElement(object): C{enablePackrat} before calling C{psyco.full()}. If you do not do this, Python will crash. For best results, call C{enablePackrat()} immediately after importing pyparsing. - + Example:: import pyparsing pyparsing.ParserElement.enablePackrat() @@ -1627,7 +1627,7 @@ class ParserElement(object): reference the input string using the parse action's C{s} argument - explictly expand the tabs in your input string before calling C{parseString} - + Example:: Word('a').parseString('aaaaabaaa') # -> ['aaaaa'] Word('a').parseString('aaaaabaaa', parseAll=True) # -> Exception: Expected end of text @@ -1672,9 +1672,9 @@ class ParserElement(object): for tokens,start,end in Word(alphas).scanString(source): print(' '*start + '^'*(end-start)) print(' '*start + tokens[0]) - + prints:: - + sldjf123lsdjjkf345sldkjf879lkjsfd987 ^^^^^ sldjf @@ -1734,11 +1734,11 @@ class ParserElement(object): Invoking C{transformString()} on a target string will then scan for matches, and replace the matched text patterns according to the logic in the parse action. C{transformString()} returns the resulting transformed string. - + Example:: wd = Word(alphas) wd.setParseAction(lambda toks: toks[0].title()) - + print(wd.transformString("now is the winter of our discontent made glorious summer by this sun of york.")) Prints:: Now Is The Winter Of Our Discontent Made Glorious Summer By This Sun Of York. @@ -1774,11 +1774,11 @@ class ParserElement(object): Another extension to C{L{scanString}}, simplifying the access to the tokens found to match the given parse expression. May be called with optional C{maxMatches} argument, to clip searching after 'n' matches are found. - + Example:: # a capitalized word starts with an uppercase letter, followed by zero or more lowercase letters cap_word = Word(alphas.upper(), alphas.lower()) - + print(cap_word.searchString("More than Iron, more than Lead, more than Gold I need Electricity")) # the sum() builtin can be used to merge results into a single ParseResults object @@ -1802,8 +1802,8 @@ class ParserElement(object): May be called with optional C{maxsplit} argument, to limit the number of splits; and the optional C{includeSeparators} argument (default=C{False}), if the separating matching text should be included in the split results. - - Example:: + + Example:: punc = oneOf(list(".,;:/-!?")) print(list(punc.split("This, this?, this sentence, is badly punctuated!"))) prints:: @@ -1822,7 +1822,7 @@ class ParserElement(object): """ Implementation of + operator - returns C{L{And}}. Adding strings to a ParserElement converts them to L{Literal}s by default. - + Example:: greet = Word(alphas) + "," + Word(alphas) + "!" hello = "Hello, World!" @@ -2026,16 +2026,16 @@ class ParserElement(object): def __call__(self, name=None): """ Shortcut for C{L{setResultsName}}, with C{listAllMatches=False}. - + If C{name} is given with a trailing C{'*'} character, then C{listAllMatches} will be passed as C{True}. - + If C{name} is omitted, same as calling C{L{copy}}. Example:: # these are equivalent userdata = Word(alphas).setResultsName("name") + Word(nums+"-").setResultsName("socsecno") - userdata = Word(alphas)("name") + Word(nums+"-")("socsecno") + userdata = Word(alphas)("name") + Word(nums+"-")("socsecno") """ if name is not None: return self.setResultsName(name) @@ -2081,11 +2081,11 @@ class ParserElement(object): Define expression to be ignored (e.g., comments) while doing pattern matching; may be called repeatedly, to define multiple comment or other ignorable patterns. - + Example:: patt = OneOrMore(Word(alphas)) patt.parseString('ablaj /* comment */ lskjd') # -> ['ablaj'] - + patt.ignore(cStyleComment) patt.parseString('ablaj /* comment */ lskjd') # -> ['ablaj', 'lskjd'] """ @@ -2118,12 +2118,12 @@ class ParserElement(object): wd = Word(alphas).setName("alphaword") integer = Word(nums).setName("numword") term = wd | integer - + # turn on debugging for wd wd.setDebug() OneOrMore(term).parseString("abc 123 xyz 890") - + prints:: Match alphaword at loc 0(1,1) Matched alphaword -> ['abc'] @@ -2212,13 +2212,13 @@ class ParserElement(object): def matches(self, testString, parseAll=True): """ - Method for quick testing of a parser against a test string. Good for simple + Method for quick testing of a parser against a test string. Good for simple inline microtests of sub expressions while building up larger parser. - + Parameters: - testString - to test against this expression for a match - parseAll - (default=C{True}) - flag to pass to C{L{parseString}} when running tests - + Example:: expr = Word(nums) assert expr.matches("100") @@ -2228,17 +2228,17 @@ class ParserElement(object): return True except ParseBaseException: return False - + def runTests(self, tests, parseAll=True, comment='#', fullDump=True, printResults=True, failureTests=False): """ Execute the parse expression on a series of test strings, showing each test, the parsed results or where the parse failed. Quick and easy way to run a parse expression against a list of sample strings. - + Parameters: - tests - a list of separate test strings, or a multiline string of test strings - - parseAll - (default=C{True}) - flag to pass to C{L{parseString}} when running tests - - comment - (default=C{'#'}) - expression for indicating embedded comments in the test + - parseAll - (default=C{True}) - flag to pass to C{L{parseString}} when running tests + - comment - (default=C{'#'}) - expression for indicating embedded comments in the test string; pass None to disable comment filtering - fullDump - (default=C{True}) - dump results as list followed by results names in nested outline; if False, only dump nested list @@ -2246,9 +2246,9 @@ class ParserElement(object): - failureTests - (default=C{False}) indicates if these tests are expected to fail parsing Returns: a (success, results) tuple, where success indicates that all tests succeeded - (or failed if C{failureTests} is True), and the results contain a list of lines of each + (or failed if C{failureTests} is True), and the results contain a list of lines of each test's output - + Example:: number_expr = pyparsing_common.number.copy() @@ -2291,7 +2291,7 @@ class ParserElement(object): [1e-12] Success - + # stray character 100Z ^ @@ -2313,7 +2313,7 @@ class ParserElement(object): lines, create a test like this:: expr.runTest(r"this is a test\\n of strings that spans \\n 3 lines") - + (Note that this is a raw string literal, you must include the leading 'r'.) """ if isinstance(tests, basestring): @@ -2357,10 +2357,10 @@ class ParserElement(object): print('\n'.join(out)) allResults.append((t, result)) - + return success, allResults - + class Token(ParserElement): """ Abstract C{ParserElement} subclass, for defining atomic matching patterns. @@ -2398,14 +2398,14 @@ class NoMatch(Token): class Literal(Token): """ Token to exactly match a specified string. - + Example:: Literal('blah').parseString('blah') # -> ['blah'] Literal('blah').parseString('blahfooblah') # -> ['blah'] Literal('blah').parseString('bla') # -> Exception: Expected "blah" - + For case-insensitive matching, use L{CaselessLiteral}. - + For keyword matching (force word break before and after the matched string), use L{Keyword} or L{CaselessKeyword}. """ @@ -2446,7 +2446,7 @@ class Keyword(Token): - C{identChars} is a string of characters that would be valid identifier characters, defaulting to all alphanumerics + "_" and "$" - C{caseless} allows case-insensitive matching, default is C{False}. - + Example:: Keyword("start").parseString("start") # -> ['start'] Keyword("start").parseString("starting") # -> Exception @@ -2509,7 +2509,7 @@ class CaselessLiteral(Literal): Example:: OneOrMore(CaselessLiteral("CMD")).parseString("cmd CMD Cmd10") # -> ['CMD', 'CMD', 'CMD'] - + (Contrast with example for L{CaselessKeyword}.) """ def __init__( self, matchString ): @@ -2530,7 +2530,7 @@ class CaselessKeyword(Keyword): Example:: OneOrMore(CaselessKeyword("CMD")).parseString("cmd CMD Cmd10") # -> ['CMD', 'CMD'] - + (Contrast with example for L{CaselessLiteral}.) """ def __init__( self, matchString, identChars=None ): @@ -2544,17 +2544,17 @@ class CaselessKeyword(Keyword): class CloseMatch(Token): """ - A variation on L{Literal} which matches "close" matches, that is, + A variation on L{Literal} which matches "close" matches, that is, strings with at most 'n' mismatching characters. C{CloseMatch} takes parameters: - C{match_string} - string to be matched - C{maxMismatches} - (C{default=1}) maximum number of mismatches allowed to count as a match - + The results from a successful parse will contain the matched text from the input string and the following named results: - C{mismatches} - a list of the positions within the match_string where mismatches were found - C{original} - the original match_string used to compare against the input string - + If C{mismatches} is an empty list, then the match was an exact match. - + Example:: patt = CloseMatch("ATCATCGAATGGA") patt.parseString("ATCATCGAAXGGA") # -> (['ATCATCGAAXGGA'], {'mismatches': [[9]], 'original': ['ATCATCGAATGGA']}) @@ -2612,14 +2612,14 @@ class Word(Token): maximum, and/or exact length. The default value for C{min} is 1 (a minimum value < 1 is not valid); the default values for C{max} and C{exact} are 0, meaning no maximum or exact length restriction. An optional - C{excludeChars} parameter can list characters that might be found in + C{excludeChars} parameter can list characters that might be found in the input C{bodyChars} string; useful to define a word of all printables except for one or two characters, for instance. - - L{srange} is useful for defining custom character set strings for defining + + L{srange} is useful for defining custom character set strings for defining C{Word} expressions, using range notation from regular expression character sets. - - A common mistake is to use C{Word} to match a specific literal string, as in + + A common mistake is to use C{Word} to match a specific literal string, as in C{Word("Address")}. Remember that C{Word} uses the string argument to define I{sets} of matchable characters. This expression would match "Add", "AAA", "dAred", or any other word made up of the characters 'A', 'd', 'r', 'e', and 's'. @@ -2637,16 +2637,16 @@ class Word(Token): Example:: # a word composed of digits integer = Word(nums) # equivalent to Word("0123456789") or Word(srange("0-9")) - + # a word with a leading capital, and zero or more lowercase capital_word = Word(alphas.upper(), alphas.lower()) # hostnames are alphanumeric, with leading alpha, and '-' hostname = Word(alphas, alphanums+'-') - + # roman numeral (not a strict parser, accepts invalid mix of characters) roman = Word("IVXLCDM") - + # any string of non-whitespace characters, except for ',' csv_value = Word(printables, excludeChars=",") """ @@ -2766,7 +2766,7 @@ class Regex(Token): r""" Token for matching strings that match a given regular expression. Defined with string specifying the regular expression in a form recognized by the inbuilt Python re module. - If the given regex contains named groups (defined using C{(?P...)}), these will be preserved as + If the given regex contains named groups (defined using C{(?P...)}), these will be preserved as named parse results. Example:: @@ -2801,7 +2801,7 @@ class Regex(Token): self.pattern = \ self.reString = str(pattern) self.flags = flags - + else: raise ValueError("Regex may only be constructed with a string or a compiled RE object") @@ -2838,7 +2838,7 @@ class Regex(Token): class QuotedString(Token): r""" Token for matching strings that are delimited by quoting characters. - + Defined with the following parameters: - quoteChar - string of one or more characters defining the quote delimiting string - escChar - character to escape quotes, typically backslash (default=C{None}) @@ -3130,9 +3130,9 @@ class GoToColumn(_PositionToken): class LineStart(_PositionToken): """ Matches if current position is at the beginning of a line within the parse string - + Example:: - + test = '''\ AAA this line AAA and this line @@ -3142,10 +3142,10 @@ class LineStart(_PositionToken): for t in (LineStart() + 'AAA' + restOfLine).searchString(test): print(t) - + Prints:: ['AAA', ' this line'] - ['AAA', ' and this line'] + ['AAA', ' and this line'] """ def __init__( self ): @@ -3347,7 +3347,7 @@ class ParseExpression(ParserElement): self.mayIndexError |= other.mayIndexError self.errmsg = "Expected " + _ustr(self) - + return self def setResultsName( self, name, listAllMatches=False ): @@ -3359,7 +3359,7 @@ class ParseExpression(ParserElement): for e in self.exprs: e.validate(tmp) self.checkRecursion( [] ) - + def copy(self): ret = super(ParseExpression,self).copy() ret.exprs = [e.copy() for e in self.exprs] @@ -3449,7 +3449,7 @@ class Or(ParseExpression): Example:: # construct Or using '^' operator - + number = Word(nums) ^ Combine(Word(nums) + '.' + Word(nums)) print(number.searchString("123 3.1416 789")) prints:: @@ -3528,7 +3528,7 @@ class MatchFirst(ParseExpression): Example:: # construct MatchFirst using '|' operator - + # watch the order of expressions to match number = Word(nums) | Combine(Word(nums) + '.' + Word(nums)) print(number.searchString("123 3.1416 789")) # Fail! -> [['123'], ['3'], ['1416'], ['789']] @@ -3603,7 +3603,7 @@ class Each(ParseExpression): color_attr = "color:" + color("color") size_attr = "size:" + integer("size") - # use Each (using operator '&') to accept attributes in any order + # use Each (using operator '&') to accept attributes in any order # (shape and posn are required, color and size are optional) shape_spec = shape_attr & posn_attr & Optional(color_attr) & Optional(size_attr) @@ -3801,7 +3801,7 @@ class FollowedBy(ParseElementEnhance): data_word = Word(alphas) label = data_word + FollowedBy(':') attr_expr = Group(label + Suppress(':') + OneOrMore(data_word, stopOn=label).setParseAction(' '.join)) - + OneOrMore(attr_expr).parseString("shape: SQUARE color: BLACK posn: upper left").pprint() prints:: [['shape', 'SQUARE'], ['color', 'BLACK'], ['posn', 'upper left']] @@ -3824,7 +3824,7 @@ class NotAny(ParseElementEnhance): always returns a null token list. May be constructed using the '~' operator. Example:: - + """ def __init__( self, expr ): super(NotAny,self).__init__(expr) @@ -3862,7 +3862,7 @@ class _MultipleMatch(ParseElementEnhance): check_ender = self.not_ender is not None if check_ender: try_not_ender = self.not_ender.tryParse - + # must be at least one (but first see if we are the stopOn sentinel; # if so, fail) if check_ender: @@ -3884,16 +3884,16 @@ class _MultipleMatch(ParseElementEnhance): pass return loc, tokens - + class OneOrMore(_MultipleMatch): """ Repetition of one or more of the given expression. - + Parameters: - expr - expression that must match one or more times - stopOn - (default=C{None}) - expression for a terminating sentinel - (only required if the sentinel would ordinarily match the repetition - expression) + (only required if the sentinel would ordinarily match the repetition + expression) Example:: data_word = Word(alphas) @@ -3906,7 +3906,7 @@ class OneOrMore(_MultipleMatch): # use stopOn attribute for OneOrMore to avoid reading label string as part of the data attr_expr = Group(label + Suppress(':') + OneOrMore(data_word, stopOn=label).setParseAction(' '.join)) OneOrMore(attr_expr).parseString(text).pprint() # Better -> [['shape', 'SQUARE'], ['posn', 'upper left'], ['color', 'BLACK']] - + # could also be written as (attr_expr * (1,)).parseString(text).pprint() """ @@ -3923,19 +3923,19 @@ class OneOrMore(_MultipleMatch): class ZeroOrMore(_MultipleMatch): """ Optional repetition of zero or more of the given expression. - + Parameters: - expr - expression that must match zero or more times - stopOn - (default=C{None}) - expression for a terminating sentinel - (only required if the sentinel would ordinarily match the repetition - expression) + (only required if the sentinel would ordinarily match the repetition + expression) Example: similar to L{OneOrMore} """ def __init__( self, expr, stopOn=None): super(ZeroOrMore,self).__init__(expr, stopOn=stopOn) self.mayReturnEmpty = True - + def parseImpl( self, instring, loc, doActions=True ): try: return super(ZeroOrMore, self).parseImpl(instring, loc, doActions) @@ -3973,10 +3973,10 @@ class Optional(ParseElementEnhance): zip.runTests(''' # traditional ZIP code 12345 - + # ZIP+4 form 12101-0001 - + # invalid ZIP 98765- ''') @@ -4029,12 +4029,12 @@ class SkipTo(ParseElementEnhance): Parameters: - expr - target expression marking the end of the data to be skipped - - include - (default=C{False}) if True, the target expression is also parsed + - include - (default=C{False}) if True, the target expression is also parsed (the skipped text and target expression are returned as a 2-element list). - - ignore - (default=C{None}) used to define grammars (typically quoted strings and + - ignore - (default=C{None}) used to define grammars (typically quoted strings and comments) that might contain false matches to the target expression - - failOn - (default=C{None}) define expressions that are not allowed to be - included in the skipped test; if found before the target expression is found, + - failOn - (default=C{None}) define expressions that are not allowed to be + included in the skipped test; if found before the target expression is found, the SkipTo is not a match Example:: @@ -4054,11 +4054,11 @@ class SkipTo(ParseElementEnhance): # - parse action will call token.strip() for each matched token, i.e., the description body string_data = SkipTo(SEP, ignore=quotedString) string_data.setParseAction(tokenMap(str.strip)) - ticket_expr = (integer("issue_num") + SEP - + string_data("sev") + SEP - + string_data("desc") + SEP + ticket_expr = (integer("issue_num") + SEP + + string_data("sev") + SEP + + string_data("desc") + SEP + integer("days_open")) - + for tkt in ticket_expr.searchString(report): print tkt.dump() prints:: @@ -4098,14 +4098,14 @@ class SkipTo(ParseElementEnhance): expr_parse = self.expr._parse self_failOn_canParseNext = self.failOn.canParseNext if self.failOn is not None else None self_ignoreExpr_tryParse = self.ignoreExpr.tryParse if self.ignoreExpr is not None else None - + tmploc = loc while tmploc <= instrlen: if self_failOn_canParseNext is not None: # break if failOn expression matches if self_failOn_canParseNext(instring, tmploc): break - + if self_ignoreExpr_tryParse is not None: # advance past ignore expressions while 1: @@ -4113,7 +4113,7 @@ class SkipTo(ParseElementEnhance): tmploc = self_ignoreExpr_tryParse(instring, tmploc) except ParseBaseException: break - + try: expr_parse(instring, tmploc, doActions=False, callPreParse=False) except (ParseException, IndexError): @@ -4131,7 +4131,7 @@ class SkipTo(ParseElementEnhance): loc = tmploc skiptext = instring[startloc:loc] skipresult = ParseResults(skiptext) - + if self.includeMatch: loc, mat = expr_parse(instring,loc,doActions,callPreParse=False) skipresult += mat @@ -4172,10 +4172,10 @@ class Forward(ParseElementEnhance): self.saveAsList = self.expr.saveAsList self.ignoreExprs.extend(self.expr.ignoreExprs) return self - + def __ilshift__(self, other): return self << other - + def leaveWhitespace( self ): self.skipWhitespace = False return self @@ -4309,16 +4309,16 @@ class Dict(TokenConverter): text = "shape: SQUARE posn: upper left color: light blue texture: burlap" attr_expr = (label + Suppress(':') + OneOrMore(data_word, stopOn=label).setParseAction(' '.join)) - + # print attributes as plain groups print(OneOrMore(attr_expr).parseString(text).dump()) - + # instead of OneOrMore(expr), parse using Dict(OneOrMore(Group(expr))) - Dict will auto-assign names result = Dict(OneOrMore(Group(attr_expr))).parseString(text) print(result.dump()) - + # access named fields as dict entries, or output as dict - print(result['shape']) + print(result['shape']) print(result.asDict()) prints:: ['shape', 'SQUARE', 'posn', 'upper left', 'color', 'light blue', 'texture', 'burlap'] @@ -4405,8 +4405,8 @@ class OnlyOnce(object): def traceParseAction(f): """ - Decorator for debugging parse actions. - + Decorator for debugging parse actions. + When the parse action is called, this decorator will print C{">> entering I{method-name}(line:I{current_source_line}, I{parse_location}, I{matched_tokens})".} When the parse action completes, the decorator will print C{"<<"} followed by the returned value, or any exception that the parse action raised. @@ -4473,7 +4473,7 @@ def countedArray( expr, intExpr=None ): integer expr expr expr... where the leading integer tells how many expr expressions follow. The matched tokens returns the array of expr tokens as a list - the leading count token is suppressed. - + If C{intExpr} is specified, it should be a pyparsing expression that produces an integer value. Example:: @@ -4656,7 +4656,7 @@ def dictOf( key, value ): text = "shape: SQUARE posn: upper left color: light blue texture: burlap" attr_expr = (label + Suppress(':') + OneOrMore(data_word, stopOn=label).setParseAction(' '.join)) print(OneOrMore(attr_expr).parseString(text).dump()) - + attr_label = label attr_value = Suppress(':') + OneOrMore(data_word, stopOn=label).setParseAction(' '.join) @@ -4683,11 +4683,11 @@ def originalTextFor(expr, asString=True): Helper to return the original, untokenized text for a given expression. Useful to restore the parsed fields of an HTML start tag into the raw tag text itself, or to revert separate tokens with intervening whitespace back to the original matching - input text. By default, returns astring containing the original parsed text. - - If the optional C{asString} argument is passed as C{False}, then the return value is a - C{L{ParseResults}} containing any results names that were originally matched, and a - single token containing the original matched text from the input string. So if + input text. By default, returns astring containing the original parsed text. + + If the optional C{asString} argument is passed as C{False}, then the return value is a + C{L{ParseResults}} containing any results names that were originally matched, and a + single token containing the original matched text from the input string. So if the expression passed to C{L{originalTextFor}} contains expressions with defined results names, you must set C{asString} to C{False} if you want to preserve those results name values. @@ -4715,7 +4715,7 @@ def originalTextFor(expr, asString=True): matchExpr.ignoreExprs = expr.ignoreExprs return matchExpr -def ungroup(expr): +def ungroup(expr): """ Helper to undo pyparsing's default grouping of And expressions, even if all but one are non-empty. @@ -4772,8 +4772,8 @@ def srange(s): The values enclosed in the []'s may be: - a single character - an escaped character with a leading backslash (such as C{\-} or C{\]}) - - an escaped hex character with a leading C{'\x'} (C{\x21}, which is a C{'!'} character) - (C{\0x##} is also supported for backwards compatibility) + - an escaped hex character with a leading C{'\x'} (C{\x21}, which is a C{'!'} character) + (C{\0x##} is also supported for backwards compatibility) - an escaped octal character with a leading C{'\0'} (C{\041}, which is a C{'!'} character) - a range of any of the above, separated by a dash (C{'a-z'}, etc.) - any combination of the above (C{'aeiouy'}, C{'a-zA-Z0-9_$'}, etc.) @@ -4803,7 +4803,7 @@ def replaceWith(replStr): num = Word(nums).setParseAction(lambda toks: int(toks[0])) na = oneOf("N/A NA").setParseAction(replaceWith(math.nan)) term = na | num - + OneOrMore(term).parseString("324 234 N/A 234") # -> [324, 234, nan, 234] """ return lambda s,l,t: [replStr] @@ -4824,7 +4824,7 @@ def removeQuotes(s,l,t): def tokenMap(func, *args): """ - Helper to define a parse action by mapping a function to all elements of a ParseResults list.If any additional + Helper to define a parse action by mapping a function to all elements of a ParseResults list.If any additional args are passed, they are forwarded to the given function as additional arguments after the token, as in C{hex_integer = Word(hexnums).setParseAction(tokenMap(int, 16))}, which will convert the parsed data to an integer using base 16. @@ -4834,7 +4834,7 @@ def tokenMap(func, *args): hex_ints.runTests(''' 00 11 22 aa FF 0a 0d 1a ''') - + upperword = Word(alphas).setParseAction(tokenMap(str.upper)) OneOrMore(upperword).runTests(''' my kingdom for a horse @@ -4858,7 +4858,7 @@ def tokenMap(func, *args): return [func(tokn, *args) for tokn in t] try: - func_name = getattr(func, '__name__', + func_name = getattr(func, '__name__', getattr(func, '__class__').__name__) except Exception: func_name = str(func) @@ -4871,7 +4871,7 @@ upcaseTokens = tokenMap(lambda t: _ustr(t).upper()) downcaseTokens = tokenMap(lambda t: _ustr(t).lower()) """(Deprecated) Helper parse action to convert tokens to lower case. Deprecated in favor of L{pyparsing_common.downcaseTokens}""" - + def _makeTags(tagStr, xml): """Internal helper to construct opening and closing tag expressions, given a tag name""" if isinstance(tagStr,basestring): @@ -4911,7 +4911,7 @@ def makeHTMLTags(tagStr): # makeHTMLTags returns pyparsing expressions for the opening and closing tags as a 2-tuple a,a_end = makeHTMLTags("A") link_expr = a + SkipTo(a_end)("link_text") + a_end - + for link in link_expr.searchString(text): # attributes in the tag (like "href" shown here) are also accessible as named results print(link.link_text, '->', link.href) @@ -4944,7 +4944,7 @@ def withAttribute(*args,**attrDict): - a list of name-value tuples, as in ( ("ns1:class", "Customer"), ("ns2:align","right") ) For attribute names with a namespace prefix, you must use the second form. Attribute names are matched insensitive to upper/lower case. - + If just testing for C{class} (with or without a namespace), use C{L{withClass}}. To verify that the attribute exists, but without specifying a value, pass @@ -4958,7 +4958,7 @@ def withAttribute(*args,**attrDict):
1,3 2,3 1,1
this has no type
- + ''' div,div_end = makeHTMLTags("div") @@ -4967,7 +4967,7 @@ def withAttribute(*args,**attrDict): grid_expr = div_grid + SkipTo(div | div_end)("body") for grid_header in grid_expr.searchString(html): print(grid_header.body) - + # construct a match with any div tag having a type attribute, regardless of the value div_any_type = div().setParseAction(withAttribute(type=withAttribute.ANY_VALUE)) div_expr = div_any_type + SkipTo(div | div_end)("body") @@ -5007,15 +5007,15 @@ def withClass(classname, namespace=''):
1,3 2,3 1,1
this <div> has no class
- + ''' div,div_end = makeHTMLTags("div") div_grid = div().setParseAction(withClass("grid")) - + grid_expr = div_grid + SkipTo(div | div_end)("body") for grid_header in grid_expr.searchString(html): print(grid_header.body) - + div_any_type = div().setParseAction(withClass(withAttribute.ANY_VALUE)) div_expr = div_any_type + SkipTo(div | div_end)("body") for div_header in div_expr.searchString(html): @@ -5027,7 +5027,7 @@ def withClass(classname, namespace=''): 1,3 2,3 1,1 """ classattr = "%s:class" % namespace if namespace else "class" - return withAttribute(**{classattr : classname}) + return withAttribute(**{classattr : classname}) opAssoc = _Constants() opAssoc.LEFT = object() @@ -5038,9 +5038,9 @@ def infixNotation( baseExpr, opList, lpar=Suppress('('), rpar=Suppress(')') ): Helper method for constructing grammars of expressions made up of operators working in a precedence hierarchy. Operators may be unary or binary, left- or right-associative. Parse actions can also be attached - to operator expressions. The generated parser will also recognize the use + to operator expressions. The generated parser will also recognize the use of parentheses to override operator precedences (see example below). - + Note: if you define a deep operator list, you may see performance issues when using infixNotation. See L{ParserElement.enablePackrat} for a mechanism to potentially improve your parser performance. @@ -5070,15 +5070,15 @@ def infixNotation( baseExpr, opList, lpar=Suppress('('), rpar=Suppress(')') ): Example:: # simple example of four-function arithmetic with ints and variable names integer = pyparsing_common.signed_integer - varname = pyparsing_common.identifier - + varname = pyparsing_common.identifier + arith_expr = infixNotation(integer | varname, [ ('-', 1, opAssoc.RIGHT), (oneOf('* /'), 2, opAssoc.LEFT), (oneOf('+ -'), 2, opAssoc.LEFT), ]) - + arith_expr.runTests(''' 5+3*6 (5+3)*6 @@ -5186,23 +5186,23 @@ def nestedExpr(opener="(", closer=")", content=None, ignoreExpr=quotedString.cop code_body = nestedExpr('{', '}', ignoreExpr=(quotedString | cStyleComment)) - c_function = (decl_data_type("type") + c_function = (decl_data_type("type") + ident("name") - + LPAR + Optional(delimitedList(arg), [])("args") + RPAR + + LPAR + Optional(delimitedList(arg), [])("args") + RPAR + code_body("body")) c_function.ignore(cStyleComment) - + source_code = ''' - int is_odd(int x) { - return (x%2); + int is_odd(int x) { + return (x%2); } - - int dec_to_hex(char hchar) { - if (hchar >= '0' && hchar <= '9') { - return (ord(hchar)-ord('0')); - } else { + + int dec_to_hex(char hchar) { + if (hchar >= '0' && hchar <= '9') { + return (ord(hchar)-ord('0')); + } else { return (10+ord(hchar)-ord('A')); - } + } } ''' for func in c_function.searchString(source_code): @@ -5226,7 +5226,7 @@ def nestedExpr(opener="(", closer=")", content=None, ignoreExpr=quotedString.cop ).setParseAction(lambda t:t[0].strip())) else: if ignoreExpr is not None: - content = (Combine(OneOrMore(~ignoreExpr + + content = (Combine(OneOrMore(~ignoreExpr + ~Literal(opener) + ~Literal(closer) + CharsNotIn(ParserElement.DEFAULT_WHITE_CHARS,exact=1)) ).setParseAction(lambda t:t[0].strip())) @@ -5320,7 +5320,7 @@ def indentedBlock(blockStatementExpr, indentStack, indent=True): 'spam', ['(', 'x', 'y', ')'], ':', - [[['def', 'eggs', ['(', 'z', ')'], ':', [['pass']]]]]]] + [[['def', 'eggs', ['(', 'z', ')'], ':', [['pass']]]]]]] """ def checkPeerIndent(s,l,t): if l >= len(s): return @@ -5571,10 +5571,10 @@ class pyparsing_common: fnumber = Regex(r'[+-]?\d+\.?\d*([eE][+-]?\d+)?').setName("fnumber").setParseAction(convertToFloat) """any int or real number, returned as float""" - + identifier = Word(alphas+'_', alphanums+'_').setName("identifier") """typical code identifier (leading alpha or '_', followed by 0 or more alphas, nums, or '_')""" - + ipv4_address = Regex(r'(25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})(\.(25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})){3}').setName("IPv4 address") "IPv4 address (C{0.0.0.0 - 255.255.255.255})" @@ -5585,7 +5585,7 @@ class pyparsing_common: _mixed_ipv6_address = ("::ffff:" + ipv4_address).setName("mixed IPv6 address") ipv6_address = Combine((_full_ipv6_address | _mixed_ipv6_address | _short_ipv6_address).setName("IPv6 address")).setName("IPv6 address") "IPv6 address (long, short, or mixed form)" - + mac_address = Regex(r'[0-9a-fA-F]{2}([:.-])[0-9a-fA-F]{2}(?:\1[0-9a-fA-F]{2}){4}').setName("MAC address") "MAC address xx:xx:xx:xx:xx (may also have '-' or '.' delimiters)" @@ -5649,16 +5649,16 @@ class pyparsing_common: Parse action to remove HTML tags from web page HTML source Example:: - # strip HTML links from normal text + # strip HTML links from normal text text = 'More info at the pyparsing wiki page' td,td_end = makeHTMLTags("TD") table_text = td + SkipTo(td_end).setParseAction(pyparsing_common.stripHTMLTags)("body") + td_end - + print(table_text.parseString(text).body) # -> 'More info at the pyparsing wiki page' """ return pyparsing_common._html_stripper.transformString(tokens[0]) - _commasepitem = Combine(OneOrMore(~Literal(",") + ~LineEnd() + Word(printables, excludeChars=',') + _commasepitem = Combine(OneOrMore(~Literal(",") + ~LineEnd() + Word(printables, excludeChars=',') + Optional( White(" \t") ) ) ).streamline().setName("commaItem") comma_separated_list = delimitedList( Optional( quotedString.copy() | _commasepitem, default="") ).setName("comma separated list") """Predefined expression of 1 or more printable words or quoted strings, separated by commas.""" @@ -5683,7 +5683,7 @@ if __name__ == "__main__": tableName = delimitedList(ident, ".", combine=True).setParseAction(upcaseTokens) tableNameList = Group(delimitedList(tableName)).setName("tables") - + simpleSQL = selectToken("command") + columnSpec("columns") + fromToken + tableNameList("tables") # demo runTests method, including embedded comments in test string diff --git a/venv/lib/python3.10/site-packages/setuptools-59.6.0.dist-info/METADATA b/venv/lib/python3.10/site-packages/setuptools-59.6.0.dist-info/METADATA index 35a436da..10236f30 100644 --- a/venv/lib/python3.10/site-packages/setuptools-59.6.0.dist-info/METADATA +++ b/venv/lib/python3.10/site-packages/setuptools-59.6.0.dist-info/METADATA @@ -121,5 +121,3 @@ Security Contact To report a security vulnerability, please use the `Tidelift security contact `_. Tidelift will coordinate the fix and disclosure. - - diff --git a/venv/lib/python3.10/site-packages/setuptools-59.6.0.dist-info/WHEEL b/venv/lib/python3.10/site-packages/setuptools-59.6.0.dist-info/WHEEL index becc9a66..18041f65 100644 --- a/venv/lib/python3.10/site-packages/setuptools-59.6.0.dist-info/WHEEL +++ b/venv/lib/python3.10/site-packages/setuptools-59.6.0.dist-info/WHEEL @@ -1,5 +1,55 @@ -Wheel-Version: 1.0 -Generator: bdist_wheel (0.37.1) -Root-Is-Purelib: true -Tag: py3-none-any +[distutils.commands] +alias = setuptools.command.alias:alias +bdist_egg = setuptools.command.bdist_egg:bdist_egg +bdist_rpm = setuptools.command.bdist_rpm:bdist_rpm +build_clib = setuptools.command.build_clib:build_clib +build_ext = setuptools.command.build_ext:build_ext +build_py = setuptools.command.build_py:build_py +develop = setuptools.command.develop:develop +dist_info = setuptools.command.dist_info:dist_info +easy_install = setuptools.command.easy_install:easy_install +egg_info = setuptools.command.egg_info:egg_info +install = setuptools.command.install:install +install_egg_info = setuptools.command.install_egg_info:install_egg_info +install_lib = setuptools.command.install_lib:install_lib +install_scripts = setuptools.command.install_scripts:install_scripts +rotate = setuptools.command.rotate:rotate +saveopts = setuptools.command.saveopts:saveopts +sdist = setuptools.command.sdist:sdist +setopt = setuptools.command.setopt:setopt +test = setuptools.command.test:test +upload_docs = setuptools.command.upload_docs:upload_docs +[distutils.setup_keywords] +dependency_links = setuptools.dist:assert_string_list +eager_resources = setuptools.dist:assert_string_list +entry_points = setuptools.dist:check_entry_points +exclude_package_data = setuptools.dist:check_package_data +extras_require = setuptools.dist:check_extras +include_package_data = setuptools.dist:assert_bool +install_requires = setuptools.dist:check_requirements +namespace_packages = setuptools.dist:check_nsp +package_data = setuptools.dist:check_package_data +packages = setuptools.dist:check_packages +python_requires = setuptools.dist:check_specifier +setup_requires = setuptools.dist:check_requirements +test_loader = setuptools.dist:check_importable +test_runner = setuptools.dist:check_importable +test_suite = setuptools.dist:check_test_suite +tests_require = setuptools.dist:check_requirements +use_2to3 = setuptools.dist:invalid_unless_false +zip_safe = setuptools.dist:assert_bool + +[egg_info.writers] +PKG-INFO = setuptools.command.egg_info:write_pkg_info +dependency_links.txt = setuptools.command.egg_info:overwrite_arg +depends.txt = setuptools.command.egg_info:warn_depends_obsolete +eager_resources.txt = setuptools.command.egg_info:overwrite_arg +entry_points.txt = setuptools.command.egg_info:write_entries +namespace_packages.txt = setuptools.command.egg_info:overwrite_arg +requires.txt = setuptools.command.egg_info:write_requirements +top_level.txt = setuptools.command.egg_info:write_toplevel_names + +[setuptools.finalize_distribution_options] +keywords = setuptools.dist:Distribution._finalize_setup_keywords +parent_finalize = setuptools.dist:_Distribution.finalize_options diff --git a/venv/lib/python3.10/site-packages/setuptools-59.6.0.dist-info/entry_points.txt b/venv/lib/python3.10/site-packages/setuptools-59.6.0.dist-info/entry_points.txt index 9466bf63..01ec8b7d 100644 --- a/venv/lib/python3.10/site-packages/setuptools-59.6.0.dist-info/entry_points.txt +++ b/venv/lib/python3.10/site-packages/setuptools-59.6.0.dist-info/entry_points.txt @@ -1,56 +1,425 @@ -[distutils.commands] -alias = setuptools.command.alias:alias -bdist_egg = setuptools.command.bdist_egg:bdist_egg -bdist_rpm = setuptools.command.bdist_rpm:bdist_rpm -build_clib = setuptools.command.build_clib:build_clib -build_ext = setuptools.command.build_ext:build_ext -build_py = setuptools.command.build_py:build_py -develop = setuptools.command.develop:develop -dist_info = setuptools.command.dist_info:dist_info -easy_install = setuptools.command.easy_install:easy_install -egg_info = setuptools.command.egg_info:egg_info -install = setuptools.command.install:install -install_egg_info = setuptools.command.install_egg_info:install_egg_info -install_lib = setuptools.command.install_lib:install_lib -install_scripts = setuptools.command.install_scripts:install_scripts -rotate = setuptools.command.rotate:rotate -saveopts = setuptools.command.saveopts:saveopts -sdist = setuptools.command.sdist:sdist -setopt = setuptools.command.setopt:setopt -test = setuptools.command.test:test -upload_docs = setuptools.command.upload_docs:upload_docs +"""distutils.cygwinccompiler -[distutils.setup_keywords] -dependency_links = setuptools.dist:assert_string_list -eager_resources = setuptools.dist:assert_string_list -entry_points = setuptools.dist:check_entry_points -exclude_package_data = setuptools.dist:check_package_data -extras_require = setuptools.dist:check_extras -include_package_data = setuptools.dist:assert_bool -install_requires = setuptools.dist:check_requirements -namespace_packages = setuptools.dist:check_nsp -package_data = setuptools.dist:check_package_data -packages = setuptools.dist:check_packages -python_requires = setuptools.dist:check_specifier -setup_requires = setuptools.dist:check_requirements -test_loader = setuptools.dist:check_importable -test_runner = setuptools.dist:check_importable -test_suite = setuptools.dist:check_test_suite -tests_require = setuptools.dist:check_requirements -use_2to3 = setuptools.dist:invalid_unless_false -zip_safe = setuptools.dist:assert_bool +Provides the CygwinCCompiler class, a subclass of UnixCCompiler that +handles the Cygwin port of the GNU C compiler to Windows. It also contains +the Mingw32CCompiler class which handles the mingw32 port of GCC (same as +cygwin in no-cygwin mode). +""" -[egg_info.writers] -PKG-INFO = setuptools.command.egg_info:write_pkg_info -dependency_links.txt = setuptools.command.egg_info:overwrite_arg -depends.txt = setuptools.command.egg_info:warn_depends_obsolete -eager_resources.txt = setuptools.command.egg_info:overwrite_arg -entry_points.txt = setuptools.command.egg_info:write_entries -namespace_packages.txt = setuptools.command.egg_info:overwrite_arg -requires.txt = setuptools.command.egg_info:write_requirements -top_level.txt = setuptools.command.egg_info:write_toplevel_names +# problems: +# +# * if you use a msvc compiled python version (1.5.2) +# 1. you have to insert a __GNUC__ section in its config.h +# 2. you have to generate an import library for its dll +# - create a def-file for python??.dll +# - create an import library using +# dlltool --dllname python15.dll --def python15.def \ +# --output-lib libpython15.a +# +# see also http://starship.python.net/crew/kernr/mingw32/Notes.html +# +# * We put export_symbols in a def-file, and don't use +# --export-all-symbols because it doesn't worked reliable in some +# tested configurations. And because other windows compilers also +# need their symbols specified this no serious problem. +# +# tested configurations: +# +# * cygwin gcc 2.91.57/ld 2.9.4/dllwrap 0.2.4 works +# (after patching python's config.h and for C++ some other include files) +# see also http://starship.python.net/crew/kernr/mingw32/Notes.html +# * mingw32 gcc 2.95.2/ld 2.9.4/dllwrap 0.2.4 works +# (ld doesn't support -shared, so we use dllwrap) +# * cygwin gcc 2.95.2/ld 2.10.90/dllwrap 2.10.90 works now +# - its dllwrap doesn't work, there is a bug in binutils 2.10.90 +# see also http://sources.redhat.com/ml/cygwin/2000-06/msg01274.html +# - using gcc -mdll instead dllwrap doesn't work without -static because +# it tries to link against dlls instead their import libraries. (If +# it finds the dll first.) +# By specifying -static we force ld to link against the import libraries, +# this is windows standard and there are normally not the necessary symbols +# in the dlls. +# *** only the version of June 2000 shows these problems +# * cygwin gcc 3.2/ld 2.13.90 works +# (ld supports -shared) +# * mingw gcc 3.2/ld 2.13 works +# (ld supports -shared) +# * llvm-mingw with Clang 11 works +# (lld supports -shared) -[setuptools.finalize_distribution_options] -keywords = setuptools.dist:Distribution._finalize_setup_keywords -parent_finalize = setuptools.dist:_Distribution.finalize_options +import os +import sys +import copy +from subprocess import Popen, PIPE, check_output +import re +import distutils.version +from distutils.unixccompiler import UnixCCompiler +from distutils.file_util import write_file +from distutils.errors import (DistutilsExecError, CCompilerError, + CompileError, UnknownFileError) +from distutils.version import LooseVersion +from distutils.spawn import find_executable + +def get_msvcr(): + """Include the appropriate MSVC runtime library if Python was built + with MSVC 7.0 or later. + """ + msc_pos = sys.version.find('MSC v.') + if msc_pos != -1: + msc_ver = sys.version[msc_pos+6:msc_pos+10] + if msc_ver == '1300': + # MSVC 7.0 + return ['msvcr70'] + elif msc_ver == '1310': + # MSVC 7.1 + return ['msvcr71'] + elif msc_ver == '1400': + # VS2005 / MSVC 8.0 + return ['msvcr80'] + elif msc_ver == '1500': + # VS2008 / MSVC 9.0 + return ['msvcr90'] + elif msc_ver == '1600': + # VS2010 / MSVC 10.0 + return ['msvcr100'] + elif msc_ver == '1700': + # VS2012 / MSVC 11.0 + return ['msvcr110'] + elif msc_ver == '1800': + # VS2013 / MSVC 12.0 + return ['msvcr120'] + elif 1900 <= int(msc_ver) < 2000: + # VS2015 / MSVC 14.0 + return ['ucrt', 'vcruntime140'] + else: + raise ValueError("Unknown MS Compiler version %s " % msc_ver) + + +class CygwinCCompiler(UnixCCompiler): + """ Handles the Cygwin port of the GNU C compiler to Windows. + """ + compiler_type = 'cygwin' + obj_extension = ".o" + static_lib_extension = ".a" + shared_lib_extension = ".dll" + static_lib_format = "lib%s%s" + shared_lib_format = "%s%s" + exe_extension = ".exe" + + def __init__(self, verbose=0, dry_run=0, force=0): + + UnixCCompiler.__init__(self, verbose, dry_run, force) + + status, details = check_config_h() + self.debug_print("Python's GCC status: %s (details: %s)" % + (status, details)) + if status is not CONFIG_H_OK: + self.warn( + "Python's pyconfig.h doesn't seem to support your compiler. " + "Reason: %s. " + "Compiling may fail because of undefined preprocessor macros." + % details) + + self.cc = os.environ.get('CC', 'gcc') + self.cxx = os.environ.get('CXX', 'g++') + + if ('gcc' in self.cc): # Start gcc workaround + self.gcc_version, self.ld_version, self.dllwrap_version = \ + get_versions() + self.debug_print(self.compiler_type + ": gcc %s, ld %s, dllwrap %s\n" % + (self.gcc_version, + self.ld_version, + self.dllwrap_version) ) + + # ld_version >= "2.10.90" and < "2.13" should also be able to use + # gcc -mdll instead of dllwrap + # Older dllwraps had own version numbers, newer ones use the + # same as the rest of binutils ( also ld ) + # dllwrap 2.10.90 is buggy + if self.ld_version >= "2.10.90": + self.linker_dll = self.cc + else: + self.linker_dll = "dllwrap" + + # ld_version >= "2.13" support -shared so use it instead of + # -mdll -static + if self.ld_version >= "2.13": + shared_option = "-shared" + else: + shared_option = "-mdll -static" + else: # Assume linker is up to date + self.linker_dll = self.cc + shared_option = "-shared" + + self.set_executables(compiler='%s -mcygwin -O -Wall' % self.cc, + compiler_so='%s -mcygwin -mdll -O -Wall' % self.cc, + compiler_cxx='%s -mcygwin -O -Wall' % self.cxx, + linker_exe='%s -mcygwin' % self.cc, + linker_so=('%s -mcygwin %s' % + (self.linker_dll, shared_option))) + + # cygwin and mingw32 need different sets of libraries + if ('gcc' in self.cc and self.gcc_version == "2.91.57"): + # cygwin shouldn't need msvcrt, but without the dlls will crash + # (gcc version 2.91.57) -- perhaps something about initialization + self.dll_libraries=["msvcrt"] + self.warn( + "Consider upgrading to a newer version of gcc") + else: + # Include the appropriate MSVC runtime library if Python was built + # with MSVC 7.0 or later. + self.dll_libraries = get_msvcr() + + def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts): + """Compiles the source by spawning GCC and windres if needed.""" + if ext == '.rc' or ext == '.res': + # gcc needs '.res' and '.rc' compiled to object files !!! + try: + self.spawn(["windres", "-i", src, "-o", obj]) + except DistutilsExecError as msg: + raise CompileError(msg) + else: # for other files use the C-compiler + try: + self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + + extra_postargs) + except DistutilsExecError as msg: + raise CompileError(msg) + + def link(self, target_desc, objects, output_filename, output_dir=None, + libraries=None, library_dirs=None, runtime_library_dirs=None, + export_symbols=None, debug=0, extra_preargs=None, + extra_postargs=None, build_temp=None, target_lang=None): + """Link the objects.""" + # use separate copies, so we can modify the lists + extra_preargs = copy.copy(extra_preargs or []) + libraries = copy.copy(libraries or []) + objects = copy.copy(objects or []) + + # Additional libraries + libraries.extend(self.dll_libraries) + + # handle export symbols by creating a def-file + # with executables this only works with gcc/ld as linker + if ((export_symbols is not None) and + (target_desc != self.EXECUTABLE or self.linker_dll == "gcc")): + # (The linker doesn't do anything if output is up-to-date. + # So it would probably better to check if we really need this, + # but for this we had to insert some unchanged parts of + # UnixCCompiler, and this is not what we want.) + + # we want to put some files in the same directory as the + # object files are, build_temp doesn't help much + # where are the object files + temp_dir = os.path.dirname(objects[0]) + # name of dll to give the helper files the same base name + (dll_name, dll_extension) = os.path.splitext( + os.path.basename(output_filename)) + + # generate the filenames for these files + def_file = os.path.join(temp_dir, dll_name + ".def") + lib_file = os.path.join(temp_dir, 'lib' + dll_name + ".a") + + # Generate .def file + contents = [ + "LIBRARY %s" % os.path.basename(output_filename), + "EXPORTS"] + for sym in export_symbols: + contents.append(sym) + self.execute(write_file, (def_file, contents), + "writing %s" % def_file) + + # next add options for def-file and to creating import libraries + + # dllwrap uses different options than gcc/ld + if self.linker_dll == "dllwrap": + extra_preargs.extend(["--output-lib", lib_file]) + # for dllwrap we have to use a special option + extra_preargs.extend(["--def", def_file]) + # we use gcc/ld here and can be sure ld is >= 2.9.10 + else: + # doesn't work: bfd_close build\...\libfoo.a: Invalid operation + #extra_preargs.extend(["-Wl,--out-implib,%s" % lib_file]) + # for gcc/ld the def-file is specified as any object files + objects.append(def_file) + + #end: if ((export_symbols is not None) and + # (target_desc != self.EXECUTABLE or self.linker_dll == "gcc")): + + # who wants symbols and a many times larger output file + # should explicitly switch the debug mode on + # otherwise we let dllwrap/ld strip the output file + # (On my machine: 10KiB < stripped_file < ??100KiB + # unstripped_file = stripped_file + XXX KiB + # ( XXX=254 for a typical python extension)) + if not debug: + extra_preargs.append("-s") + + UnixCCompiler.link(self, target_desc, objects, output_filename, + output_dir, libraries, library_dirs, + runtime_library_dirs, + None, # export_symbols, we do this in our def-file + debug, extra_preargs, extra_postargs, build_temp, + target_lang) + + # -- Miscellaneous methods ----------------------------------------- + + def object_filenames(self, source_filenames, strip_dir=0, output_dir=''): + """Adds supports for rc and res files.""" + if output_dir is None: + output_dir = '' + obj_names = [] + for src_name in source_filenames: + # use normcase to make sure '.rc' is really '.rc' and not '.RC' + base, ext = os.path.splitext(os.path.normcase(src_name)) + if ext not in (self.src_extensions + ['.rc','.res']): + raise UnknownFileError("unknown file type '%s' (from '%s')" % \ + (ext, src_name)) + if strip_dir: + base = os.path.basename (base) + if ext in ('.res', '.rc'): + # these need to be compiled to object files + obj_names.append (os.path.join(output_dir, + base + ext + self.obj_extension)) + else: + obj_names.append (os.path.join(output_dir, + base + self.obj_extension)) + return obj_names + +# the same as cygwin plus some additional parameters +class Mingw32CCompiler(CygwinCCompiler): + """ Handles the Mingw32 port of the GNU C compiler to Windows. + """ + compiler_type = 'mingw32' + + def __init__(self, verbose=0, dry_run=0, force=0): + + CygwinCCompiler.__init__ (self, verbose, dry_run, force) + + # ld_version >= "2.13" support -shared so use it instead of + # -mdll -static + if ('gcc' in self.cc and self.ld_version < "2.13"): + shared_option = "-mdll -static" + else: + shared_option = "-shared" + + # A real mingw32 doesn't need to specify a different entry point, + # but cygwin 2.91.57 in no-cygwin-mode needs it. + if ('gcc' in self.cc and self.gcc_version <= "2.91.57"): + entry_point = '--entry _DllMain@12' + else: + entry_point = '' + + if is_cygwincc(self.cc): + raise CCompilerError( + 'Cygwin gcc cannot be used with --compiler=mingw32') + + self.set_executables(compiler='%s -O -Wall' % self.cc, + compiler_so='%s -mdll -O -Wall' % self.cc, + compiler_cxx='%s -O -Wall' % self.cxx, + linker_exe='%s' % self.cc, + linker_so='%s %s %s' + % (self.linker_dll, shared_option, + entry_point)) + # Maybe we should also append -mthreads, but then the finished + # dlls need another dll (mingwm10.dll see Mingw32 docs) + # (-mthreads: Support thread-safe exception handling on `Mingw32') + + # no additional libraries needed + self.dll_libraries=[] + + # Include the appropriate MSVC runtime library if Python was built + # with MSVC 7.0 or later. + self.dll_libraries = get_msvcr() + +# Because these compilers aren't configured in Python's pyconfig.h file by +# default, we should at least warn the user if he is using an unmodified +# version. + +CONFIG_H_OK = "ok" +CONFIG_H_NOTOK = "not ok" +CONFIG_H_UNCERTAIN = "uncertain" + +def check_config_h(): + """Check if the current Python installation appears amenable to building + extensions with GCC. + + Returns a tuple (status, details), where 'status' is one of the following + constants: + + - CONFIG_H_OK: all is well, go ahead and compile + - CONFIG_H_NOTOK: doesn't look good + - CONFIG_H_UNCERTAIN: not sure -- unable to read pyconfig.h + + 'details' is a human-readable string explaining the situation. + + Note there are two ways to conclude "OK": either 'sys.version' contains + the string "GCC" (implying that this Python was built with GCC), or the + installed "pyconfig.h" contains the string "__GNUC__". + """ + + # XXX since this function also checks sys.version, it's not strictly a + # "pyconfig.h" check -- should probably be renamed... + + from distutils import sysconfig + + # if sys.version contains GCC then python was compiled with GCC, and the + # pyconfig.h file should be OK + if "GCC" in sys.version: + return CONFIG_H_OK, "sys.version mentions 'GCC'" + + # Clang would also work + if "Clang" in sys.version: + return CONFIG_H_OK, "sys.version mentions 'Clang'" + + # let's see if __GNUC__ is mentioned in python.h + fn = sysconfig.get_config_h_filename() + try: + config_h = open(fn) + try: + if "__GNUC__" in config_h.read(): + return CONFIG_H_OK, "'%s' mentions '__GNUC__'" % fn + else: + return CONFIG_H_NOTOK, "'%s' does not mention '__GNUC__'" % fn + finally: + config_h.close() + except OSError as exc: + return (CONFIG_H_UNCERTAIN, + "couldn't read '%s': %s" % (fn, exc.strerror)) + +RE_VERSION = re.compile(br'(\d+\.\d+(\.\d+)*)') + +def _find_exe_version(cmd): + """Find the version of an executable by running `cmd` in the shell. + + If the command is not found, or the output does not match + `RE_VERSION`, returns None. + """ + executable = cmd.split()[0] + if find_executable(executable) is None: + return None + out = Popen(cmd, shell=True, stdout=PIPE).stdout + try: + out_string = out.read() + finally: + out.close() + result = RE_VERSION.search(out_string) + if result is None: + return None + # LooseVersion works with strings; decode + ver_str = result.group(1).decode() + with distutils.version.suppress_known_deprecation(): + return LooseVersion(ver_str) + +def get_versions(): + """ Try to find out the versions of gcc, ld and dllwrap. + + If not possible it returns None for it. + """ + commands = ['gcc -dumpversion', 'ld -v', 'dllwrap --version'] + return tuple([_find_exe_version(cmd) for cmd in commands]) + +def is_cygwincc(cc): + '''Try to determine if the compiler that would be used is from cygwin.''' + out_string = check_output([cc, '-dumpmachine']) + return out_string.strip().endswith(b'cygwin') diff --git a/venv/lib/python3.10/site-packages/setuptools/_distutils/cygwinccompiler.py b/venv/lib/python3.10/site-packages/setuptools/_distutils/cygwinccompiler.py index ad6cc44b..21a67e97 100644 --- a/venv/lib/python3.10/site-packages/setuptools/_distutils/cygwinccompiler.py +++ b/venv/lib/python3.10/site-packages/setuptools/_distutils/cygwinccompiler.py @@ -1,425 +1,98 @@ -"""distutils.cygwinccompiler +Metadata-Version: 2.3 +Name: Werkzeug +Version: 3.1.3 +Summary: The comprehensive WSGI web application library. +Maintainer-email: Pallets +Requires-Python: >=3.9 +Description-Content-Type: text/markdown +Classifier: Development Status :: 5 - Production/Stable +Classifier: Environment :: Web Environment +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: BSD License +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python +Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content +Classifier: Topic :: Internet :: WWW/HTTP :: WSGI +Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Application +Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Middleware +Classifier: Topic :: Software Development :: Libraries :: Application Frameworks +Classifier: Typing :: Typed +Requires-Dist: MarkupSafe>=2.1.1 +Requires-Dist: watchdog>=2.3 ; extra == "watchdog" +Project-URL: Changes, https://werkzeug.palletsprojects.com/changes/ +Project-URL: Chat, https://discord.gg/pallets +Project-URL: Documentation, https://werkzeug.palletsprojects.com/ +Project-URL: Donate, https://palletsprojects.com/donate +Project-URL: Issue Tracker, https://github.com/pallets/werkzeug/issues/ +Project-URL: Source Code, https://github.com/pallets/werkzeug/ +Provides-Extra: watchdog -Provides the CygwinCCompiler class, a subclass of UnixCCompiler that -handles the Cygwin port of the GNU C compiler to Windows. It also contains -the Mingw32CCompiler class which handles the mingw32 port of GCC (same as -cygwin in no-cygwin mode). -""" +# Werkzeug -# problems: -# -# * if you use a msvc compiled python version (1.5.2) -# 1. you have to insert a __GNUC__ section in its config.h -# 2. you have to generate an import library for its dll -# - create a def-file for python??.dll -# - create an import library using -# dlltool --dllname python15.dll --def python15.def \ -# --output-lib libpython15.a -# -# see also http://starship.python.net/crew/kernr/mingw32/Notes.html -# -# * We put export_symbols in a def-file, and don't use -# --export-all-symbols because it doesn't worked reliable in some -# tested configurations. And because other windows compilers also -# need their symbols specified this no serious problem. -# -# tested configurations: -# -# * cygwin gcc 2.91.57/ld 2.9.4/dllwrap 0.2.4 works -# (after patching python's config.h and for C++ some other include files) -# see also http://starship.python.net/crew/kernr/mingw32/Notes.html -# * mingw32 gcc 2.95.2/ld 2.9.4/dllwrap 0.2.4 works -# (ld doesn't support -shared, so we use dllwrap) -# * cygwin gcc 2.95.2/ld 2.10.90/dllwrap 2.10.90 works now -# - its dllwrap doesn't work, there is a bug in binutils 2.10.90 -# see also http://sources.redhat.com/ml/cygwin/2000-06/msg01274.html -# - using gcc -mdll instead dllwrap doesn't work without -static because -# it tries to link against dlls instead their import libraries. (If -# it finds the dll first.) -# By specifying -static we force ld to link against the import libraries, -# this is windows standard and there are normally not the necessary symbols -# in the dlls. -# *** only the version of June 2000 shows these problems -# * cygwin gcc 3.2/ld 2.13.90 works -# (ld supports -shared) -# * mingw gcc 3.2/ld 2.13 works -# (ld supports -shared) -# * llvm-mingw with Clang 11 works -# (lld supports -shared) +*werkzeug* German noun: "tool". Etymology: *werk* ("work"), *zeug* ("stuff") -import os -import sys -import copy -from subprocess import Popen, PIPE, check_output -import re +Werkzeug is a comprehensive [WSGI][] web application library. It began as +a simple collection of various utilities for WSGI applications and has +become one of the most advanced WSGI utility libraries. -import distutils.version -from distutils.unixccompiler import UnixCCompiler -from distutils.file_util import write_file -from distutils.errors import (DistutilsExecError, CCompilerError, - CompileError, UnknownFileError) -from distutils.version import LooseVersion -from distutils.spawn import find_executable +It includes: -def get_msvcr(): - """Include the appropriate MSVC runtime library if Python was built - with MSVC 7.0 or later. - """ - msc_pos = sys.version.find('MSC v.') - if msc_pos != -1: - msc_ver = sys.version[msc_pos+6:msc_pos+10] - if msc_ver == '1300': - # MSVC 7.0 - return ['msvcr70'] - elif msc_ver == '1310': - # MSVC 7.1 - return ['msvcr71'] - elif msc_ver == '1400': - # VS2005 / MSVC 8.0 - return ['msvcr80'] - elif msc_ver == '1500': - # VS2008 / MSVC 9.0 - return ['msvcr90'] - elif msc_ver == '1600': - # VS2010 / MSVC 10.0 - return ['msvcr100'] - elif msc_ver == '1700': - # VS2012 / MSVC 11.0 - return ['msvcr110'] - elif msc_ver == '1800': - # VS2013 / MSVC 12.0 - return ['msvcr120'] - elif 1900 <= int(msc_ver) < 2000: - # VS2015 / MSVC 14.0 - return ['ucrt', 'vcruntime140'] - else: - raise ValueError("Unknown MS Compiler version %s " % msc_ver) +- An interactive debugger that allows inspecting stack traces and + source code in the browser with an interactive interpreter for any + frame in the stack. +- A full-featured request object with objects to interact with + headers, query args, form data, files, and cookies. +- A response object that can wrap other WSGI applications and handle + streaming data. +- A routing system for matching URLs to endpoints and generating URLs + for endpoints, with an extensible system for capturing variables + from URLs. +- HTTP utilities to handle entity tags, cache control, dates, user + agents, cookies, files, and more. +- A threaded WSGI server for use while developing applications + locally. +- A test client for simulating HTTP requests during testing without + requiring running a server. + +Werkzeug doesn't enforce any dependencies. It is up to the developer to +choose a template engine, database adapter, and even how to handle +requests. It can be used to build all sorts of end user applications +such as blogs, wikis, or bulletin boards. + +[Flask][] wraps Werkzeug, using it to handle the details of WSGI while +providing more structure and patterns for defining powerful +applications. + +[WSGI]: https://wsgi.readthedocs.io/en/latest/ +[Flask]: https://www.palletsprojects.com/p/flask/ -class CygwinCCompiler(UnixCCompiler): - """ Handles the Cygwin port of the GNU C compiler to Windows. - """ - compiler_type = 'cygwin' - obj_extension = ".o" - static_lib_extension = ".a" - shared_lib_extension = ".dll" - static_lib_format = "lib%s%s" - shared_lib_format = "%s%s" - exe_extension = ".exe" +## A Simple Example - def __init__(self, verbose=0, dry_run=0, force=0): +```python +# save this as app.py +from werkzeug.wrappers import Request, Response - UnixCCompiler.__init__(self, verbose, dry_run, force) +@Request.application +def application(request: Request) -> Response: + return Response("Hello, World!") - status, details = check_config_h() - self.debug_print("Python's GCC status: %s (details: %s)" % - (status, details)) - if status is not CONFIG_H_OK: - self.warn( - "Python's pyconfig.h doesn't seem to support your compiler. " - "Reason: %s. " - "Compiling may fail because of undefined preprocessor macros." - % details) +if __name__ == "__main__": + from werkzeug.serving import run_simple + run_simple("127.0.0.1", 5000, application) +``` - self.cc = os.environ.get('CC', 'gcc') - self.cxx = os.environ.get('CXX', 'g++') +``` +$ python -m app + * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit) +``` - if ('gcc' in self.cc): # Start gcc workaround - self.gcc_version, self.ld_version, self.dllwrap_version = \ - get_versions() - self.debug_print(self.compiler_type + ": gcc %s, ld %s, dllwrap %s\n" % - (self.gcc_version, - self.ld_version, - self.dllwrap_version) ) - # ld_version >= "2.10.90" and < "2.13" should also be able to use - # gcc -mdll instead of dllwrap - # Older dllwraps had own version numbers, newer ones use the - # same as the rest of binutils ( also ld ) - # dllwrap 2.10.90 is buggy - if self.ld_version >= "2.10.90": - self.linker_dll = self.cc - else: - self.linker_dll = "dllwrap" +## Donate - # ld_version >= "2.13" support -shared so use it instead of - # -mdll -static - if self.ld_version >= "2.13": - shared_option = "-shared" - else: - shared_option = "-mdll -static" - else: # Assume linker is up to date - self.linker_dll = self.cc - shared_option = "-shared" +The Pallets organization develops and supports Werkzeug and other +popular packages. In order to grow the community of contributors and +users, and allow the maintainers to devote more time to the projects, +[please donate today][]. - self.set_executables(compiler='%s -mcygwin -O -Wall' % self.cc, - compiler_so='%s -mcygwin -mdll -O -Wall' % self.cc, - compiler_cxx='%s -mcygwin -O -Wall' % self.cxx, - linker_exe='%s -mcygwin' % self.cc, - linker_so=('%s -mcygwin %s' % - (self.linker_dll, shared_option))) - - # cygwin and mingw32 need different sets of libraries - if ('gcc' in self.cc and self.gcc_version == "2.91.57"): - # cygwin shouldn't need msvcrt, but without the dlls will crash - # (gcc version 2.91.57) -- perhaps something about initialization - self.dll_libraries=["msvcrt"] - self.warn( - "Consider upgrading to a newer version of gcc") - else: - # Include the appropriate MSVC runtime library if Python was built - # with MSVC 7.0 or later. - self.dll_libraries = get_msvcr() - - def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts): - """Compiles the source by spawning GCC and windres if needed.""" - if ext == '.rc' or ext == '.res': - # gcc needs '.res' and '.rc' compiled to object files !!! - try: - self.spawn(["windres", "-i", src, "-o", obj]) - except DistutilsExecError as msg: - raise CompileError(msg) - else: # for other files use the C-compiler - try: - self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + - extra_postargs) - except DistutilsExecError as msg: - raise CompileError(msg) - - def link(self, target_desc, objects, output_filename, output_dir=None, - libraries=None, library_dirs=None, runtime_library_dirs=None, - export_symbols=None, debug=0, extra_preargs=None, - extra_postargs=None, build_temp=None, target_lang=None): - """Link the objects.""" - # use separate copies, so we can modify the lists - extra_preargs = copy.copy(extra_preargs or []) - libraries = copy.copy(libraries or []) - objects = copy.copy(objects or []) - - # Additional libraries - libraries.extend(self.dll_libraries) - - # handle export symbols by creating a def-file - # with executables this only works with gcc/ld as linker - if ((export_symbols is not None) and - (target_desc != self.EXECUTABLE or self.linker_dll == "gcc")): - # (The linker doesn't do anything if output is up-to-date. - # So it would probably better to check if we really need this, - # but for this we had to insert some unchanged parts of - # UnixCCompiler, and this is not what we want.) - - # we want to put some files in the same directory as the - # object files are, build_temp doesn't help much - # where are the object files - temp_dir = os.path.dirname(objects[0]) - # name of dll to give the helper files the same base name - (dll_name, dll_extension) = os.path.splitext( - os.path.basename(output_filename)) - - # generate the filenames for these files - def_file = os.path.join(temp_dir, dll_name + ".def") - lib_file = os.path.join(temp_dir, 'lib' + dll_name + ".a") - - # Generate .def file - contents = [ - "LIBRARY %s" % os.path.basename(output_filename), - "EXPORTS"] - for sym in export_symbols: - contents.append(sym) - self.execute(write_file, (def_file, contents), - "writing %s" % def_file) - - # next add options for def-file and to creating import libraries - - # dllwrap uses different options than gcc/ld - if self.linker_dll == "dllwrap": - extra_preargs.extend(["--output-lib", lib_file]) - # for dllwrap we have to use a special option - extra_preargs.extend(["--def", def_file]) - # we use gcc/ld here and can be sure ld is >= 2.9.10 - else: - # doesn't work: bfd_close build\...\libfoo.a: Invalid operation - #extra_preargs.extend(["-Wl,--out-implib,%s" % lib_file]) - # for gcc/ld the def-file is specified as any object files - objects.append(def_file) - - #end: if ((export_symbols is not None) and - # (target_desc != self.EXECUTABLE or self.linker_dll == "gcc")): - - # who wants symbols and a many times larger output file - # should explicitly switch the debug mode on - # otherwise we let dllwrap/ld strip the output file - # (On my machine: 10KiB < stripped_file < ??100KiB - # unstripped_file = stripped_file + XXX KiB - # ( XXX=254 for a typical python extension)) - if not debug: - extra_preargs.append("-s") - - UnixCCompiler.link(self, target_desc, objects, output_filename, - output_dir, libraries, library_dirs, - runtime_library_dirs, - None, # export_symbols, we do this in our def-file - debug, extra_preargs, extra_postargs, build_temp, - target_lang) - - # -- Miscellaneous methods ----------------------------------------- - - def object_filenames(self, source_filenames, strip_dir=0, output_dir=''): - """Adds supports for rc and res files.""" - if output_dir is None: - output_dir = '' - obj_names = [] - for src_name in source_filenames: - # use normcase to make sure '.rc' is really '.rc' and not '.RC' - base, ext = os.path.splitext(os.path.normcase(src_name)) - if ext not in (self.src_extensions + ['.rc','.res']): - raise UnknownFileError("unknown file type '%s' (from '%s')" % \ - (ext, src_name)) - if strip_dir: - base = os.path.basename (base) - if ext in ('.res', '.rc'): - # these need to be compiled to object files - obj_names.append (os.path.join(output_dir, - base + ext + self.obj_extension)) - else: - obj_names.append (os.path.join(output_dir, - base + self.obj_extension)) - return obj_names - -# the same as cygwin plus some additional parameters -class Mingw32CCompiler(CygwinCCompiler): - """ Handles the Mingw32 port of the GNU C compiler to Windows. - """ - compiler_type = 'mingw32' - - def __init__(self, verbose=0, dry_run=0, force=0): - - CygwinCCompiler.__init__ (self, verbose, dry_run, force) - - # ld_version >= "2.13" support -shared so use it instead of - # -mdll -static - if ('gcc' in self.cc and self.ld_version < "2.13"): - shared_option = "-mdll -static" - else: - shared_option = "-shared" - - # A real mingw32 doesn't need to specify a different entry point, - # but cygwin 2.91.57 in no-cygwin-mode needs it. - if ('gcc' in self.cc and self.gcc_version <= "2.91.57"): - entry_point = '--entry _DllMain@12' - else: - entry_point = '' - - if is_cygwincc(self.cc): - raise CCompilerError( - 'Cygwin gcc cannot be used with --compiler=mingw32') - - self.set_executables(compiler='%s -O -Wall' % self.cc, - compiler_so='%s -mdll -O -Wall' % self.cc, - compiler_cxx='%s -O -Wall' % self.cxx, - linker_exe='%s' % self.cc, - linker_so='%s %s %s' - % (self.linker_dll, shared_option, - entry_point)) - # Maybe we should also append -mthreads, but then the finished - # dlls need another dll (mingwm10.dll see Mingw32 docs) - # (-mthreads: Support thread-safe exception handling on `Mingw32') - - # no additional libraries needed - self.dll_libraries=[] - - # Include the appropriate MSVC runtime library if Python was built - # with MSVC 7.0 or later. - self.dll_libraries = get_msvcr() - -# Because these compilers aren't configured in Python's pyconfig.h file by -# default, we should at least warn the user if he is using an unmodified -# version. - -CONFIG_H_OK = "ok" -CONFIG_H_NOTOK = "not ok" -CONFIG_H_UNCERTAIN = "uncertain" - -def check_config_h(): - """Check if the current Python installation appears amenable to building - extensions with GCC. - - Returns a tuple (status, details), where 'status' is one of the following - constants: - - - CONFIG_H_OK: all is well, go ahead and compile - - CONFIG_H_NOTOK: doesn't look good - - CONFIG_H_UNCERTAIN: not sure -- unable to read pyconfig.h - - 'details' is a human-readable string explaining the situation. - - Note there are two ways to conclude "OK": either 'sys.version' contains - the string "GCC" (implying that this Python was built with GCC), or the - installed "pyconfig.h" contains the string "__GNUC__". - """ - - # XXX since this function also checks sys.version, it's not strictly a - # "pyconfig.h" check -- should probably be renamed... - - from distutils import sysconfig - - # if sys.version contains GCC then python was compiled with GCC, and the - # pyconfig.h file should be OK - if "GCC" in sys.version: - return CONFIG_H_OK, "sys.version mentions 'GCC'" - - # Clang would also work - if "Clang" in sys.version: - return CONFIG_H_OK, "sys.version mentions 'Clang'" - - # let's see if __GNUC__ is mentioned in python.h - fn = sysconfig.get_config_h_filename() - try: - config_h = open(fn) - try: - if "__GNUC__" in config_h.read(): - return CONFIG_H_OK, "'%s' mentions '__GNUC__'" % fn - else: - return CONFIG_H_NOTOK, "'%s' does not mention '__GNUC__'" % fn - finally: - config_h.close() - except OSError as exc: - return (CONFIG_H_UNCERTAIN, - "couldn't read '%s': %s" % (fn, exc.strerror)) - -RE_VERSION = re.compile(br'(\d+\.\d+(\.\d+)*)') - -def _find_exe_version(cmd): - """Find the version of an executable by running `cmd` in the shell. - - If the command is not found, or the output does not match - `RE_VERSION`, returns None. - """ - executable = cmd.split()[0] - if find_executable(executable) is None: - return None - out = Popen(cmd, shell=True, stdout=PIPE).stdout - try: - out_string = out.read() - finally: - out.close() - result = RE_VERSION.search(out_string) - if result is None: - return None - # LooseVersion works with strings; decode - ver_str = result.group(1).decode() - with distutils.version.suppress_known_deprecation(): - return LooseVersion(ver_str) - -def get_versions(): - """ Try to find out the versions of gcc, ld and dllwrap. - - If not possible it returns None for it. - """ - commands = ['gcc -dumpversion', 'ld -v', 'dllwrap --version'] - return tuple([_find_exe_version(cmd) for cmd in commands]) - -def is_cygwincc(cc): - '''Try to determine if the compiler that would be used is from cygwin.''' - out_string = check_output([cc, '-dumpmachine']) - return out_string.strip().endswith(b'cygwin') +[please donate today]: https://palletsprojects.com/donate