Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
Files changed (50)
- lib/python3.12/site-packages/_distutils_hack/__init__.pyAdded+239
- lib/python3.12/site-packages/_distutils_hack/__pycache__/__init__.cpython-312.pycAdded
- lib/python3.12/site-packages/_distutils_hack/__pycache__/override.cpython-312.pycAdded
- lib/python3.12/site-packages/_distutils_hack/override.pyAdded+1
- lib/python3.12/site-packages/dill-0.3.8.dist-info/INSTALLERAdded+1
- lib/python3.12/site-packages/dill-0.3.8.dist-info/LICENSEAdded+35
- lib/python3.12/site-packages/dill-0.3.8.dist-info/METADATAAdded+280
- lib/python3.12/site-packages/dill-0.3.8.dist-info/RECORDAdded+97
- lib/python3.12/site-packages/dill-0.3.8.dist-info/WHEELAdded+5
- lib/python3.12/site-packages/dill-0.3.8.dist-info/top_level.txtAdded+1
- lib/python3.12/site-packages/fsspec-2025.3.0.dist-info/INSTALLERAdded+1
- lib/python3.12/site-packages/fsspec-2025.3.0.dist-info/METADATAAdded+278
- lib/python3.12/site-packages/fsspec-2025.3.0.dist-info/RECORDAdded+115
- lib/python3.12/site-packages/fsspec-2025.3.0.dist-info/WHEELAdded+4
- lib/python3.12/site-packages/fsspec-2025.3.0.dist-info/licenses/LICENSEAdded+29
- lib/python3.12/site-packages/ipython_pygments_lexers-1.1.1.dist-info/INSTALLERAdded+1
- lib/python3.12/site-packages/ipython_pygments_lexers-1.1.1.dist-info/LICENSEAdded+30
- lib/python3.12/site-packages/ipython_pygments_lexers-1.1.1.dist-info/METADATAAdded+26
- lib/python3.12/site-packages/ipython_pygments_lexers-1.1.1.dist-info/RECORDAdded+8
- lib/python3.12/site-packages/ipython_pygments_lexers-1.1.1.dist-info/WHEELAdded+4
- lib/python3.12/site-packages/ipython_pygments_lexers-1.1.1.dist-info/entry_points.txtAdded+5
- lib/python3.12/site-packages/jinja2/__init__.pyAdded+38
- lib/python3.12/site-packages/jinja2/__pycache__/__init__.cpython-312.pycAdded
- lib/python3.12/site-packages/jinja2/__pycache__/_identifier.cpython-312.pycAdded
- lib/python3.12/site-packages/jinja2/__pycache__/async_utils.cpython-312.pycAdded
- lib/python3.12/site-packages/jinja2/__pycache__/bccache.cpython-312.pycAdded
- lib/python3.12/site-packages/jinja2/__pycache__/constants.cpython-312.pycAdded
- lib/python3.12/site-packages/jinja2/__pycache__/debug.cpython-312.pycAdded
- lib/python3.12/site-packages/jinja2/__pycache__/defaults.cpython-312.pycAdded
- lib/python3.12/site-packages/jinja2/__pycache__/environment.cpython-312.pycAdded
- lib/python3.12/site-packages/jinja2/__pycache__/exceptions.cpython-312.pycAdded
- lib/python3.12/site-packages/jinja2/__pycache__/ext.cpython-312.pycAdded
- lib/python3.12/site-packages/jinja2/__pycache__/filters.cpython-312.pycAdded
- lib/python3.12/site-packages/jinja2/__pycache__/idtracking.cpython-312.pycAdded
- lib/python3.12/site-packages/jinja2/__pycache__/lexer.cpython-312.pycAdded
- lib/python3.12/site-packages/jinja2/__pycache__/loaders.cpython-312.pycAdded
- lib/python3.12/site-packages/jinja2/__pycache__/meta.cpython-312.pycAdded
- lib/python3.12/site-packages/jinja2/__pycache__/nativetypes.cpython-312.pycAdded
- lib/python3.12/site-packages/jinja2/__pycache__/nodes.cpython-312.pycAdded
- lib/python3.12/site-packages/jinja2/__pycache__/optimizer.cpython-312.pycAdded
- lib/python3.12/site-packages/jinja2/__pycache__/parser.cpython-312.pycAdded
- lib/python3.12/site-packages/jinja2/__pycache__/runtime.cpython-312.pycAdded
- lib/python3.12/site-packages/jinja2/__pycache__/sandbox.cpython-312.pycAdded
- lib/python3.12/site-packages/jinja2/__pycache__/tests.cpython-312.pycAdded
- lib/python3.12/site-packages/jinja2/__pycache__/utils.cpython-312.pycAdded
- lib/python3.12/site-packages/jinja2/__pycache__/visitor.cpython-312.pycAdded
- lib/python3.12/site-packages/jinja2/_identifier.pyAdded+6
- lib/python3.12/site-packages/jinja2/async_utils.pyAdded+99
- lib/python3.12/site-packages/jinja2/bccache.pyAdded+408
- lib/python3.12/site-packages/jinja2/compiler.pyAdded+1998
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239# don't import any costly modulesimport osimport sys
report_url = ( "https://github.com/pypa/setuptools/issues/new?template=distutils-deprecation.yml")
def warn_distutils_present(): if 'distutils' not in sys.modules: return import warnings
warnings.warn( "Distutils was imported before Setuptools, but importing Setuptools " "also replaces the `distutils` module in `sys.modules`. This may lead " "to undesirable behaviors or errors. To avoid these issues, avoid " "using distutils directly, ensure that setuptools is installed in the " "traditional way (e.g. not an editable install), and/or make sure " "that setuptools is always imported before distutils." )
def clear_distutils(): if 'distutils' not in sys.modules: return import warnings
warnings.warn( "Setuptools is replacing distutils. Support for replacing " "an already imported distutils is deprecated. In the future, " "this condition will fail. " f"Register concerns at {report_url}" ) mods = [ name for name in sys.modules if name == "distutils" or name.startswith("distutils.") ] for name in mods: del sys.modules[name]
def enabled(): """ Allow selection of distutils by environment variable. """ which = os.environ.get('SETUPTOOLS_USE_DISTUTILS', 'local') if which == 'stdlib': import warnings
warnings.warn( "Reliance on distutils from stdlib is deprecated. Users " "must rely on setuptools to provide the distutils module. " "Avoid importing distutils or import setuptools first, " "and avoid setting SETUPTOOLS_USE_DISTUTILS=stdlib. " f"Register concerns at {report_url}" ) return which == 'local'
def ensure_local_distutils(): import importlib
clear_distutils()
# With the DistutilsMetaFinder in place, # perform an import to cause distutils to be # loaded from setuptools._distutils. Ref #2906. with shim(): importlib.import_module('distutils')
# check that submodules load as expected core = importlib.import_module('distutils.core') assert '_distutils' in core.__file__, core.__file__ assert 'setuptools._distutils.log' not in sys.modules
def do_override(): """ Ensure that the local copy of distutils is preferred over stdlib.
See https://github.com/pypa/setuptools/issues/417#issuecomment-392298401 for more motivation. """ if enabled(): warn_distutils_present() ensure_local_distutils()
class _TrivialRe: def __init__(self, *patterns) -> None: self._patterns = patterns
def match(self, string): return all(pat in string for pat in self._patterns)
class DistutilsMetaFinder: def find_spec(self, fullname, path, target=None): # optimization: only consider top level modules and those # found in the CPython test suite. if path is not None and not fullname.startswith('test.'): return None
method_name = 'spec_for_{fullname}'.format(**locals()) method = getattr(self, method_name, lambda: None) return method()
def spec_for_distutils(self): if self.is_cpython(): return None
import importlib import importlib.abc import importlib.util
try: mod = importlib.import_module('setuptools._distutils') except Exception: # There are a couple of cases where setuptools._distutils # may not be present: # - An older Setuptools without a local distutils is # taking precedence. Ref #2957. # - Path manipulation during sitecustomize removes # setuptools from the path but only after the hook # has been loaded. Ref #2980. # In either case, fall back to stdlib behavior. return None
class DistutilsLoader(importlib.abc.Loader): def create_module(self, spec): mod.__name__ = 'distutils' return mod
def exec_module(self, module): pass
return importlib.util.spec_from_loader( 'distutils', DistutilsLoader(), origin=mod.__file__ )
@staticmethod def is_cpython(): """ Suppress supplying distutils for CPython (build and tests). Ref #2965 and #3007. """ return os.path.isfile('pybuilddir.txt')
def spec_for_pip(self): """ Ensure stdlib distutils when running under pip. See pypa/pip#8761 for rationale. """ if sys.version_info >= (3, 12) or self.pip_imported_during_build(): return clear_distutils() self.spec_for_distutils = lambda: None
@classmethod def pip_imported_during_build(cls): """ Detect if pip is being imported in a build script. Ref #2355. """ import traceback
return any( cls.frame_file_is_setup(frame) for frame, line in traceback.walk_stack(None) )
@staticmethod def frame_file_is_setup(frame): """ Return True if the indicated frame suggests a setup.py file. """ # some frames may not have __file__ (#2940) return frame.f_globals.get('__file__', '').endswith('setup.py')
def spec_for_sensitive_tests(self): """ Ensure stdlib distutils when running select tests under CPython.
python/cpython#91169 """ clear_distutils() self.spec_for_distutils = lambda: None
sensitive_tests = ( [ 'test.test_distutils', 'test.test_peg_generator', 'test.test_importlib', ] if sys.version_info < (3, 10) else [ 'test.test_distutils', ] )
for name in DistutilsMetaFinder.sensitive_tests: setattr( DistutilsMetaFinder, f'spec_for_{name}', DistutilsMetaFinder.spec_for_sensitive_tests, )
DISTUTILS_FINDER = DistutilsMetaFinder()
def add_shim(): DISTUTILS_FINDER in sys.meta_path or insert_shim()
class shim: def __enter__(self) -> None: insert_shim()
def __exit__(self, exc: object, value: object, tb: object) -> None: _remove_shim()
def insert_shim(): sys.meta_path.insert(0, DISTUTILS_FINDER)
def _remove_shim(): try: sys.meta_path.remove(DISTUTILS_FINDER) except ValueError: pass
if sys.version_info < (3, 12): # DistutilsMetaFinder can only be disabled in Python < 3.12 (PEP 632) remove_shim = _remove_shim1__import__('_distutils_hack').do_override()1pip1234567891011121314151617181920212223242526272829303132333435Copyright (c) 2004-2016 California Institute of Technology.Copyright (c) 2016-2024 The Uncertainty Quantification Foundation.All rights reserved.
This software is available subject to the conditions and terms laidout below. By downloading and using this software you are agreeingto the following conditions.
Redistribution and use in source and binary forms, with or withoutmodification, are permitted provided that the following conditionsare met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the names of the copyright holders nor the names of any of the contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITEDTO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULARPURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER ORCONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OROTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IFADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280Metadata-Version: 2.1Name: dillVersion: 0.3.8Summary: serialize all of PythonHome-page: https://github.com/uqfoundation/dillAuthor: Mike McKernsAuthor-email: mmckerns@uqfoundation.orgMaintainer: Mike McKernsMaintainer-email: mmckerns@uqfoundation.orgLicense: BSD-3-ClauseDownload-URL: https://pypi.org/project/dill/#filesProject-URL: Documentation, http://dill.rtfd.ioProject-URL: Source Code, https://github.com/uqfoundation/dillProject-URL: Bug Tracker, https://github.com/uqfoundation/dill/issuesPlatform: LinuxPlatform: WindowsPlatform: MacClassifier: Development Status :: 5 - Production/StableClassifier: Intended Audience :: DevelopersClassifier: Intended Audience :: Science/ResearchClassifier: License :: OSI Approved :: BSD LicenseClassifier: Programming Language :: Python :: 3Classifier: Programming Language :: Python :: 3.8Classifier: Programming Language :: Python :: 3.9Classifier: Programming Language :: Python :: 3.10Classifier: Programming Language :: Python :: 3.11Classifier: Programming Language :: Python :: 3.12Classifier: Programming Language :: Python :: Implementation :: CPythonClassifier: Programming Language :: Python :: Implementation :: PyPyClassifier: Topic :: Scientific/EngineeringClassifier: Topic :: Software DevelopmentRequires-Python: >=3.8Provides-Extra: graphRequires-Dist: objgraph (>=1.7.2) ; extra == 'graph'Provides-Extra: profileRequires-Dist: gprof2dot (>=2022.7.29) ; extra == 'profile'Provides-Extra: readline
-----------------------------dill: serialize all of Python-----------------------------
About Dill==========
``dill`` extends Python's ``pickle`` module for serializing and de-serializingPython objects to the majority of the built-in Python types. Serializationis the process of converting an object to a byte stream, and the inverseof which is converting a byte stream back to a Python object hierarchy.
``dill`` provides the user the same interface as the ``pickle`` module, andalso includes some additional features. In addition to pickling Pythonobjects, ``dill`` provides the ability to save the state of an interpretersession in a single command. Hence, it would be feasible to save aninterpreter session, close the interpreter, ship the pickled file toanother computer, open a new interpreter, unpickle the session andthus continue from the 'saved' state of the original interpretersession.
``dill`` can be used to store Python objects to a file, but the primaryusage is to send Python objects across the network as a byte stream.``dill`` is quite flexible, and allows arbitrary user defined classesand functions to be serialized. Thus ``dill`` is not intended to besecure against erroneously or maliciously constructed data. It isleft to the user to decide whether the data they unpickle is froma trustworthy source.
``dill`` is part of ``pathos``, a Python framework for heterogeneous computing.``dill`` is in active development, so any user feedback, bug reports, comments,or suggestions are highly appreciated. A list of issues is located athttps://github.com/uqfoundation/dill/issues, with a legacy list maintained athttps://uqfoundation.github.io/project/pathos/query.
Major Features==============
``dill`` can pickle the following standard types:
- none, type, bool, int, float, complex, bytes, str, - tuple, list, dict, file, buffer, builtin, - Python classes, namedtuples, dataclasses, metaclasses, - instances of classes, - set, frozenset, array, functions, exceptions
``dill`` can also pickle more 'exotic' standard types:
- functions with yields, nested functions, lambdas, - cell, method, unboundmethod, module, code, methodwrapper, - methoddescriptor, getsetdescriptor, memberdescriptor, wrapperdescriptor, - dictproxy, slice, notimplemented, ellipsis, quit
``dill`` cannot yet pickle these standard types:
- frame, generator, traceback
``dill`` also provides the capability to:
- save and load Python interpreter sessions - save and extract the source code from functions and classes - interactively diagnose pickling errors
Current Release===============
The latest released version of ``dill`` is available from:
https://pypi.org/project/dill
``dill`` is distributed under a 3-clause BSD license.
Development Version===================
You can get the latest development version with all the shiny new features at:
https://github.com/uqfoundation
If you have a new contribution, please submit a pull request.
Installation============
``dill`` can be installed with ``pip``::
$ pip install dill
To optionally include the ``objgraph`` diagnostic tool in the install::
$ pip install dill[graph]
To optionally include the ``gprof2dot`` diagnostic tool in the install::
$ pip install dill[profile]
For windows users, to optionally install session history tools::
$ pip install dill[readline]
Requirements============
``dill`` requires:
- ``python`` (or ``pypy``), **>=3.8** - ``setuptools``, **>=42**
Optional requirements:
- ``objgraph``, **>=1.7.2** - ``gprof2dot``, **>=2022.7.29** - ``pyreadline``, **>=1.7.1** (on windows)
Basic Usage===========
``dill`` is a drop-in replacement for ``pickle``. Existing code can beupdated to allow complete pickling using::
>>> import dill as pickle
or::
>>> from dill import dumps, loads
``dumps`` converts the object to a unique byte string, and ``loads`` performsthe inverse operation::
>>> squared = lambda x: x**2 >>> loads(dumps(squared))(3) 9
There are a number of options to control serialization which are providedas keyword arguments to several ``dill`` functions:
* with *protocol*, the pickle protocol level can be set. This uses the same value as the ``pickle`` module, *DEFAULT_PROTOCOL*.* with *byref=True*, ``dill`` to behave a lot more like pickle with certain objects (like modules) pickled by reference as opposed to attempting to pickle the object itself.* with *recurse=True*, objects referred to in the global dictionary are recursively traced and pickled, instead of the default behavior of attempting to store the entire global dictionary.* with *fmode*, the contents of the file can be pickled along with the file handle, which is useful if the object is being sent over the wire to a remote system which does not have the original file on disk. Options are *HANDLE_FMODE* for just the handle, *CONTENTS_FMODE* for the file content and *FILE_FMODE* for content and handle.* with *ignore=False*, objects reconstructed with types defined in the top-level script environment use the existing type in the environment rather than a possibly different reconstructed type.
The default serialization can also be set globally in *dill.settings*.Thus, we can modify how ``dill`` handles references to the global dictionarylocally or globally::
>>> import dill.settings >>> dumps(absolute) == dumps(absolute, recurse=True) False >>> dill.settings['recurse'] = True >>> dumps(absolute) == dumps(absolute, recurse=True) True
``dill`` also includes source code inspection, as an alternate to pickling::
>>> import dill.source >>> print(dill.source.getsource(squared)) squared = lambda x:x**2
To aid in debugging pickling issues, use *dill.detect* which providestools like pickle tracing::
>>> import dill.detect >>> with dill.detect.trace(): >>> dumps(squared) ┬ F1: <function <lambda> at 0x7fe074f8c280> ├┬ F2: <function _create_function at 0x7fe074c49c10> │└ # F2 [34 B] ├┬ Co: <code object <lambda> at 0x7fe07501eb30, file "<stdin>", line 1> │├┬ F2: <function _create_code at 0x7fe074c49ca0> ││└ # F2 [19 B] │└ # Co [87 B] ├┬ D1: <dict object at 0x7fe0750d4680> │└ # D1 [22 B] ├┬ D2: <dict object at 0x7fe074c5a1c0> │└ # D2 [2 B] ├┬ D2: <dict object at 0x7fe074f903c0> │├┬ D2: <dict object at 0x7fe074f8ebc0> ││└ # D2 [2 B] │└ # D2 [23 B] └ # F1 [180 B]
With trace, we see how ``dill`` stored the lambda (``F1``) by first storing``_create_function``, the underlying code object (``Co``) and ``_create_code``(which is used to handle code objects), then we handle the reference tothe global dict (``D2``) plus other dictionaries (``D1`` and ``D2``) thatsave the lambda object's state. A ``#`` marks when the object is actually stored.
More Information================
Probably the best way to get started is to look at the documentation athttp://dill.rtfd.io. Also see ``dill.tests`` for a set of scripts thatdemonstrate how ``dill`` can serialize different Python objects. You canrun the test suite with ``python -m dill.tests``. The contents of anypickle file can be examined with ``undill``. As ``dill`` conforms tothe ``pickle`` interface, the examples and documentation found athttp://docs.python.org/library/pickle.html also apply to ``dill``if one will ``import dill as pickle``. The source code is also generallywell documented, so further questions may be resolved by inspecting thecode itself. Please feel free to submit a ticket on github, or ask aquestion on stackoverflow (**@Mike McKerns**).If you would like to share how you use ``dill`` in your work, please sendan email (to **mmckerns at uqfoundation dot org**).
Citation========
If you use ``dill`` to do research that leads to publication, we ask that youacknowledge use of ``dill`` by citing the following in your publication::
M.M. McKerns, L. Strand, T. Sullivan, A. Fang, M.A.G. Aivazis, "Building a framework for predictive science", Proceedings of the 10th Python in Science Conference, 2011; http://arxiv.org/pdf/1202.1056
Michael McKerns and Michael Aivazis, "pathos: a framework for heterogeneous computing", 2010- ; https://uqfoundation.github.io/project/pathos
Please see https://uqfoundation.github.io/project/pathos orhttp://arxiv.org/pdf/1202.1056 for further information.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697../../../bin/get_gprof,sha256=jZwza08tDhPEpPkkixPInUBIcjGxLGfpL1ngSFppopQ,2493
../../../bin/get_objgraph,sha256=BUf8yNZ_FCqN7E-ZzWvL1OtusOxMUpF1TtWcpiLaVSw,1687
../../../bin/undill,sha256=G_121H3ieAfCeSH1t9AHd0AuZwHFNQZQ1v9bZiMeoPA,623
dill-0.3.8.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
dill-0.3.8.dist-info/LICENSE,sha256=UeiKI-eId86r1yfCGcel4z9l2pugOsT9KFupBKoc4is,1790
dill-0.3.8.dist-info/METADATA,sha256=UxkSs2cU8JyrJsV5kS0QR9crJ07hrUJS2RiIMQaC4ss,10106
dill-0.3.8.dist-info/RECORD,,
dill-0.3.8.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
dill-0.3.8.dist-info/top_level.txt,sha256=HLSIyYIjQzJiBvs3_-16ntezE3j6mWGTW0DT1xDd7X0,5
dill/__diff.py,sha256=kirMxzB7E8lfjo21M5oIf7if95ny0aWhYB790KMpN08,7143
dill/__info__.py,sha256=Kmel_yLTyH-hwNC5cVfzN-LV08AbS_AvSa2uwMeIQdk,10756
dill/__init__.py,sha256=j-Jxl3H6bxatS0h2f8ywWs7DChwk7B9ozuZQBVcjYGU,3798
dill/__pycache__/__diff.cpython-312.pyc,,
dill/__pycache__/__info__.cpython-312.pyc,,
dill/__pycache__/__init__.cpython-312.pyc,,
dill/__pycache__/_dill.cpython-312.pyc,,
dill/__pycache__/_objects.cpython-312.pyc,,
dill/__pycache__/_shims.cpython-312.pyc,,
dill/__pycache__/detect.cpython-312.pyc,,
dill/__pycache__/logger.cpython-312.pyc,,
dill/__pycache__/objtypes.cpython-312.pyc,,
dill/__pycache__/pointers.cpython-312.pyc,,
dill/__pycache__/session.cpython-312.pyc,,
dill/__pycache__/settings.cpython-312.pyc,,
dill/__pycache__/source.cpython-312.pyc,,
dill/__pycache__/temp.cpython-312.pyc,,
dill/_dill.py,sha256=3Eo6gKj1sODJjgPgYNT8TU-YL6QNQ7rIeWPUVnRzyqQ,88548
dill/_objects.py,sha256=dPlUXzQIh8CA0fMy9NMbwwLGUPmXe5H8MdQtRWB1b_M,19605
dill/_shims.py,sha256=IuzQcyPET5VWmWMoSGStieoedvNXlb5suDpa4bykTbQ,6635
dill/detect.py,sha256=Mb-PfCxn1mg0l3TmHXyPNVEc4n3fuxc_nue6eL3-q_o,11114
dill/logger.py,sha256=YS5ZloAOKjJRZaOBRCaMUDWmWVQZcicvbXVSrz8L8XU,11134
dill/objtypes.py,sha256=BamGH3BEM6lLlxisuvXcGjsCRLNeoLs4_rFZrM5r2yM,736
dill/pointers.py,sha256=vnQzjwGtKMGnmbdYRXRWNLMyceNPSw4f7UpvwCXLYbE,4467
dill/session.py,sha256=NvCWpoP9r_rGBL2pOwwxOri8mFly5KlIWG3GwkBFnc0,23525
dill/settings.py,sha256=7I3yvSpPKstOqpoW2gv3X77kXK-hZlqCnF7nJUGhxTY,630
dill/source.py,sha256=DWfIxcBjpjbbKYz2DstV9kRdjajBdZLOcLXfsZsPo9U,45121
dill/temp.py,sha256=KJUry4t0UjQCh5t4LXcxNyMF_uOGHwcjTuNYTJD9qdA,8027
dill/tests/__init__.py,sha256=Gx-chVB-l-e7ncsGp2zF4BimTjbUyO7BY7RkrO835vY,479
dill/tests/__main__.py,sha256=fHhioQwcOvTPlf1RM_wVQ0Y3ndETWJOuXJQ2rVtqliA,899
dill/tests/__pycache__/__init__.cpython-312.pyc,,
dill/tests/__pycache__/__main__.cpython-312.pyc,,
dill/tests/__pycache__/test_abc.cpython-312.pyc,,
dill/tests/__pycache__/test_check.cpython-312.pyc,,
dill/tests/__pycache__/test_classdef.cpython-312.pyc,,
dill/tests/__pycache__/test_dataclasses.cpython-312.pyc,,
dill/tests/__pycache__/test_detect.cpython-312.pyc,,
dill/tests/__pycache__/test_dictviews.cpython-312.pyc,,
dill/tests/__pycache__/test_diff.cpython-312.pyc,,
dill/tests/__pycache__/test_extendpickle.cpython-312.pyc,,
dill/tests/__pycache__/test_fglobals.cpython-312.pyc,,
dill/tests/__pycache__/test_file.cpython-312.pyc,,
dill/tests/__pycache__/test_functions.cpython-312.pyc,,
dill/tests/__pycache__/test_functors.cpython-312.pyc,,
dill/tests/__pycache__/test_logger.cpython-312.pyc,,
dill/tests/__pycache__/test_mixins.cpython-312.pyc,,
dill/tests/__pycache__/test_module.cpython-312.pyc,,
dill/tests/__pycache__/test_moduledict.cpython-312.pyc,,
dill/tests/__pycache__/test_nested.cpython-312.pyc,,
dill/tests/__pycache__/test_objects.cpython-312.pyc,,
dill/tests/__pycache__/test_properties.cpython-312.pyc,,
dill/tests/__pycache__/test_pycapsule.cpython-312.pyc,,
dill/tests/__pycache__/test_recursive.cpython-312.pyc,,
dill/tests/__pycache__/test_registered.cpython-312.pyc,,
dill/tests/__pycache__/test_restricted.cpython-312.pyc,,
dill/tests/__pycache__/test_selected.cpython-312.pyc,,
dill/tests/__pycache__/test_session.cpython-312.pyc,,
dill/tests/__pycache__/test_source.cpython-312.pyc,,
dill/tests/__pycache__/test_temp.cpython-312.pyc,,
dill/tests/__pycache__/test_weakref.cpython-312.pyc,,
dill/tests/test_abc.py,sha256=BSjSKKCQ5_iPfFxAd0yBq4KSAJxelrlC3IzoAhjd1C4,4227
dill/tests/test_check.py,sha256=4F5gkX6zxY7C5sD2_0Tkqf3T3jmQl0K15FOxYUTZQl0,1396
dill/tests/test_classdef.py,sha256=fI3fVk4SlsjNMMs5RfU6DUCaxpP7YYRjvLZ2nhXMHuc,8600
dill/tests/test_dataclasses.py,sha256=yKjFuG24ymLtjk-sZZdhvNY7aDqerTDpMcfi_eV4ft0,890
dill/tests/test_detect.py,sha256=sE9THufHXCDysBPQ4QkN5DHn6DaIldVRAEciseIRH08,4083
dill/tests/test_dictviews.py,sha256=Jhol0cQWPwoQrp7OPxGhU8FNRX2GgfFp9fTahCvQEPA,1337
dill/tests/test_diff.py,sha256=5VIWf2fpV6auLHNfzkHLTrgx6AJBlE2xe5Wanfmq8TM,2667
dill/tests/test_extendpickle.py,sha256=gONrMBHO94Edhnqm1wo49hgzwmaxHs7L-86Hs-7albY,1315
dill/tests/test_fglobals.py,sha256=DCvdojmKcLN_X9vX4Qe1FbsqjeoJK-wsY2uJwBfNFro,1676
dill/tests/test_file.py,sha256=jUU2h8qaDOIe1mn_Ng7wqCZcd7Ucx3TAaI-K_90_Tbk,13578
dill/tests/test_functions.py,sha256=-mqTpUbzRu8GynjBGD25dRDm8qInIe07sRZmCcA_iXY,4267
dill/tests/test_functors.py,sha256=7rx9wLmrgFwF0gUm_-SGOISPYSok0XjmrQ-jFMRt6gs,930
dill/tests/test_logger.py,sha256=D9zGRaA-CEadG13orPS_D4gPVZlkqXf9Zu8wn2oMiYc,2385
dill/tests/test_mixins.py,sha256=YtB24BjodooLj85ijFbAxiM7LlFQZAUL8RQVx9vIAwY,4007
dill/tests/test_module.py,sha256=KLl_gZJJqDY7S_bD5wCqKL8JQCS0MDMoipVQSDfASlo,1943
dill/tests/test_moduledict.py,sha256=faXG6-5AcmCfP3xe2FYGOUdSosU-9TWnKU_ZVqPDaxY,1182
dill/tests/test_nested.py,sha256=ViWiOrChLZktS0z6qyKqMxDdTuy9kAX4qMgH_OreMcc,3146
dill/tests/test_objects.py,sha256=pPAth0toC_UWztuKHC7NZlsRBb0g_gSAt70UbUtXEXo,1931
dill/tests/test_properties.py,sha256=h35c-lYir1JG6oLPtrA0eYE0xoSohIimsA3yIfRw6yA,1346
dill/tests/test_pycapsule.py,sha256=EXFyB6g1Wx9O9LM6StIeUKhrhln4_hou1xrtGwkt4Cw,1417
dill/tests/test_recursive.py,sha256=bfr-BsK1Xu0PU7l2srHsDXdY2l1LeM3L3w7NraXO0cc,4182
dill/tests/test_registered.py,sha256=J3oku053VfdJgYh4Z5_kyFRf-C52JglIzjcyxEaYOhk,1573
dill/tests/test_restricted.py,sha256=xLMIae8sYJksAj9hKKyHFHIL8vtbGpFeOULz59snYM4,783
dill/tests/test_selected.py,sha256=Hp-AAd6Qp5FJZ-vY_Bbejo5Rg6xFstec5QkSg5D7Aac,3218
dill/tests/test_session.py,sha256=KoSPvs4c4VJ8mFMF7EUlD_3GwcOhhipt9fqHr--Go-4,10161
dill/tests/test_source.py,sha256=wZTYBbpzUwj3Mz5OjrHQKfskaVVwuy2UQDg5p2wLbT4,6036
dill/tests/test_temp.py,sha256=F_7nJkSetLIBSAYMw1-hYh03iVrEYwGs-4GIUzoBOfY,2619
dill/tests/test_weakref.py,sha256=mrjZP5aPtUP1wBD6ibPsDsfI9ffmq_Ykt7ltoodi5Lg,160212345Wheel-Version: 1.0Generator: bdist_wheel (0.37.1)Root-Is-Purelib: trueTag: py3-none-any
1dill1pip123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278Metadata-Version: 2.4Name: fsspecVersion: 2025.3.0Summary: File-system specificationProject-URL: Changelog, https://filesystem-spec.readthedocs.io/en/latest/changelog.htmlProject-URL: Documentation, https://filesystem-spec.readthedocs.io/en/latest/Project-URL: Homepage, https://github.com/fsspec/filesystem_specMaintainer-email: Martin Durant <mdurant@anaconda.com>License: BSD 3-Clause License Copyright (c) 2018, Martin Durant All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.License-File: LICENSEKeywords: fileClassifier: Development Status :: 4 - BetaClassifier: Intended Audience :: DevelopersClassifier: License :: OSI Approved :: BSD LicenseClassifier: Operating System :: OS IndependentClassifier: Programming Language :: Python :: 3.8Classifier: Programming Language :: Python :: 3.9Classifier: Programming Language :: Python :: 3.10Classifier: Programming Language :: Python :: 3.11Classifier: Programming Language :: Python :: 3.12Classifier: Programming Language :: Python :: 3.13Requires-Python: >=3.8Provides-Extra: abfsRequires-Dist: adlfs; extra == 'abfs'Provides-Extra: adlRequires-Dist: adlfs; extra == 'adl'Provides-Extra: arrowRequires-Dist: pyarrow>=1; extra == 'arrow'Provides-Extra: daskRequires-Dist: dask; extra == 'dask'Requires-Dist: distributed; extra == 'dask'Provides-Extra: devRequires-Dist: pre-commit; extra == 'dev'Requires-Dist: ruff; extra == 'dev'Provides-Extra: docRequires-Dist: numpydoc; extra == 'doc'Requires-Dist: sphinx; extra == 'doc'Requires-Dist: sphinx-design; extra == 'doc'Requires-Dist: sphinx-rtd-theme; extra == 'doc'Requires-Dist: yarl; extra == 'doc'Provides-Extra: dropboxRequires-Dist: dropbox; extra == 'dropbox'Requires-Dist: dropboxdrivefs; extra == 'dropbox'Requires-Dist: requests; extra == 'dropbox'Provides-Extra: entrypointsProvides-Extra: fullRequires-Dist: adlfs; extra == 'full'Requires-Dist: aiohttp!=4.0.0a0,!=4.0.0a1; extra == 'full'Requires-Dist: dask; extra == 'full'Requires-Dist: distributed; extra == 'full'Requires-Dist: dropbox; extra == 'full'Requires-Dist: dropboxdrivefs; extra == 'full'Requires-Dist: fusepy; extra == 'full'Requires-Dist: gcsfs; extra == 'full'Requires-Dist: libarchive-c; extra == 'full'Requires-Dist: ocifs; extra == 'full'Requires-Dist: panel; extra == 'full'Requires-Dist: paramiko; extra == 'full'Requires-Dist: pyarrow>=1; extra == 'full'Requires-Dist: pygit2; extra == 'full'Requires-Dist: requests; extra == 'full'Requires-Dist: s3fs; extra == 'full'Requires-Dist: smbprotocol; extra == 'full'Requires-Dist: tqdm; extra == 'full'Provides-Extra: fuseRequires-Dist: fusepy; extra == 'fuse'Provides-Extra: gcsRequires-Dist: gcsfs; extra == 'gcs'Provides-Extra: gitRequires-Dist: pygit2; extra == 'git'Provides-Extra: githubRequires-Dist: requests; extra == 'github'Provides-Extra: gsRequires-Dist: gcsfs; extra == 'gs'Provides-Extra: guiRequires-Dist: panel; extra == 'gui'Provides-Extra: hdfsRequires-Dist: pyarrow>=1; extra == 'hdfs'Provides-Extra: httpRequires-Dist: aiohttp!=4.0.0a0,!=4.0.0a1; extra == 'http'Provides-Extra: libarchiveRequires-Dist: libarchive-c; extra == 'libarchive'Provides-Extra: ociRequires-Dist: ocifs; extra == 'oci'Provides-Extra: s3Requires-Dist: s3fs; extra == 's3'Provides-Extra: sftpRequires-Dist: paramiko; extra == 'sftp'Provides-Extra: smbRequires-Dist: smbprotocol; extra == 'smb'Provides-Extra: sshRequires-Dist: paramiko; extra == 'ssh'Provides-Extra: testRequires-Dist: aiohttp!=4.0.0a0,!=4.0.0a1; extra == 'test'Requires-Dist: numpy; extra == 'test'Requires-Dist: pytest; extra == 'test'Requires-Dist: pytest-asyncio!=0.22.0; extra == 'test'Requires-Dist: pytest-benchmark; extra == 'test'Requires-Dist: pytest-cov; extra == 'test'Requires-Dist: pytest-mock; extra == 'test'Requires-Dist: pytest-recording; extra == 'test'Requires-Dist: pytest-rerunfailures; extra == 'test'Requires-Dist: requests; extra == 'test'Provides-Extra: test-downstreamRequires-Dist: aiobotocore<3.0.0,>=2.5.4; extra == 'test-downstream'Requires-Dist: dask[dataframe,test]; extra == 'test-downstream'Requires-Dist: moto[server]<5,>4; extra == 'test-downstream'Requires-Dist: pytest-timeout; extra == 'test-downstream'Requires-Dist: xarray; extra == 'test-downstream'Provides-Extra: test-fullRequires-Dist: adlfs; extra == 'test-full'Requires-Dist: aiohttp!=4.0.0a0,!=4.0.0a1; extra == 'test-full'Requires-Dist: cloudpickle; extra == 'test-full'Requires-Dist: dask; extra == 'test-full'Requires-Dist: distributed; extra == 'test-full'Requires-Dist: dropbox; extra == 'test-full'Requires-Dist: dropboxdrivefs; extra == 'test-full'Requires-Dist: fastparquet; extra == 'test-full'Requires-Dist: fusepy; extra == 'test-full'Requires-Dist: gcsfs; extra == 'test-full'Requires-Dist: jinja2; extra == 'test-full'Requires-Dist: kerchunk; extra == 'test-full'Requires-Dist: libarchive-c; extra == 'test-full'Requires-Dist: lz4; extra == 'test-full'Requires-Dist: notebook; extra == 'test-full'Requires-Dist: numpy; extra == 'test-full'Requires-Dist: ocifs; extra == 'test-full'Requires-Dist: pandas; extra == 'test-full'Requires-Dist: panel; extra == 'test-full'Requires-Dist: paramiko; extra == 'test-full'Requires-Dist: pyarrow; extra == 'test-full'Requires-Dist: pyarrow>=1; extra == 'test-full'Requires-Dist: pyftpdlib; extra == 'test-full'Requires-Dist: pygit2; extra == 'test-full'Requires-Dist: pytest; extra == 'test-full'Requires-Dist: pytest-asyncio!=0.22.0; extra == 'test-full'Requires-Dist: pytest-benchmark; extra == 'test-full'Requires-Dist: pytest-cov; extra == 'test-full'Requires-Dist: pytest-mock; extra == 'test-full'Requires-Dist: pytest-recording; extra == 'test-full'Requires-Dist: pytest-rerunfailures; extra == 'test-full'Requires-Dist: python-snappy; extra == 'test-full'Requires-Dist: requests; extra == 'test-full'Requires-Dist: smbprotocol; extra == 'test-full'Requires-Dist: tqdm; extra == 'test-full'Requires-Dist: urllib3; extra == 'test-full'Requires-Dist: zarr; extra == 'test-full'Requires-Dist: zstandard; extra == 'test-full'Provides-Extra: tqdmRequires-Dist: tqdm; extra == 'tqdm'Description-Content-Type: text/markdown
# filesystem_spec
[](https://pypi.python.org/pypi/fsspec/)[](https://anaconda.org/conda-forge/fsspec)[](https://filesystem-spec.readthedocs.io/en/latest/?badge=latest)
A specification for pythonic filesystems.
## Install
```bashpip install fsspec```
would install the base fsspec. Various optionally supported features might require specification of customextra require, e.g. `pip install fsspec[ssh]` will install dependencies for `ssh` backends support.Use `pip install fsspec[full]` for installation of all known extra dependencies.
Up-to-date package also provided through conda-forge distribution:
```bashconda install -c conda-forge fsspec```
## Purpose
To produce a template or specification for a file-system interface, that specific implementations should follow,so that applications making use of them can rely on a common behaviour and not have to worry about the specificinternal implementation decisions with any given backend. Many such implementations are included in this package,or in sister projects such as `s3fs` and `gcsfs`.
In addition, if this is well-designed, then additional functionality, such as a key-value store or FUSEmounting of the file-system implementation may be available for all implementations "for free".
## Documentation
Please refer to [RTD](https://filesystem-spec.readthedocs.io/en/latest/?badge=latest)
## Develop
fsspec uses GitHub Actions for CI. Environment files can be foundin the "ci/" directory. Note that the main environment is called "py38",but it is expected that the version of python installed be adjustable atCI runtime. For local use, pick a version suitable for you.
```bash# For a new environment (mamba / conda).mamba create -n fsspec -c conda-forge python=3.9 -yconda activate fsspec
# Standard dev install with docs and tests.pip install -e ".[dev,doc,test]"
# Full tests except for downstreampip install s3fspip uninstall s3fspip install -e .[dev,doc,test_full]pip install s3fs --no-depspytest -v
# Downstream tests.sh install_s3fs.sh# Windows powershell.install_s3fs.sh```
### Testing
Tests can be run in the dev environment, if activated, via ``pytest fsspec``.
The full fsspec suite requires a system-level docker, docker-compose, and fuseinstallation. If only making changes to one backend implementation, it isnot generally necessary to run all tests locally.
It is expected that contributors ensure that any change to fsspec does notcause issues or regressions for either other fsspec-related packages suchas gcsfs and s3fs, nor for downstream users of fsspec. The "downstream" CIrun and corresponding environment file run a set of tests from the dasktest suite, and very minimal tests against pandas and zarr from thetest_downstream.py module in this repo.
### Code Formatting
fsspec uses [Black](https://black.readthedocs.io/en/stable) to ensurea consistent code format throughout the project.Run ``black fsspec`` from the root of the filesystem_spec repository toauto-format your code. Additionally, many editors have plugins that will apply``black`` as you edit files. ``black`` is included in the ``tox`` environments.
Optionally, you may wish to setup [pre-commit hooks](https://pre-commit.com) toautomatically run ``black`` when you make a git commit.Run ``pre-commit install --install-hooks`` from the root of thefilesystem_spec repository to setup pre-commit hooks. ``black`` will now be runbefore you commit, reformatting any changed files. You can format withoutcommitting via ``pre-commit run`` or skip these checks with ``git commit--no-verify``.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115fsspec-2025.3.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
fsspec-2025.3.0.dist-info/METADATA,sha256=L2OjjikjNWpjvp8i5_ec515Cd09eUi8qZ_3peQmWG8M,11747
fsspec-2025.3.0.dist-info/RECORD,,
fsspec-2025.3.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
fsspec-2025.3.0.dist-info/licenses/LICENSE,sha256=LcNUls5TpzB5FcAIqESq1T53K0mzTN0ARFBnaRQH7JQ,1513
fsspec/__init__.py,sha256=l9MJaNNV2d4wKpCtMvXDr55n92DkdrAayGy3F9ICjzk,1998
fsspec/__pycache__/__init__.cpython-312.pyc,,
fsspec/__pycache__/_version.cpython-312.pyc,,
fsspec/__pycache__/archive.cpython-312.pyc,,
fsspec/__pycache__/asyn.cpython-312.pyc,,
fsspec/__pycache__/caching.cpython-312.pyc,,
fsspec/__pycache__/callbacks.cpython-312.pyc,,
fsspec/__pycache__/compression.cpython-312.pyc,,
fsspec/__pycache__/config.cpython-312.pyc,,
fsspec/__pycache__/conftest.cpython-312.pyc,,
fsspec/__pycache__/core.cpython-312.pyc,,
fsspec/__pycache__/dircache.cpython-312.pyc,,
fsspec/__pycache__/exceptions.cpython-312.pyc,,
fsspec/__pycache__/fuse.cpython-312.pyc,,
fsspec/__pycache__/generic.cpython-312.pyc,,
fsspec/__pycache__/gui.cpython-312.pyc,,
fsspec/__pycache__/json.cpython-312.pyc,,
fsspec/__pycache__/mapping.cpython-312.pyc,,
fsspec/__pycache__/parquet.cpython-312.pyc,,
fsspec/__pycache__/registry.cpython-312.pyc,,
fsspec/__pycache__/spec.cpython-312.pyc,,
fsspec/__pycache__/transaction.cpython-312.pyc,,
fsspec/__pycache__/utils.cpython-312.pyc,,
fsspec/_version.py,sha256=mWdw-j-kCQGfmn6901GQSyjFXi2pK3h-NrKTuLRVqCw,517
fsspec/archive.py,sha256=vM6t_lgV6lBWbBYwpm3S4ofBQFQxUPr5KkDQrrQcQro,2411
fsspec/asyn.py,sha256=rsnCsFUmBZmKJqg9m-IDWInoQtE4wV0rGDZEXZwuU3c,36500
fsspec/caching.py,sha256=oHVy9zpy4Oqk5f1t3-Q31bbw0tsmfddGGKLJs__OdKA,32790
fsspec/callbacks.py,sha256=BDIwLzK6rr_0V5ch557fSzsivCElpdqhXr5dZ9Te-EE,9210
fsspec/compression.py,sha256=jCSUMJu-zSNyrusnHT0wKXgOd1tTJR6vM126i5SR5Zc,4865
fsspec/config.py,sha256=LF4Zmu1vhJW7Je9Q-cwkRc3xP7Rhyy7Xnwj26Z6sv2g,4279
fsspec/conftest.py,sha256=fVfx-NLrH_OZS1TIpYNoPzM7efEcMoL62reHOdYeFCA,1245
fsspec/core.py,sha256=1tLctwr7sF1VO3djc_UkjhJ8IAEy0TUMH_bb07Sw17E,23828
fsspec/dircache.py,sha256=YzogWJrhEastHU7vWz-cJiJ7sdtLXFXhEpInGKd4EcM,2717
fsspec/exceptions.py,sha256=pauSLDMxzTJMOjvX1WEUK0cMyFkrFxpWJsyFywav7A8,331
fsspec/fuse.py,sha256=Q-3NOOyLqBfYa4Db5E19z_ZY36zzYHtIs1mOUasItBQ,10177
fsspec/generic.py,sha256=AFbo-mHBt5QJV1Aplg5CJuUiiJ4bNQhcKRuwkZJdWac,13761
fsspec/gui.py,sha256=xBnHL2-r0LVwhDAtnHoPpXts7jd4Z32peawCJiI-7lI,13975
fsspec/implementations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
fsspec/implementations/__pycache__/__init__.cpython-312.pyc,,
fsspec/implementations/__pycache__/arrow.cpython-312.pyc,,
fsspec/implementations/__pycache__/asyn_wrapper.cpython-312.pyc,,
fsspec/implementations/__pycache__/cache_mapper.cpython-312.pyc,,
fsspec/implementations/__pycache__/cache_metadata.cpython-312.pyc,,
fsspec/implementations/__pycache__/cached.cpython-312.pyc,,
fsspec/implementations/__pycache__/dask.cpython-312.pyc,,
fsspec/implementations/__pycache__/data.cpython-312.pyc,,
fsspec/implementations/__pycache__/dbfs.cpython-312.pyc,,
fsspec/implementations/__pycache__/dirfs.cpython-312.pyc,,
fsspec/implementations/__pycache__/ftp.cpython-312.pyc,,
fsspec/implementations/__pycache__/git.cpython-312.pyc,,
fsspec/implementations/__pycache__/github.cpython-312.pyc,,
fsspec/implementations/__pycache__/http.cpython-312.pyc,,
fsspec/implementations/__pycache__/http_sync.cpython-312.pyc,,
fsspec/implementations/__pycache__/jupyter.cpython-312.pyc,,
fsspec/implementations/__pycache__/libarchive.cpython-312.pyc,,
fsspec/implementations/__pycache__/local.cpython-312.pyc,,
fsspec/implementations/__pycache__/memory.cpython-312.pyc,,
fsspec/implementations/__pycache__/reference.cpython-312.pyc,,
fsspec/implementations/__pycache__/sftp.cpython-312.pyc,,
fsspec/implementations/__pycache__/smb.cpython-312.pyc,,
fsspec/implementations/__pycache__/tar.cpython-312.pyc,,
fsspec/implementations/__pycache__/webhdfs.cpython-312.pyc,,
fsspec/implementations/__pycache__/zip.cpython-312.pyc,,
fsspec/implementations/arrow.py,sha256=721Dikne_lV_0tlgk9jyKmHL6W-5MT0h2LKGvOYQTPI,8623
fsspec/implementations/asyn_wrapper.py,sha256=PNkYdHiLVWwk-GJok5O6dTnhPwDaSU9QTtBTE9CIRec,3082
fsspec/implementations/cache_mapper.py,sha256=W4wlxyPxZbSp9ItJ0pYRVBMh6bw9eFypgP6kUYuuiI4,2421
fsspec/implementations/cache_metadata.py,sha256=pcOJYcBQY5OaC7Yhw0F3wjg08QLYApGmoISCrbs59ks,8511
fsspec/implementations/cached.py,sha256=KA6c4jqrGeeg8WNPLsh8FkL3KeRAQtGLzKw18vSF1CI,32820
fsspec/implementations/dask.py,sha256=CXZbJzIVOhKV8ILcxuy3bTvcacCueAbyQxmvAkbPkrk,4466
fsspec/implementations/data.py,sha256=LDLczxRh8h7x39Zjrd-GgzdQHr78yYxDlrv2C9Uxb5E,1658
fsspec/implementations/dbfs.py,sha256=XwpotuS_ncz3XK1dkUteww9GnTja7HoY91c0m4GUfwI,15092
fsspec/implementations/dirfs.py,sha256=f1sGnQ9Vf0xTxrXo4jDeBy4Qfq3RTqAEemqBSeb0hwY,12108
fsspec/implementations/ftp.py,sha256=sorsczLp_2J3ukONsbZY-11sRZP6H5a3V7XXf6o6ip0,11936
fsspec/implementations/git.py,sha256=4SElW9U5d3k3_ITlvUAx59Yk7XLNRTqkGa2C3hCUkWM,3754
fsspec/implementations/github.py,sha256=eAn1kJ7VeWR6gVoVRLBYclF_rQDXSJU-xzMXpvPQWqs,8002
fsspec/implementations/http.py,sha256=_gLt0yGbVOYWvE9pK81WCC-3TgbOMOKJYllBU72ALo8,30138
fsspec/implementations/http_sync.py,sha256=vHf2_O9RRlaW6k-R4hsS-91BkqyPIlc0zwo_ENNGU4U,30147
fsspec/implementations/jupyter.py,sha256=B2uj7OEm7yIk-vRSsO37_ND0t0EBvn4B-Su43ibN4Pg,3811
fsspec/implementations/libarchive.py,sha256=5_I2DiLXwQ1JC8x-K7jXu-tBwhO9dj7tFLnb0bTnVMQ,7102
fsspec/implementations/local.py,sha256=g2iK8uWPGkSiI6bwmnIRXhJMQvTegCmXZ8Kb8ojhvAo,15543
fsspec/implementations/memory.py,sha256=cLNrK9wk97sl4Tre9uVDXWj6mEHvvVVIgaVgNA5KVIg,10527
fsspec/implementations/reference.py,sha256=t23prs_5ugXJnYhLxLlPLPyagrx4_ofZWR_oyX9wd3Q,48703
fsspec/implementations/sftp.py,sha256=fMY9XZcmpjszQ2tCqO_TPaJesaeD_Dv7ptYzgUPGoO0,5631
fsspec/implementations/smb.py,sha256=5fhu8h06nOLBPh2c48aT7WBRqh9cEcbIwtyu06wTjec,15236
fsspec/implementations/tar.py,sha256=dam78Tp_CozybNqCY2JYgGBS3Uc9FuJUAT9oB0lolOs,4111
fsspec/implementations/webhdfs.py,sha256=G9wGywj7BkZk4Mu9zXu6HaDlEqX4F8Gw1i4k46CP_-o,16769
fsspec/implementations/zip.py,sha256=9LBMHPft2OutJl2Ft-r9u_z3GptLkc2n91ur2A3bCbg,6072
fsspec/json.py,sha256=65sQ0Y7mTj33u_Y4IId5up4abQ3bAel4E4QzbKMiQSg,3826
fsspec/mapping.py,sha256=m2ndB_gtRBXYmNJg0Ie1-BVR75TFleHmIQBzC-yWhjU,8343
fsspec/parquet.py,sha256=6ibAmG527L5JNFS0VO8BDNlxHdA3bVYqdByeiFgpUVM,19448
fsspec/registry.py,sha256=Bbur6KJilN62hx_lSRgCx9HlKrv91pLpdEPG7Vzme1M,11566
fsspec/spec.py,sha256=l7ZEbgLsnrFuS-yrGl9re6ia1Yts1_10RqGV_mT-5P8,76032
fsspec/tests/abstract/__init__.py,sha256=4xUJrv7gDgc85xAOz1p-V_K1hrsdMWTSa0rviALlJk8,10181
fsspec/tests/abstract/__pycache__/__init__.cpython-312.pyc,,
fsspec/tests/abstract/__pycache__/common.cpython-312.pyc,,
fsspec/tests/abstract/__pycache__/copy.cpython-312.pyc,,
fsspec/tests/abstract/__pycache__/get.cpython-312.pyc,,
fsspec/tests/abstract/__pycache__/mv.cpython-312.pyc,,
fsspec/tests/abstract/__pycache__/open.cpython-312.pyc,,
fsspec/tests/abstract/__pycache__/pipe.cpython-312.pyc,,
fsspec/tests/abstract/__pycache__/put.cpython-312.pyc,,
fsspec/tests/abstract/common.py,sha256=1GQwNo5AONzAnzZj0fWgn8NJPLXALehbsuGxS3FzWVU,4973
fsspec/tests/abstract/copy.py,sha256=gU5-d97U3RSde35Vp4RxPY4rWwL744HiSrJ8IBOp9-8,19967
fsspec/tests/abstract/get.py,sha256=vNR4HztvTR7Cj56AMo7_tx7TeYz1Jgr_2Wb8Lv-UiBY,20755
fsspec/tests/abstract/mv.py,sha256=k8eUEBIrRrGMsBY5OOaDXdGnQUKGwDIfQyduB6YD3Ns,1982
fsspec/tests/abstract/open.py,sha256=Fi2PBPYLbRqysF8cFm0rwnB41kMdQVYjq8cGyDXp3BU,329
fsspec/tests/abstract/pipe.py,sha256=LFzIrLCB5GLXf9rzFKJmE8AdG7LQ_h4bJo70r8FLPqM,402
fsspec/tests/abstract/put.py,sha256=7aih17OKB_IZZh1Mkq1eBDIjobhtMQmI8x-Pw-S_aZk,21201
fsspec/transaction.py,sha256=xliRG6U2Zf3khG4xcw9WiB-yAoqJSHEGK_VjHOdtgo0,2398
fsspec/utils.py,sha256=A11t25RnpiQ30RO6xeR0Qqlu3fGj8bnc40jg08tlYSI,229801234Wheel-Version: 1.0Generator: hatchling 1.27.0Root-Is-Purelib: trueTag: py3-none-any1234567891011121314151617181920212223242526272829BSD 3-Clause License
Copyright (c) 2018, Martin DurantAll rights reserved.
Redistribution and use in source and binary forms, with or withoutmodification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THEIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AREDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLEFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIALDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS ORSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVERCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USEOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.1pip123456789101112131415161718192021222324252627282930BSD 3-Clause License
- Copyright (c) 2012-Present, IPython Development Team
All rights reserved.
Redistribution and use in source and binary forms, with or withoutmodification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THEIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AREDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLEFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIALDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS ORSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVERCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USEOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.1234567891011121314151617181920212223242526Metadata-Version: 2.3Name: ipython_pygments_lexersVersion: 1.1.1Summary: Defines a variety of Pygments lexers for highlighting IPython code.Author-email: The IPython Development Team <ipython-dev@python.org>Requires-Python: >=3.8Description-Content-Type: text/markdownClassifier: Framework :: IPythonClassifier: License :: OSI Approved :: BSD LicenseRequires-Dist: pygmentsProject-URL: Source, https://github.com/ipython/ipython-pygments-lexers
A [Pygments](https://pygments.org/) plugin for IPython code & console sessions
[IPython](https://ipython.org/) is an interactive Python shell. Among other features,it adds some special convenience syntax, including `%magics`, `!shell commands`and `help?`. This package contains lexers for these, to use with the Pygments syntaxhighlighting package.
- The `ipython` lexer should be used where only input code is highlighted- The `ipythonconsole` lexer works for an IPython session, including code, prompts, output and tracebacks.
These lexers were previously part of IPython itself (in `IPython.lib.lexers`),but have now been moved to a separate package.
12345678__pycache__/ipython_pygments_lexers.cpython-312.pyc,,
ipython_pygments_lexers-1.1.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
ipython_pygments_lexers-1.1.1.dist-info/LICENSE,sha256=sdDbwPp5d000uOLQrskdUNjK8F97QPwiwwEKS9mtK_k,1535
ipython_pygments_lexers-1.1.1.dist-info/METADATA,sha256=azjAlGvbxHePTjjiKYVHy9fROuupl57E5KQS6r-9-ts,1121
ipython_pygments_lexers-1.1.1.dist-info/RECORD,,
ipython_pygments_lexers-1.1.1.dist-info/WHEEL,sha256=CpUCUxeHQbRN5UGRQHYRJorO5Af-Qy_fHMctcQ8DSGI,82
ipython_pygments_lexers-1.1.1.dist-info/entry_points.txt,sha256=hyhe6r0UvHvZPV9EJvyujIlb8CgtRlQ7R6obhvM_s-Y,170
ipython_pygments_lexers.py,sha256=IPM8mGgS8w15Y3yCSnkvbKYvGAv67t9OwXHwtaKFCpc,196561234Wheel-Version: 1.0Generator: flit 3.10.1Root-Is-Purelib: trueTag: py3-none-any12345[pygments.lexers]ipython=ipython_pygments_lexers:IPythonLexeripython3=ipython_pygments_lexers:IPython3Lexeripythonconsole=ipython_pygments_lexers:IPythonConsoleLexer
1234567891011121314151617181920212223242526272829303132333435363738"""Jinja is a template engine written in pure Python. It provides anon-XML syntax that supports inline expressions and an optionalsandboxed environment."""
from .bccache import BytecodeCache as BytecodeCachefrom .bccache import FileSystemBytecodeCache as FileSystemBytecodeCachefrom .bccache import MemcachedBytecodeCache as MemcachedBytecodeCachefrom .environment import Environment as Environmentfrom .environment import Template as Templatefrom .exceptions import TemplateAssertionError as TemplateAssertionErrorfrom .exceptions import TemplateError as TemplateErrorfrom .exceptions import TemplateNotFound as TemplateNotFoundfrom .exceptions import TemplateRuntimeError as TemplateRuntimeErrorfrom .exceptions import TemplatesNotFound as TemplatesNotFoundfrom .exceptions import TemplateSyntaxError as TemplateSyntaxErrorfrom .exceptions import UndefinedError as UndefinedErrorfrom .loaders import BaseLoader as BaseLoaderfrom .loaders import ChoiceLoader as ChoiceLoaderfrom .loaders import DictLoader as DictLoaderfrom .loaders import FileSystemLoader as FileSystemLoaderfrom .loaders import FunctionLoader as FunctionLoaderfrom .loaders import ModuleLoader as ModuleLoaderfrom .loaders import PackageLoader as PackageLoaderfrom .loaders import PrefixLoader as PrefixLoaderfrom .runtime import ChainableUndefined as ChainableUndefinedfrom .runtime import DebugUndefined as DebugUndefinedfrom .runtime import make_logging_undefined as make_logging_undefinedfrom .runtime import StrictUndefined as StrictUndefinedfrom .runtime import Undefined as Undefinedfrom .utils import clear_caches as clear_cachesfrom .utils import is_undefined as is_undefinedfrom .utils import pass_context as pass_contextfrom .utils import pass_environment as pass_environmentfrom .utils import pass_eval_context as pass_eval_contextfrom .utils import select_autoescape as select_autoescape
__version__ = "3.1.6"123456import re
# generated by scripts/generate_identifier_pattern.pypattern = re.compile( r"[\w·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-ٰٟۖ-ۜ۟-۪ۤۧۨ-ܑۭܰ-݊ަ-ް߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࣓-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣঁ-ঃ়া-ৄেৈো-্ৗৢৣ৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑੰੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୢୣஂா-ூெ-ைொ-்ௗఀ-ఄా-ౄె-ైొ-్ౕౖౢౣಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣංඃ්ා-ුූෘ-ෟෲෳัิ-ฺ็-๎ັິ-ູົຼ່-ໍ༹༘༙༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏႚ-ႝ፝-፟ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝᠋-᠍ᢅᢆᢩᤠ-ᤫᤰ-᤻ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼᪰-᪽ᬀ-ᬄ᬴-᭄᭫-᭳ᮀ-ᮂᮡ-ᮭ᯦-᯳ᰤ-᰷᳐-᳔᳒-᳨᳭ᳲ-᳴᳷-᳹᷀-᷹᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰℘℮⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧꢀꢁꢴ-ꣅ꣠-꣱ꣿꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀ꧥꨩ-ꨶꩃꩌꩍꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭ﬞ︀-️︠-︯︳︴﹍-﹏_𐇽𐋠𐍶-𐍺𐨁-𐨃𐨅𐨆𐨌-𐨏𐨸-𐨿𐨺𐫦𐫥𐴤-𐽆𐴧-𐽐𑀀-𑀂𑀸-𑁆𑁿-𑂂𑂰-𑂺𑄀-𑄂𑄧-𑄴𑅅𑅆𑅳𑆀-𑆂𑆳-𑇀𑇉-𑇌𑈬-𑈷𑈾𑋟-𑋪𑌀-𑌃𑌻𑌼𑌾-𑍄𑍇𑍈𑍋-𑍍𑍗𑍢𑍣𑍦-𑍬𑍰-𑍴𑐵-𑑆𑑞𑒰-𑓃𑖯-𑖵𑖸-𑗀𑗜𑗝𑘰-𑙀𑚫-𑚷𑜝-𑜫𑠬-𑠺𑨁-𑨊𑨳-𑨹𑨻-𑨾𑩇𑩑-𑩛𑪊-𑪙𑰯-𑰶𑰸-𑰿𑲒-𑲧𑲩-𑲶𑴱-𑴶𑴺𑴼𑴽𑴿-𑵅𑵇𑶊-𑶎𑶐𑶑𑶓-𑶗𑻳-𑻶𖫰-𖫴𖬰-𖬶𖽑-𖽾𖾏-𖾒𛲝𛲞𝅥-𝅩𝅭-𝅲𝅻-𝆂𝆅-𝆋𝆪-𝆭𝉂-𝉄𝨀-𝨶𝨻-𝩬𝩵𝪄𝪛-𝪟𝪡-𝪯𞀀-𞀆𞀈-𞀘𞀛-𞀡𞀣𞀤𞀦-𞣐𞀪-𞣖𞥄-𞥊󠄀-󠇯]+" # noqa: B950)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899import inspectimport typing as tfrom functools import WRAPPER_ASSIGNMENTSfrom functools import wraps
from .utils import _PassArgfrom .utils import pass_eval_context
if t.TYPE_CHECKING: import typing_extensions as te
V = t.TypeVar("V")
def async_variant(normal_func): # type: ignore def decorator(async_func): # type: ignore pass_arg = _PassArg.from_obj(normal_func) need_eval_context = pass_arg is None
if pass_arg is _PassArg.environment:
def is_async(args: t.Any) -> bool: return t.cast(bool, args[0].is_async)
else:
def is_async(args: t.Any) -> bool: return t.cast(bool, args[0].environment.is_async)
# Take the doc and annotations from the sync function, but the # name from the async function. Pallets-Sphinx-Themes # build_function_directive expects __wrapped__ to point to the # sync function. async_func_attrs = ("__module__", "__name__", "__qualname__") normal_func_attrs = tuple(set(WRAPPER_ASSIGNMENTS).difference(async_func_attrs))
@wraps(normal_func, assigned=normal_func_attrs) @wraps(async_func, assigned=async_func_attrs, updated=()) def wrapper(*args, **kwargs): # type: ignore b = is_async(args)
if need_eval_context: args = args[1:]
if b: return async_func(*args, **kwargs)
return normal_func(*args, **kwargs)
if need_eval_context: wrapper = pass_eval_context(wrapper)
wrapper.jinja_async_variant = True # type: ignore[attr-defined] return wrapper
return decorator
_common_primitives = {int, float, bool, str, list, dict, tuple, type(None)}
async def auto_await(value: t.Union[t.Awaitable["V"], "V"]) -> "V": # Avoid a costly call to isawaitable if type(value) in _common_primitives: return t.cast("V", value)
if inspect.isawaitable(value): return await t.cast("t.Awaitable[V]", value)
return value
class _IteratorToAsyncIterator(t.Generic[V]): def __init__(self, iterator: "t.Iterator[V]"): self._iterator = iterator
def __aiter__(self) -> "te.Self": return self
async def __anext__(self) -> V: try: return next(self._iterator) except StopIteration as e: raise StopAsyncIteration(e.value) from e
def auto_aiter( iterable: "t.Union[t.AsyncIterable[V], t.Iterable[V]]",) -> "t.AsyncIterator[V]": if hasattr(iterable, "__aiter__"): return iterable.__aiter__() else: return _IteratorToAsyncIterator(iter(iterable))
async def auto_to_list( value: "t.Union[t.AsyncIterable[V], t.Iterable[V]]",) -> t.List["V"]: return [x async for x in auto_aiter(value)]123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408"""The optional bytecode cache system. This is useful if you have verycomplex template situations and the compilation of all those templatesslows down your application too much.
Situations where this is useful are often forking web applications thatare initialized on the first request."""
import errnoimport fnmatchimport marshalimport osimport pickleimport statimport sysimport tempfileimport typing as tfrom hashlib import sha1from io import BytesIOfrom types import CodeType
if t.TYPE_CHECKING: import typing_extensions as te
from .environment import Environment
class _MemcachedClient(te.Protocol): def get(self, key: str) -> bytes: ...
def set( self, key: str, value: bytes, timeout: t.Optional[int] = None ) -> None: ...
bc_version = 5# Magic bytes to identify Jinja bytecode cache files. Contains the# Python major and minor version to avoid loading incompatible bytecode# if a project upgrades its Python version.bc_magic = ( b"j2" + pickle.dumps(bc_version, 2) + pickle.dumps((sys.version_info[0] << 24) | sys.version_info[1], 2))
class Bucket: """Buckets are used to store the bytecode for one template. It's created and initialized by the bytecode cache and passed to the loading functions.
The buckets get an internal checksum from the cache assigned and use this to automatically reject outdated cache material. Individual bytecode cache subclasses don't have to care about cache invalidation. """
def __init__(self, environment: "Environment", key: str, checksum: str) -> None: self.environment = environment self.key = key self.checksum = checksum self.reset()
def reset(self) -> None: """Resets the bucket (unloads the bytecode).""" self.code: t.Optional[CodeType] = None
def load_bytecode(self, f: t.BinaryIO) -> None: """Loads bytecode from a file or file like object.""" # make sure the magic header is correct magic = f.read(len(bc_magic)) if magic != bc_magic: self.reset() return # the source code of the file changed, we need to reload checksum = pickle.load(f) if self.checksum != checksum: self.reset() return # if marshal_load fails then we need to reload try: self.code = marshal.load(f) except (EOFError, ValueError, TypeError): self.reset() return
def write_bytecode(self, f: t.IO[bytes]) -> None: """Dump the bytecode into the file or file like object passed.""" if self.code is None: raise TypeError("can't write empty bucket") f.write(bc_magic) pickle.dump(self.checksum, f, 2) marshal.dump(self.code, f)
def bytecode_from_string(self, string: bytes) -> None: """Load bytecode from bytes.""" self.load_bytecode(BytesIO(string))
def bytecode_to_string(self) -> bytes: """Return the bytecode as bytes.""" out = BytesIO() self.write_bytecode(out) return out.getvalue()
class BytecodeCache: """To implement your own bytecode cache you have to subclass this class and override :meth:`load_bytecode` and :meth:`dump_bytecode`. Both of these methods are passed a :class:`~jinja2.bccache.Bucket`.
A very basic bytecode cache that saves the bytecode on the file system::
from os import path
class MyCache(BytecodeCache):
def __init__(self, directory): self.directory = directory
def load_bytecode(self, bucket): filename = path.join(self.directory, bucket.key) if path.exists(filename): with open(filename, 'rb') as f: bucket.load_bytecode(f)
def dump_bytecode(self, bucket): filename = path.join(self.directory, bucket.key) with open(filename, 'wb') as f: bucket.write_bytecode(f)
A more advanced version of a filesystem based bytecode cache is part of Jinja. """
def load_bytecode(self, bucket: Bucket) -> None: """Subclasses have to override this method to load bytecode into a bucket. If they are not able to find code in the cache for the bucket, it must not do anything. """ raise NotImplementedError()
def dump_bytecode(self, bucket: Bucket) -> None: """Subclasses have to override this method to write the bytecode from a bucket back to the cache. If it unable to do so it must not fail silently but raise an exception. """ raise NotImplementedError()
def clear(self) -> None: """Clears the cache. This method is not used by Jinja but should be implemented to allow applications to clear the bytecode cache used by a particular environment. """
def get_cache_key( self, name: str, filename: t.Optional[t.Union[str]] = None ) -> str: """Returns the unique hash key for this template name.""" hash = sha1(name.encode("utf-8"))
if filename is not None: hash.update(f"|{filename}".encode())
return hash.hexdigest()
def get_source_checksum(self, source: str) -> str: """Returns a checksum for the source.""" return sha1(source.encode("utf-8")).hexdigest()
def get_bucket( self, environment: "Environment", name: str, filename: t.Optional[str], source: str, ) -> Bucket: """Return a cache bucket for the given template. All arguments are mandatory but filename may be `None`. """ key = self.get_cache_key(name, filename) checksum = self.get_source_checksum(source) bucket = Bucket(environment, key, checksum) self.load_bytecode(bucket) return bucket
def set_bucket(self, bucket: Bucket) -> None: """Put the bucket into the cache.""" self.dump_bytecode(bucket)
class FileSystemBytecodeCache(BytecodeCache): """A bytecode cache that stores bytecode on the filesystem. It accepts two arguments: The directory where the cache items are stored and a pattern string that is used to build the filename.
If no directory is specified a default cache directory is selected. On Windows the user's temp directory is used, on UNIX systems a directory is created for the user in the system temp directory.
The pattern can be used to have multiple separate caches operate on the same directory. The default pattern is ``'__jinja2_%s.cache'``. ``%s`` is replaced with the cache key.
>>> bcc = FileSystemBytecodeCache('/tmp/jinja_cache', '%s.cache')
This bytecode cache supports clearing of the cache using the clear method. """
def __init__( self, directory: t.Optional[str] = None, pattern: str = "__jinja2_%s.cache" ) -> None: if directory is None: directory = self._get_default_cache_dir() self.directory = directory self.pattern = pattern
def _get_default_cache_dir(self) -> str: def _unsafe_dir() -> "te.NoReturn": raise RuntimeError( "Cannot determine safe temp directory. You " "need to explicitly provide one." )
tmpdir = tempfile.gettempdir()
# On windows the temporary directory is used specific unless # explicitly forced otherwise. We can just use that. if os.name == "nt": return tmpdir if not hasattr(os, "getuid"): _unsafe_dir()
dirname = f"_jinja2-cache-{os.getuid()}" actual_dir = os.path.join(tmpdir, dirname)
try: os.mkdir(actual_dir, stat.S_IRWXU) except OSError as e: if e.errno != errno.EEXIST: raise try: os.chmod(actual_dir, stat.S_IRWXU) actual_dir_stat = os.lstat(actual_dir) if ( actual_dir_stat.st_uid != os.getuid() or not stat.S_ISDIR(actual_dir_stat.st_mode) or stat.S_IMODE(actual_dir_stat.st_mode) != stat.S_IRWXU ): _unsafe_dir() except OSError as e: if e.errno != errno.EEXIST: raise
actual_dir_stat = os.lstat(actual_dir) if ( actual_dir_stat.st_uid != os.getuid() or not stat.S_ISDIR(actual_dir_stat.st_mode) or stat.S_IMODE(actual_dir_stat.st_mode) != stat.S_IRWXU ): _unsafe_dir()
return actual_dir
def _get_cache_filename(self, bucket: Bucket) -> str: return os.path.join(self.directory, self.pattern % (bucket.key,))
def load_bytecode(self, bucket: Bucket) -> None: filename = self._get_cache_filename(bucket)
# Don't test for existence before opening the file, since the # file could disappear after the test before the open. try: f = open(filename, "rb") except (FileNotFoundError, IsADirectoryError, PermissionError): # PermissionError can occur on Windows when an operation is # in progress, such as calling clear(). return
with f: bucket.load_bytecode(f)
def dump_bytecode(self, bucket: Bucket) -> None: # Write to a temporary file, then rename to the real name after # writing. This avoids another process reading the file before # it is fully written. name = self._get_cache_filename(bucket) f = tempfile.NamedTemporaryFile( mode="wb", dir=os.path.dirname(name), prefix=os.path.basename(name), suffix=".tmp", delete=False, )
def remove_silent() -> None: try: os.remove(f.name) except OSError: # Another process may have called clear(). On Windows, # another program may be holding the file open. pass
try: with f: bucket.write_bytecode(f) except BaseException: remove_silent() raise
try: os.replace(f.name, name) except OSError: # Another process may have called clear(). On Windows, # another program may be holding the file open. remove_silent() except BaseException: remove_silent() raise
def clear(self) -> None: # imported lazily here because google app-engine doesn't support # write access on the file system and the function does not exist # normally. from os import remove
files = fnmatch.filter(os.listdir(self.directory), self.pattern % ("*",)) for filename in files: try: remove(os.path.join(self.directory, filename)) except OSError: pass
class MemcachedBytecodeCache(BytecodeCache): """This class implements a bytecode cache that uses a memcache cache for storing the information. It does not enforce a specific memcache library (tummy's memcache or cmemcache) but will accept any class that provides the minimal interface required.
Libraries compatible with this class:
- `cachelib <https://github.com/pallets/cachelib>`_ - `python-memcached <https://pypi.org/project/python-memcached/>`_
(Unfortunately the django cache interface is not compatible because it does not support storing binary data, only text. You can however pass the underlying cache client to the bytecode cache which is available as `django.core.cache.cache._client`.)
The minimal interface for the client passed to the constructor is this:
.. class:: MinimalClientInterface
.. method:: set(key, value[, timeout])
Stores the bytecode in the cache. `value` is a string and `timeout` the timeout of the key. If timeout is not provided a default timeout or no timeout should be assumed, if it's provided it's an integer with the number of seconds the cache item should exist.
.. method:: get(key)
Returns the value for the cache key. If the item does not exist in the cache the return value must be `None`.
The other arguments to the constructor are the prefix for all keys that is added before the actual cache key and the timeout for the bytecode in the cache system. We recommend a high (or no) timeout.
This bytecode cache does not support clearing of used items in the cache. The clear method is a no-operation function.
.. versionadded:: 2.7 Added support for ignoring memcache errors through the `ignore_memcache_errors` parameter. """
def __init__( self, client: "_MemcachedClient", prefix: str = "jinja2/bytecode/", timeout: t.Optional[int] = None, ignore_memcache_errors: bool = True, ): self.client = client self.prefix = prefix self.timeout = timeout self.ignore_memcache_errors = ignore_memcache_errors
def load_bytecode(self, bucket: Bucket) -> None: try: code = self.client.get(self.prefix + bucket.key) except Exception: if not self.ignore_memcache_errors: raise else: bucket.bytecode_from_string(code)
def dump_bytecode(self, bucket: Bucket) -> None: key = self.prefix + bucket.key value = bucket.bytecode_to_string()
try: if self.timeout is not None: self.client.set(key, value, self.timeout) else: self.client.set(key, value) except Exception: if not self.ignore_memcache_errors: raise123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998"""Compiles nodes from the parser into Python code."""
import typing as tfrom contextlib import contextmanagerfrom functools import update_wrapperfrom io import StringIOfrom itertools import chainfrom keyword import iskeyword as is_python_keyword
from markupsafe import escapefrom markupsafe import Markup
from . import nodesfrom .exceptions import TemplateAssertionErrorfrom .idtracking import Symbolsfrom .idtracking import VAR_LOAD_ALIASfrom .idtracking import VAR_LOAD_PARAMETERfrom .idtracking import VAR_LOAD_RESOLVEfrom .idtracking import VAR_LOAD_UNDEFINEDfrom .nodes import EvalContextfrom .optimizer import Optimizerfrom .utils import _PassArgfrom .utils import concatfrom .visitor import NodeVisitor
if t.TYPE_CHECKING: import typing_extensions as te
from .environment import Environment
F = t.TypeVar("F", bound=t.Callable[..., t.Any])
operators = { "eq": "==", "ne": "!=", "gt": ">", "gteq": ">=", "lt": "<", "lteq": "<=", "in": "in", "notin": "not in",}
def optimizeconst(f: F) -> F: def new_func( self: "CodeGenerator", node: nodes.Expr, frame: "Frame", **kwargs: t.Any ) -> t.Any: # Only optimize if the frame is not volatile if self.optimizer is not None and not frame.eval_ctx.volatile: new_node = self.optimizer.visit(node, frame.eval_ctx)
if new_node != node: return self.visit(new_node, frame)
return f(self, node, frame, **kwargs)
return update_wrapper(new_func, f) # type: ignore[return-value]
def _make_binop(op: str) -> t.Callable[["CodeGenerator", nodes.BinExpr, "Frame"], None]: @optimizeconst def visitor(self: "CodeGenerator", node: nodes.BinExpr, frame: Frame) -> None: if ( self.environment.sandboxed and op in self.environment.intercepted_binops # type: ignore ): self.write(f"environment.call_binop(context, {op!r}, ") self.visit(node.left, frame) self.write(", ") self.visit(node.right, frame) else: self.write("(") self.visit(node.left, frame) self.write(f" {op} ") self.visit(node.right, frame)
self.write(")")
return visitor
def _make_unop( op: str,) -> t.Callable[["CodeGenerator", nodes.UnaryExpr, "Frame"], None]: @optimizeconst def visitor(self: "CodeGenerator", node: nodes.UnaryExpr, frame: Frame) -> None: if ( self.environment.sandboxed and op in self.environment.intercepted_unops # type: ignore ): self.write(f"environment.call_unop(context, {op!r}, ") self.visit(node.node, frame) else: self.write("(" + op) self.visit(node.node, frame)
self.write(")")
return visitor
def generate( node: nodes.Template, environment: "Environment", name: t.Optional[str], filename: t.Optional[str], stream: t.Optional[t.TextIO] = None, defer_init: bool = False, optimized: bool = True,) -> t.Optional[str]: """Generate the python source for a node tree.""" if not isinstance(node, nodes.Template): raise TypeError("Can't compile non template nodes")
generator = environment.code_generator_class( environment, name, filename, stream, defer_init, optimized ) generator.visit(node)
if stream is None: return generator.stream.getvalue() # type: ignore
return None
def has_safe_repr(value: t.Any) -> bool: """Does the node have a safe representation?""" if value is None or value is NotImplemented or value is Ellipsis: return True
if type(value) in {bool, int, float, complex, range, str, Markup}: return True
if type(value) in {tuple, list, set, frozenset}: return all(has_safe_repr(v) for v in value)
if type(value) is dict: # noqa E721 return all(has_safe_repr(k) and has_safe_repr(v) for k, v in value.items())
return False
def find_undeclared( nodes: t.Iterable[nodes.Node], names: t.Iterable[str]) -> t.Set[str]: """Check if the names passed are accessed undeclared. The return value is a set of all the undeclared names from the sequence of names found. """ visitor = UndeclaredNameVisitor(names) try: for node in nodes: visitor.visit(node) except VisitorExit: pass return visitor.undeclared
class MacroRef: def __init__(self, node: t.Union[nodes.Macro, nodes.CallBlock]) -> None: self.node = node self.accesses_caller = False self.accesses_kwargs = False self.accesses_varargs = False
class Frame: """Holds compile time information for us."""
def __init__( self, eval_ctx: EvalContext, parent: t.Optional["Frame"] = None, level: t.Optional[int] = None, ) -> None: self.eval_ctx = eval_ctx
# the parent of this frame self.parent = parent
if parent is None: self.symbols = Symbols(level=level)
# in some dynamic inheritance situations the compiler needs to add # write tests around output statements. self.require_output_check = False
# inside some tags we are using a buffer rather than yield statements. # this for example affects {% filter %} or {% macro %}. If a frame # is buffered this variable points to the name of the list used as # buffer. self.buffer: t.Optional[str] = None
# the name of the block we're in, otherwise None. self.block: t.Optional[str] = None
else: self.symbols = Symbols(parent.symbols, level=level) self.require_output_check = parent.require_output_check self.buffer = parent.buffer self.block = parent.block
# a toplevel frame is the root + soft frames such as if conditions. self.toplevel = False
# the root frame is basically just the outermost frame, so no if # conditions. This information is used to optimize inheritance # situations. self.rootlevel = False
# variables set inside of loops and blocks should not affect outer frames, # but they still needs to be kept track of as part of the active context. self.loop_frame = False self.block_frame = False
# track whether the frame is being used in an if-statement or conditional # expression as it determines which errors should be raised during runtime # or compile time. self.soft_frame = False
def copy(self) -> "te.Self": """Create a copy of the current one.""" rv = object.__new__(self.__class__) rv.__dict__.update(self.__dict__) rv.symbols = self.symbols.copy() return rv
def inner(self, isolated: bool = False) -> "Frame": """Return an inner frame.""" if isolated: return Frame(self.eval_ctx, level=self.symbols.level + 1) return Frame(self.eval_ctx, self)
def soft(self) -> "te.Self": """Return a soft frame. A soft frame may not be modified as standalone thing as it shares the resources with the frame it was created of, but it's not a rootlevel frame any longer.
This is only used to implement if-statements and conditional expressions. """ rv = self.copy() rv.rootlevel = False rv.soft_frame = True return rv
__copy__ = copy
class VisitorExit(RuntimeError): """Exception used by the `UndeclaredNameVisitor` to signal a stop."""
class DependencyFinderVisitor(NodeVisitor): """A visitor that collects filter and test calls."""
def __init__(self) -> None: self.filters: t.Set[str] = set() self.tests: t.Set[str] = set()
def visit_Filter(self, node: nodes.Filter) -> None: self.generic_visit(node) self.filters.add(node.name)
def visit_Test(self, node: nodes.Test) -> None: self.generic_visit(node) self.tests.add(node.name)
def visit_Block(self, node: nodes.Block) -> None: """Stop visiting at blocks."""
class UndeclaredNameVisitor(NodeVisitor): """A visitor that checks if a name is accessed without being declared. This is different from the frame visitor as it will not stop at closure frames. """
def __init__(self, names: t.Iterable[str]) -> None: self.names = set(names) self.undeclared: t.Set[str] = set()
def visit_Name(self, node: nodes.Name) -> None: if node.ctx == "load" and node.name in self.names: self.undeclared.add(node.name) if self.undeclared == self.names: raise VisitorExit() else: self.names.discard(node.name)
def visit_Block(self, node: nodes.Block) -> None: """Stop visiting a blocks."""
class CompilerExit(Exception): """Raised if the compiler encountered a situation where it just doesn't make sense to further process the code. Any block that raises such an exception is not further processed. """
class CodeGenerator(NodeVisitor): def __init__( self, environment: "Environment", name: t.Optional[str], filename: t.Optional[str], stream: t.Optional[t.TextIO] = None, defer_init: bool = False, optimized: bool = True, ) -> None: if stream is None: stream = StringIO() self.environment = environment self.name = name self.filename = filename self.stream = stream self.created_block_context = False self.defer_init = defer_init self.optimizer: t.Optional[Optimizer] = None
if optimized: self.optimizer = Optimizer(environment)
# aliases for imports self.import_aliases: t.Dict[str, str] = {}
# a registry for all blocks. Because blocks are moved out # into the global python scope they are registered here self.blocks: t.Dict[str, nodes.Block] = {}
# the number of extends statements so far self.extends_so_far = 0
# some templates have a rootlevel extends. In this case we # can safely assume that we're a child template and do some # more optimizations. self.has_known_extends = False
# the current line number self.code_lineno = 1
# registry of all filters and tests (global, not block local) self.tests: t.Dict[str, str] = {} self.filters: t.Dict[str, str] = {}
# the debug information self.debug_info: t.List[t.Tuple[int, int]] = [] self._write_debug_info: t.Optional[int] = None
# the number of new lines before the next write() self._new_lines = 0
# the line number of the last written statement self._last_line = 0
# true if nothing was written so far. self._first_write = True
# used by the `temporary_identifier` method to get new # unique, temporary identifier self._last_identifier = 0
# the current indentation self._indentation = 0
# Tracks toplevel assignments self._assign_stack: t.List[t.Set[str]] = []
# Tracks parameter definition blocks self._param_def_block: t.List[t.Set[str]] = []
# Tracks the current context. self._context_reference_stack = ["context"]
@property def optimized(self) -> bool: return self.optimizer is not None
# -- Various compilation helpers
def fail(self, msg: str, lineno: int) -> "te.NoReturn": """Fail with a :exc:`TemplateAssertionError`.""" raise TemplateAssertionError(msg, lineno, self.name, self.filename)
def temporary_identifier(self) -> str: """Get a new unique identifier.""" self._last_identifier += 1 return f"t_{self._last_identifier}"
def buffer(self, frame: Frame) -> None: """Enable buffering for the frame from that point onwards.""" frame.buffer = self.temporary_identifier() self.writeline(f"{frame.buffer} = []")
def return_buffer_contents( self, frame: Frame, force_unescaped: bool = False ) -> None: """Return the buffer contents of the frame.""" if not force_unescaped: if frame.eval_ctx.volatile: self.writeline("if context.eval_ctx.autoescape:") self.indent() self.writeline(f"return Markup(concat({frame.buffer}))") self.outdent() self.writeline("else:") self.indent() self.writeline(f"return concat({frame.buffer})") self.outdent() return elif frame.eval_ctx.autoescape: self.writeline(f"return Markup(concat({frame.buffer}))") return self.writeline(f"return concat({frame.buffer})")
def indent(self) -> None: """Indent by one.""" self._indentation += 1
def outdent(self, step: int = 1) -> None: """Outdent by step.""" self._indentation -= step
def start_write(self, frame: Frame, node: t.Optional[nodes.Node] = None) -> None: """Yield or write into the frame buffer.""" if frame.buffer is None: self.writeline("yield ", node) else: self.writeline(f"{frame.buffer}.append(", node)
def end_write(self, frame: Frame) -> None: """End the writing process started by `start_write`.""" if frame.buffer is not None: self.write(")")
def simple_write( self, s: str, frame: Frame, node: t.Optional[nodes.Node] = None ) -> None: """Simple shortcut for start_write + write + end_write.""" self.start_write(frame, node) self.write(s) self.end_write(frame)
def blockvisit(self, nodes: t.Iterable[nodes.Node], frame: Frame) -> None: """Visit a list of nodes as block in a frame. If the current frame is no buffer a dummy ``if 0: yield None`` is written automatically. """ try: self.writeline("pass") for node in nodes: self.visit(node, frame) except CompilerExit: pass
def write(self, x: str) -> None: """Write a string into the output stream.""" if self._new_lines: if not self._first_write: self.stream.write("\n" * self._new_lines) self.code_lineno += self._new_lines if self._write_debug_info is not None: self.debug_info.append((self._write_debug_info, self.code_lineno)) self._write_debug_info = None self._first_write = False self.stream.write(" " * self._indentation) self._new_lines = 0 self.stream.write(x)
def writeline( self, x: str, node: t.Optional[nodes.Node] = None, extra: int = 0 ) -> None: """Combination of newline and write.""" self.newline(node, extra) self.write(x)
def newline(self, node: t.Optional[nodes.Node] = None, extra: int = 0) -> None: """Add one or more newlines before the next write.""" self._new_lines = max(self._new_lines, 1 + extra) if node is not None and node.lineno != self._last_line: self._write_debug_info = node.lineno self._last_line = node.lineno
def signature( self, node: t.Union[nodes.Call, nodes.Filter, nodes.Test], frame: Frame, extra_kwargs: t.Optional[t.Mapping[str, t.Any]] = None, ) -> None: """Writes a function call to the stream for the current node. A leading comma is added automatically. The extra keyword arguments may not include python keywords otherwise a syntax error could occur. The extra keyword arguments should be given as python dict. """ # if any of the given keyword arguments is a python keyword # we have to make sure that no invalid call is created. kwarg_workaround = any( is_python_keyword(t.cast(str, k)) for k in chain((x.key for x in node.kwargs), extra_kwargs or ()) )
for arg in node.args: self.write(", ") self.visit(arg, frame)
if not kwarg_workaround: for kwarg in node.kwargs: self.write(", ") self.visit(kwarg, frame) if extra_kwargs is not None: for key, value in extra_kwargs.items(): self.write(f", {key}={value}") if node.dyn_args: self.write(", *") self.visit(node.dyn_args, frame)
if kwarg_workaround: if node.dyn_kwargs is not None: self.write(", **dict({") else: self.write(", **{") for kwarg in node.kwargs: self.write(f"{kwarg.key!r}: ") self.visit(kwarg.value, frame) self.write(", ") if extra_kwargs is not None: for key, value in extra_kwargs.items(): self.write(f"{key!r}: {value}, ") if node.dyn_kwargs is not None: self.write("}, **") self.visit(node.dyn_kwargs, frame) self.write(")") else: self.write("}")
elif node.dyn_kwargs is not None: self.write(", **") self.visit(node.dyn_kwargs, frame)
def pull_dependencies(self, nodes: t.Iterable[nodes.Node]) -> None: """Find all filter and test names used in the template and assign them to variables in the compiled namespace. Checking that the names are registered with the environment is done when compiling the Filter and Test nodes. If the node is in an If or CondExpr node, the check is done at runtime instead.
.. versionchanged:: 3.0 Filters and tests in If and CondExpr nodes are checked at runtime instead of compile time. """ visitor = DependencyFinderVisitor()
for node in nodes: visitor.visit(node)
for id_map, names, dependency in ( (self.filters, visitor.filters, "filters"), ( self.tests, visitor.tests, "tests", ), ): for name in sorted(names): if name not in id_map: id_map[name] = self.temporary_identifier()
# add check during runtime that dependencies used inside of executed # blocks are defined, as this step may be skipped during compile time self.writeline("try:") self.indent() self.writeline(f"{id_map[name]} = environment.{dependency}[{name!r}]") self.outdent() self.writeline("except KeyError:") self.indent() self.writeline("@internalcode") self.writeline(f"def {id_map[name]}(*unused):") self.indent() self.writeline( f'raise TemplateRuntimeError("No {dependency[:-1]}' f' named {name!r} found.")' ) self.outdent() self.outdent()
def enter_frame(self, frame: Frame) -> None: undefs = [] for target, (action, param) in frame.symbols.loads.items(): if action == VAR_LOAD_PARAMETER: pass elif action == VAR_LOAD_RESOLVE: self.writeline(f"{target} = {self.get_resolve_func()}({param!r})") elif action == VAR_LOAD_ALIAS: self.writeline(f"{target} = {param}") elif action == VAR_LOAD_UNDEFINED: undefs.append(target) else: raise NotImplementedError("unknown load instruction") if undefs: self.writeline(f"{' = '.join(undefs)} = missing")
def leave_frame(self, frame: Frame, with_python_scope: bool = False) -> None: if not with_python_scope: undefs = [] for target in frame.symbols.loads: undefs.append(target) if undefs: self.writeline(f"{' = '.join(undefs)} = missing")
def choose_async(self, async_value: str = "async ", sync_value: str = "") -> str: return async_value if self.environment.is_async else sync_value
def func(self, name: str) -> str: return f"{self.choose_async()}def {name}"
def macro_body( self, node: t.Union[nodes.Macro, nodes.CallBlock], frame: Frame ) -> t.Tuple[Frame, MacroRef]: """Dump the function def of a macro or call block.""" frame = frame.inner() frame.symbols.analyze_node(node) macro_ref = MacroRef(node)
explicit_caller = None skip_special_params = set() args = []
for idx, arg in enumerate(node.args): if arg.name == "caller": explicit_caller = idx if arg.name in ("kwargs", "varargs"): skip_special_params.add(arg.name) args.append(frame.symbols.ref(arg.name))
undeclared = find_undeclared(node.body, ("caller", "kwargs", "varargs"))
if "caller" in undeclared: # In older Jinja versions there was a bug that allowed caller # to retain the special behavior even if it was mentioned in # the argument list. However thankfully this was only really # working if it was the last argument. So we are explicitly # checking this now and error out if it is anywhere else in # the argument list. if explicit_caller is not None: try: node.defaults[explicit_caller - len(node.args)] except IndexError: self.fail( "When defining macros or call blocks the " 'special "caller" argument must be omitted ' "or be given a default.", node.lineno, ) else: args.append(frame.symbols.declare_parameter("caller")) macro_ref.accesses_caller = True if "kwargs" in undeclared and "kwargs" not in skip_special_params: args.append(frame.symbols.declare_parameter("kwargs")) macro_ref.accesses_kwargs = True if "varargs" in undeclared and "varargs" not in skip_special_params: args.append(frame.symbols.declare_parameter("varargs")) macro_ref.accesses_varargs = True
# macros are delayed, they never require output checks frame.require_output_check = False frame.symbols.analyze_node(node) self.writeline(f"{self.func('macro')}({', '.join(args)}):", node) self.indent()
self.buffer(frame) self.enter_frame(frame)
self.push_parameter_definitions(frame) for idx, arg in enumerate(node.args): ref = frame.symbols.ref(arg.name) self.writeline(f"if {ref} is missing:") self.indent() try: default = node.defaults[idx - len(node.args)] except IndexError: self.writeline( f'{ref} = undefined("parameter {arg.name!r} was not provided",' f" name={arg.name!r})" ) else: self.writeline(f"{ref} = ") self.visit(default, frame) self.mark_parameter_stored(ref) self.outdent() self.pop_parameter_definitions()
self.blockvisit(node.body, frame) self.return_buffer_contents(frame, force_unescaped=True) self.leave_frame(frame, with_python_scope=True) self.outdent()
return frame, macro_ref
def macro_def(self, macro_ref: MacroRef, frame: Frame) -> None: """Dump the macro definition for the def created by macro_body.""" arg_tuple = ", ".join(repr(x.name) for x in macro_ref.node.args) name = getattr(macro_ref.node, "name", None) if len(macro_ref.node.args) == 1: arg_tuple += "," self.write( f"Macro(environment, macro, {name!r}, ({arg_tuple})," f" {macro_ref.accesses_kwargs!r}, {macro_ref.accesses_varargs!r}," f" {macro_ref.accesses_caller!r}, context.eval_ctx.autoescape)" )
def position(self, node: nodes.Node) -> str: """Return a human readable position for the node.""" rv = f"line {node.lineno}" if self.name is not None: rv = f"{rv} in {self.name!r}" return rv
def dump_local_context(self, frame: Frame) -> str: items_kv = ", ".join( f"{name!r}: {target}" for name, target in frame.symbols.dump_stores().items() ) return f"{{{items_kv}}}"
def write_commons(self) -> None: """Writes a common preamble that is used by root and block functions. Primarily this sets up common local helpers and enforces a generator through a dead branch. """ self.writeline("resolve = context.resolve_or_missing") self.writeline("undefined = environment.undefined") self.writeline("concat = environment.concat") # always use the standard Undefined class for the implicit else of # conditional expressions self.writeline("cond_expr_undefined = Undefined") self.writeline("if 0: yield None")
def push_parameter_definitions(self, frame: Frame) -> None: """Pushes all parameter targets from the given frame into a local stack that permits tracking of yet to be assigned parameters. In particular this enables the optimization from `visit_Name` to skip undefined expressions for parameters in macros as macros can reference otherwise unbound parameters. """ self._param_def_block.append(frame.symbols.dump_param_targets())
def pop_parameter_definitions(self) -> None: """Pops the current parameter definitions set.""" self._param_def_block.pop()
def mark_parameter_stored(self, target: str) -> None: """Marks a parameter in the current parameter definitions as stored. This will skip the enforced undefined checks. """ if self._param_def_block: self._param_def_block[-1].discard(target)
def push_context_reference(self, target: str) -> None: self._context_reference_stack.append(target)
def pop_context_reference(self) -> None: self._context_reference_stack.pop()
def get_context_ref(self) -> str: return self._context_reference_stack[-1]
def get_resolve_func(self) -> str: target = self._context_reference_stack[-1] if target == "context": return "resolve" return f"{target}.resolve"
def derive_context(self, frame: Frame) -> str: return f"{self.get_context_ref()}.derived({self.dump_local_context(frame)})"
def parameter_is_undeclared(self, target: str) -> bool: """Checks if a given target is an undeclared parameter.""" if not self._param_def_block: return False return target in self._param_def_block[-1]
def push_assign_tracking(self) -> None: """Pushes a new layer for assignment tracking.""" self._assign_stack.append(set())
def pop_assign_tracking(self, frame: Frame) -> None: """Pops the topmost level for assignment tracking and updates the context variables if necessary. """ vars = self._assign_stack.pop() if ( not frame.block_frame and not frame.loop_frame and not frame.toplevel or not vars ): return public_names = [x for x in vars if x[:1] != "_"] if len(vars) == 1: name = next(iter(vars)) ref = frame.symbols.ref(name) if frame.loop_frame: self.writeline(f"_loop_vars[{name!r}] = {ref}") return if frame.block_frame: self.writeline(f"_block_vars[{name!r}] = {ref}") return self.writeline(f"context.vars[{name!r}] = {ref}") else: if frame.loop_frame: self.writeline("_loop_vars.update({") elif frame.block_frame: self.writeline("_block_vars.update({") else: self.writeline("context.vars.update({") for idx, name in enumerate(sorted(vars)): if idx: self.write(", ") ref = frame.symbols.ref(name) self.write(f"{name!r}: {ref}") self.write("})") if not frame.block_frame and not frame.loop_frame and public_names: if len(public_names) == 1: self.writeline(f"context.exported_vars.add({public_names[0]!r})") else: names_str = ", ".join(map(repr, sorted(public_names))) self.writeline(f"context.exported_vars.update(({names_str}))")
# -- Statement Visitors
def visit_Template( self, node: nodes.Template, frame: t.Optional[Frame] = None ) -> None: assert frame is None, "no root frame allowed" eval_ctx = EvalContext(self.environment, self.name)
from .runtime import async_exported from .runtime import exported
if self.environment.is_async: exported_names = sorted(exported + async_exported) else: exported_names = sorted(exported)
self.writeline("from jinja2.runtime import " + ", ".join(exported_names))
# if we want a deferred initialization we cannot move the # environment into a local name envenv = "" if self.defer_init else ", environment=environment"
# do we have an extends tag at all? If not, we can save some # overhead by just not processing any inheritance code. have_extends = node.find(nodes.Extends) is not None
# find all blocks for block in node.find_all(nodes.Block): if block.name in self.blocks: self.fail(f"block {block.name!r} defined twice", block.lineno) self.blocks[block.name] = block
# find all imports and import them for import_ in node.find_all(nodes.ImportedName): if import_.importname not in self.import_aliases: imp = import_.importname self.import_aliases[imp] = alias = self.temporary_identifier() if "." in imp: module, obj = imp.rsplit(".", 1) self.writeline(f"from {module} import {obj} as {alias}") else: self.writeline(f"import {imp} as {alias}")
# add the load name self.writeline(f"name = {self.name!r}")
# generate the root render function. self.writeline( f"{self.func('root')}(context, missing=missing{envenv}):", extra=1 ) self.indent() self.write_commons()
# process the root frame = Frame(eval_ctx) if "self" in find_undeclared(node.body, ("self",)): ref = frame.symbols.declare_parameter("self") self.writeline(f"{ref} = TemplateReference(context)") frame.symbols.analyze_node(node) frame.toplevel = frame.rootlevel = True frame.require_output_check = have_extends and not self.has_known_extends if have_extends: self.writeline("parent_template = None") self.enter_frame(frame) self.pull_dependencies(node.body) self.blockvisit(node.body, frame) self.leave_frame(frame, with_python_scope=True) self.outdent()
# make sure that the parent root is called. if have_extends: if not self.has_known_extends: self.indent() self.writeline("if parent_template is not None:") self.indent() if not self.environment.is_async: self.writeline("yield from parent_template.root_render_func(context)") else: self.writeline("agen = parent_template.root_render_func(context)") self.writeline("try:") self.indent() self.writeline("async for event in agen:") self.indent() self.writeline("yield event") self.outdent() self.outdent() self.writeline("finally: await agen.aclose()") self.outdent(1 + (not self.has_known_extends))
# at this point we now have the blocks collected and can visit them too. for name, block in self.blocks.items(): self.writeline( f"{self.func('block_' + name)}(context, missing=missing{envenv}):", block, 1, ) self.indent() self.write_commons() # It's important that we do not make this frame a child of the # toplevel template. This would cause a variety of # interesting issues with identifier tracking. block_frame = Frame(eval_ctx) block_frame.block_frame = True undeclared = find_undeclared(block.body, ("self", "super")) if "self" in undeclared: ref = block_frame.symbols.declare_parameter("self") self.writeline(f"{ref} = TemplateReference(context)") if "super" in undeclared: ref = block_frame.symbols.declare_parameter("super") self.writeline(f"{ref} = context.super({name!r}, block_{name})") block_frame.symbols.analyze_node(block) block_frame.block = name self.writeline("_block_vars = {}") self.enter_frame(block_frame) self.pull_dependencies(block.body) self.blockvisit(block.body, block_frame) self.leave_frame(block_frame, with_python_scope=True) self.outdent()
blocks_kv_str = ", ".join(f"{x!r}: block_{x}" for x in self.blocks) self.writeline(f"blocks = {{{blocks_kv_str}}}", extra=1) debug_kv_str = "&".join(f"{k}={v}" for k, v in self.debug_info) self.writeline(f"debug_info = {debug_kv_str!r}")
def visit_Block(self, node: nodes.Block, frame: Frame) -> None: """Call a block and register it for the template.""" level = 0 if frame.toplevel: # if we know that we are a child template, there is no need to # check if we are one if self.has_known_extends: return if self.extends_so_far > 0: self.writeline("if parent_template is None:") self.indent() level += 1
if node.scoped: context = self.derive_context(frame) else: context = self.get_context_ref()
if node.required: self.writeline(f"if len(context.blocks[{node.name!r}]) <= 1:", node) self.indent() self.writeline( f'raise TemplateRuntimeError("Required block {node.name!r} not found")', node, ) self.outdent()
if not self.environment.is_async and frame.buffer is None: self.writeline( f"yield from context.blocks[{node.name!r}][0]({context})", node ) else: self.writeline(f"gen = context.blocks[{node.name!r}][0]({context})") self.writeline("try:") self.indent() self.writeline( f"{self.choose_async()}for event in gen:", node, ) self.indent() self.simple_write("event", frame) self.outdent() self.outdent() self.writeline( f"finally: {self.choose_async('await gen.aclose()', 'gen.close()')}" )
self.outdent(level)
def visit_Extends(self, node: nodes.Extends, frame: Frame) -> None: """Calls the extender.""" if not frame.toplevel: self.fail("cannot use extend from a non top-level scope", node.lineno)
# if the number of extends statements in general is zero so # far, we don't have to add a check if something extended # the template before this one. if self.extends_so_far > 0: # if we have a known extends we just add a template runtime # error into the generated code. We could catch that at compile # time too, but i welcome it not to confuse users by throwing the # same error at different times just "because we can". if not self.has_known_extends: self.writeline("if parent_template is not None:") self.indent() self.writeline('raise TemplateRuntimeError("extended multiple times")')
# if we have a known extends already we don't need that code here # as we know that the template execution will end here. if self.has_known_extends: raise CompilerExit() else: self.outdent()
self.writeline("parent_template = environment.get_template(", node) self.visit(node.template, frame) self.write(f", {self.name!r})") self.writeline("for name, parent_block in parent_template.blocks.items():") self.indent() self.writeline("context.blocks.setdefault(name, []).append(parent_block)") self.outdent()
# if this extends statement was in the root level we can take # advantage of that information and simplify the generated code # in the top level from this point onwards if frame.rootlevel: self.has_known_extends = True
# and now we have one more self.extends_so_far += 1
def visit_Include(self, node: nodes.Include, frame: Frame) -> None: """Handles includes.""" if node.ignore_missing: self.writeline("try:") self.indent()
func_name = "get_or_select_template" if isinstance(node.template, nodes.Const): if isinstance(node.template.value, str): func_name = "get_template" elif isinstance(node.template.value, (tuple, list)): func_name = "select_template" elif isinstance(node.template, (nodes.Tuple, nodes.List)): func_name = "select_template"
self.writeline(f"template = environment.{func_name}(", node) self.visit(node.template, frame) self.write(f", {self.name!r})") if node.ignore_missing: self.outdent() self.writeline("except TemplateNotFound:") self.indent() self.writeline("pass") self.outdent() self.writeline("else:") self.indent()
def loop_body() -> None: self.indent() self.simple_write("event", frame) self.outdent()
if node.with_context: self.writeline( f"gen = template.root_render_func(" "template.new_context(context.get_all(), True," f" {self.dump_local_context(frame)}))" ) self.writeline("try:") self.indent() self.writeline(f"{self.choose_async()}for event in gen:") loop_body() self.outdent() self.writeline( f"finally: {self.choose_async('await gen.aclose()', 'gen.close()')}" ) elif self.environment.is_async: self.writeline( "for event in (await template._get_default_module_async())" "._body_stream:" ) loop_body() else: self.writeline("yield from template._get_default_module()._body_stream")
if node.ignore_missing: self.outdent()
def _import_common( self, node: t.Union[nodes.Import, nodes.FromImport], frame: Frame ) -> None: self.write(f"{self.choose_async('await ')}environment.get_template(") self.visit(node.template, frame) self.write(f", {self.name!r}).")
if node.with_context: f_name = f"make_module{self.choose_async('_async')}" self.write( f"{f_name}(context.get_all(), True, {self.dump_local_context(frame)})" ) else: self.write(f"_get_default_module{self.choose_async('_async')}(context)")
def visit_Import(self, node: nodes.Import, frame: Frame) -> None: """Visit regular imports.""" self.writeline(f"{frame.symbols.ref(node.target)} = ", node) if frame.toplevel: self.write(f"context.vars[{node.target!r}] = ")
self._import_common(node, frame)
if frame.toplevel and not node.target.startswith("_"): self.writeline(f"context.exported_vars.discard({node.target!r})")
def visit_FromImport(self, node: nodes.FromImport, frame: Frame) -> None: """Visit named imports.""" self.newline(node) self.write("included_template = ") self._import_common(node, frame) var_names = [] discarded_names = [] for name in node.names: if isinstance(name, tuple): name, alias = name else: alias = name self.writeline( f"{frame.symbols.ref(alias)} =" f" getattr(included_template, {name!r}, missing)" ) self.writeline(f"if {frame.symbols.ref(alias)} is missing:") self.indent() # The position will contain the template name, and will be formatted # into a string that will be compiled into an f-string. Curly braces # in the name must be replaced with escapes so that they will not be # executed as part of the f-string. position = self.position(node).replace("{", "{{").replace("}", "}}") message = ( "the template {included_template.__name__!r}" f" (imported on {position})" f" does not export the requested name {name!r}" ) self.writeline( f"{frame.symbols.ref(alias)} = undefined(f{message!r}, name={name!r})" ) self.outdent() if frame.toplevel: var_names.append(alias) if not alias.startswith("_"): discarded_names.append(alias)
if var_names: if len(var_names) == 1: name = var_names[0] self.writeline(f"context.vars[{name!r}] = {frame.symbols.ref(name)}") else: names_kv = ", ".join( f"{name!r}: {frame.symbols.ref(name)}" for name in var_names ) self.writeline(f"context.vars.update({{{names_kv}}})") if discarded_names: if len(discarded_names) == 1: self.writeline(f"context.exported_vars.discard({discarded_names[0]!r})") else: names_str = ", ".join(map(repr, discarded_names)) self.writeline( f"context.exported_vars.difference_update(({names_str}))" )
def visit_For(self, node: nodes.For, frame: Frame) -> None: loop_frame = frame.inner() loop_frame.loop_frame = True test_frame = frame.inner() else_frame = frame.inner()
# try to figure out if we have an extended loop. An extended loop # is necessary if the loop is in recursive mode if the special loop # variable is accessed in the body if the body is a scoped block. extended_loop = ( node.recursive or "loop" in find_undeclared(node.iter_child_nodes(only=("body",)), ("loop",)) or any(block.scoped for block in node.find_all(nodes.Block)) )
loop_ref = None if extended_loop: loop_ref = loop_frame.symbols.declare_parameter("loop")
loop_frame.symbols.analyze_node(node, for_branch="body") if node.else_: else_frame.symbols.analyze_node(node, for_branch="else")
if node.test: loop_filter_func = self.temporary_identifier() test_frame.symbols.analyze_node(node, for_branch="test") self.writeline(f"{self.func(loop_filter_func)}(fiter):", node.test) self.indent() self.enter_frame(test_frame) self.writeline(self.choose_async("async for ", "for ")) self.visit(node.target, loop_frame) self.write(" in ") self.write(self.choose_async("auto_aiter(fiter)", "fiter")) self.write(":") self.indent() self.writeline("if ", node.test) self.visit(node.test, test_frame) self.write(":") self.indent() self.writeline("yield ") self.visit(node.target, loop_frame) self.outdent(3) self.leave_frame(test_frame, with_python_scope=True)
# if we don't have an recursive loop we have to find the shadowed # variables at that point. Because loops can be nested but the loop # variable is a special one we have to enforce aliasing for it. if node.recursive: self.writeline( f"{self.func('loop')}(reciter, loop_render_func, depth=0):", node ) self.indent() self.buffer(loop_frame)
# Use the same buffer for the else frame else_frame.buffer = loop_frame.buffer
# make sure the loop variable is a special one and raise a template # assertion error if a loop tries to write to loop if extended_loop: self.writeline(f"{loop_ref} = missing")
for name in node.find_all(nodes.Name): if name.ctx == "store" and name.name == "loop": self.fail( "Can't assign to special loop variable in for-loop target", name.lineno, )
if node.else_: iteration_indicator = self.temporary_identifier() self.writeline(f"{iteration_indicator} = 1")
self.writeline(self.choose_async("async for ", "for "), node) self.visit(node.target, loop_frame) if extended_loop: self.write(f", {loop_ref} in {self.choose_async('Async')}LoopContext(") else: self.write(" in ")
if node.test: self.write(f"{loop_filter_func}(") if node.recursive: self.write("reciter") else: if self.environment.is_async and not extended_loop: self.write("auto_aiter(") self.visit(node.iter, frame) if self.environment.is_async and not extended_loop: self.write(")") if node.test: self.write(")")
if node.recursive: self.write(", undefined, loop_render_func, depth):") else: self.write(", undefined):" if extended_loop else ":")
self.indent() self.enter_frame(loop_frame)
self.writeline("_loop_vars = {}") self.blockvisit(node.body, loop_frame) if node.else_: self.writeline(f"{iteration_indicator} = 0") self.outdent() self.leave_frame( loop_frame, with_python_scope=node.recursive and not node.else_ )
if node.else_: self.writeline(f"if {iteration_indicator}:") self.indent() self.enter_frame(else_frame) self.blockvisit(node.else_, else_frame) self.leave_frame(else_frame) self.outdent()
# if the node was recursive we have to return the buffer contents # and start the iteration code if node.recursive: self.return_buffer_contents(loop_frame) self.outdent() self.start_write(frame, node) self.write(f"{self.choose_async('await ')}loop(") if self.environment.is_async: self.write("auto_aiter(") self.visit(node.iter, frame) if self.environment.is_async: self.write(")") self.write(", loop)") self.end_write(frame)
# at the end of the iteration, clear any assignments made in the # loop from the top level if self._assign_stack: self._assign_stack[-1].difference_update(loop_frame.symbols.stores)
def visit_If(self, node: nodes.If, frame: Frame) -> None: if_frame = frame.soft() self.writeline("if ", node) self.visit(node.test, if_frame) self.write(":") self.indent() self.blockvisit(node.body, if_frame) self.outdent() for elif_ in node.elif_: self.writeline("elif ", elif_) self.visit(elif_.test, if_frame) self.write(":") self.indent() self.blockvisit(elif_.body, if_frame) self.outdent() if node.else_: self.writeline("else:") self.indent() self.blockvisit(node.else_, if_frame) self.outdent()
def visit_Macro(self, node: nodes.Macro, frame: Frame) -> None: macro_frame, macro_ref = self.macro_body(node, frame) self.newline() if frame.toplevel: if not node.name.startswith("_"): self.write(f"context.exported_vars.add({node.name!r})") self.writeline(f"context.vars[{node.name!r}] = ") self.write(f"{frame.symbols.ref(node.name)} = ") self.macro_def(macro_ref, macro_frame)
def visit_CallBlock(self, node: nodes.CallBlock, frame: Frame) -> None: call_frame, macro_ref = self.macro_body(node, frame) self.writeline("caller = ") self.macro_def(macro_ref, call_frame) self.start_write(frame, node) self.visit_Call(node.call, frame, forward_caller=True) self.end_write(frame)
def visit_FilterBlock(self, node: nodes.FilterBlock, frame: Frame) -> None: filter_frame = frame.inner() filter_frame.symbols.analyze_node(node) self.enter_frame(filter_frame) self.buffer(filter_frame) self.blockvisit(node.body, filter_frame) self.start_write(frame, node) self.visit_Filter(node.filter, filter_frame) self.end_write(frame) self.leave_frame(filter_frame)
def visit_With(self, node: nodes.With, frame: Frame) -> None: with_frame = frame.inner() with_frame.symbols.analyze_node(node) self.enter_frame(with_frame) for target, expr in zip(node.targets, node.values): self.newline() self.visit(target, with_frame) self.write(" = ") self.visit(expr, frame) self.blockvisit(node.body, with_frame) self.leave_frame(with_frame)
def visit_ExprStmt(self, node: nodes.ExprStmt, frame: Frame) -> None: self.newline(node) self.visit(node.node, frame)
class _FinalizeInfo(t.NamedTuple): const: t.Optional[t.Callable[..., str]] src: t.Optional[str]
@staticmethod def _default_finalize(value: t.Any) -> t.Any: """The default finalize function if the environment isn't configured with one. Or, if the environment has one, this is called on that function's output for constants. """ return str(value)
_finalize: t.Optional[_FinalizeInfo] = None
def _make_finalize(self) -> _FinalizeInfo: """Build the finalize function to be used on constants and at runtime. Cached so it's only created once for all output nodes.
Returns a ``namedtuple`` with the following attributes:
``const`` A function to finalize constant data at compile time.
``src`` Source code to output around nodes to be evaluated at runtime. """ if self._finalize is not None: return self._finalize
finalize: t.Optional[t.Callable[..., t.Any]] finalize = default = self._default_finalize src = None
if self.environment.finalize: src = "environment.finalize(" env_finalize = self.environment.finalize pass_arg = { _PassArg.context: "context", _PassArg.eval_context: "context.eval_ctx", _PassArg.environment: "environment", }.get( _PassArg.from_obj(env_finalize) # type: ignore ) finalize = None
if pass_arg is None:
def finalize(value: t.Any) -> t.Any: # noqa: F811 return default(env_finalize(value))
else: src = f"{src}{pass_arg}, "
if pass_arg == "environment":
def finalize(value: t.Any) -> t.Any: # noqa: F811 return default(env_finalize(self.environment, value))
self._finalize = self._FinalizeInfo(finalize, src) return self._finalize
def _output_const_repr(self, group: t.Iterable[t.Any]) -> str: """Given a group of constant values converted from ``Output`` child nodes, produce a string to write to the template module source. """ return repr(concat(group))
def _output_child_to_const( self, node: nodes.Expr, frame: Frame, finalize: _FinalizeInfo ) -> str: """Try to optimize a child of an ``Output`` node by trying to convert it to constant, finalized data at compile time.
If :exc:`Impossible` is raised, the node is not constant and will be evaluated at runtime. Any other exception will also be evaluated at runtime for easier debugging. """ const = node.as_const(frame.eval_ctx)
if frame.eval_ctx.autoescape: const = escape(const)
# Template data doesn't go through finalize. if isinstance(node, nodes.TemplateData): return str(const)
return finalize.const(const) # type: ignore
def _output_child_pre( self, node: nodes.Expr, frame: Frame, finalize: _FinalizeInfo ) -> None: """Output extra source code before visiting a child of an ``Output`` node. """ if frame.eval_ctx.volatile: self.write("(escape if context.eval_ctx.autoescape else str)(") elif frame.eval_ctx.autoescape: self.write("escape(") else: self.write("str(")
if finalize.src is not None: self.write(finalize.src)
def _output_child_post( self, node: nodes.Expr, frame: Frame, finalize: _FinalizeInfo ) -> None: """Output extra source code after visiting a child of an ``Output`` node. """ self.write(")")
if finalize.src is not None: self.write(")")
def visit_Output(self, node: nodes.Output, frame: Frame) -> None: # If an extends is active, don't render outside a block. if frame.require_output_check: # A top-level extends is known to exist at compile time. if self.has_known_extends: return
self.writeline("if parent_template is None:") self.indent()
finalize = self._make_finalize() body: t.List[t.Union[t.List[t.Any], nodes.Expr]] = []
# Evaluate constants at compile time if possible. Each item in # body will be either a list of static data or a node to be # evaluated at runtime. for child in node.nodes: try: if not ( # If the finalize function requires runtime context, # constants can't be evaluated at compile time. finalize.const # Unless it's basic template data that won't be # finalized anyway. or isinstance(child, nodes.TemplateData) ): raise nodes.Impossible()
const = self._output_child_to_const(child, frame, finalize) except (nodes.Impossible, Exception): # The node was not constant and needs to be evaluated at # runtime. Or another error was raised, which is easier # to debug at runtime. body.append(child) continue
if body and isinstance(body[-1], list): body[-1].append(const) else: body.append([const])
if frame.buffer is not None: if len(body) == 1: self.writeline(f"{frame.buffer}.append(") else: self.writeline(f"{frame.buffer}.extend((")
self.indent()
for item in body: if isinstance(item, list): # A group of constant data to join and output. val = self._output_const_repr(item)
if frame.buffer is None: self.writeline("yield " + val) else: self.writeline(val + ",") else: if frame.buffer is None: self.writeline("yield ", item) else: self.newline(item)
# A node to be evaluated at runtime. self._output_child_pre(item, frame, finalize) self.visit(item, frame) self._output_child_post(item, frame, finalize)
if frame.buffer is not None: self.write(",")
if frame.buffer is not None: self.outdent() self.writeline(")" if len(body) == 1 else "))")
if frame.require_output_check: self.outdent()
def visit_Assign(self, node: nodes.Assign, frame: Frame) -> None: self.push_assign_tracking()
# ``a.b`` is allowed for assignment, and is parsed as an NSRef. However, # it is only valid if it references a Namespace object. Emit a check for # that for each ref here, before assignment code is emitted. This can't # be done in visit_NSRef as the ref could be in the middle of a tuple. seen_refs: t.Set[str] = set()
for nsref in node.find_all(nodes.NSRef): if nsref.name in seen_refs: # Only emit the check for each reference once, in case the same # ref is used multiple times in a tuple, `ns.a, ns.b = c, d`. continue
seen_refs.add(nsref.name) ref = frame.symbols.ref(nsref.name) self.writeline(f"if not isinstance({ref}, Namespace):") self.indent() self.writeline( "raise TemplateRuntimeError" '("cannot assign attribute on non-namespace object")' ) self.outdent()
self.newline(node) self.visit(node.target, frame) self.write(" = ") self.visit(node.node, frame) self.pop_assign_tracking(frame)
def visit_AssignBlock(self, node: nodes.AssignBlock, frame: Frame) -> None: self.push_assign_tracking() block_frame = frame.inner() # This is a special case. Since a set block always captures we # will disable output checks. This way one can use set blocks # toplevel even in extended templates. block_frame.require_output_check = False block_frame.symbols.analyze_node(node) self.enter_frame(block_frame) self.buffer(block_frame) self.blockvisit(node.body, block_frame) self.newline(node) self.visit(node.target, frame) self.write(" = (Markup if context.eval_ctx.autoescape else identity)(") if node.filter is not None: self.visit_Filter(node.filter, block_frame) else: self.write(f"concat({block_frame.buffer})") self.write(")") self.pop_assign_tracking(frame) self.leave_frame(block_frame)
# -- Expression Visitors
def visit_Name(self, node: nodes.Name, frame: Frame) -> None: if node.ctx == "store" and ( frame.toplevel or frame.loop_frame or frame.block_frame ): if self._assign_stack: self._assign_stack[-1].add(node.name) ref = frame.symbols.ref(node.name)
# If we are looking up a variable we might have to deal with the # case where it's undefined. We can skip that case if the load # instruction indicates a parameter which are always defined. if node.ctx == "load": load = frame.symbols.find_load(ref) if not ( load is not None and load[0] == VAR_LOAD_PARAMETER and not self.parameter_is_undeclared(ref) ): self.write( f"(undefined(name={node.name!r}) if {ref} is missing else {ref})" ) return
self.write(ref)
def visit_NSRef(self, node: nodes.NSRef, frame: Frame) -> None: # NSRef is a dotted assignment target a.b=c, but uses a[b]=c internally. # visit_Assign emits code to validate that each ref is to a Namespace # object only. That can't be emitted here as the ref could be in the # middle of a tuple assignment. ref = frame.symbols.ref(node.name) self.writeline(f"{ref}[{node.attr!r}]")
def visit_Const(self, node: nodes.Const, frame: Frame) -> None: val = node.as_const(frame.eval_ctx) if isinstance(val, float): self.write(str(val)) else: self.write(repr(val))
def visit_TemplateData(self, node: nodes.TemplateData, frame: Frame) -> None: try: self.write(repr(node.as_const(frame.eval_ctx))) except nodes.Impossible: self.write( f"(Markup if context.eval_ctx.autoescape else identity)({node.data!r})" )
def visit_Tuple(self, node: nodes.Tuple, frame: Frame) -> None: self.write("(") idx = -1 for idx, item in enumerate(node.items): if idx: self.write(", ") self.visit(item, frame) self.write(",)" if idx == 0 else ")")
def visit_List(self, node: nodes.List, frame: Frame) -> None: self.write("[") for idx, item in enumerate(node.items): if idx: self.write(", ") self.visit(item, frame) self.write("]")
def visit_Dict(self, node: nodes.Dict, frame: Frame) -> None: self.write("{") for idx, item in enumerate(node.items): if idx: self.write(", ") self.visit(item.key, frame) self.write(": ") self.visit(item.value, frame) self.write("}")
visit_Add = _make_binop("+") visit_Sub = _make_binop("-") visit_Mul = _make_binop("*") visit_Div = _make_binop("/") visit_FloorDiv = _make_binop("//") visit_Pow = _make_binop("**") visit_Mod = _make_binop("%") visit_And = _make_binop("and") visit_Or = _make_binop("or") visit_Pos = _make_unop("+") visit_Neg = _make_unop("-") visit_Not = _make_unop("not ")
@optimizeconst def visit_Concat(self, node: nodes.Concat, frame: Frame) -> None: if frame.eval_ctx.volatile: func_name = "(markup_join if context.eval_ctx.volatile else str_join)" elif frame.eval_ctx.autoescape: func_name = "markup_join" else: func_name = "str_join" self.write(f"{func_name}((") for arg in node.nodes: self.visit(arg, frame) self.write(", ") self.write("))")
@optimizeconst def visit_Compare(self, node: nodes.Compare, frame: Frame) -> None: self.write("(") self.visit(node.expr, frame) for op in node.ops: self.visit(op, frame) self.write(")")
def visit_Operand(self, node: nodes.Operand, frame: Frame) -> None: self.write(f" {operators[node.op]} ") self.visit(node.expr, frame)
@optimizeconst def visit_Getattr(self, node: nodes.Getattr, frame: Frame) -> None: if self.environment.is_async: self.write("(await auto_await(")
self.write("environment.getattr(") self.visit(node.node, frame) self.write(f", {node.attr!r})")
if self.environment.is_async: self.write("))")
@optimizeconst def visit_Getitem(self, node: nodes.Getitem, frame: Frame) -> None: # slices bypass the environment getitem method. if isinstance(node.arg, nodes.Slice): self.visit(node.node, frame) self.write("[") self.visit(node.arg, frame) self.write("]") else: if self.environment.is_async: self.write("(await auto_await(")
self.write("environment.getitem(") self.visit(node.node, frame) self.write(", ") self.visit(node.arg, frame) self.write(")")
if self.environment.is_async: self.write("))")
def visit_Slice(self, node: nodes.Slice, frame: Frame) -> None: if node.start is not None: self.visit(node.start, frame) self.write(":") if node.stop is not None: self.visit(node.stop, frame) if node.step is not None: self.write(":") self.visit(node.step, frame)
@contextmanager def _filter_test_common( self, node: t.Union[nodes.Filter, nodes.Test], frame: Frame, is_filter: bool ) -> t.Iterator[None]: if self.environment.is_async: self.write("(await auto_await(")
if is_filter: self.write(f"{self.filters[node.name]}(") func = self.environment.filters.get(node.name) else: self.write(f"{self.tests[node.name]}(") func = self.environment.tests.get(node.name)
# When inside an If or CondExpr frame, allow the filter to be # undefined at compile time and only raise an error if it's # actually called at runtime. See pull_dependencies. if func is None and not frame.soft_frame: type_name = "filter" if is_filter else "test" self.fail(f"No {type_name} named {node.name!r}.", node.lineno)
pass_arg = { _PassArg.context: "context", _PassArg.eval_context: "context.eval_ctx", _PassArg.environment: "environment", }.get( _PassArg.from_obj(func) # type: ignore )
if pass_arg is not None: self.write(f"{pass_arg}, ")
# Back to the visitor function to handle visiting the target of # the filter or test. yield
self.signature(node, frame) self.write(")")
if self.environment.is_async: self.write("))")
@optimizeconst def visit_Filter(self, node: nodes.Filter, frame: Frame) -> None: with self._filter_test_common(node, frame, True): # if the filter node is None we are inside a filter block # and want to write to the current buffer if node.node is not None: self.visit(node.node, frame) elif frame.eval_ctx.volatile: self.write( f"(Markup(concat({frame.buffer}))" f" if context.eval_ctx.autoescape else concat({frame.buffer}))" ) elif frame.eval_ctx.autoescape: self.write(f"Markup(concat({frame.buffer}))") else: self.write(f"concat({frame.buffer})")
@optimizeconst def visit_Test(self, node: nodes.Test, frame: Frame) -> None: with self._filter_test_common(node, frame, False): self.visit(node.node, frame)
@optimizeconst def visit_CondExpr(self, node: nodes.CondExpr, frame: Frame) -> None: frame = frame.soft()
def write_expr2() -> None: if node.expr2 is not None: self.visit(node.expr2, frame) return
self.write( f'cond_expr_undefined("the inline if-expression on' f" {self.position(node)} evaluated to false and no else" f' section was defined.")' )
self.write("(") self.visit(node.expr1, frame) self.write(" if ") self.visit(node.test, frame) self.write(" else ") write_expr2() self.write(")")
@optimizeconst def visit_Call( self, node: nodes.Call, frame: Frame, forward_caller: bool = False ) -> None: if self.environment.is_async: self.write("(await auto_await(") if self.environment.sandboxed: self.write("environment.call(context, ") else: self.write("context.call(") self.visit(node.node, frame) extra_kwargs = {"caller": "caller"} if forward_caller else None loop_kwargs = {"_loop_vars": "_loop_vars"} if frame.loop_frame else {} block_kwargs = {"_block_vars": "_block_vars"} if frame.block_frame else {} if extra_kwargs: extra_kwargs.update(loop_kwargs, **block_kwargs) elif loop_kwargs or block_kwargs: extra_kwargs = dict(loop_kwargs, **block_kwargs) self.signature(node, frame, extra_kwargs) self.write(")") if self.environment.is_async: self.write("))")
def visit_Keyword(self, node: nodes.Keyword, frame: Frame) -> None: self.write(node.key + "=") self.visit(node.value, frame)
# -- Unused nodes for extensions
def visit_MarkSafe(self, node: nodes.MarkSafe, frame: Frame) -> None: self.write("Markup(") self.visit(node.expr, frame) self.write(")")
def visit_MarkSafeIfAutoescape( self, node: nodes.MarkSafeIfAutoescape, frame: Frame ) -> None: self.write("(Markup if context.eval_ctx.autoescape else identity)(") self.visit(node.expr, frame) self.write(")")
def visit_EnvironmentAttribute( self, node: nodes.EnvironmentAttribute, frame: Frame ) -> None: self.write("environment." + node.name)
def visit_ExtensionAttribute( self, node: nodes.ExtensionAttribute, frame: Frame ) -> None: self.write(f"environment.extensions[{node.identifier!r}].{node.name}")
def visit_ImportedName(self, node: nodes.ImportedName, frame: Frame) -> None: self.write(self.import_aliases[node.importname])
def visit_InternalName(self, node: nodes.InternalName, frame: Frame) -> None: self.write(node.name)
def visit_ContextReference( self, node: nodes.ContextReference, frame: Frame ) -> None: self.write("context")
def visit_DerivedContextReference( self, node: nodes.DerivedContextReference, frame: Frame ) -> None: self.write(self.derive_context(frame))
def visit_Continue(self, node: nodes.Continue, frame: Frame) -> None: self.writeline("continue", node)
def visit_Break(self, node: nodes.Break, frame: Frame) -> None: self.writeline("break", node)
def visit_Scope(self, node: nodes.Scope, frame: Frame) -> None: scope_frame = frame.inner() scope_frame.symbols.analyze_node(node) self.enter_frame(scope_frame) self.blockvisit(node.body, scope_frame) self.leave_frame(scope_frame)
def visit_OverlayScope(self, node: nodes.OverlayScope, frame: Frame) -> None: ctx = self.temporary_identifier() self.writeline(f"{ctx} = {self.derive_context(frame)}") self.writeline(f"{ctx}.vars = ") self.visit(node.context, frame) self.push_context_reference(ctx)
scope_frame = frame.inner(isolated=True) scope_frame.symbols.analyze_node(node) self.enter_frame(scope_frame) self.blockvisit(node.body, scope_frame) self.leave_frame(scope_frame) self.pop_context_reference()
def visit_EvalContextModifier( self, node: nodes.EvalContextModifier, frame: Frame ) -> None: for keyword in node.options: self.writeline(f"context.eval_ctx.{keyword.key} = ") self.visit(keyword.value, frame) try: val = keyword.value.as_const(frame.eval_ctx) except nodes.Impossible: frame.eval_ctx.volatile = True else: setattr(frame.eval_ctx, keyword.key, val)
def visit_ScopedEvalContextModifier( self, node: nodes.ScopedEvalContextModifier, frame: Frame ) -> None: old_ctx_name = self.temporary_identifier() saved_ctx = frame.eval_ctx.save() self.writeline(f"{old_ctx_name} = context.eval_ctx.save()") self.visit_EvalContextModifier(node, frame) for child in node.body: self.visit(child, frame) frame.eval_ctx.revert(saved_ctx) self.writeline(f"context.eval_ctx.revert({old_ctx_name})")lib/python3.12/site-packages/_distutils_hack/__init__.pyAdded+239
lib/python3.12/site-packages/_distutils_hack/__pycache__/__init__.cpython-312.pycAdded
lib/python3.12/site-packages/_distutils_hack/__pycache__/override.cpython-312.pycAdded
lib/python3.12/site-packages/_distutils_hack/override.pyAdded+1
lib/python3.12/site-packages/dill-0.3.8.dist-info/INSTALLERAdded+1
lib/python3.12/site-packages/dill-0.3.8.dist-info/LICENSEAdded+35
lib/python3.12/site-packages/dill-0.3.8.dist-info/METADATAAdded+280
lib/python3.12/site-packages/dill-0.3.8.dist-info/RECORDAdded+97
lib/python3.12/site-packages/dill-0.3.8.dist-info/WHEELAdded+5
lib/python3.12/site-packages/dill-0.3.8.dist-info/top_level.txtAdded+1
lib/python3.12/site-packages/fsspec-2025.3.0.dist-info/INSTALLERAdded+1
lib/python3.12/site-packages/fsspec-2025.3.0.dist-info/METADATAAdded+278
lib/python3.12/site-packages/fsspec-2025.3.0.dist-info/RECORDAdded+115
lib/python3.12/site-packages/fsspec-2025.3.0.dist-info/WHEELAdded+4
lib/python3.12/site-packages/fsspec-2025.3.0.dist-info/licenses/LICENSEAdded+29
lib/python3.12/site-packages/ipython_pygments_lexers-1.1.1.dist-info/INSTALLERAdded+1
lib/python3.12/site-packages/ipython_pygments_lexers-1.1.1.dist-info/LICENSEAdded+30
lib/python3.12/site-packages/ipython_pygments_lexers-1.1.1.dist-info/METADATAAdded+26
lib/python3.12/site-packages/ipython_pygments_lexers-1.1.1.dist-info/RECORDAdded+8
lib/python3.12/site-packages/ipython_pygments_lexers-1.1.1.dist-info/WHEELAdded+4
lib/python3.12/site-packages/ipython_pygments_lexers-1.1.1.dist-info/entry_points.txtAdded+5
lib/python3.12/site-packages/jinja2/__init__.pyAdded+38
lib/python3.12/site-packages/jinja2/__pycache__/__init__.cpython-312.pycAdded
lib/python3.12/site-packages/jinja2/__pycache__/_identifier.cpython-312.pycAdded
lib/python3.12/site-packages/jinja2/__pycache__/async_utils.cpython-312.pycAdded
lib/python3.12/site-packages/jinja2/__pycache__/bccache.cpython-312.pycAdded
lib/python3.12/site-packages/jinja2/__pycache__/constants.cpython-312.pycAdded
lib/python3.12/site-packages/jinja2/__pycache__/debug.cpython-312.pycAdded
lib/python3.12/site-packages/jinja2/__pycache__/defaults.cpython-312.pycAdded
lib/python3.12/site-packages/jinja2/__pycache__/environment.cpython-312.pycAdded
lib/python3.12/site-packages/jinja2/__pycache__/exceptions.cpython-312.pycAdded
lib/python3.12/site-packages/jinja2/__pycache__/ext.cpython-312.pycAdded
lib/python3.12/site-packages/jinja2/__pycache__/filters.cpython-312.pycAdded
lib/python3.12/site-packages/jinja2/__pycache__/idtracking.cpython-312.pycAdded
lib/python3.12/site-packages/jinja2/__pycache__/lexer.cpython-312.pycAdded
lib/python3.12/site-packages/jinja2/__pycache__/loaders.cpython-312.pycAdded
lib/python3.12/site-packages/jinja2/__pycache__/meta.cpython-312.pycAdded
lib/python3.12/site-packages/jinja2/__pycache__/nativetypes.cpython-312.pycAdded
lib/python3.12/site-packages/jinja2/__pycache__/nodes.cpython-312.pycAdded
lib/python3.12/site-packages/jinja2/__pycache__/optimizer.cpython-312.pycAdded
lib/python3.12/site-packages/jinja2/__pycache__/parser.cpython-312.pycAdded
lib/python3.12/site-packages/jinja2/__pycache__/runtime.cpython-312.pycAdded
lib/python3.12/site-packages/jinja2/__pycache__/sandbox.cpython-312.pycAdded
lib/python3.12/site-packages/jinja2/__pycache__/tests.cpython-312.pycAdded
lib/python3.12/site-packages/jinja2/__pycache__/utils.cpython-312.pycAdded
lib/python3.12/site-packages/jinja2/__pycache__/visitor.cpython-312.pycAdded
lib/python3.12/site-packages/jinja2/_identifier.pyAdded+6
lib/python3.12/site-packages/jinja2/async_utils.pyAdded+99
lib/python3.12/site-packages/jinja2/bccache.pyAdded+408
lib/python3.12/site-packages/jinja2/compiler.pyAdded+1998