diff --git a/.venv/bin/pip b/.venv/bin/pip index eaeaf9c9..f4c567f3 100644 --- a/.venv/bin/pip +++ b/.venv/bin/pip @@ -1,4 +1,4 @@ -#!/run/media/kristofers/Disk/Pyhton/School/.venv/bin/python3 +#!/run/media/kristofers/Disk/Pyhton/School/.venv/bin/python # -*- coding: utf-8 -*- import re import sys diff --git a/.venv/bin/pip3 b/.venv/bin/pip3 index eaeaf9c9..f4c567f3 100644 --- a/.venv/bin/pip3 +++ b/.venv/bin/pip3 @@ -1,4 +1,4 @@ -#!/run/media/kristofers/Disk/Pyhton/School/.venv/bin/python3 +#!/run/media/kristofers/Disk/Pyhton/School/.venv/bin/python # -*- coding: utf-8 -*- import re import sys diff --git a/.venv/bin/pip3.9 b/.venv/bin/pip3.9 index eaeaf9c9..f4c567f3 100644 --- a/.venv/bin/pip3.9 +++ b/.venv/bin/pip3.9 @@ -1,4 +1,4 @@ -#!/run/media/kristofers/Disk/Pyhton/School/.venv/bin/python3 +#!/run/media/kristofers/Disk/Pyhton/School/.venv/bin/python # -*- coding: utf-8 -*- import re import sys diff --git a/.venv/bin/yapf b/.venv/bin/yapf new file mode 100644 index 00000000..e07c6de1 --- /dev/null +++ b/.venv/bin/yapf @@ -0,0 +1,8 @@ +#!/run/media/kristofers/Disk/Pyhton/School/.venv/bin/python +# -*- coding: utf-8 -*- +import re +import sys +from yapf import run_main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(run_main()) diff --git a/.venv/bin/yapf-diff b/.venv/bin/yapf-diff new file mode 100644 index 00000000..db9b071e --- /dev/null +++ b/.venv/bin/yapf-diff @@ -0,0 +1,8 @@ +#!/run/media/kristofers/Disk/Pyhton/School/.venv/bin/python +# -*- coding: utf-8 -*- +import re +import sys +from yapf.third_party.yapf_diff.yapf_diff import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/.venv/lib/python3.9/site-packages/pip-21.2.3.dist-info/RECORD b/.venv/lib/python3.9/site-packages/pip-21.2.3.dist-info/RECORD deleted file mode 100644 index 2b3b9a14..00000000 --- a/.venv/lib/python3.9/site-packages/pip-21.2.3.dist-info/RECORD +++ /dev/null @@ -1,795 +0,0 @@ -../../../bin/pip,sha256=y_LiDjdh7P04irliSOvGNInZFHu9gdSi3jL1ZJLPwxM,263 -../../../bin/pip3,sha256=y_LiDjdh7P04irliSOvGNInZFHu9gdSi3jL1ZJLPwxM,263 -../../../bin/pip3.9,sha256=y_LiDjdh7P04irliSOvGNInZFHu9gdSi3jL1ZJLPwxM,263 -pip-21.2.3.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -pip-21.2.3.dist-info/LICENSE.txt,sha256=gJDJthjxG8mDPXZg96yUjnIt4bce2hULfec5mrfNnmI,1110 -pip-21.2.3.dist-info/METADATA,sha256=BA4M-MqDkwwNoSPm1cVEoleu3sEr_iN4HbpM3cjr6rI,4165 -pip-21.2.3.dist-info/RECORD,, -pip-21.2.3.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -pip-21.2.3.dist-info/WHEEL,sha256=OqRkF0eY5GHssMorFjlbTIq072vpHpF60fIQA6lS9xA,92 -pip-21.2.3.dist-info/entry_points.txt,sha256=HtfDOwpUlr9s73jqLQ6wF9V0_0qvUXJwCBz7Vwx0Ue0,125 -pip-21.2.3.dist-info/top_level.txt,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -pip/__init__.py,sha256=qXU49Q5cd1uydhWo2AnReaOxEtM0o8t5EP9EvhtRCN8,370 -pip/__main__.py,sha256=8mTMucDffyV05KR_fXWM2p1JQEnHPu1-CWjbthYHYis,1229 -pip/__pycache__/__init__.cpython-39.pyc,, -pip/__pycache__/__main__.cpython-39.pyc,, -pip/_internal/__init__.py,sha256=OLxitHt9NAlSaObDjAlRSYUkAftIjV9sUpv1yIZDO4E,592 -pip/_internal/__pycache__/__init__.cpython-39.pyc,, -pip/_internal/__pycache__/build_env.cpython-39.pyc,, -pip/_internal/__pycache__/cache.cpython-39.pyc,, -pip/_internal/__pycache__/configuration.cpython-39.pyc,, -pip/_internal/__pycache__/exceptions.cpython-39.pyc,, -pip/_internal/__pycache__/main.cpython-39.pyc,, -pip/_internal/__pycache__/pyproject.cpython-39.pyc,, -pip/_internal/__pycache__/self_outdated_check.cpython-39.pyc,, -pip/_internal/__pycache__/wheel_builder.cpython-39.pyc,, -pip/_internal/build_env.py,sha256=YMIinJTDdKm_x5JC8IjJZp-_Zw42kBm6fkiWprBi-Hk,10415 -pip/_internal/cache.py,sha256=bjyh33eOAq6kX1kPk84Oxb_JXazpP6izVZipJLq0eJI,10245 -pip/_internal/cli/__init__.py,sha256=9gMw_A_StJXzDh2Rhxil6bd8tFP-ZR719Q1pINHAw5I,136 -pip/_internal/cli/__pycache__/__init__.cpython-39.pyc,, -pip/_internal/cli/__pycache__/autocompletion.cpython-39.pyc,, -pip/_internal/cli/__pycache__/base_command.cpython-39.pyc,, -pip/_internal/cli/__pycache__/cmdoptions.cpython-39.pyc,, -pip/_internal/cli/__pycache__/command_context.cpython-39.pyc,, -pip/_internal/cli/__pycache__/main.cpython-39.pyc,, -pip/_internal/cli/__pycache__/main_parser.cpython-39.pyc,, -pip/_internal/cli/__pycache__/parser.cpython-39.pyc,, -pip/_internal/cli/__pycache__/progress_bars.cpython-39.pyc,, -pip/_internal/cli/__pycache__/req_command.cpython-39.pyc,, -pip/_internal/cli/__pycache__/spinners.cpython-39.pyc,, -pip/_internal/cli/__pycache__/status_codes.cpython-39.pyc,, -pip/_internal/cli/autocompletion.py,sha256=_d6Ugrj-KQOCoDgDscSr_238-RcwedXzpLmW8F_L_uc,6562 -pip/_internal/cli/base_command.py,sha256=mZH7AMA9tBoiYEysFx9l3Pe_h23mnNZy8K8M_ZhsRSs,7810 -pip/_internal/cli/cmdoptions.py,sha256=Kalu7Z2ZAvySgOOIo4e_Ah3Vv8HDmGhLQlkDysI-ihw,29292 -pip/_internal/cli/command_context.py,sha256=ocjEqsuP6pFF98N_ljRyLToYLm5fBgMaZicVjMy_f0Y,787 -pip/_internal/cli/main.py,sha256=D6DAuHgfr4na5SuEbtLyx1FlZhcGHIB9BltXsjrrKsA,2542 -pip/_internal/cli/main_parser.py,sha256=rusU-JYOLpcJ8cFXWiPvuDoNpTptRlndY3WyBh2UXq4,2701 -pip/_internal/cli/parser.py,sha256=0eTD4_7ucvjv_VnZajerOhzHUAIOju5KDlQM0rv5VP4,11080 -pip/_internal/cli/progress_bars.py,sha256=-bhkKHcjsZ0tWdf-DH9eGHsJuGedVPih8E0vV2_rJXg,8550 -pip/_internal/cli/req_command.py,sha256=_9w-fMnI0j8bey7mryr-iLxjCoUT_jIU3lkNp2PQJVU,17001 -pip/_internal/cli/spinners.py,sha256=rQJtl8c9JiMpOCsOk-YRFYtWdhiFoFectJuryMM-jn4,5233 -pip/_internal/cli/status_codes.py,sha256=1xaB32lG8Nf1nMl_6e0yy5z2Iyvv81OTUpuHwXgGsfU,122 -pip/_internal/commands/__init__.py,sha256=LoscneenHTO4OCqGIah4KtHyPNURU6F7bUeGRjbcr_k,3888 -pip/_internal/commands/__pycache__/__init__.cpython-39.pyc,, -pip/_internal/commands/__pycache__/cache.cpython-39.pyc,, -pip/_internal/commands/__pycache__/check.cpython-39.pyc,, -pip/_internal/commands/__pycache__/completion.cpython-39.pyc,, -pip/_internal/commands/__pycache__/configuration.cpython-39.pyc,, -pip/_internal/commands/__pycache__/debug.cpython-39.pyc,, -pip/_internal/commands/__pycache__/download.cpython-39.pyc,, -pip/_internal/commands/__pycache__/freeze.cpython-39.pyc,, -pip/_internal/commands/__pycache__/hash.cpython-39.pyc,, -pip/_internal/commands/__pycache__/help.cpython-39.pyc,, -pip/_internal/commands/__pycache__/index.cpython-39.pyc,, -pip/_internal/commands/__pycache__/install.cpython-39.pyc,, -pip/_internal/commands/__pycache__/list.cpython-39.pyc,, -pip/_internal/commands/__pycache__/search.cpython-39.pyc,, -pip/_internal/commands/__pycache__/show.cpython-39.pyc,, -pip/_internal/commands/__pycache__/uninstall.cpython-39.pyc,, -pip/_internal/commands/__pycache__/wheel.cpython-39.pyc,, -pip/_internal/commands/cache.py,sha256=XqHqGkiyZ6A0Vf0oIGJhWiNY4k9JIC0nlNmooiaCtuo,7453 -pip/_internal/commands/check.py,sha256=FZ7IHeRkwnWkwgdaMI1AjFPcI4xrPK4_4jODp8aDyiA,1617 -pip/_internal/commands/completion.py,sha256=RXEru4uYaBfUUtZJ2bLE7s6FJUe9t1BAVSUQ8wPzW0o,3005 -pip/_internal/commands/configuration.py,sha256=1Fr4QLwdu1OcBL_FZQh6uY3i7i38qI70OJGG-JhoUuI,9228 -pip/_internal/commands/debug.py,sha256=Bb2Lxzn7XEQRYgBYOZbuK3EYeLphKHo8Gubg_EZ6JnU,6851 -pip/_internal/commands/download.py,sha256=sT3gInhPvMyhuZ-rVBf1OlpLzh52J0hStM57_CPdvCA,5088 -pip/_internal/commands/freeze.py,sha256=xzVjiTJT5DBJceJPNnAYyCF4oGITyuSpfsfkSKR70Fg,2869 -pip/_internal/commands/hash.py,sha256=XoLZ3Hx_b72asRLGOe1WXSvJ6ClwSFhn-aFPgbcB9Zk,1719 -pip/_internal/commands/help.py,sha256=zV8LmdIbJOnVOIZTz1TwlNWQZQLEWZnJGwXSSh9SSEw,1173 -pip/_internal/commands/index.py,sha256=qTchSIS-zCEiJCrZ9X-o5_93kMYCSVZDRTmeY_fhOOE,4920 -pip/_internal/commands/install.py,sha256=oj_4a73RMGXgmFQV1jUZEZTnvnZw5kkT6pA3naYj3PA,28243 -pip/_internal/commands/list.py,sha256=1K-dhUMEs8akjPE16n5Eq9GsalONKkS7bvWwSCNzQe8,12090 -pip/_internal/commands/search.py,sha256=Dtebo30wNJJ0Blr5MkmiET1wIuNioxzoH8vR82ma7Tc,5707 -pip/_internal/commands/show.py,sha256=G-ak6SZS-H2MJqQI89D2x4TLd8l9amVYhtaa5dhCFeE,8208 -pip/_internal/commands/uninstall.py,sha256=sTUTiJSTp0NKeFHUBJHD3f-fSVPGFjBY6go_DhpvC0Q,3580 -pip/_internal/commands/wheel.py,sha256=dIRE7v6g9HTpTw0nsOG2HHoG0uvwrWV5-xyp0kuJdhU,6365 -pip/_internal/configuration.py,sha256=g_C1ByxxCGrYfY26B-X8v-3mbUwzlXdj9EKwDs-0kH0,14128 -pip/_internal/distributions/__init__.py,sha256=99Rzk077wS5wGire_mchcAjtJG9vbwTLPXZKLWrh_D4,879 -pip/_internal/distributions/__pycache__/__init__.cpython-39.pyc,, -pip/_internal/distributions/__pycache__/base.cpython-39.pyc,, -pip/_internal/distributions/__pycache__/installed.cpython-39.pyc,, -pip/_internal/distributions/__pycache__/sdist.cpython-39.pyc,, -pip/_internal/distributions/__pycache__/wheel.cpython-39.pyc,, -pip/_internal/distributions/base.py,sha256=VCEqCFm36o5SSpu3esHmM055Wv5TOxGFLXtxpY8m-L8,1244 -pip/_internal/distributions/installed.py,sha256=UZU2Q4-jcAaPexNZzqk5YXhols1jTjyh4xAA0ZQ_A8g,667 -pip/_internal/distributions/sdist.py,sha256=5OpYaS51ll8tqsZC-h86ij62RQkid3YZEOqUXCRq8TA,3957 -pip/_internal/distributions/wheel.py,sha256=8lzZqqpA5oUUHANOZlf0qcKLIunsJ3K821VP29hLYdg,1217 -pip/_internal/exceptions.py,sha256=yiMEmKFvLIPNGaLCQxxtnacfNhUisQayQ4XiqPuRLZU,13567 -pip/_internal/index/__init__.py,sha256=x0ifDyFChwwQC4V_eHBFF1fvzLwbXRYG3nq15-Axy24,32 -pip/_internal/index/__pycache__/__init__.cpython-39.pyc,, -pip/_internal/index/__pycache__/collector.cpython-39.pyc,, -pip/_internal/index/__pycache__/package_finder.cpython-39.pyc,, -pip/_internal/index/__pycache__/sources.cpython-39.pyc,, -pip/_internal/index/collector.py,sha256=pB-NFZkI-KjQnhTBo7JzArphtu6OVJ52WVQlFQrSbFU,18179 -pip/_internal/index/package_finder.py,sha256=k7qar-7Lw778ODq0iB-ETXjof-MUhRh4YHXsVNjl6eo,37120 -pip/_internal/index/sources.py,sha256=SW2LlD5eAF2Rj74TbpEUNjADU9UH-K76oqgJFNtDlWc,6781 -pip/_internal/locations/__init__.py,sha256=bReITFXFSX786ngLRJhXhsb1npYOw8YbpOuOngrQUik,11584 -pip/_internal/locations/__pycache__/__init__.cpython-39.pyc,, -pip/_internal/locations/__pycache__/_distutils.cpython-39.pyc,, -pip/_internal/locations/__pycache__/_sysconfig.cpython-39.pyc,, -pip/_internal/locations/__pycache__/base.cpython-39.pyc,, -pip/_internal/locations/_distutils.py,sha256=OUPuNiGJP2vmiYgwdAR-ZQryj_2yANs9DebSm4afDZU,6040 -pip/_internal/locations/_sysconfig.py,sha256=sJJD4PQujUcLAaKiOeXYsILmQb0-hjznP79PzKPiA4Q,8137 -pip/_internal/locations/base.py,sha256=KMpxtATY6iOshQ3AimpymGTy81zK-pM1CWPemJQ0mj4,1631 -pip/_internal/main.py,sha256=yXF5_lVS3QQTxrbbvNk31juR2E1_16H1iu-xuXAod9o,364 -pip/_internal/metadata/__init__.py,sha256=p3NvOGG_3quhV9bOlDPvWSAEByPsdn63cO4FrsFubM0,1624 -pip/_internal/metadata/__pycache__/__init__.cpython-39.pyc,, -pip/_internal/metadata/__pycache__/base.cpython-39.pyc,, -pip/_internal/metadata/__pycache__/pkg_resources.cpython-39.pyc,, -pip/_internal/metadata/base.py,sha256=dCfs9XIcicyYSoFtVtzq6rFvduUYNdV6U_EDDlG4yJ0,8170 -pip/_internal/metadata/pkg_resources.py,sha256=azUoAkvyF-h80pORd0czY4-fWUIRe_z3i2qNHuKiSjE,5353 -pip/_internal/models/__init__.py,sha256=j2kiRfNTH6h5JVP5yO_N2Yn0DqiNzJUtaPjHe2xMcgg,65 -pip/_internal/models/__pycache__/__init__.cpython-39.pyc,, -pip/_internal/models/__pycache__/candidate.cpython-39.pyc,, -pip/_internal/models/__pycache__/direct_url.cpython-39.pyc,, -pip/_internal/models/__pycache__/format_control.cpython-39.pyc,, -pip/_internal/models/__pycache__/index.cpython-39.pyc,, -pip/_internal/models/__pycache__/link.cpython-39.pyc,, -pip/_internal/models/__pycache__/scheme.cpython-39.pyc,, -pip/_internal/models/__pycache__/search_scope.cpython-39.pyc,, -pip/_internal/models/__pycache__/selection_prefs.cpython-39.pyc,, -pip/_internal/models/__pycache__/target_python.cpython-39.pyc,, -pip/_internal/models/__pycache__/wheel.cpython-39.pyc,, -pip/_internal/models/candidate.py,sha256=L4nKS2HIgdOfbylU-2MIO2APVWEWueJpHu_gcwO0iH4,977 -pip/_internal/models/direct_url.py,sha256=36n2ed5kddmPLhNLh4b1GzGr36dUdSgl23Xrbcxd_ck,6482 -pip/_internal/models/format_control.py,sha256=PZ5PExPrxArZWzzPFATSj6W07UqvxjtrMBgFNAUxae4,2641 -pip/_internal/models/index.py,sha256=vqgOrXoZqQW4AA928wBmEGjKbxjeb-_NALLGZH0kMXY,1090 -pip/_internal/models/link.py,sha256=SrRPbWmpzWh1LfQd-eurbYAuMvOvpD5fzMvNDlRFpQ8,10227 -pip/_internal/models/scheme.py,sha256=moDcYk85amZUkf6Je5TDvXh4xMHxsSgf8rkD1ykpQhU,769 -pip/_internal/models/search_scope.py,sha256=D_Q6xSo1dTjSRljshHz_xVe4vXXivl2H7_rtj0dSHpU,4600 -pip/_internal/models/selection_prefs.py,sha256=0DZIWNPT8q2EiuqZCAQxczCoVnbs9_C4zugNfhNnvaw,1923 -pip/_internal/models/target_python.py,sha256=NUm2Ua7qbJHFK0UzKAlfHixudx4-FgmAFKPKf3B2RyU,3981 -pip/_internal/models/wheel.py,sha256=NLmn_y8dVc5vfTcAYw3EfS692hAF9MPPMDr5wTBu_4E,3633 -pip/_internal/network/__init__.py,sha256=IEtuAPVGqBTS0C7M0KJ95xqGcA76coOc2AsDcgIBP-8,52 -pip/_internal/network/__pycache__/__init__.cpython-39.pyc,, -pip/_internal/network/__pycache__/auth.cpython-39.pyc,, -pip/_internal/network/__pycache__/cache.cpython-39.pyc,, -pip/_internal/network/__pycache__/download.cpython-39.pyc,, -pip/_internal/network/__pycache__/lazy_wheel.cpython-39.pyc,, -pip/_internal/network/__pycache__/session.cpython-39.pyc,, -pip/_internal/network/__pycache__/utils.cpython-39.pyc,, -pip/_internal/network/__pycache__/xmlrpc.cpython-39.pyc,, -pip/_internal/network/auth.py,sha256=820jI8SAsVfNnfoOfxfH7HaGVFtYX_M8vsHEtiHCS14,11961 -pip/_internal/network/cache.py,sha256=KfaWDbALIGsUnP4qi1MfvKSpCJ0vlC5lviELSTNKLtQ,2169 -pip/_internal/network/download.py,sha256=-EnS83XhpNVRsfB107nYU-OPZsHd29QQdG6lNokemAk,6200 -pip/_internal/network/lazy_wheel.py,sha256=LFVwrv2nHpwr0pl17i-3sbEAedJjraaLdRTFRfS23vo,7825 -pip/_internal/network/session.py,sha256=9KBZpMGrtEmek4iPgpZiLEBgyxQ6bPH3yUUxNbEEQ54,17036 -pip/_internal/network/utils.py,sha256=K4d2srYGzR_tz5vVBbKFC7rBWA-G_DqqX9io2flIrI0,4155 -pip/_internal/network/xmlrpc.py,sha256=oFCngChTOtIVcc55ExwdX1HJcPvL-6PKMNl5ok6nMQk,1851 -pip/_internal/operations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -pip/_internal/operations/__pycache__/__init__.cpython-39.pyc,, -pip/_internal/operations/__pycache__/check.cpython-39.pyc,, -pip/_internal/operations/__pycache__/freeze.cpython-39.pyc,, -pip/_internal/operations/__pycache__/prepare.cpython-39.pyc,, -pip/_internal/operations/build/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -pip/_internal/operations/build/__pycache__/__init__.cpython-39.pyc,, -pip/_internal/operations/build/__pycache__/metadata.cpython-39.pyc,, -pip/_internal/operations/build/__pycache__/metadata_legacy.cpython-39.pyc,, -pip/_internal/operations/build/__pycache__/wheel.cpython-39.pyc,, -pip/_internal/operations/build/__pycache__/wheel_legacy.cpython-39.pyc,, -pip/_internal/operations/build/metadata.py,sha256=-06VLFRgwxsIuqHL_56NxXdn7TQuZHeaL4RYXDnjB18,1200 -pip/_internal/operations/build/metadata_legacy.py,sha256=1V8i8VVGUF7GauyS_KPEhcl7dIwrocD6lyT5kWvXkBA,1991 -pip/_internal/operations/build/wheel.py,sha256=r2IKZgek1REUjP4xA0RLEG5O1-HsPZtzfy7q7W3_nhQ,1144 -pip/_internal/operations/build/wheel_legacy.py,sha256=4ddx179dnTTHJertW50M6869gchuyrNEdYcyWe4w5Yg,3337 -pip/_internal/operations/check.py,sha256=eCLrRScb_ZJDxTK9rMjU5kbLuu1xRngdoLxATNPuPQE,5448 -pip/_internal/operations/freeze.py,sha256=WEglEwdf9rD9M6jGzMyRVhiN-WF8p-hhiHGnwsWlDDc,10833 -pip/_internal/operations/install/__init__.py,sha256=Zug2xxRJjeI2LdVd45iwmeavUBYXA4ltbhFFwc4BEOg,53 -pip/_internal/operations/install/__pycache__/__init__.cpython-39.pyc,, -pip/_internal/operations/install/__pycache__/editable_legacy.cpython-39.pyc,, -pip/_internal/operations/install/__pycache__/legacy.cpython-39.pyc,, -pip/_internal/operations/install/__pycache__/wheel.cpython-39.pyc,, -pip/_internal/operations/install/editable_legacy.py,sha256=FhvBds_MF_Flabnylh6EVwCD3mFDxa-RmdKq3jl5JGM,1443 -pip/_internal/operations/install/legacy.py,sha256=xyGakzR-Xnfa9H37-OzT6cKH-AQMsctBkFxfUr3jlvw,4537 -pip/_internal/operations/install/wheel.py,sha256=oV6IB77355YCaI_ta4mqWXyHlkQF8OqBRZAdq8jpQYs,30269 -pip/_internal/operations/prepare.py,sha256=QB3-cmVD1agyO6_B9oiRs9HCQyyDMHF9pLTboLtufxo,25503 -pip/_internal/pyproject.py,sha256=DQoqc7F3HyFBO7fG82HOPsdP-GfEzfuqTUGOG0v2E1c,7246 -pip/_internal/req/__init__.py,sha256=5eiQnk8IiwtrWHU4r1ttcLy545MCrUdg5eRRq7_ZNz0,2925 -pip/_internal/req/__pycache__/__init__.cpython-39.pyc,, -pip/_internal/req/__pycache__/constructors.cpython-39.pyc,, -pip/_internal/req/__pycache__/req_file.cpython-39.pyc,, -pip/_internal/req/__pycache__/req_install.cpython-39.pyc,, -pip/_internal/req/__pycache__/req_set.cpython-39.pyc,, -pip/_internal/req/__pycache__/req_tracker.cpython-39.pyc,, -pip/_internal/req/__pycache__/req_uninstall.cpython-39.pyc,, -pip/_internal/req/constructors.py,sha256=Izde_5pbxkMzDWN-khLufzKKpC0uaGNTPRO9ShWrud8,16300 -pip/_internal/req/req_file.py,sha256=RN04-oHRNn5xECciUcs0Gh3LxA1RdlVw1X6wbVs0r7k,17936 -pip/_internal/req/req_install.py,sha256=gIGZ3t9QzqCBoeL04my4DIuqM86j0i5nId6iwZIGYzQ,32517 -pip/_internal/req/req_set.py,sha256=yeKmy9-oH5tW2Oe7SHobrp9btcDBZ3DxdFJ3HqAKQ44,7762 -pip/_internal/req/req_tracker.py,sha256=tFN50kuTTWwpY0WJkPK6QCPUZePmUhaBbuKVSgkWl1A,4312 -pip/_internal/req/req_uninstall.py,sha256=T6n_Pgpljq30LLQ81Qs4kpPoxSuJUkUvbvG9b697rGs,24450 -pip/_internal/resolution/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -pip/_internal/resolution/__pycache__/__init__.cpython-39.pyc,, -pip/_internal/resolution/__pycache__/base.cpython-39.pyc,, -pip/_internal/resolution/base.py,sha256=qMuP4GV1NJU-81E3gUKzczQxzS-f_SWF0Dk59YVrH9A,575 -pip/_internal/resolution/legacy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -pip/_internal/resolution/legacy/__pycache__/__init__.cpython-39.pyc,, -pip/_internal/resolution/legacy/__pycache__/resolver.cpython-39.pyc,, -pip/_internal/resolution/legacy/resolver.py,sha256=6nUm1wcBGRT58gUOu0-B0TE354XrCx_dexslaFtlDis,18005 -pip/_internal/resolution/resolvelib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -pip/_internal/resolution/resolvelib/__pycache__/__init__.cpython-39.pyc,, -pip/_internal/resolution/resolvelib/__pycache__/base.cpython-39.pyc,, -pip/_internal/resolution/resolvelib/__pycache__/candidates.cpython-39.pyc,, -pip/_internal/resolution/resolvelib/__pycache__/factory.cpython-39.pyc,, -pip/_internal/resolution/resolvelib/__pycache__/found_candidates.cpython-39.pyc,, -pip/_internal/resolution/resolvelib/__pycache__/provider.cpython-39.pyc,, -pip/_internal/resolution/resolvelib/__pycache__/reporter.cpython-39.pyc,, -pip/_internal/resolution/resolvelib/__pycache__/requirements.cpython-39.pyc,, -pip/_internal/resolution/resolvelib/__pycache__/resolver.cpython-39.pyc,, -pip/_internal/resolution/resolvelib/base.py,sha256=IWvd3KNMJtIqDLcqeUuGV4MbimM83JOofBKwggVYxzI,5434 -pip/_internal/resolution/resolvelib/candidates.py,sha256=a8-csKtuj_Bz8UeYgk2cz8mP1EOObTyXsZrCO8wq2Tc,19397 -pip/_internal/resolution/resolvelib/factory.py,sha256=clwGzM3_u3SReBwOOG9sAvcdd2pNqk03T5qrCyryeB4,27559 -pip/_internal/resolution/resolvelib/found_candidates.py,sha256=9kFfU_ZFugtCMaCIez6UYrG4hyfqwDaQYxP9db9XQvE,5427 -pip/_internal/resolution/resolvelib/provider.py,sha256=qXB9l3kjEca0orqTS2e6TGaWHJIn537kEqJYClBIShQ,8617 -pip/_internal/resolution/resolvelib/reporter.py,sha256=AwjzTX3LytVk9wuVS1LdJAk1V2kPhEdn1dE7MfrPwLM,2669 -pip/_internal/resolution/resolvelib/requirements.py,sha256=FKE-HcZmsljRrcLpr545XprOOqDd09149GjjF8AfTiw,5621 -pip/_internal/resolution/resolvelib/resolver.py,sha256=Bmwfy5pO8cLzI-13YMgWEAWwFlpjLKdKeCBHMrdWyWM,10795 -pip/_internal/self_outdated_check.py,sha256=cNOjZkFVtwJmftBZt34cH2j9SJ5Gd4vSbJY8FBYM6tg,6671 -pip/_internal/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -pip/_internal/utils/__pycache__/__init__.cpython-39.pyc,, -pip/_internal/utils/__pycache__/_log.cpython-39.pyc,, -pip/_internal/utils/__pycache__/appdirs.cpython-39.pyc,, -pip/_internal/utils/__pycache__/compat.cpython-39.pyc,, -pip/_internal/utils/__pycache__/compatibility_tags.cpython-39.pyc,, -pip/_internal/utils/__pycache__/datetime.cpython-39.pyc,, -pip/_internal/utils/__pycache__/deprecation.cpython-39.pyc,, -pip/_internal/utils/__pycache__/direct_url_helpers.cpython-39.pyc,, -pip/_internal/utils/__pycache__/distutils_args.cpython-39.pyc,, -pip/_internal/utils/__pycache__/encoding.cpython-39.pyc,, -pip/_internal/utils/__pycache__/entrypoints.cpython-39.pyc,, -pip/_internal/utils/__pycache__/filesystem.cpython-39.pyc,, -pip/_internal/utils/__pycache__/filetypes.cpython-39.pyc,, -pip/_internal/utils/__pycache__/glibc.cpython-39.pyc,, -pip/_internal/utils/__pycache__/hashes.cpython-39.pyc,, -pip/_internal/utils/__pycache__/inject_securetransport.cpython-39.pyc,, -pip/_internal/utils/__pycache__/logging.cpython-39.pyc,, -pip/_internal/utils/__pycache__/misc.cpython-39.pyc,, -pip/_internal/utils/__pycache__/models.cpython-39.pyc,, -pip/_internal/utils/__pycache__/packaging.cpython-39.pyc,, -pip/_internal/utils/__pycache__/parallel.cpython-39.pyc,, -pip/_internal/utils/__pycache__/pkg_resources.cpython-39.pyc,, -pip/_internal/utils/__pycache__/setuptools_build.cpython-39.pyc,, -pip/_internal/utils/__pycache__/subprocess.cpython-39.pyc,, -pip/_internal/utils/__pycache__/temp_dir.cpython-39.pyc,, -pip/_internal/utils/__pycache__/unpacking.cpython-39.pyc,, -pip/_internal/utils/__pycache__/urls.cpython-39.pyc,, -pip/_internal/utils/__pycache__/virtualenv.cpython-39.pyc,, -pip/_internal/utils/__pycache__/wheel.cpython-39.pyc,, -pip/_internal/utils/_log.py,sha256=t0zjUNjMLPYna4ZbL0MJB8wrxGdFvC8JsPs7f3UUdz0,1053 -pip/_internal/utils/appdirs.py,sha256=JKsp6Dlfk0BjBfni2Geq_uzpSycc8pV0Ap5A5qAwhag,1220 -pip/_internal/utils/compat.py,sha256=U1ofuQpRkcmWNtCsZccTK_24YsauhWl0KPDMnC69adM,1947 -pip/_internal/utils/compatibility_tags.py,sha256=f0RJ5Wb3Jj2T5z57i0RPLyoWNtqYvymealy3aUucrVU,5622 -pip/_internal/utils/datetime.py,sha256=NhzGBwpDdc5W1hX7-ynGHSFH5T8srUUPpFw6zOORiMM,253 -pip/_internal/utils/deprecation.py,sha256=onEDau8zZyztsQf5HjhHTckTChbXIIdOWRh_Ugz1PSQ,3304 -pip/_internal/utils/direct_url_helpers.py,sha256=7xVyieLJtD1SmB1xsNhIPsYBGIDK7AZGQUtfZyRi0tQ,3073 -pip/_internal/utils/distutils_args.py,sha256=fw5ZrUBHRy2IWgLciAKUl7RA4Ryu6jWL-M9LNv90V2k,1291 -pip/_internal/utils/encoding.py,sha256=3Hr_T_shHHq5EJmQg7sUCeNY37pvmxEmQay6aPsK_4o,1205 -pip/_internal/utils/entrypoints.py,sha256=Iq8laJFPEcErDlGcPIshG_-VrUmfwLB3_nLWlT1EIKI,1082 -pip/_internal/utils/filesystem.py,sha256=8UhURyTKl2R1l9TAnYXuULsGNNMkH9IBPHAoRy4QEaU,6075 -pip/_internal/utils/filetypes.py,sha256=0VA-FQmevfgw7_9OAe7YXjxB3DcYUxpUypVKERWlU_I,789 -pip/_internal/utils/glibc.py,sha256=6i1vPIDuLfV3vKQeFe2oUa9QjSHGVlOkvysujEldOEE,3262 -pip/_internal/utils/hashes.py,sha256=dV10-3U4kcopR-XrArkX6vFSiLS9uNOhPbrv8olu8Qw,5332 -pip/_internal/utils/inject_securetransport.py,sha256=Wa89Vhq5SdlBGreg8wdE40iDJGTouYEyFuugMrOVUI0,846 -pip/_internal/utils/logging.py,sha256=cRHg2gUYXEUknl_WzZ2Zdxxah485Gr69wl8TpymaAHc,12735 -pip/_internal/utils/misc.py,sha256=Zt509grPCYtfQEI16CHULTX9nW8eRXbBucPQQasuOYk,24472 -pip/_internal/utils/models.py,sha256=89bZ42cL0YJUmV9GCaFLfs4ZiG_cDW1udAHc6UTCI2c,1376 -pip/_internal/utils/packaging.py,sha256=xTyBldqCDRn0_v9CQizadbHd3ZUTgjXeElTxrJW_JKo,2989 -pip/_internal/utils/parallel.py,sha256=7IFve8sBfphARNXprnhhuSyzlxfdDWaMP3LTFwCUL9c,3325 -pip/_internal/utils/pkg_resources.py,sha256=bkYDe05U5fph4t8TO-q06fpHQwuzookJqP0MokucHWg,1146 -pip/_internal/utils/setuptools_build.py,sha256=tO48Mgcb28GJf3zmkQlzBvsRR-2hdrpm1dipXFBkyaE,5220 -pip/_internal/utils/subprocess.py,sha256=0GB0g9r2muHAnljX2s_sX-x805eWWoDtdN_9JcCwKu8,10324 -pip/_internal/utils/temp_dir.py,sha256=gFwfsfEtM-y5Lb9ZqpbP1wy_K3o-vUPsMouAFQCy7mg,8210 -pip/_internal/utils/unpacking.py,sha256=klIaodkk3_rIg-VjN2s-PQFPfGXaVhOWpOwd46T7bHo,9317 -pip/_internal/utils/urls.py,sha256=pJQSXBv1vKtBFr9KPbSMYA5lY7-G9rjLHq0A8plI7yo,1863 -pip/_internal/utils/virtualenv.py,sha256=3JeTdc_O-2uZbfn7EmQKLyXurWKD3nKSEi856ZZWSC4,3675 -pip/_internal/utils/wheel.py,sha256=xeIImmT3FJfVBPv3J4jxsHJy2wLinnJXAsZOcrrMSAM,6479 -pip/_internal/vcs/__init__.py,sha256=6ZAbu6NoqDWJjYPWCtn8PaZjulAEgs-R0Xngq2Z174Q,611 -pip/_internal/vcs/__pycache__/__init__.cpython-39.pyc,, -pip/_internal/vcs/__pycache__/bazaar.cpython-39.pyc,, -pip/_internal/vcs/__pycache__/git.cpython-39.pyc,, -pip/_internal/vcs/__pycache__/mercurial.cpython-39.pyc,, -pip/_internal/vcs/__pycache__/subversion.cpython-39.pyc,, -pip/_internal/vcs/__pycache__/versioncontrol.cpython-39.pyc,, -pip/_internal/vcs/bazaar.py,sha256=6_3dygJ3x0TrnlsMx2-sokvNKpk-6EfH2zsMgAmLj4o,3058 -pip/_internal/vcs/git.py,sha256=vYxXxg4M6YIUxNQCswMJJ2ZiBkb4capqTziRrATcp0E,17853 -pip/_internal/vcs/mercurial.py,sha256=jrfkmZF7SLOwxrJroz-NjvTTMCvaWl8BnZATPdu1CsE,5234 -pip/_internal/vcs/subversion.py,sha256=Oy4kcrNGmimnatKWHGKtED-0Da6bjfuc2DtsnitUam0,12195 -pip/_internal/vcs/versioncontrol.py,sha256=7w9WNAlFXQj5pRlWA-3jA8XUwn1VSxbNfmWvI-aY2p0,23998 -pip/_internal/wheel_builder.py,sha256=3bibo47mjXw7rRChRqudDQObp5JynLQ5uZ8x81PtBq8,12100 -pip/_vendor/__init__.py,sha256=3sjRJDFysoLez0JAFlt8jJA0FUzWVPkt9AlJlcuNsC0,4814 -pip/_vendor/__pycache__/__init__.cpython-39.pyc,, -pip/_vendor/__pycache__/appdirs.cpython-39.pyc,, -pip/_vendor/__pycache__/distro.cpython-39.pyc,, -pip/_vendor/__pycache__/pyparsing.cpython-39.pyc,, -pip/_vendor/__pycache__/six.cpython-39.pyc,, -pip/_vendor/appdirs.py,sha256=Od1rs7d0yMmHLUc0FQn2DleIUbC--EEmM-UtXvFqAjM,26540 -pip/_vendor/cachecontrol/__init__.py,sha256=SR74BEsga7Z2I6-CH8doh2Oq_vH0GG7RCwjJg7TntdI,313 -pip/_vendor/cachecontrol/__pycache__/__init__.cpython-39.pyc,, -pip/_vendor/cachecontrol/__pycache__/_cmd.cpython-39.pyc,, -pip/_vendor/cachecontrol/__pycache__/adapter.cpython-39.pyc,, -pip/_vendor/cachecontrol/__pycache__/cache.cpython-39.pyc,, -pip/_vendor/cachecontrol/__pycache__/compat.cpython-39.pyc,, -pip/_vendor/cachecontrol/__pycache__/controller.cpython-39.pyc,, -pip/_vendor/cachecontrol/__pycache__/filewrapper.cpython-39.pyc,, -pip/_vendor/cachecontrol/__pycache__/heuristics.cpython-39.pyc,, -pip/_vendor/cachecontrol/__pycache__/serialize.cpython-39.pyc,, -pip/_vendor/cachecontrol/__pycache__/wrapper.cpython-39.pyc,, -pip/_vendor/cachecontrol/_cmd.py,sha256=KIO6PIJoXmNr5RGS2pZjDum1-40oR4fw5kE0LguxrY4,1352 -pip/_vendor/cachecontrol/adapter.py,sha256=FBRrYfpkXaH8hKogEgw6wYCScnL2SJFDZlHBNF0EvLE,5015 -pip/_vendor/cachecontrol/cache.py,sha256=gCo5R0D__iptJ49dUfxwWfu2Lc2OjpDs-MERy2hTpK8,844 -pip/_vendor/cachecontrol/caches/__init__.py,sha256=rN8Ox5dd2ucPtgkybgz77XfTTUL4HFTO2-n2ACK2q3E,88 -pip/_vendor/cachecontrol/caches/__pycache__/__init__.cpython-39.pyc,, -pip/_vendor/cachecontrol/caches/__pycache__/file_cache.cpython-39.pyc,, -pip/_vendor/cachecontrol/caches/__pycache__/redis_cache.cpython-39.pyc,, -pip/_vendor/cachecontrol/caches/file_cache.py,sha256=tw35e4ZnOsxqrlZ2fQ2VYz2FlUlCbFMerNu2tPwtRHY,4299 -pip/_vendor/cachecontrol/caches/redis_cache.py,sha256=hFJ_J9MCUTjblJCBT_cV_glP--2toqHDCKLRGUIHSOQ,889 -pip/_vendor/cachecontrol/compat.py,sha256=3BisP29GBHAo0QxUrbpBsMeXSp8YzKQcGHwEW7VYU2U,724 -pip/_vendor/cachecontrol/controller.py,sha256=fTDK1V7NjpnU1hwfMboX4Vyh73-uWgL6QkghtvvyTrY,14525 -pip/_vendor/cachecontrol/filewrapper.py,sha256=YsK9ISeZg26n-rS0z7MdEcMTyQ9gW_fLb6zIRJvE2rg,2613 -pip/_vendor/cachecontrol/heuristics.py,sha256=yndlfXHJZ5u_TC1ECrV4fVl68OuWiXnDS0HPyscK1MM,4205 -pip/_vendor/cachecontrol/serialize.py,sha256=7Jq5PcVBH6RVI-qkKkQsV5yAiZCFQa7yFhvITw_DYsc,7279 -pip/_vendor/cachecontrol/wrapper.py,sha256=tKJnzRvbl7uJRxOChwlNLdJf9NR0QlnknQxgNzQW2kM,719 -pip/_vendor/certifi/__init__.py,sha256=mRf2Fl2WmJxc7O-Zob068lpqa3nlsU4215CXzbkoBBU,65 -pip/_vendor/certifi/__main__.py,sha256=4JJNpOgznsXzgISGReUBrJGB6Q4zJOlIV99WFE185fM,267 -pip/_vendor/certifi/__pycache__/__init__.cpython-39.pyc,, -pip/_vendor/certifi/__pycache__/__main__.cpython-39.pyc,, -pip/_vendor/certifi/__pycache__/core.cpython-39.pyc,, -pip/_vendor/certifi/cacert.pem,sha256=3i-hfE2K5o3CBKG2tYt6ehJWk2fP64o6Th83fHPoPp4,259465 -pip/_vendor/certifi/core.py,sha256=u1ccq2BcSYX_ZtX61r6UFpwbKCKxNavjrzse_QVQ_PI,2916 -pip/_vendor/chardet/__init__.py,sha256=yxky3TQpsr5YTFEf5XYv0O4wq2e1WSilELYZ9e2AEes,3354 -pip/_vendor/chardet/__pycache__/__init__.cpython-39.pyc,, -pip/_vendor/chardet/__pycache__/big5freq.cpython-39.pyc,, -pip/_vendor/chardet/__pycache__/big5prober.cpython-39.pyc,, -pip/_vendor/chardet/__pycache__/chardistribution.cpython-39.pyc,, -pip/_vendor/chardet/__pycache__/charsetgroupprober.cpython-39.pyc,, -pip/_vendor/chardet/__pycache__/charsetprober.cpython-39.pyc,, -pip/_vendor/chardet/__pycache__/codingstatemachine.cpython-39.pyc,, -pip/_vendor/chardet/__pycache__/compat.cpython-39.pyc,, -pip/_vendor/chardet/__pycache__/cp949prober.cpython-39.pyc,, -pip/_vendor/chardet/__pycache__/enums.cpython-39.pyc,, -pip/_vendor/chardet/__pycache__/escprober.cpython-39.pyc,, -pip/_vendor/chardet/__pycache__/escsm.cpython-39.pyc,, -pip/_vendor/chardet/__pycache__/eucjpprober.cpython-39.pyc,, -pip/_vendor/chardet/__pycache__/euckrfreq.cpython-39.pyc,, -pip/_vendor/chardet/__pycache__/euckrprober.cpython-39.pyc,, -pip/_vendor/chardet/__pycache__/euctwfreq.cpython-39.pyc,, -pip/_vendor/chardet/__pycache__/euctwprober.cpython-39.pyc,, -pip/_vendor/chardet/__pycache__/gb2312freq.cpython-39.pyc,, -pip/_vendor/chardet/__pycache__/gb2312prober.cpython-39.pyc,, -pip/_vendor/chardet/__pycache__/hebrewprober.cpython-39.pyc,, -pip/_vendor/chardet/__pycache__/jisfreq.cpython-39.pyc,, -pip/_vendor/chardet/__pycache__/jpcntx.cpython-39.pyc,, -pip/_vendor/chardet/__pycache__/langbulgarianmodel.cpython-39.pyc,, -pip/_vendor/chardet/__pycache__/langgreekmodel.cpython-39.pyc,, -pip/_vendor/chardet/__pycache__/langhebrewmodel.cpython-39.pyc,, -pip/_vendor/chardet/__pycache__/langhungarianmodel.cpython-39.pyc,, -pip/_vendor/chardet/__pycache__/langrussianmodel.cpython-39.pyc,, -pip/_vendor/chardet/__pycache__/langthaimodel.cpython-39.pyc,, -pip/_vendor/chardet/__pycache__/langturkishmodel.cpython-39.pyc,, -pip/_vendor/chardet/__pycache__/latin1prober.cpython-39.pyc,, -pip/_vendor/chardet/__pycache__/mbcharsetprober.cpython-39.pyc,, -pip/_vendor/chardet/__pycache__/mbcsgroupprober.cpython-39.pyc,, -pip/_vendor/chardet/__pycache__/mbcssm.cpython-39.pyc,, -pip/_vendor/chardet/__pycache__/sbcharsetprober.cpython-39.pyc,, -pip/_vendor/chardet/__pycache__/sbcsgroupprober.cpython-39.pyc,, -pip/_vendor/chardet/__pycache__/sjisprober.cpython-39.pyc,, -pip/_vendor/chardet/__pycache__/universaldetector.cpython-39.pyc,, -pip/_vendor/chardet/__pycache__/utf8prober.cpython-39.pyc,, -pip/_vendor/chardet/__pycache__/version.cpython-39.pyc,, -pip/_vendor/chardet/big5freq.py,sha256=dwRzRlsGp3Zgr1JQSSSwnxvyaZ7_q-5kuPfCVMuy4to,31640 -pip/_vendor/chardet/big5prober.py,sha256=TpmdoNfRtnQ7x9Q_p-a1CHaG-ok2mbisN5e9UHAtOiY,1804 -pip/_vendor/chardet/chardistribution.py,sha256=NzboAhfS6GODy_Tp6BkmUOL4NuxwTVfdVFcKA9bdUAo,9644 -pip/_vendor/chardet/charsetgroupprober.py,sha256=NPYh0Agp8UnrfqIls_qdbwszQ1mv9imGawGUCErFT6M,3946 -pip/_vendor/chardet/charsetprober.py,sha256=kk5-m0VdjqzbEhPRkBZ386R3fBQo3DxsBrdL-WFyk1o,5255 -pip/_vendor/chardet/cli/__init__.py,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2 -pip/_vendor/chardet/cli/__pycache__/__init__.cpython-39.pyc,, -pip/_vendor/chardet/cli/__pycache__/chardetect.cpython-39.pyc,, -pip/_vendor/chardet/cli/chardetect.py,sha256=535zsG4tA_x-_xPtEeDvn46QLib2nvF-5NT_nJdGgVs,2831 -pip/_vendor/chardet/codingstatemachine.py,sha256=qz9ZwK1q4mZ4s4zDRbyXu5KaGunYbk7g1Z7fqfb4mA4,3678 -pip/_vendor/chardet/compat.py,sha256=3j2eGvEAakISaIanHZ4wZutzfttNdRSdlo6RSjpyxsM,1236 -pip/_vendor/chardet/cp949prober.py,sha256=5NnMVUcel3jDY3w8ljD0cXyj2lcrvdagxOVE1jxl7xc,1904 -pip/_vendor/chardet/enums.py,sha256=3H_EIVP-VUYOdKqe2xmYdyooEDSLqS8sACMbn_3oejU,1737 -pip/_vendor/chardet/escprober.py,sha256=5MrTnVtZGEt3ssnY-lOXmOo3JY-CIqz9ruG3KjDpkbY,4051 -pip/_vendor/chardet/escsm.py,sha256=xQbwmM3Ieuskg-Aohyc6-bSfg3vsY0tx2TEKLDoVZGg,10756 -pip/_vendor/chardet/eucjpprober.py,sha256=PHumemJS19xMhDR4xPrsvxMfyBfsb297kVWmYz6zgy8,3841 -pip/_vendor/chardet/euckrfreq.py,sha256=MrLrIWMtlaDI0LYt-MM3MougBbLtSWHs6kvZx0VasIM,13741 -pip/_vendor/chardet/euckrprober.py,sha256=VbiOn7_id7mL9Q5GdeV0Ze3w5fG0nRCpUkEzeR-bnnY,1795 -pip/_vendor/chardet/euctwfreq.py,sha256=ZPBIHZDwNknGf7m6r4xGH8bX0W38qBpnTwVVv1QHw_M,32008 -pip/_vendor/chardet/euctwprober.py,sha256=hlUyGKUxzOPfBxCcyUcvRZSxgkLuvRoDU9wejp6YMiM,1793 -pip/_vendor/chardet/gb2312freq.py,sha256=aLHs-2GS8vmSM2ljyoWWgeVq_xRRcS_gN7ykpIiV43A,20998 -pip/_vendor/chardet/gb2312prober.py,sha256=msVbrDFcrJRE_XvsyETiqbTGfvdFhVIEZ2zBd-OENaE,1800 -pip/_vendor/chardet/hebrewprober.py,sha256=r81LqgKb24ZbvOmfi95MzItUxx7bkrjJR1ppkj5rvZw,14130 -pip/_vendor/chardet/jisfreq.py,sha256=vrqCR4CmwownBVXJ3Hh_gsfiDnIHOELbcNmTyC6Jx3w,26102 -pip/_vendor/chardet/jpcntx.py,sha256=Cn4cypo2y8CpqCan-zsdfYdEgXkRCnsqQoYaCu6FRjI,19876 -pip/_vendor/chardet/langbulgarianmodel.py,sha256=IuDOQ4uAe5spaYXt1F-2_496DFYd3J5lyLKKbVg-Nkw,110347 -pip/_vendor/chardet/langgreekmodel.py,sha256=cZRowhYjEUNYCevhuD5ZMHMiOIf3Pk1IpRixjTpRPB0,103969 -pip/_vendor/chardet/langhebrewmodel.py,sha256=p-xw_b2XvGVSIQFgQL91cVpS7u3vPpGJZ0udYxD07Do,103159 -pip/_vendor/chardet/langhungarianmodel.py,sha256=EKIZs5Z8Y-l6ORDcBzE9htOMMnAnr2j6Wb1PFRBMVxM,107148 -pip/_vendor/chardet/langrussianmodel.py,sha256=TFH-3rTFzbCBF15oasmoqf92FKBnwWY_HaN2ptl5WVo,136898 -pip/_vendor/chardet/langthaimodel.py,sha256=rTzLQ2x_RjQEzZfIksCR--SCFQyuP5eCtQpqxyl5-x8,107695 -pip/_vendor/chardet/langturkishmodel.py,sha256=fWI_tafe_UQ24gdOGqOWy1tnEY2jxKHoi4ueoT3rrrc,100329 -pip/_vendor/chardet/latin1prober.py,sha256=s1SFkEFY2NGe2_9bgX2MhOmyM_U_qSd_jVSdkdSgZxs,5515 -pip/_vendor/chardet/mbcharsetprober.py,sha256=hzFVD-brxTAVLnTAkDqa1ztd6RwGGwb5oAdvhj1-lE8,3504 -pip/_vendor/chardet/mbcsgroupprober.py,sha256=DlT-X7KRUl5y3SWJNqF1NXqvkjVc47jPKjJ2j4KVs3A,2066 -pip/_vendor/chardet/mbcssm.py,sha256=LGUDh1VB61rWsZB4QlJBzaCjI2PUEUgbBc91gPlX4DQ,26053 -pip/_vendor/chardet/metadata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -pip/_vendor/chardet/metadata/__pycache__/__init__.cpython-39.pyc,, -pip/_vendor/chardet/metadata/__pycache__/languages.cpython-39.pyc,, -pip/_vendor/chardet/metadata/languages.py,sha256=pGf_EnapgynSUCViRjUcwEi7AWw_bYPJFHCqerAFSbQ,19784 -pip/_vendor/chardet/sbcharsetprober.py,sha256=VPAZ5z-o8ixIIfEGTScLVXeQxkd3Zqi1eceerr0rb78,6281 -pip/_vendor/chardet/sbcsgroupprober.py,sha256=p8XICsXYXOF78Anypfvdne8K_0p8qFC-SUF5nwD1fo4,4392 -pip/_vendor/chardet/sjisprober.py,sha256=1WGev_SSHpa7AVXmM0DIONl1OvyKc8mdydUNaKtGGNI,3866 -pip/_vendor/chardet/universaldetector.py,sha256=C3ryFrDZ9JuroNMdYwgDa2_zAYJlWuPHyHLX5WtCY-g,12789 -pip/_vendor/chardet/utf8prober.py,sha256=rGwn69WfIvmibp0sWvYuH_TPoXs7zzwKHTX79Ojbr9o,2848 -pip/_vendor/chardet/version.py,sha256=LCY3oiBIflXJGeBYm7ly2aw6P9n272rhp3t7qz3oOHo,251 -pip/_vendor/colorama/__init__.py,sha256=besK61Glmusp-wZ1wjjSlsPKEY_6zndaeulh1FkVStw,245 -pip/_vendor/colorama/__pycache__/__init__.cpython-39.pyc,, -pip/_vendor/colorama/__pycache__/ansi.cpython-39.pyc,, -pip/_vendor/colorama/__pycache__/ansitowin32.cpython-39.pyc,, -pip/_vendor/colorama/__pycache__/initialise.cpython-39.pyc,, -pip/_vendor/colorama/__pycache__/win32.cpython-39.pyc,, -pip/_vendor/colorama/__pycache__/winterm.cpython-39.pyc,, -pip/_vendor/colorama/ansi.py,sha256=121ZIWJSdXR76TcqKXusVZQRgyb0AIlRnf5EW6oSGlQ,2624 -pip/_vendor/colorama/ansitowin32.py,sha256=bZByVMjpiUp-LSAK21KNvCh63UN9CPkXdHFPUsq20kA,10775 -pip/_vendor/colorama/initialise.py,sha256=J92wwYPAAEgdlAyw-ady4JJxl1j9UmXPodi0HicWDwg,1995 -pip/_vendor/colorama/win32.py,sha256=fI0Ani_DO_cYDAbHz_a0BsMbDKHCA1-P3PGcj0eDCmA,5556 -pip/_vendor/colorama/winterm.py,sha256=Zurpa5AEwarU62JTuERX53gGelEWH5SBUiAXN4CxMtA,6607 -pip/_vendor/distlib/__init__.py,sha256=iP0jP2IxDeV5bLyzuna9JsdxOw2AO-VqAMXslthb-oQ,604 -pip/_vendor/distlib/__pycache__/__init__.cpython-39.pyc,, -pip/_vendor/distlib/__pycache__/compat.cpython-39.pyc,, -pip/_vendor/distlib/__pycache__/database.cpython-39.pyc,, -pip/_vendor/distlib/__pycache__/index.cpython-39.pyc,, -pip/_vendor/distlib/__pycache__/locators.cpython-39.pyc,, -pip/_vendor/distlib/__pycache__/manifest.cpython-39.pyc,, -pip/_vendor/distlib/__pycache__/markers.cpython-39.pyc,, -pip/_vendor/distlib/__pycache__/metadata.cpython-39.pyc,, -pip/_vendor/distlib/__pycache__/resources.cpython-39.pyc,, -pip/_vendor/distlib/__pycache__/scripts.cpython-39.pyc,, -pip/_vendor/distlib/__pycache__/util.cpython-39.pyc,, -pip/_vendor/distlib/__pycache__/version.cpython-39.pyc,, -pip/_vendor/distlib/__pycache__/wheel.cpython-39.pyc,, -pip/_vendor/distlib/_backport/__init__.py,sha256=XkACqtjaFfFn1QQBFDNxSqhMva0LqXeeh6H3fVwwLQ4,280 -pip/_vendor/distlib/_backport/__pycache__/__init__.cpython-39.pyc,, -pip/_vendor/distlib/_backport/__pycache__/misc.cpython-39.pyc,, -pip/_vendor/distlib/_backport/__pycache__/shutil.cpython-39.pyc,, -pip/_vendor/distlib/_backport/__pycache__/sysconfig.cpython-39.pyc,, -pip/_vendor/distlib/_backport/__pycache__/tarfile.cpython-39.pyc,, -pip/_vendor/distlib/_backport/misc.py,sha256=focjmI7975W3LgEtiNC99lvxohfZdsNSLTakOcPNShs,1012 -pip/_vendor/distlib/_backport/shutil.py,sha256=h-yIttFtLq-_LKn5lLn4beHXzRwcmo2wEg4UKU7hX6E,26471 -pip/_vendor/distlib/_backport/sysconfig.cfg,sha256=LoipPkR2PfCKC7JUQBGxp6OFVlWIiWBXT-rNuzv8acU,2701 -pip/_vendor/distlib/_backport/sysconfig.py,sha256=qV5ZK6YVkHS-gUFacIT2TpFBw7bZJFH3DYa8PbT6O54,27640 -pip/_vendor/distlib/_backport/tarfile.py,sha256=fzwGLsCdTmO8uzoHjyjSgu4-srrDQEAcw4jNKUfvQH0,95235 -pip/_vendor/distlib/compat.py,sha256=Z8PBQ-ZPCJuRvzs5rtHuzceFOB8iYV8HHjAGrW3SQ8s,42528 -pip/_vendor/distlib/database.py,sha256=m_LtL3siDUdcSvftoTnXcjhUJA-WZhDwTvHO7rg72SA,52398 -pip/_vendor/distlib/index.py,sha256=LMZK2uX_oH2SNgPQ_lnnoJFFx6X5ByY-LBP8qgUTuC0,21248 -pip/_vendor/distlib/locators.py,sha256=mefGpRbPPG1Bl-UhNUquwBQR50J8uL0x2CSG-c5mbJs,53265 -pip/_vendor/distlib/manifest.py,sha256=0TlGw5ZyFp8wxr_GJz7tAAXGYwUJvceMIOsh9ydAXpM,15204 -pip/_vendor/distlib/markers.py,sha256=lTFISO7AcGHoYk2AQx_VFrjDltOFAg5YnPTvBGnOZtE,4474 -pip/_vendor/distlib/metadata.py,sha256=tCLNLfWfC-lQacX4bY-mBTKPgJZTiowKnLX2HWUcQeE,40167 -pip/_vendor/distlib/resources.py,sha256=DMriFf8j-5IXduPHW0YPnx50jQIbaOlvTQkPcdN5r88,11178 -pip/_vendor/distlib/scripts.py,sha256=-jtzATPNKOj8VpnxJUh1aXdUUkNpXiop-bOwsojbwWA,17671 -pip/_vendor/distlib/t32.exe,sha256=NS3xBCVAld35JVFNmb-1QRyVtThukMrwZVeXn4LhaEQ,96768 -pip/_vendor/distlib/t64.exe,sha256=oAqHes78rUWVM0OtVqIhUvequl_PKhAhXYQWnUf7zR0,105984 -pip/_vendor/distlib/util.py,sha256=w5nS2W71eWhilj69cZbERp6NR5rV1p_yIUbkwpvtqu4,69523 -pip/_vendor/distlib/version.py,sha256=cI1oZGIqY11EQn5P-jI_OqQml7jIxLFS52syBFIpXNU,24247 -pip/_vendor/distlib/w32.exe,sha256=lJtnZdeUxTZWya_EW5DZos_K5rswRECGspIl8ZJCIXs,90112 -pip/_vendor/distlib/w64.exe,sha256=0aRzoN2BO9NWW4ENy4_4vHkHR4qZTFZNVSAJJYlODTI,99840 -pip/_vendor/distlib/wheel.py,sha256=NNoICc3pe4uSF-gHpmqgGwQs3Q-0dnn5418JHS1ZI6c,44118 -pip/_vendor/distro.py,sha256=ni3ahks9qSr3P1FMur9zTPEF_xcAdaHW8iWZWqwB5mU,44858 -pip/_vendor/html5lib/__init__.py,sha256=Bmlpvs5dN2GoaWRAvN2UZ1yF_p7xb2zROelA0QxBKis,1195 -pip/_vendor/html5lib/__pycache__/__init__.cpython-39.pyc,, -pip/_vendor/html5lib/__pycache__/_ihatexml.cpython-39.pyc,, -pip/_vendor/html5lib/__pycache__/_inputstream.cpython-39.pyc,, -pip/_vendor/html5lib/__pycache__/_tokenizer.cpython-39.pyc,, -pip/_vendor/html5lib/__pycache__/_utils.cpython-39.pyc,, -pip/_vendor/html5lib/__pycache__/constants.cpython-39.pyc,, -pip/_vendor/html5lib/__pycache__/html5parser.cpython-39.pyc,, -pip/_vendor/html5lib/__pycache__/serializer.cpython-39.pyc,, -pip/_vendor/html5lib/_ihatexml.py,sha256=IyMKE35pNPCYYGs290_oSUhWXF1BQZsbVcXBzGuFvl4,17017 -pip/_vendor/html5lib/_inputstream.py,sha256=EA6Wj46jxuK6544Vnk9YOjIpFwGbfJW0Ar2cMH1H0VU,33271 -pip/_vendor/html5lib/_tokenizer.py,sha256=BUDNWZENVB0oFBiKR49sZsqQU4rzLLa13-byISlYRfA,78775 -pip/_vendor/html5lib/_trie/__init__.py,sha256=kfSo27BaU64El8U7bg4ugLmI3Ksywu54xE6BlhVgggA,114 -pip/_vendor/html5lib/_trie/__pycache__/__init__.cpython-39.pyc,, -pip/_vendor/html5lib/_trie/__pycache__/_base.cpython-39.pyc,, -pip/_vendor/html5lib/_trie/__pycache__/py.cpython-39.pyc,, -pip/_vendor/html5lib/_trie/_base.py,sha256=LTpLNz1pn7LAcfn2TFvRp4moVPbFTkkbhzjPKUrvGes,1053 -pip/_vendor/html5lib/_trie/py.py,sha256=LmuYcbypKw-aMLcT0-IY6WewATGzg1QRkmyd8hTBQeY,1842 -pip/_vendor/html5lib/_utils.py,sha256=dLFxoZDTv5r38HOIHy45uxWwUY7VhLgbEFWNQw6Wppo,5090 -pip/_vendor/html5lib/constants.py,sha256=P9n6_ScDgAFkst0YfKaB-yaAlxVtUS9uMn5Lh8ywbQo,86410 -pip/_vendor/html5lib/filters/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -pip/_vendor/html5lib/filters/__pycache__/__init__.cpython-39.pyc,, -pip/_vendor/html5lib/filters/__pycache__/alphabeticalattributes.cpython-39.pyc,, -pip/_vendor/html5lib/filters/__pycache__/base.cpython-39.pyc,, -pip/_vendor/html5lib/filters/__pycache__/inject_meta_charset.cpython-39.pyc,, -pip/_vendor/html5lib/filters/__pycache__/lint.cpython-39.pyc,, -pip/_vendor/html5lib/filters/__pycache__/optionaltags.cpython-39.pyc,, -pip/_vendor/html5lib/filters/__pycache__/sanitizer.cpython-39.pyc,, -pip/_vendor/html5lib/filters/__pycache__/whitespace.cpython-39.pyc,, -pip/_vendor/html5lib/filters/alphabeticalattributes.py,sha256=0TV6VWJzhNkcLFiR7BNZUJsTJgAEEyZ02in6-PuL2gU,948 -pip/_vendor/html5lib/filters/base.py,sha256=6D2t423hbOLtjnvAAOrs1mWX1vsabMLBrWQF67ITPho,298 -pip/_vendor/html5lib/filters/inject_meta_charset.py,sha256=J-W5X3LyosH1sUipiHU1x-2ocd7g9JSudpIek_QlCUU,3018 -pip/_vendor/html5lib/filters/lint.py,sha256=O6sK29HXXW02Nv-EIEOfGvdQMuXxWvBePu2sQ2ecbJc,3736 -pip/_vendor/html5lib/filters/optionaltags.py,sha256=IVHcJ35kr6_MYBqahFMIK-Gel-ALLUk6Wk9X-or_yXk,10795 -pip/_vendor/html5lib/filters/sanitizer.py,sha256=uwT0HNJHjnw3Omf2LpmvfoVdIgAWb9_3VrMcWD1es_M,27813 -pip/_vendor/html5lib/filters/whitespace.py,sha256=bCC0mMQZicbq8HCg67pip_oScN5Fz_KkkvldfE137Kw,1252 -pip/_vendor/html5lib/html5parser.py,sha256=2xGZMaUvdkuuswAmpkazK1CXHT_y3-XTy4lS71PYUuU,119981 -pip/_vendor/html5lib/serializer.py,sha256=vMivcnRcQxjCSTrbMFdevLMhJ2HbF0cfv_CkroTODZM,16168 -pip/_vendor/html5lib/treeadapters/__init__.py,sha256=76InX2oJAx-C4rGAJziZsoE_CHI8_3thl6TeMgP-ypk,709 -pip/_vendor/html5lib/treeadapters/__pycache__/__init__.cpython-39.pyc,, -pip/_vendor/html5lib/treeadapters/__pycache__/genshi.cpython-39.pyc,, -pip/_vendor/html5lib/treeadapters/__pycache__/sax.cpython-39.pyc,, -pip/_vendor/html5lib/treeadapters/genshi.py,sha256=nQHNa4Hu0IMpu4bqHbJJS3_Cd1pKXgDO1pgMZ6gADDg,1769 -pip/_vendor/html5lib/treeadapters/sax.py,sha256=PAmV6NG9BSpfMHUY72bDbXwAe6Q2tPn1BC2yAD-K1G0,1826 -pip/_vendor/html5lib/treebuilders/__init__.py,sha256=zfrXDjeqDo2M7cJFax6hRJs70Az4pfHFiZbuLOZ9YE4,3680 -pip/_vendor/html5lib/treebuilders/__pycache__/__init__.cpython-39.pyc,, -pip/_vendor/html5lib/treebuilders/__pycache__/base.cpython-39.pyc,, -pip/_vendor/html5lib/treebuilders/__pycache__/dom.cpython-39.pyc,, -pip/_vendor/html5lib/treebuilders/__pycache__/etree.cpython-39.pyc,, -pip/_vendor/html5lib/treebuilders/__pycache__/etree_lxml.cpython-39.pyc,, -pip/_vendor/html5lib/treebuilders/base.py,sha256=Yao9LOJd-4KaLEx-3ysqRkAkhv1YaDqhTksvX6nuQyY,14982 -pip/_vendor/html5lib/treebuilders/dom.py,sha256=QWkBtUprtDosTiTFlIY6QpgKwk2-pD0AV84qVTNgiLo,9164 -pip/_vendor/html5lib/treebuilders/etree.py,sha256=k-LHrme562Hd5GmIi87r1_vfF25MtURGPurT3mAp8sY,13179 -pip/_vendor/html5lib/treebuilders/etree_lxml.py,sha256=CviyyGjvv2TwN-m47DC8DFWdx0Gt-atRw9jMTv4v8-Q,15158 -pip/_vendor/html5lib/treewalkers/__init__.py,sha256=buyxCJb9LFfJ_1ZIMdc-Do1zV93Uw-7L942o2H-Swy0,5873 -pip/_vendor/html5lib/treewalkers/__pycache__/__init__.cpython-39.pyc,, -pip/_vendor/html5lib/treewalkers/__pycache__/base.cpython-39.pyc,, -pip/_vendor/html5lib/treewalkers/__pycache__/dom.cpython-39.pyc,, -pip/_vendor/html5lib/treewalkers/__pycache__/etree.cpython-39.pyc,, -pip/_vendor/html5lib/treewalkers/__pycache__/etree_lxml.cpython-39.pyc,, -pip/_vendor/html5lib/treewalkers/__pycache__/genshi.cpython-39.pyc,, -pip/_vendor/html5lib/treewalkers/base.py,sha256=g-cLq7VStBtpZZZ1v_Tbwp3GhJjQ2oG5njgeHVhAaXE,7728 -pip/_vendor/html5lib/treewalkers/dom.py,sha256=fBJht3gn5a6y1WN2KE9gsUru158yTQ0KikT3vOM7Xc4,1456 -pip/_vendor/html5lib/treewalkers/etree.py,sha256=VtcKOS13qy9nv2PAaYoB1j9V1Z8n9o0AEA9KoGAgYOg,4682 -pip/_vendor/html5lib/treewalkers/etree_lxml.py,sha256=u9X06RqSrHanDb0qGI-v8I99-PqzOzmnpZOspHHz_Io,6572 -pip/_vendor/html5lib/treewalkers/genshi.py,sha256=P_2Tnc2GkbWJfuodXN9oYIg6kN9E26aWXXe9iL0_eX4,2378 -pip/_vendor/idna/__init__.py,sha256=aHTBHXXun6n0ecdus8ToBvhs-4Ziin24HuNbJ9ZXE3o,893 -pip/_vendor/idna/__pycache__/__init__.cpython-39.pyc,, -pip/_vendor/idna/__pycache__/codec.cpython-39.pyc,, -pip/_vendor/idna/__pycache__/compat.cpython-39.pyc,, -pip/_vendor/idna/__pycache__/core.cpython-39.pyc,, -pip/_vendor/idna/__pycache__/idnadata.cpython-39.pyc,, -pip/_vendor/idna/__pycache__/intranges.cpython-39.pyc,, -pip/_vendor/idna/__pycache__/package_data.cpython-39.pyc,, -pip/_vendor/idna/__pycache__/uts46data.cpython-39.pyc,, -pip/_vendor/idna/codec.py,sha256=LtpT6KflQ-NkZZXgLc0_ADLiShhKuC__nz_JmYyLnXs,3570 -pip/_vendor/idna/compat.py,sha256=Y-t409G3-dxunv_cSx0zrDjJkOKtC60ALLuqSknryXc,376 -pip/_vendor/idna/core.py,sha256=PWa20xVmQMBN8zgaBNXGNKCbQHOdnqKEpdcWCxXTidw,13235 -pip/_vendor/idna/idnadata.py,sha256=z3JZKnxitScqic6U-cO3rM_SmC2P0-UjUHEDnGv1xsQ,44400 -pip/_vendor/idna/intranges.py,sha256=Ipf6IPZDhD56FppDz_tjl_1YWzzh_viPiEBBp_nSQ8k,1991 -pip/_vendor/idna/package_data.py,sha256=MMuW8HkL_d3g6tkyzl7kIEN-fg9uyv6YDmk_v_jjL3U,23 -pip/_vendor/idna/uts46data.py,sha256=l_0BwSDthDPKq_AX35avb7jnXUgPEKgjf816traOf8s,210287 -pip/_vendor/msgpack/__init__.py,sha256=OhoFouHD7wOYMP2PN-Hlyk9RAZw39V-iPTDRsmkoIns,1172 -pip/_vendor/msgpack/__pycache__/__init__.cpython-39.pyc,, -pip/_vendor/msgpack/__pycache__/_version.cpython-39.pyc,, -pip/_vendor/msgpack/__pycache__/exceptions.cpython-39.pyc,, -pip/_vendor/msgpack/__pycache__/ext.cpython-39.pyc,, -pip/_vendor/msgpack/__pycache__/fallback.cpython-39.pyc,, -pip/_vendor/msgpack/_version.py,sha256=qcv5IclQy1PSvtCYDvZyjaUSFWdHPIRzdGjv3YwkKCs,21 -pip/_vendor/msgpack/exceptions.py,sha256=2fCtczricqQgdT3NtW6cTqmZn3WA7GQtmlPuT-NhLyM,1129 -pip/_vendor/msgpack/ext.py,sha256=3Xznjz11nxxfQJe50uLzKDznWOvxOBxWSZ833DL_DDs,6281 -pip/_vendor/msgpack/fallback.py,sha256=ZaNwBMO2hh9WrqHnYqdHJaCv8zzPMnva9YhD5yInTpM,39113 -pip/_vendor/packaging/__about__.py,sha256=eoW72tGZd0YfLOf_tDScx_kjG1SFtdXMg79yNoJrxg4,687 -pip/_vendor/packaging/__init__.py,sha256=Rtl7XZgdQyDFurOf4u9TWH8UM8-Y6pNC9mfN1QP5NZY,522 -pip/_vendor/packaging/__pycache__/__about__.cpython-39.pyc,, -pip/_vendor/packaging/__pycache__/__init__.cpython-39.pyc,, -pip/_vendor/packaging/__pycache__/_manylinux.cpython-39.pyc,, -pip/_vendor/packaging/__pycache__/_musllinux.cpython-39.pyc,, -pip/_vendor/packaging/__pycache__/_structures.cpython-39.pyc,, -pip/_vendor/packaging/__pycache__/markers.cpython-39.pyc,, -pip/_vendor/packaging/__pycache__/requirements.cpython-39.pyc,, -pip/_vendor/packaging/__pycache__/specifiers.cpython-39.pyc,, -pip/_vendor/packaging/__pycache__/tags.cpython-39.pyc,, -pip/_vendor/packaging/__pycache__/utils.cpython-39.pyc,, -pip/_vendor/packaging/__pycache__/version.cpython-39.pyc,, -pip/_vendor/packaging/_manylinux.py,sha256=qLGjZQVH7CwWE2jjOIyE2f4hektTsbtFc7UxfRCQzMI,11789 -pip/_vendor/packaging/_musllinux.py,sha256=Eq-8bd_ZnxcxPEZ-N4TTl7_HATTosVSmxMhZidXvg5g,4514 -pip/_vendor/packaging/_structures.py,sha256=9-rULC3_oZTgVRl9Furm3bFZe7xVsZeGiway_piR3c0,1696 -pip/_vendor/packaging/markers.py,sha256=nTk-tDQYPWjSMZSUIwGVaIvY3NbYmtQQLSXvAgBBxL8,8791 -pip/_vendor/packaging/requirements.py,sha256=PKbV9AWRNnqd0jGBMi83GPyS3hAUmx8IMxjQSJEBXsY,4822 -pip/_vendor/packaging/specifiers.py,sha256=HeDND7swHCqUzD9mKLuvXwBp8Rl-sBdWoA9okxul8cA,31792 -pip/_vendor/packaging/tags.py,sha256=aUZfcmH14rf5DAwYCHHjx5Z9zWnPAYqm9QKJf0yEkRk,16198 -pip/_vendor/packaging/utils.py,sha256=wl4SX90PE-_rF8s24QsN30N9afxY8BX42yKBmwI3wtU,4336 -pip/_vendor/packaging/version.py,sha256=CfhEcnRcBUAgA2viaZV9i5f84V0goapf5vSGgg3Yxl0,15169 -pip/_vendor/pep517/__init__.py,sha256=_xFPzQ0RNMbFs0cvD091C2aMOneiq-cTNfGj9uSTc3k,136 -pip/_vendor/pep517/__pycache__/__init__.cpython-39.pyc,, -pip/_vendor/pep517/__pycache__/build.cpython-39.pyc,, -pip/_vendor/pep517/__pycache__/check.cpython-39.pyc,, -pip/_vendor/pep517/__pycache__/colorlog.cpython-39.pyc,, -pip/_vendor/pep517/__pycache__/compat.cpython-39.pyc,, -pip/_vendor/pep517/__pycache__/dirtools.cpython-39.pyc,, -pip/_vendor/pep517/__pycache__/envbuild.cpython-39.pyc,, -pip/_vendor/pep517/__pycache__/meta.cpython-39.pyc,, -pip/_vendor/pep517/__pycache__/wrappers.cpython-39.pyc,, -pip/_vendor/pep517/build.py,sha256=MDBFdwDA7ygdOFkHRZDA2vmbLuM5vIg3PYnHAszhMz8,3596 -pip/_vendor/pep517/check.py,sha256=FwTS6MXy67e7MCC3QPsN4g7sou0Pg1FkXxMBLimFJQ4,6303 -pip/_vendor/pep517/colorlog.py,sha256=uOdcoDYZ0ocKGRPPs5JgvpLYVDIfoEVvoMpc43ICQFU,4213 -pip/_vendor/pep517/compat.py,sha256=BmdEmQQW3XQqBjgDov0EWT-q1V-ECANNzDp692gUTdg,1113 -pip/_vendor/pep517/dirtools.py,sha256=hrSzAJOGDo3tXdtCbgJ6LqoLhPVJn6JGmekz1ofLi6o,1173 -pip/_vendor/pep517/envbuild.py,sha256=D8XnGq1CZKAuIAMZQxpJQrvDwkjKRzKotHAOpr_AF1M,6283 -pip/_vendor/pep517/in_process/__init__.py,sha256=IZ3Qr3CBsGM77dePRWUxnF9FADyAi0imlDLX5MWGPz8,580 -pip/_vendor/pep517/in_process/__pycache__/__init__.cpython-39.pyc,, -pip/_vendor/pep517/in_process/__pycache__/_in_process.cpython-39.pyc,, -pip/_vendor/pep517/in_process/_in_process.py,sha256=MW1-Z-5WuMGVy0cdY3-kgSr2rEO7bIYDlhgMuMHciEw,11182 -pip/_vendor/pep517/meta.py,sha256=ZkHYB0YHt4FDuSE5NdFuVsat3xfZ6LgW6VS6d4D6vIQ,2555 -pip/_vendor/pep517/wrappers.py,sha256=mgBTFXDKJtKluWpQ7VMZda49ZUzFGSNu5d_PYJLoor0,13629 -pip/_vendor/pkg_resources/__init__.py,sha256=zeMvnKzGEcWISjTwy6YtFKWamTFJdwBwYjBAFUoyf7A,111573 -pip/_vendor/pkg_resources/__pycache__/__init__.cpython-39.pyc,, -pip/_vendor/pkg_resources/__pycache__/py31compat.cpython-39.pyc,, -pip/_vendor/pkg_resources/py31compat.py,sha256=tzQGe-w8g7GEXb6Ozw2-v8ZHaIygADmw0LAgriYzPAc,585 -pip/_vendor/progress/__init__.py,sha256=YTntFxK5CZDfVAa1b77EbNkWljGqvyM72YKRTHaHap8,5034 -pip/_vendor/progress/__pycache__/__init__.cpython-39.pyc,, -pip/_vendor/progress/__pycache__/bar.cpython-39.pyc,, -pip/_vendor/progress/__pycache__/counter.cpython-39.pyc,, -pip/_vendor/progress/__pycache__/spinner.cpython-39.pyc,, -pip/_vendor/progress/bar.py,sha256=evFQod41y2bMU60teK16uV-A5F4yVUehab8dtCiXj1E,2945 -pip/_vendor/progress/counter.py,sha256=c8AdstUGrFQvIQbvtHjjXxZx6LCflrY-a7DVM6IYTBs,1413 -pip/_vendor/progress/spinner.py,sha256=zLcx2RFinPfM6UwveJJrcJ8YABE3aLCAKqQFVD3pHow,1423 -pip/_vendor/pyparsing.py,sha256=lD3A8iEK1JYvnNDP00Cgve4vZjwEFonCvrpo7mEl3Q8,280501 -pip/_vendor/requests/__init__.py,sha256=IPdrlLH8zOpx45fFKwMSH9HT_d9wfwdjjoka0HEY9ps,5267 -pip/_vendor/requests/__pycache__/__init__.cpython-39.pyc,, -pip/_vendor/requests/__pycache__/__version__.cpython-39.pyc,, -pip/_vendor/requests/__pycache__/_internal_utils.cpython-39.pyc,, -pip/_vendor/requests/__pycache__/adapters.cpython-39.pyc,, -pip/_vendor/requests/__pycache__/api.cpython-39.pyc,, -pip/_vendor/requests/__pycache__/auth.cpython-39.pyc,, -pip/_vendor/requests/__pycache__/certs.cpython-39.pyc,, -pip/_vendor/requests/__pycache__/compat.cpython-39.pyc,, -pip/_vendor/requests/__pycache__/cookies.cpython-39.pyc,, -pip/_vendor/requests/__pycache__/exceptions.cpython-39.pyc,, -pip/_vendor/requests/__pycache__/help.cpython-39.pyc,, -pip/_vendor/requests/__pycache__/hooks.cpython-39.pyc,, -pip/_vendor/requests/__pycache__/models.cpython-39.pyc,, -pip/_vendor/requests/__pycache__/packages.cpython-39.pyc,, -pip/_vendor/requests/__pycache__/sessions.cpython-39.pyc,, -pip/_vendor/requests/__pycache__/status_codes.cpython-39.pyc,, -pip/_vendor/requests/__pycache__/structures.cpython-39.pyc,, -pip/_vendor/requests/__pycache__/utils.cpython-39.pyc,, -pip/_vendor/requests/__version__.py,sha256=SKjnGRNIWoxDQR1pAkRW3fen6mAXw7MruEBPlqvEjuE,455 -pip/_vendor/requests/_internal_utils.py,sha256=zDALdxFfs4pAp4CME_TTw2rGyYR2EGBpSehYHgfn8o0,1138 -pip/_vendor/requests/adapters.py,sha256=v-nXh1zlxNzGQWQicaDrnsMmus75p2c99GPOtPl-6uw,22081 -pip/_vendor/requests/api.py,sha256=IPHU2zrGr6hURdheImh9lqurXPhQlv4PFOkjik6dmSQ,6561 -pip/_vendor/requests/auth.py,sha256=xe7s91xl3ENjQgRlZP3-2KsACnXYHAiLOuHLDw6nyyQ,10512 -pip/_vendor/requests/certs.py,sha256=fFBPJjnP90gWELetFYPbzrsfZgSZopej7XhlkrnVVec,483 -pip/_vendor/requests/compat.py,sha256=xfkhI1O0M1RPT9n92GEeoalPuBOYMsdApi7TONmwWD8,2121 -pip/_vendor/requests/cookies.py,sha256=PIxSKntoUn6l2irwR-CBMgm0scK8s-6yUZzwoCVIAdo,18979 -pip/_vendor/requests/exceptions.py,sha256=-_Uvqm89mT79nPWoxlf_NF7JawnsfHcJdAeIipOiAQg,3377 -pip/_vendor/requests/help.py,sha256=HQ9KRPaFWwmEYS46TnLTyaGYXGNv-G3RQyO9yUfa7Gg,4104 -pip/_vendor/requests/hooks.py,sha256=LAWGUHI8SB52PkhFYbwyPcT6mWsjuVJeeZpM0RUTADc,791 -pip/_vendor/requests/models.py,sha256=eBTofFVVYXXqpuqkMrPzRNYKJfuICHhw5bPn6bi-lEI,35890 -pip/_vendor/requests/packages.py,sha256=ry2VlKGoCDdr8ZJyNCXxDcAF1HfENfmoylCK-_VzXh0,711 -pip/_vendor/requests/sessions.py,sha256=xn0NHgjfsCdvZoi11vUDP8zS0LPM0sVuZP_6qYNC7kw,30949 -pip/_vendor/requests/status_codes.py,sha256=ef_TQlJHa44J6_nrl_hTw6h7I-oZS8qg2MHCu9YyzYY,4311 -pip/_vendor/requests/structures.py,sha256=ssrNLrH8XELX89hk4yRQYEVeHnbopq1HAJBfgu38bi8,3110 -pip/_vendor/requests/utils.py,sha256=dZh-kGRO-A8sLHdHp_hcS_5u4syIDRRE2T-un0s4HwM,32407 -pip/_vendor/resolvelib/__init__.py,sha256=g_NlynQjt3xlCb_JRtRIrV6Y-zBYSkQMxH4NtoC4Axc,563 -pip/_vendor/resolvelib/__pycache__/__init__.cpython-39.pyc,, -pip/_vendor/resolvelib/__pycache__/providers.cpython-39.pyc,, -pip/_vendor/resolvelib/__pycache__/reporters.cpython-39.pyc,, -pip/_vendor/resolvelib/__pycache__/resolvers.cpython-39.pyc,, -pip/_vendor/resolvelib/__pycache__/structs.cpython-39.pyc,, -pip/_vendor/resolvelib/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -pip/_vendor/resolvelib/compat/__pycache__/__init__.cpython-39.pyc,, -pip/_vendor/resolvelib/compat/__pycache__/collections_abc.cpython-39.pyc,, -pip/_vendor/resolvelib/compat/collections_abc.py,sha256=RCp_gXYFZUg2DF2iUPTTD-XSpBTia4xEuJhjbXNzQyM,162 -pip/_vendor/resolvelib/providers.py,sha256=4rEMGvu_xM5qx42oiIeMwgfwsrd1vCUZusmbfvMknWg,5762 -pip/_vendor/resolvelib/reporters.py,sha256=Yi7l5VMEKyhL20KIEglPukQHWJHkweV4e4amcJs-4yk,1401 -pip/_vendor/resolvelib/resolvers.py,sha256=nlrz0Zql6opJgYgnBoFg3FwG_Z9lGp8rAi7hooQ33E8,17698 -pip/_vendor/resolvelib/structs.py,sha256=8HTLTjfJCdDs2FBt3EqaNiFbn0oelLG9OQK9htCvBpE,4959 -pip/_vendor/six.py,sha256=MB08ff_RApHF8XMk2vSx581-xTyX6sf_pQOtz6j1BZU,35547 -pip/_vendor/tenacity/__init__.py,sha256=YfrArVagvtYH5gcjBOlOQ2u6dx2C2N4X1x0DOUBXv5Y,18774 -pip/_vendor/tenacity/__pycache__/__init__.cpython-39.pyc,, -pip/_vendor/tenacity/__pycache__/_asyncio.cpython-39.pyc,, -pip/_vendor/tenacity/__pycache__/_utils.cpython-39.pyc,, -pip/_vendor/tenacity/__pycache__/after.cpython-39.pyc,, -pip/_vendor/tenacity/__pycache__/before.cpython-39.pyc,, -pip/_vendor/tenacity/__pycache__/before_sleep.cpython-39.pyc,, -pip/_vendor/tenacity/__pycache__/nap.cpython-39.pyc,, -pip/_vendor/tenacity/__pycache__/retry.cpython-39.pyc,, -pip/_vendor/tenacity/__pycache__/stop.cpython-39.pyc,, -pip/_vendor/tenacity/__pycache__/tornadoweb.cpython-39.pyc,, -pip/_vendor/tenacity/__pycache__/wait.cpython-39.pyc,, -pip/_vendor/tenacity/_asyncio.py,sha256=jZcrONVfckAiLERCKTxI9DJ_Aeq4fquZj9G7Vr1_I7s,3406 -pip/_vendor/tenacity/_utils.py,sha256=J2-zhV7bDTTuye-U8jtimO7lN1x70_a23qAdKniuzSE,2012 -pip/_vendor/tenacity/after.py,sha256=mJq5ygM_NzL69Bx63RbI24IU5KgGHqmwl3AbQXiTCTc,1542 -pip/_vendor/tenacity/before.py,sha256=RmWTv09-aU_3kFVRJw6PX3dp74ZZqnRD1UZUoCWw5XY,1417 -pip/_vendor/tenacity/before_sleep.py,sha256=gSQPoPHevxpluUv0ASzd2Z4AOfq8Q8Y7XOns32cL4n8,1966 -pip/_vendor/tenacity/nap.py,sha256=5DH1ui6-d3X4ZsQCRKJhY5jaQ0NdYZ2AEqt7Svt5VFM,1426 -pip/_vendor/tenacity/retry.py,sha256=VsJQ9DcYTMr0ZeV43yhQfBDDJD1y5av52TJ0OSwvqLw,6858 -pip/_vendor/tenacity/stop.py,sha256=lVnfBu2fzvqVtsL-HH8o1m_HborN7zLnlXBWa2UzM-A,2886 -pip/_vendor/tenacity/tornadoweb.py,sha256=2wGpfDdTztK9Sk74ARv8prohTReTQzst9a1m1qo5bBs,2204 -pip/_vendor/tenacity/wait.py,sha256=t16nLHioncGDdKA6ETwTNzABC-RrZiR-7HS1pXikVsg,6882 -pip/_vendor/tomli/__init__.py,sha256=fUFJngh-LwLWqbgw4Vc7wvxnfTdrIK8Nc7wvydyxOjw,236 -pip/_vendor/tomli/__pycache__/__init__.cpython-39.pyc,, -pip/_vendor/tomli/__pycache__/_parser.cpython-39.pyc,, -pip/_vendor/tomli/__pycache__/_re.cpython-39.pyc,, -pip/_vendor/tomli/_parser.py,sha256=946C00VAWqHjKSueGK44YSAU_Ufwg4LQmvd8yqta2dg,23118 -pip/_vendor/tomli/_re.py,sha256=tGGogP0HJnQDBSITAPldXRB5TLQeaC069FBzxVOOy5k,2764 -pip/_vendor/urllib3/__init__.py,sha256=FzLqycdKhCzSxjYOPTX50D3qf0lTCe6UgfZdwT-Li7o,2848 -pip/_vendor/urllib3/__pycache__/__init__.cpython-39.pyc,, -pip/_vendor/urllib3/__pycache__/_collections.cpython-39.pyc,, -pip/_vendor/urllib3/__pycache__/_version.cpython-39.pyc,, -pip/_vendor/urllib3/__pycache__/connection.cpython-39.pyc,, -pip/_vendor/urllib3/__pycache__/connectionpool.cpython-39.pyc,, -pip/_vendor/urllib3/__pycache__/exceptions.cpython-39.pyc,, -pip/_vendor/urllib3/__pycache__/fields.cpython-39.pyc,, -pip/_vendor/urllib3/__pycache__/filepost.cpython-39.pyc,, -pip/_vendor/urllib3/__pycache__/poolmanager.cpython-39.pyc,, -pip/_vendor/urllib3/__pycache__/request.cpython-39.pyc,, -pip/_vendor/urllib3/__pycache__/response.cpython-39.pyc,, -pip/_vendor/urllib3/_collections.py,sha256=RQtWWhudTDETvb2BCVqih1QTpXS2Q5HSf77UJY5ditA,11148 -pip/_vendor/urllib3/_version.py,sha256=Cs83ZyfrMWqd18tvuyiZ-SW91-r7-fsCZ-S3EnE-7Vk,65 -pip/_vendor/urllib3/connection.py,sha256=ml6ucQ9HfP5eR3t_x7Qpgkke62PF92i-b_XYrIUdZeI,19293 -pip/_vendor/urllib3/connectionpool.py,sha256=itteZaSObupTC6p-6YYcI3KTQdLwgQxlS01w_hOoQqA,38198 -pip/_vendor/urllib3/contrib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -pip/_vendor/urllib3/contrib/__pycache__/__init__.cpython-39.pyc,, -pip/_vendor/urllib3/contrib/__pycache__/_appengine_environ.cpython-39.pyc,, -pip/_vendor/urllib3/contrib/__pycache__/appengine.cpython-39.pyc,, -pip/_vendor/urllib3/contrib/__pycache__/ntlmpool.cpython-39.pyc,, -pip/_vendor/urllib3/contrib/__pycache__/pyopenssl.cpython-39.pyc,, -pip/_vendor/urllib3/contrib/__pycache__/securetransport.cpython-39.pyc,, -pip/_vendor/urllib3/contrib/__pycache__/socks.cpython-39.pyc,, -pip/_vendor/urllib3/contrib/_appengine_environ.py,sha256=POYJSeNWacJYwXQdv0If3v56lcoiHuL6MQE8pwG1Yoc,993 -pip/_vendor/urllib3/contrib/_securetransport/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -pip/_vendor/urllib3/contrib/_securetransport/__pycache__/__init__.cpython-39.pyc,, -pip/_vendor/urllib3/contrib/_securetransport/__pycache__/bindings.cpython-39.pyc,, -pip/_vendor/urllib3/contrib/_securetransport/__pycache__/low_level.cpython-39.pyc,, -pip/_vendor/urllib3/contrib/_securetransport/bindings.py,sha256=jreOmmwBW-Cio0m7I_OjmP028nqgrGuo_oB2f7Gir3s,18168 -pip/_vendor/urllib3/contrib/_securetransport/low_level.py,sha256=0KKeznz3h0z-SBDbCtGorDfgCgiZ30VQOqkX5ZgaPBY,14304 -pip/_vendor/urllib3/contrib/appengine.py,sha256=nlIR6iWZ0A1cV9X4dYwdx7H1F1tqGE7ai9QCfJ7ntFo,11348 -pip/_vendor/urllib3/contrib/ntlmpool.py,sha256=JCCrvNQpXdL3eb_D4AoviNnl71nYhSX2r-hG9N-dPf4,4668 -pip/_vendor/urllib3/contrib/pyopenssl.py,sha256=093d4DdfHcz0h8KcEg-D9fQEUtXaVLENmOkzOqNQ5eU,17402 -pip/_vendor/urllib3/contrib/securetransport.py,sha256=ozB5tLGYiVgN2NLx9vvzVxjdtY9nNj9mBxGsCYTwEGI,35356 -pip/_vendor/urllib3/contrib/socks.py,sha256=RqYih4HGeICnKzmYnG3MMo2xMlCdwb1bAdEuo6zCA_Y,7313 -pip/_vendor/urllib3/exceptions.py,sha256=QDT9xy1fNxui5aS7dMabeb1gokQOQ-zOT7XiDp-O5Qo,8540 -pip/_vendor/urllib3/fields.py,sha256=0KSfpuXxzXUMLkI2npM9siWOqCJO1H4wCiJN6neVmlA,8853 -pip/_vendor/urllib3/filepost.py,sha256=BVkEES0YAO9tFwXGBj1mD9yO92pRwk4pX5Q6cO5IRb8,2538 -pip/_vendor/urllib3/packages/__init__.py,sha256=FsOIVHqBFBlT3XxZnaD5y2yq0mvtVwmY4kut3GEfcBI,113 -pip/_vendor/urllib3/packages/__pycache__/__init__.cpython-39.pyc,, -pip/_vendor/urllib3/packages/__pycache__/six.cpython-39.pyc,, -pip/_vendor/urllib3/packages/backports/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -pip/_vendor/urllib3/packages/backports/__pycache__/__init__.cpython-39.pyc,, -pip/_vendor/urllib3/packages/backports/__pycache__/makefile.cpython-39.pyc,, -pip/_vendor/urllib3/packages/backports/makefile.py,sha256=DREmQjGcs2LoVH_Q3hrggClhTNdcI5Y3GJglsuihjAM,1468 -pip/_vendor/urllib3/packages/six.py,sha256=dUImuFN7dZON9oeQQqHjXdwH3n2Oxr9148Ns4K4Y2xg,35743 -pip/_vendor/urllib3/packages/ssl_match_hostname/__init__.py,sha256=d-Tyw37qbvVdcjcVF4WLYiM7AXaOpIg386C2P2uB5Ks,951 -pip/_vendor/urllib3/packages/ssl_match_hostname/__pycache__/__init__.cpython-39.pyc,, -pip/_vendor/urllib3/packages/ssl_match_hostname/__pycache__/_implementation.cpython-39.pyc,, -pip/_vendor/urllib3/packages/ssl_match_hostname/_implementation.py,sha256=WXs1yNtk9PsYVmeTJQAcqeAm81zbzeabEWWf-xRJSAo,5839 -pip/_vendor/urllib3/poolmanager.py,sha256=blNTYqVqFg9zUGncVtyXk1HQsTxKO1Cy9hfGVLAGvhM,20299 -pip/_vendor/urllib3/request.py,sha256=Fe4bQCUhum8qh3t1dihpSsQwdyfd5nB44cNX8566DmM,6155 -pip/_vendor/urllib3/response.py,sha256=LjfUJBUhwPrJTrGgNI3WoySUizNEPd1Xiv71YxE2J7Y,29024 -pip/_vendor/urllib3/util/__init__.py,sha256=UV_J7p9b29cJXXQ6wTvBZppJDLUeKQ6mcv0v1ptl13c,1204 -pip/_vendor/urllib3/util/__pycache__/__init__.cpython-39.pyc,, -pip/_vendor/urllib3/util/__pycache__/connection.cpython-39.pyc,, -pip/_vendor/urllib3/util/__pycache__/proxy.cpython-39.pyc,, -pip/_vendor/urllib3/util/__pycache__/queue.cpython-39.pyc,, -pip/_vendor/urllib3/util/__pycache__/request.cpython-39.pyc,, -pip/_vendor/urllib3/util/__pycache__/response.cpython-39.pyc,, -pip/_vendor/urllib3/util/__pycache__/retry.cpython-39.pyc,, -pip/_vendor/urllib3/util/__pycache__/ssl_.cpython-39.pyc,, -pip/_vendor/urllib3/util/__pycache__/ssltransport.cpython-39.pyc,, -pip/_vendor/urllib3/util/__pycache__/timeout.cpython-39.pyc,, -pip/_vendor/urllib3/util/__pycache__/url.cpython-39.pyc,, -pip/_vendor/urllib3/util/__pycache__/wait.cpython-39.pyc,, -pip/_vendor/urllib3/util/connection.py,sha256=hoiT3Z-vROOSOB-4JrFyRKzF67xYt-ZTFMTiYj1yd6Q,5070 -pip/_vendor/urllib3/util/proxy.py,sha256=xMGYpCWlY1Obf1nod_fhOG3rk3NTUM2q_BJmj6B_NmU,1660 -pip/_vendor/urllib3/util/queue.py,sha256=mY2d0cfoJG51UEKZwk_sJMwYraofNfQWq7Larj9xh_o,520 -pip/_vendor/urllib3/util/request.py,sha256=O-NJTFysuN_wgY33pne8xA1P35qv3R7uh67ER9zwqYM,4266 -pip/_vendor/urllib3/util/response.py,sha256=685vBStgxTo8u3KoOilR6Kuh7IGPZr7TmzrP9awEtqU,3617 -pip/_vendor/urllib3/util/retry.py,sha256=6xS4OYGWN2gz8kX34RH6ly7Uc6YcfCb2Z3V0QMdHpys,21993 -pip/_vendor/urllib3/util/ssl_.py,sha256=WILvlnNl3FxrO1-AuSJzGBuFTLCNIfkzRbhNvIuxseU,17672 -pip/_vendor/urllib3/util/ssltransport.py,sha256=r8zXGD19jRdpYPlAt9wR-mBg9aVRIB3UkV1GiT5uENQ,7152 -pip/_vendor/urllib3/util/timeout.py,sha256=Ym2WjTspeYp4fzcCYGTQ5aSU1neVSMHXBAgDp1rcETw,10271 -pip/_vendor/urllib3/util/url.py,sha256=3MdcqSYaGz4A2FIwYwe4KclwnrTn6ZdEG1-sUoCniUo,14479 -pip/_vendor/urllib3/util/wait.py,sha256=qk2qJQNb3FjhOm9lKJtpByhnsLWRVapWdhW_NLr7Eog,5557 -pip/_vendor/vendor.txt,sha256=gryMWlplkGEQkjoFzG1xYAfARSAghGWVWX-fGObCxOw,386 -pip/_vendor/webencodings/__init__.py,sha256=kG5cBDbIrAtrrdU-h1iSPVYq10ayTFldU1CTRcb1ym4,10921 -pip/_vendor/webencodings/__pycache__/__init__.cpython-39.pyc,, -pip/_vendor/webencodings/__pycache__/labels.cpython-39.pyc,, -pip/_vendor/webencodings/__pycache__/mklabels.cpython-39.pyc,, -pip/_vendor/webencodings/__pycache__/tests.cpython-39.pyc,, -pip/_vendor/webencodings/__pycache__/x_user_defined.cpython-39.pyc,, -pip/_vendor/webencodings/labels.py,sha256=e9gPVTA1XNYalJMVVX7lXvb52Kurc4UdnXFJDPcBXFE,9210 -pip/_vendor/webencodings/mklabels.py,sha256=tyhoDDc-TC6kjJY25Qn5TlsyMs2_IyPf_rfh4L6nSrg,1364 -pip/_vendor/webencodings/tests.py,sha256=7J6TdufKEml8sQSWcYEsl-e73QXtPmsIHF6pPT0sq08,6716 -pip/_vendor/webencodings/x_user_defined.py,sha256=CMn5bx2ccJ4y3Bsqf3xC24bYO4ONC3ZY_lv5vrqhKAY,4632 -pip/py.typed,sha256=9_aEgAx4lyfhJKT_8nv7mk-FpX3Mdtn8cV5Fw11xicg,290 diff --git a/.venv/lib/python3.9/site-packages/pip-21.2.3.dist-info/INSTALLER b/.venv/lib/python3.9/site-packages/pip-21.2.4.dist-info/INSTALLER similarity index 100% rename from .venv/lib/python3.9/site-packages/pip-21.2.3.dist-info/INSTALLER rename to .venv/lib/python3.9/site-packages/pip-21.2.4.dist-info/INSTALLER diff --git a/.venv/lib/python3.9/site-packages/pip-21.2.3.dist-info/LICENSE.txt b/.venv/lib/python3.9/site-packages/pip-21.2.4.dist-info/LICENSE.txt similarity index 100% rename from .venv/lib/python3.9/site-packages/pip-21.2.3.dist-info/LICENSE.txt rename to .venv/lib/python3.9/site-packages/pip-21.2.4.dist-info/LICENSE.txt diff --git a/.venv/lib/python3.9/site-packages/pip-21.2.3.dist-info/METADATA b/.venv/lib/python3.9/site-packages/pip-21.2.4.dist-info/METADATA similarity index 99% rename from .venv/lib/python3.9/site-packages/pip-21.2.3.dist-info/METADATA rename to .venv/lib/python3.9/site-packages/pip-21.2.4.dist-info/METADATA index 58e30d9c..fa1b07f9 100644 --- a/.venv/lib/python3.9/site-packages/pip-21.2.3.dist-info/METADATA +++ b/.venv/lib/python3.9/site-packages/pip-21.2.4.dist-info/METADATA @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: pip -Version: 21.2.3 +Version: 21.2.4 Summary: The PyPA recommended tool for installing Python packages. Home-page: https://pip.pypa.io/ Author: The pip developers diff --git a/.venv/lib/python3.9/site-packages/pip-21.2.4.dist-info/RECORD b/.venv/lib/python3.9/site-packages/pip-21.2.4.dist-info/RECORD new file mode 100644 index 00000000..d20dfef5 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/pip-21.2.4.dist-info/RECORD @@ -0,0 +1,795 @@ +../../../bin/pip,sha256=WA6EDFarxsG50gHWZf1o3pii4sLE6_zliisL1ehtOa4,262 +../../../bin/pip3,sha256=WA6EDFarxsG50gHWZf1o3pii4sLE6_zliisL1ehtOa4,262 +../../../bin/pip3.9,sha256=WA6EDFarxsG50gHWZf1o3pii4sLE6_zliisL1ehtOa4,262 +pip-21.2.4.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +pip-21.2.4.dist-info/LICENSE.txt,sha256=I6c2HCsVgQKLxiO52ivSSZeryqR4Gs5q1ESjeUT42uE,1090 +pip-21.2.4.dist-info/METADATA,sha256=PGCimuD-VsKv664Ne_9navMt6I9Ym_rm5p_u6Ykgfd4,4165 +pip-21.2.4.dist-info/RECORD,, +pip-21.2.4.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +pip-21.2.4.dist-info/WHEEL,sha256=OqRkF0eY5GHssMorFjlbTIq072vpHpF60fIQA6lS9xA,92 +pip-21.2.4.dist-info/entry_points.txt,sha256=5ExSa1s54zSPNA_1epJn5SX06786S8k5YHwskMvVYzw,125 +pip-21.2.4.dist-info/top_level.txt,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +pip/__init__.py,sha256=EkjFYKiNdO5r1TZT1K-GxPs3Bl2IdRXw75e7IVsKrmc,357 +pip/__main__.py,sha256=mXwWDftNLMKfwVqKFWGE_uuBZvGSIiUELhLkeysIuZc,1198 +pip/__pycache__/__init__.cpython-39.pyc,, +pip/__pycache__/__main__.cpython-39.pyc,, +pip/_internal/__init__.py,sha256=nnFCuxrPMgALrIDxSoy-H6Zj4W4UY60D-uL1aJyq0pc,573 +pip/_internal/__pycache__/__init__.cpython-39.pyc,, +pip/_internal/__pycache__/build_env.cpython-39.pyc,, +pip/_internal/__pycache__/cache.cpython-39.pyc,, +pip/_internal/__pycache__/configuration.cpython-39.pyc,, +pip/_internal/__pycache__/exceptions.cpython-39.pyc,, +pip/_internal/__pycache__/main.cpython-39.pyc,, +pip/_internal/__pycache__/pyproject.cpython-39.pyc,, +pip/_internal/__pycache__/self_outdated_check.cpython-39.pyc,, +pip/_internal/__pycache__/wheel_builder.cpython-39.pyc,, +pip/_internal/build_env.py,sha256=uqtt1F0185ctzme5UX43I6bFHVeORY7q-dyhpkk5NDE,10121 +pip/_internal/cache.py,sha256=6VONtoReGZbBd7sqY1n6hwkdWC4iz3tmXwXwZjpjZKw,9958 +pip/_internal/cli/__init__.py,sha256=FkHBgpxxb-_gd6r1FjnNhfMOzAUYyXoXKJ6abijfcFU,132 +pip/_internal/cli/__pycache__/__init__.cpython-39.pyc,, +pip/_internal/cli/__pycache__/autocompletion.cpython-39.pyc,, +pip/_internal/cli/__pycache__/base_command.cpython-39.pyc,, +pip/_internal/cli/__pycache__/cmdoptions.cpython-39.pyc,, +pip/_internal/cli/__pycache__/command_context.cpython-39.pyc,, +pip/_internal/cli/__pycache__/main.cpython-39.pyc,, +pip/_internal/cli/__pycache__/main_parser.cpython-39.pyc,, +pip/_internal/cli/__pycache__/parser.cpython-39.pyc,, +pip/_internal/cli/__pycache__/progress_bars.cpython-39.pyc,, +pip/_internal/cli/__pycache__/req_command.cpython-39.pyc,, +pip/_internal/cli/__pycache__/spinners.cpython-39.pyc,, +pip/_internal/cli/__pycache__/status_codes.cpython-39.pyc,, +pip/_internal/cli/autocompletion.py,sha256=NK5yqe49SgExZOCFVEUT5Bf0QV2CuITGK27WSo2MWg8,6399 +pip/_internal/cli/base_command.py,sha256=Dq5oXBXYd24GaHs1vPt6CfYgCl22V_4tLEJqfQyBrdE,7596 +pip/_internal/cli/cmdoptions.py,sha256=xOqvgDNfpkMXVjy0mH3hI0HyczVD6wMuP8K44qsvbew,28283 +pip/_internal/cli/command_context.py,sha256=a1pBBvvGLDiZ1Kw64_4tT6HmRTwYDoYy8JFgG5Czn7s,760 +pip/_internal/cli/main.py,sha256=ioJ8IVlb2K1qLOxR-tXkee9lURhYV89CDM71MKag7YY,2472 +pip/_internal/cli/main_parser.py,sha256=Q9TnytfuC5Z2JSjBFWVGtEdYLFy7rukNIb04movHdAo,2614 +pip/_internal/cli/parser.py,sha256=CDXTuFr2UD8ozOlZYf1KDziQdo9-X_IaYOiUcyJQwrA,10788 +pip/_internal/cli/progress_bars.py,sha256=ha8wowclY8_PaoM0cz4G6qK37zjnzuxQ-ydOtzx4EMI,8300 +pip/_internal/cli/req_command.py,sha256=ZlxKFS9LtEbE1IRB6JyeUeYMe7lvKxVIzpdvag-BHok,16548 +pip/_internal/cli/spinners.py,sha256=TFhjxtOnLeNJ5YmRvQm4eKPgPbJNkZiqO8jOXuxRaYU,5076 +pip/_internal/cli/status_codes.py,sha256=sEFHUaUJbqv8iArL3HAtcztWZmGOFX01hTesSytDEh0,116 +pip/_internal/commands/__init__.py,sha256=3f1ZVidEDfgmzAH7aypZLKOZUvUy7qxv4X1CiIZEN30,3776 +pip/_internal/commands/__pycache__/__init__.cpython-39.pyc,, +pip/_internal/commands/__pycache__/cache.cpython-39.pyc,, +pip/_internal/commands/__pycache__/check.cpython-39.pyc,, +pip/_internal/commands/__pycache__/completion.cpython-39.pyc,, +pip/_internal/commands/__pycache__/configuration.cpython-39.pyc,, +pip/_internal/commands/__pycache__/debug.cpython-39.pyc,, +pip/_internal/commands/__pycache__/download.cpython-39.pyc,, +pip/_internal/commands/__pycache__/freeze.cpython-39.pyc,, +pip/_internal/commands/__pycache__/hash.cpython-39.pyc,, +pip/_internal/commands/__pycache__/help.cpython-39.pyc,, +pip/_internal/commands/__pycache__/index.cpython-39.pyc,, +pip/_internal/commands/__pycache__/install.cpython-39.pyc,, +pip/_internal/commands/__pycache__/list.cpython-39.pyc,, +pip/_internal/commands/__pycache__/search.cpython-39.pyc,, +pip/_internal/commands/__pycache__/show.cpython-39.pyc,, +pip/_internal/commands/__pycache__/uninstall.cpython-39.pyc,, +pip/_internal/commands/__pycache__/wheel.cpython-39.pyc,, +pip/_internal/commands/cache.py,sha256=O1grQjTg6IRFs_8DxMH00583tmCR0ujqTMv_gZ0h0uU,7237 +pip/_internal/commands/check.py,sha256=gPC6GTp7S9aK73IeZAW7Z6yxlMnWdMyDTq9er9nXpIY,1570 +pip/_internal/commands/completion.py,sha256=4Uh_cg04qDmtmgLji-J4VJKZ8BaIBZy2_uTWLi8tiVk,2914 +pip/_internal/commands/configuration.py,sha256=TK9VTXNJ5haVH0Dc_ylhqo6A9Q_GcNoNsAOMJff4MYY,8962 +pip/_internal/commands/debug.py,sha256=f943fbrAUufQ7flAR2zHfI0oi_uqhJEEW7Fj_EiwB1Y,6647 +pip/_internal/commands/download.py,sha256=VGyQ6TDLiqJqJXfJwr_D6ZuHnYfhmzZPQk1mRSQp3tQ,4949 +pip/_internal/commands/freeze.py,sha256=x0-ia-MFrVvfYqe5p6yAWqzaK5AIi3SqqcXBJNvxXkg,2785 +pip/_internal/commands/hash.py,sha256=Y5FQ_WgbuEFnJxyLZdNYP928BGWNyNm9ljIUr90R6tI,1664 +pip/_internal/commands/help.py,sha256=F_IJkERv9gGfGC6YpBNYm_qs8xmBphUCfOuguNRSqLs,1132 +pip/_internal/commands/index.py,sha256=xA5LSVy1kv-IAvsjIX6Wnk5ZHA0Y_m6AP9T5ZoUGs9o,4781 +pip/_internal/commands/install.py,sha256=FV-qBbQ56TUEmLDtuWTMeNpD4aQtOpjBEi7ePqlEtSM,27493 +pip/_internal/commands/list.py,sha256=fpG6_KYqtAEBV8uSlt_lfF7o1GTuS4UdobsZjVqZspQ,11753 +pip/_internal/commands/search.py,sha256=P8GY077JmUwy7FiOgYJ1CPDsBPgmo7it-b14luquJN4,5543 +pip/_internal/commands/show.py,sha256=2TxWaJ2saCDSVUVBoRYueijLiueid2DNOhZuM-jhGf0,7974 +pip/_internal/commands/uninstall.py,sha256=0VQQMfPBTGSlWJn1RRgvYtJhSj7tQFYc3H1kOjrstRE,3480 +pip/_internal/commands/wheel.py,sha256=UiH15NXfrJ9piFNg3oHm4n2Jyk9Ojv5q0MvrWbHB3Ac,6189 +pip/_internal/configuration.py,sha256=QBLfhv-sbP-oR08NFxSYnv_mLB-SgtNOsWXAF9tDEcM,13725 +pip/_internal/distributions/__init__.py,sha256=Hq6kt6gXBgjNit5hTTWLAzeCNOKoB-N0pGYSqehrli8,858 +pip/_internal/distributions/__pycache__/__init__.cpython-39.pyc,, +pip/_internal/distributions/__pycache__/base.cpython-39.pyc,, +pip/_internal/distributions/__pycache__/installed.cpython-39.pyc,, +pip/_internal/distributions/__pycache__/sdist.cpython-39.pyc,, +pip/_internal/distributions/__pycache__/wheel.cpython-39.pyc,, +pip/_internal/distributions/base.py,sha256=GynlnVE3QLvNu4JvnxPO6D8IQSs_GAlFUabA6U-G-eU,1206 +pip/_internal/distributions/installed.py,sha256=gT20WSniecOvKGMA-nCyq-4DcJlrIjv8jT-JEWyEOnA,645 +pip/_internal/distributions/sdist.py,sha256=VBme1UNlCuH_wIoUHTZq9ngo2NpFWQXmJqnwUb3ZpTk,3862 +pip/_internal/distributions/wheel.py,sha256=J7DNQvKS50pXfwXtetKZtLNgYzkEc8SAbaKQ5v6JHtA,1183 +pip/_internal/exceptions.py,sha256=2JQJSS68oggR_ZIOA-h1U2DRADURbkQn9Nf4EZWZ834,13170 +pip/_internal/index/__init__.py,sha256=vpt-JeTZefh8a-FC22ZeBSXFVbuBcXSGiILhQZJaNpQ,30 +pip/_internal/index/__pycache__/__init__.cpython-39.pyc,, +pip/_internal/index/__pycache__/collector.cpython-39.pyc,, +pip/_internal/index/__pycache__/package_finder.cpython-39.pyc,, +pip/_internal/index/__pycache__/sources.cpython-39.pyc,, +pip/_internal/index/collector.py,sha256=oH4XlYHvGMXePbjNhKZPpLI-NLBTXxpHRRZgQ85meNk,17645 +pip/_internal/index/package_finder.py,sha256=Zzto_P1YPeTlBjJTlPgU8wjocQDJnLYZxUSR8JxVf1E,36138 +pip/_internal/index/sources.py,sha256=SVyPitv08-Qalh2_Bk5diAJ9GAA_d-a93koouQodAG0,6557 +pip/_internal/locations/__init__.py,sha256=8HvAnPCRi2Ln5yimpHRq8NVtsImh1KEvqsPhi4H56y0,13292 +pip/_internal/locations/__pycache__/__init__.cpython-39.pyc,, +pip/_internal/locations/__pycache__/_distutils.cpython-39.pyc,, +pip/_internal/locations/__pycache__/_sysconfig.cpython-39.pyc,, +pip/_internal/locations/__pycache__/base.cpython-39.pyc,, +pip/_internal/locations/_distutils.py,sha256=Sk7tw8ZP1DWMYJ8MibABsa8IME2Ejv1PKeGlYQCBTZc,5871 +pip/_internal/locations/_sysconfig.py,sha256=LQNKTJKyjVqxXaPntlBwdUqTG1xwYf6GVCKMbyRJx5M,7918 +pip/_internal/locations/base.py,sha256=x5D1ONktmPJd8nnUTh-ELsAJ7fiXA-k-0a_vhfi2_Us,1579 +pip/_internal/main.py,sha256=BZ0vkdqgpoteTo1A1Q8ovFe8EzgKFJWOUjPmIUQfGCY,351 +pip/_internal/metadata/__init__.py,sha256=0XQDTWweYOV7kcMuzwoiCggu3wJearBNcK8JV9LXA6Y,1576 +pip/_internal/metadata/__pycache__/__init__.cpython-39.pyc,, +pip/_internal/metadata/__pycache__/base.cpython-39.pyc,, +pip/_internal/metadata/__pycache__/pkg_resources.cpython-39.pyc,, +pip/_internal/metadata/base.py,sha256=oRj58fKGutZKZCslfQlKfrzuXI_0M4w1xVOluT3-6TQ,7928 +pip/_internal/metadata/pkg_resources.py,sha256=xOYt6IluIDvVMgYX-QoZA3SFbToJlZDOVPRHVPJ2Uk4,5200 +pip/_internal/models/__init__.py,sha256=3DHUd_qxpPozfzouoqa9g9ts1Czr5qaHfFxbnxriepM,63 +pip/_internal/models/__pycache__/__init__.cpython-39.pyc,, +pip/_internal/models/__pycache__/candidate.cpython-39.pyc,, +pip/_internal/models/__pycache__/direct_url.cpython-39.pyc,, +pip/_internal/models/__pycache__/format_control.cpython-39.pyc,, +pip/_internal/models/__pycache__/index.cpython-39.pyc,, +pip/_internal/models/__pycache__/link.cpython-39.pyc,, +pip/_internal/models/__pycache__/scheme.cpython-39.pyc,, +pip/_internal/models/__pycache__/search_scope.cpython-39.pyc,, +pip/_internal/models/__pycache__/selection_prefs.cpython-39.pyc,, +pip/_internal/models/__pycache__/target_python.cpython-39.pyc,, +pip/_internal/models/__pycache__/wheel.cpython-39.pyc,, +pip/_internal/models/candidate.py,sha256=b2aiufhD5jZEI0zhEaMn_o1VRldVE2J-MPsqPpcY2Ds,946 +pip/_internal/models/direct_url.py,sha256=x2-kAnrP18XAdOftYBStDNt3Zfd8sipef5h0h_efGvY,6262 +pip/_internal/models/format_control.py,sha256=t5nmFD43huIFj0VchV6FuvlaRHfaMTotbBOTOPBsKeY,2557 +pip/_internal/models/index.py,sha256=_U2imEWggevvcI7rhQCFZK0djsE-It13BJmvW9Ejmig,1058 +pip/_internal/models/link.py,sha256=chRRuGqeE5w1XqidCrw6j-j8O-eeCmw-HUdYCR18HmQ,9809 +pip/_internal/models/scheme.py,sha256=i2QGt5J96gMKC_Wm7xO587kibhhChUQoULhAFgPRxkE,738 +pip/_internal/models/search_scope.py,sha256=mykEee0wDNCx9xZmQBtkgVaDiQVcDNqbjAZGqI1nm78,4474 +pip/_internal/models/selection_prefs.py,sha256=OEoiP83Wpm7cUwjH7fnbRo7TzHl5D4y23W0JnZLXk_4,1877 +pip/_internal/models/target_python.py,sha256=7iT4lbRtoNRkwsmLndysJ4Ic7Iwp_YyIII3doXeLD8c,3870 +pip/_internal/models/wheel.py,sha256=Ec8fvPoSYeBX9cvBvffLM7gNRx23CrVud1dN3zJmBjc,3541 +pip/_internal/network/__init__.py,sha256=jf6Tt5nV_7zkARBrKojIXItgejvoegVJVKUbhAa5Ioc,50 +pip/_internal/network/__pycache__/__init__.cpython-39.pyc,, +pip/_internal/network/__pycache__/auth.cpython-39.pyc,, +pip/_internal/network/__pycache__/cache.cpython-39.pyc,, +pip/_internal/network/__pycache__/download.cpython-39.pyc,, +pip/_internal/network/__pycache__/lazy_wheel.cpython-39.pyc,, +pip/_internal/network/__pycache__/session.cpython-39.pyc,, +pip/_internal/network/__pycache__/utils.cpython-39.pyc,, +pip/_internal/network/__pycache__/xmlrpc.cpython-39.pyc,, +pip/_internal/network/auth.py,sha256=zq-fu-eK_EwiqjT0SVmMxuzyvhBlCdBGJi_fnOmcar8,11645 +pip/_internal/network/cache.py,sha256=HoprMCecwd4IS2wDZowc9B_OpaBlFjJYJl4xOxvtuwU,2100 +pip/_internal/network/download.py,sha256=VmiR-KKIBugShZS4JlD7N8mq3hErx-0fK-D8aTYU3Og,6016 +pip/_internal/network/lazy_wheel.py,sha256=4szChUW2I9quggvjEoIhALezmiVVteescGh6TDUslaQ,7615 +pip/_internal/network/session.py,sha256=3tJHNQCooM7bjLK1WP-q6tiJ84jtqkyrIdrYY84WR1A,16582 +pip/_internal/network/utils.py,sha256=igLlTu_-q0LmL8FdJKq-Uj7AT_owrQ-T9FfyarkhK5U,4059 +pip/_internal/network/xmlrpc.py,sha256=AzQgG4GgS152_cqmGr_Oz2MIXsCal-xfsis7fA7nmU0,1791 +pip/_internal/operations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +pip/_internal/operations/__pycache__/__init__.cpython-39.pyc,, +pip/_internal/operations/__pycache__/check.cpython-39.pyc,, +pip/_internal/operations/__pycache__/freeze.cpython-39.pyc,, +pip/_internal/operations/__pycache__/prepare.cpython-39.pyc,, +pip/_internal/operations/build/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +pip/_internal/operations/build/__pycache__/__init__.cpython-39.pyc,, +pip/_internal/operations/build/__pycache__/metadata.cpython-39.pyc,, +pip/_internal/operations/build/__pycache__/metadata_legacy.cpython-39.pyc,, +pip/_internal/operations/build/__pycache__/wheel.cpython-39.pyc,, +pip/_internal/operations/build/__pycache__/wheel_legacy.cpython-39.pyc,, +pip/_internal/operations/build/metadata.py,sha256=jJp05Rrp0AMsQb7izDXbNGC1LtPNwOhHQj7cRM5324c,1165 +pip/_internal/operations/build/metadata_legacy.py,sha256=ECMBhLEPEQv6PUUCpPCXW-wN9QRXdY45PNXJv7BZKTU,1917 +pip/_internal/operations/build/wheel.py,sha256=WYLMxuxqN3ahJTQk2MI9hdmZKBpFyxHeNpUdO0PybxU,1106 +pip/_internal/operations/build/wheel_legacy.py,sha256=NOJhTYMYljdbizFo_WjkaKGWG1SEZ6aByrBdCrrsZB8,3227 +pip/_internal/operations/check.py,sha256=zEIdxyRL3vc7CQ1p8qkLFG-mjs-LjnaJDxOr1WI5Yp0,5295 +pip/_internal/operations/freeze.py,sha256=TyLvXT4ZqpIi8x8X_TTsgBJ76IG54CidJlxGIHBbmBM,10556 +pip/_internal/operations/install/__init__.py,sha256=mX7hyD2GNBO2mFGokDQ30r_GXv7Y_PLdtxcUv144e-s,51 +pip/_internal/operations/install/__pycache__/__init__.cpython-39.pyc,, +pip/_internal/operations/install/__pycache__/editable_legacy.cpython-39.pyc,, +pip/_internal/operations/install/__pycache__/legacy.cpython-39.pyc,, +pip/_internal/operations/install/__pycache__/wheel.cpython-39.pyc,, +pip/_internal/operations/install/editable_legacy.py,sha256=bjBObfE6sz3UmGI7y4-GCgKa2WmTgnWlFFU7b-i0sQs,1396 +pip/_internal/operations/install/legacy.py,sha256=Wk_46sR7zDsh7vp4j63Hka4NTevQ617WdqJKt8_TuUQ,4405 +pip/_internal/operations/install/wheel.py,sha256=4Y6rtOpPnjlvGkzYXP8HXzqJu1KHEuA6ExgHBdZnD6s,29466 +pip/_internal/operations/prepare.py,sha256=jgnH7CIdoAhwnYOSpkESvhrJ1yr5TL2ZY5ojjSzRMZo,24848 +pip/_internal/pyproject.py,sha256=Sl1dOQYazG9AsrE0TXWK2zVcDR_FROshCTwjKBRQsPE,7063 +pip/_internal/req/__init__.py,sha256=lz4GFfzm5gsm0e8H98Wi6IPI14R2JdDMBc61-4F-0CY,2831 +pip/_internal/req/__pycache__/__init__.cpython-39.pyc,, +pip/_internal/req/__pycache__/constructors.cpython-39.pyc,, +pip/_internal/req/__pycache__/req_file.cpython-39.pyc,, +pip/_internal/req/__pycache__/req_install.cpython-39.pyc,, +pip/_internal/req/__pycache__/req_set.cpython-39.pyc,, +pip/_internal/req/__pycache__/req_tracker.cpython-39.pyc,, +pip/_internal/req/__pycache__/req_uninstall.cpython-39.pyc,, +pip/_internal/req/constructors.py,sha256=35LRb-iaL01AlKBOO_2vrbKil6KI5Tl450NJwUvUnhk,15826 +pip/_internal/req/req_file.py,sha256=TsBSr0LMVIYF7AqkwslyJxHPLstN0SMqKeVxciI2In4,17408 +pip/_internal/req/req_install.py,sha256=jPfSPt-s3RoRCj6tYqvvHaxxIW1yr8KbiPRGbAyF3pU,31671 +pip/_internal/req/req_set.py,sha256=NoPQztL1Z5HZEB3n2Wtst6KV51hMDAPe9AfdAUWmJLs,7572 +pip/_internal/req/req_tracker.py,sha256=dJ3ql2C3VyaKUQN9kwbFvOPMxAvbTdblB0hKQ2f6Lns,4182 +pip/_internal/req/req_uninstall.py,sha256=wBcGKaweIyi5RGPPpBqrrn62t8uP3frZmrUJ-qDeO0Y,23821 +pip/_internal/resolution/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +pip/_internal/resolution/__pycache__/__init__.cpython-39.pyc,, +pip/_internal/resolution/__pycache__/base.cpython-39.pyc,, +pip/_internal/resolution/base.py,sha256=yATwIW1VbJkwkFJIgG3JQafndFDSZ50smc-Ao9-SoxI,557 +pip/_internal/resolution/legacy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +pip/_internal/resolution/legacy/__pycache__/__init__.cpython-39.pyc,, +pip/_internal/resolution/legacy/__pycache__/resolver.cpython-39.pyc,, +pip/_internal/resolution/legacy/resolver.py,sha256=TZnGUay9WM2Uk0W3D48OA70U9cLYYGHxles1h9ELqSg,17552 +pip/_internal/resolution/resolvelib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +pip/_internal/resolution/resolvelib/__pycache__/__init__.cpython-39.pyc,, +pip/_internal/resolution/resolvelib/__pycache__/base.cpython-39.pyc,, +pip/_internal/resolution/resolvelib/__pycache__/candidates.cpython-39.pyc,, +pip/_internal/resolution/resolvelib/__pycache__/factory.cpython-39.pyc,, +pip/_internal/resolution/resolvelib/__pycache__/found_candidates.cpython-39.pyc,, +pip/_internal/resolution/resolvelib/__pycache__/provider.cpython-39.pyc,, +pip/_internal/resolution/resolvelib/__pycache__/reporter.cpython-39.pyc,, +pip/_internal/resolution/resolvelib/__pycache__/requirements.cpython-39.pyc,, +pip/_internal/resolution/resolvelib/__pycache__/resolver.cpython-39.pyc,, +pip/_internal/resolution/resolvelib/base.py,sha256=Yvgb2jf0l6S4C2rXAbjbpURYF6yjUgCdwDSrnpiZA8U,5290 +pip/_internal/resolution/resolvelib/candidates.py,sha256=RgCvLf1meDecmw9lfhG_AU5tN9ufaC0EDrcVOR2hgiA,18842 +pip/_internal/resolution/resolvelib/factory.py,sha256=N9telNB1arFV-4TqdGdh9KML8zfAWdMbqUSNip6HeEc,26859 +pip/_internal/resolution/resolvelib/found_candidates.py,sha256=ES3PNACh3ONwGAghPip2Vbgyy_e4baKmeEEHVQiq47g,5285 +pip/_internal/resolution/resolvelib/provider.py,sha256=fy139RDxPrsPmNLn6YrrjqhBOmeLY0aHEEdzZqS35aU,8420 +pip/_internal/resolution/resolvelib/reporter.py,sha256=Z06Xa4d9dTWbHNvXIBtBxDn4DHeQmlyW9MJAojkC_iU,2600 +pip/_internal/resolution/resolvelib/requirements.py,sha256=pcsnwz7txyDNZUEOWJOZEfivy3COWHPf_DIU7fwZ-Kk,5455 +pip/_internal/resolution/resolvelib/resolver.py,sha256=Rry36d0uCKobfBnSPYMw8WStyNYtjAEFz3j6ZtBsbGQ,10523 +pip/_internal/self_outdated_check.py,sha256=ivoUYaGuq-Ra_DvlZvPtHhgbY97NKHYuPGzrgN2G1A8,6484 +pip/_internal/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +pip/_internal/utils/__pycache__/__init__.cpython-39.pyc,, +pip/_internal/utils/__pycache__/_log.cpython-39.pyc,, +pip/_internal/utils/__pycache__/appdirs.cpython-39.pyc,, +pip/_internal/utils/__pycache__/compat.cpython-39.pyc,, +pip/_internal/utils/__pycache__/compatibility_tags.cpython-39.pyc,, +pip/_internal/utils/__pycache__/datetime.cpython-39.pyc,, +pip/_internal/utils/__pycache__/deprecation.cpython-39.pyc,, +pip/_internal/utils/__pycache__/direct_url_helpers.cpython-39.pyc,, +pip/_internal/utils/__pycache__/distutils_args.cpython-39.pyc,, +pip/_internal/utils/__pycache__/encoding.cpython-39.pyc,, +pip/_internal/utils/__pycache__/entrypoints.cpython-39.pyc,, +pip/_internal/utils/__pycache__/filesystem.cpython-39.pyc,, +pip/_internal/utils/__pycache__/filetypes.cpython-39.pyc,, +pip/_internal/utils/__pycache__/glibc.cpython-39.pyc,, +pip/_internal/utils/__pycache__/hashes.cpython-39.pyc,, +pip/_internal/utils/__pycache__/inject_securetransport.cpython-39.pyc,, +pip/_internal/utils/__pycache__/logging.cpython-39.pyc,, +pip/_internal/utils/__pycache__/misc.cpython-39.pyc,, +pip/_internal/utils/__pycache__/models.cpython-39.pyc,, +pip/_internal/utils/__pycache__/packaging.cpython-39.pyc,, +pip/_internal/utils/__pycache__/parallel.cpython-39.pyc,, +pip/_internal/utils/__pycache__/pkg_resources.cpython-39.pyc,, +pip/_internal/utils/__pycache__/setuptools_build.cpython-39.pyc,, +pip/_internal/utils/__pycache__/subprocess.cpython-39.pyc,, +pip/_internal/utils/__pycache__/temp_dir.cpython-39.pyc,, +pip/_internal/utils/__pycache__/unpacking.cpython-39.pyc,, +pip/_internal/utils/__pycache__/urls.cpython-39.pyc,, +pip/_internal/utils/__pycache__/virtualenv.cpython-39.pyc,, +pip/_internal/utils/__pycache__/wheel.cpython-39.pyc,, +pip/_internal/utils/_log.py,sha256=-jHLOE_THaZz5BFcCnoSL9EYAtJ0nXem49s9of4jvKw,1015 +pip/_internal/utils/appdirs.py,sha256=CyH0arjhfR4kaeybXs5B1hxe66KeeCfssJhiRFxpFJk,1185 +pip/_internal/utils/compat.py,sha256=ACyBfLgj3_XG-iA5omEDrXqDM0cQKzi8h8HRBInzG6Q,1884 +pip/_internal/utils/compatibility_tags.py,sha256=h2P4U0ZCkWHwPYveBzFZA79it6agElRhm6yci7S8MCo,5454 +pip/_internal/utils/datetime.py,sha256=m21Y3wAtQc-ji6Veb6k_M5g6A0ZyFI4egchTdnwh-pQ,242 +pip/_internal/utils/deprecation.py,sha256=0bdiuvnAcAZMp1dDrwxK7uDgmJQDHVfb1790_ypO9U4,3200 +pip/_internal/utils/direct_url_helpers.py,sha256=5ffB9GHoqalUvSU6C53lEFdUgYcWAbXJGfyCwGyIlrY,2994 +pip/_internal/utils/distutils_args.py,sha256=mcAscyp80vTt3xAGTipnpgc83V-_wCvydNELVXLq7JI,1249 +pip/_internal/utils/encoding.py,sha256=bdZ3YgUpaOEBI5MP4-DEXiQarCW3V0rxw1kRz-TaU1Q,1169 +pip/_internal/utils/entrypoints.py,sha256=aPvCnQVi9Hdk35Kloww_D5ibjUpqxgqcJP8O9VuMZek,1055 +pip/_internal/utils/filesystem.py,sha256=rrl-rY1w8TYyKYndUyZlE9ffkQyA4-jI9x_59zXkn5s,5893 +pip/_internal/utils/filetypes.py,sha256=weviVbapHWVQ_8-K-PTQ_TnYL66kZi4SrVBTmRYZXLc,761 +pip/_internal/utils/glibc.py,sha256=GM1Y2hWkOf_tumySGFg-iNbc7oilBQQrjczb_705CF8,3170 +pip/_internal/utils/hashes.py,sha256=o1qQEkqe2AqsRm_JhLoM4hkxmVtewH0ZZpQ6EBObHuU,5167 +pip/_internal/utils/inject_securetransport.py,sha256=tGl9Bgyt2IHKtB3b0B-6r3W2yYF3Og-PBe0647S3lZs,810 +pip/_internal/utils/logging.py,sha256=E5VE1n-pqgdd5DajPQPKpmu7VpJVd7dAhhdjPZNsYjE,12344 +pip/_internal/utils/misc.py,sha256=WhWMKbtoBWvGrqVMaPekKML-orsLnD2e0N83arjpYQw,23644 +pip/_internal/utils/models.py,sha256=qCgYyUw2mIH1pombsJ3YQsMtONZgyJ4BGwO5MJnSC4c,1329 +pip/_internal/utils/packaging.py,sha256=I1938AB7FprcVJJd6C0vSiMuCVajmrxZF55vX5j0bMo,2900 +pip/_internal/utils/parallel.py,sha256=RZF4JddPEWVbkkPCknfvpqaLfm3Pmqd_ABoCHmV4lXs,3224 +pip/_internal/utils/pkg_resources.py,sha256=jwH5JViPe-JlXLvLC0-ASfTTCRYvm0u9CwQGcWjxStI,1106 +pip/_internal/utils/setuptools_build.py,sha256=xk9sRBjUyNTHs_TvEWebVWs1GfLPN208MzpSXr9Ok_A,5047 +pip/_internal/utils/subprocess.py,sha256=7QOQPJj6ezIVsypJJrcyyq4-mJM9qUsOdOLq0_wUiAA,10043 +pip/_internal/utils/temp_dir.py,sha256=9gs3N9GQeVXRVWjJIalSpH1uj8yQXPTzarb5n1_HMVo,7950 +pip/_internal/utils/unpacking.py,sha256=_qYZgmq8b0rRAN2swXsf9VfPogrjShlsTvhRI2heBYI,9050 +pip/_internal/utils/urls.py,sha256=O5f4VeKJ9cWt_CKqqKmiDTW48uOzo0UNb1QWPQ0n2TI,1798 +pip/_internal/utils/virtualenv.py,sha256=iRTK-sD6bWpHqXcZ0ECfdpFLWatMOHFUVCIRa0L6Gu0,3564 +pip/_internal/utils/wheel.py,sha256=DOIVZaXN7bMOAeMEqzIOZHGl4OFO-KGrEqBUB848DPo,6290 +pip/_internal/vcs/__init__.py,sha256=UAqvzpbi0VbZo3Ub6skEeZAw-ooIZR-zX_WpCbxyCoU,596 +pip/_internal/vcs/__pycache__/__init__.cpython-39.pyc,, +pip/_internal/vcs/__pycache__/bazaar.cpython-39.pyc,, +pip/_internal/vcs/__pycache__/git.cpython-39.pyc,, +pip/_internal/vcs/__pycache__/mercurial.cpython-39.pyc,, +pip/_internal/vcs/__pycache__/subversion.cpython-39.pyc,, +pip/_internal/vcs/__pycache__/versioncontrol.cpython-39.pyc,, +pip/_internal/vcs/bazaar.py,sha256=Ay_vN-87vYSEzBqXT3RVwl40vlk56j3jy_AfQbMj4uo,2962 +pip/_internal/vcs/git.py,sha256=VDSzQlkh1390xw6PMh6fneJAZyc1s9qHZgum3wO3DOU,17347 +pip/_internal/vcs/mercurial.py,sha256=WwoTWZQdQN9FcUTINvIeb0Vt46UJ_lLdf2BAdea9Tic,5076 +pip/_internal/vcs/subversion.py,sha256=FRMYx7q-b6skWuv6IU7tJyC8Jm8PPblMnH7WN_ucXWU,11866 +pip/_internal/vcs/versioncontrol.py,sha256=jMKitwE4bQ45jOKKomBxgBypm2TcuDGWWdTUmPa-MUQ,23276 +pip/_internal/wheel_builder.py,sha256=hW63ZmABr65rOiSRBHXu1jBUdEZw5LZiw0LaQBbz0lI,11740 +pip/_vendor/__init__.py,sha256=eE_yoHELq6Kw--WqhAEcKkvHLKbmTR1-JX_Th1wcNZc,4703 +pip/_vendor/__pycache__/__init__.cpython-39.pyc,, +pip/_vendor/__pycache__/appdirs.cpython-39.pyc,, +pip/_vendor/__pycache__/distro.cpython-39.pyc,, +pip/_vendor/__pycache__/pyparsing.cpython-39.pyc,, +pip/_vendor/__pycache__/six.cpython-39.pyc,, +pip/_vendor/appdirs.py,sha256=M6IYRJtdZgmSPCXCSMBRB0VT3P8MdFbWCDbSLrB2Ebg,25907 +pip/_vendor/cachecontrol/__init__.py,sha256=pJtAaUxOsMPnytI1A3juAJkXYDr8krdSnsg4Yg3OBEg,302 +pip/_vendor/cachecontrol/__pycache__/__init__.cpython-39.pyc,, +pip/_vendor/cachecontrol/__pycache__/_cmd.cpython-39.pyc,, +pip/_vendor/cachecontrol/__pycache__/adapter.cpython-39.pyc,, +pip/_vendor/cachecontrol/__pycache__/cache.cpython-39.pyc,, +pip/_vendor/cachecontrol/__pycache__/compat.cpython-39.pyc,, +pip/_vendor/cachecontrol/__pycache__/controller.cpython-39.pyc,, +pip/_vendor/cachecontrol/__pycache__/filewrapper.cpython-39.pyc,, +pip/_vendor/cachecontrol/__pycache__/heuristics.cpython-39.pyc,, +pip/_vendor/cachecontrol/__pycache__/serialize.cpython-39.pyc,, +pip/_vendor/cachecontrol/__pycache__/wrapper.cpython-39.pyc,, +pip/_vendor/cachecontrol/_cmd.py,sha256=URGE0KrA87QekCG3SGPatlSPT571dZTDjNa-ZXX3pDc,1295 +pip/_vendor/cachecontrol/adapter.py,sha256=sSwaSYd93IIfCFU4tOMgSo6b2LCt_gBSaQUj8ktJFOA,4882 +pip/_vendor/cachecontrol/cache.py,sha256=1fc4wJP8HYt1ycnJXeEw5pCpeBL2Cqxx6g9Fb0AYDWQ,805 +pip/_vendor/cachecontrol/caches/__init__.py,sha256=-gHNKYvaeD0kOk5M74eOrsSgIKUtC6i6GfbmugGweEo,86 +pip/_vendor/cachecontrol/caches/__pycache__/__init__.cpython-39.pyc,, +pip/_vendor/cachecontrol/caches/__pycache__/file_cache.cpython-39.pyc,, +pip/_vendor/cachecontrol/caches/__pycache__/redis_cache.cpython-39.pyc,, +pip/_vendor/cachecontrol/caches/file_cache.py,sha256=nYVKsJtXh6gJXvdn1iWyrhxvkwpQrK-eKoMRzuiwkKk,4153 +pip/_vendor/cachecontrol/caches/redis_cache.py,sha256=HxelMpNCo-dYr2fiJDwM3hhhRmxUYtB5tXm1GpAAT4Y,856 +pip/_vendor/cachecontrol/compat.py,sha256=kHNvMRdt6s_Xwqq_9qJmr9ou3wYMOMUMxPPcwNxT8Mc,695 +pip/_vendor/cachecontrol/controller.py,sha256=CWEX3pedIM9s60suf4zZPtm_JvVgnvogMGK_OiBG5F8,14149 +pip/_vendor/cachecontrol/filewrapper.py,sha256=vACKO8Llzu_ZWyjV1Fxn1MA4TGU60N5N3GSrAFdAY2Q,2533 +pip/_vendor/cachecontrol/heuristics.py,sha256=BFGHJ3yQcxvZizfo90LLZ04T_Z5XSCXvFotrp7Us0sc,4070 +pip/_vendor/cachecontrol/serialize.py,sha256=vIa4jvq4x_KSOLdEIedoknX2aXYHQujLDFV4-F21Dno,7091 +pip/_vendor/cachecontrol/wrapper.py,sha256=5LX0uJwkNQUtYSEw3aGmGu9WY8wGipd81mJ8lG0d0M4,690 +pip/_vendor/certifi/__init__.py,sha256=-b78tXibbl0qtgCzv9tc9v6ozwcNX915lT9Tf4a9lds,62 +pip/_vendor/certifi/__main__.py,sha256=1k3Cr95vCxxGRGDljrW3wMdpZdL3Nhf0u1n-k2qdsCY,255 +pip/_vendor/certifi/__pycache__/__init__.cpython-39.pyc,, +pip/_vendor/certifi/__pycache__/__main__.cpython-39.pyc,, +pip/_vendor/certifi/__pycache__/core.cpython-39.pyc,, +pip/_vendor/certifi/cacert.pem,sha256=3i-hfE2K5o3CBKG2tYt6ehJWk2fP64o6Th83fHPoPp4,259465 +pip/_vendor/certifi/core.py,sha256=gOFd0zHYlx4krrLEn982esOtmz3djiG0BFSDhgjlvcI,2840 +pip/_vendor/chardet/__init__.py,sha256=mWZaWmvZkhwfBEAT9O1Y6nRTfKzhT7FHhQTTAujbqUA,3271 +pip/_vendor/chardet/__pycache__/__init__.cpython-39.pyc,, +pip/_vendor/chardet/__pycache__/big5freq.cpython-39.pyc,, +pip/_vendor/chardet/__pycache__/big5prober.cpython-39.pyc,, +pip/_vendor/chardet/__pycache__/chardistribution.cpython-39.pyc,, +pip/_vendor/chardet/__pycache__/charsetgroupprober.cpython-39.pyc,, +pip/_vendor/chardet/__pycache__/charsetprober.cpython-39.pyc,, +pip/_vendor/chardet/__pycache__/codingstatemachine.cpython-39.pyc,, +pip/_vendor/chardet/__pycache__/compat.cpython-39.pyc,, +pip/_vendor/chardet/__pycache__/cp949prober.cpython-39.pyc,, +pip/_vendor/chardet/__pycache__/enums.cpython-39.pyc,, +pip/_vendor/chardet/__pycache__/escprober.cpython-39.pyc,, +pip/_vendor/chardet/__pycache__/escsm.cpython-39.pyc,, +pip/_vendor/chardet/__pycache__/eucjpprober.cpython-39.pyc,, +pip/_vendor/chardet/__pycache__/euckrfreq.cpython-39.pyc,, +pip/_vendor/chardet/__pycache__/euckrprober.cpython-39.pyc,, +pip/_vendor/chardet/__pycache__/euctwfreq.cpython-39.pyc,, +pip/_vendor/chardet/__pycache__/euctwprober.cpython-39.pyc,, +pip/_vendor/chardet/__pycache__/gb2312freq.cpython-39.pyc,, +pip/_vendor/chardet/__pycache__/gb2312prober.cpython-39.pyc,, +pip/_vendor/chardet/__pycache__/hebrewprober.cpython-39.pyc,, +pip/_vendor/chardet/__pycache__/jisfreq.cpython-39.pyc,, +pip/_vendor/chardet/__pycache__/jpcntx.cpython-39.pyc,, +pip/_vendor/chardet/__pycache__/langbulgarianmodel.cpython-39.pyc,, +pip/_vendor/chardet/__pycache__/langgreekmodel.cpython-39.pyc,, +pip/_vendor/chardet/__pycache__/langhebrewmodel.cpython-39.pyc,, +pip/_vendor/chardet/__pycache__/langhungarianmodel.cpython-39.pyc,, +pip/_vendor/chardet/__pycache__/langrussianmodel.cpython-39.pyc,, +pip/_vendor/chardet/__pycache__/langthaimodel.cpython-39.pyc,, +pip/_vendor/chardet/__pycache__/langturkishmodel.cpython-39.pyc,, +pip/_vendor/chardet/__pycache__/latin1prober.cpython-39.pyc,, +pip/_vendor/chardet/__pycache__/mbcharsetprober.cpython-39.pyc,, +pip/_vendor/chardet/__pycache__/mbcsgroupprober.cpython-39.pyc,, +pip/_vendor/chardet/__pycache__/mbcssm.cpython-39.pyc,, +pip/_vendor/chardet/__pycache__/sbcharsetprober.cpython-39.pyc,, +pip/_vendor/chardet/__pycache__/sbcsgroupprober.cpython-39.pyc,, +pip/_vendor/chardet/__pycache__/sjisprober.cpython-39.pyc,, +pip/_vendor/chardet/__pycache__/universaldetector.cpython-39.pyc,, +pip/_vendor/chardet/__pycache__/utf8prober.cpython-39.pyc,, +pip/_vendor/chardet/__pycache__/version.cpython-39.pyc,, +pip/_vendor/chardet/big5freq.py,sha256=D_zK5GyzoVsRes0HkLJziltFQX0bKCLOrFe9_xDvO_8,31254 +pip/_vendor/chardet/big5prober.py,sha256=kBxHbdetBpPe7xrlb-e990iot64g_eGSLd32lB7_h3M,1757 +pip/_vendor/chardet/chardistribution.py,sha256=3woWS62KrGooKyqz4zQSnjFbJpa6V7g02daAibTwcl8,9411 +pip/_vendor/chardet/charsetgroupprober.py,sha256=GZLReHP6FRRn43hvSOoGCxYamErKzyp6RgOQxVeC3kg,3839 +pip/_vendor/chardet/charsetprober.py,sha256=KSmwJErjypyj0bRZmC5F5eM7c8YQgLYIjZXintZNstg,5110 +pip/_vendor/chardet/cli/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1 +pip/_vendor/chardet/cli/__pycache__/__init__.cpython-39.pyc,, +pip/_vendor/chardet/cli/__pycache__/chardetect.cpython-39.pyc,, +pip/_vendor/chardet/cli/chardetect.py,sha256=XK5zqjUG2a4-y6eLHZ8ThYcp6WWUrdlmELxNypcc2SE,2747 +pip/_vendor/chardet/codingstatemachine.py,sha256=VYp_6cyyki5sHgXDSZnXW4q1oelHc3cu9AyQTX7uug8,3590 +pip/_vendor/chardet/compat.py,sha256=40zr6wICZwknxyuLGGcIOPyve8DTebBCbbvttvnmp5Q,1200 +pip/_vendor/chardet/cp949prober.py,sha256=TZ434QX8zzBsnUvL_8wm4AQVTZ2ZkqEEQL_lNw9f9ow,1855 +pip/_vendor/chardet/enums.py,sha256=Aimwdb9as1dJKZaFNUH2OhWIVBVd6ZkJJ_WK5sNY8cU,1661 +pip/_vendor/chardet/escprober.py,sha256=kkyqVg1Yw3DIOAMJ2bdlyQgUFQhuHAW8dUGskToNWSc,3950 +pip/_vendor/chardet/escsm.py,sha256=RuXlgNvTIDarndvllNCk5WZBIpdCxQ0kcd9EAuxUh84,10510 +pip/_vendor/chardet/eucjpprober.py,sha256=iD8Jdp0ISRjgjiVN7f0e8xGeQJ5GM2oeZ1dA8nbSeUw,3749 +pip/_vendor/chardet/euckrfreq.py,sha256=-7GdmvgWez4-eO4SuXpa7tBiDi5vRXQ8WvdFAzVaSfo,13546 +pip/_vendor/chardet/euckrprober.py,sha256=MqFMTQXxW4HbzIpZ9lKDHB3GN8SP4yiHenTmf8g_PxY,1748 +pip/_vendor/chardet/euctwfreq.py,sha256=No1WyduFOgB5VITUA7PLyC5oJRNzRyMbBxaKI1l16MA,31621 +pip/_vendor/chardet/euctwprober.py,sha256=13p6EP4yRaxqnP4iHtxHOJ6R2zxHq1_m8hTRjzVZ95c,1747 +pip/_vendor/chardet/gb2312freq.py,sha256=JX8lsweKLmnCwmk8UHEQsLgkr_rP_kEbvivC4qPOrlc,20715 +pip/_vendor/chardet/gb2312prober.py,sha256=gGvIWi9WhDjE-xQXHvNIyrnLvEbMAYgyUSZ65HUfylw,1754 +pip/_vendor/chardet/hebrewprober.py,sha256=c3SZ-K7hvyzGY6JRAZxJgwJ_sUS9k0WYkvMY00YBYFo,13838 +pip/_vendor/chardet/jisfreq.py,sha256=vpmJv2Bu0J8gnMVRPHMFefTRvo_ha1mryLig8CBwgOg,25777 +pip/_vendor/chardet/jpcntx.py,sha256=PYlNqRUQT8LM3cT5FmHGP0iiscFlTWED92MALvBungo,19643 +pip/_vendor/chardet/langbulgarianmodel.py,sha256=rk9CJpuxO0bObboJcv6gNgWuosYZmd8qEEds5y7DS_Y,105697 +pip/_vendor/chardet/langgreekmodel.py,sha256=S-uNQ1ihC75yhBvSux24gLFZv3QyctMwC6OxLJdX-bw,99571 +pip/_vendor/chardet/langhebrewmodel.py,sha256=DzPP6TPGG_-PV7tqspu_d8duueqm7uN-5eQ0aHUw1Gg,98776 +pip/_vendor/chardet/langhungarianmodel.py,sha256=RtJH7DZdsmaHqyK46Kkmnk5wQHiJwJPPJSqqIlpeZRc,102498 +pip/_vendor/chardet/langrussianmodel.py,sha256=THqJOhSxiTQcHboDNSc5yofc2koXXQFHFyjtyuntUfM,131180 +pip/_vendor/chardet/langthaimodel.py,sha256=R1wXHnUMtejpw0JnH_JO8XdYasME6wjVqp1zP7TKLgg,103312 +pip/_vendor/chardet/langturkishmodel.py,sha256=rfwanTptTwSycE4-P-QasPmzd-XVYgevytzjlEzBBu8,95946 +pip/_vendor/chardet/latin1prober.py,sha256=S2IoORhFk39FEFOlSFWtgVybRiP6h7BlLldHVclNkU8,5370 +pip/_vendor/chardet/mbcharsetprober.py,sha256=AR95eFH9vuqSfvLQZN-L5ijea25NOBCoXqw8s5O9xLQ,3413 +pip/_vendor/chardet/mbcsgroupprober.py,sha256=h6TRnnYq2OxG1WdD5JOyxcdVpn7dG0q-vB8nWr5mbh4,2012 +pip/_vendor/chardet/mbcssm.py,sha256=SY32wVIF3HzcjY3BaEspy9metbNSKxIIB0RKPn7tjpI,25481 +pip/_vendor/chardet/metadata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +pip/_vendor/chardet/metadata/__pycache__/__init__.cpython-39.pyc,, +pip/_vendor/chardet/metadata/__pycache__/languages.cpython-39.pyc,, +pip/_vendor/chardet/metadata/languages.py,sha256=41tLq3eLSrBEbEVVQpVGFq9K7o1ln9b1HpY1l0hCUQo,19474 +pip/_vendor/chardet/sbcharsetprober.py,sha256=nmyMyuxzG87DN6K3Rk2MUzJLMLR69MrWpdnHzOwVUwQ,6136 +pip/_vendor/chardet/sbcsgroupprober.py,sha256=hqefQuXmiFyDBArOjujH6hd6WFXlOD1kWCsxDhjx5Vc,4309 +pip/_vendor/chardet/sjisprober.py,sha256=IIt-lZj0WJqK4rmUZzKZP4GJlE8KUEtFYVuY96ek5MQ,3774 +pip/_vendor/chardet/universaldetector.py,sha256=DpZTXCX0nUHXxkQ9sr4GZxGB_hveZ6hWt3uM94cgWKs,12503 +pip/_vendor/chardet/utf8prober.py,sha256=IdD8v3zWOsB8OLiyPi-y_fqwipRFxV9Nc1eKBLSuIEw,2766 +pip/_vendor/chardet/version.py,sha256=A4CILFAd8MRVG1HoXPp45iK9RLlWyV73a1EtwE8Tvn8,242 +pip/_vendor/colorama/__init__.py,sha256=pCdErryzLSzDW5P-rRPBlPLqbBtIRNJB6cMgoeJns5k,239 +pip/_vendor/colorama/__pycache__/__init__.cpython-39.pyc,, +pip/_vendor/colorama/__pycache__/ansi.cpython-39.pyc,, +pip/_vendor/colorama/__pycache__/ansitowin32.cpython-39.pyc,, +pip/_vendor/colorama/__pycache__/initialise.cpython-39.pyc,, +pip/_vendor/colorama/__pycache__/win32.cpython-39.pyc,, +pip/_vendor/colorama/__pycache__/winterm.cpython-39.pyc,, +pip/_vendor/colorama/ansi.py,sha256=Top4EeEuaQdBWdteKMEcGOTeKeF19Q-Wo_6_Cj5kOzQ,2522 +pip/_vendor/colorama/ansitowin32.py,sha256=yV7CEmCb19MjnJKODZEEvMH_fnbJhwnpzo4sxZuGXmA,10517 +pip/_vendor/colorama/initialise.py,sha256=PprovDNxMTrvoNHFcL2NZjpH2XzDc8BLxLxiErfUl4k,1915 +pip/_vendor/colorama/win32.py,sha256=bJ8Il9jwaBN5BJ8bmN6FoYZ1QYuMKv2j8fGrXh7TJjw,5404 +pip/_vendor/colorama/winterm.py,sha256=2y_2b7Zsv34feAsP67mLOVc-Bgq51mdYGo571VprlrM,6438 +pip/_vendor/distlib/__init__.py,sha256=bHNWOvZsLE4ES9S4FEA8CyP-rDYzatVgp9GHbpTnb2I,581 +pip/_vendor/distlib/__pycache__/__init__.cpython-39.pyc,, +pip/_vendor/distlib/__pycache__/compat.cpython-39.pyc,, +pip/_vendor/distlib/__pycache__/database.cpython-39.pyc,, +pip/_vendor/distlib/__pycache__/index.cpython-39.pyc,, +pip/_vendor/distlib/__pycache__/locators.cpython-39.pyc,, +pip/_vendor/distlib/__pycache__/manifest.cpython-39.pyc,, +pip/_vendor/distlib/__pycache__/markers.cpython-39.pyc,, +pip/_vendor/distlib/__pycache__/metadata.cpython-39.pyc,, +pip/_vendor/distlib/__pycache__/resources.cpython-39.pyc,, +pip/_vendor/distlib/__pycache__/scripts.cpython-39.pyc,, +pip/_vendor/distlib/__pycache__/util.cpython-39.pyc,, +pip/_vendor/distlib/__pycache__/version.cpython-39.pyc,, +pip/_vendor/distlib/__pycache__/wheel.cpython-39.pyc,, +pip/_vendor/distlib/_backport/__init__.py,sha256=bqS_dTOH6uW9iGgd0uzfpPjo6vZ4xpPZ7kyfZJ2vNaw,274 +pip/_vendor/distlib/_backport/__pycache__/__init__.cpython-39.pyc,, +pip/_vendor/distlib/_backport/__pycache__/misc.cpython-39.pyc,, +pip/_vendor/distlib/_backport/__pycache__/shutil.cpython-39.pyc,, +pip/_vendor/distlib/_backport/__pycache__/sysconfig.cpython-39.pyc,, +pip/_vendor/distlib/_backport/__pycache__/tarfile.cpython-39.pyc,, +pip/_vendor/distlib/_backport/misc.py,sha256=KWecINdbFNOxSOP1fGF680CJnaC6S4fBRgEtaYTw0ig,971 +pip/_vendor/distlib/_backport/shutil.py,sha256=IX_G2NPqwecJibkIDje04bqu0xpHkfSQ2GaGdEVqM5Y,25707 +pip/_vendor/distlib/_backport/sysconfig.cfg,sha256=swZKxq9RY5e9r3PXCrlvQPMsvOdiWZBTHLEbqS8LJLU,2617 +pip/_vendor/distlib/_backport/sysconfig.py,sha256=BQHFlb6pubCl_dvT1NjtzIthylofjKisox239stDg0U,26854 +pip/_vendor/distlib/_backport/tarfile.py,sha256=Ihp7rXRcjbIKw8COm9wSePV9ARGXbSF9gGXAMn2Q-KU,92628 +pip/_vendor/distlib/compat.py,sha256=ADA56xiAxar3mU6qemlBhNbsrFPosXRhO44RzsbJPqk,41408 +pip/_vendor/distlib/database.py,sha256=Kl0YvPQKc4OcpVi7k5cFziydM1xOK8iqdxLGXgbZHV4,51059 +pip/_vendor/distlib/index.py,sha256=UfcimNW19AB7IKWam4VaJbXuCBvArKfSxhV16EwavzE,20739 +pip/_vendor/distlib/locators.py,sha256=AKlB3oZvfOTg4E0CtfwOzujFL19X5V4XUA4eHdKOu44,51965 +pip/_vendor/distlib/manifest.py,sha256=nQEhYmgoreaBZzyFzwYsXxJARu3fo4EkunU163U16iE,14811 +pip/_vendor/distlib/markers.py,sha256=OunMSH1SIbvLLt4z2VEERCll4WNlz2tDrg1mSXCNUj4,4344 +pip/_vendor/distlib/metadata.py,sha256=vatoxFdmBr6ie-sTVXVNPOPG3uwMDWJTnEECnm7xDCw,39109 +pip/_vendor/distlib/resources.py,sha256=LwbPksc0A1JMbi6XnuPdMBUn83X7BPuFNWqPGEKI698,10820 +pip/_vendor/distlib/scripts.py,sha256=YD5_kioPD-qybYwQ4Gxyu-FR4ffxczy2gdBuU4II9qA,17248 +pip/_vendor/distlib/t32.exe,sha256=NS3xBCVAld35JVFNmb-1QRyVtThukMrwZVeXn4LhaEQ,96768 +pip/_vendor/distlib/t64.exe,sha256=oAqHes78rUWVM0OtVqIhUvequl_PKhAhXYQWnUf7zR0,105984 +pip/_vendor/distlib/util.py,sha256=eIKKJ5Mp4unHMOVzixRIRxGq4ty5-h_PoFmZ_lpvkkM,67558 +pip/_vendor/distlib/version.py,sha256=_geOv-cHoV-G8dQzKI8g6z8F0XeFeUqdJ_1G1K6iyrQ,23508 +pip/_vendor/distlib/w32.exe,sha256=lJtnZdeUxTZWya_EW5DZos_K5rswRECGspIl8ZJCIXs,90112 +pip/_vendor/distlib/w64.exe,sha256=0aRzoN2BO9NWW4ENy4_4vHkHR4qZTFZNVSAJJYlODTI,99840 +pip/_vendor/distlib/wheel.py,sha256=W6aQQo2Si0CzWiCaqlS-Nu8CoHnDbmcGMqRxCHJmg_Q,43062 +pip/_vendor/distro.py,sha256=xxMIh2a3KmippeWEHzynTdHT3_jZM0o-pos0dAWJROM,43628 +pip/_vendor/html5lib/__init__.py,sha256=BYzcKCqeEii52xDrqBFruhnmtmkiuHXFyFh-cglQ8mk,1160 +pip/_vendor/html5lib/__pycache__/__init__.cpython-39.pyc,, +pip/_vendor/html5lib/__pycache__/_ihatexml.cpython-39.pyc,, +pip/_vendor/html5lib/__pycache__/_inputstream.cpython-39.pyc,, +pip/_vendor/html5lib/__pycache__/_tokenizer.cpython-39.pyc,, +pip/_vendor/html5lib/__pycache__/_utils.cpython-39.pyc,, +pip/_vendor/html5lib/__pycache__/constants.cpython-39.pyc,, +pip/_vendor/html5lib/__pycache__/html5parser.cpython-39.pyc,, +pip/_vendor/html5lib/__pycache__/serializer.cpython-39.pyc,, +pip/_vendor/html5lib/_ihatexml.py,sha256=ifOwF7pXqmyThIXc3boWc96s4MDezqRrRVp7FwDYUFs,16728 +pip/_vendor/html5lib/_inputstream.py,sha256=jErNASMlkgs7MpOM9Ve_VdLDJyFFweAjLuhVutZz33U,32353 +pip/_vendor/html5lib/_tokenizer.py,sha256=04mgA2sNTniutl2fxFv-ei5bns4iRaPxVXXHh_HrV_4,77040 +pip/_vendor/html5lib/_trie/__init__.py,sha256=nqfgO910329BEVJ5T4psVwQtjd2iJyEXQ2-X8c1YxwU,109 +pip/_vendor/html5lib/_trie/__pycache__/__init__.cpython-39.pyc,, +pip/_vendor/html5lib/_trie/__pycache__/_base.cpython-39.pyc,, +pip/_vendor/html5lib/_trie/__pycache__/py.cpython-39.pyc,, +pip/_vendor/html5lib/_trie/_base.py,sha256=CaybYyMro8uERQYjby2tTeSUatnWDfWroUN9N7ety5w,1013 +pip/_vendor/html5lib/_trie/py.py,sha256=wXmQLrZRf4MyWNyg0m3h81m9InhLR7GJ002mIIZh-8o,1775 +pip/_vendor/html5lib/_utils.py,sha256=Dx9AKntksRjFT1veBj7I362pf5OgIaT0zglwq43RnfU,4931 +pip/_vendor/html5lib/constants.py,sha256=Ll-yzLU_jcjyAI_h57zkqZ7aQWE5t5xA4y_jQgoUUhw,83464 +pip/_vendor/html5lib/filters/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +pip/_vendor/html5lib/filters/__pycache__/__init__.cpython-39.pyc,, +pip/_vendor/html5lib/filters/__pycache__/alphabeticalattributes.cpython-39.pyc,, +pip/_vendor/html5lib/filters/__pycache__/base.cpython-39.pyc,, +pip/_vendor/html5lib/filters/__pycache__/inject_meta_charset.cpython-39.pyc,, +pip/_vendor/html5lib/filters/__pycache__/lint.cpython-39.pyc,, +pip/_vendor/html5lib/filters/__pycache__/optionaltags.cpython-39.pyc,, +pip/_vendor/html5lib/filters/__pycache__/sanitizer.cpython-39.pyc,, +pip/_vendor/html5lib/filters/__pycache__/whitespace.cpython-39.pyc,, +pip/_vendor/html5lib/filters/alphabeticalattributes.py,sha256=lViZc2JMCclXi_5gduvmdzrRxtO5Xo9ONnbHBVCsykU,919 +pip/_vendor/html5lib/filters/base.py,sha256=z-IU9ZAYjpsVsqmVt7kuWC63jR11hDMr6CVrvuao8W0,286 +pip/_vendor/html5lib/filters/inject_meta_charset.py,sha256=egDXUEHXmAG9504xz0K6ALDgYkvUrC2q15YUVeNlVQg,2945 +pip/_vendor/html5lib/filters/lint.py,sha256=jk6q56xY0ojiYfvpdP-OZSm9eTqcAdRqhCoPItemPYA,3643 +pip/_vendor/html5lib/filters/optionaltags.py,sha256=8lWT75J0aBOHmPgfmqTHSfPpPMp01T84NKu0CRedxcE,10588 +pip/_vendor/html5lib/filters/sanitizer.py,sha256=m6oGmkBhkGAnn2nV6D4hE78SCZ6WEnK9rKdZB3uXBIc,26897 +pip/_vendor/html5lib/filters/whitespace.py,sha256=8eWqZxd4UC4zlFGW6iyY6f-2uuT8pOCSALc3IZt7_t4,1214 +pip/_vendor/html5lib/html5parser.py,sha256=anr-aXre_ImfrkQ35c_rftKXxC80vJCREKe06Tq15HA,117186 +pip/_vendor/html5lib/serializer.py,sha256=_PpvcZF07cwE7xr9uKkZqh5f4UEaI8ltCU2xPJzaTpk,15759 +pip/_vendor/html5lib/treeadapters/__init__.py,sha256=A0rY5gXIe4bJOiSGRO_j_tFhngRBO8QZPzPtPw5dFzo,679 +pip/_vendor/html5lib/treeadapters/__pycache__/__init__.cpython-39.pyc,, +pip/_vendor/html5lib/treeadapters/__pycache__/genshi.cpython-39.pyc,, +pip/_vendor/html5lib/treeadapters/__pycache__/sax.cpython-39.pyc,, +pip/_vendor/html5lib/treeadapters/genshi.py,sha256=CH27pAsDKmu4ZGkAUrwty7u0KauGLCZRLPMzaO3M5vo,1715 +pip/_vendor/html5lib/treeadapters/sax.py,sha256=BKS8woQTnKiqeffHsxChUqL4q2ZR_wb5fc9MJ3zQC8s,1776 +pip/_vendor/html5lib/treebuilders/__init__.py,sha256=AysSJyvPfikCMMsTVvaxwkgDieELD5dfR8FJIAuq7hY,3592 +pip/_vendor/html5lib/treebuilders/__pycache__/__init__.cpython-39.pyc,, +pip/_vendor/html5lib/treebuilders/__pycache__/base.cpython-39.pyc,, +pip/_vendor/html5lib/treebuilders/__pycache__/dom.cpython-39.pyc,, +pip/_vendor/html5lib/treebuilders/__pycache__/etree.cpython-39.pyc,, +pip/_vendor/html5lib/treebuilders/__pycache__/etree_lxml.cpython-39.pyc,, +pip/_vendor/html5lib/treebuilders/base.py,sha256=z-o51vt9r_l2IDG5IioTOKGzZne4Fy3_Fc-7ztrOh4I,14565 +pip/_vendor/html5lib/treebuilders/dom.py,sha256=22whb0C71zXIsai5mamg6qzBEiigcBIvaDy4Asw3at0,8925 +pip/_vendor/html5lib/treebuilders/etree.py,sha256=w5ZFpKk6bAxnrwD2_BrF5EVC7vzz0L3LMi9Sxrbc_8w,12836 +pip/_vendor/html5lib/treebuilders/etree_lxml.py,sha256=9gqDjs-IxsPhBYa5cpvv2FZ1KZlG83Giusy2lFmvIkE,14766 +pip/_vendor/html5lib/treewalkers/__init__.py,sha256=OBPtc1TU5mGyy18QDMxKEyYEz0wxFUUNj5v0-XgmYhY,5719 +pip/_vendor/html5lib/treewalkers/__pycache__/__init__.cpython-39.pyc,, +pip/_vendor/html5lib/treewalkers/__pycache__/base.cpython-39.pyc,, +pip/_vendor/html5lib/treewalkers/__pycache__/dom.cpython-39.pyc,, +pip/_vendor/html5lib/treewalkers/__pycache__/etree.cpython-39.pyc,, +pip/_vendor/html5lib/treewalkers/__pycache__/etree_lxml.cpython-39.pyc,, +pip/_vendor/html5lib/treewalkers/__pycache__/genshi.cpython-39.pyc,, +pip/_vendor/html5lib/treewalkers/base.py,sha256=ouiOsuSzvI0KgzdWP8PlxIaSNs9falhbiinAEc_UIJY,7476 +pip/_vendor/html5lib/treewalkers/dom.py,sha256=EHyFR8D8lYNnyDU9lx_IKigVJRyecUGua0mOi7HBukc,1413 +pip/_vendor/html5lib/treewalkers/etree.py,sha256=xo1L5m9VtkfpFJK0pFmkLVajhqYYVisVZn3k9kYpPkI,4551 +pip/_vendor/html5lib/treewalkers/etree_lxml.py,sha256=_b0LAVWLcVu9WaU_-w3D8f0IRSpCbjf667V-3NRdhTw,6357 +pip/_vendor/html5lib/treewalkers/genshi.py,sha256=4D2PECZ5n3ZN3qu3jMl9yY7B81jnQApBQSVlfaIuYbA,2309 +pip/_vendor/idna/__init__.py,sha256=KJQN1eQBr8iIK5SKrJ47lXvxG0BJ7Lm38W4zT0v_8lk,849 +pip/_vendor/idna/__pycache__/__init__.cpython-39.pyc,, +pip/_vendor/idna/__pycache__/codec.cpython-39.pyc,, +pip/_vendor/idna/__pycache__/compat.cpython-39.pyc,, +pip/_vendor/idna/__pycache__/core.cpython-39.pyc,, +pip/_vendor/idna/__pycache__/idnadata.cpython-39.pyc,, +pip/_vendor/idna/__pycache__/intranges.cpython-39.pyc,, +pip/_vendor/idna/__pycache__/package_data.cpython-39.pyc,, +pip/_vendor/idna/__pycache__/uts46data.cpython-39.pyc,, +pip/_vendor/idna/codec.py,sha256=QsPFD3Je8gN17rfs14e7zTGRWlnL7bNf2ZqcHTRVYHs,3453 +pip/_vendor/idna/compat.py,sha256=5A9xR04puRHCsyjBNewZlVSiarth7K1bZqyEOeob1fA,360 +pip/_vendor/idna/core.py,sha256=icq2P13S6JMjoXgKhhd6ihhby7QsnZlNfniH6fLyf6U,12826 +pip/_vendor/idna/idnadata.py,sha256=cl4x9RLdw1ZMtEEbvKwAsX-Id3AdIjO5U3HaoKM6VGs,42350 +pip/_vendor/idna/intranges.py,sha256=EqgXwyATAn-CTACInqH9tYsYAitGB2VcQ50RZt_Cpjs,1933 +pip/_vendor/idna/package_data.py,sha256=_028B4fvadRIaXMwMYjhuQPP3AxTIt1IRE7X6RDR4Mk,21 +pip/_vendor/idna/uts46data.py,sha256=DGzwDQv8JijY17I_7ondo3stjFjNnjvVAbA-z0k1XOE,201849 +pip/_vendor/msgpack/__init__.py,sha256=2gJwcsTIaAtCM0GMi2rU-_Y6kILeeQuqRkrQ22jSANc,1118 +pip/_vendor/msgpack/__pycache__/__init__.cpython-39.pyc,, +pip/_vendor/msgpack/__pycache__/_version.cpython-39.pyc,, +pip/_vendor/msgpack/__pycache__/exceptions.cpython-39.pyc,, +pip/_vendor/msgpack/__pycache__/ext.cpython-39.pyc,, +pip/_vendor/msgpack/__pycache__/fallback.cpython-39.pyc,, +pip/_vendor/msgpack/_version.py,sha256=dFR03oACnj4lsKd1RnwD7BPMiVI_FMygdOL1TOBEw_U,20 +pip/_vendor/msgpack/exceptions.py,sha256=dCTWei8dpkrMsQDcjQk74ATl9HsIBH0ybt8zOPNqMYc,1081 +pip/_vendor/msgpack/ext.py,sha256=4l356Y4sVEcvCla2dh_cL57vh4GMhZfa3kuWHFHYz6A,6088 +pip/_vendor/msgpack/fallback.py,sha256=Rpv1Ldey8f8ueRnQznD4ARKBn9dxM2PywVNkXI8IEeE,38026 +pip/_vendor/packaging/__about__.py,sha256=p_OQloqH2saadcbUQmWEsWK857dI6_ff5E3aSiCqGFA,661 +pip/_vendor/packaging/__init__.py,sha256=b9Kk5MF7KxhhLgcDmiUWukN-LatWFxPdNug0joPhHSk,497 +pip/_vendor/packaging/__pycache__/__about__.cpython-39.pyc,, +pip/_vendor/packaging/__pycache__/__init__.cpython-39.pyc,, +pip/_vendor/packaging/__pycache__/_manylinux.cpython-39.pyc,, +pip/_vendor/packaging/__pycache__/_musllinux.cpython-39.pyc,, +pip/_vendor/packaging/__pycache__/_structures.cpython-39.pyc,, +pip/_vendor/packaging/__pycache__/markers.cpython-39.pyc,, +pip/_vendor/packaging/__pycache__/requirements.cpython-39.pyc,, +pip/_vendor/packaging/__pycache__/specifiers.cpython-39.pyc,, +pip/_vendor/packaging/__pycache__/tags.cpython-39.pyc,, +pip/_vendor/packaging/__pycache__/utils.cpython-39.pyc,, +pip/_vendor/packaging/__pycache__/version.cpython-39.pyc,, +pip/_vendor/packaging/_manylinux.py,sha256=XcbiXB-qcjv3bcohp6N98TMpOP4_j3m-iOA8ptK2GWY,11488 +pip/_vendor/packaging/_musllinux.py,sha256=z5yeG1ygOPx4uUyLdqj-p8Dk5UBb5H_b0NIjW9yo8oA,4378 +pip/_vendor/packaging/_structures.py,sha256=TMiAgFbdUOPmIfDIfiHc3KFhSJ8kMjof2QS5I-2NyQ8,1629 +pip/_vendor/packaging/markers.py,sha256=AJBOcY8Oq0kYc570KuuPTkvuqjAlhufaE2c9sCUbm64,8487 +pip/_vendor/packaging/requirements.py,sha256=NtDlPBtojpn1IUC85iMjPNsUmufjpSlwnNA-Xb4m5NA,4676 +pip/_vendor/packaging/specifiers.py,sha256=MZ-fYcNL3u7pNrt-6g2EQO7AbRXkjc-SPEYwXMQbLmc,30964 +pip/_vendor/packaging/tags.py,sha256=akIerYw8W0sz4OW9HHozgawWnbt2GGOPm3sviW0jowY,15714 +pip/_vendor/packaging/utils.py,sha256=dJjeat3BS-TYn1RrUFVwufUMasbtzLfYRoy_HXENeFQ,4200 +pip/_vendor/packaging/version.py,sha256=_fLRNrFrxYcHVfyo8vk9j8s6JM8N_xsSxVFr6RJyco8,14665 +pip/_vendor/pep517/__init__.py,sha256=qDgVbDWpBYpTvtxA2tilifXlxwzOzRqIodLZdbyahyQ,130 +pip/_vendor/pep517/__pycache__/__init__.cpython-39.pyc,, +pip/_vendor/pep517/__pycache__/build.cpython-39.pyc,, +pip/_vendor/pep517/__pycache__/check.cpython-39.pyc,, +pip/_vendor/pep517/__pycache__/colorlog.cpython-39.pyc,, +pip/_vendor/pep517/__pycache__/compat.cpython-39.pyc,, +pip/_vendor/pep517/__pycache__/dirtools.cpython-39.pyc,, +pip/_vendor/pep517/__pycache__/envbuild.cpython-39.pyc,, +pip/_vendor/pep517/__pycache__/meta.cpython-39.pyc,, +pip/_vendor/pep517/__pycache__/wrappers.cpython-39.pyc,, +pip/_vendor/pep517/build.py,sha256=MqN_W6o5a9oauTC0u6W5cILGFjf9x2BV9BdMLeY60hc,3469 +pip/_vendor/pep517/check.py,sha256=AYG2yvpzmtsL810c75Z5-nhaXa7SxgK8APyw-_x53Ok,6096 +pip/_vendor/pep517/colorlog.py,sha256=Tk9AuYm_cLF3BKTBoSTJt9bRryn0aFojIQOwbfVUTxQ,4098 +pip/_vendor/pep517/compat.py,sha256=fw2Py6lqLwJLfp6MKmXvt1m4sbbgoU1D-_gcScvz8OU,1071 +pip/_vendor/pep517/dirtools.py,sha256=2mkAkAL0mRz_elYFjRKuekTJVipH1zTn4tbf1EDev84,1129 +pip/_vendor/pep517/envbuild.py,sha256=LcST0MASmcQNLOFqDPxDoS1kjkglx8F6eEhoBJ-DWkg,6112 +pip/_vendor/pep517/in_process/__init__.py,sha256=MyWoAi8JHdcBv7yXuWpUSVADbx6LSB9rZh7kTIgdA8Y,563 +pip/_vendor/pep517/in_process/__pycache__/__init__.cpython-39.pyc,, +pip/_vendor/pep517/in_process/__pycache__/_in_process.cpython-39.pyc,, +pip/_vendor/pep517/in_process/_in_process.py,sha256=YJJf-qaL7BBVdgCHuMhTpx-LtwG1EIGVfly4rtusdiI,10833 +pip/_vendor/pep517/meta.py,sha256=8mnM5lDnT4zXQpBTliJbRGfesH7iioHwozbDxALPS9Y,2463 +pip/_vendor/pep517/wrappers.py,sha256=qCWfEUnbE5387PyQl7cT8xv4dDca4uNgro_0bnAO4Rk,13258 +pip/_vendor/pkg_resources/__init__.py,sha256=XpGBfvS9fafA6bm5rx7vnxdxs7yqyoc_NnpzKApkJ64,108277 +pip/_vendor/pkg_resources/__pycache__/__init__.cpython-39.pyc,, +pip/_vendor/pkg_resources/__pycache__/py31compat.cpython-39.pyc,, +pip/_vendor/pkg_resources/py31compat.py,sha256=CRk8fkiPRDLsbi5pZcKsHI__Pbmh_94L8mr9Qy9Ab2U,562 +pip/_vendor/progress/__init__.py,sha256=fcbQQXo5np2CoQyhSH5XprkicwLZNLePR3uIahznSO0,4857 +pip/_vendor/progress/__pycache__/__init__.cpython-39.pyc,, +pip/_vendor/progress/__pycache__/bar.cpython-39.pyc,, +pip/_vendor/progress/__pycache__/counter.cpython-39.pyc,, +pip/_vendor/progress/__pycache__/spinner.cpython-39.pyc,, +pip/_vendor/progress/bar.py,sha256=QuDuVNcmXgpxtNtxO0Fq72xKigxABaVmxYGBw4J3Z_E,2854 +pip/_vendor/progress/counter.py,sha256=MznyBrvPWrOlGe4MZAlGUb9q3aODe6_aNYeAE_VNoYA,1372 +pip/_vendor/progress/spinner.py,sha256=k8JbDW94T0-WXuXfxZIFhdoNPYp3jfnpXqBnfRv5fGs,1380 +pip/_vendor/pyparsing.py,sha256=J1b4z3S_KwyJW7hKGnoN-hXW9pgMIzIP6QThyY5yJq4,273394 +pip/_vendor/requests/__init__.py,sha256=g4Bh1QYh6JKjMS4YLobx0uOLq-41sINaXjvbhX2VI8g,5113 +pip/_vendor/requests/__pycache__/__init__.cpython-39.pyc,, +pip/_vendor/requests/__pycache__/__version__.cpython-39.pyc,, +pip/_vendor/requests/__pycache__/_internal_utils.cpython-39.pyc,, +pip/_vendor/requests/__pycache__/adapters.cpython-39.pyc,, +pip/_vendor/requests/__pycache__/api.cpython-39.pyc,, +pip/_vendor/requests/__pycache__/auth.cpython-39.pyc,, +pip/_vendor/requests/__pycache__/certs.cpython-39.pyc,, +pip/_vendor/requests/__pycache__/compat.cpython-39.pyc,, +pip/_vendor/requests/__pycache__/cookies.cpython-39.pyc,, +pip/_vendor/requests/__pycache__/exceptions.cpython-39.pyc,, +pip/_vendor/requests/__pycache__/help.cpython-39.pyc,, +pip/_vendor/requests/__pycache__/hooks.cpython-39.pyc,, +pip/_vendor/requests/__pycache__/models.cpython-39.pyc,, +pip/_vendor/requests/__pycache__/packages.cpython-39.pyc,, +pip/_vendor/requests/__pycache__/sessions.cpython-39.pyc,, +pip/_vendor/requests/__pycache__/status_codes.cpython-39.pyc,, +pip/_vendor/requests/__pycache__/structures.cpython-39.pyc,, +pip/_vendor/requests/__pycache__/utils.cpython-39.pyc,, +pip/_vendor/requests/__version__.py,sha256=PZEyPTSIN_jRIAIB51wV7pw81m3qAw0InSR7OrKZUnE,441 +pip/_vendor/requests/_internal_utils.py,sha256=Zx3PnEUccyfsB-ie11nZVAW8qClJy0gx1qNME7rgT18,1096 +pip/_vendor/requests/adapters.py,sha256=e-bmKEApNVqFdylxuMJJfiaHdlmS_zhWhIMEzlHvGuc,21548 +pip/_vendor/requests/api.py,sha256=hjuoP79IAEmX6Dysrw8t032cLfwLHxbI_wM4gC5G9t0,6402 +pip/_vendor/requests/auth.py,sha256=OMoJIVKyRLy9THr91y8rxysZuclwPB-K1Xg1zBomUhQ,10207 +pip/_vendor/requests/certs.py,sha256=nXRVq9DtGmv_1AYbwjTu9UrgAcdJv05ZvkNeaoLOZxY,465 +pip/_vendor/requests/compat.py,sha256=LQWuCR4qXk6w7-qQopXyz0WNHUdAD40k0mKnaAEf1-g,2045 +pip/_vendor/requests/cookies.py,sha256=Y-bKX6TvW3FnYlE6Au0SXtVVWcaNdFvuAwQxw-G0iTI,18430 +pip/_vendor/requests/exceptions.py,sha256=dwIi512RCDqXJ2T81nLC88mqPNhUFnOI_CgKKDXhTO8,3250 +pip/_vendor/requests/help.py,sha256=dyhe3lcmHXnFCzDiZVjcGmVvvO_jtsfAm-AC542ndw8,3972 +pip/_vendor/requests/hooks.py,sha256=QReGyy0bRcr5rkwCuObNakbYsc7EkiKeBwG4qHekr2Q,757 +pip/_vendor/requests/models.py,sha256=9_LS_t1t6HbbaWFE3ZkxGmmHN2V8BgxziiOU84rrQ50,34924 +pip/_vendor/requests/packages.py,sha256=njJmVifY4aSctuW3PP5EFRCxjEwMRDO6J_feG2dKWsI,695 +pip/_vendor/requests/sessions.py,sha256=57O4ud9yRL6eLYh-dtFbqC1kO4d_EwZcCgYXEkujlfs,30168 +pip/_vendor/requests/status_codes.py,sha256=gT79Pbs_cQjBgp-fvrUgg1dn2DQO32bDj4TInjnMPSc,4188 +pip/_vendor/requests/structures.py,sha256=msAtr9mq1JxHd-JRyiILfdFlpbJwvvFuP3rfUQT_QxE,3005 +pip/_vendor/requests/utils.py,sha256=U_-i6WxLw-67KEij43xHbcvL0DdeQ5Jbd4hfifWJzQY,31394 +pip/_vendor/resolvelib/__init__.py,sha256=uoW0dgWCDwApX59mRffoPISkZGGk_UZ1It_PY4o_PaE,537 +pip/_vendor/resolvelib/__pycache__/__init__.cpython-39.pyc,, +pip/_vendor/resolvelib/__pycache__/providers.cpython-39.pyc,, +pip/_vendor/resolvelib/__pycache__/reporters.cpython-39.pyc,, +pip/_vendor/resolvelib/__pycache__/resolvers.cpython-39.pyc,, +pip/_vendor/resolvelib/__pycache__/structs.cpython-39.pyc,, +pip/_vendor/resolvelib/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +pip/_vendor/resolvelib/compat/__pycache__/__init__.cpython-39.pyc,, +pip/_vendor/resolvelib/compat/__pycache__/collections_abc.cpython-39.pyc,, +pip/_vendor/resolvelib/compat/collections_abc.py,sha256=uy8xUZ-NDEw916tugUXm8HgwCGiMO0f-RcdnpkfXfOs,156 +pip/_vendor/resolvelib/providers.py,sha256=bfzFDZd7UqkkAS7lUM_HeYbA-HzjKfDlle_pn_79vio,5638 +pip/_vendor/resolvelib/reporters.py,sha256=hQvvXuuEBOyEWO8KDfLsWKVjX55UFMAUwO0YZMNpzAw,1364 +pip/_vendor/resolvelib/resolvers.py,sha256=wT83PHiBWRCklL-nLJ1-8sk2B3yBI06Rse1H11crOsI,17225 +pip/_vendor/resolvelib/structs.py,sha256=IVIYof6sA_N4ZEiE1C1UhzTX495brCNnyCdgq6CYq28,4794 +pip/_vendor/six.py,sha256=TOOfQi7nFGfMrIvtdr6wX4wyHH8M7aknmuLfo2cBBrM,34549 +pip/_vendor/tenacity/__init__.py,sha256=GLLsTFD4Bd5VDgTR6mU_FxyOsrxc48qONorVaRebeD4,18257 +pip/_vendor/tenacity/__pycache__/__init__.cpython-39.pyc,, +pip/_vendor/tenacity/__pycache__/_asyncio.cpython-39.pyc,, +pip/_vendor/tenacity/__pycache__/_utils.cpython-39.pyc,, +pip/_vendor/tenacity/__pycache__/after.cpython-39.pyc,, +pip/_vendor/tenacity/__pycache__/before.cpython-39.pyc,, +pip/_vendor/tenacity/__pycache__/before_sleep.cpython-39.pyc,, +pip/_vendor/tenacity/__pycache__/nap.cpython-39.pyc,, +pip/_vendor/tenacity/__pycache__/retry.cpython-39.pyc,, +pip/_vendor/tenacity/__pycache__/stop.cpython-39.pyc,, +pip/_vendor/tenacity/__pycache__/tornadoweb.cpython-39.pyc,, +pip/_vendor/tenacity/__pycache__/wait.cpython-39.pyc,, +pip/_vendor/tenacity/_asyncio.py,sha256=HEb0BVJEeBJE9P-m9XBxh1KcaF96BwoeqkJCL5sbVcQ,3314 +pip/_vendor/tenacity/_utils.py,sha256=-y68scDcyoqvTJuJJ0GTfjdSCljEYlbCYvgk7nM4NdM,1944 +pip/_vendor/tenacity/after.py,sha256=dlmyxxFy2uqpLXDr838DiEd7jgv2AGthsWHGYcGYsaI,1496 +pip/_vendor/tenacity/before.py,sha256=7XtvRmO0dRWUp8SVn24OvIiGFj8-4OP5muQRUiWgLh0,1376 +pip/_vendor/tenacity/before_sleep.py,sha256=ThyDvqKU5yle_IvYQz_b6Tp6UjUS0PhVp6zgqYl9U6Y,1908 +pip/_vendor/tenacity/nap.py,sha256=fRWvnz1aIzbIq9Ap3gAkAZgDH6oo5zxMrU6ZOVByq0I,1383 +pip/_vendor/tenacity/retry.py,sha256=62R71W59bQjuNyFKsDM7hE2aEkEPtwNBRA0tnsEvgSk,6645 +pip/_vendor/tenacity/stop.py,sha256=sKHmHaoSaW6sKu3dTxUVKr1-stVkY7lw4Y9yjZU30zQ,2790 +pip/_vendor/tenacity/tornadoweb.py,sha256=E8lWO2nwe6dJgoB-N2HhQprYLDLB_UdSgFnv-EN6wKE,2145 +pip/_vendor/tenacity/wait.py,sha256=e_Saa6I2tsNLpCL1t9897wN2fGb0XQMQlE4bU2t9V2w,6691 +pip/_vendor/tomli/__init__.py,sha256=z1Elt0nLAqU5Y0DOn9p__8QnLWavlEOpRyQikdYgKro,230 +pip/_vendor/tomli/__pycache__/__init__.cpython-39.pyc,, +pip/_vendor/tomli/__pycache__/_parser.cpython-39.pyc,, +pip/_vendor/tomli/__pycache__/_re.cpython-39.pyc,, +pip/_vendor/tomli/_parser.py,sha256=50BD4o9YbzFAGAYyZLqZC8F81DQ7iWWyJnrHNwBKa6A,22415 +pip/_vendor/tomli/_re.py,sha256=5GPfgXKteg7wRFCF-DzlkAPI2ilHbkMK2-JC49F-AJQ,2681 +pip/_vendor/urllib3/__init__.py,sha256=j3yzHIbmW7CS-IKQJ9-PPQf_YKO8EOAey_rMW0UR7us,2763 +pip/_vendor/urllib3/__pycache__/__init__.cpython-39.pyc,, +pip/_vendor/urllib3/__pycache__/_collections.cpython-39.pyc,, +pip/_vendor/urllib3/__pycache__/_version.cpython-39.pyc,, +pip/_vendor/urllib3/__pycache__/connection.cpython-39.pyc,, +pip/_vendor/urllib3/__pycache__/connectionpool.cpython-39.pyc,, +pip/_vendor/urllib3/__pycache__/exceptions.cpython-39.pyc,, +pip/_vendor/urllib3/__pycache__/fields.cpython-39.pyc,, +pip/_vendor/urllib3/__pycache__/filepost.cpython-39.pyc,, +pip/_vendor/urllib3/__pycache__/poolmanager.cpython-39.pyc,, +pip/_vendor/urllib3/__pycache__/request.cpython-39.pyc,, +pip/_vendor/urllib3/__pycache__/response.cpython-39.pyc,, +pip/_vendor/urllib3/_collections.py,sha256=Rp1mVyBgc_UlAcp6M3at1skJBXR5J43NawRTvW2g_XY,10811 +pip/_vendor/urllib3/_version.py,sha256=6fJAIPnJkT0m9wzVjHrFcq5wYt65dStDpaRcjj5ugoo,63 +pip/_vendor/urllib3/connection.py,sha256=kAlubwsW33FUSUroPSVHMF_Zzv-uzX_BwUFMXX9Pt8c,18754 +pip/_vendor/urllib3/connectionpool.py,sha256=jXNmm4y3LJWYgteNeGcYJx8-0k7bzKRU__AVTXzaIak,37131 +pip/_vendor/urllib3/contrib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +pip/_vendor/urllib3/contrib/__pycache__/__init__.cpython-39.pyc,, +pip/_vendor/urllib3/contrib/__pycache__/_appengine_environ.cpython-39.pyc,, +pip/_vendor/urllib3/contrib/__pycache__/appengine.cpython-39.pyc,, +pip/_vendor/urllib3/contrib/__pycache__/ntlmpool.cpython-39.pyc,, +pip/_vendor/urllib3/contrib/__pycache__/pyopenssl.cpython-39.pyc,, +pip/_vendor/urllib3/contrib/__pycache__/securetransport.cpython-39.pyc,, +pip/_vendor/urllib3/contrib/__pycache__/socks.cpython-39.pyc,, +pip/_vendor/urllib3/contrib/_appengine_environ.py,sha256=bDbyOEhW2CKLJcQqAKAyrEHN-aklsyHFKq6vF8ZFsmk,957 +pip/_vendor/urllib3/contrib/_securetransport/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +pip/_vendor/urllib3/contrib/_securetransport/__pycache__/__init__.cpython-39.pyc,, +pip/_vendor/urllib3/contrib/_securetransport/__pycache__/bindings.cpython-39.pyc,, +pip/_vendor/urllib3/contrib/_securetransport/__pycache__/low_level.cpython-39.pyc,, +pip/_vendor/urllib3/contrib/_securetransport/bindings.py,sha256=eRy1Mj-wpg7sR6-OSvnSV4jUbjMT464dLN_CWxbIRVw,17649 +pip/_vendor/urllib3/contrib/_securetransport/low_level.py,sha256=lgIdsSycqfB0Xm5BiJzXGeIKT7ybCQMFPJAgkcwPa1s,13908 +pip/_vendor/urllib3/contrib/appengine.py,sha256=lfzpHFmJiO82shClLEm3QB62SYgHWnjpZOH_2JhU5Tc,11034 +pip/_vendor/urllib3/contrib/ntlmpool.py,sha256=ej9gGvfAb2Gt00lafFp45SIoRz-QwrQ4WChm6gQmAlM,4538 +pip/_vendor/urllib3/contrib/pyopenssl.py,sha256=lYIxGFWTosqbfLnkZXOBg7igY71iRvM3NUOaD0stUQ8,16891 +pip/_vendor/urllib3/contrib/securetransport.py,sha256=TN5q9dKZ0Sd5_vW9baRzEAEItdJ-4VlHWmAUrlcJNfo,34434 +pip/_vendor/urllib3/contrib/socks.py,sha256=aRi9eWXo9ZEb95XUxef4Z21CFlnnjbEiAo9HOseoMt4,7097 +pip/_vendor/urllib3/exceptions.py,sha256=0Mnno3KHTNfXRfY7638NufOPkUb6mXOm-Lqj-4x2w8A,8217 +pip/_vendor/urllib3/fields.py,sha256=kvLDCg_JmH1lLjUUEY_FLS8UhY7hBvDPuVETbY8mdrM,8579 +pip/_vendor/urllib3/filepost.py,sha256=5b_qqgRHVlL7uLtdAYBzBh-GHmU5AfJVt_2N0XS3PeY,2440 +pip/_vendor/urllib3/packages/__init__.py,sha256=h4BLhD4tLaBx1adaDtKXfupsgqY0wWLXb_f1_yVlV6A,108 +pip/_vendor/urllib3/packages/__pycache__/__init__.cpython-39.pyc,, +pip/_vendor/urllib3/packages/__pycache__/six.cpython-39.pyc,, +pip/_vendor/urllib3/packages/backports/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +pip/_vendor/urllib3/packages/backports/__pycache__/__init__.cpython-39.pyc,, +pip/_vendor/urllib3/packages/backports/__pycache__/makefile.cpython-39.pyc,, +pip/_vendor/urllib3/packages/backports/makefile.py,sha256=nbzt3i0agPVP07jqqgjhaYjMmuAi_W5E0EywZivVO8E,1417 +pip/_vendor/urllib3/packages/six.py,sha256=1LVW7ljqRirFlfExjwl-v1B7vSAUNTmzGMs-qays2zg,34666 +pip/_vendor/urllib3/packages/ssl_match_hostname/__init__.py,sha256=ZVMwCkHx-py8ERsxxM3Il-MiREZktV-8iLBmCfRRHI4,927 +pip/_vendor/urllib3/packages/ssl_match_hostname/__pycache__/__init__.cpython-39.pyc,, +pip/_vendor/urllib3/packages/ssl_match_hostname/__pycache__/_implementation.cpython-39.pyc,, +pip/_vendor/urllib3/packages/ssl_match_hostname/_implementation.py,sha256=6dZ-q074g7XhsJ27MFCgkct8iVNZB3sMZvKhf-KUVy0,5679 +pip/_vendor/urllib3/poolmanager.py,sha256=whzlX6UTEgODMOCy0ZDMUONRBCz5wyIM8Z9opXAY-Lk,19763 +pip/_vendor/urllib3/request.py,sha256=ZFSIqX0C6WizixecChZ3_okyu7BEv0lZu1VT0s6h4SM,5985 +pip/_vendor/urllib3/response.py,sha256=hGhGBh7TkEkh_IQg5C1W_xuPNrgIKv5BUXPyE-q0LuE,28203 +pip/_vendor/urllib3/util/__init__.py,sha256=JEmSmmqqLyaw8P51gUImZh8Gwg9i1zSe-DoqAitn2nc,1155 +pip/_vendor/urllib3/util/__pycache__/__init__.cpython-39.pyc,, +pip/_vendor/urllib3/util/__pycache__/connection.cpython-39.pyc,, +pip/_vendor/urllib3/util/__pycache__/proxy.cpython-39.pyc,, +pip/_vendor/urllib3/util/__pycache__/queue.cpython-39.pyc,, +pip/_vendor/urllib3/util/__pycache__/request.cpython-39.pyc,, +pip/_vendor/urllib3/util/__pycache__/response.cpython-39.pyc,, +pip/_vendor/urllib3/util/__pycache__/retry.cpython-39.pyc,, +pip/_vendor/urllib3/util/__pycache__/ssl_.cpython-39.pyc,, +pip/_vendor/urllib3/util/__pycache__/ssltransport.cpython-39.pyc,, +pip/_vendor/urllib3/util/__pycache__/timeout.cpython-39.pyc,, +pip/_vendor/urllib3/util/__pycache__/url.cpython-39.pyc,, +pip/_vendor/urllib3/util/__pycache__/wait.cpython-39.pyc,, +pip/_vendor/urllib3/util/connection.py,sha256=KykjNIXzUZEzeKEOpl5xvKs6IsESXP9o9eTrjE0W_Ys,4920 +pip/_vendor/urllib3/util/proxy.py,sha256=FGipAEnvZteyldXNjce4DEB7YzwU-a5lep8y5S0qHQg,1604 +pip/_vendor/urllib3/util/queue.py,sha256=nRgX8_eX-_VkvxoX096QWoz8Ps0QHUAExILCY_7PncM,498 +pip/_vendor/urllib3/util/request.py,sha256=NnzaEKQ1Pauw5MFMV6HmgEMHITf0Aua9fQuzi2uZzGc,4123 +pip/_vendor/urllib3/util/response.py,sha256=GJpg3Egi9qaJXRwBh5wv-MNuRWan5BIu40oReoxWP28,3510 +pip/_vendor/urllib3/util/retry.py,sha256=tOWfZpLsuc7Vbk5nWpMwkHdMoXCp90IAvH4xtjSDRqQ,21391 +pip/_vendor/urllib3/util/ssl_.py,sha256=X4-AqW91aYPhPx6-xbf66yHFQKbqqfC_5Zt4WkLX1Hc,17177 +pip/_vendor/urllib3/util/ssltransport.py,sha256=F_UncOXGcc-MgeWFTA1H4QCt_RRNQXRbF6onje3SyHY,6931 +pip/_vendor/urllib3/util/timeout.py,sha256=QSbBUNOB9yh6AnDn61SrLQ0hg5oz0I9-uXEG91AJuIg,10003 +pip/_vendor/urllib3/util/url.py,sha256=QVEzcbHipbXyCWwH6R4K4TR-N8T4LM55WEMwNUTBmLE,14047 +pip/_vendor/urllib3/util/wait.py,sha256=3MUKRSAUJDB2tgco7qRUskW0zXGAWYvRRE4Q1_6xlLs,5404 +pip/_vendor/vendor.txt,sha256=GuFhR0DHZazrSYZyoY7j3X3T_mGJh-ky2opcZ-A7ezo,364 +pip/_vendor/webencodings/__init__.py,sha256=qOBJIuPy_4ByYH6W_bNgJF-qYQ2DoU-dKsDu5yRWCXg,10579 +pip/_vendor/webencodings/__pycache__/__init__.cpython-39.pyc,, +pip/_vendor/webencodings/__pycache__/labels.cpython-39.pyc,, +pip/_vendor/webencodings/__pycache__/mklabels.cpython-39.pyc,, +pip/_vendor/webencodings/__pycache__/tests.cpython-39.pyc,, +pip/_vendor/webencodings/__pycache__/x_user_defined.cpython-39.pyc,, +pip/_vendor/webencodings/labels.py,sha256=4AO_KxTddqGtrL9ns7kAPjb0CcN6xsCIxbK37HY9r3E,8979 +pip/_vendor/webencodings/mklabels.py,sha256=GYIeywnpaLnP0GSic8LFWgd0UVvO_l1Nc6YoF-87R_4,1305 +pip/_vendor/webencodings/tests.py,sha256=OtGLyjhNY1fvkW1GvLJ_FV9ZoqC9Anyjr7q3kxTbzNs,6563 +pip/_vendor/webencodings/x_user_defined.py,sha256=yOqWSdmpytGfUgh_Z6JYgDNhoc-BAHyyeeT15Fr42tM,4307 +pip/py.typed,sha256=EBVvvPRTn_eIpz5e5QztSCdrMX7Qwd7VP93RSoIlZ2I,286 diff --git a/.venv/lib/python3.9/site-packages/pip-21.2.3.dist-info/REQUESTED b/.venv/lib/python3.9/site-packages/pip-21.2.4.dist-info/REQUESTED similarity index 100% rename from .venv/lib/python3.9/site-packages/pip-21.2.3.dist-info/REQUESTED rename to .venv/lib/python3.9/site-packages/pip-21.2.4.dist-info/REQUESTED diff --git a/.venv/lib/python3.9/site-packages/pip-21.2.3.dist-info/WHEEL b/.venv/lib/python3.9/site-packages/pip-21.2.4.dist-info/WHEEL similarity index 100% rename from .venv/lib/python3.9/site-packages/pip-21.2.3.dist-info/WHEEL rename to .venv/lib/python3.9/site-packages/pip-21.2.4.dist-info/WHEEL diff --git a/.venv/lib/python3.9/site-packages/pip-21.2.3.dist-info/entry_points.txt b/.venv/lib/python3.9/site-packages/pip-21.2.4.dist-info/entry_points.txt similarity index 70% rename from .venv/lib/python3.9/site-packages/pip-21.2.3.dist-info/entry_points.txt rename to .venv/lib/python3.9/site-packages/pip-21.2.4.dist-info/entry_points.txt index d48bd8a8..9609f72c 100644 --- a/.venv/lib/python3.9/site-packages/pip-21.2.3.dist-info/entry_points.txt +++ b/.venv/lib/python3.9/site-packages/pip-21.2.4.dist-info/entry_points.txt @@ -1,5 +1,5 @@ [console_scripts] pip = pip._internal.cli.main:main pip3 = pip._internal.cli.main:main -pip3.8 = pip._internal.cli.main:main +pip3.9 = pip._internal.cli.main:main diff --git a/.venv/lib/python3.9/site-packages/pip-21.2.3.dist-info/top_level.txt b/.venv/lib/python3.9/site-packages/pip-21.2.4.dist-info/top_level.txt similarity index 100% rename from .venv/lib/python3.9/site-packages/pip-21.2.3.dist-info/top_level.txt rename to .venv/lib/python3.9/site-packages/pip-21.2.4.dist-info/top_level.txt diff --git a/.venv/lib/python3.9/site-packages/pip/__init__.py b/.venv/lib/python3.9/site-packages/pip/__init__.py index 3d8dd5c7..d6b05fef 100644 --- a/.venv/lib/python3.9/site-packages/pip/__init__.py +++ b/.venv/lib/python3.9/site-packages/pip/__init__.py @@ -1,6 +1,6 @@ from typing import List, Optional -__version__ = "21.2.3" +__version__ = "21.2.4" def main(args: Optional[List[str]] = None) -> int: diff --git a/.venv/lib/python3.9/site-packages/pip/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/__pycache__/__init__.cpython-39.pyc index 5f2ce7e2..97012c17 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/__pycache__/__main__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/__pycache__/__main__.cpython-39.pyc index 69ddf081..81dd19c4 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/__pycache__/__main__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/__pycache__/__main__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/__pycache__/__init__.cpython-39.pyc index 8492ad41..962ef4be 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/__pycache__/build_env.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/__pycache__/build_env.cpython-39.pyc index a7371222..7bb69c39 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/__pycache__/build_env.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/__pycache__/build_env.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/__pycache__/cache.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/__pycache__/cache.cpython-39.pyc index a09af431..8d2c2f33 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/__pycache__/cache.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/__pycache__/cache.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/__pycache__/configuration.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/__pycache__/configuration.cpython-39.pyc index 24ba54ca..74c65446 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/__pycache__/configuration.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/__pycache__/configuration.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/__pycache__/exceptions.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/__pycache__/exceptions.cpython-39.pyc index abe8f361..c052c277 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/__pycache__/exceptions.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/__pycache__/exceptions.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/__pycache__/main.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/__pycache__/main.cpython-39.pyc index 44be44fe..f6a0459b 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/__pycache__/main.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/__pycache__/main.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/__pycache__/pyproject.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/__pycache__/pyproject.cpython-39.pyc index 7bfb7a0d..1fd2de92 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/__pycache__/pyproject.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/__pycache__/pyproject.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/__pycache__/self_outdated_check.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/__pycache__/self_outdated_check.cpython-39.pyc index acbcf04b..fddb4494 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/__pycache__/self_outdated_check.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/__pycache__/self_outdated_check.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/__pycache__/wheel_builder.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/__pycache__/wheel_builder.cpython-39.pyc index 464886ec..206fa49e 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/__pycache__/wheel_builder.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/__pycache__/wheel_builder.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/__init__.cpython-39.pyc index 49200c61..dc6ad656 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/autocompletion.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/autocompletion.cpython-39.pyc index 575823dc..d4205076 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/autocompletion.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/autocompletion.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/base_command.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/base_command.cpython-39.pyc index d586b4d9..2ce55392 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/base_command.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/base_command.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/cmdoptions.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/cmdoptions.cpython-39.pyc index e50738ba..30a52827 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/cmdoptions.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/cmdoptions.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/command_context.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/command_context.cpython-39.pyc index eefcd795..912693e9 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/command_context.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/command_context.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/main.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/main.cpython-39.pyc index 36b0c567..76d236e5 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/main.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/main.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/main_parser.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/main_parser.cpython-39.pyc index 0bdbe9fd..adf371a8 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/main_parser.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/main_parser.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/parser.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/parser.cpython-39.pyc index 0629991e..75441ccc 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/parser.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/parser.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/progress_bars.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/progress_bars.cpython-39.pyc index cffb1214..90c73886 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/progress_bars.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/progress_bars.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/req_command.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/req_command.cpython-39.pyc index 87da7deb..eb5c02af 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/req_command.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/req_command.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/spinners.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/spinners.cpython-39.pyc index e368d412..8b0e3613 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/spinners.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/spinners.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/status_codes.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/status_codes.cpython-39.pyc index 93b033f2..a1083fc7 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/status_codes.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/status_codes.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/__init__.cpython-39.pyc index cc4cc678..a68dedcd 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/cache.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/cache.cpython-39.pyc index 17d2dc5c..9acae36e 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/cache.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/cache.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/check.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/check.cpython-39.pyc index 01abcb86..1c49d85e 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/check.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/check.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/completion.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/completion.cpython-39.pyc index 7becf000..2d262b33 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/completion.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/completion.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/configuration.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/configuration.cpython-39.pyc index d0d1c511..8584f135 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/configuration.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/configuration.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/debug.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/debug.cpython-39.pyc index 5281dcb3..88b18cfc 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/debug.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/debug.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/download.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/download.cpython-39.pyc index 1b1d98e0..da00c246 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/download.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/download.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/freeze.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/freeze.cpython-39.pyc index ebf41832..5b299776 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/freeze.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/freeze.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/hash.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/hash.cpython-39.pyc index 7de923aa..a5c4074a 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/hash.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/hash.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/help.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/help.cpython-39.pyc index 9bc4b20a..1d1eb654 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/help.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/help.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/index.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/index.cpython-39.pyc index 5f0b207d..ebf96c0b 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/index.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/index.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/install.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/install.cpython-39.pyc index 330d0620..18a8fb7b 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/install.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/install.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/list.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/list.cpython-39.pyc index 57d89007..242ddcd4 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/list.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/list.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/search.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/search.cpython-39.pyc index 702d2b85..6f5e4e68 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/search.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/search.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/show.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/show.cpython-39.pyc index 2efc9ed4..8156aa81 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/show.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/show.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/uninstall.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/uninstall.cpython-39.pyc index a3be680b..0ef7d39c 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/uninstall.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/uninstall.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/wheel.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/wheel.cpython-39.pyc index f9a38e23..a3b55609 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/wheel.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/wheel.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/distributions/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/distributions/__pycache__/__init__.cpython-39.pyc index c21233f3..ca93d12b 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/distributions/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/distributions/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/distributions/__pycache__/base.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/distributions/__pycache__/base.cpython-39.pyc index 13571bb3..10b78ca5 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/distributions/__pycache__/base.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/distributions/__pycache__/base.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/distributions/__pycache__/installed.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/distributions/__pycache__/installed.cpython-39.pyc index 5bd0399c..119bade7 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/distributions/__pycache__/installed.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/distributions/__pycache__/installed.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/distributions/__pycache__/sdist.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/distributions/__pycache__/sdist.cpython-39.pyc index 6567c0a2..aa17299f 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/distributions/__pycache__/sdist.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/distributions/__pycache__/sdist.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/distributions/__pycache__/wheel.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/distributions/__pycache__/wheel.cpython-39.pyc index 786390fb..061cce8f 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/distributions/__pycache__/wheel.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/distributions/__pycache__/wheel.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/index/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/index/__pycache__/__init__.cpython-39.pyc index 66a2b68c..370de00c 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/index/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/index/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/index/__pycache__/collector.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/index/__pycache__/collector.cpython-39.pyc index cfbcebdd..3fe05f98 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/index/__pycache__/collector.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/index/__pycache__/collector.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/index/__pycache__/package_finder.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/index/__pycache__/package_finder.cpython-39.pyc index c9caf98f..269ed963 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/index/__pycache__/package_finder.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/index/__pycache__/package_finder.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/index/__pycache__/sources.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/index/__pycache__/sources.cpython-39.pyc index 7da03a50..7bcc6676 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/index/__pycache__/sources.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/index/__pycache__/sources.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/locations/__init__.py b/.venv/lib/python3.9/site-packages/pip/_internal/locations/__init__.py index 0d49cf23..2c2fd860 100644 --- a/.venv/lib/python3.9/site-packages/pip/_internal/locations/__init__.py +++ b/.venv/lib/python3.9/site-packages/pip/_internal/locations/__init__.py @@ -43,6 +43,22 @@ if os.environ.get("_PIP_LOCATIONS_NO_WARN_ON_MISMATCH"): else: _MISMATCH_LEVEL = logging.WARNING +_PLATLIBDIR: str = getattr(sys, "platlibdir", "lib") + + +def _looks_like_bpo_44860() -> bool: + """The resolution to bpo-44860 will change this incorrect platlib. + + See . + """ + from distutils.command.install import INSTALL_SCHEMES # type: ignore + + try: + unix_user_platlib = INSTALL_SCHEMES["unix_user"]["platlib"] + except KeyError: + return False + return unix_user_platlib == "$usersite" + def _looks_like_red_hat_patched_platlib_purelib(scheme: Dict[str, str]) -> bool: platlib = scheme["platlib"] @@ -95,6 +111,24 @@ def _looks_like_red_hat_scheme() -> bool: ) +@functools.lru_cache(maxsize=None) +def _looks_like_msys2_mingw_scheme() -> bool: + """MSYS2 patches distutils and sysconfig to use a UNIX-like scheme. + + However, MSYS2 incorrectly patches sysconfig ``nt`` scheme. The fix is + likely going to be included in their 3.10 release, so we ignore the warning. + See msys2/MINGW-packages#9319. + + MSYS2 MINGW's patch uses lowercase ``"lib"`` instead of the usual uppercase, + and is missing the final ``"site-packages"``. + """ + paths = sysconfig.get_paths("nt", expand=False) + return all( + "Lib" not in p and "lib" in p and not p.endswith("site-packages") + for p in (paths[key] for key in ("platlib", "purelib")) + ) + + def _fix_abiflags(parts: Tuple[str]) -> Iterator[str]: ldversion = sysconfig.get_config_var("LDVERSION") abiflags: str = getattr(sys, "abiflags", None) @@ -214,6 +248,21 @@ def get_scheme( if k == "platlib" and _looks_like_red_hat_lib(): continue + # On Python 3.9+, sysconfig's posix_user scheme sets platlib against + # sys.platlibdir, but distutils's unix_user incorrectly coninutes + # using the same $usersite for both platlib and purelib. This creates a + # mismatch when sys.platlibdir is not "lib". + skip_bpo_44860 = ( + user + and k == "platlib" + and not WINDOWS + and sys.version_info >= (3, 9) + and _PLATLIBDIR != "lib" + and _looks_like_bpo_44860() + ) + if skip_bpo_44860: + continue + # Both Debian and Red Hat patch Python to place the system site under # /usr/local instead of /usr. Debian also places lib in dist-packages # instead of site-packages, but the /usr/local check should cover it. @@ -239,6 +288,14 @@ def get_scheme( if skip_sysconfig_abiflag_bug: continue + # MSYS2 MINGW's sysconfig patch does not include the "site-packages" + # part of the path. This is incorrect and will be fixed in MSYS. + skip_msys2_mingw_bug = ( + WINDOWS and k in ("platlib", "purelib") and _looks_like_msys2_mingw_scheme() + ) + if skip_msys2_mingw_bug: + continue + warning_contexts.append((old_v, new_v, f"scheme.{k}")) if not warning_contexts: diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/locations/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/locations/__pycache__/__init__.cpython-39.pyc index d9a76057..adcd1489 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/locations/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/locations/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/locations/__pycache__/_distutils.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/locations/__pycache__/_distutils.cpython-39.pyc index bf202745..dca4d92e 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/locations/__pycache__/_distutils.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/locations/__pycache__/_distutils.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/locations/__pycache__/_sysconfig.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/locations/__pycache__/_sysconfig.cpython-39.pyc index 7684ecce..c11a68ff 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/locations/__pycache__/_sysconfig.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/locations/__pycache__/_sysconfig.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/locations/__pycache__/base.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/locations/__pycache__/base.cpython-39.pyc index 59717135..d80f94bc 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/locations/__pycache__/base.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/locations/__pycache__/base.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/metadata/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/metadata/__pycache__/__init__.cpython-39.pyc index 3babb0ce..bc0a5cd7 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/metadata/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/metadata/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/metadata/__pycache__/base.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/metadata/__pycache__/base.cpython-39.pyc index 143afa4e..b0585a2e 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/metadata/__pycache__/base.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/metadata/__pycache__/base.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/metadata/__pycache__/pkg_resources.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/metadata/__pycache__/pkg_resources.cpython-39.pyc index b29a7c58..75465aa9 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/metadata/__pycache__/pkg_resources.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/metadata/__pycache__/pkg_resources.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/models/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/models/__pycache__/__init__.cpython-39.pyc index fb9a339f..21cb54ff 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/models/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/models/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/models/__pycache__/candidate.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/models/__pycache__/candidate.cpython-39.pyc index 618e24b5..8ceda753 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/models/__pycache__/candidate.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/models/__pycache__/candidate.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/models/__pycache__/direct_url.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/models/__pycache__/direct_url.cpython-39.pyc index 1568b003..ece480c2 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/models/__pycache__/direct_url.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/models/__pycache__/direct_url.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/models/__pycache__/format_control.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/models/__pycache__/format_control.cpython-39.pyc index a4513941..3cdcd4f3 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/models/__pycache__/format_control.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/models/__pycache__/format_control.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/models/__pycache__/index.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/models/__pycache__/index.cpython-39.pyc index c1e2664f..aa17d457 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/models/__pycache__/index.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/models/__pycache__/index.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/models/__pycache__/link.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/models/__pycache__/link.cpython-39.pyc index 9e66bfb5..0bb382c1 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/models/__pycache__/link.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/models/__pycache__/link.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/models/__pycache__/scheme.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/models/__pycache__/scheme.cpython-39.pyc index 1f8925a4..174c2b86 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/models/__pycache__/scheme.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/models/__pycache__/scheme.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/models/__pycache__/search_scope.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/models/__pycache__/search_scope.cpython-39.pyc index c355ffe7..3d3cf503 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/models/__pycache__/search_scope.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/models/__pycache__/search_scope.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/models/__pycache__/selection_prefs.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/models/__pycache__/selection_prefs.cpython-39.pyc index 509a6494..873f0336 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/models/__pycache__/selection_prefs.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/models/__pycache__/selection_prefs.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/models/__pycache__/target_python.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/models/__pycache__/target_python.cpython-39.pyc index a06f6506..0ed7e686 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/models/__pycache__/target_python.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/models/__pycache__/target_python.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/models/__pycache__/wheel.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/models/__pycache__/wheel.cpython-39.pyc index a4e9c88c..5fc2c96a 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/models/__pycache__/wheel.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/models/__pycache__/wheel.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/models/link.py b/.venv/lib/python3.9/site-packages/pip/_internal/models/link.py index eb656fa0..9ef1ca36 100644 --- a/.venv/lib/python3.9/site-packages/pip/_internal/models/link.py +++ b/.venv/lib/python3.9/site-packages/pip/_internal/models/link.py @@ -256,33 +256,33 @@ class _CleanResult(NamedTuple): subdirectory: str hashes: Dict[str, str] - @classmethod - def from_link(cls, link: Link) -> "_CleanResult": - parsed = link._parsed_url - netloc = parsed.netloc.rsplit("@", 1)[-1] - # According to RFC 8089, an empty host in file: means localhost. - if parsed.scheme == "file" and not netloc: - netloc = "localhost" - fragment = urllib.parse.parse_qs(parsed.fragment) - if "egg" in fragment: - logger.debug("Ignoring egg= fragment in %s", link) - try: - # If there are multiple subdirectory values, use the first one. - # This matches the behavior of Link.subdirectory_fragment. - subdirectory = fragment["subdirectory"][0] - except (IndexError, KeyError): - subdirectory = "" - # If there are multiple hash values under the same algorithm, use the - # first one. This matches the behavior of Link.hash_value. - hashes = {k: fragment[k][0] for k in _SUPPORTED_HASHES if k in fragment} - return cls( - parsed=parsed._replace(netloc=netloc, query="", fragment=""), - query=urllib.parse.parse_qs(parsed.query), - subdirectory=subdirectory, - hashes=hashes, - ) + +def _clean_link(link: Link) -> _CleanResult: + parsed = link._parsed_url + netloc = parsed.netloc.rsplit("@", 1)[-1] + # According to RFC 8089, an empty host in file: means localhost. + if parsed.scheme == "file" and not netloc: + netloc = "localhost" + fragment = urllib.parse.parse_qs(parsed.fragment) + if "egg" in fragment: + logger.debug("Ignoring egg= fragment in %s", link) + try: + # If there are multiple subdirectory values, use the first one. + # This matches the behavior of Link.subdirectory_fragment. + subdirectory = fragment["subdirectory"][0] + except (IndexError, KeyError): + subdirectory = "" + # If there are multiple hash values under the same algorithm, use the + # first one. This matches the behavior of Link.hash_value. + hashes = {k: fragment[k][0] for k in _SUPPORTED_HASHES if k in fragment} + return _CleanResult( + parsed=parsed._replace(netloc=netloc, query="", fragment=""), + query=urllib.parse.parse_qs(parsed.query), + subdirectory=subdirectory, + hashes=hashes, + ) @functools.lru_cache(maxsize=None) def links_equivalent(link1: Link, link2: Link) -> bool: - return _CleanResult.from_link(link1) == _CleanResult.from_link(link2) + return _clean_link(link1) == _clean_link(link2) diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/network/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/network/__pycache__/__init__.cpython-39.pyc index 2a954dd1..29ba1e77 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/network/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/network/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/network/__pycache__/auth.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/network/__pycache__/auth.cpython-39.pyc index 7ac6bdf4..0cabf3aa 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/network/__pycache__/auth.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/network/__pycache__/auth.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/network/__pycache__/cache.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/network/__pycache__/cache.cpython-39.pyc index c1a559e7..02b71ae1 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/network/__pycache__/cache.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/network/__pycache__/cache.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/network/__pycache__/download.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/network/__pycache__/download.cpython-39.pyc index 589d440e..a25dd509 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/network/__pycache__/download.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/network/__pycache__/download.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/network/__pycache__/lazy_wheel.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/network/__pycache__/lazy_wheel.cpython-39.pyc index b7fdc2b7..76ab461e 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/network/__pycache__/lazy_wheel.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/network/__pycache__/lazy_wheel.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/network/__pycache__/session.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/network/__pycache__/session.cpython-39.pyc index 0e9c50e1..a83b1edd 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/network/__pycache__/session.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/network/__pycache__/session.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/network/__pycache__/utils.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/network/__pycache__/utils.cpython-39.pyc index a9a7be67..68b8eafd 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/network/__pycache__/utils.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/network/__pycache__/utils.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/network/__pycache__/xmlrpc.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/network/__pycache__/xmlrpc.cpython-39.pyc index 9e449f89..fc082c21 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/network/__pycache__/xmlrpc.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/network/__pycache__/xmlrpc.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/operations/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/operations/__pycache__/__init__.cpython-39.pyc index fa166c05..b32f6514 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/operations/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/operations/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/operations/__pycache__/check.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/operations/__pycache__/check.cpython-39.pyc index 049c4ce2..e3a6d9a2 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/operations/__pycache__/check.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/operations/__pycache__/check.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/operations/__pycache__/freeze.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/operations/__pycache__/freeze.cpython-39.pyc index 5edde33b..1919c361 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/operations/__pycache__/freeze.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/operations/__pycache__/freeze.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/operations/__pycache__/prepare.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/operations/__pycache__/prepare.cpython-39.pyc index 79017859..5ddb5ad9 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/operations/__pycache__/prepare.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/operations/__pycache__/prepare.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/operations/build/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/operations/build/__pycache__/__init__.cpython-39.pyc index 49649ec8..16a57668 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/operations/build/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/operations/build/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/operations/build/__pycache__/metadata.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/operations/build/__pycache__/metadata.cpython-39.pyc index e3cf218c..cee60511 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/operations/build/__pycache__/metadata.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/operations/build/__pycache__/metadata.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/operations/build/__pycache__/metadata_legacy.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/operations/build/__pycache__/metadata_legacy.cpython-39.pyc index 14d4a907..358ff263 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/operations/build/__pycache__/metadata_legacy.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/operations/build/__pycache__/metadata_legacy.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/operations/build/__pycache__/wheel.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/operations/build/__pycache__/wheel.cpython-39.pyc index 9c65e38f..c0835f2a 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/operations/build/__pycache__/wheel.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/operations/build/__pycache__/wheel.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/operations/build/__pycache__/wheel_legacy.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/operations/build/__pycache__/wheel_legacy.cpython-39.pyc index eafa0b00..8898606a 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/operations/build/__pycache__/wheel_legacy.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/operations/build/__pycache__/wheel_legacy.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/operations/install/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/operations/install/__pycache__/__init__.cpython-39.pyc index 9826d13d..7c8638ce 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/operations/install/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/operations/install/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/operations/install/__pycache__/editable_legacy.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/operations/install/__pycache__/editable_legacy.cpython-39.pyc index b0085655..204859ac 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/operations/install/__pycache__/editable_legacy.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/operations/install/__pycache__/editable_legacy.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/operations/install/__pycache__/legacy.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/operations/install/__pycache__/legacy.cpython-39.pyc index cf6d9112..f84c56e9 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/operations/install/__pycache__/legacy.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/operations/install/__pycache__/legacy.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/operations/install/__pycache__/wheel.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/operations/install/__pycache__/wheel.cpython-39.pyc index d4f3d9ff..9cc1f5f7 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/operations/install/__pycache__/wheel.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/operations/install/__pycache__/wheel.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/req/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/req/__pycache__/__init__.cpython-39.pyc index ab9cf044..42d541de 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/req/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/req/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/req/__pycache__/constructors.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/req/__pycache__/constructors.cpython-39.pyc index 6aeddc5f..b32f82c0 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/req/__pycache__/constructors.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/req/__pycache__/constructors.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/req/__pycache__/req_file.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/req/__pycache__/req_file.cpython-39.pyc index 7443ef65..b2dacf1c 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/req/__pycache__/req_file.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/req/__pycache__/req_file.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/req/__pycache__/req_install.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/req/__pycache__/req_install.cpython-39.pyc index ac2e0c4f..6f7893ea 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/req/__pycache__/req_install.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/req/__pycache__/req_install.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/req/__pycache__/req_set.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/req/__pycache__/req_set.cpython-39.pyc index b8128f63..8daeff7b 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/req/__pycache__/req_set.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/req/__pycache__/req_set.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/req/__pycache__/req_tracker.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/req/__pycache__/req_tracker.cpython-39.pyc index ab15e50d..c445920c 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/req/__pycache__/req_tracker.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/req/__pycache__/req_tracker.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/req/__pycache__/req_uninstall.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/req/__pycache__/req_uninstall.cpython-39.pyc index 7c766d37..f57e22a4 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/req/__pycache__/req_uninstall.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/req/__pycache__/req_uninstall.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/resolution/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/resolution/__pycache__/__init__.cpython-39.pyc index 6b432d25..3f1e4a4c 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/resolution/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/resolution/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/resolution/__pycache__/base.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/resolution/__pycache__/base.cpython-39.pyc index e057f432..b890e699 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/resolution/__pycache__/base.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/resolution/__pycache__/base.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/resolution/legacy/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/resolution/legacy/__pycache__/__init__.cpython-39.pyc index a641d0a8..4314e4aa 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/resolution/legacy/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/resolution/legacy/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/resolution/legacy/__pycache__/resolver.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/resolution/legacy/__pycache__/resolver.cpython-39.pyc index ab022974..f9543245 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/resolution/legacy/__pycache__/resolver.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/resolution/legacy/__pycache__/resolver.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/__init__.cpython-39.pyc index b2c62adf..735d6c4b 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/base.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/base.cpython-39.pyc index 18d1e4e7..9e6c5c27 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/base.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/base.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/candidates.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/candidates.cpython-39.pyc index ccfaffab..006cfd44 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/candidates.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/candidates.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/factory.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/factory.cpython-39.pyc index a08a791e..934d7c41 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/factory.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/factory.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/found_candidates.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/found_candidates.cpython-39.pyc index c1921605..9ab3e0be 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/found_candidates.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/found_candidates.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/provider.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/provider.cpython-39.pyc index a0385954..cdd4a1ec 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/provider.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/provider.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/reporter.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/reporter.cpython-39.pyc index c10c1702..f1c08086 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/reporter.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/reporter.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/requirements.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/requirements.cpython-39.pyc index 1333bab5..0f7d9129 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/requirements.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/requirements.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/resolver.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/resolver.cpython-39.pyc index 3f64f616..63bbf3f7 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/resolver.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/resolver.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/__init__.cpython-39.pyc index e38f4e6f..abc4386a 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/_log.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/_log.cpython-39.pyc index 0252aa53..be3f42d1 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/_log.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/_log.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/appdirs.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/appdirs.cpython-39.pyc index ee174d2e..44637dc3 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/appdirs.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/appdirs.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/compat.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/compat.cpython-39.pyc index d80e6102..152a0070 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/compat.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/compat.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/compatibility_tags.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/compatibility_tags.cpython-39.pyc index dd032b81..b84e5edd 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/compatibility_tags.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/compatibility_tags.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/datetime.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/datetime.cpython-39.pyc index 7ea7ba43..23e690ac 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/datetime.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/datetime.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/deprecation.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/deprecation.cpython-39.pyc index 54a551aa..0582d63d 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/deprecation.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/deprecation.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/direct_url_helpers.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/direct_url_helpers.cpython-39.pyc index fb3ad032..1e7d2857 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/direct_url_helpers.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/direct_url_helpers.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/distutils_args.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/distutils_args.cpython-39.pyc index 630e50dd..5b39a165 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/distutils_args.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/distutils_args.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/encoding.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/encoding.cpython-39.pyc index 36548eee..ca029ebd 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/encoding.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/encoding.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/entrypoints.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/entrypoints.cpython-39.pyc index 806ac51a..d9ef9e1d 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/entrypoints.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/entrypoints.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/filesystem.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/filesystem.cpython-39.pyc index 41e793f1..724a2466 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/filesystem.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/filesystem.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/filetypes.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/filetypes.cpython-39.pyc index 1dddbb7e..0c9a3082 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/filetypes.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/filetypes.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/glibc.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/glibc.cpython-39.pyc index 94bcf11a..c4937b6e 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/glibc.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/glibc.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/hashes.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/hashes.cpython-39.pyc index b4d4245d..8ab83e2b 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/hashes.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/hashes.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/inject_securetransport.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/inject_securetransport.cpython-39.pyc index 3564e9cb..0ae04d51 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/inject_securetransport.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/inject_securetransport.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/logging.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/logging.cpython-39.pyc index c4d51352..db91373e 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/logging.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/logging.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/misc.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/misc.cpython-39.pyc index 1079dc1b..b000b571 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/misc.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/misc.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/models.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/models.cpython-39.pyc index b09df2a9..53667b93 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/models.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/models.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/packaging.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/packaging.cpython-39.pyc index 293f5089..99cda5f8 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/packaging.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/packaging.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/parallel.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/parallel.cpython-39.pyc index b8ac2bcc..3bcc8aeb 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/parallel.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/parallel.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/pkg_resources.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/pkg_resources.cpython-39.pyc index 9956348d..8c62287d 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/pkg_resources.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/pkg_resources.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/setuptools_build.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/setuptools_build.cpython-39.pyc index 761db6ba..07150e84 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/setuptools_build.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/setuptools_build.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/subprocess.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/subprocess.cpython-39.pyc index c25558c0..65794c68 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/subprocess.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/subprocess.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/temp_dir.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/temp_dir.cpython-39.pyc index be1f9f2a..779db338 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/temp_dir.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/temp_dir.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/unpacking.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/unpacking.cpython-39.pyc index 643f1261..97f93313 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/unpacking.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/unpacking.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/urls.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/urls.cpython-39.pyc index 69faca41..95153b3b 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/urls.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/urls.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/virtualenv.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/virtualenv.cpython-39.pyc index 5ba9e0bf..b2eea848 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/virtualenv.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/virtualenv.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/wheel.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/wheel.cpython-39.pyc index 8bf6b580..bce0897f 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/wheel.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/wheel.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/vcs/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/vcs/__pycache__/__init__.cpython-39.pyc index ff37038a..f57c67b9 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/vcs/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/vcs/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/vcs/__pycache__/bazaar.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/vcs/__pycache__/bazaar.cpython-39.pyc index d955cadf..8c8c9bd0 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/vcs/__pycache__/bazaar.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/vcs/__pycache__/bazaar.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/vcs/__pycache__/git.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/vcs/__pycache__/git.cpython-39.pyc index 2188f492..594284b8 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/vcs/__pycache__/git.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/vcs/__pycache__/git.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/vcs/__pycache__/mercurial.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/vcs/__pycache__/mercurial.cpython-39.pyc index ed97e8eb..7aa82d33 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/vcs/__pycache__/mercurial.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/vcs/__pycache__/mercurial.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/vcs/__pycache__/subversion.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/vcs/__pycache__/subversion.cpython-39.pyc index 33538ebe..c173a5d5 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/vcs/__pycache__/subversion.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/vcs/__pycache__/subversion.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_internal/vcs/__pycache__/versioncontrol.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_internal/vcs/__pycache__/versioncontrol.cpython-39.pyc index cdba344f..de2655e2 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_internal/vcs/__pycache__/versioncontrol.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_internal/vcs/__pycache__/versioncontrol.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/__pycache__/__init__.cpython-39.pyc index 4bbad5e1..ea4fb7e8 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/__pycache__/appdirs.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/__pycache__/appdirs.cpython-39.pyc index e1732617..2771404c 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/__pycache__/appdirs.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/__pycache__/appdirs.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/__pycache__/distro.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/__pycache__/distro.cpython-39.pyc index b5b70b57..99d3411c 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/__pycache__/distro.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/__pycache__/distro.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/__pycache__/pyparsing.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/__pycache__/pyparsing.cpython-39.pyc index f03a243a..fb4f73cc 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/__pycache__/pyparsing.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/__pycache__/pyparsing.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/__pycache__/six.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/__pycache__/six.cpython-39.pyc index dc426694..ada25d3d 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/__pycache__/six.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/__pycache__/six.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/__pycache__/__init__.cpython-39.pyc index 90aac300..41b26864 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/__pycache__/_cmd.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/__pycache__/_cmd.cpython-39.pyc index 2f6aa08a..520a23b9 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/__pycache__/_cmd.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/__pycache__/_cmd.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/__pycache__/adapter.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/__pycache__/adapter.cpython-39.pyc index f7044199..489ee8ee 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/__pycache__/adapter.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/__pycache__/adapter.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/__pycache__/cache.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/__pycache__/cache.cpython-39.pyc index a857ba92..b906ce20 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/__pycache__/cache.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/__pycache__/cache.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/__pycache__/compat.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/__pycache__/compat.cpython-39.pyc index 93ac5837..60b2b433 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/__pycache__/compat.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/__pycache__/compat.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/__pycache__/controller.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/__pycache__/controller.cpython-39.pyc index d436378c..3d7d8df1 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/__pycache__/controller.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/__pycache__/controller.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/__pycache__/filewrapper.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/__pycache__/filewrapper.cpython-39.pyc index f49758f9..49e86ed8 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/__pycache__/filewrapper.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/__pycache__/filewrapper.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/__pycache__/heuristics.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/__pycache__/heuristics.cpython-39.pyc index c3c39124..96a567fd 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/__pycache__/heuristics.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/__pycache__/heuristics.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/__pycache__/serialize.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/__pycache__/serialize.cpython-39.pyc index 55348bfb..ed57c8f2 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/__pycache__/serialize.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/__pycache__/serialize.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/__pycache__/wrapper.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/__pycache__/wrapper.cpython-39.pyc index a3d6aa17..918d83ff 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/__pycache__/wrapper.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/__pycache__/wrapper.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/caches/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/caches/__pycache__/__init__.cpython-39.pyc index ff02c69a..9a2189ee 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/caches/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/caches/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/caches/__pycache__/file_cache.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/caches/__pycache__/file_cache.cpython-39.pyc index 60e6e4be..401ddf63 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/caches/__pycache__/file_cache.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/caches/__pycache__/file_cache.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/caches/__pycache__/redis_cache.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/caches/__pycache__/redis_cache.cpython-39.pyc index 10be5c5b..f39a4ef2 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/caches/__pycache__/redis_cache.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/caches/__pycache__/redis_cache.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/certifi/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/certifi/__pycache__/__init__.cpython-39.pyc index b5cc6ad0..e66437ab 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/certifi/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/certifi/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/certifi/__pycache__/__main__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/certifi/__pycache__/__main__.cpython-39.pyc index 93e7c5cd..e24db4e0 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/certifi/__pycache__/__main__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/certifi/__pycache__/__main__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/certifi/__pycache__/core.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/certifi/__pycache__/core.cpython-39.pyc index e26c749a..65606c20 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/certifi/__pycache__/core.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/certifi/__pycache__/core.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/__init__.cpython-39.pyc index cf297a7a..fcfaa6ce 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/big5freq.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/big5freq.cpython-39.pyc index 329eb309..51b384ff 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/big5freq.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/big5freq.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/big5prober.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/big5prober.cpython-39.pyc index 21dce801..727d7d44 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/big5prober.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/big5prober.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/chardistribution.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/chardistribution.cpython-39.pyc index c290af0b..14985b2d 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/chardistribution.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/chardistribution.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/charsetgroupprober.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/charsetgroupprober.cpython-39.pyc index 5b2ce256..976fd1a9 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/charsetgroupprober.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/charsetgroupprober.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/charsetprober.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/charsetprober.cpython-39.pyc index 2ccaa41b..c24cfa68 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/charsetprober.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/charsetprober.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/codingstatemachine.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/codingstatemachine.cpython-39.pyc index 731dc788..27a4e1a5 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/codingstatemachine.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/codingstatemachine.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/compat.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/compat.cpython-39.pyc index 5100a575..c77a43f1 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/compat.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/compat.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/cp949prober.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/cp949prober.cpython-39.pyc index b4996616..85a5f781 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/cp949prober.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/cp949prober.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/enums.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/enums.cpython-39.pyc index b577b270..6bb627a1 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/enums.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/enums.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/escprober.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/escprober.cpython-39.pyc index c4b3916f..534e7326 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/escprober.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/escprober.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/escsm.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/escsm.cpython-39.pyc index e005f4ba..1ed3befd 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/escsm.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/escsm.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/eucjpprober.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/eucjpprober.cpython-39.pyc index 0887fbbd..a4cec942 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/eucjpprober.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/eucjpprober.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/euckrfreq.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/euckrfreq.cpython-39.pyc index c738c430..93c1f875 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/euckrfreq.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/euckrfreq.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/euckrprober.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/euckrprober.cpython-39.pyc index f914ef4b..9847600b 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/euckrprober.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/euckrprober.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/euctwfreq.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/euctwfreq.cpython-39.pyc index 89e6bed6..353af3d0 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/euctwfreq.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/euctwfreq.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/euctwprober.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/euctwprober.cpython-39.pyc index e6577f90..7222c3dd 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/euctwprober.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/euctwprober.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/gb2312freq.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/gb2312freq.cpython-39.pyc index 68c83a3e..41e4e9f0 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/gb2312freq.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/gb2312freq.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/gb2312prober.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/gb2312prober.cpython-39.pyc index 6cbc9599..b5e5f2d8 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/gb2312prober.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/gb2312prober.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/hebrewprober.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/hebrewprober.cpython-39.pyc index d1f96240..9972affc 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/hebrewprober.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/hebrewprober.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/jisfreq.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/jisfreq.cpython-39.pyc index 2d7c2c40..6bf5a80d 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/jisfreq.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/jisfreq.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/jpcntx.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/jpcntx.cpython-39.pyc index 7ff9ba39..41a085b5 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/jpcntx.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/jpcntx.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/langbulgarianmodel.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/langbulgarianmodel.cpython-39.pyc index 839708bd..90537b90 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/langbulgarianmodel.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/langbulgarianmodel.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/langgreekmodel.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/langgreekmodel.cpython-39.pyc index aaf3e026..60bf5f0a 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/langgreekmodel.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/langgreekmodel.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/langhebrewmodel.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/langhebrewmodel.cpython-39.pyc index f9091231..b6d5a81a 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/langhebrewmodel.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/langhebrewmodel.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/langhungarianmodel.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/langhungarianmodel.cpython-39.pyc index 6ed49b62..7ed5771e 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/langhungarianmodel.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/langhungarianmodel.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/langrussianmodel.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/langrussianmodel.cpython-39.pyc index 30c264dc..de3a062d 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/langrussianmodel.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/langrussianmodel.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/langthaimodel.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/langthaimodel.cpython-39.pyc index d8e0af53..5ad583dc 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/langthaimodel.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/langthaimodel.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/langturkishmodel.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/langturkishmodel.cpython-39.pyc index b935d49f..63be95f6 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/langturkishmodel.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/langturkishmodel.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/latin1prober.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/latin1prober.cpython-39.pyc index 1fef38c6..b227bcd1 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/latin1prober.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/latin1prober.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/mbcharsetprober.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/mbcharsetprober.cpython-39.pyc index 1fbbd97e..4a80c04b 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/mbcharsetprober.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/mbcharsetprober.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/mbcsgroupprober.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/mbcsgroupprober.cpython-39.pyc index 58032a7d..1f4a5ee2 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/mbcsgroupprober.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/mbcsgroupprober.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/mbcssm.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/mbcssm.cpython-39.pyc index 3a89b85e..dc4e6550 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/mbcssm.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/mbcssm.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/sbcharsetprober.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/sbcharsetprober.cpython-39.pyc index f938dee2..ee72965e 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/sbcharsetprober.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/sbcharsetprober.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/sbcsgroupprober.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/sbcsgroupprober.cpython-39.pyc index e902fd44..cb697087 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/sbcsgroupprober.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/sbcsgroupprober.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/sjisprober.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/sjisprober.cpython-39.pyc index 1a20a557..22a4e26a 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/sjisprober.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/sjisprober.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/universaldetector.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/universaldetector.cpython-39.pyc index ad16d036..20cd338f 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/universaldetector.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/universaldetector.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/utf8prober.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/utf8prober.cpython-39.pyc index 09cbde6a..36fffdd5 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/utf8prober.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/utf8prober.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/version.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/version.cpython-39.pyc index 2ff4f0c8..37ff3965 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/version.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/__pycache__/version.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/cli/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/cli/__pycache__/__init__.cpython-39.pyc index b282b6d2..439ec016 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/cli/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/cli/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/cli/__pycache__/chardetect.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/cli/__pycache__/chardetect.cpython-39.pyc index fdfd2b2e..c125a31a 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/cli/__pycache__/chardetect.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/cli/__pycache__/chardetect.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/metadata/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/metadata/__pycache__/__init__.cpython-39.pyc index 7d0ce50b..d204433a 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/metadata/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/metadata/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/metadata/__pycache__/languages.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/metadata/__pycache__/languages.cpython-39.pyc index 0d013c7a..5a97f894 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/metadata/__pycache__/languages.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/chardet/metadata/__pycache__/languages.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/colorama/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/colorama/__pycache__/__init__.cpython-39.pyc index bde6abb2..ddcfac9f 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/colorama/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/colorama/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/colorama/__pycache__/ansi.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/colorama/__pycache__/ansi.cpython-39.pyc index a54c4061..17a17e4a 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/colorama/__pycache__/ansi.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/colorama/__pycache__/ansi.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/colorama/__pycache__/ansitowin32.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/colorama/__pycache__/ansitowin32.cpython-39.pyc index d7d32960..05257ba7 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/colorama/__pycache__/ansitowin32.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/colorama/__pycache__/ansitowin32.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/colorama/__pycache__/initialise.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/colorama/__pycache__/initialise.cpython-39.pyc index a99a282b..1ad0d652 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/colorama/__pycache__/initialise.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/colorama/__pycache__/initialise.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/colorama/__pycache__/win32.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/colorama/__pycache__/win32.cpython-39.pyc index eac9e85c..eb607ea8 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/colorama/__pycache__/win32.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/colorama/__pycache__/win32.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/colorama/__pycache__/winterm.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/colorama/__pycache__/winterm.cpython-39.pyc index ee71f5d2..a6c279ce 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/colorama/__pycache__/winterm.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/colorama/__pycache__/winterm.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/__init__.cpython-39.pyc index 8cbcb1ff..2b5552e3 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/compat.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/compat.cpython-39.pyc index d716775e..77d758f2 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/compat.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/compat.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/database.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/database.cpython-39.pyc index 503ffdb1..5d9d687d 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/database.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/database.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/index.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/index.cpython-39.pyc index 651f0aee..6c1ab6c9 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/index.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/index.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/locators.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/locators.cpython-39.pyc index eccc8162..72245954 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/locators.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/locators.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/manifest.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/manifest.cpython-39.pyc index 2b361aa0..86a9a2d2 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/manifest.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/manifest.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/markers.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/markers.cpython-39.pyc index 85fd2bc2..40afadcb 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/markers.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/markers.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/metadata.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/metadata.cpython-39.pyc index c1b10f46..ccb243e8 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/metadata.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/metadata.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/resources.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/resources.cpython-39.pyc index a9ad559f..7398f4ec 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/resources.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/resources.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/scripts.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/scripts.cpython-39.pyc index a72a96fc..0c2ca79d 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/scripts.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/scripts.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/util.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/util.cpython-39.pyc index fb32b245..3a7374ae 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/util.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/util.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/version.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/version.cpython-39.pyc index cfbf043a..90ea1671 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/version.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/version.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/wheel.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/wheel.cpython-39.pyc index 6aecddf7..367c49e3 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/wheel.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/__pycache__/wheel.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/_backport/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/_backport/__pycache__/__init__.cpython-39.pyc index 3d763537..6b8b8e9b 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/_backport/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/_backport/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/_backport/__pycache__/misc.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/_backport/__pycache__/misc.cpython-39.pyc index ed21e133..8d64bc12 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/_backport/__pycache__/misc.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/_backport/__pycache__/misc.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/_backport/__pycache__/shutil.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/_backport/__pycache__/shutil.cpython-39.pyc index 727fa697..c7f33b96 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/_backport/__pycache__/shutil.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/_backport/__pycache__/shutil.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/_backport/__pycache__/sysconfig.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/_backport/__pycache__/sysconfig.cpython-39.pyc index 1446f778..66af09c8 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/_backport/__pycache__/sysconfig.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/_backport/__pycache__/sysconfig.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/_backport/__pycache__/tarfile.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/_backport/__pycache__/tarfile.cpython-39.pyc index 49e6017b..95b019c2 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/_backport/__pycache__/tarfile.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/distlib/_backport/__pycache__/tarfile.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/__pycache__/__init__.cpython-39.pyc index a2102557..4fe3e1ee 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/__pycache__/_ihatexml.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/__pycache__/_ihatexml.cpython-39.pyc index b61d6772..ed3d9cec 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/__pycache__/_ihatexml.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/__pycache__/_ihatexml.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/__pycache__/_inputstream.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/__pycache__/_inputstream.cpython-39.pyc index 0ef884e2..a3d9f3bc 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/__pycache__/_inputstream.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/__pycache__/_inputstream.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/__pycache__/_tokenizer.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/__pycache__/_tokenizer.cpython-39.pyc index 51c52b56..2e89708a 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/__pycache__/_tokenizer.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/__pycache__/_tokenizer.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/__pycache__/_utils.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/__pycache__/_utils.cpython-39.pyc index 6d30787c..885bf480 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/__pycache__/_utils.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/__pycache__/_utils.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/__pycache__/constants.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/__pycache__/constants.cpython-39.pyc index c9f9186b..9a552c52 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/__pycache__/constants.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/__pycache__/constants.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/__pycache__/html5parser.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/__pycache__/html5parser.cpython-39.pyc index a68187f4..501b7e4f 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/__pycache__/html5parser.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/__pycache__/html5parser.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/__pycache__/serializer.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/__pycache__/serializer.cpython-39.pyc index b4b07659..062b60fa 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/__pycache__/serializer.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/__pycache__/serializer.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/_trie/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/_trie/__pycache__/__init__.cpython-39.pyc index aeaef1cc..2b1a8ad7 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/_trie/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/_trie/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/_trie/__pycache__/_base.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/_trie/__pycache__/_base.cpython-39.pyc index 2566266e..cfde837c 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/_trie/__pycache__/_base.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/_trie/__pycache__/_base.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/_trie/__pycache__/py.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/_trie/__pycache__/py.cpython-39.pyc index 86bf251a..06b72a60 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/_trie/__pycache__/py.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/_trie/__pycache__/py.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/filters/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/filters/__pycache__/__init__.cpython-39.pyc index 0080ccea..98fdf45b 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/filters/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/filters/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/filters/__pycache__/alphabeticalattributes.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/filters/__pycache__/alphabeticalattributes.cpython-39.pyc index 156bd4be..11893a7a 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/filters/__pycache__/alphabeticalattributes.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/filters/__pycache__/alphabeticalattributes.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/filters/__pycache__/base.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/filters/__pycache__/base.cpython-39.pyc index bf74c6db..7e2a1878 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/filters/__pycache__/base.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/filters/__pycache__/base.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/filters/__pycache__/inject_meta_charset.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/filters/__pycache__/inject_meta_charset.cpython-39.pyc index 9747b349..76d991f1 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/filters/__pycache__/inject_meta_charset.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/filters/__pycache__/inject_meta_charset.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/filters/__pycache__/lint.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/filters/__pycache__/lint.cpython-39.pyc index e6911a4e..796c7849 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/filters/__pycache__/lint.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/filters/__pycache__/lint.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/filters/__pycache__/optionaltags.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/filters/__pycache__/optionaltags.cpython-39.pyc index a522cb79..8fba0d99 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/filters/__pycache__/optionaltags.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/filters/__pycache__/optionaltags.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/filters/__pycache__/sanitizer.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/filters/__pycache__/sanitizer.cpython-39.pyc index 0ce0870f..ac0a7c44 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/filters/__pycache__/sanitizer.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/filters/__pycache__/sanitizer.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/filters/__pycache__/whitespace.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/filters/__pycache__/whitespace.cpython-39.pyc index 232b0407..204e0179 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/filters/__pycache__/whitespace.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/filters/__pycache__/whitespace.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treeadapters/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treeadapters/__pycache__/__init__.cpython-39.pyc index e2d6f5e4..8a4824ca 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treeadapters/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treeadapters/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treeadapters/__pycache__/genshi.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treeadapters/__pycache__/genshi.cpython-39.pyc index 3b9ef537..b3ec99a9 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treeadapters/__pycache__/genshi.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treeadapters/__pycache__/genshi.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treeadapters/__pycache__/sax.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treeadapters/__pycache__/sax.cpython-39.pyc index 12a59fe9..13368125 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treeadapters/__pycache__/sax.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treeadapters/__pycache__/sax.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treebuilders/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treebuilders/__pycache__/__init__.cpython-39.pyc index aabd25dc..e253e31b 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treebuilders/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treebuilders/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treebuilders/__pycache__/base.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treebuilders/__pycache__/base.cpython-39.pyc index 56d74c96..b43565d7 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treebuilders/__pycache__/base.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treebuilders/__pycache__/base.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treebuilders/__pycache__/dom.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treebuilders/__pycache__/dom.cpython-39.pyc index 0cb59956..36d1904d 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treebuilders/__pycache__/dom.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treebuilders/__pycache__/dom.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treebuilders/__pycache__/etree.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treebuilders/__pycache__/etree.cpython-39.pyc index da087c33..901dc045 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treebuilders/__pycache__/etree.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treebuilders/__pycache__/etree.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treebuilders/__pycache__/etree_lxml.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treebuilders/__pycache__/etree_lxml.cpython-39.pyc index 8c7d42bb..8db050fd 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treebuilders/__pycache__/etree_lxml.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treebuilders/__pycache__/etree_lxml.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treewalkers/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treewalkers/__pycache__/__init__.cpython-39.pyc index 3db7eb9a..a426ae73 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treewalkers/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treewalkers/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treewalkers/__pycache__/base.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treewalkers/__pycache__/base.cpython-39.pyc index 6152df02..c8a74076 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treewalkers/__pycache__/base.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treewalkers/__pycache__/base.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treewalkers/__pycache__/dom.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treewalkers/__pycache__/dom.cpython-39.pyc index 81e0d86a..c4b753e4 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treewalkers/__pycache__/dom.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treewalkers/__pycache__/dom.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treewalkers/__pycache__/etree.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treewalkers/__pycache__/etree.cpython-39.pyc index 7c23e0ab..a79947ad 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treewalkers/__pycache__/etree.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treewalkers/__pycache__/etree.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treewalkers/__pycache__/etree_lxml.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treewalkers/__pycache__/etree_lxml.cpython-39.pyc index 1b22835e..71ded911 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treewalkers/__pycache__/etree_lxml.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treewalkers/__pycache__/etree_lxml.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treewalkers/__pycache__/genshi.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treewalkers/__pycache__/genshi.cpython-39.pyc index 7cae0e28..be61c229 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treewalkers/__pycache__/genshi.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treewalkers/__pycache__/genshi.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/idna/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/idna/__pycache__/__init__.cpython-39.pyc index 74fb1178..6279ed95 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/idna/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/idna/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/idna/__pycache__/codec.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/idna/__pycache__/codec.cpython-39.pyc index 1754cd33..72e1d91b 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/idna/__pycache__/codec.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/idna/__pycache__/codec.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/idna/__pycache__/compat.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/idna/__pycache__/compat.cpython-39.pyc index 26a819b2..9f466bcf 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/idna/__pycache__/compat.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/idna/__pycache__/compat.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/idna/__pycache__/core.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/idna/__pycache__/core.cpython-39.pyc index 78313b35..472252c2 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/idna/__pycache__/core.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/idna/__pycache__/core.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/idna/__pycache__/idnadata.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/idna/__pycache__/idnadata.cpython-39.pyc index 42e6b459..bd4e11f1 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/idna/__pycache__/idnadata.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/idna/__pycache__/idnadata.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/idna/__pycache__/intranges.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/idna/__pycache__/intranges.cpython-39.pyc index f8aacd7a..42b093b2 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/idna/__pycache__/intranges.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/idna/__pycache__/intranges.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/idna/__pycache__/package_data.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/idna/__pycache__/package_data.cpython-39.pyc index a1e462bb..e185aea7 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/idna/__pycache__/package_data.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/idna/__pycache__/package_data.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/idna/__pycache__/uts46data.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/idna/__pycache__/uts46data.cpython-39.pyc index c0f3683d..a3f2112a 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/idna/__pycache__/uts46data.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/idna/__pycache__/uts46data.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/msgpack/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/msgpack/__pycache__/__init__.cpython-39.pyc index cfc28eec..896a4fac 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/msgpack/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/msgpack/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/msgpack/__pycache__/_version.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/msgpack/__pycache__/_version.cpython-39.pyc index 99d24470..ce6cc7b7 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/msgpack/__pycache__/_version.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/msgpack/__pycache__/_version.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/msgpack/__pycache__/exceptions.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/msgpack/__pycache__/exceptions.cpython-39.pyc index 12ffe3e9..b61fa373 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/msgpack/__pycache__/exceptions.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/msgpack/__pycache__/exceptions.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/msgpack/__pycache__/ext.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/msgpack/__pycache__/ext.cpython-39.pyc index db5d36d5..108c2012 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/msgpack/__pycache__/ext.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/msgpack/__pycache__/ext.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/msgpack/__pycache__/fallback.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/msgpack/__pycache__/fallback.cpython-39.pyc index e7969ca5..60215697 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/msgpack/__pycache__/fallback.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/msgpack/__pycache__/fallback.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/__pycache__/__about__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/__pycache__/__about__.cpython-39.pyc index b45ac1cc..6cfeea5b 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/__pycache__/__about__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/__pycache__/__about__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/__pycache__/__init__.cpython-39.pyc index 0c73e1e8..2073127f 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/__pycache__/_manylinux.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/__pycache__/_manylinux.cpython-39.pyc index 3c3c10a8..04faf0be 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/__pycache__/_manylinux.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/__pycache__/_manylinux.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/__pycache__/_musllinux.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/__pycache__/_musllinux.cpython-39.pyc index 584b8edd..6af3297f 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/__pycache__/_musllinux.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/__pycache__/_musllinux.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/__pycache__/_structures.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/__pycache__/_structures.cpython-39.pyc index bd42828d..841dd20c 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/__pycache__/_structures.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/__pycache__/_structures.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/__pycache__/markers.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/__pycache__/markers.cpython-39.pyc index fa35317d..40b9d893 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/__pycache__/markers.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/__pycache__/markers.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/__pycache__/requirements.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/__pycache__/requirements.cpython-39.pyc index 6ba5c3e0..87b2dbfe 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/__pycache__/requirements.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/__pycache__/requirements.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/__pycache__/specifiers.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/__pycache__/specifiers.cpython-39.pyc index 3852ea05..e8f5c855 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/__pycache__/specifiers.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/__pycache__/specifiers.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/__pycache__/tags.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/__pycache__/tags.cpython-39.pyc index 56a577f7..67db7df3 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/__pycache__/tags.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/__pycache__/tags.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/__pycache__/utils.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/__pycache__/utils.cpython-39.pyc index bd4fa192..d099aac4 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/__pycache__/utils.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/__pycache__/utils.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/__pycache__/version.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/__pycache__/version.cpython-39.pyc index cee89f46..9327dbcb 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/__pycache__/version.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/packaging/__pycache__/version.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/__pycache__/__init__.cpython-39.pyc index 70701315..c964f9c3 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/__pycache__/build.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/__pycache__/build.cpython-39.pyc index 63ea40bc..76d26746 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/__pycache__/build.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/__pycache__/build.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/__pycache__/check.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/__pycache__/check.cpython-39.pyc index 0eb7fbda..e5f43c7e 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/__pycache__/check.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/__pycache__/check.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/__pycache__/colorlog.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/__pycache__/colorlog.cpython-39.pyc index 919efa52..3113e34f 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/__pycache__/colorlog.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/__pycache__/colorlog.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/__pycache__/compat.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/__pycache__/compat.cpython-39.pyc index 20788e0d..12b2eb7b 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/__pycache__/compat.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/__pycache__/compat.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/__pycache__/dirtools.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/__pycache__/dirtools.cpython-39.pyc index e0cae6b8..c503bd85 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/__pycache__/dirtools.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/__pycache__/dirtools.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/__pycache__/envbuild.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/__pycache__/envbuild.cpython-39.pyc index 456c842c..b8805ef3 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/__pycache__/envbuild.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/__pycache__/envbuild.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/__pycache__/meta.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/__pycache__/meta.cpython-39.pyc index 2732d8ba..8328b31c 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/__pycache__/meta.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/__pycache__/meta.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/__pycache__/wrappers.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/__pycache__/wrappers.cpython-39.pyc index 86285dc5..f85a5c11 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/__pycache__/wrappers.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/__pycache__/wrappers.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/__pycache__/__init__.cpython-39.pyc index 0b1ab791..52bac22d 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/__pycache__/_in_process.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/__pycache__/_in_process.cpython-39.pyc index c3329512..e0b464cb 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/__pycache__/_in_process.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/__pycache__/_in_process.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/pkg_resources/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/pkg_resources/__pycache__/__init__.cpython-39.pyc index 560fb454..22361f3f 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/pkg_resources/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/pkg_resources/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/pkg_resources/__pycache__/py31compat.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/pkg_resources/__pycache__/py31compat.cpython-39.pyc index 723c0d6d..4c231c48 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/pkg_resources/__pycache__/py31compat.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/pkg_resources/__pycache__/py31compat.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/progress/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/progress/__pycache__/__init__.cpython-39.pyc index 0943432d..97ab7aa9 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/progress/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/progress/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/progress/__pycache__/bar.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/progress/__pycache__/bar.cpython-39.pyc index de61e6ff..9bcfead1 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/progress/__pycache__/bar.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/progress/__pycache__/bar.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/progress/__pycache__/counter.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/progress/__pycache__/counter.cpython-39.pyc index c9757eff..b1f0970c 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/progress/__pycache__/counter.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/progress/__pycache__/counter.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/progress/__pycache__/spinner.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/progress/__pycache__/spinner.cpython-39.pyc index 65a7077c..f905b665 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/progress/__pycache__/spinner.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/progress/__pycache__/spinner.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/__init__.cpython-39.pyc index de29903e..d3942b96 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/__version__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/__version__.cpython-39.pyc index 319601ed..d548cc37 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/__version__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/__version__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/_internal_utils.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/_internal_utils.cpython-39.pyc index de029b04..bee7a581 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/_internal_utils.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/_internal_utils.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/adapters.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/adapters.cpython-39.pyc index 87be207a..fc1fe104 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/adapters.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/adapters.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/api.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/api.cpython-39.pyc index 8e323c89..bd182f59 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/api.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/api.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/auth.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/auth.cpython-39.pyc index 2a817e71..4bd697fd 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/auth.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/auth.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/certs.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/certs.cpython-39.pyc index 54d6d614..bc007f5f 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/certs.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/certs.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/compat.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/compat.cpython-39.pyc index 7aa25ff1..7462181b 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/compat.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/compat.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/cookies.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/cookies.cpython-39.pyc index a8e0c72f..2e94f230 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/cookies.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/cookies.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/exceptions.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/exceptions.cpython-39.pyc index a6ab122e..2d4225f3 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/exceptions.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/exceptions.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/help.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/help.cpython-39.pyc index 9f45276a..a15b5248 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/help.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/help.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/hooks.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/hooks.cpython-39.pyc index 0dfae466..a3cacdff 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/hooks.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/hooks.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/models.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/models.cpython-39.pyc index d8b0b565..7bc19ccc 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/models.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/models.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/packages.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/packages.cpython-39.pyc index f89c06c9..ff67eccb 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/packages.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/packages.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/sessions.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/sessions.cpython-39.pyc index d947271d..fc69f062 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/sessions.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/sessions.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/status_codes.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/status_codes.cpython-39.pyc index e3d5b861..e5236e45 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/status_codes.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/status_codes.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/structures.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/structures.cpython-39.pyc index e4cc7d27..96636aba 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/structures.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/structures.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/utils.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/utils.cpython-39.pyc index cbe3368e..256afb56 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/utils.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/requests/__pycache__/utils.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/resolvelib/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/resolvelib/__pycache__/__init__.cpython-39.pyc index b87efac6..db31bdfc 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/resolvelib/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/resolvelib/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/resolvelib/__pycache__/providers.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/resolvelib/__pycache__/providers.cpython-39.pyc index 68fa1f8b..bf89a388 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/resolvelib/__pycache__/providers.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/resolvelib/__pycache__/providers.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/resolvelib/__pycache__/reporters.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/resolvelib/__pycache__/reporters.cpython-39.pyc index ee07e4be..a4bf2276 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/resolvelib/__pycache__/reporters.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/resolvelib/__pycache__/reporters.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/resolvelib/__pycache__/resolvers.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/resolvelib/__pycache__/resolvers.cpython-39.pyc index a5d6032c..63cc8c61 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/resolvelib/__pycache__/resolvers.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/resolvelib/__pycache__/resolvers.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/resolvelib/__pycache__/structs.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/resolvelib/__pycache__/structs.cpython-39.pyc index 19c2d47c..5f61cb66 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/resolvelib/__pycache__/structs.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/resolvelib/__pycache__/structs.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/resolvelib/compat/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/resolvelib/compat/__pycache__/__init__.cpython-39.pyc index 3e0f6f14..bccc8e08 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/resolvelib/compat/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/resolvelib/compat/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/resolvelib/compat/__pycache__/collections_abc.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/resolvelib/compat/__pycache__/collections_abc.cpython-39.pyc index a1abe473..a653294a 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/resolvelib/compat/__pycache__/collections_abc.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/resolvelib/compat/__pycache__/collections_abc.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/__pycache__/__init__.cpython-39.pyc index ad57fb98..f037aec9 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/__pycache__/_asyncio.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/__pycache__/_asyncio.cpython-39.pyc index 153b379e..c6c3f319 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/__pycache__/_asyncio.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/__pycache__/_asyncio.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/__pycache__/_utils.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/__pycache__/_utils.cpython-39.pyc index 93954830..11eb9133 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/__pycache__/_utils.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/__pycache__/_utils.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/__pycache__/after.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/__pycache__/after.cpython-39.pyc index a4cf7f03..223d3fc9 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/__pycache__/after.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/__pycache__/after.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/__pycache__/before.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/__pycache__/before.cpython-39.pyc index f3e4452b..4b95ab54 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/__pycache__/before.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/__pycache__/before.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/__pycache__/before_sleep.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/__pycache__/before_sleep.cpython-39.pyc index fb0c23bc..4112f6d5 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/__pycache__/before_sleep.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/__pycache__/before_sleep.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/__pycache__/nap.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/__pycache__/nap.cpython-39.pyc index c1ced099..f9b0f07d 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/__pycache__/nap.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/__pycache__/nap.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/__pycache__/retry.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/__pycache__/retry.cpython-39.pyc index 260adf35..fed720d3 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/__pycache__/retry.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/__pycache__/retry.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/__pycache__/stop.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/__pycache__/stop.cpython-39.pyc index 0c1c9805..48225c07 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/__pycache__/stop.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/__pycache__/stop.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/__pycache__/tornadoweb.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/__pycache__/tornadoweb.cpython-39.pyc index 6e4145bc..1b2cbcf8 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/__pycache__/tornadoweb.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/__pycache__/tornadoweb.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/__pycache__/wait.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/__pycache__/wait.cpython-39.pyc index cd1c9d85..cfd83b10 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/__pycache__/wait.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/tenacity/__pycache__/wait.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/tomli/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/tomli/__pycache__/__init__.cpython-39.pyc index ce5b1bb3..34896868 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/tomli/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/tomli/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/tomli/__pycache__/_parser.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/tomli/__pycache__/_parser.cpython-39.pyc index b3e6e81a..4c127ecf 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/tomli/__pycache__/_parser.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/tomli/__pycache__/_parser.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/tomli/__pycache__/_re.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/tomli/__pycache__/_re.cpython-39.pyc index 0657627a..64b77cd1 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/tomli/__pycache__/_re.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/tomli/__pycache__/_re.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/__pycache__/__init__.cpython-39.pyc index 3eedb8ba..0c104b54 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/__pycache__/_collections.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/__pycache__/_collections.cpython-39.pyc index 88257246..8bbd911a 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/__pycache__/_collections.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/__pycache__/_collections.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/__pycache__/_version.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/__pycache__/_version.cpython-39.pyc index 4ffd6ad8..93878ab2 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/__pycache__/_version.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/__pycache__/_version.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/__pycache__/connection.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/__pycache__/connection.cpython-39.pyc index 43ee8b10..4676af7e 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/__pycache__/connection.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/__pycache__/connection.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/__pycache__/connectionpool.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/__pycache__/connectionpool.cpython-39.pyc index d9c41ae5..6fac4301 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/__pycache__/connectionpool.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/__pycache__/connectionpool.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/__pycache__/exceptions.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/__pycache__/exceptions.cpython-39.pyc index cc263eac..58683f8e 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/__pycache__/exceptions.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/__pycache__/exceptions.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/__pycache__/fields.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/__pycache__/fields.cpython-39.pyc index 0eec050c..6167ac1c 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/__pycache__/fields.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/__pycache__/fields.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/__pycache__/filepost.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/__pycache__/filepost.cpython-39.pyc index 88609812..1befcd6c 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/__pycache__/filepost.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/__pycache__/filepost.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/__pycache__/poolmanager.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/__pycache__/poolmanager.cpython-39.pyc index f4601b49..5226b8bc 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/__pycache__/poolmanager.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/__pycache__/poolmanager.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/__pycache__/request.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/__pycache__/request.cpython-39.pyc index 127183a9..c435ce4d 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/__pycache__/request.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/__pycache__/request.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/__pycache__/response.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/__pycache__/response.cpython-39.pyc index 322936d5..0c792633 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/__pycache__/response.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/__pycache__/response.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/__pycache__/__init__.cpython-39.pyc index 791e2081..516ff574 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/__pycache__/_appengine_environ.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/__pycache__/_appengine_environ.cpython-39.pyc index 3d5a6bdd..2fdee83d 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/__pycache__/_appengine_environ.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/__pycache__/_appengine_environ.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/__pycache__/appengine.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/__pycache__/appengine.cpython-39.pyc index 7f6fdbc3..6b9522b3 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/__pycache__/appengine.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/__pycache__/appengine.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/__pycache__/ntlmpool.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/__pycache__/ntlmpool.cpython-39.pyc index 562b02ad..d6439a71 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/__pycache__/ntlmpool.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/__pycache__/ntlmpool.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/__pycache__/pyopenssl.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/__pycache__/pyopenssl.cpython-39.pyc index 84b7e7bc..b6885f52 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/__pycache__/pyopenssl.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/__pycache__/pyopenssl.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/__pycache__/securetransport.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/__pycache__/securetransport.cpython-39.pyc index 81a5946d..1315891b 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/__pycache__/securetransport.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/__pycache__/securetransport.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/__pycache__/socks.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/__pycache__/socks.cpython-39.pyc index c08a6711..028e5185 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/__pycache__/socks.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/__pycache__/socks.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/_securetransport/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/_securetransport/__pycache__/__init__.cpython-39.pyc index 6189a798..3adaabaf 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/_securetransport/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/_securetransport/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/_securetransport/__pycache__/bindings.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/_securetransport/__pycache__/bindings.cpython-39.pyc index cdf00413..d4d81df1 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/_securetransport/__pycache__/bindings.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/_securetransport/__pycache__/bindings.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/_securetransport/__pycache__/low_level.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/_securetransport/__pycache__/low_level.cpython-39.pyc index 724b6422..ab0f769c 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/_securetransport/__pycache__/low_level.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/contrib/_securetransport/__pycache__/low_level.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/packages/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/packages/__pycache__/__init__.cpython-39.pyc index 4a78b13a..5f718b92 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/packages/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/packages/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/packages/__pycache__/six.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/packages/__pycache__/six.cpython-39.pyc index 6b44e1fb..12dab1c6 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/packages/__pycache__/six.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/packages/__pycache__/six.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/packages/backports/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/packages/backports/__pycache__/__init__.cpython-39.pyc index 1c5206c6..614d58e1 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/packages/backports/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/packages/backports/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/packages/backports/__pycache__/makefile.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/packages/backports/__pycache__/makefile.cpython-39.pyc index 94cc9ee9..da20e719 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/packages/backports/__pycache__/makefile.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/packages/backports/__pycache__/makefile.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/packages/ssl_match_hostname/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/packages/ssl_match_hostname/__pycache__/__init__.cpython-39.pyc index 2287af5a..8dafa3bf 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/packages/ssl_match_hostname/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/packages/ssl_match_hostname/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/packages/ssl_match_hostname/__pycache__/_implementation.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/packages/ssl_match_hostname/__pycache__/_implementation.cpython-39.pyc index ab2f2176..97d91b21 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/packages/ssl_match_hostname/__pycache__/_implementation.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/packages/ssl_match_hostname/__pycache__/_implementation.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/__init__.cpython-39.pyc index 413c9002..910067de 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/connection.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/connection.cpython-39.pyc index 0ea4bd10..e2edeb5f 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/connection.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/connection.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/proxy.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/proxy.cpython-39.pyc index 7e819f5c..eb6151e6 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/proxy.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/proxy.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/queue.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/queue.cpython-39.pyc index 781e4f76..8433b71c 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/queue.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/queue.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/request.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/request.cpython-39.pyc index e7748e04..64852dfc 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/request.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/request.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/response.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/response.cpython-39.pyc index 07601770..2f657204 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/response.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/response.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/retry.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/retry.cpython-39.pyc index 7124506c..989368c5 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/retry.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/retry.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/ssl_.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/ssl_.cpython-39.pyc index f6ffdad5..534f4ba7 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/ssl_.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/ssl_.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/ssltransport.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/ssltransport.cpython-39.pyc index d8e5e9b8..aa71b0e8 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/ssltransport.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/ssltransport.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/timeout.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/timeout.cpython-39.pyc index 0fbf1e9b..7f1544c1 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/timeout.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/timeout.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/url.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/url.cpython-39.pyc index 0d616236..6f477494 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/url.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/url.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/wait.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/wait.cpython-39.pyc index 39b03231..66c1dcb8 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/wait.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__pycache__/wait.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/webencodings/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/webencodings/__pycache__/__init__.cpython-39.pyc index a3d8c2df..c88270c3 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/webencodings/__pycache__/__init__.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/webencodings/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/webencodings/__pycache__/labels.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/webencodings/__pycache__/labels.cpython-39.pyc index eb3377ba..aedc2469 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/webencodings/__pycache__/labels.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/webencodings/__pycache__/labels.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/webencodings/__pycache__/mklabels.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/webencodings/__pycache__/mklabels.cpython-39.pyc index 884e5ebf..ca0898e3 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/webencodings/__pycache__/mklabels.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/webencodings/__pycache__/mklabels.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/webencodings/__pycache__/tests.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/webencodings/__pycache__/tests.cpython-39.pyc index 0af521d5..3f72e267 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/webencodings/__pycache__/tests.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/webencodings/__pycache__/tests.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/pip/_vendor/webencodings/__pycache__/x_user_defined.cpython-39.pyc b/.venv/lib/python3.9/site-packages/pip/_vendor/webencodings/__pycache__/x_user_defined.cpython-39.pyc index 8399dd48..f0429a74 100644 Binary files a/.venv/lib/python3.9/site-packages/pip/_vendor/webencodings/__pycache__/x_user_defined.cpython-39.pyc and b/.venv/lib/python3.9/site-packages/pip/_vendor/webencodings/__pycache__/x_user_defined.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/tk-0.1.0.dist-info/INSTALLER b/.venv/lib/python3.9/site-packages/tk-0.1.0.dist-info/INSTALLER new file mode 100644 index 00000000..a1b589e3 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/tk-0.1.0.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/.venv/lib/python3.9/site-packages/tk-0.1.0.dist-info/LICENSE b/.venv/lib/python3.9/site-packages/tk-0.1.0.dist-info/LICENSE new file mode 100644 index 00000000..a77350d8 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/tk-0.1.0.dist-info/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 kaiJIN + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/.venv/lib/python3.9/site-packages/tk-0.1.0.dist-info/METADATA b/.venv/lib/python3.9/site-packages/tk-0.1.0.dist-info/METADATA new file mode 100644 index 00000000..e92f11f2 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/tk-0.1.0.dist-info/METADATA @@ -0,0 +1,21 @@ +Metadata-Version: 2.1 +Name: tk +Version: 0.1.0 +Summary: TensorKit is a deep learning helper between Python and C++. +Home-page: https://github.com/atranitell/TensorKit +Author: Kai Jin +Author-email: atranitell@gmail.com +License: Apache 2.0 Licence +Platform: UNKNOWN +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: License :: OSI Approved :: Apache Software License +Classifier: Operating System :: OS Independent +Classifier: Intended Audience :: Science/Research +Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence +Description-Content-Type: text/markdown + +UNKNOWN + + diff --git a/.venv/lib/python3.9/site-packages/tk-0.1.0.dist-info/RECORD b/.venv/lib/python3.9/site-packages/tk-0.1.0.dist-info/RECORD new file mode 100644 index 00000000..7abb4eb4 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/tk-0.1.0.dist-info/RECORD @@ -0,0 +1,15 @@ +tk-0.1.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +tk-0.1.0.dist-info/LICENSE,sha256=MH9HhyfBy9HZBpz_T8Tq5FQg8vxyqh7PPbJVd5efsgU,1063 +tk-0.1.0.dist-info/METADATA,sha256=jN6gCFOYnMRb5d6SPF8Wbb-Fj-bPXIm_NOqkkqlRluY,693 +tk-0.1.0.dist-info/RECORD,, +tk-0.1.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +tk-0.1.0.dist-info/WHEEL,sha256=U88EhGIw8Sj2_phqajeu_EAi3RAo8-C6zV3REsWbWbs,92 +tk-0.1.0.dist-info/top_level.txt,sha256=JeUv2teCAcHSOK73Cj0C_bKyZfgzp6-ycI7zkFfXOLc,3 +tk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +tk/__pycache__/__init__.cpython-39.pyc,, +tk/structure/Tensor.py,sha256=s5OD2dL6qAcMeDMxUD0ZO7jMun9X0J-KSP_LYH-C49c,2703 +tk/structure/TensorMap.py,sha256=9z76_XV8hCxqjyd3W9xUyNoiOISKHNJlzUCRUKhRFA0,2029 +tk/structure/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +tk/structure/__pycache__/Tensor.cpython-39.pyc,, +tk/structure/__pycache__/TensorMap.cpython-39.pyc,, +tk/structure/__pycache__/__init__.cpython-39.pyc,, diff --git a/.venv/lib/python3.9/site-packages/tk-0.1.0.dist-info/REQUESTED b/.venv/lib/python3.9/site-packages/tk-0.1.0.dist-info/REQUESTED new file mode 100644 index 00000000..e69de29b diff --git a/.venv/lib/python3.9/site-packages/tk-0.1.0.dist-info/WHEEL b/.venv/lib/python3.9/site-packages/tk-0.1.0.dist-info/WHEEL new file mode 100644 index 00000000..e499438d --- /dev/null +++ b/.venv/lib/python3.9/site-packages/tk-0.1.0.dist-info/WHEEL @@ -0,0 +1,5 @@ +Wheel-Version: 1.0 +Generator: bdist_wheel (0.33.1) +Root-Is-Purelib: true +Tag: py3-none-any + diff --git a/.venv/lib/python3.9/site-packages/tk-0.1.0.dist-info/top_level.txt b/.venv/lib/python3.9/site-packages/tk-0.1.0.dist-info/top_level.txt new file mode 100644 index 00000000..a276a6ec --- /dev/null +++ b/.venv/lib/python3.9/site-packages/tk-0.1.0.dist-info/top_level.txt @@ -0,0 +1 @@ +tk diff --git a/.venv/lib/python3.9/site-packages/tk/__init__.py b/.venv/lib/python3.9/site-packages/tk/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/.venv/lib/python3.9/site-packages/tk/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/tk/__pycache__/__init__.cpython-39.pyc new file mode 100644 index 00000000..0661eab6 Binary files /dev/null and b/.venv/lib/python3.9/site-packages/tk/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/tk/structure/Tensor.py b/.venv/lib/python3.9/site-packages/tk/structure/Tensor.py new file mode 100644 index 00000000..70347d03 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/tk/structure/Tensor.py @@ -0,0 +1,98 @@ +# automatically generated by the FlatBuffers compiler, do not modify + +# namespace: structure + +import flatbuffers + + +class Tensor(object): + __slots__ = ['_tab'] + + @classmethod + def GetRootAsTensor(cls, buf, offset): + n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) + x = Tensor() + x.Init(buf, n + offset) + return x + + # Tensor + def Init(self, buf, pos): + self._tab = flatbuffers.table.Table(buf, pos) + + # Tensor + def Name(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + if o != 0: + return self._tab.String(o + self._tab.Pos) + return None + + # Tensor + def Info(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) + if o != 0: + return self._tab.String(o + self._tab.Pos) + return None + + # Tensor + def Shape(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) + if o != 0: + return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos) + return 0 + + # Tensor + def Size(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) + if o != 0: + return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos) + return 0 + + # Tensor + def Data(self, j): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) + if o != 0: + a = self._tab.Vector(o) + return self._tab.Get(flatbuffers.number_types.Float32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) + return 0 + + # Tensor + def DataAsNumpy(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) + if o != 0: + return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Float32Flags, o) + return 0 + + # Tensor + def DataLength(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) + if o != 0: + return self._tab.VectorLen(o) + return 0 + + +def TensorStart(builder): builder.StartObject(5) + + +def TensorAddName(builder, name): builder.PrependUOffsetTRelativeSlot( + 0, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0) + + +def TensorAddInfo(builder, info): builder.PrependUOffsetTRelativeSlot( + 1, flatbuffers.number_types.UOffsetTFlags.py_type(info), 0) + + +def TensorAddShape(builder, shape): builder.PrependUint32Slot(2, shape, 0) + + +def TensorAddSize(builder, size): builder.PrependUint32Slot(3, size, 0) + + +def TensorAddData(builder, data): builder.PrependUOffsetTRelativeSlot( + 4, flatbuffers.number_types.UOffsetTFlags.py_type(data), 0) + + +def TensorStartDataVector( + builder, numElems): return builder.StartVector(4, numElems, 4) + + +def TensorEnd(builder): return builder.EndObject() diff --git a/.venv/lib/python3.9/site-packages/tk/structure/TensorMap.py b/.venv/lib/python3.9/site-packages/tk/structure/TensorMap.py new file mode 100644 index 00000000..5cb9167b --- /dev/null +++ b/.venv/lib/python3.9/site-packages/tk/structure/TensorMap.py @@ -0,0 +1,76 @@ +# automatically generated by the FlatBuffers compiler, do not modify + +# namespace: structure + +import flatbuffers + + +class TensorMap(object): + __slots__ = ['_tab'] + + @classmethod + def GetRootAsTensorMap(cls, buf, offset): + n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) + x = TensorMap() + x.Init(buf, n + offset) + return x + + # TensorMap + def Init(self, buf, pos): + self._tab = flatbuffers.table.Table(buf, pos) + + # TensorMap + def Name(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + if o != 0: + return self._tab.String(o + self._tab.Pos) + return None + + # TensorMap + def Info(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) + if o != 0: + return self._tab.String(o + self._tab.Pos) + return None + + # TensorMap + def Tensors(self, j): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) + if o != 0: + x = self._tab.Vector(o) + x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 + x = self._tab.Indirect(x) + from .Tensor import Tensor + obj = Tensor() + obj.Init(self._tab.Bytes, x) + return obj + return None + + # TensorMap + def TensorsLength(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) + if o != 0: + return self._tab.VectorLen(o) + return 0 + + +def TensorMapStart(builder): builder.StartObject(3) + + +def TensorMapAddName(builder, name): builder.PrependUOffsetTRelativeSlot( + 0, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0) + + +def TensorMapAddInfo(builder, info): builder.PrependUOffsetTRelativeSlot( + 1, flatbuffers.number_types.UOffsetTFlags.py_type(info), 0) + + +def TensorMapAddTensors(builder, tensors): builder.PrependUOffsetTRelativeSlot( + 2, flatbuffers.number_types.UOffsetTFlags.py_type(tensors), 0) + + +def TensorMapStartTensorsVector( + builder, numElems): return builder.StartVector(4, numElems, 4) + + +def TensorMapEnd(builder): return builder.EndObject() diff --git a/.venv/lib/python3.9/site-packages/tk/structure/__init__.py b/.venv/lib/python3.9/site-packages/tk/structure/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/.venv/lib/python3.9/site-packages/tk/structure/__pycache__/Tensor.cpython-39.pyc b/.venv/lib/python3.9/site-packages/tk/structure/__pycache__/Tensor.cpython-39.pyc new file mode 100644 index 00000000..046b49df Binary files /dev/null and b/.venv/lib/python3.9/site-packages/tk/structure/__pycache__/Tensor.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/tk/structure/__pycache__/TensorMap.cpython-39.pyc b/.venv/lib/python3.9/site-packages/tk/structure/__pycache__/TensorMap.cpython-39.pyc new file mode 100644 index 00000000..4479a340 Binary files /dev/null and b/.venv/lib/python3.9/site-packages/tk/structure/__pycache__/TensorMap.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/tk/structure/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/tk/structure/__pycache__/__init__.cpython-39.pyc new file mode 100644 index 00000000..f768ec37 Binary files /dev/null and b/.venv/lib/python3.9/site-packages/tk/structure/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapf-0.31.0.dist-info/AUTHORS b/.venv/lib/python3.9/site-packages/yapf-0.31.0.dist-info/AUTHORS new file mode 100644 index 00000000..b5e878e2 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapf-0.31.0.dist-info/AUTHORS @@ -0,0 +1,9 @@ +# This is the official list of YAPF authors for copyright purposes. +# This file is distinct from the CONTRIBUTORS files. +# See the latter for an explanation. + +# Names should be added to this file as: +# Name or Organization +# The email address is not required for organizations. + +Google Inc. diff --git a/.venv/lib/python3.9/site-packages/yapf-0.31.0.dist-info/INSTALLER b/.venv/lib/python3.9/site-packages/yapf-0.31.0.dist-info/INSTALLER new file mode 100644 index 00000000..a1b589e3 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapf-0.31.0.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/.venv/lib/python3.9/site-packages/yapf-0.31.0.dist-info/LICENSE b/.venv/lib/python3.9/site-packages/yapf-0.31.0.dist-info/LICENSE new file mode 100644 index 00000000..d6456956 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapf-0.31.0.dist-info/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/.venv/lib/python3.9/site-packages/yapf-0.31.0.dist-info/METADATA b/.venv/lib/python3.9/site-packages/yapf-0.31.0.dist-info/METADATA new file mode 100644 index 00000000..25084e77 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapf-0.31.0.dist-info/METADATA @@ -0,0 +1,1026 @@ +Metadata-Version: 2.1 +Name: yapf +Version: 0.31.0 +Summary: A formatter for Python code. +Home-page: UNKNOWN +Author: Google Inc. +Maintainer: Bill Wendling +Maintainer-email: morbo@google.com +License: Apache License, Version 2.0 +Platform: UNKNOWN +Classifier: Development Status :: 4 - Beta +Classifier: Environment :: Console +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: Apache Software License +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 2 +Classifier: Programming Language :: Python :: 2.7 +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.6 +Classifier: Topic :: Software Development :: Libraries :: Python Modules +Classifier: Topic :: Software Development :: Quality Assurance + +==== +YAPF +==== + +.. image:: https://badge.fury.io/py/yapf.svg + :target: https://badge.fury.io/py/yapf + :alt: PyPI version + +.. image:: https://travis-ci.org/google/yapf.svg?branch=main + :target: https://travis-ci.org/google/yapf + :alt: Build status + +.. image:: https://coveralls.io/repos/google/yapf/badge.svg?branch=main + :target: https://coveralls.io/r/google/yapf?branch=main + :alt: Coverage status + + +Introduction +============ + +Most of the current formatters for Python --- e.g., autopep8, and pep8ify --- +are made to remove lint errors from code. This has some obvious limitations. +For instance, code that conforms to the PEP 8 guidelines may not be +reformatted. But it doesn't mean that the code looks good. + +YAPF takes a different approach. It's based off of `'clang-format' `_, developed by Daniel Jasper. In essence, +the algorithm takes the code and reformats it to the best formatting that +conforms to the style guide, even if the original code didn't violate the +style guide. The idea is also similar to the `'gofmt' `_ tool for the Go programming language: end all holy wars about +formatting - if the whole codebase of a project is simply piped through YAPF +whenever modifications are made, the style remains consistent throughout the +project and there's no point arguing about style in every code review. + +The ultimate goal is that the code YAPF produces is as good as the code that a +programmer would write if they were following the style guide. It takes away +some of the drudgery of maintaining your code. + +.. footer:: + + YAPF is not an official Google product (experimental or otherwise), it is + just code that happens to be owned by Google. + +.. contents:: + + +Installation +============ + +To install YAPF from PyPI: + +.. code-block:: shell + + $ pip install yapf + +(optional) If you are using Python 2.7 and want to enable multiprocessing: + +.. code-block:: shell + + $ pip install futures + +YAPF is still considered in "alpha" stage, and the released version may change +often; therefore, the best way to keep up-to-date with the latest development +is to clone this repository. + +Note that if you intend to use YAPF as a command-line tool rather than as a +library, installation is not necessary. YAPF supports being run as a directory +by the Python interpreter. If you cloned/unzipped YAPF into ``DIR``, it's +possible to run: + +.. code-block:: shell + + $ PYTHONPATH=DIR python DIR/yapf [options] ... + + +Python versions +=============== + +YAPF supports Python 2.7 and 3.6.4+. (Note that some Python 3 features may fail +to parse with Python versions before 3.6.4.) + +YAPF requires the code it formats to be valid Python for the version YAPF itself +runs under. Therefore, if you format Python 3 code with YAPF, run YAPF itself +under Python 3 (and similarly for Python 2). + + +Usage +===== + +Options:: + + usage: yapf [-h] [-v] [-d | -i] [-r | -l START-END] [-e PATTERN] + [--style STYLE] [--style-help] [--no-local-style] [-p] + [-vv] + [files [files ...]] + + Formatter for Python code. + + positional arguments: + files + + optional arguments: + -h, --help show this help message and exit + -v, --version show version number and exit + -d, --diff print the diff for the fixed source + -i, --in-place make changes to files in place + -r, --recursive run recursively over directories + -l START-END, --lines START-END + range of lines to reformat, one-based + -e PATTERN, --exclude PATTERN + patterns for files to exclude from formatting + --style STYLE specify formatting style: either a style name (for + example "pep8" or "google"), or the name of a file + with style settings. The default is pep8 unless a + .style.yapf or setup.cfg or pyproject.toml file + located in the same directory as the source or one of + its parent directories (for stdin, the current + directory is used). + --style-help show style settings and exit; this output can be saved + to .style.yapf to make your settings permanent + --no-local-style don't search for local style definition + -p, --parallel Run yapf in parallel when formatting multiple files. + Requires concurrent.futures in Python 2.X + -vv, --verbose Print out file names while processing + + +------------ +Return Codes +------------ + +Normally YAPF returns zero on successful program termination and non-zero otherwise. + +If ``--diff`` is supplied, YAPF returns zero when no changes were necessary, non-zero +otherwise (including program error). You can use this in a CI workflow to test that code +has been YAPF-formatted. + +--------------------------------------------- +Excluding files from formatting (.yapfignore) +--------------------------------------------- + +In addition to exclude patterns provided on commandline, YAPF looks for additional +patterns specified in a file named ``.yapfignore`` located in the working directory from +which YAPF is invoked. + +``.yapfignore``'s syntax is similar to UNIX's filename pattern matching:: + + * matches everything + ? matches any single character + [seq] matches any character in seq + [!seq] matches any character not in seq + +Note that no entry should begin with `./`. + + +Formatting style +================ + +The formatting style used by YAPF is configurable and there are many "knobs" +that can be used to tune how YAPF does formatting. See the ``style.py`` module +for the full list. + +To control the style, run YAPF with the ``--style`` argument. It accepts one of +the predefined styles (e.g., ``pep8`` or ``google``), a path to a configuration +file that specifies the desired style, or a dictionary of key/value pairs. + +The config file is a simple listing of (case-insensitive) ``key = value`` pairs +with a ``[yapf]`` heading. For example: + +.. code-block:: ini + + [yapf] + based_on_style = pep8 + spaces_before_comment = 4 + split_before_logical_operator = true + +The ``based_on_style`` setting determines which of the predefined styles this +custom style is based on (think of it like subclassing). Four +styles are predefined: + +- ``pep8`` (default) +- ``google`` (based off of the `Google Python Style Guide`_) +- ``yapf`` (for use with Google open source projects) +- ``facebook`` + +.. _`Google Python Style Guide`: https://github.com/google/styleguide/blob/gh-pages/pyguide.md + +See ``_STYLE_NAME_TO_FACTORY`` in style.py_ for details. + +.. _style.py: https://github.com/google/yapf/blob/main/yapf/yapflib/style.py + +It's also possible to do the same on the command line with a dictionary. For +example: + +.. code-block:: shell + + --style='{based_on_style: pep8, indent_width: 2}' + +This will take the ``pep8`` base style and modify it to have two space +indentations. + +YAPF will search for the formatting style in the following manner: + +1. Specified on the command line +2. In the ``[style]`` section of a ``.style.yapf`` file in either the current + directory or one of its parent directories. +3. In the ``[yapf]`` section of a ``setup.cfg`` file in either the current + directory or one of its parent directories. +4. In the ``[tool.yapf]`` section of a ``pyproject.toml`` file in either the current + directory or one of its parent directories. +5. In the ``[style]`` section of a ``~/.config/yapf/style`` file in your home + directory. + +If none of those files are found, the default style is used (PEP8). + + +Example +======= + +An example of the type of formatting that YAPF can do, it will take this ugly +code: + +.. code-block:: python + + x = { 'a':37,'b':42, + + 'c':927} + + y = 'hello ''world' + z = 'hello '+'world' + a = 'hello {}'.format('world') + class foo ( object ): + def f (self ): + return 37*-+2 + def g(self, x,y=42): + return y + def f ( a ) : + return 37+-+a[42-x : y**3] + +and reformat it into: + +.. code-block:: python + + x = {'a': 37, 'b': 42, 'c': 927} + + y = 'hello ' 'world' + z = 'hello ' + 'world' + a = 'hello {}'.format('world') + + + class foo(object): + def f(self): + return 37 * -+2 + + def g(self, x, y=42): + return y + + + def f(a): + return 37 + -+a[42 - x:y**3] + + +Example as a module +=================== + +The two main APIs for calling yapf are ``FormatCode`` and ``FormatFile``, these +share several arguments which are described below: + +.. code-block:: python + + >>> from yapf.yapflib.yapf_api import FormatCode # reformat a string of code + + >>> FormatCode("f ( a = 1, b = 2 )") + 'f(a=1, b=2)\n' + +A ``style_config`` argument: Either a style name or a path to a file that contains +formatting style settings. If None is specified, use the default style +as set in ``style.DEFAULT_STYLE_FACTORY``. + +.. code-block:: python + + >>> FormatCode("def g():\n return True", style_config='pep8') + 'def g():\n return True\n' + +A ``lines`` argument: A list of tuples of lines (ints), [start, end], +that we want to format. The lines are 1-based indexed. It can be used by +third-party code (e.g., IDEs) when reformatting a snippet of code rather +than a whole file. + +.. code-block:: python + + >>> FormatCode("def g( ):\n a=1\n b = 2\n return a==b", lines=[(1, 1), (2, 3)]) + 'def g():\n a = 1\n b = 2\n return a==b\n' + +A ``print_diff`` (bool): Instead of returning the reformatted source, return a +diff that turns the formatted source into reformatter source. + +.. code-block:: python + + >>> print(FormatCode("a==b", filename="foo.py", print_diff=True)) + --- foo.py (original) + +++ foo.py (reformatted) + @@ -1 +1 @@ + -a==b + +a == b + +Note: the ``filename`` argument for ``FormatCode`` is what is inserted into +the diff, the default is ````. + +``FormatFile`` returns reformatted code from the passed file along with its encoding: + +.. code-block:: python + + >>> from yapf.yapflib.yapf_api import FormatFile # reformat a file + + >>> print(open("foo.py").read()) # contents of file + a==b + + >>> FormatFile("foo.py") + ('a == b\n', 'utf-8') + +The ``in_place`` argument saves the reformatted code back to the file: + +.. code-block:: python + + >>> FormatFile("foo.py", in_place=True) + (None, 'utf-8') + + >>> print(open("foo.py").read()) # contents of file (now fixed) + a == b + +Formatting diffs +================ + +Options:: + + usage: yapf-diff [-h] [-i] [-p NUM] [--regex PATTERN] [--iregex PATTERN][-v] + [--style STYLE] [--binary BINARY] + + This script reads input from a unified diff and reformats all the changed + lines. This is useful to reformat all the lines touched by a specific patch. + Example usage for git/svn users: + + git diff -U0 --no-color --relative HEAD^ | yapf-diff -i + svn diff --diff-cmd=diff -x-U0 | yapf-diff -p0 -i + + It should be noted that the filename contained in the diff is used + unmodified to determine the source file to update. Users calling this script + directly should be careful to ensure that the path in the diff is correct + relative to the current working directory. + + optional arguments: + -h, --help show this help message and exit + -i, --in-place apply edits to files instead of displaying a diff + -p NUM, --prefix NUM strip the smallest prefix containing P slashes + --regex PATTERN custom pattern selecting file paths to reformat + (case sensitive, overrides -iregex) + --iregex PATTERN custom pattern selecting file paths to reformat + (case insensitive, overridden by -regex) + -v, --verbose be more verbose, ineffective without -i + --style STYLE specify formatting style: either a style name (for + example "pep8" or "google"), or the name of a file + with style settings. The default is pep8 unless a + .style.yapf or setup.cfg or pyproject.toml file + located in the same directory as the source or one of + its parent directories (for stdin, the current + directory is used). + --binary BINARY location of binary to use for yapf + +Knobs +===== + +``ALIGN_CLOSING_BRACKET_WITH_VISUAL_INDENT`` + Align closing bracket with visual indentation. + +``ALLOW_MULTILINE_LAMBDAS`` + Allow lambdas to be formatted on more than one line. + +``ALLOW_MULTILINE_DICTIONARY_KEYS`` + Allow dictionary keys to exist on multiple lines. For example: + + .. code-block:: python + + x = { + ('this is the first element of a tuple', + 'this is the second element of a tuple'): + value, + } + +``ALLOW_SPLIT_BEFORE_DEFAULT_OR_NAMED_ASSIGNS`` + Allow splitting before a default / named assignment in an argument list. + +``ALLOW_SPLIT_BEFORE_DICT_VALUE`` + Allow splits before the dictionary value. + +``ARITHMETIC_PRECEDENCE_INDICATION`` + Let spacing indicate operator precedence. For example: + + .. code-block:: python + + a = 1 * 2 + 3 / 4 + b = 1 / 2 - 3 * 4 + c = (1 + 2) * (3 - 4) + d = (1 - 2) / (3 + 4) + e = 1 * 2 - 3 + f = 1 + 2 + 3 + 4 + + will be formatted as follows to indicate precedence: + + .. code-block:: python + + a = 1*2 + 3/4 + b = 1/2 - 3*4 + c = (1+2) * (3-4) + d = (1-2) / (3+4) + e = 1*2 - 3 + f = 1 + 2 + 3 + 4 + +``BLANK_LINE_BEFORE_NESTED_CLASS_OR_DEF`` + Insert a blank line before a ``def`` or ``class`` immediately nested within + another ``def`` or ``class``. For example: + + .. code-block:: python + + class Foo: + # <------ this blank line + def method(): + pass + +``BLANK_LINE_BEFORE_MODULE_DOCSTRING`` + Insert a blank line before a module docstring. + +``BLANK_LINE_BEFORE_CLASS_DOCSTRING`` + Insert a blank line before a class-level docstring. + +``BLANK_LINES_AROUND_TOP_LEVEL_DEFINITION`` + Sets the number of desired blank lines surrounding top-level function and + class definitions. For example: + + .. code-block:: python + + class Foo: + pass + # <------ having two blank lines here + # <------ is the default setting + class Bar: + pass + +``BLANK_LINES_BETWEEN_TOP_LEVEL_IMPORTS_AND_VARIABLES`` + Sets the number of desired blank lines between top-level imports and + variable definitions. Useful for compatibility with tools like isort. + +``COALESCE_BRACKETS`` + Do not split consecutive brackets. Only relevant when + ``DEDENT_CLOSING_BRACKETS`` or ``INDENT_CLOSING_BRACKETS`` + is set. For example: + + .. code-block:: python + + call_func_that_takes_a_dict( + { + 'key1': 'value1', + 'key2': 'value2', + } + ) + + would reformat to: + + .. code-block:: python + + call_func_that_takes_a_dict({ + 'key1': 'value1', + 'key2': 'value2', + }) + + +``COLUMN_LIMIT`` + The column limit (or max line-length) + +``CONTINUATION_ALIGN_STYLE`` + The style for continuation alignment. Possible values are: + + - ``SPACE``: Use spaces for continuation alignment. This is default + behavior. + - ``FIXED``: Use fixed number (CONTINUATION_INDENT_WIDTH) of columns + (ie: CONTINUATION_INDENT_WIDTH/INDENT_WIDTH tabs or CONTINUATION_INDENT_WIDTH + spaces) for continuation alignment. + - ``VALIGN-RIGHT``: Vertically align continuation lines to multiple of + INDENT_WIDTH columns. Slightly right (one tab or a few spaces) if cannot + vertically align continuation lines with indent characters. + +``CONTINUATION_INDENT_WIDTH`` + Indent width used for line continuations. + +``DEDENT_CLOSING_BRACKETS`` + Put closing brackets on a separate line, dedented, if the bracketed + expression can't fit in a single line. Applies to all kinds of brackets, + including function definitions and calls. For example: + + .. code-block:: python + + config = { + 'key1': 'value1', + 'key2': 'value2', + } # <--- this bracket is dedented and on a separate line + + time_series = self.remote_client.query_entity_counters( + entity='dev3246.region1', + key='dns.query_latency_tcp', + transform=Transformation.AVERAGE(window=timedelta(seconds=60)), + start_ts=now()-timedelta(days=3), + end_ts=now(), + ) # <--- this bracket is dedented and on a separate line + +``DISABLE_ENDING_COMMA_HEURISTIC`` + Disable the heuristic which places each list element on a separate line if + the list is comma-terminated. + +``EACH_DICT_ENTRY_ON_SEPARATE_LINE`` + Place each dictionary entry onto its own line. + +``FORCE_MULTILINE_DICT`` + Respect EACH_DICT_ENTRY_ON_SEPARATE_LINE even if the line is shorter than + COLUMN_LIMIT. + +``I18N_COMMENT`` + The regex for an internationalization comment. The presence of this comment + stops reformatting of that line, because the comments are required to be + next to the string they translate. + +``I18N_FUNCTION_CALL`` + The internationalization function call names. The presence of this function + stops reformatting on that line, because the string it has cannot be moved + away from the i18n comment. + +``INDENT_DICTIONARY_VALUE`` + Indent the dictionary value if it cannot fit on the same line as the + dictionary key. For example: + + .. code-block:: python + + config = { + 'key1': + 'value1', + 'key2': value1 + + value2, + } + +``INDENT_WIDTH`` + The number of columns to use for indentation. + +``INDENT_BLANK_LINES`` + Set to ``True`` to prefer indented blank lines rather than empty + +``INDENT_CLOSING_BRACKETS`` + Put closing brackets on a separate line, indented, if the bracketed + expression can't fit in a single line. Applies to all kinds of brackets, + including function definitions and calls. For example: + + .. code-block:: python + + config = { + 'key1': 'value1', + 'key2': 'value2', + } # <--- this bracket is indented and on a separate line + + time_series = self.remote_client.query_entity_counters( + entity='dev3246.region1', + key='dns.query_latency_tcp', + transform=Transformation.AVERAGE(window=timedelta(seconds=60)), + start_ts=now()-timedelta(days=3), + end_ts=now(), + ) # <--- this bracket is indented and on a separate line + +``JOIN_MULTIPLE_LINES`` + Join short lines into one line. E.g., single line ``if`` statements. + +``NO_SPACES_AROUND_SELECTED_BINARY_OPERATORS`` + Do not include spaces around selected binary operators. For example: + + .. code-block:: python + + 1 + 2 * 3 - 4 / 5 + + will be formatted as follows when configured with ``*``, ``/``: + + .. code-block:: python + + 1 + 2*3 - 4/5 + +``SPACES_AROUND_POWER_OPERATOR`` + Set to ``True`` to prefer using spaces around ``**``. + +``SPACES_AROUND_DEFAULT_OR_NAMED_ASSIGN`` + Set to ``True`` to prefer spaces around the assignment operator for default + or keyword arguments. + +``SPACES_AROUND_DICT_DELIMITERS`` + Adds a space after the opening '{' and before the ending '}' dict delimiters. + + .. code-block:: python + + {1: 2} + + will be formatted as: + + .. code-block:: python + + { 1: 2 } + +``SPACES_AROUND_LIST_DELIMITERS`` + Adds a space after the opening '[' and before the ending ']' list delimiters. + + .. code-block:: python + + [1, 2] + + will be formatted as: + + .. code-block:: python + + [ 1, 2 ] + +``SPACES_AROUND_SUBSCRIPT_COLON`` + Use spaces around the subscript / slice operator. For example: + + .. code-block:: python + + my_list[1 : 10 : 2] + +``SPACES_AROUND_TUPLE_DELIMITERS`` + Adds a space after the opening '(' and before the ending ')' tuple delimiters. + + .. code-block:: python + + (1, 2, 3) + + will be formatted as: + + .. code-block:: python + + ( 1, 2, 3 ) + +``SPACES_BEFORE_COMMENT`` + The number of spaces required before a trailing comment. + This can be a single value (representing the number of spaces + before each trailing comment) or list of of values (representing + alignment column values; trailing comments within a block will + be aligned to the first column value that is greater than the maximum + line length within the block). For example: + + With ``spaces_before_comment=5``: + + .. code-block:: python + + 1 + 1 # Adding values + + will be formatted as: + + .. code-block:: python + + 1 + 1 # Adding values <-- 5 spaces between the end of the statement and comment + + With ``spaces_before_comment=15, 20``: + + .. code-block:: python + + 1 + 1 # Adding values + two + two # More adding + + longer_statement # This is a longer statement + short # This is a shorter statement + + a_very_long_statement_that_extends_beyond_the_final_column # Comment + short # This is a shorter statement + + will be formatted as: + + .. code-block:: python + + 1 + 1 # Adding values <-- end of line comments in block aligned to col 15 + two + two # More adding + + longer_statement # This is a longer statement <-- end of line comments in block aligned to col 20 + short # This is a shorter statement + + a_very_long_statement_that_extends_beyond_the_final_column # Comment <-- the end of line comments are aligned based on the line length + short # This is a shorter statement + +``SPACE_BETWEEN_ENDING_COMMA_AND_CLOSING_BRACKET`` + Insert a space between the ending comma and closing bracket of a list, etc. + +``SPACE_INSIDE_BRACKETS`` + Use spaces inside brackets, braces, and parentheses. For example: + + .. code-block:: python + + method_call( 1 ) + my_dict[ 3 ][ 1 ][ get_index( *args, **kwargs ) ] + my_set = { 1, 2, 3 } + +``SPLIT_ARGUMENTS_WHEN_COMMA_TERMINATED`` + Split before arguments if the argument list is terminated by a comma. + +``SPLIT_ALL_COMMA_SEPARATED_VALUES`` + If a comma separated list (``dict``, ``list``, ``tuple``, or function + ``def``) is on a line that is too long, split such that all elements + are on a single line. + +``SPLIT_ALL_TOP_LEVEL_COMMA_SEPARATED_VALUES`` + Variation on ``SPLIT_ALL_COMMA_SEPARATED_VALUES`` in which, if a + subexpression with a comma fits in its starting line, then the + subexpression is not split. This avoids splits like the one for + ``b`` in this code: + + .. code-block:: python + + abcdef( + aReallyLongThing: int, + b: [Int, + Int]) + + With the new knob this is split as: + + .. code-block:: python + + abcdef( + aReallyLongThing: int, + b: [Int, Int]) + +``SPLIT_BEFORE_BITWISE_OPERATOR`` + Set to ``True`` to prefer splitting before ``&``, ``|`` or ``^`` rather + than after. + +``SPLIT_BEFORE_ARITHMETIC_OPERATOR`` + Set to ``True`` to prefer splitting before ``+``, ``-``, ``*``, ``/``, ``//``, + or ``@`` rather than after. + +``SPLIT_BEFORE_CLOSING_BRACKET`` + Split before the closing bracket if a ``list`` or ``dict`` literal doesn't + fit on a single line. + +``SPLIT_BEFORE_DICT_SET_GENERATOR`` + Split before a dictionary or set generator (comp_for). For example, note + the split before the ``for``: + + .. code-block:: python + + foo = { + variable: 'Hello world, have a nice day!' + for variable in bar if variable != 42 + } + +``SPLIT_BEFORE_DOT`` + Split before the ``.`` if we need to split a longer expression: + + .. code-block:: python + + foo = ('This is a really long string: {}, {}, {}, {}'.format(a, b, c, d)) + + would reformat to something like: + + .. code-block:: python + + foo = ('This is a really long string: {}, {}, {}, {}' + .format(a, b, c, d)) + +``SPLIT_BEFORE_EXPRESSION_AFTER_OPENING_PAREN`` + Split after the opening paren which surrounds an expression if it doesn't + fit on a single line. + +``SPLIT_BEFORE_FIRST_ARGUMENT`` + If an argument / parameter list is going to be split, then split before the + first argument. + +``SPLIT_BEFORE_LOGICAL_OPERATOR`` + Set to ``True`` to prefer splitting before ``and`` or ``or`` rather than + after. + +``SPLIT_BEFORE_NAMED_ASSIGNS`` + Split named assignments onto individual lines. + +``SPLIT_COMPLEX_COMPREHENSION`` + For list comprehensions and generator expressions with multiple clauses + (e.g multiple ``for`` calls, ``if`` filter expressions) and which need to + be reflowed, split each clause onto its own line. For example: + + .. code-block:: python + + result = [ + a_var + b_var for a_var in xrange(1000) for b_var in xrange(1000) + if a_var % b_var] + + would reformat to something like: + + .. code-block:: python + + result = [ + a_var + b_var + for a_var in xrange(1000) + for b_var in xrange(1000) + if a_var % b_var] + +``SPLIT_PENALTY_AFTER_OPENING_BRACKET`` + The penalty for splitting right after the opening bracket. + +``SPLIT_PENALTY_AFTER_UNARY_OPERATOR`` + The penalty for splitting the line after a unary operator. + +``SPLIT_PENALTY_ARITHMETIC_OPERATOR`` + The penalty of splitting the line around the ``+``, ``-``, ``*``, ``/``, + ``//``, ``%``, and ``@`` operators. + +``SPLIT_PENALTY_BEFORE_IF_EXPR`` + The penalty for splitting right before an ``if`` expression. + +``SPLIT_PENALTY_BITWISE_OPERATOR`` + The penalty of splitting the line around the ``&``, ``|``, and ``^`` + operators. + +``SPLIT_PENALTY_COMPREHENSION`` + The penalty for splitting a list comprehension or generator expression. + +``SPLIT_PENALTY_EXCESS_CHARACTER`` + The penalty for characters over the column limit. + +``SPLIT_PENALTY_FOR_ADDED_LINE_SPLIT`` + The penalty incurred by adding a line split to the unwrapped line. The more + line splits added the higher the penalty. + +``SPLIT_PENALTY_IMPORT_NAMES`` + The penalty of splitting a list of ``import as`` names. For example: + + .. code-block:: python + + from a_very_long_or_indented_module_name_yada_yad import (long_argument_1, + long_argument_2, + long_argument_3) + + would reformat to something like: + + .. code-block:: python + + from a_very_long_or_indented_module_name_yada_yad import ( + long_argument_1, long_argument_2, long_argument_3) + +``SPLIT_PENALTY_LOGICAL_OPERATOR`` + The penalty of splitting the line around the ``and`` and ``or`` operators. + +``USE_TABS`` + Use the Tab character for indentation. + +(Potentially) Frequently Asked Questions +======================================== + +-------------------------------------------- +Why does YAPF destroy my awesome formatting? +-------------------------------------------- + +YAPF tries very hard to get the formatting correct. But for some code, it won't +be as good as hand-formatting. In particular, large data literals may become +horribly disfigured under YAPF. + +The reasons for this are manyfold. In short, YAPF is simply a tool to help +with development. It will format things to coincide with the style guide, but +that may not equate with readability. + +What can be done to alleviate this situation is to indicate regions YAPF should +ignore when reformatting something: + +.. code-block:: python + + # yapf: disable + FOO = { + # ... some very large, complex data literal. + } + + BAR = [ + # ... another large data literal. + ] + # yapf: enable + +You can also disable formatting for a single literal like this: + +.. code-block:: python + + BAZ = { + (1, 2, 3, 4), + (5, 6, 7, 8), + (9, 10, 11, 12), + } # yapf: disable + +To preserve the nice dedented closing brackets, use the +``dedent_closing_brackets`` in your style. Note that in this case all +brackets, including function definitions and calls, are going to use +that style. This provides consistency across the formatted codebase. + +------------------------------- +Why Not Improve Existing Tools? +------------------------------- + +We wanted to use clang-format's reformatting algorithm. It's very powerful and +designed to come up with the best formatting possible. Existing tools were +created with different goals in mind, and would require extensive modifications +to convert to using clang-format's algorithm. + +----------------------------- +Can I Use YAPF In My Program? +----------------------------- + +Please do! YAPF was designed to be used as a library as well as a command line +tool. This means that a tool or IDE plugin is free to use YAPF. + +----------------------------------------- +I still get non Pep8 compliant code! Why? +----------------------------------------- + +YAPF tries very hard to be fully PEP 8 compliant. However, it is paramount +to not risk altering the semantics of your code. Thus, YAPF tries to be as +safe as possible and does not change the token stream +(e.g., by adding parentheses). +All these cases however, can be easily fixed manually. For instance, + +.. code-block:: python + + from my_package import my_function_1, my_function_2, my_function_3, my_function_4, my_function_5 + + FOO = my_variable_1 + my_variable_2 + my_variable_3 + my_variable_4 + my_variable_5 + my_variable_6 + my_variable_7 + my_variable_8 + +won't be split, but you can easily get it right by just adding parentheses: + +.. code-block:: python + + from my_package import (my_function_1, my_function_2, my_function_3, + my_function_4, my_function_5) + + FOO = (my_variable_1 + my_variable_2 + my_variable_3 + my_variable_4 + + my_variable_5 + my_variable_6 + my_variable_7 + my_variable_8) + +Gory Details +============ + +---------------- +Algorithm Design +---------------- + +The main data structure in YAPF is the ``UnwrappedLine`` object. It holds a list +of ``FormatToken``\s, that we would want to place on a single line if there were +no column limit. An exception being a comment in the middle of an expression +statement will force the line to be formatted on more than one line. The +formatter works on one ``UnwrappedLine`` object at a time. + +An ``UnwrappedLine`` typically won't affect the formatting of lines before or +after it. There is a part of the algorithm that may join two or more +``UnwrappedLine``\s into one line. For instance, an if-then statement with a +short body can be placed on a single line: + +.. code-block:: python + + if a == 42: continue + +YAPF's formatting algorithm creates a weighted tree that acts as the solution +space for the algorithm. Each node in the tree represents the result of a +formatting decision --- i.e., whether to split or not to split before a token. +Each formatting decision has a cost associated with it. Therefore, the cost is +realized on the edge between two nodes. (In reality, the weighted tree doesn't +have separate edge objects, so the cost resides on the nodes themselves.) + +For example, take the following Python code snippet. For the sake of this +example, assume that line (1) violates the column limit restriction and needs to +be reformatted. + +.. code-block:: python + + def xxxxxxxxxxx(aaaaaaaaaaaa, bbbbbbbbb, cccccccc, dddddddd, eeeeee): # 1 + pass # 2 + +For line (1), the algorithm will build a tree where each node (a +``FormattingDecisionState`` object) is the state of the line at that token given +the decision to split before the token or not. Note: the ``FormatDecisionState`` +objects are copied by value so each node in the graph is unique and a change in +one doesn't affect other nodes. + +Heuristics are used to determine the costs of splitting or not splitting. +Because a node holds the state of the tree up to a token's insertion, it can +easily determine if a splitting decision will violate one of the style +requirements. For instance, the heuristic is able to apply an extra penalty to +the edge when not splitting between the previous token and the one being added. + +There are some instances where we will never want to split the line, because +doing so will always be detrimental (i.e., it will require a backslash-newline, +which is very rarely desirable). For line (1), we will never want to split the +first three tokens: ``def``, ``xxxxxxxxxxx``, and ``(``. Nor will we want to +split between the ``)`` and the ``:`` at the end. These regions are said to be +"unbreakable." This is reflected in the tree by there not being a "split" +decision (left hand branch) within the unbreakable region. + +Now that we have the tree, we determine what the "best" formatting is by finding +the path through the tree with the lowest cost. + +And that's it! + + diff --git a/.venv/lib/python3.9/site-packages/yapf-0.31.0.dist-info/RECORD b/.venv/lib/python3.9/site-packages/yapf-0.31.0.dist-info/RECORD new file mode 100644 index 00000000..eb5ba6cb --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapf-0.31.0.dist-info/RECORD @@ -0,0 +1,109 @@ +../../../bin/yapf,sha256=WCBLcotr5g3fIFZ1Ctzhm3Z757WtSRcsm4KqVz3CdkI,252 +../../../bin/yapf-diff,sha256=mDli66ek7j4vjfdisNZkay-ik3P2A1D5TDeoNJnWHag,276 +yapf-0.31.0.dist-info/AUTHORS,sha256=GjWR8Xly-Dl9VrKuzTLOvRoCbMNy278DxK2Sud9LcCw,307 +yapf-0.31.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +yapf-0.31.0.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358 +yapf-0.31.0.dist-info/METADATA,sha256=LVZ2UdIdDWvcyZvycrgLTvTQgk2I3p9lg5Uu49jWAYA,34036 +yapf-0.31.0.dist-info/RECORD,, +yapf-0.31.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +yapf-0.31.0.dist-info/WHEEL,sha256=8zNYZbwQSXoB9IfXOjPfeNwvAsALAjffgk27FqvCWbo,110 +yapf-0.31.0.dist-info/entry_points.txt,sha256=fc7WCcYyJWR7Twl8ubci_UQz4gt-U9VYkXKDZODxEHA,94 +yapf-0.31.0.dist-info/top_level.txt,sha256=Y1sKm3Or1-KlBNXU8zv3IuXSJx1lAU-I_Cv_qTNq-WQ,15 +yapf/__init__.py,sha256=vQ4lF_BZ0lW_KZF7-77Cljs8uZaSmMyflcZ4Q-xpYJg,12493 +yapf/__main__.py,sha256=jJ5Fcwe6tbXxqSuUxRO3uel44tHP53vVScojlus0cBM,680 +yapf/__pycache__/__init__.cpython-39.pyc,, +yapf/__pycache__/__main__.cpython-39.pyc,, +yapf/yapflib/__init__.py,sha256=abBqhqqPP10jK6pNCEt5VDVZfYK0u0fQugTp2AC0K4k,596 +yapf/yapflib/__pycache__/__init__.cpython-39.pyc,, +yapf/yapflib/__pycache__/blank_line_calculator.cpython-39.pyc,, +yapf/yapflib/__pycache__/comment_splicer.cpython-39.pyc,, +yapf/yapflib/__pycache__/continuation_splicer.cpython-39.pyc,, +yapf/yapflib/__pycache__/errors.cpython-39.pyc,, +yapf/yapflib/__pycache__/file_resources.cpython-39.pyc,, +yapf/yapflib/__pycache__/format_decision_state.cpython-39.pyc,, +yapf/yapflib/__pycache__/format_token.cpython-39.pyc,, +yapf/yapflib/__pycache__/identify_container.cpython-39.pyc,, +yapf/yapflib/__pycache__/line_joiner.cpython-39.pyc,, +yapf/yapflib/__pycache__/object_state.cpython-39.pyc,, +yapf/yapflib/__pycache__/py3compat.cpython-39.pyc,, +yapf/yapflib/__pycache__/pytree_unwrapper.cpython-39.pyc,, +yapf/yapflib/__pycache__/pytree_utils.cpython-39.pyc,, +yapf/yapflib/__pycache__/pytree_visitor.cpython-39.pyc,, +yapf/yapflib/__pycache__/reformatter.cpython-39.pyc,, +yapf/yapflib/__pycache__/split_penalty.cpython-39.pyc,, +yapf/yapflib/__pycache__/style.cpython-39.pyc,, +yapf/yapflib/__pycache__/subtype_assigner.cpython-39.pyc,, +yapf/yapflib/__pycache__/unwrapped_line.cpython-39.pyc,, +yapf/yapflib/__pycache__/verifier.cpython-39.pyc,, +yapf/yapflib/__pycache__/yapf_api.cpython-39.pyc,, +yapf/yapflib/blank_line_calculator.py,sha256=BIjdJNXN-jbYak17yM-GG1cTgntlRMxgfr7tm1w7ZC4,6297 +yapf/yapflib/comment_splicer.py,sha256=zZ3NQNgSACygyvc-zJb_wsdL1E_WcP-kwXYPHANGY4I,15240 +yapf/yapflib/continuation_splicer.py,sha256=5_Npzn98SLISqopH2hB3dSTBDVVs_iuCZBd-NJTNOKc,1776 +yapf/yapflib/errors.py,sha256=_fQDh4NEOXANkcm-Y7FobBI6g19szgqR38Hfy_Fmiqw,843 +yapf/yapflib/file_resources.py,sha256=RTMBisikbhupG-oYfr9YM4p2eXWO-NFCiidwia-UeDM,8570 +yapf/yapflib/format_decision_state.py,sha256=MM6qXrBNBUVizlmdIn36pEu7JmVdGTeSwh1IjvVEDEE,48673 +yapf/yapflib/format_token.py,sha256=KGCuDte6k11jBWXmB99o2DhNpvg0JKuedRlkdhDmQQI,12355 +yapf/yapflib/identify_container.py,sha256=ILh2GgBrcmQMvz0g9wPBzIQsOJG1KlmD_mAUR3SruHM,2279 +yapf/yapflib/line_joiner.py,sha256=jAc7Gt6sIbcbVy23y6fyD8l8jXMIyWmP4fWTSTThlew,3924 +yapf/yapflib/object_state.py,sha256=qO18NO2tpgJ9EegxD7DwccGy2PKFymg7lAyffMdY54E,8130 +yapf/yapflib/py3compat.py,sha256=nEKVr2KdYf-fXubA01E88ORixSy7AEUBKoZJOw6ZmfA,4228 +yapf/yapflib/pytree_unwrapper.py,sha256=6gODwJkN5j24jjl2UdhakaNbbm5tzeHRx3TVdH50Gzk,14899 +yapf/yapflib/pytree_utils.py,sha256=DvvGIOmN3C3PzvLqpeSEfaCtDq3075fcOTT22EKrc-Q,10864 +yapf/yapflib/pytree_visitor.py,sha256=qzH-34TqPA776YQIiVv63SfYRlOuxJiH2x3ynLxshmE,4528 +yapf/yapflib/reformatter.py,sha256=H3EaOpZ9YAd5q91cJGxMCW27gqdi78-OT5RMcbeHq9o,28773 +yapf/yapflib/split_penalty.py,sha256=cTqWMa0q_IBkM3q33upQyS2XqkLdcjoHdCaNqnPQGrA,24450 +yapf/yapflib/style.py,sha256=uXM1_0O6N_wpGqDEYbVca0Mp9ah-FTinJuMBnwCqFyY,31772 +yapf/yapflib/subtype_assigner.py,sha256=HlGVcJhmPj1r4DRSP8Nz0JHz-cLbgTCnZzPyW5YRiQE,20220 +yapf/yapflib/unwrapped_line.py,sha256=z9ug5YteMfYvBDp74w55wljXgGChcxykZ4Bt5u6hlpA,25819 +yapf/yapflib/verifier.py,sha256=qT5jlM1j96jeV7YwpdCczKX8vKm51I41TE1mkLX8dkk,3042 +yapf/yapflib/yapf_api.py,sha256=acHd6Mqglnz23VMwHuz2PaBfLn5aCaH0EZSqxowj01Y,10902 +yapftests/__init__.py,sha256=abBqhqqPP10jK6pNCEt5VDVZfYK0u0fQugTp2AC0K4k,596 +yapftests/__pycache__/__init__.cpython-39.pyc,, +yapftests/__pycache__/blank_line_calculator_test.cpython-39.pyc,, +yapftests/__pycache__/comment_splicer_test.cpython-39.pyc,, +yapftests/__pycache__/file_resources_test.cpython-39.pyc,, +yapftests/__pycache__/format_decision_state_test.cpython-39.pyc,, +yapftests/__pycache__/format_token_test.cpython-39.pyc,, +yapftests/__pycache__/line_joiner_test.cpython-39.pyc,, +yapftests/__pycache__/main_test.cpython-39.pyc,, +yapftests/__pycache__/pytree_unwrapper_test.cpython-39.pyc,, +yapftests/__pycache__/pytree_utils_test.cpython-39.pyc,, +yapftests/__pycache__/pytree_visitor_test.cpython-39.pyc,, +yapftests/__pycache__/reformatter_basic_test.cpython-39.pyc,, +yapftests/__pycache__/reformatter_buganizer_test.cpython-39.pyc,, +yapftests/__pycache__/reformatter_facebook_test.cpython-39.pyc,, +yapftests/__pycache__/reformatter_pep8_test.cpython-39.pyc,, +yapftests/__pycache__/reformatter_python3_test.cpython-39.pyc,, +yapftests/__pycache__/reformatter_style_config_test.cpython-39.pyc,, +yapftests/__pycache__/reformatter_verify_test.cpython-39.pyc,, +yapftests/__pycache__/split_penalty_test.cpython-39.pyc,, +yapftests/__pycache__/style_test.cpython-39.pyc,, +yapftests/__pycache__/subtype_assigner_test.cpython-39.pyc,, +yapftests/__pycache__/unwrapped_line_test.cpython-39.pyc,, +yapftests/__pycache__/utils.cpython-39.pyc,, +yapftests/__pycache__/yapf_test.cpython-39.pyc,, +yapftests/__pycache__/yapf_test_helper.cpython-39.pyc,, +yapftests/blank_line_calculator_test.py,sha256=gFd4ZB07U5vrjMKQokyGgKqQWrVD2Xy0VegYAJdXZ94,9157 +yapftests/comment_splicer_test.py,sha256=smvYTJaG99DLdK7nUcLZqCLuJxnzuqQUDmDfujGl3qg,11005 +yapftests/file_resources_test.py,sha256=PycS_nslonsWNHTaCMskA55ARgsA3M3kDTkqfyYGEfw,16831 +yapftests/format_decision_state_test.py,sha256=-TP1msflnJSN3tOX1tqXZCO_73OSm8xsbeu-z9AdDlA,4422 +yapftests/format_token_test.py,sha256=50pv1Gll3nHcPKqa-ycK9dNyrzWFvfZQPYCXt82Oz-g,2899 +yapftests/line_joiner_test.py,sha256=XPGvgP-yvbWGO7MoPZc1wsIhimV-o73MAireSHF_K_M,2616 +yapftests/main_test.py,sha256=XJdvrvhxJ7LfbeHobIWbByIo3DG12v0W9VpItMJbgl0,4174 +yapftests/pytree_unwrapper_test.py,sha256=nBfqDrSpbIzC0ukiecq6P-vXcY_AXQrIPRD_eZ-nHrQ,9368 +yapftests/pytree_utils_test.py,sha256=5NeI1iorER5zipo_CwIsm5FBWtWqeeOjalygUMNaWas,8140 +yapftests/pytree_visitor_test.py,sha256=ljVsmUmIDNGnOpbgoEOmYL6SV-KAIDZoNfiALbKhrP0,4068 +yapftests/reformatter_basic_test.py,sha256=j6E_gPKdjIS8DvTyKcyFD-O0QQt3W_jLLofJ89eRU7c,109414 +yapftests/reformatter_buganizer_test.py,sha256=_vKdQnTEaKwr0PTdi3tTz6i42DvQTQFh_YVa9kd9SHU,86368 +yapftests/reformatter_facebook_test.py,sha256=4G48CTQRLdBVieXSqhQs5U-6pNx0-C8Wjo2bMB5weDI,15205 +yapftests/reformatter_pep8_test.py,sha256=CM5M31rt6tZybbHYJ_j8_K1aZ02qXGUkNillMtch-nk,32620 +yapftests/reformatter_python3_test.py,sha256=PxBeDahwz9RCxLkxaPYvfrHwlBfWN9xsf0rO_WNBkH4,14355 +yapftests/reformatter_style_config_test.py,sha256=6qUvf0gQX29fNS55mIDREQGMjDPTeo_bxDTdmoicEX0,7219 +yapftests/reformatter_verify_test.py,sha256=GbyweTg98AOuV-H5sHdIMOo4q7JV4hJGul4lzsiKuJg,3579 +yapftests/split_penalty_test.py,sha256=oMFpOlCXFxdFUL54npVVkQa3-CfYy3EowQCDbyqhYJI,7417 +yapftests/style_test.py,sha256=I_-yqomVusqtkB3_NO3OiUngx5PAoVBr7maETEN0cgc,11568 +yapftests/subtype_assigner_test.py,sha256=Dab-QW39T-M4k7Nkzd6weztyVPV9PbnxdUrqVs3_oTI,11409 +yapftests/unwrapped_line_test.py,sha256=EVmXcgMRATc468iIWpv3kaW1DyCve-xYJvEeKOj82LE,3218 +yapftests/utils.py,sha256=kbrj8PEnvmrV7kJUEOaIrqOGapkpXWYEoCVEqW2iugM,2708 +yapftests/yapf_test.py,sha256=vSasOEGPHVWNDSwHAZKUhp8V9nkv-ZTPPOtkbJTqcCA,62012 +yapftests/yapf_test_helper.py,sha256=KdxSdP3NKZiqUSba_reXRmW79ECvllFvax3hn7ryCQ4,2825 diff --git a/.venv/lib/python3.9/site-packages/yapf-0.31.0.dist-info/REQUESTED b/.venv/lib/python3.9/site-packages/yapf-0.31.0.dist-info/REQUESTED new file mode 100644 index 00000000..e69de29b diff --git a/.venv/lib/python3.9/site-packages/yapf-0.31.0.dist-info/WHEEL b/.venv/lib/python3.9/site-packages/yapf-0.31.0.dist-info/WHEEL new file mode 100644 index 00000000..8b701e93 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapf-0.31.0.dist-info/WHEEL @@ -0,0 +1,6 @@ +Wheel-Version: 1.0 +Generator: bdist_wheel (0.33.6) +Root-Is-Purelib: true +Tag: py2-none-any +Tag: py3-none-any + diff --git a/.venv/lib/python3.9/site-packages/yapf-0.31.0.dist-info/entry_points.txt b/.venv/lib/python3.9/site-packages/yapf-0.31.0.dist-info/entry_points.txt new file mode 100644 index 00000000..a08c5ad0 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapf-0.31.0.dist-info/entry_points.txt @@ -0,0 +1,4 @@ +[console_scripts] +yapf = yapf:run_main +yapf-diff = yapf.third_party.yapf_diff.yapf_diff:main + diff --git a/.venv/lib/python3.9/site-packages/yapf-0.31.0.dist-info/top_level.txt b/.venv/lib/python3.9/site-packages/yapf-0.31.0.dist-info/top_level.txt new file mode 100644 index 00000000..63289569 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapf-0.31.0.dist-info/top_level.txt @@ -0,0 +1,2 @@ +yapf +yapftests diff --git a/.venv/lib/python3.9/site-packages/yapf/__init__.py b/.venv/lib/python3.9/site-packages/yapf/__init__.py new file mode 100644 index 00000000..a70db848 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapf/__init__.py @@ -0,0 +1,369 @@ +# Copyright 2015 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""YAPF. + +YAPF uses the algorithm in clang-format to figure out the "best" formatting for +Python code. It looks at the program as a series of "unwrappable lines" --- +i.e., lines which, if there were no column limit, we would place all tokens on +that line. It then uses a priority queue to figure out what the best formatting +is --- i.e., the formatting with the least penalty. + +It differs from tools like autopep8 and pep8ify in that it doesn't just look for +violations of the style guide, but looks at the module as a whole, making +formatting decisions based on what's the best format for each line. + +If no filenames are specified, YAPF reads the code from stdin. +""" +from __future__ import print_function + +import argparse +import logging +import os +import sys + +from lib2to3.pgen2 import tokenize + +from yapf.yapflib import errors +from yapf.yapflib import file_resources +from yapf.yapflib import py3compat +from yapf.yapflib import style +from yapf.yapflib import yapf_api + +__version__ = '0.31.0' + + +def main(argv): + """Main program. + + Arguments: + argv: command-line arguments, such as sys.argv (including the program name + in argv[0]). + + Returns: + Zero on successful program termination, non-zero otherwise. + With --diff: zero if there were no changes, non-zero otherwise. + + Raises: + YapfError: if none of the supplied files were Python files. + """ + parser = _BuildParser() + args = parser.parse_args(argv[1:]) + if args.version: + print('yapf {}'.format(__version__)) + return 0 + + style_config = args.style + + if args.style_help: + _PrintHelp(args) + return 0 + + if args.lines and len(args.files) > 1: + parser.error('cannot use -l/--lines with more than one file') + + lines = _GetLines(args.lines) if args.lines is not None else None + if not args.files: + # No arguments specified. Read code from stdin. + if args.in_place or args.diff: + parser.error('cannot use --in-place or --diff flags when reading ' + 'from stdin') + + original_source = [] + while True: + if sys.stdin.closed: + break + try: + # Use 'raw_input' instead of 'sys.stdin.read', because otherwise the + # user will need to hit 'Ctrl-D' more than once if they're inputting + # the program by hand. 'raw_input' throws an EOFError exception if + # 'Ctrl-D' is pressed, which makes it easy to bail out of this loop. + original_source.append(py3compat.raw_input()) + except EOFError: + break + except KeyboardInterrupt: + return 1 + + if style_config is None and not args.no_local_style: + style_config = file_resources.GetDefaultStyleForDir(os.getcwd()) + + source = [line.rstrip() for line in original_source] + source[0] = py3compat.removeBOM(source[0]) + + try: + reformatted_source, _ = yapf_api.FormatCode( + py3compat.unicode('\n'.join(source) + '\n'), + filename='', + style_config=style_config, + lines=lines, + verify=args.verify) + except tokenize.TokenError as e: + raise errors.YapfError('%s:%s' % (e.args[1][0], e.args[0])) + + file_resources.WriteReformattedCode('', reformatted_source) + return 0 + + # Get additional exclude patterns from ignorefile + exclude_patterns_from_ignore_file = file_resources.GetExcludePatternsForDir( + os.getcwd()) + + files = file_resources.GetCommandLineFiles(args.files, args.recursive, + (args.exclude or []) + + exclude_patterns_from_ignore_file) + if not files: + raise errors.YapfError('Input filenames did not match any python files') + + changed = FormatFiles( + files, + lines, + style_config=args.style, + no_local_style=args.no_local_style, + in_place=args.in_place, + print_diff=args.diff, + verify=args.verify, + parallel=args.parallel, + quiet=args.quiet, + verbose=args.verbose) + return 1 if changed and (args.diff or args.quiet) else 0 + + +def _PrintHelp(args): + """Prints the help menu.""" + + if args.style is None and not args.no_local_style: + args.style = file_resources.GetDefaultStyleForDir(os.getcwd()) + style.SetGlobalStyle(style.CreateStyleFromConfig(args.style)) + print('[style]') + for option, docstring in sorted(style.Help().items()): + for line in docstring.splitlines(): + print('#', line and ' ' or '', line, sep='') + option_value = style.Get(option) + if isinstance(option_value, set) or isinstance(option_value, list): + option_value = ', '.join(map(str, option_value)) + print(option.lower(), '=', option_value, sep='') + print() + + +def FormatFiles(filenames, + lines, + style_config=None, + no_local_style=False, + in_place=False, + print_diff=False, + verify=False, + parallel=False, + quiet=False, + verbose=False): + """Format a list of files. + + Arguments: + filenames: (list of unicode) A list of files to reformat. + lines: (list of tuples of integers) A list of tuples of lines, [start, end], + that we want to format. The lines are 1-based indexed. This argument + overrides the 'args.lines'. It can be used by third-party code (e.g., + IDEs) when reformatting a snippet of code. + style_config: (string) Style name or file path. + no_local_style: (string) If style_config is None don't search for + directory-local style configuration. + in_place: (bool) Modify the files in place. + print_diff: (bool) Instead of returning the reformatted source, return a + diff that turns the formatted source into reformatter source. + verify: (bool) True if reformatted code should be verified for syntax. + parallel: (bool) True if should format multiple files in parallel. + quiet: (bool) True if should output nothing. + verbose: (bool) True if should print out filenames while processing. + + Returns: + True if the source code changed in any of the files being formatted. + """ + changed = False + if parallel: + import multiprocessing # pylint: disable=g-import-not-at-top + import concurrent.futures # pylint: disable=g-import-not-at-top + workers = min(multiprocessing.cpu_count(), len(filenames)) + with concurrent.futures.ProcessPoolExecutor(workers) as executor: + future_formats = [ + executor.submit(_FormatFile, filename, lines, style_config, + no_local_style, in_place, print_diff, verify, quiet, + verbose) for filename in filenames + ] + for future in concurrent.futures.as_completed(future_formats): + changed |= future.result() + else: + for filename in filenames: + changed |= _FormatFile(filename, lines, style_config, no_local_style, + in_place, print_diff, verify, quiet, verbose) + return changed + + +def _FormatFile(filename, + lines, + style_config=None, + no_local_style=False, + in_place=False, + print_diff=False, + verify=False, + quiet=False, + verbose=False): + """Format an individual file.""" + if verbose and not quiet: + print('Reformatting %s' % filename) + + if style_config is None and not no_local_style: + style_config = file_resources.GetDefaultStyleForDir( + os.path.dirname(filename)) + + try: + reformatted_code, encoding, has_change = yapf_api.FormatFile( + filename, + in_place=in_place, + style_config=style_config, + lines=lines, + print_diff=print_diff, + verify=verify, + logger=logging.warning) + except tokenize.TokenError as e: + raise errors.YapfError('%s:%s:%s' % (filename, e.args[1][0], e.args[0])) + except SyntaxError as e: + e.filename = filename + raise + + if not in_place and not quiet and reformatted_code: + file_resources.WriteReformattedCode(filename, reformatted_code, encoding, + in_place) + return has_change + + +def _GetLines(line_strings): + """Parses the start and end lines from a line string like 'start-end'. + + Arguments: + line_strings: (array of string) A list of strings representing a line + range like 'start-end'. + + Returns: + A list of tuples of the start and end line numbers. + + Raises: + ValueError: If the line string failed to parse or was an invalid line range. + """ + lines = [] + for line_string in line_strings: + # The 'list' here is needed by Python 3. + line = list(map(int, line_string.split('-', 1))) + if line[0] < 1: + raise errors.YapfError('invalid start of line range: %r' % line) + if line[0] > line[1]: + raise errors.YapfError('end comes before start in line range: %r' % line) + lines.append(tuple(line)) + return lines + + +def _BuildParser(): + """Constructs the parser for the command line arguments. + + Returns: + An ArgumentParser instance for the CLI. + """ + parser = argparse.ArgumentParser(description='Formatter for Python code.') + parser.add_argument( + '-v', + '--version', + action='store_true', + help='show version number and exit') + + diff_inplace_quiet_group = parser.add_mutually_exclusive_group() + diff_inplace_quiet_group.add_argument( + '-d', + '--diff', + action='store_true', + help='print the diff for the fixed source') + diff_inplace_quiet_group.add_argument( + '-i', + '--in-place', + action='store_true', + help='make changes to files in place') + diff_inplace_quiet_group.add_argument( + '-q', + '--quiet', + action='store_true', + help='output nothing and set return value') + + lines_recursive_group = parser.add_mutually_exclusive_group() + lines_recursive_group.add_argument( + '-r', + '--recursive', + action='store_true', + help='run recursively over directories') + lines_recursive_group.add_argument( + '-l', + '--lines', + metavar='START-END', + action='append', + default=None, + help='range of lines to reformat, one-based') + + parser.add_argument( + '-e', + '--exclude', + metavar='PATTERN', + action='append', + default=None, + help='patterns for files to exclude from formatting') + parser.add_argument( + '--style', + action='store', + help=('specify formatting style: either a style name (for example "pep8" ' + 'or "google"), or the name of a file with style settings. The ' + 'default is pep8 unless a %s or %s or %s file located in the same ' + 'directory as the source or one of its parent directories ' + '(for stdin, the current directory is used).' % + (style.LOCAL_STYLE, style.SETUP_CONFIG, style.PYPROJECT_TOML))) + parser.add_argument( + '--style-help', + action='store_true', + help=('show style settings and exit; this output can be ' + 'saved to .style.yapf to make your settings ' + 'permanent')) + parser.add_argument( + '--no-local-style', + action='store_true', + help="don't search for local style definition") + parser.add_argument('--verify', action='store_true', help=argparse.SUPPRESS) + parser.add_argument( + '-p', + '--parallel', + action='store_true', + help=('run yapf in parallel when formatting multiple files. Requires ' + 'concurrent.futures in Python 2.X')) + parser.add_argument( + '-vv', + '--verbose', + action='store_true', + help='print out file names while processing') + + parser.add_argument( + 'files', nargs='*', help='reads from stdin when no files are specified.') + return parser + + +def run_main(): # pylint: disable=invalid-name + try: + sys.exit(main(sys.argv)) + except errors.YapfError as e: + sys.stderr.write('yapf: ' + str(e) + '\n') + sys.exit(1) + + +if __name__ == '__main__': + run_main() diff --git a/.venv/lib/python3.9/site-packages/yapf/__main__.py b/.venv/lib/python3.9/site-packages/yapf/__main__.py new file mode 100644 index 00000000..f1d0e322 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapf/__main__.py @@ -0,0 +1,18 @@ +# Copyright 2015 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Main entry point.""" +# pylint: disable=invalid-name +import yapf + +yapf.run_main() diff --git a/.venv/lib/python3.9/site-packages/yapf/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapf/__pycache__/__init__.cpython-39.pyc new file mode 100644 index 00000000..bf43a840 Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapf/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapf/__pycache__/__main__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapf/__pycache__/__main__.cpython-39.pyc new file mode 100644 index 00000000..b8228020 Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapf/__pycache__/__main__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapf/yapflib/__init__.py b/.venv/lib/python3.9/site-packages/yapf/yapflib/__init__.py new file mode 100644 index 00000000..e7522b2c --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapf/yapflib/__init__.py @@ -0,0 +1,13 @@ +# Copyright 2015 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. diff --git a/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/__init__.cpython-39.pyc new file mode 100644 index 00000000..1424018c Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/blank_line_calculator.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/blank_line_calculator.cpython-39.pyc new file mode 100644 index 00000000..d41a26af Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/blank_line_calculator.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/comment_splicer.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/comment_splicer.cpython-39.pyc new file mode 100644 index 00000000..eb2c873f Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/comment_splicer.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/continuation_splicer.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/continuation_splicer.cpython-39.pyc new file mode 100644 index 00000000..69fc9d46 Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/continuation_splicer.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/errors.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/errors.cpython-39.pyc new file mode 100644 index 00000000..897bae02 Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/errors.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/file_resources.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/file_resources.cpython-39.pyc new file mode 100644 index 00000000..3c0accfd Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/file_resources.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/format_decision_state.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/format_decision_state.cpython-39.pyc new file mode 100644 index 00000000..2aceb3ab Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/format_decision_state.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/format_token.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/format_token.cpython-39.pyc new file mode 100644 index 00000000..893468c3 Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/format_token.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/identify_container.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/identify_container.cpython-39.pyc new file mode 100644 index 00000000..ea6948a4 Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/identify_container.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/line_joiner.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/line_joiner.cpython-39.pyc new file mode 100644 index 00000000..6ba6f74d Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/line_joiner.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/object_state.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/object_state.cpython-39.pyc new file mode 100644 index 00000000..c3ebad1b Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/object_state.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/py3compat.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/py3compat.cpython-39.pyc new file mode 100644 index 00000000..3c515bda Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/py3compat.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/pytree_unwrapper.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/pytree_unwrapper.cpython-39.pyc new file mode 100644 index 00000000..b266ca7d Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/pytree_unwrapper.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/pytree_utils.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/pytree_utils.cpython-39.pyc new file mode 100644 index 00000000..b53d6a80 Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/pytree_utils.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/pytree_visitor.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/pytree_visitor.cpython-39.pyc new file mode 100644 index 00000000..d8e611ae Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/pytree_visitor.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/reformatter.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/reformatter.cpython-39.pyc new file mode 100644 index 00000000..4a722ddd Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/reformatter.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/split_penalty.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/split_penalty.cpython-39.pyc new file mode 100644 index 00000000..4f578b15 Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/split_penalty.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/style.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/style.cpython-39.pyc new file mode 100644 index 00000000..9cea8c9c Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/style.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/subtype_assigner.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/subtype_assigner.cpython-39.pyc new file mode 100644 index 00000000..211cf504 Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/subtype_assigner.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/unwrapped_line.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/unwrapped_line.cpython-39.pyc new file mode 100644 index 00000000..a303a33c Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/unwrapped_line.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/verifier.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/verifier.cpython-39.pyc new file mode 100644 index 00000000..25cb5a32 Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/verifier.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/yapf_api.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/yapf_api.cpython-39.pyc new file mode 100644 index 00000000..f2d7e9c3 Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapf/yapflib/__pycache__/yapf_api.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapf/yapflib/blank_line_calculator.py b/.venv/lib/python3.9/site-packages/yapf/yapflib/blank_line_calculator.py new file mode 100644 index 00000000..37413485 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapf/yapflib/blank_line_calculator.py @@ -0,0 +1,177 @@ +# Copyright 2015 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Calculate the number of blank lines between top-level entities. + +Calculates how many blank lines we need between classes, functions, and other +entities at the same level. + + CalculateBlankLines(): the main function exported by this module. + +Annotations: + newlines: The number of newlines required before the node. +""" + +from yapf.yapflib import py3compat +from yapf.yapflib import pytree_utils +from yapf.yapflib import pytree_visitor +from yapf.yapflib import style + +_NO_BLANK_LINES = 1 +_ONE_BLANK_LINE = 2 +_TWO_BLANK_LINES = 3 + +_PYTHON_STATEMENTS = frozenset({ + 'small_stmt', 'expr_stmt', 'print_stmt', 'del_stmt', 'pass_stmt', + 'break_stmt', 'continue_stmt', 'return_stmt', 'raise_stmt', 'yield_stmt', + 'import_stmt', 'global_stmt', 'exec_stmt', 'assert_stmt', 'if_stmt', + 'while_stmt', 'for_stmt', 'try_stmt', 'with_stmt', 'nonlocal_stmt', + 'async_stmt', 'simple_stmt' +}) + + +def CalculateBlankLines(tree): + """Run the blank line calculator visitor over the tree. + + This modifies the tree in place. + + Arguments: + tree: the top-level pytree node to annotate with subtypes. + """ + blank_line_calculator = _BlankLineCalculator() + blank_line_calculator.Visit(tree) + + +class _BlankLineCalculator(pytree_visitor.PyTreeVisitor): + """_BlankLineCalculator - see file-level docstring for a description.""" + + def __init__(self): + self.class_level = 0 + self.function_level = 0 + self.last_comment_lineno = 0 + self.last_was_decorator = False + self.last_was_class_or_function = False + + def Visit_simple_stmt(self, node): # pylint: disable=invalid-name + self.DefaultNodeVisit(node) + if pytree_utils.NodeName(node.children[0]) == 'COMMENT': + self.last_comment_lineno = node.children[0].lineno + + def Visit_decorator(self, node): # pylint: disable=invalid-name + if (self.last_comment_lineno and + self.last_comment_lineno == node.children[0].lineno - 1): + _SetNumNewlines(node.children[0], _NO_BLANK_LINES) + else: + _SetNumNewlines(node.children[0], self._GetNumNewlines(node)) + for child in node.children: + self.Visit(child) + self.last_was_decorator = True + + def Visit_classdef(self, node): # pylint: disable=invalid-name + self.last_was_class_or_function = False + index = self._SetBlankLinesBetweenCommentAndClassFunc(node) + self.last_was_decorator = False + self.class_level += 1 + for child in node.children[index:]: + self.Visit(child) + self.class_level -= 1 + self.last_was_class_or_function = True + + def Visit_funcdef(self, node): # pylint: disable=invalid-name + self.last_was_class_or_function = False + index = self._SetBlankLinesBetweenCommentAndClassFunc(node) + if _AsyncFunction(node): + index = self._SetBlankLinesBetweenCommentAndClassFunc( + node.prev_sibling.parent) + _SetNumNewlines(node.children[0], None) + else: + index = self._SetBlankLinesBetweenCommentAndClassFunc(node) + self.last_was_decorator = False + self.function_level += 1 + for child in node.children[index:]: + self.Visit(child) + self.function_level -= 1 + self.last_was_class_or_function = True + + def DefaultNodeVisit(self, node): + """Override the default visitor for Node. + + This will set the blank lines required if the last entity was a class or + function. + + Arguments: + node: (pytree.Node) The node to visit. + """ + if self.last_was_class_or_function: + if pytree_utils.NodeName(node) in _PYTHON_STATEMENTS: + leaf = pytree_utils.FirstLeafNode(node) + _SetNumNewlines(leaf, self._GetNumNewlines(leaf)) + self.last_was_class_or_function = False + super(_BlankLineCalculator, self).DefaultNodeVisit(node) + + def _SetBlankLinesBetweenCommentAndClassFunc(self, node): + """Set the number of blanks between a comment and class or func definition. + + Class and function definitions have leading comments as children of the + classdef and functdef nodes. + + Arguments: + node: (pytree.Node) The classdef or funcdef node. + + Returns: + The index of the first child past the comment nodes. + """ + index = 0 + while pytree_utils.IsCommentStatement(node.children[index]): + # Standalone comments are wrapped in a simple_stmt node with the comment + # node as its only child. + self.Visit(node.children[index].children[0]) + if not self.last_was_decorator: + _SetNumNewlines(node.children[index].children[0], _ONE_BLANK_LINE) + index += 1 + if (index and node.children[index].lineno - 1 + == node.children[index - 1].children[0].lineno): + _SetNumNewlines(node.children[index], _NO_BLANK_LINES) + else: + if self.last_comment_lineno + 1 == node.children[index].lineno: + num_newlines = _NO_BLANK_LINES + else: + num_newlines = self._GetNumNewlines(node) + _SetNumNewlines(node.children[index], num_newlines) + return index + + def _GetNumNewlines(self, node): + if self.last_was_decorator: + return _NO_BLANK_LINES + elif self._IsTopLevel(node): + return 1 + style.Get('BLANK_LINES_AROUND_TOP_LEVEL_DEFINITION') + return _ONE_BLANK_LINE + + def _IsTopLevel(self, node): + return (not (self.class_level or self.function_level) and + _StartsInZerothColumn(node)) + + +def _SetNumNewlines(node, num_newlines): + pytree_utils.SetNodeAnnotation(node, pytree_utils.Annotation.NEWLINES, + num_newlines) + + +def _StartsInZerothColumn(node): + return (pytree_utils.FirstLeafNode(node).column == 0 or + (_AsyncFunction(node) and node.prev_sibling.column == 0)) + + +def _AsyncFunction(node): + return (py3compat.PY3 and node.prev_sibling and + pytree_utils.NodeName(node.prev_sibling) == 'ASYNC') diff --git a/.venv/lib/python3.9/site-packages/yapf/yapflib/comment_splicer.py b/.venv/lib/python3.9/site-packages/yapf/yapflib/comment_splicer.py new file mode 100644 index 00000000..8d646849 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapf/yapflib/comment_splicer.py @@ -0,0 +1,365 @@ +# Copyright 2015 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Comment splicer for lib2to3 trees. + +The lib2to3 syntax tree produced by the parser holds comments and whitespace in +prefix attributes of nodes, rather than nodes themselves. This module provides +functionality to splice comments out of prefixes and into nodes of their own, +making them easier to process. + + SpliceComments(): the main function exported by this module. +""" + +from lib2to3 import pygram +from lib2to3 import pytree +from lib2to3.pgen2 import token + +from yapf.yapflib import pytree_utils + + +def SpliceComments(tree): + """Given a pytree, splice comments into nodes of their own right. + + Extract comments from the prefixes where they are housed after parsing. + The prefixes that previously housed the comments become empty. + + Args: + tree: a pytree.Node - the tree to work on. The tree is modified by this + function. + """ + # The previous leaf node encountered in the traversal. + # This is a list because Python 2.x doesn't have 'nonlocal' :) + prev_leaf = [None] + _AnnotateIndents(tree) + + def _VisitNodeRec(node): + """Recursively visit each node to splice comments into the AST.""" + # This loop may insert into node.children, so we'll iterate over a copy. + for child in node.children[:]: + if isinstance(child, pytree.Node): + # Nodes don't have prefixes. + _VisitNodeRec(child) + else: + if child.prefix.lstrip().startswith('#'): + # We have a comment prefix in this child, so splicing is needed. + comment_prefix = child.prefix + comment_lineno = child.lineno - comment_prefix.count('\n') + comment_column = child.column + + # Remember the leading indentation of this prefix and clear it. + # Mopping up the prefix is important because we may go over this same + # child in the next iteration... + child_prefix = child.prefix.lstrip('\n') + prefix_indent = child_prefix[:child_prefix.find('#')] + if '\n' in prefix_indent: + prefix_indent = prefix_indent[prefix_indent.rfind('\n') + 1:] + child.prefix = '' + + if child.type == token.NEWLINE: + # If the prefix was on a NEWLINE leaf, it's part of the line so it + # will be inserted after the previously encountered leaf. + # We can't just insert it before the NEWLINE node, because as a + # result of the way pytrees are organized, this node can be under + # an inappropriate parent. + comment_column -= len(comment_prefix.lstrip()) + pytree_utils.InsertNodesAfter( + _CreateCommentsFromPrefix( + comment_prefix, + comment_lineno, + comment_column, + standalone=False), prev_leaf[0]) + elif child.type == token.DEDENT: + # Comment prefixes on DEDENT nodes also deserve special treatment, + # because their final placement depends on their prefix. + # We'll look for an ancestor of this child with a matching + # indentation, and insert the comment before it if the ancestor is + # on a DEDENT node and after it otherwise. + # + # lib2to3 places comments that should be separated into the same + # DEDENT node. For example, "comment 1" and "comment 2" will be + # combined. + # + # def _(): + # for x in y: + # pass + # # comment 1 + # + # # comment 2 + # pass + # + # In this case, we need to split them up ourselves. + + # Split into groups of comments at decreasing levels of indentation + comment_groups = [] + comment_column = None + for cmt in comment_prefix.split('\n'): + col = cmt.find('#') + if col < 0: + if comment_column is None: + # Skip empty lines at the top of the first comment group + comment_lineno += 1 + continue + elif comment_column is None or col < comment_column: + comment_column = col + comment_indent = cmt[:comment_column] + comment_groups.append((comment_column, comment_indent, [])) + comment_groups[-1][-1].append(cmt) + + # Insert a node for each group + for comment_column, comment_indent, comment_group in comment_groups: + ancestor_at_indent = _FindAncestorAtIndent(child, comment_indent) + if ancestor_at_indent.type == token.DEDENT: + InsertNodes = pytree_utils.InsertNodesBefore # pylint: disable=invalid-name + else: + InsertNodes = pytree_utils.InsertNodesAfter # pylint: disable=invalid-name + InsertNodes( + _CreateCommentsFromPrefix( + '\n'.join(comment_group) + '\n', + comment_lineno, + comment_column, + standalone=True), ancestor_at_indent) + comment_lineno += len(comment_group) + else: + # Otherwise there are two cases. + # + # 1. The comment is on its own line + # 2. The comment is part of an expression. + # + # Unfortunately, it's fairly difficult to distinguish between the + # two in lib2to3 trees. The algorithm here is to determine whether + # child is the first leaf in the statement it belongs to. If it is, + # then the comment (which is a prefix) belongs on a separate line. + # If it is not, it means the comment is buried deep in the statement + # and is part of some expression. + stmt_parent = _FindStmtParent(child) + + for leaf_in_parent in stmt_parent.leaves(): + if leaf_in_parent.type == token.NEWLINE: + continue + elif id(leaf_in_parent) == id(child): + # This comment stands on its own line, and it has to be inserted + # into the appropriate parent. We'll have to find a suitable + # parent to insert into. See comments above + # _STANDALONE_LINE_NODES for more details. + node_with_line_parent = _FindNodeWithStandaloneLineParent(child) + + if pytree_utils.NodeName( + node_with_line_parent.parent) in {'funcdef', 'classdef'}: + # Keep a comment that's not attached to a function or class + # next to the object it is attached to. + comment_end = ( + comment_lineno + comment_prefix.rstrip('\n').count('\n')) + if comment_end < node_with_line_parent.lineno - 1: + node_with_line_parent = node_with_line_parent.parent + + pytree_utils.InsertNodesBefore( + _CreateCommentsFromPrefix( + comment_prefix, comment_lineno, 0, standalone=True), + node_with_line_parent) + break + else: + if comment_lineno == prev_leaf[0].lineno: + comment_lines = comment_prefix.splitlines() + value = comment_lines[0].lstrip() + if value.rstrip('\n'): + comment_column = prev_leaf[0].column + comment_column += len(prev_leaf[0].value) + comment_column += ( + len(comment_lines[0]) - len(comment_lines[0].lstrip())) + comment_leaf = pytree.Leaf( + type=token.COMMENT, + value=value.rstrip('\n'), + context=('', (comment_lineno, comment_column))) + pytree_utils.InsertNodesAfter([comment_leaf], prev_leaf[0]) + comment_prefix = '\n'.join(comment_lines[1:]) + comment_lineno += 1 + + rindex = (0 if '\n' not in comment_prefix.rstrip() else + comment_prefix.rstrip().rindex('\n') + 1) + comment_column = ( + len(comment_prefix[rindex:]) - + len(comment_prefix[rindex:].lstrip())) + comments = _CreateCommentsFromPrefix( + comment_prefix, + comment_lineno, + comment_column, + standalone=False) + pytree_utils.InsertNodesBefore(comments, child) + break + + prev_leaf[0] = child + + _VisitNodeRec(tree) + + +def _CreateCommentsFromPrefix(comment_prefix, + comment_lineno, + comment_column, + standalone=False): + """Create pytree nodes to represent the given comment prefix. + + Args: + comment_prefix: (unicode) the text of the comment from the node's prefix. + comment_lineno: (int) the line number for the start of the comment. + comment_column: (int) the column for the start of the comment. + standalone: (bool) determines if the comment is standalone or not. + + Returns: + The simple_stmt nodes if this is a standalone comment, otherwise a list of + new COMMENT leafs. The prefix may consist of multiple comment blocks, + separated by blank lines. Each block gets its own leaf. + """ + # The comment is stored in the prefix attribute, with no lineno of its + # own. So we only know at which line it ends. To find out at which line it + # starts, look at how many newlines the comment itself contains. + comments = [] + + lines = comment_prefix.split('\n') + index = 0 + while index < len(lines): + comment_block = [] + while index < len(lines) and lines[index].lstrip().startswith('#'): + comment_block.append(lines[index].strip()) + index += 1 + + if comment_block: + new_lineno = comment_lineno + index - 1 + comment_block[0] = comment_block[0].strip() + comment_block[-1] = comment_block[-1].strip() + comment_leaf = pytree.Leaf( + type=token.COMMENT, + value='\n'.join(comment_block), + context=('', (new_lineno, comment_column))) + comment_node = comment_leaf if not standalone else pytree.Node( + pygram.python_symbols.simple_stmt, [comment_leaf]) + comments.append(comment_node) + + while index < len(lines) and not lines[index].lstrip(): + index += 1 + + return comments + + +# "Standalone line nodes" are tree nodes that have to start a new line in Python +# code (and cannot follow a ';' or ':'). Other nodes, like 'expr_stmt', serve as +# parents of other nodes but can come later in a line. This is a list of +# standalone line nodes in the grammar. It is meant to be exhaustive +# *eventually*, and we'll modify it with time as we discover more corner cases +# in the parse tree. +# +# When splicing a standalone comment (i.e. a comment that appears on its own +# line, not on the same line with other code), it's important to insert it into +# an appropriate parent of the node it's attached to. An appropriate parent +# is the first "standalone line node" in the parent chain of a node. +_STANDALONE_LINE_NODES = frozenset([ + 'suite', 'if_stmt', 'while_stmt', 'for_stmt', 'try_stmt', 'with_stmt', + 'funcdef', 'classdef', 'decorated', 'file_input' +]) + + +def _FindNodeWithStandaloneLineParent(node): + """Find a node whose parent is a 'standalone line' node. + + See the comment above _STANDALONE_LINE_NODES for more details. + + Arguments: + node: node to start from + + Returns: + Suitable node that's either the node itself or one of its ancestors. + """ + if pytree_utils.NodeName(node.parent) in _STANDALONE_LINE_NODES: + return node + else: + # This is guaranteed to terminate because 'file_input' is the root node of + # any pytree. + return _FindNodeWithStandaloneLineParent(node.parent) + + +# "Statement nodes" are standalone statements. The don't have to start a new +# line. +_STATEMENT_NODES = frozenset(['simple_stmt']) | _STANDALONE_LINE_NODES + + +def _FindStmtParent(node): + """Find the nearest parent of node that is a statement node. + + Arguments: + node: node to start from + + Returns: + Nearest parent (or node itself, if suitable). + """ + if pytree_utils.NodeName(node) in _STATEMENT_NODES: + return node + else: + return _FindStmtParent(node.parent) + + +def _FindAncestorAtIndent(node, indent): + """Find an ancestor of node with the given indentation. + + Arguments: + node: node to start from. This must not be the tree root. + indent: indentation string for the ancestor we're looking for. + See _AnnotateIndents for more details. + + Returns: + An ancestor node with suitable indentation. If no suitable ancestor is + found, the closest ancestor to the tree root is returned. + """ + if node.parent.parent is None: + # Our parent is the tree root, so there's nowhere else to go. + return node + + # If the parent has an indent annotation, and it's shorter than node's + # indent, this is a suitable ancestor. + # The reason for "shorter" rather than "equal" is that comments may be + # improperly indented (i.e. by three spaces, where surrounding statements + # have either zero or two or four), and we don't want to propagate them all + # the way to the root. + parent_indent = pytree_utils.GetNodeAnnotation( + node.parent, pytree_utils.Annotation.CHILD_INDENT) + if parent_indent is not None and indent.startswith(parent_indent): + return node + else: + # Keep looking up the tree. + return _FindAncestorAtIndent(node.parent, indent) + + +def _AnnotateIndents(tree): + """Annotate the tree with child_indent annotations. + + A child_indent annotation on a node specifies the indentation (as a string, + like " ") of its children. It is inferred from the INDENT child of a node. + + Arguments: + tree: root of a pytree. The pytree is modified to add annotations to nodes. + + Raises: + RuntimeError: if the tree is malformed. + """ + # Annotate the root of the tree with zero indent. + if tree.parent is None: + pytree_utils.SetNodeAnnotation(tree, pytree_utils.Annotation.CHILD_INDENT, + '') + for child in tree.children: + if child.type == token.INDENT: + child_indent = pytree_utils.GetNodeAnnotation( + tree, pytree_utils.Annotation.CHILD_INDENT) + if child_indent is not None and child_indent != child.value: + raise RuntimeError('inconsistent indentation for child', (tree, child)) + pytree_utils.SetNodeAnnotation(tree, pytree_utils.Annotation.CHILD_INDENT, + child.value) + _AnnotateIndents(child) diff --git a/.venv/lib/python3.9/site-packages/yapf/yapflib/continuation_splicer.py b/.venv/lib/python3.9/site-packages/yapf/yapflib/continuation_splicer.py new file mode 100644 index 00000000..b86188cb --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapf/yapflib/continuation_splicer.py @@ -0,0 +1,52 @@ +# Copyright 2015 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Insert "continuation" nodes into lib2to3 tree. + +The "backslash-newline" continuation marker is shoved into the node's prefix. +Pull them out and make it into nodes of their own. + + SpliceContinuations(): the main function exported by this module. +""" + +from lib2to3 import pytree + +from yapf.yapflib import format_token + + +def SpliceContinuations(tree): + """Given a pytree, splice the continuation marker into nodes. + + Arguments: + tree: (pytree.Node) The tree to work on. The tree is modified by this + function. + """ + + def RecSplicer(node): + """Inserts a continuation marker into the node.""" + if isinstance(node, pytree.Leaf): + if node.prefix.lstrip().startswith('\\\n'): + new_lineno = node.lineno - node.prefix.count('\n') + return pytree.Leaf( + type=format_token.CONTINUATION, + value=node.prefix, + context=('', (new_lineno, 0))) + return None + num_inserted = 0 + for index, child in enumerate(node.children[:]): + continuation_node = RecSplicer(child) + if continuation_node: + node.children.insert(index + num_inserted, continuation_node) + num_inserted += 1 + + RecSplicer(tree) diff --git a/.venv/lib/python3.9/site-packages/yapf/yapflib/errors.py b/.venv/lib/python3.9/site-packages/yapf/yapflib/errors.py new file mode 100644 index 00000000..3946275c --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapf/yapflib/errors.py @@ -0,0 +1,23 @@ +# Copyright 2015 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""YAPF error object.""" + + +class YapfError(Exception): + """Parent class for user errors or input errors. + + Exceptions of this type are handled by the command line tool + and result in clear error messages, as opposed to backtraces. + """ + pass diff --git a/.venv/lib/python3.9/site-packages/yapf/yapflib/file_resources.py b/.venv/lib/python3.9/site-packages/yapf/yapflib/file_resources.py new file mode 100644 index 00000000..84a8a542 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapf/yapflib/file_resources.py @@ -0,0 +1,265 @@ +# Copyright 2015 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Interface to file resources. + +This module provides functions for interfacing with files: opening, writing, and +querying. +""" + +import fnmatch +import os +import re + +from lib2to3.pgen2 import tokenize + +from yapf.yapflib import errors +from yapf.yapflib import py3compat +from yapf.yapflib import style + +CR = '\r' +LF = '\n' +CRLF = '\r\n' + + +def _GetExcludePatternsFromFile(filename): + """Get a list of file patterns to ignore.""" + ignore_patterns = [] + # See if we have a .yapfignore file. + if os.path.isfile(filename) and os.access(filename, os.R_OK): + with open(filename, 'r') as fd: + for line in fd: + if line.strip() and not line.startswith('#'): + ignore_patterns.append(line.strip()) + + if any(e.startswith('./') for e in ignore_patterns): + raise errors.YapfError('path in .yapfignore should not start with ./') + + return ignore_patterns + + +def GetExcludePatternsForDir(dirname): + """Return patterns of files to exclude from ignorefile in a given directory. + + Looks for .yapfignore in the directory dirname. + + Arguments: + dirname: (unicode) The name of the directory. + + Returns: + A List of file patterns to exclude if ignore file is found, otherwise empty + List. + """ + ignore_file = os.path.join(dirname, '.yapfignore') + return _GetExcludePatternsFromFile(ignore_file) + + +def GetDefaultStyleForDir(dirname, default_style=style.DEFAULT_STYLE): + """Return default style name for a given directory. + + Looks for .style.yapf or setup.cfg or pyproject.toml in the parent directories. + + Arguments: + dirname: (unicode) The name of the directory. + default_style: The style to return if nothing is found. Defaults to the + global default style ('pep8') unless otherwise specified. + + Returns: + The filename if found, otherwise return the default style. + """ + dirname = os.path.abspath(dirname) + while True: + # See if we have a .style.yapf file. + style_file = os.path.join(dirname, style.LOCAL_STYLE) + if os.path.exists(style_file): + return style_file + + # See if we have a setup.cfg file with a '[yapf]' section. + config_file = os.path.join(dirname, style.SETUP_CONFIG) + try: + fd = open(config_file) + except IOError: + pass # It's okay if it's not there. + else: + with fd: + config = py3compat.ConfigParser() + config.read_file(fd) + if config.has_section('yapf'): + return config_file + + # See if we have a pyproject.toml file with a '[tool.yapf]' section. + config_file = os.path.join(dirname, style.PYPROJECT_TOML) + try: + fd = open(config_file) + except IOError: + pass # It's okay if it's not there. + else: + with fd: + try: + import toml + except ImportError: + raise errors.YapfError( + "toml package is needed for using pyproject.toml as a configuration file" + ) + + pyproject_toml = toml.load(config_file) + style_dict = pyproject_toml.get('tool', {}).get('yapf', None) + if style_dict is not None: + return config_file + + if (not dirname or not os.path.basename(dirname) or + dirname == os.path.abspath(os.path.sep)): + break + dirname = os.path.dirname(dirname) + + global_file = os.path.expanduser(style.GLOBAL_STYLE) + if os.path.exists(global_file): + return global_file + + return default_style + + +def GetCommandLineFiles(command_line_file_list, recursive, exclude): + """Return the list of files specified on the command line.""" + return _FindPythonFiles(command_line_file_list, recursive, exclude) + + +def WriteReformattedCode(filename, + reformatted_code, + encoding='', + in_place=False): + """Emit the reformatted code. + + Write the reformatted code into the file, if in_place is True. Otherwise, + write to stdout. + + Arguments: + filename: (unicode) The name of the unformatted file. + reformatted_code: (unicode) The reformatted code. + encoding: (unicode) The encoding of the file. + in_place: (bool) If True, then write the reformatted code to the file. + """ + if in_place: + with py3compat.open_with_encoding( + filename, mode='w', encoding=encoding, newline='') as fd: + fd.write(reformatted_code) + else: + py3compat.EncodeAndWriteToStdout(reformatted_code) + + +def LineEnding(lines): + """Retrieve the line ending of the original source.""" + endings = {CRLF: 0, CR: 0, LF: 0} + for line in lines: + if line.endswith(CRLF): + endings[CRLF] += 1 + elif line.endswith(CR): + endings[CR] += 1 + elif line.endswith(LF): + endings[LF] += 1 + return (sorted(endings, key=endings.get, reverse=True) or [LF])[0] + + +def _FindPythonFiles(filenames, recursive, exclude): + """Find all Python files.""" + if exclude and any(e.startswith('./') for e in exclude): + raise errors.YapfError("path in '--exclude' should not start with ./") + exclude = exclude and [e.rstrip("/" + os.path.sep) for e in exclude] + + python_files = [] + for filename in filenames: + if filename != '.' and exclude and IsIgnored(filename, exclude): + continue + if os.path.isdir(filename): + if not recursive: + raise errors.YapfError( + "directory specified without '--recursive' flag: %s" % filename) + + # TODO(morbo): Look into a version of os.walk that can handle recursion. + excluded_dirs = [] + for dirpath, dirnames, filelist in os.walk(filename): + if dirpath != '.' and exclude and IsIgnored(dirpath, exclude): + excluded_dirs.append(dirpath) + continue + elif any(dirpath.startswith(e) for e in excluded_dirs): + continue + for f in filelist: + filepath = os.path.join(dirpath, f) + if exclude and IsIgnored(filepath, exclude): + continue + if IsPythonFile(filepath): + python_files.append(filepath) + # To prevent it from scanning the contents excluded folders, os.walk() + # lets you amend its list of child dirs `dirnames`. These edits must be + # made in-place instead of creating a modified copy of `dirnames`. + # list.remove() is slow and list.pop() is a headache. Instead clear + # `dirnames` then repopulate it. + dirnames_ = [dirnames.pop(0) for i in range(len(dirnames))] + for dirname in dirnames_: + dir_ = os.path.join(dirpath, dirname) + if IsIgnored(dir_, exclude): + excluded_dirs.append(dir_) + else: + dirnames.append(dirname) + + elif os.path.isfile(filename): + python_files.append(filename) + + return python_files + + +def IsIgnored(path, exclude): + """Return True if filename matches any patterns in exclude.""" + if exclude is None: + return False + path = path.lstrip(os.path.sep) + while path.startswith('.' + os.path.sep): + path = path[2:] + return any(fnmatch.fnmatch(path, e.rstrip(os.path.sep)) for e in exclude) + + +def IsPythonFile(filename): + """Return True if filename is a Python file.""" + if os.path.splitext(filename)[1] == '.py': + return True + + try: + with open(filename, 'rb') as fd: + encoding = tokenize.detect_encoding(fd.readline)[0] + + # Check for correctness of encoding. + with py3compat.open_with_encoding( + filename, mode='r', encoding=encoding) as fd: + fd.read() + except UnicodeDecodeError: + encoding = 'latin-1' + except (IOError, SyntaxError): + # If we fail to detect encoding (or the encoding cookie is incorrect - which + # will make detect_encoding raise SyntaxError), assume it's not a Python + # file. + return False + + try: + with py3compat.open_with_encoding( + filename, mode='r', encoding=encoding) as fd: + first_line = fd.readline(256) + except IOError: + return False + + return re.match(r'^#!.*\bpython[23]?\b', first_line) + + +def FileEncoding(filename): + """Return the file's encoding.""" + with open(filename, 'rb') as fd: + return tokenize.detect_encoding(fd.readline)[0] diff --git a/.venv/lib/python3.9/site-packages/yapf/yapflib/format_decision_state.py b/.venv/lib/python3.9/site-packages/yapf/yapflib/format_decision_state.py new file mode 100644 index 00000000..164818e9 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapf/yapflib/format_decision_state.py @@ -0,0 +1,1254 @@ +# Copyright 2015 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Implements a format decision state object that manages whitespace decisions. + +Each token is processed one at a time, at which point its whitespace formatting +decisions are made. A graph of potential whitespace formattings is created, +where each node in the graph is a format decision state object. The heuristic +tries formatting the token with and without a newline before it to determine +which one has the least penalty. Therefore, the format decision state object for +each decision needs to be its own unique copy. + +Once the heuristic determines the best formatting, it makes a non-dry run pass +through the code to commit the whitespace formatting. + + FormatDecisionState: main class exported by this module. +""" + +from yapf.yapflib import format_token +from yapf.yapflib import object_state +from yapf.yapflib import split_penalty +from yapf.yapflib import style +from yapf.yapflib import unwrapped_line + + +class FormatDecisionState(object): + """The current state when indenting an unwrapped line. + + The FormatDecisionState object is meant to be copied instead of referenced. + + Attributes: + first_indent: The indent of the first token. + column: The number of used columns in the current line. + line: The unwrapped line we're currently processing. + next_token: The next token to be formatted. + paren_level: The level of nesting inside (), [], and {}. + lowest_level_on_line: The lowest paren_level on the current line. + stack: A stack (of _ParenState) keeping track of properties applying to + parenthesis levels. + comp_stack: A stack (of ComprehensionState) keeping track of properties + applying to comprehensions. + param_list_stack: A stack (of ParameterListState) keeping track of + properties applying to function parameter lists. + ignore_stack_for_comparison: Ignore the stack of _ParenState for state + comparison. + column_limit: The column limit specified by the style. + """ + + def __init__(self, line, first_indent): + """Initializer. + + Initializes to the state after placing the first token from 'line' at + 'first_indent'. + + Arguments: + line: (UnwrappedLine) The unwrapped line we're currently processing. + first_indent: (int) The indent of the first token. + """ + self.next_token = line.first + self.column = first_indent + self.line = line + self.paren_level = 0 + self.lowest_level_on_line = 0 + self.ignore_stack_for_comparison = False + self.stack = [_ParenState(first_indent, first_indent)] + self.comp_stack = [] + self.param_list_stack = [] + self.first_indent = first_indent + self.column_limit = style.Get('COLUMN_LIMIT') + + def Clone(self): + """Clones a FormatDecisionState object.""" + new = FormatDecisionState(self.line, self.first_indent) + new.next_token = self.next_token + new.column = self.column + new.line = self.line + new.paren_level = self.paren_level + new.line.depth = self.line.depth + new.lowest_level_on_line = self.lowest_level_on_line + new.ignore_stack_for_comparison = self.ignore_stack_for_comparison + new.first_indent = self.first_indent + new.stack = [state.Clone() for state in self.stack] + new.comp_stack = [state.Clone() for state in self.comp_stack] + new.param_list_stack = [state.Clone() for state in self.param_list_stack] + return new + + def __eq__(self, other): + # Note: 'first_indent' is implicit in the stack. Also, we ignore 'previous', + # because it shouldn't have a bearing on this comparison. (I.e., it will + # report equal if 'next_token' does.) + return (self.next_token == other.next_token and + self.column == other.column and + self.paren_level == other.paren_level and + self.line.depth == other.line.depth and + self.lowest_level_on_line == other.lowest_level_on_line and + (self.ignore_stack_for_comparison or + other.ignore_stack_for_comparison or self.stack == other.stack and + self.comp_stack == other.comp_stack and + self.param_list_stack == other.param_list_stack)) + + def __ne__(self, other): + return not self == other + + def __hash__(self): + return hash((self.next_token, self.column, self.paren_level, + self.line.depth, self.lowest_level_on_line)) + + def __repr__(self): + return ('column::%d, next_token::%s, paren_level::%d, stack::[\n\t%s' % + (self.column, repr(self.next_token), self.paren_level, + '\n\t'.join(repr(s) for s in self.stack) + ']')) + + def CanSplit(self, must_split): + """Determine if we can split before the next token. + + Arguments: + must_split: (bool) A newline was required before this token. + + Returns: + True if the line can be split before the next token. + """ + current = self.next_token + previous = current.previous_token + + if current.is_pseudo_paren: + return False + + if (not must_split and + format_token.Subtype.DICTIONARY_KEY_PART in current.subtypes and + format_token.Subtype.DICTIONARY_KEY not in current.subtypes and + not style.Get('ALLOW_MULTILINE_DICTIONARY_KEYS')): + # In some situations, a dictionary may be multiline, but pylint doesn't + # like it. So don't allow it unless forced to. + return False + + if (not must_split and + format_token.Subtype.DICTIONARY_VALUE in current.subtypes and + not style.Get('ALLOW_SPLIT_BEFORE_DICT_VALUE')): + return False + + if previous and previous.value == '(' and current.value == ')': + # Don't split an empty function call list if we aren't splitting before + # dict values. + token = previous.previous_token + while token: + prev = token.previous_token + if not prev or prev.name not in {'NAME', 'DOT'}: + break + token = token.previous_token + if token and format_token.Subtype.DICTIONARY_VALUE in token.subtypes: + if not style.Get('ALLOW_SPLIT_BEFORE_DICT_VALUE'): + return False + + if previous and previous.value == '.' and current.value == '.': + return False + + return current.can_break_before + + def MustSplit(self): + """Returns True if the line must split before the next token.""" + current = self.next_token + previous = current.previous_token + + if current.is_pseudo_paren: + return False + + if current.must_break_before: + return True + + if not previous: + return False + + if style.Get('SPLIT_ALL_COMMA_SEPARATED_VALUES') and previous.value == ',': + return True + + if (style.Get('SPLIT_ALL_TOP_LEVEL_COMMA_SEPARATED_VALUES') and + previous.value == ','): + # Avoid breaking in a container that fits in the current line if possible + opening = _GetOpeningBracket(current) + + # Can't find opening bracket, behave the same way as + # SPLIT_ALL_COMMA_SEPARATED_VALUES. + if not opening: + return True + + if current.is_comment: + # Don't require splitting before a comment, since it may be related to + # the current line. + return False + + # Allow the fallthrough code to handle the closing bracket. + if current != opening.matching_bracket: + # If the container doesn't fit in the current line, must split + return not self._ContainerFitsOnStartLine(opening) + + if (self.stack[-1].split_before_closing_bracket and + (current.value in '}]' and style.Get('SPLIT_BEFORE_CLOSING_BRACKET') or + current.value in '}])' and style.Get('INDENT_CLOSING_BRACKETS'))): + # Split before the closing bracket if we can. + if format_token.Subtype.SUBSCRIPT_BRACKET not in current.subtypes: + return current.node_split_penalty != split_penalty.UNBREAKABLE + + if (current.value == ')' and previous.value == ',' and + not _IsSingleElementTuple(current.matching_bracket)): + return True + + # Prevent splitting before the first argument in compound statements + # with the exception of function declarations. + if (style.Get('SPLIT_BEFORE_FIRST_ARGUMENT') and + _IsCompoundStatement(self.line.first) and + not _IsFunctionDef(self.line.first)): + return False + + ########################################################################### + # List Splitting + if (style.Get('DEDENT_CLOSING_BRACKETS') or + style.Get('INDENT_CLOSING_BRACKETS') or + style.Get('SPLIT_BEFORE_FIRST_ARGUMENT')): + bracket = current if current.ClosesScope() else previous + if format_token.Subtype.SUBSCRIPT_BRACKET not in bracket.subtypes: + if bracket.OpensScope(): + if style.Get('COALESCE_BRACKETS'): + if current.OpensScope(): + # Prefer to keep all opening brackets together. + return False + + if (not _IsLastScopeInLine(bracket) or + unwrapped_line.IsSurroundedByBrackets(bracket)): + last_token = bracket.matching_bracket + else: + last_token = _LastTokenInLine(bracket.matching_bracket) + + if not self._FitsOnLine(bracket, last_token): + # Split before the first element if the whole list can't fit on a + # single line. + self.stack[-1].split_before_closing_bracket = True + return True + + elif (style.Get('DEDENT_CLOSING_BRACKETS') or + style.Get('INDENT_CLOSING_BRACKETS')) and current.ClosesScope(): + # Split before and dedent the closing bracket. + return self.stack[-1].split_before_closing_bracket + + if (style.Get('SPLIT_BEFORE_EXPRESSION_AFTER_OPENING_PAREN') and + current.is_name): + # An expression that's surrounded by parens gets split after the opening + # parenthesis. + def SurroundedByParens(token): + """Check if it's an expression surrounded by parentheses.""" + while token: + if token.value == ',': + return False + if token.value == ')': + return not token.next_token + if token.OpensScope(): + token = token.matching_bracket.next_token + else: + token = token.next_token + return False + + if (previous.value == '(' and not previous.is_pseudo_paren and + not unwrapped_line.IsSurroundedByBrackets(previous)): + pptoken = previous.previous_token + if (pptoken and not pptoken.is_name and not pptoken.is_keyword and + SurroundedByParens(current)): + return True + + if (current.is_name or current.is_string) and previous.value == ',': + # If the list has function calls in it and the full list itself cannot + # fit on the line, then we want to split. Otherwise, we'll get something + # like this: + # + # X = [ + # Bar(xxx='some string', + # yyy='another long string', + # zzz='a third long string'), Bar( + # xxx='some string', + # yyy='another long string', + # zzz='a third long string') + # ] + # + # or when a string formatting syntax. + func_call_or_string_format = False + tok = current.next_token + if current.is_name: + while tok and (tok.is_name or tok.value == '.'): + tok = tok.next_token + func_call_or_string_format = tok and tok.value == '(' + elif current.is_string: + while tok and tok.is_string: + tok = tok.next_token + func_call_or_string_format = tok and tok.value == '%' + if func_call_or_string_format: + open_bracket = unwrapped_line.IsSurroundedByBrackets(current) + if open_bracket: + if open_bracket.value in '[{': + if not self._FitsOnLine(open_bracket, + open_bracket.matching_bracket): + return True + elif tok.value == '(': + if not self._FitsOnLine(current, tok.matching_bracket): + return True + + if (current.OpensScope() and previous.value == ',' and + format_token.Subtype.DICTIONARY_KEY not in current.next_token.subtypes): + # If we have a list of tuples, then we can get a similar look as above. If + # the full list cannot fit on the line, then we want a split. + open_bracket = unwrapped_line.IsSurroundedByBrackets(current) + if (open_bracket and open_bracket.value in '[{' and + format_token.Subtype.SUBSCRIPT_BRACKET not in open_bracket.subtypes): + if not self._FitsOnLine(current, current.matching_bracket): + return True + + ########################################################################### + # Dict/Set Splitting + if (style.Get('EACH_DICT_ENTRY_ON_SEPARATE_LINE') and + format_token.Subtype.DICTIONARY_KEY in current.subtypes and + not current.is_comment): + # Place each dictionary entry onto its own line. + if previous.value == '{' and previous.previous_token: + opening = _GetOpeningBracket(previous.previous_token) + if (opening and opening.value == '(' and opening.previous_token and + opening.previous_token.is_name): + # This is a dictionary that's an argument to a function. + if (self._FitsOnLine(previous, previous.matching_bracket) and + previous.matching_bracket.next_token and + (not opening.matching_bracket.next_token or + opening.matching_bracket.next_token.value != '.') and + _ScopeHasNoCommas(previous)): + # Don't split before the key if: + # - The dictionary fits on a line, and + # - The function call isn't part of a builder-style call and + # - The dictionary has one entry and no trailing comma + return False + return True + + if (style.Get('SPLIT_BEFORE_DICT_SET_GENERATOR') and + format_token.Subtype.DICT_SET_GENERATOR in current.subtypes): + # Split before a dict/set generator. + return True + + if (format_token.Subtype.DICTIONARY_VALUE in current.subtypes or + (previous.is_pseudo_paren and previous.value == '(' and + not current.is_comment)): + # Split before the dictionary value if we can't fit every dictionary + # entry on its own line. + if not current.OpensScope(): + opening = _GetOpeningBracket(current) + if not self._EachDictEntryFitsOnOneLine(opening): + return style.Get('ALLOW_SPLIT_BEFORE_DICT_VALUE') + + if previous.value == '{': + # Split if the dict/set cannot fit on one line and ends in a comma. + closing = previous.matching_bracket + if (not self._FitsOnLine(previous, closing) and + closing.previous_token.value == ','): + self.stack[-1].split_before_closing_bracket = True + return True + + ########################################################################### + # Argument List Splitting + if (style.Get('SPLIT_BEFORE_NAMED_ASSIGNS') and not current.is_comment and + format_token.Subtype.DEFAULT_OR_NAMED_ASSIGN_ARG_LIST + in current.subtypes): + if (previous.value not in {'=', ':', '*', '**'} and + current.value not in ':=,)' and not _IsFunctionDefinition(previous)): + # If we're going to split the lines because of named arguments, then we + # want to split after the opening bracket as well. But not when this is + # part of a function definition. + if previous.value == '(': + # Make sure we don't split after the opening bracket if the + # continuation indent is greater than the opening bracket: + # + # a( + # b=1, + # c=2) + if (self._FitsOnLine(previous, previous.matching_bracket) and + unwrapped_line.IsSurroundedByBrackets(previous)): + # An argument to a function is a function call with named + # assigns. + return False + + # Don't split if not required + if (not style.Get('SPLIT_BEFORE_EXPRESSION_AFTER_OPENING_PAREN') and + not style.Get('SPLIT_BEFORE_FIRST_ARGUMENT')): + return False + + column = self.column - self.stack[-1].last_space + return column > style.Get('CONTINUATION_INDENT_WIDTH') + + opening = _GetOpeningBracket(current) + if opening: + return not self._ContainerFitsOnStartLine(opening) + + if (current.value not in '{)' and previous.value == '(' and + self._ArgumentListHasDictionaryEntry(current)): + return True + + if style.Get('SPLIT_ARGUMENTS_WHEN_COMMA_TERMINATED'): + # Split before arguments in a function call or definition if the + # arguments are terminated by a comma. + opening = _GetOpeningBracket(current) + if opening and opening.previous_token and opening.previous_token.is_name: + if previous.value in '(,': + if opening.matching_bracket.previous_token.value == ',': + return True + + if ((current.is_name or current.value in {'*', '**'}) and + previous.value == ','): + # If we have a function call within an argument list and it won't fit on + # the remaining line, but it will fit on a line by itself, then go ahead + # and split before the call. + opening = _GetOpeningBracket(current) + if (opening and opening.value == '(' and opening.previous_token and + (opening.previous_token.is_name or + opening.previous_token.value in {'*', '**'})): + is_func_call = False + opening = current + while opening: + if opening.value == '(': + is_func_call = True + break + if (not (opening.is_name or opening.value in {'*', '**'}) and + opening.value != '.'): + break + opening = opening.next_token + + if is_func_call: + if (not self._FitsOnLine(current, opening.matching_bracket) or + (opening.matching_bracket.next_token and + opening.matching_bracket.next_token.value != ',' and + not opening.matching_bracket.next_token.ClosesScope())): + return True + + pprevious = previous.previous_token + + # A function call with a dictionary as its first argument may result in + # unreadable formatting if the dictionary spans multiple lines. The + # dictionary itself is formatted just fine, but the remaning arguments are + # indented too far: + # + # function_call({ + # KEY_1: 'value one', + # KEY_2: 'value two', + # }, + # default=False) + if (current.value == '{' and previous.value == '(' and pprevious and + pprevious.is_name): + dict_end = current.matching_bracket + next_token = dict_end.next_token + if next_token.value == ',' and not self._FitsOnLine(current, dict_end): + return True + + if (current.is_name and pprevious and pprevious.is_name and + previous.value == '('): + + if (not self._FitsOnLine(previous, previous.matching_bracket) and + _IsFunctionCallWithArguments(current)): + # There is a function call, with more than 1 argument, where the first + # argument is itself a function call with arguments that does not fit + # into the line. In this specific case, if we split after the first + # argument's opening '(', then the formatting will look bad for the + # rest of the arguments. E.g.: + # + # outer_function_call(inner_function_call( + # inner_arg1, inner_arg2), + # outer_arg1, outer_arg2) + # + # Instead, enforce a split before that argument to keep things looking + # good. + if (style.Get('SPLIT_BEFORE_EXPRESSION_AFTER_OPENING_PAREN') or + style.Get('SPLIT_BEFORE_FIRST_ARGUMENT')): + return True + + opening = _GetOpeningBracket(current) + if (opening and opening.value == '(' and opening.previous_token and + (opening.previous_token.is_name or + opening.previous_token.value in {'*', '**'})): + is_func_call = False + opening = current + while opening: + if opening.value == '(': + is_func_call = True + break + if (not (opening.is_name or opening.value in {'*', '**'}) and + opening.value != '.'): + break + opening = opening.next_token + + if is_func_call: + if (not self._FitsOnLine(current, opening.matching_bracket) or + (opening.matching_bracket.next_token and + opening.matching_bracket.next_token.value != ',' and + not opening.matching_bracket.next_token.ClosesScope())): + return True + + if (previous.OpensScope() and not current.OpensScope() and + not current.is_comment and + format_token.Subtype.SUBSCRIPT_BRACKET not in previous.subtypes): + if pprevious and not pprevious.is_keyword and not pprevious.is_name: + # We want to split if there's a comment in the container. + token = current + while token != previous.matching_bracket: + if token.is_comment: + return True + token = token.next_token + if previous.value == '(': + pptoken = previous.previous_token + if not pptoken or not pptoken.is_name: + # Split after the opening of a tuple if it doesn't fit on the current + # line and it's not a function call. + if self._FitsOnLine(previous, previous.matching_bracket): + return False + elif not self._FitsOnLine(previous, previous.matching_bracket): + if len(previous.container_elements) == 1: + return False + + elements = previous.container_elements + [previous.matching_bracket] + i = 1 + while i < len(elements): + if (not elements[i - 1].OpensScope() and + not self._FitsOnLine(elements[i - 1], elements[i])): + return True + i += 1 + + if (self.column_limit - self.column) / float(self.column_limit) < 0.3: + # Try not to squish all of the arguments off to the right. + return True + else: + # Split after the opening of a container if it doesn't fit on the + # current line. + if not self._FitsOnLine(previous, previous.matching_bracket): + return True + + ########################################################################### + # Original Formatting Splitting + # These checks rely upon the original formatting. This is in order to + # attempt to keep hand-written code in the same condition as it was before. + # However, this may cause the formatter to fail to be idempotent. + if (style.Get('SPLIT_BEFORE_BITWISE_OPERATOR') and current.value in '&|' and + previous.lineno < current.lineno): + # Retain the split before a bitwise operator. + return True + + if (current.is_comment and + previous.lineno < current.lineno - current.value.count('\n')): + # If a comment comes in the middle of an unwrapped line (like an if + # conditional with comments interspersed), then we want to split if the + # original comments were on a separate line. + return True + + return False + + def AddTokenToState(self, newline, dry_run, must_split=False): + """Add a token to the format decision state. + + Allow the heuristic to try out adding the token with and without a newline. + Later on, the algorithm will determine which one has the lowest penalty. + + Arguments: + newline: (bool) Add the token on a new line if True. + dry_run: (bool) Don't commit whitespace changes to the FormatToken if + True. + must_split: (bool) A newline was required before this token. + + Returns: + The penalty of splitting after the current token. + """ + self._PushParameterListState(newline) + + penalty = 0 + if newline: + penalty = self._AddTokenOnNewline(dry_run, must_split) + else: + self._AddTokenOnCurrentLine(dry_run) + + penalty += self._CalculateComprehensionState(newline) + penalty += self._CalculateParameterListState(newline) + + return self.MoveStateToNextToken() + penalty + + def _AddTokenOnCurrentLine(self, dry_run): + """Puts the token on the current line. + + Appends the next token to the state and updates information necessary for + indentation. + + Arguments: + dry_run: (bool) Commit whitespace changes to the FormatToken if True. + """ + current = self.next_token + previous = current.previous_token + + spaces = current.spaces_required_before + if isinstance(spaces, list): + # Don't set the value here, as we need to look at the lines near + # this one to determine the actual horizontal alignment value. + spaces = 0 + + if not dry_run: + current.AddWhitespacePrefix(newlines_before=0, spaces=spaces) + + if previous.OpensScope(): + if not current.is_comment: + # Align closing scopes that are on a newline with the opening scope: + # + # foo = [a, + # b, + # ] + self.stack[-1].closing_scope_indent = self.column - 1 + if style.Get('ALIGN_CLOSING_BRACKET_WITH_VISUAL_INDENT'): + self.stack[-1].closing_scope_indent += 1 + self.stack[-1].indent = self.column + spaces + else: + self.stack[-1].closing_scope_indent = ( + self.stack[-1].indent - style.Get('CONTINUATION_INDENT_WIDTH')) + + self.column += spaces + + def _AddTokenOnNewline(self, dry_run, must_split): + """Adds a line break and necessary indentation. + + Appends the next token to the state and updates information necessary for + indentation. + + Arguments: + dry_run: (bool) Don't commit whitespace changes to the FormatToken if + True. + must_split: (bool) A newline was required before this token. + + Returns: + The split penalty for splitting after the current state. + """ + current = self.next_token + previous = current.previous_token + + self.column = self._GetNewlineColumn() + + if not dry_run: + indent_level = self.line.depth + spaces = self.column + if spaces: + spaces -= indent_level * style.Get('INDENT_WIDTH') + current.AddWhitespacePrefix( + newlines_before=1, spaces=spaces, indent_level=indent_level) + + if not current.is_comment: + self.stack[-1].last_space = self.column + self.lowest_level_on_line = self.paren_level + + if (previous.OpensScope() or + (previous.is_comment and previous.previous_token is not None and + previous.previous_token.OpensScope())): + dedent = (style.Get('CONTINUATION_INDENT_WIDTH'), + 0)[style.Get('INDENT_CLOSING_BRACKETS')] + self.stack[-1].closing_scope_indent = ( + max(0, self.stack[-1].indent - dedent)) + self.stack[-1].split_before_closing_bracket = True + + # Calculate the split penalty. + penalty = current.split_penalty + + if must_split: + # Don't penalize for a must split. + return penalty + + if previous.is_pseudo_paren and previous.value == '(': + # Small penalty for splitting after a pseudo paren. + penalty += 50 + + # Add a penalty for each increasing newline we add, but don't penalize for + # splitting before an if-expression or list comprehension. + if current.value not in {'if', 'for'}: + last = self.stack[-1] + last.num_line_splits += 1 + penalty += ( + style.Get('SPLIT_PENALTY_FOR_ADDED_LINE_SPLIT') * + last.num_line_splits) + + if current.OpensScope() and previous.OpensScope(): + # Prefer to keep opening brackets coalesced (unless it's at the beginning + # of a function call). + pprev = previous.previous_token + if not pprev or not pprev.is_name: + penalty += 10 + + return penalty + 10 + + def MoveStateToNextToken(self): + """Calculate format decision state information and move onto the next token. + + Before moving onto the next token, we first calculate the format decision + state given the current token and its formatting decisions. Then the format + decision state is set up so that the next token can be added. + + Returns: + The penalty for the number of characters over the column limit. + """ + current = self.next_token + if not current.OpensScope() and not current.ClosesScope(): + self.lowest_level_on_line = min(self.lowest_level_on_line, + self.paren_level) + + # If we encounter an opening bracket, we add a level to our stack to prepare + # for the subsequent tokens. + if current.OpensScope(): + last = self.stack[-1] + new_indent = style.Get('CONTINUATION_INDENT_WIDTH') + last.last_space + + self.stack.append(_ParenState(new_indent, self.stack[-1].last_space)) + self.paren_level += 1 + + # If we encounter a closing bracket, we can remove a level from our + # parenthesis stack. + if len(self.stack) > 1 and current.ClosesScope(): + if format_token.Subtype.DICTIONARY_KEY_PART in current.subtypes: + self.stack[-2].last_space = self.stack[-2].indent + else: + self.stack[-2].last_space = self.stack[-1].last_space + self.stack.pop() + self.paren_level -= 1 + + is_multiline_string = current.is_string and '\n' in current.value + if is_multiline_string: + # This is a multiline string. Only look at the first line. + self.column += len(current.value.split('\n')[0]) + elif not current.is_pseudo_paren: + self.column += len(current.value) + + self.next_token = self.next_token.next_token + + # Calculate the penalty for overflowing the column limit. + penalty = 0 + if (not current.is_pylint_comment and not current.is_pytype_comment and + not current.is_copybara_comment and self.column > self.column_limit): + excess_characters = self.column - self.column_limit + penalty += style.Get('SPLIT_PENALTY_EXCESS_CHARACTER') * excess_characters + + if is_multiline_string: + # If this is a multiline string, the column is actually the + # end of the last line in the string. + self.column = len(current.value.split('\n')[-1]) + + return penalty + + def _CalculateComprehensionState(self, newline): + """Makes required changes to comprehension state. + + Args: + newline: Whether the current token is to be added on a newline. + + Returns: + The penalty for the token-newline combination given the current + comprehension state. + """ + current = self.next_token + previous = current.previous_token + top_of_stack = self.comp_stack[-1] if self.comp_stack else None + penalty = 0 + + if top_of_stack is not None: + # Check if the token terminates the current comprehension. + if current == top_of_stack.closing_bracket: + last = self.comp_stack.pop() + # Lightly penalize comprehensions that are split across multiple lines. + if last.has_interior_split: + penalty += style.Get('SPLIT_PENALTY_COMPREHENSION') + + return penalty + + if newline: + top_of_stack.has_interior_split = True + + if (format_token.Subtype.COMP_EXPR in current.subtypes and + format_token.Subtype.COMP_EXPR not in previous.subtypes): + self.comp_stack.append(object_state.ComprehensionState(current)) + return penalty + + if (current.value == 'for' and + format_token.Subtype.COMP_FOR in current.subtypes): + if top_of_stack.for_token is not None: + # Treat nested comprehensions like normal comp_if expressions. + # Example: + # my_comp = [ + # a.qux + b.qux + # for a in foo + # --> for b in bar <-- + # if a.zut + b.zut + # ] + if (style.Get('SPLIT_COMPLEX_COMPREHENSION') and + top_of_stack.has_split_at_for != newline and + (top_of_stack.has_split_at_for or + not top_of_stack.HasTrivialExpr())): + penalty += split_penalty.UNBREAKABLE + else: + top_of_stack.for_token = current + top_of_stack.has_split_at_for = newline + + # Try to keep trivial expressions on the same line as the comp_for. + if (style.Get('SPLIT_COMPLEX_COMPREHENSION') and newline and + top_of_stack.HasTrivialExpr()): + penalty += split_penalty.CONNECTED + + if (format_token.Subtype.COMP_IF in current.subtypes and + format_token.Subtype.COMP_IF not in previous.subtypes): + # Penalize breaking at comp_if when it doesn't match the newline structure + # in the rest of the comprehension. + if (style.Get('SPLIT_COMPLEX_COMPREHENSION') and + top_of_stack.has_split_at_for != newline and + (top_of_stack.has_split_at_for or not top_of_stack.HasTrivialExpr())): + penalty += split_penalty.UNBREAKABLE + + return penalty + + def _PushParameterListState(self, newline): + """Push a new parameter list state for a function definition. + + Args: + newline: Whether the current token is to be added on a newline. + """ + current = self.next_token + previous = current.previous_token + + if _IsFunctionDefinition(previous): + first_param_column = previous.total_length + self.stack[-2].indent + self.param_list_stack.append( + object_state.ParameterListState(previous, newline, + first_param_column)) + + def _CalculateParameterListState(self, newline): + """Makes required changes to parameter list state. + + Args: + newline: Whether the current token is to be added on a newline. + + Returns: + The penalty for the token-newline combination given the current + parameter state. + """ + current = self.next_token + previous = current.previous_token + penalty = 0 + + if _IsFunctionDefinition(previous): + first_param_column = previous.total_length + self.stack[-2].indent + if not newline: + param_list = self.param_list_stack[-1] + if param_list.parameters and param_list.has_typed_return: + last_param = param_list.parameters[-1].first_token + last_token = _LastTokenInLine(previous.matching_bracket) + total_length = last_token.total_length + total_length -= last_param.total_length - len(last_param.value) + if total_length + self.column > self.column_limit: + # If we need to split before the trailing code of a function + # definition with return types, then also split before the opening + # parameter so that the trailing bit isn't indented on a line by + # itself: + # + # def rrrrrrrrrrrrrrrrrrrrrr(ccccccccccccccccccccccc: Tuple[Text] + # ) -> List[Tuple[Text, Text]]: + # pass + penalty += split_penalty.VERY_STRONGLY_CONNECTED + return penalty + + if first_param_column <= self.column: + # Make sure we don't split after the opening bracket if the + # continuation indent is greater than the opening bracket: + # + # a( + # b=1, + # c=2) + penalty += split_penalty.VERY_STRONGLY_CONNECTED + return penalty + + if not self.param_list_stack: + return penalty + + param_list = self.param_list_stack[-1] + if current == self.param_list_stack[-1].closing_bracket: + self.param_list_stack.pop() # We're done with this state. + if newline and param_list.has_typed_return: + if param_list.split_before_closing_bracket: + penalty -= split_penalty.STRONGLY_CONNECTED + elif param_list.LastParamFitsOnLine(self.column): + penalty += split_penalty.STRONGLY_CONNECTED + + if (not newline and param_list.has_typed_return and + param_list.has_split_before_first_param): + # Prefer splitting before the closing bracket if there's a return type + # and we've already split before the first parameter. + penalty += split_penalty.STRONGLY_CONNECTED + + return penalty + + if not param_list.parameters: + return penalty + + if newline: + if self._FitsOnLine(param_list.parameters[0].first_token, + _LastTokenInLine(param_list.closing_bracket)): + penalty += split_penalty.STRONGLY_CONNECTED + + if (not newline and style.Get('SPLIT_BEFORE_NAMED_ASSIGNS') and + param_list.has_default_values and + current != param_list.parameters[0].first_token and + current != param_list.closing_bracket and + format_token.Subtype.PARAMETER_START in current.subtypes): + # If we want to split before parameters when there are named assigns, + # then add a penalty for not splitting. + penalty += split_penalty.STRONGLY_CONNECTED + + return penalty + + def _IndentWithContinuationAlignStyle(self, column): + if column == 0: + return column + align_style = style.Get('CONTINUATION_ALIGN_STYLE') + if align_style == 'FIXED': + return ((self.line.depth * style.Get('INDENT_WIDTH')) + + style.Get('CONTINUATION_INDENT_WIDTH')) + if align_style == 'VALIGN-RIGHT': + indent_width = style.Get('INDENT_WIDTH') + return indent_width * int((column + indent_width - 1) / indent_width) + return column + + def _GetNewlineColumn(self): + """Return the new column on the newline.""" + current = self.next_token + previous = current.previous_token + top_of_stack = self.stack[-1] + + if isinstance(current.spaces_required_before, list): + # Don't set the value here, as we need to look at the lines near + # this one to determine the actual horizontal alignment value. + return 0 + elif current.spaces_required_before > 2 or self.line.disable: + return current.spaces_required_before + + cont_aligned_indent = self._IndentWithContinuationAlignStyle( + top_of_stack.indent) + + if current.OpensScope(): + return cont_aligned_indent if self.paren_level else self.first_indent + + if current.ClosesScope(): + if (previous.OpensScope() or + (previous.is_comment and previous.previous_token is not None and + previous.previous_token.OpensScope())): + return max(0, + top_of_stack.indent - style.Get('CONTINUATION_INDENT_WIDTH')) + return top_of_stack.closing_scope_indent + + if (previous and previous.is_string and current.is_string and + format_token.Subtype.DICTIONARY_VALUE in current.subtypes): + return previous.column + + if style.Get('INDENT_DICTIONARY_VALUE'): + if previous and (previous.value == ':' or previous.is_pseudo_paren): + if format_token.Subtype.DICTIONARY_VALUE in current.subtypes: + return top_of_stack.indent + + if (not self.param_list_stack and _IsCompoundStatement(self.line.first) and + (not (style.Get('DEDENT_CLOSING_BRACKETS') or + style.Get('INDENT_CLOSING_BRACKETS')) or + style.Get('SPLIT_BEFORE_FIRST_ARGUMENT'))): + token_indent = ( + len(self.line.first.whitespace_prefix.split('\n')[-1]) + + style.Get('INDENT_WIDTH')) + if token_indent == top_of_stack.indent: + return token_indent + style.Get('CONTINUATION_INDENT_WIDTH') + + if (self.param_list_stack and + not self.param_list_stack[-1].SplitBeforeClosingBracket( + top_of_stack.indent) and top_of_stack.indent + == ((self.line.depth + 1) * style.Get('INDENT_WIDTH'))): + if (format_token.Subtype.PARAMETER_START in current.subtypes or + (previous.is_comment and + format_token.Subtype.PARAMETER_START in previous.subtypes)): + return top_of_stack.indent + style.Get('CONTINUATION_INDENT_WIDTH') + + return cont_aligned_indent + + def _FitsOnLine(self, start, end): + """Determines if line between start and end can fit on the current line.""" + length = end.total_length - start.total_length + if not start.is_pseudo_paren: + length += len(start.value) + return length + self.column <= self.column_limit + + def _EachDictEntryFitsOnOneLine(self, opening): + """Determine if each dict elems can fit on one line.""" + + def PreviousNonCommentToken(tok): + tok = tok.previous_token + while tok.is_comment: + tok = tok.previous_token + return tok + + def ImplicitStringConcatenation(tok): + num_strings = 0 + if tok.is_pseudo_paren: + tok = tok.next_token + while tok.is_string: + num_strings += 1 + tok = tok.next_token + return num_strings > 1 + + def DictValueIsContainer(opening, closing): + """Return true if the dictionary value is a container.""" + if not opening or not closing: + return False + colon = opening.previous_token + while colon: + if not colon.is_pseudo_paren: + break + colon = colon.previous_token + if not colon or colon.value != ':': + return False + key = colon.previous_token + if not key: + return False + return format_token.Subtype.DICTIONARY_KEY_PART in key.subtypes + + closing = opening.matching_bracket + entry_start = opening.next_token + current = opening.next_token.next_token + + while current and current != closing: + if format_token.Subtype.DICTIONARY_KEY in current.subtypes: + prev = PreviousNonCommentToken(current) + if prev.value == ',': + prev = PreviousNonCommentToken(prev.previous_token) + if not DictValueIsContainer(prev.matching_bracket, prev): + length = prev.total_length - entry_start.total_length + length += len(entry_start.value) + if length + self.stack[-2].indent >= self.column_limit: + return False + entry_start = current + if current.OpensScope(): + if ((current.value == '{' or + (current.is_pseudo_paren and current.next_token.value == '{') and + format_token.Subtype.DICTIONARY_VALUE in current.subtypes) or + ImplicitStringConcatenation(current)): + # A dictionary entry that cannot fit on a single line shouldn't matter + # to this calculation. If it can't fit on a single line, then the + # opening should be on the same line as the key and the rest on + # newlines after it. But the other entries should be on single lines + # if possible. + if current.matching_bracket: + current = current.matching_bracket + while current: + if current == closing: + return True + if format_token.Subtype.DICTIONARY_KEY in current.subtypes: + entry_start = current + break + current = current.next_token + else: + current = current.matching_bracket + else: + current = current.next_token + + # At this point, current is the closing bracket. Go back one to get the end + # of the dictionary entry. + current = PreviousNonCommentToken(current) + length = current.total_length - entry_start.total_length + length += len(entry_start.value) + return length + self.stack[-2].indent <= self.column_limit + + def _ArgumentListHasDictionaryEntry(self, token): + """Check if the function argument list has a dictionary as an arg.""" + if _IsArgumentToFunction(token): + while token: + if token.value == '{': + length = token.matching_bracket.total_length - token.total_length + return length + self.stack[-2].indent > self.column_limit + if token.ClosesScope(): + break + if token.OpensScope(): + token = token.matching_bracket + token = token.next_token + return False + + def _ContainerFitsOnStartLine(self, opening): + """Check if the container can fit on its starting line. + + Arguments: + opening: (FormatToken) The unwrapped line we're currently processing. + + Returns: + True if the container fits on the start line. + """ + return (opening.matching_bracket.total_length - opening.total_length + + self.stack[-1].indent) <= self.column_limit + + +_COMPOUND_STMTS = frozenset( + {'for', 'while', 'if', 'elif', 'with', 'except', 'def', 'class'}) + + +def _IsCompoundStatement(token): + if token.value == 'async': + token = token.next_token + return token.value in _COMPOUND_STMTS + + +def _IsFunctionDef(token): + if token.value == 'async': + token = token.next_token + return token.value == 'def' + + +def _IsFunctionCallWithArguments(token): + while token: + if token.value == '(': + token = token.next_token + return token and token.value != ')' + elif token.name not in {'NAME', 'DOT', 'EQUAL'}: + break + token = token.next_token + return False + + +def _IsArgumentToFunction(token): + bracket = unwrapped_line.IsSurroundedByBrackets(token) + if not bracket or bracket.value != '(': + return False + previous = bracket.previous_token + return previous and previous.is_name + + +def _GetOpeningBracket(current): + """Get the opening bracket containing the current token.""" + if current.matching_bracket and not current.is_pseudo_paren: + return current if current.OpensScope() else current.matching_bracket + + while current: + if current.ClosesScope(): + current = current.matching_bracket + elif current.is_pseudo_paren: + current = current.previous_token + elif current.OpensScope(): + return current + current = current.previous_token + return None + + +def _LastTokenInLine(current): + while not current.is_comment and current.next_token: + current = current.next_token + return current + + +def _IsFunctionDefinition(current): + prev = current.previous_token + return (current.value == '(' and prev and + format_token.Subtype.FUNC_DEF in prev.subtypes) + + +def _IsLastScopeInLine(current): + current = current.matching_bracket + while current: + current = current.next_token + if current and current.OpensScope(): + return False + return True + + +def _IsSingleElementTuple(token): + """Check if it's a single-element tuple.""" + close = token.matching_bracket + token = token.next_token + num_commas = 0 + while token != close: + if token.value == ',': + num_commas += 1 + if token.OpensScope(): + token = token.matching_bracket + else: + token = token.next_token + return num_commas == 1 + + +def _ScopeHasNoCommas(token): + """Check if the scope has no commas.""" + close = token.matching_bracket + token = token.next_token + while token != close: + if token.value == ',': + return False + if token.OpensScope(): + token = token.matching_bracket + else: + token = token.next_token + return True + + +class _ParenState(object): + """Maintains the state of the bracket enclosures. + + A stack of _ParenState objects are kept so that we know how to indent relative + to the brackets. + + Attributes: + indent: The column position to which a specified parenthesis level needs to + be indented. + last_space: The column position of the last space on each level. + closing_scope_indent: The column position of the closing indentation. + split_before_closing_bracket: Whether a newline needs to be inserted before + the closing bracket. We only want to insert a newline before the closing + bracket if there also was a newline after the beginning left bracket. + num_line_splits: Number of line splits this _ParenState contains already. + Each subsequent line split gets an increasing penalty. + """ + + # TODO(morbo): This doesn't track "bin packing." + + def __init__(self, indent, last_space): + self.indent = indent + self.last_space = last_space + self.closing_scope_indent = 0 + self.split_before_closing_bracket = False + self.num_line_splits = 0 + + def Clone(self): + state = _ParenState(self.indent, self.last_space) + state.closing_scope_indent = self.closing_scope_indent + state.split_before_closing_bracket = self.split_before_closing_bracket + state.num_line_splits = self.num_line_splits + return state + + def __repr__(self): + return '[indent::%d, last_space::%d, closing_scope_indent::%d]' % ( + self.indent, self.last_space, self.closing_scope_indent) + + def __eq__(self, other): + return hash(self) == hash(other) + + def __ne__(self, other): + return not self == other + + def __hash__(self, *args, **kwargs): + return hash((self.indent, self.last_space, self.closing_scope_indent, + self.split_before_closing_bracket, self.num_line_splits)) diff --git a/.venv/lib/python3.9/site-packages/yapf/yapflib/format_token.py b/.venv/lib/python3.9/site-packages/yapf/yapflib/format_token.py new file mode 100644 index 00000000..92c26ee5 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapf/yapflib/format_token.py @@ -0,0 +1,385 @@ +# Copyright 2015 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Pytree nodes with extra formatting information. + +This is a thin wrapper around a pytree.Leaf node. +""" + +import keyword +import re + +from lib2to3.pgen2 import token + +from yapf.yapflib import py3compat +from yapf.yapflib import pytree_utils +from yapf.yapflib import style + +CONTINUATION = token.N_TOKENS + + +class Subtype(object): + """Subtype information about tokens. + + Gleaned from parsing the code. Helps determine the best formatting. + """ + NONE = 0 + UNARY_OPERATOR = 1 + BINARY_OPERATOR = 2 + A_EXPR_OPERATOR = 3 + M_EXPR_OPERATOR = 4 + SUBSCRIPT_COLON = 5 + SUBSCRIPT_BRACKET = 6 + DEFAULT_OR_NAMED_ASSIGN = 7 + DEFAULT_OR_NAMED_ASSIGN_ARG_LIST = 8 + VARARGS_LIST = 9 + VARARGS_STAR = 10 + KWARGS_STAR_STAR = 11 + ASSIGN_OPERATOR = 12 + DICTIONARY_KEY = 13 + DICTIONARY_KEY_PART = 14 + DICTIONARY_VALUE = 15 + DICT_SET_GENERATOR = 16 + COMP_EXPR = 17 + COMP_FOR = 18 + COMP_IF = 19 + FUNC_DEF = 20 + DECORATOR = 21 + TYPED_NAME = 22 + TYPED_NAME_ARG_LIST = 23 + SIMPLE_EXPRESSION = 24 + PARAMETER_START = 25 + PARAMETER_STOP = 26 + + +def _TabbedContinuationAlignPadding(spaces, align_style, tab_width): + """Build padding string for continuation alignment in tabbed indentation. + + Arguments: + spaces: (int) The number of spaces to place before the token for alignment. + align_style: (str) The alignment style for continuation lines. + tab_width: (int) Number of columns of each tab character. + + Returns: + A padding string for alignment with style specified by align_style option. + """ + if align_style in ('FIXED', 'VALIGN-RIGHT'): + if spaces > 0: + return '\t' * int((spaces + tab_width - 1) / tab_width) + return '' + return ' ' * spaces + + +class FormatToken(object): + """A wrapper around pytree Leaf nodes. + + This represents the token plus additional information useful for reformatting + the code. + + Attributes: + node: The PyTree node this token represents. + next_token: The token in the unwrapped line after this token or None if this + is the last token in the unwrapped line. + previous_token: The token in the unwrapped line before this token or None if + this is the first token in the unwrapped line. + matching_bracket: If a bracket token ('[', '{', or '(') the matching + bracket. + parameters: If this and its following tokens make up a parameter list, then + this is a list of those parameters. + container_opening: If the object is in a container, this points to its + opening bracket. + container_elements: If this is the start of a container, a list of the + elements in the container. + whitespace_prefix: The prefix for the whitespace. + spaces_required_before: The number of spaces required before a token. This + is a lower-bound for the formatter and not a hard requirement. For + instance, a comment may have n required spaces before it. But the + formatter won't place n spaces before all comments. Only those that are + moved to the end of a line of code. The formatter may use different + spacing when appropriate. + can_break_before: True if we're allowed to break before this token. + must_break_before: True if we're required to break before this token. + total_length: The total length of the unwrapped line up to and including + whitespace and this token. However, this doesn't include the initial + indentation amount. + split_penalty: The penalty for splitting the line before this token. + """ + + def __init__(self, node): + """Constructor. + + Arguments: + node: (pytree.Leaf) The node that's being wrapped. + """ + self.node = node + self.next_token = None + self.previous_token = None + self.matching_bracket = None + self.parameters = [] + self.container_opening = None + self.container_elements = [] + self.whitespace_prefix = '' + self.can_break_before = False + self.must_break_before = False + self.total_length = 0 # TODO(morbo): Think up a better name. + self.split_penalty = 0 + + if self.is_comment: + self.spaces_required_before = style.Get('SPACES_BEFORE_COMMENT') + else: + self.spaces_required_before = 0 + + if self.is_continuation: + self.value = self.node.value.rstrip() + else: + self.value = self.node.value + + @property + def formatted_whitespace_prefix(self): + if style.Get('INDENT_BLANK_LINES'): + without_newlines = self.whitespace_prefix.lstrip('\n') + height = len(self.whitespace_prefix) - len(without_newlines) + if height: + return ('\n' + without_newlines) * height + return self.whitespace_prefix + + def AddWhitespacePrefix(self, newlines_before, spaces=0, indent_level=0): + """Register a token's whitespace prefix. + + This is the whitespace that will be output before a token's string. + + Arguments: + newlines_before: (int) The number of newlines to place before the token. + spaces: (int) The number of spaces to place before the token. + indent_level: (int) The indentation level. + """ + if style.Get('USE_TABS'): + if newlines_before > 0: + indent_before = '\t' * indent_level + _TabbedContinuationAlignPadding( + spaces, style.Get('CONTINUATION_ALIGN_STYLE'), + style.Get('INDENT_WIDTH')) + else: + indent_before = '\t' * indent_level + ' ' * spaces + else: + indent_before = (' ' * indent_level * style.Get('INDENT_WIDTH') + + ' ' * spaces) + + if self.is_comment: + comment_lines = [s.lstrip() for s in self.value.splitlines()] + self.node.value = ('\n' + indent_before).join(comment_lines) + + # Update our own value since we are changing node value + self.value = self.node.value + + if not self.whitespace_prefix: + self.whitespace_prefix = ('\n' * (self.newlines or newlines_before) + + indent_before) + else: + self.whitespace_prefix += indent_before + + def AdjustNewlinesBefore(self, newlines_before): + """Change the number of newlines before this token.""" + self.whitespace_prefix = ('\n' * newlines_before + + self.whitespace_prefix.lstrip('\n')) + + def RetainHorizontalSpacing(self, first_column, depth): + """Retains a token's horizontal spacing.""" + previous = self.previous_token + if not previous: + return + + if previous.is_pseudo_paren: + previous = previous.previous_token + if not previous: + return + + cur_lineno = self.lineno + prev_lineno = previous.lineno + if previous.is_multiline_string: + prev_lineno += previous.value.count('\n') + + if (cur_lineno != prev_lineno or + (previous.is_pseudo_paren and previous.value != ')' and + cur_lineno != previous.previous_token.lineno)): + self.spaces_required_before = ( + self.column - first_column + depth * style.Get('INDENT_WIDTH')) + return + + cur_column = self.node.column + prev_column = previous.node.column + prev_len = len(previous.value) + + if previous.is_pseudo_paren and previous.value == ')': + prev_column -= 1 + prev_len = 0 + + if previous.is_multiline_string: + prev_len = len(previous.value.split('\n')[-1]) + if '\n' in previous.value: + prev_column = 0 # Last line starts in column 0. + + self.spaces_required_before = cur_column - (prev_column + prev_len) + + def OpensScope(self): + return self.value in pytree_utils.OPENING_BRACKETS + + def ClosesScope(self): + return self.value in pytree_utils.CLOSING_BRACKETS + + def __repr__(self): + msg = 'FormatToken(name={0}, value={1}, lineno={2}'.format( + self.name, self.value, self.lineno) + msg += ', pseudo)' if self.is_pseudo_paren else ')' + return msg + + @property + @py3compat.lru_cache() + def node_split_penalty(self): + """Split penalty attached to the pytree node of this token.""" + return pytree_utils.GetNodeAnnotation( + self.node, pytree_utils.Annotation.SPLIT_PENALTY, default=0) + + @property + def newlines(self): + """The number of newlines needed before this token.""" + return pytree_utils.GetNodeAnnotation(self.node, + pytree_utils.Annotation.NEWLINES) + + @property + def must_split(self): + """Return true if the token requires a split before it.""" + return pytree_utils.GetNodeAnnotation(self.node, + pytree_utils.Annotation.MUST_SPLIT) + + @property + def column(self): + """The original column number of the node in the source.""" + return self.node.column + + @property + def lineno(self): + """The original line number of the node in the source.""" + return self.node.lineno + + @property + @py3compat.lru_cache() + def subtypes(self): + """Extra type information for directing formatting.""" + value = pytree_utils.GetNodeAnnotation(self.node, + pytree_utils.Annotation.SUBTYPE) + return [Subtype.NONE] if value is None else value + + @property + @py3compat.lru_cache() + def is_binary_op(self): + """Token is a binary operator.""" + return Subtype.BINARY_OPERATOR in self.subtypes + + @property + @py3compat.lru_cache() + def is_a_expr_op(self): + """Token is an a_expr operator.""" + return Subtype.A_EXPR_OPERATOR in self.subtypes + + @property + @py3compat.lru_cache() + def is_m_expr_op(self): + """Token is an m_expr operator.""" + return Subtype.M_EXPR_OPERATOR in self.subtypes + + @property + @py3compat.lru_cache() + def is_arithmetic_op(self): + """Token is an arithmetic operator.""" + return self.is_a_expr_op or self.is_m_expr_op + + @property + @py3compat.lru_cache() + def is_simple_expr(self): + """Token is an operator in a simple expression.""" + return Subtype.SIMPLE_EXPRESSION in self.subtypes + + @property + @py3compat.lru_cache() + def is_subscript_colon(self): + """Token is a subscript colon.""" + return Subtype.SUBSCRIPT_COLON in self.subtypes + + @property + @py3compat.lru_cache() + def name(self): + """A string representation of the node's name.""" + return pytree_utils.NodeName(self.node) + + @property + def is_comment(self): + return self.node.type == token.COMMENT + + @property + def is_continuation(self): + return self.node.type == CONTINUATION + + @property + @py3compat.lru_cache() + def is_keyword(self): + return keyword.iskeyword(self.value) + + @property + @py3compat.lru_cache() + def is_name(self): + return self.node.type == token.NAME and not self.is_keyword + + @property + def is_number(self): + return self.node.type == token.NUMBER + + @property + def is_string(self): + return self.node.type == token.STRING + + @property + @py3compat.lru_cache() + def is_multiline_string(self): + """Test if this string is a multiline string. + + Returns: + A multiline string always ends with triple quotes, so if it is a string + token, inspect the last 3 characters and return True if it is a triple + double or triple single quote mark. + """ + return self.is_string and self.value.endswith(('"""', "'''")) + + @property + @py3compat.lru_cache() + def is_docstring(self): + return self.is_multiline_string and not self.node.prev_sibling + + @property + @py3compat.lru_cache() + def is_pseudo_paren(self): + return hasattr(self.node, 'is_pseudo') and self.node.is_pseudo + + @property + def is_pylint_comment(self): + return self.is_comment and re.match(r'#.*\bpylint:\s*(disable|enable)=', + self.value) + + @property + def is_pytype_comment(self): + return self.is_comment and re.match(r'#.*\bpytype:\s*(disable|enable)=', + self.value) + + @property + def is_copybara_comment(self): + return self.is_comment and re.match(r'#.*\bcopybara:(strip|insert|replace)', + self.value) diff --git a/.venv/lib/python3.9/site-packages/yapf/yapflib/identify_container.py b/.venv/lib/python3.9/site-packages/yapf/yapflib/identify_container.py new file mode 100644 index 00000000..5c5fc5bf --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapf/yapflib/identify_container.py @@ -0,0 +1,67 @@ +# Copyright 2018 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Identify containers for lib2to3 trees. + +This module identifies containers and the elements in them. Each element points +to the opening bracket and vice-versa. + + IdentifyContainers(): the main function exported by this module. +""" + +from yapf.yapflib import pytree_utils +from yapf.yapflib import pytree_visitor + + +def IdentifyContainers(tree): + """Run the identify containers visitor over the tree, modifying it in place. + + Arguments: + tree: the top-level pytree node to annotate with subtypes. + """ + identify_containers = _IdentifyContainers() + identify_containers.Visit(tree) + + +class _IdentifyContainers(pytree_visitor.PyTreeVisitor): + """_IdentifyContainers - see file-level docstring for detailed description.""" + + def Visit_trailer(self, node): # pylint: disable=invalid-name + for child in node.children: + self.Visit(child) + + if len(node.children) != 3: + return + if pytree_utils.NodeName(node.children[0]) != 'LPAR': + return + + if pytree_utils.NodeName(node.children[1]) == 'arglist': + for child in node.children[1].children: + pytree_utils.SetOpeningBracket( + pytree_utils.FirstLeafNode(child), node.children[0]) + else: + pytree_utils.SetOpeningBracket( + pytree_utils.FirstLeafNode(node.children[1]), node.children[0]) + + def Visit_atom(self, node): # pylint: disable=invalid-name + for child in node.children: + self.Visit(child) + + if len(node.children) != 3: + return + if pytree_utils.NodeName(node.children[0]) != 'LPAR': + return + + for child in node.children[1].children: + pytree_utils.SetOpeningBracket( + pytree_utils.FirstLeafNode(child), node.children[0]) diff --git a/.venv/lib/python3.9/site-packages/yapf/yapflib/line_joiner.py b/.venv/lib/python3.9/site-packages/yapf/yapflib/line_joiner.py new file mode 100644 index 00000000..84346c26 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapf/yapflib/line_joiner.py @@ -0,0 +1,109 @@ +# Copyright 2015 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Join unwrapped lines together. + +Determine how many lines can be joined into one line. For instance, we could +join these statements into one line: + + if a == 42: + continue + +like this: + + if a == 42: continue + +There are a few restrictions: + + 1. The lines should have been joined in the original source. + 2. The joined lines must not go over the column boundary if placed on the same + line. + 3. They need to be very simple statements. + +Note: Because we don't allow the use of a semicolon to separate statements, it +follows that there can only be at most two lines to join. +""" + +from yapf.yapflib import style + +_CLASS_OR_FUNC = frozenset({'def', 'class'}) + + +def CanMergeMultipleLines(lines, last_was_merged=False): + """Determine if multiple lines can be joined into one. + + Arguments: + lines: (list of UnwrappedLine) This is a splice of UnwrappedLines from the + full code base. + last_was_merged: (bool) The last line was merged. + + Returns: + True if two consecutive lines can be joined together. In reality, this will + only happen if two consecutive lines can be joined, due to the style guide. + """ + # The indentation amount for the starting line (number of spaces). + indent_amt = lines[0].depth * style.Get('INDENT_WIDTH') + if len(lines) == 1 or indent_amt > style.Get('COLUMN_LIMIT'): + return False + + if (len(lines) >= 3 and lines[2].depth >= lines[1].depth and + lines[0].depth != lines[2].depth): + # If lines[2]'s depth is greater than or equal to line[1]'s depth, we're not + # looking at a single statement (e.g., if-then, while, etc.). A following + # line with the same depth as the first line isn't part of the lines we + # would want to combine. + return False # Don't merge more than two lines together. + + if lines[0].first.value in _CLASS_OR_FUNC: + # Don't join lines onto the starting line of a class or function. + return False + + limit = style.Get('COLUMN_LIMIT') - indent_amt + if lines[0].last.total_length < limit: + limit -= lines[0].last.total_length + + if lines[0].first.value == 'if': + return _CanMergeLineIntoIfStatement(lines, limit) + if last_was_merged and lines[0].first.value in {'elif', 'else'}: + return _CanMergeLineIntoIfStatement(lines, limit) + + # TODO(morbo): Other control statements? + + return False + + +def _CanMergeLineIntoIfStatement(lines, limit): + """Determine if we can merge a short if-then statement into one line. + + Two lines of an if-then statement can be merged if they were that way in the + original source, fit on the line without going over the column limit, and are + considered "simple" statements --- typically statements like 'pass', + 'continue', and 'break'. + + Arguments: + lines: (list of UnwrappedLine) The lines we are wanting to merge. + limit: (int) The amount of space remaining on the line. + + Returns: + True if the lines can be merged, False otherwise. + """ + if len(lines[1].tokens) == 1 and lines[1].last.is_multiline_string: + # This might be part of a multiline shebang. + return True + if lines[0].lineno != lines[1].lineno: + # Don't merge lines if the original lines weren't merged. + return False + if lines[1].last.total_length >= limit: + # Don't merge lines if the result goes over the column limit. + return False + return style.Get('JOIN_MULTIPLE_LINES') diff --git a/.venv/lib/python3.9/site-packages/yapf/yapflib/object_state.py b/.venv/lib/python3.9/site-packages/yapf/yapflib/object_state.py new file mode 100644 index 00000000..4ae8eaeb --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapf/yapflib/object_state.py @@ -0,0 +1,235 @@ +# Copyright 2017 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Represents the state of Python objects being formatted. + +Objects (e.g., list comprehensions, dictionaries, etc.) have specific +requirements on how they're formatted. These state objects keep track of these +requirements. +""" + +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function + +from yapf.yapflib import format_token +from yapf.yapflib import py3compat +from yapf.yapflib import style + + +class ComprehensionState(object): + """Maintains the state of list comprehension formatting decisions. + + A stack of ComprehensionState objects are kept to ensure that list + comprehensions are wrapped with well-defined rules. + + Attributes: + expr_token: The first token in the comprehension. + for_token: The first 'for' token of the comprehension. + opening_bracket: The opening bracket of the list comprehension. + closing_bracket: The closing bracket of the list comprehension. + has_split_at_for: Whether there is a newline immediately before the + for_token. + has_interior_split: Whether there is a newline within the comprehension. + That is, a split somewhere after expr_token or before closing_bracket. + """ + + def __init__(self, expr_token): + self.expr_token = expr_token + self.for_token = None + self.has_split_at_for = False + self.has_interior_split = False + + def HasTrivialExpr(self): + """Returns whether the comp_expr is "trivial" i.e. is a single token.""" + return self.expr_token.next_token.value == 'for' + + @property + def opening_bracket(self): + return self.expr_token.previous_token + + @property + def closing_bracket(self): + return self.opening_bracket.matching_bracket + + def Clone(self): + clone = ComprehensionState(self.expr_token) + clone.for_token = self.for_token + clone.has_split_at_for = self.has_split_at_for + clone.has_interior_split = self.has_interior_split + return clone + + def __repr__(self): + return ('[opening_bracket::%s, for_token::%s, has_split_at_for::%s,' + ' has_interior_split::%s, has_trivial_expr::%s]' % + (self.opening_bracket, self.for_token, self.has_split_at_for, + self.has_interior_split, self.HasTrivialExpr())) + + def __eq__(self, other): + return hash(self) == hash(other) + + def __ne__(self, other): + return not self == other + + def __hash__(self, *args, **kwargs): + return hash((self.expr_token, self.for_token, self.has_split_at_for, + self.has_interior_split)) + + +class ParameterListState(object): + """Maintains the state of function parameter list formatting decisions. + + Attributes: + opening_bracket: The opening bracket of the parameter list. + closing_bracket: The closing bracket of the parameter list. + has_typed_return: True if the function definition has a typed return. + ends_in_comma: True if the parameter list ends in a comma. + last_token: Returns the last token of the function declaration. + has_default_values: True if the parameters have default values. + has_split_before_first_param: Whether there is a newline before the first + parameter. + opening_column: The position of the opening parameter before a newline. + parameters: A list of parameter objects (Parameter). + split_before_closing_bracket: Split before the closing bracket. Sometimes + needed if the indentation would collide. + """ + + def __init__(self, opening_bracket, newline, opening_column): + self.opening_bracket = opening_bracket + self.has_split_before_first_param = newline + self.opening_column = opening_column + self.parameters = opening_bracket.parameters + self.split_before_closing_bracket = False + + @property + def closing_bracket(self): + return self.opening_bracket.matching_bracket + + @property + def has_typed_return(self): + return self.closing_bracket.next_token.value == '->' + + @property + @py3compat.lru_cache() + def has_default_values(self): + return any(param.has_default_value for param in self.parameters) + + @property + @py3compat.lru_cache() + def ends_in_comma(self): + if not self.parameters: + return False + return self.parameters[-1].last_token.next_token.value == ',' + + @property + @py3compat.lru_cache() + def last_token(self): + token = self.opening_bracket.matching_bracket + while not token.is_comment and token.next_token: + token = token.next_token + return token + + @py3compat.lru_cache() + def LastParamFitsOnLine(self, indent): + """Return true if the last parameter fits on a single line.""" + if not self.has_typed_return: + return False + if not self.parameters: + return True + total_length = self.last_token.total_length + last_param = self.parameters[-1].first_token + total_length -= last_param.total_length - len(last_param.value) + return total_length + indent <= style.Get('COLUMN_LIMIT') + + @py3compat.lru_cache() + def SplitBeforeClosingBracket(self, indent): + """Return true if there's a split before the closing bracket.""" + if style.Get('DEDENT_CLOSING_BRACKETS'): + return True + if self.ends_in_comma: + return True + if not self.parameters: + return False + total_length = self.last_token.total_length + last_param = self.parameters[-1].first_token + total_length -= last_param.total_length - len(last_param.value) + return total_length + indent > style.Get('COLUMN_LIMIT') + + def Clone(self): + clone = ParameterListState(self.opening_bracket, + self.has_split_before_first_param, + self.opening_column) + clone.split_before_closing_bracket = self.split_before_closing_bracket + clone.parameters = [param.Clone() for param in self.parameters] + return clone + + def __repr__(self): + return ('[opening_bracket::%s, has_split_before_first_param::%s, ' + 'opening_column::%d]' % + (self.opening_bracket, self.has_split_before_first_param, + self.opening_column)) + + def __eq__(self, other): + return hash(self) == hash(other) + + def __ne__(self, other): + return not self == other + + def __hash__(self, *args, **kwargs): + return hash( + (self.opening_bracket, self.has_split_before_first_param, + self.opening_column, (hash(param) for param in self.parameters))) + + +class Parameter(object): + """A parameter in a parameter list. + + Attributes: + first_token: (format_token.FormatToken) First token of parameter. + last_token: (format_token.FormatToken) Last token of parameter. + has_default_value: (boolean) True if the parameter has a default value + """ + + def __init__(self, first_token, last_token): + self.first_token = first_token + self.last_token = last_token + + @property + @py3compat.lru_cache() + def has_default_value(self): + """Returns true if the parameter has a default value.""" + tok = self.first_token + while tok != self.last_token: + if format_token.Subtype.DEFAULT_OR_NAMED_ASSIGN in tok.subtypes: + return True + if tok.OpensScope(): + tok = tok.matching_bracket + else: + tok = tok.next_token + return False + + def Clone(self): + return Parameter(self.first_token, self.last_token) + + def __repr__(self): + return '[first_token::%s, last_token:%s]' % (self.first_token, + self.last_token) + + def __eq__(self, other): + return hash(self) == hash(other) + + def __ne__(self, other): + return not self == other + + def __hash__(self, *args, **kwargs): + return hash((self.first_token, self.last_token)) diff --git a/.venv/lib/python3.9/site-packages/yapf/yapflib/py3compat.py b/.venv/lib/python3.9/site-packages/yapf/yapflib/py3compat.py new file mode 100644 index 00000000..7c905237 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapf/yapflib/py3compat.py @@ -0,0 +1,131 @@ +# Copyright 2015 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Utilities for Python2 / Python3 compatibility.""" + +import codecs +import io +import os +import sys + +PY3 = sys.version_info[0] >= 3 +PY36 = sys.version_info[0] >= 3 and sys.version_info[1] >= 6 +PY37 = sys.version_info[0] >= 3 and sys.version_info[1] >= 7 +PY38 = sys.version_info[0] >= 3 and sys.version_info[1] >= 8 + +if PY3: + StringIO = io.StringIO + BytesIO = io.BytesIO + + import codecs + + def open_with_encoding(filename, mode, encoding, newline=''): # pylint: disable=unused-argument + return codecs.open(filename, mode=mode, encoding=encoding) + + import functools + lru_cache = functools.lru_cache + + range = range + ifilter = filter + + def raw_input(): + wrapper = io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8') + return wrapper.buffer.raw.readall().decode('utf-8') + + import configparser + + # Mappings from strings to booleans (such as '1' to True, 'false' to False, + # etc.) + CONFIGPARSER_BOOLEAN_STATES = configparser.ConfigParser.BOOLEAN_STATES +else: + import __builtin__ + import cStringIO + StringIO = BytesIO = cStringIO.StringIO + + open_with_encoding = io.open + + # Python 2.7 doesn't have a native LRU cache, so do nothing. + def lru_cache(maxsize=128, typed=False): + + def fake_wrapper(user_function): + return user_function + + return fake_wrapper + + range = xrange + + from itertools import ifilter + raw_input = raw_input + + import ConfigParser as configparser + CONFIGPARSER_BOOLEAN_STATES = configparser.ConfigParser._boolean_states # pylint: disable=protected-access + + +def EncodeAndWriteToStdout(s, encoding='utf-8'): + """Encode the given string and emit to stdout. + + The string may contain non-ascii characters. This is a problem when stdout is + redirected, because then Python doesn't know the encoding and we may get a + UnicodeEncodeError. + + Arguments: + s: (string) The string to encode. + encoding: (string) The encoding of the string. + """ + if PY3: + sys.stdout.buffer.write(s.encode(encoding)) + elif sys.platform == 'win32': + # On python 2 and Windows universal newline transformation will be in + # effect on stdout. Python 2 will not let us avoid the easily because + # it happens based on whether the file handle is opened in O_BINARY or + # O_TEXT state. However we can tell Windows itself to change the current + # mode, and python 2 will follow suit. However we must take care to change + # the mode on the actual external stdout not just the current sys.stdout + # which may have been monkey-patched inside the python environment. + import msvcrt # pylint: disable=g-import-not-at-top + if sys.__stdout__ is sys.stdout: + msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY) + sys.stdout.write(s.encode(encoding)) + else: + sys.stdout.write(s.encode(encoding)) + + +if PY3: + basestring = str + unicode = str # pylint: disable=redefined-builtin,invalid-name +else: + basestring = basestring + + def unicode(s): # pylint: disable=invalid-name + """Force conversion of s to unicode.""" + return __builtin__.unicode(s, 'utf-8') + + +# In Python 3.2+, readfp is deprecated in favor of read_file, which doesn't +# exist in Python 2 yet. To avoid deprecation warnings, subclass ConfigParser to +# fix this - now read_file works across all Python versions we care about. +class ConfigParser(configparser.ConfigParser): + if not PY3: + + def read_file(self, fp, source=None): + self.readfp(fp, filename=source) + + +def removeBOM(source): + """Remove any Byte-order-Mark bytes from the beginning of a file.""" + bom = codecs.BOM_UTF8 + if PY3: + bom = bom.decode('utf-8') + if source.startswith(bom): + return source[len(bom):] + return source diff --git a/.venv/lib/python3.9/site-packages/yapf/yapflib/pytree_unwrapper.py b/.venv/lib/python3.9/site-packages/yapf/yapflib/pytree_unwrapper.py new file mode 100644 index 00000000..c7e32a3e --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapf/yapflib/pytree_unwrapper.py @@ -0,0 +1,424 @@ +# Copyright 2015 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""PyTreeUnwrapper - produces a list of unwrapped lines from a pytree. + +[for a description of what an unwrapped line is, see unwrapped_line.py] + +This is a pytree visitor that goes over a parse tree and produces a list of +UnwrappedLine containers from it, each with its own depth and containing all +the tokens that could fit on the line if there were no maximal line-length +limitations. + +Note: a precondition to running this visitor and obtaining correct results is +for the tree to have its comments spliced in as nodes. Prefixes are ignored. + +For most uses, the convenience function UnwrapPyTree should be sufficient. +""" + +# The word "token" is overloaded within this module, so for clarity rename +# the imported pgen2.token module. +from lib2to3 import pytree +from lib2to3.pgen2 import token as grammar_token + +from yapf.yapflib import format_token +from yapf.yapflib import object_state +from yapf.yapflib import pytree_utils +from yapf.yapflib import pytree_visitor +from yapf.yapflib import split_penalty +from yapf.yapflib import style +from yapf.yapflib import unwrapped_line + + +def UnwrapPyTree(tree): + """Create and return a list of unwrapped lines from the given pytree. + + Arguments: + tree: the top-level pytree node to unwrap. + + Returns: + A list of UnwrappedLine objects. + """ + unwrapper = PyTreeUnwrapper() + unwrapper.Visit(tree) + uwlines = unwrapper.GetUnwrappedLines() + uwlines.sort(key=lambda x: x.lineno) + return uwlines + + +# Grammar tokens considered as whitespace for the purpose of unwrapping. +_WHITESPACE_TOKENS = frozenset([ + grammar_token.NEWLINE, grammar_token.DEDENT, grammar_token.INDENT, + grammar_token.ENDMARKER +]) + + +class PyTreeUnwrapper(pytree_visitor.PyTreeVisitor): + """PyTreeUnwrapper - see file-level docstring for detailed description. + + Note: since this implements PyTreeVisitor and node names in lib2to3 are + underscore_separated, the visiting methods of this class are named as + Visit_node_name. invalid-name pragmas are added to each such method to silence + a style warning. This is forced on us by the usage of lib2to3, and re-munging + method names to make them different from actual node names sounded like a + confusing and brittle affair that wasn't worth it for this small & controlled + deviation from the style guide. + + To understand the connection between visitor methods in this class, some + familiarity with the Python grammar is required. + """ + + def __init__(self): + # A list of all unwrapped lines finished visiting so far. + self._unwrapped_lines = [] + + # Builds up a "current" unwrapped line while visiting pytree nodes. Some + # nodes will finish a line and start a new one. + self._cur_unwrapped_line = unwrapped_line.UnwrappedLine(0) + + # Current indentation depth. + self._cur_depth = 0 + + def GetUnwrappedLines(self): + """Fetch the result of the tree walk. + + Note: only call this after visiting the whole tree. + + Returns: + A list of UnwrappedLine objects. + """ + # Make sure the last line that was being populated is flushed. + self._StartNewLine() + return self._unwrapped_lines + + def _StartNewLine(self): + """Finish current line and start a new one. + + Place the currently accumulated line into the _unwrapped_lines list and + start a new one. + """ + if self._cur_unwrapped_line.tokens: + self._unwrapped_lines.append(self._cur_unwrapped_line) + _MatchBrackets(self._cur_unwrapped_line) + _IdentifyParameterLists(self._cur_unwrapped_line) + _AdjustSplitPenalty(self._cur_unwrapped_line) + self._cur_unwrapped_line = unwrapped_line.UnwrappedLine(self._cur_depth) + + _STMT_TYPES = frozenset({ + 'if_stmt', + 'while_stmt', + 'for_stmt', + 'try_stmt', + 'expect_clause', + 'with_stmt', + 'funcdef', + 'classdef', + }) + + # pylint: disable=invalid-name,missing-docstring + def Visit_simple_stmt(self, node): + # A 'simple_stmt' conveniently represents a non-compound Python statement, + # i.e. a statement that does not contain other statements. + + # When compound nodes have a single statement as their suite, the parser + # can leave it in the tree directly without creating a suite. But we have + # to increase depth in these cases as well. However, don't increase the + # depth of we have a simple_stmt that's a comment node. This represents a + # standalone comment and in the case of it coming directly after the + # funcdef, it is a "top" comment for the whole function. + # TODO(eliben): add more relevant compound statements here. + single_stmt_suite = ( + node.parent and pytree_utils.NodeName(node.parent) in self._STMT_TYPES) + is_comment_stmt = pytree_utils.IsCommentStatement(node) + if single_stmt_suite and not is_comment_stmt: + self._cur_depth += 1 + self._StartNewLine() + self.DefaultNodeVisit(node) + if single_stmt_suite and not is_comment_stmt: + self._cur_depth -= 1 + + def _VisitCompoundStatement(self, node, substatement_names): + """Helper for visiting compound statements. + + Python compound statements serve as containers for other statements. Thus, + when we encounter a new compound statement we start a new unwrapped line. + + Arguments: + node: the node to visit. + substatement_names: set of node names. A compound statement will be + recognized as a NAME node with a name in this set. + """ + for child in node.children: + # A pytree is structured in such a way that a single 'if_stmt' node will + # contain all the 'if', 'elif' and 'else' nodes as children (similar + # structure applies to 'while' statements, 'try' blocks, etc). Therefore, + # we visit all children here and create a new line before the requested + # set of nodes. + if (child.type == grammar_token.NAME and + child.value in substatement_names): + self._StartNewLine() + self.Visit(child) + + _IF_STMT_ELEMS = frozenset({'if', 'else', 'elif'}) + + def Visit_if_stmt(self, node): # pylint: disable=invalid-name + self._VisitCompoundStatement(node, self._IF_STMT_ELEMS) + + _WHILE_STMT_ELEMS = frozenset({'while', 'else'}) + + def Visit_while_stmt(self, node): # pylint: disable=invalid-name + self._VisitCompoundStatement(node, self._WHILE_STMT_ELEMS) + + _FOR_STMT_ELEMS = frozenset({'for', 'else'}) + + def Visit_for_stmt(self, node): # pylint: disable=invalid-name + self._VisitCompoundStatement(node, self._FOR_STMT_ELEMS) + + _TRY_STMT_ELEMS = frozenset({'try', 'except', 'else', 'finally'}) + + def Visit_try_stmt(self, node): # pylint: disable=invalid-name + self._VisitCompoundStatement(node, self._TRY_STMT_ELEMS) + + _EXCEPT_STMT_ELEMS = frozenset({'except'}) + + def Visit_except_clause(self, node): # pylint: disable=invalid-name + self._VisitCompoundStatement(node, self._EXCEPT_STMT_ELEMS) + + _FUNC_DEF_ELEMS = frozenset({'def'}) + + def Visit_funcdef(self, node): # pylint: disable=invalid-name + self._VisitCompoundStatement(node, self._FUNC_DEF_ELEMS) + + def Visit_async_funcdef(self, node): # pylint: disable=invalid-name + self._StartNewLine() + index = 0 + for child in node.children: + index += 1 + self.Visit(child) + if pytree_utils.NodeName(child) == 'ASYNC': + break + for child in node.children[index].children: + self.Visit(child) + + _CLASS_DEF_ELEMS = frozenset({'class'}) + + def Visit_classdef(self, node): # pylint: disable=invalid-name + self._VisitCompoundStatement(node, self._CLASS_DEF_ELEMS) + + def Visit_async_stmt(self, node): # pylint: disable=invalid-name + self._StartNewLine() + index = 0 + for child in node.children: + index += 1 + self.Visit(child) + if pytree_utils.NodeName(child) == 'ASYNC': + break + for child in node.children[index].children: + if pytree_utils.NodeName(child) == 'NAME' and child.value == 'else': + self._StartNewLine() + self.Visit(child) + + def Visit_decorator(self, node): # pylint: disable=invalid-name + for child in node.children: + self.Visit(child) + if (pytree_utils.NodeName(child) == 'COMMENT' and + child == node.children[0]): + self._StartNewLine() + + def Visit_decorators(self, node): # pylint: disable=invalid-name + for child in node.children: + self._StartNewLine() + self.Visit(child) + + def Visit_decorated(self, node): # pylint: disable=invalid-name + for child in node.children: + self._StartNewLine() + self.Visit(child) + + _WITH_STMT_ELEMS = frozenset({'with'}) + + def Visit_with_stmt(self, node): # pylint: disable=invalid-name + self._VisitCompoundStatement(node, self._WITH_STMT_ELEMS) + + def Visit_suite(self, node): # pylint: disable=invalid-name + # A 'suite' starts a new indentation level in Python. + self._cur_depth += 1 + self._StartNewLine() + self.DefaultNodeVisit(node) + self._cur_depth -= 1 + + def Visit_listmaker(self, node): # pylint: disable=invalid-name + _DetermineMustSplitAnnotation(node) + self.DefaultNodeVisit(node) + + def Visit_dictsetmaker(self, node): # pylint: disable=invalid-name + _DetermineMustSplitAnnotation(node) + self.DefaultNodeVisit(node) + + def Visit_import_as_names(self, node): # pylint: disable=invalid-name + if node.prev_sibling.value == '(': + _DetermineMustSplitAnnotation(node) + self.DefaultNodeVisit(node) + + def Visit_testlist_gexp(self, node): # pylint: disable=invalid-name + _DetermineMustSplitAnnotation(node) + self.DefaultNodeVisit(node) + + def Visit_arglist(self, node): # pylint: disable=invalid-name + _DetermineMustSplitAnnotation(node) + self.DefaultNodeVisit(node) + + def Visit_typedargslist(self, node): # pylint: disable=invalid-name + _DetermineMustSplitAnnotation(node) + self.DefaultNodeVisit(node) + + def DefaultLeafVisit(self, leaf): + """Default visitor for tree leaves. + + A tree leaf is always just gets appended to the current unwrapped line. + + Arguments: + leaf: the leaf to visit. + """ + if leaf.type in _WHITESPACE_TOKENS: + self._StartNewLine() + elif leaf.type != grammar_token.COMMENT or leaf.value.strip(): + # Add non-whitespace tokens and comments that aren't empty. + self._cur_unwrapped_line.AppendNode(leaf) + + +_BRACKET_MATCH = {')': '(', '}': '{', ']': '['} + + +def _MatchBrackets(uwline): + """Visit the node and match the brackets. + + For every open bracket ('[', '{', or '('), find the associated closing bracket + and "match" them up. I.e., save in the token a pointer to its associated open + or close bracket. + + Arguments: + uwline: (UnwrappedLine) An unwrapped line. + """ + bracket_stack = [] + for token in uwline.tokens: + if token.value in pytree_utils.OPENING_BRACKETS: + bracket_stack.append(token) + elif token.value in pytree_utils.CLOSING_BRACKETS: + bracket_stack[-1].matching_bracket = token + token.matching_bracket = bracket_stack[-1] + bracket_stack.pop() + + for bracket in bracket_stack: + if id(pytree_utils.GetOpeningBracket(token.node)) == id(bracket.node): + bracket.container_elements.append(token) + token.container_opening = bracket + + +def _IdentifyParameterLists(uwline): + """Visit the node to create a state for parameter lists. + + For instance, a parameter is considered an "object" with its first and last + token uniquely identifying the object. + + Arguments: + uwline: (UnwrappedLine) An unwrapped line. + """ + func_stack = [] + param_stack = [] + for tok in uwline.tokens: + # Identify parameter list objects. + if format_token.Subtype.FUNC_DEF in tok.subtypes: + assert tok.next_token.value == '(' + func_stack.append(tok.next_token) + continue + + if func_stack and tok.value == ')': + if tok == func_stack[-1].matching_bracket: + func_stack.pop() + continue + + # Identify parameter objects. + if format_token.Subtype.PARAMETER_START in tok.subtypes: + param_stack.append(tok) + + # Not "elif", a parameter could be a single token. + if param_stack and format_token.Subtype.PARAMETER_STOP in tok.subtypes: + start = param_stack.pop() + func_stack[-1].parameters.append(object_state.Parameter(start, tok)) + + +def _AdjustSplitPenalty(uwline): + """Visit the node and adjust the split penalties if needed. + + A token shouldn't be split if it's not within a bracket pair. Mark any token + that's not within a bracket pair as "unbreakable". + + Arguments: + uwline: (UnwrappedLine) An unwrapped line. + """ + bracket_level = 0 + for index, token in enumerate(uwline.tokens): + if index and not bracket_level: + pytree_utils.SetNodeAnnotation(token.node, + pytree_utils.Annotation.SPLIT_PENALTY, + split_penalty.UNBREAKABLE) + if token.value in pytree_utils.OPENING_BRACKETS: + bracket_level += 1 + elif token.value in pytree_utils.CLOSING_BRACKETS: + bracket_level -= 1 + + +def _DetermineMustSplitAnnotation(node): + """Enforce a split in the list if the list ends with a comma.""" + if style.Get('DISABLE_ENDING_COMMA_HEURISTIC'): + return + if not _ContainsComments(node): + token = next(node.parent.leaves()) + if token.value == '(': + if sum(1 for ch in node.children + if pytree_utils.NodeName(ch) == 'COMMA') < 2: + return + if (not isinstance(node.children[-1], pytree.Leaf) or + node.children[-1].value != ','): + return + num_children = len(node.children) + index = 0 + _SetMustSplitOnFirstLeaf(node.children[0]) + while index < num_children - 1: + child = node.children[index] + if isinstance(child, pytree.Leaf) and child.value == ',': + next_child = node.children[index + 1] + if next_child.type == grammar_token.COMMENT: + index += 1 + if index >= num_children - 1: + break + _SetMustSplitOnFirstLeaf(node.children[index + 1]) + index += 1 + + +def _ContainsComments(node): + """Return True if the list has a comment in it.""" + if isinstance(node, pytree.Leaf): + return node.type == grammar_token.COMMENT + for child in node.children: + if _ContainsComments(child): + return True + return False + + +def _SetMustSplitOnFirstLeaf(node): + """Set the "must split" annotation on the first leaf node.""" + pytree_utils.SetNodeAnnotation( + pytree_utils.FirstLeafNode(node), pytree_utils.Annotation.MUST_SPLIT, + True) diff --git a/.venv/lib/python3.9/site-packages/yapf/yapflib/pytree_utils.py b/.venv/lib/python3.9/site-packages/yapf/yapflib/pytree_utils.py new file mode 100644 index 00000000..75d4ca20 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapf/yapflib/pytree_utils.py @@ -0,0 +1,346 @@ +# Copyright 2015 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""pytree-related utilities. + +This module collects various utilities related to the parse trees produced by +the lib2to3 library. + + NodeName(): produces a string name for pytree nodes. + ParseCodeToTree(): convenience wrapper around lib2to3 interfaces to parse + a given string with code to a pytree. + InsertNodeBefore(): insert a node before another in a pytree. + InsertNodeAfter(): insert a node after another in a pytree. + {Get,Set}NodeAnnotation(): manage custom annotations on pytree nodes. +""" + +import ast + +from lib2to3 import pygram +from lib2to3 import pytree +from lib2to3.pgen2 import driver +from lib2to3.pgen2 import parse +from lib2to3.pgen2 import token + +# TODO(eliben): We may want to get rid of this filtering at some point once we +# have a better understanding of what information we need from the tree. Then, +# these tokens may be filtered out from the tree before the tree gets to the +# unwrapper. +NONSEMANTIC_TOKENS = frozenset(['DEDENT', 'INDENT', 'NEWLINE', 'ENDMARKER']) + +OPENING_BRACKETS = frozenset({'(', '[', '{'}) +CLOSING_BRACKETS = frozenset({')', ']', '}'}) + + +class Annotation(object): + """Annotation names associated with pytrees.""" + CHILD_INDENT = 'child_indent' + NEWLINES = 'newlines' + MUST_SPLIT = 'must_split' + SPLIT_PENALTY = 'split_penalty' + SUBTYPE = 'subtype' + + +def NodeName(node): + """Produce a string name for a given node. + + For a Leaf this is the token name, and for a Node this is the type. + + Arguments: + node: a tree node + + Returns: + Name as a string. + """ + # Nodes with values < 256 are tokens. Values >= 256 are grammar symbols. + if node.type < 256: + return token.tok_name[node.type] + else: + return pygram.python_grammar.number2symbol[node.type] + + +def FirstLeafNode(node): + if isinstance(node, pytree.Leaf): + return node + return FirstLeafNode(node.children[0]) + + +def LastLeafNode(node): + if isinstance(node, pytree.Leaf): + return node + return LastLeafNode(node.children[-1]) + + +# lib2to3 thoughtfully provides pygram.python_grammar_no_print_statement for +# parsing Python 3 code that wouldn't parse otherwise (when 'print' is used in a +# context where a keyword is disallowed). +# It forgets to do the same for 'exec' though. Luckily, Python is amenable to +# monkey-patching. +_GRAMMAR_FOR_PY3 = pygram.python_grammar_no_print_statement.copy() +del _GRAMMAR_FOR_PY3.keywords['exec'] + +_GRAMMAR_FOR_PY2 = pygram.python_grammar.copy() +del _GRAMMAR_FOR_PY2.keywords['nonlocal'] + + +def ParseCodeToTree(code): + """Parse the given code to a lib2to3 pytree. + + Arguments: + code: a string with the code to parse. + + Raises: + SyntaxError if the code is invalid syntax. + parse.ParseError if some other parsing failure. + + Returns: + The root node of the parsed tree. + """ + # This function is tiny, but the incantation for invoking the parser correctly + # is sufficiently magical to be worth abstracting away. + try: + # Try to parse using a Python 3 grammar, which is more permissive (print and + # exec are not keywords). + parser_driver = driver.Driver(_GRAMMAR_FOR_PY3, convert=pytree.convert) + tree = parser_driver.parse_string(code, debug=False) + except parse.ParseError: + # Now try to parse using a Python 2 grammar; If this fails, then + # there's something else wrong with the code. + try: + parser_driver = driver.Driver(_GRAMMAR_FOR_PY2, convert=pytree.convert) + tree = parser_driver.parse_string(code, debug=False) + except parse.ParseError: + # Raise a syntax error if the code is invalid python syntax. + try: + ast.parse(code) + except SyntaxError as e: + raise e + else: + raise + return _WrapEndMarker(tree) + + +def _WrapEndMarker(tree): + """Wrap a single ENDMARKER token in a "file_input" node. + + Arguments: + tree: (pytree.Node) The root node of the parsed tree. + + Returns: + The root node of the parsed tree. If the tree is a single ENDMARKER node, + then that node is wrapped in a "file_input" node. That will ensure we don't + skip comments attached to that node. + """ + if isinstance(tree, pytree.Leaf) and tree.type == token.ENDMARKER: + return pytree.Node(pygram.python_symbols.file_input, [tree]) + return tree + + +def InsertNodesBefore(new_nodes, target): + """Insert new_nodes before the given target location in the tree. + + Arguments: + new_nodes: a sequence of new nodes to insert (the nodes should not be in the + tree). + target: the target node before which the new node node will be inserted. + + Raises: + RuntimeError: if the tree is corrupted, or the insertion would corrupt it. + """ + for node in new_nodes: + _InsertNodeAt(node, target, after=False) + + +def InsertNodesAfter(new_nodes, target): + """Insert new_nodes after the given target location in the tree. + + Arguments: + new_nodes: a sequence of new nodes to insert (the nodes should not be in the + tree). + target: the target node after which the new node node will be inserted. + + Raises: + RuntimeError: if the tree is corrupted, or the insertion would corrupt it. + """ + for node in reversed(new_nodes): + _InsertNodeAt(node, target, after=True) + + +def _InsertNodeAt(new_node, target, after=False): + """Underlying implementation for node insertion. + + Arguments: + new_node: a new node to insert (this node should not be in the tree). + target: the target node. + after: if True, new_node is inserted after target. Otherwise, it's inserted + before target. + + Returns: + nothing + + Raises: + RuntimeError: if the tree is corrupted, or the insertion would corrupt it. + """ + + # Protect against attempts to insert nodes which already belong to some tree. + if new_node.parent is not None: + raise RuntimeError('inserting node which already has a parent', + (new_node, new_node.parent)) + + # The code here is based on pytree.Base.next_sibling + parent_of_target = target.parent + if parent_of_target is None: + raise RuntimeError('expected target node to have a parent', (target,)) + + for i, child in enumerate(parent_of_target.children): + if child is target: + insertion_index = i + 1 if after else i + parent_of_target.insert_child(insertion_index, new_node) + return + + raise RuntimeError('unable to find insertion point for target node', + (target,)) + + +# The following constant and functions implement a simple custom annotation +# mechanism for pytree nodes. We attach new attributes to nodes. Each attribute +# is prefixed with _NODE_ANNOTATION_PREFIX. These annotations should only be +# managed through GetNodeAnnotation and SetNodeAnnotation. +_NODE_ANNOTATION_PREFIX = '_yapf_annotation_' + + +def CopyYapfAnnotations(src, dst): + """Copy all YAPF annotations from the source node to the destination node. + + Arguments: + src: the source node. + dst: the destination node. + """ + for annotation in dir(src): + if annotation.startswith(_NODE_ANNOTATION_PREFIX): + setattr(dst, annotation, getattr(src, annotation, None)) + + +def GetNodeAnnotation(node, annotation, default=None): + """Get annotation value from a node. + + Arguments: + node: the node. + annotation: annotation name - a string. + default: the default value to return if there's no annotation. + + Returns: + Value of the annotation in the given node. If the node doesn't have this + particular annotation name yet, returns default. + """ + return getattr(node, _NODE_ANNOTATION_PREFIX + annotation, default) + + +def SetNodeAnnotation(node, annotation, value): + """Set annotation value on a node. + + Arguments: + node: the node. + annotation: annotation name - a string. + value: annotation value to set. + """ + setattr(node, _NODE_ANNOTATION_PREFIX + annotation, value) + + +def AppendNodeAnnotation(node, annotation, value): + """Appends an annotation value to a list of annotations on the node. + + Arguments: + node: the node. + annotation: annotation name - a string. + value: annotation value to set. + """ + attr = GetNodeAnnotation(node, annotation, set()) + attr.add(value) + SetNodeAnnotation(node, annotation, attr) + + +def RemoveSubtypeAnnotation(node, value): + """Removes an annotation value from the subtype annotations on the node. + + Arguments: + node: the node. + value: annotation value to remove. + """ + attr = GetNodeAnnotation(node, Annotation.SUBTYPE) + if attr and value in attr: + attr.remove(value) + SetNodeAnnotation(node, Annotation.SUBTYPE, attr) + + +def GetOpeningBracket(node): + """Get opening bracket value from a node. + + Arguments: + node: the node. + + Returns: + The opening bracket node or None if it couldn't find one. + """ + return getattr(node, _NODE_ANNOTATION_PREFIX + 'container_bracket', None) + + +def SetOpeningBracket(node, bracket): + """Set opening bracket value for a node. + + Arguments: + node: the node. + bracket: opening bracket to set. + """ + setattr(node, _NODE_ANNOTATION_PREFIX + 'container_bracket', bracket) + + +def DumpNodeToString(node): + """Dump a string representation of the given node. For debugging. + + Arguments: + node: the node. + + Returns: + The string representation. + """ + if isinstance(node, pytree.Leaf): + fmt = ('{name}({value}) [lineno={lineno}, column={column}, ' + 'prefix={prefix}, penalty={penalty}]') + return fmt.format( + name=NodeName(node), + value=_PytreeNodeRepr(node), + lineno=node.lineno, + column=node.column, + prefix=repr(node.prefix), + penalty=GetNodeAnnotation(node, Annotation.SPLIT_PENALTY, None)) + else: + fmt = '{node} [{len} children] [child_indent="{indent}"]' + return fmt.format( + node=NodeName(node), + len=len(node.children), + indent=GetNodeAnnotation(node, Annotation.CHILD_INDENT)) + + +def _PytreeNodeRepr(node): + """Like pytree.Node.__repr__, but names instead of numbers for tokens.""" + if isinstance(node, pytree.Node): + return '%s(%s, %r)' % (node.__class__.__name__, NodeName(node), + [_PytreeNodeRepr(c) for c in node.children]) + if isinstance(node, pytree.Leaf): + return '%s(%s, %r)' % (node.__class__.__name__, NodeName(node), node.value) + + +def IsCommentStatement(node): + return (NodeName(node) == 'simple_stmt' and + node.children[0].type == token.COMMENT) diff --git a/.venv/lib/python3.9/site-packages/yapf/yapflib/pytree_visitor.py b/.venv/lib/python3.9/site-packages/yapf/yapflib/pytree_visitor.py new file mode 100644 index 00000000..49da0566 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapf/yapflib/pytree_visitor.py @@ -0,0 +1,135 @@ +# Copyright 2015 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Generic visitor pattern for pytrees. + +The lib2to3 parser produces a "pytree" - syntax tree consisting of Node +and Leaf types. This module implements a visitor pattern for such trees. + +It also exports a basic "dumping" visitor that dumps a textual representation of +a pytree into a stream. + + PyTreeVisitor: a generic visitor pattern fo pytrees. + PyTreeDumper: a configurable "dumper" for displaying pytrees. + DumpPyTree(): a convenience function to dump a pytree. +""" + +import sys + +from lib2to3 import pytree + +from yapf.yapflib import pytree_utils + + +class PyTreeVisitor(object): + """Visitor pattern for pytree trees. + + Methods named Visit_XXX will be invoked when a node with type XXX is + encountered in the tree. The type is either a token type (for Leaf nodes) or + grammar symbols (for Node nodes). The return value of Visit_XXX methods is + ignored by the visitor. + + Visitors can modify node contents but must not change the tree structure + (e.g. add/remove children and move nodes around). + + This is a very common visitor pattern in Python code; it's also used in the + Python standard library ast module for providing AST visitors. + + Note: this makes names that aren't style conformant, so such visitor methods + need to be marked with # pylint: disable=invalid-name We don't have a choice + here, because lib2to3 nodes have under_separated names. + + For more complex behavior, the visit, DefaultNodeVisit and DefaultLeafVisit + methods can be overridden. Don't forget to invoke DefaultNodeVisit for nodes + that may have children - otherwise the children will not be visited. + """ + + def Visit(self, node): + """Visit a node.""" + method = 'Visit_{0}'.format(pytree_utils.NodeName(node)) + if hasattr(self, method): + # Found a specific visitor for this node + getattr(self, method)(node) + else: + if isinstance(node, pytree.Leaf): + self.DefaultLeafVisit(node) + else: + self.DefaultNodeVisit(node) + + def DefaultNodeVisit(self, node): + """Default visitor for Node: visits the node's children depth-first. + + This method is invoked when no specific visitor for the node is defined. + + Arguments: + node: the node to visit + """ + for child in node.children: + self.Visit(child) + + def DefaultLeafVisit(self, leaf): + """Default visitor for Leaf: no-op. + + This method is invoked when no specific visitor for the leaf is defined. + + Arguments: + leaf: the leaf to visit + """ + pass + + +def DumpPyTree(tree, target_stream=sys.stdout): + """Convenience function for dumping a given pytree. + + This function presents a very minimal interface. For more configurability (for + example, controlling how specific node types are displayed), use PyTreeDumper + directly. + + Arguments: + tree: the tree to dump. + target_stream: the stream to dump the tree to. A file-like object. By + default will dump into stdout. + """ + dumper = PyTreeDumper(target_stream) + dumper.Visit(tree) + + +class PyTreeDumper(PyTreeVisitor): + """Visitor that dumps the tree to a stream. + + Implements the PyTreeVisitor interface. + """ + + def __init__(self, target_stream=sys.stdout): + """Create a tree dumper. + + Arguments: + target_stream: the stream to dump the tree to. A file-like object. By + default will dump into stdout. + """ + self._target_stream = target_stream + self._current_indent = 0 + + def _DumpString(self, s): + self._target_stream.write('{0}{1}\n'.format(' ' * self._current_indent, s)) + + def DefaultNodeVisit(self, node): + # Dump information about the current node, and then use the generic + # DefaultNodeVisit visitor to dump each of its children. + self._DumpString(pytree_utils.DumpNodeToString(node)) + self._current_indent += 2 + super(PyTreeDumper, self).DefaultNodeVisit(node) + self._current_indent -= 2 + + def DefaultLeafVisit(self, leaf): + self._DumpString(pytree_utils.DumpNodeToString(leaf)) diff --git a/.venv/lib/python3.9/site-packages/yapf/yapflib/reformatter.py b/.venv/lib/python3.9/site-packages/yapf/yapflib/reformatter.py new file mode 100644 index 00000000..60386e51 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapf/yapflib/reformatter.py @@ -0,0 +1,800 @@ +# Copyright 2015 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Decide what the format for the code should be. + +The `unwrapped_line.UnwrappedLine`s are now ready to be formatted. +UnwrappedLines that can be merged together are. The best formatting is returned +as a string. + + Reformat(): the main function exported by this module. +""" + +from __future__ import unicode_literals +import collections +import heapq +import re + +from lib2to3 import pytree +from lib2to3.pgen2 import token + +from yapf.yapflib import format_decision_state +from yapf.yapflib import format_token +from yapf.yapflib import line_joiner +from yapf.yapflib import pytree_utils +from yapf.yapflib import style +from yapf.yapflib import verifier + + +def Reformat(uwlines, verify=False, lines=None): + """Reformat the unwrapped lines. + + Arguments: + uwlines: (list of unwrapped_line.UnwrappedLine) Lines we want to format. + verify: (bool) True if reformatted code should be verified for syntax. + lines: (set of int) The lines which can be modified or None if there is no + line range restriction. + + Returns: + A string representing the reformatted code. + """ + final_lines = [] + prev_uwline = None # The previous line. + indent_width = style.Get('INDENT_WIDTH') + + for uwline in _SingleOrMergedLines(uwlines): + first_token = uwline.first + _FormatFirstToken(first_token, uwline.depth, prev_uwline, final_lines) + + indent_amt = indent_width * uwline.depth + state = format_decision_state.FormatDecisionState(uwline, indent_amt) + state.MoveStateToNextToken() + + if not uwline.disable: + if uwline.first.is_comment: + uwline.first.node.value = uwline.first.node.value.rstrip() + elif uwline.last.is_comment: + uwline.last.node.value = uwline.last.node.value.rstrip() + if prev_uwline and prev_uwline.disable: + # Keep the vertical spacing between a disabled and enabled formatting + # region. + _RetainRequiredVerticalSpacingBetweenTokens(uwline.first, + prev_uwline.last, lines) + if any(tok.is_comment for tok in uwline.tokens): + _RetainVerticalSpacingBeforeComments(uwline) + + if uwline.disable or _LineHasContinuationMarkers(uwline): + _RetainHorizontalSpacing(uwline) + _RetainRequiredVerticalSpacing(uwline, prev_uwline, lines) + _EmitLineUnformatted(state) + + elif (_LineContainsPylintDisableLineTooLong(uwline) or + _LineContainsI18n(uwline)): + # Don't modify vertical spacing, but fix any horizontal spacing issues. + _RetainRequiredVerticalSpacing(uwline, prev_uwline, lines) + _EmitLineUnformatted(state) + + elif _CanPlaceOnSingleLine(uwline) and not any(tok.must_split + for tok in uwline.tokens): + # The unwrapped line fits on one line. + while state.next_token: + state.AddTokenToState(newline=False, dry_run=False) + + else: + if not _AnalyzeSolutionSpace(state): + # Failsafe mode. If there isn't a solution to the line, then just emit + # it as is. + state = format_decision_state.FormatDecisionState(uwline, indent_amt) + state.MoveStateToNextToken() + _RetainHorizontalSpacing(uwline) + _RetainRequiredVerticalSpacing(uwline, prev_uwline, None) + _EmitLineUnformatted(state) + + final_lines.append(uwline) + prev_uwline = uwline + + _AlignTrailingComments(final_lines) + return _FormatFinalLines(final_lines, verify) + + +def _RetainHorizontalSpacing(uwline): + """Retain all horizontal spacing between tokens.""" + for tok in uwline.tokens: + tok.RetainHorizontalSpacing(uwline.first.column, uwline.depth) + + +def _RetainRequiredVerticalSpacing(cur_uwline, prev_uwline, lines): + """Retain all vertical spacing between lines.""" + prev_tok = None + if prev_uwline is not None: + prev_tok = prev_uwline.last + + for cur_tok in cur_uwline.tokens: + _RetainRequiredVerticalSpacingBetweenTokens(cur_tok, prev_tok, lines) + + prev_tok = cur_tok + if cur_uwline.disable: + # After the first token we are acting on a single line. So if it is + # disabled we must not reformat. + lines = set() + + +def _RetainRequiredVerticalSpacingBetweenTokens(cur_tok, prev_tok, lines): + """Retain vertical spacing between two tokens if not in editable range.""" + if prev_tok is None: + return + + if prev_tok.is_string: + prev_lineno = prev_tok.lineno + prev_tok.value.count('\n') + elif prev_tok.is_pseudo_paren: + if not prev_tok.previous_token.is_multiline_string: + prev_lineno = prev_tok.previous_token.lineno + else: + prev_lineno = prev_tok.lineno + else: + prev_lineno = prev_tok.lineno + + if cur_tok.is_comment: + cur_lineno = cur_tok.lineno - cur_tok.value.count('\n') + else: + cur_lineno = cur_tok.lineno + + if not prev_tok.is_comment and prev_tok.value.endswith('\\'): + prev_lineno += prev_tok.value.count('\n') + + required_newlines = cur_lineno - prev_lineno + if cur_tok.is_comment and not prev_tok.is_comment: + # Don't adjust between a comment and non-comment. + pass + elif lines and lines.intersection(range(prev_lineno, cur_lineno + 1)): + desired_newlines = cur_tok.whitespace_prefix.count('\n') + whitespace_lines = range(prev_lineno + 1, cur_lineno) + deletable_lines = len(lines.intersection(whitespace_lines)) + required_newlines = max(required_newlines - deletable_lines, + desired_newlines) + + cur_tok.AdjustNewlinesBefore(required_newlines) + + +def _RetainVerticalSpacingBeforeComments(uwline): + """Retain vertical spacing before comments.""" + prev_token = None + for tok in uwline.tokens: + if tok.is_comment and prev_token: + if tok.lineno - tok.value.count('\n') - prev_token.lineno > 1: + tok.AdjustNewlinesBefore(ONE_BLANK_LINE) + + prev_token = tok + + +def _EmitLineUnformatted(state): + """Emit the line without formatting. + + The line contains code that if reformatted would break a non-syntactic + convention. E.g., i18n comments and function calls are tightly bound by + convention. Instead, we calculate when / if a newline should occur and honor + that. But otherwise the code emitted will be the same as the original code. + + Arguments: + state: (format_decision_state.FormatDecisionState) The format decision + state. + """ + while state.next_token: + previous_token = state.next_token.previous_token + previous_lineno = previous_token.lineno + + if previous_token.is_multiline_string or previous_token.is_string: + previous_lineno += previous_token.value.count('\n') + + if previous_token.is_continuation: + newline = False + else: + newline = state.next_token.lineno > previous_lineno + + state.AddTokenToState(newline=newline, dry_run=False) + + +def _LineContainsI18n(uwline): + """Return true if there are i18n comments or function calls in the line. + + I18n comments and pseudo-function calls are closely related. They cannot + be moved apart without breaking i18n. + + Arguments: + uwline: (unwrapped_line.UnwrappedLine) The line currently being formatted. + + Returns: + True if the line contains i18n comments or function calls. False otherwise. + """ + if style.Get('I18N_COMMENT'): + for tok in uwline.tokens: + if tok.is_comment and re.match(style.Get('I18N_COMMENT'), tok.value): + # Contains an i18n comment. + return True + + if style.Get('I18N_FUNCTION_CALL'): + length = len(uwline.tokens) + index = 0 + while index < length - 1: + if (uwline.tokens[index + 1].value == '(' and + uwline.tokens[index].value in style.Get('I18N_FUNCTION_CALL')): + return True + index += 1 + + return False + + +def _LineContainsPylintDisableLineTooLong(uwline): + """Return true if there is a "pylint: disable=line-too-long" comment.""" + return re.search(r'\bpylint:\s+disable=line-too-long\b', uwline.last.value) + + +def _LineHasContinuationMarkers(uwline): + """Return true if the line has continuation markers in it.""" + return any(tok.is_continuation for tok in uwline.tokens) + + +def _CanPlaceOnSingleLine(uwline): + """Determine if the unwrapped line can go on a single line. + + Arguments: + uwline: (unwrapped_line.UnwrappedLine) The line currently being formatted. + + Returns: + True if the line can or should be added to a single line. False otherwise. + """ + token_names = [x.name for x in uwline.tokens] + if (style.Get('FORCE_MULTILINE_DICT') and 'LBRACE' in token_names): + return False + indent_amt = style.Get('INDENT_WIDTH') * uwline.depth + last = uwline.last + last_index = -1 + if (last.is_pylint_comment or last.is_pytype_comment or + last.is_copybara_comment): + last = last.previous_token + last_index = -2 + if last is None: + return True + return (last.total_length + indent_amt <= style.Get('COLUMN_LIMIT') and + not any(tok.is_comment for tok in uwline.tokens[:last_index])) + + +def _AlignTrailingComments(final_lines): + """Align trailing comments to the same column.""" + final_lines_index = 0 + while final_lines_index < len(final_lines): + line = final_lines[final_lines_index] + assert line.tokens + + processed_content = False + + for tok in line.tokens: + if (tok.is_comment and isinstance(tok.spaces_required_before, list) and + tok.value.startswith('#')): + # All trailing comments and comments that appear on a line by themselves + # in this block should be indented at the same level. The block is + # terminated by an empty line or EOF. Enumerate through each line in + # the block and calculate the max line length. Once complete, use the + # first col value greater than that value and create the necessary for + # each line accordingly. + all_pc_line_lengths = [] # All pre-comment line lengths + max_line_length = 0 + + while True: + # EOF + if final_lines_index + len(all_pc_line_lengths) == len(final_lines): + break + + this_line = final_lines[final_lines_index + len(all_pc_line_lengths)] + + # Blank line - note that content is preformatted so we don't need to + # worry about spaces/tabs; a blank line will always be '\n\n'. + assert this_line.tokens + if (all_pc_line_lengths and + this_line.tokens[0].formatted_whitespace_prefix.startswith('\n\n') + ): + break + + if this_line.disable: + all_pc_line_lengths.append([]) + continue + + # Calculate the length of each line in this unwrapped line. + line_content = '' + pc_line_lengths = [] + + for line_tok in this_line.tokens: + whitespace_prefix = line_tok.formatted_whitespace_prefix + + newline_index = whitespace_prefix.rfind('\n') + if newline_index != -1: + max_line_length = max(max_line_length, len(line_content)) + line_content = '' + + whitespace_prefix = whitespace_prefix[newline_index + 1:] + + if line_tok.is_comment: + pc_line_lengths.append(len(line_content)) + else: + line_content += '{}{}'.format(whitespace_prefix, line_tok.value) + + if pc_line_lengths: + max_line_length = max(max_line_length, max(pc_line_lengths)) + + all_pc_line_lengths.append(pc_line_lengths) + + # Calculate the aligned column value + max_line_length += 2 + + aligned_col = None + for potential_col in tok.spaces_required_before: + if potential_col > max_line_length: + aligned_col = potential_col + break + + if aligned_col is None: + aligned_col = max_line_length + + # Update the comment token values based on the aligned values + for all_pc_line_lengths_index, pc_line_lengths in enumerate( + all_pc_line_lengths): + if not pc_line_lengths: + continue + + this_line = final_lines[final_lines_index + all_pc_line_lengths_index] + + pc_line_length_index = 0 + for line_tok in this_line.tokens: + if line_tok.is_comment: + assert pc_line_length_index < len(pc_line_lengths) + assert pc_line_lengths[pc_line_length_index] < aligned_col + + # Note that there may be newlines embedded in the comments, so + # we need to apply a whitespace prefix to each line. + whitespace = ' ' * ( + aligned_col - pc_line_lengths[pc_line_length_index] - 1) + pc_line_length_index += 1 + + line_content = [] + + for comment_line_index, comment_line in enumerate( + line_tok.value.split('\n')): + line_content.append('{}{}'.format(whitespace, + comment_line.strip())) + + if comment_line_index == 0: + whitespace = ' ' * (aligned_col - 1) + + line_content = '\n'.join(line_content) + + # Account for initial whitespace already slated for the + # beginning of the line. + existing_whitespace_prefix = \ + line_tok.formatted_whitespace_prefix.lstrip('\n') + + if line_content.startswith(existing_whitespace_prefix): + line_content = line_content[len(existing_whitespace_prefix):] + + line_tok.value = line_content + + assert pc_line_length_index == len(pc_line_lengths) + + final_lines_index += len(all_pc_line_lengths) + + processed_content = True + break + + if not processed_content: + final_lines_index += 1 + + +def _FormatFinalLines(final_lines, verify): + """Compose the final output from the finalized lines.""" + formatted_code = [] + for line in final_lines: + formatted_line = [] + for tok in line.tokens: + if not tok.is_pseudo_paren: + formatted_line.append(tok.formatted_whitespace_prefix) + formatted_line.append(tok.value) + else: + if (not tok.next_token.whitespace_prefix.startswith('\n') and + not tok.next_token.whitespace_prefix.startswith(' ')): + if (tok.previous_token.value == ':' or + tok.next_token.value not in ',}])'): + formatted_line.append(' ') + + formatted_code.append(''.join(formatted_line)) + if verify: + verifier.VerifyCode(formatted_code[-1]) + + return ''.join(formatted_code) + '\n' + + +class _StateNode(object): + """An edge in the solution space from 'previous.state' to 'state'. + + Attributes: + state: (format_decision_state.FormatDecisionState) The format decision state + for this node. + newline: If True, then on the edge from 'previous.state' to 'state' a + newline is inserted. + previous: (_StateNode) The previous state node in the graph. + """ + + # TODO(morbo): Add a '__cmp__' method. + + def __init__(self, state, newline, previous): + self.state = state.Clone() + self.newline = newline + self.previous = previous + + def __repr__(self): # pragma: no cover + return 'StateNode(state=[\n{0}\n], newline={1})'.format( + self.state, self.newline) + + +# A tuple of (penalty, count) that is used to prioritize the BFS. In case of +# equal penalties, we prefer states that were inserted first. During state +# generation, we make sure that we insert states first that break the line as +# late as possible. +_OrderedPenalty = collections.namedtuple('OrderedPenalty', ['penalty', 'count']) + +# An item in the prioritized BFS search queue. The 'StateNode's 'state' has +# the given '_OrderedPenalty'. +_QueueItem = collections.namedtuple('QueueItem', + ['ordered_penalty', 'state_node']) + + +def _AnalyzeSolutionSpace(initial_state): + """Analyze the entire solution space starting from initial_state. + + This implements a variant of Dijkstra's algorithm on the graph that spans + the solution space (LineStates are the nodes). The algorithm tries to find + the shortest path (the one with the lowest penalty) from 'initial_state' to + the state where all tokens are placed. + + Arguments: + initial_state: (format_decision_state.FormatDecisionState) The initial state + to start the search from. + + Returns: + True if a formatting solution was found. False otherwise. + """ + count = 0 + seen = set() + p_queue = [] + + # Insert start element. + node = _StateNode(initial_state, False, None) + heapq.heappush(p_queue, _QueueItem(_OrderedPenalty(0, count), node)) + + count += 1 + while p_queue: + item = p_queue[0] + penalty = item.ordered_penalty.penalty + node = item.state_node + if not node.state.next_token: + break + heapq.heappop(p_queue) + + if count > 10000: + node.state.ignore_stack_for_comparison = True + + if node.state in seen: + continue + + seen.add(node.state) + + # FIXME(morbo): Add a 'decision' element? + + count = _AddNextStateToQueue(penalty, node, False, count, p_queue) + count = _AddNextStateToQueue(penalty, node, True, count, p_queue) + + if not p_queue: + # We weren't able to find a solution. Do nothing. + return False + + _ReconstructPath(initial_state, heapq.heappop(p_queue).state_node) + return True + + +def _AddNextStateToQueue(penalty, previous_node, newline, count, p_queue): + """Add the following state to the analysis queue. + + Assume the current state is 'previous_node' and has been reached with a + penalty of 'penalty'. Insert a line break if 'newline' is True. + + Arguments: + penalty: (int) The penalty associated with the path up to this point. + previous_node: (_StateNode) The last _StateNode inserted into the priority + queue. + newline: (bool) Add a newline if True. + count: (int) The number of elements in the queue. + p_queue: (heapq) The priority queue representing the solution space. + + Returns: + The updated number of elements in the queue. + """ + must_split = previous_node.state.MustSplit() + if newline and not previous_node.state.CanSplit(must_split): + # Don't add a newline if the token cannot be split. + return count + if not newline and must_split: + # Don't add a token we must split but where we aren't splitting. + return count + + node = _StateNode(previous_node.state, newline, previous_node) + penalty += node.state.AddTokenToState( + newline=newline, dry_run=True, must_split=must_split) + heapq.heappush(p_queue, _QueueItem(_OrderedPenalty(penalty, count), node)) + return count + 1 + + +def _ReconstructPath(initial_state, current): + """Reconstruct the path through the queue with lowest penalty. + + Arguments: + initial_state: (format_decision_state.FormatDecisionState) The initial state + to start the search from. + current: (_StateNode) The node in the decision graph that is the end point + of the path with the least penalty. + """ + path = collections.deque() + + while current.previous: + path.appendleft(current) + current = current.previous + + for node in path: + initial_state.AddTokenToState(newline=node.newline, dry_run=False) + + +NESTED_DEPTH = [] + + +def _FormatFirstToken(first_token, indent_depth, prev_uwline, final_lines): + """Format the first token in the unwrapped line. + + Add a newline and the required indent before the first token of the unwrapped + line. + + Arguments: + first_token: (format_token.FormatToken) The first token in the unwrapped + line. + indent_depth: (int) The line's indentation depth. + prev_uwline: (list of unwrapped_line.UnwrappedLine) The unwrapped line + previous to this line. + final_lines: (list of unwrapped_line.UnwrappedLine) The unwrapped lines + that have already been processed. + """ + global NESTED_DEPTH + while NESTED_DEPTH and NESTED_DEPTH[-1] > indent_depth: + NESTED_DEPTH.pop() + + first_nested = False + if _IsClassOrDef(first_token): + if not NESTED_DEPTH: + NESTED_DEPTH = [indent_depth] + elif NESTED_DEPTH[-1] < indent_depth: + first_nested = True + NESTED_DEPTH.append(indent_depth) + + first_token.AddWhitespacePrefix( + _CalculateNumberOfNewlines(first_token, indent_depth, prev_uwline, + final_lines, first_nested), + indent_level=indent_depth) + + +NO_BLANK_LINES = 1 +ONE_BLANK_LINE = 2 +TWO_BLANK_LINES = 3 + + +def _IsClassOrDef(tok): + if tok.value in {'class', 'def', '@'}: + return True + return (tok.next_token and tok.value == 'async' and + tok.next_token.value == 'def') + + +def _CalculateNumberOfNewlines(first_token, indent_depth, prev_uwline, + final_lines, first_nested): + """Calculate the number of newlines we need to add. + + Arguments: + first_token: (format_token.FormatToken) The first token in the unwrapped + line. + indent_depth: (int) The line's indentation depth. + prev_uwline: (list of unwrapped_line.UnwrappedLine) The unwrapped line + previous to this line. + final_lines: (list of unwrapped_line.UnwrappedLine) The unwrapped lines + that have already been processed. + first_nested: (boolean) Whether this is the first nested class or function. + + Returns: + The number of newlines needed before the first token. + """ + # TODO(morbo): Special handling for imports. + # TODO(morbo): Create a knob that can tune these. + if prev_uwline is None: + # The first line in the file. Don't add blank lines. + # FIXME(morbo): Is this correct? + if first_token.newlines is not None: + pytree_utils.SetNodeAnnotation(first_token.node, + pytree_utils.Annotation.NEWLINES, None) + return 0 + + if first_token.is_docstring: + if (prev_uwline.first.value == 'class' and + style.Get('BLANK_LINE_BEFORE_CLASS_DOCSTRING')): + # Enforce a blank line before a class's docstring. + return ONE_BLANK_LINE + elif (prev_uwline.first.value.startswith('#') and + style.Get('BLANK_LINE_BEFORE_MODULE_DOCSTRING')): + # Enforce a blank line before a module's docstring. + return ONE_BLANK_LINE + # The docstring shouldn't have a newline before it. + return NO_BLANK_LINES + + if first_token.is_name and not indent_depth: + if (prev_uwline.first.value == 'from' or + prev_uwline.first.value == 'import'): + # Support custom number of blank lines between top-level imports and + # variable definitions. + return 1 + style.Get( + 'BLANK_LINES_BETWEEN_TOP_LEVEL_IMPORTS_AND_VARIABLES') + + prev_last_token = prev_uwline.last + if prev_last_token.is_docstring: + if (not indent_depth and first_token.value in {'class', 'def', 'async'}): + # Separate a class or function from the module-level docstring with + # appropriate number of blank lines. + return 1 + style.Get('BLANK_LINES_AROUND_TOP_LEVEL_DEFINITION') + if (first_nested and + not style.Get('BLANK_LINE_BEFORE_NESTED_CLASS_OR_DEF') and + _IsClassOrDef(first_token)): + pytree_utils.SetNodeAnnotation(first_token.node, + pytree_utils.Annotation.NEWLINES, None) + return NO_BLANK_LINES + if _NoBlankLinesBeforeCurrentToken(prev_last_token.value, first_token, + prev_last_token): + return NO_BLANK_LINES + else: + return ONE_BLANK_LINE + + if _IsClassOrDef(first_token): + # TODO(morbo): This can go once the blank line calculator is more + # sophisticated. + if not indent_depth: + # This is a top-level class or function. + is_inline_comment = prev_last_token.whitespace_prefix.count('\n') == 0 + if (not prev_uwline.disable and prev_last_token.is_comment and + not is_inline_comment): + # This token follows a non-inline comment. + if _NoBlankLinesBeforeCurrentToken(prev_last_token.value, first_token, + prev_last_token): + # Assume that the comment is "attached" to the current line. + # Therefore, we want two blank lines before the comment. + index = len(final_lines) - 1 + while index > 0: + if not final_lines[index - 1].is_comment: + break + index -= 1 + if final_lines[index - 1].first.value == '@': + final_lines[index].first.AdjustNewlinesBefore(NO_BLANK_LINES) + else: + prev_last_token.AdjustNewlinesBefore( + 1 + style.Get('BLANK_LINES_AROUND_TOP_LEVEL_DEFINITION')) + if first_token.newlines is not None: + pytree_utils.SetNodeAnnotation(first_token.node, + pytree_utils.Annotation.NEWLINES, + None) + return NO_BLANK_LINES + elif _IsClassOrDef(prev_uwline.first): + if first_nested and not style.Get( + 'BLANK_LINE_BEFORE_NESTED_CLASS_OR_DEF'): + pytree_utils.SetNodeAnnotation(first_token.node, + pytree_utils.Annotation.NEWLINES, None) + return NO_BLANK_LINES + + # Calculate how many newlines were between the original lines. We want to + # retain that formatting if it doesn't violate one of the style guide rules. + if first_token.is_comment: + first_token_lineno = first_token.lineno - first_token.value.count('\n') + else: + first_token_lineno = first_token.lineno + + prev_last_token_lineno = prev_last_token.lineno + if prev_last_token.is_multiline_string: + prev_last_token_lineno += prev_last_token.value.count('\n') + + if first_token_lineno - prev_last_token_lineno > 1: + return ONE_BLANK_LINE + + return NO_BLANK_LINES + + +def _SingleOrMergedLines(uwlines): + """Generate the lines we want to format. + + Arguments: + uwlines: (list of unwrapped_line.UnwrappedLine) Lines we want to format. + + Yields: + Either a single line, if the current line cannot be merged with the + succeeding line, or the next two lines merged into one line. + """ + index = 0 + last_was_merged = False + while index < len(uwlines): + if uwlines[index].disable: + uwline = uwlines[index] + index += 1 + while index < len(uwlines): + column = uwline.last.column + 2 + if uwlines[index].lineno != uwline.lineno: + break + if uwline.last.value != ':': + leaf = pytree.Leaf( + type=token.SEMI, value=';', context=('', (uwline.lineno, column))) + uwline.AppendToken(format_token.FormatToken(leaf)) + for tok in uwlines[index].tokens: + uwline.AppendToken(tok) + index += 1 + yield uwline + elif line_joiner.CanMergeMultipleLines(uwlines[index:], last_was_merged): + # TODO(morbo): This splice is potentially very slow. Come up with a more + # performance-friendly way of determining if two lines can be merged. + next_uwline = uwlines[index + 1] + for tok in next_uwline.tokens: + uwlines[index].AppendToken(tok) + if (len(next_uwline.tokens) == 1 and + next_uwline.first.is_multiline_string): + # This may be a multiline shebang. In that case, we want to retain the + # formatting. Otherwise, it could mess up the shell script's syntax. + uwlines[index].disable = True + yield uwlines[index] + index += 2 + last_was_merged = True + else: + yield uwlines[index] + index += 1 + last_was_merged = False + + +def _NoBlankLinesBeforeCurrentToken(text, cur_token, prev_token): + """Determine if there are no blank lines before the current token. + + The previous token is a docstring or comment. The prev_token_lineno is the + start of the text of that token. Counting the number of newlines in its text + gives us the extent and thus where the line number of the end of the + docstring or comment. After that, we just compare it to the current token's + line number to see if there are blank lines between them. + + Arguments: + text: (unicode) The text of the docstring or comment before the current + token. + cur_token: (format_token.FormatToken) The current token in the unwrapped + line. + prev_token: (format_token.FormatToken) The previous token in the unwrapped + line. + + Returns: + True if there is no blank line before the current token. + """ + cur_token_lineno = cur_token.lineno + if cur_token.is_comment: + cur_token_lineno -= cur_token.value.count('\n') + num_newlines = text.count('\n') if not prev_token.is_comment else 0 + return prev_token.lineno + num_newlines == cur_token_lineno - 1 diff --git a/.venv/lib/python3.9/site-packages/yapf/yapflib/split_penalty.py b/.venv/lib/python3.9/site-packages/yapf/yapflib/split_penalty.py new file mode 100644 index 00000000..d4c3dc47 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapf/yapflib/split_penalty.py @@ -0,0 +1,629 @@ +# Copyright 2015 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Computation of split penalties before/between tokens.""" + +import re + +from lib2to3 import pytree + +from yapf.yapflib import format_token +from yapf.yapflib import py3compat +from yapf.yapflib import pytree_utils +from yapf.yapflib import pytree_visitor +from yapf.yapflib import style + +# TODO(morbo): Document the annotations in a centralized place. E.g., the +# README file. +UNBREAKABLE = 1000 * 1000 +NAMED_ASSIGN = 15000 +DOTTED_NAME = 4000 +VERY_STRONGLY_CONNECTED = 3500 +STRONGLY_CONNECTED = 3000 +CONNECTED = 500 +TOGETHER = 100 + +OR_TEST = 1000 +AND_TEST = 1100 +NOT_TEST = 1200 +COMPARISON = 1300 +STAR_EXPR = 1300 +EXPR = 1400 +XOR_EXPR = 1500 +AND_EXPR = 1700 +SHIFT_EXPR = 1800 +ARITH_EXPR = 1900 +TERM = 2000 +FACTOR = 2100 +POWER = 2200 +ATOM = 2300 +ONE_ELEMENT_ARGUMENT = 500 +SUBSCRIPT = 6000 + + +def ComputeSplitPenalties(tree): + """Compute split penalties on tokens in the given parse tree. + + Arguments: + tree: the top-level pytree node to annotate with penalties. + """ + _SplitPenaltyAssigner().Visit(tree) + + +class _SplitPenaltyAssigner(pytree_visitor.PyTreeVisitor): + """Assigns split penalties to tokens, based on parse tree structure. + + Split penalties are attached as annotations to tokens. + """ + + def Visit(self, node): + if not hasattr(node, 'is_pseudo'): # Ignore pseudo tokens. + super(_SplitPenaltyAssigner, self).Visit(node) + + def Visit_import_as_names(self, node): # pyline: disable=invalid-name + # import_as_names ::= import_as_name (',' import_as_name)* [','] + self.DefaultNodeVisit(node) + prev_child = None + for child in node.children: + if (prev_child and isinstance(prev_child, pytree.Leaf) and + prev_child.value == ','): + _SetSplitPenalty(child, style.Get('SPLIT_PENALTY_IMPORT_NAMES')) + prev_child = child + + def Visit_classdef(self, node): # pylint: disable=invalid-name + # classdef ::= 'class' NAME ['(' [arglist] ')'] ':' suite + # + # NAME + _SetUnbreakable(node.children[1]) + if len(node.children) > 4: + # opening '(' + _SetUnbreakable(node.children[2]) + # ':' + _SetUnbreakable(node.children[-2]) + self.DefaultNodeVisit(node) + + def Visit_funcdef(self, node): # pylint: disable=invalid-name + # funcdef ::= 'def' NAME parameters ['->' test] ':' suite + # + # Can't break before the function name and before the colon. The parameters + # are handled by child iteration. + colon_idx = 1 + while pytree_utils.NodeName(node.children[colon_idx]) == 'simple_stmt': + colon_idx += 1 + _SetUnbreakable(node.children[colon_idx]) + arrow_idx = -1 + while colon_idx < len(node.children): + if isinstance(node.children[colon_idx], pytree.Leaf): + if node.children[colon_idx].value == ':': + break + if node.children[colon_idx].value == '->': + arrow_idx = colon_idx + colon_idx += 1 + _SetUnbreakable(node.children[colon_idx]) + self.DefaultNodeVisit(node) + if arrow_idx > 0: + _SetSplitPenalty( + pytree_utils.LastLeafNode(node.children[arrow_idx - 1]), 0) + _SetUnbreakable(node.children[arrow_idx]) + _SetStronglyConnected(node.children[arrow_idx + 1]) + + def Visit_lambdef(self, node): # pylint: disable=invalid-name + # lambdef ::= 'lambda' [varargslist] ':' test + # Loop over the lambda up to and including the colon. + allow_multiline_lambdas = style.Get('ALLOW_MULTILINE_LAMBDAS') + if not allow_multiline_lambdas: + for child in node.children: + if pytree_utils.NodeName(child) == 'COMMENT': + if re.search(r'pylint:.*disable=.*\bg-long-lambda', child.value): + allow_multiline_lambdas = True + break + + if allow_multiline_lambdas: + _SetExpressionPenalty(node, STRONGLY_CONNECTED) + else: + _SetExpressionPenalty(node, VERY_STRONGLY_CONNECTED) + + def Visit_parameters(self, node): # pylint: disable=invalid-name + # parameters ::= '(' [typedargslist] ')' + self.DefaultNodeVisit(node) + + # Can't break before the opening paren of a parameter list. + _SetUnbreakable(node.children[0]) + if not (style.Get('INDENT_CLOSING_BRACKETS') or + style.Get('DEDENT_CLOSING_BRACKETS')): + _SetStronglyConnected(node.children[-1]) + + def Visit_arglist(self, node): # pylint: disable=invalid-name + # arglist ::= argument (',' argument)* [','] + if pytree_utils.NodeName(node.children[0]) == 'STAR': + # Python 3 treats a star expression as a specific expression type. + # Process it in that method. + self.Visit_star_expr(node) + return + + self.DefaultNodeVisit(node) + + for index in py3compat.range(1, len(node.children)): + child = node.children[index] + if isinstance(child, pytree.Leaf) and child.value == ',': + _SetUnbreakable(child) + + for child in node.children: + if pytree_utils.NodeName(child) == 'atom': + _IncreasePenalty(child, CONNECTED) + + def Visit_argument(self, node): # pylint: disable=invalid-name + # argument ::= test [comp_for] | test '=' test # Really [keyword '='] test + self.DefaultNodeVisit(node) + + for index in py3compat.range(1, len(node.children) - 1): + child = node.children[index] + if isinstance(child, pytree.Leaf) and child.value == '=': + _SetSplitPenalty( + pytree_utils.FirstLeafNode(node.children[index]), NAMED_ASSIGN) + _SetSplitPenalty( + pytree_utils.FirstLeafNode(node.children[index + 1]), NAMED_ASSIGN) + + def Visit_tname(self, node): # pylint: disable=invalid-name + # tname ::= NAME [':' test] + self.DefaultNodeVisit(node) + + for index in py3compat.range(1, len(node.children) - 1): + child = node.children[index] + if isinstance(child, pytree.Leaf) and child.value == ':': + _SetSplitPenalty( + pytree_utils.FirstLeafNode(node.children[index]), NAMED_ASSIGN) + _SetSplitPenalty( + pytree_utils.FirstLeafNode(node.children[index + 1]), NAMED_ASSIGN) + + def Visit_dotted_name(self, node): # pylint: disable=invalid-name + # dotted_name ::= NAME ('.' NAME)* + for child in node.children: + self.Visit(child) + start = 2 if hasattr(node.children[0], 'is_pseudo') else 1 + for i in py3compat.range(start, len(node.children)): + _SetUnbreakable(node.children[i]) + + def Visit_dictsetmaker(self, node): # pylint: disable=invalid-name + # dictsetmaker ::= ( (test ':' test + # (comp_for | (',' test ':' test)* [','])) | + # (test (comp_for | (',' test)* [','])) ) + for child in node.children: + self.Visit(child) + if pytree_utils.NodeName(child) == 'COLON': + # This is a key to a dictionary. We don't want to split the key if at + # all possible. + _SetStronglyConnected(child) + + def Visit_trailer(self, node): # pylint: disable=invalid-name + # trailer ::= '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME + if node.children[0].value == '.': + before = style.Get('SPLIT_BEFORE_DOT') + _SetSplitPenalty(node.children[0], + VERY_STRONGLY_CONNECTED if before else DOTTED_NAME) + _SetSplitPenalty(node.children[1], + DOTTED_NAME if before else VERY_STRONGLY_CONNECTED) + elif len(node.children) == 2: + # Don't split an empty argument list if at all possible. + _SetSplitPenalty(node.children[1], VERY_STRONGLY_CONNECTED) + elif len(node.children) == 3: + name = pytree_utils.NodeName(node.children[1]) + if name in {'argument', 'comparison'}: + # Don't split an argument list with one element if at all possible. + _SetStronglyConnected(node.children[1]) + if (len(node.children[1].children) > 1 and + pytree_utils.NodeName(node.children[1].children[1]) == 'comp_for'): + # Don't penalize splitting before a comp_for expression. + _SetSplitPenalty(pytree_utils.FirstLeafNode(node.children[1]), 0) + else: + _SetSplitPenalty( + pytree_utils.FirstLeafNode(node.children[1]), + ONE_ELEMENT_ARGUMENT) + elif (pytree_utils.NodeName(node.children[0]) == 'LSQB' and + len(node.children[1].children) > 2 and + (name.endswith('_test') or name.endswith('_expr'))): + _SetStronglyConnected(node.children[1].children[0]) + _SetStronglyConnected(node.children[1].children[2]) + + # Still allow splitting around the operator. + split_before = ((name.endswith('_test') and + style.Get('SPLIT_BEFORE_LOGICAL_OPERATOR')) or + (name.endswith('_expr') and + style.Get('SPLIT_BEFORE_BITWISE_OPERATOR'))) + if split_before: + _SetSplitPenalty( + pytree_utils.LastLeafNode(node.children[1].children[1]), 0) + else: + _SetSplitPenalty( + pytree_utils.FirstLeafNode(node.children[1].children[2]), 0) + + # Don't split the ending bracket of a subscript list. + _RecAnnotate(node.children[-1], pytree_utils.Annotation.SPLIT_PENALTY, + VERY_STRONGLY_CONNECTED) + elif name not in { + 'arglist', 'argument', 'term', 'or_test', 'and_test', 'comparison', + 'atom', 'power' + }: + # Don't split an argument list with one element if at all possible. + subtypes = pytree_utils.GetNodeAnnotation( + pytree_utils.FirstLeafNode(node), pytree_utils.Annotation.SUBTYPE) + if subtypes and format_token.Subtype.SUBSCRIPT_BRACKET in subtypes: + _IncreasePenalty(node, SUBSCRIPT) + + # Bump up the split penalty for the first part of a subscript. We + # would rather not split there. + _IncreasePenalty(node.children[1], CONNECTED) + else: + _SetStronglyConnected(node.children[1], node.children[2]) + + if name == 'arglist': + _SetStronglyConnected(node.children[-1]) + + self.DefaultNodeVisit(node) + + def Visit_power(self, node): # pylint: disable=invalid-name,missing-docstring + # power ::= atom trailer* ['**' factor] + self.DefaultNodeVisit(node) + + # When atom is followed by a trailer, we can not break between them. + # E.g. arr[idx] - no break allowed between 'arr' and '['. + if (len(node.children) > 1 and + pytree_utils.NodeName(node.children[1]) == 'trailer'): + # children[1] itself is a whole trailer: we don't want to + # mark all of it as unbreakable, only its first token: (, [ or . + first = pytree_utils.FirstLeafNode(node.children[1]) + if first.value != '.': + _SetUnbreakable(node.children[1].children[0]) + + # A special case when there are more trailers in the sequence. Given: + # atom tr1 tr2 + # The last token of tr1 and the first token of tr2 comprise an unbreakable + # region. For example: foo.bar.baz(1) + # We can't put breaks between either of the '.', '(', or '[' and the names + # *preceding* them. + prev_trailer_idx = 1 + while prev_trailer_idx < len(node.children) - 1: + cur_trailer_idx = prev_trailer_idx + 1 + cur_trailer = node.children[cur_trailer_idx] + if pytree_utils.NodeName(cur_trailer) != 'trailer': + break + + # Now we know we have two trailers one after the other + prev_trailer = node.children[prev_trailer_idx] + if prev_trailer.children[-1].value != ')': + # Set the previous node unbreakable if it's not a function call: + # atom tr1() tr2 + # It may be necessary (though undesirable) to split up a previous + # function call's parentheses to the next line. + _SetStronglyConnected(prev_trailer.children[-1]) + _SetStronglyConnected(cur_trailer.children[0]) + prev_trailer_idx = cur_trailer_idx + + # We don't want to split before the last ')' of a function call. This also + # takes care of the special case of: + # atom tr1 tr2 ... trn + # where the 'tr#' are trailers that may end in a ')'. + for trailer in node.children[1:]: + if pytree_utils.NodeName(trailer) != 'trailer': + break + if trailer.children[0].value in '([': + if len(trailer.children) > 2: + subtypes = pytree_utils.GetNodeAnnotation( + trailer.children[0], pytree_utils.Annotation.SUBTYPE) + if subtypes and format_token.Subtype.SUBSCRIPT_BRACKET in subtypes: + _SetStronglyConnected( + pytree_utils.FirstLeafNode(trailer.children[1])) + + last_child_node = pytree_utils.LastLeafNode(trailer) + if last_child_node.value.strip().startswith('#'): + last_child_node = last_child_node.prev_sibling + if not (style.Get('INDENT_CLOSING_BRACKETS') or + style.Get('DEDENT_CLOSING_BRACKETS')): + last = pytree_utils.LastLeafNode(last_child_node.prev_sibling) + if last.value != ',': + if last_child_node.value == ']': + _SetUnbreakable(last_child_node) + else: + _SetSplitPenalty(last_child_node, VERY_STRONGLY_CONNECTED) + else: + # If the trailer's children are '()', then make it a strongly + # connected region. It's sometimes necessary, though undesirable, to + # split the two. + _SetStronglyConnected(trailer.children[-1]) + + def Visit_subscriptlist(self, node): # pylint: disable=invalid-name + # subscriptlist ::= subscript (',' subscript)* [','] + self.DefaultNodeVisit(node) + _SetSplitPenalty(pytree_utils.FirstLeafNode(node), 0) + prev_child = None + for child in node.children: + if prev_child and pytree_utils.NodeName(prev_child) == 'COMMA': + _SetSplitPenalty(pytree_utils.FirstLeafNode(child), 0) + prev_child = child + + def Visit_subscript(self, node): # pylint: disable=invalid-name + # subscript ::= test | [test] ':' [test] [sliceop] + _SetStronglyConnected(*node.children) + self.DefaultNodeVisit(node) + + def Visit_comp_for(self, node): # pylint: disable=invalid-name + # comp_for ::= 'for' exprlist 'in' testlist_safe [comp_iter] + _SetSplitPenalty(pytree_utils.FirstLeafNode(node), 0) + _SetStronglyConnected(*node.children[1:]) + self.DefaultNodeVisit(node) + + def Visit_old_comp_for(self, node): # pylint: disable=invalid-name + # Python 3.7 + self.Visit_comp_for(node) + + def Visit_comp_if(self, node): # pylint: disable=invalid-name + # comp_if ::= 'if' old_test [comp_iter] + _SetSplitPenalty(node.children[0], + style.Get('SPLIT_PENALTY_BEFORE_IF_EXPR')) + _SetStronglyConnected(*node.children[1:]) + self.DefaultNodeVisit(node) + + def Visit_old_comp_if(self, node): # pylint: disable=invalid-name + # Python 3.7 + self.Visit_comp_if(node) + + def Visit_test(self, node): # pylint: disable=invalid-name + # test ::= or_test ['if' or_test 'else' test] | lambdef + _IncreasePenalty(node, OR_TEST) + self.DefaultNodeVisit(node) + + def Visit_or_test(self, node): # pylint: disable=invalid-name + # or_test ::= and_test ('or' and_test)* + self.DefaultNodeVisit(node) + _IncreasePenalty(node, OR_TEST) + index = 1 + while index + 1 < len(node.children): + if style.Get('SPLIT_BEFORE_LOGICAL_OPERATOR'): + _DecrementSplitPenalty( + pytree_utils.FirstLeafNode(node.children[index]), OR_TEST) + else: + _DecrementSplitPenalty( + pytree_utils.FirstLeafNode(node.children[index + 1]), OR_TEST) + index += 2 + + def Visit_and_test(self, node): # pylint: disable=invalid-name + # and_test ::= not_test ('and' not_test)* + self.DefaultNodeVisit(node) + _IncreasePenalty(node, AND_TEST) + index = 1 + while index + 1 < len(node.children): + if style.Get('SPLIT_BEFORE_LOGICAL_OPERATOR'): + _DecrementSplitPenalty( + pytree_utils.FirstLeafNode(node.children[index]), AND_TEST) + else: + _DecrementSplitPenalty( + pytree_utils.FirstLeafNode(node.children[index + 1]), AND_TEST) + index += 2 + + def Visit_not_test(self, node): # pylint: disable=invalid-name + # not_test ::= 'not' not_test | comparison + self.DefaultNodeVisit(node) + _IncreasePenalty(node, NOT_TEST) + + def Visit_comparison(self, node): # pylint: disable=invalid-name + # comparison ::= expr (comp_op expr)* + self.DefaultNodeVisit(node) + if len(node.children) == 3 and _StronglyConnectedCompOp(node): + _IncreasePenalty(node.children[1], VERY_STRONGLY_CONNECTED) + _SetSplitPenalty( + pytree_utils.FirstLeafNode(node.children[2]), STRONGLY_CONNECTED) + else: + _IncreasePenalty(node, COMPARISON) + + def Visit_star_expr(self, node): # pylint: disable=invalid-name + # star_expr ::= '*' expr + self.DefaultNodeVisit(node) + _IncreasePenalty(node, STAR_EXPR) + + def Visit_expr(self, node): # pylint: disable=invalid-name + # expr ::= xor_expr ('|' xor_expr)* + self.DefaultNodeVisit(node) + _IncreasePenalty(node, EXPR) + _SetBitwiseOperandPenalty(node, '|') + + def Visit_xor_expr(self, node): # pylint: disable=invalid-name + # xor_expr ::= and_expr ('^' and_expr)* + self.DefaultNodeVisit(node) + _IncreasePenalty(node, XOR_EXPR) + _SetBitwiseOperandPenalty(node, '^') + + def Visit_and_expr(self, node): # pylint: disable=invalid-name + # and_expr ::= shift_expr ('&' shift_expr)* + self.DefaultNodeVisit(node) + _IncreasePenalty(node, AND_EXPR) + _SetBitwiseOperandPenalty(node, '&') + + def Visit_shift_expr(self, node): # pylint: disable=invalid-name + # shift_expr ::= arith_expr (('<<'|'>>') arith_expr)* + self.DefaultNodeVisit(node) + _IncreasePenalty(node, SHIFT_EXPR) + + _ARITH_OPS = frozenset({'PLUS', 'MINUS'}) + + def Visit_arith_expr(self, node): # pylint: disable=invalid-name + # arith_expr ::= term (('+'|'-') term)* + self.DefaultNodeVisit(node) + _IncreasePenalty(node, ARITH_EXPR) + _SetExpressionOperandPenalty(node, self._ARITH_OPS) + + _TERM_OPS = frozenset({'STAR', 'AT', 'SLASH', 'PERCENT', 'DOUBLESLASH'}) + + def Visit_term(self, node): # pylint: disable=invalid-name + # term ::= factor (('*'|'@'|'/'|'%'|'//') factor)* + self.DefaultNodeVisit(node) + _IncreasePenalty(node, TERM) + _SetExpressionOperandPenalty(node, self._TERM_OPS) + + def Visit_factor(self, node): # pyline: disable=invalid-name + # factor ::= ('+'|'-'|'~') factor | power + self.DefaultNodeVisit(node) + _IncreasePenalty(node, FACTOR) + + def Visit_atom(self, node): # pylint: disable=invalid-name + # atom ::= ('(' [yield_expr|testlist_gexp] ')' + # '[' [listmaker] ']' | + # '{' [dictsetmaker] '}') + self.DefaultNodeVisit(node) + if (node.children[0].value == '(' and + not hasattr(node.children[0], 'is_pseudo')): + if node.children[-1].value == ')': + if pytree_utils.NodeName(node.parent) == 'if_stmt': + _SetSplitPenalty(node.children[-1], STRONGLY_CONNECTED) + else: + if len(node.children) > 2: + _SetSplitPenalty(pytree_utils.FirstLeafNode(node.children[1]), EXPR) + _SetSplitPenalty(node.children[-1], ATOM) + elif node.children[0].value in '[{' and len(node.children) == 2: + # Keep empty containers together if we can. + _SetUnbreakable(node.children[-1]) + + def Visit_testlist_gexp(self, node): # pylint: disable=invalid-name + self.DefaultNodeVisit(node) + prev_was_comma = False + for child in node.children: + if isinstance(child, pytree.Leaf) and child.value == ',': + _SetUnbreakable(child) + prev_was_comma = True + else: + if prev_was_comma: + _SetSplitPenalty(pytree_utils.FirstLeafNode(child), TOGETHER) + prev_was_comma = False + + +def _SetUnbreakable(node): + """Set an UNBREAKABLE penalty annotation for the given node.""" + _RecAnnotate(node, pytree_utils.Annotation.SPLIT_PENALTY, UNBREAKABLE) + + +def _SetStronglyConnected(*nodes): + """Set a STRONGLY_CONNECTED penalty annotation for the given nodes.""" + for node in nodes: + _RecAnnotate(node, pytree_utils.Annotation.SPLIT_PENALTY, + STRONGLY_CONNECTED) + + +def _SetExpressionPenalty(node, penalty): + """Set a penalty annotation on children nodes.""" + + def RecExpression(node, first_child_leaf): + if node is first_child_leaf: + return + + if isinstance(node, pytree.Leaf): + if node.value in {'(', 'for', 'if'}: + return + penalty_annotation = pytree_utils.GetNodeAnnotation( + node, pytree_utils.Annotation.SPLIT_PENALTY, default=0) + if penalty_annotation < penalty: + _SetSplitPenalty(node, penalty) + else: + for child in node.children: + RecExpression(child, first_child_leaf) + + RecExpression(node, pytree_utils.FirstLeafNode(node)) + + +def _SetBitwiseOperandPenalty(node, op): + for index in py3compat.range(1, len(node.children) - 1): + child = node.children[index] + if isinstance(child, pytree.Leaf) and child.value == op: + if style.Get('SPLIT_BEFORE_BITWISE_OPERATOR'): + _SetSplitPenalty(child, style.Get('SPLIT_PENALTY_BITWISE_OPERATOR')) + else: + _SetSplitPenalty( + pytree_utils.FirstLeafNode(node.children[index + 1]), + style.Get('SPLIT_PENALTY_BITWISE_OPERATOR')) + + +def _SetExpressionOperandPenalty(node, ops): + for index in py3compat.range(1, len(node.children) - 1): + child = node.children[index] + if pytree_utils.NodeName(child) in ops: + if style.Get('SPLIT_BEFORE_ARITHMETIC_OPERATOR'): + _SetSplitPenalty(child, style.Get('SPLIT_PENALTY_ARITHMETIC_OPERATOR')) + else: + _SetSplitPenalty( + pytree_utils.FirstLeafNode(node.children[index + 1]), + style.Get('SPLIT_PENALTY_ARITHMETIC_OPERATOR')) + + +def _IncreasePenalty(node, amt): + """Increase a penalty annotation on children nodes.""" + + def RecExpression(node, first_child_leaf): + if node is first_child_leaf: + return + + if isinstance(node, pytree.Leaf): + if node.value in {'(', 'for'}: + return + penalty = pytree_utils.GetNodeAnnotation( + node, pytree_utils.Annotation.SPLIT_PENALTY, default=0) + _SetSplitPenalty(node, penalty + amt) + else: + for child in node.children: + RecExpression(child, first_child_leaf) + + RecExpression(node, pytree_utils.FirstLeafNode(node)) + + +def _RecAnnotate(tree, annotate_name, annotate_value): + """Recursively set the given annotation on all leafs of the subtree. + + Takes care to only increase the penalty. If the node already has a higher + or equal penalty associated with it, this is a no-op. + + Args: + tree: subtree to annotate + annotate_name: name of the annotation to set + annotate_value: value of the annotation to set + """ + for child in tree.children: + _RecAnnotate(child, annotate_name, annotate_value) + if isinstance(tree, pytree.Leaf): + cur_annotate = pytree_utils.GetNodeAnnotation( + tree, annotate_name, default=0) + if cur_annotate < annotate_value: + pytree_utils.SetNodeAnnotation(tree, annotate_name, annotate_value) + + +def _StronglyConnectedCompOp(op): + if (len(op.children[1].children) == 2 and + pytree_utils.NodeName(op.children[1]) == 'comp_op'): + if (pytree_utils.FirstLeafNode(op.children[1]).value == 'not' and + pytree_utils.LastLeafNode(op.children[1]).value == 'in'): + return True + if (pytree_utils.FirstLeafNode(op.children[1]).value == 'is' and + pytree_utils.LastLeafNode(op.children[1]).value == 'not'): + return True + if (isinstance(op.children[1], pytree.Leaf) and + op.children[1].value in {'==', 'in'}): + return True + return False + + +def _DecrementSplitPenalty(node, amt): + penalty = pytree_utils.GetNodeAnnotation( + node, pytree_utils.Annotation.SPLIT_PENALTY, default=amt) + penalty = penalty - amt if amt < penalty else 0 + _SetSplitPenalty(node, penalty) + + +def _SetSplitPenalty(node, penalty): + pytree_utils.SetNodeAnnotation(node, pytree_utils.Annotation.SPLIT_PENALTY, + penalty) diff --git a/.venv/lib/python3.9/site-packages/yapf/yapflib/style.py b/.venv/lib/python3.9/site-packages/yapf/yapflib/style.py new file mode 100644 index 00000000..6bd2372f --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapf/yapflib/style.py @@ -0,0 +1,849 @@ +# Copyright 2015 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Python formatting style settings.""" + +import os +import re +import textwrap + +from yapf.yapflib import errors +from yapf.yapflib import py3compat + + +class StyleConfigError(errors.YapfError): + """Raised when there's a problem reading the style configuration.""" + pass + + +def Get(setting_name): + """Get a style setting.""" + return _style[setting_name] + + +def GetOrDefault(setting_name, default_value): + """Get a style setting or default value if the setting does not exist.""" + return _style.get(setting_name, default_value) + + +def Help(): + """Return dict mapping style names to help strings.""" + return _STYLE_HELP + + +def SetGlobalStyle(style): + """Set a style dict.""" + global _style + global _GLOBAL_STYLE_FACTORY + factory = _GetStyleFactory(style) + if factory: + _GLOBAL_STYLE_FACTORY = factory + _style = style + + +_STYLE_HELP = dict( + ALIGN_CLOSING_BRACKET_WITH_VISUAL_INDENT=textwrap.dedent("""\ + Align closing bracket with visual indentation."""), + ALLOW_MULTILINE_LAMBDAS=textwrap.dedent("""\ + Allow lambdas to be formatted on more than one line."""), + ALLOW_MULTILINE_DICTIONARY_KEYS=textwrap.dedent("""\ + Allow dictionary keys to exist on multiple lines. For example: + + x = { + ('this is the first element of a tuple', + 'this is the second element of a tuple'): + value, + }"""), + ALLOW_SPLIT_BEFORE_DEFAULT_OR_NAMED_ASSIGNS=textwrap.dedent("""\ + Allow splitting before a default / named assignment in an argument list. + """), + ALLOW_SPLIT_BEFORE_DICT_VALUE=textwrap.dedent("""\ + Allow splits before the dictionary value."""), + ARITHMETIC_PRECEDENCE_INDICATION=textwrap.dedent("""\ + Let spacing indicate operator precedence. For example: + + a = 1 * 2 + 3 / 4 + b = 1 / 2 - 3 * 4 + c = (1 + 2) * (3 - 4) + d = (1 - 2) / (3 + 4) + e = 1 * 2 - 3 + f = 1 + 2 + 3 + 4 + + will be formatted as follows to indicate precedence: + + a = 1*2 + 3/4 + b = 1/2 - 3*4 + c = (1+2) * (3-4) + d = (1-2) / (3+4) + e = 1*2 - 3 + f = 1 + 2 + 3 + 4 + + """), + BLANK_LINE_BEFORE_NESTED_CLASS_OR_DEF=textwrap.dedent("""\ + Insert a blank line before a 'def' or 'class' immediately nested + within another 'def' or 'class'. For example: + + class Foo: + # <------ this blank line + def method(): + ..."""), + BLANK_LINE_BEFORE_CLASS_DOCSTRING=textwrap.dedent("""\ + Insert a blank line before a class-level docstring."""), + BLANK_LINE_BEFORE_MODULE_DOCSTRING=textwrap.dedent("""\ + Insert a blank line before a module docstring."""), + BLANK_LINES_AROUND_TOP_LEVEL_DEFINITION=textwrap.dedent("""\ + Number of blank lines surrounding top-level function and class + definitions."""), + BLANK_LINES_BETWEEN_TOP_LEVEL_IMPORTS_AND_VARIABLES=textwrap.dedent("""\ + Number of blank lines between top-level imports and variable + definitions."""), + COALESCE_BRACKETS=textwrap.dedent("""\ + Do not split consecutive brackets. Only relevant when + dedent_closing_brackets is set. For example: + + call_func_that_takes_a_dict( + { + 'key1': 'value1', + 'key2': 'value2', + } + ) + + would reformat to: + + call_func_that_takes_a_dict({ + 'key1': 'value1', + 'key2': 'value2', + })"""), + COLUMN_LIMIT=textwrap.dedent("""\ + The column limit."""), + CONTINUATION_ALIGN_STYLE=textwrap.dedent("""\ + The style for continuation alignment. Possible values are: + + - SPACE: Use spaces for continuation alignment. This is default behavior. + - FIXED: Use fixed number (CONTINUATION_INDENT_WIDTH) of columns + (ie: CONTINUATION_INDENT_WIDTH/INDENT_WIDTH tabs or + CONTINUATION_INDENT_WIDTH spaces) for continuation alignment. + - VALIGN-RIGHT: Vertically align continuation lines to multiple of + INDENT_WIDTH columns. Slightly right (one tab or a few spaces) if + cannot vertically align continuation lines with indent characters."""), + CONTINUATION_INDENT_WIDTH=textwrap.dedent("""\ + Indent width used for line continuations."""), + DEDENT_CLOSING_BRACKETS=textwrap.dedent("""\ + Put closing brackets on a separate line, dedented, if the bracketed + expression can't fit in a single line. Applies to all kinds of brackets, + including function definitions and calls. For example: + + config = { + 'key1': 'value1', + 'key2': 'value2', + } # <--- this bracket is dedented and on a separate line + + time_series = self.remote_client.query_entity_counters( + entity='dev3246.region1', + key='dns.query_latency_tcp', + transform=Transformation.AVERAGE(window=timedelta(seconds=60)), + start_ts=now()-timedelta(days=3), + end_ts=now(), + ) # <--- this bracket is dedented and on a separate line + """), + DISABLE_ENDING_COMMA_HEURISTIC=textwrap.dedent("""\ + Disable the heuristic which places each list element on a separate line + if the list is comma-terminated."""), + EACH_DICT_ENTRY_ON_SEPARATE_LINE=textwrap.dedent("""\ + Place each dictionary entry onto its own line."""), + FORCE_MULTILINE_DICT=textwrap.dedent("""\ + Require multiline dictionary even if it would normally fit on one line. + For example: + + config = { + 'key1': 'value1' + }"""), + I18N_COMMENT=textwrap.dedent("""\ + The regex for an i18n comment. The presence of this comment stops + reformatting of that line, because the comments are required to be + next to the string they translate."""), + I18N_FUNCTION_CALL=textwrap.dedent("""\ + The i18n function call names. The presence of this function stops + reformattting on that line, because the string it has cannot be moved + away from the i18n comment."""), + INDENT_CLOSING_BRACKETS=textwrap.dedent("""\ + Put closing brackets on a separate line, indented, if the bracketed + expression can't fit in a single line. Applies to all kinds of brackets, + including function definitions and calls. For example: + + config = { + 'key1': 'value1', + 'key2': 'value2', + } # <--- this bracket is indented and on a separate line + + time_series = self.remote_client.query_entity_counters( + entity='dev3246.region1', + key='dns.query_latency_tcp', + transform=Transformation.AVERAGE(window=timedelta(seconds=60)), + start_ts=now()-timedelta(days=3), + end_ts=now(), + ) # <--- this bracket is indented and on a separate line + """), + INDENT_DICTIONARY_VALUE=textwrap.dedent("""\ + Indent the dictionary value if it cannot fit on the same line as the + dictionary key. For example: + + config = { + 'key1': + 'value1', + 'key2': value1 + + value2, + } + """), + INDENT_WIDTH=textwrap.dedent("""\ + The number of columns to use for indentation."""), + INDENT_BLANK_LINES=textwrap.dedent("""\ + Indent blank lines."""), + JOIN_MULTIPLE_LINES=textwrap.dedent("""\ + Join short lines into one line. E.g., single line 'if' statements."""), + NO_SPACES_AROUND_SELECTED_BINARY_OPERATORS=textwrap.dedent("""\ + Do not include spaces around selected binary operators. For example: + + 1 + 2 * 3 - 4 / 5 + + will be formatted as follows when configured with "*,/": + + 1 + 2*3 - 4/5 + """), + SPACE_BETWEEN_ENDING_COMMA_AND_CLOSING_BRACKET=textwrap.dedent("""\ + Insert a space between the ending comma and closing bracket of a list, + etc."""), + SPACE_INSIDE_BRACKETS=textwrap.dedent("""\ + Use spaces inside brackets, braces, and parentheses. For example: + + method_call( 1 ) + my_dict[ 3 ][ 1 ][ get_index( *args, **kwargs ) ] + my_set = { 1, 2, 3 } + """), + SPACES_AROUND_POWER_OPERATOR=textwrap.dedent("""\ + Use spaces around the power operator."""), + SPACES_AROUND_DEFAULT_OR_NAMED_ASSIGN=textwrap.dedent("""\ + Use spaces around default or named assigns."""), + SPACES_AROUND_DICT_DELIMITERS=textwrap.dedent("""\ + Adds a space after the opening '{' and before the ending '}' dict delimiters. + + {1: 2} + + will be formatted as: + + { 1: 2 } + """), + SPACES_AROUND_LIST_DELIMITERS=textwrap.dedent("""\ + Adds a space after the opening '[' and before the ending ']' list delimiters. + + [1, 2] + + will be formatted as: + + [ 1, 2 ] + """), + SPACES_AROUND_SUBSCRIPT_COLON=textwrap.dedent("""\ + Use spaces around the subscript / slice operator. For example: + + my_list[1 : 10 : 2] + """), + SPACES_AROUND_TUPLE_DELIMITERS=textwrap.dedent("""\ + Adds a space after the opening '(' and before the ending ')' tuple delimiters. + + (1, 2, 3) + + will be formatted as: + + ( 1, 2, 3 ) + """), + SPACES_BEFORE_COMMENT=textwrap.dedent("""\ + The number of spaces required before a trailing comment. + This can be a single value (representing the number of spaces + before each trailing comment) or list of values (representing + alignment column values; trailing comments within a block will + be aligned to the first column value that is greater than the maximum + line length within the block). For example: + + With spaces_before_comment=5: + + 1 + 1 # Adding values + + will be formatted as: + + 1 + 1 # Adding values <-- 5 spaces between the end of the statement and comment + + With spaces_before_comment=15, 20: + + 1 + 1 # Adding values + two + two # More adding + + longer_statement # This is a longer statement + short # This is a shorter statement + + a_very_long_statement_that_extends_beyond_the_final_column # Comment + short # This is a shorter statement + + will be formatted as: + + 1 + 1 # Adding values <-- end of line comments in block aligned to col 15 + two + two # More adding + + longer_statement # This is a longer statement <-- end of line comments in block aligned to col 20 + short # This is a shorter statement + + a_very_long_statement_that_extends_beyond_the_final_column # Comment <-- the end of line comments are aligned based on the line length + short # This is a shorter statement + + """), + SPLIT_ARGUMENTS_WHEN_COMMA_TERMINATED=textwrap.dedent("""\ + Split before arguments if the argument list is terminated by a + comma."""), + SPLIT_ALL_COMMA_SEPARATED_VALUES=textwrap.dedent("""\ + Split before arguments"""), + SPLIT_ALL_TOP_LEVEL_COMMA_SEPARATED_VALUES=textwrap.dedent("""\ + Split before arguments, but do not split all subexpressions recursively + (unless needed)."""), + SPLIT_BEFORE_ARITHMETIC_OPERATOR=textwrap.dedent("""\ + Set to True to prefer splitting before '+', '-', '*', '/', '//', or '@' + rather than after."""), + SPLIT_BEFORE_BITWISE_OPERATOR=textwrap.dedent("""\ + Set to True to prefer splitting before '&', '|' or '^' rather than + after."""), + SPLIT_BEFORE_CLOSING_BRACKET=textwrap.dedent("""\ + Split before the closing bracket if a list or dict literal doesn't fit on + a single line."""), + SPLIT_BEFORE_DICT_SET_GENERATOR=textwrap.dedent("""\ + Split before a dictionary or set generator (comp_for). For example, note + the split before the 'for': + + foo = { + variable: 'Hello world, have a nice day!' + for variable in bar if variable != 42 + }"""), + SPLIT_BEFORE_DOT=textwrap.dedent("""\ + Split before the '.' if we need to split a longer expression: + + foo = ('This is a really long string: {}, {}, {}, {}'.format(a, b, c, d)) + + would reformat to something like: + + foo = ('This is a really long string: {}, {}, {}, {}' + .format(a, b, c, d)) + """), + SPLIT_BEFORE_EXPRESSION_AFTER_OPENING_PAREN=textwrap.dedent("""\ + Split after the opening paren which surrounds an expression if it doesn't + fit on a single line. + """), + SPLIT_BEFORE_FIRST_ARGUMENT=textwrap.dedent("""\ + If an argument / parameter list is going to be split, then split before + the first argument."""), + SPLIT_BEFORE_LOGICAL_OPERATOR=textwrap.dedent("""\ + Set to True to prefer splitting before 'and' or 'or' rather than + after."""), + SPLIT_BEFORE_NAMED_ASSIGNS=textwrap.dedent("""\ + Split named assignments onto individual lines."""), + SPLIT_COMPLEX_COMPREHENSION=textwrap.dedent("""\ + Set to True to split list comprehensions and generators that have + non-trivial expressions and multiple clauses before each of these + clauses. For example: + + result = [ + a_long_var + 100 for a_long_var in xrange(1000) + if a_long_var % 10] + + would reformat to something like: + + result = [ + a_long_var + 100 + for a_long_var in xrange(1000) + if a_long_var % 10] + """), + SPLIT_PENALTY_AFTER_OPENING_BRACKET=textwrap.dedent("""\ + The penalty for splitting right after the opening bracket."""), + SPLIT_PENALTY_AFTER_UNARY_OPERATOR=textwrap.dedent("""\ + The penalty for splitting the line after a unary operator."""), + SPLIT_PENALTY_ARITHMETIC_OPERATOR=textwrap.dedent("""\ + The penalty of splitting the line around the '+', '-', '*', '/', '//', + ``%``, and '@' operators."""), + SPLIT_PENALTY_BEFORE_IF_EXPR=textwrap.dedent("""\ + The penalty for splitting right before an if expression."""), + SPLIT_PENALTY_BITWISE_OPERATOR=textwrap.dedent("""\ + The penalty of splitting the line around the '&', '|', and '^' + operators."""), + SPLIT_PENALTY_COMPREHENSION=textwrap.dedent("""\ + The penalty for splitting a list comprehension or generator + expression."""), + SPLIT_PENALTY_EXCESS_CHARACTER=textwrap.dedent("""\ + The penalty for characters over the column limit."""), + SPLIT_PENALTY_FOR_ADDED_LINE_SPLIT=textwrap.dedent("""\ + The penalty incurred by adding a line split to the unwrapped line. The + more line splits added the higher the penalty."""), + SPLIT_PENALTY_IMPORT_NAMES=textwrap.dedent("""\ + The penalty of splitting a list of "import as" names. For example: + + from a_very_long_or_indented_module_name_yada_yad import (long_argument_1, + long_argument_2, + long_argument_3) + + would reformat to something like: + + from a_very_long_or_indented_module_name_yada_yad import ( + long_argument_1, long_argument_2, long_argument_3) + """), + SPLIT_PENALTY_LOGICAL_OPERATOR=textwrap.dedent("""\ + The penalty of splitting the line around the 'and' and 'or' + operators."""), + USE_TABS=textwrap.dedent("""\ + Use the Tab character for indentation."""), + # BASED_ON_STYLE='Which predefined style this style is based on', +) + + +def CreatePEP8Style(): + """Create the PEP8 formatting style.""" + return dict( + ALIGN_CLOSING_BRACKET_WITH_VISUAL_INDENT=True, + ALLOW_MULTILINE_LAMBDAS=False, + ALLOW_MULTILINE_DICTIONARY_KEYS=False, + ALLOW_SPLIT_BEFORE_DEFAULT_OR_NAMED_ASSIGNS=True, + ALLOW_SPLIT_BEFORE_DICT_VALUE=True, + ARITHMETIC_PRECEDENCE_INDICATION=False, + BLANK_LINE_BEFORE_NESTED_CLASS_OR_DEF=False, + BLANK_LINE_BEFORE_CLASS_DOCSTRING=False, + BLANK_LINE_BEFORE_MODULE_DOCSTRING=False, + BLANK_LINES_AROUND_TOP_LEVEL_DEFINITION=2, + BLANK_LINES_BETWEEN_TOP_LEVEL_IMPORTS_AND_VARIABLES=1, + COALESCE_BRACKETS=False, + COLUMN_LIMIT=79, + CONTINUATION_ALIGN_STYLE='SPACE', + CONTINUATION_INDENT_WIDTH=4, + DEDENT_CLOSING_BRACKETS=False, + INDENT_CLOSING_BRACKETS=False, + DISABLE_ENDING_COMMA_HEURISTIC=False, + EACH_DICT_ENTRY_ON_SEPARATE_LINE=True, + FORCE_MULTILINE_DICT=False, + I18N_COMMENT='', + I18N_FUNCTION_CALL='', + INDENT_DICTIONARY_VALUE=False, + INDENT_WIDTH=4, + INDENT_BLANK_LINES=False, + JOIN_MULTIPLE_LINES=True, + NO_SPACES_AROUND_SELECTED_BINARY_OPERATORS=set(), + SPACE_BETWEEN_ENDING_COMMA_AND_CLOSING_BRACKET=True, + SPACE_INSIDE_BRACKETS=False, + SPACES_AROUND_POWER_OPERATOR=False, + SPACES_AROUND_DEFAULT_OR_NAMED_ASSIGN=False, + SPACES_AROUND_DICT_DELIMITERS=False, + SPACES_AROUND_LIST_DELIMITERS=False, + SPACES_AROUND_SUBSCRIPT_COLON=False, + SPACES_AROUND_TUPLE_DELIMITERS=False, + SPACES_BEFORE_COMMENT=2, + SPLIT_ARGUMENTS_WHEN_COMMA_TERMINATED=False, + SPLIT_ALL_COMMA_SEPARATED_VALUES=False, + SPLIT_ALL_TOP_LEVEL_COMMA_SEPARATED_VALUES=False, + SPLIT_BEFORE_ARITHMETIC_OPERATOR=False, + SPLIT_BEFORE_BITWISE_OPERATOR=True, + SPLIT_BEFORE_CLOSING_BRACKET=True, + SPLIT_BEFORE_DICT_SET_GENERATOR=True, + SPLIT_BEFORE_DOT=False, + SPLIT_BEFORE_EXPRESSION_AFTER_OPENING_PAREN=False, + SPLIT_BEFORE_FIRST_ARGUMENT=False, + SPLIT_BEFORE_LOGICAL_OPERATOR=True, + SPLIT_BEFORE_NAMED_ASSIGNS=True, + SPLIT_COMPLEX_COMPREHENSION=False, + SPLIT_PENALTY_AFTER_OPENING_BRACKET=300, + SPLIT_PENALTY_AFTER_UNARY_OPERATOR=10000, + SPLIT_PENALTY_ARITHMETIC_OPERATOR=300, + SPLIT_PENALTY_BEFORE_IF_EXPR=0, + SPLIT_PENALTY_BITWISE_OPERATOR=300, + SPLIT_PENALTY_COMPREHENSION=80, + SPLIT_PENALTY_EXCESS_CHARACTER=7000, + SPLIT_PENALTY_FOR_ADDED_LINE_SPLIT=30, + SPLIT_PENALTY_IMPORT_NAMES=0, + SPLIT_PENALTY_LOGICAL_OPERATOR=300, + USE_TABS=False, + ) + + +def CreateGoogleStyle(): + """Create the Google formatting style.""" + style = CreatePEP8Style() + style['ALIGN_CLOSING_BRACKET_WITH_VISUAL_INDENT'] = False + style['BLANK_LINE_BEFORE_NESTED_CLASS_OR_DEF'] = True + style['COLUMN_LIMIT'] = 80 + style['INDENT_DICTIONARY_VALUE'] = True + style['INDENT_WIDTH'] = 4 + style['I18N_COMMENT'] = r'#\..*' + style['I18N_FUNCTION_CALL'] = ['N_', '_'] + style['JOIN_MULTIPLE_LINES'] = False + style['SPACE_BETWEEN_ENDING_COMMA_AND_CLOSING_BRACKET'] = False + style['SPLIT_BEFORE_BITWISE_OPERATOR'] = False + style['SPLIT_BEFORE_DICT_SET_GENERATOR'] = False + style['SPLIT_BEFORE_LOGICAL_OPERATOR'] = False + style['SPLIT_COMPLEX_COMPREHENSION'] = True + style['SPLIT_PENALTY_COMPREHENSION'] = 2100 + return style + + +def CreateYapfStyle(): + """Create the YAPF formatting style.""" + style = CreateGoogleStyle() + style['ALLOW_MULTILINE_DICTIONARY_KEYS'] = True + style['ALLOW_SPLIT_BEFORE_DEFAULT_OR_NAMED_ASSIGNS'] = False + style['INDENT_WIDTH'] = 2 + style['SPLIT_BEFORE_BITWISE_OPERATOR'] = True + style['SPLIT_BEFORE_DOT'] = True + style['SPLIT_BEFORE_EXPRESSION_AFTER_OPENING_PAREN'] = True + return style + + +def CreateFacebookStyle(): + """Create the Facebook formatting style.""" + style = CreatePEP8Style() + style['ALIGN_CLOSING_BRACKET_WITH_VISUAL_INDENT'] = False + style['COLUMN_LIMIT'] = 80 + style['DEDENT_CLOSING_BRACKETS'] = True + style['INDENT_CLOSING_BRACKETS'] = False + style['INDENT_DICTIONARY_VALUE'] = True + style['JOIN_MULTIPLE_LINES'] = False + style['SPACES_BEFORE_COMMENT'] = 2 + style['SPLIT_PENALTY_AFTER_OPENING_BRACKET'] = 0 + style['SPLIT_PENALTY_BEFORE_IF_EXPR'] = 30 + style['SPLIT_PENALTY_FOR_ADDED_LINE_SPLIT'] = 30 + style['SPLIT_BEFORE_LOGICAL_OPERATOR'] = False + style['SPLIT_BEFORE_BITWISE_OPERATOR'] = False + return style + + +_STYLE_NAME_TO_FACTORY = dict( + pep8=CreatePEP8Style, + google=CreateGoogleStyle, + facebook=CreateFacebookStyle, + yapf=CreateYapfStyle, +) + +_DEFAULT_STYLE_TO_FACTORY = [ + (CreateFacebookStyle(), CreateFacebookStyle), + (CreateGoogleStyle(), CreateGoogleStyle), + (CreatePEP8Style(), CreatePEP8Style), + (CreateYapfStyle(), CreateYapfStyle), +] + + +def _GetStyleFactory(style): + for def_style, factory in _DEFAULT_STYLE_TO_FACTORY: + if style == def_style: + return factory + return None + + +def _ContinuationAlignStyleStringConverter(s): + """Option value converter for a continuation align style string.""" + accepted_styles = ('SPACE', 'FIXED', 'VALIGN-RIGHT') + if s: + r = s.strip('"\'').replace('_', '-').upper() + if r not in accepted_styles: + raise ValueError('unknown continuation align style: %r' % (s,)) + else: + r = accepted_styles[0] + return r + + +def _StringListConverter(s): + """Option value converter for a comma-separated list of strings.""" + return [part.strip() for part in s.split(',')] + + +def _StringSetConverter(s): + """Option value converter for a comma-separated set of strings.""" + if len(s) > 2 and s[0] in '"\'': + s = s[1:-1] + return set(part.strip() for part in s.split(',')) + + +def _BoolConverter(s): + """Option value converter for a boolean.""" + return py3compat.CONFIGPARSER_BOOLEAN_STATES[s.lower()] + + +def _IntListConverter(s): + """Option value converter for a comma-separated list of integers.""" + s = s.strip() + if s.startswith('[') and s.endswith(']'): + s = s[1:-1] + + return [int(part.strip()) for part in s.split(',') if part.strip()] + + +def _IntOrIntListConverter(s): + """Option value converter for an integer or list of integers.""" + if len(s) > 2 and s[0] in '"\'': + s = s[1:-1] + return _IntListConverter(s) if ',' in s else int(s) + + +# Different style options need to have their values interpreted differently when +# read from the config file. This dict maps an option name to a "converter" +# function that accepts the string read for the option's value from the file and +# returns it wrapper in actual Python type that's going to be meaningful to +# yapf. +# +# Note: this dict has to map all the supported style options. +_STYLE_OPTION_VALUE_CONVERTER = dict( + ALIGN_CLOSING_BRACKET_WITH_VISUAL_INDENT=_BoolConverter, + ALLOW_MULTILINE_LAMBDAS=_BoolConverter, + ALLOW_MULTILINE_DICTIONARY_KEYS=_BoolConverter, + ALLOW_SPLIT_BEFORE_DEFAULT_OR_NAMED_ASSIGNS=_BoolConverter, + ALLOW_SPLIT_BEFORE_DICT_VALUE=_BoolConverter, + ARITHMETIC_PRECEDENCE_INDICATION=_BoolConverter, + BLANK_LINE_BEFORE_NESTED_CLASS_OR_DEF=_BoolConverter, + BLANK_LINE_BEFORE_CLASS_DOCSTRING=_BoolConverter, + BLANK_LINE_BEFORE_MODULE_DOCSTRING=_BoolConverter, + BLANK_LINES_AROUND_TOP_LEVEL_DEFINITION=int, + BLANK_LINES_BETWEEN_TOP_LEVEL_IMPORTS_AND_VARIABLES=int, + COALESCE_BRACKETS=_BoolConverter, + COLUMN_LIMIT=int, + CONTINUATION_ALIGN_STYLE=_ContinuationAlignStyleStringConverter, + CONTINUATION_INDENT_WIDTH=int, + DEDENT_CLOSING_BRACKETS=_BoolConverter, + INDENT_CLOSING_BRACKETS=_BoolConverter, + DISABLE_ENDING_COMMA_HEURISTIC=_BoolConverter, + EACH_DICT_ENTRY_ON_SEPARATE_LINE=_BoolConverter, + FORCE_MULTILINE_DICT=_BoolConverter, + I18N_COMMENT=str, + I18N_FUNCTION_CALL=_StringListConverter, + INDENT_DICTIONARY_VALUE=_BoolConverter, + INDENT_WIDTH=int, + INDENT_BLANK_LINES=_BoolConverter, + JOIN_MULTIPLE_LINES=_BoolConverter, + NO_SPACES_AROUND_SELECTED_BINARY_OPERATORS=_StringSetConverter, + SPACE_BETWEEN_ENDING_COMMA_AND_CLOSING_BRACKET=_BoolConverter, + SPACE_INSIDE_BRACKETS=_BoolConverter, + SPACES_AROUND_POWER_OPERATOR=_BoolConverter, + SPACES_AROUND_DEFAULT_OR_NAMED_ASSIGN=_BoolConverter, + SPACES_AROUND_DICT_DELIMITERS=_BoolConverter, + SPACES_AROUND_LIST_DELIMITERS=_BoolConverter, + SPACES_AROUND_SUBSCRIPT_COLON=_BoolConverter, + SPACES_AROUND_TUPLE_DELIMITERS=_BoolConverter, + SPACES_BEFORE_COMMENT=_IntOrIntListConverter, + SPLIT_ARGUMENTS_WHEN_COMMA_TERMINATED=_BoolConverter, + SPLIT_ALL_COMMA_SEPARATED_VALUES=_BoolConverter, + SPLIT_ALL_TOP_LEVEL_COMMA_SEPARATED_VALUES=_BoolConverter, + SPLIT_BEFORE_ARITHMETIC_OPERATOR=_BoolConverter, + SPLIT_BEFORE_BITWISE_OPERATOR=_BoolConverter, + SPLIT_BEFORE_CLOSING_BRACKET=_BoolConverter, + SPLIT_BEFORE_DICT_SET_GENERATOR=_BoolConverter, + SPLIT_BEFORE_DOT=_BoolConverter, + SPLIT_BEFORE_EXPRESSION_AFTER_OPENING_PAREN=_BoolConverter, + SPLIT_BEFORE_FIRST_ARGUMENT=_BoolConverter, + SPLIT_BEFORE_LOGICAL_OPERATOR=_BoolConverter, + SPLIT_BEFORE_NAMED_ASSIGNS=_BoolConverter, + SPLIT_COMPLEX_COMPREHENSION=_BoolConverter, + SPLIT_PENALTY_AFTER_OPENING_BRACKET=int, + SPLIT_PENALTY_AFTER_UNARY_OPERATOR=int, + SPLIT_PENALTY_ARITHMETIC_OPERATOR=int, + SPLIT_PENALTY_BEFORE_IF_EXPR=int, + SPLIT_PENALTY_BITWISE_OPERATOR=int, + SPLIT_PENALTY_COMPREHENSION=int, + SPLIT_PENALTY_EXCESS_CHARACTER=int, + SPLIT_PENALTY_FOR_ADDED_LINE_SPLIT=int, + SPLIT_PENALTY_IMPORT_NAMES=int, + SPLIT_PENALTY_LOGICAL_OPERATOR=int, + USE_TABS=_BoolConverter, +) + + +def CreateStyleFromConfig(style_config): + """Create a style dict from the given config. + + Arguments: + style_config: either a style name or a file name. The file is expected to + contain settings. It can have a special BASED_ON_STYLE setting naming the + style which it derives from. If no such setting is found, it derives from + the default style. When style_config is None, the _GLOBAL_STYLE_FACTORY + config is created. + + Returns: + A style dict. + + Raises: + StyleConfigError: if an unknown style option was encountered. + """ + + def GlobalStyles(): + for style, _ in _DEFAULT_STYLE_TO_FACTORY: + yield style + + def_style = False + if style_config is None: + for style in GlobalStyles(): + if _style == style: + def_style = True + break + if not def_style: + return _style + return _GLOBAL_STYLE_FACTORY() + + if isinstance(style_config, dict): + config = _CreateConfigParserFromConfigDict(style_config) + elif isinstance(style_config, py3compat.basestring): + style_factory = _STYLE_NAME_TO_FACTORY.get(style_config.lower()) + if style_factory is not None: + return style_factory() + if style_config.startswith('{'): + # Most likely a style specification from the command line. + config = _CreateConfigParserFromConfigString(style_config) + else: + # Unknown config name: assume it's a file name then. + config = _CreateConfigParserFromConfigFile(style_config) + return _CreateStyleFromConfigParser(config) + + +def _CreateConfigParserFromConfigDict(config_dict): + config = py3compat.ConfigParser() + config.add_section('style') + for key, value in config_dict.items(): + config.set('style', key, str(value)) + return config + + +def _CreateConfigParserFromConfigString(config_string): + """Given a config string from the command line, return a config parser.""" + if config_string[0] != '{' or config_string[-1] != '}': + raise StyleConfigError( + "Invalid style dict syntax: '{}'.".format(config_string)) + config = py3compat.ConfigParser() + config.add_section('style') + for key, value, _ in re.findall( + r'([a-zA-Z0-9_]+)\s*[:=]\s*' + r'(?:' + r'((?P[\'"]).*?(?P=quote)|' + r'[a-zA-Z0-9_]+)' + r')', config_string): # yapf: disable + config.set('style', key, value) + return config + + +def _CreateConfigParserFromConfigFile(config_filename): + """Read the file and return a ConfigParser object.""" + if not os.path.exists(config_filename): + # Provide a more meaningful error here. + raise StyleConfigError( + '"{0}" is not a valid style or file path'.format(config_filename)) + with open(config_filename) as style_file: + config = py3compat.ConfigParser() + if config_filename.endswith(PYPROJECT_TOML): + try: + import toml + except ImportError: + raise errors.YapfError( + "toml package is needed for using pyproject.toml as a configuration file" + ) + + pyproject_toml = toml.load(style_file) + style_dict = pyproject_toml.get("tool", {}).get("yapf", None) + if style_dict is None: + raise StyleConfigError( + 'Unable to find section [tool.yapf] in {0}'.format(config_filename)) + config.add_section('style') + for k, v in style_dict.items(): + config.set('style', k, str(v)) + return config + + config.read_file(style_file) + if config_filename.endswith(SETUP_CONFIG): + if not config.has_section('yapf'): + raise StyleConfigError( + 'Unable to find section [yapf] in {0}'.format(config_filename)) + return config + + if config_filename.endswith(LOCAL_STYLE): + if not config.has_section('style'): + raise StyleConfigError( + 'Unable to find section [style] in {0}'.format(config_filename)) + return config + + if not config.has_section('style'): + raise StyleConfigError( + 'Unable to find section [style] in {0}'.format(config_filename)) + return config + + +def _CreateStyleFromConfigParser(config): + """Create a style dict from a configuration file. + + Arguments: + config: a ConfigParser object. + + Returns: + A style dict. + + Raises: + StyleConfigError: if an unknown style option was encountered. + """ + # Initialize the base style. + section = 'yapf' if config.has_section('yapf') else 'style' + if config.has_option('style', 'based_on_style'): + based_on = config.get('style', 'based_on_style').lower() + base_style = _STYLE_NAME_TO_FACTORY[based_on]() + elif config.has_option('yapf', 'based_on_style'): + based_on = config.get('yapf', 'based_on_style').lower() + base_style = _STYLE_NAME_TO_FACTORY[based_on]() + else: + base_style = _GLOBAL_STYLE_FACTORY() + + # Read all options specified in the file and update the style. + for option, value in config.items(section): + if option.lower() == 'based_on_style': + # Now skip this one - we've already handled it and it's not one of the + # recognized style options. + continue + option = option.upper() + if option not in _STYLE_OPTION_VALUE_CONVERTER: + raise StyleConfigError('Unknown style option "{0}"'.format(option)) + try: + base_style[option] = _STYLE_OPTION_VALUE_CONVERTER[option](value) + except ValueError: + raise StyleConfigError("'{}' is not a valid setting for {}.".format( + value, option)) + return base_style + + +# The default style - used if yapf is not invoked without specifically +# requesting a formatting style. +DEFAULT_STYLE = 'pep8' +DEFAULT_STYLE_FACTORY = CreatePEP8Style +_GLOBAL_STYLE_FACTORY = CreatePEP8Style + +# The name of the file to use for global style definition. +GLOBAL_STYLE = ( + os.path.join( + os.getenv('XDG_CONFIG_HOME') or os.path.expanduser('~/.config'), 'yapf', + 'style')) + +# The name of the file to use for directory-local style definition. +LOCAL_STYLE = '.style.yapf' + +# Alternative place for directory-local style definition. Style should be +# specified in the '[yapf]' section. +SETUP_CONFIG = 'setup.cfg' + +# Style definition by local pyproject.toml file. Style should be specified +# in the '[tool.yapf]' section. +PYPROJECT_TOML = 'pyproject.toml' + +# TODO(eliben): For now we're preserving the global presence of a style dict. +# Refactor this so that the style is passed around through yapf rather than +# being global. +_style = None +SetGlobalStyle(_GLOBAL_STYLE_FACTORY()) diff --git a/.venv/lib/python3.9/site-packages/yapf/yapflib/subtype_assigner.py b/.venv/lib/python3.9/site-packages/yapf/yapflib/subtype_assigner.py new file mode 100644 index 00000000..0fa2d966 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapf/yapflib/subtype_assigner.py @@ -0,0 +1,509 @@ +# Copyright 2015 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Subtype assigner for lib2to3 trees. + +This module assigns extra type information to the lib2to3 trees. This +information is more specific than whether something is an operator or an +identifier. For instance, it can specify if a node in the tree is part of a +subscript. + + AssignSubtypes(): the main function exported by this module. + +Annotations: + subtype: The subtype of a pytree token. See 'format_token' module for a list + of subtypes. +""" + +from lib2to3 import pytree +from lib2to3.pgen2 import token +from lib2to3.pygram import python_symbols as syms + +from yapf.yapflib import format_token +from yapf.yapflib import pytree_utils +from yapf.yapflib import pytree_visitor +from yapf.yapflib import style + + +def AssignSubtypes(tree): + """Run the subtype assigner visitor over the tree, modifying it in place. + + Arguments: + tree: the top-level pytree node to annotate with subtypes. + """ + subtype_assigner = _SubtypeAssigner() + subtype_assigner.Visit(tree) + + +# Map tokens in argument lists to their respective subtype. +_ARGLIST_TOKEN_TO_SUBTYPE = { + '=': format_token.Subtype.DEFAULT_OR_NAMED_ASSIGN, + ':': format_token.Subtype.TYPED_NAME, + '*': format_token.Subtype.VARARGS_STAR, + '**': format_token.Subtype.KWARGS_STAR_STAR, +} + + +class _SubtypeAssigner(pytree_visitor.PyTreeVisitor): + """_SubtypeAssigner - see file-level docstring for detailed description. + + The subtype is added as an annotation to the pytree token. + """ + + def Visit_dictsetmaker(self, node): # pylint: disable=invalid-name + # dictsetmaker ::= (test ':' test (comp_for | + # (',' test ':' test)* [','])) | + # (test (comp_for | (',' test)* [','])) + for child in node.children: + self.Visit(child) + + comp_for = False + dict_maker = False + + for child in node.children: + if pytree_utils.NodeName(child) == 'comp_for': + comp_for = True + _AppendFirstLeafTokenSubtype(child, + format_token.Subtype.DICT_SET_GENERATOR) + elif pytree_utils.NodeName(child) in ('COLON', 'DOUBLESTAR'): + dict_maker = True + + if not comp_for and dict_maker: + last_was_colon = False + unpacking = False + for child in node.children: + if pytree_utils.NodeName(child) == 'DOUBLESTAR': + _AppendFirstLeafTokenSubtype(child, + format_token.Subtype.KWARGS_STAR_STAR) + if last_was_colon: + if style.Get('INDENT_DICTIONARY_VALUE'): + _InsertPseudoParentheses(child) + else: + _AppendFirstLeafTokenSubtype(child, + format_token.Subtype.DICTIONARY_VALUE) + elif (isinstance(child, pytree.Node) or + (not child.value.startswith('#') and child.value not in '{:,')): + # Mark the first leaf of a key entry as a DICTIONARY_KEY. We + # normally want to split before them if the dictionary cannot exist + # on a single line. + if not unpacking or pytree_utils.FirstLeafNode(child).value == '**': + _AppendFirstLeafTokenSubtype(child, + format_token.Subtype.DICTIONARY_KEY) + _AppendSubtypeRec(child, format_token.Subtype.DICTIONARY_KEY_PART) + last_was_colon = pytree_utils.NodeName(child) == 'COLON' + if pytree_utils.NodeName(child) == 'DOUBLESTAR': + unpacking = True + elif last_was_colon: + unpacking = False + + def Visit_expr_stmt(self, node): # pylint: disable=invalid-name + # expr_stmt ::= testlist_star_expr (augassign (yield_expr|testlist) + # | ('=' (yield_expr|testlist_star_expr))*) + for child in node.children: + self.Visit(child) + if isinstance(child, pytree.Leaf) and child.value == '=': + _AppendTokenSubtype(child, format_token.Subtype.ASSIGN_OPERATOR) + + def Visit_or_test(self, node): # pylint: disable=invalid-name + # or_test ::= and_test ('or' and_test)* + for child in node.children: + self.Visit(child) + if isinstance(child, pytree.Leaf) and child.value == 'or': + _AppendTokenSubtype(child, format_token.Subtype.BINARY_OPERATOR) + + def Visit_and_test(self, node): # pylint: disable=invalid-name + # and_test ::= not_test ('and' not_test)* + for child in node.children: + self.Visit(child) + if isinstance(child, pytree.Leaf) and child.value == 'and': + _AppendTokenSubtype(child, format_token.Subtype.BINARY_OPERATOR) + + def Visit_not_test(self, node): # pylint: disable=invalid-name + # not_test ::= 'not' not_test | comparison + for child in node.children: + self.Visit(child) + if isinstance(child, pytree.Leaf) and child.value == 'not': + _AppendTokenSubtype(child, format_token.Subtype.UNARY_OPERATOR) + + def Visit_comparison(self, node): # pylint: disable=invalid-name + # comparison ::= expr (comp_op expr)* + # comp_op ::= '<'|'>'|'=='|'>='|'<='|'<>'|'!='|'in'|'not in'|'is'|'is not' + for child in node.children: + self.Visit(child) + if (isinstance(child, pytree.Leaf) and + child.value in {'<', '>', '==', '>=', '<=', '<>', '!=', 'in', 'is'}): + _AppendTokenSubtype(child, format_token.Subtype.BINARY_OPERATOR) + elif pytree_utils.NodeName(child) == 'comp_op': + for grandchild in child.children: + _AppendTokenSubtype(grandchild, format_token.Subtype.BINARY_OPERATOR) + + def Visit_star_expr(self, node): # pylint: disable=invalid-name + # star_expr ::= '*' expr + for child in node.children: + self.Visit(child) + if isinstance(child, pytree.Leaf) and child.value == '*': + _AppendTokenSubtype(child, format_token.Subtype.UNARY_OPERATOR) + _AppendTokenSubtype(child, format_token.Subtype.VARARGS_STAR) + + def Visit_expr(self, node): # pylint: disable=invalid-name + # expr ::= xor_expr ('|' xor_expr)* + for child in node.children: + self.Visit(child) + if isinstance(child, pytree.Leaf) and child.value == '|': + _AppendTokenSubtype(child, format_token.Subtype.BINARY_OPERATOR) + + def Visit_xor_expr(self, node): # pylint: disable=invalid-name + # xor_expr ::= and_expr ('^' and_expr)* + for child in node.children: + self.Visit(child) + if isinstance(child, pytree.Leaf) and child.value == '^': + _AppendTokenSubtype(child, format_token.Subtype.BINARY_OPERATOR) + + def Visit_and_expr(self, node): # pylint: disable=invalid-name + # and_expr ::= shift_expr ('&' shift_expr)* + for child in node.children: + self.Visit(child) + if isinstance(child, pytree.Leaf) and child.value == '&': + _AppendTokenSubtype(child, format_token.Subtype.BINARY_OPERATOR) + + def Visit_shift_expr(self, node): # pylint: disable=invalid-name + # shift_expr ::= arith_expr (('<<'|'>>') arith_expr)* + for child in node.children: + self.Visit(child) + if isinstance(child, pytree.Leaf) and child.value in {'<<', '>>'}: + _AppendTokenSubtype(child, format_token.Subtype.BINARY_OPERATOR) + + def Visit_arith_expr(self, node): # pylint: disable=invalid-name + # arith_expr ::= term (('+'|'-') term)* + for child in node.children: + self.Visit(child) + if _IsAExprOperator(child): + _AppendTokenSubtype(child, format_token.Subtype.BINARY_OPERATOR) + _AppendTokenSubtype(child, format_token.Subtype.A_EXPR_OPERATOR) + + if _IsSimpleExpression(node): + for child in node.children: + if _IsAExprOperator(child): + _AppendTokenSubtype(child, format_token.Subtype.SIMPLE_EXPRESSION) + + def Visit_term(self, node): # pylint: disable=invalid-name + # term ::= factor (('*'|'/'|'%'|'//'|'@') factor)* + for child in node.children: + self.Visit(child) + if _IsMExprOperator(child): + _AppendTokenSubtype(child, format_token.Subtype.BINARY_OPERATOR) + _AppendTokenSubtype(child, format_token.Subtype.M_EXPR_OPERATOR) + + if _IsSimpleExpression(node): + for child in node.children: + if _IsMExprOperator(child): + _AppendTokenSubtype(child, format_token.Subtype.SIMPLE_EXPRESSION) + + def Visit_factor(self, node): # pylint: disable=invalid-name + # factor ::= ('+'|'-'|'~') factor | power + for child in node.children: + self.Visit(child) + if isinstance(child, pytree.Leaf) and child.value in '+-~': + _AppendTokenSubtype(child, format_token.Subtype.UNARY_OPERATOR) + + def Visit_power(self, node): # pylint: disable=invalid-name + # power ::= atom trailer* ['**' factor] + for child in node.children: + self.Visit(child) + if isinstance(child, pytree.Leaf) and child.value == '**': + _AppendTokenSubtype(child, format_token.Subtype.BINARY_OPERATOR) + + def Visit_trailer(self, node): # pylint: disable=invalid-name + for child in node.children: + self.Visit(child) + if isinstance(child, pytree.Leaf) and child.value in '[]': + _AppendTokenSubtype(child, format_token.Subtype.SUBSCRIPT_BRACKET) + + def Visit_subscript(self, node): # pylint: disable=invalid-name + # subscript ::= test | [test] ':' [test] [sliceop] + for child in node.children: + self.Visit(child) + if isinstance(child, pytree.Leaf) and child.value == ':': + _AppendTokenSubtype(child, format_token.Subtype.SUBSCRIPT_COLON) + + def Visit_sliceop(self, node): # pylint: disable=invalid-name + # sliceop ::= ':' [test] + for child in node.children: + self.Visit(child) + if isinstance(child, pytree.Leaf) and child.value == ':': + _AppendTokenSubtype(child, format_token.Subtype.SUBSCRIPT_COLON) + + def Visit_argument(self, node): # pylint: disable=invalid-name + # argument ::= + # test [comp_for] | test '=' test + self._ProcessArgLists(node) + + def Visit_arglist(self, node): # pylint: disable=invalid-name + # arglist ::= + # (argument ',')* (argument [','] + # | '*' test (',' argument)* [',' '**' test] + # | '**' test) + self._ProcessArgLists(node) + _SetArgListSubtype(node, format_token.Subtype.DEFAULT_OR_NAMED_ASSIGN, + format_token.Subtype.DEFAULT_OR_NAMED_ASSIGN_ARG_LIST) + + def Visit_tname(self, node): # pylint: disable=invalid-name + self._ProcessArgLists(node) + _SetArgListSubtype(node, format_token.Subtype.DEFAULT_OR_NAMED_ASSIGN, + format_token.Subtype.DEFAULT_OR_NAMED_ASSIGN_ARG_LIST) + + def Visit_decorator(self, node): # pylint: disable=invalid-name + # decorator ::= + # '@' dotted_name [ '(' [arglist] ')' ] NEWLINE + for child in node.children: + if isinstance(child, pytree.Leaf) and child.value == '@': + _AppendTokenSubtype(child, subtype=format_token.Subtype.DECORATOR) + self.Visit(child) + + def Visit_funcdef(self, node): # pylint: disable=invalid-name + # funcdef ::= + # 'def' NAME parameters ['->' test] ':' suite + for child in node.children: + if pytree_utils.NodeName(child) == 'NAME' and child.value != 'def': + _AppendTokenSubtype(child, format_token.Subtype.FUNC_DEF) + break + for child in node.children: + self.Visit(child) + + def Visit_parameters(self, node): # pylint: disable=invalid-name + # parameters ::= '(' [typedargslist] ')' + self._ProcessArgLists(node) + if len(node.children) > 2: + _AppendFirstLeafTokenSubtype(node.children[1], + format_token.Subtype.PARAMETER_START) + _AppendLastLeafTokenSubtype(node.children[-2], + format_token.Subtype.PARAMETER_STOP) + + def Visit_typedargslist(self, node): # pylint: disable=invalid-name + # typedargslist ::= + # ((tfpdef ['=' test] ',')* + # ('*' [tname] (',' tname ['=' test])* [',' '**' tname] + # | '**' tname) + # | tfpdef ['=' test] (',' tfpdef ['=' test])* [',']) + self._ProcessArgLists(node) + _SetArgListSubtype(node, format_token.Subtype.DEFAULT_OR_NAMED_ASSIGN, + format_token.Subtype.DEFAULT_OR_NAMED_ASSIGN_ARG_LIST) + tname = False + if not node.children: + return + + _AppendFirstLeafTokenSubtype(node.children[0], + format_token.Subtype.PARAMETER_START) + _AppendLastLeafTokenSubtype(node.children[-1], + format_token.Subtype.PARAMETER_STOP) + + i = 1 + tname = pytree_utils.NodeName(node.children[0]) == 'tname' + while i < len(node.children): + prev_child = node.children[i - 1] + child = node.children[i] + i += 1 + + if pytree_utils.NodeName(prev_child) == 'COMMA': + _AppendFirstLeafTokenSubtype(child, + format_token.Subtype.PARAMETER_START) + elif pytree_utils.NodeName(child) == 'COMMA': + _AppendLastLeafTokenSubtype(prev_child, + format_token.Subtype.PARAMETER_STOP) + + if pytree_utils.NodeName(child) == 'tname': + tname = True + _SetArgListSubtype(child, format_token.Subtype.TYPED_NAME, + format_token.Subtype.TYPED_NAME_ARG_LIST) + elif pytree_utils.NodeName(child) == 'COMMA': + tname = False + elif pytree_utils.NodeName(child) == 'EQUAL' and tname: + _AppendTokenSubtype(child, subtype=format_token.Subtype.TYPED_NAME) + tname = False + + def Visit_varargslist(self, node): # pylint: disable=invalid-name + # varargslist ::= + # ((vfpdef ['=' test] ',')* + # ('*' [vname] (',' vname ['=' test])* [',' '**' vname] + # | '**' vname) + # | vfpdef ['=' test] (',' vfpdef ['=' test])* [',']) + self._ProcessArgLists(node) + for child in node.children: + self.Visit(child) + if isinstance(child, pytree.Leaf) and child.value == '=': + _AppendTokenSubtype(child, format_token.Subtype.VARARGS_LIST) + + def Visit_comp_for(self, node): # pylint: disable=invalid-name + # comp_for ::= 'for' exprlist 'in' testlist_safe [comp_iter] + _AppendSubtypeRec(node, format_token.Subtype.COMP_FOR) + # Mark the previous node as COMP_EXPR unless this is a nested comprehension + # as these will have the outer comprehension as their previous node. + attr = pytree_utils.GetNodeAnnotation(node.parent, + pytree_utils.Annotation.SUBTYPE) + if not attr or format_token.Subtype.COMP_FOR not in attr: + _AppendSubtypeRec(node.parent.children[0], format_token.Subtype.COMP_EXPR) + self.DefaultNodeVisit(node) + + def Visit_old_comp_for(self, node): # pylint: disable=invalid-name + # Python 3.7 + self.Visit_comp_for(node) + + def Visit_comp_if(self, node): # pylint: disable=invalid-name + # comp_if ::= 'if' old_test [comp_iter] + _AppendSubtypeRec(node, format_token.Subtype.COMP_IF) + self.DefaultNodeVisit(node) + + def Visit_old_comp_if(self, node): # pylint: disable=invalid-name + # Python 3.7 + self.Visit_comp_if(node) + + def _ProcessArgLists(self, node): + """Common method for processing argument lists.""" + for child in node.children: + self.Visit(child) + if isinstance(child, pytree.Leaf): + _AppendTokenSubtype( + child, + subtype=_ARGLIST_TOKEN_TO_SUBTYPE.get(child.value, + format_token.Subtype.NONE)) + + +def _SetArgListSubtype(node, node_subtype, list_subtype): + """Set named assign subtype on elements in a arg list.""" + + def HasSubtype(node): + """Return True if the arg list has a named assign subtype.""" + if isinstance(node, pytree.Leaf): + return node_subtype in pytree_utils.GetNodeAnnotation( + node, pytree_utils.Annotation.SUBTYPE, set()) + + for child in node.children: + node_name = pytree_utils.NodeName(child) + if node_name not in {'atom', 'arglist', 'power'}: + if HasSubtype(child): + return True + + return False + + if not HasSubtype(node): + return + + for child in node.children: + node_name = pytree_utils.NodeName(child) + if node_name not in {'atom', 'COMMA'}: + _AppendFirstLeafTokenSubtype(child, list_subtype) + + +def _AppendTokenSubtype(node, subtype): + """Append the token's subtype only if it's not already set.""" + pytree_utils.AppendNodeAnnotation(node, pytree_utils.Annotation.SUBTYPE, + subtype) + + +def _AppendFirstLeafTokenSubtype(node, subtype): + """Append the first leaf token's subtypes.""" + if isinstance(node, pytree.Leaf): + _AppendTokenSubtype(node, subtype) + return + _AppendFirstLeafTokenSubtype(node.children[0], subtype) + + +def _AppendLastLeafTokenSubtype(node, subtype): + """Append the last leaf token's subtypes.""" + if isinstance(node, pytree.Leaf): + _AppendTokenSubtype(node, subtype) + return + _AppendLastLeafTokenSubtype(node.children[-1], subtype) + + +def _AppendSubtypeRec(node, subtype, force=True): + """Append the leafs in the node to the given subtype.""" + if isinstance(node, pytree.Leaf): + _AppendTokenSubtype(node, subtype) + return + for child in node.children: + _AppendSubtypeRec(child, subtype, force=force) + + +def _InsertPseudoParentheses(node): + """Insert pseudo parentheses so that dicts can be formatted correctly.""" + comment_node = None + if isinstance(node, pytree.Node): + if node.children[-1].type == token.COMMENT: + comment_node = node.children[-1].clone() + node.children[-1].remove() + + first = pytree_utils.FirstLeafNode(node) + last = pytree_utils.LastLeafNode(node) + + if first == last and first.type == token.COMMENT: + # A comment was inserted before the value, which is a pytree.Leaf. + # Encompass the dictionary's value into an ATOM node. + last = first.next_sibling + last_clone = last.clone() + new_node = pytree.Node(syms.atom, [first.clone(), last_clone]) + for orig_leaf, clone_leaf in zip(last.leaves(), last_clone.leaves()): + pytree_utils.CopyYapfAnnotations(orig_leaf, clone_leaf) + if hasattr(orig_leaf, 'is_pseudo'): + clone_leaf.is_pseudo = orig_leaf.is_pseudo + + node.replace(new_node) + node = new_node + last.remove() + + first = pytree_utils.FirstLeafNode(node) + last = pytree_utils.LastLeafNode(node) + + lparen = pytree.Leaf( + token.LPAR, u'(', context=('', (first.get_lineno(), first.column - 1))) + last_lineno = last.get_lineno() + if last.type == token.STRING and '\n' in last.value: + last_lineno += last.value.count('\n') + + if last.type == token.STRING and '\n' in last.value: + last_column = len(last.value.split('\n')[-1]) + 1 + else: + last_column = last.column + len(last.value) + 1 + rparen = pytree.Leaf( + token.RPAR, u')', context=('', (last_lineno, last_column))) + + lparen.is_pseudo = True + rparen.is_pseudo = True + + if isinstance(node, pytree.Node): + node.insert_child(0, lparen) + node.append_child(rparen) + if comment_node: + node.append_child(comment_node) + _AppendFirstLeafTokenSubtype(node, format_token.Subtype.DICTIONARY_VALUE) + else: + clone = node.clone() + for orig_leaf, clone_leaf in zip(node.leaves(), clone.leaves()): + pytree_utils.CopyYapfAnnotations(orig_leaf, clone_leaf) + new_node = pytree.Node(syms.atom, [lparen, clone, rparen]) + node.replace(new_node) + _AppendFirstLeafTokenSubtype(clone, format_token.Subtype.DICTIONARY_VALUE) + + +def _IsAExprOperator(node): + return isinstance(node, pytree.Leaf) and node.value in {'+', '-'} + + +def _IsMExprOperator(node): + return isinstance(node, + pytree.Leaf) and node.value in {'*', '/', '%', '//', '@'} + + +def _IsSimpleExpression(node): + """A node with only leafs as children.""" + return all(isinstance(child, pytree.Leaf) for child in node.children) diff --git a/.venv/lib/python3.9/site-packages/yapf/yapflib/unwrapped_line.py b/.venv/lib/python3.9/site-packages/yapf/yapflib/unwrapped_line.py new file mode 100644 index 00000000..475bd6e0 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapf/yapflib/unwrapped_line.py @@ -0,0 +1,673 @@ +# Copyright 2015 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""UnwrappedLine primitive for formatting. + +An unwrapped line is the containing data structure produced by the parser. It +collects all nodes (stored in FormatToken objects) that could appear on a +single line if there were no line length restrictions. It's then used by the +parser to perform the wrapping required to comply with the style guide. +""" + +from yapf.yapflib import format_token +from yapf.yapflib import py3compat +from yapf.yapflib import pytree_utils +from yapf.yapflib import split_penalty +from yapf.yapflib import style + +from lib2to3.fixer_util import syms as python_symbols + + +class UnwrappedLine(object): + """Represents a single unwrapped line in the output. + + Attributes: + depth: indentation depth of this line. This is just a numeric value used to + distinguish lines that are more deeply nested than others. It is not the + actual amount of spaces, which is style-dependent. + """ + + def __init__(self, depth, tokens=None): + """Constructor. + + Creates a new unwrapped line with the given depth an initial list of tokens. + Constructs the doubly-linked lists for format tokens using their built-in + next_token and previous_token attributes. + + Arguments: + depth: indentation depth of this line + tokens: initial list of tokens + """ + self.depth = depth + self._tokens = tokens or [] + self.disable = False + + if self._tokens: + # Set up a doubly linked list. + for index, tok in enumerate(self._tokens[1:]): + # Note, 'index' is the index to the previous token. + tok.previous_token = self._tokens[index] + self._tokens[index].next_token = tok + + def CalculateFormattingInformation(self): + """Calculate the split penalty and total length for the tokens.""" + # Say that the first token in the line should have a space before it. This + # means only that if this unwrapped line is joined with a predecessor line, + # then there will be a space between them. + self.first.spaces_required_before = 1 + self.first.total_length = len(self.first.value) + + prev_token = self.first + prev_length = self.first.total_length + for token in self._tokens[1:]: + if (token.spaces_required_before == 0 and + _SpaceRequiredBetween(prev_token, token, self.disable)): + token.spaces_required_before = 1 + + tok_len = len(token.value) if not token.is_pseudo_paren else 0 + + spaces_required_before = token.spaces_required_before + if isinstance(spaces_required_before, list): + assert token.is_comment, token + + # If here, we are looking at a comment token that appears on a line + # with other tokens (but because it is a comment, it is always the last + # token). Rather than specifying the actual number of spaces here, + # hard code a value of 0 and then set it later. This logic only works + # because this comment token is guaranteed to be the last token in the + # list. + spaces_required_before = 0 + + token.total_length = prev_length + tok_len + spaces_required_before + + # The split penalty has to be computed before {must|can}_break_before, + # because these may use it for their decision. + token.split_penalty += _SplitPenalty(prev_token, token) + token.must_break_before = _MustBreakBefore(prev_token, token) + token.can_break_before = ( + token.must_break_before or _CanBreakBefore(prev_token, token)) + + prev_length = token.total_length + prev_token = token + + def Split(self): + """Split the line at semicolons.""" + if not self.has_semicolon or self.disable: + return [self] + + uwlines = [] + uwline = UnwrappedLine(self.depth) + for tok in self._tokens: + if tok.value == ';': + uwlines.append(uwline) + uwline = UnwrappedLine(self.depth) + else: + uwline.AppendToken(tok) + + if uwline.tokens: + uwlines.append(uwline) + + for uwline in uwlines: + pytree_utils.SetNodeAnnotation(uwline.first.node, + pytree_utils.Annotation.MUST_SPLIT, True) + uwline.first.previous_token = None + uwline.last.next_token = None + + return uwlines + + ############################################################################ + # Token Access and Manipulation Methods # + ############################################################################ + + def AppendToken(self, token): + """Append a new FormatToken to the tokens contained in this line.""" + if self._tokens: + token.previous_token = self.last + self.last.next_token = token + self._tokens.append(token) + + def AppendNode(self, node): + """Convenience method to append a pytree node directly. + + Wraps the node with a FormatToken. + + Arguments: + node: the node to append + """ + self.AppendToken(format_token.FormatToken(node)) + + @property + def first(self): + """Returns the first non-whitespace token.""" + return self._tokens[0] + + @property + def last(self): + """Returns the last non-whitespace token.""" + return self._tokens[-1] + + ############################################################################ + # Token -> String Methods # + ############################################################################ + + def AsCode(self, indent_per_depth=2): + """Return a "code" representation of this line. + + The code representation shows how the line would be printed out as code. + + TODO(eliben): for now this is rudimentary for debugging - once we add + formatting capabilities, this method will have other uses (not all tokens + have spaces around them, for example). + + Arguments: + indent_per_depth: how much spaces to indend per depth level. + + Returns: + A string representing the line as code. + """ + indent = ' ' * indent_per_depth * self.depth + tokens_str = ' '.join(tok.value for tok in self._tokens) + return indent + tokens_str + + def __str__(self): # pragma: no cover + return self.AsCode() + + def __repr__(self): # pragma: no cover + tokens_repr = ','.join( + ['{0}({1!r})'.format(tok.name, tok.value) for tok in self._tokens]) + return 'UnwrappedLine(depth={0}, tokens=[{1}])'.format( + self.depth, tokens_repr) + + ############################################################################ + # Properties # + ############################################################################ + + @property + def tokens(self): + """Access the tokens contained within this line. + + The caller must not modify the tokens list returned by this method. + + Returns: + List of tokens in this line. + """ + return self._tokens + + @property + def lineno(self): + """Return the line number of this unwrapped line. + + Returns: + The line number of the first token in this unwrapped line. + """ + return self.first.lineno + + @property + def is_comment(self): + return self.first.is_comment + + @property + def has_semicolon(self): + return any(tok.value == ';' for tok in self._tokens) + + +def _IsIdNumberStringToken(tok): + return tok.is_keyword or tok.is_name or tok.is_number or tok.is_string + + +def _IsUnaryOperator(tok): + return format_token.Subtype.UNARY_OPERATOR in tok.subtypes + + +def _HasPrecedence(tok): + """Whether a binary operation has precedence within its context.""" + node = tok.node + + # We let ancestor be the statement surrounding the operation that tok is the + # operator in. + ancestor = node.parent.parent + + while ancestor is not None: + # Search through the ancestor nodes in the parse tree for operators with + # lower precedence. + predecessor_type = pytree_utils.NodeName(ancestor) + if predecessor_type in ['arith_expr', 'term']: + # An ancestor "arith_expr" or "term" means we have found an operator + # with lower precedence than our tok. + return True + if predecessor_type != 'atom': + # We understand the context to look for precedence within as an + # arbitrary nesting of "arith_expr", "term", and "atom" nodes. If we + # leave this context we have not found a lower precedence operator. + return False + # Under normal usage we expect a complete parse tree to be available and + # we will return before we get an AttributeError from the root. + ancestor = ancestor.parent + + +def _PriorityIndicatingNoSpace(tok): + """Whether to remove spaces around an operator due to precedence.""" + if not tok.is_arithmetic_op or not tok.is_simple_expr: + # Limit space removal to highest priority arithmetic operators + return False + return _HasPrecedence(tok) + + +def _IsSubscriptColonAndValuePair(token1, token2): + return (token1.is_number or token1.is_name) and token2.is_subscript_colon + + +def _SpaceRequiredBetween(left, right, is_line_disabled): + """Return True if a space is required between the left and right token.""" + lval = left.value + rval = right.value + if (left.is_pseudo_paren and _IsIdNumberStringToken(right) and + left.previous_token and _IsIdNumberStringToken(left.previous_token)): + # Space between keyword... tokens and pseudo parens. + return True + if left.is_pseudo_paren or right.is_pseudo_paren: + # There should be a space after the ':' in a dictionary. + if left.OpensScope(): + return True + # The closing pseudo-paren shouldn't affect spacing. + return False + if left.is_continuation or right.is_continuation: + # The continuation node's value has all of the spaces it needs. + return False + if right.name in pytree_utils.NONSEMANTIC_TOKENS: + # No space before a non-semantic token. + return False + if _IsIdNumberStringToken(left) and _IsIdNumberStringToken(right): + # Spaces between keyword, string, number, and identifier tokens. + return True + if lval == ',' and rval == ':': + # We do want a space between a comma and colon. + return True + if style.Get('SPACE_INSIDE_BRACKETS'): + # Supersede the "no space before a colon or comma" check. + if lval in pytree_utils.OPENING_BRACKETS and rval == ':': + return True + if rval in pytree_utils.CLOSING_BRACKETS and lval == ':': + return True + if (style.Get('SPACES_AROUND_SUBSCRIPT_COLON') and + (_IsSubscriptColonAndValuePair(left, right) or + _IsSubscriptColonAndValuePair(right, left))): + # Supersede the "never want a space before a colon or comma" check. + return True + if rval in ':,': + # Otherwise, we never want a space before a colon or comma. + return False + if lval == ',' and rval in ']})': + # Add a space between ending ',' and closing bracket if requested. + return style.Get('SPACE_BETWEEN_ENDING_COMMA_AND_CLOSING_BRACKET') + if lval == ',': + # We want a space after a comma. + return True + if lval == 'from' and rval == '.': + # Space before the '.' in an import statement. + return True + if lval == '.' and rval == 'import': + # Space after the '.' in an import statement. + return True + if (lval == '=' and rval == '.' and + format_token.Subtype.DEFAULT_OR_NAMED_ASSIGN not in left.subtypes): + # Space between equal and '.' as in "X = ...". + return True + if ((right.is_keyword or right.is_name) and + (left.is_keyword or left.is_name)): + # Don't merge two keywords/identifiers. + return True + if (format_token.Subtype.SUBSCRIPT_COLON in left.subtypes or + format_token.Subtype.SUBSCRIPT_COLON in right.subtypes): + # A subscript shouldn't have spaces separating its colons. + return False + if (format_token.Subtype.TYPED_NAME in left.subtypes or + format_token.Subtype.TYPED_NAME in right.subtypes): + # A typed argument should have a space after the colon. + return True + if left.is_string: + if (rval == '=' and format_token.Subtype.DEFAULT_OR_NAMED_ASSIGN_ARG_LIST + in right.subtypes): + # If there is a type hint, then we don't want to add a space between the + # equal sign and the hint. + return False + if rval not in '[)]}.' and not right.is_binary_op: + # A string followed by something other than a subscript, closing bracket, + # dot, or a binary op should have a space after it. + return True + if rval in pytree_utils.CLOSING_BRACKETS: + # A string followed by closing brackets should have a space after it + # depending on SPACE_INSIDE_BRACKETS. A string followed by opening + # brackets, however, should not. + return style.Get('SPACE_INSIDE_BRACKETS') + if format_token.Subtype.SUBSCRIPT_BRACKET in right.subtypes: + # It's legal to do this in Python: 'hello'[a] + return False + if left.is_binary_op and lval != '**' and _IsUnaryOperator(right): + # Space between the binary operator and the unary operator. + return True + if left.is_keyword and _IsUnaryOperator(right): + # Handle things like "not -3 < x". + return True + if _IsUnaryOperator(left) and _IsUnaryOperator(right): + # No space between two unary operators. + return False + if left.is_binary_op or right.is_binary_op: + if lval == '**' or rval == '**': + # Space around the "power" operator. + return style.Get('SPACES_AROUND_POWER_OPERATOR') + # Enforce spaces around binary operators except the blocked ones. + block_list = style.Get('NO_SPACES_AROUND_SELECTED_BINARY_OPERATORS') + if lval in block_list or rval in block_list: + return False + if style.Get('ARITHMETIC_PRECEDENCE_INDICATION'): + if _PriorityIndicatingNoSpace(left) or _PriorityIndicatingNoSpace(right): + return False + else: + return True + else: + return True + if (_IsUnaryOperator(left) and lval != 'not' and + (right.is_name or right.is_number or rval == '(')): + # The previous token was a unary op. No space is desired between it and + # the current token. + return False + if (format_token.Subtype.DEFAULT_OR_NAMED_ASSIGN in left.subtypes and + format_token.Subtype.TYPED_NAME not in right.subtypes): + # A named argument or default parameter shouldn't have spaces around it. + return style.Get('SPACES_AROUND_DEFAULT_OR_NAMED_ASSIGN') + if (format_token.Subtype.DEFAULT_OR_NAMED_ASSIGN in right.subtypes and + format_token.Subtype.TYPED_NAME not in left.subtypes): + # A named argument or default parameter shouldn't have spaces around it. + return style.Get('SPACES_AROUND_DEFAULT_OR_NAMED_ASSIGN') + if (format_token.Subtype.VARARGS_LIST in left.subtypes or + format_token.Subtype.VARARGS_LIST in right.subtypes): + return False + if (format_token.Subtype.VARARGS_STAR in left.subtypes or + format_token.Subtype.KWARGS_STAR_STAR in left.subtypes): + # Don't add a space after a vararg's star or a keyword's star-star. + return False + if lval == '@' and format_token.Subtype.DECORATOR in left.subtypes: + # Decorators shouldn't be separated from the 'at' sign. + return False + if left.is_keyword and rval == '.': + # Add space between keywords and dots. + return lval != 'None' and lval != 'print' + if lval == '.' and right.is_keyword: + # Add space between keywords and dots. + return rval != 'None' and rval != 'print' + if lval == '.' or rval == '.': + # Don't place spaces between dots. + return False + if ((lval == '(' and rval == ')') or (lval == '[' and rval == ']') or + (lval == '{' and rval == '}')): + # Empty objects shouldn't be separated by spaces. + return False + if not is_line_disabled and (left.OpensScope() or right.ClosesScope()): + if (style.GetOrDefault('SPACES_AROUND_DICT_DELIMITERS', False) and ( + (lval == '{' and _IsDictListTupleDelimiterTok(left, is_opening=True)) or + (rval == '}' and + _IsDictListTupleDelimiterTok(right, is_opening=False)))): + return True + if (style.GetOrDefault('SPACES_AROUND_LIST_DELIMITERS', False) and ( + (lval == '[' and _IsDictListTupleDelimiterTok(left, is_opening=True)) or + (rval == ']' and + _IsDictListTupleDelimiterTok(right, is_opening=False)))): + return True + if (style.GetOrDefault('SPACES_AROUND_TUPLE_DELIMITERS', False) and ( + (lval == '(' and _IsDictListTupleDelimiterTok(left, is_opening=True)) or + (rval == ')' and + _IsDictListTupleDelimiterTok(right, is_opening=False)))): + return True + if (lval in pytree_utils.OPENING_BRACKETS and + rval in pytree_utils.OPENING_BRACKETS): + # Nested objects' opening brackets shouldn't be separated, unless enabled + # by SPACE_INSIDE_BRACKETS. + return style.Get('SPACE_INSIDE_BRACKETS') + if (lval in pytree_utils.CLOSING_BRACKETS and + rval in pytree_utils.CLOSING_BRACKETS): + # Nested objects' closing brackets shouldn't be separated, unless enabled + # by SPACE_INSIDE_BRACKETS. + return style.Get('SPACE_INSIDE_BRACKETS') + if lval in pytree_utils.CLOSING_BRACKETS and rval in '([': + # A call, set, dictionary, or subscript that has a call or subscript after + # it shouldn't have a space between them. + return False + if lval in pytree_utils.OPENING_BRACKETS and _IsIdNumberStringToken(right): + # Don't separate the opening bracket from the first item, unless enabled + # by SPACE_INSIDE_BRACKETS. + return style.Get('SPACE_INSIDE_BRACKETS') + if left.is_name and rval in '([': + # Don't separate a call or array access from the name. + return False + if rval in pytree_utils.CLOSING_BRACKETS: + # Don't separate the closing bracket from the last item, unless enabled + # by SPACE_INSIDE_BRACKETS. + # FIXME(morbo): This might be too permissive. + return style.Get('SPACE_INSIDE_BRACKETS') + if lval == 'print' and rval == '(': + # Special support for the 'print' function. + return False + if lval in pytree_utils.OPENING_BRACKETS and _IsUnaryOperator(right): + # Don't separate a unary operator from the opening bracket, unless enabled + # by SPACE_INSIDE_BRACKETS. + return style.Get('SPACE_INSIDE_BRACKETS') + if (lval in pytree_utils.OPENING_BRACKETS and + (format_token.Subtype.VARARGS_STAR in right.subtypes or + format_token.Subtype.KWARGS_STAR_STAR in right.subtypes)): + # Don't separate a '*' or '**' from the opening bracket, unless enabled + # by SPACE_INSIDE_BRACKETS. + return style.Get('SPACE_INSIDE_BRACKETS') + if rval == ';': + # Avoid spaces before a semicolon. (Why is there a semicolon?!) + return False + if lval == '(' and rval == 'await': + # Special support for the 'await' keyword. Don't separate the 'await' + # keyword from an opening paren, unless enabled by SPACE_INSIDE_BRACKETS. + return style.Get('SPACE_INSIDE_BRACKETS') + return True + + +def _MustBreakBefore(prev_token, cur_token): + """Return True if a line break is required before the current token.""" + if prev_token.is_comment or (prev_token.previous_token and + prev_token.is_pseudo_paren and + prev_token.previous_token.is_comment): + # Must break if the previous token was a comment. + return True + if (cur_token.is_string and prev_token.is_string and + IsSurroundedByBrackets(cur_token)): + # We want consecutive strings to be on separate lines. This is a + # reasonable assumption, because otherwise they should have written them + # all on the same line, or with a '+'. + return True + return pytree_utils.GetNodeAnnotation( + cur_token.node, pytree_utils.Annotation.MUST_SPLIT, default=False) + + +def _CanBreakBefore(prev_token, cur_token): + """Return True if a line break may occur before the current token.""" + pval = prev_token.value + cval = cur_token.value + if py3compat.PY3: + if pval == 'yield' and cval == 'from': + # Don't break before a yield argument. + return False + if pval in {'async', 'await'} and cval in {'def', 'with', 'for'}: + # Don't break after sync keywords. + return False + if cur_token.split_penalty >= split_penalty.UNBREAKABLE: + return False + if pval == '@': + # Don't break right after the beginning of a decorator. + return False + if cval == ':': + # Don't break before the start of a block of code. + return False + if cval == ',': + # Don't break before a comma. + return False + if prev_token.is_name and cval == '(': + # Don't break in the middle of a function definition or call. + return False + if prev_token.is_name and cval == '[': + # Don't break in the middle of an array dereference. + return False + if cur_token.is_comment and prev_token.lineno == cur_token.lineno: + # Don't break a comment at the end of the line. + return False + if format_token.Subtype.UNARY_OPERATOR in prev_token.subtypes: + # Don't break after a unary token. + return False + if not style.Get('ALLOW_SPLIT_BEFORE_DEFAULT_OR_NAMED_ASSIGNS'): + if (format_token.Subtype.DEFAULT_OR_NAMED_ASSIGN in cur_token.subtypes or + format_token.Subtype.DEFAULT_OR_NAMED_ASSIGN in prev_token.subtypes): + return False + return True + + +def IsSurroundedByBrackets(tok): + """Return True if the token is surrounded by brackets.""" + paren_count = 0 + brace_count = 0 + sq_bracket_count = 0 + previous_token = tok.previous_token + while previous_token: + if previous_token.value == ')': + paren_count -= 1 + elif previous_token.value == '}': + brace_count -= 1 + elif previous_token.value == ']': + sq_bracket_count -= 1 + + if previous_token.value == '(': + if paren_count == 0: + return previous_token + paren_count += 1 + elif previous_token.value == '{': + if brace_count == 0: + return previous_token + brace_count += 1 + elif previous_token.value == '[': + if sq_bracket_count == 0: + return previous_token + sq_bracket_count += 1 + + previous_token = previous_token.previous_token + return None + + +def _IsDictListTupleDelimiterTok(tok, is_opening): + assert tok + + if tok.matching_bracket is None: + return False + + if is_opening: + open_tok = tok + close_tok = tok.matching_bracket + else: + open_tok = tok.matching_bracket + close_tok = tok + + # There must be something in between the tokens + if open_tok.next_token == close_tok: + return False + + assert open_tok.next_token.node + assert open_tok.next_token.node.parent + + return open_tok.next_token.node.parent.type in [ + python_symbols.dictsetmaker, + python_symbols.listmaker, + python_symbols.testlist_gexp, + ] + + +_LOGICAL_OPERATORS = frozenset({'and', 'or'}) +_BITWISE_OPERATORS = frozenset({'&', '|', '^'}) +_ARITHMETIC_OPERATORS = frozenset({'+', '-', '*', '/', '%', '//', '@'}) + + +def _SplitPenalty(prev_token, cur_token): + """Return the penalty for breaking the line before the current token.""" + pval = prev_token.value + cval = cur_token.value + if pval == 'not': + return split_penalty.UNBREAKABLE + + if cur_token.node_split_penalty > 0: + return cur_token.node_split_penalty + + if style.Get('SPLIT_BEFORE_LOGICAL_OPERATOR'): + # Prefer to split before 'and' and 'or'. + if pval in _LOGICAL_OPERATORS: + return style.Get('SPLIT_PENALTY_LOGICAL_OPERATOR') + if cval in _LOGICAL_OPERATORS: + return 0 + else: + # Prefer to split after 'and' and 'or'. + if pval in _LOGICAL_OPERATORS: + return 0 + if cval in _LOGICAL_OPERATORS: + return style.Get('SPLIT_PENALTY_LOGICAL_OPERATOR') + + if style.Get('SPLIT_BEFORE_BITWISE_OPERATOR'): + # Prefer to split before '&', '|', and '^'. + if pval in _BITWISE_OPERATORS: + return style.Get('SPLIT_PENALTY_BITWISE_OPERATOR') + if cval in _BITWISE_OPERATORS: + return 0 + else: + # Prefer to split after '&', '|', and '^'. + if pval in _BITWISE_OPERATORS: + return 0 + if cval in _BITWISE_OPERATORS: + return style.Get('SPLIT_PENALTY_BITWISE_OPERATOR') + + if (format_token.Subtype.COMP_FOR in cur_token.subtypes or + format_token.Subtype.COMP_IF in cur_token.subtypes): + # We don't mind breaking before the 'for' or 'if' of a list comprehension. + return 0 + if format_token.Subtype.UNARY_OPERATOR in prev_token.subtypes: + # Try not to break after a unary operator. + return style.Get('SPLIT_PENALTY_AFTER_UNARY_OPERATOR') + if pval == ',': + # Breaking after a comma is fine, if need be. + return 0 + if pval == '**' or cval == '**': + return split_penalty.STRONGLY_CONNECTED + if (format_token.Subtype.VARARGS_STAR in prev_token.subtypes or + format_token.Subtype.KWARGS_STAR_STAR in prev_token.subtypes): + # Don't split after a varargs * or kwargs **. + return split_penalty.UNBREAKABLE + if prev_token.OpensScope() and cval != '(': + # Slightly prefer + return style.Get('SPLIT_PENALTY_AFTER_OPENING_BRACKET') + if cval == ':': + # Don't split before a colon. + return split_penalty.UNBREAKABLE + if cval == '=': + # Don't split before an assignment. + return split_penalty.UNBREAKABLE + if (format_token.Subtype.DEFAULT_OR_NAMED_ASSIGN in prev_token.subtypes or + format_token.Subtype.DEFAULT_OR_NAMED_ASSIGN in cur_token.subtypes): + # Don't break before or after an default or named assignment. + return split_penalty.UNBREAKABLE + if cval == '==': + # We would rather not split before an equality operator. + return split_penalty.STRONGLY_CONNECTED + if cur_token.ClosesScope(): + # Give a slight penalty for splitting before the closing scope. + return 100 + return 0 diff --git a/.venv/lib/python3.9/site-packages/yapf/yapflib/verifier.py b/.venv/lib/python3.9/site-packages/yapf/yapflib/verifier.py new file mode 100644 index 00000000..bcbe6fb6 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapf/yapflib/verifier.py @@ -0,0 +1,93 @@ +# Copyright 2015 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Verify that the generated code is valid code. + +This takes a line of code and "normalizes" it. I.e., it transforms the snippet +into something that has the potential to compile. + + VerifyCode(): the main function exported by this module. +""" + +import ast +import re +import sys +import textwrap + + +class InternalError(Exception): + """Internal error in verifying formatted code.""" + pass + + +def VerifyCode(code): + """Verify that the reformatted code is syntactically correct. + + Arguments: + code: (unicode) The reformatted code snippet. + + Raises: + SyntaxError if the code was reformatted incorrectly. + """ + try: + compile(textwrap.dedent(code).encode('UTF-8'), '', 'exec') + except SyntaxError: + try: + ast.parse(textwrap.dedent(code.lstrip('\n')).lstrip(), '', 'exec') + except SyntaxError: + try: + normalized_code = _NormalizeCode(code) + compile(normalized_code.encode('UTF-8'), '', 'exec') + except SyntaxError: + raise InternalError(sys.exc_info()[1]) + + +def _NormalizeCode(code): + """Make sure that the code snippet is compilable.""" + code = textwrap.dedent(code.lstrip('\n')).lstrip() + + # Split the code to lines and get rid of all leading full-comment lines as + # they can mess up the normalization attempt. + lines = code.split('\n') + i = 0 + for i, line in enumerate(lines): + line = line.strip() + if line and not line.startswith('#'): + break + code = '\n'.join(lines[i:]) + '\n' + + if re.match(r'(if|while|for|with|def|class|async|await)\b', code): + code += '\n pass' + elif re.match(r'(elif|else)\b', code): + try: + try_code = 'if True:\n pass\n' + code + '\n pass' + ast.parse( + textwrap.dedent(try_code.lstrip('\n')).lstrip(), '', 'exec') + code = try_code + except SyntaxError: + # The assumption here is that the code is on a single line. + code = 'if True: pass\n' + code + elif code.startswith('@'): + code += '\ndef _():\n pass' + elif re.match(r'try\b', code): + code += '\n pass\nexcept:\n pass' + elif re.match(r'(except|finally)\b', code): + code = 'try:\n pass\n' + code + '\n pass' + elif re.match(r'(return|yield)\b', code): + code = 'def _():\n ' + code + elif re.match(r'(continue|break)\b', code): + code = 'while True:\n ' + code + elif re.match(r'print\b', code): + code = 'from __future__ import print_function\n' + code + + return code + '\n' diff --git a/.venv/lib/python3.9/site-packages/yapf/yapflib/yapf_api.py b/.venv/lib/python3.9/site-packages/yapf/yapflib/yapf_api.py new file mode 100644 index 00000000..dde1df93 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapf/yapflib/yapf_api.py @@ -0,0 +1,319 @@ +# Copyright 2015 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Entry points for YAPF. + +The main APIs that YAPF exposes to drive the reformatting. + + FormatFile(): reformat a file. + FormatCode(): reformat a string of code. + +These APIs have some common arguments: + + style_config: (string) Either a style name or a path to a file that contains + formatting style settings. If None is specified, use the default style + as set in style.DEFAULT_STYLE_FACTORY + lines: (list of tuples of integers) A list of tuples of lines, [start, end], + that we want to format. The lines are 1-based indexed. It can be used by + third-party code (e.g., IDEs) when reformatting a snippet of code rather + than a whole file. + print_diff: (bool) Instead of returning the reformatted source, return a + diff that turns the formatted source into reformatter source. + verify: (bool) True if reformatted code should be verified for syntax. +""" + +import difflib +import re +import sys + +from lib2to3.pgen2 import parse + +from yapf.yapflib import blank_line_calculator +from yapf.yapflib import comment_splicer +from yapf.yapflib import continuation_splicer +from yapf.yapflib import file_resources +from yapf.yapflib import identify_container +from yapf.yapflib import py3compat +from yapf.yapflib import pytree_unwrapper +from yapf.yapflib import pytree_utils +from yapf.yapflib import reformatter +from yapf.yapflib import split_penalty +from yapf.yapflib import style +from yapf.yapflib import subtype_assigner + + +def FormatFile(filename, + style_config=None, + lines=None, + print_diff=False, + verify=False, + in_place=False, + logger=None): + """Format a single Python file and return the formatted code. + + Arguments: + filename: (unicode) The file to reformat. + style_config: (string) Either a style name or a path to a file that contains + formatting style settings. If None is specified, use the default style + as set in style.DEFAULT_STYLE_FACTORY + lines: (list of tuples of integers) A list of tuples of lines, [start, end], + that we want to format. The lines are 1-based indexed. It can be used by + third-party code (e.g., IDEs) when reformatting a snippet of code rather + than a whole file. + print_diff: (bool) Instead of returning the reformatted source, return a + diff that turns the formatted source into reformatter source. + verify: (bool) True if reformatted code should be verified for syntax. + in_place: (bool) If True, write the reformatted code back to the file. + logger: (io streamer) A stream to output logging. + + Returns: + Tuple of (reformatted_code, encoding, changed). reformatted_code is None if + the file is successfully written to (having used in_place). reformatted_code + is a diff if print_diff is True. + + Raises: + IOError: raised if there was an error reading the file. + ValueError: raised if in_place and print_diff are both specified. + """ + _CheckPythonVersion() + + if in_place and print_diff: + raise ValueError('Cannot pass both in_place and print_diff.') + + original_source, newline, encoding = ReadFile(filename, logger) + reformatted_source, changed = FormatCode( + original_source, + style_config=style_config, + filename=filename, + lines=lines, + print_diff=print_diff, + verify=verify) + if reformatted_source.rstrip('\n'): + lines = reformatted_source.rstrip('\n').split('\n') + reformatted_source = newline.join(line for line in lines) + newline + if in_place: + if original_source and original_source != reformatted_source: + file_resources.WriteReformattedCode(filename, reformatted_source, + encoding, in_place) + return None, encoding, changed + + return reformatted_source, encoding, changed + + +def FormatCode(unformatted_source, + filename='', + style_config=None, + lines=None, + print_diff=False, + verify=False): + """Format a string of Python code. + + This provides an alternative entry point to YAPF. + + Arguments: + unformatted_source: (unicode) The code to format. + filename: (unicode) The name of the file being reformatted. + style_config: (string) Either a style name or a path to a file that contains + formatting style settings. If None is specified, use the default style + as set in style.DEFAULT_STYLE_FACTORY + lines: (list of tuples of integers) A list of tuples of lines, [start, end], + that we want to format. The lines are 1-based indexed. It can be used by + third-party code (e.g., IDEs) when reformatting a snippet of code rather + than a whole file. + print_diff: (bool) Instead of returning the reformatted source, return a + diff that turns the formatted source into reformatter source. + verify: (bool) True if reformatted code should be verified for syntax. + + Returns: + Tuple of (reformatted_source, changed). reformatted_source conforms to the + desired formatting style. changed is True if the source changed. + """ + _CheckPythonVersion() + style.SetGlobalStyle(style.CreateStyleFromConfig(style_config)) + if not unformatted_source.endswith('\n'): + unformatted_source += '\n' + + try: + tree = pytree_utils.ParseCodeToTree(unformatted_source) + except parse.ParseError as e: + e.msg = filename + ': ' + e.msg + raise + + # Run passes on the tree, modifying it in place. + comment_splicer.SpliceComments(tree) + continuation_splicer.SpliceContinuations(tree) + subtype_assigner.AssignSubtypes(tree) + identify_container.IdentifyContainers(tree) + split_penalty.ComputeSplitPenalties(tree) + blank_line_calculator.CalculateBlankLines(tree) + + uwlines = pytree_unwrapper.UnwrapPyTree(tree) + for uwl in uwlines: + uwl.CalculateFormattingInformation() + + lines = _LineRangesToSet(lines) + _MarkLinesToFormat(uwlines, lines) + reformatted_source = reformatter.Reformat( + _SplitSemicolons(uwlines), verify, lines) + + if unformatted_source == reformatted_source: + return '' if print_diff else reformatted_source, False + + code_diff = _GetUnifiedDiff( + unformatted_source, reformatted_source, filename=filename) + + if print_diff: + return code_diff, code_diff.strip() != '' # pylint: disable=g-explicit-bool-comparison + + return reformatted_source, True + + +def _CheckPythonVersion(): # pragma: no cover + errmsg = 'yapf is only supported for Python 2.7 or 3.4+' + if sys.version_info[0] == 2: + if sys.version_info[1] < 7: + raise RuntimeError(errmsg) + elif sys.version_info[0] == 3: + if sys.version_info[1] < 4: + raise RuntimeError(errmsg) + + +def ReadFile(filename, logger=None): + """Read the contents of the file. + + An optional logger can be specified to emit messages to your favorite logging + stream. If specified, then no exception is raised. This is external so that it + can be used by third-party applications. + + Arguments: + filename: (unicode) The name of the file. + logger: (function) A function or lambda that takes a string and emits it. + + Returns: + The contents of filename. + + Raises: + IOError: raised if there was an error reading the file. + """ + try: + encoding = file_resources.FileEncoding(filename) + + # Preserves line endings. + with py3compat.open_with_encoding( + filename, mode='r', encoding=encoding, newline='') as fd: + lines = fd.readlines() + + line_ending = file_resources.LineEnding(lines) + source = '\n'.join(line.rstrip('\r\n') for line in lines) + '\n' + return source, line_ending, encoding + except IOError as err: # pragma: no cover + if logger: + logger(err) + raise + except UnicodeDecodeError as err: # pragma: no cover + if logger: + logger('Could not parse %s! Consider excluding this file with --exclude.', + filename) + logger(err) + raise + + +def _SplitSemicolons(uwlines): + res = [] + for uwline in uwlines: + res.extend(uwline.Split()) + return res + + +DISABLE_PATTERN = r'^#.*\byapf:\s*disable\b' +ENABLE_PATTERN = r'^#.*\byapf:\s*enable\b' + + +def _LineRangesToSet(line_ranges): + """Return a set of lines in the range.""" + + if line_ranges is None: + return None + + line_set = set() + for low, high in sorted(line_ranges): + line_set.update(range(low, high + 1)) + + return line_set + + +def _MarkLinesToFormat(uwlines, lines): + """Skip sections of code that we shouldn't reformat.""" + if lines: + for uwline in uwlines: + uwline.disable = not lines.intersection( + range(uwline.lineno, uwline.last.lineno + 1)) + + # Now go through the lines and disable any lines explicitly marked as + # disabled. + index = 0 + while index < len(uwlines): + uwline = uwlines[index] + if uwline.is_comment: + if _DisableYAPF(uwline.first.value.strip()): + index += 1 + while index < len(uwlines): + uwline = uwlines[index] + if uwline.is_comment and _EnableYAPF(uwline.first.value.strip()): + if not re.search(DISABLE_PATTERN, + uwline.first.value.strip().split('\n')[-1].strip(), + re.IGNORECASE): + break + uwline.disable = True + index += 1 + elif re.search(DISABLE_PATTERN, uwline.last.value.strip(), re.IGNORECASE): + uwline.disable = True + index += 1 + + +def _DisableYAPF(line): + return (re.search(DISABLE_PATTERN, + line.split('\n')[0].strip(), re.IGNORECASE) or + re.search(DISABLE_PATTERN, + line.split('\n')[-1].strip(), re.IGNORECASE)) + + +def _EnableYAPF(line): + return (re.search(ENABLE_PATTERN, + line.split('\n')[0].strip(), re.IGNORECASE) or + re.search(ENABLE_PATTERN, + line.split('\n')[-1].strip(), re.IGNORECASE)) + + +def _GetUnifiedDiff(before, after, filename='code'): + """Get a unified diff of the changes. + + Arguments: + before: (unicode) The original source code. + after: (unicode) The reformatted source code. + filename: (unicode) The code's filename. + + Returns: + The unified diff text. + """ + before = before.splitlines() + after = after.splitlines() + return '\n'.join( + difflib.unified_diff( + before, + after, + filename, + filename, + '(original)', + '(reformatted)', + lineterm='')) + '\n' diff --git a/.venv/lib/python3.9/site-packages/yapftests/__init__.py b/.venv/lib/python3.9/site-packages/yapftests/__init__.py new file mode 100644 index 00000000..e7522b2c --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapftests/__init__.py @@ -0,0 +1,13 @@ +# Copyright 2015 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. diff --git a/.venv/lib/python3.9/site-packages/yapftests/__pycache__/__init__.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/__init__.cpython-39.pyc new file mode 100644 index 00000000..362d53e4 Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/__init__.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapftests/__pycache__/blank_line_calculator_test.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/blank_line_calculator_test.cpython-39.pyc new file mode 100644 index 00000000..b3f27d3c Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/blank_line_calculator_test.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapftests/__pycache__/comment_splicer_test.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/comment_splicer_test.cpython-39.pyc new file mode 100644 index 00000000..e04cf1be Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/comment_splicer_test.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapftests/__pycache__/file_resources_test.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/file_resources_test.cpython-39.pyc new file mode 100644 index 00000000..eb22b22d Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/file_resources_test.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapftests/__pycache__/format_decision_state_test.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/format_decision_state_test.cpython-39.pyc new file mode 100644 index 00000000..057cb4c5 Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/format_decision_state_test.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapftests/__pycache__/format_token_test.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/format_token_test.cpython-39.pyc new file mode 100644 index 00000000..c2adda1d Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/format_token_test.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapftests/__pycache__/line_joiner_test.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/line_joiner_test.cpython-39.pyc new file mode 100644 index 00000000..6df57ade Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/line_joiner_test.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapftests/__pycache__/main_test.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/main_test.cpython-39.pyc new file mode 100644 index 00000000..628f5ed4 Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/main_test.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapftests/__pycache__/pytree_unwrapper_test.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/pytree_unwrapper_test.cpython-39.pyc new file mode 100644 index 00000000..46236973 Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/pytree_unwrapper_test.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapftests/__pycache__/pytree_utils_test.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/pytree_utils_test.cpython-39.pyc new file mode 100644 index 00000000..9a72bdc7 Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/pytree_utils_test.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapftests/__pycache__/pytree_visitor_test.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/pytree_visitor_test.cpython-39.pyc new file mode 100644 index 00000000..4d7e894a Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/pytree_visitor_test.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapftests/__pycache__/reformatter_basic_test.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/reformatter_basic_test.cpython-39.pyc new file mode 100644 index 00000000..a4e87f70 Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/reformatter_basic_test.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapftests/__pycache__/reformatter_buganizer_test.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/reformatter_buganizer_test.cpython-39.pyc new file mode 100644 index 00000000..7de76c52 Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/reformatter_buganizer_test.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapftests/__pycache__/reformatter_facebook_test.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/reformatter_facebook_test.cpython-39.pyc new file mode 100644 index 00000000..0b51c00d Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/reformatter_facebook_test.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapftests/__pycache__/reformatter_pep8_test.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/reformatter_pep8_test.cpython-39.pyc new file mode 100644 index 00000000..3f5b681a Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/reformatter_pep8_test.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapftests/__pycache__/reformatter_python3_test.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/reformatter_python3_test.cpython-39.pyc new file mode 100644 index 00000000..62373b89 Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/reformatter_python3_test.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapftests/__pycache__/reformatter_style_config_test.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/reformatter_style_config_test.cpython-39.pyc new file mode 100644 index 00000000..7ed89bef Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/reformatter_style_config_test.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapftests/__pycache__/reformatter_verify_test.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/reformatter_verify_test.cpython-39.pyc new file mode 100644 index 00000000..fc1c1c52 Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/reformatter_verify_test.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapftests/__pycache__/split_penalty_test.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/split_penalty_test.cpython-39.pyc new file mode 100644 index 00000000..7b374ccd Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/split_penalty_test.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapftests/__pycache__/style_test.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/style_test.cpython-39.pyc new file mode 100644 index 00000000..7f6c5c5a Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/style_test.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapftests/__pycache__/subtype_assigner_test.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/subtype_assigner_test.cpython-39.pyc new file mode 100644 index 00000000..759bf83b Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/subtype_assigner_test.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapftests/__pycache__/unwrapped_line_test.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/unwrapped_line_test.cpython-39.pyc new file mode 100644 index 00000000..56838787 Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/unwrapped_line_test.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapftests/__pycache__/utils.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/utils.cpython-39.pyc new file mode 100644 index 00000000..ef95815d Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/utils.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapftests/__pycache__/yapf_test.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/yapf_test.cpython-39.pyc new file mode 100644 index 00000000..c2e63520 Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/yapf_test.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapftests/__pycache__/yapf_test_helper.cpython-39.pyc b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/yapf_test_helper.cpython-39.pyc new file mode 100644 index 00000000..af329f66 Binary files /dev/null and b/.venv/lib/python3.9/site-packages/yapftests/__pycache__/yapf_test_helper.cpython-39.pyc differ diff --git a/.venv/lib/python3.9/site-packages/yapftests/blank_line_calculator_test.py b/.venv/lib/python3.9/site-packages/yapftests/blank_line_calculator_test.py new file mode 100644 index 00000000..1ec0a5e5 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapftests/blank_line_calculator_test.py @@ -0,0 +1,422 @@ +# Copyright 2015 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Tests for yapf.blank_line_calculator.""" + +import textwrap +import unittest + +from yapf.yapflib import reformatter +from yapf.yapflib import style +from yapf.yapflib import yapf_api + +from yapftests import yapf_test_helper + + +class BasicBlankLineCalculatorTest(yapf_test_helper.YAPFTest): + + @classmethod + def setUpClass(cls): + style.SetGlobalStyle(style.CreateYapfStyle()) + + def testDecorators(self): + unformatted_code = textwrap.dedent("""\ + @bork() + + def foo(): + pass + """) + expected_formatted_code = textwrap.dedent("""\ + @bork() + def foo(): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testComplexDecorators(self): + unformatted_code = textwrap.dedent("""\ + import sys + @bork() + + def foo(): + pass + @fork() + + class moo(object): + @bar() + @baz() + + def method(self): + pass + """) + expected_formatted_code = textwrap.dedent("""\ + import sys + + + @bork() + def foo(): + pass + + + @fork() + class moo(object): + + @bar() + @baz() + def method(self): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testCodeAfterFunctionsAndClasses(self): + unformatted_code = textwrap.dedent("""\ + def foo(): + pass + top_level_code = True + class moo(object): + def method_1(self): + pass + ivar_a = 42 + ivar_b = 13 + def method_2(self): + pass + try: + raise Error + except Error as error: + pass + """) + expected_formatted_code = textwrap.dedent("""\ + def foo(): + pass + + + top_level_code = True + + + class moo(object): + + def method_1(self): + pass + + ivar_a = 42 + ivar_b = 13 + + def method_2(self): + pass + + + try: + raise Error + except Error as error: + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testCommentSpacing(self): + unformatted_code = textwrap.dedent("""\ + # This is the first comment + # And it's multiline + + # This is the second comment + + def foo(): + pass + + # multiline before a + # class definition + + # This is the second comment + + class qux(object): + pass + + + # An attached comment. + class bar(object): + '''class docstring''' + # Comment attached to + # function + def foo(self): + '''Another docstring.''' + # Another multiline + # comment + pass + """) + expected_formatted_code = textwrap.dedent("""\ + # This is the first comment + # And it's multiline + + # This is the second comment + + + def foo(): + pass + + + # multiline before a + # class definition + + # This is the second comment + + + class qux(object): + pass + + + # An attached comment. + class bar(object): + '''class docstring''' + + # Comment attached to + # function + def foo(self): + '''Another docstring.''' + # Another multiline + # comment + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testCommentBeforeMethod(self): + code = textwrap.dedent("""\ + class foo(object): + + # pylint: disable=invalid-name + def f(self): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testCommentsBeforeClassDefs(self): + code = textwrap.dedent('''\ + """Test.""" + + # Comment + + + class Foo(object): + pass + ''') + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testCommentsBeforeDecorator(self): + code = textwrap.dedent("""\ + # The @foo operator adds bork to a(). + @foo() + def a(): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + code = textwrap.dedent("""\ + # Hello world + + + @foo() + def a(): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testCommentsAfterDecorator(self): + code = textwrap.dedent("""\ + class _(): + + def _(): + pass + + @pytest.mark.xfail(reason="#709 and #710") + # also + #@pytest.mark.xfail(setuptools.tests.is_ascii, + # reason="https://github.com/pypa/setuptools/issues/706") + def test_unicode_filename_in_sdist(self, sdist_unicode, tmpdir, monkeypatch): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testInnerClasses(self): + unformatted_code = textwrap.dedent("""\ + class DeployAPIClient(object): + class Error(Exception): pass + + class TaskValidationError(Error): pass + + class DeployAPIHTTPError(Error): pass + """) + expected_formatted_code = textwrap.dedent("""\ + class DeployAPIClient(object): + + class Error(Exception): + pass + + class TaskValidationError(Error): + pass + + class DeployAPIHTTPError(Error): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testLinesOnRangeBoundary(self): + unformatted_code = textwrap.dedent(u"""\ + def A(): + pass + + def B(): # 4 + pass # 5 + + def C(): + pass + def D(): # 9 + pass # 10 + def E(): + pass + """) + expected_formatted_code = textwrap.dedent(u"""\ + def A(): + pass + + + def B(): # 4 + pass # 5 + + + def C(): + pass + + + def D(): # 9 + pass # 10 + + + def E(): + pass + """) + code, changed = yapf_api.FormatCode( + unformatted_code, lines=[(4, 5), (9, 10)]) + self.assertCodeEqual(expected_formatted_code, code) + self.assertTrue(changed) + + def testLinesRangeBoundaryNotOutside(self): + unformatted_code = textwrap.dedent(u"""\ + def A(): + pass + + + + def B(): # 6 + pass # 7 + + + + def C(): + pass + """) + expected_formatted_code = textwrap.dedent(u"""\ + def A(): + pass + + + + def B(): # 6 + pass # 7 + + + + def C(): + pass + """) + code, changed = yapf_api.FormatCode(unformatted_code, lines=[(6, 7)]) + self.assertCodeEqual(expected_formatted_code, code) + self.assertFalse(changed) + + def testLinesRangeRemove(self): + unformatted_code = textwrap.dedent(u"""\ + def A(): + pass + + + + def B(): # 6 + pass # 7 + + + + + def C(): + pass + """) + expected_formatted_code = textwrap.dedent(u"""\ + def A(): + pass + + + def B(): # 6 + pass # 7 + + + def C(): + pass + """) + code, changed = yapf_api.FormatCode(unformatted_code, lines=[(5, 9)]) + self.assertCodeEqual(expected_formatted_code, code) + self.assertTrue(changed) + + def testLinesRangeRemoveSome(self): + unformatted_code = textwrap.dedent(u"""\ + def A(): + pass + + + + + def B(): # 7 + pass # 8 + + + + + def C(): + pass + """) + expected_formatted_code = textwrap.dedent(u"""\ + def A(): + pass + + + + def B(): # 7 + pass # 8 + + + + def C(): + pass + """) + code, changed = yapf_api.FormatCode(unformatted_code, lines=[(6, 9)]) + self.assertCodeEqual(expected_formatted_code, code) + self.assertTrue(changed) + + +if __name__ == '__main__': + unittest.main() diff --git a/.venv/lib/python3.9/site-packages/yapftests/comment_splicer_test.py b/.venv/lib/python3.9/site-packages/yapftests/comment_splicer_test.py new file mode 100644 index 00000000..aacc8882 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapftests/comment_splicer_test.py @@ -0,0 +1,334 @@ +# Copyright 2015 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Tests for yapf.comment_splicer.""" + +import textwrap +import unittest + +from yapf.yapflib import comment_splicer +from yapf.yapflib import py3compat +from yapf.yapflib import pytree_utils + + +class CommentSplicerTest(unittest.TestCase): + + def _AssertNodeType(self, expected_type, node): + self.assertEqual(expected_type, pytree_utils.NodeName(node)) + + def _AssertNodeIsComment(self, node, text_in_comment=None): + if pytree_utils.NodeName(node) == 'simple_stmt': + self._AssertNodeType('COMMENT', node.children[0]) + node_value = node.children[0].value + else: + self._AssertNodeType('COMMENT', node) + node_value = node.value + if text_in_comment is not None: + self.assertIn(text_in_comment, node_value) + + def _FindNthChildNamed(self, node, name, n=1): + for i, child in enumerate( + py3compat.ifilter(lambda c: pytree_utils.NodeName(c) == name, + node.pre_order())): + if i == n - 1: + return child + raise RuntimeError('No Nth child for n={0}'.format(n)) + + def testSimpleInline(self): + code = 'foo = 1 # and a comment\n' + tree = pytree_utils.ParseCodeToTree(code) + comment_splicer.SpliceComments(tree) + + expr = tree.children[0].children[0] + # Check that the expected node is still expr_stmt, but now it has 4 children + # (before comment splicing it had 3), the last child being the comment. + self._AssertNodeType('expr_stmt', expr) + self.assertEqual(4, len(expr.children)) + comment_node = expr.children[3] + self._AssertNodeIsComment(comment_node, '# and a comment') + + def testSimpleSeparateLine(self): + code = textwrap.dedent(r''' + foo = 1 + # first comment + bar = 2 + ''') + tree = pytree_utils.ParseCodeToTree(code) + comment_splicer.SpliceComments(tree) + + # The comment should've been added to the root's children (now 4, including + # the ENDMARKER in the end. + self.assertEqual(4, len(tree.children)) + comment_node = tree.children[1] + self._AssertNodeIsComment(comment_node) + + def testTwoLineComment(self): + code = textwrap.dedent(r''' + foo = 1 + # first comment + # second comment + bar = 2 + ''') + tree = pytree_utils.ParseCodeToTree(code) + comment_splicer.SpliceComments(tree) + + # This is similar to the single-line standalone comment. + self.assertEqual(4, len(tree.children)) + self._AssertNodeIsComment(tree.children[1]) + + def testCommentIsFirstChildInCompound(self): + code = textwrap.dedent(r''' + if x: + # a comment + foo = 1 + ''') + tree = pytree_utils.ParseCodeToTree(code) + comment_splicer.SpliceComments(tree) + + # Look into the suite node under the 'if'. We don't care about the NEWLINE + # leaf but the new COMMENT must be a child of the suite and before the + # actual code leaf. + if_suite = tree.children[0].children[3] + self._AssertNodeType('NEWLINE', if_suite.children[0]) + self._AssertNodeIsComment(if_suite.children[1]) + + def testCommentIsLastChildInCompound(self): + code = textwrap.dedent(r''' + if x: + foo = 1 + # a comment + ''') + tree = pytree_utils.ParseCodeToTree(code) + comment_splicer.SpliceComments(tree) + + # Look into the suite node under the 'if'. We don't care about the DEDENT + # leaf but the new COMMENT must be a child of the suite and after the + # actual code leaf. + if_suite = tree.children[0].children[3] + self._AssertNodeType('DEDENT', if_suite.children[-1]) + self._AssertNodeIsComment(if_suite.children[-2]) + + def testInlineAfterSeparateLine(self): + code = textwrap.dedent(r''' + bar = 1 + # line comment + foo = 1 # inline comment + ''') + tree = pytree_utils.ParseCodeToTree(code) + comment_splicer.SpliceComments(tree) + + # The separate line comment should become a child of the root, while + # the inline comment remains within its simple_node. + sep_comment_node = tree.children[1] + self._AssertNodeIsComment(sep_comment_node, '# line comment') + + expr = tree.children[2].children[0] + inline_comment_node = expr.children[-1] + self._AssertNodeIsComment(inline_comment_node, '# inline comment') + + def testSeparateLineAfterInline(self): + code = textwrap.dedent(r''' + bar = 1 + foo = 1 # inline comment + # line comment + ''') + tree = pytree_utils.ParseCodeToTree(code) + comment_splicer.SpliceComments(tree) + + # The separate line comment should become a child of the root, while + # the inline comment remains within its simple_node. + sep_comment_node = tree.children[-2] + self._AssertNodeIsComment(sep_comment_node, '# line comment') + + expr = tree.children[1].children[0] + inline_comment_node = expr.children[-1] + self._AssertNodeIsComment(inline_comment_node, '# inline comment') + + def testCommentBeforeDedent(self): + code = textwrap.dedent(r''' + if bar: + z = 1 + # a comment + j = 2 + ''') + tree = pytree_utils.ParseCodeToTree(code) + comment_splicer.SpliceComments(tree) + + # The comment should go under the tree root, not under the 'if'. + self._AssertNodeIsComment(tree.children[1]) + if_suite = tree.children[0].children[3] + self._AssertNodeType('DEDENT', if_suite.children[-1]) + + def testCommentBeforeDedentTwoLevel(self): + code = textwrap.dedent(r''' + if foo: + if bar: + z = 1 + # a comment + y = 1 + ''') + tree = pytree_utils.ParseCodeToTree(code) + comment_splicer.SpliceComments(tree) + + if_suite = tree.children[0].children[3] + # The comment is in the first if_suite, not the nested if under it. It's + # right before the DEDENT + self._AssertNodeIsComment(if_suite.children[-2]) + self._AssertNodeType('DEDENT', if_suite.children[-1]) + + def testCommentBeforeDedentTwoLevelImproperlyIndented(self): + code = textwrap.dedent(r''' + if foo: + if bar: + z = 1 + # comment 2 + y = 1 + ''') + tree = pytree_utils.ParseCodeToTree(code) + comment_splicer.SpliceComments(tree) + + # The comment here is indented by 3 spaces, which is unlike any of the + # surrounding statement indentation levels. The splicer attaches it to the + # "closest" parent with smaller indentation. + if_suite = tree.children[0].children[3] + # The comment is in the first if_suite, not the nested if under it. It's + # right before the DEDENT + self._AssertNodeIsComment(if_suite.children[-2]) + self._AssertNodeType('DEDENT', if_suite.children[-1]) + + def testCommentBeforeDedentThreeLevel(self): + code = textwrap.dedent(r''' + if foo: + if bar: + z = 1 + # comment 2 + # comment 1 + # comment 0 + j = 2 + ''') + tree = pytree_utils.ParseCodeToTree(code) + comment_splicer.SpliceComments(tree) + + # comment 0 should go under the tree root + self._AssertNodeIsComment(tree.children[1], '# comment 0') + + # comment 1 is in the first if_suite, right before the DEDENT + if_suite_1 = self._FindNthChildNamed(tree, 'suite', n=1) + self._AssertNodeIsComment(if_suite_1.children[-2], '# comment 1') + self._AssertNodeType('DEDENT', if_suite_1.children[-1]) + + # comment 2 is in if_suite nested under the first if suite, + # right before the DEDENT + if_suite_2 = self._FindNthChildNamed(tree, 'suite', n=2) + self._AssertNodeIsComment(if_suite_2.children[-2], '# comment 2') + self._AssertNodeType('DEDENT', if_suite_2.children[-1]) + + def testCommentsInClass(self): + code = textwrap.dedent(r''' + class Foo: + """docstring abc...""" + # top-level comment + def foo(): pass + # another comment + ''') + + tree = pytree_utils.ParseCodeToTree(code) + comment_splicer.SpliceComments(tree) + + class_suite = tree.children[0].children[3] + another_comment = class_suite.children[-2] + self._AssertNodeIsComment(another_comment, '# another') + + # It's OK for the comment to be a child of funcdef, as long as it's + # the first child and thus comes before the 'def'. + funcdef = class_suite.children[3] + toplevel_comment = funcdef.children[0] + self._AssertNodeIsComment(toplevel_comment, '# top-level') + + def testMultipleBlockComments(self): + code = textwrap.dedent(r''' + # Block comment number 1 + + # Block comment number 2 + def f(): + pass + ''') + + tree = pytree_utils.ParseCodeToTree(code) + comment_splicer.SpliceComments(tree) + + funcdef = tree.children[0] + block_comment_1 = funcdef.children[0] + self._AssertNodeIsComment(block_comment_1, '# Block comment number 1') + + block_comment_2 = funcdef.children[1] + self._AssertNodeIsComment(block_comment_2, '# Block comment number 2') + + def testCommentsOnDedents(self): + code = textwrap.dedent(r''' + class Foo(object): + # A comment for qux. + def qux(self): + pass + + # Interim comment. + + def mux(self): + pass + ''') + + tree = pytree_utils.ParseCodeToTree(code) + comment_splicer.SpliceComments(tree) + + classdef = tree.children[0] + class_suite = classdef.children[6] + qux_comment = class_suite.children[1] + self._AssertNodeIsComment(qux_comment, '# A comment for qux.') + + interim_comment = class_suite.children[4] + self._AssertNodeIsComment(interim_comment, '# Interim comment.') + + def testExprComments(self): + code = textwrap.dedent(r''' + foo( # Request fractions of an hour. + 948.0/3600, 20) + ''') + tree = pytree_utils.ParseCodeToTree(code) + comment_splicer.SpliceComments(tree) + + trailer = self._FindNthChildNamed(tree, 'trailer', 1) + comment = trailer.children[1] + self._AssertNodeIsComment(comment, '# Request fractions of an hour.') + + def testMultipleCommentsInOneExpr(self): + code = textwrap.dedent(r''' + foo( # com 1 + 948.0/3600, # com 2 + 20 + 12 # com 3 + ) + ''') + tree = pytree_utils.ParseCodeToTree(code) + comment_splicer.SpliceComments(tree) + + trailer = self._FindNthChildNamed(tree, 'trailer', 1) + self._AssertNodeIsComment(trailer.children[1], '# com 1') + + arglist = self._FindNthChildNamed(tree, 'arglist', 1) + self._AssertNodeIsComment(arglist.children[2], '# com 2') + + arith_expr = self._FindNthChildNamed(tree, 'arith_expr', 1) + self._AssertNodeIsComment(arith_expr.children[-1], '# com 3') + + +if __name__ == '__main__': + unittest.main() diff --git a/.venv/lib/python3.9/site-packages/yapftests/file_resources_test.py b/.venv/lib/python3.9/site-packages/yapftests/file_resources_test.py new file mode 100644 index 00000000..a4b12305 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapftests/file_resources_test.py @@ -0,0 +1,493 @@ +# -*- coding: utf-8 -*- +# Copyright 2015 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Tests for yapf.file_resources.""" + +import contextlib +import os +import shutil +import tempfile +import unittest + +from yapf.yapflib import errors +from yapf.yapflib import file_resources +from yapf.yapflib import py3compat + +from yapftests import utils + + +@contextlib.contextmanager +def _restore_working_dir(): + curdir = os.getcwd() + try: + yield + finally: + os.chdir(curdir) + + +@contextlib.contextmanager +def _exists_mocked_in_module(module, mock_implementation): + unmocked_exists = getattr(module, 'exists') + setattr(module, 'exists', mock_implementation) + try: + yield + finally: + setattr(module, 'exists', unmocked_exists) + + +class GetExcludePatternsForDir(unittest.TestCase): + + def setUp(self): # pylint: disable=g-missing-super-call + self.test_tmpdir = tempfile.mkdtemp() + + def tearDown(self): # pylint: disable=g-missing-super-call + shutil.rmtree(self.test_tmpdir) + + def _make_test_dir(self, name): + fullpath = os.path.normpath(os.path.join(self.test_tmpdir, name)) + os.makedirs(fullpath) + return fullpath + + def test_get_exclude_file_patterns(self): + local_ignore_file = os.path.join(self.test_tmpdir, '.yapfignore') + ignore_patterns = ['temp/**/*.py', 'temp2/*.py'] + with open(local_ignore_file, 'w') as f: + f.writelines('\n'.join(ignore_patterns)) + + self.assertEqual( + sorted(file_resources.GetExcludePatternsForDir(self.test_tmpdir)), + sorted(ignore_patterns)) + + +class GetDefaultStyleForDirTest(unittest.TestCase): + + def setUp(self): # pylint: disable=g-missing-super-call + self.test_tmpdir = tempfile.mkdtemp() + + def tearDown(self): # pylint: disable=g-missing-super-call + shutil.rmtree(self.test_tmpdir) + + def test_no_local_style(self): + test_file = os.path.join(self.test_tmpdir, 'file.py') + style_name = file_resources.GetDefaultStyleForDir(test_file) + self.assertEqual(style_name, 'pep8') + + def test_no_local_style_custom_default(self): + test_file = os.path.join(self.test_tmpdir, 'file.py') + style_name = file_resources.GetDefaultStyleForDir( + test_file, default_style='custom-default') + self.assertEqual(style_name, 'custom-default') + + def test_with_local_style(self): + # Create an empty .style.yapf file in test_tmpdir + style_file = os.path.join(self.test_tmpdir, '.style.yapf') + open(style_file, 'w').close() + + test_filename = os.path.join(self.test_tmpdir, 'file.py') + self.assertEqual(style_file, + file_resources.GetDefaultStyleForDir(test_filename)) + + test_filename = os.path.join(self.test_tmpdir, 'dir1', 'file.py') + self.assertEqual(style_file, + file_resources.GetDefaultStyleForDir(test_filename)) + + def test_setup_config(self): + # An empty setup.cfg file should not be used + setup_config = os.path.join(self.test_tmpdir, 'setup.cfg') + open(setup_config, 'w').close() + + test_dir = os.path.join(self.test_tmpdir, 'dir1') + style_name = file_resources.GetDefaultStyleForDir(test_dir) + self.assertEqual(style_name, 'pep8') + + # One with a '[yapf]' section should be used + with open(setup_config, 'w') as f: + f.write('[yapf]\n') + self.assertEqual(setup_config, + file_resources.GetDefaultStyleForDir(test_dir)) + + def test_pyproject_toml(self): + # An empty pyproject.toml file should not be used + try: + import toml + except ImportError: + return + + pyproject_toml = os.path.join(self.test_tmpdir, 'pyproject.toml') + open(pyproject_toml, 'w').close() + + test_dir = os.path.join(self.test_tmpdir, 'dir1') + style_name = file_resources.GetDefaultStyleForDir(test_dir) + self.assertEqual(style_name, 'pep8') + + # One with a '[tool.yapf]' section should be used + with open(pyproject_toml, 'w') as f: + f.write('[tool.yapf]\n') + self.assertEqual(pyproject_toml, + file_resources.GetDefaultStyleForDir(test_dir)) + + def test_local_style_at_root(self): + # Test behavior of files located on the root, and under root. + rootdir = os.path.abspath(os.path.sep) + test_dir_at_root = os.path.join(rootdir, 'dir1') + test_dir_under_root = os.path.join(rootdir, 'dir1', 'dir2') + + # Fake placing only a style file at the root by mocking `os.path.exists`. + style_file = os.path.join(rootdir, '.style.yapf') + + def mock_exists_implementation(path): + return path == style_file + + with _exists_mocked_in_module(file_resources.os.path, + mock_exists_implementation): + # Both files should find the style file at the root. + default_style_at_root = file_resources.GetDefaultStyleForDir( + test_dir_at_root) + self.assertEqual(style_file, default_style_at_root) + default_style_under_root = file_resources.GetDefaultStyleForDir( + test_dir_under_root) + self.assertEqual(style_file, default_style_under_root) + + +def _touch_files(filenames): + for name in filenames: + open(name, 'a').close() + + +class GetCommandLineFilesTest(unittest.TestCase): + + def setUp(self): # pylint: disable=g-missing-super-call + self.test_tmpdir = tempfile.mkdtemp() + self.old_dir = os.getcwd() + + def tearDown(self): # pylint: disable=g-missing-super-call + os.chdir(self.old_dir) + shutil.rmtree(self.test_tmpdir) + + def _make_test_dir(self, name): + fullpath = os.path.normpath(os.path.join(self.test_tmpdir, name)) + os.makedirs(fullpath) + return fullpath + + def test_find_files_not_dirs(self): + tdir1 = self._make_test_dir('test1') + tdir2 = self._make_test_dir('test2') + file1 = os.path.join(tdir1, 'testfile1.py') + file2 = os.path.join(tdir2, 'testfile2.py') + _touch_files([file1, file2]) + + self.assertEqual( + file_resources.GetCommandLineFiles([file1, file2], + recursive=False, + exclude=None), [file1, file2]) + self.assertEqual( + file_resources.GetCommandLineFiles([file1, file2], + recursive=True, + exclude=None), [file1, file2]) + + def test_nonrecursive_find_in_dir(self): + tdir1 = self._make_test_dir('test1') + tdir2 = self._make_test_dir('test1/foo') + file1 = os.path.join(tdir1, 'testfile1.py') + file2 = os.path.join(tdir2, 'testfile2.py') + _touch_files([file1, file2]) + + self.assertRaises( + errors.YapfError, + file_resources.GetCommandLineFiles, + command_line_file_list=[tdir1], + recursive=False, + exclude=None) + + def test_recursive_find_in_dir(self): + tdir1 = self._make_test_dir('test1') + tdir2 = self._make_test_dir('test2/testinner/') + tdir3 = self._make_test_dir('test3/foo/bar/bas/xxx') + files = [ + os.path.join(tdir1, 'testfile1.py'), + os.path.join(tdir2, 'testfile2.py'), + os.path.join(tdir3, 'testfile3.py'), + ] + _touch_files(files) + + self.assertEqual( + sorted( + file_resources.GetCommandLineFiles([self.test_tmpdir], + recursive=True, + exclude=None)), sorted(files)) + + def test_recursive_find_in_dir_with_exclude(self): + tdir1 = self._make_test_dir('test1') + tdir2 = self._make_test_dir('test2/testinner/') + tdir3 = self._make_test_dir('test3/foo/bar/bas/xxx') + files = [ + os.path.join(tdir1, 'testfile1.py'), + os.path.join(tdir2, 'testfile2.py'), + os.path.join(tdir3, 'testfile3.py'), + ] + _touch_files(files) + + self.assertEqual( + sorted( + file_resources.GetCommandLineFiles([self.test_tmpdir], + recursive=True, + exclude=['*test*3.py'])), + sorted([ + os.path.join(tdir1, 'testfile1.py'), + os.path.join(tdir2, 'testfile2.py'), + ])) + + def test_find_with_excluded_hidden_dirs(self): + tdir1 = self._make_test_dir('.test1') + tdir2 = self._make_test_dir('test_2') + tdir3 = self._make_test_dir('test.3') + files = [ + os.path.join(tdir1, 'testfile1.py'), + os.path.join(tdir2, 'testfile2.py'), + os.path.join(tdir3, 'testfile3.py'), + ] + _touch_files(files) + + actual = file_resources.GetCommandLineFiles([self.test_tmpdir], + recursive=True, + exclude=['*.test1*']) + + self.assertEqual( + sorted(actual), + sorted([ + os.path.join(tdir2, 'testfile2.py'), + os.path.join(tdir3, 'testfile3.py'), + ])) + + def test_find_with_excluded_hidden_dirs_relative(self): + """Test find with excluded hidden dirs. + + A regression test against a specific case where a hidden directory (one + beginning with a period) is being excluded, but it is also an immediate + child of the current directory which has been specified in a relative + manner. + + At its core, the bug has to do with overzelous stripping of "./foo" so that + it removes too much from "./.foo" . + """ + tdir1 = self._make_test_dir('.test1') + tdir2 = self._make_test_dir('test_2') + tdir3 = self._make_test_dir('test.3') + files = [ + os.path.join(tdir1, 'testfile1.py'), + os.path.join(tdir2, 'testfile2.py'), + os.path.join(tdir3, 'testfile3.py'), + ] + _touch_files(files) + + # We must temporarily change the current directory, so that we test against + # patterns like ./.test1/file instead of /tmp/foo/.test1/file + with _restore_working_dir(): + + os.chdir(self.test_tmpdir) + actual = file_resources.GetCommandLineFiles( + [os.path.relpath(self.test_tmpdir)], + recursive=True, + exclude=['*.test1*']) + + self.assertEqual( + sorted(actual), + sorted([ + os.path.join( + os.path.relpath(self.test_tmpdir), os.path.basename(tdir2), + 'testfile2.py'), + os.path.join( + os.path.relpath(self.test_tmpdir), os.path.basename(tdir3), + 'testfile3.py'), + ])) + + def test_find_with_excluded_dirs(self): + tdir1 = self._make_test_dir('test1') + tdir2 = self._make_test_dir('test2/testinner/') + tdir3 = self._make_test_dir('test3/foo/bar/bas/xxx') + files = [ + os.path.join(tdir1, 'testfile1.py'), + os.path.join(tdir2, 'testfile2.py'), + os.path.join(tdir3, 'testfile3.py'), + ] + _touch_files(files) + + os.chdir(self.test_tmpdir) + + found = sorted( + file_resources.GetCommandLineFiles(['test1', 'test2', 'test3'], + recursive=True, + exclude=[ + 'test1', + 'test2/testinner/', + ])) + + self.assertEqual( + found, ['test3/foo/bar/bas/xxx/testfile3.py'.replace("/", os.path.sep)]) + + found = sorted( + file_resources.GetCommandLineFiles(['.'], + recursive=True, + exclude=[ + 'test1', + 'test3', + ])) + + self.assertEqual( + found, ['./test2/testinner/testfile2.py'.replace("/", os.path.sep)]) + + def test_find_with_excluded_current_dir(self): + with self.assertRaises(errors.YapfError): + file_resources.GetCommandLineFiles([], False, exclude=['./z']) + + +class IsPythonFileTest(unittest.TestCase): + + def setUp(self): # pylint: disable=g-missing-super-call + self.test_tmpdir = tempfile.mkdtemp() + + def tearDown(self): # pylint: disable=g-missing-super-call + shutil.rmtree(self.test_tmpdir) + + def test_with_py_extension(self): + file1 = os.path.join(self.test_tmpdir, 'testfile1.py') + self.assertTrue(file_resources.IsPythonFile(file1)) + + def test_empty_without_py_extension(self): + file1 = os.path.join(self.test_tmpdir, 'testfile1') + self.assertFalse(file_resources.IsPythonFile(file1)) + file2 = os.path.join(self.test_tmpdir, 'testfile1.rb') + self.assertFalse(file_resources.IsPythonFile(file2)) + + def test_python_shebang(self): + file1 = os.path.join(self.test_tmpdir, 'testfile1') + with open(file1, 'w') as f: + f.write(u'#!/usr/bin/python\n') + self.assertTrue(file_resources.IsPythonFile(file1)) + + file2 = os.path.join(self.test_tmpdir, 'testfile2.run') + with open(file2, 'w') as f: + f.write(u'#! /bin/python2\n') + self.assertTrue(file_resources.IsPythonFile(file1)) + + def test_with_latin_encoding(self): + file1 = os.path.join(self.test_tmpdir, 'testfile1') + with py3compat.open_with_encoding(file1, mode='w', encoding='latin-1') as f: + f.write(u'#! /bin/python2\n') + self.assertTrue(file_resources.IsPythonFile(file1)) + + def test_with_invalid_encoding(self): + file1 = os.path.join(self.test_tmpdir, 'testfile1') + with open(file1, 'w') as f: + f.write(u'#! /bin/python2\n') + f.write(u'# -*- coding: iso-3-14159 -*-\n') + self.assertFalse(file_resources.IsPythonFile(file1)) + + +class IsIgnoredTest(unittest.TestCase): + + def test_root_path(self): + self.assertTrue(file_resources.IsIgnored('media', ['media'])) + self.assertFalse(file_resources.IsIgnored('media', ['media/*'])) + + def test_sub_path(self): + self.assertTrue(file_resources.IsIgnored('media/a', ['*/a'])) + self.assertTrue(file_resources.IsIgnored('media/b', ['media/*'])) + self.assertTrue(file_resources.IsIgnored('media/b/c', ['*/*/c'])) + + def test_trailing_slash(self): + self.assertTrue(file_resources.IsIgnored('z', ['z'])) + self.assertTrue(file_resources.IsIgnored('z', ['z' + os.path.sep])) + + +class BufferedByteStream(object): + + def __init__(self): + self.stream = py3compat.BytesIO() + + def getvalue(self): # pylint: disable=invalid-name + return self.stream.getvalue().decode('utf-8') + + @property + def buffer(self): + return self.stream + + +class WriteReformattedCodeTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): # pylint: disable=g-missing-super-call + cls.test_tmpdir = tempfile.mkdtemp() + + @classmethod + def tearDownClass(cls): # pylint: disable=g-missing-super-call + shutil.rmtree(cls.test_tmpdir) + + def test_write_to_file(self): + s = u'foobar\n' + with utils.NamedTempFile(dirname=self.test_tmpdir) as (f, fname): + file_resources.WriteReformattedCode( + fname, s, in_place=True, encoding='utf-8') + f.flush() + + with open(fname) as f2: + self.assertEqual(f2.read(), s) + + def test_write_to_stdout(self): + s = u'foobar' + stream = BufferedByteStream() if py3compat.PY3 else py3compat.StringIO() + with utils.stdout_redirector(stream): + file_resources.WriteReformattedCode( + None, s, in_place=False, encoding='utf-8') + self.assertEqual(stream.getvalue(), s) + + def test_write_encoded_to_stdout(self): + s = '\ufeff# -*- coding: utf-8 -*-\nresult = "passed"\n' # pylint: disable=anomalous-unicode-escape-in-string + stream = BufferedByteStream() if py3compat.PY3 else py3compat.StringIO() + with utils.stdout_redirector(stream): + file_resources.WriteReformattedCode( + None, s, in_place=False, encoding='utf-8') + self.assertEqual(stream.getvalue(), s) + + +class LineEndingTest(unittest.TestCase): + + def test_line_ending_linefeed(self): + lines = ['spam\n', 'spam\n'] + actual = file_resources.LineEnding(lines) + self.assertEqual(actual, '\n') + + def test_line_ending_carriage_return(self): + lines = ['spam\r', 'spam\r'] + actual = file_resources.LineEnding(lines) + self.assertEqual(actual, '\r') + + def test_line_ending_combo(self): + lines = ['spam\r\n', 'spam\r\n'] + actual = file_resources.LineEnding(lines) + self.assertEqual(actual, '\r\n') + + def test_line_ending_weighted(self): + lines = [ + 'spam\n', + 'spam\n', + 'spam\r', + 'spam\r\n', + ] + actual = file_resources.LineEnding(lines) + self.assertEqual(actual, '\n') + + +if __name__ == '__main__': + unittest.main() diff --git a/.venv/lib/python3.9/site-packages/yapftests/format_decision_state_test.py b/.venv/lib/python3.9/site-packages/yapftests/format_decision_state_test.py new file mode 100644 index 00000000..39e7e8e0 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapftests/format_decision_state_test.py @@ -0,0 +1,145 @@ +# Copyright 2015 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Tests for yapf.format_decision_state.""" + +import textwrap +import unittest + +from yapf.yapflib import format_decision_state +from yapf.yapflib import pytree_utils +from yapf.yapflib import style +from yapf.yapflib import unwrapped_line + +from yapftests import yapf_test_helper + + +class FormatDecisionStateTest(yapf_test_helper.YAPFTest): + + @classmethod + def setUpClass(cls): + style.SetGlobalStyle(style.CreateYapfStyle()) + + def testSimpleFunctionDefWithNoSplitting(self): + code = textwrap.dedent(r""" + def f(a, b): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + uwline = unwrapped_line.UnwrappedLine(0, _FilterLine(uwlines[0])) + uwline.CalculateFormattingInformation() + + # Add: 'f' + state = format_decision_state.FormatDecisionState(uwline, 0) + state.MoveStateToNextToken() + self.assertEqual('f', state.next_token.value) + self.assertFalse(state.CanSplit(False)) + + # Add: '(' + state.AddTokenToState(False, True) + self.assertEqual('(', state.next_token.value) + self.assertFalse(state.CanSplit(False)) + self.assertFalse(state.MustSplit()) + + # Add: 'a' + state.AddTokenToState(False, True) + self.assertEqual('a', state.next_token.value) + self.assertTrue(state.CanSplit(False)) + self.assertFalse(state.MustSplit()) + + # Add: ',' + state.AddTokenToState(False, True) + self.assertEqual(',', state.next_token.value) + self.assertFalse(state.CanSplit(False)) + self.assertFalse(state.MustSplit()) + + # Add: 'b' + state.AddTokenToState(False, True) + self.assertEqual('b', state.next_token.value) + self.assertTrue(state.CanSplit(False)) + self.assertFalse(state.MustSplit()) + + # Add: ')' + state.AddTokenToState(False, True) + self.assertEqual(')', state.next_token.value) + self.assertTrue(state.CanSplit(False)) + self.assertFalse(state.MustSplit()) + + # Add: ':' + state.AddTokenToState(False, True) + self.assertEqual(':', state.next_token.value) + self.assertFalse(state.CanSplit(False)) + self.assertFalse(state.MustSplit()) + + clone = state.Clone() + self.assertEqual(repr(state), repr(clone)) + + def testSimpleFunctionDefWithSplitting(self): + code = textwrap.dedent(r""" + def f(a, b): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + uwline = unwrapped_line.UnwrappedLine(0, _FilterLine(uwlines[0])) + uwline.CalculateFormattingInformation() + + # Add: 'f' + state = format_decision_state.FormatDecisionState(uwline, 0) + state.MoveStateToNextToken() + self.assertEqual('f', state.next_token.value) + self.assertFalse(state.CanSplit(False)) + + # Add: '(' + state.AddTokenToState(True, True) + self.assertEqual('(', state.next_token.value) + self.assertFalse(state.CanSplit(False)) + + # Add: 'a' + state.AddTokenToState(True, True) + self.assertEqual('a', state.next_token.value) + self.assertTrue(state.CanSplit(False)) + + # Add: ',' + state.AddTokenToState(True, True) + self.assertEqual(',', state.next_token.value) + self.assertFalse(state.CanSplit(False)) + + # Add: 'b' + state.AddTokenToState(True, True) + self.assertEqual('b', state.next_token.value) + self.assertTrue(state.CanSplit(False)) + + # Add: ')' + state.AddTokenToState(True, True) + self.assertEqual(')', state.next_token.value) + self.assertTrue(state.CanSplit(False)) + + # Add: ':' + state.AddTokenToState(True, True) + self.assertEqual(':', state.next_token.value) + self.assertFalse(state.CanSplit(False)) + + clone = state.Clone() + self.assertEqual(repr(state), repr(clone)) + + +def _FilterLine(uwline): + """Filter out nonsemantic tokens from the UnwrappedLines.""" + return [ + ft for ft in uwline.tokens + if ft.name not in pytree_utils.NONSEMANTIC_TOKENS + ] + + +if __name__ == '__main__': + unittest.main() diff --git a/.venv/lib/python3.9/site-packages/yapftests/format_token_test.py b/.venv/lib/python3.9/site-packages/yapftests/format_token_test.py new file mode 100644 index 00000000..b4c71510 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapftests/format_token_test.py @@ -0,0 +1,88 @@ +# Copyright 2015 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Tests for yapf.format_token.""" + +import unittest + +from lib2to3 import pytree +from lib2to3.pgen2 import token + +from yapf.yapflib import format_token + + +class TabbedContinuationAlignPaddingTest(unittest.TestCase): + + def testSpace(self): + align_style = 'SPACE' + + pad = format_token._TabbedContinuationAlignPadding(0, align_style, 2) + self.assertEqual(pad, '') + + pad = format_token._TabbedContinuationAlignPadding(2, align_style, 2) + self.assertEqual(pad, ' ' * 2) + + pad = format_token._TabbedContinuationAlignPadding(5, align_style, 2) + self.assertEqual(pad, ' ' * 5) + + def testFixed(self): + align_style = 'FIXED' + + pad = format_token._TabbedContinuationAlignPadding(0, align_style, 4) + self.assertEqual(pad, '') + + pad = format_token._TabbedContinuationAlignPadding(2, align_style, 4) + self.assertEqual(pad, '\t') + + pad = format_token._TabbedContinuationAlignPadding(5, align_style, 4) + self.assertEqual(pad, '\t' * 2) + + def testVAlignRight(self): + align_style = 'VALIGN-RIGHT' + + pad = format_token._TabbedContinuationAlignPadding(0, align_style, 4) + self.assertEqual(pad, '') + + pad = format_token._TabbedContinuationAlignPadding(2, align_style, 4) + self.assertEqual(pad, '\t') + + pad = format_token._TabbedContinuationAlignPadding(4, align_style, 4) + self.assertEqual(pad, '\t') + + pad = format_token._TabbedContinuationAlignPadding(5, align_style, 4) + self.assertEqual(pad, '\t' * 2) + + +class FormatTokenTest(unittest.TestCase): + + def testSimple(self): + tok = format_token.FormatToken(pytree.Leaf(token.STRING, "'hello world'")) + self.assertEqual("FormatToken(name=STRING, value='hello world', lineno=0)", + str(tok)) + self.assertTrue(tok.is_string) + + tok = format_token.FormatToken(pytree.Leaf(token.COMMENT, '# A comment')) + self.assertEqual('FormatToken(name=COMMENT, value=# A comment, lineno=0)', + str(tok)) + self.assertTrue(tok.is_comment) + + def testIsMultilineString(self): + tok = format_token.FormatToken(pytree.Leaf(token.STRING, '"""hello"""')) + self.assertTrue(tok.is_multiline_string) + + tok = format_token.FormatToken(pytree.Leaf(token.STRING, 'r"""hello"""')) + self.assertTrue(tok.is_multiline_string) + + +if __name__ == '__main__': + unittest.main() diff --git a/.venv/lib/python3.9/site-packages/yapftests/line_joiner_test.py b/.venv/lib/python3.9/site-packages/yapftests/line_joiner_test.py new file mode 100644 index 00000000..6501bc88 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapftests/line_joiner_test.py @@ -0,0 +1,82 @@ +# Copyright 2015 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Tests for yapf.line_joiner.""" + +import textwrap +import unittest + +from yapf.yapflib import line_joiner +from yapf.yapflib import style + +from yapftests import yapf_test_helper + + +class LineJoinerTest(yapf_test_helper.YAPFTest): + + @classmethod + def setUpClass(cls): + style.SetGlobalStyle(style.CreatePEP8Style()) + + def _CheckLineJoining(self, code, join_lines): + """Check that the given UnwrappedLines are joined as expected. + + Arguments: + code: The code to check to see if we can join it. + join_lines: True if we expect the lines to be joined. + """ + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(line_joiner.CanMergeMultipleLines(uwlines), join_lines) + + def testSimpleSingleLineStatement(self): + code = textwrap.dedent(u"""\ + if isinstance(a, int): continue + """) + self._CheckLineJoining(code, join_lines=True) + + def testSimpleMultipleLineStatement(self): + code = textwrap.dedent(u"""\ + if isinstance(b, int): + continue + """) + self._CheckLineJoining(code, join_lines=False) + + def testSimpleMultipleLineComplexStatement(self): + code = textwrap.dedent(u"""\ + if isinstance(c, int): + while True: + continue + """) + self._CheckLineJoining(code, join_lines=False) + + def testSimpleMultipleLineStatementWithComment(self): + code = textwrap.dedent(u"""\ + if isinstance(d, int): continue # We're pleased that d's an int. + """) + self._CheckLineJoining(code, join_lines=True) + + def testSimpleMultipleLineStatementWithLargeIndent(self): + code = textwrap.dedent(u"""\ + if isinstance(e, int): continue + """) + self._CheckLineJoining(code, join_lines=True) + + def testOverColumnLimit(self): + code = textwrap.dedent(u"""\ + if instance(bbbbbbbbbbbbbbbbbbbbbbbbb, int): cccccccccccccccccccccccccc = ddddddddddddddddddddd + """) + self._CheckLineJoining(code, join_lines=False) + + +if __name__ == '__main__': + unittest.main() diff --git a/.venv/lib/python3.9/site-packages/yapftests/main_test.py b/.venv/lib/python3.9/site-packages/yapftests/main_test.py new file mode 100644 index 00000000..94daaaa9 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapftests/main_test.py @@ -0,0 +1,144 @@ +# -*- coding: utf-8 -*- +# Copyright 2015 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Tests for yapf.__init__.main.""" + +from contextlib import contextmanager +import sys +import unittest +import yapf + +from yapf.yapflib import py3compat + + +class IO(object): + """IO is a thin wrapper around StringIO. + + This is strictly to wrap the Python 3 StringIO object so that it can supply a + "buffer" attribute. + """ + + class Buffer(object): + + def __init__(self): + self.string_io = py3compat.StringIO() + + def write(self, s): + if py3compat.PY3 and isinstance(s, bytes): + s = str(s, 'utf-8') + self.string_io.write(s) + + def getvalue(self): + return self.string_io.getvalue() + + def __init__(self): + self.buffer = self.Buffer() + + def write(self, s): + self.buffer.write(s) + + def getvalue(self): + return self.buffer.getvalue() + + +@contextmanager +def captured_output(): + new_out, new_err = IO(), IO() + old_out, old_err = sys.stdout, sys.stderr + try: + sys.stdout, sys.stderr = new_out, new_err + yield sys.stdout, sys.stderr + finally: + sys.stdout, sys.stderr = old_out, old_err + + +@contextmanager +def patched_input(code): + """Monkey patch code as though it were coming from stdin.""" + + def lines(): + for line in code.splitlines(): + yield line + raise EOFError() + + def patch_raw_input(lines=lines()): + return next(lines) + + try: + orig_raw_import = yapf.py3compat.raw_input + yapf.py3compat.raw_input = patch_raw_input + yield + finally: + yapf.py3compat.raw_input = orig_raw_import + + +class RunMainTest(unittest.TestCase): + + def testShouldHandleYapfError(self): + """run_main should handle YapfError and sys.exit(1).""" + expected_message = 'yapf: Input filenames did not match any python files\n' + sys.argv = ['yapf', 'foo.c'] + with captured_output() as (out, err): + with self.assertRaises(SystemExit): + yapf.run_main() + self.assertEqual(out.getvalue(), '') + self.assertEqual(err.getvalue(), expected_message) + + +class MainTest(unittest.TestCase): + + def testNoPythonFilesMatched(self): + with self.assertRaisesRegexp(yapf.errors.YapfError, + 'did not match any python files'): + yapf.main(['yapf', 'foo.c']) + + def testEchoInput(self): + code = 'a = 1\nb = 2\n' + with patched_input(code): + with captured_output() as (out, _): + ret = yapf.main([]) + self.assertEqual(ret, 0) + self.assertEqual(out.getvalue(), code) + + def testEchoInputWithStyle(self): + code = 'def f(a = 1):\n return 2*a\n' + yapf_code = 'def f(a=1):\n return 2 * a\n' + with patched_input(code): + with captured_output() as (out, _): + ret = yapf.main(['-', '--style=yapf']) + self.assertEqual(ret, 0) + self.assertEqual(out.getvalue(), yapf_code) + + def testEchoBadInput(self): + bad_syntax = ' a = 1\n' + with patched_input(bad_syntax): + with captured_output() as (_, _): + with self.assertRaisesRegexp(SyntaxError, 'unexpected indent'): + yapf.main([]) + + def testHelp(self): + with captured_output() as (out, _): + ret = yapf.main(['-', '--style-help', '--style=pep8']) + self.assertEqual(ret, 0) + help_message = out.getvalue() + self.assertIn('indent_width=4', help_message) + self.assertIn('The number of spaces required before a trailing comment.', + help_message) + + def testVersion(self): + with captured_output() as (out, _): + ret = yapf.main(['-', '--version']) + self.assertEqual(ret, 0) + version = 'yapf {}\n'.format(yapf.__version__) + self.assertEqual(version, out.getvalue()) diff --git a/.venv/lib/python3.9/site-packages/yapftests/pytree_unwrapper_test.py b/.venv/lib/python3.9/site-packages/yapftests/pytree_unwrapper_test.py new file mode 100644 index 00000000..f95f3666 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapftests/pytree_unwrapper_test.py @@ -0,0 +1,356 @@ +# Copyright 2015 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Tests for yapf.pytree_unwrapper.""" + +import textwrap +import unittest + +from yapf.yapflib import pytree_utils + +from yapftests import yapf_test_helper + + +class PytreeUnwrapperTest(yapf_test_helper.YAPFTest): + + def _CheckUnwrappedLines(self, uwlines, list_of_expected): + """Check that the given UnwrappedLines match expectations. + + Args: + uwlines: list of UnwrappedLine + list_of_expected: list of (depth, values) pairs. Non-semantic tokens are + filtered out from the expected values. + """ + actual = [] + for uwl in uwlines: + filtered_values = [ + ft.value + for ft in uwl.tokens + if ft.name not in pytree_utils.NONSEMANTIC_TOKENS + ] + actual.append((uwl.depth, filtered_values)) + + self.assertEqual(list_of_expected, actual) + + def testSimpleFileScope(self): + code = textwrap.dedent(r""" + x = 1 + # a comment + y = 2 + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self._CheckUnwrappedLines(uwlines, [ + (0, ['x', '=', '1']), + (0, ['# a comment']), + (0, ['y', '=', '2']), + ]) + + def testSimpleMultilineStatement(self): + code = textwrap.dedent(r""" + y = (1 + + x) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self._CheckUnwrappedLines(uwlines, [ + (0, ['y', '=', '(', '1', '+', 'x', ')']), + ]) + + def testFileScopeWithInlineComment(self): + code = textwrap.dedent(r""" + x = 1 # a comment + y = 2 + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self._CheckUnwrappedLines(uwlines, [ + (0, ['x', '=', '1', '# a comment']), + (0, ['y', '=', '2']), + ]) + + def testSimpleIf(self): + code = textwrap.dedent(r""" + if foo: + x = 1 + y = 2 + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self._CheckUnwrappedLines(uwlines, [ + (0, ['if', 'foo', ':']), + (1, ['x', '=', '1']), + (1, ['y', '=', '2']), + ]) + + def testSimpleIfWithComments(self): + code = textwrap.dedent(r""" + # c1 + if foo: # c2 + x = 1 + y = 2 + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self._CheckUnwrappedLines(uwlines, [ + (0, ['# c1']), + (0, ['if', 'foo', ':', '# c2']), + (1, ['x', '=', '1']), + (1, ['y', '=', '2']), + ]) + + def testIfWithCommentsInside(self): + code = textwrap.dedent(r""" + if foo: + # c1 + x = 1 # c2 + # c3 + y = 2 + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self._CheckUnwrappedLines(uwlines, [ + (0, ['if', 'foo', ':']), + (1, ['# c1']), + (1, ['x', '=', '1', '# c2']), + (1, ['# c3']), + (1, ['y', '=', '2']), + ]) + + def testIfElifElse(self): + code = textwrap.dedent(r""" + if x: + x = 1 # c1 + elif y: # c2 + y = 1 + else: + # c3 + z = 1 + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self._CheckUnwrappedLines(uwlines, [ + (0, ['if', 'x', ':']), + (1, ['x', '=', '1', '# c1']), + (0, ['elif', 'y', ':', '# c2']), + (1, ['y', '=', '1']), + (0, ['else', ':']), + (1, ['# c3']), + (1, ['z', '=', '1']), + ]) + + def testNestedCompoundTwoLevel(self): + code = textwrap.dedent(r""" + if x: + x = 1 # c1 + while t: + # c2 + j = 1 + k = 1 + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self._CheckUnwrappedLines(uwlines, [ + (0, ['if', 'x', ':']), + (1, ['x', '=', '1', '# c1']), + (1, ['while', 't', ':']), + (2, ['# c2']), + (2, ['j', '=', '1']), + (1, ['k', '=', '1']), + ]) + + def testSimpleWhile(self): + code = textwrap.dedent(r""" + while x > 1: # c1 + # c2 + x = 1 + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self._CheckUnwrappedLines(uwlines, [ + (0, ['while', 'x', '>', '1', ':', '# c1']), + (1, ['# c2']), + (1, ['x', '=', '1']), + ]) + + def testSimpleTry(self): + code = textwrap.dedent(r""" + try: + pass + except: + pass + except: + pass + else: + pass + finally: + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self._CheckUnwrappedLines(uwlines, [ + (0, ['try', ':']), + (1, ['pass']), + (0, ['except', ':']), + (1, ['pass']), + (0, ['except', ':']), + (1, ['pass']), + (0, ['else', ':']), + (1, ['pass']), + (0, ['finally', ':']), + (1, ['pass']), + ]) + + def testSimpleFuncdef(self): + code = textwrap.dedent(r""" + def foo(x): # c1 + # c2 + return x + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self._CheckUnwrappedLines(uwlines, [ + (0, ['def', 'foo', '(', 'x', ')', ':', '# c1']), + (1, ['# c2']), + (1, ['return', 'x']), + ]) + + def testTwoFuncDefs(self): + code = textwrap.dedent(r""" + def foo(x): # c1 + # c2 + return x + + def bar(): # c3 + # c4 + return x + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self._CheckUnwrappedLines(uwlines, [ + (0, ['def', 'foo', '(', 'x', ')', ':', '# c1']), + (1, ['# c2']), + (1, ['return', 'x']), + (0, ['def', 'bar', '(', ')', ':', '# c3']), + (1, ['# c4']), + (1, ['return', 'x']), + ]) + + def testSimpleClassDef(self): + code = textwrap.dedent(r""" + class Klass: # c1 + # c2 + p = 1 + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self._CheckUnwrappedLines(uwlines, [ + (0, ['class', 'Klass', ':', '# c1']), + (1, ['# c2']), + (1, ['p', '=', '1']), + ]) + + def testSingleLineStmtInFunc(self): + code = textwrap.dedent(r""" + def f(): return 37 + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self._CheckUnwrappedLines(uwlines, [ + (0, ['def', 'f', '(', ')', ':']), + (1, ['return', '37']), + ]) + + def testMultipleComments(self): + code = textwrap.dedent(r""" + # Comment #1 + + # Comment #2 + def f(): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self._CheckUnwrappedLines(uwlines, [ + (0, ['# Comment #1']), + (0, ['# Comment #2']), + (0, ['def', 'f', '(', ')', ':']), + (1, ['pass']), + ]) + + def testSplitListWithComment(self): + code = textwrap.dedent(r""" + a = [ + 'a', + 'b', + 'c', # hello world + ] + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self._CheckUnwrappedLines(uwlines, [(0, [ + 'a', '=', '[', "'a'", ',', "'b'", ',', "'c'", ',', '# hello world', ']' + ])]) + + +class MatchBracketsTest(yapf_test_helper.YAPFTest): + + def _CheckMatchingBrackets(self, uwlines, list_of_expected): + """Check that the tokens have the expected matching bracket. + + Arguments: + uwlines: list of UnwrappedLine. + list_of_expected: list of (index, index) pairs. The matching brackets at + the indexes need to match. Non-semantic tokens are filtered out from the + expected values. + """ + actual = [] + for uwl in uwlines: + filtered_values = [(ft, ft.matching_bracket) + for ft in uwl.tokens + if ft.name not in pytree_utils.NONSEMANTIC_TOKENS] + if filtered_values: + actual.append(filtered_values) + + for index, bracket_list in enumerate(list_of_expected): + uwline = actual[index] + if not bracket_list: + for value in uwline: + self.assertIsNone(value[1]) + else: + for open_bracket, close_bracket in bracket_list: + self.assertEqual(uwline[open_bracket][0], uwline[close_bracket][1]) + self.assertEqual(uwline[close_bracket][0], uwline[open_bracket][1]) + + def testFunctionDef(self): + code = textwrap.dedent("""\ + def foo(a, b=['w','d'], c=[42, 37]): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self._CheckMatchingBrackets(uwlines, [ + [(2, 20), (7, 11), (15, 19)], + [], + ]) + + def testDecorator(self): + code = textwrap.dedent("""\ + @bar() + def foo(a, b, c): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self._CheckMatchingBrackets(uwlines, [ + [(2, 3)], + [(2, 8)], + [], + ]) + + def testClassDef(self): + code = textwrap.dedent("""\ + class A(B, C, D): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self._CheckMatchingBrackets(uwlines, [ + [(2, 8)], + [], + ]) + + +if __name__ == '__main__': + unittest.main() diff --git a/.venv/lib/python3.9/site-packages/yapftests/pytree_utils_test.py b/.venv/lib/python3.9/site-packages/yapftests/pytree_utils_test.py new file mode 100644 index 00000000..3b9fde7f --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapftests/pytree_utils_test.py @@ -0,0 +1,205 @@ +# Copyright 2015 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Tests for yapf.pytree_utils.""" + +import unittest + +from lib2to3 import pygram +from lib2to3 import pytree +from lib2to3.pgen2 import token + +from yapf.yapflib import pytree_utils + +# More direct access to the symbol->number mapping living within the grammar +# module. +_GRAMMAR_SYMBOL2NUMBER = pygram.python_grammar.symbol2number + +_FOO = 'foo' +_FOO1 = 'foo1' +_FOO2 = 'foo2' +_FOO3 = 'foo3' +_FOO4 = 'foo4' +_FOO5 = 'foo5' + + +class NodeNameTest(unittest.TestCase): + + def testNodeNameForLeaf(self): + leaf = pytree.Leaf(token.LPAR, '(') + self.assertEqual('LPAR', pytree_utils.NodeName(leaf)) + + def testNodeNameForNode(self): + leaf = pytree.Leaf(token.LPAR, '(') + node = pytree.Node(pygram.python_grammar.symbol2number['suite'], [leaf]) + self.assertEqual('suite', pytree_utils.NodeName(node)) + + +class ParseCodeToTreeTest(unittest.TestCase): + + def testParseCodeToTree(self): + # Since ParseCodeToTree is a thin wrapper around underlying lib2to3 + # functionality, only a sanity test here... + tree = pytree_utils.ParseCodeToTree('foo = 2\n') + self.assertEqual('file_input', pytree_utils.NodeName(tree)) + self.assertEqual(2, len(tree.children)) + self.assertEqual('simple_stmt', pytree_utils.NodeName(tree.children[0])) + + def testPrintFunctionToTree(self): + tree = pytree_utils.ParseCodeToTree( + 'print("hello world", file=sys.stderr)\n') + self.assertEqual('file_input', pytree_utils.NodeName(tree)) + self.assertEqual(2, len(tree.children)) + self.assertEqual('simple_stmt', pytree_utils.NodeName(tree.children[0])) + + def testPrintStatementToTree(self): + tree = pytree_utils.ParseCodeToTree('print "hello world"\n') + self.assertEqual('file_input', pytree_utils.NodeName(tree)) + self.assertEqual(2, len(tree.children)) + self.assertEqual('simple_stmt', pytree_utils.NodeName(tree.children[0])) + + def testClassNotLocal(self): + tree = pytree_utils.ParseCodeToTree('class nonlocal: pass\n') + self.assertEqual('file_input', pytree_utils.NodeName(tree)) + self.assertEqual(2, len(tree.children)) + self.assertEqual('classdef', pytree_utils.NodeName(tree.children[0])) + + +class InsertNodesBeforeAfterTest(unittest.TestCase): + + def _BuildSimpleTree(self): + # Builds a simple tree we can play with in the tests. + # The tree looks like this: + # + # suite: + # LPAR + # LPAR + # simple_stmt: + # NAME('foo') + # + lpar1 = pytree.Leaf(token.LPAR, '(') + lpar2 = pytree.Leaf(token.LPAR, '(') + simple_stmt = pytree.Node(_GRAMMAR_SYMBOL2NUMBER['simple_stmt'], + [pytree.Leaf(token.NAME, 'foo')]) + return pytree.Node(_GRAMMAR_SYMBOL2NUMBER['suite'], + [lpar1, lpar2, simple_stmt]) + + def _MakeNewNodeRPAR(self): + return pytree.Leaf(token.RPAR, ')') + + def setUp(self): + self._simple_tree = self._BuildSimpleTree() + + def testInsertNodesBefore(self): + # Insert before simple_stmt and make sure it went to the right place + pytree_utils.InsertNodesBefore([self._MakeNewNodeRPAR()], + self._simple_tree.children[2]) + self.assertEqual(4, len(self._simple_tree.children)) + self.assertEqual('RPAR', + pytree_utils.NodeName(self._simple_tree.children[2])) + self.assertEqual('simple_stmt', + pytree_utils.NodeName(self._simple_tree.children[3])) + + def testInsertNodesBeforeFirstChild(self): + # Insert before the first child of its parent + simple_stmt = self._simple_tree.children[2] + foo_child = simple_stmt.children[0] + pytree_utils.InsertNodesBefore([self._MakeNewNodeRPAR()], foo_child) + self.assertEqual(3, len(self._simple_tree.children)) + self.assertEqual(2, len(simple_stmt.children)) + self.assertEqual('RPAR', pytree_utils.NodeName(simple_stmt.children[0])) + self.assertEqual('NAME', pytree_utils.NodeName(simple_stmt.children[1])) + + def testInsertNodesAfter(self): + # Insert after and make sure it went to the right place + pytree_utils.InsertNodesAfter([self._MakeNewNodeRPAR()], + self._simple_tree.children[2]) + self.assertEqual(4, len(self._simple_tree.children)) + self.assertEqual('simple_stmt', + pytree_utils.NodeName(self._simple_tree.children[2])) + self.assertEqual('RPAR', + pytree_utils.NodeName(self._simple_tree.children[3])) + + def testInsertNodesAfterLastChild(self): + # Insert after the last child of its parent + simple_stmt = self._simple_tree.children[2] + foo_child = simple_stmt.children[0] + pytree_utils.InsertNodesAfter([self._MakeNewNodeRPAR()], foo_child) + self.assertEqual(3, len(self._simple_tree.children)) + self.assertEqual(2, len(simple_stmt.children)) + self.assertEqual('NAME', pytree_utils.NodeName(simple_stmt.children[0])) + self.assertEqual('RPAR', pytree_utils.NodeName(simple_stmt.children[1])) + + def testInsertNodesWhichHasParent(self): + # Try to insert an existing tree node into another place and fail. + with self.assertRaises(RuntimeError): + pytree_utils.InsertNodesAfter([self._simple_tree.children[1]], + self._simple_tree.children[0]) + + +class AnnotationsTest(unittest.TestCase): + + def setUp(self): + self._leaf = pytree.Leaf(token.LPAR, '(') + self._node = pytree.Node(_GRAMMAR_SYMBOL2NUMBER['simple_stmt'], + [pytree.Leaf(token.NAME, 'foo')]) + + def testGetWhenNone(self): + self.assertIsNone(pytree_utils.GetNodeAnnotation(self._leaf, _FOO)) + + def testSetWhenNone(self): + pytree_utils.SetNodeAnnotation(self._leaf, _FOO, 20) + self.assertEqual(pytree_utils.GetNodeAnnotation(self._leaf, _FOO), 20) + + def testSetAgain(self): + pytree_utils.SetNodeAnnotation(self._leaf, _FOO, 20) + self.assertEqual(pytree_utils.GetNodeAnnotation(self._leaf, _FOO), 20) + pytree_utils.SetNodeAnnotation(self._leaf, _FOO, 30) + self.assertEqual(pytree_utils.GetNodeAnnotation(self._leaf, _FOO), 30) + + def testMultiple(self): + pytree_utils.SetNodeAnnotation(self._leaf, _FOO, 20) + pytree_utils.SetNodeAnnotation(self._leaf, _FOO1, 1) + pytree_utils.SetNodeAnnotation(self._leaf, _FOO2, 2) + pytree_utils.SetNodeAnnotation(self._leaf, _FOO3, 3) + pytree_utils.SetNodeAnnotation(self._leaf, _FOO4, 4) + pytree_utils.SetNodeAnnotation(self._leaf, _FOO5, 5) + + self.assertEqual(pytree_utils.GetNodeAnnotation(self._leaf, _FOO), 20) + self.assertEqual(pytree_utils.GetNodeAnnotation(self._leaf, _FOO1), 1) + self.assertEqual(pytree_utils.GetNodeAnnotation(self._leaf, _FOO2), 2) + self.assertEqual(pytree_utils.GetNodeAnnotation(self._leaf, _FOO3), 3) + self.assertEqual(pytree_utils.GetNodeAnnotation(self._leaf, _FOO4), 4) + self.assertEqual(pytree_utils.GetNodeAnnotation(self._leaf, _FOO5), 5) + + def testSubtype(self): + pytree_utils.AppendNodeAnnotation(self._leaf, + pytree_utils.Annotation.SUBTYPE, _FOO) + + self.assertSetEqual( + pytree_utils.GetNodeAnnotation(self._leaf, + pytree_utils.Annotation.SUBTYPE), {_FOO}) + + pytree_utils.RemoveSubtypeAnnotation(self._leaf, _FOO) + + self.assertSetEqual( + pytree_utils.GetNodeAnnotation(self._leaf, + pytree_utils.Annotation.SUBTYPE), set()) + + def testSetOnNode(self): + pytree_utils.SetNodeAnnotation(self._node, _FOO, 20) + self.assertEqual(pytree_utils.GetNodeAnnotation(self._node, _FOO), 20) + + +if __name__ == '__main__': + unittest.main() diff --git a/.venv/lib/python3.9/site-packages/yapftests/pytree_visitor_test.py b/.venv/lib/python3.9/site-packages/yapftests/pytree_visitor_test.py new file mode 100644 index 00000000..1908249d --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapftests/pytree_visitor_test.py @@ -0,0 +1,120 @@ +# Copyright 2015 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Tests for yapf.pytree_visitor.""" + +import unittest + +from yapf.yapflib import py3compat +from yapf.yapflib import pytree_utils +from yapf.yapflib import pytree_visitor + + +class _NodeNameCollector(pytree_visitor.PyTreeVisitor): + """A tree visitor that collects the names of all tree nodes into a list. + + Attributes: + all_node_names: collected list of the names, available when the traversal + is over. + name_node_values: collects a list of NAME leaves (in addition to those going + into all_node_names). + """ + + def __init__(self): + self.all_node_names = [] + self.name_node_values = [] + + def DefaultNodeVisit(self, node): + self.all_node_names.append(pytree_utils.NodeName(node)) + super(_NodeNameCollector, self).DefaultNodeVisit(node) + + def DefaultLeafVisit(self, leaf): + self.all_node_names.append(pytree_utils.NodeName(leaf)) + + def Visit_NAME(self, leaf): + self.name_node_values.append(leaf.value) + self.DefaultLeafVisit(leaf) + + +_VISITOR_TEST_SIMPLE_CODE = r""" +foo = bar +baz = x +""" + +_VISITOR_TEST_NESTED_CODE = r""" +if x: + if y: + return z +""" + + +class PytreeVisitorTest(unittest.TestCase): + + def testCollectAllNodeNamesSimpleCode(self): + tree = pytree_utils.ParseCodeToTree(_VISITOR_TEST_SIMPLE_CODE) + collector = _NodeNameCollector() + collector.Visit(tree) + expected_names = [ + 'file_input', + 'simple_stmt', 'expr_stmt', 'NAME', 'EQUAL', 'NAME', 'NEWLINE', + 'simple_stmt', 'expr_stmt', 'NAME', 'EQUAL', 'NAME', 'NEWLINE', + 'ENDMARKER', + ] # yapf: disable + self.assertEqual(expected_names, collector.all_node_names) + + expected_name_node_values = ['foo', 'bar', 'baz', 'x'] + self.assertEqual(expected_name_node_values, collector.name_node_values) + + def testCollectAllNodeNamesNestedCode(self): + tree = pytree_utils.ParseCodeToTree(_VISITOR_TEST_NESTED_CODE) + collector = _NodeNameCollector() + collector.Visit(tree) + expected_names = [ + 'file_input', + 'if_stmt', 'NAME', 'NAME', 'COLON', + 'suite', 'NEWLINE', + 'INDENT', 'if_stmt', 'NAME', 'NAME', 'COLON', 'suite', 'NEWLINE', + 'INDENT', 'simple_stmt', 'return_stmt', 'NAME', 'NAME', 'NEWLINE', + 'DEDENT', 'DEDENT', 'ENDMARKER', + ] # yapf: disable + self.assertEqual(expected_names, collector.all_node_names) + + expected_name_node_values = ['if', 'x', 'if', 'y', 'return', 'z'] + self.assertEqual(expected_name_node_values, collector.name_node_values) + + def testDumper(self): + # PyTreeDumper is mainly a debugging utility, so only do basic sanity + # checking. + tree = pytree_utils.ParseCodeToTree(_VISITOR_TEST_SIMPLE_CODE) + stream = py3compat.StringIO() + pytree_visitor.PyTreeDumper(target_stream=stream).Visit(tree) + + dump_output = stream.getvalue() + self.assertIn('file_input [3 children]', dump_output) + self.assertIn("NAME(Leaf(NAME, 'foo'))", dump_output) + self.assertIn("EQUAL(Leaf(EQUAL, '='))", dump_output) + + def testDumpPyTree(self): + # Similar sanity checking for the convenience wrapper DumpPyTree + tree = pytree_utils.ParseCodeToTree(_VISITOR_TEST_SIMPLE_CODE) + stream = py3compat.StringIO() + pytree_visitor.DumpPyTree(tree, target_stream=stream) + + dump_output = stream.getvalue() + self.assertIn('file_input [3 children]', dump_output) + self.assertIn("NAME(Leaf(NAME, 'foo'))", dump_output) + self.assertIn("EQUAL(Leaf(EQUAL, '='))", dump_output) + + +if __name__ == '__main__': + unittest.main() diff --git a/.venv/lib/python3.9/site-packages/yapftests/reformatter_basic_test.py b/.venv/lib/python3.9/site-packages/yapftests/reformatter_basic_test.py new file mode 100644 index 00000000..a67e4c47 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapftests/reformatter_basic_test.py @@ -0,0 +1,3140 @@ +# Copyright 2016 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Basic tests for yapf.reformatter.""" + +import textwrap +import unittest + +from yapf.yapflib import py3compat +from yapf.yapflib import reformatter +from yapf.yapflib import style + +from yapftests import yapf_test_helper + + +class BasicReformatterTest(yapf_test_helper.YAPFTest): + + @classmethod + def setUpClass(cls): + style.SetGlobalStyle(style.CreateYapfStyle()) + + def testSplittingAllArgs(self): + style.SetGlobalStyle( + style.CreateStyleFromConfig( + '{split_all_comma_separated_values: true, column_limit: 40}')) + unformatted_code = textwrap.dedent("""\ + responseDict = {"timestamp": timestamp, "someValue": value, "whatever": 120} + """) + expected_formatted_code = textwrap.dedent("""\ + responseDict = { + "timestamp": timestamp, + "someValue": value, + "whatever": 120 + } + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + unformatted_code = textwrap.dedent("""\ + yes = { 'yes': 'no', 'no': 'yes', } + """) + expected_formatted_code = textwrap.dedent("""\ + yes = { + 'yes': 'no', + 'no': 'yes', + } + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + unformatted_code = textwrap.dedent("""\ + def foo(long_arg, really_long_arg, really_really_long_arg, cant_keep_all_these_args): + pass + """) + expected_formatted_code = textwrap.dedent("""\ + def foo(long_arg, + really_long_arg, + really_really_long_arg, + cant_keep_all_these_args): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + unformatted_code = textwrap.dedent("""\ + foo_tuple = [long_arg, really_long_arg, really_really_long_arg, cant_keep_all_these_args] + """) + expected_formatted_code = textwrap.dedent("""\ + foo_tuple = [ + long_arg, + really_long_arg, + really_really_long_arg, + cant_keep_all_these_args + ] + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + unformatted_code = textwrap.dedent("""\ + foo_tuple = [short, arg] + """) + expected_formatted_code = textwrap.dedent("""\ + foo_tuple = [short, arg] + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + # There is a test for split_all_top_level_comma_separated_values, with + # different expected value + unformatted_code = textwrap.dedent("""\ + someLongFunction(this_is_a_very_long_parameter, + abc=(a, this_will_just_fit_xxxxxxx)) + """) + expected_formatted_code = textwrap.dedent("""\ + someLongFunction( + this_is_a_very_long_parameter, + abc=(a, + this_will_just_fit_xxxxxxx)) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testSplittingTopLevelAllArgs(self): + style.SetGlobalStyle( + style.CreateStyleFromConfig( + '{split_all_top_level_comma_separated_values: true, column_limit: 40}' + )) + # Works the same way as split_all_comma_separated_values + unformatted_code = textwrap.dedent("""\ + responseDict = {"timestamp": timestamp, "someValue": value, "whatever": 120} + """) + expected_formatted_code = textwrap.dedent("""\ + responseDict = { + "timestamp": timestamp, + "someValue": value, + "whatever": 120 + } + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + # Works the same way as split_all_comma_separated_values + unformatted_code = textwrap.dedent("""\ + def foo(long_arg, really_long_arg, really_really_long_arg, cant_keep_all_these_args): + pass + """) + expected_formatted_code = textwrap.dedent("""\ + def foo(long_arg, + really_long_arg, + really_really_long_arg, + cant_keep_all_these_args): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + # Works the same way as split_all_comma_separated_values + unformatted_code = textwrap.dedent("""\ + foo_tuple = [long_arg, really_long_arg, really_really_long_arg, cant_keep_all_these_args] + """) + expected_formatted_code = textwrap.dedent("""\ + foo_tuple = [ + long_arg, + really_long_arg, + really_really_long_arg, + cant_keep_all_these_args + ] + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + # Works the same way as split_all_comma_separated_values + unformatted_code = textwrap.dedent("""\ + foo_tuple = [short, arg] + """) + expected_formatted_code = textwrap.dedent("""\ + foo_tuple = [short, arg] + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + # There is a test for split_all_comma_separated_values, with different + # expected value + unformatted_code = textwrap.dedent("""\ + someLongFunction(this_is_a_very_long_parameter, + abc=(a, this_will_just_fit_xxxxxxx)) + """) + expected_formatted_code = textwrap.dedent("""\ + someLongFunction( + this_is_a_very_long_parameter, + abc=(a, this_will_just_fit_xxxxxxx)) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + actual_formatted_code = reformatter.Reformat(uwlines) + self.assertEqual(40, len(actual_formatted_code.splitlines()[-1])) + self.assertCodeEqual(expected_formatted_code, actual_formatted_code) + + unformatted_code = textwrap.dedent("""\ + someLongFunction(this_is_a_very_long_parameter, + abc=(a, this_will_not_fit_xxxxxxxxx)) + """) + expected_formatted_code = textwrap.dedent("""\ + someLongFunction( + this_is_a_very_long_parameter, + abc=(a, + this_will_not_fit_xxxxxxxxx)) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + # Exercise the case where there's no opening bracket (for a, b) + unformatted_code = textwrap.dedent("""\ + a, b = f( + a_very_long_parameter, yet_another_one, and_another) + """) + expected_formatted_code = textwrap.dedent("""\ + a, b = f( + a_very_long_parameter, yet_another_one, and_another) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + # Don't require splitting before comments. + unformatted_code = textwrap.dedent("""\ + KO = { + 'ABC': Abc, # abc + 'DEF': Def, # def + 'LOL': Lol, # wtf + 'GHI': Ghi, + 'JKL': Jkl, + } + """) + expected_formatted_code = textwrap.dedent("""\ + KO = { + 'ABC': Abc, # abc + 'DEF': Def, # def + 'LOL': Lol, # wtf + 'GHI': Ghi, + 'JKL': Jkl, + } + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testSimpleFunctionsWithTrailingComments(self): + unformatted_code = textwrap.dedent("""\ + def g(): # Trailing comment + if (xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0]) == 'aaaaaaaaaaa' and + xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0].mmmmmmmm[0]) == 'bbbbbbb'): + pass + + def f( # Intermediate comment + ): + if (xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0]) == 'aaaaaaaaaaa' and + xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0].mmmmmmmm[0]) == 'bbbbbbb'): + pass + """) + expected_formatted_code = textwrap.dedent("""\ + def g(): # Trailing comment + if (xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0]) == 'aaaaaaaaaaa' and + xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0].mmmmmmmm[0]) == 'bbbbbbb'): + pass + + + def f( # Intermediate comment + ): + if (xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0]) == 'aaaaaaaaaaa' and + xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0].mmmmmmmm[0]) == 'bbbbbbb'): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testBlankLinesBetweenTopLevelImportsAndVariables(self): + unformatted_code = textwrap.dedent("""\ + import foo as bar + VAR = 'baz' + """) + expected_formatted_code = textwrap.dedent("""\ + import foo as bar + + VAR = 'baz' + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + unformatted_code = textwrap.dedent("""\ + import foo as bar + + VAR = 'baz' + """) + expected_formatted_code = textwrap.dedent("""\ + import foo as bar + + + VAR = 'baz' + """) + try: + style.SetGlobalStyle( + style.CreateStyleFromConfig( + '{based_on_style: yapf, blank_lines_between_top_level_imports_and_variables: 2}' + )) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, + reformatter.Reformat(uwlines)) + finally: + style.SetGlobalStyle(style.CreateYapfStyle()) + + unformatted_code = textwrap.dedent("""\ + import foo as bar + # Some comment + """) + expected_formatted_code = textwrap.dedent("""\ + import foo as bar + # Some comment + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + unformatted_code = textwrap.dedent("""\ + import foo as bar + class Baz(): + pass + """) + expected_formatted_code = textwrap.dedent("""\ + import foo as bar + + + class Baz(): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + unformatted_code = textwrap.dedent("""\ + import foo as bar + def foobar(): + pass + """) + expected_formatted_code = textwrap.dedent("""\ + import foo as bar + + + def foobar(): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + unformatted_code = textwrap.dedent("""\ + def foobar(): + from foo import Bar + Bar.baz() + """) + expected_formatted_code = textwrap.dedent("""\ + def foobar(): + from foo import Bar + Bar.baz() + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testBlankLinesAtEndOfFile(self): + unformatted_code = textwrap.dedent("""\ + def foobar(): # foo + pass + + + + """) + expected_formatted_code = textwrap.dedent("""\ + def foobar(): # foo + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + unformatted_code = textwrap.dedent("""\ + x = { 'a':37,'b':42, + + 'c':927} + + """) + expected_formatted_code = textwrap.dedent("""\ + x = {'a': 37, 'b': 42, 'c': 927} + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testIndentBlankLines(self): + unformatted_code = textwrap.dedent("""\ + class foo(object): + + def foobar(self): + + pass + + def barfoo(self, x, y): # bar + + if x: + + return y + + + def bar(): + + return 0 + """) + expected_formatted_code = """\ +class foo(object):\n \n def foobar(self):\n \n pass\n \n def barfoo(self, x, y): # bar\n \n if x:\n \n return y\n\n\ndef bar():\n \n return 0 +""" + + try: + style.SetGlobalStyle( + style.CreateStyleFromConfig( + '{based_on_style: yapf, indent_blank_lines: true}')) + + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, + reformatter.Reformat(uwlines)) + finally: + style.SetGlobalStyle(style.CreateYapfStyle()) + + unformatted_code, expected_formatted_code = (expected_formatted_code, + unformatted_code) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testMultipleUgliness(self): + unformatted_code = textwrap.dedent("""\ + x = { 'a':37,'b':42, + + 'c':927} + + y = 'hello ''world' + z = 'hello '+'world' + a = 'hello {}'.format('world') + class foo ( object ): + def f (self ): + return 37*-+2 + def g(self, x,y=42): + return y + def f ( a ) : + return 37+-+a[42-x : y**3] + """) + expected_formatted_code = textwrap.dedent("""\ + x = {'a': 37, 'b': 42, 'c': 927} + + y = 'hello ' 'world' + z = 'hello ' + 'world' + a = 'hello {}'.format('world') + + + class foo(object): + + def f(self): + return 37 * -+2 + + def g(self, x, y=42): + return y + + + def f(a): + return 37 + -+a[42 - x:y**3] + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testComments(self): + unformatted_code = textwrap.dedent("""\ + class Foo(object): + pass + + # Attached comment + class Bar(object): + pass + + global_assignment = 42 + + # Comment attached to class with decorator. + # Comment attached to class with decorator. + @noop + @noop + class Baz(object): + pass + + # Intermediate comment + + class Qux(object): + pass + """) + expected_formatted_code = textwrap.dedent("""\ + class Foo(object): + pass + + + # Attached comment + class Bar(object): + pass + + + global_assignment = 42 + + + # Comment attached to class with decorator. + # Comment attached to class with decorator. + @noop + @noop + class Baz(object): + pass + + + # Intermediate comment + + + class Qux(object): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testSingleComment(self): + code = textwrap.dedent("""\ + # Thing 1 + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testCommentsWithTrailingSpaces(self): + unformatted_code = textwrap.dedent("""\ + # Thing 1 + # Thing 2 + """) + expected_formatted_code = textwrap.dedent("""\ + # Thing 1 + # Thing 2 + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testCommentsInDataLiteral(self): + code = textwrap.dedent("""\ + def f(): + return collections.OrderedDict({ + # First comment. + 'fnord': 37, + + # Second comment. + # Continuation of second comment. + 'bork': 42, + + # Ending comment. + }) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testEndingWhitespaceAfterSimpleStatement(self): + code = textwrap.dedent("""\ + import foo as bar + # Thing 1 + # Thing 2 + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testDocstrings(self): + unformatted_code = textwrap.dedent('''\ + u"""Module-level docstring.""" + import os + class Foo(object): + + """Class-level docstring.""" + # A comment for qux. + def qux(self): + + + """Function-level docstring. + + A multiline function docstring. + """ + print('hello {}'.format('world')) + return 42 + ''') + expected_formatted_code = textwrap.dedent('''\ + u"""Module-level docstring.""" + import os + + + class Foo(object): + """Class-level docstring.""" + + # A comment for qux. + def qux(self): + """Function-level docstring. + + A multiline function docstring. + """ + print('hello {}'.format('world')) + return 42 + ''') + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testDocstringAndMultilineComment(self): + unformatted_code = textwrap.dedent('''\ + """Hello world""" + # A multiline + # comment + class bar(object): + """class docstring""" + # class multiline + # comment + def foo(self): + """Another docstring.""" + # Another multiline + # comment + pass + ''') + expected_formatted_code = textwrap.dedent('''\ + """Hello world""" + + + # A multiline + # comment + class bar(object): + """class docstring""" + + # class multiline + # comment + def foo(self): + """Another docstring.""" + # Another multiline + # comment + pass + ''') + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testMultilineDocstringAndMultilineComment(self): + unformatted_code = textwrap.dedent('''\ + """Hello world + + RIP Dennis Richie. + """ + # A multiline + # comment + class bar(object): + """class docstring + + A classy class. + """ + # class multiline + # comment + def foo(self): + """Another docstring. + + A functional function. + """ + # Another multiline + # comment + pass + ''') + expected_formatted_code = textwrap.dedent('''\ + """Hello world + + RIP Dennis Richie. + """ + + + # A multiline + # comment + class bar(object): + """class docstring + + A classy class. + """ + + # class multiline + # comment + def foo(self): + """Another docstring. + + A functional function. + """ + # Another multiline + # comment + pass + ''') + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testTupleCommaBeforeLastParen(self): + unformatted_code = textwrap.dedent("""\ + a = ( 1, ) + """) + expected_formatted_code = textwrap.dedent("""\ + a = (1,) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testNoBreakOutsideOfBracket(self): + # FIXME(morbo): How this is formatted is not correct. But it's syntactically + # correct. + unformatted_code = textwrap.dedent("""\ + def f(): + assert port >= minimum, \ +'Unexpected port %d when minimum was %d.' % (port, minimum) + """) + expected_formatted_code = textwrap.dedent("""\ + def f(): + assert port >= minimum, 'Unexpected port %d when minimum was %d.' % (port, + minimum) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testBlankLinesBeforeDecorators(self): + unformatted_code = textwrap.dedent("""\ + @foo() + class A(object): + @bar() + @baz() + def x(self): + pass + """) + expected_formatted_code = textwrap.dedent("""\ + @foo() + class A(object): + + @bar() + @baz() + def x(self): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testCommentBetweenDecorators(self): + unformatted_code = textwrap.dedent("""\ + @foo() + # frob + @bar + def x (self): + pass + """) + expected_formatted_code = textwrap.dedent("""\ + @foo() + # frob + @bar + def x(self): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testListComprehension(self): + unformatted_code = textwrap.dedent("""\ + def given(y): + [k for k in () + if k in y] + """) + expected_formatted_code = textwrap.dedent("""\ + def given(y): + [k for k in () if k in y] + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testListComprehensionPreferOneLine(self): + unformatted_code = textwrap.dedent("""\ + def given(y): + long_variable_name = [ + long_var_name + 1 + for long_var_name in () + if long_var_name == 2] + """) + expected_formatted_code = textwrap.dedent("""\ + def given(y): + long_variable_name = [ + long_var_name + 1 for long_var_name in () if long_var_name == 2 + ] + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testListComprehensionPreferOneLineOverArithmeticSplit(self): + unformatted_code = textwrap.dedent("""\ + def given(used_identifiers): + return (sum(len(identifier) + for identifier in used_identifiers) / len(used_identifiers)) + """) + expected_formatted_code = textwrap.dedent("""\ + def given(used_identifiers): + return (sum(len(identifier) for identifier in used_identifiers) / + len(used_identifiers)) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testListComprehensionPreferThreeLinesForLineWrap(self): + unformatted_code = textwrap.dedent("""\ + def given(y): + long_variable_name = [ + long_var_name + 1 + for long_var_name, number_two in () + if long_var_name == 2 and number_two == 3] + """) + expected_formatted_code = textwrap.dedent("""\ + def given(y): + long_variable_name = [ + long_var_name + 1 + for long_var_name, number_two in () + if long_var_name == 2 and number_two == 3 + ] + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testListComprehensionPreferNoBreakForTrivialExpression(self): + unformatted_code = textwrap.dedent("""\ + def given(y): + long_variable_name = [ + long_var_name + for long_var_name, number_two in () + if long_var_name == 2 and number_two == 3] + """) + expected_formatted_code = textwrap.dedent("""\ + def given(y): + long_variable_name = [ + long_var_name for long_var_name, number_two in () + if long_var_name == 2 and number_two == 3 + ] + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testOpeningAndClosingBrackets(self): + unformatted_code = """\ +foo( (1, ) ) +foo( ( 1, 2, 3 ) ) +foo( ( 1, 2, 3, ) ) +""" + expected_formatted_code = """\ +foo((1,)) +foo((1, 2, 3)) +foo(( + 1, + 2, + 3, +)) +""" + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testSingleLineFunctions(self): + unformatted_code = textwrap.dedent("""\ + def foo(): return 42 + """) + expected_formatted_code = textwrap.dedent("""\ + def foo(): + return 42 + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testNoQueueSeletionInMiddleOfLine(self): + # If the queue isn't properly constructed, then a token in the middle of the + # line may be selected as the one with least penalty. The tokens after that + # one are then splatted at the end of the line with no formatting. + unformatted_code = """\ +find_symbol(node.type) + "< " + " ".join(find_pattern(n) for n in node.child) + " >" +""" + expected_formatted_code = """\ +find_symbol(node.type) + "< " + " ".join( + find_pattern(n) for n in node.child) + " >" +""" + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testNoSpacesBetweenSubscriptsAndCalls(self): + unformatted_code = textwrap.dedent("""\ + aaaaaaaaaa = bbbbbbbb.ccccccccc() [42] (a, 2) + """) + expected_formatted_code = textwrap.dedent("""\ + aaaaaaaaaa = bbbbbbbb.ccccccccc()[42](a, 2) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testNoSpacesBetweenOpeningBracketAndStartingOperator(self): + # Unary operator. + unformatted_code = textwrap.dedent("""\ + aaaaaaaaaa = bbbbbbbb.ccccccccc[ -1 ]( -42 ) + """) + expected_formatted_code = textwrap.dedent("""\ + aaaaaaaaaa = bbbbbbbb.ccccccccc[-1](-42) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + # Varargs and kwargs. + unformatted_code = textwrap.dedent("""\ + aaaaaaaaaa = bbbbbbbb.ccccccccc( *varargs ) + aaaaaaaaaa = bbbbbbbb.ccccccccc( **kwargs ) + """) + expected_formatted_code = textwrap.dedent("""\ + aaaaaaaaaa = bbbbbbbb.ccccccccc(*varargs) + aaaaaaaaaa = bbbbbbbb.ccccccccc(**kwargs) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testMultilineCommentReformatted(self): + unformatted_code = textwrap.dedent("""\ + if True: + # This is a multiline + # comment. + pass + """) + expected_formatted_code = textwrap.dedent("""\ + if True: + # This is a multiline + # comment. + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testDictionaryMakerFormatting(self): + unformatted_code = textwrap.dedent("""\ + _PYTHON_STATEMENTS = frozenset({ + lambda x, y: 'simple_stmt': 'small_stmt', 'expr_stmt': 'print_stmt', 'del_stmt': + 'pass_stmt', lambda: 'break_stmt': 'continue_stmt', 'return_stmt': 'raise_stmt', + 'yield_stmt': 'import_stmt', lambda: 'global_stmt': 'exec_stmt', 'assert_stmt': + 'if_stmt', 'while_stmt': 'for_stmt', + }) + """) + expected_formatted_code = textwrap.dedent("""\ + _PYTHON_STATEMENTS = frozenset({ + lambda x, y: 'simple_stmt': 'small_stmt', + 'expr_stmt': 'print_stmt', + 'del_stmt': 'pass_stmt', + lambda: 'break_stmt': 'continue_stmt', + 'return_stmt': 'raise_stmt', + 'yield_stmt': 'import_stmt', + lambda: 'global_stmt': 'exec_stmt', + 'assert_stmt': 'if_stmt', + 'while_stmt': 'for_stmt', + }) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testSimpleMultilineCode(self): + unformatted_code = textwrap.dedent("""\ + if True: + aaaaaaaaaaaaaa.bbbbbbbbbbbbbb.ccccccc(zzzzzzzzzzzz, \ +xxxxxxxxxxx, yyyyyyyyyyyy, vvvvvvvvv) + aaaaaaaaaaaaaa.bbbbbbbbbbbbbb.ccccccc(zzzzzzzzzzzz, \ +xxxxxxxxxxx, yyyyyyyyyyyy, vvvvvvvvv) + """) + expected_formatted_code = textwrap.dedent("""\ + if True: + aaaaaaaaaaaaaa.bbbbbbbbbbbbbb.ccccccc(zzzzzzzzzzzz, xxxxxxxxxxx, yyyyyyyyyyyy, + vvvvvvvvv) + aaaaaaaaaaaaaa.bbbbbbbbbbbbbb.ccccccc(zzzzzzzzzzzz, xxxxxxxxxxx, yyyyyyyyyyyy, + vvvvvvvvv) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testMultilineComment(self): + code = textwrap.dedent("""\ + if Foo: + # Hello world + # Yo man. + # Yo man. + # Yo man. + # Yo man. + a = 42 + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testSpaceBetweenStringAndParentheses(self): + code = textwrap.dedent("""\ + b = '0' ('hello') + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testMultilineString(self): + code = textwrap.dedent("""\ + code = textwrap.dedent('''\ + if Foo: + # Hello world + # Yo man. + # Yo man. + # Yo man. + # Yo man. + a = 42 + ''') + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + unformatted_code = textwrap.dedent('''\ + def f(): + email_text += """This is a really long docstring that goes over the column limit and is multi-line.

+ Czar: """+despot["Nicholas"]+"""
+ Minion: """+serf["Dmitri"]+"""
+ Residence: """+palace["Winter"]+"""
+ + """ + ''') + expected_formatted_code = textwrap.dedent('''\ + def f(): + email_text += """This is a really long docstring that goes over the column limit and is multi-line.

+ Czar: """ + despot["Nicholas"] + """
+ Minion: """ + serf["Dmitri"] + """
+ Residence: """ + palace["Winter"] + """
+ + """ + ''') + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testSimpleMultilineWithComments(self): + code = textwrap.dedent("""\ + if ( # This is the first comment + a and # This is the second comment + # This is the third comment + b): # A trailing comment + # Whoa! A normal comment!! + pass # Another trailing comment + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testMatchingParenSplittingMatching(self): + unformatted_code = textwrap.dedent("""\ + def f(): + raise RuntimeError('unable to find insertion point for target node', + (target,)) + """) + expected_formatted_code = textwrap.dedent("""\ + def f(): + raise RuntimeError('unable to find insertion point for target node', + (target,)) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testContinuationIndent(self): + unformatted_code = textwrap.dedent('''\ + class F: + def _ProcessArgLists(self, node): + """Common method for processing argument lists.""" + for child in node.children: + if isinstance(child, pytree.Leaf): + self._SetTokenSubtype( + child, subtype=_ARGLIST_TOKEN_TO_SUBTYPE.get( + child.value, format_token.Subtype.NONE)) + ''') + expected_formatted_code = textwrap.dedent('''\ + class F: + + def _ProcessArgLists(self, node): + """Common method for processing argument lists.""" + for child in node.children: + if isinstance(child, pytree.Leaf): + self._SetTokenSubtype( + child, + subtype=_ARGLIST_TOKEN_TO_SUBTYPE.get(child.value, + format_token.Subtype.NONE)) + ''') + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testTrailingCommaAndBracket(self): + unformatted_code = textwrap.dedent('''\ + a = { 42, } + b = ( 42, ) + c = [ 42, ] + ''') + expected_formatted_code = textwrap.dedent('''\ + a = { + 42, + } + b = (42,) + c = [ + 42, + ] + ''') + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testI18n(self): + code = textwrap.dedent("""\ + N_('Some years ago - never mind how long precisely - having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world.') # A comment is here. + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + code = textwrap.dedent("""\ + foo('Fake function call') #. Some years ago - never mind how long precisely - having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world. + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testI18nCommentsInDataLiteral(self): + code = textwrap.dedent("""\ + def f(): + return collections.OrderedDict({ + #. First i18n comment. + 'bork': 'foo', + + #. Second i18n comment. + 'snork': 'bar#.*=\\\\0', + }) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testClosingBracketIndent(self): + code = textwrap.dedent('''\ + def f(): + + def g(): + while (xxxxxxxxxxxxxxxxxxxxx(yyyyyyyyyyyyy[zzzzz]) == 'aaaaaaaaaaa' and + xxxxxxxxxxxxxxxxxxxxx( + yyyyyyyyyyyyy[zzzzz].aaaaaaaa[0]) == 'bbbbbbb'): + pass + ''') + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testClosingBracketsInlinedInCall(self): + unformatted_code = textwrap.dedent("""\ + class Foo(object): + + def bar(self): + self.aaaaaaaa = xxxxxxxxxxxxxxxxxxx.yyyyyyyyyyyyy( + self.cccccc.ddddddddd.eeeeeeee, + options={ + "forkforkfork": 1, + "borkborkbork": 2, + "corkcorkcork": 3, + "horkhorkhork": 4, + "porkporkpork": 5, + }) + """) + expected_formatted_code = textwrap.dedent("""\ + class Foo(object): + + def bar(self): + self.aaaaaaaa = xxxxxxxxxxxxxxxxxxx.yyyyyyyyyyyyy( + self.cccccc.ddddddddd.eeeeeeee, + options={ + "forkforkfork": 1, + "borkborkbork": 2, + "corkcorkcork": 3, + "horkhorkhork": 4, + "porkporkpork": 5, + }) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testLineWrapInForExpression(self): + code = textwrap.dedent("""\ + class A: + + def x(self, node, name, n=1): + for i, child in enumerate( + itertools.ifilter(lambda c: pytree_utils.NodeName(c) == name, + node.pre_order())): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testFunctionCallContinuationLine(self): + code = """\ +class foo: + + def bar(self, node, name, n=1): + if True: + if True: + return [(aaaaaaaaaa, + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb( + cccc, ddddddddddddddddddddddddddddddddddddd))] +""" + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testI18nNonFormatting(self): + code = textwrap.dedent("""\ + class F(object): + + def __init__(self, fieldname, + #. Error message indicating an invalid e-mail address. + message=N_('Please check your email address.'), **kwargs): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testNoSpaceBetweenUnaryOpAndOpeningParen(self): + code = textwrap.dedent("""\ + if ~(a or b): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testCommentBeforeFuncDef(self): + code = textwrap.dedent("""\ + class Foo(object): + + a = 42 + + # This is a comment. + def __init__(self, + xxxxxxx, + yyyyy=0, + zzzzzzz=None, + aaaaaaaaaaaaaaaaaa=False, + bbbbbbbbbbbbbbb=False): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testExcessLineCountWithDefaultKeywords(self): + unformatted_code = textwrap.dedent("""\ + class Fnord(object): + def Moo(self): + aaaaaaaaaaaaaaaa = self._bbbbbbbbbbbbbbbbbbbbbbb( + ccccccccccccc=ccccccccccccc, ddddddd=ddddddd, eeee=eeee, + fffff=fffff, ggggggg=ggggggg, hhhhhhhhhhhhh=hhhhhhhhhhhhh, + iiiiiii=iiiiiiiiiiiiii) + """) + expected_formatted_code = textwrap.dedent("""\ + class Fnord(object): + + def Moo(self): + aaaaaaaaaaaaaaaa = self._bbbbbbbbbbbbbbbbbbbbbbb( + ccccccccccccc=ccccccccccccc, + ddddddd=ddddddd, + eeee=eeee, + fffff=fffff, + ggggggg=ggggggg, + hhhhhhhhhhhhh=hhhhhhhhhhhhh, + iiiiiii=iiiiiiiiiiiiii) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testSpaceAfterNotOperator(self): + code = textwrap.dedent("""\ + if not (this and that): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testNoPenaltySplitting(self): + code = textwrap.dedent("""\ + def f(): + if True: + if True: + python_files.extend( + os.path.join(filename, f) + for f in os.listdir(filename) + if IsPythonFile(os.path.join(filename, f))) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testExpressionPenalties(self): + code = textwrap.dedent("""\ + def f(): + if ((left.value == '(' and right.value == ')') or + (left.value == '[' and right.value == ']') or + (left.value == '{' and right.value == '}')): + return False + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testLineDepthOfSingleLineStatement(self): + unformatted_code = textwrap.dedent("""\ + while True: continue + for x in range(3): continue + try: a = 42 + except: b = 42 + with open(a) as fd: a = fd.read() + """) + expected_formatted_code = textwrap.dedent("""\ + while True: + continue + for x in range(3): + continue + try: + a = 42 + except: + b = 42 + with open(a) as fd: + a = fd.read() + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testSplitListWithTerminatingComma(self): + unformatted_code = textwrap.dedent("""\ + FOO = ['bar', 'baz', 'mux', 'qux', 'quux', 'quuux', 'quuuux', + 'quuuuux', 'quuuuuux', 'quuuuuuux', lambda a, b: 37,] + """) + expected_formatted_code = textwrap.dedent("""\ + FOO = [ + 'bar', + 'baz', + 'mux', + 'qux', + 'quux', + 'quuux', + 'quuuux', + 'quuuuux', + 'quuuuuux', + 'quuuuuuux', + lambda a, b: 37, + ] + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testSplitListWithInterspersedComments(self): + code = textwrap.dedent("""\ + FOO = [ + 'bar', # bar + 'baz', # baz + 'mux', # mux + 'qux', # qux + 'quux', # quux + 'quuux', # quuux + 'quuuux', # quuuux + 'quuuuux', # quuuuux + 'quuuuuux', # quuuuuux + 'quuuuuuux', # quuuuuuux + lambda a, b: 37 # lambda + ] + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testRelativeImportStatements(self): + code = textwrap.dedent("""\ + from ... import bork + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testSingleLineList(self): + # A list on a single line should prefer to remain contiguous. + unformatted_code = textwrap.dedent("""\ + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb = aaaaaaaaaaa( + ("...", "."), "..", + ".............................................." + ) + """) + expected_formatted_code = textwrap.dedent("""\ + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb = aaaaaaaaaaa( + ("...", "."), "..", "..............................................") + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testBlankLinesBeforeFunctionsNotInColumnZero(self): + unformatted_code = textwrap.dedent("""\ + import signal + + + try: + signal.SIGALRM + # .................................................................. + # ............................................................... + + + def timeout(seconds=1): + pass + except: + pass + """) + expected_formatted_code = textwrap.dedent("""\ + import signal + + try: + signal.SIGALRM + + # .................................................................. + # ............................................................... + + + def timeout(seconds=1): + pass + except: + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testNoKeywordArgumentBreakage(self): + code = textwrap.dedent("""\ + class A(object): + + def b(self): + if self.aaaaaaaaaaaaaaaaaaaa not in self.bbbbbbbbbb( + cccccccccccccccccccc=True): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testTrailerOnSingleLine(self): + code = """\ +urlpatterns = patterns('', url(r'^$', 'homepage_view'), + url(r'^/login/$', 'login_view'), + url(r'^/login/$', 'logout_view'), + url(r'^/user/(?P\\w+)/$', 'profile_view')) +""" + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testIfConditionalParens(self): + code = textwrap.dedent("""\ + class Foo: + + def bar(): + if True: + if (child.type == grammar_token.NAME and + child.value in substatement_names): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testContinuationMarkers(self): + code = textwrap.dedent("""\ + text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. "\\ + "Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur "\\ + "ante hendrerit. Donec et mollis dolor. Praesent et diam eget libero egestas mattis "\\ + "sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. "\\ + "Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet" + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + code = textwrap.dedent("""\ + from __future__ import nested_scopes, generators, division, absolute_import, with_statement, \\ + print_function, unicode_literals + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + code = textwrap.dedent("""\ + if aaaaaaaaa == 42 and bbbbbbbbbbbbbb == 42 and \\ + cccccccc == 42: + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testCommentsWithContinuationMarkers(self): + code = textwrap.dedent("""\ + def fn(arg): + v = fn2(key1=True, + #c1 + key2=arg)\\ + .fn3() + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testMultipleContinuationMarkers(self): + code = textwrap.dedent("""\ + xyz = \\ + \\ + some_thing() + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testContinuationMarkerAfterStringWithContinuation(self): + code = """\ +s = 'foo \\ + bar' \\ + .format() +""" + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testEmptyContainers(self): + code = textwrap.dedent("""\ + flags.DEFINE_list( + 'output_dirs', [], + 'Lorem ipsum dolor sit amet, consetetur adipiscing elit. Donec a diam lectus. ' + 'Sed sit amet ipsum mauris. Maecenas congue.') + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testSplitStringsIfSurroundedByParens(self): + unformatted_code = textwrap.dedent("""\ + a = foo.bar({'xxxxxxxxxxxxxxxxxxxxxxx' 'yyyyyyyyyyyyyyyyyyyyyyyyyy': baz[42]} + 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' 'bbbbbbbbbbbbbbbbbbbbbbbbbb' 'cccccccccccccccccccccccccccccccc' 'ddddddddddddddddddddddddddddd') + """) + expected_formatted_code = textwrap.dedent("""\ + a = foo.bar({'xxxxxxxxxxxxxxxxxxxxxxx' + 'yyyyyyyyyyyyyyyyyyyyyyyyyy': baz[42]} + + 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + 'bbbbbbbbbbbbbbbbbbbbbbbbbb' + 'cccccccccccccccccccccccccccccccc' + 'ddddddddddddddddddddddddddddd') + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + code = textwrap.dedent("""\ + a = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' \ +'bbbbbbbbbbbbbbbbbbbbbbbbbb' 'cccccccccccccccccccccccccccccccc' \ +'ddddddddddddddddddddddddddddd' + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testMultilineShebang(self): + code = textwrap.dedent("""\ + #!/bin/sh + if "true" : '''\' + then + + export FOO=123 + exec /usr/bin/env python "$0" "$@" + + exit 127 + fi + ''' + + import os + + assert os.environ['FOO'] == '123' + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testNoSplittingAroundTermOperators(self): + code = textwrap.dedent("""\ + a_very_long_function_call_yada_yada_etc_etc_etc(long_arg1, + long_arg2 / long_arg3) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testNoSplittingWithinSubscriptList(self): + code = textwrap.dedent("""\ + somequitelongvariablename.somemember[(a, b)] = { + 'somelongkey': 1, + 'someotherlongkey': 2 + } + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testExcessCharacters(self): + code = textwrap.dedent("""\ + class foo: + + def bar(self): + self.write(s=[ + '%s%s %s' % ('many of really', 'long strings', '+ just makes up 81') + ]) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + unformatted_code = textwrap.dedent("""\ + def _(): + if True: + if True: + if contract == allow_contract and attr_dict.get(if_attribute) == has_value: + return True + """) + expected_code = textwrap.dedent("""\ + def _(): + if True: + if True: + if contract == allow_contract and attr_dict.get( + if_attribute) == has_value: + return True + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_code, reformatter.Reformat(uwlines)) + + def testDictSetGenerator(self): + code = textwrap.dedent("""\ + foo = { + variable: 'hello world. How are you today?' + for variable in fnord + if variable != 37 + } + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testUnaryOpInDictionaryValue(self): + code = textwrap.dedent("""\ + beta = "123" + + test = {'alpha': beta[-1]} + + print(beta[-1]) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testUnaryNotOperator(self): + code = textwrap.dedent("""\ + if True: + if True: + if True: + if True: + remote_checksum = self.get_checksum(conn, tmp, dest, inject, + not directory_prepended, source) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testRelaxArraySubscriptAffinity(self): + code = """\ +class A(object): + + def f(self, aaaaaaaaa, bbbbbbbbbbbbb, row): + if True: + if True: + if True: + if True: + if row[4] is None or row[5] is None: + bbbbbbbbbbbbb[ + '..............'] = row[5] if row[5] is not None else 5 +""" + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testFunctionCallInDict(self): + code = "a = {'a': b(c=d, **e)}\n" + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testFunctionCallInNestedDict(self): + code = "a = {'a': {'a': {'a': b(c=d, **e)}}}\n" + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testUnbreakableNot(self): + code = textwrap.dedent("""\ + def test(): + if not "Foooooooooooooooooooooooooooooo" or "Foooooooooooooooooooooooooooooo" == "Foooooooooooooooooooooooooooooo": + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testSplitListWithComment(self): + code = textwrap.dedent("""\ + a = [ + 'a', + 'b', + 'c' # hello world + ] + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testOverColumnLimit(self): + unformatted_code = textwrap.dedent("""\ + class Test: + + def testSomething(self): + expected = { + ('aaaaaaaaaaaaa', 'bbbb'): 'ccccccccccccccccccccccccccccccccccccccccccc', + ('aaaaaaaaaaaaa', 'bbbb'): 'ccccccccccccccccccccccccccccccccccccccccccc', + ('aaaaaaaaaaaaa', 'bbbb'): 'ccccccccccccccccccccccccccccccccccccccccccc', + } + """) + expected_formatted_code = textwrap.dedent("""\ + class Test: + + def testSomething(self): + expected = { + ('aaaaaaaaaaaaa', 'bbbb'): + 'ccccccccccccccccccccccccccccccccccccccccccc', + ('aaaaaaaaaaaaa', 'bbbb'): + 'ccccccccccccccccccccccccccccccccccccccccccc', + ('aaaaaaaaaaaaa', 'bbbb'): + 'ccccccccccccccccccccccccccccccccccccccccccc', + } + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testEndingComment(self): + code = textwrap.dedent("""\ + a = f( + a="something", + b="something requiring comment which is quite long", # comment about b (pushes line over 79) + c="something else, about which comment doesn't make sense") + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testContinuationSpaceRetention(self): + code = textwrap.dedent("""\ + def fn(): + return module \\ + .method(Object(data, + fn2(arg) + )) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testIfExpressionWithFunctionCall(self): + code = textwrap.dedent("""\ + if x or z.y( + a, + c, + aaaaaaaaaaaaaaaaaaaaa=aaaaaaaaaaaaaaaaaa, + bbbbbbbbbbbbbbbbbbbbb=bbbbbbbbbbbbbbbbbb): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testUnformattedAfterMultilineString(self): + code = textwrap.dedent("""\ + def foo(): + com_text = \\ + ''' + TEST + ''' % (input_fname, output_fname) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testNoSpacesAroundKeywordDefaultValues(self): + code = textwrap.dedent("""\ + sources = { + 'json': request.get_json(silent=True) or {}, + 'json2': request.get_json(silent=True), + } + json = request.get_json(silent=True) or {} + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testNoSplittingBeforeEndingSubscriptBracket(self): + unformatted_code = textwrap.dedent("""\ + if True: + if True: + status = cf.describe_stacks(StackName=stackname)[u'Stacks'][0][u'StackStatus'] + """) + expected_formatted_code = textwrap.dedent("""\ + if True: + if True: + status = cf.describe_stacks( + StackName=stackname)[u'Stacks'][0][u'StackStatus'] + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testNoSplittingOnSingleArgument(self): + unformatted_code = textwrap.dedent("""\ + xxxxxxxxxxxxxx = (re.search(r'(\\d+\\.\\d+\\.\\d+\\.)\\d+', + aaaaaaa.bbbbbbbbbbbb).group(1) + + re.search(r'\\d+\\.\\d+\\.\\d+\\.(\\d+)', + ccccccc).group(1)) + xxxxxxxxxxxxxx = (re.search(r'(\\d+\\.\\d+\\.\\d+\\.)\\d+', + aaaaaaa.bbbbbbbbbbbb).group(a.b) + + re.search(r'\\d+\\.\\d+\\.\\d+\\.(\\d+)', + ccccccc).group(c.d)) + """) + expected_formatted_code = textwrap.dedent("""\ + xxxxxxxxxxxxxx = ( + re.search(r'(\\d+\\.\\d+\\.\\d+\\.)\\d+', aaaaaaa.bbbbbbbbbbbb).group(1) + + re.search(r'\\d+\\.\\d+\\.\\d+\\.(\\d+)', ccccccc).group(1)) + xxxxxxxxxxxxxx = ( + re.search(r'(\\d+\\.\\d+\\.\\d+\\.)\\d+', aaaaaaa.bbbbbbbbbbbb).group(a.b) + + re.search(r'\\d+\\.\\d+\\.\\d+\\.(\\d+)', ccccccc).group(c.d)) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testSplittingArraysSensibly(self): + unformatted_code = textwrap.dedent("""\ + while True: + while True: + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = list['bbbbbbbbbbbbbbbbbbbbbbbbb'].split(',') + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = list('bbbbbbbbbbbbbbbbbbbbbbbbb').split(',') + """) + expected_formatted_code = textwrap.dedent("""\ + while True: + while True: + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = list[ + 'bbbbbbbbbbbbbbbbbbbbbbbbb'].split(',') + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = list( + 'bbbbbbbbbbbbbbbbbbbbbbbbb').split(',') + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testComprehensionForAndIf(self): + unformatted_code = textwrap.dedent("""\ + class f: + + def __repr__(self): + tokens_repr = ','.join(['{0}({1!r})'.format(tok.name, tok.value) for tok in self._tokens]) + """) + expected_formatted_code = textwrap.dedent("""\ + class f: + + def __repr__(self): + tokens_repr = ','.join( + ['{0}({1!r})'.format(tok.name, tok.value) for tok in self._tokens]) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testFunctionCallArguments(self): + unformatted_code = textwrap.dedent("""\ + def f(): + if True: + pytree_utils.InsertNodesBefore(_CreateCommentsFromPrefix( + comment_prefix, comment_lineno, comment_column, + standalone=True), ancestor_at_indent) + pytree_utils.InsertNodesBefore(_CreateCommentsFromPrefix( + comment_prefix, comment_lineno, comment_column, + standalone=True)) + """) + expected_formatted_code = textwrap.dedent("""\ + def f(): + if True: + pytree_utils.InsertNodesBefore( + _CreateCommentsFromPrefix( + comment_prefix, comment_lineno, comment_column, standalone=True), + ancestor_at_indent) + pytree_utils.InsertNodesBefore( + _CreateCommentsFromPrefix( + comment_prefix, comment_lineno, comment_column, standalone=True)) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testBinaryOperators(self): + unformatted_code = textwrap.dedent("""\ + a = b ** 37 + c = (20 ** -3) / (_GRID_ROWS ** (code_length - 10)) + """) + expected_formatted_code = textwrap.dedent("""\ + a = b**37 + c = (20**-3) / (_GRID_ROWS**(code_length - 10)) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + code = textwrap.dedent("""\ + def f(): + if True: + if (self.stack[-1].split_before_closing_bracket and + # FIXME(morbo): Use the 'matching_bracket' instead of this. + # FIXME(morbo): Don't forget about tuples! + current.value in ']}'): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testContiguousList(self): + code = textwrap.dedent("""\ + [retval1, retval2] = a_very_long_function(argument_1, argument2, argument_3, + argument_4) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testArgsAndKwargsFormatting(self): + code = textwrap.dedent("""\ + a(a=aaaaaaaaaaaaaaaaaaaaa, + b=aaaaaaaaaaaaaaaaaaaaaaaa, + c=aaaaaaaaaaaaaaaaaa, + *d, + **e) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + code = textwrap.dedent("""\ + def foo(): + return [ + Bar(xxx='some string', + yyy='another long string', + zzz='a third long string') + ] + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testCommentColumnLimitOverflow(self): + code = textwrap.dedent("""\ + def f(): + if True: + TaskManager.get_tags = MagicMock( + name='get_tags_mock', + return_value=[157031694470475], + # side_effect=[(157031694470475), (157031694470475),], + ) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testMultilineLambdas(self): + unformatted_code = textwrap.dedent("""\ + class SomeClass(object): + do_something = True + + def succeeded(self, dddddddddddddd): + d = defer.succeed(None) + + if self.do_something: + d.addCallback(lambda _: self.aaaaaa.bbbbbbbbbbbbbbbb.cccccccccccccccccccccccccccccccc(dddddddddddddd)) + return d + """) + expected_formatted_code = textwrap.dedent("""\ + class SomeClass(object): + do_something = True + + def succeeded(self, dddddddddddddd): + d = defer.succeed(None) + + if self.do_something: + d.addCallback(lambda _: self.aaaaaa.bbbbbbbbbbbbbbbb. + cccccccccccccccccccccccccccccccc(dddddddddddddd)) + return d + """) + + try: + style.SetGlobalStyle( + style.CreateStyleFromConfig( + '{based_on_style: yapf, allow_multiline_lambdas: true}')) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, + reformatter.Reformat(uwlines)) + finally: + style.SetGlobalStyle(style.CreateYapfStyle()) + + def testMultilineDictionaryKeys(self): + unformatted_code = textwrap.dedent("""\ + MAP_WITH_LONG_KEYS = { + ('lorem ipsum', 'dolor sit amet'): + 1, + ('consectetur adipiscing elit.', 'Vestibulum mauris justo, ornare eget dolor eget'): + 2, + ('vehicula convallis nulla. Vestibulum dictum nisl in malesuada finibus.',): + 3 + } + """) + expected_formatted_code = textwrap.dedent("""\ + MAP_WITH_LONG_KEYS = { + ('lorem ipsum', 'dolor sit amet'): + 1, + ('consectetur adipiscing elit.', + 'Vestibulum mauris justo, ornare eget dolor eget'): + 2, + ('vehicula convallis nulla. Vestibulum dictum nisl in malesuada finibus.',): + 3 + } + """) + + try: + style.SetGlobalStyle( + style.CreateStyleFromConfig('{based_on_style: yapf, ' + 'allow_multiline_dictionary_keys: true}')) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, + reformatter.Reformat(uwlines)) + finally: + style.SetGlobalStyle(style.CreateYapfStyle()) + + def testStableDictionaryFormatting(self): + code = textwrap.dedent("""\ + class A(object): + def method(self): + filters = { + 'expressions': [{ + 'field': { + 'search_field': { + 'user_field': 'latest_party__number_of_guests' + }, + } + }] + } + """) + + try: + style.SetGlobalStyle( + style.CreateStyleFromConfig( + '{based_on_style: pep8, indent_width: 2, ' + 'continuation_indent_width: 4, indent_dictionary_value: True}')) + + uwlines = yapf_test_helper.ParseAndUnwrap(code) + reformatted_code = reformatter.Reformat(uwlines) + self.assertCodeEqual(code, reformatted_code) + + uwlines = yapf_test_helper.ParseAndUnwrap(reformatted_code) + reformatted_code = reformatter.Reformat(uwlines) + self.assertCodeEqual(code, reformatted_code) + finally: + style.SetGlobalStyle(style.CreateYapfStyle()) + + def testStableInlinedDictionaryFormatting(self): + try: + style.SetGlobalStyle(style.CreatePEP8Style()) + unformatted_code = textwrap.dedent("""\ + def _(): + url = "http://{0}/axis-cgi/admin/param.cgi?{1}".format( + value, urllib.urlencode({'action': 'update', 'parameter': value})) + """) + expected_formatted_code = textwrap.dedent("""\ + def _(): + url = "http://{0}/axis-cgi/admin/param.cgi?{1}".format( + value, urllib.urlencode({ + 'action': 'update', + 'parameter': value + })) + """) + + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + reformatted_code = reformatter.Reformat(uwlines) + self.assertCodeEqual(expected_formatted_code, reformatted_code) + + uwlines = yapf_test_helper.ParseAndUnwrap(reformatted_code) + reformatted_code = reformatter.Reformat(uwlines) + self.assertCodeEqual(expected_formatted_code, reformatted_code) + finally: + style.SetGlobalStyle(style.CreateYapfStyle()) + + def testDontSplitKeywordValueArguments(self): + unformatted_code = textwrap.dedent("""\ + def mark_game_scored(gid): + _connect.execute(_games.update().where(_games.c.gid == gid).values( + scored=True)) + """) + expected_formatted_code = textwrap.dedent("""\ + def mark_game_scored(gid): + _connect.execute( + _games.update().where(_games.c.gid == gid).values(scored=True)) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testDontAddBlankLineAfterMultilineString(self): + code = textwrap.dedent("""\ + query = '''SELECT id + FROM table + WHERE day in {}''' + days = ",".join(days) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testFormattingListComprehensions(self): + code = textwrap.dedent("""\ + def a(): + if True: + if True: + if True: + columns = [ + x for x, y in self._heap_this_is_very_long if x.route[0] == choice + ] + self._heap = [x for x in self._heap if x.route and x.route[0] == choice] + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testNoSplittingWhenBinPacking(self): + code = textwrap.dedent("""\ + a_very_long_function_name( + long_argument_name_1=1, + long_argument_name_2=2, + long_argument_name_3=3, + long_argument_name_4=4, + ) + + a_very_long_function_name( + long_argument_name_1=1, long_argument_name_2=2, long_argument_name_3=3, + long_argument_name_4=4 + ) + """) + + try: + style.SetGlobalStyle( + style.CreateStyleFromConfig( + '{based_on_style: pep8, indent_width: 2, ' + 'continuation_indent_width: 4, indent_dictionary_value: True, ' + 'dedent_closing_brackets: True, ' + 'split_before_named_assigns: False}')) + + uwlines = yapf_test_helper.ParseAndUnwrap(code) + reformatted_code = reformatter.Reformat(uwlines) + self.assertCodeEqual(code, reformatted_code) + + uwlines = yapf_test_helper.ParseAndUnwrap(reformatted_code) + reformatted_code = reformatter.Reformat(uwlines) + self.assertCodeEqual(code, reformatted_code) + finally: + style.SetGlobalStyle(style.CreateYapfStyle()) + + def testNotSplittingAfterSubscript(self): + unformatted_code = textwrap.dedent("""\ + if not aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.b(c == d[ + 'eeeeee']).ffffff(): + pass + """) + expected_formatted_code = textwrap.dedent("""\ + if not aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.b( + c == d['eeeeee']).ffffff(): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testSplittingOneArgumentList(self): + unformatted_code = textwrap.dedent("""\ + def _(): + if True: + if True: + if True: + if True: + if True: + boxes[id_] = np.concatenate((points.min(axis=0), qoints.max(axis=0))) + """) + expected_formatted_code = textwrap.dedent("""\ + def _(): + if True: + if True: + if True: + if True: + if True: + boxes[id_] = np.concatenate( + (points.min(axis=0), qoints.max(axis=0))) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testSplittingBeforeFirstElementListArgument(self): + unformatted_code = textwrap.dedent("""\ + class _(): + @classmethod + def _pack_results_for_constraint_or(cls, combination, constraints): + if True: + if True: + if True: + return cls._create_investigation_result( + ( + clue for clue in combination if not clue == Verifier.UNMATCHED + ), constraints, InvestigationResult.OR + ) + """) + expected_formatted_code = textwrap.dedent("""\ + class _(): + + @classmethod + def _pack_results_for_constraint_or(cls, combination, constraints): + if True: + if True: + if True: + return cls._create_investigation_result( + (clue for clue in combination if not clue == Verifier.UNMATCHED), + constraints, InvestigationResult.OR) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testSplittingArgumentsTerminatedByComma(self): + unformatted_code = textwrap.dedent("""\ + function_name(argument_name_1=1, argument_name_2=2, argument_name_3=3) + + function_name(argument_name_1=1, argument_name_2=2, argument_name_3=3,) + + a_very_long_function_name(long_argument_name_1=1, long_argument_name_2=2, long_argument_name_3=3, long_argument_name_4=4) + + a_very_long_function_name(long_argument_name_1, long_argument_name_2, long_argument_name_3, long_argument_name_4,) + + r =f0 (1, 2,3,) + """) + expected_formatted_code = textwrap.dedent("""\ + function_name(argument_name_1=1, argument_name_2=2, argument_name_3=3) + + function_name( + argument_name_1=1, + argument_name_2=2, + argument_name_3=3, + ) + + a_very_long_function_name( + long_argument_name_1=1, + long_argument_name_2=2, + long_argument_name_3=3, + long_argument_name_4=4) + + a_very_long_function_name( + long_argument_name_1, + long_argument_name_2, + long_argument_name_3, + long_argument_name_4, + ) + + r = f0( + 1, + 2, + 3, + ) + """) + + try: + style.SetGlobalStyle( + style.CreateStyleFromConfig( + '{based_on_style: yapf, ' + 'split_arguments_when_comma_terminated: True}')) + + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + reformatted_code = reformatter.Reformat(uwlines) + self.assertCodeEqual(expected_formatted_code, reformatted_code) + + uwlines = yapf_test_helper.ParseAndUnwrap(reformatted_code) + reformatted_code = reformatter.Reformat(uwlines) + self.assertCodeEqual(expected_formatted_code, reformatted_code) + finally: + style.SetGlobalStyle(style.CreateYapfStyle()) + + def testImportAsList(self): + code = textwrap.dedent("""\ + from toto import titi, tata, tutu # noqa + from toto import titi, tata, tutu + from toto import (titi, tata, tutu) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testDictionaryValuesOnOwnLines(self): + unformatted_code = textwrap.dedent("""\ + a = { + 'aaaaaaaaaaaaaaaaaaaaaaaa': + Check('ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ', '=', True), + 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb': + Check('YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY', '=', True), + 'ccccccccccccccc': + Check('XXXXXXXXXXXXXXXXXXX', '!=', 'SUSPENDED'), + 'dddddddddddddddddddddddddddddd': + Check('WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW', '=', False), + 'eeeeeeeeeeeeeeeeeeeeeeeeeeeee': + Check('VVVVVVVVVVVVVVVVVVVVVVVVVVVVVV', '=', False), + 'ffffffffffffffffffffffffff': + Check('UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU', '=', True), + 'ggggggggggggggggg': + Check('TTTTTTTTTTTTTTTTTTTTTTTTTTTTTT', '=', True), + 'hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh': + Check('SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS', '=', True), + 'iiiiiiiiiiiiiiiiiiiiiiii': + Check('RRRRRRRRRRRRRRRRRRRRRRRRRRR', '=', True), + 'jjjjjjjjjjjjjjjjjjjjjjjjjj': + Check('QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ', '=', False), + } + """) + expected_formatted_code = textwrap.dedent("""\ + a = { + 'aaaaaaaaaaaaaaaaaaaaaaaa': + Check('ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ', '=', True), + 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb': + Check('YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY', '=', True), + 'ccccccccccccccc': + Check('XXXXXXXXXXXXXXXXXXX', '!=', 'SUSPENDED'), + 'dddddddddddddddddddddddddddddd': + Check('WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW', '=', False), + 'eeeeeeeeeeeeeeeeeeeeeeeeeeeee': + Check('VVVVVVVVVVVVVVVVVVVVVVVVVVVVVV', '=', False), + 'ffffffffffffffffffffffffff': + Check('UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU', '=', True), + 'ggggggggggggggggg': + Check('TTTTTTTTTTTTTTTTTTTTTTTTTTTTTT', '=', True), + 'hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh': + Check('SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS', '=', True), + 'iiiiiiiiiiiiiiiiiiiiiiii': + Check('RRRRRRRRRRRRRRRRRRRRRRRRRRR', '=', True), + 'jjjjjjjjjjjjjjjjjjjjjjjjjj': + Check('QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ', '=', False), + } + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testDictionaryOnOwnLine(self): + unformatted_code = textwrap.dedent("""\ + doc = test_utils.CreateTestDocumentViaController( + content={ 'a': 'b' }, + branch_key=branch.key, + collection_key=collection.key) + """) + expected_formatted_code = textwrap.dedent("""\ + doc = test_utils.CreateTestDocumentViaController( + content={'a': 'b'}, branch_key=branch.key, collection_key=collection.key) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + unformatted_code = textwrap.dedent("""\ + doc = test_utils.CreateTestDocumentViaController( + content={ 'a': 'b' }, + branch_key=branch.key, + collection_key=collection.key, + collection_key2=collection.key2) + """) + expected_formatted_code = textwrap.dedent("""\ + doc = test_utils.CreateTestDocumentViaController( + content={'a': 'b'}, + branch_key=branch.key, + collection_key=collection.key, + collection_key2=collection.key2) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testNestedListsInDictionary(self): + unformatted_code = textwrap.dedent("""\ + _A = { + 'cccccccccc': ('^^1',), + 'rrrrrrrrrrrrrrrrrrrrrrrrr': ('^7913', # AAAAAAAAAAAAAA. + ), + 'eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee': ('^6242', # BBBBBBBBBBBBBBB. + ), + 'vvvvvvvvvvvvvvvvvvv': ('^27959', # CCCCCCCCCCCCCCCCCC. + '^19746', # DDDDDDDDDDDDDDDDDDDDDDD. + '^22907', # EEEEEEEEEEEEEEEEEEEEEEEE. + '^21098', # FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF. + '^22826', # GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG. + '^22769', # HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH. + '^22935', # IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII. + '^3982', # JJJJJJJJJJJJJ. + ), + 'uuuuuuuuuuuu': ('^19745', # LLLLLLLLLLLLLLLLLLLLLLLLLL. + '^21324', # MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM. + '^22831', # NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN. + '^17081', # OOOOOOOOOOOOOOOOOOOOO. + ), + 'eeeeeeeeeeeeee': ( + '^9416', # Reporter email. Not necessarily the reporter. + '^^3', # This appears to be the raw email field. + ), + 'cccccccccc': ('^21109', # PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP. + ), + } + """) + expected_formatted_code = textwrap.dedent("""\ + _A = { + 'cccccccccc': ('^^1',), + 'rrrrrrrrrrrrrrrrrrrrrrrrr': ( + '^7913', # AAAAAAAAAAAAAA. + ), + 'eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee': ( + '^6242', # BBBBBBBBBBBBBBB. + ), + 'vvvvvvvvvvvvvvvvvvv': ( + '^27959', # CCCCCCCCCCCCCCCCCC. + '^19746', # DDDDDDDDDDDDDDDDDDDDDDD. + '^22907', # EEEEEEEEEEEEEEEEEEEEEEEE. + '^21098', # FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF. + '^22826', # GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG. + '^22769', # HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH. + '^22935', # IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII. + '^3982', # JJJJJJJJJJJJJ. + ), + 'uuuuuuuuuuuu': ( + '^19745', # LLLLLLLLLLLLLLLLLLLLLLLLLL. + '^21324', # MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM. + '^22831', # NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN. + '^17081', # OOOOOOOOOOOOOOOOOOOOO. + ), + 'eeeeeeeeeeeeee': ( + '^9416', # Reporter email. Not necessarily the reporter. + '^^3', # This appears to be the raw email field. + ), + 'cccccccccc': ( + '^21109', # PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP. + ), + } + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testNestedDictionary(self): + unformatted_code = textwrap.dedent("""\ + class _(): + def _(): + breadcrumbs = [{'name': 'Admin', + 'url': url_for(".home")}, + {'title': title},] + breadcrumbs = [{'name': 'Admin', + 'url': url_for(".home")}, + {'title': title}] + """) + expected_formatted_code = textwrap.dedent("""\ + class _(): + def _(): + breadcrumbs = [ + { + 'name': 'Admin', + 'url': url_for(".home") + }, + { + 'title': title + }, + ] + breadcrumbs = [{'name': 'Admin', 'url': url_for(".home")}, {'title': title}] + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testDictionaryElementsOnOneLine(self): + code = textwrap.dedent("""\ + class _(): + + @mock.patch.dict( + os.environ, + {'HTTP_' + xsrf._XSRF_TOKEN_HEADER.replace('-', '_'): 'atoken'}) + def _(): + pass + + + AAAAAAAAAAAAAAAAAAAAAAAA = { + Environment.XXXXXXXXXX: 'some text more text even more tex', + Environment.YYYYYYY: 'some text more text even more text yet ag', + Environment.ZZZZZZZZZZZ: 'some text more text even mor etext yet again tex', + } + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testNotInParams(self): + unformatted_code = textwrap.dedent("""\ + list("a long line to break the line. a long line to break the brk a long lin", not True) + """) + expected_code = textwrap.dedent("""\ + list("a long line to break the line. a long line to break the brk a long lin", + not True) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_code, reformatter.Reformat(uwlines)) + + def testNamedAssignNotAtEndOfLine(self): + unformatted_code = textwrap.dedent("""\ + def _(): + if True: + with py3compat.open_with_encoding(filename, mode='w', + encoding=encoding) as fd: + pass + """) + expected_code = textwrap.dedent("""\ + def _(): + if True: + with py3compat.open_with_encoding( + filename, mode='w', encoding=encoding) as fd: + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_code, reformatter.Reformat(uwlines)) + + def testBlankLineBeforeClassDocstring(self): + unformatted_code = textwrap.dedent('''\ + class A: + + """Does something. + + Also, here are some details. + """ + + def __init__(self): + pass + ''') + expected_code = textwrap.dedent('''\ + class A: + """Does something. + + Also, here are some details. + """ + + def __init__(self): + pass + ''') + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_code, reformatter.Reformat(uwlines)) + + unformatted_code = textwrap.dedent('''\ + class A: + + """Does something. + + Also, here are some details. + """ + + def __init__(self): + pass + ''') + expected_formatted_code = textwrap.dedent('''\ + class A: + + """Does something. + + Also, here are some details. + """ + + def __init__(self): + pass + ''') + + try: + style.SetGlobalStyle( + style.CreateStyleFromConfig( + '{based_on_style: yapf, ' + 'blank_line_before_class_docstring: True}')) + + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, + reformatter.Reformat(uwlines)) + finally: + style.SetGlobalStyle(style.CreateYapfStyle()) + + def testBlankLineBeforeModuleDocstring(self): + unformatted_code = textwrap.dedent('''\ + #!/usr/bin/env python + # -*- coding: utf-8 name> -*- + + """Some module docstring.""" + + + def foobar(): + pass + ''') + expected_code = textwrap.dedent('''\ + #!/usr/bin/env python + # -*- coding: utf-8 name> -*- + """Some module docstring.""" + + + def foobar(): + pass + ''') + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_code, reformatter.Reformat(uwlines)) + + unformatted_code = textwrap.dedent('''\ + #!/usr/bin/env python + # -*- coding: utf-8 name> -*- + """Some module docstring.""" + + + def foobar(): + pass + ''') + expected_formatted_code = textwrap.dedent('''\ + #!/usr/bin/env python + # -*- coding: utf-8 name> -*- + + """Some module docstring.""" + + + def foobar(): + pass + ''') + + try: + style.SetGlobalStyle( + style.CreateStyleFromConfig( + '{based_on_style: pep8, ' + 'blank_line_before_module_docstring: True}')) + + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, + reformatter.Reformat(uwlines)) + finally: + style.SetGlobalStyle(style.CreateYapfStyle()) + + def testTupleCohesion(self): + unformatted_code = textwrap.dedent("""\ + def f(): + this_is_a_very_long_function_name(an_extremely_long_variable_name, ( + 'a string that may be too long %s' % 'M15')) + """) + expected_code = textwrap.dedent("""\ + def f(): + this_is_a_very_long_function_name( + an_extremely_long_variable_name, + ('a string that may be too long %s' % 'M15')) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_code, reformatter.Reformat(uwlines)) + + def testSubscriptExpression(self): + code = textwrap.dedent("""\ + foo = d[not a] + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testListWithFunctionCalls(self): + unformatted_code = textwrap.dedent("""\ + def foo(): + return [ + Bar( + xxx='some string', + yyy='another long string', + zzz='a third long string'), Bar( + xxx='some string', + yyy='another long string', + zzz='a third long string') + ] + """) + expected_code = textwrap.dedent("""\ + def foo(): + return [ + Bar(xxx='some string', + yyy='another long string', + zzz='a third long string'), + Bar(xxx='some string', + yyy='another long string', + zzz='a third long string') + ] + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_code, reformatter.Reformat(uwlines)) + + def testEllipses(self): + unformatted_code = textwrap.dedent("""\ + X=... + Y = X if ... else X + """) + expected_code = textwrap.dedent("""\ + X = ... + Y = X if ... else X + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_code, reformatter.Reformat(uwlines)) + + def testPseudoParens(self): + unformatted_code = """\ +my_dict = { + 'key': # Some comment about the key + {'nested_key': 1, }, +} +""" + expected_code = """\ +my_dict = { + 'key': # Some comment about the key + { + 'nested_key': 1, + }, +} +""" + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_code, reformatter.Reformat(uwlines)) + + def testSplittingBeforeFirstArgumentOnFunctionCall(self): + """Tests split_before_first_argument on a function call.""" + unformatted_code = textwrap.dedent("""\ + a_very_long_function_name("long string with formatting {0:s}".format( + "mystring")) + """) + expected_formatted_code = textwrap.dedent("""\ + a_very_long_function_name( + "long string with formatting {0:s}".format("mystring")) + """) + + try: + style.SetGlobalStyle( + style.CreateStyleFromConfig( + '{based_on_style: yapf, split_before_first_argument: True}')) + + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, + reformatter.Reformat(uwlines)) + finally: + style.SetGlobalStyle(style.CreateYapfStyle()) + + def testSplittingBeforeFirstArgumentOnFunctionDefinition(self): + """Tests split_before_first_argument on a function definition.""" + unformatted_code = textwrap.dedent("""\ + def _GetNumberOfSecondsFromElements(year, month, day, hours, + minutes, seconds, microseconds): + return + """) + expected_formatted_code = textwrap.dedent("""\ + def _GetNumberOfSecondsFromElements( + year, month, day, hours, minutes, seconds, microseconds): + return + """) + + try: + style.SetGlobalStyle( + style.CreateStyleFromConfig( + '{based_on_style: yapf, split_before_first_argument: True}')) + + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, + reformatter.Reformat(uwlines)) + finally: + style.SetGlobalStyle(style.CreateYapfStyle()) + + def testSplittingBeforeFirstArgumentOnCompoundStatement(self): + """Tests split_before_first_argument on a compound statement.""" + unformatted_code = textwrap.dedent("""\ + if (long_argument_name_1 == 1 or + long_argument_name_2 == 2 or + long_argument_name_3 == 3 or + long_argument_name_4 == 4): + pass + """) + expected_formatted_code = textwrap.dedent("""\ + if (long_argument_name_1 == 1 or long_argument_name_2 == 2 or + long_argument_name_3 == 3 or long_argument_name_4 == 4): + pass + """) + + try: + style.SetGlobalStyle( + style.CreateStyleFromConfig( + '{based_on_style: yapf, split_before_first_argument: True}')) + + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, + reformatter.Reformat(uwlines)) + finally: + style.SetGlobalStyle(style.CreateYapfStyle()) + + def testCoalesceBracketsOnDict(self): + """Tests coalesce_brackets on a dictionary.""" + unformatted_code = textwrap.dedent("""\ + date_time_values = ( + { + u'year': year, + u'month': month, + u'day_of_month': day_of_month, + u'hours': hours, + u'minutes': minutes, + u'seconds': seconds + } + ) + """) + expected_formatted_code = textwrap.dedent("""\ + date_time_values = ({ + u'year': year, + u'month': month, + u'day_of_month': day_of_month, + u'hours': hours, + u'minutes': minutes, + u'seconds': seconds + }) + """) + + try: + style.SetGlobalStyle( + style.CreateStyleFromConfig( + '{based_on_style: yapf, coalesce_brackets: True}')) + + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, + reformatter.Reformat(uwlines)) + finally: + style.SetGlobalStyle(style.CreateYapfStyle()) + + def testSplitAfterComment(self): + code = textwrap.dedent("""\ + if __name__ == "__main__": + with another_resource: + account = { + "validUntil": + int(time() + (6 * 7 * 24 * 60 * 60)) # in 6 weeks time + } + """) + + try: + style.SetGlobalStyle( + style.CreateStyleFromConfig( + '{based_on_style: yapf, coalesce_brackets: True, ' + 'dedent_closing_brackets: true}')) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + finally: + style.SetGlobalStyle(style.CreateYapfStyle()) + + @unittest.skipUnless(not py3compat.PY3, 'Requires Python 2.7') + def testAsyncAsNonKeyword(self): + try: + style.SetGlobalStyle(style.CreatePEP8Style()) + + # In Python 2, async may be used as a non-keyword identifier. + code = textwrap.dedent("""\ + from util import async + + + class A(object): + def foo(self): + async.run() + """) + + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + finally: + style.SetGlobalStyle(style.CreateYapfStyle()) + + def testDisableEndingCommaHeuristic(self): + code = textwrap.dedent("""\ + x = [1, 2, 3, 4, 5, 6, 7,] + """) + + try: + style.SetGlobalStyle( + style.CreateStyleFromConfig('{based_on_style: yapf,' + ' disable_ending_comma_heuristic: True}')) + + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + finally: + style.SetGlobalStyle(style.CreateYapfStyle()) + + def testDedentClosingBracketsWithTypeAnnotationExceedingLineLength(self): + unformatted_code = textwrap.dedent("""\ + def function(first_argument_xxxxxxxxxxxxxxxx=(0,), second_argument=None) -> None: + pass + + + def function(first_argument_xxxxxxxxxxxxxxxxxxxxxxx=(0,), second_argument=None) -> None: + pass + """) + expected_formatted_code = textwrap.dedent("""\ + def function( + first_argument_xxxxxxxxxxxxxxxx=(0,), second_argument=None + ) -> None: + pass + + + def function( + first_argument_xxxxxxxxxxxxxxxxxxxxxxx=(0,), second_argument=None + ) -> None: + pass + """) + + try: + style.SetGlobalStyle( + style.CreateStyleFromConfig('{based_on_style: yapf,' + ' dedent_closing_brackets: True}')) + + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, + reformatter.Reformat(uwlines)) + finally: + style.SetGlobalStyle(style.CreateYapfStyle()) + + def testIndentClosingBracketsWithTypeAnnotationExceedingLineLength(self): + unformatted_code = textwrap.dedent("""\ + def function(first_argument_xxxxxxxxxxxxxxxx=(0,), second_argument=None) -> None: + pass + + + def function(first_argument_xxxxxxxxxxxxxxxxxxxxxxx=(0,), second_argument=None) -> None: + pass + """) + expected_formatted_code = textwrap.dedent("""\ + def function( + first_argument_xxxxxxxxxxxxxxxx=(0,), second_argument=None + ) -> None: + pass + + + def function( + first_argument_xxxxxxxxxxxxxxxxxxxxxxx=(0,), second_argument=None + ) -> None: + pass + """) + + try: + style.SetGlobalStyle( + style.CreateStyleFromConfig('{based_on_style: yapf,' + ' indent_closing_brackets: True}')) + + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, + reformatter.Reformat(uwlines)) + finally: + style.SetGlobalStyle(style.CreateYapfStyle()) + + def testIndentClosingBracketsInFunctionCall(self): + unformatted_code = textwrap.dedent("""\ + def function(first_argument_xxxxxxxxxxxxxxxx=(0,), second_argument=None, third_and_final_argument=True): + pass + + + def function(first_argument_xxxxxxxxxxxxxxxxxxxxxxx=(0,), second_and_last_argument=None): + pass + """) + expected_formatted_code = textwrap.dedent("""\ + def function( + first_argument_xxxxxxxxxxxxxxxx=(0,), + second_argument=None, + third_and_final_argument=True + ): + pass + + + def function( + first_argument_xxxxxxxxxxxxxxxxxxxxxxx=(0,), second_and_last_argument=None + ): + pass + """) + + try: + style.SetGlobalStyle( + style.CreateStyleFromConfig('{based_on_style: yapf,' + ' indent_closing_brackets: True}')) + + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, + reformatter.Reformat(uwlines)) + finally: + style.SetGlobalStyle(style.CreateYapfStyle()) + + def testIndentClosingBracketsInTuple(self): + unformatted_code = textwrap.dedent("""\ + def function(): + some_var = ('a long element', 'another long element', 'short element', 'really really long element') + return True + + def function(): + some_var = ('a couple', 'small', 'elemens') + return False + """) + expected_formatted_code = textwrap.dedent("""\ + def function(): + some_var = ( + 'a long element', 'another long element', 'short element', + 'really really long element' + ) + return True + + + def function(): + some_var = ('a couple', 'small', 'elemens') + return False + """) + + try: + style.SetGlobalStyle( + style.CreateStyleFromConfig('{based_on_style: yapf,' + ' indent_closing_brackets: True}')) + + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, + reformatter.Reformat(uwlines)) + finally: + style.SetGlobalStyle(style.CreateYapfStyle()) + + def testIndentClosingBracketsInList(self): + unformatted_code = textwrap.dedent("""\ + def function(): + some_var = ['a long element', 'another long element', 'short element', 'really really long element'] + return True + + def function(): + some_var = ['a couple', 'small', 'elemens'] + return False + """) + expected_formatted_code = textwrap.dedent("""\ + def function(): + some_var = [ + 'a long element', 'another long element', 'short element', + 'really really long element' + ] + return True + + + def function(): + some_var = ['a couple', 'small', 'elemens'] + return False + """) + + try: + style.SetGlobalStyle( + style.CreateStyleFromConfig('{based_on_style: yapf,' + ' indent_closing_brackets: True}')) + + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, + reformatter.Reformat(uwlines)) + finally: + style.SetGlobalStyle(style.CreateYapfStyle()) + + def testIndentClosingBracketsInDict(self): + unformatted_code = textwrap.dedent("""\ + def function(): + some_var = {1: ('a long element', 'and another really really long element that is really really amazingly long'), 2: 'another long element', 3: 'short element', 4: 'really really long element'} + return True + + def function(): + some_var = {1: 'a couple', 2: 'small', 3: 'elemens'} + return False + """) + expected_formatted_code = textwrap.dedent("""\ + def function(): + some_var = { + 1: + ( + 'a long element', + 'and another really really long element that is really really amazingly long' + ), + 2: 'another long element', + 3: 'short element', + 4: 'really really long element' + } + return True + + + def function(): + some_var = {1: 'a couple', 2: 'small', 3: 'elemens'} + return False + """) + + try: + style.SetGlobalStyle( + style.CreateStyleFromConfig('{based_on_style: yapf,' + ' indent_closing_brackets: True}')) + + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, + reformatter.Reformat(uwlines)) + finally: + style.SetGlobalStyle(style.CreateYapfStyle()) + + def testMultipleDictionariesInList(self): + unformatted_code = textwrap.dedent("""\ + class A: + def b(): + d = { + "123456": [ + { + "12": "aa" + }, + { + "12": "bb" + }, + { + "12": "cc", + "1234567890": { + "1234567": [{ + "12": "dd", + "12345": "text 1" + }, { + "12": "ee", + "12345": "text 2" + }] + } + } + ] + } + """) + expected_formatted_code = textwrap.dedent("""\ + class A: + + def b(): + d = { + "123456": [{ + "12": "aa" + }, { + "12": "bb" + }, { + "12": "cc", + "1234567890": { + "1234567": [{ + "12": "dd", + "12345": "text 1" + }, { + "12": "ee", + "12345": "text 2" + }] + } + }] + } + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testForceMultilineDict_True(self): + try: + style.SetGlobalStyle( + style.CreateStyleFromConfig('{force_multiline_dict: true}')) + unformatted_code = textwrap.dedent( + "responseDict = {'childDict': {'spam': 'eggs'}}\n") + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + actual = reformatter.Reformat(uwlines) + expected = textwrap.dedent("""\ + responseDict = { + 'childDict': { + 'spam': 'eggs' + } + } + """) + self.assertCodeEqual(expected, actual) + finally: + style.SetGlobalStyle(style.CreateYapfStyle()) + + def testForceMultilineDict_False(self): + try: + style.SetGlobalStyle( + style.CreateStyleFromConfig('{force_multiline_dict: false}')) + unformatted_code = textwrap.dedent("""\ + responseDict = {'childDict': {'spam': 'eggs'}} + """) + expected_formatted_code = unformatted_code + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, + reformatter.Reformat(uwlines)) + finally: + style.SetGlobalStyle(style.CreateYapfStyle()) + + @unittest.skipUnless(py3compat.PY38, 'Requires Python 3.8') + def testWalrus(self): + unformatted_code = textwrap.dedent("""\ + if (x := len([1]*1000)>100): + print(f'{x} is pretty big' ) + """) + expected = textwrap.dedent("""\ + if (x := len([1] * 1000) > 100): + print(f'{x} is pretty big') + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected, reformatter.Reformat(uwlines)) + + +if __name__ == '__main__': + unittest.main() diff --git a/.venv/lib/python3.9/site-packages/yapftests/reformatter_buganizer_test.py b/.venv/lib/python3.9/site-packages/yapftests/reformatter_buganizer_test.py new file mode 100644 index 00000000..e96f6da7 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapftests/reformatter_buganizer_test.py @@ -0,0 +1,2350 @@ +# Copyright 2016 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Buganizer tests for yapf.reformatter.""" + +import textwrap +import unittest + +from yapf.yapflib import reformatter +from yapf.yapflib import style + +from yapftests import yapf_test_helper + + +class BuganizerFixes(yapf_test_helper.YAPFTest): + + @classmethod + def setUpClass(cls): + style.SetGlobalStyle(style.CreateYapfStyle()) + + def testB137580392(self): + code = """\ +def _create_testing_simulator_and_sink( +) -> Tuple[_batch_simulator:_batch_simulator.BatchSimulator, + _batch_simulator.SimulationSink]: + pass +""" + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB73279849(self): + unformatted_code = """\ +class A: + def _(a): + return 'hello' [ a ] +""" + expected_formatted_code = """\ +class A: + def _(a): + return 'hello'[a] +""" + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB122455211(self): + unformatted_code = """\ +_zzzzzzzzzzzzzzzzzzzz = Union[sssssssssssssssssssss.pppppppppppppppp, + sssssssssssssssssssss.pppppppppppppppppppppppppppp] +""" + expected_formatted_code = """\ +_zzzzzzzzzzzzzzzzzzzz = Union[ + sssssssssssssssssssss.pppppppppppppppp, + sssssssssssssssssssss.pppppppppppppppppppppppppppp] +""" + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB119300344(self): + code = """\ +def _GenerateStatsEntries( + process_id: Text, + timestamp: Optional[rdfvalue.RDFDatetime] = None +) -> Sequence[stats_values.StatsStoreEntry]: + pass +""" + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB132886019(self): + code = """\ +X = { + 'some_dict_key': + frozenset([ + # pylint: disable=line-too-long + '//this/path/is/really/too/long/for/this/line/and/probably/should/be/split', + ]), +} +""" + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB26521719(self): + code = """\ +class _(): + + def _(self): + self.stubs.Set(some_type_of_arg, 'ThisIsAStringArgument', + lambda *unused_args, **unused_kwargs: fake_resolver) +""" + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB122541552(self): + code = """\ +# pylint: disable=g-explicit-bool-comparison,singleton-comparison +_QUERY = account.Account.query(account.Account.enabled == True) +# pylint: enable=g-explicit-bool-comparison,singleton-comparison + + +def _(): + pass +""" + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB124415889(self): + code = """\ +class _(): + + def run_queue_scanners(): + return xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx( + { + components.NAME.FNOR: True, + components.NAME.DEVO: True, + }, + default=False) + + def modules_to_install(): + modules = DeepCopy(GetDef({})) + modules.update({ + 'xxxxxxxxxxxxxxxxxxxx': + GetDef('zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz', None), + }) + return modules +""" + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB73166511(self): + code = """\ +def _(): + if min_std is not None: + groundtruth_age_variances = tf.maximum(groundtruth_age_variances, + min_std**2) +""" + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB118624921(self): + code = """\ +def _(): + function_call( + alert_name='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', + time_delta='1h', + alert_level='bbbbbbbb', + metric='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', + bork=foo) +""" + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB35417079(self): + code = """\ +class _(): + + def _(): + X = ( + _ares_label_prefix + + 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' # pylint: disable=line-too-long + 'PyTypePyTypePyTypePyTypePyTypePyTypePyTypePyTypePyTypePyTypePyTypePyTypePyType' # pytype: disable=attribute-error + 'CopybaraCopybaraCopybaraCopybaraCopybaraCopybaraCopybaraCopybaraCopybara' # copybara:strip + ) +""" + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB120047670(self): + unformatted_code = """\ +X = { + 'NO_PING_COMPONENTS': [ + 79775, # Releases / FOO API + 79770, # Releases / BAZ API + 79780], # Releases / MUX API + + 'PING_BLOCKED_BUGS': False, +} +""" + expected_formatted_code = """\ +X = { + 'NO_PING_COMPONENTS': [ + 79775, # Releases / FOO API + 79770, # Releases / BAZ API + 79780 + ], # Releases / MUX API + 'PING_BLOCKED_BUGS': False, +} +""" + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB120245013(self): + unformatted_code = """\ +class Foo(object): + def testNoAlertForShortPeriod(self, rutabaga): + self.targets[:][streamz_path,self._fillInOtherFields(streamz_path, {streamz_field_of_interest:True})] = series.Counter('1s', '+ 500x10000') +""" + expected_formatted_code = """\ +class Foo(object): + + def testNoAlertForShortPeriod(self, rutabaga): + self.targets[:][ + streamz_path, + self._fillInOtherFields(streamz_path, {streamz_field_of_interest: True} + )] = series.Counter('1s', '+ 500x10000') +""" + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB117841880(self): + code = """\ +def xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx( + aaaaaaaaaaaaaaaaaaa: AnyStr, + bbbbbbbbbbbb: Optional[Sequence[AnyStr]] = None, + cccccccccc: AnyStr = cst.DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD, + dddddddddd: Sequence[SliceDimension] = (), + eeeeeeeeeeee: AnyStr = cst.DEFAULT_CONTROL_NAME, + ffffffffffffffffffff: Optional[Callable[[pd.DataFrame], + pd.DataFrame]] = None, + gggggggggggggg: ooooooooooooo = ooooooooooooo() +) -> pd.DataFrame: + pass +""" + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB111764402(self): + unformatted_code = """\ +x = self.stubs.stub(video_classification_map, 'read_video_classifications', (lambda external_ids, **unused_kwargs: {external_id: self._get_serving_classification('video') for external_id in external_ids})) +""" + expected_formatted_code = """\ +x = self.stubs.stub(video_classification_map, 'read_video_classifications', + (lambda external_ids, **unused_kwargs: { + external_id: self._get_serving_classification('video') + for external_id in external_ids + })) +""" + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB116825060(self): + code = """\ +result_df = pd.DataFrame({LEARNED_CTR_COLUMN: learned_ctr}, + index=df_metrics.index) +""" + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB112711217(self): + code = """\ +def _(): + stats['moderated'] = ~stats.moderation_reason.isin( + approved_moderation_reasons) +""" + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB112867548(self): + unformatted_code = """\ +def _(): + return flask.make_response( + 'Records: {}, Problems: {}, More: {}'.format( + process_result.result_ct, process_result.problem_ct, + process_result.has_more), + httplib.ACCEPTED if process_result.has_more else httplib.OK, + {'content-type': _TEXT_CONTEXT_TYPE}) +""" + expected_formatted_code = """\ +def _(): + return flask.make_response( + 'Records: {}, Problems: {}, More: {}'.format(process_result.result_ct, + process_result.problem_ct, + process_result.has_more), + httplib.ACCEPTED if process_result.has_more else httplib.OK, + {'content-type': _TEXT_CONTEXT_TYPE}) +""" + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB112651423(self): + unformatted_code = """\ +def potato(feeditems, browse_use_case=None): + for item in turnip: + if kumquat: + if not feeds_variants.variants['FEEDS_LOAD_PLAYLIST_VIDEOS_FOR_ALL_ITEMS'] and item.video: + continue +""" + expected_formatted_code = """\ +def potato(feeditems, browse_use_case=None): + for item in turnip: + if kumquat: + if not feeds_variants.variants[ + 'FEEDS_LOAD_PLAYLIST_VIDEOS_FOR_ALL_ITEMS'] and item.video: + continue +""" + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB80484938(self): + code = """\ +for sssssss, aaaaaaaaaa in [ + ('ssssssssssssssssssss', 'sssssssssssssssssssssssss'), + ('nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn', + 'nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn'), + ('pppppppppppppppppppppppppppp', 'pppppppppppppppppppppppppppppppp'), + ('wwwwwwwwwwwwwwwwwwww', 'wwwwwwwwwwwwwwwwwwwwwwwww'), + ('sssssssssssssssss', 'sssssssssssssssssssssss'), + ('ggggggggggggggggggggggg', 'gggggggggggggggggggggggggggg'), + ('ggggggggggggggggg', 'gggggggggggggggggggggg'), + ('eeeeeeeeeeeeeeeeeeeeee', 'eeeeeeeeeeeeeeeeeeeeeeeeeee') +]: + pass + +for sssssss, aaaaaaaaaa in [ + ('ssssssssssssssssssss', 'sssssssssssssssssssssssss'), + ('nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn', 'nnnnnnnnnnnnnnnnnnnnnnnnn'), + ('pppppppppppppppppppppppppppp', 'pppppppppppppppppppppppppppppppp'), + ('wwwwwwwwwwwwwwwwwwww', 'wwwwwwwwwwwwwwwwwwwwwwwww'), + ('sssssssssssssssss', 'sssssssssssssssssssssss'), + ('ggggggggggggggggggggggg', 'gggggggggggggggggggggggggggg'), + ('ggggggggggggggggg', 'gggggggggggggggggggggg'), + ('eeeeeeeeeeeeeeeeeeeeee', 'eeeeeeeeeeeeeeeeeeeeeeeeeee') +]: + pass + +for sssssss, aaaaaaaaaa in [ + ('ssssssssssssssssssss', 'sssssssssssssssssssssssss'), + ('nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn', + 'nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn'), + ('pppppppppppppppppppppppppppp', 'pppppppppppppppppppppppppppppppp'), + ('wwwwwwwwwwwwwwwwwwww', 'wwwwwwwwwwwwwwwwwwwwwwwww'), + ('sssssssssssssssss', 'sssssssssssssssssssssss'), + ('ggggggggggggggggggggggg', 'gggggggggggggggggggggggggggg'), + ('ggggggggggggggggg', 'gggggggggggggggggggggg'), + ('eeeeeeeeeeeeeeeeeeeeee', 'eeeeeeeeeeeeeeeeeeeeeeeeeee'), +]: + pass +""" + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB120771563(self): + code = """\ +class A: + + def b(): + d = { + "123456": [{ + "12": "aa" + }, { + "12": "bb" + }, { + "12": "cc", + "1234567890": { + "1234567": [{ + "12": "dd", + "12345": "text 1" + }, { + "12": "ee", + "12345": "text 2" + }] + } + }] + } +""" + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB79462249(self): + code = """\ +foo.bar(baz, [ + quux(thud=42), + norf, +]) +foo.bar(baz, [ + quux(), + norf, +]) +foo.bar(baz, quux(thud=42), aaaaaaaaaaaaaaaaaaaaaa, bbbbbbbbbbbbbbbbbbbbb, + ccccccccccccccccccc) +foo.bar( + baz, + quux(thud=42), + aaaaaaaaaaaaaaaaaaaaaa=1, + bbbbbbbbbbbbbbbbbbbbb=2, + ccccccccccccccccccc=3) +""" + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB113210278(self): + unformatted_code = """\ +def _(): + aaaaaaaaaaa = bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.cccccccccccccccccccccccccccc(\ +eeeeeeeeeeeeeeeeeeeeeeeeee.fffffffffffffffffffffffffffffffffffffff.\ +ggggggggggggggggggggggggggggggggg.hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh()) +""" + expected_formatted_code = """\ +def _(): + aaaaaaaaaaa = bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.cccccccccccccccccccccccccccc( + eeeeeeeeeeeeeeeeeeeeeeeeee.fffffffffffffffffffffffffffffffffffffff + .ggggggggggggggggggggggggggggggggg.hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh()) +""" + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB77923341(self): + code = """\ +def f(): + if (aaaaaaaaaaaaaa.bbbbbbbbbbbb.ccccc <= 0 and # pytype: disable=attribute-error + ddddddddddd.eeeeeeeee == constants.FFFFFFFFFFFFFF): + raise "yo" +""" + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB77329955(self): + code = """\ +class _(): + + @parameterized.named_parameters( + ('ReadyExpiredSuccess', True, True, True, None, None), + ('SpannerUpdateFails', True, False, True, None, None), + ('ReadyNotExpired', False, True, True, True, None), + # ('ReadyNotExpiredNotHealthy', False, True, True, False, True), + # ('ReadyNotExpiredNotHealthyErrorFails', False, True, True, False, False + # ('ReadyNotExpiredNotHealthyUpdateFails', False, False, True, False, True + ) + def _(): + pass +""" + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB65197969(self): + unformatted_code = """\ +class _(): + + def _(): + return timedelta(seconds=max(float(time_scale), small_interval) * + 1.41 ** min(num_attempts, 9)) +""" + expected_formatted_code = """\ +class _(): + + def _(): + return timedelta( + seconds=max(float(time_scale), small_interval) * + 1.41**min(num_attempts, 9)) +""" + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB65546221(self): + unformatted_code = """\ +SUPPORTED_PLATFORMS = ( + "centos-6", + "centos-7", + "ubuntu-1204-precise", + "ubuntu-1404-trusty", + "ubuntu-1604-xenial", + "debian-7-wheezy", + "debian-8-jessie", + "debian-9-stretch",) +""" + expected_formatted_code = """\ +SUPPORTED_PLATFORMS = ( + "centos-6", + "centos-7", + "ubuntu-1204-precise", + "ubuntu-1404-trusty", + "ubuntu-1604-xenial", + "debian-7-wheezy", + "debian-8-jessie", + "debian-9-stretch", +) +""" + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB30500455(self): + unformatted_code = """\ +INITIAL_SYMTAB = dict([(name, 'exception#' + name) for name in INITIAL_EXCEPTIONS +] * [(name, 'type#' + name) for name in INITIAL_TYPES] + [ + (name, 'function#' + name) for name in INITIAL_FUNCTIONS +] + [(name, 'const#' + name) for name in INITIAL_CONSTS]) +""" + expected_formatted_code = """\ +INITIAL_SYMTAB = dict( + [(name, 'exception#' + name) for name in INITIAL_EXCEPTIONS] * + [(name, 'type#' + name) for name in INITIAL_TYPES] + + [(name, 'function#' + name) for name in INITIAL_FUNCTIONS] + + [(name, 'const#' + name) for name in INITIAL_CONSTS]) +""" + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB38343525(self): + code = """\ +# This does foo. +@arg.String('some_path_to_a_file', required=True) +# This does bar. +@arg.String('some_path_to_a_file', required=True) +def f(): + print 1 +""" + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB37099651(self): + unformatted_code = """\ +_MEMCACHE = lazy.MakeLazy( + # pylint: disable=g-long-lambda + lambda: function.call.mem.clients(FLAGS.some_flag_thingy, default_namespace=_LAZY_MEM_NAMESPACE, allow_pickle=True) + # pylint: enable=g-long-lambda +) +""" + expected_formatted_code = """\ +_MEMCACHE = lazy.MakeLazy( + # pylint: disable=g-long-lambda + lambda: function.call.mem.clients( + FLAGS.some_flag_thingy, + default_namespace=_LAZY_MEM_NAMESPACE, + allow_pickle=True) + # pylint: enable=g-long-lambda +) +""" + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB33228502(self): + unformatted_code = """\ +def _(): + success_rate_stream_table = module.Precompute( + query_function=module.DefineQueryFunction( + name='Response error ratio', + expression=((m.Fetch( + m.Raw('monarch.BorgTask', + '/corp/travel/trips2/dispatcher/email/response'), + {'borg_job': module_config.job, 'metric:response_type': 'SUCCESS'}), + m.Fetch(m.Raw('monarch.BorgTask', '/corp/travel/trips2/dispatcher/email/response'), {'borg_job': module_config.job})) + | m.Window(m.Delta('1h')) + | m.Join('successes', 'total') + | m.Point(m.VAL['successes'] / m.VAL['total'])))) +""" + expected_formatted_code = """\ +def _(): + success_rate_stream_table = module.Precompute( + query_function=module.DefineQueryFunction( + name='Response error ratio', + expression=( + (m.Fetch( + m.Raw('monarch.BorgTask', + '/corp/travel/trips2/dispatcher/email/response'), { + 'borg_job': module_config.job, + 'metric:response_type': 'SUCCESS' + }), + m.Fetch( + m.Raw('monarch.BorgTask', + '/corp/travel/trips2/dispatcher/email/response'), + {'borg_job': module_config.job})) + | m.Window(m.Delta('1h')) + | m.Join('successes', 'total') + | m.Point(m.VAL['successes'] / m.VAL['total'])))) +""" + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB30394228(self): + code = """\ +class _(): + + def _(self): + return some.randome.function.calling( + wf, None, alert.Format(alert.subject, alert=alert, threshold=threshold), + alert.Format(alert.body, alert=alert, threshold=threshold), + alert.html_formatting) +""" + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB65246454(self): + unformatted_code = """\ +class _(): + + def _(self): + self.assertEqual({i.id + for i in successful_instances}, + {i.id + for i in self._statuses.successful_instances}) +""" + expected_formatted_code = """\ +class _(): + + def _(self): + self.assertEqual({i.id for i in successful_instances}, + {i.id for i in self._statuses.successful_instances}) +""" + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB67935450(self): + unformatted_code = """\ +def _(): + return ( + (Gauge( + metric='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', + group_by=group_by + ['metric:process_name'], + metric_filter={'metric:process_name': process_name_re}), + Gauge( + metric='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb', + group_by=group_by + ['metric:process_name'], + metric_filter={'metric:process_name': process_name_re})) + | expr.Join( + left_name='start', left_default=0, right_name='end', right_default=0) + | m.Point( + m.Cond(m.VAL['end'] != 0, m.VAL['end'], k.TimestampMicros() / + 1000000L) - m.Cond(m.VAL['start'] != 0, m.VAL['start'], + m.TimestampMicros() / 1000000L))) +""" + expected_formatted_code = """\ +def _(): + return ( + (Gauge( + metric='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', + group_by=group_by + ['metric:process_name'], + metric_filter={'metric:process_name': process_name_re}), + Gauge( + metric='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb', + group_by=group_by + ['metric:process_name'], + metric_filter={'metric:process_name': process_name_re})) + | expr.Join( + left_name='start', left_default=0, right_name='end', right_default=0) + | m.Point( + m.Cond(m.VAL['end'] != 0, m.VAL['end'], + k.TimestampMicros() / 1000000L) - + m.Cond(m.VAL['start'] != 0, m.VAL['start'], + m.TimestampMicros() / 1000000L))) +""" + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB66011084(self): + unformatted_code = """\ +X = { +"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa": # Comment 1. +([] if True else [ # Comment 2. + "bbbbbbbbbbbbbbbbbbb", # Comment 3. + "cccccccccccccccccccccccc", # Comment 4. + "ddddddddddddddddddddddddd", # Comment 5. + "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", # Comment 6. + "fffffffffffffffffffffffffffffff", # Comment 7. + "ggggggggggggggggggggggggggg", # Comment 8. + "hhhhhhhhhhhhhhhhhh", # Comment 9. +]), +} +""" + expected_formatted_code = """\ +X = { + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa": # Comment 1. + ([] if True else [ # Comment 2. + "bbbbbbbbbbbbbbbbbbb", # Comment 3. + "cccccccccccccccccccccccc", # Comment 4. + "ddddddddddddddddddddddddd", # Comment 5. + "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", # Comment 6. + "fffffffffffffffffffffffffffffff", # Comment 7. + "ggggggggggggggggggggggggggg", # Comment 8. + "hhhhhhhhhhhhhhhhhh", # Comment 9. + ]), +} +""" + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB67455376(self): + unformatted_code = """\ +sponge_ids.extend(invocation.id() for invocation in self._client.GetInvocationsByLabels(labels)) +""" + expected_formatted_code = """\ +sponge_ids.extend(invocation.id() + for invocation in self._client.GetInvocationsByLabels(labels)) +""" + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB35210351(self): + unformatted_code = """\ +def _(): + config.AnotherRuleThing( + 'the_title_to_the_thing_here', + {'monitorname': 'firefly', + 'service': ACCOUNTING_THING, + 'severity': 'the_bug', + 'monarch_module_name': alerts.TheLabel(qa_module_regexp, invert=True)}, + fanout, + alerts.AlertUsToSomething( + GetTheAlertToIt('the_title_to_the_thing_here'), + GetNotificationTemplate('your_email_here'))) +""" + expected_formatted_code = """\ +def _(): + config.AnotherRuleThing( + 'the_title_to_the_thing_here', { + 'monitorname': 'firefly', + 'service': ACCOUNTING_THING, + 'severity': 'the_bug', + 'monarch_module_name': alerts.TheLabel(qa_module_regexp, invert=True) + }, fanout, + alerts.AlertUsToSomething( + GetTheAlertToIt('the_title_to_the_thing_here'), + GetNotificationTemplate('your_email_here'))) +""" + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB34774905(self): + unformatted_code = """\ +x=[VarExprType(ir_name=IrName( value='x', +expr_type=UnresolvedAttrExprType( atom=UnknownExprType(), attr_name=IrName( + value='x', expr_type=UnknownExprType(), usage='UNKNOWN', fqn=None, + astn=None), usage='REF'), usage='ATTR', fqn='.x', astn=None))] +""" + expected_formatted_code = """\ +x = [ + VarExprType( + ir_name=IrName( + value='x', + expr_type=UnresolvedAttrExprType( + atom=UnknownExprType(), + attr_name=IrName( + value='x', + expr_type=UnknownExprType(), + usage='UNKNOWN', + fqn=None, + astn=None), + usage='REF'), + usage='ATTR', + fqn='.x', + astn=None)) +] +""" + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB65176185(self): + code = """\ +xx = zip(*[(a, b) for (a, b, c) in yy]) +""" + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB35210166(self): + unformatted_code = """\ +def _(): + query = ( + m.Fetch(n.Raw('monarch.BorgTask', '/proc/container/memory/usage'), { 'borg_user': borguser, 'borg_job': jobname }) + | o.Window(m.Align('5m')) | p.GroupBy(['borg_user', 'borg_job', 'borg_cell'], q.Mean())) +""" + expected_formatted_code = """\ +def _(): + query = ( + m.Fetch( + n.Raw('monarch.BorgTask', '/proc/container/memory/usage'), { + 'borg_user': borguser, + 'borg_job': jobname + }) + | o.Window(m.Align('5m')) + | p.GroupBy(['borg_user', 'borg_job', 'borg_cell'], q.Mean())) +""" + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB32167774(self): + unformatted_code = """\ +X = ( + 'is_official', + 'is_cover', + 'is_remix', + 'is_instrumental', + 'is_live', + 'has_lyrics', + 'is_album', + 'is_compilation',) +""" + expected_formatted_code = """\ +X = ( + 'is_official', + 'is_cover', + 'is_remix', + 'is_instrumental', + 'is_live', + 'has_lyrics', + 'is_album', + 'is_compilation', +) +""" + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB66912275(self): + unformatted_code = """\ +def _(): + with self.assertRaisesRegexp(errors.HttpError, 'Invalid'): + patch_op = api_client.forwardingRules().patch( + project=project_id, + region=region, + forwardingRule=rule_name, + body={'fingerprint': base64.urlsafe_b64encode('invalid_fingerprint')}).execute() +""" + expected_formatted_code = """\ +def _(): + with self.assertRaisesRegexp(errors.HttpError, 'Invalid'): + patch_op = api_client.forwardingRules().patch( + project=project_id, + region=region, + forwardingRule=rule_name, + body={ + 'fingerprint': base64.urlsafe_b64encode('invalid_fingerprint') + }).execute() +""" + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB67312284(self): + code = """\ +def _(): + self.assertEqual( + [u'to be published 2', u'to be published 1', u'to be published 0'], + [el.text for el in page.first_column_tds]) +""" + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB65241516(self): + unformatted_code = """\ +checkpoint_files = gfile.Glob(os.path.join(TrainTraceDir(unit_key, "*", "*"), embedding_model.CHECKPOINT_FILENAME + "-*")) +""" + expected_formatted_code = """\ +checkpoint_files = gfile.Glob( + os.path.join( + TrainTraceDir(unit_key, "*", "*"), + embedding_model.CHECKPOINT_FILENAME + "-*")) +""" + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB37460004(self): + code = textwrap.dedent("""\ + assert all(s not in (_SENTINEL, None) for s in nested_schemas + ), 'Nested schemas should never contain None/_SENTINEL' + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB36806207(self): + code = """\ +def _(): + linearity_data = [[row] for row in [ + "%.1f mm" % (np.mean(linearity_values["pos_error"]) * 1000.0), + "%.1f mm" % (np.max(linearity_values["pos_error"]) * 1000.0), + "%.1f mm" % (np.mean(linearity_values["pos_error_chunk_mean"]) * 1000.0), + "%.1f mm" % (np.max(linearity_values["pos_error_chunk_max"]) * 1000.0), + "%.1f deg" % math.degrees(np.mean(linearity_values["rot_noise"])), + "%.1f deg" % math.degrees(np.max(linearity_values["rot_noise"])), + "%.1f deg" % math.degrees(np.mean(linearity_values["rot_drift"])), + "%.1f deg" % math.degrees(np.max(linearity_values["rot_drift"])), + "%.1f%%" % (np.max(linearity_values["pos_discontinuity"]) * 100.0), + "%.1f%%" % (np.max(linearity_values["rot_discontinuity"]) * 100.0) + ]] +""" + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB36215507(self): + code = textwrap.dedent("""\ + class X(): + + def _(): + aaaaaaaaaaaaa._bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb( + mmmmmmmmmmmmm, nnnnn, ooooooooo, + _(ppppppppppppppppppppppppppppppppppppp), + *(qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq), + **(qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq)) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB35212469(self): + unformatted_code = textwrap.dedent("""\ + def _(): + X = { + 'retain': { + 'loadtest': # This is a comment in the middle of a dictionary entry + ('/some/path/to/a/file/that/is/needed/by/this/process') + } + } + """) + expected_formatted_code = textwrap.dedent("""\ + def _(): + X = { + 'retain': { + 'loadtest': # This is a comment in the middle of a dictionary entry + ('/some/path/to/a/file/that/is/needed/by/this/process') + } + } + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB31063453(self): + unformatted_code = textwrap.dedent("""\ + def _(): + while ((not mpede_proc) or ((time_time() - last_modified) < FLAGS_boot_idle_timeout)): + pass + """) + expected_formatted_code = textwrap.dedent("""\ + def _(): + while ((not mpede_proc) or + ((time_time() - last_modified) < FLAGS_boot_idle_timeout)): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB35021894(self): + unformatted_code = textwrap.dedent("""\ + def _(): + labelacl = Env(qa={ + 'read': 'name/some-type-of-very-long-name-for-reading-perms', + 'modify': 'name/some-other-type-of-very-long-name-for-modifying' + }, + prod={ + 'read': 'name/some-type-of-very-long-name-for-reading-perms', + 'modify': 'name/some-other-type-of-very-long-name-for-modifying' + }) + """) + expected_formatted_code = textwrap.dedent("""\ + def _(): + labelacl = Env( + qa={ + 'read': 'name/some-type-of-very-long-name-for-reading-perms', + 'modify': 'name/some-other-type-of-very-long-name-for-modifying' + }, + prod={ + 'read': 'name/some-type-of-very-long-name-for-reading-perms', + 'modify': 'name/some-other-type-of-very-long-name-for-modifying' + }) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB34682902(self): + unformatted_code = textwrap.dedent("""\ + logging.info("Mean angular velocity norm: %.3f", np.linalg.norm(np.mean(ang_vel_arr, axis=0))) + """) + expected_formatted_code = textwrap.dedent("""\ + logging.info("Mean angular velocity norm: %.3f", + np.linalg.norm(np.mean(ang_vel_arr, axis=0))) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB33842726(self): + unformatted_code = textwrap.dedent("""\ + class _(): + def _(): + hints.append(('hg tag -f -l -r %s %s # %s' % (short(ctx.node( + )), candidatetag, firstline))[:78]) + """) + expected_formatted_code = textwrap.dedent("""\ + class _(): + def _(): + hints.append(('hg tag -f -l -r %s %s # %s' % + (short(ctx.node()), candidatetag, firstline))[:78]) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB32931780(self): + unformatted_code = textwrap.dedent("""\ + environments = { + 'prod': { + # this is a comment before the first entry. + 'entry one': + 'an entry.', + # this is the comment before the second entry. + 'entry number 2.': + 'something', + # this is the comment before the third entry and it's a doozy. So big! + 'who': + 'allin', + # This is an entry that has a dictionary in it. It's ugly + 'something': { + 'page': ['this-is-a-page@xxxxxxxx.com', 'something-for-eml@xxxxxx.com'], + 'bug': ['bugs-go-here5300@xxxxxx.com'], + 'email': ['sometypeof-email@xxxxxx.com'], + }, + # a short comment + 'yolo!!!!!': + 'another-email-address@xxxxxx.com', + # this entry has an implicit string concatenation + 'implicit': + 'https://this-is-very-long.url-addr.com/' + '?something=something%20some%20more%20stuff..', + # A more normal entry. + '.....': + 'this is an entry', + } + } + """) + expected_formatted_code = textwrap.dedent("""\ + environments = { + 'prod': { + # this is a comment before the first entry. + 'entry one': 'an entry.', + # this is the comment before the second entry. + 'entry number 2.': 'something', + # this is the comment before the third entry and it's a doozy. So big! + 'who': 'allin', + # This is an entry that has a dictionary in it. It's ugly + 'something': { + 'page': [ + 'this-is-a-page@xxxxxxxx.com', 'something-for-eml@xxxxxx.com' + ], + 'bug': ['bugs-go-here5300@xxxxxx.com'], + 'email': ['sometypeof-email@xxxxxx.com'], + }, + # a short comment + 'yolo!!!!!': 'another-email-address@xxxxxx.com', + # this entry has an implicit string concatenation + 'implicit': 'https://this-is-very-long.url-addr.com/' + '?something=something%20some%20more%20stuff..', + # A more normal entry. + '.....': 'this is an entry', + } + } + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB33047408(self): + code = textwrap.dedent("""\ + def _(): + for sort in (sorts or []): + request['sorts'].append({ + 'field': { + 'user_field': sort + }, + 'order': 'ASCENDING' + }) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB32714745(self): + code = textwrap.dedent("""\ + class _(): + + def _BlankDefinition(): + '''Return a generic blank dictionary for a new field.''' + return { + 'type': '', + 'validation': '', + 'name': 'fieldname', + 'label': 'Field Label', + 'help': '', + 'initial': '', + 'required': False, + 'required_msg': 'Required', + 'invalid_msg': 'Please enter a valid value', + 'options': { + 'regex': '', + 'widget_attr': '', + 'choices_checked': '', + 'choices_count': '', + 'choices': {} + }, + 'isnew': True, + 'dirty': False, + } + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB32737279(self): + unformatted_code = textwrap.dedent("""\ + here_is_a_dict = { + 'key': + # Comment. + 'value' + } + """) + expected_formatted_code = textwrap.dedent("""\ + here_is_a_dict = { + 'key': # Comment. + 'value' + } + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB32570937(self): + code = textwrap.dedent("""\ + def _(): + if (job_message.ball not in ('*', ball) or + job_message.call not in ('*', call) or + job_message.mall not in ('*', job_name)): + return False + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB31937033(self): + code = textwrap.dedent("""\ + class _(): + + def __init__(self, metric, fields_cb=None): + self._fields_cb = fields_cb or (lambda *unused_args, **unused_kwargs: {}) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB31911533(self): + code = """\ +class _(): + + @parameterized.NamedParameters( + ('IncludingModInfoWithHeaderList', AAAA, aaaa), + ('IncludingModInfoWithoutHeaderList', BBBB, bbbbb), + ('ExcludingModInfoWithHeaderList', CCCCC, cccc), + ('ExcludingModInfoWithoutHeaderList', DDDDD, ddddd), + ) + def _(): + pass +""" + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB31847238(self): + unformatted_code = textwrap.dedent("""\ + class _(): + + def aaaaa(self, bbbbb, cccccccccccccc=None): # TODO(who): pylint: disable=unused-argument + return 1 + + def xxxxx(self, yyyyy, zzzzzzzzzzzzzz=None): # A normal comment that runs over the column limit. + return 1 + """) + expected_formatted_code = textwrap.dedent("""\ + class _(): + + def aaaaa(self, bbbbb, cccccccccccccc=None): # TODO(who): pylint: disable=unused-argument + return 1 + + def xxxxx( + self, + yyyyy, + zzzzzzzzzzzzzz=None): # A normal comment that runs over the column limit. + return 1 + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB30760569(self): + unformatted_code = textwrap.dedent("""\ + {'1234567890123456789012345678901234567890123456789012345678901234567890': + '1234567890123456789012345678901234567890'} + """) + expected_formatted_code = textwrap.dedent("""\ + { + '1234567890123456789012345678901234567890123456789012345678901234567890': + '1234567890123456789012345678901234567890' + } + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB26034238(self): + unformatted_code = textwrap.dedent("""\ + class Thing: + + def Function(self): + thing.Scrape('/aaaaaaaaa/bbbbbbbbbb/ccccc/dddd/eeeeeeeeeeeeee/ffffffffffffff').AndReturn(42) + """) + expected_formatted_code = textwrap.dedent("""\ + class Thing: + + def Function(self): + thing.Scrape( + '/aaaaaaaaa/bbbbbbbbbb/ccccc/dddd/eeeeeeeeeeeeee/ffffffffffffff' + ).AndReturn(42) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB30536435(self): + unformatted_code = textwrap.dedent("""\ + def main(unused_argv): + if True: + if True: + aaaaaaaaaaa.comment('import-from[{}] {} {}'.format( + bbbbbbbbb.usage, + ccccccccc.within, + imports.ddddddddddddddddddd(name_item.ffffffffffffffff))) + """) + expected_formatted_code = textwrap.dedent("""\ + def main(unused_argv): + if True: + if True: + aaaaaaaaaaa.comment('import-from[{}] {} {}'.format( + bbbbbbbbb.usage, ccccccccc.within, + imports.ddddddddddddddddddd(name_item.ffffffffffffffff))) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB30442148(self): + unformatted_code = textwrap.dedent("""\ + def lulz(): + return (some_long_module_name.SomeLongClassName. + some_long_attribute_name.some_long_method_name()) + """) + expected_formatted_code = textwrap.dedent("""\ + def lulz(): + return (some_long_module_name.SomeLongClassName.some_long_attribute_name + .some_long_method_name()) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB26868213(self): + unformatted_code = textwrap.dedent("""\ + def _(): + xxxxxxxxxxxxxxxxxxx = { + 'ssssss': {'ddddd': 'qqqqq', + 'p90': aaaaaaaaaaaaaaaaa, + 'p99': bbbbbbbbbbbbbbbbb, + 'lllllllllllll': yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy(),}, + 'bbbbbbbbbbbbbbbbbbbbbbbbbbbb': { + 'ddddd': 'bork bork bork bo', + 'p90': wwwwwwwwwwwwwwwww, + 'p99': wwwwwwwwwwwwwwwww, + 'lllllllllllll': None, # use the default + } + } + """) + expected_formatted_code = textwrap.dedent("""\ + def _(): + xxxxxxxxxxxxxxxxxxx = { + 'ssssss': { + 'ddddd': 'qqqqq', + 'p90': aaaaaaaaaaaaaaaaa, + 'p99': bbbbbbbbbbbbbbbbb, + 'lllllllllllll': yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy(), + }, + 'bbbbbbbbbbbbbbbbbbbbbbbbbbbb': { + 'ddddd': 'bork bork bork bo', + 'p90': wwwwwwwwwwwwwwwww, + 'p99': wwwwwwwwwwwwwwwww, + 'lllllllllllll': None, # use the default + } + } + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB30173198(self): + code = textwrap.dedent("""\ + class _(): + + def _(): + self.assertFalse( + evaluation_runner.get_larps_in_eval_set('these_arent_the_larps')) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB29908765(self): + code = textwrap.dedent("""\ + class _(): + + def __repr__(self): + return '' % ( + self._id, self._stub._stub.rpc_channel().target()) # pylint:disable=protected-access + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB30087362(self): + code = textwrap.dedent("""\ + def _(): + for s in sorted(env['foo']): + bar() + # This is a comment + + # This is another comment + foo() + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB30087363(self): + code = textwrap.dedent("""\ + if False: + bar() + # This is a comment + # This is another comment + elif True: + foo() + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB29093579(self): + unformatted_code = textwrap.dedent("""\ + def _(): + _xxxxxxxxxxxxxxx(aaaaaaaa, bbbbbbbbbbbbbb.cccccccccc[ + dddddddddddddddddddddddddddd.eeeeeeeeeeeeeeeeeeeeee.fffffffffffffffffffff]) + """) + expected_formatted_code = textwrap.dedent("""\ + def _(): + _xxxxxxxxxxxxxxx( + aaaaaaaa, + bbbbbbbbbbbbbb.cccccccccc[dddddddddddddddddddddddddddd + .eeeeeeeeeeeeeeeeeeeeee.fffffffffffffffffffff]) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB26382315(self): + code = textwrap.dedent("""\ + @hello_world + # This is a first comment + + # Comment + def foo(): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB27616132(self): + unformatted_code = textwrap.dedent("""\ + if True: + query.fetch_page.assert_has_calls([ + mock.call(100, + start_cursor=None), + mock.call(100, + start_cursor=cursor_1), + mock.call(100, + start_cursor=cursor_2), + ]) + """) + expected_formatted_code = textwrap.dedent("""\ + if True: + query.fetch_page.assert_has_calls([ + mock.call(100, start_cursor=None), + mock.call(100, start_cursor=cursor_1), + mock.call(100, start_cursor=cursor_2), + ]) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB27590179(self): + unformatted_code = textwrap.dedent("""\ + if True: + if True: + self.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = ( + { True: + self.bbb.cccccccccc(ddddddddddddddddddddddd.eeeeeeeeeeeeeeeeeeeeee), + False: + self.bbb.cccccccccc(ddddddddddddddddddddddd.eeeeeeeeeeeeeeeeeeeeee) + }) + """) + expected_formatted_code = textwrap.dedent("""\ + if True: + if True: + self.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = ({ + True: + self.bbb.cccccccccc(ddddddddddddddddddddddd.eeeeeeeeeeeeeeeeeeeeee), + False: + self.bbb.cccccccccc(ddddddddddddddddddddddd.eeeeeeeeeeeeeeeeeeeeee) + }) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB27266946(self): + unformatted_code = textwrap.dedent("""\ + def _(): + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = (self.bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.cccccccccccccccccccccccccccccccccccc) + """) + expected_formatted_code = textwrap.dedent("""\ + def _(): + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = ( + self.bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb + .cccccccccccccccccccccccccccccccccccc) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB25505359(self): + code = textwrap.dedent("""\ + _EXAMPLE = { + 'aaaaaaaaaaaaaa': [{ + 'bbbb': 'cccccccccccccccccccccc', + 'dddddddddddd': [] + }, { + 'bbbb': 'ccccccccccccccccccc', + 'dddddddddddd': [] + }] + } + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB25324261(self): + code = textwrap.dedent("""\ + aaaaaaaaa = set(bbbb.cccc + for ddd in eeeeee.fffffffffff.gggggggggggggggg + for cccc in ddd.specification) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB25136704(self): + code = textwrap.dedent("""\ + class f: + + def test(self): + self.bbbbbbb[0]['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', { + 'xxxxxx': 'yyyyyy' + }] = cccccc.ddd('1m', '10x1+1') + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB25165602(self): + code = textwrap.dedent("""\ + def f(): + ids = {u: i for u, i in zip(self.aaaaa, xrange(42, 42 + len(self.aaaaaa)))} + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB25157123(self): + code = textwrap.dedent("""\ + def ListArgs(): + FairlyLongMethodName([relatively_long_identifier_for_a_list], + another_argument_with_a_long_identifier) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB25136820(self): + unformatted_code = textwrap.dedent("""\ + def foo(): + return collections.OrderedDict({ + # Preceding comment. + 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa': + '$bbbbbbbbbbbbbbbbbbbbbbbb', + }) + """) + expected_formatted_code = textwrap.dedent("""\ + def foo(): + return collections.OrderedDict({ + # Preceding comment. + 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa': + '$bbbbbbbbbbbbbbbbbbbbbbbb', + }) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB25131481(self): + unformatted_code = textwrap.dedent("""\ + APPARENT_ACTIONS = ('command_type', { + 'materialize': lambda x: some_type_of_function('materialize ' + x.command_def), + '#': lambda x: x # do nothing + }) + """) + expected_formatted_code = textwrap.dedent("""\ + APPARENT_ACTIONS = ( + 'command_type', + { + 'materialize': + lambda x: some_type_of_function('materialize ' + x.command_def), + '#': + lambda x: x # do nothing + }) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB23445244(self): + unformatted_code = textwrap.dedent("""\ + def foo(): + if True: + return xxxxxxxxxxxxxxxx( + command, + extra_env={ + "OOOOOOOOOOOOOOOOOOOOO": FLAGS.zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz, + "PPPPPPPPPPPPPPPPPPPPP": + FLAGS.aaaaaaaaaaaaaa + FLAGS.bbbbbbbbbbbbbbbbbbb, + }) + """) + expected_formatted_code = textwrap.dedent("""\ + def foo(): + if True: + return xxxxxxxxxxxxxxxx( + command, + extra_env={ + "OOOOOOOOOOOOOOOOOOOOO": + FLAGS.zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz, + "PPPPPPPPPPPPPPPPPPPPP": + FLAGS.aaaaaaaaaaaaaa + FLAGS.bbbbbbbbbbbbbbbbbbb, + }) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB20559654(self): + unformatted_code = textwrap.dedent("""\ + class A(object): + + def foo(self): + unused_error, result = server.Query( + ['AA BBBB CCC DDD EEEEEEEE X YY ZZZZ FFF EEE AAAAAAAA'], + aaaaaaaaaaa=True, bbbbbbbb=None) + """) + expected_formatted_code = textwrap.dedent("""\ + class A(object): + + def foo(self): + unused_error, result = server.Query( + ['AA BBBB CCC DDD EEEEEEEE X YY ZZZZ FFF EEE AAAAAAAA'], + aaaaaaaaaaa=True, + bbbbbbbb=None) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB23943842(self): + unformatted_code = textwrap.dedent("""\ + class F(): + def f(): + self.assertDictEqual( + accounts, { + 'foo': + {'account': 'foo', + 'lines': 'l1\\nl2\\nl3\\n1 line(s) were elided.'}, + 'bar': {'account': 'bar', + 'lines': 'l5\\nl6\\nl7'}, + 'wiz': {'account': 'wiz', + 'lines': 'l8'} + }) + """) + expected_formatted_code = textwrap.dedent("""\ + class F(): + + def f(): + self.assertDictEqual( + accounts, { + 'foo': { + 'account': 'foo', + 'lines': 'l1\\nl2\\nl3\\n1 line(s) were elided.' + }, + 'bar': { + 'account': 'bar', + 'lines': 'l5\\nl6\\nl7' + }, + 'wiz': { + 'account': 'wiz', + 'lines': 'l8' + } + }) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB20551180(self): + unformatted_code = textwrap.dedent("""\ + def foo(): + if True: + return (struct.pack('aaaa', bbbbbbbbbb, ccccccccccccccc, dddddddd) + eeeeeee) + """) + expected_formatted_code = textwrap.dedent("""\ + def foo(): + if True: + return (struct.pack('aaaa', bbbbbbbbbb, ccccccccccccccc, dddddddd) + + eeeeeee) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB23944849(self): + unformatted_code = textwrap.dedent("""\ + class A(object): + def xxxxxxxxx(self, aaaaaaa, bbbbbbb=ccccccccccc, dddddd=300, eeeeeeeeeeeeee=None, fffffffffffffff=0): + pass + """) + expected_formatted_code = textwrap.dedent("""\ + class A(object): + + def xxxxxxxxx(self, + aaaaaaa, + bbbbbbb=ccccccccccc, + dddddd=300, + eeeeeeeeeeeeee=None, + fffffffffffffff=0): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB23935890(self): + unformatted_code = textwrap.dedent("""\ + class F(): + def functioni(self, aaaaaaa, bbbbbbb, cccccc, dddddddddddddd, eeeeeeeeeeeeeee): + pass + """) + expected_formatted_code = textwrap.dedent("""\ + class F(): + + def functioni(self, aaaaaaa, bbbbbbb, cccccc, dddddddddddddd, + eeeeeeeeeeeeeee): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB28414371(self): + code = textwrap.dedent("""\ + def _(): + return ((m.fffff( + m.rrr('mmmmmmmmmmmmmmmm', 'ssssssssssssssssssssssssss'), ffffffffffffffff) + | m.wwwwww(m.ddddd('1h')) + | m.ggggggg(bbbbbbbbbbbbbbb) + | m.ppppp( + (1 - m.ffffffffffffffff(llllllllllllllllllllll * 1000000, m.vvv)) + * m.ddddddddddddddddd(m.vvv)), + m.fffff( + m.rrr('mmmmmmmmmmmmmmmm', 'sssssssssssssssssssssss'), + dict( + ffffffffffffffff, **{ + 'mmmmmm:ssssss': + m.rrrrrrrrrrr('|'.join(iiiiiiiiiiiiii), iiiiii=True) + })) + | m.wwwwww(m.rrrr('1h')) + | m.ggggggg(bbbbbbbbbbbbbbb)) + | m.jjjj() + | m.ppppp(m.vvv[0] + m.vvv[1])) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB20127686(self): + code = textwrap.dedent("""\ + def f(): + if True: + return ((m.fffff( + m.rrr('xxxxxxxxxxxxxxxx', + 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy'), + mmmmmmmm) + | m.wwwwww(m.rrrr(self.tttttttttt, self.mmmmmmmmmmmmmmmmmmmmm)) + | m.ggggggg(self.gggggggg, m.sss()), m.fffff('aaaaaaaaaaaaaaaa') + | m.wwwwww(m.ddddd(self.tttttttttt, self.mmmmmmmmmmmmmmmmmmmmm)) + | m.ggggggg(self.gggggggg)) + | m.jjjj() + | m.ppppp(m.VAL[0] / m.VAL[1])) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB20016122(self): + unformatted_code = textwrap.dedent("""\ + from a_very_long_or_indented_module_name_yada_yada import (long_argument_1, + long_argument_2) + """) + expected_formatted_code = textwrap.dedent("""\ + from a_very_long_or_indented_module_name_yada_yada import ( + long_argument_1, long_argument_2) + """) + + try: + style.SetGlobalStyle( + style.CreateStyleFromConfig( + '{based_on_style: pep8, split_penalty_import_names: 350}')) + + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, + reformatter.Reformat(uwlines)) + finally: + style.SetGlobalStyle(style.CreatePEP8Style()) + + code = textwrap.dedent("""\ + class foo(): + + def __eq__(self, other): + return (isinstance(other, type(self)) + and self.xxxxxxxxxxx == other.xxxxxxxxxxx + and self.xxxxxxxx == other.xxxxxxxx + and self.aaaaaaaaaaaa == other.aaaaaaaaaaaa + and self.bbbbbbbbbbb == other.bbbbbbbbbbb + and self.ccccccccccccccccc == other.ccccccccccccccccc + and self.ddddddddddddddddddddddd == other.ddddddddddddddddddddddd + and self.eeeeeeeeeeee == other.eeeeeeeeeeee + and self.ffffffffffffff == other.time_completed + and self.gggggg == other.gggggg and self.hhh == other.hhh + and len(self.iiiiiiii) == len(other.iiiiiiii) + and all(jjjjjjj in other.iiiiiiii for jjjjjjj in self.iiiiiiii)) + """) + + try: + style.SetGlobalStyle( + style.CreateStyleFromConfig('{based_on_style: yapf, ' + 'split_before_logical_operator: True}')) + + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + finally: + style.SetGlobalStyle(style.CreateYapfStyle()) + + def testB22527411(self): + unformatted_code = textwrap.dedent("""\ + def f(): + if True: + aaaaaa.bbbbbbbbbbbbbbbbbbbb[-1].cccccccccccccc.ddd().eeeeeeee(ffffffffffffff) + """) + expected_formatted_code = textwrap.dedent("""\ + def f(): + if True: + aaaaaa.bbbbbbbbbbbbbbbbbbbb[-1].cccccccccccccc.ddd().eeeeeeee( + ffffffffffffff) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB20849933(self): + unformatted_code = textwrap.dedent("""\ + def main(unused_argv): + if True: + aaaaaaaa = { + 'xxx': '%s/cccccc/ddddddddddddddddddd.jar' % + (eeeeee.FFFFFFFFFFFFFFFFFF), + } + """) + expected_formatted_code = textwrap.dedent("""\ + def main(unused_argv): + if True: + aaaaaaaa = { + 'xxx': + '%s/cccccc/ddddddddddddddddddd.jar' % (eeeeee.FFFFFFFFFFFFFFFFFF), + } + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB20813997(self): + code = textwrap.dedent("""\ + def myfunc_1(): + myarray = numpy.zeros((2, 2, 2)) + print(myarray[:, 1, :]) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB20605036(self): + code = textwrap.dedent("""\ + foo = { + 'aaaa': { + # A comment for no particular reason. + 'xxxxxxxx': 'bbbbbbbbb', + 'yyyyyyyyyyyyyyyyyy': 'cccccccccccccccccccccccccccccc' + 'dddddddddddddddddddddddddddddddddddddddddd', + } + } + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB20562732(self): + code = textwrap.dedent("""\ + foo = [ + # Comment about first list item + 'First item', + # Comment about second list item + 'Second item', + ] + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB20128830(self): + code = textwrap.dedent("""\ + a = { + 'xxxxxxxxxxxxxxxxxxxx': { + 'aaaa': + 'mmmmmmm', + 'bbbbb': + 'mmmmmmmmmmmmmmmmmmmmm', + 'cccccccccc': [ + 'nnnnnnnnnnn', + 'ooooooooooo', + 'ppppppppppp', + 'qqqqqqqqqqq', + ], + }, + } + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB20073838(self): + code = textwrap.dedent("""\ + class DummyModel(object): + + def do_nothing(self, class_1_count): + if True: + class_0_count = num_votes - class_1_count + return ('{class_0_name}={class_0_count}, {class_1_name}={class_1_count}' + .format( + class_0_name=self.class_0_name, + class_0_count=class_0_count, + class_1_name=self.class_1_name, + class_1_count=class_1_count)) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB19626808(self): + code = textwrap.dedent("""\ + if True: + aaaaaaaaaaaaaaaaaaaaaaa.bbbbbbbbb( + 'ccccccccccc', ddddddddd='eeeee').fffffffff([ggggggggggggggggggggg]) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB19547210(self): + code = textwrap.dedent("""\ + while True: + if True: + if True: + if True: + if xxxxxxxxxxxx.yyyyyyy(aa).zzzzzzz() not in ( + xxxxxxxxxxxx.yyyyyyyyyyyyyy.zzzzzzzz, + xxxxxxxxxxxx.yyyyyyyyyyyyyy.zzzzzzzz): + continue + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB19377034(self): + code = textwrap.dedent("""\ + def f(): + if (aaaaaaaaaaaaaaa.start >= aaaaaaaaaaaaaaa.end or + bbbbbbbbbbbbbbb.start >= bbbbbbbbbbbbbbb.end): + return False + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB19372573(self): + code = textwrap.dedent("""\ + def f(): + if a: return 42 + while True: + if b: continue + if c: break + return 0 + """) + + try: + style.SetGlobalStyle(style.CreatePEP8Style()) + + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + finally: + style.SetGlobalStyle(style.CreateYapfStyle()) + + def testB19353268(self): + code = textwrap.dedent("""\ + a = {1, 2, 3}[x] + b = {'foo': 42, 'bar': 37}['foo'] + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB19287512(self): + unformatted_code = textwrap.dedent("""\ + class Foo(object): + + def bar(self): + with xxxxxxxxxx.yyyyy( + 'aaaaaaa.bbbbbbbb.ccccccc.dddddddddddddddddddd.eeeeeeeeeee', + fffffffffff=(aaaaaaa.bbbbbbbb.ccccccc.dddddddddddddddddddd + .Mmmmmmmmmmmmmmmmmm(-1, 'permission error'))): + self.assertRaises(nnnnnnnnnnnnnnnn.ooooo, ppppp.qqqqqqqqqqqqqqqqq) + """) + expected_formatted_code = textwrap.dedent("""\ + class Foo(object): + + def bar(self): + with xxxxxxxxxx.yyyyy( + 'aaaaaaa.bbbbbbbb.ccccccc.dddddddddddddddddddd.eeeeeeeeeee', + fffffffffff=( + aaaaaaa.bbbbbbbb.ccccccc.dddddddddddddddddddd.Mmmmmmmmmmmmmmmmmm( + -1, 'permission error'))): + self.assertRaises(nnnnnnnnnnnnnnnn.ooooo, ppppp.qqqqqqqqqqqqqqqqq) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB19194420(self): + code = textwrap.dedent("""\ + method.Set( + 'long argument goes here that causes the line to break', + lambda arg2=0.5: arg2) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB19073499(self): + code = """\ +instance = ( + aaaaaaa.bbbbbbb().ccccccccccccccccc().ddddddddddd({ + 'aa': 'context!' + }).eeeeeeeeeeeeeeeeeee({ # Inline comment about why fnord has the value 6. + 'fnord': 6 + })) +""" + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB18257115(self): + code = textwrap.dedent("""\ + if True: + if True: + self._Test(aaaa, bbbbbbb.cccccccccc, dddddddd, eeeeeeeeeee, + [ffff, ggggggggggg, hhhhhhhhhhhh, iiiiii, jjjj]) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB18256666(self): + code = textwrap.dedent("""\ + class Foo(object): + + def Bar(self): + aaaaa.bbbbbbb( + ccc='ddddddddddddddd', + eeee='ffffffffffffffffffffff-%s-%s' % (gggg, int(time.time())), + hhhhhh={ + 'iiiiiiiiiii': iiiiiiiiiii, + 'jjjj': jjjj.jjjjj(), + 'kkkkkkkkkkkk': kkkkkkkkkkkk, + }, + llllllllll=mmmmmm.nnnnnnnnnnnnnnnn) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB18256826(self): + code = textwrap.dedent("""\ + if True: + pass + # A multiline comment. + # Line two. + elif False: + pass + + if True: + pass + # A multiline comment. + # Line two. + elif False: + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB18255697(self): + code = textwrap.dedent("""\ + AAAAAAAAAAAAAAA = { + 'XXXXXXXXXXXXXX': 4242, # Inline comment + # Next comment + 'YYYYYYYYYYYYYYYY': ['zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'], + } + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testB17534869(self): + unformatted_code = textwrap.dedent("""\ + if True: + self.assertLess(abs(time.time()-aaaa.bbbbbbbbbbb( + datetime.datetime.now())), 1) + """) + expected_formatted_code = textwrap.dedent("""\ + if True: + self.assertLess( + abs(time.time() - aaaa.bbbbbbbbbbb(datetime.datetime.now())), 1) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB17489866(self): + unformatted_code = textwrap.dedent("""\ + def f(): + if True: + if True: + return aaaa.bbbbbbbbb(ccccccc=dddddddddddddd({('eeee', \ +'ffffffff'): str(j)})) + """) + expected_formatted_code = textwrap.dedent("""\ + def f(): + if True: + if True: + return aaaa.bbbbbbbbb( + ccccccc=dddddddddddddd({('eeee', 'ffffffff'): str(j)})) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB17133019(self): + unformatted_code = textwrap.dedent("""\ + class aaaaaaaaaaaaaa(object): + + def bbbbbbbbbb(self): + with io.open("/dev/null", "rb"): + with io.open(os.path.join(aaaaa.bbbbb.ccccccccccc, + DDDDDDDDDDDDDDD, + "eeeeeeeee ffffffffff" + ), "rb") as gggggggggggggggggggg: + print(gggggggggggggggggggg) + """) + expected_formatted_code = textwrap.dedent("""\ + class aaaaaaaaaaaaaa(object): + + def bbbbbbbbbb(self): + with io.open("/dev/null", "rb"): + with io.open( + os.path.join(aaaaa.bbbbb.ccccccccccc, DDDDDDDDDDDDDDD, + "eeeeeeeee ffffffffff"), "rb") as gggggggggggggggggggg: + print(gggggggggggggggggggg) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB17011869(self): + unformatted_code = textwrap.dedent("""\ + '''blah......''' + + class SomeClass(object): + '''blah.''' + + AAAAAAAAAAAA = { # Comment. + 'BBB': 1.0, + 'DDDDDDDD': 0.4811 + } + """) + expected_formatted_code = textwrap.dedent("""\ + '''blah......''' + + + class SomeClass(object): + '''blah.''' + + AAAAAAAAAAAA = { # Comment. + 'BBB': 1.0, + 'DDDDDDDD': 0.4811 + } + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB16783631(self): + unformatted_code = textwrap.dedent("""\ + if True: + with aaaaaaaaaaaaaa.bbbbbbbbbbbbb.ccccccc(ddddddddddddd, + eeeeeeeee=self.fffffffffffff + )as gggg: + pass + """) + expected_formatted_code = textwrap.dedent("""\ + if True: + with aaaaaaaaaaaaaa.bbbbbbbbbbbbb.ccccccc( + ddddddddddddd, eeeeeeeee=self.fffffffffffff) as gggg: + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB16572361(self): + unformatted_code = textwrap.dedent("""\ + def foo(self): + def bar(my_dict_name): + self.my_dict_name['foo-bar-baz-biz-boo-baa-baa'].IncrementBy.assert_called_once_with('foo_bar_baz_boo') + """) + expected_formatted_code = textwrap.dedent("""\ + def foo(self): + + def bar(my_dict_name): + self.my_dict_name[ + 'foo-bar-baz-biz-boo-baa-baa'].IncrementBy.assert_called_once_with( + 'foo_bar_baz_boo') + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB15884241(self): + unformatted_code = textwrap.dedent("""\ + if 1: + if 1: + for row in AAAA: + self.create(aaaaaaaa="/aaa/bbbb/cccc/dddddd/eeeeeeeeeeeeeeeeeeeeeeeeee/%s" % row [0].replace(".foo", ".bar"), aaaaa=bbb[1], ccccc=bbb[2], dddd=bbb[3], eeeeeeeeeee=[s.strip() for s in bbb[4].split(",")], ffffffff=[s.strip() for s in bbb[5].split(",")], gggggg=bbb[6]) + """) + expected_formatted_code = textwrap.dedent("""\ + if 1: + if 1: + for row in AAAA: + self.create( + aaaaaaaa="/aaa/bbbb/cccc/dddddd/eeeeeeeeeeeeeeeeeeeeeeeeee/%s" % + row[0].replace(".foo", ".bar"), + aaaaa=bbb[1], + ccccc=bbb[2], + dddd=bbb[3], + eeeeeeeeeee=[s.strip() for s in bbb[4].split(",")], + ffffffff=[s.strip() for s in bbb[5].split(",")], + gggggg=bbb[6]) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB15697268(self): + unformatted_code = textwrap.dedent("""\ + def main(unused_argv): + ARBITRARY_CONSTANT_A = 10 + an_array_with_an_exceedingly_long_name = range(ARBITRARY_CONSTANT_A + 1) + ok = an_array_with_an_exceedingly_long_name[:ARBITRARY_CONSTANT_A] + bad_slice = map(math.sqrt, an_array_with_an_exceedingly_long_name[:ARBITRARY_CONSTANT_A]) + a_long_name_slicing = an_array_with_an_exceedingly_long_name[:ARBITRARY_CONSTANT_A] + bad_slice = ("I am a crazy, no good, string whats too long, etc." + " no really ")[:ARBITRARY_CONSTANT_A] + """) + expected_formatted_code = textwrap.dedent("""\ + def main(unused_argv): + ARBITRARY_CONSTANT_A = 10 + an_array_with_an_exceedingly_long_name = range(ARBITRARY_CONSTANT_A + 1) + ok = an_array_with_an_exceedingly_long_name[:ARBITRARY_CONSTANT_A] + bad_slice = map(math.sqrt, + an_array_with_an_exceedingly_long_name[:ARBITRARY_CONSTANT_A]) + a_long_name_slicing = an_array_with_an_exceedingly_long_name[: + ARBITRARY_CONSTANT_A] + bad_slice = ("I am a crazy, no good, string whats too long, etc." + + " no really ")[:ARBITRARY_CONSTANT_A] + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB15597568(self): + unformatted_code = """\ +if True: + if True: + if True: + print(("Return code was %d" + (", and the process timed out." if did_time_out else ".")) % errorcode) +""" + expected_formatted_code = """\ +if True: + if True: + if True: + print(("Return code was %d" + + (", and the process timed out." if did_time_out else ".")) % + errorcode) +""" + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB15542157(self): + unformatted_code = textwrap.dedent("""\ + aaaaaaaaaaaa = bbbb.ccccccccccccccc(dddddd.eeeeeeeeeeeeee, ffffffffffffffffff, gggggg.hhhhhhhhhhhhhhhhh) + """) + expected_formatted_code = textwrap.dedent("""\ + aaaaaaaaaaaa = bbbb.ccccccccccccccc(dddddd.eeeeeeeeeeeeee, ffffffffffffffffff, + gggggg.hhhhhhhhhhhhhhhhh) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB15438132(self): + unformatted_code = textwrap.dedent("""\ + if aaaaaaa.bbbbbbbbbb: + cccccc.dddddddddd(eeeeeeeeeee=fffffffffffff.gggggggggggggggggg) + if hhhhhh.iiiii.jjjjjjjjjjjjj: + # This is a comment in the middle of it all. + kkkkkkk.llllllllll.mmmmmmmmmmmmm = True + if (aaaaaa.bbbbb.ccccccccccccc != ddddddd.eeeeeeeeee.fffffffffffff or + eeeeee.fffff.ggggggggggggggggggggggggggg() != hhhhhhh.iiiiiiiiii.jjjjjjjjjjjj): + aaaaaaaa.bbbbbbbbbbbb( + aaaaaa.bbbbb.cc, + dddddddddddd=eeeeeeeeeeeeeeeeeee.fffffffffffffffff( + gggggg.hh, + iiiiiiiiiiiiiiiiiii.jjjjjjjjjj.kkkkkkk, + lllll.mm), + nnnnnnnnnn=ooooooo.pppppppppp) + """) + expected_formatted_code = textwrap.dedent("""\ + if aaaaaaa.bbbbbbbbbb: + cccccc.dddddddddd(eeeeeeeeeee=fffffffffffff.gggggggggggggggggg) + if hhhhhh.iiiii.jjjjjjjjjjjjj: + # This is a comment in the middle of it all. + kkkkkkk.llllllllll.mmmmmmmmmmmmm = True + if (aaaaaa.bbbbb.ccccccccccccc != ddddddd.eeeeeeeeee.fffffffffffff or + eeeeee.fffff.ggggggggggggggggggggggggggg() != + hhhhhhh.iiiiiiiiii.jjjjjjjjjjjj): + aaaaaaaa.bbbbbbbbbbbb( + aaaaaa.bbbbb.cc, + dddddddddddd=eeeeeeeeeeeeeeeeeee.fffffffffffffffff( + gggggg.hh, iiiiiiiiiiiiiiiiiii.jjjjjjjjjj.kkkkkkk, lllll.mm), + nnnnnnnnnn=ooooooo.pppppppppp) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB14468247(self): + unformatted_code = """\ +call(a=1, + b=2, +) +""" + expected_formatted_code = """\ +call( + a=1, + b=2, +) +""" + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB14406499(self): + unformatted_code = textwrap.dedent("""\ + def foo1(parameter_1, parameter_2, parameter_3, parameter_4, \ +parameter_5, parameter_6): pass + """) + expected_formatted_code = textwrap.dedent("""\ + def foo1(parameter_1, parameter_2, parameter_3, parameter_4, parameter_5, + parameter_6): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB13900309(self): + unformatted_code = textwrap.dedent("""\ + self.aaaaaaaaaaa( # A comment in the middle of it all. + 948.0/3600, self.bbb.ccccccccccccccccccccc(dddddddddddddddd.eeee, True)) + """) + expected_formatted_code = textwrap.dedent("""\ + self.aaaaaaaaaaa( # A comment in the middle of it all. + 948.0 / 3600, self.bbb.ccccccccccccccccccccc(dddddddddddddddd.eeee, True)) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + code = textwrap.dedent("""\ + aaaaaaaaaa.bbbbbbbbbbbbbbbbbbbbbbbb.cccccccccccccccccccccccccccccc( + DC_1, (CL - 50, CL), AAAAAAAA, BBBBBBBBBBBBBBBB, 98.0, + CCCCCCC).ddddddddd( # Look! A comment is here. + AAAAAAAA - (20 * 60 - 5)) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + unformatted_code = textwrap.dedent("""\ + aaaaaaaaaaaaaaaaaaaaaaaa.bbbbbbbbbbbbb.ccccccccccccccccccccccccc().dddddddddddddddddddddddddd(1, 2, 3, 4) + """) + expected_formatted_code = textwrap.dedent("""\ + aaaaaaaaaaaaaaaaaaaaaaaa.bbbbbbbbbbbbb.ccccccccccccccccccccccccc( + ).dddddddddddddddddddddddddd(1, 2, 3, 4) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + unformatted_code = textwrap.dedent("""\ + aaaaaaaaaaaaaaaaaaaaaaaa.bbbbbbbbbbbbb.ccccccccccccccccccccccccc(x).dddddddddddddddddddddddddd(1, 2, 3, 4) + """) + expected_formatted_code = textwrap.dedent("""\ + aaaaaaaaaaaaaaaaaaaaaaaa.bbbbbbbbbbbbb.ccccccccccccccccccccccccc( + x).dddddddddddddddddddddddddd(1, 2, 3, 4) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + unformatted_code = textwrap.dedent("""\ + aaaaaaaaaaaaaaaaaaaaaaaa(xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx).dddddddddddddddddddddddddd(1, 2, 3, 4) + """) + expected_formatted_code = textwrap.dedent("""\ + aaaaaaaaaaaaaaaaaaaaaaaa( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx).dddddddddddddddddddddddddd(1, 2, 3, 4) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + unformatted_code = textwrap.dedent("""\ + aaaaaaaaaaaaaaaaaaaaaaaa().bbbbbbbbbbbbbbbbbbbbbbbb().ccccccccccccccccccc().\ +dddddddddddddddddd().eeeeeeeeeeeeeeeeeeeee().fffffffffffffffff().gggggggggggggggggg() + """) + expected_formatted_code = textwrap.dedent("""\ + aaaaaaaaaaaaaaaaaaaaaaaa().bbbbbbbbbbbbbbbbbbbbbbbb().ccccccccccccccccccc( + ).dddddddddddddddddd().eeeeeeeeeeeeeeeeeeeee().fffffffffffffffff( + ).gggggggggggggggggg() + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testB67935687(self): + code = textwrap.dedent("""\ + Fetch( + Raw('monarch.BorgTask', '/union/row_operator_action_delay'), + {'borg_user': self.borg_user}) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + unformatted_code = textwrap.dedent("""\ + shelf_renderer.expand_text = text.translate_to_unicode( + expand_text % { + 'creator': creator + }) + """) + expected_formatted_code = textwrap.dedent("""\ + shelf_renderer.expand_text = text.translate_to_unicode(expand_text % + {'creator': creator}) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + +if __name__ == '__main__': + unittest.main() diff --git a/.venv/lib/python3.9/site-packages/yapftests/reformatter_facebook_test.py b/.venv/lib/python3.9/site-packages/yapftests/reformatter_facebook_test.py new file mode 100644 index 00000000..289aa853 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapftests/reformatter_facebook_test.py @@ -0,0 +1,432 @@ +# Copyright 2016 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Facebook tests for yapf.reformatter.""" + +import textwrap +import unittest + +from yapf.yapflib import reformatter +from yapf.yapflib import style + +from yapftests import yapf_test_helper + + +class TestsForFacebookStyle(yapf_test_helper.YAPFTest): + + @classmethod + def setUpClass(cls): + style.SetGlobalStyle(style.CreateFacebookStyle()) + + def testNoNeedForLineBreaks(self): + unformatted_code = textwrap.dedent("""\ + def overly_long_function_name( + just_one_arg, **kwargs): + pass + """) + expected_formatted_code = textwrap.dedent("""\ + def overly_long_function_name(just_one_arg, **kwargs): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testDedentClosingBracket(self): + unformatted_code = textwrap.dedent("""\ + def overly_long_function_name( + first_argument_on_the_same_line, + second_argument_makes_the_line_too_long): + pass + """) + expected_formatted_code = textwrap.dedent("""\ + def overly_long_function_name( + first_argument_on_the_same_line, second_argument_makes_the_line_too_long + ): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testBreakAfterOpeningBracketIfContentsTooBig(self): + unformatted_code = textwrap.dedent("""\ + def overly_long_function_name(a, b, c, d, e, f, g, h, i, j, k, l, m, + n, o, p, q, r, s, t, u, v, w, x, y, z): + pass + """) + expected_formatted_code = textwrap.dedent("""\ + def overly_long_function_name( + a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, \ +v, w, x, y, z + ): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testDedentClosingBracketWithComments(self): + unformatted_code = textwrap.dedent("""\ + def overly_long_function_name( + # comment about the first argument + first_argument_with_a_very_long_name_or_so, + # comment about the second argument + second_argument_makes_the_line_too_long): + pass + """) + expected_formatted_code = textwrap.dedent("""\ + def overly_long_function_name( + # comment about the first argument + first_argument_with_a_very_long_name_or_so, + # comment about the second argument + second_argument_makes_the_line_too_long + ): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testDedentImportAsNames(self): + code = textwrap.dedent("""\ + from module import ( + internal_function as function, + SOME_CONSTANT_NUMBER1, + SOME_CONSTANT_NUMBER2, + SOME_CONSTANT_NUMBER3, + ) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testDedentTestListGexp(self): + unformatted_code = textwrap.dedent("""\ + try: + pass + except ( + IOError, OSError, LookupError, RuntimeError, OverflowError + ) as exception: + pass + + try: + pass + except ( + IOError, OSError, LookupError, RuntimeError, OverflowError, + ) as exception: + pass + """) + expected_formatted_code = textwrap.dedent("""\ + try: + pass + except ( + IOError, OSError, LookupError, RuntimeError, OverflowError + ) as exception: + pass + + try: + pass + except ( + IOError, + OSError, + LookupError, + RuntimeError, + OverflowError, + ) as exception: + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testBrokenIdempotency(self): + # TODO(ambv): The following behaviour should be fixed. + pass0_code = textwrap.dedent("""\ + try: + pass + except (IOError, OSError, LookupError, RuntimeError, OverflowError) as exception: + pass + """) + pass1_code = textwrap.dedent("""\ + try: + pass + except ( + IOError, OSError, LookupError, RuntimeError, OverflowError + ) as exception: + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(pass0_code) + self.assertCodeEqual(pass1_code, reformatter.Reformat(uwlines)) + + pass2_code = textwrap.dedent("""\ + try: + pass + except ( + IOError, OSError, LookupError, RuntimeError, OverflowError + ) as exception: + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(pass1_code) + self.assertCodeEqual(pass2_code, reformatter.Reformat(uwlines)) + + def testIfExprHangingIndent(self): + unformatted_code = textwrap.dedent("""\ + if True: + if True: + if True: + if not self.frobbies and ( + self.foobars.counters['db.cheeses'] != 1 or + self.foobars.counters['db.marshmellow_skins'] != 1): + pass + """) + expected_formatted_code = textwrap.dedent("""\ + if True: + if True: + if True: + if not self.frobbies and ( + self.foobars.counters['db.cheeses'] != 1 or + self.foobars.counters['db.marshmellow_skins'] != 1 + ): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testSimpleDedenting(self): + unformatted_code = textwrap.dedent("""\ + if True: + self.assertEqual(result.reason_not_added, "current preflight is still running") + """) + expected_formatted_code = textwrap.dedent("""\ + if True: + self.assertEqual( + result.reason_not_added, "current preflight is still running" + ) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testDedentingWithSubscripts(self): + unformatted_code = textwrap.dedent("""\ + class Foo: + class Bar: + @classmethod + def baz(cls, clues_list, effect, constraints, constraint_manager): + if clues_lists: + return cls.single_constraint_not(clues_lists, effect, constraints[0], constraint_manager) + + """) + expected_formatted_code = textwrap.dedent("""\ + class Foo: + class Bar: + @classmethod + def baz(cls, clues_list, effect, constraints, constraint_manager): + if clues_lists: + return cls.single_constraint_not( + clues_lists, effect, constraints[0], constraint_manager + ) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testDedentingCallsWithInnerLists(self): + code = textwrap.dedent("""\ + class _(): + def _(): + cls.effect_clues = { + 'effect': Clue((cls.effect_time, 'apache_host'), effect_line, 40) + } + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testDedentingListComprehension(self): + unformatted_code = textwrap.dedent("""\ + class Foo(): + def _pack_results_for_constraint_or(): + self.param_groups = dict( + ( + key + 1, ParamGroup(groups[key], default_converter) + ) for key in six.moves.range(len(groups)) + ) + + for combination in cls._clues_combinations(clues_lists): + if all( + cls._verify_constraint(combination, effect, constraint) + for constraint in constraints + ): + pass + + guessed_dict = dict( + ( + key, guessed_pattern_matches[key] + ) for key in six.moves.range(len(guessed_pattern_matches)) + ) + + content = "".join( + itertools.chain( + (first_line_fragment, ), lines_between, (last_line_fragment, ) + ) + ) + + rule = Rule( + [self.cause1, self.cause2, self.cause1, self.cause2], self.effect, constraints1, + Rule.LINKAGE_AND + ) + + assert sorted(log_type.files_to_parse) == [ + ('localhost', os.path.join(path, 'node_1.log'), super_parser), + ('localhost', os.path.join(path, 'node_2.log'), super_parser) + ] + """) + expected_formatted_code = textwrap.dedent("""\ + class Foo(): + def _pack_results_for_constraint_or(): + self.param_groups = dict( + (key + 1, ParamGroup(groups[key], default_converter)) + for key in six.moves.range(len(groups)) + ) + + for combination in cls._clues_combinations(clues_lists): + if all( + cls._verify_constraint(combination, effect, constraint) + for constraint in constraints + ): + pass + + guessed_dict = dict( + (key, guessed_pattern_matches[key]) + for key in six.moves.range(len(guessed_pattern_matches)) + ) + + content = "".join( + itertools.chain( + (first_line_fragment, ), lines_between, (last_line_fragment, ) + ) + ) + + rule = Rule( + [self.cause1, self.cause2, self.cause1, self.cause2], self.effect, + constraints1, Rule.LINKAGE_AND + ) + + assert sorted(log_type.files_to_parse) == [ + ('localhost', os.path.join(path, 'node_1.log'), super_parser), + ('localhost', os.path.join(path, 'node_2.log'), super_parser) + ] + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testMustSplitDedenting(self): + code = textwrap.dedent("""\ + class _(): + def _(): + effect_line = FrontInput( + effect_line_offset, line_content, + LineSource('localhost', xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx) + ) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testDedentIfConditional(self): + code = textwrap.dedent("""\ + class _(): + def _(): + if True: + if not self.frobbies and ( + self.foobars.counters['db.cheeses'] != 1 or + self.foobars.counters['db.marshmellow_skins'] != 1 + ): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testDedentSet(self): + code = textwrap.dedent("""\ + class _(): + def _(): + assert set(self.constraint_links.get_links()) == set( + [ + (2, 10, 100), + (2, 10, 200), + (2, 20, 100), + (2, 20, 200), + ] + ) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testDedentingInnerScope(self): + code = textwrap.dedent("""\ + class Foo(): + @classmethod + def _pack_results_for_constraint_or(cls, combination, constraints): + return cls._create_investigation_result( + (clue for clue in combination if not clue == Verifier.UNMATCHED), + constraints, InvestigationResult.OR + ) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + reformatted_code = reformatter.Reformat(uwlines) + self.assertCodeEqual(code, reformatted_code) + + uwlines = yapf_test_helper.ParseAndUnwrap(reformatted_code) + reformatted_code = reformatter.Reformat(uwlines) + self.assertCodeEqual(code, reformatted_code) + + def testCommentWithNewlinesInPrefix(self): + unformatted_code = textwrap.dedent("""\ + def foo(): + if 0: + return False + + + #a deadly comment + elif 1: + return True + + + print(foo()) + """) + expected_formatted_code = textwrap.dedent("""\ + def foo(): + if 0: + return False + + #a deadly comment + elif 1: + return True + + + print(foo()) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testIfStmtClosingBracket(self): + unformatted_code = """\ +if (isinstance(value , (StopIteration , StopAsyncIteration )) and exc.__cause__ is value_asdfasdfasdfasdfsafsafsafdasfasdfs): + return False +""" + expected_formatted_code = """\ +if ( + isinstance(value, (StopIteration, StopAsyncIteration)) and + exc.__cause__ is value_asdfasdfasdfasdfsafsafsafdasfasdfs +): + return False +""" + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + +if __name__ == '__main__': + unittest.main() diff --git a/.venv/lib/python3.9/site-packages/yapftests/reformatter_pep8_test.py b/.venv/lib/python3.9/site-packages/yapftests/reformatter_pep8_test.py new file mode 100644 index 00000000..bdd074a7 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapftests/reformatter_pep8_test.py @@ -0,0 +1,919 @@ +# Copyright 2016 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""PEP8 tests for yapf.reformatter.""" + +import textwrap +import unittest + +from yapf.yapflib import py3compat +from yapf.yapflib import reformatter +from yapf.yapflib import style + +from yapftests import yapf_test_helper + + +class TestsForPEP8Style(yapf_test_helper.YAPFTest): + + @classmethod + def setUpClass(cls): # pylint: disable=g-missing-super-call + style.SetGlobalStyle(style.CreatePEP8Style()) + + def testIndent4(self): + unformatted_code = textwrap.dedent("""\ + if a+b: + pass + """) + expected_formatted_code = textwrap.dedent("""\ + if a + b: + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testSingleLineIfStatements(self): + code = textwrap.dedent("""\ + if True: a = 42 + elif False: b = 42 + else: c = 42 + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testNoBlankBetweenClassAndDef(self): + unformatted_code = textwrap.dedent("""\ + class Foo: + + def joe(): + pass + """) + expected_formatted_code = textwrap.dedent("""\ + class Foo: + def joe(): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testNoBlankBetweenDefsInClass(self): + unformatted_code = textwrap.dedent('''\ + class TestClass: + def __init__(self): + self.running = False + def run(self): + """Override in subclass""" + def is_running(self): + return self.running + ''') + expected_formatted_code = textwrap.dedent('''\ + class TestClass: + def __init__(self): + self.running = False + + def run(self): + """Override in subclass""" + + def is_running(self): + return self.running + ''') + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testSingleWhiteBeforeTrailingComment(self): + unformatted_code = textwrap.dedent("""\ + if a+b: # comment + pass + """) + expected_formatted_code = textwrap.dedent("""\ + if a + b: # comment + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testSpaceBetweenEndingCommandAndClosingBracket(self): + unformatted_code = textwrap.dedent("""\ + a = ( + 1, + ) + """) + expected_formatted_code = textwrap.dedent("""\ + a = (1, ) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testContinuedNonOutdentedLine(self): + code = textwrap.dedent("""\ + class eld(d): + if str(geom.geom_type).upper( + ) != self.geom_type and not self.geom_type == 'GEOMETRY': + ror(code='om_type') + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testWrappingPercentExpressions(self): + unformatted_code = textwrap.dedent("""\ + def f(): + if True: + zzzzz = '%s-%s' % (xxxxxxxxxxxxxxxxxxxxxxxxxx + 1, xxxxxxxxxxxxxxxxx.yyy + 1) + zzzzz = '%s-%s'.ww(xxxxxxxxxxxxxxxxxxxxxxxxxx + 1, xxxxxxxxxxxxxxxxx.yyy + 1) + zzzzz = '%s-%s' % (xxxxxxxxxxxxxxxxxxxxxxx + 1, xxxxxxxxxxxxxxxxxxxxx + 1) + zzzzz = '%s-%s'.ww(xxxxxxxxxxxxxxxxxxxxxxx + 1, xxxxxxxxxxxxxxxxxxxxx + 1) + """) + expected_formatted_code = textwrap.dedent("""\ + def f(): + if True: + zzzzz = '%s-%s' % (xxxxxxxxxxxxxxxxxxxxxxxxxx + 1, + xxxxxxxxxxxxxxxxx.yyy + 1) + zzzzz = '%s-%s'.ww(xxxxxxxxxxxxxxxxxxxxxxxxxx + 1, + xxxxxxxxxxxxxxxxx.yyy + 1) + zzzzz = '%s-%s' % (xxxxxxxxxxxxxxxxxxxxxxx + 1, + xxxxxxxxxxxxxxxxxxxxx + 1) + zzzzz = '%s-%s'.ww(xxxxxxxxxxxxxxxxxxxxxxx + 1, + xxxxxxxxxxxxxxxxxxxxx + 1) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testAlignClosingBracketWithVisualIndentation(self): + unformatted_code = textwrap.dedent("""\ + TEST_LIST = ('foo', 'bar', # first comment + 'baz' # second comment + ) + """) + expected_formatted_code = textwrap.dedent("""\ + TEST_LIST = ( + 'foo', + 'bar', # first comment + 'baz' # second comment + ) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + unformatted_code = textwrap.dedent("""\ + def f(): + + def g(): + while (xxxxxxxxxxxxxxxxxxxx(yyyyyyyyyyyyy[zzzzz]) == 'aaaaaaaaaaa' and + xxxxxxxxxxxxxxxxxxxx(yyyyyyyyyyyyy[zzzzz].aaaaaaaa[0]) == 'bbbbbbb' + ): + pass + """) + expected_formatted_code = textwrap.dedent("""\ + def f(): + def g(): + while (xxxxxxxxxxxxxxxxxxxx(yyyyyyyyyyyyy[zzzzz]) == 'aaaaaaaaaaa' + and xxxxxxxxxxxxxxxxxxxx( + yyyyyyyyyyyyy[zzzzz].aaaaaaaa[0]) == 'bbbbbbb'): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testIndentSizeChanging(self): + unformatted_code = textwrap.dedent("""\ + if True: + runtime_mins = (program_end_time - program_start_time).total_seconds() / 60.0 + """) + expected_formatted_code = textwrap.dedent("""\ + if True: + runtime_mins = (program_end_time - + program_start_time).total_seconds() / 60.0 + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testHangingIndentCollision(self): + unformatted_code = textwrap.dedent("""\ + if (aaaaaaaaaaaaaa + bbbbbbbbbbbbbbbb == ccccccccccccccccc and xxxxxxxxxxxxx or yyyyyyyyyyyyyyyyy): + pass + elif (xxxxxxxxxxxxxxx(aaaaaaaaaaa, bbbbbbbbbbbbbb, cccccccccccc, dddddddddd=None)): + pass + + + def h(): + if (xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0]) == 'aaaaaaaaaaa' and xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0].mmmmmmmm[0]) == 'bbbbbbb'): + pass + + for connection in itertools.chain(branch.contact, branch.address, morestuff.andmore.andmore.andmore.andmore.andmore.andmore.andmore): + dosomething(connection) + """) + expected_formatted_code = textwrap.dedent("""\ + if (aaaaaaaaaaaaaa + bbbbbbbbbbbbbbbb == ccccccccccccccccc and xxxxxxxxxxxxx + or yyyyyyyyyyyyyyyyy): + pass + elif (xxxxxxxxxxxxxxx(aaaaaaaaaaa, + bbbbbbbbbbbbbb, + cccccccccccc, + dddddddddd=None)): + pass + + + def h(): + if (xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0]) == 'aaaaaaaaaaa' and + xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0].mmmmmmmm[0]) == 'bbbbbbb'): + pass + + for connection in itertools.chain( + branch.contact, branch.address, + morestuff.andmore.andmore.andmore.andmore.andmore.andmore.andmore): + dosomething(connection) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testSplittingBeforeLogicalOperator(self): + try: + style.SetGlobalStyle( + style.CreateStyleFromConfig( + '{based_on_style: pep8, split_before_logical_operator: True}')) + unformatted_code = textwrap.dedent("""\ + def foo(): + return bool(update.message.new_chat_member or update.message.left_chat_member or + update.message.new_chat_title or update.message.new_chat_photo or + update.message.delete_chat_photo or update.message.group_chat_created or + update.message.supergroup_chat_created or update.message.channel_chat_created + or update.message.migrate_to_chat_id or update.message.migrate_from_chat_id or + update.message.pinned_message) + """) + expected_formatted_code = textwrap.dedent("""\ + def foo(): + return bool( + update.message.new_chat_member or update.message.left_chat_member + or update.message.new_chat_title or update.message.new_chat_photo + or update.message.delete_chat_photo + or update.message.group_chat_created + or update.message.supergroup_chat_created + or update.message.channel_chat_created + or update.message.migrate_to_chat_id + or update.message.migrate_from_chat_id + or update.message.pinned_message) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, + reformatter.Reformat(uwlines)) + finally: + style.SetGlobalStyle(style.CreatePEP8Style()) + + def testContiguousListEndingWithComment(self): + unformatted_code = textwrap.dedent("""\ + if True: + if True: + keys.append(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) # may be unassigned. + """) + expected_formatted_code = textwrap.dedent("""\ + if True: + if True: + keys.append( + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) # may be unassigned. + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testSplittingBeforeFirstArgument(self): + try: + style.SetGlobalStyle( + style.CreateStyleFromConfig( + '{based_on_style: pep8, split_before_first_argument: True}')) + unformatted_code = textwrap.dedent("""\ + a_very_long_function_name(long_argument_name_1=1, long_argument_name_2=2, + long_argument_name_3=3, long_argument_name_4=4) + """) + expected_formatted_code = textwrap.dedent("""\ + a_very_long_function_name( + long_argument_name_1=1, + long_argument_name_2=2, + long_argument_name_3=3, + long_argument_name_4=4) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, + reformatter.Reformat(uwlines)) + finally: + style.SetGlobalStyle(style.CreatePEP8Style()) + + def testSplittingExpressionsInsideSubscripts(self): + unformatted_code = textwrap.dedent("""\ + def foo(): + df = df[(df['campaign_status'] == 'LIVE') & (df['action_status'] == 'LIVE')] + """) + expected_formatted_code = textwrap.dedent("""\ + def foo(): + df = df[(df['campaign_status'] == 'LIVE') + & (df['action_status'] == 'LIVE')] + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testSplitListsAndDictSetMakersIfCommaTerminated(self): + unformatted_code = textwrap.dedent("""\ + DJANGO_TEMPLATES_OPTIONS = {"context_processors": []} + DJANGO_TEMPLATES_OPTIONS = {"context_processors": [],} + x = ["context_processors"] + x = ["context_processors",] + """) + expected_formatted_code = textwrap.dedent("""\ + DJANGO_TEMPLATES_OPTIONS = {"context_processors": []} + DJANGO_TEMPLATES_OPTIONS = { + "context_processors": [], + } + x = ["context_processors"] + x = [ + "context_processors", + ] + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testSplitAroundNamedAssigns(self): + unformatted_code = textwrap.dedent("""\ + class a(): + def a(): return a( + aaaaaaaaaa=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) + """) + expected_formatted_code = textwrap.dedent("""\ + class a(): + def a(): + return a( + aaaaaaaaaa=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + ) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testUnaryOperator(self): + unformatted_code = textwrap.dedent("""\ + if not -3 < x < 3: + pass + if -3 < x < 3: + pass + """) + expected_formatted_code = textwrap.dedent("""\ + if not -3 < x < 3: + pass + if -3 < x < 3: + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testNoSplitBeforeDictValue(self): + try: + style.SetGlobalStyle( + style.CreateStyleFromConfig('{based_on_style: pep8, ' + 'allow_split_before_dict_value: false, ' + 'coalesce_brackets: true, ' + 'dedent_closing_brackets: true, ' + 'each_dict_entry_on_separate_line: true, ' + 'split_before_logical_operator: true}')) + + unformatted_code = textwrap.dedent("""\ + some_dict = { + 'title': _("I am example data"), + 'description': _("Lorem ipsum dolor met sit amet elit, si vis pacem para bellum " + "elites nihi very long string."), + } + """) + expected_formatted_code = textwrap.dedent("""\ + some_dict = { + 'title': _("I am example data"), + 'description': _( + "Lorem ipsum dolor met sit amet elit, si vis pacem para bellum " + "elites nihi very long string." + ), + } + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, + reformatter.Reformat(uwlines)) + + unformatted_code = textwrap.dedent("""\ + X = {'a': 1, 'b': 2, 'key': this_is_a_function_call_that_goes_over_the_column_limit_im_pretty_sure()} + """) + expected_formatted_code = textwrap.dedent("""\ + X = { + 'a': 1, + 'b': 2, + 'key': this_is_a_function_call_that_goes_over_the_column_limit_im_pretty_sure() + } + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, + reformatter.Reformat(uwlines)) + + unformatted_code = textwrap.dedent("""\ + attrs = { + 'category': category, + 'role': forms.ModelChoiceField(label=_("Role"), required=False, queryset=category_roles, initial=selected_role, empty_label=_("No access"),), + } + """) + expected_formatted_code = textwrap.dedent("""\ + attrs = { + 'category': category, + 'role': forms.ModelChoiceField( + label=_("Role"), + required=False, + queryset=category_roles, + initial=selected_role, + empty_label=_("No access"), + ), + } + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, + reformatter.Reformat(uwlines)) + + unformatted_code = textwrap.dedent("""\ + css_class = forms.CharField( + label=_("CSS class"), + required=False, + help_text=_("Optional CSS class used to customize this category appearance from templates."), + ) + """) + expected_formatted_code = textwrap.dedent("""\ + css_class = forms.CharField( + label=_("CSS class"), + required=False, + help_text=_( + "Optional CSS class used to customize this category appearance from templates." + ), + ) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, + reformatter.Reformat(uwlines)) + finally: + style.SetGlobalStyle(style.CreatePEP8Style()) + + def testBitwiseOperandSplitting(self): + unformatted_code = """\ +def _(): + include_values = np.where( + (cdffile['Quality_Flag'][:] >= 5) & ( + cdffile['Day_Night_Flag'][:] == 1) & ( + cdffile['Longitude'][:] >= select_lon - radius) & ( + cdffile['Longitude'][:] <= select_lon + radius) & ( + cdffile['Latitude'][:] >= select_lat - radius) & ( + cdffile['Latitude'][:] <= select_lat + radius)) +""" + expected_code = """\ +def _(): + include_values = np.where( + (cdffile['Quality_Flag'][:] >= 5) & (cdffile['Day_Night_Flag'][:] == 1) + & (cdffile['Longitude'][:] >= select_lon - radius) + & (cdffile['Longitude'][:] <= select_lon + radius) + & (cdffile['Latitude'][:] >= select_lat - radius) + & (cdffile['Latitude'][:] <= select_lat + radius)) +""" + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertEqual(expected_code, reformatter.Reformat(uwlines)) + + def testNoBlankLinesOnlyForFirstNestedObject(self): + unformatted_code = '''\ +class Demo: + """ + Demo docs + """ + def foo(self): + """ + foo docs + """ + def bar(self): + """ + bar docs + """ +''' + expected_code = '''\ +class Demo: + """ + Demo docs + """ + def foo(self): + """ + foo docs + """ + + def bar(self): + """ + bar docs + """ +''' + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertEqual(expected_code, reformatter.Reformat(uwlines)) + + def testSplitBeforeArithmeticOperators(self): + try: + style.SetGlobalStyle( + style.CreateStyleFromConfig( + '{based_on_style: pep8, split_before_arithmetic_operator: true}')) + + unformatted_code = """\ +def _(): + raise ValueError('This is a long message that ends with an argument: ' + str(42)) +""" + expected_formatted_code = """\ +def _(): + raise ValueError('This is a long message that ends with an argument: ' + + str(42)) +""" + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, + reformatter.Reformat(uwlines)) + finally: + style.SetGlobalStyle(style.CreatePEP8Style()) + + def testListSplitting(self): + unformatted_code = """\ +foo([(1,1), (1,1), (1,1), (1,1), (1,1), (1,1), (1,1), + (1,1), (1,1), (1,1), (1,1), (1,1), (1,1), (1,1), + (1,10), (1,11), (1, 10), (1,11), (10,11)]) +""" + expected_code = """\ +foo([(1, 1), (1, 1), (1, 1), (1, 1), (1, 1), (1, 1), (1, 1), (1, 1), (1, 1), + (1, 1), (1, 1), (1, 1), (1, 1), (1, 1), (1, 10), (1, 11), (1, 10), + (1, 11), (10, 11)]) +""" + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_code, reformatter.Reformat(uwlines)) + + def testNoBlankLineBeforeNestedFuncOrClass(self): + try: + style.SetGlobalStyle( + style.CreateStyleFromConfig( + '{based_on_style: pep8, ' + 'blank_line_before_nested_class_or_def: false}')) + + unformatted_code = '''\ +def normal_function(): + """Return the nested function.""" + + def nested_function(): + """Do nothing just nest within.""" + + @nested(klass) + class nested_class(): + pass + + pass + + return nested_function +''' + expected_formatted_code = '''\ +def normal_function(): + """Return the nested function.""" + def nested_function(): + """Do nothing just nest within.""" + @nested(klass) + class nested_class(): + pass + + pass + + return nested_function +''' + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, + reformatter.Reformat(uwlines)) + finally: + style.SetGlobalStyle(style.CreatePEP8Style()) + + def testParamListIndentationCollision1(self): + unformatted_code = textwrap.dedent("""\ +class _(): + + def __init__(self, title: Optional[str], diffs: Collection[BinaryDiff] = (), charset: Union[Type[AsciiCharset], Type[LineCharset]] = AsciiCharset, preprocess: Callable[[str], str] = identity, + # TODO(somebody): Make this a Literal type. + justify: str = 'rjust'): + self._cs = charset + self._preprocess = preprocess + """) + expected_formatted_code = textwrap.dedent("""\ +class _(): + def __init__( + self, + title: Optional[str], + diffs: Collection[BinaryDiff] = (), + charset: Union[Type[AsciiCharset], + Type[LineCharset]] = AsciiCharset, + preprocess: Callable[[str], str] = identity, + # TODO(somebody): Make this a Literal type. + justify: str = 'rjust'): + self._cs = charset + self._preprocess = preprocess + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testParamListIndentationCollision2(self): + code = textwrap.dedent("""\ + def simple_pass_function_with_an_extremely_long_name_and_some_arguments( + argument0, argument1): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testParamListIndentationCollision3(self): + code = textwrap.dedent("""\ + def func1( + arg1, + arg2, + ) -> None: + pass + + + def func2( + arg1, + arg2, + ): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testTwoWordComparisonOperators(self): + unformatted_code = textwrap.dedent("""\ + _ = (klsdfjdklsfjksdlfjdklsfjdslkfjsdkl is not ksldfjsdklfjdklsfjdklsfjdklsfjdsklfjdklsfj) + _ = (klsdfjdklsfjksdlfjdklsfjdslkfjsdkl not in {ksldfjsdklfjdklsfjdklsfjdklsfjdsklfjdklsfj}) + """) + expected_formatted_code = textwrap.dedent("""\ + _ = (klsdfjdklsfjksdlfjdklsfjdslkfjsdkl + is not ksldfjsdklfjdklsfjdklsfjdklsfjdsklfjdklsfj) + _ = (klsdfjdklsfjksdlfjdklsfjdslkfjsdkl + not in {ksldfjsdklfjdklsfjdklsfjdklsfjdsklfjdklsfj}) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + @unittest.skipUnless(not py3compat.PY3, 'Requires Python 2.7') + def testAsyncAsNonKeyword(self): + # In Python 2, async may be used as a non-keyword identifier. + code = textwrap.dedent("""\ + from util import async + + + class A(object): + def foo(self): + async.run() + + def bar(self): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines, verify=False)) + + def testStableInlinedDictionaryFormatting(self): + unformatted_code = textwrap.dedent("""\ + def _(): + url = "http://{0}/axis-cgi/admin/param.cgi?{1}".format( + value, urllib.urlencode({'action': 'update', 'parameter': value})) + """) + expected_formatted_code = textwrap.dedent("""\ + def _(): + url = "http://{0}/axis-cgi/admin/param.cgi?{1}".format( + value, urllib.urlencode({ + 'action': 'update', + 'parameter': value + })) + """) + + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + reformatted_code = reformatter.Reformat(uwlines) + self.assertCodeEqual(expected_formatted_code, reformatted_code) + + uwlines = yapf_test_helper.ParseAndUnwrap(reformatted_code) + reformatted_code = reformatter.Reformat(uwlines) + self.assertCodeEqual(expected_formatted_code, reformatted_code) + + +class TestsForSpacesInsideBrackets(yapf_test_helper.YAPFTest): + """Test the SPACE_INSIDE_BRACKETS style option.""" + unformatted_code = textwrap.dedent("""\ + foo() + foo(1) + foo(1,2) + foo((1,)) + foo((1, 2)) + foo((1, 2,)) + foo(bar['baz'][0]) + set1 = {1, 2, 3} + dict1 = {1: 1, foo: 2, 3: bar} + dict2 = { + 1: 1, + foo: 2, + 3: bar, + } + dict3[3][1][get_index(*args,**kwargs)] + dict4[3][1][get_index(**kwargs)] + x = dict5[4](foo(*args)) + a = list1[:] + b = list2[slice_start:] + c = list3[slice_start:slice_end] + d = list4[slice_start:slice_end:] + e = list5[slice_start:slice_end:slice_step] + # Print gets special handling + print(set2) + compound = ((10+3)/(5-2**(6+x))) + string_idx = "mystring"[3] + """) + + def testEnabled(self): + style.SetGlobalStyle( + style.CreateStyleFromConfig('{space_inside_brackets: True}')) + + expected_formatted_code = textwrap.dedent("""\ + foo() + foo( 1 ) + foo( 1, 2 ) + foo( ( 1, ) ) + foo( ( 1, 2 ) ) + foo( ( + 1, + 2, + ) ) + foo( bar[ 'baz' ][ 0 ] ) + set1 = { 1, 2, 3 } + dict1 = { 1: 1, foo: 2, 3: bar } + dict2 = { + 1: 1, + foo: 2, + 3: bar, + } + dict3[ 3 ][ 1 ][ get_index( *args, **kwargs ) ] + dict4[ 3 ][ 1 ][ get_index( **kwargs ) ] + x = dict5[ 4 ]( foo( *args ) ) + a = list1[ : ] + b = list2[ slice_start: ] + c = list3[ slice_start:slice_end ] + d = list4[ slice_start:slice_end: ] + e = list5[ slice_start:slice_end:slice_step ] + # Print gets special handling + print( set2 ) + compound = ( ( 10 + 3 ) / ( 5 - 2**( 6 + x ) ) ) + string_idx = "mystring"[ 3 ] + """) + + uwlines = yapf_test_helper.ParseAndUnwrap(self.unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testDefault(self): + style.SetGlobalStyle(style.CreatePEP8Style()) + + expected_formatted_code = textwrap.dedent("""\ + foo() + foo(1) + foo(1, 2) + foo((1, )) + foo((1, 2)) + foo(( + 1, + 2, + )) + foo(bar['baz'][0]) + set1 = {1, 2, 3} + dict1 = {1: 1, foo: 2, 3: bar} + dict2 = { + 1: 1, + foo: 2, + 3: bar, + } + dict3[3][1][get_index(*args, **kwargs)] + dict4[3][1][get_index(**kwargs)] + x = dict5[4](foo(*args)) + a = list1[:] + b = list2[slice_start:] + c = list3[slice_start:slice_end] + d = list4[slice_start:slice_end:] + e = list5[slice_start:slice_end:slice_step] + # Print gets special handling + print(set2) + compound = ((10 + 3) / (5 - 2**(6 + x))) + string_idx = "mystring"[3] + """) + + uwlines = yapf_test_helper.ParseAndUnwrap(self.unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + @unittest.skipUnless(py3compat.PY36, 'Requires Python 3.6') + def testAwait(self): + style.SetGlobalStyle( + style.CreateStyleFromConfig('{space_inside_brackets: True}')) + unformatted_code = textwrap.dedent("""\ + import asyncio + import time + + @print_args + async def slow_operation(): + await asyncio.sleep(1) + # print("Slow operation {} complete".format(n)) + async def main(): + start = time.time() + if (await get_html()): + pass + """) + expected_formatted_code = textwrap.dedent("""\ + import asyncio + import time + + + @print_args + async def slow_operation(): + await asyncio.sleep( 1 ) + + # print("Slow operation {} complete".format(n)) + async def main(): + start = time.time() + if ( await get_html() ): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + +class TestsForSpacesAroundSubscriptColon(yapf_test_helper.YAPFTest): + """Test the SPACES_AROUND_SUBSCRIPT_COLON style option.""" + unformatted_code = textwrap.dedent("""\ + a = list1[ : ] + b = list2[ slice_start: ] + c = list3[ slice_start:slice_end ] + d = list4[ slice_start:slice_end: ] + e = list5[ slice_start:slice_end:slice_step ] + a1 = list1[ : ] + b1 = list2[ 1: ] + c1 = list3[ 1:20 ] + d1 = list4[ 1:20: ] + e1 = list5[ 1:20:3 ] + """) + + def testEnabled(self): + style.SetGlobalStyle( + style.CreateStyleFromConfig('{spaces_around_subscript_colon: True}')) + expected_formatted_code = textwrap.dedent("""\ + a = list1[:] + b = list2[slice_start :] + c = list3[slice_start : slice_end] + d = list4[slice_start : slice_end :] + e = list5[slice_start : slice_end : slice_step] + a1 = list1[:] + b1 = list2[1 :] + c1 = list3[1 : 20] + d1 = list4[1 : 20 :] + e1 = list5[1 : 20 : 3] + """) + uwlines = yapf_test_helper.ParseAndUnwrap(self.unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testWithSpaceInsideBrackets(self): + style.SetGlobalStyle( + style.CreateStyleFromConfig('{' + 'spaces_around_subscript_colon: true, ' + 'space_inside_brackets: true,' + '}')) + expected_formatted_code = textwrap.dedent("""\ + a = list1[ : ] + b = list2[ slice_start : ] + c = list3[ slice_start : slice_end ] + d = list4[ slice_start : slice_end : ] + e = list5[ slice_start : slice_end : slice_step ] + a1 = list1[ : ] + b1 = list2[ 1 : ] + c1 = list3[ 1 : 20 ] + d1 = list4[ 1 : 20 : ] + e1 = list5[ 1 : 20 : 3 ] + """) + uwlines = yapf_test_helper.ParseAndUnwrap(self.unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testDefault(self): + style.SetGlobalStyle(style.CreatePEP8Style()) + expected_formatted_code = textwrap.dedent("""\ + a = list1[:] + b = list2[slice_start:] + c = list3[slice_start:slice_end] + d = list4[slice_start:slice_end:] + e = list5[slice_start:slice_end:slice_step] + a1 = list1[:] + b1 = list2[1:] + c1 = list3[1:20] + d1 = list4[1:20:] + e1 = list5[1:20:3] + """) + uwlines = yapf_test_helper.ParseAndUnwrap(self.unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + +if __name__ == '__main__': + unittest.main() diff --git a/.venv/lib/python3.9/site-packages/yapftests/reformatter_python3_test.py b/.venv/lib/python3.9/site-packages/yapftests/reformatter_python3_test.py new file mode 100644 index 00000000..d06e4062 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapftests/reformatter_python3_test.py @@ -0,0 +1,471 @@ +# Copyright 2016 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Python 3 tests for yapf.reformatter.""" + +import sys +import textwrap +import unittest + +from yapf.yapflib import py3compat +from yapf.yapflib import reformatter +from yapf.yapflib import style + +from yapftests import yapf_test_helper + + +@unittest.skipUnless(py3compat.PY3, 'Requires Python 3') +class TestsForPython3Code(yapf_test_helper.YAPFTest): + """Test a few constructs that are new Python 3 syntax.""" + + @classmethod + def setUpClass(cls): # pylint: disable=g-missing-super-call + style.SetGlobalStyle(style.CreatePEP8Style()) + + def testTypedNames(self): + unformatted_code = textwrap.dedent("""\ + def x(aaaaaaaaaaaaaaa:int,bbbbbbbbbbbbbbbb:str,ccccccccccccccc:dict,eeeeeeeeeeeeee:set={1, 2, 3})->bool: + pass + """) + expected_formatted_code = textwrap.dedent("""\ + def x(aaaaaaaaaaaaaaa: int, + bbbbbbbbbbbbbbbb: str, + ccccccccccccccc: dict, + eeeeeeeeeeeeee: set = {1, 2, 3}) -> bool: + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testTypedNameWithLongNamedArg(self): + unformatted_code = textwrap.dedent("""\ + def func(arg=long_function_call_that_pushes_the_line_over_eighty_characters()) -> ReturnType: + pass + """) + expected_formatted_code = textwrap.dedent("""\ + def func(arg=long_function_call_that_pushes_the_line_over_eighty_characters() + ) -> ReturnType: + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testKeywordOnlyArgSpecifier(self): + unformatted_code = textwrap.dedent("""\ + def foo(a, *, kw): + return a+kw + """) + expected_formatted_code = textwrap.dedent("""\ + def foo(a, *, kw): + return a + kw + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + @unittest.skipUnless(py3compat.PY36, 'Requires Python 3.6') + def testPEP448ParameterExpansion(self): + unformatted_code = textwrap.dedent("""\ + { ** x } + { **{} } + { **{ **x }, **x } + {'a': 1, **kw , 'b':3, **kw2 } + """) + expected_formatted_code = textwrap.dedent("""\ + {**x} + {**{}} + {**{**x}, **x} + {'a': 1, **kw, 'b': 3, **kw2} + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testAnnotations(self): + unformatted_code = textwrap.dedent("""\ + def foo(a: list, b: "bar") -> dict: + return a+b + """) + expected_formatted_code = textwrap.dedent("""\ + def foo(a: list, b: "bar") -> dict: + return a + b + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testExecAsNonKeyword(self): + unformatted_code = 'methods.exec( sys.modules[name])\n' + expected_formatted_code = 'methods.exec(sys.modules[name])\n' + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testAsyncFunctions(self): + if sys.version_info[1] < 5: + return + code = textwrap.dedent("""\ + import asyncio + import time + + + @print_args + async def slow_operation(): + await asyncio.sleep(1) + # print("Slow operation {} complete".format(n)) + + + async def main(): + start = time.time() + if (await get_html()): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines, verify=False)) + + def testNoSpacesAroundPowerOperator(self): + unformatted_code = textwrap.dedent("""\ + a**b + """) + expected_formatted_code = textwrap.dedent("""\ + a ** b + """) + + try: + style.SetGlobalStyle( + style.CreateStyleFromConfig( + '{based_on_style: pep8, SPACES_AROUND_POWER_OPERATOR: True}')) + + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, + reformatter.Reformat(uwlines)) + finally: + style.SetGlobalStyle(style.CreatePEP8Style()) + + def testSpacesAroundDefaultOrNamedAssign(self): + unformatted_code = textwrap.dedent("""\ + f(a=5) + """) + expected_formatted_code = textwrap.dedent("""\ + f(a = 5) + """) + + try: + style.SetGlobalStyle( + style.CreateStyleFromConfig( + '{based_on_style: pep8, ' + 'SPACES_AROUND_DEFAULT_OR_NAMED_ASSIGN: True}')) + + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, + reformatter.Reformat(uwlines)) + finally: + style.SetGlobalStyle(style.CreatePEP8Style()) + + def testTypeHint(self): + unformatted_code = textwrap.dedent("""\ + def foo(x: int=42): + pass + + + def foo2(x: 'int' =42): + pass + """) + expected_formatted_code = textwrap.dedent("""\ + def foo(x: int = 42): + pass + + + def foo2(x: 'int' = 42): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testMatrixMultiplication(self): + unformatted_code = textwrap.dedent("""\ + a=b@c + """) + expected_formatted_code = textwrap.dedent("""\ + a = b @ c + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testNoneKeyword(self): + code = """\ +None.__ne__() +""" + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testAsyncWithPrecedingComment(self): + if sys.version_info[1] < 5: + return + unformatted_code = textwrap.dedent("""\ + import asyncio + + # Comment + async def bar(): + pass + + async def foo(): + pass + """) + expected_formatted_code = textwrap.dedent("""\ + import asyncio + + + # Comment + async def bar(): + pass + + + async def foo(): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testAsyncFunctionsNested(self): + if sys.version_info[1] < 5: + return + code = textwrap.dedent("""\ + async def outer(): + async def inner(): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testKeepTypesIntact(self): + if sys.version_info[1] < 5: + return + unformatted_code = textwrap.dedent("""\ + def _ReduceAbstractContainers( + self, *args: Optional[automation_converter.PyiCollectionAbc]) -> List[ + automation_converter.PyiCollectionAbc]: + pass + """) + expected_formatted_code = textwrap.dedent("""\ + def _ReduceAbstractContainers( + self, *args: Optional[automation_converter.PyiCollectionAbc] + ) -> List[automation_converter.PyiCollectionAbc]: + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testContinuationIndentWithAsync(self): + if sys.version_info[1] < 5: + return + unformatted_code = textwrap.dedent("""\ + async def start_websocket(): + async with session.ws_connect( + r"ws://a_really_long_long_long_long_long_long_url") as ws: + pass + """) + expected_formatted_code = textwrap.dedent("""\ + async def start_websocket(): + async with session.ws_connect( + r"ws://a_really_long_long_long_long_long_long_url") as ws: + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testSplittingArguments(self): + if sys.version_info[1] < 5: + return + + unformatted_code = """\ +async def open_file(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None): + pass + +async def run_sync_in_worker_thread(sync_fn, *args, cancellable=False, limiter=None): + pass + +def open_file(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None): + pass + +def run_sync_in_worker_thread(sync_fn, *args, cancellable=False, limiter=None): + pass +""" + expected_formatted_code = """\ +async def open_file( + file, + mode='r', + buffering=-1, + encoding=None, + errors=None, + newline=None, + closefd=True, + opener=None +): + pass + + +async def run_sync_in_worker_thread( + sync_fn, *args, cancellable=False, limiter=None +): + pass + + +def open_file( + file, + mode='r', + buffering=-1, + encoding=None, + errors=None, + newline=None, + closefd=True, + opener=None +): + pass + + +def run_sync_in_worker_thread(sync_fn, *args, cancellable=False, limiter=None): + pass +""" + + try: + style.SetGlobalStyle( + style.CreateStyleFromConfig( + '{based_on_style: pep8, ' + 'dedent_closing_brackets: true, ' + 'coalesce_brackets: false, ' + 'space_between_ending_comma_and_closing_bracket: false, ' + 'split_arguments_when_comma_terminated: true, ' + 'split_before_first_argument: true}')) + + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, + reformatter.Reformat(uwlines)) + finally: + style.SetGlobalStyle(style.CreatePEP8Style()) + + def testDictUnpacking(self): + if sys.version_info[1] < 5: + return + unformatted_code = """\ +class Foo: + def foo(self): + foofoofoofoofoofoofoofoo('foofoofoofoofoo', { + + 'foo': 'foo', + + **foofoofoo + }) +""" + expected_formatted_code = """\ +class Foo: + def foo(self): + foofoofoofoofoofoofoofoo('foofoofoofoofoo', { + 'foo': 'foo', + **foofoofoo + }) +""" + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testMultilineFormatString(self): + if sys.version_info[1] < 6: + return + code = """\ +# yapf: disable +(f''' + ''') +# yapf: enable +""" + # https://github.com/google/yapf/issues/513 + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testEllipses(self): + if sys.version_info[1] < 6: + return + code = """\ +def dirichlet(x12345678901234567890123456789012345678901234567890=...) -> None: + return +""" + # https://github.com/google/yapf/issues/533 + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testFunctionTypedReturnNextLine(self): + code = """\ +def _GenerateStatsEntries( + process_id: Text, + timestamp: Optional[ffffffff.FFFFFFFFFFF] = None +) -> Sequence[ssssssssssss.SSSSSSSSSSSSSSS]: + pass +""" + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testFunctionTypedReturnSameLine(self): + code = """\ +def rrrrrrrrrrrrrrrrrrrrrr( + ccccccccccccccccccccccc: Tuple[Text, Text]) -> List[Tuple[Text, Text]]: + pass +""" + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testAsyncForElseNotIndentedInsideBody(self): + if sys.version_info[1] < 5: + return + code = textwrap.dedent("""\ + async def fn(): + async for message in websocket: + for i in range(10): + pass + else: + pass + else: + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testForElseInAsyncNotMixedWithAsyncFor(self): + if sys.version_info[1] < 5: + return + code = textwrap.dedent("""\ + async def fn(): + for i in range(10): + pass + else: + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self.assertCodeEqual(code, reformatter.Reformat(uwlines)) + + def testParameterListIndentationConflicts(self): + unformatted_code = textwrap.dedent("""\ + def raw_message( # pylint: disable=too-many-arguments + self, text, user_id=1000, chat_type='private', forward_date=None, forward_from=None): + pass + """) + expected_formatted_code = textwrap.dedent("""\ + def raw_message( # pylint: disable=too-many-arguments + self, + text, + user_id=1000, + chat_type='private', + forward_date=None, + forward_from=None): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + +if __name__ == '__main__': + unittest.main() diff --git a/.venv/lib/python3.9/site-packages/yapftests/reformatter_style_config_test.py b/.venv/lib/python3.9/site-packages/yapftests/reformatter_style_config_test.py new file mode 100644 index 00000000..d77c1970 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapftests/reformatter_style_config_test.py @@ -0,0 +1,198 @@ +# Copyright 2016 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Style config tests for yapf.reformatter.""" + +import textwrap +import unittest + +from yapf.yapflib import reformatter +from yapf.yapflib import style + +from yapftests import yapf_test_helper + + +class TestsForStyleConfig(yapf_test_helper.YAPFTest): + + def setUp(self): + self.current_style = style.DEFAULT_STYLE + + def testSetGlobalStyle(self): + try: + style.SetGlobalStyle(style.CreateYapfStyle()) + unformatted_code = textwrap.dedent(u"""\ + for i in range(5): + print('bar') + """) + expected_formatted_code = textwrap.dedent(u"""\ + for i in range(5): + print('bar') + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, + reformatter.Reformat(uwlines)) + finally: + style.SetGlobalStyle(style.CreatePEP8Style()) + style.DEFAULT_STYLE = self.current_style + + unformatted_code = textwrap.dedent(u"""\ + for i in range(5): + print('bar') + """) + expected_formatted_code = textwrap.dedent(u"""\ + for i in range(5): + print('bar') + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines)) + + def testOperatorNoSpaceStyle(self): + try: + sympy_style = style.CreatePEP8Style() + sympy_style['NO_SPACES_AROUND_SELECTED_BINARY_OPERATORS'] = \ + style._StringSetConverter('*,/') + style.SetGlobalStyle(sympy_style) + unformatted_code = textwrap.dedent("""\ + a = 1+2 * 3 - 4 / 5 + b = '0' * 1 + """) + expected_formatted_code = textwrap.dedent("""\ + a = 1 + 2*3 - 4/5 + b = '0'*1 + """) + + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, + reformatter.Reformat(uwlines)) + finally: + style.SetGlobalStyle(style.CreatePEP8Style()) + style.DEFAULT_STYLE = self.current_style + + def testOperatorPrecedenceStyle(self): + try: + pep8_with_precedence = style.CreatePEP8Style() + pep8_with_precedence['ARITHMETIC_PRECEDENCE_INDICATION'] = True + style.SetGlobalStyle(pep8_with_precedence) + unformatted_code = textwrap.dedent("""\ + 1+2 + (1 + 2) * (3 - (4 / 5)) + a = 1 * 2 + 3 / 4 + b = 1 / 2 - 3 * 4 + c = (1 + 2) * (3 - 4) + d = (1 - 2) / (3 + 4) + e = 1 * 2 - 3 + f = 1 + 2 + 3 + 4 + g = 1 * 2 * 3 * 4 + h = 1 + 2 - 3 + 4 + i = 1 * 2 / 3 * 4 + j = (1 * 2 - 3) + 4 + k = (1 * 2 * 3) + (4 * 5 * 6 * 7 * 8) + """) + expected_formatted_code = textwrap.dedent("""\ + 1 + 2 + (1+2) * (3 - (4/5)) + a = 1*2 + 3/4 + b = 1/2 - 3*4 + c = (1+2) * (3-4) + d = (1-2) / (3+4) + e = 1*2 - 3 + f = 1 + 2 + 3 + 4 + g = 1 * 2 * 3 * 4 + h = 1 + 2 - 3 + 4 + i = 1 * 2 / 3 * 4 + j = (1*2 - 3) + 4 + k = (1*2*3) + (4*5*6*7*8) + """) + + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, + reformatter.Reformat(uwlines)) + finally: + style.SetGlobalStyle(style.CreatePEP8Style()) + style.DEFAULT_STYLE = self.current_style + + def testNoSplitBeforeFirstArgumentStyle1(self): + try: + pep8_no_split_before_first = style.CreatePEP8Style() + pep8_no_split_before_first['SPLIT_BEFORE_FIRST_ARGUMENT'] = False + pep8_no_split_before_first['SPLIT_BEFORE_NAMED_ASSIGNS'] = False + style.SetGlobalStyle(pep8_no_split_before_first) + formatted_code = textwrap.dedent("""\ + # Example from in-code MustSplit comments + foo = outer_function_call(fitting_inner_function_call(inner_arg1, inner_arg2), + outer_arg1, outer_arg2) + + foo = outer_function_call( + not_fitting_inner_function_call(inner_arg1, inner_arg2), outer_arg1, + outer_arg2) + + # Examples Issue#424 + a_super_long_version_of_print(argument1, argument2, argument3, argument4, + argument5, argument6, argument7) + + CREDS_FILE = os.path.join(os.path.expanduser('~'), + 'apis/super-secret-admin-creds.json') + + # Examples Issue#556 + i_take_a_lot_of_params(arg1, param1=very_long_expression1(), + param2=very_long_expression2(), + param3=very_long_expression3(), + param4=very_long_expression4()) + + # Examples Issue#590 + plt.plot(numpy.linspace(0, 1, 10), numpy.linspace(0, 1, 10), marker="x", + color="r") + + plt.plot(veryverylongvariablename, veryverylongvariablename, marker="x", + color="r") + """) + uwlines = yapf_test_helper.ParseAndUnwrap(formatted_code) + self.assertCodeEqual(formatted_code, reformatter.Reformat(uwlines)) + finally: + style.SetGlobalStyle(style.CreatePEP8Style()) + style.DEFAULT_STYLE = self.current_style + + def testNoSplitBeforeFirstArgumentStyle2(self): + try: + pep8_no_split_before_first = style.CreatePEP8Style() + pep8_no_split_before_first['SPLIT_BEFORE_FIRST_ARGUMENT'] = False + pep8_no_split_before_first['SPLIT_BEFORE_NAMED_ASSIGNS'] = True + style.SetGlobalStyle(pep8_no_split_before_first) + formatted_code = textwrap.dedent("""\ + # Examples Issue#556 + i_take_a_lot_of_params(arg1, + param1=very_long_expression1(), + param2=very_long_expression2(), + param3=very_long_expression3(), + param4=very_long_expression4()) + + # Examples Issue#590 + plt.plot(numpy.linspace(0, 1, 10), + numpy.linspace(0, 1, 10), + marker="x", + color="r") + + plt.plot(veryverylongvariablename, + veryverylongvariablename, + marker="x", + color="r") + """) + uwlines = yapf_test_helper.ParseAndUnwrap(formatted_code) + self.assertCodeEqual(formatted_code, reformatter.Reformat(uwlines)) + finally: + style.SetGlobalStyle(style.CreatePEP8Style()) + style.DEFAULT_STYLE = self.current_style + + +if __name__ == '__main__': + unittest.main() diff --git a/.venv/lib/python3.9/site-packages/yapftests/reformatter_verify_test.py b/.venv/lib/python3.9/site-packages/yapftests/reformatter_verify_test.py new file mode 100644 index 00000000..1b3d5b08 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapftests/reformatter_verify_test.py @@ -0,0 +1,108 @@ +# Copyright 2016 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Tests for yapf.reformatter.""" + +import textwrap +import unittest + +from yapf.yapflib import py3compat +from yapf.yapflib import reformatter +from yapf.yapflib import style +from yapf.yapflib import verifier + +from yapftests import yapf_test_helper + + +@unittest.skipIf(py3compat.PY3, 'Requires Python 2') +class TestVerifyNoVerify(yapf_test_helper.YAPFTest): + + @classmethod + def setUpClass(cls): + style.SetGlobalStyle(style.CreatePEP8Style()) + + def testVerifyException(self): + unformatted_code = textwrap.dedent("""\ + class ABC(metaclass=type): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + with self.assertRaises(verifier.InternalError): + reformatter.Reformat(uwlines, verify=True) + reformatter.Reformat(uwlines) # verify should be False by default. + + def testNoVerify(self): + unformatted_code = textwrap.dedent("""\ + class ABC(metaclass=type): + pass + """) + expected_formatted_code = textwrap.dedent("""\ + class ABC(metaclass=type): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, + reformatter.Reformat(uwlines, verify=False)) + + def testVerifyFutureImport(self): + unformatted_code = textwrap.dedent("""\ + from __future__ import print_function + + def call_my_function(the_function): + the_function("hi") + + if __name__ == "__main__": + call_my_function(print) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + with self.assertRaises(verifier.InternalError): + reformatter.Reformat(uwlines, verify=True) + + expected_formatted_code = textwrap.dedent("""\ + from __future__ import print_function + + + def call_my_function(the_function): + the_function("hi") + + + if __name__ == "__main__": + call_my_function(print) + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, + reformatter.Reformat(uwlines, verify=False)) + + def testContinuationLineShouldBeDistinguished(self): + unformatted_code = textwrap.dedent("""\ + class Foo(object): + + def bar(self): + if self.solo_generator_that_is_long is None and len( + self.generators + self.next_batch) == 1: + pass + """) + expected_formatted_code = textwrap.dedent("""\ + class Foo(object): + def bar(self): + if self.solo_generator_that_is_long is None and len( + self.generators + self.next_batch) == 1: + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code) + self.assertCodeEqual(expected_formatted_code, + reformatter.Reformat(uwlines, verify=False)) + + +if __name__ == '__main__': + unittest.main() diff --git a/.venv/lib/python3.9/site-packages/yapftests/split_penalty_test.py b/.venv/lib/python3.9/site-packages/yapftests/split_penalty_test.py new file mode 100644 index 00000000..4d551291 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapftests/split_penalty_test.py @@ -0,0 +1,266 @@ +# Copyright 2015 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Tests for yapf.split_penalty.""" + +import sys +import textwrap +import unittest + +from lib2to3 import pytree + +from yapf.yapflib import pytree_utils +from yapf.yapflib import pytree_visitor +from yapf.yapflib import split_penalty +from yapf.yapflib import style + +from yapftests import yapf_test_helper + +UNBREAKABLE = split_penalty.UNBREAKABLE +VERY_STRONGLY_CONNECTED = split_penalty.VERY_STRONGLY_CONNECTED +DOTTED_NAME = split_penalty.DOTTED_NAME +STRONGLY_CONNECTED = split_penalty.STRONGLY_CONNECTED + + +class SplitPenaltyTest(yapf_test_helper.YAPFTest): + + @classmethod + def setUpClass(cls): + style.SetGlobalStyle(style.CreateYapfStyle()) + + def _ParseAndComputePenalties(self, code, dumptree=False): + """Parses the code and computes split penalties. + + Arguments: + code: code to parse as a string + dumptree: if True, the parsed pytree (after penalty assignment) is dumped + to stderr. Useful for debugging. + + Returns: + Parse tree. + """ + tree = pytree_utils.ParseCodeToTree(code) + split_penalty.ComputeSplitPenalties(tree) + if dumptree: + pytree_visitor.DumpPyTree(tree, target_stream=sys.stderr) + return tree + + def _CheckPenalties(self, tree, list_of_expected): + """Check that the tokens in the tree have the correct penalties. + + Args: + tree: the pytree. + list_of_expected: list of (name, penalty) pairs. Non-semantic tokens are + filtered out from the expected values. + """ + + def FlattenRec(tree): + if pytree_utils.NodeName(tree) in pytree_utils.NONSEMANTIC_TOKENS: + return [] + if isinstance(tree, pytree.Leaf): + return [(tree.value, + pytree_utils.GetNodeAnnotation( + tree, pytree_utils.Annotation.SPLIT_PENALTY))] + nodes = [] + for node in tree.children: + nodes += FlattenRec(node) + return nodes + + self.assertEqual(list_of_expected, FlattenRec(tree)) + + def testUnbreakable(self): + # Test function definitions. + code = textwrap.dedent(r""" + def foo(x): + pass + """) + tree = self._ParseAndComputePenalties(code) + self._CheckPenalties(tree, [ + ('def', None), + ('foo', UNBREAKABLE), + ('(', UNBREAKABLE), + ('x', None), + (')', STRONGLY_CONNECTED), + (':', UNBREAKABLE), + ('pass', None), + ]) + + # Test function definition with trailing comment. + code = textwrap.dedent(r""" + def foo(x): # trailing comment + pass + """) + tree = self._ParseAndComputePenalties(code) + self._CheckPenalties(tree, [ + ('def', None), + ('foo', UNBREAKABLE), + ('(', UNBREAKABLE), + ('x', None), + (')', STRONGLY_CONNECTED), + (':', UNBREAKABLE), + ('pass', None), + ]) + + # Test class definitions. + code = textwrap.dedent(r""" + class A: + pass + class B(A): + pass + """) + tree = self._ParseAndComputePenalties(code) + self._CheckPenalties(tree, [ + ('class', None), + ('A', UNBREAKABLE), + (':', UNBREAKABLE), + ('pass', None), + ('class', None), + ('B', UNBREAKABLE), + ('(', UNBREAKABLE), + ('A', None), + (')', None), + (':', UNBREAKABLE), + ('pass', None), + ]) + + # Test lambda definitions. + code = textwrap.dedent(r""" + lambda a, b: None + """) + tree = self._ParseAndComputePenalties(code) + self._CheckPenalties(tree, [ + ('lambda', None), + ('a', VERY_STRONGLY_CONNECTED), + (',', VERY_STRONGLY_CONNECTED), + ('b', VERY_STRONGLY_CONNECTED), + (':', VERY_STRONGLY_CONNECTED), + ('None', VERY_STRONGLY_CONNECTED), + ]) + + # Test dotted names. + code = textwrap.dedent(r""" + import a.b.c + """) + tree = self._ParseAndComputePenalties(code) + self._CheckPenalties(tree, [ + ('import', None), + ('a', None), + ('.', UNBREAKABLE), + ('b', UNBREAKABLE), + ('.', UNBREAKABLE), + ('c', UNBREAKABLE), + ]) + + def testStronglyConnected(self): + # Test dictionary keys. + code = textwrap.dedent(r""" + a = { + 'x': 42, + y(lambda a: 23): 37, + } + """) + tree = self._ParseAndComputePenalties(code) + self._CheckPenalties(tree, [ + ('a', None), + ('=', None), + ('{', None), + ("'x'", None), + (':', STRONGLY_CONNECTED), + ('42', None), + (',', None), + ('y', None), + ('(', UNBREAKABLE), + ('lambda', STRONGLY_CONNECTED), + ('a', VERY_STRONGLY_CONNECTED), + (':', VERY_STRONGLY_CONNECTED), + ('23', VERY_STRONGLY_CONNECTED), + (')', VERY_STRONGLY_CONNECTED), + (':', STRONGLY_CONNECTED), + ('37', None), + (',', None), + ('}', None), + ]) + + # Test list comprehension. + code = textwrap.dedent(r""" + [a for a in foo if a.x == 37] + """) + tree = self._ParseAndComputePenalties(code) + self._CheckPenalties(tree, [ + ('[', None), + ('a', None), + ('for', 0), + ('a', STRONGLY_CONNECTED), + ('in', STRONGLY_CONNECTED), + ('foo', STRONGLY_CONNECTED), + ('if', 0), + ('a', STRONGLY_CONNECTED), + ('.', VERY_STRONGLY_CONNECTED), + ('x', DOTTED_NAME), + ('==', STRONGLY_CONNECTED), + ('37', STRONGLY_CONNECTED), + (']', None), + ]) + + def testFuncCalls(self): + code = 'foo(1, 2, 3)\n' + tree = self._ParseAndComputePenalties(code) + self._CheckPenalties(tree, [ + ('foo', None), + ('(', UNBREAKABLE), + ('1', None), + (',', UNBREAKABLE), + ('2', None), + (',', UNBREAKABLE), + ('3', None), + (')', VERY_STRONGLY_CONNECTED), + ]) + + # Now a method call, which has more than one trailer + code = 'foo.bar.baz(1, 2, 3)\n' + tree = self._ParseAndComputePenalties(code) + self._CheckPenalties(tree, [ + ('foo', None), + ('.', VERY_STRONGLY_CONNECTED), + ('bar', DOTTED_NAME), + ('.', VERY_STRONGLY_CONNECTED), + ('baz', DOTTED_NAME), + ('(', STRONGLY_CONNECTED), + ('1', None), + (',', UNBREAKABLE), + ('2', None), + (',', UNBREAKABLE), + ('3', None), + (')', VERY_STRONGLY_CONNECTED), + ]) + + # Test single generator argument. + code = 'max(i for i in xrange(10))\n' + tree = self._ParseAndComputePenalties(code) + self._CheckPenalties(tree, [ + ('max', None), + ('(', UNBREAKABLE), + ('i', 0), + ('for', 0), + ('i', STRONGLY_CONNECTED), + ('in', STRONGLY_CONNECTED), + ('xrange', STRONGLY_CONNECTED), + ('(', UNBREAKABLE), + ('10', STRONGLY_CONNECTED), + (')', VERY_STRONGLY_CONNECTED), + (')', VERY_STRONGLY_CONNECTED), + ]) + + +if __name__ == '__main__': + unittest.main() diff --git a/.venv/lib/python3.9/site-packages/yapftests/style_test.py b/.venv/lib/python3.9/site-packages/yapftests/style_test.py new file mode 100644 index 00000000..2fd3f2d0 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapftests/style_test.py @@ -0,0 +1,336 @@ +# -*- coding: utf-8 -*- +# Copyright 2015 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Tests for yapf.style.""" + +import os +import shutil +import tempfile +import textwrap +import unittest + +from yapf.yapflib import style + +from yapftests import utils + + +class UtilsTest(unittest.TestCase): + + def testContinuationAlignStyleStringConverter(self): + for cont_align_space in ('', 'space', '"space"', '\'space\''): + self.assertEqual( + style._ContinuationAlignStyleStringConverter(cont_align_space), + 'SPACE') + for cont_align_fixed in ('fixed', '"fixed"', '\'fixed\''): + self.assertEqual( + style._ContinuationAlignStyleStringConverter(cont_align_fixed), + 'FIXED') + for cont_align_valignright in ( + 'valign-right', + '"valign-right"', + '\'valign-right\'', + 'valign_right', + '"valign_right"', + '\'valign_right\'', + ): + self.assertEqual( + style._ContinuationAlignStyleStringConverter(cont_align_valignright), + 'VALIGN-RIGHT') + with self.assertRaises(ValueError) as ctx: + style._ContinuationAlignStyleStringConverter('blahblah') + self.assertIn("unknown continuation align style: 'blahblah'", + str(ctx.exception)) + + def testStringListConverter(self): + self.assertEqual(style._StringListConverter('foo, bar'), ['foo', 'bar']) + self.assertEqual(style._StringListConverter('foo,bar'), ['foo', 'bar']) + self.assertEqual(style._StringListConverter(' foo'), ['foo']) + self.assertEqual( + style._StringListConverter('joe ,foo, bar'), ['joe', 'foo', 'bar']) + + def testBoolConverter(self): + self.assertEqual(style._BoolConverter('true'), True) + self.assertEqual(style._BoolConverter('1'), True) + self.assertEqual(style._BoolConverter('false'), False) + self.assertEqual(style._BoolConverter('0'), False) + + def testIntListConverter(self): + self.assertEqual(style._IntListConverter('1, 2, 3'), [1, 2, 3]) + self.assertEqual(style._IntListConverter('[ 1, 2, 3 ]'), [1, 2, 3]) + self.assertEqual(style._IntListConverter('[ 1, 2, 3, ]'), [1, 2, 3]) + + def testIntOrIntListConverter(self): + self.assertEqual(style._IntOrIntListConverter('10'), 10) + self.assertEqual(style._IntOrIntListConverter('1, 2, 3'), [1, 2, 3]) + + +def _LooksLikeGoogleStyle(cfg): + return cfg['COLUMN_LIMIT'] == 80 and cfg['SPLIT_COMPLEX_COMPREHENSION'] + + +def _LooksLikePEP8Style(cfg): + return cfg['COLUMN_LIMIT'] == 79 + + +def _LooksLikeFacebookStyle(cfg): + return cfg['DEDENT_CLOSING_BRACKETS'] + + +def _LooksLikeYapfStyle(cfg): + return cfg['SPLIT_BEFORE_DOT'] + + +class PredefinedStylesByNameTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): # pylint: disable=g-missing-super-call + style.SetGlobalStyle(style.CreatePEP8Style()) + + def testDefault(self): + # default is PEP8 + cfg = style.CreateStyleFromConfig(None) + self.assertTrue(_LooksLikePEP8Style(cfg)) + + def testPEP8ByName(self): + for pep8_name in ('PEP8', 'pep8', 'Pep8'): + cfg = style.CreateStyleFromConfig(pep8_name) + self.assertTrue(_LooksLikePEP8Style(cfg)) + + def testGoogleByName(self): + for google_name in ('google', 'Google', 'GOOGLE'): + cfg = style.CreateStyleFromConfig(google_name) + self.assertTrue(_LooksLikeGoogleStyle(cfg)) + + def testYapfByName(self): + for yapf_name in ('yapf', 'YAPF'): + cfg = style.CreateStyleFromConfig(yapf_name) + self.assertTrue(_LooksLikeYapfStyle(cfg)) + + def testFacebookByName(self): + for fb_name in ('facebook', 'FACEBOOK', 'Facebook'): + cfg = style.CreateStyleFromConfig(fb_name) + self.assertTrue(_LooksLikeFacebookStyle(cfg)) + + +class StyleFromFileTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): # pylint: disable=g-missing-super-call + cls.test_tmpdir = tempfile.mkdtemp() + style.SetGlobalStyle(style.CreatePEP8Style()) + + @classmethod + def tearDownClass(cls): # pylint: disable=g-missing-super-call + shutil.rmtree(cls.test_tmpdir) + + def testDefaultBasedOnStyle(self): + cfg = textwrap.dedent(u'''\ + [style] + continuation_indent_width = 20 + ''') + with utils.TempFileContents(self.test_tmpdir, cfg) as filepath: + cfg = style.CreateStyleFromConfig(filepath) + self.assertTrue(_LooksLikePEP8Style(cfg)) + self.assertEqual(cfg['CONTINUATION_INDENT_WIDTH'], 20) + + def testDefaultBasedOnPEP8Style(self): + cfg = textwrap.dedent(u'''\ + [style] + based_on_style = pep8 + continuation_indent_width = 40 + ''') + with utils.TempFileContents(self.test_tmpdir, cfg) as filepath: + cfg = style.CreateStyleFromConfig(filepath) + self.assertTrue(_LooksLikePEP8Style(cfg)) + self.assertEqual(cfg['CONTINUATION_INDENT_WIDTH'], 40) + + def testDefaultBasedOnGoogleStyle(self): + cfg = textwrap.dedent(u'''\ + [style] + based_on_style = google + continuation_indent_width = 20 + ''') + with utils.TempFileContents(self.test_tmpdir, cfg) as filepath: + cfg = style.CreateStyleFromConfig(filepath) + self.assertTrue(_LooksLikeGoogleStyle(cfg)) + self.assertEqual(cfg['CONTINUATION_INDENT_WIDTH'], 20) + + def testDefaultBasedOnFacebookStyle(self): + cfg = textwrap.dedent(u'''\ + [style] + based_on_style = facebook + continuation_indent_width = 20 + ''') + with utils.TempFileContents(self.test_tmpdir, cfg) as filepath: + cfg = style.CreateStyleFromConfig(filepath) + self.assertTrue(_LooksLikeFacebookStyle(cfg)) + self.assertEqual(cfg['CONTINUATION_INDENT_WIDTH'], 20) + + def testBoolOptionValue(self): + cfg = textwrap.dedent(u'''\ + [style] + based_on_style = pep8 + SPLIT_BEFORE_NAMED_ASSIGNS=False + split_before_logical_operator = true + ''') + with utils.TempFileContents(self.test_tmpdir, cfg) as filepath: + cfg = style.CreateStyleFromConfig(filepath) + self.assertTrue(_LooksLikePEP8Style(cfg)) + self.assertEqual(cfg['SPLIT_BEFORE_NAMED_ASSIGNS'], False) + self.assertEqual(cfg['SPLIT_BEFORE_LOGICAL_OPERATOR'], True) + + def testStringListOptionValue(self): + cfg = textwrap.dedent(u'''\ + [style] + based_on_style = pep8 + I18N_FUNCTION_CALL = N_, V_, T_ + ''') + with utils.TempFileContents(self.test_tmpdir, cfg) as filepath: + cfg = style.CreateStyleFromConfig(filepath) + self.assertTrue(_LooksLikePEP8Style(cfg)) + self.assertEqual(cfg['I18N_FUNCTION_CALL'], ['N_', 'V_', 'T_']) + + def testErrorNoStyleFile(self): + with self.assertRaisesRegexp(style.StyleConfigError, + 'is not a valid style or file path'): + style.CreateStyleFromConfig('/8822/xyznosuchfile') + + def testErrorNoStyleSection(self): + cfg = textwrap.dedent(u'''\ + [s] + indent_width=2 + ''') + with utils.TempFileContents(self.test_tmpdir, cfg) as filepath: + with self.assertRaisesRegexp(style.StyleConfigError, + 'Unable to find section'): + style.CreateStyleFromConfig(filepath) + + def testErrorUnknownStyleOption(self): + cfg = textwrap.dedent(u'''\ + [style] + indent_width=2 + hummus=2 + ''') + with utils.TempFileContents(self.test_tmpdir, cfg) as filepath: + with self.assertRaisesRegexp(style.StyleConfigError, + 'Unknown style option'): + style.CreateStyleFromConfig(filepath) + + def testPyprojectTomlNoYapfSection(self): + try: + import toml + except ImportError: + return + + filepath = os.path.join(self.test_tmpdir, 'pyproject.toml') + _ = open(filepath, 'w') + with self.assertRaisesRegexp(style.StyleConfigError, + 'Unable to find section'): + style.CreateStyleFromConfig(filepath) + + def testPyprojectTomlParseYapfSection(self): + try: + import toml + except ImportError: + return + + cfg = textwrap.dedent(u'''\ + [tool.yapf] + based_on_style = "pep8" + continuation_indent_width = 40 + ''') + filepath = os.path.join(self.test_tmpdir, 'pyproject.toml') + with open(filepath, 'w') as f: + f.write(cfg) + cfg = style.CreateStyleFromConfig(filepath) + self.assertTrue(_LooksLikePEP8Style(cfg)) + self.assertEqual(cfg['CONTINUATION_INDENT_WIDTH'], 40) + + +class StyleFromDict(unittest.TestCase): + + @classmethod + def setUpClass(cls): # pylint: disable=g-missing-super-call + style.SetGlobalStyle(style.CreatePEP8Style()) + + def testDefaultBasedOnStyle(self): + config_dict = { + 'based_on_style': 'pep8', + 'indent_width': 2, + 'blank_line_before_nested_class_or_def': True + } + cfg = style.CreateStyleFromConfig(config_dict) + self.assertTrue(_LooksLikePEP8Style(cfg)) + self.assertEqual(cfg['INDENT_WIDTH'], 2) + + def testDefaultBasedOnStyleBadDict(self): + self.assertRaisesRegexp(style.StyleConfigError, 'Unknown style option', + style.CreateStyleFromConfig, + {'based_on_styl': 'pep8'}) + self.assertRaisesRegexp(style.StyleConfigError, 'not a valid', + style.CreateStyleFromConfig, + {'INDENT_WIDTH': 'FOUR'}) + + +class StyleFromCommandLine(unittest.TestCase): + + @classmethod + def setUpClass(cls): # pylint: disable=g-missing-super-call + style.SetGlobalStyle(style.CreatePEP8Style()) + + def testDefaultBasedOnStyle(self): + cfg = style.CreateStyleFromConfig( + '{based_on_style: pep8,' + ' indent_width: 2,' + ' blank_line_before_nested_class_or_def: True}') + self.assertTrue(_LooksLikePEP8Style(cfg)) + self.assertEqual(cfg['INDENT_WIDTH'], 2) + + def testDefaultBasedOnStyleNotStrict(self): + cfg = style.CreateStyleFromConfig( + '{based_on_style : pep8' + ' ,indent_width=2' + ' blank_line_before_nested_class_or_def:True}') + self.assertTrue(_LooksLikePEP8Style(cfg)) + self.assertEqual(cfg['INDENT_WIDTH'], 2) + + def testDefaultBasedOnExplicitlyUnicodeTypeString(self): + cfg = style.CreateStyleFromConfig(u'{}') + self.assertIsInstance(cfg, dict) + + def testDefaultBasedOnDetaultTypeString(self): + cfg = style.CreateStyleFromConfig('{}') + self.assertIsInstance(cfg, dict) + + def testDefaultBasedOnStyleBadString(self): + self.assertRaisesRegexp(style.StyleConfigError, 'Unknown style option', + style.CreateStyleFromConfig, + '{based_on_styl: pep8}') + self.assertRaisesRegexp(style.StyleConfigError, 'not a valid', + style.CreateStyleFromConfig, '{INDENT_WIDTH: FOUR}') + self.assertRaisesRegexp(style.StyleConfigError, 'Invalid style dict', + style.CreateStyleFromConfig, + '{based_on_style: pep8') + + +class StyleHelp(unittest.TestCase): + + def testHelpKeys(self): + settings = sorted(style.Help()) + expected = sorted(style._style) + self.assertListEqual(settings, expected) + + +if __name__ == '__main__': + unittest.main() diff --git a/.venv/lib/python3.9/site-packages/yapftests/subtype_assigner_test.py b/.venv/lib/python3.9/site-packages/yapftests/subtype_assigner_test.py new file mode 100644 index 00000000..b42b8cfa --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapftests/subtype_assigner_test.py @@ -0,0 +1,304 @@ +# Copyright 2015 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Tests for yapf.subtype_assigner.""" + +import textwrap +import unittest + +from yapf.yapflib import format_token +from yapf.yapflib import pytree_utils + +from yapftests import yapf_test_helper + + +class SubtypeAssignerTest(yapf_test_helper.YAPFTest): + + def _CheckFormatTokenSubtypes(self, uwlines, list_of_expected): + """Check that the tokens in the UnwrappedLines have the expected subtypes. + + Args: + uwlines: list of UnwrappedLine. + list_of_expected: list of (name, subtype) pairs. Non-semantic tokens are + filtered out from the expected values. + """ + actual = [] + for uwl in uwlines: + filtered_values = [(ft.value, ft.subtypes) + for ft in uwl.tokens + if ft.name not in pytree_utils.NONSEMANTIC_TOKENS] + if filtered_values: + actual.append(filtered_values) + + self.assertEqual(list_of_expected, actual) + + def testFuncDefDefaultAssign(self): + self.maxDiff = None # pylint: disable=invalid-name + code = textwrap.dedent(r""" + def foo(a=37, *b, **c): + return -x[:42] + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self._CheckFormatTokenSubtypes(uwlines, [ + [ + ('def', [format_token.Subtype.NONE]), + ('foo', {format_token.Subtype.FUNC_DEF}), + ('(', {format_token.Subtype.NONE}), + ('a', { + format_token.Subtype.NONE, + format_token.Subtype.DEFAULT_OR_NAMED_ASSIGN_ARG_LIST, + format_token.Subtype.PARAMETER_START, + }), + ('=', { + format_token.Subtype.DEFAULT_OR_NAMED_ASSIGN, + format_token.Subtype.DEFAULT_OR_NAMED_ASSIGN_ARG_LIST, + }), + ('37', { + format_token.Subtype.NONE, + format_token.Subtype.PARAMETER_STOP, + format_token.Subtype.DEFAULT_OR_NAMED_ASSIGN_ARG_LIST, + }), + (',', {format_token.Subtype.NONE}), + ('*', { + format_token.Subtype.PARAMETER_START, + format_token.Subtype.VARARGS_STAR, + format_token.Subtype.DEFAULT_OR_NAMED_ASSIGN_ARG_LIST, + }), + ('b', { + format_token.Subtype.NONE, + format_token.Subtype.PARAMETER_STOP, + format_token.Subtype.DEFAULT_OR_NAMED_ASSIGN_ARG_LIST, + }), + (',', {format_token.Subtype.NONE}), + ('**', { + format_token.Subtype.PARAMETER_START, + format_token.Subtype.KWARGS_STAR_STAR, + format_token.Subtype.DEFAULT_OR_NAMED_ASSIGN_ARG_LIST, + }), + ('c', { + format_token.Subtype.NONE, + format_token.Subtype.PARAMETER_STOP, + format_token.Subtype.DEFAULT_OR_NAMED_ASSIGN_ARG_LIST, + }), + (')', {format_token.Subtype.NONE}), + (':', [format_token.Subtype.NONE]), + ], + [ + ('return', [format_token.Subtype.NONE]), + ('-', {format_token.Subtype.UNARY_OPERATOR}), + ('x', [format_token.Subtype.NONE]), + ('[', {format_token.Subtype.SUBSCRIPT_BRACKET}), + (':', {format_token.Subtype.SUBSCRIPT_COLON}), + ('42', [format_token.Subtype.NONE]), + (']', {format_token.Subtype.SUBSCRIPT_BRACKET}), + ], + ]) + + def testFuncCallWithDefaultAssign(self): + code = textwrap.dedent(r""" + foo(x, a='hello world') + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self._CheckFormatTokenSubtypes(uwlines, [ + [ + ('foo', [format_token.Subtype.NONE]), + ('(', [format_token.Subtype.NONE]), + ('x', { + format_token.Subtype.NONE, + format_token.Subtype.DEFAULT_OR_NAMED_ASSIGN_ARG_LIST, + }), + (',', {format_token.Subtype.NONE}), + ('a', { + format_token.Subtype.NONE, + format_token.Subtype.DEFAULT_OR_NAMED_ASSIGN_ARG_LIST, + }), + ('=', {format_token.Subtype.DEFAULT_OR_NAMED_ASSIGN}), + ("'hello world'", {format_token.Subtype.NONE}), + (')', [format_token.Subtype.NONE]), + ], + ]) + + def testSetComprehension(self): + code = textwrap.dedent("""\ + def foo(strs): + return {s.lower() for s in strs} + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self._CheckFormatTokenSubtypes(uwlines, [ + [ + ('def', [format_token.Subtype.NONE]), + ('foo', {format_token.Subtype.FUNC_DEF}), + ('(', {format_token.Subtype.NONE}), + ('strs', { + format_token.Subtype.NONE, + format_token.Subtype.PARAMETER_START, + format_token.Subtype.PARAMETER_STOP, + }), + (')', {format_token.Subtype.NONE}), + (':', [format_token.Subtype.NONE]), + ], + [ + ('return', [format_token.Subtype.NONE]), + ('{', [format_token.Subtype.NONE]), + ('s', {format_token.Subtype.COMP_EXPR}), + ('.', {format_token.Subtype.COMP_EXPR}), + ('lower', {format_token.Subtype.COMP_EXPR}), + ('(', {format_token.Subtype.COMP_EXPR}), + (')', {format_token.Subtype.COMP_EXPR}), + ('for', { + format_token.Subtype.DICT_SET_GENERATOR, + format_token.Subtype.COMP_FOR, + }), + ('s', {format_token.Subtype.COMP_FOR}), + ('in', {format_token.Subtype.COMP_FOR}), + ('strs', {format_token.Subtype.COMP_FOR}), + ('}', [format_token.Subtype.NONE]), + ], + ]) + + def testUnaryNotOperator(self): + code = textwrap.dedent("""\ + not a + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self._CheckFormatTokenSubtypes( + uwlines, [[('not', {format_token.Subtype.UNARY_OPERATOR}), + ('a', [format_token.Subtype.NONE])]]) + + def testBitwiseOperators(self): + code = textwrap.dedent("""\ + x = ((a | (b ^ 3) & c) << 3) >> 1 + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self._CheckFormatTokenSubtypes(uwlines, [ + [ + ('x', [format_token.Subtype.NONE]), + ('=', {format_token.Subtype.ASSIGN_OPERATOR}), + ('(', [format_token.Subtype.NONE]), + ('(', [format_token.Subtype.NONE]), + ('a', [format_token.Subtype.NONE]), + ('|', {format_token.Subtype.BINARY_OPERATOR}), + ('(', [format_token.Subtype.NONE]), + ('b', [format_token.Subtype.NONE]), + ('^', {format_token.Subtype.BINARY_OPERATOR}), + ('3', [format_token.Subtype.NONE]), + (')', [format_token.Subtype.NONE]), + ('&', {format_token.Subtype.BINARY_OPERATOR}), + ('c', [format_token.Subtype.NONE]), + (')', [format_token.Subtype.NONE]), + ('<<', {format_token.Subtype.BINARY_OPERATOR}), + ('3', [format_token.Subtype.NONE]), + (')', [format_token.Subtype.NONE]), + ('>>', {format_token.Subtype.BINARY_OPERATOR}), + ('1', [format_token.Subtype.NONE]), + ], + ]) + + def testArithmeticOperators(self): + code = textwrap.dedent("""\ + x = ((a + (b - 3) * (1 % c) @ d) / 3) // 1 + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self._CheckFormatTokenSubtypes(uwlines, [ + [ + ('x', [format_token.Subtype.NONE]), + ('=', {format_token.Subtype.ASSIGN_OPERATOR}), + ('(', [format_token.Subtype.NONE]), + ('(', [format_token.Subtype.NONE]), + ('a', [format_token.Subtype.NONE]), + ('+', { + format_token.Subtype.BINARY_OPERATOR, + format_token.Subtype.A_EXPR_OPERATOR, + }), + ('(', [format_token.Subtype.NONE]), + ('b', [format_token.Subtype.NONE]), + ('-', { + format_token.Subtype.BINARY_OPERATOR, + format_token.Subtype.A_EXPR_OPERATOR, + format_token.Subtype.SIMPLE_EXPRESSION, + }), + ('3', [format_token.Subtype.NONE]), + (')', [format_token.Subtype.NONE]), + ('*', { + format_token.Subtype.BINARY_OPERATOR, + format_token.Subtype.M_EXPR_OPERATOR, + }), + ('(', [format_token.Subtype.NONE]), + ('1', [format_token.Subtype.NONE]), + ('%', { + format_token.Subtype.BINARY_OPERATOR, + format_token.Subtype.M_EXPR_OPERATOR, + format_token.Subtype.SIMPLE_EXPRESSION, + }), + ('c', [format_token.Subtype.NONE]), + (')', [format_token.Subtype.NONE]), + ('@', { + format_token.Subtype.BINARY_OPERATOR, + format_token.Subtype.M_EXPR_OPERATOR, + }), + ('d', [format_token.Subtype.NONE]), + (')', [format_token.Subtype.NONE]), + ('/', { + format_token.Subtype.BINARY_OPERATOR, + format_token.Subtype.M_EXPR_OPERATOR, + }), + ('3', [format_token.Subtype.NONE]), + (')', [format_token.Subtype.NONE]), + ('//', { + format_token.Subtype.BINARY_OPERATOR, + format_token.Subtype.M_EXPR_OPERATOR, + }), + ('1', [format_token.Subtype.NONE]), + ], + ]) + + def testSubscriptColon(self): + code = textwrap.dedent("""\ + x[0:42:1] + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self._CheckFormatTokenSubtypes(uwlines, [ + [ + ('x', [format_token.Subtype.NONE]), + ('[', {format_token.Subtype.SUBSCRIPT_BRACKET}), + ('0', [format_token.Subtype.NONE]), + (':', {format_token.Subtype.SUBSCRIPT_COLON}), + ('42', [format_token.Subtype.NONE]), + (':', {format_token.Subtype.SUBSCRIPT_COLON}), + ('1', [format_token.Subtype.NONE]), + (']', {format_token.Subtype.SUBSCRIPT_BRACKET}), + ], + ]) + + def testFunctionCallWithStarExpression(self): + code = textwrap.dedent("""\ + [a, *b] + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + self._CheckFormatTokenSubtypes(uwlines, [ + [ + ('[', [format_token.Subtype.NONE]), + ('a', [format_token.Subtype.NONE]), + (',', [format_token.Subtype.NONE]), + ('*', { + format_token.Subtype.UNARY_OPERATOR, + format_token.Subtype.VARARGS_STAR, + }), + ('b', [format_token.Subtype.NONE]), + (']', [format_token.Subtype.NONE]), + ], + ]) + + +if __name__ == '__main__': + unittest.main() diff --git a/.venv/lib/python3.9/site-packages/yapftests/unwrapped_line_test.py b/.venv/lib/python3.9/site-packages/yapftests/unwrapped_line_test.py new file mode 100644 index 00000000..90be1a13 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapftests/unwrapped_line_test.py @@ -0,0 +1,96 @@ +# Copyright 2015 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Tests for yapf.unwrapped_line.""" + +import textwrap +import unittest + +from lib2to3 import pytree +from lib2to3.pgen2 import token + +from yapf.yapflib import format_token +from yapf.yapflib import split_penalty +from yapf.yapflib import unwrapped_line + +from yapftests import yapf_test_helper + + +class UnwrappedLineBasicTest(unittest.TestCase): + + def testConstruction(self): + toks = _MakeFormatTokenList([(token.DOT, '.'), (token.VBAR, '|')]) + uwl = unwrapped_line.UnwrappedLine(20, toks) + self.assertEqual(20, uwl.depth) + self.assertEqual(['DOT', 'VBAR'], [tok.name for tok in uwl.tokens]) + + def testFirstLast(self): + toks = _MakeFormatTokenList([(token.DOT, '.'), (token.LPAR, '('), + (token.VBAR, '|')]) + uwl = unwrapped_line.UnwrappedLine(20, toks) + self.assertEqual(20, uwl.depth) + self.assertEqual('DOT', uwl.first.name) + self.assertEqual('VBAR', uwl.last.name) + + def testAsCode(self): + toks = _MakeFormatTokenList([(token.DOT, '.'), (token.LPAR, '('), + (token.VBAR, '|')]) + uwl = unwrapped_line.UnwrappedLine(2, toks) + self.assertEqual(' . ( |', uwl.AsCode()) + + def testAppendToken(self): + uwl = unwrapped_line.UnwrappedLine(0) + uwl.AppendToken(_MakeFormatTokenLeaf(token.LPAR, '(')) + uwl.AppendToken(_MakeFormatTokenLeaf(token.RPAR, ')')) + self.assertEqual(['LPAR', 'RPAR'], [tok.name for tok in uwl.tokens]) + + def testAppendNode(self): + uwl = unwrapped_line.UnwrappedLine(0) + uwl.AppendNode(pytree.Leaf(token.LPAR, '(')) + uwl.AppendNode(pytree.Leaf(token.RPAR, ')')) + self.assertEqual(['LPAR', 'RPAR'], [tok.name for tok in uwl.tokens]) + + +class UnwrappedLineFormattingInformationTest(yapf_test_helper.YAPFTest): + + def testFuncDef(self): + code = textwrap.dedent(r""" + def f(a, b): + pass + """) + uwlines = yapf_test_helper.ParseAndUnwrap(code) + + f = uwlines[0].tokens[1] + self.assertFalse(f.can_break_before) + self.assertFalse(f.must_break_before) + self.assertEqual(f.split_penalty, split_penalty.UNBREAKABLE) + + lparen = uwlines[0].tokens[2] + self.assertFalse(lparen.can_break_before) + self.assertFalse(lparen.must_break_before) + self.assertEqual(lparen.split_penalty, split_penalty.UNBREAKABLE) + + +def _MakeFormatTokenLeaf(token_type, token_value): + return format_token.FormatToken(pytree.Leaf(token_type, token_value)) + + +def _MakeFormatTokenList(token_type_values): + return [ + _MakeFormatTokenLeaf(token_type, token_value) + for token_type, token_value in token_type_values + ] + + +if __name__ == '__main__': + unittest.main() diff --git a/.venv/lib/python3.9/site-packages/yapftests/utils.py b/.venv/lib/python3.9/site-packages/yapftests/utils.py new file mode 100644 index 00000000..268b8c43 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapftests/utils.py @@ -0,0 +1,89 @@ +# -*- coding: utf-8 -*- +# Copyright 2017 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Utilities for tests.""" + +import contextlib +import io +import os +import sys +import tempfile + + +@contextlib.contextmanager +def stdout_redirector(stream): # pylint: disable=invalid-name + old_stdout = sys.stdout + sys.stdout = stream + try: + yield + finally: + sys.stdout = old_stdout + + +# NamedTemporaryFile is useless because on Windows the temporary file would be +# created with O_TEMPORARY, which would not allow the file to be opened a +# second time, even by the same process, unless the same flag is used. +# Thus we provide a simplified version ourselves. +# +# Note: returns a tuple of (io.file_obj, file_path), instead of a file_obj with +# a .name attribute +# +# Note: `buffering` is set to -1 despite documentation of NamedTemporaryFile +# says None. This is probably a problem with the python documentation. +@contextlib.contextmanager +def NamedTempFile(mode='w+b', + buffering=-1, + encoding=None, + errors=None, + newline=None, + suffix=None, + prefix=None, + dirname=None, + text=False): + """Context manager creating a new temporary file in text mode.""" + if sys.version_info < (3, 5): # covers also python 2 + if suffix is None: + suffix = '' + if prefix is None: + prefix = 'tmp' + (fd, fname) = tempfile.mkstemp( + suffix=suffix, prefix=prefix, dir=dirname, text=text) + f = io.open( + fd, + mode=mode, + buffering=buffering, + encoding=encoding, + errors=errors, + newline=newline) + yield f, fname + f.close() + os.remove(fname) + + +@contextlib.contextmanager +def TempFileContents(dirname, + contents, + encoding='utf-8', + newline='', + suffix=None): + # Note: NamedTempFile properly handles unicode encoding when using mode='w' + with NamedTempFile( + dirname=dirname, + mode='w', + encoding=encoding, + newline=newline, + suffix=suffix) as (f, fname): + f.write(contents) + f.flush() + yield fname diff --git a/.venv/lib/python3.9/site-packages/yapftests/yapf_test.py b/.venv/lib/python3.9/site-packages/yapftests/yapf_test.py new file mode 100644 index 00000000..e3e3df38 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapftests/yapf_test.py @@ -0,0 +1,2038 @@ +# -*- coding: utf-8 -*- +# Copyright 2015 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Tests for yapf.yapf.""" + +import io +import logging +import os +import shutil +import subprocess +import sys +import tempfile +import textwrap +import unittest + +from lib2to3.pgen2 import tokenize + +from yapf.yapflib import py3compat +from yapf.yapflib import style +from yapf.yapflib import yapf_api + +from yapftests import utils +from yapftests import yapf_test_helper + +ROOT_DIR = os.path.dirname(os.path.abspath(os.path.dirname(__file__))) + +# Verification is turned off by default, but want to enable it for testing. +YAPF_BINARY = [sys.executable, '-m', 'yapf', '--verify', '--no-local-style'] + + +class FormatCodeTest(yapf_test_helper.YAPFTest): + + def _Check(self, unformatted_code, expected_formatted_code): + formatted_code, _ = yapf_api.FormatCode( + unformatted_code, style_config='yapf') + self.assertCodeEqual(expected_formatted_code, formatted_code) + + def testSimple(self): + unformatted_code = textwrap.dedent("""\ + print('foo') + """) + self._Check(unformatted_code, unformatted_code) + + def testNoEndingNewline(self): + unformatted_code = textwrap.dedent("""\ + if True: + pass""") + expected_formatted_code = textwrap.dedent("""\ + if True: + pass + """) + self._Check(unformatted_code, expected_formatted_code) + + def testPrintAfterPeriod(self): + unformatted_code = textwrap.dedent("""a.print\n""") + expected_formatted_code = textwrap.dedent("""a.print\n""") + self._Check(unformatted_code, expected_formatted_code) + + +class FormatFileTest(unittest.TestCase): + + def setUp(self): # pylint: disable=g-missing-super-call + self.test_tmpdir = tempfile.mkdtemp() + + def tearDown(self): # pylint: disable=g-missing-super-call + shutil.rmtree(self.test_tmpdir) + + def assertCodeEqual(self, expected_code, code): + if code != expected_code: + msg = 'Code format mismatch:\n' + msg += 'Expected:\n >' + msg += '\n > '.join(expected_code.splitlines()) + msg += '\nActual:\n >' + msg += '\n > '.join(code.splitlines()) + # TODO(sbc): maybe using difflib here to produce easy to read deltas? + self.fail(msg) + + def testFormatFile(self): + unformatted_code = textwrap.dedent(u"""\ + if True: + pass + """) + expected_formatted_code_pep8 = textwrap.dedent(u"""\ + if True: + pass + """) + expected_formatted_code_yapf = textwrap.dedent(u"""\ + if True: + pass + """) + with utils.TempFileContents(self.test_tmpdir, unformatted_code) as filepath: + formatted_code, _, _ = yapf_api.FormatFile(filepath, style_config='pep8') + self.assertCodeEqual(expected_formatted_code_pep8, formatted_code) + + formatted_code, _, _ = yapf_api.FormatFile(filepath, style_config='yapf') + self.assertCodeEqual(expected_formatted_code_yapf, formatted_code) + + def testDisableLinesPattern(self): + unformatted_code = textwrap.dedent(u"""\ + if a: b + + # yapf: disable + if f: g + + if h: i + """) + expected_formatted_code = textwrap.dedent(u"""\ + if a: b + + # yapf: disable + if f: g + + if h: i + """) + with utils.TempFileContents(self.test_tmpdir, unformatted_code) as filepath: + formatted_code, _, _ = yapf_api.FormatFile(filepath, style_config='pep8') + self.assertCodeEqual(expected_formatted_code, formatted_code) + + def testDisableAndReenableLinesPattern(self): + unformatted_code = textwrap.dedent(u"""\ + if a: b + + # yapf: disable + if f: g + # yapf: enable + + if h: i + """) + expected_formatted_code = textwrap.dedent(u"""\ + if a: b + + # yapf: disable + if f: g + # yapf: enable + + if h: i + """) + with utils.TempFileContents(self.test_tmpdir, unformatted_code) as filepath: + formatted_code, _, _ = yapf_api.FormatFile(filepath, style_config='pep8') + self.assertCodeEqual(expected_formatted_code, formatted_code) + + def testDisablePartOfMultilineComment(self): + unformatted_code = textwrap.dedent(u"""\ + if a: b + + # This is a multiline comment that disables YAPF. + # yapf: disable + if f: g + # yapf: enable + # This is a multiline comment that enables YAPF. + + if h: i + """) + + expected_formatted_code = textwrap.dedent(u"""\ + if a: b + + # This is a multiline comment that disables YAPF. + # yapf: disable + if f: g + # yapf: enable + # This is a multiline comment that enables YAPF. + + if h: i + """) + with utils.TempFileContents(self.test_tmpdir, unformatted_code) as filepath: + formatted_code, _, _ = yapf_api.FormatFile(filepath, style_config='pep8') + self.assertCodeEqual(expected_formatted_code, formatted_code) + + code = textwrap.dedent(u"""\ + def foo_function(): + # some comment + # yapf: disable + + foo( + bar, + baz + ) + + # yapf: enable + """) + with utils.TempFileContents(self.test_tmpdir, code) as filepath: + formatted_code, _, _ = yapf_api.FormatFile(filepath, style_config='pep8') + self.assertCodeEqual(code, formatted_code) + + def testEnabledDisabledSameComment(self): + code = textwrap.dedent(u"""\ + # yapf: disable + a(bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb, ccccccccccccccccccccccccccccccc, ddddddddddddddddddddddd, eeeeeeeeeeeeeeeeeeeeeeeeeee) + # yapf: enable + # yapf: disable + a(bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb, ccccccccccccccccccccccccccccccc, ddddddddddddddddddddddd, eeeeeeeeeeeeeeeeeeeeeeeeeee) + # yapf: enable + """) + with utils.TempFileContents(self.test_tmpdir, code) as filepath: + formatted_code, _, _ = yapf_api.FormatFile(filepath, style_config='pep8') + self.assertCodeEqual(code, formatted_code) + + def testFormatFileLinesSelection(self): + unformatted_code = textwrap.dedent(u"""\ + if a: b + + if f: g + + if h: i + """) + expected_formatted_code_lines1and2 = textwrap.dedent(u"""\ + if a: b + + if f: g + + if h: i + """) + expected_formatted_code_lines3 = textwrap.dedent(u"""\ + if a: b + + if f: g + + if h: i + """) + with utils.TempFileContents(self.test_tmpdir, unformatted_code) as filepath: + formatted_code, _, _ = yapf_api.FormatFile( + filepath, style_config='pep8', lines=[(1, 2)]) + self.assertCodeEqual(expected_formatted_code_lines1and2, formatted_code) + formatted_code, _, _ = yapf_api.FormatFile( + filepath, style_config='pep8', lines=[(3, 3)]) + self.assertCodeEqual(expected_formatted_code_lines3, formatted_code) + + def testFormatFileDiff(self): + unformatted_code = textwrap.dedent(u"""\ + if True: + pass + """) + with utils.TempFileContents(self.test_tmpdir, unformatted_code) as filepath: + diff, _, _ = yapf_api.FormatFile(filepath, print_diff=True) + self.assertIn(u'+ pass', diff) + + def testFormatFileInPlace(self): + unformatted_code = u'True==False\n' + formatted_code = u'True == False\n' + with utils.TempFileContents(self.test_tmpdir, unformatted_code) as filepath: + result, _, _ = yapf_api.FormatFile(filepath, in_place=True) + self.assertEqual(result, None) + with open(filepath) as fd: + if sys.version_info[0] <= 2: + self.assertCodeEqual(formatted_code, fd.read().decode('ascii')) + else: + self.assertCodeEqual(formatted_code, fd.read()) + + self.assertRaises( + ValueError, + yapf_api.FormatFile, + filepath, + in_place=True, + print_diff=True) + + def testNoFile(self): + stream = py3compat.StringIO() + handler = logging.StreamHandler(stream) + logger = logging.getLogger('mylogger') + logger.addHandler(handler) + self.assertRaises( + IOError, yapf_api.FormatFile, 'not_a_file.py', logger=logger.error) + self.assertEqual(stream.getvalue(), + "[Errno 2] No such file or directory: 'not_a_file.py'\n") + + def testCommentsUnformatted(self): + code = textwrap.dedent(u"""\ + foo = [# A list of things + # bork + 'one', + # quark + 'two'] # yapf: disable + """) + with utils.TempFileContents(self.test_tmpdir, code) as filepath: + formatted_code, _, _ = yapf_api.FormatFile(filepath, style_config='pep8') + self.assertCodeEqual(code, formatted_code) + + def testDisabledHorizontalFormattingOnNewLine(self): + code = textwrap.dedent(u"""\ + # yapf: disable + a = [ + 1] + # yapf: enable + """) + with utils.TempFileContents(self.test_tmpdir, code) as filepath: + formatted_code, _, _ = yapf_api.FormatFile(filepath, style_config='pep8') + self.assertCodeEqual(code, formatted_code) + + def testSplittingSemicolonStatements(self): + unformatted_code = textwrap.dedent(u"""\ + def f(): + x = y + 42 ; z = n * 42 + if True: a += 1 ; b += 1; c += 1 + """) + expected_formatted_code = textwrap.dedent(u"""\ + def f(): + x = y + 42 + z = n * 42 + if True: + a += 1 + b += 1 + c += 1 + """) + with utils.TempFileContents(self.test_tmpdir, unformatted_code) as filepath: + formatted_code, _, _ = yapf_api.FormatFile(filepath, style_config='pep8') + self.assertCodeEqual(expected_formatted_code, formatted_code) + + def testSemicolonStatementsDisabled(self): + unformatted_code = textwrap.dedent(u"""\ + def f(): + x = y + 42 ; z = n * 42 # yapf: disable + if True: a += 1 ; b += 1; c += 1 + """) + expected_formatted_code = textwrap.dedent(u"""\ + def f(): + x = y + 42 ; z = n * 42 # yapf: disable + if True: + a += 1 + b += 1 + c += 1 + """) + with utils.TempFileContents(self.test_tmpdir, unformatted_code) as filepath: + formatted_code, _, _ = yapf_api.FormatFile(filepath, style_config='pep8') + self.assertCodeEqual(expected_formatted_code, formatted_code) + + def testDisabledSemiColonSeparatedStatements(self): + code = textwrap.dedent(u"""\ + # yapf: disable + if True: a ; b + """) + with utils.TempFileContents(self.test_tmpdir, code) as filepath: + formatted_code, _, _ = yapf_api.FormatFile(filepath, style_config='pep8') + self.assertCodeEqual(code, formatted_code) + + def testDisabledMultilineStringInDictionary(self): + code = textwrap.dedent(u"""\ + # yapf: disable + + A = [ + { + "aaaaaaaaaaaaaaaaaaa": ''' + bbbbbbbbbbb: "ccccccccccc" + dddddddddddddd: 1 + eeeeeeee: 0 + ffffffffff: "ggggggg" + ''', + }, + ] + """) + with utils.TempFileContents(self.test_tmpdir, code) as filepath: + formatted_code, _, _ = yapf_api.FormatFile(filepath, style_config='yapf') + self.assertCodeEqual(code, formatted_code) + + def testDisabledWithPrecedingText(self): + code = textwrap.dedent(u"""\ + # TODO(fix formatting): yapf: disable + + A = [ + { + "aaaaaaaaaaaaaaaaaaa": ''' + bbbbbbbbbbb: "ccccccccccc" + dddddddddddddd: 1 + eeeeeeee: 0 + ffffffffff: "ggggggg" + ''', + }, + ] + """) + with utils.TempFileContents(self.test_tmpdir, code) as filepath: + formatted_code, _, _ = yapf_api.FormatFile(filepath, style_config='yapf') + self.assertCodeEqual(code, formatted_code) + + def testCRLFLineEnding(self): + code = u'class _():\r\n pass\r\n' + with utils.TempFileContents(self.test_tmpdir, code) as filepath: + formatted_code, _, _ = yapf_api.FormatFile(filepath, style_config='yapf') + self.assertCodeEqual(code, formatted_code) + + +class CommandLineTest(unittest.TestCase): + """Test how calling yapf from the command line acts.""" + + @classmethod + def setUpClass(cls): # pylint: disable=g-missing-super-call + cls.test_tmpdir = tempfile.mkdtemp() + + @classmethod + def tearDownClass(cls): # pylint: disable=g-missing-super-call + shutil.rmtree(cls.test_tmpdir) + + def assertYapfReformats(self, + unformatted, + expected, + extra_options=None, + env=None): + """Check that yapf reformats the given code as expected. + + Invokes yapf in a subprocess, piping the unformatted code into its stdin. + Checks that the formatted output is as expected. + + Arguments: + unformatted: unformatted code - input to yapf + expected: expected formatted code at the output of yapf + extra_options: iterable of extra command-line options to pass to yapf + env: dict of environment variables. + """ + cmdline = YAPF_BINARY + (extra_options or []) + p = subprocess.Popen( + cmdline, + stdout=subprocess.PIPE, + stdin=subprocess.PIPE, + stderr=subprocess.PIPE, + env=env) + reformatted_code, stderrdata = p.communicate( + unformatted.encode('utf-8-sig')) + self.assertEqual(stderrdata, b'') + self.assertMultiLineEqual(reformatted_code.decode('utf-8'), expected) + + def testUnicodeEncodingPipedToFile(self): + unformatted_code = textwrap.dedent(u"""\ + def foo(): + print('⇒') + """) + with utils.NamedTempFile( + dirname=self.test_tmpdir, suffix='.py') as (out, _): + with utils.TempFileContents( + self.test_tmpdir, unformatted_code, suffix='.py') as filepath: + subprocess.check_call(YAPF_BINARY + ['--diff', filepath], stdout=out) + + def testInPlaceReformatting(self): + unformatted_code = textwrap.dedent(u"""\ + def foo(): + x = 37 + """) + expected_formatted_code = textwrap.dedent("""\ + def foo(): + x = 37 + """) + with utils.TempFileContents( + self.test_tmpdir, unformatted_code, suffix='.py') as filepath: + p = subprocess.Popen(YAPF_BINARY + ['--in-place', filepath]) + p.wait() + with io.open(filepath, mode='r', newline='') as fd: + reformatted_code = fd.read() + self.assertEqual(reformatted_code, expected_formatted_code) + + def testInPlaceReformattingBlank(self): + unformatted_code = u'\n\n' + expected_formatted_code = u'\n' + with utils.TempFileContents( + self.test_tmpdir, unformatted_code, suffix='.py') as filepath: + p = subprocess.Popen(YAPF_BINARY + ['--in-place', filepath]) + p.wait() + with io.open(filepath, mode='r', encoding='utf-8', newline='') as fd: + reformatted_code = fd.read() + self.assertEqual(reformatted_code, expected_formatted_code) + + def testInPlaceReformattingEmpty(self): + unformatted_code = u'' + expected_formatted_code = u'' + with utils.TempFileContents( + self.test_tmpdir, unformatted_code, suffix='.py') as filepath: + p = subprocess.Popen(YAPF_BINARY + ['--in-place', filepath]) + p.wait() + with io.open(filepath, mode='r', encoding='utf-8', newline='') as fd: + reformatted_code = fd.read() + self.assertEqual(reformatted_code, expected_formatted_code) + + def testReadFromStdin(self): + unformatted_code = textwrap.dedent("""\ + def foo(): + x = 37 + """) + expected_formatted_code = textwrap.dedent("""\ + def foo(): + x = 37 + """) + self.assertYapfReformats(unformatted_code, expected_formatted_code) + + def testReadFromStdinWithEscapedStrings(self): + unformatted_code = textwrap.dedent("""\ + s = "foo\\nbar" + """) + expected_formatted_code = textwrap.dedent("""\ + s = "foo\\nbar" + """) + self.assertYapfReformats(unformatted_code, expected_formatted_code) + + def testSetYapfStyle(self): + unformatted_code = textwrap.dedent("""\ + def foo(): # trail + x = 37 + """) + expected_formatted_code = textwrap.dedent("""\ + def foo(): # trail + x = 37 + """) + self.assertYapfReformats( + unformatted_code, + expected_formatted_code, + extra_options=['--style=yapf']) + + def testSetCustomStyleBasedOnYapf(self): + unformatted_code = textwrap.dedent("""\ + def foo(): # trail + x = 37 + """) + expected_formatted_code = textwrap.dedent("""\ + def foo(): # trail + x = 37 + """) + style_file = textwrap.dedent(u'''\ + [style] + based_on_style = yapf + spaces_before_comment = 4 + ''') + with utils.TempFileContents(self.test_tmpdir, style_file) as stylepath: + self.assertYapfReformats( + unformatted_code, + expected_formatted_code, + extra_options=['--style={0}'.format(stylepath)]) + + def testSetCustomStyleSpacesBeforeComment(self): + unformatted_code = textwrap.dedent("""\ + a_very_long_statement_that_extends_way_beyond # Comment + short # This is a shorter statement + """) + expected_formatted_code = textwrap.dedent("""\ + a_very_long_statement_that_extends_way_beyond # Comment + short # This is a shorter statement + """) + style_file = textwrap.dedent(u'''\ + [style] + spaces_before_comment = 15, 20 + ''') + with utils.TempFileContents(self.test_tmpdir, style_file) as stylepath: + self.assertYapfReformats( + unformatted_code, + expected_formatted_code, + extra_options=['--style={0}'.format(stylepath)]) + + def testReadSingleLineCodeFromStdin(self): + unformatted_code = textwrap.dedent("""\ + if True: pass + """) + expected_formatted_code = textwrap.dedent("""\ + if True: pass + """) + self.assertYapfReformats(unformatted_code, expected_formatted_code) + + def testEncodingVerification(self): + unformatted_code = textwrap.dedent(u"""\ + '''The module docstring.''' + # -*- coding: utf-8 -*- + def f(): + x = 37 + """) + + with utils.NamedTempFile( + suffix='.py', dirname=self.test_tmpdir) as (out, _): + with utils.TempFileContents( + self.test_tmpdir, unformatted_code, suffix='.py') as filepath: + try: + subprocess.check_call(YAPF_BINARY + ['--diff', filepath], stdout=out) + except subprocess.CalledProcessError as e: + # Indicates the text changed. + self.assertEqual(e.returncode, 1) # pylint: disable=g-assert-in-except + + def testReformattingSpecificLines(self): + unformatted_code = textwrap.dedent("""\ + def h(): + if (xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0]) == 'aaaaaaaaaaa' and xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0].mmmmmmmm[0]) == 'bbbbbbb'): + pass + + + def g(): + if (xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0]) == 'aaaaaaaaaaa' and xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0].mmmmmmmm[0]) == 'bbbbbbb'): + pass + """) + expected_formatted_code = textwrap.dedent("""\ + def h(): + if (xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0]) == 'aaaaaaaaaaa' and + xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0].mmmmmmmm[0]) == 'bbbbbbb'): + pass + + + def g(): + if (xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0]) == 'aaaaaaaaaaa' and xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0].mmmmmmmm[0]) == 'bbbbbbb'): + pass + """) + # TODO(ambv): the `expected_formatted_code` here is not PEP8 compliant, + # raising "E129 visually indented line with same indent as next logical + # line" with flake8. + self.assertYapfReformats( + unformatted_code, + expected_formatted_code, + extra_options=['--lines', '1-2']) + + def testOmitFormattingLinesBeforeDisabledFunctionComment(self): + unformatted_code = textwrap.dedent("""\ + import sys + + # Comment + def some_func(x): + x = ["badly" , "formatted","line" ] + """) + expected_formatted_code = textwrap.dedent("""\ + import sys + + # Comment + def some_func(x): + x = ["badly", "formatted", "line"] + """) + self.assertYapfReformats( + unformatted_code, + expected_formatted_code, + extra_options=['--lines', '5-5']) + + def testReformattingSkippingLines(self): + unformatted_code = textwrap.dedent("""\ + def h(): + if (xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0]) == 'aaaaaaaaaaa' and xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0].mmmmmmmm[0]) == 'bbbbbbb'): + pass + + # yapf: disable + def g(): + if (xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0]) == 'aaaaaaaaaaa' and xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0].mmmmmmmm[0]) == 'bbbbbbb'): + pass + # yapf: enable + """) + expected_formatted_code = textwrap.dedent("""\ + def h(): + if (xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0]) == 'aaaaaaaaaaa' and + xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0].mmmmmmmm[0]) == 'bbbbbbb'): + pass + + + # yapf: disable + def g(): + if (xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0]) == 'aaaaaaaaaaa' and xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0].mmmmmmmm[0]) == 'bbbbbbb'): + pass + # yapf: enable + """) + self.assertYapfReformats(unformatted_code, expected_formatted_code) + + def testReformattingSkippingToEndOfFile(self): + unformatted_code = textwrap.dedent("""\ + def h(): + if (xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0]) == 'aaaaaaaaaaa' and xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0].mmmmmmmm[0]) == 'bbbbbbb'): + pass + + # yapf: disable + def g(): + if (xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0]) == 'aaaaaaaaaaa' and xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0].mmmmmmmm[0]) == 'bbbbbbb'): + pass + + def f(): + def e(): + while (xxxxxxxxxxxxxxxxxxxxx(yyyyyyyyyyyyy[zzzzz]) == 'aaaaaaaaaaa' and + xxxxxxxxxxxxxxxxxxxxx(yyyyyyyyyyyyy[zzzzz].aaaaaaaa[0]) == + 'bbbbbbb'): + pass + """) + expected_formatted_code = textwrap.dedent("""\ + def h(): + if (xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0]) == 'aaaaaaaaaaa' and + xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0].mmmmmmmm[0]) == 'bbbbbbb'): + pass + + + # yapf: disable + def g(): + if (xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0]) == 'aaaaaaaaaaa' and xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0].mmmmmmmm[0]) == 'bbbbbbb'): + pass + + def f(): + def e(): + while (xxxxxxxxxxxxxxxxxxxxx(yyyyyyyyyyyyy[zzzzz]) == 'aaaaaaaaaaa' and + xxxxxxxxxxxxxxxxxxxxx(yyyyyyyyyyyyy[zzzzz].aaaaaaaa[0]) == + 'bbbbbbb'): + pass + """) + self.assertYapfReformats(unformatted_code, expected_formatted_code) + + def testReformattingSkippingSingleLine(self): + unformatted_code = textwrap.dedent("""\ + def h(): + if (xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0]) == 'aaaaaaaaaaa' and xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0].mmmmmmmm[0]) == 'bbbbbbb'): + pass + + def g(): + if (xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0]) == 'aaaaaaaaaaa' and xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0].mmmmmmmm[0]) == 'bbbbbbb'): # yapf: disable + pass + """) + expected_formatted_code = textwrap.dedent("""\ + def h(): + if (xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0]) == 'aaaaaaaaaaa' and + xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0].mmmmmmmm[0]) == 'bbbbbbb'): + pass + + + def g(): + if (xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0]) == 'aaaaaaaaaaa' and xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0].mmmmmmmm[0]) == 'bbbbbbb'): # yapf: disable + pass + """) + self.assertYapfReformats(unformatted_code, expected_formatted_code) + + def testDisableWholeDataStructure(self): + unformatted_code = textwrap.dedent("""\ + A = set([ + 'hello', + 'world', + ]) # yapf: disable + """) + expected_formatted_code = textwrap.dedent("""\ + A = set([ + 'hello', + 'world', + ]) # yapf: disable + """) + self.assertYapfReformats(unformatted_code, expected_formatted_code) + + def testDisableButAdjustIndentations(self): + unformatted_code = textwrap.dedent("""\ + class SplitPenaltyTest(unittest.TestCase): + def testUnbreakable(self): + self._CheckPenalties(tree, [ + ]) # yapf: disable + """) + expected_formatted_code = textwrap.dedent("""\ + class SplitPenaltyTest(unittest.TestCase): + def testUnbreakable(self): + self._CheckPenalties(tree, [ + ]) # yapf: disable + """) + self.assertYapfReformats(unformatted_code, expected_formatted_code) + + def testRetainingHorizontalWhitespace(self): + unformatted_code = textwrap.dedent("""\ + def h(): + if (xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0]) == 'aaaaaaaaaaa' and xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0].mmmmmmmm[0]) == 'bbbbbbb'): + pass + + def g(): + if (xxxxxxxxxxxx.yyyyyyyy (zzzzzzzzzzzzz [0]) == 'aaaaaaaaaaa' and xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0].mmmmmmmm[0]) == 'bbbbbbb'): # yapf: disable + pass + """) + expected_formatted_code = textwrap.dedent("""\ + def h(): + if (xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0]) == 'aaaaaaaaaaa' and + xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0].mmmmmmmm[0]) == 'bbbbbbb'): + pass + + + def g(): + if (xxxxxxxxxxxx.yyyyyyyy (zzzzzzzzzzzzz [0]) == 'aaaaaaaaaaa' and xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0].mmmmmmmm[0]) == 'bbbbbbb'): # yapf: disable + pass + """) + self.assertYapfReformats(unformatted_code, expected_formatted_code) + + def testRetainingVerticalWhitespace(self): + unformatted_code = textwrap.dedent("""\ + def h(): + if (xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0]) == 'aaaaaaaaaaa' and xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0].mmmmmmmm[0]) == 'bbbbbbb'): + pass + + def g(): + + + if (xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0]) == 'aaaaaaaaaaa' and xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0].mmmmmmmm[0]) == 'bbbbbbb'): + + pass + """) + expected_formatted_code = textwrap.dedent("""\ + def h(): + if (xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0]) == 'aaaaaaaaaaa' and + xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0].mmmmmmmm[0]) == 'bbbbbbb'): + pass + + def g(): + + + if (xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0]) == 'aaaaaaaaaaa' and xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0].mmmmmmmm[0]) == 'bbbbbbb'): + + pass + """) + self.assertYapfReformats( + unformatted_code, + expected_formatted_code, + extra_options=['--lines', '1-2']) + + unformatted_code = textwrap.dedent("""\ + + + if a: b + + + if c: + to_much + indent + + same + + + + #comment + + # trailing whitespace + """) + expected_formatted_code = textwrap.dedent("""\ + if a: b + + + if c: + to_much + indent + + same + + + + #comment + + # trailing whitespace + """) + self.assertYapfReformats( + unformatted_code, + expected_formatted_code, + extra_options=['--lines', '3-3', '--lines', '13-13']) + + unformatted_code = textwrap.dedent("""\ + ''' + docstring + + ''' + + import blah + """) + + self.assertYapfReformats( + unformatted_code, unformatted_code, extra_options=['--lines', '2-2']) + + def testVerticalSpacingWithCommentWithContinuationMarkers(self): + unformatted_code = """\ +# \\ +# \\ +# \\ + +x = { +} +""" + expected_formatted_code = """\ +# \\ +# \\ +# \\ + +x = { +} +""" + self.assertYapfReformats( + unformatted_code, + expected_formatted_code, + extra_options=['--lines', '1-1']) + + def testRetainingSemicolonsWhenSpecifyingLines(self): + unformatted_code = textwrap.dedent("""\ + a = line_to_format + def f(): + x = y + 42; z = n * 42 + if True: a += 1 ; b += 1 ; c += 1 + """) + expected_formatted_code = textwrap.dedent("""\ + a = line_to_format + + + def f(): + x = y + 42; z = n * 42 + if True: a += 1 ; b += 1 ; c += 1 + """) + self.assertYapfReformats( + unformatted_code, + expected_formatted_code, + extra_options=['--lines', '1-1']) + + def testDisabledMultilineStrings(self): + unformatted_code = textwrap.dedent('''\ + foo=42 + def f(): + email_text += """This is a really long docstring that goes over the column limit and is multi-line.

+ Czar: """+despot["Nicholas"]+"""
+ Minion: """+serf["Dmitri"]+"""
+ Residence: """+palace["Winter"]+"""
+ + """ + ''') + expected_formatted_code = textwrap.dedent('''\ + foo = 42 + + + def f(): + email_text += """This is a really long docstring that goes over the column limit and is multi-line.

+ Czar: """+despot["Nicholas"]+"""
+ Minion: """+serf["Dmitri"]+"""
+ Residence: """+palace["Winter"]+"""
+ + """ + ''') + self.assertYapfReformats( + unformatted_code, + expected_formatted_code, + extra_options=['--lines', '1-1']) + + def testDisableWhenSpecifyingLines(self): + unformatted_code = textwrap.dedent("""\ + # yapf: disable + A = set([ + 'hello', + 'world', + ]) + # yapf: enable + B = set([ + 'hello', + 'world', + ]) # yapf: disable + """) + expected_formatted_code = textwrap.dedent("""\ + # yapf: disable + A = set([ + 'hello', + 'world', + ]) + # yapf: enable + B = set([ + 'hello', + 'world', + ]) # yapf: disable + """) + self.assertYapfReformats( + unformatted_code, + expected_formatted_code, + extra_options=['--lines', '1-10']) + + def testDisableFormattingInDataLiteral(self): + unformatted_code = textwrap.dedent("""\ + def horrible(): + oh_god() + why_would_you() + [ + 'do', + + 'that', + ] + + def still_horrible(): + oh_god() + why_would_you() + [ + 'do', + + 'that' + ] + """) + expected_formatted_code = textwrap.dedent("""\ + def horrible(): + oh_god() + why_would_you() + [ + 'do', + + 'that', + ] + + def still_horrible(): + oh_god() + why_would_you() + ['do', 'that'] + """) + self.assertYapfReformats( + unformatted_code, + expected_formatted_code, + extra_options=['--lines', '14-15']) + + def testRetainVerticalFormattingBetweenDisabledAndEnabledLines(self): + unformatted_code = textwrap.dedent("""\ + class A(object): + def aaaaaaaaaaaaa(self): + c = bbbbbbbbb.ccccccccc('challenge', 0, 1, 10) + self.assertEqual( + ('ddddddddddddddddddddddddd', + 'eeeeeeeeeeeeeeeeeeeeeeeee.%s' % + c.ffffffffffff), + gggggggggggg.hhhhhhhhh(c, c.ffffffffffff)) + iiiii = jjjjjjjjjjjjjj.iiiii + """) + expected_formatted_code = textwrap.dedent("""\ + class A(object): + def aaaaaaaaaaaaa(self): + c = bbbbbbbbb.ccccccccc('challenge', 0, 1, 10) + self.assertEqual(('ddddddddddddddddddddddddd', + 'eeeeeeeeeeeeeeeeeeeeeeeee.%s' % c.ffffffffffff), + gggggggggggg.hhhhhhhhh(c, c.ffffffffffff)) + iiiii = jjjjjjjjjjjjjj.iiiii + """) + self.assertYapfReformats( + unformatted_code, + expected_formatted_code, + extra_options=['--lines', '4-7']) + + def testRetainVerticalFormattingBetweenDisabledLines(self): + unformatted_code = textwrap.dedent("""\ + class A(object): + def aaaaaaaaaaaaa(self): + pass + + + def bbbbbbbbbbbbb(self): # 5 + pass + """) + expected_formatted_code = textwrap.dedent("""\ + class A(object): + def aaaaaaaaaaaaa(self): + pass + + def bbbbbbbbbbbbb(self): # 5 + pass + """) + self.assertYapfReformats( + unformatted_code, + expected_formatted_code, + extra_options=['--lines', '4-4']) + + def testFormatLinesSpecifiedInMiddleOfExpression(self): + unformatted_code = textwrap.dedent("""\ + class A(object): + def aaaaaaaaaaaaa(self): + c = bbbbbbbbb.ccccccccc('challenge', 0, 1, 10) + self.assertEqual( + ('ddddddddddddddddddddddddd', + 'eeeeeeeeeeeeeeeeeeeeeeeee.%s' % + c.ffffffffffff), + gggggggggggg.hhhhhhhhh(c, c.ffffffffffff)) + iiiii = jjjjjjjjjjjjjj.iiiii + """) + expected_formatted_code = textwrap.dedent("""\ + class A(object): + def aaaaaaaaaaaaa(self): + c = bbbbbbbbb.ccccccccc('challenge', 0, 1, 10) + self.assertEqual(('ddddddddddddddddddddddddd', + 'eeeeeeeeeeeeeeeeeeeeeeeee.%s' % c.ffffffffffff), + gggggggggggg.hhhhhhhhh(c, c.ffffffffffff)) + iiiii = jjjjjjjjjjjjjj.iiiii + """) + self.assertYapfReformats( + unformatted_code, + expected_formatted_code, + extra_options=['--lines', '5-6']) + + def testCommentFollowingMultilineString(self): + unformatted_code = textwrap.dedent("""\ + def foo(): + '''First line. + Second line. + ''' # comment + x = '''hello world''' # second comment + return 42 # another comment + """) + expected_formatted_code = textwrap.dedent("""\ + def foo(): + '''First line. + Second line. + ''' # comment + x = '''hello world''' # second comment + return 42 # another comment + """) + self.assertYapfReformats( + unformatted_code, + expected_formatted_code, + extra_options=['--lines', '1-1']) + + def testDedentClosingBracket(self): + # no line-break on the first argument, not dedenting closing brackets + unformatted_code = textwrap.dedent("""\ + def overly_long_function_name(first_argument_on_the_same_line, + second_argument_makes_the_line_too_long): + pass + """) + expected_formatted_code = textwrap.dedent("""\ + def overly_long_function_name(first_argument_on_the_same_line, + second_argument_makes_the_line_too_long): + pass + """) + self.assertYapfReformats( + unformatted_code, + expected_formatted_code, + extra_options=['--style=pep8']) + + # TODO(ambv): currently the following produces the closing bracket on a new + # line but indented to the opening bracket which is the worst of both + # worlds. Expected behaviour would be to format as --style=pep8 does in + # this case. + # self.assertYapfReformats(unformatted_code, expected_formatted_code, + # extra_options=['--style=facebook']) + + # line-break before the first argument, dedenting closing brackets if set + unformatted_code = textwrap.dedent("""\ + def overly_long_function_name( + first_argument_on_the_same_line, + second_argument_makes_the_line_too_long): + pass + """) + # expected_formatted_pep8_code = textwrap.dedent("""\ + # def overly_long_function_name( + # first_argument_on_the_same_line, + # second_argument_makes_the_line_too_long): + # pass + # """) + expected_formatted_fb_code = textwrap.dedent("""\ + def overly_long_function_name( + first_argument_on_the_same_line, second_argument_makes_the_line_too_long + ): + pass + """) + self.assertYapfReformats( + unformatted_code, + expected_formatted_fb_code, + extra_options=['--style=facebook']) + # TODO(ambv): currently the following produces code that is not PEP8 + # compliant, raising "E125 continuation line with same indent as next + # logical line" with flake8. Expected behaviour for PEP8 would be to use + # double-indentation here. + # self.assertYapfReformats(unformatted_code, expected_formatted_pep8_code, + # extra_options=['--style=pep8']) + + def testCoalesceBrackets(self): + unformatted_code = textwrap.dedent("""\ + some_long_function_name_foo( + { + 'first_argument_of_the_thing': id, + 'second_argument_of_the_thing': "some thing" + } + )""") + expected_formatted_code = textwrap.dedent("""\ + some_long_function_name_foo({ + 'first_argument_of_the_thing': id, + 'second_argument_of_the_thing': "some thing" + }) + """) + with utils.NamedTempFile(dirname=self.test_tmpdir, mode='w') as (f, name): + f.write( + textwrap.dedent(u'''\ + [style] + column_limit=82 + coalesce_brackets = True + ''')) + f.flush() + self.assertYapfReformats( + unformatted_code, + expected_formatted_code, + extra_options=['--style={0}'.format(name)]) + + def testPseudoParenSpaces(self): + unformatted_code = textwrap.dedent("""\ + def foo(): + def bar(): + return {msg_id: author for author, msg_id in reader} + """) + expected_formatted_code = textwrap.dedent("""\ + def foo(): + + def bar(): + return {msg_id: author for author, msg_id in reader} + """) + self.assertYapfReformats( + unformatted_code, + expected_formatted_code, + extra_options=['--lines', '1-1', '--style', 'yapf']) + + def testMultilineCommentFormattingDisabled(self): + unformatted_code = textwrap.dedent("""\ + # This is a comment + FOO = { + aaaaaaaa.ZZZ: [ + bbbbbbbbbb.Pop(), + # Multiline comment. + # Line two. + bbbbbbbbbb.Pop(), + ], + 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx': + ('yyyyy', zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz), + '#': lambda x: x # do nothing + } + """) + expected_formatted_code = textwrap.dedent("""\ + # This is a comment + FOO = { + aaaaaaaa.ZZZ: [ + bbbbbbbbbb.Pop(), + # Multiline comment. + # Line two. + bbbbbbbbbb.Pop(), + ], + 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx': + ('yyyyy', zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz), + '#': lambda x: x # do nothing + } + """) + self.assertYapfReformats( + unformatted_code, + expected_formatted_code, + extra_options=['--lines', '1-1', '--style', 'yapf']) + + def testTrailingCommentsWithDisabledFormatting(self): + unformatted_code = textwrap.dedent("""\ + import os + + SCOPES = [ + 'hello world' # This is a comment. + ] + """) + expected_formatted_code = textwrap.dedent("""\ + import os + + SCOPES = [ + 'hello world' # This is a comment. + ] + """) + self.assertYapfReformats( + unformatted_code, + expected_formatted_code, + extra_options=['--lines', '1-1', '--style', 'yapf']) + + def testUseTabs(self): + unformatted_code = """\ +def foo_function(): + if True: + pass +""" + expected_formatted_code = """\ +def foo_function(): + if True: + pass +""" + style_contents = u"""\ +[style] +based_on_style = yapf +USE_TABS = true +INDENT_WIDTH=1 +""" + with utils.TempFileContents(self.test_tmpdir, style_contents) as stylepath: + self.assertYapfReformats( + unformatted_code, + expected_formatted_code, + extra_options=['--style={0}'.format(stylepath)]) + + def testUseTabsWith(self): + unformatted_code = """\ +def f(): + return ['hello', 'world',] +""" + expected_formatted_code = """\ +def f(): + return [ + 'hello', + 'world', + ] +""" + style_contents = u"""\ +[style] +based_on_style = yapf +USE_TABS = true +INDENT_WIDTH=1 +""" + with utils.TempFileContents(self.test_tmpdir, style_contents) as stylepath: + self.assertYapfReformats( + unformatted_code, + expected_formatted_code, + extra_options=['--style={0}'.format(stylepath)]) + + def testUseTabsContinuationAlignStyleFixed(self): + unformatted_code = """\ +def foo_function(arg1, arg2, arg3): + return ['hello', 'world',] +""" + expected_formatted_code = """\ +def foo_function( + arg1, arg2, arg3): + return [ + 'hello', + 'world', + ] +""" + style_contents = u"""\ +[style] +based_on_style = yapf +USE_TABS = true +COLUMN_LIMIT=32 +INDENT_WIDTH=4 +CONTINUATION_INDENT_WIDTH=8 +CONTINUATION_ALIGN_STYLE = fixed +""" + with utils.TempFileContents(self.test_tmpdir, style_contents) as stylepath: + self.assertYapfReformats( + unformatted_code, + expected_formatted_code, + extra_options=['--style={0}'.format(stylepath)]) + + def testUseTabsContinuationAlignStyleVAlignRight(self): + unformatted_code = """\ +def foo_function(arg1, arg2, arg3): + return ['hello', 'world',] +""" + expected_formatted_code = """\ +def foo_function(arg1, arg2, + arg3): + return [ + 'hello', + 'world', + ] +""" + style_contents = u"""\ +[style] +based_on_style = yapf +USE_TABS = true +COLUMN_LIMIT=32 +INDENT_WIDTH=4 +CONTINUATION_INDENT_WIDTH=8 +CONTINUATION_ALIGN_STYLE = valign-right +""" + with utils.TempFileContents(self.test_tmpdir, style_contents) as stylepath: + self.assertYapfReformats( + unformatted_code, + expected_formatted_code, + extra_options=['--style={0}'.format(stylepath)]) + + def testUseSpacesContinuationAlignStyleFixed(self): + unformatted_code = """\ +def foo_function(arg1, arg2, arg3): + return ['hello', 'world',] +""" + expected_formatted_code = """\ +def foo_function( + arg1, arg2, arg3): + return [ + 'hello', + 'world', + ] +""" + style_contents = u"""\ +[style] +based_on_style = yapf +COLUMN_LIMIT=32 +INDENT_WIDTH=4 +CONTINUATION_INDENT_WIDTH=8 +CONTINUATION_ALIGN_STYLE = fixed +""" + with utils.TempFileContents(self.test_tmpdir, style_contents) as stylepath: + self.assertYapfReformats( + unformatted_code, + expected_formatted_code, + extra_options=['--style={0}'.format(stylepath)]) + + def testUseSpacesContinuationAlignStyleVAlignRight(self): + unformatted_code = """\ +def foo_function(arg1, arg2, arg3): + return ['hello', 'world',] +""" + expected_formatted_code = """\ +def foo_function(arg1, arg2, + arg3): + return [ + 'hello', + 'world', + ] +""" + style_contents = u"""\ +[style] +based_on_style = yapf +COLUMN_LIMIT=32 +INDENT_WIDTH=4 +CONTINUATION_INDENT_WIDTH=8 +CONTINUATION_ALIGN_STYLE = valign-right +""" + with utils.TempFileContents(self.test_tmpdir, style_contents) as stylepath: + self.assertYapfReformats( + unformatted_code, + expected_formatted_code, + extra_options=['--style={0}'.format(stylepath)]) + + def testStyleOutputRoundTrip(self): + unformatted_code = textwrap.dedent("""\ + def foo_function(): + pass + """) + expected_formatted_code = textwrap.dedent("""\ + def foo_function(): + pass + """) + + with utils.NamedTempFile(dirname=self.test_tmpdir) as (stylefile, + stylepath): + p = subprocess.Popen( + YAPF_BINARY + ['--style-help'], + stdout=stylefile, + stdin=subprocess.PIPE, + stderr=subprocess.PIPE) + _, stderrdata = p.communicate() + self.assertEqual(stderrdata, b'') + self.assertYapfReformats( + unformatted_code, + expected_formatted_code, + extra_options=['--style={0}'.format(stylepath)]) + + def testSpacingBeforeComments(self): + unformatted_code = textwrap.dedent("""\ + A = 42 + + + # A comment + def x(): + pass + def _(): + pass + """) + expected_formatted_code = textwrap.dedent("""\ + A = 42 + + + # A comment + def x(): + pass + def _(): + pass + """) + self.assertYapfReformats( + unformatted_code, + expected_formatted_code, + extra_options=['--lines', '1-2']) + + def testSpacingBeforeCommentsInDicts(self): + unformatted_code = textwrap.dedent("""\ + A=42 + + X = { + # 'Valid' statuses. + PASSED: # Passed + 'PASSED', + FAILED: # Failed + 'FAILED', + TIMED_OUT: # Timed out. + 'FAILED', + BORKED: # Broken. + 'BROKEN' + } + """) + expected_formatted_code = textwrap.dedent("""\ + A = 42 + + X = { + # 'Valid' statuses. + PASSED: # Passed + 'PASSED', + FAILED: # Failed + 'FAILED', + TIMED_OUT: # Timed out. + 'FAILED', + BORKED: # Broken. + 'BROKEN' + } + """) + self.assertYapfReformats( + unformatted_code, + expected_formatted_code, + extra_options=['--style', 'yapf', '--lines', '1-1']) + + @unittest.skipUnless(py3compat.PY36, 'Requires Python 3.6') + def testNoSpacesAroundBinaryOperators(self): + unformatted_code = """\ +a = 4-b/c@d**37 +""" + expected_formatted_code = """\ +a = 4-b / c@d**37 +""" + self.assertYapfReformats( + unformatted_code, + expected_formatted_code, + extra_options=[ + '--style', + '{based_on_style: pep8, ' + 'no_spaces_around_selected_binary_operators: "@,**,-"}', + ]) + + @unittest.skipUnless(py3compat.PY36, 'Requires Python 3.6') + def testCP936Encoding(self): + unformatted_code = 'print("中文")\n' + expected_formatted_code = 'print("中文")\n' + self.assertYapfReformats( + unformatted_code, + expected_formatted_code, + env={'PYTHONIOENCODING': 'cp936'}) + + def testDisableWithLineRanges(self): + unformatted_code = """\ +# yapf: disable +a = [ + 1, + 2, + + 3 +] +""" + expected_formatted_code = """\ +# yapf: disable +a = [ + 1, + 2, + + 3 +] +""" + self.assertYapfReformats( + unformatted_code, + expected_formatted_code, + extra_options=['--style', 'yapf', '--lines', '1-100']) + + +class BadInputTest(unittest.TestCase): + """Test yapf's behaviour when passed bad input.""" + + def testBadSyntax(self): + code = ' a = 1\n' + self.assertRaises(SyntaxError, yapf_api.FormatCode, code) + + def testBadCode(self): + code = 'x = """hello\n' + self.assertRaises(tokenize.TokenError, yapf_api.FormatCode, code) + + +class DiffIndentTest(unittest.TestCase): + + @staticmethod + def _OwnStyle(): + my_style = style.CreatePEP8Style() + my_style['INDENT_WIDTH'] = 3 + my_style['CONTINUATION_INDENT_WIDTH'] = 3 + return my_style + + def _Check(self, unformatted_code, expected_formatted_code): + formatted_code, _ = yapf_api.FormatCode( + unformatted_code, style_config=style.SetGlobalStyle(self._OwnStyle())) + self.assertEqual(expected_formatted_code, formatted_code) + + def testSimple(self): + unformatted_code = textwrap.dedent("""\ + for i in range(5): + print('bar') + """) + expected_formatted_code = textwrap.dedent("""\ + for i in range(5): + print('bar') + """) + self._Check(unformatted_code, expected_formatted_code) + + +class HorizontallyAlignedTrailingCommentsTest(yapf_test_helper.YAPFTest): + + @staticmethod + def _OwnStyle(): + my_style = style.CreatePEP8Style() + my_style['SPACES_BEFORE_COMMENT'] = [ + 15, + 25, + 35, + ] + return my_style + + def _Check(self, unformatted_code, expected_formatted_code): + formatted_code, _ = yapf_api.FormatCode( + unformatted_code, style_config=style.SetGlobalStyle(self._OwnStyle())) + self.assertCodeEqual(expected_formatted_code, formatted_code) + + def testSimple(self): + unformatted_code = textwrap.dedent("""\ + foo = '1' # Aligned at first list value + + foo = '2__<15>' # Aligned at second list value + + foo = '3____________<25>' # Aligned at third list value + + foo = '4______________________<35>' # Aligned beyond list values + """) + expected_formatted_code = textwrap.dedent("""\ + foo = '1' # Aligned at first list value + + foo = '2__<15>' # Aligned at second list value + + foo = '3____________<25>' # Aligned at third list value + + foo = '4______________________<35>' # Aligned beyond list values + """) + self._Check(unformatted_code, expected_formatted_code) + + def testBlock(self): + unformatted_code = textwrap.dedent("""\ + func(1) # Line 1 + func(2) # Line 2 + # Line 3 + func(3) # Line 4 + # Line 5 + # Line 6 + """) + expected_formatted_code = textwrap.dedent("""\ + func(1) # Line 1 + func(2) # Line 2 + # Line 3 + func(3) # Line 4 + # Line 5 + # Line 6 + """) + self._Check(unformatted_code, expected_formatted_code) + + def testBlockWithLongLine(self): + unformatted_code = textwrap.dedent("""\ + func(1) # Line 1 + func___________________(2) # Line 2 + # Line 3 + func(3) # Line 4 + # Line 5 + # Line 6 + """) + expected_formatted_code = textwrap.dedent("""\ + func(1) # Line 1 + func___________________(2) # Line 2 + # Line 3 + func(3) # Line 4 + # Line 5 + # Line 6 + """) + self._Check(unformatted_code, expected_formatted_code) + + def testBlockFuncSuffix(self): + unformatted_code = textwrap.dedent("""\ + func(1) # Line 1 + func(2) # Line 2 + # Line 3 + func(3) # Line 4 + # Line 5 + # Line 6 + + def Func(): + pass + """) + expected_formatted_code = textwrap.dedent("""\ + func(1) # Line 1 + func(2) # Line 2 + # Line 3 + func(3) # Line 4 + # Line 5 + # Line 6 + + + def Func(): + pass + """) + self._Check(unformatted_code, expected_formatted_code) + + def testBlockCommentSuffix(self): + unformatted_code = textwrap.dedent("""\ + func(1) # Line 1 + func(2) # Line 2 + # Line 3 + func(3) # Line 4 + # Line 5 - SpliceComments makes this part of the previous block + # Line 6 + + # Aligned with prev comment block + """) + expected_formatted_code = textwrap.dedent("""\ + func(1) # Line 1 + func(2) # Line 2 + # Line 3 + func(3) # Line 4 + # Line 5 - SpliceComments makes this part of the previous block + # Line 6 + + # Aligned with prev comment block + """) + self._Check(unformatted_code, expected_formatted_code) + + def testBlockIndentedFuncSuffix(self): + unformatted_code = textwrap.dedent("""\ + if True: + func(1) # Line 1 + func(2) # Line 2 + # Line 3 + func(3) # Line 4 + # Line 5 - SpliceComments makes this a new block + # Line 6 + + # Aligned with Func + + def Func(): + pass + """) + expected_formatted_code = textwrap.dedent("""\ + if True: + func(1) # Line 1 + func(2) # Line 2 + # Line 3 + func(3) # Line 4 + + # Line 5 - SpliceComments makes this a new block + # Line 6 + + # Aligned with Func + + + def Func(): + pass + """) + self._Check(unformatted_code, expected_formatted_code) + + def testBlockIndentedCommentSuffix(self): + unformatted_code = textwrap.dedent("""\ + if True: + func(1) # Line 1 + func(2) # Line 2 + # Line 3 + func(3) # Line 4 + # Line 5 + # Line 6 + + # Not aligned + """) + expected_formatted_code = textwrap.dedent("""\ + if True: + func(1) # Line 1 + func(2) # Line 2 + # Line 3 + func(3) # Line 4 + # Line 5 + # Line 6 + + # Not aligned + """) + self._Check(unformatted_code, expected_formatted_code) + + def testBlockMultiIndented(self): + unformatted_code = textwrap.dedent("""\ + if True: + if True: + if True: + func(1) # Line 1 + func(2) # Line 2 + # Line 3 + func(3) # Line 4 + # Line 5 + # Line 6 + + # Not aligned + """) + expected_formatted_code = textwrap.dedent("""\ + if True: + if True: + if True: + func(1) # Line 1 + func(2) # Line 2 + # Line 3 + func(3) # Line 4 + # Line 5 + # Line 6 + + # Not aligned + """) + self._Check(unformatted_code, expected_formatted_code) + + def testArgs(self): + unformatted_code = textwrap.dedent("""\ + def MyFunc( + arg1, # Desc 1 + arg2, # Desc 2 + a_longer_var_name, # Desc 3 + arg4, + arg5, # Desc 5 + arg6, + ): + pass + """) + expected_formatted_code = textwrap.dedent("""\ + def MyFunc( + arg1, # Desc 1 + arg2, # Desc 2 + a_longer_var_name, # Desc 3 + arg4, + arg5, # Desc 5 + arg6, + ): + pass + """) + self._Check(unformatted_code, expected_formatted_code) + + def testDisableBlock(self): + unformatted_code = textwrap.dedent("""\ + a() # comment 1 + b() # comment 2 + + # yapf: disable + c() # comment 3 + d() # comment 4 + # yapf: enable + + e() # comment 5 + f() # comment 6 + """) + expected_formatted_code = textwrap.dedent("""\ + a() # comment 1 + b() # comment 2 + + # yapf: disable + c() # comment 3 + d() # comment 4 + # yapf: enable + + e() # comment 5 + f() # comment 6 + """) + self._Check(unformatted_code, expected_formatted_code) + + def testDisabledLine(self): + unformatted_code = textwrap.dedent("""\ + short # comment 1 + do_not_touch1 # yapf: disable + do_not_touch2 # yapf: disable + a_longer_statement # comment 2 + """) + expected_formatted_code = textwrap.dedent("""\ + short # comment 1 + do_not_touch1 # yapf: disable + do_not_touch2 # yapf: disable + a_longer_statement # comment 2 + """) + self._Check(unformatted_code, expected_formatted_code) + + +class _SpacesAroundDictListTupleTestImpl(unittest.TestCase): + + @staticmethod + def _OwnStyle(): + my_style = style.CreatePEP8Style() + my_style['DISABLE_ENDING_COMMA_HEURISTIC'] = True + my_style['SPLIT_ALL_COMMA_SEPARATED_VALUES'] = False + my_style['SPLIT_ARGUMENTS_WHEN_COMMA_TERMINATED'] = False + return my_style + + def _Check(self, unformatted_code, expected_formatted_code): + formatted_code, _ = yapf_api.FormatCode( + unformatted_code, style_config=style.SetGlobalStyle(self._OwnStyle())) + self.assertEqual(expected_formatted_code, formatted_code) + + def setUp(self): + self.maxDiff = None + + +class SpacesAroundDictTest(_SpacesAroundDictListTupleTestImpl): + + @classmethod + def _OwnStyle(cls): + style = super(SpacesAroundDictTest, cls)._OwnStyle() + style['SPACES_AROUND_DICT_DELIMITERS'] = True + + return style + + def testStandard(self): + unformatted_code = textwrap.dedent("""\ + {1 : 2} + {k:v for k, v in other.items()} + {k for k in [1, 2, 3]} + + # The following statements should not change + {} + {1 : 2} # yapf: disable + + # yapf: disable + {1 : 2} + # yapf: enable + + # Dict settings should not impact lists or tuples + [1, 2] + (3, 4) + """) + expected_formatted_code = textwrap.dedent("""\ + { 1: 2 } + { k: v for k, v in other.items() } + { k for k in [1, 2, 3] } + + # The following statements should not change + {} + {1 : 2} # yapf: disable + + # yapf: disable + {1 : 2} + # yapf: enable + + # Dict settings should not impact lists or tuples + [1, 2] + (3, 4) + """) + + self._Check(unformatted_code, expected_formatted_code) + + +class SpacesAroundListTest(_SpacesAroundDictListTupleTestImpl): + + @classmethod + def _OwnStyle(cls): + style = super(SpacesAroundListTest, cls)._OwnStyle() + style['SPACES_AROUND_LIST_DELIMITERS'] = True + + return style + + def testStandard(self): + unformatted_code = textwrap.dedent("""\ + [a,b,c] + [4,5,] + [6, [7, 8], 9] + [v for v in [1,2,3] if v & 1] + + # The following statements should not change + index[0] + index[a, b] + [] + [v for v in [1,2,3] if v & 1] # yapf: disable + + # yapf: disable + [a,b,c] + [4,5,] + # yapf: enable + + # List settings should not impact dicts or tuples + {a: b} + (1, 2) + """) + expected_formatted_code = textwrap.dedent("""\ + [ a, b, c ] + [ 4, 5, ] + [ 6, [ 7, 8 ], 9 ] + [ v for v in [ 1, 2, 3 ] if v & 1 ] + + # The following statements should not change + index[0] + index[a, b] + [] + [v for v in [1,2,3] if v & 1] # yapf: disable + + # yapf: disable + [a,b,c] + [4,5,] + # yapf: enable + + # List settings should not impact dicts or tuples + {a: b} + (1, 2) + """) + + self._Check(unformatted_code, expected_formatted_code) + + +class SpacesAroundTupleTest(_SpacesAroundDictListTupleTestImpl): + + @classmethod + def _OwnStyle(cls): + style = super(SpacesAroundTupleTest, cls)._OwnStyle() + style['SPACES_AROUND_TUPLE_DELIMITERS'] = True + + return style + + def testStandard(self): + unformatted_code = textwrap.dedent("""\ + (0, 1) + (2, 3) + (4, 5, 6,) + func((7, 8), 9) + + # The following statements should not change + func(1, 2) + (this_func or that_func)(3, 4) + if (True and False): pass + () + + (0, 1) # yapf: disable + + # yapf: disable + (0, 1) + (2, 3) + # yapf: enable + + # Tuple settings should not impact dicts or lists + {a: b} + [3, 4] + """) + expected_formatted_code = textwrap.dedent("""\ + ( 0, 1 ) + ( 2, 3 ) + ( 4, 5, 6, ) + func(( 7, 8 ), 9) + + # The following statements should not change + func(1, 2) + (this_func or that_func)(3, 4) + if (True and False): pass + () + + (0, 1) # yapf: disable + + # yapf: disable + (0, 1) + (2, 3) + # yapf: enable + + # Tuple settings should not impact dicts or lists + {a: b} + [3, 4] + """) + + self._Check(unformatted_code, expected_formatted_code) + + +if __name__ == '__main__': + unittest.main() diff --git a/.venv/lib/python3.9/site-packages/yapftests/yapf_test_helper.py b/.venv/lib/python3.9/site-packages/yapftests/yapf_test_helper.py new file mode 100644 index 00000000..1f21b363 --- /dev/null +++ b/.venv/lib/python3.9/site-packages/yapftests/yapf_test_helper.py @@ -0,0 +1,89 @@ +# Copyright 2016 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Support module for tests for yapf.""" + +import difflib +import sys +import unittest + +from yapf.yapflib import blank_line_calculator +from yapf.yapflib import comment_splicer +from yapf.yapflib import continuation_splicer +from yapf.yapflib import identify_container +from yapf.yapflib import pytree_unwrapper +from yapf.yapflib import pytree_utils +from yapf.yapflib import pytree_visitor +from yapf.yapflib import split_penalty +from yapf.yapflib import style +from yapf.yapflib import subtype_assigner + + +class YAPFTest(unittest.TestCase): + + def assertCodeEqual(self, expected_code, code): + if code != expected_code: + msg = ['Code format mismatch:', 'Expected:'] + linelen = style.Get('COLUMN_LIMIT') + for l in expected_code.splitlines(): + if len(l) > linelen: + msg.append('!> %s' % l) + else: + msg.append(' > %s' % l) + msg.append('Actual:') + for l in code.splitlines(): + if len(l) > linelen: + msg.append('!> %s' % l) + else: + msg.append(' > %s' % l) + msg.append('Diff:') + msg.extend( + difflib.unified_diff( + code.splitlines(), + expected_code.splitlines(), + fromfile='actual', + tofile='expected', + lineterm='')) + self.fail('\n'.join(msg)) + + +def ParseAndUnwrap(code, dumptree=False): + """Produces unwrapped lines from the given code. + + Parses the code into a tree, performs comment splicing and runs the + unwrapper. + + Arguments: + code: code to parse as a string + dumptree: if True, the parsed pytree (after comment splicing) is dumped + to stderr. Useful for debugging. + + Returns: + List of unwrapped lines. + """ + tree = pytree_utils.ParseCodeToTree(code) + comment_splicer.SpliceComments(tree) + continuation_splicer.SpliceContinuations(tree) + subtype_assigner.AssignSubtypes(tree) + identify_container.IdentifyContainers(tree) + split_penalty.ComputeSplitPenalties(tree) + blank_line_calculator.CalculateBlankLines(tree) + + if dumptree: + pytree_visitor.DumpPyTree(tree, target_stream=sys.stderr) + + uwlines = pytree_unwrapper.UnwrapPyTree(tree) + for uwl in uwlines: + uwl.CalculateFormattingInformation() + + return uwlines