diff --git a/.cache/pip/http/1/e/b/b/e/1ebbeab65aa7ff9aee5556962ca09463acf5572da69862f5dee21a03 b/.cache/pip/http/1/e/b/b/e/1ebbeab65aa7ff9aee5556962ca09463acf5572da69862f5dee21a03 new file mode 100644 index 0000000000000000000000000000000000000000..e8dfbbded4e8fb03097ac1ae8990a04863e5eb2a Binary files /dev/null and b/.cache/pip/http/1/e/b/b/e/1ebbeab65aa7ff9aee5556962ca09463acf5572da69862f5dee21a03 differ diff --git a/.cache/pip/http/2/4/0/c/6/240c64a7d4b874a8ad7a9d229bb3e2112f13d5020287eeb9232cfad9 b/.cache/pip/http/2/4/0/c/6/240c64a7d4b874a8ad7a9d229bb3e2112f13d5020287eeb9232cfad9 new file mode 100644 index 0000000000000000000000000000000000000000..507881666f3515785e568c2e62e7b14bafee8cf8 Binary files /dev/null and b/.cache/pip/http/2/4/0/c/6/240c64a7d4b874a8ad7a9d229bb3e2112f13d5020287eeb9232cfad9 differ diff --git a/.cache/pip/http/3/8/6/0/e/3860e4de9ae53c79d2fd61419e9049df314ccc8b640782c02c6e2e2d b/.cache/pip/http/3/8/6/0/e/3860e4de9ae53c79d2fd61419e9049df314ccc8b640782c02c6e2e2d new file mode 100644 index 0000000000000000000000000000000000000000..8d01a7a26605d3a1414b4ef80257e7cdd781e825 Binary files /dev/null and b/.cache/pip/http/3/8/6/0/e/3860e4de9ae53c79d2fd61419e9049df314ccc8b640782c02c6e2e2d differ diff --git a/.cache/pip/http/6/c/b/b/3/6cbb3631113b4b5f721ede6a26a99dc77b286db1b7f16ead421465ef b/.cache/pip/http/6/c/b/b/3/6cbb3631113b4b5f721ede6a26a99dc77b286db1b7f16ead421465ef new file mode 100644 index 0000000000000000000000000000000000000000..4e272e9f5d72f4734bbf9730d7e71c50b18d8d0f Binary files /dev/null and b/.cache/pip/http/6/c/b/b/3/6cbb3631113b4b5f721ede6a26a99dc77b286db1b7f16ead421465ef differ diff --git a/.cache/pip/http/9/0/6/7/9/906797ab7b3f56fdd856b186be66ce1ad5fb99862a404c1091a707b6 b/.cache/pip/http/9/0/6/7/9/906797ab7b3f56fdd856b186be66ce1ad5fb99862a404c1091a707b6 new file mode 100644 index 0000000000000000000000000000000000000000..b9e42cb17f292f0076ac124f496dc5e137971b35 Binary files /dev/null and b/.cache/pip/http/9/0/6/7/9/906797ab7b3f56fdd856b186be66ce1ad5fb99862a404c1091a707b6 differ diff --git a/.cache/pip/http/a/1/9/5/3/a19537d3cf37c122db841d6fe4cd322bc10d1a558bb00d146b85cb9a b/.cache/pip/http/a/1/9/5/3/a19537d3cf37c122db841d6fe4cd322bc10d1a558bb00d146b85cb9a new file mode 100644 index 0000000000000000000000000000000000000000..6dcbe20c06eed2ccb1be9cb835b71642bee38890 Binary files /dev/null and b/.cache/pip/http/a/1/9/5/3/a19537d3cf37c122db841d6fe4cd322bc10d1a558bb00d146b85cb9a differ diff --git a/.cache/pip/http/b/8/6/2/6/b862637a242a4033f1ba3be874e038f3a95ab29277da4c878f7c162d b/.cache/pip/http/b/8/6/2/6/b862637a242a4033f1ba3be874e038f3a95ab29277da4c878f7c162d new file mode 100644 index 0000000000000000000000000000000000000000..0a7cd5efbe07486b196931d150fb0a65becc5636 Binary files /dev/null and b/.cache/pip/http/b/8/6/2/6/b862637a242a4033f1ba3be874e038f3a95ab29277da4c878f7c162d differ diff --git a/.cache/pip/http/c/0/7/a/c/c07ac6a1aa0164987344a1c80a6a257cfc0226cd38d7ea2ca95dbf37 b/.cache/pip/http/c/0/7/a/c/c07ac6a1aa0164987344a1c80a6a257cfc0226cd38d7ea2ca95dbf37 new file mode 100644 index 0000000000000000000000000000000000000000..1d5007c94e9fecfe0f8af1805733b735746c6162 Binary files /dev/null and b/.cache/pip/http/c/0/7/a/c/c07ac6a1aa0164987344a1c80a6a257cfc0226cd38d7ea2ca95dbf37 differ diff --git a/.cache/pip/http/c/0/e/8/5/c0e854830132b4466a4ad702e2f7168f1253a791e391b297676ef2cd b/.cache/pip/http/c/0/e/8/5/c0e854830132b4466a4ad702e2f7168f1253a791e391b297676ef2cd new file mode 100644 index 0000000000000000000000000000000000000000..ce71d093c89b9777762f31d991e1f6a9925c65a6 Binary files /dev/null and b/.cache/pip/http/c/0/e/8/5/c0e854830132b4466a4ad702e2f7168f1253a791e391b297676ef2cd differ diff --git a/.cache/pip/selfcheck/241e69162522ccf5846a2f42ebc24b17464915a155679666b89a9f31 b/.cache/pip/selfcheck/241e69162522ccf5846a2f42ebc24b17464915a155679666b89a9f31 new file mode 100644 index 0000000000000000000000000000000000000000..e96be79379d9b3a965cc311b3f0e11e5c5bd1597 --- /dev/null +++ b/.cache/pip/selfcheck/241e69162522ccf5846a2f42ebc24b17464915a155679666b89a9f31 @@ -0,0 +1 @@ +{"key":"/usr","last_check":"2023-01-24T03:44:36Z","pypi_version":"22.3.1"} \ No newline at end of file diff --git a/.gitattributes b/.gitattributes index c7d9f3332a950355d5a77d85000f05e6f45435ea..0d2659ade295cf6d3d17f89248fd727cf5917e17 100644 --- a/.gitattributes +++ b/.gitattributes @@ -32,3 +32,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text *.zip filter=lfs diff=lfs merge=lfs -text *.zst filter=lfs diff=lfs merge=lfs -text *tfevents* filter=lfs diff=lfs merge=lfs -text +.local/lib/python3.10/site-packages/yaml/_yaml.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text diff --git a/.local/bin/huggingface-cli b/.local/bin/huggingface-cli new file mode 100644 index 0000000000000000000000000000000000000000..60c4966c3ea784ecb06e46a17575425153da1f41 --- /dev/null +++ b/.local/bin/huggingface-cli @@ -0,0 +1,8 @@ +#!/usr/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from huggingface_hub.commands.huggingface_cli import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/.local/bin/tqdm b/.local/bin/tqdm new file mode 100644 index 0000000000000000000000000000000000000000..bdac0c3a76325ec7ebcc99a4b4221b67884eb9e1 --- /dev/null +++ b/.local/bin/tqdm @@ -0,0 +1,8 @@ +#!/usr/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from tqdm.cli import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/.local/lib/python3.10/site-packages/PyYAML-6.0.dist-info/INSTALLER b/.local/lib/python3.10/site-packages/PyYAML-6.0.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/.local/lib/python3.10/site-packages/PyYAML-6.0.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/.local/lib/python3.10/site-packages/PyYAML-6.0.dist-info/LICENSE b/.local/lib/python3.10/site-packages/PyYAML-6.0.dist-info/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..2f1b8e15e5627d92f0521605c9870bc8e5505cb4 --- /dev/null +++ b/.local/lib/python3.10/site-packages/PyYAML-6.0.dist-info/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2017-2021 Ingy döt Net +Copyright (c) 2006-2016 Kirill Simonov + +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/.local/lib/python3.10/site-packages/PyYAML-6.0.dist-info/METADATA b/.local/lib/python3.10/site-packages/PyYAML-6.0.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..9a910762b227db96d0e08fa66d005f00114924ae --- /dev/null +++ b/.local/lib/python3.10/site-packages/PyYAML-6.0.dist-info/METADATA @@ -0,0 +1,46 @@ +Metadata-Version: 2.1 +Name: PyYAML +Version: 6.0 +Summary: YAML parser and emitter for Python +Home-page: https://pyyaml.org/ +Author: Kirill Simonov +Author-email: xi@resolvent.net +License: MIT +Download-URL: https://pypi.org/project/PyYAML/ +Project-URL: Bug Tracker, https://github.com/yaml/pyyaml/issues +Project-URL: CI, https://github.com/yaml/pyyaml/actions +Project-URL: Documentation, https://pyyaml.org/wiki/PyYAMLDocumentation +Project-URL: Mailing lists, http://lists.sourceforge.net/lists/listinfo/yaml-core +Project-URL: Source Code, https://github.com/yaml/pyyaml +Platform: Any +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: MIT License +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Cython +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Programming Language :: Python :: Implementation :: PyPy +Classifier: Topic :: Software Development :: Libraries :: Python Modules +Classifier: Topic :: Text Processing :: Markup +Requires-Python: >=3.6 +License-File: LICENSE + +YAML is a data serialization format designed for human readability +and interaction with scripting languages. PyYAML is a YAML parser +and emitter for Python. + +PyYAML features a complete YAML 1.1 parser, Unicode support, pickle +support, capable extension API, and sensible error messages. PyYAML +supports standard YAML tags and provides Python-specific tags that +allow to represent an arbitrary Python object. + +PyYAML is applicable for a broad range of tasks from complex +configuration files to object serialization and persistence. + diff --git a/.local/lib/python3.10/site-packages/PyYAML-6.0.dist-info/RECORD b/.local/lib/python3.10/site-packages/PyYAML-6.0.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..5d70e90d6a3634fee0e2258cc9dd50dbfe2abfc1 --- /dev/null +++ b/.local/lib/python3.10/site-packages/PyYAML-6.0.dist-info/RECORD @@ -0,0 +1,43 @@ +PyYAML-6.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +PyYAML-6.0.dist-info/LICENSE,sha256=jTko-dxEkP1jVwfLiOsmvXZBAqcoKVQwfT5RZ6V36KQ,1101 +PyYAML-6.0.dist-info/METADATA,sha256=QmHx9kGp_0yezQCXYaft4eEFeJ6W4oyFfYwHDLP1kdg,2006 +PyYAML-6.0.dist-info/RECORD,, +PyYAML-6.0.dist-info/WHEEL,sha256=gn97LKY8yapDq5WrPM24dc0-MAPY7hOCxJGLaGdibEk,225 +PyYAML-6.0.dist-info/top_level.txt,sha256=rpj0IVMTisAjh_1vG3Ccf9v5jpCQwAz6cD1IVU5ZdhQ,11 +_yaml/__init__.py,sha256=04Ae_5osxahpJHa3XBZUAf4wi6XX32gR8D6X6p64GEA,1402 +_yaml/__pycache__/__init__.cpython-310.pyc,, +yaml/__init__.py,sha256=NDS7S8XgA72-hY6LRmGzUWTPvzGzjWVrWk-OGA-77AA,12309 +yaml/__pycache__/__init__.cpython-310.pyc,, +yaml/__pycache__/composer.cpython-310.pyc,, +yaml/__pycache__/constructor.cpython-310.pyc,, +yaml/__pycache__/cyaml.cpython-310.pyc,, +yaml/__pycache__/dumper.cpython-310.pyc,, +yaml/__pycache__/emitter.cpython-310.pyc,, +yaml/__pycache__/error.cpython-310.pyc,, +yaml/__pycache__/events.cpython-310.pyc,, +yaml/__pycache__/loader.cpython-310.pyc,, +yaml/__pycache__/nodes.cpython-310.pyc,, +yaml/__pycache__/parser.cpython-310.pyc,, +yaml/__pycache__/reader.cpython-310.pyc,, +yaml/__pycache__/representer.cpython-310.pyc,, +yaml/__pycache__/resolver.cpython-310.pyc,, +yaml/__pycache__/scanner.cpython-310.pyc,, +yaml/__pycache__/serializer.cpython-310.pyc,, +yaml/__pycache__/tokens.cpython-310.pyc,, +yaml/_yaml.cpython-310-x86_64-linux-gnu.so,sha256=RsHkV2bQtRQWNALoJ8O3V0nq2GceRCbMSh4hIkd4QZQ,2165840 +yaml/composer.py,sha256=_Ko30Wr6eDWUeUpauUGT3Lcg9QPBnOPVlTnIMRGJ9FM,4883 +yaml/constructor.py,sha256=kNgkfaeLUkwQYY_Q6Ff1Tz2XVw_pG1xVE9Ak7z-viLA,28639 +yaml/cyaml.py,sha256=6ZrAG9fAYvdVe2FK_w0hmXoG7ZYsoYUwapG8CiC72H0,3851 +yaml/dumper.py,sha256=PLctZlYwZLp7XmeUdwRuv4nYOZ2UBnDIUy8-lKfLF-o,2837 +yaml/emitter.py,sha256=jghtaU7eFwg31bG0B7RZea_29Adi9CKmXq_QjgQpCkQ,43006 +yaml/error.py,sha256=Ah9z-toHJUbE9j-M8YpxgSRM5CgLCcwVzJgLLRF2Fxo,2533 +yaml/events.py,sha256=50_TksgQiE4up-lKo_V-nBy-tAIxkIPQxY5qDhKCeHw,2445 +yaml/loader.py,sha256=UVa-zIqmkFSCIYq_PgSGm4NSJttHY2Rf_zQ4_b1fHN0,2061 +yaml/nodes.py,sha256=gPKNj8pKCdh2d4gr3gIYINnPOaOxGhJAUiYhGRnPE84,1440 +yaml/parser.py,sha256=ilWp5vvgoHFGzvOZDItFoGjD6D42nhlZrZyjAwa0oJo,25495 +yaml/reader.py,sha256=0dmzirOiDG4Xo41RnuQS7K9rkY3xjHiVasfDMNTqCNw,6794 +yaml/representer.py,sha256=IuWP-cAW9sHKEnS0gCqSa894k1Bg4cgTxaDwIcbRQ-Y,14190 +yaml/resolver.py,sha256=9L-VYfm4mWHxUD1Vg4X7rjDRK_7VZd6b92wzq7Y2IKY,9004 +yaml/scanner.py,sha256=YEM3iLZSaQwXcQRg2l2R4MdT0zGP2F9eHkKGKnHyWQY,51279 +yaml/serializer.py,sha256=ChuFgmhU01hj4xgI8GaKv6vfM2Bujwa9i7d2FAHj7cA,4165 +yaml/tokens.py,sha256=lTQIzSVw8Mg9wv459-TjiOQe6wVziqaRlqX2_89rp54,2573 diff --git a/.local/lib/python3.10/site-packages/PyYAML-6.0.dist-info/WHEEL b/.local/lib/python3.10/site-packages/PyYAML-6.0.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..7215a9d1fd978eed7e15f533dab743d16874366a --- /dev/null +++ b/.local/lib/python3.10/site-packages/PyYAML-6.0.dist-info/WHEEL @@ -0,0 +1,8 @@ +Wheel-Version: 1.0 +Generator: bdist_wheel (0.37.0) +Root-Is-Purelib: false +Tag: cp310-cp310-manylinux_2_5_x86_64 +Tag: cp310-cp310-manylinux1_x86_64 +Tag: cp310-cp310-manylinux_2_12_x86_64 +Tag: cp310-cp310-manylinux2010_x86_64 + diff --git a/.local/lib/python3.10/site-packages/PyYAML-6.0.dist-info/top_level.txt b/.local/lib/python3.10/site-packages/PyYAML-6.0.dist-info/top_level.txt new file mode 100644 index 0000000000000000000000000000000000000000..e6475e911f628412049bc4090d86f23ac403adde --- /dev/null +++ b/.local/lib/python3.10/site-packages/PyYAML-6.0.dist-info/top_level.txt @@ -0,0 +1,2 @@ +_yaml +yaml diff --git a/.local/lib/python3.10/site-packages/_yaml/__init__.py b/.local/lib/python3.10/site-packages/_yaml/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..7baa8c4b68127d5cdf0be9a799429e61347c2694 --- /dev/null +++ b/.local/lib/python3.10/site-packages/_yaml/__init__.py @@ -0,0 +1,33 @@ +# This is a stub package designed to roughly emulate the _yaml +# extension module, which previously existed as a standalone module +# and has been moved into the `yaml` package namespace. +# It does not perfectly mimic its old counterpart, but should get +# close enough for anyone who's relying on it even when they shouldn't. +import yaml + +# in some circumstances, the yaml module we imoprted may be from a different version, so we need +# to tread carefully when poking at it here (it may not have the attributes we expect) +if not getattr(yaml, '__with_libyaml__', False): + from sys import version_info + + exc = ModuleNotFoundError if version_info >= (3, 6) else ImportError + raise exc("No module named '_yaml'") +else: + from yaml._yaml import * + import warnings + warnings.warn( + 'The _yaml extension module is now located at yaml._yaml' + ' and its location is subject to change. To use the' + ' LibYAML-based parser and emitter, import from `yaml`:' + ' `from yaml import CLoader as Loader, CDumper as Dumper`.', + DeprecationWarning + ) + del warnings + # Don't `del yaml` here because yaml is actually an existing + # namespace member of _yaml. + +__name__ = '_yaml' +# If the module is top-level (i.e. not a part of any specific package) +# then the attribute should be set to ''. +# https://docs.python.org/3.8/library/types.html +__package__ = '' diff --git a/.local/lib/python3.10/site-packages/_yaml/__pycache__/__init__.cpython-310.pyc b/.local/lib/python3.10/site-packages/_yaml/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5839c47eb9c70415f47eadcec160608968f3b835 Binary files /dev/null and b/.local/lib/python3.10/site-packages/_yaml/__pycache__/__init__.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/filelock-3.9.0.dist-info/INSTALLER b/.local/lib/python3.10/site-packages/filelock-3.9.0.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/.local/lib/python3.10/site-packages/filelock-3.9.0.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/.local/lib/python3.10/site-packages/filelock-3.9.0.dist-info/METADATA b/.local/lib/python3.10/site-packages/filelock-3.9.0.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..f73f461a572063f10a7f254493181d33f044ed1c --- /dev/null +++ b/.local/lib/python3.10/site-packages/filelock-3.9.0.dist-info/METADATA @@ -0,0 +1,47 @@ +Metadata-Version: 2.1 +Name: filelock +Version: 3.9.0 +Summary: A platform independent file lock. +Project-URL: Documentation, https://py-filelock.readthedocs.io +Project-URL: Homepage, https://github.com/tox-dev/py-filelock +Project-URL: Source, https://github.com/tox-dev/py-filelock +Project-URL: Tracker, https://github.com/tox-dev/py-filelock/issues +Maintainer-email: Bernát Gábor +License-File: LICENSE +Keywords: application,cache,directory,log,user +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: The Unlicense (Unlicense) +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3 :: Only +Classifier: Topic :: Internet +Classifier: Topic :: Software Development :: Libraries +Classifier: Topic :: System +Requires-Python: >=3.7 +Provides-Extra: docs +Requires-Dist: furo>=2022.12.7; extra == 'docs' +Requires-Dist: sphinx-autodoc-typehints>=1.19.5; extra == 'docs' +Requires-Dist: sphinx>=5.3; extra == 'docs' +Provides-Extra: testing +Requires-Dist: covdefaults>=2.2.2; extra == 'testing' +Requires-Dist: coverage>=7.0.1; extra == 'testing' +Requires-Dist: pytest-cov>=4; extra == 'testing' +Requires-Dist: pytest-timeout>=2.1; extra == 'testing' +Requires-Dist: pytest>=7.2; extra == 'testing' +Description-Content-Type: text/markdown + +# py-filelock + +[![PyPI](https://img.shields.io/pypi/v/filelock)](https://pypi.org/project/filelock/) +[![Supported Python +versions](https://img.shields.io/pypi/pyversions/filelock.svg)](https://pypi.org/project/filelock/) +[![Documentation +status](https://readthedocs.org/projects/py-filelock/badge/?version=latest)](https://py-filelock.readthedocs.io/en/latest/?badge=latest) +[![Code style: +black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) +[![Downloads](https://pepy.tech/badge/filelock/month)](https://pepy.tech/project/filelock/month) +[![check](https://github.com/tox-dev/py-filelock/actions/workflows/check.yml/badge.svg)](https://github.com/tox-dev/py-filelock/actions/workflows/check.yml) + +For more information checkout the [official documentation](https://py-filelock.readthedocs.io/en/latest/index.html). diff --git a/.local/lib/python3.10/site-packages/filelock-3.9.0.dist-info/RECORD b/.local/lib/python3.10/site-packages/filelock-3.9.0.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..1c923afcad8300ee4564003a4e0d261d8551ad26 --- /dev/null +++ b/.local/lib/python3.10/site-packages/filelock-3.9.0.dist-info/RECORD @@ -0,0 +1,22 @@ +filelock-3.9.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +filelock-3.9.0.dist-info/METADATA,sha256=4g57vwoD4oLdGUZ7sWFBzuGgrRw49BTQNHVm2GchOr8,2329 +filelock-3.9.0.dist-info/RECORD,, +filelock-3.9.0.dist-info/WHEEL,sha256=NaLmgHHW_f9jTvv_wRh9vcK7c7EK9o5fwsIXMOzoGgM,87 +filelock-3.9.0.dist-info/licenses/LICENSE,sha256=iNm062BXnBkew5HKBMFhMFctfu3EqG2qWL8oxuFMm80,1210 +filelock/__init__.py,sha256=faxkZA3vcouNv9jkORSXWkjoSqO1oPsyi6_izCgE8Tw,1315 +filelock/__pycache__/__init__.cpython-310.pyc,, +filelock/__pycache__/_api.cpython-310.pyc,, +filelock/__pycache__/_error.cpython-310.pyc,, +filelock/__pycache__/_soft.cpython-310.pyc,, +filelock/__pycache__/_unix.cpython-310.pyc,, +filelock/__pycache__/_util.cpython-310.pyc,, +filelock/__pycache__/_windows.cpython-310.pyc,, +filelock/__pycache__/version.cpython-310.pyc,, +filelock/_api.py,sha256=n66L3nFuqMCa-WRflz2oz-24q30aXVyBZ1_mhh-GBIs,8896 +filelock/_error.py,sha256=Gaxp2TfdmgdvYFkllGCBOE37vYIXnHKKW3RYfKH7DYM,399 +filelock/_soft.py,sha256=rSpmt4Oi0Eb4JeKzyWImeqf5MYCJR0Dyc_kUN3kHj7Y,1650 +filelock/_unix.py,sha256=gM4-5mqDtamGp5qwWkaZNSTuv9p7vwBa4diVmI1ZBwQ,1578 +filelock/_util.py,sha256=BZKOAYTQdmcHmF34-Ft4kMdEvk3a8NGtsAhe6kfxZuU,594 +filelock/_windows.py,sha256=wvg-_SfJEDyxDeDVH8wBqxbPquXaycoYXgXJOBmm-G4,1890 +filelock/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +filelock/version.py,sha256=dcWkZ8mPGAgApojINeseg-iJIp1hYz0eDxjT8AZ_6KY,160 diff --git a/.local/lib/python3.10/site-packages/filelock-3.9.0.dist-info/WHEEL b/.local/lib/python3.10/site-packages/filelock-3.9.0.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..6d803659b75f74a2396884b98634329099146ede --- /dev/null +++ b/.local/lib/python3.10/site-packages/filelock-3.9.0.dist-info/WHEEL @@ -0,0 +1,4 @@ +Wheel-Version: 1.0 +Generator: hatchling 1.11.1 +Root-Is-Purelib: true +Tag: py3-none-any diff --git a/.local/lib/python3.10/site-packages/filelock-3.9.0.dist-info/licenses/LICENSE b/.local/lib/python3.10/site-packages/filelock-3.9.0.dist-info/licenses/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..cf1ab25da0349f84a3fdd40032f0ce99db813b8b --- /dev/null +++ b/.local/lib/python3.10/site-packages/filelock-3.9.0.dist-info/licenses/LICENSE @@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +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 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. + +For more information, please refer to diff --git a/.local/lib/python3.10/site-packages/filelock/__init__.py b/.local/lib/python3.10/site-packages/filelock/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..36fe7e4395ebaef2b0dafd9a6c67460f9f5738c7 --- /dev/null +++ b/.local/lib/python3.10/site-packages/filelock/__init__.py @@ -0,0 +1,52 @@ +""" +A platform independent file lock that supports the with-statement. + +.. autodata:: filelock.__version__ + :no-value: + +""" +from __future__ import annotations + +import sys +import warnings +from typing import TYPE_CHECKING + +from ._api import AcquireReturnProxy, BaseFileLock +from ._error import Timeout +from ._soft import SoftFileLock +from ._unix import UnixFileLock, has_fcntl +from ._windows import WindowsFileLock +from .version import version + +#: version of the project as a string +__version__: str = version + + +if sys.platform == "win32": # pragma: win32 cover + _FileLock: type[BaseFileLock] = WindowsFileLock +else: # pragma: win32 no cover + if has_fcntl: + _FileLock: type[BaseFileLock] = UnixFileLock + else: + _FileLock = SoftFileLock + if warnings is not None: + warnings.warn("only soft file lock is available") + +#: Alias for the lock, which should be used for the current platform. On Windows, this is an alias for +# :class:`WindowsFileLock`, on Unix for :class:`UnixFileLock` and otherwise for :class:`SoftFileLock`. +if TYPE_CHECKING: + FileLock = SoftFileLock +else: + FileLock = _FileLock + + +__all__ = [ + "__version__", + "FileLock", + "SoftFileLock", + "Timeout", + "UnixFileLock", + "WindowsFileLock", + "BaseFileLock", + "AcquireReturnProxy", +] diff --git a/.local/lib/python3.10/site-packages/filelock/__pycache__/__init__.cpython-310.pyc b/.local/lib/python3.10/site-packages/filelock/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..635a370e73cc32329e85033b3a5d9d903de60b6b Binary files /dev/null and b/.local/lib/python3.10/site-packages/filelock/__pycache__/__init__.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/filelock/__pycache__/_api.cpython-310.pyc b/.local/lib/python3.10/site-packages/filelock/__pycache__/_api.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ec833e7c73df78d33e310e08f909abbcc6790844 Binary files /dev/null and b/.local/lib/python3.10/site-packages/filelock/__pycache__/_api.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/filelock/__pycache__/_error.cpython-310.pyc b/.local/lib/python3.10/site-packages/filelock/__pycache__/_error.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3d6941fb30f39d5e434b3c36014dda3bef13c79f Binary files /dev/null and b/.local/lib/python3.10/site-packages/filelock/__pycache__/_error.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/filelock/__pycache__/_soft.cpython-310.pyc b/.local/lib/python3.10/site-packages/filelock/__pycache__/_soft.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..43f1ac6bd585eb0a29179aa2bab6fd7c59e47bbb Binary files /dev/null and b/.local/lib/python3.10/site-packages/filelock/__pycache__/_soft.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/filelock/__pycache__/_unix.cpython-310.pyc b/.local/lib/python3.10/site-packages/filelock/__pycache__/_unix.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8ac41c2e747ef1c6f6a0d8b8f923d51a5f570a2e Binary files /dev/null and b/.local/lib/python3.10/site-packages/filelock/__pycache__/_unix.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/filelock/__pycache__/_util.cpython-310.pyc b/.local/lib/python3.10/site-packages/filelock/__pycache__/_util.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f1ffb5583488c8787b4f011d388d3159fe00f967 Binary files /dev/null and b/.local/lib/python3.10/site-packages/filelock/__pycache__/_util.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/filelock/__pycache__/_windows.cpython-310.pyc b/.local/lib/python3.10/site-packages/filelock/__pycache__/_windows.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4c61b679f8bf7fed12eff8c0f8b4adb573b14e45 Binary files /dev/null and b/.local/lib/python3.10/site-packages/filelock/__pycache__/_windows.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/filelock/__pycache__/version.cpython-310.pyc b/.local/lib/python3.10/site-packages/filelock/__pycache__/version.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8d14b1575104c1c287c16496988e1a382e6bbe0a Binary files /dev/null and b/.local/lib/python3.10/site-packages/filelock/__pycache__/version.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/filelock/_api.py b/.local/lib/python3.10/site-packages/filelock/_api.py new file mode 100644 index 0000000000000000000000000000000000000000..273b82e6f54867291d3cc28870003a16e07c1ef7 --- /dev/null +++ b/.local/lib/python3.10/site-packages/filelock/_api.py @@ -0,0 +1,246 @@ +from __future__ import annotations + +import contextlib +import logging +import os +import time +import warnings +from abc import ABC, abstractmethod +from threading import Lock +from types import TracebackType +from typing import Any + +from ._error import Timeout + +_LOGGER = logging.getLogger("filelock") + + +# This is a helper class which is returned by :meth:`BaseFileLock.acquire` and wraps the lock to make sure __enter__ +# is not called twice when entering the with statement. If we would simply return *self*, the lock would be acquired +# again in the *__enter__* method of the BaseFileLock, but not released again automatically. issue #37 (memory leak) +class AcquireReturnProxy: + """A context aware object that will release the lock file when exiting.""" + + def __init__(self, lock: BaseFileLock) -> None: + self.lock = lock + + def __enter__(self) -> BaseFileLock: + return self.lock + + def __exit__( + self, + exc_type: type[BaseException] | None, # noqa: U100 + exc_value: BaseException | None, # noqa: U100 + traceback: TracebackType | None, # noqa: U100 + ) -> None: + self.lock.release() + + +class BaseFileLock(ABC, contextlib.ContextDecorator): + """Abstract base class for a file lock object.""" + + def __init__(self, lock_file: str | os.PathLike[Any], timeout: float = -1) -> None: + """ + Create a new lock object. + + :param lock_file: path to the file + :param timeout: default timeout when acquiring the lock, in seconds. It will be used as fallback value in + the acquire method, if no timeout value (``None``) is given. If you want to disable the timeout, set it + to a negative value. A timeout of 0 means, that there is exactly one attempt to acquire the file lock. + """ + # The path to the lock file. + self._lock_file: str = os.fspath(lock_file) + + # The file descriptor for the *_lock_file* as it is returned by the os.open() function. + # This file lock is only NOT None, if the object currently holds the lock. + self._lock_file_fd: int | None = None + + # The default timeout value. + self._timeout: float = timeout + + # We use this lock primarily for the lock counter. + self._thread_lock: Lock = Lock() + + # The lock counter is used for implementing the nested locking mechanism. Whenever the lock is acquired, the + # counter is increased and the lock is only released, when this value is 0 again. + self._lock_counter: int = 0 + + @property + def lock_file(self) -> str: + """:return: path to the lock file""" + return self._lock_file + + @property + def timeout(self) -> float: + """ + :return: the default timeout value, in seconds + + .. versionadded:: 2.0.0 + """ + return self._timeout + + @timeout.setter + def timeout(self, value: float | str) -> None: + """ + Change the default timeout value. + + :param value: the new value, in seconds + """ + self._timeout = float(value) + + @abstractmethod + def _acquire(self) -> None: + """If the file lock could be acquired, self._lock_file_fd holds the file descriptor of the lock file.""" + raise NotImplementedError + + @abstractmethod + def _release(self) -> None: + """Releases the lock and sets self._lock_file_fd to None.""" + raise NotImplementedError + + @property + def is_locked(self) -> bool: + """ + + :return: A boolean indicating if the lock file is holding the lock currently. + + .. versionchanged:: 2.0.0 + + This was previously a method and is now a property. + """ + return self._lock_file_fd is not None + + def acquire( + self, + timeout: float | None = None, + poll_interval: float = 0.05, + *, + poll_intervall: float | None = None, + blocking: bool = True, + ) -> AcquireReturnProxy: + """ + Try to acquire the file lock. + + :param timeout: maximum wait time for acquiring the lock, ``None`` means use the default :attr:`~timeout` is and + if ``timeout < 0``, there is no timeout and this method will block until the lock could be acquired + :param poll_interval: interval of trying to acquire the lock file + :param poll_intervall: deprecated, kept for backwards compatibility, use ``poll_interval`` instead + :param blocking: defaults to True. If False, function will return immediately if it cannot obtain a lock on the + first attempt. Otherwise this method will block until the timeout expires or the lock is acquired. + :raises Timeout: if fails to acquire lock within the timeout period + :return: a context object that will unlock the file when the context is exited + + .. code-block:: python + + # You can use this method in the context manager (recommended) + with lock.acquire(): + pass + + # Or use an equivalent try-finally construct: + lock.acquire() + try: + pass + finally: + lock.release() + + .. versionchanged:: 2.0.0 + + This method returns now a *proxy* object instead of *self*, + so that it can be used in a with statement without side effects. + + """ + # Use the default timeout, if no timeout is provided. + if timeout is None: + timeout = self.timeout + + if poll_intervall is not None: + msg = "use poll_interval instead of poll_intervall" + warnings.warn(msg, DeprecationWarning, stacklevel=2) + poll_interval = poll_intervall + + # Increment the number right at the beginning. We can still undo it, if something fails. + with self._thread_lock: + self._lock_counter += 1 + + lock_id = id(self) + lock_filename = self._lock_file + start_time = time.monotonic() + try: + while True: + with self._thread_lock: + if not self.is_locked: + _LOGGER.debug("Attempting to acquire lock %s on %s", lock_id, lock_filename) + self._acquire() + + if self.is_locked: + _LOGGER.debug("Lock %s acquired on %s", lock_id, lock_filename) + break + elif blocking is False: + _LOGGER.debug("Failed to immediately acquire lock %s on %s", lock_id, lock_filename) + raise Timeout(self._lock_file) + elif 0 <= timeout < time.monotonic() - start_time: + _LOGGER.debug("Timeout on acquiring lock %s on %s", lock_id, lock_filename) + raise Timeout(self._lock_file) + else: + msg = "Lock %s not acquired on %s, waiting %s seconds ..." + _LOGGER.debug(msg, lock_id, lock_filename, poll_interval) + time.sleep(poll_interval) + except BaseException: # Something did go wrong, so decrement the counter. + with self._thread_lock: + self._lock_counter = max(0, self._lock_counter - 1) + raise + return AcquireReturnProxy(lock=self) + + def release(self, force: bool = False) -> None: + """ + Releases the file lock. Please note, that the lock is only completely released, if the lock counter is 0. Also + note, that the lock file itself is not automatically deleted. + + :param force: If true, the lock counter is ignored and the lock is released in every case/ + """ + with self._thread_lock: + + if self.is_locked: + self._lock_counter -= 1 + + if self._lock_counter == 0 or force: + lock_id, lock_filename = id(self), self._lock_file + + _LOGGER.debug("Attempting to release lock %s on %s", lock_id, lock_filename) + self._release() + self._lock_counter = 0 + _LOGGER.debug("Lock %s released on %s", lock_id, lock_filename) + + def __enter__(self) -> BaseFileLock: + """ + Acquire the lock. + + :return: the lock object + """ + self.acquire() + return self + + def __exit__( + self, + exc_type: type[BaseException] | None, # noqa: U100 + exc_value: BaseException | None, # noqa: U100 + traceback: TracebackType | None, # noqa: U100 + ) -> None: + """ + Release the lock. + + :param exc_type: the exception type if raised + :param exc_value: the exception value if raised + :param traceback: the exception traceback if raised + """ + self.release() + + def __del__(self) -> None: + """Called when the lock object is deleted.""" + self.release(force=True) + + +__all__ = [ + "BaseFileLock", + "AcquireReturnProxy", +] diff --git a/.local/lib/python3.10/site-packages/filelock/_error.py b/.local/lib/python3.10/site-packages/filelock/_error.py new file mode 100644 index 0000000000000000000000000000000000000000..b3885214df6b5c66c46adf153fa4290498f2fc35 --- /dev/null +++ b/.local/lib/python3.10/site-packages/filelock/_error.py @@ -0,0 +1,17 @@ +from __future__ import annotations + + +class Timeout(TimeoutError): + """Raised when the lock could not be acquired in *timeout* seconds.""" + + def __init__(self, lock_file: str) -> None: + #: The path of the file lock. + self.lock_file = lock_file + + def __str__(self) -> str: + return f"The file lock '{self.lock_file}' could not be acquired." + + +__all__ = [ + "Timeout", +] diff --git a/.local/lib/python3.10/site-packages/filelock/_soft.py b/.local/lib/python3.10/site-packages/filelock/_soft.py new file mode 100644 index 0000000000000000000000000000000000000000..cb09799ade656c4f49fd9c9e0157726a17a48096 --- /dev/null +++ b/.local/lib/python3.10/site-packages/filelock/_soft.py @@ -0,0 +1,47 @@ +from __future__ import annotations + +import os +import sys +from errno import EACCES, EEXIST, ENOENT + +from ._api import BaseFileLock +from ._util import raise_on_exist_ro_file + + +class SoftFileLock(BaseFileLock): + """Simply watches the existence of the lock file.""" + + def _acquire(self) -> None: + raise_on_exist_ro_file(self._lock_file) + # first check for exists and read-only mode as the open will mask this case as EEXIST + mode = ( + os.O_WRONLY # open for writing only + | os.O_CREAT + | os.O_EXCL # together with above raise EEXIST if the file specified by filename exists + | os.O_TRUNC # truncate the file to zero byte + ) + try: + fd = os.open(self._lock_file, mode) + except OSError as exception: + if exception.errno == EEXIST: # expected if cannot lock + pass + elif exception.errno == ENOENT: # No such file or directory - parent directory is missing + raise + elif exception.errno == EACCES and sys.platform != "win32": # pragma: win32 no cover + # Permission denied - parent dir is R/O + raise # note windows does not allow you to make a folder r/o only files + else: + self._lock_file_fd = fd + + def _release(self) -> None: + os.close(self._lock_file_fd) # type: ignore # the lock file is definitely not None + self._lock_file_fd = None + try: + os.remove(self._lock_file) + except OSError: # the file is already deleted and that's what we want + pass + + +__all__ = [ + "SoftFileLock", +] diff --git a/.local/lib/python3.10/site-packages/filelock/_unix.py b/.local/lib/python3.10/site-packages/filelock/_unix.py new file mode 100644 index 0000000000000000000000000000000000000000..03b612c92139efec11272b04faff59d980118da7 --- /dev/null +++ b/.local/lib/python3.10/site-packages/filelock/_unix.py @@ -0,0 +1,56 @@ +from __future__ import annotations + +import os +import sys +from typing import cast + +from ._api import BaseFileLock + +#: a flag to indicate if the fcntl API is available +has_fcntl = False +if sys.platform == "win32": # pragma: win32 cover + + class UnixFileLock(BaseFileLock): + """Uses the :func:`fcntl.flock` to hard lock the lock file on unix systems.""" + + def _acquire(self) -> None: + raise NotImplementedError + + def _release(self) -> None: + raise NotImplementedError + +else: # pragma: win32 no cover + try: + import fcntl + except ImportError: + pass + else: + has_fcntl = True + + class UnixFileLock(BaseFileLock): + """Uses the :func:`fcntl.flock` to hard lock the lock file on unix systems.""" + + def _acquire(self) -> None: + open_mode = os.O_RDWR | os.O_CREAT | os.O_TRUNC + fd = os.open(self._lock_file, open_mode) + try: + fcntl.flock(fd, fcntl.LOCK_EX | fcntl.LOCK_NB) + except OSError: + os.close(fd) + else: + self._lock_file_fd = fd + + def _release(self) -> None: + # Do not remove the lockfile: + # https://github.com/tox-dev/py-filelock/issues/31 + # https://stackoverflow.com/questions/17708885/flock-removing-locked-file-without-race-condition + fd = cast(int, self._lock_file_fd) + self._lock_file_fd = None + fcntl.flock(fd, fcntl.LOCK_UN) + os.close(fd) + + +__all__ = [ + "has_fcntl", + "UnixFileLock", +] diff --git a/.local/lib/python3.10/site-packages/filelock/_util.py b/.local/lib/python3.10/site-packages/filelock/_util.py new file mode 100644 index 0000000000000000000000000000000000000000..238b80fa1b596f1e8af9bb36ff9a16e310a5f259 --- /dev/null +++ b/.local/lib/python3.10/site-packages/filelock/_util.py @@ -0,0 +1,20 @@ +from __future__ import annotations + +import os +import stat + + +def raise_on_exist_ro_file(filename: str) -> None: + try: + file_stat = os.stat(filename) # use stat to do exists + can write to check without race condition + except OSError: + return None # swallow does not exist or other errors + + if file_stat.st_mtime != 0: # if os.stat returns but modification is zero that's an invalid os.stat - ignore it + if not (file_stat.st_mode & stat.S_IWUSR): + raise PermissionError(f"Permission denied: {filename!r}") + + +__all__ = [ + "raise_on_exist_ro_file", +] diff --git a/.local/lib/python3.10/site-packages/filelock/_windows.py b/.local/lib/python3.10/site-packages/filelock/_windows.py new file mode 100644 index 0000000000000000000000000000000000000000..60e68cb9b677b5773ec69c827ab884d29b843df2 --- /dev/null +++ b/.local/lib/python3.10/site-packages/filelock/_windows.py @@ -0,0 +1,63 @@ +from __future__ import annotations + +import os +import sys +from errno import ENOENT +from typing import cast + +from ._api import BaseFileLock +from ._util import raise_on_exist_ro_file + +if sys.platform == "win32": # pragma: win32 cover + import msvcrt + + class WindowsFileLock(BaseFileLock): + """Uses the :func:`msvcrt.locking` function to hard lock the lock file on windows systems.""" + + def _acquire(self) -> None: + raise_on_exist_ro_file(self._lock_file) + mode = ( + os.O_RDWR # open for read and write + | os.O_CREAT # create file if not exists + | os.O_TRUNC # truncate file if not empty + ) + try: + fd = os.open(self._lock_file, mode) + except OSError as exception: + if exception.errno == ENOENT: # No such file or directory + raise + else: + try: + msvcrt.locking(fd, msvcrt.LK_NBLCK, 1) + except OSError: + os.close(fd) + else: + self._lock_file_fd = fd + + def _release(self) -> None: + fd = cast(int, self._lock_file_fd) + self._lock_file_fd = None + msvcrt.locking(fd, msvcrt.LK_UNLCK, 1) + os.close(fd) + + try: + os.remove(self._lock_file) + # Probably another instance of the application hat acquired the file lock. + except OSError: + pass + +else: # pragma: win32 no cover + + class WindowsFileLock(BaseFileLock): + """Uses the :func:`msvcrt.locking` function to hard lock the lock file on windows systems.""" + + def _acquire(self) -> None: + raise NotImplementedError + + def _release(self) -> None: + raise NotImplementedError + + +__all__ = [ + "WindowsFileLock", +] diff --git a/.local/lib/python3.10/site-packages/filelock/py.typed b/.local/lib/python3.10/site-packages/filelock/py.typed new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/.local/lib/python3.10/site-packages/filelock/version.py b/.local/lib/python3.10/site-packages/filelock/version.py new file mode 100644 index 0000000000000000000000000000000000000000..6477018ea2d438778d8816c7935f3569ec7b2eb8 --- /dev/null +++ b/.local/lib/python3.10/site-packages/filelock/version.py @@ -0,0 +1,4 @@ +# file generated by setuptools_scm +# don't change, don't track in version control +__version__ = version = '3.9.0' +__version_tuple__ = version_tuple = (3, 9, 0) diff --git a/.local/lib/python3.10/site-packages/huggingface_hub-0.11.1.dist-info/INSTALLER b/.local/lib/python3.10/site-packages/huggingface_hub-0.11.1.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub-0.11.1.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/.local/lib/python3.10/site-packages/huggingface_hub-0.11.1.dist-info/LICENSE b/.local/lib/python3.10/site-packages/huggingface_hub-0.11.1.dist-info/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..261eeb9e9f8b2b4b0d119366dda99c6fd7d35c64 --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub-0.11.1.dist-info/LICENSE @@ -0,0 +1,201 @@ + 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/.local/lib/python3.10/site-packages/huggingface_hub-0.11.1.dist-info/METADATA b/.local/lib/python3.10/site-packages/huggingface_hub-0.11.1.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..cfc4364e7e19eda14c968e0e63d89f4cb9f9c8d6 --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub-0.11.1.dist-info/METADATA @@ -0,0 +1,150 @@ +Metadata-Version: 2.1 +Name: huggingface-hub +Version: 0.11.1 +Summary: Client library to download and publish models, datasets and other repos on the huggingface.co hub +Home-page: https://github.com/huggingface/huggingface_hub +Author: Hugging Face, Inc. +Author-email: julien@huggingface.co +License: Apache +Keywords: model-hub machine-learning models natural-language-processing deep-learning pytorch pretrained-models +Platform: UNKNOWN +Classifier: Intended Audience :: Developers +Classifier: Intended Audience :: Education +Classifier: Intended Audience :: Science/Research +Classifier: License :: OSI Approved :: Apache Software License +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3 :: Only +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence +Requires-Python: >=3.7.0 +Description-Content-Type: text/markdown +License-File: LICENSE +Requires-Dist: filelock +Requires-Dist: requests +Requires-Dist: tqdm +Requires-Dist: pyyaml (>=5.1) +Requires-Dist: typing-extensions (>=3.7.4.3) +Requires-Dist: packaging (>=20.9) +Requires-Dist: importlib-metadata ; python_version < "3.8" +Provides-Extra: all +Requires-Dist: InquirerPy (==0.3.4) ; extra == 'all' +Requires-Dist: isort (>=5.5.4) ; extra == 'all' +Requires-Dist: jedi ; extra == 'all' +Requires-Dist: Jinja2 ; extra == 'all' +Requires-Dist: pytest ; extra == 'all' +Requires-Dist: pytest-cov ; extra == 'all' +Requires-Dist: pytest-env ; extra == 'all' +Requires-Dist: soundfile ; extra == 'all' +Requires-Dist: black (==22.3) ; extra == 'all' +Requires-Dist: flake8 (>=3.8.3) ; extra == 'all' +Requires-Dist: flake8-bugbear ; extra == 'all' +Requires-Dist: mypy (==0.982) ; extra == 'all' +Requires-Dist: types-PyYAML ; extra == 'all' +Requires-Dist: types-requests ; extra == 'all' +Requires-Dist: types-simplejson ; extra == 'all' +Requires-Dist: types-toml ; extra == 'all' +Requires-Dist: types-tqdm ; extra == 'all' +Requires-Dist: types-urllib3 ; extra == 'all' +Provides-Extra: cli +Requires-Dist: InquirerPy (==0.3.4) ; extra == 'cli' +Provides-Extra: dev +Requires-Dist: InquirerPy (==0.3.4) ; extra == 'dev' +Requires-Dist: isort (>=5.5.4) ; extra == 'dev' +Requires-Dist: jedi ; extra == 'dev' +Requires-Dist: Jinja2 ; extra == 'dev' +Requires-Dist: pytest ; extra == 'dev' +Requires-Dist: pytest-cov ; extra == 'dev' +Requires-Dist: pytest-env ; extra == 'dev' +Requires-Dist: soundfile ; extra == 'dev' +Requires-Dist: black (==22.3) ; extra == 'dev' +Requires-Dist: flake8 (>=3.8.3) ; extra == 'dev' +Requires-Dist: flake8-bugbear ; extra == 'dev' +Requires-Dist: mypy (==0.982) ; extra == 'dev' +Requires-Dist: types-PyYAML ; extra == 'dev' +Requires-Dist: types-requests ; extra == 'dev' +Requires-Dist: types-simplejson ; extra == 'dev' +Requires-Dist: types-toml ; extra == 'dev' +Requires-Dist: types-tqdm ; extra == 'dev' +Requires-Dist: types-urllib3 ; extra == 'dev' +Provides-Extra: fastai +Requires-Dist: toml ; extra == 'fastai' +Requires-Dist: fastai (>=2.4) ; extra == 'fastai' +Requires-Dist: fastcore (>=1.3.27) ; extra == 'fastai' +Provides-Extra: quality +Requires-Dist: black (==22.3) ; extra == 'quality' +Requires-Dist: flake8 (>=3.8.3) ; extra == 'quality' +Requires-Dist: flake8-bugbear ; extra == 'quality' +Requires-Dist: isort (>=5.5.4) ; extra == 'quality' +Requires-Dist: mypy (==0.982) ; extra == 'quality' +Provides-Extra: tensorflow +Requires-Dist: tensorflow ; extra == 'tensorflow' +Requires-Dist: pydot ; extra == 'tensorflow' +Requires-Dist: graphviz ; extra == 'tensorflow' +Provides-Extra: testing +Requires-Dist: InquirerPy (==0.3.4) ; extra == 'testing' +Requires-Dist: isort (>=5.5.4) ; extra == 'testing' +Requires-Dist: jedi ; extra == 'testing' +Requires-Dist: Jinja2 ; extra == 'testing' +Requires-Dist: pytest ; extra == 'testing' +Requires-Dist: pytest-cov ; extra == 'testing' +Requires-Dist: pytest-env ; extra == 'testing' +Requires-Dist: soundfile ; extra == 'testing' +Provides-Extra: torch +Requires-Dist: torch ; extra == 'torch' +Provides-Extra: typing +Requires-Dist: types-PyYAML ; extra == 'typing' +Requires-Dist: types-requests ; extra == 'typing' +Requires-Dist: types-simplejson ; extra == 'typing' +Requires-Dist: types-toml ; extra == 'typing' +Requires-Dist: types-tqdm ; extra == 'typing' +Requires-Dist: types-urllib3 ; extra == 'typing' + +# `huggingface_hub` + +Code style: black +Code coverage +GitHub release +Documentation +Documentation + +## Welcome to the huggingface_hub library + + +The `huggingface_hub` is a client library to interact with the Hugging Face Hub. The Hugging Face Hub is a platform with over 35K models, 4K datasets, and 2K demos in which people can easily collaborate in their ML workflows. The Hub works as a central place where anyone can share, explore, discover, and experiment with open-source Machine Learning. + +With `huggingface_hub`, you can easily download and upload models, datasets, and Spaces. You can extract useful information from the Hub, and do much more. Some example use cases: +* Downloading and caching files from a Hub repository. +* Creating repositories and uploading an updated model every few epochs. +* Extract metadata from all models that match certain criteria (e.g. models for `text-classification`). +* List all files from a specific repository. + +Read all about it in [the library documentation](https://huggingface.co/docs/huggingface_hub). + +
+ +## Integrating to the Hub. + +We're partnering with cool open source ML libraries to provide free model hosting and versioning. You can find the existing integrations [here](https://huggingface.co/docs/hub/libraries). + +The advantages are: + +- Free model or dataset hosting for libraries and their users. +- Built-in file versioning, even with very large files, thanks to a git-based approach. +- Hosted inference API for all models publicly available. +- In-browser widgets to play with the uploaded models. +- Anyone can upload a new model for your library, they just need to add the corresponding tag for the model to be discoverable. +- Fast downloads! We use Cloudfront (a CDN) to geo-replicate downloads so they're blazing fast from anywhere on the globe. +- Usage stats and more features to come. + +If you would like to integrate your library, feel free to open an issue to begin the discussion. We wrote a [step-by-step guide](https://huggingface.co/docs/hub/adding-a-library) with ❤️ showing how to do this integration. + +
+ +## Feedback (feature requests, bugs, etc.) is super welcome 💙💚💛💜♥️🧡 + + diff --git a/.local/lib/python3.10/site-packages/huggingface_hub-0.11.1.dist-info/RECORD b/.local/lib/python3.10/site-packages/huggingface_hub-0.11.1.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..edb1c92ef7770644bb187dfe94ac4e8f198037e9 --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub-0.11.1.dist-info/RECORD @@ -0,0 +1,104 @@ +../../../bin/huggingface-cli,sha256=aXlt11P-78xiRjfit2L9n0dpqrWW43A5Mewo9B4aVF8,239 +huggingface_hub-0.11.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +huggingface_hub-0.11.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357 +huggingface_hub-0.11.1.dist-info/METADATA,sha256=YOfvPvlo4R2BqVbg2iN2Y9WTJllu3mLhqIADtfiGuPA,7548 +huggingface_hub-0.11.1.dist-info/RECORD,, +huggingface_hub-0.11.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +huggingface_hub-0.11.1.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92 +huggingface_hub-0.11.1.dist-info/entry_points.txt,sha256=7-_O79Kk26OM9R3QgywVzfyrNjZ3F8tCUhDtozJ7yIc,83 +huggingface_hub-0.11.1.dist-info/top_level.txt,sha256=8KzlQJAY4miUvjAssOAJodqKOw3harNzuiwGQ9qLSSk,16 +huggingface_hub/__init__.py,sha256=7HzsQzNuKGT5LrSQC8KdcyA9R6AwaK1YYfS-559JISE,14466 +huggingface_hub/__pycache__/__init__.cpython-310.pyc,, +huggingface_hub/__pycache__/_commit_api.cpython-310.pyc,, +huggingface_hub/__pycache__/_login.cpython-310.pyc,, +huggingface_hub/__pycache__/_snapshot_download.cpython-310.pyc,, +huggingface_hub/__pycache__/community.cpython-310.pyc,, +huggingface_hub/__pycache__/constants.cpython-310.pyc,, +huggingface_hub/__pycache__/fastai_utils.cpython-310.pyc,, +huggingface_hub/__pycache__/file_download.cpython-310.pyc,, +huggingface_hub/__pycache__/hf_api.cpython-310.pyc,, +huggingface_hub/__pycache__/hub_mixin.cpython-310.pyc,, +huggingface_hub/__pycache__/inference_api.cpython-310.pyc,, +huggingface_hub/__pycache__/keras_mixin.cpython-310.pyc,, +huggingface_hub/__pycache__/lfs.cpython-310.pyc,, +huggingface_hub/__pycache__/repocard.cpython-310.pyc,, +huggingface_hub/__pycache__/repocard_data.cpython-310.pyc,, +huggingface_hub/__pycache__/repository.cpython-310.pyc,, +huggingface_hub/_commit_api.py,sha256=_cYNvQzipwIregb15NNS1Uz6Ca8K2azRyMfKCjoQZNo,21184 +huggingface_hub/_login.py,sha256=yqvq6sbOwKxcHYHv0UTMsFH8n1dmTciEWufegl1yjHY,11133 +huggingface_hub/_snapshot_download.py,sha256=EZ2gosW7oCkfoPTGAjpbq76a602y--UF96zW7kyMBFY,8104 +huggingface_hub/commands/__init__.py,sha256=AkbM2a-iGh0Vq_xAWhK3mu3uZ44km8-X5uWjKcvcrUQ,928 +huggingface_hub/commands/__pycache__/__init__.cpython-310.pyc,, +huggingface_hub/commands/__pycache__/_cli_utils.cpython-310.pyc,, +huggingface_hub/commands/__pycache__/delete_cache.cpython-310.pyc,, +huggingface_hub/commands/__pycache__/env.cpython-310.pyc,, +huggingface_hub/commands/__pycache__/huggingface_cli.cpython-310.pyc,, +huggingface_hub/commands/__pycache__/lfs.cpython-310.pyc,, +huggingface_hub/commands/__pycache__/scan_cache.cpython-310.pyc,, +huggingface_hub/commands/__pycache__/user.cpython-310.pyc,, +huggingface_hub/commands/_cli_utils.py,sha256=VA_3cHzIlsEQmKPnfNTgJNI36UtcrxRmfB44RdbP1LA,1970 +huggingface_hub/commands/delete_cache.py,sha256=qsfqOjnS1cG9_qRd2jassz08iR539uPNocbBQuiPpZ8,16392 +huggingface_hub/commands/env.py,sha256=ABSFyUnngQkVU6fFDW2oq2-2tcGKI_tC5HB-JapA9Lo,1247 +huggingface_hub/commands/huggingface_cli.py,sha256=HzT9wXbgelLTyE4xVZLV9wLkRhge-QNThZpv8rWYQmU,1706 +huggingface_hub/commands/lfs.py,sha256=dCBs4Ho7-ifkS1LD79T2v5AGFw1qK5Kn6yxJYsaK17o,7384 +huggingface_hub/commands/scan_cache.py,sha256=VpcSpr9Rgj75psfIH2wiV0QV0zooCuElqzBjvqc2G1w,5387 +huggingface_hub/commands/user.py,sha256=VfHxIv4FWz8eA4Z7o3ZHytTGTzHts7wRvee_NK9fRBw,7071 +huggingface_hub/community.py,sha256=aDQnAAF7KwtcY7RsyZ2mOuP3HhYmS6MLTtNKJRl9O8k,11059 +huggingface_hub/constants.py,sha256=_n4eBibnxZ4zHB3_jCeQPa4Tizo_6qeoQRRycSeOivQ,3458 +huggingface_hub/fastai_utils.py,sha256=lGCRAlA6ZGoKhiY_Gdonza90EYrkZ3NTvyvJkiJ7c5Y,17463 +huggingface_hub/file_download.py,sha256=y7CTf6wAUEqX18HPlO7rWh1YKiHdLOKAidJibBnVcHo,55879 +huggingface_hub/hf_api.py,sha256=2kBd9gytb03-DT-rlsVYrsFhxRm8pdfKy8akuaQIkMk,134259 +huggingface_hub/hub_mixin.py,sha256=uMEdbqDmRE4URKEYLSoTK3lCgWEk3Z2EC6d5HXBYyKA,19299 +huggingface_hub/inference_api.py,sha256=vOMIHT0Gjf0Mf0KUHrvM9gf78wPeX1zKsaEl4pg2trA,5658 +huggingface_hub/keras_mixin.py,sha256=Dy4qxJrgPnL3iP7ooTSP8iPy7mVAXDboQnXTaIQG1jg,23413 +huggingface_hub/lfs.py,sha256=DLMquBZr2anrSl5tS4uqcOhKrIIMVrdB1ujQAl5J310,16185 +huggingface_hub/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +huggingface_hub/repocard.py,sha256=s9MkKCdN_maqfEobc6VsY--wHcvMy9CWvdCX7iCvER0,33764 +huggingface_hub/repocard_data.py,sha256=q4Sa5ft-ONMCFPJViRCqHNyk7p3anqmH8_uVTgePMi4,23775 +huggingface_hub/repository.py,sha256=88hrcHwA61VxQWclbdV0_EEC16dZtNPpvyUDvmvB7wc,57104 +huggingface_hub/templates/datasetcard_template.md,sha256=dl9YyYvK7RMMy4C8z0MWpa4Fmq7h6SiG-urHBYV3mck,3645 +huggingface_hub/templates/modelcard_template.md,sha256=2-w3qLeYdqCoBmBOBfUd-IOX4-rdnVY4QmuP_BckwAc,6824 +huggingface_hub/utils/__init__.py,sha256=CRDlVMNYdRL48_v54CVR14KmZ9XlNklv6qezs2xrRcw,2446 +huggingface_hub/utils/__pycache__/__init__.cpython-310.pyc,, +huggingface_hub/utils/__pycache__/_cache_assets.cpython-310.pyc,, +huggingface_hub/utils/__pycache__/_cache_manager.cpython-310.pyc,, +huggingface_hub/utils/__pycache__/_chunk_utils.cpython-310.pyc,, +huggingface_hub/utils/__pycache__/_datetime.cpython-310.pyc,, +huggingface_hub/utils/__pycache__/_deprecation.cpython-310.pyc,, +huggingface_hub/utils/__pycache__/_errors.cpython-310.pyc,, +huggingface_hub/utils/__pycache__/_fixes.cpython-310.pyc,, +huggingface_hub/utils/__pycache__/_git_credential.cpython-310.pyc,, +huggingface_hub/utils/__pycache__/_headers.cpython-310.pyc,, +huggingface_hub/utils/__pycache__/_hf_folder.cpython-310.pyc,, +huggingface_hub/utils/__pycache__/_http.cpython-310.pyc,, +huggingface_hub/utils/__pycache__/_pagination.cpython-310.pyc,, +huggingface_hub/utils/__pycache__/_paths.cpython-310.pyc,, +huggingface_hub/utils/__pycache__/_runtime.cpython-310.pyc,, +huggingface_hub/utils/__pycache__/_subprocess.cpython-310.pyc,, +huggingface_hub/utils/__pycache__/_typing.cpython-310.pyc,, +huggingface_hub/utils/__pycache__/_validators.cpython-310.pyc,, +huggingface_hub/utils/__pycache__/endpoint_helpers.cpython-310.pyc,, +huggingface_hub/utils/__pycache__/logging.cpython-310.pyc,, +huggingface_hub/utils/__pycache__/sha.cpython-310.pyc,, +huggingface_hub/utils/__pycache__/tqdm.cpython-310.pyc,, +huggingface_hub/utils/_cache_assets.py,sha256=xPg64oY-SiOM_Oyv_iDCqYFA9aU34-MZqo5hSJ2qD2I,5792 +huggingface_hub/utils/_cache_manager.py,sha256=UEndBYwZQA_NtLqcNtOmisywTBb9cMNjbuxD2fMJepU,29456 +huggingface_hub/utils/_chunk_utils.py,sha256=6VRyjiGr2bPupPl1azSUTxKuJ51wdgELipwJ2YRfH5U,2129 +huggingface_hub/utils/_datetime.py,sha256=RA92d7k3pV6JKmRXFvsofgp1oHfjMZb5Y-X0vpTIkgQ,2728 +huggingface_hub/utils/_deprecation.py,sha256=-W7m-Si9dnWNJBtOOc5nel4hm42QRTuWQM1LWdjyI7A,8404 +huggingface_hub/utils/_errors.py,sha256=ctguSP0PTjZhXvx4fpYJ5LjzODIed-YhDkslbFFfeoA,12136 +huggingface_hub/utils/_fixes.py,sha256=UaKSA2Oa7QgST147Kbbt-lOSSeDjh8oYgJrrz8h3RX8,968 +huggingface_hub/utils/_git_credential.py,sha256=IoLR9n5O5X3lxlTvrvW-dxo_59d6ViyrKbTS0NOqKyM,6887 +huggingface_hub/utils/_headers.py,sha256=WxPeXzv42tadLQNLUeF511NlR-frR2WtrVEAMPRkGzs,8734 +huggingface_hub/utils/_hf_folder.py,sha256=5ZRd0TFIveQDKQW2LKPLOhOmLjgn309Jb-uo2RiKuRE,2005 +huggingface_hub/utils/_http.py,sha256=q3yksn4IOx2sgqQUNXsap2mVwZP2lutmMAEnWTXX3B4,6533 +huggingface_hub/utils/_pagination.py,sha256=v3VUUG60VCvzd3EnGGuiFdzNjTsJWVd6Lspy_XPNSmA,2076 +huggingface_hub/utils/_paths.py,sha256=0AupDuZkweZfbVxzX1wqDz5inAI5EcN1O7oUwaYQo_8,4415 +huggingface_hub/utils/_runtime.py,sha256=-wzgxqWBRIFkLV624nQMa1fmZ7dpkQxOInyxFBvr2lc,6627 +huggingface_hub/utils/_subprocess.py,sha256=V6UfB0VIGZBlemSZCvdeJjork6LR2sFzB637lWXh68k,3979 +huggingface_hub/utils/_typing.py,sha256=-5LS6BKwb491Grqp14eoNGYGmYmJjVjQNX7p9qAFCqk,917 +huggingface_hub/utils/_validators.py,sha256=oD4KFmsO4X3xM2l_zP1WuCifLUeSFCSVeZeM5eOVVek,9514 +huggingface_hub/utils/endpoint_helpers.py,sha256=ulXR7pJCaD61gTJq6yfOULw-q18-UVYJ1up5BgeZbmU,12877 +huggingface_hub/utils/logging.py,sha256=i1UUvMuTkZPvZcz5Y9g2uJ3k2h5FOYA6yPyuLj_6R_g,4874 +huggingface_hub/utils/sha.py,sha256=3VhuhpPIIaJlbs16fixaUiXBysRzfRBeAYB_28vJ9g0,1214 +huggingface_hub/utils/tqdm.py,sha256=Bn8mOC-8fOI7CDuCxc6tgOMSuEt4IbOY4xFauuaXLos,4090 diff --git a/.local/lib/python3.10/site-packages/huggingface_hub-0.11.1.dist-info/REQUESTED b/.local/lib/python3.10/site-packages/huggingface_hub-0.11.1.dist-info/REQUESTED new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/.local/lib/python3.10/site-packages/huggingface_hub-0.11.1.dist-info/WHEEL b/.local/lib/python3.10/site-packages/huggingface_hub-0.11.1.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..57e3d840d59a650ac5bccbad5baeec47d155f0ad --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub-0.11.1.dist-info/WHEEL @@ -0,0 +1,5 @@ +Wheel-Version: 1.0 +Generator: bdist_wheel (0.38.4) +Root-Is-Purelib: true +Tag: py3-none-any + diff --git a/.local/lib/python3.10/site-packages/huggingface_hub-0.11.1.dist-info/entry_points.txt b/.local/lib/python3.10/site-packages/huggingface_hub-0.11.1.dist-info/entry_points.txt new file mode 100644 index 0000000000000000000000000000000000000000..a2d5f5e9d57e1d728aba8d2f5944829a7c47489d --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub-0.11.1.dist-info/entry_points.txt @@ -0,0 +1,3 @@ +[console_scripts] +huggingface-cli = huggingface_hub.commands.huggingface_cli:main + diff --git a/.local/lib/python3.10/site-packages/huggingface_hub-0.11.1.dist-info/top_level.txt b/.local/lib/python3.10/site-packages/huggingface_hub-0.11.1.dist-info/top_level.txt new file mode 100644 index 0000000000000000000000000000000000000000..6b964ccca3c1b6766042b3fe3b2707ba25372924 --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub-0.11.1.dist-info/top_level.txt @@ -0,0 +1 @@ +huggingface_hub diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/__init__.py b/.local/lib/python3.10/site-packages/huggingface_hub/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..d0257adad1c90cf8cd11496df407674276517b0d --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/__init__.py @@ -0,0 +1,400 @@ +# Copyright 2020 The HuggingFace Team. 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. + +# *********** +# `huggingface_hub` init has 2 modes: +# - Normal usage: +# If imported to use it, all modules and functions are lazy-loaded. This means +# they exist at top level in module but are imported only the first time they are +# used. This way, `from huggingface_hub import something` will import `something` +# quickly without the hassle of importing all the features from `huggingface_hub`. +# - Static check: +# If statically analyzed, all modules and functions are loaded normally. This way +# static typing check works properly as well as autocomplete in text editors and +# IDEs. +# +# The static model imports are done inside the `if TYPE_CHECKING:` statement at +# the bottom of this file. Since module/functions imports are duplicated, it is +# mandatory to make sure to add them twice when adding one. This is checked in the +# `make quality` command. +# +# To update the static imports, please run the following command and commit the changes. +# ``` +# # Use script +# python utils/check_static_imports.py --update-file +# +# # Or run style on codebase +# make style +# ``` +# +# *********** +# Lazy loader vendored from https://github.com/scientific-python/lazy_loader +import importlib +import os +import sys +from typing import TYPE_CHECKING + + +__version__ = "0.11.1" + +# Alphabetical order of definitions is ensured in tests +# WARNING: any comment added in this dictionary definition will be lost when +# re-generating the file ! +_SUBMOD_ATTRS = { + "_login": [ + "interpreter_login", + "login", + "logout", + "notebook_login", + ], + "_snapshot_download": [ + "snapshot_download", + ], + "community": [ + "Discussion", + "DiscussionComment", + "DiscussionCommit", + "DiscussionEvent", + "DiscussionStatusChange", + "DiscussionTitleChange", + "DiscussionWithDetails", + ], + "constants": [ + "CONFIG_NAME", + "FLAX_WEIGHTS_NAME", + "HUGGINGFACE_CO_URL_HOME", + "HUGGINGFACE_CO_URL_TEMPLATE", + "PYTORCH_WEIGHTS_NAME", + "REPO_TYPE_DATASET", + "REPO_TYPE_MODEL", + "REPO_TYPE_SPACE", + "TF2_WEIGHTS_NAME", + "TF_WEIGHTS_NAME", + ], + "fastai_utils": [ + "_save_pretrained_fastai", + "from_pretrained_fastai", + "push_to_hub_fastai", + ], + "file_download": [ + "HfFileMetadata", + "cached_download", + "get_hf_file_metadata", + "hf_hub_download", + "hf_hub_url", + "try_to_load_from_cache", + ], + "hf_api": [ + "CommitInfo", + "CommitOperation", + "CommitOperationAdd", + "CommitOperationDelete", + "DatasetSearchArguments", + "HfApi", + "ModelSearchArguments", + "change_discussion_status", + "comment_discussion", + "create_branch", + "create_commit", + "create_discussion", + "create_pull_request", + "create_repo", + "create_tag", + "dataset_info", + "delete_branch", + "delete_file", + "delete_folder", + "delete_repo", + "delete_tag", + "edit_discussion_comment", + "get_dataset_tags", + "get_discussion_details", + "get_full_repo_name", + "get_model_tags", + "get_repo_discussions", + "list_datasets", + "list_metrics", + "list_models", + "list_repo_files", + "list_spaces", + "merge_pull_request", + "model_info", + "move_repo", + "rename_discussion", + "repo_type_and_id_from_hf_id", + "set_access_token", + "space_info", + "unset_access_token", + "update_repo_visibility", + "upload_file", + "upload_folder", + "whoami", + ], + "hub_mixin": [ + "ModelHubMixin", + "PyTorchModelHubMixin", + ], + "inference_api": [ + "InferenceApi", + ], + "keras_mixin": [ + "KerasModelHubMixin", + "from_pretrained_keras", + "push_to_hub_keras", + "save_pretrained_keras", + ], + "repocard": [ + "DatasetCard", + "ModelCard", + "metadata_eval_result", + "metadata_load", + "metadata_save", + "metadata_update", + ], + "repocard_data": [ + "CardData", + "DatasetCardData", + "EvalResult", + "ModelCardData", + ], + "repository": [ + "Repository", + ], + "utils": [ + "CacheNotFound", + "CachedFileInfo", + "CachedRepoInfo", + "CachedRevisionInfo", + "CorruptedCacheException", + "DeleteCacheStrategy", + "HFCacheInfo", + "HfFolder", + "cached_assets_path", + "dump_environment_info", + "logging", + "scan_cache_dir", + ], + "utils.endpoint_helpers": [ + "DatasetFilter", + "ModelFilter", + ], +} + + +def _attach(package_name, submodules=None, submod_attrs=None): + """Attach lazily loaded submodules, functions, or other attributes. + + Typically, modules import submodules and attributes as follows: + + ```py + import mysubmodule + import anothersubmodule + + from .foo import someattr + ``` + + The idea is to replace a package's `__getattr__`, `__dir__`, and + `__all__`, such that all imports work exactly the way they would + with normal imports, except that the import occurs upon first use. + + The typical way to call this function, replacing the above imports, is: + + ```python + __getattr__, __dir__, __all__ = lazy.attach( + __name__, + ['mysubmodule', 'anothersubmodule'], + {'foo': ['someattr']} + ) + ``` + This functionality requires Python 3.7 or higher. + + Args: + package_name (`str`): + Typically use `__name__`. + submodules (`set`): + List of submodules to attach. + submod_attrs (`dict`): + Dictionary of submodule -> list of attributes / functions. + These attributes are imported as they are used. + + Returns: + __getattr__, __dir__, __all__ + + """ + if submod_attrs is None: + submod_attrs = {} + + if submodules is None: + submodules = set() + else: + submodules = set(submodules) + + attr_to_modules = { + attr: mod for mod, attrs in submod_attrs.items() for attr in attrs + } + + __all__ = list(submodules | attr_to_modules.keys()) + + def __getattr__(name): + if name in submodules: + return importlib.import_module(f"{package_name}.{name}") + elif name in attr_to_modules: + submod_path = f"{package_name}.{attr_to_modules[name]}" + submod = importlib.import_module(submod_path) + attr = getattr(submod, name) + + # If the attribute lives in a file (module) with the same + # name as the attribute, ensure that the attribute and *not* + # the module is accessible on the package. + if name == attr_to_modules[name]: + pkg = sys.modules[package_name] + pkg.__dict__[name] = attr + + return attr + else: + raise AttributeError(f"No {package_name} attribute {name}") + + def __dir__(): + return __all__ + + if os.environ.get("EAGER_IMPORT", ""): + for attr in set(attr_to_modules.keys()) | submodules: + __getattr__(attr) + + return __getattr__, __dir__, list(__all__) + + +__getattr__, __dir__, __all__ = _attach( + __name__, submodules=[], submod_attrs=_SUBMOD_ATTRS +) + +# WARNING: any content below this statement is generated automatically. Any manual edit +# will be lost when re-generating this file ! +# +# To update the static imports, please run the following command and commit the changes. +# ``` +# # Use script +# python utils/check_static_imports.py --update-file +# +# # Or run style on codebase +# make style +# ``` +if TYPE_CHECKING: # pragma: no cover + from ._login import interpreter_login # noqa: F401 + from ._login import login # noqa: F401 + from ._login import logout # noqa: F401 + from ._login import notebook_login # noqa: F401 + from ._snapshot_download import snapshot_download # noqa: F401 + from .community import Discussion # noqa: F401 + from .community import DiscussionComment # noqa: F401 + from .community import DiscussionCommit # noqa: F401 + from .community import DiscussionEvent # noqa: F401 + from .community import DiscussionStatusChange # noqa: F401 + from .community import DiscussionTitleChange # noqa: F401 + from .community import DiscussionWithDetails # noqa: F401 + from .constants import CONFIG_NAME # noqa: F401 + from .constants import FLAX_WEIGHTS_NAME # noqa: F401 + from .constants import HUGGINGFACE_CO_URL_HOME # noqa: F401 + from .constants import HUGGINGFACE_CO_URL_TEMPLATE # noqa: F401 + from .constants import PYTORCH_WEIGHTS_NAME # noqa: F401 + from .constants import REPO_TYPE_DATASET # noqa: F401 + from .constants import REPO_TYPE_MODEL # noqa: F401 + from .constants import REPO_TYPE_SPACE # noqa: F401 + from .constants import TF2_WEIGHTS_NAME # noqa: F401 + from .constants import TF_WEIGHTS_NAME # noqa: F401 + from .fastai_utils import _save_pretrained_fastai # noqa: F401 + from .fastai_utils import from_pretrained_fastai # noqa: F401 + from .fastai_utils import push_to_hub_fastai # noqa: F401 + from .file_download import HfFileMetadata # noqa: F401 + from .file_download import cached_download # noqa: F401 + from .file_download import get_hf_file_metadata # noqa: F401 + from .file_download import hf_hub_download # noqa: F401 + from .file_download import hf_hub_url # noqa: F401 + from .file_download import try_to_load_from_cache # noqa: F401 + from .hf_api import CommitInfo # noqa: F401 + from .hf_api import CommitOperation # noqa: F401 + from .hf_api import CommitOperationAdd # noqa: F401 + from .hf_api import CommitOperationDelete # noqa: F401 + from .hf_api import DatasetSearchArguments # noqa: F401 + from .hf_api import HfApi # noqa: F401 + from .hf_api import ModelSearchArguments # noqa: F401 + from .hf_api import change_discussion_status # noqa: F401 + from .hf_api import comment_discussion # noqa: F401 + from .hf_api import create_branch # noqa: F401 + from .hf_api import create_commit # noqa: F401 + from .hf_api import create_discussion # noqa: F401 + from .hf_api import create_pull_request # noqa: F401 + from .hf_api import create_repo # noqa: F401 + from .hf_api import create_tag # noqa: F401 + from .hf_api import dataset_info # noqa: F401 + from .hf_api import delete_branch # noqa: F401 + from .hf_api import delete_file # noqa: F401 + from .hf_api import delete_folder # noqa: F401 + from .hf_api import delete_repo # noqa: F401 + from .hf_api import delete_tag # noqa: F401 + from .hf_api import edit_discussion_comment # noqa: F401 + from .hf_api import get_dataset_tags # noqa: F401 + from .hf_api import get_discussion_details # noqa: F401 + from .hf_api import get_full_repo_name # noqa: F401 + from .hf_api import get_model_tags # noqa: F401 + from .hf_api import get_repo_discussions # noqa: F401 + from .hf_api import list_datasets # noqa: F401 + from .hf_api import list_metrics # noqa: F401 + from .hf_api import list_models # noqa: F401 + from .hf_api import list_repo_files # noqa: F401 + from .hf_api import list_spaces # noqa: F401 + from .hf_api import merge_pull_request # noqa: F401 + from .hf_api import model_info # noqa: F401 + from .hf_api import move_repo # noqa: F401 + from .hf_api import rename_discussion # noqa: F401 + from .hf_api import repo_type_and_id_from_hf_id # noqa: F401 + from .hf_api import set_access_token # noqa: F401 + from .hf_api import space_info # noqa: F401 + from .hf_api import unset_access_token # noqa: F401 + from .hf_api import update_repo_visibility # noqa: F401 + from .hf_api import upload_file # noqa: F401 + from .hf_api import upload_folder # noqa: F401 + from .hf_api import whoami # noqa: F401 + from .hub_mixin import ModelHubMixin # noqa: F401 + from .hub_mixin import PyTorchModelHubMixin # noqa: F401 + from .inference_api import InferenceApi # noqa: F401 + from .keras_mixin import KerasModelHubMixin # noqa: F401 + from .keras_mixin import from_pretrained_keras # noqa: F401 + from .keras_mixin import push_to_hub_keras # noqa: F401 + from .keras_mixin import save_pretrained_keras # noqa: F401 + from .repocard import DatasetCard # noqa: F401 + from .repocard import ModelCard # noqa: F401 + from .repocard import metadata_eval_result # noqa: F401 + from .repocard import metadata_load # noqa: F401 + from .repocard import metadata_save # noqa: F401 + from .repocard import metadata_update # noqa: F401 + from .repocard_data import CardData # noqa: F401 + from .repocard_data import DatasetCardData # noqa: F401 + from .repocard_data import EvalResult # noqa: F401 + from .repocard_data import ModelCardData # noqa: F401 + from .repository import Repository # noqa: F401 + from .utils import CachedFileInfo # noqa: F401 + from .utils import CachedRepoInfo # noqa: F401 + from .utils import CachedRevisionInfo # noqa: F401 + from .utils import CacheNotFound # noqa: F401 + from .utils import CorruptedCacheException # noqa: F401 + from .utils import DeleteCacheStrategy # noqa: F401 + from .utils import HFCacheInfo # noqa: F401 + from .utils import HfFolder # noqa: F401 + from .utils import cached_assets_path # noqa: F401 + from .utils import dump_environment_info # noqa: F401 + from .utils import logging # noqa: F401 + from .utils import scan_cache_dir # noqa: F401 + from .utils.endpoint_helpers import DatasetFilter # noqa: F401 + from .utils.endpoint_helpers import ModelFilter # noqa: F401 diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/__init__.cpython-310.pyc b/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..44acb97a6c6dd114212a47965f3f479bca09cef8 Binary files /dev/null and b/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/__init__.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/_commit_api.cpython-310.pyc b/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/_commit_api.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d7fde68635e0e62699833ba21d47832f90982bbc Binary files /dev/null and b/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/_commit_api.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/_login.cpython-310.pyc b/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/_login.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bce73bebe7457310c75b524c4ea602c5ba1179e5 Binary files /dev/null and b/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/_login.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/_snapshot_download.cpython-310.pyc b/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/_snapshot_download.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d09ec622a08feb0abe851250569dfd68b2c9b8f1 Binary files /dev/null and b/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/_snapshot_download.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/community.cpython-310.pyc b/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/community.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..13935ccc590a97a513c1b1a49776a9efca4be372 Binary files /dev/null and b/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/community.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/constants.cpython-310.pyc b/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/constants.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1e1884cc5ea6fede76fc402fcb448d0faf1b081c Binary files /dev/null and b/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/constants.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/fastai_utils.cpython-310.pyc b/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/fastai_utils.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7a0440e6649319bf5c32b8547c65865751466033 Binary files /dev/null and b/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/fastai_utils.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/file_download.cpython-310.pyc b/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/file_download.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b10fcf8a5d3e9445603922076eb1877d26ecf2a6 Binary files /dev/null and b/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/file_download.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/hf_api.cpython-310.pyc b/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/hf_api.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..08604a091934c6fdee3bd4132971726703d90170 Binary files /dev/null and b/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/hf_api.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/hub_mixin.cpython-310.pyc b/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/hub_mixin.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..30e9c8ac3f813bcd5ac33e62828965ba69dc6733 Binary files /dev/null and b/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/hub_mixin.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/inference_api.cpython-310.pyc b/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/inference_api.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..337ded07d9055c143cff17514f9ecc330fac9951 Binary files /dev/null and b/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/inference_api.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/keras_mixin.cpython-310.pyc b/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/keras_mixin.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..12a66d487da8a64f051582946c6f51e058e9a000 Binary files /dev/null and b/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/keras_mixin.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/lfs.cpython-310.pyc b/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/lfs.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..69bbf7d07d174b823fa6f90867cfbd0237b6aec2 Binary files /dev/null and b/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/lfs.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/repocard.cpython-310.pyc b/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/repocard.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..915e9c8efea4561c76e476ae5897de91248dd519 Binary files /dev/null and b/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/repocard.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/repocard_data.cpython-310.pyc b/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/repocard_data.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2509916f850dd113ac3b1a3664d806b67aed780f Binary files /dev/null and b/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/repocard_data.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/repository.cpython-310.pyc b/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/repository.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e6281a814ee911e23ccb0ccb0156a650846184db Binary files /dev/null and b/.local/lib/python3.10/site-packages/huggingface_hub/__pycache__/repository.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/_commit_api.py b/.local/lib/python3.10/site-packages/huggingface_hub/_commit_api.py new file mode 100644 index 0000000000000000000000000000000000000000..8c58a0c79fc5794315ad6c453284e9fa7d37eebb --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/_commit_api.py @@ -0,0 +1,546 @@ +""" +Type definitions and utilities for the `create_commit` API +""" +import base64 +import io +import os +import warnings +from collections import defaultdict +from concurrent import futures +from concurrent.futures import ThreadPoolExecutor +from contextlib import contextmanager +from dataclasses import dataclass, field +from pathlib import PurePosixPath +from typing import Any, BinaryIO, Dict, Iterable, List, Optional, Union + +import requests + +from .constants import ENDPOINT +from .lfs import UploadInfo, _validate_batch_actions, lfs_upload, post_lfs_batch_info +from .utils import ( + build_hf_headers, + chunk_iterable, + hf_raise_for_status, + logging, + validate_hf_hub_args, +) +from .utils._deprecation import _deprecate_method +from .utils._typing import Literal + + +logger = logging.get_logger(__name__) + + +UploadMode = Literal["lfs", "regular"] + + +@dataclass +class CommitOperationDelete: + """ + Data structure holding necessary info to delete a file or a folder from a repository + on the Hub. + + Args: + path_in_repo (`str`): + Relative filepath in the repo, for example: `"checkpoints/1fec34a/weights.bin"` + for a file or `"checkpoints/1fec34a/"` for a folder. + is_folder (`bool` or `Literal["auto"]`, *optional*) + Whether the Delete Operation applies to a folder or not. If "auto", the path + type (file or folder) is guessed automatically by looking if path ends with + a "/" (folder) or not (file). To explicitly set the path type, you can set + `is_folder=True` or `is_folder=False`. + """ + + path_in_repo: str + is_folder: Union[bool, Literal["auto"]] = "auto" + + def __post_init__(self): + if self.is_folder == "auto": + self.is_folder = self.path_in_repo.endswith("/") + if not isinstance(self.is_folder, bool): + raise ValueError( + "Wrong value for `is_folder`. Must be one of [`True`, `False`," + f" `'auto'`]. Got '{self.is_folder}'." + ) + + +@dataclass +class CommitOperationAdd: + """ + Data structure holding necessary info to upload a file to a repository on the Hub. + + Args: + path_in_repo (`str`): + Relative filepath in the repo, for example: `"checkpoints/1fec34a/weights.bin"` + path_or_fileobj (`str`, `bytes`, or `BinaryIO`): + Either: + - a path to a local file (as str) to upload + - a buffer of bytes (`bytes`) holding the content of the file to upload + - a "file object" (subclass of `io.BufferedIOBase`), typically obtained + with `open(path, "rb")`. It must support `seek()` and `tell()` methods. + + Raises: + [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) + If `path_or_fileobj` is not one of `str`, `bytes` or `io.BufferedIOBase`. + [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) + If `path_or_fileobj` is a `str` but not a path to an existing file. + [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) + If `path_or_fileobj` is a `io.BufferedIOBase` but it doesn't support both + `seek()` and `tell()`. + """ + + path_in_repo: str + path_or_fileobj: Union[str, bytes, BinaryIO] + upload_info: UploadInfo = field(init=False, repr=False) + + def __post_init__(self) -> None: + """Validates `path_or_fileobj` and compute `upload_info`.""" + # Validate `path_or_fileobj` value + if isinstance(self.path_or_fileobj, str): + path_or_fileobj = os.path.normpath(os.path.expanduser(self.path_or_fileobj)) + if not os.path.isfile(path_or_fileobj): + raise ValueError( + f"Provided path: '{path_or_fileobj}' is not a file on the local" + " file system" + ) + elif not isinstance(self.path_or_fileobj, (io.BufferedIOBase, bytes)): + # ^^ Inspired from: https://stackoverflow.com/questions/44584829/how-to-determine-if-file-is-opened-in-binary-or-text-mode + raise ValueError( + "path_or_fileobj must be either an instance of str, bytes or" + " io.BufferedIOBase. If you passed a file-like object, make sure it is" + " in binary mode." + ) + if isinstance(self.path_or_fileobj, io.BufferedIOBase): + try: + self.path_or_fileobj.tell() + self.path_or_fileobj.seek(0, os.SEEK_CUR) + except (OSError, AttributeError) as exc: + raise ValueError( + "path_or_fileobj is a file-like object but does not implement" + " seek() and tell()" + ) from exc + + # Compute "upload_info" attribute + if isinstance(self.path_or_fileobj, str): + self.upload_info = UploadInfo.from_path(self.path_or_fileobj) + elif isinstance(self.path_or_fileobj, bytes): + self.upload_info = UploadInfo.from_bytes(self.path_or_fileobj) + else: + self.upload_info = UploadInfo.from_fileobj(self.path_or_fileobj) + + @_deprecate_method( + version="0.14", message="Operation is validated at initialization." + ) + def validate(self) -> None: + pass + + @_deprecate_method(version="0.14", message="Use `upload_info` property instead.") + def _upload_info(self) -> UploadInfo: + return self.upload_info + + @contextmanager + def as_file(self): + """ + A context manager that yields a file-like object allowing to read the underlying + data behind `path_or_fileobj`. + + Example: + + ```python + >>> operation = CommitOperationAdd( + ... path_in_repo="remote/dir/weights.h5", + ... path_or_fileobj="./local/weights.h5", + ... ) + CommitOperationAdd(path_in_repo='remote/dir/weights.h5', path_or_fileobj='./local/weights.h5') + + >>> with operation.as_file() as file: + ... content = file.read() + ``` + + """ + if isinstance(self.path_or_fileobj, str): + with open(self.path_or_fileobj, "rb") as file: + yield file + elif isinstance(self.path_or_fileobj, bytes): + yield io.BytesIO(self.path_or_fileobj) + elif isinstance(self.path_or_fileobj, io.BufferedIOBase): + prev_pos = self.path_or_fileobj.tell() + yield self.path_or_fileobj + self.path_or_fileobj.seek(prev_pos, io.SEEK_SET) + + def b64content(self) -> bytes: + """ + The base64-encoded content of `path_or_fileobj` + + Returns: `bytes` + """ + with self.as_file() as file: + return base64.b64encode(file.read()) + + +CommitOperation = Union[CommitOperationAdd, CommitOperationDelete] + + +def warn_on_overwriting_operations(operations: List[CommitOperation]) -> None: + """ + Warn user when a list of operations is expected to overwrite itself in a single + commit. + + Rules: + - If a filepath is updated by multiple `CommitOperationAdd` operations, a warning + message is triggered. + - If a filepath is updated at least once by a `CommitOperationAdd` and then deleted + by a `CommitOperationDelete`, a warning is triggered. + - If a `CommitOperationDelete` deletes a filepath that is then updated by a + `CommitOperationAdd`, no warning is triggered. This is usually useless (no need to + delete before upload) but can happen if a user deletes an entire folder and then + add new files to it. + """ + nb_additions_per_path: Dict[str, int] = defaultdict(int) + for operation in operations: + path_in_repo = operation.path_in_repo + if isinstance(operation, CommitOperationAdd): + if nb_additions_per_path[path_in_repo] > 0: + warnings.warn( + "About to update multiple times the same file in the same commit:" + f" '{path_in_repo}'. This can cause undesired inconsistencies in" + " your repo." + ) + nb_additions_per_path[path_in_repo] += 1 + for parent in PurePosixPath(path_in_repo).parents: + # Also keep track of number of updated files per folder + # => warns if deleting a folder overwrite some contained files + nb_additions_per_path[str(parent)] += 1 + if isinstance(operation, CommitOperationDelete): + if nb_additions_per_path[str(PurePosixPath(path_in_repo))] > 0: + if operation.is_folder: + warnings.warn( + "About to delete a folder containing files that have just been" + f" updated within the same commit: '{path_in_repo}'. This can" + " cause undesired inconsistencies in your repo." + ) + else: + warnings.warn( + "About to delete a file that have just been updated within the" + f" same commit: '{path_in_repo}'. This can cause undesired" + " inconsistencies in your repo." + ) + + +@validate_hf_hub_args +def upload_lfs_files( + *, + additions: List[CommitOperationAdd], + repo_type: str, + repo_id: str, + token: Optional[str], + endpoint: Optional[str] = None, + num_threads: int = 5, +): + """ + Uploads the content of `additions` to the Hub using the large file storage protocol. + + Relevant external documentation: + - LFS Batch API: https://github.com/git-lfs/git-lfs/blob/main/docs/api/batch.md + + Args: + additions (`List` of `CommitOperationAdd`): + The files to be uploaded + repo_type (`str`): + Type of the repo to upload to: `"model"`, `"dataset"` or `"space"`. + repo_id (`str`): + A namespace (user or an organization) and a repo name separated + by a `/`. + token (`str`, *optional*): + An authentication token ( See https://huggingface.co/settings/tokens ) + num_threads (`int`, *optional*): + The number of concurrent threads to use when uploading. Defaults to 5. + + + Raises: `RuntimeError` if an upload failed for any reason + + Raises: `ValueError` if the server returns malformed responses + + Raises: `requests.HTTPError` if the LFS batch endpoint returned an HTTP + error + + """ + # Step 1: retrieve upload instructions from the LFS batch endpoint. + # Upload instructions are retrieved by chunk of 256 files to avoid reaching + # the payload limit. + batch_actions: List[Dict] = [] + for chunk in chunk_iterable(additions, chunk_size=256): + batch_actions_chunk, batch_errors_chunk = post_lfs_batch_info( + upload_infos=[op.upload_info for op in chunk], + token=token, + repo_id=repo_id, + repo_type=repo_type, + endpoint=endpoint, + ) + + # If at least 1 error, we do not retrieve information for other chunks + if batch_errors_chunk: + message = "\n".join( + [ + f'Encountered error for file with OID {err.get("oid")}:' + f' `{err.get("error", {}).get("message")}' + for err in batch_errors_chunk + ] + ) + raise ValueError(f"LFS batch endpoint returned errors:\n{message}") + + batch_actions += batch_actions_chunk + + # Step 2: upload files concurrently according to these instructions + oid2addop = {add_op.upload_info.sha256.hex(): add_op for add_op in additions} + with ThreadPoolExecutor(max_workers=num_threads) as pool: + logger.debug( + f"Uploading {len(batch_actions)} LFS files to the Hub using up to" + f" {num_threads} threads concurrently" + ) + # Upload the files concurrently, stopping on the first exception + futures2operation: Dict[futures.Future, CommitOperationAdd] = { + pool.submit( + _upload_lfs_object, + operation=oid2addop[batch_action["oid"]], + lfs_batch_action=batch_action, + token=token, + ): oid2addop[batch_action["oid"]] + for batch_action in batch_actions + } + completed, pending = futures.wait( + futures2operation, + return_when=futures.FIRST_EXCEPTION, + ) + + for pending_future in pending: + # Cancel pending futures + # Uploads already in progress can't be stopped unfortunately, + # as `requests` does not support cancelling / aborting a request + pending_future.cancel() + + for future in completed: + operation = futures2operation[future] + try: + future.result() + except Exception as exc: + # Raise the first exception encountered + raise RuntimeError( + f"Error while uploading {operation.path_in_repo} to the Hub" + ) from exc + + +def _upload_lfs_object( + operation: CommitOperationAdd, lfs_batch_action: dict, token: Optional[str] +): + """ + Handles uploading a given object to the Hub with the LFS protocol. + + Defers to [`~utils.lfs.lfs_upload`] for the actual upload logic. + + Can be a No-op if the content of the file is already present on the hub + large file storage. + + Args: + operation (`CommitOperationAdd`): + The add operation triggering this upload + lfs_batch_action (`dict`): + Upload instructions from the LFS batch endpoint for this object. + See [`~utils.lfs.post_lfs_batch_info`] for more details. + token (`str`, *optional*): + A [user access token](https://hf.co/settings/tokens) to authenticate requests against the Hub + + Raises: `ValueError` if `lfs_batch_action` is improperly formatted + """ + _validate_batch_actions(lfs_batch_action) + upload_info = operation.upload_info + actions = lfs_batch_action.get("actions") + if actions is None: + # The file was already uploaded + logger.debug( + f"Content of file {operation.path_in_repo} is already present upstream" + " - skipping upload" + ) + return + upload_action = lfs_batch_action["actions"].get("upload") + verify_action = lfs_batch_action["actions"].get("verify") + + with operation.as_file() as fileobj: + logger.debug(f"Uploading {operation.path_in_repo} as LFS file...") + lfs_upload( + fileobj=fileobj, + upload_action=upload_action, + verify_action=verify_action, + upload_info=upload_info, + token=token, + ) + logger.debug(f"{operation.path_in_repo}: Upload successful") + + +def _validate_preupload_info(preupload_info: dict): + files = preupload_info.get("files") + if not isinstance(files, list): + raise ValueError("preupload_info is improperly formatted") + for file_info in files: + if not ( + isinstance(file_info, dict) + and isinstance(file_info.get("path"), str) + and isinstance(file_info.get("uploadMode"), str) + and (file_info["uploadMode"] in ("lfs", "regular")) + ): + raise ValueError("preupload_info is improperly formatted:") + return preupload_info + + +@validate_hf_hub_args +def fetch_upload_modes( + additions: Iterable[CommitOperationAdd], + repo_type: str, + repo_id: str, + token: Optional[str], + revision: str, + endpoint: Optional[str] = None, + create_pr: bool = False, +) -> Dict[str, UploadMode]: + """ + Requests the Hub "preupload" endpoint to determine wether each input file + should be uploaded as a regular git blob or as git LFS blob. + + Args: + additions (`Iterable` of :class:`CommitOperationAdd`): + Iterable of :class:`CommitOperationAdd` describing the files to + upload to the Hub. + repo_type (`str`): + Type of the repo to upload to: `"model"`, `"dataset"` or `"space"`. + repo_id (`str`): + A namespace (user or an organization) and a repo name separated + by a `/`. + token (`str`, *optional*): + An authentication token ( See https://huggingface.co/settings/tokens ) + revision (`str`): + The git revision to upload the files to. Can be any valid git revision. + + Returns: `Dict[str, UploadMode]` + Key is the file path, value is the upload mode ("regular" or "lfs"). + + Raises: + [`~utils.HfHubHTTPError`] + If the Hub API returned an error. + [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) + If the Hub API response is improperly formatted. + """ + endpoint = endpoint if endpoint is not None else ENDPOINT + headers = build_hf_headers(token=token) + + # Fetch upload mode (LFS or regular) chunk by chunk. + upload_modes: Dict[str, UploadMode] = {} + for chunk in chunk_iterable(additions, 256): + payload = { + "files": [ + { + "path": op.path_in_repo, + "sample": base64.b64encode(op.upload_info.sample).decode("ascii"), + "size": op.upload_info.size, + "sha": op.upload_info.sha256.hex(), + } + for op in chunk + ] + } + + resp = requests.post( + f"{endpoint}/api/{repo_type}s/{repo_id}/preupload/{revision}", + json=payload, + headers=headers, + params={"create_pr": "1"} if create_pr else None, + ) + hf_raise_for_status(resp) + preupload_info = _validate_preupload_info(resp.json()) + upload_modes.update( + **{file["path"]: file["uploadMode"] for file in preupload_info["files"]} + ) + + # If a file is empty, it is most likely a mistake. + # => a warning message is triggered to warn the user. + # => except if `.gitkeep` as it is a legit use case for an empty file. + # + # Empty files cannot be uploaded as LFS (S3 would fail with a 501 Not Implemented) + # => empty files are uploaded as "regular" to still allow users to commit them. + for addition in additions: + if addition.upload_info.size == 0: + path = addition.path_in_repo + if not path.endswith(".gitkeep"): + warnings.warn( + f"About to commit an empty file: '{path}'. Are you sure this is" + " intended?" + ) + upload_modes[path] = "regular" + + return upload_modes + + +def prepare_commit_payload( + operations: Iterable[CommitOperation], + upload_modes: Dict[str, UploadMode], + commit_message: str, + commit_description: Optional[str] = None, + parent_commit: Optional[str] = None, +) -> Iterable[Dict[str, Any]]: + """ + Builds the payload to POST to the `/commit` API of the Hub. + + Payload is returned as an iterator so that it can be streamed as a ndjson in the + POST request. + + For more information, see: + - https://github.com/huggingface/huggingface_hub/issues/1085#issuecomment-1265208073 + - http://ndjson.org/ + """ + commit_description = commit_description if commit_description is not None else "" + + # 1. Send a header item with the commit metadata + header_value = {"summary": commit_message, "description": commit_description} + if parent_commit is not None: + header_value["parentCommit"] = parent_commit + yield {"key": "header", "value": header_value} + + # 2. Send operations, one per line + for operation in operations: + # 2.a. Case adding a regular file + if ( + isinstance(operation, CommitOperationAdd) + and upload_modes.get(operation.path_in_repo) == "regular" + ): + yield { + "key": "file", + "value": { + "content": operation.b64content().decode(), + "path": operation.path_in_repo, + "encoding": "base64", + }, + } + # 2.b. Case adding an LFS file + elif ( + isinstance(operation, CommitOperationAdd) + and upload_modes.get(operation.path_in_repo) == "lfs" + ): + yield { + "key": "lfsFile", + "value": { + "path": operation.path_in_repo, + "algo": "sha256", + "oid": operation.upload_info.sha256.hex(), + "size": operation.upload_info.size, + }, + } + # 2.c. Case deleting a file or folder + elif isinstance(operation, CommitOperationDelete): + yield { + "key": "deletedFolder" if operation.is_folder else "deletedFile", + "value": {"path": operation.path_in_repo}, + } + # 2.d. Never expected to happen + else: + raise ValueError( + f"Unknown operation to commit. Operation: {operation}. Upload mode:" + f" {upload_modes.get(operation.path_in_repo)}" + ) diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/_login.py b/.local/lib/python3.10/site-packages/huggingface_hub/_login.py new file mode 100644 index 0000000000000000000000000000000000000000..b5f3ae3a8b8702e19147891307a066c7a92be5b9 --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/_login.py @@ -0,0 +1,298 @@ +# Copyright 2020 The HuggingFace Team. 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. +"""Contains methods to login to the Hub.""" +import subprocess +from getpass import getpass +from typing import List, Optional + +from .commands._cli_utils import ANSI +from .commands.delete_cache import _ask_for_confirmation_no_tui +from .hf_api import HfApi +from .utils import ( + HfFolder, + is_google_colab, + is_notebook, + list_credential_helpers, + logging, + run_subprocess, + set_git_credential, + unset_git_credential, +) +from .utils._deprecation import _deprecate_method + + +logger = logging.get_logger(__name__) + + +def login(token: Optional[str] = None, add_to_git_credential: bool = False) -> None: + """Login the machine to access the Hub. + + The `token` is persisted in cache and set as a git credential. Once done, the machine + is logged in and the access token will be available across all `huggingface_hub` + components. If `token` is not provided, it will be prompted to the user either with + a widget (in a notebook) or via the terminal. + + To login from outside of a script, one can also use `huggingface-cli login` which is + a cli command that wraps [`login`]. + + + [`login`] is a drop-in replacement method for [`notebook_login`] as it wraps and + extends its capabilities. + + + + When the token is not passed, [`login`] will automatically detect if the script runs + in a notebook or not. However, this detection might not be accurate due to the + variety of notebooks that exists nowadays. If that is the case, you can always force + the UI by using [`notebook_login`] or [`interpreter_login`]. + + + Args: + token (`str`, *optional*): + User access token to generate from https://huggingface.co/settings/token. + add_to_git_credential (`bool`, defaults to `False`): + If `True`, token will be set as git credential. If no git credential helper + is configured, a warning will be displayed to the user. If `token` is `None`, + the value of `add_to_git_credential` is ignored and will be prompted again + to the end user. + + + Raises: + [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) + If an organization token is passed. Only personal account tokens are valid + to login. + [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) + If token is invalid. + [`ImportError`](https://docs.python.org/3/library/exceptions.html#ImportError) + If running in a notebook but `ipywidgets` is not installed. + """ + if token is not None: + if not add_to_git_credential: + print( + "Token will not been saved to git credential helper. Pass" + " `add_to_git_credential=True` if you want to set the git" + " credential as well." + ) + _login(token, add_to_git_credential=add_to_git_credential) + elif is_notebook(): + notebook_login() + else: + interpreter_login() + + +def logout() -> None: + """Logout the machine from the Hub. + + Token is deleted from the machine and removed from git credential. + """ + token = HfFolder.get_token() + if token is None: + print("Not logged in!") + return + HfFolder.delete_token() + unset_git_credential() + print("Successfully logged out.") + + +### +# Interpreter-based login (text) +### + + +def interpreter_login() -> None: + """ + Displays a prompt to login to the HF website and store the token. + + This is equivalent to [`login`] without passing a token when not run in a notebook. + [`interpreter_login`] is useful if you want to force the use of the terminal prompt + instead of a notebook widget. + + For more details, see [`login`]. + """ + print( # docstyle-ignore + """ + _| _| _| _| _|_|_| _|_|_| _|_|_| _| _| _|_|_| _|_|_|_| _|_| _|_|_| _|_|_|_| + _| _| _| _| _| _| _| _|_| _| _| _| _| _| _| _| + _|_|_|_| _| _| _| _|_| _| _|_| _| _| _| _| _| _|_| _|_|_| _|_|_|_| _| _|_|_| + _| _| _| _| _| _| _| _| _| _| _|_| _| _| _| _| _| _| _| + _| _| _|_| _|_|_| _|_|_| _|_|_| _| _| _|_|_| _| _| _| _|_|_| _|_|_|_| + + To login, `huggingface_hub` now requires a token generated from https://huggingface.co/settings/tokens . + """ + ) + token = getpass("Token: ") + add_to_git_credential = _ask_for_confirmation_no_tui("Add token as git credential?") + + _login(token=token, add_to_git_credential=add_to_git_credential) + + +### +# Notebook-based login (widget) +### + +NOTEBOOK_LOGIN_PASSWORD_HTML = """

Immediately click login after typing your password or +it might be stored in plain text in this notebook file.
""" + + +NOTEBOOK_LOGIN_TOKEN_HTML_START = """

Copy a token from your Hugging Face +tokens page and paste it below.
Immediately click login after copying +your token or it might be stored in plain text in this notebook file.
""" + + +NOTEBOOK_LOGIN_TOKEN_HTML_END = """ +Pro Tip: If you don't already have one, you can create a dedicated +'notebooks' token with 'write' access, that you can then easily reuse for all +notebooks. """ + + +def notebook_login() -> None: + """ + Displays a widget to login to the HF website and store the token. + + This is equivalent to [`login`] without passing a token when run in a notebook. + [`notebook_login`] is useful if you want to force the use of the notebook widget + instead of a prompt in the terminal. + + For more details, see [`login`]. + """ + try: + import ipywidgets.widgets as widgets # type: ignore + from IPython.display import clear_output, display # type: ignore + except ImportError: + raise ImportError( + "The `notebook_login` function can only be used in a notebook (Jupyter or" + " Colab) and you need the `ipywidgets` module: `pip install ipywidgets`." + ) + + box_layout = widgets.Layout( + display="flex", flex_flow="column", align_items="center", width="50%" + ) + + token_widget = widgets.Password(description="Token:") + git_checkbox_widget = widgets.Checkbox( + value=True, description="Add token as git credential?" + ) + token_finish_button = widgets.Button(description="Login") + + login_token_widget = widgets.VBox( + [ + widgets.HTML(NOTEBOOK_LOGIN_TOKEN_HTML_START), + token_widget, + git_checkbox_widget, + token_finish_button, + widgets.HTML(NOTEBOOK_LOGIN_TOKEN_HTML_END), + ], + layout=box_layout, + ) + display(login_token_widget) + + # On click events + def login_token_event(t): + token = token_widget.value + add_to_git_credential = git_checkbox_widget.value + # Erase token and clear value to make sure it's not saved in the notebook. + token_widget.value = "" + clear_output() + _login(token, add_to_git_credential=add_to_git_credential) + + token_finish_button.on_click(login_token_event) + + +### +# Login private helpers +### + + +def _login(token: str, add_to_git_credential: bool) -> None: + hf_api = HfApi() + if token.startswith("api_org"): + raise ValueError("You must use your personal account token.") + if not hf_api._is_valid_token(token=token): + raise ValueError("Invalid token passed!") + print("Token is valid.") + + if add_to_git_credential: + if _is_git_credential_helper_configured(): + set_git_credential(token) + print( + "Your token has been saved in your configured git credential helpers" + f" ({','.join(list_credential_helpers())})." + ) + else: + print("Token has not been saved to git credential helper.") + + HfFolder.save_token(token) + print("Your token has been saved to", HfFolder.path_token) + print("Login successful") + + +def _is_git_credential_helper_configured() -> bool: + """Check if a git credential helper is configured. + + Warns user if not the case (except for Google Colab where "store" is set by default + by `huggingface_hub`). + """ + helpers = list_credential_helpers() + if len(helpers) > 0: + return True # Do not warn: at least 1 helper is set + + # Only in Google Colab to avoid the warning message + # See https://github.com/huggingface/huggingface_hub/issues/1043#issuecomment-1247010710 + if is_google_colab(): + _set_store_as_git_credential_helper_globally() + return True # Do not warn: "store" is used by default in Google Colab + + # Otherwise, warn user + print( + ANSI.red( + "Cannot authenticate through git-credential as no helper is defined on your" + " machine.\nYou might have to re-authenticate when pushing to the Hugging" + " Face Hub.\nRun the following command in your terminal in case you want to" + " set the 'store' credential helper as default.\n\ngit config --global" + " credential.helper store\n\nRead" + " https://git-scm.com/book/en/v2/Git-Tools-Credential-Storage for more" + " details." + ) + ) + return False + + +def _set_store_as_git_credential_helper_globally() -> None: + """Set globally the credential.helper to `store`. + + To be used only in Google Colab as we assume the user doesn't care about the git + credential config. It is the only particular case where we don't want to display the + warning message in [`notebook_login()`]. + + Related: + - https://github.com/huggingface/huggingface_hub/issues/1043 + - https://github.com/huggingface/huggingface_hub/issues/1051 + - https://git-scm.com/docs/git-credential-store + """ + try: + run_subprocess("git config --global credential.helper store") + except subprocess.CalledProcessError as exc: + raise EnvironmentError(exc.stderr) + + +@_deprecate_method( + version="0.14", message="Please use `list_credential_helpers` instead." +) +def _currently_setup_credential_helpers(directory: Optional[str] = None) -> List[str]: + return list_credential_helpers(directory) diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/_snapshot_download.py b/.local/lib/python3.10/site-packages/huggingface_hub/_snapshot_download.py new file mode 100644 index 0000000000000000000000000000000000000000..8aa47e68947489cc5ba61547db75010bee2e8a84 --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/_snapshot_download.py @@ -0,0 +1,206 @@ +import os +from pathlib import Path +from typing import Dict, List, Optional, Union + +from .constants import DEFAULT_REVISION, HUGGINGFACE_HUB_CACHE, REPO_TYPES +from .file_download import REGEX_COMMIT_HASH, hf_hub_download, repo_folder_name +from .hf_api import HfApi +from .utils import filter_repo_objects, logging, tqdm, validate_hf_hub_args +from .utils._deprecation import _deprecate_arguments + + +logger = logging.get_logger(__name__) + + +@_deprecate_arguments( + version="0.12", + deprecated_args={"allow_regex", "ignore_regex"}, + custom_message="Please use `allow_patterns` and `ignore_patterns` instead.", +) +@validate_hf_hub_args +def snapshot_download( + repo_id: str, + *, + revision: Optional[str] = None, + repo_type: Optional[str] = None, + cache_dir: Union[str, Path, None] = None, + library_name: Optional[str] = None, + library_version: Optional[str] = None, + user_agent: Optional[Union[Dict, str]] = None, + proxies: Optional[Dict] = None, + etag_timeout: float = 10, + resume_download: bool = False, + token: Optional[Union[bool, str]] = None, + local_files_only: bool = False, + allow_regex: Optional[Union[List[str], str]] = None, + ignore_regex: Optional[Union[List[str], str]] = None, + allow_patterns: Optional[Union[List[str], str]] = None, + ignore_patterns: Optional[Union[List[str], str]] = None, +) -> str: + """Download all files of a repo. + + Downloads a whole snapshot of a repo's files at the specified revision. This + is useful when you want all files from a repo, because you don't know which + ones you will need a priori. All files are nested inside a folder in order + to keep their actual filename relative to that folder. + + An alternative would be to just clone a repo but this would require that the + user always has git and git-lfs installed, and properly configured. + + Args: + repo_id (`str`): + A user or an organization name and a repo name separated by a `/`. + revision (`str`, *optional*): + An optional Git revision id which can be a branch name, a tag, or a + commit hash. + repo_type (`str`, *optional*): + Set to `"dataset"` or `"space"` if uploading to a dataset or space, + `None` or `"model"` if uploading to a model. Default is `None`. + cache_dir (`str`, `Path`, *optional*): + Path to the folder where cached files are stored. + library_name (`str`, *optional*): + The name of the library to which the object corresponds. + library_version (`str`, *optional*): + The version of the library. + user_agent (`str`, `dict`, *optional*): + The user-agent info in the form of a dictionary or a string. + proxies (`dict`, *optional*): + Dictionary mapping protocol to the URL of the proxy passed to + `requests.request`. + etag_timeout (`float`, *optional*, defaults to `10`): + When fetching ETag, how many seconds to wait for the server to send + data before giving up which is passed to `requests.request`. + resume_download (`bool`, *optional*, defaults to `False): + If `True`, resume a previously interrupted download. + token (`str`, `bool`, *optional*): + A token to be used for the download. + - If `True`, the token is read from the HuggingFace config + folder. + - If a string, it's used as the authentication token. + local_files_only (`bool`, *optional*, defaults to `False`): + If `True`, avoid downloading the file and return the path to the + local cached file if it exists. + allow_patterns (`List[str]` or `str`, *optional*): + If provided, only files matching at least one pattern are downloaded. + ignore_patterns (`List[str]` or `str`, *optional*): + If provided, files matching any of the patterns are not downloaded. + + Returns: + Local folder path (string) of repo snapshot + + + + Raises the following errors: + + - [`EnvironmentError`](https://docs.python.org/3/library/exceptions.html#EnvironmentError) + if `token=True` and the token cannot be found. + - [`OSError`](https://docs.python.org/3/library/exceptions.html#OSError) if + ETag cannot be determined. + - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) + if some parameter value is invalid + + + """ + if cache_dir is None: + cache_dir = HUGGINGFACE_HUB_CACHE + if revision is None: + revision = DEFAULT_REVISION + if isinstance(cache_dir, Path): + cache_dir = str(cache_dir) + + if repo_type is None: + repo_type = "model" + if repo_type not in REPO_TYPES: + raise ValueError( + f"Invalid repo type: {repo_type}. Accepted repo types are:" + f" {str(REPO_TYPES)}" + ) + + storage_folder = os.path.join( + cache_dir, repo_folder_name(repo_id=repo_id, repo_type=repo_type) + ) + + # TODO: remove these 4 lines in version 0.12 + # Deprecated code to ensure backward compatibility. + if allow_regex is not None: + allow_patterns = allow_regex + if ignore_regex is not None: + ignore_patterns = ignore_regex + + # if we have no internet connection we will look for an + # appropriate folder in the cache + # If the specified revision is a commit hash, look inside "snapshots". + # If the specified revision is a branch or tag, look inside "refs". + if local_files_only: + if REGEX_COMMIT_HASH.match(revision): + commit_hash = revision + else: + # retrieve commit_hash from file + ref_path = os.path.join(storage_folder, "refs", revision) + with open(ref_path) as f: + commit_hash = f.read() + + snapshot_folder = os.path.join(storage_folder, "snapshots", commit_hash) + + if os.path.exists(snapshot_folder): + return snapshot_folder + + raise ValueError( + "Cannot find an appropriate cached snapshot folder for the specified" + " revision on the local disk and outgoing traffic has been disabled. To" + " enable repo look-ups and downloads online, set 'local_files_only' to" + " False." + ) + + # if we have internet connection we retrieve the correct folder name from the huggingface api + _api = HfApi() + repo_info = _api.repo_info( + repo_id=repo_id, + repo_type=repo_type, + revision=revision, + token=token, + ) + assert ( + repo_info.sha is not None + ), "Repo info returned from server must have a revision sha." + filtered_repo_files = list( + filter_repo_objects( + items=[f.rfilename for f in repo_info.siblings], + allow_patterns=allow_patterns, + ignore_patterns=ignore_patterns, + ) + ) + commit_hash = repo_info.sha + snapshot_folder = os.path.join(storage_folder, "snapshots", commit_hash) + # if passed revision is not identical to commit_hash + # then revision has to be a branch name or tag name. + # In that case store a ref. + if revision != commit_hash: + ref_path = os.path.join(storage_folder, "refs", revision) + os.makedirs(os.path.dirname(ref_path), exist_ok=True) + with open(ref_path, "w") as f: + f.write(commit_hash) + + # we pass the commit_hash to hf_hub_download + # so no network call happens if we already + # have the file locally. + + for repo_file in tqdm( + filtered_repo_files, f"Fetching {len(filtered_repo_files)} files" + ): + _ = hf_hub_download( + repo_id, + filename=repo_file, + repo_type=repo_type, + revision=commit_hash, + cache_dir=cache_dir, + library_name=library_name, + library_version=library_version, + user_agent=user_agent, + proxies=proxies, + etag_timeout=etag_timeout, + resume_download=resume_download, + token=token, + ) + + return snapshot_folder diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/commands/__init__.py b/.local/lib/python3.10/site-packages/huggingface_hub/commands/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..49d088214505b9604964ab142e7f8a5b38ccd5ef --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/commands/__init__.py @@ -0,0 +1,27 @@ +# Copyright 2020 The HuggingFace Team. 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. + +from abc import ABC, abstractmethod +from argparse import _SubParsersAction + + +class BaseHuggingfaceCLICommand(ABC): + @staticmethod + @abstractmethod + def register_subcommand(parser: _SubParsersAction): + raise NotImplementedError() + + @abstractmethod + def run(self): + raise NotImplementedError() diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/commands/__pycache__/__init__.cpython-310.pyc b/.local/lib/python3.10/site-packages/huggingface_hub/commands/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ecf6fb596037993988857a03c622ac12ebd2971b Binary files /dev/null and b/.local/lib/python3.10/site-packages/huggingface_hub/commands/__pycache__/__init__.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/commands/__pycache__/_cli_utils.cpython-310.pyc b/.local/lib/python3.10/site-packages/huggingface_hub/commands/__pycache__/_cli_utils.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8ba925b2bbf5e5ed17cb4308b32f99a47534699e Binary files /dev/null and b/.local/lib/python3.10/site-packages/huggingface_hub/commands/__pycache__/_cli_utils.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/commands/__pycache__/delete_cache.cpython-310.pyc b/.local/lib/python3.10/site-packages/huggingface_hub/commands/__pycache__/delete_cache.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..82d1fb1a055f74de88df4d6dc3e00d71b157bd0b Binary files /dev/null and b/.local/lib/python3.10/site-packages/huggingface_hub/commands/__pycache__/delete_cache.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/commands/__pycache__/env.cpython-310.pyc b/.local/lib/python3.10/site-packages/huggingface_hub/commands/__pycache__/env.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..211bf8b26643e70d06407675913a619c773892ff Binary files /dev/null and b/.local/lib/python3.10/site-packages/huggingface_hub/commands/__pycache__/env.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/commands/__pycache__/huggingface_cli.cpython-310.pyc b/.local/lib/python3.10/site-packages/huggingface_hub/commands/__pycache__/huggingface_cli.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5a9d91180d019ac9b58c0e7bfc7da68b9c9d48b8 Binary files /dev/null and b/.local/lib/python3.10/site-packages/huggingface_hub/commands/__pycache__/huggingface_cli.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/commands/__pycache__/lfs.cpython-310.pyc b/.local/lib/python3.10/site-packages/huggingface_hub/commands/__pycache__/lfs.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..44f1c146b986fe12ca70edbf1caa7baded87ed3a Binary files /dev/null and b/.local/lib/python3.10/site-packages/huggingface_hub/commands/__pycache__/lfs.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/commands/__pycache__/scan_cache.cpython-310.pyc b/.local/lib/python3.10/site-packages/huggingface_hub/commands/__pycache__/scan_cache.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e7705f21ab714884cdc135741a5efeb7ba463380 Binary files /dev/null and b/.local/lib/python3.10/site-packages/huggingface_hub/commands/__pycache__/scan_cache.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/commands/__pycache__/user.cpython-310.pyc b/.local/lib/python3.10/site-packages/huggingface_hub/commands/__pycache__/user.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..28f86dc811139788df2ceffcd00c36b41b0d6407 Binary files /dev/null and b/.local/lib/python3.10/site-packages/huggingface_hub/commands/__pycache__/user.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/commands/_cli_utils.py b/.local/lib/python3.10/site-packages/huggingface_hub/commands/_cli_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..bbf17e887e901e58461b09e6648d614bb2caabbb --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/commands/_cli_utils.py @@ -0,0 +1,63 @@ +# Copyright 2022 The HuggingFace Team. 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. +"""Contains a utility for good-looking prints.""" +import os +from typing import List, Union + + +class ANSI: + """ + Helper for en.wikipedia.org/wiki/ANSI_escape_code + """ + + _bold = "\u001b[1m" + _gray = "\u001b[90m" + _red = "\u001b[31m" + _reset = "\u001b[0m" + + @classmethod + def bold(cls, s: str) -> str: + return cls._format(s, cls._bold) + + @classmethod + def gray(cls, s: str) -> str: + return cls._format(s, cls._gray) + + @classmethod + def red(cls, s: str) -> str: + return cls._format(s, cls._bold + cls._red) + + @classmethod + def _format(cls, s: str, code: str) -> str: + if os.environ.get("NO_COLOR"): + # See https://no-color.org/ + return s + return f"{code}{s}{cls._reset}" + + +def tabulate(rows: List[List[Union[str, int]]], headers: List[str]) -> str: + """ + Inspired by: + + - stackoverflow.com/a/8356620/593036 + - stackoverflow.com/questions/9535954/printing-lists-as-tabular-data + """ + col_widths = [max(len(str(x)) for x in col) for col in zip(*rows, headers)] + row_format = ("{{:{}}} " * len(headers)).format(*col_widths) + lines = [] + lines.append(row_format.format(*headers)) + lines.append(row_format.format(*["-" * w for w in col_widths])) + for row in rows: + lines.append(row_format.format(*row)) + return "\n".join(lines) diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/commands/delete_cache.py b/.local/lib/python3.10/site-packages/huggingface_hub/commands/delete_cache.py new file mode 100644 index 0000000000000000000000000000000000000000..1f9feedbc389fd74df204784b9572641c072c137 --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/commands/delete_cache.py @@ -0,0 +1,453 @@ +# coding=utf-8 +# Copyright 2022-present, the HuggingFace Inc. team. +# +# 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. +"""Contains command to delete some revisions from the HF cache directory. + +Usage: + huggingface-cli delete-cache + huggingface-cli delete-cache --disable-tui + huggingface-cli delete-cache --dir ~/.cache/huggingface/hub + +NOTE: + This command is based on `InquirerPy` to build the multiselect menu in the terminal. + This dependency has to be installed with `pip install huggingface_hub[cli]`. Since + we want to avoid as much as possible cross-platform issues, I chose a library that + is built on top of `python-prompt-toolkit` which seems to be a reference in terminal + GUI (actively maintained on both Unix and Windows, 7.9k stars). + + For the moment, the TUI feature is in beta. + + See: + - https://github.com/kazhala/InquirerPy + - https://inquirerpy.readthedocs.io/en/latest/ + - https://github.com/prompt-toolkit/python-prompt-toolkit + + Other solutions could have been: + - `simple_term_menu`: would be good as well for our use case but some issues suggest + that Windows is less supported. + See: https://github.com/IngoMeyer441/simple-term-menu + - `PyInquirer`: very similar to `InquirerPy` but older and not maintained anymore. + In particular, no support of Python3.10. + See: https://github.com/CITGuru/PyInquirer + - `pick` (or `pickpack`): easy to use and flexible but built on top of Python's + standard library `curses` that is specific to Unix (not implemented on Windows). + See https://github.com/wong2/pick and https://github.com/anafvana/pickpack. + - `inquirer`: lot of traction (700 stars) but explicitly states "experimental + support of Windows". Not built on top of `python-prompt-toolkit`. + See https://github.com/magmax/python-inquirer + +TODO: add support for `huggingface-cli delete-cache aaaaaa bbbbbb cccccc (...)` ? +TODO: add "--keep-last" arg to delete revisions that are not on `main` ref +TODO: add "--filter" arg to filter repositories by name ? +TODO: add "--sort" arg to sort by size ? +TODO: add "--limit" arg to limit to X repos ? +TODO: add "-y" arg for immediate deletion ? +See discussions in https://github.com/huggingface/huggingface_hub/issues/1025. +""" +import os +from argparse import _SubParsersAction +from functools import wraps +from tempfile import mkstemp +from typing import Any, Callable, Iterable, List, Optional, Union + +from ..utils import CachedRepoInfo, CachedRevisionInfo, HFCacheInfo, scan_cache_dir +from . import BaseHuggingfaceCLICommand +from ._cli_utils import ANSI + + +try: + from InquirerPy import inquirer + from InquirerPy.base.control import Choice + from InquirerPy.separator import Separator + + _inquirer_py_available = True +except ImportError: + _inquirer_py_available = False + + +def require_inquirer_py(fn: Callable) -> Callable: + """Decorator to flag methods that require `InquirerPy`.""" + # TODO: refactor this + imports in a unified pattern across codebase + @wraps(fn) + def _inner(*args, **kwargs): + if not _inquirer_py_available: + raise ImportError( + "The `delete-cache` command requires extra dependencies to work with" + " the TUI.\nPlease run `pip install huggingface_hub[cli]` to install" + " them.\nOtherwise, disable TUI using the `--disable-tui` flag." + ) + + return fn(*args, **kwargs) + + return _inner + + +# Possibility for the user to cancel deletion +_CANCEL_DELETION_STR = "CANCEL_DELETION" + + +class DeleteCacheCommand(BaseHuggingfaceCLICommand): + @staticmethod + def register_subcommand(parser: _SubParsersAction): + delete_cache_parser = parser.add_parser( + "delete-cache", help="Delete revisions from the cache directory." + ) + + delete_cache_parser.add_argument( + "--dir", + type=str, + default=None, + help=( + "cache directory (optional). Default to the default HuggingFace cache." + ), + ) + + delete_cache_parser.add_argument( + "--disable-tui", + action="store_true", + help=( + "Disable Terminal User Interface (TUI) mode. Useful if your" + " platform/terminal doesn't support the multiselect menu." + ), + ) + + delete_cache_parser.set_defaults(func=DeleteCacheCommand) + + def __init__(self, args): + self.cache_dir: Optional[str] = args.dir + self.disable_tui: bool = args.disable_tui + + def run(self): + """Run `delete-cache` command with or without TUI.""" + # Scan cache directory + hf_cache_info = scan_cache_dir(self.cache_dir) + + # Manual review from the user + if self.disable_tui: + selected_hashes = _manual_review_no_tui(hf_cache_info, preselected=[]) + else: + selected_hashes = _manual_review_tui(hf_cache_info, preselected=[]) + + # If deletion is not cancelled + if len(selected_hashes) > 0 and _CANCEL_DELETION_STR not in selected_hashes: + confirm_message = ( + _get_expectations_str(hf_cache_info, selected_hashes) + + " Confirm deletion ?" + ) + + # Confirm deletion + if self.disable_tui: + confirmed = _ask_for_confirmation_no_tui(confirm_message) + else: + confirmed = _ask_for_confirmation_tui(confirm_message) + + # Deletion is confirmed + if confirmed: + strategy = hf_cache_info.delete_revisions(*selected_hashes) + print("Start deletion.") + strategy.execute() + print( + f"Done. Deleted {len(strategy.repos)} repo(s) and" + f" {len(strategy.snapshots)} revision(s) for a total of" + f" {strategy.expected_freed_size_str}." + ) + return + + # Deletion is cancelled + print("Deletion is cancelled. Do nothing.") + + +@require_inquirer_py +def _manual_review_tui(hf_cache_info: HFCacheInfo, preselected: List[str]) -> List[str]: + """Ask the user for a manual review of the revisions to delete. + + Displays a multi-select menu in the terminal (TUI). + """ + # Define multiselect list + choices = _get_tui_choices_from_scan( + repos=hf_cache_info.repos, preselected=preselected + ) + checkbox = inquirer.checkbox( + message="Select revisions to delete:", + choices=choices, # List of revisions with some pre-selection + cycle=False, # No loop between top and bottom + height=100, # Large list if possible + # We use the instruction to display to the user the expected effect of the + # deletion. + instruction=_get_expectations_str( + hf_cache_info, + selected_hashes=[ + c.value for c in choices if isinstance(c, Choice) and c.enabled + ], + ), + # We use the long instruction to should keybindings instructions to the user + long_instruction=( + "Press to select, to validate and to quit" + " without modification." + ), + # Message that is displayed once the user validates its selection. + transformer=lambda result: f"{len(result)} revision(s) selected.", + ) + + # Add a callback to update the information line when a revision is + # selected/unselected + def _update_expectations(_) -> None: + # Hacky way to dynamically set an instruction message to the checkbox when + # a revision hash is selected/unselected. + checkbox._instruction = _get_expectations_str( + hf_cache_info, + selected_hashes=[ + choice["value"] + for choice in checkbox.content_control.choices + if choice["enabled"] + ], + ) + + checkbox.kb_func_lookup["toggle"].append({"func": _update_expectations}) + + # Finally display the form to the user. + try: + return checkbox.execute() + except KeyboardInterrupt: + return [] # Quit without deletion + + +@require_inquirer_py +def _ask_for_confirmation_tui(message: str, default: bool = True) -> bool: + """Ask for confirmation using Inquirer.""" + return inquirer.confirm(message, default=default).execute() + + +def _get_tui_choices_from_scan( + repos: Iterable[CachedRepoInfo], preselected: List[str] +) -> List: + """Build a list of choices from the scanned repos. + + Args: + repos (*Iterable[`CachedRepoInfo`]*): + List of scanned repos on which we want to delete revisions. + preselected (*List[`str`]*): + List of revision hashes that will be preselected. + + Return: + The list of choices to pass to `inquirer.checkbox`. + """ + choices: List[Union[Choice, Separator]] = [] + + # First choice is to cancel the deletion. If selected, nothing will be deleted, + # no matter the other selected items. + choices.append( + Choice( + _CANCEL_DELETION_STR, + name="None of the following (if selected, nothing will be deleted).", + enabled=False, + ) + ) + + # Display a separator per repo and a Choice for each revisions of the repo + for repo in sorted(repos, key=_repo_sorting_order): + # Repo as separator + choices.append( + Separator( + f"\n{repo.repo_type.capitalize()} {repo.repo_id} ({repo.size_on_disk_str}," + f" used {repo.last_accessed_str})" + ) + ) + for revision in sorted(repo.revisions, key=_revision_sorting_order): + # Revision as choice + choices.append( + Choice( + revision.commit_hash, + name=( + f"{revision.commit_hash[:8]}:" + f" {', '.join(sorted(revision.refs)) or '(detached)'} #" + f" modified {revision.last_modified_str}" + ), + enabled=revision.commit_hash in preselected, + ) + ) + + # Return choices + return choices + + +def _manual_review_no_tui( + hf_cache_info: HFCacheInfo, preselected: List[str] +) -> List[str]: + """Ask the user for a manual review of the revisions to delete. + + Used when TUI is disabled. Manual review happens in a separate tmp file that the + user can manually edit. + """ + # 1. Generate temporary file with delete commands. + fd, tmp_path = mkstemp(suffix=".txt") # suffix to make it easier to find by editors + os.close(fd) + + lines = [] + for repo in sorted(hf_cache_info.repos, key=_repo_sorting_order): + lines.append( + f"\n# {repo.repo_type.capitalize()} {repo.repo_id} ({repo.size_on_disk_str}," + f" used {repo.last_accessed_str})" + ) + for revision in sorted(repo.revisions, key=_revision_sorting_order): + lines.append( + # Deselect by prepending a '#' + f"{'' if revision.commit_hash in preselected else '#'} " + f" {revision.commit_hash} # Refs:" + # Print `refs` as comment on same line + f" {', '.join(sorted(revision.refs)) or '(detached)'} # modified" + # Print `last_modified` as comment on same line + f" {revision.last_modified_str}" + ) + + with open(tmp_path, "w") as f: + f.write(_MANUAL_REVIEW_NO_TUI_INSTRUCTIONS) + f.write("\n".join(lines)) + + # 2. Prompt instructions to user. + instructions = f""" + TUI is disabled. In other to select which revisions you want to delete, please edit + the following file using the text editor of your choice. Instructions for manual + editing are located at the beginning of the file. Edit the file, save it and confirm + to continue. + File to edit: {ANSI.bold(tmp_path)} + """ + print("\n".join(line.strip() for line in instructions.strip().split("\n"))) + + # 3. Wait for user confirmation. + while True: + selected_hashes = _read_manual_review_tmp_file(tmp_path) + if _ask_for_confirmation_no_tui( + _get_expectations_str(hf_cache_info, selected_hashes) + " Continue ?", + default=False, + ): + break + + # 4. Return selected_hashes + os.remove(tmp_path) + return selected_hashes + + +def _ask_for_confirmation_no_tui(message: str, default: bool = True) -> bool: + """Ask for confirmation using pure-python.""" + YES = ("y", "yes", "1") + NO = ("n", "no", "0") + DEFAULT = "" + ALL = YES + NO + (DEFAULT,) + full_message = message + (" (Y/n) " if default else " (y/N) ") + while True: + answer = input(full_message).lower() + if answer == DEFAULT: + return default + if answer in YES: + return True + if answer in NO: + return False + print(f"Invalid input. Must be one of {ALL}") + + +def _get_expectations_str( + hf_cache_info: HFCacheInfo, selected_hashes: List[str] +) -> str: + """Format a string to display to the user how much space would be saved. + + Example: + ``` + >>> _get_expectations_str(hf_cache_info, selected_hashes) + '7 revisions selected counting for 4.3G.' + ``` + """ + if _CANCEL_DELETION_STR in selected_hashes: + return "Nothing will be deleted." + strategy = hf_cache_info.delete_revisions(*selected_hashes) + return ( + f"{len(selected_hashes)} revisions selected counting for" + f" {strategy.expected_freed_size_str}." + ) + + +def _read_manual_review_tmp_file(tmp_path: str) -> List[str]: + """Read the manually reviewed instruction file and return a list of revision hash. + + Example: + ```txt + # This is the tmp file content + ### + + # Commented out line + 123456789 # revision hash + + # Something else + # a_newer_hash # 2 days ago + an_older_hash # 3 days ago + ``` + + ```py + >>> _read_manual_review_tmp_file(tmp_path) + ['123456789', 'an_older_hash'] + ``` + """ + with open(tmp_path) as f: + content = f.read() + + # Split lines + lines = [line.strip() for line in content.split("\n")] + + # Filter commented lines + selected_lines = [line for line in lines if not line.startswith("#")] + + # Select only before comment + selected_hashes = [line.split("#")[0].strip() for line in selected_lines] + + # Return revision hashes + return [hash for hash in selected_hashes if len(hash) > 0] + + +_MANUAL_REVIEW_NO_TUI_INSTRUCTIONS = f""" +# INSTRUCTIONS +# ------------ +# This is a temporary file created by running `huggingface-cli delete-cache` with the +# `--disable-tui` option. It contains a set of revisions that can be deleted from your +# local cache directory. +# +# Please manually review the revisions you want to delete: +# - Revision hashes can be commented out with '#'. +# - Only non-commented revisions in this file will be deleted. +# - Revision hashes that are removed from this file are ignored as well. +# - If `{_CANCEL_DELETION_STR}` line is uncommented, the all cache deletion is cancelled and +# no changes will be applied. +# +# Once you've manually reviewed this file, please confirm deletion in the terminal. This +# file will be automatically removed once done. +# ------------ + +# KILL SWITCH +# ------------ +# Un-comment following line to completely cancel the deletion process +# {_CANCEL_DELETION_STR} +# ------------ + +# REVISIONS +# ------------ +""".strip() + + +def _repo_sorting_order(repo: CachedRepoInfo) -> Any: + # First split by Dataset/Model, then sort by last accessed (oldest first) + return (repo.repo_type, repo.last_accessed) + + +def _revision_sorting_order(revision: CachedRevisionInfo) -> Any: + # Sort by last modified (oldest first) + return revision.last_modified diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/commands/env.py b/.local/lib/python3.10/site-packages/huggingface_hub/commands/env.py new file mode 100644 index 0000000000000000000000000000000000000000..f987adcac025f44ee35ddd2e8010905fc21afdb1 --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/commands/env.py @@ -0,0 +1,37 @@ +# Copyright 2022 The HuggingFace Team. 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. +"""Contains command to print information about the environment. + +Usage: + huggingface-cli env +""" +from argparse import _SubParsersAction + +from ..utils import dump_environment_info +from . import BaseHuggingfaceCLICommand + + +class EnvironmentCommand(BaseHuggingfaceCLICommand): + def __init__(self, args): + self.args = args + + @staticmethod + def register_subcommand(parser: _SubParsersAction): + env_parser = parser.add_parser( + "env", help="Print information about the environment." + ) + env_parser.set_defaults(func=EnvironmentCommand) + + def run(self) -> None: + dump_environment_info() diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/commands/huggingface_cli.py b/.local/lib/python3.10/site-packages/huggingface_hub/commands/huggingface_cli.py new file mode 100644 index 0000000000000000000000000000000000000000..fc9a754daee859c1970825e070ba7a621e823590 --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/commands/huggingface_cli.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python +# Copyright 2020 The HuggingFace Team. 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. + +from argparse import ArgumentParser + +from huggingface_hub.commands.delete_cache import DeleteCacheCommand +from huggingface_hub.commands.env import EnvironmentCommand +from huggingface_hub.commands.lfs import LfsCommands +from huggingface_hub.commands.scan_cache import ScanCacheCommand +from huggingface_hub.commands.user import UserCommands + + +def main(): + parser = ArgumentParser( + "huggingface-cli", usage="huggingface-cli []" + ) + commands_parser = parser.add_subparsers(help="huggingface-cli command helpers") + + # Register commands + EnvironmentCommand.register_subcommand(commands_parser) + UserCommands.register_subcommand(commands_parser) + LfsCommands.register_subcommand(commands_parser) + ScanCacheCommand.register_subcommand(commands_parser) + DeleteCacheCommand.register_subcommand(commands_parser) + + # Let's go + args = parser.parse_args() + + if not hasattr(args, "func"): + parser.print_help() + exit(1) + + # Run + service = args.func(args) + service.run() + + +if __name__ == "__main__": + main() diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/commands/lfs.py b/.local/lib/python3.10/site-packages/huggingface_hub/commands/lfs.py new file mode 100644 index 0000000000000000000000000000000000000000..3e362752db720d38c3a0b64d124df30bb133cd4e --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/commands/lfs.py @@ -0,0 +1,208 @@ +""" +Implementation of a custom transfer agent for the transfer type "multipart" for +git-lfs. + +Inspired by: +github.com/cbartz/git-lfs-swift-transfer-agent/blob/master/git_lfs_swift_transfer.py + +Spec is: github.com/git-lfs/git-lfs/blob/master/docs/custom-transfers.md + + +To launch debugger while developing: + +``` [lfs "customtransfer.multipart"] +path = /path/to/huggingface_hub/.env/bin/python args = -m debugpy --listen 5678 +--wait-for-client +/path/to/huggingface_hub/src/huggingface_hub/commands/huggingface_cli.py +lfs-multipart-upload ```""" + +import json +import os +import subprocess +import sys +from argparse import _SubParsersAction +from typing import Dict, List, Optional + +import requests +from huggingface_hub.commands import BaseHuggingfaceCLICommand +from huggingface_hub.lfs import LFS_MULTIPART_UPLOAD_COMMAND, SliceFileObj + +from ..utils import hf_raise_for_status, logging + + +logger = logging.get_logger(__name__) + + +class LfsCommands(BaseHuggingfaceCLICommand): + """ + Implementation of a custom transfer agent for the transfer type "multipart" + for git-lfs. This lets users upload large files >5GB 🔥. Spec for LFS custom + transfer agent is: + https://github.com/git-lfs/git-lfs/blob/master/docs/custom-transfers.md + + This introduces two commands to the CLI: + + 1. $ huggingface-cli lfs-enable-largefiles + + This should be executed once for each model repo that contains a model file + >5GB. It's documented in the error message you get if you just try to git + push a 5GB file without having enabled it before. + + 2. $ huggingface-cli lfs-multipart-upload + + This command is called by lfs directly and is not meant to be called by the + user. + """ + + @staticmethod + def register_subcommand(parser: _SubParsersAction): + enable_parser = parser.add_parser( + "lfs-enable-largefiles", + help="Configure your repository to enable upload of files > 5GB.", + ) + enable_parser.add_argument( + "path", type=str, help="Local path to repository you want to configure." + ) + enable_parser.set_defaults(func=lambda args: LfsEnableCommand(args)) + + upload_parser = parser.add_parser( + LFS_MULTIPART_UPLOAD_COMMAND, + help="Command will get called by git-lfs, do not call it directly.", + ) + upload_parser.set_defaults(func=lambda args: LfsUploadCommand(args)) + + +class LfsEnableCommand: + def __init__(self, args): + self.args = args + + def run(self): + local_path = os.path.abspath(self.args.path) + if not os.path.isdir(local_path): + print("This does not look like a valid git repo.") + exit(1) + subprocess.run( + "git config lfs.customtransfer.multipart.path huggingface-cli".split(), + check=True, + cwd=local_path, + ) + subprocess.run( + "git config lfs.customtransfer.multipart.args" + f" {LFS_MULTIPART_UPLOAD_COMMAND}".split(), + check=True, + cwd=local_path, + ) + print("Local repo set up for largefiles") + + +def write_msg(msg: Dict): + """Write out the message in Line delimited JSON.""" + msg_str = json.dumps(msg) + "\n" + sys.stdout.write(msg_str) + sys.stdout.flush() + + +def read_msg() -> Optional[Dict]: + """Read Line delimited JSON from stdin.""" + msg = json.loads(sys.stdin.readline().strip()) + + if "terminate" in (msg.get("type"), msg.get("event")): + # terminate message received + return None + + if msg.get("event") not in ("download", "upload"): + logger.critical("Received unexpected message") + sys.exit(1) + + return msg + + +class LfsUploadCommand: + def __init__(self, args): + self.args = args + + def run(self): + # Immediately after invoking a custom transfer process, git-lfs + # sends initiation data to the process over stdin. + # This tells the process useful information about the configuration. + init_msg = json.loads(sys.stdin.readline().strip()) + if not ( + init_msg.get("event") == "init" and init_msg.get("operation") == "upload" + ): + write_msg({"error": {"code": 32, "message": "Wrong lfs init operation"}}) + sys.exit(1) + + # The transfer process should use the information it needs from the + # initiation structure, and also perform any one-off setup tasks it + # needs to do. It should then respond on stdout with a simple empty + # confirmation structure, as follows: + write_msg({}) + + # After the initiation exchange, git-lfs will send any number of + # transfer requests to the stdin of the transfer process, in a serial sequence. + while True: + msg = read_msg() + if msg is None: + # When all transfers have been processed, git-lfs will send + # a terminate event to the stdin of the transfer process. + # On receiving this message the transfer process should + # clean up and terminate. No response is expected. + sys.exit(0) + + oid = msg["oid"] + filepath = msg["path"] + completion_url = msg["action"]["href"] + header = msg["action"]["header"] + chunk_size = int(header.pop("chunk_size")) + presigned_urls: List[str] = list(header.values()) + + # Send a "started" progress event to allow other workers to start. + # Otherwise they're delayed until first "progress" event is reported, + # i.e. after the first 5GB by default (!) + write_msg( + { + "event": "progress", + "oid": oid, + "bytesSoFar": 1, + "bytesSinceLast": 0, + } + ) + + parts = [] + with open(filepath, "rb") as file: + for i, presigned_url in enumerate(presigned_urls): + with SliceFileObj( + file, + seek_from=i * chunk_size, + read_limit=chunk_size, + ) as data: + r = requests.put(presigned_url, data=data) + hf_raise_for_status(r) + parts.append( + { + "etag": r.headers.get("etag"), + "partNumber": i + 1, + } + ) + # In order to support progress reporting while data is uploading / downloading, + # the transfer process should post messages to stdout + write_msg( + { + "event": "progress", + "oid": oid, + "bytesSoFar": (i + 1) * chunk_size, + "bytesSinceLast": chunk_size, + } + ) + # Not precise but that's ok. + + r = requests.post( + completion_url, + json={ + "oid": oid, + "parts": parts, + }, + ) + hf_raise_for_status(r) + + write_msg({"event": "complete", "oid": oid}) diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/commands/scan_cache.py b/.local/lib/python3.10/site-packages/huggingface_hub/commands/scan_cache.py new file mode 100644 index 0000000000000000000000000000000000000000..84b728a532d283ff6557f0077a25da718a11dc5f --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/commands/scan_cache.py @@ -0,0 +1,149 @@ +# coding=utf-8 +# Copyright 2022-present, the HuggingFace Inc. team. +# +# 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. +"""Contains command to scan the HF cache directory. + +Usage: + huggingface-cli scan-cache + huggingface-cli scan-cache -v + huggingface-cli scan-cache -vvv + huggingface-cli scan-cache --dir ~/.cache/huggingface/hub +""" +import time +from argparse import _SubParsersAction +from typing import Optional + +from ..utils import CacheNotFound, HFCacheInfo, scan_cache_dir +from . import BaseHuggingfaceCLICommand +from ._cli_utils import ANSI, tabulate + + +class ScanCacheCommand(BaseHuggingfaceCLICommand): + @staticmethod + def register_subcommand(parser: _SubParsersAction): + scan_cache_parser = parser.add_parser( + "scan-cache", help="Scan cache directory." + ) + + scan_cache_parser.add_argument( + "--dir", + type=str, + default=None, + help=( + "cache directory to scan (optional). Default to the" + " default HuggingFace cache." + ), + ) + scan_cache_parser.add_argument( + "-v", + "--verbose", + action="count", + default=0, + help="show a more verbose output", + ) + scan_cache_parser.set_defaults(func=ScanCacheCommand) + + def __init__(self, args): + self.verbosity: int = args.verbose + self.cache_dir: Optional[str] = args.dir + + def run(self): + try: + t0 = time.time() + hf_cache_info = scan_cache_dir(self.cache_dir) + t1 = time.time() + except CacheNotFound as exc: + cache_dir = exc.cache_dir + print(f"Cache directory not found: {cache_dir}") + return + + self._print_hf_cache_info_as_table(hf_cache_info) + + print( + f"\nDone in {round(t1-t0,1)}s. Scanned {len(hf_cache_info.repos)} repo(s)" + f" for a total of {ANSI.red(hf_cache_info.size_on_disk_str)}." + ) + if len(hf_cache_info.warnings) > 0: + message = f"Got {len(hf_cache_info.warnings)} warning(s) while scanning." + if self.verbosity >= 3: + print(ANSI.gray(message)) + for warning in hf_cache_info.warnings: + print(ANSI.gray(warning)) + else: + print(ANSI.gray(message + " Use -vvv to print details.")) + + def _print_hf_cache_info_as_table(self, hf_cache_info: HFCacheInfo) -> None: + if self.verbosity == 0: + print( + tabulate( + rows=[ + [ + repo.repo_id, + repo.repo_type, + "{:>12}".format(repo.size_on_disk_str), + repo.nb_files, + repo.last_accessed_str, + repo.last_modified_str, + ", ".join(sorted(repo.refs)), + str(repo.repo_path), + ] + for repo in sorted( + hf_cache_info.repos, key=lambda repo: repo.repo_path + ) + ], + headers=[ + "REPO ID", + "REPO TYPE", + "SIZE ON DISK", + "NB FILES", + "LAST_ACCESSED", + "LAST_MODIFIED", + "REFS", + "LOCAL PATH", + ], + ) + ) + else: + print( + tabulate( + rows=[ + [ + repo.repo_id, + repo.repo_type, + revision.commit_hash, + "{:>12}".format(revision.size_on_disk_str), + revision.nb_files, + revision.last_modified_str, + ", ".join(sorted(revision.refs)), + str(revision.snapshot_path), + ] + for repo in sorted( + hf_cache_info.repos, key=lambda repo: repo.repo_path + ) + for revision in sorted( + repo.revisions, key=lambda revision: revision.commit_hash + ) + ], + headers=[ + "REPO ID", + "REPO TYPE", + "REVISION", + "SIZE ON DISK", + "NB FILES", + "LAST_MODIFIED", + "REFS", + "LOCAL PATH", + ], + ) + ) diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/commands/user.py b/.local/lib/python3.10/site-packages/huggingface_hub/commands/user.py new file mode 100644 index 0000000000000000000000000000000000000000..15e9fd3ba439c1727fd61412fb391c0cf56b70a1 --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/commands/user.py @@ -0,0 +1,212 @@ +# Copyright 2020 The HuggingFace Team. 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. +import subprocess +from argparse import _SubParsersAction + +from huggingface_hub.commands import BaseHuggingfaceCLICommand +from huggingface_hub.constants import ( + ENDPOINT, + REPO_TYPES, + REPO_TYPES_URL_PREFIXES, + SPACES_SDK_TYPES, +) +from huggingface_hub.hf_api import HfApi +from requests.exceptions import HTTPError + +from .._login import ( # noqa: F401 # for backward compatibility + NOTEBOOK_LOGIN_PASSWORD_HTML, + NOTEBOOK_LOGIN_TOKEN_HTML_END, + NOTEBOOK_LOGIN_TOKEN_HTML_START, +) +from .._login import ( # noqa: F401 # for backward compatibility + _currently_setup_credential_helpers as currently_setup_credential_helpers, +) +from .._login import ( # noqa: F401 # for backward compatibility + login, + logout, + notebook_login, +) +from ..utils import HfFolder +from ._cli_utils import ANSI + + +class UserCommands(BaseHuggingfaceCLICommand): + @staticmethod + def register_subcommand(parser: _SubParsersAction): + login_parser = parser.add_parser( + "login", help="Log in using a token from huggingface.co/settings/tokens" + ) + login_parser.set_defaults(func=lambda args: LoginCommand(args)) + whoami_parser = parser.add_parser( + "whoami", help="Find out which huggingface.co account you are logged in as." + ) + whoami_parser.set_defaults(func=lambda args: WhoamiCommand(args)) + logout_parser = parser.add_parser("logout", help="Log out") + logout_parser.set_defaults(func=lambda args: LogoutCommand(args)) + + # new system: git-based repo system + repo_parser = parser.add_parser( + "repo", + help=( + "{create, ls-files} Commands to interact with your huggingface.co" + " repos." + ), + ) + repo_subparsers = repo_parser.add_subparsers( + help="huggingface.co repos related commands" + ) + repo_create_parser = repo_subparsers.add_parser( + "create", help="Create a new repo on huggingface.co" + ) + repo_create_parser.add_argument( + "name", + type=str, + help=( + "Name for your repo. Will be namespaced under your username to build" + " the repo id." + ), + ) + repo_create_parser.add_argument( + "--type", + type=str, + help=( + 'Optional: repo_type: set to "dataset" or "space" if creating a dataset' + " or space, default is model." + ), + ) + repo_create_parser.add_argument( + "--organization", type=str, help="Optional: organization namespace." + ) + repo_create_parser.add_argument( + "--space_sdk", + type=str, + help=( + "Optional: Hugging Face Spaces SDK type. Required when --type is set to" + ' "space".' + ), + choices=SPACES_SDK_TYPES, + ) + repo_create_parser.add_argument( + "-y", + "--yes", + action="store_true", + help="Optional: answer Yes to the prompt", + ) + repo_create_parser.set_defaults(func=lambda args: RepoCreateCommand(args)) + + +class BaseUserCommand: + def __init__(self, args): + self.args = args + self._api = HfApi() + + +class LoginCommand(BaseUserCommand): + def run(self): + login() + + +class LogoutCommand(BaseUserCommand): + def run(self): + logout() + + +class WhoamiCommand(BaseUserCommand): + def run(self): + token = HfFolder.get_token() + if token is None: + print("Not logged in") + exit() + try: + info = self._api.whoami(token) + print(info["name"]) + orgs = [org["name"] for org in info["orgs"]] + if orgs: + print(ANSI.bold("orgs: "), ",".join(orgs)) + + if ENDPOINT != "https://huggingface.co": + print(f"Authenticated through private endpoint: {ENDPOINT}") + except HTTPError as e: + print(e) + print(ANSI.red(e.response.text)) + exit(1) + + +class RepoCreateCommand(BaseUserCommand): + def run(self): + token = HfFolder.get_token() + if token is None: + print("Not logged in") + exit(1) + try: + stdout = subprocess.check_output(["git", "--version"]).decode("utf-8") + print(ANSI.gray(stdout.strip())) + except FileNotFoundError: + print("Looks like you do not have git installed, please install.") + + try: + stdout = subprocess.check_output(["git-lfs", "--version"]).decode("utf-8") + print(ANSI.gray(stdout.strip())) + except FileNotFoundError: + print( + ANSI.red( + "Looks like you do not have git-lfs installed, please install." + " You can install from https://git-lfs.github.com/." + " Then run `git lfs install` (you only have to do this once)." + ) + ) + print("") + + user = self._api.whoami(token)["name"] + namespace = ( + self.args.organization if self.args.organization is not None else user + ) + + repo_id = f"{namespace}/{self.args.name}" + + if self.args.type not in REPO_TYPES: + print("Invalid repo --type") + exit(1) + + if self.args.type in REPO_TYPES_URL_PREFIXES: + prefixed_repo_id = REPO_TYPES_URL_PREFIXES[self.args.type] + repo_id + else: + prefixed_repo_id = repo_id + + print(f"You are about to create {ANSI.bold(prefixed_repo_id)}") + + if not self.args.yes: + choice = input("Proceed? [Y/n] ").lower() + if not (choice == "" or choice == "y" or choice == "yes"): + print("Abort") + exit() + try: + url = self._api.create_repo( + repo_id=repo_id, + token=token, + repo_type=self.args.type, + space_sdk=self.args.space_sdk, + ) + except HTTPError as e: + print(e) + print(ANSI.red(e.response.text)) + exit(1) + print("\nYour repo now lives at:") + print(f" {ANSI.bold(url)}") + print( + "\nYou can clone it locally with the command below," + " and commit/push as usual." + ) + print(f"\n git clone {url}") + print("") diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/community.py b/.local/lib/python3.10/site-packages/huggingface_hub/community.py new file mode 100644 index 0000000000000000000000000000000000000000..5b891e9dcdd13a4b3422a5260a0b8f7b9c85cc83 --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/community.py @@ -0,0 +1,333 @@ +""" +Data structures to interact with Discussions and Pull Requests on the Hub. + +See [the Discussions and Pull Requests guide](https://huggingface.co/docs/hub/repositories-pull-requests-discussions) +for more information on Pull Requests, Discussions, and the community tab. +""" +from dataclasses import dataclass +from datetime import datetime +from typing import List, Optional + +from .utils import parse_datetime +from .utils._typing import Literal + + +DiscussionStatus = Literal["open", "closed", "merged", "draft"] + + +@dataclass +class Discussion: + """ + A Discussion or Pull Request on the Hub. + + This dataclass is not intended to be instantiated directly. + + Attributes: + title (`str`): + The title of the Discussion / Pull Request + status (`str`): + The status of the Discussion / Pull Request. + It must be one of: + * `"open"` + * `"closed"` + * `"merged"` (only for Pull Requests ) + * `"draft"` (only for Pull Requests ) + num (`int`): + The number of the Discussion / Pull Request. + repo_id (`str`): + The id (`"{namespace}/{repo_name}"`) of the repo on which + the Discussion / Pull Request was open. + repo_type (`str`): + The type of the repo on which the Discussion / Pull Request was open. + Possible values are: `"model"`, `"dataset"`, `"space"`. + author (`str`): + The username of the Discussion / Pull Request author. + Can be `"deleted"` if the user has been deleted since. + is_pull_request (`bool`): + Wether or not this is a Pull Request. + created_at (`datetime`): + The `datetime` of creation of the Discussion / Pull Request. + """ + + title: str + status: DiscussionStatus + num: int + repo_id: str + repo_type: str + author: str + is_pull_request: bool + created_at: datetime + + @property + def git_reference(self) -> Optional[str]: + """ + If this is a Pull Request , returns the git reference to which changes can be pushed. + Returns `None` otherwise. + """ + if self.is_pull_request: + return f"refs/pr/{self.num}" + return None + + +@dataclass +class DiscussionWithDetails(Discussion): + """ + Subclass of [`Discussion`]. + + Attributes: + title (`str`): + The title of the Discussion / Pull Request + status (`str`): + The status of the Discussion / Pull Request. + It can be one of: + * `"open"` + * `"closed"` + * `"merged"` (only for Pull Requests ) + * `"draft"` (only for Pull Requests ) + num (`int`): + The number of the Discussion / Pull Request. + repo_id (`str`): + The id (`"{namespace}/{repo_name}"`) of the repo on which + the Discussion / Pull Request was open. + repo_type (`str`): + The type of the repo on which the Discussion / Pull Request was open. + Possible values are: `"model"`, `"dataset"`, `"space"`. + author (`str`): + The username of the Discussion / Pull Request author. + Can be `"deleted"` if the user has been deleted since. + is_pull_request (`bool`): + Wether or not this is a Pull Request. + created_at (`datetime`): + The `datetime` of creation of the Discussion / Pull Request. + events (`list` of [`DiscussionEvent`]) + The list of [`DiscussionEvents`] in this Discussion or Pull Request. + conflicting_files (`list` of `str`, *optional*): + A list of conflicting files if this is a Pull Request. + `None` if `self.is_pull_request` is `False`. + target_branch (`str`, *optional*): + The branch into which changes are to be merged if this is a + Pull Request . `None` if `self.is_pull_request` is `False`. + merge_commit_oid (`str`, *optional*): + If this is a merged Pull Request , this is set to the OID / SHA of + the merge commit, `None` otherwise. + diff (`str`, *optional*): + The git diff if this is a Pull Request , `None` otherwise. + """ + + events: List["DiscussionEvent"] + conflicting_files: Optional[List[str]] + target_branch: Optional[str] + merge_commit_oid: Optional[str] + diff: Optional[str] + + +@dataclass +class DiscussionEvent: + """ + An event in a Discussion or Pull Request. + + Use concrete classes: + * [`DiscussionComment`] + * [`DiscussionStatusChange`] + * [`DiscussionCommit`] + * [`DiscussionTitleChange`] + + Attributes: + id (`str`): + The ID of the event. An hexadecimal string. + type (`str`): + The type of the event. + created_at (`datetime`): + A [`datetime`](https://docs.python.org/3/library/datetime.html?highlight=datetime#datetime.datetime) + object holding the creation timestamp for the event. + author (`str`): + The username of the Discussion / Pull Request author. + Can be `"deleted"` if the user has been deleted since. + """ + + id: str + type: str + created_at: datetime + author: str + + _event: dict + """Stores the original event data, in case we need to access it later.""" + + +@dataclass +class DiscussionComment(DiscussionEvent): + """A comment in a Discussion / Pull Request. + + Subclass of [`DiscussionEvent`]. + + + Attributes: + id (`str`): + The ID of the event. An hexadecimal string. + type (`str`): + The type of the event. + created_at (`datetime`): + A [`datetime`](https://docs.python.org/3/library/datetime.html?highlight=datetime#datetime.datetime) + object holding the creation timestamp for the event. + author (`str`): + The username of the Discussion / Pull Request author. + Can be `"deleted"` if the user has been deleted since. + content (`str`): + The raw markdown content of the comment. Mentions, links and images are not rendered. + edited (`bool`): + Wether or not this comment has been edited. + hidden (`bool`): + Whether or not this comment has been hidden. + """ + + content: str + edited: bool + hidden: bool + + @property + def rendered(self) -> str: + """The rendered comment, as a HTML string""" + return self._event["data"]["latest"]["html"] + + @property + def last_edited_at(self) -> datetime: + """The last edit time, as a `datetime` object.""" + return parse_datetime(self._event["data"]["latest"]["updatedAt"]) + + @property + def last_edited_by(self) -> str: + """The last edit tiem, as a `datetime` object.""" + return self._event["data"]["latest"].get("author", {}).get("name", "deleted") + + @property + def edit_history(self) -> List[dict]: + """The edit history of the comment""" + return self._event["data"]["history"] + + @property + def number_of_edits(self) -> int: + return len(self.edit_history) + + +@dataclass +class DiscussionStatusChange(DiscussionEvent): + """A change of status in a Discussion / Pull Request. + + Subclass of [`DiscussionEvent`]. + + Attributes: + id (`str`): + The ID of the event. An hexadecimal string. + type (`str`): + The type of the event. + created_at (`datetime`): + A [`datetime`](https://docs.python.org/3/library/datetime.html?highlight=datetime#datetime.datetime) + object holding the creation timestamp for the event. + author (`str`): + The username of the Discussion / Pull Request author. + Can be `"deleted"` if the user has been deleted since. + new_status (`str`): + The status of the Discussion / Pull Request after the change. + It can be one of: + * `"open"` + * `"closed"` + * `"merged"` (only for Pull Requests ) + """ + + new_status: str + + +@dataclass +class DiscussionCommit(DiscussionEvent): + """A commit in a Pull Request. + + Subclass of [`DiscussionEvent`]. + + Attributes: + id (`str`): + The ID of the event. An hexadecimal string. + type (`str`): + The type of the event. + created_at (`datetime`): + A [`datetime`](https://docs.python.org/3/library/datetime.html?highlight=datetime#datetime.datetime) + object holding the creation timestamp for the event. + author (`str`): + The username of the Discussion / Pull Request author. + Can be `"deleted"` if the user has been deleted since. + summary (`str`): + The summary of the commit. + oid (`str`): + The OID / SHA of the commit, as a hexadecimal string. + """ + + summary: str + oid: str + + +@dataclass +class DiscussionTitleChange(DiscussionEvent): + """A rename event in a Discussion / Pull Request. + + Subclass of [`DiscussionEvent`]. + + Attributes: + id (`str`): + The ID of the event. An hexadecimal string. + type (`str`): + The type of the event. + created_at (`datetime`): + A [`datetime`](https://docs.python.org/3/library/datetime.html?highlight=datetime#datetime.datetime) + object holding the creation timestamp for the event. + author (`str`): + The username of the Discussion / Pull Request author. + Can be `"deleted"` if the user has been deleted since. + old_title (`str`): + The previous title for the Discussion / Pull Request. + new_title (`str`): + The new title. + """ + + old_title: str + new_title: str + + +def deserialize_event(event: dict) -> DiscussionEvent: + """Instantiates a [`DiscussionEvent`] from a dict""" + event_id: str = event["id"] + event_type: str = event["type"] + created_at = parse_datetime(event["createdAt"]) + + common_args = dict( + id=event_id, + type=event_type, + created_at=created_at, + author=event.get("author", {}).get("name", "deleted"), + _event=event, + ) + + if event_type == "comment": + return DiscussionComment( + **common_args, + edited=event["data"]["edited"], + hidden=event["data"]["hidden"], + content=event["data"]["latest"]["raw"], + ) + if event_type == "status-change": + return DiscussionStatusChange( + **common_args, + new_status=event["data"]["status"], + ) + if event_type == "commit": + return DiscussionCommit( + **common_args, + summary=event["data"]["subject"], + oid=event["data"]["oid"], + ) + if event_type == "title-change": + return DiscussionTitleChange( + **common_args, + old_title=event["data"]["from"], + new_title=event["data"]["to"], + ) + + return DiscussionEvent(**common_args) diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/constants.py b/.local/lib/python3.10/site-packages/huggingface_hub/constants.py new file mode 100644 index 0000000000000000000000000000000000000000..c08cf1bbdcf01c45898d1984490b1e9ea32051d5 --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/constants.py @@ -0,0 +1,113 @@ +import os +import re +from typing import Optional + + +# Possible values for env variables + +ENV_VARS_TRUE_VALUES = {"1", "ON", "YES", "TRUE"} +ENV_VARS_TRUE_AND_AUTO_VALUES = ENV_VARS_TRUE_VALUES.union({"AUTO"}) + + +def _is_true(value: Optional[str]) -> bool: + if value is None: + return False + return value.upper() in ENV_VARS_TRUE_VALUES + + +def _is_true_or_auto(value: Optional[str]) -> bool: + if value is None: + return False + return value.upper() in ENV_VARS_TRUE_AND_AUTO_VALUES + + +# Constants for file downloads + +PYTORCH_WEIGHTS_NAME = "pytorch_model.bin" +TF2_WEIGHTS_NAME = "tf_model.h5" +TF_WEIGHTS_NAME = "model.ckpt" +FLAX_WEIGHTS_NAME = "flax_model.msgpack" +CONFIG_NAME = "config.json" +REPOCARD_NAME = "README.md" + +# Git-related constants + +DEFAULT_REVISION = "main" +REGEX_COMMIT_OID = re.compile(r"[A-Fa-f0-9]{5,40}") + +HUGGINGFACE_CO_URL_HOME = "https://huggingface.co/" + +_staging_mode = _is_true(os.environ.get("HUGGINGFACE_CO_STAGING")) + +ENDPOINT = os.getenv("HF_ENDPOINT") or ( + "https://hub-ci.huggingface.co" if _staging_mode else "https://huggingface.co" +) + +HUGGINGFACE_CO_URL_TEMPLATE = ENDPOINT + "/{repo_id}/resolve/{revision}/{filename}" +HUGGINGFACE_HEADER_X_REPO_COMMIT = "X-Repo-Commit" +HUGGINGFACE_HEADER_X_LINKED_ETAG = "X-Linked-Etag" +HUGGINGFACE_HEADER_X_LINKED_SIZE = "X-Linked-Size" + +REPO_ID_SEPARATOR = "--" +# ^ this substring is not allowed in repo_ids on hf.co +# and is the canonical one we use for serialization of repo ids elsewhere. + + +REPO_TYPE_DATASET = "dataset" +REPO_TYPE_SPACE = "space" +REPO_TYPE_MODEL = "model" +REPO_TYPES = [None, REPO_TYPE_MODEL, REPO_TYPE_DATASET, REPO_TYPE_SPACE] +SPACES_SDK_TYPES = ["gradio", "streamlit", "static"] + +REPO_TYPES_URL_PREFIXES = { + REPO_TYPE_DATASET: "datasets/", + REPO_TYPE_SPACE: "spaces/", +} +REPO_TYPES_MAPPING = { + "datasets": REPO_TYPE_DATASET, + "spaces": REPO_TYPE_SPACE, + "models": REPO_TYPE_MODEL, +} + + +# default cache +default_home = os.path.join(os.path.expanduser("~"), ".cache") +hf_cache_home = os.path.expanduser( + os.getenv( + "HF_HOME", + os.path.join(os.getenv("XDG_CACHE_HOME", default_home), "huggingface"), + ) +) + +default_cache_path = os.path.join(hf_cache_home, "hub") +default_assets_cache_path = os.path.join(hf_cache_home, "assets") + +HUGGINGFACE_HUB_CACHE = os.getenv("HUGGINGFACE_HUB_CACHE", default_cache_path) +HUGGINGFACE_ASSETS_CACHE = os.getenv( + "HUGGINGFACE_ASSETS_CACHE", default_assets_cache_path +) + +HF_HUB_OFFLINE = _is_true(os.environ.get("HF_HUB_OFFLINE")) + + +# Here, `True` will disable progress bars globally without possibility of enabling it +# programmatically. `False` will enable them without possibility of disabling them. +# If environment variable is not set (None), then the user is free to enable/disable +# them programmatically. +# TL;DR: env variable has priority over code +__HF_HUB_DISABLE_PROGRESS_BARS = os.environ.get("HF_HUB_DISABLE_PROGRESS_BARS") +HF_HUB_DISABLE_PROGRESS_BARS: Optional[bool] = ( + _is_true(__HF_HUB_DISABLE_PROGRESS_BARS) + if __HF_HUB_DISABLE_PROGRESS_BARS is not None + else None +) + +# Disable warning on machines that do not support symlinks (e.g. Windows non-developer) +HF_HUB_DISABLE_SYMLINKS_WARNING: bool = _is_true( + os.environ.get("HF_HUB_DISABLE_SYMLINKS_WARNING") +) + +# Disable sending the cached token by default is all HTTP requests to the Hub +HF_HUB_DISABLE_IMPLICIT_TOKEN: bool = _is_true( + os.environ.get("HF_HUB_DISABLE_IMPLICIT_TOKEN") +) diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/fastai_utils.py b/.local/lib/python3.10/site-packages/huggingface_hub/fastai_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..7d80e05e2e5c54032f5e6051180cd6341acfcc93 --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/fastai_utils.py @@ -0,0 +1,464 @@ +import json +import os +import tempfile +from pathlib import Path +from pickle import DEFAULT_PROTOCOL, PicklingError +from typing import Any, Dict, List, Optional, Union + +from packaging import version + +from huggingface_hub import snapshot_download +from huggingface_hub.constants import CONFIG_NAME +from huggingface_hub.hf_api import HfApi +from huggingface_hub.utils import ( + get_fastai_version, + get_fastcore_version, + get_python_version, +) + +from .utils import logging, validate_hf_hub_args +from .utils._deprecation import _deprecate_arguments, _deprecate_positional_args +from .utils._runtime import _PY_VERSION # noqa: F401 # for backward compatibility... + + +logger = logging.get_logger(__name__) + + +def _check_fastai_fastcore_versions( + fastai_min_version: str = "2.4", + fastcore_min_version: str = "1.3.27", +): + """ + Checks that the installed fastai and fastcore versions are compatible for pickle serialization. + + Args: + fastai_min_version (`str`, *optional*): + The minimum fastai version supported. + fastcore_min_version (`str`, *optional*): + The minimum fastcore version supported. + + + Raises the following error: + + - [`ImportError`](https://docs.python.org/3/library/exceptions.html#ImportError) + if the fastai or fastcore libraries are not available or are of an invalid version. + + + """ + + if (get_fastcore_version() or get_fastai_version()) == "N/A": + raise ImportError( + f"fastai>={fastai_min_version} and fastcore>={fastcore_min_version} are" + f" required. Currently using fastai=={get_fastai_version()} and" + f" fastcore=={get_fastcore_version()}." + ) + + current_fastai_version = version.Version(get_fastai_version()) + current_fastcore_version = version.Version(get_fastcore_version()) + + if current_fastai_version < version.Version(fastai_min_version): + raise ImportError( + "`push_to_hub_fastai` and `from_pretrained_fastai` require a" + f" fastai>={fastai_min_version} version, but you are using fastai version" + f" {get_fastai_version()} which is incompatible. Upgrade with `pip install" + " fastai==2.5.6`." + ) + + if current_fastcore_version < version.Version(fastcore_min_version): + raise ImportError( + "`push_to_hub_fastai` and `from_pretrained_fastai` require a" + f" fastcore>={fastcore_min_version} version, but you are using fastcore" + f" version {get_fastcore_version()} which is incompatible. Upgrade with" + " `pip install fastcore==1.3.27`." + ) + + +def _check_fastai_fastcore_pyproject_versions( + storage_folder: str, + fastai_min_version: str = "2.4", + fastcore_min_version: str = "1.3.27", +): + """ + Checks that the `pyproject.toml` file in the directory `storage_folder` has fastai and fastcore versions + that are compatible with `from_pretrained_fastai` and `push_to_hub_fastai`. If `pyproject.toml` does not exist + or does not contain versions for fastai and fastcore, then it logs a warning. + + Args: + storage_folder (`str`): + Folder to look for the `pyproject.toml` file. + fastai_min_version (`str`, *optional*): + The minimum fastai version supported. + fastcore_min_version (`str`, *optional*): + The minimum fastcore version supported. + + + Raises the following errors: + + - [`ImportError`](https://docs.python.org/3/library/exceptions.html#ImportError) + if the `toml` module is not installed. + - [`ImportError`](https://docs.python.org/3/library/exceptions.html#ImportError) + if the `pyproject.toml` indicates a lower than minimum supported version of fastai or fastcore. + + + """ + + try: + import toml + except ModuleNotFoundError: + raise ImportError( + "`push_to_hub_fastai` and `from_pretrained_fastai` require the toml module." + " Install it with `pip install toml`." + ) + + # Checks that a `pyproject.toml`, with `build-system` and `requires` sections, exists in the repository. If so, get a list of required packages. + if not os.path.isfile(f"{storage_folder}/pyproject.toml"): + logger.warning( + "There is no `pyproject.toml` in the repository that contains the fastai" + " `Learner`. The `pyproject.toml` would allow us to verify that your fastai" + " and fastcore versions are compatible with those of the model you want to" + " load." + ) + return + pyproject_toml = toml.load(f"{storage_folder}/pyproject.toml") + + if "build-system" not in pyproject_toml.keys(): + logger.warning( + "There is no `build-system` section in the pyproject.toml of the repository" + " that contains the fastai `Learner`. The `build-system` would allow us to" + " verify that your fastai and fastcore versions are compatible with those" + " of the model you want to load." + ) + return + build_system_toml = pyproject_toml["build-system"] + + if "requires" not in build_system_toml.keys(): + logger.warning( + "There is no `requires` section in the pyproject.toml of the repository" + " that contains the fastai `Learner`. The `requires` would allow us to" + " verify that your fastai and fastcore versions are compatible with those" + " of the model you want to load." + ) + return + package_versions = build_system_toml["requires"] + + # Extracts contains fastai and fastcore versions from `pyproject.toml` if available. + # If the package is specified but not the version (e.g. "fastai" instead of "fastai=2.4"), the default versions are the highest. + fastai_packages = [pck for pck in package_versions if pck.startswith("fastai")] + if len(fastai_packages) == 0: + logger.warning( + "The repository does not have a fastai version specified in the" + " `pyproject.toml`." + ) + # fastai_version is an empty string if not specified + else: + fastai_version = str(fastai_packages[0]).partition("=")[2] + if fastai_version != "" and version.Version(fastai_version) < version.Version( + fastai_min_version + ): + raise ImportError( + "`from_pretrained_fastai` requires" + f" fastai>={fastai_min_version} version but the model to load uses" + f" {fastai_version} which is incompatible." + ) + + fastcore_packages = [pck for pck in package_versions if pck.startswith("fastcore")] + if len(fastcore_packages) == 0: + logger.warning( + "The repository does not have a fastcore version specified in the" + " `pyproject.toml`." + ) + # fastcore_version is an empty string if not specified + else: + fastcore_version = str(fastcore_packages[0]).partition("=")[2] + if fastcore_version != "" and version.Version( + fastcore_version + ) < version.Version(fastcore_min_version): + raise ImportError( + "`from_pretrained_fastai` requires" + f" fastcore>={fastcore_min_version} version, but you are using fastcore" + f" version {fastcore_version} which is incompatible." + ) + + +README_TEMPLATE = """--- +tags: +- fastai +--- + +# Amazing! + +🥳 Congratulations on hosting your fastai model on the Hugging Face Hub! + +# Some next steps +1. Fill out this model card with more information (see the template below and the [documentation here](https://huggingface.co/docs/hub/model-repos))! + +2. Create a demo in Gradio or Streamlit using 🤗 Spaces ([documentation here](https://huggingface.co/docs/hub/spaces)). + +3. Join the fastai community on the [Fastai Discord](https://discord.com/invite/YKrxeNn)! + +Greetings fellow fastlearner 🤝! Don't forget to delete this content from your model card. + + +--- + + +# Model card + +## Model description +More information needed + +## Intended uses & limitations +More information needed + +## Training and evaluation data +More information needed +""" + +PYPROJECT_TEMPLATE = f"""[build-system] +requires = ["setuptools>=40.8.0", "wheel", "python={get_python_version()}", "fastai={get_fastai_version()}", "fastcore={get_fastcore_version()}"] +build-backend = "setuptools.build_meta:__legacy__" +""" + + +def _create_model_card(repo_dir: Path): + """ + Creates a model card for the repository. + + Args: + repo_dir (`Path`): + Directory where model card is created. + """ + readme_path = repo_dir / "README.md" + + if not readme_path.exists(): + with readme_path.open("w", encoding="utf-8") as f: + f.write(README_TEMPLATE) + + +def _create_model_pyproject(repo_dir: Path): + """ + Creates a `pyproject.toml` for the repository. + + Args: + repo_dir (`Path`): + Directory where `pyproject.toml` is created. + """ + pyproject_path = repo_dir / "pyproject.toml" + + if not pyproject_path.exists(): + with pyproject_path.open("w", encoding="utf-8") as f: + f.write(PYPROJECT_TEMPLATE) + + +def _save_pretrained_fastai( + learner, + save_directory: Union[str, Path], + config: Optional[Dict[str, Any]] = None, +): + """ + Saves a fastai learner to `save_directory` in pickle format using the default pickle protocol for the version of python used. + + Args: + learner (`Learner`): + The `fastai.Learner` you'd like to save. + save_directory (`str` or `Path`): + Specific directory in which you want to save the fastai learner. + config (`dict`, *optional*): + Configuration object. Will be uploaded as a .json file. Example: 'https://huggingface.co/espejelomar/fastai-pet-breeds-classification/blob/main/config.json'. + + + + Raises the following error: + + - [`RuntimeError`](https://docs.python.org/3/library/exceptions.html#RuntimeError) + if the config file provided is not a dictionary. + + + """ + _check_fastai_fastcore_versions() + + os.makedirs(save_directory, exist_ok=True) + + # if the user provides config then we update it with the fastai and fastcore versions in CONFIG_TEMPLATE. + if config is not None: + if not isinstance(config, dict): + raise RuntimeError( + f"Provided config should be a dict. Got: '{type(config)}'" + ) + path = os.path.join(save_directory, CONFIG_NAME) + with open(path, "w") as f: + json.dump(config, f) + + _create_model_card(Path(save_directory)) + _create_model_pyproject(Path(save_directory)) + + # learner.export saves the model in `self.path`. + learner.path = Path(save_directory) + os.makedirs(save_directory, exist_ok=True) + try: + learner.export( + fname="model.pkl", + pickle_protocol=DEFAULT_PROTOCOL, + ) + except PicklingError: + raise PicklingError( + "You are using a lambda function, i.e., an anonymous function. `pickle`" + " cannot pickle function objects and requires that all functions have" + " names. One possible solution is to name the function." + ) + + +@validate_hf_hub_args +def from_pretrained_fastai( + repo_id: str, + revision: Optional[str] = None, +): + """ + Load pretrained fastai model from the Hub or from a local directory. + + Args: + repo_id (`str`): + The location where the pickled fastai.Learner is. It can be either of the two: + - Hosted on the Hugging Face Hub. E.g.: 'espejelomar/fatai-pet-breeds-classification' or 'distilgpt2'. + You can add a `revision` by appending `@` at the end of `repo_id`. E.g.: `dbmdz/bert-base-german-cased@main`. + Revision is the specific model version to use. Since we use a git-based system for storing models and other + artifacts on the Hugging Face Hub, it can be a branch name, a tag name, or a commit id. + - Hosted locally. `repo_id` would be a directory containing the pickle and a pyproject.toml + indicating the fastai and fastcore versions used to build the `fastai.Learner`. E.g.: `./my_model_directory/`. + revision (`str`, *optional*): + Revision at which the repo's files are downloaded. See documentation of `snapshot_download`. + + Returns: + The `fastai.Learner` model in the `repo_id` repo. + """ + _check_fastai_fastcore_versions() + + # Load the `repo_id` repo. + # `snapshot_download` returns the folder where the model was stored. + # `cache_dir` will be the default '/root/.cache/huggingface/hub' + if not os.path.isdir(repo_id): + storage_folder = snapshot_download( + repo_id=repo_id, + revision=revision, + library_name="fastai", + library_version=get_fastai_version(), + ) + else: + storage_folder = repo_id + + _check_fastai_fastcore_pyproject_versions(storage_folder) + + from fastai.learner import load_learner # type: ignore + + return load_learner(os.path.join(storage_folder, "model.pkl")) + + +@_deprecate_positional_args(version="0.12") +@_deprecate_arguments( + version="0.12", + deprecated_args={ + "git_user", + "git_email", + }, +) +@validate_hf_hub_args +def push_to_hub_fastai( + # NOTE: New arguments since 0.9 + learner, + *, + repo_id: str, + commit_message: str = "Add model", + private: bool = False, + token: Optional[str] = None, + config: Optional[dict] = None, + branch: Optional[str] = None, + create_pr: Optional[bool] = None, + allow_patterns: Optional[Union[List[str], str]] = None, + ignore_patterns: Optional[Union[List[str], str]] = None, + api_endpoint: Optional[str] = None, + # NOTE: deprecated signature that will change in 0.12 + git_user: Optional[str] = None, + git_email: Optional[str] = None, + # TODO (release 0.12): signature must be the following + # learner, + # repo_id: Optional[str] = None, # optional only until 0.12 + # commit_message: str = "Add model", + # private: Optional[bool] = None, + # token: Optional[str] = None, + # config: Optional[dict] = None, + # branch: Optional[str] = None, + # create_pr: Optional[bool] = None, + # allow_patterns: Optional[Union[List[str], str]] = None, + # ignore_patterns: Optional[Union[List[str], str]] = None, + # api_endpoint: Optional[str] = None, +): + """ + Upload learner checkpoint files to the Hub. + + Use `allow_patterns` and `ignore_patterns` to precisely filter which files should be + pushed to the hub. See [`upload_folder`] reference for more details. + + Args: + learner (`Learner`): + The `fastai.Learner' you'd like to push to the Hub. + repo_id (`str`): + The repository id for your model in Hub in the format of "namespace/repo_name". The namespace can be your individual account or an organization to which you have write access (for example, 'stanfordnlp/stanza-de'). + commit_message (`str`, *optional*): + Message to commit while pushing. Will default to :obj:`"add model"`. + private (`bool`, *optional*, defaults to `False`): + Whether or not the repository created should be private. + token (`str`, *optional*): + The Hugging Face account token to use as HTTP bearer authorization for remote files. If :obj:`None`, the token will be asked by a prompt. + config (`dict`, *optional*): + Configuration object to be saved alongside the model weights. + branch (`str`, *optional*): + The git branch on which to push the model. This defaults to + the default branch as specified in your repository, which + defaults to `"main"`. + create_pr (`boolean`, *optional*): + Whether or not to create a Pull Request from `branch` with that commit. + Defaults to `False`. + api_endpoint (`str`, *optional*): + The API endpoint to use when pushing the model to the hub. + allow_patterns (`List[str]` or `str`, *optional*): + If provided, only files matching at least one pattern are pushed. + ignore_patterns (`List[str]` or `str`, *optional*): + If provided, files matching any of the patterns are not pushed. + Returns: + The url of the commit of your model in the given repository. + + + + Raises the following error: + + - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) + if the user is not log on to the Hugging Face Hub. + + + """ + + _check_fastai_fastcore_versions() + api = HfApi(endpoint=api_endpoint) + api.create_repo( + repo_id=repo_id, + repo_type="model", + token=token, + private=private, + exist_ok=True, + ) + + # Push the files to the repo in a single commit + with tempfile.TemporaryDirectory() as tmp: + saved_path = Path(tmp) / repo_id + _save_pretrained_fastai(learner, saved_path, config=config) + return api.upload_folder( + repo_id=repo_id, + repo_type="model", + token=token, + folder_path=saved_path, + commit_message=commit_message, + revision=branch, + create_pr=create_pr, + allow_patterns=allow_patterns, + ignore_patterns=ignore_patterns, + ) diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/file_download.py b/.local/lib/python3.10/site-packages/huggingface_hub/file_download.py new file mode 100644 index 0000000000000000000000000000000000000000..02b3ba3ec8465e0c9f160fdb77430222c7751cba --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/file_download.py @@ -0,0 +1,1427 @@ +import copy +import fnmatch +import io +import json +import os +import re +import shutil +import stat +import tempfile +import uuid +import warnings +from contextlib import contextmanager +from dataclasses import dataclass +from functools import partial +from hashlib import sha256 +from pathlib import Path +from typing import Any, BinaryIO, Dict, Generator, Optional, Tuple, Union +from urllib.parse import quote, urlparse + +import requests +from filelock import FileLock +from huggingface_hub import constants +from requests.exceptions import ConnectTimeout, ProxyError + +from . import __version__ # noqa: F401 # for backward compatibility +from .constants import ( + DEFAULT_REVISION, + HF_HUB_DISABLE_SYMLINKS_WARNING, + HUGGINGFACE_CO_URL_TEMPLATE, + HUGGINGFACE_HEADER_X_LINKED_ETAG, + HUGGINGFACE_HEADER_X_LINKED_SIZE, + HUGGINGFACE_HEADER_X_REPO_COMMIT, + HUGGINGFACE_HUB_CACHE, + REPO_ID_SEPARATOR, + REPO_TYPES, + REPO_TYPES_URL_PREFIXES, +) +from .utils import get_fastai_version # noqa: F401 # for backward compatibility +from .utils import get_fastcore_version # noqa: F401 # for backward compatibility +from .utils import get_graphviz_version # noqa: F401 # for backward compatibility +from .utils import get_jinja_version # noqa: F401 # for backward compatibility +from .utils import get_pydot_version # noqa: F401 # for backward compatibility +from .utils import get_tf_version # noqa: F401 # for backward compatibility +from .utils import get_torch_version # noqa: F401 # for backward compatibility +from .utils import is_fastai_available # noqa: F401 # for backward compatibility +from .utils import is_fastcore_available # noqa: F401 # for backward compatibility +from .utils import is_graphviz_available # noqa: F401 # for backward compatibility +from .utils import is_jinja_available # noqa: F401 # for backward compatibility +from .utils import is_pydot_available # noqa: F401 # for backward compatibility +from .utils import is_tf_available # noqa: F401 # for backward compatibility +from .utils import is_torch_available # noqa: F401 # for backward compatibility +from .utils import ( + EntryNotFoundError, + LocalEntryNotFoundError, + build_hf_headers, + hf_raise_for_status, + http_backoff, + logging, + tqdm, + validate_hf_hub_args, +) +from .utils._headers import _http_user_agent +from .utils._runtime import _PY_VERSION # noqa: F401 # for backward compatibility +from .utils._typing import HTTP_METHOD_T + + +logger = logging.get_logger(__name__) + + +_are_symlinks_supported_in_dir: Dict[str, bool] = {} + + +def are_symlinks_supported(cache_dir: Union[str, Path, None] = None) -> bool: + """Return whether the symlinks are supported on the machine. + + Since symlinks support can change depending on the mounted disk, we need to check + on the precise cache folder. By default, the default HF cache directory is checked. + + Args: + cache_dir (`str`, `Path`, *optional*): + Path to the folder where cached files are stored. + + Returns: [bool] Whether symlinks are supported in the directory. + """ + # Defaults to HF cache + if cache_dir is None: + cache_dir = HUGGINGFACE_HUB_CACHE + cache_dir = str(Path(cache_dir).expanduser().resolve()) # make it unique + + # Check symlink compatibility only once (per cache directory) at first time use + if cache_dir not in _are_symlinks_supported_in_dir: + _are_symlinks_supported_in_dir[cache_dir] = True + + os.makedirs(cache_dir, exist_ok=True) + with tempfile.TemporaryDirectory(dir=cache_dir) as tmpdir: + src_path = Path(tmpdir) / "dummy_file_src" + src_path.touch() + dst_path = Path(tmpdir) / "dummy_file_dst" + + # Relative source path as in `_create_relative_symlink`` + relative_src = os.path.relpath(src_path, start=os.path.dirname(dst_path)) + try: + os.symlink(relative_src, dst_path) + except OSError: + # Likely running on Windows + _are_symlinks_supported_in_dir[cache_dir] = False + + if not HF_HUB_DISABLE_SYMLINKS_WARNING: + message = ( + "`huggingface_hub` cache-system uses symlinks by default to" + " efficiently store duplicated files but your machine does not" + f" support them in {cache_dir}. Caching files will still work" + " but in a degraded version that might require more space on" + " your disk. This warning can be disabled by setting the" + " `HF_HUB_DISABLE_SYMLINKS_WARNING` environment variable. For" + " more details, see" + " https://huggingface.co/docs/huggingface_hub/how-to-cache#limitations." + ) + if os.name == "nt": + message += ( + "\nTo support symlinks on Windows, you either need to" + " activate Developer Mode or to run Python as an" + " administrator. In order to see activate developer mode," + " see this article:" + " https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development" + ) + warnings.warn(message) + + return _are_symlinks_supported_in_dir[cache_dir] + + +# Return value when trying to load a file from cache but the file does not exist in the distant repo. +_CACHED_NO_EXIST = object() +_CACHED_NO_EXIST_T = Any +REGEX_COMMIT_HASH = re.compile(r"^[0-9a-f]{40}$") + + +@dataclass(frozen=True) +class HfFileMetadata: + """Data structure containing information about a file versioned on the Hub. + + Returned by [`get_hf_file_metadata`] based on a URL. + + Args: + commit_hash (`str`, *optional*): + The commit_hash related to the file. + etag (`str`, *optional*): + Etag of the file on the server. + location (`str`): + Location where to download the file. Can be a Hub url or not (CDN). + size (`size`): + Size of the file. In case of an LFS file, contains the size of the actual + LFS file, not the pointer. + """ + + commit_hash: Optional[str] + etag: Optional[str] + location: str + size: Optional[int] + + +@validate_hf_hub_args +def hf_hub_url( + repo_id: str, + filename: str, + *, + subfolder: Optional[str] = None, + repo_type: Optional[str] = None, + revision: Optional[str] = None, +) -> str: + """Construct the URL of a file from the given information. + + The resolved address can either be a huggingface.co-hosted url, or a link to + Cloudfront (a Content Delivery Network, or CDN) for large files which are + more than a few MBs. + + Args: + repo_id (`str`): + A namespace (user or an organization) name and a repo name separated + by a `/`. + filename (`str`): + The name of the file in the repo. + subfolder (`str`, *optional*): + An optional value corresponding to a folder inside the repo. + repo_type (`str`, *optional*): + Set to `"dataset"` or `"space"` if uploading to a dataset or space, + `None` or `"model"` if uploading to a model. Default is `None`. + revision (`str`, *optional*): + An optional Git revision id which can be a branch name, a tag, or a + commit hash. + + Example: + + ```python + >>> from huggingface_hub import hf_hub_url + + >>> hf_hub_url( + ... repo_id="julien-c/EsperBERTo-small", filename="pytorch_model.bin" + ... ) + 'https://huggingface.co/julien-c/EsperBERTo-small/resolve/main/pytorch_model.bin' + ``` + + + + Notes: + + Cloudfront is replicated over the globe so downloads are way faster for + the end user (and it also lowers our bandwidth costs). + + Cloudfront aggressively caches files by default (default TTL is 24 + hours), however this is not an issue here because we implement a + git-based versioning system on huggingface.co, which means that we store + the files on S3/Cloudfront in a content-addressable way (i.e., the file + name is its hash). Using content-addressable filenames means cache can't + ever be stale. + + In terms of client-side caching from this library, we base our caching + on the objects' entity tag (`ETag`), which is an identifier of a + specific version of a resource [1]_. An object's ETag is: its git-sha1 + if stored in git, or its sha256 if stored in git-lfs. + + + + References: + + - [1] https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag + """ + if subfolder == "": + subfolder = None + if subfolder is not None: + filename = f"{subfolder}/{filename}" + + if repo_type not in REPO_TYPES: + raise ValueError("Invalid repo type") + + if repo_type in REPO_TYPES_URL_PREFIXES: + repo_id = REPO_TYPES_URL_PREFIXES[repo_type] + repo_id + + if revision is None: + revision = DEFAULT_REVISION + return HUGGINGFACE_CO_URL_TEMPLATE.format( + repo_id=repo_id, + revision=quote(revision, safe=""), + filename=quote(filename), + ) + + +def url_to_filename(url: str, etag: Optional[str] = None) -> str: + """Generate a local filename from a url. + + Convert `url` into a hashed filename in a reproducible way. If `etag` is + specified, append its hash to the url's, delimited by a period. If the url + ends with .h5 (Keras HDF5 weights) adds '.h5' to the name so that TF 2.0 can + identify it as a HDF5 file (see + https://github.com/tensorflow/tensorflow/blob/00fad90125b18b80fe054de1055770cfb8fe4ba3/tensorflow/python/keras/engine/network.py#L1380) + + Args: + url (`str`): + The address to the file. + etag (`str`, *optional*): + The ETag of the file. + + Returns: + The generated filename. + """ + url_bytes = url.encode("utf-8") + filename = sha256(url_bytes).hexdigest() + + if etag: + etag_bytes = etag.encode("utf-8") + filename += "." + sha256(etag_bytes).hexdigest() + + if url.endswith(".h5"): + filename += ".h5" + + return filename + + +def filename_to_url( + filename, + cache_dir: Optional[str] = None, + legacy_cache_layout: bool = False, +) -> Tuple[str, str]: + """ + Return the url and etag (which may be `None`) stored for `filename`. Raise + `EnvironmentError` if `filename` or its stored metadata do not exist. + + Args: + filename (`str`): + The name of the file + cache_dir (`str`, *optional*): + The cache directory to use instead of the default one. + legacy_cache_layout (`bool`, *optional*, defaults to `False`): + If `True`, uses the legacy file cache layout i.e. just call `hf_hub_url` + then `cached_download`. This is deprecated as the new cache layout is + more powerful. + """ + if not legacy_cache_layout: + warnings.warn( + "`filename_to_url` uses the legacy way cache file layout", + FutureWarning, + ) + + if cache_dir is None: + cache_dir = HUGGINGFACE_HUB_CACHE + if isinstance(cache_dir, Path): + cache_dir = str(cache_dir) + + cache_path = os.path.join(cache_dir, filename) + if not os.path.exists(cache_path): + raise EnvironmentError(f"file {cache_path} not found") + + meta_path = cache_path + ".json" + if not os.path.exists(meta_path): + raise EnvironmentError(f"file {meta_path} not found") + + with open(meta_path, encoding="utf-8") as meta_file: + metadata = json.load(meta_file) + url = metadata["url"] + etag = metadata["etag"] + + return url, etag + + +def http_user_agent( + *, + library_name: Optional[str] = None, + library_version: Optional[str] = None, + user_agent: Union[Dict, str, None] = None, +) -> str: + """Deprecated in favor of [`build_hf_headers`].""" + return _http_user_agent( + library_name=library_name, + library_version=library_version, + user_agent=user_agent, + ) + + +class OfflineModeIsEnabled(ConnectionError): + pass + + +def _raise_if_offline_mode_is_enabled(msg: Optional[str] = None): + """Raise a OfflineModeIsEnabled error (subclass of ConnectionError) if + HF_HUB_OFFLINE is True.""" + if constants.HF_HUB_OFFLINE: + raise OfflineModeIsEnabled( + "Offline mode is enabled." + if msg is None + else "Offline mode is enabled. " + str(msg) + ) + + +def _request_wrapper( + method: HTTP_METHOD_T, + url: str, + *, + max_retries: int = 0, + base_wait_time: float = 0.5, + max_wait_time: float = 2, + timeout: float = 10.0, + follow_relative_redirects: bool = False, + **params, +) -> requests.Response: + """Wrapper around requests methods to add several features. + + What it does: + 1. Ensure offline mode is disabled (env variable `HF_HUB_OFFLINE` not set to 1). + If enabled, a `OfflineModeIsEnabled` exception is raised. + 2. Follow relative redirections if `follow_relative_redirects=True` even when + `allow_redirection` kwarg is set to False. + 3. Retry in case request fails with a `ConnectTimeout`, with exponential backoff. + + Args: + method (`str`): + HTTP method, such as 'GET' or 'HEAD'. + url (`str`): + The URL of the resource to fetch. + max_retries (`int`, *optional*, defaults to `0`): + Maximum number of retries, defaults to 0 (no retries). + base_wait_time (`float`, *optional*, defaults to `0.5`): + Duration (in seconds) to wait before retrying the first time. + Wait time between retries then grows exponentially, capped by + `max_wait_time`. + max_wait_time (`float`, *optional*, defaults to `2`): + Maximum amount of time between two retries, in seconds. + timeout (`float`, *optional*, defaults to `10`): + How many seconds to wait for the server to send data before + giving up which is passed to `requests.request`. + follow_relative_redirects (`bool`, *optional*, defaults to `False`) + If True, relative redirection (redirection to the same site) will be + resolved even when `allow_redirection` kwarg is set to False. Useful when we + want to follow a redirection to a renamed repository without following + redirection to a CDN. + **params (`dict`, *optional*): + Params to pass to `requests.request`. + """ + # 1. Check online mode + _raise_if_offline_mode_is_enabled(f"Tried to reach {url}") + + # 2. Force relative redirection + if follow_relative_redirects: + response = _request_wrapper( + method=method, + url=url, + max_retries=max_retries, + base_wait_time=base_wait_time, + max_wait_time=max_wait_time, + timeout=timeout, + follow_relative_redirects=False, + **params, + ) + + # If redirection, we redirect only relative paths. + # This is useful in case of a renamed repository. + if 300 <= response.status_code <= 399: + parsed_target = urlparse(response.headers["Location"]) + if parsed_target.netloc == "": + # This means it is a relative 'location' headers, as allowed by RFC 7231. + # (e.g. '/path/to/resource' instead of 'http://domain.tld/path/to/resource') + # We want to follow this relative redirect ! + # + # Highly inspired by `resolve_redirects` from requests library. + # See https://github.com/psf/requests/blob/main/requests/sessions.py#L159 + return _request_wrapper( + method=method, + url=urlparse(url)._replace(path=parsed_target.path).geturl(), + max_retries=max_retries, + base_wait_time=base_wait_time, + max_wait_time=max_wait_time, + timeout=timeout, + follow_relative_redirects=True, # resolve recursively + **params, + ) + return response + + # 3. Exponential backoff + return http_backoff( + method=method, + url=url, + max_retries=max_retries, + base_wait_time=base_wait_time, + max_wait_time=max_wait_time, + retry_on_exceptions=(ConnectTimeout, ProxyError), + retry_on_status_codes=(), + timeout=timeout, + **params, + ) + + +def _request_with_retry(*args, **kwargs) -> requests.Response: + """Deprecated method. Please use `_request_wrapper` instead. + + Alias to keep backward compatibility (used in Transformers). + """ + return _request_wrapper(*args, **kwargs) + + +def http_get( + url: str, + temp_file: BinaryIO, + *, + proxies=None, + resume_size=0, + headers: Optional[Dict[str, str]] = None, + timeout=10.0, + max_retries=0, +): + """ + Download a remote file. Do not gobble up errors, and will return errors tailored to the Hugging Face Hub. + """ + headers = copy.deepcopy(headers) or {} + if resume_size > 0: + headers["Range"] = "bytes=%d-" % (resume_size,) + r = _request_wrapper( + method="GET", + url=url, + stream=True, + proxies=proxies, + headers=headers, + timeout=timeout, + max_retries=max_retries, + ) + hf_raise_for_status(r) + content_length = r.headers.get("Content-Length") + total = resume_size + int(content_length) if content_length is not None else None + progress = tqdm( + unit="B", + unit_scale=True, + total=total, + initial=resume_size, + desc="Downloading", + disable=bool(logger.getEffectiveLevel() == logging.NOTSET), + ) + for chunk in r.iter_content(chunk_size=1024): + if chunk: # filter out keep-alive new chunks + progress.update(len(chunk)) + temp_file.write(chunk) + progress.close() + + +@validate_hf_hub_args +def cached_download( + url: str, + *, + library_name: Optional[str] = None, + library_version: Optional[str] = None, + cache_dir: Union[str, Path, None] = None, + user_agent: Union[Dict, str, None] = None, + force_download: bool = False, + force_filename: Optional[str] = None, + proxies: Optional[Dict] = None, + etag_timeout: float = 10, + resume_download: bool = False, + token: Union[bool, str, None] = None, + local_files_only: bool = False, + legacy_cache_layout: bool = False, +) -> Optional[str]: # pragma: no cover + """ + Download from a given URL and cache it if it's not already present in the + local cache. + + Given a URL, this function looks for the corresponding file in the local + cache. If it's not there, download it. Then return the path to the cached + file. + + Will raise errors tailored to the Hugging Face Hub. + + Args: + url (`str`): + The path to the file to be downloaded. + library_name (`str`, *optional*): + The name of the library to which the object corresponds. + library_version (`str`, *optional*): + The version of the library. + cache_dir (`str`, `Path`, *optional*): + Path to the folder where cached files are stored. + user_agent (`dict`, `str`, *optional*): + The user-agent info in the form of a dictionary or a string. + force_download (`bool`, *optional*, defaults to `False`): + Whether the file should be downloaded even if it already exists in + the local cache. + force_filename (`str`, *optional*): + Use this name instead of a generated file name. + proxies (`dict`, *optional*): + Dictionary mapping protocol to the URL of the proxy passed to + `requests.request`. + etag_timeout (`float`, *optional* defaults to `10`): + When fetching ETag, how many seconds to wait for the server to send + data before giving up which is passed to `requests.request`. + resume_download (`bool`, *optional*, defaults to `False`): + If `True`, resume a previously interrupted download. + token (`bool`, `str`, *optional*): + A token to be used for the download. + - If `True`, the token is read from the HuggingFace config + folder. + - If a string, it's used as the authentication token. + local_files_only (`bool`, *optional*, defaults to `False`): + If `True`, avoid downloading the file and return the path to the + local cached file if it exists. + legacy_cache_layout (`bool`, *optional*, defaults to `False`): + Set this parameter to `True` to mention that you'd like to continue + the old cache layout. Putting this to `True` manually will not raise + any warning when using `cached_download`. We recommend using + `hf_hub_download` to take advantage of the new cache. + + Returns: + Local path (string) of file or if networking is off, last version of + file cached on disk. + + + + Raises the following errors: + + - [`EnvironmentError`](https://docs.python.org/3/library/exceptions.html#EnvironmentError) + if `token=True` and the token cannot be found. + - [`OSError`](https://docs.python.org/3/library/exceptions.html#OSError) + if ETag cannot be determined. + - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) + if some parameter value is invalid + - [`~utils.RepositoryNotFoundError`] + If the repository to download from cannot be found. This may be because it doesn't exist, + or because it is set to `private` and you do not have access. + - [`~utils.RevisionNotFoundError`] + If the revision to download from cannot be found. + - [`~utils.EntryNotFoundError`] + If the file to download cannot be found. + - [`~utils.LocalEntryNotFoundError`] + If network is disabled or unavailable and file is not found in cache. + + + """ + if not legacy_cache_layout: + warnings.warn( + "`cached_download` is the legacy way to download files from the HF hub," + " please consider upgrading to `hf_hub_download`", + FutureWarning, + ) + + if cache_dir is None: + cache_dir = HUGGINGFACE_HUB_CACHE + if isinstance(cache_dir, Path): + cache_dir = str(cache_dir) + + os.makedirs(cache_dir, exist_ok=True) + + headers = build_hf_headers( + token=token, + library_name=library_name, + library_version=library_version, + user_agent=user_agent, + ) + + url_to_download = url + etag = None + if not local_files_only: + try: + r = _request_wrapper( + method="HEAD", + url=url, + headers=headers, + allow_redirects=False, + follow_relative_redirects=True, + proxies=proxies, + timeout=etag_timeout, + ) + hf_raise_for_status(r) + etag = r.headers.get("X-Linked-Etag") or r.headers.get("ETag") + # We favor a custom header indicating the etag of the linked resource, and + # we fallback to the regular etag header. + # If we don't have any of those, raise an error. + if etag is None: + raise OSError( + "Distant resource does not have an ETag, we won't be able to" + " reliably ensure reproducibility." + ) + # In case of a redirect, save an extra redirect on the request.get call, + # and ensure we download the exact atomic version even if it changed + # between the HEAD and the GET (unlikely, but hey). + # Useful for lfs blobs that are stored on a CDN. + if 300 <= r.status_code <= 399: + url_to_download = r.headers["Location"] + except (requests.exceptions.SSLError, requests.exceptions.ProxyError): + # Actually raise for those subclasses of ConnectionError + raise + except ( + requests.exceptions.ConnectionError, + requests.exceptions.Timeout, + OfflineModeIsEnabled, + ): + # Otherwise, our Internet connection is down. + # etag is None + pass + + filename = ( + force_filename if force_filename is not None else url_to_filename(url, etag) + ) + + # get cache path to put the file + cache_path = os.path.join(cache_dir, filename) + + # etag is None == we don't have a connection or we passed local_files_only. + # try to get the last downloaded one + if etag is None: + if os.path.exists(cache_path) and not force_download: + return cache_path + else: + matching_files = [ + file + for file in fnmatch.filter( + os.listdir(cache_dir), filename.split(".")[0] + ".*" + ) + if not file.endswith(".json") and not file.endswith(".lock") + ] + if ( + len(matching_files) > 0 + and not force_download + and force_filename is None + ): + return os.path.join(cache_dir, matching_files[-1]) + else: + # If files cannot be found and local_files_only=True, + # the models might've been found if local_files_only=False + # Notify the user about that + if local_files_only: + raise LocalEntryNotFoundError( + "Cannot find the requested files in the cached path and" + " outgoing traffic has been disabled. To enable model look-ups" + " and downloads online, set 'local_files_only' to False." + ) + else: + raise LocalEntryNotFoundError( + "Connection error, and we cannot find the requested files in" + " the cached path. Please try again or make sure your Internet" + " connection is on." + ) + + # From now on, etag is not None. + if os.path.exists(cache_path) and not force_download: + return cache_path + + # Prevent parallel downloads of the same file with a lock. + lock_path = cache_path + ".lock" + + # Some Windows versions do not allow for paths longer than 255 characters. + # In this case, we must specify it is an extended path by using the "\\?\" prefix. + if os.name == "nt" and len(os.path.abspath(lock_path)) > 255: + lock_path = "\\\\?\\" + os.path.abspath(lock_path) + + if os.name == "nt" and len(os.path.abspath(cache_path)) > 255: + cache_path = "\\\\?\\" + os.path.abspath(cache_path) + + with FileLock(lock_path): + # If the download just completed while the lock was activated. + if os.path.exists(cache_path) and not force_download: + # Even if returning early like here, the lock will be released. + return cache_path + + if resume_download: + incomplete_path = cache_path + ".incomplete" + + @contextmanager + def _resumable_file_manager() -> Generator[io.BufferedWriter, None, None]: + with open(incomplete_path, "ab") as f: + yield f + + temp_file_manager = _resumable_file_manager + if os.path.exists(incomplete_path): + resume_size = os.stat(incomplete_path).st_size + else: + resume_size = 0 + else: + temp_file_manager = partial( # type: ignore + tempfile.NamedTemporaryFile, mode="wb", dir=cache_dir, delete=False + ) + resume_size = 0 + + # Download to temporary file, then copy to cache dir once finished. + # Otherwise you get corrupt cache entries if the download gets interrupted. + with temp_file_manager() as temp_file: + logger.info("downloading %s to %s", url, temp_file.name) + + http_get( + url_to_download, + temp_file, + proxies=proxies, + resume_size=resume_size, + headers=headers, + ) + + logger.info("storing %s in cache at %s", url, cache_path) + _chmod_and_replace(temp_file.name, cache_path) + + if force_filename is None: + logger.info("creating metadata file for %s", cache_path) + meta = {"url": url, "etag": etag} + meta_path = cache_path + ".json" + with open(meta_path, "w") as meta_file: + json.dump(meta, meta_file) + + return cache_path + + +def _normalize_etag(etag: Optional[str]) -> Optional[str]: + """Normalize ETag HTTP header, so it can be used to create nice filepaths. + + The HTTP spec allows two forms of ETag: + ETag: W/"" + ETag: "" + + The hf.co hub guarantees to only send the second form. + + Args: + etag (`str`, *optional*): HTTP header + + Returns: + `str` or `None`: string that can be used as a nice directory name. + Returns `None` if input is None. + """ + if etag is None: + return None + return etag.strip('"') + + +def _create_relative_symlink(src: str, dst: str, new_blob: bool = False) -> None: + """Create a symbolic link named dst pointing to src as a relative path to dst. + + The relative part is mostly because it seems more elegant to the author. + + The result layout looks something like + └── [ 128] snapshots + ├── [ 128] 2439f60ef33a0d46d85da5001d52aeda5b00ce9f + │ ├── [ 52] README.md -> ../../blobs/d7edf6bd2a681fb0175f7735299831ee1b22b812 + │ └── [ 76] pytorch_model.bin -> ../../blobs/403450e234d65943a7dcf7e05a771ce3c92faa84dd07db4ac20f592037a1e4bd + + If symlinks cannot be created on this platform (most likely to be Windows), the + workaround is to avoid symlinks by having the actual file in `dst`. If it is a new + file (`new_blob=True`), we move it to `dst`. If it is not a new file + (`new_blob=False`), we don't know if the blob file is already referenced elsewhere. + To avoid breaking existing cache, the file is duplicated on the disk. + + In case symlinks are not supported, a warning message is displayed to the user once + when loading `huggingface_hub`. The warning message can be disable with the + `DISABLE_SYMLINKS_WARNING` environment variable. + """ + try: + os.remove(dst) + except OSError: + pass + + cache_dir = os.path.dirname(os.path.commonpath([src, dst])) + if are_symlinks_supported(cache_dir=cache_dir): + relative_src = os.path.relpath(src, start=os.path.dirname(dst)) + try: + os.symlink(relative_src, dst) + except FileExistsError: + if os.path.islink(dst) and os.path.realpath(dst) == os.path.realpath(src): + # `dst` already exists and is a symlink to the `src` blob. It is most + # likely that the file has been cached twice concurrently (exactly + # between `os.remove` and `os.symlink`). Do nothing. + pass + else: + # Very unlikely to happen. Means a file `dst` has been created exactly + # between `os.remove` and `os.symlink` and is not a symlink to the `src` + # blob file. Raise exception. + raise + elif new_blob: + os.replace(src, dst) + else: + shutil.copyfile(src, dst) + + +def _cache_commit_hash_for_specific_revision( + storage_folder: str, revision: str, commit_hash: str +) -> None: + """Cache reference between a revision (tag, branch or truncated commit hash) and the corresponding commit hash. + + Does nothing if `revision` is already a proper `commit_hash` or reference is already cached. + """ + if revision != commit_hash: + ref_path = os.path.join(storage_folder, "refs", revision) + os.makedirs(os.path.dirname(ref_path), exist_ok=True) + with open(ref_path, "w") as f: + f.write(commit_hash) + + +@validate_hf_hub_args +def repo_folder_name(*, repo_id: str, repo_type: str) -> str: + """Return a serialized version of a hf.co repo name and type, safe for disk storage + as a single non-nested folder. + + Example: models--julien-c--EsperBERTo-small + """ + # remove all `/` occurrences to correctly convert repo to directory name + parts = [f"{repo_type}s", *repo_id.split("/")] + return REPO_ID_SEPARATOR.join(parts) + + +@validate_hf_hub_args +def hf_hub_download( + repo_id: str, + filename: str, + *, + subfolder: Optional[str] = None, + repo_type: Optional[str] = None, + revision: Optional[str] = None, + library_name: Optional[str] = None, + library_version: Optional[str] = None, + cache_dir: Union[str, Path, None] = None, + user_agent: Union[Dict, str, None] = None, + force_download: bool = False, + force_filename: Optional[str] = None, + proxies: Optional[Dict] = None, + etag_timeout: float = 10, + resume_download: bool = False, + token: Union[bool, str, None] = None, + local_files_only: bool = False, + legacy_cache_layout: bool = False, +): + """Download a given file if it's not already present in the local cache. + + The new cache file layout looks like this: + - The cache directory contains one subfolder per repo_id (namespaced by repo type) + - inside each repo folder: + - refs is a list of the latest known revision => commit_hash pairs + - blobs contains the actual file blobs (identified by their git-sha or sha256, depending on + whether they're LFS files or not) + - snapshots contains one subfolder per commit, each "commit" contains the subset of the files + that have been resolved at that particular commit. Each filename is a symlink to the blob + at that particular commit. + + ``` + [ 96] . + └── [ 160] models--julien-c--EsperBERTo-small + ├── [ 160] blobs + │ ├── [321M] 403450e234d65943a7dcf7e05a771ce3c92faa84dd07db4ac20f592037a1e4bd + │ ├── [ 398] 7cb18dc9bafbfcf74629a4b760af1b160957a83e + │ └── [1.4K] d7edf6bd2a681fb0175f7735299831ee1b22b812 + ├── [ 96] refs + │ └── [ 40] main + └── [ 128] snapshots + ├── [ 128] 2439f60ef33a0d46d85da5001d52aeda5b00ce9f + │ ├── [ 52] README.md -> ../../blobs/d7edf6bd2a681fb0175f7735299831ee1b22b812 + │ └── [ 76] pytorch_model.bin -> ../../blobs/403450e234d65943a7dcf7e05a771ce3c92faa84dd07db4ac20f592037a1e4bd + └── [ 128] bbc77c8132af1cc5cf678da3f1ddf2de43606d48 + ├── [ 52] README.md -> ../../blobs/7cb18dc9bafbfcf74629a4b760af1b160957a83e + └── [ 76] pytorch_model.bin -> ../../blobs/403450e234d65943a7dcf7e05a771ce3c92faa84dd07db4ac20f592037a1e4bd + ``` + + Args: + repo_id (`str`): + A user or an organization name and a repo name separated by a `/`. + filename (`str`): + The name of the file in the repo. + subfolder (`str`, *optional*): + An optional value corresponding to a folder inside the model repo. + repo_type (`str`, *optional*): + Set to `"dataset"` or `"space"` if uploading to a dataset or space, + `None` or `"model"` if uploading to a model. Default is `None`. + revision (`str`, *optional*): + An optional Git revision id which can be a branch name, a tag, or a + commit hash. + library_name (`str`, *optional*): + The name of the library to which the object corresponds. + library_version (`str`, *optional*): + The version of the library. + cache_dir (`str`, `Path`, *optional*): + Path to the folder where cached files are stored. + user_agent (`dict`, `str`, *optional*): + The user-agent info in the form of a dictionary or a string. + force_download (`bool`, *optional*, defaults to `False`): + Whether the file should be downloaded even if it already exists in + the local cache. + proxies (`dict`, *optional*): + Dictionary mapping protocol to the URL of the proxy passed to + `requests.request`. + etag_timeout (`float`, *optional*, defaults to `10`): + When fetching ETag, how many seconds to wait for the server to send + data before giving up which is passed to `requests.request`. + resume_download (`bool`, *optional*, defaults to `False`): + If `True`, resume a previously interrupted download. + token (`str`, `bool`, *optional*): + A token to be used for the download. + - If `True`, the token is read from the HuggingFace config + folder. + - If a string, it's used as the authentication token. + local_files_only (`bool`, *optional*, defaults to `False`): + If `True`, avoid downloading the file and return the path to the + local cached file if it exists. + legacy_cache_layout (`bool`, *optional*, defaults to `False`): + If `True`, uses the legacy file cache layout i.e. just call [`hf_hub_url`] + then `cached_download`. This is deprecated as the new cache layout is + more powerful. + + Returns: + Local path (string) of file or if networking is off, last version of + file cached on disk. + + + + Raises the following errors: + + - [`EnvironmentError`](https://docs.python.org/3/library/exceptions.html#EnvironmentError) + if `token=True` and the token cannot be found. + - [`OSError`](https://docs.python.org/3/library/exceptions.html#OSError) + if ETag cannot be determined. + - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) + if some parameter value is invalid + - [`~utils.RepositoryNotFoundError`] + If the repository to download from cannot be found. This may be because it doesn't exist, + or because it is set to `private` and you do not have access. + - [`~utils.RevisionNotFoundError`] + If the revision to download from cannot be found. + - [`~utils.EntryNotFoundError`] + If the file to download cannot be found. + - [`~utils.LocalEntryNotFoundError`] + If network is disabled or unavailable and file is not found in cache. + + + """ + if force_filename is not None: + warnings.warn( + "The `force_filename` parameter is deprecated as a new caching system, " + "which keeps the filenames as they are on the Hub, is now in place.", + FutureWarning, + ) + legacy_cache_layout = True + + if legacy_cache_layout: + url = hf_hub_url( + repo_id, + filename, + subfolder=subfolder, + repo_type=repo_type, + revision=revision, + ) + + return cached_download( + url, + library_name=library_name, + library_version=library_version, + cache_dir=cache_dir, + user_agent=user_agent, + force_download=force_download, + force_filename=force_filename, + proxies=proxies, + etag_timeout=etag_timeout, + resume_download=resume_download, + token=token, + local_files_only=local_files_only, + legacy_cache_layout=legacy_cache_layout, + ) + + if cache_dir is None: + cache_dir = HUGGINGFACE_HUB_CACHE + if revision is None: + revision = DEFAULT_REVISION + if isinstance(cache_dir, Path): + cache_dir = str(cache_dir) + + if subfolder == "": + subfolder = None + if subfolder is not None: + # This is used to create a URL, and not a local path, hence the forward slash. + filename = f"{subfolder}/{filename}" + + if repo_type is None: + repo_type = "model" + if repo_type not in REPO_TYPES: + raise ValueError( + f"Invalid repo type: {repo_type}. Accepted repo types are:" + f" {str(REPO_TYPES)}" + ) + + storage_folder = os.path.join( + cache_dir, repo_folder_name(repo_id=repo_id, repo_type=repo_type) + ) + os.makedirs(storage_folder, exist_ok=True) + + # cross platform transcription of filename, to be used as a local file path. + relative_filename = os.path.join(*filename.split("/")) + + # if user provides a commit_hash and they already have the file on disk, + # shortcut everything. + if REGEX_COMMIT_HASH.match(revision): + pointer_path = os.path.join( + storage_folder, "snapshots", revision, relative_filename + ) + if os.path.exists(pointer_path): + return pointer_path + + url = hf_hub_url(repo_id, filename, repo_type=repo_type, revision=revision) + + headers = build_hf_headers( + token=token, + library_name=library_name, + library_version=library_version, + user_agent=user_agent, + ) + + url_to_download = url + etag = None + commit_hash = None + if not local_files_only: + try: + try: + metadata = get_hf_file_metadata( + url=url, + token=token, + proxies=proxies, + timeout=etag_timeout, + ) + except EntryNotFoundError as http_error: + # Cache the non-existence of the file and raise + commit_hash = http_error.response.headers.get( + HUGGINGFACE_HEADER_X_REPO_COMMIT + ) + if commit_hash is not None and not legacy_cache_layout: + no_exist_file_path = ( + Path(storage_folder) + / ".no_exist" + / commit_hash + / relative_filename + ) + no_exist_file_path.parent.mkdir(parents=True, exist_ok=True) + no_exist_file_path.touch() + _cache_commit_hash_for_specific_revision( + storage_folder, revision, commit_hash + ) + raise + + # Commit hash must exist + commit_hash = metadata.commit_hash + if commit_hash is None: + raise OSError( + "Distant resource does not seem to be on huggingface.co (missing" + " commit header)." + ) + + # Etag must exist + etag = metadata.etag + # We favor a custom header indicating the etag of the linked resource, and + # we fallback to the regular etag header. + # If we don't have any of those, raise an error. + if etag is None: + raise OSError( + "Distant resource does not have an ETag, we won't be able to" + " reliably ensure reproducibility." + ) + + # In case of a redirect, save an extra redirect on the request.get call, + # and ensure we download the exact atomic version even if it changed + # between the HEAD and the GET (unlikely, but hey). + # Useful for lfs blobs that are stored on a CDN. + if metadata.location != url: + url_to_download = metadata.location + if ( + "lfs.huggingface.co" in url_to_download + or "lfs-staging.huggingface.co" in url_to_download + ): + # Remove authorization header when downloading a LFS blob + headers.pop("authorization", None) + except (requests.exceptions.SSLError, requests.exceptions.ProxyError): + # Actually raise for those subclasses of ConnectionError + raise + except ( + requests.exceptions.ConnectionError, + requests.exceptions.Timeout, + OfflineModeIsEnabled, + ): + # Otherwise, our Internet connection is down. + # etag is None + pass + + # etag is None == we don't have a connection or we passed local_files_only. + # try to get the last downloaded one from the specified revision. + # If the specified revision is a commit hash, look inside "snapshots". + # If the specified revision is a branch or tag, look inside "refs". + if etag is None: + # In those cases, we cannot force download. + if force_download: + raise ValueError( + "We have no connection or you passed local_files_only, so" + " force_download is not an accepted option." + ) + if REGEX_COMMIT_HASH.match(revision): + commit_hash = revision + else: + ref_path = os.path.join(storage_folder, "refs", revision) + with open(ref_path) as f: + commit_hash = f.read() + + pointer_path = os.path.join( + storage_folder, "snapshots", commit_hash, relative_filename + ) + if os.path.exists(pointer_path): + return pointer_path + + # If we couldn't find an appropriate file on disk, + # raise an error. + # If files cannot be found and local_files_only=True, + # the models might've been found if local_files_only=False + # Notify the user about that + if local_files_only: + raise LocalEntryNotFoundError( + "Cannot find the requested files in the disk cache and" + " outgoing traffic has been disabled. To enable hf.co look-ups" + " and downloads online, set 'local_files_only' to False." + ) + else: + raise LocalEntryNotFoundError( + "Connection error, and we cannot find the requested files in" + " the disk cache. Please try again or make sure your Internet" + " connection is on." + ) + + # From now on, etag and commit_hash are not None. + assert etag is not None, "etag must have been retrieved from server" + assert commit_hash is not None, "commit_hash must have been retrieved from server" + blob_path = os.path.join(storage_folder, "blobs", etag) + pointer_path = os.path.join( + storage_folder, "snapshots", commit_hash, relative_filename + ) + + os.makedirs(os.path.dirname(blob_path), exist_ok=True) + os.makedirs(os.path.dirname(pointer_path), exist_ok=True) + # if passed revision is not identical to commit_hash + # then revision has to be a branch name or tag name. + # In that case store a ref. + _cache_commit_hash_for_specific_revision(storage_folder, revision, commit_hash) + + if os.path.exists(pointer_path) and not force_download: + return pointer_path + + if os.path.exists(blob_path) and not force_download: + # we have the blob already, but not the pointer + logger.info("creating pointer to %s from %s", blob_path, pointer_path) + _create_relative_symlink(blob_path, pointer_path, new_blob=False) + return pointer_path + + # Prevent parallel downloads of the same file with a lock. + lock_path = blob_path + ".lock" + + # Some Windows versions do not allow for paths longer than 255 characters. + # In this case, we must specify it is an extended path by using the "\\?\" prefix. + if os.name == "nt" and len(os.path.abspath(lock_path)) > 255: + lock_path = "\\\\?\\" + os.path.abspath(lock_path) + + if os.name == "nt" and len(os.path.abspath(blob_path)) > 255: + blob_path = "\\\\?\\" + os.path.abspath(blob_path) + + with FileLock(lock_path): + # If the download just completed while the lock was activated. + if os.path.exists(pointer_path) and not force_download: + # Even if returning early like here, the lock will be released. + return pointer_path + + if resume_download: + incomplete_path = blob_path + ".incomplete" + + @contextmanager + def _resumable_file_manager() -> Generator[io.BufferedWriter, None, None]: + with open(incomplete_path, "ab") as f: + yield f + + temp_file_manager = _resumable_file_manager + if os.path.exists(incomplete_path): + resume_size = os.stat(incomplete_path).st_size + else: + resume_size = 0 + else: + temp_file_manager = partial( # type: ignore + tempfile.NamedTemporaryFile, mode="wb", dir=cache_dir, delete=False + ) + resume_size = 0 + + # Download to temporary file, then copy to cache dir once finished. + # Otherwise you get corrupt cache entries if the download gets interrupted. + with temp_file_manager() as temp_file: + logger.info("downloading %s to %s", url, temp_file.name) + + http_get( + url_to_download, + temp_file, + proxies=proxies, + resume_size=resume_size, + headers=headers, + ) + + logger.info("storing %s in cache at %s", url, blob_path) + _chmod_and_replace(temp_file.name, blob_path) + + logger.info("creating pointer to %s from %s", blob_path, pointer_path) + _create_relative_symlink(blob_path, pointer_path, new_blob=True) + + try: + os.remove(lock_path) + except OSError: + pass + + return pointer_path + + +@validate_hf_hub_args +def try_to_load_from_cache( + repo_id: str, + filename: str, + cache_dir: Union[str, Path, None] = None, + revision: Optional[str] = None, + repo_type: Optional[str] = None, +) -> Union[str, _CACHED_NO_EXIST_T, None]: + """ + Explores the cache to return the latest cached file for a given revision if found. + + This function will not raise any exception if the file in not cached. + + Args: + cache_dir (`str` or `os.PathLike`): + The folder where the cached files lie. + repo_id (`str`): + The ID of the repo on huggingface.co. + filename (`str`): + The filename to look for inside `repo_id`. + revision (`str`, *optional*): + The specific model version to use. Will default to `"main"` if it's not provided and no `commit_hash` is + provided either. + repo_type (`str`, *optional*): + The type of the repository. Will default to `"model"`. + + Returns: + `Optional[str]` or `_CACHED_NO_EXIST`: + Will return `None` if the file was not cached. Otherwise: + - The exact path to the cached file if it's found in the cache + - A special value `_CACHED_NO_EXIST` if the file does not exist at the given commit hash and this fact was + cached. + """ + if revision is None: + revision = "main" + if repo_type is None: + repo_type = "model" + if repo_type not in REPO_TYPES: + raise ValueError( + f"Invalid repo type: {repo_type}. Accepted repo types are:" + f" {str(REPO_TYPES)}" + ) + if cache_dir is None: + cache_dir = HUGGINGFACE_HUB_CACHE + + object_id = repo_id.replace("/", "--") + repo_cache = os.path.join(cache_dir, f"{repo_type}s--{object_id}") + if not os.path.isdir(repo_cache): + # No cache for this model + return None + for subfolder in ["refs", "snapshots"]: + if not os.path.isdir(os.path.join(repo_cache, subfolder)): + return None + + # Resolve refs (for instance to convert main to the associated commit sha) + cached_refs = os.listdir(os.path.join(repo_cache, "refs")) + if revision in cached_refs: + with open(os.path.join(repo_cache, "refs", revision)) as f: + revision = f.read() + + if os.path.isfile(os.path.join(repo_cache, ".no_exist", revision, filename)): + return _CACHED_NO_EXIST + + cached_shas = os.listdir(os.path.join(repo_cache, "snapshots")) + if revision not in cached_shas: + # No cache for this revision and we won't try to return a random revision + return None + + cached_file = os.path.join(repo_cache, "snapshots", revision, filename) + return cached_file if os.path.isfile(cached_file) else None + + +@validate_hf_hub_args +def get_hf_file_metadata( + url: str, + token: Union[bool, str, None] = None, + proxies: Optional[Dict] = None, + timeout: float = 10, +) -> HfFileMetadata: + """Fetch metadata of a file versioned on the Hub for a given url. + + Args: + url (`str`): + File url, for example returned by [`hf_hub_url`]. + token (`str` or `bool`, *optional*): + A token to be used for the download. + - If `True`, the token is read from the HuggingFace config + folder. + - If `False` or `None`, no token is provided. + - If a string, it's used as the authentication token. + proxies (`dict`, *optional*): + Dictionary mapping protocol to the URL of the proxy passed to + `requests.request`. + timeout (`float`, *optional*, defaults to 10): + How many seconds to wait for the server to send metadata before giving up. + + Returns: + A [`HfFileMetadata`] object containing metadata such as location, etag, size and + commit_hash. + """ + headers = build_hf_headers(token=token) + + # Retrieve metadata + r = _request_wrapper( + method="HEAD", + url=url, + headers=headers, + allow_redirects=False, + follow_relative_redirects=True, + proxies=proxies, + timeout=timeout, + ) + hf_raise_for_status(r) + + # Return + return HfFileMetadata( + commit_hash=r.headers.get(HUGGINGFACE_HEADER_X_REPO_COMMIT), + etag=_normalize_etag( + # We favor a custom header indicating the etag of the linked resource, and + # we fallback to the regular etag header. + r.headers.get("ETag") + or r.headers.get(HUGGINGFACE_HEADER_X_LINKED_ETAG) + ), + # Either from response headers (if redirected) or defaults to request url + # Do not use directly `url`, as `_request_wrapper` might have followed relative + # redirects. + location=r.headers.get("Location") or r.request.url, # type: ignore + size=_int_or_none( + r.headers.get(HUGGINGFACE_HEADER_X_LINKED_SIZE) + or r.headers.get("Content-Length") + ), + ) + + +def _int_or_none(value: Optional[str]) -> Optional[int]: + try: + return int(value) # type: ignore + except (TypeError, ValueError): + return None + + +def _chmod_and_replace(src: str, dst: str) -> None: + """Set correct permission before moving a blob from tmp directory to cache dir. + + Do not take into account the `umask` from the process as there is no convenient way + to get it that is thread-safe. + + See: + - About umask: https://docs.python.org/3/library/os.html#os.umask + - Thread-safety: https://stackoverflow.com/a/70343066 + - About solution: https://github.com/huggingface/huggingface_hub/pull/1220#issuecomment-1326211591 + - Fix issue: https://github.com/huggingface/huggingface_hub/issues/1141 + - Fix issue: https://github.com/huggingface/huggingface_hub/issues/1215 + """ + # Get umask by creating a temporary file in the cached repo folder. + tmp_file = Path(dst).parent.parent / f"tmp_{uuid.uuid4()}" + try: + tmp_file.touch() + cache_dir_mode = Path(tmp_file).stat().st_mode + os.chmod(src, stat.S_IMODE(cache_dir_mode)) + finally: + tmp_file.unlink() + + os.replace(src, dst) diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/hf_api.py b/.local/lib/python3.10/site-packages/huggingface_hub/hf_api.py new file mode 100644 index 0000000000000000000000000000000000000000..3cb9013d56a5b07ffc50504869ede61e08137ce8 --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/hf_api.py @@ -0,0 +1,3510 @@ +# coding=utf-8 +# Copyright 2019-present, the HuggingFace Inc. team. +# +# 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. +import json +import os +import re +import warnings +from dataclasses import dataclass, field +from itertools import islice +from pathlib import Path +from typing import Any, BinaryIO, Dict, Iterable, Iterator, List, Optional, Tuple, Union +from urllib.parse import quote + +import requests +from huggingface_hub.utils import EntryNotFoundError, RepositoryNotFoundError +from requests.exceptions import HTTPError + +from ._commit_api import ( + CommitOperation, + CommitOperationAdd, + CommitOperationDelete, + fetch_upload_modes, + prepare_commit_payload, + upload_lfs_files, + warn_on_overwriting_operations, +) +from .community import ( + Discussion, + DiscussionComment, + DiscussionStatusChange, + DiscussionTitleChange, + DiscussionWithDetails, + deserialize_event, +) +from .constants import ( + DEFAULT_REVISION, + ENDPOINT, + REGEX_COMMIT_OID, + REPO_TYPE_MODEL, + REPO_TYPES, + REPO_TYPES_MAPPING, + REPO_TYPES_URL_PREFIXES, + SPACES_SDK_TYPES, +) +from .utils import ( # noqa: F401 # imported for backward compatibility + HfFolder, + HfHubHTTPError, + build_hf_headers, + erase_from_credential_store, + filter_repo_objects, + hf_raise_for_status, + logging, + parse_datetime, + read_from_credential_store, + validate_hf_hub_args, + write_to_credential_store, +) +from .utils._deprecation import ( + _deprecate_arguments, + _deprecate_list_output, + _deprecate_method, + _deprecate_positional_args, +) +from .utils._pagination import paginate +from .utils._typing import Literal, TypedDict +from .utils.endpoint_helpers import ( + AttributeDictionary, + DatasetFilter, + DatasetTags, + ModelFilter, + ModelTags, + _filter_emissions, +) + + +USERNAME_PLACEHOLDER = "hf_user" +_REGEX_DISCUSSION_URL = re.compile(r".*/discussions/(\d+)$") + +logger = logging.get_logger(__name__) + + +def repo_type_and_id_from_hf_id( + hf_id: str, hub_url: Optional[str] = None +) -> Tuple[Optional[str], Optional[str], str]: + """ + Returns the repo type and ID from a huggingface.co URL linking to a + repository + + Args: + hf_id (`str`): + An URL or ID of a repository on the HF hub. Accepted values are: + + - https://huggingface.co/// + - https://huggingface.co// + - // + - / + - + hub_url (`str`, *optional*): + The URL of the HuggingFace Hub, defaults to https://huggingface.co + + Returns: + A tuple with three items: repo_type (`str` or `None`), namespace (`str` or + `None`) and repo_id (`str`). + """ + hub_url = re.sub(r"https?://", "", hub_url if hub_url is not None else ENDPOINT) + is_hf_url = hub_url in hf_id and "@" not in hf_id + url_segments = hf_id.split("/") + is_hf_id = len(url_segments) <= 3 + + namespace: Optional[str] + if is_hf_url: + namespace, repo_id = url_segments[-2:] + if namespace == hub_url: + namespace = None + if len(url_segments) > 2 and hub_url not in url_segments[-3]: + repo_type = url_segments[-3] + else: + repo_type = None + elif is_hf_id: + if len(url_segments) == 3: + # Passed // or // + repo_type, namespace, repo_id = url_segments[-3:] + elif len(url_segments) == 2: + # Passed / or / + namespace, repo_id = hf_id.split("/")[-2:] + repo_type = None + else: + # Passed + repo_id = url_segments[0] + namespace, repo_type = None, None + else: + raise ValueError( + f"Unable to retrieve user and repo ID from the passed HF ID: {hf_id}" + ) + + if repo_type not in REPO_TYPES: + assert repo_type is not None, "repo_type `None` do not have mapping" + repo_type = REPO_TYPES_MAPPING.get(repo_type) + + return repo_type, namespace, repo_id + + +class BlobLfsInfo(TypedDict, total=False): + size: int + sha256: str + + +@dataclass +class CommitInfo: + """Data structure containing information about a newly created commit. + + Returned by [`create_commit`]. + + Args: + commit_url (`str`): + Url where to find the commit. + + commit_message (`str`): + The summary (first line) of the commit that has been created. + + commit_description (`str`): + Description of the commit that has been created. Can be empty. + + oid (`str`): + Commit hash id. Example: `"91c54ad1727ee830252e457677f467be0bfd8a57"`. + + pr_url (`str`, *optional*): + Url to the PR that has been created, if any. Populated when `create_pr=True` + is passed. + + pr_revision (`str`, *optional*): + Revision of the PR that has been created, if any. Populated when + `create_pr=True` is passed. Example: `"refs/pr/1"`. + + pr_num (`int`, *optional*): + Number of the PR discussion that has been created, if any. Populated when + `create_pr=True` is passed. Can be passed as `discussion_num` in + [`get_discussion_details`]. Example: `1`. + """ + + commit_url: str + commit_message: str + commit_description: str + oid: str + pr_url: Optional[str] = None + + # Computed from `pr_url` in `__post_init__` + pr_revision: Optional[str] = field(init=False) + pr_num: Optional[str] = field(init=False) + + def __post_init__(self): + """Populate pr-related fields after initialization. + + See https://docs.python.org/3.10/library/dataclasses.html#post-init-processing. + """ + if self.pr_url is not None: + self.pr_revision = _parse_revision_from_pr_url(self.pr_url) + self.pr_num = int(self.pr_revision.split("/")[-1]) + else: + self.pr_revision = None + self.pr_num = None + + +class RepoFile: + """ + Data structure that represents a public file inside a repo, accessible from + huggingface.co + + Args: + rfilename (str): + file name, relative to the repo root. This is the only attribute + that's guaranteed to be here, but under certain conditions there can + certain other stuff. + size (`int`, *optional*): + The file's size, in bytes. This attribute is present when `files_metadata` argument + of [`repo_info`] is set to `True`. It's `None` otherwise. + blob_id (`str`, *optional*): + The file's git OID. This attribute is present when `files_metadata` argument + of [`repo_info`] is set to `True`. It's `None` otherwise. + lfs (`BlobLfsInfo`, *optional*): + The file's LFS metadata. This attribute is present when`files_metadata` argument + of [`repo_info`] is set to `True` and the file is stored with Git LFS. It's `None` otherwise. + """ + + def __init__( + self, + rfilename: str, + size: Optional[int] = None, + blobId: Optional[str] = None, + lfs: Optional[BlobLfsInfo] = None, + **kwargs, + ): + self.rfilename = rfilename # filename relative to the repo root + + # Optional file metadata + self.size = size + self.blob_id = blobId + self.lfs = lfs + + # Hack to ensure backward compatibility with future versions of the API. + # See discussion in https://github.com/huggingface/huggingface_hub/pull/951#discussion_r926460408 + for k, v in kwargs.items(): + setattr(self, k, v) + + def __repr__(self): + items = (f"{k}='{v}'" for k, v in self.__dict__.items()) + return f"{self.__class__.__name__}({', '.join(items)})" + + +class ModelInfo: + """ + Info about a model accessible from huggingface.co + + Attributes: + modelId (`str`, *optional*): + ID of model repository. + sha (`str`, *optional*): + repo sha at this particular revision + lastModified (`str`, *optional*): + date of last commit to repo + tags (`List[str]`, *optional*): + List of tags. + pipeline_tag (`str`, *optional*): + Pipeline tag to identify the correct widget. + siblings (`List[RepoFile]`, *optional*): + list of ([`huggingface_hub.hf_api.RepoFile`]) objects that constitute the model. + private (`bool`, *optional*, defaults to `False`): + is the repo private + author (`str`, *optional*): + repo author + config (`Dict`, *optional*): + Model configuration information + securityStatus (`Dict`, *optional*): + Security status of the model. + Example: `{"containsInfected": False}` + kwargs (`Dict`, *optional*): + Kwargs that will be become attributes of the class. + """ + + def __init__( + self, + *, + modelId: Optional[str] = None, + sha: Optional[str] = None, + lastModified: Optional[str] = None, + tags: Optional[List[str]] = None, + pipeline_tag: Optional[str] = None, + siblings: Optional[List[Dict]] = None, + private: bool = False, + author: Optional[str] = None, + config: Optional[Dict] = None, + securityStatus: Optional[Dict] = None, + **kwargs, + ): + self.modelId = modelId + self.sha = sha + self.lastModified = lastModified + self.tags = tags + self.pipeline_tag = pipeline_tag + self.siblings = ( + [RepoFile(**x) for x in siblings] if siblings is not None else [] + ) + self.private = private + self.author = author + self.config = config + self.securityStatus = securityStatus + for k, v in kwargs.items(): + setattr(self, k, v) + + def __repr__(self): + s = f"{self.__class__.__name__}:" + " {" + for key, val in self.__dict__.items(): + s += f"\n\t{key}: {val}" + return s + "\n}" + + def __str__(self): + r = f"Model Name: {self.modelId}, Tags: {self.tags}" + if self.pipeline_tag: + r += f", Task: {self.pipeline_tag}" + return r + + +class DatasetInfo: + """ + Info about a dataset accessible from huggingface.co + + Attributes: + id (`str`, *optional*): + ID of dataset repository. + sha (`str`, *optional*): + repo sha at this particular revision + lastModified (`str`, *optional*): + date of last commit to repo + tags (`Listr[str]`, *optional*): + List of tags. + siblings (`List[RepoFile]`, *optional*): + list of [`huggingface_hub.hf_api.RepoFile`] objects that constitute the dataset. + private (`bool`, *optional*, defaults to `False`): + is the repo private + author (`str`, *optional*): + repo author + description (`str`, *optional*): + Description of the dataset + citation (`str`, *optional*): + Dataset citation + cardData (`Dict`, *optional*): + Metadata of the model card as a dictionary. + kwargs (`Dict`, *optional*): + Kwargs that will be become attributes of the class. + """ + + def __init__( + self, + *, + id: Optional[str] = None, + sha: Optional[str] = None, + lastModified: Optional[str] = None, + tags: Optional[List[str]] = None, + siblings: Optional[List[Dict]] = None, + private: bool = False, + author: Optional[str] = None, + description: Optional[str] = None, + citation: Optional[str] = None, + cardData: Optional[dict] = None, + **kwargs, + ): + self.id = id + self.sha = sha + self.lastModified = lastModified + self.tags = tags + self.private = private + self.author = author + self.description = description + self.citation = citation + self.cardData = cardData + self.siblings = ( + [RepoFile(**x) for x in siblings] if siblings is not None else [] + ) + # Legacy stuff, "key" is always returned with an empty string + # because of old versions of the datasets lib that need this field + kwargs.pop("key", None) + # Store all the other fields returned by the API + for k, v in kwargs.items(): + setattr(self, k, v) + + def __repr__(self): + s = f"{self.__class__.__name__}:" + " {" + for key, val in self.__dict__.items(): + s += f"\n\t{key}: {val}" + return s + "\n}" + + def __str__(self): + r = f"Dataset Name: {self.id}, Tags: {self.tags}" + return r + + +class SpaceInfo: + """ + Info about a Space accessible from huggingface.co + + This is a "dataclass" like container that just sets on itself any attribute + passed by the server. + + Attributes: + id (`str`, *optional*): + id of space + sha (`str`, *optional*): + repo sha at this particular revision + lastModified (`str`, *optional*): + date of last commit to repo + siblings (`List[RepoFile]`, *optional*): + list of [`huggingface_hub.hf_api.RepoFIle`] objects that constitute the Space + private (`bool`, *optional*, defaults to `False`): + is the repo private + author (`str`, *optional*): + repo author + kwargs (`Dict`, *optional*): + Kwargs that will be become attributes of the class. + """ + + def __init__( + self, + *, + id: Optional[str] = None, + sha: Optional[str] = None, + lastModified: Optional[str] = None, + siblings: Optional[List[Dict]] = None, + private: bool = False, + author: Optional[str] = None, + **kwargs, + ): + self.id = id + self.sha = sha + self.lastModified = lastModified + self.siblings = ( + [RepoFile(**x) for x in siblings] if siblings is not None else [] + ) + self.private = private + self.author = author + for k, v in kwargs.items(): + setattr(self, k, v) + + def __repr__(self): + s = f"{self.__class__.__name__}:" + " {" + for key, val in self.__dict__.items(): + s += f"\n\t{key}: {val}" + return s + "\n}" + + +class MetricInfo: + """ + Info about a public metric accessible from huggingface.co + """ + + def __init__( + self, + *, + id: Optional[str] = None, # id of metric + description: Optional[str] = None, + citation: Optional[str] = None, + **kwargs, + ): + self.id = id + self.description = description + self.citation = citation + # Legacy stuff, "key" is always returned with an empty string + # because of old versions of the datasets lib that need this field + kwargs.pop("key", None) + # Store all the other fields returned by the API + for k, v in kwargs.items(): + setattr(self, k, v) + + def __repr__(self): + s = f"{self.__class__.__name__}:" + " {" + for key, val in self.__dict__.items(): + s += f"\n\t{key}: {val}" + return s + "\n}" + + def __str__(self): + r = f"Metric Name: {self.id}" + return r + + +class ModelSearchArguments(AttributeDictionary): + """ + A nested namespace object holding all possible values for properties of + models currently hosted in the Hub with tab-completion. If a value starts + with a number, it will only exist in the dictionary + + Example: + + ```python + >>> args = ModelSearchArguments() + >>> args.author_or_organization.huggingface + >>> args.language.en + ``` + """ + + def __init__(self, api: Optional["HfApi"] = None): + self._api = api if api is not None else HfApi() + tags = self._api.get_model_tags() + super().__init__(tags) + self._process_models() + + def _process_models(self): + def clean(s: str) -> str: + return s.replace(" ", "").replace("-", "_").replace(".", "_") + + models = self._api.list_models() + author_dict, model_name_dict = AttributeDictionary(), AttributeDictionary() + for model in models: + if "/" in model.modelId: + author, name = model.modelId.split("/") + author_dict[author] = clean(author) + else: + name = model.modelId + model_name_dict[name] = clean(name) + self["model_name"] = model_name_dict + self["author"] = author_dict + + +class DatasetSearchArguments(AttributeDictionary): + """ + A nested namespace object holding all possible values for properties of + datasets currently hosted in the Hub with tab-completion. If a value starts + with a number, it will only exist in the dictionary + + Example: + + ```python + >>> args = DatasetSearchArguments() + >>> args.author_or_organization.huggingface + >>> args.language.en + ``` + """ + + def __init__(self, api: Optional["HfApi"] = None): + self._api = api if api is not None else HfApi() + tags = self._api.get_dataset_tags() + super().__init__(tags) + self._process_models() + + def _process_models(self): + def clean(s: str): + return s.replace(" ", "").replace("-", "_").replace(".", "_") + + datasets = self._api.list_datasets() + author_dict, dataset_name_dict = AttributeDictionary(), AttributeDictionary() + for dataset in datasets: + if "/" in dataset.id: + author, name = dataset.id.split("/") + author_dict[author] = clean(author) + else: + name = dataset.id + dataset_name_dict[name] = clean(name) + self["dataset_name"] = dataset_name_dict + self["author"] = author_dict + + +class HfApi: + def __init__( + self, endpoint: Optional[str] = None, token: Optional[str] = None + ) -> None: + self.endpoint = endpoint if endpoint is not None else ENDPOINT + self.token = token + + def whoami(self, token: Optional[str] = None) -> Dict: + """ + Call HF API to know "whoami". + + Args: + token (`str`, *optional*): + Hugging Face token. Will default to the locally saved token if + not provided. + """ + r = requests.get( + f"{self.endpoint}/api/whoami-v2", + headers=self._build_hf_headers( + # If `token` is provided and not `None`, it will be used by default. + # Otherwise, the token must be retrieved from cache or env variable. + token=(token or self.token or True), + ), + ) + try: + hf_raise_for_status(r) + except HTTPError as e: + raise HTTPError( + "Invalid user token. If you didn't pass a user token, make sure you " + "are properly logged in by executing `huggingface-cli login`, and " + "if you did pass a user token, double-check it's correct." + ) from e + return r.json() + + def _is_valid_token(self, token: str) -> bool: + """ + Determines whether `token` is a valid token or not. + + Args: + token (`str`): + The token to check for validity. + + Returns: + `bool`: `True` if valid, `False` otherwise. + """ + try: + self.whoami(token=token) + return True + except HTTPError: + return False + + @staticmethod + @_deprecate_method( + version="0.14", + message=( + "`HfApi.set_access_token` is deprecated as it is very ambiguous. Use" + " `login` or `set_git_credential` instead." + ), + ) + def set_access_token(access_token: str): + """ + Saves the passed access token so git can correctly authenticate the + user. + + Args: + access_token (`str`): + The access token to save. + """ + write_to_credential_store(USERNAME_PLACEHOLDER, access_token) + + @staticmethod + @_deprecate_method( + version="0.14", + message=( + "`HfApi.unset_access_token` is deprecated as it is very ambiguous. Use" + " `login` or `unset_git_credential` instead." + ), + ) + def unset_access_token(): + """ + Resets the user's access token. + """ + erase_from_credential_store(USERNAME_PLACEHOLDER) + + def get_model_tags(self) -> ModelTags: + "Gets all valid model tags as a nested namespace object" + path = f"{self.endpoint}/api/models-tags-by-type" + r = requests.get(path) + hf_raise_for_status(r) + d = r.json() + return ModelTags(d) + + def get_dataset_tags(self) -> DatasetTags: + """ + Gets all valid dataset tags as a nested namespace object. + """ + path = f"{self.endpoint}/api/datasets-tags-by-type" + r = requests.get(path) + hf_raise_for_status(r) + d = r.json() + return DatasetTags(d) + + @_deprecate_list_output(version="0.14") + @validate_hf_hub_args + def list_models( + self, + *, + filter: Union[ModelFilter, str, Iterable[str], None] = None, + author: Optional[str] = None, + search: Optional[str] = None, + emissions_thresholds: Optional[Tuple[float, float]] = None, + sort: Union[Literal["lastModified"], str, None] = None, + direction: Optional[Literal[-1]] = None, + limit: Optional[int] = None, + full: Optional[bool] = None, + cardData: bool = False, + fetch_config: bool = False, + token: Optional[Union[bool, str]] = None, + ) -> List[ModelInfo]: + """ + Get the list of all the models on huggingface.co + + Args: + filter ([`ModelFilter`] or `str` or `Iterable`, *optional*): + A string or [`ModelFilter`] which can be used to identify models + on the Hub. + author (`str`, *optional*): + A string which identify the author (user or organization) of the + returned models + search (`str`, *optional*): + A string that will be contained in the returned models Example + usage: + emissions_thresholds (`Tuple`, *optional*): + A tuple of two ints or floats representing a minimum and maximum + carbon footprint to filter the resulting models with in grams. + sort (`Literal["lastModified"]` or `str`, *optional*): + The key with which to sort the resulting models. Possible values + are the properties of the [`huggingface_hub.hf_api.ModelInfo`] class. + direction (`Literal[-1]` or `int`, *optional*): + Direction in which to sort. The value `-1` sorts by descending + order while all other values sort by ascending order. + limit (`int`, *optional*): + The limit on the number of models fetched. Leaving this option + to `None` fetches all models. + full (`bool`, *optional*): + Whether to fetch all model data, including the `lastModified`, + the `sha`, the files and the `tags`. This is set to `True` by + default when using a filter. + cardData (`bool`, *optional*): + Whether to grab the metadata for the model as well. Can contain + useful information such as carbon emissions, metrics, and + datasets trained on. + fetch_config (`bool`, *optional*): + Whether to fetch the model configs as well. This is not included + in `full` due to its size. + token (`bool` or `str`, *optional*): + A valid authentication token (see https://huggingface.co/settings/token). + If `None` or `True` and machine is logged in (through `huggingface-cli login` + or [`~huggingface_hub.login`]), token will be retrieved from the cache. + If `False`, token is not sent in the request header. + + Returns: + `List[ModelInfo]`: a list of [`huggingface_hub.hf_api.ModelInfo`] objects. + To anticipate future pagination, please consider the return value to be a + simple iterator. + + Example usage with the `filter` argument: + + ```python + >>> from huggingface_hub import HfApi + + >>> api = HfApi() + + >>> # List all models + >>> api.list_models() + + >>> # Get all valid search arguments + >>> args = ModelSearchArguments() + + >>> # List only the text classification models + >>> api.list_models(filter="text-classification") + >>> # Using the `ModelFilter` + >>> filt = ModelFilter(task="text-classification") + >>> # With `ModelSearchArguments` + >>> filt = ModelFilter(task=args.pipeline_tags.TextClassification) + >>> api.list_models(filter=filt) + + >>> # Using `ModelFilter` and `ModelSearchArguments` to find text classification in both PyTorch and TensorFlow + >>> filt = ModelFilter( + ... task=args.pipeline_tags.TextClassification, + ... library=[args.library.PyTorch, args.library.TensorFlow], + ... ) + >>> api.list_models(filter=filt) + + >>> # List only models from the AllenNLP library + >>> api.list_models(filter="allennlp") + >>> # Using `ModelFilter` and `ModelSearchArguments` + >>> filt = ModelFilter(library=args.library.allennlp) + ``` + + Example usage with the `search` argument: + + ```python + >>> from huggingface_hub import HfApi + + >>> api = HfApi() + + >>> # List all models with "bert" in their name + >>> api.list_models(search="bert") + + >>> # List all models with "bert" in their name made by google + >>> api.list_models(search="bert", author="google") + ``` + """ + path = f"{self.endpoint}/api/models" + headers = self._build_hf_headers(token=token) + params = {} + if filter is not None: + if isinstance(filter, ModelFilter): + params = self._unpack_model_filter(filter) + else: + params.update({"filter": filter}) + params.update({"full": True}) + if author is not None: + params.update({"author": author}) + if search is not None: + params.update({"search": search}) + if sort is not None: + params.update({"sort": sort}) + if direction is not None: + params.update({"direction": direction}) + if limit is not None: + params.update({"limit": limit}) + if full is not None: + if full: + params.update({"full": True}) + elif "full" in params: + del params["full"] + if fetch_config: + params.update({"config": True}) + if cardData: + params.update({"cardData": True}) + + data = paginate(path, params=params, headers=headers) + if limit is not None: + data = islice(data, limit) # Do not iterate over all pages + items = [ModelInfo(**x) for x in data] + + if emissions_thresholds is not None: + if cardData is None: + raise ValueError( + "`emissions_thresholds` were passed without setting" + " `cardData=True`." + ) + else: + return _filter_emissions(items, *emissions_thresholds) + + return items + + def _unpack_model_filter(self, model_filter: ModelFilter): + """ + Unpacks a [`ModelFilter`] into something readable for `list_models` + """ + model_str = "" + tags = [] + + # Handling author + if model_filter.author is not None: + model_str = f"{model_filter.author}/" + + # Handling model_name + if model_filter.model_name is not None: + model_str += model_filter.model_name + + filter_list: List[str] = [] + + # Handling tasks + if model_filter.task is not None: + filter_list.extend( + [model_filter.task] + if isinstance(model_filter.task, str) + else model_filter.task + ) + + # Handling dataset + if model_filter.trained_dataset is not None: + if not isinstance(model_filter.trained_dataset, (list, tuple)): + model_filter.trained_dataset = [model_filter.trained_dataset] + for dataset in model_filter.trained_dataset: + if "dataset:" not in dataset: + dataset = f"dataset:{dataset}" + filter_list.append(dataset) + + # Handling library + if model_filter.library: + filter_list.extend( + [model_filter.library] + if isinstance(model_filter.library, str) + else model_filter.library + ) + + # Handling tags + if model_filter.tags: + tags.extend( + [model_filter.tags] + if isinstance(model_filter.tags, str) + else model_filter.tags + ) + + query_dict: Dict[str, Any] = {} + if model_str is not None: + query_dict["search"] = model_str + if len(tags) > 0: + query_dict["tags"] = tags + if isinstance(model_filter.language, list): + filter_list.extend(model_filter.language) + elif isinstance(model_filter.language, str): + filter_list.append(model_filter.language) + query_dict["filter"] = tuple(filter_list) + return query_dict + + @_deprecate_arguments( + version="0.14", + deprecated_args={"cardData"}, + custom_message="Use 'full' instead.", + ) + @_deprecate_list_output(version="0.14") + @validate_hf_hub_args + def list_datasets( + self, + *, + filter: Union[DatasetFilter, str, Iterable[str], None] = None, + author: Optional[str] = None, + search: Optional[str] = None, + sort: Union[Literal["lastModified"], str, None] = None, + direction: Optional[Literal[-1]] = None, + limit: Optional[int] = None, + cardData: Optional[bool] = None, # deprecated + full: Optional[bool] = None, + token: Optional[str] = None, + ) -> List[DatasetInfo]: + """ + Get the list of all the datasets on huggingface.co + + Args: + filter ([`DatasetFilter`] or `str` or `Iterable`, *optional*): + A string or [`DatasetFilter`] which can be used to identify + datasets on the hub. + author (`str`, *optional*): + A string which identify the author of the returned datasets. + search (`str`, *optional*): + A string that will be contained in the returned datasets. + sort (`Literal["lastModified"]` or `str`, *optional*): + The key with which to sort the resulting datasets. Possible + values are the properties of the [`huggingface_hub.hf_api.DatasetInfo`] class. + direction (`Literal[-1]` or `int`, *optional*): + Direction in which to sort. The value `-1` sorts by descending + order while all other values sort by ascending order. + limit (`int`, *optional*): + The limit on the number of datasets fetched. Leaving this option + to `None` fetches all datasets. + full (`bool`, *optional*): + Whether to fetch all dataset data, including the `lastModified` + and the `cardData`. Can contain useful information such as the + PapersWithCode ID. + token (`bool` or `str`, *optional*): + A valid authentication token (see https://huggingface.co/settings/token). + If `None` or `True` and machine is logged in (through `huggingface-cli login` + or [`~huggingface_hub.login`]), token will be retrieved from the cache. + If `False`, token is not sent in the request header. + + Returns: + `List[DatasetInfo]`: a list of [`huggingface_hub.hf_api.DatasetInfo`] objects. + To anticipate future pagination, please consider the return value to be a + simple iterator. + + Example usage with the `filter` argument: + + ```python + >>> from huggingface_hub import HfApi + + >>> api = HfApi() + + >>> # List all datasets + >>> api.list_datasets() + + >>> # Get all valid search arguments + >>> args = DatasetSearchArguments() + + >>> # List only the text classification datasets + >>> api.list_datasets(filter="task_categories:text-classification") + >>> # Using the `DatasetFilter` + >>> filt = DatasetFilter(task_categories="text-classification") + >>> # With `DatasetSearchArguments` + >>> filt = DatasetFilter(task=args.task_categories.text_classification) + >>> api.list_models(filter=filt) + + >>> # List only the datasets in russian for language modeling + >>> api.list_datasets( + ... filter=("language:ru", "task_ids:language-modeling") + ... ) + >>> # Using the `DatasetFilter` + >>> filt = DatasetFilter(language="ru", task_ids="language-modeling") + >>> # With `DatasetSearchArguments` + >>> filt = DatasetFilter( + ... language=args.language.ru, + ... task_ids=args.task_ids.language_modeling, + ... ) + >>> api.list_datasets(filter=filt) + ``` + + Example usage with the `search` argument: + + ```python + >>> from huggingface_hub import HfApi + + >>> api = HfApi() + + >>> # List all datasets with "text" in their name + >>> api.list_datasets(search="text") + + >>> # List all datasets with "text" in their name made by google + >>> api.list_datasets(search="text", author="google") + ``` + """ + path = f"{self.endpoint}/api/datasets" + headers = self._build_hf_headers(token=token) + params = {} + if filter is not None: + if isinstance(filter, DatasetFilter): + params = self._unpack_dataset_filter(filter) + else: + params.update({"filter": filter}) + if author is not None: + params.update({"author": author}) + if search is not None: + params.update({"search": search}) + if sort is not None: + params.update({"sort": sort}) + if direction is not None: + params.update({"direction": direction}) + if limit is not None: + params.update({"limit": limit}) + if full or cardData: + params.update({"full": True}) + + data = paginate(path, params=params, headers=headers) + if limit is not None: + data = islice(data, limit) # Do not iterate over all pages + return [DatasetInfo(**x) for x in data] + + def _unpack_dataset_filter(self, dataset_filter: DatasetFilter): + """ + Unpacks a [`DatasetFilter`] into something readable for `list_datasets` + """ + dataset_str = "" + + # Handling author + if dataset_filter.author is not None: + dataset_str = f"{dataset_filter.author}/" + + # Handling dataset_name + if dataset_filter.dataset_name is not None: + dataset_str += dataset_filter.dataset_name + + filter_list = [] + data_attributes = [ + "benchmark", + "language_creators", + "language", + "multilinguality", + "size_categories", + "task_categories", + "task_ids", + ] + + for attr in data_attributes: + curr_attr = getattr(dataset_filter, attr) + if curr_attr is not None: + if not isinstance(curr_attr, (list, tuple)): + curr_attr = [curr_attr] + for data in curr_attr: + if f"{attr}:" not in data: + data = f"{attr}:{data}" + filter_list.append(data) + + query_dict: Dict[str, Any] = {} + if dataset_str is not None: + query_dict["search"] = dataset_str + query_dict["filter"] = tuple(filter_list) + return query_dict + + def list_metrics(self) -> List[MetricInfo]: + """ + Get the public list of all the metrics on huggingface.co + + Returns: + `List[MetricInfo]`: a list of [`MetricInfo`] objects which. + """ + path = f"{self.endpoint}/api/metrics" + r = requests.get(path) + hf_raise_for_status(r) + d = r.json() + return [MetricInfo(**x) for x in d] + + @_deprecate_list_output(version="0.14") + @validate_hf_hub_args + def list_spaces( + self, + *, + filter: Union[str, Iterable[str], None] = None, + author: Optional[str] = None, + search: Optional[str] = None, + sort: Union[Literal["lastModified"], str, None] = None, + direction: Optional[Literal[-1]] = None, + limit: Optional[int] = None, + datasets: Union[str, Iterable[str], None] = None, + models: Union[str, Iterable[str], None] = None, + linked: bool = False, + full: Optional[bool] = None, + token: Optional[str] = None, + ) -> List[SpaceInfo]: + """ + Get the public list of all Spaces on huggingface.co + + Args: + filter `str` or `Iterable`, *optional*): + A string tag or list of tags that can be used to identify Spaces on the Hub. + author (`str`, *optional*): + A string which identify the author of the returned Spaces. + search (`str`, *optional*): + A string that will be contained in the returned Spaces. + sort (`Literal["lastModified"]` or `str`, *optional*): + The key with which to sort the resulting Spaces. Possible + values are the properties of the [`huggingface_hub.hf_api.SpaceInfo`]` class. + direction (`Literal[-1]` or `int`, *optional*): + Direction in which to sort. The value `-1` sorts by descending + order while all other values sort by ascending order. + limit (`int`, *optional*): + The limit on the number of Spaces fetched. Leaving this option + to `None` fetches all Spaces. + datasets (`str` or `Iterable`, *optional*): + Whether to return Spaces that make use of a dataset. + The name of a specific dataset can be passed as a string. + models (`str` or `Iterable`, *optional*): + Whether to return Spaces that make use of a model. + The name of a specific model can be passed as a string. + linked (`bool`, *optional*): + Whether to return Spaces that make use of either a model or a dataset. + full (`bool`, *optional*): + Whether to fetch all Spaces data, including the `lastModified` + and the `cardData`. + token (`bool` or `str`, *optional*): + A valid authentication token (see https://huggingface.co/settings/token). + If `None` or `True` and machine is logged in (through `huggingface-cli login` + or [`~huggingface_hub.login`]), token will be retrieved from the cache. + If `False`, token is not sent in the request header. + + Returns: + `List[SpaceInfo]`: a list of [`huggingface_hub.hf_api.SpaceInfo`] objects. + To anticipate future pagination, please consider the return value to be a + simple iterator. + """ + path = f"{self.endpoint}/api/spaces" + headers = self._build_hf_headers(token=token) + params: Dict[str, Any] = {} + if filter is not None: + params.update({"filter": filter}) + if author is not None: + params.update({"author": author}) + if search is not None: + params.update({"search": search}) + if sort is not None: + params.update({"sort": sort}) + if direction is not None: + params.update({"direction": direction}) + if limit is not None: + params.update({"limit": limit}) + if full: + params.update({"full": True}) + if linked: + params.update({"linked": True}) + if datasets is not None: + params.update({"datasets": datasets}) + if models is not None: + params.update({"models": models}) + + data = paginate(path, params=params, headers=headers) + if limit is not None: + data = islice(data, limit) # Do not iterate over all pages + return [SpaceInfo(**x) for x in data] + + @validate_hf_hub_args + def model_info( + self, + repo_id: str, + *, + revision: Optional[str] = None, + timeout: Optional[float] = None, + securityStatus: Optional[bool] = None, + files_metadata: bool = False, + token: Optional[Union[bool, str]] = None, + ) -> ModelInfo: + """ + Get info on one specific model on huggingface.co + + Model can be private if you pass an acceptable token or are logged in. + + Args: + repo_id (`str`): + A namespace (user or an organization) and a repo name separated + by a `/`. + revision (`str`, *optional*): + The revision of the model repository from which to get the + information. + timeout (`float`, *optional*): + Whether to set a timeout for the request to the Hub. + securityStatus (`bool`, *optional*): + Whether to retrieve the security status from the model + repository as well. + files_metadata (`bool`, *optional*): + Whether or not to retrieve metadata for files in the repository + (size, LFS metadata, etc). Defaults to `False`. + token (`bool` or `str`, *optional*): + A valid authentication token (see https://huggingface.co/settings/token). + If `None` or `True` and machine is logged in (through `huggingface-cli login` + or [`~huggingface_hub.login`]), token will be retrieved from the cache. + If `False`, token is not sent in the request header. + + Returns: + [`huggingface_hub.hf_api.ModelInfo`]: The model repository information. + + + + Raises the following errors: + + - [`~utils.RepositoryNotFoundError`] + If the repository to download from cannot be found. This may be because it doesn't exist, + or because it is set to `private` and you do not have access. + - [`~utils.RevisionNotFoundError`] + If the revision to download from cannot be found. + + + """ + headers = self._build_hf_headers(token=token) + path = ( + f"{self.endpoint}/api/models/{repo_id}" + if revision is None + else ( + f"{self.endpoint}/api/models/{repo_id}/revision/{quote(revision, safe='')}" + ) + ) + params = {} + if securityStatus: + params["securityStatus"] = True + if files_metadata: + params["blobs"] = True + r = requests.get( + path, + headers=headers, + timeout=timeout, + params=params, + ) + hf_raise_for_status(r) + d = r.json() + return ModelInfo(**d) + + @validate_hf_hub_args + def dataset_info( + self, + repo_id: str, + *, + revision: Optional[str] = None, + timeout: Optional[float] = None, + files_metadata: bool = False, + token: Optional[Union[bool, str]] = None, + ) -> DatasetInfo: + """ + Get info on one specific dataset on huggingface.co. + + Dataset can be private if you pass an acceptable token. + + Args: + repo_id (`str`): + A namespace (user or an organization) and a repo name separated + by a `/`. + revision (`str`, *optional*): + The revision of the dataset repository from which to get the + information. + timeout (`float`, *optional*): + Whether to set a timeout for the request to the Hub. + files_metadata (`bool`, *optional*): + Whether or not to retrieve metadata for files in the repository + (size, LFS metadata, etc). Defaults to `False`. + token (`bool` or `str`, *optional*): + A valid authentication token (see https://huggingface.co/settings/token). + If `None` or `True` and machine is logged in (through `huggingface-cli login` + or [`~huggingface_hub.login`]), token will be retrieved from the cache. + If `False`, token is not sent in the request header. + + Returns: + [`hf_api.DatasetInfo`]: The dataset repository information. + + + + Raises the following errors: + + - [`~utils.RepositoryNotFoundError`] + If the repository to download from cannot be found. This may be because it doesn't exist, + or because it is set to `private` and you do not have access. + - [`~utils.RevisionNotFoundError`] + If the revision to download from cannot be found. + + + """ + headers = self._build_hf_headers(token=token) + path = ( + f"{self.endpoint}/api/datasets/{repo_id}" + if revision is None + else ( + f"{self.endpoint}/api/datasets/{repo_id}/revision/{quote(revision, safe='')}" + ) + ) + params = {} + if files_metadata: + params["blobs"] = True + + r = requests.get(path, headers=headers, timeout=timeout, params=params) + hf_raise_for_status(r) + d = r.json() + return DatasetInfo(**d) + + @validate_hf_hub_args + def space_info( + self, + repo_id: str, + *, + revision: Optional[str] = None, + timeout: Optional[float] = None, + files_metadata: bool = False, + token: Optional[Union[bool, str]] = None, + ) -> SpaceInfo: + """ + Get info on one specific Space on huggingface.co. + + Space can be private if you pass an acceptable token. + + Args: + repo_id (`str`): + A namespace (user or an organization) and a repo name separated + by a `/`. + revision (`str`, *optional*): + The revision of the space repository from which to get the + information. + timeout (`float`, *optional*): + Whether to set a timeout for the request to the Hub. + files_metadata (`bool`, *optional*): + Whether or not to retrieve metadata for files in the repository + (size, LFS metadata, etc). Defaults to `False`. + token (`bool` or `str`, *optional*): + A valid authentication token (see https://huggingface.co/settings/token). + If `None` or `True` and machine is logged in (through `huggingface-cli login` + or [`~huggingface_hub.login`]), token will be retrieved from the cache. + If `False`, token is not sent in the request header. + + Returns: + [`~hf_api.SpaceInfo`]: The space repository information. + + + + Raises the following errors: + + - [`~utils.RepositoryNotFoundError`] + If the repository to download from cannot be found. This may be because it doesn't exist, + or because it is set to `private` and you do not have access. + - [`~utils.RevisionNotFoundError`] + If the revision to download from cannot be found. + + + """ + headers = self._build_hf_headers(token=token) + path = ( + f"{self.endpoint}/api/spaces/{repo_id}" + if revision is None + else ( + f"{self.endpoint}/api/spaces/{repo_id}/revision/{quote(revision, safe='')}" + ) + ) + params = {} + if files_metadata: + params["blobs"] = True + + r = requests.get(path, headers=headers, timeout=timeout, params=params) + hf_raise_for_status(r) + d = r.json() + return SpaceInfo(**d) + + @validate_hf_hub_args + def repo_info( + self, + repo_id: str, + *, + revision: Optional[str] = None, + repo_type: Optional[str] = None, + timeout: Optional[float] = None, + files_metadata: bool = False, + token: Optional[Union[bool, str]] = None, + ) -> Union[ModelInfo, DatasetInfo, SpaceInfo]: + """ + Get the info object for a given repo of a given type. + + Args: + repo_id (`str`): + A namespace (user or an organization) and a repo name separated + by a `/`. + revision (`str`, *optional*): + The revision of the repository from which to get the + information. + timeout (`float`, *optional*): + Whether to set a timeout for the request to the Hub. + files_metadata (`bool`, *optional*): + Whether or not to retrieve metadata for files in the repository + (size, LFS metadata, etc). Defaults to `False`. + token (`bool` or `str`, *optional*): + A valid authentication token (see https://huggingface.co/settings/token). + If `None` or `True` and machine is logged in (through `huggingface-cli login` + or [`~huggingface_hub.login`]), token will be retrieved from the cache. + If `False`, token is not sent in the request header. + + Returns: + `Union[SpaceInfo, DatasetInfo, ModelInfo]`: The repository information, as a + [`huggingface_hub.hf_api.DatasetInfo`], [`huggingface_hub.hf_api.ModelInfo`] + or [`huggingface_hub.hf_api.SpaceInfo`] object. + + + + Raises the following errors: + + - [`~utils.RepositoryNotFoundError`] + If the repository to download from cannot be found. This may be because it doesn't exist, + or because it is set to `private` and you do not have access. + - [`~utils.RevisionNotFoundError`] + If the revision to download from cannot be found. + + + """ + if repo_type is None or repo_type == "model": + method = self.model_info + elif repo_type == "dataset": + method = self.dataset_info # type: ignore + elif repo_type == "space": + method = self.space_info # type: ignore + else: + raise ValueError("Unsupported repo type.") + return method( + repo_id, + revision=revision, + token=token, + timeout=timeout, + files_metadata=files_metadata, + ) + + @validate_hf_hub_args + def list_repo_files( + self, + repo_id: str, + *, + revision: Optional[str] = None, + repo_type: Optional[str] = None, + timeout: Optional[float] = None, + token: Optional[Union[bool, str]] = None, + ) -> List[str]: + """ + Get the list of files in a given repo. + + Args: + repo_id (`str`): + A namespace (user or an organization) and a repo name separated + by a `/`. + revision (`str`, *optional*): + The revision of the model repository from which to get the + information. + repo_type (`str`, *optional*): + Set to `"dataset"` or `"space"` if uploading to a dataset or + space, `None` or `"model"` if uploading to a model. Default is + `None`. + timeout (`float`, *optional*): + Whether to set a timeout for the request to the Hub. + token (`bool` or `str`, *optional*): + A valid authentication token (see https://huggingface.co/settings/token). + If `None` or `True` and machine is logged in (through `huggingface-cli login` + or [`~huggingface_hub.login`]), token will be retrieved from the cache. + If `False`, token is not sent in the request header. + + Returns: + `List[str]`: the list of files in a given repository. + """ + repo_info = self.repo_info( + repo_id, + revision=revision, + repo_type=repo_type, + token=token, + timeout=timeout, + ) + return [f.rfilename for f in repo_info.siblings] + + @validate_hf_hub_args + @_deprecate_positional_args(version="0.12") + def create_repo( + self, + repo_id: str, + *, + token: Optional[str] = None, + private: bool = False, + repo_type: Optional[str] = None, + exist_ok: bool = False, + space_sdk: Optional[str] = None, + ) -> str: + """Create an empty repo on the HuggingFace Hub. + + Args: + repo_id (`str`): + A namespace (user or an organization) and a repo name separated + by a `/`. + token (`str`, *optional*): + An authentication token (See https://huggingface.co/settings/token) + private (`bool`, *optional*, defaults to `False`): + Whether the model repo should be private. + repo_type (`str`, *optional*): + Set to `"dataset"` or `"space"` if uploading to a dataset or + space, `None` or `"model"` if uploading to a model. Default is + `None`. + exist_ok (`bool`, *optional*, defaults to `False`): + If `True`, do not raise an error if repo already exists. + space_sdk (`str`, *optional*): + Choice of SDK to use if repo_type is "space". Can be + "streamlit", "gradio", or "static". + + Returns: + `str`: URL to the newly created repo. + """ + organization, name = repo_id.split("/") if "/" in repo_id else (None, repo_id) + + path = f"{self.endpoint}/api/repos/create" + + if repo_type not in REPO_TYPES: + raise ValueError("Invalid repo type") + + json = {"name": name, "organization": organization, "private": private} + if repo_type is not None: + json["type"] = repo_type + if repo_type == "space": + if space_sdk is None: + raise ValueError( + "No space_sdk provided. `create_repo` expects space_sdk to be one" + f" of {SPACES_SDK_TYPES} when repo_type is 'space'`" + ) + if space_sdk not in SPACES_SDK_TYPES: + raise ValueError( + f"Invalid space_sdk. Please choose one of {SPACES_SDK_TYPES}." + ) + json["sdk"] = space_sdk + if space_sdk is not None and repo_type != "space": + warnings.warn( + "Ignoring provided space_sdk because repo_type is not 'space'." + ) + + if getattr(self, "_lfsmultipartthresh", None): + # Testing purposes only. + # See https://github.com/huggingface/huggingface_hub/pull/733/files#r820604472 + json["lfsmultipartthresh"] = self._lfsmultipartthresh # type: ignore + headers = self._build_hf_headers(token=token, is_write_action=True) + r = requests.post(path, headers=headers, json=json) + + try: + hf_raise_for_status(r) + except HTTPError as err: + if exist_ok and err.response.status_code == 409: + # Repo already exists and `exist_ok=True` + pass + else: + raise + + d = r.json() + return d["url"] + + @validate_hf_hub_args + def delete_repo( + self, + repo_id: str, + *, + token: Optional[str] = None, + repo_type: Optional[str] = None, + ): + """ + Delete a repo from the HuggingFace Hub. CAUTION: this is irreversible. + + Args: + repo_id (`str`): + A namespace (user or an organization) and a repo name separated + by a `/`. + token (`str`, *optional*): + An authentication token (See https://huggingface.co/settings/token) + repo_type (`str`, *optional*): + Set to `"dataset"` or `"space"` if uploading to a dataset or + space, `None` or `"model"` if uploading to a model. + + + + Raises the following errors: + + - [`~utils.RepositoryNotFoundError`] + If the repository to download from cannot be found. This may be because it doesn't exist, + or because it is set to `private` and you do not have access. + + + """ + organization, name = repo_id.split("/") if "/" in repo_id else (None, repo_id) + + path = f"{self.endpoint}/api/repos/delete" + + if repo_type not in REPO_TYPES: + raise ValueError("Invalid repo type") + + json = {"name": name, "organization": organization} + if repo_type is not None: + json["type"] = repo_type + + headers = self._build_hf_headers(token=token, is_write_action=True) + r = requests.delete(path, headers=headers, json=json) + hf_raise_for_status(r) + + @validate_hf_hub_args + def update_repo_visibility( + self, + repo_id: str, + private: bool = False, + *, + token: Optional[str] = None, + organization: Optional[str] = None, + repo_type: Optional[str] = None, + name: Optional[str] = None, + ) -> Dict[str, bool]: + """Update the visibility setting of a repository. + + Args: + repo_id (`str`, *optional*): + A namespace (user or an organization) and a repo name separated + by a `/`. + private (`bool`, *optional*, defaults to `False`): + Whether the model repo should be private. + token (`str`, *optional*): + An authentication token (See https://huggingface.co/settings/token) + repo_type (`str`, *optional*): + Set to `"dataset"` or `"space"` if uploading to a dataset or + space, `None` or `"model"` if uploading to a model. Default is + `None`. + + Returns: + The HTTP response in json. + + + + Raises the following errors: + + - [`~utils.RepositoryNotFoundError`] + If the repository to download from cannot be found. This may be because it doesn't exist, + or because it is set to `private` and you do not have access. + + + """ + if repo_type not in REPO_TYPES: + raise ValueError("Invalid repo type") + + organization, name = repo_id.split("/") if "/" in repo_id else (None, repo_id) + + if organization is None: + namespace = self.whoami(token)["name"] + else: + namespace = organization + + if repo_type is None: + repo_type = REPO_TYPE_MODEL # default repo type + + r = requests.put( + url=f"{self.endpoint}/api/{repo_type}s/{namespace}/{name}/settings", + headers=self._build_hf_headers(token=token, is_write_action=True), + json={"private": private}, + ) + hf_raise_for_status(r) + return r.json() + + def move_repo( + self, + from_id: str, + to_id: str, + *, + repo_type: Optional[str] = None, + token: Optional[str] = None, + ): + """ + Moving a repository from namespace1/repo_name1 to namespace2/repo_name2 + + Note there are certain limitations. For more information about moving + repositories, please see + https://hf.co/docs/hub/main#how-can-i-rename-or-transfer-a-repo. + + Args: + from_id (`str`): + A namespace (user or an organization) and a repo name separated + by a `/`. Original repository identifier. + to_id (`str`): + A namespace (user or an organization) and a repo name separated + by a `/`. Final repository identifier. + repo_type (`str`, *optional*): + Set to `"dataset"` or `"space"` if uploading to a dataset or + space, `None` or `"model"` if uploading to a model. Default is + `None`. + token (`str`, *optional*): + An authentication token (See https://huggingface.co/settings/token) + + + + Raises the following errors: + + - [`~utils.RepositoryNotFoundError`] + If the repository to download from cannot be found. This may be because it doesn't exist, + or because it is set to `private` and you do not have access. + + + """ + if len(from_id.split("/")) != 2: + raise ValueError( + f"Invalid repo_id: {from_id}. It should have a namespace" + " (:namespace:/:repo_name:)" + ) + + if len(to_id.split("/")) != 2: + raise ValueError( + f"Invalid repo_id: {to_id}. It should have a namespace" + " (:namespace:/:repo_name:)" + ) + + if repo_type is None: + repo_type = REPO_TYPE_MODEL # Hub won't accept `None`. + + json = {"fromRepo": from_id, "toRepo": to_id, "type": repo_type} + + path = f"{self.endpoint}/api/repos/move" + headers = self._build_hf_headers(token=token, is_write_action=True) + r = requests.post(path, headers=headers, json=json) + try: + hf_raise_for_status(r) + except HfHubHTTPError as e: + e.append_to_message( + "\nFor additional documentation please see" + " https://hf.co/docs/hub/main#how-can-i-rename-or-transfer-a-repo." + ) + raise + + @validate_hf_hub_args + def create_commit( + self, + repo_id: str, + operations: Iterable[CommitOperation], + *, + commit_message: str, + commit_description: Optional[str] = None, + token: Optional[str] = None, + repo_type: Optional[str] = None, + revision: Optional[str] = None, + create_pr: Optional[bool] = None, + num_threads: int = 5, + parent_commit: Optional[str] = None, + ) -> CommitInfo: + """ + Creates a commit in the given repo, deleting & uploading files as needed. + + Args: + repo_id (`str`): + The repository in which the commit will be created, for example: + `"username/custom_transformers"` + + operations (`Iterable` of [`~hf_api.CommitOperation`]): + An iterable of operations to include in the commit, either: + + - [`~hf_api.CommitOperationAdd`] to upload a file + - [`~hf_api.CommitOperationDelete`] to delete a file + + commit_message (`str`): + The summary (first line) of the commit that will be created. + + commit_description (`str`, *optional*): + The description of the commit that will be created + + token (`str`, *optional*): + Authentication token, obtained with `HfApi.login` method. Will + default to the stored token. + + repo_type (`str`, *optional*): + Set to `"dataset"` or `"space"` if uploading to a dataset or + space, `None` or `"model"` if uploading to a model. Default is + `None`. + + revision (`str`, *optional*): + The git revision to commit from. Defaults to the head of the `"main"` branch. + + create_pr (`boolean`, *optional*): + Whether or not to create a Pull Request with that commit. Defaults to `False`. + If `revision` is not set, PR is opened against the `"main"` branch. If + `revision` is set and is a branch, PR is opened against this branch. If + `revision` is set and is not a branch name (example: a commit oid), an + `RevisionNotFoundError` is returned by the server. + + num_threads (`int`, *optional*): + Number of concurrent threads for uploading files. Defaults to 5. + Setting it to 2 means at most 2 files will be uploaded concurrently. + + parent_commit (`str`, *optional*): + The OID / SHA of the parent commit, as a hexadecimal string. + Shorthands (7 first characters) are also supported.If specified and `create_pr` is `False`, + the commit will fail if `revision` does not point to `parent_commit`. If specified and `create_pr` + is `True`, the pull request will be created from `parent_commit`. Specifying `parent_commit` + ensures the repo has not changed before committing the changes, and can be especially useful + if the repo is updated / committed to concurrently. + + Returns: + [`CommitInfo`]: + Instance of [`CommitInfo`] containing information about the newly + created commit (commit hash, commit url, pr url, commit message,...). + + Raises: + [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) + If commit message is empty. + [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) + If parent commit is not a valid commit OID. + [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) + If the Hub API returns an HTTP 400 error (bad request) + [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) + If `create_pr` is `True` and revision is neither `None` nor `"main"`. + [`~utils.RepositoryNotFoundError`]: + If repository is not found (error 404): wrong repo_id/repo_type, private + but not authenticated or repo does not exist. + + + + `create_commit` assumes that the repo already exists on the Hub. If you get a + Client error 404, please make sure you are authenticated and that `repo_id` and + `repo_type` are set correctly. If repo does not exist, create it first using + [`~hf_api.create_repo`]. + + + + + + `create_commit` is limited to 25k LFS files and a 1GB payload for regular files. + + + """ + _CREATE_COMMIT_NO_REPO_ERROR_MESSAGE = ( + "\nNote: Creating a commit assumes that the repo already exists on the" + " Huggingface Hub. Please use `create_repo` if it's not the case." + ) + + if parent_commit is not None and not REGEX_COMMIT_OID.fullmatch(parent_commit): + raise ValueError( + "`parent_commit` is not a valid commit OID. It must match the" + f" following regex: {REGEX_COMMIT_OID}" + ) + + if commit_message is None or len(commit_message) == 0: + raise ValueError("`commit_message` can't be empty, please pass a value.") + + commit_description = ( + commit_description if commit_description is not None else "" + ) + repo_type = repo_type if repo_type is not None else REPO_TYPE_MODEL + if repo_type not in REPO_TYPES: + raise ValueError(f"Invalid repo type, must be one of {REPO_TYPES}") + revision = ( + quote(revision, safe="") if revision is not None else DEFAULT_REVISION + ) + create_pr = create_pr if create_pr is not None else False + + operations = list(operations) + additions = [op for op in operations if isinstance(op, CommitOperationAdd)] + nb_additions = len(additions) + nb_deletions = len(operations) - nb_additions + + logger.debug( + f"About to commit to the hub: {len(additions)} addition(s) and" + f" {nb_deletions} deletion(s)." + ) + + # If updating twice the same file or update then delete a file in a single commit + warn_on_overwriting_operations(operations) + + try: + upload_modes = fetch_upload_modes( + additions=additions, + repo_type=repo_type, + repo_id=repo_id, + token=token or self.token, + revision=revision, + endpoint=self.endpoint, + create_pr=create_pr, + ) + except RepositoryNotFoundError as e: + e.append_to_message(_CREATE_COMMIT_NO_REPO_ERROR_MESSAGE) + raise + + upload_lfs_files( + additions=[ + addition + for addition in additions + if upload_modes[addition.path_in_repo] == "lfs" + ], + repo_type=repo_type, + repo_id=repo_id, + token=token or self.token, + endpoint=self.endpoint, + num_threads=num_threads, + ) + commit_payload = prepare_commit_payload( + operations=operations, + upload_modes=upload_modes, + commit_message=commit_message, + commit_description=commit_description, + parent_commit=parent_commit, + ) + commit_url = f"{self.endpoint}/api/{repo_type}s/{repo_id}/commit/{revision}" + + def _payload_as_ndjson() -> Iterable[bytes]: + for item in commit_payload: + yield json.dumps(item).encode() + yield b"\n" + + headers = { + # See https://github.com/huggingface/huggingface_hub/issues/1085#issuecomment-1265208073 + "Content-Type": "application/x-ndjson", + **self._build_hf_headers(token=token, is_write_action=True), + } + + try: + commit_resp = requests.post( + url=commit_url, + headers=headers, + data=_payload_as_ndjson(), # type: ignore + params={"create_pr": "1"} if create_pr else None, + ) + hf_raise_for_status(commit_resp, endpoint_name="commit") + except RepositoryNotFoundError as e: + e.append_to_message(_CREATE_COMMIT_NO_REPO_ERROR_MESSAGE) + raise + except EntryNotFoundError as e: + if nb_deletions > 0 and "A file with this name doesn't exist" in str(e): + e.append_to_message( + "\nMake sure to differentiate file and folder paths in delete" + " operations with a trailing '/' or using `is_folder=True/False`." + ) + raise + + commit_data = commit_resp.json() + return CommitInfo( + commit_url=commit_data["commitUrl"], + commit_message=commit_message, + commit_description=commit_description, + oid=commit_data["commitOid"], + pr_url=commit_data["pullRequestUrl"] if create_pr else None, + ) + + @validate_hf_hub_args + def upload_file( + self, + *, + path_or_fileobj: Union[str, bytes, BinaryIO], + path_in_repo: str, + repo_id: str, + token: Optional[str] = None, + repo_type: Optional[str] = None, + revision: Optional[str] = None, + commit_message: Optional[str] = None, + commit_description: Optional[str] = None, + create_pr: Optional[bool] = None, + parent_commit: Optional[str] = None, + ) -> str: + """ + Upload a local file (up to 50 GB) to the given repo. The upload is done + through a HTTP post request, and doesn't require git or git-lfs to be + installed. + + Args: + path_or_fileobj (`str`, `bytes`, or `IO`): + Path to a file on the local machine or binary data stream / + fileobj / buffer. + path_in_repo (`str`): + Relative filepath in the repo, for example: + `"checkpoints/1fec34a/weights.bin"` + repo_id (`str`): + The repository to which the file will be uploaded, for example: + `"username/custom_transformers"` + token (`str`, *optional*): + Authentication token, obtained with `HfApi.login` method. Will + default to the stored token. + repo_type (`str`, *optional*): + Set to `"dataset"` or `"space"` if uploading to a dataset or + space, `None` or `"model"` if uploading to a model. Default is + `None`. + revision (`str`, *optional*): + The git revision to commit from. Defaults to the head of the `"main"` branch. + commit_message (`str`, *optional*): + The summary / title / first line of the generated commit + commit_description (`str` *optional*) + The description of the generated commit + create_pr (`boolean`, *optional*): + Whether or not to create a Pull Request with that commit. Defaults to `False`. + If `revision` is not set, PR is opened against the `"main"` branch. If + `revision` is set and is a branch, PR is opened against this branch. If + `revision` is set and is not a branch name (example: a commit oid), an + `RevisionNotFoundError` is returned by the server. + parent_commit (`str`, *optional*): + The OID / SHA of the parent commit, as a hexadecimal string. Shorthands (7 first characters) are also supported. + If specified and `create_pr` is `False`, the commit will fail if `revision` does not point to `parent_commit`. + If specified and `create_pr` is `True`, the pull request will be created from `parent_commit`. + Specifying `parent_commit` ensures the repo has not changed before committing the changes, and can be + especially useful if the repo is updated / committed to concurrently. + + + Returns: + `str`: The URL to visualize the uploaded file on the hub + + + + Raises the following errors: + + - [`HTTPError`](https://2.python-requests.org/en/master/api/#requests.HTTPError) + if the HuggingFace API returned an error + - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) + if some parameter value is invalid + - [`~utils.RepositoryNotFoundError`] + If the repository to download from cannot be found. This may be because it doesn't exist, + or because it is set to `private` and you do not have access. + - [`~utils.RevisionNotFoundError`] + If the revision to download from cannot be found. + + + + + + `upload_file` assumes that the repo already exists on the Hub. If you get a + Client error 404, please make sure you are authenticated and that `repo_id` and + `repo_type` are set correctly. If repo does not exist, create it first using + [`~hf_api.create_repo`]. + + + + Example: + + ```python + >>> from huggingface_hub import upload_file + + >>> with open("./local/filepath", "rb") as fobj: + ... upload_file( + ... path_or_fileobj=fileobj, + ... path_in_repo="remote/file/path.h5", + ... repo_id="username/my-dataset", + ... repo_type="dataset", + ... token="my_token", + ... ) + "https://huggingface.co/datasets/username/my-dataset/blob/main/remote/file/path.h5" + + >>> upload_file( + ... path_or_fileobj=".\\\\local\\\\file\\\\path", + ... path_in_repo="remote/file/path.h5", + ... repo_id="username/my-model", + ... token="my_token", + ... ) + "https://huggingface.co/username/my-model/blob/main/remote/file/path.h5" + + >>> upload_file( + ... path_or_fileobj=".\\\\local\\\\file\\\\path", + ... path_in_repo="remote/file/path.h5", + ... repo_id="username/my-model", + ... token="my_token", + ... create_pr=True, + ... ) + "https://huggingface.co/username/my-model/blob/refs%2Fpr%2F1/remote/file/path.h5" + ``` + """ + if repo_type not in REPO_TYPES: + raise ValueError(f"Invalid repo type, must be one of {REPO_TYPES}") + + commit_message = ( + commit_message + if commit_message is not None + else f"Upload {path_in_repo} with huggingface_hub" + ) + operation = CommitOperationAdd( + path_or_fileobj=path_or_fileobj, + path_in_repo=path_in_repo, + ) + + commit_info = self.create_commit( + repo_id=repo_id, + repo_type=repo_type, + operations=[operation], + commit_message=commit_message, + commit_description=commit_description, + token=token, + revision=revision, + create_pr=create_pr, + parent_commit=parent_commit, + ) + + if commit_info.pr_url is not None: + revision = quote(_parse_revision_from_pr_url(commit_info.pr_url), safe="") + if repo_type in REPO_TYPES_URL_PREFIXES: + repo_id = REPO_TYPES_URL_PREFIXES[repo_type] + repo_id + revision = revision if revision is not None else DEFAULT_REVISION + # Similar to `hf_hub_url` but it's "blob" instead of "resolve" + return f"{self.endpoint}/{repo_id}/blob/{revision}/{path_in_repo}" + + @validate_hf_hub_args + def upload_folder( + self, + *, + repo_id: str, + folder_path: Union[str, Path], + path_in_repo: Optional[str] = None, + commit_message: Optional[str] = None, + commit_description: Optional[str] = None, + token: Optional[str] = None, + repo_type: Optional[str] = None, + revision: Optional[str] = None, + create_pr: Optional[bool] = None, + parent_commit: Optional[str] = None, + allow_patterns: Optional[Union[List[str], str]] = None, + ignore_patterns: Optional[Union[List[str], str]] = None, + ): + """ + Upload a local folder to the given repo. The upload is done + through a HTTP requests, and doesn't require git or git-lfs to be + installed. + + The structure of the folder will be preserved. Files with the same name + already present in the repository will be overwritten, others will be left untouched. + + Use the `allow_patterns` and `ignore_patterns` arguments to specify which files + to upload. These parameters accept either a single pattern or a list of + patterns. Patterns are Standard Wildcards (globbing patterns) as documented + [here](https://tldp.org/LDP/GNU-Linux-Tools-Summary/html/x11655.htm). If both + `allow_patterns` and `ignore_patterns` are provided, both constraints apply. By + default, all files from the folder are uploaded. + + Uses `HfApi.create_commit` under the hood. + + Args: + repo_id (`str`): + The repository to which the file will be uploaded, for example: + `"username/custom_transformers"` + folder_path (`str` or `Path`): + Path to the folder to upload on the local file system + path_in_repo (`str`, *optional*): + Relative path of the directory in the repo, for example: + `"checkpoints/1fec34a/results"`. Will default to the root folder of the repository. + token (`str`, *optional*): + Authentication token, obtained with `HfApi.login` method. Will + default to the stored token. + repo_type (`str`, *optional*): + Set to `"dataset"` or `"space"` if uploading to a dataset or + space, `None` or `"model"` if uploading to a model. Default is + `None`. + revision (`str`, *optional*): + The git revision to commit from. Defaults to the head of the `"main"` branch. + commit_message (`str`, *optional*): + The summary / title / first line of the generated commit. Defaults to: + `f"Upload {path_in_repo} with huggingface_hub"` + commit_description (`str` *optional*): + The description of the generated commit + create_pr (`boolean`, *optional*): + Whether or not to create a Pull Request with that commit. Defaults to `False`. + If `revision` is not set, PR is opened against the `"main"` branch. If + `revision` is set and is a branch, PR is opened against this branch. If + `revision` is set and is not a branch name (example: a commit oid), an + `RevisionNotFoundError` is returned by the server. + parent_commit (`str`, *optional*): + The OID / SHA of the parent commit, as a hexadecimal string. Shorthands (7 first characters) are also supported. + If specified and `create_pr` is `False`, the commit will fail if `revision` does not point to `parent_commit`. + If specified and `create_pr` is `True`, the pull request will be created from `parent_commit`. + Specifying `parent_commit` ensures the repo has not changed before committing the changes, and can be + especially useful if the repo is updated / committed to concurrently. + allow_patterns (`List[str]` or `str`, *optional*): + If provided, only files matching at least one pattern are uploaded. + ignore_patterns (`List[str]` or `str`, *optional*): + If provided, files matching any of the patterns are not uploaded. + + Returns: + `str`: A URL to visualize the uploaded folder on the hub + + + + Raises the following errors: + + - [`HTTPError`](https://2.python-requests.org/en/master/api/#requests.HTTPError) + if the HuggingFace API returned an error + - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) + if some parameter value is invalid + + + + + + `upload_folder` assumes that the repo already exists on the Hub. If you get a + Client error 404, please make sure you are authenticated and that `repo_id` and + `repo_type` are set correctly. If repo does not exist, create it first using + [`~hf_api.create_repo`]. + + + + Example: + + ```python + >>> upload_folder( + ... folder_path="local/checkpoints", + ... path_in_repo="remote/experiment/checkpoints", + ... repo_id="username/my-dataset", + ... repo_type="datasets", + ... token="my_token", + ... ignore_patterns="**/logs/*.txt", + ... ) + # "https://huggingface.co/datasets/username/my-dataset/tree/main/remote/experiment/checkpoints" + + >>> upload_folder( + ... folder_path="local/checkpoints", + ... path_in_repo="remote/experiment/checkpoints", + ... repo_id="username/my-dataset", + ... repo_type="datasets", + ... token="my_token", + ... create_pr=True, + ... ) + # "https://huggingface.co/datasets/username/my-dataset/tree/refs%2Fpr%2F1/remote/experiment/checkpoints" + + ``` + """ + if repo_type not in REPO_TYPES: + raise ValueError(f"Invalid repo type, must be one of {REPO_TYPES}") + + # By default, upload folder to the root directory in repo. + if path_in_repo is None: + path_in_repo = "" + + commit_message = ( + commit_message + if commit_message is not None + else f"Upload {path_in_repo} with huggingface_hub" + ) + + files_to_add = _prepare_upload_folder_commit( + folder_path, + path_in_repo, + allow_patterns=allow_patterns, + ignore_patterns=ignore_patterns, + ) + + commit_info = self.create_commit( + repo_type=repo_type, + repo_id=repo_id, + operations=files_to_add, + commit_message=commit_message, + commit_description=commit_description, + token=token, + revision=revision, + create_pr=create_pr, + parent_commit=parent_commit, + ) + + if commit_info.pr_url is not None: + revision = quote(_parse_revision_from_pr_url(commit_info.pr_url), safe="") + if repo_type in REPO_TYPES_URL_PREFIXES: + repo_id = REPO_TYPES_URL_PREFIXES[repo_type] + repo_id + revision = revision if revision is not None else DEFAULT_REVISION + # Similar to `hf_hub_url` but it's "tree" instead of "resolve" + return f"{self.endpoint}/{repo_id}/tree/{revision}/{path_in_repo}" + + @validate_hf_hub_args + def delete_file( + self, + path_in_repo: str, + repo_id: str, + *, + token: Optional[str] = None, + repo_type: Optional[str] = None, + revision: Optional[str] = None, + commit_message: Optional[str] = None, + commit_description: Optional[str] = None, + create_pr: Optional[bool] = None, + parent_commit: Optional[str] = None, + ) -> CommitInfo: + """ + Deletes a file in the given repo. + + Args: + path_in_repo (`str`): + Relative filepath in the repo, for example: + `"checkpoints/1fec34a/weights.bin"` + repo_id (`str`): + The repository from which the file will be deleted, for example: + `"username/custom_transformers"` + token (`str`, *optional*): + Authentication token, obtained with `HfApi.login` method. Will + default to the stored token. + repo_type (`str`, *optional*): + Set to `"dataset"` or `"space"` if the file is in a dataset or + space, `None` or `"model"` if in a model. Default is `None`. + revision (`str`, *optional*): + The git revision to commit from. Defaults to the head of the `"main"` branch. + commit_message (`str`, *optional*): + The summary / title / first line of the generated commit. Defaults to + `f"Delete {path_in_repo} with huggingface_hub"`. + commit_description (`str` *optional*) + The description of the generated commit + create_pr (`boolean`, *optional*): + Whether or not to create a Pull Request with that commit. Defaults to `False`. + If `revision` is not set, PR is opened against the `"main"` branch. If + `revision` is set and is a branch, PR is opened against this branch. If + `revision` is set and is not a branch name (example: a commit oid), an + `RevisionNotFoundError` is returned by the server. + parent_commit (`str`, *optional*): + The OID / SHA of the parent commit, as a hexadecimal string. Shorthands (7 first characters) are also supported. + If specified and `create_pr` is `False`, the commit will fail if `revision` does not point to `parent_commit`. + If specified and `create_pr` is `True`, the pull request will be created from `parent_commit`. + Specifying `parent_commit` ensures the repo has not changed before committing the changes, and can be + especially useful if the repo is updated / committed to concurrently. + + + + + Raises the following errors: + + - [`HTTPError`](https://2.python-requests.org/en/master/api/#requests.HTTPError) + if the HuggingFace API returned an error + - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) + if some parameter value is invalid + - [`~utils.RepositoryNotFoundError`] + If the repository to download from cannot be found. This may be because it doesn't exist, + or because it is set to `private` and you do not have access. + - [`~utils.RevisionNotFoundError`] + If the revision to download from cannot be found. + - [`~utils.EntryNotFoundError`] + If the file to download cannot be found. + + + + """ + commit_message = ( + commit_message + if commit_message is not None + else f"Delete {path_in_repo} with huggingface_hub" + ) + + operations = [CommitOperationDelete(path_in_repo=path_in_repo)] + + return self.create_commit( + repo_id=repo_id, + repo_type=repo_type, + token=token, + operations=operations, + revision=revision, + commit_message=commit_message, + commit_description=commit_description, + create_pr=create_pr, + parent_commit=parent_commit, + ) + + @validate_hf_hub_args + def delete_folder( + self, + path_in_repo: str, + repo_id: str, + *, + token: Optional[str] = None, + repo_type: Optional[str] = None, + revision: Optional[str] = None, + commit_message: Optional[str] = None, + commit_description: Optional[str] = None, + create_pr: Optional[bool] = None, + parent_commit: Optional[str] = None, + ) -> CommitInfo: + """ + Deletes a folder in the given repo. + + Simple wrapper around [`create_commit`] method. + + Args: + path_in_repo (`str`): + Relative folder path in the repo, for example: `"checkpoints/1fec34a"`. + repo_id (`str`): + The repository from which the folder will be deleted, for example: + `"username/custom_transformers"` + token (`str`, *optional*): + Authentication token, obtained with `HfApi.login` method. Will default + to the stored token. + repo_type (`str`, *optional*): + Set to `"dataset"` or `"space"` if the folder is in a dataset or + space, `None` or `"model"` if in a model. Default is `None`. + revision (`str`, *optional*): + The git revision to commit from. Defaults to the head of the `"main"` branch. + commit_message (`str`, *optional*): + The summary / title / first line of the generated commit. Defaults to + `f"Delete folder {path_in_repo} with huggingface_hub"`. + commit_description (`str` *optional*) + The description of the generated commit. + create_pr (`boolean`, *optional*): + Whether or not to create a Pull Request with that commit. Defaults to `False`. + If `revision` is not set, PR is opened against the `"main"` branch. If + `revision` is set and is a branch, PR is opened against this branch. If + `revision` is set and is not a branch name (example: a commit oid), an + `RevisionNotFoundError` is returned by the server. + parent_commit (`str`, *optional*): + The OID / SHA of the parent commit, as a hexadecimal string. Shorthands (7 first characters) are also supported. + If specified and `create_pr` is `False`, the commit will fail if `revision` does not point to `parent_commit`. + If specified and `create_pr` is `True`, the pull request will be created from `parent_commit`. + Specifying `parent_commit` ensures the repo has not changed before committing the changes, and can be + especially useful if the repo is updated / committed to concurrently. + """ + return self.create_commit( + repo_id=repo_id, + repo_type=repo_type, + token=token, + operations=[ + CommitOperationDelete(path_in_repo=path_in_repo, is_folder=True) + ], + revision=revision, + commit_message=( + commit_message + if commit_message is not None + else f"Delete folder {path_in_repo} with huggingface_hub" + ), + commit_description=commit_description, + create_pr=create_pr, + parent_commit=parent_commit, + ) + + @validate_hf_hub_args + def create_branch( + self, + repo_id: str, + *, + branch: str, + token: Optional[str] = None, + repo_type: Optional[str] = None, + ) -> None: + """ + Create a new branch from `main` on a repo on the Hub. + + Args: + repo_id (`str`): + The repository in which the branch will be created. + Example: `"user/my-cool-model"`. + + branch (`str`): + The name of the branch to create. + + token (`str`, *optional*): + Authentication token. Will default to the stored token. + + repo_type (`str`, *optional*): + Set to `"dataset"` or `"space"` if creating a branch on a dataset or + space, `None` or `"model"` if tagging a model. Default is `None`. + + Raises: + [`~utils.RepositoryNotFoundError`]: + If repository is not found (error 404): wrong repo_id/repo_type, private + but not authenticated or repo does not exist. + [`~utils.BadRequestError`]: + If invalid reference for a branch. Ex: `refs/pr/5` or 'refs/foo/bar'. + [`~utils.HfHubHTTPError`]: + If the branch already exists on the repo (error 409). + """ + if repo_type is None: + repo_type = REPO_TYPE_MODEL + branch = quote(branch, safe="") + + # Prepare request + branch_url = f"{self.endpoint}/api/{repo_type}s/{repo_id}/branch/{branch}" + headers = self._build_hf_headers(token=token, is_write_action=True) + + # Create branch + response = requests.post(url=branch_url, headers=headers) + hf_raise_for_status(response) + + @validate_hf_hub_args + def delete_branch( + self, + repo_id: str, + *, + branch: str, + token: Optional[str] = None, + repo_type: Optional[str] = None, + ) -> None: + """ + Delete a branch from a repo on the Hub. + + Args: + repo_id (`str`): + The repository in which a branch will be deleted. + Example: `"user/my-cool-model"`. + + branch (`str`): + The name of the branch to delete. + + token (`str`, *optional*): + Authentication token. Will default to the stored token. + + repo_type (`str`, *optional*): + Set to `"dataset"` or `"space"` if creating a branch on a dataset or + space, `None` or `"model"` if tagging a model. Default is `None`. + + Raises: + [`~utils.RepositoryNotFoundError`]: + If repository is not found (error 404): wrong repo_id/repo_type, private + but not authenticated or repo does not exist. + [`~utils.HfHubHTTPError`]: + If trying to delete a protected branch. Ex: `main` cannot be deleted. + [`~utils.HfHubHTTPError`]: + If trying to delete a branch that does not exist. + + """ + if repo_type is None: + repo_type = REPO_TYPE_MODEL + branch = quote(branch, safe="") + + # Prepare request + branch_url = f"{self.endpoint}/api/{repo_type}s/{repo_id}/branch/{branch}" + headers = self._build_hf_headers(token=token, is_write_action=True) + + # Delete branch + response = requests.delete(url=branch_url, headers=headers) + hf_raise_for_status(response) + + @validate_hf_hub_args + def create_tag( + self, + repo_id: str, + *, + tag: str, + tag_message: Optional[str] = None, + revision: Optional[str] = None, + token: Optional[str] = None, + repo_type: Optional[str] = None, + ) -> None: + """ + Tag a given commit of a repo on the Hub. + + Args: + repo_id (`str`): + The repository in which a commit will be tagged. + Example: `"user/my-cool-model"`. + + tag (`str`): + The name of the tag to create. + + tag_message (`str`, *optional*): + The description of the tag to create. + + revision (`str`, *optional*): + The git revision to tag. It can be a branch name or the OID/SHA of a + commit, as a hexadecimal string. Shorthands (7 first characters) are + also supported. Defaults to the head of the `"main"` branch. + + token (`str`, *optional*): + Authentication token. Will default to the stored token. + + repo_type (`str`, *optional*): + Set to `"dataset"` or `"space"` if tagging a dataset or + space, `None` or `"model"` if tagging a model. Default is + `None`. + + Raises: + [`~utils.RepositoryNotFoundError`]: + If repository is not found (error 404): wrong repo_id/repo_type, private + but not authenticated or repo does not exist. + [`~utils.RevisionNotFoundError`]: + If revision is not found (error 404) on the repo. + """ + if repo_type is None: + repo_type = REPO_TYPE_MODEL + revision = ( + quote(revision, safe="") if revision is not None else DEFAULT_REVISION + ) + + # Prepare request + tag_url = f"{self.endpoint}/api/{repo_type}s/{repo_id}/tag/{revision}" + headers = self._build_hf_headers(token=token, is_write_action=True) + payload = {"tag": tag} + if tag_message is not None: + payload["message"] = tag_message + + # Tag + response = requests.post(url=tag_url, headers=headers, json=payload) + hf_raise_for_status(response) + + @validate_hf_hub_args + def delete_tag( + self, + repo_id: str, + *, + tag: str, + token: Optional[str] = None, + repo_type: Optional[str] = None, + ) -> None: + """ + Delete a tag from a repo on the Hub. + + Args: + repo_id (`str`): + The repository in which a tag will be deleted. + Example: `"user/my-cool-model"`. + + tag (`str`): + The name of the tag to delete. + + token (`str`, *optional*): + Authentication token. Will default to the stored token. + + repo_type (`str`, *optional*): + Set to `"dataset"` or `"space"` if tagging a dataset or space, `None` or + `"model"` if tagging a model. Default is `None`. + + Raises: + [`~utils.RepositoryNotFoundError`]: + If repository is not found (error 404): wrong repo_id/repo_type, private + but not authenticated or repo does not exist. + [`~utils.RevisionNotFoundError`]: + If tag is not found. + """ + if repo_type is None: + repo_type = REPO_TYPE_MODEL + tag = quote(tag, safe="") + + # Prepare request + tag_url = f"{self.endpoint}/api/{repo_type}s/{repo_id}/tag/{tag}" + headers = self._build_hf_headers(token=token, is_write_action=True) + + # Un-tag + response = requests.delete(url=tag_url, headers=headers) + hf_raise_for_status(response) + + @validate_hf_hub_args + def get_full_repo_name( + self, + model_id: str, + *, + organization: Optional[str] = None, + token: Optional[Union[bool, str]] = None, + ): + """ + Returns the repository name for a given model ID and optional + organization. + + Args: + model_id (`str`): + The name of the model. + organization (`str`, *optional*): + If passed, the repository name will be in the organization + namespace instead of the user namespace. + token (`bool` or `str`, *optional*): + A valid authentication token (see https://huggingface.co/settings/token). + If `None` or `True` and machine is logged in (through `huggingface-cli login` + or [`~huggingface_hub.login`]), token will be retrieved from the cache. + If `False`, token is not sent in the request header. + + Returns: + `str`: The repository name in the user's namespace + ({username}/{model_id}) if no organization is passed, and under the + organization namespace ({organization}/{model_id}) otherwise. + """ + if organization is None: + if "/" in model_id: + username = model_id.split("/")[0] + else: + username = self.whoami(token=token)["name"] # type: ignore + return f"{username}/{model_id}" + else: + return f"{organization}/{model_id}" + + @validate_hf_hub_args + def get_repo_discussions( + self, + repo_id: str, + *, + repo_type: Optional[str] = None, + token: Optional[str] = None, + ) -> Iterator[Discussion]: + """ + Fetches Discussions and Pull Requests for the given repo. + + Args: + repo_id (`str`): + A namespace (user or an organization) and a repo name separated + by a `/`. + repo_type (`str`, *optional*): + Set to `"dataset"` or `"space"` if fetching from a dataset or + space, `None` or `"model"` if fetching from a model. Default is + `None`. + token (`str`, *optional*): + An authentication token (See https://huggingface.co/settings/token). + + Returns: + `Iterator[Discussion]`: An iterator of [`Discussion`] objects. + + Example: + Collecting all discussions of a repo in a list: + + ```python + >>> from huggingface_hub import get_repo_discussions + >>> discussions_list = list(get_repo_discussions(repo_id="bert-base-uncased")) + ``` + + Iterating over discussions of a repo: + + ```python + >>> from huggingface_hub import get_repo_discussions + >>> for discussion in get_repo_discussions(repo_id="bert-base-uncased"): + ... print(discussion.num, discussion.title) + ``` + """ + if repo_type not in REPO_TYPES: + raise ValueError(f"Invalid repo type, must be one of {REPO_TYPES}") + if repo_type is None: + repo_type = REPO_TYPE_MODEL + + headers = self._build_hf_headers(token=token) + + def _fetch_discussion_page(page_index: int): + path = ( + f"{self.endpoint}/api/{repo_type}s/{repo_id}/discussions?p={page_index}" + ) + resp = requests.get(path, headers=headers) + hf_raise_for_status(resp) + paginated_discussions = resp.json() + total = paginated_discussions["count"] + start = paginated_discussions["start"] + discussions = paginated_discussions["discussions"] + has_next = (start + len(discussions)) < total + return discussions, has_next + + has_next, page_index = True, 0 + + while has_next: + discussions, has_next = _fetch_discussion_page(page_index=page_index) + for discussion in discussions: + yield Discussion( + title=discussion["title"], + num=discussion["num"], + author=discussion.get("author", {}).get("name", "deleted"), + created_at=parse_datetime(discussion["createdAt"]), + status=discussion["status"], + repo_id=discussion["repo"]["name"], + repo_type=discussion["repo"]["type"], + is_pull_request=discussion["isPullRequest"], + ) + page_index = page_index + 1 + + @validate_hf_hub_args + def get_discussion_details( + self, + repo_id: str, + discussion_num: int, + *, + repo_type: Optional[str] = None, + token: Optional[str] = None, + ) -> DiscussionWithDetails: + """Fetches a Discussion's / Pull Request 's details from the Hub. + + Args: + repo_id (`str`): + A namespace (user or an organization) and a repo name separated + by a `/`. + discussion_num (`int`): + The number of the Discussion or Pull Request . Must be a strictly positive integer. + repo_type (`str`, *optional*): + Set to `"dataset"` or `"space"` if uploading to a dataset or + space, `None` or `"model"` if uploading to a model. Default is + `None`. + token (`str`, *optional*): + An authentication token (See https://huggingface.co/settings/token) + + Returns: [`DiscussionWithDetails`] + + + + Raises the following errors: + + - [`HTTPError`](https://2.python-requests.org/en/master/api/#requests.HTTPError) + if the HuggingFace API returned an error + - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) + if some parameter value is invalid + - [`~utils.RepositoryNotFoundError`] + If the repository to download from cannot be found. This may be because it doesn't exist, + or because it is set to `private` and you do not have access. + + + """ + if not isinstance(discussion_num, int) or discussion_num <= 0: + raise ValueError("Invalid discussion_num, must be a positive integer") + if repo_type not in REPO_TYPES: + raise ValueError(f"Invalid repo type, must be one of {REPO_TYPES}") + if repo_type is None: + repo_type = REPO_TYPE_MODEL + + path = ( + f"{self.endpoint}/api/{repo_type}s/{repo_id}/discussions/{discussion_num}" + ) + headers = self._build_hf_headers(token=token) + resp = requests.get(path, params={"diff": "1"}, headers=headers) + hf_raise_for_status(resp) + + discussion_details = resp.json() + is_pull_request = discussion_details["isPullRequest"] + + target_branch = ( + discussion_details["changes"]["base"] if is_pull_request else None + ) + conflicting_files = ( + discussion_details["filesWithConflicts"] if is_pull_request else None + ) + merge_commit_oid = ( + discussion_details["changes"].get("mergeCommitId", None) + if is_pull_request + else None + ) + + return DiscussionWithDetails( + title=discussion_details["title"], + num=discussion_details["num"], + author=discussion_details.get("author", {}).get("name", "deleted"), + created_at=parse_datetime(discussion_details["createdAt"]), + status=discussion_details["status"], + repo_id=discussion_details["repo"]["name"], + repo_type=discussion_details["repo"]["type"], + is_pull_request=discussion_details["isPullRequest"], + events=[deserialize_event(evt) for evt in discussion_details["events"]], + conflicting_files=conflicting_files, + target_branch=target_branch, + merge_commit_oid=merge_commit_oid, + diff=discussion_details.get("diff"), + ) + + @validate_hf_hub_args + def create_discussion( + self, + repo_id: str, + title: str, + *, + token: Optional[str] = None, + description: Optional[str] = None, + repo_type: Optional[str] = None, + pull_request: bool = False, + ) -> DiscussionWithDetails: + """Creates a Discussion or Pull Request. + + Pull Requests created programmatically will be in `"draft"` status. + + Creating a Pull Request with changes can also be done at once with [`HfApi.create_commit`]. + + Args: + repo_id (`str`): + A namespace (user or an organization) and a repo name separated + by a `/`. + title (`str`): + The title of the discussion. It can be up to 200 characters long, + and must be at least 3 characters long. Leading and trailing whitespaces + will be stripped. + token (`str`, *optional*): + An authentication token (See https://huggingface.co/settings/token) + description (`str`, *optional*): + An optional description for the Pull Request. + Defaults to `"Discussion opened with the huggingface_hub Python library"` + pull_request (`bool`, *optional*): + Whether to create a Pull Request or discussion. If `True`, creates a Pull Request. + If `False`, creates a discussion. Defaults to `False`. + repo_type (`str`, *optional*): + Set to `"dataset"` or `"space"` if uploading to a dataset or + space, `None` or `"model"` if uploading to a model. Default is + `None`. + + Returns: [`DiscussionWithDetails`] + + + + Raises the following errors: + + - [`HTTPError`](https://2.python-requests.org/en/master/api/#requests.HTTPError) + if the HuggingFace API returned an error + - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) + if some parameter value is invalid + - [`~utils.RepositoryNotFoundError`] + If the repository to download from cannot be found. This may be because it doesn't exist, + or because it is set to `private` and you do not have access. + + """ + if repo_type not in REPO_TYPES: + raise ValueError(f"Invalid repo type, must be one of {REPO_TYPES}") + if repo_type is None: + repo_type = REPO_TYPE_MODEL + + if description is not None: + description = description.strip() + description = ( + description + if description + else ( + f"{'Pull Request' if pull_request else 'Discussion'} opened with the" + " [huggingface_hub Python" + " library](https://huggingface.co/docs/huggingface_hub)" + ) + ) + + headers = self._build_hf_headers(token=token, is_write_action=True) + resp = requests.post( + f"{self.endpoint}/api/{repo_type}s/{repo_id}/discussions", + json={ + "title": title.strip(), + "description": description, + "pullRequest": pull_request, + }, + headers=headers, + ) + hf_raise_for_status(resp) + num = resp.json()["num"] + return self.get_discussion_details( + repo_id=repo_id, + repo_type=repo_type, + discussion_num=num, + token=token, + ) + + @validate_hf_hub_args + def create_pull_request( + self, + repo_id: str, + title: str, + *, + token: Optional[str] = None, + description: Optional[str] = None, + repo_type: Optional[str] = None, + ) -> DiscussionWithDetails: + """Creates a Pull Request . Pull Requests created programmatically will be in `"draft"` status. + + Creating a Pull Request with changes can also be done at once with [`HfApi.create_commit`]; + + This is a wrapper around [`HfApi.create_discusssion`]. + + Args: + repo_id (`str`): + A namespace (user or an organization) and a repo name separated + by a `/`. + title (`str`): + The title of the discussion. It can be up to 200 characters long, + and must be at least 3 characters long. Leading and trailing whitespaces + will be stripped. + token (`str`, *optional*): + An authentication token (See https://huggingface.co/settings/token) + description (`str`, *optional*): + An optional description for the Pull Request. + Defaults to `"Discussion opened with the huggingface_hub Python library"` + repo_type (`str`, *optional*): + Set to `"dataset"` or `"space"` if uploading to a dataset or + space, `None` or `"model"` if uploading to a model. Default is + `None`. + + Returns: [`DiscussionWithDetails`] + + + + Raises the following errors: + + - [`HTTPError`](https://2.python-requests.org/en/master/api/#requests.HTTPError) + if the HuggingFace API returned an error + - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) + if some parameter value is invalid + - [`~utils.RepositoryNotFoundError`] + If the repository to download from cannot be found. This may be because it doesn't exist, + or because it is set to `private` and you do not have access. + + """ + return self.create_discussion( + repo_id=repo_id, + title=title, + token=token, + description=description, + repo_type=repo_type, + pull_request=True, + ) + + def _post_discussion_changes( + self, + *, + repo_id: str, + discussion_num: int, + resource: str, + body: Optional[dict] = None, + token: Optional[str] = None, + repo_type: Optional[str] = None, + ) -> requests.Response: + """Internal utility to POST changes to a Discussion or Pull Request""" + if not isinstance(discussion_num, int) or discussion_num <= 0: + raise ValueError("Invalid discussion_num, must be a positive integer") + if repo_type not in REPO_TYPES: + raise ValueError(f"Invalid repo type, must be one of {REPO_TYPES}") + if repo_type is None: + repo_type = REPO_TYPE_MODEL + repo_id = f"{repo_type}s/{repo_id}" + + path = f"{self.endpoint}/api/{repo_id}/discussions/{discussion_num}/{resource}" + + headers = self._build_hf_headers(token=token, is_write_action=True) + resp = requests.post(path, headers=headers, json=body) + hf_raise_for_status(resp) + return resp + + @validate_hf_hub_args + def comment_discussion( + self, + repo_id: str, + discussion_num: int, + comment: str, + *, + token: Optional[str] = None, + repo_type: Optional[str] = None, + ) -> DiscussionComment: + """Creates a new comment on the given Discussion. + + Args: + repo_id (`str`): + A namespace (user or an organization) and a repo name separated + by a `/`. + discussion_num (`int`): + The number of the Discussion or Pull Request . Must be a strictly positive integer. + comment (`str`): + The content of the comment to create. Comments support markdown formatting. + repo_type (`str`, *optional*): + Set to `"dataset"` or `"space"` if uploading to a dataset or + space, `None` or `"model"` if uploading to a model. Default is + `None`. + token (`str`, *optional*): + An authentication token (See https://huggingface.co/settings/token) + + Returns: + [`DiscussionComment`]: the newly created comment + + + Examples: + ```python + + >>> comment = \"\"\" + ... Hello @otheruser! + ... + ... # This is a title + ... + ... **This is bold**, *this is italic* and ~this is strikethrough~ + ... And [this](http://url) is a link + ... \"\"\" + + >>> HfApi().comment_discussion( + ... repo_id="username/repo_name", + ... discussion_num=34 + ... comment=comment + ... ) + # DiscussionComment(id='deadbeef0000000', type='comment', ...) + + ``` + + + + Raises the following errors: + + - [`HTTPError`](https://2.python-requests.org/en/master/api/#requests.HTTPError) + if the HuggingFace API returned an error + - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) + if some parameter value is invalid + - [`~utils.RepositoryNotFoundError`] + If the repository to download from cannot be found. This may be because it doesn't exist, + or because it is set to `private` and you do not have access. + + + """ + resp = self._post_discussion_changes( + repo_id=repo_id, + repo_type=repo_type, + discussion_num=discussion_num, + token=token, + resource="comment", + body={"comment": comment}, + ) + return deserialize_event(resp.json()["newMessage"]) # type: ignore + + @validate_hf_hub_args + def rename_discussion( + self, + repo_id: str, + discussion_num: int, + new_title: str, + *, + token: Optional[str] = None, + repo_type: Optional[str] = None, + ) -> DiscussionTitleChange: + """Renames a Discussion. + + Args: + repo_id (`str`): + A namespace (user or an organization) and a repo name separated + by a `/`. + discussion_num (`int`): + The number of the Discussion or Pull Request . Must be a strictly positive integer. + new_title (`str`): + The new title for the discussion + repo_type (`str`, *optional*): + Set to `"dataset"` or `"space"` if uploading to a dataset or + space, `None` or `"model"` if uploading to a model. Default is + `None`. + token (`str`, *optional*): + An authentication token (See https://huggingface.co/settings/token) + + Returns: + [`DiscussionTitleChange`]: the title change event + + + Examples: + ```python + >>> new_title = "New title, fixing a typo" + >>> HfApi().rename_discussion( + ... repo_id="username/repo_name", + ... discussion_num=34 + ... new_title=new_title + ... ) + # DiscussionTitleChange(id='deadbeef0000000', type='title-change', ...) + + ``` + + + + Raises the following errors: + + - [`HTTPError`](https://2.python-requests.org/en/master/api/#requests.HTTPError) + if the HuggingFace API returned an error + - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) + if some parameter value is invalid + - [`~utils.RepositoryNotFoundError`] + If the repository to download from cannot be found. This may be because it doesn't exist, + or because it is set to `private` and you do not have access. + + + """ + resp = self._post_discussion_changes( + repo_id=repo_id, + repo_type=repo_type, + discussion_num=discussion_num, + token=token, + resource="title", + body={"title": new_title}, + ) + return deserialize_event(resp.json()["newTitle"]) # type: ignore + + @validate_hf_hub_args + def change_discussion_status( + self, + repo_id: str, + discussion_num: int, + new_status: Literal["open", "closed"], + *, + token: Optional[str] = None, + comment: Optional[str] = None, + repo_type: Optional[str] = None, + ) -> DiscussionStatusChange: + """Closes or re-opens a Discussion or Pull Request. + + Args: + repo_id (`str`): + A namespace (user or an organization) and a repo name separated + by a `/`. + discussion_num (`int`): + The number of the Discussion or Pull Request . Must be a strictly positive integer. + new_status (`str`): + The new status for the discussion, either `"open"` or `"closed"`. + comment (`str`, *optional*): + An optional comment to post with the status change. + repo_type (`str`, *optional*): + Set to `"dataset"` or `"space"` if uploading to a dataset or + space, `None` or `"model"` if uploading to a model. Default is + `None`. + token (`str`, *optional*): + An authentication token (See https://huggingface.co/settings/token) + + Returns: + [`DiscussionStatusChange`]: the status change event + + + Examples: + ```python + >>> new_title = "New title, fixing a typo" + >>> HfApi().rename_discussion( + ... repo_id="username/repo_name", + ... discussion_num=34 + ... new_title=new_title + ... ) + # DiscussionStatusChange(id='deadbeef0000000', type='status-change', ...) + + ``` + + + + Raises the following errors: + + - [`HTTPError`](https://2.python-requests.org/en/master/api/#requests.HTTPError) + if the HuggingFace API returned an error + - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) + if some parameter value is invalid + - [`~utils.RepositoryNotFoundError`] + If the repository to download from cannot be found. This may be because it doesn't exist, + or because it is set to `private` and you do not have access. + + + """ + if new_status not in ["open", "closed"]: + raise ValueError("Invalid status, valid statuses are: 'open' and 'closed'") + body: Dict[str, str] = {"status": new_status} + if comment and comment.strip(): + body["comment"] = comment.strip() + resp = self._post_discussion_changes( + repo_id=repo_id, + repo_type=repo_type, + discussion_num=discussion_num, + token=token, + resource="status", + body=body, + ) + return deserialize_event(resp.json()["newStatus"]) # type: ignore + + @validate_hf_hub_args + def merge_pull_request( + self, + repo_id: str, + discussion_num: int, + *, + token: Optional[str] = None, + comment: Optional[str] = None, + repo_type: Optional[str] = None, + ): + """Merges a Pull Request. + + Args: + repo_id (`str`): + A namespace (user or an organization) and a repo name separated + by a `/`. + discussion_num (`int`): + The number of the Discussion or Pull Request . Must be a strictly positive integer. + comment (`str`, *optional*): + An optional comment to post with the status change. + repo_type (`str`, *optional*): + Set to `"dataset"` or `"space"` if uploading to a dataset or + space, `None` or `"model"` if uploading to a model. Default is + `None`. + token (`str`, *optional*): + An authentication token (See https://huggingface.co/settings/token) + + Returns: + [`DiscussionStatusChange`]: the status change event + + + + Raises the following errors: + + - [`HTTPError`](https://2.python-requests.org/en/master/api/#requests.HTTPError) + if the HuggingFace API returned an error + - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) + if some parameter value is invalid + - [`~utils.RepositoryNotFoundError`] + If the repository to download from cannot be found. This may be because it doesn't exist, + or because it is set to `private` and you do not have access. + + + """ + self._post_discussion_changes( + repo_id=repo_id, + repo_type=repo_type, + discussion_num=discussion_num, + token=token, + resource="merge", + body={"comment": comment.strip()} if comment and comment.strip() else None, + ) + + @validate_hf_hub_args + def edit_discussion_comment( + self, + repo_id: str, + discussion_num: int, + comment_id: str, + new_content: str, + *, + token: Optional[str] = None, + repo_type: Optional[str] = None, + ) -> DiscussionComment: + """Edits a comment on a Discussion / Pull Request. + + Args: + repo_id (`str`): + A namespace (user or an organization) and a repo name separated + by a `/`. + discussion_num (`int`): + The number of the Discussion or Pull Request . Must be a strictly positive integer. + comment_id (`str`): + The ID of the comment to edit. + new_content (`str`): + The new content of the comment. Comments support markdown formatting. + repo_type (`str`, *optional*): + Set to `"dataset"` or `"space"` if uploading to a dataset or + space, `None` or `"model"` if uploading to a model. Default is + `None`. + token (`str`, *optional*): + An authentication token (See https://huggingface.co/settings/token) + + Returns: + [`DiscussionComment`]: the edited comment + + + + Raises the following errors: + + - [`HTTPError`](https://2.python-requests.org/en/master/api/#requests.HTTPError) + if the HuggingFace API returned an error + - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) + if some parameter value is invalid + - [`~utils.RepositoryNotFoundError`] + If the repository to download from cannot be found. This may be because it doesn't exist, + or because it is set to `private` and you do not have access. + + + """ + resp = self._post_discussion_changes( + repo_id=repo_id, + repo_type=repo_type, + discussion_num=discussion_num, + token=token, + resource=f"comment/{comment_id.lower()}/edit", + body={"content": new_content}, + ) + return deserialize_event(resp.json()["updatedComment"]) # type: ignore + + @validate_hf_hub_args + def hide_discussion_comment( + self, + repo_id: str, + discussion_num: int, + comment_id: str, + *, + token: Optional[str] = None, + repo_type: Optional[str] = None, + ) -> DiscussionComment: + """Hides a comment on a Discussion / Pull Request. + + + Hidden comments' content cannot be retrieved anymore. Hiding a comment is irreversible. + + + Args: + repo_id (`str`): + A namespace (user or an organization) and a repo name separated + by a `/`. + discussion_num (`int`): + The number of the Discussion or Pull Request . Must be a strictly positive integer. + comment_id (`str`): + The ID of the comment to edit. + repo_type (`str`, *optional*): + Set to `"dataset"` or `"space"` if uploading to a dataset or + space, `None` or `"model"` if uploading to a model. Default is + `None`. + token (`str`, *optional*): + An authentication token (See https://huggingface.co/settings/token) + + Returns: + [`DiscussionComment`]: the hidden comment + + + + Raises the following errors: + + - [`HTTPError`](https://2.python-requests.org/en/master/api/#requests.HTTPError) + if the HuggingFace API returned an error + - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) + if some parameter value is invalid + - [`~utils.RepositoryNotFoundError`] + If the repository to download from cannot be found. This may be because it doesn't exist, + or because it is set to `private` and you do not have access. + + + """ + warnings.warn( + "Hidden comments' content cannot be retrieved anymore. Hiding a comment is" + " irreversible.", + UserWarning, + ) + resp = self._post_discussion_changes( + repo_id=repo_id, + repo_type=repo_type, + discussion_num=discussion_num, + token=token, + resource=f"comment/{comment_id.lower()}/hide", + ) + return deserialize_event(resp.json()["updatedComment"]) # type: ignore + + def _build_hf_headers( + self, + token: Optional[Union[bool, str]] = None, + is_write_action: bool = False, + library_name: Optional[str] = None, + library_version: Optional[str] = None, + user_agent: Union[Dict, str, None] = None, + ) -> Dict[str, str]: + """ + Alias for [`build_hf_headers`] that uses the token from [`HfApi`] client + when `token` is not provided. + """ + if token is None: + token = self.token + return build_hf_headers( + token=token, + is_write_action=is_write_action, + library_name=library_name, + library_version=library_version, + user_agent=user_agent, + ) + + +def _prepare_upload_folder_commit( + folder_path: Union[str, Path], + path_in_repo: str, + allow_patterns: Optional[Union[List[str], str]] = None, + ignore_patterns: Optional[Union[List[str], str]] = None, +) -> List[CommitOperationAdd]: + """Generate the list of Add operations for a commit to upload a folder. + + Files not matching the `allow_patterns` (allowlist) and `ignore_patterns` (denylist) + constraints are discarded. + """ + folder_path = os.path.normpath(os.path.expanduser(folder_path)) + if not os.path.isdir(folder_path): + raise ValueError(f"Provided path: '{folder_path}' is not a directory") + + files_to_add: List[CommitOperationAdd] = [] + for dirpath, _, filenames in os.walk(folder_path): + for filename in filenames: + abs_path = os.path.join(dirpath, filename) + rel_path = os.path.relpath(abs_path, folder_path) + files_to_add.append( + CommitOperationAdd( + path_or_fileobj=abs_path, + path_in_repo=os.path.normpath( + os.path.join(path_in_repo, rel_path) + ).replace(os.sep, "/"), + ) + ) + + return list( + filter_repo_objects( + files_to_add, + allow_patterns=allow_patterns, + ignore_patterns=ignore_patterns, + key=lambda x: x.path_in_repo, + ) + ) + + +def _parse_revision_from_pr_url(pr_url: str) -> str: + """Safely parse revision number from a PR url. + + Example: + ```py + >>> _parse_revision_from_pr_url("https://huggingface.co/bigscience/bloom/discussions/2") + "refs/pr/2" + ``` + """ + re_match = re.match(_REGEX_DISCUSSION_URL, pr_url) + if re_match is None: + raise RuntimeError( + "Unexpected response from the hub, expected a Pull Request URL but got:" + f" '{pr_url}'" + ) + return f"refs/pr/{re_match[1]}" + + +api = HfApi() + +set_access_token = api.set_access_token +unset_access_token = api.unset_access_token + +whoami = api.whoami + +list_models = api.list_models +model_info = api.model_info + +list_datasets = api.list_datasets +dataset_info = api.dataset_info + +list_spaces = api.list_spaces +space_info = api.space_info + +repo_info = api.repo_info +list_repo_files = api.list_repo_files + +list_metrics = api.list_metrics + +get_model_tags = api.get_model_tags +get_dataset_tags = api.get_dataset_tags + +create_commit = api.create_commit +create_repo = api.create_repo +delete_repo = api.delete_repo +update_repo_visibility = api.update_repo_visibility +move_repo = api.move_repo +upload_file = api.upload_file +upload_folder = api.upload_folder +delete_file = api.delete_file +delete_folder = api.delete_folder +create_branch = api.create_branch +delete_branch = api.delete_branch +create_tag = api.create_tag +delete_tag = api.delete_tag +get_full_repo_name = api.get_full_repo_name + +get_discussion_details = api.get_discussion_details +get_repo_discussions = api.get_repo_discussions +create_discussion = api.create_discussion +create_pull_request = api.create_pull_request +change_discussion_status = api.change_discussion_status +comment_discussion = api.comment_discussion +edit_discussion_comment = api.edit_discussion_comment +rename_discussion = api.rename_discussion +merge_pull_request = api.merge_pull_request diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/hub_mixin.py b/.local/lib/python3.10/site-packages/huggingface_hub/hub_mixin.py new file mode 100644 index 0000000000000000000000000000000000000000..b4290e734fd06627630afc37723da82ab343eb50 --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/hub_mixin.py @@ -0,0 +1,491 @@ +import json +import os +import tempfile +from pathlib import Path +from typing import Dict, List, Optional, Union + +import requests + +from .constants import CONFIG_NAME, PYTORCH_WEIGHTS_NAME +from .file_download import hf_hub_download, is_torch_available +from .hf_api import HfApi +from .repository import Repository +from .utils import HfFolder, logging, validate_hf_hub_args +from .utils._deprecation import _deprecate_arguments, _deprecate_positional_args + + +if is_torch_available(): + import torch # type: ignore + +logger = logging.get_logger(__name__) + + +class ModelHubMixin: + """ + A generic Hub mixin for machine learning models. Define your own mixin for + any framework by inheriting from this class and overwriting the + [`_from_pretrained`] and [`_save_pretrained`] methods to define custom logic + for saving and loading your classes. See [`PyTorchModelHubMixin`] for an + example. + """ + + def save_pretrained( + self, + save_directory: Union[str, Path], + config: Optional[dict] = None, + push_to_hub: bool = False, + **kwargs, + ): + """ + Save weights in local directory. + + Parameters: + save_directory (`str` or `Path`): + Specify directory in which you want to save weights. + config (`dict`, *optional*): + Specify config (must be dict) in case you want to save + it. + push_to_hub (`bool`, *optional*, defaults to `False`): + Whether or not to push your model to the Hugging Face Hub after + saving it. You can specify the repository you want to push to with + `repo_id` (will default to the name of `save_directory` in your + namespace). + kwargs: + Additional key word arguments passed along to the + [`~utils.PushToHubMixin.push_to_hub`] method. + """ + os.makedirs(save_directory, exist_ok=True) + + # saving model weights/files + self._save_pretrained(save_directory) + + # saving config + if isinstance(config, dict): + path = os.path.join(save_directory, CONFIG_NAME) + with open(path, "w") as f: + json.dump(config, f) + + if push_to_hub: + kwargs = kwargs.copy() # soft-copy to avoid mutating input + if config is not None: # kwarg for `push_to_hub` + kwargs["config"] = config + + if ( + # If a deprecated argument is passed, we have to use the deprecated + # version of `push_to_hub`. + # TODO: remove this possibility in v0.12 + kwargs.get("repo_url") is not None + or kwargs.get("repo_path_or_name") is not None + or kwargs.get("organization") is not None + or kwargs.get("git_user") is not None + or kwargs.get("git_email") is not None + or kwargs.get("skip_lfs_files") is not None + ): + if kwargs.get("repo_path_or_name") is None: + # Repo name defaults to `save_directory` name + kwargs["repo_path_or_name"] = save_directory + elif kwargs.get("repo_id") is None: + # Repo name defaults to `save_directory` name + kwargs["repo_id"] = Path(save_directory).name + + return self.push_to_hub(**kwargs) + + def _save_pretrained(self, save_directory: Union[str, Path]): + """ + Overwrite this method in subclass to define how to save your model. + """ + raise NotImplementedError + + @classmethod + @validate_hf_hub_args + def from_pretrained( + cls, + pretrained_model_name_or_path: str, + force_download: bool = False, + resume_download: bool = False, + proxies: Optional[Dict] = None, + token: Optional[Union[str, bool]] = None, + cache_dir: Optional[str] = None, + local_files_only: bool = False, + **model_kwargs, + ): + r""" + Download and instantiate a model from the Hugging Face Hub. + + Parameters: + pretrained_model_name_or_path (`str` or `os.PathLike`): + Can be either: + - A string, the `model id` of a pretrained model + hosted inside a model repo on huggingface.co. + Valid model ids can be located at the root-level, + like `bert-base-uncased`, or namespaced under a + user or organization name, like + `dbmdz/bert-base-german-cased`. + - You can add `revision` by appending `@` at the end + of model_id simply like this: + `dbmdz/bert-base-german-cased@main` Revision is + the specific model version to use. It can be a + branch name, a tag name, or a commit id, since we + use a git-based system for storing models and + other artifacts on huggingface.co, so `revision` + can be any identifier allowed by git. + - A path to a `directory` containing model weights + saved using + [`~transformers.PreTrainedModel.save_pretrained`], + e.g., `./my_model_directory/`. + - `None` if you are both providing the configuration + and state dictionary (resp. with keyword arguments + `config` and `state_dict`). + force_download (`bool`, *optional*, defaults to `False`): + Whether to force the (re-)download of the model weights + and configuration files, overriding the cached versions + if they exist. + resume_download (`bool`, *optional*, defaults to `False`): + Whether to delete incompletely received files. Will + attempt to resume the download if such a file exists. + proxies (`Dict[str, str]`, *optional*): + A dictionary of proxy servers to use by protocol or + endpoint, e.g., `{'http': 'foo.bar:3128', + 'http://hostname': 'foo.bar:4012'}`. The proxies are + used on each request. + token (`str` or `bool`, *optional*): + The token to use as HTTP bearer authorization for remote + files. If `True`, will use the token generated when + running `transformers-cli login` (stored in + `~/.huggingface`). + cache_dir (`Union[str, os.PathLike]`, *optional*): + Path to a directory in which a downloaded pretrained + model configuration should be cached if the standard + cache should not be used. + local_files_only(`bool`, *optional*, defaults to `False`): + Whether to only look at local files (i.e., do not try to + download the model). + model_kwargs (`Dict`, *optional*): + model_kwargs will be passed to the model during + initialization + + + + Passing `token=True` is required when you want to use a + private model. + + + """ + + model_id = pretrained_model_name_or_path + + revision = None + if len(model_id.split("@")) == 2: + model_id, revision = model_id.split("@") + + config_file: Optional[str] = None + if os.path.isdir(model_id): + if CONFIG_NAME in os.listdir(model_id): + config_file = os.path.join(model_id, CONFIG_NAME) + else: + logger.warning(f"{CONFIG_NAME} not found in {Path(model_id).resolve()}") + else: + try: + config_file = hf_hub_download( + repo_id=model_id, + filename=CONFIG_NAME, + revision=revision, + cache_dir=cache_dir, + force_download=force_download, + proxies=proxies, + resume_download=resume_download, + token=token, + local_files_only=local_files_only, + ) + except requests.exceptions.RequestException: + logger.warning(f"{CONFIG_NAME} not found in HuggingFace Hub") + + if config_file is not None: + with open(config_file, "r", encoding="utf-8") as f: + config = json.load(f) + model_kwargs.update({"config": config}) + + return cls._from_pretrained( + model_id, + revision, + cache_dir, + force_download, + proxies, + resume_download, + local_files_only, + token, + **model_kwargs, + ) + + @classmethod + def _from_pretrained( + cls, + model_id, + revision, + cache_dir, + force_download, + proxies, + resume_download, + local_files_only, + token, + **model_kwargs, + ): + """Overwrite this method in subclass to define how to load your model from + pretrained""" + raise NotImplementedError + + @_deprecate_positional_args(version="0.12") + @_deprecate_arguments( + version="0.12", + deprecated_args={ + "repo_url", + "repo_path_or_name", + "organization", + "git_user", + "git_email", + "skip_lfs_files", + }, + ) + @validate_hf_hub_args + def push_to_hub( + self, + # NOTE: deprecated signature that will change in 0.12 + *, + repo_path_or_name: Optional[str] = None, + repo_url: Optional[str] = None, + commit_message: str = "Add model", + organization: Optional[str] = None, + private: bool = False, + api_endpoint: Optional[str] = None, + token: Optional[str] = None, + git_user: Optional[str] = None, + git_email: Optional[str] = None, + config: Optional[dict] = None, + skip_lfs_files: bool = False, + # NOTE: New arguments since 0.9 + repo_id: Optional[str] = None, # optional only until 0.12 + branch: Optional[str] = None, + create_pr: Optional[bool] = None, + allow_patterns: Optional[Union[List[str], str]] = None, + ignore_patterns: Optional[Union[List[str], str]] = None, + # TODO (release 0.12): signature must be the following + # repo_id: str, + # *, + # commit_message: str = "Add model", + # private: bool = False, + # api_endpoint: Optional[str] = None, + # token: Optional[str] = None, + # branch: Optional[str] = None, + # create_pr: Optional[bool] = None, + # config: Optional[dict] = None, + # allow_patterns: Optional[Union[List[str], str]] = None, + # ignore_patterns: Optional[Union[List[str], str]] = None, + ) -> str: + """ + Upload model checkpoint to the Hub. + + Use `allow_patterns` and `ignore_patterns` to precisely filter which files + should be pushed to the hub. See [`upload_folder`] reference for more details. + + Parameters: + repo_id (`str`, *optional*): + Repository name to which push. + commit_message (`str`, *optional*): + Message to commit while pushing. + private (`bool`, *optional*, defaults to `False`): + Whether the repository created should be private. + api_endpoint (`str`, *optional*): + The API endpoint to use when pushing the model to the hub. + token (`str`, *optional*): + The token to use as HTTP bearer authorization for remote files. + If not set, will use the token set when logging in with + `transformers-cli login` (stored in `~/.huggingface`). + branch (`str`, *optional*): + The git branch on which to push the model. This defaults to + the default branch as specified in your repository, which + defaults to `"main"`. + create_pr (`boolean`, *optional*): + Whether or not to create a Pull Request from `branch` with that commit. + Defaults to `False`. + config (`dict`, *optional*): + Configuration object to be saved alongside the model weights. + allow_patterns (`List[str]` or `str`, *optional*): + If provided, only files matching at least one pattern are pushed. + ignore_patterns (`List[str]` or `str`, *optional*): + If provided, files matching any of the patterns are not pushed. + + Returns: + The url of the commit of your model in the given repository. + """ + # If the repo id is set, it means we use the new version using HTTP endpoint + # (introduced in v0.9). + if repo_id is not None: + api = HfApi(endpoint=api_endpoint) + api.create_repo( + repo_id=repo_id, + repo_type="model", + token=token, + private=private, + exist_ok=True, + ) + + # Push the files to the repo in a single commit + with tempfile.TemporaryDirectory() as tmp: + saved_path = Path(tmp) / repo_id + self.save_pretrained(saved_path, config=config) + return api.upload_folder( + repo_id=repo_id, + repo_type="model", + token=token, + folder_path=saved_path, + commit_message=commit_message, + revision=branch, + create_pr=create_pr, + allow_patterns=allow_patterns, + ignore_patterns=ignore_patterns, + ) + + # If the repo id is None, it means we use the deprecated version using Git + # TODO: remove code between here and `return repo.git_push()` in release 0.12 + if repo_path_or_name is None and repo_url is None: + raise ValueError( + "You need to specify a `repo_path_or_name` or a `repo_url`." + ) + + if token is None and repo_url is None: + token = HfFolder.get_token() + if token is None: + raise ValueError( + "You must login to the Hugging Face hub on this computer by typing" + " `huggingface-cli login` and entering your credentials to use" + " `token=True`. Alternatively, you can pass your own token" + " as the `token` argument." + ) + elif isinstance(token, str): + token = token + else: + token = None + + if repo_path_or_name is None: + assert repo_url is not None, "A `None` repo URL would have raised above" + repo_path_or_name = repo_url.split("/")[-1] + + # If no URL is passed and there's no path to a directory containing files, create a repo + if repo_url is None and not os.path.exists(repo_path_or_name): + repo_id = Path(repo_path_or_name).name + if organization: + repo_id = f"{organization}/{repo_id}" + repo_url = HfApi(endpoint=api_endpoint).create_repo( + repo_id=repo_id, + token=token, + private=private, + repo_type=None, + exist_ok=True, + ) + + repo = Repository( + repo_path_or_name, + clone_from=repo_url, + token=token, + git_user=git_user, + git_email=git_email, + skip_lfs_files=skip_lfs_files, + ) + repo.git_pull(rebase=True) + + # Save the files in the cloned repo + self.save_pretrained(repo_path_or_name, config=config) + + # Commit and push! + repo.git_add(auto_lfs_track=True) + repo.git_commit(commit_message) + return repo.git_push() + + +class PyTorchModelHubMixin(ModelHubMixin): + """ + Implementation of [`ModelHubMixin`] to provide model Hub upload/download + capabilities to PyTorch models. The model is set in evaluation mode by + default using `model.eval()` (dropout modules are deactivated). To train + the model, you should first set it back in training mode with + `model.train()`. + + Example: + + ```python + >>> import torch + >>> import torch.nn as nn + >>> from huggingface_hub import PyTorchModelHubMixin + + + >>> class MyModel(nn.Module, PyTorchModelHubMixin): + ... def __init__(self): + ... super().__init__() + ... self.param = nn.Parameter(torch.rand(3, 4)) + ... self.linear = nn.Linear(4, 5) + + ... def forward(self, x): + ... return self.linear(x + self.param) + + + >>> model = MyModel() + >>> # Save model weights to local directory + >>> model.save_pretrained("my-awesome-model") + >>> # Push model weights to the Hub + >>> model.push_to_hub("my-awesome-model") + >>> # Download and initialize weights from the Hub + >>> model = MyModel.from_pretrained("username/my-awesome-model") + ``` + """ + + def _save_pretrained(self, save_directory): + """ + Overwrite this method if you wish to save specific layers instead of the + complete model. + """ + path = os.path.join(save_directory, PYTORCH_WEIGHTS_NAME) + model_to_save = self.module if hasattr(self, "module") else self + torch.save(model_to_save.state_dict(), path) + + @classmethod + def _from_pretrained( + cls, + model_id, + revision, + cache_dir, + force_download, + proxies, + resume_download, + local_files_only, + token, + map_location="cpu", + strict=False, + **model_kwargs, + ): + """ + Overwrite this method to initialize your model in a different way. + """ + map_location = torch.device(map_location) + + if os.path.isdir(model_id): + print("Loading weights from local directory") + model_file = os.path.join(model_id, PYTORCH_WEIGHTS_NAME) + else: + model_file = hf_hub_download( + repo_id=model_id, + filename=PYTORCH_WEIGHTS_NAME, + revision=revision, + cache_dir=cache_dir, + force_download=force_download, + proxies=proxies, + resume_download=resume_download, + token=token, + local_files_only=local_files_only, + ) + model = cls(**model_kwargs) + + state_dict = torch.load(model_file, map_location=map_location) + model.load_state_dict(state_dict, strict=strict) + model.eval() + + return model diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/inference_api.py b/.local/lib/python3.10/site-packages/huggingface_hub/inference_api.py new file mode 100644 index 0000000000000000000000000000000000000000..4b9d712ceeb487fddffbbd3bfe8e6a2321539156 --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/inference_api.py @@ -0,0 +1,163 @@ +from typing import Any, Dict, List, Optional, Union + +import requests + +from .hf_api import HfApi +from .utils import logging, validate_hf_hub_args + + +logger = logging.get_logger(__name__) + + +ENDPOINT = "https://api-inference.huggingface.co" + +ALL_TASKS = [ + # NLP + "text-classification", + "token-classification", + "table-question-answering", + "question-answering", + "zero-shot-classification", + "translation", + "summarization", + "conversational", + "feature-extraction", + "text-generation", + "text2text-generation", + "fill-mask", + "sentence-similarity", + # Audio + "text-to-speech", + "automatic-speech-recognition", + "audio-to-audio", + "audio-classification", + "voice-activity-detection", + # Computer vision + "image-classification", + "object-detection", + "image-segmentation", + "text-to-image", + # Others + "tabular-classification", + "tabular-regression", +] + + +class InferenceApi: + """Client to configure requests and make calls to the HuggingFace Inference API. + + Example: + + ```python + >>> from huggingface_hub.inference_api import InferenceApi + + >>> # Mask-fill example + >>> inference = InferenceApi("bert-base-uncased") + >>> inference(inputs="The goal of life is [MASK].") + [{'sequence': 'the goal of life is life.', 'score': 0.10933292657136917, 'token': 2166, 'token_str': 'life'}] + + >>> # Question Answering example + >>> inference = InferenceApi("deepset/roberta-base-squad2") + >>> inputs = { + ... "question": "What's my name?", + ... "context": "My name is Clara and I live in Berkeley.", + ... } + >>> inference(inputs) + {'score': 0.9326569437980652, 'start': 11, 'end': 16, 'answer': 'Clara'} + + >>> # Zero-shot example + >>> inference = InferenceApi("typeform/distilbert-base-uncased-mnli") + >>> inputs = "Hi, I recently bought a device from your company but it is not working as advertised and I would like to get reimbursed!" + >>> params = {"candidate_labels": ["refund", "legal", "faq"]} + >>> inference(inputs, params) + {'sequence': 'Hi, I recently bought a device from your company but it is not working as advertised and I would like to get reimbursed!', 'labels': ['refund', 'faq', 'legal'], 'scores': [0.9378499388694763, 0.04914155602455139, 0.013008488342165947]} + + >>> # Overriding configured task + >>> inference = InferenceApi("bert-base-uncased", task="feature-extraction") + ``` + """ + + @validate_hf_hub_args + def __init__( + self, + repo_id: str, + task: Optional[str] = None, + token: Optional[str] = None, + gpu: bool = False, + ): + """Inits headers and API call information. + + Args: + repo_id (``str``): + Id of repository (e.g. `user/bert-base-uncased`). + task (``str``, `optional`, defaults ``None``): + Whether to force a task instead of using task specified in the + repository. + token (`str`, `optional`): + The API token to use as HTTP bearer authorization. This is not + the authentication token. You can find the token in + https://huggingface.co/settings/token. Alternatively, you can + find both your organizations and personal API tokens using + `HfApi().whoami(token)`. + gpu (``bool``, `optional`, defaults ``False``): + Whether to use GPU instead of CPU for inference(requires Startup + plan at least). + .. note:: + Setting `token` is required when you want to use a private model. + """ + self.options = {"wait_for_model": True, "use_gpu": gpu} + + self.headers = {} + if isinstance(token, str): + self.headers["Authorization"] = f"Bearer {token}" + + # Configure task + model_info = HfApi().model_info(repo_id=repo_id, token=token) + if not model_info.pipeline_tag and not task: + raise ValueError( + "Task not specified in the repository. Please add it to the model card" + " using pipeline_tag" + " (https://huggingface.co/docs#how-is-a-models-type-of-inference-api-and-widget-determined)" + ) + + if task and task != model_info.pipeline_tag: + if task not in ALL_TASKS: + raise ValueError(f"Invalid task {task}. Make sure it's valid.") + + logger.warning( + "You're using a different task than the one specified in the" + " repository. Be sure to know what you're doing :)" + ) + self.task = task + else: + assert model_info.pipeline_tag is not None, "Pipeline tag cannot be None" + self.task = model_info.pipeline_tag + + self.api_url = f"{ENDPOINT}/pipeline/{self.task}/{repo_id}" + + def __repr__(self): + items = (f"{k}='{v}'" for k, v in self.__dict__.items()) + return f"{self.__class__.__name__}({', '.join(items)})" + + def __call__( + self, + inputs: Optional[Union[str, Dict, List[str], List[List[str]]]] = None, + params: Optional[Dict] = None, + data: Optional[bytes] = None, + ): + payload: Dict[str, Any] = { + "options": self.options, + } + + if inputs: + payload["inputs"] = inputs + + if params: + payload["parameters"] = params + + # TODO: Decide if we should raise an error instead of + # returning the json. + response = requests.post( + self.api_url, headers=self.headers, json=payload, data=data + ).json() + return response diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/keras_mixin.py b/.local/lib/python3.10/site-packages/huggingface_hub/keras_mixin.py new file mode 100644 index 0000000000000000000000000000000000000000..cd65ebc19fd4dee662770e87d49317a5e4f8b2bf --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/keras_mixin.py @@ -0,0 +1,619 @@ +import collections.abc as collections +import json +import os +import tempfile +import warnings +from pathlib import Path +from shutil import copytree, rmtree +from typing import Any, Dict, List, Optional, Union +from urllib.parse import quote + +from huggingface_hub import CommitOperationDelete, ModelHubMixin, snapshot_download +from huggingface_hub._commit_api import CommitOperation +from huggingface_hub.utils import ( + get_tf_version, + is_graphviz_available, + is_pydot_available, + is_tf_available, + yaml_dump, +) + +from .constants import CONFIG_NAME, DEFAULT_REVISION +from .hf_api import HfApi, _parse_revision_from_pr_url, _prepare_upload_folder_commit +from .repository import Repository +from .utils import HfFolder, logging, validate_hf_hub_args +from .utils._deprecation import _deprecate_arguments, _deprecate_positional_args + + +logger = logging.get_logger(__name__) + +if is_tf_available(): + import tensorflow as tf # type: ignore + + +def _flatten_dict(dictionary, parent_key=""): + """Flatten a nested dictionary. + Reference: https://stackoverflow.com/a/6027615/10319735 + + Args: + dictionary (`dict`): + The nested dictionary to be flattened. + parent_key (`str`): + The parent key to be prefixed to the childer keys. + Necessary for recursing over the nested dictionary. + + Returns: + The flattened dictionary. + """ + items = [] + for key, value in dictionary.items(): + new_key = f"{parent_key}.{key}" if parent_key else key + if isinstance(value, collections.MutableMapping): + items.extend( + _flatten_dict( + value, + new_key, + ).items() + ) + else: + items.append((new_key, value)) + return dict(items) + + +def _create_hyperparameter_table(model): + """Parse hyperparameter dictionary into a markdown table.""" + if model.optimizer is not None: + optimizer_params = model.optimizer.get_config() + # flatten the configuration + optimizer_params = _flatten_dict(optimizer_params) + optimizer_params[ + "training_precision" + ] = tf.keras.mixed_precision.global_policy().name + table = "| Hyperparameters | Value |\n| :-- | :-- |\n" + for key, value in optimizer_params.items(): + table += f"| {key} | {value} |\n" + else: + table = None + return table + + +def _plot_network(model, save_directory): + tf.keras.utils.plot_model( + model, + to_file=f"{save_directory}/model.png", + show_shapes=False, + show_dtype=False, + show_layer_names=True, + rankdir="TB", + expand_nested=False, + dpi=96, + layer_range=None, + ) + + +def _create_model_card( + model, + repo_dir: Path, + plot_model: bool = True, + metadata: Optional[dict] = None, +): + """ + Creates a model card for the repository. + """ + hyperparameters = _create_hyperparameter_table(model) + if plot_model and is_graphviz_available() and is_pydot_available(): + _plot_network(model, repo_dir) + if metadata is None: + metadata = {} + readme_path = f"{repo_dir}/README.md" + metadata["library_name"] = "keras" + model_card: str = "---\n" + model_card += yaml_dump(metadata, default_flow_style=False) + model_card += "---\n" + model_card += "\n## Model description\n\nMore information needed\n" + model_card += "\n## Intended uses & limitations\n\nMore information needed\n" + model_card += "\n## Training and evaluation data\n\nMore information needed\n" + if hyperparameters is not None: + model_card += "\n## Training procedure\n" + model_card += "\n### Training hyperparameters\n" + model_card += "\nThe following hyperparameters were used during training:\n\n" + model_card += hyperparameters + model_card += "\n" + if plot_model and os.path.exists(f"{repo_dir}/model.png"): + model_card += "\n ## Model Plot\n" + model_card += "\n
" + model_card += "\nView Model Plot\n" + path_to_plot = "./model.png" + model_card += f"\n![Model Image]({path_to_plot})\n" + model_card += "\n
" + + if os.path.exists(readme_path): + with open(readme_path, "r", encoding="utf8") as f: + readme = f.read() + else: + readme = model_card + with open(readme_path, "w", encoding="utf-8") as f: + f.write(readme) + + +def save_pretrained_keras( + model, + save_directory: Union[str, Path], + config: Optional[Dict[str, Any]] = None, + include_optimizer: bool = False, + plot_model: bool = True, + tags: Optional[Union[list, str]] = None, + **model_save_kwargs, +): + """ + Saves a Keras model to save_directory in SavedModel format. Use this if + you're using the Functional or Sequential APIs. + + Args: + model (`Keras.Model`): + The [Keras + model](https://www.tensorflow.org/api_docs/python/tf/keras/Model) + you'd like to save. The model must be compiled and built. + save_directory (`str` or `Path`): + Specify directory in which you want to save the Keras model. + config (`dict`, *optional*): + Configuration object to be saved alongside the model weights. + include_optimizer(`bool`, *optional*, defaults to `False`): + Whether or not to include optimizer in serialization. + plot_model (`bool`, *optional*, defaults to `True`): + Setting this to `True` will plot the model and put it in the model + card. Requires graphviz and pydot to be installed. + tags (Union[`str`,`list`], *optional*): + List of tags that are related to model or string of a single tag. See example tags + [here](https://github.com/huggingface/hub-docs/blame/main/modelcard.md). + model_save_kwargs(`dict`, *optional*): + model_save_kwargs will be passed to + [`tf.keras.models.save_model()`](https://www.tensorflow.org/api_docs/python/tf/keras/models/save_model). + """ + if is_tf_available(): + import tensorflow as tf + else: + raise ImportError( + "Called a Tensorflow-specific function but could not import it." + ) + + if not model.built: + raise ValueError("Model should be built before trying to save") + + save_directory = Path(save_directory) + save_directory.mkdir(parents=True, exist_ok=True) + + # saving config + if config: + if not isinstance(config, dict): + raise RuntimeError( + "Provided config to save_pretrained_keras should be a dict. Got:" + f" '{type(config)}'" + ) + + with (save_directory / CONFIG_NAME).open("w") as f: + json.dump(config, f) + + metadata = {} + if isinstance(tags, list): + metadata["tags"] = tags + elif isinstance(tags, str): + metadata["tags"] = [tags] + + task_name = model_save_kwargs.pop("task_name", None) + if task_name is not None: + warnings.warn( + "`task_name` input argument is deprecated. Pass `tags` instead.", + FutureWarning, + ) + if "tags" in metadata: + metadata["tags"].append(task_name) + else: + metadata["tags"] = [task_name] + + if model.history is not None: + if model.history.history != {}: + path = save_directory / "history.json" + if path.exists(): + warnings.warn( + "`history.json` file already exists, it will be overwritten by the" + " history of this version.", + UserWarning, + ) + with path.open("w", encoding="utf-8") as f: + json.dump(model.history.history, f, indent=2, sort_keys=True) + + _create_model_card(model, save_directory, plot_model, metadata) + tf.keras.models.save_model( + model, save_directory, include_optimizer=include_optimizer, **model_save_kwargs + ) + + +def from_pretrained_keras(*args, **kwargs): + r""" + Instantiate a pretrained Keras model from a pre-trained model from the Hub. + The model is expected to be in `SavedModel` format. + + Parameters: + pretrained_model_name_or_path (`str` or `os.PathLike`): + Can be either: + - A string, the `model id` of a pretrained model hosted inside a + model repo on huggingface.co. Valid model ids can be located + at the root-level, like `bert-base-uncased`, or namespaced + under a user or organization name, like + `dbmdz/bert-base-german-cased`. + - You can add `revision` by appending `@` at the end of model_id + simply like this: `dbmdz/bert-base-german-cased@main` Revision + is the specific model version to use. It can be a branch name, + a tag name, or a commit id, since we use a git-based system + for storing models and other artifacts on huggingface.co, so + `revision` can be any identifier allowed by git. + - A path to a `directory` containing model weights saved using + [`~transformers.PreTrainedModel.save_pretrained`], e.g., + `./my_model_directory/`. + - `None` if you are both providing the configuration and state + dictionary (resp. with keyword arguments `config` and + `state_dict`). + force_download (`bool`, *optional*, defaults to `False`): + Whether to force the (re-)download of the model weights and + configuration files, overriding the cached versions if they exist. + resume_download (`bool`, *optional*, defaults to `False`): + Whether to delete incompletely received files. Will attempt to + resume the download if such a file exists. + proxies (`Dict[str, str]`, *optional*): + A dictionary of proxy servers to use by protocol or endpoint, e.g., + `{'http': 'foo.bar:3128', 'http://hostname': 'foo.bar:4012'}`. The + proxies are used on each request. + token (`str` or `bool`, *optional*): + The token to use as HTTP bearer authorization for remote files. If + `True`, will use the token generated when running `transformers-cli + login` (stored in `~/.huggingface`). + cache_dir (`Union[str, os.PathLike]`, *optional*): + Path to a directory in which a downloaded pretrained model + configuration should be cached if the standard cache should not be + used. + local_files_only(`bool`, *optional*, defaults to `False`): + Whether to only look at local files (i.e., do not try to download + the model). + model_kwargs (`Dict`, *optional*): + model_kwargs will be passed to the model during initialization + + + + Passing `token=True` is required when you want to use a private + model. + + + """ + return KerasModelHubMixin.from_pretrained(*args, **kwargs) + + +@_deprecate_positional_args(version="0.12") +@_deprecate_arguments( + version="0.12", + deprecated_args={ + "repo_path_or_name", + "repo_url", + "organization", + "git_user", + "git_email", + }, +) +@validate_hf_hub_args +def push_to_hub_keras( + # NOTE: deprecated signature that will change in 0.12 + model, + *, + repo_path_or_name: Optional[str] = None, + repo_url: Optional[str] = None, + log_dir: Optional[str] = None, + commit_message: str = "Add Keras model", + organization: Optional[str] = None, + private: bool = False, + api_endpoint: Optional[str] = None, + git_user: Optional[str] = None, + git_email: Optional[str] = None, + config: Optional[dict] = None, + include_optimizer: bool = False, + tags: Optional[Union[list, str]] = None, + plot_model: bool = True, + # NOTE: New arguments since 0.9 + token: Optional[str] = None, + repo_id: Optional[str] = None, # optional only until 0.12 + branch: Optional[str] = None, + create_pr: Optional[bool] = None, + allow_patterns: Optional[Union[List[str], str]] = None, + ignore_patterns: Optional[Union[List[str], str]] = None, + **model_save_kwargs, + # TODO (release 0.12): signature must be the following + # model, + # repo_id: str, + # *, + # commit_message: str = "Add model", + # private: bool = None, + # api_endpoint: Optional[str] = None, + # token: Optional[str] = True, + # branch: Optional[str] = None, + # create_pr: Optional[bool] = None, + # config: Optional[dict] = None, + # allow_patterns: Optional[Union[List[str], str]] = None, + # ignore_patterns: Optional[Union[List[str], str]] = None, + # log_dir: Optional[str] = None, + # include_optimizer: bool = False, + # tags: Optional[Union[list, str]] = None, + # plot_model: Optional[bool] = True, + # **model_save_kwargs, +): + """ + Upload model checkpoint or tokenizer files to the Hub while synchronizing a + local clone of the repo in `repo_path_or_name`. + + Use `allow_patterns` and `ignore_patterns` to precisely filter which files should be + pushed to the hub. See [`upload_folder`] reference for more details. + + Parameters: + model (`Keras.Model`): + The [Keras + model](`https://www.tensorflow.org/api_docs/python/tf/keras/Model`) + you'd like to push to the Hub. The model must be compiled and built. + repo_id (`str`): + Repository name to which push + commit_message (`str`, *optional*, defaults to "Add Keras model"): + Message to commit while pushing. + private (`bool`, *optional*, defaults to `False`): + Whether the repository created should be private. + api_endpoint (`str`, *optional*): + The API endpoint to use when pushing the model to the hub. + token (`str`, *optional*): + The token to use as HTTP bearer authorization for remote files. If + not set, will use the token set when logging in with + `huggingface-cli login` (stored in `~/.huggingface`). + branch (`str`, *optional*): + The git branch on which to push the model. This defaults to + the default branch as specified in your repository, which + defaults to `"main"`. + create_pr (`boolean`, *optional*): + Whether or not to create a Pull Request from `branch` with that commit. + Defaults to `False`. + config (`dict`, *optional*): + Configuration object to be saved alongside the model weights. + allow_patterns (`List[str]` or `str`, *optional*): + If provided, only files matching at least one pattern are pushed. + ignore_patterns (`List[str]` or `str`, *optional*): + If provided, files matching any of the patterns are not pushed. + log_dir (`str`, *optional*): + TensorBoard logging directory to be pushed. The Hub automatically + hosts and displays a TensorBoard instance if log files are included + in the repository. + include_optimizer (`bool`, *optional*, defaults to `False`): + Whether or not to include optimizer during serialization. + tags (Union[`list`, `str`], *optional*): + List of tags that are related to model or string of a single tag. See example tags + [here](https://github.com/huggingface/hub-docs/blame/main/modelcard.md). + plot_model (`bool`, *optional*, defaults to `True`): + Setting this to `True` will plot the model and put it in the model + card. Requires graphviz and pydot to be installed. + model_save_kwargs(`dict`, *optional*): + model_save_kwargs will be passed to + [`tf.keras.models.save_model()`](https://www.tensorflow.org/api_docs/python/tf/keras/models/save_model). + + Returns: + The url of the commit of your model in the given repository. + """ + if repo_id is not None: + api = HfApi(endpoint=api_endpoint) + api.create_repo( + repo_id=repo_id, + repo_type="model", + token=token, + private=private, + exist_ok=True, + ) + + # Push the files to the repo in a single commit + with tempfile.TemporaryDirectory() as tmp: + saved_path = Path(tmp) / repo_id + save_pretrained_keras( + model, + saved_path, + config=config, + include_optimizer=include_optimizer, + tags=tags, + plot_model=plot_model, + **model_save_kwargs, + ) + + # If log dir is provided, delete old logs + add new ones + operations: List[CommitOperation] = [] + if log_dir is not None: + # Delete previous log files from Hub + operations += [ + CommitOperationDelete(path_in_repo=file) + for file in api.list_repo_files(repo_id=repo_id, token=token) + if file.startswith("logs/") + ] + + # Copy new log files + copytree(log_dir, saved_path / "logs") + + # NOTE: `_prepare_upload_folder_commit` and `create_commit` calls are + # duplicate code from `upload_folder`. We are not directly using + # `upload_folder` since we want to add delete operations to the + # commit as well. + operations += _prepare_upload_folder_commit( + saved_path, + path_in_repo="", + allow_patterns=allow_patterns, + ignore_patterns=ignore_patterns, + ) + commit_info = api.create_commit( + repo_type="model", + repo_id=repo_id, + operations=operations, + commit_message=commit_message, + token=token, + revision=branch, + create_pr=create_pr, + ) + revision = branch + if revision is None: + revision = ( + quote(_parse_revision_from_pr_url(commit_info.pr_url), safe="") + if commit_info.pr_url is not None + else DEFAULT_REVISION + ) + return f"{api.endpoint}/{repo_id}/tree/{revision}/" + + # Repo id is None means we use the deprecated version using Git + # TODO: remove code between here and `return repo.git_push()` in release 0.12 + if repo_path_or_name is None and repo_url is None: + raise ValueError("You need to specify a `repo_path_or_name` or a `repo_url`.") + + if isinstance(token, bool) and token: + token = HfFolder.get_token() + elif isinstance(token, str): + token = token + else: + token = None + + if token is None: + raise ValueError( + "You must login to the Hugging Face hub on this computer by typing" + " `huggingface-cli login` and entering your credentials to use" + " `token=True`. Alternatively, you can pass your own token as the" + " `token` argument." + ) + + if repo_path_or_name is None: + assert repo_url is not None, "A `None` repo URL would have raised above" + repo_path_or_name = repo_url.split("/")[-1] + + # If no URL is passed and there's no path to a directory containing files, create a repo + if repo_url is None and not os.path.exists(repo_path_or_name): + repo_id = Path(repo_path_or_name).name + if organization: + repo_id = f"{organization}/{repo_id}" + repo_url = HfApi(endpoint=api_endpoint).create_repo( + repo_id=repo_id, + token=token, + private=private, + repo_type=None, + exist_ok=True, + ) + + repo = Repository( + repo_path_or_name, + clone_from=repo_url, + token=token, + git_user=git_user, + git_email=git_email, + ) + repo.git_pull(rebase=True) + + save_pretrained_keras( + model, + repo_path_or_name, + config=config, + include_optimizer=include_optimizer, + tags=tags, + plot_model=plot_model, + **model_save_kwargs, + ) + + if log_dir is not None: + if os.path.exists(f"{repo_path_or_name}/logs"): + rmtree(f"{repo_path_or_name}/logs") + copytree(log_dir, f"{repo_path_or_name}/logs") + + # Commit and push! + repo.git_add(auto_lfs_track=True) + repo.git_commit(commit_message) + return repo.git_push() + + +class KerasModelHubMixin(ModelHubMixin): + """ + Implementation of [`ModelHubMixin`] to provide model Hub upload/download + capabilities to Keras models. + + + ```python + >>> import tensorflow as tf + >>> from huggingface_hub import KerasModelHubMixin + + + >>> class MyModel(tf.keras.Model, KerasModelHubMixin): + ... def __init__(self, **kwargs): + ... super().__init__() + ... self.config = kwargs.pop("config", None) + ... self.dummy_inputs = ... + ... self.layer = ... + + ... def call(self, *args): + ... return ... + + + >>> # Initialize and compile the model as you normally would + >>> model = MyModel() + >>> model.compile(...) + >>> # Build the graph by training it or passing dummy inputs + >>> _ = model(model.dummy_inputs) + >>> # Save model weights to local directory + >>> model.save_pretrained("my-awesome-model") + >>> # Push model weights to the Hub + >>> model.push_to_hub("my-awesome-model") + >>> # Download and initialize weights from the Hub + >>> model = MyModel.from_pretrained("username/super-cool-model") + ``` + """ + + def _save_pretrained(self, save_directory): + save_pretrained_keras(self, save_directory) + + @classmethod + def _from_pretrained( + cls, + model_id, + revision, + cache_dir, + force_download, + proxies, + resume_download, + local_files_only, + token, + **model_kwargs, + ): + """Here we just call [`from_pretrained_keras`] function so both the mixin and + functional APIs stay in sync. + + TODO - Some args above aren't used since we are calling + snapshot_download instead of hf_hub_download. + """ + if is_tf_available(): + import tensorflow as tf + else: + raise ImportError( + "Called a TensorFlow-specific function but could not import it." + ) + + # TODO - Figure out what to do about these config values. Config is not going to be needed to load model + cfg = model_kwargs.pop("config", None) + + # Root is either a local filepath matching model_id or a cached snapshot + if not os.path.isdir(model_id): + storage_folder = snapshot_download( + repo_id=model_id, + revision=revision, + cache_dir=cache_dir, + library_name="keras", + library_version=get_tf_version(), + ) + else: + storage_folder = model_id + + model = tf.keras.models.load_model(storage_folder, **model_kwargs) + + # For now, we add a new attribute, config, to store the config loaded from the hub/a local dir. + model.config = cfg + + return model diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/lfs.py b/.local/lib/python3.10/site-packages/huggingface_hub/lfs.py new file mode 100644 index 0000000000000000000000000000000000000000..3cbee7324c50b0e80fe99917e40f27b5922f4447 --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/lfs.py @@ -0,0 +1,492 @@ +# coding=utf-8 +# Copyright 2019-present, the HuggingFace Inc. team. +# +# 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. +"""Git LFS related type definitions and utilities""" +import io +import os +import re +from contextlib import AbstractContextManager +from dataclasses import dataclass +from math import ceil +from os.path import getsize +from typing import BinaryIO, Iterable, List, Optional, Tuple + +import requests +from huggingface_hub.constants import ENDPOINT, REPO_TYPES_URL_PREFIXES +from requests.auth import HTTPBasicAuth + +from .utils import ( + get_token_to_send, + hf_raise_for_status, + http_backoff, + validate_hf_hub_args, +) +from .utils._typing import TypedDict +from .utils.sha import sha256, sha_fileobj + + +OID_REGEX = re.compile(r"^[0-9a-f]{40}$") + +LFS_MULTIPART_UPLOAD_COMMAND = "lfs-multipart-upload" + +LFS_HEADERS = { + "Accept": "application/vnd.git-lfs+json", + "Content-Type": "application/vnd.git-lfs+json", +} + + +@dataclass +class UploadInfo: + """ + Dataclass holding required information to determine whether a blob + should be uploaded to the hub using the LFS protocol or the regular protocol + + Args: + sha256 (`bytes`): + SHA256 hash of the blob + size (`int`): + Size in bytes of the blob + sample (`bytes`): + First 512 bytes of the blob + """ + + sha256: bytes + size: int + sample: bytes + + @classmethod + def from_path(cls, path: str): + size = getsize(path) + with io.open(path, "rb") as file: + sample = file.peek(512)[:512] + sha = sha_fileobj(file) + return cls(size=size, sha256=sha, sample=sample) + + @classmethod + def from_bytes(cls, data: bytes): + sha = sha256(data).digest() + return cls(size=len(data), sample=data[:512], sha256=sha) + + @classmethod + def from_fileobj(cls, fileobj: BinaryIO): + sample = fileobj.read(512) + fileobj.seek(0, io.SEEK_SET) + sha = sha_fileobj(fileobj) + size = fileobj.tell() + fileobj.seek(0, io.SEEK_SET) + return cls(size=size, sha256=sha, sample=sample) + + +def _validate_lfs_action(lfs_action: dict): + """validates response from the LFS batch endpoint""" + if not ( + isinstance(lfs_action.get("href"), str) + and ( + lfs_action.get("header") is None + or isinstance(lfs_action.get("header"), dict) + ) + ): + raise ValueError("lfs_action is improperly formatted") + return lfs_action + + +def _validate_batch_actions(lfs_batch_actions: dict): + """validates response from the LFS batch endpoint""" + if not ( + isinstance(lfs_batch_actions.get("oid"), str) + and isinstance(lfs_batch_actions.get("size"), int) + ): + raise ValueError("lfs_batch_actions is improperly formatted") + + upload_action = lfs_batch_actions.get("actions", {}).get("upload") + verify_action = lfs_batch_actions.get("actions", {}).get("verify") + if upload_action is not None: + _validate_lfs_action(upload_action) + if verify_action is not None: + _validate_lfs_action(verify_action) + return lfs_batch_actions + + +def _validate_batch_error(lfs_batch_error: dict): + """validates response from the LFS batch endpoint""" + if not ( + isinstance(lfs_batch_error.get("oid"), str) + and isinstance(lfs_batch_error.get("size"), int) + ): + raise ValueError("lfs_batch_error is improperly formatted") + error_info = lfs_batch_error.get("error") + if not ( + isinstance(error_info, dict) + and isinstance(error_info.get("message"), str) + and isinstance(error_info.get("code"), int) + ): + raise ValueError("lfs_batch_error is improperly formatted") + return lfs_batch_error + + +@validate_hf_hub_args +def post_lfs_batch_info( + upload_infos: Iterable[UploadInfo], + token: Optional[str], + repo_type: str, + repo_id: str, + endpoint: Optional[str] = None, +) -> Tuple[List[dict], List[dict]]: + """ + Requests the LFS batch endpoint to retrieve upload instructions + + Learn more: https://github.com/git-lfs/git-lfs/blob/main/docs/api/batch.md + + Args: + upload_infos (`Iterable` of `UploadInfo`): + `UploadInfo` for the files that are being uploaded, typically obtained + from `CommitOperationAdd.upload_info` + repo_type (`str`): + Type of the repo to upload to: `"model"`, `"dataset"` or `"space"`. + repo_id (`str`): + A namespace (user or an organization) and a repo name separated + by a `/`. + token (`str`, *optional*): + An authentication token ( See https://huggingface.co/settings/tokens ) + + Returns: + `LfsBatchInfo`: 2-tuple: + - First element is the list of upload instructions from the server + - Second element is an list of errors, if any + + Raises: + `ValueError`: If an argument is invalid or the server response is malformed + + `HTTPError`: If the server returned an error + """ + endpoint = endpoint if endpoint is not None else ENDPOINT + url_prefix = "" + if repo_type in REPO_TYPES_URL_PREFIXES: + url_prefix = REPO_TYPES_URL_PREFIXES[repo_type] + batch_url = f"{endpoint}/{url_prefix}{repo_id}.git/info/lfs/objects/batch" + resp = requests.post( + batch_url, + headers={ + "Accept": "application/vnd.git-lfs+json", + "Content-Type": "application/vnd.git-lfs+json", + }, + json={ + "operation": "upload", + "transfers": ["basic", "multipart"], + "objects": [ + { + "oid": upload.sha256.hex(), + "size": upload.size, + } + for upload in upload_infos + ], + "hash_algo": "sha256", + }, + auth=HTTPBasicAuth( + "access_token", + get_token_to_send(token or True), # Token must be provided or retrieved + ), + ) + hf_raise_for_status(resp) + batch_info = resp.json() + + objects = batch_info.get("objects", None) + if not isinstance(objects, list): + raise ValueError("Malformed response from server") + + return ( + [_validate_batch_actions(obj) for obj in objects if "error" not in obj], + [_validate_batch_error(obj) for obj in objects if "error" in obj], + ) + + +def lfs_upload( + fileobj: BinaryIO, + upload_info: UploadInfo, + upload_action: dict, + verify_action: Optional[dict], + token: Optional[str], +): + """ + Uploads a file using the git lfs protocol and determines automatically whether or not + to use the multipart transfer protocol + + Args: + fileobj (file-like object): + The content of the file to upload + upload_info (`UploadInfo`): + Upload info for `fileobj` + upload_action (`dict`): + The `upload` action from the LFS Batch endpoint. Must contain + a `href` field, and optionally a `header` field. + verify_action (`dict`): + The `verify` action from the LFS Batch endpoint. Must contain + a `href` field, and optionally a `header` field. The `href` URL will + be called after a successful upload. + token (`str`, *optional*): + A [user access token](https://hf.co/settings/tokens) to authenticate requests + against the Hub. + + Returns: + `requests.Response`: + the response from the completion request in case of a multi-part upload, and the + response from the single PUT request in case of a single-part upload + + Raises: + `ValueError`: if some objects / responses are malformed + + `requests.HTTPError` + """ + _validate_lfs_action(upload_action) + if verify_action is not None: + _validate_lfs_action(verify_action) + + header = upload_action.get("header", {}) + chunk_size = header.get("chunk_size", None) + if chunk_size is not None: + if isinstance(chunk_size, str): + chunk_size = int(chunk_size, 10) + else: + raise ValueError( + "Malformed response from LFS batch endpoint: `chunk_size`" + " should be a string" + ) + _upload_multi_part( + completion_url=upload_action["href"], + fileobj=fileobj, + chunk_size=chunk_size, + header=header, + upload_info=upload_info, + ) + else: + _upload_single_part( + upload_url=upload_action["href"], + fileobj=fileobj, + ) + if verify_action is not None: + verify_resp = requests.post( + verify_action["href"], + auth=HTTPBasicAuth( + username="USER", + # Token must be provided or retrieved + password=get_token_to_send(token or True), + ), + json={"oid": upload_info.sha256.hex(), "size": upload_info.size}, + ) + hf_raise_for_status(verify_resp) + + +def _upload_single_part(upload_url: str, fileobj: BinaryIO): + """ + Uploads `fileobj` as a single PUT HTTP request (basic LFS transfer protocol) + + Args: + upload_url (`str`): + The URL to PUT the file to. + fileobj: + The file-like object holding the data to upload. + + Returns: `requests.Response` + + Raises: `requests.HTTPError` if the upload resulted in an error + """ + upload_res = http_backoff("PUT", upload_url, data=fileobj) + hf_raise_for_status(upload_res) + return upload_res + + +class PayloadPartT(TypedDict): + partNumber: int + etag: str + + +class CompletionPayloadT(TypedDict): + """Payload that will be sent to the Hub when uploading multi-part.""" + + oid: str + parts: List[PayloadPartT] + + +def _upload_multi_part( + completion_url: str, + fileobj: BinaryIO, + header: dict, + chunk_size: int, + upload_info: UploadInfo, +): + """ + Uploads `fileobj` using HF multipart LFS transfer protocol. + + Args: + completion_url (`str`): + The URL to GET after completing all parts uploads. + fileobj: + The file-like object holding the data to upload. + header (`dict`): + The `header` field from the `upload` action from the LFS + Batch endpoint response + chunk_size (`int`): + The size in bytes of the parts. `fileobj` will be uploaded in parts + of `chunk_size` bytes (except for the last part who can be smaller) + upload_info (`UploadInfo`): + `UploadInfo` for `fileobj`. + + Returns: `requests.Response`: The response from requesting `completion_url`. + + Raises: `requests.HTTPError` if uploading any of the parts resulted in an error. + + Raises: `requests.HTTPError` if requesting `completion_url` resulted in an error. + + """ + sorted_part_upload_urls = [ + upload_url + for _, upload_url in sorted( + [ + (int(part_num, 10), upload_url) + for part_num, upload_url in header.items() + if part_num.isdigit() and len(part_num) > 0 + ], + key=lambda t: t[0], + ) + ] + num_parts = len(sorted_part_upload_urls) + if num_parts != ceil(upload_info.size / chunk_size): + raise ValueError("Invalid server response to upload large LFS file") + + completion_payload: CompletionPayloadT = { + "oid": upload_info.sha256.hex(), + "parts": [ + { + "partNumber": idx + 1, + "etag": "", + } + for idx in range(num_parts) + ], + } + + for part_idx, part_upload_url in enumerate(sorted_part_upload_urls): + with SliceFileObj( + fileobj, + seek_from=chunk_size * part_idx, + read_limit=chunk_size, + ) as fileobj_slice: + part_upload_res = http_backoff("PUT", part_upload_url, data=fileobj_slice) + hf_raise_for_status(part_upload_res) + etag = part_upload_res.headers.get("etag") + if etag is None or etag == "": + raise ValueError( + f"Invalid etag (`{etag}`) returned for part {part_idx +1} of" + f" {num_parts}" + ) + completion_payload["parts"][part_idx]["etag"] = etag + + completion_res = requests.post( + completion_url, + json=completion_payload, + headers=LFS_HEADERS, + ) + hf_raise_for_status(completion_res) + return completion_res + + +class SliceFileObj(AbstractContextManager): + """ + Utility context manager to read a *slice* of a seekable file-like object as a seekable, file-like object. + + This is NOT thread safe + + Inspired by stackoverflow.com/a/29838711/593036 + + Credits to @julien-c + + Args: + fileobj (`BinaryIO`): + A file-like object to slice. MUST implement `tell()` and `seek()` (and `read()` of course). + `fileobj` will be reset to its original position when exiting the context manager. + seek_from (`int`): + The start of the slice (offset from position 0 in bytes). + read_limit (`int`): + The maximum number of bytes to read from the slice. + + Attributes: + previous_position (`int`): + The previous position + + Examples: + + Reading 200 bytes with an offset of 128 bytes from a file (ie bytes 128 to 327): + ```python + >>> with open("path/to/file", "rb") as file: + ... with SliceFileObj(file, seek_from=128, read_limit=200) as fslice: + ... fslice.read(...) + ``` + + Reading a file in chunks of 512 bytes + ```python + >>> import os + >>> chunk_size = 512 + >>> file_size = os.getsize("path/to/file") + >>> with open("path/to/file", "rb") as file: + ... for chunk_idx in range(ceil(file_size / chunk_size)): + ... with SliceFileObj(file, seek_from=chunk_idx * chunk_size, read_limit=chunk_size) as fslice: + ... chunk = fslice.read(...) + + ``` + """ + + def __init__(self, fileobj: BinaryIO, seek_from: int, read_limit: int): + self.fileobj = fileobj + self.seek_from = seek_from + self.read_limit = read_limit + + def __enter__(self): + self._previous_position = self.fileobj.tell() + end_of_stream = self.fileobj.seek(0, os.SEEK_END) + self._len = min(self.read_limit, end_of_stream - self.seek_from) + # ^^ The actual number of bytes that can be read from the slice + self.fileobj.seek(self.seek_from, io.SEEK_SET) + return self + + def __exit__(self, exc_type, exc_value, traceback): + self.fileobj.seek(self._previous_position, io.SEEK_SET) + + def read(self, n: int = -1): + pos = self.tell() + if pos >= self._len: + return b"" + remaining_amount = self._len - pos + data = self.fileobj.read( + remaining_amount if n < 0 else min(n, remaining_amount) + ) + return data + + def tell(self) -> int: + return self.fileobj.tell() - self.seek_from + + def seek(self, offset: int, whence: int = os.SEEK_SET) -> int: + start = self.seek_from + end = start + self._len + if whence in (os.SEEK_SET, os.SEEK_END): + offset = start + offset if whence == os.SEEK_SET else end + offset + offset = max(start, min(offset, end)) + whence = os.SEEK_SET + elif whence == os.SEEK_CUR: + cur_pos = self.fileobj.tell() + offset = max(start - cur_pos, min(offset, end - cur_pos)) + else: + raise ValueError(f"whence value {whence} is not supported") + return self.fileobj.seek(offset, whence) - self.seek_from + + def __iter__(self): + yield self.read(n=4 * 1024 * 1024) diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/py.typed b/.local/lib/python3.10/site-packages/huggingface_hub/py.typed new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/repocard.py b/.local/lib/python3.10/site-packages/huggingface_hub/repocard.py new file mode 100644 index 0000000000000000000000000000000000000000..f88c932a89a13d2e81226d78d5f9b80ee031558a --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/repocard.py @@ -0,0 +1,836 @@ +import os +import re +import sys +import tempfile +from pathlib import Path +from typing import Any, Dict, Optional, Type, Union + + +if sys.version_info >= (3, 8): + from typing import Literal +else: + from typing_extensions import Literal + +import requests +import yaml +from huggingface_hub.file_download import hf_hub_download +from huggingface_hub.hf_api import upload_file +from huggingface_hub.repocard_data import ( + CardData, + DatasetCardData, + EvalResult, + ModelCardData, + eval_results_to_model_index, + model_index_to_eval_results, +) +from huggingface_hub.utils import is_jinja_available, yaml_dump + +from .constants import REPOCARD_NAME +from .utils import EntryNotFoundError, validate_hf_hub_args +from .utils._deprecation import _deprecate_positional_args +from .utils.logging import get_logger + + +TEMPLATE_MODELCARD_PATH = Path(__file__).parent / "templates" / "modelcard_template.md" +TEMPLATE_DATASETCARD_PATH = ( + Path(__file__).parent / "templates" / "datasetcard_template.md" +) + +# exact same regex as in the Hub server. Please keep in sync. +REGEX_YAML_BLOCK = re.compile(r"---[\n\r]+([\S\s]*?)[\n\r]+---[\n\r]") + +logger = get_logger(__name__) + + +class RepoCard: + card_data_class = CardData + default_template_path = TEMPLATE_MODELCARD_PATH + repo_type = "model" + + def __init__(self, content: str): + """Initialize a RepoCard from string content. The content should be a + Markdown file with a YAML block at the beginning and a Markdown body. + + Args: + content (`str`): The content of the Markdown file. + + Example: + ```python + >>> from huggingface_hub.repocard import RepoCard + >>> text = ''' + ... --- + ... language: en + ... license: mit + ... --- + ... + ... # My repo + ... ''' + >>> card = RepoCard(text) + >>> card.data.to_dict() + {'language': 'en', 'license': 'mit'} + >>> card.text + '\\n# My repo\\n' + + ``` + + Raises the following error: + + - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) + when the content of the repo card metadata is not a dictionary. + + + """ + + # Set the content of the RepoCard, as well as underlying .data and .text attributes. + # See the `content` property setter for more details. + self.content = content + + @property + def content(self): + """The content of the RepoCard, including the YAML block and the Markdown body.""" + line_break = _detect_line_ending(self._content) or "\n" + return f"---{line_break}{self.data.to_yaml(line_break=line_break)}{line_break}---{line_break}{self.text}" + + @content.setter + def content(self, content: str): + """Set the content of the RepoCard.""" + self._content = content + + match = REGEX_YAML_BLOCK.search(content) + if match: + # Metadata found in the YAML block + yaml_block = match.group(1) + self.text = content[match.end() :] + data_dict = yaml.safe_load(yaml_block) + + # The YAML block's data should be a dictionary + if not isinstance(data_dict, dict): + raise ValueError("repo card metadata block should be a dict") + else: + # Model card without metadata... create empty metadata + logger.warning( + "Repo card metadata block was not found. Setting CardData to empty." + ) + data_dict = {} + self.text = content + + self.data = self.card_data_class(**data_dict) + + def __str__(self): + return self.content + + def save(self, filepath: Union[Path, str]): + r"""Save a RepoCard to a file. + + Args: + filepath (`Union[Path, str]`): Filepath to the markdown file to save. + + Example: + ```python + >>> from huggingface_hub.repocard import RepoCard + >>> card = RepoCard("---\nlanguage: en\n---\n# This is a test repo card") + >>> card.save("/tmp/test.md") + + ``` + """ + filepath = Path(filepath) + filepath.parent.mkdir(parents=True, exist_ok=True) + filepath.write_text(str(self), encoding="utf-8") + + @classmethod + def load( + cls, + repo_id_or_path: Union[str, Path], + repo_type: Optional[str] = None, + token: Optional[str] = None, + ): + """Initialize a RepoCard from a Hugging Face Hub repo's README.md or a local filepath. + + Args: + repo_id_or_path (`Union[str, Path]`): + The repo ID associated with a Hugging Face Hub repo or a local filepath. + repo_type (`str`, *optional*): + The type of Hugging Face repo to push to. Defaults to None, which will use + use "model". Other options are "dataset" and "space". Not used when loading from + a local filepath. If this is called from a child class, the default value will be + the child class's `repo_type`. + token (`str`, *optional*): + Authentication token, obtained with `huggingface_hub.HfApi.login` method. Will default to + the stored token. + + Returns: + [`huggingface_hub.repocard.RepoCard`]: The RepoCard (or subclass) initialized from the repo's + README.md file or filepath. + + Example: + ```python + >>> from huggingface_hub.repocard import RepoCard + >>> card = RepoCard.load("nateraw/food") + >>> assert card.data.tags == ["generated_from_trainer", "image-classification", "pytorch"] + + ``` + """ + + if Path(repo_id_or_path).exists(): + card_path = Path(repo_id_or_path) + elif isinstance(repo_id_or_path, str): + card_path = hf_hub_download( + repo_id_or_path, + REPOCARD_NAME, + repo_type=repo_type or cls.repo_type, + token=token, + ) + else: + raise ValueError( + f"Cannot load RepoCard: path not found on disk ({repo_id_or_path})." + ) + + # Preserve newlines in the existing file. + with Path(card_path).open(mode="r", newline="", encoding="utf-8") as f: + return cls(f.read()) + + def validate(self, repo_type: Optional[str] = None): + """Validates card against Hugging Face Hub's card validation logic. + Using this function requires access to the internet, so it is only called + internally by [`huggingface_hub.repocard.RepoCard.push_to_hub`]. + + Args: + repo_type (`str`, *optional*, defaults to "model"): + The type of Hugging Face repo to push to. Options are "model", "dataset", and "space". + If this function is called from a child class, the default will be the child class's `repo_type`. + + + Raises the following errors: + + - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) + if the card fails validation checks. + - [`HTTPError`](https://2.python-requests.org/en/master/api/#requests.HTTPError) + if the request to the Hub API fails for any other reason. + + + """ + + # If repo type is provided, otherwise, use the repo type of the card. + repo_type = repo_type or self.repo_type + + body = { + "repoType": repo_type, + "content": str(self), + } + headers = {"Accept": "text/plain"} + + try: + r = requests.post( + "https://huggingface.co/api/validate-yaml", body, headers=headers + ) + r.raise_for_status() + except requests.exceptions.HTTPError as exc: + if r.status_code == 400: + raise ValueError(r.text) + else: + raise exc + + def push_to_hub( + self, + repo_id: str, + token: Optional[str] = None, + repo_type: Optional[str] = None, + commit_message: Optional[str] = None, + commit_description: Optional[str] = None, + revision: Optional[str] = None, + create_pr: Optional[bool] = None, + parent_commit: Optional[str] = None, + ): + """Push a RepoCard to a Hugging Face Hub repo. + + Args: + repo_id (`str`): + The repo ID of the Hugging Face Hub repo to push to. Example: "nateraw/food". + token (`str`, *optional*): + Authentication token, obtained with `huggingface_hub.HfApi.login` method. Will default to + the stored token. + repo_type (`str`, *optional*, defaults to "model"): + The type of Hugging Face repo to push to. Options are "model", "dataset", and "space". If this + function is called by a child class, it will default to the child class's `repo_type`. + commit_message (`str`, *optional*): + The summary / title / first line of the generated commit. + commit_description (`str`, *optional*) + The description of the generated commit. + revision (`str`, *optional*): + The git revision to commit from. Defaults to the head of the `"main"` branch. + create_pr (`bool`, *optional*): + Whether or not to create a Pull Request with this commit. Defaults to `False`. + parent_commit (`str`, *optional*): + The OID / SHA of the parent commit, as a hexadecimal string. Shorthands (7 first characters) are also supported. + If specified and `create_pr` is `False`, the commit will fail if `revision` does not point to `parent_commit`. + If specified and `create_pr` is `True`, the pull request will be created from `parent_commit`. + Specifying `parent_commit` ensures the repo has not changed before committing the changes, and can be + especially useful if the repo is updated / committed to concurrently. + Returns: + `str`: URL of the commit which updated the card metadata. + """ + + # If repo type is provided, otherwise, use the repo type of the card. + repo_type = repo_type or self.repo_type + + # Validate card before pushing to hub + self.validate(repo_type=repo_type) + + with tempfile.TemporaryDirectory() as tmpdir: + tmp_path = Path(tmpdir) / REPOCARD_NAME + tmp_path.write_text(str(self)) + url = upload_file( + path_or_fileobj=str(tmp_path), + path_in_repo=REPOCARD_NAME, + repo_id=repo_id, + token=token, + repo_type=repo_type, + commit_message=commit_message, + commit_description=commit_description, + create_pr=create_pr, + revision=revision, + parent_commit=parent_commit, + ) + return url + + @classmethod + def from_template( + cls, + card_data: CardData, + template_path: Optional[str] = None, + **template_kwargs, + ): + """Initialize a RepoCard from a template. By default, it uses the default template. + + Templates are Jinja2 templates that can be customized by passing keyword arguments. + + Args: + card_data (`huggingface_hub.CardData`): + A huggingface_hub.CardData instance containing the metadata you want to include in the YAML + header of the repo card on the Hugging Face Hub. + template_path (`str`, *optional*): + A path to a markdown file with optional Jinja template variables that can be filled + in with `template_kwargs`. Defaults to the default template. + + Returns: + [`huggingface_hub.repocard.RepoCard`]: A RepoCard instance with the specified card data and content from the + template. + """ + if is_jinja_available(): + import jinja2 + else: + raise ImportError( + "Using RepoCard.from_template requires Jinja2 to be installed. Please" + " install it with `pip install Jinja2`." + ) + + kwargs = card_data.to_dict().copy() + kwargs.update(template_kwargs) # Template_kwargs have priority + template = jinja2.Template( + Path(template_path or cls.default_template_path).read_text() + ) + content = template.render(card_data=card_data.to_yaml(), **kwargs) + return cls(content) + + +class ModelCard(RepoCard): + card_data_class = ModelCardData + default_template_path = TEMPLATE_MODELCARD_PATH + repo_type = "model" + + @classmethod + def from_template( # type: ignore # violates Liskov property but easier to use + cls, + card_data: ModelCardData, + template_path: Optional[str] = None, + **template_kwargs, + ): + """Initialize a ModelCard from a template. By default, it uses the default template, which can be found here: + https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/templates/modelcard_template.md + + Templates are Jinja2 templates that can be customized by passing keyword arguments. + + Args: + card_data (`huggingface_hub.ModelCardData`): + A huggingface_hub.ModelCardData instance containing the metadata you want to include in the YAML + header of the model card on the Hugging Face Hub. + template_path (`str`, *optional*): + A path to a markdown file with optional Jinja template variables that can be filled + in with `template_kwargs`. Defaults to the default template. + + Returns: + [`huggingface_hub.ModelCard`]: A ModelCard instance with the specified card data and content from the + template. + + Example: + ```python + >>> from huggingface_hub import ModelCard, ModelCardData, EvalResult + + >>> # Using the Default Template + >>> card_data = ModelCardData( + ... language='en', + ... license='mit', + ... library_name='timm', + ... tags=['image-classification', 'resnet'], + ... datasets='beans', + ... metrics=['accuracy'], + ... ) + >>> card = ModelCard.from_template( + ... card_data, + ... model_description='This model does x + y...' + ... ) + + >>> # Including Evaluation Results + >>> card_data = ModelCardData( + ... language='en', + ... tags=['image-classification', 'resnet'], + ... eval_results=[ + ... EvalResult( + ... task_type='image-classification', + ... dataset_type='beans', + ... dataset_name='Beans', + ... metric_type='accuracy', + ... metric_value=0.9, + ... ), + ... ], + ... model_name='my-cool-model', + ... ) + >>> card = ModelCard.from_template(card_data) + + >>> # Using a Custom Template + >>> card_data = ModelCardData( + ... language='en', + ... tags=['image-classification', 'resnet'] + ... ) + >>> card = ModelCard.from_template( + ... card_data=card_data, + ... template_path='./src/huggingface_hub/templates/modelcard_template.md', + ... custom_template_var='custom value', # will be replaced in template if it exists + ... ) + + ``` + """ + return super().from_template(card_data, template_path, **template_kwargs) + + +class DatasetCard(RepoCard): + card_data_class = DatasetCardData + default_template_path = TEMPLATE_DATASETCARD_PATH + repo_type = "dataset" + + @classmethod + def from_template( # type: ignore # violates Liskov property but easier to use + cls, + card_data: DatasetCardData, + template_path: Optional[str] = None, + **template_kwargs, + ): + """Initialize a DatasetCard from a template. By default, it uses the default template, which can be found here: + https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/templates/datasetcard_template.md + + Templates are Jinja2 templates that can be customized by passing keyword arguments. + + Args: + card_data (`huggingface_hub.DatasetCardData`): + A huggingface_hub.DatasetCardData instance containing the metadata you want to include in the YAML + header of the dataset card on the Hugging Face Hub. + template_path (`str`, *optional*): + A path to a markdown file with optional Jinja template variables that can be filled + in with `template_kwargs`. Defaults to the default template. + + Returns: + [`huggingface_hub.DatasetCard`]: A DatasetCard instance with the specified card data and content from the + template. + + Example: + ```python + >>> from huggingface_hub import DatasetCard, DatasetCardData + + >>> # Using the Default Template + >>> card_data = DatasetCardData( + ... language='en', + ... license='mit', + ... annotations_creators='crowdsourced', + ... task_categories=['text-classification'], + ... task_ids=['sentiment-classification', 'text-scoring'], + ... multilinguality='monolingual', + ... pretty_name='My Text Classification Dataset', + ... ) + >>> card = DatasetCard.from_template( + ... card_data, + ... pretty_name=card_data.pretty_name, + ... ) + + >>> # Using a Custom Template + >>> card_data = DatasetCardData( + ... language='en', + ... license='mit', + ... ) + >>> card = DatasetCard.from_template( + ... card_data=card_data, + ... template_path='./src/huggingface_hub/templates/datasetcard_template.md', + ... custom_template_var='custom value', # will be replaced in template if it exists + ... ) + + ``` + """ + return super().from_template(card_data, template_path, **template_kwargs) + + +def _detect_line_ending(content: str) -> Literal["\r", "\n", "\r\n", None]: + """Detect the line ending of a string. Used by RepoCard to avoid making huge diff on newlines. + + Uses same implem as in Hub server, keep it in sync. + + Returns: + str: The detected line ending of the string. + """ + cr = content.count("\r") + lf = content.count("\n") + crlf = content.count("\r\n") + if cr + lf == 0: + return None + if crlf == cr and crlf == lf: + return "\r\n" + if cr > lf: + return "\r" + else: + return "\n" + + +def metadata_load(local_path: Union[str, Path]) -> Optional[Dict]: + content = Path(local_path).read_text() + match = REGEX_YAML_BLOCK.search(content) + if match: + yaml_block = match.group(1) + data = yaml.safe_load(yaml_block) + if isinstance(data, dict): + return data + else: + raise ValueError("repo card metadata block should be a dict") + else: + return None + + +def metadata_save(local_path: Union[str, Path], data: Dict) -> None: + """ + Save the metadata dict in the upper YAML part Trying to preserve newlines as + in the existing file. Docs about open() with newline="" parameter: + https://docs.python.org/3/library/functions.html?highlight=open#open Does + not work with "^M" linebreaks, which are replaced by \n + """ + line_break = "\n" + content = "" + # try to detect existing newline character + if os.path.exists(local_path): + with open(local_path, "r", newline="") as readme: + if type(readme.newlines) is tuple: + line_break = readme.newlines[0] + if type(readme.newlines) is str: + line_break = readme.newlines + content = readme.read() + + # creates a new file if it not + with open(local_path, "w", newline="") as readme: + data_yaml = yaml_dump(data, sort_keys=False, line_break=line_break) + # sort_keys: keep dict order + match = REGEX_YAML_BLOCK.search(content) + if match: + output = ( + content[: match.start()] + + f"---{line_break}{data_yaml}---{line_break}" + + content[match.end() :] + ) + else: + output = f"---{line_break}{data_yaml}---{line_break}{content}" + + readme.write(output) + readme.close() + + +@_deprecate_positional_args(version="0.12") +def metadata_eval_result( + *, + model_pretty_name: str, + task_pretty_name: str, + task_id: str, + metrics_pretty_name: str, + metrics_id: str, + metrics_value: Any, + dataset_pretty_name: str, + dataset_id: str, + metrics_config: Optional[str] = None, + metrics_verified: bool = False, + dataset_config: Optional[str] = None, + dataset_split: Optional[str] = None, + dataset_revision: Optional[str] = None, + metrics_verification_token: Optional[str] = None, +) -> Dict: + """ + Creates a metadata dict with the result from a model evaluated on a dataset. + + Args: + model_pretty_name (`str`): + The name of the model in natural language. + task_pretty_name (`str`): + The name of a task in natural language. + task_id (`str`): + Example: automatic-speech-recognition. A task id. + metrics_pretty_name (`str`): + A name for the metric in natural language. Example: Test WER. + metrics_id (`str`): + Example: wer. A metric id from https://hf.co/metrics. + metrics_value (`Any`): + The value from the metric. Example: 20.0 or "20.0 ± 1.2". + dataset_pretty_name (`str`): + The name of the dataset in natural language. + dataset_id (`str`): + Example: common_voice. A dataset id from https://hf.co/datasets. + metrics_config (`str`, *optional*): + The name of the metric configuration used in `load_metric()`. + Example: bleurt-large-512 in `load_metric("bleurt", "bleurt-large-512")`. + metrics_verified (`bool`, *optional*, defaults to `False`): + Indicates whether the metrics originate from Hugging Face's [evaluation service](https://huggingface.co/spaces/autoevaluate/model-evaluator) or not. Automatically computed by Hugging Face, do not set. + dataset_config (`str`, *optional*): + Example: fr. The name of the dataset configuration used in `load_dataset()`. + dataset_split (`str`, *optional*): + Example: test. The name of the dataset split used in `load_dataset()`. + dataset_revision (`str`, *optional*): + Example: 5503434ddd753f426f4b38109466949a1217c2bb. The name of the dataset dataset revision + used in `load_dataset()`. + metrics_verification_token (`bool`, *optional*): + A JSON Web Token that is used to verify whether the metrics originate from Hugging Face's [evaluation service](https://huggingface.co/spaces/autoevaluate/model-evaluator) or not. + + Returns: + `dict`: a metadata dict with the result from a model evaluated on a dataset. + + Example: + ```python + >>> from huggingface_hub import metadata_eval_result + >>> results = metadata_eval_result( + ... model_pretty_name="RoBERTa fine-tuned on ReactionGIF", + ... task_pretty_name="Text Classification", + ... task_id="text-classification", + ... metrics_pretty_name="Accuracy", + ... metrics_id="accuracy", + ... metrics_value=0.2662102282047272, + ... dataset_pretty_name="ReactionJPEG", + ... dataset_id="julien-c/reactionjpeg", + ... dataset_config="default", + ... dataset_split="test", + ... ) + >>> results == { + ... 'model-index': [ + ... { + ... 'name': 'RoBERTa fine-tuned on ReactionGIF', + ... 'results': [ + ... { + ... 'task': { + ... 'type': 'text-classification', + ... 'name': 'Text Classification' + ... }, + ... 'dataset': { + ... 'name': 'ReactionJPEG', + ... 'type': 'julien-c/reactionjpeg', + ... 'config': 'default', + ... 'split': 'test' + ... }, + ... 'metrics': [ + ... { + ... 'type': 'accuracy', + ... 'value': 0.2662102282047272, + ... 'name': 'Accuracy', + ... 'verified': False + ... } + ... ] + ... } + ... ] + ... } + ... ] + ... } + True + + ``` + """ + + return { + "model-index": eval_results_to_model_index( + model_name=model_pretty_name, + eval_results=[ + EvalResult( + task_name=task_pretty_name, + task_type=task_id, + metric_name=metrics_pretty_name, + metric_type=metrics_id, + metric_value=metrics_value, + dataset_name=dataset_pretty_name, + dataset_type=dataset_id, + metric_config=metrics_config, + verified=metrics_verified, + verify_token=metrics_verification_token, + dataset_config=dataset_config, + dataset_split=dataset_split, + dataset_revision=dataset_revision, + ) + ], + ) + } + + +@validate_hf_hub_args +def metadata_update( + repo_id: str, + metadata: Dict, + *, + repo_type: Optional[str] = None, + overwrite: bool = False, + token: Optional[str] = None, + commit_message: Optional[str] = None, + commit_description: Optional[str] = None, + revision: Optional[str] = None, + create_pr: bool = False, + parent_commit: Optional[str] = None, +) -> str: + """ + Updates the metadata in the README.md of a repository on the Hugging Face Hub. + If the README.md file doesn't exist yet, a new one is created with metadata and an + the default ModelCard or DatasetCard template. For `space` repo, an error is thrown + as a Space cannot exist without a `README.md` file. + + Args: + repo_id (`str`): + The name of the repository. + metadata (`dict`): + A dictionary containing the metadata to be updated. + repo_type (`str`, *optional*): + Set to `"dataset"` or `"space"` if updating to a dataset or space, + `None` or `"model"` if updating to a model. Default is `None`. + overwrite (`bool`, *optional*, defaults to `False`): + If set to `True` an existing field can be overwritten, otherwise + attempting to overwrite an existing field will cause an error. + token (`str`, *optional*): + The Hugging Face authentication token. + commit_message (`str`, *optional*): + The summary / title / first line of the generated commit. Defaults to + `f"Update metadata with huggingface_hub"` + commit_description (`str` *optional*) + The description of the generated commit + revision (`str`, *optional*): + The git revision to commit from. Defaults to the head of the + `"main"` branch. + create_pr (`boolean`, *optional*): + Whether or not to create a Pull Request from `revision` with that commit. + Defaults to `False`. + parent_commit (`str`, *optional*): + The OID / SHA of the parent commit, as a hexadecimal string. Shorthands (7 first characters) are also supported. + If specified and `create_pr` is `False`, the commit will fail if `revision` does not point to `parent_commit`. + If specified and `create_pr` is `True`, the pull request will be created from `parent_commit`. + Specifying `parent_commit` ensures the repo has not changed before committing the changes, and can be + especially useful if the repo is updated / committed to concurrently. + Returns: + `str`: URL of the commit which updated the card metadata. + + Example: + ```python + >>> from huggingface_hub import metadata_update + >>> metadata = {'model-index': [{'name': 'RoBERTa fine-tuned on ReactionGIF', + ... 'results': [{'dataset': {'name': 'ReactionGIF', + ... 'type': 'julien-c/reactiongif'}, + ... 'metrics': [{'name': 'Recall', + ... 'type': 'recall', + ... 'value': 0.7762102282047272}], + ... 'task': {'name': 'Text Classification', + ... 'type': 'text-classification'}}]}]} + >>> url = metadata_update("hf-internal-testing/reactiongif-roberta-card", metadata) + + ``` + """ + commit_message = ( + commit_message + if commit_message is not None + else "Update metadata with huggingface_hub" + ) + + # Card class given repo_type + card_class: Type[RepoCard] + if repo_type is None or repo_type == "model": + card_class = ModelCard + elif repo_type == "dataset": + card_class = DatasetCard + elif repo_type == "space": + card_class = RepoCard + else: + raise ValueError(f"Unknown repo_type: {repo_type}") + + # Either load repo_card from the Hub or create an empty one. + # NOTE: Will not create the repo if it doesn't exist. + try: + card = card_class.load(repo_id, token=token, repo_type=repo_type) + except EntryNotFoundError: + if repo_type == "space": + raise ValueError( + "Cannot update metadata on a Space that doesn't contain a `README.md`" + " file." + ) + + # Initialize a ModelCard or DatasetCard from default template and no data. + card = card_class.from_template(CardData()) + + for key, value in metadata.items(): + if key == "model-index": + # if the new metadata doesn't include a name, either use existing one or repo name + if "name" not in value[0]: + value[0]["name"] = getattr(card, "model_name", repo_id) + model_name, new_results = model_index_to_eval_results(value) + if card.data.eval_results is None: + card.data.eval_results = new_results + card.data.model_name = model_name + else: + existing_results = card.data.eval_results + + # Iterate over new results + # Iterate over existing results + # If both results describe the same metric but value is different: + # If overwrite=True: overwrite the metric value + # Else: raise ValueError + # Else: append new result to existing ones. + for new_result in new_results: + result_found = False + for existing_result in existing_results: + if new_result.is_equal_except_value(existing_result): + if new_result != existing_result and not overwrite: + raise ValueError( + "You passed a new value for the existing metric" + f" 'name: {new_result.metric_name}, type: " + f"{new_result.metric_type}'. Set `overwrite=True`" + " to overwrite existing metrics." + ) + result_found = True + existing_result.metric_value = new_result.metric_value + if not result_found: + card.data.eval_results.append(new_result) + else: + # Any metadata that is not a result metric + if ( + hasattr(card.data, key) + and getattr(card.data, key) is not None + and not overwrite + and getattr(card.data, key) != value + ): + raise ValueError( + f"You passed a new value for the existing meta data field '{key}'." + " Set `overwrite=True` to overwrite existing metadata." + ) + else: + setattr(card.data, key, value) + + return card.push_to_hub( + repo_id, + token=token, + repo_type=repo_type, + commit_message=commit_message, + commit_description=commit_description, + create_pr=create_pr, + revision=revision, + parent_commit=parent_commit, + ) diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/repocard_data.py b/.local/lib/python3.10/site-packages/huggingface_hub/repocard_data.py new file mode 100644 index 0000000000000000000000000000000000000000..843d609278e495764d1c86e5cf36d008516cfe07 --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/repocard_data.py @@ -0,0 +1,559 @@ +import copy +from collections import defaultdict +from dataclasses import dataclass +from typing import Any, Dict, List, Optional, Tuple, Union + +from huggingface_hub.utils import yaml_dump + +from .utils.logging import get_logger + + +logger = get_logger(__name__) + + +@dataclass +class EvalResult: + """ + Flattened representation of individual evaluation results found in model-index of Model Cards. + + For more information on the model-index spec, see https://github.com/huggingface/hub-docs/blob/main/modelcard.md?plain=1. + + Args: + task_type (`str`): + The task identifier. Example: "image-classification". + dataset_type (`str`): + The dataset identifier. Example: "common_voice". Use dataset id from https://hf.co/datasets. + dataset_name (`str`): + A pretty name for the dataset. Example: "Common Voice (French)". + metric_type (`str`): + The metric identifier. Example: "wer". Use metric id from https://hf.co/metrics. + metric_value (`Any`): + The metric value. Example: 0.9 or "20.0 ± 1.2". + task_name (`str`, *optional*): + A pretty name for the task. Example: "Speech Recognition". + dataset_config (`str`, *optional*): + The name of the dataset configuration used in `load_dataset()`. + Example: fr in `load_dataset("common_voice", "fr")`. See the `datasets` docs for more info: + https://hf.co/docs/datasets/package_reference/loading_methods#datasets.load_dataset.name + dataset_split (`str`, *optional*): + The split used in `load_dataset()`. Example: "test". + dataset_revision (`str`, *optional*): + The revision (AKA Git Sha) of the dataset used in `load_dataset()`. + Example: 5503434ddd753f426f4b38109466949a1217c2bb + dataset_args (`Dict[str, Any]`, *optional*): + The arguments passed during `Metric.compute()`. Example for `bleu`: `{"max_order": 4}` + metric_name (`str`, *optional*): + A pretty name for the metric. Example: "Test WER". + metric_config (`str`, *optional*): + The name of the metric configuration used in `load_metric()`. + Example: bleurt-large-512 in `load_metric("bleurt", "bleurt-large-512")`. + See the `datasets` docs for more info: https://huggingface.co/docs/datasets/v2.1.0/en/loading#load-configurations + metric_args (`Dict[str, Any]`, *optional*): + The arguments passed during `Metric.compute()`. Example for `bleu`: max_order: 4 + verified (`bool`, *optional*): + Indicates whether the metrics originate from Hugging Face's [evaluation service](https://huggingface.co/spaces/autoevaluate/model-evaluator) or not. Automatically computed by Hugging Face, do not set. + verify_token (`str`, *optional*): + A JSON Web Token that is used to verify whether the metrics originate from Hugging Face's [evaluation service](https://huggingface.co/spaces/autoevaluate/model-evaluator) or not. + """ + + # Required + + # The task identifier + # Example: automatic-speech-recognition + task_type: str + + # The dataset identifier + # Example: common_voice. Use dataset id from https://hf.co/datasets + dataset_type: str + + # A pretty name for the dataset. + # Example: Common Voice (French) + dataset_name: str + + # The metric identifier + # Example: wer. Use metric id from https://hf.co/metrics + metric_type: str + + # Value of the metric. + # Example: 20.0 or "20.0 ± 1.2" + metric_value: Any + + # Optional + + # A pretty name for the task. + # Example: Speech Recognition + task_name: Optional[str] = None + + # The name of the dataset configuration used in `load_dataset()`. + # Example: fr in `load_dataset("common_voice", "fr")`. + # See the `datasets` docs for more info: + # https://huggingface.co/docs/datasets/package_reference/loading_methods#datasets.load_dataset.name + dataset_config: Optional[str] = None + + # The split used in `load_dataset()`. + # Example: test + dataset_split: Optional[str] = None + + # The revision (AKA Git Sha) of the dataset used in `load_dataset()`. + # Example: 5503434ddd753f426f4b38109466949a1217c2bb + dataset_revision: Optional[str] = None + + # The arguments passed during `Metric.compute()`. + # Example for `bleu`: max_order: 4 + dataset_args: Optional[Dict[str, Any]] = None + + # A pretty name for the metric. + # Example: Test WER + metric_name: Optional[str] = None + + # The name of the metric configuration used in `load_metric()`. + # Example: bleurt-large-512 in `load_metric("bleurt", "bleurt-large-512")`. + # See the `datasets` docs for more info: https://huggingface.co/docs/datasets/v2.1.0/en/loading#load-configurations + metric_config: Optional[str] = None + + # The arguments passed during `Metric.compute()`. + # Example for `bleu`: max_order: 4 + metric_args: Optional[Dict[str, Any]] = None + + # Indicates whether the metrics originate from Hugging Face's [evaluation service](https://huggingface.co/spaces/autoevaluate/model-evaluator) or not. Automatically computed by Hugging Face, do not set. + verified: Optional[bool] = None + + # A JSON Web Token that is used to verify whether the metrics originate from Hugging Face's [evaluation service](https://huggingface.co/spaces/autoevaluate/model-evaluator) or not. + verify_token: Optional[str] = None + + def is_equal_except_value(self, other: "EvalResult") -> bool: + """ + Return True if `self` and `other` describe exactly the same metric but with a + different value. + """ + for key, _ in self.__dict__.items(): + if key == "metric_value": + continue + if getattr(self, key) != getattr(other, key): + return False + return True + + +@dataclass +class CardData: + def __init__(self, **kwargs): + self.__dict__.update(kwargs) + + def to_dict(self) -> Dict[str, Any]: + """Converts CardData to a dict. + + Returns: + `dict`: CardData represented as a dictionary ready to be dumped to a YAML + block for inclusion in a README.md file. + """ + + data_dict = copy.deepcopy(self.__dict__) + self._to_dict(data_dict) + return _remove_none(data_dict) + + def _to_dict(self, data_dict): + """Use this method in child classes to alter the dict representation of the data. Alter the dict in-place. + + Args: + data_dict (`dict`): The raw dict representation of the card data. + """ + pass + + def to_yaml(self, line_break=None) -> str: + """Dumps CardData to a YAML block for inclusion in a README.md file. + + Args: + line_break (str, *optional*): + The line break to use when dumping to yaml. + + Returns: + `str`: CardData represented as a YAML block. + """ + return yaml_dump(self.to_dict(), sort_keys=False, line_break=line_break).strip() + + def __repr__(self): + return self.to_yaml() + + +class ModelCardData(CardData): + """Model Card Metadata that is used by Hugging Face Hub when included at the top of your README.md + + Args: + language (`Union[str, List[str]]`, *optional*): + Language of model's training data or metadata. It must be an ISO 639-1, 639-2 or + 639-3 code (two/three letters), or a special value like "code", "multilingual". Defaults to `None`. + license (`str`, *optional*): + License of this model. Example: apache-2.0 or any license from + https://huggingface.co/docs/hub/repositories-licenses. Defaults to None. + library_name (`str`, *optional*): + Name of library used by this model. Example: keras or any library from + https://github.com/huggingface/hub-docs/blob/main/js/src/lib/interfaces/Libraries.ts. + Defaults to None. + tags (`List[str]`, *optional*): + List of tags to add to your model that can be used when filtering on the Hugging + Face Hub. Defaults to None. + datasets (`Union[str, List[str]]`, *optional*): + Dataset or list of datasets that were used to train this model. Should be a dataset ID + found on https://hf.co/datasets. Defaults to None. + metrics (`Union[str, List[str]]`, *optional*): + List of metrics used to evaluate this model. Should be a metric name that can be found + at https://hf.co/metrics. Example: 'accuracy'. Defaults to None. + eval_results (`Union[List[EvalResult], EvalResult]`, *optional*): + List of `huggingface_hub.EvalResult` that define evaluation results of the model. If provided, + `model_name` is used to as a name on PapersWithCode's leaderboards. Defaults to `None`. + model_name (`str`, *optional*): + A name for this model. It is used along with + `eval_results` to construct the `model-index` within the card's metadata. The name + you supply here is what will be used on PapersWithCode's leaderboards. If None is provided + then the repo name is used as a default. Defaults to None. + kwargs (`dict`, *optional*): + Additional metadata that will be added to the model card. Defaults to None. + + Example: + ```python + >>> from huggingface_hub import ModelCardData + >>> card_data = ModelCardData( + ... language="en", + ... license="mit", + ... library_name="timm", + ... tags=['image-classification', 'resnet'], + ... ) + >>> card_data.to_dict() + {'language': 'en', 'license': 'mit', 'library_name': 'timm', 'tags': ['image-classification', 'resnet']} + + ``` + """ + + def __init__( + self, + *, + language: Optional[Union[str, List[str]]] = None, + license: Optional[str] = None, + library_name: Optional[str] = None, + tags: Optional[List[str]] = None, + datasets: Optional[Union[str, List[str]]] = None, + metrics: Optional[Union[str, List[str]]] = None, + eval_results: Optional[List[EvalResult]] = None, + model_name: Optional[str] = None, + **kwargs, + ): + self.language = language + self.license = license + self.library_name = library_name + self.tags = tags + self.datasets = datasets + self.metrics = metrics + self.eval_results = eval_results + self.model_name = model_name + + model_index = kwargs.pop("model-index", None) + if model_index: + try: + model_name, eval_results = model_index_to_eval_results(model_index) + self.model_name = model_name + self.eval_results = eval_results + except KeyError: + logger.warning( + "Invalid model-index. Not loading eval results into CardData." + ) + + super().__init__(**kwargs) + + if self.eval_results: + if type(self.eval_results) == EvalResult: + self.eval_results = [self.eval_results] + if self.model_name is None: + raise ValueError( + "Passing `eval_results` requires `model_name` to be set." + ) + + def _to_dict(self, data_dict): + """Format the internal data dict. In this case, we convert eval results to a valid model index""" + if self.eval_results is not None: + data_dict["model-index"] = eval_results_to_model_index( + self.model_name, self.eval_results + ) + del data_dict["eval_results"], data_dict["model_name"] + + +class DatasetCardData(CardData): + """Dataset Card Metadata that is used by Hugging Face Hub when included at the top of your README.md + + Args: + language (`Union[str, List[str]]`, *optional*): + Language of dataset's data or metadata. It must be an ISO 639-1, 639-2 or + 639-3 code (two/three letters), or a special value like "code", "multilingual". + license (`Union[str, List[str]]`, *optional*): + License(s) of this dataset. Example: apache-2.0 or any license from + https://huggingface.co/docs/hub/repositories-licenses. + annotations_creators (`Union[str, List[str]]`, *optional*): + How the annotations for the dataset were created. + Options are: 'found', 'crowdsourced', 'expert-generated', 'machine-generated', 'no-annotation', 'other'. + language_creators (`Union[str, List[str]]`, *optional*): + How the text-based data in the dataset was created. + Options are: 'found', 'crowdsourced', 'expert-generated', 'machine-generated', 'other' + multilinguality (`Union[str, List[str]]`, *optional*): + Whether the dataset is multilingual. + Options are: 'monolingual', 'multilingual', 'translation', 'other'. + size_categories (`Union[str, List[str]]`, *optional*): + The number of examples in the dataset. Options are: 'n<1K', '1K1T', and 'other'. + source_datasets (`Union[str, List[str]]`, *optional*): + Indicates whether the dataset is an original dataset or extended from another existing dataset. + Options are: 'original' and 'extended'. + task_categories (`Union[str, List[str]]`, *optional*): + What categories of task does the dataset support? + task_ids (`Union[str, List[str]]`, *optional*): + What specific tasks does the dataset support? + paperswithcode_id (`str`, *optional*): + ID of the dataset on PapersWithCode. + pretty_name (`str`, *optional*): + A more human-readable name for the dataset. (ex. "Cats vs. Dogs") + train_eval_index (`Dict`, *optional*): + A dictionary that describes the necessary spec for doing evaluation on the Hub. + If not provided, it will be gathered from the 'train-eval-index' key of the kwargs. + configs (`Union[str, List[str]]`, *optional*): + A list of the available dataset configs for the dataset. + """ + + def __init__( + self, + *, + language: Optional[Union[str, List[str]]] = None, + license: Optional[Union[str, List[str]]] = None, + annotations_creators: Optional[Union[str, List[str]]] = None, + language_creators: Optional[Union[str, List[str]]] = None, + multilinguality: Optional[Union[str, List[str]]] = None, + size_categories: Optional[Union[str, List[str]]] = None, + source_datasets: Optional[Union[str, List[str]]] = None, + task_categories: Optional[Union[str, List[str]]] = None, + task_ids: Optional[Union[str, List[str]]] = None, + paperswithcode_id: Optional[str] = None, + pretty_name: Optional[str] = None, + train_eval_index: Optional[Dict] = None, + configs: Optional[Union[str, List[str]]] = None, + **kwargs, + ): + self.annotations_creators = annotations_creators + self.language_creators = language_creators + self.language = language + self.license = license + self.multilinguality = multilinguality + self.size_categories = size_categories + self.source_datasets = source_datasets + self.task_categories = task_categories + self.task_ids = task_ids + self.paperswithcode_id = paperswithcode_id + self.pretty_name = pretty_name + self.configs = configs + + # TODO - maybe handle this similarly to EvalResult? + self.train_eval_index = train_eval_index or kwargs.pop("train-eval-index", None) + super().__init__(**kwargs) + + def _to_dict(self, data_dict): + data_dict["train-eval-index"] = data_dict.pop("train_eval_index") + + +def model_index_to_eval_results( + model_index: List[Dict[str, Any]] +) -> Tuple[str, List[EvalResult]]: + """Takes in a model index and returns the model name and a list of `huggingface_hub.EvalResult` objects. + + A detailed spec of the model index can be found here: + https://github.com/huggingface/hub-docs/blob/main/modelcard.md?plain=1 + + Args: + model_index (`List[Dict[str, Any]]`): + A model index data structure, likely coming from a README.md file on the + Hugging Face Hub. + + Returns: + model_name (`str`): + The name of the model as found in the model index. This is used as the + identifier for the model on leaderboards like PapersWithCode. + eval_results (`List[EvalResult]`): + A list of `huggingface_hub.EvalResult` objects containing the metrics + reported in the provided model_index. + + Example: + ```python + >>> from huggingface_hub.repocard_data import model_index_to_eval_results + >>> # Define a minimal model index + >>> model_index = [ + ... { + ... "name": "my-cool-model", + ... "results": [ + ... { + ... "task": { + ... "type": "image-classification" + ... }, + ... "dataset": { + ... "type": "beans", + ... "name": "Beans" + ... }, + ... "metrics": [ + ... { + ... "type": "accuracy", + ... "value": 0.9 + ... } + ... ] + ... } + ... ] + ... } + ... ] + >>> model_name, eval_results = model_index_to_eval_results(model_index) + >>> model_name + 'my-cool-model' + >>> eval_results[0].task_type + 'image-classification' + >>> eval_results[0].metric_type + 'accuracy' + + ``` + """ + + eval_results = [] + for elem in model_index: + name = elem["name"] + results = elem["results"] + for result in results: + task_type = result["task"]["type"] + task_name = result["task"].get("name") + dataset_type = result["dataset"]["type"] + dataset_name = result["dataset"]["name"] + dataset_config = result["dataset"].get("config") + dataset_split = result["dataset"].get("split") + dataset_revision = result["dataset"].get("revision") + dataset_args = result["dataset"].get("args") + + for metric in result["metrics"]: + metric_type = metric["type"] + metric_value = metric["value"] + metric_name = metric.get("name") + metric_args = metric.get("args") + metric_config = metric.get("config") + verified = metric.get("verified") + verify_token = metric.get("verifyToken") + + eval_result = EvalResult( + task_type=task_type, # Required + dataset_type=dataset_type, # Required + dataset_name=dataset_name, # Required + metric_type=metric_type, # Required + metric_value=metric_value, # Required + task_name=task_name, + dataset_config=dataset_config, + dataset_split=dataset_split, + dataset_revision=dataset_revision, + dataset_args=dataset_args, + metric_name=metric_name, + metric_args=metric_args, + metric_config=metric_config, + verified=verified, + verify_token=verify_token, + ) + eval_results.append(eval_result) + return name, eval_results + + +def _remove_none(obj): + """ + Recursively remove `None` values from a dict. Borrowed from: https://stackoverflow.com/a/20558778 + """ + if isinstance(obj, (list, tuple, set)): + return type(obj)(_remove_none(x) for x in obj if x is not None) + elif isinstance(obj, dict): + return type(obj)( + (_remove_none(k), _remove_none(v)) + for k, v in obj.items() + if k is not None and v is not None + ) + else: + return obj + + +def eval_results_to_model_index( + model_name: str, eval_results: List[EvalResult] +) -> List[Dict[str, Any]]: + """Takes in given model name and list of `huggingface_hub.EvalResult` and returns a + valid model-index that will be compatible with the format expected by the + Hugging Face Hub. + + Args: + model_name (`str`): + Name of the model (ex. "my-cool-model"). This is used as the identifier + for the model on leaderboards like PapersWithCode. + eval_results (`List[EvalResult]`): + List of `huggingface_hub.EvalResult` objects containing the metrics to be + reported in the model-index. + + Returns: + model_index (`List[Dict[str, Any]]`): The eval_results converted to a model-index. + + Example: + ```python + >>> from huggingface_hub.repocard_data import eval_results_to_model_index, EvalResult + >>> # Define minimal eval_results + >>> eval_results = [ + ... EvalResult( + ... task_type="image-classification", # Required + ... dataset_type="beans", # Required + ... dataset_name="Beans", # Required + ... metric_type="accuracy", # Required + ... metric_value=0.9, # Required + ... ) + ... ] + >>> eval_results_to_model_index("my-cool-model", eval_results) + [{'name': 'my-cool-model', 'results': [{'task': {'type': 'image-classification'}, 'dataset': {'name': 'Beans', 'type': 'beans'}, 'metrics': [{'type': 'accuracy', 'value': 0.9}]}]}] + + ``` + """ + + # Metrics are reported on a unique task-and-dataset basis. + # Here, we make a map of those pairs and the associated EvalResults. + task_and_ds_types_map = defaultdict(list) + for eval_result in eval_results: + task_and_ds_pair = (eval_result.task_type, eval_result.dataset_type) + task_and_ds_types_map[task_and_ds_pair].append(eval_result) + + # Use the map from above to generate the model index data. + model_index_data = [] + for (task_type, dataset_type), results in task_and_ds_types_map.items(): + data = { + "task": { + "type": task_type, + "name": results[0].task_name, + }, + "dataset": { + "name": results[0].dataset_name, + "type": dataset_type, + "config": results[0].dataset_config, + "split": results[0].dataset_split, + "revision": results[0].dataset_revision, + "args": results[0].dataset_args, + }, + "metrics": [ + { + "type": result.metric_type, + "value": result.metric_value, + "name": result.metric_name, + "config": result.metric_config, + "args": result.metric_args, + "verified": result.verified, + "verifyToken": result.verify_token, + } + for result in results + ], + } + model_index_data.append(data) + + # TODO - Check if there cases where this list is longer than one? + # Finally, the model index itself is list of dicts. + model_index = [ + { + "name": model_name, + "results": model_index_data, + } + ] + return _remove_none(model_index) diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/repository.py b/.local/lib/python3.10/site-packages/huggingface_hub/repository.py new file mode 100644 index 0000000000000000000000000000000000000000..a9148ccb642a6d7038a45646244798d7901ad8de --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/repository.py @@ -0,0 +1,1596 @@ +import atexit +import os +import re +import subprocess +import tempfile +import threading +import time +import warnings +from contextlib import contextmanager +from pathlib import Path +from typing import Callable, Dict, Iterator, List, Optional, Tuple, Union +from urllib.parse import urlparse + +from huggingface_hub.constants import REPO_TYPES_URL_PREFIXES, REPOCARD_NAME +from huggingface_hub.repocard import metadata_load, metadata_save + +from .hf_api import HfApi, repo_type_and_id_from_hf_id +from .lfs import LFS_MULTIPART_UPLOAD_COMMAND +from .utils import ( + HfFolder, + RepositoryNotFoundError, + logging, + run_subprocess, + tqdm, + validate_hf_hub_args, +) +from .utils._deprecation import _deprecate_arguments, _deprecate_method +from .utils._typing import TypedDict + + +logger = logging.get_logger(__name__) + + +class CommandInProgress: + """ + Utility to follow commands launched asynchronously. + """ + + def __init__( + self, + title: str, + is_done_method: Callable, + status_method: Callable, + process: subprocess.Popen, + post_method: Optional[Callable] = None, + ): + self.title = title + self._is_done = is_done_method + self._status = status_method + self._process = process + self._stderr = "" + self._stdout = "" + self._post_method = post_method + + @property + def is_done(self) -> bool: + """ + Whether the process is done. + """ + result = self._is_done() + + if result and self._post_method is not None: + self._post_method() + self._post_method = None + + return result + + @property + def status(self) -> int: + """ + The exit code/status of the current action. Will return `0` if the + command has completed successfully, and a number between 1 and 255 if + the process errored-out. + + Will return -1 if the command is still ongoing. + """ + return self._status() + + @property + def failed(self) -> bool: + """ + Whether the process errored-out. + """ + return self.status > 0 + + @property + def stderr(self) -> str: + """ + The current output message on the standard error. + """ + if self._process.stderr is not None: + self._stderr += self._process.stderr.read() + return self._stderr + + @property + def stdout(self) -> str: + """ + The current output message on the standard output. + """ + if self._process.stdout is not None: + self._stdout += self._process.stdout.read() + return self._stdout + + def __repr__(self): + status = self.status + + if status == -1: + status = "running" + + return ( + f"[{self.title} command, status code: {status}," + f" {'in progress.' if not self.is_done else 'finished.'} PID:" + f" {self._process.pid}]" + ) + + +def is_git_repo(folder: Union[str, Path]) -> bool: + """ + Check if the folder is the root or part of a git repository + + Args: + folder (`str`): + The folder in which to run the command. + + Returns: + `bool`: `True` if the repository is part of a repository, `False` + otherwise. + """ + folder_exists = os.path.exists(os.path.join(folder, ".git")) + git_branch = subprocess.run( + "git branch".split(), cwd=folder, stdout=subprocess.PIPE, stderr=subprocess.PIPE + ) + return folder_exists and git_branch.returncode == 0 + + +def is_local_clone(folder: Union[str, Path], remote_url: str) -> bool: + """ + Check if the folder is a local clone of the remote_url + + Args: + folder (`str` or `Path`): + The folder in which to run the command. + remote_url (`str`): + The url of a git repository. + + Returns: + `bool`: `True` if the repository is a local clone of the remote + repository specified, `False` otherwise. + """ + if not is_git_repo(folder): + return False + + remotes = run_subprocess("git remote -v", folder).stdout + + # Remove token for the test with remotes. + remote_url = re.sub(r"https://.*@", "https://", remote_url) + remotes = [re.sub(r"https://.*@", "https://", remote) for remote in remotes.split()] + return remote_url in remotes + + +def is_tracked_with_lfs(filename: Union[str, Path]) -> bool: + """ + Check if the file passed is tracked with git-lfs. + + Args: + filename (`str` or `Path`): + The filename to check. + + Returns: + `bool`: `True` if the file passed is tracked with git-lfs, `False` + otherwise. + """ + folder = Path(filename).parent + filename = Path(filename).name + + try: + p = run_subprocess("git check-attr -a".split() + [filename], folder) + attributes = p.stdout.strip() + except subprocess.CalledProcessError as exc: + if not is_git_repo(folder): + return False + else: + raise OSError(exc.stderr) + + if len(attributes) == 0: + return False + + found_lfs_tag = {"diff": False, "merge": False, "filter": False} + + for attribute in attributes.split("\n"): + for tag in found_lfs_tag.keys(): + if tag in attribute and "lfs" in attribute: + found_lfs_tag[tag] = True + + return all(found_lfs_tag.values()) + + +def is_git_ignored(filename: Union[str, Path]) -> bool: + """ + Check if file is git-ignored. Supports nested .gitignore files. + + Args: + filename (`str` or `Path`): + The filename to check. + + Returns: + `bool`: `True` if the file passed is ignored by `git`, `False` + otherwise. + """ + folder = Path(filename).parent + filename = Path(filename).name + + try: + p = run_subprocess("git check-ignore".split() + [filename], folder, check=False) + # Will return exit code 1 if not gitignored + is_ignored = not bool(p.returncode) + except subprocess.CalledProcessError as exc: + raise OSError(exc.stderr) + + return is_ignored + + +def is_binary_file(filename: Union[str, Path]) -> bool: + """ + Check if file is a binary file. + + Args: + filename (`str` or `Path`): + The filename to check. + + Returns: + `bool`: `True` if the file passed is a binary file, `False` otherwise. + """ + try: + with open(filename, "rb") as f: + content = f.read(10 * (1024**2)) # Read a maximum of 10MB + + # Code sample taken from the following stack overflow thread + # https://stackoverflow.com/questions/898669/how-can-i-detect-if-a-file-is-binary-non-text-in-python/7392391#7392391 + text_chars = bytearray( + {7, 8, 9, 10, 12, 13, 27} | set(range(0x20, 0x100)) - {0x7F} + ) + return bool(content.translate(None, text_chars)) + except UnicodeDecodeError: + return True + + +def files_to_be_staged( + pattern: str = ".", folder: Union[str, Path, None] = None +) -> List[str]: + """ + Returns a list of filenames that are to be staged. + + Args: + pattern (`str` or `Path`): + The pattern of filenames to check. Put `.` to get all files. + folder (`str` or `Path`): + The folder in which to run the command. + + Returns: + `List[str]`: List of files that are to be staged. + """ + try: + p = run_subprocess("git ls-files -mo".split() + [pattern], folder) + if len(p.stdout.strip()): + files = p.stdout.strip().split("\n") + else: + files = [] + except subprocess.CalledProcessError as exc: + raise EnvironmentError(exc.stderr) + + return files + + +def is_tracked_upstream(folder: Union[str, Path]) -> bool: + """ + Check if the current checked-out branch is tracked upstream. + + Args: + folder (`str` or `Path`): + The folder in which to run the command. + + Returns: + `bool`: `True` if the current checked-out branch is tracked upstream, + `False` otherwise. + """ + try: + run_subprocess("git rev-parse --symbolic-full-name --abbrev-ref @{u}", folder) + return True + except subprocess.CalledProcessError as exc: + if "HEAD" in exc.stderr: + raise OSError("No branch checked out") + + return False + + +def commits_to_push(folder: Union[str, Path], upstream: Optional[str] = None) -> int: + """ + Check the number of commits that would be pushed upstream + + Args: + folder (`str` or `Path`): + The folder in which to run the command. + upstream (`str`, *optional*): + The name of the upstream repository with which the comparison should be + made. + + Returns: + `int`: Number of commits that would be pushed upstream were a `git + push` to proceed. + """ + try: + result = run_subprocess(f"git cherry -v {upstream or ''}", folder) + return len(result.stdout.split("\n")) - 1 + except subprocess.CalledProcessError as exc: + raise EnvironmentError(exc.stderr) + + +class PbarT(TypedDict): + # Used to store an opened progress bar in `_lfs_log_progress` + bar: tqdm + past_bytes: int + + +@contextmanager +def _lfs_log_progress(): + """ + This is a context manager that will log the Git LFS progress of cleaning, + smudging, pulling and pushing. + """ + + if logger.getEffectiveLevel() >= logging.ERROR: + try: + yield + except Exception: + pass + return + + def output_progress(stopping_event: threading.Event): + """ + To be launched as a separate thread with an event meaning it should stop + the tail. + """ + # Key is tuple(state, filename), value is a dict(tqdm bar and a previous value) + pbars: Dict[Tuple[str, str], PbarT] = {} + + def close_pbars(): + for pbar in pbars.values(): + pbar["bar"].update(pbar["bar"].total - pbar["past_bytes"]) + pbar["bar"].refresh() + pbar["bar"].close() + + def tail_file(filename) -> Iterator[str]: + """ + Creates a generator to be iterated through, which will return each + line one by one. Will stop tailing the file if the stopping_event is + set. + """ + with open(filename, "r") as file: + current_line = "" + while True: + if stopping_event.is_set(): + close_pbars() + break + + line_bit = file.readline() + if line_bit is not None and not len(line_bit.strip()) == 0: + current_line += line_bit + if current_line.endswith("\n"): + yield current_line + current_line = "" + else: + time.sleep(1) + + # If the file isn't created yet, wait for a few seconds before trying again. + # Can be interrupted with the stopping_event. + while not os.path.exists(os.environ["GIT_LFS_PROGRESS"]): + if stopping_event.is_set(): + close_pbars() + return + + time.sleep(2) + + for line in tail_file(os.environ["GIT_LFS_PROGRESS"]): + state, file_progress, byte_progress, filename = line.split() + description = f"{state.capitalize()} file {filename}" + + current_bytes, total_bytes = byte_progress.split("/") + current_bytes_int = int(current_bytes) + total_bytes_int = int(total_bytes) + + pbar = pbars.get((state, filename)) + if pbar is None: + # Initialize progress bar + pbars[(state, filename)] = { + "bar": tqdm( + desc=description, + initial=current_bytes_int, + total=total_bytes_int, + unit="B", + unit_scale=True, + unit_divisor=1024, + ), + "past_bytes": int(current_bytes), + } + else: + # Update progress bar + pbar["bar"].update(current_bytes_int - pbar["past_bytes"]) + pbar["past_bytes"] = current_bytes_int + + current_lfs_progress_value = os.environ.get("GIT_LFS_PROGRESS", "") + + with tempfile.TemporaryDirectory() as tmpdir: + os.environ["GIT_LFS_PROGRESS"] = os.path.join(tmpdir, "lfs_progress") + logger.debug(f"Following progress in {os.environ['GIT_LFS_PROGRESS']}") + + exit_event = threading.Event() + x = threading.Thread(target=output_progress, args=(exit_event,), daemon=True) + x.start() + + try: + yield + finally: + exit_event.set() + x.join() + + os.environ["GIT_LFS_PROGRESS"] = current_lfs_progress_value + + +class Repository: + """ + Helper class to wrap the git and git-lfs commands. + + The aim is to facilitate interacting with huggingface.co hosted model or + dataset repos, though not a lot here (if any) is actually specific to + huggingface.co. + """ + + command_queue: List[CommandInProgress] + + @_deprecate_arguments( + version="0.12", + deprecated_args=[ + # Private arg is only used to create the repo if it doesn't exist which is a + # deprecated behavior. + "private" + ], + ) + @validate_hf_hub_args + def __init__( + self, + local_dir: str, + clone_from: Optional[str] = None, + repo_type: Optional[str] = None, + token: Union[bool, str] = True, + git_user: Optional[str] = None, + git_email: Optional[str] = None, + revision: Optional[str] = None, + private: bool = False, + skip_lfs_files: bool = False, + client: Optional[HfApi] = None, + ): + """ + Instantiate a local clone of a git repo. + + + If specifying a `clone_from`, it will clone an existing remote + repository, for instance one that was previously created using + `HfApi().create_repo(repo_id=repo_name)`. + + `Repository` uses the local git credentials by default, but if required, + the `huggingface_token` as well as the git `user` and the `email` can be + explicitly specified. + + Args: + local_dir (`str`): + path (e.g. `'my_trained_model/'`) to the local directory, where + the `Repository` will be initalized. + clone_from (`str`, *optional*): + Either a repository url or `repo_id`. + Example: + - `"https://huggingface.co/philschmid/playground-tests"` + - `"philschmid/playground-tests"` + repo_type (`str`, *optional*): + To set when cloning a repo from a repo_id. Default is model. + token (`bool` or `str`, *optional*): + A valid authentication token (see https://huggingface.co/settings/token). + If `None` or `True` and machine is logged in (through `huggingface-cli login` + or [`~huggingface_hub.login`]), token will be retrieved from the cache. + If `False`, token is not sent in the request header. + git_user (`str`, *optional*): + will override the `git config user.name` for committing and + pushing files to the hub. + git_email (`str`, *optional*): + will override the `git config user.email` for committing and + pushing files to the hub. + revision (`str`, *optional*): + Revision to checkout after initializing the repository. If the + revision doesn't exist, a branch will be created with that + revision name from the default branch's current HEAD. + skip_lfs_files (`bool`, *optional*, defaults to `False`): + whether to skip git-LFS files or not. + client (`HfApi`, *optional*): + Instance of HfApi to use when calling the HF Hub API. A new + instance will be created if this is left to `None`. + """ + + os.makedirs(local_dir, exist_ok=True) + self.local_dir = os.path.join(os.getcwd(), local_dir) + self._repo_type = repo_type + self.command_queue = [] + self._private = private + self.skip_lfs_files = skip_lfs_files + self.client = client if client is not None else HfApi() + + self.check_git_versions() + + if isinstance(token, str): + self.huggingface_token: Optional[str] = token + elif token is False: + self.huggingface_token = None + else: + # if `True` -> explicit use of the cached token + # if `None` -> implicit use of the cached token + self.huggingface_token = HfFolder.get_token() + + if clone_from is not None: + self.clone_from(repo_url=clone_from) + else: + if is_git_repo(self.local_dir): + logger.debug("[Repository] is a valid git repo") + else: + raise ValueError( + "If not specifying `clone_from`, you need to pass Repository a" + " valid git clone." + ) + + if self.huggingface_token is not None and ( + git_email is None or git_user is None + ): + user = self.client.whoami(self.huggingface_token) + + if git_email is None: + git_email = user["email"] + + if git_user is None: + git_user = user["fullname"] + + if git_user is not None or git_email is not None: + self.git_config_username_and_email(git_user, git_email) + + self.lfs_enable_largefiles() + self.git_credential_helper_store() + + if revision is not None: + self.git_checkout(revision, create_branch_ok=True) + + # This ensures that all commands exit before exiting the Python runtime. + # This will ensure all pushes register on the hub, even if other errors happen in subsequent operations. + atexit.register(self.wait_for_commands) + + @property + def current_branch(self) -> str: + """ + Returns the current checked out branch. + + Returns: + `str`: Current checked out branch. + """ + try: + result = run_subprocess( + "git rev-parse --abbrev-ref HEAD", self.local_dir + ).stdout.strip() + except subprocess.CalledProcessError as exc: + raise EnvironmentError(exc.stderr) + + return result + + @property + @_deprecate_method( + version="0.12", + message="`repo_type` is only used in a deprecated use case of `clone_from`.", + ) + def repo_type(self) -> Optional[str]: + """Make `repo_type` a private attribute to warn users this is not a value to + access from `Repository` object (error-prone). Property to be removed when + `repo_type` will be definitely removed (v0.12). + """ + return self._repo_type + + @property + @_deprecate_method( + version="0.12", + message="`private` is only used in a deprecated use case of `clone_from`.", + ) + def private(self) -> bool: + """Make `private` a private attribute to warn users this is not a value to + access from `Repository` object (error-prone). Property to be removed when + `private` will be definitely removed (v0.12). + """ + return self._private + + def check_git_versions(self): + """ + Checks that `git` and `git-lfs` can be run. + + Raises: + `EnvironmentError`: if `git` or `git-lfs` are not installed. + """ + try: + git_version = run_subprocess("git --version", self.local_dir).stdout.strip() + except FileNotFoundError: + raise EnvironmentError( + "Looks like you do not have git installed, please install." + ) + + try: + lfs_version = run_subprocess( + "git-lfs --version", self.local_dir + ).stdout.strip() + except FileNotFoundError: + raise EnvironmentError( + "Looks like you do not have git-lfs installed, please install." + " You can install from https://git-lfs.github.com/." + " Then run `git lfs install` (you only have to do this once)." + ) + logger.info(git_version + "\n" + lfs_version) + + @validate_hf_hub_args + def clone_from(self, repo_url: str, token: Union[bool, str, None] = None): + """ + Clone from a remote. If the folder already exists, will try to clone the + repository within it. + + If this folder is a git repository with linked history, will try to + update the repository. + + Args: + repo_url (`str`): + The URL from which to clone the repository + token (`Union[str, bool]`, *optional*): + Whether to use the authentication token. It can be: + - a string which is the token itself + - `False`, which would not use the authentication token + - `True`, which would fetch the authentication token from the + local folder and use it (you should be logged in for this to + work). + - `None`, which would retrieve the value of + `self.huggingface_token`. + + + + Raises the following error: + + - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) + if the `token` cannot be identified and the `private` keyword is set to + `True`. The `token` must be passed in order to handle private repositories. + + - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) + if an organization token (starts with "api_org") is passed. Use must use + your own personal access token (see https://hf.co/settings/tokens). + + - [`EnvironmentError`](https://docs.python.org/3/library/exceptions.html#EnvironmentError) + if you are trying to clone the repository in a non-empty folder, or if the + `git` operations raise errors. + + + """ + token = ( + token # str -> use it + if isinstance(token, str) + else ( + None # `False` -> explicit no token + if token is False + else self.huggingface_token # `None` or `True` -> use default + ) + ) + if token is None and self._private: + raise ValueError( + "Couldn't load Hugging Face Authorization Token. Credentials are" + " required to work with private repositories. Please login in using" + " `huggingface-cli login` or provide your token manually with the" + " `token` key." + ) + elif token is not None and token.startswith("api_org"): + raise ValueError( + "You must use your personal access token, not an Organization token" + " (see https://hf.co/settings/tokens)." + ) + + hub_url = self.client.endpoint + if hub_url in repo_url or ( + "http" not in repo_url and len(repo_url.split("/")) <= 2 + ): + repo_type, namespace, repo_name = repo_type_and_id_from_hf_id( + repo_url, hub_url=hub_url + ) + repo_id = f"{namespace}/{repo_name}" if namespace is not None else repo_name + + if repo_type is not None: + self._repo_type = repo_type + + repo_url = hub_url + "/" + + if self._repo_type in REPO_TYPES_URL_PREFIXES: + repo_url += REPO_TYPES_URL_PREFIXES[self._repo_type] + + if token is not None: + # Add token in git url when provided + scheme = urlparse(repo_url).scheme + repo_url = repo_url.replace(f"{scheme}://", f"{scheme}://user:{token}@") + + repo_url += repo_id + + # To be removed: check if repo exists. If not, create it first. + try: + HfApi().repo_info(f"{repo_id}", repo_type=self._repo_type, token=token) + except RepositoryNotFoundError: + if self._repo_type == "space": + raise ValueError( + "Creating a Space through passing Space link to clone_from is" + " not allowed. Make sure the Space exists on Hugging Face Hub." + ) + else: + warnings.warn( + "Creating a repository through 'clone_from' is deprecated and" + " will be removed in v0.12. Please create the repository first" + " using `create_repo(..., exists_ok=True)`.", + FutureWarning, + ) + self.client.create_repo( + repo_id=repo_id, + token=token, + repo_type=self._repo_type, + exist_ok=True, + private=self._private, + ) + + # For error messages, it's cleaner to show the repo url without the token. + clean_repo_url = re.sub(r"(https?)://.*@", r"\1://", repo_url) + try: + run_subprocess("git lfs install", self.local_dir) + + # checks if repository is initialized in a empty repository or in one with files + if len(os.listdir(self.local_dir)) == 0: + logger.warning(f"Cloning {clean_repo_url} into local empty directory.") + + with _lfs_log_progress(): + env = os.environ.copy() + + if self.skip_lfs_files: + env.update({"GIT_LFS_SKIP_SMUDGE": "1"}) + + run_subprocess( + f"{'git clone' if self.skip_lfs_files else 'git lfs clone'} {repo_url} .", + self.local_dir, + env=env, + ) + else: + # Check if the folder is the root of a git repository + if not is_git_repo(self.local_dir): + raise EnvironmentError( + "Tried to clone a repository in a non-empty folder that isn't a" + " git repository. If you really want to do this, do it" + " manually:\ngit init && git remote add origin && git pull" + " origin main\n or clone repo to a new folder and move your" + " existing files there afterwards." + ) + + if is_local_clone(self.local_dir, repo_url): + logger.warning( + f"{self.local_dir} is already a clone of {clean_repo_url}." + " Make sure you pull the latest changes with" + " `repo.git_pull()`." + ) + else: + output = run_subprocess( + "git remote get-url origin", self.local_dir, check=False + ) + + error_msg = ( + f"Tried to clone {clean_repo_url} in an unrelated git" + " repository.\nIf you believe this is an error, please add" + f" a remote with the following URL: {clean_repo_url}." + ) + if output.returncode == 0: + clean_local_remote_url = re.sub( + r"https://.*@", "https://", output.stdout + ) + error_msg += ( + "\nLocal path has its origin defined as:" + f" {clean_local_remote_url}" + ) + raise EnvironmentError(error_msg) + + except subprocess.CalledProcessError as exc: + raise EnvironmentError(exc.stderr) + + def git_config_username_and_email( + self, git_user: Optional[str] = None, git_email: Optional[str] = None + ): + """ + Sets git username and email (only in the current repo). + + Args: + git_user (`str`, *optional*): + The username to register through `git`. + git_email (`str`, *optional*): + The email to register through `git`. + """ + try: + if git_user is not None: + run_subprocess( + "git config user.name".split() + [git_user], self.local_dir + ) + + if git_email is not None: + run_subprocess( + f"git config user.email {git_email}".split(), self.local_dir + ) + except subprocess.CalledProcessError as exc: + raise EnvironmentError(exc.stderr) + + def git_credential_helper_store(self): + """ + Sets the git credential helper to `store` + """ + try: + run_subprocess("git config credential.helper store", self.local_dir) + except subprocess.CalledProcessError as exc: + raise EnvironmentError(exc.stderr) + + def git_head_hash(self) -> str: + """ + Get commit sha on top of HEAD. + + Returns: + `str`: The current checked out commit SHA. + """ + try: + p = run_subprocess("git rev-parse HEAD", self.local_dir) + return p.stdout.strip() + except subprocess.CalledProcessError as exc: + raise EnvironmentError(exc.stderr) + + def git_remote_url(self) -> str: + """ + Get URL to origin remote. + + Returns: + `str`: The URL of the `origin` remote. + """ + try: + p = run_subprocess("git config --get remote.origin.url", self.local_dir) + url = p.stdout.strip() + # Strip basic auth info. + return re.sub(r"https://.*@", "https://", url) + except subprocess.CalledProcessError as exc: + raise EnvironmentError(exc.stderr) + + def git_head_commit_url(self) -> str: + """ + Get URL to last commit on HEAD. We assume it's been pushed, and the url + scheme is the same one as for GitHub or HuggingFace. + + Returns: + `str`: The URL to the current checked-out commit. + """ + sha = self.git_head_hash() + url = self.git_remote_url() + if url.endswith("/"): + url = url[:-1] + return f"{url}/commit/{sha}" + + def list_deleted_files(self) -> List[str]: + """ + Returns a list of the files that are deleted in the working directory or + index. + + Returns: + `List[str]`: A list of files that have been deleted in the working + directory or index. + """ + try: + git_status = run_subprocess("git status -s", self.local_dir).stdout.strip() + except subprocess.CalledProcessError as exc: + raise EnvironmentError(exc.stderr) + + if len(git_status) == 0: + return [] + + # Receives a status like the following + # D .gitignore + # D new_file.json + # AD new_file1.json + # ?? new_file2.json + # ?? new_file4.json + + # Strip each line of whitespaces + modified_files_statuses = [status.strip() for status in git_status.split("\n")] + + # Only keep files that are deleted using the D prefix + deleted_files_statuses = [ + status for status in modified_files_statuses if "D" in status.split()[0] + ] + + # Remove the D prefix and strip to keep only the relevant filename + deleted_files = [ + status.split()[-1].strip() for status in deleted_files_statuses + ] + + return deleted_files + + def lfs_track(self, patterns: Union[str, List[str]], filename: bool = False): + """ + Tell git-lfs to track files according to a pattern. + + Setting the `filename` argument to `True` will treat the arguments as + literal filenames, not as patterns. Any special glob characters in the + filename will be escaped when writing to the `.gitattributes` file. + + Args: + patterns (`Union[str, List[str]]`): + The pattern, or list of patterns, to track with git-lfs. + filename (`bool`, *optional*, defaults to `False`): + Whether to use the patterns as literal filenames. + """ + if isinstance(patterns, str): + patterns = [patterns] + try: + for pattern in patterns: + run_subprocess( + f"git lfs track {'--filename' if filename else ''} {pattern}", + self.local_dir, + ) + except subprocess.CalledProcessError as exc: + raise EnvironmentError(exc.stderr) + + def lfs_untrack(self, patterns: Union[str, List[str]]): + """ + Tell git-lfs to untrack those files. + + Args: + patterns (`Union[str, List[str]]`): + The pattern, or list of patterns, to untrack with git-lfs. + """ + if isinstance(patterns, str): + patterns = [patterns] + try: + for pattern in patterns: + run_subprocess("git lfs untrack".split() + [pattern], self.local_dir) + except subprocess.CalledProcessError as exc: + raise EnvironmentError(exc.stderr) + + def lfs_enable_largefiles(self): + """ + HF-specific. This enables upload support of files >5GB. + """ + try: + lfs_config = "git config lfs.customtransfer.multipart" + run_subprocess(f"{lfs_config}.path huggingface-cli", self.local_dir) + run_subprocess( + f"{lfs_config}.args {LFS_MULTIPART_UPLOAD_COMMAND}", + self.local_dir, + ) + except subprocess.CalledProcessError as exc: + raise EnvironmentError(exc.stderr) + + def auto_track_binary_files(self, pattern: str = ".") -> List[str]: + """ + Automatically track binary files with git-lfs. + + Args: + pattern (`str`, *optional*, defaults to "."): + The pattern with which to track files that are binary. + + Returns: + `List[str]`: List of filenames that are now tracked due to being + binary files + """ + files_to_be_tracked_with_lfs = [] + + deleted_files = self.list_deleted_files() + + for filename in files_to_be_staged(pattern, folder=self.local_dir): + if filename in deleted_files: + continue + + path_to_file = os.path.join(os.getcwd(), self.local_dir, filename) + + if not (is_tracked_with_lfs(path_to_file) or is_git_ignored(path_to_file)): + size_in_mb = os.path.getsize(path_to_file) / (1024 * 1024) + + if size_in_mb >= 10: + logger.warning( + "Parsing a large file to check if binary or not. Tracking large" + " files using `repository.auto_track_large_files` is" + " recommended so as to not load the full file in memory." + ) + + is_binary = is_binary_file(path_to_file) + + if is_binary: + self.lfs_track(filename) + files_to_be_tracked_with_lfs.append(filename) + + # Cleanup the .gitattributes if files were deleted + self.lfs_untrack(deleted_files) + + return files_to_be_tracked_with_lfs + + def auto_track_large_files(self, pattern: str = ".") -> List[str]: + """ + Automatically track large files (files that weigh more than 10MBs) with + git-lfs. + + Args: + pattern (`str`, *optional*, defaults to "."): + The pattern with which to track files that are above 10MBs. + + Returns: + `List[str]`: List of filenames that are now tracked due to their + size. + """ + files_to_be_tracked_with_lfs = [] + + deleted_files = self.list_deleted_files() + + for filename in files_to_be_staged(pattern, folder=self.local_dir): + if filename in deleted_files: + continue + + path_to_file = os.path.join(os.getcwd(), self.local_dir, filename) + size_in_mb = os.path.getsize(path_to_file) / (1024 * 1024) + + if ( + size_in_mb >= 10 + and not is_tracked_with_lfs(path_to_file) + and not is_git_ignored(path_to_file) + ): + self.lfs_track(filename) + files_to_be_tracked_with_lfs.append(filename) + + # Cleanup the .gitattributes if files were deleted + self.lfs_untrack(deleted_files) + + return files_to_be_tracked_with_lfs + + def lfs_prune(self, recent=False): + """ + git lfs prune + + Args: + recent (`bool`, *optional*, defaults to `False`): + Whether to prune files even if they were referenced by recent + commits. See the following + [link](https://github.com/git-lfs/git-lfs/blob/f3d43f0428a84fc4f1e5405b76b5a73ec2437e65/docs/man/git-lfs-prune.1.ronn#recent-files) + for more information. + """ + try: + with _lfs_log_progress(): + result = run_subprocess( + f"git lfs prune {'--recent' if recent else ''}", self.local_dir + ) + logger.info(result.stdout) + except subprocess.CalledProcessError as exc: + raise EnvironmentError(exc.stderr) + + def git_pull(self, rebase: bool = False, lfs: bool = False): + """ + git pull + + Args: + rebase (`bool`, *optional*, defaults to `False`): + Whether to rebase the current branch on top of the upstream + branch after fetching. + lfs (`bool`, *optional*, defaults to `False`): + Whether to fetch the LFS files too. This option only changes the + behavior when a repository was cloned without fetching the LFS + files; calling `repo.git_pull(lfs=True)` will then fetch the LFS + file from the remote repository. + """ + command = "git pull" if not lfs else "git lfs pull" + if rebase: + command += " --rebase" + try: + with _lfs_log_progress(): + result = run_subprocess(command, self.local_dir) + logger.info(result.stdout) + except subprocess.CalledProcessError as exc: + raise EnvironmentError(exc.stderr) + + def git_add(self, pattern: str = ".", auto_lfs_track: bool = False): + """ + git add + + Setting the `auto_lfs_track` parameter to `True` will automatically + track files that are larger than 10MB with `git-lfs`. + + Args: + pattern (`str`, *optional*, defaults to "."): + The pattern with which to add files to staging. + auto_lfs_track (`bool`, *optional*, defaults to `False`): + Whether to automatically track large and binary files with + git-lfs. Any file over 10MB in size, or in binary format, will + be automatically tracked. + """ + if auto_lfs_track: + # Track files according to their size (>=10MB) + tracked_files = self.auto_track_large_files(pattern) + + # Read the remaining files and track them if they're binary + tracked_files.extend(self.auto_track_binary_files(pattern)) + + if tracked_files: + logger.warning( + f"Adding files tracked by Git LFS: {tracked_files}. This may take a" + " bit of time if the files are large." + ) + + try: + result = run_subprocess("git add -v".split() + [pattern], self.local_dir) + logger.info(f"Adding to index:\n{result.stdout}\n") + except subprocess.CalledProcessError as exc: + raise EnvironmentError(exc.stderr) + + def git_commit(self, commit_message: str = "commit files to HF hub"): + """ + git commit + + Args: + commit_message (`str`, *optional*, defaults to "commit files to HF hub"): + The message attributed to the commit. + """ + try: + result = run_subprocess( + "git commit -v -m".split() + [commit_message], self.local_dir + ) + logger.info(f"Committed:\n{result.stdout}\n") + except subprocess.CalledProcessError as exc: + if len(exc.stderr) > 0: + raise EnvironmentError(exc.stderr) + else: + raise EnvironmentError(exc.stdout) + + def git_push( + self, + upstream: Optional[str] = None, + blocking: bool = True, + auto_lfs_prune: bool = False, + ) -> Union[str, Tuple[str, CommandInProgress]]: + """ + git push + + If used without setting `blocking`, will return url to commit on remote + repo. If used with `blocking=True`, will return a tuple containing the + url to commit and the command object to follow for information about the + process. + + Args: + upstream (`str`, *optional*): + Upstream to which this should push. If not specified, will push + to the lastly defined upstream or to the default one (`origin + main`). + blocking (`bool`, *optional*, defaults to `True`): + Whether the function should return only when the push has + finished. Setting this to `False` will return an + `CommandInProgress` object which has an `is_done` property. This + property will be set to `True` when the push is finished. + auto_lfs_prune (`bool`, *optional*, defaults to `False`): + Whether to automatically prune files once they have been pushed + to the remote. + """ + command = "git push" + + if upstream: + command += f" --set-upstream {upstream}" + + number_of_commits = commits_to_push(self.local_dir, upstream) + + if number_of_commits > 1: + logger.warning( + f"Several commits ({number_of_commits}) will be pushed upstream." + ) + if blocking: + logger.warning("The progress bars may be unreliable.") + + try: + with _lfs_log_progress(): + process = subprocess.Popen( + command.split(), + stderr=subprocess.PIPE, + stdout=subprocess.PIPE, + encoding="utf-8", + cwd=self.local_dir, + ) + + if blocking: + stdout, stderr = process.communicate() + return_code = process.poll() + process.kill() + + if len(stderr): + logger.warning(stderr) + + if return_code: + raise subprocess.CalledProcessError( + return_code, process.args, output=stdout, stderr=stderr + ) + + except subprocess.CalledProcessError as exc: + raise EnvironmentError(exc.stderr) + + if not blocking: + + def status_method(): + status = process.poll() + if status is None: + return -1 + else: + return status + + command_in_progress = CommandInProgress( + "push", + is_done_method=lambda: process.poll() is not None, + status_method=status_method, + process=process, + post_method=self.lfs_prune if auto_lfs_prune else None, + ) + + self.command_queue.append(command_in_progress) + + return self.git_head_commit_url(), command_in_progress + + if auto_lfs_prune: + self.lfs_prune() + + return self.git_head_commit_url() + + def git_checkout(self, revision: str, create_branch_ok: bool = False): + """ + git checkout a given revision + + Specifying `create_branch_ok` to `True` will create the branch to the + given revision if that revision doesn't exist. + + Args: + revision (`str`): + The revision to checkout. + create_branch_ok (`str`, *optional*, defaults to `False`): + Whether creating a branch named with the `revision` passed at + the current checked-out reference if `revision` isn't an + existing revision is allowed. + """ + try: + result = run_subprocess(f"git checkout {revision}", self.local_dir) + logger.warning(f"Checked out {revision} from {self.current_branch}.") + logger.warning(result.stdout) + except subprocess.CalledProcessError as exc: + if not create_branch_ok: + raise EnvironmentError(exc.stderr) + else: + try: + result = run_subprocess( + f"git checkout -b {revision}", self.local_dir + ) + logger.warning( + f"Revision `{revision}` does not exist. Created and checked out" + f" branch `{revision}`." + ) + logger.warning(result.stdout) + except subprocess.CalledProcessError as exc: + raise EnvironmentError(exc.stderr) + + def tag_exists(self, tag_name: str, remote: Optional[str] = None) -> bool: + """ + Check if a tag exists or not. + + Args: + tag_name (`str`): + The name of the tag to check. + remote (`str`, *optional*): + Whether to check if the tag exists on a remote. This parameter + should be the identifier of the remote. + + Returns: + `bool`: Whether the tag exists. + """ + if remote: + try: + result = run_subprocess( + f"git ls-remote origin refs/tags/{tag_name}", self.local_dir + ).stdout.strip() + except subprocess.CalledProcessError as exc: + raise EnvironmentError(exc.stderr) + + return len(result) != 0 + else: + try: + git_tags = run_subprocess("git tag", self.local_dir).stdout.strip() + except subprocess.CalledProcessError as exc: + raise EnvironmentError(exc.stderr) + + git_tags = git_tags.split("\n") + return tag_name in git_tags + + def delete_tag(self, tag_name: str, remote: Optional[str] = None) -> bool: + """ + Delete a tag, both local and remote, if it exists + + Args: + tag_name (`str`): + The tag name to delete. + remote (`str`, *optional*): + The remote on which to delete the tag. + + Returns: + `bool`: `True` if deleted, `False` if the tag didn't exist. + If remote is not passed, will just be updated locally + """ + delete_locally = True + delete_remotely = True + + if not self.tag_exists(tag_name): + delete_locally = False + + if not self.tag_exists(tag_name, remote=remote): + delete_remotely = False + + if delete_locally: + try: + run_subprocess( + ["git", "tag", "-d", tag_name], self.local_dir + ).stdout.strip() + except subprocess.CalledProcessError as exc: + raise EnvironmentError(exc.stderr) + + if remote and delete_remotely: + try: + run_subprocess( + f"git push {remote} --delete {tag_name}", self.local_dir + ).stdout.strip() + except subprocess.CalledProcessError as exc: + raise EnvironmentError(exc.stderr) + + return True + + def add_tag( + self, tag_name: str, message: Optional[str] = None, remote: Optional[str] = None + ): + """ + Add a tag at the current head and push it + + If remote is None, will just be updated locally + + If no message is provided, the tag will be lightweight. if a message is + provided, the tag will be annotated. + + Args: + tag_name (`str`): + The name of the tag to be added. + message (`str`, *optional*): + The message that accompanies the tag. The tag will turn into an + annotated tag if a message is passed. + remote (`str`, *optional*): + The remote on which to add the tag. + """ + if message: + tag_args = ["git", "tag", "-a", tag_name, "-m", message] + else: + tag_args = ["git", "tag", tag_name] + + try: + run_subprocess(tag_args, self.local_dir).stdout.strip() + except subprocess.CalledProcessError as exc: + raise EnvironmentError(exc.stderr) + + if remote: + try: + run_subprocess( + f"git push {remote} {tag_name}", self.local_dir + ).stdout.strip() + except subprocess.CalledProcessError as exc: + raise EnvironmentError(exc.stderr) + + def is_repo_clean(self) -> bool: + """ + Return whether or not the git status is clean or not + + Returns: + `bool`: `True` if the git status is clean, `False` otherwise. + """ + try: + git_status = run_subprocess( + "git status --porcelain", self.local_dir + ).stdout.strip() + except subprocess.CalledProcessError as exc: + raise EnvironmentError(exc.stderr) + + return len(git_status) == 0 + + def push_to_hub( + self, + commit_message: str = "commit files to HF hub", + blocking: bool = True, + clean_ok: bool = True, + auto_lfs_prune: bool = False, + ) -> Union[None, str, Tuple[str, CommandInProgress]]: + """ + Helper to add, commit, and push files to remote repository on the + HuggingFace Hub. Will automatically track large files (>10MB). + + Args: + commit_message (`str`): + Message to use for the commit. + blocking (`bool`, *optional*, defaults to `True`): + Whether the function should return only when the `git push` has + finished. + clean_ok (`bool`, *optional*, defaults to `True`): + If True, this function will return None if the repo is + untouched. Default behavior is to fail because the git command + fails. + auto_lfs_prune (`bool`, *optional*, defaults to `False`): + Whether to automatically prune files once they have been pushed + to the remote. + """ + if clean_ok and self.is_repo_clean(): + logger.info("Repo currently clean. Ignoring push_to_hub") + return None + self.git_add(auto_lfs_track=True) + self.git_commit(commit_message) + return self.git_push( + upstream=f"origin {self.current_branch}", + blocking=blocking, + auto_lfs_prune=auto_lfs_prune, + ) + + @contextmanager + def commit( + self, + commit_message: str, + branch: Optional[str] = None, + track_large_files: bool = True, + blocking: bool = True, + auto_lfs_prune: bool = False, + ): + """ + Context manager utility to handle committing to a repository. This + automatically tracks large files (>10Mb) with git-lfs. Set the + `track_large_files` argument to `False` if you wish to ignore that + behavior. + + Args: + commit_message (`str`): + Message to use for the commit. + branch (`str`, *optional*): + The branch on which the commit will appear. This branch will be + checked-out before any operation. + track_large_files (`bool`, *optional*, defaults to `True`): + Whether to automatically track large files or not. Will do so by + default. + blocking (`bool`, *optional*, defaults to `True`): + Whether the function should return only when the `git push` has + finished. + auto_lfs_prune (`bool`, defaults to `True`): + Whether to automatically prune files once they have been pushed + to the remote. + + Examples: + + ```python + >>> with Repository( + ... "text-files", + ... clone_from="/text-files", + ... token=True, + >>> ).commit("My first file :)"): + ... with open("file.txt", "w+") as f: + ... f.write(json.dumps({"hey": 8})) + + >>> import torch + + >>> model = torch.nn.Transformer() + >>> with Repository( + ... "torch-model", + ... clone_from="/torch-model", + ... token=True, + >>> ).commit("My cool model :)"): + ... torch.save(model.state_dict(), "model.pt") + ``` + + """ + + files_to_stage = files_to_be_staged(".", folder=self.local_dir) + + if len(files_to_stage): + if len(files_to_stage) > 5: + files_in_msg = str(files_to_stage[:5])[:-1] + ", ...]" + + logger.error( + "There exists some updated files in the local repository that are not" + f" committed: {files_in_msg}. This may lead to errors if checking out" + " a branch. These files and their modifications will be added to the" + " current commit." + ) + + if branch is not None: + self.git_checkout(branch, create_branch_ok=True) + + if is_tracked_upstream(self.local_dir): + logger.warning("Pulling changes ...") + self.git_pull(rebase=True) + else: + logger.warning( + "The current branch has no upstream branch. Will push to 'origin" + f" {self.current_branch}'" + ) + + current_working_directory = os.getcwd() + os.chdir(os.path.join(current_working_directory, self.local_dir)) + + try: + yield self + finally: + self.git_add(auto_lfs_track=track_large_files) + + try: + self.git_commit(commit_message) + except OSError as e: + # If no changes are detected, there is nothing to commit. + if "nothing to commit" not in str(e): + raise e + + try: + self.git_push( + upstream=f"origin {self.current_branch}", + blocking=blocking, + auto_lfs_prune=auto_lfs_prune, + ) + except OSError as e: + # If no changes are detected, there is nothing to commit. + if "could not read Username" in str(e): + raise OSError( + "Couldn't authenticate user for push. Did you set" + " `token` to `True`?" + ) from e + else: + raise e + + os.chdir(current_working_directory) + + def repocard_metadata_load(self) -> Optional[Dict]: + filepath = os.path.join(self.local_dir, REPOCARD_NAME) + if os.path.isfile(filepath): + return metadata_load(filepath) + return None + + def repocard_metadata_save(self, data: Dict) -> None: + return metadata_save(os.path.join(self.local_dir, REPOCARD_NAME), data) + + @property + def commands_failed(self): + """ + Returns the asynchronous commands that failed. + """ + return [c for c in self.command_queue if c.status > 0] + + @property + def commands_in_progress(self): + """ + Returns the asynchronous commands that are currently in progress. + """ + return [c for c in self.command_queue if not c.is_done] + + def wait_for_commands(self): + """ + Blocking method: blocks all subsequent execution until all commands have + been processed. + """ + index = 0 + for command_failed in self.commands_failed: + logger.error( + f"The {command_failed.title} command with PID" + f" {command_failed._process.pid} failed." + ) + logger.error(command_failed.stderr) + + while self.commands_in_progress: + if index % 10 == 0: + logger.error( + "Waiting for the following commands to finish before shutting" + f" down: {self.commands_in_progress}." + ) + + index += 1 + + time.sleep(1) diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/templates/datasetcard_template.md b/.local/lib/python3.10/site-packages/huggingface_hub/templates/datasetcard_template.md new file mode 100644 index 0000000000000000000000000000000000000000..c77031041e16362a0e4dd1155e5441bd468d7448 --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/templates/datasetcard_template.md @@ -0,0 +1,126 @@ +--- +{{ card_data }} +--- + +# Dataset Card for {{ pretty_name | default("Dataset Name", true) }} + +## Table of Contents +- [Table of Contents](#table-of-contents) +- [Dataset Description](#dataset-description) + - [Dataset Summary](#dataset-summary) + - [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards) + - [Languages](#languages) +- [Dataset Structure](#dataset-structure) + - [Data Instances](#data-instances) + - [Data Fields](#data-fields) + - [Data Splits](#data-splits) +- [Dataset Creation](#dataset-creation) + - [Curation Rationale](#curation-rationale) + - [Source Data](#source-data) + - [Annotations](#annotations) + - [Personal and Sensitive Information](#personal-and-sensitive-information) +- [Considerations for Using the Data](#considerations-for-using-the-data) + - [Social Impact of Dataset](#social-impact-of-dataset) + - [Discussion of Biases](#discussion-of-biases) + - [Other Known Limitations](#other-known-limitations) +- [Additional Information](#additional-information) + - [Dataset Curators](#dataset-curators) + - [Licensing Information](#licensing-information) + - [Citation Information](#citation-information) + - [Contributions](#contributions) + +## Dataset Description + +- **Homepage:** {{ homepage_url | default("", true)}} +- **Repository:** {{ repo_url | default("", true)}} +- **Paper:** {{ paper_url | default("", true)}} +- **Leaderboard:** {{ leaderboard_url | default("", true)}} +- **Point of Contact:** {{ point_of_contact | default("", true)}} + +### Dataset Summary + +{{ dataset_summary | default("[More Information Needed]", true)}} + +### Supported Tasks and Leaderboards + +{{ supported_tasks_and_leaderboards_section | default("[More Information Needed]", true)}} + +### Languages + +{{ languages_section | default("[More Information Needed]", true)}} + +## Dataset Structure + +### Data Instances + +{{ data_instances_section | default("[More Information Needed]", true)}} + +### Data Fields + +{{ data_fields_section | default("[More Information Needed]", true)}} + +### Data Splits + +{{ data_splits_section | default("[More Information Needed]", true)}} + +## Dataset Creation + +### Curation Rationale + +{{ curation_rationale_section | default("[More Information Needed]", true)}} + +### Source Data + +#### Initial Data Collection and Normalization + +{{ data_collection_section | default("[More Information Needed]", true)}} + +#### Who are the source language producers? + +{{ source_language_producers_section | default("[More Information Needed]", true)}} + +### Annotations + +#### Annotation process + +{{ annotation_process_section | default("[More Information Needed]", true)}} + +#### Who are the annotators? + +{{ who_are_annotators_section | default("[More Information Needed]", true)}} + +### Personal and Sensitive Information + +{{ personal_and_sensitive_information_section | default("[More Information Needed]", true)}} + +## Considerations for Using the Data + +### Social Impact of Dataset + +{{ social_impact_section | default("[More Information Needed]", true)}} + +### Discussion of Biases + +{{ discussion_of_biases_section | default("[More Information Needed]", true)}} + +### Other Known Limitations + +{{ known_limitations_section | default("[More Information Needed]", true)}} + +## Additional Information + +### Dataset Curators + +{{ dataset_curators_section | default("[More Information Needed]", true)}} + +### Licensing Information + +{{ licensing_information_section | default("[More Information Needed]", true)}} + +### Citation Information + +{{ citation_information_section | default("[More Information Needed]", true)}} + +### Contributions + +Thanks to [@github-username](https://github.com/) for adding this dataset. \ No newline at end of file diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/templates/modelcard_template.md b/.local/lib/python3.10/site-packages/huggingface_hub/templates/modelcard_template.md new file mode 100644 index 0000000000000000000000000000000000000000..a038379f86ff4a759ea1bcd7c228ca924749ae2d --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/templates/modelcard_template.md @@ -0,0 +1,203 @@ +--- +# For reference on model card metadata, see: https://github.com/huggingface/hub-docs/blob/main/modelcard.md?plain=1 +{{card_data}} +--- + +# Model Card for {{ model_id | default("Model ID", true) }} + + + +# Table of Contents + +1. [Model Details](#model-details) +2. [Uses](#uses) +3. [Bias, Risks, and Limitations](#bias-risks-and-limitations) +4. [Training Details](#training-details) +5. [Evaluation](#evaluation) +6. [Model Examination](#model-examination-optional) +7. [Environmental Impact](#environmental-impact) +8. [Technical Specifications](#technical-specifications-optional) +9. [Citation](#citation-optional) +10. [Glossary](#glossary-optional) +11. [More Information](#more-information-optional) +12. [Model Card Authors](#model-card-authors-optional) +13. [Model Card Contact](#model-card-contact) +14. [How To Get Started With the Model](#how-to-get-started-with-the-model) + + +# Model Details + +## Model Description + + + +{{ model_description | default("", true) }} + +- **Developed by:** {{ developers | default("[More Information Needed]", true)}} +- **Shared by [optional]:** {{ shared_by | default("[More Information Needed]", true)}} +- **Model type:** {{ model_type | default("[More Information Needed]", true)}} +- **Language(s) (NLP):** {{ language | default("[More Information Needed]", true)}} +- **License:** {{ license | default("[More Information Needed]", true)}} +- **Finetuned from model [optional]:** {{ finetuned_from | default("[More Information Needed]", true)}} +- **Resources for more information:** {{ more_resources | default("[More Information Needed]", true)}} + +# Uses + + + +## Direct Use + + + +{{ direct_use | default("[More Information Needed]", true)}} + +## Downstream Use [optional] + + + +{{ downstream_use | default("[More Information Needed]", true)}} + +## Out-of-Scope Use + + + +{{ out_of_scope_use | default("[More Information Needed]", true)}} + +# Bias, Risks, and Limitations + + + +{{ bias_risks_limitations | default("[More Information Needed]", true)}} + +## Recommendations + + + +{{ bias_recommendations | default("Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.", true)}} + +# Training Details + +## Training Data + + + +{{ training_data | default("[More Information Needed]", true)}} + +## Training Procedure [optional] + + + +### Preprocessing + +{{ preprocessing | default("[More Information Needed]", true)}} + +### Speeds, Sizes, Times + + + +{{ speeds_sizes_times | default("[More Information Needed]", true)}} + +# Evaluation + + + +## Testing Data, Factors & Metrics + +### Testing Data + + + +{{ testing_data | default("[More Information Needed]", true)}} + +### Factors + + + +{{ testing_factors | default("[More Information Needed]", true)}} + +### Metrics + + + +{{ testing_metrics | default("[More Information Needed]", true)}} + +## Results + +{{ results | default("[More Information Needed]", true)}} + +# Model Examination [optional] + + + +{{ model_examination | default("[More Information Needed]", true)}} + +# Environmental Impact + + + +Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700). + +- **Hardware Type:** {{ hardware | default("[More Information Needed]", true)}} +- **Hours used:** {{ hours_used | default("[More Information Needed]", true)}} +- **Cloud Provider:** {{ cloud_provider | default("[More Information Needed]", true)}} +- **Compute Region:** {{ cloud_region | default("[More Information Needed]", true)}} +- **Carbon Emitted:** {{ co2_emitted | default("[More Information Needed]", true)}} + +# Technical Specifications [optional] + +## Model Architecture and Objective + +{{ model_specs | default("[More Information Needed]", true)}} + +## Compute Infrastructure + +{{ compute_infrastructure | default("[More Information Needed]", true)}} + +### Hardware + +{{ hardware | default("[More Information Needed]", true)}} + +### Software + +{{ software | default("[More Information Needed]", true)}} + +# Citation [optional] + + + +**BibTeX:** + +{{ citation_bibtex | default("[More Information Needed]", true)}} + +**APA:** + +{{ citation_apa | default("[More Information Needed]", true)}} + +# Glossary [optional] + + + +{{ glossary | default("[More Information Needed]", true)}} + +# More Information [optional] + +{{ more_information | default("[More Information Needed]", true)}} + +# Model Card Authors [optional] + +{{ model_card_authors | default("[More Information Needed]", true)}} + +# Model Card Contact + +{{ model_card_contact | default("[More Information Needed]", true)}} + +# How to Get Started with the Model + +Use the code below to get started with the model. + +
+ Click to expand + +{{ get_started_code | default("[More Information Needed]", true)}} + +
diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/utils/__init__.py b/.local/lib/python3.10/site-packages/huggingface_hub/utils/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..8d2ddd7ce479e8ef3b5e4dc66071f5a5a4e8f3d4 --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/utils/__init__.py @@ -0,0 +1,87 @@ +# flake8: noqa +#!/usr/bin/env python +# coding=utf-8 +# Copyright 2021 The HuggingFace Inc. team. 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 + +from . import tqdm as _tqdm # _tqdm is the module +from ._cache_assets import cached_assets_path +from ._cache_manager import ( + CachedFileInfo, + CachedRepoInfo, + CachedRevisionInfo, + CacheNotFound, + CorruptedCacheException, + DeleteCacheStrategy, + HFCacheInfo, + scan_cache_dir, +) +from ._chunk_utils import chunk_iterable +from ._datetime import parse_datetime +from ._errors import ( + BadRequestError, + EntryNotFoundError, + HfHubHTTPError, + LocalEntryNotFoundError, + RepositoryNotFoundError, + RevisionNotFoundError, + hf_raise_for_status, +) +from ._fixes import yaml_dump +from ._git_credential import ( + erase_from_credential_store, + list_credential_helpers, + read_from_credential_store, + set_git_credential, + unset_git_credential, + write_to_credential_store, +) +from ._headers import build_hf_headers, get_token_to_send +from ._hf_folder import HfFolder +from ._http import http_backoff +from ._paths import filter_repo_objects +from ._runtime import ( + dump_environment_info, + get_fastai_version, + get_fastcore_version, + get_graphviz_version, + get_hf_hub_version, + get_jinja_version, + get_pydot_version, + get_python_version, + get_tf_version, + get_torch_version, + is_fastai_available, + is_fastcore_available, + is_google_colab, + is_graphviz_available, + is_jinja_available, + is_notebook, + is_pydot_available, + is_tf_available, + is_torch_available, +) +from ._subprocess import run_interactive_subprocess, run_subprocess +from ._validators import ( + HFValidationError, + smoothly_deprecate_use_auth_token, + validate_hf_hub_args, + validate_repo_id, +) +from .tqdm import ( + are_progress_bars_disabled, + disable_progress_bars, + enable_progress_bars, + tqdm, +) diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/__init__.cpython-310.pyc b/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..133710e25b88ca1935048da7fa936d2584f1fd09 Binary files /dev/null and b/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/__init__.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_cache_assets.cpython-310.pyc b/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_cache_assets.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2ff93c7c6118fd9754e27cad6cfbfe13f282bd8c Binary files /dev/null and b/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_cache_assets.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_cache_manager.cpython-310.pyc b/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_cache_manager.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f98494bb1ebb2b0126d714d1ec6c34e2db96d4cd Binary files /dev/null and b/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_cache_manager.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_chunk_utils.cpython-310.pyc b/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_chunk_utils.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d7178b128733253b3a31ad2495bf0dde542468dd Binary files /dev/null and b/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_chunk_utils.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_datetime.cpython-310.pyc b/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_datetime.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5ae1d232c3dff16a90e26d47b785ce87d057654e Binary files /dev/null and b/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_datetime.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_deprecation.cpython-310.pyc b/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_deprecation.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..92fadc9bfb905a9e0efbfe22fa39d8c0458cb9e2 Binary files /dev/null and b/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_deprecation.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_errors.cpython-310.pyc b/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_errors.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..00363f51d9cb2864169e00627f94fe7de74a88a9 Binary files /dev/null and b/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_errors.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_fixes.cpython-310.pyc b/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_fixes.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5b89057b808ac8377d6ea22d06eabbbcdad5753c Binary files /dev/null and b/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_fixes.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_git_credential.cpython-310.pyc b/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_git_credential.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5827c302e439135e0f7d0456b8a28b7b7b823c48 Binary files /dev/null and b/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_git_credential.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_headers.cpython-310.pyc b/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_headers.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1780780bd40d3ad025f951f4cb43e68fd44f8dfd Binary files /dev/null and b/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_headers.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_hf_folder.cpython-310.pyc b/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_hf_folder.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..59b27f1428a6ec6837fc7d974f062a7b1d1f2128 Binary files /dev/null and b/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_hf_folder.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_http.cpython-310.pyc b/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_http.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e60021f58445c095e3a79414b9e9760b64ee3c59 Binary files /dev/null and b/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_http.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_pagination.cpython-310.pyc b/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_pagination.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8f7af8fec3c760fe2ba446d4697b01488dcec1aa Binary files /dev/null and b/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_pagination.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_paths.cpython-310.pyc b/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_paths.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1e357d0e04aadc903d7600947d1c52c7e4da2125 Binary files /dev/null and b/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_paths.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_runtime.cpython-310.pyc b/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_runtime.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..167fb601749c200a4e4cb2dffd989f7d8a805e80 Binary files /dev/null and b/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_runtime.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_subprocess.cpython-310.pyc b/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_subprocess.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1369b9e9c9d683fcd3915c6757de0725bd15598d Binary files /dev/null and b/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_subprocess.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_typing.cpython-310.pyc b/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_typing.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..32556eb9791a772e249fb79ef14cd2cb7292caf2 Binary files /dev/null and b/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_typing.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_validators.cpython-310.pyc b/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_validators.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bb2dfd2614b1ddf69b372e94ec01cd247d431a90 Binary files /dev/null and b/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_validators.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/endpoint_helpers.cpython-310.pyc b/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/endpoint_helpers.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1723c60bb8b77a833fdedf0b32a05d3061b6dc90 Binary files /dev/null and b/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/endpoint_helpers.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/logging.cpython-310.pyc b/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/logging.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f0fdaa22ec084d5b3a45920e43bdd405ae763900 Binary files /dev/null and b/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/logging.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/sha.cpython-310.pyc b/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/sha.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bf8d09934f92a75e1247f536fd6af6818092e27f Binary files /dev/null and b/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/sha.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/tqdm.cpython-310.pyc b/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/tqdm.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..751eab31f33b77186afb52e1a3d1dcd454a0405f Binary files /dev/null and b/.local/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/tqdm.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/utils/_cache_assets.py b/.local/lib/python3.10/site-packages/huggingface_hub/utils/_cache_assets.py new file mode 100644 index 0000000000000000000000000000000000000000..467ddaae54e982b8ef3b57baaa00f6baff9ad55d --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/utils/_cache_assets.py @@ -0,0 +1,138 @@ +# coding=utf-8 +# Copyright 2019-present, the HuggingFace Inc. team. +# +# 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. +from pathlib import Path +from typing import Union + +from ..constants import HUGGINGFACE_ASSETS_CACHE + + +def cached_assets_path( + library_name: str, + namespace: str = "default", + subfolder: str = "default", + *, + assets_dir: Union[str, Path, None] = None, +): + """Return a folder path to cache arbitrary files. + + `huggingface_hub` provides a canonical folder path to store assets. This is the + recommended way to integrate cache in a downstream library as it will benefit from + the builtins tools to scan and delete the cache properly. + + The distinction is made between files cached from the Hub and assets. Files from the + Hub are cached in a git-aware manner and entirely managed by `huggingface_hub`. See + [related documentation](https://huggingface.co/docs/huggingface_hub/how-to-cache). + All other files that a downstream library caches are considered to be "assets" + (files downloaded from external sources, extracted from a .tar archive, preprocessed + for training,...). + + Once the folder path is generated, it is guaranteed to exist and to be a directory. + The path is based on 3 levels of depth: the library name, a namespace and a + subfolder. Those 3 levels grants flexibility while allowing `huggingface_hub` to + expect folders when scanning/deleting parts of the assets cache. Within a library, + it is expected that all namespaces share the same subset of subfolder names but this + is not a mandatory rule. The downstream library has then full control on which file + structure to adopt within its cache. Namespace and subfolder are optional (would + default to a `"default/"` subfolder) but library name is mandatory as we want every + downstream library to manage its own cache. + + Expected tree: + ```text + assets/ + └── datasets/ + │ ├── SQuAD/ + │ │ ├── downloaded/ + │ │ ├── extracted/ + │ │ └── processed/ + │ ├── Helsinki-NLP--tatoeba_mt/ + │ ├── downloaded/ + │ ├── extracted/ + │ └── processed/ + └── transformers/ + ├── default/ + │ ├── something/ + ├── bert-base-cased/ + │ ├── default/ + │ └── training/ + hub/ + └── models--julien-c--EsperBERTo-small/ + ├── blobs/ + │ ├── (...) + │ ├── (...) + ├── refs/ + │ └── (...) + └── [ 128] snapshots/ + ├── 2439f60ef33a0d46d85da5001d52aeda5b00ce9f/ + │ ├── (...) + └── bbc77c8132af1cc5cf678da3f1ddf2de43606d48/ + └── (...) + ``` + + + Args: + library_name (`str`): + Name of the library that will manage the cache folder. Example: `"dataset"`. + namespace (`str`, *optional*, defaults to "default"): + Namespace to which the data belongs. Example: `"SQuAD"`. + subfolder (`str`, *optional*, defaults to "default"): + Subfolder in which the data will be stored. Example: `extracted`. + assets_dir (`str`, `Path`, *optional*): + Path to the folder where assets are cached. This must not be the same folder + where Hub files are cached. Defaults to `HF_HOME / "assets"` if not provided. + Can also be set with `HUGGINGFACE_ASSETS_CACHE` environment variable. + + Returns: + Path to the cache folder (`Path`). + + Example: + ```py + >>> from huggingface_hub import cached_assets_path + + >>> cached_assets_path(library_name="datasets", namespace="SQuAD", subfolder="download") + PosixPath('/home/wauplin/.cache/huggingface/extra/datasets/SQuAD/download') + + >>> cached_assets_path(library_name="datasets", namespace="SQuAD", subfolder="extracted") + PosixPath('/home/wauplin/.cache/huggingface/extra/datasets/SQuAD/extracted') + + >>> cached_assets_path(library_name="datasets", namespace="Helsinki-NLP/tatoeba_mt") + PosixPath('/home/wauplin/.cache/huggingface/extra/datasets/Helsinki-NLP--tatoeba_mt/default') + + >>> cached_assets_path(library_name="datasets", assets_dir="/tmp/tmp123456") + PosixPath('/tmp/tmp123456/datasets/default/default') + ``` + """ + # Resolve assets_dir + if assets_dir is None: + assets_dir = HUGGINGFACE_ASSETS_CACHE + assets_dir = Path(assets_dir).expanduser().resolve() + + # Avoid names that could create path issues + for part in (" ", "/", "\\"): + library_name = library_name.replace(part, "--") + namespace = namespace.replace(part, "--") + subfolder = subfolder.replace(part, "--") + + # Path to subfolder is created + path = assets_dir / library_name / namespace / subfolder + try: + path.mkdir(exist_ok=True, parents=True) + except (FileExistsError, NotADirectoryError): + raise ValueError( + "Corrupted assets folder: cannot create directory because of an existing" + f" file ({path})." + ) + + # Return + return path diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/utils/_cache_manager.py b/.local/lib/python3.10/site-packages/huggingface_hub/utils/_cache_manager.py new file mode 100644 index 0000000000000000000000000000000000000000..a4e966aeafdb03d4dfddf6f38abdc794403993aa --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/utils/_cache_manager.py @@ -0,0 +1,832 @@ +# coding=utf-8 +# Copyright 2022-present, the HuggingFace Inc. team. +# +# 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. +"""Contains utilities to manage the HF cache directory.""" +import os +import shutil +import time +from collections import defaultdict +from dataclasses import dataclass +from pathlib import Path +from typing import Dict, FrozenSet, List, Optional, Set, Union + +from ..constants import HUGGINGFACE_HUB_CACHE +from . import logging +from ._typing import Literal + + +logger = logging.get_logger(__name__) + +REPO_TYPE_T = Literal["model", "dataset", "space"] + + +class CacheNotFound(Exception): + """Exception thrown when the Huggingface cache is not found.""" + + cache_dir = Union[str, Path] + + def __init__(self, msg: str, cache_dir: Union[str, Path], *args, **kwargs): + super().__init__(msg, *args, **kwargs) + self.cache_dir = cache_dir + + +class CorruptedCacheException(Exception): + """Exception for any unexpected structure in the Huggingface cache-system.""" + + +@dataclass(frozen=True) +class CachedFileInfo: + """Frozen data structure holding information about a single cached file. + + Args: + file_name (`str`): + Name of the file. Example: `config.json`. + file_path (`Path`): + Path of the file in the `snapshots` directory. The file path is a symlink + referring to a blob in the `blobs` folder. + blob_path (`Path`): + Path of the blob file. This is equivalent to `file_path.resolve()`. + size_on_disk (`int`): + Size of the blob file in bytes. + blob_last_accessed (`float`): + Timestamp of the last time the blob file has been accessed (from any + revision). + blob_last_modified (`float`): + Timestamp of the last time the blob file has been modified/created. + + + + `blob_last_accessed` and `blob_last_modified` reliability can depend on the OS you + are using. See [python documentation](https://docs.python.org/3/library/os.html#os.stat_result) + for more details. + + + """ + + file_name: str + file_path: Path + blob_path: Path + size_on_disk: int + + blob_last_accessed: float + blob_last_modified: float + + @property + def blob_last_accessed_str(self) -> str: + """ + (property) Timestamp of the last time the blob file has been accessed (from any + revision), returned as a human-readable string. + + Example: "2 weeks ago". + """ + return _format_timesince(self.blob_last_accessed) + + @property + def blob_last_modified_str(self) -> str: + """ + (property) Timestamp of the last time the blob file has been modified, returned + as a human-readable string. + + Example: "2 weeks ago". + """ + return _format_timesince(self.blob_last_modified) + + @property + def size_on_disk_str(self) -> str: + """ + (property) Size of the blob file as a human-readable string. + + Example: "42.2K". + """ + return _format_size(self.size_on_disk) + + +@dataclass(frozen=True) +class CachedRevisionInfo: + """Frozen data structure holding information about a revision. + + A revision correspond to a folder in the `snapshots` folder and is populated with + the exact tree structure as the repo on the Hub but contains only symlinks. A + revision can be either referenced by 1 or more `refs` or be "detached" (no refs). + + Args: + commit_hash (`str`): + Hash of the revision (unique). + Example: `"9338f7b671827df886678df2bdd7cc7b4f36dffd"`. + snapshot_path (`Path`): + Path to the revision directory in the `snapshots` folder. It contains the + exact tree structure as the repo on the Hub. + files: (`FrozenSet[CachedFileInfo]`): + Set of [`~CachedFileInfo`] describing all files contained in the snapshot. + refs (`FrozenSet[str]`): + Set of `refs` pointing to this revision. If the revision has no `refs`, it + is considered detached. + Example: `{"main", "2.4.0"}` or `{"refs/pr/1"}`. + size_on_disk (`int`): + Sum of the blob file sizes that are symlink-ed by the revision. + last_modified (`float`): + Timestamp of the last time the revision has been created/modified. + + + + `last_accessed` cannot be determined correctly on a single revision as blob files + are shared across revisions. + + + + + + `size_on_disk` is not necessarily the sum of all file sizes because of possible + duplicated files. Besides, only blobs are taken into account, not the (negligible) + size of folders and symlinks. + + + """ + + commit_hash: str + snapshot_path: Path + size_on_disk: int + files: FrozenSet[CachedFileInfo] + refs: FrozenSet[str] + + last_modified: float + + @property + def last_modified_str(self) -> str: + """ + (property) Timestamp of the last time the revision has been modified, returned + as a human-readable string. + + Example: "2 weeks ago". + """ + return _format_timesince(self.last_modified) + + @property + def size_on_disk_str(self) -> str: + """ + (property) Sum of the blob file sizes as a human-readable string. + + Example: "42.2K". + """ + return _format_size(self.size_on_disk) + + @property + def nb_files(self) -> int: + """ + (property) Total number of files in the revision. + """ + return len(self.files) + + +@dataclass(frozen=True) +class CachedRepoInfo: + """Frozen data structure holding information about a cached repository. + + Args: + repo_id (`str`): + Repo id of the repo on the Hub. Example: `"google/fleurs"`. + repo_type (`Literal["dataset", "model", "space"]`): + Type of the cached repo. + repo_path (`Path`): + Local path to the cached repo. + size_on_disk (`int`): + Sum of the blob file sizes in the cached repo. + nb_files (`int`): + Total number of blob files in the cached repo. + revisions (`FrozenSet[CachedRevisionInfo]`): + Set of [`~CachedRevisionInfo`] describing all revisions cached in the repo. + last_accessed (`float`): + Timestamp of the last time a blob file of the repo has been accessed. + last_modified (`float`): + Timestamp of the last time a blob file of the repo has been modified/created. + + + + `size_on_disk` is not necessarily the sum of all revisions sizes because of + duplicated files. Besides, only blobs are taken into account, not the (negligible) + size of folders and symlinks. + + + + + + `last_accessed` and `last_modified` reliability can depend on the OS you are using. + See [python documentation](https://docs.python.org/3/library/os.html#os.stat_result) + for more details. + + + """ + + repo_id: str + repo_type: REPO_TYPE_T + repo_path: Path + size_on_disk: int + nb_files: int + revisions: FrozenSet[CachedRevisionInfo] + + last_accessed: float + last_modified: float + + @property + def last_accessed_str(self) -> str: + """ + (property) Last time a blob file of the repo has been accessed, returned as a + human-readable string. + + Example: "2 weeks ago". + """ + return _format_timesince(self.last_accessed) + + @property + def last_modified_str(self) -> str: + """ + (property) Last time a blob file of the repo has been modified, returned as a + human-readable string. + + Example: "2 weeks ago". + """ + return _format_timesince(self.last_modified) + + @property + def size_on_disk_str(self) -> str: + """ + (property) Sum of the blob file sizes as a human-readable string. + + Example: "42.2K". + """ + return _format_size(self.size_on_disk) + + @property + def refs(self) -> Dict[str, CachedRevisionInfo]: + """ + (property) Mapping between `refs` and revision data structures. + """ + return {ref: revision for revision in self.revisions for ref in revision.refs} + + +@dataclass(frozen=True) +class DeleteCacheStrategy: + """Frozen data structure holding the strategy to delete cached revisions. + + This object is not meant to be instantiated programmatically but to be returned by + [`~utils.HFCacheInfo.delete_revisions`]. See documentation for usage example. + + Args: + expected_freed_size (`float`): + Expected freed size once strategy is executed. + blobs (`FrozenSet[Path]`): + Set of blob file paths to be deleted. + refs (`FrozenSet[Path]`): + Set of reference file paths to be deleted. + repos (`FrozenSet[Path]`): + Set of entire repo paths to be deleted. + snapshots (`FrozenSet[Path]`): + Set of snapshots to be deleted (directory of symlinks). + """ + + expected_freed_size: int + blobs: FrozenSet[Path] + refs: FrozenSet[Path] + repos: FrozenSet[Path] + snapshots: FrozenSet[Path] + + @property + def expected_freed_size_str(self) -> str: + """ + (property) Expected size that will be freed as a human-readable string. + + Example: "42.2K". + """ + return _format_size(self.expected_freed_size) + + def execute(self) -> None: + """Execute the defined strategy. + + + + If this method is interrupted, the cache might get corrupted. Deletion order is + implemented so that references and symlinks are deleted before the actual blob + files. + + + + + + This method is irreversible. If executed, cached files are erased and must be + downloaded again. + + + """ + # Deletion order matters. Blobs are deleted in last so that the user can't end + # up in a state where a `ref`` refers to a missing snapshot or a snapshot + # symlink refers to a deleted blob. + + # Delete entire repos + for path in self.repos: + _try_delete_path(path, path_type="repo") + + # Delete snapshot directories + for path in self.snapshots: + _try_delete_path(path, path_type="snapshot") + + # Delete refs files + for path in self.refs: + _try_delete_path(path, path_type="ref") + + # Delete blob files + for path in self.blobs: + _try_delete_path(path, path_type="blob") + + logger.info(f"Cache deletion done. Saved {self.expected_freed_size_str}.") + + +@dataclass(frozen=True) +class HFCacheInfo: + """Frozen data structure holding information about the entire cache-system. + + This data structure is returned by [`scan_cache_dir`] and is immutable. + + Args: + size_on_disk (`int`): + Sum of all valid repo sizes in the cache-system. + repos (`FrozenSet[CachedRepoInfo]`): + Set of [`~CachedRepoInfo`] describing all valid cached repos found on the + cache-system while scanning. + warnings (`List[CorruptedCacheException]`): + List of [`~CorruptedCacheException`] that occurred while scanning the cache. + Those exceptions are captured so that the scan can continue. Corrupted repos + are skipped from the scan. + + + + Here `size_on_disk` is equal to the sum of all repo sizes (only blobs). However if + some cached repos are corrupted, their sizes are not taken into account. + + + """ + + size_on_disk: int + repos: FrozenSet[CachedRepoInfo] + warnings: List[CorruptedCacheException] + + @property + def size_on_disk_str(self) -> str: + """ + (property) Sum of all valid repo sizes in the cache-system as a human-readable + string. + + Example: "42.2K". + """ + return _format_size(self.size_on_disk) + + def delete_revisions(self, *revisions: str) -> DeleteCacheStrategy: + """Prepare the strategy to delete one or more revisions cached locally. + + Input revisions can be any revision hash. If a revision hash is not found in the + local cache, a warning is thrown but no error is raised. Revisions can be from + different cached repos since hashes are unique across repos, + + Examples: + ```py + >>> from huggingface_hub import scan_cache_dir + >>> cache_info = scan_cache_dir() + >>> delete_strategy = cache_info.delete_revisions( + ... "81fd1d6e7847c99f5862c9fb81387956d99ec7aa" + ... ) + >>> print(f"Will free {delete_strategy.expected_freed_size_str}.") + Will free 7.9K. + >>> delete_strategy.execute() + Cache deletion done. Saved 7.9K. + ``` + + ```py + >>> from huggingface_hub import scan_cache_dir + >>> scan_cache_dir().delete_revisions( + ... "81fd1d6e7847c99f5862c9fb81387956d99ec7aa", + ... "e2983b237dccf3ab4937c97fa717319a9ca1a96d", + ... "6c0e6080953db56375760c0471a8c5f2929baf11", + ... ).execute() + Cache deletion done. Saved 8.6G. + ``` + + + + `delete_revisions` returns a [`~utils.DeleteCacheStrategy`] object that needs to + be executed. The [`~utils.DeleteCacheStrategy`] is not meant to be modified but + allows having a dry run before actually executing the deletion. + + + """ + hashes_to_delete: Set[str] = set(revisions) + + repos_with_revisions: Dict[ + CachedRepoInfo, Set[CachedRevisionInfo] + ] = defaultdict(set) + + for repo in self.repos: + for revision in repo.revisions: + if revision.commit_hash in hashes_to_delete: + repos_with_revisions[repo].add(revision) + hashes_to_delete.remove(revision.commit_hash) + + if len(hashes_to_delete) > 0: + logger.warning( + "Revision(s) not found - cannot delete them:" + f" {', '.join(hashes_to_delete)}" + ) + + delete_strategy_blobs: Set[Path] = set() + delete_strategy_refs: Set[Path] = set() + delete_strategy_repos: Set[Path] = set() + delete_strategy_snapshots: Set[Path] = set() + delete_strategy_expected_freed_size = 0 + + for affected_repo, revisions_to_delete in repos_with_revisions.items(): + other_revisions = affected_repo.revisions - revisions_to_delete + + # If no other revisions, it means all revisions are deleted + # -> delete the entire cached repo + if len(other_revisions) == 0: + delete_strategy_repos.add(affected_repo.repo_path) + delete_strategy_expected_freed_size += affected_repo.size_on_disk + continue + + # Some revisions of the repo will be deleted but not all. We need to filter + # which blob files will not be linked anymore. + for revision_to_delete in revisions_to_delete: + # Snapshot dir + delete_strategy_snapshots.add(revision_to_delete.snapshot_path) + + # Refs dir + for ref in revision_to_delete.refs: + delete_strategy_refs.add(affected_repo.repo_path / "refs" / ref) + + # Blobs dir + for file in revision_to_delete.files: + if file.blob_path not in delete_strategy_blobs: + is_file_alone = True + for revision in other_revisions: + for rev_file in revision.files: + if file.blob_path == rev_file.blob_path: + is_file_alone = False + break + if not is_file_alone: + break + + # Blob file not referenced by remaining revisions -> delete + if is_file_alone: + delete_strategy_blobs.add(file.blob_path) + delete_strategy_expected_freed_size += file.size_on_disk + + # Return the strategy instead of executing it. + return DeleteCacheStrategy( + blobs=frozenset(delete_strategy_blobs), + refs=frozenset(delete_strategy_refs), + repos=frozenset(delete_strategy_repos), + snapshots=frozenset(delete_strategy_snapshots), + expected_freed_size=delete_strategy_expected_freed_size, + ) + + +def scan_cache_dir(cache_dir: Optional[Union[str, Path]] = None) -> HFCacheInfo: + """Scan the entire HF cache-system and return a [`~HFCacheInfo`] structure. + + Use `scan_cache_dir` in order to programmatically scan your cache-system. The cache + will be scanned repo by repo. If a repo is corrupted, a [`~CorruptedCacheException`] + will be thrown internally but captured and returned in the [`~HFCacheInfo`] + structure. Only valid repos get a proper report. + + ```py + >>> from huggingface_hub import scan_cache_dir + + >>> hf_cache_info = scan_cache_dir() + HFCacheInfo( + size_on_disk=3398085269, + repos=frozenset({ + CachedRepoInfo( + repo_id='t5-small', + repo_type='model', + repo_path=PosixPath(...), + size_on_disk=970726914, + nb_files=11, + revisions=frozenset({ + CachedRevisionInfo( + commit_hash='d78aea13fa7ecd06c29e3e46195d6341255065d5', + size_on_disk=970726339, + snapshot_path=PosixPath(...), + files=frozenset({ + CachedFileInfo( + file_name='config.json', + size_on_disk=1197 + file_path=PosixPath(...), + blob_path=PosixPath(...), + ), + CachedFileInfo(...), + ... + }), + ), + CachedRevisionInfo(...), + ... + }), + ), + CachedRepoInfo(...), + ... + }), + warnings=[ + CorruptedCacheException("Snapshots dir doesn't exist in cached repo: ..."), + CorruptedCacheException(...), + ... + ], + ) + ``` + + You can also print a detailed report directly from the `huggingface-cli` using: + ```text + > huggingface-cli scan-cache + REPO ID REPO TYPE SIZE ON DISK NB FILES REFS LOCAL PATH + --------------------------- --------- ------------ -------- ------------------- ------------------------------------------------------------------------- + glue dataset 116.3K 15 1.17.0, main, 2.4.0 /Users/lucain/.cache/huggingface/hub/datasets--glue + google/fleurs dataset 64.9M 6 main, refs/pr/1 /Users/lucain/.cache/huggingface/hub/datasets--google--fleurs + Jean-Baptiste/camembert-ner model 441.0M 7 main /Users/lucain/.cache/huggingface/hub/models--Jean-Baptiste--camembert-ner + bert-base-cased model 1.9G 13 main /Users/lucain/.cache/huggingface/hub/models--bert-base-cased + t5-base model 10.1K 3 main /Users/lucain/.cache/huggingface/hub/models--t5-base + t5-small model 970.7M 11 refs/pr/1, main /Users/lucain/.cache/huggingface/hub/models--t5-small + + Done in 0.0s. Scanned 6 repo(s) for a total of 3.4G. + Got 1 warning(s) while scanning. Use -vvv to print details. + ``` + + Args: + cache_dir (`str` or `Path`, `optional`): + Cache directory to cache. Defaults to the default HF cache directory. + + + + Raises: + + `CacheNotFound` + If the cache directory does not exist. + + [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) + If the cache directory is a file, instead of a directory. + + + + Returns: a [`~HFCacheInfo`] object. + """ + if cache_dir is None: + cache_dir = HUGGINGFACE_HUB_CACHE + + cache_dir = Path(cache_dir).expanduser().resolve() + if not cache_dir.exists(): + raise CacheNotFound( + f"Cache directory not found: {cache_dir}. Please use `cache_dir` argument" + " or set `HUGGINGFACE_HUB_CACHE` environment variable.", + cache_dir=cache_dir, + ) + + if cache_dir.is_file(): + raise ValueError( + f"Scan cache expects a directory but found a file: {cache_dir}. Please use" + " `cache_dir` argument or set `HUGGINGFACE_HUB_CACHE` environment" + " variable." + ) + + repos: Set[CachedRepoInfo] = set() + warnings: List[CorruptedCacheException] = [] + for repo_path in cache_dir.iterdir(): + try: + repos.add(_scan_cached_repo(repo_path)) + except CorruptedCacheException as e: + warnings.append(e) + + return HFCacheInfo( + repos=frozenset(repos), + size_on_disk=sum(repo.size_on_disk for repo in repos), + warnings=warnings, + ) + + +def _scan_cached_repo(repo_path: Path) -> CachedRepoInfo: + """Scan a single cache repo and return information about it. + + Any unexpected behavior will raise a [`~CorruptedCacheException`]. + """ + if not repo_path.is_dir(): + raise CorruptedCacheException(f"Repo path is not a directory: {repo_path}") + + if "--" not in repo_path.name: + raise CorruptedCacheException( + f"Repo path is not a valid HuggingFace cache directory: {repo_path}" + ) + + repo_type, repo_id = repo_path.name.split("--", maxsplit=1) + repo_type = repo_type[:-1] # "models" -> "model" + repo_id = repo_id.replace("--", "/") # google/fleurs -> "google/fleurs" + + if repo_type not in {"dataset", "model", "space"}: + raise CorruptedCacheException( + f"Repo type must be `dataset`, `model` or `space`, found `{repo_type}`" + f" ({repo_path})." + ) + + blob_stats: Dict[Path, os.stat_result] = {} # Key is blob_path, value is blob stats + + snapshots_path = repo_path / "snapshots" + refs_path = repo_path / "refs" + + if not snapshots_path.exists() or not snapshots_path.is_dir(): + raise CorruptedCacheException( + f"Snapshots dir doesn't exist in cached repo: {snapshots_path}" + ) + + # Scan over `refs` directory + + # key is revision hash, value is set of refs + refs_by_hash: Dict[str, Set[str]] = defaultdict(set) + if refs_path.exists(): + # Example of `refs` directory + # ── refs + # ├── main + # └── refs + # └── pr + # └── 1 + if refs_path.is_file(): + raise CorruptedCacheException( + f"Refs directory cannot be a file: {refs_path}" + ) + + for ref_path in refs_path.glob("**/*"): + # glob("**/*") iterates over all files and directories -> skip directories + if ref_path.is_dir(): + continue + + ref_name = str(ref_path.relative_to(refs_path)) + with ref_path.open() as f: + commit_hash = f.read() + + refs_by_hash[commit_hash].add(ref_name) + + # Scan snapshots directory + cached_revisions: Set[CachedRevisionInfo] = set() + for revision_path in snapshots_path.iterdir(): + if revision_path.is_file(): + raise CorruptedCacheException( + f"Snapshots folder corrupted. Found a file: {revision_path}" + ) + + cached_files = set() + for file_path in revision_path.glob("**/*"): + # glob("**/*") iterates over all files and directories -> skip directories + if file_path.is_dir(): + continue + + blob_path = Path(file_path).resolve() + if not blob_path.exists(): + raise CorruptedCacheException( + f"Blob missing (broken symlink): {blob_path}" + ) + + if blob_path not in blob_stats: + blob_stats[blob_path] = blob_path.stat() + + cached_files.add( + CachedFileInfo( + file_name=file_path.name, + file_path=file_path, + size_on_disk=blob_stats[blob_path].st_size, + blob_path=blob_path, + blob_last_accessed=blob_stats[blob_path].st_atime, + blob_last_modified=blob_stats[blob_path].st_mtime, + ) + ) + + # Last modified is either the last modified blob file or the revision folder + # itself if it is empty + if len(cached_files) > 0: + revision_last_modified = max( + blob_stats[file.blob_path].st_mtime for file in cached_files + ) + else: + revision_last_modified = revision_path.stat().st_mtime + + cached_revisions.add( + CachedRevisionInfo( + commit_hash=revision_path.name, + files=frozenset(cached_files), + refs=frozenset(refs_by_hash.pop(revision_path.name, set())), + size_on_disk=sum( + blob_stats[blob_path].st_size + for blob_path in set(file.blob_path for file in cached_files) + ), + snapshot_path=revision_path, + last_modified=revision_last_modified, + ) + ) + + # Check that all refs referred to an existing revision + if len(refs_by_hash) > 0: + raise CorruptedCacheException( + "Reference(s) refer to missing commit hashes:" + f" {dict(refs_by_hash)} ({repo_path})." + ) + + # Last modified is either the last modified blob file or the repo folder itself if + # no blob files has been found. Same for last accessed. + if len(blob_stats) > 0: + repo_last_accessed = max(stat.st_atime for stat in blob_stats.values()) + repo_last_modified = max(stat.st_mtime for stat in blob_stats.values()) + else: + repo_stats = repo_path.stat() + repo_last_accessed = repo_stats.st_atime + repo_last_modified = repo_stats.st_mtime + + # Build and return frozen structure + return CachedRepoInfo( + nb_files=len(blob_stats), + repo_id=repo_id, + repo_path=repo_path, + repo_type=repo_type, # type: ignore + revisions=frozenset(cached_revisions), + size_on_disk=sum(stat.st_size for stat in blob_stats.values()), + last_accessed=repo_last_accessed, + last_modified=repo_last_modified, + ) + + +def _format_size(num: int) -> str: + """Format size in bytes into a human-readable string. + + Taken from https://stackoverflow.com/a/1094933 + """ + num_f = float(num) + for unit in ["", "K", "M", "G", "T", "P", "E", "Z"]: + if abs(num_f) < 1000.0: + return f"{num_f:3.1f}{unit}" + num_f /= 1000.0 + return f"{num_f:.1f}Y" + + +_TIMESINCE_CHUNKS = ( + # Label, divider, max value + ("second", 1, 60), + ("minute", 60, 60), + ("hour", 60 * 60, 24), + ("day", 60 * 60 * 24, 6), + ("week", 60 * 60 * 24 * 7, 6), + ("month", 60 * 60 * 24 * 30, 11), + ("year", 60 * 60 * 24 * 365, None), +) + + +def _format_timesince(ts: float) -> str: + """Format timestamp in seconds into a human-readable string, relative to now. + + Vaguely inspired by Django's `timesince` formatter. + """ + delta = time.time() - ts + if delta < 20: + return "a few seconds ago" + for label, divider, max_value in _TIMESINCE_CHUNKS: # noqa: B007 + value = round(delta / divider) + if max_value is not None and value <= max_value: + break + return f"{value} {label}{'s' if value > 1 else ''} ago" + + +def _try_delete_path(path: Path, path_type: str) -> None: + """Try to delete a local file or folder. + + If the path does not exists, error is logged as a warning and then ignored. + + Args: + path (`Path`) + Path to delete. Can be a file or a folder. + path_type (`str`) + What path are we deleting ? Only for logging purposes. Example: "snapshot". + """ + logger.info(f"Delete {path_type}: {path}") + try: + if path.is_file(): + os.remove(path) + else: + shutil.rmtree(path) + except FileNotFoundError: + logger.warning( + f"Couldn't delete {path_type}: file not found ({path})", exc_info=True + ) + except PermissionError: + logger.warning( + f"Couldn't delete {path_type}: permission denied ({path})", exc_info=True + ) diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/utils/_chunk_utils.py b/.local/lib/python3.10/site-packages/huggingface_hub/utils/_chunk_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..5ff0b8125ece381b1270754669ae8e708c370f61 --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/utils/_chunk_utils.py @@ -0,0 +1,64 @@ +# coding=utf-8 +# Copyright 2022-present, the HuggingFace Inc. team. +# +# 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. +"""Contains a utility to iterate by chunks over an iterator.""" +import itertools +from typing import Iterable, TypeVar + + +T = TypeVar("T") + + +def chunk_iterable(iterable: Iterable[T], chunk_size: int) -> Iterable[Iterable[T]]: + """Iterates over an iterator chunk by chunk. + + Taken from https://stackoverflow.com/a/8998040. + See also https://github.com/huggingface/huggingface_hub/pull/920#discussion_r938793088. + + Args: + iterable (`Iterable`): + The iterable on which we want to iterate. + chunk_size (`int`): + Size of the chunks. Must be a strictly positive integer (e.g. >0). + + Example: + + ```python + >>> from huggingface_hub.utils import chunk_iterable + + >>> for items in chunk_iterable(range(17), chunk_size=8): + ... print(items) + # [0, 1, 2, 3, 4, 5, 6, 7] + # [8, 9, 10, 11, 12, 13, 14, 15] + # [16] # smaller last chunk + ``` + + Raises: + [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) + If `chunk_size` <= 0. + + + The last chunk can be smaller than `chunk_size`. + + """ + if not isinstance(chunk_size, int) or chunk_size <= 0: + raise ValueError("`chunk_size` must be a strictly positive integer (>0).") + + iterator = iter(iterable) + while True: + try: + next_item = next(iterator) + except StopIteration: + return + yield itertools.chain((next_item,), itertools.islice(iterator, chunk_size - 1)) diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/utils/_datetime.py b/.local/lib/python3.10/site-packages/huggingface_hub/utils/_datetime.py new file mode 100644 index 0000000000000000000000000000000000000000..57c3524d08857b37ca4f7e1c4901fd50d5be3404 --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/utils/_datetime.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# Copyright 2022-present, the HuggingFace Inc. team. +# +# 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. +"""Contains utilities to handle datetimes in Huggingface Hub.""" +from datetime import datetime, timedelta, timezone + + +# Local machine offset compared to UTC. +# Taken from https://stackoverflow.com/a/3168394. +# `utcoffset()` returns `None` if no offset -> empty timedelta. +UTC_OFFSET = datetime.now(timezone.utc).astimezone().utcoffset() or timedelta() + + +def parse_datetime(date_string: str) -> datetime: + """ + Parses a date_string returned from the server to a datetime object. + + This parser is a weak-parser is the sense that it handles only a single format of + date_string. It is expected that the server format will never change. The + implementation depends only on the standard lib to avoid an external dependency + (python-dateutil). See full discussion about this decision on PR: + https://github.com/huggingface/huggingface_hub/pull/999. + + Example: + ```py + > parse_datetime('2022-08-19T07:19:38.123Z') + datetime.datetime(2022, 8, 19, 7, 19, 38, 123000, tzinfo=timezone.utc) + ``` + + Args: + date_string (`str`): + A string representing a datetime returned by the Hub server. + String is expected to follow '%Y-%m-%dT%H:%M:%S.%fZ' pattern. + + Returns: + A python datetime object. + + Raises: + :class:`ValueError`: + If `date_string` cannot be parsed. + """ + try: + # Datetime ending with a Z means "UTC". Here we parse the date as local machine + # timezone and then move it to the appropriate UTC timezone. + # See https://en.wikipedia.org/wiki/ISO_8601#Coordinated_Universal_Time_(UTC) + # Taken from https://stackoverflow.com/a/3168394. + + dt = datetime.strptime(date_string, "%Y-%m-%dT%H:%M:%S.%fZ") + dt += UTC_OFFSET # By default, datetime is not timezoned -> move to UTC time + return dt.astimezone(timezone.utc) # Set explicit timezone + except ValueError as e: + raise ValueError( + f"Cannot parse '{date_string}' as a datetime. Date string is expected to" + " follow '%Y-%m-%dT%H:%M:%S.%fZ' pattern." + ) from e diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/utils/_deprecation.py b/.local/lib/python3.10/site-packages/huggingface_hub/utils/_deprecation.py new file mode 100644 index 0000000000000000000000000000000000000000..68a14b11be6d5adb9b294e311e320e16ff28c3d8 --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/utils/_deprecation.py @@ -0,0 +1,233 @@ +import warnings +from functools import wraps +from inspect import Parameter, signature +from typing import Generator, Iterable, Optional + + +def _deprecate_positional_args(*, version: str): + """Decorator for methods that issues warnings for positional arguments. + Using the keyword-only argument syntax in pep 3102, arguments after the + * will issue a warning when passed as a positional argument. + + Args: + version (`str`): + The version when positional arguments will result in error. + """ + + def _inner_deprecate_positional_args(f): + sig = signature(f) + kwonly_args = [] + all_args = [] + for name, param in sig.parameters.items(): + if param.kind == Parameter.POSITIONAL_OR_KEYWORD: + all_args.append(name) + elif param.kind == Parameter.KEYWORD_ONLY: + kwonly_args.append(name) + + @wraps(f) + def inner_f(*args, **kwargs): + extra_args = len(args) - len(all_args) + if extra_args <= 0: + return f(*args, **kwargs) + # extra_args > 0 + args_msg = [ + f"{name}='{arg}'" if isinstance(arg, str) else f"{name}={arg}" + for name, arg in zip(kwonly_args[:extra_args], args[-extra_args:]) + ] + args_msg = ", ".join(args_msg) + warnings.warn( + f"Deprecated positional argument(s) used in '{f.__name__}': pass" + f" {args_msg} as keyword args. From version {version} passing these as" + " positional arguments will result in an error,", + FutureWarning, + ) + kwargs.update(zip(sig.parameters, args)) + return f(**kwargs) + + return inner_f + + return _inner_deprecate_positional_args + + +def _deprecate_arguments( + *, + version: str, + deprecated_args: Iterable[str], + custom_message: Optional[str] = None, +): + """Decorator to issue warnings when using deprecated arguments. + + TODO: could be useful to be able to set a custom error message. + + Args: + version (`str`): + The version when deprecated arguments will result in error. + deprecated_args (`List[str]`): + List of the arguments to be deprecated. + custom_message (`str`, *optional*): + Warning message that is raised. If not passed, a default warning message + will be created. + """ + + def _inner_deprecate_positional_args(f): + sig = signature(f) + + @wraps(f) + def inner_f(*args, **kwargs): + # Check for used deprecated arguments + used_deprecated_args = [] + for _, parameter in zip(args, sig.parameters.values()): + if parameter.name in deprecated_args: + used_deprecated_args.append(parameter.name) + for kwarg_name, kwarg_value in kwargs.items(): + if ( + # If argument is deprecated but still used + kwarg_name in deprecated_args + # And then the value is not the default value + and kwarg_value != sig.parameters[kwarg_name].default + ): + used_deprecated_args.append(kwarg_name) + + # Warn and proceed + if len(used_deprecated_args) > 0: + message = ( + f"Deprecated argument(s) used in '{f.__name__}':" + f" {', '.join(used_deprecated_args)}. Will not be supported from" + f" version '{version}'." + ) + if custom_message is not None: + message += "\n\n" + custom_message + warnings.warn(message, FutureWarning) + return f(*args, **kwargs) + + return inner_f + + return _inner_deprecate_positional_args + + +def _deprecate_method(*, version: str, message: Optional[str] = None): + """Decorator to issue warnings when using a deprecated method. + + Args: + version (`str`): + The version when deprecated arguments will result in error. + message (`str`, *optional*): + Warning message that is raised. If not passed, a default warning message + will be created. + """ + + def _inner_deprecate_method(f): + @wraps(f) + def inner_f(*args, **kwargs): + warning_message = ( + f"'{f.__name__}' (from '{f.__module__}') is deprecated and will be" + f" removed from version '{version}'." + ) + if message is not None: + warning_message += " " + message + warnings.warn(warning_message, FutureWarning) + return f(*args, **kwargs) + + return inner_f + + return _inner_deprecate_method + + +def _deprecate_list_output(*, version: str): + """Decorator to deprecate the usage as a list of the output of a method. + + To be used when a method currently returns a list of objects but is planned to return + an generator instead in the future. Output is still a list but tweaked to issue a + warning message when it is specifically used as a list (e.g. get/set/del item, get + length,...). + + Args: + version (`str`): + The version when output will start to be an generator. + """ + + def _inner_deprecate_method(f): + @wraps(f) + def inner_f(*args, **kwargs): + list_value = f(*args, **kwargs) + return DeprecatedList( + list_value, + warning_message=( + "'{f.__name__}' currently returns a list of objects but is planned" + " to be a generator starting from version {version} in order to" + " implement pagination. Please avoid to use" + " `{f.__name__}(...).{attr_name}` or explicitly convert the output" + " to a list first with `list(iter({f.__name__})(...))`.".format( + f=f, + version=version, + # Dumb but working workaround to render `attr_name` later + # Taken from https://stackoverflow.com/a/35300723 + attr_name="{attr_name}", + ) + ), + ) + + return inner_f + + return _inner_deprecate_method + + +def _empty_gen() -> Generator: + # Create an empty generator + # Taken from https://stackoverflow.com/a/13243870 + return + yield + + +# Build the set of attributes that are specific to a List object (and will be deprecated) +_LIST_ONLY_ATTRS = frozenset(set(dir([])) - set(dir(_empty_gen()))) + + +class DeprecateListMetaclass(type): + """Metaclass that overwrites all list-only methods, including magic ones.""" + + def __new__(cls, clsname, bases, attrs): + # Check consistency + if "_deprecate" not in attrs: + raise TypeError( + "A `_deprecate` method must be implemented to use" + " `DeprecateListMetaclass`." + ) + if list not in bases: + raise TypeError( + "Class must inherit from `list` to use `DeprecateListMetaclass`." + ) + + # Create decorator to deprecate list-only methods, including magic ones + def _with_deprecation(f, name): + @wraps(f) + def _inner(self, *args, **kwargs): + self._deprecate(name) # Use the `_deprecate` + return f(self, *args, **kwargs) + + return _inner + + # Deprecate list-only methods + for attr in _LIST_ONLY_ATTRS: + attrs[attr] = _with_deprecation(getattr(list, attr), attr) + + return super().__new__(cls, clsname, bases, attrs) + + +class DeprecatedList(list, metaclass=DeprecateListMetaclass): + """Custom List class for which all calls to a list-specific method is deprecated. + + Methods that are shared with a generator are not deprecated. + See `_deprecate_list_output` for more details. + """ + + def __init__(self, iterable, warning_message: str): + """Initialize the list with a default warning message. + + Warning message will be formatted at runtime with a "{attr_name}" value. + """ + super().__init__(iterable) + self._deprecation_msg = warning_message + + def _deprecate(self, attr_name: str) -> None: + warnings.warn(self._deprecation_msg.format(attr_name=attr_name), FutureWarning) diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/utils/_errors.py b/.local/lib/python3.10/site-packages/huggingface_hub/utils/_errors.py new file mode 100644 index 0000000000000000000000000000000000000000..3a318dd4cf50ae98b0efdd905d38f1ff293e20df --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/utils/_errors.py @@ -0,0 +1,336 @@ +from typing import Optional + +from requests import HTTPError, Response + +from ._deprecation import _deprecate_method +from ._fixes import JSONDecodeError + + +class HfHubHTTPError(HTTPError): + """ + HTTPError to inherit from for any custom HTTP Error raised in HF Hub. + + Any HTTPError is converted at least into a `HfHubHTTPError`. If some information is + sent back by the server, it will be added to the error message. + + Added details: + - Request id from "X-Request-Id" header if exists. + - Server error message from the header "X-Error-Message". + - Server error message if we can found one in the response body. + + Example: + ```py + import requests + from huggingface_hub.utils import hf_raise_for_status, HfHubHTTPError + + response = requests.post(...) + try: + hf_raise_for_status(response) + except HfHubHTTPError as e: + print(str(e)) # formatted message + e.request_id, e.server_message # details returned by server + + # Complete the error message with additional information once it's raised + e.append_to_message("\n`create_commit` expects the repository to exist.") + raise + ``` + """ + + request_id: Optional[str] = None + server_message: Optional[str] = None + + def __init__(self, message: str, response: Optional[Response]): + # Parse server information if any. + if response is not None: + self.request_id = response.headers.get("X-Request-Id") + try: + server_data = response.json() + except JSONDecodeError: + server_data = {} + + # Retrieve server error message from multiple sources + server_message_from_headers = response.headers.get("X-Error-Message") + server_message_from_body = server_data.get("error") + server_multiple_messages_from_body = "\n".join( + error["message"] + for error in server_data.get("errors", []) + if "message" in error + ) + + # Concatenate error messages + _server_message = "" + if server_message_from_headers is not None: # from headers + _server_message += server_message_from_headers + "\n" + if server_message_from_body is not None: # from body "error" + if server_message_from_body not in _server_message: + _server_message += server_message_from_body + "\n" + if server_multiple_messages_from_body is not None: # from body "errors" + if server_multiple_messages_from_body not in _server_message: + _server_message += server_multiple_messages_from_body + "\n" + _server_message = _server_message.strip() + + # Set message to `HfHubHTTPError` (if any) + if _server_message != "": + self.server_message = _server_message + + super().__init__( + _format_error_message( + message, + request_id=self.request_id, + server_message=self.server_message, + ), + response=response, + ) + + def append_to_message(self, additional_message: str) -> None: + """Append additional information to the `HfHubHTTPError` initial message.""" + self.args = (self.args[0] + additional_message,) + self.args[1:] + + +class RepositoryNotFoundError(HfHubHTTPError): + """ + Raised when trying to access a hf.co URL with an invalid repository name, or + with a private repo name the user does not have access to. + + Example: + + ```py + >>> from huggingface_hub import model_info + >>> model_info("") + (...) + huggingface_hub.utils._errors.RepositoryNotFoundError: 401 Client Error. (Request ID: PvMw_VjBMjVdMz53WKIzP) + + Repository Not Found for url: https://huggingface.co/api/models/%3Cnon_existent_repository%3E. + Please make sure you specified the correct `repo_id` and `repo_type`. + If the repo is private, make sure you are authenticated. + Invalid username or password. + ``` + """ + + +class RevisionNotFoundError(HfHubHTTPError): + """ + Raised when trying to access a hf.co URL with a valid repository but an invalid + revision. + + Example: + + ```py + >>> from huggingface_hub import hf_hub_download + >>> hf_hub_download('bert-base-cased', 'config.json', revision='') + (...) + huggingface_hub.utils._errors.RevisionNotFoundError: 404 Client Error. (Request ID: Mwhe_c3Kt650GcdKEFomX) + + Revision Not Found for url: https://huggingface.co/bert-base-cased/resolve/%3Cnon-existent-revision%3E/config.json. + ``` + """ + + +class EntryNotFoundError(HfHubHTTPError): + """ + Raised when trying to access a hf.co URL with a valid repository and revision + but an invalid filename. + + Example: + + ```py + >>> from huggingface_hub import hf_hub_download + >>> hf_hub_download('bert-base-cased', '') + (...) + huggingface_hub.utils._errors.EntryNotFoundError: 404 Client Error. (Request ID: 53pNl6M0MxsnG5Sw8JA6x) + + Entry Not Found for url: https://huggingface.co/bert-base-cased/resolve/main/%3Cnon-existent-file%3E. + ``` + """ + + +class LocalEntryNotFoundError(EntryNotFoundError, FileNotFoundError, ValueError): + """ + Raised when trying to access a file that is not on the disk when network is + disabled or unavailable (connection issue). The entry may exist on the Hub. + + Note: `ValueError` type is to ensure backward compatibility. + Note: `LocalEntryNotFoundError` derives from `HTTPError` because of `EntryNotFoundError` + even when it is not a network issue. + + Example: + + ```py + >>> from huggingface_hub import hf_hub_download + >>> hf_hub_download('bert-base-cased', '', local_files_only=True) + (...) + huggingface_hub.utils._errors.LocalEntryNotFoundError: Cannot find the requested files in the disk cache and outgoing traffic has been disabled. To enable hf.co look-ups and downloads online, set 'local_files_only' to False. + ``` + """ + + def __init__(self, message: str): + super().__init__(message, response=None) + + +class BadRequestError(HfHubHTTPError, ValueError): + """ + Raised by `hf_raise_for_status` when the server returns a HTTP 400 error. + + Example: + + ```py + >>> resp = requests.post("hf.co/api/check", ...) + >>> hf_raise_for_status(resp, endpoint_name="check") + huggingface_hub.utils._errors.BadRequestError: Bad request for check endpoint: {details} (Request ID: XXX) + ``` + """ + + +def hf_raise_for_status( + response: Response, endpoint_name: Optional[str] = None +) -> None: + """ + Internal version of `response.raise_for_status()` that will refine a + potential HTTPError. Raised exception will be an instance of `HfHubHTTPError`. + + This helper is meant to be the unique method to raise_for_status when making a call + to the Hugging Face Hub. + + Example: + ```py + import requests + from huggingface_hub.utils import hf_raise_for_status, HfHubHTTPError + + response = requests.post(...) + try: + hf_raise_for_status(response) + except HfHubHTTPError as e: + print(str(e)) # formatted message + e.request_id, e.server_message # details returned by server + + # Complete the error message with additional information once it's raised + e.append_to_message("\n`create_commit` expects the repository to exist.") + raise + ``` + + Args: + response (`Response`): + Response from the server. + endpoint_name (`str`, *optional*): + Name of the endpoint that has been called. If provided, the error message + will be more complete. + + + + Raises when the request has failed: + + - [`~utils.RepositoryNotFoundError`] + If the repository to download from cannot be found. This may be because it + doesn't exist, because `repo_type` is not set correctly, or because the repo + is `private` and you do not have access. + - [`~utils.RevisionNotFoundError`] + If the repository exists but the revision couldn't be find. + - [`~utils.EntryNotFoundError`] + If the repository exists but the entry (e.g. the requested file) couldn't be + find. + - [`~utils.BadRequestError`] + If request failed with a HTTP 400 BadRequest error. + - [`~utils.HfHubHTTPError`] + If request failed for a reason not listed above. + + + """ + try: + response.raise_for_status() + except HTTPError as e: + error_code = response.headers.get("X-Error-Code") + + if error_code == "RevisionNotFound": + message = ( + f"{response.status_code} Client Error." + + "\n\n" + + f"Revision Not Found for url: {response.url}." + ) + raise RevisionNotFoundError(message, response) from e + + elif error_code == "EntryNotFound": + message = ( + f"{response.status_code} Client Error." + + "\n\n" + + f"Entry Not Found for url: {response.url}." + ) + raise EntryNotFoundError(message, response) from e + + elif error_code == "RepoNotFound" or response.status_code == 401: + message = ( + f"{response.status_code} Client Error." + + "\n\n" + + f"Repository Not Found for url: {response.url}." + + "\nPlease make sure you specified the correct `repo_id` and" + " `repo_type`." + + "\nIf the repo is private, make sure you are authenticated." + ) + raise RepositoryNotFoundError(message, response) from e + + elif response.status_code == 400: + message = ( + f"\n\nBad request for {endpoint_name} endpoint:" + if endpoint_name is not None + else "\n\nBad request:" + ) + raise BadRequestError(message, response=response) from e + + # Convert `HTTPError` into a `HfHubHTTPError` to display request information + # as well (request id and/or server error message) + raise HfHubHTTPError(str(e), response=response) from e + + +@_deprecate_method(version="0.13", message="Use `hf_raise_for_status` instead.") +def _raise_for_status(response): + """Keep alias for now.""" + hf_raise_for_status(response) + + +@_deprecate_method(version="0.13", message="Use `hf_raise_for_status` instead.") +def _raise_with_request_id(response): + """Keep alias for now.""" + hf_raise_for_status(response) + + +@_deprecate_method(version="0.13", message="Use `hf_raise_for_status` instead.") +def _raise_convert_bad_request(response: Response, endpoint_name: str): + """ + Calls hf_raise_for_status on resp and converts HTTP 400 errors into ValueError. + + Keep alias for now. + """ + hf_raise_for_status(response, endpoint_name=endpoint_name) + + +def _format_error_message( + message: str, request_id: Optional[str], server_message: Optional[str] +) -> str: + """ + Format the `HfHubHTTPError` error message based on initial message and information + returned by the server. + + Used when initializing `HfHubHTTPError`. + """ + # Add message from response body + if ( + server_message is not None + and len(server_message) > 0 + and server_message.lower() not in message.lower() + ): + if "\n\n" in message: + message += "\n" + server_message + else: + message += "\n\n" + server_message + + # Add Request ID + if request_id is not None and str(request_id).lower() not in message.lower(): + request_id_message = f" (Request ID: {request_id})" + if "\n" in message: + newline_index = message.index("\n") + message = ( + message[:newline_index] + request_id_message + message[newline_index:] + ) + else: + message += request_id_message + + return message diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/utils/_fixes.py b/.local/lib/python3.10/site-packages/huggingface_hub/utils/_fixes.py new file mode 100644 index 0000000000000000000000000000000000000000..4eef280ae311c7d6d4500cf42a516aca5d6f22ef --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/utils/_fixes.py @@ -0,0 +1,30 @@ +# JSONDecodeError was introduced in requests=2.27 released in 2022. +# This allows us to support older requests for users +# More information: https://github.com/psf/requests/pull/5856 +try: + from requests import JSONDecodeError # type: ignore # noqa: F401 +except ImportError: + try: + from simplejson import JSONDecodeError # type: ignore # noqa: F401 + except ImportError: + from json import JSONDecodeError # type: ignore # noqa: F401 + +from functools import partial +from typing import Callable + +import yaml + + +# Wrap `yaml.dump` to set `allow_unicode=True` by default. +# +# Example: +# ```py +# >>> yaml.dump({"emoji": "👀", "some unicode": "日本か"}) +# 'emoji: "\\U0001F440"\nsome unicode: "\\u65E5\\u672C\\u304B"\n' +# +# >>> yaml_dump({"emoji": "👀", "some unicode": "日本か"}) +# 'emoji: "👀"\nsome unicode: "日本か"\n' +# ``` +yaml_dump: Callable[..., str] = partial( # type: ignore + yaml.dump, stream=None, allow_unicode=True +) diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/utils/_git_credential.py b/.local/lib/python3.10/site-packages/huggingface_hub/utils/_git_credential.py new file mode 100644 index 0000000000000000000000000000000000000000..1c5239d7ff2372ee841d6d62f7f8227b1a6eea9c --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/utils/_git_credential.py @@ -0,0 +1,186 @@ +# coding=utf-8 +# Copyright 2022-present, the HuggingFace Inc. team. +# +# 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. +"""Contains utilities to manage Git credentials.""" +import subprocess +from typing import List, Optional, Tuple, Union + +from ..constants import ENDPOINT +from ._deprecation import _deprecate_method +from ._subprocess import run_interactive_subprocess, run_subprocess + + +def list_credential_helpers(folder: Optional[str] = None) -> List[str]: + """Return the list of git credential helpers configured. + + See https://git-scm.com/docs/gitcredentials. + + Credentials are saved in all configured helpers (store, cache, macos keychain,...). + Calls "`git credential approve`" internally. See https://git-scm.com/docs/git-credential. + + Args: + folder (`str`, *optional*): + The folder in which to check the configured helpers. + """ + try: + output = run_subprocess("git config --list", folder=folder).stdout + # NOTE: If user has set an helper for a custom URL, it will not we caught here. + # Example: `credential.https://huggingface.co.helper=store` + # See: https://github.com/huggingface/huggingface_hub/pull/1138#discussion_r1013324508 + return sorted( # Sort for nice printing + { # Might have some duplicates + line.split("=")[-1].split()[0] + for line in output.split("\n") + if "credential.helper" in line + } + ) + except subprocess.CalledProcessError as exc: + raise EnvironmentError(exc.stderr) + + +def set_git_credential( + token: str, username: str = "hf_user", folder: Optional[str] = None +) -> None: + """Save a username/token pair in git credential for HF Hub registry. + + Credentials are saved in all configured helpers (store, cache, macos keychain,...). + Calls "`git credential approve`" internally. See https://git-scm.com/docs/git-credential. + + Args: + username (`str`, defaults to `"hf_user"`): + A git username. Defaults to `"hf_user"`, the default user used in the Hub. + token (`str`, defaults to `"hf_user"`): + A git password. In practice, the User Access Token for the Hub. + See https://huggingface.co/settings/tokens. + folder (`str`, *optional*): + The folder in which to check the configured helpers. + """ + with run_interactive_subprocess("git credential approve", folder=folder) as ( + stdin, + _, + ): + stdin.write( + f"url={ENDPOINT}\nusername={username.lower()}\npassword={token}\n\n" + ) + stdin.flush() + + +def unset_git_credential( + username: str = "hf_user", folder: Optional[str] = None +) -> None: + """Erase credentials from git credential for HF Hub registry. + + Credentials are erased from the configured helpers (store, cache, macos + keychain,...), if any. If `username` is not provided, any credential configured for + HF Hub endpoint is erased. + Calls "`git credential erase`" internally. See https://git-scm.com/docs/git-credential. + + Args: + username (`str`, defaults to `"hf_user"`): + A git username. Defaults to `"hf_user"`, the default user used in the Hub. + folder (`str`, *optional*): + The folder in which to check the configured helpers. + """ + with run_interactive_subprocess("git credential reject", folder=folder) as ( + stdin, + _, + ): + standard_input = f"url={ENDPOINT}\n" + if username is not None: + standard_input += f"username={username.lower()}\n" + standard_input += "\n" + + stdin.write(standard_input) + stdin.flush() + + +@_deprecate_method( + version="0.14", + message=( + "Please use `huggingface_hub.set_git_credential` instead as it allows" + " the user to chose which git-credential tool to use." + ), +) +def write_to_credential_store(username: str, password: str) -> None: + with run_interactive_subprocess("git credential-store store") as (stdin, _): + input_username = f"username={username.lower()}" + input_password = f"password={password}" + stdin.write(f"url={ENDPOINT}\n{input_username}\n{input_password}\n\n") + stdin.flush() + + +@_deprecate_method( + version="0.14", + message=( + "Please open an issue on https://github.com/huggingface/huggingface_hub if this" + " a useful feature for you." + ), +) +def read_from_credential_store( + username: Optional[str] = None, +) -> Union[Tuple[str, str], Tuple[None, None]]: + """ + Reads the credential store relative to huggingface.co. + + Args: + username (`str`, *optional*): + A username to filter to search. If not specified, the first entry under + `huggingface.co` endpoint is returned. + + Returns: + `Tuple[str, str]` or `Tuple[None, None]`: either a username/password pair or + None/None if credential has not been found. The returned username is always + lowercase. + """ + with run_interactive_subprocess("git credential-store get") as (stdin, stdout): + standard_input = f"url={ENDPOINT}\n" + if username is not None: + standard_input += f"username={username.lower()}\n" + standard_input += "\n" + + stdin.write(standard_input) + stdin.flush() + output = stdout.read() + + if len(output) == 0: + return None, None + + username, password = [line for line in output.split("\n") if len(line) != 0] + return username.split("=")[1], password.split("=")[1] + + +@_deprecate_method( + version="0.14", + message=( + "Please use `huggingface_hub.unset_git_credential` instead as it allows" + " the user to chose which git-credential tool to use." + ), +) +def erase_from_credential_store(username: Optional[str] = None) -> None: + """ + Erases the credential store relative to huggingface.co. + + Args: + username (`str`, *optional*): + A username to filter to search. If not specified, all entries under + `huggingface.co` endpoint is erased. + """ + with run_interactive_subprocess("git credential-store erase") as (stdin, _): + standard_input = f"url={ENDPOINT}\n" + if username is not None: + standard_input += f"username={username.lower()}\n" + standard_input += "\n" + + stdin.write(standard_input) + stdin.flush() diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/utils/_headers.py b/.local/lib/python3.10/site-packages/huggingface_hub/utils/_headers.py new file mode 100644 index 0000000000000000000000000000000000000000..bb4735abe0614781aa4fe3203ec4a4e79838cd0b --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/utils/_headers.py @@ -0,0 +1,219 @@ +# coding=utf-8 +# Copyright 2022-present, the HuggingFace Inc. team. +# +# 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. +"""Contains utilities to handle headers to send in calls to Huggingface Hub.""" +from typing import Dict, Optional, Union + +from ..constants import HF_HUB_DISABLE_IMPLICIT_TOKEN +from ._hf_folder import HfFolder +from ._runtime import ( + get_fastai_version, + get_fastcore_version, + get_hf_hub_version, + get_python_version, + get_tf_version, + get_torch_version, + is_fastai_available, + is_fastcore_available, + is_tf_available, + is_torch_available, +) +from ._validators import validate_hf_hub_args + + +@validate_hf_hub_args +def build_hf_headers( + *, + token: Optional[Union[bool, str]] = None, + is_write_action: bool = False, + library_name: Optional[str] = None, + library_version: Optional[str] = None, + user_agent: Union[Dict, str, None] = None, +) -> Dict[str, str]: + """ + Build headers dictionary to send in a HF Hub call. + + By default, authorization token is always provided either from argument (explicit + use) or retrieved from the cache (implicit use). To explicitly avoid sending the + token to the Hub, set `token=False` or set the `HF_HUB_DISABLE_IMPLICIT_TOKEN` + environment variable. + + In case of an API call that requires write access, an error is thrown if token is + `None` or token is an organization token (starting with `"api_org***"`). + + In addition to the auth header, a user-agent is added to provide information about + the installed packages (versions of python, huggingface_hub, torch, tensorflow, + fastai and fastcore). + + Args: + token (`str`, `bool`, *optional*): + The token to be sent in authorization header for the Hub call: + - if a string, it is used as the Hugging Face token + - if `True`, the token is read from the machine (cache or env variable) + - if `False`, authorization header is not set + - if `None`, the token is read from the machine only except if + `HF_HUB_DISABLE_IMPLICIT_TOKEN` env variable is set. + is_write_action (`bool`, default to `False`): + Set to True if the API call requires a write access. If `True`, the token + will be validated (cannot be `None`, cannot start by `"api_org***"`). + library_name (`str`, *optional*): + The name of the library that is making the HTTP request. Will be added to + the user-agent header. + library_version (`str`, *optional*): + The version of the library that is making the HTTP request. Will be added + to the user-agent header. + user_agent (`str`, `dict`, *optional*): + The user agent info in the form of a dictionary or a single string. It will + be completed with information about the installed packages. + + Returns: + A `Dict` of headers to pass in your API call. + + Example: + ```py + >>> build_hf_headers(token="hf_***") # explicit token + {"authorization": "Bearer hf_***", "user-agent": ""} + + >>> build_hf_headers(token=True) # explicitly use cached token + {"authorization": "Bearer hf_***",...} + + >>> build_hf_headers(token=False) # explicitly don't use cached token + {"user-agent": ...} + + >>> build_hf_headers() # implicit use of the cached token + {"authorization": "Bearer hf_***",...} + + # HF_HUB_DISABLE_IMPLICIT_TOKEN=True # to set as env variable + >>> build_hf_headers() # token is not sent + {"user-agent": ...} + + >>> build_hf_headers(token="api_org_***", is_write_action=True) + ValueError: You must use your personal account token for write-access methods. + + >>> build_hf_headers(library_name="transformers", library_version="1.2.3") + {"authorization": ..., "user-agent": "transformers/1.2.3; hf_hub/0.10.2; python/3.10.4; tensorflow/1.55"} + ``` + + Raises: + [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) + If organization token is passed and "write" access is required. + [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) + If "write" access is required but token is not passed and not saved locally. + [`EnvironmentError`](https://docs.python.org/3/library/exceptions.html#EnvironmentError) + If `token=True` but token is not saved locally. + """ + # Get auth token to send + token_to_send = get_token_to_send(token) + _validate_token_to_send(token_to_send, is_write_action=is_write_action) + + # Combine headers + headers = { + "user-agent": _http_user_agent( + library_name=library_name, + library_version=library_version, + user_agent=user_agent, + ) + } + if token_to_send is not None: + headers["authorization"] = f"Bearer {token_to_send}" + return headers + + +def get_token_to_send(token: Optional[Union[bool, str]]) -> Optional[str]: + """Select the token to send from either `token` or the cache.""" + # Case token is explicitly provided + if isinstance(token, str): + return token + + # Case token is explicitly forbidden + if token is False: + return None + + # Token is not provided: we get it from local cache + cached_token = HfFolder().get_token() + + # Case token is explicitly required + if token is True: + if cached_token is None: + raise EnvironmentError( + "Token is required (`token=True`), but no token found. You" + " need to provide a token or be logged in to Hugging Face with" + " `huggingface-cli login` or `huggingface_hub.login`. See" + " https://huggingface.co/settings/tokens." + ) + return cached_token + + # Case implicit use of the token is forbidden by env variable + if HF_HUB_DISABLE_IMPLICIT_TOKEN: + return None + + # Otherwise: we use the cached token as the user has not explicitly forbidden it + return cached_token + + +def _validate_token_to_send(token: Optional[str], is_write_action: bool) -> None: + if is_write_action: + if token is None: + raise ValueError( + "Token is required (write-access action) but no token found. You need" + " to provide a token or be logged in to Hugging Face with" + " `huggingface-cli login` or `huggingface_hub.login`. See" + " https://huggingface.co/settings/tokens." + ) + if token.startswith("api_org"): + raise ValueError( + "You must use your personal account token for write-access methods. To" + " generate a write-access token, go to" + " https://huggingface.co/settings/tokens" + ) + + +def _http_user_agent( + *, + library_name: Optional[str] = None, + library_version: Optional[str] = None, + user_agent: Union[Dict, str, None] = None, +) -> str: + """Format a user-agent string containing information about the installed packages. + + Args: + library_name (`str`, *optional*): + The name of the library that is making the HTTP request. + library_version (`str`, *optional*): + The version of the library that is making the HTTP request. + user_agent (`str`, `dict`, *optional*): + The user agent info in the form of a dictionary or a single string. + + Returns: + The formatted user-agent string. + """ + if library_name is not None: + ua = f"{library_name}/{library_version}" + else: + ua = "unknown/None" + ua += f"; hf_hub/{get_hf_hub_version()}" + ua += f"; python/{get_python_version()}" + if is_torch_available(): + ua += f"; torch/{get_torch_version()}" + if is_tf_available(): + ua += f"; tensorflow/{get_tf_version()}" + if is_fastai_available(): + ua += f"; fastai/{get_fastai_version()}" + if is_fastcore_available(): + ua += f"; fastcore/{get_fastcore_version()}" + if isinstance(user_agent, dict): + ua += "; " + "; ".join(f"{k}/{v}" for k, v in user_agent.items()) + elif isinstance(user_agent, str): + ua += "; " + user_agent + return ua diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/utils/_hf_folder.py b/.local/lib/python3.10/site-packages/huggingface_hub/utils/_hf_folder.py new file mode 100644 index 0000000000000000000000000000000000000000..c9182ada0a734bb1d26adb801b5dcfdf63ea3406 --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/utils/_hf_folder.py @@ -0,0 +1,64 @@ +# coding=utf-8 +# Copyright 2022-present, the HuggingFace Inc. team. +# +# 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. +"""Contain helper class to retrieve/store token from/to local cache.""" +import os +from pathlib import Path +from typing import Optional + + +class HfFolder: + path_token = Path("~/.huggingface/token").expanduser() + + @classmethod + def save_token(cls, token: str) -> None: + """ + Save token, creating folder as needed. + + Args: + token (`str`): + The token to save to the [`HfFolder`] + """ + cls.path_token.parent.mkdir(exist_ok=True) + with cls.path_token.open("w+") as f: + f.write(token) + + @classmethod + def get_token(cls) -> Optional[str]: + """ + Get token or None if not existent. + + Note that a token can be also provided using the + `HUGGING_FACE_HUB_TOKEN` environment variable. + + Returns: + `str` or `None`: The token, `None` if it doesn't exist. + """ + token: Optional[str] = os.environ.get("HUGGING_FACE_HUB_TOKEN") + if token is None: + try: + return cls.path_token.read_text() + except FileNotFoundError: + pass + return token + + @classmethod + def delete_token(cls) -> None: + """ + Deletes the token from storage. Does not fail if token does not exist. + """ + try: + cls.path_token.unlink() + except FileNotFoundError: + pass diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/utils/_http.py b/.local/lib/python3.10/site-packages/huggingface_hub/utils/_http.py new file mode 100644 index 0000000000000000000000000000000000000000..24b203162f9f60af68f1f8475091a1a8016ccbf6 --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/utils/_http.py @@ -0,0 +1,155 @@ +# coding=utf-8 +# Copyright 2022-present, the HuggingFace Inc. team. +# +# 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. +"""Contains utilities to handle HTTP requests in Huggingface Hub.""" +import io +import time +from http import HTTPStatus +from typing import Tuple, Type, Union + +import requests +from requests import Response +from requests.exceptions import ConnectTimeout, ProxyError + +from . import logging +from ._typing import HTTP_METHOD_T + + +logger = logging.get_logger(__name__) + + +def http_backoff( + method: HTTP_METHOD_T, + url: str, + *, + max_retries: int = 5, + base_wait_time: float = 1, + max_wait_time: float = 8, + retry_on_exceptions: Union[Type[Exception], Tuple[Type[Exception], ...]] = ( + ConnectTimeout, + ProxyError, + ), + retry_on_status_codes: Union[int, Tuple[int, ...]] = HTTPStatus.SERVICE_UNAVAILABLE, + **kwargs, +) -> Response: + """Wrapper around requests to retry calls on an endpoint, with exponential backoff. + + Endpoint call is retried on exceptions (ex: connection timeout, proxy error,...) + and/or on specific status codes (ex: service unavailable). If the call failed more + than `max_retries`, the exception is thrown or `raise_for_status` is called on the + response object. + + Re-implement mechanisms from the `backoff` library to avoid adding an external + dependencies to `hugging_face_hub`. See https://github.com/litl/backoff. + + Args: + method (`Literal["GET", "OPTIONS", "HEAD", "POST", "PUT", "PATCH", "DELETE"]`): + HTTP method to perform. + url (`str`): + The URL of the resource to fetch. + max_retries (`int`, *optional*, defaults to `5`): + Maximum number of retries, defaults to 5 (no retries). + base_wait_time (`float`, *optional*, defaults to `1`): + Duration (in seconds) to wait before retrying the first time. + Wait time between retries then grows exponentially, capped by + `max_wait_time`. + max_wait_time (`float`, *optional*, defaults to `8`): + Maximum duration (in seconds) to wait before retrying. + retry_on_exceptions (`Type[Exception]` or `Tuple[Type[Exception]]`, *optional*, defaults to `(ConnectTimeout, ProxyError,)`): + Define which exceptions must be caught to retry the request. Can be a single + type or a tuple of types. + By default, retry on `ConnectTimeout` and `ProxyError`. + retry_on_status_codes (`int` or `Tuple[int]`, *optional*, defaults to `503`): + Define on which status codes the request must be retried. By default, only + HTTP 503 Service Unavailable is retried. + **kwargs (`dict`, *optional*): + kwargs to pass to `requests.request`. + + Example: + ``` + >>> from huggingface_hub.utils import http_backoff + + # Same usage as "requests.request". + >>> response = http_backoff("GET", "https://www.google.com") + >>> response.raise_for_status() + + # If you expect a Gateway Timeout from time to time + >>> http_backoff("PUT", upload_url, data=data, retry_on_status_codes=504) + >>> response.raise_for_status() + ``` + + + + When using `requests` it is possible to stream data by passing an iterator to the + `data` argument. On http backoff this is a problem as the iterator is not reset + after a failed call. This issue is mitigated for file objects or any IO streams + by saving the initial position of the cursor (with `data.tell()`) and resetting the + cursor between each call (with `data.seek()`). For arbitrary iterators, http backoff + will fail. If this is a hard constraint for you, please let us know by opening an + issue on [Github](https://github.com/huggingface/huggingface_hub). + + + """ + if isinstance(retry_on_exceptions, type): # Tuple from single exception type + retry_on_exceptions = (retry_on_exceptions,) + + if isinstance(retry_on_status_codes, int): # Tuple from single status code + retry_on_status_codes = (retry_on_status_codes,) + + nb_tries = 0 + sleep_time = base_wait_time + + # If `data` is used and is a file object (or any IO), it will be consumed on the + # first HTTP request. We need to save the initial position so that the full content + # of the file is re-sent on http backoff. See warning tip in docstring. + io_obj_initial_pos = None + if "data" in kwargs and isinstance(kwargs["data"], io.IOBase): + io_obj_initial_pos = kwargs["data"].tell() + + while True: + nb_tries += 1 + try: + # If `data` is used and is a file object (or any IO), set back cursor to + # initial position. + if io_obj_initial_pos is not None: + kwargs["data"].seek(io_obj_initial_pos) + + # Perform request and return if status_code is not in the retry list. + response = requests.request(method=method, url=url, **kwargs) + if response.status_code not in retry_on_status_codes: + return response + + # Wrong status code returned (HTTP 503 for instance) + logger.warning( + f"HTTP Error {response.status_code} thrown while requesting" + f" {method} {url}" + ) + if nb_tries > max_retries: + response.raise_for_status() # Will raise uncaught exception + # We return response to avoid infinite loop in the corner case where the + # user ask for retry on a status code that doesn't raise_for_status. + return response + + except retry_on_exceptions as err: + logger.warning(f"'{err}' thrown while requesting {method} {url}") + + if nb_tries > max_retries: + raise err + + # Sleep for X seconds + logger.warning(f"Retrying in {sleep_time}s [Retry {nb_tries}/{max_retries}].") + time.sleep(sleep_time) + + # Update sleep time for next retry + sleep_time = min(max_wait_time, sleep_time * 2) # Exponential backoff diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/utils/_pagination.py b/.local/lib/python3.10/site-packages/huggingface_hub/utils/_pagination.py new file mode 100644 index 0000000000000000000000000000000000000000..1d4f26301b8ad1cbd5218a756f40a4e1fa8acc61 --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/utils/_pagination.py @@ -0,0 +1,54 @@ +# coding=utf-8 +# Copyright 2022-present, the HuggingFace Inc. team. +# +# 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. +"""Contains utilities to handle pagination on Huggingface Hub.""" +from typing import Dict, Iterable, Optional + +import requests + +from . import hf_raise_for_status, logging + + +logger = logging.get_logger(__name__) + + +def paginate(path: str, params: Dict, headers: Dict) -> Iterable: + """Fetch a list of models/datasets/spaces and paginate through results. + + For now, pagination is not mandatory on the Hub. However at some point the number of + repos per page will be limited for performance reasons. This helper makes `huggingface_hub` + compliant with future server-side updates. + + This is using the same "Link" header format as GitHub. + See: + - https://requests.readthedocs.io/en/latest/api/#requests.Response.links + - https://docs.github.com/en/rest/guides/traversing-with-pagination#link-header + """ + r = requests.get(path, params=params, headers=headers) + hf_raise_for_status(r) + yield from r.json() + + # If pagination is implemented server-side, follow pages + # Next link already contains query params + next_page = _get_next_page(r) + while next_page is not None: + logger.debug(f"Pagination detected. Requesting next page: {next_page}") + r = requests.get(next_page, headers=headers) + hf_raise_for_status(r) + yield from r.json() + next_page = _get_next_page(r) + + +def _get_next_page(response: requests.Response) -> Optional[str]: + return response.links.get("next", {}).get("url") diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/utils/_paths.py b/.local/lib/python3.10/site-packages/huggingface_hub/utils/_paths.py new file mode 100644 index 0000000000000000000000000000000000000000..3a496696cc702c6725b7ad965709981249ce0148 --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/utils/_paths.py @@ -0,0 +1,122 @@ +# coding=utf-8 +# Copyright 2022-present, the HuggingFace Inc. team. +# +# 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. +"""Contains utilities to handle paths in Huggingface Hub.""" +from fnmatch import fnmatch +from pathlib import Path +from typing import Callable, Generator, Iterable, List, Optional, TypeVar, Union + + +T = TypeVar("T") + + +def filter_repo_objects( + items: Iterable[T], + *, + allow_patterns: Optional[Union[List[str], str]] = None, + ignore_patterns: Optional[Union[List[str], str]] = None, + key: Optional[Callable[[T], str]] = None, +) -> Generator[T, None, None]: + """Filter repo objects based on an allowlist and a denylist. + + Input must be a list of paths (`str` or `Path`) or a list of arbitrary objects. + In the later case, `key` must be provided and specifies a function of one argument + that is used to extract a path from each element in iterable. + + Patterns are Unix shell-style wildcards which are NOT regular expressions. See + https://docs.python.org/3/library/fnmatch.html for more details. + + Args: + items (`Iterable`): + List of items to filter. + allow_patterns (`str` or `List[str]`, *optional*): + Patterns constituing the allowlist. If provided, item paths must match at + least one pattern from the allowlist. + ignore_patterns (`str` or `List[str]`, *optional*): + Patterns constituing the denylist. If provided, item paths must not match + any patterns from the denylist. + key (`Callable[[T], str]`, *optional*): + Single-argument function to extract a path from each item. If not provided, + the `items` must already be `str` or `Path`. + + Returns: + Filtered list of objects, as a generator. + + Raises: + :class:`ValueError`: + If `key` is not provided and items are not `str` or `Path`. + + Example usage with paths: + ```python + >>> # Filter only PDFs that are not hidden. + >>> list(filter_repo_objects( + ... ["aaa.PDF", "bbb.jpg", ".ccc.pdf", ".ddd.png"], + ... allow_patterns=["*.pdf"], + ... ignore_patterns=[".*"], + ... )) + ["aaa.pdf"] + ``` + + Example usage with objects: + ```python + >>> list(filter_repo_objects( + ... [ + ... CommitOperationAdd(path_or_fileobj="/tmp/aaa.pdf", path_in_repo="aaa.pdf") + ... CommitOperationAdd(path_or_fileobj="/tmp/bbb.jpg", path_in_repo="bbb.jpg") + ... CommitOperationAdd(path_or_fileobj="/tmp/.ccc.pdf", path_in_repo=".ccc.pdf") + ... CommitOperationAdd(path_or_fileobj="/tmp/.ddd.png", path_in_repo=".ddd.png") + ... ], + ... allow_patterns=["*.pdf"], + ... ignore_patterns=[".*"], + ... key=lambda x: x.repo_in_path + ... )) + [CommitOperationAdd(path_or_fileobj="/tmp/aaa.pdf", path_in_repo="aaa.pdf")] + ``` + """ + if isinstance(allow_patterns, str): + allow_patterns = [allow_patterns] + + if isinstance(ignore_patterns, str): + ignore_patterns = [ignore_patterns] + + if key is None: + + def _identity(item: T) -> str: + if isinstance(item, str): + return item + if isinstance(item, Path): + return str(item) + raise ValueError( + f"Please provide `key` argument in `filter_repo_objects`: `{item}` is" + " not a string." + ) + + key = _identity # Items must be `str` or `Path`, otherwise raise ValueError + + for item in items: + path = key(item) + + # Skip if there's an allowlist and path doesn't match any + if allow_patterns is not None and not any( + fnmatch(path, r) for r in allow_patterns + ): + continue + + # Skip if there's a denylist and path matches any + if ignore_patterns is not None and any( + fnmatch(path, r) for r in ignore_patterns + ): + continue + + yield item diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/utils/_runtime.py b/.local/lib/python3.10/site-packages/huggingface_hub/utils/_runtime.py new file mode 100644 index 0000000000000000000000000000000000000000..f71bcb3f58674766845c22fe55198df884626b03 --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/utils/_runtime.py @@ -0,0 +1,238 @@ +# coding=utf-8 +# Copyright 2022-present, the HuggingFace Inc. team. +# +# 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. +"""Check presence of installed packages at runtime.""" +import platform +import sys +from typing import Any, Dict + +import packaging.version + +from .. import __version__ + + +_PY_VERSION: str = sys.version.split()[0].rstrip("+") + +if packaging.version.Version(_PY_VERSION) < packaging.version.Version("3.8.0"): + import importlib_metadata # type: ignore +else: + import importlib.metadata as importlib_metadata # type: ignore + + +_package_versions = {} + +_CANDIDATES = { + "torch": {"torch"}, + "pydot": {"pydot"}, + "graphviz": {"graphviz"}, + "tensorflow": ( + "tensorflow", + "tensorflow-cpu", + "tensorflow-gpu", + "tf-nightly", + "tf-nightly-cpu", + "tf-nightly-gpu", + "intel-tensorflow", + "intel-tensorflow-avx512", + "tensorflow-rocm", + "tensorflow-macos", + ), + "fastai": {"fastai"}, + "fastcore": {"fastcore"}, + "jinja": {"Jinja2"}, +} + +# Check once at runtime +for candidate_name, package_names in _CANDIDATES.items(): + _package_versions[candidate_name] = "N/A" + for name in package_names: + try: + _package_versions[candidate_name] = importlib_metadata.version(name) + break + except importlib_metadata.PackageNotFoundError: + pass + + +def _get_version(package_name: str) -> str: + return _package_versions.get(package_name, "N/A") + + +def _is_available(package_name: str) -> bool: + return _get_version(package_name) != "N/A" + + +# Python +def get_python_version() -> str: + return _PY_VERSION + + +# Huggingface Hub +def get_hf_hub_version() -> str: + return __version__ + + +# FastAI +def is_fastai_available() -> bool: + return _is_available("fastai") + + +def get_fastai_version() -> str: + return _get_version("fastai") + + +# Fastcore +def is_fastcore_available() -> bool: + return _is_available("fastcore") + + +def get_fastcore_version() -> str: + return _get_version("fastcore") + + +# Graphviz +def is_graphviz_available() -> bool: + return _is_available("graphviz") + + +def get_graphviz_version() -> str: + return _get_version("graphviz") + + +# Jinja +def is_jinja_available() -> bool: + return _is_available("jinja") + + +def get_jinja_version() -> str: + return _get_version("jinja") + + +# Pydot +def is_pydot_available() -> bool: + return _is_available("pydot") + + +def get_pydot_version() -> str: + return _get_version("pydot") + + +# Tensorflow +def is_tf_available() -> bool: + return _is_available("tensorflow") + + +def get_tf_version() -> str: + return _get_version("tensorflow") + + +# Torch +def is_torch_available() -> bool: + return _is_available("torch") + + +def get_torch_version() -> str: + return _get_version("torch") + + +# Shell-related helpers +try: + # Set to `True` if script is running in a Google Colab notebook. + # If running in Google Colab, git credential store is set globally which makes the + # warning disappear. See https://github.com/huggingface/huggingface_hub/issues/1043 + # + # Taken from https://stackoverflow.com/a/63519730. + _is_google_colab = "google.colab" in str(get_ipython()) # type: ignore # noqa: F821 +except NameError: + _is_google_colab = False + + +def is_notebook() -> bool: + """Return `True` if code is executed in a notebook (Jupyter, Colab, QTconsole). + + Taken from https://stackoverflow.com/a/39662359. + Adapted to make it work with Google colab as well. + """ + try: + shell_class = get_ipython().__class__ # type: ignore # noqa: F821 + for parent_class in shell_class.__mro__: # e.g. "is subclass of" + if parent_class.__name__ == "ZMQInteractiveShell": + return True # Jupyter notebook, Google colab or qtconsole + return False + except NameError: + return False # Probably standard Python interpreter + + +def is_google_colab() -> bool: + """Return `True` if code is executed in a Google colab. + + Taken from https://stackoverflow.com/a/63519730. + """ + return _is_google_colab + + +def dump_environment_info() -> Dict[str, Any]: + """Dump information about the machine to help debugging issues. + + Similar helper exist in: + - `datasets` (https://github.com/huggingface/datasets/blob/main/src/datasets/commands/env.py) + - `diffusers` (https://github.com/huggingface/diffusers/blob/main/src/diffusers/commands/env.py) + - `transformers` (https://github.com/huggingface/transformers/blob/main/src/transformers/commands/env.py) + """ + from huggingface_hub import HfFolder, whoami + from huggingface_hub.utils import list_credential_helpers + + token = HfFolder().get_token() + + # Generic machine info + info: Dict[str, Any] = { + "huggingface_hub version": get_hf_hub_version(), + "Platform": platform.platform(), + "Python version": get_python_version(), + } + + # Interpreter info + try: + shell_class = get_ipython().__class__ # type: ignore # noqa: F821 + info["Running in iPython ?"] = "Yes" + info["iPython shell"] = shell_class.__name__ + except NameError: + info["Running in iPython ?"] = "No" + info["Running in notebook ?"] = "Yes" if is_notebook() else "No" + info["Running in Google Colab ?"] = "Yes" if is_google_colab() else "No" + + # Login info + info["Token path ?"] = HfFolder().path_token + info["Has saved token ?"] = token is not None + if token is not None: + try: + info["Who am I ?"] = whoami()["name"] + except Exception: + pass + + try: + info["Configured git credential helpers"] = ", ".join(list_credential_helpers()) + except Exception: + pass + + # Installed dependencies + info["FastAI"] = get_fastai_version() + info["Tensorflow"] = get_tf_version() + info["Torch"] = get_torch_version() + info["Jinja2"] = get_jinja_version() + info["Graphviz"] = get_graphviz_version() + info["Pydot"] = get_pydot_version() + + print("\nCopy-and-paste the text below in your GitHub issue.\n") + print("\n".join([f"- {prop}: {val}" for prop, val in info.items()]) + "\n") + return info diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/utils/_subprocess.py b/.local/lib/python3.10/site-packages/huggingface_hub/utils/_subprocess.py new file mode 100644 index 0000000000000000000000000000000000000000..e3b95d28007864c23510e2c8470d52693b570f25 --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/utils/_subprocess.py @@ -0,0 +1,118 @@ +#!/usr/bin/env python +# coding=utf-8 +# Copyright 2021 The HuggingFace Inc. team. 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 +"""Contains utilities to easily handle subprocesses in `huggingface_hub`.""" +import os +import subprocess +from contextlib import contextmanager +from pathlib import Path +from typing import IO, Generator, List, Optional, Tuple, Union + +from .logging import get_logger + + +logger = get_logger(__name__) + + +def run_subprocess( + command: Union[str, List[str]], + folder: Optional[Union[str, Path]] = None, + check=True, + **kwargs, +) -> subprocess.CompletedProcess: + """ + Method to run subprocesses. Calling this will capture the `stderr` and `stdout`, + please call `subprocess.run` manually in case you would like for them not to + be captured. + + Args: + command (`str` or `List[str]`): + The command to execute as a string or list of strings. + folder (`str`, *optional*): + The folder in which to run the command. Defaults to current working + directory (from `os.getcwd()`). + check (`bool`, *optional*, defaults to `True`): + Setting `check` to `True` will raise a `subprocess.CalledProcessError` + when the subprocess has a non-zero exit code. + kwargs (`Dict[str]`): + Keyword arguments to be passed to the `subprocess.run` underlying command. + + Returns: + `subprocess.CompletedProcess`: The completed process. + """ + if isinstance(command, str): + command = command.split() + + if isinstance(folder, Path): + folder = str(folder) + + return subprocess.run( + command, + stderr=subprocess.PIPE, + stdout=subprocess.PIPE, + check=check, + encoding="utf-8", + cwd=folder or os.getcwd(), + **kwargs, + ) + + +@contextmanager +def run_interactive_subprocess( + command: Union[str, List[str]], + folder: Optional[Union[str, Path]] = None, + **kwargs, +) -> Generator[Tuple[IO[str], IO[str]], None, None]: + """Run a subprocess in an interactive mode in a context manager. + + Args: + command (`str` or `List[str]`): + The command to execute as a string or list of strings. + folder (`str`, *optional*): + The folder in which to run the command. Defaults to current working + directory (from `os.getcwd()`). + kwargs (`Dict[str]`): + Keyword arguments to be passed to the `subprocess.run` underlying command. + + Returns: + `Tuple[IO[str], IO[str]]`: A tuple with `stdin` and `stdout` to interact + with the process (input and output are utf-8 encoded). + + Example: + ```python + with _interactive_subprocess("git credential-store get") as (stdin, stdout): + # Write to stdin + stdin.write("url=hf.co\nusername=obama\n".encode("utf-8")) + stdin.flush() + + # Read from stdout + output = stdout.read().decode("utf-8") + ``` + """ + if isinstance(command, str): + command = command.split() + + with subprocess.Popen( + command, + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + encoding="utf-8", + cwd=folder or os.getcwd(), + **kwargs, + ) as process: + assert process.stdin is not None, "subprocess is opened as subprocess.PIPE" + assert process.stdout is not None, "subprocess is opened as subprocess.PIPE" + yield process.stdin, process.stdout diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/utils/_typing.py b/.local/lib/python3.10/site-packages/huggingface_hub/utils/_typing.py new file mode 100644 index 0000000000000000000000000000000000000000..812c65ea398815c4912d7b53e6e79fd92dbee7d0 --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/utils/_typing.py @@ -0,0 +1,24 @@ +# coding=utf-8 +# Copyright 2022-present, the HuggingFace Inc. team. +# +# 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. +"""Handle typing imports based on system compatibility.""" +import sys + + +if sys.version_info >= (3, 8): + from typing import Literal, TypedDict +else: + from typing_extensions import Literal, TypedDict # noqa: F401 + +HTTP_METHOD_T = Literal["GET", "OPTIONS", "HEAD", "POST", "PUT", "PATCH", "DELETE"] diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py b/.local/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py new file mode 100644 index 0000000000000000000000000000000000000000..a41d67c25cb2a7949cf1b22c64b03ef096715da2 --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py @@ -0,0 +1,240 @@ +# coding=utf-8 +# Copyright 2022-present, the HuggingFace Inc. team. +# +# 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. +"""Contains utilities to validate argument values in `huggingface_hub`.""" +import inspect +import re +import warnings +from functools import wraps +from itertools import chain +from typing import Any, Callable, Dict, TypeVar + + +REPO_ID_REGEX = re.compile( + r""" + ^ + (\b[\w\-.]+\b/)? # optional namespace (username or organization) + \b # starts with a word boundary + [\w\-.]{1,96} # repo_name: alphanumeric + . _ - + \b # ends with a word boundary + $ + """, + flags=re.VERBOSE, +) + + +class HFValidationError(ValueError): + """Generic exception thrown by `huggingface_hub` validators. + + Inherits from [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError). + """ + + +# type hint meaning "function signature not changed by decorator" +CallableT = TypeVar("CallableT", bound=Callable) + + +def validate_hf_hub_args(fn: CallableT) -> CallableT: + """Validate values received as argument for any public method of `huggingface_hub`. + + The goal of this decorator is to harmonize validation of arguments reused + everywhere. By default, all defined validators are tested. + + Validators: + - [`~utils.validate_repo_id`]: `repo_id` must be `"repo_name"` + or `"namespace/repo_name"`. Namespace is a username or an organization. + - [`~utils.smoothly_deprecate_use_auth_token`]: Use `token` instead of + `use_auth_token` (only if `use_auth_token` is not expected by the decorated + function - in practice, always the case in `huggingface_hub`). + + Example: + ```py + >>> from huggingface_hub.utils import validate_hf_hub_args + + >>> @validate_hf_hub_args + ... def my_cool_method(repo_id: str): + ... print(repo_id) + + >>> my_cool_method(repo_id="valid_repo_id") + valid_repo_id + + >>> my_cool_method("other..repo..id") + huggingface_hub.utils._validators.HFValidationError: Cannot have -- or .. in repo_id: 'other..repo..id'. + + >>> my_cool_method(repo_id="other..repo..id") + huggingface_hub.utils._validators.HFValidationError: Cannot have -- or .. in repo_id: 'other..repo..id'. + + >>> @validate_hf_hub_args + ... def my_cool_auth_method(token: str): + ... print(token) + + >>> my_cool_auth_method(token="a token") + "a token" + + >>> my_cool_auth_method(use_auth_token="a use_auth_token") + "a use_auth_token" + + >>> my_cool_auth_method(token="a token", use_auth_token="a use_auth_token") + UserWarning: Both `token` and `use_auth_token` are passed (...) + "a token" + ``` + + Raises: + [`~utils.HFValidationError`]: + If an input is not valid. + """ + # TODO: add an argument to opt-out validation for specific argument? + signature = inspect.signature(fn) + + # Should the validator switch `use_auth_token` values to `token`? In practice, always + # True in `huggingface_hub`. Might not be the case in a downstream library. + check_use_auth_token = ( + "use_auth_token" not in signature.parameters and "token" in signature.parameters + ) + + @wraps(fn) + def _inner_fn(*args, **kwargs): + has_token = False + for arg_name, arg_value in chain( + zip(signature.parameters, args), # Args values + kwargs.items(), # Kwargs values + ): + if arg_name == "repo_id": + validate_repo_id(arg_value) + + elif arg_name == "token" and arg_value is not None: + has_token = True + + if check_use_auth_token: + kwargs = smoothly_deprecate_use_auth_token( + fn_name=fn.__name__, has_token=has_token, kwargs=kwargs + ) + + return fn(*args, **kwargs) + + return _inner_fn # type: ignore + + +def validate_repo_id(repo_id: str) -> None: + """Validate `repo_id` is valid. + + This is not meant to replace the proper validation made on the Hub but rather to + avoid local inconsistencies whenever possible (example: passing `repo_type` in the + `repo_id` is forbidden). + + Rules: + - Between 1 and 96 characters. + - Either "repo_name" or "namespace/repo_name" + - [a-zA-Z0-9] or "-", "_", "." + - "--" and ".." are forbidden + + Valid: `"foo"`, `"foo/bar"`, `"123"`, `"Foo-BAR_foo.bar123"` + + Not valid: `"datasets/foo/bar"`, `".repo_id"`, `"foo--bar"`, `"foo.git"` + + Example: + ```py + >>> from huggingface_hub.utils import validate_repo_id + >>> validate_repo_id(repo_id="valid_repo_id") + >>> validate_repo_id(repo_id="other..repo..id") + huggingface_hub.utils._validators.HFValidationError: Cannot have -- or .. in repo_id: 'other..repo..id'. + ``` + + Discussed in https://github.com/huggingface/huggingface_hub/issues/1008. + In moon-landing (internal repository): + - https://github.com/huggingface/moon-landing/blob/main/server/lib/Names.ts#L27 + - https://github.com/huggingface/moon-landing/blob/main/server/views/components/NewRepoForm/NewRepoForm.svelte#L138 + """ + if not isinstance(repo_id, str): + # Typically, a Path is not a repo_id + raise HFValidationError( + f"Repo id must be a string, not {type(repo_id)}: '{repo_id}'." + ) + + if repo_id.count("/") > 1: + raise HFValidationError( + "Repo id must be in the form 'repo_name' or 'namespace/repo_name':" + f" '{repo_id}'. Use `repo_type` argument if needed." + ) + + if not REPO_ID_REGEX.match(repo_id): + raise HFValidationError( + "Repo id must use alphanumeric chars or '-', '_', '.', '--' and '..' are" + " forbidden, '-' and '.' cannot start or end the name, max length is 96:" + f" '{repo_id}'." + ) + + if "--" in repo_id or ".." in repo_id: + raise HFValidationError(f"Cannot have -- or .. in repo_id: '{repo_id}'.") + + if repo_id.endswith(".git"): + raise HFValidationError(f"Repo_id cannot end by '.git': '{repo_id}'.") + + +def smoothly_deprecate_use_auth_token( + fn_name: str, has_token: bool, kwargs: Dict[str, Any] +) -> Dict[str, Any]: + """Smoothly deprecate `use_auth_token` in the `huggingface_hub` codebase. + + The long-term goal is to remove any mention of `use_auth_token` in the codebase in + favor of a unique and less verbose `token` argument. This will be done a few steps: + + 0. Step 0: methods that require a read-access to the Hub use the `use_auth_token` + argument (`str`, `bool` or `None`). Methods requiring write-access have a `token` + argument (`str`, `None`). This implicit rule exists to be able to not send the + token when not necessary (`use_auth_token=False`) even if logged in. + + 1. Step 1: we want to harmonize everything and use `token` everywhere (supporting + `token=False` for read-only methods). In order not to break existing code, if + `use_auth_token` is passed to a function, the `use_auth_token` value is passed + as `token` instead, without any warning. + a. Corner case: if both `use_auth_token` and `token` values are passed, a warning + is thrown and the `use_auth_token` value is ignored. + + 2. Step 2: Once it is release, we should push downstream libraries to switch from + `use_auth_token` to `token` as much as possible, but without throwing a warning + (e.g. manually create issues on the corresponding repos). + + 3. Step 3: After a transitional period (6 months e.g. until April 2023?), we update + `huggingface_hub` to throw a warning on `use_auth_token`. Hopefully, very few + users will be impacted as it would have already been fixed. + In addition, unit tests in `huggingface_hub` must be adapted to expect warnings + to be thrown (but still use `use_auth_token` as before). + + 4. Step 4: After a normal deprecation cycle (3 releases ?), remove this validator. + `use_auth_token` will definitely not be supported. + In addition, we update unit tests in `huggingface_hub` to use `token` everywhere. + + This has been discussed in: + - https://github.com/huggingface/huggingface_hub/issues/1094. + - https://github.com/huggingface/huggingface_hub/pull/928 + - (related) https://github.com/huggingface/huggingface_hub/pull/1064 + """ + new_kwargs = kwargs.copy() # do not mutate input ! + + use_auth_token = new_kwargs.pop("use_auth_token", None) # remove from kwargs + if use_auth_token is not None: + if has_token: + warnings.warn( + "Both `token` and `use_auth_token` are passed to" + f" `{fn_name}` with non-None values. `token` is now the" + " preferred argument to pass a User Access Token." + " `use_auth_token` value will be ignored." + ) + else: + # `token` argument is not passed and a non-None value is passed in + # `use_auth_token` => use `use_auth_token` value as `token` kwarg. + new_kwargs["token"] = use_auth_token + + return new_kwargs diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/utils/endpoint_helpers.py b/.local/lib/python3.10/site-packages/huggingface_hub/utils/endpoint_helpers.py new file mode 100644 index 0000000000000000000000000000000000000000..57fdfd663c1e6d63f75134b5e6718179d53d2c4e --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/utils/endpoint_helpers.py @@ -0,0 +1,367 @@ +# 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. +""" +Helpful utility functions and classes in relation to exploring API endpoints +with the aim for a user-friendly interface. +""" +import math +import re +from dataclasses import dataclass +from typing import List, Optional, Union + + +def _filter_emissions( + models, + minimum_threshold: Optional[float] = None, + maximum_threshold: Optional[float] = None, +): + """Filters a list of models for those that include an emission tag + and limit them to between two thresholds + + Args: + models (`ModelInfo` or `List`): + A list of `ModelInfo`'s to filter by. + minimum_threshold (`float`, *optional*): + A minimum carbon threshold to filter by, such as 1. + maximum_threshold (`float`, *optional*): + A maximum carbon threshold to filter by, such as 10. + """ + if minimum_threshold is None and maximum_threshold is None: + raise ValueError( + "Both `minimum_threshold` and `maximum_threshold` cannot both be `None`" + ) + if minimum_threshold is None: + minimum_threshold = -1 + if maximum_threshold is None: + maximum_threshold = math.inf + emissions = [] + for i, model in enumerate(models): + if hasattr(model, "cardData"): + if isinstance(model.cardData, dict): + emission = model.cardData.get("co2_eq_emissions", None) + if isinstance(emission, dict): + emission = emission["emissions"] + if emission: + emission = str(emission) + matched = re.search(r"\d+\.\d+|\d+", emission) + if matched is not None: + emissions.append((i, float(matched.group(0)))) + filtered_results = [] + for idx, emission in emissions: + if emission >= minimum_threshold and emission <= maximum_threshold: + filtered_results.append(models[idx]) + return filtered_results + + +@dataclass +class DatasetFilter: + """ + A class that converts human-readable dataset search parameters into ones + compatible with the REST API. For all parameters capitalization does not + matter. + + Args: + author (`str`, *optional*): + A string or list of strings that can be used to identify datasets on + the Hub by the original uploader (author or organization), such as + `facebook` or `huggingface`. + benchmark (`str` or `List`, *optional*): + A string or list of strings that can be used to identify datasets on + the Hub by their official benchmark. + dataset_name (`str`, *optional*): + A string or list of strings that can be used to identify datasets on + the Hub by its name, such as `SQAC` or `wikineural` + language_creators (`str` or `List`, *optional*): + A string or list of strings that can be used to identify datasets on + the Hub with how the data was curated, such as `crowdsourced` or + `machine_generated`. + language (`str` or `List`, *optional*): + A string or list of strings representing a two-character language to + filter datasets by on the Hub. + multilinguality (`str` or `List`, *optional*): + A string or list of strings representing a filter for datasets that + contain multiple languages. + size_categories (`str` or `List`, *optional*): + A string or list of strings that can be used to identify datasets on + the Hub by the size of the dataset such as `100K>> from huggingface_hub import DatasetFilter + + >>> # Using author + >>> new_filter = DatasetFilter(author="facebook") + + >>> # Using benchmark + >>> new_filter = DatasetFilter(benchmark="raft") + + >>> # Using dataset_name + >>> new_filter = DatasetFilter(dataset_name="wikineural") + + >>> # Using language_creator + >>> new_filter = DatasetFilter(language_creator="crowdsourced") + + >>> # Using language + >>> new_filter = DatasetFilter(language="en") + + >>> # Using multilinguality + >>> new_filter = DatasetFilter(multilinguality="multilingual") + + >>> # Using size_categories + >>> new_filter = DatasetFilter(size_categories="100K>> # Using task_categories + >>> new_filter = DatasetFilter(task_categories="audio_classification") + + >>> # Using task_ids + >>> new_filter = DatasetFilter(task_ids="paraphrase") + ``` + """ + + author: Optional[str] = None + benchmark: Optional[Union[str, List[str]]] = None + dataset_name: Optional[str] = None + language_creators: Optional[Union[str, List[str]]] = None + language: Optional[Union[str, List[str]]] = None + multilinguality: Optional[Union[str, List[str]]] = None + size_categories: Optional[Union[str, List[str]]] = None + task_categories: Optional[Union[str, List[str]]] = None + task_ids: Optional[Union[str, List[str]]] = None + + +@dataclass +class ModelFilter: + """ + A class that converts human-readable model search parameters into ones + compatible with the REST API. For all parameters capitalization does not + matter. + + Args: + author (`str`, *optional*): + A string that can be used to identify models on the Hub by the + original uploader (author or organization), such as `facebook` or + `huggingface`. + library (`str` or `List`, *optional*): + A string or list of strings of foundational libraries models were + originally trained from, such as pytorch, tensorflow, or allennlp. + language (`str` or `List`, *optional*): + A string or list of strings of languages, both by name and country + code, such as "en" or "English" + model_name (`str`, *optional*): + A string that contain complete or partial names for models on the + Hub, such as "bert" or "bert-base-cased" + task (`str` or `List`, *optional*): + A string or list of strings of tasks models were designed for, such + as: "fill-mask" or "automatic-speech-recognition" + tags (`str` or `List`, *optional*): + A string tag or a list of tags to filter models on the Hub by, such + as `text-generation` or `spacy`. + trained_dataset (`str` or `List`, *optional*): + A string tag or a list of string tags of the trained dataset for a + model on the Hub. + + + ```python + >>> from huggingface_hub import ModelFilter + + >>> # For the author_or_organization + >>> new_filter = ModelFilter(author_or_organization="facebook") + + >>> # For the library + >>> new_filter = ModelFilter(library="pytorch") + + >>> # For the language + >>> new_filter = ModelFilter(language="french") + + >>> # For the model_name + >>> new_filter = ModelFilter(model_name="bert") + + >>> # For the task + >>> new_filter = ModelFilter(task="text-classification") + + >>> # Retrieving tags using the `HfApi.get_model_tags` method + >>> from huggingface_hub import HfApi + + >>> api = HfApi() + # To list model tags + + >>> api.get_model_tags() + # To list dataset tags + + >>> api.get_dataset_tags() + >>> new_filter = ModelFilter(tags="benchmark:raft") + + >>> # Related to the dataset + >>> new_filter = ModelFilter(trained_dataset="common_voice") + ``` + """ + + author: Optional[str] = None + library: Optional[Union[str, List[str]]] = None + language: Optional[Union[str, List[str]]] = None + model_name: Optional[str] = None + task: Optional[Union[str, List[str]]] = None + trained_dataset: Optional[Union[str, List[str]]] = None + tags: Optional[Union[str, List[str]]] = None + + +class AttributeDictionary(dict): + """ + `dict` subclass that also provides access to keys as attributes + + If a key starts with a number, it will exist in the dictionary but not as an + attribute + + Example: + + ```python + >>> d = AttributeDictionary() + >>> d["test"] = "a" + >>> print(d.test) # prints "a" + ``` + + """ + + def __getattr__(self, k): + if k in self: + return self[k] + else: + raise AttributeError(k) + + def __setattr__(self, k, v): + (self.__setitem__, super().__setattr__)[k[0] == "_"](k, v) + + def __delattr__(self, k): + if k in self: + del self[k] + else: + raise AttributeError(k) + + def __dir__(self): + keys = sorted(self.keys()) + keys = [key for key in keys if key.replace("_", "").isalpha()] + return super().__dir__() + keys + + def __repr__(self): + repr_str = "Available Attributes or Keys:\n" + for key in sorted(self.keys()): + repr_str += f" * {key}" + if not key.replace("_", "").isalpha(): + repr_str += " (Key only)" + repr_str += "\n" + return repr_str + + +class GeneralTags(AttributeDictionary): + """ + A namespace object holding all tags, filtered by `keys` If a tag starts with + a number, it will only exist in the dictionary + + Example: + ```python + >>> a.b["1a"] # will work + >>> a["b"]["1a"] # will work + >>> # a.b.1a # will not work + ``` + + Args: + tag_dictionary (`dict`): + A dictionary of tags returned from the /api/***-tags-by-type api + endpoint + keys (`list`): + A list of keys to unpack the `tag_dictionary` with, such as + `["library","language"]` + """ + + def __init__(self, tag_dictionary: dict, keys: Optional[list] = None): + self._tag_dictionary = tag_dictionary + if keys is None: + keys = list(self._tag_dictionary.keys()) + for key in keys: + self._unpack_and_assign_dictionary(key) + + def _unpack_and_assign_dictionary(self, key: str): + "Assignes nested attributes to `self.key` containing information as an `AttributeDictionary`" + setattr(self, key, AttributeDictionary()) + for item in self._tag_dictionary[key]: + ref = getattr(self, key) + item["label"] = ( + item["label"].replace(" ", "").replace("-", "_").replace(".", "_") + ) + setattr(ref, item["label"], item["id"]) + + +class ModelTags(GeneralTags): + """ + A namespace object holding all available model tags If a tag starts with a + number, it will only exist in the dictionary + + Example: + + ```python + >>> a.dataset["1_5BArabicCorpus"] # will work + >>> a["dataset"]["1_5BArabicCorpus"] # will work + >>> # o.dataset.1_5BArabicCorpus # will not work + ``` + + Args: + model_tag_dictionary (`dict`): + A dictionary of valid model tags, returned from the + /api/models-tags-by-type api endpoint + """ + + def __init__(self, model_tag_dictionary: dict): + keys = ["library", "language", "license", "dataset", "pipeline_tag"] + super().__init__(model_tag_dictionary, keys) + + +class DatasetTags(GeneralTags): + """ + A namespace object holding all available dataset tags If a tag starts with a + number, it will only exist in the dictionary + + Example + + ```python + >>> a.size_categories["100K>> a["size_categories"]["100K>> # o.size_categories.100K str: + return __name__.split(".")[0] + + +def _get_library_root_logger() -> logging.Logger: + return logging.getLogger(_get_library_name()) + + +def _get_default_logging_level(): + """ + If HUGGINGFACE_HUB_VERBOSITY env var is set to one of the valid choices + return that as the new default level. If it is not - fall back to + `_default_log_level` + """ + env_level_str = os.getenv("HUGGINGFACE_HUB_VERBOSITY", None) + if env_level_str: + if env_level_str in log_levels: + return log_levels[env_level_str] + else: + logging.getLogger().warning( + f"Unknown option HUGGINGFACE_HUB_VERBOSITY={env_level_str}, " + f"has to be one of: { ', '.join(log_levels.keys()) }" + ) + return _default_log_level + + +def _configure_library_root_logger() -> None: + library_root_logger = _get_library_root_logger() + library_root_logger.addHandler(logging.StreamHandler()) + library_root_logger.setLevel(_get_default_logging_level()) + + +def _reset_library_root_logger() -> None: + library_root_logger = _get_library_root_logger() + library_root_logger.setLevel(logging.NOTSET) + + +def get_logger(name: Optional[str] = None) -> logging.Logger: + """ + Returns a logger with the specified name. This function is not supposed + to be directly accessed by library users. + + Args: + name (`str`, *optional*): + The name of the logger to get, usually the filename + + Example: + + ```python + >>> from huggingface_hub import get_logger + + >>> logger = get_logger(__file__) + >>> logger.set_verbosity_info() + ``` + """ + + if name is None: + name = _get_library_name() + + return logging.getLogger(name) + + +def get_verbosity() -> int: + """Return the current level for the HuggingFace Hub's root logger. + + Returns: + Logging level, e.g., `huggingface_hub.logging.DEBUG` and + `huggingface_hub.logging.INFO`. + + + + HuggingFace Hub has following logging levels: + + - `huggingface_hub.logging.CRITICAL`, `huggingface_hub.logging.FATAL` + - `huggingface_hub.logging.ERROR` + - `huggingface_hub.logging.WARNING`, `huggingface_hub.logging.WARN` + - `huggingface_hub.logging.INFO` + - `huggingface_hub.logging.DEBUG` + + + """ + return _get_library_root_logger().getEffectiveLevel() + + +def set_verbosity(verbosity: int) -> None: + """ + Sets the level for the HuggingFace Hub's root logger. + + Args: + verbosity (`int`): + Logging level, e.g., `huggingface_hub.logging.DEBUG` and + `huggingface_hub.logging.INFO`. + """ + _get_library_root_logger().setLevel(verbosity) + + +def set_verbosity_info(): + """ + Sets the verbosity to `logging.INFO`. + """ + return set_verbosity(INFO) + + +def set_verbosity_warning(): + """ + Sets the verbosity to `logging.WARNING`. + """ + return set_verbosity(WARNING) + + +def set_verbosity_debug(): + """ + Sets the verbosity to `logging.DEBUG`. + """ + return set_verbosity(DEBUG) + + +def set_verbosity_error(): + """ + Sets the verbosity to `logging.ERROR`. + """ + return set_verbosity(ERROR) + + +def disable_propagation() -> None: + """ + Disable propagation of the library log outputs. Note that log propagation is + disabled by default. + """ + _get_library_root_logger().propagate = False + + +def enable_propagation() -> None: + """ + Enable propagation of the library log outputs. Please disable the + HuggingFace Hub's default handler to prevent double logging if the root + logger has been configured. + """ + _get_library_root_logger().propagate = True + + +_configure_library_root_logger() diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/utils/sha.py b/.local/lib/python3.10/site-packages/huggingface_hub/utils/sha.py new file mode 100644 index 0000000000000000000000000000000000000000..404d2e1b42dacffa660ceb3d7b1f975c89f86db6 --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/utils/sha.py @@ -0,0 +1,37 @@ +"""Utilities to efficiently compute the SHA 256 hash of a bunch of bytes""" + +from functools import partial +from hashlib import sha256 +from typing import BinaryIO, Iterable, Optional + + +def iter_fileobj( + fileobj: BinaryIO, chunk_size: Optional[int] = None +) -> Iterable[bytes]: + """Returns an iterator over the content of ``fileobj`` in chunks of ``chunk_size``""" + chunk_size = chunk_size or -1 + return iter(partial(fileobj.read, chunk_size), b"") + + +def sha_iter(iterable: Iterable[bytes]): + sha = sha256() + for chunk in iterable: + sha.update(chunk) + return sha.digest() + + +def sha_fileobj(fileobj: BinaryIO, chunk_size: Optional[int] = None) -> bytes: + """ + Computes the sha256 hash of the given file object, by chunks of size `chunk_size`. + + Args: + fileobj (file-like object): + The File object to compute sha256 for, typically obtained with `open(path, "rb")` + chunk_size (`int`, *optional*): + The number of bytes to read from `fileobj` at once, defaults to 512 + + Returns: + `bytes`: `fileobj`'s sha256 hash as bytes + """ + chunk_size = chunk_size if chunk_size is not None else 512 + return sha_iter(iter_fileobj(fileobj)) diff --git a/.local/lib/python3.10/site-packages/huggingface_hub/utils/tqdm.py b/.local/lib/python3.10/site-packages/huggingface_hub/utils/tqdm.py new file mode 100644 index 0000000000000000000000000000000000000000..88c1551d424fb7215ec9006d8b29a6af42c28919 --- /dev/null +++ b/.local/lib/python3.10/site-packages/huggingface_hub/utils/tqdm.py @@ -0,0 +1,120 @@ +#!/usr/bin/env python +# coding=utf-8 +# Copyright 2021 The HuggingFace Inc. team. 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 +"""Utility helpers to handle progress bars in `huggingface_hub`. + +Example: + 1. Use `huggingface_hub.utils.tqdm` as you would use `tqdm.tqdm` or `tqdm.auto.tqdm`. + 2. To disable progress bars, either use `disable_progress_bars()` helper or set the + environement variable `HF_HUB_DISABLE_PROGRESS_BARS` to 1. + 3. To re-enable progress bars, use `enable_progress_bars()`. + 4. To check weither progress bars are disabled, use `are_progress_bars_disabled()`. + +NOTE: Environment variable `HF_HUB_DISABLE_PROGRESS_BARS` has the priority. + +Example: + ```py + from huggingface_hub.utils import ( + are_progress_bars_disabled, + disable_progress_bars, + enable_progress_bars, + tqdm, + ) + + # Disable progress bars globally + disable_progress_bars() + + # Use as normal `tqdm` + for _ in tqdm(range(5)): + do_something() + + # Still not showing progress bars, as `disable=False` is overwritten to `True`. + for _ in tqdm(range(5), disable=False): + do_something() + + are_progress_bars_disabled() # True + + # Re-enable progress bars globally + enable_progress_bars() + + # Progress bar will be shown ! + for _ in tqdm(range(5)): + do_something() + ``` +""" +import warnings + +from tqdm.auto import tqdm as old_tqdm + +from ..constants import HF_HUB_DISABLE_PROGRESS_BARS + + +# `HF_HUB_DISABLE_PROGRESS_BARS` is `Optional[bool]` while `_hf_hub_progress_bars_disabled` +# is a `bool`. If `HF_HUB_DISABLE_PROGRESS_BARS` is set to True or False, it has priority. +# If `HF_HUB_DISABLE_PROGRESS_BARS` is None, it means the user have not set the +# environment variable and is free to enable/disable progress bars programmatically. +# TL;DR: env variable has priority over code. +# +# By default, progress bars are enabled. +_hf_hub_progress_bars_disabled: bool = HF_HUB_DISABLE_PROGRESS_BARS or False + + +def disable_progress_bars() -> None: + """ + Disable globally progress bars used in `huggingface_hub` except if + `HF_HUB_DISABLE_PROGRESS_BARS` environement variable has been set. + """ + if HF_HUB_DISABLE_PROGRESS_BARS is False: + warnings.warn( + "Cannot disable progress bars: environment variable" + " `HF_HUB_DISABLE_PROGRESS_BARS=0` is set and has priority." + ) + return + global _hf_hub_progress_bars_disabled + _hf_hub_progress_bars_disabled = True + + +def enable_progress_bars() -> None: + """ + Enable globally progress bars used in `huggingface_hub` except if + `HF_HUB_DISABLE_PROGRESS_BARS` environement variable has been set. + """ + if HF_HUB_DISABLE_PROGRESS_BARS is True: + warnings.warn( + "Cannot enable progress bars: environment variable" + " `HF_HUB_DISABLE_PROGRESS_BARS=1` is set and has priority." + ) + return + global _hf_hub_progress_bars_disabled + _hf_hub_progress_bars_disabled = False + + +def are_progress_bars_disabled() -> bool: + """Return weither progress bars are globally disabled or not.""" + global _hf_hub_progress_bars_disabled + return _hf_hub_progress_bars_disabled + + +class tqdm(old_tqdm): + """ + Class to override `disable` argument in case progress bars are globally disabled. + + Taken from https://github.com/tqdm/tqdm/issues/619#issuecomment-619639324. + """ + + def __init__(self, *args, **kwargs): + if are_progress_bars_disabled(): + kwargs["disable"] = True + super().__init__(*args, **kwargs) diff --git a/.local/lib/python3.10/site-packages/tqdm-4.64.1.dist-info/INSTALLER b/.local/lib/python3.10/site-packages/tqdm-4.64.1.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/.local/lib/python3.10/site-packages/tqdm-4.64.1.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/.local/lib/python3.10/site-packages/tqdm-4.64.1.dist-info/LICENCE b/.local/lib/python3.10/site-packages/tqdm-4.64.1.dist-info/LICENCE new file mode 100644 index 0000000000000000000000000000000000000000..5b3cab7fb59874bed3d4b6a018ebd05f3b40de0d --- /dev/null +++ b/.local/lib/python3.10/site-packages/tqdm-4.64.1.dist-info/LICENCE @@ -0,0 +1,49 @@ +`tqdm` is a product of collaborative work. +Unless otherwise stated, all authors (see commit logs) retain copyright +for their respective work, and release the work under the MIT licence +(text below). + +Exceptions or notable authors are listed below +in reverse chronological order: + +* files: * + MPLv2.0 2015-2021 (c) Casper da Costa-Luis + [casperdcl](https://github.com/casperdcl). +* files: tqdm/_tqdm.py + MIT 2016 (c) [PR #96] on behalf of Google Inc. +* files: tqdm/_tqdm.py setup.py README.rst MANIFEST.in .gitignore + MIT 2013 (c) Noam Yorav-Raphael, original author. + +[PR #96]: https://github.com/tqdm/tqdm/pull/96 + + +Mozilla Public Licence (MPL) v. 2.0 - Exhibit A +----------------------------------------------- + +This Source Code Form is subject to the terms of the +Mozilla Public License, v. 2.0. +If a copy of the MPL was not distributed with this project, +You can obtain one at https://mozilla.org/MPL/2.0/. + + +MIT License (MIT) +----------------- + +Copyright (c) 2013 noamraph + +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/.local/lib/python3.10/site-packages/tqdm-4.64.1.dist-info/METADATA b/.local/lib/python3.10/site-packages/tqdm-4.64.1.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..13ff8f028c2a4142fd11d79a511de560e899d50e --- /dev/null +++ b/.local/lib/python3.10/site-packages/tqdm-4.64.1.dist-info/METADATA @@ -0,0 +1,1589 @@ +Metadata-Version: 2.1 +Name: tqdm +Version: 4.64.1 +Summary: Fast, Extensible Progress Meter +Home-page: https://tqdm.github.io +Maintainer: tqdm developers +Maintainer-email: python.tqdm@gmail.com +License: MPLv2.0, MIT Licences +Project-URL: Changelog, https://tqdm.github.io/releases +Project-URL: Source, https://github.com/tqdm/tqdm +Project-URL: Wiki, https://github.com/tqdm/tqdm/wiki +Keywords: progressbar,progressmeter,progress,bar,meter,rate,eta,console,terminal,time +Platform: any +Classifier: Development Status :: 5 - Production/Stable +Classifier: Environment :: Console +Classifier: Environment :: MacOS X +Classifier: Environment :: Other Environment +Classifier: Environment :: Win32 (MS Windows) +Classifier: Environment :: X11 Applications +Classifier: Framework :: IPython +Classifier: Framework :: Jupyter +Classifier: Intended Audience :: Developers +Classifier: Intended Audience :: Education +Classifier: Intended Audience :: End Users/Desktop +Classifier: Intended Audience :: Other Audience +Classifier: Intended Audience :: System Administrators +Classifier: License :: OSI Approved :: MIT License +Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0) +Classifier: Operating System :: MacOS +Classifier: Operating System :: MacOS :: MacOS X +Classifier: Operating System :: Microsoft +Classifier: Operating System :: Microsoft :: MS-DOS +Classifier: Operating System :: Microsoft :: Windows +Classifier: Operating System :: POSIX +Classifier: Operating System :: POSIX :: BSD +Classifier: Operating System :: POSIX :: BSD :: FreeBSD +Classifier: Operating System :: POSIX :: Linux +Classifier: Operating System :: POSIX :: SunOS/Solaris +Classifier: Operating System :: Unix +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.5 +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: Implementation +Classifier: Programming Language :: Python :: Implementation :: IronPython +Classifier: Programming Language :: Python :: Implementation :: PyPy +Classifier: Programming Language :: Unix Shell +Classifier: Topic :: Desktop Environment +Classifier: Topic :: Education :: Computer Aided Instruction (CAI) +Classifier: Topic :: Education :: Testing +Classifier: Topic :: Office/Business +Classifier: Topic :: Other/Nonlisted Topic +Classifier: Topic :: Software Development :: Build Tools +Classifier: Topic :: Software Development :: Libraries +Classifier: Topic :: Software Development :: Libraries :: Python Modules +Classifier: Topic :: Software Development :: Pre-processors +Classifier: Topic :: Software Development :: User Interfaces +Classifier: Topic :: System :: Installation/Setup +Classifier: Topic :: System :: Logging +Classifier: Topic :: System :: Monitoring +Classifier: Topic :: System :: Shells +Classifier: Topic :: Terminals +Classifier: Topic :: Utilities +Provides: tqdm +Requires-Python: !=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7 +Description-Content-Type: text/x-rst +License-File: LICENCE +Requires-Dist: colorama ; platform_system == "Windows" +Requires-Dist: importlib-resources ; python_version < "3.7" +Provides-Extra: dev +Requires-Dist: py-make (>=0.1.0) ; extra == 'dev' +Requires-Dist: twine ; extra == 'dev' +Requires-Dist: wheel ; extra == 'dev' +Provides-Extra: notebook +Requires-Dist: ipywidgets (>=6) ; extra == 'notebook' +Provides-Extra: slack +Requires-Dist: slack-sdk ; extra == 'slack' +Provides-Extra: telegram +Requires-Dist: requests ; extra == 'telegram' + +|Logo| + +tqdm +==== + +|Py-Versions| |Versions| |Conda-Forge-Status| |Docker| |Snapcraft| + +|Build-Status| |Coverage-Status| |Branch-Coverage-Status| |Codacy-Grade| |Libraries-Rank| |PyPI-Downloads| + +|LICENCE| |OpenHub-Status| |binder-demo| |awesome-python| + +``tqdm`` derives from the Arabic word *taqaddum* (تقدّم) which can mean "progress," +and is an abbreviation for "I love you so much" in Spanish (*te quiero demasiado*). + +Instantly make your loops show a smart progress meter - just wrap any +iterable with ``tqdm(iterable)``, and you're done! + +.. code:: python + + from tqdm import tqdm + for i in tqdm(range(10000)): + ... + +``76%|████████████████████████        | 7568/10000 [00:33<00:10, 229.00it/s]`` + +``trange(N)`` can be also used as a convenient shortcut for +``tqdm(range(N))``. + +|Screenshot| + |Video| |Slides| |Merch| + +It can also be executed as a module with pipes: + +.. code:: sh + + $ seq 9999999 | tqdm --bytes | wc -l + 75.2MB [00:00, 217MB/s] + 9999999 + + $ tar -zcf - docs/ | tqdm --bytes --total `du -sb docs/ | cut -f1` \ + > backup.tgz + 32%|██████████▍ | 8.89G/27.9G [00:42<01:31, 223MB/s] + +Overhead is low -- about 60ns per iteration (80ns with ``tqdm.gui``), and is +unit tested against performance regression. +By comparison, the well-established +`ProgressBar `__ has +an 800ns/iter overhead. + +In addition to its low overhead, ``tqdm`` uses smart algorithms to predict +the remaining time and to skip unnecessary iteration displays, which allows +for a negligible overhead in most cases. + +``tqdm`` works on any platform +(Linux, Windows, Mac, FreeBSD, NetBSD, Solaris/SunOS), +in any console or in a GUI, and is also friendly with IPython/Jupyter notebooks. + +``tqdm`` does not require any dependencies (not even ``curses``!), just +Python and an environment supporting ``carriage return \r`` and +``line feed \n`` control characters. + +------------------------------------------ + +.. contents:: Table of contents + :backlinks: top + :local: + + +Installation +------------ + +Latest PyPI stable release +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +|Versions| |PyPI-Downloads| |Libraries-Dependents| + +.. code:: sh + + pip install tqdm + +Latest development release on GitHub +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +|GitHub-Status| |GitHub-Stars| |GitHub-Commits| |GitHub-Forks| |GitHub-Updated| + +Pull and install pre-release ``devel`` branch: + +.. code:: sh + + pip install "git+https://github.com/tqdm/tqdm.git@devel#egg=tqdm" + +Latest Conda release +~~~~~~~~~~~~~~~~~~~~ + +|Conda-Forge-Status| + +.. code:: sh + + conda install -c conda-forge tqdm + +Latest Snapcraft release +~~~~~~~~~~~~~~~~~~~~~~~~ + +|Snapcraft| + +There are 3 channels to choose from: + +.. code:: sh + + snap install tqdm # implies --stable, i.e. latest tagged release + snap install tqdm --candidate # master branch + snap install tqdm --edge # devel branch + +Note that ``snap`` binaries are purely for CLI use (not ``import``-able), and +automatically set up ``bash`` tab-completion. + +Latest Docker release +~~~~~~~~~~~~~~~~~~~~~ + +|Docker| + +.. code:: sh + + docker pull tqdm/tqdm + docker run -i --rm tqdm/tqdm --help + +Other +~~~~~ + +There are other (unofficial) places where ``tqdm`` may be downloaded, particularly for CLI use: + +|Repology| + +.. |Repology| image:: https://repology.org/badge/tiny-repos/python:tqdm.svg + :target: https://repology.org/project/python:tqdm/versions + +Changelog +--------- + +The list of all changes is available either on GitHub's Releases: +|GitHub-Status|, on the +`wiki `__, or on the +`website `__. + + +Usage +----- + +``tqdm`` is very versatile and can be used in a number of ways. +The three main ones are given below. + +Iterable-based +~~~~~~~~~~~~~~ + +Wrap ``tqdm()`` around any iterable: + +.. code:: python + + from tqdm import tqdm + from time import sleep + + text = "" + for char in tqdm(["a", "b", "c", "d"]): + sleep(0.25) + text = text + char + +``trange(i)`` is a special optimised instance of ``tqdm(range(i))``: + +.. code:: python + + from tqdm import trange + + for i in trange(100): + sleep(0.01) + +Instantiation outside of the loop allows for manual control over ``tqdm()``: + +.. code:: python + + pbar = tqdm(["a", "b", "c", "d"]) + for char in pbar: + sleep(0.25) + pbar.set_description("Processing %s" % char) + +Manual +~~~~~~ + +Manual control of ``tqdm()`` updates using a ``with`` statement: + +.. code:: python + + with tqdm(total=100) as pbar: + for i in range(10): + sleep(0.1) + pbar.update(10) + +If the optional variable ``total`` (or an iterable with ``len()``) is +provided, predictive stats are displayed. + +``with`` is also optional (you can just assign ``tqdm()`` to a variable, +but in this case don't forget to ``del`` or ``close()`` at the end: + +.. code:: python + + pbar = tqdm(total=100) + for i in range(10): + sleep(0.1) + pbar.update(10) + pbar.close() + +Module +~~~~~~ + +Perhaps the most wonderful use of ``tqdm`` is in a script or on the command +line. Simply inserting ``tqdm`` (or ``python -m tqdm``) between pipes will pass +through all ``stdin`` to ``stdout`` while printing progress to ``stderr``. + +The example below demonstrate counting the number of lines in all Python files +in the current directory, with timing information included. + +.. code:: sh + + $ time find . -name '*.py' -type f -exec cat \{} \; | wc -l + 857365 + + real 0m3.458s + user 0m0.274s + sys 0m3.325s + + $ time find . -name '*.py' -type f -exec cat \{} \; | tqdm | wc -l + 857366it [00:03, 246471.31it/s] + 857365 + + real 0m3.585s + user 0m0.862s + sys 0m3.358s + +Note that the usual arguments for ``tqdm`` can also be specified. + +.. code:: sh + + $ find . -name '*.py' -type f -exec cat \{} \; | + tqdm --unit loc --unit_scale --total 857366 >> /dev/null + 100%|█████████████████████████████████| 857K/857K [00:04<00:00, 246Kloc/s] + +Backing up a large directory? + +.. code:: sh + + $ tar -zcf - docs/ | tqdm --bytes --total `du -sb docs/ | cut -f1` \ + > backup.tgz + 44%|██████████████▊ | 153M/352M [00:14<00:18, 11.0MB/s] + +This can be beautified further: + +.. code:: sh + + $ BYTES="$(du -sb docs/ | cut -f1)" + $ tar -cf - docs/ \ + | tqdm --bytes --total "$BYTES" --desc Processing | gzip \ + | tqdm --bytes --total "$BYTES" --desc Compressed --position 1 \ + > ~/backup.tgz + Processing: 100%|██████████████████████| 352M/352M [00:14<00:00, 30.2MB/s] + Compressed: 42%|█████████▎ | 148M/352M [00:14<00:19, 10.9MB/s] + +Or done on a file level using 7-zip: + +.. code:: sh + + $ 7z a -bd -r backup.7z docs/ | grep Compressing \ + | tqdm --total $(find docs/ -type f | wc -l) --unit files \ + | grep -v Compressing + 100%|██████████████████████████▉| 15327/15327 [01:00<00:00, 712.96files/s] + +Pre-existing CLI programs already outputting basic progress information will +benefit from ``tqdm``'s ``--update`` and ``--update_to`` flags: + +.. code:: sh + + $ seq 3 0.1 5 | tqdm --total 5 --update_to --null + 100%|████████████████████████████████████| 5.0/5 [00:00<00:00, 9673.21it/s] + $ seq 10 | tqdm --update --null # 1 + 2 + ... + 10 = 55 iterations + 55it [00:00, 90006.52it/s] + +FAQ and Known Issues +-------------------- + +|GitHub-Issues| + +The most common issues relate to excessive output on multiple lines, instead +of a neat one-line progress bar. + +- Consoles in general: require support for carriage return (``CR``, ``\r``). +- Nested progress bars: + + * Consoles in general: require support for moving cursors up to the + previous line. For example, + `IDLE `__, + `ConEmu `__ and + `PyCharm `__ (also + `here `__, + `here `__, and + `here `__) + lack full support. + * Windows: additionally may require the Python module ``colorama`` + to ensure nested bars stay within their respective lines. + +- Unicode: + + * Environments which report that they support unicode will have solid smooth + progressbars. The fallback is an ``ascii``-only bar. + * Windows consoles often only partially support unicode and thus + `often require explicit ascii=True `__ + (also `here `__). This is due to + either normal-width unicode characters being incorrectly displayed as + "wide", or some unicode characters not rendering. + +- Wrapping generators: + + * Generator wrapper functions tend to hide the length of iterables. + ``tqdm`` does not. + * Replace ``tqdm(enumerate(...))`` with ``enumerate(tqdm(...))`` or + ``tqdm(enumerate(x), total=len(x), ...)``. + The same applies to ``numpy.ndenumerate``. + * Replace ``tqdm(zip(a, b))`` with ``zip(tqdm(a), b)`` or even + ``zip(tqdm(a), tqdm(b))``. + * The same applies to ``itertools``. + * Some useful convenience functions can be found under ``tqdm.contrib``. + +- `Hanging pipes in python2 `__: + when using ``tqdm`` on the CLI, you may need to use Python 3.5+ for correct + buffering. +- `No intermediate output in docker-compose `__: + use ``docker-compose run`` instead of ``docker-compose up`` and ``tty: true``. + +If you come across any other difficulties, browse and file |GitHub-Issues|. + +Documentation +------------- + +|Py-Versions| |README-Hits| (Since 19 May 2016) + +.. code:: python + + class tqdm(): + """ + Decorate an iterable object, returning an iterator which acts exactly + like the original iterable, but prints a dynamically updating + progressbar every time a value is requested. + """ + + def __init__(self, iterable=None, desc=None, total=None, leave=True, + file=None, ncols=None, mininterval=0.1, + maxinterval=10.0, miniters=None, ascii=None, disable=False, + unit='it', unit_scale=False, dynamic_ncols=False, + smoothing=0.3, bar_format=None, initial=0, position=None, + postfix=None, unit_divisor=1000): + +Parameters +~~~~~~~~~~ + +* iterable : iterable, optional + Iterable to decorate with a progressbar. + Leave blank to manually manage the updates. +* desc : str, optional + Prefix for the progressbar. +* total : int or float, optional + The number of expected iterations. If unspecified, + len(iterable) is used if possible. If float("inf") or as a last + resort, only basic progress statistics are displayed + (no ETA, no progressbar). + If ``gui`` is True and this parameter needs subsequent updating, + specify an initial arbitrary large positive number, + e.g. 9e9. +* leave : bool, optional + If [default: True], keeps all traces of the progressbar + upon termination of iteration. + If ``None``, will leave only if ``position`` is ``0``. +* file : ``io.TextIOWrapper`` or ``io.StringIO``, optional + Specifies where to output the progress messages + (default: sys.stderr). Uses ``file.write(str)`` and ``file.flush()`` + methods. For encoding, see ``write_bytes``. +* ncols : int, optional + The width of the entire output message. If specified, + dynamically resizes the progressbar to stay within this bound. + If unspecified, attempts to use environment width. The + fallback is a meter width of 10 and no limit for the counter and + statistics. If 0, will not print any meter (only stats). +* mininterval : float, optional + Minimum progress display update interval [default: 0.1] seconds. +* maxinterval : float, optional + Maximum progress display update interval [default: 10] seconds. + Automatically adjusts ``miniters`` to correspond to ``mininterval`` + after long display update lag. Only works if ``dynamic_miniters`` + or monitor thread is enabled. +* miniters : int or float, optional + Minimum progress display update interval, in iterations. + If 0 and ``dynamic_miniters``, will automatically adjust to equal + ``mininterval`` (more CPU efficient, good for tight loops). + If > 0, will skip display of specified number of iterations. + Tweak this and ``mininterval`` to get very efficient loops. + If your progress is erratic with both fast and slow iterations + (network, skipping items, etc) you should set miniters=1. +* ascii : bool or str, optional + If unspecified or False, use unicode (smooth blocks) to fill + the meter. The fallback is to use ASCII characters " 123456789#". +* disable : bool, optional + Whether to disable the entire progressbar wrapper + [default: False]. If set to None, disable on non-TTY. +* unit : str, optional + String that will be used to define the unit of each iteration + [default: it]. +* unit_scale : bool or int or float, optional + If 1 or True, the number of iterations will be reduced/scaled + automatically and a metric prefix following the + International System of Units standard will be added + (kilo, mega, etc.) [default: False]. If any other non-zero + number, will scale ``total`` and ``n``. +* dynamic_ncols : bool, optional + If set, constantly alters ``ncols`` and ``nrows`` to the + environment (allowing for window resizes) [default: False]. +* smoothing : float, optional + Exponential moving average smoothing factor for speed estimates + (ignored in GUI mode). Ranges from 0 (average speed) to 1 + (current/instantaneous speed) [default: 0.3]. +* bar_format : str, optional + Specify a custom bar string formatting. May impact performance. + [default: '{l_bar}{bar}{r_bar}'], where + l_bar='{desc}: {percentage:3.0f}%|' and + r_bar='| {n_fmt}/{total_fmt} [{elapsed}<{remaining}, ' + '{rate_fmt}{postfix}]' + Possible vars: l_bar, bar, r_bar, n, n_fmt, total, total_fmt, + percentage, elapsed, elapsed_s, ncols, nrows, desc, unit, + rate, rate_fmt, rate_noinv, rate_noinv_fmt, + rate_inv, rate_inv_fmt, postfix, unit_divisor, + remaining, remaining_s, eta. + Note that a trailing ": " is automatically removed after {desc} + if the latter is empty. +* initial : int or float, optional + The initial counter value. Useful when restarting a progress + bar [default: 0]. If using float, consider specifying ``{n:.3f}`` + or similar in ``bar_format``, or specifying ``unit_scale``. +* position : int, optional + Specify the line offset to print this bar (starting from 0) + Automatic if unspecified. + Useful to manage multiple bars at once (eg, from threads). +* postfix : dict or ``*``, optional + Specify additional stats to display at the end of the bar. + Calls ``set_postfix(**postfix)`` if possible (dict). +* unit_divisor : float, optional + [default: 1000], ignored unless ``unit_scale`` is True. +* write_bytes : bool, optional + If (default: None) and ``file`` is unspecified, + bytes will be written in Python 2. If ``True`` will also write + bytes. In all other cases will default to unicode. +* lock_args : tuple, optional + Passed to ``refresh`` for intermediate output + (initialisation, iterating, and updating). +* nrows : int, optional + The screen height. If specified, hides nested bars outside this + bound. If unspecified, attempts to use environment height. + The fallback is 20. +* colour : str, optional + Bar colour (e.g. 'green', '#00ff00'). +* delay : float, optional + Don't display until [default: 0] seconds have elapsed. + +Extra CLI Options +~~~~~~~~~~~~~~~~~ + +* delim : chr, optional + Delimiting character [default: '\n']. Use '\0' for null. + N.B.: on Windows systems, Python converts '\n' to '\r\n'. +* buf_size : int, optional + String buffer size in bytes [default: 256] + used when ``delim`` is specified. +* bytes : bool, optional + If true, will count bytes, ignore ``delim``, and default + ``unit_scale`` to True, ``unit_divisor`` to 1024, and ``unit`` to 'B'. +* tee : bool, optional + If true, passes ``stdin`` to both ``stderr`` and ``stdout``. +* update : bool, optional + If true, will treat input as newly elapsed iterations, + i.e. numbers to pass to ``update()``. Note that this is slow + (~2e5 it/s) since every input must be decoded as a number. +* update_to : bool, optional + If true, will treat input as total elapsed iterations, + i.e. numbers to assign to ``self.n``. Note that this is slow + (~2e5 it/s) since every input must be decoded as a number. +* null : bool, optional + If true, will discard input (no stdout). +* manpath : str, optional + Directory in which to install tqdm man pages. +* comppath : str, optional + Directory in which to place tqdm completion. +* log : str, optional + CRITICAL|FATAL|ERROR|WARN(ING)|[default: 'INFO']|DEBUG|NOTSET. + +Returns +~~~~~~~ + +* out : decorated iterator. + +.. code:: python + + class tqdm(): + def update(self, n=1): + """ + Manually update the progress bar, useful for streams + such as reading files. + E.g.: + >>> t = tqdm(total=filesize) # Initialise + >>> for current_buffer in stream: + ... ... + ... t.update(len(current_buffer)) + >>> t.close() + The last line is highly recommended, but possibly not necessary if + ``t.update()`` will be called in such a way that ``filesize`` will be + exactly reached and printed. + + Parameters + ---------- + n : int or float, optional + Increment to add to the internal counter of iterations + [default: 1]. If using float, consider specifying ``{n:.3f}`` + or similar in ``bar_format``, or specifying ``unit_scale``. + + Returns + ------- + out : bool or None + True if a ``display()`` was triggered. + """ + + def close(self): + """Cleanup and (if leave=False) close the progressbar.""" + + def clear(self, nomove=False): + """Clear current bar display.""" + + def refresh(self): + """ + Force refresh the display of this bar. + + Parameters + ---------- + nolock : bool, optional + If ``True``, does not lock. + If [default: ``False``]: calls ``acquire()`` on internal lock. + lock_args : tuple, optional + Passed to internal lock's ``acquire()``. + If specified, will only ``display()`` if ``acquire()`` returns ``True``. + """ + + def unpause(self): + """Restart tqdm timer from last print time.""" + + def reset(self, total=None): + """ + Resets to 0 iterations for repeated use. + + Consider combining with ``leave=True``. + + Parameters + ---------- + total : int or float, optional. Total to use for the new bar. + """ + + def set_description(self, desc=None, refresh=True): + """ + Set/modify description of the progress bar. + + Parameters + ---------- + desc : str, optional + refresh : bool, optional + Forces refresh [default: True]. + """ + + def set_postfix(self, ordered_dict=None, refresh=True, **tqdm_kwargs): + """ + Set/modify postfix (additional stats) + with automatic formatting based on datatype. + + Parameters + ---------- + ordered_dict : dict or OrderedDict, optional + refresh : bool, optional + Forces refresh [default: True]. + kwargs : dict, optional + """ + + @classmethod + def write(cls, s, file=sys.stdout, end="\n"): + """Print a message via tqdm (without overlap with bars).""" + + @property + def format_dict(self): + """Public API for read-only member access.""" + + def display(self, msg=None, pos=None): + """ + Use ``self.sp`` to display ``msg`` in the specified ``pos``. + + Consider overloading this function when inheriting to use e.g.: + ``self.some_frontend(**self.format_dict)`` instead of ``self.sp``. + + Parameters + ---------- + msg : str, optional. What to display (default: ``repr(self)``). + pos : int, optional. Position to ``moveto`` + (default: ``abs(self.pos)``). + """ + + @classmethod + @contextmanager + def wrapattr(cls, stream, method, total=None, bytes=True, **tqdm_kwargs): + """ + stream : file-like object. + method : str, "read" or "write". The result of ``read()`` and + the first argument of ``write()`` should have a ``len()``. + + >>> with tqdm.wrapattr(file_obj, "read", total=file_obj.size) as fobj: + ... while True: + ... chunk = fobj.read(chunk_size) + ... if not chunk: + ... break + """ + + @classmethod + def pandas(cls, *targs, **tqdm_kwargs): + """Registers the current `tqdm` class with `pandas`.""" + + def trange(*args, **tqdm_kwargs): + """ + A shortcut for `tqdm(xrange(*args), **tqdm_kwargs)`. + On Python3+, `range` is used instead of `xrange`. + """ + +Convenience Functions +~~~~~~~~~~~~~~~~~~~~~ + +.. code:: python + + def tqdm.contrib.tenumerate(iterable, start=0, total=None, + tqdm_class=tqdm.auto.tqdm, **tqdm_kwargs): + """Equivalent of `numpy.ndenumerate` or builtin `enumerate`.""" + + def tqdm.contrib.tzip(iter1, *iter2plus, **tqdm_kwargs): + """Equivalent of builtin `zip`.""" + + def tqdm.contrib.tmap(function, *sequences, **tqdm_kwargs): + """Equivalent of builtin `map`.""" + +Submodules +~~~~~~~~~~ + +.. code:: python + + class tqdm.notebook.tqdm(tqdm.tqdm): + """IPython/Jupyter Notebook widget.""" + + class tqdm.auto.tqdm(tqdm.tqdm): + """Automatically chooses beween `tqdm.notebook` and `tqdm.tqdm`.""" + + class tqdm.asyncio.tqdm(tqdm.tqdm): + """Asynchronous version.""" + @classmethod + def as_completed(cls, fs, *, loop=None, timeout=None, total=None, + **tqdm_kwargs): + """Wrapper for `asyncio.as_completed`.""" + + class tqdm.gui.tqdm(tqdm.tqdm): + """Matplotlib GUI version.""" + + class tqdm.tk.tqdm(tqdm.tqdm): + """Tkinter GUI version.""" + + class tqdm.rich.tqdm(tqdm.tqdm): + """`rich.progress` version.""" + + class tqdm.keras.TqdmCallback(keras.callbacks.Callback): + """Keras callback for epoch and batch progress.""" + + class tqdm.dask.TqdmCallback(dask.callbacks.Callback): + """Dask callback for task progress.""" + + +``contrib`` ++++++++++++ + +The ``tqdm.contrib`` package also contains experimental modules: + +- ``tqdm.contrib.itertools``: Thin wrappers around ``itertools`` +- ``tqdm.contrib.concurrent``: Thin wrappers around ``concurrent.futures`` +- ``tqdm.contrib.slack``: Posts to `Slack `__ bots +- ``tqdm.contrib.discord``: Posts to `Discord `__ bots +- ``tqdm.contrib.telegram``: Posts to `Telegram `__ bots +- ``tqdm.contrib.bells``: Automagically enables all optional features + + * ``auto``, ``pandas``, ``slack``, ``discord``, ``telegram`` + +Examples and Advanced Usage +--------------------------- + +- See the `examples `__ + folder; +- import the module and run ``help()``; +- consult the `wiki `__; + + * this has an + `excellent article `__ + on how to make a **great** progressbar; + +- check out the `slides from PyData London `__, or +- run the |binder-demo|. + +Description and additional stats +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Custom information can be displayed and updated dynamically on ``tqdm`` bars +with the ``desc`` and ``postfix`` arguments: + +.. code:: python + + from tqdm import tqdm, trange + from random import random, randint + from time import sleep + + with trange(10) as t: + for i in t: + # Description will be displayed on the left + t.set_description('GEN %i' % i) + # Postfix will be displayed on the right, + # formatted automatically based on argument's datatype + t.set_postfix(loss=random(), gen=randint(1,999), str='h', + lst=[1, 2]) + sleep(0.1) + + with tqdm(total=10, bar_format="{postfix[0]} {postfix[1][value]:>8.2g}", + postfix=["Batch", dict(value=0)]) as t: + for i in range(10): + sleep(0.1) + t.postfix[1]["value"] = i / 2 + t.update() + +Points to remember when using ``{postfix[...]}`` in the ``bar_format`` string: + +- ``postfix`` also needs to be passed as an initial argument in a compatible + format, and +- ``postfix`` will be auto-converted to a string if it is a ``dict``-like + object. To prevent this behaviour, insert an extra item into the dictionary + where the key is not a string. + +Additional ``bar_format`` parameters may also be defined by overriding +``format_dict``, and the bar itself may be modified using ``ascii``: + +.. code:: python + + from tqdm import tqdm + class TqdmExtraFormat(tqdm): + """Provides a `total_time` format parameter""" + @property + def format_dict(self): + d = super(TqdmExtraFormat, self).format_dict + total_time = d["elapsed"] * (d["total"] or 0) / max(d["n"], 1) + d.update(total_time=self.format_interval(total_time) + " in total") + return d + + for i in TqdmExtraFormat( + range(9), ascii=" .oO0", + bar_format="{total_time}: {percentage:.0f}%|{bar}{r_bar}"): + if i == 4: + break + +.. code:: + + 00:00 in total: 44%|0000. | 4/9 [00:00<00:00, 962.93it/s] + +Note that ``{bar}`` also supports a format specifier ``[width][type]``. + +- ``width`` + + * unspecified (default): automatic to fill ``ncols`` + * ``int >= 0``: fixed width overriding ``ncols`` logic + * ``int < 0``: subtract from the automatic default + +- ``type`` + + * ``a``: ascii (``ascii=True`` override) + * ``u``: unicode (``ascii=False`` override) + * ``b``: blank (``ascii=" "`` override) + +This means a fixed bar with right-justified text may be created by using: +``bar_format="{l_bar}{bar:10}|{bar:-10b}right-justified"`` + +Nested progress bars +~~~~~~~~~~~~~~~~~~~~ + +``tqdm`` supports nested progress bars. Here's an example: + +.. code:: python + + from tqdm.auto import trange + from time import sleep + + for i in trange(4, desc='1st loop'): + for j in trange(5, desc='2nd loop'): + for k in trange(50, desc='3rd loop', leave=False): + sleep(0.01) + +For manual control over positioning (e.g. for multi-processing use), +you may specify ``position=n`` where ``n=0`` for the outermost bar, +``n=1`` for the next, and so on. +However, it's best to check if ``tqdm`` can work without manual ``position`` +first. + +.. code:: python + + from time import sleep + from tqdm import trange, tqdm + from multiprocessing import Pool, RLock, freeze_support + + L = list(range(9)) + + def progresser(n): + interval = 0.001 / (n + 2) + total = 5000 + text = "#{}, est. {:<04.2}s".format(n, interval * total) + for _ in trange(total, desc=text, position=n): + sleep(interval) + + if __name__ == '__main__': + freeze_support() # for Windows support + tqdm.set_lock(RLock()) # for managing output contention + p = Pool(initializer=tqdm.set_lock, initargs=(tqdm.get_lock(),)) + p.map(progresser, L) + +Note that in Python 3, ``tqdm.write`` is thread-safe: + +.. code:: python + + from time import sleep + from tqdm import tqdm, trange + from concurrent.futures import ThreadPoolExecutor + + L = list(range(9)) + + def progresser(n): + interval = 0.001 / (n + 2) + total = 5000 + text = "#{}, est. {:<04.2}s".format(n, interval * total) + for _ in trange(total, desc=text): + sleep(interval) + if n == 6: + tqdm.write("n == 6 completed.") + tqdm.write("`tqdm.write()` is thread-safe in py3!") + + if __name__ == '__main__': + with ThreadPoolExecutor() as p: + p.map(progresser, L) + +Hooks and callbacks +~~~~~~~~~~~~~~~~~~~ + +``tqdm`` can easily support callbacks/hooks and manual updates. +Here's an example with ``urllib``: + +**``urllib.urlretrieve`` documentation** + + | [...] + | If present, the hook function will be called once + | on establishment of the network connection and once after each block read + | thereafter. The hook will be passed three arguments; a count of blocks + | transferred so far, a block size in bytes, and the total size of the file. + | [...] + +.. code:: python + + import urllib, os + from tqdm import tqdm + urllib = getattr(urllib, 'request', urllib) + + class TqdmUpTo(tqdm): + """Provides `update_to(n)` which uses `tqdm.update(delta_n)`.""" + def update_to(self, b=1, bsize=1, tsize=None): + """ + b : int, optional + Number of blocks transferred so far [default: 1]. + bsize : int, optional + Size of each block (in tqdm units) [default: 1]. + tsize : int, optional + Total size (in tqdm units). If [default: None] remains unchanged. + """ + if tsize is not None: + self.total = tsize + return self.update(b * bsize - self.n) # also sets self.n = b * bsize + + eg_link = "https://caspersci.uk.to/matryoshka.zip" + with TqdmUpTo(unit='B', unit_scale=True, unit_divisor=1024, miniters=1, + desc=eg_link.split('/')[-1]) as t: # all optional kwargs + urllib.urlretrieve(eg_link, filename=os.devnull, + reporthook=t.update_to, data=None) + t.total = t.n + +Inspired by `twine#242 `__. +Functional alternative in +`examples/tqdm_wget.py `__. + +It is recommend to use ``miniters=1`` whenever there is potentially +large differences in iteration speed (e.g. downloading a file over +a patchy connection). + +**Wrapping read/write methods** + +To measure throughput through a file-like object's ``read`` or ``write`` +methods, use ``CallbackIOWrapper``: + +.. code:: python + + from tqdm.auto import tqdm + from tqdm.utils import CallbackIOWrapper + + with tqdm(total=file_obj.size, + unit='B', unit_scale=True, unit_divisor=1024) as t: + fobj = CallbackIOWrapper(t.update, file_obj, "read") + while True: + chunk = fobj.read(chunk_size) + if not chunk: + break + t.reset() + # ... continue to use `t` for something else + +Alternatively, use the even simpler ``wrapattr`` convenience function, +which would condense both the ``urllib`` and ``CallbackIOWrapper`` examples +down to: + +.. code:: python + + import urllib, os + from tqdm import tqdm + + eg_link = "https://caspersci.uk.to/matryoshka.zip" + response = getattr(urllib, 'request', urllib).urlopen(eg_link) + with tqdm.wrapattr(open(os.devnull, "wb"), "write", + miniters=1, desc=eg_link.split('/')[-1], + total=getattr(response, 'length', None)) as fout: + for chunk in response: + fout.write(chunk) + +The ``requests`` equivalent is nearly identical: + +.. code:: python + + import requests, os + from tqdm import tqdm + + eg_link = "https://caspersci.uk.to/matryoshka.zip" + response = requests.get(eg_link, stream=True) + with tqdm.wrapattr(open(os.devnull, "wb"), "write", + miniters=1, desc=eg_link.split('/')[-1], + total=int(response.headers.get('content-length', 0))) as fout: + for chunk in response.iter_content(chunk_size=4096): + fout.write(chunk) + +**Custom callback** + +``tqdm`` is known for intelligently skipping unnecessary displays. To make a +custom callback take advantage of this, simply use the return value of +``update()``. This is set to ``True`` if a ``display()`` was triggered. + +.. code:: python + + from tqdm.auto import tqdm as std_tqdm + + def external_callback(*args, **kwargs): + ... + + class TqdmExt(std_tqdm): + def update(self, n=1): + displayed = super(TqdmExt, self).update(n) + if displayed: + external_callback(**self.format_dict) + return displayed + +``asyncio`` +~~~~~~~~~~~ + +Note that ``break`` isn't currently caught by asynchronous iterators. +This means that ``tqdm`` cannot clean up after itself in this case: + +.. code:: python + + from tqdm.asyncio import tqdm + + async for i in tqdm(range(9)): + if i == 2: + break + +Instead, either call ``pbar.close()`` manually or use the context manager syntax: + +.. code:: python + + from tqdm.asyncio import tqdm + + with tqdm(range(9)) as pbar: + async for i in pbar: + if i == 2: + break + +Pandas Integration +~~~~~~~~~~~~~~~~~~ + +Due to popular demand we've added support for ``pandas`` -- here's an example +for ``DataFrame.progress_apply`` and ``DataFrameGroupBy.progress_apply``: + +.. code:: python + + import pandas as pd + import numpy as np + from tqdm import tqdm + + df = pd.DataFrame(np.random.randint(0, 100, (100000, 6))) + + # Register `pandas.progress_apply` and `pandas.Series.map_apply` with `tqdm` + # (can use `tqdm.gui.tqdm`, `tqdm.notebook.tqdm`, optional kwargs, etc.) + tqdm.pandas(desc="my bar!") + + # Now you can use `progress_apply` instead of `apply` + # and `progress_map` instead of `map` + df.progress_apply(lambda x: x**2) + # can also groupby: + # df.groupby(0).progress_apply(lambda x: x**2) + +In case you're interested in how this works (and how to modify it for your +own callbacks), see the +`examples `__ +folder or import the module and run ``help()``. + +Keras Integration +~~~~~~~~~~~~~~~~~ + +A ``keras`` callback is also available: + +.. code:: python + + from tqdm.keras import TqdmCallback + + ... + + model.fit(..., verbose=0, callbacks=[TqdmCallback()]) + +Dask Integration +~~~~~~~~~~~~~~~~ + +A ``dask`` callback is also available: + +.. code:: python + + from tqdm.dask import TqdmCallback + + with TqdmCallback(desc="compute"): + ... + arr.compute() + + # or use callback globally + cb = TqdmCallback(desc="global") + cb.register() + arr.compute() + +IPython/Jupyter Integration +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +IPython/Jupyter is supported via the ``tqdm.notebook`` submodule: + +.. code:: python + + from tqdm.notebook import trange, tqdm + from time import sleep + + for i in trange(3, desc='1st loop'): + for j in tqdm(range(100), desc='2nd loop'): + sleep(0.01) + +In addition to ``tqdm`` features, the submodule provides a native Jupyter +widget (compatible with IPython v1-v4 and Jupyter), fully working nested bars +and colour hints (blue: normal, green: completed, red: error/interrupt, +light blue: no ETA); as demonstrated below. + +|Screenshot-Jupyter1| +|Screenshot-Jupyter2| +|Screenshot-Jupyter3| + +The ``notebook`` version supports percentage or pixels for overall width +(e.g.: ``ncols='100%'`` or ``ncols='480px'``). + +It is also possible to let ``tqdm`` automatically choose between +console or notebook versions by using the ``autonotebook`` submodule: + +.. code:: python + + from tqdm.autonotebook import tqdm + tqdm.pandas() + +Note that this will issue a ``TqdmExperimentalWarning`` if run in a notebook +since it is not meant to be possible to distinguish between ``jupyter notebook`` +and ``jupyter console``. Use ``auto`` instead of ``autonotebook`` to suppress +this warning. + +Note that notebooks will display the bar in the cell where it was created. +This may be a different cell from the one where it is used. +If this is not desired, either + +- delay the creation of the bar to the cell where it must be displayed, or +- create the bar with ``display=False``, and in a later cell call + ``display(bar.container)``: + +.. code:: python + + from tqdm.notebook import tqdm + pbar = tqdm(..., display=False) + +.. code:: python + + # different cell + display(pbar.container) + +The ``keras`` callback has a ``display()`` method which can be used likewise: + +.. code:: python + + from tqdm.keras import TqdmCallback + cbk = TqdmCallback(display=False) + +.. code:: python + + # different cell + cbk.display() + model.fit(..., verbose=0, callbacks=[cbk]) + +Another possibility is to have a single bar (near the top of the notebook) +which is constantly re-used (using ``reset()`` rather than ``close()``). +For this reason, the notebook version (unlike the CLI version) does not +automatically call ``close()`` upon ``Exception``. + +.. code:: python + + from tqdm.notebook import tqdm + pbar = tqdm() + +.. code:: python + + # different cell + iterable = range(100) + pbar.reset(total=len(iterable)) # initialise with new `total` + for i in iterable: + pbar.update() + pbar.refresh() # force print final status but don't `close()` + +Custom Integration +~~~~~~~~~~~~~~~~~~ + +To change the default arguments (such as making ``dynamic_ncols=True``), +simply use built-in Python magic: + +.. code:: python + + from functools import partial + from tqdm import tqdm as std_tqdm + tqdm = partial(std_tqdm, dynamic_ncols=True) + +For further customisation, +``tqdm`` may be inherited from to create custom callbacks (as with the +``TqdmUpTo`` example `above <#hooks-and-callbacks>`__) or for custom frontends +(e.g. GUIs such as notebook or plotting packages). In the latter case: + +1. ``def __init__()`` to call ``super().__init__(..., gui=True)`` to disable + terminal ``status_printer`` creation. +2. Redefine: ``close()``, ``clear()``, ``display()``. + +Consider overloading ``display()`` to use e.g. +``self.frontend(**self.format_dict)`` instead of ``self.sp(repr(self))``. + +Some submodule examples of inheritance: + +- `tqdm/notebook.py `__ +- `tqdm/gui.py `__ +- `tqdm/tk.py `__ +- `tqdm/contrib/slack.py `__ +- `tqdm/contrib/discord.py `__ +- `tqdm/contrib/telegram.py `__ + +Dynamic Monitor/Meter +~~~~~~~~~~~~~~~~~~~~~ + +You can use a ``tqdm`` as a meter which is not monotonically increasing. +This could be because ``n`` decreases (e.g. a CPU usage monitor) or ``total`` +changes. + +One example would be recursively searching for files. The ``total`` is the +number of objects found so far, while ``n`` is the number of those objects which +are files (rather than folders): + +.. code:: python + + from tqdm import tqdm + import os.path + + def find_files_recursively(path, show_progress=True): + files = [] + # total=1 assumes `path` is a file + t = tqdm(total=1, unit="file", disable=not show_progress) + if not os.path.exists(path): + raise IOError("Cannot find:" + path) + + def append_found_file(f): + files.append(f) + t.update() + + def list_found_dir(path): + """returns os.listdir(path) assuming os.path.isdir(path)""" + listing = os.listdir(path) + # subtract 1 since a "file" we found was actually this directory + t.total += len(listing) - 1 + # fancy way to give info without forcing a refresh + t.set_postfix(dir=path[-10:], refresh=False) + t.update(0) # may trigger a refresh + return listing + + def recursively_search(path): + if os.path.isdir(path): + for f in list_found_dir(path): + recursively_search(os.path.join(path, f)) + else: + append_found_file(path) + + recursively_search(path) + t.set_postfix(dir=path) + t.close() + return files + +Using ``update(0)`` is a handy way to let ``tqdm`` decide when to trigger a +display refresh to avoid console spamming. + +Writing messages +~~~~~~~~~~~~~~~~ + +This is a work in progress (see +`#737 `__). + +Since ``tqdm`` uses a simple printing mechanism to display progress bars, +you should not write any message in the terminal using ``print()`` while +a progressbar is open. + +To write messages in the terminal without any collision with ``tqdm`` bar +display, a ``.write()`` method is provided: + +.. code:: python + + from tqdm.auto import tqdm, trange + from time import sleep + + bar = trange(10) + for i in bar: + # Print using tqdm class method .write() + sleep(0.1) + if not (i % 3): + tqdm.write("Done task %i" % i) + # Can also use bar.write() + +By default, this will print to standard output ``sys.stdout``. but you can +specify any file-like object using the ``file`` argument. For example, this +can be used to redirect the messages writing to a log file or class. + +Redirecting writing +~~~~~~~~~~~~~~~~~~~ + +If using a library that can print messages to the console, editing the library +by replacing ``print()`` with ``tqdm.write()`` may not be desirable. +In that case, redirecting ``sys.stdout`` to ``tqdm.write()`` is an option. + +To redirect ``sys.stdout``, create a file-like class that will write +any input string to ``tqdm.write()``, and supply the arguments +``file=sys.stdout, dynamic_ncols=True``. + +A reusable canonical example is given below: + +.. code:: python + + from time import sleep + import contextlib + import sys + from tqdm import tqdm + from tqdm.contrib import DummyTqdmFile + + + @contextlib.contextmanager + def std_out_err_redirect_tqdm(): + orig_out_err = sys.stdout, sys.stderr + try: + sys.stdout, sys.stderr = map(DummyTqdmFile, orig_out_err) + yield orig_out_err[0] + # Relay exceptions + except Exception as exc: + raise exc + # Always restore sys.stdout/err if necessary + finally: + sys.stdout, sys.stderr = orig_out_err + + def some_fun(i): + print("Fee, fi, fo,".split()[i]) + + # Redirect stdout to tqdm.write() (don't forget the `as save_stdout`) + with std_out_err_redirect_tqdm() as orig_stdout: + # tqdm needs the original stdout + # and dynamic_ncols=True to autodetect console width + for i in tqdm(range(3), file=orig_stdout, dynamic_ncols=True): + sleep(.5) + some_fun(i) + + # After the `with`, printing is restored + print("Done!") + +Redirecting ``logging`` +~~~~~~~~~~~~~~~~~~~~~~~ + +Similar to ``sys.stdout``/``sys.stderr`` as detailed above, console ``logging`` +may also be redirected to ``tqdm.write()``. + +Warning: if also redirecting ``sys.stdout``/``sys.stderr``, make sure to +redirect ``logging`` first if needed. + +Helper methods are available in ``tqdm.contrib.logging``. For example: + +.. code:: python + + import logging + from tqdm import trange + from tqdm.contrib.logging import logging_redirect_tqdm + + LOG = logging.getLogger(__name__) + + if __name__ == '__main__': + logging.basicConfig(level=logging.INFO) + with logging_redirect_tqdm(): + for i in trange(9): + if i == 4: + LOG.info("console logging redirected to `tqdm.write()`") + # logging restored + +Monitoring thread, intervals and miniters +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +``tqdm`` implements a few tricks to increase efficiency and reduce overhead. + +- Avoid unnecessary frequent bar refreshing: ``mininterval`` defines how long + to wait between each refresh. ``tqdm`` always gets updated in the background, + but it will display only every ``mininterval``. +- Reduce number of calls to check system clock/time. +- ``mininterval`` is more intuitive to configure than ``miniters``. + A clever adjustment system ``dynamic_miniters`` will automatically adjust + ``miniters`` to the amount of iterations that fit into time ``mininterval``. + Essentially, ``tqdm`` will check if it's time to print without actually + checking time. This behaviour can be still be bypassed by manually setting + ``miniters``. + +However, consider a case with a combination of fast and slow iterations. +After a few fast iterations, ``dynamic_miniters`` will set ``miniters`` to a +large number. When iteration rate subsequently slows, ``miniters`` will +remain large and thus reduce display update frequency. To address this: + +- ``maxinterval`` defines the maximum time between display refreshes. + A concurrent monitoring thread checks for overdue updates and forces one + where necessary. + +The monitoring thread should not have a noticeable overhead, and guarantees +updates at least every 10 seconds by default. +This value can be directly changed by setting the ``monitor_interval`` of +any ``tqdm`` instance (i.e. ``t = tqdm.tqdm(...); t.monitor_interval = 2``). +The monitor thread may be disabled application-wide by setting +``tqdm.tqdm.monitor_interval = 0`` before instantiation of any ``tqdm`` bar. + + +Merch +----- + +You can buy `tqdm branded merch `__ now! + +Contributions +------------- + +|GitHub-Commits| |GitHub-Issues| |GitHub-PRs| |OpenHub-Status| |GitHub-Contributions| |CII Best Practices| + +All source code is hosted on `GitHub `__. +Contributions are welcome. + +See the +`CONTRIBUTING `__ +file for more information. + +Developers who have made significant contributions, ranked by *SLoC* +(surviving lines of code, +`git fame `__ ``-wMC --excl '\.(png|gif|jpg)$'``), +are: + +==================== ======================================================== ==== ================================ +Name ID SLoC Notes +==================== ======================================================== ==== ================================ +Casper da Costa-Luis `casperdcl `__ ~78% primary maintainer |Gift-Casper| +Stephen Larroque `lrq3000 `__ ~10% team member +Martin Zugnoni `martinzugnoni `__ ~4% +Daniel Ecer `de-code `__ ~2% +Richard Sheridan `richardsheridan `__ ~1% +Guangshuo Chen `chengs `__ ~1% +Kyle Altendorf `altendky `__ <1% +Matthew Stevens `mjstevens777 `__ <1% +Hadrien Mary `hadim `__ <1% team member +Noam Yorav-Raphael `noamraph `__ <1% original author +Mikhail Korobov `kmike `__ <1% team member +==================== ======================================================== ==== ================================ + +Ports to Other Languages +~~~~~~~~~~~~~~~~~~~~~~~~ + +A list is available on +`this wiki page `__. + + +LICENCE +------- + +Open Source (OSI approved): |LICENCE| + +Citation information: |DOI| + +|README-Hits| (Since 19 May 2016) + +.. |Logo| image:: https://img.tqdm.ml/logo.gif +.. |Screenshot| image:: https://img.tqdm.ml/tqdm.gif +.. |Video| image:: https://img.tqdm.ml/video.jpg + :target: https://tqdm.github.io/video +.. |Slides| image:: https://img.tqdm.ml/slides.jpg + :target: https://tqdm.github.io/PyData2019/slides.html +.. |Merch| image:: https://img.tqdm.ml/merch.jpg + :target: https://tqdm.github.io/merch +.. |Build-Status| image:: https://img.shields.io/github/workflow/status/tqdm/tqdm/Test/master?logo=GitHub + :target: https://github.com/tqdm/tqdm/actions?query=workflow%3ATest +.. |Coverage-Status| image:: https://img.shields.io/coveralls/github/tqdm/tqdm/master?logo=coveralls + :target: https://coveralls.io/github/tqdm/tqdm +.. |Branch-Coverage-Status| image:: https://codecov.io/gh/tqdm/tqdm/branch/master/graph/badge.svg + :target: https://codecov.io/gh/tqdm/tqdm +.. |Codacy-Grade| image:: https://app.codacy.com/project/badge/Grade/3f965571598f44549c7818f29cdcf177 + :target: https://www.codacy.com/gh/tqdm/tqdm/dashboard +.. |CII Best Practices| image:: https://bestpractices.coreinfrastructure.org/projects/3264/badge + :target: https://bestpractices.coreinfrastructure.org/projects/3264 +.. |GitHub-Status| image:: https://img.shields.io/github/tag/tqdm/tqdm.svg?maxAge=86400&logo=github&logoColor=white + :target: https://github.com/tqdm/tqdm/releases +.. |GitHub-Forks| image:: https://img.shields.io/github/forks/tqdm/tqdm.svg?logo=github&logoColor=white + :target: https://github.com/tqdm/tqdm/network +.. |GitHub-Stars| image:: https://img.shields.io/github/stars/tqdm/tqdm.svg?logo=github&logoColor=white + :target: https://github.com/tqdm/tqdm/stargazers +.. |GitHub-Commits| image:: https://img.shields.io/github/commit-activity/y/tqdm/tqdm.svg?logo=git&logoColor=white + :target: https://github.com/tqdm/tqdm/graphs/commit-activity +.. |GitHub-Issues| image:: https://img.shields.io/github/issues-closed/tqdm/tqdm.svg?logo=github&logoColor=white + :target: https://github.com/tqdm/tqdm/issues?q= +.. |GitHub-PRs| image:: https://img.shields.io/github/issues-pr-closed/tqdm/tqdm.svg?logo=github&logoColor=white + :target: https://github.com/tqdm/tqdm/pulls +.. |GitHub-Contributions| image:: https://img.shields.io/github/contributors/tqdm/tqdm.svg?logo=github&logoColor=white + :target: https://github.com/tqdm/tqdm/graphs/contributors +.. |GitHub-Updated| image:: https://img.shields.io/github/last-commit/tqdm/tqdm/master.svg?logo=github&logoColor=white&label=pushed + :target: https://github.com/tqdm/tqdm/pulse +.. |Gift-Casper| image:: https://img.shields.io/badge/dynamic/json.svg?color=ff69b4&label=gifts%20received&prefix=%C2%A3&query=%24..sum&url=https%3A%2F%2Fcaspersci.uk.to%2Fgifts.json + :target: https://cdcl.ml/sponsor +.. |Versions| image:: https://img.shields.io/pypi/v/tqdm.svg + :target: https://tqdm.github.io/releases +.. |PyPI-Downloads| image:: https://img.shields.io/pypi/dm/tqdm.svg?label=pypi%20downloads&logo=PyPI&logoColor=white + :target: https://pepy.tech/project/tqdm +.. |Py-Versions| image:: https://img.shields.io/pypi/pyversions/tqdm.svg?logo=python&logoColor=white + :target: https://pypi.org/project/tqdm +.. |Conda-Forge-Status| image:: https://img.shields.io/conda/v/conda-forge/tqdm.svg?label=conda-forge&logo=conda-forge + :target: https://anaconda.org/conda-forge/tqdm +.. |Snapcraft| image:: https://img.shields.io/badge/snap-install-82BEA0.svg?logo=snapcraft + :target: https://snapcraft.io/tqdm +.. |Docker| image:: https://img.shields.io/badge/docker-pull-blue.svg?logo=docker&logoColor=white + :target: https://hub.docker.com/r/tqdm/tqdm +.. |Libraries-Rank| image:: https://img.shields.io/librariesio/sourcerank/pypi/tqdm.svg?logo=koding&logoColor=white + :target: https://libraries.io/pypi/tqdm +.. |Libraries-Dependents| image:: https://img.shields.io/librariesio/dependent-repos/pypi/tqdm.svg?logo=koding&logoColor=white + :target: https://github.com/tqdm/tqdm/network/dependents +.. |OpenHub-Status| image:: https://www.openhub.net/p/tqdm/widgets/project_thin_badge?format=gif + :target: https://www.openhub.net/p/tqdm?ref=Thin+badge +.. |awesome-python| image:: https://awesome.re/mentioned-badge.svg + :target: https://github.com/vinta/awesome-python +.. |LICENCE| image:: https://img.shields.io/pypi/l/tqdm.svg + :target: https://raw.githubusercontent.com/tqdm/tqdm/master/LICENCE +.. |DOI| image:: https://img.shields.io/badge/DOI-10.5281/zenodo.595120-blue.svg + :target: https://doi.org/10.5281/zenodo.595120 +.. |binder-demo| image:: https://mybinder.org/badge_logo.svg + :target: https://mybinder.org/v2/gh/tqdm/tqdm/master?filepath=DEMO.ipynb +.. |Screenshot-Jupyter1| image:: https://img.tqdm.ml/jupyter-1.gif +.. |Screenshot-Jupyter2| image:: https://img.tqdm.ml/jupyter-2.gif +.. |Screenshot-Jupyter3| image:: https://img.tqdm.ml/jupyter-3.gif +.. |README-Hits| image:: https://caspersci.uk.to/cgi-bin/hits.cgi?q=tqdm&style=social&r=https://github.com/tqdm/tqdm&l=https://img.tqdm.ml/favicon.png&f=https://img.tqdm.ml/logo.gif + :target: https://caspersci.uk.to/cgi-bin/hits.cgi?q=tqdm&a=plot&r=https://github.com/tqdm/tqdm&l=https://img.tqdm.ml/favicon.png&f=https://img.tqdm.ml/logo.gif&style=social diff --git a/.local/lib/python3.10/site-packages/tqdm-4.64.1.dist-info/RECORD b/.local/lib/python3.10/site-packages/tqdm-4.64.1.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..70d3ceb473f39b499f374bff61569787e9d11faf --- /dev/null +++ b/.local/lib/python3.10/site-packages/tqdm-4.64.1.dist-info/RECORD @@ -0,0 +1,74 @@ +../../../bin/tqdm,sha256=ejd0w3qZ13EuKvThVwl6Rl0PH6IwmWdnyQFKBOoY28U,207 +tqdm-4.64.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +tqdm-4.64.1.dist-info/LICENCE,sha256=oPwXhajyogCjEk1wPUlVBgG3dBzP_IYXE8LdqgelN90,2006 +tqdm-4.64.1.dist-info/METADATA,sha256=jsTR8y5U6BX1aR0f56wIIfTRD3UULEF2gUfjrqpsDek,57320 +tqdm-4.64.1.dist-info/RECORD,, +tqdm-4.64.1.dist-info/WHEEL,sha256=z9j0xAa_JmUKMpmz72K0ZGALSM_n-wQVmGbleXx2VHg,110 +tqdm-4.64.1.dist-info/entry_points.txt,sha256=ReJCH7Ui3Zyh6M16E4OhsZ1oU7WtMXCfbtoyBhGO29Y,39 +tqdm-4.64.1.dist-info/top_level.txt,sha256=NLiUJNfmc9At15s7JURiwvqMEjUi9G5PMGRrmMYzNSM,5 +tqdm/__init__.py,sha256=LiezHIqATK3FOij_365eMcu11UPmijmDFKogl72fHp4,1639 +tqdm/__main__.py,sha256=bYt9eEaoRQWdejEHFD8REx9jxVEdZptECFsV7F49Ink,30 +tqdm/__pycache__/__init__.cpython-310.pyc,, +tqdm/__pycache__/__main__.cpython-310.pyc,, +tqdm/__pycache__/_dist_ver.cpython-310.pyc,, +tqdm/__pycache__/_main.cpython-310.pyc,, +tqdm/__pycache__/_monitor.cpython-310.pyc,, +tqdm/__pycache__/_tqdm.cpython-310.pyc,, +tqdm/__pycache__/_tqdm_gui.cpython-310.pyc,, +tqdm/__pycache__/_tqdm_notebook.cpython-310.pyc,, +tqdm/__pycache__/_tqdm_pandas.cpython-310.pyc,, +tqdm/__pycache__/_utils.cpython-310.pyc,, +tqdm/__pycache__/asyncio.cpython-310.pyc,, +tqdm/__pycache__/auto.cpython-310.pyc,, +tqdm/__pycache__/autonotebook.cpython-310.pyc,, +tqdm/__pycache__/cli.cpython-310.pyc,, +tqdm/__pycache__/dask.cpython-310.pyc,, +tqdm/__pycache__/gui.cpython-310.pyc,, +tqdm/__pycache__/keras.cpython-310.pyc,, +tqdm/__pycache__/notebook.cpython-310.pyc,, +tqdm/__pycache__/rich.cpython-310.pyc,, +tqdm/__pycache__/std.cpython-310.pyc,, +tqdm/__pycache__/tk.cpython-310.pyc,, +tqdm/__pycache__/utils.cpython-310.pyc,, +tqdm/__pycache__/version.cpython-310.pyc,, +tqdm/_dist_ver.py,sha256=t_S6ewuKLyIG83cQE_4p3-9fuVl15vndP1_y1FpoRyM,23 +tqdm/_main.py,sha256=9ySvgmi_2Sw4CAo5UDW0Q2dxfTryboEWGHohfCJz0sA,283 +tqdm/_monitor.py,sha256=Uku-DPWgzJ7dO5CK08xKJK-E_F6qQ-JB3ksuXczSYR0,3699 +tqdm/_tqdm.py,sha256=LfLCuJ6bpsVo9xilmtBXyEm1vGnUCFrliW85j3J-nD4,283 +tqdm/_tqdm_gui.py,sha256=03Hc8KayxJveieI5-0-2NGiDpLvw9jZekofJUV7CCwk,287 +tqdm/_tqdm_notebook.py,sha256=BuHiLuxu6uEfZFaPJW3RPpPaxaVctEQA3kdSJSDL1hw,307 +tqdm/_tqdm_pandas.py,sha256=c9jptUgigN6axRDhRd4Rif98Tmxeopc1nFNFhIpbFUE,888 +tqdm/_utils.py,sha256=YIwj0ZJQonXgYa2HaA3U_paP4xOXJqj0ZWMPeZSf6Pw,596 +tqdm/asyncio.py,sha256=7CWT2150uMvyXSMDkl9PvG9G_HrfOVY32rWbeP2bw1Y,2789 +tqdm/auto.py,sha256=P__dIfklVGqcRdzV4q68SOBVhLHe9QWnrCk3IJIA-fM,1106 +tqdm/autonotebook.py,sha256=Yb9F5uaiBPhfbDDFpbtoG8I2YUw3uQJ89rUDLbfR6ws,956 +tqdm/cli.py,sha256=h4DvZDBZ2ZlANtlRi2mXblr8yjEe9iUGlOqZc5XPljc,10871 +tqdm/completion.sh,sha256=j79KbSmpIj_E11jfTfBXrGnUTzKXVpQ1vGVQvsyDRl4,946 +tqdm/contrib/__init__.py,sha256=gpiBeuWB1OaaoGFwiS-G_Nodv8fLPZ_xVxbENL0EYL4,2604 +tqdm/contrib/__pycache__/__init__.cpython-310.pyc,, +tqdm/contrib/__pycache__/bells.cpython-310.pyc,, +tqdm/contrib/__pycache__/concurrent.cpython-310.pyc,, +tqdm/contrib/__pycache__/discord.cpython-310.pyc,, +tqdm/contrib/__pycache__/itertools.cpython-310.pyc,, +tqdm/contrib/__pycache__/logging.cpython-310.pyc,, +tqdm/contrib/__pycache__/slack.cpython-310.pyc,, +tqdm/contrib/__pycache__/telegram.cpython-310.pyc,, +tqdm/contrib/__pycache__/utils_worker.cpython-310.pyc,, +tqdm/contrib/bells.py,sha256=Yx1HqGCmHrESCAO700j5wE__JCleNODJxedh1ijPLD0,837 +tqdm/contrib/concurrent.py,sha256=YmHJG_jUYUsg2NR1eAhsrl6X-_BfzlANtW32IhNmRTA,4644 +tqdm/contrib/discord.py,sha256=VbmiX5-ioD2Lqq0XtO9qx0hxStWokVaiR4l_a9Qozzw,4090 +tqdm/contrib/itertools.py,sha256=PW3WkdYKP-aVCrlcOfH53i4IA5R7G8rjEJdp6CF5IO8,814 +tqdm/contrib/logging.py,sha256=F4pEE2mRecNKoZNm7jIWr2nMeelvogvZ8aopo_irK44,3844 +tqdm/contrib/slack.py,sha256=CQauSUZP5PyKOrXqU0HN5XOQM9E1pU6NgV1BVaGdV0I,4196 +tqdm/contrib/telegram.py,sha256=5S6IIZMjDg7rcdxJaGGcvTRC37DnHf0r36ahje_JyyQ,5228 +tqdm/contrib/utils_worker.py,sha256=3Mj9TvDa3qRGoZvrmU5cQTnmQLPd8oP7AURuJjVVFXo,1247 +tqdm/dask.py,sha256=BqPQ2O_Bd59hnXlC7B5rS7y9C2wI4cPkIHDdeCWGtzc,1377 +tqdm/gui.py,sha256=kQP-ezwAUSvJ44f50Up2fEG4Hq-p4snrEyKwSNwcgkI,5943 +tqdm/keras.py,sha256=auQQJvAZMHgr0Y3kY6pKQVD-6EAJMPg91ZOJ2WSTN-A,4409 +tqdm/notebook.py,sha256=9U5j_FciNUpLaqd6nmJocRlFa3PFcCzvhTaKudrWbbA,11317 +tqdm/rich.py,sha256=ocxh5vFqPhpV49g6qrC9JkfB9RK1pNuH74681Otzg5I,5152 +tqdm/std.py,sha256=3D8qfR_CdRI12Ad05Fm9ndmfFlD5M6HvtK2gn-KQDAE,58341 +tqdm/tk.py,sha256=a3lbj1GsP7jyDpQQgm5ohsFm9Y9-adeklYIhPH69P88,6948 +tqdm/tqdm.1,sha256=1YMLZFiY0wGAUYgjmrfr9vQTlyMql6LT31oUWvOyQdU,7997 +tqdm/utils.py,sha256=KvE0DM28X__NHYKgGl5jUrk6CM5BV60G4Nf55ITPeJI,9803 +tqdm/version.py,sha256=-1yWjfu3P0eghVsysHH07fbzdiADNRdzRtYPqOaqR2A,333 diff --git a/.local/lib/python3.10/site-packages/tqdm-4.64.1.dist-info/WHEEL b/.local/lib/python3.10/site-packages/tqdm-4.64.1.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..0b18a281107a0448a9980396d9d324ea2aa7a7f8 --- /dev/null +++ b/.local/lib/python3.10/site-packages/tqdm-4.64.1.dist-info/WHEEL @@ -0,0 +1,6 @@ +Wheel-Version: 1.0 +Generator: bdist_wheel (0.37.1) +Root-Is-Purelib: true +Tag: py2-none-any +Tag: py3-none-any + diff --git a/.local/lib/python3.10/site-packages/tqdm-4.64.1.dist-info/entry_points.txt b/.local/lib/python3.10/site-packages/tqdm-4.64.1.dist-info/entry_points.txt new file mode 100644 index 0000000000000000000000000000000000000000..540e60f4e073bc53a5f0a521a3639e0d80780af4 --- /dev/null +++ b/.local/lib/python3.10/site-packages/tqdm-4.64.1.dist-info/entry_points.txt @@ -0,0 +1,2 @@ +[console_scripts] +tqdm = tqdm.cli:main diff --git a/.local/lib/python3.10/site-packages/tqdm-4.64.1.dist-info/top_level.txt b/.local/lib/python3.10/site-packages/tqdm-4.64.1.dist-info/top_level.txt new file mode 100644 index 0000000000000000000000000000000000000000..78620c472c9d799a14ccb02a0233f4669b3bcdcb --- /dev/null +++ b/.local/lib/python3.10/site-packages/tqdm-4.64.1.dist-info/top_level.txt @@ -0,0 +1 @@ +tqdm diff --git a/.local/lib/python3.10/site-packages/tqdm/__init__.py b/.local/lib/python3.10/site-packages/tqdm/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..a021d16e9a54eb18384d2c678675eca917753848 --- /dev/null +++ b/.local/lib/python3.10/site-packages/tqdm/__init__.py @@ -0,0 +1,41 @@ +from ._monitor import TMonitor, TqdmSynchronisationWarning +from ._tqdm_pandas import tqdm_pandas +from .cli import main # TODO: remove in v5.0.0 +from .gui import tqdm as tqdm_gui # TODO: remove in v5.0.0 +from .gui import trange as tgrange # TODO: remove in v5.0.0 +from .std import ( + TqdmDeprecationWarning, TqdmExperimentalWarning, TqdmKeyError, TqdmMonitorWarning, + TqdmTypeError, TqdmWarning, tqdm, trange) +from .version import __version__ + +__all__ = ['tqdm', 'tqdm_gui', 'trange', 'tgrange', 'tqdm_pandas', + 'tqdm_notebook', 'tnrange', 'main', 'TMonitor', + 'TqdmTypeError', 'TqdmKeyError', + 'TqdmWarning', 'TqdmDeprecationWarning', + 'TqdmExperimentalWarning', + 'TqdmMonitorWarning', 'TqdmSynchronisationWarning', + '__version__'] + + +def tqdm_notebook(*args, **kwargs): # pragma: no cover + """See tqdm.notebook.tqdm for full documentation""" + from warnings import warn + + from .notebook import tqdm as _tqdm_notebook + warn("This function will be removed in tqdm==5.0.0\n" + "Please use `tqdm.notebook.tqdm` instead of `tqdm.tqdm_notebook`", + TqdmDeprecationWarning, stacklevel=2) + return _tqdm_notebook(*args, **kwargs) + + +def tnrange(*args, **kwargs): # pragma: no cover + """ + A shortcut for `tqdm.notebook.tqdm(xrange(*args), **kwargs)`. + On Python3+, `range` is used instead of `xrange`. + """ + from warnings import warn + + from .notebook import trange as _tnrange + warn("Please use `tqdm.notebook.trange` instead of `tqdm.tnrange`", + TqdmDeprecationWarning, stacklevel=2) + return _tnrange(*args, **kwargs) diff --git a/.local/lib/python3.10/site-packages/tqdm/__main__.py b/.local/lib/python3.10/site-packages/tqdm/__main__.py new file mode 100644 index 0000000000000000000000000000000000000000..4e28416e104515e90fca4b69cc60d0c61fd15d61 --- /dev/null +++ b/.local/lib/python3.10/site-packages/tqdm/__main__.py @@ -0,0 +1,3 @@ +from .cli import main + +main() diff --git a/.local/lib/python3.10/site-packages/tqdm/__pycache__/__init__.cpython-310.pyc b/.local/lib/python3.10/site-packages/tqdm/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7d58930ab85cb530440d0eaa225491ca5acc2f32 Binary files /dev/null and b/.local/lib/python3.10/site-packages/tqdm/__pycache__/__init__.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/tqdm/__pycache__/__main__.cpython-310.pyc b/.local/lib/python3.10/site-packages/tqdm/__pycache__/__main__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2e7ad0839ac61b2a17f563206446f4d681e05b59 Binary files /dev/null and b/.local/lib/python3.10/site-packages/tqdm/__pycache__/__main__.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/tqdm/__pycache__/_dist_ver.cpython-310.pyc b/.local/lib/python3.10/site-packages/tqdm/__pycache__/_dist_ver.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6c60445a564fadeff276abeb5abd8f554ea93150 Binary files /dev/null and b/.local/lib/python3.10/site-packages/tqdm/__pycache__/_dist_ver.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/tqdm/__pycache__/_main.cpython-310.pyc b/.local/lib/python3.10/site-packages/tqdm/__pycache__/_main.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b7a1359f401163c3d05593d1dd8bb6b0e021e4c1 Binary files /dev/null and b/.local/lib/python3.10/site-packages/tqdm/__pycache__/_main.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/tqdm/__pycache__/_monitor.cpython-310.pyc b/.local/lib/python3.10/site-packages/tqdm/__pycache__/_monitor.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..48b6e79a711473be1b498cab7de5f539404b98b0 Binary files /dev/null and b/.local/lib/python3.10/site-packages/tqdm/__pycache__/_monitor.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/tqdm/__pycache__/_tqdm.cpython-310.pyc b/.local/lib/python3.10/site-packages/tqdm/__pycache__/_tqdm.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a96709f997a223b35631521ec4bf2b897ff936ec Binary files /dev/null and b/.local/lib/python3.10/site-packages/tqdm/__pycache__/_tqdm.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/tqdm/__pycache__/_tqdm_gui.cpython-310.pyc b/.local/lib/python3.10/site-packages/tqdm/__pycache__/_tqdm_gui.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e7ecd6d56a94d7ac4a433d2c4c6f311c75f505aa Binary files /dev/null and b/.local/lib/python3.10/site-packages/tqdm/__pycache__/_tqdm_gui.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/tqdm/__pycache__/_tqdm_notebook.cpython-310.pyc b/.local/lib/python3.10/site-packages/tqdm/__pycache__/_tqdm_notebook.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7066e84476d301b7e4aece09a6d389897a7b7fbb Binary files /dev/null and b/.local/lib/python3.10/site-packages/tqdm/__pycache__/_tqdm_notebook.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/tqdm/__pycache__/_tqdm_pandas.cpython-310.pyc b/.local/lib/python3.10/site-packages/tqdm/__pycache__/_tqdm_pandas.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f9f4d9b194784360cd0de62b03a1f6babe987c7b Binary files /dev/null and b/.local/lib/python3.10/site-packages/tqdm/__pycache__/_tqdm_pandas.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/tqdm/__pycache__/_utils.cpython-310.pyc b/.local/lib/python3.10/site-packages/tqdm/__pycache__/_utils.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..63f059c70ef49cd027e541836f75f14c0cbdfea7 Binary files /dev/null and b/.local/lib/python3.10/site-packages/tqdm/__pycache__/_utils.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/tqdm/__pycache__/asyncio.cpython-310.pyc b/.local/lib/python3.10/site-packages/tqdm/__pycache__/asyncio.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bc6a4e04699e38ed429788f956af7f5c5cf50a54 Binary files /dev/null and b/.local/lib/python3.10/site-packages/tqdm/__pycache__/asyncio.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/tqdm/__pycache__/auto.cpython-310.pyc b/.local/lib/python3.10/site-packages/tqdm/__pycache__/auto.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ff396479ff3c44553604479dd33f802f10d899e5 Binary files /dev/null and b/.local/lib/python3.10/site-packages/tqdm/__pycache__/auto.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/tqdm/__pycache__/autonotebook.cpython-310.pyc b/.local/lib/python3.10/site-packages/tqdm/__pycache__/autonotebook.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f5dc35d12439269bdc947865ef9b79618ae9bd22 Binary files /dev/null and b/.local/lib/python3.10/site-packages/tqdm/__pycache__/autonotebook.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/tqdm/__pycache__/cli.cpython-310.pyc b/.local/lib/python3.10/site-packages/tqdm/__pycache__/cli.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3868fe96f36e0977180776e9cb8868c22f7311ea Binary files /dev/null and b/.local/lib/python3.10/site-packages/tqdm/__pycache__/cli.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/tqdm/__pycache__/dask.cpython-310.pyc b/.local/lib/python3.10/site-packages/tqdm/__pycache__/dask.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d143bace143df388dd17bc9f97ec839f5cdc212f Binary files /dev/null and b/.local/lib/python3.10/site-packages/tqdm/__pycache__/dask.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/tqdm/__pycache__/gui.cpython-310.pyc b/.local/lib/python3.10/site-packages/tqdm/__pycache__/gui.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1cf4ff6021be0df7767992852bbebdf7ed53087b Binary files /dev/null and b/.local/lib/python3.10/site-packages/tqdm/__pycache__/gui.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/tqdm/__pycache__/keras.cpython-310.pyc b/.local/lib/python3.10/site-packages/tqdm/__pycache__/keras.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9684149f5b409cb64e79707bb4f97d9eb6cd6c1e Binary files /dev/null and b/.local/lib/python3.10/site-packages/tqdm/__pycache__/keras.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/tqdm/__pycache__/notebook.cpython-310.pyc b/.local/lib/python3.10/site-packages/tqdm/__pycache__/notebook.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bf083b4e93a05b1190959de8872119e9de4b6b4c Binary files /dev/null and b/.local/lib/python3.10/site-packages/tqdm/__pycache__/notebook.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/tqdm/__pycache__/rich.cpython-310.pyc b/.local/lib/python3.10/site-packages/tqdm/__pycache__/rich.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d9b68d3e8e7bb00b770b36f2d6d4cd156e610ad0 Binary files /dev/null and b/.local/lib/python3.10/site-packages/tqdm/__pycache__/rich.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/tqdm/__pycache__/std.cpython-310.pyc b/.local/lib/python3.10/site-packages/tqdm/__pycache__/std.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..140119bd3d5937b79e7df3ad0a1768d0fd7dda03 Binary files /dev/null and b/.local/lib/python3.10/site-packages/tqdm/__pycache__/std.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/tqdm/__pycache__/tk.cpython-310.pyc b/.local/lib/python3.10/site-packages/tqdm/__pycache__/tk.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b7d27962eb46a7b6193e147c4c46eaafb6eba4f9 Binary files /dev/null and b/.local/lib/python3.10/site-packages/tqdm/__pycache__/tk.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/tqdm/__pycache__/utils.cpython-310.pyc b/.local/lib/python3.10/site-packages/tqdm/__pycache__/utils.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c72d66c97f3590c959c533ee7a1ac5e420285e8f Binary files /dev/null and b/.local/lib/python3.10/site-packages/tqdm/__pycache__/utils.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/tqdm/__pycache__/version.cpython-310.pyc b/.local/lib/python3.10/site-packages/tqdm/__pycache__/version.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..60e18bd6b49c8a94a7264bb436ac1dd712ac11e6 Binary files /dev/null and b/.local/lib/python3.10/site-packages/tqdm/__pycache__/version.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/tqdm/_dist_ver.py b/.local/lib/python3.10/site-packages/tqdm/_dist_ver.py new file mode 100644 index 0000000000000000000000000000000000000000..1c2d0048d2f407166c60a5ef2363fa8d2ada7d48 --- /dev/null +++ b/.local/lib/python3.10/site-packages/tqdm/_dist_ver.py @@ -0,0 +1 @@ +__version__ = '4.64.1' diff --git a/.local/lib/python3.10/site-packages/tqdm/_main.py b/.local/lib/python3.10/site-packages/tqdm/_main.py new file mode 100644 index 0000000000000000000000000000000000000000..04fdeeff17b5cc84b210f445b54b87d5b99e3748 --- /dev/null +++ b/.local/lib/python3.10/site-packages/tqdm/_main.py @@ -0,0 +1,9 @@ +from warnings import warn + +from .cli import * # NOQA +from .cli import __all__ # NOQA +from .std import TqdmDeprecationWarning + +warn("This function will be removed in tqdm==5.0.0\n" + "Please use `tqdm.cli.*` instead of `tqdm._main.*`", + TqdmDeprecationWarning, stacklevel=2) diff --git a/.local/lib/python3.10/site-packages/tqdm/_monitor.py b/.local/lib/python3.10/site-packages/tqdm/_monitor.py new file mode 100644 index 0000000000000000000000000000000000000000..f71aa56817ca77eba5df4a2dd11cb0c4a9a7ea1c --- /dev/null +++ b/.local/lib/python3.10/site-packages/tqdm/_monitor.py @@ -0,0 +1,95 @@ +import atexit +from threading import Event, Thread, current_thread +from time import time +from warnings import warn + +__all__ = ["TMonitor", "TqdmSynchronisationWarning"] + + +class TqdmSynchronisationWarning(RuntimeWarning): + """tqdm multi-thread/-process errors which may cause incorrect nesting + but otherwise no adverse effects""" + pass + + +class TMonitor(Thread): + """ + Monitoring thread for tqdm bars. + Monitors if tqdm bars are taking too much time to display + and readjusts miniters automatically if necessary. + + Parameters + ---------- + tqdm_cls : class + tqdm class to use (can be core tqdm or a submodule). + sleep_interval : float + Time to sleep between monitoring checks. + """ + _test = {} # internal vars for unit testing + + def __init__(self, tqdm_cls, sleep_interval): + Thread.__init__(self) + self.daemon = True # kill thread when main killed (KeyboardInterrupt) + self.woken = 0 # last time woken up, to sync with monitor + self.tqdm_cls = tqdm_cls + self.sleep_interval = sleep_interval + self._time = self._test.get("time", time) + self.was_killed = self._test.get("Event", Event)() + atexit.register(self.exit) + self.start() + + def exit(self): + self.was_killed.set() + if self is not current_thread(): + self.join() + return self.report() + + def get_instances(self): + # returns a copy of started `tqdm_cls` instances + return [i for i in self.tqdm_cls._instances.copy() + # Avoid race by checking that the instance started + if hasattr(i, 'start_t')] + + def run(self): + cur_t = self._time() + while True: + # After processing and before sleeping, notify that we woke + # Need to be done just before sleeping + self.woken = cur_t + # Sleep some time... + self.was_killed.wait(self.sleep_interval) + # Quit if killed + if self.was_killed.is_set(): + return + # Then monitor! + # Acquire lock (to access _instances) + with self.tqdm_cls.get_lock(): + cur_t = self._time() + # Check tqdm instances are waiting too long to print + instances = self.get_instances() + for instance in instances: + # Check event in loop to reduce blocking time on exit + if self.was_killed.is_set(): + return + # Only if mininterval > 1 (else iterations are just slow) + # and last refresh exceeded maxinterval + if ( + instance.miniters > 1 + and (cur_t - instance.last_print_t) >= instance.maxinterval + ): + # force bypassing miniters on next iteration + # (dynamic_miniters adjusts mininterval automatically) + instance.miniters = 1 + # Refresh now! (works only for manual tqdm) + instance.refresh(nolock=True) + # Remove accidental long-lived strong reference + del instance + if instances != self.get_instances(): # pragma: nocover + warn("Set changed size during iteration" + + " (see https://github.com/tqdm/tqdm/issues/481)", + TqdmSynchronisationWarning, stacklevel=2) + # Remove accidental long-lived strong references + del instances + + def report(self): + return not self.was_killed.is_set() diff --git a/.local/lib/python3.10/site-packages/tqdm/_tqdm.py b/.local/lib/python3.10/site-packages/tqdm/_tqdm.py new file mode 100644 index 0000000000000000000000000000000000000000..7fc4962774a4651db7a739a3f143633b6215a9bd --- /dev/null +++ b/.local/lib/python3.10/site-packages/tqdm/_tqdm.py @@ -0,0 +1,9 @@ +from warnings import warn + +from .std import * # NOQA +from .std import __all__ # NOQA +from .std import TqdmDeprecationWarning + +warn("This function will be removed in tqdm==5.0.0\n" + "Please use `tqdm.std.*` instead of `tqdm._tqdm.*`", + TqdmDeprecationWarning, stacklevel=2) diff --git a/.local/lib/python3.10/site-packages/tqdm/_tqdm_gui.py b/.local/lib/python3.10/site-packages/tqdm/_tqdm_gui.py new file mode 100644 index 0000000000000000000000000000000000000000..f32aa894f54b3a5b47a0fbf4263c2fd20df56c9d --- /dev/null +++ b/.local/lib/python3.10/site-packages/tqdm/_tqdm_gui.py @@ -0,0 +1,9 @@ +from warnings import warn + +from .gui import * # NOQA +from .gui import __all__ # NOQA +from .std import TqdmDeprecationWarning + +warn("This function will be removed in tqdm==5.0.0\n" + "Please use `tqdm.gui.*` instead of `tqdm._tqdm_gui.*`", + TqdmDeprecationWarning, stacklevel=2) diff --git a/.local/lib/python3.10/site-packages/tqdm/_tqdm_notebook.py b/.local/lib/python3.10/site-packages/tqdm/_tqdm_notebook.py new file mode 100644 index 0000000000000000000000000000000000000000..f225fbf5b52d04987ccf68f4d5ee4b735e3158b0 --- /dev/null +++ b/.local/lib/python3.10/site-packages/tqdm/_tqdm_notebook.py @@ -0,0 +1,9 @@ +from warnings import warn + +from .notebook import * # NOQA +from .notebook import __all__ # NOQA +from .std import TqdmDeprecationWarning + +warn("This function will be removed in tqdm==5.0.0\n" + "Please use `tqdm.notebook.*` instead of `tqdm._tqdm_notebook.*`", + TqdmDeprecationWarning, stacklevel=2) diff --git a/.local/lib/python3.10/site-packages/tqdm/_tqdm_pandas.py b/.local/lib/python3.10/site-packages/tqdm/_tqdm_pandas.py new file mode 100644 index 0000000000000000000000000000000000000000..c4fe6efdc603579e7f8acfa27ac10dccdf3e94ce --- /dev/null +++ b/.local/lib/python3.10/site-packages/tqdm/_tqdm_pandas.py @@ -0,0 +1,24 @@ +import sys + +__author__ = "github.com/casperdcl" +__all__ = ['tqdm_pandas'] + + +def tqdm_pandas(tclass, **tqdm_kwargs): + """ + Registers the given `tqdm` instance with + `pandas.core.groupby.DataFrameGroupBy.progress_apply`. + """ + from tqdm import TqdmDeprecationWarning + + if isinstance(tclass, type) or (getattr(tclass, '__name__', '').startswith( + 'tqdm_')): # delayed adapter case + TqdmDeprecationWarning( + "Please use `tqdm.pandas(...)` instead of `tqdm_pandas(tqdm, ...)`.", + fp_write=getattr(tqdm_kwargs.get('file', None), 'write', sys.stderr.write)) + tclass.pandas(**tqdm_kwargs) + else: + TqdmDeprecationWarning( + "Please use `tqdm.pandas(...)` instead of `tqdm_pandas(tqdm(...))`.", + fp_write=getattr(tclass.fp, 'write', sys.stderr.write)) + type(tclass).pandas(deprecated_t=tclass) diff --git a/.local/lib/python3.10/site-packages/tqdm/_utils.py b/.local/lib/python3.10/site-packages/tqdm/_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..2cf10909f5cd5ee27d7cc23cbce3e47a51665212 --- /dev/null +++ b/.local/lib/python3.10/site-packages/tqdm/_utils.py @@ -0,0 +1,12 @@ +from warnings import warn + +from .std import TqdmDeprecationWarning +from .utils import ( # NOQA, pylint: disable=unused-import + CUR_OS, IS_NIX, IS_WIN, RE_ANSI, Comparable, FormatReplace, SimpleTextIOWrapper, _basestring, + _environ_cols_wrapper, _is_ascii, _is_utf, _range, _screen_shape_linux, _screen_shape_tput, + _screen_shape_windows, _screen_shape_wrapper, _supports_unicode, _term_move_up, _unich, + _unicode, colorama) + +warn("This function will be removed in tqdm==5.0.0\n" + "Please use `tqdm.utils.*` instead of `tqdm._utils.*`", + TqdmDeprecationWarning, stacklevel=2) diff --git a/.local/lib/python3.10/site-packages/tqdm/asyncio.py b/.local/lib/python3.10/site-packages/tqdm/asyncio.py new file mode 100644 index 0000000000000000000000000000000000000000..97c5f88fc22480a45e919de73c4077c4415bdc85 --- /dev/null +++ b/.local/lib/python3.10/site-packages/tqdm/asyncio.py @@ -0,0 +1,93 @@ +""" +Asynchronous progressbar decorator for iterators. +Includes a default `range` iterator printing to `stderr`. + +Usage: +>>> from tqdm.asyncio import trange, tqdm +>>> async for i in trange(10): +... ... +""" +import asyncio +from sys import version_info + +from .std import tqdm as std_tqdm + +__author__ = {"github.com/": ["casperdcl"]} +__all__ = ['tqdm_asyncio', 'tarange', 'tqdm', 'trange'] + + +class tqdm_asyncio(std_tqdm): + """ + Asynchronous-friendly version of tqdm (Python 3.6+). + """ + def __init__(self, iterable=None, *args, **kwargs): + super(tqdm_asyncio, self).__init__(iterable, *args, **kwargs) + self.iterable_awaitable = False + if iterable is not None: + if hasattr(iterable, "__anext__"): + self.iterable_next = iterable.__anext__ + self.iterable_awaitable = True + elif hasattr(iterable, "__next__"): + self.iterable_next = iterable.__next__ + else: + self.iterable_iterator = iter(iterable) + self.iterable_next = self.iterable_iterator.__next__ + + def __aiter__(self): + return self + + async def __anext__(self): + try: + if self.iterable_awaitable: + res = await self.iterable_next() + else: + res = self.iterable_next() + self.update() + return res + except StopIteration: + self.close() + raise StopAsyncIteration + except BaseException: + self.close() + raise + + def send(self, *args, **kwargs): + return self.iterable.send(*args, **kwargs) + + @classmethod + def as_completed(cls, fs, *, loop=None, timeout=None, total=None, **tqdm_kwargs): + """ + Wrapper for `asyncio.as_completed`. + """ + if total is None: + total = len(fs) + kwargs = {} + if version_info[:2] < (3, 10): + kwargs['loop'] = loop + yield from cls(asyncio.as_completed(fs, timeout=timeout, **kwargs), + total=total, **tqdm_kwargs) + + @classmethod + async def gather(cls, *fs, loop=None, timeout=None, total=None, **tqdm_kwargs): + """ + Wrapper for `asyncio.gather`. + """ + async def wrap_awaitable(i, f): + return i, await f + + ifs = [wrap_awaitable(i, f) for i, f in enumerate(fs)] + res = [await f for f in cls.as_completed(ifs, loop=loop, timeout=timeout, + total=total, **tqdm_kwargs)] + return [i for _, i in sorted(res)] + + +def tarange(*args, **kwargs): + """ + A shortcut for `tqdm.asyncio.tqdm(range(*args), **kwargs)`. + """ + return tqdm_asyncio(range(*args), **kwargs) + + +# Aliases +tqdm = tqdm_asyncio +trange = tarange diff --git a/.local/lib/python3.10/site-packages/tqdm/auto.py b/.local/lib/python3.10/site-packages/tqdm/auto.py new file mode 100644 index 0000000000000000000000000000000000000000..cffca206ffe014bea6e758df858a1d640392fe96 --- /dev/null +++ b/.local/lib/python3.10/site-packages/tqdm/auto.py @@ -0,0 +1,44 @@ +""" +Enables multiple commonly used features. + +Method resolution order: + +- `tqdm.autonotebook` without import warnings +- `tqdm.asyncio` on Python3.6+ +- `tqdm.std` base class + +Usage: +>>> from tqdm.auto import trange, tqdm +>>> for i in trange(10): +... ... +""" +import sys +import warnings + +from .std import TqdmExperimentalWarning + +with warnings.catch_warnings(): + warnings.simplefilter("ignore", category=TqdmExperimentalWarning) + from .autonotebook import tqdm as notebook_tqdm + from .autonotebook import trange as notebook_trange + +if sys.version_info[:2] < (3, 6): + tqdm = notebook_tqdm + trange = notebook_trange +else: # Python3.6+ + from .asyncio import tqdm as asyncio_tqdm + from .std import tqdm as std_tqdm + + if notebook_tqdm != std_tqdm: + class tqdm(notebook_tqdm, asyncio_tqdm): # pylint: disable=inconsistent-mro + pass + else: + tqdm = asyncio_tqdm + + def trange(*args, **kwargs): + """ + A shortcut for `tqdm.auto.tqdm(range(*args), **kwargs)`. + """ + return tqdm(range(*args), **kwargs) + +__all__ = ["tqdm", "trange"] diff --git a/.local/lib/python3.10/site-packages/tqdm/autonotebook.py b/.local/lib/python3.10/site-packages/tqdm/autonotebook.py new file mode 100644 index 0000000000000000000000000000000000000000..a09f2ec4b8c95f12b8c7b7774f84d5ec55826334 --- /dev/null +++ b/.local/lib/python3.10/site-packages/tqdm/autonotebook.py @@ -0,0 +1,29 @@ +""" +Automatically choose between `tqdm.notebook` and `tqdm.std`. + +Usage: +>>> from tqdm.autonotebook import trange, tqdm +>>> for i in trange(10): +... ... +""" +import sys +from warnings import warn + +try: + get_ipython = sys.modules['IPython'].get_ipython + if 'IPKernelApp' not in get_ipython().config: # pragma: no cover + raise ImportError("console") + from .notebook import WARN_NOIPYW, IProgress + if IProgress is None: + from .std import TqdmWarning + warn(WARN_NOIPYW, TqdmWarning, stacklevel=2) + raise ImportError('ipywidgets') +except Exception: + from .std import tqdm, trange +else: # pragma: no cover + from .notebook import tqdm, trange + from .std import TqdmExperimentalWarning + warn("Using `tqdm.autonotebook.tqdm` in notebook mode." + " Use `tqdm.tqdm` instead to force console mode" + " (e.g. in jupyter console)", TqdmExperimentalWarning, stacklevel=2) +__all__ = ["tqdm", "trange"] diff --git a/.local/lib/python3.10/site-packages/tqdm/cli.py b/.local/lib/python3.10/site-packages/tqdm/cli.py new file mode 100644 index 0000000000000000000000000000000000000000..3ed25fbb441607f911c558556416f2218b4a4696 --- /dev/null +++ b/.local/lib/python3.10/site-packages/tqdm/cli.py @@ -0,0 +1,315 @@ +""" +Module version for monitoring CLI pipes (`... | python -m tqdm | ...`). +""" +import logging +import re +import sys +from ast import literal_eval as numeric + +from .std import TqdmKeyError, TqdmTypeError, tqdm +from .version import __version__ + +__all__ = ["main"] +log = logging.getLogger(__name__) + + +def cast(val, typ): + log.debug((val, typ)) + if " or " in typ: + for t in typ.split(" or "): + try: + return cast(val, t) + except TqdmTypeError: + pass + raise TqdmTypeError(val + ' : ' + typ) + + # sys.stderr.write('\ndebug | `val:type`: `' + val + ':' + typ + '`.\n') + if typ == 'bool': + if (val == 'True') or (val == ''): + return True + elif val == 'False': + return False + else: + raise TqdmTypeError(val + ' : ' + typ) + try: + return eval(typ + '("' + val + '")') + except Exception: + if typ == 'chr': + return chr(ord(eval('"' + val + '"'))).encode() + else: + raise TqdmTypeError(val + ' : ' + typ) + + +def posix_pipe(fin, fout, delim=b'\\n', buf_size=256, + callback=lambda float: None, callback_len=True): + """ + Params + ------ + fin : binary file with `read(buf_size : int)` method + fout : binary file with `write` (and optionally `flush`) methods. + callback : function(float), e.g.: `tqdm.update` + callback_len : If (default: True) do `callback(len(buffer))`. + Otherwise, do `callback(data) for data in buffer.split(delim)`. + """ + fp_write = fout.write + + if not delim: + while True: + tmp = fin.read(buf_size) + + # flush at EOF + if not tmp: + getattr(fout, 'flush', lambda: None)() + return + + fp_write(tmp) + callback(len(tmp)) + # return + + buf = b'' + len_delim = len(delim) + # n = 0 + while True: + tmp = fin.read(buf_size) + + # flush at EOF + if not tmp: + if buf: + fp_write(buf) + if callback_len: + # n += 1 + buf.count(delim) + callback(1 + buf.count(delim)) + else: + for i in buf.split(delim): + callback(i) + getattr(fout, 'flush', lambda: None)() + return # n + + while True: + i = tmp.find(delim) + if i < 0: + buf += tmp + break + fp_write(buf + tmp[:i + len(delim)]) + # n += 1 + callback(1 if callback_len else (buf + tmp[:i])) + buf = b'' + tmp = tmp[i + len_delim:] + + +# ((opt, type), ... ) +RE_OPTS = re.compile(r'\n {8}(\S+)\s{2,}:\s*([^,]+)') +# better split method assuming no positional args +RE_SHLEX = re.compile(r'\s*(? : \2', d) + split = RE_OPTS.split(d) + opt_types_desc = zip(split[1::3], split[2::3], split[3::3]) + d = ''.join(('\n --{0} : {2}{3}' if otd[1] == 'bool' else + '\n --{0}=<{1}> : {2}{3}').format( + otd[0].replace('_', '-'), otd[0], *otd[1:]) + for otd in opt_types_desc if otd[0] not in UNSUPPORTED_OPTS) + + help_short = "Usage:\n tqdm [--help | options]\n" + d = help_short + """ +Options: + -h, --help Print this help and exit. + -v, --version Print version and exit. +""" + d.strip('\n') + '\n' + + # opts = docopt(d, version=__version__) + if any(v in argv for v in ('-v', '--version')): + sys.stdout.write(__version__ + '\n') + sys.exit(0) + elif any(v in argv for v in ('-h', '--help')): + sys.stdout.write(d + '\n') + sys.exit(0) + elif argv and argv[0][:2] != '--': + sys.stderr.write( + "Error:Unknown argument:{0}\n{1}".format(argv[0], help_short)) + + argv = RE_SHLEX.split(' '.join(["tqdm"] + argv)) + opts = dict(zip(argv[1::3], argv[3::3])) + + log.debug(opts) + opts.pop('log', True) + + tqdm_args = {'file': fp} + try: + for (o, v) in opts.items(): + o = o.replace('-', '_') + try: + tqdm_args[o] = cast(v, opt_types[o]) + except KeyError as e: + raise TqdmKeyError(str(e)) + log.debug('args:' + str(tqdm_args)) + + delim_per_char = tqdm_args.pop('bytes', False) + update = tqdm_args.pop('update', False) + update_to = tqdm_args.pop('update_to', False) + if sum((delim_per_char, update, update_to)) > 1: + raise TqdmKeyError("Can only have one of --bytes --update --update_to") + except Exception: + fp.write("\nError:\n" + help_short) + stdin, stdout_write = sys.stdin, sys.stdout.write + for i in stdin: + stdout_write(i) + raise + else: + buf_size = tqdm_args.pop('buf_size', 256) + delim = tqdm_args.pop('delim', b'\\n') + tee = tqdm_args.pop('tee', False) + manpath = tqdm_args.pop('manpath', None) + comppath = tqdm_args.pop('comppath', None) + if tqdm_args.pop('null', False): + class stdout(object): + @staticmethod + def write(_): + pass + else: + stdout = sys.stdout + stdout = getattr(stdout, 'buffer', stdout) + stdin = getattr(sys.stdin, 'buffer', sys.stdin) + if manpath or comppath: + from os import path + from shutil import copyfile + try: # py<3.7 + import importlib_resources as resources + except ImportError: + from importlib import resources + + def cp(name, dst): + """copy resource `name` to `dst`""" + if hasattr(resources, 'files'): + copyfile(str(resources.files('tqdm') / name), dst) + else: # py<3.9 + with resources.path('tqdm', name) as src: + copyfile(str(src), dst) + log.info("written:%s", dst) + if manpath is not None: + cp('tqdm.1', path.join(manpath, 'tqdm.1')) + if comppath is not None: + cp('completion.sh', path.join(comppath, 'tqdm_completion.sh')) + sys.exit(0) + if tee: + stdout_write = stdout.write + fp_write = getattr(fp, 'buffer', fp).write + + class stdout(object): # pylint: disable=function-redefined + @staticmethod + def write(x): + with tqdm.external_write_mode(file=fp): + fp_write(x) + stdout_write(x) + if delim_per_char: + tqdm_args.setdefault('unit', 'B') + tqdm_args.setdefault('unit_scale', True) + tqdm_args.setdefault('unit_divisor', 1024) + log.debug(tqdm_args) + with tqdm(**tqdm_args) as t: + posix_pipe(stdin, stdout, '', buf_size, t.update) + elif delim == b'\\n': + log.debug(tqdm_args) + write = stdout.write + if update or update_to: + with tqdm(**tqdm_args) as t: + if update: + def callback(i): + t.update(numeric(i.decode())) + else: # update_to + def callback(i): + t.update(numeric(i.decode()) - t.n) + for i in stdin: + write(i) + callback(i) + else: + for i in tqdm(stdin, **tqdm_args): + write(i) + else: + log.debug(tqdm_args) + with tqdm(**tqdm_args) as t: + callback_len = False + if update: + def callback(i): + t.update(numeric(i.decode())) + elif update_to: + def callback(i): + t.update(numeric(i.decode()) - t.n) + else: + callback = t.update + callback_len = True + posix_pipe(stdin, stdout, delim, buf_size, callback, callback_len) diff --git a/.local/lib/python3.10/site-packages/tqdm/completion.sh b/.local/lib/python3.10/site-packages/tqdm/completion.sh new file mode 100644 index 0000000000000000000000000000000000000000..9f61c7f14bb8c1f6099b9eb75dce28ece6a7ae96 --- /dev/null +++ b/.local/lib/python3.10/site-packages/tqdm/completion.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +_tqdm(){ + local cur prv + cur="${COMP_WORDS[COMP_CWORD]}" + prv="${COMP_WORDS[COMP_CWORD - 1]}" + + case ${prv} in + --bar_format|--buf_size|--colour|--comppath|--delay|--delim|--desc|--initial|--lock_args|--manpath|--maxinterval|--mininterval|--miniters|--ncols|--nrows|--position|--postfix|--smoothing|--total|--unit|--unit_divisor) + # await user input + ;; + "--log") + COMPREPLY=($(compgen -W 'CRITICAL FATAL ERROR WARN WARNING INFO DEBUG NOTSET' -- ${cur})) + ;; + *) + COMPREPLY=($(compgen -W '--ascii --bar_format --buf_size --bytes --colour --comppath --delay --delim --desc --disable --dynamic_ncols --help --initial --leave --lock_args --log --manpath --maxinterval --mininterval --miniters --ncols --nrows --null --position --postfix --smoothing --tee --total --unit --unit_divisor --unit_scale --update --update_to --version --write_bytes -h -v' -- ${cur})) + ;; + esac +} +complete -F _tqdm tqdm diff --git a/.local/lib/python3.10/site-packages/tqdm/contrib/__init__.py b/.local/lib/python3.10/site-packages/tqdm/contrib/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..0b521770732a3a1cce94ca4116af2ef978f3c6b0 --- /dev/null +++ b/.local/lib/python3.10/site-packages/tqdm/contrib/__init__.py @@ -0,0 +1,98 @@ +""" +Thin wrappers around common functions. + +Subpackages contain potentially unstable extensions. +""" +import sys +from functools import wraps + +from ..auto import tqdm as tqdm_auto +from ..std import tqdm +from ..utils import ObjectWrapper + +__author__ = {"github.com/": ["casperdcl"]} +__all__ = ['tenumerate', 'tzip', 'tmap'] + + +class DummyTqdmFile(ObjectWrapper): + """Dummy file-like that will write to tqdm""" + + def __init__(self, wrapped): + super(DummyTqdmFile, self).__init__(wrapped) + self._buf = [] + + def write(self, x, nolock=False): + nl = b"\n" if isinstance(x, bytes) else "\n" + pre, sep, post = x.rpartition(nl) + if sep: + blank = type(nl)() + tqdm.write(blank.join(self._buf + [pre, sep]), + end=blank, file=self._wrapped, nolock=nolock) + self._buf = [post] + else: + self._buf.append(x) + + def __del__(self): + if self._buf: + blank = type(self._buf[0])() + try: + tqdm.write(blank.join(self._buf), end=blank, file=self._wrapped) + except (OSError, ValueError): + pass + + +def builtin_iterable(func): + """Wraps `func()` output in a `list()` in py2""" + if sys.version_info[:1] < (3,): + @wraps(func) + def inner(*args, **kwargs): + return list(func(*args, **kwargs)) + return inner + return func + + +def tenumerate(iterable, start=0, total=None, tqdm_class=tqdm_auto, **tqdm_kwargs): + """ + Equivalent of `numpy.ndenumerate` or builtin `enumerate`. + + Parameters + ---------- + tqdm_class : [default: tqdm.auto.tqdm]. + """ + try: + import numpy as np + except ImportError: + pass + else: + if isinstance(iterable, np.ndarray): + return tqdm_class(np.ndenumerate(iterable), total=total or iterable.size, + **tqdm_kwargs) + return enumerate(tqdm_class(iterable, total=total, **tqdm_kwargs), start) + + +@builtin_iterable +def tzip(iter1, *iter2plus, **tqdm_kwargs): + """ + Equivalent of builtin `zip`. + + Parameters + ---------- + tqdm_class : [default: tqdm.auto.tqdm]. + """ + kwargs = tqdm_kwargs.copy() + tqdm_class = kwargs.pop("tqdm_class", tqdm_auto) + for i in zip(tqdm_class(iter1, **kwargs), *iter2plus): + yield i + + +@builtin_iterable +def tmap(function, *sequences, **tqdm_kwargs): + """ + Equivalent of builtin `map`. + + Parameters + ---------- + tqdm_class : [default: tqdm.auto.tqdm]. + """ + for i in tzip(*sequences, **tqdm_kwargs): + yield function(*i) diff --git a/.local/lib/python3.10/site-packages/tqdm/contrib/__pycache__/__init__.cpython-310.pyc b/.local/lib/python3.10/site-packages/tqdm/contrib/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..04a181bd8023a4dedf0ad1650c3ec8cec4fe38d2 Binary files /dev/null and b/.local/lib/python3.10/site-packages/tqdm/contrib/__pycache__/__init__.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/tqdm/contrib/__pycache__/bells.cpython-310.pyc b/.local/lib/python3.10/site-packages/tqdm/contrib/__pycache__/bells.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4ff17e16cfa4ca2c85332741ea784a6ba85659fe Binary files /dev/null and b/.local/lib/python3.10/site-packages/tqdm/contrib/__pycache__/bells.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/tqdm/contrib/__pycache__/concurrent.cpython-310.pyc b/.local/lib/python3.10/site-packages/tqdm/contrib/__pycache__/concurrent.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b47330a7ce0c822846a3451bd371bb30e0997cd4 Binary files /dev/null and b/.local/lib/python3.10/site-packages/tqdm/contrib/__pycache__/concurrent.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/tqdm/contrib/__pycache__/discord.cpython-310.pyc b/.local/lib/python3.10/site-packages/tqdm/contrib/__pycache__/discord.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..16f69f194cc05d5f435a24c1d0661fb3f4f7898d Binary files /dev/null and b/.local/lib/python3.10/site-packages/tqdm/contrib/__pycache__/discord.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/tqdm/contrib/__pycache__/itertools.cpython-310.pyc b/.local/lib/python3.10/site-packages/tqdm/contrib/__pycache__/itertools.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..54d003b70442f5f2ee531cfd4f3fa5fbd8d042a8 Binary files /dev/null and b/.local/lib/python3.10/site-packages/tqdm/contrib/__pycache__/itertools.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/tqdm/contrib/__pycache__/logging.cpython-310.pyc b/.local/lib/python3.10/site-packages/tqdm/contrib/__pycache__/logging.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d320806be438b6a17f0204be37db3d9344c91d1c Binary files /dev/null and b/.local/lib/python3.10/site-packages/tqdm/contrib/__pycache__/logging.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/tqdm/contrib/__pycache__/slack.cpython-310.pyc b/.local/lib/python3.10/site-packages/tqdm/contrib/__pycache__/slack.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4ffc31309bdf69542202b03b5e3ec22460093fd3 Binary files /dev/null and b/.local/lib/python3.10/site-packages/tqdm/contrib/__pycache__/slack.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/tqdm/contrib/__pycache__/telegram.cpython-310.pyc b/.local/lib/python3.10/site-packages/tqdm/contrib/__pycache__/telegram.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..66e93c60afa89a14d72cd085e7a94637b363769c Binary files /dev/null and b/.local/lib/python3.10/site-packages/tqdm/contrib/__pycache__/telegram.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/tqdm/contrib/__pycache__/utils_worker.cpython-310.pyc b/.local/lib/python3.10/site-packages/tqdm/contrib/__pycache__/utils_worker.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..121a7a5579dc10d96ab904d391acc05ee5f0d06e Binary files /dev/null and b/.local/lib/python3.10/site-packages/tqdm/contrib/__pycache__/utils_worker.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/tqdm/contrib/bells.py b/.local/lib/python3.10/site-packages/tqdm/contrib/bells.py new file mode 100644 index 0000000000000000000000000000000000000000..5b8f4b9ecd894f1edfaa08d9fe730b8d7c8b93e0 --- /dev/null +++ b/.local/lib/python3.10/site-packages/tqdm/contrib/bells.py @@ -0,0 +1,26 @@ +""" +Even more features than `tqdm.auto` (all the bells & whistles): + +- `tqdm.auto` +- `tqdm.tqdm.pandas` +- `tqdm.contrib.telegram` + + uses `${TQDM_TELEGRAM_TOKEN}` and `${TQDM_TELEGRAM_CHAT_ID}` +- `tqdm.contrib.discord` + + uses `${TQDM_DISCORD_TOKEN}` and `${TQDM_DISCORD_CHANNEL_ID}` +""" +__all__ = ['tqdm', 'trange'] +import warnings +from os import getenv + +if getenv("TQDM_SLACK_TOKEN") and getenv("TQDM_SLACK_CHANNEL"): + from .slack import tqdm, trange +elif getenv("TQDM_TELEGRAM_TOKEN") and getenv("TQDM_TELEGRAM_CHAT_ID"): + from .telegram import tqdm, trange +elif getenv("TQDM_DISCORD_TOKEN") and getenv("TQDM_DISCORD_CHANNEL_ID"): + from .discord import tqdm, trange +else: + from ..auto import tqdm, trange + +with warnings.catch_warnings(): + warnings.simplefilter("ignore", category=FutureWarning) + tqdm.pandas() diff --git a/.local/lib/python3.10/site-packages/tqdm/contrib/concurrent.py b/.local/lib/python3.10/site-packages/tqdm/contrib/concurrent.py new file mode 100644 index 0000000000000000000000000000000000000000..ccb5e1252939f64c1d678b2f01f1259dc4d9371a --- /dev/null +++ b/.local/lib/python3.10/site-packages/tqdm/contrib/concurrent.py @@ -0,0 +1,130 @@ +""" +Thin wrappers around `concurrent.futures`. +""" +from __future__ import absolute_import + +from contextlib import contextmanager + +from ..auto import tqdm as tqdm_auto +from ..std import TqdmWarning + +try: + from operator import length_hint +except ImportError: + def length_hint(it, default=0): + """Returns `len(it)`, falling back to `default`""" + try: + return len(it) + except TypeError: + return default +try: + from os import cpu_count +except ImportError: + try: + from multiprocessing import cpu_count + except ImportError: + def cpu_count(): + return 4 +import sys + +__author__ = {"github.com/": ["casperdcl"]} +__all__ = ['thread_map', 'process_map'] + + +@contextmanager +def ensure_lock(tqdm_class, lock_name=""): + """get (create if necessary) and then restore `tqdm_class`'s lock""" + old_lock = getattr(tqdm_class, '_lock', None) # don't create a new lock + lock = old_lock or tqdm_class.get_lock() # maybe create a new lock + lock = getattr(lock, lock_name, lock) # maybe subtype + tqdm_class.set_lock(lock) + yield lock + if old_lock is None: + del tqdm_class._lock + else: + tqdm_class.set_lock(old_lock) + + +def _executor_map(PoolExecutor, fn, *iterables, **tqdm_kwargs): + """ + Implementation of `thread_map` and `process_map`. + + Parameters + ---------- + tqdm_class : [default: tqdm.auto.tqdm]. + max_workers : [default: min(32, cpu_count() + 4)]. + chunksize : [default: 1]. + lock_name : [default: "":str]. + """ + kwargs = tqdm_kwargs.copy() + if "total" not in kwargs: + kwargs["total"] = length_hint(iterables[0]) + tqdm_class = kwargs.pop("tqdm_class", tqdm_auto) + max_workers = kwargs.pop("max_workers", min(32, cpu_count() + 4)) + chunksize = kwargs.pop("chunksize", 1) + lock_name = kwargs.pop("lock_name", "") + with ensure_lock(tqdm_class, lock_name=lock_name) as lk: + pool_kwargs = {'max_workers': max_workers} + sys_version = sys.version_info[:2] + if sys_version >= (3, 7): + # share lock in case workers are already using `tqdm` + pool_kwargs.update(initializer=tqdm_class.set_lock, initargs=(lk,)) + map_args = {} + if not (3, 0) < sys_version < (3, 5): + map_args.update(chunksize=chunksize) + with PoolExecutor(**pool_kwargs) as ex: + return list(tqdm_class(ex.map(fn, *iterables, **map_args), **kwargs)) + + +def thread_map(fn, *iterables, **tqdm_kwargs): + """ + Equivalent of `list(map(fn, *iterables))` + driven by `concurrent.futures.ThreadPoolExecutor`. + + Parameters + ---------- + tqdm_class : optional + `tqdm` class to use for bars [default: tqdm.auto.tqdm]. + max_workers : int, optional + Maximum number of workers to spawn; passed to + `concurrent.futures.ThreadPoolExecutor.__init__`. + [default: max(32, cpu_count() + 4)]. + """ + from concurrent.futures import ThreadPoolExecutor + return _executor_map(ThreadPoolExecutor, fn, *iterables, **tqdm_kwargs) + + +def process_map(fn, *iterables, **tqdm_kwargs): + """ + Equivalent of `list(map(fn, *iterables))` + driven by `concurrent.futures.ProcessPoolExecutor`. + + Parameters + ---------- + tqdm_class : optional + `tqdm` class to use for bars [default: tqdm.auto.tqdm]. + max_workers : int, optional + Maximum number of workers to spawn; passed to + `concurrent.futures.ProcessPoolExecutor.__init__`. + [default: min(32, cpu_count() + 4)]. + chunksize : int, optional + Size of chunks sent to worker processes; passed to + `concurrent.futures.ProcessPoolExecutor.map`. [default: 1]. + lock_name : str, optional + Member of `tqdm_class.get_lock()` to use [default: mp_lock]. + """ + from concurrent.futures import ProcessPoolExecutor + if iterables and "chunksize" not in tqdm_kwargs: + # default `chunksize=1` has poor performance for large iterables + # (most time spent dispatching items to workers). + longest_iterable_len = max(map(length_hint, iterables)) + if longest_iterable_len > 1000: + from warnings import warn + warn("Iterable length %d > 1000 but `chunksize` is not set." + " This may seriously degrade multiprocess performance." + " Set `chunksize=1` or more." % longest_iterable_len, + TqdmWarning, stacklevel=2) + if "lock_name" not in tqdm_kwargs: + tqdm_kwargs = tqdm_kwargs.copy() + tqdm_kwargs["lock_name"] = "mp_lock" + return _executor_map(ProcessPoolExecutor, fn, *iterables, **tqdm_kwargs) diff --git a/.local/lib/python3.10/site-packages/tqdm/contrib/discord.py b/.local/lib/python3.10/site-packages/tqdm/contrib/discord.py new file mode 100644 index 0000000000000000000000000000000000000000..0edd35ccabe5bc534b91a7b8d8356f0083732e0d --- /dev/null +++ b/.local/lib/python3.10/site-packages/tqdm/contrib/discord.py @@ -0,0 +1,125 @@ +""" +Sends updates to a Discord bot. + +Usage: +>>> from tqdm.contrib.discord import tqdm, trange +>>> for i in trange(10, token='{token}', channel_id='{channel_id}'): +... ... + +![screenshot](https://img.tqdm.ml/screenshot-discord.png) +""" +from __future__ import absolute_import + +import logging +from os import getenv + +try: + from disco.client import Client, ClientConfig +except ImportError: + raise ImportError("Please `pip install disco-py`") + +from ..auto import tqdm as tqdm_auto +from ..utils import _range +from .utils_worker import MonoWorker + +__author__ = {"github.com/": ["casperdcl"]} +__all__ = ['DiscordIO', 'tqdm_discord', 'tdrange', 'tqdm', 'trange'] + + +class DiscordIO(MonoWorker): + """Non-blocking file-like IO using a Discord Bot.""" + def __init__(self, token, channel_id): + """Creates a new message in the given `channel_id`.""" + super(DiscordIO, self).__init__() + config = ClientConfig() + config.token = token + client = Client(config) + self.text = self.__class__.__name__ + try: + self.message = client.api.channels_messages_create(channel_id, self.text) + except Exception as e: + tqdm_auto.write(str(e)) + self.message = None + + def write(self, s): + """Replaces internal `message`'s text with `s`.""" + if not s: + s = "..." + s = s.replace('\r', '').strip() + if s == self.text: + return # skip duplicate message + message = self.message + if message is None: + return + self.text = s + try: + future = self.submit(message.edit, '`' + s + '`') + except Exception as e: + tqdm_auto.write(str(e)) + else: + return future + + +class tqdm_discord(tqdm_auto): + """ + Standard `tqdm.auto.tqdm` but also sends updates to a Discord Bot. + May take a few seconds to create (`__init__`). + + - create a discord bot (not public, no requirement of OAuth2 code + grant, only send message permissions) & invite it to a channel: + + - copy the bot `{token}` & `{channel_id}` and paste below + + >>> from tqdm.contrib.discord import tqdm, trange + >>> for i in tqdm(iterable, token='{token}', channel_id='{channel_id}'): + ... ... + """ + def __init__(self, *args, **kwargs): + """ + Parameters + ---------- + token : str, required. Discord token + [default: ${TQDM_DISCORD_TOKEN}]. + channel_id : int, required. Discord channel ID + [default: ${TQDM_DISCORD_CHANNEL_ID}]. + mininterval : float, optional. + Minimum of [default: 1.5] to avoid rate limit. + + See `tqdm.auto.tqdm.__init__` for other parameters. + """ + if not kwargs.get('disable'): + kwargs = kwargs.copy() + logging.getLogger("HTTPClient").setLevel(logging.WARNING) + self.dio = DiscordIO( + kwargs.pop('token', getenv("TQDM_DISCORD_TOKEN")), + kwargs.pop('channel_id', getenv("TQDM_DISCORD_CHANNEL_ID"))) + kwargs['mininterval'] = max(1.5, kwargs.get('mininterval', 1.5)) + super(tqdm_discord, self).__init__(*args, **kwargs) + + def display(self, **kwargs): + super(tqdm_discord, self).display(**kwargs) + fmt = self.format_dict + if fmt.get('bar_format', None): + fmt['bar_format'] = fmt['bar_format'].replace( + '', '{bar:10u}').replace('{bar}', '{bar:10u}') + else: + fmt['bar_format'] = '{l_bar}{bar:10u}{r_bar}' + self.dio.write(self.format_meter(**fmt)) + + def clear(self, *args, **kwargs): + super(tqdm_discord, self).clear(*args, **kwargs) + if not self.disable: + self.dio.write("") + + +def tdrange(*args, **kwargs): + """ + A shortcut for `tqdm.contrib.discord.tqdm(xrange(*args), **kwargs)`. + On Python3+, `range` is used instead of `xrange`. + """ + return tqdm_discord(_range(*args), **kwargs) + + +# Aliases +tqdm = tqdm_discord +trange = tdrange diff --git a/.local/lib/python3.10/site-packages/tqdm/contrib/itertools.py b/.local/lib/python3.10/site-packages/tqdm/contrib/itertools.py new file mode 100644 index 0000000000000000000000000000000000000000..5f22505a2c3e21dc71b9f650981860ba6761650d --- /dev/null +++ b/.local/lib/python3.10/site-packages/tqdm/contrib/itertools.py @@ -0,0 +1,37 @@ +""" +Thin wrappers around `itertools`. +""" +from __future__ import absolute_import + +import itertools + +from ..auto import tqdm as tqdm_auto + +__author__ = {"github.com/": ["casperdcl"]} +__all__ = ['product'] + + +def product(*iterables, **tqdm_kwargs): + """ + Equivalent of `itertools.product`. + + Parameters + ---------- + tqdm_class : [default: tqdm.auto.tqdm]. + """ + kwargs = tqdm_kwargs.copy() + tqdm_class = kwargs.pop("tqdm_class", tqdm_auto) + try: + lens = list(map(len, iterables)) + except TypeError: + total = None + else: + total = 1 + for i in lens: + total *= i + kwargs.setdefault("total", total) + with tqdm_class(**kwargs) as t: + it = itertools.product(*iterables) + for i in it: + yield i + t.update() diff --git a/.local/lib/python3.10/site-packages/tqdm/contrib/logging.py b/.local/lib/python3.10/site-packages/tqdm/contrib/logging.py new file mode 100644 index 0000000000000000000000000000000000000000..cd9925ec1355bb9e5076a8f4486c3d705719ea0d --- /dev/null +++ b/.local/lib/python3.10/site-packages/tqdm/contrib/logging.py @@ -0,0 +1,128 @@ +""" +Helper functionality for interoperability with stdlib `logging`. +""" +from __future__ import absolute_import + +import logging +import sys +from contextlib import contextmanager + +try: + from typing import Iterator, List, Optional, Type # pylint: disable=unused-import +except ImportError: + pass + +from ..std import tqdm as std_tqdm + + +class _TqdmLoggingHandler(logging.StreamHandler): + def __init__( + self, + tqdm_class=std_tqdm # type: Type[std_tqdm] + ): + super(_TqdmLoggingHandler, self).__init__() + self.tqdm_class = tqdm_class + + def emit(self, record): + try: + msg = self.format(record) + self.tqdm_class.write(msg, file=self.stream) + self.flush() + except (KeyboardInterrupt, SystemExit): + raise + except: # noqa pylint: disable=bare-except + self.handleError(record) + + +def _is_console_logging_handler(handler): + return (isinstance(handler, logging.StreamHandler) + and handler.stream in {sys.stdout, sys.stderr}) + + +def _get_first_found_console_logging_handler(handlers): + for handler in handlers: + if _is_console_logging_handler(handler): + return handler + + +@contextmanager +def logging_redirect_tqdm( + loggers=None, # type: Optional[List[logging.Logger]], + tqdm_class=std_tqdm # type: Type[std_tqdm] +): + # type: (...) -> Iterator[None] + """ + Context manager redirecting console logging to `tqdm.write()`, leaving + other logging handlers (e.g. log files) unaffected. + + Parameters + ---------- + loggers : list, optional + Which handlers to redirect (default: [logging.root]). + tqdm_class : optional + + Example + ------- + ```python + import logging + from tqdm import trange + from tqdm.contrib.logging import logging_redirect_tqdm + + LOG = logging.getLogger(__name__) + + if __name__ == '__main__': + logging.basicConfig(level=logging.INFO) + with logging_redirect_tqdm(): + for i in trange(9): + if i == 4: + LOG.info("console logging redirected to `tqdm.write()`") + # logging restored + ``` + """ + if loggers is None: + loggers = [logging.root] + original_handlers_list = [logger.handlers for logger in loggers] + try: + for logger in loggers: + tqdm_handler = _TqdmLoggingHandler(tqdm_class) + orig_handler = _get_first_found_console_logging_handler(logger.handlers) + if orig_handler is not None: + tqdm_handler.setFormatter(orig_handler.formatter) + tqdm_handler.stream = orig_handler.stream + logger.handlers = [ + handler for handler in logger.handlers + if not _is_console_logging_handler(handler)] + [tqdm_handler] + yield + finally: + for logger, original_handlers in zip(loggers, original_handlers_list): + logger.handlers = original_handlers + + +@contextmanager +def tqdm_logging_redirect( + *args, + # loggers=None, # type: Optional[List[logging.Logger]] + # tqdm=None, # type: Optional[Type[tqdm.tqdm]] + **kwargs +): + # type: (...) -> Iterator[None] + """ + Convenience shortcut for: + ```python + with tqdm_class(*args, **tqdm_kwargs) as pbar: + with logging_redirect_tqdm(loggers=loggers, tqdm_class=tqdm_class): + yield pbar + ``` + + Parameters + ---------- + tqdm_class : optional, (default: tqdm.std.tqdm). + loggers : optional, list. + **tqdm_kwargs : passed to `tqdm_class`. + """ + tqdm_kwargs = kwargs.copy() + loggers = tqdm_kwargs.pop('loggers', None) + tqdm_class = tqdm_kwargs.pop('tqdm_class', std_tqdm) + with tqdm_class(*args, **tqdm_kwargs) as pbar: + with logging_redirect_tqdm(loggers=loggers, tqdm_class=tqdm_class): + yield pbar diff --git a/.local/lib/python3.10/site-packages/tqdm/contrib/slack.py b/.local/lib/python3.10/site-packages/tqdm/contrib/slack.py new file mode 100644 index 0000000000000000000000000000000000000000..b478d9236ee4fb835285a0f5d673efb57ca1f7bc --- /dev/null +++ b/.local/lib/python3.10/site-packages/tqdm/contrib/slack.py @@ -0,0 +1,126 @@ +""" +Sends updates to a Slack app. + +Usage: +>>> from tqdm.contrib.slack import tqdm, trange +>>> for i in trange(10, token='{token}', channel='{channel}'): +... ... + +![screenshot](https://img.tqdm.ml/screenshot-slack.png) +""" +from __future__ import absolute_import + +import logging +from os import getenv + +try: + from slack_sdk import WebClient +except ImportError: + raise ImportError("Please `pip install slack-sdk`") + +from ..auto import tqdm as tqdm_auto +from ..utils import _range +from .utils_worker import MonoWorker + +__author__ = {"github.com/": ["0x2b3bfa0", "casperdcl"]} +__all__ = ['SlackIO', 'tqdm_slack', 'tsrange', 'tqdm', 'trange'] + + +class SlackIO(MonoWorker): + """Non-blocking file-like IO using a Slack app.""" + def __init__(self, token, channel): + """Creates a new message in the given `channel`.""" + super(SlackIO, self).__init__() + self.client = WebClient(token=token) + self.text = self.__class__.__name__ + try: + self.message = self.client.chat_postMessage(channel=channel, text=self.text) + except Exception as e: + tqdm_auto.write(str(e)) + self.message = None + + def write(self, s): + """Replaces internal `message`'s text with `s`.""" + if not s: + s = "..." + s = s.replace('\r', '').strip() + if s == self.text: + return # skip duplicate message + message = self.message + if message is None: + return + self.text = s + try: + future = self.submit(self.client.chat_update, channel=message['channel'], + ts=message['ts'], text='`' + s + '`') + except Exception as e: + tqdm_auto.write(str(e)) + else: + return future + + +class tqdm_slack(tqdm_auto): + """ + Standard `tqdm.auto.tqdm` but also sends updates to a Slack app. + May take a few seconds to create (`__init__`). + + - create a Slack app with the `chat:write` scope & invite it to a + channel: + - copy the bot `{token}` & `{channel}` and paste below + >>> from tqdm.contrib.slack import tqdm, trange + >>> for i in tqdm(iterable, token='{token}', channel='{channel}'): + ... ... + """ + def __init__(self, *args, **kwargs): + """ + Parameters + ---------- + token : str, required. Slack token + [default: ${TQDM_SLACK_TOKEN}]. + channel : int, required. Slack channel + [default: ${TQDM_SLACK_CHANNEL}]. + mininterval : float, optional. + Minimum of [default: 1.5] to avoid rate limit. + + See `tqdm.auto.tqdm.__init__` for other parameters. + """ + if not kwargs.get('disable'): + kwargs = kwargs.copy() + logging.getLogger("HTTPClient").setLevel(logging.WARNING) + self.sio = SlackIO( + kwargs.pop('token', getenv("TQDM_SLACK_TOKEN")), + kwargs.pop('channel', getenv("TQDM_SLACK_CHANNEL"))) + kwargs['mininterval'] = max(1.5, kwargs.get('mininterval', 1.5)) + super(tqdm_slack, self).__init__(*args, **kwargs) + + def display(self, **kwargs): + super(tqdm_slack, self).display(**kwargs) + fmt = self.format_dict + if fmt.get('bar_format', None): + fmt['bar_format'] = fmt['bar_format'].replace( + '', '`{bar:10}`').replace('{bar}', '`{bar:10u}`') + else: + fmt['bar_format'] = '{l_bar}`{bar:10}`{r_bar}' + if fmt['ascii'] is False: + fmt['ascii'] = [":black_square:", ":small_blue_diamond:", ":large_blue_diamond:", + ":large_blue_square:"] + fmt['ncols'] = 336 + self.sio.write(self.format_meter(**fmt)) + + def clear(self, *args, **kwargs): + super(tqdm_slack, self).clear(*args, **kwargs) + if not self.disable: + self.sio.write("") + + +def tsrange(*args, **kwargs): + """ + A shortcut for `tqdm.contrib.slack.tqdm(xrange(*args), **kwargs)`. + On Python3+, `range` is used instead of `xrange`. + """ + return tqdm_slack(_range(*args), **kwargs) + + +# Aliases +tqdm = tqdm_slack +trange = tsrange diff --git a/.local/lib/python3.10/site-packages/tqdm/contrib/telegram.py b/.local/lib/python3.10/site-packages/tqdm/contrib/telegram.py new file mode 100644 index 0000000000000000000000000000000000000000..99cbe8c88850886ed9d9313c89c09f0e39922341 --- /dev/null +++ b/.local/lib/python3.10/site-packages/tqdm/contrib/telegram.py @@ -0,0 +1,159 @@ +""" +Sends updates to a Telegram bot. + +Usage: +>>> from tqdm.contrib.telegram import tqdm, trange +>>> for i in trange(10, token='{token}', chat_id='{chat_id}'): +... ... + +![screenshot](https://img.tqdm.ml/screenshot-telegram.gif) +""" +from __future__ import absolute_import + +from os import getenv +from warnings import warn + +from requests import Session + +from ..auto import tqdm as tqdm_auto +from ..std import TqdmWarning +from ..utils import _range +from .utils_worker import MonoWorker + +__author__ = {"github.com/": ["casperdcl"]} +__all__ = ['TelegramIO', 'tqdm_telegram', 'ttgrange', 'tqdm', 'trange'] + + +class TelegramIO(MonoWorker): + """Non-blocking file-like IO using a Telegram Bot.""" + API = 'https://api.telegram.org/bot' + + def __init__(self, token, chat_id): + """Creates a new message in the given `chat_id`.""" + super(TelegramIO, self).__init__() + self.token = token + self.chat_id = chat_id + self.session = Session() + self.text = self.__class__.__name__ + self.message_id + + @property + def message_id(self): + if hasattr(self, '_message_id'): + return self._message_id + try: + res = self.session.post( + self.API + '%s/sendMessage' % self.token, + data={'text': '`' + self.text + '`', 'chat_id': self.chat_id, + 'parse_mode': 'MarkdownV2'}).json() + except Exception as e: + tqdm_auto.write(str(e)) + else: + if res.get('error_code') == 429: + warn("Creation rate limit: try increasing `mininterval`.", + TqdmWarning, stacklevel=2) + else: + self._message_id = res['result']['message_id'] + return self._message_id + + def write(self, s): + """Replaces internal `message_id`'s text with `s`.""" + if not s: + s = "..." + s = s.replace('\r', '').strip() + if s == self.text: + return # avoid duplicate message Bot error + message_id = self.message_id + if message_id is None: + return + self.text = s + try: + future = self.submit( + self.session.post, self.API + '%s/editMessageText' % self.token, + data={'text': '`' + s + '`', 'chat_id': self.chat_id, + 'message_id': message_id, 'parse_mode': 'MarkdownV2'}) + except Exception as e: + tqdm_auto.write(str(e)) + else: + return future + + def delete(self): + """Deletes internal `message_id`.""" + try: + future = self.submit( + self.session.post, self.API + '%s/deleteMessage' % self.token, + data={'chat_id': self.chat_id, 'message_id': self.message_id}) + except Exception as e: + tqdm_auto.write(str(e)) + else: + return future + + +class tqdm_telegram(tqdm_auto): + """ + Standard `tqdm.auto.tqdm` but also sends updates to a Telegram Bot. + May take a few seconds to create (`__init__`). + + - create a bot + - copy its `{token}` + - add the bot to a chat and send it a message such as `/start` + - go to to find out + the `{chat_id}` + - paste the `{token}` & `{chat_id}` below + + >>> from tqdm.contrib.telegram import tqdm, trange + >>> for i in tqdm(iterable, token='{token}', chat_id='{chat_id}'): + ... ... + """ + def __init__(self, *args, **kwargs): + """ + Parameters + ---------- + token : str, required. Telegram token + [default: ${TQDM_TELEGRAM_TOKEN}]. + chat_id : str, required. Telegram chat ID + [default: ${TQDM_TELEGRAM_CHAT_ID}]. + + See `tqdm.auto.tqdm.__init__` for other parameters. + """ + if not kwargs.get('disable'): + kwargs = kwargs.copy() + self.tgio = TelegramIO( + kwargs.pop('token', getenv('TQDM_TELEGRAM_TOKEN')), + kwargs.pop('chat_id', getenv('TQDM_TELEGRAM_CHAT_ID'))) + super(tqdm_telegram, self).__init__(*args, **kwargs) + + def display(self, **kwargs): + super(tqdm_telegram, self).display(**kwargs) + fmt = self.format_dict + if fmt.get('bar_format', None): + fmt['bar_format'] = fmt['bar_format'].replace( + '', '{bar:10u}').replace('{bar}', '{bar:10u}') + else: + fmt['bar_format'] = '{l_bar}{bar:10u}{r_bar}' + self.tgio.write(self.format_meter(**fmt)) + + def clear(self, *args, **kwargs): + super(tqdm_telegram, self).clear(*args, **kwargs) + if not self.disable: + self.tgio.write("") + + def close(self): + if self.disable: + return + super(tqdm_telegram, self).close() + if not (self.leave or (self.leave is None and self.pos == 0)): + self.tgio.delete() + + +def ttgrange(*args, **kwargs): + """ + A shortcut for `tqdm.contrib.telegram.tqdm(xrange(*args), **kwargs)`. + On Python3+, `range` is used instead of `xrange`. + """ + return tqdm_telegram(_range(*args), **kwargs) + + +# Aliases +tqdm = tqdm_telegram +trange = ttgrange diff --git a/.local/lib/python3.10/site-packages/tqdm/contrib/utils_worker.py b/.local/lib/python3.10/site-packages/tqdm/contrib/utils_worker.py new file mode 100644 index 0000000000000000000000000000000000000000..17adda6678bb44782390a3db086dcd3da36b5ef3 --- /dev/null +++ b/.local/lib/python3.10/site-packages/tqdm/contrib/utils_worker.py @@ -0,0 +1,40 @@ +""" +IO/concurrency helpers for `tqdm.contrib`. +""" +from __future__ import absolute_import + +from collections import deque +from concurrent.futures import ThreadPoolExecutor + +from ..auto import tqdm as tqdm_auto + +__author__ = {"github.com/": ["casperdcl"]} +__all__ = ['MonoWorker'] + + +class MonoWorker(object): + """ + Supports one running task and one waiting task. + The waiting task is the most recent submitted (others are discarded). + """ + def __init__(self): + self.pool = ThreadPoolExecutor(max_workers=1) + self.futures = deque([], 2) + + def submit(self, func, *args, **kwargs): + """`func(*args, **kwargs)` may replace currently waiting task.""" + futures = self.futures + if len(futures) == futures.maxlen: + running = futures.popleft() + if not running.done(): + if len(futures): # clear waiting + waiting = futures.pop() + waiting.cancel() + futures.appendleft(running) # re-insert running + try: + waiting = self.pool.submit(func, *args, **kwargs) + except Exception as e: + tqdm_auto.write(str(e)) + else: + futures.append(waiting) + return waiting diff --git a/.local/lib/python3.10/site-packages/tqdm/dask.py b/.local/lib/python3.10/site-packages/tqdm/dask.py new file mode 100644 index 0000000000000000000000000000000000000000..6fc7504c79a37872388a99e2abe498e9e9c5b41a --- /dev/null +++ b/.local/lib/python3.10/site-packages/tqdm/dask.py @@ -0,0 +1,46 @@ +from __future__ import absolute_import + +from functools import partial + +from dask.callbacks import Callback + +from .auto import tqdm as tqdm_auto + +__author__ = {"github.com/": ["casperdcl"]} +__all__ = ['TqdmCallback'] + + +class TqdmCallback(Callback): + """Dask callback for task progress.""" + def __init__(self, start=None, pretask=None, tqdm_class=tqdm_auto, + **tqdm_kwargs): + """ + Parameters + ---------- + tqdm_class : optional + `tqdm` class to use for bars [default: `tqdm.auto.tqdm`]. + tqdm_kwargs : optional + Any other arguments used for all bars. + """ + super(TqdmCallback, self).__init__(start=start, pretask=pretask) + if tqdm_kwargs: + tqdm_class = partial(tqdm_class, **tqdm_kwargs) + self.tqdm_class = tqdm_class + + def _start_state(self, _, state): + self.pbar = self.tqdm_class(total=sum( + len(state[k]) for k in ['ready', 'waiting', 'running', 'finished'])) + + def _posttask(self, *_, **__): + self.pbar.update() + + def _finish(self, *_, **__): + self.pbar.close() + + def display(self): + """Displays in the current cell in Notebooks.""" + container = getattr(self.bar, 'container', None) + if container is None: + return + from .notebook import display + display(container) diff --git a/.local/lib/python3.10/site-packages/tqdm/gui.py b/.local/lib/python3.10/site-packages/tqdm/gui.py new file mode 100644 index 0000000000000000000000000000000000000000..4612701d2a4dd7ab0175f3f8924c9d600d9a7220 --- /dev/null +++ b/.local/lib/python3.10/site-packages/tqdm/gui.py @@ -0,0 +1,191 @@ +""" +Matplotlib GUI progressbar decorator for iterators. + +Usage: +>>> from tqdm.gui import trange, tqdm +>>> for i in trange(10): +... ... +""" +# future division is important to divide integers and get as +# a result precise floating numbers (instead of truncated int) +from __future__ import absolute_import, division + +import re +from warnings import warn + +# to inherit from the tqdm class +from .std import TqdmExperimentalWarning +from .std import tqdm as std_tqdm +# import compatibility functions and utilities +from .utils import _range + +__author__ = {"github.com/": ["casperdcl", "lrq3000"]} +__all__ = ['tqdm_gui', 'tgrange', 'tqdm', 'trange'] + + +class tqdm_gui(std_tqdm): # pragma: no cover + """Experimental Matplotlib GUI version of tqdm!""" + # TODO: @classmethod: write() on GUI? + def __init__(self, *args, **kwargs): + from collections import deque + + import matplotlib as mpl + import matplotlib.pyplot as plt + kwargs = kwargs.copy() + kwargs['gui'] = True + colour = kwargs.pop('colour', 'g') + super(tqdm_gui, self).__init__(*args, **kwargs) + + if self.disable: + return + + warn("GUI is experimental/alpha", TqdmExperimentalWarning, stacklevel=2) + self.mpl = mpl + self.plt = plt + + # Remember if external environment uses toolbars + self.toolbar = self.mpl.rcParams['toolbar'] + self.mpl.rcParams['toolbar'] = 'None' + + self.mininterval = max(self.mininterval, 0.5) + self.fig, ax = plt.subplots(figsize=(9, 2.2)) + # self.fig.subplots_adjust(bottom=0.2) + total = self.__len__() # avoids TypeError on None #971 + if total is not None: + self.xdata = [] + self.ydata = [] + self.zdata = [] + else: + self.xdata = deque([]) + self.ydata = deque([]) + self.zdata = deque([]) + self.line1, = ax.plot(self.xdata, self.ydata, color='b') + self.line2, = ax.plot(self.xdata, self.zdata, color='k') + ax.set_ylim(0, 0.001) + if total is not None: + ax.set_xlim(0, 100) + ax.set_xlabel("percent") + self.fig.legend((self.line1, self.line2), ("cur", "est"), + loc='center right') + # progressbar + self.hspan = plt.axhspan(0, 0.001, xmin=0, xmax=0, color=colour) + else: + # ax.set_xlim(-60, 0) + ax.set_xlim(0, 60) + ax.invert_xaxis() + ax.set_xlabel("seconds") + ax.legend(("cur", "est"), loc='lower left') + ax.grid() + # ax.set_xlabel('seconds') + ax.set_ylabel((self.unit if self.unit else "it") + "/s") + if self.unit_scale: + plt.ticklabel_format(style='sci', axis='y', scilimits=(0, 0)) + ax.yaxis.get_offset_text().set_x(-0.15) + + # Remember if external environment is interactive + self.wasion = plt.isinteractive() + plt.ion() + self.ax = ax + + def close(self): + if self.disable: + return + + self.disable = True + + with self.get_lock(): + self._instances.remove(self) + + # Restore toolbars + self.mpl.rcParams['toolbar'] = self.toolbar + # Return to non-interactive mode + if not self.wasion: + self.plt.ioff() + if self.leave: + self.display() + else: + self.plt.close(self.fig) + + def clear(self, *_, **__): + pass + + def display(self, *_, **__): + n = self.n + cur_t = self._time() + elapsed = cur_t - self.start_t + delta_it = n - self.last_print_n + delta_t = cur_t - self.last_print_t + + # Inline due to multiple calls + total = self.total + xdata = self.xdata + ydata = self.ydata + zdata = self.zdata + ax = self.ax + line1 = self.line1 + line2 = self.line2 + # instantaneous rate + y = delta_it / delta_t + # overall rate + z = n / elapsed + # update line data + xdata.append(n * 100.0 / total if total else cur_t) + ydata.append(y) + zdata.append(z) + + # Discard old values + # xmin, xmax = ax.get_xlim() + # if (not total) and elapsed > xmin * 1.1: + if (not total) and elapsed > 66: + xdata.popleft() + ydata.popleft() + zdata.popleft() + + ymin, ymax = ax.get_ylim() + if y > ymax or z > ymax: + ymax = 1.1 * y + ax.set_ylim(ymin, ymax) + ax.figure.canvas.draw() + + if total: + line1.set_data(xdata, ydata) + line2.set_data(xdata, zdata) + try: + poly_lims = self.hspan.get_xy() + except AttributeError: + self.hspan = self.plt.axhspan(0, 0.001, xmin=0, xmax=0, color='g') + poly_lims = self.hspan.get_xy() + poly_lims[0, 1] = ymin + poly_lims[1, 1] = ymax + poly_lims[2] = [n / total, ymax] + poly_lims[3] = [poly_lims[2, 0], ymin] + if len(poly_lims) > 4: + poly_lims[4, 1] = ymin + self.hspan.set_xy(poly_lims) + else: + t_ago = [cur_t - i for i in xdata] + line1.set_data(t_ago, ydata) + line2.set_data(t_ago, zdata) + + d = self.format_dict + # remove {bar} + d['bar_format'] = (d['bar_format'] or "{l_bar}{r_bar}").replace( + "{bar}", "") + msg = self.format_meter(**d) + if '' in msg: + msg = "".join(re.split(r'\|?\|?', msg, 1)) + ax.set_title(msg, fontname="DejaVu Sans Mono", fontsize=11) + self.plt.pause(1e-9) + + +def tgrange(*args, **kwargs): + """ + A shortcut for `tqdm.gui.tqdm(xrange(*args), **kwargs)`. + On Python3+, `range` is used instead of `xrange`. + """ + return tqdm_gui(_range(*args), **kwargs) + + +# Aliases +tqdm = tqdm_gui +trange = tgrange diff --git a/.local/lib/python3.10/site-packages/tqdm/keras.py b/.local/lib/python3.10/site-packages/tqdm/keras.py new file mode 100644 index 0000000000000000000000000000000000000000..523e62e94753523f52ebc0a704240c4095321e44 --- /dev/null +++ b/.local/lib/python3.10/site-packages/tqdm/keras.py @@ -0,0 +1,124 @@ +from __future__ import absolute_import, division + +from copy import copy +from functools import partial + +from .auto import tqdm as tqdm_auto + +try: + import keras +except (ImportError, AttributeError) as e: + try: + from tensorflow import keras + except ImportError: + raise e +__author__ = {"github.com/": ["casperdcl"]} +__all__ = ['TqdmCallback'] + + +class TqdmCallback(keras.callbacks.Callback): + """Keras callback for epoch and batch progress.""" + @staticmethod + def bar2callback(bar, pop=None, delta=(lambda logs: 1)): + def callback(_, logs=None): + n = delta(logs) + if logs: + if pop: + logs = copy(logs) + [logs.pop(i, 0) for i in pop] + bar.set_postfix(logs, refresh=False) + bar.update(n) + + return callback + + def __init__(self, epochs=None, data_size=None, batch_size=None, verbose=1, + tqdm_class=tqdm_auto, **tqdm_kwargs): + """ + Parameters + ---------- + epochs : int, optional + data_size : int, optional + Number of training pairs. + batch_size : int, optional + Number of training pairs per batch. + verbose : int + 0: epoch, 1: batch (transient), 2: batch. [default: 1]. + Will be set to `0` unless both `data_size` and `batch_size` + are given. + tqdm_class : optional + `tqdm` class to use for bars [default: `tqdm.auto.tqdm`]. + tqdm_kwargs : optional + Any other arguments used for all bars. + """ + if tqdm_kwargs: + tqdm_class = partial(tqdm_class, **tqdm_kwargs) + self.tqdm_class = tqdm_class + self.epoch_bar = tqdm_class(total=epochs, unit='epoch') + self.on_epoch_end = self.bar2callback(self.epoch_bar) + if data_size and batch_size: + self.batches = batches = (data_size + batch_size - 1) // batch_size + else: + self.batches = batches = None + self.verbose = verbose + if verbose == 1: + self.batch_bar = tqdm_class(total=batches, unit='batch', leave=False) + self.on_batch_end = self.bar2callback( + self.batch_bar, pop=['batch', 'size'], + delta=lambda logs: logs.get('size', 1)) + + def on_train_begin(self, *_, **__): + params = self.params.get + auto_total = params('epochs', params('nb_epoch', None)) + if auto_total is not None and auto_total != self.epoch_bar.total: + self.epoch_bar.reset(total=auto_total) + + def on_epoch_begin(self, epoch, *_, **__): + if self.epoch_bar.n < epoch: + ebar = self.epoch_bar + ebar.n = ebar.last_print_n = ebar.initial = epoch + if self.verbose: + params = self.params.get + total = params('samples', params( + 'nb_sample', params('steps', None))) or self.batches + if self.verbose == 2: + if hasattr(self, 'batch_bar'): + self.batch_bar.close() + self.batch_bar = self.tqdm_class( + total=total, unit='batch', leave=True, + unit_scale=1 / (params('batch_size', 1) or 1)) + self.on_batch_end = self.bar2callback( + self.batch_bar, pop=['batch', 'size'], + delta=lambda logs: logs.get('size', 1)) + elif self.verbose == 1: + self.batch_bar.unit_scale = 1 / (params('batch_size', 1) or 1) + self.batch_bar.reset(total=total) + else: + raise KeyError('Unknown verbosity') + + def on_train_end(self, *_, **__): + if self.verbose: + self.batch_bar.close() + self.epoch_bar.close() + + def display(self): + """Displays in the current cell in Notebooks.""" + container = getattr(self.epoch_bar, 'container', None) + if container is None: + return + from .notebook import display + display(container) + batch_bar = getattr(self, 'batch_bar', None) + if batch_bar is not None: + display(batch_bar.container) + + @staticmethod + def _implements_train_batch_hooks(): + return True + + @staticmethod + def _implements_test_batch_hooks(): + return True + + @staticmethod + def _implements_predict_batch_hooks(): + return True diff --git a/.local/lib/python3.10/site-packages/tqdm/notebook.py b/.local/lib/python3.10/site-packages/tqdm/notebook.py new file mode 100644 index 0000000000000000000000000000000000000000..ffd0947833ffbd89e644326c40129be9a43fad61 --- /dev/null +++ b/.local/lib/python3.10/site-packages/tqdm/notebook.py @@ -0,0 +1,329 @@ +""" +IPython/Jupyter Notebook progressbar decorator for iterators. +Includes a default `range` iterator printing to `stderr`. + +Usage: +>>> from tqdm.notebook import trange, tqdm +>>> for i in trange(10): +... ... +""" +# future division is important to divide integers and get as +# a result precise floating numbers (instead of truncated int) +from __future__ import absolute_import, division + +# import compatibility functions and utilities +import re +import sys +from weakref import proxy + +# to inherit from the tqdm class +from .std import tqdm as std_tqdm +from .utils import _range + +if True: # pragma: no cover + # import IPython/Jupyter base widget and display utilities + IPY = 0 + try: # IPython 4.x + import ipywidgets + IPY = 4 + except ImportError: # IPython 3.x / 2.x + IPY = 32 + import warnings + with warnings.catch_warnings(): + warnings.filterwarnings( + 'ignore', message=".*The `IPython.html` package has been deprecated.*") + try: + import IPython.html.widgets as ipywidgets # NOQA: F401 + except ImportError: + pass + + try: # IPython 4.x / 3.x + if IPY == 32: + from IPython.html.widgets import HTML + from IPython.html.widgets import FloatProgress as IProgress + from IPython.html.widgets import HBox + IPY = 3 + else: + from ipywidgets import HTML + from ipywidgets import FloatProgress as IProgress + from ipywidgets import HBox + except ImportError: + try: # IPython 2.x + from IPython.html.widgets import HTML + from IPython.html.widgets import ContainerWidget as HBox + from IPython.html.widgets import FloatProgressWidget as IProgress + IPY = 2 + except ImportError: + IPY = 0 + IProgress = None + HBox = object + + try: + from IPython.display import display # , clear_output + except ImportError: + pass + + # HTML encoding + try: # Py3 + from html import escape + except ImportError: # Py2 + from cgi import escape + +__author__ = {"github.com/": ["lrq3000", "casperdcl", "alexanderkuk"]} +__all__ = ['tqdm_notebook', 'tnrange', 'tqdm', 'trange'] +WARN_NOIPYW = ("IProgress not found. Please update jupyter and ipywidgets." + " See https://ipywidgets.readthedocs.io/en/stable" + "/user_install.html") + + +class TqdmHBox(HBox): + """`ipywidgets.HBox` with a pretty representation""" + def _json_(self, pretty=None): + pbar = getattr(self, 'pbar', None) + if pbar is None: + return {} + d = pbar.format_dict + if pretty is not None: + d["ascii"] = not pretty + return d + + def __repr__(self, pretty=False): + pbar = getattr(self, 'pbar', None) + if pbar is None: + return super(TqdmHBox, self).__repr__() + return pbar.format_meter(**self._json_(pretty)) + + def _repr_pretty_(self, pp, *_, **__): + pp.text(self.__repr__(True)) + + +class tqdm_notebook(std_tqdm): + """ + Experimental IPython/Jupyter Notebook widget using tqdm! + """ + @staticmethod + def status_printer(_, total=None, desc=None, ncols=None): + """ + Manage the printing of an IPython/Jupyter Notebook progress bar widget. + """ + # Fallback to text bar if there's no total + # DEPRECATED: replaced with an 'info' style bar + # if not total: + # return super(tqdm_notebook, tqdm_notebook).status_printer(file) + + # fp = file + + # Prepare IPython progress bar + if IProgress is None: # #187 #451 #558 #872 + raise ImportError(WARN_NOIPYW) + if total: + pbar = IProgress(min=0, max=total) + else: # No total? Show info style bar with no progress tqdm status + pbar = IProgress(min=0, max=1) + pbar.value = 1 + pbar.bar_style = 'info' + if ncols is None: + pbar.layout.width = "20px" + + ltext = HTML() + rtext = HTML() + if desc: + ltext.value = desc + container = TqdmHBox(children=[ltext, pbar, rtext]) + # Prepare layout + if ncols is not None: # use default style of ipywidgets + # ncols could be 100, "100px", "100%" + ncols = str(ncols) # ipywidgets only accepts string + try: + if int(ncols) > 0: # isnumeric and positive + ncols += 'px' + except ValueError: + pass + pbar.layout.flex = '2' + container.layout.width = ncols + container.layout.display = 'inline-flex' + container.layout.flex_flow = 'row wrap' + + return container + + def display(self, msg=None, pos=None, + # additional signals + close=False, bar_style=None, check_delay=True): + # Note: contrary to native tqdm, msg='' does NOT clear bar + # goal is to keep all infos if error happens so user knows + # at which iteration the loop failed. + + # Clear previous output (really necessary?) + # clear_output(wait=1) + + if not msg and not close: + d = self.format_dict + # remove {bar} + d['bar_format'] = (d['bar_format'] or "{l_bar}{r_bar}").replace( + "{bar}", "") + msg = self.format_meter(**d) + + ltext, pbar, rtext = self.container.children + pbar.value = self.n + + if msg: + # html escape special characters (like '&') + if '' in msg: + left, right = map(escape, re.split(r'\|?\|?', msg, 1)) + else: + left, right = '', escape(msg) + + # Update description + ltext.value = left + # never clear the bar (signal: msg='') + if right: + rtext.value = right + + # Change bar style + if bar_style: + # Hack-ish way to avoid the danger bar_style being overridden by + # success because the bar gets closed after the error... + if pbar.bar_style != 'danger' or bar_style != 'success': + pbar.bar_style = bar_style + + # Special signal to close the bar + if close and pbar.bar_style != 'danger': # hide only if no error + try: + self.container.close() + except AttributeError: + self.container.visible = False + self.container.layout.visibility = 'hidden' # IPYW>=8 + + if check_delay and self.delay > 0 and not self.displayed: + display(self.container) + self.displayed = True + + @property + def colour(self): + if hasattr(self, 'container'): + return self.container.children[-2].style.bar_color + + @colour.setter + def colour(self, bar_color): + if hasattr(self, 'container'): + self.container.children[-2].style.bar_color = bar_color + + def __init__(self, *args, **kwargs): + """ + Supports the usual `tqdm.tqdm` parameters as well as those listed below. + + Parameters + ---------- + display : Whether to call `display(self.container)` immediately + [default: True]. + """ + kwargs = kwargs.copy() + # Setup default output + file_kwarg = kwargs.get('file', sys.stderr) + if file_kwarg is sys.stderr or file_kwarg is None: + kwargs['file'] = sys.stdout # avoid the red block in IPython + + # Initialize parent class + avoid printing by using gui=True + kwargs['gui'] = True + # convert disable = None to False + kwargs['disable'] = bool(kwargs.get('disable', False)) + colour = kwargs.pop('colour', None) + display_here = kwargs.pop('display', True) + super(tqdm_notebook, self).__init__(*args, **kwargs) + if self.disable or not kwargs['gui']: + self.disp = lambda *_, **__: None + return + + # Get bar width + self.ncols = '100%' if self.dynamic_ncols else kwargs.get("ncols", None) + + # Replace with IPython progress bar display (with correct total) + unit_scale = 1 if self.unit_scale is True else self.unit_scale or 1 + total = self.total * unit_scale if self.total else self.total + self.container = self.status_printer(self.fp, total, self.desc, self.ncols) + self.container.pbar = proxy(self) + self.displayed = False + if display_here and self.delay <= 0: + display(self.container) + self.displayed = True + self.disp = self.display + self.colour = colour + + # Print initial bar state + if not self.disable: + self.display(check_delay=False) + + def __iter__(self): + try: + it = super(tqdm_notebook, self).__iter__() + for obj in it: + # return super(tqdm...) will not catch exception + yield obj + # NB: except ... [ as ...] breaks IPython async KeyboardInterrupt + except: # NOQA + self.disp(bar_style='danger') + raise + # NB: don't `finally: close()` + # since this could be a shared bar which the user will `reset()` + + def update(self, n=1): + try: + return super(tqdm_notebook, self).update(n=n) + # NB: except ... [ as ...] breaks IPython async KeyboardInterrupt + except: # NOQA + # cannot catch KeyboardInterrupt when using manual tqdm + # as the interrupt will most likely happen on another statement + self.disp(bar_style='danger') + raise + # NB: don't `finally: close()` + # since this could be a shared bar which the user will `reset()` + + def close(self): + if self.disable: + return + super(tqdm_notebook, self).close() + # Try to detect if there was an error or KeyboardInterrupt + # in manual mode: if n < total, things probably got wrong + if self.total and self.n < self.total: + self.disp(bar_style='danger', check_delay=False) + else: + if self.leave: + self.disp(bar_style='success', check_delay=False) + else: + self.disp(close=True, check_delay=False) + + def clear(self, *_, **__): + pass + + def reset(self, total=None): + """ + Resets to 0 iterations for repeated use. + + Consider combining with `leave=True`. + + Parameters + ---------- + total : int or float, optional. Total to use for the new bar. + """ + if self.disable: + return super(tqdm_notebook, self).reset(total=total) + _, pbar, _ = self.container.children + pbar.bar_style = '' + if total is not None: + pbar.max = total + if not self.total and self.ncols is None: # no longer unknown total + pbar.layout.width = None # reset width + return super(tqdm_notebook, self).reset(total=total) + + +def tnrange(*args, **kwargs): + """ + A shortcut for `tqdm.notebook.tqdm(xrange(*args), **kwargs)`. + On Python3+, `range` is used instead of `xrange`. + """ + return tqdm_notebook(_range(*args), **kwargs) + + +# Aliases +tqdm = tqdm_notebook +trange = tnrange diff --git a/.local/lib/python3.10/site-packages/tqdm/rich.py b/.local/lib/python3.10/site-packages/tqdm/rich.py new file mode 100644 index 0000000000000000000000000000000000000000..69893ffdd5247dc40ab44a9de09697e5c8e0bb3b --- /dev/null +++ b/.local/lib/python3.10/site-packages/tqdm/rich.py @@ -0,0 +1,156 @@ +""" +`rich.progress` decorator for iterators. + +Usage: +>>> from tqdm.rich import trange, tqdm +>>> for i in trange(10): +... ... +""" +from __future__ import absolute_import + +from warnings import warn + +from rich.progress import ( + BarColumn, Progress, ProgressColumn, Text, TimeElapsedColumn, TimeRemainingColumn, filesize) + +from .std import TqdmExperimentalWarning +from .std import tqdm as std_tqdm +from .utils import _range + +__author__ = {"github.com/": ["casperdcl"]} +__all__ = ['tqdm_rich', 'trrange', 'tqdm', 'trange'] + + +class FractionColumn(ProgressColumn): + """Renders completed/total, e.g. '0.5/2.3 G'.""" + def __init__(self, unit_scale=False, unit_divisor=1000): + self.unit_scale = unit_scale + self.unit_divisor = unit_divisor + super().__init__() + + def render(self, task): + """Calculate common unit for completed and total.""" + completed = int(task.completed) + total = int(task.total) + if self.unit_scale: + unit, suffix = filesize.pick_unit_and_suffix( + total, + ["", "K", "M", "G", "T", "P", "E", "Z", "Y"], + self.unit_divisor, + ) + else: + unit, suffix = filesize.pick_unit_and_suffix(total, [""], 1) + precision = 0 if unit == 1 else 1 + return Text( + f"{completed/unit:,.{precision}f}/{total/unit:,.{precision}f} {suffix}", + style="progress.download") + + +class RateColumn(ProgressColumn): + """Renders human readable transfer speed.""" + def __init__(self, unit="", unit_scale=False, unit_divisor=1000): + self.unit = unit + self.unit_scale = unit_scale + self.unit_divisor = unit_divisor + super().__init__() + + def render(self, task): + """Show data transfer speed.""" + speed = task.speed + if speed is None: + return Text(f"? {self.unit}/s", style="progress.data.speed") + if self.unit_scale: + unit, suffix = filesize.pick_unit_and_suffix( + speed, + ["", "K", "M", "G", "T", "P", "E", "Z", "Y"], + self.unit_divisor, + ) + else: + unit, suffix = filesize.pick_unit_and_suffix(speed, [""], 1) + precision = 0 if unit == 1 else 1 + return Text(f"{speed/unit:,.{precision}f} {suffix}{self.unit}/s", + style="progress.data.speed") + + +class tqdm_rich(std_tqdm): # pragma: no cover + """Experimental rich.progress GUI version of tqdm!""" + # TODO: @classmethod: write()? + def __init__(self, *args, **kwargs): + """ + This class accepts the following parameters *in addition* to + the parameters accepted by `tqdm`. + + Parameters + ---------- + progress : tuple, optional + arguments for `rich.progress.Progress()`. + options : dict, optional + keyword arguments for `rich.progress.Progress()`. + """ + kwargs = kwargs.copy() + kwargs['gui'] = True + # convert disable = None to False + kwargs['disable'] = bool(kwargs.get('disable', False)) + progress = kwargs.pop('progress', None) + options = kwargs.pop('options', {}).copy() + super(tqdm_rich, self).__init__(*args, **kwargs) + + if self.disable: + return + + warn("rich is experimental/alpha", TqdmExperimentalWarning, stacklevel=2) + d = self.format_dict + if progress is None: + progress = ( + "[progress.description]{task.description}" + "[progress.percentage]{task.percentage:>4.0f}%", + BarColumn(bar_width=None), + FractionColumn( + unit_scale=d['unit_scale'], unit_divisor=d['unit_divisor']), + "[", TimeElapsedColumn(), "<", TimeRemainingColumn(), + ",", RateColumn(unit=d['unit'], unit_scale=d['unit_scale'], + unit_divisor=d['unit_divisor']), "]" + ) + options.setdefault('transient', not self.leave) + self._prog = Progress(*progress, **options) + self._prog.__enter__() + self._task_id = self._prog.add_task(self.desc or "", **d) + + def close(self): + if self.disable: + return + super(tqdm_rich, self).close() + self._prog.__exit__(None, None, None) + + def clear(self, *_, **__): + pass + + def display(self, *_, **__): + if not hasattr(self, '_prog'): + return + self._prog.update(self._task_id, completed=self.n, description=self.desc) + + def reset(self, total=None): + """ + Resets to 0 iterations for repeated use. + + Parameters + ---------- + total : int or float, optional. Total to use for the new bar. + """ + if hasattr(self, '_prog'): + self._prog.reset(total=total) + super(tqdm_rich, self).reset(total=total) + + +def trrange(*args, **kwargs): + """ + A shortcut for `tqdm.rich.tqdm(xrange(*args), **kwargs)`. + On Python3+, `range` is used instead of `xrange`. + """ + return tqdm_rich(_range(*args), **kwargs) + + +# Aliases +tqdm = tqdm_rich +trange = trrange diff --git a/.local/lib/python3.10/site-packages/tqdm/std.py b/.local/lib/python3.10/site-packages/tqdm/std.py new file mode 100644 index 0000000000000000000000000000000000000000..5f9dccafeaaf1a37713497291f004eb89ab9ad41 --- /dev/null +++ b/.local/lib/python3.10/site-packages/tqdm/std.py @@ -0,0 +1,1541 @@ +""" +Customisable progressbar decorator for iterators. +Includes a default `range` iterator printing to `stderr`. + +Usage: +>>> from tqdm import trange, tqdm +>>> for i in trange(10): +... ... +""" +from __future__ import absolute_import, division + +import sys +from collections import OrderedDict, defaultdict +from contextlib import contextmanager +from datetime import datetime, timedelta +from numbers import Number +from time import time +from warnings import warn +from weakref import WeakSet + +from ._monitor import TMonitor +from .utils import ( + CallbackIOWrapper, Comparable, DisableOnWriteError, FormatReplace, SimpleTextIOWrapper, + _basestring, _is_ascii, _range, _screen_shape_wrapper, _supports_unicode, _term_move_up, + _unich, _unicode, disp_len, disp_trim) + +__author__ = "https://github.com/tqdm/tqdm#contributions" +__all__ = ['tqdm', 'trange', + 'TqdmTypeError', 'TqdmKeyError', 'TqdmWarning', + 'TqdmExperimentalWarning', 'TqdmDeprecationWarning', + 'TqdmMonitorWarning'] + + +class TqdmTypeError(TypeError): + pass + + +class TqdmKeyError(KeyError): + pass + + +class TqdmWarning(Warning): + """base class for all tqdm warnings. + + Used for non-external-code-breaking errors, such as garbled printing. + """ + def __init__(self, msg, fp_write=None, *a, **k): + if fp_write is not None: + fp_write("\n" + self.__class__.__name__ + ": " + str(msg).rstrip() + '\n') + else: + super(TqdmWarning, self).__init__(msg, *a, **k) + + +class TqdmExperimentalWarning(TqdmWarning, FutureWarning): + """beta feature, unstable API and behaviour""" + pass + + +class TqdmDeprecationWarning(TqdmWarning, DeprecationWarning): + # not suppressed if raised + pass + + +class TqdmMonitorWarning(TqdmWarning, RuntimeWarning): + """tqdm monitor errors which do not affect external functionality""" + pass + + +def TRLock(*args, **kwargs): + """threading RLock""" + try: + from threading import RLock + return RLock(*args, **kwargs) + except (ImportError, OSError): # pragma: no cover + pass + + +class TqdmDefaultWriteLock(object): + """ + Provide a default write lock for thread and multiprocessing safety. + Works only on platforms supporting `fork` (so Windows is excluded). + You must initialise a `tqdm` or `TqdmDefaultWriteLock` instance + before forking in order for the write lock to work. + On Windows, you need to supply the lock from the parent to the children as + an argument to joblib or the parallelism lib you use. + """ + # global thread lock so no setup required for multithreading. + # NB: Do not create multiprocessing lock as it sets the multiprocessing + # context, disallowing `spawn()`/`forkserver()` + th_lock = TRLock() + + def __init__(self): + # Create global parallelism locks to avoid racing issues with parallel + # bars works only if fork available (Linux/MacOSX, but not Windows) + cls = type(self) + root_lock = cls.th_lock + if root_lock is not None: + root_lock.acquire() + cls.create_mp_lock() + self.locks = [lk for lk in [cls.mp_lock, cls.th_lock] if lk is not None] + if root_lock is not None: + root_lock.release() + + def acquire(self, *a, **k): + for lock in self.locks: + lock.acquire(*a, **k) + + def release(self): + for lock in self.locks[::-1]: # Release in inverse order of acquisition + lock.release() + + def __enter__(self): + self.acquire() + + def __exit__(self, *exc): + self.release() + + @classmethod + def create_mp_lock(cls): + if not hasattr(cls, 'mp_lock'): + try: + from multiprocessing import RLock + cls.mp_lock = RLock() + except (ImportError, OSError): # pragma: no cover + cls.mp_lock = None + + @classmethod + def create_th_lock(cls): + assert hasattr(cls, 'th_lock') + warn("create_th_lock not needed anymore", TqdmDeprecationWarning, stacklevel=2) + + +class Bar(object): + """ + `str.format`-able bar with format specifiers: `[width][type]` + + - `width` + + unspecified (default): use `self.default_len` + + `int >= 0`: overrides `self.default_len` + + `int < 0`: subtract from `self.default_len` + - `type` + + `a`: ascii (`charset=self.ASCII` override) + + `u`: unicode (`charset=self.UTF` override) + + `b`: blank (`charset=" "` override) + """ + ASCII = " 123456789#" + UTF = u" " + u''.join(map(_unich, range(0x258F, 0x2587, -1))) + BLANK = " " + COLOUR_RESET = '\x1b[0m' + COLOUR_RGB = '\x1b[38;2;%d;%d;%dm' + COLOURS = {'BLACK': '\x1b[30m', 'RED': '\x1b[31m', 'GREEN': '\x1b[32m', + 'YELLOW': '\x1b[33m', 'BLUE': '\x1b[34m', 'MAGENTA': '\x1b[35m', + 'CYAN': '\x1b[36m', 'WHITE': '\x1b[37m'} + + def __init__(self, frac, default_len=10, charset=UTF, colour=None): + if not 0 <= frac <= 1: + warn("clamping frac to range [0, 1]", TqdmWarning, stacklevel=2) + frac = max(0, min(1, frac)) + assert default_len > 0 + self.frac = frac + self.default_len = default_len + self.charset = charset + self.colour = colour + + @property + def colour(self): + return self._colour + + @colour.setter + def colour(self, value): + if not value: + self._colour = None + return + try: + if value.upper() in self.COLOURS: + self._colour = self.COLOURS[value.upper()] + elif value[0] == '#' and len(value) == 7: + self._colour = self.COLOUR_RGB % tuple( + int(i, 16) for i in (value[1:3], value[3:5], value[5:7])) + else: + raise KeyError + except (KeyError, AttributeError): + warn("Unknown colour (%s); valid choices: [hex (#00ff00), %s]" % ( + value, ", ".join(self.COLOURS)), + TqdmWarning, stacklevel=2) + self._colour = None + + def __format__(self, format_spec): + if format_spec: + _type = format_spec[-1].lower() + try: + charset = {'a': self.ASCII, 'u': self.UTF, 'b': self.BLANK}[_type] + except KeyError: + charset = self.charset + else: + format_spec = format_spec[:-1] + if format_spec: + N_BARS = int(format_spec) + if N_BARS < 0: + N_BARS += self.default_len + else: + N_BARS = self.default_len + else: + charset = self.charset + N_BARS = self.default_len + + nsyms = len(charset) - 1 + bar_length, frac_bar_length = divmod(int(self.frac * N_BARS * nsyms), nsyms) + + res = charset[-1] * bar_length + if bar_length < N_BARS: # whitespace padding + res = res + charset[frac_bar_length] + charset[0] * (N_BARS - bar_length - 1) + return self.colour + res + self.COLOUR_RESET if self.colour else res + + +class EMA(object): + """ + Exponential moving average: smoothing to give progressively lower + weights to older values. + + Parameters + ---------- + smoothing : float, optional + Smoothing factor in range [0, 1], [default: 0.3]. + Increase to give more weight to recent values. + Ranges from 0 (yields old value) to 1 (yields new value). + """ + def __init__(self, smoothing=0.3): + self.alpha = smoothing + self.last = 0 + self.calls = 0 + + def __call__(self, x=None): + """ + Parameters + ---------- + x : float + New value to include in EMA. + """ + beta = 1 - self.alpha + if x is not None: + self.last = self.alpha * x + beta * self.last + self.calls += 1 + return self.last / (1 - beta ** self.calls) if self.calls else self.last + + +class tqdm(Comparable): + """ + Decorate an iterable object, returning an iterator which acts exactly + like the original iterable, but prints a dynamically updating + progressbar every time a value is requested. + """ + + monitor_interval = 10 # set to 0 to disable the thread + monitor = None + _instances = WeakSet() + + @staticmethod + def format_sizeof(num, suffix='', divisor=1000): + """ + Formats a number (greater than unity) with SI Order of Magnitude + prefixes. + + Parameters + ---------- + num : float + Number ( >= 1) to format. + suffix : str, optional + Post-postfix [default: '']. + divisor : float, optional + Divisor between prefixes [default: 1000]. + + Returns + ------- + out : str + Number with Order of Magnitude SI unit postfix. + """ + for unit in ['', 'k', 'M', 'G', 'T', 'P', 'E', 'Z']: + if abs(num) < 999.5: + if abs(num) < 99.95: + if abs(num) < 9.995: + return '{0:1.2f}'.format(num) + unit + suffix + return '{0:2.1f}'.format(num) + unit + suffix + return '{0:3.0f}'.format(num) + unit + suffix + num /= divisor + return '{0:3.1f}Y'.format(num) + suffix + + @staticmethod + def format_interval(t): + """ + Formats a number of seconds as a clock time, [H:]MM:SS + + Parameters + ---------- + t : int + Number of seconds. + + Returns + ------- + out : str + [H:]MM:SS + """ + mins, s = divmod(int(t), 60) + h, m = divmod(mins, 60) + if h: + return '{0:d}:{1:02d}:{2:02d}'.format(h, m, s) + else: + return '{0:02d}:{1:02d}'.format(m, s) + + @staticmethod + def format_num(n): + """ + Intelligent scientific notation (.3g). + + Parameters + ---------- + n : int or float or Numeric + A Number. + + Returns + ------- + out : str + Formatted number. + """ + f = '{0:.3g}'.format(n).replace('+0', '+').replace('-0', '-') + n = str(n) + return f if len(f) < len(n) else n + + @staticmethod + def status_printer(file): + """ + Manage the printing and in-place updating of a line of characters. + Note that if the string is longer than a line, then in-place + updating may not work (it will print a new line at each refresh). + """ + fp = file + fp_flush = getattr(fp, 'flush', lambda: None) # pragma: no cover + if fp in (sys.stderr, sys.stdout): + getattr(sys.stderr, 'flush', lambda: None)() + getattr(sys.stdout, 'flush', lambda: None)() + + def fp_write(s): + fp.write(_unicode(s)) + fp_flush() + + last_len = [0] + + def print_status(s): + len_s = disp_len(s) + fp_write('\r' + s + (' ' * max(last_len[0] - len_s, 0))) + last_len[0] = len_s + + return print_status + + @staticmethod + def format_meter(n, total, elapsed, ncols=None, prefix='', ascii=False, unit='it', + unit_scale=False, rate=None, bar_format=None, postfix=None, + unit_divisor=1000, initial=0, colour=None, **extra_kwargs): + """ + Return a string-based progress bar given some parameters + + Parameters + ---------- + n : int or float + Number of finished iterations. + total : int or float + The expected total number of iterations. If meaningless (None), + only basic progress statistics are displayed (no ETA). + elapsed : float + Number of seconds passed since start. + ncols : int, optional + The width of the entire output message. If specified, + dynamically resizes `{bar}` to stay within this bound + [default: None]. If `0`, will not print any bar (only stats). + The fallback is `{bar:10}`. + prefix : str, optional + Prefix message (included in total width) [default: '']. + Use as {desc} in bar_format string. + ascii : bool, optional or str, optional + If not set, use unicode (smooth blocks) to fill the meter + [default: False]. The fallback is to use ASCII characters + " 123456789#". + unit : str, optional + The iteration unit [default: 'it']. + unit_scale : bool or int or float, optional + If 1 or True, the number of iterations will be printed with an + appropriate SI metric prefix (k = 10^3, M = 10^6, etc.) + [default: False]. If any other non-zero number, will scale + `total` and `n`. + rate : float, optional + Manual override for iteration rate. + If [default: None], uses n/elapsed. + bar_format : str, optional + Specify a custom bar string formatting. May impact performance. + [default: '{l_bar}{bar}{r_bar}'], where + l_bar='{desc}: {percentage:3.0f}%|' and + r_bar='| {n_fmt}/{total_fmt} [{elapsed}<{remaining}, ' + '{rate_fmt}{postfix}]' + Possible vars: l_bar, bar, r_bar, n, n_fmt, total, total_fmt, + percentage, elapsed, elapsed_s, ncols, nrows, desc, unit, + rate, rate_fmt, rate_noinv, rate_noinv_fmt, + rate_inv, rate_inv_fmt, postfix, unit_divisor, + remaining, remaining_s, eta. + Note that a trailing ": " is automatically removed after {desc} + if the latter is empty. + postfix : *, optional + Similar to `prefix`, but placed at the end + (e.g. for additional stats). + Note: postfix is usually a string (not a dict) for this method, + and will if possible be set to postfix = ', ' + postfix. + However other types are supported (#382). + unit_divisor : float, optional + [default: 1000], ignored unless `unit_scale` is True. + initial : int or float, optional + The initial counter value [default: 0]. + colour : str, optional + Bar colour (e.g. 'green', '#00ff00'). + + Returns + ------- + out : Formatted meter and stats, ready to display. + """ + + # sanity check: total + if total and n >= (total + 0.5): # allow float imprecision (#849) + total = None + + # apply custom scale if necessary + if unit_scale and unit_scale not in (True, 1): + if total: + total *= unit_scale + n *= unit_scale + if rate: + rate *= unit_scale # by default rate = self.avg_dn / self.avg_dt + unit_scale = False + + elapsed_str = tqdm.format_interval(elapsed) + + # if unspecified, attempt to use rate = average speed + # (we allow manual override since predicting time is an arcane art) + if rate is None and elapsed: + rate = (n - initial) / elapsed + inv_rate = 1 / rate if rate else None + format_sizeof = tqdm.format_sizeof + rate_noinv_fmt = ((format_sizeof(rate) if unit_scale else + '{0:5.2f}'.format(rate)) if rate else '?') + unit + '/s' + rate_inv_fmt = ( + (format_sizeof(inv_rate) if unit_scale else '{0:5.2f}'.format(inv_rate)) + if inv_rate else '?') + 's/' + unit + rate_fmt = rate_inv_fmt if inv_rate and inv_rate > 1 else rate_noinv_fmt + + if unit_scale: + n_fmt = format_sizeof(n, divisor=unit_divisor) + total_fmt = format_sizeof(total, divisor=unit_divisor) if total is not None else '?' + else: + n_fmt = str(n) + total_fmt = str(total) if total is not None else '?' + + try: + postfix = ', ' + postfix if postfix else '' + except TypeError: + pass + + remaining = (total - n) / rate if rate and total else 0 + remaining_str = tqdm.format_interval(remaining) if rate else '?' + try: + eta_dt = (datetime.now() + timedelta(seconds=remaining) + if rate and total else datetime.utcfromtimestamp(0)) + except OverflowError: + eta_dt = datetime.max + + # format the stats displayed to the left and right sides of the bar + if prefix: + # old prefix setup work around + bool_prefix_colon_already = (prefix[-2:] == ": ") + l_bar = prefix if bool_prefix_colon_already else prefix + ": " + else: + l_bar = '' + + r_bar = '| {0}/{1} [{2}<{3}, {4}{5}]'.format( + n_fmt, total_fmt, elapsed_str, remaining_str, rate_fmt, postfix) + + # Custom bar formatting + # Populate a dict with all available progress indicators + format_dict = dict( + # slight extension of self.format_dict + n=n, n_fmt=n_fmt, total=total, total_fmt=total_fmt, + elapsed=elapsed_str, elapsed_s=elapsed, + ncols=ncols, desc=prefix or '', unit=unit, + rate=inv_rate if inv_rate and inv_rate > 1 else rate, + rate_fmt=rate_fmt, rate_noinv=rate, + rate_noinv_fmt=rate_noinv_fmt, rate_inv=inv_rate, + rate_inv_fmt=rate_inv_fmt, + postfix=postfix, unit_divisor=unit_divisor, + colour=colour, + # plus more useful definitions + remaining=remaining_str, remaining_s=remaining, + l_bar=l_bar, r_bar=r_bar, eta=eta_dt, + **extra_kwargs) + + # total is known: we can predict some stats + if total: + # fractional and percentage progress + frac = n / total + percentage = frac * 100 + + l_bar += '{0:3.0f}%|'.format(percentage) + + if ncols == 0: + return l_bar[:-1] + r_bar[1:] + + format_dict.update(l_bar=l_bar) + if bar_format: + format_dict.update(percentage=percentage) + + # auto-remove colon for empty `desc` + if not prefix: + bar_format = bar_format.replace("{desc}: ", '') + else: + bar_format = "{l_bar}{bar}{r_bar}" + + full_bar = FormatReplace() + try: + nobar = bar_format.format(bar=full_bar, **format_dict) + except UnicodeEncodeError: + bar_format = _unicode(bar_format) + nobar = bar_format.format(bar=full_bar, **format_dict) + if not full_bar.format_called: + # no {bar}, we can just format and return + return nobar + + # Formatting progress bar space available for bar's display + full_bar = Bar(frac, + max(1, ncols - disp_len(nobar)) if ncols else 10, + charset=Bar.ASCII if ascii is True else ascii or Bar.UTF, + colour=colour) + if not _is_ascii(full_bar.charset) and _is_ascii(bar_format): + bar_format = _unicode(bar_format) + res = bar_format.format(bar=full_bar, **format_dict) + return disp_trim(res, ncols) if ncols else res + + elif bar_format: + # user-specified bar_format but no total + l_bar += '|' + format_dict.update(l_bar=l_bar, percentage=0) + full_bar = FormatReplace() + nobar = bar_format.format(bar=full_bar, **format_dict) + if not full_bar.format_called: + return nobar + full_bar = Bar(0, + max(1, ncols - disp_len(nobar)) if ncols else 10, + charset=Bar.BLANK, colour=colour) + res = bar_format.format(bar=full_bar, **format_dict) + return disp_trim(res, ncols) if ncols else res + else: + # no total: no progressbar, ETA, just progress stats + return '{0}{1}{2} [{3}, {4}{5}]'.format( + (prefix + ": ") if prefix else '', n_fmt, unit, elapsed_str, rate_fmt, postfix) + + def __new__(cls, *_, **__): + instance = object.__new__(cls) + with cls.get_lock(): # also constructs lock if non-existent + cls._instances.add(instance) + # create monitoring thread + if cls.monitor_interval and (cls.monitor is None + or not cls.monitor.report()): + try: + cls.monitor = TMonitor(cls, cls.monitor_interval) + except Exception as e: # pragma: nocover + warn("tqdm:disabling monitor support" + " (monitor_interval = 0) due to:\n" + str(e), + TqdmMonitorWarning, stacklevel=2) + cls.monitor_interval = 0 + return instance + + @classmethod + def _get_free_pos(cls, instance=None): + """Skips specified instance.""" + positions = {abs(inst.pos) for inst in cls._instances + if inst is not instance and hasattr(inst, "pos")} + return min(set(range(len(positions) + 1)).difference(positions)) + + @classmethod + def _decr_instances(cls, instance): + """ + Remove from list and reposition another unfixed bar + to fill the new gap. + + This means that by default (where all nested bars are unfixed), + order is not maintained but screen flicker/blank space is minimised. + (tqdm<=4.44.1 moved ALL subsequent unfixed bars up.) + """ + with cls._lock: + try: + cls._instances.remove(instance) + except KeyError: + # if not instance.gui: # pragma: no cover + # raise + pass # py2: maybe magically removed already + # else: + if not instance.gui: + last = (instance.nrows or 20) - 1 + # find unfixed (`pos >= 0`) overflow (`pos >= nrows - 1`) + instances = list(filter( + lambda i: hasattr(i, "pos") and last <= i.pos, + cls._instances)) + # set first found to current `pos` + if instances: + inst = min(instances, key=lambda i: i.pos) + inst.clear(nolock=True) + inst.pos = abs(instance.pos) + + @classmethod + def write(cls, s, file=None, end="\n", nolock=False): + """Print a message via tqdm (without overlap with bars).""" + fp = file if file is not None else sys.stdout + with cls.external_write_mode(file=file, nolock=nolock): + # Write the message + fp.write(s) + fp.write(end) + + @classmethod + @contextmanager + def external_write_mode(cls, file=None, nolock=False): + """ + Disable tqdm within context and refresh tqdm when exits. + Useful when writing to standard output stream + """ + fp = file if file is not None else sys.stdout + + try: + if not nolock: + cls.get_lock().acquire() + # Clear all bars + inst_cleared = [] + for inst in getattr(cls, '_instances', []): + # Clear instance if in the target output file + # or if write output + tqdm output are both either + # sys.stdout or sys.stderr (because both are mixed in terminal) + if hasattr(inst, "start_t") and (inst.fp == fp or all( + f in (sys.stdout, sys.stderr) for f in (fp, inst.fp))): + inst.clear(nolock=True) + inst_cleared.append(inst) + yield + # Force refresh display of bars we cleared + for inst in inst_cleared: + inst.refresh(nolock=True) + finally: + if not nolock: + cls._lock.release() + + @classmethod + def set_lock(cls, lock): + """Set the global lock.""" + cls._lock = lock + + @classmethod + def get_lock(cls): + """Get the global lock. Construct it if it does not exist.""" + if not hasattr(cls, '_lock'): + cls._lock = TqdmDefaultWriteLock() + return cls._lock + + @classmethod + def pandas(cls, **tqdm_kwargs): + """ + Registers the current `tqdm` class with + pandas.core. + ( frame.DataFrame + | series.Series + | groupby.(generic.)DataFrameGroupBy + | groupby.(generic.)SeriesGroupBy + ).progress_apply + + A new instance will be created every time `progress_apply` is called, + and each instance will automatically `close()` upon completion. + + Parameters + ---------- + tqdm_kwargs : arguments for the tqdm instance + + Examples + -------- + >>> import pandas as pd + >>> import numpy as np + >>> from tqdm import tqdm + >>> from tqdm.gui import tqdm as tqdm_gui + >>> + >>> df = pd.DataFrame(np.random.randint(0, 100, (100000, 6))) + >>> tqdm.pandas(ncols=50) # can use tqdm_gui, optional kwargs, etc + >>> # Now you can use `progress_apply` instead of `apply` + >>> df.groupby(0).progress_apply(lambda x: x**2) + + References + ---------- + + """ + from warnings import catch_warnings, simplefilter + + from pandas.core.frame import DataFrame + from pandas.core.series import Series + try: + with catch_warnings(): + simplefilter("ignore", category=FutureWarning) + from pandas import Panel + except ImportError: # pandas>=1.2.0 + Panel = None + Rolling, Expanding = None, None + try: # pandas>=1.0.0 + from pandas.core.window.rolling import _Rolling_and_Expanding + except ImportError: + try: # pandas>=0.18.0 + from pandas.core.window import _Rolling_and_Expanding + except ImportError: # pandas>=1.2.0 + try: # pandas>=1.2.0 + from pandas.core.window.expanding import Expanding + from pandas.core.window.rolling import Rolling + _Rolling_and_Expanding = Rolling, Expanding + except ImportError: # pragma: no cover + _Rolling_and_Expanding = None + try: # pandas>=0.25.0 + from pandas.core.groupby.generic import SeriesGroupBy # , NDFrameGroupBy + from pandas.core.groupby.generic import DataFrameGroupBy + except ImportError: # pragma: no cover + try: # pandas>=0.23.0 + from pandas.core.groupby.groupby import DataFrameGroupBy, SeriesGroupBy + except ImportError: + from pandas.core.groupby import DataFrameGroupBy, SeriesGroupBy + try: # pandas>=0.23.0 + from pandas.core.groupby.groupby import GroupBy + except ImportError: # pragma: no cover + from pandas.core.groupby import GroupBy + + try: # pandas>=0.23.0 + from pandas.core.groupby.groupby import PanelGroupBy + except ImportError: + try: + from pandas.core.groupby import PanelGroupBy + except ImportError: # pandas>=0.25.0 + PanelGroupBy = None + + tqdm_kwargs = tqdm_kwargs.copy() + deprecated_t = [tqdm_kwargs.pop('deprecated_t', None)] + + def inner_generator(df_function='apply'): + def inner(df, func, *args, **kwargs): + """ + Parameters + ---------- + df : (DataFrame|Series)[GroupBy] + Data (may be grouped). + func : function + To be applied on the (grouped) data. + **kwargs : optional + Transmitted to `df.apply()`. + """ + + # Precompute total iterations + total = tqdm_kwargs.pop("total", getattr(df, 'ngroups', None)) + if total is None: # not grouped + if df_function == 'applymap': + total = df.size + elif isinstance(df, Series): + total = len(df) + elif (_Rolling_and_Expanding is None or + not isinstance(df, _Rolling_and_Expanding)): + # DataFrame or Panel + axis = kwargs.get('axis', 0) + if axis == 'index': + axis = 0 + elif axis == 'columns': + axis = 1 + # when axis=0, total is shape[axis1] + total = df.size // df.shape[axis] + + # Init bar + if deprecated_t[0] is not None: + t = deprecated_t[0] + deprecated_t[0] = None + else: + t = cls(total=total, **tqdm_kwargs) + + if len(args) > 0: + # *args intentionally not supported (see #244, #299) + TqdmDeprecationWarning( + "Except func, normal arguments are intentionally" + + " not supported by" + + " `(DataFrame|Series|GroupBy).progress_apply`." + + " Use keyword arguments instead.", + fp_write=getattr(t.fp, 'write', sys.stderr.write)) + + try: # pandas>=1.3.0 + from pandas.core.common import is_builtin_func + except ImportError: + is_builtin_func = df._is_builtin_func + try: + func = is_builtin_func(func) + except TypeError: + pass + + # Define bar updating wrapper + def wrapper(*args, **kwargs): + # update tbar correctly + # it seems `pandas apply` calls `func` twice + # on the first column/row to decide whether it can + # take a fast or slow code path; so stop when t.total==t.n + t.update(n=1 if not t.total or t.n < t.total else 0) + return func(*args, **kwargs) + + # Apply the provided function (in **kwargs) + # on the df using our wrapper (which provides bar updating) + try: + return getattr(df, df_function)(wrapper, **kwargs) + finally: + t.close() + + return inner + + # Monkeypatch pandas to provide easy methods + # Enable custom tqdm progress in pandas! + Series.progress_apply = inner_generator() + SeriesGroupBy.progress_apply = inner_generator() + Series.progress_map = inner_generator('map') + SeriesGroupBy.progress_map = inner_generator('map') + + DataFrame.progress_apply = inner_generator() + DataFrameGroupBy.progress_apply = inner_generator() + DataFrame.progress_applymap = inner_generator('applymap') + + if Panel is not None: + Panel.progress_apply = inner_generator() + if PanelGroupBy is not None: + PanelGroupBy.progress_apply = inner_generator() + + GroupBy.progress_apply = inner_generator() + GroupBy.progress_aggregate = inner_generator('aggregate') + GroupBy.progress_transform = inner_generator('transform') + + if Rolling is not None and Expanding is not None: + Rolling.progress_apply = inner_generator() + Expanding.progress_apply = inner_generator() + elif _Rolling_and_Expanding is not None: + _Rolling_and_Expanding.progress_apply = inner_generator() + + def __init__(self, iterable=None, desc=None, total=None, leave=True, file=None, + ncols=None, mininterval=0.1, maxinterval=10.0, miniters=None, + ascii=None, disable=False, unit='it', unit_scale=False, + dynamic_ncols=False, smoothing=0.3, bar_format=None, initial=0, + position=None, postfix=None, unit_divisor=1000, write_bytes=None, + lock_args=None, nrows=None, colour=None, delay=0, gui=False, + **kwargs): + """ + Parameters + ---------- + iterable : iterable, optional + Iterable to decorate with a progressbar. + Leave blank to manually manage the updates. + desc : str, optional + Prefix for the progressbar. + total : int or float, optional + The number of expected iterations. If unspecified, + len(iterable) is used if possible. If float("inf") or as a last + resort, only basic progress statistics are displayed + (no ETA, no progressbar). + If `gui` is True and this parameter needs subsequent updating, + specify an initial arbitrary large positive number, + e.g. 9e9. + leave : bool, optional + If [default: True], keeps all traces of the progressbar + upon termination of iteration. + If `None`, will leave only if `position` is `0`. + file : `io.TextIOWrapper` or `io.StringIO`, optional + Specifies where to output the progress messages + (default: sys.stderr). Uses `file.write(str)` and `file.flush()` + methods. For encoding, see `write_bytes`. + ncols : int, optional + The width of the entire output message. If specified, + dynamically resizes the progressbar to stay within this bound. + If unspecified, attempts to use environment width. The + fallback is a meter width of 10 and no limit for the counter and + statistics. If 0, will not print any meter (only stats). + mininterval : float, optional + Minimum progress display update interval [default: 0.1] seconds. + maxinterval : float, optional + Maximum progress display update interval [default: 10] seconds. + Automatically adjusts `miniters` to correspond to `mininterval` + after long display update lag. Only works if `dynamic_miniters` + or monitor thread is enabled. + miniters : int or float, optional + Minimum progress display update interval, in iterations. + If 0 and `dynamic_miniters`, will automatically adjust to equal + `mininterval` (more CPU efficient, good for tight loops). + If > 0, will skip display of specified number of iterations. + Tweak this and `mininterval` to get very efficient loops. + If your progress is erratic with both fast and slow iterations + (network, skipping items, etc) you should set miniters=1. + ascii : bool or str, optional + If unspecified or False, use unicode (smooth blocks) to fill + the meter. The fallback is to use ASCII characters " 123456789#". + disable : bool, optional + Whether to disable the entire progressbar wrapper + [default: False]. If set to None, disable on non-TTY. + unit : str, optional + String that will be used to define the unit of each iteration + [default: it]. + unit_scale : bool or int or float, optional + If 1 or True, the number of iterations will be reduced/scaled + automatically and a metric prefix following the + International System of Units standard will be added + (kilo, mega, etc.) [default: False]. If any other non-zero + number, will scale `total` and `n`. + dynamic_ncols : bool, optional + If set, constantly alters `ncols` and `nrows` to the + environment (allowing for window resizes) [default: False]. + smoothing : float, optional + Exponential moving average smoothing factor for speed estimates + (ignored in GUI mode). Ranges from 0 (average speed) to 1 + (current/instantaneous speed) [default: 0.3]. + bar_format : str, optional + Specify a custom bar string formatting. May impact performance. + [default: '{l_bar}{bar}{r_bar}'], where + l_bar='{desc}: {percentage:3.0f}%|' and + r_bar='| {n_fmt}/{total_fmt} [{elapsed}<{remaining}, ' + '{rate_fmt}{postfix}]' + Possible vars: l_bar, bar, r_bar, n, n_fmt, total, total_fmt, + percentage, elapsed, elapsed_s, ncols, nrows, desc, unit, + rate, rate_fmt, rate_noinv, rate_noinv_fmt, + rate_inv, rate_inv_fmt, postfix, unit_divisor, + remaining, remaining_s, eta. + Note that a trailing ": " is automatically removed after {desc} + if the latter is empty. + initial : int or float, optional + The initial counter value. Useful when restarting a progress + bar [default: 0]. If using float, consider specifying `{n:.3f}` + or similar in `bar_format`, or specifying `unit_scale`. + position : int, optional + Specify the line offset to print this bar (starting from 0) + Automatic if unspecified. + Useful to manage multiple bars at once (eg, from threads). + postfix : dict or *, optional + Specify additional stats to display at the end of the bar. + Calls `set_postfix(**postfix)` if possible (dict). + unit_divisor : float, optional + [default: 1000], ignored unless `unit_scale` is True. + write_bytes : bool, optional + If (default: None) and `file` is unspecified, + bytes will be written in Python 2. If `True` will also write + bytes. In all other cases will default to unicode. + lock_args : tuple, optional + Passed to `refresh` for intermediate output + (initialisation, iterating, and updating). + nrows : int, optional + The screen height. If specified, hides nested bars outside this + bound. If unspecified, attempts to use environment height. + The fallback is 20. + colour : str, optional + Bar colour (e.g. 'green', '#00ff00'). + delay : float, optional + Don't display until [default: 0] seconds have elapsed. + gui : bool, optional + WARNING: internal parameter - do not use. + Use tqdm.gui.tqdm(...) instead. If set, will attempt to use + matplotlib animations for a graphical output [default: False]. + + Returns + ------- + out : decorated iterator. + """ + if write_bytes is None: + write_bytes = file is None and sys.version_info < (3,) + + if file is None: + file = sys.stderr + + if write_bytes: + # Despite coercing unicode into bytes, py2 sys.std* streams + # should have bytes written to them. + file = SimpleTextIOWrapper( + file, encoding=getattr(file, 'encoding', None) or 'utf-8') + + file = DisableOnWriteError(file, tqdm_instance=self) + + if disable is None and hasattr(file, "isatty") and not file.isatty(): + disable = True + + if total is None and iterable is not None: + try: + total = len(iterable) + except (TypeError, AttributeError): + total = None + if total == float("inf"): + # Infinite iterations, behave same as unknown + total = None + + if disable: + self.iterable = iterable + self.disable = disable + with self._lock: + self.pos = self._get_free_pos(self) + self._instances.remove(self) + self.n = initial + self.total = total + self.leave = leave + return + + if kwargs: + self.disable = True + with self._lock: + self.pos = self._get_free_pos(self) + self._instances.remove(self) + raise ( + TqdmDeprecationWarning( + "`nested` is deprecated and automated.\n" + "Use `position` instead for manual control.\n", + fp_write=getattr(file, 'write', sys.stderr.write)) + if "nested" in kwargs else + TqdmKeyError("Unknown argument(s): " + str(kwargs))) + + # Preprocess the arguments + if ( + (ncols is None or nrows is None) and (file in (sys.stderr, sys.stdout)) + ) or dynamic_ncols: # pragma: no cover + if dynamic_ncols: + dynamic_ncols = _screen_shape_wrapper() + if dynamic_ncols: + ncols, nrows = dynamic_ncols(file) + else: + _dynamic_ncols = _screen_shape_wrapper() + if _dynamic_ncols: + _ncols, _nrows = _dynamic_ncols(file) + if ncols is None: + ncols = _ncols + if nrows is None: + nrows = _nrows + + if miniters is None: + miniters = 0 + dynamic_miniters = True + else: + dynamic_miniters = False + + if mininterval is None: + mininterval = 0 + + if maxinterval is None: + maxinterval = 0 + + if ascii is None: + ascii = not _supports_unicode(file) + + if bar_format and ascii is not True and not _is_ascii(ascii): + # Convert bar format into unicode since terminal uses unicode + bar_format = _unicode(bar_format) + + if smoothing is None: + smoothing = 0 + + # Store the arguments + self.iterable = iterable + self.desc = desc or '' + self.total = total + self.leave = leave + self.fp = file + self.ncols = ncols + self.nrows = nrows + self.mininterval = mininterval + self.maxinterval = maxinterval + self.miniters = miniters + self.dynamic_miniters = dynamic_miniters + self.ascii = ascii + self.disable = disable + self.unit = unit + self.unit_scale = unit_scale + self.unit_divisor = unit_divisor + self.initial = initial + self.lock_args = lock_args + self.delay = delay + self.gui = gui + self.dynamic_ncols = dynamic_ncols + self.smoothing = smoothing + self._ema_dn = EMA(smoothing) + self._ema_dt = EMA(smoothing) + self._ema_miniters = EMA(smoothing) + self.bar_format = bar_format + self.postfix = None + self.colour = colour + self._time = time + if postfix: + try: + self.set_postfix(refresh=False, **postfix) + except TypeError: + self.postfix = postfix + + # Init the iterations counters + self.last_print_n = initial + self.n = initial + + # if nested, at initial sp() call we replace '\r' by '\n' to + # not overwrite the outer progress bar + with self._lock: + # mark fixed positions as negative + self.pos = self._get_free_pos(self) if position is None else -position + + if not gui: + # Initialize the screen printer + self.sp = self.status_printer(self.fp) + if delay <= 0: + self.refresh(lock_args=self.lock_args) + + # Init the time counter + self.last_print_t = self._time() + # NB: Avoid race conditions by setting start_t at the very end of init + self.start_t = self.last_print_t + + def __bool__(self): + if self.total is not None: + return self.total > 0 + if self.iterable is None: + raise TypeError('bool() undefined when iterable == total == None') + return bool(self.iterable) + + def __nonzero__(self): + return self.__bool__() + + def __len__(self): + return ( + self.total if self.iterable is None + else self.iterable.shape[0] if hasattr(self.iterable, "shape") + else len(self.iterable) if hasattr(self.iterable, "__len__") + else self.iterable.__length_hint__() if hasattr(self.iterable, "__length_hint__") + else getattr(self, "total", None)) + + def __reversed__(self): + try: + orig = self.iterable + except AttributeError: + raise TypeError("'tqdm' object is not reversible") + else: + self.iterable = reversed(self.iterable) + return self.__iter__() + finally: + self.iterable = orig + + def __contains__(self, item): + contains = getattr(self.iterable, '__contains__', None) + return contains(item) if contains is not None else item in self.__iter__() + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_value, traceback): + try: + self.close() + except AttributeError: + # maybe eager thread cleanup upon external error + if (exc_type, exc_value, traceback) == (None, None, None): + raise + warn("AttributeError ignored", TqdmWarning, stacklevel=2) + + def __del__(self): + self.close() + + def __str__(self): + return self.format_meter(**self.format_dict) + + @property + def _comparable(self): + return abs(getattr(self, "pos", 1 << 31)) + + def __hash__(self): + return id(self) + + def __iter__(self): + """Backward-compatibility to use: for x in tqdm(iterable)""" + + # Inlining instance variables as locals (speed optimisation) + iterable = self.iterable + + # If the bar is disabled, then just walk the iterable + # (note: keep this check outside the loop for performance) + if self.disable: + for obj in iterable: + yield obj + return + + mininterval = self.mininterval + last_print_t = self.last_print_t + last_print_n = self.last_print_n + min_start_t = self.start_t + self.delay + n = self.n + time = self._time + + try: + for obj in iterable: + yield obj + # Update and possibly print the progressbar. + # Note: does not call self.update(1) for speed optimisation. + n += 1 + + if n - last_print_n >= self.miniters: + cur_t = time() + dt = cur_t - last_print_t + if dt >= mininterval and cur_t >= min_start_t: + self.update(n - last_print_n) + last_print_n = self.last_print_n + last_print_t = self.last_print_t + finally: + self.n = n + self.close() + + def update(self, n=1): + """ + Manually update the progress bar, useful for streams + such as reading files. + E.g.: + >>> t = tqdm(total=filesize) # Initialise + >>> for current_buffer in stream: + ... ... + ... t.update(len(current_buffer)) + >>> t.close() + The last line is highly recommended, but possibly not necessary if + `t.update()` will be called in such a way that `filesize` will be + exactly reached and printed. + + Parameters + ---------- + n : int or float, optional + Increment to add to the internal counter of iterations + [default: 1]. If using float, consider specifying `{n:.3f}` + or similar in `bar_format`, or specifying `unit_scale`. + + Returns + ------- + out : bool or None + True if a `display()` was triggered. + """ + if self.disable: + return + + if n < 0: + self.last_print_n += n # for auto-refresh logic to work + self.n += n + + # check counter first to reduce calls to time() + if self.n - self.last_print_n >= self.miniters: + cur_t = self._time() + dt = cur_t - self.last_print_t + if dt >= self.mininterval and cur_t >= self.start_t + self.delay: + cur_t = self._time() + dn = self.n - self.last_print_n # >= n + if self.smoothing and dt and dn: + # EMA (not just overall average) + self._ema_dn(dn) + self._ema_dt(dt) + self.refresh(lock_args=self.lock_args) + if self.dynamic_miniters: + # If no `miniters` was specified, adjust automatically to the + # maximum iteration rate seen so far between two prints. + # e.g.: After running `tqdm.update(5)`, subsequent + # calls to `tqdm.update()` will only cause an update after + # at least 5 more iterations. + if self.maxinterval and dt >= self.maxinterval: + self.miniters = dn * (self.mininterval or self.maxinterval) / dt + elif self.smoothing: + # EMA miniters update + self.miniters = self._ema_miniters( + dn * (self.mininterval / dt if self.mininterval and dt + else 1)) + else: + # max iters between two prints + self.miniters = max(self.miniters, dn) + + # Store old values for next call + self.last_print_n = self.n + self.last_print_t = cur_t + return True + + def close(self): + """Cleanup and (if leave=False) close the progressbar.""" + if self.disable: + return + + # Prevent multiple closures + self.disable = True + + # decrement instance pos and remove from internal set + pos = abs(self.pos) + self._decr_instances(self) + + if self.last_print_t < self.start_t + self.delay: + # haven't ever displayed; nothing to clear + return + + # GUI mode + if getattr(self, 'sp', None) is None: + return + + # annoyingly, _supports_unicode isn't good enough + def fp_write(s): + self.fp.write(_unicode(s)) + + try: + fp_write('') + except ValueError as e: + if 'closed' in str(e): + return + raise # pragma: no cover + + leave = pos == 0 if self.leave is None else self.leave + + with self._lock: + if leave: + # stats for overall rate (no weighted average) + self._ema_dt = lambda: None + self.display(pos=0) + fp_write('\n') + else: + # clear previous display + if self.display(msg='', pos=pos) and not pos: + fp_write('\r') + + def clear(self, nolock=False): + """Clear current bar display.""" + if self.disable: + return + + if not nolock: + self._lock.acquire() + pos = abs(self.pos) + if pos < (self.nrows or 20): + self.moveto(pos) + self.sp('') + self.fp.write('\r') # place cursor back at the beginning of line + self.moveto(-pos) + if not nolock: + self._lock.release() + + def refresh(self, nolock=False, lock_args=None): + """ + Force refresh the display of this bar. + + Parameters + ---------- + nolock : bool, optional + If `True`, does not lock. + If [default: `False`]: calls `acquire()` on internal lock. + lock_args : tuple, optional + Passed to internal lock's `acquire()`. + If specified, will only `display()` if `acquire()` returns `True`. + """ + if self.disable: + return + + if not nolock: + if lock_args: + if not self._lock.acquire(*lock_args): + return False + else: + self._lock.acquire() + self.display() + if not nolock: + self._lock.release() + return True + + def unpause(self): + """Restart tqdm timer from last print time.""" + if self.disable: + return + cur_t = self._time() + self.start_t += cur_t - self.last_print_t + self.last_print_t = cur_t + + def reset(self, total=None): + """ + Resets to 0 iterations for repeated use. + + Consider combining with `leave=True`. + + Parameters + ---------- + total : int or float, optional. Total to use for the new bar. + """ + self.n = 0 + if total is not None: + self.total = total + if self.disable: + return + self.last_print_n = 0 + self.last_print_t = self.start_t = self._time() + self._ema_dn = EMA(self.smoothing) + self._ema_dt = EMA(self.smoothing) + self._ema_miniters = EMA(self.smoothing) + self.refresh() + + def set_description(self, desc=None, refresh=True): + """ + Set/modify description of the progress bar. + + Parameters + ---------- + desc : str, optional + refresh : bool, optional + Forces refresh [default: True]. + """ + self.desc = desc + ': ' if desc else '' + if refresh: + self.refresh() + + def set_description_str(self, desc=None, refresh=True): + """Set/modify description without ': ' appended.""" + self.desc = desc or '' + if refresh: + self.refresh() + + def set_postfix(self, ordered_dict=None, refresh=True, **kwargs): + """ + Set/modify postfix (additional stats) + with automatic formatting based on datatype. + + Parameters + ---------- + ordered_dict : dict or OrderedDict, optional + refresh : bool, optional + Forces refresh [default: True]. + kwargs : dict, optional + """ + # Sort in alphabetical order to be more deterministic + postfix = OrderedDict([] if ordered_dict is None else ordered_dict) + for key in sorted(kwargs.keys()): + postfix[key] = kwargs[key] + # Preprocess stats according to datatype + for key in postfix.keys(): + # Number: limit the length of the string + if isinstance(postfix[key], Number): + postfix[key] = self.format_num(postfix[key]) + # Else for any other type, try to get the string conversion + elif not isinstance(postfix[key], _basestring): + postfix[key] = str(postfix[key]) + # Else if it's a string, don't need to preprocess anything + # Stitch together to get the final postfix + self.postfix = ', '.join(key + '=' + postfix[key].strip() + for key in postfix.keys()) + if refresh: + self.refresh() + + def set_postfix_str(self, s='', refresh=True): + """ + Postfix without dictionary expansion, similar to prefix handling. + """ + self.postfix = str(s) + if refresh: + self.refresh() + + def moveto(self, n): + # TODO: private method + self.fp.write(_unicode('\n' * n + _term_move_up() * -n)) + getattr(self.fp, 'flush', lambda: None)() + + @property + def format_dict(self): + """Public API for read-only member access.""" + if self.disable and not hasattr(self, 'unit'): + return defaultdict(lambda: None, { + 'n': self.n, 'total': self.total, 'elapsed': 0, 'unit': 'it'}) + if self.dynamic_ncols: + self.ncols, self.nrows = self.dynamic_ncols(self.fp) + return { + 'n': self.n, 'total': self.total, + 'elapsed': self._time() - self.start_t if hasattr(self, 'start_t') else 0, + 'ncols': self.ncols, 'nrows': self.nrows, 'prefix': self.desc, + 'ascii': self.ascii, 'unit': self.unit, 'unit_scale': self.unit_scale, + 'rate': self._ema_dn() / self._ema_dt() if self._ema_dt() else None, + 'bar_format': self.bar_format, 'postfix': self.postfix, + 'unit_divisor': self.unit_divisor, 'initial': self.initial, + 'colour': self.colour} + + def display(self, msg=None, pos=None): + """ + Use `self.sp` to display `msg` in the specified `pos`. + + Consider overloading this function when inheriting to use e.g.: + `self.some_frontend(**self.format_dict)` instead of `self.sp`. + + Parameters + ---------- + msg : str, optional. What to display (default: `repr(self)`). + pos : int, optional. Position to `moveto` + (default: `abs(self.pos)`). + """ + if pos is None: + pos = abs(self.pos) + + nrows = self.nrows or 20 + if pos >= nrows - 1: + if pos >= nrows: + return False + if msg or msg is None: # override at `nrows - 1` + msg = " ... (more hidden) ..." + + if not hasattr(self, "sp"): + raise TqdmDeprecationWarning( + "Please use `tqdm.gui.tqdm(...)`" + " instead of `tqdm(..., gui=True)`\n", + fp_write=getattr(self.fp, 'write', sys.stderr.write)) + + if pos: + self.moveto(pos) + self.sp(self.__str__() if msg is None else msg) + if pos: + self.moveto(-pos) + return True + + @classmethod + @contextmanager + def wrapattr(cls, stream, method, total=None, bytes=True, **tqdm_kwargs): + """ + stream : file-like object. + method : str, "read" or "write". The result of `read()` and + the first argument of `write()` should have a `len()`. + + >>> with tqdm.wrapattr(file_obj, "read", total=file_obj.size) as fobj: + ... while True: + ... chunk = fobj.read(chunk_size) + ... if not chunk: + ... break + """ + with cls(total=total, **tqdm_kwargs) as t: + if bytes: + t.unit = "B" + t.unit_scale = True + t.unit_divisor = 1024 + yield CallbackIOWrapper(t.update, stream, method) + + +def trange(*args, **kwargs): + """ + A shortcut for tqdm(xrange(*args), **kwargs). + On Python3+ range is used instead of xrange. + """ + return tqdm(_range(*args), **kwargs) diff --git a/.local/lib/python3.10/site-packages/tqdm/tk.py b/.local/lib/python3.10/site-packages/tqdm/tk.py new file mode 100644 index 0000000000000000000000000000000000000000..92adb51db3b1c5834ee610532de1403a70aed6a3 --- /dev/null +++ b/.local/lib/python3.10/site-packages/tqdm/tk.py @@ -0,0 +1,207 @@ +""" +Tkinter GUI progressbar decorator for iterators. + +Usage: +>>> from tqdm.tk import trange, tqdm +>>> for i in trange(10): +... ... +""" +from __future__ import absolute_import, division + +import re +import sys +from warnings import warn + +try: + import tkinter + import tkinter.ttk as ttk +except ImportError: + import Tkinter as tkinter + import ttk as ttk + +from .std import TqdmExperimentalWarning, TqdmWarning +from .std import tqdm as std_tqdm +from .utils import _range + +__author__ = {"github.com/": ["richardsheridan", "casperdcl"]} +__all__ = ['tqdm_tk', 'ttkrange', 'tqdm', 'trange'] + + +class tqdm_tk(std_tqdm): # pragma: no cover + """ + Experimental Tkinter GUI version of tqdm! + + Note: Window interactivity suffers if `tqdm_tk` is not running within + a Tkinter mainloop and values are generated infrequently. In this case, + consider calling `tqdm_tk.refresh()` frequently in the Tk thread. + """ + + # TODO: @classmethod: write()? + + def __init__(self, *args, **kwargs): + """ + This class accepts the following parameters *in addition* to + the parameters accepted by `tqdm`. + + Parameters + ---------- + grab : bool, optional + Grab the input across all windows of the process. + tk_parent : `tkinter.Wm`, optional + Parent Tk window. + cancel_callback : Callable, optional + Create a cancel button and set `cancel_callback` to be called + when the cancel or window close button is clicked. + """ + kwargs = kwargs.copy() + kwargs['gui'] = True + # convert disable = None to False + kwargs['disable'] = bool(kwargs.get('disable', False)) + self._warn_leave = 'leave' in kwargs + grab = kwargs.pop('grab', False) + tk_parent = kwargs.pop('tk_parent', None) + self._cancel_callback = kwargs.pop('cancel_callback', None) + super(tqdm_tk, self).__init__(*args, **kwargs) + + if self.disable: + return + + if tk_parent is None: # Discover parent widget + try: + tk_parent = tkinter._default_root + except AttributeError: + raise AttributeError( + "`tk_parent` required when using `tkinter.NoDefaultRoot()`") + if tk_parent is None: # use new default root window as display + self._tk_window = tkinter.Tk() + else: # some other windows already exist + self._tk_window = tkinter.Toplevel() + else: + self._tk_window = tkinter.Toplevel(tk_parent) + + warn("GUI is experimental/alpha", TqdmExperimentalWarning, stacklevel=2) + self._tk_dispatching = self._tk_dispatching_helper() + + self._tk_window.protocol("WM_DELETE_WINDOW", self.cancel) + self._tk_window.wm_title(self.desc) + self._tk_window.wm_attributes("-topmost", 1) + self._tk_window.after(0, lambda: self._tk_window.wm_attributes("-topmost", 0)) + self._tk_n_var = tkinter.DoubleVar(self._tk_window, value=0) + self._tk_text_var = tkinter.StringVar(self._tk_window) + pbar_frame = ttk.Frame(self._tk_window, padding=5) + pbar_frame.pack() + _tk_label = ttk.Label(pbar_frame, textvariable=self._tk_text_var, + wraplength=600, anchor="center", justify="center") + _tk_label.pack() + self._tk_pbar = ttk.Progressbar( + pbar_frame, variable=self._tk_n_var, length=450) + if self.total is not None: + self._tk_pbar.configure(maximum=self.total) + else: + self._tk_pbar.configure(mode="indeterminate") + self._tk_pbar.pack() + if self._cancel_callback is not None: + _tk_button = ttk.Button(pbar_frame, text="Cancel", command=self.cancel) + _tk_button.pack() + if grab: + self._tk_window.grab_set() + + def close(self): + if self.disable: + return + + self.disable = True + + with self.get_lock(): + self._instances.remove(self) + + def _close(): + self._tk_window.after('idle', self._tk_window.destroy) + if not self._tk_dispatching: + self._tk_window.update() + + self._tk_window.protocol("WM_DELETE_WINDOW", _close) + + # if leave is set but we are self-dispatching, the left window is + # totally unresponsive unless the user manually dispatches + if not self.leave: + _close() + elif not self._tk_dispatching: + if self._warn_leave: + warn("leave flag ignored if not in tkinter mainloop", + TqdmWarning, stacklevel=2) + _close() + + def clear(self, *_, **__): + pass + + def display(self, *_, **__): + self._tk_n_var.set(self.n) + d = self.format_dict + # remove {bar} + d['bar_format'] = (d['bar_format'] or "{l_bar}{r_bar}").replace( + "{bar}", "") + msg = self.format_meter(**d) + if '' in msg: + msg = "".join(re.split(r'\|?\|?', msg, 1)) + self._tk_text_var.set(msg) + if not self._tk_dispatching: + self._tk_window.update() + + def set_description(self, desc=None, refresh=True): + self.set_description_str(desc, refresh) + + def set_description_str(self, desc=None, refresh=True): + self.desc = desc + if not self.disable: + self._tk_window.wm_title(desc) + if refresh and not self._tk_dispatching: + self._tk_window.update() + + def cancel(self): + """ + `cancel_callback()` followed by `close()` + when close/cancel buttons clicked. + """ + if self._cancel_callback is not None: + self._cancel_callback() + self.close() + + def reset(self, total=None): + """ + Resets to 0 iterations for repeated use. + + Parameters + ---------- + total : int or float, optional. Total to use for the new bar. + """ + if hasattr(self, '_tk_pbar'): + if total is None: + self._tk_pbar.configure(maximum=100, mode="indeterminate") + else: + self._tk_pbar.configure(maximum=total, mode="determinate") + super(tqdm_tk, self).reset(total=total) + + @staticmethod + def _tk_dispatching_helper(): + """determine if Tkinter mainloop is dispatching events""" + codes = {tkinter.mainloop.__code__, tkinter.Misc.mainloop.__code__} + for frame in sys._current_frames().values(): + while frame: + if frame.f_code in codes: + return True + frame = frame.f_back + return False + + +def ttkrange(*args, **kwargs): + """ + A shortcut for `tqdm.tk.tqdm(xrange(*args), **kwargs)`. + On Python3+, `range` is used instead of `xrange`. + """ + return tqdm_tk(_range(*args), **kwargs) + + +# Aliases +tqdm = tqdm_tk +trange = ttkrange diff --git a/.local/lib/python3.10/site-packages/tqdm/tqdm.1 b/.local/lib/python3.10/site-packages/tqdm/tqdm.1 new file mode 100644 index 0000000000000000000000000000000000000000..0533198ca51425532ac1e5e96bf7af978081a9b8 --- /dev/null +++ b/.local/lib/python3.10/site-packages/tqdm/tqdm.1 @@ -0,0 +1,316 @@ +.\" Automatically generated by Pandoc 1.19.2 +.\" +.TH "TQDM" "1" "2015\-2021" "tqdm User Manuals" "" +.hy +.SH NAME +.PP +tqdm \- fast, extensible progress bar for Python and CLI +.SH SYNOPSIS +.PP +tqdm [\f[I]options\f[]] +.SH DESCRIPTION +.PP +See . +Can be used as a pipe: +.IP +.nf +\f[C] +$\ #\ count\ lines\ of\ code +$\ cat\ *.py\ |\ tqdm\ |\ wc\ \-l +327it\ [00:00,\ 981773.38it/s] +327 + +$\ #\ find\ all\ files +$\ find\ .\ \-name\ "*.py"\ |\ tqdm\ |\ wc\ \-l +432it\ [00:00,\ 833842.30it/s] +432 + +#\ ...\ and\ more\ info +$\ find\ .\ \-name\ \[aq]*.py\[aq]\ \-exec\ wc\ \-l\ \\{}\ \\;\ \\ +\ \ |\ tqdm\ \-\-total\ 432\ \-\-unit\ files\ \-\-desc\ counting\ \\ +\ \ |\ awk\ \[aq]{\ sum\ +=\ $1\ };\ END\ {\ print\ sum\ }\[aq] +counting:\ 100%|█████████|\ 432/432\ [00:00<00:00,\ 794361.83files/s] +131998 +\f[] +.fi +.SH OPTIONS +.TP +.B \-h, \-\-help +Print this help and exit. +.RS +.RE +.TP +.B \-v, \-\-version +Print version and exit. +.RS +.RE +.TP +.B \-\-desc=\f[I]desc\f[] +str, optional. +Prefix for the progressbar. +.RS +.RE +.TP +.B \-\-total=\f[I]total\f[] +int or float, optional. +The number of expected iterations. +If unspecified, len(iterable) is used if possible. +If float("inf") or as a last resort, only basic progress statistics are +displayed (no ETA, no progressbar). +If \f[C]gui\f[] is True and this parameter needs subsequent updating, +specify an initial arbitrary large positive number, e.g. +9e9. +.RS +.RE +.TP +.B \-\-leave +bool, optional. +If [default: True], keeps all traces of the progressbar upon termination +of iteration. +If \f[C]None\f[], will leave only if \f[C]position\f[] is \f[C]0\f[]. +.RS +.RE +.TP +.B \-\-ncols=\f[I]ncols\f[] +int, optional. +The width of the entire output message. +If specified, dynamically resizes the progressbar to stay within this +bound. +If unspecified, attempts to use environment width. +The fallback is a meter width of 10 and no limit for the counter and +statistics. +If 0, will not print any meter (only stats). +.RS +.RE +.TP +.B \-\-mininterval=\f[I]mininterval\f[] +float, optional. +Minimum progress display update interval [default: 0.1] seconds. +.RS +.RE +.TP +.B \-\-maxinterval=\f[I]maxinterval\f[] +float, optional. +Maximum progress display update interval [default: 10] seconds. +Automatically adjusts \f[C]miniters\f[] to correspond to +\f[C]mininterval\f[] after long display update lag. +Only works if \f[C]dynamic_miniters\f[] or monitor thread is enabled. +.RS +.RE +.TP +.B \-\-miniters=\f[I]miniters\f[] +int or float, optional. +Minimum progress display update interval, in iterations. +If 0 and \f[C]dynamic_miniters\f[], will automatically adjust to equal +\f[C]mininterval\f[] (more CPU efficient, good for tight loops). +If > 0, will skip display of specified number of iterations. +Tweak this and \f[C]mininterval\f[] to get very efficient loops. +If your progress is erratic with both fast and slow iterations (network, +skipping items, etc) you should set miniters=1. +.RS +.RE +.TP +.B \-\-ascii=\f[I]ascii\f[] +bool or str, optional. +If unspecified or False, use unicode (smooth blocks) to fill the meter. +The fallback is to use ASCII characters " 123456789#". +.RS +.RE +.TP +.B \-\-disable +bool, optional. +Whether to disable the entire progressbar wrapper [default: False]. +If set to None, disable on non\-TTY. +.RS +.RE +.TP +.B \-\-unit=\f[I]unit\f[] +str, optional. +String that will be used to define the unit of each iteration [default: +it]. +.RS +.RE +.TP +.B \-\-unit\-scale=\f[I]unit_scale\f[] +bool or int or float, optional. +If 1 or True, the number of iterations will be reduced/scaled +automatically and a metric prefix following the International System of +Units standard will be added (kilo, mega, etc.) [default: False]. +If any other non\-zero number, will scale \f[C]total\f[] and \f[C]n\f[]. +.RS +.RE +.TP +.B \-\-dynamic\-ncols +bool, optional. +If set, constantly alters \f[C]ncols\f[] and \f[C]nrows\f[] to the +environment (allowing for window resizes) [default: False]. +.RS +.RE +.TP +.B \-\-smoothing=\f[I]smoothing\f[] +float, optional. +Exponential moving average smoothing factor for speed estimates (ignored +in GUI mode). +Ranges from 0 (average speed) to 1 (current/instantaneous speed) +[default: 0.3]. +.RS +.RE +.TP +.B \-\-bar\-format=\f[I]bar_format\f[] +str, optional. +Specify a custom bar string formatting. +May impact performance. +[default: \[aq]{l_bar}{bar}{r_bar}\[aq]], where l_bar=\[aq]{desc}: +{percentage:3.0f}%|\[aq] and r_bar=\[aq]| {n_fmt}/{total_fmt} +[{elapsed}<{remaining}, \[aq] \[aq]{rate_fmt}{postfix}]\[aq] Possible +vars: l_bar, bar, r_bar, n, n_fmt, total, total_fmt, percentage, +elapsed, elapsed_s, ncols, nrows, desc, unit, rate, rate_fmt, +rate_noinv, rate_noinv_fmt, rate_inv, rate_inv_fmt, postfix, +unit_divisor, remaining, remaining_s, eta. +Note that a trailing ": " is automatically removed after {desc} if the +latter is empty. +.RS +.RE +.TP +.B \-\-initial=\f[I]initial\f[] +int or float, optional. +The initial counter value. +Useful when restarting a progress bar [default: 0]. +If using float, consider specifying \f[C]{n:.3f}\f[] or similar in +\f[C]bar_format\f[], or specifying \f[C]unit_scale\f[]. +.RS +.RE +.TP +.B \-\-position=\f[I]position\f[] +int, optional. +Specify the line offset to print this bar (starting from 0) Automatic if +unspecified. +Useful to manage multiple bars at once (eg, from threads). +.RS +.RE +.TP +.B \-\-postfix=\f[I]postfix\f[] +dict or *, optional. +Specify additional stats to display at the end of the bar. +Calls \f[C]set_postfix(**postfix)\f[] if possible (dict). +.RS +.RE +.TP +.B \-\-unit\-divisor=\f[I]unit_divisor\f[] +float, optional. +[default: 1000], ignored unless \f[C]unit_scale\f[] is True. +.RS +.RE +.TP +.B \-\-write\-bytes +bool, optional. +If (default: None) and \f[C]file\f[] is unspecified, bytes will be +written in Python 2. +If \f[C]True\f[] will also write bytes. +In all other cases will default to unicode. +.RS +.RE +.TP +.B \-\-lock\-args=\f[I]lock_args\f[] +tuple, optional. +Passed to \f[C]refresh\f[] for intermediate output (initialisation, +iterating, and updating). +.RS +.RE +.TP +.B \-\-nrows=\f[I]nrows\f[] +int, optional. +The screen height. +If specified, hides nested bars outside this bound. +If unspecified, attempts to use environment height. +The fallback is 20. +.RS +.RE +.TP +.B \-\-colour=\f[I]colour\f[] +str, optional. +Bar colour (e.g. +\[aq]green\[aq], \[aq]#00ff00\[aq]). +.RS +.RE +.TP +.B \-\-delay=\f[I]delay\f[] +float, optional. +Don\[aq]t display until [default: 0] seconds have elapsed. +.RS +.RE +.TP +.B \-\-delim=\f[I]delim\f[] +chr, optional. +Delimiting character [default: \[aq]\\n\[aq]]. +Use \[aq]\\0\[aq] for null. +N.B.: on Windows systems, Python converts \[aq]\\n\[aq] to +\[aq]\\r\\n\[aq]. +.RS +.RE +.TP +.B \-\-buf\-size=\f[I]buf_size\f[] +int, optional. +String buffer size in bytes [default: 256] used when \f[C]delim\f[] is +specified. +.RS +.RE +.TP +.B \-\-bytes +bool, optional. +If true, will count bytes, ignore \f[C]delim\f[], and default +\f[C]unit_scale\f[] to True, \f[C]unit_divisor\f[] to 1024, and +\f[C]unit\f[] to \[aq]B\[aq]. +.RS +.RE +.TP +.B \-\-tee +bool, optional. +If true, passes \f[C]stdin\f[] to both \f[C]stderr\f[] and +\f[C]stdout\f[]. +.RS +.RE +.TP +.B \-\-update +bool, optional. +If true, will treat input as newly elapsed iterations, i.e. +numbers to pass to \f[C]update()\f[]. +Note that this is slow (~2e5 it/s) since every input must be decoded as +a number. +.RS +.RE +.TP +.B \-\-update\-to +bool, optional. +If true, will treat input as total elapsed iterations, i.e. +numbers to assign to \f[C]self.n\f[]. +Note that this is slow (~2e5 it/s) since every input must be decoded as +a number. +.RS +.RE +.TP +.B \-\-null +bool, optional. +If true, will discard input (no stdout). +.RS +.RE +.TP +.B \-\-manpath=\f[I]manpath\f[] +str, optional. +Directory in which to install tqdm man pages. +.RS +.RE +.TP +.B \-\-comppath=\f[I]comppath\f[] +str, optional. +Directory in which to place tqdm completion. +.RS +.RE +.TP +.B \-\-log=\f[I]log\f[] +str, optional. +CRITICAL|FATAL|ERROR|WARN(ING)|[default: \[aq]INFO\[aq]]|DEBUG|NOTSET. +.RS +.RE +.SH AUTHORS +tqdm developers . diff --git a/.local/lib/python3.10/site-packages/tqdm/utils.py b/.local/lib/python3.10/site-packages/tqdm/utils.py new file mode 100644 index 0000000000000000000000000000000000000000..0632b8dd0536069417da6cb4e130422217941148 --- /dev/null +++ b/.local/lib/python3.10/site-packages/tqdm/utils.py @@ -0,0 +1,354 @@ +""" +General helpers required for `tqdm.std`. +""" +import os +import re +import sys +from functools import wraps +from warnings import warn +from weakref import proxy + +# py2/3 compat +try: + _range = xrange +except NameError: + _range = range + +try: + _unich = unichr +except NameError: + _unich = chr + +try: + _unicode = unicode +except NameError: + _unicode = str + +try: + _basestring = basestring +except NameError: + _basestring = str + +CUR_OS = sys.platform +IS_WIN = any(CUR_OS.startswith(i) for i in ['win32', 'cygwin']) +IS_NIX = any(CUR_OS.startswith(i) for i in ['aix', 'linux', 'darwin']) +RE_ANSI = re.compile(r"\x1b\[[;\d]*[A-Za-z]") + +try: + if IS_WIN: + import colorama + else: + raise ImportError +except ImportError: + colorama = None +else: + try: + colorama.init(strip=False) + except TypeError: + colorama.init() + + +class FormatReplace(object): + """ + >>> a = FormatReplace('something') + >>> "{:5d}".format(a) + 'something' + """ # NOQA: P102 + def __init__(self, replace=''): + self.replace = replace + self.format_called = 0 + + def __format__(self, _): + self.format_called += 1 + return self.replace + + +class Comparable(object): + """Assumes child has self._comparable attr/@property""" + def __lt__(self, other): + return self._comparable < other._comparable + + def __le__(self, other): + return (self < other) or (self == other) + + def __eq__(self, other): + return self._comparable == other._comparable + + def __ne__(self, other): + return not self == other + + def __gt__(self, other): + return not self <= other + + def __ge__(self, other): + return not self < other + + +class ObjectWrapper(object): + def __getattr__(self, name): + return getattr(self._wrapped, name) + + def __setattr__(self, name, value): + return setattr(self._wrapped, name, value) + + def wrapper_getattr(self, name): + """Actual `self.getattr` rather than self._wrapped.getattr""" + try: + return object.__getattr__(self, name) + except AttributeError: # py2 + return getattr(self, name) + + def wrapper_setattr(self, name, value): + """Actual `self.setattr` rather than self._wrapped.setattr""" + return object.__setattr__(self, name, value) + + def __init__(self, wrapped): + """ + Thin wrapper around a given object + """ + self.wrapper_setattr('_wrapped', wrapped) + + +class SimpleTextIOWrapper(ObjectWrapper): + """ + Change only `.write()` of the wrapped object by encoding the passed + value and passing the result to the wrapped object's `.write()` method. + """ + # pylint: disable=too-few-public-methods + def __init__(self, wrapped, encoding): + super(SimpleTextIOWrapper, self).__init__(wrapped) + self.wrapper_setattr('encoding', encoding) + + def write(self, s): + """ + Encode `s` and pass to the wrapped object's `.write()` method. + """ + return self._wrapped.write(s.encode(self.wrapper_getattr('encoding'))) + + def __eq__(self, other): + return self._wrapped == getattr(other, '_wrapped', other) + + +class DisableOnWriteError(ObjectWrapper): + """ + Disable the given `tqdm_instance` upon `write()` or `flush()` errors. + """ + @staticmethod + def disable_on_exception(tqdm_instance, func): + """ + Quietly set `tqdm_instance.miniters=inf` if `func` raises `errno=5`. + """ + tqdm_instance = proxy(tqdm_instance) + + def inner(*args, **kwargs): + try: + return func(*args, **kwargs) + except OSError as e: + if e.errno != 5: + raise + try: + tqdm_instance.miniters = float('inf') + except ReferenceError: + pass + except ValueError as e: + if 'closed' not in str(e): + raise + try: + tqdm_instance.miniters = float('inf') + except ReferenceError: + pass + return inner + + def __init__(self, wrapped, tqdm_instance): + super(DisableOnWriteError, self).__init__(wrapped) + if hasattr(wrapped, 'write'): + self.wrapper_setattr( + 'write', self.disable_on_exception(tqdm_instance, wrapped.write)) + if hasattr(wrapped, 'flush'): + self.wrapper_setattr( + 'flush', self.disable_on_exception(tqdm_instance, wrapped.flush)) + + def __eq__(self, other): + return self._wrapped == getattr(other, '_wrapped', other) + + +class CallbackIOWrapper(ObjectWrapper): + def __init__(self, callback, stream, method="read"): + """ + Wrap a given `file`-like object's `read()` or `write()` to report + lengths to the given `callback` + """ + super(CallbackIOWrapper, self).__init__(stream) + func = getattr(stream, method) + if method == "write": + @wraps(func) + def write(data, *args, **kwargs): + res = func(data, *args, **kwargs) + callback(len(data)) + return res + self.wrapper_setattr('write', write) + elif method == "read": + @wraps(func) + def read(*args, **kwargs): + data = func(*args, **kwargs) + callback(len(data)) + return data + self.wrapper_setattr('read', read) + else: + raise KeyError("Can only wrap read/write methods") + + +def _is_utf(encoding): + try: + u'\u2588\u2589'.encode(encoding) + except UnicodeEncodeError: + return False + except Exception: + try: + return encoding.lower().startswith('utf-') or ('U8' == encoding) + except Exception: + return False + else: + return True + + +def _supports_unicode(fp): + try: + return _is_utf(fp.encoding) + except AttributeError: + return False + + +def _is_ascii(s): + if isinstance(s, str): + for c in s: + if ord(c) > 255: + return False + return True + return _supports_unicode(s) + + +def _screen_shape_wrapper(): # pragma: no cover + """ + Return a function which returns console dimensions (width, height). + Supported: linux, osx, windows, cygwin. + """ + _screen_shape = None + if IS_WIN: + _screen_shape = _screen_shape_windows + if _screen_shape is None: + _screen_shape = _screen_shape_tput + if IS_NIX: + _screen_shape = _screen_shape_linux + return _screen_shape + + +def _screen_shape_windows(fp): # pragma: no cover + try: + import struct + from ctypes import create_string_buffer, windll + from sys import stdin, stdout + + io_handle = -12 # assume stderr + if fp == stdin: + io_handle = -10 + elif fp == stdout: + io_handle = -11 + + h = windll.kernel32.GetStdHandle(io_handle) + csbi = create_string_buffer(22) + res = windll.kernel32.GetConsoleScreenBufferInfo(h, csbi) + if res: + (_bufx, _bufy, _curx, _cury, _wattr, left, top, right, bottom, + _maxx, _maxy) = struct.unpack("hhhhHhhhhhh", csbi.raw) + return right - left, bottom - top # +1 + except Exception: # nosec + pass + return None, None + + +def _screen_shape_tput(*_): # pragma: no cover + """cygwin xterm (windows)""" + try: + import shlex + from subprocess import check_call # nosec + return [int(check_call(shlex.split('tput ' + i))) - 1 + for i in ('cols', 'lines')] + except Exception: # nosec + pass + return None, None + + +def _screen_shape_linux(fp): # pragma: no cover + + try: + from array import array + from fcntl import ioctl + from termios import TIOCGWINSZ + except ImportError: + return None, None + else: + try: + rows, cols = array('h', ioctl(fp, TIOCGWINSZ, '\0' * 8))[:2] + return cols, rows + except Exception: + try: + return [int(os.environ[i]) - 1 for i in ("COLUMNS", "LINES")] + except (KeyError, ValueError): + return None, None + + +def _environ_cols_wrapper(): # pragma: no cover + """ + Return a function which returns console width. + Supported: linux, osx, windows, cygwin. + """ + warn("Use `_screen_shape_wrapper()(file)[0]` instead of" + " `_environ_cols_wrapper()(file)`", DeprecationWarning, stacklevel=2) + shape = _screen_shape_wrapper() + if not shape: + return None + + @wraps(shape) + def inner(fp): + return shape(fp)[0] + + return inner + + +def _term_move_up(): # pragma: no cover + return '' if (os.name == 'nt') and (colorama is None) else '\x1b[A' + + +try: + # TODO consider using wcswidth third-party package for 0-width characters + from unicodedata import east_asian_width +except ImportError: + _text_width = len +else: + def _text_width(s): + return sum(2 if east_asian_width(ch) in 'FW' else 1 for ch in _unicode(s)) + + +def disp_len(data): + """ + Returns the real on-screen length of a string which may contain + ANSI control codes and wide chars. + """ + return _text_width(RE_ANSI.sub('', data)) + + +def disp_trim(data, length): + """ + Trim a string which may contain ANSI control characters. + """ + if len(data) == disp_len(data): + return data[:length] + + ansi_present = bool(RE_ANSI.search(data)) + while disp_len(data) > length: # carefully delete one char at a time + data = data[:-1] + if ansi_present and bool(RE_ANSI.search(data)): + # assume ANSI reset is required + return data if data.endswith("\033[0m") else data + "\033[0m" + return data diff --git a/.local/lib/python3.10/site-packages/tqdm/version.py b/.local/lib/python3.10/site-packages/tqdm/version.py new file mode 100644 index 0000000000000000000000000000000000000000..11cbaea79d1f4f46f9ae4bea542d7c66ded96e34 --- /dev/null +++ b/.local/lib/python3.10/site-packages/tqdm/version.py @@ -0,0 +1,9 @@ +"""`tqdm` version detector. Precedence: installed dist, git, 'UNKNOWN'.""" +try: + from ._dist_ver import __version__ +except ImportError: + try: + from setuptools_scm import get_version + __version__ = get_version(root='..', relative_to=__file__) + except (ImportError, LookupError): + __version__ = "UNKNOWN" diff --git a/.local/lib/python3.10/site-packages/yaml/__init__.py b/.local/lib/python3.10/site-packages/yaml/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..465041dce2c58f192a1f25c8b62969ec49e4e4e7 --- /dev/null +++ b/.local/lib/python3.10/site-packages/yaml/__init__.py @@ -0,0 +1,390 @@ + +from .error import * + +from .tokens import * +from .events import * +from .nodes import * + +from .loader import * +from .dumper import * + +__version__ = '6.0' +try: + from .cyaml import * + __with_libyaml__ = True +except ImportError: + __with_libyaml__ = False + +import io + +#------------------------------------------------------------------------------ +# XXX "Warnings control" is now deprecated. Leaving in the API function to not +# break code that uses it. +#------------------------------------------------------------------------------ +def warnings(settings=None): + if settings is None: + return {} + +#------------------------------------------------------------------------------ +def scan(stream, Loader=Loader): + """ + Scan a YAML stream and produce scanning tokens. + """ + loader = Loader(stream) + try: + while loader.check_token(): + yield loader.get_token() + finally: + loader.dispose() + +def parse(stream, Loader=Loader): + """ + Parse a YAML stream and produce parsing events. + """ + loader = Loader(stream) + try: + while loader.check_event(): + yield loader.get_event() + finally: + loader.dispose() + +def compose(stream, Loader=Loader): + """ + Parse the first YAML document in a stream + and produce the corresponding representation tree. + """ + loader = Loader(stream) + try: + return loader.get_single_node() + finally: + loader.dispose() + +def compose_all(stream, Loader=Loader): + """ + Parse all YAML documents in a stream + and produce corresponding representation trees. + """ + loader = Loader(stream) + try: + while loader.check_node(): + yield loader.get_node() + finally: + loader.dispose() + +def load(stream, Loader): + """ + Parse the first YAML document in a stream + and produce the corresponding Python object. + """ + loader = Loader(stream) + try: + return loader.get_single_data() + finally: + loader.dispose() + +def load_all(stream, Loader): + """ + Parse all YAML documents in a stream + and produce corresponding Python objects. + """ + loader = Loader(stream) + try: + while loader.check_data(): + yield loader.get_data() + finally: + loader.dispose() + +def full_load(stream): + """ + Parse the first YAML document in a stream + and produce the corresponding Python object. + + Resolve all tags except those known to be + unsafe on untrusted input. + """ + return load(stream, FullLoader) + +def full_load_all(stream): + """ + Parse all YAML documents in a stream + and produce corresponding Python objects. + + Resolve all tags except those known to be + unsafe on untrusted input. + """ + return load_all(stream, FullLoader) + +def safe_load(stream): + """ + Parse the first YAML document in a stream + and produce the corresponding Python object. + + Resolve only basic YAML tags. This is known + to be safe for untrusted input. + """ + return load(stream, SafeLoader) + +def safe_load_all(stream): + """ + Parse all YAML documents in a stream + and produce corresponding Python objects. + + Resolve only basic YAML tags. This is known + to be safe for untrusted input. + """ + return load_all(stream, SafeLoader) + +def unsafe_load(stream): + """ + Parse the first YAML document in a stream + and produce the corresponding Python object. + + Resolve all tags, even those known to be + unsafe on untrusted input. + """ + return load(stream, UnsafeLoader) + +def unsafe_load_all(stream): + """ + Parse all YAML documents in a stream + and produce corresponding Python objects. + + Resolve all tags, even those known to be + unsafe on untrusted input. + """ + return load_all(stream, UnsafeLoader) + +def emit(events, stream=None, Dumper=Dumper, + canonical=None, indent=None, width=None, + allow_unicode=None, line_break=None): + """ + Emit YAML parsing events into a stream. + If stream is None, return the produced string instead. + """ + getvalue = None + if stream is None: + stream = io.StringIO() + getvalue = stream.getvalue + dumper = Dumper(stream, canonical=canonical, indent=indent, width=width, + allow_unicode=allow_unicode, line_break=line_break) + try: + for event in events: + dumper.emit(event) + finally: + dumper.dispose() + if getvalue: + return getvalue() + +def serialize_all(nodes, stream=None, Dumper=Dumper, + canonical=None, indent=None, width=None, + allow_unicode=None, line_break=None, + encoding=None, explicit_start=None, explicit_end=None, + version=None, tags=None): + """ + Serialize a sequence of representation trees into a YAML stream. + If stream is None, return the produced string instead. + """ + getvalue = None + if stream is None: + if encoding is None: + stream = io.StringIO() + else: + stream = io.BytesIO() + getvalue = stream.getvalue + dumper = Dumper(stream, canonical=canonical, indent=indent, width=width, + allow_unicode=allow_unicode, line_break=line_break, + encoding=encoding, version=version, tags=tags, + explicit_start=explicit_start, explicit_end=explicit_end) + try: + dumper.open() + for node in nodes: + dumper.serialize(node) + dumper.close() + finally: + dumper.dispose() + if getvalue: + return getvalue() + +def serialize(node, stream=None, Dumper=Dumper, **kwds): + """ + Serialize a representation tree into a YAML stream. + If stream is None, return the produced string instead. + """ + return serialize_all([node], stream, Dumper=Dumper, **kwds) + +def dump_all(documents, stream=None, Dumper=Dumper, + default_style=None, default_flow_style=False, + canonical=None, indent=None, width=None, + allow_unicode=None, line_break=None, + encoding=None, explicit_start=None, explicit_end=None, + version=None, tags=None, sort_keys=True): + """ + Serialize a sequence of Python objects into a YAML stream. + If stream is None, return the produced string instead. + """ + getvalue = None + if stream is None: + if encoding is None: + stream = io.StringIO() + else: + stream = io.BytesIO() + getvalue = stream.getvalue + dumper = Dumper(stream, default_style=default_style, + default_flow_style=default_flow_style, + canonical=canonical, indent=indent, width=width, + allow_unicode=allow_unicode, line_break=line_break, + encoding=encoding, version=version, tags=tags, + explicit_start=explicit_start, explicit_end=explicit_end, sort_keys=sort_keys) + try: + dumper.open() + for data in documents: + dumper.represent(data) + dumper.close() + finally: + dumper.dispose() + if getvalue: + return getvalue() + +def dump(data, stream=None, Dumper=Dumper, **kwds): + """ + Serialize a Python object into a YAML stream. + If stream is None, return the produced string instead. + """ + return dump_all([data], stream, Dumper=Dumper, **kwds) + +def safe_dump_all(documents, stream=None, **kwds): + """ + Serialize a sequence of Python objects into a YAML stream. + Produce only basic YAML tags. + If stream is None, return the produced string instead. + """ + return dump_all(documents, stream, Dumper=SafeDumper, **kwds) + +def safe_dump(data, stream=None, **kwds): + """ + Serialize a Python object into a YAML stream. + Produce only basic YAML tags. + If stream is None, return the produced string instead. + """ + return dump_all([data], stream, Dumper=SafeDumper, **kwds) + +def add_implicit_resolver(tag, regexp, first=None, + Loader=None, Dumper=Dumper): + """ + Add an implicit scalar detector. + If an implicit scalar value matches the given regexp, + the corresponding tag is assigned to the scalar. + first is a sequence of possible initial characters or None. + """ + if Loader is None: + loader.Loader.add_implicit_resolver(tag, regexp, first) + loader.FullLoader.add_implicit_resolver(tag, regexp, first) + loader.UnsafeLoader.add_implicit_resolver(tag, regexp, first) + else: + Loader.add_implicit_resolver(tag, regexp, first) + Dumper.add_implicit_resolver(tag, regexp, first) + +def add_path_resolver(tag, path, kind=None, Loader=None, Dumper=Dumper): + """ + Add a path based resolver for the given tag. + A path is a list of keys that forms a path + to a node in the representation tree. + Keys can be string values, integers, or None. + """ + if Loader is None: + loader.Loader.add_path_resolver(tag, path, kind) + loader.FullLoader.add_path_resolver(tag, path, kind) + loader.UnsafeLoader.add_path_resolver(tag, path, kind) + else: + Loader.add_path_resolver(tag, path, kind) + Dumper.add_path_resolver(tag, path, kind) + +def add_constructor(tag, constructor, Loader=None): + """ + Add a constructor for the given tag. + Constructor is a function that accepts a Loader instance + and a node object and produces the corresponding Python object. + """ + if Loader is None: + loader.Loader.add_constructor(tag, constructor) + loader.FullLoader.add_constructor(tag, constructor) + loader.UnsafeLoader.add_constructor(tag, constructor) + else: + Loader.add_constructor(tag, constructor) + +def add_multi_constructor(tag_prefix, multi_constructor, Loader=None): + """ + Add a multi-constructor for the given tag prefix. + Multi-constructor is called for a node if its tag starts with tag_prefix. + Multi-constructor accepts a Loader instance, a tag suffix, + and a node object and produces the corresponding Python object. + """ + if Loader is None: + loader.Loader.add_multi_constructor(tag_prefix, multi_constructor) + loader.FullLoader.add_multi_constructor(tag_prefix, multi_constructor) + loader.UnsafeLoader.add_multi_constructor(tag_prefix, multi_constructor) + else: + Loader.add_multi_constructor(tag_prefix, multi_constructor) + +def add_representer(data_type, representer, Dumper=Dumper): + """ + Add a representer for the given type. + Representer is a function accepting a Dumper instance + and an instance of the given data type + and producing the corresponding representation node. + """ + Dumper.add_representer(data_type, representer) + +def add_multi_representer(data_type, multi_representer, Dumper=Dumper): + """ + Add a representer for the given type. + Multi-representer is a function accepting a Dumper instance + and an instance of the given data type or subtype + and producing the corresponding representation node. + """ + Dumper.add_multi_representer(data_type, multi_representer) + +class YAMLObjectMetaclass(type): + """ + The metaclass for YAMLObject. + """ + def __init__(cls, name, bases, kwds): + super(YAMLObjectMetaclass, cls).__init__(name, bases, kwds) + if 'yaml_tag' in kwds and kwds['yaml_tag'] is not None: + if isinstance(cls.yaml_loader, list): + for loader in cls.yaml_loader: + loader.add_constructor(cls.yaml_tag, cls.from_yaml) + else: + cls.yaml_loader.add_constructor(cls.yaml_tag, cls.from_yaml) + + cls.yaml_dumper.add_representer(cls, cls.to_yaml) + +class YAMLObject(metaclass=YAMLObjectMetaclass): + """ + An object that can dump itself to a YAML stream + and load itself from a YAML stream. + """ + + __slots__ = () # no direct instantiation, so allow immutable subclasses + + yaml_loader = [Loader, FullLoader, UnsafeLoader] + yaml_dumper = Dumper + + yaml_tag = None + yaml_flow_style = None + + @classmethod + def from_yaml(cls, loader, node): + """ + Convert a representation node to a Python object. + """ + return loader.construct_yaml_object(node, cls) + + @classmethod + def to_yaml(cls, dumper, data): + """ + Convert a Python object to a representation node. + """ + return dumper.represent_yaml_object(cls.yaml_tag, data, cls, + flow_style=cls.yaml_flow_style) + diff --git a/.local/lib/python3.10/site-packages/yaml/__pycache__/__init__.cpython-310.pyc b/.local/lib/python3.10/site-packages/yaml/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b6c92ede1a1ff5f3b2296f3ac7580df67811b6c2 Binary files /dev/null and b/.local/lib/python3.10/site-packages/yaml/__pycache__/__init__.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/yaml/__pycache__/composer.cpython-310.pyc b/.local/lib/python3.10/site-packages/yaml/__pycache__/composer.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..543fecbd7bceee739689ccd3e992ce9b0a59a142 Binary files /dev/null and b/.local/lib/python3.10/site-packages/yaml/__pycache__/composer.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/yaml/__pycache__/constructor.cpython-310.pyc b/.local/lib/python3.10/site-packages/yaml/__pycache__/constructor.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6131f00a5216f599a0682a1c7413c4418756769e Binary files /dev/null and b/.local/lib/python3.10/site-packages/yaml/__pycache__/constructor.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/yaml/__pycache__/cyaml.cpython-310.pyc b/.local/lib/python3.10/site-packages/yaml/__pycache__/cyaml.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9bff74a8e139f844759df0615c8aaf8ced793725 Binary files /dev/null and b/.local/lib/python3.10/site-packages/yaml/__pycache__/cyaml.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/yaml/__pycache__/dumper.cpython-310.pyc b/.local/lib/python3.10/site-packages/yaml/__pycache__/dumper.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..91ce72e568538e81d0721b451582388c4ec09418 Binary files /dev/null and b/.local/lib/python3.10/site-packages/yaml/__pycache__/dumper.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/yaml/__pycache__/emitter.cpython-310.pyc b/.local/lib/python3.10/site-packages/yaml/__pycache__/emitter.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2794a1c10cfe9fe916b167ff391ed82407dec7ff Binary files /dev/null and b/.local/lib/python3.10/site-packages/yaml/__pycache__/emitter.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/yaml/__pycache__/error.cpython-310.pyc b/.local/lib/python3.10/site-packages/yaml/__pycache__/error.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1f228923fef5f588c123201d36aec93b9e9a6bf0 Binary files /dev/null and b/.local/lib/python3.10/site-packages/yaml/__pycache__/error.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/yaml/__pycache__/events.cpython-310.pyc b/.local/lib/python3.10/site-packages/yaml/__pycache__/events.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0a216284a1486a88b6c710cce6676cc741dc99d5 Binary files /dev/null and b/.local/lib/python3.10/site-packages/yaml/__pycache__/events.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/yaml/__pycache__/loader.cpython-310.pyc b/.local/lib/python3.10/site-packages/yaml/__pycache__/loader.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..15318962a4ffdde8a9ee49031c09ab2c1d2cb7ee Binary files /dev/null and b/.local/lib/python3.10/site-packages/yaml/__pycache__/loader.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/yaml/__pycache__/nodes.cpython-310.pyc b/.local/lib/python3.10/site-packages/yaml/__pycache__/nodes.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..deb9196a6060138e56c01cb9d53ab58f188cc144 Binary files /dev/null and b/.local/lib/python3.10/site-packages/yaml/__pycache__/nodes.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/yaml/__pycache__/parser.cpython-310.pyc b/.local/lib/python3.10/site-packages/yaml/__pycache__/parser.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..300e452131e50f14b9ac38c017887a0a2896f848 Binary files /dev/null and b/.local/lib/python3.10/site-packages/yaml/__pycache__/parser.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/yaml/__pycache__/reader.cpython-310.pyc b/.local/lib/python3.10/site-packages/yaml/__pycache__/reader.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..81d08daa062b11f28c0f204c660cb93be65bebf6 Binary files /dev/null and b/.local/lib/python3.10/site-packages/yaml/__pycache__/reader.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/yaml/__pycache__/representer.cpython-310.pyc b/.local/lib/python3.10/site-packages/yaml/__pycache__/representer.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7e4700369e6aaa54e7f3aef526203c25dcbe5dd4 Binary files /dev/null and b/.local/lib/python3.10/site-packages/yaml/__pycache__/representer.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/yaml/__pycache__/resolver.cpython-310.pyc b/.local/lib/python3.10/site-packages/yaml/__pycache__/resolver.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3eff542da3a710f17031f5011a5dfc379389f886 Binary files /dev/null and b/.local/lib/python3.10/site-packages/yaml/__pycache__/resolver.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/yaml/__pycache__/scanner.cpython-310.pyc b/.local/lib/python3.10/site-packages/yaml/__pycache__/scanner.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f513074329c63ba37052c2e47db87a25719a882c Binary files /dev/null and b/.local/lib/python3.10/site-packages/yaml/__pycache__/scanner.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/yaml/__pycache__/serializer.cpython-310.pyc b/.local/lib/python3.10/site-packages/yaml/__pycache__/serializer.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..df57ff7c66400fdd9d9336bfd4c47be860111eb3 Binary files /dev/null and b/.local/lib/python3.10/site-packages/yaml/__pycache__/serializer.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/yaml/__pycache__/tokens.cpython-310.pyc b/.local/lib/python3.10/site-packages/yaml/__pycache__/tokens.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d2708a167090f1825a0e48c6268d53923b1537af Binary files /dev/null and b/.local/lib/python3.10/site-packages/yaml/__pycache__/tokens.cpython-310.pyc differ diff --git a/.local/lib/python3.10/site-packages/yaml/_yaml.cpython-310-x86_64-linux-gnu.so b/.local/lib/python3.10/site-packages/yaml/_yaml.cpython-310-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..d50e683523192a9ffad28760730f9dfc3ba145a4 --- /dev/null +++ b/.local/lib/python3.10/site-packages/yaml/_yaml.cpython-310-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:46c1e45766d0b514163402e827c3b75749ead8671e4426cc4a1e212247784194 +size 2165840 diff --git a/.local/lib/python3.10/site-packages/yaml/composer.py b/.local/lib/python3.10/site-packages/yaml/composer.py new file mode 100644 index 0000000000000000000000000000000000000000..6d15cb40e3b4198819c91c6f8d8b32807fcf53b2 --- /dev/null +++ b/.local/lib/python3.10/site-packages/yaml/composer.py @@ -0,0 +1,139 @@ + +__all__ = ['Composer', 'ComposerError'] + +from .error import MarkedYAMLError +from .events import * +from .nodes import * + +class ComposerError(MarkedYAMLError): + pass + +class Composer: + + def __init__(self): + self.anchors = {} + + def check_node(self): + # Drop the STREAM-START event. + if self.check_event(StreamStartEvent): + self.get_event() + + # If there are more documents available? + return not self.check_event(StreamEndEvent) + + def get_node(self): + # Get the root node of the next document. + if not self.check_event(StreamEndEvent): + return self.compose_document() + + def get_single_node(self): + # Drop the STREAM-START event. + self.get_event() + + # Compose a document if the stream is not empty. + document = None + if not self.check_event(StreamEndEvent): + document = self.compose_document() + + # Ensure that the stream contains no more documents. + if not self.check_event(StreamEndEvent): + event = self.get_event() + raise ComposerError("expected a single document in the stream", + document.start_mark, "but found another document", + event.start_mark) + + # Drop the STREAM-END event. + self.get_event() + + return document + + def compose_document(self): + # Drop the DOCUMENT-START event. + self.get_event() + + # Compose the root node. + node = self.compose_node(None, None) + + # Drop the DOCUMENT-END event. + self.get_event() + + self.anchors = {} + return node + + def compose_node(self, parent, index): + if self.check_event(AliasEvent): + event = self.get_event() + anchor = event.anchor + if anchor not in self.anchors: + raise ComposerError(None, None, "found undefined alias %r" + % anchor, event.start_mark) + return self.anchors[anchor] + event = self.peek_event() + anchor = event.anchor + if anchor is not None: + if anchor in self.anchors: + raise ComposerError("found duplicate anchor %r; first occurrence" + % anchor, self.anchors[anchor].start_mark, + "second occurrence", event.start_mark) + self.descend_resolver(parent, index) + if self.check_event(ScalarEvent): + node = self.compose_scalar_node(anchor) + elif self.check_event(SequenceStartEvent): + node = self.compose_sequence_node(anchor) + elif self.check_event(MappingStartEvent): + node = self.compose_mapping_node(anchor) + self.ascend_resolver() + return node + + def compose_scalar_node(self, anchor): + event = self.get_event() + tag = event.tag + if tag is None or tag == '!': + tag = self.resolve(ScalarNode, event.value, event.implicit) + node = ScalarNode(tag, event.value, + event.start_mark, event.end_mark, style=event.style) + if anchor is not None: + self.anchors[anchor] = node + return node + + def compose_sequence_node(self, anchor): + start_event = self.get_event() + tag = start_event.tag + if tag is None or tag == '!': + tag = self.resolve(SequenceNode, None, start_event.implicit) + node = SequenceNode(tag, [], + start_event.start_mark, None, + flow_style=start_event.flow_style) + if anchor is not None: + self.anchors[anchor] = node + index = 0 + while not self.check_event(SequenceEndEvent): + node.value.append(self.compose_node(node, index)) + index += 1 + end_event = self.get_event() + node.end_mark = end_event.end_mark + return node + + def compose_mapping_node(self, anchor): + start_event = self.get_event() + tag = start_event.tag + if tag is None or tag == '!': + tag = self.resolve(MappingNode, None, start_event.implicit) + node = MappingNode(tag, [], + start_event.start_mark, None, + flow_style=start_event.flow_style) + if anchor is not None: + self.anchors[anchor] = node + while not self.check_event(MappingEndEvent): + #key_event = self.peek_event() + item_key = self.compose_node(node, None) + #if item_key in node.value: + # raise ComposerError("while composing a mapping", start_event.start_mark, + # "found duplicate key", key_event.start_mark) + item_value = self.compose_node(node, item_key) + #node.value[item_key] = item_value + node.value.append((item_key, item_value)) + end_event = self.get_event() + node.end_mark = end_event.end_mark + return node + diff --git a/.local/lib/python3.10/site-packages/yaml/constructor.py b/.local/lib/python3.10/site-packages/yaml/constructor.py new file mode 100644 index 0000000000000000000000000000000000000000..619acd3070a4845c653fcf22a626e05158035bc2 --- /dev/null +++ b/.local/lib/python3.10/site-packages/yaml/constructor.py @@ -0,0 +1,748 @@ + +__all__ = [ + 'BaseConstructor', + 'SafeConstructor', + 'FullConstructor', + 'UnsafeConstructor', + 'Constructor', + 'ConstructorError' +] + +from .error import * +from .nodes import * + +import collections.abc, datetime, base64, binascii, re, sys, types + +class ConstructorError(MarkedYAMLError): + pass + +class BaseConstructor: + + yaml_constructors = {} + yaml_multi_constructors = {} + + def __init__(self): + self.constructed_objects = {} + self.recursive_objects = {} + self.state_generators = [] + self.deep_construct = False + + def check_data(self): + # If there are more documents available? + return self.check_node() + + def check_state_key(self, key): + """Block special attributes/methods from being set in a newly created + object, to prevent user-controlled methods from being called during + deserialization""" + if self.get_state_keys_blacklist_regexp().match(key): + raise ConstructorError(None, None, + "blacklisted key '%s' in instance state found" % (key,), None) + + def get_data(self): + # Construct and return the next document. + if self.check_node(): + return self.construct_document(self.get_node()) + + def get_single_data(self): + # Ensure that the stream contains a single document and construct it. + node = self.get_single_node() + if node is not None: + return self.construct_document(node) + return None + + def construct_document(self, node): + data = self.construct_object(node) + while self.state_generators: + state_generators = self.state_generators + self.state_generators = [] + for generator in state_generators: + for dummy in generator: + pass + self.constructed_objects = {} + self.recursive_objects = {} + self.deep_construct = False + return data + + def construct_object(self, node, deep=False): + if node in self.constructed_objects: + return self.constructed_objects[node] + if deep: + old_deep = self.deep_construct + self.deep_construct = True + if node in self.recursive_objects: + raise ConstructorError(None, None, + "found unconstructable recursive node", node.start_mark) + self.recursive_objects[node] = None + constructor = None + tag_suffix = None + if node.tag in self.yaml_constructors: + constructor = self.yaml_constructors[node.tag] + else: + for tag_prefix in self.yaml_multi_constructors: + if tag_prefix is not None and node.tag.startswith(tag_prefix): + tag_suffix = node.tag[len(tag_prefix):] + constructor = self.yaml_multi_constructors[tag_prefix] + break + else: + if None in self.yaml_multi_constructors: + tag_suffix = node.tag + constructor = self.yaml_multi_constructors[None] + elif None in self.yaml_constructors: + constructor = self.yaml_constructors[None] + elif isinstance(node, ScalarNode): + constructor = self.__class__.construct_scalar + elif isinstance(node, SequenceNode): + constructor = self.__class__.construct_sequence + elif isinstance(node, MappingNode): + constructor = self.__class__.construct_mapping + if tag_suffix is None: + data = constructor(self, node) + else: + data = constructor(self, tag_suffix, node) + if isinstance(data, types.GeneratorType): + generator = data + data = next(generator) + if self.deep_construct: + for dummy in generator: + pass + else: + self.state_generators.append(generator) + self.constructed_objects[node] = data + del self.recursive_objects[node] + if deep: + self.deep_construct = old_deep + return data + + def construct_scalar(self, node): + if not isinstance(node, ScalarNode): + raise ConstructorError(None, None, + "expected a scalar node, but found %s" % node.id, + node.start_mark) + return node.value + + def construct_sequence(self, node, deep=False): + if not isinstance(node, SequenceNode): + raise ConstructorError(None, None, + "expected a sequence node, but found %s" % node.id, + node.start_mark) + return [self.construct_object(child, deep=deep) + for child in node.value] + + def construct_mapping(self, node, deep=False): + if not isinstance(node, MappingNode): + raise ConstructorError(None, None, + "expected a mapping node, but found %s" % node.id, + node.start_mark) + mapping = {} + for key_node, value_node in node.value: + key = self.construct_object(key_node, deep=deep) + if not isinstance(key, collections.abc.Hashable): + raise ConstructorError("while constructing a mapping", node.start_mark, + "found unhashable key", key_node.start_mark) + value = self.construct_object(value_node, deep=deep) + mapping[key] = value + return mapping + + def construct_pairs(self, node, deep=False): + if not isinstance(node, MappingNode): + raise ConstructorError(None, None, + "expected a mapping node, but found %s" % node.id, + node.start_mark) + pairs = [] + for key_node, value_node in node.value: + key = self.construct_object(key_node, deep=deep) + value = self.construct_object(value_node, deep=deep) + pairs.append((key, value)) + return pairs + + @classmethod + def add_constructor(cls, tag, constructor): + if not 'yaml_constructors' in cls.__dict__: + cls.yaml_constructors = cls.yaml_constructors.copy() + cls.yaml_constructors[tag] = constructor + + @classmethod + def add_multi_constructor(cls, tag_prefix, multi_constructor): + if not 'yaml_multi_constructors' in cls.__dict__: + cls.yaml_multi_constructors = cls.yaml_multi_constructors.copy() + cls.yaml_multi_constructors[tag_prefix] = multi_constructor + +class SafeConstructor(BaseConstructor): + + def construct_scalar(self, node): + if isinstance(node, MappingNode): + for key_node, value_node in node.value: + if key_node.tag == 'tag:yaml.org,2002:value': + return self.construct_scalar(value_node) + return super().construct_scalar(node) + + def flatten_mapping(self, node): + merge = [] + index = 0 + while index < len(node.value): + key_node, value_node = node.value[index] + if key_node.tag == 'tag:yaml.org,2002:merge': + del node.value[index] + if isinstance(value_node, MappingNode): + self.flatten_mapping(value_node) + merge.extend(value_node.value) + elif isinstance(value_node, SequenceNode): + submerge = [] + for subnode in value_node.value: + if not isinstance(subnode, MappingNode): + raise ConstructorError("while constructing a mapping", + node.start_mark, + "expected a mapping for merging, but found %s" + % subnode.id, subnode.start_mark) + self.flatten_mapping(subnode) + submerge.append(subnode.value) + submerge.reverse() + for value in submerge: + merge.extend(value) + else: + raise ConstructorError("while constructing a mapping", node.start_mark, + "expected a mapping or list of mappings for merging, but found %s" + % value_node.id, value_node.start_mark) + elif key_node.tag == 'tag:yaml.org,2002:value': + key_node.tag = 'tag:yaml.org,2002:str' + index += 1 + else: + index += 1 + if merge: + node.value = merge + node.value + + def construct_mapping(self, node, deep=False): + if isinstance(node, MappingNode): + self.flatten_mapping(node) + return super().construct_mapping(node, deep=deep) + + def construct_yaml_null(self, node): + self.construct_scalar(node) + return None + + bool_values = { + 'yes': True, + 'no': False, + 'true': True, + 'false': False, + 'on': True, + 'off': False, + } + + def construct_yaml_bool(self, node): + value = self.construct_scalar(node) + return self.bool_values[value.lower()] + + def construct_yaml_int(self, node): + value = self.construct_scalar(node) + value = value.replace('_', '') + sign = +1 + if value[0] == '-': + sign = -1 + if value[0] in '+-': + value = value[1:] + if value == '0': + return 0 + elif value.startswith('0b'): + return sign*int(value[2:], 2) + elif value.startswith('0x'): + return sign*int(value[2:], 16) + elif value[0] == '0': + return sign*int(value, 8) + elif ':' in value: + digits = [int(part) for part in value.split(':')] + digits.reverse() + base = 1 + value = 0 + for digit in digits: + value += digit*base + base *= 60 + return sign*value + else: + return sign*int(value) + + inf_value = 1e300 + while inf_value != inf_value*inf_value: + inf_value *= inf_value + nan_value = -inf_value/inf_value # Trying to make a quiet NaN (like C99). + + def construct_yaml_float(self, node): + value = self.construct_scalar(node) + value = value.replace('_', '').lower() + sign = +1 + if value[0] == '-': + sign = -1 + if value[0] in '+-': + value = value[1:] + if value == '.inf': + return sign*self.inf_value + elif value == '.nan': + return self.nan_value + elif ':' in value: + digits = [float(part) for part in value.split(':')] + digits.reverse() + base = 1 + value = 0.0 + for digit in digits: + value += digit*base + base *= 60 + return sign*value + else: + return sign*float(value) + + def construct_yaml_binary(self, node): + try: + value = self.construct_scalar(node).encode('ascii') + except UnicodeEncodeError as exc: + raise ConstructorError(None, None, + "failed to convert base64 data into ascii: %s" % exc, + node.start_mark) + try: + if hasattr(base64, 'decodebytes'): + return base64.decodebytes(value) + else: + return base64.decodestring(value) + except binascii.Error as exc: + raise ConstructorError(None, None, + "failed to decode base64 data: %s" % exc, node.start_mark) + + timestamp_regexp = re.compile( + r'''^(?P[0-9][0-9][0-9][0-9]) + -(?P[0-9][0-9]?) + -(?P[0-9][0-9]?) + (?:(?:[Tt]|[ \t]+) + (?P[0-9][0-9]?) + :(?P[0-9][0-9]) + :(?P[0-9][0-9]) + (?:\.(?P[0-9]*))? + (?:[ \t]*(?PZ|(?P[-+])(?P[0-9][0-9]?) + (?::(?P[0-9][0-9]))?))?)?$''', re.X) + + def construct_yaml_timestamp(self, node): + value = self.construct_scalar(node) + match = self.timestamp_regexp.match(node.value) + values = match.groupdict() + year = int(values['year']) + month = int(values['month']) + day = int(values['day']) + if not values['hour']: + return datetime.date(year, month, day) + hour = int(values['hour']) + minute = int(values['minute']) + second = int(values['second']) + fraction = 0 + tzinfo = None + if values['fraction']: + fraction = values['fraction'][:6] + while len(fraction) < 6: + fraction += '0' + fraction = int(fraction) + if values['tz_sign']: + tz_hour = int(values['tz_hour']) + tz_minute = int(values['tz_minute'] or 0) + delta = datetime.timedelta(hours=tz_hour, minutes=tz_minute) + if values['tz_sign'] == '-': + delta = -delta + tzinfo = datetime.timezone(delta) + elif values['tz']: + tzinfo = datetime.timezone.utc + return datetime.datetime(year, month, day, hour, minute, second, fraction, + tzinfo=tzinfo) + + def construct_yaml_omap(self, node): + # Note: we do not check for duplicate keys, because it's too + # CPU-expensive. + omap = [] + yield omap + if not isinstance(node, SequenceNode): + raise ConstructorError("while constructing an ordered map", node.start_mark, + "expected a sequence, but found %s" % node.id, node.start_mark) + for subnode in node.value: + if not isinstance(subnode, MappingNode): + raise ConstructorError("while constructing an ordered map", node.start_mark, + "expected a mapping of length 1, but found %s" % subnode.id, + subnode.start_mark) + if len(subnode.value) != 1: + raise ConstructorError("while constructing an ordered map", node.start_mark, + "expected a single mapping item, but found %d items" % len(subnode.value), + subnode.start_mark) + key_node, value_node = subnode.value[0] + key = self.construct_object(key_node) + value = self.construct_object(value_node) + omap.append((key, value)) + + def construct_yaml_pairs(self, node): + # Note: the same code as `construct_yaml_omap`. + pairs = [] + yield pairs + if not isinstance(node, SequenceNode): + raise ConstructorError("while constructing pairs", node.start_mark, + "expected a sequence, but found %s" % node.id, node.start_mark) + for subnode in node.value: + if not isinstance(subnode, MappingNode): + raise ConstructorError("while constructing pairs", node.start_mark, + "expected a mapping of length 1, but found %s" % subnode.id, + subnode.start_mark) + if len(subnode.value) != 1: + raise ConstructorError("while constructing pairs", node.start_mark, + "expected a single mapping item, but found %d items" % len(subnode.value), + subnode.start_mark) + key_node, value_node = subnode.value[0] + key = self.construct_object(key_node) + value = self.construct_object(value_node) + pairs.append((key, value)) + + def construct_yaml_set(self, node): + data = set() + yield data + value = self.construct_mapping(node) + data.update(value) + + def construct_yaml_str(self, node): + return self.construct_scalar(node) + + def construct_yaml_seq(self, node): + data = [] + yield data + data.extend(self.construct_sequence(node)) + + def construct_yaml_map(self, node): + data = {} + yield data + value = self.construct_mapping(node) + data.update(value) + + def construct_yaml_object(self, node, cls): + data = cls.__new__(cls) + yield data + if hasattr(data, '__setstate__'): + state = self.construct_mapping(node, deep=True) + data.__setstate__(state) + else: + state = self.construct_mapping(node) + data.__dict__.update(state) + + def construct_undefined(self, node): + raise ConstructorError(None, None, + "could not determine a constructor for the tag %r" % node.tag, + node.start_mark) + +SafeConstructor.add_constructor( + 'tag:yaml.org,2002:null', + SafeConstructor.construct_yaml_null) + +SafeConstructor.add_constructor( + 'tag:yaml.org,2002:bool', + SafeConstructor.construct_yaml_bool) + +SafeConstructor.add_constructor( + 'tag:yaml.org,2002:int', + SafeConstructor.construct_yaml_int) + +SafeConstructor.add_constructor( + 'tag:yaml.org,2002:float', + SafeConstructor.construct_yaml_float) + +SafeConstructor.add_constructor( + 'tag:yaml.org,2002:binary', + SafeConstructor.construct_yaml_binary) + +SafeConstructor.add_constructor( + 'tag:yaml.org,2002:timestamp', + SafeConstructor.construct_yaml_timestamp) + +SafeConstructor.add_constructor( + 'tag:yaml.org,2002:omap', + SafeConstructor.construct_yaml_omap) + +SafeConstructor.add_constructor( + 'tag:yaml.org,2002:pairs', + SafeConstructor.construct_yaml_pairs) + +SafeConstructor.add_constructor( + 'tag:yaml.org,2002:set', + SafeConstructor.construct_yaml_set) + +SafeConstructor.add_constructor( + 'tag:yaml.org,2002:str', + SafeConstructor.construct_yaml_str) + +SafeConstructor.add_constructor( + 'tag:yaml.org,2002:seq', + SafeConstructor.construct_yaml_seq) + +SafeConstructor.add_constructor( + 'tag:yaml.org,2002:map', + SafeConstructor.construct_yaml_map) + +SafeConstructor.add_constructor(None, + SafeConstructor.construct_undefined) + +class FullConstructor(SafeConstructor): + # 'extend' is blacklisted because it is used by + # construct_python_object_apply to add `listitems` to a newly generate + # python instance + def get_state_keys_blacklist(self): + return ['^extend$', '^__.*__$'] + + def get_state_keys_blacklist_regexp(self): + if not hasattr(self, 'state_keys_blacklist_regexp'): + self.state_keys_blacklist_regexp = re.compile('(' + '|'.join(self.get_state_keys_blacklist()) + ')') + return self.state_keys_blacklist_regexp + + def construct_python_str(self, node): + return self.construct_scalar(node) + + def construct_python_unicode(self, node): + return self.construct_scalar(node) + + def construct_python_bytes(self, node): + try: + value = self.construct_scalar(node).encode('ascii') + except UnicodeEncodeError as exc: + raise ConstructorError(None, None, + "failed to convert base64 data into ascii: %s" % exc, + node.start_mark) + try: + if hasattr(base64, 'decodebytes'): + return base64.decodebytes(value) + else: + return base64.decodestring(value) + except binascii.Error as exc: + raise ConstructorError(None, None, + "failed to decode base64 data: %s" % exc, node.start_mark) + + def construct_python_long(self, node): + return self.construct_yaml_int(node) + + def construct_python_complex(self, node): + return complex(self.construct_scalar(node)) + + def construct_python_tuple(self, node): + return tuple(self.construct_sequence(node)) + + def find_python_module(self, name, mark, unsafe=False): + if not name: + raise ConstructorError("while constructing a Python module", mark, + "expected non-empty name appended to the tag", mark) + if unsafe: + try: + __import__(name) + except ImportError as exc: + raise ConstructorError("while constructing a Python module", mark, + "cannot find module %r (%s)" % (name, exc), mark) + if name not in sys.modules: + raise ConstructorError("while constructing a Python module", mark, + "module %r is not imported" % name, mark) + return sys.modules[name] + + def find_python_name(self, name, mark, unsafe=False): + if not name: + raise ConstructorError("while constructing a Python object", mark, + "expected non-empty name appended to the tag", mark) + if '.' in name: + module_name, object_name = name.rsplit('.', 1) + else: + module_name = 'builtins' + object_name = name + if unsafe: + try: + __import__(module_name) + except ImportError as exc: + raise ConstructorError("while constructing a Python object", mark, + "cannot find module %r (%s)" % (module_name, exc), mark) + if module_name not in sys.modules: + raise ConstructorError("while constructing a Python object", mark, + "module %r is not imported" % module_name, mark) + module = sys.modules[module_name] + if not hasattr(module, object_name): + raise ConstructorError("while constructing a Python object", mark, + "cannot find %r in the module %r" + % (object_name, module.__name__), mark) + return getattr(module, object_name) + + def construct_python_name(self, suffix, node): + value = self.construct_scalar(node) + if value: + raise ConstructorError("while constructing a Python name", node.start_mark, + "expected the empty value, but found %r" % value, node.start_mark) + return self.find_python_name(suffix, node.start_mark) + + def construct_python_module(self, suffix, node): + value = self.construct_scalar(node) + if value: + raise ConstructorError("while constructing a Python module", node.start_mark, + "expected the empty value, but found %r" % value, node.start_mark) + return self.find_python_module(suffix, node.start_mark) + + def make_python_instance(self, suffix, node, + args=None, kwds=None, newobj=False, unsafe=False): + if not args: + args = [] + if not kwds: + kwds = {} + cls = self.find_python_name(suffix, node.start_mark) + if not (unsafe or isinstance(cls, type)): + raise ConstructorError("while constructing a Python instance", node.start_mark, + "expected a class, but found %r" % type(cls), + node.start_mark) + if newobj and isinstance(cls, type): + return cls.__new__(cls, *args, **kwds) + else: + return cls(*args, **kwds) + + def set_python_instance_state(self, instance, state, unsafe=False): + if hasattr(instance, '__setstate__'): + instance.__setstate__(state) + else: + slotstate = {} + if isinstance(state, tuple) and len(state) == 2: + state, slotstate = state + if hasattr(instance, '__dict__'): + if not unsafe and state: + for key in state.keys(): + self.check_state_key(key) + instance.__dict__.update(state) + elif state: + slotstate.update(state) + for key, value in slotstate.items(): + if not unsafe: + self.check_state_key(key) + setattr(instance, key, value) + + def construct_python_object(self, suffix, node): + # Format: + # !!python/object:module.name { ... state ... } + instance = self.make_python_instance(suffix, node, newobj=True) + yield instance + deep = hasattr(instance, '__setstate__') + state = self.construct_mapping(node, deep=deep) + self.set_python_instance_state(instance, state) + + def construct_python_object_apply(self, suffix, node, newobj=False): + # Format: + # !!python/object/apply # (or !!python/object/new) + # args: [ ... arguments ... ] + # kwds: { ... keywords ... } + # state: ... state ... + # listitems: [ ... listitems ... ] + # dictitems: { ... dictitems ... } + # or short format: + # !!python/object/apply [ ... arguments ... ] + # The difference between !!python/object/apply and !!python/object/new + # is how an object is created, check make_python_instance for details. + if isinstance(node, SequenceNode): + args = self.construct_sequence(node, deep=True) + kwds = {} + state = {} + listitems = [] + dictitems = {} + else: + value = self.construct_mapping(node, deep=True) + args = value.get('args', []) + kwds = value.get('kwds', {}) + state = value.get('state', {}) + listitems = value.get('listitems', []) + dictitems = value.get('dictitems', {}) + instance = self.make_python_instance(suffix, node, args, kwds, newobj) + if state: + self.set_python_instance_state(instance, state) + if listitems: + instance.extend(listitems) + if dictitems: + for key in dictitems: + instance[key] = dictitems[key] + return instance + + def construct_python_object_new(self, suffix, node): + return self.construct_python_object_apply(suffix, node, newobj=True) + +FullConstructor.add_constructor( + 'tag:yaml.org,2002:python/none', + FullConstructor.construct_yaml_null) + +FullConstructor.add_constructor( + 'tag:yaml.org,2002:python/bool', + FullConstructor.construct_yaml_bool) + +FullConstructor.add_constructor( + 'tag:yaml.org,2002:python/str', + FullConstructor.construct_python_str) + +FullConstructor.add_constructor( + 'tag:yaml.org,2002:python/unicode', + FullConstructor.construct_python_unicode) + +FullConstructor.add_constructor( + 'tag:yaml.org,2002:python/bytes', + FullConstructor.construct_python_bytes) + +FullConstructor.add_constructor( + 'tag:yaml.org,2002:python/int', + FullConstructor.construct_yaml_int) + +FullConstructor.add_constructor( + 'tag:yaml.org,2002:python/long', + FullConstructor.construct_python_long) + +FullConstructor.add_constructor( + 'tag:yaml.org,2002:python/float', + FullConstructor.construct_yaml_float) + +FullConstructor.add_constructor( + 'tag:yaml.org,2002:python/complex', + FullConstructor.construct_python_complex) + +FullConstructor.add_constructor( + 'tag:yaml.org,2002:python/list', + FullConstructor.construct_yaml_seq) + +FullConstructor.add_constructor( + 'tag:yaml.org,2002:python/tuple', + FullConstructor.construct_python_tuple) + +FullConstructor.add_constructor( + 'tag:yaml.org,2002:python/dict', + FullConstructor.construct_yaml_map) + +FullConstructor.add_multi_constructor( + 'tag:yaml.org,2002:python/name:', + FullConstructor.construct_python_name) + +class UnsafeConstructor(FullConstructor): + + def find_python_module(self, name, mark): + return super(UnsafeConstructor, self).find_python_module(name, mark, unsafe=True) + + def find_python_name(self, name, mark): + return super(UnsafeConstructor, self).find_python_name(name, mark, unsafe=True) + + def make_python_instance(self, suffix, node, args=None, kwds=None, newobj=False): + return super(UnsafeConstructor, self).make_python_instance( + suffix, node, args, kwds, newobj, unsafe=True) + + def set_python_instance_state(self, instance, state): + return super(UnsafeConstructor, self).set_python_instance_state( + instance, state, unsafe=True) + +UnsafeConstructor.add_multi_constructor( + 'tag:yaml.org,2002:python/module:', + UnsafeConstructor.construct_python_module) + +UnsafeConstructor.add_multi_constructor( + 'tag:yaml.org,2002:python/object:', + UnsafeConstructor.construct_python_object) + +UnsafeConstructor.add_multi_constructor( + 'tag:yaml.org,2002:python/object/new:', + UnsafeConstructor.construct_python_object_new) + +UnsafeConstructor.add_multi_constructor( + 'tag:yaml.org,2002:python/object/apply:', + UnsafeConstructor.construct_python_object_apply) + +# Constructor is same as UnsafeConstructor. Need to leave this in place in case +# people have extended it directly. +class Constructor(UnsafeConstructor): + pass diff --git a/.local/lib/python3.10/site-packages/yaml/cyaml.py b/.local/lib/python3.10/site-packages/yaml/cyaml.py new file mode 100644 index 0000000000000000000000000000000000000000..0c21345879b298bb8668201bebe7d289586b17f9 --- /dev/null +++ b/.local/lib/python3.10/site-packages/yaml/cyaml.py @@ -0,0 +1,101 @@ + +__all__ = [ + 'CBaseLoader', 'CSafeLoader', 'CFullLoader', 'CUnsafeLoader', 'CLoader', + 'CBaseDumper', 'CSafeDumper', 'CDumper' +] + +from yaml._yaml import CParser, CEmitter + +from .constructor import * + +from .serializer import * +from .representer import * + +from .resolver import * + +class CBaseLoader(CParser, BaseConstructor, BaseResolver): + + def __init__(self, stream): + CParser.__init__(self, stream) + BaseConstructor.__init__(self) + BaseResolver.__init__(self) + +class CSafeLoader(CParser, SafeConstructor, Resolver): + + def __init__(self, stream): + CParser.__init__(self, stream) + SafeConstructor.__init__(self) + Resolver.__init__(self) + +class CFullLoader(CParser, FullConstructor, Resolver): + + def __init__(self, stream): + CParser.__init__(self, stream) + FullConstructor.__init__(self) + Resolver.__init__(self) + +class CUnsafeLoader(CParser, UnsafeConstructor, Resolver): + + def __init__(self, stream): + CParser.__init__(self, stream) + UnsafeConstructor.__init__(self) + Resolver.__init__(self) + +class CLoader(CParser, Constructor, Resolver): + + def __init__(self, stream): + CParser.__init__(self, stream) + Constructor.__init__(self) + Resolver.__init__(self) + +class CBaseDumper(CEmitter, BaseRepresenter, BaseResolver): + + def __init__(self, stream, + default_style=None, default_flow_style=False, + canonical=None, indent=None, width=None, + allow_unicode=None, line_break=None, + encoding=None, explicit_start=None, explicit_end=None, + version=None, tags=None, sort_keys=True): + CEmitter.__init__(self, stream, canonical=canonical, + indent=indent, width=width, encoding=encoding, + allow_unicode=allow_unicode, line_break=line_break, + explicit_start=explicit_start, explicit_end=explicit_end, + version=version, tags=tags) + Representer.__init__(self, default_style=default_style, + default_flow_style=default_flow_style, sort_keys=sort_keys) + Resolver.__init__(self) + +class CSafeDumper(CEmitter, SafeRepresenter, Resolver): + + def __init__(self, stream, + default_style=None, default_flow_style=False, + canonical=None, indent=None, width=None, + allow_unicode=None, line_break=None, + encoding=None, explicit_start=None, explicit_end=None, + version=None, tags=None, sort_keys=True): + CEmitter.__init__(self, stream, canonical=canonical, + indent=indent, width=width, encoding=encoding, + allow_unicode=allow_unicode, line_break=line_break, + explicit_start=explicit_start, explicit_end=explicit_end, + version=version, tags=tags) + SafeRepresenter.__init__(self, default_style=default_style, + default_flow_style=default_flow_style, sort_keys=sort_keys) + Resolver.__init__(self) + +class CDumper(CEmitter, Serializer, Representer, Resolver): + + def __init__(self, stream, + default_style=None, default_flow_style=False, + canonical=None, indent=None, width=None, + allow_unicode=None, line_break=None, + encoding=None, explicit_start=None, explicit_end=None, + version=None, tags=None, sort_keys=True): + CEmitter.__init__(self, stream, canonical=canonical, + indent=indent, width=width, encoding=encoding, + allow_unicode=allow_unicode, line_break=line_break, + explicit_start=explicit_start, explicit_end=explicit_end, + version=version, tags=tags) + Representer.__init__(self, default_style=default_style, + default_flow_style=default_flow_style, sort_keys=sort_keys) + Resolver.__init__(self) + diff --git a/.local/lib/python3.10/site-packages/yaml/dumper.py b/.local/lib/python3.10/site-packages/yaml/dumper.py new file mode 100644 index 0000000000000000000000000000000000000000..6aadba551f3836b02f4752277f4b3027073defad --- /dev/null +++ b/.local/lib/python3.10/site-packages/yaml/dumper.py @@ -0,0 +1,62 @@ + +__all__ = ['BaseDumper', 'SafeDumper', 'Dumper'] + +from .emitter import * +from .serializer import * +from .representer import * +from .resolver import * + +class BaseDumper(Emitter, Serializer, BaseRepresenter, BaseResolver): + + def __init__(self, stream, + default_style=None, default_flow_style=False, + canonical=None, indent=None, width=None, + allow_unicode=None, line_break=None, + encoding=None, explicit_start=None, explicit_end=None, + version=None, tags=None, sort_keys=True): + Emitter.__init__(self, stream, canonical=canonical, + indent=indent, width=width, + allow_unicode=allow_unicode, line_break=line_break) + Serializer.__init__(self, encoding=encoding, + explicit_start=explicit_start, explicit_end=explicit_end, + version=version, tags=tags) + Representer.__init__(self, default_style=default_style, + default_flow_style=default_flow_style, sort_keys=sort_keys) + Resolver.__init__(self) + +class SafeDumper(Emitter, Serializer, SafeRepresenter, Resolver): + + def __init__(self, stream, + default_style=None, default_flow_style=False, + canonical=None, indent=None, width=None, + allow_unicode=None, line_break=None, + encoding=None, explicit_start=None, explicit_end=None, + version=None, tags=None, sort_keys=True): + Emitter.__init__(self, stream, canonical=canonical, + indent=indent, width=width, + allow_unicode=allow_unicode, line_break=line_break) + Serializer.__init__(self, encoding=encoding, + explicit_start=explicit_start, explicit_end=explicit_end, + version=version, tags=tags) + SafeRepresenter.__init__(self, default_style=default_style, + default_flow_style=default_flow_style, sort_keys=sort_keys) + Resolver.__init__(self) + +class Dumper(Emitter, Serializer, Representer, Resolver): + + def __init__(self, stream, + default_style=None, default_flow_style=False, + canonical=None, indent=None, width=None, + allow_unicode=None, line_break=None, + encoding=None, explicit_start=None, explicit_end=None, + version=None, tags=None, sort_keys=True): + Emitter.__init__(self, stream, canonical=canonical, + indent=indent, width=width, + allow_unicode=allow_unicode, line_break=line_break) + Serializer.__init__(self, encoding=encoding, + explicit_start=explicit_start, explicit_end=explicit_end, + version=version, tags=tags) + Representer.__init__(self, default_style=default_style, + default_flow_style=default_flow_style, sort_keys=sort_keys) + Resolver.__init__(self) + diff --git a/.local/lib/python3.10/site-packages/yaml/emitter.py b/.local/lib/python3.10/site-packages/yaml/emitter.py new file mode 100644 index 0000000000000000000000000000000000000000..a664d011162af69184df2f8e59ab7feec818f7c7 --- /dev/null +++ b/.local/lib/python3.10/site-packages/yaml/emitter.py @@ -0,0 +1,1137 @@ + +# Emitter expects events obeying the following grammar: +# stream ::= STREAM-START document* STREAM-END +# document ::= DOCUMENT-START node DOCUMENT-END +# node ::= SCALAR | sequence | mapping +# sequence ::= SEQUENCE-START node* SEQUENCE-END +# mapping ::= MAPPING-START (node node)* MAPPING-END + +__all__ = ['Emitter', 'EmitterError'] + +from .error import YAMLError +from .events import * + +class EmitterError(YAMLError): + pass + +class ScalarAnalysis: + def __init__(self, scalar, empty, multiline, + allow_flow_plain, allow_block_plain, + allow_single_quoted, allow_double_quoted, + allow_block): + self.scalar = scalar + self.empty = empty + self.multiline = multiline + self.allow_flow_plain = allow_flow_plain + self.allow_block_plain = allow_block_plain + self.allow_single_quoted = allow_single_quoted + self.allow_double_quoted = allow_double_quoted + self.allow_block = allow_block + +class Emitter: + + DEFAULT_TAG_PREFIXES = { + '!' : '!', + 'tag:yaml.org,2002:' : '!!', + } + + def __init__(self, stream, canonical=None, indent=None, width=None, + allow_unicode=None, line_break=None): + + # The stream should have the methods `write` and possibly `flush`. + self.stream = stream + + # Encoding can be overridden by STREAM-START. + self.encoding = None + + # Emitter is a state machine with a stack of states to handle nested + # structures. + self.states = [] + self.state = self.expect_stream_start + + # Current event and the event queue. + self.events = [] + self.event = None + + # The current indentation level and the stack of previous indents. + self.indents = [] + self.indent = None + + # Flow level. + self.flow_level = 0 + + # Contexts. + self.root_context = False + self.sequence_context = False + self.mapping_context = False + self.simple_key_context = False + + # Characteristics of the last emitted character: + # - current position. + # - is it a whitespace? + # - is it an indention character + # (indentation space, '-', '?', or ':')? + self.line = 0 + self.column = 0 + self.whitespace = True + self.indention = True + + # Whether the document requires an explicit document indicator + self.open_ended = False + + # Formatting details. + self.canonical = canonical + self.allow_unicode = allow_unicode + self.best_indent = 2 + if indent and 1 < indent < 10: + self.best_indent = indent + self.best_width = 80 + if width and width > self.best_indent*2: + self.best_width = width + self.best_line_break = '\n' + if line_break in ['\r', '\n', '\r\n']: + self.best_line_break = line_break + + # Tag prefixes. + self.tag_prefixes = None + + # Prepared anchor and tag. + self.prepared_anchor = None + self.prepared_tag = None + + # Scalar analysis and style. + self.analysis = None + self.style = None + + def dispose(self): + # Reset the state attributes (to clear self-references) + self.states = [] + self.state = None + + def emit(self, event): + self.events.append(event) + while not self.need_more_events(): + self.event = self.events.pop(0) + self.state() + self.event = None + + # In some cases, we wait for a few next events before emitting. + + def need_more_events(self): + if not self.events: + return True + event = self.events[0] + if isinstance(event, DocumentStartEvent): + return self.need_events(1) + elif isinstance(event, SequenceStartEvent): + return self.need_events(2) + elif isinstance(event, MappingStartEvent): + return self.need_events(3) + else: + return False + + def need_events(self, count): + level = 0 + for event in self.events[1:]: + if isinstance(event, (DocumentStartEvent, CollectionStartEvent)): + level += 1 + elif isinstance(event, (DocumentEndEvent, CollectionEndEvent)): + level -= 1 + elif isinstance(event, StreamEndEvent): + level = -1 + if level < 0: + return False + return (len(self.events) < count+1) + + def increase_indent(self, flow=False, indentless=False): + self.indents.append(self.indent) + if self.indent is None: + if flow: + self.indent = self.best_indent + else: + self.indent = 0 + elif not indentless: + self.indent += self.best_indent + + # States. + + # Stream handlers. + + def expect_stream_start(self): + if isinstance(self.event, StreamStartEvent): + if self.event.encoding and not hasattr(self.stream, 'encoding'): + self.encoding = self.event.encoding + self.write_stream_start() + self.state = self.expect_first_document_start + else: + raise EmitterError("expected StreamStartEvent, but got %s" + % self.event) + + def expect_nothing(self): + raise EmitterError("expected nothing, but got %s" % self.event) + + # Document handlers. + + def expect_first_document_start(self): + return self.expect_document_start(first=True) + + def expect_document_start(self, first=False): + if isinstance(self.event, DocumentStartEvent): + if (self.event.version or self.event.tags) and self.open_ended: + self.write_indicator('...', True) + self.write_indent() + if self.event.version: + version_text = self.prepare_version(self.event.version) + self.write_version_directive(version_text) + self.tag_prefixes = self.DEFAULT_TAG_PREFIXES.copy() + if self.event.tags: + handles = sorted(self.event.tags.keys()) + for handle in handles: + prefix = self.event.tags[handle] + self.tag_prefixes[prefix] = handle + handle_text = self.prepare_tag_handle(handle) + prefix_text = self.prepare_tag_prefix(prefix) + self.write_tag_directive(handle_text, prefix_text) + implicit = (first and not self.event.explicit and not self.canonical + and not self.event.version and not self.event.tags + and not self.check_empty_document()) + if not implicit: + self.write_indent() + self.write_indicator('---', True) + if self.canonical: + self.write_indent() + self.state = self.expect_document_root + elif isinstance(self.event, StreamEndEvent): + if self.open_ended: + self.write_indicator('...', True) + self.write_indent() + self.write_stream_end() + self.state = self.expect_nothing + else: + raise EmitterError("expected DocumentStartEvent, but got %s" + % self.event) + + def expect_document_end(self): + if isinstance(self.event, DocumentEndEvent): + self.write_indent() + if self.event.explicit: + self.write_indicator('...', True) + self.write_indent() + self.flush_stream() + self.state = self.expect_document_start + else: + raise EmitterError("expected DocumentEndEvent, but got %s" + % self.event) + + def expect_document_root(self): + self.states.append(self.expect_document_end) + self.expect_node(root=True) + + # Node handlers. + + def expect_node(self, root=False, sequence=False, mapping=False, + simple_key=False): + self.root_context = root + self.sequence_context = sequence + self.mapping_context = mapping + self.simple_key_context = simple_key + if isinstance(self.event, AliasEvent): + self.expect_alias() + elif isinstance(self.event, (ScalarEvent, CollectionStartEvent)): + self.process_anchor('&') + self.process_tag() + if isinstance(self.event, ScalarEvent): + self.expect_scalar() + elif isinstance(self.event, SequenceStartEvent): + if self.flow_level or self.canonical or self.event.flow_style \ + or self.check_empty_sequence(): + self.expect_flow_sequence() + else: + self.expect_block_sequence() + elif isinstance(self.event, MappingStartEvent): + if self.flow_level or self.canonical or self.event.flow_style \ + or self.check_empty_mapping(): + self.expect_flow_mapping() + else: + self.expect_block_mapping() + else: + raise EmitterError("expected NodeEvent, but got %s" % self.event) + + def expect_alias(self): + if self.event.anchor is None: + raise EmitterError("anchor is not specified for alias") + self.process_anchor('*') + self.state = self.states.pop() + + def expect_scalar(self): + self.increase_indent(flow=True) + self.process_scalar() + self.indent = self.indents.pop() + self.state = self.states.pop() + + # Flow sequence handlers. + + def expect_flow_sequence(self): + self.write_indicator('[', True, whitespace=True) + self.flow_level += 1 + self.increase_indent(flow=True) + self.state = self.expect_first_flow_sequence_item + + def expect_first_flow_sequence_item(self): + if isinstance(self.event, SequenceEndEvent): + self.indent = self.indents.pop() + self.flow_level -= 1 + self.write_indicator(']', False) + self.state = self.states.pop() + else: + if self.canonical or self.column > self.best_width: + self.write_indent() + self.states.append(self.expect_flow_sequence_item) + self.expect_node(sequence=True) + + def expect_flow_sequence_item(self): + if isinstance(self.event, SequenceEndEvent): + self.indent = self.indents.pop() + self.flow_level -= 1 + if self.canonical: + self.write_indicator(',', False) + self.write_indent() + self.write_indicator(']', False) + self.state = self.states.pop() + else: + self.write_indicator(',', False) + if self.canonical or self.column > self.best_width: + self.write_indent() + self.states.append(self.expect_flow_sequence_item) + self.expect_node(sequence=True) + + # Flow mapping handlers. + + def expect_flow_mapping(self): + self.write_indicator('{', True, whitespace=True) + self.flow_level += 1 + self.increase_indent(flow=True) + self.state = self.expect_first_flow_mapping_key + + def expect_first_flow_mapping_key(self): + if isinstance(self.event, MappingEndEvent): + self.indent = self.indents.pop() + self.flow_level -= 1 + self.write_indicator('}', False) + self.state = self.states.pop() + else: + if self.canonical or self.column > self.best_width: + self.write_indent() + if not self.canonical and self.check_simple_key(): + self.states.append(self.expect_flow_mapping_simple_value) + self.expect_node(mapping=True, simple_key=True) + else: + self.write_indicator('?', True) + self.states.append(self.expect_flow_mapping_value) + self.expect_node(mapping=True) + + def expect_flow_mapping_key(self): + if isinstance(self.event, MappingEndEvent): + self.indent = self.indents.pop() + self.flow_level -= 1 + if self.canonical: + self.write_indicator(',', False) + self.write_indent() + self.write_indicator('}', False) + self.state = self.states.pop() + else: + self.write_indicator(',', False) + if self.canonical or self.column > self.best_width: + self.write_indent() + if not self.canonical and self.check_simple_key(): + self.states.append(self.expect_flow_mapping_simple_value) + self.expect_node(mapping=True, simple_key=True) + else: + self.write_indicator('?', True) + self.states.append(self.expect_flow_mapping_value) + self.expect_node(mapping=True) + + def expect_flow_mapping_simple_value(self): + self.write_indicator(':', False) + self.states.append(self.expect_flow_mapping_key) + self.expect_node(mapping=True) + + def expect_flow_mapping_value(self): + if self.canonical or self.column > self.best_width: + self.write_indent() + self.write_indicator(':', True) + self.states.append(self.expect_flow_mapping_key) + self.expect_node(mapping=True) + + # Block sequence handlers. + + def expect_block_sequence(self): + indentless = (self.mapping_context and not self.indention) + self.increase_indent(flow=False, indentless=indentless) + self.state = self.expect_first_block_sequence_item + + def expect_first_block_sequence_item(self): + return self.expect_block_sequence_item(first=True) + + def expect_block_sequence_item(self, first=False): + if not first and isinstance(self.event, SequenceEndEvent): + self.indent = self.indents.pop() + self.state = self.states.pop() + else: + self.write_indent() + self.write_indicator('-', True, indention=True) + self.states.append(self.expect_block_sequence_item) + self.expect_node(sequence=True) + + # Block mapping handlers. + + def expect_block_mapping(self): + self.increase_indent(flow=False) + self.state = self.expect_first_block_mapping_key + + def expect_first_block_mapping_key(self): + return self.expect_block_mapping_key(first=True) + + def expect_block_mapping_key(self, first=False): + if not first and isinstance(self.event, MappingEndEvent): + self.indent = self.indents.pop() + self.state = self.states.pop() + else: + self.write_indent() + if self.check_simple_key(): + self.states.append(self.expect_block_mapping_simple_value) + self.expect_node(mapping=True, simple_key=True) + else: + self.write_indicator('?', True, indention=True) + self.states.append(self.expect_block_mapping_value) + self.expect_node(mapping=True) + + def expect_block_mapping_simple_value(self): + self.write_indicator(':', False) + self.states.append(self.expect_block_mapping_key) + self.expect_node(mapping=True) + + def expect_block_mapping_value(self): + self.write_indent() + self.write_indicator(':', True, indention=True) + self.states.append(self.expect_block_mapping_key) + self.expect_node(mapping=True) + + # Checkers. + + def check_empty_sequence(self): + return (isinstance(self.event, SequenceStartEvent) and self.events + and isinstance(self.events[0], SequenceEndEvent)) + + def check_empty_mapping(self): + return (isinstance(self.event, MappingStartEvent) and self.events + and isinstance(self.events[0], MappingEndEvent)) + + def check_empty_document(self): + if not isinstance(self.event, DocumentStartEvent) or not self.events: + return False + event = self.events[0] + return (isinstance(event, ScalarEvent) and event.anchor is None + and event.tag is None and event.implicit and event.value == '') + + def check_simple_key(self): + length = 0 + if isinstance(self.event, NodeEvent) and self.event.anchor is not None: + if self.prepared_anchor is None: + self.prepared_anchor = self.prepare_anchor(self.event.anchor) + length += len(self.prepared_anchor) + if isinstance(self.event, (ScalarEvent, CollectionStartEvent)) \ + and self.event.tag is not None: + if self.prepared_tag is None: + self.prepared_tag = self.prepare_tag(self.event.tag) + length += len(self.prepared_tag) + if isinstance(self.event, ScalarEvent): + if self.analysis is None: + self.analysis = self.analyze_scalar(self.event.value) + length += len(self.analysis.scalar) + return (length < 128 and (isinstance(self.event, AliasEvent) + or (isinstance(self.event, ScalarEvent) + and not self.analysis.empty and not self.analysis.multiline) + or self.check_empty_sequence() or self.check_empty_mapping())) + + # Anchor, Tag, and Scalar processors. + + def process_anchor(self, indicator): + if self.event.anchor is None: + self.prepared_anchor = None + return + if self.prepared_anchor is None: + self.prepared_anchor = self.prepare_anchor(self.event.anchor) + if self.prepared_anchor: + self.write_indicator(indicator+self.prepared_anchor, True) + self.prepared_anchor = None + + def process_tag(self): + tag = self.event.tag + if isinstance(self.event, ScalarEvent): + if self.style is None: + self.style = self.choose_scalar_style() + if ((not self.canonical or tag is None) and + ((self.style == '' and self.event.implicit[0]) + or (self.style != '' and self.event.implicit[1]))): + self.prepared_tag = None + return + if self.event.implicit[0] and tag is None: + tag = '!' + self.prepared_tag = None + else: + if (not self.canonical or tag is None) and self.event.implicit: + self.prepared_tag = None + return + if tag is None: + raise EmitterError("tag is not specified") + if self.prepared_tag is None: + self.prepared_tag = self.prepare_tag(tag) + if self.prepared_tag: + self.write_indicator(self.prepared_tag, True) + self.prepared_tag = None + + def choose_scalar_style(self): + if self.analysis is None: + self.analysis = self.analyze_scalar(self.event.value) + if self.event.style == '"' or self.canonical: + return '"' + if not self.event.style and self.event.implicit[0]: + if (not (self.simple_key_context and + (self.analysis.empty or self.analysis.multiline)) + and (self.flow_level and self.analysis.allow_flow_plain + or (not self.flow_level and self.analysis.allow_block_plain))): + return '' + if self.event.style and self.event.style in '|>': + if (not self.flow_level and not self.simple_key_context + and self.analysis.allow_block): + return self.event.style + if not self.event.style or self.event.style == '\'': + if (self.analysis.allow_single_quoted and + not (self.simple_key_context and self.analysis.multiline)): + return '\'' + return '"' + + def process_scalar(self): + if self.analysis is None: + self.analysis = self.analyze_scalar(self.event.value) + if self.style is None: + self.style = self.choose_scalar_style() + split = (not self.simple_key_context) + #if self.analysis.multiline and split \ + # and (not self.style or self.style in '\'\"'): + # self.write_indent() + if self.style == '"': + self.write_double_quoted(self.analysis.scalar, split) + elif self.style == '\'': + self.write_single_quoted(self.analysis.scalar, split) + elif self.style == '>': + self.write_folded(self.analysis.scalar) + elif self.style == '|': + self.write_literal(self.analysis.scalar) + else: + self.write_plain(self.analysis.scalar, split) + self.analysis = None + self.style = None + + # Analyzers. + + def prepare_version(self, version): + major, minor = version + if major != 1: + raise EmitterError("unsupported YAML version: %d.%d" % (major, minor)) + return '%d.%d' % (major, minor) + + def prepare_tag_handle(self, handle): + if not handle: + raise EmitterError("tag handle must not be empty") + if handle[0] != '!' or handle[-1] != '!': + raise EmitterError("tag handle must start and end with '!': %r" % handle) + for ch in handle[1:-1]: + if not ('0' <= ch <= '9' or 'A' <= ch <= 'Z' or 'a' <= ch <= 'z' \ + or ch in '-_'): + raise EmitterError("invalid character %r in the tag handle: %r" + % (ch, handle)) + return handle + + def prepare_tag_prefix(self, prefix): + if not prefix: + raise EmitterError("tag prefix must not be empty") + chunks = [] + start = end = 0 + if prefix[0] == '!': + end = 1 + while end < len(prefix): + ch = prefix[end] + if '0' <= ch <= '9' or 'A' <= ch <= 'Z' or 'a' <= ch <= 'z' \ + or ch in '-;/?!:@&=+$,_.~*\'()[]': + end += 1 + else: + if start < end: + chunks.append(prefix[start:end]) + start = end = end+1 + data = ch.encode('utf-8') + for ch in data: + chunks.append('%%%02X' % ord(ch)) + if start < end: + chunks.append(prefix[start:end]) + return ''.join(chunks) + + def prepare_tag(self, tag): + if not tag: + raise EmitterError("tag must not be empty") + if tag == '!': + return tag + handle = None + suffix = tag + prefixes = sorted(self.tag_prefixes.keys()) + for prefix in prefixes: + if tag.startswith(prefix) \ + and (prefix == '!' or len(prefix) < len(tag)): + handle = self.tag_prefixes[prefix] + suffix = tag[len(prefix):] + chunks = [] + start = end = 0 + while end < len(suffix): + ch = suffix[end] + if '0' <= ch <= '9' or 'A' <= ch <= 'Z' or 'a' <= ch <= 'z' \ + or ch in '-;/?:@&=+$,_.~*\'()[]' \ + or (ch == '!' and handle != '!'): + end += 1 + else: + if start < end: + chunks.append(suffix[start:end]) + start = end = end+1 + data = ch.encode('utf-8') + for ch in data: + chunks.append('%%%02X' % ch) + if start < end: + chunks.append(suffix[start:end]) + suffix_text = ''.join(chunks) + if handle: + return '%s%s' % (handle, suffix_text) + else: + return '!<%s>' % suffix_text + + def prepare_anchor(self, anchor): + if not anchor: + raise EmitterError("anchor must not be empty") + for ch in anchor: + if not ('0' <= ch <= '9' or 'A' <= ch <= 'Z' or 'a' <= ch <= 'z' \ + or ch in '-_'): + raise EmitterError("invalid character %r in the anchor: %r" + % (ch, anchor)) + return anchor + + def analyze_scalar(self, scalar): + + # Empty scalar is a special case. + if not scalar: + return ScalarAnalysis(scalar=scalar, empty=True, multiline=False, + allow_flow_plain=False, allow_block_plain=True, + allow_single_quoted=True, allow_double_quoted=True, + allow_block=False) + + # Indicators and special characters. + block_indicators = False + flow_indicators = False + line_breaks = False + special_characters = False + + # Important whitespace combinations. + leading_space = False + leading_break = False + trailing_space = False + trailing_break = False + break_space = False + space_break = False + + # Check document indicators. + if scalar.startswith('---') or scalar.startswith('...'): + block_indicators = True + flow_indicators = True + + # First character or preceded by a whitespace. + preceded_by_whitespace = True + + # Last character or followed by a whitespace. + followed_by_whitespace = (len(scalar) == 1 or + scalar[1] in '\0 \t\r\n\x85\u2028\u2029') + + # The previous character is a space. + previous_space = False + + # The previous character is a break. + previous_break = False + + index = 0 + while index < len(scalar): + ch = scalar[index] + + # Check for indicators. + if index == 0: + # Leading indicators are special characters. + if ch in '#,[]{}&*!|>\'\"%@`': + flow_indicators = True + block_indicators = True + if ch in '?:': + flow_indicators = True + if followed_by_whitespace: + block_indicators = True + if ch == '-' and followed_by_whitespace: + flow_indicators = True + block_indicators = True + else: + # Some indicators cannot appear within a scalar as well. + if ch in ',?[]{}': + flow_indicators = True + if ch == ':': + flow_indicators = True + if followed_by_whitespace: + block_indicators = True + if ch == '#' and preceded_by_whitespace: + flow_indicators = True + block_indicators = True + + # Check for line breaks, special, and unicode characters. + if ch in '\n\x85\u2028\u2029': + line_breaks = True + if not (ch == '\n' or '\x20' <= ch <= '\x7E'): + if (ch == '\x85' or '\xA0' <= ch <= '\uD7FF' + or '\uE000' <= ch <= '\uFFFD' + or '\U00010000' <= ch < '\U0010ffff') and ch != '\uFEFF': + unicode_characters = True + if not self.allow_unicode: + special_characters = True + else: + special_characters = True + + # Detect important whitespace combinations. + if ch == ' ': + if index == 0: + leading_space = True + if index == len(scalar)-1: + trailing_space = True + if previous_break: + break_space = True + previous_space = True + previous_break = False + elif ch in '\n\x85\u2028\u2029': + if index == 0: + leading_break = True + if index == len(scalar)-1: + trailing_break = True + if previous_space: + space_break = True + previous_space = False + previous_break = True + else: + previous_space = False + previous_break = False + + # Prepare for the next character. + index += 1 + preceded_by_whitespace = (ch in '\0 \t\r\n\x85\u2028\u2029') + followed_by_whitespace = (index+1 >= len(scalar) or + scalar[index+1] in '\0 \t\r\n\x85\u2028\u2029') + + # Let's decide what styles are allowed. + allow_flow_plain = True + allow_block_plain = True + allow_single_quoted = True + allow_double_quoted = True + allow_block = True + + # Leading and trailing whitespaces are bad for plain scalars. + if (leading_space or leading_break + or trailing_space or trailing_break): + allow_flow_plain = allow_block_plain = False + + # We do not permit trailing spaces for block scalars. + if trailing_space: + allow_block = False + + # Spaces at the beginning of a new line are only acceptable for block + # scalars. + if break_space: + allow_flow_plain = allow_block_plain = allow_single_quoted = False + + # Spaces followed by breaks, as well as special character are only + # allowed for double quoted scalars. + if space_break or special_characters: + allow_flow_plain = allow_block_plain = \ + allow_single_quoted = allow_block = False + + # Although the plain scalar writer supports breaks, we never emit + # multiline plain scalars. + if line_breaks: + allow_flow_plain = allow_block_plain = False + + # Flow indicators are forbidden for flow plain scalars. + if flow_indicators: + allow_flow_plain = False + + # Block indicators are forbidden for block plain scalars. + if block_indicators: + allow_block_plain = False + + return ScalarAnalysis(scalar=scalar, + empty=False, multiline=line_breaks, + allow_flow_plain=allow_flow_plain, + allow_block_plain=allow_block_plain, + allow_single_quoted=allow_single_quoted, + allow_double_quoted=allow_double_quoted, + allow_block=allow_block) + + # Writers. + + def flush_stream(self): + if hasattr(self.stream, 'flush'): + self.stream.flush() + + def write_stream_start(self): + # Write BOM if needed. + if self.encoding and self.encoding.startswith('utf-16'): + self.stream.write('\uFEFF'.encode(self.encoding)) + + def write_stream_end(self): + self.flush_stream() + + def write_indicator(self, indicator, need_whitespace, + whitespace=False, indention=False): + if self.whitespace or not need_whitespace: + data = indicator + else: + data = ' '+indicator + self.whitespace = whitespace + self.indention = self.indention and indention + self.column += len(data) + self.open_ended = False + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + + def write_indent(self): + indent = self.indent or 0 + if not self.indention or self.column > indent \ + or (self.column == indent and not self.whitespace): + self.write_line_break() + if self.column < indent: + self.whitespace = True + data = ' '*(indent-self.column) + self.column = indent + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + + def write_line_break(self, data=None): + if data is None: + data = self.best_line_break + self.whitespace = True + self.indention = True + self.line += 1 + self.column = 0 + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + + def write_version_directive(self, version_text): + data = '%%YAML %s' % version_text + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + self.write_line_break() + + def write_tag_directive(self, handle_text, prefix_text): + data = '%%TAG %s %s' % (handle_text, prefix_text) + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + self.write_line_break() + + # Scalar streams. + + def write_single_quoted(self, text, split=True): + self.write_indicator('\'', True) + spaces = False + breaks = False + start = end = 0 + while end <= len(text): + ch = None + if end < len(text): + ch = text[end] + if spaces: + if ch is None or ch != ' ': + if start+1 == end and self.column > self.best_width and split \ + and start != 0 and end != len(text): + self.write_indent() + else: + data = text[start:end] + self.column += len(data) + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + start = end + elif breaks: + if ch is None or ch not in '\n\x85\u2028\u2029': + if text[start] == '\n': + self.write_line_break() + for br in text[start:end]: + if br == '\n': + self.write_line_break() + else: + self.write_line_break(br) + self.write_indent() + start = end + else: + if ch is None or ch in ' \n\x85\u2028\u2029' or ch == '\'': + if start < end: + data = text[start:end] + self.column += len(data) + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + start = end + if ch == '\'': + data = '\'\'' + self.column += 2 + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + start = end + 1 + if ch is not None: + spaces = (ch == ' ') + breaks = (ch in '\n\x85\u2028\u2029') + end += 1 + self.write_indicator('\'', False) + + ESCAPE_REPLACEMENTS = { + '\0': '0', + '\x07': 'a', + '\x08': 'b', + '\x09': 't', + '\x0A': 'n', + '\x0B': 'v', + '\x0C': 'f', + '\x0D': 'r', + '\x1B': 'e', + '\"': '\"', + '\\': '\\', + '\x85': 'N', + '\xA0': '_', + '\u2028': 'L', + '\u2029': 'P', + } + + def write_double_quoted(self, text, split=True): + self.write_indicator('"', True) + start = end = 0 + while end <= len(text): + ch = None + if end < len(text): + ch = text[end] + if ch is None or ch in '"\\\x85\u2028\u2029\uFEFF' \ + or not ('\x20' <= ch <= '\x7E' + or (self.allow_unicode + and ('\xA0' <= ch <= '\uD7FF' + or '\uE000' <= ch <= '\uFFFD'))): + if start < end: + data = text[start:end] + self.column += len(data) + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + start = end + if ch is not None: + if ch in self.ESCAPE_REPLACEMENTS: + data = '\\'+self.ESCAPE_REPLACEMENTS[ch] + elif ch <= '\xFF': + data = '\\x%02X' % ord(ch) + elif ch <= '\uFFFF': + data = '\\u%04X' % ord(ch) + else: + data = '\\U%08X' % ord(ch) + self.column += len(data) + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + start = end+1 + if 0 < end < len(text)-1 and (ch == ' ' or start >= end) \ + and self.column+(end-start) > self.best_width and split: + data = text[start:end]+'\\' + if start < end: + start = end + self.column += len(data) + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + self.write_indent() + self.whitespace = False + self.indention = False + if text[start] == ' ': + data = '\\' + self.column += len(data) + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + end += 1 + self.write_indicator('"', False) + + def determine_block_hints(self, text): + hints = '' + if text: + if text[0] in ' \n\x85\u2028\u2029': + hints += str(self.best_indent) + if text[-1] not in '\n\x85\u2028\u2029': + hints += '-' + elif len(text) == 1 or text[-2] in '\n\x85\u2028\u2029': + hints += '+' + return hints + + def write_folded(self, text): + hints = self.determine_block_hints(text) + self.write_indicator('>'+hints, True) + if hints[-1:] == '+': + self.open_ended = True + self.write_line_break() + leading_space = True + spaces = False + breaks = True + start = end = 0 + while end <= len(text): + ch = None + if end < len(text): + ch = text[end] + if breaks: + if ch is None or ch not in '\n\x85\u2028\u2029': + if not leading_space and ch is not None and ch != ' ' \ + and text[start] == '\n': + self.write_line_break() + leading_space = (ch == ' ') + for br in text[start:end]: + if br == '\n': + self.write_line_break() + else: + self.write_line_break(br) + if ch is not None: + self.write_indent() + start = end + elif spaces: + if ch != ' ': + if start+1 == end and self.column > self.best_width: + self.write_indent() + else: + data = text[start:end] + self.column += len(data) + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + start = end + else: + if ch is None or ch in ' \n\x85\u2028\u2029': + data = text[start:end] + self.column += len(data) + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + if ch is None: + self.write_line_break() + start = end + if ch is not None: + breaks = (ch in '\n\x85\u2028\u2029') + spaces = (ch == ' ') + end += 1 + + def write_literal(self, text): + hints = self.determine_block_hints(text) + self.write_indicator('|'+hints, True) + if hints[-1:] == '+': + self.open_ended = True + self.write_line_break() + breaks = True + start = end = 0 + while end <= len(text): + ch = None + if end < len(text): + ch = text[end] + if breaks: + if ch is None or ch not in '\n\x85\u2028\u2029': + for br in text[start:end]: + if br == '\n': + self.write_line_break() + else: + self.write_line_break(br) + if ch is not None: + self.write_indent() + start = end + else: + if ch is None or ch in '\n\x85\u2028\u2029': + data = text[start:end] + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + if ch is None: + self.write_line_break() + start = end + if ch is not None: + breaks = (ch in '\n\x85\u2028\u2029') + end += 1 + + def write_plain(self, text, split=True): + if self.root_context: + self.open_ended = True + if not text: + return + if not self.whitespace: + data = ' ' + self.column += len(data) + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + self.whitespace = False + self.indention = False + spaces = False + breaks = False + start = end = 0 + while end <= len(text): + ch = None + if end < len(text): + ch = text[end] + if spaces: + if ch != ' ': + if start+1 == end and self.column > self.best_width and split: + self.write_indent() + self.whitespace = False + self.indention = False + else: + data = text[start:end] + self.column += len(data) + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + start = end + elif breaks: + if ch not in '\n\x85\u2028\u2029': + if text[start] == '\n': + self.write_line_break() + for br in text[start:end]: + if br == '\n': + self.write_line_break() + else: + self.write_line_break(br) + self.write_indent() + self.whitespace = False + self.indention = False + start = end + else: + if ch is None or ch in ' \n\x85\u2028\u2029': + data = text[start:end] + self.column += len(data) + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + start = end + if ch is not None: + spaces = (ch == ' ') + breaks = (ch in '\n\x85\u2028\u2029') + end += 1 diff --git a/.local/lib/python3.10/site-packages/yaml/error.py b/.local/lib/python3.10/site-packages/yaml/error.py new file mode 100644 index 0000000000000000000000000000000000000000..b796b4dc519512c4825ff539a2e6aa20f4d370d0 --- /dev/null +++ b/.local/lib/python3.10/site-packages/yaml/error.py @@ -0,0 +1,75 @@ + +__all__ = ['Mark', 'YAMLError', 'MarkedYAMLError'] + +class Mark: + + def __init__(self, name, index, line, column, buffer, pointer): + self.name = name + self.index = index + self.line = line + self.column = column + self.buffer = buffer + self.pointer = pointer + + def get_snippet(self, indent=4, max_length=75): + if self.buffer is None: + return None + head = '' + start = self.pointer + while start > 0 and self.buffer[start-1] not in '\0\r\n\x85\u2028\u2029': + start -= 1 + if self.pointer-start > max_length/2-1: + head = ' ... ' + start += 5 + break + tail = '' + end = self.pointer + while end < len(self.buffer) and self.buffer[end] not in '\0\r\n\x85\u2028\u2029': + end += 1 + if end-self.pointer > max_length/2-1: + tail = ' ... ' + end -= 5 + break + snippet = self.buffer[start:end] + return ' '*indent + head + snippet + tail + '\n' \ + + ' '*(indent+self.pointer-start+len(head)) + '^' + + def __str__(self): + snippet = self.get_snippet() + where = " in \"%s\", line %d, column %d" \ + % (self.name, self.line+1, self.column+1) + if snippet is not None: + where += ":\n"+snippet + return where + +class YAMLError(Exception): + pass + +class MarkedYAMLError(YAMLError): + + def __init__(self, context=None, context_mark=None, + problem=None, problem_mark=None, note=None): + self.context = context + self.context_mark = context_mark + self.problem = problem + self.problem_mark = problem_mark + self.note = note + + def __str__(self): + lines = [] + if self.context is not None: + lines.append(self.context) + if self.context_mark is not None \ + and (self.problem is None or self.problem_mark is None + or self.context_mark.name != self.problem_mark.name + or self.context_mark.line != self.problem_mark.line + or self.context_mark.column != self.problem_mark.column): + lines.append(str(self.context_mark)) + if self.problem is not None: + lines.append(self.problem) + if self.problem_mark is not None: + lines.append(str(self.problem_mark)) + if self.note is not None: + lines.append(self.note) + return '\n'.join(lines) + diff --git a/.local/lib/python3.10/site-packages/yaml/events.py b/.local/lib/python3.10/site-packages/yaml/events.py new file mode 100644 index 0000000000000000000000000000000000000000..f79ad389cb6c9517e391dcd25534866bc9ccd36a --- /dev/null +++ b/.local/lib/python3.10/site-packages/yaml/events.py @@ -0,0 +1,86 @@ + +# Abstract classes. + +class Event(object): + def __init__(self, start_mark=None, end_mark=None): + self.start_mark = start_mark + self.end_mark = end_mark + def __repr__(self): + attributes = [key for key in ['anchor', 'tag', 'implicit', 'value'] + if hasattr(self, key)] + arguments = ', '.join(['%s=%r' % (key, getattr(self, key)) + for key in attributes]) + return '%s(%s)' % (self.__class__.__name__, arguments) + +class NodeEvent(Event): + def __init__(self, anchor, start_mark=None, end_mark=None): + self.anchor = anchor + self.start_mark = start_mark + self.end_mark = end_mark + +class CollectionStartEvent(NodeEvent): + def __init__(self, anchor, tag, implicit, start_mark=None, end_mark=None, + flow_style=None): + self.anchor = anchor + self.tag = tag + self.implicit = implicit + self.start_mark = start_mark + self.end_mark = end_mark + self.flow_style = flow_style + +class CollectionEndEvent(Event): + pass + +# Implementations. + +class StreamStartEvent(Event): + def __init__(self, start_mark=None, end_mark=None, encoding=None): + self.start_mark = start_mark + self.end_mark = end_mark + self.encoding = encoding + +class StreamEndEvent(Event): + pass + +class DocumentStartEvent(Event): + def __init__(self, start_mark=None, end_mark=None, + explicit=None, version=None, tags=None): + self.start_mark = start_mark + self.end_mark = end_mark + self.explicit = explicit + self.version = version + self.tags = tags + +class DocumentEndEvent(Event): + def __init__(self, start_mark=None, end_mark=None, + explicit=None): + self.start_mark = start_mark + self.end_mark = end_mark + self.explicit = explicit + +class AliasEvent(NodeEvent): + pass + +class ScalarEvent(NodeEvent): + def __init__(self, anchor, tag, implicit, value, + start_mark=None, end_mark=None, style=None): + self.anchor = anchor + self.tag = tag + self.implicit = implicit + self.value = value + self.start_mark = start_mark + self.end_mark = end_mark + self.style = style + +class SequenceStartEvent(CollectionStartEvent): + pass + +class SequenceEndEvent(CollectionEndEvent): + pass + +class MappingStartEvent(CollectionStartEvent): + pass + +class MappingEndEvent(CollectionEndEvent): + pass + diff --git a/.local/lib/python3.10/site-packages/yaml/loader.py b/.local/lib/python3.10/site-packages/yaml/loader.py new file mode 100644 index 0000000000000000000000000000000000000000..e90c11224c38e559cdf0cb205f0692ebd4fb8681 --- /dev/null +++ b/.local/lib/python3.10/site-packages/yaml/loader.py @@ -0,0 +1,63 @@ + +__all__ = ['BaseLoader', 'FullLoader', 'SafeLoader', 'Loader', 'UnsafeLoader'] + +from .reader import * +from .scanner import * +from .parser import * +from .composer import * +from .constructor import * +from .resolver import * + +class BaseLoader(Reader, Scanner, Parser, Composer, BaseConstructor, BaseResolver): + + def __init__(self, stream): + Reader.__init__(self, stream) + Scanner.__init__(self) + Parser.__init__(self) + Composer.__init__(self) + BaseConstructor.__init__(self) + BaseResolver.__init__(self) + +class FullLoader(Reader, Scanner, Parser, Composer, FullConstructor, Resolver): + + def __init__(self, stream): + Reader.__init__(self, stream) + Scanner.__init__(self) + Parser.__init__(self) + Composer.__init__(self) + FullConstructor.__init__(self) + Resolver.__init__(self) + +class SafeLoader(Reader, Scanner, Parser, Composer, SafeConstructor, Resolver): + + def __init__(self, stream): + Reader.__init__(self, stream) + Scanner.__init__(self) + Parser.__init__(self) + Composer.__init__(self) + SafeConstructor.__init__(self) + Resolver.__init__(self) + +class Loader(Reader, Scanner, Parser, Composer, Constructor, Resolver): + + def __init__(self, stream): + Reader.__init__(self, stream) + Scanner.__init__(self) + Parser.__init__(self) + Composer.__init__(self) + Constructor.__init__(self) + Resolver.__init__(self) + +# UnsafeLoader is the same as Loader (which is and was always unsafe on +# untrusted input). Use of either Loader or UnsafeLoader should be rare, since +# FullLoad should be able to load almost all YAML safely. Loader is left intact +# to ensure backwards compatibility. +class UnsafeLoader(Reader, Scanner, Parser, Composer, Constructor, Resolver): + + def __init__(self, stream): + Reader.__init__(self, stream) + Scanner.__init__(self) + Parser.__init__(self) + Composer.__init__(self) + Constructor.__init__(self) + Resolver.__init__(self) diff --git a/.local/lib/python3.10/site-packages/yaml/nodes.py b/.local/lib/python3.10/site-packages/yaml/nodes.py new file mode 100644 index 0000000000000000000000000000000000000000..c4f070c41e1fb1bc01af27d69329e92dded38908 --- /dev/null +++ b/.local/lib/python3.10/site-packages/yaml/nodes.py @@ -0,0 +1,49 @@ + +class Node(object): + def __init__(self, tag, value, start_mark, end_mark): + self.tag = tag + self.value = value + self.start_mark = start_mark + self.end_mark = end_mark + def __repr__(self): + value = self.value + #if isinstance(value, list): + # if len(value) == 0: + # value = '' + # elif len(value) == 1: + # value = '<1 item>' + # else: + # value = '<%d items>' % len(value) + #else: + # if len(value) > 75: + # value = repr(value[:70]+u' ... ') + # else: + # value = repr(value) + value = repr(value) + return '%s(tag=%r, value=%s)' % (self.__class__.__name__, self.tag, value) + +class ScalarNode(Node): + id = 'scalar' + def __init__(self, tag, value, + start_mark=None, end_mark=None, style=None): + self.tag = tag + self.value = value + self.start_mark = start_mark + self.end_mark = end_mark + self.style = style + +class CollectionNode(Node): + def __init__(self, tag, value, + start_mark=None, end_mark=None, flow_style=None): + self.tag = tag + self.value = value + self.start_mark = start_mark + self.end_mark = end_mark + self.flow_style = flow_style + +class SequenceNode(CollectionNode): + id = 'sequence' + +class MappingNode(CollectionNode): + id = 'mapping' + diff --git a/.local/lib/python3.10/site-packages/yaml/parser.py b/.local/lib/python3.10/site-packages/yaml/parser.py new file mode 100644 index 0000000000000000000000000000000000000000..13a5995d292045d0f865a99abf692bd35dc87814 --- /dev/null +++ b/.local/lib/python3.10/site-packages/yaml/parser.py @@ -0,0 +1,589 @@ + +# The following YAML grammar is LL(1) and is parsed by a recursive descent +# parser. +# +# stream ::= STREAM-START implicit_document? explicit_document* STREAM-END +# implicit_document ::= block_node DOCUMENT-END* +# explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* +# block_node_or_indentless_sequence ::= +# ALIAS +# | properties (block_content | indentless_block_sequence)? +# | block_content +# | indentless_block_sequence +# block_node ::= ALIAS +# | properties block_content? +# | block_content +# flow_node ::= ALIAS +# | properties flow_content? +# | flow_content +# properties ::= TAG ANCHOR? | ANCHOR TAG? +# block_content ::= block_collection | flow_collection | SCALAR +# flow_content ::= flow_collection | SCALAR +# block_collection ::= block_sequence | block_mapping +# flow_collection ::= flow_sequence | flow_mapping +# block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END +# indentless_sequence ::= (BLOCK-ENTRY block_node?)+ +# block_mapping ::= BLOCK-MAPPING_START +# ((KEY block_node_or_indentless_sequence?)? +# (VALUE block_node_or_indentless_sequence?)?)* +# BLOCK-END +# flow_sequence ::= FLOW-SEQUENCE-START +# (flow_sequence_entry FLOW-ENTRY)* +# flow_sequence_entry? +# FLOW-SEQUENCE-END +# flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +# flow_mapping ::= FLOW-MAPPING-START +# (flow_mapping_entry FLOW-ENTRY)* +# flow_mapping_entry? +# FLOW-MAPPING-END +# flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +# +# FIRST sets: +# +# stream: { STREAM-START } +# explicit_document: { DIRECTIVE DOCUMENT-START } +# implicit_document: FIRST(block_node) +# block_node: { ALIAS TAG ANCHOR SCALAR BLOCK-SEQUENCE-START BLOCK-MAPPING-START FLOW-SEQUENCE-START FLOW-MAPPING-START } +# flow_node: { ALIAS ANCHOR TAG SCALAR FLOW-SEQUENCE-START FLOW-MAPPING-START } +# block_content: { BLOCK-SEQUENCE-START BLOCK-MAPPING-START FLOW-SEQUENCE-START FLOW-MAPPING-START SCALAR } +# flow_content: { FLOW-SEQUENCE-START FLOW-MAPPING-START SCALAR } +# block_collection: { BLOCK-SEQUENCE-START BLOCK-MAPPING-START } +# flow_collection: { FLOW-SEQUENCE-START FLOW-MAPPING-START } +# block_sequence: { BLOCK-SEQUENCE-START } +# block_mapping: { BLOCK-MAPPING-START } +# block_node_or_indentless_sequence: { ALIAS ANCHOR TAG SCALAR BLOCK-SEQUENCE-START BLOCK-MAPPING-START FLOW-SEQUENCE-START FLOW-MAPPING-START BLOCK-ENTRY } +# indentless_sequence: { ENTRY } +# flow_collection: { FLOW-SEQUENCE-START FLOW-MAPPING-START } +# flow_sequence: { FLOW-SEQUENCE-START } +# flow_mapping: { FLOW-MAPPING-START } +# flow_sequence_entry: { ALIAS ANCHOR TAG SCALAR FLOW-SEQUENCE-START FLOW-MAPPING-START KEY } +# flow_mapping_entry: { ALIAS ANCHOR TAG SCALAR FLOW-SEQUENCE-START FLOW-MAPPING-START KEY } + +__all__ = ['Parser', 'ParserError'] + +from .error import MarkedYAMLError +from .tokens import * +from .events import * +from .scanner import * + +class ParserError(MarkedYAMLError): + pass + +class Parser: + # Since writing a recursive-descendant parser is a straightforward task, we + # do not give many comments here. + + DEFAULT_TAGS = { + '!': '!', + '!!': 'tag:yaml.org,2002:', + } + + def __init__(self): + self.current_event = None + self.yaml_version = None + self.tag_handles = {} + self.states = [] + self.marks = [] + self.state = self.parse_stream_start + + def dispose(self): + # Reset the state attributes (to clear self-references) + self.states = [] + self.state = None + + def check_event(self, *choices): + # Check the type of the next event. + if self.current_event is None: + if self.state: + self.current_event = self.state() + if self.current_event is not None: + if not choices: + return True + for choice in choices: + if isinstance(self.current_event, choice): + return True + return False + + def peek_event(self): + # Get the next event. + if self.current_event is None: + if self.state: + self.current_event = self.state() + return self.current_event + + def get_event(self): + # Get the next event and proceed further. + if self.current_event is None: + if self.state: + self.current_event = self.state() + value = self.current_event + self.current_event = None + return value + + # stream ::= STREAM-START implicit_document? explicit_document* STREAM-END + # implicit_document ::= block_node DOCUMENT-END* + # explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* + + def parse_stream_start(self): + + # Parse the stream start. + token = self.get_token() + event = StreamStartEvent(token.start_mark, token.end_mark, + encoding=token.encoding) + + # Prepare the next state. + self.state = self.parse_implicit_document_start + + return event + + def parse_implicit_document_start(self): + + # Parse an implicit document. + if not self.check_token(DirectiveToken, DocumentStartToken, + StreamEndToken): + self.tag_handles = self.DEFAULT_TAGS + token = self.peek_token() + start_mark = end_mark = token.start_mark + event = DocumentStartEvent(start_mark, end_mark, + explicit=False) + + # Prepare the next state. + self.states.append(self.parse_document_end) + self.state = self.parse_block_node + + return event + + else: + return self.parse_document_start() + + def parse_document_start(self): + + # Parse any extra document end indicators. + while self.check_token(DocumentEndToken): + self.get_token() + + # Parse an explicit document. + if not self.check_token(StreamEndToken): + token = self.peek_token() + start_mark = token.start_mark + version, tags = self.process_directives() + if not self.check_token(DocumentStartToken): + raise ParserError(None, None, + "expected '', but found %r" + % self.peek_token().id, + self.peek_token().start_mark) + token = self.get_token() + end_mark = token.end_mark + event = DocumentStartEvent(start_mark, end_mark, + explicit=True, version=version, tags=tags) + self.states.append(self.parse_document_end) + self.state = self.parse_document_content + else: + # Parse the end of the stream. + token = self.get_token() + event = StreamEndEvent(token.start_mark, token.end_mark) + assert not self.states + assert not self.marks + self.state = None + return event + + def parse_document_end(self): + + # Parse the document end. + token = self.peek_token() + start_mark = end_mark = token.start_mark + explicit = False + if self.check_token(DocumentEndToken): + token = self.get_token() + end_mark = token.end_mark + explicit = True + event = DocumentEndEvent(start_mark, end_mark, + explicit=explicit) + + # Prepare the next state. + self.state = self.parse_document_start + + return event + + def parse_document_content(self): + if self.check_token(DirectiveToken, + DocumentStartToken, DocumentEndToken, StreamEndToken): + event = self.process_empty_scalar(self.peek_token().start_mark) + self.state = self.states.pop() + return event + else: + return self.parse_block_node() + + def process_directives(self): + self.yaml_version = None + self.tag_handles = {} + while self.check_token(DirectiveToken): + token = self.get_token() + if token.name == 'YAML': + if self.yaml_version is not None: + raise ParserError(None, None, + "found duplicate YAML directive", token.start_mark) + major, minor = token.value + if major != 1: + raise ParserError(None, None, + "found incompatible YAML document (version 1.* is required)", + token.start_mark) + self.yaml_version = token.value + elif token.name == 'TAG': + handle, prefix = token.value + if handle in self.tag_handles: + raise ParserError(None, None, + "duplicate tag handle %r" % handle, + token.start_mark) + self.tag_handles[handle] = prefix + if self.tag_handles: + value = self.yaml_version, self.tag_handles.copy() + else: + value = self.yaml_version, None + for key in self.DEFAULT_TAGS: + if key not in self.tag_handles: + self.tag_handles[key] = self.DEFAULT_TAGS[key] + return value + + # block_node_or_indentless_sequence ::= ALIAS + # | properties (block_content | indentless_block_sequence)? + # | block_content + # | indentless_block_sequence + # block_node ::= ALIAS + # | properties block_content? + # | block_content + # flow_node ::= ALIAS + # | properties flow_content? + # | flow_content + # properties ::= TAG ANCHOR? | ANCHOR TAG? + # block_content ::= block_collection | flow_collection | SCALAR + # flow_content ::= flow_collection | SCALAR + # block_collection ::= block_sequence | block_mapping + # flow_collection ::= flow_sequence | flow_mapping + + def parse_block_node(self): + return self.parse_node(block=True) + + def parse_flow_node(self): + return self.parse_node() + + def parse_block_node_or_indentless_sequence(self): + return self.parse_node(block=True, indentless_sequence=True) + + def parse_node(self, block=False, indentless_sequence=False): + if self.check_token(AliasToken): + token = self.get_token() + event = AliasEvent(token.value, token.start_mark, token.end_mark) + self.state = self.states.pop() + else: + anchor = None + tag = None + start_mark = end_mark = tag_mark = None + if self.check_token(AnchorToken): + token = self.get_token() + start_mark = token.start_mark + end_mark = token.end_mark + anchor = token.value + if self.check_token(TagToken): + token = self.get_token() + tag_mark = token.start_mark + end_mark = token.end_mark + tag = token.value + elif self.check_token(TagToken): + token = self.get_token() + start_mark = tag_mark = token.start_mark + end_mark = token.end_mark + tag = token.value + if self.check_token(AnchorToken): + token = self.get_token() + end_mark = token.end_mark + anchor = token.value + if tag is not None: + handle, suffix = tag + if handle is not None: + if handle not in self.tag_handles: + raise ParserError("while parsing a node", start_mark, + "found undefined tag handle %r" % handle, + tag_mark) + tag = self.tag_handles[handle]+suffix + else: + tag = suffix + #if tag == '!': + # raise ParserError("while parsing a node", start_mark, + # "found non-specific tag '!'", tag_mark, + # "Please check 'http://pyyaml.org/wiki/YAMLNonSpecificTag' and share your opinion.") + if start_mark is None: + start_mark = end_mark = self.peek_token().start_mark + event = None + implicit = (tag is None or tag == '!') + if indentless_sequence and self.check_token(BlockEntryToken): + end_mark = self.peek_token().end_mark + event = SequenceStartEvent(anchor, tag, implicit, + start_mark, end_mark) + self.state = self.parse_indentless_sequence_entry + else: + if self.check_token(ScalarToken): + token = self.get_token() + end_mark = token.end_mark + if (token.plain and tag is None) or tag == '!': + implicit = (True, False) + elif tag is None: + implicit = (False, True) + else: + implicit = (False, False) + event = ScalarEvent(anchor, tag, implicit, token.value, + start_mark, end_mark, style=token.style) + self.state = self.states.pop() + elif self.check_token(FlowSequenceStartToken): + end_mark = self.peek_token().end_mark + event = SequenceStartEvent(anchor, tag, implicit, + start_mark, end_mark, flow_style=True) + self.state = self.parse_flow_sequence_first_entry + elif self.check_token(FlowMappingStartToken): + end_mark = self.peek_token().end_mark + event = MappingStartEvent(anchor, tag, implicit, + start_mark, end_mark, flow_style=True) + self.state = self.parse_flow_mapping_first_key + elif block and self.check_token(BlockSequenceStartToken): + end_mark = self.peek_token().start_mark + event = SequenceStartEvent(anchor, tag, implicit, + start_mark, end_mark, flow_style=False) + self.state = self.parse_block_sequence_first_entry + elif block and self.check_token(BlockMappingStartToken): + end_mark = self.peek_token().start_mark + event = MappingStartEvent(anchor, tag, implicit, + start_mark, end_mark, flow_style=False) + self.state = self.parse_block_mapping_first_key + elif anchor is not None or tag is not None: + # Empty scalars are allowed even if a tag or an anchor is + # specified. + event = ScalarEvent(anchor, tag, (implicit, False), '', + start_mark, end_mark) + self.state = self.states.pop() + else: + if block: + node = 'block' + else: + node = 'flow' + token = self.peek_token() + raise ParserError("while parsing a %s node" % node, start_mark, + "expected the node content, but found %r" % token.id, + token.start_mark) + return event + + # block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END + + def parse_block_sequence_first_entry(self): + token = self.get_token() + self.marks.append(token.start_mark) + return self.parse_block_sequence_entry() + + def parse_block_sequence_entry(self): + if self.check_token(BlockEntryToken): + token = self.get_token() + if not self.check_token(BlockEntryToken, BlockEndToken): + self.states.append(self.parse_block_sequence_entry) + return self.parse_block_node() + else: + self.state = self.parse_block_sequence_entry + return self.process_empty_scalar(token.end_mark) + if not self.check_token(BlockEndToken): + token = self.peek_token() + raise ParserError("while parsing a block collection", self.marks[-1], + "expected , but found %r" % token.id, token.start_mark) + token = self.get_token() + event = SequenceEndEvent(token.start_mark, token.end_mark) + self.state = self.states.pop() + self.marks.pop() + return event + + # indentless_sequence ::= (BLOCK-ENTRY block_node?)+ + + def parse_indentless_sequence_entry(self): + if self.check_token(BlockEntryToken): + token = self.get_token() + if not self.check_token(BlockEntryToken, + KeyToken, ValueToken, BlockEndToken): + self.states.append(self.parse_indentless_sequence_entry) + return self.parse_block_node() + else: + self.state = self.parse_indentless_sequence_entry + return self.process_empty_scalar(token.end_mark) + token = self.peek_token() + event = SequenceEndEvent(token.start_mark, token.start_mark) + self.state = self.states.pop() + return event + + # block_mapping ::= BLOCK-MAPPING_START + # ((KEY block_node_or_indentless_sequence?)? + # (VALUE block_node_or_indentless_sequence?)?)* + # BLOCK-END + + def parse_block_mapping_first_key(self): + token = self.get_token() + self.marks.append(token.start_mark) + return self.parse_block_mapping_key() + + def parse_block_mapping_key(self): + if self.check_token(KeyToken): + token = self.get_token() + if not self.check_token(KeyToken, ValueToken, BlockEndToken): + self.states.append(self.parse_block_mapping_value) + return self.parse_block_node_or_indentless_sequence() + else: + self.state = self.parse_block_mapping_value + return self.process_empty_scalar(token.end_mark) + if not self.check_token(BlockEndToken): + token = self.peek_token() + raise ParserError("while parsing a block mapping", self.marks[-1], + "expected , but found %r" % token.id, token.start_mark) + token = self.get_token() + event = MappingEndEvent(token.start_mark, token.end_mark) + self.state = self.states.pop() + self.marks.pop() + return event + + def parse_block_mapping_value(self): + if self.check_token(ValueToken): + token = self.get_token() + if not self.check_token(KeyToken, ValueToken, BlockEndToken): + self.states.append(self.parse_block_mapping_key) + return self.parse_block_node_or_indentless_sequence() + else: + self.state = self.parse_block_mapping_key + return self.process_empty_scalar(token.end_mark) + else: + self.state = self.parse_block_mapping_key + token = self.peek_token() + return self.process_empty_scalar(token.start_mark) + + # flow_sequence ::= FLOW-SEQUENCE-START + # (flow_sequence_entry FLOW-ENTRY)* + # flow_sequence_entry? + # FLOW-SEQUENCE-END + # flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? + # + # Note that while production rules for both flow_sequence_entry and + # flow_mapping_entry are equal, their interpretations are different. + # For `flow_sequence_entry`, the part `KEY flow_node? (VALUE flow_node?)?` + # generate an inline mapping (set syntax). + + def parse_flow_sequence_first_entry(self): + token = self.get_token() + self.marks.append(token.start_mark) + return self.parse_flow_sequence_entry(first=True) + + def parse_flow_sequence_entry(self, first=False): + if not self.check_token(FlowSequenceEndToken): + if not first: + if self.check_token(FlowEntryToken): + self.get_token() + else: + token = self.peek_token() + raise ParserError("while parsing a flow sequence", self.marks[-1], + "expected ',' or ']', but got %r" % token.id, token.start_mark) + + if self.check_token(KeyToken): + token = self.peek_token() + event = MappingStartEvent(None, None, True, + token.start_mark, token.end_mark, + flow_style=True) + self.state = self.parse_flow_sequence_entry_mapping_key + return event + elif not self.check_token(FlowSequenceEndToken): + self.states.append(self.parse_flow_sequence_entry) + return self.parse_flow_node() + token = self.get_token() + event = SequenceEndEvent(token.start_mark, token.end_mark) + self.state = self.states.pop() + self.marks.pop() + return event + + def parse_flow_sequence_entry_mapping_key(self): + token = self.get_token() + if not self.check_token(ValueToken, + FlowEntryToken, FlowSequenceEndToken): + self.states.append(self.parse_flow_sequence_entry_mapping_value) + return self.parse_flow_node() + else: + self.state = self.parse_flow_sequence_entry_mapping_value + return self.process_empty_scalar(token.end_mark) + + def parse_flow_sequence_entry_mapping_value(self): + if self.check_token(ValueToken): + token = self.get_token() + if not self.check_token(FlowEntryToken, FlowSequenceEndToken): + self.states.append(self.parse_flow_sequence_entry_mapping_end) + return self.parse_flow_node() + else: + self.state = self.parse_flow_sequence_entry_mapping_end + return self.process_empty_scalar(token.end_mark) + else: + self.state = self.parse_flow_sequence_entry_mapping_end + token = self.peek_token() + return self.process_empty_scalar(token.start_mark) + + def parse_flow_sequence_entry_mapping_end(self): + self.state = self.parse_flow_sequence_entry + token = self.peek_token() + return MappingEndEvent(token.start_mark, token.start_mark) + + # flow_mapping ::= FLOW-MAPPING-START + # (flow_mapping_entry FLOW-ENTRY)* + # flow_mapping_entry? + # FLOW-MAPPING-END + # flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? + + def parse_flow_mapping_first_key(self): + token = self.get_token() + self.marks.append(token.start_mark) + return self.parse_flow_mapping_key(first=True) + + def parse_flow_mapping_key(self, first=False): + if not self.check_token(FlowMappingEndToken): + if not first: + if self.check_token(FlowEntryToken): + self.get_token() + else: + token = self.peek_token() + raise ParserError("while parsing a flow mapping", self.marks[-1], + "expected ',' or '}', but got %r" % token.id, token.start_mark) + if self.check_token(KeyToken): + token = self.get_token() + if not self.check_token(ValueToken, + FlowEntryToken, FlowMappingEndToken): + self.states.append(self.parse_flow_mapping_value) + return self.parse_flow_node() + else: + self.state = self.parse_flow_mapping_value + return self.process_empty_scalar(token.end_mark) + elif not self.check_token(FlowMappingEndToken): + self.states.append(self.parse_flow_mapping_empty_value) + return self.parse_flow_node() + token = self.get_token() + event = MappingEndEvent(token.start_mark, token.end_mark) + self.state = self.states.pop() + self.marks.pop() + return event + + def parse_flow_mapping_value(self): + if self.check_token(ValueToken): + token = self.get_token() + if not self.check_token(FlowEntryToken, FlowMappingEndToken): + self.states.append(self.parse_flow_mapping_key) + return self.parse_flow_node() + else: + self.state = self.parse_flow_mapping_key + return self.process_empty_scalar(token.end_mark) + else: + self.state = self.parse_flow_mapping_key + token = self.peek_token() + return self.process_empty_scalar(token.start_mark) + + def parse_flow_mapping_empty_value(self): + self.state = self.parse_flow_mapping_key + return self.process_empty_scalar(self.peek_token().start_mark) + + def process_empty_scalar(self, mark): + return ScalarEvent(None, None, (True, False), '', mark, mark) + diff --git a/.local/lib/python3.10/site-packages/yaml/reader.py b/.local/lib/python3.10/site-packages/yaml/reader.py new file mode 100644 index 0000000000000000000000000000000000000000..774b0219b5932a0ee1c27e637371de5ba8d9cb16 --- /dev/null +++ b/.local/lib/python3.10/site-packages/yaml/reader.py @@ -0,0 +1,185 @@ +# This module contains abstractions for the input stream. You don't have to +# looks further, there are no pretty code. +# +# We define two classes here. +# +# Mark(source, line, column) +# It's just a record and its only use is producing nice error messages. +# Parser does not use it for any other purposes. +# +# Reader(source, data) +# Reader determines the encoding of `data` and converts it to unicode. +# Reader provides the following methods and attributes: +# reader.peek(length=1) - return the next `length` characters +# reader.forward(length=1) - move the current position to `length` characters. +# reader.index - the number of the current character. +# reader.line, stream.column - the line and the column of the current character. + +__all__ = ['Reader', 'ReaderError'] + +from .error import YAMLError, Mark + +import codecs, re + +class ReaderError(YAMLError): + + def __init__(self, name, position, character, encoding, reason): + self.name = name + self.character = character + self.position = position + self.encoding = encoding + self.reason = reason + + def __str__(self): + if isinstance(self.character, bytes): + return "'%s' codec can't decode byte #x%02x: %s\n" \ + " in \"%s\", position %d" \ + % (self.encoding, ord(self.character), self.reason, + self.name, self.position) + else: + return "unacceptable character #x%04x: %s\n" \ + " in \"%s\", position %d" \ + % (self.character, self.reason, + self.name, self.position) + +class Reader(object): + # Reader: + # - determines the data encoding and converts it to a unicode string, + # - checks if characters are in allowed range, + # - adds '\0' to the end. + + # Reader accepts + # - a `bytes` object, + # - a `str` object, + # - a file-like object with its `read` method returning `str`, + # - a file-like object with its `read` method returning `unicode`. + + # Yeah, it's ugly and slow. + + def __init__(self, stream): + self.name = None + self.stream = None + self.stream_pointer = 0 + self.eof = True + self.buffer = '' + self.pointer = 0 + self.raw_buffer = None + self.raw_decode = None + self.encoding = None + self.index = 0 + self.line = 0 + self.column = 0 + if isinstance(stream, str): + self.name = "" + self.check_printable(stream) + self.buffer = stream+'\0' + elif isinstance(stream, bytes): + self.name = "" + self.raw_buffer = stream + self.determine_encoding() + else: + self.stream = stream + self.name = getattr(stream, 'name', "") + self.eof = False + self.raw_buffer = None + self.determine_encoding() + + def peek(self, index=0): + try: + return self.buffer[self.pointer+index] + except IndexError: + self.update(index+1) + return self.buffer[self.pointer+index] + + def prefix(self, length=1): + if self.pointer+length >= len(self.buffer): + self.update(length) + return self.buffer[self.pointer:self.pointer+length] + + def forward(self, length=1): + if self.pointer+length+1 >= len(self.buffer): + self.update(length+1) + while length: + ch = self.buffer[self.pointer] + self.pointer += 1 + self.index += 1 + if ch in '\n\x85\u2028\u2029' \ + or (ch == '\r' and self.buffer[self.pointer] != '\n'): + self.line += 1 + self.column = 0 + elif ch != '\uFEFF': + self.column += 1 + length -= 1 + + def get_mark(self): + if self.stream is None: + return Mark(self.name, self.index, self.line, self.column, + self.buffer, self.pointer) + else: + return Mark(self.name, self.index, self.line, self.column, + None, None) + + def determine_encoding(self): + while not self.eof and (self.raw_buffer is None or len(self.raw_buffer) < 2): + self.update_raw() + if isinstance(self.raw_buffer, bytes): + if self.raw_buffer.startswith(codecs.BOM_UTF16_LE): + self.raw_decode = codecs.utf_16_le_decode + self.encoding = 'utf-16-le' + elif self.raw_buffer.startswith(codecs.BOM_UTF16_BE): + self.raw_decode = codecs.utf_16_be_decode + self.encoding = 'utf-16-be' + else: + self.raw_decode = codecs.utf_8_decode + self.encoding = 'utf-8' + self.update(1) + + NON_PRINTABLE = re.compile('[^\x09\x0A\x0D\x20-\x7E\x85\xA0-\uD7FF\uE000-\uFFFD\U00010000-\U0010ffff]') + def check_printable(self, data): + match = self.NON_PRINTABLE.search(data) + if match: + character = match.group() + position = self.index+(len(self.buffer)-self.pointer)+match.start() + raise ReaderError(self.name, position, ord(character), + 'unicode', "special characters are not allowed") + + def update(self, length): + if self.raw_buffer is None: + return + self.buffer = self.buffer[self.pointer:] + self.pointer = 0 + while len(self.buffer) < length: + if not self.eof: + self.update_raw() + if self.raw_decode is not None: + try: + data, converted = self.raw_decode(self.raw_buffer, + 'strict', self.eof) + except UnicodeDecodeError as exc: + character = self.raw_buffer[exc.start] + if self.stream is not None: + position = self.stream_pointer-len(self.raw_buffer)+exc.start + else: + position = exc.start + raise ReaderError(self.name, position, character, + exc.encoding, exc.reason) + else: + data = self.raw_buffer + converted = len(data) + self.check_printable(data) + self.buffer += data + self.raw_buffer = self.raw_buffer[converted:] + if self.eof: + self.buffer += '\0' + self.raw_buffer = None + break + + def update_raw(self, size=4096): + data = self.stream.read(size) + if self.raw_buffer is None: + self.raw_buffer = data + else: + self.raw_buffer += data + self.stream_pointer += len(data) + if not data: + self.eof = True diff --git a/.local/lib/python3.10/site-packages/yaml/representer.py b/.local/lib/python3.10/site-packages/yaml/representer.py new file mode 100644 index 0000000000000000000000000000000000000000..808ca06dfbd60c9a23eb079151b74a82ef688749 --- /dev/null +++ b/.local/lib/python3.10/site-packages/yaml/representer.py @@ -0,0 +1,389 @@ + +__all__ = ['BaseRepresenter', 'SafeRepresenter', 'Representer', + 'RepresenterError'] + +from .error import * +from .nodes import * + +import datetime, copyreg, types, base64, collections + +class RepresenterError(YAMLError): + pass + +class BaseRepresenter: + + yaml_representers = {} + yaml_multi_representers = {} + + def __init__(self, default_style=None, default_flow_style=False, sort_keys=True): + self.default_style = default_style + self.sort_keys = sort_keys + self.default_flow_style = default_flow_style + self.represented_objects = {} + self.object_keeper = [] + self.alias_key = None + + def represent(self, data): + node = self.represent_data(data) + self.serialize(node) + self.represented_objects = {} + self.object_keeper = [] + self.alias_key = None + + def represent_data(self, data): + if self.ignore_aliases(data): + self.alias_key = None + else: + self.alias_key = id(data) + if self.alias_key is not None: + if self.alias_key in self.represented_objects: + node = self.represented_objects[self.alias_key] + #if node is None: + # raise RepresenterError("recursive objects are not allowed: %r" % data) + return node + #self.represented_objects[alias_key] = None + self.object_keeper.append(data) + data_types = type(data).__mro__ + if data_types[0] in self.yaml_representers: + node = self.yaml_representers[data_types[0]](self, data) + else: + for data_type in data_types: + if data_type in self.yaml_multi_representers: + node = self.yaml_multi_representers[data_type](self, data) + break + else: + if None in self.yaml_multi_representers: + node = self.yaml_multi_representers[None](self, data) + elif None in self.yaml_representers: + node = self.yaml_representers[None](self, data) + else: + node = ScalarNode(None, str(data)) + #if alias_key is not None: + # self.represented_objects[alias_key] = node + return node + + @classmethod + def add_representer(cls, data_type, representer): + if not 'yaml_representers' in cls.__dict__: + cls.yaml_representers = cls.yaml_representers.copy() + cls.yaml_representers[data_type] = representer + + @classmethod + def add_multi_representer(cls, data_type, representer): + if not 'yaml_multi_representers' in cls.__dict__: + cls.yaml_multi_representers = cls.yaml_multi_representers.copy() + cls.yaml_multi_representers[data_type] = representer + + def represent_scalar(self, tag, value, style=None): + if style is None: + style = self.default_style + node = ScalarNode(tag, value, style=style) + if self.alias_key is not None: + self.represented_objects[self.alias_key] = node + return node + + def represent_sequence(self, tag, sequence, flow_style=None): + value = [] + node = SequenceNode(tag, value, flow_style=flow_style) + if self.alias_key is not None: + self.represented_objects[self.alias_key] = node + best_style = True + for item in sequence: + node_item = self.represent_data(item) + if not (isinstance(node_item, ScalarNode) and not node_item.style): + best_style = False + value.append(node_item) + if flow_style is None: + if self.default_flow_style is not None: + node.flow_style = self.default_flow_style + else: + node.flow_style = best_style + return node + + def represent_mapping(self, tag, mapping, flow_style=None): + value = [] + node = MappingNode(tag, value, flow_style=flow_style) + if self.alias_key is not None: + self.represented_objects[self.alias_key] = node + best_style = True + if hasattr(mapping, 'items'): + mapping = list(mapping.items()) + if self.sort_keys: + try: + mapping = sorted(mapping) + except TypeError: + pass + for item_key, item_value in mapping: + node_key = self.represent_data(item_key) + node_value = self.represent_data(item_value) + if not (isinstance(node_key, ScalarNode) and not node_key.style): + best_style = False + if not (isinstance(node_value, ScalarNode) and not node_value.style): + best_style = False + value.append((node_key, node_value)) + if flow_style is None: + if self.default_flow_style is not None: + node.flow_style = self.default_flow_style + else: + node.flow_style = best_style + return node + + def ignore_aliases(self, data): + return False + +class SafeRepresenter(BaseRepresenter): + + def ignore_aliases(self, data): + if data is None: + return True + if isinstance(data, tuple) and data == (): + return True + if isinstance(data, (str, bytes, bool, int, float)): + return True + + def represent_none(self, data): + return self.represent_scalar('tag:yaml.org,2002:null', 'null') + + def represent_str(self, data): + return self.represent_scalar('tag:yaml.org,2002:str', data) + + def represent_binary(self, data): + if hasattr(base64, 'encodebytes'): + data = base64.encodebytes(data).decode('ascii') + else: + data = base64.encodestring(data).decode('ascii') + return self.represent_scalar('tag:yaml.org,2002:binary', data, style='|') + + def represent_bool(self, data): + if data: + value = 'true' + else: + value = 'false' + return self.represent_scalar('tag:yaml.org,2002:bool', value) + + def represent_int(self, data): + return self.represent_scalar('tag:yaml.org,2002:int', str(data)) + + inf_value = 1e300 + while repr(inf_value) != repr(inf_value*inf_value): + inf_value *= inf_value + + def represent_float(self, data): + if data != data or (data == 0.0 and data == 1.0): + value = '.nan' + elif data == self.inf_value: + value = '.inf' + elif data == -self.inf_value: + value = '-.inf' + else: + value = repr(data).lower() + # Note that in some cases `repr(data)` represents a float number + # without the decimal parts. For instance: + # >>> repr(1e17) + # '1e17' + # Unfortunately, this is not a valid float representation according + # to the definition of the `!!float` tag. We fix this by adding + # '.0' before the 'e' symbol. + if '.' not in value and 'e' in value: + value = value.replace('e', '.0e', 1) + return self.represent_scalar('tag:yaml.org,2002:float', value) + + def represent_list(self, data): + #pairs = (len(data) > 0 and isinstance(data, list)) + #if pairs: + # for item in data: + # if not isinstance(item, tuple) or len(item) != 2: + # pairs = False + # break + #if not pairs: + return self.represent_sequence('tag:yaml.org,2002:seq', data) + #value = [] + #for item_key, item_value in data: + # value.append(self.represent_mapping(u'tag:yaml.org,2002:map', + # [(item_key, item_value)])) + #return SequenceNode(u'tag:yaml.org,2002:pairs', value) + + def represent_dict(self, data): + return self.represent_mapping('tag:yaml.org,2002:map', data) + + def represent_set(self, data): + value = {} + for key in data: + value[key] = None + return self.represent_mapping('tag:yaml.org,2002:set', value) + + def represent_date(self, data): + value = data.isoformat() + return self.represent_scalar('tag:yaml.org,2002:timestamp', value) + + def represent_datetime(self, data): + value = data.isoformat(' ') + return self.represent_scalar('tag:yaml.org,2002:timestamp', value) + + def represent_yaml_object(self, tag, data, cls, flow_style=None): + if hasattr(data, '__getstate__'): + state = data.__getstate__() + else: + state = data.__dict__.copy() + return self.represent_mapping(tag, state, flow_style=flow_style) + + def represent_undefined(self, data): + raise RepresenterError("cannot represent an object", data) + +SafeRepresenter.add_representer(type(None), + SafeRepresenter.represent_none) + +SafeRepresenter.add_representer(str, + SafeRepresenter.represent_str) + +SafeRepresenter.add_representer(bytes, + SafeRepresenter.represent_binary) + +SafeRepresenter.add_representer(bool, + SafeRepresenter.represent_bool) + +SafeRepresenter.add_representer(int, + SafeRepresenter.represent_int) + +SafeRepresenter.add_representer(float, + SafeRepresenter.represent_float) + +SafeRepresenter.add_representer(list, + SafeRepresenter.represent_list) + +SafeRepresenter.add_representer(tuple, + SafeRepresenter.represent_list) + +SafeRepresenter.add_representer(dict, + SafeRepresenter.represent_dict) + +SafeRepresenter.add_representer(set, + SafeRepresenter.represent_set) + +SafeRepresenter.add_representer(datetime.date, + SafeRepresenter.represent_date) + +SafeRepresenter.add_representer(datetime.datetime, + SafeRepresenter.represent_datetime) + +SafeRepresenter.add_representer(None, + SafeRepresenter.represent_undefined) + +class Representer(SafeRepresenter): + + def represent_complex(self, data): + if data.imag == 0.0: + data = '%r' % data.real + elif data.real == 0.0: + data = '%rj' % data.imag + elif data.imag > 0: + data = '%r+%rj' % (data.real, data.imag) + else: + data = '%r%rj' % (data.real, data.imag) + return self.represent_scalar('tag:yaml.org,2002:python/complex', data) + + def represent_tuple(self, data): + return self.represent_sequence('tag:yaml.org,2002:python/tuple', data) + + def represent_name(self, data): + name = '%s.%s' % (data.__module__, data.__name__) + return self.represent_scalar('tag:yaml.org,2002:python/name:'+name, '') + + def represent_module(self, data): + return self.represent_scalar( + 'tag:yaml.org,2002:python/module:'+data.__name__, '') + + def represent_object(self, data): + # We use __reduce__ API to save the data. data.__reduce__ returns + # a tuple of length 2-5: + # (function, args, state, listitems, dictitems) + + # For reconstructing, we calls function(*args), then set its state, + # listitems, and dictitems if they are not None. + + # A special case is when function.__name__ == '__newobj__'. In this + # case we create the object with args[0].__new__(*args). + + # Another special case is when __reduce__ returns a string - we don't + # support it. + + # We produce a !!python/object, !!python/object/new or + # !!python/object/apply node. + + cls = type(data) + if cls in copyreg.dispatch_table: + reduce = copyreg.dispatch_table[cls](data) + elif hasattr(data, '__reduce_ex__'): + reduce = data.__reduce_ex__(2) + elif hasattr(data, '__reduce__'): + reduce = data.__reduce__() + else: + raise RepresenterError("cannot represent an object", data) + reduce = (list(reduce)+[None]*5)[:5] + function, args, state, listitems, dictitems = reduce + args = list(args) + if state is None: + state = {} + if listitems is not None: + listitems = list(listitems) + if dictitems is not None: + dictitems = dict(dictitems) + if function.__name__ == '__newobj__': + function = args[0] + args = args[1:] + tag = 'tag:yaml.org,2002:python/object/new:' + newobj = True + else: + tag = 'tag:yaml.org,2002:python/object/apply:' + newobj = False + function_name = '%s.%s' % (function.__module__, function.__name__) + if not args and not listitems and not dictitems \ + and isinstance(state, dict) and newobj: + return self.represent_mapping( + 'tag:yaml.org,2002:python/object:'+function_name, state) + if not listitems and not dictitems \ + and isinstance(state, dict) and not state: + return self.represent_sequence(tag+function_name, args) + value = {} + if args: + value['args'] = args + if state or not isinstance(state, dict): + value['state'] = state + if listitems: + value['listitems'] = listitems + if dictitems: + value['dictitems'] = dictitems + return self.represent_mapping(tag+function_name, value) + + def represent_ordered_dict(self, data): + # Provide uniform representation across different Python versions. + data_type = type(data) + tag = 'tag:yaml.org,2002:python/object/apply:%s.%s' \ + % (data_type.__module__, data_type.__name__) + items = [[key, value] for key, value in data.items()] + return self.represent_sequence(tag, [items]) + +Representer.add_representer(complex, + Representer.represent_complex) + +Representer.add_representer(tuple, + Representer.represent_tuple) + +Representer.add_multi_representer(type, + Representer.represent_name) + +Representer.add_representer(collections.OrderedDict, + Representer.represent_ordered_dict) + +Representer.add_representer(types.FunctionType, + Representer.represent_name) + +Representer.add_representer(types.BuiltinFunctionType, + Representer.represent_name) + +Representer.add_representer(types.ModuleType, + Representer.represent_module) + +Representer.add_multi_representer(object, + Representer.represent_object) + diff --git a/.local/lib/python3.10/site-packages/yaml/resolver.py b/.local/lib/python3.10/site-packages/yaml/resolver.py new file mode 100644 index 0000000000000000000000000000000000000000..3522bdaaf6358110b608f4e6503b9d314c82d887 --- /dev/null +++ b/.local/lib/python3.10/site-packages/yaml/resolver.py @@ -0,0 +1,227 @@ + +__all__ = ['BaseResolver', 'Resolver'] + +from .error import * +from .nodes import * + +import re + +class ResolverError(YAMLError): + pass + +class BaseResolver: + + DEFAULT_SCALAR_TAG = 'tag:yaml.org,2002:str' + DEFAULT_SEQUENCE_TAG = 'tag:yaml.org,2002:seq' + DEFAULT_MAPPING_TAG = 'tag:yaml.org,2002:map' + + yaml_implicit_resolvers = {} + yaml_path_resolvers = {} + + def __init__(self): + self.resolver_exact_paths = [] + self.resolver_prefix_paths = [] + + @classmethod + def add_implicit_resolver(cls, tag, regexp, first): + if not 'yaml_implicit_resolvers' in cls.__dict__: + implicit_resolvers = {} + for key in cls.yaml_implicit_resolvers: + implicit_resolvers[key] = cls.yaml_implicit_resolvers[key][:] + cls.yaml_implicit_resolvers = implicit_resolvers + if first is None: + first = [None] + for ch in first: + cls.yaml_implicit_resolvers.setdefault(ch, []).append((tag, regexp)) + + @classmethod + def add_path_resolver(cls, tag, path, kind=None): + # Note: `add_path_resolver` is experimental. The API could be changed. + # `new_path` is a pattern that is matched against the path from the + # root to the node that is being considered. `node_path` elements are + # tuples `(node_check, index_check)`. `node_check` is a node class: + # `ScalarNode`, `SequenceNode`, `MappingNode` or `None`. `None` + # matches any kind of a node. `index_check` could be `None`, a boolean + # value, a string value, or a number. `None` and `False` match against + # any _value_ of sequence and mapping nodes. `True` matches against + # any _key_ of a mapping node. A string `index_check` matches against + # a mapping value that corresponds to a scalar key which content is + # equal to the `index_check` value. An integer `index_check` matches + # against a sequence value with the index equal to `index_check`. + if not 'yaml_path_resolvers' in cls.__dict__: + cls.yaml_path_resolvers = cls.yaml_path_resolvers.copy() + new_path = [] + for element in path: + if isinstance(element, (list, tuple)): + if len(element) == 2: + node_check, index_check = element + elif len(element) == 1: + node_check = element[0] + index_check = True + else: + raise ResolverError("Invalid path element: %s" % element) + else: + node_check = None + index_check = element + if node_check is str: + node_check = ScalarNode + elif node_check is list: + node_check = SequenceNode + elif node_check is dict: + node_check = MappingNode + elif node_check not in [ScalarNode, SequenceNode, MappingNode] \ + and not isinstance(node_check, str) \ + and node_check is not None: + raise ResolverError("Invalid node checker: %s" % node_check) + if not isinstance(index_check, (str, int)) \ + and index_check is not None: + raise ResolverError("Invalid index checker: %s" % index_check) + new_path.append((node_check, index_check)) + if kind is str: + kind = ScalarNode + elif kind is list: + kind = SequenceNode + elif kind is dict: + kind = MappingNode + elif kind not in [ScalarNode, SequenceNode, MappingNode] \ + and kind is not None: + raise ResolverError("Invalid node kind: %s" % kind) + cls.yaml_path_resolvers[tuple(new_path), kind] = tag + + def descend_resolver(self, current_node, current_index): + if not self.yaml_path_resolvers: + return + exact_paths = {} + prefix_paths = [] + if current_node: + depth = len(self.resolver_prefix_paths) + for path, kind in self.resolver_prefix_paths[-1]: + if self.check_resolver_prefix(depth, path, kind, + current_node, current_index): + if len(path) > depth: + prefix_paths.append((path, kind)) + else: + exact_paths[kind] = self.yaml_path_resolvers[path, kind] + else: + for path, kind in self.yaml_path_resolvers: + if not path: + exact_paths[kind] = self.yaml_path_resolvers[path, kind] + else: + prefix_paths.append((path, kind)) + self.resolver_exact_paths.append(exact_paths) + self.resolver_prefix_paths.append(prefix_paths) + + def ascend_resolver(self): + if not self.yaml_path_resolvers: + return + self.resolver_exact_paths.pop() + self.resolver_prefix_paths.pop() + + def check_resolver_prefix(self, depth, path, kind, + current_node, current_index): + node_check, index_check = path[depth-1] + if isinstance(node_check, str): + if current_node.tag != node_check: + return + elif node_check is not None: + if not isinstance(current_node, node_check): + return + if index_check is True and current_index is not None: + return + if (index_check is False or index_check is None) \ + and current_index is None: + return + if isinstance(index_check, str): + if not (isinstance(current_index, ScalarNode) + and index_check == current_index.value): + return + elif isinstance(index_check, int) and not isinstance(index_check, bool): + if index_check != current_index: + return + return True + + def resolve(self, kind, value, implicit): + if kind is ScalarNode and implicit[0]: + if value == '': + resolvers = self.yaml_implicit_resolvers.get('', []) + else: + resolvers = self.yaml_implicit_resolvers.get(value[0], []) + wildcard_resolvers = self.yaml_implicit_resolvers.get(None, []) + for tag, regexp in resolvers + wildcard_resolvers: + if regexp.match(value): + return tag + implicit = implicit[1] + if self.yaml_path_resolvers: + exact_paths = self.resolver_exact_paths[-1] + if kind in exact_paths: + return exact_paths[kind] + if None in exact_paths: + return exact_paths[None] + if kind is ScalarNode: + return self.DEFAULT_SCALAR_TAG + elif kind is SequenceNode: + return self.DEFAULT_SEQUENCE_TAG + elif kind is MappingNode: + return self.DEFAULT_MAPPING_TAG + +class Resolver(BaseResolver): + pass + +Resolver.add_implicit_resolver( + 'tag:yaml.org,2002:bool', + re.compile(r'''^(?:yes|Yes|YES|no|No|NO + |true|True|TRUE|false|False|FALSE + |on|On|ON|off|Off|OFF)$''', re.X), + list('yYnNtTfFoO')) + +Resolver.add_implicit_resolver( + 'tag:yaml.org,2002:float', + re.compile(r'''^(?:[-+]?(?:[0-9][0-9_]*)\.[0-9_]*(?:[eE][-+][0-9]+)? + |\.[0-9][0-9_]*(?:[eE][-+][0-9]+)? + |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]* + |[-+]?\.(?:inf|Inf|INF) + |\.(?:nan|NaN|NAN))$''', re.X), + list('-+0123456789.')) + +Resolver.add_implicit_resolver( + 'tag:yaml.org,2002:int', + re.compile(r'''^(?:[-+]?0b[0-1_]+ + |[-+]?0[0-7_]+ + |[-+]?(?:0|[1-9][0-9_]*) + |[-+]?0x[0-9a-fA-F_]+ + |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9])+)$''', re.X), + list('-+0123456789')) + +Resolver.add_implicit_resolver( + 'tag:yaml.org,2002:merge', + re.compile(r'^(?:<<)$'), + ['<']) + +Resolver.add_implicit_resolver( + 'tag:yaml.org,2002:null', + re.compile(r'''^(?: ~ + |null|Null|NULL + | )$''', re.X), + ['~', 'n', 'N', '']) + +Resolver.add_implicit_resolver( + 'tag:yaml.org,2002:timestamp', + re.compile(r'''^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] + |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]? + (?:[Tt]|[ \t]+)[0-9][0-9]? + :[0-9][0-9] :[0-9][0-9] (?:\.[0-9]*)? + (?:[ \t]*(?:Z|[-+][0-9][0-9]?(?::[0-9][0-9])?))?)$''', re.X), + list('0123456789')) + +Resolver.add_implicit_resolver( + 'tag:yaml.org,2002:value', + re.compile(r'^(?:=)$'), + ['=']) + +# The following resolver is only for documentation purposes. It cannot work +# because plain scalars cannot start with '!', '&', or '*'. +Resolver.add_implicit_resolver( + 'tag:yaml.org,2002:yaml', + re.compile(r'^(?:!|&|\*)$'), + list('!&*')) + diff --git a/.local/lib/python3.10/site-packages/yaml/scanner.py b/.local/lib/python3.10/site-packages/yaml/scanner.py new file mode 100644 index 0000000000000000000000000000000000000000..de925b07f1eaec33c9c305a8a69f9eb7ac5983c5 --- /dev/null +++ b/.local/lib/python3.10/site-packages/yaml/scanner.py @@ -0,0 +1,1435 @@ + +# Scanner produces tokens of the following types: +# STREAM-START +# STREAM-END +# DIRECTIVE(name, value) +# DOCUMENT-START +# DOCUMENT-END +# BLOCK-SEQUENCE-START +# BLOCK-MAPPING-START +# BLOCK-END +# FLOW-SEQUENCE-START +# FLOW-MAPPING-START +# FLOW-SEQUENCE-END +# FLOW-MAPPING-END +# BLOCK-ENTRY +# FLOW-ENTRY +# KEY +# VALUE +# ALIAS(value) +# ANCHOR(value) +# TAG(value) +# SCALAR(value, plain, style) +# +# Read comments in the Scanner code for more details. +# + +__all__ = ['Scanner', 'ScannerError'] + +from .error import MarkedYAMLError +from .tokens import * + +class ScannerError(MarkedYAMLError): + pass + +class SimpleKey: + # See below simple keys treatment. + + def __init__(self, token_number, required, index, line, column, mark): + self.token_number = token_number + self.required = required + self.index = index + self.line = line + self.column = column + self.mark = mark + +class Scanner: + + def __init__(self): + """Initialize the scanner.""" + # It is assumed that Scanner and Reader will have a common descendant. + # Reader do the dirty work of checking for BOM and converting the + # input data to Unicode. It also adds NUL to the end. + # + # Reader supports the following methods + # self.peek(i=0) # peek the next i-th character + # self.prefix(l=1) # peek the next l characters + # self.forward(l=1) # read the next l characters and move the pointer. + + # Had we reached the end of the stream? + self.done = False + + # The number of unclosed '{' and '['. `flow_level == 0` means block + # context. + self.flow_level = 0 + + # List of processed tokens that are not yet emitted. + self.tokens = [] + + # Add the STREAM-START token. + self.fetch_stream_start() + + # Number of tokens that were emitted through the `get_token` method. + self.tokens_taken = 0 + + # The current indentation level. + self.indent = -1 + + # Past indentation levels. + self.indents = [] + + # Variables related to simple keys treatment. + + # A simple key is a key that is not denoted by the '?' indicator. + # Example of simple keys: + # --- + # block simple key: value + # ? not a simple key: + # : { flow simple key: value } + # We emit the KEY token before all keys, so when we find a potential + # simple key, we try to locate the corresponding ':' indicator. + # Simple keys should be limited to a single line and 1024 characters. + + # Can a simple key start at the current position? A simple key may + # start: + # - at the beginning of the line, not counting indentation spaces + # (in block context), + # - after '{', '[', ',' (in the flow context), + # - after '?', ':', '-' (in the block context). + # In the block context, this flag also signifies if a block collection + # may start at the current position. + self.allow_simple_key = True + + # Keep track of possible simple keys. This is a dictionary. The key + # is `flow_level`; there can be no more that one possible simple key + # for each level. The value is a SimpleKey record: + # (token_number, required, index, line, column, mark) + # A simple key may start with ALIAS, ANCHOR, TAG, SCALAR(flow), + # '[', or '{' tokens. + self.possible_simple_keys = {} + + # Public methods. + + def check_token(self, *choices): + # Check if the next token is one of the given types. + while self.need_more_tokens(): + self.fetch_more_tokens() + if self.tokens: + if not choices: + return True + for choice in choices: + if isinstance(self.tokens[0], choice): + return True + return False + + def peek_token(self): + # Return the next token, but do not delete if from the queue. + # Return None if no more tokens. + while self.need_more_tokens(): + self.fetch_more_tokens() + if self.tokens: + return self.tokens[0] + else: + return None + + def get_token(self): + # Return the next token. + while self.need_more_tokens(): + self.fetch_more_tokens() + if self.tokens: + self.tokens_taken += 1 + return self.tokens.pop(0) + + # Private methods. + + def need_more_tokens(self): + if self.done: + return False + if not self.tokens: + return True + # The current token may be a potential simple key, so we + # need to look further. + self.stale_possible_simple_keys() + if self.next_possible_simple_key() == self.tokens_taken: + return True + + def fetch_more_tokens(self): + + # Eat whitespaces and comments until we reach the next token. + self.scan_to_next_token() + + # Remove obsolete possible simple keys. + self.stale_possible_simple_keys() + + # Compare the current indentation and column. It may add some tokens + # and decrease the current indentation level. + self.unwind_indent(self.column) + + # Peek the next character. + ch = self.peek() + + # Is it the end of stream? + if ch == '\0': + return self.fetch_stream_end() + + # Is it a directive? + if ch == '%' and self.check_directive(): + return self.fetch_directive() + + # Is it the document start? + if ch == '-' and self.check_document_start(): + return self.fetch_document_start() + + # Is it the document end? + if ch == '.' and self.check_document_end(): + return self.fetch_document_end() + + # TODO: support for BOM within a stream. + #if ch == '\uFEFF': + # return self.fetch_bom() <-- issue BOMToken + + # Note: the order of the following checks is NOT significant. + + # Is it the flow sequence start indicator? + if ch == '[': + return self.fetch_flow_sequence_start() + + # Is it the flow mapping start indicator? + if ch == '{': + return self.fetch_flow_mapping_start() + + # Is it the flow sequence end indicator? + if ch == ']': + return self.fetch_flow_sequence_end() + + # Is it the flow mapping end indicator? + if ch == '}': + return self.fetch_flow_mapping_end() + + # Is it the flow entry indicator? + if ch == ',': + return self.fetch_flow_entry() + + # Is it the block entry indicator? + if ch == '-' and self.check_block_entry(): + return self.fetch_block_entry() + + # Is it the key indicator? + if ch == '?' and self.check_key(): + return self.fetch_key() + + # Is it the value indicator? + if ch == ':' and self.check_value(): + return self.fetch_value() + + # Is it an alias? + if ch == '*': + return self.fetch_alias() + + # Is it an anchor? + if ch == '&': + return self.fetch_anchor() + + # Is it a tag? + if ch == '!': + return self.fetch_tag() + + # Is it a literal scalar? + if ch == '|' and not self.flow_level: + return self.fetch_literal() + + # Is it a folded scalar? + if ch == '>' and not self.flow_level: + return self.fetch_folded() + + # Is it a single quoted scalar? + if ch == '\'': + return self.fetch_single() + + # Is it a double quoted scalar? + if ch == '\"': + return self.fetch_double() + + # It must be a plain scalar then. + if self.check_plain(): + return self.fetch_plain() + + # No? It's an error. Let's produce a nice error message. + raise ScannerError("while scanning for the next token", None, + "found character %r that cannot start any token" % ch, + self.get_mark()) + + # Simple keys treatment. + + def next_possible_simple_key(self): + # Return the number of the nearest possible simple key. Actually we + # don't need to loop through the whole dictionary. We may replace it + # with the following code: + # if not self.possible_simple_keys: + # return None + # return self.possible_simple_keys[ + # min(self.possible_simple_keys.keys())].token_number + min_token_number = None + for level in self.possible_simple_keys: + key = self.possible_simple_keys[level] + if min_token_number is None or key.token_number < min_token_number: + min_token_number = key.token_number + return min_token_number + + def stale_possible_simple_keys(self): + # Remove entries that are no longer possible simple keys. According to + # the YAML specification, simple keys + # - should be limited to a single line, + # - should be no longer than 1024 characters. + # Disabling this procedure will allow simple keys of any length and + # height (may cause problems if indentation is broken though). + for level in list(self.possible_simple_keys): + key = self.possible_simple_keys[level] + if key.line != self.line \ + or self.index-key.index > 1024: + if key.required: + raise ScannerError("while scanning a simple key", key.mark, + "could not find expected ':'", self.get_mark()) + del self.possible_simple_keys[level] + + def save_possible_simple_key(self): + # The next token may start a simple key. We check if it's possible + # and save its position. This function is called for + # ALIAS, ANCHOR, TAG, SCALAR(flow), '[', and '{'. + + # Check if a simple key is required at the current position. + required = not self.flow_level and self.indent == self.column + + # The next token might be a simple key. Let's save it's number and + # position. + if self.allow_simple_key: + self.remove_possible_simple_key() + token_number = self.tokens_taken+len(self.tokens) + key = SimpleKey(token_number, required, + self.index, self.line, self.column, self.get_mark()) + self.possible_simple_keys[self.flow_level] = key + + def remove_possible_simple_key(self): + # Remove the saved possible key position at the current flow level. + if self.flow_level in self.possible_simple_keys: + key = self.possible_simple_keys[self.flow_level] + + if key.required: + raise ScannerError("while scanning a simple key", key.mark, + "could not find expected ':'", self.get_mark()) + + del self.possible_simple_keys[self.flow_level] + + # Indentation functions. + + def unwind_indent(self, column): + + ## In flow context, tokens should respect indentation. + ## Actually the condition should be `self.indent >= column` according to + ## the spec. But this condition will prohibit intuitively correct + ## constructions such as + ## key : { + ## } + #if self.flow_level and self.indent > column: + # raise ScannerError(None, None, + # "invalid indentation or unclosed '[' or '{'", + # self.get_mark()) + + # In the flow context, indentation is ignored. We make the scanner less + # restrictive then specification requires. + if self.flow_level: + return + + # In block context, we may need to issue the BLOCK-END tokens. + while self.indent > column: + mark = self.get_mark() + self.indent = self.indents.pop() + self.tokens.append(BlockEndToken(mark, mark)) + + def add_indent(self, column): + # Check if we need to increase indentation. + if self.indent < column: + self.indents.append(self.indent) + self.indent = column + return True + return False + + # Fetchers. + + def fetch_stream_start(self): + # We always add STREAM-START as the first token and STREAM-END as the + # last token. + + # Read the token. + mark = self.get_mark() + + # Add STREAM-START. + self.tokens.append(StreamStartToken(mark, mark, + encoding=self.encoding)) + + + def fetch_stream_end(self): + + # Set the current indentation to -1. + self.unwind_indent(-1) + + # Reset simple keys. + self.remove_possible_simple_key() + self.allow_simple_key = False + self.possible_simple_keys = {} + + # Read the token. + mark = self.get_mark() + + # Add STREAM-END. + self.tokens.append(StreamEndToken(mark, mark)) + + # The steam is finished. + self.done = True + + def fetch_directive(self): + + # Set the current indentation to -1. + self.unwind_indent(-1) + + # Reset simple keys. + self.remove_possible_simple_key() + self.allow_simple_key = False + + # Scan and add DIRECTIVE. + self.tokens.append(self.scan_directive()) + + def fetch_document_start(self): + self.fetch_document_indicator(DocumentStartToken) + + def fetch_document_end(self): + self.fetch_document_indicator(DocumentEndToken) + + def fetch_document_indicator(self, TokenClass): + + # Set the current indentation to -1. + self.unwind_indent(-1) + + # Reset simple keys. Note that there could not be a block collection + # after '---'. + self.remove_possible_simple_key() + self.allow_simple_key = False + + # Add DOCUMENT-START or DOCUMENT-END. + start_mark = self.get_mark() + self.forward(3) + end_mark = self.get_mark() + self.tokens.append(TokenClass(start_mark, end_mark)) + + def fetch_flow_sequence_start(self): + self.fetch_flow_collection_start(FlowSequenceStartToken) + + def fetch_flow_mapping_start(self): + self.fetch_flow_collection_start(FlowMappingStartToken) + + def fetch_flow_collection_start(self, TokenClass): + + # '[' and '{' may start a simple key. + self.save_possible_simple_key() + + # Increase the flow level. + self.flow_level += 1 + + # Simple keys are allowed after '[' and '{'. + self.allow_simple_key = True + + # Add FLOW-SEQUENCE-START or FLOW-MAPPING-START. + start_mark = self.get_mark() + self.forward() + end_mark = self.get_mark() + self.tokens.append(TokenClass(start_mark, end_mark)) + + def fetch_flow_sequence_end(self): + self.fetch_flow_collection_end(FlowSequenceEndToken) + + def fetch_flow_mapping_end(self): + self.fetch_flow_collection_end(FlowMappingEndToken) + + def fetch_flow_collection_end(self, TokenClass): + + # Reset possible simple key on the current level. + self.remove_possible_simple_key() + + # Decrease the flow level. + self.flow_level -= 1 + + # No simple keys after ']' or '}'. + self.allow_simple_key = False + + # Add FLOW-SEQUENCE-END or FLOW-MAPPING-END. + start_mark = self.get_mark() + self.forward() + end_mark = self.get_mark() + self.tokens.append(TokenClass(start_mark, end_mark)) + + def fetch_flow_entry(self): + + # Simple keys are allowed after ','. + self.allow_simple_key = True + + # Reset possible simple key on the current level. + self.remove_possible_simple_key() + + # Add FLOW-ENTRY. + start_mark = self.get_mark() + self.forward() + end_mark = self.get_mark() + self.tokens.append(FlowEntryToken(start_mark, end_mark)) + + def fetch_block_entry(self): + + # Block context needs additional checks. + if not self.flow_level: + + # Are we allowed to start a new entry? + if not self.allow_simple_key: + raise ScannerError(None, None, + "sequence entries are not allowed here", + self.get_mark()) + + # We may need to add BLOCK-SEQUENCE-START. + if self.add_indent(self.column): + mark = self.get_mark() + self.tokens.append(BlockSequenceStartToken(mark, mark)) + + # It's an error for the block entry to occur in the flow context, + # but we let the parser detect this. + else: + pass + + # Simple keys are allowed after '-'. + self.allow_simple_key = True + + # Reset possible simple key on the current level. + self.remove_possible_simple_key() + + # Add BLOCK-ENTRY. + start_mark = self.get_mark() + self.forward() + end_mark = self.get_mark() + self.tokens.append(BlockEntryToken(start_mark, end_mark)) + + def fetch_key(self): + + # Block context needs additional checks. + if not self.flow_level: + + # Are we allowed to start a key (not necessary a simple)? + if not self.allow_simple_key: + raise ScannerError(None, None, + "mapping keys are not allowed here", + self.get_mark()) + + # We may need to add BLOCK-MAPPING-START. + if self.add_indent(self.column): + mark = self.get_mark() + self.tokens.append(BlockMappingStartToken(mark, mark)) + + # Simple keys are allowed after '?' in the block context. + self.allow_simple_key = not self.flow_level + + # Reset possible simple key on the current level. + self.remove_possible_simple_key() + + # Add KEY. + start_mark = self.get_mark() + self.forward() + end_mark = self.get_mark() + self.tokens.append(KeyToken(start_mark, end_mark)) + + def fetch_value(self): + + # Do we determine a simple key? + if self.flow_level in self.possible_simple_keys: + + # Add KEY. + key = self.possible_simple_keys[self.flow_level] + del self.possible_simple_keys[self.flow_level] + self.tokens.insert(key.token_number-self.tokens_taken, + KeyToken(key.mark, key.mark)) + + # If this key starts a new block mapping, we need to add + # BLOCK-MAPPING-START. + if not self.flow_level: + if self.add_indent(key.column): + self.tokens.insert(key.token_number-self.tokens_taken, + BlockMappingStartToken(key.mark, key.mark)) + + # There cannot be two simple keys one after another. + self.allow_simple_key = False + + # It must be a part of a complex key. + else: + + # Block context needs additional checks. + # (Do we really need them? They will be caught by the parser + # anyway.) + if not self.flow_level: + + # We are allowed to start a complex value if and only if + # we can start a simple key. + if not self.allow_simple_key: + raise ScannerError(None, None, + "mapping values are not allowed here", + self.get_mark()) + + # If this value starts a new block mapping, we need to add + # BLOCK-MAPPING-START. It will be detected as an error later by + # the parser. + if not self.flow_level: + if self.add_indent(self.column): + mark = self.get_mark() + self.tokens.append(BlockMappingStartToken(mark, mark)) + + # Simple keys are allowed after ':' in the block context. + self.allow_simple_key = not self.flow_level + + # Reset possible simple key on the current level. + self.remove_possible_simple_key() + + # Add VALUE. + start_mark = self.get_mark() + self.forward() + end_mark = self.get_mark() + self.tokens.append(ValueToken(start_mark, end_mark)) + + def fetch_alias(self): + + # ALIAS could be a simple key. + self.save_possible_simple_key() + + # No simple keys after ALIAS. + self.allow_simple_key = False + + # Scan and add ALIAS. + self.tokens.append(self.scan_anchor(AliasToken)) + + def fetch_anchor(self): + + # ANCHOR could start a simple key. + self.save_possible_simple_key() + + # No simple keys after ANCHOR. + self.allow_simple_key = False + + # Scan and add ANCHOR. + self.tokens.append(self.scan_anchor(AnchorToken)) + + def fetch_tag(self): + + # TAG could start a simple key. + self.save_possible_simple_key() + + # No simple keys after TAG. + self.allow_simple_key = False + + # Scan and add TAG. + self.tokens.append(self.scan_tag()) + + def fetch_literal(self): + self.fetch_block_scalar(style='|') + + def fetch_folded(self): + self.fetch_block_scalar(style='>') + + def fetch_block_scalar(self, style): + + # A simple key may follow a block scalar. + self.allow_simple_key = True + + # Reset possible simple key on the current level. + self.remove_possible_simple_key() + + # Scan and add SCALAR. + self.tokens.append(self.scan_block_scalar(style)) + + def fetch_single(self): + self.fetch_flow_scalar(style='\'') + + def fetch_double(self): + self.fetch_flow_scalar(style='"') + + def fetch_flow_scalar(self, style): + + # A flow scalar could be a simple key. + self.save_possible_simple_key() + + # No simple keys after flow scalars. + self.allow_simple_key = False + + # Scan and add SCALAR. + self.tokens.append(self.scan_flow_scalar(style)) + + def fetch_plain(self): + + # A plain scalar could be a simple key. + self.save_possible_simple_key() + + # No simple keys after plain scalars. But note that `scan_plain` will + # change this flag if the scan is finished at the beginning of the + # line. + self.allow_simple_key = False + + # Scan and add SCALAR. May change `allow_simple_key`. + self.tokens.append(self.scan_plain()) + + # Checkers. + + def check_directive(self): + + # DIRECTIVE: ^ '%' ... + # The '%' indicator is already checked. + if self.column == 0: + return True + + def check_document_start(self): + + # DOCUMENT-START: ^ '---' (' '|'\n') + if self.column == 0: + if self.prefix(3) == '---' \ + and self.peek(3) in '\0 \t\r\n\x85\u2028\u2029': + return True + + def check_document_end(self): + + # DOCUMENT-END: ^ '...' (' '|'\n') + if self.column == 0: + if self.prefix(3) == '...' \ + and self.peek(3) in '\0 \t\r\n\x85\u2028\u2029': + return True + + def check_block_entry(self): + + # BLOCK-ENTRY: '-' (' '|'\n') + return self.peek(1) in '\0 \t\r\n\x85\u2028\u2029' + + def check_key(self): + + # KEY(flow context): '?' + if self.flow_level: + return True + + # KEY(block context): '?' (' '|'\n') + else: + return self.peek(1) in '\0 \t\r\n\x85\u2028\u2029' + + def check_value(self): + + # VALUE(flow context): ':' + if self.flow_level: + return True + + # VALUE(block context): ':' (' '|'\n') + else: + return self.peek(1) in '\0 \t\r\n\x85\u2028\u2029' + + def check_plain(self): + + # A plain scalar may start with any non-space character except: + # '-', '?', ':', ',', '[', ']', '{', '}', + # '#', '&', '*', '!', '|', '>', '\'', '\"', + # '%', '@', '`'. + # + # It may also start with + # '-', '?', ':' + # if it is followed by a non-space character. + # + # Note that we limit the last rule to the block context (except the + # '-' character) because we want the flow context to be space + # independent. + ch = self.peek() + return ch not in '\0 \t\r\n\x85\u2028\u2029-?:,[]{}#&*!|>\'\"%@`' \ + or (self.peek(1) not in '\0 \t\r\n\x85\u2028\u2029' + and (ch == '-' or (not self.flow_level and ch in '?:'))) + + # Scanners. + + def scan_to_next_token(self): + # We ignore spaces, line breaks and comments. + # If we find a line break in the block context, we set the flag + # `allow_simple_key` on. + # The byte order mark is stripped if it's the first character in the + # stream. We do not yet support BOM inside the stream as the + # specification requires. Any such mark will be considered as a part + # of the document. + # + # TODO: We need to make tab handling rules more sane. A good rule is + # Tabs cannot precede tokens + # BLOCK-SEQUENCE-START, BLOCK-MAPPING-START, BLOCK-END, + # KEY(block), VALUE(block), BLOCK-ENTRY + # So the checking code is + # if : + # self.allow_simple_keys = False + # We also need to add the check for `allow_simple_keys == True` to + # `unwind_indent` before issuing BLOCK-END. + # Scanners for block, flow, and plain scalars need to be modified. + + if self.index == 0 and self.peek() == '\uFEFF': + self.forward() + found = False + while not found: + while self.peek() == ' ': + self.forward() + if self.peek() == '#': + while self.peek() not in '\0\r\n\x85\u2028\u2029': + self.forward() + if self.scan_line_break(): + if not self.flow_level: + self.allow_simple_key = True + else: + found = True + + def scan_directive(self): + # See the specification for details. + start_mark = self.get_mark() + self.forward() + name = self.scan_directive_name(start_mark) + value = None + if name == 'YAML': + value = self.scan_yaml_directive_value(start_mark) + end_mark = self.get_mark() + elif name == 'TAG': + value = self.scan_tag_directive_value(start_mark) + end_mark = self.get_mark() + else: + end_mark = self.get_mark() + while self.peek() not in '\0\r\n\x85\u2028\u2029': + self.forward() + self.scan_directive_ignored_line(start_mark) + return DirectiveToken(name, value, start_mark, end_mark) + + def scan_directive_name(self, start_mark): + # See the specification for details. + length = 0 + ch = self.peek(length) + while '0' <= ch <= '9' or 'A' <= ch <= 'Z' or 'a' <= ch <= 'z' \ + or ch in '-_': + length += 1 + ch = self.peek(length) + if not length: + raise ScannerError("while scanning a directive", start_mark, + "expected alphabetic or numeric character, but found %r" + % ch, self.get_mark()) + value = self.prefix(length) + self.forward(length) + ch = self.peek() + if ch not in '\0 \r\n\x85\u2028\u2029': + raise ScannerError("while scanning a directive", start_mark, + "expected alphabetic or numeric character, but found %r" + % ch, self.get_mark()) + return value + + def scan_yaml_directive_value(self, start_mark): + # See the specification for details. + while self.peek() == ' ': + self.forward() + major = self.scan_yaml_directive_number(start_mark) + if self.peek() != '.': + raise ScannerError("while scanning a directive", start_mark, + "expected a digit or '.', but found %r" % self.peek(), + self.get_mark()) + self.forward() + minor = self.scan_yaml_directive_number(start_mark) + if self.peek() not in '\0 \r\n\x85\u2028\u2029': + raise ScannerError("while scanning a directive", start_mark, + "expected a digit or ' ', but found %r" % self.peek(), + self.get_mark()) + return (major, minor) + + def scan_yaml_directive_number(self, start_mark): + # See the specification for details. + ch = self.peek() + if not ('0' <= ch <= '9'): + raise ScannerError("while scanning a directive", start_mark, + "expected a digit, but found %r" % ch, self.get_mark()) + length = 0 + while '0' <= self.peek(length) <= '9': + length += 1 + value = int(self.prefix(length)) + self.forward(length) + return value + + def scan_tag_directive_value(self, start_mark): + # See the specification for details. + while self.peek() == ' ': + self.forward() + handle = self.scan_tag_directive_handle(start_mark) + while self.peek() == ' ': + self.forward() + prefix = self.scan_tag_directive_prefix(start_mark) + return (handle, prefix) + + def scan_tag_directive_handle(self, start_mark): + # See the specification for details. + value = self.scan_tag_handle('directive', start_mark) + ch = self.peek() + if ch != ' ': + raise ScannerError("while scanning a directive", start_mark, + "expected ' ', but found %r" % ch, self.get_mark()) + return value + + def scan_tag_directive_prefix(self, start_mark): + # See the specification for details. + value = self.scan_tag_uri('directive', start_mark) + ch = self.peek() + if ch not in '\0 \r\n\x85\u2028\u2029': + raise ScannerError("while scanning a directive", start_mark, + "expected ' ', but found %r" % ch, self.get_mark()) + return value + + def scan_directive_ignored_line(self, start_mark): + # See the specification for details. + while self.peek() == ' ': + self.forward() + if self.peek() == '#': + while self.peek() not in '\0\r\n\x85\u2028\u2029': + self.forward() + ch = self.peek() + if ch not in '\0\r\n\x85\u2028\u2029': + raise ScannerError("while scanning a directive", start_mark, + "expected a comment or a line break, but found %r" + % ch, self.get_mark()) + self.scan_line_break() + + def scan_anchor(self, TokenClass): + # The specification does not restrict characters for anchors and + # aliases. This may lead to problems, for instance, the document: + # [ *alias, value ] + # can be interpreted in two ways, as + # [ "value" ] + # and + # [ *alias , "value" ] + # Therefore we restrict aliases to numbers and ASCII letters. + start_mark = self.get_mark() + indicator = self.peek() + if indicator == '*': + name = 'alias' + else: + name = 'anchor' + self.forward() + length = 0 + ch = self.peek(length) + while '0' <= ch <= '9' or 'A' <= ch <= 'Z' or 'a' <= ch <= 'z' \ + or ch in '-_': + length += 1 + ch = self.peek(length) + if not length: + raise ScannerError("while scanning an %s" % name, start_mark, + "expected alphabetic or numeric character, but found %r" + % ch, self.get_mark()) + value = self.prefix(length) + self.forward(length) + ch = self.peek() + if ch not in '\0 \t\r\n\x85\u2028\u2029?:,]}%@`': + raise ScannerError("while scanning an %s" % name, start_mark, + "expected alphabetic or numeric character, but found %r" + % ch, self.get_mark()) + end_mark = self.get_mark() + return TokenClass(value, start_mark, end_mark) + + def scan_tag(self): + # See the specification for details. + start_mark = self.get_mark() + ch = self.peek(1) + if ch == '<': + handle = None + self.forward(2) + suffix = self.scan_tag_uri('tag', start_mark) + if self.peek() != '>': + raise ScannerError("while parsing a tag", start_mark, + "expected '>', but found %r" % self.peek(), + self.get_mark()) + self.forward() + elif ch in '\0 \t\r\n\x85\u2028\u2029': + handle = None + suffix = '!' + self.forward() + else: + length = 1 + use_handle = False + while ch not in '\0 \r\n\x85\u2028\u2029': + if ch == '!': + use_handle = True + break + length += 1 + ch = self.peek(length) + handle = '!' + if use_handle: + handle = self.scan_tag_handle('tag', start_mark) + else: + handle = '!' + self.forward() + suffix = self.scan_tag_uri('tag', start_mark) + ch = self.peek() + if ch not in '\0 \r\n\x85\u2028\u2029': + raise ScannerError("while scanning a tag", start_mark, + "expected ' ', but found %r" % ch, self.get_mark()) + value = (handle, suffix) + end_mark = self.get_mark() + return TagToken(value, start_mark, end_mark) + + def scan_block_scalar(self, style): + # See the specification for details. + + if style == '>': + folded = True + else: + folded = False + + chunks = [] + start_mark = self.get_mark() + + # Scan the header. + self.forward() + chomping, increment = self.scan_block_scalar_indicators(start_mark) + self.scan_block_scalar_ignored_line(start_mark) + + # Determine the indentation level and go to the first non-empty line. + min_indent = self.indent+1 + if min_indent < 1: + min_indent = 1 + if increment is None: + breaks, max_indent, end_mark = self.scan_block_scalar_indentation() + indent = max(min_indent, max_indent) + else: + indent = min_indent+increment-1 + breaks, end_mark = self.scan_block_scalar_breaks(indent) + line_break = '' + + # Scan the inner part of the block scalar. + while self.column == indent and self.peek() != '\0': + chunks.extend(breaks) + leading_non_space = self.peek() not in ' \t' + length = 0 + while self.peek(length) not in '\0\r\n\x85\u2028\u2029': + length += 1 + chunks.append(self.prefix(length)) + self.forward(length) + line_break = self.scan_line_break() + breaks, end_mark = self.scan_block_scalar_breaks(indent) + if self.column == indent and self.peek() != '\0': + + # Unfortunately, folding rules are ambiguous. + # + # This is the folding according to the specification: + + if folded and line_break == '\n' \ + and leading_non_space and self.peek() not in ' \t': + if not breaks: + chunks.append(' ') + else: + chunks.append(line_break) + + # This is Clark Evans's interpretation (also in the spec + # examples): + # + #if folded and line_break == '\n': + # if not breaks: + # if self.peek() not in ' \t': + # chunks.append(' ') + # else: + # chunks.append(line_break) + #else: + # chunks.append(line_break) + else: + break + + # Chomp the tail. + if chomping is not False: + chunks.append(line_break) + if chomping is True: + chunks.extend(breaks) + + # We are done. + return ScalarToken(''.join(chunks), False, start_mark, end_mark, + style) + + def scan_block_scalar_indicators(self, start_mark): + # See the specification for details. + chomping = None + increment = None + ch = self.peek() + if ch in '+-': + if ch == '+': + chomping = True + else: + chomping = False + self.forward() + ch = self.peek() + if ch in '0123456789': + increment = int(ch) + if increment == 0: + raise ScannerError("while scanning a block scalar", start_mark, + "expected indentation indicator in the range 1-9, but found 0", + self.get_mark()) + self.forward() + elif ch in '0123456789': + increment = int(ch) + if increment == 0: + raise ScannerError("while scanning a block scalar", start_mark, + "expected indentation indicator in the range 1-9, but found 0", + self.get_mark()) + self.forward() + ch = self.peek() + if ch in '+-': + if ch == '+': + chomping = True + else: + chomping = False + self.forward() + ch = self.peek() + if ch not in '\0 \r\n\x85\u2028\u2029': + raise ScannerError("while scanning a block scalar", start_mark, + "expected chomping or indentation indicators, but found %r" + % ch, self.get_mark()) + return chomping, increment + + def scan_block_scalar_ignored_line(self, start_mark): + # See the specification for details. + while self.peek() == ' ': + self.forward() + if self.peek() == '#': + while self.peek() not in '\0\r\n\x85\u2028\u2029': + self.forward() + ch = self.peek() + if ch not in '\0\r\n\x85\u2028\u2029': + raise ScannerError("while scanning a block scalar", start_mark, + "expected a comment or a line break, but found %r" % ch, + self.get_mark()) + self.scan_line_break() + + def scan_block_scalar_indentation(self): + # See the specification for details. + chunks = [] + max_indent = 0 + end_mark = self.get_mark() + while self.peek() in ' \r\n\x85\u2028\u2029': + if self.peek() != ' ': + chunks.append(self.scan_line_break()) + end_mark = self.get_mark() + else: + self.forward() + if self.column > max_indent: + max_indent = self.column + return chunks, max_indent, end_mark + + def scan_block_scalar_breaks(self, indent): + # See the specification for details. + chunks = [] + end_mark = self.get_mark() + while self.column < indent and self.peek() == ' ': + self.forward() + while self.peek() in '\r\n\x85\u2028\u2029': + chunks.append(self.scan_line_break()) + end_mark = self.get_mark() + while self.column < indent and self.peek() == ' ': + self.forward() + return chunks, end_mark + + def scan_flow_scalar(self, style): + # See the specification for details. + # Note that we loose indentation rules for quoted scalars. Quoted + # scalars don't need to adhere indentation because " and ' clearly + # mark the beginning and the end of them. Therefore we are less + # restrictive then the specification requires. We only need to check + # that document separators are not included in scalars. + if style == '"': + double = True + else: + double = False + chunks = [] + start_mark = self.get_mark() + quote = self.peek() + self.forward() + chunks.extend(self.scan_flow_scalar_non_spaces(double, start_mark)) + while self.peek() != quote: + chunks.extend(self.scan_flow_scalar_spaces(double, start_mark)) + chunks.extend(self.scan_flow_scalar_non_spaces(double, start_mark)) + self.forward() + end_mark = self.get_mark() + return ScalarToken(''.join(chunks), False, start_mark, end_mark, + style) + + ESCAPE_REPLACEMENTS = { + '0': '\0', + 'a': '\x07', + 'b': '\x08', + 't': '\x09', + '\t': '\x09', + 'n': '\x0A', + 'v': '\x0B', + 'f': '\x0C', + 'r': '\x0D', + 'e': '\x1B', + ' ': '\x20', + '\"': '\"', + '\\': '\\', + '/': '/', + 'N': '\x85', + '_': '\xA0', + 'L': '\u2028', + 'P': '\u2029', + } + + ESCAPE_CODES = { + 'x': 2, + 'u': 4, + 'U': 8, + } + + def scan_flow_scalar_non_spaces(self, double, start_mark): + # See the specification for details. + chunks = [] + while True: + length = 0 + while self.peek(length) not in '\'\"\\\0 \t\r\n\x85\u2028\u2029': + length += 1 + if length: + chunks.append(self.prefix(length)) + self.forward(length) + ch = self.peek() + if not double and ch == '\'' and self.peek(1) == '\'': + chunks.append('\'') + self.forward(2) + elif (double and ch == '\'') or (not double and ch in '\"\\'): + chunks.append(ch) + self.forward() + elif double and ch == '\\': + self.forward() + ch = self.peek() + if ch in self.ESCAPE_REPLACEMENTS: + chunks.append(self.ESCAPE_REPLACEMENTS[ch]) + self.forward() + elif ch in self.ESCAPE_CODES: + length = self.ESCAPE_CODES[ch] + self.forward() + for k in range(length): + if self.peek(k) not in '0123456789ABCDEFabcdef': + raise ScannerError("while scanning a double-quoted scalar", start_mark, + "expected escape sequence of %d hexadecimal numbers, but found %r" % + (length, self.peek(k)), self.get_mark()) + code = int(self.prefix(length), 16) + chunks.append(chr(code)) + self.forward(length) + elif ch in '\r\n\x85\u2028\u2029': + self.scan_line_break() + chunks.extend(self.scan_flow_scalar_breaks(double, start_mark)) + else: + raise ScannerError("while scanning a double-quoted scalar", start_mark, + "found unknown escape character %r" % ch, self.get_mark()) + else: + return chunks + + def scan_flow_scalar_spaces(self, double, start_mark): + # See the specification for details. + chunks = [] + length = 0 + while self.peek(length) in ' \t': + length += 1 + whitespaces = self.prefix(length) + self.forward(length) + ch = self.peek() + if ch == '\0': + raise ScannerError("while scanning a quoted scalar", start_mark, + "found unexpected end of stream", self.get_mark()) + elif ch in '\r\n\x85\u2028\u2029': + line_break = self.scan_line_break() + breaks = self.scan_flow_scalar_breaks(double, start_mark) + if line_break != '\n': + chunks.append(line_break) + elif not breaks: + chunks.append(' ') + chunks.extend(breaks) + else: + chunks.append(whitespaces) + return chunks + + def scan_flow_scalar_breaks(self, double, start_mark): + # See the specification for details. + chunks = [] + while True: + # Instead of checking indentation, we check for document + # separators. + prefix = self.prefix(3) + if (prefix == '---' or prefix == '...') \ + and self.peek(3) in '\0 \t\r\n\x85\u2028\u2029': + raise ScannerError("while scanning a quoted scalar", start_mark, + "found unexpected document separator", self.get_mark()) + while self.peek() in ' \t': + self.forward() + if self.peek() in '\r\n\x85\u2028\u2029': + chunks.append(self.scan_line_break()) + else: + return chunks + + def scan_plain(self): + # See the specification for details. + # We add an additional restriction for the flow context: + # plain scalars in the flow context cannot contain ',' or '?'. + # We also keep track of the `allow_simple_key` flag here. + # Indentation rules are loosed for the flow context. + chunks = [] + start_mark = self.get_mark() + end_mark = start_mark + indent = self.indent+1 + # We allow zero indentation for scalars, but then we need to check for + # document separators at the beginning of the line. + #if indent == 0: + # indent = 1 + spaces = [] + while True: + length = 0 + if self.peek() == '#': + break + while True: + ch = self.peek(length) + if ch in '\0 \t\r\n\x85\u2028\u2029' \ + or (ch == ':' and + self.peek(length+1) in '\0 \t\r\n\x85\u2028\u2029' + + (u',[]{}' if self.flow_level else u''))\ + or (self.flow_level and ch in ',?[]{}'): + break + length += 1 + if length == 0: + break + self.allow_simple_key = False + chunks.extend(spaces) + chunks.append(self.prefix(length)) + self.forward(length) + end_mark = self.get_mark() + spaces = self.scan_plain_spaces(indent, start_mark) + if not spaces or self.peek() == '#' \ + or (not self.flow_level and self.column < indent): + break + return ScalarToken(''.join(chunks), True, start_mark, end_mark) + + def scan_plain_spaces(self, indent, start_mark): + # See the specification for details. + # The specification is really confusing about tabs in plain scalars. + # We just forbid them completely. Do not use tabs in YAML! + chunks = [] + length = 0 + while self.peek(length) in ' ': + length += 1 + whitespaces = self.prefix(length) + self.forward(length) + ch = self.peek() + if ch in '\r\n\x85\u2028\u2029': + line_break = self.scan_line_break() + self.allow_simple_key = True + prefix = self.prefix(3) + if (prefix == '---' or prefix == '...') \ + and self.peek(3) in '\0 \t\r\n\x85\u2028\u2029': + return + breaks = [] + while self.peek() in ' \r\n\x85\u2028\u2029': + if self.peek() == ' ': + self.forward() + else: + breaks.append(self.scan_line_break()) + prefix = self.prefix(3) + if (prefix == '---' or prefix == '...') \ + and self.peek(3) in '\0 \t\r\n\x85\u2028\u2029': + return + if line_break != '\n': + chunks.append(line_break) + elif not breaks: + chunks.append(' ') + chunks.extend(breaks) + elif whitespaces: + chunks.append(whitespaces) + return chunks + + def scan_tag_handle(self, name, start_mark): + # See the specification for details. + # For some strange reasons, the specification does not allow '_' in + # tag handles. I have allowed it anyway. + ch = self.peek() + if ch != '!': + raise ScannerError("while scanning a %s" % name, start_mark, + "expected '!', but found %r" % ch, self.get_mark()) + length = 1 + ch = self.peek(length) + if ch != ' ': + while '0' <= ch <= '9' or 'A' <= ch <= 'Z' or 'a' <= ch <= 'z' \ + or ch in '-_': + length += 1 + ch = self.peek(length) + if ch != '!': + self.forward(length) + raise ScannerError("while scanning a %s" % name, start_mark, + "expected '!', but found %r" % ch, self.get_mark()) + length += 1 + value = self.prefix(length) + self.forward(length) + return value + + def scan_tag_uri(self, name, start_mark): + # See the specification for details. + # Note: we do not check if URI is well-formed. + chunks = [] + length = 0 + ch = self.peek(length) + while '0' <= ch <= '9' or 'A' <= ch <= 'Z' or 'a' <= ch <= 'z' \ + or ch in '-;/?:@&=+$,_.!~*\'()[]%': + if ch == '%': + chunks.append(self.prefix(length)) + self.forward(length) + length = 0 + chunks.append(self.scan_uri_escapes(name, start_mark)) + else: + length += 1 + ch = self.peek(length) + if length: + chunks.append(self.prefix(length)) + self.forward(length) + length = 0 + if not chunks: + raise ScannerError("while parsing a %s" % name, start_mark, + "expected URI, but found %r" % ch, self.get_mark()) + return ''.join(chunks) + + def scan_uri_escapes(self, name, start_mark): + # See the specification for details. + codes = [] + mark = self.get_mark() + while self.peek() == '%': + self.forward() + for k in range(2): + if self.peek(k) not in '0123456789ABCDEFabcdef': + raise ScannerError("while scanning a %s" % name, start_mark, + "expected URI escape sequence of 2 hexadecimal numbers, but found %r" + % self.peek(k), self.get_mark()) + codes.append(int(self.prefix(2), 16)) + self.forward(2) + try: + value = bytes(codes).decode('utf-8') + except UnicodeDecodeError as exc: + raise ScannerError("while scanning a %s" % name, start_mark, str(exc), mark) + return value + + def scan_line_break(self): + # Transforms: + # '\r\n' : '\n' + # '\r' : '\n' + # '\n' : '\n' + # '\x85' : '\n' + # '\u2028' : '\u2028' + # '\u2029 : '\u2029' + # default : '' + ch = self.peek() + if ch in '\r\n\x85': + if self.prefix(2) == '\r\n': + self.forward(2) + else: + self.forward() + return '\n' + elif ch in '\u2028\u2029': + self.forward() + return ch + return '' diff --git a/.local/lib/python3.10/site-packages/yaml/serializer.py b/.local/lib/python3.10/site-packages/yaml/serializer.py new file mode 100644 index 0000000000000000000000000000000000000000..fe911e67ae7a739abb491fbbc6834b9c37bbda4b --- /dev/null +++ b/.local/lib/python3.10/site-packages/yaml/serializer.py @@ -0,0 +1,111 @@ + +__all__ = ['Serializer', 'SerializerError'] + +from .error import YAMLError +from .events import * +from .nodes import * + +class SerializerError(YAMLError): + pass + +class Serializer: + + ANCHOR_TEMPLATE = 'id%03d' + + def __init__(self, encoding=None, + explicit_start=None, explicit_end=None, version=None, tags=None): + self.use_encoding = encoding + self.use_explicit_start = explicit_start + self.use_explicit_end = explicit_end + self.use_version = version + self.use_tags = tags + self.serialized_nodes = {} + self.anchors = {} + self.last_anchor_id = 0 + self.closed = None + + def open(self): + if self.closed is None: + self.emit(StreamStartEvent(encoding=self.use_encoding)) + self.closed = False + elif self.closed: + raise SerializerError("serializer is closed") + else: + raise SerializerError("serializer is already opened") + + def close(self): + if self.closed is None: + raise SerializerError("serializer is not opened") + elif not self.closed: + self.emit(StreamEndEvent()) + self.closed = True + + #def __del__(self): + # self.close() + + def serialize(self, node): + if self.closed is None: + raise SerializerError("serializer is not opened") + elif self.closed: + raise SerializerError("serializer is closed") + self.emit(DocumentStartEvent(explicit=self.use_explicit_start, + version=self.use_version, tags=self.use_tags)) + self.anchor_node(node) + self.serialize_node(node, None, None) + self.emit(DocumentEndEvent(explicit=self.use_explicit_end)) + self.serialized_nodes = {} + self.anchors = {} + self.last_anchor_id = 0 + + def anchor_node(self, node): + if node in self.anchors: + if self.anchors[node] is None: + self.anchors[node] = self.generate_anchor(node) + else: + self.anchors[node] = None + if isinstance(node, SequenceNode): + for item in node.value: + self.anchor_node(item) + elif isinstance(node, MappingNode): + for key, value in node.value: + self.anchor_node(key) + self.anchor_node(value) + + def generate_anchor(self, node): + self.last_anchor_id += 1 + return self.ANCHOR_TEMPLATE % self.last_anchor_id + + def serialize_node(self, node, parent, index): + alias = self.anchors[node] + if node in self.serialized_nodes: + self.emit(AliasEvent(alias)) + else: + self.serialized_nodes[node] = True + self.descend_resolver(parent, index) + if isinstance(node, ScalarNode): + detected_tag = self.resolve(ScalarNode, node.value, (True, False)) + default_tag = self.resolve(ScalarNode, node.value, (False, True)) + implicit = (node.tag == detected_tag), (node.tag == default_tag) + self.emit(ScalarEvent(alias, node.tag, implicit, node.value, + style=node.style)) + elif isinstance(node, SequenceNode): + implicit = (node.tag + == self.resolve(SequenceNode, node.value, True)) + self.emit(SequenceStartEvent(alias, node.tag, implicit, + flow_style=node.flow_style)) + index = 0 + for item in node.value: + self.serialize_node(item, node, index) + index += 1 + self.emit(SequenceEndEvent()) + elif isinstance(node, MappingNode): + implicit = (node.tag + == self.resolve(MappingNode, node.value, True)) + self.emit(MappingStartEvent(alias, node.tag, implicit, + flow_style=node.flow_style)) + for key, value in node.value: + self.serialize_node(key, node, None) + self.serialize_node(value, node, key) + self.emit(MappingEndEvent()) + self.ascend_resolver() + diff --git a/.local/lib/python3.10/site-packages/yaml/tokens.py b/.local/lib/python3.10/site-packages/yaml/tokens.py new file mode 100644 index 0000000000000000000000000000000000000000..4d0b48a394ac8c019b401516a12f688df361cf90 --- /dev/null +++ b/.local/lib/python3.10/site-packages/yaml/tokens.py @@ -0,0 +1,104 @@ + +class Token(object): + def __init__(self, start_mark, end_mark): + self.start_mark = start_mark + self.end_mark = end_mark + def __repr__(self): + attributes = [key for key in self.__dict__ + if not key.endswith('_mark')] + attributes.sort() + arguments = ', '.join(['%s=%r' % (key, getattr(self, key)) + for key in attributes]) + return '%s(%s)' % (self.__class__.__name__, arguments) + +#class BOMToken(Token): +# id = '' + +class DirectiveToken(Token): + id = '' + def __init__(self, name, value, start_mark, end_mark): + self.name = name + self.value = value + self.start_mark = start_mark + self.end_mark = end_mark + +class DocumentStartToken(Token): + id = '' + +class DocumentEndToken(Token): + id = '' + +class StreamStartToken(Token): + id = '' + def __init__(self, start_mark=None, end_mark=None, + encoding=None): + self.start_mark = start_mark + self.end_mark = end_mark + self.encoding = encoding + +class StreamEndToken(Token): + id = '' + +class BlockSequenceStartToken(Token): + id = '' + +class BlockMappingStartToken(Token): + id = '' + +class BlockEndToken(Token): + id = '' + +class FlowSequenceStartToken(Token): + id = '[' + +class FlowMappingStartToken(Token): + id = '{' + +class FlowSequenceEndToken(Token): + id = ']' + +class FlowMappingEndToken(Token): + id = '}' + +class KeyToken(Token): + id = '?' + +class ValueToken(Token): + id = ':' + +class BlockEntryToken(Token): + id = '-' + +class FlowEntryToken(Token): + id = ',' + +class AliasToken(Token): + id = '' + def __init__(self, value, start_mark, end_mark): + self.value = value + self.start_mark = start_mark + self.end_mark = end_mark + +class AnchorToken(Token): + id = '' + def __init__(self, value, start_mark, end_mark): + self.value = value + self.start_mark = start_mark + self.end_mark = end_mark + +class TagToken(Token): + id = '' + def __init__(self, value, start_mark, end_mark): + self.value = value + self.start_mark = start_mark + self.end_mark = end_mark + +class ScalarToken(Token): + id = '' + def __init__(self, value, plain, start_mark, end_mark, style=None): + self.value = value + self.plain = plain + self.start_mark = start_mark + self.end_mark = end_mark + self.style = style + diff --git a/.openvscode-server/data/CachedExtensions/builtin b/.openvscode-server/data/CachedExtensions/builtin new file mode 100644 index 0000000000000000000000000000000000000000..51bed7340250f09c495360dd784d97a7f8d13c45 --- /dev/null +++ b/.openvscode-server/data/CachedExtensions/builtin @@ -0,0 +1 @@ +{"input":{"location":{"$mid":1,"fsPath":"/home/.openvscode-server/extensions","path":"/home/.openvscode-server/extensions","scheme":"file"},"mtime":1671718430000,"profile":false,"type":0,"excludeObsolete":true,"validate":true,"productVersion":"1.74.2","productDate":"2022-12-22T14:13:42.842Z","productCommit":"e8a3071ea4344d9d48ef8a4df2c097372b0c5161","devMode":false,"language":"en","translations":{}},"result":[{"type":0,"identifier":{"id":"vscode.bat"},"manifest":{"name":"bat","displayName":"Windows Bat Language Basics","description":"Provides snippets, syntax highlighting, bracket matching and folding in Windows batch files.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"^1.52.0"},"scripts":{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin mmims/language-batchfile grammars/batchfile.cson ./syntaxes/batchfile.tmLanguage.json"},"contributes":{"languages":[{"id":"bat","extensions":[".bat",".cmd"],"aliases":["Batch","bat"],"configuration":"./language-configuration.json"}],"grammars":[{"language":"bat","scopeName":"source.batchfile","path":"./syntaxes/batchfile.tmLanguage.json"}],"snippets":[{"language":"bat","path":"./snippets/batchfile.code-snippets"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/bat","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.clojure"},"manifest":{"name":"clojure","displayName":"Clojure Language Basics","description":"Provides syntax highlighting and bracket matching in Clojure files.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"*"},"scripts":{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin atom/language-clojure grammars/clojure.cson ./syntaxes/clojure.tmLanguage.json"},"contributes":{"languages":[{"id":"clojure","aliases":["Clojure","clojure"],"extensions":[".clj",".cljs",".cljc",".cljx",".clojure",".edn"],"configuration":"./language-configuration.json"}],"grammars":[{"language":"clojure","scopeName":"source.clojure","path":"./syntaxes/clojure.tmLanguage.json"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/clojure","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.coffeescript"},"manifest":{"name":"coffeescript","displayName":"CoffeeScript Language Basics","description":"Provides snippets, syntax highlighting, bracket matching and folding in CoffeeScript files.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"*"},"scripts":{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin atom/language-coffee-script grammars/coffeescript.cson ./syntaxes/coffeescript.tmLanguage.json"},"contributes":{"languages":[{"id":"coffeescript","extensions":[".coffee",".cson",".iced"],"aliases":["CoffeeScript","coffeescript","coffee"],"configuration":"./language-configuration.json"}],"grammars":[{"language":"coffeescript","scopeName":"source.coffee","path":"./syntaxes/coffeescript.tmLanguage.json"}],"breakpoints":[{"language":"coffeescript"}],"snippets":[{"language":"coffeescript","path":"./snippets/coffeescript.code-snippets"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/coffeescript","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.configuration-editing"},"manifest":{"name":"configuration-editing","displayName":"Configuration Editing","description":"Provides capabilities (advanced IntelliSense, auto-fixing) in configuration files like settings, launch, and extension recommendation files.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"^1.0.0"},"icon":"images/icon.png","activationEvents":["onLanguage:json","onLanguage:jsonc"],"main":"./dist/configurationEditingMain","browser":"./dist/browser/configurationEditingMain","capabilities":{"virtualWorkspaces":true,"untrustedWorkspaces":{"supported":true}},"contributes":{"languages":[{"id":"jsonc","extensions":[".code-workspace","language-configuration.json","icon-theme.json","color-theme.json",".code-snippets"],"filenames":["settings.json","launch.json","tasks.json","keybindings.json","extensions.json","argv.json","profiles.json","devcontainer.json",".devcontainer.json"],"filenamePatterns":["**/User/snippets/*.json","**/User/profiles/*/snippets/*.json"]},{"id":"json","extensions":[".code-profile"]}],"jsonValidation":[{"fileMatch":"vscode://defaultsettings/keybindings.json","url":"vscode://schemas/keybindings"},{"fileMatch":"%APP_SETTINGS_HOME%/keybindings.json","url":"vscode://schemas/keybindings"},{"fileMatch":"%APP_SETTINGS_HOME%/profiles/*/keybindings.json","url":"vscode://schemas/keybindings"},{"fileMatch":"vscode://defaultsettings/*.json","url":"vscode://schemas/settings/default"},{"fileMatch":"%APP_SETTINGS_HOME%/settings.json","url":"vscode://schemas/settings/user"},{"fileMatch":"%APP_SETTINGS_HOME%/profiles/*/settings.json","url":"vscode://schemas/settings/profile"},{"fileMatch":"%MACHINE_SETTINGS_HOME%/settings.json","url":"vscode://schemas/settings/machine"},{"fileMatch":"%APP_WORKSPACES_HOME%/*/workspace.json","url":"vscode://schemas/workspaceConfig"},{"fileMatch":"**/*.code-workspace","url":"vscode://schemas/workspaceConfig"},{"fileMatch":"**/argv.json","url":"vscode://schemas/argv"},{"fileMatch":"/.vscode/settings.json","url":"vscode://schemas/settings/folder"},{"fileMatch":"/.vscode/launch.json","url":"vscode://schemas/launch"},{"fileMatch":"/.vscode/tasks.json","url":"vscode://schemas/tasks"},{"fileMatch":"%APP_SETTINGS_HOME%/tasks.json","url":"vscode://schemas/tasks"},{"fileMatch":"%APP_SETTINGS_HOME%/snippets/*.json","url":"vscode://schemas/snippets"},{"fileMatch":"%APP_SETTINGS_HOME%/profiles/*/snippets/.json","url":"vscode://schemas/snippets"},{"fileMatch":"%APP_SETTINGS_HOME%/sync/snippets/preview/*.json","url":"vscode://schemas/snippets"},{"fileMatch":"**/*.code-snippets","url":"vscode://schemas/global-snippets"},{"fileMatch":"/.vscode/extensions.json","url":"vscode://schemas/extensions"},{"fileMatch":"devcontainer.json","url":"./schemas/devContainer.schema.generated.json"},{"fileMatch":".devcontainer.json","url":"./schemas/devContainer.schema.generated.json"},{"fileMatch":"%APP_SETTINGS_HOME%/globalStorage/ms-vscode-remote.remote-containers/nameConfigs/*.json","url":"./schemas/attachContainer.schema.json"},{"fileMatch":"%APP_SETTINGS_HOME%/globalStorage/ms-vscode-remote.remote-containers/imageConfigs/*.json","url":"./schemas/attachContainer.schema.json"},{"fileMatch":"**/quality/*/product.json","url":"vscode://schemas/vscode-product"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/configuration-editing","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.cpp"},"manifest":{"name":"cpp","displayName":"C/C++ Language Basics","description":"Provides snippets, syntax highlighting, bracket matching and folding in C/C++ files.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"*"},"scripts":{"update-grammar":"node ./build/update-grammars.js"},"contributes":{"languages":[{"id":"c","extensions":[".c",".i"],"aliases":["C","c"],"configuration":"./language-configuration.json"},{"id":"cpp","extensions":[".cpp",".cc",".cxx",".c++",".hpp",".hh",".hxx",".h++",".h",".ii",".ino",".inl",".ipp",".ixx",".tpp",".txx",".hpp.in",".h.in"],"aliases":["C++","Cpp","cpp"],"configuration":"./language-configuration.json"},{"id":"cuda-cpp","extensions":[".cu",".cuh"],"aliases":["CUDA C++"],"configuration":"./language-configuration.json"}],"grammars":[{"language":"c","scopeName":"source.c","path":"./syntaxes/c.tmLanguage.json"},{"language":"cpp","scopeName":"source.cpp.embedded.macro","path":"./syntaxes/cpp.embedded.macro.tmLanguage.json"},{"language":"cpp","scopeName":"source.cpp","path":"./syntaxes/cpp.tmLanguage.json"},{"scopeName":"source.c.platform","path":"./syntaxes/platform.tmLanguage.json"},{"language":"cuda-cpp","scopeName":"source.cuda-cpp","path":"./syntaxes/cuda-cpp.tmLanguage.json"}],"problemPatterns":[{"name":"nvcc-location","regexp":"^(.*)\\((\\d+)\\):\\s+(warning|error):\\s+(.*)","kind":"location","file":1,"location":2,"severity":3,"message":4}],"problemMatchers":[{"name":"nvcc","owner":"cuda-cpp","fileLocation":["relative","${workspaceFolder}"],"pattern":"$nvcc-location"}],"snippets":[{"language":"c","path":"./snippets/c.code-snippets"},{"language":"cpp","path":"./snippets/cpp.code-snippets"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/cpp","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.csharp"},"manifest":{"name":"csharp","displayName":"C# Language Basics","description":"Provides snippets, syntax highlighting, bracket matching and folding in C# files.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"0.10.x"},"scripts":{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin dotnet/csharp-tmLanguage grammars/csharp.tmLanguage ./syntaxes/csharp.tmLanguage.json"},"contributes":{"configurationDefaults":{"[csharp]":{"editor.maxTokenizationLineLength":2500}},"languages":[{"id":"csharp","extensions":[".cs",".csx",".cake"],"aliases":["C#","csharp"],"configuration":"./language-configuration.json"}],"grammars":[{"language":"csharp","scopeName":"source.cs","path":"./syntaxes/csharp.tmLanguage.json"}],"snippets":[{"language":"csharp","path":"./snippets/csharp.code-snippets"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/csharp","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.css"},"manifest":{"name":"css","displayName":"CSS Language Basics","description":"Provides syntax highlighting and bracket matching for CSS, LESS and SCSS files.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"0.10.x"},"scripts":{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin atom/language-css grammars/css.cson ./syntaxes/css.tmLanguage.json"},"contributes":{"languages":[{"id":"css","aliases":["CSS","css"],"extensions":[".css"],"mimetypes":["text/css"],"configuration":"./language-configuration.json"}],"grammars":[{"language":"css","scopeName":"source.css","path":"./syntaxes/css.tmLanguage.json","tokenTypes":{"meta.function.url string.quoted":"other"}}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/css","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.css-language-features"},"manifest":{"name":"css-language-features","displayName":"CSS Language Features","description":"Provides rich language support for CSS, LESS and SCSS files.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"^1.29.0"},"icon":"icons/css.png","activationEvents":["onLanguage:css","onLanguage:less","onLanguage:scss","onCommand:_css.applyCodeAction"],"main":"./client/dist/node/cssClientMain","browser":"./client/dist/browser/cssClientMain","capabilities":{"virtualWorkspaces":true,"untrustedWorkspaces":{"supported":true}},"categories":["Programming Languages"],"contributes":{"configuration":[{"order":22,"id":"css","title":"CSS","properties":{"css.customData":{"type":"array","markdownDescription":"A list of relative file paths pointing to JSON files following the [custom data format](https://github.com/microsoft/vscode-css-languageservice/blob/master/docs/customData.md).\n\nVS Code loads custom data on startup to enhance its CSS support for the custom CSS properties, at directives, pseudo classes and pseudo elements you specify in the JSON files.\n\nThe file paths are relative to workspace and only workspace folder settings are considered.","default":[],"items":{"type":"string"},"scope":"resource"},"css.completion.triggerPropertyValueCompletion":{"type":"boolean","scope":"resource","default":true,"description":"By default, VS Code triggers property value completion after selecting a CSS property. Use this setting to disable this behavior."},"css.completion.completePropertyWithSemicolon":{"type":"boolean","scope":"resource","default":true,"description":"Insert semicolon at end of line when completing CSS properties."},"css.validate":{"type":"boolean","scope":"resource","default":true,"description":"Enables or disables all validations."},"css.hover.documentation":{"type":"boolean","scope":"resource","default":true,"description":"Show tag and attribute documentation in CSS hovers."},"css.hover.references":{"type":"boolean","scope":"resource","default":true,"description":"Show references to MDN in CSS hovers."},"css.lint.compatibleVendorPrefixes":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"ignore","description":"When using a vendor-specific prefix make sure to also include all other vendor-specific properties."},"css.lint.vendorPrefix":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"warning","description":"When using a vendor-specific prefix, also include the standard property."},"css.lint.duplicateProperties":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"ignore","description":"Do not use duplicate style definitions."},"css.lint.emptyRules":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"warning","description":"Do not use empty rulesets."},"css.lint.importStatement":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"ignore","description":"Import statements do not load in parallel."},"css.lint.boxModel":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"ignore","markdownDescription":"Do not use `width` or `height` when using `padding` or `border`."},"css.lint.universalSelector":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"ignore","markdownDescription":"The universal selector (`*`) is known to be slow."},"css.lint.zeroUnits":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"ignore","description":"No unit for zero needed."},"css.lint.fontFaceProperties":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"warning","markdownDescription":"`@font-face` rule must define `src` and `font-family` properties."},"css.lint.hexColorLength":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"error","description":"Hex colors must consist of three or six hex numbers."},"css.lint.argumentsInColorFunction":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"error","description":"Invalid number of parameters."},"css.lint.unknownProperties":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"warning","description":"Unknown property."},"css.lint.validProperties":{"type":"array","uniqueItems":true,"items":{"type":"string"},"scope":"resource","default":[],"description":"A list of properties that are not validated against the `unknownProperties` rule."},"css.lint.ieHack":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"ignore","description":"IE hacks are only necessary when supporting IE7 and older."},"css.lint.unknownVendorSpecificProperties":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"ignore","description":"Unknown vendor specific property."},"css.lint.propertyIgnoredDueToDisplay":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"warning","markdownDescription":"Property is ignored due to the display. E.g. with `display: inline`, the `width`, `height`, `margin-top`, `margin-bottom`, and `float` properties have no effect."},"css.lint.important":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"ignore","markdownDescription":"Avoid using `!important`. It is an indication that the specificity of the entire CSS has gotten out of control and needs to be refactored."},"css.lint.float":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"ignore","markdownDescription":"Avoid using `float`. Floats lead to fragile CSS that is easy to break if one aspect of the layout changes."},"css.lint.idSelector":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"ignore","description":"Selectors should not contain IDs because these rules are too tightly coupled with the HTML."},"css.lint.unknownAtRules":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"warning","description":"Unknown at-rule."},"css.trace.server":{"type":"string","scope":"window","enum":["off","messages","verbose"],"default":"off","description":"Traces the communication between VS Code and the CSS language server."},"css.format.enable":{"type":"boolean","scope":"window","default":true,"description":"Enable/disable default CSS formatter."},"css.format.newlineBetweenSelectors":{"type":"boolean","scope":"resource","default":true,"markdownDescription":"Separate selectors with a new line."},"css.format.newlineBetweenRules":{"type":"boolean","scope":"resource","default":true,"markdownDescription":"Separate rulesets by a blank line."},"css.format.spaceAroundSelectorSeparator":{"type":"boolean","scope":"resource","default":false,"markdownDescription":"Ensure a space character around selector separators '>', '+', '~' (e.g. `a > b`)."},"css.format.braceStyle":{"type":"string","scope":"resource","default":"collapse","enum":["collapse","expand"],"markdownDescription":"Put braces on the same line as rules (`collapse`) or put braces on own line (`expand`)."},"css.format.preserveNewLines":{"type":"boolean","scope":"resource","default":true,"markdownDescription":"Whether existing line breaks before elements should be preserved."},"css.format.maxPreserveNewLines":{"type":["number","null"],"scope":"resource","default":null,"markdownDescription":"Maximum number of line breaks to be preserved in one chunk, when `#css.format.preserveNewLines#` is enabled."}}},{"id":"scss","order":24,"title":"SCSS (Sass)","properties":{"scss.completion.triggerPropertyValueCompletion":{"type":"boolean","scope":"resource","default":true,"description":"By default, VS Code triggers property value completion after selecting a CSS property. Use this setting to disable this behavior."},"scss.completion.completePropertyWithSemicolon":{"type":"boolean","scope":"resource","default":true,"description":"Insert semicolon at end of line when completing CSS properties."},"scss.validate":{"type":"boolean","scope":"resource","default":true,"description":"Enables or disables all validations."},"scss.hover.documentation":{"type":"boolean","scope":"resource","default":true,"description":"Show tag and attribute documentation in SCSS hovers."},"scss.hover.references":{"type":"boolean","scope":"resource","default":true,"description":"Show references to MDN in SCSS hovers."},"scss.lint.compatibleVendorPrefixes":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"ignore","description":"When using a vendor-specific prefix make sure to also include all other vendor-specific properties."},"scss.lint.vendorPrefix":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"warning","description":"When using a vendor-specific prefix, also include the standard property."},"scss.lint.duplicateProperties":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"ignore","description":"Do not use duplicate style definitions."},"scss.lint.emptyRules":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"warning","description":"Do not use empty rulesets."},"scss.lint.importStatement":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"ignore","description":"Import statements do not load in parallel."},"scss.lint.boxModel":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"ignore","markdownDescription":"Do not use `width` or `height` when using `padding` or `border`."},"scss.lint.universalSelector":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"ignore","markdownDescription":"The universal selector (`*`) is known to be slow."},"scss.lint.zeroUnits":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"ignore","description":"No unit for zero needed."},"scss.lint.fontFaceProperties":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"warning","markdownDescription":"`@font-face` rule must define `src` and `font-family` properties."},"scss.lint.hexColorLength":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"error","description":"Hex colors must consist of three or six hex numbers."},"scss.lint.argumentsInColorFunction":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"error","description":"Invalid number of parameters."},"scss.lint.unknownProperties":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"warning","description":"Unknown property."},"scss.lint.validProperties":{"type":"array","uniqueItems":true,"items":{"type":"string"},"scope":"resource","default":[],"description":"A list of properties that are not validated against the `unknownProperties` rule."},"scss.lint.ieHack":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"ignore","description":"IE hacks are only necessary when supporting IE7 and older."},"scss.lint.unknownVendorSpecificProperties":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"ignore","description":"Unknown vendor specific property."},"scss.lint.propertyIgnoredDueToDisplay":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"warning","markdownDescription":"Property is ignored due to the display. E.g. with `display: inline`, the `width`, `height`, `margin-top`, `margin-bottom`, and `float` properties have no effect."},"scss.lint.important":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"ignore","markdownDescription":"Avoid using `!important`. It is an indication that the specificity of the entire CSS has gotten out of control and needs to be refactored."},"scss.lint.float":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"ignore","markdownDescription":"Avoid using `float`. Floats lead to fragile CSS that is easy to break if one aspect of the layout changes."},"scss.lint.idSelector":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"ignore","description":"Selectors should not contain IDs because these rules are too tightly coupled with the HTML."},"scss.lint.unknownAtRules":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"warning","description":"Unknown at-rule."},"scss.format.enable":{"type":"boolean","scope":"window","default":true,"description":"Enable/disable default SCSS formatter."},"scss.format.newlineBetweenSelectors":{"type":"boolean","scope":"resource","default":true,"markdownDescription":"Separate selectors with a new line."},"scss.format.newlineBetweenRules":{"type":"boolean","scope":"resource","default":true,"markdownDescription":"Separate rulesets by a blank line."},"scss.format.spaceAroundSelectorSeparator":{"type":"boolean","scope":"resource","default":false,"markdownDescription":"Ensure a space character around selector separators '>', '+', '~' (e.g. `a > b`)."},"scss.format.braceStyle":{"type":"string","scope":"resource","default":"collapse","enum":["collapse","expand"],"markdownDescription":"Put braces on the same line as rules (`collapse`) or put braces on own line (`expand`)."},"scss.format.preserveNewLines":{"type":"boolean","scope":"resource","default":true,"markdownDescription":"Whether existing line breaks before elements should be preserved."},"scss.format.maxPreserveNewLines":{"type":["number","null"],"scope":"resource","default":null,"markdownDescription":"Maximum number of line breaks to be preserved in one chunk, when `#scss.format.preserveNewLines#` is enabled."}}},{"id":"less","order":23,"type":"object","title":"LESS","properties":{"less.completion.triggerPropertyValueCompletion":{"type":"boolean","scope":"resource","default":true,"description":"By default, VS Code triggers property value completion after selecting a CSS property. Use this setting to disable this behavior."},"less.completion.completePropertyWithSemicolon":{"type":"boolean","scope":"resource","default":true,"description":"Insert semicolon at end of line when completing CSS properties."},"less.validate":{"type":"boolean","scope":"resource","default":true,"description":"Enables or disables all validations."},"less.hover.documentation":{"type":"boolean","scope":"resource","default":true,"description":"Show tag and attribute documentation in LESS hovers."},"less.hover.references":{"type":"boolean","scope":"resource","default":true,"description":"Show references to MDN in LESS hovers."},"less.lint.compatibleVendorPrefixes":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"ignore","description":"When using a vendor-specific prefix make sure to also include all other vendor-specific properties."},"less.lint.vendorPrefix":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"warning","description":"When using a vendor-specific prefix, also include the standard property."},"less.lint.duplicateProperties":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"ignore","description":"Do not use duplicate style definitions."},"less.lint.emptyRules":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"warning","description":"Do not use empty rulesets."},"less.lint.importStatement":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"ignore","description":"Import statements do not load in parallel."},"less.lint.boxModel":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"ignore","markdownDescription":"Do not use `width` or `height` when using `padding` or `border`."},"less.lint.universalSelector":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"ignore","markdownDescription":"The universal selector (`*`) is known to be slow."},"less.lint.zeroUnits":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"ignore","description":"No unit for zero needed."},"less.lint.fontFaceProperties":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"warning","markdownDescription":"`@font-face` rule must define `src` and `font-family` properties."},"less.lint.hexColorLength":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"error","description":"Hex colors must consist of three or six hex numbers."},"less.lint.argumentsInColorFunction":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"error","description":"Invalid number of parameters."},"less.lint.unknownProperties":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"warning","description":"Unknown property."},"less.lint.validProperties":{"type":"array","uniqueItems":true,"items":{"type":"string"},"scope":"resource","default":[],"description":"A list of properties that are not validated against the `unknownProperties` rule."},"less.lint.ieHack":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"ignore","description":"IE hacks are only necessary when supporting IE7 and older."},"less.lint.unknownVendorSpecificProperties":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"ignore","description":"Unknown vendor specific property."},"less.lint.propertyIgnoredDueToDisplay":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"warning","markdownDescription":"Property is ignored due to the display. E.g. with `display: inline`, the `width`, `height`, `margin-top`, `margin-bottom`, and `float` properties have no effect."},"less.lint.important":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"ignore","markdownDescription":"Avoid using `!important`. It is an indication that the specificity of the entire CSS has gotten out of control and needs to be refactored."},"less.lint.float":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"ignore","markdownDescription":"Avoid using `float`. Floats lead to fragile CSS that is easy to break if one aspect of the layout changes."},"less.lint.idSelector":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"ignore","description":"Selectors should not contain IDs because these rules are too tightly coupled with the HTML."},"less.lint.unknownAtRules":{"type":"string","scope":"resource","enum":["ignore","warning","error"],"default":"warning","description":"Unknown at-rule."},"less.format.enable":{"type":"boolean","scope":"window","default":true,"description":"Enable/disable default LESS formatter."},"less.format.newlineBetweenSelectors":{"type":"boolean","scope":"resource","default":true,"markdownDescription":"Separate selectors with a new line."},"less.format.newlineBetweenRules":{"type":"boolean","scope":"resource","default":true,"markdownDescription":"Separate rulesets by a blank line."},"less.format.spaceAroundSelectorSeparator":{"type":"boolean","scope":"resource","default":false,"markdownDescription":"Ensure a space character around selector separators '>', '+', '~' (e.g. `a > b`)."},"less.format.braceStyle":{"type":"string","scope":"resource","default":"collapse","enum":["collapse","expand"],"markdownDescription":"Put braces on the same line as rules (`collapse`) or put braces on own line (`expand`)."},"less.format.preserveNewLines":{"type":"boolean","scope":"resource","default":true,"markdownDescription":"Whether existing line breaks before elements should be preserved."},"less.format.maxPreserveNewLines":{"type":["number","null"],"scope":"resource","default":null,"markdownDescription":"Maximum number of line breaks to be preserved in one chunk, when `#less.format.preserveNewLines#` is enabled."}}}],"configurationDefaults":{"[css]":{"editor.suggest.insertMode":"replace"},"[scss]":{"editor.suggest.insertMode":"replace"},"[less]":{"editor.suggest.insertMode":"replace"}},"jsonValidation":[{"fileMatch":"*.css-data.json","url":"https://raw.githubusercontent.com/microsoft/vscode-css-languageservice/master/docs/customData.schema.json"},{"fileMatch":"package.json","url":"./schemas/package.schema.json"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/css-language-features","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.dart"},"manifest":{"name":"dart","displayName":"Dart Language Basics","description":"Provides syntax highlighting & bracket matching in Dart files.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"0.10.x"},"scripts":{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin dart-lang/dart-syntax-highlight grammars/dart.json ./syntaxes/dart.tmLanguage.json"},"contributes":{"languages":[{"id":"dart","extensions":[".dart"],"aliases":["Dart"],"configuration":"./language-configuration.json"}],"grammars":[{"language":"dart","scopeName":"source.dart","path":"./syntaxes/dart.tmLanguage.json"}]}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/dart","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.debug-auto-launch"},"manifest":{"name":"debug-auto-launch","displayName":"Node Debug Auto-attach","description":"Helper for auto-attach feature when node-debug extensions are not active.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"^1.5.0"},"icon":"media/icon.png","capabilities":{"virtualWorkspaces":false,"untrustedWorkspaces":{"supported":true}},"activationEvents":["onStartupFinished"],"main":"./dist/extension","contributes":{"commands":[{"command":"extension.node-debug.toggleAutoAttach","title":"Toggle Auto Attach","category":"Debug"}]},"prettier":{"printWidth":100,"trailingComma":"all","singleQuote":true,"arrowParens":"avoid"},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/debug-auto-launch","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.debug-server-ready"},"manifest":{"name":"debug-server-ready","displayName":"Server Ready Action","description":"Open URI in browser if server under debugging is ready.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"^1.32.0"},"icon":"media/icon.png","activationEvents":["onDebugResolve"],"capabilities":{"virtualWorkspaces":false,"untrustedWorkspaces":{"supported":true}},"enabledApiProposals":["terminalDataWriteEvent"],"main":"./dist/extension","contributes":{"debuggers":[{"type":"*","configurationAttributes":{"launch":{"properties":{"serverReadyAction":{"oneOf":[{"type":"object","additionalProperties":false,"markdownDescription":"Act upon a URI when a server program under debugging is ready (indicated by sending output of the form 'listening on port 3000' or 'Now listening on: https://localhost:5001' to the debug console.)","default":{"action":"openExternally","killOnServerStop":false},"properties":{"action":{"type":"string","enum":["openExternally"],"enumDescriptions":["Open URI externally with the default application."],"markdownDescription":"What to do with the URI when the server is ready.","default":"openExternally"},"pattern":{"type":"string","markdownDescription":"Server is ready if this pattern appears on the debug console. The first capture group must include a URI or a port number.","default":"listening on port ([0-9]+)"},"uriFormat":{"type":"string","markdownDescription":"A format string used when constructing the URI from a port number. The first '%s' is substituted with the port number.","default":"http://localhost:%s"},"killOnServerStop":{"type":"boolean","markdownDescription":"Stop the child session when the parent session stopped.","default":false}}},{"type":"object","additionalProperties":false,"markdownDescription":"Act upon a URI when a server program under debugging is ready (indicated by sending output of the form 'listening on port 3000' or 'Now listening on: https://localhost:5001' to the debug console.)","default":{"action":"debugWithEdge","pattern":"listening on port ([0-9]+)","uriFormat":"http://localhost:%s","webRoot":"${workspaceFolder}","killOnServerStop":false},"properties":{"action":{"type":"string","enum":["debugWithChrome","debugWithEdge"],"enumDescriptions":["Start debugging with the 'Debugger for Chrome'."],"markdownDescription":"What to do with the URI when the server is ready.","default":"debugWithEdge"},"pattern":{"type":"string","markdownDescription":"Server is ready if this pattern appears on the debug console. The first capture group must include a URI or a port number.","default":"listening on port ([0-9]+)"},"uriFormat":{"type":"string","markdownDescription":"A format string used when constructing the URI from a port number. The first '%s' is substituted with the port number.","default":"http://localhost:%s"},"webRoot":{"type":"string","markdownDescription":"Value passed to the debug configuration for the 'Debugger for Chrome'.","default":"${workspaceFolder}"},"killOnServerStop":{"type":"boolean","markdownDescription":"Stop the child session when the parent session stopped.","default":false}}},{"type":"object","additionalProperties":false,"markdownDescription":"Act upon a URI when a server program under debugging is ready (indicated by sending output of the form 'listening on port 3000' or 'Now listening on: https://localhost:5001' to the debug console.)","default":{"action":"startDebugging","name":"","killOnServerStop":false},"required":["name"],"properties":{"action":{"type":"string","enum":["startDebugging"],"enumDescriptions":["Run another launch configuration."],"markdownDescription":"What to do with the URI when the server is ready.","default":"startDebugging"},"pattern":{"type":"string","markdownDescription":"Server is ready if this pattern appears on the debug console. The first capture group must include a URI or a port number.","default":"listening on port ([0-9]+)"},"name":{"type":"string","markdownDescription":"Name of the launch configuration to run.","default":"Launch Browser"},"killOnServerStop":{"type":"boolean","markdownDescription":"Stop the child session when the parent session stopped.","default":false}}}]}}}}}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/debug-server-ready","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.diff"},"manifest":{"name":"diff","displayName":"Diff Language Basics","description":"Provides syntax highlighting & bracket matching in Diff files.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"0.10.x"},"scripts":{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin textmate/diff.tmbundle Syntaxes/Diff.plist ./syntaxes/diff.tmLanguage.json"},"contributes":{"languages":[{"id":"diff","aliases":["Diff","diff"],"extensions":[".diff",".patch",".rej"],"configuration":"./language-configuration.json"}],"grammars":[{"language":"diff","scopeName":"source.diff","path":"./syntaxes/diff.tmLanguage.json"}]}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/diff","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.docker"},"manifest":{"name":"docker","displayName":"Docker Language Basics","description":"Provides syntax highlighting and bracket matching in Docker files.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"*"},"scripts":{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin moby/moby contrib/syntax/textmate/Docker.tmbundle/Syntaxes/Dockerfile.tmLanguage ./syntaxes/docker.tmLanguage.json"},"contributes":{"languages":[{"id":"dockerfile","extensions":[".dockerfile",".containerfile"],"filenames":["Dockerfile","Containerfile"],"filenamePatterns":["Dockerfile.*","Containerfile.*"],"aliases":["Docker","Dockerfile","Containerfile"],"configuration":"./language-configuration.json"}],"grammars":[{"language":"dockerfile","scopeName":"source.dockerfile","path":"./syntaxes/docker.tmLanguage.json"}],"configurationDefaults":{"[dockerfile]":{"editor.quickSuggestions":{"strings":true}}}},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/docker","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.emmet"},"manifest":{"name":"emmet","displayName":"Emmet","description":"Emmet support for VS Code","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"^1.13.0"},"icon":"images/icon.png","categories":["Other"],"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"},"activationEvents":["onCommand:emmet.expandAbbreviation","onCommand:editor.emmet.action.wrapWithAbbreviation","onCommand:editor.emmet.action.removeTag","onCommand:editor.emmet.action.updateTag","onCommand:editor.emmet.action.matchTag","onCommand:editor.emmet.action.balanceIn","onCommand:editor.emmet.action.balanceOut","onCommand:editor.emmet.action.prevEditPoint","onCommand:editor.emmet.action.nextEditPoint","onCommand:editor.emmet.action.mergeLines","onCommand:editor.emmet.action.selectPrevItem","onCommand:editor.emmet.action.selectNextItem","onCommand:editor.emmet.action.splitJoinTag","onCommand:editor.emmet.action.toggleComment","onCommand:editor.emmet.action.evaluateMathExpression","onCommand:editor.emmet.action.updateImageSize","onCommand:editor.emmet.action.incrementNumberByOneTenth","onCommand:editor.emmet.action.incrementNumberByOne","onCommand:editor.emmet.action.incrementNumberByTen","onCommand:editor.emmet.action.decrementNumberByOneTenth","onCommand:editor.emmet.action.decrementNumberByOne","onCommand:editor.emmet.action.decrementNumberByTen","onCommand:editor.emmet.action.reflectCSSValue","onCommand:workbench.action.showEmmetCommands","onStartupFinished"],"main":"./dist/node/emmetNodeMain","browser":"./dist/browser/emmetBrowserMain","contributes":{"configuration":{"type":"object","title":"Emmet","properties":{"emmet.showExpandedAbbreviation":{"type":["string"],"enum":["never","always","inMarkupAndStylesheetFilesOnly"],"default":"always","markdownDescription":"Shows expanded Emmet abbreviations as suggestions.\nThe option `\"inMarkupAndStylesheetFilesOnly\"` applies to html, haml, jade, slim, xml, xsl, css, scss, sass, less and stylus.\nThe option `\"always\"` applies to all parts of the file regardless of markup/css."},"emmet.showAbbreviationSuggestions":{"type":"boolean","default":true,"scope":"language-overridable","markdownDescription":"Shows possible Emmet abbreviations as suggestions. Not applicable in stylesheets or when emmet.showExpandedAbbreviation is set to `\"never\"`."},"emmet.includeLanguages":{"type":"object","additionalProperties":{"type":"string"},"default":{},"markdownDescription":"Enable Emmet abbreviations in languages that are not supported by default. Add a mapping here between the language and Emmet supported language.\n For example: `{\"vue-html\": \"html\", \"javascript\": \"javascriptreact\"}`"},"emmet.variables":{"type":"object","properties":{"lang":{"type":"string","default":"en"},"charset":{"type":"string","default":"UTF-8"}},"additionalProperties":{"type":"string"},"default":{},"markdownDescription":"Variables to be used in Emmet snippets."},"emmet.syntaxProfiles":{"type":"object","default":{},"markdownDescription":"Define profile for specified syntax or use your own profile with specific rules."},"emmet.excludeLanguages":{"type":"array","items":{"type":"string"},"default":["markdown"],"markdownDescription":"An array of languages where Emmet abbreviations should not be expanded."},"emmet.extensionsPath":{"type":"array","items":{"type":"string","markdownDescription":"A path containing Emmet syntaxProfiles and/or snippets."},"default":[],"scope":"machine-overridable","markdownDescription":"An array of paths, where each path can contain Emmet syntaxProfiles and/or snippet files.\nIn case of conflicts, the profiles/snippets of later paths will override those of earlier paths.\nSee https://code.visualstudio.com/docs/editor/emmet for more information and an example snippet file."},"emmet.triggerExpansionOnTab":{"type":"boolean","default":false,"scope":"language-overridable","markdownDescription":"When enabled, Emmet abbreviations are expanded when pressing TAB, even when completions do not show up. When disabled, completions that show up can still be accepted by pressing TAB."},"emmet.useInlineCompletions":{"type":"boolean","default":false,"markdownDescription":"If `true`, Emmet will use inline completions to suggest expansions. To prevent the non-inline completion item provider from showing up as often while this setting is `true`, turn `#editor.quickSuggestions#` to `inline` or `off` for the `other` item."},"emmet.preferences":{"type":"object","default":{},"markdownDescription":"Preferences used to modify behavior of some actions and resolvers of Emmet.","properties":{"css.intUnit":{"type":"string","default":"px","markdownDescription":"Default unit for integer values."},"css.floatUnit":{"type":"string","default":"em","markdownDescription":"Default unit for float values."},"css.propertyEnd":{"type":"string","default":";","markdownDescription":"Symbol to be placed at the end of CSS property when expanding CSS abbreviations."},"sass.propertyEnd":{"type":"string","default":"","markdownDescription":"Symbol to be placed at the end of CSS property when expanding CSS abbreviations in Sass files."},"stylus.propertyEnd":{"type":"string","default":"","markdownDescription":"Symbol to be placed at the end of CSS property when expanding CSS abbreviations in Stylus files."},"css.valueSeparator":{"type":"string","default":": ","markdownDescription":"Symbol to be placed at the between CSS property and value when expanding CSS abbreviations."},"sass.valueSeparator":{"type":"string","default":": ","markdownDescription":"Symbol to be placed at the between CSS property and value when expanding CSS abbreviations in Sass files."},"stylus.valueSeparator":{"type":"string","default":" ","markdownDescription":"Symbol to be placed at the between CSS property and value when expanding CSS abbreviations in Stylus files."},"bem.elementSeparator":{"type":"string","default":"__","markdownDescription":"Element separator used for classes when using the BEM filter."},"bem.modifierSeparator":{"type":"string","default":"_","markdownDescription":"Modifier separator used for classes when using the BEM filter."},"filter.commentBefore":{"type":"string","default":"","markdownDescription":"A definition of comment that should be placed before matched element when comment filter is applied."},"filter.commentAfter":{"type":"string","default":"\n","markdownDescription":"A definition of comment that should be placed after matched element when comment filter is applied."},"filter.commentTrigger":{"type":"array","default":["id","class"],"markdownDescription":"A comma-separated list of attribute names that should exist in the abbreviation for the comment filter to be applied."},"format.noIndentTags":{"type":"array","default":["html"],"markdownDescription":"An array of tag names that should never get inner indentation."},"format.forceIndentationForTags":{"type":"array","default":["body"],"markdownDescription":"An array of tag names that should always get inner indentation."},"profile.allowCompactBoolean":{"type":"boolean","default":false,"markdownDescription":"If `true`, compact notation of boolean attributes are produced."},"css.webkitProperties":{"type":"string","default":null,"markdownDescription":"Comma separated CSS properties that get the 'webkit' vendor prefix when used in Emmet abbreviation that starts with `-`. Set to empty string to always avoid the 'webkit' prefix."},"css.mozProperties":{"type":"string","default":null,"markdownDescription":"Comma separated CSS properties that get the 'moz' vendor prefix when used in Emmet abbreviation that starts with `-`. Set to empty string to always avoid the 'moz' prefix."},"css.oProperties":{"type":"string","default":null,"markdownDescription":"Comma separated CSS properties that get the 'o' vendor prefix when used in Emmet abbreviation that starts with `-`. Set to empty string to always avoid the 'o' prefix."},"css.msProperties":{"type":"string","default":null,"markdownDescription":"Comma separated CSS properties that get the 'ms' vendor prefix when used in Emmet abbreviation that starts with `-`. Set to empty string to always avoid the 'ms' prefix."},"css.fuzzySearchMinScore":{"type":"number","default":0.3,"markdownDescription":"The minimum score (from 0 to 1) that fuzzy-matched abbreviation should achieve. Lower values may produce many false-positive matches, higher values may reduce possible matches."},"output.inlineBreak":{"type":"number","default":0,"markdownDescription":"The number of sibling inline elements needed for line breaks to be placed between those elements. If `0`, inline elements are always expanded onto a single line."},"output.reverseAttributes":{"type":"boolean","default":false,"markdownDescription":"If `true`, reverses attribute merging directions when resolving snippets."},"output.selfClosingStyle":{"type":"string","enum":["html","xhtml","xml"],"default":"html","markdownDescription":"Style of self-closing tags: html (`
`), xml (`
`) or xhtml (`
`)."},"css.color.short":{"type":"boolean","default":true,"markdownDescription":"If `true`, color values like `#f` will be expanded to `#fff` instead of `#ffffff`."}}},"emmet.showSuggestionsAsSnippets":{"type":"boolean","default":false,"markdownDescription":"If `true`, then Emmet suggestions will show up as snippets allowing you to order them as per `#editor.snippetSuggestions#` setting."},"emmet.optimizeStylesheetParsing":{"type":"boolean","default":true,"markdownDescription":"When set to `false`, the whole file is parsed to determine if current position is valid for expanding Emmet abbreviations. When set to `true`, only the content around the current position in CSS/SCSS/Less files is parsed."}}},"commands":[{"command":"editor.emmet.action.wrapWithAbbreviation","title":"Wrap with Abbreviation","category":"Emmet"},{"command":"editor.emmet.action.removeTag","title":"Remove Tag","category":"Emmet"},{"command":"editor.emmet.action.updateTag","title":"Update Tag","category":"Emmet"},{"command":"editor.emmet.action.matchTag","title":"Go to Matching Pair","category":"Emmet"},{"command":"editor.emmet.action.balanceIn","title":"Balance (inward)","category":"Emmet"},{"command":"editor.emmet.action.balanceOut","title":"Balance (outward)","category":"Emmet"},{"command":"editor.emmet.action.prevEditPoint","title":"Go to Previous Edit Point","category":"Emmet"},{"command":"editor.emmet.action.nextEditPoint","title":"Go to Next Edit Point","category":"Emmet"},{"command":"editor.emmet.action.mergeLines","title":"Merge Lines","category":"Emmet"},{"command":"editor.emmet.action.selectPrevItem","title":"Select Previous Item","category":"Emmet"},{"command":"editor.emmet.action.selectNextItem","title":"Select Next Item","category":"Emmet"},{"command":"editor.emmet.action.splitJoinTag","title":"Split/Join Tag","category":"Emmet"},{"command":"editor.emmet.action.toggleComment","title":"Toggle Comment","category":"Emmet"},{"command":"editor.emmet.action.evaluateMathExpression","title":"Evaluate Math Expression","category":"Emmet"},{"command":"editor.emmet.action.updateImageSize","title":"Update Image Size","category":"Emmet"},{"command":"editor.emmet.action.incrementNumberByOneTenth","title":"Increment by 0.1","category":"Emmet"},{"command":"editor.emmet.action.incrementNumberByOne","title":"Increment by 1","category":"Emmet"},{"command":"editor.emmet.action.incrementNumberByTen","title":"Increment by 10","category":"Emmet"},{"command":"editor.emmet.action.decrementNumberByOneTenth","title":"Decrement by 0.1","category":"Emmet"},{"command":"editor.emmet.action.decrementNumberByOne","title":"Decrement by 1","category":"Emmet"},{"command":"editor.emmet.action.decrementNumberByTen","title":"Decrement by 10","category":"Emmet"},{"command":"editor.emmet.action.reflectCSSValue","title":"Reflect CSS Value","category":"Emmet"},{"command":"workbench.action.showEmmetCommands","title":"Show Emmet Commands","category":""}],"menus":{"commandPalette":[{"command":"editor.emmet.action.wrapWithAbbreviation","when":"!activeEditorIsReadonly"},{"command":"editor.emmet.action.removeTag","when":"!activeEditorIsReadonly"},{"command":"editor.emmet.action.updateTag","when":"!activeEditorIsReadonly"},{"command":"editor.emmet.action.matchTag","when":"!activeEditorIsReadonly"},{"command":"editor.emmet.action.balanceIn","when":"!activeEditorIsReadonly"},{"command":"editor.emmet.action.balanceOut","when":"!activeEditorIsReadonly"},{"command":"editor.emmet.action.prevEditPoint","when":"!activeEditorIsReadonly"},{"command":"editor.emmet.action.nextEditPoint","when":"!activeEditorIsReadonly"},{"command":"editor.emmet.action.mergeLines","when":"!activeEditorIsReadonly"},{"command":"editor.emmet.action.selectPrevItem","when":"!activeEditorIsReadonly"},{"command":"editor.emmet.action.selectNextItem","when":"!activeEditorIsReadonly"},{"command":"editor.emmet.action.splitJoinTag","when":"!activeEditorIsReadonly"},{"command":"editor.emmet.action.toggleComment","when":"!activeEditorIsReadonly"},{"command":"editor.emmet.action.evaluateMathExpression","when":"!activeEditorIsReadonly"},{"command":"editor.emmet.action.updateImageSize","when":"!activeEditorIsReadonly"},{"command":"editor.emmet.action.incrementNumberByOneTenth","when":"!activeEditorIsReadonly"},{"command":"editor.emmet.action.incrementNumberByOne","when":"!activeEditorIsReadonly"},{"command":"editor.emmet.action.incrementNumberByTen","when":"!activeEditorIsReadonly"},{"command":"editor.emmet.action.decrementNumberByOneTenth","when":"!activeEditorIsReadonly"},{"command":"editor.emmet.action.decrementNumberByOne","when":"!activeEditorIsReadonly"},{"command":"editor.emmet.action.decrementNumberByTen","when":"!activeEditorIsReadonly"},{"command":"editor.emmet.action.reflectCSSValue","when":"!activeEditorIsReadonly"}]}},"capabilities":{"virtualWorkspaces":true,"untrustedWorkspaces":{"supported":true}}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/emmet","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.extension-editing"},"manifest":{"name":"extension-editing","displayName":"Extension Authoring","description":"Provides linting capabilities for authoring extensions.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"^1.4.0"},"icon":"images/icon.png","activationEvents":["onLanguage:json","onLanguage:markdown"],"main":"./dist/extensionEditingMain","browser":"./dist/browser/extensionEditingBrowserMain","capabilities":{"virtualWorkspaces":true,"untrustedWorkspaces":{"supported":true}},"contributes":{"jsonValidation":[{"fileMatch":"package.json","url":"vscode://schemas/vscode-extensions"},{"fileMatch":"*language-configuration.json","url":"vscode://schemas/language-configuration"},{"fileMatch":["*icon-theme.json","!*product-icon-theme.json"],"url":"vscode://schemas/icon-theme"},{"fileMatch":"*product-icon-theme.json","url":"vscode://schemas/product-icon-theme"},{"fileMatch":"*color-theme.json","url":"vscode://schemas/color-theme"}],"languages":[{"id":"ignore","filenames":[".vscodeignore"]}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/extension-editing","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.fsharp"},"manifest":{"name":"fsharp","displayName":"F# Language Basics","description":"Provides snippets, syntax highlighting, bracket matching and folding in F# files.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"*"},"scripts":{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin ionide/ionide-fsgrammar grammars/fsharp.json ./syntaxes/fsharp.tmLanguage.json"},"contributes":{"languages":[{"id":"fsharp","extensions":[".fs",".fsi",".fsx",".fsscript"],"aliases":["F#","FSharp","fsharp"],"configuration":"./language-configuration.json"}],"grammars":[{"language":"fsharp","scopeName":"source.fsharp","path":"./syntaxes/fsharp.tmLanguage.json"}],"snippets":[{"language":"fsharp","path":"./snippets/fsharp.code-snippets"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/fsharp","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.git"},"manifest":{"name":"git","displayName":"Git","description":"Git SCM Integration","publisher":"vscode","license":"MIT","version":"1.0.0","engines":{"vscode":"^1.5.0"},"aiKey":"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255","enabledApiProposals":["telemetryLogger","diffCommand","contribEditorContentMenu","contribViewsWelcome","editSessionIdentityProvider","scmActionButton","scmSelectedProvider","scmValidation","tabInputTextMerge","timeline","contribMergeEditorMenus"],"categories":["Other"],"activationEvents":["*","onEditSession:file","onFileSystem:git","onFileSystem:git-show"],"extensionDependencies":["vscode.git-base"],"main":"./dist/main","icon":"resources/icons/git.png","capabilities":{"virtualWorkspaces":true,"untrustedWorkspaces":{"supported":false}},"contributes":{"commands":[{"command":"git.clone","title":"Clone","category":"Git"},{"command":"git.cloneRecursive","title":"Clone (Recursive)","category":"Git"},{"command":"git.init","title":"Initialize Repository","category":"Git","icon":"$(add)"},{"command":"git.openRepository","title":"Open Repository","category":"Git"},{"command":"git.close","title":"Close Repository","category":"Git"},{"command":"git.refresh","title":"Refresh","category":"Git","icon":"$(refresh)"},{"command":"git.openChange","title":"Open Changes","category":"Git","icon":"$(compare-changes)"},{"command":"git.openAllChanges","title":"Open All Changes","category":"Git"},{"command":"git.openFile","title":"Open File","category":"Git","icon":"$(go-to-file)"},{"command":"git.openFile2","title":"Open File","category":"Git","icon":"$(go-to-file)"},{"command":"git.openHEADFile","title":"Open File (HEAD)","category":"Git"},{"command":"git.stage","title":"Stage Changes","category":"Git","icon":"$(add)"},{"command":"git.stageAll","title":"Stage All Changes","category":"Git","icon":"$(add)"},{"command":"git.stageAllTracked","title":"Stage All Tracked Changes","category":"Git","icon":"$(add)"},{"command":"git.stageAllUntracked","title":"Stage All Untracked Changes","category":"Git","icon":"$(add)"},{"command":"git.stageAllMerge","title":"Stage All Merge Changes","category":"Git","icon":"$(add)"},{"command":"git.stageSelectedRanges","title":"Stage Selected Ranges","category":"Git"},{"command":"git.revertSelectedRanges","title":"Revert Selected Ranges","category":"Git"},{"command":"git.stageChange","title":"Stage Change","category":"Git","icon":"$(add)"},{"command":"git.revertChange","title":"Revert Change","category":"Git","icon":"$(discard)"},{"command":"git.unstage","title":"Unstage Changes","category":"Git","icon":"$(remove)"},{"command":"git.unstageAll","title":"Unstage All Changes","category":"Git","icon":"$(remove)"},{"command":"git.unstageSelectedRanges","title":"Unstage Selected Ranges","category":"Git"},{"command":"git.clean","title":"Discard Changes","category":"Git","icon":"$(discard)"},{"command":"git.cleanAll","title":"Discard All Changes","category":"Git","icon":"$(discard)"},{"command":"git.cleanAllTracked","title":"Discard All Tracked Changes","category":"Git","icon":"$(discard)"},{"command":"git.cleanAllUntracked","title":"Discard All Untracked Changes","category":"Git","icon":"$(discard)"},{"command":"git.rename","title":"Rename","category":"Git","icon":"$(discard)"},{"command":"git.commit","title":"Commit","category":"Git","icon":"$(check)","enablement":"!commitInProgress"},{"command":"git.commitStaged","title":"Commit Staged","category":"Git","enablement":"!commitInProgress"},{"command":"git.commitEmpty","title":"Commit Empty","category":"Git","enablement":"!commitInProgress"},{"command":"git.commitStagedSigned","title":"Commit Staged (Signed Off)","category":"Git","enablement":"!commitInProgress"},{"command":"git.commitStagedAmend","title":"Commit Staged (Amend)","category":"Git","enablement":"!commitInProgress"},{"command":"git.commitAll","title":"Commit All","category":"Git","enablement":"!commitInProgress"},{"command":"git.commitAllSigned","title":"Commit All (Signed Off)","category":"Git","enablement":"!commitInProgress"},{"command":"git.commitAllAmend","title":"Commit All (Amend)","category":"Git","enablement":"!commitInProgress"},{"command":"git.commitNoVerify","title":"Commit (No Verify)","category":"Git","icon":"$(check)","enablement":"!commitInProgress"},{"command":"git.commitStagedNoVerify","title":"Commit Staged (No Verify)","category":"Git","enablement":"!commitInProgress"},{"command":"git.commitEmptyNoVerify","title":"Commit Empty (No Verify)","category":"Git","enablement":"!commitInProgress"},{"command":"git.commitStagedSignedNoVerify","title":"Commit Staged (Signed Off, No Verify)","category":"Git","enablement":"!commitInProgress"},{"command":"git.commitStagedAmendNoVerify","title":"Commit Staged (Amend, No Verify)","category":"Git","enablement":"!commitInProgress"},{"command":"git.commitAllNoVerify","title":"Commit All (No Verify)","category":"Git","enablement":"!commitInProgress"},{"command":"git.commitAllSignedNoVerify","title":"Commit All (Signed Off, No Verify)","category":"Git","enablement":"!commitInProgress"},{"command":"git.commitAllAmendNoVerify","title":"Commit All (Amend, No Verify)","category":"Git","enablement":"!commitInProgress"},{"command":"git.commitMessageAccept","title":"Accept Commit Message","icon":"$(check)","category":"Git"},{"command":"git.commitMessageDiscard","title":"Discard Commit Message","icon":"$(discard)","category":"Git"},{"command":"git.restoreCommitTemplate","title":"Restore Commit Template","category":"Git"},{"command":"git.undoCommit","title":"Undo Last Commit","category":"Git","enablement":"!commitInProgress"},{"command":"git.checkout","title":"Checkout to...","category":"Git"},{"command":"git.checkoutDetached","title":"Checkout to (Detached)...","category":"Git"},{"command":"git.branch","title":"Create Branch...","category":"Git"},{"command":"git.branchFrom","title":"Create Branch From...","category":"Git"},{"command":"git.deleteBranch","title":"Delete Branch...","category":"Git"},{"command":"git.renameBranch","title":"Rename Branch...","category":"Git"},{"command":"git.merge","title":"Merge Branch...","category":"Git"},{"command":"git.mergeAbort","title":"Abort Merge","category":"Git"},{"command":"git.rebase","title":"Rebase Branch...","category":"Git"},{"command":"git.createTag","title":"Create Tag","category":"Git"},{"command":"git.deleteTag","title":"Delete Tag","category":"Git"},{"command":"git.fetch","title":"Fetch","category":"Git"},{"command":"git.fetchPrune","title":"Fetch (Prune)","category":"Git"},{"command":"git.fetchAll","title":"Fetch From All Remotes","category":"Git"},{"command":"git.pull","title":"Pull","category":"Git"},{"command":"git.pullRebase","title":"Pull (Rebase)","category":"Git"},{"command":"git.pullFrom","title":"Pull from...","category":"Git"},{"command":"git.push","title":"Push","category":"Git"},{"command":"git.pushForce","title":"Push (Force)","category":"Git"},{"command":"git.pushTo","title":"Push to...","category":"Git"},{"command":"git.pushToForce","title":"Push to... (Force)","category":"Git"},{"command":"git.pushTags","title":"Push Tags","category":"Git"},{"command":"git.pushWithTags","title":"Push (Follow Tags)","category":"Git"},{"command":"git.pushWithTagsForce","title":"Push (Follow Tags, Force)","category":"Git"},{"command":"git.cherryPick","title":"Cherry Pick...","category":"Git"},{"command":"git.addRemote","title":"Add Remote...","category":"Git"},{"command":"git.removeRemote","title":"Remove Remote","category":"Git"},{"command":"git.sync","title":"Sync","category":"Git"},{"command":"git.syncRebase","title":"Sync (Rebase)","category":"Git"},{"command":"git.publish","title":"Publish Branch...","category":"Git"},{"command":"git.showOutput","title":"Show Git Output","category":"Git"},{"command":"git.ignore","title":"Add to .gitignore","category":"Git"},{"command":"git.revealInExplorer","title":"Reveal in Explorer View","category":"Git"},{"command":"git.revealFileInOS.linux","title":"Open Containing Folder","category":"Git"},{"command":"git.revealFileInOS.mac","title":"Reveal in Finder","category":"Git"},{"command":"git.revealFileInOS.windows","title":"Reveal in File Explorer","category":"Git"},{"command":"git.stashIncludeUntracked","title":"Stash (Include Untracked)","category":"Git"},{"command":"git.stash","title":"Stash","category":"Git"},{"command":"git.stashPop","title":"Pop Stash...","category":"Git"},{"command":"git.stashPopLatest","title":"Pop Latest Stash","category":"Git"},{"command":"git.stashApply","title":"Apply Stash...","category":"Git"},{"command":"git.stashApplyLatest","title":"Apply Latest Stash","category":"Git"},{"command":"git.stashDrop","title":"Drop Stash...","category":"Git"},{"command":"git.stashDropAll","title":"Drop All Stashes...","category":"Git"},{"command":"git.timeline.openDiff","title":"Open Changes","icon":"$(compare-changes)","category":"Git"},{"command":"git.timeline.copyCommitId","title":"Copy Commit ID","category":"Git"},{"command":"git.timeline.copyCommitMessage","title":"Copy Commit Message","category":"Git"},{"command":"git.timeline.selectForCompare","title":"Select for Compare","category":"Git"},{"command":"git.timeline.compareWithSelected","title":"Compare with Selected","category":"Git"},{"command":"git.rebaseAbort","title":"Abort Rebase","category":"Git"},{"command":"git.closeAllDiffEditors","title":"Close All Diff Editors","category":"Git"},{"command":"git.api.getRepositories","title":"Get Repositories","category":"Git API"},{"command":"git.api.getRepositoryState","title":"Get Repository State","category":"Git API"},{"command":"git.api.getRemoteSources","title":"Get Remote Sources","category":"Git API"},{"command":"git.acceptMerge","title":"Complete Merge","category":"Git","enablement":"isMergeEditor && mergeEditorResultUri in git.mergeChanges"},{"command":"git.openMergeEditor","title":"Resolve in Merge Editor","category":"Git"},{"command":"git.runGitMerge","title":"Compute Conflicts With Git","category":"Git","enablement":"isMergeEditor"},{"command":"git.runGitMergeDiff3","title":"Compute Conflicts With Git (Diff3)","category":"Git","enablement":"isMergeEditor"},{"command":"git.manageUnsafeRepositories","title":"Manage Unsafe Repositories","category":"Git"}],"keybindings":[{"command":"git.stageSelectedRanges","key":"ctrl+k ctrl+alt+s","mac":"cmd+k cmd+alt+s","when":"isInDiffEditor"},{"command":"git.unstageSelectedRanges","key":"ctrl+k ctrl+n","mac":"cmd+k cmd+n","when":"isInDiffEditor"},{"command":"git.revertSelectedRanges","key":"ctrl+k ctrl+r","mac":"cmd+k cmd+r","when":"isInDiffEditor"}],"menus":{"commandPalette":[{"command":"git.clone","when":"config.git.enabled && !git.missing"},{"command":"git.cloneRecursive","when":"config.git.enabled && !git.missing"},{"command":"git.init","when":"config.git.enabled && !git.missing && remoteName != 'codespaces'"},{"command":"git.openRepository","when":"config.git.enabled && !git.missing"},{"command":"git.close","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.refresh","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.openFile","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0 && resourceScheme == file && scmActiveResourceHasChanges"},{"command":"git.openHEADFile","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0 && resourceScheme == file && scmActiveResourceHasChanges"},{"command":"git.openChange","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.stage","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.stageAll","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.stageAllTracked","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.stageAllUntracked","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.stageAllMerge","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.stageSelectedRanges","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.stageChange","when":"false"},{"command":"git.revertSelectedRanges","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.revertChange","when":"false"},{"command":"git.openFile2","when":"false"},{"command":"git.unstage","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.unstageAll","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.unstageSelectedRanges","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.clean","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.cleanAll","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.cleanAllTracked","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.cleanAllUntracked","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.rename","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0 && resourceScheme == file && scmActiveResourceRepository"},{"command":"git.commit","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.commitStaged","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.commitEmpty","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.commitStagedSigned","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.commitStagedAmend","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.commitAll","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.commitAllSigned","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.commitAllAmend","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.rebaseAbort","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0 && gitRebaseInProgress"},{"command":"git.commitNoVerify","when":"config.git.enabled && !git.missing && config.git.allowNoVerifyCommit && gitOpenRepositoryCount != 0"},{"command":"git.commitStagedNoVerify","when":"config.git.enabled && !git.missing && config.git.allowNoVerifyCommit && gitOpenRepositoryCount != 0"},{"command":"git.commitEmptyNoVerify","when":"config.git.enabled && !git.missing && config.git.allowNoVerifyCommit && gitOpenRepositoryCount != 0"},{"command":"git.commitStagedSignedNoVerify","when":"config.git.enabled && !git.missing && config.git.allowNoVerifyCommit && gitOpenRepositoryCount != 0"},{"command":"git.commitStagedAmendNoVerify","when":"config.git.enabled && !git.missing && config.git.allowNoVerifyCommit && gitOpenRepositoryCount != 0"},{"command":"git.commitAllNoVerify","when":"config.git.enabled && !git.missing && config.git.allowNoVerifyCommit && gitOpenRepositoryCount != 0"},{"command":"git.commitAllSignedNoVerify","when":"config.git.enabled && !git.missing && config.git.allowNoVerifyCommit && gitOpenRepositoryCount != 0"},{"command":"git.commitAllAmendNoVerify","when":"config.git.enabled && !git.missing && config.git.allowNoVerifyCommit && gitOpenRepositoryCount != 0"},{"command":"git.restoreCommitTemplate","when":"false"},{"command":"git.commitMessageAccept","when":"false"},{"command":"git.commitMessageDiscard","when":"false"},{"command":"git.revealInExplorer","when":"false"},{"command":"git.revealFileInOS.linux","when":"false"},{"command":"git.revealFileInOS.mac","when":"false"},{"command":"git.revealFileInOS.windows","when":"false"},{"command":"git.undoCommit","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.checkout","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.branch","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.branchFrom","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.deleteBranch","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.renameBranch","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.cherryPick","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.pull","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.pullFrom","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.pullRebase","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.merge","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.mergeAbort","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0 && gitMergeInProgress"},{"command":"git.rebase","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.createTag","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.deleteTag","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.fetch","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.fetchPrune","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.fetchAll","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.push","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.pushForce","when":"config.git.enabled && !git.missing && config.git.allowForcePush && gitOpenRepositoryCount != 0"},{"command":"git.pushTo","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.pushToForce","when":"config.git.enabled && !git.missing && config.git.allowForcePush && gitOpenRepositoryCount != 0"},{"command":"git.pushWithTags","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.pushWithTagsForce","when":"config.git.enabled && !git.missing && config.git.allowForcePush && gitOpenRepositoryCount != 0"},{"command":"git.pushTags","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.addRemote","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.removeRemote","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.sync","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.syncRebase","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.publish","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.showOutput","when":"config.git.enabled"},{"command":"git.ignore","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0 && resourceScheme == file && scmActiveResourceRepository"},{"command":"git.stashIncludeUntracked","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.stash","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.stashPop","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.stashPopLatest","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.stashApply","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.stashApplyLatest","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.stashDrop","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.stashDropAll","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.timeline.openDiff","when":"false"},{"command":"git.timeline.copyCommitId","when":"false"},{"command":"git.timeline.copyCommitMessage","when":"false"},{"command":"git.timeline.selectForCompare","when":"false"},{"command":"git.timeline.compareWithSelected","when":"false"},{"command":"git.closeAllDiffEditors","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"},{"command":"git.api.getRepositories","when":"false"},{"command":"git.api.getRepositoryState","when":"false"},{"command":"git.api.getRemoteSources","when":"false"},{"command":"git.openMergeEditor","when":"false"},{"command":"git.manageUnsafeRepositories","when":"config.git.enabled && !git.missing && git.unsafeRepositoryCount != 0"}],"scm/title":[{"command":"git.commit","group":"navigation","when":"scmProvider == git"},{"command":"git.refresh","group":"navigation","when":"scmProvider == git"},{"command":"git.pull","group":"1_header@1","when":"scmProvider == git"},{"command":"git.push","group":"1_header@2","when":"scmProvider == git"},{"command":"git.clone","group":"1_header@3","when":"scmProvider == git"},{"command":"git.checkout","group":"1_header@4","when":"scmProvider == git"},{"command":"git.fetch","group":"1_header@5","when":"scmProvider == git"},{"submenu":"git.commit","group":"2_main@1","when":"scmProvider == git"},{"submenu":"git.changes","group":"2_main@2","when":"scmProvider == git"},{"submenu":"git.pullpush","group":"2_main@3","when":"scmProvider == git"},{"submenu":"git.branch","group":"2_main@4","when":"scmProvider == git"},{"submenu":"git.remotes","group":"2_main@5","when":"scmProvider == git"},{"submenu":"git.stash","group":"2_main@6","when":"scmProvider == git"},{"submenu":"git.tags","group":"2_main@7","when":"scmProvider == git"},{"command":"git.showOutput","group":"3_footer","when":"scmProvider == git"}],"scm/sourceControl":[{"command":"git.close","group":"navigation","when":"scmProvider == git"}],"scm/resourceGroup/context":[{"command":"git.stageAllMerge","when":"scmProvider == git && scmResourceGroup == merge","group":"1_modification"},{"command":"git.stageAllMerge","when":"scmProvider == git && scmResourceGroup == merge","group":"inline@2"},{"command":"git.unstageAll","when":"scmProvider == git && scmResourceGroup == index","group":"1_modification"},{"command":"git.unstageAll","when":"scmProvider == git && scmResourceGroup == index","group":"inline@2"},{"command":"git.cleanAll","when":"scmProvider == git && scmResourceGroup == workingTree && config.git.untrackedChanges == mixed","group":"1_modification"},{"command":"git.stageAll","when":"scmProvider == git && scmResourceGroup == workingTree && config.git.untrackedChanges == mixed","group":"1_modification"},{"command":"git.cleanAll","when":"scmProvider == git && scmResourceGroup == workingTree && config.git.untrackedChanges == mixed","group":"inline@2"},{"command":"git.stageAll","when":"scmProvider == git && scmResourceGroup == workingTree && config.git.untrackedChanges == mixed","group":"inline@2"},{"command":"git.cleanAllTracked","when":"scmProvider == git && scmResourceGroup == workingTree && config.git.untrackedChanges != mixed","group":"1_modification"},{"command":"git.stageAllTracked","when":"scmProvider == git && scmResourceGroup == workingTree && config.git.untrackedChanges != mixed","group":"1_modification"},{"command":"git.cleanAllTracked","when":"scmProvider == git && scmResourceGroup == workingTree && config.git.untrackedChanges != mixed","group":"inline@2"},{"command":"git.stageAllTracked","when":"scmProvider == git && scmResourceGroup == workingTree && config.git.untrackedChanges != mixed","group":"inline@2"},{"command":"git.cleanAllUntracked","when":"scmProvider == git && scmResourceGroup == untracked","group":"1_modification"},{"command":"git.stageAllUntracked","when":"scmProvider == git && scmResourceGroup == untracked","group":"1_modification"},{"command":"git.cleanAllUntracked","when":"scmProvider == git && scmResourceGroup == untracked","group":"inline@2"},{"command":"git.stageAllUntracked","when":"scmProvider == git && scmResourceGroup == untracked","group":"inline@2"}],"scm/resourceFolder/context":[{"command":"git.stage","when":"scmProvider == git && scmResourceGroup == merge","group":"1_modification"},{"command":"git.stage","when":"scmProvider == git && scmResourceGroup == merge","group":"inline@2"},{"command":"git.unstage","when":"scmProvider == git && scmResourceGroup == index","group":"1_modification"},{"command":"git.unstage","when":"scmProvider == git && scmResourceGroup == index","group":"inline@2"},{"command":"git.stage","when":"scmProvider == git && scmResourceGroup == workingTree","group":"1_modification"},{"command":"git.clean","when":"scmProvider == git && scmResourceGroup == workingTree","group":"1_modification"},{"command":"git.clean","when":"scmProvider == git && scmResourceGroup == workingTree","group":"inline@2"},{"command":"git.stage","when":"scmProvider == git && scmResourceGroup == workingTree","group":"inline@2"},{"command":"git.ignore","when":"scmProvider == git && scmResourceGroup == workingTree","group":"1_modification@3"},{"command":"git.stage","when":"scmProvider == git && scmResourceGroup == untracked","group":"1_modification"},{"command":"git.stage","when":"scmProvider == git && scmResourceGroup == untracked","group":"inline@2"},{"command":"git.clean","when":"scmProvider == git && scmResourceGroup == untracked","group":"1_modification"},{"command":"git.clean","when":"scmProvider == git && scmResourceGroup == untracked","group":"inline@2"},{"command":"git.ignore","when":"scmProvider == git && scmResourceGroup == untracked","group":"1_modification@3"}],"scm/resourceState/context":[{"command":"git.stage","when":"scmProvider == git && scmResourceGroup == merge","group":"1_modification"},{"command":"git.openFile","when":"scmProvider == git && scmResourceGroup == merge","group":"navigation"},{"command":"git.stage","when":"scmProvider == git && scmResourceGroup == merge","group":"inline@2"},{"command":"git.revealInExplorer","when":"scmProvider == git && scmResourceGroup == merge","group":"2_view@1"},{"command":"git.revealFileInOS.linux","when":"scmProvider == git && scmResourceGroup == merge && remoteName == '' && isLinux","group":"2_view@2"},{"command":"git.revealFileInOS.mac","when":"scmProvider == git && scmResourceGroup == merge && remoteName == '' && isMac","group":"2_view@2"},{"command":"git.revealFileInOS.windows","when":"scmProvider == git && scmResourceGroup == merge && remoteName == '' && isWindows","group":"2_view@2"},{"command":"git.openFile2","when":"scmProvider == git && scmResourceGroup == merge && config.git.showInlineOpenFileAction && config.git.openDiffOnClick","group":"inline@1"},{"command":"git.openChange","when":"scmProvider == git && scmResourceGroup == merge && config.git.showInlineOpenFileAction && !config.git.openDiffOnClick","group":"inline@1"},{"command":"git.openChange","when":"scmProvider == git && scmResourceGroup == index","group":"navigation"},{"command":"git.openFile","when":"scmProvider == git && scmResourceGroup == index","group":"navigation"},{"command":"git.openHEADFile","when":"scmProvider == git && scmResourceGroup == index","group":"navigation"},{"command":"git.unstage","when":"scmProvider == git && scmResourceGroup == index","group":"1_modification"},{"command":"git.unstage","when":"scmProvider == git && scmResourceGroup == index","group":"inline@2"},{"command":"git.revealInExplorer","when":"scmProvider == git && scmResourceGroup == index","group":"2_view@1"},{"command":"git.revealFileInOS.linux","when":"scmProvider == git && scmResourceGroup == index && remoteName == '' && isLinux","group":"2_view@2"},{"command":"git.revealFileInOS.mac","when":"scmProvider == git && scmResourceGroup == index && remoteName == '' && isMac","group":"2_view@2"},{"command":"git.revealFileInOS.windows","when":"scmProvider == git && scmResourceGroup == index && remoteName == '' && isWindows","group":"2_view@2"},{"command":"git.openFile2","when":"scmProvider == git && scmResourceGroup == index && config.git.showInlineOpenFileAction && config.git.openDiffOnClick","group":"inline@1"},{"command":"git.openChange","when":"scmProvider == git && scmResourceGroup == index && config.git.showInlineOpenFileAction && !config.git.openDiffOnClick","group":"inline@1"},{"command":"git.openChange","when":"scmProvider == git && scmResourceGroup == workingTree","group":"navigation"},{"command":"git.openHEADFile","when":"scmProvider == git && scmResourceGroup == workingTree","group":"navigation"},{"command":"git.openFile","when":"scmProvider == git && scmResourceGroup == workingTree","group":"navigation"},{"command":"git.stage","when":"scmProvider == git && scmResourceGroup == workingTree","group":"1_modification"},{"command":"git.clean","when":"scmProvider == git && scmResourceGroup == workingTree","group":"1_modification"},{"command":"git.clean","when":"scmProvider == git && scmResourceGroup == workingTree","group":"inline@2"},{"command":"git.stage","when":"scmProvider == git && scmResourceGroup == workingTree","group":"inline@2"},{"command":"git.openFile2","when":"scmProvider == git && scmResourceGroup == workingTree && config.git.showInlineOpenFileAction && config.git.openDiffOnClick","group":"inline@1"},{"command":"git.openChange","when":"scmProvider == git && scmResourceGroup == workingTree && config.git.showInlineOpenFileAction && !config.git.openDiffOnClick","group":"inline@1"},{"command":"git.ignore","when":"scmProvider == git && scmResourceGroup == workingTree","group":"1_modification@3"},{"command":"git.revealInExplorer","when":"scmProvider == git && scmResourceGroup == workingTree","group":"2_view@1"},{"command":"git.revealFileInOS.linux","when":"scmProvider == git && scmResourceGroup == workingTree && remoteName == '' && isLinux","group":"2_view@2"},{"command":"git.revealFileInOS.mac","when":"scmProvider == git && scmResourceGroup == workingTree && remoteName == '' && isMac","group":"2_view@2"},{"command":"git.revealFileInOS.windows","when":"scmProvider == git && scmResourceGroup == workingTree && remoteName == '' && isWindows","group":"2_view@2"},{"command":"git.openChange","when":"scmProvider == git && scmResourceGroup == untracked","group":"navigation"},{"command":"git.openHEADFile","when":"scmProvider == git && scmResourceGroup == untracked","group":"navigation"},{"command":"git.openFile","when":"scmProvider == git && scmResourceGroup == untracked","group":"navigation"},{"command":"git.stage","when":"scmProvider == git && scmResourceGroup == untracked","group":"1_modification"},{"command":"git.clean","when":"scmProvider == git && scmResourceGroup == untracked && !gitFreshRepository","group":"1_modification"},{"command":"git.clean","when":"scmProvider == git && scmResourceGroup == untracked && !gitFreshRepository","group":"inline@2"},{"command":"git.stage","when":"scmProvider == git && scmResourceGroup == untracked","group":"inline@2"},{"command":"git.openFile2","when":"scmProvider == git && scmResourceGroup == untracked && config.git.showInlineOpenFileAction && config.git.openDiffOnClick","group":"inline@1"},{"command":"git.openChange","when":"scmProvider == git && scmResourceGroup == untracked && config.git.showInlineOpenFileAction && !config.git.openDiffOnClick","group":"inline@1"},{"command":"git.ignore","when":"scmProvider == git && scmResourceGroup == untracked","group":"1_modification@3"}],"editor/title":[{"command":"git.openFile","group":"navigation","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^git$|^file$/"},{"command":"git.openFile","group":"navigation","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0 && isInNotebookTextDiffEditor && resourceScheme =~ /^git$|^file$/"},{"command":"git.openChange","group":"navigation","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0 && !isInDiffEditor && !isMergeEditor && resourceScheme == file && scmActiveResourceHasChanges"},{"command":"git.commitMessageAccept","group":"navigation","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0 && editorLangId == git-commit && commitInProgress"},{"command":"git.commitMessageDiscard","group":"navigation","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0 && editorLangId == git-commit && commitInProgress"},{"command":"git.stageSelectedRanges","group":"2_git@1","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^git$|^file$/"},{"command":"git.unstageSelectedRanges","group":"2_git@2","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^git$|^file$/"},{"command":"git.revertSelectedRanges","group":"2_git@3","when":"config.git.enabled && !git.missing && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^git$|^file$/"}],"editor/context":[{"command":"git.stageSelectedRanges","group":"2_git@1","when":"isInDiffRightEditor && !isInEmbeddedDiffEditor && config.git.enabled && !git.missing && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^git$|^file$/"},{"command":"git.unstageSelectedRanges","group":"2_git@2","when":"isInDiffRightEditor && !isInEmbeddedDiffEditor && config.git.enabled && !git.missing && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^git$|^file$/"},{"command":"git.revertSelectedRanges","group":"2_git@3","when":"isInDiffRightEditor && !isInEmbeddedDiffEditor && config.git.enabled && !git.missing && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^git$|^file$/"}],"editor/content":[{"command":"git.acceptMerge","when":"isMergeResultEditor && mergeEditorBaseUri =~ /^(git|file):/ && mergeEditorResultUri in git.mergeChanges"},{"command":"git.openMergeEditor","group":"navigation@-10","when":"config.git.enabled && !git.missing && !isInDiffEditor && !isMergeEditor && resource in git.mergeChanges"}],"scm/change/title":[{"command":"git.stageChange","when":"config.git.enabled && !git.missing && originalResourceScheme == git"},{"command":"git.revertChange","when":"config.git.enabled && !git.missing && originalResourceScheme == git"}],"timeline/item/context":[{"command":"git.timeline.openDiff","group":"1_actions","when":"config.git.enabled && !git.missing && timelineItem =~ /git:file\\b/ && !listMultiSelection"},{"command":"git.timeline.compareWithSelected","group":"3_compare@1","when":"config.git.enabled && !git.missing && git.timeline.selectedForCompare && timelineItem =~ /git:file\\b/ && !listMultiSelection"},{"command":"git.timeline.selectForCompare","group":"3_compare@2","when":"config.git.enabled && !git.missing && timelineItem =~ /git:file\\b/ && !listMultiSelection"},{"command":"git.timeline.copyCommitId","group":"5_copy@1","when":"config.git.enabled && !git.missing && timelineItem =~ /git:file:commit\\b/ && !listMultiSelection"},{"command":"git.timeline.copyCommitMessage","group":"5_copy@2","when":"config.git.enabled && !git.missing && timelineItem =~ /git:file:commit\\b/ && !listMultiSelection"}],"git.commit":[{"command":"git.commit","group":"1_commit@1"},{"command":"git.commitStaged","group":"1_commit@2"},{"command":"git.commitAll","group":"1_commit@3"},{"command":"git.undoCommit","group":"1_commit@4"},{"command":"git.rebaseAbort","group":"1_commit@5"},{"command":"git.commitNoVerify","group":"1_commit@6","when":"config.git.allowNoVerifyCommit"},{"command":"git.commitStagedNoVerify","group":"1_commit@7","when":"config.git.allowNoVerifyCommit"},{"command":"git.commitAllNoVerify","group":"1_commit@8","when":"config.git.allowNoVerifyCommit"},{"command":"git.commitStagedAmend","group":"2_amend@1"},{"command":"git.commitAllAmend","group":"2_amend@2"},{"command":"git.commitStagedAmendNoVerify","group":"2_amend@3","when":"config.git.allowNoVerifyCommit"},{"command":"git.commitAllAmendNoVerify","group":"2_amend@4","when":"config.git.allowNoVerifyCommit"},{"command":"git.commitStagedSigned","group":"3_signoff@1"},{"command":"git.commitAllSigned","group":"3_signoff@2"},{"command":"git.commitStagedSignedNoVerify","group":"3_signoff@3","when":"config.git.allowNoVerifyCommit"},{"command":"git.commitAllSignedNoVerify","group":"3_signoff@4","when":"config.git.allowNoVerifyCommit"}],"git.changes":[{"command":"git.stageAll","group":"changes@1"},{"command":"git.unstageAll","group":"changes@2"},{"command":"git.cleanAll","group":"changes@3"}],"git.pullpush":[{"command":"git.sync","group":"1_sync@1"},{"command":"git.syncRebase","when":"gitState == idle","group":"1_sync@2"},{"command":"git.pull","group":"2_pull@1"},{"command":"git.pullRebase","group":"2_pull@2"},{"command":"git.pullFrom","group":"2_pull@3"},{"command":"git.push","group":"3_push@1"},{"command":"git.pushForce","when":"config.git.allowForcePush","group":"3_push@2"},{"command":"git.pushTo","group":"3_push@3"},{"command":"git.pushToForce","when":"config.git.allowForcePush","group":"3_push@4"},{"command":"git.fetch","group":"4_fetch@1"},{"command":"git.fetchPrune","group":"4_fetch@2"},{"command":"git.fetchAll","group":"4_fetch@3"}],"git.branch":[{"command":"git.merge","group":"branch@1"},{"command":"git.rebase","group":"branch@2"},{"command":"git.branch","group":"branch@3"},{"command":"git.branchFrom","group":"branch@4"},{"command":"git.renameBranch","group":"branch@5"},{"command":"git.deleteBranch","group":"branch@6"},{"command":"git.publish","group":"branch@7"}],"git.remotes":[{"command":"git.addRemote","group":"remote@1"},{"command":"git.removeRemote","group":"remote@2"}],"git.stash":[{"command":"git.stash","group":"stash@1"},{"command":"git.stashIncludeUntracked","group":"stash@2"},{"command":"git.stashApplyLatest","group":"stash@3"},{"command":"git.stashApply","group":"stash@4"},{"command":"git.stashPopLatest","group":"stash@5"},{"command":"git.stashPop","group":"stash@6"},{"command":"git.stashDrop","group":"stash@7"},{"command":"git.stashDropAll","group":"stash@8"}],"git.tags":[{"command":"git.createTag","group":"tags@1"},{"command":"git.deleteTag","group":"tags@2"}]},"submenus":[{"id":"git.commit","label":"Commit"},{"id":"git.changes","label":"Changes"},{"id":"git.pullpush","label":"Pull, Push"},{"id":"git.branch","label":"Branch"},{"id":"git.remotes","label":"Remote"},{"id":"git.stash","label":"Stash"},{"id":"git.tags","label":"Tags"}],"configuration":{"title":"Git","properties":{"git.enabled":{"type":"boolean","scope":"resource","description":"Whether git is enabled.","default":true},"git.path":{"type":["string","null","array"],"markdownDescription":"Path and filename of the git executable, e.g. `C:\\Program Files\\Git\\bin\\git.exe` (Windows). This can also be an array of string values containing multiple paths to look up.","default":null,"scope":"machine"},"git.autoRepositoryDetection":{"type":["boolean","string"],"enum":[true,false,"subFolders","openEditors"],"enumDescriptions":["Scan for both subfolders of the current opened folder and parent folders of open files.","Disable automatic repository scanning.","Scan for subfolders of the currently opened folder.","Scan for parent folders of open files."],"description":"Configures when repositories should be automatically detected.","default":true},"git.autorefresh":{"type":"boolean","description":"Whether auto refreshing is enabled.","default":true},"git.autofetch":{"type":["boolean","string"],"enum":[true,false,"all"],"scope":"resource","markdownDescription":"When set to true, commits will automatically be fetched from the default remote of the current Git repository. Setting to `all` will fetch from all remotes.","default":false,"tags":["usesOnlineServices"]},"git.autofetchPeriod":{"type":"number","scope":"resource","markdownDescription":"Duration in seconds between each automatic git fetch, when `#git.autofetch#` is enabled.","default":180},"git.branchPrefix":{"type":"string","description":"Prefix used when creating a new branch.","default":"","scope":"resource"},"git.branchProtection":{"type":"array","markdownDescription":"List of protected branches. By default, a prompt is shown before changes are committed to a protected branch. The prompt can be controlled using the `#git.branchProtectionPrompt#` setting.","items":{"type":"string"},"default":[],"scope":"resource"},"git.branchProtectionPrompt":{"type":"string","description":"Controls whether a prompt is being shown before changes are committed to a protected branch.","enum":["alwaysCommit","alwaysCommitToNewBranch","alwaysPrompt"],"enumDescriptions":["Always commit changes to the protected branch.","Always commit changes to a new branch.","Always prompt before changes are committed to a protected branch."],"default":"alwaysPrompt","scope":"resource"},"git.branchValidationRegex":{"type":"string","description":"A regular expression to validate new branch names.","default":""},"git.branchWhitespaceChar":{"type":"string","description":"The character to replace whitespace in new branch names, and to separate segments of a randomly generated branch name.","default":"-"},"git.branchRandomName.enable":{"type":"boolean","description":"Controls whether a random name is generated when creating a new branch.","default":false,"scope":"resource"},"git.branchRandomName.dictionary":{"type":"array","markdownDescription":"List of dictionaries used for the randomly generated branch name. Each value represents the dictionary used to generate the segment of the branch name. Supported dictionaries: `adjectives`, `animals`, `colors` and `numbers`.","items":{"type":"string","enum":["adjectives","animals","colors","numbers"],"enumDescriptions":["A random adjective","A random animal name","A random color name","A random number between 100 and 999"]},"minItems":1,"maxItems":5,"default":["adjectives","animals"],"scope":"resource"},"git.confirmSync":{"type":"boolean","description":"Confirm before synchronizing git repositories.","default":true},"git.countBadge":{"type":"string","enum":["all","tracked","off"],"enumDescriptions":["Count all changes.","Count only tracked changes.","Turn off counter."],"description":"Controls the Git count badge.","default":"all","scope":"resource"},"git.checkoutType":{"type":"array","items":{"type":"string","enum":["local","tags","remote"],"enumDescriptions":["Local branches","Tags","Remote branches"]},"uniqueItems":true,"markdownDescription":"Controls what type of git refs are listed when running `Checkout to...`.","default":["local","remote","tags"]},"git.ignoreLegacyWarning":{"type":"boolean","description":"Ignores the legacy Git warning.","default":false},"git.ignoreMissingGitWarning":{"type":"boolean","description":"Ignores the warning when Git is missing.","default":false},"git.ignoreWindowsGit27Warning":{"type":"boolean","description":"Ignores the warning when Git 2.25 - 2.26 is installed on Windows.","default":false},"git.ignoreLimitWarning":{"type":"boolean","description":"Ignores the warning when there are too many changes in a repository.","default":false},"git.ignoreRebaseWarning":{"type":"boolean","description":"Ignores the warning when it looks like the branch might have been rebased when pulling.","default":false},"git.defaultCloneDirectory":{"type":["string","null"],"default":null,"scope":"machine","description":"The default location to clone a git repository."},"git.useEditorAsCommitInput":{"type":"boolean","description":"Controls whether a full text editor will be used to author commit messages, whenever no message is provided in the commit input box.","default":true},"git.verboseCommit":{"type":"boolean","scope":"resource","markdownDescription":"Enable verbose output when `#git.useEditorAsCommitInput#` is enabled.","default":false},"git.enableSmartCommit":{"type":"boolean","scope":"resource","description":"Commit all changes when there are no staged changes.","default":false},"git.smartCommitChanges":{"type":"string","enum":["all","tracked"],"enumDescriptions":["Automatically stage all changes.","Automatically stage tracked changes only."],"scope":"resource","description":"Control which changes are automatically staged by Smart Commit.","default":"all"},"git.suggestSmartCommit":{"type":"boolean","scope":"resource","description":"Suggests to enable smart commit (commit all changes when there are no staged changes).","default":true},"git.enableCommitSigning":{"type":"boolean","scope":"resource","description":"Enables commit signing with GPG or X.509.","default":false},"git.confirmEmptyCommits":{"type":"boolean","scope":"resource","description":"Always confirm the creation of empty commits for the 'Git: Commit Empty' command.","default":true},"git.decorations.enabled":{"type":"boolean","default":true,"description":"Controls whether Git contributes colors and badges to the Explorer and the Open Editors view."},"git.enableStatusBarSync":{"type":"boolean","default":true,"description":"Controls whether the Git Sync command appears in the status bar.","scope":"resource"},"git.followTagsWhenSync":{"type":"boolean","scope":"resource","default":false,"description":"Follow push all tags when running the sync command."},"git.promptToSaveFilesBeforeStash":{"type":"string","enum":["always","staged","never"],"enumDescriptions":["Check for any unsaved files.","Check only for unsaved staged files.","Disable this check."],"scope":"resource","default":"always","description":"Controls whether Git should check for unsaved files before stashing changes."},"git.promptToSaveFilesBeforeCommit":{"type":"string","enum":["always","staged","never"],"enumDescriptions":["Check for any unsaved files.","Check only for unsaved staged files.","Disable this check."],"scope":"resource","default":"always","description":"Controls whether Git should check for unsaved files before committing."},"git.postCommitCommand":{"type":"string","enum":["none","push","sync"],"enumDescriptions":["Don't run any command after a commit.","Run 'git push' after a successful commit.","Run 'git pull' and 'git push' after a successful commit."],"markdownDescription":"Run a git command after a successful commit.","scope":"resource","default":"none"},"git.rememberPostCommitCommand":{"type":"boolean","description":"Remember the last git command that ran after a commit.","scope":"resource","default":false},"git.openAfterClone":{"type":"string","enum":["always","alwaysNewWindow","whenNoFolderOpen","prompt"],"enumDescriptions":["Always open in current window.","Always open in a new window.","Only open in current window when no folder is opened.","Always prompt for action."],"default":"prompt","description":"Controls whether to open a repository automatically after cloning."},"git.showInlineOpenFileAction":{"type":"boolean","default":true,"description":"Controls whether to show an inline Open File action in the Git changes view."},"git.showPushSuccessNotification":{"type":"boolean","description":"Controls whether to show a notification when a push is successful.","default":false},"git.inputValidation":{"type":"string","enum":["always","warn","off"],"default":"warn","description":"Controls when to show commit message input validation."},"git.inputValidationLength":{"type":"number","default":72,"description":"Controls the commit message length threshold for showing a warning."},"git.inputValidationSubjectLength":{"type":["number","null"],"default":50,"description":"Controls the commit message subject length threshold for showing a warning. Unset it to inherit the value of `config.inputValidationLength`."},"git.detectSubmodules":{"type":"boolean","scope":"resource","default":true,"description":"Controls whether to automatically detect git submodules."},"git.detectSubmodulesLimit":{"type":"number","scope":"resource","default":10,"description":"Controls the limit of git submodules detected."},"git.alwaysShowStagedChangesResourceGroup":{"type":"boolean","scope":"resource","default":false,"description":"Always show the Staged Changes resource group."},"git.alwaysSignOff":{"type":"boolean","scope":"resource","default":false,"description":"Controls the signoff flag for all commits."},"git.ignoreSubmodules":{"type":"boolean","scope":"resource","default":false,"description":"Ignore modifications to submodules in the file tree."},"git.ignoredRepositories":{"type":"array","items":{"type":"string"},"default":[],"scope":"window","description":"List of git repositories to ignore."},"git.scanRepositories":{"type":"array","items":{"type":"string"},"default":[],"scope":"resource","description":"List of paths to search for git repositories in."},"git.showProgress":{"type":"boolean","description":"Controls whether git actions should show progress.","default":true,"scope":"resource"},"git.rebaseWhenSync":{"type":"boolean","scope":"resource","default":false,"description":"Force git to use rebase when running the sync command."},"git.pullBeforeCheckout":{"type":"boolean","scope":"resource","default":false,"description":"Controls whether a branch that does not have outgoing commits is fast-forwarded before it is checked out."},"git.fetchOnPull":{"type":"boolean","scope":"resource","default":false,"description":"When enabled, fetch all branches when pulling. Otherwise, fetch just the current one."},"git.pruneOnFetch":{"type":"boolean","scope":"resource","default":false,"description":"Prune when fetching."},"git.pullTags":{"type":"boolean","scope":"resource","default":true,"description":"Fetch all tags when pulling."},"git.autoStash":{"type":"boolean","scope":"resource","default":false,"description":"Stash any changes before pulling and restore them after successful pull."},"git.allowForcePush":{"type":"boolean","default":false,"description":"Controls whether force push (with or without lease) is enabled."},"git.useForcePushWithLease":{"type":"boolean","default":true,"description":"Controls whether force pushing uses the safer force-with-lease variant."},"git.confirmForcePush":{"type":"boolean","default":true,"description":"Controls whether to ask for confirmation before force-pushing."},"git.allowNoVerifyCommit":{"type":"boolean","default":false,"description":"Controls whether commits without running pre-commit and commit-msg hooks are allowed."},"git.confirmNoVerifyCommit":{"type":"boolean","default":true,"description":"Controls whether to ask for confirmation before committing without verification."},"git.closeDiffOnOperation":{"type":"boolean","scope":"resource","default":false,"description":"Controls whether the diff editor should be automatically closed when changes are stashed, committed, discarded, staged, or unstaged."},"git.openDiffOnClick":{"type":"boolean","scope":"resource","default":true,"description":"Controls whether the diff editor should be opened when clicking a change. Otherwise the regular editor will be opened."},"git.supportCancellation":{"type":"boolean","scope":"resource","default":false,"description":"Controls whether a notification comes up when running the Sync action, which allows the user to cancel the operation."},"git.branchSortOrder":{"type":"string","enum":["committerdate","alphabetically"],"default":"committerdate","description":"Controls the sort order for branches."},"git.untrackedChanges":{"type":"string","enum":["mixed","separate","hidden"],"enumDescriptions":["All changes, tracked and untracked, appear together and behave equally.","Untracked changes appear separately in the Source Control view. They are also excluded from several actions.","Untracked changes are hidden and excluded from several actions."],"default":"mixed","description":"Controls how untracked changes behave.","scope":"resource"},"git.requireGitUserConfig":{"type":"boolean","description":"Controls whether to require explicit Git user configuration or allow Git to guess if missing.","default":true,"scope":"resource"},"git.showCommitInput":{"type":"boolean","scope":"resource","default":true,"description":"Controls whether to show the commit input in the Git source control panel."},"git.terminalAuthentication":{"type":"boolean","default":true,"description":"Controls whether to enable VS Code to be the authentication handler for Git processes spawned in the Integrated Terminal. Note: Terminals need to be restarted to pick up a change in this setting."},"git.terminalGitEditor":{"type":"boolean","default":false,"description":"Controls whether to enable VS Code to be the Git editor for Git processes spawned in the integrated terminal. Note: Terminals need to be restarted to pick up a change in this setting."},"git.useCommitInputAsStashMessage":{"type":"boolean","scope":"resource","default":false,"description":"Controls whether to use the message from the commit input box as the default stash message."},"git.useIntegratedAskPass":{"type":"boolean","default":true,"description":"Controls whether GIT_ASKPASS should be overwritten to use the integrated version."},"git.githubAuthentication":{"deprecationMessage":"This setting is now deprecated, please use `github.gitAuthentication` instead."},"git.timeline.date":{"type":"string","enum":["committed","authored"],"enumDescriptions":["Use the committed date","Use the authored date"],"default":"committed","description":"Controls which date to use for items in the Timeline view.","scope":"window"},"git.timeline.showAuthor":{"type":"boolean","default":true,"description":"Controls whether to show the commit author in the Timeline view.","scope":"window"},"git.timeline.showUncommitted":{"type":"boolean","default":false,"description":"Controls whether to show uncommitted changes in the Timeline view.","scope":"window"},"git.showActionButton":{"type":"object","additionalProperties":false,"description":"Controls whether an action button is shown in the Source Control view.","properties":{"commit":{"type":"boolean","description":"Show an action button to commit changes when the local branch has modified files ready to be committed."},"publish":{"type":"boolean","description":"Show an action button to publish the local branch when it does not have a tracking remote branch."},"sync":{"type":"boolean","description":"Show an action button to synchronize changes when the local branch is either ahead or behind the remote branch."}},"default":{"commit":true,"publish":true,"sync":true},"scope":"resource"},"git.statusLimit":{"type":"number","scope":"resource","default":10000,"description":"Controls how to limit the number of changes that can be parsed from Git status command. Can be set to 0 for no limit."},"git.repositoryScanIgnoredFolders":{"type":"array","items":{"type":"string"},"default":["node_modules"],"scope":"resource","markdownDescription":"List of folders that are ignored while scanning for Git repositories when `#git.autoRepositoryDetection#` is set to `true` or `subFolders`."},"git.repositoryScanMaxDepth":{"type":"number","scope":"resource","default":1,"markdownDescription":"Controls the depth used when scanning workspace folders for Git repositories when `#git.autoRepositoryDetection#` is set to `true` or `subFolders`. Can be set to `-1` for no limit."},"git.commandsToLog":{"type":"array","items":{"type":"string"},"default":[],"markdownDescription":"List of git commands (ex: commit, push) that would have their `stdout` logged to the [git output](command:git.showOutput). If the git command has a client-side hook configured, the client-side hook's `stdout` will also be logged to the [git output](command:git.showOutput)."},"git.mergeEditor":{"type":"boolean","default":false,"markdownDescription":"Open the merge editor for files that are currently under conflict.","scope":"window"},"git.optimisticUpdate":{"type":"boolean","default":true,"markdownDescription":"Controls whether to optimistically update the state of the Source Control view after running git commands.","scope":"resource","tags":["experimental"]}}},"colors":[{"id":"gitDecoration.addedResourceForeground","description":"Color for added resources.","defaults":{"light":"#587c0c","dark":"#81b88b","highContrast":"#a1e3ad","highContrastLight":"#374e06"}},{"id":"gitDecoration.modifiedResourceForeground","description":"Color for modified resources.","defaults":{"light":"#895503","dark":"#E2C08D","highContrast":"#E2C08D","highContrastLight":"#895503"}},{"id":"gitDecoration.deletedResourceForeground","description":"Color for deleted resources.","defaults":{"light":"#ad0707","dark":"#c74e39","highContrast":"#c74e39","highContrastLight":"#ad0707"}},{"id":"gitDecoration.renamedResourceForeground","description":"Color for renamed or copied resources.","defaults":{"light":"#007100","dark":"#73C991","highContrast":"#73C991","highContrastLight":"#007100"}},{"id":"gitDecoration.untrackedResourceForeground","description":"Color for untracked resources.","defaults":{"light":"#007100","dark":"#73C991","highContrast":"#73C991","highContrastLight":"#007100"}},{"id":"gitDecoration.ignoredResourceForeground","description":"Color for ignored resources.","defaults":{"light":"#8E8E90","dark":"#8C8C8C","highContrast":"#A7A8A9","highContrastLight":"#8e8e90"}},{"id":"gitDecoration.stageModifiedResourceForeground","description":"Color for modified resources which have been staged.","defaults":{"light":"#895503","dark":"#E2C08D","highContrast":"#E2C08D","highContrastLight":"#895503"}},{"id":"gitDecoration.stageDeletedResourceForeground","description":"Color for deleted resources which have been staged.","defaults":{"light":"#ad0707","dark":"#c74e39","highContrast":"#c74e39","highContrastLight":"#ad0707"}},{"id":"gitDecoration.conflictingResourceForeground","description":"Color for resources with conflicts.","defaults":{"light":"#ad0707","dark":"#e4676b","highContrast":"#c74e39","highContrastLight":"#ad0707"}},{"id":"gitDecoration.submoduleResourceForeground","description":"Color for submodule resources.","defaults":{"light":"#1258a7","dark":"#8db9e2","highContrast":"#8db9e2","highContrastLight":"#1258a7"}}],"configurationDefaults":{"[git-commit]":{"editor.rulers":[72],"workbench.editor.restoreViewState":false},"[git-rebase]":{"workbench.editor.restoreViewState":false}},"viewsWelcome":[{"view":"scm","contents":"If you would like to use git features, please enable git in your [settings](command:workbench.action.openSettings?%5B%22git.enabled%22%5D).\nTo learn more about how to use git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).","when":"!config.git.enabled"},{"view":"scm","contents":"Install Git, a popular source control system, to track code changes and collaborate with others. Learn more in our [Git guides](https://aka.ms/vscode-scm).","when":"config.git.enabled && git.missing"},{"view":"scm","contents":"[Download Git for macOS](https://git-scm.com/download/mac)\nAfter installing, please [reload](command:workbench.action.reloadWindow) (or [troubleshoot](command:git.showOutput)). Additional source control providers can be installed [from the Marketplace](command:workbench.extensions.search?%22%40category%3A%5C%22scm%20providers%5C%22%22).","when":"config.git.enabled && git.missing && isMac"},{"view":"scm","contents":"[Download Git for Windows](https://git-scm.com/download/win)\nAfter installing, please [reload](command:workbench.action.reloadWindow) (or [troubleshoot](command:git.showOutput)). Additional source control providers can be installed [from the Marketplace](command:workbench.extensions.search?%22%40category%3A%5C%22scm%20providers%5C%22%22).","when":"config.git.enabled && git.missing && isWindows"},{"view":"scm","contents":"Source control depends on Git being installed.\n[Download Git for Linux](https://git-scm.com/download/linux)\nAfter installing, please [reload](command:workbench.action.reloadWindow) (or [troubleshoot](command:git.showOutput)). Additional source control providers can be installed [from the Marketplace](command:workbench.extensions.search?%22%40category%3A%5C%22scm%20providers%5C%22%22).","when":"config.git.enabled && git.missing && isLinux"},{"view":"scm","contents":"In order to use git features, you can open a folder containing a git repository or clone from a URL.\n[Open Folder](command:vscode.openFolder)\n[Clone Repository](command:git.clone)\nTo learn more about how to use git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).","when":"config.git.enabled && !git.missing && workbenchState == empty && git.unsafeRepositoryCount == 0","enablement":"git.state == initialized","group":"2_open@1"},{"view":"scm","contents":"The workspace currently open doesn't have any folders containing git repositories.\n[Add Folder to Workspace](command:workbench.action.addRootFolder)\nTo learn more about how to use git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).","when":"config.git.enabled && !git.missing && workbenchState == workspace && workspaceFolderCount == 0 && git.unsafeRepositoryCount == 0","enablement":"git.state == initialized","group":"2_open@1"},{"view":"scm","contents":"Scanning folder for git repositories...","when":"config.git.enabled && !git.missing && workbenchState == folder && workspaceFolderCount != 0 && git.state != initialized"},{"view":"scm","contents":"Scanning workspace for git repositories...","when":"config.git.enabled && !git.missing && workbenchState == workspace && workspaceFolderCount != 0 && git.state != initialized"},{"view":"scm","contents":"The folder currently open doesn't have a git repository. You can initialize a repository which will enable source control features powered by git.\n[Initialize Repository](command:git.init?%5Btrue%5D)\nTo learn more about how to use git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).","when":"config.git.enabled && !git.missing && git.state == initialized && workbenchState == folder && scmRepositoryCount == 0 && git.unsafeRepositoryCount == 0 && remoteName != 'codespaces'","group":"5_scm@1"},{"view":"scm","contents":"The workspace currently open doesn't have any folders containing git repositories. You can initialize a repository on a folder which will enable source control features powered by git.\n[Initialize Repository](command:git.init)\nTo learn more about how to use git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).","when":"config.git.enabled && !git.missing && git.state == initialized && workbenchState == workspace && workspaceFolderCount != 0 && scmRepositoryCount == 0 && git.unsafeRepositoryCount == 0 && remoteName != 'codespaces'","group":"5_scm@1"},{"view":"scm","contents":"The detected git repository is potentially unsafe as the folder is owned by someone other than the current user.\n[Manage Unsafe Repositories](command:git.manageUnsafeRepositories)\nTo learn more about unsafe repositories [read our docs](https://aka.ms/vscode-git-unsafe-repository).","when":"config.git.enabled && !git.missing && git.state == initialized && git.unsafeRepositoryCount == 1"},{"view":"scm","contents":"The detected git repositories are potentially unsafe as the folders are owned by someone other than the current user.\n[Manage Unsafe Repositories](command:git.manageUnsafeRepositories)\nTo learn more about unsafe repositories [read our docs](https://aka.ms/vscode-git-unsafe-repository).","when":"config.git.enabled && !git.missing && git.state == initialized && git.unsafeRepositoryCount > 1"},{"view":"explorer","contents":"You can clone a repository locally.\n[Clone Repository](command:git.clone 'Clone a repository once the git extension has activated')","when":"config.git.enabled","enablement":"git.state == initialized","group":"5_scm@1"},{"view":"explorer","contents":"To learn more about how to use git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).","when":"config.git.enabled","enablement":"git.state == initialized","group":"5_scm@10"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/git","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.git-base"},"manifest":{"name":"git-base","displayName":"Git Base","description":"Git static contributions and pickers.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"0.10.x"},"categories":["Other"],"activationEvents":["*"],"main":"./dist/extension.js","browser":"./dist/browser/extension.js","icon":"resources/icons/git.png","capabilities":{"virtualWorkspaces":true,"untrustedWorkspaces":{"supported":true}},"contributes":{"commands":[{"command":"git-base.api.getRemoteSources","title":"Get Remote Sources","category":"Git Base API"}],"menus":{"commandPalette":[{"command":"git-base.api.getRemoteSources","when":"false"}]},"languages":[{"id":"git-commit","aliases":["Git Commit Message","git-commit"],"filenames":["COMMIT_EDITMSG","MERGE_MSG"],"configuration":"./languages/git-commit.language-configuration.json"},{"id":"git-rebase","aliases":["Git Rebase Message","git-rebase"],"filenames":["git-rebase-todo"],"configuration":"./languages/git-rebase.language-configuration.json"},{"id":"ignore","aliases":["Ignore","ignore"],"extensions":[".gitignore_global",".gitignore"],"configuration":"./languages/ignore.language-configuration.json"}],"grammars":[{"language":"git-commit","scopeName":"text.git-commit","path":"./syntaxes/git-commit.tmLanguage.json"},{"language":"git-rebase","scopeName":"text.git-rebase","path":"./syntaxes/git-rebase.tmLanguage.json"},{"language":"ignore","scopeName":"source.ignore","path":"./syntaxes/ignore.tmLanguage.json"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/git-base","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.github"},"manifest":{"name":"github","displayName":"GitHub","description":"GitHub features for VS Code","publisher":"vscode","license":"MIT","version":"0.0.1","engines":{"vscode":"^1.41.0"},"icon":"images/icon.png","categories":["Other"],"activationEvents":["*","onProfile","onProfile:github"],"extensionDependencies":["vscode.git-base"],"main":"./dist/extension.js","capabilities":{"virtualWorkspaces":false,"untrustedWorkspaces":{"supported":true}},"enabledApiProposals":["contribShareMenu","contribEditSessions","profileContentHandlers"],"contributes":{"commands":[{"command":"github.publish","title":"Publish to GitHub"},{"command":"github.copyVscodeDevLink","title":"Copy vscode.dev Link"},{"command":"github.copyVscodeDevLinkFile","title":"Copy vscode.dev Link"},{"command":"github.openOnVscodeDev","title":"Open on vscode.dev","icon":"$(globe)"}],"continueEditSession":[{"command":"github.openOnVscodeDev","when":"github.hasGitHubRepo","qualifiedName":"Continue Working in VS Code for the Web"}],"menus":{"commandPalette":[{"command":"github.publish","when":"git-base.gitEnabled && remoteName != 'codespaces'"},{"command":"github.copyVscodeDevLink","when":"false"},{"command":"github.copyVscodeDevLinkFile","when":"false"},{"command":"github.openOnVscodeDev","when":"false"}],"file/share":[{"command":"github.copyVscodeDevLinkFile","when":"github.hasGitHubRepo","group":"0_vscode@0"}],"editor/context/share":[{"command":"github.copyVscodeDevLink","when":"github.hasGitHubRepo && resourceScheme != untitled","group":"0_vscode@0"}]},"configuration":[{"title":"GitHub","properties":{"github.gitAuthentication":{"type":"boolean","scope":"resource","default":true,"description":"Controls whether to enable automatic GitHub authentication for git commands within VS Code."},"github.gitProtocol":{"type":"string","enum":["https","ssh"],"default":"https","description":"Controls which protocol is used to clone a GitHub repository"}}}],"viewsWelcome":[{"view":"scm","contents":"You can directly publish this folder to a GitHub repository. Once published, you'll have access to source control features powered by git and GitHub.\n[$(github) Publish to GitHub](command:github.publish)","when":"config.git.enabled && git.state == initialized && workbenchState == folder && git.unsafeRepositoryCount == 0"},{"view":"scm","contents":"You can directly publish a workspace folder to a GitHub repository. Once published, you'll have access to source control features powered by git and GitHub.\n[$(github) Publish to GitHub](command:github.publish)","when":"config.git.enabled && git.state == initialized && workbenchState == workspace && workspaceFolderCount != 0 && git.unsafeRepositoryCount == 0"}],"markdown.previewStyles":["./markdown.css"]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/github","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.github-authentication"},"manifest":{"name":"github-authentication","displayName":"GitHub Authentication","description":"GitHub Authentication Provider","publisher":"vscode","license":"MIT","version":"0.0.2","engines":{"vscode":"^1.41.0"},"icon":"images/icon.png","categories":["Other"],"api":"none","extensionKind":["ui","workspace"],"activationEvents":[],"capabilities":{"virtualWorkspaces":true,"untrustedWorkspaces":{"supported":"limited","restrictedConfigurations":["github-enterprise.uri"]}},"contributes":{"authentication":[{"label":"GitHub","id":"github"},{"label":"GitHub Enterprise Server","id":"github-enterprise"}],"configuration":{"title":"GitHub Enterprise Server Authentication Provider","properties":{"github-enterprise.uri":{"type":"string","description":"GitHub Enterprise Server URI"}}}},"enabledApiProposals":["telemetryLogger"],"aiKey":"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255","main":"./dist/extension.js","browser":"./dist/browser/extension.js","repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/github-authentication","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.go"},"manifest":{"name":"go","displayName":"Go Language Basics","description":"Provides syntax highlighting and bracket matching in Go files.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"*"},"scripts":{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin jeff-hykin/better-go-syntax export/generated.tmLanguage.json ./syntaxes/go.tmLanguage.json"},"contributes":{"languages":[{"id":"go","extensions":[".go"],"aliases":["Go"],"configuration":"./language-configuration.json"}],"grammars":[{"language":"go","scopeName":"source.go","path":"./syntaxes/go.tmLanguage.json"}],"configurationDefaults":{"[go]":{"editor.insertSpaces":false}}},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/go","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.groovy"},"manifest":{"name":"groovy","displayName":"Groovy Language Basics","description":"Provides snippets, syntax highlighting and bracket matching in Groovy files.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"*"},"scripts":{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin textmate/groovy.tmbundle Syntaxes/Groovy.tmLanguage ./syntaxes/groovy.tmLanguage.json"},"contributes":{"languages":[{"id":"groovy","aliases":["Groovy","groovy"],"extensions":[".groovy",".gvy",".gradle",".jenkinsfile",".nf"],"filenames":["Jenkinsfile"],"filenamePatterns":["Jenkinsfile*"],"firstLine":"^#!.*\\bgroovy\\b","configuration":"./language-configuration.json"}],"grammars":[{"language":"groovy","scopeName":"source.groovy","path":"./syntaxes/groovy.tmLanguage.json"}],"snippets":[{"language":"groovy","path":"./snippets/groovy.code-snippets"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/groovy","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.grunt"},"manifest":{"name":"grunt","publisher":"vscode","description":"Extension to add Grunt capabilities to VS Code.","displayName":"Grunt support for VS Code","version":"1.0.0","icon":"images/grunt.png","license":"MIT","engines":{"vscode":"*"},"categories":["Other"],"main":"./dist/main","activationEvents":["onTaskType:grunt"],"capabilities":{"virtualWorkspaces":false,"untrustedWorkspaces":{"supported":true}},"contributes":{"configuration":{"id":"grunt","type":"object","title":"Grunt","properties":{"grunt.autoDetect":{"scope":"application","type":"string","enum":["off","on"],"default":"off","description":"Controls enablement of Grunt task detection. Grunt task detection can cause files in any open workspace to be executed."}}},"taskDefinitions":[{"type":"grunt","required":["task"],"properties":{"task":{"type":"string","description":"The Grunt task to customize."},"args":{"type":"array","description":"Command line arguments to pass to the grunt task"},"file":{"type":"string","description":"The Grunt file that provides the task. Can be omitted."}},"when":"shellExecutionSupported"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/grunt","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.gulp"},"manifest":{"name":"gulp","publisher":"vscode","description":"Extension to add Gulp capabilities to VSCode.","displayName":"Gulp support for VSCode","version":"1.0.0","icon":"images/gulp.png","license":"MIT","engines":{"vscode":"*"},"categories":["Other"],"main":"./dist/main","activationEvents":["onTaskType:gulp"],"capabilities":{"virtualWorkspaces":false,"untrustedWorkspaces":{"supported":true}},"contributes":{"configuration":{"id":"gulp","type":"object","title":"Gulp","properties":{"gulp.autoDetect":{"scope":"application","type":"string","enum":["off","on"],"default":"off","description":"Controls enablement of Gulp task detection. Gulp task detection can cause files in any open workspace to be executed."}}},"taskDefinitions":[{"type":"gulp","required":["task"],"properties":{"task":{"type":"string","description":"The Gulp task to customize."},"file":{"type":"string","description":"The Gulp file that provides the task. Can be omitted."}},"when":"shellExecutionSupported"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/gulp","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.handlebars"},"manifest":{"name":"handlebars","displayName":"Handlebars Language Basics","description":"Provides syntax highlighting and bracket matching in Handlebars files.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"0.10.x"},"scripts":{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin daaain/Handlebars grammars/Handlebars.json ./syntaxes/Handlebars.tmLanguage.json"},"contributes":{"languages":[{"id":"handlebars","extensions":[".handlebars",".hbs",".hjs"],"aliases":["Handlebars","handlebars"],"mimetypes":["text/x-handlebars-template"],"configuration":"./language-configuration.json"}],"grammars":[{"language":"handlebars","scopeName":"text.html.handlebars","path":"./syntaxes/Handlebars.tmLanguage.json"}],"htmlLanguageParticipants":[{"languageId":"handlebars","autoInsert":true}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/handlebars","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.hlsl"},"manifest":{"name":"hlsl","displayName":"HLSL Language Basics","description":"Provides syntax highlighting and bracket matching in HLSL files.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"*"},"scripts":{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin tgjones/shaders-tmLanguage grammars/hlsl.json ./syntaxes/hlsl.tmLanguage.json"},"contributes":{"languages":[{"id":"hlsl","extensions":[".hlsl",".hlsli",".fx",".fxh",".vsh",".psh",".cginc",".compute"],"aliases":["HLSL","hlsl"],"configuration":"./language-configuration.json"}],"grammars":[{"language":"hlsl","path":"./syntaxes/hlsl.tmLanguage.json","scopeName":"source.hlsl"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/hlsl","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.html"},"manifest":{"name":"html","displayName":"HTML Language Basics","description":"Provides syntax highlighting, bracket matching & snippets in HTML files.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"0.10.x"},"scripts":{"update-grammar":"node ./build/update-grammar.mjs"},"contributes":{"languages":[{"id":"html","extensions":[".html",".htm",".shtml",".xhtml",".xht",".mdoc",".jsp",".asp",".aspx",".jshtm",".volt",".ejs",".rhtml"],"aliases":["HTML","htm","html","xhtml"],"mimetypes":["text/html","text/x-jshtm","text/template","text/ng-template","application/xhtml+xml"],"configuration":"./language-configuration.json"}],"grammars":[{"scopeName":"text.html.basic","path":"./syntaxes/html.tmLanguage.json","embeddedLanguages":{"text.html":"html","source.css":"css","source.js":"javascript","source.python":"python","source.smarty":"smarty"},"tokenTypes":{"meta.tag string.quoted":"other"}},{"language":"html","scopeName":"text.html.derivative","path":"./syntaxes/html-derivative.tmLanguage.json","embeddedLanguages":{"text.html":"html","source.css":"css","source.js":"javascript","source.python":"python","source.smarty":"smarty"},"tokenTypes":{"meta.tag string.quoted":"other"}}],"snippets":[{"language":"html","path":"./snippets/html.code-snippets"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/html","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.html-language-features"},"manifest":{"name":"html-language-features","displayName":"HTML Language Features","description":"Provides rich language support for HTML and Handlebar files","version":"1.0.0","publisher":"vscode","license":"MIT","aiKey":"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255","engines":{"vscode":"0.10.x"},"icon":"icons/html.png","activationEvents":["onLanguage:html","onLanguage:handlebars"],"enabledApiProposals":["telemetryLogger","extensionsAny"],"main":"./client/dist/node/htmlClientMain","browser":"./client/dist/browser/htmlClientMain","capabilities":{"virtualWorkspaces":true,"untrustedWorkspaces":{"supported":true}},"categories":["Programming Languages"],"contributes":{"configuration":{"id":"html","order":20,"type":"object","title":"HTML","properties":{"html.completion.attributeDefaultValue":{"type":"string","scope":"resource","enum":["doublequotes","singlequotes","empty"],"enumDescriptions":["Attribute value is set to \"\".","Attribute value is set to ''.","Attribute value is not set."],"default":"doublequotes","description":"Controls the default value for attributes when completion is accepted."},"html.customData":{"type":"array","markdownDescription":"A list of relative file paths pointing to JSON files following the [custom data format](https://github.com/microsoft/vscode-html-languageservice/blob/master/docs/customData.md).\n\nVS Code loads custom data on startup to enhance its HTML support for the custom HTML tags, attributes and attribute values you specify in the JSON files.\n\nThe file paths are relative to workspace and only workspace folder settings are considered.","default":[],"items":{"type":"string"},"scope":"resource"},"html.format.enable":{"type":"boolean","scope":"window","default":true,"description":"Enable/disable default HTML formatter."},"html.format.wrapLineLength":{"type":"integer","scope":"resource","default":120,"description":"Maximum amount of characters per line (0 = disable)."},"html.format.unformatted":{"type":["string","null"],"scope":"resource","default":"wbr","markdownDescription":"List of tags, comma separated, that shouldn't be reformatted. `null` defaults to all tags listed at https://www.w3.org/TR/html5/dom.html#phrasing-content."},"html.format.contentUnformatted":{"type":["string","null"],"scope":"resource","default":"pre,code,textarea","markdownDescription":"List of tags, comma separated, where the content shouldn't be reformatted. `null` defaults to the `pre` tag."},"html.format.indentInnerHtml":{"type":"boolean","scope":"resource","default":false,"markdownDescription":"Indent `` and `` sections."},"html.format.preserveNewLines":{"type":"boolean","scope":"resource","default":true,"description":"Controls whether existing line breaks before elements should be preserved. Only works before elements, not inside tags or for text."},"html.format.maxPreserveNewLines":{"type":["number","null"],"scope":"resource","default":null,"markdownDescription":"Maximum number of line breaks to be preserved in one chunk. Use `null` for unlimited."},"html.format.indentHandlebars":{"type":"boolean","scope":"resource","default":false,"markdownDescription":"Format and indent `{{#foo}}` and `{{/foo}}`."},"html.format.extraLiners":{"type":["string","null"],"scope":"resource","default":"head, body, /html","markdownDescription":"List of tags, comma separated, that should have an extra newline before them. `null` defaults to `\"head, body, /html\"`."},"html.format.wrapAttributes":{"type":"string","scope":"resource","default":"auto","enum":["auto","force","force-aligned","force-expand-multiline","aligned-multiple","preserve","preserve-aligned"],"enumDescriptions":["Wrap attributes only when line length is exceeded.","Wrap each attribute except first.","Wrap each attribute except first and keep aligned.","Wrap each attribute.","Wrap when line length is exceeded, align attributes vertically.","Preserve wrapping of attributes.","Preserve wrapping of attributes but align."],"description":"Wrap attributes."},"html.format.wrapAttributesIndentSize":{"type":["number","null"],"scope":"resource","default":null,"markdownDescription":"Indent wrapped attributes to after N characters. Use `null` to use the default indent size. Ignored if `#html.format.wrapAttributes#` is set to 'aligned'."},"html.format.templating":{"type":"boolean","scope":"resource","default":false,"description":"Honor django, erb, handlebars and php templating language tags."},"html.format.unformattedContentDelimiter":{"type":"string","scope":"resource","default":"","markdownDescription":"Keep text content together between this string."},"html.suggest.html5":{"type":"boolean","scope":"resource","default":true,"description":"Controls whether the built-in HTML language support suggests HTML5 tags, properties and values."},"html.validate.scripts":{"type":"boolean","scope":"resource","default":true,"description":"Controls whether the built-in HTML language support validates embedded scripts."},"html.validate.styles":{"type":"boolean","scope":"resource","default":true,"description":"Controls whether the built-in HTML language support validates embedded styles."},"html.autoCreateQuotes":{"type":"boolean","scope":"resource","default":true,"description":"Enable/disable auto creation of quotes for HTML attribute assignment. The type of quotes can be configured by `#html.completion.attributeDefaultValue#`."},"html.autoClosingTags":{"type":"boolean","scope":"resource","default":true,"description":"Enable/disable autoclosing of HTML tags."},"html.hover.documentation":{"type":"boolean","scope":"resource","default":true,"description":"Show tag and attribute documentation in hover."},"html.hover.references":{"type":"boolean","scope":"resource","default":true,"description":"Show references to MDN in hover."},"html.mirrorCursorOnMatchingTag":{"type":"boolean","scope":"resource","default":false,"description":"Enable/disable mirroring cursor on matching HTML tag.","deprecationMessage":"Deprecated in favor of `editor.linkedEditing`"},"html.trace.server":{"type":"string","scope":"window","enum":["off","messages","verbose"],"default":"off","description":"Traces the communication between VS Code and the HTML language server."}}},"configurationDefaults":{"[html]":{"editor.suggest.insertMode":"replace"},"[handlebars]":{"editor.suggest.insertMode":"replace"}},"jsonValidation":[{"fileMatch":"*.html-data.json","url":"https://raw.githubusercontent.com/microsoft/vscode-html-languageservice/master/docs/customData.schema.json"},{"fileMatch":"package.json","url":"./schemas/package.schema.json"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/html-language-features","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.ini"},"manifest":{"name":"ini","displayName":"Ini Language Basics","description":"Provides syntax highlighting and bracket matching in Ini files.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"*"},"scripts":{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin textmate/ini.tmbundle Syntaxes/Ini.plist ./syntaxes/ini.tmLanguage.json"},"contributes":{"languages":[{"id":"ini","extensions":[".ini"],"aliases":["Ini","ini"],"configuration":"./ini.language-configuration.json"},{"id":"properties","extensions":[".conf",".properties",".cfg",".directory",".gitattributes",".gitconfig",".gitmodules",".editorconfig"],"filenames":["gitconfig",".env"],"filenamePatterns":["**/.config/git/config","**/.git/config"],"aliases":["Properties","properties"],"configuration":"./properties.language-configuration.json"}],"grammars":[{"language":"ini","scopeName":"source.ini","path":"./syntaxes/ini.tmLanguage.json"},{"language":"properties","scopeName":"source.ini","path":"./syntaxes/ini.tmLanguage.json"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/ini","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.ipynb"},"manifest":{"name":"ipynb","displayName":".ipynb Support","description":"Provides basic support for opening and reading Jupyter's .ipynb notebook files","publisher":"vscode","version":"1.0.0","license":"MIT","engines":{"vscode":"^1.57.0"},"enabledApiProposals":["documentPaste","diffContentOptions"],"activationEvents":["onNotebook:jupyter-notebook","onCommand:ipynb.newUntitledIpynb"],"extensionKind":["workspace","ui"],"main":"./dist/ipynbMain.js","browser":"./dist/browser/ipynbMain.js","capabilities":{"virtualWorkspaces":true,"untrustedWorkspaces":{"supported":true}},"contributes":{"configuration":[{"properties":{"ipynb.pasteImagesAsAttachments.enabled":{"type":"boolean","scope":"resource","markdownDescription":"Enable/disable pasting of images into Markdown cells in ipynb notebook files. Pasted images are inserted as attachments to the cell.","default":true}}}],"commands":[{"command":"ipynb.newUntitledIpynb","title":"New Jupyter Notebook","shortTitle":"Jupyter Notebook","category":"Create"},{"command":"ipynb.openIpynbInNotebookEditor","title":"Open ipynb file in notebook editor"},{"command":"ipynb.cleanInvalidImageAttachment","title":"Clean invalid image attachment reference"}],"notebooks":[{"type":"jupyter-notebook","displayName":"Jupyter Notebook","selector":[{"filenamePattern":"*.ipynb"}],"priority":"default"}],"notebookRenderer":[{"id":"vscode.markdown-it-cell-attachment-renderer","displayName":"Markdown it ipynb Cell Attachment renderer","entrypoint":{"extends":"vscode.markdown-it-renderer","path":"./notebook-out/cellAttachmentRenderer.js"}}],"menus":{"file/newFile":[{"command":"ipynb.newUntitledIpynb","group":"notebook"}],"commandPalette":[{"command":"ipynb.newUntitledIpynb"},{"command":"ipynb.openIpynbInNotebookEditor","when":"false"},{"command":"ipynb.cleanInvalidImageAttachment","when":"false"}]}},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/ipynb","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.jake"},"manifest":{"name":"jake","publisher":"vscode","description":"Extension to add Jake capabilities to VS Code.","displayName":"Jake support for VS Code","icon":"images/cowboy_hat.png","version":"1.0.0","license":"MIT","engines":{"vscode":"*"},"categories":["Other"],"main":"./dist/main","activationEvents":["onTaskType:jake"],"capabilities":{"virtualWorkspaces":false,"untrustedWorkspaces":{"supported":true}},"contributes":{"configuration":{"id":"jake","type":"object","title":"Jake","properties":{"jake.autoDetect":{"scope":"application","type":"string","enum":["off","on"],"default":"off","description":"Controls enablement of Jake task detection. Jake task detection can cause files in any open workspace to be executed."}}},"taskDefinitions":[{"type":"jake","required":["task"],"properties":{"task":{"type":"string","description":"The Jake task to customize."},"file":{"type":"string","description":"The Jake file that provides the task. Can be omitted."}},"when":"shellExecutionSupported"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/jake","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.java"},"manifest":{"name":"java","displayName":"Java Language Basics","description":"Provides snippets, syntax highlighting, bracket matching and folding in Java files.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"*"},"scripts":{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin atom/language-java grammars/java.cson ./syntaxes/java.tmLanguage.json"},"contributes":{"languages":[{"id":"java","extensions":[".java",".jav"],"aliases":["Java","java"],"configuration":"./language-configuration.json"}],"grammars":[{"language":"java","scopeName":"source.java","path":"./syntaxes/java.tmLanguage.json"}],"snippets":[{"language":"java","path":"./snippets/java.code-snippets"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/java","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.javascript"},"manifest":{"name":"javascript","displayName":"JavaScript Language Basics","description":"Provides snippets, syntax highlighting, bracket matching and folding in JavaScript files.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"0.10.x"},"contributes":{"configurationDefaults":{"[javascript]":{"editor.maxTokenizationLineLength":2500}},"languages":[{"id":"javascriptreact","aliases":["JavaScript React","jsx"],"extensions":[".jsx"],"configuration":"./javascript-language-configuration.json"},{"id":"javascript","aliases":["JavaScript","javascript","js"],"extensions":[".js",".es6",".mjs",".cjs",".pac"],"filenames":["jakefile"],"firstLine":"^#!.*\\bnode","mimetypes":["text/javascript"],"configuration":"./javascript-language-configuration.json"},{"id":"jsx-tags","aliases":[],"configuration":"./tags-language-configuration.json"}],"grammars":[{"language":"javascriptreact","scopeName":"source.js.jsx","path":"./syntaxes/JavaScriptReact.tmLanguage.json","embeddedLanguages":{"meta.tag.js":"jsx-tags","meta.tag.without-attributes.js":"jsx-tags","meta.tag.attributes.js.jsx":"javascriptreact","meta.embedded.expression.js":"javascriptreact"},"tokenTypes":{"meta.template.expression":"other","meta.template.expression string":"string","meta.template.expression comment":"comment","entity.name.type.instance.jsdoc":"other","entity.name.function.tagged-template":"other","meta.import string.quoted":"other","variable.other.jsdoc":"other"}},{"language":"javascript","scopeName":"source.js","path":"./syntaxes/JavaScript.tmLanguage.json","embeddedLanguages":{"meta.tag.js":"jsx-tags","meta.tag.without-attributes.js":"jsx-tags","meta.tag.attributes.js":"javascript","meta.embedded.expression.js":"javascript"},"tokenTypes":{"meta.template.expression":"other","meta.template.expression string":"string","meta.template.expression comment":"comment","entity.name.type.instance.jsdoc":"other","entity.name.function.tagged-template":"other","meta.import string.quoted":"other","variable.other.jsdoc":"other"}},{"scopeName":"source.js.regexp","path":"./syntaxes/Regular Expressions (JavaScript).tmLanguage"}],"semanticTokenScopes":[{"language":"javascript","scopes":{"property":["variable.other.property.js"],"property.readonly":["variable.other.constant.property.js"],"variable":["variable.other.readwrite.js"],"variable.readonly":["variable.other.constant.object.js"],"function":["entity.name.function.js"],"namespace":["entity.name.type.module.js"],"variable.defaultLibrary":["support.variable.js"],"function.defaultLibrary":["support.function.js"]}},{"language":"javascriptreact","scopes":{"property":["variable.other.property.jsx"],"property.readonly":["variable.other.constant.property.jsx"],"variable":["variable.other.readwrite.jsx"],"variable.readonly":["variable.other.constant.object.jsx"],"function":["entity.name.function.jsx"],"namespace":["entity.name.type.module.jsx"],"variable.defaultLibrary":["support.variable.js"],"function.defaultLibrary":["support.function.js"]}}],"snippets":[{"language":"javascript","path":"./snippets/javascript.code-snippets"},{"language":"javascriptreact","path":"./snippets/javascript.code-snippets"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/javascript","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.json"},"manifest":{"name":"json","displayName":"JSON Language Basics","description":"Provides syntax highlighting & bracket matching in JSON files.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"0.10.x"},"scripts":{"update-grammar":"node ./build/update-grammars.js"},"contributes":{"languages":[{"id":"json","aliases":["JSON","json"],"extensions":[".json",".bowerrc",".jscsrc",".webmanifest",".js.map",".css.map",".ts.map",".har",".jslintrc",".jsonld",".geojson",".ipynb"],"filenames":["composer.lock",".watchmanconfig"],"mimetypes":["application/json","application/manifest+json"],"configuration":"./language-configuration.json"},{"id":"jsonc","aliases":["JSON with Comments"],"extensions":[".jsonc",".eslintrc",".eslintrc.json",".jsfmtrc",".jshintrc",".swcrc",".hintrc",".babelrc"],"filenames":["babel.config.json",".babelrc.json",".ember-cli","typedoc.json"],"configuration":"./language-configuration.json"}],"grammars":[{"language":"json","scopeName":"source.json","path":"./syntaxes/JSON.tmLanguage.json"},{"language":"jsonc","scopeName":"source.json.comments","path":"./syntaxes/JSONC.tmLanguage.json"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/json","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.json-language-features"},"manifest":{"name":"json-language-features","displayName":"JSON Language Features","description":"Provides rich language support for JSON files.","version":"1.0.0","publisher":"vscode","license":"MIT","aiKey":"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255","engines":{"vscode":"0.10.x"},"enabledApiProposals":["telemetryLogger"],"icon":"icons/json.png","activationEvents":["onLanguage:json","onLanguage:jsonc","onCommand:json.clearCache"],"main":"./client/dist/node/jsonClientMain","browser":"./client/dist/browser/jsonClientMain","capabilities":{"virtualWorkspaces":true,"untrustedWorkspaces":{"supported":true}},"categories":["Programming Languages"],"contributes":{"configuration":{"id":"json","order":20,"type":"object","title":"JSON","properties":{"json.schemas":{"type":"array","scope":"resource","description":"Associate schemas to JSON files in the current project.","items":{"type":"object","default":{"fileMatch":["/myfile"],"url":"schemaURL"},"properties":{"url":{"type":"string","default":"/user.schema.json","description":"A URL to a schema or a relative path to a schema in the current directory"},"fileMatch":{"type":"array","items":{"type":"string","default":"MyFile.json","description":"A file pattern that can contain '*' to match against when resolving JSON files to schemas."},"minItems":1,"description":"An array of file patterns to match against when resolving JSON files to schemas. `*` can be used as a wildcard. Exclusion patterns can also be defined and start with '!'. A file matches when there is at least one matching pattern and the last matching pattern is not an exclusion pattern."},"schema":{"$ref":"http://json-schema.org/draft-07/schema#","description":"The schema definition for the given URL. The schema only needs to be provided to avoid accesses to the schema URL."}}}},"json.validate.enable":{"type":"boolean","scope":"window","default":true,"description":"Enable/disable JSON validation."},"json.format.enable":{"type":"boolean","scope":"window","default":true,"description":"Enable/disable default JSON formatter"},"json.format.keepLines":{"type":"boolean","scope":"window","default":false,"description":"Keep all existing new lines when formatting."},"json.trace.server":{"type":"string","scope":"window","enum":["off","messages","verbose"],"default":"off","description":"Traces the communication between VS Code and the JSON language server."},"json.colorDecorators.enable":{"type":"boolean","scope":"window","default":true,"description":"Enables or disables color decorators","deprecationMessage":"The setting `json.colorDecorators.enable` has been deprecated in favor of `editor.colorDecorators`."},"json.maxItemsComputed":{"type":"number","default":5000,"description":"The maximum number of outline symbols and folding regions computed (limited for performance reasons)."},"json.schemaDownload.enable":{"type":"boolean","default":true,"description":"When enabled, JSON schemas can be fetched from http and https locations.","tags":["usesOnlineServices"]}}},"configurationDefaults":{"[json]":{"editor.quickSuggestions":{"strings":true},"editor.suggest.insertMode":"replace"},"[jsonc]":{"editor.quickSuggestions":{"strings":true},"editor.suggest.insertMode":"replace"}},"jsonValidation":[{"fileMatch":"*.schema.json","url":"http://json-schema.org/draft-07/schema#"}],"commands":[{"command":"json.clearCache","title":"Clear schema cache","category":"JSON"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/json-language-features","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.julia"},"manifest":{"name":"julia","displayName":"Julia Language Basics","description":"Provides syntax highlighting & bracket matching in Julia files.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"0.10.x"},"scripts":{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin JuliaEditorSupport/atom-language-julia grammars/julia_vscode.json ./syntaxes/julia.tmLanguage.json"},"contributes":{"languages":[{"id":"julia","aliases":["Julia","julia"],"extensions":[".jl"],"firstLine":"^#!\\s*/.*\\bjulia[0-9.-]*\\b","configuration":"./language-configuration.json"},{"id":"juliamarkdown","aliases":["Julia Markdown","juliamarkdown"],"extensions":[".jmd"]}],"grammars":[{"language":"julia","scopeName":"source.julia","path":"./syntaxes/julia.tmLanguage.json","embeddedLanguages":{"meta.embedded.inline.cpp":"cpp","meta.embedded.inline.javascript":"javascript","meta.embedded.inline.python":"python","meta.embedded.inline.r":"r","meta.embedded.inline.sql":"sql"}}]}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/julia","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.latex"},"manifest":{"name":"latex","displayName":"LaTeX Language Basics","description":"Provides syntax highlighting and bracket matching for TeX, LaTeX and BibTeX.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"*"},"scripts":{"update-grammar":"node ./build/update-grammars.js"},"contributes":{"languages":[{"id":"tex","aliases":["TeX","tex"],"extensions":[".sty",".cls",".bbx",".cbx"],"configuration":"latex-language-configuration.json"},{"id":"latex","aliases":["LaTeX","latex"],"extensions":[".tex",".ltx",".ctx"],"configuration":"latex-language-configuration.json"},{"id":"bibtex","aliases":["BibTeX","bibtex"],"extensions":[".bib"]},{"id":"cpp_embedded_latex","configuration":"latex-cpp-embedded-language-configuration.json","aliases":[]},{"id":"markdown_latex_combined","configuration":"markdown-latex-combined-language-configuration.json","aliases":[]}],"grammars":[{"language":"tex","scopeName":"text.tex","path":"./syntaxes/TeX.tmLanguage.json"},{"language":"latex","scopeName":"text.tex.latex","path":"./syntaxes/LaTeX.tmLanguage.json","embeddedLanguages":{"source.cpp":"cpp_embedded_latex","source.css":"css","text.html":"html","source.java":"java","source.js":"javascript","source.julia":"julia","source.lua":"lua","source.python":"python","source.ruby":"ruby","source.ts":"typescript","text.xml":"xml","source.yaml":"yaml","meta.embedded.markdown_latex_combined":"markdown_latex_combined"}},{"language":"bibtex","scopeName":"text.bibtex","path":"./syntaxes/Bibtex.tmLanguage.json"},{"language":"markdown_latex_combined","scopeName":"text.tex.markdown_latex_combined","path":"./syntaxes/markdown-latex-combined.tmLanguage.json"},{"language":"cpp_embedded_latex","scopeName":"source.cpp.embedded.latex","path":"./syntaxes/cpp-grammar-bailout.tmLanguage.json"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/latex","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.less"},"manifest":{"name":"less","displayName":"Less Language Basics","description":"Provides syntax highlighting, bracket matching and folding in Less files.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"*"},"scripts":{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin atom/language-less grammars/less.cson ./syntaxes/less.tmLanguage.json"},"contributes":{"languages":[{"id":"less","aliases":["Less","less"],"extensions":[".less"],"mimetypes":["text/x-less","text/less"],"configuration":"./language-configuration.json"}],"grammars":[{"language":"less","scopeName":"source.css.less","path":"./syntaxes/less.tmLanguage.json"}],"problemMatchers":[{"name":"lessc","label":"Lessc compiler","owner":"lessc","source":"less","fileLocation":"absolute","pattern":{"regexp":"(.*)\\sin\\s(.*)\\son line\\s(\\d+),\\scolumn\\s(\\d+)","message":1,"file":2,"line":3,"column":4}}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/less","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.log"},"manifest":{"name":"log","displayName":"Log","description":"Provides syntax highlighting for files with .log extension.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"*"},"scripts":{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin emilast/vscode-logfile-highlighter syntaxes/log.tmLanguage ./syntaxes/log.tmLanguage.json"},"contributes":{"languages":[{"id":"log","extensions":[".log","*.log.?"],"aliases":["Log"]}],"grammars":[{"language":"log","scopeName":"text.log","path":"./syntaxes/log.tmLanguage.json"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/log","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.lua"},"manifest":{"name":"lua","displayName":"Lua Language Basics","description":"Provides syntax highlighting and bracket matching in Lua files.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"*"},"scripts":{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin sumneko/lua.tmbundle Syntaxes/Lua.plist ./syntaxes/lua.tmLanguage.json"},"contributes":{"languages":[{"id":"lua","extensions":[".lua"],"aliases":["Lua","lua"],"configuration":"./language-configuration.json"}],"grammars":[{"language":"lua","scopeName":"source.lua","path":"./syntaxes/lua.tmLanguage.json","tokenTypes":{"comment.line.double-dash.doc.lua":"other"}}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/lua","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.make"},"manifest":{"name":"make","displayName":"Make Language Basics","description":"Provides syntax highlighting and bracket matching in Make files.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"*"},"scripts":{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin fadeevab/make.tmbundle Syntaxes/Makefile.plist ./syntaxes/make.tmLanguage.json"},"contributes":{"languages":[{"id":"makefile","aliases":["Makefile","makefile"],"extensions":[".mak",".mk"],"filenames":["Makefile","makefile","GNUmakefile","OCamlMakefile"],"firstLine":"^#!\\s*/usr/bin/make","configuration":"./language-configuration.json"}],"grammars":[{"language":"makefile","scopeName":"source.makefile","path":"./syntaxes/make.tmLanguage.json","tokenTypes":{"string.interpolated":"other"}}],"configurationDefaults":{"[makefile]":{"editor.insertSpaces":false}}},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/make","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.markdown"},"manifest":{"name":"markdown","displayName":"Markdown Language Basics","description":"Provides snippets and syntax highlighting for Markdown.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"^1.20.0"},"contributes":{"languages":[{"id":"markdown","aliases":["Markdown","markdown"],"extensions":[".md",".mkd",".mdwn",".mdown",".markdown",".markdn",".mdtxt",".mdtext",".workbook"],"configuration":"./language-configuration.json"}],"grammars":[{"language":"markdown","scopeName":"text.html.markdown","path":"./syntaxes/markdown.tmLanguage.json","embeddedLanguages":{"meta.embedded.block.html":"html","source.js":"javascript","source.css":"css","meta.embedded.block.frontmatter":"yaml","meta.embedded.block.css":"css","meta.embedded.block.ini":"ini","meta.embedded.block.java":"java","meta.embedded.block.lua":"lua","meta.embedded.block.makefile":"makefile","meta.embedded.block.perl":"perl","meta.embedded.block.r":"r","meta.embedded.block.ruby":"ruby","meta.embedded.block.php":"php","meta.embedded.block.sql":"sql","meta.embedded.block.vs_net":"vs_net","meta.embedded.block.xml":"xml","meta.embedded.block.xsl":"xsl","meta.embedded.block.yaml":"yaml","meta.embedded.block.dosbatch":"dosbatch","meta.embedded.block.clojure":"clojure","meta.embedded.block.coffee":"coffee","meta.embedded.block.c":"c","meta.embedded.block.cpp":"cpp","meta.embedded.block.diff":"diff","meta.embedded.block.dockerfile":"dockerfile","meta.embedded.block.go":"go","meta.embedded.block.groovy":"groovy","meta.embedded.block.pug":"jade","meta.embedded.block.javascript":"javascript","meta.embedded.block.json":"json","meta.embedded.block.jsonc":"jsonc","meta.embedded.block.latex":"latex","meta.embedded.block.less":"less","meta.embedded.block.objc":"objc","meta.embedded.block.scss":"scss","meta.embedded.block.perl6":"perl6","meta.embedded.block.powershell":"powershell","meta.embedded.block.python":"python","meta.embedded.block.rust":"rust","meta.embedded.block.scala":"scala","meta.embedded.block.shellscript":"shellscript","meta.embedded.block.typescript":"typescript","meta.embedded.block.typescriptreact":"typescriptreact","meta.embedded.block.csharp":"csharp","meta.embedded.block.fsharp":"fsharp"}}],"snippets":[{"language":"markdown","path":"./snippets/markdown.code-snippets"}],"configurationDefaults":{"[markdown]":{"editor.unicodeHighlight.ambiguousCharacters":false,"editor.unicodeHighlight.invisibleCharacters":false}}},"scripts":{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin microsoft/vscode-markdown-tm-grammar syntaxes/markdown.tmLanguage ./syntaxes/markdown.tmLanguage.json"},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/markdown-basics","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.markdown-language-features"},"manifest":{"name":"markdown-language-features","displayName":"Markdown Language Features","description":"Provides rich language support for Markdown.","version":"1.0.0","icon":"icon.png","publisher":"vscode","license":"MIT","aiKey":"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255","engines":{"vscode":"^1.70.0"},"main":"./dist/extension","browser":"./dist/browser/extension","categories":["Programming Languages"],"enabledApiProposals":["telemetryLogger","documentPaste"],"activationEvents":["onLanguage:markdown","onCommand:markdown.preview.toggleLock","onCommand:markdown.preview.refresh","onCommand:markdown.showPreview","onCommand:markdown.showPreviewToSide","onCommand:markdown.showLockedPreviewToSide","onCommand:markdown.showSource","onCommand:markdown.showPreviewSecuritySelector","onCommand:markdown.api.render","onCommand:markdown.api.reloadPlugins","onCommand:markdown.findAllFileReferences","onCommand:markdown.editor.insertLinkFromWorkspace","onCommand:markdown.editor.insertImageFromWorkspace","onWebviewPanel:markdown.preview","onCustomEditor:vscode.markdown.preview.editor"],"capabilities":{"virtualWorkspaces":true,"untrustedWorkspaces":{"supported":"limited","description":"Required for loading styles configured in the workspace.","restrictedConfigurations":["markdown.styles"]}},"contributes":{"notebookRenderer":[{"id":"vscode.markdown-it-renderer","displayName":"Markdown it renderer","entrypoint":"./notebook-out/index.js","mimeTypes":["text/markdown","text/latex","text/x-css","text/x-html","text/x-json","text/x-typescript","text/x-abap","text/x-apex","text/x-azcli","text/x-bat","text/x-cameligo","text/x-clojure","text/x-coffee","text/x-cpp","text/x-csharp","text/x-csp","text/x-css","text/x-dart","text/x-dockerfile","text/x-ecl","text/x-fsharp","text/x-go","text/x-graphql","text/x-handlebars","text/x-hcl","text/x-html","text/x-ini","text/x-java","text/x-javascript","text/x-julia","text/x-kotlin","text/x-less","text/x-lexon","text/x-lua","text/x-m3","text/x-markdown","text/x-mips","text/x-msdax","text/x-mysql","text/x-objective-c/objective","text/x-pascal","text/x-pascaligo","text/x-perl","text/x-pgsql","text/x-php","text/x-postiats","text/x-powerquery","text/x-powershell","text/x-pug","text/x-python","text/x-r","text/x-razor","text/x-redis","text/x-redshift","text/x-restructuredtext","text/x-ruby","text/x-rust","text/x-sb","text/x-scala","text/x-scheme","text/x-scss","text/x-shell","text/x-solidity","text/x-sophia","text/x-sql","text/x-st","text/x-swift","text/x-systemverilog","text/x-tcl","text/x-twig","text/x-typescript","text/x-vb","text/x-xml","text/x-yaml","application/json"]}],"commands":[{"command":"markdown.showPreview","title":"Open Preview","category":"Markdown","icon":{"light":"./media/preview-light.svg","dark":"./media/preview-dark.svg"}},{"command":"markdown.showPreviewToSide","title":"Open Preview to the Side","category":"Markdown","icon":"$(open-preview)"},{"command":"markdown.showLockedPreviewToSide","title":"Open Locked Preview to the Side","category":"Markdown","icon":"$(open-preview)"},{"command":"markdown.showSource","title":"Show Source","category":"Markdown","icon":"$(go-to-file)"},{"command":"markdown.showPreviewSecuritySelector","title":"Change Preview Security Settings","category":"Markdown"},{"command":"markdown.preview.refresh","title":"Refresh Preview","category":"Markdown"},{"command":"markdown.preview.toggleLock","title":"Toggle Preview Locking","category":"Markdown"},{"command":"markdown.findAllFileReferences","title":"Find File References","category":"Markdown"},{"command":"markdown.editor.insertLinkFromWorkspace","title":"Insert Link to File in Workspace","category":"Markdown","enablement":"editorLangId == markdown && !activeEditorIsReadonly"},{"command":"markdown.editor.insertImageFromWorkspace","title":"Insert Image from Workspace","category":"Markdown","enablement":"editorLangId == markdown && !activeEditorIsReadonly"}],"menus":{"editor/title":[{"command":"markdown.showPreviewToSide","when":"editorLangId == markdown && !notebookEditorFocused && !hasCustomMarkdownPreview","alt":"markdown.showPreview","group":"navigation"},{"command":"markdown.showSource","when":"activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'","group":"navigation"},{"command":"markdown.preview.refresh","when":"activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'","group":"1_markdown"},{"command":"markdown.preview.toggleLock","when":"activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'","group":"1_markdown"},{"command":"markdown.showPreviewSecuritySelector","when":"activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'","group":"1_markdown"}],"explorer/context":[{"command":"markdown.showPreview","when":"resourceLangId == markdown && !hasCustomMarkdownPreview","group":"navigation"},{"command":"markdown.findAllFileReferences","when":"resourceLangId == markdown","group":"4_search"}],"editor/title/context":[{"command":"markdown.showPreview","when":"resourceLangId == markdown && !hasCustomMarkdownPreview","group":"1_open"},{"command":"markdown.findAllFileReferences","when":"resourceLangId == markdown"}],"commandPalette":[{"command":"markdown.showPreview","when":"editorLangId == markdown && !notebookEditorFocused","group":"navigation"},{"command":"markdown.showPreviewToSide","when":"editorLangId == markdown && !notebookEditorFocused","group":"navigation"},{"command":"markdown.showLockedPreviewToSide","when":"editorLangId == markdown && !notebookEditorFocused","group":"navigation"},{"command":"markdown.showSource","when":"activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'","group":"navigation"},{"command":"markdown.showPreviewSecuritySelector","when":"editorLangId == markdown && !notebookEditorFocused"},{"command":"markdown.showPreviewSecuritySelector","when":"activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'"},{"command":"markdown.preview.toggleLock","when":"activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'"},{"command":"markdown.preview.refresh","when":"editorLangId == markdown && !notebookEditorFocused"},{"command":"markdown.preview.refresh","when":"activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'"},{"command":"markdown.findAllFileReferences","when":"editorLangId == markdown"}]},"keybindings":[{"command":"markdown.showPreview","key":"shift+ctrl+v","mac":"shift+cmd+v","when":"editorLangId == markdown && !notebookEditorFocused"},{"command":"markdown.showPreviewToSide","key":"ctrl+k v","mac":"cmd+k v","when":"editorLangId == markdown && !notebookEditorFocused"}],"configuration":{"type":"object","title":"Markdown","order":20,"properties":{"markdown.styles":{"type":"array","items":{"type":"string"},"default":[],"description":"A list of URLs or local paths to CSS style sheets to use from the Markdown preview. Relative paths are interpreted relative to the folder open in the Explorer. If there is no open folder, they are interpreted relative to the location of the Markdown file. All '\\' need to be written as '\\\\'.","scope":"resource"},"markdown.preview.breaks":{"type":"boolean","default":false,"description":"Sets how line-breaks are rendered in the Markdown preview. Setting it to 'true' creates a
for newlines inside paragraphs.","scope":"resource"},"markdown.preview.linkify":{"type":"boolean","default":true,"description":"Convert URL-like text to links in the Markdown preview.","scope":"resource"},"markdown.preview.typographer":{"type":"boolean","default":false,"description":"Enable some language-neutral replacement and quotes beautification in the Markdown preview.","scope":"resource"},"markdown.preview.fontFamily":{"type":"string","default":"-apple-system, BlinkMacSystemFont, 'Segoe WPC', 'Segoe UI', system-ui, 'Ubuntu', 'Droid Sans', sans-serif","description":"Controls the font family used in the Markdown preview.","scope":"resource"},"markdown.preview.fontSize":{"type":"number","default":14,"description":"Controls the font size in pixels used in the Markdown preview.","scope":"resource"},"markdown.preview.lineHeight":{"type":"number","default":1.6,"description":"Controls the line height used in the Markdown preview. This number is relative to the font size.","scope":"resource"},"markdown.preview.scrollPreviewWithEditor":{"type":"boolean","default":true,"description":"When a Markdown editor is scrolled, update the view of the preview.","scope":"resource"},"markdown.preview.markEditorSelection":{"type":"boolean","default":true,"description":"Mark the current editor selection in the Markdown preview.","scope":"resource"},"markdown.preview.scrollEditorWithPreview":{"type":"boolean","default":true,"description":"When a Markdown preview is scrolled, update the view of the editor.","scope":"resource"},"markdown.preview.doubleClickToSwitchToEditor":{"type":"boolean","default":true,"description":"Double click in the Markdown preview to switch to the editor.","scope":"resource"},"markdown.preview.openMarkdownLinks":{"type":"string","default":"inPreview","description":"Controls how links to other Markdown files in the Markdown preview should be opened.","scope":"resource","enum":["inPreview","inEditor"],"enumDescriptions":["Try to open links in the Markdown preview.","Try to open links in the editor."]},"markdown.links.openLocation":{"type":"string","default":"currentGroup","description":"Controls where links in Markdown files should be opened.","scope":"resource","enum":["currentGroup","beside"],"enumDescriptions":["Open links in the active editor group.","Open links beside the active editor."]},"markdown.suggest.paths.enabled":{"type":"boolean","default":true,"description":"Enable path suggestions while writing links in Markdown files.","scope":"resource"},"markdown.trace.extension":{"type":"string","enum":["off","verbose"],"default":"off","description":"Enable debug logging for the Markdown extension.","scope":"window"},"markdown.trace.server":{"type":"string","scope":"window","enum":["off","messages","verbose"],"default":"off","description":"Traces the communication between VS Code and the Markdown language server."},"markdown.editor.drop.enabled":{"type":"boolean","default":true,"markdownDescription":"Enable dropping files into a Markdown editor while holding Shift. Requires enabling `#editor.dropIntoEditor.enabled#`.","scope":"resource"},"markdown.experimental.editor.pasteLinks.enabled":{"type":"boolean","scope":"resource","markdownDescription":"Enable pasting files into a Markdown editor inserts Markdown links. Requires enabling `#editor.experimental.pasteActions.enabled#`.","default":true,"tags":["experimental"]},"markdown.validate.enabled":{"type":"boolean","scope":"resource","description":"Enable all error reporting in Markdown files.","default":false},"markdown.validate.referenceLinks.enabled":{"type":"string","scope":"resource","markdownDescription":"Validate reference links in Markdown files, for example `[link][ref]`. Requires enabling `#markdown.validate.enabled#`.","default":"warning","enum":["ignore","warning","error"]},"markdown.validate.fragmentLinks.enabled":{"type":"string","scope":"resource","markdownDescription":"Validate fragment links to headers in the current Markdown file, for example `[link](#header)`. Requires enabling `#markdown.validate.enabled#`.","default":"warning","enum":["ignore","warning","error"]},"markdown.validate.fileLinks.enabled":{"type":"string","scope":"resource","markdownDescription":"Validate links to other files in Markdown files, for example `[link](/path/to/file.md)`. This checks that the target files exists. Requires enabling `#markdown.validate.enabled#`.","default":"warning","enum":["ignore","warning","error"]},"markdown.validate.fileLinks.markdownFragmentLinks":{"type":"string","scope":"resource","markdownDescription":"Validate the fragment part of links to headers in other files in Markdown files, for example `[link](/path/to/file.md#header)`. Inherits the setting value from `#markdown.validate.fragmentLinks.enabled#` by default.","default":"inherit","enum":["inherit","ignore","warning","error"]},"markdown.validate.ignoredLinks":{"type":"array","scope":"resource","markdownDescription":"Configure links that should not be validated. For example adding `/about` would not validate the link `[about](/about)`, while the glob `/assets/**/*.svg` would let you skip validation for any link to `.svg` files under the `assets` directory.","items":{"type":"string"}},"markdown.validate.unusedLinkDefinitions.enabled":{"type":"string","scope":"resource","markdownDescription":"Validate link definitions that are unused in the current file.","default":"hint","enum":["ignore","hint","warning","error"]},"markdown.validate.duplicateLinkDefinitions.enabled":{"type":"string","scope":"resource","markdownDescription":"Validate duplicated definitions in the current file.","default":"warning","enum":["ignore","warning","error"]},"markdown.updateLinksOnFileMove.enabled":{"type":"string","enum":["prompt","always","never"],"markdownEnumDescriptions":["Prompt on each file move.","Always update links automatically.","Never try to update link and don't prompt."],"default":"never","markdownDescription":"Try to update links in Markdown files when a file is renamed/moved in the workspace. Use `#markdown.updateLinksOnFileMove.include#` to configure which files trigger link updates.","scope":"window"},"markdown.updateLinksOnFileMove.include":{"type":"array","markdownDescription":"Glob patterns that specifies files that trigger automatic link updates. See `#markdown.updateLinksOnFileMove.enabled#` for details about this feature.","scope":"window","items":{"type":"string","description":"The glob pattern to match file paths against. Set to true to enable the pattern."},"default":["**/*.{md,mkd,mdwn,mdown,markdown,markdn,mdtxt,mdtext,workbook}","**/*.{jpg,jpe,jpeg,png,bmp,gif,ico,webp,avif,tiff,svg,mp4}"]},"markdown.updateLinksOnFileMove.enableForDirectories":{"type":"boolean","default":true,"description":"Enable updating links when a directory is moved or renamed in the workspace.","scope":"window"},"markdown.occurrencesHighlight.enabled":{"type":"boolean","default":false,"description":"Enable highlighting link occurrences in the current document.","scope":"resource"}}},"configurationDefaults":{"[markdown]":{"editor.wordWrap":"on","editor.quickSuggestions":{"comments":"off","strings":"off","other":"off"}}},"jsonValidation":[{"fileMatch":"package.json","url":"./schemas/package.schema.json"}],"markdown.previewStyles":["./media/markdown.css","./media/highlight.css"],"markdown.previewScripts":["./media/index.js"],"customEditors":[{"viewType":"vscode.markdown.preview.editor","displayName":"Markdown Preview","priority":"option","selector":[{"filenamePattern":"*.md"}]}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/markdown-language-features","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.markdown-math"},"manifest":{"name":"markdown-math","displayName":"Markdown Math","description":"Adds math support to Markdown in notebooks.","version":"1.0.0","icon":"icon.png","publisher":"vscode","license":"MIT","aiKey":"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255","engines":{"vscode":"^1.54.0"},"categories":["Other"],"capabilities":{"virtualWorkspaces":true,"untrustedWorkspaces":{"supported":true}},"main":"./dist/extension","browser":"./dist/browser/extension","activationEvents":[],"contributes":{"languages":[{"id":"markdown-math","aliases":[]}],"grammars":[{"language":"markdown-math","scopeName":"text.html.markdown.math","path":"./syntaxes/md-math.tmLanguage.json"},{"scopeName":"markdown.math.block","path":"./syntaxes/md-math-block.tmLanguage.json","injectTo":["text.html.markdown"],"embeddedLanguages":{"meta.embedded.math.markdown":"latex"}},{"scopeName":"markdown.math.inline","path":"./syntaxes/md-math-inline.tmLanguage.json","injectTo":["text.html.markdown"],"embeddedLanguages":{"meta.embedded.math.markdown":"latex"}}],"notebookRenderer":[{"id":"vscode.markdown-it-katex-extension","displayName":"Markdown it KaTeX renderer","entrypoint":{"extends":"vscode.markdown-it-renderer","path":"./notebook-out/katex.js"}}],"markdown.markdownItPlugins":true,"markdown.previewStyles":["./notebook-out/katex.min.css","./preview-styles/index.css"],"configuration":[{"title":"Markdown Math","properties":{"markdown.math.enabled":{"type":"boolean","default":true,"description":"Enable/disable rendering math in the built-in Markdown preview."}}}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/markdown-math","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.media-preview"},"manifest":{"name":"media-preview","displayName":"Media Preview","description":"Provides VS Code's built-in previews for images, audio, and video","enabledApiProposals":["telemetryLogger"],"extensionKind":["ui","workspace"],"version":"1.0.0","publisher":"vscode","icon":"icon.png","license":"MIT","aiKey":"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255","engines":{"vscode":"^1.70.0"},"main":"./dist/extension","browser":"./dist/browser/extension.js","categories":["Other"],"activationEvents":["onCustomEditor:imagePreview.previewEditor","onCommand:imagePreview.zoomIn","onCommand:imagePreview.zoomOut","onCustomEditor:vscode.audioPreview","onCustomEditor:vscode.videoPreview"],"capabilities":{"virtualWorkspaces":true,"untrustedWorkspaces":{"supported":true}},"contributes":{"customEditors":[{"viewType":"imagePreview.previewEditor","displayName":"Image Preview","priority":"builtin","selector":[{"filenamePattern":"*.{jpg,jpe,jpeg,png,bmp,gif,ico,webp,avif}"}]},{"viewType":"vscode.audioPreview","displayName":"Audio Preview","priority":"builtin","selector":[{"filenamePattern":"*.{mp3,wav,ogg}"}]},{"viewType":"vscode.videoPreview","displayName":"Video Preview","priority":"builtin","selector":[{"filenamePattern":"*.{mp4,webm}"}]}],"commands":[{"command":"imagePreview.zoomIn","title":"Zoom in","category":"Image Preview"},{"command":"imagePreview.zoomOut","title":"Zoom out","category":"Image Preview"}],"menus":{"commandPalette":[{"command":"imagePreview.zoomIn","when":"activeCustomEditorId == 'imagePreview.previewEditor'","group":"1_imagePreview"},{"command":"imagePreview.zoomOut","when":"activeCustomEditorId == 'imagePreview.previewEditor'","group":"1_imagePreview"}]}},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/media-preview","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.merge-conflict"},"manifest":{"name":"merge-conflict","publisher":"vscode","displayName":"Merge Conflict","description":"Highlighting and commands for inline merge conflicts.","icon":"media/icon.png","version":"1.0.0","license":"MIT","aiKey":"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255","engines":{"vscode":"^1.5.0"},"categories":["Other"],"capabilities":{"virtualWorkspaces":true,"untrustedWorkspaces":{"supported":true}},"enabledApiProposals":["telemetryLogger"],"activationEvents":["onStartupFinished"],"main":"./dist/mergeConflictMain","browser":"./dist/browser/mergeConflictMain","contributes":{"commands":[{"category":"Merge Conflict","title":"Accept All Current","original":"Accept All Current","command":"merge-conflict.accept.all-current","enablement":"!isMergeEditor"},{"category":"Merge Conflict","title":"Accept All Incoming","original":"Accept All Incoming","command":"merge-conflict.accept.all-incoming","enablement":"!isMergeEditor"},{"category":"Merge Conflict","title":"Accept All Both","original":"Accept All Both","command":"merge-conflict.accept.all-both","enablement":"!isMergeEditor"},{"category":"Merge Conflict","title":"Accept Current","original":"Accept Current","command":"merge-conflict.accept.current","enablement":"!isMergeEditor"},{"category":"Merge Conflict","title":"Accept Incoming","original":"Accept Incoming","command":"merge-conflict.accept.incoming","enablement":"!isMergeEditor"},{"category":"Merge Conflict","title":"Accept Selection","original":"Accept Selection","command":"merge-conflict.accept.selection","enablement":"!isMergeEditor"},{"category":"Merge Conflict","title":"Accept Both","original":"Accept Both","command":"merge-conflict.accept.both","enablement":"!isMergeEditor"},{"category":"Merge Conflict","title":"Next Conflict","original":"Next Conflict","command":"merge-conflict.next","enablement":"!isMergeEditor","icon":"$(arrow-down)"},{"category":"Merge Conflict","title":"Previous Conflict","original":"Previous Conflict","command":"merge-conflict.previous","enablement":"!isMergeEditor","icon":"$(arrow-up)"},{"category":"Merge Conflict","title":"Compare Current Conflict","original":"Compare Current Conflict","command":"merge-conflict.compare","enablement":"!isMergeEditor"}],"menus":{"scm/resourceState/context":[{"command":"merge-conflict.accept.all-current","when":"scmProvider == git && scmResourceGroup == merge","group":"1_modification"},{"command":"merge-conflict.accept.all-incoming","when":"scmProvider == git && scmResourceGroup == merge","group":"1_modification"}],"editor/title":[{"command":"merge-conflict.previous","group":"navigation@1","when":"!isMergeEditor && mergeConflictsCount && mergeConflictsCount != 0"},{"command":"merge-conflict.next","group":"navigation@2","when":"!isMergeEditor && mergeConflictsCount && mergeConflictsCount != 0"}]},"configuration":{"title":"Merge Conflict","properties":{"merge-conflict.codeLens.enabled":{"type":"boolean","description":"Create a CodeLens for merge conflict blocks within editor.","default":true},"merge-conflict.decorators.enabled":{"type":"boolean","description":"Create decorators for merge conflict blocks within editor.","default":true},"merge-conflict.autoNavigateNextConflict.enabled":{"type":"boolean","description":"Whether to automatically navigate to the next merge conflict after resolving a merge conflict.","default":false},"merge-conflict.diffViewPosition":{"type":"string","enum":["Current","Beside","Below"],"description":"Controls where the diff view should be opened when comparing changes in merge conflicts.","enumDescriptions":["Open the diff view in the current editor group.","Open the diff view next to the current editor group.","Open the diff view below the current editor group."],"default":"Current"}}}},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/merge-conflict","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.microsoft-authentication"},"manifest":{"name":"microsoft-authentication","publisher":"vscode","license":"MIT","displayName":"Microsoft Account","description":"Microsoft authentication provider","version":"0.0.1","engines":{"vscode":"^1.42.0"},"icon":"media/icon.png","categories":["Other"],"activationEvents":[],"enabledApiProposals":["telemetryLogger","idToken"],"capabilities":{"virtualWorkspaces":true,"untrustedWorkspaces":{"supported":true}},"extensionKind":["ui","workspace"],"contributes":{"authentication":[{"label":"Microsoft","id":"microsoft"}]},"aiKey":"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255","main":"./dist/extension.js","browser":"./dist/browser/extension.js","repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/microsoft-authentication","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"ms-vscode.js-debug","uuid":"25629058-ddac-4e17-abba-74678e126c5d"},"manifest":{"name":"js-debug","displayName":"JavaScript Debugger","version":"1.74.1","publisher":"ms-vscode","author":{"name":"Microsoft Corporation"},"keywords":["pwa","javascript","node","chrome","debugger"],"description":"An extension for debugging Node.js programs and Chrome.","license":"MIT","engines":{"vscode":"^1.73.0","node":">=10"},"icon":"resources/logo.png","categories":["Debuggers"],"private":true,"repository":{"type":"git","url":"https://github.com/Microsoft/vscode-pwa.git"},"bugs":{"url":"https://github.com/Microsoft/vscode-pwa/issues"},"prettier":{"trailingComma":"all","singleQuote":true,"arrowParens":"avoid","printWidth":100,"tabWidth":2},"main":"./src/extension.js","enabledApiProposals":["portsAttributes","findTextInFiles","workspaceTrust","tunnels"],"activationEvents":["onDebugDynamicConfigurations","onDebugInitialConfigurations","onDebugResolve:node","onDebugResolve:extensionHost","onDebugResolve:chrome","onTerminalProfile:extension.js-debug.debugTerminal","onCommand:extension.js-debug.addCustomBreakpoints","onCommand:extension.pwa-node-debug.attachNodeProcess","onCommand:extension.js-debug.clearAutoAttachVariables","onCommand:extension.js-debug.setAutoAttachVariables","onCommand:extension.js-debug.autoAttachToProcess","onCommand:extension.js-debug.createDebuggerTerminal","onCommand:extension.js-debug.createDiagnostics","onCommand:extension.js-debug.getDiagnosticLogs","onCommand:extension.js-debug.debugLink","onCommand:extension.js-debug.npmScript","onCommand:extension.js-debug.pickNodeProcess","onCommand:extension.js-debug.prettyPrint","onCommand:extension.js-debug.removeAllCustomBreakpoints","onCommand:extension.js-debug.removeCustomBreakpoint","onCommand:extension.js-debug.revealPage","onCommand:extension.js-debug.startProfile","onCommand:extension.js-debug.stopProfile","onCommand:extension.js-debug.toggleSkippingFile","onCommand:extension.node-debug.startWithStopOnEntry","onCommand:extension.js-debug.requestCDPProxy","onCommand:extension.js-debug.openEdgeDevTools","onCommand:extension.js-debug.callers.add","onCommand:extension.js-debug.callers.goToCaller","onCommand:extension.js-debug.callers.gotToTarget","onCommand:extension.js-debug.callers.remove","onCommand:extension.js-debug.callers.removeAll","onCommand:extension.js-debug.enableSourceMapStepping","onCommand:extension.js-debug.disableSourceMapStepping","onDebugResolve:pwa-node","onDebugResolve:node-terminal","onDebugResolve:pwa-extensionHost","onDebugResolve:pwa-chrome","onDebugResolve:pwa-msedge","onDebugResolve:node","onDebugResolve:chrome","onDebugResolve:extensionHost","onDebugResolve:msedge","onView:jsBrowserBreakpoints","onView:jsExcludedCallers","onWebviewPanel:jsDebugDiagnostics"],"extensionKind":["workspace"],"contributes":{"terminal":{"profiles":[{"id":"extension.js-debug.debugTerminal","title":"JavaScript Debug Terminal","icon":"$(debug)"}]},"menus":{"commandPalette":[{"command":"extension.js-debug.prettyPrint","title":"Pretty print for debugging","when":"debugType == pwa-extensionHost && inDebugMode || debugType == node-terminal && inDebugMode || debugType == pwa-node && inDebugMode || debugType == pwa-chrome && inDebugMode || debugType == pwa-msedge && inDebugMode"},{"command":"extension.js-debug.startProfile","title":"Take Performance Profile","when":"debugType == pwa-extensionHost && inDebugMode && !jsDebugIsProfiling || debugType == node-terminal && inDebugMode && !jsDebugIsProfiling || debugType == pwa-node && inDebugMode && !jsDebugIsProfiling || debugType == pwa-chrome && inDebugMode && !jsDebugIsProfiling || debugType == pwa-msedge && inDebugMode && !jsDebugIsProfiling"},{"command":"extension.js-debug.stopProfile","title":"Stop Performance Profile","when":"debugType == pwa-extensionHost && inDebugMode && jsDebugIsProfiling || debugType == node-terminal && inDebugMode && jsDebugIsProfiling || debugType == pwa-node && inDebugMode && jsDebugIsProfiling || debugType == pwa-chrome && inDebugMode && jsDebugIsProfiling || debugType == pwa-msedge && inDebugMode && jsDebugIsProfiling"},{"command":"extension.js-debug.revealPage","when":"false"},{"command":"extension.js-debug.debugLink","title":"Open Link","when":"!isWeb"},{"command":"extension.js-debug.createDiagnostics","title":"Diagnose Breakpoint Problems","when":"debugType == pwa-extensionHost && inDebugMode || debugType == node-terminal && inDebugMode || debugType == pwa-node && inDebugMode || debugType == pwa-chrome && inDebugMode || debugType == pwa-msedge && inDebugMode"},{"command":"extension.js-debug.getDiagnosticLogs","title":"Save Diagnostic JS Debug Logs","when":"debugType == pwa-extensionHost && inDebugMode || debugType == node-terminal && inDebugMode || debugType == pwa-node && inDebugMode || debugType == pwa-chrome && inDebugMode || debugType == pwa-msedge && inDebugMode"},{"command":"extension.js-debug.openEdgeDevTools","title":"Open Browser Devtools","when":"debugType == pwa-msedge"},{"command":"extension.js-debug.callers.add","title":"Exclude caller from pausing in the current location","when":"debugType == pwa-extensionHost && debugState == \"stopped\" || debugType == node-terminal && debugState == \"stopped\" || debugType == pwa-node && debugState == \"stopped\" || debugType == pwa-chrome && debugState == \"stopped\" || debugType == pwa-msedge && debugState == \"stopped\""},{"command":"extension.js-debug.callers.goToCaller","when":"false"},{"command":"extension.js-debug.callers.gotToTarget","when":"false"},{"command":"extension.js-debug.enableSourceMapStepping","when":"jsDebugIsMapSteppingDisabled"},{"command":"extension.js-debug.disableSourceMapStepping","when":"!jsDebugIsMapSteppingDisabled"},{"command":"extension.js-debug.enableSourceMapStepping","when":"jsDebugIsMapSteppingDisabled"}],"debug/callstack/context":[{"command":"extension.js-debug.revealPage","group":"navigation","when":"debugType == pwa-chrome && callStackItemType == 'session' || debugType == pwa-msedge && callStackItemType == 'session'"},{"command":"extension.js-debug.toggleSkippingFile","group":"navigation","when":"debugType == pwa-extensionHost && callStackItemType == 'session' || debugType == node-terminal && callStackItemType == 'session' || debugType == pwa-node && callStackItemType == 'session' || debugType == pwa-chrome && callStackItemType == 'session' || debugType == pwa-msedge && callStackItemType == 'session'"},{"command":"extension.js-debug.startProfile","group":"navigation","when":"debugType == pwa-extensionHost && !jsDebugIsProfiling && callStackItemType == 'session' || debugType == node-terminal && !jsDebugIsProfiling && callStackItemType == 'session' || debugType == pwa-node && !jsDebugIsProfiling && callStackItemType == 'session' || debugType == pwa-chrome && !jsDebugIsProfiling && callStackItemType == 'session' || debugType == pwa-msedge && !jsDebugIsProfiling && callStackItemType == 'session'"},{"command":"extension.js-debug.stopProfile","group":"navigation","when":"debugType == pwa-extensionHost && jsDebugIsProfiling && callStackItemType == 'session' || debugType == node-terminal && jsDebugIsProfiling && callStackItemType == 'session' || debugType == pwa-node && jsDebugIsProfiling && callStackItemType == 'session' || debugType == pwa-chrome && jsDebugIsProfiling && callStackItemType == 'session' || debugType == pwa-msedge && jsDebugIsProfiling && callStackItemType == 'session'"},{"command":"extension.js-debug.startProfile","group":"inline","when":"debugType == pwa-extensionHost && !jsDebugIsProfiling || debugType == node-terminal && !jsDebugIsProfiling || debugType == pwa-node && !jsDebugIsProfiling || debugType == pwa-chrome && !jsDebugIsProfiling || debugType == pwa-msedge && !jsDebugIsProfiling"},{"command":"extension.js-debug.stopProfile","group":"inline","when":"debugType == pwa-extensionHost && jsDebugIsProfiling || debugType == node-terminal && jsDebugIsProfiling || debugType == pwa-node && jsDebugIsProfiling || debugType == pwa-chrome && jsDebugIsProfiling || debugType == pwa-msedge && jsDebugIsProfiling"},{"command":"extension.js-debug.callers.add","when":"debugType == pwa-extensionHost && callStackItemType == 'stackFrame' || debugType == node-terminal && callStackItemType == 'stackFrame' || debugType == pwa-node && callStackItemType == 'stackFrame' || debugType == pwa-chrome && callStackItemType == 'stackFrame' || debugType == pwa-msedge && callStackItemType == 'stackFrame'"}],"debug/toolBar":[{"command":"extension.js-debug.stopProfile","when":"debugType == pwa-extensionHost && jsDebugIsProfiling || debugType == node-terminal && jsDebugIsProfiling || debugType == pwa-node && jsDebugIsProfiling || debugType == pwa-chrome && jsDebugIsProfiling || debugType == pwa-msedge && jsDebugIsProfiling"},{"command":"extension.js-debug.openEdgeDevTools","when":"debugType == pwa-msedge"},{"command":"extension.js-debug.enableSourceMapStepping","when":"jsDebugIsMapSteppingDisabled"}],"view/title":[{"command":"extension.js-debug.addCustomBreakpoints","when":"view == jsBrowserBreakpoints"},{"command":"extension.js-debug.removeAllCustomBreakpoints","when":"view == jsBrowserBreakpoints"},{"command":"extension.js-debug.callers.removeAll","group":"navigation","when":"view == jsExcludedCallers"},{"command":"extension.js-debug.disableSourceMapStepping","group":"navigation","when":"debugType == pwa-extensionHost && view == workbench.debug.callStackView && !jsDebugIsMapSteppingDisabled || debugType == node-terminal && view == workbench.debug.callStackView && !jsDebugIsMapSteppingDisabled || debugType == pwa-node && view == workbench.debug.callStackView && !jsDebugIsMapSteppingDisabled || debugType == pwa-chrome && view == workbench.debug.callStackView && !jsDebugIsMapSteppingDisabled || debugType == pwa-msedge && view == workbench.debug.callStackView && !jsDebugIsMapSteppingDisabled"},{"command":"extension.js-debug.enableSourceMapStepping","group":"navigation","when":"debugType == pwa-extensionHost && view == workbench.debug.callStackView && jsDebugIsMapSteppingDisabled || debugType == node-terminal && view == workbench.debug.callStackView && jsDebugIsMapSteppingDisabled || debugType == pwa-node && view == workbench.debug.callStackView && jsDebugIsMapSteppingDisabled || debugType == pwa-chrome && view == workbench.debug.callStackView && jsDebugIsMapSteppingDisabled || debugType == pwa-msedge && view == workbench.debug.callStackView && jsDebugIsMapSteppingDisabled"}],"view/item/context":[{"command":"extension.js-debug.removeCustomBreakpoint","when":"view == jsBrowserBreakpoints","group":"inline"},{"command":"extension.js-debug.addCustomBreakpoints","when":"view == jsBrowserBreakpoints"},{"command":"extension.js-debug.removeCustomBreakpoint","when":"view == jsBrowserBreakpoints"},{"command":"extension.js-debug.callers.goToCaller","group":"inline","when":"view == jsExcludedCallers"},{"command":"extension.js-debug.callers.gotToTarget","group":"inline","when":"view == jsExcludedCallers"},{"command":"extension.js-debug.callers.remove","group":"inline","when":"view == jsExcludedCallers"}],"editor/title":[{"command":"extension.js-debug.prettyPrint","group":"navigation","when":"resource in jsDebugCanPrettyPrint"}]},"breakpoints":[{"language":"javascript"},{"language":"typescript"},{"language":"typescriptreact"},{"language":"javascriptreact"},{"language":"fsharp"},{"language":"html"}],"debuggers":[{"aiKey":"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255","configurationAttributes":{"attach":{"properties":{"address":{"default":"localhost","description":"TCP/IP address of process to be debugged. Default is 'localhost'.","type":"string"},"attachExistingChildren":{"default":false,"description":"Whether to attempt to attach to already-spawned child processes.","type":"boolean"},"autoAttachChildProcesses":{"default":true,"description":"Attach debugger to new child processes automatically.","type":"boolean"},"cascadeTerminateToConfigurations":{"default":[],"description":"A list of debug sessions which, when this debug session is terminated, will also be stopped.","items":{"type":"string","uniqueItems":true},"type":"array"},"continueOnAttach":{"default":true,"markdownDescription":"If true, we'll automatically resume programs launched and waiting on `--inspect-brk`","type":"boolean"},"customDescriptionGenerator":{"description":"Customize the textual description the debugger shows for objects (local variables, etc...). Samples:\n 1. this.toString() // will call toString to print all objects\n 2. this.customDescription ? this.customDescription() : defaultValue // Use customDescription method if available, if not return defaultValue\n 3. function (def) { return this.customDescription ? this.customDescription() : def } // Use customDescription method if available, if not return defaultValue\n ","type":"string"},"customPropertiesGenerator":{"deprecated":true,"description":"Customize the properties shown for an object in the debugger (local variables, etc...). Samples:\n 1. { ...this, extraProperty: '12345' } // Add an extraProperty 12345 to all objects\n 2. this.customProperties ? this.customProperties() : this // Use customProperties method if available, if not use the properties in this (the default properties)\n 3. function () { return this.customProperties ? this.customProperties() : this } // Use customDescription method if available, if not return the default properties\n\n Deprecated: This is a temporary implementation of this feature until we have time to implement it in the way described here: https://github.com/microsoft/vscode/issues/102181","type":"string"},"cwd":{"default":"${workspaceFolder}","description":"Absolute path to the working directory of the program being debugged. If you've set localRoot then cwd will match that value otherwise it falls back to your workspaceFolder","type":"string"},"enableContentValidation":{"default":true,"description":"Toggles whether we verify the contents of files on disk match the ones loaded in the runtime. This is useful in a variety of scenarios and required in some, but can cause issues if you have server-side transformation of scripts, for example.","type":"boolean"},"env":{"additionalProperties":{"type":["string","null"]},"default":{},"markdownDescription":"Environment variables passed to the program. The value `null` removes the variable from the environment.","type":"object"},"envFile":{"default":"${workspaceFolder}/.env","description":"Absolute path to a file containing environment variable definitions.","type":"string"},"localRoot":{"default":null,"description":"Path to the local directory containing the program.","type":["string","null"]},"nodeVersionHint":{"default":12,"description":"Allows you to explicitly specify the Node version that's running, which can be used to disable or enable certain behaviors in cases where the automatic version detection does not work.","minimum":8,"type":"number"},"outFiles":{"default":["${workspaceFolder}/**/*.js","!**/node_modules/**"],"description":"If source maps are enabled, these glob patterns specify the generated JavaScript files. If a pattern starts with `!` the files are excluded. If not specified, the generated code is expected in the same directory as its source.","items":{"type":"string"},"type":["array"]},"outputCapture":{"default":"console","enum":["console","std"],"markdownDescription":"From where to capture output messages: the default debug API if set to `console`, or stdout/stderr streams if set to `std`."},"pauseForSourceMap":{"default":false,"markdownDescription":"Whether to wait for source maps to load for each incoming script. This has a performance overhead, and might be safely disabled when running off of disk, so long as `rootPath` is not disabled.","type":"boolean"},"port":{"default":9229,"description":"Debug port to attach to. Default is 9229.","type":"number"},"processId":{"default":"${command:PickProcess}","description":"ID of process to attach to.","type":"string"},"remoteRoot":{"default":null,"description":"Absolute path to the remote directory containing the program.","type":["string","null"]},"resolveSourceMapLocations":{"default":["${workspaceFolder}/**","!**/node_modules/**"],"description":"A list of minimatch patterns for locations (folders and URLs) in which source maps can be used to resolve local files. This can be used to avoid incorrectly breaking in external source mapped code. Patterns can be prefixed with \"!\" to exclude them. May be set to an empty array or null to avoid restriction.","items":{"type":"string"},"type":["array","null"]},"restart":{"default":true,"description":"Try to reconnect to the program if we lose connection. If set to `true`, we'll try once a second, forever. You can customize the interval and maximum number of attempts by specifying the `delay` and `maxAttempts` in an object instead.","oneOf":[{"type":"boolean"},{"properties":{"delay":{"default":1000,"minimum":0,"type":"number"},"maxAttempts":{"default":10,"minimum":0,"type":"number"}},"type":"object"}]},"runtimeSourcemapPausePatterns":{"default":[],"items":{"type":"string"},"markdownDescription":"A list of patterns at which to manually insert entrypoint breakpoints. This can be useful to give the debugger an opportunity to set breakpoints when using sourcemaps that don't exist or can't be detected before launch, such as [with the Serverless framework](https://github.com/microsoft/vscode-js-debug/issues/492).","type":"array"},"showAsyncStacks":{"default":true,"description":"Show the async calls that led to the current call stack.","oneOf":[{"type":"boolean"},{"properties":{"onAttach":{"default":32,"type":"number"}},"required":["onAttach"],"type":"object"},{"properties":{"onceBreakpointResolved":{"default":32,"type":"number"}},"required":["onceBreakpointResolved"],"type":"object"}]},"skipFiles":{"default":["/**"],"description":"An array of file or folder names, or path globs, to skip when debugging. Star patterns and negations are allowed, for example, `[\"**/node_modules/**\", \"!**/node_modules/my-module/**\"]`","type":"array"},"smartStep":{"default":true,"description":"Automatically step through generated code that cannot be mapped back to the original source.","type":"boolean"},"sourceMapPathOverrides":{"default":{"meteor://💻app/*":"${workspaceFolder}/*","webpack:///./~/*":"${workspaceFolder}/node_modules/*","webpack://?:*/*":"${workspaceFolder}/*"},"description":"A set of mappings for rewriting the locations of source files from what the sourcemap says, to their locations on disk.","type":"object"},"sourceMapRenames":{"default":true,"description":"Whether to use the \"names\" mapping in sourcemaps. This requires requesting source content, which can be slow with certain debuggers.","type":"boolean"},"sourceMaps":{"default":true,"description":"Use JavaScript source maps (if they exist).","type":"boolean"},"timeout":{"default":10000,"description":"Retry for this number of milliseconds to connect to Node.js. Default is 10000 ms.","type":"number"},"timeouts":{"additionalProperties":false,"default":{},"description":"Timeouts for several debugger operations.","markdownDescription":"Timeouts for several debugger operations.","properties":{"hoverEvaluation":{"default":500,"description":"Time until value evaluation for hovered symbols is aborted. If set to 0, hover evaluation does never time out.","type":"number"},"sourceMapCumulativePause":{"default":1000,"description":"Extra time in milliseconds allowed per session to be spent waiting for source-maps to be processed, after the minimum time (sourceMapMinPause) has been exhausted","type":"number"},"sourceMapMinPause":{"default":1000,"description":"Minimum time in milliseconds spent waiting for each source-map to be processed when a script is being parsed","type":"number"}},"type":"object"},"trace":{"default":true,"description":"Configures what diagnostic output is produced.","oneOf":[{"description":"Trace may be set to 'true' to write diagnostic logs to the disk.","type":"boolean"},{"additionalProperties":false,"properties":{"logFile":{"description":"Configures where on disk logs are written.","type":["string","null"]},"stdio":{"description":"Whether to return trace data from the launched application or browser.","type":"boolean"}},"type":"object"}]},"websocketAddress":{"description":"Exact websocket address to attach to. If unspecified, it will be discovered from the address and port.","type":"string"}}},"launch":{"properties":{"args":{"default":[],"description":"Command line arguments passed to the program.\n\nCan be an array of strings or a single string. When the program is launched in a terminal, setting this property to a single string will result in the arguments not being escaped for the shell.","items":{"type":"string"},"type":["array","string"]},"attachSimplePort":{"default":9229,"description":"If set, attaches to the process via the given port. This is generally no longer necessary for Node.js programs and loses the ability to debug child processes, but can be useful in more esoteric scenarios such as with Deno and Docker launches. If set to 0, a random port will be chosen and --inspect-brk added to the launch arguments automatically.","type":"integer"},"autoAttachChildProcesses":{"default":true,"description":"Attach debugger to new child processes automatically.","type":"boolean"},"cascadeTerminateToConfigurations":{"default":[],"description":"A list of debug sessions which, when this debug session is terminated, will also be stopped.","items":{"type":"string","uniqueItems":true},"type":"array"},"console":{"default":"internalConsole","description":"Where to launch the debug target.","enum":["internalConsole","integratedTerminal","externalTerminal"],"enumDescriptions":["VS Code Debug Console (which doesn't support to read input from a program)","VS Code's integrated terminal","External terminal that can be configured via user settings"],"type":"string"},"customDescriptionGenerator":{"description":"Customize the textual description the debugger shows for objects (local variables, etc...). Samples:\n 1. this.toString() // will call toString to print all objects\n 2. this.customDescription ? this.customDescription() : defaultValue // Use customDescription method if available, if not return defaultValue\n 3. function (def) { return this.customDescription ? this.customDescription() : def } // Use customDescription method if available, if not return defaultValue\n ","type":"string"},"customPropertiesGenerator":{"deprecated":true,"description":"Customize the properties shown for an object in the debugger (local variables, etc...). Samples:\n 1. { ...this, extraProperty: '12345' } // Add an extraProperty 12345 to all objects\n 2. this.customProperties ? this.customProperties() : this // Use customProperties method if available, if not use the properties in this (the default properties)\n 3. function () { return this.customProperties ? this.customProperties() : this } // Use customDescription method if available, if not return the default properties\n\n Deprecated: This is a temporary implementation of this feature until we have time to implement it in the way described here: https://github.com/microsoft/vscode/issues/102181","type":"string"},"cwd":{"default":"${workspaceFolder}","description":"Absolute path to the working directory of the program being debugged. If you've set localRoot then cwd will match that value otherwise it falls back to your workspaceFolder","type":"string"},"enableContentValidation":{"default":true,"description":"Toggles whether we verify the contents of files on disk match the ones loaded in the runtime. This is useful in a variety of scenarios and required in some, but can cause issues if you have server-side transformation of scripts, for example.","type":"boolean"},"env":{"additionalProperties":{"type":["string","null"]},"default":{},"markdownDescription":"Environment variables passed to the program. The value `null` removes the variable from the environment.","type":"object"},"envFile":{"default":"${workspaceFolder}/.env","description":"Absolute path to a file containing environment variable definitions.","type":"string"},"killBehavior":{"default":"forceful","enum":["forceful","polite","none"],"markdownDescription":"Configures how debug processes are killed when stopping the session. Can be:\n\n- forceful (default): forcefully tears down the process tree. Sends SIGKILL on posix, or `taskkill.exe /F` on Windows.\n- polite: gracefully tears down the process tree. It's possible that misbehaving processes continue to run after shutdown in this way. Sends SIGTERM on posix, or `taskkill.exe` with no `/F` (force) flag on Windows.\n- none: no termination will happen.","type":"string"},"localRoot":{"default":null,"description":"Path to the local directory containing the program.","type":["string","null"]},"nodeVersionHint":{"default":12,"description":"Allows you to explicitly specify the Node version that's running, which can be used to disable or enable certain behaviors in cases where the automatic version detection does not work.","minimum":8,"type":"number"},"outFiles":{"default":["${workspaceFolder}/**/*.js","!**/node_modules/**"],"description":"If source maps are enabled, these glob patterns specify the generated JavaScript files. If a pattern starts with `!` the files are excluded. If not specified, the generated code is expected in the same directory as its source.","items":{"type":"string"},"type":["array"]},"outputCapture":{"default":"console","enum":["console","std"],"markdownDescription":"From where to capture output messages: the default debug API if set to `console`, or stdout/stderr streams if set to `std`."},"pauseForSourceMap":{"default":false,"markdownDescription":"Whether to wait for source maps to load for each incoming script. This has a performance overhead, and might be safely disabled when running off of disk, so long as `rootPath` is not disabled.","type":"boolean"},"profileStartup":{"default":true,"description":"If true, will start profiling as soon as the process launches","type":"boolean"},"program":{"default":"","description":"Absolute path to the program. Generated value is guessed by looking at package.json and opened files. Edit this attribute.","type":"string"},"remoteRoot":{"default":null,"description":"Absolute path to the remote directory containing the program.","type":["string","null"]},"resolveSourceMapLocations":{"default":["${workspaceFolder}/**","!**/node_modules/**"],"description":"A list of minimatch patterns for locations (folders and URLs) in which source maps can be used to resolve local files. This can be used to avoid incorrectly breaking in external source mapped code. Patterns can be prefixed with \"!\" to exclude them. May be set to an empty array or null to avoid restriction.","items":{"type":"string"},"type":["array","null"]},"restart":{"default":true,"description":"Try to reconnect to the program if we lose connection. If set to `true`, we'll try once a second, forever. You can customize the interval and maximum number of attempts by specifying the `delay` and `maxAttempts` in an object instead.","oneOf":[{"type":"boolean"},{"properties":{"delay":{"default":1000,"minimum":0,"type":"number"},"maxAttempts":{"default":10,"minimum":0,"type":"number"}},"type":"object"}]},"runtimeArgs":{"default":[],"description":"Optional arguments passed to the runtime executable.","items":{"type":"string"},"type":"array"},"runtimeExecutable":{"default":"node","markdownDescription":"Runtime to use. Either an absolute path or the name of a runtime available on the PATH. If omitted `node` is assumed.","type":["string","null"]},"runtimeSourcemapPausePatterns":{"default":[],"items":{"type":"string"},"markdownDescription":"A list of patterns at which to manually insert entrypoint breakpoints. This can be useful to give the debugger an opportunity to set breakpoints when using sourcemaps that don't exist or can't be detected before launch, such as [with the Serverless framework](https://github.com/microsoft/vscode-js-debug/issues/492).","type":"array"},"runtimeVersion":{"default":"default","markdownDescription":"Version of `node` runtime to use. Requires `nvm`.","type":"string"},"showAsyncStacks":{"default":true,"description":"Show the async calls that led to the current call stack.","oneOf":[{"type":"boolean"},{"properties":{"onAttach":{"default":32,"type":"number"}},"required":["onAttach"],"type":"object"},{"properties":{"onceBreakpointResolved":{"default":32,"type":"number"}},"required":["onceBreakpointResolved"],"type":"object"}]},"skipFiles":{"default":["/**"],"description":"An array of file or folder names, or path globs, to skip when debugging. Star patterns and negations are allowed, for example, `[\"**/node_modules/**\", \"!**/node_modules/my-module/**\"]`","type":"array"},"smartStep":{"default":true,"description":"Automatically step through generated code that cannot be mapped back to the original source.","type":"boolean"},"sourceMapPathOverrides":{"default":{"meteor://💻app/*":"${workspaceFolder}/*","webpack:///./~/*":"${workspaceFolder}/node_modules/*","webpack://?:*/*":"${workspaceFolder}/*"},"description":"A set of mappings for rewriting the locations of source files from what the sourcemap says, to their locations on disk.","type":"object"},"sourceMapRenames":{"default":true,"description":"Whether to use the \"names\" mapping in sourcemaps. This requires requesting source content, which can be slow with certain debuggers.","type":"boolean"},"sourceMaps":{"default":true,"description":"Use JavaScript source maps (if they exist).","type":"boolean"},"stopOnEntry":{"default":true,"description":"Automatically stop program after launch.","type":["boolean","string"]},"timeout":{"default":10000,"description":"Retry for this number of milliseconds to connect to Node.js. Default is 10000 ms.","type":"number"},"timeouts":{"additionalProperties":false,"default":{},"description":"Timeouts for several debugger operations.","markdownDescription":"Timeouts for several debugger operations.","properties":{"hoverEvaluation":{"default":500,"description":"Time until value evaluation for hovered symbols is aborted. If set to 0, hover evaluation does never time out.","type":"number"},"sourceMapCumulativePause":{"default":1000,"description":"Extra time in milliseconds allowed per session to be spent waiting for source-maps to be processed, after the minimum time (sourceMapMinPause) has been exhausted","type":"number"},"sourceMapMinPause":{"default":1000,"description":"Minimum time in milliseconds spent waiting for each source-map to be processed when a script is being parsed","type":"number"}},"type":"object"},"trace":{"default":true,"description":"Configures what diagnostic output is produced.","oneOf":[{"description":"Trace may be set to 'true' to write diagnostic logs to the disk.","type":"boolean"},{"additionalProperties":false,"properties":{"logFile":{"description":"Configures where on disk logs are written.","type":["string","null"]},"stdio":{"description":"Whether to return trace data from the launched application or browser.","type":"boolean"}},"type":"object"}]}}}},"configurationSnippets":[],"deprecated":"Please use type node instead","label":"Node.js","languages":["javascript","typescript","javascriptreact","typescriptreact"],"strings":{"unverifiedBreakpoints":"Some of your breakpoints could not be set. If you're having an issue, you can [troubleshoot your launch configuration](command:extension.js-debug.createDiagnostics)."},"type":"pwa-node","variables":{"PickProcess":"extension.js-debug.pickNodeProcess"}},{"aiKey":"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255","configurationAttributes":{"attach":{"properties":{"address":{"default":"localhost","description":"TCP/IP address of process to be debugged. Default is 'localhost'.","type":"string"},"attachExistingChildren":{"default":false,"description":"Whether to attempt to attach to already-spawned child processes.","type":"boolean"},"autoAttachChildProcesses":{"default":true,"description":"Attach debugger to new child processes automatically.","type":"boolean"},"cascadeTerminateToConfigurations":{"default":[],"description":"A list of debug sessions which, when this debug session is terminated, will also be stopped.","items":{"type":"string","uniqueItems":true},"type":"array"},"continueOnAttach":{"default":true,"markdownDescription":"If true, we'll automatically resume programs launched and waiting on `--inspect-brk`","type":"boolean"},"customDescriptionGenerator":{"description":"Customize the textual description the debugger shows for objects (local variables, etc...). Samples:\n 1. this.toString() // will call toString to print all objects\n 2. this.customDescription ? this.customDescription() : defaultValue // Use customDescription method if available, if not return defaultValue\n 3. function (def) { return this.customDescription ? this.customDescription() : def } // Use customDescription method if available, if not return defaultValue\n ","type":"string"},"customPropertiesGenerator":{"deprecated":true,"description":"Customize the properties shown for an object in the debugger (local variables, etc...). Samples:\n 1. { ...this, extraProperty: '12345' } // Add an extraProperty 12345 to all objects\n 2. this.customProperties ? this.customProperties() : this // Use customProperties method if available, if not use the properties in this (the default properties)\n 3. function () { return this.customProperties ? this.customProperties() : this } // Use customDescription method if available, if not return the default properties\n\n Deprecated: This is a temporary implementation of this feature until we have time to implement it in the way described here: https://github.com/microsoft/vscode/issues/102181","type":"string"},"cwd":{"default":"${workspaceFolder}","description":"Absolute path to the working directory of the program being debugged. If you've set localRoot then cwd will match that value otherwise it falls back to your workspaceFolder","type":"string"},"enableContentValidation":{"default":true,"description":"Toggles whether we verify the contents of files on disk match the ones loaded in the runtime. This is useful in a variety of scenarios and required in some, but can cause issues if you have server-side transformation of scripts, for example.","type":"boolean"},"env":{"additionalProperties":{"type":["string","null"]},"default":{},"markdownDescription":"Environment variables passed to the program. The value `null` removes the variable from the environment.","type":"object"},"envFile":{"default":"${workspaceFolder}/.env","description":"Absolute path to a file containing environment variable definitions.","type":"string"},"localRoot":{"default":null,"description":"Path to the local directory containing the program.","type":["string","null"]},"nodeVersionHint":{"default":12,"description":"Allows you to explicitly specify the Node version that's running, which can be used to disable or enable certain behaviors in cases where the automatic version detection does not work.","minimum":8,"type":"number"},"outFiles":{"default":["${workspaceFolder}/**/*.js","!**/node_modules/**"],"description":"If source maps are enabled, these glob patterns specify the generated JavaScript files. If a pattern starts with `!` the files are excluded. If not specified, the generated code is expected in the same directory as its source.","items":{"type":"string"},"type":["array"]},"outputCapture":{"default":"console","enum":["console","std"],"markdownDescription":"From where to capture output messages: the default debug API if set to `console`, or stdout/stderr streams if set to `std`."},"pauseForSourceMap":{"default":false,"markdownDescription":"Whether to wait for source maps to load for each incoming script. This has a performance overhead, and might be safely disabled when running off of disk, so long as `rootPath` is not disabled.","type":"boolean"},"port":{"default":9229,"description":"Debug port to attach to. Default is 9229.","type":"number"},"processId":{"default":"${command:PickProcess}","description":"ID of process to attach to.","type":"string"},"remoteRoot":{"default":null,"description":"Absolute path to the remote directory containing the program.","type":["string","null"]},"resolveSourceMapLocations":{"default":["${workspaceFolder}/**","!**/node_modules/**"],"description":"A list of minimatch patterns for locations (folders and URLs) in which source maps can be used to resolve local files. This can be used to avoid incorrectly breaking in external source mapped code. Patterns can be prefixed with \"!\" to exclude them. May be set to an empty array or null to avoid restriction.","items":{"type":"string"},"type":["array","null"]},"restart":{"default":true,"description":"Try to reconnect to the program if we lose connection. If set to `true`, we'll try once a second, forever. You can customize the interval and maximum number of attempts by specifying the `delay` and `maxAttempts` in an object instead.","oneOf":[{"type":"boolean"},{"properties":{"delay":{"default":1000,"minimum":0,"type":"number"},"maxAttempts":{"default":10,"minimum":0,"type":"number"}},"type":"object"}]},"runtimeSourcemapPausePatterns":{"default":[],"items":{"type":"string"},"markdownDescription":"A list of patterns at which to manually insert entrypoint breakpoints. This can be useful to give the debugger an opportunity to set breakpoints when using sourcemaps that don't exist or can't be detected before launch, such as [with the Serverless framework](https://github.com/microsoft/vscode-js-debug/issues/492).","type":"array"},"showAsyncStacks":{"default":true,"description":"Show the async calls that led to the current call stack.","oneOf":[{"type":"boolean"},{"properties":{"onAttach":{"default":32,"type":"number"}},"required":["onAttach"],"type":"object"},{"properties":{"onceBreakpointResolved":{"default":32,"type":"number"}},"required":["onceBreakpointResolved"],"type":"object"}]},"skipFiles":{"default":["/**"],"description":"An array of file or folder names, or path globs, to skip when debugging. Star patterns and negations are allowed, for example, `[\"**/node_modules/**\", \"!**/node_modules/my-module/**\"]`","type":"array"},"smartStep":{"default":true,"description":"Automatically step through generated code that cannot be mapped back to the original source.","type":"boolean"},"sourceMapPathOverrides":{"default":{"meteor://💻app/*":"${workspaceFolder}/*","webpack:///./~/*":"${workspaceFolder}/node_modules/*","webpack://?:*/*":"${workspaceFolder}/*"},"description":"A set of mappings for rewriting the locations of source files from what the sourcemap says, to their locations on disk.","type":"object"},"sourceMapRenames":{"default":true,"description":"Whether to use the \"names\" mapping in sourcemaps. This requires requesting source content, which can be slow with certain debuggers.","type":"boolean"},"sourceMaps":{"default":true,"description":"Use JavaScript source maps (if they exist).","type":"boolean"},"timeout":{"default":10000,"description":"Retry for this number of milliseconds to connect to Node.js. Default is 10000 ms.","type":"number"},"timeouts":{"additionalProperties":false,"default":{},"description":"Timeouts for several debugger operations.","markdownDescription":"Timeouts for several debugger operations.","properties":{"hoverEvaluation":{"default":500,"description":"Time until value evaluation for hovered symbols is aborted. If set to 0, hover evaluation does never time out.","type":"number"},"sourceMapCumulativePause":{"default":1000,"description":"Extra time in milliseconds allowed per session to be spent waiting for source-maps to be processed, after the minimum time (sourceMapMinPause) has been exhausted","type":"number"},"sourceMapMinPause":{"default":1000,"description":"Minimum time in milliseconds spent waiting for each source-map to be processed when a script is being parsed","type":"number"}},"type":"object"},"trace":{"default":true,"description":"Configures what diagnostic output is produced.","oneOf":[{"description":"Trace may be set to 'true' to write diagnostic logs to the disk.","type":"boolean"},{"additionalProperties":false,"properties":{"logFile":{"description":"Configures where on disk logs are written.","type":["string","null"]},"stdio":{"description":"Whether to return trace data from the launched application or browser.","type":"boolean"}},"type":"object"}]},"websocketAddress":{"description":"Exact websocket address to attach to. If unspecified, it will be discovered from the address and port.","type":"string"}}},"launch":{"properties":{"args":{"default":[],"description":"Command line arguments passed to the program.\n\nCan be an array of strings or a single string. When the program is launched in a terminal, setting this property to a single string will result in the arguments not being escaped for the shell.","items":{"type":"string"},"type":["array","string"]},"attachSimplePort":{"default":9229,"description":"If set, attaches to the process via the given port. This is generally no longer necessary for Node.js programs and loses the ability to debug child processes, but can be useful in more esoteric scenarios such as with Deno and Docker launches. If set to 0, a random port will be chosen and --inspect-brk added to the launch arguments automatically.","type":"integer"},"autoAttachChildProcesses":{"default":true,"description":"Attach debugger to new child processes automatically.","type":"boolean"},"cascadeTerminateToConfigurations":{"default":[],"description":"A list of debug sessions which, when this debug session is terminated, will also be stopped.","items":{"type":"string","uniqueItems":true},"type":"array"},"console":{"default":"internalConsole","description":"Where to launch the debug target.","enum":["internalConsole","integratedTerminal","externalTerminal"],"enumDescriptions":["VS Code Debug Console (which doesn't support to read input from a program)","VS Code's integrated terminal","External terminal that can be configured via user settings"],"type":"string"},"customDescriptionGenerator":{"description":"Customize the textual description the debugger shows for objects (local variables, etc...). Samples:\n 1. this.toString() // will call toString to print all objects\n 2. this.customDescription ? this.customDescription() : defaultValue // Use customDescription method if available, if not return defaultValue\n 3. function (def) { return this.customDescription ? this.customDescription() : def } // Use customDescription method if available, if not return defaultValue\n ","type":"string"},"customPropertiesGenerator":{"deprecated":true,"description":"Customize the properties shown for an object in the debugger (local variables, etc...). Samples:\n 1. { ...this, extraProperty: '12345' } // Add an extraProperty 12345 to all objects\n 2. this.customProperties ? this.customProperties() : this // Use customProperties method if available, if not use the properties in this (the default properties)\n 3. function () { return this.customProperties ? this.customProperties() : this } // Use customDescription method if available, if not return the default properties\n\n Deprecated: This is a temporary implementation of this feature until we have time to implement it in the way described here: https://github.com/microsoft/vscode/issues/102181","type":"string"},"cwd":{"default":"${workspaceFolder}","description":"Absolute path to the working directory of the program being debugged. If you've set localRoot then cwd will match that value otherwise it falls back to your workspaceFolder","type":"string"},"enableContentValidation":{"default":true,"description":"Toggles whether we verify the contents of files on disk match the ones loaded in the runtime. This is useful in a variety of scenarios and required in some, but can cause issues if you have server-side transformation of scripts, for example.","type":"boolean"},"env":{"additionalProperties":{"type":["string","null"]},"default":{},"markdownDescription":"Environment variables passed to the program. The value `null` removes the variable from the environment.","type":"object"},"envFile":{"default":"${workspaceFolder}/.env","description":"Absolute path to a file containing environment variable definitions.","type":"string"},"killBehavior":{"default":"forceful","enum":["forceful","polite","none"],"markdownDescription":"Configures how debug processes are killed when stopping the session. Can be:\n\n- forceful (default): forcefully tears down the process tree. Sends SIGKILL on posix, or `taskkill.exe /F` on Windows.\n- polite: gracefully tears down the process tree. It's possible that misbehaving processes continue to run after shutdown in this way. Sends SIGTERM on posix, or `taskkill.exe` with no `/F` (force) flag on Windows.\n- none: no termination will happen.","type":"string"},"localRoot":{"default":null,"description":"Path to the local directory containing the program.","type":["string","null"]},"nodeVersionHint":{"default":12,"description":"Allows you to explicitly specify the Node version that's running, which can be used to disable or enable certain behaviors in cases where the automatic version detection does not work.","minimum":8,"type":"number"},"outFiles":{"default":["${workspaceFolder}/**/*.js","!**/node_modules/**"],"description":"If source maps are enabled, these glob patterns specify the generated JavaScript files. If a pattern starts with `!` the files are excluded. If not specified, the generated code is expected in the same directory as its source.","items":{"type":"string"},"type":["array"]},"outputCapture":{"default":"console","enum":["console","std"],"markdownDescription":"From where to capture output messages: the default debug API if set to `console`, or stdout/stderr streams if set to `std`."},"pauseForSourceMap":{"default":false,"markdownDescription":"Whether to wait for source maps to load for each incoming script. This has a performance overhead, and might be safely disabled when running off of disk, so long as `rootPath` is not disabled.","type":"boolean"},"profileStartup":{"default":true,"description":"If true, will start profiling as soon as the process launches","type":"boolean"},"program":{"default":"","description":"Absolute path to the program. Generated value is guessed by looking at package.json and opened files. Edit this attribute.","type":"string"},"remoteRoot":{"default":null,"description":"Absolute path to the remote directory containing the program.","type":["string","null"]},"resolveSourceMapLocations":{"default":["${workspaceFolder}/**","!**/node_modules/**"],"description":"A list of minimatch patterns for locations (folders and URLs) in which source maps can be used to resolve local files. This can be used to avoid incorrectly breaking in external source mapped code. Patterns can be prefixed with \"!\" to exclude them. May be set to an empty array or null to avoid restriction.","items":{"type":"string"},"type":["array","null"]},"restart":{"default":true,"description":"Try to reconnect to the program if we lose connection. If set to `true`, we'll try once a second, forever. You can customize the interval and maximum number of attempts by specifying the `delay` and `maxAttempts` in an object instead.","oneOf":[{"type":"boolean"},{"properties":{"delay":{"default":1000,"minimum":0,"type":"number"},"maxAttempts":{"default":10,"minimum":0,"type":"number"}},"type":"object"}]},"runtimeArgs":{"default":[],"description":"Optional arguments passed to the runtime executable.","items":{"type":"string"},"type":"array"},"runtimeExecutable":{"default":"node","markdownDescription":"Runtime to use. Either an absolute path or the name of a runtime available on the PATH. If omitted `node` is assumed.","type":["string","null"]},"runtimeSourcemapPausePatterns":{"default":[],"items":{"type":"string"},"markdownDescription":"A list of patterns at which to manually insert entrypoint breakpoints. This can be useful to give the debugger an opportunity to set breakpoints when using sourcemaps that don't exist or can't be detected before launch, such as [with the Serverless framework](https://github.com/microsoft/vscode-js-debug/issues/492).","type":"array"},"runtimeVersion":{"default":"default","markdownDescription":"Version of `node` runtime to use. Requires `nvm`.","type":"string"},"showAsyncStacks":{"default":true,"description":"Show the async calls that led to the current call stack.","oneOf":[{"type":"boolean"},{"properties":{"onAttach":{"default":32,"type":"number"}},"required":["onAttach"],"type":"object"},{"properties":{"onceBreakpointResolved":{"default":32,"type":"number"}},"required":["onceBreakpointResolved"],"type":"object"}]},"skipFiles":{"default":["/**"],"description":"An array of file or folder names, or path globs, to skip when debugging. Star patterns and negations are allowed, for example, `[\"**/node_modules/**\", \"!**/node_modules/my-module/**\"]`","type":"array"},"smartStep":{"default":true,"description":"Automatically step through generated code that cannot be mapped back to the original source.","type":"boolean"},"sourceMapPathOverrides":{"default":{"meteor://💻app/*":"${workspaceFolder}/*","webpack:///./~/*":"${workspaceFolder}/node_modules/*","webpack://?:*/*":"${workspaceFolder}/*"},"description":"A set of mappings for rewriting the locations of source files from what the sourcemap says, to their locations on disk.","type":"object"},"sourceMapRenames":{"default":true,"description":"Whether to use the \"names\" mapping in sourcemaps. This requires requesting source content, which can be slow with certain debuggers.","type":"boolean"},"sourceMaps":{"default":true,"description":"Use JavaScript source maps (if they exist).","type":"boolean"},"stopOnEntry":{"default":true,"description":"Automatically stop program after launch.","type":["boolean","string"]},"timeout":{"default":10000,"description":"Retry for this number of milliseconds to connect to Node.js. Default is 10000 ms.","type":"number"},"timeouts":{"additionalProperties":false,"default":{},"description":"Timeouts for several debugger operations.","markdownDescription":"Timeouts for several debugger operations.","properties":{"hoverEvaluation":{"default":500,"description":"Time until value evaluation for hovered symbols is aborted. If set to 0, hover evaluation does never time out.","type":"number"},"sourceMapCumulativePause":{"default":1000,"description":"Extra time in milliseconds allowed per session to be spent waiting for source-maps to be processed, after the minimum time (sourceMapMinPause) has been exhausted","type":"number"},"sourceMapMinPause":{"default":1000,"description":"Minimum time in milliseconds spent waiting for each source-map to be processed when a script is being parsed","type":"number"}},"type":"object"},"trace":{"default":true,"description":"Configures what diagnostic output is produced.","oneOf":[{"description":"Trace may be set to 'true' to write diagnostic logs to the disk.","type":"boolean"},{"additionalProperties":false,"properties":{"logFile":{"description":"Configures where on disk logs are written.","type":["string","null"]},"stdio":{"description":"Whether to return trace data from the launched application or browser.","type":"boolean"}},"type":"object"}]}}}},"configurationSnippets":[{"body":{"name":"${1:Attach}","port":9229,"request":"attach","skipFiles":["/**"],"type":"node"},"description":"Attach to a running node program","label":"Node.js: Attach"},{"body":{"address":"${2:TCP/IP address of process to be debugged}","localRoot":"^\"\\${workspaceFolder}\"","name":"${1:Attach to Remote}","port":9229,"remoteRoot":"${3:Absolute path to the remote directory containing the program}","request":"attach","skipFiles":["/**"],"type":"node"},"description":"Attach to the debug port of a remote node program","label":"Node.js: Attach to Remote Program"},{"body":{"name":"${1:Attach by Process ID}","processId":"^\"\\${command:PickProcess}\"","request":"attach","skipFiles":["/**"],"type":"node"},"description":"Open process picker to select node process to attach to","label":"Node.js: Attach to Process"},{"body":{"name":"${2:Launch Program}","program":"^\"\\${workspaceFolder}/${1:app.js}\"","request":"launch","skipFiles":["/**"],"type":"node"},"description":"Launch a node program in debug mode","label":"Node.js: Launch Program"},{"body":{"name":"${1:Launch via NPM}","request":"launch","runtimeArgs":["run-script","debug"],"runtimeExecutable":"npm","skipFiles":["/**"],"type":"node"},"label":"Node.js: Launch via npm","markdownDescription":"Launch a node program through an npm `debug` script"},{"body":{"console":"integratedTerminal","internalConsoleOptions":"neverOpen","name":"nodemon","program":"^\"\\${workspaceFolder}/${1:app.js}\"","request":"launch","restart":true,"runtimeExecutable":"nodemon","skipFiles":["/**"],"type":"node"},"description":"Use nodemon to relaunch a debug session on source changes","label":"Node.js: Nodemon Setup"},{"body":{"args":["-u","tdd","--timeout","999999","--colors","^\"\\${workspaceFolder}/${1:test}\""],"internalConsoleOptions":"openOnSessionStart","name":"Mocha Tests","program":"^\"\\${workspaceFolder}/node_modules/mocha/bin/_mocha\"","request":"launch","skipFiles":["/**"],"type":"node"},"description":"Debug mocha tests","label":"Node.js: Mocha Tests"},{"body":{"args":["${1:generator}"],"console":"integratedTerminal","internalConsoleOptions":"neverOpen","name":"Yeoman ${1:generator}","program":"^\"\\${workspaceFolder}/node_modules/yo/lib/cli.js\"","request":"launch","skipFiles":["/**"],"type":"node"},"label":"Node.js: Yeoman generator","markdownDescription":"Debug yeoman generator (install by running `npm link` in project folder)"},{"body":{"args":["${1:task}"],"name":"Gulp ${1:task}","program":"^\"\\${workspaceFolder}/node_modules/gulp/bin/gulp.js\"","request":"launch","skipFiles":["/**"],"type":"node"},"description":"Debug gulp task (make sure to have a local gulp installed in your project)","label":"Node.js: Gulp task"},{"body":{"name":"Electron Main","program":"^\"\\${workspaceFolder}/main.js\"","request":"launch","runtimeExecutable":"^\"\\${workspaceFolder}/node_modules/.bin/electron\"","skipFiles":["/**"],"type":"node"},"description":"Debug the Electron main process","label":"Node.js: Electron Main"}],"label":"Node.js","strings":{"unverifiedBreakpoints":"Some of your breakpoints could not be set. If you're having an issue, you can [troubleshoot your launch configuration](command:extension.js-debug.createDiagnostics)."},"type":"node","variables":{"PickProcess":"extension.js-debug.pickNodeProcess"}},{"aiKey":"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255","configurationAttributes":{"launch":{"properties":{"autoAttachChildProcesses":{"default":true,"description":"Attach debugger to new child processes automatically.","type":"boolean"},"cascadeTerminateToConfigurations":{"default":[],"description":"A list of debug sessions which, when this debug session is terminated, will also be stopped.","items":{"type":"string","uniqueItems":true},"type":"array"},"command":{"default":"npm start","description":"Command to run in the launched terminal. If not provided, the terminal will open without launching a program.","type":["string","null"]},"customDescriptionGenerator":{"description":"Customize the textual description the debugger shows for objects (local variables, etc...). Samples:\n 1. this.toString() // will call toString to print all objects\n 2. this.customDescription ? this.customDescription() : defaultValue // Use customDescription method if available, if not return defaultValue\n 3. function (def) { return this.customDescription ? this.customDescription() : def } // Use customDescription method if available, if not return defaultValue\n ","type":"string"},"customPropertiesGenerator":{"deprecated":true,"description":"Customize the properties shown for an object in the debugger (local variables, etc...). Samples:\n 1. { ...this, extraProperty: '12345' } // Add an extraProperty 12345 to all objects\n 2. this.customProperties ? this.customProperties() : this // Use customProperties method if available, if not use the properties in this (the default properties)\n 3. function () { return this.customProperties ? this.customProperties() : this } // Use customDescription method if available, if not return the default properties\n\n Deprecated: This is a temporary implementation of this feature until we have time to implement it in the way described here: https://github.com/microsoft/vscode/issues/102181","type":"string"},"cwd":{"default":"${workspaceFolder}","description":"Absolute path to the working directory of the program being debugged. If you've set localRoot then cwd will match that value otherwise it falls back to your workspaceFolder","type":"string"},"enableContentValidation":{"default":true,"description":"Toggles whether we verify the contents of files on disk match the ones loaded in the runtime. This is useful in a variety of scenarios and required in some, but can cause issues if you have server-side transformation of scripts, for example.","type":"boolean"},"env":{"additionalProperties":{"type":["string","null"]},"default":{},"markdownDescription":"Environment variables passed to the program. The value `null` removes the variable from the environment.","type":"object"},"envFile":{"default":"${workspaceFolder}/.env","description":"Absolute path to a file containing environment variable definitions.","type":"string"},"localRoot":{"default":null,"description":"Path to the local directory containing the program.","type":["string","null"]},"nodeVersionHint":{"default":12,"description":"Allows you to explicitly specify the Node version that's running, which can be used to disable or enable certain behaviors in cases where the automatic version detection does not work.","minimum":8,"type":"number"},"outFiles":{"default":["${workspaceFolder}/**/*.js","!**/node_modules/**"],"description":"If source maps are enabled, these glob patterns specify the generated JavaScript files. If a pattern starts with `!` the files are excluded. If not specified, the generated code is expected in the same directory as its source.","items":{"type":"string"},"type":["array"]},"outputCapture":{"default":"console","enum":["console","std"],"markdownDescription":"From where to capture output messages: the default debug API if set to `console`, or stdout/stderr streams if set to `std`."},"pauseForSourceMap":{"default":false,"markdownDescription":"Whether to wait for source maps to load for each incoming script. This has a performance overhead, and might be safely disabled when running off of disk, so long as `rootPath` is not disabled.","type":"boolean"},"remoteRoot":{"default":null,"description":"Absolute path to the remote directory containing the program.","type":["string","null"]},"resolveSourceMapLocations":{"default":["${workspaceFolder}/**","!**/node_modules/**"],"description":"A list of minimatch patterns for locations (folders and URLs) in which source maps can be used to resolve local files. This can be used to avoid incorrectly breaking in external source mapped code. Patterns can be prefixed with \"!\" to exclude them. May be set to an empty array or null to avoid restriction.","items":{"type":"string"},"type":["array","null"]},"runtimeSourcemapPausePatterns":{"default":[],"items":{"type":"string"},"markdownDescription":"A list of patterns at which to manually insert entrypoint breakpoints. This can be useful to give the debugger an opportunity to set breakpoints when using sourcemaps that don't exist or can't be detected before launch, such as [with the Serverless framework](https://github.com/microsoft/vscode-js-debug/issues/492).","type":"array"},"showAsyncStacks":{"default":true,"description":"Show the async calls that led to the current call stack.","oneOf":[{"type":"boolean"},{"properties":{"onAttach":{"default":32,"type":"number"}},"required":["onAttach"],"type":"object"},{"properties":{"onceBreakpointResolved":{"default":32,"type":"number"}},"required":["onceBreakpointResolved"],"type":"object"}]},"skipFiles":{"default":["/**"],"description":"An array of file or folder names, or path globs, to skip when debugging. Star patterns and negations are allowed, for example, `[\"**/node_modules/**\", \"!**/node_modules/my-module/**\"]`","type":"array"},"smartStep":{"default":true,"description":"Automatically step through generated code that cannot be mapped back to the original source.","type":"boolean"},"sourceMapPathOverrides":{"default":{"meteor://💻app/*":"${workspaceFolder}/*","webpack:///./~/*":"${workspaceFolder}/node_modules/*","webpack://?:*/*":"${workspaceFolder}/*"},"description":"A set of mappings for rewriting the locations of source files from what the sourcemap says, to their locations on disk.","type":"object"},"sourceMapRenames":{"default":true,"description":"Whether to use the \"names\" mapping in sourcemaps. This requires requesting source content, which can be slow with certain debuggers.","type":"boolean"},"sourceMaps":{"default":true,"description":"Use JavaScript source maps (if they exist).","type":"boolean"},"timeout":{"default":10000,"description":"Retry for this number of milliseconds to connect to Node.js. Default is 10000 ms.","type":"number"},"timeouts":{"additionalProperties":false,"default":{},"description":"Timeouts for several debugger operations.","markdownDescription":"Timeouts for several debugger operations.","properties":{"hoverEvaluation":{"default":500,"description":"Time until value evaluation for hovered symbols is aborted. If set to 0, hover evaluation does never time out.","type":"number"},"sourceMapCumulativePause":{"default":1000,"description":"Extra time in milliseconds allowed per session to be spent waiting for source-maps to be processed, after the minimum time (sourceMapMinPause) has been exhausted","type":"number"},"sourceMapMinPause":{"default":1000,"description":"Minimum time in milliseconds spent waiting for each source-map to be processed when a script is being parsed","type":"number"}},"type":"object"},"trace":{"default":true,"description":"Configures what diagnostic output is produced.","oneOf":[{"description":"Trace may be set to 'true' to write diagnostic logs to the disk.","type":"boolean"},{"additionalProperties":false,"properties":{"logFile":{"description":"Configures where on disk logs are written.","type":["string","null"]},"stdio":{"description":"Whether to return trace data from the launched application or browser.","type":"boolean"}},"type":"object"}]}}}},"configurationSnippets":[{"body":{"command":"npm start","name":"Run npm start","request":"launch","type":"node-terminal"},"description":"Run \"npm start\" in a debug terminal","label":"Run \"npm start\" in a debug terminal"}],"label":"JavaScript Debug Terminal","languages":[],"strings":{"unverifiedBreakpoints":"Some of your breakpoints could not be set. If you're having an issue, you can [troubleshoot your launch configuration](command:extension.js-debug.createDiagnostics)."},"type":"node-terminal"},{"aiKey":"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255","configurationAttributes":{"launch":{"properties":{"args":{"default":["--extensionDevelopmentPath=${workspaceFolder}"],"description":"Command line arguments passed to the program.\n\nCan be an array of strings or a single string. When the program is launched in a terminal, setting this property to a single string will result in the arguments not being escaped for the shell.","items":{"type":"string"},"type":"array"},"autoAttachChildProcesses":{"default":true,"description":"Attach debugger to new child processes automatically.","type":"boolean"},"cascadeTerminateToConfigurations":{"default":[],"description":"A list of debug sessions which, when this debug session is terminated, will also be stopped.","items":{"type":"string","uniqueItems":true},"type":"array"},"customDescriptionGenerator":{"description":"Customize the textual description the debugger shows for objects (local variables, etc...). Samples:\n 1. this.toString() // will call toString to print all objects\n 2. this.customDescription ? this.customDescription() : defaultValue // Use customDescription method if available, if not return defaultValue\n 3. function (def) { return this.customDescription ? this.customDescription() : def } // Use customDescription method if available, if not return defaultValue\n ","type":"string"},"customPropertiesGenerator":{"deprecated":true,"description":"Customize the properties shown for an object in the debugger (local variables, etc...). Samples:\n 1. { ...this, extraProperty: '12345' } // Add an extraProperty 12345 to all objects\n 2. this.customProperties ? this.customProperties() : this // Use customProperties method if available, if not use the properties in this (the default properties)\n 3. function () { return this.customProperties ? this.customProperties() : this } // Use customDescription method if available, if not return the default properties\n\n Deprecated: This is a temporary implementation of this feature until we have time to implement it in the way described here: https://github.com/microsoft/vscode/issues/102181","type":"string"},"cwd":{"default":"${workspaceFolder}","description":"Absolute path to the working directory of the program being debugged. If you've set localRoot then cwd will match that value otherwise it falls back to your workspaceFolder","type":"string"},"debugWebWorkerHost":{"default":true,"markdownDescription":"Configures whether we should try to attach to the web worker extension host.","type":["boolean"]},"debugWebviews":{"default":true,"markdownDescription":"Configures whether we should try to attach to webviews in the launched VS Code instance. This will only work in desktop VS Code.","type":["boolean"]},"enableContentValidation":{"default":true,"description":"Toggles whether we verify the contents of files on disk match the ones loaded in the runtime. This is useful in a variety of scenarios and required in some, but can cause issues if you have server-side transformation of scripts, for example.","type":"boolean"},"env":{"additionalProperties":{"type":["string","null"]},"default":{},"markdownDescription":"Environment variables passed to the program. The value `null` removes the variable from the environment.","type":"object"},"envFile":{"default":"${workspaceFolder}/.env","description":"Absolute path to a file containing environment variable definitions.","type":"string"},"localRoot":{"default":null,"description":"Path to the local directory containing the program.","type":["string","null"]},"nodeVersionHint":{"default":12,"description":"Allows you to explicitly specify the Node version that's running, which can be used to disable or enable certain behaviors in cases where the automatic version detection does not work.","minimum":8,"type":"number"},"outFiles":{"default":["${workspaceFolder}/**/*.js","!**/node_modules/**"],"description":"If source maps are enabled, these glob patterns specify the generated JavaScript files. If a pattern starts with `!` the files are excluded. If not specified, the generated code is expected in the same directory as its source.","items":{"type":"string"},"type":["array"]},"outputCapture":{"default":"console","enum":["console","std"],"markdownDescription":"From where to capture output messages: the default debug API if set to `console`, or stdout/stderr streams if set to `std`."},"pauseForSourceMap":{"default":false,"markdownDescription":"Whether to wait for source maps to load for each incoming script. This has a performance overhead, and might be safely disabled when running off of disk, so long as `rootPath` is not disabled.","type":"boolean"},"remoteRoot":{"default":null,"description":"Absolute path to the remote directory containing the program.","type":["string","null"]},"rendererDebugOptions":{"default":{"webRoot":"${workspaceFolder}"},"markdownDescription":"Chrome launch options used when attaching to the renderer process, with `debugWebviews` or `debugWebWorkerHost`.","properties":{"address":{"default":"localhost","description":"IP address or hostname the debugged browser is listening on.","type":"string"},"browserAttachLocation":{"default":null,"description":"Forces the browser to attach in one location. In a remote workspace (through ssh or WSL, for example) this can be used to attach to a browser on the remote machine rather than locally.","oneOf":[{"type":"null"},{"enum":["ui","workspace"],"type":"string"}]},"cascadeTerminateToConfigurations":{"default":[],"description":"A list of debug sessions which, when this debug session is terminated, will also be stopped.","items":{"type":"string","uniqueItems":true},"type":"array"},"customDescriptionGenerator":{"description":"Customize the textual description the debugger shows for objects (local variables, etc...). Samples:\n 1. this.toString() // will call toString to print all objects\n 2. this.customDescription ? this.customDescription() : defaultValue // Use customDescription method if available, if not return defaultValue\n 3. function (def) { return this.customDescription ? this.customDescription() : def } // Use customDescription method if available, if not return defaultValue\n ","type":"string"},"customPropertiesGenerator":{"deprecated":true,"description":"Customize the properties shown for an object in the debugger (local variables, etc...). Samples:\n 1. { ...this, extraProperty: '12345' } // Add an extraProperty 12345 to all objects\n 2. this.customProperties ? this.customProperties() : this // Use customProperties method if available, if not use the properties in this (the default properties)\n 3. function () { return this.customProperties ? this.customProperties() : this } // Use customDescription method if available, if not return the default properties\n\n Deprecated: This is a temporary implementation of this feature until we have time to implement it in the way described here: https://github.com/microsoft/vscode/issues/102181","type":"string"},"disableNetworkCache":{"default":true,"description":"Controls whether to skip the network cache for each request","type":"boolean"},"enableContentValidation":{"default":true,"description":"Toggles whether we verify the contents of files on disk match the ones loaded in the runtime. This is useful in a variety of scenarios and required in some, but can cause issues if you have server-side transformation of scripts, for example.","type":"boolean"},"inspectUri":{"default":null,"description":"Format to use to rewrite the inspectUri: It's a template string that interpolates keys in `{curlyBraces}`. Available keys are:\n - `url.*` is the parsed address of the running application. For instance, `{url.port}`, `{url.hostname}`\n - `port` is the debug port that Chrome is listening on.\n - `browserInspectUri` is the inspector URI on the launched browser\n - `browserInspectUriPath` is the path part of the inspector URI on the launched browser (e.g.: \"/devtools/browser/e9ec0098-306e-472a-8133-5e42488929c2\").\n - `wsProtocol` is the hinted websocket protocol. This is set to `wss` if the original URL is `https`, or `ws` otherwise.\n","type":["string","null"]},"outFiles":{"default":["${workspaceFolder}/**/*.js","!**/node_modules/**"],"description":"If source maps are enabled, these glob patterns specify the generated JavaScript files. If a pattern starts with `!` the files are excluded. If not specified, the generated code is expected in the same directory as its source.","items":{"type":"string"},"type":["array"]},"outputCapture":{"default":"console","enum":["console","std"],"markdownDescription":"From where to capture output messages: the default debug API if set to `console`, or stdout/stderr streams if set to `std`."},"pathMapping":{"default":{},"description":"A mapping of URLs/paths to local folders, to resolve scripts in the Browser to scripts on disk","type":"object"},"pauseForSourceMap":{"default":false,"markdownDescription":"Whether to wait for source maps to load for each incoming script. This has a performance overhead, and might be safely disabled when running off of disk, so long as `rootPath` is not disabled.","type":"boolean"},"perScriptSourcemaps":{"default":"auto","description":"Whether scripts are loaded individually with unique sourcemaps containing the basename of the source file. This can be set to optimize sourcemap handling when dealing with lots of small scripts. If set to \"auto\", we'll detect known cases where this is appropriate.","enum":["yes","no","auto"],"type":"string"},"port":{"default":9229,"description":"Port to use to remote debugging the browser, given as `--remote-debugging-port` when launching the browser.","type":"number"},"resolveSourceMapLocations":{"default":null,"description":"A list of minimatch patterns for locations (folders and URLs) in which source maps can be used to resolve local files. This can be used to avoid incorrectly breaking in external source mapped code. Patterns can be prefixed with \"!\" to exclude them. May be set to an empty array or null to avoid restriction.","items":{"type":"string"},"type":["array","null"]},"restart":{"default":false,"markdownDescription":"Whether to reconnect if the browser connection is closed","type":"boolean"},"server":{"oneOf":[{"additionalProperties":false,"default":{"program":"node my-server.js"},"description":"Configures a web server to start up. Takes the same configuration as the 'node' launch task.","properties":{"args":{"default":[],"description":"Command line arguments passed to the program.\n\nCan be an array of strings or a single string. When the program is launched in a terminal, setting this property to a single string will result in the arguments not being escaped for the shell.","items":{"type":"string"},"type":["array","string"]},"attachSimplePort":{"default":9229,"description":"If set, attaches to the process via the given port. This is generally no longer necessary for Node.js programs and loses the ability to debug child processes, but can be useful in more esoteric scenarios such as with Deno and Docker launches. If set to 0, a random port will be chosen and --inspect-brk added to the launch arguments automatically.","type":"integer"},"autoAttachChildProcesses":{"default":true,"description":"Attach debugger to new child processes automatically.","type":"boolean"},"cascadeTerminateToConfigurations":{"default":[],"description":"A list of debug sessions which, when this debug session is terminated, will also be stopped.","items":{"type":"string","uniqueItems":true},"type":"array"},"console":{"default":"internalConsole","description":"Where to launch the debug target.","enum":["internalConsole","integratedTerminal","externalTerminal"],"enumDescriptions":["VS Code Debug Console (which doesn't support to read input from a program)","VS Code's integrated terminal","External terminal that can be configured via user settings"],"type":"string"},"customDescriptionGenerator":{"description":"Customize the textual description the debugger shows for objects (local variables, etc...). Samples:\n 1. this.toString() // will call toString to print all objects\n 2. this.customDescription ? this.customDescription() : defaultValue // Use customDescription method if available, if not return defaultValue\n 3. function (def) { return this.customDescription ? this.customDescription() : def } // Use customDescription method if available, if not return defaultValue\n ","type":"string"},"customPropertiesGenerator":{"deprecated":true,"description":"Customize the properties shown for an object in the debugger (local variables, etc...). Samples:\n 1. { ...this, extraProperty: '12345' } // Add an extraProperty 12345 to all objects\n 2. this.customProperties ? this.customProperties() : this // Use customProperties method if available, if not use the properties in this (the default properties)\n 3. function () { return this.customProperties ? this.customProperties() : this } // Use customDescription method if available, if not return the default properties\n\n Deprecated: This is a temporary implementation of this feature until we have time to implement it in the way described here: https://github.com/microsoft/vscode/issues/102181","type":"string"},"cwd":{"default":"${workspaceFolder}","description":"Absolute path to the working directory of the program being debugged. If you've set localRoot then cwd will match that value otherwise it falls back to your workspaceFolder","type":"string"},"enableContentValidation":{"default":true,"description":"Toggles whether we verify the contents of files on disk match the ones loaded in the runtime. This is useful in a variety of scenarios and required in some, but can cause issues if you have server-side transformation of scripts, for example.","type":"boolean"},"env":{"additionalProperties":{"type":["string","null"]},"default":{},"markdownDescription":"Environment variables passed to the program. The value `null` removes the variable from the environment.","type":"object"},"envFile":{"default":"${workspaceFolder}/.env","description":"Absolute path to a file containing environment variable definitions.","type":"string"},"killBehavior":{"default":"forceful","enum":["forceful","polite","none"],"markdownDescription":"Configures how debug processes are killed when stopping the session. Can be:\n\n- forceful (default): forcefully tears down the process tree. Sends SIGKILL on posix, or `taskkill.exe /F` on Windows.\n- polite: gracefully tears down the process tree. It's possible that misbehaving processes continue to run after shutdown in this way. Sends SIGTERM on posix, or `taskkill.exe` with no `/F` (force) flag on Windows.\n- none: no termination will happen.","type":"string"},"localRoot":{"default":null,"description":"Path to the local directory containing the program.","type":["string","null"]},"nodeVersionHint":{"default":12,"description":"Allows you to explicitly specify the Node version that's running, which can be used to disable or enable certain behaviors in cases where the automatic version detection does not work.","minimum":8,"type":"number"},"outFiles":{"default":["${workspaceFolder}/**/*.js","!**/node_modules/**"],"description":"If source maps are enabled, these glob patterns specify the generated JavaScript files. If a pattern starts with `!` the files are excluded. If not specified, the generated code is expected in the same directory as its source.","items":{"type":"string"},"type":["array"]},"outputCapture":{"default":"console","enum":["console","std"],"markdownDescription":"From where to capture output messages: the default debug API if set to `console`, or stdout/stderr streams if set to `std`."},"pauseForSourceMap":{"default":false,"markdownDescription":"Whether to wait for source maps to load for each incoming script. This has a performance overhead, and might be safely disabled when running off of disk, so long as `rootPath` is not disabled.","type":"boolean"},"profileStartup":{"default":true,"description":"If true, will start profiling as soon as the process launches","type":"boolean"},"program":{"default":"","description":"Absolute path to the program. Generated value is guessed by looking at package.json and opened files. Edit this attribute.","type":"string"},"remoteRoot":{"default":null,"description":"Absolute path to the remote directory containing the program.","type":["string","null"]},"resolveSourceMapLocations":{"default":["${workspaceFolder}/**","!**/node_modules/**"],"description":"A list of minimatch patterns for locations (folders and URLs) in which source maps can be used to resolve local files. This can be used to avoid incorrectly breaking in external source mapped code. Patterns can be prefixed with \"!\" to exclude them. May be set to an empty array or null to avoid restriction.","items":{"type":"string"},"type":["array","null"]},"restart":{"default":true,"description":"Try to reconnect to the program if we lose connection. If set to `true`, we'll try once a second, forever. You can customize the interval and maximum number of attempts by specifying the `delay` and `maxAttempts` in an object instead.","oneOf":[{"type":"boolean"},{"properties":{"delay":{"default":1000,"minimum":0,"type":"number"},"maxAttempts":{"default":10,"minimum":0,"type":"number"}},"type":"object"}]},"runtimeArgs":{"default":[],"description":"Optional arguments passed to the runtime executable.","items":{"type":"string"},"type":"array"},"runtimeExecutable":{"default":"node","markdownDescription":"Runtime to use. Either an absolute path or the name of a runtime available on the PATH. If omitted `node` is assumed.","type":["string","null"]},"runtimeSourcemapPausePatterns":{"default":[],"items":{"type":"string"},"markdownDescription":"A list of patterns at which to manually insert entrypoint breakpoints. This can be useful to give the debugger an opportunity to set breakpoints when using sourcemaps that don't exist or can't be detected before launch, such as [with the Serverless framework](https://github.com/microsoft/vscode-js-debug/issues/492).","type":"array"},"runtimeVersion":{"default":"default","markdownDescription":"Version of `node` runtime to use. Requires `nvm`.","type":"string"},"showAsyncStacks":{"default":true,"description":"Show the async calls that led to the current call stack.","oneOf":[{"type":"boolean"},{"properties":{"onAttach":{"default":32,"type":"number"}},"required":["onAttach"],"type":"object"},{"properties":{"onceBreakpointResolved":{"default":32,"type":"number"}},"required":["onceBreakpointResolved"],"type":"object"}]},"skipFiles":{"default":["/**"],"description":"An array of file or folder names, or path globs, to skip when debugging. Star patterns and negations are allowed, for example, `[\"**/node_modules/**\", \"!**/node_modules/my-module/**\"]`","type":"array"},"smartStep":{"default":true,"description":"Automatically step through generated code that cannot be mapped back to the original source.","type":"boolean"},"sourceMapPathOverrides":{"default":{"meteor://💻app/*":"${workspaceFolder}/*","webpack:///./~/*":"${workspaceFolder}/node_modules/*","webpack://?:*/*":"${workspaceFolder}/*"},"description":"A set of mappings for rewriting the locations of source files from what the sourcemap says, to their locations on disk.","type":"object"},"sourceMapRenames":{"default":true,"description":"Whether to use the \"names\" mapping in sourcemaps. This requires requesting source content, which can be slow with certain debuggers.","type":"boolean"},"sourceMaps":{"default":true,"description":"Use JavaScript source maps (if they exist).","type":"boolean"},"stopOnEntry":{"default":true,"description":"Automatically stop program after launch.","type":["boolean","string"]},"timeout":{"default":10000,"description":"Retry for this number of milliseconds to connect to Node.js. Default is 10000 ms.","type":"number"},"timeouts":{"additionalProperties":false,"default":{},"description":"Timeouts for several debugger operations.","markdownDescription":"Timeouts for several debugger operations.","properties":{"hoverEvaluation":{"default":500,"description":"Time until value evaluation for hovered symbols is aborted. If set to 0, hover evaluation does never time out.","type":"number"},"sourceMapCumulativePause":{"default":1000,"description":"Extra time in milliseconds allowed per session to be spent waiting for source-maps to be processed, after the minimum time (sourceMapMinPause) has been exhausted","type":"number"},"sourceMapMinPause":{"default":1000,"description":"Minimum time in milliseconds spent waiting for each source-map to be processed when a script is being parsed","type":"number"}},"type":"object"},"trace":{"default":true,"description":"Configures what diagnostic output is produced.","oneOf":[{"description":"Trace may be set to 'true' to write diagnostic logs to the disk.","type":"boolean"},{"additionalProperties":false,"properties":{"logFile":{"description":"Configures where on disk logs are written.","type":["string","null"]},"stdio":{"description":"Whether to return trace data from the launched application or browser.","type":"boolean"}},"type":"object"}]}},"type":"object"},{"additionalProperties":false,"default":{"program":"npm start"},"description":"JavaScript Debug Terminal","properties":{"autoAttachChildProcesses":{"default":true,"description":"Attach debugger to new child processes automatically.","type":"boolean"},"cascadeTerminateToConfigurations":{"default":[],"description":"A list of debug sessions which, when this debug session is terminated, will also be stopped.","items":{"type":"string","uniqueItems":true},"type":"array"},"command":{"default":"npm start","description":"Command to run in the launched terminal. If not provided, the terminal will open without launching a program.","type":["string","null"]},"customDescriptionGenerator":{"description":"Customize the textual description the debugger shows for objects (local variables, etc...). Samples:\n 1. this.toString() // will call toString to print all objects\n 2. this.customDescription ? this.customDescription() : defaultValue // Use customDescription method if available, if not return defaultValue\n 3. function (def) { return this.customDescription ? this.customDescription() : def } // Use customDescription method if available, if not return defaultValue\n ","type":"string"},"customPropertiesGenerator":{"deprecated":true,"description":"Customize the properties shown for an object in the debugger (local variables, etc...). Samples:\n 1. { ...this, extraProperty: '12345' } // Add an extraProperty 12345 to all objects\n 2. this.customProperties ? this.customProperties() : this // Use customProperties method if available, if not use the properties in this (the default properties)\n 3. function () { return this.customProperties ? this.customProperties() : this } // Use customDescription method if available, if not return the default properties\n\n Deprecated: This is a temporary implementation of this feature until we have time to implement it in the way described here: https://github.com/microsoft/vscode/issues/102181","type":"string"},"cwd":{"default":"${workspaceFolder}","description":"Absolute path to the working directory of the program being debugged. If you've set localRoot then cwd will match that value otherwise it falls back to your workspaceFolder","docDefault":"localRoot || ${workspaceFolder}","type":"string"},"enableContentValidation":{"default":true,"description":"Toggles whether we verify the contents of files on disk match the ones loaded in the runtime. This is useful in a variety of scenarios and required in some, but can cause issues if you have server-side transformation of scripts, for example.","type":"boolean"},"env":{"additionalProperties":{"type":["string","null"]},"default":{},"markdownDescription":"Environment variables passed to the program. The value `null` removes the variable from the environment.","type":"object"},"envFile":{"default":"${workspaceFolder}/.env","description":"Absolute path to a file containing environment variable definitions.","type":"string"},"localRoot":{"default":null,"description":"Path to the local directory containing the program.","type":["string","null"]},"nodeVersionHint":{"default":12,"description":"Allows you to explicitly specify the Node version that's running, which can be used to disable or enable certain behaviors in cases where the automatic version detection does not work.","minimum":8,"type":"number"},"outFiles":{"default":["${workspaceFolder}/**/*.js","!**/node_modules/**"],"description":"If source maps are enabled, these glob patterns specify the generated JavaScript files. If a pattern starts with `!` the files are excluded. If not specified, the generated code is expected in the same directory as its source.","items":{"type":"string"},"type":["array"]},"outputCapture":{"default":"console","enum":["console","std"],"markdownDescription":"From where to capture output messages: the default debug API if set to `console`, or stdout/stderr streams if set to `std`."},"pauseForSourceMap":{"default":false,"markdownDescription":"Whether to wait for source maps to load for each incoming script. This has a performance overhead, and might be safely disabled when running off of disk, so long as `rootPath` is not disabled.","type":"boolean"},"remoteRoot":{"default":null,"description":"Absolute path to the remote directory containing the program.","type":["string","null"]},"resolveSourceMapLocations":{"default":["${workspaceFolder}/**","!**/node_modules/**"],"description":"A list of minimatch patterns for locations (folders and URLs) in which source maps can be used to resolve local files. This can be used to avoid incorrectly breaking in external source mapped code. Patterns can be prefixed with \"!\" to exclude them. May be set to an empty array or null to avoid restriction.","items":{"type":"string"},"type":["array","null"]},"runtimeSourcemapPausePatterns":{"default":[],"items":{"type":"string"},"markdownDescription":"A list of patterns at which to manually insert entrypoint breakpoints. This can be useful to give the debugger an opportunity to set breakpoints when using sourcemaps that don't exist or can't be detected before launch, such as [with the Serverless framework](https://github.com/microsoft/vscode-js-debug/issues/492).","type":"array"},"showAsyncStacks":{"default":true,"description":"Show the async calls that led to the current call stack.","oneOf":[{"type":"boolean"},{"properties":{"onAttach":{"default":32,"type":"number"}},"required":["onAttach"],"type":"object"},{"properties":{"onceBreakpointResolved":{"default":32,"type":"number"}},"required":["onceBreakpointResolved"],"type":"object"}]},"skipFiles":{"default":["/**"],"description":"An array of file or folder names, or path globs, to skip when debugging. Star patterns and negations are allowed, for example, `[\"**/node_modules/**\", \"!**/node_modules/my-module/**\"]`","type":"array"},"smartStep":{"default":true,"description":"Automatically step through generated code that cannot be mapped back to the original source.","type":"boolean"},"sourceMapPathOverrides":{"default":{"meteor://💻app/*":"${workspaceFolder}/*","webpack:///./~/*":"${workspaceFolder}/node_modules/*","webpack://?:*/*":"${workspaceFolder}/*"},"description":"A set of mappings for rewriting the locations of source files from what the sourcemap says, to their locations on disk.","type":"object"},"sourceMapRenames":{"default":true,"description":"Whether to use the \"names\" mapping in sourcemaps. This requires requesting source content, which can be slow with certain debuggers.","type":"boolean"},"sourceMaps":{"default":true,"description":"Use JavaScript source maps (if they exist).","type":"boolean"},"timeout":{"default":10000,"description":"Retry for this number of milliseconds to connect to Node.js. Default is 10000 ms.","type":"number"},"timeouts":{"additionalProperties":false,"default":{},"description":"Timeouts for several debugger operations.","markdownDescription":"Timeouts for several debugger operations.","properties":{"hoverEvaluation":{"default":500,"description":"Time until value evaluation for hovered symbols is aborted. If set to 0, hover evaluation does never time out.","type":"number"},"sourceMapCumulativePause":{"default":1000,"description":"Extra time in milliseconds allowed per session to be spent waiting for source-maps to be processed, after the minimum time (sourceMapMinPause) has been exhausted","type":"number"},"sourceMapMinPause":{"default":1000,"description":"Minimum time in milliseconds spent waiting for each source-map to be processed when a script is being parsed","type":"number"}},"type":"object"},"trace":{"default":true,"description":"Configures what diagnostic output is produced.","oneOf":[{"description":"Trace may be set to 'true' to write diagnostic logs to the disk.","type":"boolean"},{"additionalProperties":false,"properties":{"logFile":{"description":"Configures where on disk logs are written.","type":["string","null"]},"stdio":{"description":"Whether to return trace data from the launched application or browser.","type":"boolean"}},"type":"object"}]}},"type":"object"}]},"showAsyncStacks":{"default":true,"description":"Show the async calls that led to the current call stack.","oneOf":[{"type":"boolean"},{"properties":{"onAttach":{"default":32,"type":"number"}},"required":["onAttach"],"type":"object"},{"properties":{"onceBreakpointResolved":{"default":32,"type":"number"}},"required":["onceBreakpointResolved"],"type":"object"}]},"skipFiles":{"default":["/**"],"description":"An array of file or folder names, or path globs, to skip when debugging. Star patterns and negations are allowed, for example, `[\"**/node_modules/**\", \"!**/node_modules/my-module/**\"]`","type":"array"},"smartStep":{"default":true,"description":"Automatically step through generated code that cannot be mapped back to the original source.","type":"boolean"},"sourceMapPathOverrides":{"default":{"meteor://💻app/*":"${workspaceFolder}/*","webpack:///./~/*":"${workspaceFolder}/node_modules/*","webpack://?:*/*":"${workspaceFolder}/*"},"description":"A set of mappings for rewriting the locations of source files from what the sourcemap says, to their locations on disk.","type":"object"},"sourceMapRenames":{"default":true,"description":"Whether to use the \"names\" mapping in sourcemaps. This requires requesting source content, which can be slow with certain debuggers.","type":"boolean"},"sourceMaps":{"default":true,"description":"Use JavaScript source maps (if they exist).","type":"boolean"},"targetSelection":{"default":"automatic","enum":["pick","automatic"],"markdownDescription":"Whether to attach to all targets that match the URL filter (\"automatic\") or ask to pick one (\"pick\").","type":"string"},"timeout":{"default":10000,"description":"Retry for this number of milliseconds to connect to Node.js. Default is 10000 ms.","type":"number"},"timeouts":{"additionalProperties":false,"default":{},"description":"Timeouts for several debugger operations.","markdownDescription":"Timeouts for several debugger operations.","properties":{"hoverEvaluation":{"default":500,"description":"Time until value evaluation for hovered symbols is aborted. If set to 0, hover evaluation does never time out.","type":"number"},"sourceMapCumulativePause":{"default":1000,"description":"Extra time in milliseconds allowed per session to be spent waiting for source-maps to be processed, after the minimum time (sourceMapMinPause) has been exhausted","type":"number"},"sourceMapMinPause":{"default":1000,"description":"Minimum time in milliseconds spent waiting for each source-map to be processed when a script is being parsed","type":"number"}},"type":"object"},"trace":{"default":true,"description":"Configures what diagnostic output is produced.","oneOf":[{"description":"Trace may be set to 'true' to write diagnostic logs to the disk.","type":"boolean"},{"additionalProperties":false,"properties":{"logFile":{"description":"Configures where on disk logs are written.","type":["string","null"]},"stdio":{"description":"Whether to return trace data from the launched application or browser.","type":"boolean"}},"type":"object"}]},"url":{"default":"http://localhost:8080","description":"Will search for a tab with this exact url and attach to it, if found","type":"string"},"urlFilter":{"default":"","description":"Will search for a page with this url and attach to it, if found. Can have * wildcards.","type":"string"},"vueComponentPaths":{"default":["${workspaceFolder}/**/*.vue"],"description":"A list of file glob patterns to find `*.vue` components. By default, searches the entire workspace. This needs to be specified due to extra lookups that Vue's sourcemaps require in Vue CLI 4. You can disable this special handling by setting this to an empty array.","type":"array"},"webRoot":{"default":"${workspaceFolder}","description":"This specifies the workspace absolute path to the webserver root. Used to resolve paths like `/app.js` to files on disk. Shorthand for a pathMapping for \"/\"","type":"string"}},"type":"object"},"resolveSourceMapLocations":{"default":["${workspaceFolder}/**","!**/node_modules/**"],"description":"A list of minimatch patterns for locations (folders and URLs) in which source maps can be used to resolve local files. This can be used to avoid incorrectly breaking in external source mapped code. Patterns can be prefixed with \"!\" to exclude them. May be set to an empty array or null to avoid restriction.","items":{"type":"string"},"type":["array","null"]},"runtimeExecutable":{"default":"node","markdownDescription":"Absolute path to VS Code.","type":["string","null"]},"runtimeSourcemapPausePatterns":{"default":[],"items":{"type":"string"},"markdownDescription":"A list of patterns at which to manually insert entrypoint breakpoints. This can be useful to give the debugger an opportunity to set breakpoints when using sourcemaps that don't exist or can't be detected before launch, such as [with the Serverless framework](https://github.com/microsoft/vscode-js-debug/issues/492).","type":"array"},"showAsyncStacks":{"default":true,"description":"Show the async calls that led to the current call stack.","oneOf":[{"type":"boolean"},{"properties":{"onAttach":{"default":32,"type":"number"}},"required":["onAttach"],"type":"object"},{"properties":{"onceBreakpointResolved":{"default":32,"type":"number"}},"required":["onceBreakpointResolved"],"type":"object"}]},"skipFiles":{"default":["/**"],"description":"An array of file or folder names, or path globs, to skip when debugging. Star patterns and negations are allowed, for example, `[\"**/node_modules/**\", \"!**/node_modules/my-module/**\"]`","type":"array"},"smartStep":{"default":true,"description":"Automatically step through generated code that cannot be mapped back to the original source.","type":"boolean"},"sourceMapPathOverrides":{"default":{"meteor://💻app/*":"${workspaceFolder}/*","webpack:///./~/*":"${workspaceFolder}/node_modules/*","webpack://?:*/*":"${workspaceFolder}/*"},"description":"A set of mappings for rewriting the locations of source files from what the sourcemap says, to their locations on disk.","type":"object"},"sourceMapRenames":{"default":true,"description":"Whether to use the \"names\" mapping in sourcemaps. This requires requesting source content, which can be slow with certain debuggers.","type":"boolean"},"sourceMaps":{"default":true,"description":"Use JavaScript source maps (if they exist).","type":"boolean"},"timeout":{"default":10000,"description":"Retry for this number of milliseconds to connect to Node.js. Default is 10000 ms.","type":"number"},"timeouts":{"additionalProperties":false,"default":{},"description":"Timeouts for several debugger operations.","markdownDescription":"Timeouts for several debugger operations.","properties":{"hoverEvaluation":{"default":500,"description":"Time until value evaluation for hovered symbols is aborted. If set to 0, hover evaluation does never time out.","type":"number"},"sourceMapCumulativePause":{"default":1000,"description":"Extra time in milliseconds allowed per session to be spent waiting for source-maps to be processed, after the minimum time (sourceMapMinPause) has been exhausted","type":"number"},"sourceMapMinPause":{"default":1000,"description":"Minimum time in milliseconds spent waiting for each source-map to be processed when a script is being parsed","type":"number"}},"type":"object"},"trace":{"default":true,"description":"Configures what diagnostic output is produced.","oneOf":[{"description":"Trace may be set to 'true' to write diagnostic logs to the disk.","type":"boolean"},{"additionalProperties":false,"properties":{"logFile":{"description":"Configures where on disk logs are written.","type":["string","null"]},"stdio":{"description":"Whether to return trace data from the launched application or browser.","type":"boolean"}},"type":"object"}]}},"required":["args"]}},"configurationSnippets":[],"deprecated":"Please use type extensionHost instead","label":"VS Code Extension Development","languages":["javascript","typescript","javascriptreact","typescriptreact"],"strings":{"unverifiedBreakpoints":"Some of your breakpoints could not be set. If you're having an issue, you can [troubleshoot your launch configuration](command:extension.js-debug.createDiagnostics)."},"type":"pwa-extensionHost"},{"aiKey":"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255","configurationAttributes":{"launch":{"properties":{"args":{"default":["--extensionDevelopmentPath=${workspaceFolder}"],"description":"Command line arguments passed to the program.\n\nCan be an array of strings or a single string. When the program is launched in a terminal, setting this property to a single string will result in the arguments not being escaped for the shell.","items":{"type":"string"},"type":"array"},"autoAttachChildProcesses":{"default":true,"description":"Attach debugger to new child processes automatically.","type":"boolean"},"cascadeTerminateToConfigurations":{"default":[],"description":"A list of debug sessions which, when this debug session is terminated, will also be stopped.","items":{"type":"string","uniqueItems":true},"type":"array"},"customDescriptionGenerator":{"description":"Customize the textual description the debugger shows for objects (local variables, etc...). Samples:\n 1. this.toString() // will call toString to print all objects\n 2. this.customDescription ? this.customDescription() : defaultValue // Use customDescription method if available, if not return defaultValue\n 3. function (def) { return this.customDescription ? this.customDescription() : def } // Use customDescription method if available, if not return defaultValue\n ","type":"string"},"customPropertiesGenerator":{"deprecated":true,"description":"Customize the properties shown for an object in the debugger (local variables, etc...). Samples:\n 1. { ...this, extraProperty: '12345' } // Add an extraProperty 12345 to all objects\n 2. this.customProperties ? this.customProperties() : this // Use customProperties method if available, if not use the properties in this (the default properties)\n 3. function () { return this.customProperties ? this.customProperties() : this } // Use customDescription method if available, if not return the default properties\n\n Deprecated: This is a temporary implementation of this feature until we have time to implement it in the way described here: https://github.com/microsoft/vscode/issues/102181","type":"string"},"cwd":{"default":"${workspaceFolder}","description":"Absolute path to the working directory of the program being debugged. If you've set localRoot then cwd will match that value otherwise it falls back to your workspaceFolder","type":"string"},"debugWebWorkerHost":{"default":true,"markdownDescription":"Configures whether we should try to attach to the web worker extension host.","type":["boolean"]},"debugWebviews":{"default":true,"markdownDescription":"Configures whether we should try to attach to webviews in the launched VS Code instance. This will only work in desktop VS Code.","type":["boolean"]},"enableContentValidation":{"default":true,"description":"Toggles whether we verify the contents of files on disk match the ones loaded in the runtime. This is useful in a variety of scenarios and required in some, but can cause issues if you have server-side transformation of scripts, for example.","type":"boolean"},"env":{"additionalProperties":{"type":["string","null"]},"default":{},"markdownDescription":"Environment variables passed to the program. The value `null` removes the variable from the environment.","type":"object"},"envFile":{"default":"${workspaceFolder}/.env","description":"Absolute path to a file containing environment variable definitions.","type":"string"},"localRoot":{"default":null,"description":"Path to the local directory containing the program.","type":["string","null"]},"nodeVersionHint":{"default":12,"description":"Allows you to explicitly specify the Node version that's running, which can be used to disable or enable certain behaviors in cases where the automatic version detection does not work.","minimum":8,"type":"number"},"outFiles":{"default":["${workspaceFolder}/**/*.js","!**/node_modules/**"],"description":"If source maps are enabled, these glob patterns specify the generated JavaScript files. If a pattern starts with `!` the files are excluded. If not specified, the generated code is expected in the same directory as its source.","items":{"type":"string"},"type":["array"]},"outputCapture":{"default":"console","enum":["console","std"],"markdownDescription":"From where to capture output messages: the default debug API if set to `console`, or stdout/stderr streams if set to `std`."},"pauseForSourceMap":{"default":false,"markdownDescription":"Whether to wait for source maps to load for each incoming script. This has a performance overhead, and might be safely disabled when running off of disk, so long as `rootPath` is not disabled.","type":"boolean"},"remoteRoot":{"default":null,"description":"Absolute path to the remote directory containing the program.","type":["string","null"]},"rendererDebugOptions":{"default":{"webRoot":"${workspaceFolder}"},"markdownDescription":"Chrome launch options used when attaching to the renderer process, with `debugWebviews` or `debugWebWorkerHost`.","properties":{"address":{"default":"localhost","description":"IP address or hostname the debugged browser is listening on.","type":"string"},"browserAttachLocation":{"default":null,"description":"Forces the browser to attach in one location. In a remote workspace (through ssh or WSL, for example) this can be used to attach to a browser on the remote machine rather than locally.","oneOf":[{"type":"null"},{"enum":["ui","workspace"],"type":"string"}]},"cascadeTerminateToConfigurations":{"default":[],"description":"A list of debug sessions which, when this debug session is terminated, will also be stopped.","items":{"type":"string","uniqueItems":true},"type":"array"},"customDescriptionGenerator":{"description":"Customize the textual description the debugger shows for objects (local variables, etc...). Samples:\n 1. this.toString() // will call toString to print all objects\n 2. this.customDescription ? this.customDescription() : defaultValue // Use customDescription method if available, if not return defaultValue\n 3. function (def) { return this.customDescription ? this.customDescription() : def } // Use customDescription method if available, if not return defaultValue\n ","type":"string"},"customPropertiesGenerator":{"deprecated":true,"description":"Customize the properties shown for an object in the debugger (local variables, etc...). Samples:\n 1. { ...this, extraProperty: '12345' } // Add an extraProperty 12345 to all objects\n 2. this.customProperties ? this.customProperties() : this // Use customProperties method if available, if not use the properties in this (the default properties)\n 3. function () { return this.customProperties ? this.customProperties() : this } // Use customDescription method if available, if not return the default properties\n\n Deprecated: This is a temporary implementation of this feature until we have time to implement it in the way described here: https://github.com/microsoft/vscode/issues/102181","type":"string"},"disableNetworkCache":{"default":true,"description":"Controls whether to skip the network cache for each request","type":"boolean"},"enableContentValidation":{"default":true,"description":"Toggles whether we verify the contents of files on disk match the ones loaded in the runtime. This is useful in a variety of scenarios and required in some, but can cause issues if you have server-side transformation of scripts, for example.","type":"boolean"},"inspectUri":{"default":null,"description":"Format to use to rewrite the inspectUri: It's a template string that interpolates keys in `{curlyBraces}`. Available keys are:\n - `url.*` is the parsed address of the running application. For instance, `{url.port}`, `{url.hostname}`\n - `port` is the debug port that Chrome is listening on.\n - `browserInspectUri` is the inspector URI on the launched browser\n - `browserInspectUriPath` is the path part of the inspector URI on the launched browser (e.g.: \"/devtools/browser/e9ec0098-306e-472a-8133-5e42488929c2\").\n - `wsProtocol` is the hinted websocket protocol. This is set to `wss` if the original URL is `https`, or `ws` otherwise.\n","type":["string","null"]},"outFiles":{"default":["${workspaceFolder}/**/*.js","!**/node_modules/**"],"description":"If source maps are enabled, these glob patterns specify the generated JavaScript files. If a pattern starts with `!` the files are excluded. If not specified, the generated code is expected in the same directory as its source.","items":{"type":"string"},"type":["array"]},"outputCapture":{"default":"console","enum":["console","std"],"markdownDescription":"From where to capture output messages: the default debug API if set to `console`, or stdout/stderr streams if set to `std`."},"pathMapping":{"default":{},"description":"A mapping of URLs/paths to local folders, to resolve scripts in the Browser to scripts on disk","type":"object"},"pauseForSourceMap":{"default":false,"markdownDescription":"Whether to wait for source maps to load for each incoming script. This has a performance overhead, and might be safely disabled when running off of disk, so long as `rootPath` is not disabled.","type":"boolean"},"perScriptSourcemaps":{"default":"auto","description":"Whether scripts are loaded individually with unique sourcemaps containing the basename of the source file. This can be set to optimize sourcemap handling when dealing with lots of small scripts. If set to \"auto\", we'll detect known cases where this is appropriate.","enum":["yes","no","auto"],"type":"string"},"port":{"default":9229,"description":"Port to use to remote debugging the browser, given as `--remote-debugging-port` when launching the browser.","type":"number"},"resolveSourceMapLocations":{"default":null,"description":"A list of minimatch patterns for locations (folders and URLs) in which source maps can be used to resolve local files. This can be used to avoid incorrectly breaking in external source mapped code. Patterns can be prefixed with \"!\" to exclude them. May be set to an empty array or null to avoid restriction.","items":{"type":"string"},"type":["array","null"]},"restart":{"default":false,"markdownDescription":"Whether to reconnect if the browser connection is closed","type":"boolean"},"server":{"oneOf":[{"additionalProperties":false,"default":{"program":"node my-server.js"},"description":"Configures a web server to start up. Takes the same configuration as the 'node' launch task.","properties":{"args":{"default":[],"description":"Command line arguments passed to the program.\n\nCan be an array of strings or a single string. When the program is launched in a terminal, setting this property to a single string will result in the arguments not being escaped for the shell.","items":{"type":"string"},"type":["array","string"]},"attachSimplePort":{"default":9229,"description":"If set, attaches to the process via the given port. This is generally no longer necessary for Node.js programs and loses the ability to debug child processes, but can be useful in more esoteric scenarios such as with Deno and Docker launches. If set to 0, a random port will be chosen and --inspect-brk added to the launch arguments automatically.","type":"integer"},"autoAttachChildProcesses":{"default":true,"description":"Attach debugger to new child processes automatically.","type":"boolean"},"cascadeTerminateToConfigurations":{"default":[],"description":"A list of debug sessions which, when this debug session is terminated, will also be stopped.","items":{"type":"string","uniqueItems":true},"type":"array"},"console":{"default":"internalConsole","description":"Where to launch the debug target.","enum":["internalConsole","integratedTerminal","externalTerminal"],"enumDescriptions":["VS Code Debug Console (which doesn't support to read input from a program)","VS Code's integrated terminal","External terminal that can be configured via user settings"],"type":"string"},"customDescriptionGenerator":{"description":"Customize the textual description the debugger shows for objects (local variables, etc...). Samples:\n 1. this.toString() // will call toString to print all objects\n 2. this.customDescription ? this.customDescription() : defaultValue // Use customDescription method if available, if not return defaultValue\n 3. function (def) { return this.customDescription ? this.customDescription() : def } // Use customDescription method if available, if not return defaultValue\n ","type":"string"},"customPropertiesGenerator":{"deprecated":true,"description":"Customize the properties shown for an object in the debugger (local variables, etc...). Samples:\n 1. { ...this, extraProperty: '12345' } // Add an extraProperty 12345 to all objects\n 2. this.customProperties ? this.customProperties() : this // Use customProperties method if available, if not use the properties in this (the default properties)\n 3. function () { return this.customProperties ? this.customProperties() : this } // Use customDescription method if available, if not return the default properties\n\n Deprecated: This is a temporary implementation of this feature until we have time to implement it in the way described here: https://github.com/microsoft/vscode/issues/102181","type":"string"},"cwd":{"default":"${workspaceFolder}","description":"Absolute path to the working directory of the program being debugged. If you've set localRoot then cwd will match that value otherwise it falls back to your workspaceFolder","type":"string"},"enableContentValidation":{"default":true,"description":"Toggles whether we verify the contents of files on disk match the ones loaded in the runtime. This is useful in a variety of scenarios and required in some, but can cause issues if you have server-side transformation of scripts, for example.","type":"boolean"},"env":{"additionalProperties":{"type":["string","null"]},"default":{},"markdownDescription":"Environment variables passed to the program. The value `null` removes the variable from the environment.","type":"object"},"envFile":{"default":"${workspaceFolder}/.env","description":"Absolute path to a file containing environment variable definitions.","type":"string"},"killBehavior":{"default":"forceful","enum":["forceful","polite","none"],"markdownDescription":"Configures how debug processes are killed when stopping the session. Can be:\n\n- forceful (default): forcefully tears down the process tree. Sends SIGKILL on posix, or `taskkill.exe /F` on Windows.\n- polite: gracefully tears down the process tree. It's possible that misbehaving processes continue to run after shutdown in this way. Sends SIGTERM on posix, or `taskkill.exe` with no `/F` (force) flag on Windows.\n- none: no termination will happen.","type":"string"},"localRoot":{"default":null,"description":"Path to the local directory containing the program.","type":["string","null"]},"nodeVersionHint":{"default":12,"description":"Allows you to explicitly specify the Node version that's running, which can be used to disable or enable certain behaviors in cases where the automatic version detection does not work.","minimum":8,"type":"number"},"outFiles":{"default":["${workspaceFolder}/**/*.js","!**/node_modules/**"],"description":"If source maps are enabled, these glob patterns specify the generated JavaScript files. If a pattern starts with `!` the files are excluded. If not specified, the generated code is expected in the same directory as its source.","items":{"type":"string"},"type":["array"]},"outputCapture":{"default":"console","enum":["console","std"],"markdownDescription":"From where to capture output messages: the default debug API if set to `console`, or stdout/stderr streams if set to `std`."},"pauseForSourceMap":{"default":false,"markdownDescription":"Whether to wait for source maps to load for each incoming script. This has a performance overhead, and might be safely disabled when running off of disk, so long as `rootPath` is not disabled.","type":"boolean"},"profileStartup":{"default":true,"description":"If true, will start profiling as soon as the process launches","type":"boolean"},"program":{"default":"","description":"Absolute path to the program. Generated value is guessed by looking at package.json and opened files. Edit this attribute.","type":"string"},"remoteRoot":{"default":null,"description":"Absolute path to the remote directory containing the program.","type":["string","null"]},"resolveSourceMapLocations":{"default":["${workspaceFolder}/**","!**/node_modules/**"],"description":"A list of minimatch patterns for locations (folders and URLs) in which source maps can be used to resolve local files. This can be used to avoid incorrectly breaking in external source mapped code. Patterns can be prefixed with \"!\" to exclude them. May be set to an empty array or null to avoid restriction.","items":{"type":"string"},"type":["array","null"]},"restart":{"default":true,"description":"Try to reconnect to the program if we lose connection. If set to `true`, we'll try once a second, forever. You can customize the interval and maximum number of attempts by specifying the `delay` and `maxAttempts` in an object instead.","oneOf":[{"type":"boolean"},{"properties":{"delay":{"default":1000,"minimum":0,"type":"number"},"maxAttempts":{"default":10,"minimum":0,"type":"number"}},"type":"object"}]},"runtimeArgs":{"default":[],"description":"Optional arguments passed to the runtime executable.","items":{"type":"string"},"type":"array"},"runtimeExecutable":{"default":"node","markdownDescription":"Runtime to use. Either an absolute path or the name of a runtime available on the PATH. If omitted `node` is assumed.","type":["string","null"]},"runtimeSourcemapPausePatterns":{"default":[],"items":{"type":"string"},"markdownDescription":"A list of patterns at which to manually insert entrypoint breakpoints. This can be useful to give the debugger an opportunity to set breakpoints when using sourcemaps that don't exist or can't be detected before launch, such as [with the Serverless framework](https://github.com/microsoft/vscode-js-debug/issues/492).","type":"array"},"runtimeVersion":{"default":"default","markdownDescription":"Version of `node` runtime to use. Requires `nvm`.","type":"string"},"showAsyncStacks":{"default":true,"description":"Show the async calls that led to the current call stack.","oneOf":[{"type":"boolean"},{"properties":{"onAttach":{"default":32,"type":"number"}},"required":["onAttach"],"type":"object"},{"properties":{"onceBreakpointResolved":{"default":32,"type":"number"}},"required":["onceBreakpointResolved"],"type":"object"}]},"skipFiles":{"default":["/**"],"description":"An array of file or folder names, or path globs, to skip when debugging. Star patterns and negations are allowed, for example, `[\"**/node_modules/**\", \"!**/node_modules/my-module/**\"]`","type":"array"},"smartStep":{"default":true,"description":"Automatically step through generated code that cannot be mapped back to the original source.","type":"boolean"},"sourceMapPathOverrides":{"default":{"meteor://💻app/*":"${workspaceFolder}/*","webpack:///./~/*":"${workspaceFolder}/node_modules/*","webpack://?:*/*":"${workspaceFolder}/*"},"description":"A set of mappings for rewriting the locations of source files from what the sourcemap says, to their locations on disk.","type":"object"},"sourceMapRenames":{"default":true,"description":"Whether to use the \"names\" mapping in sourcemaps. This requires requesting source content, which can be slow with certain debuggers.","type":"boolean"},"sourceMaps":{"default":true,"description":"Use JavaScript source maps (if they exist).","type":"boolean"},"stopOnEntry":{"default":true,"description":"Automatically stop program after launch.","type":["boolean","string"]},"timeout":{"default":10000,"description":"Retry for this number of milliseconds to connect to Node.js. Default is 10000 ms.","type":"number"},"timeouts":{"additionalProperties":false,"default":{},"description":"Timeouts for several debugger operations.","markdownDescription":"Timeouts for several debugger operations.","properties":{"hoverEvaluation":{"default":500,"description":"Time until value evaluation for hovered symbols is aborted. If set to 0, hover evaluation does never time out.","type":"number"},"sourceMapCumulativePause":{"default":1000,"description":"Extra time in milliseconds allowed per session to be spent waiting for source-maps to be processed, after the minimum time (sourceMapMinPause) has been exhausted","type":"number"},"sourceMapMinPause":{"default":1000,"description":"Minimum time in milliseconds spent waiting for each source-map to be processed when a script is being parsed","type":"number"}},"type":"object"},"trace":{"default":true,"description":"Configures what diagnostic output is produced.","oneOf":[{"description":"Trace may be set to 'true' to write diagnostic logs to the disk.","type":"boolean"},{"additionalProperties":false,"properties":{"logFile":{"description":"Configures where on disk logs are written.","type":["string","null"]},"stdio":{"description":"Whether to return trace data from the launched application or browser.","type":"boolean"}},"type":"object"}]}},"type":"object"},{"additionalProperties":false,"default":{"program":"npm start"},"description":"JavaScript Debug Terminal","properties":{"autoAttachChildProcesses":{"default":true,"description":"Attach debugger to new child processes automatically.","type":"boolean"},"cascadeTerminateToConfigurations":{"default":[],"description":"A list of debug sessions which, when this debug session is terminated, will also be stopped.","items":{"type":"string","uniqueItems":true},"type":"array"},"command":{"default":"npm start","description":"Command to run in the launched terminal. If not provided, the terminal will open without launching a program.","type":["string","null"]},"customDescriptionGenerator":{"description":"Customize the textual description the debugger shows for objects (local variables, etc...). Samples:\n 1. this.toString() // will call toString to print all objects\n 2. this.customDescription ? this.customDescription() : defaultValue // Use customDescription method if available, if not return defaultValue\n 3. function (def) { return this.customDescription ? this.customDescription() : def } // Use customDescription method if available, if not return defaultValue\n ","type":"string"},"customPropertiesGenerator":{"deprecated":true,"description":"Customize the properties shown for an object in the debugger (local variables, etc...). Samples:\n 1. { ...this, extraProperty: '12345' } // Add an extraProperty 12345 to all objects\n 2. this.customProperties ? this.customProperties() : this // Use customProperties method if available, if not use the properties in this (the default properties)\n 3. function () { return this.customProperties ? this.customProperties() : this } // Use customDescription method if available, if not return the default properties\n\n Deprecated: This is a temporary implementation of this feature until we have time to implement it in the way described here: https://github.com/microsoft/vscode/issues/102181","type":"string"},"cwd":{"default":"${workspaceFolder}","description":"Absolute path to the working directory of the program being debugged. If you've set localRoot then cwd will match that value otherwise it falls back to your workspaceFolder","docDefault":"localRoot || ${workspaceFolder}","type":"string"},"enableContentValidation":{"default":true,"description":"Toggles whether we verify the contents of files on disk match the ones loaded in the runtime. This is useful in a variety of scenarios and required in some, but can cause issues if you have server-side transformation of scripts, for example.","type":"boolean"},"env":{"additionalProperties":{"type":["string","null"]},"default":{},"markdownDescription":"Environment variables passed to the program. The value `null` removes the variable from the environment.","type":"object"},"envFile":{"default":"${workspaceFolder}/.env","description":"Absolute path to a file containing environment variable definitions.","type":"string"},"localRoot":{"default":null,"description":"Path to the local directory containing the program.","type":["string","null"]},"nodeVersionHint":{"default":12,"description":"Allows you to explicitly specify the Node version that's running, which can be used to disable or enable certain behaviors in cases where the automatic version detection does not work.","minimum":8,"type":"number"},"outFiles":{"default":["${workspaceFolder}/**/*.js","!**/node_modules/**"],"description":"If source maps are enabled, these glob patterns specify the generated JavaScript files. If a pattern starts with `!` the files are excluded. If not specified, the generated code is expected in the same directory as its source.","items":{"type":"string"},"type":["array"]},"outputCapture":{"default":"console","enum":["console","std"],"markdownDescription":"From where to capture output messages: the default debug API if set to `console`, or stdout/stderr streams if set to `std`."},"pauseForSourceMap":{"default":false,"markdownDescription":"Whether to wait for source maps to load for each incoming script. This has a performance overhead, and might be safely disabled when running off of disk, so long as `rootPath` is not disabled.","type":"boolean"},"remoteRoot":{"default":null,"description":"Absolute path to the remote directory containing the program.","type":["string","null"]},"resolveSourceMapLocations":{"default":["${workspaceFolder}/**","!**/node_modules/**"],"description":"A list of minimatch patterns for locations (folders and URLs) in which source maps can be used to resolve local files. This can be used to avoid incorrectly breaking in external source mapped code. Patterns can be prefixed with \"!\" to exclude them. May be set to an empty array or null to avoid restriction.","items":{"type":"string"},"type":["array","null"]},"runtimeSourcemapPausePatterns":{"default":[],"items":{"type":"string"},"markdownDescription":"A list of patterns at which to manually insert entrypoint breakpoints. This can be useful to give the debugger an opportunity to set breakpoints when using sourcemaps that don't exist or can't be detected before launch, such as [with the Serverless framework](https://github.com/microsoft/vscode-js-debug/issues/492).","type":"array"},"showAsyncStacks":{"default":true,"description":"Show the async calls that led to the current call stack.","oneOf":[{"type":"boolean"},{"properties":{"onAttach":{"default":32,"type":"number"}},"required":["onAttach"],"type":"object"},{"properties":{"onceBreakpointResolved":{"default":32,"type":"number"}},"required":["onceBreakpointResolved"],"type":"object"}]},"skipFiles":{"default":["/**"],"description":"An array of file or folder names, or path globs, to skip when debugging. Star patterns and negations are allowed, for example, `[\"**/node_modules/**\", \"!**/node_modules/my-module/**\"]`","type":"array"},"smartStep":{"default":true,"description":"Automatically step through generated code that cannot be mapped back to the original source.","type":"boolean"},"sourceMapPathOverrides":{"default":{"meteor://💻app/*":"${workspaceFolder}/*","webpack:///./~/*":"${workspaceFolder}/node_modules/*","webpack://?:*/*":"${workspaceFolder}/*"},"description":"A set of mappings for rewriting the locations of source files from what the sourcemap says, to their locations on disk.","type":"object"},"sourceMapRenames":{"default":true,"description":"Whether to use the \"names\" mapping in sourcemaps. This requires requesting source content, which can be slow with certain debuggers.","type":"boolean"},"sourceMaps":{"default":true,"description":"Use JavaScript source maps (if they exist).","type":"boolean"},"timeout":{"default":10000,"description":"Retry for this number of milliseconds to connect to Node.js. Default is 10000 ms.","type":"number"},"timeouts":{"additionalProperties":false,"default":{},"description":"Timeouts for several debugger operations.","markdownDescription":"Timeouts for several debugger operations.","properties":{"hoverEvaluation":{"default":500,"description":"Time until value evaluation for hovered symbols is aborted. If set to 0, hover evaluation does never time out.","type":"number"},"sourceMapCumulativePause":{"default":1000,"description":"Extra time in milliseconds allowed per session to be spent waiting for source-maps to be processed, after the minimum time (sourceMapMinPause) has been exhausted","type":"number"},"sourceMapMinPause":{"default":1000,"description":"Minimum time in milliseconds spent waiting for each source-map to be processed when a script is being parsed","type":"number"}},"type":"object"},"trace":{"default":true,"description":"Configures what diagnostic output is produced.","oneOf":[{"description":"Trace may be set to 'true' to write diagnostic logs to the disk.","type":"boolean"},{"additionalProperties":false,"properties":{"logFile":{"description":"Configures where on disk logs are written.","type":["string","null"]},"stdio":{"description":"Whether to return trace data from the launched application or browser.","type":"boolean"}},"type":"object"}]}},"type":"object"}]},"showAsyncStacks":{"default":true,"description":"Show the async calls that led to the current call stack.","oneOf":[{"type":"boolean"},{"properties":{"onAttach":{"default":32,"type":"number"}},"required":["onAttach"],"type":"object"},{"properties":{"onceBreakpointResolved":{"default":32,"type":"number"}},"required":["onceBreakpointResolved"],"type":"object"}]},"skipFiles":{"default":["/**"],"description":"An array of file or folder names, or path globs, to skip when debugging. Star patterns and negations are allowed, for example, `[\"**/node_modules/**\", \"!**/node_modules/my-module/**\"]`","type":"array"},"smartStep":{"default":true,"description":"Automatically step through generated code that cannot be mapped back to the original source.","type":"boolean"},"sourceMapPathOverrides":{"default":{"meteor://💻app/*":"${workspaceFolder}/*","webpack:///./~/*":"${workspaceFolder}/node_modules/*","webpack://?:*/*":"${workspaceFolder}/*"},"description":"A set of mappings for rewriting the locations of source files from what the sourcemap says, to their locations on disk.","type":"object"},"sourceMapRenames":{"default":true,"description":"Whether to use the \"names\" mapping in sourcemaps. This requires requesting source content, which can be slow with certain debuggers.","type":"boolean"},"sourceMaps":{"default":true,"description":"Use JavaScript source maps (if they exist).","type":"boolean"},"targetSelection":{"default":"automatic","enum":["pick","automatic"],"markdownDescription":"Whether to attach to all targets that match the URL filter (\"automatic\") or ask to pick one (\"pick\").","type":"string"},"timeout":{"default":10000,"description":"Retry for this number of milliseconds to connect to Node.js. Default is 10000 ms.","type":"number"},"timeouts":{"additionalProperties":false,"default":{},"description":"Timeouts for several debugger operations.","markdownDescription":"Timeouts for several debugger operations.","properties":{"hoverEvaluation":{"default":500,"description":"Time until value evaluation for hovered symbols is aborted. If set to 0, hover evaluation does never time out.","type":"number"},"sourceMapCumulativePause":{"default":1000,"description":"Extra time in milliseconds allowed per session to be spent waiting for source-maps to be processed, after the minimum time (sourceMapMinPause) has been exhausted","type":"number"},"sourceMapMinPause":{"default":1000,"description":"Minimum time in milliseconds spent waiting for each source-map to be processed when a script is being parsed","type":"number"}},"type":"object"},"trace":{"default":true,"description":"Configures what diagnostic output is produced.","oneOf":[{"description":"Trace may be set to 'true' to write diagnostic logs to the disk.","type":"boolean"},{"additionalProperties":false,"properties":{"logFile":{"description":"Configures where on disk logs are written.","type":["string","null"]},"stdio":{"description":"Whether to return trace data from the launched application or browser.","type":"boolean"}},"type":"object"}]},"url":{"default":"http://localhost:8080","description":"Will search for a tab with this exact url and attach to it, if found","type":"string"},"urlFilter":{"default":"","description":"Will search for a page with this url and attach to it, if found. Can have * wildcards.","type":"string"},"vueComponentPaths":{"default":["${workspaceFolder}/**/*.vue"],"description":"A list of file glob patterns to find `*.vue` components. By default, searches the entire workspace. This needs to be specified due to extra lookups that Vue's sourcemaps require in Vue CLI 4. You can disable this special handling by setting this to an empty array.","type":"array"},"webRoot":{"default":"${workspaceFolder}","description":"This specifies the workspace absolute path to the webserver root. Used to resolve paths like `/app.js` to files on disk. Shorthand for a pathMapping for \"/\"","type":"string"}},"type":"object"},"resolveSourceMapLocations":{"default":["${workspaceFolder}/**","!**/node_modules/**"],"description":"A list of minimatch patterns for locations (folders and URLs) in which source maps can be used to resolve local files. This can be used to avoid incorrectly breaking in external source mapped code. Patterns can be prefixed with \"!\" to exclude them. May be set to an empty array or null to avoid restriction.","items":{"type":"string"},"type":["array","null"]},"runtimeExecutable":{"default":"node","markdownDescription":"Absolute path to VS Code.","type":["string","null"]},"runtimeSourcemapPausePatterns":{"default":[],"items":{"type":"string"},"markdownDescription":"A list of patterns at which to manually insert entrypoint breakpoints. This can be useful to give the debugger an opportunity to set breakpoints when using sourcemaps that don't exist or can't be detected before launch, such as [with the Serverless framework](https://github.com/microsoft/vscode-js-debug/issues/492).","type":"array"},"showAsyncStacks":{"default":true,"description":"Show the async calls that led to the current call stack.","oneOf":[{"type":"boolean"},{"properties":{"onAttach":{"default":32,"type":"number"}},"required":["onAttach"],"type":"object"},{"properties":{"onceBreakpointResolved":{"default":32,"type":"number"}},"required":["onceBreakpointResolved"],"type":"object"}]},"skipFiles":{"default":["/**"],"description":"An array of file or folder names, or path globs, to skip when debugging. Star patterns and negations are allowed, for example, `[\"**/node_modules/**\", \"!**/node_modules/my-module/**\"]`","type":"array"},"smartStep":{"default":true,"description":"Automatically step through generated code that cannot be mapped back to the original source.","type":"boolean"},"sourceMapPathOverrides":{"default":{"meteor://💻app/*":"${workspaceFolder}/*","webpack:///./~/*":"${workspaceFolder}/node_modules/*","webpack://?:*/*":"${workspaceFolder}/*"},"description":"A set of mappings for rewriting the locations of source files from what the sourcemap says, to their locations on disk.","type":"object"},"sourceMapRenames":{"default":true,"description":"Whether to use the \"names\" mapping in sourcemaps. This requires requesting source content, which can be slow with certain debuggers.","type":"boolean"},"sourceMaps":{"default":true,"description":"Use JavaScript source maps (if they exist).","type":"boolean"},"timeout":{"default":10000,"description":"Retry for this number of milliseconds to connect to Node.js. Default is 10000 ms.","type":"number"},"timeouts":{"additionalProperties":false,"default":{},"description":"Timeouts for several debugger operations.","markdownDescription":"Timeouts for several debugger operations.","properties":{"hoverEvaluation":{"default":500,"description":"Time until value evaluation for hovered symbols is aborted. If set to 0, hover evaluation does never time out.","type":"number"},"sourceMapCumulativePause":{"default":1000,"description":"Extra time in milliseconds allowed per session to be spent waiting for source-maps to be processed, after the minimum time (sourceMapMinPause) has been exhausted","type":"number"},"sourceMapMinPause":{"default":1000,"description":"Minimum time in milliseconds spent waiting for each source-map to be processed when a script is being parsed","type":"number"}},"type":"object"},"trace":{"default":true,"description":"Configures what diagnostic output is produced.","oneOf":[{"description":"Trace may be set to 'true' to write diagnostic logs to the disk.","type":"boolean"},{"additionalProperties":false,"properties":{"logFile":{"description":"Configures where on disk logs are written.","type":["string","null"]},"stdio":{"description":"Whether to return trace data from the launched application or browser.","type":"boolean"}},"type":"object"}]}},"required":["args"]}},"configurationSnippets":[{"body":{"args":["^\"--extensionDevelopmentPath=\\${workspaceFolder}\""],"name":"Launch Extension","outFiles":["^\"\\${workspaceFolder}/out/**/*.js\""],"preLaunchTask":"npm","request":"launch","type":"extensionHost"},"description":"Launch a VS Code extension in debug mode","label":"VS Code Extension Development"}],"label":"VS Code Extension Development","strings":{"unverifiedBreakpoints":"Some of your breakpoints could not be set. If you're having an issue, you can [troubleshoot your launch configuration](command:extension.js-debug.createDiagnostics)."},"type":"extensionHost"},{"aiKey":"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255","configurationAttributes":{"attach":{"properties":{"address":{"default":"localhost","description":"IP address or hostname the debugged browser is listening on.","type":"string"},"browserAttachLocation":{"default":null,"description":"Forces the browser to attach in one location. In a remote workspace (through ssh or WSL, for example) this can be used to attach to a browser on the remote machine rather than locally.","oneOf":[{"type":"null"},{"enum":["ui","workspace"],"type":"string"}]},"cascadeTerminateToConfigurations":{"default":[],"description":"A list of debug sessions which, when this debug session is terminated, will also be stopped.","items":{"type":"string","uniqueItems":true},"type":"array"},"customDescriptionGenerator":{"description":"Customize the textual description the debugger shows for objects (local variables, etc...). Samples:\n 1. this.toString() // will call toString to print all objects\n 2. this.customDescription ? this.customDescription() : defaultValue // Use customDescription method if available, if not return defaultValue\n 3. function (def) { return this.customDescription ? this.customDescription() : def } // Use customDescription method if available, if not return defaultValue\n ","type":"string"},"customPropertiesGenerator":{"deprecated":true,"description":"Customize the properties shown for an object in the debugger (local variables, etc...). Samples:\n 1. { ...this, extraProperty: '12345' } // Add an extraProperty 12345 to all objects\n 2. this.customProperties ? this.customProperties() : this // Use customProperties method if available, if not use the properties in this (the default properties)\n 3. function () { return this.customProperties ? this.customProperties() : this } // Use customDescription method if available, if not return the default properties\n\n Deprecated: This is a temporary implementation of this feature until we have time to implement it in the way described here: https://github.com/microsoft/vscode/issues/102181","type":"string"},"disableNetworkCache":{"default":true,"description":"Controls whether to skip the network cache for each request","type":"boolean"},"enableContentValidation":{"default":true,"description":"Toggles whether we verify the contents of files on disk match the ones loaded in the runtime. This is useful in a variety of scenarios and required in some, but can cause issues if you have server-side transformation of scripts, for example.","type":"boolean"},"inspectUri":{"default":null,"description":"Format to use to rewrite the inspectUri: It's a template string that interpolates keys in `{curlyBraces}`. Available keys are:\n - `url.*` is the parsed address of the running application. For instance, `{url.port}`, `{url.hostname}`\n - `port` is the debug port that Chrome is listening on.\n - `browserInspectUri` is the inspector URI on the launched browser\n - `browserInspectUriPath` is the path part of the inspector URI on the launched browser (e.g.: \"/devtools/browser/e9ec0098-306e-472a-8133-5e42488929c2\").\n - `wsProtocol` is the hinted websocket protocol. This is set to `wss` if the original URL is `https`, or `ws` otherwise.\n","type":["string","null"]},"outFiles":{"default":["${workspaceFolder}/**/*.js","!**/node_modules/**"],"description":"If source maps are enabled, these glob patterns specify the generated JavaScript files. If a pattern starts with `!` the files are excluded. If not specified, the generated code is expected in the same directory as its source.","items":{"type":"string"},"type":["array"]},"outputCapture":{"default":"console","enum":["console","std"],"markdownDescription":"From where to capture output messages: the default debug API if set to `console`, or stdout/stderr streams if set to `std`."},"pathMapping":{"default":{},"description":"A mapping of URLs/paths to local folders, to resolve scripts in the Browser to scripts on disk","type":"object"},"pauseForSourceMap":{"default":false,"markdownDescription":"Whether to wait for source maps to load for each incoming script. This has a performance overhead, and might be safely disabled when running off of disk, so long as `rootPath` is not disabled.","type":"boolean"},"perScriptSourcemaps":{"default":"auto","description":"Whether scripts are loaded individually with unique sourcemaps containing the basename of the source file. This can be set to optimize sourcemap handling when dealing with lots of small scripts. If set to \"auto\", we'll detect known cases where this is appropriate.","enum":["yes","no","auto"],"type":"string"},"port":{"default":9229,"description":"Port to use to remote debugging the browser, given as `--remote-debugging-port` when launching the browser.","type":"number"},"resolveSourceMapLocations":{"default":null,"description":"A list of minimatch patterns for locations (folders and URLs) in which source maps can be used to resolve local files. This can be used to avoid incorrectly breaking in external source mapped code. Patterns can be prefixed with \"!\" to exclude them. May be set to an empty array or null to avoid restriction.","items":{"type":"string"},"type":["array","null"]},"restart":{"default":false,"markdownDescription":"Whether to reconnect if the browser connection is closed","type":"boolean"},"server":{"oneOf":[{"additionalProperties":false,"default":{"program":"node my-server.js"},"description":"Configures a web server to start up. Takes the same configuration as the 'node' launch task.","properties":{"args":{"default":[],"description":"Command line arguments passed to the program.\n\nCan be an array of strings or a single string. When the program is launched in a terminal, setting this property to a single string will result in the arguments not being escaped for the shell.","items":{"type":"string"},"type":["array","string"]},"attachSimplePort":{"default":9229,"description":"If set, attaches to the process via the given port. This is generally no longer necessary for Node.js programs and loses the ability to debug child processes, but can be useful in more esoteric scenarios such as with Deno and Docker launches. If set to 0, a random port will be chosen and --inspect-brk added to the launch arguments automatically.","type":"integer"},"autoAttachChildProcesses":{"default":true,"description":"Attach debugger to new child processes automatically.","type":"boolean"},"cascadeTerminateToConfigurations":{"default":[],"description":"A list of debug sessions which, when this debug session is terminated, will also be stopped.","items":{"type":"string","uniqueItems":true},"type":"array"},"console":{"default":"internalConsole","description":"Where to launch the debug target.","enum":["internalConsole","integratedTerminal","externalTerminal"],"enumDescriptions":["VS Code Debug Console (which doesn't support to read input from a program)","VS Code's integrated terminal","External terminal that can be configured via user settings"],"type":"string"},"customDescriptionGenerator":{"description":"Customize the textual description the debugger shows for objects (local variables, etc...). Samples:\n 1. this.toString() // will call toString to print all objects\n 2. this.customDescription ? this.customDescription() : defaultValue // Use customDescription method if available, if not return defaultValue\n 3. function (def) { return this.customDescription ? this.customDescription() : def } // Use customDescription method if available, if not return defaultValue\n ","type":"string"},"customPropertiesGenerator":{"deprecated":true,"description":"Customize the properties shown for an object in the debugger (local variables, etc...). Samples:\n 1. { ...this, extraProperty: '12345' } // Add an extraProperty 12345 to all objects\n 2. this.customProperties ? this.customProperties() : this // Use customProperties method if available, if not use the properties in this (the default properties)\n 3. function () { return this.customProperties ? this.customProperties() : this } // Use customDescription method if available, if not return the default properties\n\n Deprecated: This is a temporary implementation of this feature until we have time to implement it in the way described here: https://github.com/microsoft/vscode/issues/102181","type":"string"},"cwd":{"default":"${workspaceFolder}","description":"Absolute path to the working directory of the program being debugged. If you've set localRoot then cwd will match that value otherwise it falls back to your workspaceFolder","type":"string"},"enableContentValidation":{"default":true,"description":"Toggles whether we verify the contents of files on disk match the ones loaded in the runtime. This is useful in a variety of scenarios and required in some, but can cause issues if you have server-side transformation of scripts, for example.","type":"boolean"},"env":{"additionalProperties":{"type":["string","null"]},"default":{},"markdownDescription":"Environment variables passed to the program. The value `null` removes the variable from the environment.","type":"object"},"envFile":{"default":"${workspaceFolder}/.env","description":"Absolute path to a file containing environment variable definitions.","type":"string"},"killBehavior":{"default":"forceful","enum":["forceful","polite","none"],"markdownDescription":"Configures how debug processes are killed when stopping the session. Can be:\n\n- forceful (default): forcefully tears down the process tree. Sends SIGKILL on posix, or `taskkill.exe /F` on Windows.\n- polite: gracefully tears down the process tree. It's possible that misbehaving processes continue to run after shutdown in this way. Sends SIGTERM on posix, or `taskkill.exe` with no `/F` (force) flag on Windows.\n- none: no termination will happen.","type":"string"},"localRoot":{"default":null,"description":"Path to the local directory containing the program.","type":["string","null"]},"nodeVersionHint":{"default":12,"description":"Allows you to explicitly specify the Node version that's running, which can be used to disable or enable certain behaviors in cases where the automatic version detection does not work.","minimum":8,"type":"number"},"outFiles":{"default":["${workspaceFolder}/**/*.js","!**/node_modules/**"],"description":"If source maps are enabled, these glob patterns specify the generated JavaScript files. If a pattern starts with `!` the files are excluded. If not specified, the generated code is expected in the same directory as its source.","items":{"type":"string"},"type":["array"]},"outputCapture":{"default":"console","enum":["console","std"],"markdownDescription":"From where to capture output messages: the default debug API if set to `console`, or stdout/stderr streams if set to `std`."},"pauseForSourceMap":{"default":false,"markdownDescription":"Whether to wait for source maps to load for each incoming script. This has a performance overhead, and might be safely disabled when running off of disk, so long as `rootPath` is not disabled.","type":"boolean"},"profileStartup":{"default":true,"description":"If true, will start profiling as soon as the process launches","type":"boolean"},"program":{"default":"","description":"Absolute path to the program. Generated value is guessed by looking at package.json and opened files. Edit this attribute.","type":"string"},"remoteRoot":{"default":null,"description":"Absolute path to the remote directory containing the program.","type":["string","null"]},"resolveSourceMapLocations":{"default":["${workspaceFolder}/**","!**/node_modules/**"],"description":"A list of minimatch patterns for locations (folders and URLs) in which source maps can be used to resolve local files. This can be used to avoid incorrectly breaking in external source mapped code. Patterns can be prefixed with \"!\" to exclude them. May be set to an empty array or null to avoid restriction.","items":{"type":"string"},"type":["array","null"]},"restart":{"default":true,"description":"Try to reconnect to the program if we lose connection. If set to `true`, we'll try once a second, forever. You can customize the interval and maximum number of attempts by specifying the `delay` and `maxAttempts` in an object instead.","oneOf":[{"type":"boolean"},{"properties":{"delay":{"default":1000,"minimum":0,"type":"number"},"maxAttempts":{"default":10,"minimum":0,"type":"number"}},"type":"object"}]},"runtimeArgs":{"default":[],"description":"Optional arguments passed to the runtime executable.","items":{"type":"string"},"type":"array"},"runtimeExecutable":{"default":"node","markdownDescription":"Runtime to use. Either an absolute path or the name of a runtime available on the PATH. If omitted `node` is assumed.","type":["string","null"]},"runtimeSourcemapPausePatterns":{"default":[],"items":{"type":"string"},"markdownDescription":"A list of patterns at which to manually insert entrypoint breakpoints. This can be useful to give the debugger an opportunity to set breakpoints when using sourcemaps that don't exist or can't be detected before launch, such as [with the Serverless framework](https://github.com/microsoft/vscode-js-debug/issues/492).","type":"array"},"runtimeVersion":{"default":"default","markdownDescription":"Version of `node` runtime to use. Requires `nvm`.","type":"string"},"showAsyncStacks":{"default":true,"description":"Show the async calls that led to the current call stack.","oneOf":[{"type":"boolean"},{"properties":{"onAttach":{"default":32,"type":"number"}},"required":["onAttach"],"type":"object"},{"properties":{"onceBreakpointResolved":{"default":32,"type":"number"}},"required":["onceBreakpointResolved"],"type":"object"}]},"skipFiles":{"default":["/**"],"description":"An array of file or folder names, or path globs, to skip when debugging. Star patterns and negations are allowed, for example, `[\"**/node_modules/**\", \"!**/node_modules/my-module/**\"]`","type":"array"},"smartStep":{"default":true,"description":"Automatically step through generated code that cannot be mapped back to the original source.","type":"boolean"},"sourceMapPathOverrides":{"default":{"meteor://💻app/*":"${workspaceFolder}/*","webpack:///./~/*":"${workspaceFolder}/node_modules/*","webpack://?:*/*":"${workspaceFolder}/*"},"description":"A set of mappings for rewriting the locations of source files from what the sourcemap says, to their locations on disk.","type":"object"},"sourceMapRenames":{"default":true,"description":"Whether to use the \"names\" mapping in sourcemaps. This requires requesting source content, which can be slow with certain debuggers.","type":"boolean"},"sourceMaps":{"default":true,"description":"Use JavaScript source maps (if they exist).","type":"boolean"},"stopOnEntry":{"default":true,"description":"Automatically stop program after launch.","type":["boolean","string"]},"timeout":{"default":10000,"description":"Retry for this number of milliseconds to connect to Node.js. Default is 10000 ms.","type":"number"},"timeouts":{"additionalProperties":false,"default":{},"description":"Timeouts for several debugger operations.","markdownDescription":"Timeouts for several debugger operations.","properties":{"hoverEvaluation":{"default":500,"description":"Time until value evaluation for hovered symbols is aborted. If set to 0, hover evaluation does never time out.","type":"number"},"sourceMapCumulativePause":{"default":1000,"description":"Extra time in milliseconds allowed per session to be spent waiting for source-maps to be processed, after the minimum time (sourceMapMinPause) has been exhausted","type":"number"},"sourceMapMinPause":{"default":1000,"description":"Minimum time in milliseconds spent waiting for each source-map to be processed when a script is being parsed","type":"number"}},"type":"object"},"trace":{"default":true,"description":"Configures what diagnostic output is produced.","oneOf":[{"description":"Trace may be set to 'true' to write diagnostic logs to the disk.","type":"boolean"},{"additionalProperties":false,"properties":{"logFile":{"description":"Configures where on disk logs are written.","type":["string","null"]},"stdio":{"description":"Whether to return trace data from the launched application or browser.","type":"boolean"}},"type":"object"}]}},"type":"object"},{"additionalProperties":false,"default":{"program":"npm start"},"description":"JavaScript Debug Terminal","properties":{"autoAttachChildProcesses":{"default":true,"description":"Attach debugger to new child processes automatically.","type":"boolean"},"cascadeTerminateToConfigurations":{"default":[],"description":"A list of debug sessions which, when this debug session is terminated, will also be stopped.","items":{"type":"string","uniqueItems":true},"type":"array"},"command":{"default":"npm start","description":"Command to run in the launched terminal. If not provided, the terminal will open without launching a program.","type":["string","null"]},"customDescriptionGenerator":{"description":"Customize the textual description the debugger shows for objects (local variables, etc...). Samples:\n 1. this.toString() // will call toString to print all objects\n 2. this.customDescription ? this.customDescription() : defaultValue // Use customDescription method if available, if not return defaultValue\n 3. function (def) { return this.customDescription ? this.customDescription() : def } // Use customDescription method if available, if not return defaultValue\n ","type":"string"},"customPropertiesGenerator":{"deprecated":true,"description":"Customize the properties shown for an object in the debugger (local variables, etc...). Samples:\n 1. { ...this, extraProperty: '12345' } // Add an extraProperty 12345 to all objects\n 2. this.customProperties ? this.customProperties() : this // Use customProperties method if available, if not use the properties in this (the default properties)\n 3. function () { return this.customProperties ? this.customProperties() : this } // Use customDescription method if available, if not return the default properties\n\n Deprecated: This is a temporary implementation of this feature until we have time to implement it in the way described here: https://github.com/microsoft/vscode/issues/102181","type":"string"},"cwd":{"default":"${workspaceFolder}","description":"Absolute path to the working directory of the program being debugged. If you've set localRoot then cwd will match that value otherwise it falls back to your workspaceFolder","docDefault":"localRoot || ${workspaceFolder}","type":"string"},"enableContentValidation":{"default":true,"description":"Toggles whether we verify the contents of files on disk match the ones loaded in the runtime. This is useful in a variety of scenarios and required in some, but can cause issues if you have server-side transformation of scripts, for example.","type":"boolean"},"env":{"additionalProperties":{"type":["string","null"]},"default":{},"markdownDescription":"Environment variables passed to the program. The value `null` removes the variable from the environment.","type":"object"},"envFile":{"default":"${workspaceFolder}/.env","description":"Absolute path to a file containing environment variable definitions.","type":"string"},"localRoot":{"default":null,"description":"Path to the local directory containing the program.","type":["string","null"]},"nodeVersionHint":{"default":12,"description":"Allows you to explicitly specify the Node version that's running, which can be used to disable or enable certain behaviors in cases where the automatic version detection does not work.","minimum":8,"type":"number"},"outFiles":{"default":["${workspaceFolder}/**/*.js","!**/node_modules/**"],"description":"If source maps are enabled, these glob patterns specify the generated JavaScript files. If a pattern starts with `!` the files are excluded. If not specified, the generated code is expected in the same directory as its source.","items":{"type":"string"},"type":["array"]},"outputCapture":{"default":"console","enum":["console","std"],"markdownDescription":"From where to capture output messages: the default debug API if set to `console`, or stdout/stderr streams if set to `std`."},"pauseForSourceMap":{"default":false,"markdownDescription":"Whether to wait for source maps to load for each incoming script. This has a performance overhead, and might be safely disabled when running off of disk, so long as `rootPath` is not disabled.","type":"boolean"},"remoteRoot":{"default":null,"description":"Absolute path to the remote directory containing the program.","type":["string","null"]},"resolveSourceMapLocations":{"default":["${workspaceFolder}/**","!**/node_modules/**"],"description":"A list of minimatch patterns for locations (folders and URLs) in which source maps can be used to resolve local files. This can be used to avoid incorrectly breaking in external source mapped code. Patterns can be prefixed with \"!\" to exclude them. May be set to an empty array or null to avoid restriction.","items":{"type":"string"},"type":["array","null"]},"runtimeSourcemapPausePatterns":{"default":[],"items":{"type":"string"},"markdownDescription":"A list of patterns at which to manually insert entrypoint breakpoints. This can be useful to give the debugger an opportunity to set breakpoints when using sourcemaps that don't exist or can't be detected before launch, such as [with the Serverless framework](https://github.com/microsoft/vscode-js-debug/issues/492).","type":"array"},"showAsyncStacks":{"default":true,"description":"Show the async calls that led to the current call stack.","oneOf":[{"type":"boolean"},{"properties":{"onAttach":{"default":32,"type":"number"}},"required":["onAttach"],"type":"object"},{"properties":{"onceBreakpointResolved":{"default":32,"type":"number"}},"required":["onceBreakpointResolved"],"type":"object"}]},"skipFiles":{"default":["/**"],"description":"An array of file or folder names, or path globs, to skip when debugging. Star patterns and negations are allowed, for example, `[\"**/node_modules/**\", \"!**/node_modules/my-module/**\"]`","type":"array"},"smartStep":{"default":true,"description":"Automatically step through generated code that cannot be mapped back to the original source.","type":"boolean"},"sourceMapPathOverrides":{"default":{"meteor://💻app/*":"${workspaceFolder}/*","webpack:///./~/*":"${workspaceFolder}/node_modules/*","webpack://?:*/*":"${workspaceFolder}/*"},"description":"A set of mappings for rewriting the locations of source files from what the sourcemap says, to their locations on disk.","type":"object"},"sourceMapRenames":{"default":true,"description":"Whether to use the \"names\" mapping in sourcemaps. This requires requesting source content, which can be slow with certain debuggers.","type":"boolean"},"sourceMaps":{"default":true,"description":"Use JavaScript source maps (if they exist).","type":"boolean"},"timeout":{"default":10000,"description":"Retry for this number of milliseconds to connect to Node.js. Default is 10000 ms.","type":"number"},"timeouts":{"additionalProperties":false,"default":{},"description":"Timeouts for several debugger operations.","markdownDescription":"Timeouts for several debugger operations.","properties":{"hoverEvaluation":{"default":500,"description":"Time until value evaluation for hovered symbols is aborted. If set to 0, hover evaluation does never time out.","type":"number"},"sourceMapCumulativePause":{"default":1000,"description":"Extra time in milliseconds allowed per session to be spent waiting for source-maps to be processed, after the minimum time (sourceMapMinPause) has been exhausted","type":"number"},"sourceMapMinPause":{"default":1000,"description":"Minimum time in milliseconds spent waiting for each source-map to be processed when a script is being parsed","type":"number"}},"type":"object"},"trace":{"default":true,"description":"Configures what diagnostic output is produced.","oneOf":[{"description":"Trace may be set to 'true' to write diagnostic logs to the disk.","type":"boolean"},{"additionalProperties":false,"properties":{"logFile":{"description":"Configures where on disk logs are written.","type":["string","null"]},"stdio":{"description":"Whether to return trace data from the launched application or browser.","type":"boolean"}},"type":"object"}]}},"type":"object"}]},"showAsyncStacks":{"default":true,"description":"Show the async calls that led to the current call stack.","oneOf":[{"type":"boolean"},{"properties":{"onAttach":{"default":32,"type":"number"}},"required":["onAttach"],"type":"object"},{"properties":{"onceBreakpointResolved":{"default":32,"type":"number"}},"required":["onceBreakpointResolved"],"type":"object"}]},"skipFiles":{"default":["/**"],"description":"An array of file or folder names, or path globs, to skip when debugging. Star patterns and negations are allowed, for example, `[\"**/node_modules/**\", \"!**/node_modules/my-module/**\"]`","type":"array"},"smartStep":{"default":true,"description":"Automatically step through generated code that cannot be mapped back to the original source.","type":"boolean"},"sourceMapPathOverrides":{"default":{"meteor://💻app/*":"${workspaceFolder}/*","webpack:///./~/*":"${workspaceFolder}/node_modules/*","webpack://?:*/*":"${workspaceFolder}/*"},"description":"A set of mappings for rewriting the locations of source files from what the sourcemap says, to their locations on disk.","type":"object"},"sourceMapRenames":{"default":true,"description":"Whether to use the \"names\" mapping in sourcemaps. This requires requesting source content, which can be slow with certain debuggers.","type":"boolean"},"sourceMaps":{"default":true,"description":"Use JavaScript source maps (if they exist).","type":"boolean"},"targetSelection":{"default":"automatic","enum":["pick","automatic"],"markdownDescription":"Whether to attach to all targets that match the URL filter (\"automatic\") or ask to pick one (\"pick\").","type":"string"},"timeout":{"default":10000,"description":"Retry for this number of milliseconds to connect to Node.js. Default is 10000 ms.","type":"number"},"timeouts":{"additionalProperties":false,"default":{},"description":"Timeouts for several debugger operations.","markdownDescription":"Timeouts for several debugger operations.","properties":{"hoverEvaluation":{"default":500,"description":"Time until value evaluation for hovered symbols is aborted. If set to 0, hover evaluation does never time out.","type":"number"},"sourceMapCumulativePause":{"default":1000,"description":"Extra time in milliseconds allowed per session to be spent waiting for source-maps to be processed, after the minimum time (sourceMapMinPause) has been exhausted","type":"number"},"sourceMapMinPause":{"default":1000,"description":"Minimum time in milliseconds spent waiting for each source-map to be processed when a script is being parsed","type":"number"}},"type":"object"},"trace":{"default":true,"description":"Configures what diagnostic output is produced.","oneOf":[{"description":"Trace may be set to 'true' to write diagnostic logs to the disk.","type":"boolean"},{"additionalProperties":false,"properties":{"logFile":{"description":"Configures where on disk logs are written.","type":["string","null"]},"stdio":{"description":"Whether to return trace data from the launched application or browser.","type":"boolean"}},"type":"object"}]},"url":{"default":"http://localhost:8080","description":"Will search for a tab with this exact url and attach to it, if found","type":"string"},"urlFilter":{"default":"","description":"Will search for a page with this url and attach to it, if found. Can have * wildcards.","type":"string"},"vueComponentPaths":{"default":["${workspaceFolder}/**/*.vue"],"description":"A list of file glob patterns to find `*.vue` components. By default, searches the entire workspace. This needs to be specified due to extra lookups that Vue's sourcemaps require in Vue CLI 4. You can disable this special handling by setting this to an empty array.","type":"array"},"webRoot":{"default":"${workspaceFolder}","description":"This specifies the workspace absolute path to the webserver root. Used to resolve paths like `/app.js` to files on disk. Shorthand for a pathMapping for \"/\"","type":"string"}}},"launch":{"properties":{"browserLaunchLocation":{"default":null,"description":"Forces the browser to be launched in one location. In a remote workspace (through ssh or WSL, for example) this can be used to open the browser on the remote machine rather than locally.","oneOf":[{"type":"null"},{"enum":["ui","workspace"],"type":"string"}]},"cascadeTerminateToConfigurations":{"default":[],"description":"A list of debug sessions which, when this debug session is terminated, will also be stopped.","items":{"type":"string","uniqueItems":true},"type":"array"},"cleanUp":{"default":"wholeBrowser","description":"What clean-up to do after the debugging session finishes. Close only the tab being debug, vs. close the whole browser.","enum":["wholeBrowser","onlyTab"],"type":"string"},"customDescriptionGenerator":{"description":"Customize the textual description the debugger shows for objects (local variables, etc...). Samples:\n 1. this.toString() // will call toString to print all objects\n 2. this.customDescription ? this.customDescription() : defaultValue // Use customDescription method if available, if not return defaultValue\n 3. function (def) { return this.customDescription ? this.customDescription() : def } // Use customDescription method if available, if not return defaultValue\n ","type":"string"},"customPropertiesGenerator":{"deprecated":true,"description":"Customize the properties shown for an object in the debugger (local variables, etc...). Samples:\n 1. { ...this, extraProperty: '12345' } // Add an extraProperty 12345 to all objects\n 2. this.customProperties ? this.customProperties() : this // Use customProperties method if available, if not use the properties in this (the default properties)\n 3. function () { return this.customProperties ? this.customProperties() : this } // Use customDescription method if available, if not return the default properties\n\n Deprecated: This is a temporary implementation of this feature until we have time to implement it in the way described here: https://github.com/microsoft/vscode/issues/102181","type":"string"},"cwd":{"default":null,"description":"Optional working directory for the runtime executable.","type":"string"},"disableNetworkCache":{"default":true,"description":"Controls whether to skip the network cache for each request","type":"boolean"},"enableContentValidation":{"default":true,"description":"Toggles whether we verify the contents of files on disk match the ones loaded in the runtime. This is useful in a variety of scenarios and required in some, but can cause issues if you have server-side transformation of scripts, for example.","type":"boolean"},"env":{"default":{},"description":"Optional dictionary of environment key/value pairs for the browser.","type":"object"},"file":{"default":"${workspaceFolder}/index.html","description":"A local html file to open in the browser","type":"string"},"includeDefaultArgs":{"default":true,"description":"Whether default browser launch arguments (to disable features that may make debugging harder) will be included in the launch.","type":"boolean"},"includeLaunchArgs":{"default":true,"description":"Advanced: whether any default launch/debugging arguments are set on the browser. The debugger will assume the browser will use pipe debugging such as that which is provided with `--remote-debugging-pipe`.","type":"boolean"},"inspectUri":{"default":null,"description":"Format to use to rewrite the inspectUri: It's a template string that interpolates keys in `{curlyBraces}`. Available keys are:\n - `url.*` is the parsed address of the running application. For instance, `{url.port}`, `{url.hostname}`\n - `port` is the debug port that Chrome is listening on.\n - `browserInspectUri` is the inspector URI on the launched browser\n - `browserInspectUriPath` is the path part of the inspector URI on the launched browser (e.g.: \"/devtools/browser/e9ec0098-306e-472a-8133-5e42488929c2\").\n - `wsProtocol` is the hinted websocket protocol. This is set to `wss` if the original URL is `https`, or `ws` otherwise.\n","type":["string","null"]},"outFiles":{"default":["${workspaceFolder}/**/*.js","!**/node_modules/**"],"description":"If source maps are enabled, these glob patterns specify the generated JavaScript files. If a pattern starts with `!` the files are excluded. If not specified, the generated code is expected in the same directory as its source.","items":{"type":"string"},"type":["array"]},"outputCapture":{"default":"console","enum":["console","std"],"markdownDescription":"From where to capture output messages: the default debug API if set to `console`, or stdout/stderr streams if set to `std`."},"pathMapping":{"default":{},"description":"A mapping of URLs/paths to local folders, to resolve scripts in the Browser to scripts on disk","type":"object"},"pauseForSourceMap":{"default":false,"markdownDescription":"Whether to wait for source maps to load for each incoming script. This has a performance overhead, and might be safely disabled when running off of disk, so long as `rootPath` is not disabled.","type":"boolean"},"perScriptSourcemaps":{"default":"auto","description":"Whether scripts are loaded individually with unique sourcemaps containing the basename of the source file. This can be set to optimize sourcemap handling when dealing with lots of small scripts. If set to \"auto\", we'll detect known cases where this is appropriate.","enum":["yes","no","auto"],"type":"string"},"port":{"default":0,"description":"Port for the browser to listen on. Defaults to \"0\", which will cause the browser to be debugged via pipes, which is generally more secure and should be chosen unless you need to attach to the browser from another tool.","type":"number"},"profileStartup":{"default":true,"description":"If true, will start profiling soon as the process launches","type":"boolean"},"resolveSourceMapLocations":{"default":null,"description":"A list of minimatch patterns for locations (folders and URLs) in which source maps can be used to resolve local files. This can be used to avoid incorrectly breaking in external source mapped code. Patterns can be prefixed with \"!\" to exclude them. May be set to an empty array or null to avoid restriction.","items":{"type":"string"},"type":["array","null"]},"runtimeArgs":{"default":[],"description":"Optional arguments passed to the runtime executable.","items":{"type":"string"},"type":"array"},"runtimeExecutable":{"default":"stable","description":"Either 'canary', 'stable', 'custom' or path to the browser executable. Custom means a custom wrapper, custom build or CHROME_PATH environment variable.","type":["string","null"]},"server":{"oneOf":[{"additionalProperties":false,"default":{"program":"node my-server.js"},"description":"Configures a web server to start up. Takes the same configuration as the 'node' launch task.","properties":{"args":{"default":[],"description":"Command line arguments passed to the program.\n\nCan be an array of strings or a single string. When the program is launched in a terminal, setting this property to a single string will result in the arguments not being escaped for the shell.","items":{"type":"string"},"type":["array","string"]},"attachSimplePort":{"default":9229,"description":"If set, attaches to the process via the given port. This is generally no longer necessary for Node.js programs and loses the ability to debug child processes, but can be useful in more esoteric scenarios such as with Deno and Docker launches. If set to 0, a random port will be chosen and --inspect-brk added to the launch arguments automatically.","type":"integer"},"autoAttachChildProcesses":{"default":true,"description":"Attach debugger to new child processes automatically.","type":"boolean"},"cascadeTerminateToConfigurations":{"default":[],"description":"A list of debug sessions which, when this debug session is terminated, will also be stopped.","items":{"type":"string","uniqueItems":true},"type":"array"},"console":{"default":"internalConsole","description":"Where to launch the debug target.","enum":["internalConsole","integratedTerminal","externalTerminal"],"enumDescriptions":["VS Code Debug Console (which doesn't support to read input from a program)","VS Code's integrated terminal","External terminal that can be configured via user settings"],"type":"string"},"customDescriptionGenerator":{"description":"Customize the textual description the debugger shows for objects (local variables, etc...). Samples:\n 1. this.toString() // will call toString to print all objects\n 2. this.customDescription ? this.customDescription() : defaultValue // Use customDescription method if available, if not return defaultValue\n 3. function (def) { return this.customDescription ? this.customDescription() : def } // Use customDescription method if available, if not return defaultValue\n ","type":"string"},"customPropertiesGenerator":{"deprecated":true,"description":"Customize the properties shown for an object in the debugger (local variables, etc...). Samples:\n 1. { ...this, extraProperty: '12345' } // Add an extraProperty 12345 to all objects\n 2. this.customProperties ? this.customProperties() : this // Use customProperties method if available, if not use the properties in this (the default properties)\n 3. function () { return this.customProperties ? this.customProperties() : this } // Use customDescription method if available, if not return the default properties\n\n Deprecated: This is a temporary implementation of this feature until we have time to implement it in the way described here: https://github.com/microsoft/vscode/issues/102181","type":"string"},"cwd":{"default":"${workspaceFolder}","description":"Absolute path to the working directory of the program being debugged. If you've set localRoot then cwd will match that value otherwise it falls back to your workspaceFolder","type":"string"},"enableContentValidation":{"default":true,"description":"Toggles whether we verify the contents of files on disk match the ones loaded in the runtime. This is useful in a variety of scenarios and required in some, but can cause issues if you have server-side transformation of scripts, for example.","type":"boolean"},"env":{"additionalProperties":{"type":["string","null"]},"default":{},"markdownDescription":"Environment variables passed to the program. The value `null` removes the variable from the environment.","type":"object"},"envFile":{"default":"${workspaceFolder}/.env","description":"Absolute path to a file containing environment variable definitions.","type":"string"},"killBehavior":{"default":"forceful","enum":["forceful","polite","none"],"markdownDescription":"Configures how debug processes are killed when stopping the session. Can be:\n\n- forceful (default): forcefully tears down the process tree. Sends SIGKILL on posix, or `taskkill.exe /F` on Windows.\n- polite: gracefully tears down the process tree. It's possible that misbehaving processes continue to run after shutdown in this way. Sends SIGTERM on posix, or `taskkill.exe` with no `/F` (force) flag on Windows.\n- none: no termination will happen.","type":"string"},"localRoot":{"default":null,"description":"Path to the local directory containing the program.","type":["string","null"]},"nodeVersionHint":{"default":12,"description":"Allows you to explicitly specify the Node version that's running, which can be used to disable or enable certain behaviors in cases where the automatic version detection does not work.","minimum":8,"type":"number"},"outFiles":{"default":["${workspaceFolder}/**/*.js","!**/node_modules/**"],"description":"If source maps are enabled, these glob patterns specify the generated JavaScript files. If a pattern starts with `!` the files are excluded. If not specified, the generated code is expected in the same directory as its source.","items":{"type":"string"},"type":["array"]},"outputCapture":{"default":"console","enum":["console","std"],"markdownDescription":"From where to capture output messages: the default debug API if set to `console`, or stdout/stderr streams if set to `std`."},"pauseForSourceMap":{"default":false,"markdownDescription":"Whether to wait for source maps to load for each incoming script. This has a performance overhead, and might be safely disabled when running off of disk, so long as `rootPath` is not disabled.","type":"boolean"},"profileStartup":{"default":true,"description":"If true, will start profiling as soon as the process launches","type":"boolean"},"program":{"default":"","description":"Absolute path to the program. Generated value is guessed by looking at package.json and opened files. Edit this attribute.","type":"string"},"remoteRoot":{"default":null,"description":"Absolute path to the remote directory containing the program.","type":["string","null"]},"resolveSourceMapLocations":{"default":["${workspaceFolder}/**","!**/node_modules/**"],"description":"A list of minimatch patterns for locations (folders and URLs) in which source maps can be used to resolve local files. This can be used to avoid incorrectly breaking in external source mapped code. Patterns can be prefixed with \"!\" to exclude them. May be set to an empty array or null to avoid restriction.","items":{"type":"string"},"type":["array","null"]},"restart":{"default":true,"description":"Try to reconnect to the program if we lose connection. If set to `true`, we'll try once a second, forever. You can customize the interval and maximum number of attempts by specifying the `delay` and `maxAttempts` in an object instead.","oneOf":[{"type":"boolean"},{"properties":{"delay":{"default":1000,"minimum":0,"type":"number"},"maxAttempts":{"default":10,"minimum":0,"type":"number"}},"type":"object"}]},"runtimeArgs":{"default":[],"description":"Optional arguments passed to the runtime executable.","items":{"type":"string"},"type":"array"},"runtimeExecutable":{"default":"node","markdownDescription":"Runtime to use. Either an absolute path or the name of a runtime available on the PATH. If omitted `node` is assumed.","type":["string","null"]},"runtimeSourcemapPausePatterns":{"default":[],"items":{"type":"string"},"markdownDescription":"A list of patterns at which to manually insert entrypoint breakpoints. This can be useful to give the debugger an opportunity to set breakpoints when using sourcemaps that don't exist or can't be detected before launch, such as [with the Serverless framework](https://github.com/microsoft/vscode-js-debug/issues/492).","type":"array"},"runtimeVersion":{"default":"default","markdownDescription":"Version of `node` runtime to use. Requires `nvm`.","type":"string"},"showAsyncStacks":{"default":true,"description":"Show the async calls that led to the current call stack.","oneOf":[{"type":"boolean"},{"properties":{"onAttach":{"default":32,"type":"number"}},"required":["onAttach"],"type":"object"},{"properties":{"onceBreakpointResolved":{"default":32,"type":"number"}},"required":["onceBreakpointResolved"],"type":"object"}]},"skipFiles":{"default":["/**"],"description":"An array of file or folder names, or path globs, to skip when debugging. Star patterns and negations are allowed, for example, `[\"**/node_modules/**\", \"!**/node_modules/my-module/**\"]`","type":"array"},"smartStep":{"default":true,"description":"Automatically step through generated code that cannot be mapped back to the original source.","type":"boolean"},"sourceMapPathOverrides":{"default":{"meteor://💻app/*":"${workspaceFolder}/*","webpack:///./~/*":"${workspaceFolder}/node_modules/*","webpack://?:*/*":"${workspaceFolder}/*"},"description":"A set of mappings for rewriting the locations of source files from what the sourcemap says, to their locations on disk.","type":"object"},"sourceMapRenames":{"default":true,"description":"Whether to use the \"names\" mapping in sourcemaps. This requires requesting source content, which can be slow with certain debuggers.","type":"boolean"},"sourceMaps":{"default":true,"description":"Use JavaScript source maps (if they exist).","type":"boolean"},"stopOnEntry":{"default":true,"description":"Automatically stop program after launch.","type":["boolean","string"]},"timeout":{"default":10000,"description":"Retry for this number of milliseconds to connect to Node.js. Default is 10000 ms.","type":"number"},"timeouts":{"additionalProperties":false,"default":{},"description":"Timeouts for several debugger operations.","markdownDescription":"Timeouts for several debugger operations.","properties":{"hoverEvaluation":{"default":500,"description":"Time until value evaluation for hovered symbols is aborted. If set to 0, hover evaluation does never time out.","type":"number"},"sourceMapCumulativePause":{"default":1000,"description":"Extra time in milliseconds allowed per session to be spent waiting for source-maps to be processed, after the minimum time (sourceMapMinPause) has been exhausted","type":"number"},"sourceMapMinPause":{"default":1000,"description":"Minimum time in milliseconds spent waiting for each source-map to be processed when a script is being parsed","type":"number"}},"type":"object"},"trace":{"default":true,"description":"Configures what diagnostic output is produced.","oneOf":[{"description":"Trace may be set to 'true' to write diagnostic logs to the disk.","type":"boolean"},{"additionalProperties":false,"properties":{"logFile":{"description":"Configures where on disk logs are written.","type":["string","null"]},"stdio":{"description":"Whether to return trace data from the launched application or browser.","type":"boolean"}},"type":"object"}]}},"type":"object"},{"additionalProperties":false,"default":{"program":"npm start"},"description":"JavaScript Debug Terminal","properties":{"autoAttachChildProcesses":{"default":true,"description":"Attach debugger to new child processes automatically.","type":"boolean"},"cascadeTerminateToConfigurations":{"default":[],"description":"A list of debug sessions which, when this debug session is terminated, will also be stopped.","items":{"type":"string","uniqueItems":true},"type":"array"},"command":{"default":"npm start","description":"Command to run in the launched terminal. If not provided, the terminal will open without launching a program.","type":["string","null"]},"customDescriptionGenerator":{"description":"Customize the textual description the debugger shows for objects (local variables, etc...). Samples:\n 1. this.toString() // will call toString to print all objects\n 2. this.customDescription ? this.customDescription() : defaultValue // Use customDescription method if available, if not return defaultValue\n 3. function (def) { return this.customDescription ? this.customDescription() : def } // Use customDescription method if available, if not return defaultValue\n ","type":"string"},"customPropertiesGenerator":{"deprecated":true,"description":"Customize the properties shown for an object in the debugger (local variables, etc...). Samples:\n 1. { ...this, extraProperty: '12345' } // Add an extraProperty 12345 to all objects\n 2. this.customProperties ? this.customProperties() : this // Use customProperties method if available, if not use the properties in this (the default properties)\n 3. function () { return this.customProperties ? this.customProperties() : this } // Use customDescription method if available, if not return the default properties\n\n Deprecated: This is a temporary implementation of this feature until we have time to implement it in the way described here: https://github.com/microsoft/vscode/issues/102181","type":"string"},"cwd":{"default":"${workspaceFolder}","description":"Absolute path to the working directory of the program being debugged. If you've set localRoot then cwd will match that value otherwise it falls back to your workspaceFolder","docDefault":"localRoot || ${workspaceFolder}","type":"string"},"enableContentValidation":{"default":true,"description":"Toggles whether we verify the contents of files on disk match the ones loaded in the runtime. This is useful in a variety of scenarios and required in some, but can cause issues if you have server-side transformation of scripts, for example.","type":"boolean"},"env":{"additionalProperties":{"type":["string","null"]},"default":{},"markdownDescription":"Environment variables passed to the program. The value `null` removes the variable from the environment.","type":"object"},"envFile":{"default":"${workspaceFolder}/.env","description":"Absolute path to a file containing environment variable definitions.","type":"string"},"localRoot":{"default":null,"description":"Path to the local directory containing the program.","type":["string","null"]},"nodeVersionHint":{"default":12,"description":"Allows you to explicitly specify the Node version that's running, which can be used to disable or enable certain behaviors in cases where the automatic version detection does not work.","minimum":8,"type":"number"},"outFiles":{"default":["${workspaceFolder}/**/*.js","!**/node_modules/**"],"description":"If source maps are enabled, these glob patterns specify the generated JavaScript files. If a pattern starts with `!` the files are excluded. If not specified, the generated code is expected in the same directory as its source.","items":{"type":"string"},"type":["array"]},"outputCapture":{"default":"console","enum":["console","std"],"markdownDescription":"From where to capture output messages: the default debug API if set to `console`, or stdout/stderr streams if set to `std`."},"pauseForSourceMap":{"default":false,"markdownDescription":"Whether to wait for source maps to load for each incoming script. This has a performance overhead, and might be safely disabled when running off of disk, so long as `rootPath` is not disabled.","type":"boolean"},"remoteRoot":{"default":null,"description":"Absolute path to the remote directory containing the program.","type":["string","null"]},"resolveSourceMapLocations":{"default":["${workspaceFolder}/**","!**/node_modules/**"],"description":"A list of minimatch patterns for locations (folders and URLs) in which source maps can be used to resolve local files. This can be used to avoid incorrectly breaking in external source mapped code. Patterns can be prefixed with \"!\" to exclude them. May be set to an empty array or null to avoid restriction.","items":{"type":"string"},"type":["array","null"]},"runtimeSourcemapPausePatterns":{"default":[],"items":{"type":"string"},"markdownDescription":"A list of patterns at which to manually insert entrypoint breakpoints. This can be useful to give the debugger an opportunity to set breakpoints when using sourcemaps that don't exist or can't be detected before launch, such as [with the Serverless framework](https://github.com/microsoft/vscode-js-debug/issues/492).","type":"array"},"showAsyncStacks":{"default":true,"description":"Show the async calls that led to the current call stack.","oneOf":[{"type":"boolean"},{"properties":{"onAttach":{"default":32,"type":"number"}},"required":["onAttach"],"type":"object"},{"properties":{"onceBreakpointResolved":{"default":32,"type":"number"}},"required":["onceBreakpointResolved"],"type":"object"}]},"skipFiles":{"default":["/**"],"description":"An array of file or folder names, or path globs, to skip when debugging. Star patterns and negations are allowed, for example, `[\"**/node_modules/**\", \"!**/node_modules/my-module/**\"]`","type":"array"},"smartStep":{"default":true,"description":"Automatically step through generated code that cannot be mapped back to the original source.","type":"boolean"},"sourceMapPathOverrides":{"default":{"meteor://💻app/*":"${workspaceFolder}/*","webpack:///./~/*":"${workspaceFolder}/node_modules/*","webpack://?:*/*":"${workspaceFolder}/*"},"description":"A set of mappings for rewriting the locations of source files from what the sourcemap says, to their locations on disk.","type":"object"},"sourceMapRenames":{"default":true,"description":"Whether to use the \"names\" mapping in sourcemaps. This requires requesting source content, which can be slow with certain debuggers.","type":"boolean"},"sourceMaps":{"default":true,"description":"Use JavaScript source maps (if they exist).","type":"boolean"},"timeout":{"default":10000,"description":"Retry for this number of milliseconds to connect to Node.js. Default is 10000 ms.","type":"number"},"timeouts":{"additionalProperties":false,"default":{},"description":"Timeouts for several debugger operations.","markdownDescription":"Timeouts for several debugger operations.","properties":{"hoverEvaluation":{"default":500,"description":"Time until value evaluation for hovered symbols is aborted. If set to 0, hover evaluation does never time out.","type":"number"},"sourceMapCumulativePause":{"default":1000,"description":"Extra time in milliseconds allowed per session to be spent waiting for source-maps to be processed, after the minimum time (sourceMapMinPause) has been exhausted","type":"number"},"sourceMapMinPause":{"default":1000,"description":"Minimum time in milliseconds spent waiting for each source-map to be processed when a script is being parsed","type":"number"}},"type":"object"},"trace":{"default":true,"description":"Configures what diagnostic output is produced.","oneOf":[{"description":"Trace may be set to 'true' to write diagnostic logs to the disk.","type":"boolean"},{"additionalProperties":false,"properties":{"logFile":{"description":"Configures where on disk logs are written.","type":["string","null"]},"stdio":{"description":"Whether to return trace data from the launched application or browser.","type":"boolean"}},"type":"object"}]}},"type":"object"}]},"showAsyncStacks":{"default":true,"description":"Show the async calls that led to the current call stack.","oneOf":[{"type":"boolean"},{"properties":{"onAttach":{"default":32,"type":"number"}},"required":["onAttach"],"type":"object"},{"properties":{"onceBreakpointResolved":{"default":32,"type":"number"}},"required":["onceBreakpointResolved"],"type":"object"}]},"skipFiles":{"default":["/**"],"description":"An array of file or folder names, or path globs, to skip when debugging. Star patterns and negations are allowed, for example, `[\"**/node_modules/**\", \"!**/node_modules/my-module/**\"]`","type":"array"},"smartStep":{"default":true,"description":"Automatically step through generated code that cannot be mapped back to the original source.","type":"boolean"},"sourceMapPathOverrides":{"default":{"meteor://💻app/*":"${workspaceFolder}/*","webpack:///./~/*":"${workspaceFolder}/node_modules/*","webpack://?:*/*":"${workspaceFolder}/*"},"description":"A set of mappings for rewriting the locations of source files from what the sourcemap says, to their locations on disk.","type":"object"},"sourceMapRenames":{"default":true,"description":"Whether to use the \"names\" mapping in sourcemaps. This requires requesting source content, which can be slow with certain debuggers.","type":"boolean"},"sourceMaps":{"default":true,"description":"Use JavaScript source maps (if they exist).","type":"boolean"},"timeout":{"default":10000,"description":"Retry for this number of milliseconds to connect to Node.js. Default is 10000 ms.","type":"number"},"timeouts":{"additionalProperties":false,"default":{},"description":"Timeouts for several debugger operations.","markdownDescription":"Timeouts for several debugger operations.","properties":{"hoverEvaluation":{"default":500,"description":"Time until value evaluation for hovered symbols is aborted. If set to 0, hover evaluation does never time out.","type":"number"},"sourceMapCumulativePause":{"default":1000,"description":"Extra time in milliseconds allowed per session to be spent waiting for source-maps to be processed, after the minimum time (sourceMapMinPause) has been exhausted","type":"number"},"sourceMapMinPause":{"default":1000,"description":"Minimum time in milliseconds spent waiting for each source-map to be processed when a script is being parsed","type":"number"}},"type":"object"},"trace":{"default":true,"description":"Configures what diagnostic output is produced.","oneOf":[{"description":"Trace may be set to 'true' to write diagnostic logs to the disk.","type":"boolean"},{"additionalProperties":false,"properties":{"logFile":{"description":"Configures where on disk logs are written.","type":["string","null"]},"stdio":{"description":"Whether to return trace data from the launched application or browser.","type":"boolean"}},"type":"object"}]},"url":{"default":"http://localhost:8080","description":"Will search for a tab with this exact url and attach to it, if found","type":"string"},"urlFilter":{"default":"","description":"Will search for a page with this url and attach to it, if found. Can have * wildcards.","type":"string"},"userDataDir":{"default":true,"description":"By default, the browser is launched with a separate user profile in a temp folder. Use this option to override it. Set to false to launch with your default user profile. A new browser can't be launched if an instance is already running from `userDataDir`.","type":["string","boolean"]},"vueComponentPaths":{"default":["${workspaceFolder}/**/*.vue"],"description":"A list of file glob patterns to find `*.vue` components. By default, searches the entire workspace. This needs to be specified due to extra lookups that Vue's sourcemaps require in Vue CLI 4. You can disable this special handling by setting this to an empty array.","type":"array"},"webRoot":{"default":"${workspaceFolder}","description":"This specifies the workspace absolute path to the webserver root. Used to resolve paths like `/app.js` to files on disk. Shorthand for a pathMapping for \"/\"","type":"string"}}}},"configurationSnippets":[],"deprecated":"Please use type chrome instead","label":"Web App (Chrome)","languages":["javascript","typescript","javascriptreact","typescriptreact","html","css","coffeescript","handlebars","vue"],"strings":{"unverifiedBreakpoints":"Some of your breakpoints could not be set. If you're having an issue, you can [troubleshoot your launch configuration](command:extension.js-debug.createDiagnostics)."},"type":"pwa-chrome"},{"aiKey":"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255","configurationAttributes":{"attach":{"properties":{"address":{"default":"localhost","description":"IP address or hostname the debugged browser is listening on.","type":"string"},"browserAttachLocation":{"default":null,"description":"Forces the browser to attach in one location. In a remote workspace (through ssh or WSL, for example) this can be used to attach to a browser on the remote machine rather than locally.","oneOf":[{"type":"null"},{"enum":["ui","workspace"],"type":"string"}]},"cascadeTerminateToConfigurations":{"default":[],"description":"A list of debug sessions which, when this debug session is terminated, will also be stopped.","items":{"type":"string","uniqueItems":true},"type":"array"},"customDescriptionGenerator":{"description":"Customize the textual description the debugger shows for objects (local variables, etc...). Samples:\n 1. this.toString() // will call toString to print all objects\n 2. this.customDescription ? this.customDescription() : defaultValue // Use customDescription method if available, if not return defaultValue\n 3. function (def) { return this.customDescription ? this.customDescription() : def } // Use customDescription method if available, if not return defaultValue\n ","type":"string"},"customPropertiesGenerator":{"deprecated":true,"description":"Customize the properties shown for an object in the debugger (local variables, etc...). Samples:\n 1. { ...this, extraProperty: '12345' } // Add an extraProperty 12345 to all objects\n 2. this.customProperties ? this.customProperties() : this // Use customProperties method if available, if not use the properties in this (the default properties)\n 3. function () { return this.customProperties ? this.customProperties() : this } // Use customDescription method if available, if not return the default properties\n\n Deprecated: This is a temporary implementation of this feature until we have time to implement it in the way described here: https://github.com/microsoft/vscode/issues/102181","type":"string"},"disableNetworkCache":{"default":true,"description":"Controls whether to skip the network cache for each request","type":"boolean"},"enableContentValidation":{"default":true,"description":"Toggles whether we verify the contents of files on disk match the ones loaded in the runtime. This is useful in a variety of scenarios and required in some, but can cause issues if you have server-side transformation of scripts, for example.","type":"boolean"},"inspectUri":{"default":null,"description":"Format to use to rewrite the inspectUri: It's a template string that interpolates keys in `{curlyBraces}`. Available keys are:\n - `url.*` is the parsed address of the running application. For instance, `{url.port}`, `{url.hostname}`\n - `port` is the debug port that Chrome is listening on.\n - `browserInspectUri` is the inspector URI on the launched browser\n - `browserInspectUriPath` is the path part of the inspector URI on the launched browser (e.g.: \"/devtools/browser/e9ec0098-306e-472a-8133-5e42488929c2\").\n - `wsProtocol` is the hinted websocket protocol. This is set to `wss` if the original URL is `https`, or `ws` otherwise.\n","type":["string","null"]},"outFiles":{"default":["${workspaceFolder}/**/*.js","!**/node_modules/**"],"description":"If source maps are enabled, these glob patterns specify the generated JavaScript files. If a pattern starts with `!` the files are excluded. If not specified, the generated code is expected in the same directory as its source.","items":{"type":"string"},"type":["array"]},"outputCapture":{"default":"console","enum":["console","std"],"markdownDescription":"From where to capture output messages: the default debug API if set to `console`, or stdout/stderr streams if set to `std`."},"pathMapping":{"default":{},"description":"A mapping of URLs/paths to local folders, to resolve scripts in the Browser to scripts on disk","type":"object"},"pauseForSourceMap":{"default":false,"markdownDescription":"Whether to wait for source maps to load for each incoming script. This has a performance overhead, and might be safely disabled when running off of disk, so long as `rootPath` is not disabled.","type":"boolean"},"perScriptSourcemaps":{"default":"auto","description":"Whether scripts are loaded individually with unique sourcemaps containing the basename of the source file. This can be set to optimize sourcemap handling when dealing with lots of small scripts. If set to \"auto\", we'll detect known cases where this is appropriate.","enum":["yes","no","auto"],"type":"string"},"port":{"default":9229,"description":"Port to use to remote debugging the browser, given as `--remote-debugging-port` when launching the browser.","type":"number"},"resolveSourceMapLocations":{"default":null,"description":"A list of minimatch patterns for locations (folders and URLs) in which source maps can be used to resolve local files. This can be used to avoid incorrectly breaking in external source mapped code. Patterns can be prefixed with \"!\" to exclude them. May be set to an empty array or null to avoid restriction.","items":{"type":"string"},"type":["array","null"]},"restart":{"default":false,"markdownDescription":"Whether to reconnect if the browser connection is closed","type":"boolean"},"server":{"oneOf":[{"additionalProperties":false,"default":{"program":"node my-server.js"},"description":"Configures a web server to start up. Takes the same configuration as the 'node' launch task.","properties":{"args":{"default":[],"description":"Command line arguments passed to the program.\n\nCan be an array of strings or a single string. When the program is launched in a terminal, setting this property to a single string will result in the arguments not being escaped for the shell.","items":{"type":"string"},"type":["array","string"]},"attachSimplePort":{"default":9229,"description":"If set, attaches to the process via the given port. This is generally no longer necessary for Node.js programs and loses the ability to debug child processes, but can be useful in more esoteric scenarios such as with Deno and Docker launches. If set to 0, a random port will be chosen and --inspect-brk added to the launch arguments automatically.","type":"integer"},"autoAttachChildProcesses":{"default":true,"description":"Attach debugger to new child processes automatically.","type":"boolean"},"cascadeTerminateToConfigurations":{"default":[],"description":"A list of debug sessions which, when this debug session is terminated, will also be stopped.","items":{"type":"string","uniqueItems":true},"type":"array"},"console":{"default":"internalConsole","description":"Where to launch the debug target.","enum":["internalConsole","integratedTerminal","externalTerminal"],"enumDescriptions":["VS Code Debug Console (which doesn't support to read input from a program)","VS Code's integrated terminal","External terminal that can be configured via user settings"],"type":"string"},"customDescriptionGenerator":{"description":"Customize the textual description the debugger shows for objects (local variables, etc...). Samples:\n 1. this.toString() // will call toString to print all objects\n 2. this.customDescription ? this.customDescription() : defaultValue // Use customDescription method if available, if not return defaultValue\n 3. function (def) { return this.customDescription ? this.customDescription() : def } // Use customDescription method if available, if not return defaultValue\n ","type":"string"},"customPropertiesGenerator":{"deprecated":true,"description":"Customize the properties shown for an object in the debugger (local variables, etc...). Samples:\n 1. { ...this, extraProperty: '12345' } // Add an extraProperty 12345 to all objects\n 2. this.customProperties ? this.customProperties() : this // Use customProperties method if available, if not use the properties in this (the default properties)\n 3. function () { return this.customProperties ? this.customProperties() : this } // Use customDescription method if available, if not return the default properties\n\n Deprecated: This is a temporary implementation of this feature until we have time to implement it in the way described here: https://github.com/microsoft/vscode/issues/102181","type":"string"},"cwd":{"default":"${workspaceFolder}","description":"Absolute path to the working directory of the program being debugged. If you've set localRoot then cwd will match that value otherwise it falls back to your workspaceFolder","type":"string"},"enableContentValidation":{"default":true,"description":"Toggles whether we verify the contents of files on disk match the ones loaded in the runtime. This is useful in a variety of scenarios and required in some, but can cause issues if you have server-side transformation of scripts, for example.","type":"boolean"},"env":{"additionalProperties":{"type":["string","null"]},"default":{},"markdownDescription":"Environment variables passed to the program. The value `null` removes the variable from the environment.","type":"object"},"envFile":{"default":"${workspaceFolder}/.env","description":"Absolute path to a file containing environment variable definitions.","type":"string"},"killBehavior":{"default":"forceful","enum":["forceful","polite","none"],"markdownDescription":"Configures how debug processes are killed when stopping the session. Can be:\n\n- forceful (default): forcefully tears down the process tree. Sends SIGKILL on posix, or `taskkill.exe /F` on Windows.\n- polite: gracefully tears down the process tree. It's possible that misbehaving processes continue to run after shutdown in this way. Sends SIGTERM on posix, or `taskkill.exe` with no `/F` (force) flag on Windows.\n- none: no termination will happen.","type":"string"},"localRoot":{"default":null,"description":"Path to the local directory containing the program.","type":["string","null"]},"nodeVersionHint":{"default":12,"description":"Allows you to explicitly specify the Node version that's running, which can be used to disable or enable certain behaviors in cases where the automatic version detection does not work.","minimum":8,"type":"number"},"outFiles":{"default":["${workspaceFolder}/**/*.js","!**/node_modules/**"],"description":"If source maps are enabled, these glob patterns specify the generated JavaScript files. If a pattern starts with `!` the files are excluded. If not specified, the generated code is expected in the same directory as its source.","items":{"type":"string"},"type":["array"]},"outputCapture":{"default":"console","enum":["console","std"],"markdownDescription":"From where to capture output messages: the default debug API if set to `console`, or stdout/stderr streams if set to `std`."},"pauseForSourceMap":{"default":false,"markdownDescription":"Whether to wait for source maps to load for each incoming script. This has a performance overhead, and might be safely disabled when running off of disk, so long as `rootPath` is not disabled.","type":"boolean"},"profileStartup":{"default":true,"description":"If true, will start profiling as soon as the process launches","type":"boolean"},"program":{"default":"","description":"Absolute path to the program. Generated value is guessed by looking at package.json and opened files. Edit this attribute.","type":"string"},"remoteRoot":{"default":null,"description":"Absolute path to the remote directory containing the program.","type":["string","null"]},"resolveSourceMapLocations":{"default":["${workspaceFolder}/**","!**/node_modules/**"],"description":"A list of minimatch patterns for locations (folders and URLs) in which source maps can be used to resolve local files. This can be used to avoid incorrectly breaking in external source mapped code. Patterns can be prefixed with \"!\" to exclude them. May be set to an empty array or null to avoid restriction.","items":{"type":"string"},"type":["array","null"]},"restart":{"default":true,"description":"Try to reconnect to the program if we lose connection. If set to `true`, we'll try once a second, forever. You can customize the interval and maximum number of attempts by specifying the `delay` and `maxAttempts` in an object instead.","oneOf":[{"type":"boolean"},{"properties":{"delay":{"default":1000,"minimum":0,"type":"number"},"maxAttempts":{"default":10,"minimum":0,"type":"number"}},"type":"object"}]},"runtimeArgs":{"default":[],"description":"Optional arguments passed to the runtime executable.","items":{"type":"string"},"type":"array"},"runtimeExecutable":{"default":"node","markdownDescription":"Runtime to use. Either an absolute path or the name of a runtime available on the PATH. If omitted `node` is assumed.","type":["string","null"]},"runtimeSourcemapPausePatterns":{"default":[],"items":{"type":"string"},"markdownDescription":"A list of patterns at which to manually insert entrypoint breakpoints. This can be useful to give the debugger an opportunity to set breakpoints when using sourcemaps that don't exist or can't be detected before launch, such as [with the Serverless framework](https://github.com/microsoft/vscode-js-debug/issues/492).","type":"array"},"runtimeVersion":{"default":"default","markdownDescription":"Version of `node` runtime to use. Requires `nvm`.","type":"string"},"showAsyncStacks":{"default":true,"description":"Show the async calls that led to the current call stack.","oneOf":[{"type":"boolean"},{"properties":{"onAttach":{"default":32,"type":"number"}},"required":["onAttach"],"type":"object"},{"properties":{"onceBreakpointResolved":{"default":32,"type":"number"}},"required":["onceBreakpointResolved"],"type":"object"}]},"skipFiles":{"default":["/**"],"description":"An array of file or folder names, or path globs, to skip when debugging. Star patterns and negations are allowed, for example, `[\"**/node_modules/**\", \"!**/node_modules/my-module/**\"]`","type":"array"},"smartStep":{"default":true,"description":"Automatically step through generated code that cannot be mapped back to the original source.","type":"boolean"},"sourceMapPathOverrides":{"default":{"meteor://💻app/*":"${workspaceFolder}/*","webpack:///./~/*":"${workspaceFolder}/node_modules/*","webpack://?:*/*":"${workspaceFolder}/*"},"description":"A set of mappings for rewriting the locations of source files from what the sourcemap says, to their locations on disk.","type":"object"},"sourceMapRenames":{"default":true,"description":"Whether to use the \"names\" mapping in sourcemaps. This requires requesting source content, which can be slow with certain debuggers.","type":"boolean"},"sourceMaps":{"default":true,"description":"Use JavaScript source maps (if they exist).","type":"boolean"},"stopOnEntry":{"default":true,"description":"Automatically stop program after launch.","type":["boolean","string"]},"timeout":{"default":10000,"description":"Retry for this number of milliseconds to connect to Node.js. Default is 10000 ms.","type":"number"},"timeouts":{"additionalProperties":false,"default":{},"description":"Timeouts for several debugger operations.","markdownDescription":"Timeouts for several debugger operations.","properties":{"hoverEvaluation":{"default":500,"description":"Time until value evaluation for hovered symbols is aborted. If set to 0, hover evaluation does never time out.","type":"number"},"sourceMapCumulativePause":{"default":1000,"description":"Extra time in milliseconds allowed per session to be spent waiting for source-maps to be processed, after the minimum time (sourceMapMinPause) has been exhausted","type":"number"},"sourceMapMinPause":{"default":1000,"description":"Minimum time in milliseconds spent waiting for each source-map to be processed when a script is being parsed","type":"number"}},"type":"object"},"trace":{"default":true,"description":"Configures what diagnostic output is produced.","oneOf":[{"description":"Trace may be set to 'true' to write diagnostic logs to the disk.","type":"boolean"},{"additionalProperties":false,"properties":{"logFile":{"description":"Configures where on disk logs are written.","type":["string","null"]},"stdio":{"description":"Whether to return trace data from the launched application or browser.","type":"boolean"}},"type":"object"}]}},"type":"object"},{"additionalProperties":false,"default":{"program":"npm start"},"description":"JavaScript Debug Terminal","properties":{"autoAttachChildProcesses":{"default":true,"description":"Attach debugger to new child processes automatically.","type":"boolean"},"cascadeTerminateToConfigurations":{"default":[],"description":"A list of debug sessions which, when this debug session is terminated, will also be stopped.","items":{"type":"string","uniqueItems":true},"type":"array"},"command":{"default":"npm start","description":"Command to run in the launched terminal. If not provided, the terminal will open without launching a program.","type":["string","null"]},"customDescriptionGenerator":{"description":"Customize the textual description the debugger shows for objects (local variables, etc...). Samples:\n 1. this.toString() // will call toString to print all objects\n 2. this.customDescription ? this.customDescription() : defaultValue // Use customDescription method if available, if not return defaultValue\n 3. function (def) { return this.customDescription ? this.customDescription() : def } // Use customDescription method if available, if not return defaultValue\n ","type":"string"},"customPropertiesGenerator":{"deprecated":true,"description":"Customize the properties shown for an object in the debugger (local variables, etc...). Samples:\n 1. { ...this, extraProperty: '12345' } // Add an extraProperty 12345 to all objects\n 2. this.customProperties ? this.customProperties() : this // Use customProperties method if available, if not use the properties in this (the default properties)\n 3. function () { return this.customProperties ? this.customProperties() : this } // Use customDescription method if available, if not return the default properties\n\n Deprecated: This is a temporary implementation of this feature until we have time to implement it in the way described here: https://github.com/microsoft/vscode/issues/102181","type":"string"},"cwd":{"default":"${workspaceFolder}","description":"Absolute path to the working directory of the program being debugged. If you've set localRoot then cwd will match that value otherwise it falls back to your workspaceFolder","docDefault":"localRoot || ${workspaceFolder}","type":"string"},"enableContentValidation":{"default":true,"description":"Toggles whether we verify the contents of files on disk match the ones loaded in the runtime. This is useful in a variety of scenarios and required in some, but can cause issues if you have server-side transformation of scripts, for example.","type":"boolean"},"env":{"additionalProperties":{"type":["string","null"]},"default":{},"markdownDescription":"Environment variables passed to the program. The value `null` removes the variable from the environment.","type":"object"},"envFile":{"default":"${workspaceFolder}/.env","description":"Absolute path to a file containing environment variable definitions.","type":"string"},"localRoot":{"default":null,"description":"Path to the local directory containing the program.","type":["string","null"]},"nodeVersionHint":{"default":12,"description":"Allows you to explicitly specify the Node version that's running, which can be used to disable or enable certain behaviors in cases where the automatic version detection does not work.","minimum":8,"type":"number"},"outFiles":{"default":["${workspaceFolder}/**/*.js","!**/node_modules/**"],"description":"If source maps are enabled, these glob patterns specify the generated JavaScript files. If a pattern starts with `!` the files are excluded. If not specified, the generated code is expected in the same directory as its source.","items":{"type":"string"},"type":["array"]},"outputCapture":{"default":"console","enum":["console","std"],"markdownDescription":"From where to capture output messages: the default debug API if set to `console`, or stdout/stderr streams if set to `std`."},"pauseForSourceMap":{"default":false,"markdownDescription":"Whether to wait for source maps to load for each incoming script. This has a performance overhead, and might be safely disabled when running off of disk, so long as `rootPath` is not disabled.","type":"boolean"},"remoteRoot":{"default":null,"description":"Absolute path to the remote directory containing the program.","type":["string","null"]},"resolveSourceMapLocations":{"default":["${workspaceFolder}/**","!**/node_modules/**"],"description":"A list of minimatch patterns for locations (folders and URLs) in which source maps can be used to resolve local files. This can be used to avoid incorrectly breaking in external source mapped code. Patterns can be prefixed with \"!\" to exclude them. May be set to an empty array or null to avoid restriction.","items":{"type":"string"},"type":["array","null"]},"runtimeSourcemapPausePatterns":{"default":[],"items":{"type":"string"},"markdownDescription":"A list of patterns at which to manually insert entrypoint breakpoints. This can be useful to give the debugger an opportunity to set breakpoints when using sourcemaps that don't exist or can't be detected before launch, such as [with the Serverless framework](https://github.com/microsoft/vscode-js-debug/issues/492).","type":"array"},"showAsyncStacks":{"default":true,"description":"Show the async calls that led to the current call stack.","oneOf":[{"type":"boolean"},{"properties":{"onAttach":{"default":32,"type":"number"}},"required":["onAttach"],"type":"object"},{"properties":{"onceBreakpointResolved":{"default":32,"type":"number"}},"required":["onceBreakpointResolved"],"type":"object"}]},"skipFiles":{"default":["/**"],"description":"An array of file or folder names, or path globs, to skip when debugging. Star patterns and negations are allowed, for example, `[\"**/node_modules/**\", \"!**/node_modules/my-module/**\"]`","type":"array"},"smartStep":{"default":true,"description":"Automatically step through generated code that cannot be mapped back to the original source.","type":"boolean"},"sourceMapPathOverrides":{"default":{"meteor://💻app/*":"${workspaceFolder}/*","webpack:///./~/*":"${workspaceFolder}/node_modules/*","webpack://?:*/*":"${workspaceFolder}/*"},"description":"A set of mappings for rewriting the locations of source files from what the sourcemap says, to their locations on disk.","type":"object"},"sourceMapRenames":{"default":true,"description":"Whether to use the \"names\" mapping in sourcemaps. This requires requesting source content, which can be slow with certain debuggers.","type":"boolean"},"sourceMaps":{"default":true,"description":"Use JavaScript source maps (if they exist).","type":"boolean"},"timeout":{"default":10000,"description":"Retry for this number of milliseconds to connect to Node.js. Default is 10000 ms.","type":"number"},"timeouts":{"additionalProperties":false,"default":{},"description":"Timeouts for several debugger operations.","markdownDescription":"Timeouts for several debugger operations.","properties":{"hoverEvaluation":{"default":500,"description":"Time until value evaluation for hovered symbols is aborted. If set to 0, hover evaluation does never time out.","type":"number"},"sourceMapCumulativePause":{"default":1000,"description":"Extra time in milliseconds allowed per session to be spent waiting for source-maps to be processed, after the minimum time (sourceMapMinPause) has been exhausted","type":"number"},"sourceMapMinPause":{"default":1000,"description":"Minimum time in milliseconds spent waiting for each source-map to be processed when a script is being parsed","type":"number"}},"type":"object"},"trace":{"default":true,"description":"Configures what diagnostic output is produced.","oneOf":[{"description":"Trace may be set to 'true' to write diagnostic logs to the disk.","type":"boolean"},{"additionalProperties":false,"properties":{"logFile":{"description":"Configures where on disk logs are written.","type":["string","null"]},"stdio":{"description":"Whether to return trace data from the launched application or browser.","type":"boolean"}},"type":"object"}]}},"type":"object"}]},"showAsyncStacks":{"default":true,"description":"Show the async calls that led to the current call stack.","oneOf":[{"type":"boolean"},{"properties":{"onAttach":{"default":32,"type":"number"}},"required":["onAttach"],"type":"object"},{"properties":{"onceBreakpointResolved":{"default":32,"type":"number"}},"required":["onceBreakpointResolved"],"type":"object"}]},"skipFiles":{"default":["/**"],"description":"An array of file or folder names, or path globs, to skip when debugging. Star patterns and negations are allowed, for example, `[\"**/node_modules/**\", \"!**/node_modules/my-module/**\"]`","type":"array"},"smartStep":{"default":true,"description":"Automatically step through generated code that cannot be mapped back to the original source.","type":"boolean"},"sourceMapPathOverrides":{"default":{"meteor://💻app/*":"${workspaceFolder}/*","webpack:///./~/*":"${workspaceFolder}/node_modules/*","webpack://?:*/*":"${workspaceFolder}/*"},"description":"A set of mappings for rewriting the locations of source files from what the sourcemap says, to their locations on disk.","type":"object"},"sourceMapRenames":{"default":true,"description":"Whether to use the \"names\" mapping in sourcemaps. This requires requesting source content, which can be slow with certain debuggers.","type":"boolean"},"sourceMaps":{"default":true,"description":"Use JavaScript source maps (if they exist).","type":"boolean"},"targetSelection":{"default":"automatic","enum":["pick","automatic"],"markdownDescription":"Whether to attach to all targets that match the URL filter (\"automatic\") or ask to pick one (\"pick\").","type":"string"},"timeout":{"default":10000,"description":"Retry for this number of milliseconds to connect to Node.js. Default is 10000 ms.","type":"number"},"timeouts":{"additionalProperties":false,"default":{},"description":"Timeouts for several debugger operations.","markdownDescription":"Timeouts for several debugger operations.","properties":{"hoverEvaluation":{"default":500,"description":"Time until value evaluation for hovered symbols is aborted. If set to 0, hover evaluation does never time out.","type":"number"},"sourceMapCumulativePause":{"default":1000,"description":"Extra time in milliseconds allowed per session to be spent waiting for source-maps to be processed, after the minimum time (sourceMapMinPause) has been exhausted","type":"number"},"sourceMapMinPause":{"default":1000,"description":"Minimum time in milliseconds spent waiting for each source-map to be processed when a script is being parsed","type":"number"}},"type":"object"},"trace":{"default":true,"description":"Configures what diagnostic output is produced.","oneOf":[{"description":"Trace may be set to 'true' to write diagnostic logs to the disk.","type":"boolean"},{"additionalProperties":false,"properties":{"logFile":{"description":"Configures where on disk logs are written.","type":["string","null"]},"stdio":{"description":"Whether to return trace data from the launched application or browser.","type":"boolean"}},"type":"object"}]},"url":{"default":"http://localhost:8080","description":"Will search for a tab with this exact url and attach to it, if found","type":"string"},"urlFilter":{"default":"","description":"Will search for a page with this url and attach to it, if found. Can have * wildcards.","type":"string"},"vueComponentPaths":{"default":["${workspaceFolder}/**/*.vue"],"description":"A list of file glob patterns to find `*.vue` components. By default, searches the entire workspace. This needs to be specified due to extra lookups that Vue's sourcemaps require in Vue CLI 4. You can disable this special handling by setting this to an empty array.","type":"array"},"webRoot":{"default":"${workspaceFolder}","description":"This specifies the workspace absolute path to the webserver root. Used to resolve paths like `/app.js` to files on disk. Shorthand for a pathMapping for \"/\"","type":"string"}}},"launch":{"properties":{"browserLaunchLocation":{"default":null,"description":"Forces the browser to be launched in one location. In a remote workspace (through ssh or WSL, for example) this can be used to open the browser on the remote machine rather than locally.","oneOf":[{"type":"null"},{"enum":["ui","workspace"],"type":"string"}]},"cascadeTerminateToConfigurations":{"default":[],"description":"A list of debug sessions which, when this debug session is terminated, will also be stopped.","items":{"type":"string","uniqueItems":true},"type":"array"},"cleanUp":{"default":"wholeBrowser","description":"What clean-up to do after the debugging session finishes. Close only the tab being debug, vs. close the whole browser.","enum":["wholeBrowser","onlyTab"],"type":"string"},"customDescriptionGenerator":{"description":"Customize the textual description the debugger shows for objects (local variables, etc...). Samples:\n 1. this.toString() // will call toString to print all objects\n 2. this.customDescription ? this.customDescription() : defaultValue // Use customDescription method if available, if not return defaultValue\n 3. function (def) { return this.customDescription ? this.customDescription() : def } // Use customDescription method if available, if not return defaultValue\n ","type":"string"},"customPropertiesGenerator":{"deprecated":true,"description":"Customize the properties shown for an object in the debugger (local variables, etc...). Samples:\n 1. { ...this, extraProperty: '12345' } // Add an extraProperty 12345 to all objects\n 2. this.customProperties ? this.customProperties() : this // Use customProperties method if available, if not use the properties in this (the default properties)\n 3. function () { return this.customProperties ? this.customProperties() : this } // Use customDescription method if available, if not return the default properties\n\n Deprecated: This is a temporary implementation of this feature until we have time to implement it in the way described here: https://github.com/microsoft/vscode/issues/102181","type":"string"},"cwd":{"default":null,"description":"Optional working directory for the runtime executable.","type":"string"},"disableNetworkCache":{"default":true,"description":"Controls whether to skip the network cache for each request","type":"boolean"},"enableContentValidation":{"default":true,"description":"Toggles whether we verify the contents of files on disk match the ones loaded in the runtime. This is useful in a variety of scenarios and required in some, but can cause issues if you have server-side transformation of scripts, for example.","type":"boolean"},"env":{"default":{},"description":"Optional dictionary of environment key/value pairs for the browser.","type":"object"},"file":{"default":"${workspaceFolder}/index.html","description":"A local html file to open in the browser","type":"string"},"includeDefaultArgs":{"default":true,"description":"Whether default browser launch arguments (to disable features that may make debugging harder) will be included in the launch.","type":"boolean"},"includeLaunchArgs":{"default":true,"description":"Advanced: whether any default launch/debugging arguments are set on the browser. The debugger will assume the browser will use pipe debugging such as that which is provided with `--remote-debugging-pipe`.","type":"boolean"},"inspectUri":{"default":null,"description":"Format to use to rewrite the inspectUri: It's a template string that interpolates keys in `{curlyBraces}`. Available keys are:\n - `url.*` is the parsed address of the running application. For instance, `{url.port}`, `{url.hostname}`\n - `port` is the debug port that Chrome is listening on.\n - `browserInspectUri` is the inspector URI on the launched browser\n - `browserInspectUriPath` is the path part of the inspector URI on the launched browser (e.g.: \"/devtools/browser/e9ec0098-306e-472a-8133-5e42488929c2\").\n - `wsProtocol` is the hinted websocket protocol. This is set to `wss` if the original URL is `https`, or `ws` otherwise.\n","type":["string","null"]},"outFiles":{"default":["${workspaceFolder}/**/*.js","!**/node_modules/**"],"description":"If source maps are enabled, these glob patterns specify the generated JavaScript files. If a pattern starts with `!` the files are excluded. If not specified, the generated code is expected in the same directory as its source.","items":{"type":"string"},"type":["array"]},"outputCapture":{"default":"console","enum":["console","std"],"markdownDescription":"From where to capture output messages: the default debug API if set to `console`, or stdout/stderr streams if set to `std`."},"pathMapping":{"default":{},"description":"A mapping of URLs/paths to local folders, to resolve scripts in the Browser to scripts on disk","type":"object"},"pauseForSourceMap":{"default":false,"markdownDescription":"Whether to wait for source maps to load for each incoming script. This has a performance overhead, and might be safely disabled when running off of disk, so long as `rootPath` is not disabled.","type":"boolean"},"perScriptSourcemaps":{"default":"auto","description":"Whether scripts are loaded individually with unique sourcemaps containing the basename of the source file. This can be set to optimize sourcemap handling when dealing with lots of small scripts. If set to \"auto\", we'll detect known cases where this is appropriate.","enum":["yes","no","auto"],"type":"string"},"port":{"default":0,"description":"Port for the browser to listen on. Defaults to \"0\", which will cause the browser to be debugged via pipes, which is generally more secure and should be chosen unless you need to attach to the browser from another tool.","type":"number"},"profileStartup":{"default":true,"description":"If true, will start profiling soon as the process launches","type":"boolean"},"resolveSourceMapLocations":{"default":null,"description":"A list of minimatch patterns for locations (folders and URLs) in which source maps can be used to resolve local files. This can be used to avoid incorrectly breaking in external source mapped code. Patterns can be prefixed with \"!\" to exclude them. May be set to an empty array or null to avoid restriction.","items":{"type":"string"},"type":["array","null"]},"runtimeArgs":{"default":[],"description":"Optional arguments passed to the runtime executable.","items":{"type":"string"},"type":"array"},"runtimeExecutable":{"default":"stable","description":"Either 'canary', 'stable', 'custom' or path to the browser executable. Custom means a custom wrapper, custom build or CHROME_PATH environment variable.","type":["string","null"]},"server":{"oneOf":[{"additionalProperties":false,"default":{"program":"node my-server.js"},"description":"Configures a web server to start up. Takes the same configuration as the 'node' launch task.","properties":{"args":{"default":[],"description":"Command line arguments passed to the program.\n\nCan be an array of strings or a single string. When the program is launched in a terminal, setting this property to a single string will result in the arguments not being escaped for the shell.","items":{"type":"string"},"type":["array","string"]},"attachSimplePort":{"default":9229,"description":"If set, attaches to the process via the given port. This is generally no longer necessary for Node.js programs and loses the ability to debug child processes, but can be useful in more esoteric scenarios such as with Deno and Docker launches. If set to 0, a random port will be chosen and --inspect-brk added to the launch arguments automatically.","type":"integer"},"autoAttachChildProcesses":{"default":true,"description":"Attach debugger to new child processes automatically.","type":"boolean"},"cascadeTerminateToConfigurations":{"default":[],"description":"A list of debug sessions which, when this debug session is terminated, will also be stopped.","items":{"type":"string","uniqueItems":true},"type":"array"},"console":{"default":"internalConsole","description":"Where to launch the debug target.","enum":["internalConsole","integratedTerminal","externalTerminal"],"enumDescriptions":["VS Code Debug Console (which doesn't support to read input from a program)","VS Code's integrated terminal","External terminal that can be configured via user settings"],"type":"string"},"customDescriptionGenerator":{"description":"Customize the textual description the debugger shows for objects (local variables, etc...). Samples:\n 1. this.toString() // will call toString to print all objects\n 2. this.customDescription ? this.customDescription() : defaultValue // Use customDescription method if available, if not return defaultValue\n 3. function (def) { return this.customDescription ? this.customDescription() : def } // Use customDescription method if available, if not return defaultValue\n ","type":"string"},"customPropertiesGenerator":{"deprecated":true,"description":"Customize the properties shown for an object in the debugger (local variables, etc...). Samples:\n 1. { ...this, extraProperty: '12345' } // Add an extraProperty 12345 to all objects\n 2. this.customProperties ? this.customProperties() : this // Use customProperties method if available, if not use the properties in this (the default properties)\n 3. function () { return this.customProperties ? this.customProperties() : this } // Use customDescription method if available, if not return the default properties\n\n Deprecated: This is a temporary implementation of this feature until we have time to implement it in the way described here: https://github.com/microsoft/vscode/issues/102181","type":"string"},"cwd":{"default":"${workspaceFolder}","description":"Absolute path to the working directory of the program being debugged. If you've set localRoot then cwd will match that value otherwise it falls back to your workspaceFolder","type":"string"},"enableContentValidation":{"default":true,"description":"Toggles whether we verify the contents of files on disk match the ones loaded in the runtime. This is useful in a variety of scenarios and required in some, but can cause issues if you have server-side transformation of scripts, for example.","type":"boolean"},"env":{"additionalProperties":{"type":["string","null"]},"default":{},"markdownDescription":"Environment variables passed to the program. The value `null` removes the variable from the environment.","type":"object"},"envFile":{"default":"${workspaceFolder}/.env","description":"Absolute path to a file containing environment variable definitions.","type":"string"},"killBehavior":{"default":"forceful","enum":["forceful","polite","none"],"markdownDescription":"Configures how debug processes are killed when stopping the session. Can be:\n\n- forceful (default): forcefully tears down the process tree. Sends SIGKILL on posix, or `taskkill.exe /F` on Windows.\n- polite: gracefully tears down the process tree. It's possible that misbehaving processes continue to run after shutdown in this way. Sends SIGTERM on posix, or `taskkill.exe` with no `/F` (force) flag on Windows.\n- none: no termination will happen.","type":"string"},"localRoot":{"default":null,"description":"Path to the local directory containing the program.","type":["string","null"]},"nodeVersionHint":{"default":12,"description":"Allows you to explicitly specify the Node version that's running, which can be used to disable or enable certain behaviors in cases where the automatic version detection does not work.","minimum":8,"type":"number"},"outFiles":{"default":["${workspaceFolder}/**/*.js","!**/node_modules/**"],"description":"If source maps are enabled, these glob patterns specify the generated JavaScript files. If a pattern starts with `!` the files are excluded. If not specified, the generated code is expected in the same directory as its source.","items":{"type":"string"},"type":["array"]},"outputCapture":{"default":"console","enum":["console","std"],"markdownDescription":"From where to capture output messages: the default debug API if set to `console`, or stdout/stderr streams if set to `std`."},"pauseForSourceMap":{"default":false,"markdownDescription":"Whether to wait for source maps to load for each incoming script. This has a performance overhead, and might be safely disabled when running off of disk, so long as `rootPath` is not disabled.","type":"boolean"},"profileStartup":{"default":true,"description":"If true, will start profiling as soon as the process launches","type":"boolean"},"program":{"default":"","description":"Absolute path to the program. Generated value is guessed by looking at package.json and opened files. Edit this attribute.","type":"string"},"remoteRoot":{"default":null,"description":"Absolute path to the remote directory containing the program.","type":["string","null"]},"resolveSourceMapLocations":{"default":["${workspaceFolder}/**","!**/node_modules/**"],"description":"A list of minimatch patterns for locations (folders and URLs) in which source maps can be used to resolve local files. This can be used to avoid incorrectly breaking in external source mapped code. Patterns can be prefixed with \"!\" to exclude them. May be set to an empty array or null to avoid restriction.","items":{"type":"string"},"type":["array","null"]},"restart":{"default":true,"description":"Try to reconnect to the program if we lose connection. If set to `true`, we'll try once a second, forever. You can customize the interval and maximum number of attempts by specifying the `delay` and `maxAttempts` in an object instead.","oneOf":[{"type":"boolean"},{"properties":{"delay":{"default":1000,"minimum":0,"type":"number"},"maxAttempts":{"default":10,"minimum":0,"type":"number"}},"type":"object"}]},"runtimeArgs":{"default":[],"description":"Optional arguments passed to the runtime executable.","items":{"type":"string"},"type":"array"},"runtimeExecutable":{"default":"node","markdownDescription":"Runtime to use. Either an absolute path or the name of a runtime available on the PATH. If omitted `node` is assumed.","type":["string","null"]},"runtimeSourcemapPausePatterns":{"default":[],"items":{"type":"string"},"markdownDescription":"A list of patterns at which to manually insert entrypoint breakpoints. This can be useful to give the debugger an opportunity to set breakpoints when using sourcemaps that don't exist or can't be detected before launch, such as [with the Serverless framework](https://github.com/microsoft/vscode-js-debug/issues/492).","type":"array"},"runtimeVersion":{"default":"default","markdownDescription":"Version of `node` runtime to use. Requires `nvm`.","type":"string"},"showAsyncStacks":{"default":true,"description":"Show the async calls that led to the current call stack.","oneOf":[{"type":"boolean"},{"properties":{"onAttach":{"default":32,"type":"number"}},"required":["onAttach"],"type":"object"},{"properties":{"onceBreakpointResolved":{"default":32,"type":"number"}},"required":["onceBreakpointResolved"],"type":"object"}]},"skipFiles":{"default":["/**"],"description":"An array of file or folder names, or path globs, to skip when debugging. Star patterns and negations are allowed, for example, `[\"**/node_modules/**\", \"!**/node_modules/my-module/**\"]`","type":"array"},"smartStep":{"default":true,"description":"Automatically step through generated code that cannot be mapped back to the original source.","type":"boolean"},"sourceMapPathOverrides":{"default":{"meteor://💻app/*":"${workspaceFolder}/*","webpack:///./~/*":"${workspaceFolder}/node_modules/*","webpack://?:*/*":"${workspaceFolder}/*"},"description":"A set of mappings for rewriting the locations of source files from what the sourcemap says, to their locations on disk.","type":"object"},"sourceMapRenames":{"default":true,"description":"Whether to use the \"names\" mapping in sourcemaps. This requires requesting source content, which can be slow with certain debuggers.","type":"boolean"},"sourceMaps":{"default":true,"description":"Use JavaScript source maps (if they exist).","type":"boolean"},"stopOnEntry":{"default":true,"description":"Automatically stop program after launch.","type":["boolean","string"]},"timeout":{"default":10000,"description":"Retry for this number of milliseconds to connect to Node.js. Default is 10000 ms.","type":"number"},"timeouts":{"additionalProperties":false,"default":{},"description":"Timeouts for several debugger operations.","markdownDescription":"Timeouts for several debugger operations.","properties":{"hoverEvaluation":{"default":500,"description":"Time until value evaluation for hovered symbols is aborted. If set to 0, hover evaluation does never time out.","type":"number"},"sourceMapCumulativePause":{"default":1000,"description":"Extra time in milliseconds allowed per session to be spent waiting for source-maps to be processed, after the minimum time (sourceMapMinPause) has been exhausted","type":"number"},"sourceMapMinPause":{"default":1000,"description":"Minimum time in milliseconds spent waiting for each source-map to be processed when a script is being parsed","type":"number"}},"type":"object"},"trace":{"default":true,"description":"Configures what diagnostic output is produced.","oneOf":[{"description":"Trace may be set to 'true' to write diagnostic logs to the disk.","type":"boolean"},{"additionalProperties":false,"properties":{"logFile":{"description":"Configures where on disk logs are written.","type":["string","null"]},"stdio":{"description":"Whether to return trace data from the launched application or browser.","type":"boolean"}},"type":"object"}]}},"type":"object"},{"additionalProperties":false,"default":{"program":"npm start"},"description":"JavaScript Debug Terminal","properties":{"autoAttachChildProcesses":{"default":true,"description":"Attach debugger to new child processes automatically.","type":"boolean"},"cascadeTerminateToConfigurations":{"default":[],"description":"A list of debug sessions which, when this debug session is terminated, will also be stopped.","items":{"type":"string","uniqueItems":true},"type":"array"},"command":{"default":"npm start","description":"Command to run in the launched terminal. If not provided, the terminal will open without launching a program.","type":["string","null"]},"customDescriptionGenerator":{"description":"Customize the textual description the debugger shows for objects (local variables, etc...). Samples:\n 1. this.toString() // will call toString to print all objects\n 2. this.customDescription ? this.customDescription() : defaultValue // Use customDescription method if available, if not return defaultValue\n 3. function (def) { return this.customDescription ? this.customDescription() : def } // Use customDescription method if available, if not return defaultValue\n ","type":"string"},"customPropertiesGenerator":{"deprecated":true,"description":"Customize the properties shown for an object in the debugger (local variables, etc...). Samples:\n 1. { ...this, extraProperty: '12345' } // Add an extraProperty 12345 to all objects\n 2. this.customProperties ? this.customProperties() : this // Use customProperties method if available, if not use the properties in this (the default properties)\n 3. function () { return this.customProperties ? this.customProperties() : this } // Use customDescription method if available, if not return the default properties\n\n Deprecated: This is a temporary implementation of this feature until we have time to implement it in the way described here: https://github.com/microsoft/vscode/issues/102181","type":"string"},"cwd":{"default":"${workspaceFolder}","description":"Absolute path to the working directory of the program being debugged. If you've set localRoot then cwd will match that value otherwise it falls back to your workspaceFolder","docDefault":"localRoot || ${workspaceFolder}","type":"string"},"enableContentValidation":{"default":true,"description":"Toggles whether we verify the contents of files on disk match the ones loaded in the runtime. This is useful in a variety of scenarios and required in some, but can cause issues if you have server-side transformation of scripts, for example.","type":"boolean"},"env":{"additionalProperties":{"type":["string","null"]},"default":{},"markdownDescription":"Environment variables passed to the program. The value `null` removes the variable from the environment.","type":"object"},"envFile":{"default":"${workspaceFolder}/.env","description":"Absolute path to a file containing environment variable definitions.","type":"string"},"localRoot":{"default":null,"description":"Path to the local directory containing the program.","type":["string","null"]},"nodeVersionHint":{"default":12,"description":"Allows you to explicitly specify the Node version that's running, which can be used to disable or enable certain behaviors in cases where the automatic version detection does not work.","minimum":8,"type":"number"},"outFiles":{"default":["${workspaceFolder}/**/*.js","!**/node_modules/**"],"description":"If source maps are enabled, these glob patterns specify the generated JavaScript files. If a pattern starts with `!` the files are excluded. If not specified, the generated code is expected in the same directory as its source.","items":{"type":"string"},"type":["array"]},"outputCapture":{"default":"console","enum":["console","std"],"markdownDescription":"From where to capture output messages: the default debug API if set to `console`, or stdout/stderr streams if set to `std`."},"pauseForSourceMap":{"default":false,"markdownDescription":"Whether to wait for source maps to load for each incoming script. This has a performance overhead, and might be safely disabled when running off of disk, so long as `rootPath` is not disabled.","type":"boolean"},"remoteRoot":{"default":null,"description":"Absolute path to the remote directory containing the program.","type":["string","null"]},"resolveSourceMapLocations":{"default":["${workspaceFolder}/**","!**/node_modules/**"],"description":"A list of minimatch patterns for locations (folders and URLs) in which source maps can be used to resolve local files. This can be used to avoid incorrectly breaking in external source mapped code. Patterns can be prefixed with \"!\" to exclude them. May be set to an empty array or null to avoid restriction.","items":{"type":"string"},"type":["array","null"]},"runtimeSourcemapPausePatterns":{"default":[],"items":{"type":"string"},"markdownDescription":"A list of patterns at which to manually insert entrypoint breakpoints. This can be useful to give the debugger an opportunity to set breakpoints when using sourcemaps that don't exist or can't be detected before launch, such as [with the Serverless framework](https://github.com/microsoft/vscode-js-debug/issues/492).","type":"array"},"showAsyncStacks":{"default":true,"description":"Show the async calls that led to the current call stack.","oneOf":[{"type":"boolean"},{"properties":{"onAttach":{"default":32,"type":"number"}},"required":["onAttach"],"type":"object"},{"properties":{"onceBreakpointResolved":{"default":32,"type":"number"}},"required":["onceBreakpointResolved"],"type":"object"}]},"skipFiles":{"default":["/**"],"description":"An array of file or folder names, or path globs, to skip when debugging. Star patterns and negations are allowed, for example, `[\"**/node_modules/**\", \"!**/node_modules/my-module/**\"]`","type":"array"},"smartStep":{"default":true,"description":"Automatically step through generated code that cannot be mapped back to the original source.","type":"boolean"},"sourceMapPathOverrides":{"default":{"meteor://💻app/*":"${workspaceFolder}/*","webpack:///./~/*":"${workspaceFolder}/node_modules/*","webpack://?:*/*":"${workspaceFolder}/*"},"description":"A set of mappings for rewriting the locations of source files from what the sourcemap says, to their locations on disk.","type":"object"},"sourceMapRenames":{"default":true,"description":"Whether to use the \"names\" mapping in sourcemaps. This requires requesting source content, which can be slow with certain debuggers.","type":"boolean"},"sourceMaps":{"default":true,"description":"Use JavaScript source maps (if they exist).","type":"boolean"},"timeout":{"default":10000,"description":"Retry for this number of milliseconds to connect to Node.js. Default is 10000 ms.","type":"number"},"timeouts":{"additionalProperties":false,"default":{},"description":"Timeouts for several debugger operations.","markdownDescription":"Timeouts for several debugger operations.","properties":{"hoverEvaluation":{"default":500,"description":"Time until value evaluation for hovered symbols is aborted. If set to 0, hover evaluation does never time out.","type":"number"},"sourceMapCumulativePause":{"default":1000,"description":"Extra time in milliseconds allowed per session to be spent waiting for source-maps to be processed, after the minimum time (sourceMapMinPause) has been exhausted","type":"number"},"sourceMapMinPause":{"default":1000,"description":"Minimum time in milliseconds spent waiting for each source-map to be processed when a script is being parsed","type":"number"}},"type":"object"},"trace":{"default":true,"description":"Configures what diagnostic output is produced.","oneOf":[{"description":"Trace may be set to 'true' to write diagnostic logs to the disk.","type":"boolean"},{"additionalProperties":false,"properties":{"logFile":{"description":"Configures where on disk logs are written.","type":["string","null"]},"stdio":{"description":"Whether to return trace data from the launched application or browser.","type":"boolean"}},"type":"object"}]}},"type":"object"}]},"showAsyncStacks":{"default":true,"description":"Show the async calls that led to the current call stack.","oneOf":[{"type":"boolean"},{"properties":{"onAttach":{"default":32,"type":"number"}},"required":["onAttach"],"type":"object"},{"properties":{"onceBreakpointResolved":{"default":32,"type":"number"}},"required":["onceBreakpointResolved"],"type":"object"}]},"skipFiles":{"default":["/**"],"description":"An array of file or folder names, or path globs, to skip when debugging. Star patterns and negations are allowed, for example, `[\"**/node_modules/**\", \"!**/node_modules/my-module/**\"]`","type":"array"},"smartStep":{"default":true,"description":"Automatically step through generated code that cannot be mapped back to the original source.","type":"boolean"},"sourceMapPathOverrides":{"default":{"meteor://💻app/*":"${workspaceFolder}/*","webpack:///./~/*":"${workspaceFolder}/node_modules/*","webpack://?:*/*":"${workspaceFolder}/*"},"description":"A set of mappings for rewriting the locations of source files from what the sourcemap says, to their locations on disk.","type":"object"},"sourceMapRenames":{"default":true,"description":"Whether to use the \"names\" mapping in sourcemaps. This requires requesting source content, which can be slow with certain debuggers.","type":"boolean"},"sourceMaps":{"default":true,"description":"Use JavaScript source maps (if they exist).","type":"boolean"},"timeout":{"default":10000,"description":"Retry for this number of milliseconds to connect to Node.js. Default is 10000 ms.","type":"number"},"timeouts":{"additionalProperties":false,"default":{},"description":"Timeouts for several debugger operations.","markdownDescription":"Timeouts for several debugger operations.","properties":{"hoverEvaluation":{"default":500,"description":"Time until value evaluation for hovered symbols is aborted. If set to 0, hover evaluation does never time out.","type":"number"},"sourceMapCumulativePause":{"default":1000,"description":"Extra time in milliseconds allowed per session to be spent waiting for source-maps to be processed, after the minimum time (sourceMapMinPause) has been exhausted","type":"number"},"sourceMapMinPause":{"default":1000,"description":"Minimum time in milliseconds spent waiting for each source-map to be processed when a script is being parsed","type":"number"}},"type":"object"},"trace":{"default":true,"description":"Configures what diagnostic output is produced.","oneOf":[{"description":"Trace may be set to 'true' to write diagnostic logs to the disk.","type":"boolean"},{"additionalProperties":false,"properties":{"logFile":{"description":"Configures where on disk logs are written.","type":["string","null"]},"stdio":{"description":"Whether to return trace data from the launched application or browser.","type":"boolean"}},"type":"object"}]},"url":{"default":"http://localhost:8080","description":"Will search for a tab with this exact url and attach to it, if found","type":"string"},"urlFilter":{"default":"","description":"Will search for a page with this url and attach to it, if found. Can have * wildcards.","type":"string"},"userDataDir":{"default":true,"description":"By default, the browser is launched with a separate user profile in a temp folder. Use this option to override it. Set to false to launch with your default user profile. A new browser can't be launched if an instance is already running from `userDataDir`.","type":["string","boolean"]},"vueComponentPaths":{"default":["${workspaceFolder}/**/*.vue"],"description":"A list of file glob patterns to find `*.vue` components. By default, searches the entire workspace. This needs to be specified due to extra lookups that Vue's sourcemaps require in Vue CLI 4. You can disable this special handling by setting this to an empty array.","type":"array"},"webRoot":{"default":"${workspaceFolder}","description":"This specifies the workspace absolute path to the webserver root. Used to resolve paths like `/app.js` to files on disk. Shorthand for a pathMapping for \"/\"","type":"string"}}}},"configurationSnippets":[{"body":{"name":"Launch Chrome","request":"launch","type":"chrome","url":"http://localhost:8080","webRoot":"^\"${2:\\${workspaceFolder\\}}\""},"description":"Launch Chrome to debug a URL","label":"Chrome: Launch"},{"body":{"name":"Attach to Chrome","port":9222,"request":"attach","type":"chrome","webRoot":"^\"${2:\\${workspaceFolder\\}}\""},"description":"Attach to an instance of Chrome already in debug mode","label":"Chrome: Attach"}],"label":"Web App (Chrome)","strings":{"unverifiedBreakpoints":"Some of your breakpoints could not be set. If you're having an issue, you can [troubleshoot your launch configuration](command:extension.js-debug.createDiagnostics)."},"type":"chrome"},{"aiKey":"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255","configurationAttributes":{"attach":{"properties":{"address":{"default":"localhost","description":"IP address or hostname the debugged browser is listening on.","type":"string"},"browserAttachLocation":{"default":null,"description":"Forces the browser to attach in one location. In a remote workspace (through ssh or WSL, for example) this can be used to attach to a browser on the remote machine rather than locally.","oneOf":[{"type":"null"},{"enum":["ui","workspace"],"type":"string"}]},"cascadeTerminateToConfigurations":{"default":[],"description":"A list of debug sessions which, when this debug session is terminated, will also be stopped.","items":{"type":"string","uniqueItems":true},"type":"array"},"customDescriptionGenerator":{"description":"Customize the textual description the debugger shows for objects (local variables, etc...). Samples:\n 1. this.toString() // will call toString to print all objects\n 2. this.customDescription ? this.customDescription() : defaultValue // Use customDescription method if available, if not return defaultValue\n 3. function (def) { return this.customDescription ? this.customDescription() : def } // Use customDescription method if available, if not return defaultValue\n ","type":"string"},"customPropertiesGenerator":{"deprecated":true,"description":"Customize the properties shown for an object in the debugger (local variables, etc...). Samples:\n 1. { ...this, extraProperty: '12345' } // Add an extraProperty 12345 to all objects\n 2. this.customProperties ? this.customProperties() : this // Use customProperties method if available, if not use the properties in this (the default properties)\n 3. function () { return this.customProperties ? this.customProperties() : this } // Use customDescription method if available, if not return the default properties\n\n Deprecated: This is a temporary implementation of this feature until we have time to implement it in the way described here: https://github.com/microsoft/vscode/issues/102181","type":"string"},"disableNetworkCache":{"default":true,"description":"Controls whether to skip the network cache for each request","type":"boolean"},"enableContentValidation":{"default":true,"description":"Toggles whether we verify the contents of files on disk match the ones loaded in the runtime. This is useful in a variety of scenarios and required in some, but can cause issues if you have server-side transformation of scripts, for example.","type":"boolean"},"inspectUri":{"default":null,"description":"Format to use to rewrite the inspectUri: It's a template string that interpolates keys in `{curlyBraces}`. Available keys are:\n - `url.*` is the parsed address of the running application. For instance, `{url.port}`, `{url.hostname}`\n - `port` is the debug port that Chrome is listening on.\n - `browserInspectUri` is the inspector URI on the launched browser\n - `browserInspectUriPath` is the path part of the inspector URI on the launched browser (e.g.: \"/devtools/browser/e9ec0098-306e-472a-8133-5e42488929c2\").\n - `wsProtocol` is the hinted websocket protocol. This is set to `wss` if the original URL is `https`, or `ws` otherwise.\n","type":["string","null"]},"outFiles":{"default":["${workspaceFolder}/**/*.js","!**/node_modules/**"],"description":"If source maps are enabled, these glob patterns specify the generated JavaScript files. If a pattern starts with `!` the files are excluded. If not specified, the generated code is expected in the same directory as its source.","items":{"type":"string"},"type":["array"]},"outputCapture":{"default":"console","enum":["console","std"],"markdownDescription":"From where to capture output messages: the default debug API if set to `console`, or stdout/stderr streams if set to `std`."},"pathMapping":{"default":{},"description":"A mapping of URLs/paths to local folders, to resolve scripts in the Browser to scripts on disk","type":"object"},"pauseForSourceMap":{"default":false,"markdownDescription":"Whether to wait for source maps to load for each incoming script. This has a performance overhead, and might be safely disabled when running off of disk, so long as `rootPath` is not disabled.","type":"boolean"},"perScriptSourcemaps":{"default":"auto","description":"Whether scripts are loaded individually with unique sourcemaps containing the basename of the source file. This can be set to optimize sourcemap handling when dealing with lots of small scripts. If set to \"auto\", we'll detect known cases where this is appropriate.","enum":["yes","no","auto"],"type":"string"},"port":{"default":9229,"description":"Port to use to remote debugging the browser, given as `--remote-debugging-port` when launching the browser.","type":"number"},"resolveSourceMapLocations":{"default":null,"description":"A list of minimatch patterns for locations (folders and URLs) in which source maps can be used to resolve local files. This can be used to avoid incorrectly breaking in external source mapped code. Patterns can be prefixed with \"!\" to exclude them. May be set to an empty array or null to avoid restriction.","items":{"type":"string"},"type":["array","null"]},"restart":{"default":false,"markdownDescription":"Whether to reconnect if the browser connection is closed","type":"boolean"},"server":{"oneOf":[{"additionalProperties":false,"default":{"program":"node my-server.js"},"description":"Configures a web server to start up. Takes the same configuration as the 'node' launch task.","properties":{"args":{"default":[],"description":"Command line arguments passed to the program.\n\nCan be an array of strings or a single string. When the program is launched in a terminal, setting this property to a single string will result in the arguments not being escaped for the shell.","items":{"type":"string"},"type":["array","string"]},"attachSimplePort":{"default":9229,"description":"If set, attaches to the process via the given port. This is generally no longer necessary for Node.js programs and loses the ability to debug child processes, but can be useful in more esoteric scenarios such as with Deno and Docker launches. If set to 0, a random port will be chosen and --inspect-brk added to the launch arguments automatically.","type":"integer"},"autoAttachChildProcesses":{"default":true,"description":"Attach debugger to new child processes automatically.","type":"boolean"},"cascadeTerminateToConfigurations":{"default":[],"description":"A list of debug sessions which, when this debug session is terminated, will also be stopped.","items":{"type":"string","uniqueItems":true},"type":"array"},"console":{"default":"internalConsole","description":"Where to launch the debug target.","enum":["internalConsole","integratedTerminal","externalTerminal"],"enumDescriptions":["VS Code Debug Console (which doesn't support to read input from a program)","VS Code's integrated terminal","External terminal that can be configured via user settings"],"type":"string"},"customDescriptionGenerator":{"description":"Customize the textual description the debugger shows for objects (local variables, etc...). Samples:\n 1. this.toString() // will call toString to print all objects\n 2. this.customDescription ? this.customDescription() : defaultValue // Use customDescription method if available, if not return defaultValue\n 3. function (def) { return this.customDescription ? this.customDescription() : def } // Use customDescription method if available, if not return defaultValue\n ","type":"string"},"customPropertiesGenerator":{"deprecated":true,"description":"Customize the properties shown for an object in the debugger (local variables, etc...). Samples:\n 1. { ...this, extraProperty: '12345' } // Add an extraProperty 12345 to all objects\n 2. this.customProperties ? this.customProperties() : this // Use customProperties method if available, if not use the properties in this (the default properties)\n 3. function () { return this.customProperties ? this.customProperties() : this } // Use customDescription method if available, if not return the default properties\n\n Deprecated: This is a temporary implementation of this feature until we have time to implement it in the way described here: https://github.com/microsoft/vscode/issues/102181","type":"string"},"cwd":{"default":"${workspaceFolder}","description":"Absolute path to the working directory of the program being debugged. If you've set localRoot then cwd will match that value otherwise it falls back to your workspaceFolder","type":"string"},"enableContentValidation":{"default":true,"description":"Toggles whether we verify the contents of files on disk match the ones loaded in the runtime. This is useful in a variety of scenarios and required in some, but can cause issues if you have server-side transformation of scripts, for example.","type":"boolean"},"env":{"additionalProperties":{"type":["string","null"]},"default":{},"markdownDescription":"Environment variables passed to the program. The value `null` removes the variable from the environment.","type":"object"},"envFile":{"default":"${workspaceFolder}/.env","description":"Absolute path to a file containing environment variable definitions.","type":"string"},"killBehavior":{"default":"forceful","enum":["forceful","polite","none"],"markdownDescription":"Configures how debug processes are killed when stopping the session. Can be:\n\n- forceful (default): forcefully tears down the process tree. Sends SIGKILL on posix, or `taskkill.exe /F` on Windows.\n- polite: gracefully tears down the process tree. It's possible that misbehaving processes continue to run after shutdown in this way. Sends SIGTERM on posix, or `taskkill.exe` with no `/F` (force) flag on Windows.\n- none: no termination will happen.","type":"string"},"localRoot":{"default":null,"description":"Path to the local directory containing the program.","type":["string","null"]},"nodeVersionHint":{"default":12,"description":"Allows you to explicitly specify the Node version that's running, which can be used to disable or enable certain behaviors in cases where the automatic version detection does not work.","minimum":8,"type":"number"},"outFiles":{"default":["${workspaceFolder}/**/*.js","!**/node_modules/**"],"description":"If source maps are enabled, these glob patterns specify the generated JavaScript files. If a pattern starts with `!` the files are excluded. If not specified, the generated code is expected in the same directory as its source.","items":{"type":"string"},"type":["array"]},"outputCapture":{"default":"console","enum":["console","std"],"markdownDescription":"From where to capture output messages: the default debug API if set to `console`, or stdout/stderr streams if set to `std`."},"pauseForSourceMap":{"default":false,"markdownDescription":"Whether to wait for source maps to load for each incoming script. This has a performance overhead, and might be safely disabled when running off of disk, so long as `rootPath` is not disabled.","type":"boolean"},"profileStartup":{"default":true,"description":"If true, will start profiling as soon as the process launches","type":"boolean"},"program":{"default":"","description":"Absolute path to the program. Generated value is guessed by looking at package.json and opened files. Edit this attribute.","type":"string"},"remoteRoot":{"default":null,"description":"Absolute path to the remote directory containing the program.","type":["string","null"]},"resolveSourceMapLocations":{"default":["${workspaceFolder}/**","!**/node_modules/**"],"description":"A list of minimatch patterns for locations (folders and URLs) in which source maps can be used to resolve local files. This can be used to avoid incorrectly breaking in external source mapped code. Patterns can be prefixed with \"!\" to exclude them. May be set to an empty array or null to avoid restriction.","items":{"type":"string"},"type":["array","null"]},"restart":{"default":true,"description":"Try to reconnect to the program if we lose connection. If set to `true`, we'll try once a second, forever. You can customize the interval and maximum number of attempts by specifying the `delay` and `maxAttempts` in an object instead.","oneOf":[{"type":"boolean"},{"properties":{"delay":{"default":1000,"minimum":0,"type":"number"},"maxAttempts":{"default":10,"minimum":0,"type":"number"}},"type":"object"}]},"runtimeArgs":{"default":[],"description":"Optional arguments passed to the runtime executable.","items":{"type":"string"},"type":"array"},"runtimeExecutable":{"default":"node","markdownDescription":"Runtime to use. Either an absolute path or the name of a runtime available on the PATH. If omitted `node` is assumed.","type":["string","null"]},"runtimeSourcemapPausePatterns":{"default":[],"items":{"type":"string"},"markdownDescription":"A list of patterns at which to manually insert entrypoint breakpoints. This can be useful to give the debugger an opportunity to set breakpoints when using sourcemaps that don't exist or can't be detected before launch, such as [with the Serverless framework](https://github.com/microsoft/vscode-js-debug/issues/492).","type":"array"},"runtimeVersion":{"default":"default","markdownDescription":"Version of `node` runtime to use. Requires `nvm`.","type":"string"},"showAsyncStacks":{"default":true,"description":"Show the async calls that led to the current call stack.","oneOf":[{"type":"boolean"},{"properties":{"onAttach":{"default":32,"type":"number"}},"required":["onAttach"],"type":"object"},{"properties":{"onceBreakpointResolved":{"default":32,"type":"number"}},"required":["onceBreakpointResolved"],"type":"object"}]},"skipFiles":{"default":["/**"],"description":"An array of file or folder names, or path globs, to skip when debugging. Star patterns and negations are allowed, for example, `[\"**/node_modules/**\", \"!**/node_modules/my-module/**\"]`","type":"array"},"smartStep":{"default":true,"description":"Automatically step through generated code that cannot be mapped back to the original source.","type":"boolean"},"sourceMapPathOverrides":{"default":{"meteor://💻app/*":"${workspaceFolder}/*","webpack:///./~/*":"${workspaceFolder}/node_modules/*","webpack://?:*/*":"${workspaceFolder}/*"},"description":"A set of mappings for rewriting the locations of source files from what the sourcemap says, to their locations on disk.","type":"object"},"sourceMapRenames":{"default":true,"description":"Whether to use the \"names\" mapping in sourcemaps. This requires requesting source content, which can be slow with certain debuggers.","type":"boolean"},"sourceMaps":{"default":true,"description":"Use JavaScript source maps (if they exist).","type":"boolean"},"stopOnEntry":{"default":true,"description":"Automatically stop program after launch.","type":["boolean","string"]},"timeout":{"default":10000,"description":"Retry for this number of milliseconds to connect to Node.js. Default is 10000 ms.","type":"number"},"timeouts":{"additionalProperties":false,"default":{},"description":"Timeouts for several debugger operations.","markdownDescription":"Timeouts for several debugger operations.","properties":{"hoverEvaluation":{"default":500,"description":"Time until value evaluation for hovered symbols is aborted. If set to 0, hover evaluation does never time out.","type":"number"},"sourceMapCumulativePause":{"default":1000,"description":"Extra time in milliseconds allowed per session to be spent waiting for source-maps to be processed, after the minimum time (sourceMapMinPause) has been exhausted","type":"number"},"sourceMapMinPause":{"default":1000,"description":"Minimum time in milliseconds spent waiting for each source-map to be processed when a script is being parsed","type":"number"}},"type":"object"},"trace":{"default":true,"description":"Configures what diagnostic output is produced.","oneOf":[{"description":"Trace may be set to 'true' to write diagnostic logs to the disk.","type":"boolean"},{"additionalProperties":false,"properties":{"logFile":{"description":"Configures where on disk logs are written.","type":["string","null"]},"stdio":{"description":"Whether to return trace data from the launched application or browser.","type":"boolean"}},"type":"object"}]}},"type":"object"},{"additionalProperties":false,"default":{"program":"npm start"},"description":"JavaScript Debug Terminal","properties":{"autoAttachChildProcesses":{"default":true,"description":"Attach debugger to new child processes automatically.","type":"boolean"},"cascadeTerminateToConfigurations":{"default":[],"description":"A list of debug sessions which, when this debug session is terminated, will also be stopped.","items":{"type":"string","uniqueItems":true},"type":"array"},"command":{"default":"npm start","description":"Command to run in the launched terminal. If not provided, the terminal will open without launching a program.","type":["string","null"]},"customDescriptionGenerator":{"description":"Customize the textual description the debugger shows for objects (local variables, etc...). Samples:\n 1. this.toString() // will call toString to print all objects\n 2. this.customDescription ? this.customDescription() : defaultValue // Use customDescription method if available, if not return defaultValue\n 3. function (def) { return this.customDescription ? this.customDescription() : def } // Use customDescription method if available, if not return defaultValue\n ","type":"string"},"customPropertiesGenerator":{"deprecated":true,"description":"Customize the properties shown for an object in the debugger (local variables, etc...). Samples:\n 1. { ...this, extraProperty: '12345' } // Add an extraProperty 12345 to all objects\n 2. this.customProperties ? this.customProperties() : this // Use customProperties method if available, if not use the properties in this (the default properties)\n 3. function () { return this.customProperties ? this.customProperties() : this } // Use customDescription method if available, if not return the default properties\n\n Deprecated: This is a temporary implementation of this feature until we have time to implement it in the way described here: https://github.com/microsoft/vscode/issues/102181","type":"string"},"cwd":{"default":"${workspaceFolder}","description":"Absolute path to the working directory of the program being debugged. If you've set localRoot then cwd will match that value otherwise it falls back to your workspaceFolder","docDefault":"localRoot || ${workspaceFolder}","type":"string"},"enableContentValidation":{"default":true,"description":"Toggles whether we verify the contents of files on disk match the ones loaded in the runtime. This is useful in a variety of scenarios and required in some, but can cause issues if you have server-side transformation of scripts, for example.","type":"boolean"},"env":{"additionalProperties":{"type":["string","null"]},"default":{},"markdownDescription":"Environment variables passed to the program. The value `null` removes the variable from the environment.","type":"object"},"envFile":{"default":"${workspaceFolder}/.env","description":"Absolute path to a file containing environment variable definitions.","type":"string"},"localRoot":{"default":null,"description":"Path to the local directory containing the program.","type":["string","null"]},"nodeVersionHint":{"default":12,"description":"Allows you to explicitly specify the Node version that's running, which can be used to disable or enable certain behaviors in cases where the automatic version detection does not work.","minimum":8,"type":"number"},"outFiles":{"default":["${workspaceFolder}/**/*.js","!**/node_modules/**"],"description":"If source maps are enabled, these glob patterns specify the generated JavaScript files. If a pattern starts with `!` the files are excluded. If not specified, the generated code is expected in the same directory as its source.","items":{"type":"string"},"type":["array"]},"outputCapture":{"default":"console","enum":["console","std"],"markdownDescription":"From where to capture output messages: the default debug API if set to `console`, or stdout/stderr streams if set to `std`."},"pauseForSourceMap":{"default":false,"markdownDescription":"Whether to wait for source maps to load for each incoming script. This has a performance overhead, and might be safely disabled when running off of disk, so long as `rootPath` is not disabled.","type":"boolean"},"remoteRoot":{"default":null,"description":"Absolute path to the remote directory containing the program.","type":["string","null"]},"resolveSourceMapLocations":{"default":["${workspaceFolder}/**","!**/node_modules/**"],"description":"A list of minimatch patterns for locations (folders and URLs) in which source maps can be used to resolve local files. This can be used to avoid incorrectly breaking in external source mapped code. Patterns can be prefixed with \"!\" to exclude them. May be set to an empty array or null to avoid restriction.","items":{"type":"string"},"type":["array","null"]},"runtimeSourcemapPausePatterns":{"default":[],"items":{"type":"string"},"markdownDescription":"A list of patterns at which to manually insert entrypoint breakpoints. This can be useful to give the debugger an opportunity to set breakpoints when using sourcemaps that don't exist or can't be detected before launch, such as [with the Serverless framework](https://github.com/microsoft/vscode-js-debug/issues/492).","type":"array"},"showAsyncStacks":{"default":true,"description":"Show the async calls that led to the current call stack.","oneOf":[{"type":"boolean"},{"properties":{"onAttach":{"default":32,"type":"number"}},"required":["onAttach"],"type":"object"},{"properties":{"onceBreakpointResolved":{"default":32,"type":"number"}},"required":["onceBreakpointResolved"],"type":"object"}]},"skipFiles":{"default":["/**"],"description":"An array of file or folder names, or path globs, to skip when debugging. Star patterns and negations are allowed, for example, `[\"**/node_modules/**\", \"!**/node_modules/my-module/**\"]`","type":"array"},"smartStep":{"default":true,"description":"Automatically step through generated code that cannot be mapped back to the original source.","type":"boolean"},"sourceMapPathOverrides":{"default":{"meteor://💻app/*":"${workspaceFolder}/*","webpack:///./~/*":"${workspaceFolder}/node_modules/*","webpack://?:*/*":"${workspaceFolder}/*"},"description":"A set of mappings for rewriting the locations of source files from what the sourcemap says, to their locations on disk.","type":"object"},"sourceMapRenames":{"default":true,"description":"Whether to use the \"names\" mapping in sourcemaps. This requires requesting source content, which can be slow with certain debuggers.","type":"boolean"},"sourceMaps":{"default":true,"description":"Use JavaScript source maps (if they exist).","type":"boolean"},"timeout":{"default":10000,"description":"Retry for this number of milliseconds to connect to Node.js. Default is 10000 ms.","type":"number"},"timeouts":{"additionalProperties":false,"default":{},"description":"Timeouts for several debugger operations.","markdownDescription":"Timeouts for several debugger operations.","properties":{"hoverEvaluation":{"default":500,"description":"Time until value evaluation for hovered symbols is aborted. If set to 0, hover evaluation does never time out.","type":"number"},"sourceMapCumulativePause":{"default":1000,"description":"Extra time in milliseconds allowed per session to be spent waiting for source-maps to be processed, after the minimum time (sourceMapMinPause) has been exhausted","type":"number"},"sourceMapMinPause":{"default":1000,"description":"Minimum time in milliseconds spent waiting for each source-map to be processed when a script is being parsed","type":"number"}},"type":"object"},"trace":{"default":true,"description":"Configures what diagnostic output is produced.","oneOf":[{"description":"Trace may be set to 'true' to write diagnostic logs to the disk.","type":"boolean"},{"additionalProperties":false,"properties":{"logFile":{"description":"Configures where on disk logs are written.","type":["string","null"]},"stdio":{"description":"Whether to return trace data from the launched application or browser.","type":"boolean"}},"type":"object"}]}},"type":"object"}]},"showAsyncStacks":{"default":true,"description":"Show the async calls that led to the current call stack.","oneOf":[{"type":"boolean"},{"properties":{"onAttach":{"default":32,"type":"number"}},"required":["onAttach"],"type":"object"},{"properties":{"onceBreakpointResolved":{"default":32,"type":"number"}},"required":["onceBreakpointResolved"],"type":"object"}]},"skipFiles":{"default":["/**"],"description":"An array of file or folder names, or path globs, to skip when debugging. Star patterns and negations are allowed, for example, `[\"**/node_modules/**\", \"!**/node_modules/my-module/**\"]`","type":"array"},"smartStep":{"default":true,"description":"Automatically step through generated code that cannot be mapped back to the original source.","type":"boolean"},"sourceMapPathOverrides":{"default":{"meteor://💻app/*":"${workspaceFolder}/*","webpack:///./~/*":"${workspaceFolder}/node_modules/*","webpack://?:*/*":"${workspaceFolder}/*"},"description":"A set of mappings for rewriting the locations of source files from what the sourcemap says, to their locations on disk.","type":"object"},"sourceMapRenames":{"default":true,"description":"Whether to use the \"names\" mapping in sourcemaps. This requires requesting source content, which can be slow with certain debuggers.","type":"boolean"},"sourceMaps":{"default":true,"description":"Use JavaScript source maps (if they exist).","type":"boolean"},"targetSelection":{"default":"automatic","enum":["pick","automatic"],"markdownDescription":"Whether to attach to all targets that match the URL filter (\"automatic\") or ask to pick one (\"pick\").","type":"string"},"timeout":{"default":10000,"description":"Retry for this number of milliseconds to connect to Node.js. Default is 10000 ms.","type":"number"},"timeouts":{"additionalProperties":false,"default":{},"description":"Timeouts for several debugger operations.","markdownDescription":"Timeouts for several debugger operations.","properties":{"hoverEvaluation":{"default":500,"description":"Time until value evaluation for hovered symbols is aborted. If set to 0, hover evaluation does never time out.","type":"number"},"sourceMapCumulativePause":{"default":1000,"description":"Extra time in milliseconds allowed per session to be spent waiting for source-maps to be processed, after the minimum time (sourceMapMinPause) has been exhausted","type":"number"},"sourceMapMinPause":{"default":1000,"description":"Minimum time in milliseconds spent waiting for each source-map to be processed when a script is being parsed","type":"number"}},"type":"object"},"trace":{"default":true,"description":"Configures what diagnostic output is produced.","oneOf":[{"description":"Trace may be set to 'true' to write diagnostic logs to the disk.","type":"boolean"},{"additionalProperties":false,"properties":{"logFile":{"description":"Configures where on disk logs are written.","type":["string","null"]},"stdio":{"description":"Whether to return trace data from the launched application or browser.","type":"boolean"}},"type":"object"}]},"url":{"default":"http://localhost:8080","description":"Will search for a tab with this exact url and attach to it, if found","type":"string"},"urlFilter":{"default":"","description":"Will search for a page with this url and attach to it, if found. Can have * wildcards.","type":"string"},"useWebView":{"default":{"pipeName":"MyPipeName"},"description":"An object containing the `pipeName` of a debug pipe for a UWP hosted Webview2. This is the \"MyTestSharedMemory\" when creating the pipe \"\\\\.\\pipe\\LOCAL\\MyTestSharedMemory\"","properties":{"pipeName":{"type":"string"}},"type":"object"},"vueComponentPaths":{"default":["${workspaceFolder}/**/*.vue"],"description":"A list of file glob patterns to find `*.vue` components. By default, searches the entire workspace. This needs to be specified due to extra lookups that Vue's sourcemaps require in Vue CLI 4. You can disable this special handling by setting this to an empty array.","type":"array"},"webRoot":{"default":"${workspaceFolder}","description":"This specifies the workspace absolute path to the webserver root. Used to resolve paths like `/app.js` to files on disk. Shorthand for a pathMapping for \"/\"","type":"string"}}},"launch":{"properties":{"address":{"default":"localhost","description":"When debugging webviews, the IP address or hostname the webview is listening on. Will be automatically discovered if not set.","type":"string"},"browserLaunchLocation":{"default":null,"description":"Forces the browser to be launched in one location. In a remote workspace (through ssh or WSL, for example) this can be used to open the browser on the remote machine rather than locally.","oneOf":[{"type":"null"},{"enum":["ui","workspace"],"type":"string"}]},"cascadeTerminateToConfigurations":{"default":[],"description":"A list of debug sessions which, when this debug session is terminated, will also be stopped.","items":{"type":"string","uniqueItems":true},"type":"array"},"cleanUp":{"default":"wholeBrowser","description":"What clean-up to do after the debugging session finishes. Close only the tab being debug, vs. close the whole browser.","enum":["wholeBrowser","onlyTab"],"type":"string"},"customDescriptionGenerator":{"description":"Customize the textual description the debugger shows for objects (local variables, etc...). Samples:\n 1. this.toString() // will call toString to print all objects\n 2. this.customDescription ? this.customDescription() : defaultValue // Use customDescription method if available, if not return defaultValue\n 3. function (def) { return this.customDescription ? this.customDescription() : def } // Use customDescription method if available, if not return defaultValue\n ","type":"string"},"customPropertiesGenerator":{"deprecated":true,"description":"Customize the properties shown for an object in the debugger (local variables, etc...). Samples:\n 1. { ...this, extraProperty: '12345' } // Add an extraProperty 12345 to all objects\n 2. this.customProperties ? this.customProperties() : this // Use customProperties method if available, if not use the properties in this (the default properties)\n 3. function () { return this.customProperties ? this.customProperties() : this } // Use customDescription method if available, if not return the default properties\n\n Deprecated: This is a temporary implementation of this feature until we have time to implement it in the way described here: https://github.com/microsoft/vscode/issues/102181","type":"string"},"cwd":{"default":null,"description":"Optional working directory for the runtime executable.","type":"string"},"disableNetworkCache":{"default":true,"description":"Controls whether to skip the network cache for each request","type":"boolean"},"enableContentValidation":{"default":true,"description":"Toggles whether we verify the contents of files on disk match the ones loaded in the runtime. This is useful in a variety of scenarios and required in some, but can cause issues if you have server-side transformation of scripts, for example.","type":"boolean"},"env":{"default":{},"description":"Optional dictionary of environment key/value pairs for the browser.","type":"object"},"file":{"default":"${workspaceFolder}/index.html","description":"A local html file to open in the browser","type":"string"},"includeDefaultArgs":{"default":true,"description":"Whether default browser launch arguments (to disable features that may make debugging harder) will be included in the launch.","type":"boolean"},"includeLaunchArgs":{"default":true,"description":"Advanced: whether any default launch/debugging arguments are set on the browser. The debugger will assume the browser will use pipe debugging such as that which is provided with `--remote-debugging-pipe`.","type":"boolean"},"inspectUri":{"default":null,"description":"Format to use to rewrite the inspectUri: It's a template string that interpolates keys in `{curlyBraces}`. Available keys are:\n - `url.*` is the parsed address of the running application. For instance, `{url.port}`, `{url.hostname}`\n - `port` is the debug port that Chrome is listening on.\n - `browserInspectUri` is the inspector URI on the launched browser\n - `browserInspectUriPath` is the path part of the inspector URI on the launched browser (e.g.: \"/devtools/browser/e9ec0098-306e-472a-8133-5e42488929c2\").\n - `wsProtocol` is the hinted websocket protocol. This is set to `wss` if the original URL is `https`, or `ws` otherwise.\n","type":["string","null"]},"outFiles":{"default":["${workspaceFolder}/**/*.js","!**/node_modules/**"],"description":"If source maps are enabled, these glob patterns specify the generated JavaScript files. If a pattern starts with `!` the files are excluded. If not specified, the generated code is expected in the same directory as its source.","items":{"type":"string"},"type":["array"]},"outputCapture":{"default":"console","enum":["console","std"],"markdownDescription":"From where to capture output messages: the default debug API if set to `console`, or stdout/stderr streams if set to `std`."},"pathMapping":{"default":{},"description":"A mapping of URLs/paths to local folders, to resolve scripts in the Browser to scripts on disk","type":"object"},"pauseForSourceMap":{"default":false,"markdownDescription":"Whether to wait for source maps to load for each incoming script. This has a performance overhead, and might be safely disabled when running off of disk, so long as `rootPath` is not disabled.","type":"boolean"},"perScriptSourcemaps":{"default":"auto","description":"Whether scripts are loaded individually with unique sourcemaps containing the basename of the source file. This can be set to optimize sourcemap handling when dealing with lots of small scripts. If set to \"auto\", we'll detect known cases where this is appropriate.","enum":["yes","no","auto"],"type":"string"},"port":{"default":9229,"description":"When debugging webviews, the port the webview debugger is listening on. Will be automatically discovered if not set.","type":"number"},"profileStartup":{"default":true,"description":"If true, will start profiling soon as the process launches","type":"boolean"},"resolveSourceMapLocations":{"default":null,"description":"A list of minimatch patterns for locations (folders and URLs) in which source maps can be used to resolve local files. This can be used to avoid incorrectly breaking in external source mapped code. Patterns can be prefixed with \"!\" to exclude them. May be set to an empty array or null to avoid restriction.","items":{"type":"string"},"type":["array","null"]},"runtimeArgs":{"default":[],"description":"Optional arguments passed to the runtime executable.","items":{"type":"string"},"type":"array"},"runtimeExecutable":{"default":"stable","description":"Either 'canary', 'stable', 'dev', 'custom' or path to the browser executable. Custom means a custom wrapper, custom build or EDGE_PATH environment variable.","type":["string","null"]},"server":{"oneOf":[{"additionalProperties":false,"default":{"program":"node my-server.js"},"description":"Configures a web server to start up. Takes the same configuration as the 'node' launch task.","properties":{"args":{"default":[],"description":"Command line arguments passed to the program.\n\nCan be an array of strings or a single string. When the program is launched in a terminal, setting this property to a single string will result in the arguments not being escaped for the shell.","items":{"type":"string"},"type":["array","string"]},"attachSimplePort":{"default":9229,"description":"If set, attaches to the process via the given port. This is generally no longer necessary for Node.js programs and loses the ability to debug child processes, but can be useful in more esoteric scenarios such as with Deno and Docker launches. If set to 0, a random port will be chosen and --inspect-brk added to the launch arguments automatically.","type":"integer"},"autoAttachChildProcesses":{"default":true,"description":"Attach debugger to new child processes automatically.","type":"boolean"},"cascadeTerminateToConfigurations":{"default":[],"description":"A list of debug sessions which, when this debug session is terminated, will also be stopped.","items":{"type":"string","uniqueItems":true},"type":"array"},"console":{"default":"internalConsole","description":"Where to launch the debug target.","enum":["internalConsole","integratedTerminal","externalTerminal"],"enumDescriptions":["VS Code Debug Console (which doesn't support to read input from a program)","VS Code's integrated terminal","External terminal that can be configured via user settings"],"type":"string"},"customDescriptionGenerator":{"description":"Customize the textual description the debugger shows for objects (local variables, etc...). Samples:\n 1. this.toString() // will call toString to print all objects\n 2. this.customDescription ? this.customDescription() : defaultValue // Use customDescription method if available, if not return defaultValue\n 3. function (def) { return this.customDescription ? this.customDescription() : def } // Use customDescription method if available, if not return defaultValue\n ","type":"string"},"customPropertiesGenerator":{"deprecated":true,"description":"Customize the properties shown for an object in the debugger (local variables, etc...). Samples:\n 1. { ...this, extraProperty: '12345' } // Add an extraProperty 12345 to all objects\n 2. this.customProperties ? this.customProperties() : this // Use customProperties method if available, if not use the properties in this (the default properties)\n 3. function () { return this.customProperties ? this.customProperties() : this } // Use customDescription method if available, if not return the default properties\n\n Deprecated: This is a temporary implementation of this feature until we have time to implement it in the way described here: https://github.com/microsoft/vscode/issues/102181","type":"string"},"cwd":{"default":"${workspaceFolder}","description":"Absolute path to the working directory of the program being debugged. If you've set localRoot then cwd will match that value otherwise it falls back to your workspaceFolder","type":"string"},"enableContentValidation":{"default":true,"description":"Toggles whether we verify the contents of files on disk match the ones loaded in the runtime. This is useful in a variety of scenarios and required in some, but can cause issues if you have server-side transformation of scripts, for example.","type":"boolean"},"env":{"additionalProperties":{"type":["string","null"]},"default":{},"markdownDescription":"Environment variables passed to the program. The value `null` removes the variable from the environment.","type":"object"},"envFile":{"default":"${workspaceFolder}/.env","description":"Absolute path to a file containing environment variable definitions.","type":"string"},"killBehavior":{"default":"forceful","enum":["forceful","polite","none"],"markdownDescription":"Configures how debug processes are killed when stopping the session. Can be:\n\n- forceful (default): forcefully tears down the process tree. Sends SIGKILL on posix, or `taskkill.exe /F` on Windows.\n- polite: gracefully tears down the process tree. It's possible that misbehaving processes continue to run after shutdown in this way. Sends SIGTERM on posix, or `taskkill.exe` with no `/F` (force) flag on Windows.\n- none: no termination will happen.","type":"string"},"localRoot":{"default":null,"description":"Path to the local directory containing the program.","type":["string","null"]},"nodeVersionHint":{"default":12,"description":"Allows you to explicitly specify the Node version that's running, which can be used to disable or enable certain behaviors in cases where the automatic version detection does not work.","minimum":8,"type":"number"},"outFiles":{"default":["${workspaceFolder}/**/*.js","!**/node_modules/**"],"description":"If source maps are enabled, these glob patterns specify the generated JavaScript files. If a pattern starts with `!` the files are excluded. If not specified, the generated code is expected in the same directory as its source.","items":{"type":"string"},"type":["array"]},"outputCapture":{"default":"console","enum":["console","std"],"markdownDescription":"From where to capture output messages: the default debug API if set to `console`, or stdout/stderr streams if set to `std`."},"pauseForSourceMap":{"default":false,"markdownDescription":"Whether to wait for source maps to load for each incoming script. This has a performance overhead, and might be safely disabled when running off of disk, so long as `rootPath` is not disabled.","type":"boolean"},"profileStartup":{"default":true,"description":"If true, will start profiling as soon as the process launches","type":"boolean"},"program":{"default":"","description":"Absolute path to the program. Generated value is guessed by looking at package.json and opened files. Edit this attribute.","type":"string"},"remoteRoot":{"default":null,"description":"Absolute path to the remote directory containing the program.","type":["string","null"]},"resolveSourceMapLocations":{"default":["${workspaceFolder}/**","!**/node_modules/**"],"description":"A list of minimatch patterns for locations (folders and URLs) in which source maps can be used to resolve local files. This can be used to avoid incorrectly breaking in external source mapped code. Patterns can be prefixed with \"!\" to exclude them. May be set to an empty array or null to avoid restriction.","items":{"type":"string"},"type":["array","null"]},"restart":{"default":true,"description":"Try to reconnect to the program if we lose connection. If set to `true`, we'll try once a second, forever. You can customize the interval and maximum number of attempts by specifying the `delay` and `maxAttempts` in an object instead.","oneOf":[{"type":"boolean"},{"properties":{"delay":{"default":1000,"minimum":0,"type":"number"},"maxAttempts":{"default":10,"minimum":0,"type":"number"}},"type":"object"}]},"runtimeArgs":{"default":[],"description":"Optional arguments passed to the runtime executable.","items":{"type":"string"},"type":"array"},"runtimeExecutable":{"default":"node","markdownDescription":"Runtime to use. Either an absolute path or the name of a runtime available on the PATH. If omitted `node` is assumed.","type":["string","null"]},"runtimeSourcemapPausePatterns":{"default":[],"items":{"type":"string"},"markdownDescription":"A list of patterns at which to manually insert entrypoint breakpoints. This can be useful to give the debugger an opportunity to set breakpoints when using sourcemaps that don't exist or can't be detected before launch, such as [with the Serverless framework](https://github.com/microsoft/vscode-js-debug/issues/492).","type":"array"},"runtimeVersion":{"default":"default","markdownDescription":"Version of `node` runtime to use. Requires `nvm`.","type":"string"},"showAsyncStacks":{"default":true,"description":"Show the async calls that led to the current call stack.","oneOf":[{"type":"boolean"},{"properties":{"onAttach":{"default":32,"type":"number"}},"required":["onAttach"],"type":"object"},{"properties":{"onceBreakpointResolved":{"default":32,"type":"number"}},"required":["onceBreakpointResolved"],"type":"object"}]},"skipFiles":{"default":["/**"],"description":"An array of file or folder names, or path globs, to skip when debugging. Star patterns and negations are allowed, for example, `[\"**/node_modules/**\", \"!**/node_modules/my-module/**\"]`","type":"array"},"smartStep":{"default":true,"description":"Automatically step through generated code that cannot be mapped back to the original source.","type":"boolean"},"sourceMapPathOverrides":{"default":{"meteor://💻app/*":"${workspaceFolder}/*","webpack:///./~/*":"${workspaceFolder}/node_modules/*","webpack://?:*/*":"${workspaceFolder}/*"},"description":"A set of mappings for rewriting the locations of source files from what the sourcemap says, to their locations on disk.","type":"object"},"sourceMapRenames":{"default":true,"description":"Whether to use the \"names\" mapping in sourcemaps. This requires requesting source content, which can be slow with certain debuggers.","type":"boolean"},"sourceMaps":{"default":true,"description":"Use JavaScript source maps (if they exist).","type":"boolean"},"stopOnEntry":{"default":true,"description":"Automatically stop program after launch.","type":["boolean","string"]},"timeout":{"default":10000,"description":"Retry for this number of milliseconds to connect to Node.js. Default is 10000 ms.","type":"number"},"timeouts":{"additionalProperties":false,"default":{},"description":"Timeouts for several debugger operations.","markdownDescription":"Timeouts for several debugger operations.","properties":{"hoverEvaluation":{"default":500,"description":"Time until value evaluation for hovered symbols is aborted. If set to 0, hover evaluation does never time out.","type":"number"},"sourceMapCumulativePause":{"default":1000,"description":"Extra time in milliseconds allowed per session to be spent waiting for source-maps to be processed, after the minimum time (sourceMapMinPause) has been exhausted","type":"number"},"sourceMapMinPause":{"default":1000,"description":"Minimum time in milliseconds spent waiting for each source-map to be processed when a script is being parsed","type":"number"}},"type":"object"},"trace":{"default":true,"description":"Configures what diagnostic output is produced.","oneOf":[{"description":"Trace may be set to 'true' to write diagnostic logs to the disk.","type":"boolean"},{"additionalProperties":false,"properties":{"logFile":{"description":"Configures where on disk logs are written.","type":["string","null"]},"stdio":{"description":"Whether to return trace data from the launched application or browser.","type":"boolean"}},"type":"object"}]}},"type":"object"},{"additionalProperties":false,"default":{"program":"npm start"},"description":"JavaScript Debug Terminal","properties":{"autoAttachChildProcesses":{"default":true,"description":"Attach debugger to new child processes automatically.","type":"boolean"},"cascadeTerminateToConfigurations":{"default":[],"description":"A list of debug sessions which, when this debug session is terminated, will also be stopped.","items":{"type":"string","uniqueItems":true},"type":"array"},"command":{"default":"npm start","description":"Command to run in the launched terminal. If not provided, the terminal will open without launching a program.","type":["string","null"]},"customDescriptionGenerator":{"description":"Customize the textual description the debugger shows for objects (local variables, etc...). Samples:\n 1. this.toString() // will call toString to print all objects\n 2. this.customDescription ? this.customDescription() : defaultValue // Use customDescription method if available, if not return defaultValue\n 3. function (def) { return this.customDescription ? this.customDescription() : def } // Use customDescription method if available, if not return defaultValue\n ","type":"string"},"customPropertiesGenerator":{"deprecated":true,"description":"Customize the properties shown for an object in the debugger (local variables, etc...). Samples:\n 1. { ...this, extraProperty: '12345' } // Add an extraProperty 12345 to all objects\n 2. this.customProperties ? this.customProperties() : this // Use customProperties method if available, if not use the properties in this (the default properties)\n 3. function () { return this.customProperties ? this.customProperties() : this } // Use customDescription method if available, if not return the default properties\n\n Deprecated: This is a temporary implementation of this feature until we have time to implement it in the way described here: https://github.com/microsoft/vscode/issues/102181","type":"string"},"cwd":{"default":"${workspaceFolder}","description":"Absolute path to the working directory of the program being debugged. If you've set localRoot then cwd will match that value otherwise it falls back to your workspaceFolder","docDefault":"localRoot || ${workspaceFolder}","type":"string"},"enableContentValidation":{"default":true,"description":"Toggles whether we verify the contents of files on disk match the ones loaded in the runtime. This is useful in a variety of scenarios and required in some, but can cause issues if you have server-side transformation of scripts, for example.","type":"boolean"},"env":{"additionalProperties":{"type":["string","null"]},"default":{},"markdownDescription":"Environment variables passed to the program. The value `null` removes the variable from the environment.","type":"object"},"envFile":{"default":"${workspaceFolder}/.env","description":"Absolute path to a file containing environment variable definitions.","type":"string"},"localRoot":{"default":null,"description":"Path to the local directory containing the program.","type":["string","null"]},"nodeVersionHint":{"default":12,"description":"Allows you to explicitly specify the Node version that's running, which can be used to disable or enable certain behaviors in cases where the automatic version detection does not work.","minimum":8,"type":"number"},"outFiles":{"default":["${workspaceFolder}/**/*.js","!**/node_modules/**"],"description":"If source maps are enabled, these glob patterns specify the generated JavaScript files. If a pattern starts with `!` the files are excluded. If not specified, the generated code is expected in the same directory as its source.","items":{"type":"string"},"type":["array"]},"outputCapture":{"default":"console","enum":["console","std"],"markdownDescription":"From where to capture output messages: the default debug API if set to `console`, or stdout/stderr streams if set to `std`."},"pauseForSourceMap":{"default":false,"markdownDescription":"Whether to wait for source maps to load for each incoming script. This has a performance overhead, and might be safely disabled when running off of disk, so long as `rootPath` is not disabled.","type":"boolean"},"remoteRoot":{"default":null,"description":"Absolute path to the remote directory containing the program.","type":["string","null"]},"resolveSourceMapLocations":{"default":["${workspaceFolder}/**","!**/node_modules/**"],"description":"A list of minimatch patterns for locations (folders and URLs) in which source maps can be used to resolve local files. This can be used to avoid incorrectly breaking in external source mapped code. Patterns can be prefixed with \"!\" to exclude them. May be set to an empty array or null to avoid restriction.","items":{"type":"string"},"type":["array","null"]},"runtimeSourcemapPausePatterns":{"default":[],"items":{"type":"string"},"markdownDescription":"A list of patterns at which to manually insert entrypoint breakpoints. This can be useful to give the debugger an opportunity to set breakpoints when using sourcemaps that don't exist or can't be detected before launch, such as [with the Serverless framework](https://github.com/microsoft/vscode-js-debug/issues/492).","type":"array"},"showAsyncStacks":{"default":true,"description":"Show the async calls that led to the current call stack.","oneOf":[{"type":"boolean"},{"properties":{"onAttach":{"default":32,"type":"number"}},"required":["onAttach"],"type":"object"},{"properties":{"onceBreakpointResolved":{"default":32,"type":"number"}},"required":["onceBreakpointResolved"],"type":"object"}]},"skipFiles":{"default":["/**"],"description":"An array of file or folder names, or path globs, to skip when debugging. Star patterns and negations are allowed, for example, `[\"**/node_modules/**\", \"!**/node_modules/my-module/**\"]`","type":"array"},"smartStep":{"default":true,"description":"Automatically step through generated code that cannot be mapped back to the original source.","type":"boolean"},"sourceMapPathOverrides":{"default":{"meteor://💻app/*":"${workspaceFolder}/*","webpack:///./~/*":"${workspaceFolder}/node_modules/*","webpack://?:*/*":"${workspaceFolder}/*"},"description":"A set of mappings for rewriting the locations of source files from what the sourcemap says, to their locations on disk.","type":"object"},"sourceMapRenames":{"default":true,"description":"Whether to use the \"names\" mapping in sourcemaps. This requires requesting source content, which can be slow with certain debuggers.","type":"boolean"},"sourceMaps":{"default":true,"description":"Use JavaScript source maps (if they exist).","type":"boolean"},"timeout":{"default":10000,"description":"Retry for this number of milliseconds to connect to Node.js. Default is 10000 ms.","type":"number"},"timeouts":{"additionalProperties":false,"default":{},"description":"Timeouts for several debugger operations.","markdownDescription":"Timeouts for several debugger operations.","properties":{"hoverEvaluation":{"default":500,"description":"Time until value evaluation for hovered symbols is aborted. If set to 0, hover evaluation does never time out.","type":"number"},"sourceMapCumulativePause":{"default":1000,"description":"Extra time in milliseconds allowed per session to be spent waiting for source-maps to be processed, after the minimum time (sourceMapMinPause) has been exhausted","type":"number"},"sourceMapMinPause":{"default":1000,"description":"Minimum time in milliseconds spent waiting for each source-map to be processed when a script is being parsed","type":"number"}},"type":"object"},"trace":{"default":true,"description":"Configures what diagnostic output is produced.","oneOf":[{"description":"Trace may be set to 'true' to write diagnostic logs to the disk.","type":"boolean"},{"additionalProperties":false,"properties":{"logFile":{"description":"Configures where on disk logs are written.","type":["string","null"]},"stdio":{"description":"Whether to return trace data from the launched application or browser.","type":"boolean"}},"type":"object"}]}},"type":"object"}]},"showAsyncStacks":{"default":true,"description":"Show the async calls that led to the current call stack.","oneOf":[{"type":"boolean"},{"properties":{"onAttach":{"default":32,"type":"number"}},"required":["onAttach"],"type":"object"},{"properties":{"onceBreakpointResolved":{"default":32,"type":"number"}},"required":["onceBreakpointResolved"],"type":"object"}]},"skipFiles":{"default":["/**"],"description":"An array of file or folder names, or path globs, to skip when debugging. Star patterns and negations are allowed, for example, `[\"**/node_modules/**\", \"!**/node_modules/my-module/**\"]`","type":"array"},"smartStep":{"default":true,"description":"Automatically step through generated code that cannot be mapped back to the original source.","type":"boolean"},"sourceMapPathOverrides":{"default":{"meteor://💻app/*":"${workspaceFolder}/*","webpack:///./~/*":"${workspaceFolder}/node_modules/*","webpack://?:*/*":"${workspaceFolder}/*"},"description":"A set of mappings for rewriting the locations of source files from what the sourcemap says, to their locations on disk.","type":"object"},"sourceMapRenames":{"default":true,"description":"Whether to use the \"names\" mapping in sourcemaps. This requires requesting source content, which can be slow with certain debuggers.","type":"boolean"},"sourceMaps":{"default":true,"description":"Use JavaScript source maps (if they exist).","type":"boolean"},"timeout":{"default":10000,"description":"Retry for this number of milliseconds to connect to Node.js. Default is 10000 ms.","type":"number"},"timeouts":{"additionalProperties":false,"default":{},"description":"Timeouts for several debugger operations.","markdownDescription":"Timeouts for several debugger operations.","properties":{"hoverEvaluation":{"default":500,"description":"Time until value evaluation for hovered symbols is aborted. If set to 0, hover evaluation does never time out.","type":"number"},"sourceMapCumulativePause":{"default":1000,"description":"Extra time in milliseconds allowed per session to be spent waiting for source-maps to be processed, after the minimum time (sourceMapMinPause) has been exhausted","type":"number"},"sourceMapMinPause":{"default":1000,"description":"Minimum time in milliseconds spent waiting for each source-map to be processed when a script is being parsed","type":"number"}},"type":"object"},"trace":{"default":true,"description":"Configures what diagnostic output is produced.","oneOf":[{"description":"Trace may be set to 'true' to write diagnostic logs to the disk.","type":"boolean"},{"additionalProperties":false,"properties":{"logFile":{"description":"Configures where on disk logs are written.","type":["string","null"]},"stdio":{"description":"Whether to return trace data from the launched application or browser.","type":"boolean"}},"type":"object"}]},"url":{"default":"http://localhost:8080","description":"Will search for a tab with this exact url and attach to it, if found","type":"string"},"urlFilter":{"default":"","description":"Will search for a page with this url and attach to it, if found. Can have * wildcards.","type":"string"},"useWebView":{"default":false,"description":"When 'true', the debugger will treat the runtime executable as a host application that contains a WebView allowing you to debug the WebView script content.","type":"boolean"},"userDataDir":{"default":true,"description":"By default, the browser is launched with a separate user profile in a temp folder. Use this option to override it. Set to false to launch with your default user profile. A new browser can't be launched if an instance is already running from `userDataDir`.","type":["string","boolean"]},"vueComponentPaths":{"default":["${workspaceFolder}/**/*.vue"],"description":"A list of file glob patterns to find `*.vue` components. By default, searches the entire workspace. This needs to be specified due to extra lookups that Vue's sourcemaps require in Vue CLI 4. You can disable this special handling by setting this to an empty array.","type":"array"},"webRoot":{"default":"${workspaceFolder}","description":"This specifies the workspace absolute path to the webserver root. Used to resolve paths like `/app.js` to files on disk. Shorthand for a pathMapping for \"/\"","type":"string"}}}},"configurationSnippets":[],"deprecated":"Please use type msedge instead","label":"Web App (Edge)","languages":["javascript","typescript","javascriptreact","typescriptreact","html","css","coffeescript","handlebars","vue"],"strings":{"unverifiedBreakpoints":"Some of your breakpoints could not be set. If you're having an issue, you can [troubleshoot your launch configuration](command:extension.js-debug.createDiagnostics)."},"type":"pwa-msedge"},{"aiKey":"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255","configurationAttributes":{"attach":{"properties":{"address":{"default":"localhost","description":"IP address or hostname the debugged browser is listening on.","type":"string"},"browserAttachLocation":{"default":null,"description":"Forces the browser to attach in one location. In a remote workspace (through ssh or WSL, for example) this can be used to attach to a browser on the remote machine rather than locally.","oneOf":[{"type":"null"},{"enum":["ui","workspace"],"type":"string"}]},"cascadeTerminateToConfigurations":{"default":[],"description":"A list of debug sessions which, when this debug session is terminated, will also be stopped.","items":{"type":"string","uniqueItems":true},"type":"array"},"customDescriptionGenerator":{"description":"Customize the textual description the debugger shows for objects (local variables, etc...). Samples:\n 1. this.toString() // will call toString to print all objects\n 2. this.customDescription ? this.customDescription() : defaultValue // Use customDescription method if available, if not return defaultValue\n 3. function (def) { return this.customDescription ? this.customDescription() : def } // Use customDescription method if available, if not return defaultValue\n ","type":"string"},"customPropertiesGenerator":{"deprecated":true,"description":"Customize the properties shown for an object in the debugger (local variables, etc...). Samples:\n 1. { ...this, extraProperty: '12345' } // Add an extraProperty 12345 to all objects\n 2. this.customProperties ? this.customProperties() : this // Use customProperties method if available, if not use the properties in this (the default properties)\n 3. function () { return this.customProperties ? this.customProperties() : this } // Use customDescription method if available, if not return the default properties\n\n Deprecated: This is a temporary implementation of this feature until we have time to implement it in the way described here: https://github.com/microsoft/vscode/issues/102181","type":"string"},"disableNetworkCache":{"default":true,"description":"Controls whether to skip the network cache for each request","type":"boolean"},"enableContentValidation":{"default":true,"description":"Toggles whether we verify the contents of files on disk match the ones loaded in the runtime. This is useful in a variety of scenarios and required in some, but can cause issues if you have server-side transformation of scripts, for example.","type":"boolean"},"inspectUri":{"default":null,"description":"Format to use to rewrite the inspectUri: It's a template string that interpolates keys in `{curlyBraces}`. Available keys are:\n - `url.*` is the parsed address of the running application. For instance, `{url.port}`, `{url.hostname}`\n - `port` is the debug port that Chrome is listening on.\n - `browserInspectUri` is the inspector URI on the launched browser\n - `browserInspectUriPath` is the path part of the inspector URI on the launched browser (e.g.: \"/devtools/browser/e9ec0098-306e-472a-8133-5e42488929c2\").\n - `wsProtocol` is the hinted websocket protocol. This is set to `wss` if the original URL is `https`, or `ws` otherwise.\n","type":["string","null"]},"outFiles":{"default":["${workspaceFolder}/**/*.js","!**/node_modules/**"],"description":"If source maps are enabled, these glob patterns specify the generated JavaScript files. If a pattern starts with `!` the files are excluded. If not specified, the generated code is expected in the same directory as its source.","items":{"type":"string"},"type":["array"]},"outputCapture":{"default":"console","enum":["console","std"],"markdownDescription":"From where to capture output messages: the default debug API if set to `console`, or stdout/stderr streams if set to `std`."},"pathMapping":{"default":{},"description":"A mapping of URLs/paths to local folders, to resolve scripts in the Browser to scripts on disk","type":"object"},"pauseForSourceMap":{"default":false,"markdownDescription":"Whether to wait for source maps to load for each incoming script. This has a performance overhead, and might be safely disabled when running off of disk, so long as `rootPath` is not disabled.","type":"boolean"},"perScriptSourcemaps":{"default":"auto","description":"Whether scripts are loaded individually with unique sourcemaps containing the basename of the source file. This can be set to optimize sourcemap handling when dealing with lots of small scripts. If set to \"auto\", we'll detect known cases where this is appropriate.","enum":["yes","no","auto"],"type":"string"},"port":{"default":9229,"description":"Port to use to remote debugging the browser, given as `--remote-debugging-port` when launching the browser.","type":"number"},"resolveSourceMapLocations":{"default":null,"description":"A list of minimatch patterns for locations (folders and URLs) in which source maps can be used to resolve local files. This can be used to avoid incorrectly breaking in external source mapped code. Patterns can be prefixed with \"!\" to exclude them. May be set to an empty array or null to avoid restriction.","items":{"type":"string"},"type":["array","null"]},"restart":{"default":false,"markdownDescription":"Whether to reconnect if the browser connection is closed","type":"boolean"},"server":{"oneOf":[{"additionalProperties":false,"default":{"program":"node my-server.js"},"description":"Configures a web server to start up. Takes the same configuration as the 'node' launch task.","properties":{"args":{"default":[],"description":"Command line arguments passed to the program.\n\nCan be an array of strings or a single string. When the program is launched in a terminal, setting this property to a single string will result in the arguments not being escaped for the shell.","items":{"type":"string"},"type":["array","string"]},"attachSimplePort":{"default":9229,"description":"If set, attaches to the process via the given port. This is generally no longer necessary for Node.js programs and loses the ability to debug child processes, but can be useful in more esoteric scenarios such as with Deno and Docker launches. If set to 0, a random port will be chosen and --inspect-brk added to the launch arguments automatically.","type":"integer"},"autoAttachChildProcesses":{"default":true,"description":"Attach debugger to new child processes automatically.","type":"boolean"},"cascadeTerminateToConfigurations":{"default":[],"description":"A list of debug sessions which, when this debug session is terminated, will also be stopped.","items":{"type":"string","uniqueItems":true},"type":"array"},"console":{"default":"internalConsole","description":"Where to launch the debug target.","enum":["internalConsole","integratedTerminal","externalTerminal"],"enumDescriptions":["VS Code Debug Console (which doesn't support to read input from a program)","VS Code's integrated terminal","External terminal that can be configured via user settings"],"type":"string"},"customDescriptionGenerator":{"description":"Customize the textual description the debugger shows for objects (local variables, etc...). Samples:\n 1. this.toString() // will call toString to print all objects\n 2. this.customDescription ? this.customDescription() : defaultValue // Use customDescription method if available, if not return defaultValue\n 3. function (def) { return this.customDescription ? this.customDescription() : def } // Use customDescription method if available, if not return defaultValue\n ","type":"string"},"customPropertiesGenerator":{"deprecated":true,"description":"Customize the properties shown for an object in the debugger (local variables, etc...). Samples:\n 1. { ...this, extraProperty: '12345' } // Add an extraProperty 12345 to all objects\n 2. this.customProperties ? this.customProperties() : this // Use customProperties method if available, if not use the properties in this (the default properties)\n 3. function () { return this.customProperties ? this.customProperties() : this } // Use customDescription method if available, if not return the default properties\n\n Deprecated: This is a temporary implementation of this feature until we have time to implement it in the way described here: https://github.com/microsoft/vscode/issues/102181","type":"string"},"cwd":{"default":"${workspaceFolder}","description":"Absolute path to the working directory of the program being debugged. If you've set localRoot then cwd will match that value otherwise it falls back to your workspaceFolder","type":"string"},"enableContentValidation":{"default":true,"description":"Toggles whether we verify the contents of files on disk match the ones loaded in the runtime. This is useful in a variety of scenarios and required in some, but can cause issues if you have server-side transformation of scripts, for example.","type":"boolean"},"env":{"additionalProperties":{"type":["string","null"]},"default":{},"markdownDescription":"Environment variables passed to the program. The value `null` removes the variable from the environment.","type":"object"},"envFile":{"default":"${workspaceFolder}/.env","description":"Absolute path to a file containing environment variable definitions.","type":"string"},"killBehavior":{"default":"forceful","enum":["forceful","polite","none"],"markdownDescription":"Configures how debug processes are killed when stopping the session. Can be:\n\n- forceful (default): forcefully tears down the process tree. Sends SIGKILL on posix, or `taskkill.exe /F` on Windows.\n- polite: gracefully tears down the process tree. It's possible that misbehaving processes continue to run after shutdown in this way. Sends SIGTERM on posix, or `taskkill.exe` with no `/F` (force) flag on Windows.\n- none: no termination will happen.","type":"string"},"localRoot":{"default":null,"description":"Path to the local directory containing the program.","type":["string","null"]},"nodeVersionHint":{"default":12,"description":"Allows you to explicitly specify the Node version that's running, which can be used to disable or enable certain behaviors in cases where the automatic version detection does not work.","minimum":8,"type":"number"},"outFiles":{"default":["${workspaceFolder}/**/*.js","!**/node_modules/**"],"description":"If source maps are enabled, these glob patterns specify the generated JavaScript files. If a pattern starts with `!` the files are excluded. If not specified, the generated code is expected in the same directory as its source.","items":{"type":"string"},"type":["array"]},"outputCapture":{"default":"console","enum":["console","std"],"markdownDescription":"From where to capture output messages: the default debug API if set to `console`, or stdout/stderr streams if set to `std`."},"pauseForSourceMap":{"default":false,"markdownDescription":"Whether to wait for source maps to load for each incoming script. This has a performance overhead, and might be safely disabled when running off of disk, so long as `rootPath` is not disabled.","type":"boolean"},"profileStartup":{"default":true,"description":"If true, will start profiling as soon as the process launches","type":"boolean"},"program":{"default":"","description":"Absolute path to the program. Generated value is guessed by looking at package.json and opened files. Edit this attribute.","type":"string"},"remoteRoot":{"default":null,"description":"Absolute path to the remote directory containing the program.","type":["string","null"]},"resolveSourceMapLocations":{"default":["${workspaceFolder}/**","!**/node_modules/**"],"description":"A list of minimatch patterns for locations (folders and URLs) in which source maps can be used to resolve local files. This can be used to avoid incorrectly breaking in external source mapped code. Patterns can be prefixed with \"!\" to exclude them. May be set to an empty array or null to avoid restriction.","items":{"type":"string"},"type":["array","null"]},"restart":{"default":true,"description":"Try to reconnect to the program if we lose connection. If set to `true`, we'll try once a second, forever. You can customize the interval and maximum number of attempts by specifying the `delay` and `maxAttempts` in an object instead.","oneOf":[{"type":"boolean"},{"properties":{"delay":{"default":1000,"minimum":0,"type":"number"},"maxAttempts":{"default":10,"minimum":0,"type":"number"}},"type":"object"}]},"runtimeArgs":{"default":[],"description":"Optional arguments passed to the runtime executable.","items":{"type":"string"},"type":"array"},"runtimeExecutable":{"default":"node","markdownDescription":"Runtime to use. Either an absolute path or the name of a runtime available on the PATH. If omitted `node` is assumed.","type":["string","null"]},"runtimeSourcemapPausePatterns":{"default":[],"items":{"type":"string"},"markdownDescription":"A list of patterns at which to manually insert entrypoint breakpoints. This can be useful to give the debugger an opportunity to set breakpoints when using sourcemaps that don't exist or can't be detected before launch, such as [with the Serverless framework](https://github.com/microsoft/vscode-js-debug/issues/492).","type":"array"},"runtimeVersion":{"default":"default","markdownDescription":"Version of `node` runtime to use. Requires `nvm`.","type":"string"},"showAsyncStacks":{"default":true,"description":"Show the async calls that led to the current call stack.","oneOf":[{"type":"boolean"},{"properties":{"onAttach":{"default":32,"type":"number"}},"required":["onAttach"],"type":"object"},{"properties":{"onceBreakpointResolved":{"default":32,"type":"number"}},"required":["onceBreakpointResolved"],"type":"object"}]},"skipFiles":{"default":["/**"],"description":"An array of file or folder names, or path globs, to skip when debugging. Star patterns and negations are allowed, for example, `[\"**/node_modules/**\", \"!**/node_modules/my-module/**\"]`","type":"array"},"smartStep":{"default":true,"description":"Automatically step through generated code that cannot be mapped back to the original source.","type":"boolean"},"sourceMapPathOverrides":{"default":{"meteor://💻app/*":"${workspaceFolder}/*","webpack:///./~/*":"${workspaceFolder}/node_modules/*","webpack://?:*/*":"${workspaceFolder}/*"},"description":"A set of mappings for rewriting the locations of source files from what the sourcemap says, to their locations on disk.","type":"object"},"sourceMapRenames":{"default":true,"description":"Whether to use the \"names\" mapping in sourcemaps. This requires requesting source content, which can be slow with certain debuggers.","type":"boolean"},"sourceMaps":{"default":true,"description":"Use JavaScript source maps (if they exist).","type":"boolean"},"stopOnEntry":{"default":true,"description":"Automatically stop program after launch.","type":["boolean","string"]},"timeout":{"default":10000,"description":"Retry for this number of milliseconds to connect to Node.js. Default is 10000 ms.","type":"number"},"timeouts":{"additionalProperties":false,"default":{},"description":"Timeouts for several debugger operations.","markdownDescription":"Timeouts for several debugger operations.","properties":{"hoverEvaluation":{"default":500,"description":"Time until value evaluation for hovered symbols is aborted. If set to 0, hover evaluation does never time out.","type":"number"},"sourceMapCumulativePause":{"default":1000,"description":"Extra time in milliseconds allowed per session to be spent waiting for source-maps to be processed, after the minimum time (sourceMapMinPause) has been exhausted","type":"number"},"sourceMapMinPause":{"default":1000,"description":"Minimum time in milliseconds spent waiting for each source-map to be processed when a script is being parsed","type":"number"}},"type":"object"},"trace":{"default":true,"description":"Configures what diagnostic output is produced.","oneOf":[{"description":"Trace may be set to 'true' to write diagnostic logs to the disk.","type":"boolean"},{"additionalProperties":false,"properties":{"logFile":{"description":"Configures where on disk logs are written.","type":["string","null"]},"stdio":{"description":"Whether to return trace data from the launched application or browser.","type":"boolean"}},"type":"object"}]}},"type":"object"},{"additionalProperties":false,"default":{"program":"npm start"},"description":"JavaScript Debug Terminal","properties":{"autoAttachChildProcesses":{"default":true,"description":"Attach debugger to new child processes automatically.","type":"boolean"},"cascadeTerminateToConfigurations":{"default":[],"description":"A list of debug sessions which, when this debug session is terminated, will also be stopped.","items":{"type":"string","uniqueItems":true},"type":"array"},"command":{"default":"npm start","description":"Command to run in the launched terminal. If not provided, the terminal will open without launching a program.","type":["string","null"]},"customDescriptionGenerator":{"description":"Customize the textual description the debugger shows for objects (local variables, etc...). Samples:\n 1. this.toString() // will call toString to print all objects\n 2. this.customDescription ? this.customDescription() : defaultValue // Use customDescription method if available, if not return defaultValue\n 3. function (def) { return this.customDescription ? this.customDescription() : def } // Use customDescription method if available, if not return defaultValue\n ","type":"string"},"customPropertiesGenerator":{"deprecated":true,"description":"Customize the properties shown for an object in the debugger (local variables, etc...). Samples:\n 1. { ...this, extraProperty: '12345' } // Add an extraProperty 12345 to all objects\n 2. this.customProperties ? this.customProperties() : this // Use customProperties method if available, if not use the properties in this (the default properties)\n 3. function () { return this.customProperties ? this.customProperties() : this } // Use customDescription method if available, if not return the default properties\n\n Deprecated: This is a temporary implementation of this feature until we have time to implement it in the way described here: https://github.com/microsoft/vscode/issues/102181","type":"string"},"cwd":{"default":"${workspaceFolder}","description":"Absolute path to the working directory of the program being debugged. If you've set localRoot then cwd will match that value otherwise it falls back to your workspaceFolder","docDefault":"localRoot || ${workspaceFolder}","type":"string"},"enableContentValidation":{"default":true,"description":"Toggles whether we verify the contents of files on disk match the ones loaded in the runtime. This is useful in a variety of scenarios and required in some, but can cause issues if you have server-side transformation of scripts, for example.","type":"boolean"},"env":{"additionalProperties":{"type":["string","null"]},"default":{},"markdownDescription":"Environment variables passed to the program. The value `null` removes the variable from the environment.","type":"object"},"envFile":{"default":"${workspaceFolder}/.env","description":"Absolute path to a file containing environment variable definitions.","type":"string"},"localRoot":{"default":null,"description":"Path to the local directory containing the program.","type":["string","null"]},"nodeVersionHint":{"default":12,"description":"Allows you to explicitly specify the Node version that's running, which can be used to disable or enable certain behaviors in cases where the automatic version detection does not work.","minimum":8,"type":"number"},"outFiles":{"default":["${workspaceFolder}/**/*.js","!**/node_modules/**"],"description":"If source maps are enabled, these glob patterns specify the generated JavaScript files. If a pattern starts with `!` the files are excluded. If not specified, the generated code is expected in the same directory as its source.","items":{"type":"string"},"type":["array"]},"outputCapture":{"default":"console","enum":["console","std"],"markdownDescription":"From where to capture output messages: the default debug API if set to `console`, or stdout/stderr streams if set to `std`."},"pauseForSourceMap":{"default":false,"markdownDescription":"Whether to wait for source maps to load for each incoming script. This has a performance overhead, and might be safely disabled when running off of disk, so long as `rootPath` is not disabled.","type":"boolean"},"remoteRoot":{"default":null,"description":"Absolute path to the remote directory containing the program.","type":["string","null"]},"resolveSourceMapLocations":{"default":["${workspaceFolder}/**","!**/node_modules/**"],"description":"A list of minimatch patterns for locations (folders and URLs) in which source maps can be used to resolve local files. This can be used to avoid incorrectly breaking in external source mapped code. Patterns can be prefixed with \"!\" to exclude them. May be set to an empty array or null to avoid restriction.","items":{"type":"string"},"type":["array","null"]},"runtimeSourcemapPausePatterns":{"default":[],"items":{"type":"string"},"markdownDescription":"A list of patterns at which to manually insert entrypoint breakpoints. This can be useful to give the debugger an opportunity to set breakpoints when using sourcemaps that don't exist or can't be detected before launch, such as [with the Serverless framework](https://github.com/microsoft/vscode-js-debug/issues/492).","type":"array"},"showAsyncStacks":{"default":true,"description":"Show the async calls that led to the current call stack.","oneOf":[{"type":"boolean"},{"properties":{"onAttach":{"default":32,"type":"number"}},"required":["onAttach"],"type":"object"},{"properties":{"onceBreakpointResolved":{"default":32,"type":"number"}},"required":["onceBreakpointResolved"],"type":"object"}]},"skipFiles":{"default":["/**"],"description":"An array of file or folder names, or path globs, to skip when debugging. Star patterns and negations are allowed, for example, `[\"**/node_modules/**\", \"!**/node_modules/my-module/**\"]`","type":"array"},"smartStep":{"default":true,"description":"Automatically step through generated code that cannot be mapped back to the original source.","type":"boolean"},"sourceMapPathOverrides":{"default":{"meteor://💻app/*":"${workspaceFolder}/*","webpack:///./~/*":"${workspaceFolder}/node_modules/*","webpack://?:*/*":"${workspaceFolder}/*"},"description":"A set of mappings for rewriting the locations of source files from what the sourcemap says, to their locations on disk.","type":"object"},"sourceMapRenames":{"default":true,"description":"Whether to use the \"names\" mapping in sourcemaps. This requires requesting source content, which can be slow with certain debuggers.","type":"boolean"},"sourceMaps":{"default":true,"description":"Use JavaScript source maps (if they exist).","type":"boolean"},"timeout":{"default":10000,"description":"Retry for this number of milliseconds to connect to Node.js. Default is 10000 ms.","type":"number"},"timeouts":{"additionalProperties":false,"default":{},"description":"Timeouts for several debugger operations.","markdownDescription":"Timeouts for several debugger operations.","properties":{"hoverEvaluation":{"default":500,"description":"Time until value evaluation for hovered symbols is aborted. If set to 0, hover evaluation does never time out.","type":"number"},"sourceMapCumulativePause":{"default":1000,"description":"Extra time in milliseconds allowed per session to be spent waiting for source-maps to be processed, after the minimum time (sourceMapMinPause) has been exhausted","type":"number"},"sourceMapMinPause":{"default":1000,"description":"Minimum time in milliseconds spent waiting for each source-map to be processed when a script is being parsed","type":"number"}},"type":"object"},"trace":{"default":true,"description":"Configures what diagnostic output is produced.","oneOf":[{"description":"Trace may be set to 'true' to write diagnostic logs to the disk.","type":"boolean"},{"additionalProperties":false,"properties":{"logFile":{"description":"Configures where on disk logs are written.","type":["string","null"]},"stdio":{"description":"Whether to return trace data from the launched application or browser.","type":"boolean"}},"type":"object"}]}},"type":"object"}]},"showAsyncStacks":{"default":true,"description":"Show the async calls that led to the current call stack.","oneOf":[{"type":"boolean"},{"properties":{"onAttach":{"default":32,"type":"number"}},"required":["onAttach"],"type":"object"},{"properties":{"onceBreakpointResolved":{"default":32,"type":"number"}},"required":["onceBreakpointResolved"],"type":"object"}]},"skipFiles":{"default":["/**"],"description":"An array of file or folder names, or path globs, to skip when debugging. Star patterns and negations are allowed, for example, `[\"**/node_modules/**\", \"!**/node_modules/my-module/**\"]`","type":"array"},"smartStep":{"default":true,"description":"Automatically step through generated code that cannot be mapped back to the original source.","type":"boolean"},"sourceMapPathOverrides":{"default":{"meteor://💻app/*":"${workspaceFolder}/*","webpack:///./~/*":"${workspaceFolder}/node_modules/*","webpack://?:*/*":"${workspaceFolder}/*"},"description":"A set of mappings for rewriting the locations of source files from what the sourcemap says, to their locations on disk.","type":"object"},"sourceMapRenames":{"default":true,"description":"Whether to use the \"names\" mapping in sourcemaps. This requires requesting source content, which can be slow with certain debuggers.","type":"boolean"},"sourceMaps":{"default":true,"description":"Use JavaScript source maps (if they exist).","type":"boolean"},"targetSelection":{"default":"automatic","enum":["pick","automatic"],"markdownDescription":"Whether to attach to all targets that match the URL filter (\"automatic\") or ask to pick one (\"pick\").","type":"string"},"timeout":{"default":10000,"description":"Retry for this number of milliseconds to connect to Node.js. Default is 10000 ms.","type":"number"},"timeouts":{"additionalProperties":false,"default":{},"description":"Timeouts for several debugger operations.","markdownDescription":"Timeouts for several debugger operations.","properties":{"hoverEvaluation":{"default":500,"description":"Time until value evaluation for hovered symbols is aborted. If set to 0, hover evaluation does never time out.","type":"number"},"sourceMapCumulativePause":{"default":1000,"description":"Extra time in milliseconds allowed per session to be spent waiting for source-maps to be processed, after the minimum time (sourceMapMinPause) has been exhausted","type":"number"},"sourceMapMinPause":{"default":1000,"description":"Minimum time in milliseconds spent waiting for each source-map to be processed when a script is being parsed","type":"number"}},"type":"object"},"trace":{"default":true,"description":"Configures what diagnostic output is produced.","oneOf":[{"description":"Trace may be set to 'true' to write diagnostic logs to the disk.","type":"boolean"},{"additionalProperties":false,"properties":{"logFile":{"description":"Configures where on disk logs are written.","type":["string","null"]},"stdio":{"description":"Whether to return trace data from the launched application or browser.","type":"boolean"}},"type":"object"}]},"url":{"default":"http://localhost:8080","description":"Will search for a tab with this exact url and attach to it, if found","type":"string"},"urlFilter":{"default":"","description":"Will search for a page with this url and attach to it, if found. Can have * wildcards.","type":"string"},"useWebView":{"default":{"pipeName":"MyPipeName"},"description":"An object containing the `pipeName` of a debug pipe for a UWP hosted Webview2. This is the \"MyTestSharedMemory\" when creating the pipe \"\\\\.\\pipe\\LOCAL\\MyTestSharedMemory\"","properties":{"pipeName":{"type":"string"}},"type":"object"},"vueComponentPaths":{"default":["${workspaceFolder}/**/*.vue"],"description":"A list of file glob patterns to find `*.vue` components. By default, searches the entire workspace. This needs to be specified due to extra lookups that Vue's sourcemaps require in Vue CLI 4. You can disable this special handling by setting this to an empty array.","type":"array"},"webRoot":{"default":"${workspaceFolder}","description":"This specifies the workspace absolute path to the webserver root. Used to resolve paths like `/app.js` to files on disk. Shorthand for a pathMapping for \"/\"","type":"string"}}},"launch":{"properties":{"address":{"default":"localhost","description":"When debugging webviews, the IP address or hostname the webview is listening on. Will be automatically discovered if not set.","type":"string"},"browserLaunchLocation":{"default":null,"description":"Forces the browser to be launched in one location. In a remote workspace (through ssh or WSL, for example) this can be used to open the browser on the remote machine rather than locally.","oneOf":[{"type":"null"},{"enum":["ui","workspace"],"type":"string"}]},"cascadeTerminateToConfigurations":{"default":[],"description":"A list of debug sessions which, when this debug session is terminated, will also be stopped.","items":{"type":"string","uniqueItems":true},"type":"array"},"cleanUp":{"default":"wholeBrowser","description":"What clean-up to do after the debugging session finishes. Close only the tab being debug, vs. close the whole browser.","enum":["wholeBrowser","onlyTab"],"type":"string"},"customDescriptionGenerator":{"description":"Customize the textual description the debugger shows for objects (local variables, etc...). Samples:\n 1. this.toString() // will call toString to print all objects\n 2. this.customDescription ? this.customDescription() : defaultValue // Use customDescription method if available, if not return defaultValue\n 3. function (def) { return this.customDescription ? this.customDescription() : def } // Use customDescription method if available, if not return defaultValue\n ","type":"string"},"customPropertiesGenerator":{"deprecated":true,"description":"Customize the properties shown for an object in the debugger (local variables, etc...). Samples:\n 1. { ...this, extraProperty: '12345' } // Add an extraProperty 12345 to all objects\n 2. this.customProperties ? this.customProperties() : this // Use customProperties method if available, if not use the properties in this (the default properties)\n 3. function () { return this.customProperties ? this.customProperties() : this } // Use customDescription method if available, if not return the default properties\n\n Deprecated: This is a temporary implementation of this feature until we have time to implement it in the way described here: https://github.com/microsoft/vscode/issues/102181","type":"string"},"cwd":{"default":null,"description":"Optional working directory for the runtime executable.","type":"string"},"disableNetworkCache":{"default":true,"description":"Controls whether to skip the network cache for each request","type":"boolean"},"enableContentValidation":{"default":true,"description":"Toggles whether we verify the contents of files on disk match the ones loaded in the runtime. This is useful in a variety of scenarios and required in some, but can cause issues if you have server-side transformation of scripts, for example.","type":"boolean"},"env":{"default":{},"description":"Optional dictionary of environment key/value pairs for the browser.","type":"object"},"file":{"default":"${workspaceFolder}/index.html","description":"A local html file to open in the browser","type":"string"},"includeDefaultArgs":{"default":true,"description":"Whether default browser launch arguments (to disable features that may make debugging harder) will be included in the launch.","type":"boolean"},"includeLaunchArgs":{"default":true,"description":"Advanced: whether any default launch/debugging arguments are set on the browser. The debugger will assume the browser will use pipe debugging such as that which is provided with `--remote-debugging-pipe`.","type":"boolean"},"inspectUri":{"default":null,"description":"Format to use to rewrite the inspectUri: It's a template string that interpolates keys in `{curlyBraces}`. Available keys are:\n - `url.*` is the parsed address of the running application. For instance, `{url.port}`, `{url.hostname}`\n - `port` is the debug port that Chrome is listening on.\n - `browserInspectUri` is the inspector URI on the launched browser\n - `browserInspectUriPath` is the path part of the inspector URI on the launched browser (e.g.: \"/devtools/browser/e9ec0098-306e-472a-8133-5e42488929c2\").\n - `wsProtocol` is the hinted websocket protocol. This is set to `wss` if the original URL is `https`, or `ws` otherwise.\n","type":["string","null"]},"outFiles":{"default":["${workspaceFolder}/**/*.js","!**/node_modules/**"],"description":"If source maps are enabled, these glob patterns specify the generated JavaScript files. If a pattern starts with `!` the files are excluded. If not specified, the generated code is expected in the same directory as its source.","items":{"type":"string"},"type":["array"]},"outputCapture":{"default":"console","enum":["console","std"],"markdownDescription":"From where to capture output messages: the default debug API if set to `console`, or stdout/stderr streams if set to `std`."},"pathMapping":{"default":{},"description":"A mapping of URLs/paths to local folders, to resolve scripts in the Browser to scripts on disk","type":"object"},"pauseForSourceMap":{"default":false,"markdownDescription":"Whether to wait for source maps to load for each incoming script. This has a performance overhead, and might be safely disabled when running off of disk, so long as `rootPath` is not disabled.","type":"boolean"},"perScriptSourcemaps":{"default":"auto","description":"Whether scripts are loaded individually with unique sourcemaps containing the basename of the source file. This can be set to optimize sourcemap handling when dealing with lots of small scripts. If set to \"auto\", we'll detect known cases where this is appropriate.","enum":["yes","no","auto"],"type":"string"},"port":{"default":9229,"description":"When debugging webviews, the port the webview debugger is listening on. Will be automatically discovered if not set.","type":"number"},"profileStartup":{"default":true,"description":"If true, will start profiling soon as the process launches","type":"boolean"},"resolveSourceMapLocations":{"default":null,"description":"A list of minimatch patterns for locations (folders and URLs) in which source maps can be used to resolve local files. This can be used to avoid incorrectly breaking in external source mapped code. Patterns can be prefixed with \"!\" to exclude them. May be set to an empty array or null to avoid restriction.","items":{"type":"string"},"type":["array","null"]},"runtimeArgs":{"default":[],"description":"Optional arguments passed to the runtime executable.","items":{"type":"string"},"type":"array"},"runtimeExecutable":{"default":"stable","description":"Either 'canary', 'stable', 'dev', 'custom' or path to the browser executable. Custom means a custom wrapper, custom build or EDGE_PATH environment variable.","type":["string","null"]},"server":{"oneOf":[{"additionalProperties":false,"default":{"program":"node my-server.js"},"description":"Configures a web server to start up. Takes the same configuration as the 'node' launch task.","properties":{"args":{"default":[],"description":"Command line arguments passed to the program.\n\nCan be an array of strings or a single string. When the program is launched in a terminal, setting this property to a single string will result in the arguments not being escaped for the shell.","items":{"type":"string"},"type":["array","string"]},"attachSimplePort":{"default":9229,"description":"If set, attaches to the process via the given port. This is generally no longer necessary for Node.js programs and loses the ability to debug child processes, but can be useful in more esoteric scenarios such as with Deno and Docker launches. If set to 0, a random port will be chosen and --inspect-brk added to the launch arguments automatically.","type":"integer"},"autoAttachChildProcesses":{"default":true,"description":"Attach debugger to new child processes automatically.","type":"boolean"},"cascadeTerminateToConfigurations":{"default":[],"description":"A list of debug sessions which, when this debug session is terminated, will also be stopped.","items":{"type":"string","uniqueItems":true},"type":"array"},"console":{"default":"internalConsole","description":"Where to launch the debug target.","enum":["internalConsole","integratedTerminal","externalTerminal"],"enumDescriptions":["VS Code Debug Console (which doesn't support to read input from a program)","VS Code's integrated terminal","External terminal that can be configured via user settings"],"type":"string"},"customDescriptionGenerator":{"description":"Customize the textual description the debugger shows for objects (local variables, etc...). Samples:\n 1. this.toString() // will call toString to print all objects\n 2. this.customDescription ? this.customDescription() : defaultValue // Use customDescription method if available, if not return defaultValue\n 3. function (def) { return this.customDescription ? this.customDescription() : def } // Use customDescription method if available, if not return defaultValue\n ","type":"string"},"customPropertiesGenerator":{"deprecated":true,"description":"Customize the properties shown for an object in the debugger (local variables, etc...). Samples:\n 1. { ...this, extraProperty: '12345' } // Add an extraProperty 12345 to all objects\n 2. this.customProperties ? this.customProperties() : this // Use customProperties method if available, if not use the properties in this (the default properties)\n 3. function () { return this.customProperties ? this.customProperties() : this } // Use customDescription method if available, if not return the default properties\n\n Deprecated: This is a temporary implementation of this feature until we have time to implement it in the way described here: https://github.com/microsoft/vscode/issues/102181","type":"string"},"cwd":{"default":"${workspaceFolder}","description":"Absolute path to the working directory of the program being debugged. If you've set localRoot then cwd will match that value otherwise it falls back to your workspaceFolder","type":"string"},"enableContentValidation":{"default":true,"description":"Toggles whether we verify the contents of files on disk match the ones loaded in the runtime. This is useful in a variety of scenarios and required in some, but can cause issues if you have server-side transformation of scripts, for example.","type":"boolean"},"env":{"additionalProperties":{"type":["string","null"]},"default":{},"markdownDescription":"Environment variables passed to the program. The value `null` removes the variable from the environment.","type":"object"},"envFile":{"default":"${workspaceFolder}/.env","description":"Absolute path to a file containing environment variable definitions.","type":"string"},"killBehavior":{"default":"forceful","enum":["forceful","polite","none"],"markdownDescription":"Configures how debug processes are killed when stopping the session. Can be:\n\n- forceful (default): forcefully tears down the process tree. Sends SIGKILL on posix, or `taskkill.exe /F` on Windows.\n- polite: gracefully tears down the process tree. It's possible that misbehaving processes continue to run after shutdown in this way. Sends SIGTERM on posix, or `taskkill.exe` with no `/F` (force) flag on Windows.\n- none: no termination will happen.","type":"string"},"localRoot":{"default":null,"description":"Path to the local directory containing the program.","type":["string","null"]},"nodeVersionHint":{"default":12,"description":"Allows you to explicitly specify the Node version that's running, which can be used to disable or enable certain behaviors in cases where the automatic version detection does not work.","minimum":8,"type":"number"},"outFiles":{"default":["${workspaceFolder}/**/*.js","!**/node_modules/**"],"description":"If source maps are enabled, these glob patterns specify the generated JavaScript files. If a pattern starts with `!` the files are excluded. If not specified, the generated code is expected in the same directory as its source.","items":{"type":"string"},"type":["array"]},"outputCapture":{"default":"console","enum":["console","std"],"markdownDescription":"From where to capture output messages: the default debug API if set to `console`, or stdout/stderr streams if set to `std`."},"pauseForSourceMap":{"default":false,"markdownDescription":"Whether to wait for source maps to load for each incoming script. This has a performance overhead, and might be safely disabled when running off of disk, so long as `rootPath` is not disabled.","type":"boolean"},"profileStartup":{"default":true,"description":"If true, will start profiling as soon as the process launches","type":"boolean"},"program":{"default":"","description":"Absolute path to the program. Generated value is guessed by looking at package.json and opened files. Edit this attribute.","type":"string"},"remoteRoot":{"default":null,"description":"Absolute path to the remote directory containing the program.","type":["string","null"]},"resolveSourceMapLocations":{"default":["${workspaceFolder}/**","!**/node_modules/**"],"description":"A list of minimatch patterns for locations (folders and URLs) in which source maps can be used to resolve local files. This can be used to avoid incorrectly breaking in external source mapped code. Patterns can be prefixed with \"!\" to exclude them. May be set to an empty array or null to avoid restriction.","items":{"type":"string"},"type":["array","null"]},"restart":{"default":true,"description":"Try to reconnect to the program if we lose connection. If set to `true`, we'll try once a second, forever. You can customize the interval and maximum number of attempts by specifying the `delay` and `maxAttempts` in an object instead.","oneOf":[{"type":"boolean"},{"properties":{"delay":{"default":1000,"minimum":0,"type":"number"},"maxAttempts":{"default":10,"minimum":0,"type":"number"}},"type":"object"}]},"runtimeArgs":{"default":[],"description":"Optional arguments passed to the runtime executable.","items":{"type":"string"},"type":"array"},"runtimeExecutable":{"default":"node","markdownDescription":"Runtime to use. Either an absolute path or the name of a runtime available on the PATH. If omitted `node` is assumed.","type":["string","null"]},"runtimeSourcemapPausePatterns":{"default":[],"items":{"type":"string"},"markdownDescription":"A list of patterns at which to manually insert entrypoint breakpoints. This can be useful to give the debugger an opportunity to set breakpoints when using sourcemaps that don't exist or can't be detected before launch, such as [with the Serverless framework](https://github.com/microsoft/vscode-js-debug/issues/492).","type":"array"},"runtimeVersion":{"default":"default","markdownDescription":"Version of `node` runtime to use. Requires `nvm`.","type":"string"},"showAsyncStacks":{"default":true,"description":"Show the async calls that led to the current call stack.","oneOf":[{"type":"boolean"},{"properties":{"onAttach":{"default":32,"type":"number"}},"required":["onAttach"],"type":"object"},{"properties":{"onceBreakpointResolved":{"default":32,"type":"number"}},"required":["onceBreakpointResolved"],"type":"object"}]},"skipFiles":{"default":["/**"],"description":"An array of file or folder names, or path globs, to skip when debugging. Star patterns and negations are allowed, for example, `[\"**/node_modules/**\", \"!**/node_modules/my-module/**\"]`","type":"array"},"smartStep":{"default":true,"description":"Automatically step through generated code that cannot be mapped back to the original source.","type":"boolean"},"sourceMapPathOverrides":{"default":{"meteor://💻app/*":"${workspaceFolder}/*","webpack:///./~/*":"${workspaceFolder}/node_modules/*","webpack://?:*/*":"${workspaceFolder}/*"},"description":"A set of mappings for rewriting the locations of source files from what the sourcemap says, to their locations on disk.","type":"object"},"sourceMapRenames":{"default":true,"description":"Whether to use the \"names\" mapping in sourcemaps. This requires requesting source content, which can be slow with certain debuggers.","type":"boolean"},"sourceMaps":{"default":true,"description":"Use JavaScript source maps (if they exist).","type":"boolean"},"stopOnEntry":{"default":true,"description":"Automatically stop program after launch.","type":["boolean","string"]},"timeout":{"default":10000,"description":"Retry for this number of milliseconds to connect to Node.js. Default is 10000 ms.","type":"number"},"timeouts":{"additionalProperties":false,"default":{},"description":"Timeouts for several debugger operations.","markdownDescription":"Timeouts for several debugger operations.","properties":{"hoverEvaluation":{"default":500,"description":"Time until value evaluation for hovered symbols is aborted. If set to 0, hover evaluation does never time out.","type":"number"},"sourceMapCumulativePause":{"default":1000,"description":"Extra time in milliseconds allowed per session to be spent waiting for source-maps to be processed, after the minimum time (sourceMapMinPause) has been exhausted","type":"number"},"sourceMapMinPause":{"default":1000,"description":"Minimum time in milliseconds spent waiting for each source-map to be processed when a script is being parsed","type":"number"}},"type":"object"},"trace":{"default":true,"description":"Configures what diagnostic output is produced.","oneOf":[{"description":"Trace may be set to 'true' to write diagnostic logs to the disk.","type":"boolean"},{"additionalProperties":false,"properties":{"logFile":{"description":"Configures where on disk logs are written.","type":["string","null"]},"stdio":{"description":"Whether to return trace data from the launched application or browser.","type":"boolean"}},"type":"object"}]}},"type":"object"},{"additionalProperties":false,"default":{"program":"npm start"},"description":"JavaScript Debug Terminal","properties":{"autoAttachChildProcesses":{"default":true,"description":"Attach debugger to new child processes automatically.","type":"boolean"},"cascadeTerminateToConfigurations":{"default":[],"description":"A list of debug sessions which, when this debug session is terminated, will also be stopped.","items":{"type":"string","uniqueItems":true},"type":"array"},"command":{"default":"npm start","description":"Command to run in the launched terminal. If not provided, the terminal will open without launching a program.","type":["string","null"]},"customDescriptionGenerator":{"description":"Customize the textual description the debugger shows for objects (local variables, etc...). Samples:\n 1. this.toString() // will call toString to print all objects\n 2. this.customDescription ? this.customDescription() : defaultValue // Use customDescription method if available, if not return defaultValue\n 3. function (def) { return this.customDescription ? this.customDescription() : def } // Use customDescription method if available, if not return defaultValue\n ","type":"string"},"customPropertiesGenerator":{"deprecated":true,"description":"Customize the properties shown for an object in the debugger (local variables, etc...). Samples:\n 1. { ...this, extraProperty: '12345' } // Add an extraProperty 12345 to all objects\n 2. this.customProperties ? this.customProperties() : this // Use customProperties method if available, if not use the properties in this (the default properties)\n 3. function () { return this.customProperties ? this.customProperties() : this } // Use customDescription method if available, if not return the default properties\n\n Deprecated: This is a temporary implementation of this feature until we have time to implement it in the way described here: https://github.com/microsoft/vscode/issues/102181","type":"string"},"cwd":{"default":"${workspaceFolder}","description":"Absolute path to the working directory of the program being debugged. If you've set localRoot then cwd will match that value otherwise it falls back to your workspaceFolder","docDefault":"localRoot || ${workspaceFolder}","type":"string"},"enableContentValidation":{"default":true,"description":"Toggles whether we verify the contents of files on disk match the ones loaded in the runtime. This is useful in a variety of scenarios and required in some, but can cause issues if you have server-side transformation of scripts, for example.","type":"boolean"},"env":{"additionalProperties":{"type":["string","null"]},"default":{},"markdownDescription":"Environment variables passed to the program. The value `null` removes the variable from the environment.","type":"object"},"envFile":{"default":"${workspaceFolder}/.env","description":"Absolute path to a file containing environment variable definitions.","type":"string"},"localRoot":{"default":null,"description":"Path to the local directory containing the program.","type":["string","null"]},"nodeVersionHint":{"default":12,"description":"Allows you to explicitly specify the Node version that's running, which can be used to disable or enable certain behaviors in cases where the automatic version detection does not work.","minimum":8,"type":"number"},"outFiles":{"default":["${workspaceFolder}/**/*.js","!**/node_modules/**"],"description":"If source maps are enabled, these glob patterns specify the generated JavaScript files. If a pattern starts with `!` the files are excluded. If not specified, the generated code is expected in the same directory as its source.","items":{"type":"string"},"type":["array"]},"outputCapture":{"default":"console","enum":["console","std"],"markdownDescription":"From where to capture output messages: the default debug API if set to `console`, or stdout/stderr streams if set to `std`."},"pauseForSourceMap":{"default":false,"markdownDescription":"Whether to wait for source maps to load for each incoming script. This has a performance overhead, and might be safely disabled when running off of disk, so long as `rootPath` is not disabled.","type":"boolean"},"remoteRoot":{"default":null,"description":"Absolute path to the remote directory containing the program.","type":["string","null"]},"resolveSourceMapLocations":{"default":["${workspaceFolder}/**","!**/node_modules/**"],"description":"A list of minimatch patterns for locations (folders and URLs) in which source maps can be used to resolve local files. This can be used to avoid incorrectly breaking in external source mapped code. Patterns can be prefixed with \"!\" to exclude them. May be set to an empty array or null to avoid restriction.","items":{"type":"string"},"type":["array","null"]},"runtimeSourcemapPausePatterns":{"default":[],"items":{"type":"string"},"markdownDescription":"A list of patterns at which to manually insert entrypoint breakpoints. This can be useful to give the debugger an opportunity to set breakpoints when using sourcemaps that don't exist or can't be detected before launch, such as [with the Serverless framework](https://github.com/microsoft/vscode-js-debug/issues/492).","type":"array"},"showAsyncStacks":{"default":true,"description":"Show the async calls that led to the current call stack.","oneOf":[{"type":"boolean"},{"properties":{"onAttach":{"default":32,"type":"number"}},"required":["onAttach"],"type":"object"},{"properties":{"onceBreakpointResolved":{"default":32,"type":"number"}},"required":["onceBreakpointResolved"],"type":"object"}]},"skipFiles":{"default":["/**"],"description":"An array of file or folder names, or path globs, to skip when debugging. Star patterns and negations are allowed, for example, `[\"**/node_modules/**\", \"!**/node_modules/my-module/**\"]`","type":"array"},"smartStep":{"default":true,"description":"Automatically step through generated code that cannot be mapped back to the original source.","type":"boolean"},"sourceMapPathOverrides":{"default":{"meteor://💻app/*":"${workspaceFolder}/*","webpack:///./~/*":"${workspaceFolder}/node_modules/*","webpack://?:*/*":"${workspaceFolder}/*"},"description":"A set of mappings for rewriting the locations of source files from what the sourcemap says, to their locations on disk.","type":"object"},"sourceMapRenames":{"default":true,"description":"Whether to use the \"names\" mapping in sourcemaps. This requires requesting source content, which can be slow with certain debuggers.","type":"boolean"},"sourceMaps":{"default":true,"description":"Use JavaScript source maps (if they exist).","type":"boolean"},"timeout":{"default":10000,"description":"Retry for this number of milliseconds to connect to Node.js. Default is 10000 ms.","type":"number"},"timeouts":{"additionalProperties":false,"default":{},"description":"Timeouts for several debugger operations.","markdownDescription":"Timeouts for several debugger operations.","properties":{"hoverEvaluation":{"default":500,"description":"Time until value evaluation for hovered symbols is aborted. If set to 0, hover evaluation does never time out.","type":"number"},"sourceMapCumulativePause":{"default":1000,"description":"Extra time in milliseconds allowed per session to be spent waiting for source-maps to be processed, after the minimum time (sourceMapMinPause) has been exhausted","type":"number"},"sourceMapMinPause":{"default":1000,"description":"Minimum time in milliseconds spent waiting for each source-map to be processed when a script is being parsed","type":"number"}},"type":"object"},"trace":{"default":true,"description":"Configures what diagnostic output is produced.","oneOf":[{"description":"Trace may be set to 'true' to write diagnostic logs to the disk.","type":"boolean"},{"additionalProperties":false,"properties":{"logFile":{"description":"Configures where on disk logs are written.","type":["string","null"]},"stdio":{"description":"Whether to return trace data from the launched application or browser.","type":"boolean"}},"type":"object"}]}},"type":"object"}]},"showAsyncStacks":{"default":true,"description":"Show the async calls that led to the current call stack.","oneOf":[{"type":"boolean"},{"properties":{"onAttach":{"default":32,"type":"number"}},"required":["onAttach"],"type":"object"},{"properties":{"onceBreakpointResolved":{"default":32,"type":"number"}},"required":["onceBreakpointResolved"],"type":"object"}]},"skipFiles":{"default":["/**"],"description":"An array of file or folder names, or path globs, to skip when debugging. Star patterns and negations are allowed, for example, `[\"**/node_modules/**\", \"!**/node_modules/my-module/**\"]`","type":"array"},"smartStep":{"default":true,"description":"Automatically step through generated code that cannot be mapped back to the original source.","type":"boolean"},"sourceMapPathOverrides":{"default":{"meteor://💻app/*":"${workspaceFolder}/*","webpack:///./~/*":"${workspaceFolder}/node_modules/*","webpack://?:*/*":"${workspaceFolder}/*"},"description":"A set of mappings for rewriting the locations of source files from what the sourcemap says, to their locations on disk.","type":"object"},"sourceMapRenames":{"default":true,"description":"Whether to use the \"names\" mapping in sourcemaps. This requires requesting source content, which can be slow with certain debuggers.","type":"boolean"},"sourceMaps":{"default":true,"description":"Use JavaScript source maps (if they exist).","type":"boolean"},"timeout":{"default":10000,"description":"Retry for this number of milliseconds to connect to Node.js. Default is 10000 ms.","type":"number"},"timeouts":{"additionalProperties":false,"default":{},"description":"Timeouts for several debugger operations.","markdownDescription":"Timeouts for several debugger operations.","properties":{"hoverEvaluation":{"default":500,"description":"Time until value evaluation for hovered symbols is aborted. If set to 0, hover evaluation does never time out.","type":"number"},"sourceMapCumulativePause":{"default":1000,"description":"Extra time in milliseconds allowed per session to be spent waiting for source-maps to be processed, after the minimum time (sourceMapMinPause) has been exhausted","type":"number"},"sourceMapMinPause":{"default":1000,"description":"Minimum time in milliseconds spent waiting for each source-map to be processed when a script is being parsed","type":"number"}},"type":"object"},"trace":{"default":true,"description":"Configures what diagnostic output is produced.","oneOf":[{"description":"Trace may be set to 'true' to write diagnostic logs to the disk.","type":"boolean"},{"additionalProperties":false,"properties":{"logFile":{"description":"Configures where on disk logs are written.","type":["string","null"]},"stdio":{"description":"Whether to return trace data from the launched application or browser.","type":"boolean"}},"type":"object"}]},"url":{"default":"http://localhost:8080","description":"Will search for a tab with this exact url and attach to it, if found","type":"string"},"urlFilter":{"default":"","description":"Will search for a page with this url and attach to it, if found. Can have * wildcards.","type":"string"},"useWebView":{"default":false,"description":"When 'true', the debugger will treat the runtime executable as a host application that contains a WebView allowing you to debug the WebView script content.","type":"boolean"},"userDataDir":{"default":true,"description":"By default, the browser is launched with a separate user profile in a temp folder. Use this option to override it. Set to false to launch with your default user profile. A new browser can't be launched if an instance is already running from `userDataDir`.","type":["string","boolean"]},"vueComponentPaths":{"default":["${workspaceFolder}/**/*.vue"],"description":"A list of file glob patterns to find `*.vue` components. By default, searches the entire workspace. This needs to be specified due to extra lookups that Vue's sourcemaps require in Vue CLI 4. You can disable this special handling by setting this to an empty array.","type":"array"},"webRoot":{"default":"${workspaceFolder}","description":"This specifies the workspace absolute path to the webserver root. Used to resolve paths like `/app.js` to files on disk. Shorthand for a pathMapping for \"/\"","type":"string"}}}},"configurationSnippets":[{"body":{"name":"Launch Edge","request":"launch","type":"msedge","url":"http://localhost:8080","webRoot":"^\"${2:\\${workspaceFolder\\}}\""},"description":"Launch Edge to debug a URL","label":"Edge: Launch"},{"body":{"name":"Attach to Edge","port":9222,"request":"attach","type":"msedge","webRoot":"^\"${2:\\${workspaceFolder\\}}\""},"description":"Attach to an instance of Edge already in debug mode","label":"Edge: Attach"}],"label":"Web App (Edge)","strings":{"unverifiedBreakpoints":"Some of your breakpoints could not be set. If you're having an issue, you can [troubleshoot your launch configuration](command:extension.js-debug.createDiagnostics)."},"type":"msedge"}],"commands":[{"command":"extension.js-debug.prettyPrint","title":"Pretty print for debugging","category":"Debug","icon":"$(json)"},{"command":"extension.js-debug.toggleSkippingFile","title":"Toggle Skipping this File","category":"Debug"},{"command":"extension.js-debug.addCustomBreakpoints","title":"Add Browser Breakpoint","icon":"$(add)"},{"command":"extension.js-debug.removeCustomBreakpoint","title":"Remove Browser Breakpoint","icon":"$(remove)"},{"command":"extension.js-debug.removeAllCustomBreakpoints","title":"Remove All Browser Breakpoints","icon":"$(close-all)"},{"command":"extension.pwa-node-debug.attachNodeProcess","title":"Attach to Node Process","category":"Debug"},{"command":"extension.js-debug.npmScript","title":"Debug npm Script","category":"Debug"},{"command":"extension.js-debug.createDebuggerTerminal","title":"JavaScript Debug Terminal","category":"Debug"},{"command":"extension.js-debug.startProfile","title":"Take Performance Profile","category":"Debug","icon":"$(record)"},{"command":"extension.js-debug.stopProfile","title":"Stop Performance Profile","category":"Debug","icon":"resources/dark/stop-profiling.svg"},{"command":"extension.js-debug.revealPage","title":"Focus Tab","category":"Debug"},{"command":"extension.js-debug.debugLink","title":"Open Link","category":"Debug"},{"command":"extension.js-debug.createDiagnostics","title":"Diagnose Breakpoint Problems","category":"Debug"},{"command":"extension.js-debug.getDiagnosticLogs","title":"Save Diagnostic JS Debug Logs","category":"Debug"},{"command":"extension.node-debug.startWithStopOnEntry","title":"Start Debugging and Stop on Entry","category":"Debug"},{"command":"extension.js-debug.openEdgeDevTools","title":"Open Browser Devtools","icon":"$(inspect)","category":"Debug"},{"command":"extension.js-debug.callers.add","title":"Exclude Caller","category":"Debug"},{"command":"extension.js-debug.callers.remove","title":"Remove excluded caller","icon":"$(close)"},{"command":"extension.js-debug.callers.removeAll","title":"Remove all excluded callers","icon":"$(clear-all)"},{"command":"extension.js-debug.callers.goToCaller","title":"Go to caller location","icon":"$(call-outgoing)"},{"command":"extension.js-debug.callers.gotToTarget","title":"Go to target location","icon":"$(call-incoming)"},{"command":"extension.js-debug.enableSourceMapStepping","title":"Enable Source Mapped Stepping","icon":"$(compass-dot)"},{"command":"extension.js-debug.disableSourceMapStepping","title":"Disable Source Mapped Stepping","icon":"$(compass)"}],"keybindings":[{"command":"extension.node-debug.startWithStopOnEntry","key":"F10","mac":"F10","when":"debugConfigurationType == pwa-node && !inDebugMode || debugConfigurationType == pwa-extensionHost && !inDebugMode || debugConfigurationType == node && !inDebugMode"},{"command":"extension.node-debug.startWithStopOnEntry","key":"F11","mac":"F11","when":"debugConfigurationType == pwa-node && !inDebugMode && activeViewlet == workbench.view.debug || debugConfigurationType == pwa-extensionHost && !inDebugMode && activeViewlet == workbench.view.debug || debugConfigurationType == node && !inDebugMode && activeViewlet == workbench.view.debug"}],"configuration":{"title":"JavaScript Debugger","properties":{"debug.javascript.codelens.npmScripts":{"enum":["top","all","never"],"default":"top","description":"Where a \"Run\" and \"Debug\" code lens should be shown in your npm scripts. It may be on \"all\", scripts, on \"top\" of the script section, or \"never\"."},"debug.javascript.terminalOptions":{"type":"object","description":"Default launch options for the JavaScript debug terminal and npm scripts.","default":{},"properties":{"resolveSourceMapLocations":{"type":["array","null"],"description":"A list of minimatch patterns for locations (folders and URLs) in which source maps can be used to resolve local files. This can be used to avoid incorrectly breaking in external source mapped code. Patterns can be prefixed with \"!\" to exclude them. May be set to an empty array or null to avoid restriction.","default":["${workspaceFolder}/**","!**/node_modules/**"],"items":{"type":"string"}},"outFiles":{"type":["array"],"description":"If source maps are enabled, these glob patterns specify the generated JavaScript files. If a pattern starts with `!` the files are excluded. If not specified, the generated code is expected in the same directory as its source.","default":["${workspaceFolder}/**/*.js","!**/node_modules/**"],"items":{"type":"string"}},"pauseForSourceMap":{"type":"boolean","markdownDescription":"Whether to wait for source maps to load for each incoming script. This has a performance overhead, and might be safely disabled when running off of disk, so long as `rootPath` is not disabled.","default":false},"showAsyncStacks":{"description":"Show the async calls that led to the current call stack.","default":true,"oneOf":[{"type":"boolean"},{"type":"object","required":["onAttach"],"properties":{"onAttach":{"type":"number","default":32}}},{"type":"object","required":["onceBreakpointResolved"],"properties":{"onceBreakpointResolved":{"type":"number","default":32}}}]},"skipFiles":{"type":"array","description":"An array of file or folder names, or path globs, to skip when debugging. Star patterns and negations are allowed, for example, `[\"**/node_modules/**\", \"!**/node_modules/my-module/**\"]`","default":["/**"]},"smartStep":{"type":"boolean","description":"Automatically step through generated code that cannot be mapped back to the original source.","default":true},"sourceMaps":{"type":"boolean","description":"Use JavaScript source maps (if they exist).","default":true},"sourceMapRenames":{"type":"boolean","default":true,"description":"Whether to use the \"names\" mapping in sourcemaps. This requires requesting source content, which can be slow with certain debuggers."},"sourceMapPathOverrides":{"type":"object","description":"A set of mappings for rewriting the locations of source files from what the sourcemap says, to their locations on disk.","default":{"webpack://?:*/*":"${workspaceFolder}/*","webpack:///./~/*":"${workspaceFolder}/node_modules/*","meteor://💻app/*":"${workspaceFolder}/*"}},"timeout":{"type":"number","description":"Retry for this number of milliseconds to connect to Node.js. Default is 10000 ms.","default":10000},"timeouts":{"type":"object","description":"Timeouts for several debugger operations.","default":{},"properties":{"sourceMapMinPause":{"type":"number","description":"Minimum time in milliseconds spent waiting for each source-map to be processed when a script is being parsed","default":1000},"sourceMapCumulativePause":{"type":"number","description":"Extra time in milliseconds allowed per session to be spent waiting for source-maps to be processed, after the minimum time (sourceMapMinPause) has been exhausted","default":1000},"hoverEvaluation":{"type":"number","description":"Time until value evaluation for hovered symbols is aborted. If set to 0, hover evaluation does never time out.","default":500}},"additionalProperties":false,"markdownDescription":"Timeouts for several debugger operations."},"trace":{"description":"Configures what diagnostic output is produced.","default":true,"oneOf":[{"type":"boolean","description":"Trace may be set to 'true' to write diagnostic logs to the disk."},{"type":"object","additionalProperties":false,"properties":{"stdio":{"type":"boolean","description":"Whether to return trace data from the launched application or browser."},"logFile":{"type":["string","null"],"description":"Configures where on disk logs are written."}}}]},"outputCapture":{"enum":["console","std"],"markdownDescription":"From where to capture output messages: the default debug API if set to `console`, or stdout/stderr streams if set to `std`.","default":"console"},"enableContentValidation":{"default":true,"type":"boolean","description":"Toggles whether we verify the contents of files on disk match the ones loaded in the runtime. This is useful in a variety of scenarios and required in some, but can cause issues if you have server-side transformation of scripts, for example."},"customDescriptionGenerator":{"type":"string","description":"Customize the textual description the debugger shows for objects (local variables, etc...). Samples:\n 1. this.toString() // will call toString to print all objects\n 2. this.customDescription ? this.customDescription() : defaultValue // Use customDescription method if available, if not return defaultValue\n 3. function (def) { return this.customDescription ? this.customDescription() : def } // Use customDescription method if available, if not return defaultValue\n "},"customPropertiesGenerator":{"type":"string","deprecated":true,"description":"Customize the properties shown for an object in the debugger (local variables, etc...). Samples:\n 1. { ...this, extraProperty: '12345' } // Add an extraProperty 12345 to all objects\n 2. this.customProperties ? this.customProperties() : this // Use customProperties method if available, if not use the properties in this (the default properties)\n 3. function () { return this.customProperties ? this.customProperties() : this } // Use customDescription method if available, if not return the default properties\n\n Deprecated: This is a temporary implementation of this feature until we have time to implement it in the way described here: https://github.com/microsoft/vscode/issues/102181"},"cascadeTerminateToConfigurations":{"type":"array","items":{"type":"string","uniqueItems":true},"default":[],"description":"A list of debug sessions which, when this debug session is terminated, will also be stopped."},"cwd":{"type":"string","description":"Absolute path to the working directory of the program being debugged. If you've set localRoot then cwd will match that value otherwise it falls back to your workspaceFolder","default":"${workspaceFolder}","docDefault":"localRoot || ${workspaceFolder}"},"localRoot":{"type":["string","null"],"description":"Path to the local directory containing the program.","default":null},"remoteRoot":{"type":["string","null"],"description":"Absolute path to the remote directory containing the program.","default":null},"autoAttachChildProcesses":{"type":"boolean","description":"Attach debugger to new child processes automatically.","default":true},"env":{"type":"object","additionalProperties":{"type":["string","null"]},"markdownDescription":"Environment variables passed to the program. The value `null` removes the variable from the environment.","default":{}},"envFile":{"type":"string","description":"Absolute path to a file containing environment variable definitions.","default":"${workspaceFolder}/.env"},"runtimeSourcemapPausePatterns":{"type":"array","items":{"type":"string"},"markdownDescription":"A list of patterns at which to manually insert entrypoint breakpoints. This can be useful to give the debugger an opportunity to set breakpoints when using sourcemaps that don't exist or can't be detected before launch, such as [with the Serverless framework](https://github.com/microsoft/vscode-js-debug/issues/492).","default":[]},"nodeVersionHint":{"type":"number","minimum":8,"description":"Allows you to explicitly specify the Node version that's running, which can be used to disable or enable certain behaviors in cases where the automatic version detection does not work.","default":12},"command":{"type":["string","null"],"description":"Command to run in the launched terminal. If not provided, the terminal will open without launching a program.","default":"npm start"}}},"debug.javascript.automaticallyTunnelRemoteServer":{"type":"boolean","description":"When debugging a remote web app, configures whether to automatically tunnel the remote server to your local machine.","default":true},"debug.javascript.debugByLinkOptions":{"default":"on","description":"Options used when debugging open links clicked from inside the JavaScript Debug Terminal. Can be set to \"off\" to disable this behavior, or \"always\" to enable debugging in all terminals.","oneOf":[{"type":"string","enum":["on","off","always"]},{"type":"object","properties":{"resolveSourceMapLocations":{"type":["array","null"],"description":"A list of minimatch patterns for locations (folders and URLs) in which source maps can be used to resolve local files. This can be used to avoid incorrectly breaking in external source mapped code. Patterns can be prefixed with \"!\" to exclude them. May be set to an empty array or null to avoid restriction.","default":null,"items":{"type":"string"}},"outFiles":{"type":["array"],"description":"If source maps are enabled, these glob patterns specify the generated JavaScript files. If a pattern starts with `!` the files are excluded. If not specified, the generated code is expected in the same directory as its source.","default":["${workspaceFolder}/**/*.js","!**/node_modules/**"],"items":{"type":"string"}},"pauseForSourceMap":{"type":"boolean","markdownDescription":"Whether to wait for source maps to load for each incoming script. This has a performance overhead, and might be safely disabled when running off of disk, so long as `rootPath` is not disabled.","default":false},"showAsyncStacks":{"description":"Show the async calls that led to the current call stack.","default":true,"oneOf":[{"type":"boolean"},{"type":"object","required":["onAttach"],"properties":{"onAttach":{"type":"number","default":32}}},{"type":"object","required":["onceBreakpointResolved"],"properties":{"onceBreakpointResolved":{"type":"number","default":32}}}]},"skipFiles":{"type":"array","description":"An array of file or folder names, or path globs, to skip when debugging. Star patterns and negations are allowed, for example, `[\"**/node_modules/**\", \"!**/node_modules/my-module/**\"]`","default":["/**"]},"smartStep":{"type":"boolean","description":"Automatically step through generated code that cannot be mapped back to the original source.","default":true},"sourceMaps":{"type":"boolean","description":"Use JavaScript source maps (if they exist).","default":true},"sourceMapRenames":{"type":"boolean","default":true,"description":"Whether to use the \"names\" mapping in sourcemaps. This requires requesting source content, which can be slow with certain debuggers."},"sourceMapPathOverrides":{"type":"object","description":"A set of mappings for rewriting the locations of source files from what the sourcemap says, to their locations on disk.","default":{"webpack://?:*/*":"${workspaceFolder}/*","webpack:///./~/*":"${workspaceFolder}/node_modules/*","meteor://💻app/*":"${workspaceFolder}/*"}},"timeout":{"type":"number","description":"Retry for this number of milliseconds to connect to Node.js. Default is 10000 ms.","default":10000},"timeouts":{"type":"object","description":"Timeouts for several debugger operations.","default":{},"properties":{"sourceMapMinPause":{"type":"number","description":"Minimum time in milliseconds spent waiting for each source-map to be processed when a script is being parsed","default":1000},"sourceMapCumulativePause":{"type":"number","description":"Extra time in milliseconds allowed per session to be spent waiting for source-maps to be processed, after the minimum time (sourceMapMinPause) has been exhausted","default":1000},"hoverEvaluation":{"type":"number","description":"Time until value evaluation for hovered symbols is aborted. If set to 0, hover evaluation does never time out.","default":500}},"additionalProperties":false,"markdownDescription":"Timeouts for several debugger operations."},"trace":{"description":"Configures what diagnostic output is produced.","default":true,"oneOf":[{"type":"boolean","description":"Trace may be set to 'true' to write diagnostic logs to the disk."},{"type":"object","additionalProperties":false,"properties":{"stdio":{"type":"boolean","description":"Whether to return trace data from the launched application or browser."},"logFile":{"type":["string","null"],"description":"Configures where on disk logs are written."}}}]},"outputCapture":{"enum":["console","std"],"markdownDescription":"From where to capture output messages: the default debug API if set to `console`, or stdout/stderr streams if set to `std`.","default":"console"},"enableContentValidation":{"default":true,"type":"boolean","description":"Toggles whether we verify the contents of files on disk match the ones loaded in the runtime. This is useful in a variety of scenarios and required in some, but can cause issues if you have server-side transformation of scripts, for example."},"customDescriptionGenerator":{"type":"string","description":"Customize the textual description the debugger shows for objects (local variables, etc...). Samples:\n 1. this.toString() // will call toString to print all objects\n 2. this.customDescription ? this.customDescription() : defaultValue // Use customDescription method if available, if not return defaultValue\n 3. function (def) { return this.customDescription ? this.customDescription() : def } // Use customDescription method if available, if not return defaultValue\n "},"customPropertiesGenerator":{"type":"string","deprecated":true,"description":"Customize the properties shown for an object in the debugger (local variables, etc...). Samples:\n 1. { ...this, extraProperty: '12345' } // Add an extraProperty 12345 to all objects\n 2. this.customProperties ? this.customProperties() : this // Use customProperties method if available, if not use the properties in this (the default properties)\n 3. function () { return this.customProperties ? this.customProperties() : this } // Use customDescription method if available, if not return the default properties\n\n Deprecated: This is a temporary implementation of this feature until we have time to implement it in the way described here: https://github.com/microsoft/vscode/issues/102181"},"cascadeTerminateToConfigurations":{"type":"array","items":{"type":"string","uniqueItems":true},"default":[],"description":"A list of debug sessions which, when this debug session is terminated, will also be stopped."},"disableNetworkCache":{"type":"boolean","description":"Controls whether to skip the network cache for each request","default":true},"pathMapping":{"type":"object","description":"A mapping of URLs/paths to local folders, to resolve scripts in the Browser to scripts on disk","default":{}},"webRoot":{"type":"string","description":"This specifies the workspace absolute path to the webserver root. Used to resolve paths like `/app.js` to files on disk. Shorthand for a pathMapping for \"/\"","default":"${workspaceFolder}"},"urlFilter":{"type":"string","description":"Will search for a page with this url and attach to it, if found. Can have * wildcards.","default":""},"url":{"type":"string","description":"Will search for a tab with this exact url and attach to it, if found","default":"http://localhost:8080"},"inspectUri":{"type":["string","null"],"description":"Format to use to rewrite the inspectUri: It's a template string that interpolates keys in `{curlyBraces}`. Available keys are:\n - `url.*` is the parsed address of the running application. For instance, `{url.port}`, `{url.hostname}`\n - `port` is the debug port that Chrome is listening on.\n - `browserInspectUri` is the inspector URI on the launched browser\n - `browserInspectUriPath` is the path part of the inspector URI on the launched browser (e.g.: \"/devtools/browser/e9ec0098-306e-472a-8133-5e42488929c2\").\n - `wsProtocol` is the hinted websocket protocol. This is set to `wss` if the original URL is `https`, or `ws` otherwise.\n","default":null},"vueComponentPaths":{"type":"array","description":"A list of file glob patterns to find `*.vue` components. By default, searches the entire workspace. This needs to be specified due to extra lookups that Vue's sourcemaps require in Vue CLI 4. You can disable this special handling by setting this to an empty array.","default":["${workspaceFolder}/**/*.vue"]},"server":{"oneOf":[{"type":"object","description":"Configures a web server to start up. Takes the same configuration as the 'node' launch task.","additionalProperties":false,"default":{"program":"node my-server.js"},"properties":{"resolveSourceMapLocations":{"type":["array","null"],"description":"A list of minimatch patterns for locations (folders and URLs) in which source maps can be used to resolve local files. This can be used to avoid incorrectly breaking in external source mapped code. Patterns can be prefixed with \"!\" to exclude them. May be set to an empty array or null to avoid restriction.","default":["${workspaceFolder}/**","!**/node_modules/**"],"items":{"type":"string"}},"outFiles":{"type":["array"],"description":"If source maps are enabled, these glob patterns specify the generated JavaScript files. If a pattern starts with `!` the files are excluded. If not specified, the generated code is expected in the same directory as its source.","default":["${workspaceFolder}/**/*.js","!**/node_modules/**"],"items":{"type":"string"}},"pauseForSourceMap":{"type":"boolean","markdownDescription":"Whether to wait for source maps to load for each incoming script. This has a performance overhead, and might be safely disabled when running off of disk, so long as `rootPath` is not disabled.","default":false},"showAsyncStacks":{"description":"Show the async calls that led to the current call stack.","default":true,"oneOf":[{"type":"boolean"},{"type":"object","required":["onAttach"],"properties":{"onAttach":{"type":"number","default":32}}},{"type":"object","required":["onceBreakpointResolved"],"properties":{"onceBreakpointResolved":{"type":"number","default":32}}}]},"skipFiles":{"type":"array","description":"An array of file or folder names, or path globs, to skip when debugging. Star patterns and negations are allowed, for example, `[\"**/node_modules/**\", \"!**/node_modules/my-module/**\"]`","default":["/**"]},"smartStep":{"type":"boolean","description":"Automatically step through generated code that cannot be mapped back to the original source.","default":true},"sourceMaps":{"type":"boolean","description":"Use JavaScript source maps (if they exist).","default":true},"sourceMapRenames":{"type":"boolean","default":true,"description":"Whether to use the \"names\" mapping in sourcemaps. This requires requesting source content, which can be slow with certain debuggers."},"sourceMapPathOverrides":{"type":"object","description":"A set of mappings for rewriting the locations of source files from what the sourcemap says, to their locations on disk.","default":{"webpack://?:*/*":"${workspaceFolder}/*","webpack:///./~/*":"${workspaceFolder}/node_modules/*","meteor://💻app/*":"${workspaceFolder}/*"}},"timeout":{"type":"number","description":"Retry for this number of milliseconds to connect to Node.js. Default is 10000 ms.","default":10000},"timeouts":{"type":"object","description":"Timeouts for several debugger operations.","default":{},"properties":{"sourceMapMinPause":{"type":"number","description":"Minimum time in milliseconds spent waiting for each source-map to be processed when a script is being parsed","default":1000},"sourceMapCumulativePause":{"type":"number","description":"Extra time in milliseconds allowed per session to be spent waiting for source-maps to be processed, after the minimum time (sourceMapMinPause) has been exhausted","default":1000},"hoverEvaluation":{"type":"number","description":"Time until value evaluation for hovered symbols is aborted. If set to 0, hover evaluation does never time out.","default":500}},"additionalProperties":false,"markdownDescription":"Timeouts for several debugger operations."},"trace":{"description":"Configures what diagnostic output is produced.","default":true,"oneOf":[{"type":"boolean","description":"Trace may be set to 'true' to write diagnostic logs to the disk."},{"type":"object","additionalProperties":false,"properties":{"stdio":{"type":"boolean","description":"Whether to return trace data from the launched application or browser."},"logFile":{"type":["string","null"],"description":"Configures where on disk logs are written."}}}]},"outputCapture":{"enum":["console","std"],"markdownDescription":"From where to capture output messages: the default debug API if set to `console`, or stdout/stderr streams if set to `std`.","default":"console"},"enableContentValidation":{"default":true,"type":"boolean","description":"Toggles whether we verify the contents of files on disk match the ones loaded in the runtime. This is useful in a variety of scenarios and required in some, but can cause issues if you have server-side transformation of scripts, for example."},"customDescriptionGenerator":{"type":"string","description":"Customize the textual description the debugger shows for objects (local variables, etc...). Samples:\n 1. this.toString() // will call toString to print all objects\n 2. this.customDescription ? this.customDescription() : defaultValue // Use customDescription method if available, if not return defaultValue\n 3. function (def) { return this.customDescription ? this.customDescription() : def } // Use customDescription method if available, if not return defaultValue\n "},"customPropertiesGenerator":{"type":"string","deprecated":true,"description":"Customize the properties shown for an object in the debugger (local variables, etc...). Samples:\n 1. { ...this, extraProperty: '12345' } // Add an extraProperty 12345 to all objects\n 2. this.customProperties ? this.customProperties() : this // Use customProperties method if available, if not use the properties in this (the default properties)\n 3. function () { return this.customProperties ? this.customProperties() : this } // Use customDescription method if available, if not return the default properties\n\n Deprecated: This is a temporary implementation of this feature until we have time to implement it in the way described here: https://github.com/microsoft/vscode/issues/102181"},"cascadeTerminateToConfigurations":{"type":"array","items":{"type":"string","uniqueItems":true},"default":[],"description":"A list of debug sessions which, when this debug session is terminated, will also be stopped."},"cwd":{"type":"string","description":"Absolute path to the working directory of the program being debugged. If you've set localRoot then cwd will match that value otherwise it falls back to your workspaceFolder","default":"${workspaceFolder}"},"localRoot":{"type":["string","null"],"description":"Path to the local directory containing the program.","default":null},"remoteRoot":{"type":["string","null"],"description":"Absolute path to the remote directory containing the program.","default":null},"autoAttachChildProcesses":{"type":"boolean","description":"Attach debugger to new child processes automatically.","default":true},"env":{"type":"object","additionalProperties":{"type":["string","null"]},"markdownDescription":"Environment variables passed to the program. The value `null` removes the variable from the environment.","default":{}},"envFile":{"type":"string","description":"Absolute path to a file containing environment variable definitions.","default":"${workspaceFolder}/.env"},"runtimeSourcemapPausePatterns":{"type":"array","items":{"type":"string"},"markdownDescription":"A list of patterns at which to manually insert entrypoint breakpoints. This can be useful to give the debugger an opportunity to set breakpoints when using sourcemaps that don't exist or can't be detected before launch, such as [with the Serverless framework](https://github.com/microsoft/vscode-js-debug/issues/492).","default":[]},"nodeVersionHint":{"type":"number","minimum":8,"description":"Allows you to explicitly specify the Node version that's running, which can be used to disable or enable certain behaviors in cases where the automatic version detection does not work.","default":12},"program":{"type":"string","description":"Absolute path to the program. Generated value is guessed by looking at package.json and opened files. Edit this attribute.","default":""},"stopOnEntry":{"type":["boolean","string"],"description":"Automatically stop program after launch.","default":true},"console":{"type":"string","enum":["internalConsole","integratedTerminal","externalTerminal"],"enumDescriptions":["VS Code Debug Console (which doesn't support to read input from a program)","VS Code's integrated terminal","External terminal that can be configured via user settings"],"description":"Where to launch the debug target.","default":"internalConsole"},"args":{"type":["array","string"],"description":"Command line arguments passed to the program.\n\nCan be an array of strings or a single string. When the program is launched in a terminal, setting this property to a single string will result in the arguments not being escaped for the shell.","items":{"type":"string"},"default":[]},"restart":{"description":"Try to reconnect to the program if we lose connection. If set to `true`, we'll try once a second, forever. You can customize the interval and maximum number of attempts by specifying the `delay` and `maxAttempts` in an object instead.","default":true,"oneOf":[{"type":"boolean"},{"type":"object","properties":{"delay":{"type":"number","minimum":0,"default":1000},"maxAttempts":{"type":"number","minimum":0,"default":10}}}]},"runtimeExecutable":{"type":["string","null"],"markdownDescription":"Runtime to use. Either an absolute path or the name of a runtime available on the PATH. If omitted `node` is assumed.","default":"node"},"runtimeVersion":{"type":"string","markdownDescription":"Version of `node` runtime to use. Requires `nvm`.","default":"default"},"runtimeArgs":{"type":"array","description":"Optional arguments passed to the runtime executable.","items":{"type":"string"},"default":[]},"profileStartup":{"type":"boolean","description":"If true, will start profiling as soon as the process launches","default":true},"attachSimplePort":{"type":"integer","description":"If set, attaches to the process via the given port. This is generally no longer necessary for Node.js programs and loses the ability to debug child processes, but can be useful in more esoteric scenarios such as with Deno and Docker launches. If set to 0, a random port will be chosen and --inspect-brk added to the launch arguments automatically.","default":9229},"killBehavior":{"type":"string","enum":["forceful","polite","none"],"default":"forceful","markdownDescription":"Configures how debug processes are killed when stopping the session. Can be:\n\n- forceful (default): forcefully tears down the process tree. Sends SIGKILL on posix, or `taskkill.exe /F` on Windows.\n- polite: gracefully tears down the process tree. It's possible that misbehaving processes continue to run after shutdown in this way. Sends SIGTERM on posix, or `taskkill.exe` with no `/F` (force) flag on Windows.\n- none: no termination will happen."}}},{"type":"object","description":"JavaScript Debug Terminal","additionalProperties":false,"default":{"program":"npm start"},"properties":{"resolveSourceMapLocations":{"type":["array","null"],"description":"A list of minimatch patterns for locations (folders and URLs) in which source maps can be used to resolve local files. This can be used to avoid incorrectly breaking in external source mapped code. Patterns can be prefixed with \"!\" to exclude them. May be set to an empty array or null to avoid restriction.","default":["${workspaceFolder}/**","!**/node_modules/**"],"items":{"type":"string"}},"outFiles":{"type":["array"],"description":"If source maps are enabled, these glob patterns specify the generated JavaScript files. If a pattern starts with `!` the files are excluded. If not specified, the generated code is expected in the same directory as its source.","default":["${workspaceFolder}/**/*.js","!**/node_modules/**"],"items":{"type":"string"}},"pauseForSourceMap":{"type":"boolean","markdownDescription":"Whether to wait for source maps to load for each incoming script. This has a performance overhead, and might be safely disabled when running off of disk, so long as `rootPath` is not disabled.","default":false},"showAsyncStacks":{"description":"Show the async calls that led to the current call stack.","default":true,"oneOf":[{"type":"boolean"},{"type":"object","required":["onAttach"],"properties":{"onAttach":{"type":"number","default":32}}},{"type":"object","required":["onceBreakpointResolved"],"properties":{"onceBreakpointResolved":{"type":"number","default":32}}}]},"skipFiles":{"type":"array","description":"An array of file or folder names, or path globs, to skip when debugging. Star patterns and negations are allowed, for example, `[\"**/node_modules/**\", \"!**/node_modules/my-module/**\"]`","default":["/**"]},"smartStep":{"type":"boolean","description":"Automatically step through generated code that cannot be mapped back to the original source.","default":true},"sourceMaps":{"type":"boolean","description":"Use JavaScript source maps (if they exist).","default":true},"sourceMapRenames":{"type":"boolean","default":true,"description":"Whether to use the \"names\" mapping in sourcemaps. This requires requesting source content, which can be slow with certain debuggers."},"sourceMapPathOverrides":{"type":"object","description":"A set of mappings for rewriting the locations of source files from what the sourcemap says, to their locations on disk.","default":{"webpack://?:*/*":"${workspaceFolder}/*","webpack:///./~/*":"${workspaceFolder}/node_modules/*","meteor://💻app/*":"${workspaceFolder}/*"}},"timeout":{"type":"number","description":"Retry for this number of milliseconds to connect to Node.js. Default is 10000 ms.","default":10000},"timeouts":{"type":"object","description":"Timeouts for several debugger operations.","default":{},"properties":{"sourceMapMinPause":{"type":"number","description":"Minimum time in milliseconds spent waiting for each source-map to be processed when a script is being parsed","default":1000},"sourceMapCumulativePause":{"type":"number","description":"Extra time in milliseconds allowed per session to be spent waiting for source-maps to be processed, after the minimum time (sourceMapMinPause) has been exhausted","default":1000},"hoverEvaluation":{"type":"number","description":"Time until value evaluation for hovered symbols is aborted. If set to 0, hover evaluation does never time out.","default":500}},"additionalProperties":false,"markdownDescription":"Timeouts for several debugger operations."},"trace":{"description":"Configures what diagnostic output is produced.","default":true,"oneOf":[{"type":"boolean","description":"Trace may be set to 'true' to write diagnostic logs to the disk."},{"type":"object","additionalProperties":false,"properties":{"stdio":{"type":"boolean","description":"Whether to return trace data from the launched application or browser."},"logFile":{"type":["string","null"],"description":"Configures where on disk logs are written."}}}]},"outputCapture":{"enum":["console","std"],"markdownDescription":"From where to capture output messages: the default debug API if set to `console`, or stdout/stderr streams if set to `std`.","default":"console"},"enableContentValidation":{"default":true,"type":"boolean","description":"Toggles whether we verify the contents of files on disk match the ones loaded in the runtime. This is useful in a variety of scenarios and required in some, but can cause issues if you have server-side transformation of scripts, for example."},"customDescriptionGenerator":{"type":"string","description":"Customize the textual description the debugger shows for objects (local variables, etc...). Samples:\n 1. this.toString() // will call toString to print all objects\n 2. this.customDescription ? this.customDescription() : defaultValue // Use customDescription method if available, if not return defaultValue\n 3. function (def) { return this.customDescription ? this.customDescription() : def } // Use customDescription method if available, if not return defaultValue\n "},"customPropertiesGenerator":{"type":"string","deprecated":true,"description":"Customize the properties shown for an object in the debugger (local variables, etc...). Samples:\n 1. { ...this, extraProperty: '12345' } // Add an extraProperty 12345 to all objects\n 2. this.customProperties ? this.customProperties() : this // Use customProperties method if available, if not use the properties in this (the default properties)\n 3. function () { return this.customProperties ? this.customProperties() : this } // Use customDescription method if available, if not return the default properties\n\n Deprecated: This is a temporary implementation of this feature until we have time to implement it in the way described here: https://github.com/microsoft/vscode/issues/102181"},"cascadeTerminateToConfigurations":{"type":"array","items":{"type":"string","uniqueItems":true},"default":[],"description":"A list of debug sessions which, when this debug session is terminated, will also be stopped."},"cwd":{"type":"string","description":"Absolute path to the working directory of the program being debugged. If you've set localRoot then cwd will match that value otherwise it falls back to your workspaceFolder","default":"${workspaceFolder}","docDefault":"localRoot || ${workspaceFolder}"},"localRoot":{"type":["string","null"],"description":"Path to the local directory containing the program.","default":null},"remoteRoot":{"type":["string","null"],"description":"Absolute path to the remote directory containing the program.","default":null},"autoAttachChildProcesses":{"type":"boolean","description":"Attach debugger to new child processes automatically.","default":true},"env":{"type":"object","additionalProperties":{"type":["string","null"]},"markdownDescription":"Environment variables passed to the program. The value `null` removes the variable from the environment.","default":{}},"envFile":{"type":"string","description":"Absolute path to a file containing environment variable definitions.","default":"${workspaceFolder}/.env"},"runtimeSourcemapPausePatterns":{"type":"array","items":{"type":"string"},"markdownDescription":"A list of patterns at which to manually insert entrypoint breakpoints. This can be useful to give the debugger an opportunity to set breakpoints when using sourcemaps that don't exist or can't be detected before launch, such as [with the Serverless framework](https://github.com/microsoft/vscode-js-debug/issues/492).","default":[]},"nodeVersionHint":{"type":"number","minimum":8,"description":"Allows you to explicitly specify the Node version that's running, which can be used to disable or enable certain behaviors in cases where the automatic version detection does not work.","default":12},"command":{"type":["string","null"],"description":"Command to run in the launched terminal. If not provided, the terminal will open without launching a program.","default":"npm start"}}}]},"perScriptSourcemaps":{"type":"string","default":"auto","enum":["yes","no","auto"],"description":"Whether scripts are loaded individually with unique sourcemaps containing the basename of the source file. This can be set to optimize sourcemap handling when dealing with lots of small scripts. If set to \"auto\", we'll detect known cases where this is appropriate."},"port":{"type":"number","description":"Port for the browser to listen on. Defaults to \"0\", which will cause the browser to be debugged via pipes, which is generally more secure and should be chosen unless you need to attach to the browser from another tool.","default":0},"file":{"type":"string","description":"A local html file to open in the browser","default":"${workspaceFolder}/index.html"},"userDataDir":{"type":["string","boolean"],"description":"By default, the browser is launched with a separate user profile in a temp folder. Use this option to override it. Set to false to launch with your default user profile. A new browser can't be launched if an instance is already running from `userDataDir`.","default":true},"includeDefaultArgs":{"type":"boolean","description":"Whether default browser launch arguments (to disable features that may make debugging harder) will be included in the launch.","default":true},"includeLaunchArgs":{"type":"boolean","description":"Advanced: whether any default launch/debugging arguments are set on the browser. The debugger will assume the browser will use pipe debugging such as that which is provided with `--remote-debugging-pipe`.","default":true},"runtimeExecutable":{"type":["string","null"],"description":"Either 'canary', 'stable', 'custom' or path to the browser executable. Custom means a custom wrapper, custom build or CHROME_PATH environment variable.","default":"stable"},"runtimeArgs":{"type":"array","description":"Optional arguments passed to the runtime executable.","items":{"type":"string"},"default":[]},"env":{"type":"object","description":"Optional dictionary of environment key/value pairs for the browser.","default":{}},"cwd":{"type":"string","description":"Optional working directory for the runtime executable.","default":null},"profileStartup":{"type":"boolean","description":"If true, will start profiling soon as the process launches","default":true},"cleanUp":{"type":"string","enum":["wholeBrowser","onlyTab"],"description":"What clean-up to do after the debugging session finishes. Close only the tab being debug, vs. close the whole browser.","default":"wholeBrowser"},"browserLaunchLocation":{"description":"Forces the browser to be launched in one location. In a remote workspace (through ssh or WSL, for example) this can be used to open the browser on the remote machine rather than locally.","default":null,"oneOf":[{"type":"null"},{"type":"string","enum":["ui","workspace"]}]},"enabled":{"type":"string","enum":["on","off","always"]}}}]},"debug.javascript.pickAndAttachOptions":{"type":"object","default":{},"markdownDescription":"Default options used when debugging a process through the `Debug: Attach to Node.js Process` command","properties":{"resolveSourceMapLocations":{"type":["array","null"],"description":"A list of minimatch patterns for locations (folders and URLs) in which source maps can be used to resolve local files. This can be used to avoid incorrectly breaking in external source mapped code. Patterns can be prefixed with \"!\" to exclude them. May be set to an empty array or null to avoid restriction.","default":["${workspaceFolder}/**","!**/node_modules/**"],"items":{"type":"string"}},"outFiles":{"type":["array"],"description":"If source maps are enabled, these glob patterns specify the generated JavaScript files. If a pattern starts with `!` the files are excluded. If not specified, the generated code is expected in the same directory as its source.","default":["${workspaceFolder}/**/*.js","!**/node_modules/**"],"items":{"type":"string"}},"pauseForSourceMap":{"type":"boolean","markdownDescription":"Whether to wait for source maps to load for each incoming script. This has a performance overhead, and might be safely disabled when running off of disk, so long as `rootPath` is not disabled.","default":false},"showAsyncStacks":{"description":"Show the async calls that led to the current call stack.","default":true,"oneOf":[{"type":"boolean"},{"type":"object","required":["onAttach"],"properties":{"onAttach":{"type":"number","default":32}}},{"type":"object","required":["onceBreakpointResolved"],"properties":{"onceBreakpointResolved":{"type":"number","default":32}}}]},"skipFiles":{"type":"array","description":"An array of file or folder names, or path globs, to skip when debugging. Star patterns and negations are allowed, for example, `[\"**/node_modules/**\", \"!**/node_modules/my-module/**\"]`","default":["/**"]},"smartStep":{"type":"boolean","description":"Automatically step through generated code that cannot be mapped back to the original source.","default":true},"sourceMaps":{"type":"boolean","description":"Use JavaScript source maps (if they exist).","default":true},"sourceMapRenames":{"type":"boolean","default":true,"description":"Whether to use the \"names\" mapping in sourcemaps. This requires requesting source content, which can be slow with certain debuggers."},"sourceMapPathOverrides":{"type":"object","description":"A set of mappings for rewriting the locations of source files from what the sourcemap says, to their locations on disk.","default":{"webpack://?:*/*":"${workspaceFolder}/*","webpack:///./~/*":"${workspaceFolder}/node_modules/*","meteor://💻app/*":"${workspaceFolder}/*"}},"timeout":{"type":"number","description":"Retry for this number of milliseconds to connect to Node.js. Default is 10000 ms.","default":10000},"timeouts":{"type":"object","description":"Timeouts for several debugger operations.","default":{},"properties":{"sourceMapMinPause":{"type":"number","description":"Minimum time in milliseconds spent waiting for each source-map to be processed when a script is being parsed","default":1000},"sourceMapCumulativePause":{"type":"number","description":"Extra time in milliseconds allowed per session to be spent waiting for source-maps to be processed, after the minimum time (sourceMapMinPause) has been exhausted","default":1000},"hoverEvaluation":{"type":"number","description":"Time until value evaluation for hovered symbols is aborted. If set to 0, hover evaluation does never time out.","default":500}},"additionalProperties":false,"markdownDescription":"Timeouts for several debugger operations."},"trace":{"description":"Configures what diagnostic output is produced.","default":true,"oneOf":[{"type":"boolean","description":"Trace may be set to 'true' to write diagnostic logs to the disk."},{"type":"object","additionalProperties":false,"properties":{"stdio":{"type":"boolean","description":"Whether to return trace data from the launched application or browser."},"logFile":{"type":["string","null"],"description":"Configures where on disk logs are written."}}}]},"outputCapture":{"enum":["console","std"],"markdownDescription":"From where to capture output messages: the default debug API if set to `console`, or stdout/stderr streams if set to `std`.","default":"console"},"enableContentValidation":{"default":true,"type":"boolean","description":"Toggles whether we verify the contents of files on disk match the ones loaded in the runtime. This is useful in a variety of scenarios and required in some, but can cause issues if you have server-side transformation of scripts, for example."},"customDescriptionGenerator":{"type":"string","description":"Customize the textual description the debugger shows for objects (local variables, etc...). Samples:\n 1. this.toString() // will call toString to print all objects\n 2. this.customDescription ? this.customDescription() : defaultValue // Use customDescription method if available, if not return defaultValue\n 3. function (def) { return this.customDescription ? this.customDescription() : def } // Use customDescription method if available, if not return defaultValue\n "},"customPropertiesGenerator":{"type":"string","deprecated":true,"description":"Customize the properties shown for an object in the debugger (local variables, etc...). Samples:\n 1. { ...this, extraProperty: '12345' } // Add an extraProperty 12345 to all objects\n 2. this.customProperties ? this.customProperties() : this // Use customProperties method if available, if not use the properties in this (the default properties)\n 3. function () { return this.customProperties ? this.customProperties() : this } // Use customDescription method if available, if not return the default properties\n\n Deprecated: This is a temporary implementation of this feature until we have time to implement it in the way described here: https://github.com/microsoft/vscode/issues/102181"},"cascadeTerminateToConfigurations":{"type":"array","items":{"type":"string","uniqueItems":true},"default":[],"description":"A list of debug sessions which, when this debug session is terminated, will also be stopped."},"cwd":{"type":"string","description":"Absolute path to the working directory of the program being debugged. If you've set localRoot then cwd will match that value otherwise it falls back to your workspaceFolder","default":"${workspaceFolder}","docDefault":"localRoot || ${workspaceFolder}"},"localRoot":{"type":["string","null"],"description":"Path to the local directory containing the program.","default":null},"remoteRoot":{"type":["string","null"],"description":"Absolute path to the remote directory containing the program.","default":null},"autoAttachChildProcesses":{"type":"boolean","description":"Attach debugger to new child processes automatically.","default":true},"env":{"type":"object","additionalProperties":{"type":["string","null"]},"markdownDescription":"Environment variables passed to the program. The value `null` removes the variable from the environment.","default":{}},"envFile":{"type":"string","description":"Absolute path to a file containing environment variable definitions.","default":"${workspaceFolder}/.env"},"runtimeSourcemapPausePatterns":{"type":"array","items":{"type":"string"},"markdownDescription":"A list of patterns at which to manually insert entrypoint breakpoints. This can be useful to give the debugger an opportunity to set breakpoints when using sourcemaps that don't exist or can't be detected before launch, such as [with the Serverless framework](https://github.com/microsoft/vscode-js-debug/issues/492).","default":[]},"nodeVersionHint":{"type":"number","minimum":8,"description":"Allows you to explicitly specify the Node version that's running, which can be used to disable or enable certain behaviors in cases where the automatic version detection does not work.","default":12},"address":{"type":"string","description":"TCP/IP address of process to be debugged. Default is 'localhost'.","default":"localhost"},"port":{"type":"number","description":"Debug port to attach to. Default is 9229.","default":9229},"websocketAddress":{"type":"string","description":"Exact websocket address to attach to. If unspecified, it will be discovered from the address and port."},"restart":{"description":"Try to reconnect to the program if we lose connection. If set to `true`, we'll try once a second, forever. You can customize the interval and maximum number of attempts by specifying the `delay` and `maxAttempts` in an object instead.","default":true,"oneOf":[{"type":"boolean"},{"type":"object","properties":{"delay":{"type":"number","minimum":0,"default":1000},"maxAttempts":{"type":"number","minimum":0,"default":10}}}]},"processId":{"type":"string","description":"ID of process to attach to.","default":"${command:PickProcess}"},"attachExistingChildren":{"type":"boolean","description":"Whether to attempt to attach to already-spawned child processes.","default":false},"continueOnAttach":{"type":"boolean","markdownDescription":"If true, we'll automatically resume programs launched and waiting on `--inspect-brk`","default":true}}},"debug.javascript.autoAttachFilter":{"type":"string","default":"disabled","enum":["always","smart","onlyWithFlag","disabled"],"enumDescriptions":["Auto attach to every Node.js process launched in the terminal.","Auto attach when running scripts that aren't in a node_modules folder.","Only auto attach when the `--inspect` is given.","Auto attach is disabled and not shown in status bar."],"markdownDescription":"Configures which processes to automatically attach and debug when `#debug.node.autoAttach#` is on. A Node process launched with the `--inspect` flag will always be attached to, regardless of this setting."},"debug.javascript.autoAttachSmartPattern":{"type":"array","items":{"type":"string"},"default":["${workspaceFolder}/**","!**/node_modules/**","**/$KNOWN_TOOLS$/**"],"markdownDescription":"Configures glob patterns for determining when to attach in \"smart\" `#debug.javascript.autoAttachFilter#` mode. `$KNOWN_TOOLS$` is replaced with a list of names of common test and code runners. [Read more on the VS Code docs](https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_auto-attach-smart-patterns)."},"debug.javascript.breakOnConditionalError":{"type":"boolean","default":false,"markdownDescription":"Whether to stop when conditional breakpoints throw an error."},"debug.javascript.unmapMissingSources":{"type":"boolean","default":false,"description":"Configures whether sourcemapped file where the original file can't be read will automatically be unmapped. If this is false (default), a prompt is shown."},"debug.javascript.defaultRuntimeExecutable":{"type":"object","default":{"pwa-node":"node"},"markdownDescription":"The default `runtimeExecutable` used for launch configurations, if unspecified. This can be used to config custom paths to Node.js or browser installations.","properties":{"pwa-node":{"type":"string"},"pwa-chrome":{"type":"string"},"pwa-msedge":{"type":"string"}}},"debug.javascript.resourceRequestOptions":{"type":"object","default":{},"markdownDescription":"Request options to use when loading resources, such as source maps, in the debugger. You may need to configure this if your sourcemaps require authentication or use a self-signed certificate, for instance. Options are used to create a request using the [`got`](https://github.com/sindresorhus/got) library.\n\nA common case to disable certificate verification can be done by passing `{ \"https\": { \"rejectUnauthorized\": false } }`."}}},"views":{"debug":[{"id":"jsBrowserBreakpoints","name":"Browser breakpoints","when":"debugType == pwa-chrome || debugType == pwa-msedge"},{"id":"jsExcludedCallers","name":"Excluded Callers","when":"debugType == pwa-extensionHost && jsDebugHasExcludedCallers || debugType == node-terminal && jsDebugHasExcludedCallers || debugType == pwa-node && jsDebugHasExcludedCallers || debugType == pwa-chrome && jsDebugHasExcludedCallers || debugType == pwa-msedge && jsDebugHasExcludedCallers"}]},"viewsWelcome":[{"view":"debug","contents":"[JavaScript Debug Terminal](command:extension.js-debug.createDebuggerTerminal)\n\nYou can use the JavaScript Debug Terminal to debug Node.js processes run on the command line.\n\n[Debug URL](command:extension.js-debug.debugLink)","when":"debugStartLanguage == javascript && !isWeb || debugStartLanguage == typescript && !isWeb || debugStartLanguage == javascriptreact && !isWeb || debugStartLanguage == typescriptreact && !isWeb"},{"view":"debug","contents":"[JavaScript Debug Terminal](command:extension.js-debug.createDebuggerTerminal)\n\nYou can use the JavaScript Debug Terminal to debug Node.js processes run on the command line.","when":"debugStartLanguage == javascript && isWeb || debugStartLanguage == typescript && isWeb || debugStartLanguage == javascriptreact && isWeb || debugStartLanguage == typescriptreact && isWeb"}]},"capabilities":{"virtualWorkspaces":false,"untrustedWorkspaces":{"supported":"limited","description":"Trust is required to debug code in this workspace."}}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/ms-vscode.js-debug","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","metadata":{"id":"25629058-ddac-4e17-abba-74678e126c5d","publisherId":{"publisherId":"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee","publisherName":"ms-vscode","displayName":"Microsoft","flags":"verified"},"publisherDisplayName":"Microsoft"},"isValid":true,"validations":[]},{"type":0,"identifier":{"id":"ms-vscode.js-debug-companion","uuid":"99cb0b7f-7354-4278-b8da-6cc79972169d"},"manifest":{"name":"js-debug-companion","displayName":"JavaScript Debugger Companion Extension","description":"Companion extension to js-debug that provides capability for remote debugging","version":"1.0.18","publisher":"ms-vscode","engines":{"vscode":"^1.65.0"},"icon":"resources/logo.png","categories":["Other"],"repository":{"type":"git","url":"https://github.com/microsoft/vscode-js-debug-companion.git"},"author":"Connor Peet ","license":"MIT","bugs":{"url":"https://github.com/microsoft/vscode-js-debug-companion/issues"},"homepage":"https://github.com/microsoft/vscode-js-debug-companion#readme","capabilities":{"virtualWorkspaces":false,"untrustedWorkspaces":{"supported":true}},"activationEvents":["onCommand:js-debug-companion.launchAndAttach","onCommand:js-debug-companion.kill"],"main":"./out/extension.js","contributes":{},"extensionKind":["ui"],"api":"none","prettier":{"trailingComma":"all","singleQuote":true,"printWidth":100,"tabWidth":2,"arrowParens":"avoid"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/ms-vscode.js-debug-companion","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","metadata":{"id":"99cb0b7f-7354-4278-b8da-6cc79972169d","publisherId":{"publisherId":"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee","publisherName":"ms-vscode","displayName":"Microsoft","flags":"verified"},"publisherDisplayName":"Microsoft"},"isValid":true,"validations":[]},{"type":0,"identifier":{"id":"ms-vscode.vscode-js-profile-table","uuid":"7e52b41b-71ad-457b-ab7e-0620f1fc4feb"},"manifest":{"name":"vscode-js-profile-table","version":"1.0.3","displayName":"Table Visualizer for JavaScript Profiles","description":"Text visualizer for profiles taken from the JavaScript debugger","author":"Connor Peet ","homepage":"https://github.com/microsoft/vscode-js-profile-visualizer#readme","license":"MIT","main":"out/extension.js","browser":"out/extension.web.js","files":["out"],"repository":{"type":"git","url":"https://github.com/microsoft/vscode-js-profile-visualizer.git"},"capabilities":{"virtualWorkspaces":true,"untrustedWorkspaces":{"supported":true}},"icon":"resources/icon.png","publisher":"ms-vscode","sideEffects":false,"engines":{"vscode":"^1.67.0-insider"},"activationEvents":["onCustomEditor:jsProfileVisualizer.cpuprofile.table","onCustomEditor:jsProfileVisualizer.heapprofile.table"],"contributes":{"customEditors":[{"viewType":"jsProfileVisualizer.cpuprofile.table","displayName":"CPU Profile Table Visualizer","priority":"default","selector":[{"filenamePattern":"*.cpuprofile"}]},{"viewType":"jsProfileVisualizer.heapprofile.table","displayName":"Heap Profile Table Visualizer","priority":"default","selector":[{"filenamePattern":"*.heapprofile"}]}],"commands":[{"command":"extension.jsProfileVisualizer.table.clearCodeLenses","title":"Clear Profile Code Lenses"}],"menus":{"commandPalette":[{"command":"extension.jsProfileVisualizer.table.clearCodeLenses","when":"jsProfileVisualizer.hasCodeLenses == true"}]}},"bugs":{"url":"https://github.com/microsoft/vscode-js-profile-visualizer/issues"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/ms-vscode.vscode-js-profile-table","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","metadata":{"id":"7e52b41b-71ad-457b-ab7e-0620f1fc4feb","publisherId":{"publisherId":"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee","publisherName":"ms-vscode","displayName":"Microsoft","flags":"verified"},"publisherDisplayName":"Microsoft"},"isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.builtin-notebook-renderers"},"manifest":{"name":"builtin-notebook-renderers","displayName":"Builtin Notebook Output Renderers","description":"Provides basic output renderers for notebooks","publisher":"vscode","version":"1.0.0","license":"MIT","engines":{"vscode":"^1.57.0"},"capabilities":{"virtualWorkspaces":true,"untrustedWorkspaces":{"supported":true}},"contributes":{"notebookRenderer":[{"id":"vscode.builtin-renderer","entrypoint":"./renderer-out/index.js","displayName":"VS Code Builtin Notebook Output Renderer","requiresMessaging":"never","mimeTypes":["image/gif","image/png","image/jpeg","image/git","image/svg+xml","text/html","application/javascript","application/vnd.code.notebook.error","application/vnd.code.notebook.stdout","application/x.notebook.stdout","application/x.notebook.stream","application/vnd.code.notebook.stderr","application/x.notebook.stderr","text/plain"]}]},"scripts":{"compile":"npm run build-notebook","watch":"node ./esbuild --watch","build-notebook":"node ./esbuild"},"dependencies":{},"devDependencies":{"@types/vscode-notebook-renderer":"^1.60.0"},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/notebook-renderers","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.npm"},"manifest":{"name":"npm","publisher":"vscode","displayName":"NPM support for VS Code","description":"Extension to add task support for npm scripts.","version":"1.0.1","license":"MIT","engines":{"vscode":"0.10.x"},"icon":"images/npm_icon.png","categories":["Other"],"resolutions":{"which-pm/load-yaml-file/**/argparse":"1.0.9"},"main":"./dist/npmMain","browser":"./dist/browser/npmBrowserMain","activationEvents":["onTaskType:npm","onCommand:npm.runScriptFromFolder","onLanguage:json","workspaceContains:package.json","onView:npm"],"capabilities":{"virtualWorkspaces":false,"untrustedWorkspaces":{"supported":"limited","description":"This extension executes tasks, which require trust to run."}},"contributes":{"languages":[{"id":"ignore","extensions":[".npmignore"]},{"id":"properties","extensions":[".npmrc"]}],"views":{"explorer":[{"id":"npm","name":"NPM Scripts","when":"npm:showScriptExplorer","icon":"$(json)","visibility":"hidden","contextualTitle":"NPM Scripts"}]},"commands":[{"command":"npm.runScript","title":"Run","icon":"$(run)"},{"command":"npm.debugScript","title":"Debug","icon":"$(debug)"},{"command":"npm.openScript","title":"Open"},{"command":"npm.runInstall","title":"Run Install"},{"command":"npm.refresh","title":"Refresh","icon":"$(refresh)"},{"command":"npm.runSelectedScript","title":"Run Script"},{"command":"npm.runScriptFromFolder","title":"Run NPM Script in Folder..."},{"command":"npm.packageManager","title":"Get Configured Package Manager"}],"menus":{"commandPalette":[{"command":"npm.refresh","when":"false"},{"command":"npm.runScript","when":"false"},{"command":"npm.debugScript","when":"false"},{"command":"npm.openScript","when":"false"},{"command":"npm.runInstall","when":"false"},{"command":"npm.runSelectedScript","when":"false"},{"command":"npm.runScriptFromFolder","when":"false"},{"command":"npm.packageManager","when":"false"}],"editor/context":[{"command":"npm.runSelectedScript","when":"resourceFilename == 'package.json' && resourceScheme == file","group":"navigation@+1"}],"view/title":[{"command":"npm.refresh","when":"view == npm","group":"navigation"}],"view/item/context":[{"command":"npm.openScript","when":"view == npm && viewItem == packageJSON","group":"navigation@1"},{"command":"npm.runInstall","when":"view == npm && viewItem == packageJSON","group":"navigation@2"},{"command":"npm.openScript","when":"view == npm && viewItem == script","group":"navigation@1"},{"command":"npm.runScript","when":"view == npm && viewItem == script","group":"navigation@2"},{"command":"npm.runScript","when":"view == npm && viewItem == script","group":"inline"},{"command":"npm.debugScript","when":"view == npm && viewItem == script","group":"inline"},{"command":"npm.debugScript","when":"view == npm && viewItem == script","group":"navigation@3"}],"explorer/context":[{"when":"config.npm.enableRunFromFolder && explorerViewletVisible && explorerResourceIsFolder && resourceScheme == file","command":"npm.runScriptFromFolder","group":"2_workspace"}]},"configuration":{"id":"npm","type":"object","title":"Npm","properties":{"npm.autoDetect":{"type":"string","enum":["off","on"],"default":"on","scope":"resource","description":"Controls whether npm scripts should be automatically detected."},"npm.runSilent":{"type":"boolean","default":false,"scope":"resource","markdownDescription":"Run npm commands with the `--silent` option."},"npm.packageManager":{"scope":"resource","type":"string","enum":["auto","npm","yarn","pnpm"],"enumDescriptions":["Auto-detect which package manager to use for running scripts based on lock files and installed package managers.","Use npm as the package manager for running scripts.","Use yarn as the package manager for running scripts.","Use pnpm as the package manager for running scripts."],"default":"auto","description":"The package manager used to run scripts."},"npm.exclude":{"type":["string","array"],"items":{"type":"string"},"description":"Configure glob patterns for folders that should be excluded from automatic script detection.","scope":"resource"},"npm.enableScriptExplorer":{"type":"boolean","default":false,"scope":"resource","deprecationMessage":"The NPM Script Explorer is now available in 'Views' menu in the Explorer in all folders.","description":"Enable an explorer view for npm scripts when there is no top-level 'package.json' file."},"npm.enableRunFromFolder":{"type":"boolean","default":false,"scope":"resource","description":"Enable running npm scripts contained in a folder from the Explorer context menu."},"npm.scriptExplorerAction":{"type":"string","enum":["open","run"],"markdownDescription":"The default click action used in the NPM Scripts Explorer: `open` or `run`, the default is `open`.","scope":"window","default":"open"},"npm.scriptExplorerExclude":{"type":"array","items":{"type":"string"},"markdownDescription":"An array of regular expressions that indicate which scripts should be excluded from the NPM Scripts view.","scope":"resource","default":[]},"npm.fetchOnlinePackageInfo":{"type":"boolean","description":"Fetch data from https://registry.npmjs.org and https://registry.bower.io to provide auto-completion and information on hover features on npm dependencies.","default":true,"scope":"window","tags":["usesOnlineServices"]},"npm.scriptHover":{"type":"boolean","description":"Display hover with 'Run' and 'Debug' commands for scripts.","default":true,"scope":"window"}}},"jsonValidation":[{"fileMatch":"package.json","url":"https://json.schemastore.org/package"},{"fileMatch":"bower.json","url":"https://json.schemastore.org/bower"}],"taskDefinitions":[{"type":"npm","required":["script"],"properties":{"script":{"type":"string","description":"The npm script to customize."},"path":{"type":"string","description":"The path to the folder of the package.json file that provides the script. Can be omitted."}},"when":"shellExecutionSupported"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/npm","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.objective-c"},"manifest":{"name":"objective-c","displayName":"Objective-C Language Basics","description":"Provides syntax highlighting and bracket matching in Objective-C files.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"*"},"scripts":{"update-grammar":"node ./build/update-grammars.js"},"contributes":{"languages":[{"id":"objective-c","extensions":[".m"],"aliases":["Objective-C"],"configuration":"./language-configuration.json"},{"id":"objective-cpp","extensions":[".mm"],"aliases":["Objective-C++"],"configuration":"./language-configuration.json"}],"grammars":[{"language":"objective-c","scopeName":"source.objc","path":"./syntaxes/objective-c.tmLanguage.json"},{"language":"objective-cpp","scopeName":"source.objcpp","path":"./syntaxes/objective-c++.tmLanguage.json"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/objective-c","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.perl"},"manifest":{"name":"perl","displayName":"Perl Language Basics","description":"Provides syntax highlighting and bracket matching in Perl files.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"*"},"scripts":{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin textmate/perl.tmbundle Syntaxes/Perl.plist ./syntaxes/perl.tmLanguage.json Syntaxes/Perl%206.tmLanguage ./syntaxes/perl6.tmLanguage.json"},"contributes":{"languages":[{"id":"perl","aliases":["Perl","perl"],"extensions":[".pl",".pm",".pod",".t",".PL",".psgi"],"firstLine":"^#!.*\\bperl\\b","configuration":"./perl.language-configuration.json"},{"id":"perl6","aliases":["Perl 6","perl6"],"extensions":[".p6",".pl6",".pm6",".nqp"],"firstLine":"(^#!.*\\bperl6\\b)|use\\s+v6","configuration":"./perl6.language-configuration.json"}],"grammars":[{"language":"perl","scopeName":"source.perl","path":"./syntaxes/perl.tmLanguage.json"},{"language":"perl6","scopeName":"source.perl.6","path":"./syntaxes/perl6.tmLanguage.json"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/perl","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.php"},"manifest":{"name":"php","displayName":"PHP Language Basics","description":"Provides syntax highlighting and bracket matching for PHP files.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"0.10.x"},"contributes":{"languages":[{"id":"php","extensions":[".php",".php4",".php5",".phtml",".ctp"],"aliases":["PHP","php"],"firstLine":"^#!\\s*/.*\\bphp\\b","mimetypes":["application/x-php"],"configuration":"./language-configuration.json"}],"grammars":[{"language":"php","scopeName":"source.php","path":"./syntaxes/php.tmLanguage.json"},{"language":"php","scopeName":"text.html.php","path":"./syntaxes/html.tmLanguage.json","embeddedLanguages":{"text.html":"html","source.php":"php","source.sql":"sql","text.xml":"xml","source.js":"javascript","source.json":"json","source.css":"css"}}],"snippets":[{"language":"php","path":"./snippets/php.code-snippets"}]},"scripts":{"update-grammar":"node ./build/update-grammar.mjs"},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/php","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.php-language-features"},"manifest":{"name":"php-language-features","displayName":"PHP Language Features","description":"Provides rich language support for PHP files.","version":"1.0.0","publisher":"vscode","license":"MIT","icon":"icons/logo.png","engines":{"vscode":"0.10.x"},"activationEvents":["onLanguage:php"],"main":"./dist/phpMain","categories":["Programming Languages"],"capabilities":{"virtualWorkspaces":false,"untrustedWorkspaces":{"supported":"limited","description":"The extension requires workspace trust when the `php.validate.executablePath` setting will load a version of PHP in the workspace.","restrictedConfigurations":["php.validate.executablePath"]}},"contributes":{"configuration":{"title":"PHP","type":"object","order":20,"properties":{"php.suggest.basic":{"type":"boolean","default":true,"description":"Controls whether the built-in PHP language suggestions are enabled. The support suggests PHP globals and variables."},"php.validate.enable":{"type":"boolean","default":true,"description":"Enable/disable built-in PHP validation."},"php.validate.executablePath":{"type":["string","null"],"default":null,"description":"Points to the PHP executable.","scope":"machine-overridable"},"php.validate.run":{"type":"string","enum":["onSave","onType"],"default":"onSave","description":"Whether the linter is run on save or on type."}}},"jsonValidation":[{"fileMatch":"composer.json","url":"https://getcomposer.org/schema.json"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/php-language-features","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.powershell"},"manifest":{"name":"powershell","displayName":"Powershell Language Basics","description":"Provides snippets, syntax highlighting, bracket matching and folding in Powershell files.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"*"},"contributes":{"languages":[{"id":"powershell","extensions":[".ps1",".psm1",".psd1",".pssc",".psrc"],"aliases":["PowerShell","powershell","ps","ps1"],"firstLine":"^#!\\s*/.*\\bpwsh\\b","configuration":"./language-configuration.json"}],"grammars":[{"language":"powershell","scopeName":"source.powershell","path":"./syntaxes/powershell.tmLanguage.json"}]},"scripts":{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin PowerShell/EditorSyntax PowerShellSyntax.tmLanguage ./syntaxes/powershell.tmLanguage.json"},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/powershell","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.pug"},"manifest":{"name":"pug","displayName":"Pug Language Basics","description":"Provides syntax highlighting and bracket matching in Pug files.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"*"},"scripts":{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin davidrios/pug-tmbundle Syntaxes/Pug.JSON-tmLanguage ./syntaxes/pug.tmLanguage.json"},"contributes":{"languages":[{"id":"jade","extensions":[".pug",".jade"],"aliases":["Pug","Jade","jade"],"configuration":"./language-configuration.json"}],"grammars":[{"language":"jade","scopeName":"text.pug","path":"./syntaxes/pug.tmLanguage.json"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/pug","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.python"},"manifest":{"name":"python","displayName":"Python Language Basics","description":"Provides syntax highlighting, bracket matching and folding in Python files.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"*"},"contributes":{"languages":[{"id":"python","extensions":[".py",".rpy",".pyw",".cpy",".gyp",".gypi",".pyi",".ipy",".pyt"],"aliases":["Python","py"],"filenames":["SConstruct","SConscript"],"firstLine":"^#!\\s*/?.*\\bpython[0-9.-]*\\b","configuration":"./language-configuration.json"}],"grammars":[{"language":"python","scopeName":"source.python","path":"./syntaxes/MagicPython.tmLanguage.json"},{"scopeName":"source.regexp.python","path":"./syntaxes/MagicRegExp.tmLanguage.json"}]},"scripts":{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin MagicStack/MagicPython grammars/MagicPython.tmLanguage ./syntaxes/MagicPython.tmLanguage.json grammars/MagicRegExp.tmLanguage ./syntaxes/MagicRegExp.tmLanguage.json"},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/python","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.r"},"manifest":{"name":"r","displayName":"R Language Basics","description":"Provides syntax highlighting and bracket matching in R files.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"*"},"scripts":{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin Ikuyadeu/vscode-R syntax/r.json ./syntaxes/r.tmLanguage.json"},"contributes":{"languages":[{"id":"r","extensions":[".r",".rhistory",".rprofile",".rt"],"aliases":["R","r"],"configuration":"./language-configuration.json"}],"grammars":[{"language":"r","scopeName":"source.r","path":"./syntaxes/r.tmLanguage.json"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/r","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.razor"},"manifest":{"name":"razor","displayName":"Razor Language Basics","description":"Provides syntax highlighting, bracket matching and folding in Razor files.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"0.10.x"},"scripts":{"update-grammar":"node ./build/update-grammar.mjs"},"contributes":{"languages":[{"id":"razor","extensions":[".cshtml",".razor"],"aliases":["Razor","razor"],"mimetypes":["text/x-cshtml"],"configuration":"./language-configuration.json"}],"grammars":[{"language":"razor","scopeName":"text.html.cshtml","path":"./syntaxes/cshtml.tmLanguage.json","embeddedLanguages":{"section.embedded.source.cshtml":"csharp","source.css":"css","source.js":"javascript"}}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/razor","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.references-view"},"manifest":{"name":"references-view","displayName":"Reference Search View","description":"Reference Search results as separate, stable view in the sidebar","icon":"media/icon.png","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"^1.67.0"},"capabilities":{"virtualWorkspaces":true,"untrustedWorkspaces":{"supported":true}},"repository":{"type":"git","url":"https://github.com/Microsoft/vscode-references-view"},"bugs":{"url":"https://github.com/Microsoft/vscode-references-view/issues"},"categories":["Programming Languages"],"activationEvents":["onCommand:references-view.find","onCommand:references-view.findReferences","onCommand:references-view.findImplementations","onCommand:references-view.showCallHierarchy","onCommand:references-view.showTypeHierarchy","onCommand:editor.action.showReferences","onView:references-view.tree"],"main":"./dist/extension","browser":"./dist/extension.js","contributes":{"configuration":{"properties":{"references.preferredLocation":{"description":"Controls whether 'Peek References' or 'Find References' is invoked when selecting CodeLens references.","type":"string","default":"peek","enum":["peek","view"],"enumDescriptions":["Show references in peek editor.","Show references in separate view."]}}},"viewsContainers":{"activitybar":[{"id":"references-view","icon":"$(references)","title":"References"}]},"views":{"references-view":[{"id":"references-view.tree","name":"Results","when":"reference-list.isActive"}]},"commands":[{"command":"references-view.findReferences","title":"Find All References","category":"References"},{"command":"references-view.findImplementations","title":"Find All Implementations","category":"References"},{"command":"references-view.clearHistory","title":"Clear History","category":"References","icon":"$(clear-all)"},{"command":"references-view.clear","title":"Clear","category":"References","icon":"$(clear-all)"},{"command":"references-view.refresh","title":"Refresh","category":"References","icon":"$(refresh)"},{"command":"references-view.pickFromHistory","title":"Show History","category":"References"},{"command":"references-view.removeReferenceItem","title":"Dismiss","icon":"$(close)"},{"command":"references-view.copy","title":"Copy"},{"command":"references-view.copyAll","title":"Copy All"},{"command":"references-view.copyPath","title":"Copy Path"},{"command":"references-view.refind","title":"Rerun","icon":"$(refresh)"},{"command":"references-view.showCallHierarchy","title":"Show Call Hierarchy","category":"Calls"},{"command":"references-view.showOutgoingCalls","title":"Show Outgoing Calls","category":"Calls","icon":"$(call-outgoing)"},{"command":"references-view.showIncomingCalls","title":"Show Incoming Calls","category":"Calls","icon":"$(call-incoming)"},{"command":"references-view.removeCallItem","title":"Dismiss","icon":"$(close)"},{"command":"references-view.next","title":"Go to Next Reference","enablement":"references-view.canNavigate"},{"command":"references-view.prev","title":"Go to Previous Reference","enablement":"references-view.canNavigate"},{"command":"references-view.showTypeHierarchy","title":"Show Type Hierarchy","category":"Types"},{"command":"references-view.showSupertypes","title":"Show Supertypes","category":"Types","icon":"$(type-hierarchy-super)"},{"command":"references-view.showSubtypes","title":"Show Subtypes","category":"Types","icon":"$(type-hierarchy-sub)"},{"command":"references-view.removeTypeItem","title":"Dismiss","icon":"$(close)"}],"menus":{"editor/context":[{"command":"references-view.findReferences","when":"editorHasReferenceProvider","group":"0_navigation@1"},{"command":"references-view.findImplementations","when":"editorHasImplementationProvider","group":"0_navigation@2"},{"command":"references-view.showCallHierarchy","when":"editorHasCallHierarchyProvider","group":"0_navigation@3"},{"command":"references-view.showTypeHierarchy","when":"editorHasTypeHierarchyProvider","group":"0_navigation@4"}],"view/title":[{"command":"references-view.clear","group":"navigation@3","when":"view == references-view.tree && reference-list.hasResult"},{"command":"references-view.clearHistory","group":"navigation@3","when":"view == references-view.tree && reference-list.hasHistory && !reference-list.hasResult"},{"command":"references-view.refresh","group":"navigation@2","when":"view == references-view.tree && reference-list.hasResult"},{"command":"references-view.showOutgoingCalls","group":"navigation@1","when":"view == references-view.tree && reference-list.hasResult && reference-list.source == callHierarchy && references-view.callHierarchyMode == showIncoming"},{"command":"references-view.showIncomingCalls","group":"navigation@1","when":"view == references-view.tree && reference-list.hasResult && reference-list.source == callHierarchy && references-view.callHierarchyMode == showOutgoing"},{"command":"references-view.showSupertypes","group":"navigation@1","when":"view == references-view.tree && reference-list.hasResult && reference-list.source == typeHierarchy && references-view.typeHierarchyMode != supertypes"},{"command":"references-view.showSubtypes","group":"navigation@1","when":"view == references-view.tree && reference-list.hasResult && reference-list.source == typeHierarchy && references-view.typeHierarchyMode != subtypes"}],"view/item/context":[{"command":"references-view.removeReferenceItem","group":"inline","when":"view == references-view.tree && viewItem == file-item || view == references-view.tree && viewItem == reference-item"},{"command":"references-view.removeCallItem","group":"inline","when":"view == references-view.tree && viewItem == call-item"},{"command":"references-view.removeTypeItem","group":"inline","when":"view == references-view.tree && viewItem == type-item"},{"command":"references-view.refind","group":"inline","when":"view == references-view.tree && viewItem == history-item"},{"command":"references-view.removeReferenceItem","group":"1","when":"view == references-view.tree && viewItem == file-item || view == references-view.tree && viewItem == reference-item"},{"command":"references-view.removeCallItem","group":"1","when":"view == references-view.tree && viewItem == call-item"},{"command":"references-view.removeTypeItem","group":"1","when":"view == references-view.tree && viewItem == type-item"},{"command":"references-view.refind","group":"1","when":"view == references-view.tree && viewItem == history-item"},{"command":"references-view.copy","group":"2@1","when":"view == references-view.tree && viewItem == file-item || view == references-view.tree && viewItem == reference-item"},{"command":"references-view.copyPath","group":"2@2","when":"view == references-view.tree && viewItem == file-item"},{"command":"references-view.copyAll","group":"2@3","when":"view == references-view.tree && viewItem == file-item || view == references-view.tree && viewItem == reference-item"},{"command":"references-view.showOutgoingCalls","group":"1","when":"view == references-view.tree && viewItem == call-item"},{"command":"references-view.showIncomingCalls","group":"1","when":"view == references-view.tree && viewItem == call-item"},{"command":"references-view.showSupertypes","group":"1","when":"view == references-view.tree && viewItem == type-item"},{"command":"references-view.showSubtypes","group":"1","when":"view == references-view.tree && viewItem == type-item"}],"commandPalette":[{"command":"references-view.removeReferenceItem","when":"never"},{"command":"references-view.removeCallItem","when":"never"},{"command":"references-view.removeTypeItem","when":"never"},{"command":"references-view.copy","when":"never"},{"command":"references-view.copyAll","when":"never"},{"command":"references-view.copyPath","when":"never"},{"command":"references-view.refind","when":"never"},{"command":"references-view.findReferences","when":"editorHasReferenceProvider"},{"command":"references-view.clear","when":"reference-list.hasResult"},{"command":"references-view.clearHistory","when":"reference-list.isActive && !reference-list.hasResult"},{"command":"references-view.refresh","when":"reference-list.hasResult"},{"command":"references-view.pickFromHistory","when":"reference-list.isActive"},{"command":"references-view.next","when":"never"},{"command":"references-view.prev","when":"never"}]},"keybindings":[{"command":"references-view.findReferences","when":"editorHasReferenceProvider","key":"shift+alt+f12"},{"command":"references-view.next","when":"reference-list.hasResult","key":"f4"},{"command":"references-view.prev","when":"reference-list.hasResult","key":"shift+f4"},{"command":"references-view.showCallHierarchy","when":"editorHasCallHierarchyProvider","key":"shift+alt+h"}]}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/references-view","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.restructuredtext"},"manifest":{"name":"restructuredtext","displayName":"reStructuredText Language Basics","description":"Provides syntax highlighting in reStructuredText files.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"*"},"scripts":{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin trond-snekvik/vscode-rst syntaxes/rst.tmLanguage.json ./syntaxes/rst.tmLanguage.json"},"contributes":{"languages":[{"id":"restructuredtext","aliases":["reStructuredText"],"configuration":"./language-configuration.json","extensions":[".rst"]}],"grammars":[{"language":"restructuredtext","scopeName":"source.rst","path":"./syntaxes/rst.tmLanguage.json"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/restructuredtext","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.ruby"},"manifest":{"name":"ruby","displayName":"Ruby Language Basics","description":"Provides syntax highlighting and bracket matching in Ruby files.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"*"},"scripts":{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin textmate/ruby.tmbundle Syntaxes/Ruby.plist ./syntaxes/ruby.tmLanguage.json"},"contributes":{"languages":[{"id":"ruby","extensions":[".rb",".rbx",".rjs",".gemspec",".rake",".ru",".erb",".podspec",".rbi"],"filenames":["rakefile","gemfile","guardfile","podfile","capfile","cheffile","hobofile","vagrantfile","appraisals","rantfile","berksfile","berksfile.lock","thorfile","puppetfile","dangerfile","brewfile","fastfile","appfile","deliverfile","matchfile","scanfile","snapfile","gymfile"],"aliases":["Ruby","rb"],"firstLine":"^#!\\s*/.*\\bruby\\b","configuration":"./language-configuration.json"}],"grammars":[{"language":"ruby","scopeName":"source.ruby","path":"./syntaxes/ruby.tmLanguage.json"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/ruby","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.rust"},"manifest":{"name":"rust","displayName":"Rust Language Basics","description":"Provides syntax highlighting and bracket matching in Rust files.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"*"},"scripts":{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin dustypomerleau/rust-syntax syntaxes/rust.tmLanguage.json ./syntaxes/rust.tmLanguage.json"},"contributes":{"languages":[{"id":"rust","extensions":[".rs"],"aliases":["Rust","rust"],"configuration":"./language-configuration.json"}],"grammars":[{"language":"rust","path":"./syntaxes/rust.tmLanguage.json","scopeName":"source.rust"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/rust","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.scss"},"manifest":{"name":"scss","displayName":"SCSS Language Basics","description":"Provides syntax highlighting, bracket matching and folding in SCSS files.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"*"},"scripts":{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin atom/language-sass grammars/scss.cson ./syntaxes/scss.tmLanguage.json grammars/sassdoc.cson ./syntaxes/sassdoc.tmLanguage.json"},"contributes":{"languages":[{"id":"scss","aliases":["SCSS","scss"],"extensions":[".scss"],"mimetypes":["text/x-scss","text/scss"],"configuration":"./language-configuration.json"}],"grammars":[{"language":"scss","scopeName":"source.css.scss","path":"./syntaxes/scss.tmLanguage.json"},{"scopeName":"source.sassdoc","path":"./syntaxes/sassdoc.tmLanguage.json"}],"problemMatchers":[{"name":"node-sass","label":"Node Sass Compiler","owner":"node-sass","fileLocation":"absolute","pattern":[{"regexp":"^{$"},{"regexp":"\\s*\"status\":\\s\\d+,"},{"regexp":"\\s*\"file\":\\s\"(.*)\",","file":1},{"regexp":"\\s*\"line\":\\s(\\d+),","line":1},{"regexp":"\\s*\"column\":\\s(\\d+),","column":1},{"regexp":"\\s*\"message\":\\s\"(.*)\",","message":1},{"regexp":"\\s*\"formatted\":\\s(.*)"},{"regexp":"^}$"}]}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/scss","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.search-result"},"manifest":{"name":"search-result","displayName":"Search Result","description":"Provides syntax highlighting and language features for tabbed search results.","version":"1.0.0","publisher":"vscode","license":"MIT","icon":"images/icon.png","engines":{"vscode":"^1.39.0"},"categories":["Programming Languages"],"main":"./dist/extension.js","browser":"./dist/extension.js","activationEvents":["onLanguage:search-result"],"capabilities":{"virtualWorkspaces":true,"untrustedWorkspaces":{"supported":true}},"enabledApiProposals":["documentFiltersExclusive"],"contributes":{"configurationDefaults":{"[search-result]":{"editor.lineNumbers":"off"}},"languages":[{"id":"search-result","extensions":[".code-search"],"aliases":["Search Result"]}],"grammars":[{"language":"search-result","scopeName":"text.searchResult","path":"./syntaxes/searchResult.tmLanguage.json"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/search-result","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.shaderlab"},"manifest":{"name":"shaderlab","displayName":"Shaderlab Language Basics","description":"Provides syntax highlighting and bracket matching in Shaderlab files.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"*"},"scripts":{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin tgjones/shaders-tmLanguage grammars/shaderlab.json ./syntaxes/shaderlab.tmLanguage.json"},"contributes":{"languages":[{"id":"shaderlab","extensions":[".shader"],"aliases":["ShaderLab","shaderlab"],"configuration":"./language-configuration.json"}],"grammars":[{"language":"shaderlab","path":"./syntaxes/shaderlab.tmLanguage.json","scopeName":"source.shaderlab"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/shaderlab","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.shellscript"},"manifest":{"name":"shellscript","displayName":"Shell Script Language Basics","description":"Provides syntax highlighting and bracket matching in Shell Script files.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"*"},"scripts":{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin atom/language-shellscript grammars/shell-unix-bash.cson ./syntaxes/shell-unix-bash.tmLanguage.json"},"contributes":{"languages":[{"id":"shellscript","aliases":["Shell Script","shellscript","bash","fish","sh","zsh","ksh","csh"],"extensions":[".sh",".bash",".bashrc",".bash_aliases",".bash_profile",".bash_login",".ebuild",".profile",".bash_logout",".xprofile",".xsession",".xsessionrc",".Xsession",".zsh",".zshrc",".zprofile",".zlogin",".zlogout",".zshenv",".zsh-theme",".fish",".ksh",".csh",".cshrc",".tcshrc",".yashrc",".yash_profile"],"filenames":["APKBUILD","PKGBUILD",".envrc",".hushlogin","zshrc","zshenv","zlogin","zprofile","zlogout","bashrc_Apple_Terminal","zshrc_Apple_Terminal"],"firstLine":"^#!.*\\b(bash|fish|zsh|sh|ksh|dtksh|pdksh|mksh|ash|dash|yash|sh|csh|jcsh|tcsh|itcsh).*|^#\\s*-\\*-[^*]*mode:\\s*shell-script[^*]*-\\*-","configuration":"./language-configuration.json","mimetypes":["text/x-shellscript"]}],"grammars":[{"language":"shellscript","scopeName":"source.shell","path":"./syntaxes/shell-unix-bash.tmLanguage.json","balancedBracketScopes":["*"],"unbalancedBracketScopes":["meta.scope.case-pattern.shell"]}],"configurationDefaults":{"[shellscript]":{"files.eol":"\n"}}},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/shellscript","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.simple-browser"},"manifest":{"name":"simple-browser","displayName":"Simple Browser","description":"A very basic built-in webview for displaying web content.","enabledApiProposals":["telemetryLogger","externalUriOpener"],"version":"1.0.0","icon":"media/icon.png","publisher":"vscode","license":"MIT","aiKey":"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255","engines":{"vscode":"^1.70.0"},"main":"./dist/extension","browser":"./dist/browser/extension","categories":["Other"],"extensionKind":["ui","workspace"],"activationEvents":["onCommand:simpleBrowser.show","onCommand:simpleBrowser.api.open","onOpenExternalUri:http","onOpenExternalUri:https","onWebviewPanel:simpleBrowser.view"],"capabilities":{"virtualWorkspaces":true,"untrustedWorkspaces":{"supported":true}},"contributes":{"commands":[{"command":"simpleBrowser.show","title":"Show","category":"Simple Browser"}],"configuration":[{"title":"Simple Browser","properties":{"simpleBrowser.focusLockIndicator.enabled":{"type":"boolean","default":true,"title":"Focus Lock Indicator Enabled","description":"Enable/disable the floating indicator that shows when focused in the simple browser."}}}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/simple-browser","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.sql"},"manifest":{"name":"sql","displayName":"SQL Language Basics","description":"Provides syntax highlighting and bracket matching in SQL files.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"*"},"scripts":{"update-grammar":"node ./build/update-grammar.mjs"},"contributes":{"languages":[{"id":"sql","extensions":[".sql",".dsql"],"aliases":["SQL"],"configuration":"./language-configuration.json"}],"grammars":[{"language":"sql","scopeName":"source.sql","path":"./syntaxes/sql.tmLanguage.json"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/sql","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.swift"},"manifest":{"name":"swift","displayName":"Swift Language Basics","description":"Provides snippets, syntax highlighting and bracket matching in Swift files.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"*"},"scripts":{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin textmate/swift.tmbundle Syntaxes/Swift.tmLanguage ./syntaxes/swift.tmLanguage.json"},"contributes":{"languages":[{"id":"swift","aliases":["Swift","swift"],"extensions":[".swift"],"configuration":"./language-configuration.json"}],"grammars":[{"language":"swift","scopeName":"source.swift","path":"./syntaxes/swift.tmLanguage.json"}],"snippets":[{"language":"swift","path":"./snippets/swift.code-snippets"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/swift","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.theme-abyss"},"manifest":{"name":"theme-abyss","displayName":"Abyss Theme","description":"Abyss theme for Visual Studio Code","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"*"},"contributes":{"themes":[{"id":"Abyss","label":"Abyss","uiTheme":"vs-dark","path":"./themes/abyss-color-theme.json"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/theme-abyss","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.theme-defaults"},"manifest":{"name":"theme-defaults","displayName":"Default Themes","description":"The default Visual Studio light and dark themes","categories":["Themes"],"version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"*"},"contributes":{"themes":[{"id":"Default Dark+","label":"Dark+ (default dark)","uiTheme":"vs-dark","path":"./themes/dark_plus.json"},{"id":"Default Light+","label":"Light+ (default light)","uiTheme":"vs","path":"./themes/light_plus.json"},{"id":"Visual Studio Dark","label":"Dark (Visual Studio)","uiTheme":"vs-dark","path":"./themes/dark_vs.json"},{"id":"Visual Studio Light","label":"Light (Visual Studio)","uiTheme":"vs","path":"./themes/light_vs.json"},{"id":"Default High Contrast","label":"Dark High Contrast","uiTheme":"hc-black","path":"./themes/hc_black.json"},{"id":"Default High Contrast Light","label":"Light High Contrast","uiTheme":"hc-light","path":"./themes/hc_light.json"}],"iconThemes":[{"id":"vs-minimal","label":"Minimal (Visual Studio Code)","path":"./fileicons/vs_minimal-icon-theme.json"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/theme-defaults","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.theme-kimbie-dark"},"manifest":{"name":"theme-kimbie-dark","displayName":"Kimbie Dark Theme","description":"Kimbie dark theme for Visual Studio Code","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"*"},"contributes":{"themes":[{"id":"Kimbie Dark","label":"Kimbie Dark","uiTheme":"vs-dark","path":"./themes/kimbie-dark-color-theme.json"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/theme-kimbie-dark","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.theme-monokai"},"manifest":{"name":"theme-monokai","displayName":"Monokai Theme","description":"Monokai theme for Visual Studio Code","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"*"},"contributes":{"themes":[{"id":"Monokai","label":"Monokai","uiTheme":"vs-dark","path":"./themes/monokai-color-theme.json"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/theme-monokai","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.theme-monokai-dimmed"},"manifest":{"name":"theme-monokai-dimmed","displayName":"Monokai Dimmed Theme","description":"Monokai dimmed theme for Visual Studio Code","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"*"},"contributes":{"themes":[{"id":"Monokai Dimmed","label":"Monokai Dimmed","uiTheme":"vs-dark","path":"./themes/dimmed-monokai-color-theme.json"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/theme-monokai-dimmed","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.theme-quietlight"},"manifest":{"name":"theme-quietlight","displayName":"Quiet Light Theme","description":"Quiet light theme for Visual Studio Code","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"*"},"contributes":{"themes":[{"id":"Quiet Light","label":"Quiet Light","uiTheme":"vs","path":"./themes/quietlight-color-theme.json"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/theme-quietlight","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.theme-red"},"manifest":{"name":"theme-red","displayName":"Red Theme","description":"Red theme for Visual Studio Code","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"*"},"contributes":{"themes":[{"id":"Red","label":"Red","uiTheme":"vs-dark","path":"./themes/Red-color-theme.json"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/theme-red","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.vscode-theme-seti"},"manifest":{"name":"vscode-theme-seti","private":true,"version":"1.0.0","displayName":"Seti File Icon Theme","description":"A file icon theme made out of the Seti UI file icons","publisher":"vscode","license":"MIT","icon":"icons/seti-circular-128x128.png","scripts":{"update":"node ./build/update-icon-theme.js"},"engines":{"vscode":"*"},"contributes":{"iconThemes":[{"id":"vs-seti","label":"Seti (Visual Studio Code)","path":"./icons/vs-seti-icon-theme.json"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/theme-seti","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.theme-solarized-dark"},"manifest":{"name":"theme-solarized-dark","displayName":"Solarized Dark Theme","description":"Solarized dark theme for Visual Studio Code","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"*"},"contributes":{"themes":[{"id":"Solarized Dark","label":"Solarized Dark","uiTheme":"vs-dark","path":"./themes/solarized-dark-color-theme.json"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/theme-solarized-dark","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.theme-solarized-light"},"manifest":{"name":"theme-solarized-light","displayName":"Solarized Light Theme","description":"Solarized light theme for Visual Studio Code","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"*"},"contributes":{"themes":[{"id":"Solarized Light","label":"Solarized Light","uiTheme":"vs","path":"./themes/solarized-light-color-theme.json"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/theme-solarized-light","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.theme-tomorrow-night-blue"},"manifest":{"name":"theme-tomorrow-night-blue","displayName":"Tomorrow Night Blue Theme","description":"Tomorrow night blue theme for Visual Studio Code","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"*"},"contributes":{"themes":[{"id":"Tomorrow Night Blue","label":"Tomorrow Night Blue","uiTheme":"vs-dark","path":"./themes/tomorrow-night-blue-color-theme.json"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/theme-tomorrow-night-blue","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.typescript"},"manifest":{"name":"typescript","description":"Provides snippets, syntax highlighting, bracket matching and folding in TypeScript files.","displayName":"TypeScript Language Basics","version":"1.0.0","author":"vscode","publisher":"vscode","license":"MIT","engines":{"vscode":"*"},"scripts":{"update-grammar":"node ./build/update-grammars.mjs"},"contributes":{"languages":[{"id":"typescript","aliases":["TypeScript","ts","typescript"],"extensions":[".ts",".cts",".mts"],"configuration":"./language-configuration.json"},{"id":"typescriptreact","aliases":["TypeScript React","tsx"],"extensions":[".tsx"],"configuration":"./language-configuration.json"},{"id":"jsonc","filenames":["tsconfig.json","jsconfig.json"],"filenamePatterns":["tsconfig.*.json","jsconfig.*.json","tsconfig-*.json","jsconfig-*.json"]},{"id":"json","filenames":["tsconfig.tsbuildinfo"]}],"grammars":[{"language":"typescript","scopeName":"source.ts","path":"./syntaxes/TypeScript.tmLanguage.json","unbalancedBracketScopes":["keyword.operator.relational","storage.type.function.arrow","keyword.operator.bitwise.shift","meta.brace.angle","punctuation.definition.tag"],"tokenTypes":{"meta.template.expression":"other","meta.template.expression string":"string","meta.template.expression comment":"comment","entity.name.type.instance.jsdoc":"other","entity.name.function.tagged-template":"other","meta.import string.quoted":"other","variable.other.jsdoc":"other"}},{"language":"typescriptreact","scopeName":"source.tsx","path":"./syntaxes/TypeScriptReact.tmLanguage.json","unbalancedBracketScopes":["keyword.operator.relational","storage.type.function.arrow","keyword.operator.bitwise.shift","punctuation.definition.tag"],"embeddedLanguages":{"meta.tag.tsx":"jsx-tags","meta.tag.without-attributes.tsx":"jsx-tags","meta.tag.attributes.tsx":"typescriptreact","meta.embedded.expression.tsx":"typescriptreact"},"tokenTypes":{"meta.template.expression":"other","meta.template.expression string":"string","meta.template.expression comment":"comment","entity.name.type.instance.jsdoc":"other","entity.name.function.tagged-template":"other","meta.import string.quoted":"other","variable.other.jsdoc":"other"}},{"scopeName":"documentation.injection.ts","path":"./syntaxes/jsdoc.ts.injection.tmLanguage.json","injectTo":["source.ts","source.tsx"]},{"scopeName":"documentation.injection.js.jsx","path":"./syntaxes/jsdoc.js.injection.tmLanguage.json","injectTo":["source.js","source.js.jsx"]}],"semanticTokenScopes":[{"language":"typescript","scopes":{"property":["variable.other.property.ts"],"property.readonly":["variable.other.constant.property.ts"],"variable":["variable.other.readwrite.ts"],"variable.readonly":["variable.other.constant.object.ts"],"function":["entity.name.function.ts"],"namespace":["entity.name.type.module.ts"],"variable.defaultLibrary":["support.variable.ts"],"function.defaultLibrary":["support.function.ts"]}},{"language":"typescriptreact","scopes":{"property":["variable.other.property.tsx"],"property.readonly":["variable.other.constant.property.tsx"],"variable":["variable.other.readwrite.tsx"],"variable.readonly":["variable.other.constant.object.tsx"],"function":["entity.name.function.tsx"],"namespace":["entity.name.type.module.tsx"],"variable.defaultLibrary":["support.variable.tsx"],"function.defaultLibrary":["support.function.tsx"]}}],"snippets":[{"language":"typescript","path":"./snippets/typescript.code-snippets"},{"language":"typescriptreact","path":"./snippets/typescript.code-snippets"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/typescript-basics","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.typescript-language-features"},"manifest":{"name":"typescript-language-features","description":"Provides rich language support for JavaScript and TypeScript.","displayName":"TypeScript and JavaScript Language Features","version":"1.0.0","author":"vscode","publisher":"vscode","license":"MIT","aiKey":"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255","enabledApiProposals":["telemetryLogger","resolvers","workspaceTrust"],"capabilities":{"virtualWorkspaces":{"supported":"limited","description":"In virtual workspaces, resolving and finding references across files is not supported."},"untrustedWorkspaces":{"supported":"limited","description":"The extension requires workspace trust when the workspace version is used because it executes code specified by the workspace.","restrictedConfigurations":["typescript.tsdk","typescript.tsserver.pluginPaths","typescript.npm"]}},"engines":{"vscode":"^1.30.0"},"icon":"media/icon.png","categories":["Programming Languages"],"activationEvents":["onLanguage:javascript","onLanguage:javascriptreact","onLanguage:typescript","onLanguage:typescriptreact","onLanguage:jsx-tags","onCommand:typescript.reloadProjects","onCommand:javascript.reloadProjects","onCommand:typescript.selectTypeScriptVersion","onCommand:javascript.goToProjectConfig","onCommand:typescript.goToProjectConfig","onCommand:typescript.openTsServerLog","onCommand:typescript.tsserverRequest","onCommand:_typescript.configurePlugin","onCommand:_typescript.learnMoreAboutRefactorings","onCommand:typescript.fileReferences","onCommand:typescript.goToSourceDefinition","onTaskType:typescript","onLanguage:jsonc","onWalkthrough:nodejsWelcome"],"main":"./dist/extension","browser":"./dist/browser/extension","contributes":{"jsonValidation":[{"fileMatch":"package.json","url":"./schemas/package.schema.json"},{"fileMatch":"tsconfig.json","url":"https://json.schemastore.org/tsconfig"},{"fileMatch":"tsconfig.json","url":"./schemas/tsconfig.schema.json"},{"fileMatch":"tsconfig.*.json","url":"https://json.schemastore.org/tsconfig"},{"fileMatch":"tsconfig-*.json","url":"./schemas/tsconfig.schema.json"},{"fileMatch":"tsconfig-*.json","url":"https://json.schemastore.org/tsconfig"},{"fileMatch":"tsconfig.*.json","url":"./schemas/tsconfig.schema.json"},{"fileMatch":"typings.json","url":"https://json.schemastore.org/typings"},{"fileMatch":".bowerrc","url":"https://json.schemastore.org/bowerrc"},{"fileMatch":".babelrc","url":"https://json.schemastore.org/babelrc"},{"fileMatch":".babelrc.json","url":"https://json.schemastore.org/babelrc"},{"fileMatch":"babel.config.json","url":"https://json.schemastore.org/babelrc"},{"fileMatch":"jsconfig.json","url":"https://json.schemastore.org/jsconfig"},{"fileMatch":"jsconfig.json","url":"./schemas/jsconfig.schema.json"},{"fileMatch":"jsconfig.*.json","url":"https://json.schemastore.org/jsconfig"},{"fileMatch":"jsconfig.*.json","url":"./schemas/jsconfig.schema.json"},{"fileMatch":"typedoc.json","url":"https://typedoc.org/schema.json"}],"configuration":{"type":"object","title":"TypeScript","order":20,"properties":{"typescript.tsdk":{"type":"string","markdownDescription":"Specifies the folder path to the tsserver and `lib*.d.ts` files under a TypeScript install to use for IntelliSense, for example: `./node_modules/typescript/lib`.\n\n- When specified as a user setting, the TypeScript version from `typescript.tsdk` automatically replaces the built-in TypeScript version.\n- When specified as a workspace setting, `typescript.tsdk` allows you to switch to use that workspace version of TypeScript for IntelliSense with the `TypeScript: Select TypeScript version` command.\n\nSee the [TypeScript documentation](https://code.visualstudio.com/docs/typescript/typescript-compiling#_using-newer-typescript-versions) for more detail about managing TypeScript versions.","scope":"window"},"typescript.disableAutomaticTypeAcquisition":{"type":"boolean","default":false,"markdownDescription":"Disables [automatic type acquisition](https://code.visualstudio.com/docs/nodejs/working-with-javascript#_typings-and-automatic-type-acquisition). Automatic type acquisition fetches `@types` packages from npm to improve IntelliSense for external libraries.","scope":"window","tags":["usesOnlineServices"]},"typescript.enablePromptUseWorkspaceTsdk":{"type":"boolean","default":false,"description":"Enables prompting of users to use the TypeScript version configured in the workspace for Intellisense.","scope":"window"},"typescript.npm":{"type":"string","markdownDescription":"Specifies the path to the npm executable used for [Automatic Type Acquisition](https://code.visualstudio.com/docs/nodejs/working-with-javascript#_typings-and-automatic-type-acquisition).","scope":"machine"},"typescript.check.npmIsInstalled":{"type":"boolean","default":true,"markdownDescription":"Check if npm is installed for [Automatic Type Acquisition](https://code.visualstudio.com/docs/nodejs/working-with-javascript#_typings-and-automatic-type-acquisition).","scope":"window"},"javascript.referencesCodeLens.enabled":{"type":"boolean","default":false,"description":"Enable/disable references CodeLens in JavaScript files.","scope":"window"},"javascript.referencesCodeLens.showOnAllFunctions":{"type":"boolean","default":false,"description":"Enable/disable references CodeLens on all functions in JavaScript files.","scope":"window"},"typescript.referencesCodeLens.enabled":{"type":"boolean","default":false,"description":"Enable/disable references CodeLens in TypeScript files.","scope":"window"},"typescript.referencesCodeLens.showOnAllFunctions":{"type":"boolean","default":false,"description":"Enable/disable references CodeLens on all functions in TypeScript files.","scope":"window"},"typescript.implementationsCodeLens.enabled":{"type":"boolean","default":false,"description":"Enable/disable implementations CodeLens. This CodeLens shows the implementers of an interface.","scope":"window"},"typescript.tsserver.enableTracing":{"type":"boolean","default":false,"description":"Enables tracing TS server performance to a directory. These trace files can be used to diagnose TS Server performance issues. The log may contain file paths, source code, and other potentially sensitive information from your project.","scope":"window"},"typescript.tsserver.log":{"type":"string","enum":["off","terse","normal","verbose"],"default":"off","description":"Enables logging of the TS server to a file. This log can be used to diagnose TS Server issues. The log may contain file paths, source code, and other potentially sensitive information from your project.","scope":"window"},"typescript.tsserver.pluginPaths":{"type":"array","items":{"type":"string","description":"Either an absolute or relative path. Relative path will be resolved against workspace folder(s)."},"default":[],"description":"Additional paths to discover TypeScript Language Service plugins.","scope":"machine"},"typescript.tsserver.trace":{"type":"string","enum":["off","messages","verbose"],"default":"off","description":"Enables tracing of messages sent to the TS server. This trace can be used to diagnose TS Server issues. The trace may contain file paths, source code, and other potentially sensitive information from your project.","scope":"window"},"javascript.suggest.completeFunctionCalls":{"type":"boolean","default":false,"description":"Complete functions with their parameter signature.","scope":"resource"},"typescript.suggest.completeFunctionCalls":{"type":"boolean","default":false,"description":"Complete functions with their parameter signature.","scope":"resource"},"javascript.suggest.includeAutomaticOptionalChainCompletions":{"type":"boolean","default":true,"description":"Enable/disable showing completions on potentially undefined values that insert an optional chain call. Requires strict null checks to be enabled.","scope":"resource"},"typescript.suggest.includeAutomaticOptionalChainCompletions":{"type":"boolean","default":true,"description":"Enable/disable showing completions on potentially undefined values that insert an optional chain call. Requires strict null checks to be enabled.","scope":"resource"},"typescript.inlayHints.parameterNames.enabled":{"type":"string","enum":["none","literals","all"],"enumDescriptions":["Disable parameter name hints.","Enable parameter name hints only for literal arguments.","Enable parameter name hints for literal and non-literal arguments."],"default":"none","markdownDescription":"Enable/disable inlay hints for parameter names:\n```typescript\n\nparseInt(/* str: */ '123', /* radix: */ 8)\n \n```","scope":"resource"},"typescript.inlayHints.parameterNames.suppressWhenArgumentMatchesName":{"type":"boolean","default":true,"markdownDescription":"Suppress parameter name hints on arguments whose text is identical to the parameter name.","scope":"resource"},"typescript.inlayHints.parameterTypes.enabled":{"type":"boolean","default":false,"markdownDescription":"Enable/disable inlay hints for implicit parameter types:\n```typescript\n\nel.addEventListener('click', e /* :MouseEvent */ => ...)\n \n```","scope":"resource"},"typescript.inlayHints.variableTypes.enabled":{"type":"boolean","default":false,"markdownDescription":"Enable/disable inlay hints for implicit variable types:\n```typescript\n\nconst foo /* :number */ = Date.now();\n \n```","scope":"resource"},"typescript.inlayHints.variableTypes.suppressWhenTypeMatchesName":{"type":"boolean","default":true,"markdownDescription":"Suppress type hints on variables whose name is identical to the type name. Requires using TypeScript 4.8+ in the workspace.","scope":"resource"},"typescript.inlayHints.propertyDeclarationTypes.enabled":{"type":"boolean","default":false,"markdownDescription":"Enable/disable inlay hints for implicit types on property declarations:\n```typescript\n\nclass Foo {\n\tprop /* :number */ = Date.now();\n}\n \n```","scope":"resource"},"typescript.inlayHints.functionLikeReturnTypes.enabled":{"type":"boolean","default":false,"markdownDescription":"Enable/disable inlay hints for implicit return types on function signatures:\n```typescript\n\nfunction foo() /* :number */ {\n\treturn Date.now();\n} \n \n```","scope":"resource"},"typescript.inlayHints.enumMemberValues.enabled":{"type":"boolean","default":false,"markdownDescription":"Enable/disable inlay hints for member values in enum declarations:\n```typescript\n\nenum MyValue {\n\tA /* = 0 */;\n\tB /* = 1 */;\n}\n \n```","scope":"resource"},"javascript.inlayHints.parameterNames.enabled":{"type":"string","enum":["none","literals","all"],"enumDescriptions":["Disable parameter name hints.","Enable parameter name hints only for literal arguments.","Enable parameter name hints for literal and non-literal arguments."],"default":"none","markdownDescription":"Enable/disable inlay hints for parameter names:\n```typescript\n\nparseInt(/* str: */ '123', /* radix: */ 8)\n \n```","scope":"resource"},"javascript.inlayHints.parameterNames.suppressWhenArgumentMatchesName":{"type":"boolean","default":true,"markdownDescription":"Suppress parameter name hints on arguments whose text is identical to the parameter name.","scope":"resource"},"javascript.inlayHints.parameterTypes.enabled":{"type":"boolean","default":false,"markdownDescription":"Enable/disable inlay hints for implicit parameter types:\n```typescript\n\nel.addEventListener('click', e /* :MouseEvent */ => ...)\n \n```","scope":"resource"},"javascript.inlayHints.variableTypes.enabled":{"type":"boolean","default":false,"markdownDescription":"Enable/disable inlay hints for implicit variable types:\n```typescript\n\nconst foo /* :number */ = Date.now();\n \n```","scope":"resource"},"javascript.inlayHints.variableTypes.suppressWhenTypeMatchesName":{"type":"boolean","default":true,"markdownDescription":"Suppress type hints on variables whose name is identical to the type name. Requires using TypeScript 4.8+ in the workspace.","scope":"resource"},"javascript.inlayHints.propertyDeclarationTypes.enabled":{"type":"boolean","default":false,"markdownDescription":"Enable/disable inlay hints for implicit types on property declarations:\n```typescript\n\nclass Foo {\n\tprop /* :number */ = Date.now();\n}\n \n```","scope":"resource"},"javascript.inlayHints.functionLikeReturnTypes.enabled":{"type":"boolean","default":false,"markdownDescription":"Enable/disable inlay hints for implicit return types on function signatures:\n```typescript\n\nfunction foo() /* :number */ {\n\treturn Date.now();\n} \n \n```","scope":"resource"},"javascript.inlayHints.enumMemberValues.enabled":{"type":"boolean","default":false,"markdownDescription":"Enable/disable inlay hints for member values in enum declarations:\n```typescript\n\nenum MyValue {\n\tA /* = 0 */;\n\tB /* = 1 */;\n}\n \n```","scope":"resource"},"javascript.suggest.includeCompletionsForImportStatements":{"type":"boolean","default":true,"description":"Enable/disable auto-import-style completions on partially-typed import statements.","scope":"resource"},"typescript.suggest.includeCompletionsForImportStatements":{"type":"boolean","default":true,"description":"Enable/disable auto-import-style completions on partially-typed import statements.","scope":"resource"},"typescript.suggest.includeCompletionsWithSnippetText":{"type":"boolean","default":true,"description":"Enable/disable snippet completions from TS Server.","scope":"resource"},"typescript.reportStyleChecksAsWarnings":{"type":"boolean","default":true,"description":"Report style checks as warnings.","scope":"window"},"typescript.validate.enable":{"type":"boolean","default":true,"description":"Enable/disable TypeScript validation.","scope":"window"},"typescript.format.enable":{"type":"boolean","default":true,"description":"Enable/disable default TypeScript formatter.","scope":"window"},"typescript.format.insertSpaceAfterCommaDelimiter":{"type":"boolean","default":true,"description":"Defines space handling after a comma delimiter.","scope":"resource"},"typescript.format.insertSpaceAfterConstructor":{"type":"boolean","default":false,"description":"Defines space handling after the constructor keyword.","scope":"resource"},"typescript.format.insertSpaceAfterSemicolonInForStatements":{"type":"boolean","default":true,"description":"Defines space handling after a semicolon in a for statement.","scope":"resource"},"typescript.format.insertSpaceBeforeAndAfterBinaryOperators":{"type":"boolean","default":true,"description":"Defines space handling after a binary operator.","scope":"resource"},"typescript.format.insertSpaceAfterKeywordsInControlFlowStatements":{"type":"boolean","default":true,"description":"Defines space handling after keywords in a control flow statement.","scope":"resource"},"typescript.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions":{"type":"boolean","default":true,"description":"Defines space handling after function keyword for anonymous functions.","scope":"resource"},"typescript.format.insertSpaceBeforeFunctionParenthesis":{"type":"boolean","default":false,"description":"Defines space handling before function argument parentheses.","scope":"resource"},"typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis":{"type":"boolean","default":false,"description":"Defines space handling after opening and before closing non-empty parenthesis.","scope":"resource"},"typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets":{"type":"boolean","default":false,"description":"Defines space handling after opening and before closing non-empty brackets.","scope":"resource"},"typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces":{"type":"boolean","default":true,"description":"Defines space handling after opening and before closing non-empty braces.","scope":"resource"},"typescript.format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces":{"type":"boolean","default":true,"description":"Defines space handling after opening and before closing empty braces.","scope":"resource"},"typescript.format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces":{"type":"boolean","default":false,"description":"Defines space handling after opening and before closing template string braces.","scope":"resource"},"typescript.format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces":{"type":"boolean","default":false,"description":"Defines space handling after opening and before closing JSX expression braces.","scope":"resource"},"typescript.format.insertSpaceAfterTypeAssertion":{"type":"boolean","default":false,"description":"Defines space handling after type assertions in TypeScript.","scope":"resource"},"typescript.format.placeOpenBraceOnNewLineForFunctions":{"type":"boolean","default":false,"description":"Defines whether an open brace is put onto a new line for functions or not.","scope":"resource"},"typescript.format.placeOpenBraceOnNewLineForControlBlocks":{"type":"boolean","default":false,"description":"Defines whether an open brace is put onto a new line for control blocks or not.","scope":"resource"},"typescript.format.semicolons":{"type":"string","default":"ignore","description":"Defines handling of optional semicolons.","scope":"resource","enum":["ignore","insert","remove"],"enumDescriptions":["Don't insert or remove any semicolons.","Insert semicolons at statement ends.","Remove unnecessary semicolons."]},"javascript.validate.enable":{"type":"boolean","default":true,"description":"Enable/disable JavaScript validation.","scope":"window"},"javascript.format.enable":{"type":"boolean","default":true,"description":"Enable/disable default JavaScript formatter.","scope":"window"},"javascript.format.insertSpaceAfterCommaDelimiter":{"type":"boolean","default":true,"description":"Defines space handling after a comma delimiter.","scope":"resource"},"javascript.format.insertSpaceAfterConstructor":{"type":"boolean","default":false,"description":"Defines space handling after the constructor keyword.","scope":"resource"},"javascript.format.insertSpaceAfterSemicolonInForStatements":{"type":"boolean","default":true,"description":"Defines space handling after a semicolon in a for statement.","scope":"resource"},"javascript.format.insertSpaceBeforeAndAfterBinaryOperators":{"type":"boolean","default":true,"description":"Defines space handling after a binary operator.","scope":"resource"},"javascript.format.insertSpaceAfterKeywordsInControlFlowStatements":{"type":"boolean","default":true,"description":"Defines space handling after keywords in a control flow statement.","scope":"resource"},"javascript.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions":{"type":"boolean","default":true,"description":"Defines space handling after function keyword for anonymous functions.","scope":"resource"},"javascript.format.insertSpaceBeforeFunctionParenthesis":{"type":"boolean","default":false,"description":"Defines space handling before function argument parentheses.","scope":"resource"},"javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis":{"type":"boolean","default":false,"description":"Defines space handling after opening and before closing non-empty parenthesis.","scope":"resource"},"javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets":{"type":"boolean","default":false,"description":"Defines space handling after opening and before closing non-empty brackets.","scope":"resource"},"javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces":{"type":"boolean","default":true,"description":"Defines space handling after opening and before closing non-empty braces.","scope":"resource"},"javascript.format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces":{"type":"boolean","default":true,"description":"Defines space handling after opening and before closing empty braces.","scope":"resource"},"javascript.format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces":{"type":"boolean","default":false,"description":"Defines space handling after opening and before closing template string braces.","scope":"resource"},"javascript.format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces":{"type":"boolean","default":false,"description":"Defines space handling after opening and before closing JSX expression braces.","scope":"resource"},"javascript.format.placeOpenBraceOnNewLineForFunctions":{"type":"boolean","default":false,"description":"Defines whether an open brace is put onto a new line for functions or not.","scope":"resource"},"javascript.format.placeOpenBraceOnNewLineForControlBlocks":{"type":"boolean","default":false,"description":"Defines whether an open brace is put onto a new line for control blocks or not.","scope":"resource"},"javascript.format.semicolons":{"type":"string","default":"ignore","description":"Defines handling of optional semicolons.","scope":"resource","enum":["ignore","insert","remove"],"enumDescriptions":["Don't insert or remove any semicolons.","Insert semicolons at statement ends.","Remove unnecessary semicolons."]},"js/ts.implicitProjectConfig.module":{"type":"string","markdownDescription":"Sets the module system for the program. See more: https://www.typescriptlang.org/tsconfig#module.","default":"ESNext","enum":["CommonJS","AMD","System","UMD","ES6","ES2015","ES2020","ESNext","None","ES2022","Node12","NodeNext"],"scope":"window"},"js/ts.implicitProjectConfig.target":{"type":"string","default":"ES2020","markdownDescription":"Set target JavaScript language version for emitted JavaScript and include library declarations. See more: https://www.typescriptlang.org/tsconfig#target.","enum":["ES3","ES5","ES6","ES2015","ES2016","ES2017","ES2018","ES2019","ES2020","ES2021","ES2022","ESNext"],"scope":"window"},"javascript.implicitProjectConfig.checkJs":{"type":"boolean","default":false,"markdownDescription":"Enable/disable semantic checking of JavaScript files. Existing `jsconfig.json` or `tsconfig.json` files override this setting.","markdownDeprecationMessage":"This setting has been deprecated in favor of `js/ts.implicitProjectConfig.checkJs`.","scope":"window"},"js/ts.implicitProjectConfig.checkJs":{"type":"boolean","default":false,"markdownDescription":"Enable/disable semantic checking of JavaScript files. Existing `jsconfig.json` or `tsconfig.json` files override this setting.","scope":"window"},"javascript.implicitProjectConfig.experimentalDecorators":{"type":"boolean","default":false,"markdownDescription":"Enable/disable `experimentalDecorators` in JavaScript files that are not part of a project. Existing `jsconfig.json` or `tsconfig.json` files override this setting.","markdownDeprecationMessage":"This setting has been deprecated in favor of `js/ts.implicitProjectConfig.experimentalDecorators`.","scope":"window"},"js/ts.implicitProjectConfig.experimentalDecorators":{"type":"boolean","default":false,"markdownDescription":"Enable/disable `experimentalDecorators` in JavaScript files that are not part of a project. Existing `jsconfig.json` or `tsconfig.json` files override this setting.","scope":"window"},"js/ts.implicitProjectConfig.strictNullChecks":{"type":"boolean","default":true,"markdownDescription":"Enable/disable [strict null checks](https://www.typescriptlang.org/tsconfig#strictNullChecks) in JavaScript and TypeScript files that are not part of a project. Existing `jsconfig.json` or `tsconfig.json` files override this setting.","scope":"window"},"js/ts.implicitProjectConfig.strictFunctionTypes":{"type":"boolean","default":true,"markdownDescription":"Enable/disable [strict function types](https://www.typescriptlang.org/tsconfig#strictFunctionTypes) in JavaScript and TypeScript files that are not part of a project. Existing `jsconfig.json` or `tsconfig.json` files override this setting.","scope":"window"},"javascript.suggest.names":{"type":"boolean","default":true,"markdownDescription":"Enable/disable including unique names from the file in JavaScript suggestions. Note that name suggestions are always disabled in JavaScript code that is semantically checked using `@ts-check` or `checkJs`.","scope":"resource"},"typescript.tsc.autoDetect":{"type":"string","default":"on","enum":["on","off","build","watch"],"markdownEnumDescriptions":["Create both build and watch tasks.","Disable this feature.","Only create single run compile tasks.","Only create compile and watch tasks."],"description":"Controls auto detection of tsc tasks.","scope":"window"},"javascript.suggest.paths":{"type":"boolean","default":true,"description":"Enable/disable suggestions for paths in import statements and require calls.","scope":"resource"},"typescript.suggest.paths":{"type":"boolean","default":true,"description":"Enable/disable suggestions for paths in import statements and require calls.","scope":"resource"},"javascript.suggest.autoImports":{"type":"boolean","default":true,"description":"Enable/disable auto import suggestions.","scope":"resource"},"typescript.suggest.autoImports":{"type":"boolean","default":true,"description":"Enable/disable auto import suggestions.","scope":"resource"},"javascript.suggest.completeJSDocs":{"type":"boolean","default":true,"description":"Enable/disable suggestion to complete JSDoc comments.","scope":"language-overridable"},"typescript.suggest.completeJSDocs":{"type":"boolean","default":true,"description":"Enable/disable suggestion to complete JSDoc comments.","scope":"language-overridable"},"javascript.suggest.jsdoc.generateReturns":{"type":"boolean","default":true,"markdownDescription":"Enable/disable generating `@returns` annotations for JSDoc templates.","scope":"language-overridable"},"typescript.suggest.jsdoc.generateReturns":{"type":"boolean","default":true,"markdownDescription":"Enable/disable generating `@returns` annotations for JSDoc templates.","scope":"language-overridable"},"typescript.locale":{"type":"string","default":"auto","enum":["auto","de","es","en","fr","it","ja","ko","ru","zh-CN","zh-TW"],"markdownDescription":"Sets the locale used to report JavaScript and TypeScript errors. Defaults to use VS Code's locale.","scope":"window"},"javascript.suggestionActions.enabled":{"type":"boolean","default":true,"description":"Enable/disable suggestion diagnostics for JavaScript files in the editor.","scope":"resource"},"typescript.suggestionActions.enabled":{"type":"boolean","default":true,"description":"Enable/disable suggestion diagnostics for TypeScript files in the editor.","scope":"resource"},"javascript.preferences.quoteStyle":{"type":"string","enum":["auto","single","double"],"default":"auto","markdownDescription":"Preferred quote style to use for Quick Fixes.","markdownEnumDescriptions":["Infer quote type from existing code","Always use single quotes: `'`","Always use double quotes: `\"`"],"scope":"language-overridable"},"typescript.preferences.quoteStyle":{"type":"string","enum":["auto","single","double"],"default":"auto","markdownDescription":"Preferred quote style to use for Quick Fixes.","markdownEnumDescriptions":["Infer quote type from existing code","Always use single quotes: `'`","Always use double quotes: `\"`"],"scope":"language-overridable"},"javascript.preferences.importModuleSpecifier":{"type":"string","enum":["shortest","relative","non-relative","project-relative"],"markdownEnumDescriptions":["Prefers a non-relative import only if one is available that has fewer path segments than a relative import.","Prefers a relative path to the imported file location.","Prefers a non-relative import based on the `baseUrl` or `paths` configured in your `jsconfig.json` / `tsconfig.json`.","Prefers a non-relative import only if the relative import path would leave the package or project directory."],"default":"shortest","description":"Preferred path style for auto imports.","scope":"language-overridable"},"typescript.preferences.importModuleSpecifier":{"type":"string","enum":["shortest","relative","non-relative","project-relative"],"markdownEnumDescriptions":["Prefers a non-relative import only if one is available that has fewer path segments than a relative import.","Prefers a relative path to the imported file location.","Prefers a non-relative import based on the `baseUrl` or `paths` configured in your `jsconfig.json` / `tsconfig.json`.","Prefers a non-relative import only if the relative import path would leave the package or project directory."],"default":"shortest","description":"Preferred path style for auto imports.","scope":"language-overridable"},"javascript.preferences.importModuleSpecifierEnding":{"type":"string","enum":["auto","minimal","index","js"],"markdownEnumDescriptions":["Use project settings to select a default.","Shorten `./component/index.js` to `./component`.","Shorten `./component/index.js` to `./component/index`.","Do not shorten path endings; include the `.js` extension."],"default":"auto","description":"Preferred path ending for auto imports.","scope":"language-overridable"},"typescript.preferences.importModuleSpecifierEnding":{"type":"string","enum":["auto","minimal","index","js"],"markdownEnumDescriptions":["Use project settings to select a default.","Shorten `./component/index.js` to `./component`.","Shorten `./component/index.js` to `./component/index`.","Do not shorten path endings; include the `.js` extension."],"default":"auto","description":"Preferred path ending for auto imports.","scope":"language-overridable"},"javascript.preferences.jsxAttributeCompletionStyle":{"type":"string","enum":["auto","braces","none"],"markdownEnumDescriptions":["Insert `={}` or `=\"\"` after attribute names based on the prop type. See `javascript.preferences.quoteStyle` to control the type of quotes used for string attributes.","Insert `={}` after attribute names.","Only insert attribute names."],"default":"auto","description":"Preferred style for JSX attribute completions.","scope":"language-overridable"},"typescript.preferences.jsxAttributeCompletionStyle":{"type":"string","enum":["auto","braces","none"],"markdownEnumDescriptions":["Insert `={}` or `=\"\"` after attribute names based on the prop type. See `typescript.preferences.quoteStyle` to control the type of quotes used for string attributes.","Insert `={}` after attribute names.","Only insert attribute names."],"default":"auto","description":"Preferred style for JSX attribute completions.","scope":"language-overridable"},"typescript.preferences.includePackageJsonAutoImports":{"type":"string","enum":["auto","on","off"],"enumDescriptions":["Search dependencies based on estimated performance impact.","Always search dependencies.","Never search dependencies."],"default":"auto","markdownDescription":"Enable/disable searching `package.json` dependencies for available auto imports.","scope":"window"},"typescript.preferences.autoImportFileExcludePatterns":{"type":"array","items":{"type":"string"},"markdownDescription":"Specify glob patterns of files to exclude from auto imports. Requires using TypeScript 4.8 or newer in the workspace.","scope":"resource"},"javascript.preferences.autoImportFileExcludePatterns":{"type":"array","items":{"type":"string"},"markdownDescription":"Specify glob patterns of files to exclude from auto imports. Requires using TypeScript 4.8 or newer in the workspace.","scope":"resource"},"javascript.preferences.renameShorthandProperties":{"type":"boolean","default":true,"description":"Enable/disable introducing aliases for object shorthand properties during renames.","deprecationMessage":"The setting 'typescript.preferences.renameShorthandProperties' has been deprecated in favor of 'typescript.preferences.useAliasesForRenames'","scope":"language-overridable"},"typescript.preferences.renameShorthandProperties":{"type":"boolean","default":true,"description":"Enable/disable introducing aliases for object shorthand properties during renames.","deprecationMessage":"The setting 'typescript.preferences.renameShorthandProperties' has been deprecated in favor of 'typescript.preferences.useAliasesForRenames'","scope":"language-overridable"},"javascript.preferences.useAliasesForRenames":{"type":"boolean","default":true,"description":"Enable/disable introducing aliases for object shorthand properties during renames.","scope":"language-overridable"},"typescript.preferences.useAliasesForRenames":{"type":"boolean","default":true,"description":"Enable/disable introducing aliases for object shorthand properties during renames.","scope":"language-overridable"},"typescript.updateImportsOnFileMove.enabled":{"type":"string","enum":["prompt","always","never"],"markdownEnumDescriptions":["Prompt on each rename.","Always update paths automatically.","Never rename paths and don't prompt."],"default":"prompt","description":"Enable/disable automatic updating of import paths when you rename or move a file in VS Code.","scope":"resource"},"javascript.updateImportsOnFileMove.enabled":{"type":"string","enum":["prompt","always","never"],"markdownEnumDescriptions":["Prompt on each rename.","Always update paths automatically.","Never rename paths and don't prompt."],"default":"prompt","description":"Enable/disable automatic updating of import paths when you rename or move a file in VS Code.","scope":"resource"},"typescript.autoClosingTags":{"type":"boolean","default":true,"description":"Enable/disable automatic closing of JSX tags.","scope":"language-overridable"},"javascript.autoClosingTags":{"type":"boolean","default":true,"description":"Enable/disable automatic closing of JSX tags.","scope":"language-overridable"},"javascript.suggest.enabled":{"type":"boolean","default":true,"description":"Enabled/disable autocomplete suggestions.","scope":"language-overridable"},"typescript.suggest.enabled":{"type":"boolean","default":true,"description":"Enabled/disable autocomplete suggestions.","scope":"language-overridable"},"typescript.surveys.enabled":{"type":"boolean","default":true,"description":"Enabled/disable occasional surveys that help us improve VS Code's JavaScript and TypeScript support.","scope":"window"},"typescript.tsserver.useSeparateSyntaxServer":{"type":"boolean","default":true,"description":"Enable/disable spawning a separate TypeScript server that can more quickly respond to syntax related operations, such as calculating folding or computing document symbols.","markdownDeprecationMessage":"This setting has been deprecated in favor of `typescript.tsserver.useSyntaxServer`.","scope":"window"},"typescript.tsserver.useSyntaxServer":{"type":"string","scope":"window","description":"Controls if TypeScript launches a dedicated server to more quickly handle syntax related operations, such as computing code folding.","default":"auto","enum":["always","never","auto"],"enumDescriptions":["Use a lighter weight syntax server to handle all IntelliSense operations. This syntax server can only provide IntelliSense for opened files.","Don't use a dedicated syntax server. Use a single server to handle all IntelliSense operations.","Spawn both a full server and a lighter weight server dedicated to syntax operations. The syntax server is used to speed up syntax operations and provide IntelliSense while projects are loading."]},"typescript.tsserver.maxTsServerMemory":{"type":"number","default":3072,"description":"The maximum amount of memory (in MB) to allocate to the TypeScript server process.","scope":"window"},"typescript.tsserver.experimental.enableProjectDiagnostics":{"type":"boolean","default":false,"description":"(Experimental) Enables project wide error reporting.","scope":"window","tags":["experimental"]},"typescript.tsserver.watchOptions":{"type":"object","description":"Configure which watching strategies should be used to keep track of files and directories.","scope":"window","properties":{"watchFile":{"type":"string","description":"Strategy for how individual files are watched.","enum":["fixedChunkSizePolling","fixedPollingInterval","priorityPollingInterval","dynamicPriorityPolling","useFsEvents","useFsEventsOnParentDirectory"],"enumDescriptions":["Polls files in chunks at regular interval.","Check every file for changes several times a second at a fixed interval.","Check every file for changes several times a second, but use heuristics to check certain types of files less frequently than others.","Use a dynamic queue where less-frequently modified files will be checked less often.","Attempt to use the operating system/file system's native events for file changes.","Attempt to use the operating system/file system's native events to listen for changes on a file's containing directories. This can use fewer file watchers, but might be less accurate."],"default":"useFsEvents"},"watchDirectory":{"type":"string","description":"Strategy for how entire directory trees are watched under systems that lack recursive file-watching functionality.","enum":["fixedChunkSizePolling","fixedPollingInterval","dynamicPriorityPolling","useFsEvents"],"enumDescriptions":["Polls directories in chunks at regular interval.","Check every directory for changes several times a second at a fixed interval.","Use a dynamic queue where less-frequently modified directories will be checked less often.","Attempt to use the operating system/file system's native events for directory changes."],"default":"useFsEvents"},"fallbackPolling":{"type":"string","description":"When using file system events, this option specifies the polling strategy that gets used when the system runs out of native file watchers and/or doesn't support native file watchers.","enum":["fixedPollingInterval","priorityPollingInterval","dynamicPriorityPolling"],"enumDescriptions":["configuration.tsserver.watchOptions.fallbackPolling.fixedPollingInterval","configuration.tsserver.watchOptions.fallbackPolling.priorityPollingInterval","configuration.tsserver.watchOptions.fallbackPolling.dynamicPriorityPolling"]},"synchronousWatchDirectory":{"type":"boolean","description":"Disable deferred watching on directories. Deferred watching is useful when lots of file changes might occur at once (e.g. a change in node_modules from running npm install), but you might want to disable it with this flag for some less-common setups."}}},"typescript.workspaceSymbols.scope":{"type":"string","enum":["allOpenProjects","currentProject"],"enumDescriptions":["Search all open JavaScript or TypeScript projects for symbols.","Only search for symbols in the current JavaScript or TypeScript project."],"default":"allOpenProjects","markdownDescription":"Controls which files are searched by [Go to Symbol in Workspace](https://code.visualstudio.com/docs/editor/editingevolved#_open-symbol-by-name).","scope":"window"},"javascript.suggest.classMemberSnippets.enabled":{"type":"boolean","default":true,"description":"Enable/disable snippet completions for class members.","scope":"resource"},"typescript.suggest.classMemberSnippets.enabled":{"type":"boolean","default":true,"description":"Enable/disable snippet completions for class members.","scope":"resource"},"typescript.suggest.objectLiteralMethodSnippets.enabled":{"type":"boolean","default":true,"description":"Enable/disable snippet completions for methods in object literals. Requires using TypeScript 4.7+ in the workspace.","scope":"resource"}}},"commands":[{"command":"typescript.reloadProjects","title":"Reload Project","category":"TypeScript"},{"command":"javascript.reloadProjects","title":"Reload Project","category":"JavaScript"},{"command":"typescript.selectTypeScriptVersion","title":"Select TypeScript Version...","category":"TypeScript"},{"command":"typescript.goToProjectConfig","title":"Go to Project Configuration","category":"TypeScript"},{"command":"javascript.goToProjectConfig","title":"Go to Project Configuration","category":"JavaScript"},{"command":"typescript.openTsServerLog","title":"Open TS Server log","category":"TypeScript"},{"command":"typescript.restartTsServer","title":"Restart TS server","category":"TypeScript"},{"command":"typescript.findAllFileReferences","title":"Find File References","category":"TypeScript"},{"command":"typescript.goToSourceDefinition","title":"Go to Source Definition","category":"TypeScript"},{"command":"typescript.sortImports","title":"Sort Imports","category":"TypeScript"},{"command":"javascript.sortImports","title":"Sort Imports","category":"JavaScript"},{"command":"typescript.removeUnusedImports","title":"Remove Unused Imports","category":"TypeScript"},{"command":"javascript.removeUnusedImports","title":"Remove Unused Imports","category":"JavaScript"}],"menus":{"commandPalette":[{"command":"typescript.reloadProjects","when":"editorLangId == typescript && typescript.isManagedFile"},{"command":"typescript.reloadProjects","when":"editorLangId == typescriptreact && typescript.isManagedFile"},{"command":"javascript.reloadProjects","when":"editorLangId == javascript && typescript.isManagedFile"},{"command":"javascript.reloadProjects","when":"editorLangId == javascriptreact && typescript.isManagedFile"},{"command":"typescript.goToProjectConfig","when":"editorLangId == typescript && typescript.isManagedFile"},{"command":"typescript.goToProjectConfig","when":"editorLangId == typescriptreact"},{"command":"javascript.goToProjectConfig","when":"editorLangId == javascript && typescript.isManagedFile"},{"command":"javascript.goToProjectConfig","when":"editorLangId == javascriptreact && typescript.isManagedFile"},{"command":"typescript.selectTypeScriptVersion","when":"typescript.isManagedFile"},{"command":"typescript.openTsServerLog","when":"typescript.isManagedFile"},{"command":"typescript.restartTsServer","when":"typescript.isManagedFile"},{"command":"typescript.findAllFileReferences","when":"tsSupportsFileReferences && typescript.isManagedFile"},{"command":"typescript.goToSourceDefinition","when":"tsSupportsSourceDefinition && typescript.isManagedFile"},{"command":"typescript.sortImports","when":"supportedCodeAction =~ /(\\s|^)source\\.sortImports\\b/ && editorLangId =~ /^typescript(react)?$/"},{"command":"javascript.sortImports","when":"supportedCodeAction =~ /(\\s|^)source\\.sortImports\\b/ && editorLangId =~ /^javascript(react)?$/"},{"command":"typescript.removeUnusedImports","when":"supportedCodeAction =~ /(\\s|^)source\\.removeUnusedImports\\b/ && editorLangId =~ /^typescript(react)?$/"},{"command":"javascript.removeUnusedImports","when":"supportedCodeAction =~ /(\\s|^)source\\.removeUnusedImports\\b/ && editorLangId =~ /^javascript(react)?$/"}],"editor/context":[{"command":"typescript.goToSourceDefinition","when":"tsSupportsSourceDefinition && resourceLangId == typescript","group":"navigation@9"},{"command":"typescript.goToSourceDefinition","when":"tsSupportsSourceDefinition && resourceLangId == typescriptreact","group":"navigation@9"},{"command":"typescript.goToSourceDefinition","when":"tsSupportsSourceDefinition && resourceLangId == javascript","group":"navigation@9"},{"command":"typescript.goToSourceDefinition","when":"tsSupportsSourceDefinition && resourceLangId == javascriptreact","group":"navigation@9"}],"explorer/context":[{"command":"typescript.findAllFileReferences","when":"tsSupportsFileReferences && resourceLangId == typescript","group":"4_search"},{"command":"typescript.findAllFileReferences","when":"tsSupportsFileReferences && resourceLangId == typescriptreact","group":"4_search"},{"command":"typescript.findAllFileReferences","when":"tsSupportsFileReferences && resourceLangId == javascript","group":"4_search"},{"command":"typescript.findAllFileReferences","when":"tsSupportsFileReferences && resourceLangId == javascriptreact","group":"4_search"}],"editor/title/context":[{"command":"typescript.findAllFileReferences","when":"tsSupportsFileReferences && resourceLangId == javascript"},{"command":"typescript.findAllFileReferences","when":"tsSupportsFileReferences && resourceLangId == javascriptreact"},{"command":"typescript.findAllFileReferences","when":"tsSupportsFileReferences && resourceLangId == typescript"},{"command":"typescript.findAllFileReferences","when":"tsSupportsFileReferences && resourceLangId == typescriptreact"}]},"breakpoints":[{"language":"typescript"},{"language":"typescriptreact"}],"taskDefinitions":[{"type":"typescript","required":["tsconfig"],"properties":{"tsconfig":{"type":"string","description":"The tsconfig file that defines the TS build."},"option":{"type":"string"}},"when":"shellExecutionSupported"}],"problemPatterns":[{"name":"tsc","regexp":"^([^\\s].*)[\\(:](\\d+)[,:](\\d+)(?:\\):\\s+|\\s+-\\s+)(error|warning|info)\\s+TS(\\d+)\\s*:\\s*(.*)$","file":1,"line":2,"column":3,"severity":4,"code":5,"message":6}],"problemMatchers":[{"name":"tsc","label":"TypeScript problems","owner":"typescript","source":"ts","applyTo":"closedDocuments","fileLocation":["relative","${cwd}"],"pattern":"$tsc"},{"name":"tsc-watch","label":"TypeScript problems (watch mode)","owner":"typescript","source":"ts","applyTo":"closedDocuments","fileLocation":["relative","${cwd}"],"pattern":"$tsc","background":{"activeOnStart":true,"beginsPattern":{"regexp":"^\\s*(?:message TS6032:|\\[?\\D*.{1,2}[:.].{1,2}[:.].{1,2}\\D*(├\\D*\\d{1,2}\\D+┤)?(?:\\]| -)) (Starting compilation in watch mode|File change detected\\. Starting incremental compilation)\\.\\.\\."},"endsPattern":{"regexp":"^\\s*(?:message TS6042:|\\[?\\D*.{1,2}[:.].{1,2}[:.].{1,2}\\D*(├\\D*\\d{1,2}\\D+┤)?(?:\\]| -)) (?:Compilation complete\\.|Found \\d+ errors?\\.) Watching for file changes\\."}}}],"codeActions":[{"languages":["javascript","javascriptreact","typescript","typescriptreact"],"actions":[{"kind":"refactor.extract.constant","title":"Extract constant","description":"Extract expression to constant."},{"kind":"refactor.extract.function","title":"Extract function","description":"Extract expression to method or function."},{"kind":"refactor.extract.interface","title":"Extract interface","description":"Extract type to an interface."},{"kind":"refactor.extract.type","title":"Extract type","description":"Extract type to a type alias."},{"kind":"refactor.rewrite.import","title":"Convert import","description":"Convert between named imports and namespace imports."},{"kind":"refactor.rewrite.export","title":"Convert export","description":"Convert between default export and named export."},{"kind":"refactor.rewrite.arrow.braces","title":"Rewrite arrow braces","description":"Add or remove braces in an arrow function."},{"kind":"refactor.rewrite.parameters.toDestructured","title":"Convert parameters to destructured object"},{"kind":"refactor.rewrite.property.generateAccessors","title":"Generate accessors","description":"Generate 'get' and 'set' accessors"},{"kind":"refactor.move.newFile","title":"Move to a new file","description":"Move the expression to a new file."},{"kind":"source.organizeImports","title":"Organize Imports"}]}],"walkthroughs":[{"id":"nodejsWelcome","title":"Get started with JavaScript and Node.js","icon":"media/nodejsWalkthroughIcon.png","description":"Make the most of Visual Studio Code's first-class JavaScript experience.","when":"false","steps":[{"id":"walkthroughs.nodejsWelcome.downloadNode.forMacOrWindows","title":"Install Node.js","description":"Node.js is an easy way to run JavaScript code. You can use it to quickly build command-line apps and servers. It also comes with npm, a package manager which makes reusing and sharing JavaScript code easy.\n[Install Node.js](https://nodejs.org/en/download/)","media":{"svg":"resources/walkthroughs/install-node-js.svg"},"when":"isWindows || isMac"},{"id":"walkthroughs.nodejsWelcome.downloadNode.forLinux","title":"Install Node.js","description":"Node.js is an easy way to run JavaScript code. You can use it to quickly build command-line apps and servers. It also comes with npm, a package manager which makes reusing and sharing JavaScript code easy.\n[Install Node.js](https://nodejs.org/en/download/package-manager/)","media":{"svg":"resources/walkthroughs/install-node-js.svg"},"when":"isLinux"},{"id":"walkthroughs.nodejsWelcome.makeJsFile","title":"Create a JavaScript File","description":"Let's write our first JavaScript file. We'll have to create a new file and save it with the ``.js`` extension at the end of the file name.\n[Create a JavaScript File](command:javascript-walkthrough.commands.createJsFile)","media":{"svg":"resources/walkthroughs/create-a-js-file.svg"}},{"id":"walkthroughs.nodejsWelcome.debugJsFile","title":"Run and Debug your JavaScript","description":"Once you've installed Node.js, you can run JavaScript programs at a terminal by entering ``node your-file-name.js``\nAnother easy way to run Node.js programs is by using VS Code's debugger which lets you run your code, pause at different points, and help you understand what's going on step-by-step.\n[Start Debugging](command:javascript-walkthrough.commands.debugJsFile)","media":{"svg":"resources/walkthroughs/debug-and-run.svg"}},{"id":"walkthroughs.nodejsWelcome.learnMoreAboutJs","title":"Explore More","description":"Want to get more comfortable with JavaScript, Node.js, and VS Code? Be sure to check out our docs!\nWe've got lots of resources for learning [JavaScript](https://code.visualstudio.com/docs/nodejs/working-with-javascript) and [Node.js](https://code.visualstudio.com/docs/nodejs/nodejs-tutorial).\n\n[Learn More](https://code.visualstudio.com/docs/nodejs/nodejs-tutorial)","media":{"svg":"resources/walkthroughs/learn-more.svg"}}]}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/typescript-language-features","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.vb"},"manifest":{"name":"vb","displayName":"Visual Basic Language Basics","description":"Provides snippets, syntax highlighting, bracket matching and folding in Visual Basic files.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"*"},"scripts":{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin textmate/asp.vb.net.tmbundle Syntaxes/ASP%20VB.net.plist ./syntaxes/asp-vb-net.tmlanguage.json"},"contributes":{"languages":[{"id":"vb","extensions":[".vb",".brs",".vbs",".bas",".vba"],"aliases":["Visual Basic","vb"],"configuration":"./language-configuration.json"}],"grammars":[{"language":"vb","scopeName":"source.asp.vb.net","path":"./syntaxes/asp-vb-net.tmlanguage.json"}],"snippets":[{"language":"vb","path":"./snippets/vb.code-snippets"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}},"location":{"$mid":1,"path":"/home/.openvscode-server/extensions/vb","scheme":"file"},"isBuiltin":true,"targetPlatform":"undefined","isValid":true,"validations":[]},{"type":0,"identifier":{"id":"vscode.xml"},"manifest":{"name":"xml","displayName":"XML Language Basics","description":"Provides syntax highlighting and bracket matching in XML files.","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"*"},"contributes":{"languages":[{"id":"xml","extensions":[".xml",".xsd",".ascx",".atom",".axml",".axaml",".bpmn",".cpt",".csl",".csproj",".csproj.user",".dita",".ditamap",".dtd",".ent",".mod",".dtml",".fsproj",".fxml",".iml",".isml",".jmx",".launch",".menu",".mxml",".nuspec",".opml",".owl",".proj",".props",".pt",".publishsettings",".pubxml",".pubxml.user",".rbxlx",".rbxmx",".rdf",".rng",".rss",".shproj",".storyboard",".svg",".targets",".tld",".tmx",".vbproj",".vbproj.user",".vcxproj",".vcxproj.filters",".wsdl",".wxi",".wxl",".wxs",".xaml",".xbl",".xib",".xlf",".xliff",".xpdl",".xul",".xoml"],"firstLine":"(\\<\\?xml.*)|(\\ Launched Extension Host Process. +2023-01-24 03:37:03.532 [info] [10.16.1.64][174115bd][ManagementConnection] New connection established. +2023-01-24 03:37:03.979 [info] [10.16.1.64][93e3f2db][ExtensionHostConnection] New connection established. +2023-01-24 03:37:03.984 [info] [10.16.1.64][93e3f2db][ExtensionHostConnection] <189> Launched Extension Host Process. +2023-01-24 03:37:05.318 [warning] RequestStore#acceptReply was called without receiving a matching request 49 +2023-01-24 03:37:06.239 [warning] RequestStore#acceptReply was called without receiving a matching request 50 +2023-01-24 03:37:06.239 [warning] RequestStore#acceptReply was called without receiving a matching request 51 +2023-01-24 03:37:06.240 [warning] RequestStore#acceptReply was called without receiving a matching request 52 +2023-01-24 03:37:06.240 [warning] RequestStore#acceptReply was called without receiving a matching request 53 +2023-01-24 03:37:06.240 [warning] RequestStore#acceptReply was called without receiving a matching request 54 +2023-01-24 03:37:06.241 [warning] RequestStore#acceptReply was called without receiving a matching request 55 +2023-01-24 03:37:06.516 [warning] RequestStore#acceptReply was called without receiving a matching request 56 +2023-01-24 03:37:06.517 [warning] RequestStore#acceptReply was called without receiving a matching request 57 +2023-01-24 03:37:06.517 [warning] RequestStore#acceptReply was called without receiving a matching request 58 +2023-01-24 03:37:06.517 [warning] RequestStore#acceptReply was called without receiving a matching request 59 +2023-01-24 03:37:06.546 [warning] RequestStore#acceptReply was called without receiving a matching request 60 +2023-01-24 03:37:06.546 [warning] RequestStore#acceptReply was called without receiving a matching request 61 +2023-01-24 03:37:06.548 [warning] RequestStore#acceptReply was called without receiving a matching request 62 +2023-01-24 03:37:06.548 [warning] RequestStore#acceptReply was called without receiving a matching request 63 +2023-01-24 03:37:06.826 [warning] RequestStore#acceptReply was called without receiving a matching request 64 +2023-01-24 03:37:06.826 [warning] RequestStore#acceptReply was called without receiving a matching request 65 +2023-01-24 03:37:06.827 [warning] RequestStore#acceptReply was called without receiving a matching request 66 +2023-01-24 03:37:06.827 [warning] RequestStore#acceptReply was called without receiving a matching request 67 +2023-01-24 03:37:06.832 [warning] RequestStore#acceptReply was called without receiving a matching request 68 +2023-01-24 03:37:06.878 [warning] RequestStore#acceptReply was called without receiving a matching request 69 +2023-01-24 03:37:07.060 [warning] RequestStore#acceptReply was called without receiving a matching request 70 +2023-01-24 03:37:07.195 [warning] RequestStore#acceptReply was called without receiving a matching request 71 +2023-01-24 03:37:07.285 [warning] RequestStore#acceptReply was called without receiving a matching request 72 +2023-01-24 03:37:07.330 [warning] RequestStore#acceptReply was called without receiving a matching request 73 +2023-01-24 03:37:07.445 [warning] RequestStore#acceptReply was called without receiving a matching request 74 +2023-01-24 03:37:07.555 [warning] RequestStore#acceptReply was called without receiving a matching request 75 +2023-01-24 03:37:07.690 [warning] RequestStore#acceptReply was called without receiving a matching request 76 +2023-01-24 03:37:07.823 [warning] RequestStore#acceptReply was called without receiving a matching request 77 +2023-01-24 03:37:07.958 [warning] RequestStore#acceptReply was called without receiving a matching request 78 +2023-01-24 03:37:08.093 [warning] RequestStore#acceptReply was called without receiving a matching request 79 +2023-01-24 03:37:08.227 [warning] RequestStore#acceptReply was called without receiving a matching request 80 +2023-01-24 03:37:08.361 [warning] RequestStore#acceptReply was called without receiving a matching request 81 +2023-01-24 03:37:08.497 [warning] RequestStore#acceptReply was called without receiving a matching request 82 +2023-01-24 03:37:08.633 [warning] RequestStore#acceptReply was called without receiving a matching request 83 +2023-01-24 03:37:08.769 [warning] RequestStore#acceptReply was called without receiving a matching request 84 +2023-01-24 03:46:15.511 [warning] No ptyHost heartbeat after 6 seconds diff --git a/.openvscode-server/extensions/.init-default-profile-extensions b/.openvscode-server/extensions/.init-default-profile-extensions new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/.wget-hsts b/.wget-hsts new file mode 100644 index 0000000000000000000000000000000000000000..58ee45399aa33910c67c67bee528f09b3e302174 --- /dev/null +++ b/.wget-hsts @@ -0,0 +1,4 @@ +# HSTS 1.0 Known Hosts database for GNU Wget. +# Edit at your own risk. +# +huggingface.co 0 1 1674531460 31536000 diff --git a/Anything-V3.0.ckpt b/Anything-V3.0.ckpt new file mode 100644 index 0000000000000000000000000000000000000000..9faf5011224d99da24e8771e5c2751546628f722 --- /dev/null +++ b/Anything-V3.0.ckpt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8712e20a5d65b6acaa743e8a74961eadfdf846a2c9a32160d80a80cba13ad475 +size 7703657858