cli-ih 0.6.3__py3-none-any.whl → 0.6.3.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cli_ih/asyncClient.py +13 -7
- cli_ih/client.py +13 -6
- {cli_ih-0.6.3.dist-info → cli_ih-0.6.3.1.dist-info}/METADATA +1 -1
- cli_ih-0.6.3.1.dist-info/RECORD +425 -0
- {cli_ih-0.6.3.dist-info → cli_ih-0.6.3.1.dist-info}/WHEEL +1 -1
- {cli_ih-0.6.3.dist-info → cli_ih-0.6.3.1.dist-info}/top_level.txt +1 -0
- venv/Lib/site-packages/__editable___cli_ih_0_6_3_1_finder.py +85 -0
- venv/Lib/site-packages/pip/__init__.py +13 -0
- venv/Lib/site-packages/pip/__main__.py +24 -0
- venv/Lib/site-packages/pip/__pip-runner__.py +50 -0
- venv/Lib/site-packages/pip/_internal/__init__.py +18 -0
- venv/Lib/site-packages/pip/_internal/build_env.py +349 -0
- venv/Lib/site-packages/pip/_internal/cache.py +291 -0
- venv/Lib/site-packages/pip/_internal/cli/__init__.py +3 -0
- venv/Lib/site-packages/pip/_internal/cli/autocompletion.py +184 -0
- venv/Lib/site-packages/pip/_internal/cli/base_command.py +244 -0
- venv/Lib/site-packages/pip/_internal/cli/cmdoptions.py +1138 -0
- venv/Lib/site-packages/pip/_internal/cli/command_context.py +28 -0
- venv/Lib/site-packages/pip/_internal/cli/index_command.py +175 -0
- venv/Lib/site-packages/pip/_internal/cli/main.py +80 -0
- venv/Lib/site-packages/pip/_internal/cli/main_parser.py +134 -0
- venv/Lib/site-packages/pip/_internal/cli/parser.py +298 -0
- venv/Lib/site-packages/pip/_internal/cli/progress_bars.py +151 -0
- venv/Lib/site-packages/pip/_internal/cli/req_command.py +351 -0
- venv/Lib/site-packages/pip/_internal/cli/spinners.py +235 -0
- venv/Lib/site-packages/pip/_internal/cli/status_codes.py +6 -0
- venv/Lib/site-packages/pip/_internal/commands/__init__.py +139 -0
- venv/Lib/site-packages/pip/_internal/commands/cache.py +231 -0
- venv/Lib/site-packages/pip/_internal/commands/check.py +66 -0
- venv/Lib/site-packages/pip/_internal/commands/completion.py +135 -0
- venv/Lib/site-packages/pip/_internal/commands/configuration.py +288 -0
- venv/Lib/site-packages/pip/_internal/commands/debug.py +203 -0
- venv/Lib/site-packages/pip/_internal/commands/download.py +145 -0
- venv/Lib/site-packages/pip/_internal/commands/freeze.py +107 -0
- venv/Lib/site-packages/pip/_internal/commands/hash.py +58 -0
- venv/Lib/site-packages/pip/_internal/commands/help.py +40 -0
- venv/Lib/site-packages/pip/_internal/commands/index.py +159 -0
- venv/Lib/site-packages/pip/_internal/commands/inspect.py +92 -0
- venv/Lib/site-packages/pip/_internal/commands/install.py +798 -0
- venv/Lib/site-packages/pip/_internal/commands/list.py +400 -0
- venv/Lib/site-packages/pip/_internal/commands/lock.py +170 -0
- venv/Lib/site-packages/pip/_internal/commands/search.py +178 -0
- venv/Lib/site-packages/pip/_internal/commands/show.py +231 -0
- venv/Lib/site-packages/pip/_internal/commands/uninstall.py +113 -0
- venv/Lib/site-packages/pip/_internal/commands/wheel.py +181 -0
- venv/Lib/site-packages/pip/_internal/configuration.py +397 -0
- venv/Lib/site-packages/pip/_internal/distributions/__init__.py +21 -0
- venv/Lib/site-packages/pip/_internal/distributions/base.py +55 -0
- venv/Lib/site-packages/pip/_internal/distributions/installed.py +33 -0
- venv/Lib/site-packages/pip/_internal/distributions/sdist.py +165 -0
- venv/Lib/site-packages/pip/_internal/distributions/wheel.py +44 -0
- venv/Lib/site-packages/pip/_internal/exceptions.py +881 -0
- venv/Lib/site-packages/pip/_internal/index/__init__.py +1 -0
- venv/Lib/site-packages/pip/_internal/index/collector.py +489 -0
- venv/Lib/site-packages/pip/_internal/index/package_finder.py +1059 -0
- venv/Lib/site-packages/pip/_internal/index/sources.py +287 -0
- venv/Lib/site-packages/pip/_internal/locations/__init__.py +441 -0
- venv/Lib/site-packages/pip/_internal/locations/_distutils.py +173 -0
- venv/Lib/site-packages/pip/_internal/locations/_sysconfig.py +215 -0
- venv/Lib/site-packages/pip/_internal/locations/base.py +82 -0
- venv/Lib/site-packages/pip/_internal/main.py +12 -0
- venv/Lib/site-packages/pip/_internal/metadata/__init__.py +164 -0
- venv/Lib/site-packages/pip/_internal/metadata/_json.py +87 -0
- venv/Lib/site-packages/pip/_internal/metadata/base.py +685 -0
- venv/Lib/site-packages/pip/_internal/metadata/importlib/__init__.py +6 -0
- venv/Lib/site-packages/pip/_internal/metadata/importlib/_compat.py +87 -0
- venv/Lib/site-packages/pip/_internal/metadata/importlib/_dists.py +223 -0
- venv/Lib/site-packages/pip/_internal/metadata/importlib/_envs.py +143 -0
- venv/Lib/site-packages/pip/_internal/metadata/pkg_resources.py +298 -0
- venv/Lib/site-packages/pip/_internal/models/__init__.py +1 -0
- venv/Lib/site-packages/pip/_internal/models/candidate.py +25 -0
- venv/Lib/site-packages/pip/_internal/models/direct_url.py +227 -0
- venv/Lib/site-packages/pip/_internal/models/format_control.py +78 -0
- venv/Lib/site-packages/pip/_internal/models/index.py +28 -0
- venv/Lib/site-packages/pip/_internal/models/installation_report.py +57 -0
- venv/Lib/site-packages/pip/_internal/models/link.py +613 -0
- venv/Lib/site-packages/pip/_internal/models/pylock.py +188 -0
- venv/Lib/site-packages/pip/_internal/models/scheme.py +25 -0
- venv/Lib/site-packages/pip/_internal/models/search_scope.py +126 -0
- venv/Lib/site-packages/pip/_internal/models/selection_prefs.py +53 -0
- venv/Lib/site-packages/pip/_internal/models/target_python.py +122 -0
- venv/Lib/site-packages/pip/_internal/models/wheel.py +141 -0
- venv/Lib/site-packages/pip/_internal/network/__init__.py +1 -0
- venv/Lib/site-packages/pip/_internal/network/auth.py +564 -0
- venv/Lib/site-packages/pip/_internal/network/cache.py +133 -0
- venv/Lib/site-packages/pip/_internal/network/download.py +342 -0
- venv/Lib/site-packages/pip/_internal/network/lazy_wheel.py +213 -0
- venv/Lib/site-packages/pip/_internal/network/session.py +528 -0
- venv/Lib/site-packages/pip/_internal/network/utils.py +98 -0
- venv/Lib/site-packages/pip/_internal/network/xmlrpc.py +61 -0
- venv/Lib/site-packages/pip/_internal/operations/__init__.py +0 -0
- venv/Lib/site-packages/pip/_internal/operations/build/__init__.py +0 -0
- venv/Lib/site-packages/pip/_internal/operations/build/build_tracker.py +140 -0
- venv/Lib/site-packages/pip/_internal/operations/build/metadata.py +38 -0
- venv/Lib/site-packages/pip/_internal/operations/build/metadata_editable.py +41 -0
- venv/Lib/site-packages/pip/_internal/operations/build/metadata_legacy.py +73 -0
- venv/Lib/site-packages/pip/_internal/operations/build/wheel.py +38 -0
- venv/Lib/site-packages/pip/_internal/operations/build/wheel_editable.py +47 -0
- venv/Lib/site-packages/pip/_internal/operations/build/wheel_legacy.py +119 -0
- venv/Lib/site-packages/pip/_internal/operations/check.py +175 -0
- venv/Lib/site-packages/pip/_internal/operations/freeze.py +259 -0
- venv/Lib/site-packages/pip/_internal/operations/install/__init__.py +1 -0
- venv/Lib/site-packages/pip/_internal/operations/install/editable_legacy.py +48 -0
- venv/Lib/site-packages/pip/_internal/operations/install/wheel.py +746 -0
- venv/Lib/site-packages/pip/_internal/operations/prepare.py +742 -0
- venv/Lib/site-packages/pip/_internal/pyproject.py +182 -0
- venv/Lib/site-packages/pip/_internal/req/__init__.py +105 -0
- venv/Lib/site-packages/pip/_internal/req/constructors.py +562 -0
- venv/Lib/site-packages/pip/_internal/req/req_dependency_group.py +75 -0
- venv/Lib/site-packages/pip/_internal/req/req_file.py +620 -0
- venv/Lib/site-packages/pip/_internal/req/req_install.py +937 -0
- venv/Lib/site-packages/pip/_internal/req/req_set.py +81 -0
- venv/Lib/site-packages/pip/_internal/req/req_uninstall.py +639 -0
- venv/Lib/site-packages/pip/_internal/resolution/__init__.py +0 -0
- venv/Lib/site-packages/pip/_internal/resolution/base.py +20 -0
- venv/Lib/site-packages/pip/_internal/resolution/legacy/__init__.py +0 -0
- venv/Lib/site-packages/pip/_internal/resolution/legacy/resolver.py +598 -0
- venv/Lib/site-packages/pip/_internal/resolution/resolvelib/__init__.py +0 -0
- venv/Lib/site-packages/pip/_internal/resolution/resolvelib/base.py +142 -0
- venv/Lib/site-packages/pip/_internal/resolution/resolvelib/candidates.py +582 -0
- venv/Lib/site-packages/pip/_internal/resolution/resolvelib/factory.py +814 -0
- venv/Lib/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py +166 -0
- venv/Lib/site-packages/pip/_internal/resolution/resolvelib/provider.py +276 -0
- venv/Lib/site-packages/pip/_internal/resolution/resolvelib/reporter.py +85 -0
- venv/Lib/site-packages/pip/_internal/resolution/resolvelib/requirements.py +247 -0
- venv/Lib/site-packages/pip/_internal/resolution/resolvelib/resolver.py +336 -0
- venv/Lib/site-packages/pip/_internal/self_outdated_check.py +254 -0
- venv/Lib/site-packages/pip/_internal/utils/__init__.py +0 -0
- venv/Lib/site-packages/pip/_internal/utils/_jaraco_text.py +109 -0
- venv/Lib/site-packages/pip/_internal/utils/_log.py +38 -0
- venv/Lib/site-packages/pip/_internal/utils/appdirs.py +52 -0
- venv/Lib/site-packages/pip/_internal/utils/compat.py +85 -0
- venv/Lib/site-packages/pip/_internal/utils/compatibility_tags.py +201 -0
- venv/Lib/site-packages/pip/_internal/utils/datetime.py +10 -0
- venv/Lib/site-packages/pip/_internal/utils/deprecation.py +126 -0
- venv/Lib/site-packages/pip/_internal/utils/direct_url_helpers.py +87 -0
- venv/Lib/site-packages/pip/_internal/utils/egg_link.py +81 -0
- venv/Lib/site-packages/pip/_internal/utils/entrypoints.py +88 -0
- venv/Lib/site-packages/pip/_internal/utils/filesystem.py +152 -0
- venv/Lib/site-packages/pip/_internal/utils/filetypes.py +24 -0
- venv/Lib/site-packages/pip/_internal/utils/glibc.py +102 -0
- venv/Lib/site-packages/pip/_internal/utils/hashes.py +150 -0
- venv/Lib/site-packages/pip/_internal/utils/logging.py +364 -0
- venv/Lib/site-packages/pip/_internal/utils/misc.py +765 -0
- venv/Lib/site-packages/pip/_internal/utils/packaging.py +44 -0
- venv/Lib/site-packages/pip/_internal/utils/retry.py +45 -0
- venv/Lib/site-packages/pip/_internal/utils/setuptools_build.py +149 -0
- venv/Lib/site-packages/pip/_internal/utils/subprocess.py +248 -0
- venv/Lib/site-packages/pip/_internal/utils/temp_dir.py +294 -0
- venv/Lib/site-packages/pip/_internal/utils/unpacking.py +337 -0
- venv/Lib/site-packages/pip/_internal/utils/urls.py +55 -0
- venv/Lib/site-packages/pip/_internal/utils/virtualenv.py +105 -0
- venv/Lib/site-packages/pip/_internal/utils/wheel.py +132 -0
- venv/Lib/site-packages/pip/_internal/vcs/__init__.py +15 -0
- venv/Lib/site-packages/pip/_internal/vcs/bazaar.py +130 -0
- venv/Lib/site-packages/pip/_internal/vcs/git.py +571 -0
- venv/Lib/site-packages/pip/_internal/vcs/mercurial.py +186 -0
- venv/Lib/site-packages/pip/_internal/vcs/subversion.py +335 -0
- venv/Lib/site-packages/pip/_internal/vcs/versioncontrol.py +693 -0
- venv/Lib/site-packages/pip/_internal/wheel_builder.py +334 -0
- venv/Lib/site-packages/pip/_vendor/__init__.py +117 -0
- venv/Lib/site-packages/pip/_vendor/cachecontrol/__init__.py +29 -0
- venv/Lib/site-packages/pip/_vendor/cachecontrol/_cmd.py +70 -0
- venv/Lib/site-packages/pip/_vendor/cachecontrol/adapter.py +168 -0
- venv/Lib/site-packages/pip/_vendor/cachecontrol/cache.py +75 -0
- venv/Lib/site-packages/pip/_vendor/cachecontrol/caches/__init__.py +8 -0
- venv/Lib/site-packages/pip/_vendor/cachecontrol/caches/file_cache.py +145 -0
- venv/Lib/site-packages/pip/_vendor/cachecontrol/caches/redis_cache.py +48 -0
- venv/Lib/site-packages/pip/_vendor/cachecontrol/controller.py +511 -0
- venv/Lib/site-packages/pip/_vendor/cachecontrol/filewrapper.py +119 -0
- venv/Lib/site-packages/pip/_vendor/cachecontrol/heuristics.py +157 -0
- venv/Lib/site-packages/pip/_vendor/cachecontrol/py.typed +0 -0
- venv/Lib/site-packages/pip/_vendor/cachecontrol/serialize.py +146 -0
- venv/Lib/site-packages/pip/_vendor/cachecontrol/wrapper.py +43 -0
- venv/Lib/site-packages/pip/_vendor/certifi/__init__.py +4 -0
- venv/Lib/site-packages/pip/_vendor/certifi/__main__.py +12 -0
- venv/Lib/site-packages/pip/_vendor/certifi/core.py +83 -0
- venv/Lib/site-packages/pip/_vendor/certifi/py.typed +0 -0
- venv/Lib/site-packages/pip/_vendor/dependency_groups/__init__.py +13 -0
- venv/Lib/site-packages/pip/_vendor/dependency_groups/__main__.py +65 -0
- venv/Lib/site-packages/pip/_vendor/dependency_groups/_implementation.py +209 -0
- venv/Lib/site-packages/pip/_vendor/dependency_groups/_lint_dependency_groups.py +59 -0
- venv/Lib/site-packages/pip/_vendor/dependency_groups/_pip_wrapper.py +62 -0
- venv/Lib/site-packages/pip/_vendor/dependency_groups/_toml_compat.py +9 -0
- venv/Lib/site-packages/pip/_vendor/dependency_groups/py.typed +0 -0
- venv/Lib/site-packages/pip/_vendor/distlib/__init__.py +33 -0
- venv/Lib/site-packages/pip/_vendor/distlib/compat.py +1137 -0
- venv/Lib/site-packages/pip/_vendor/distlib/resources.py +358 -0
- venv/Lib/site-packages/pip/_vendor/distlib/scripts.py +447 -0
- venv/Lib/site-packages/pip/_vendor/distlib/util.py +1984 -0
- venv/Lib/site-packages/pip/_vendor/distro/__init__.py +54 -0
- venv/Lib/site-packages/pip/_vendor/distro/__main__.py +4 -0
- venv/Lib/site-packages/pip/_vendor/distro/distro.py +1403 -0
- venv/Lib/site-packages/pip/_vendor/distro/py.typed +0 -0
- venv/Lib/site-packages/pip/_vendor/idna/__init__.py +45 -0
- venv/Lib/site-packages/pip/_vendor/idna/codec.py +122 -0
- venv/Lib/site-packages/pip/_vendor/idna/compat.py +15 -0
- venv/Lib/site-packages/pip/_vendor/idna/core.py +437 -0
- venv/Lib/site-packages/pip/_vendor/idna/idnadata.py +4243 -0
- venv/Lib/site-packages/pip/_vendor/idna/intranges.py +57 -0
- venv/Lib/site-packages/pip/_vendor/idna/package_data.py +1 -0
- venv/Lib/site-packages/pip/_vendor/idna/py.typed +0 -0
- venv/Lib/site-packages/pip/_vendor/idna/uts46data.py +8681 -0
- venv/Lib/site-packages/pip/_vendor/msgpack/__init__.py +55 -0
- venv/Lib/site-packages/pip/_vendor/msgpack/exceptions.py +48 -0
- venv/Lib/site-packages/pip/_vendor/msgpack/ext.py +170 -0
- venv/Lib/site-packages/pip/_vendor/msgpack/fallback.py +929 -0
- venv/Lib/site-packages/pip/_vendor/packaging/__init__.py +15 -0
- venv/Lib/site-packages/pip/_vendor/packaging/_elffile.py +109 -0
- venv/Lib/site-packages/pip/_vendor/packaging/_manylinux.py +262 -0
- venv/Lib/site-packages/pip/_vendor/packaging/_musllinux.py +85 -0
- venv/Lib/site-packages/pip/_vendor/packaging/_parser.py +353 -0
- venv/Lib/site-packages/pip/_vendor/packaging/_structures.py +61 -0
- venv/Lib/site-packages/pip/_vendor/packaging/_tokenizer.py +195 -0
- venv/Lib/site-packages/pip/_vendor/packaging/licenses/__init__.py +145 -0
- venv/Lib/site-packages/pip/_vendor/packaging/licenses/_spdx.py +759 -0
- venv/Lib/site-packages/pip/_vendor/packaging/markers.py +362 -0
- venv/Lib/site-packages/pip/_vendor/packaging/metadata.py +862 -0
- venv/Lib/site-packages/pip/_vendor/packaging/py.typed +0 -0
- venv/Lib/site-packages/pip/_vendor/packaging/requirements.py +91 -0
- venv/Lib/site-packages/pip/_vendor/packaging/specifiers.py +1019 -0
- venv/Lib/site-packages/pip/_vendor/packaging/tags.py +656 -0
- venv/Lib/site-packages/pip/_vendor/packaging/utils.py +163 -0
- venv/Lib/site-packages/pip/_vendor/packaging/version.py +582 -0
- venv/Lib/site-packages/pip/_vendor/pkg_resources/__init__.py +3676 -0
- venv/Lib/site-packages/pip/_vendor/platformdirs/__init__.py +631 -0
- venv/Lib/site-packages/pip/_vendor/platformdirs/__main__.py +55 -0
- venv/Lib/site-packages/pip/_vendor/platformdirs/android.py +249 -0
- venv/Lib/site-packages/pip/_vendor/platformdirs/api.py +299 -0
- venv/Lib/site-packages/pip/_vendor/platformdirs/macos.py +144 -0
- venv/Lib/site-packages/pip/_vendor/platformdirs/py.typed +0 -0
- venv/Lib/site-packages/pip/_vendor/platformdirs/unix.py +272 -0
- venv/Lib/site-packages/pip/_vendor/platformdirs/version.py +21 -0
- venv/Lib/site-packages/pip/_vendor/platformdirs/windows.py +272 -0
- venv/Lib/site-packages/pip/_vendor/pygments/__init__.py +82 -0
- venv/Lib/site-packages/pip/_vendor/pygments/__main__.py +17 -0
- venv/Lib/site-packages/pip/_vendor/pygments/console.py +70 -0
- venv/Lib/site-packages/pip/_vendor/pygments/filter.py +70 -0
- venv/Lib/site-packages/pip/_vendor/pygments/filters/__init__.py +940 -0
- venv/Lib/site-packages/pip/_vendor/pygments/formatter.py +129 -0
- venv/Lib/site-packages/pip/_vendor/pygments/formatters/__init__.py +157 -0
- venv/Lib/site-packages/pip/_vendor/pygments/formatters/_mapping.py +23 -0
- venv/Lib/site-packages/pip/_vendor/pygments/lexer.py +963 -0
- venv/Lib/site-packages/pip/_vendor/pygments/lexers/__init__.py +362 -0
- venv/Lib/site-packages/pip/_vendor/pygments/lexers/_mapping.py +602 -0
- venv/Lib/site-packages/pip/_vendor/pygments/lexers/python.py +1201 -0
- venv/Lib/site-packages/pip/_vendor/pygments/modeline.py +43 -0
- venv/Lib/site-packages/pip/_vendor/pygments/plugin.py +72 -0
- venv/Lib/site-packages/pip/_vendor/pygments/regexopt.py +91 -0
- venv/Lib/site-packages/pip/_vendor/pygments/scanner.py +104 -0
- venv/Lib/site-packages/pip/_vendor/pygments/sphinxext.py +247 -0
- venv/Lib/site-packages/pip/_vendor/pygments/style.py +203 -0
- venv/Lib/site-packages/pip/_vendor/pygments/styles/__init__.py +61 -0
- venv/Lib/site-packages/pip/_vendor/pygments/styles/_mapping.py +54 -0
- venv/Lib/site-packages/pip/_vendor/pygments/token.py +214 -0
- venv/Lib/site-packages/pip/_vendor/pygments/unistring.py +153 -0
- venv/Lib/site-packages/pip/_vendor/pygments/util.py +324 -0
- venv/Lib/site-packages/pip/_vendor/pyproject_hooks/__init__.py +31 -0
- venv/Lib/site-packages/pip/_vendor/pyproject_hooks/_impl.py +410 -0
- venv/Lib/site-packages/pip/_vendor/pyproject_hooks/_in_process/__init__.py +21 -0
- venv/Lib/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py +389 -0
- venv/Lib/site-packages/pip/_vendor/pyproject_hooks/py.typed +0 -0
- venv/Lib/site-packages/pip/_vendor/requests/__init__.py +179 -0
- venv/Lib/site-packages/pip/_vendor/requests/__version__.py +14 -0
- venv/Lib/site-packages/pip/_vendor/requests/_internal_utils.py +50 -0
- venv/Lib/site-packages/pip/_vendor/requests/adapters.py +719 -0
- venv/Lib/site-packages/pip/_vendor/requests/api.py +157 -0
- venv/Lib/site-packages/pip/_vendor/requests/auth.py +314 -0
- venv/Lib/site-packages/pip/_vendor/requests/certs.py +17 -0
- venv/Lib/site-packages/pip/_vendor/requests/compat.py +90 -0
- venv/Lib/site-packages/pip/_vendor/requests/cookies.py +561 -0
- venv/Lib/site-packages/pip/_vendor/requests/exceptions.py +151 -0
- venv/Lib/site-packages/pip/_vendor/requests/help.py +127 -0
- venv/Lib/site-packages/pip/_vendor/requests/hooks.py +33 -0
- venv/Lib/site-packages/pip/_vendor/requests/models.py +1039 -0
- venv/Lib/site-packages/pip/_vendor/requests/packages.py +25 -0
- venv/Lib/site-packages/pip/_vendor/requests/sessions.py +831 -0
- venv/Lib/site-packages/pip/_vendor/requests/status_codes.py +128 -0
- venv/Lib/site-packages/pip/_vendor/requests/structures.py +99 -0
- venv/Lib/site-packages/pip/_vendor/requests/utils.py +1086 -0
- venv/Lib/site-packages/pip/_vendor/resolvelib/__init__.py +27 -0
- venv/Lib/site-packages/pip/_vendor/resolvelib/providers.py +196 -0
- venv/Lib/site-packages/pip/_vendor/resolvelib/py.typed +0 -0
- venv/Lib/site-packages/pip/_vendor/resolvelib/reporters.py +55 -0
- venv/Lib/site-packages/pip/_vendor/resolvelib/resolvers/__init__.py +27 -0
- venv/Lib/site-packages/pip/_vendor/resolvelib/resolvers/abstract.py +47 -0
- venv/Lib/site-packages/pip/_vendor/resolvelib/resolvers/criterion.py +48 -0
- venv/Lib/site-packages/pip/_vendor/resolvelib/resolvers/exceptions.py +57 -0
- venv/Lib/site-packages/pip/_vendor/resolvelib/resolvers/resolution.py +622 -0
- venv/Lib/site-packages/pip/_vendor/resolvelib/structs.py +209 -0
- venv/Lib/site-packages/pip/_vendor/rich/__init__.py +177 -0
- venv/Lib/site-packages/pip/_vendor/rich/__main__.py +245 -0
- venv/Lib/site-packages/pip/_vendor/rich/_cell_widths.py +454 -0
- venv/Lib/site-packages/pip/_vendor/rich/_emoji_codes.py +3610 -0
- venv/Lib/site-packages/pip/_vendor/rich/_emoji_replace.py +32 -0
- venv/Lib/site-packages/pip/_vendor/rich/_export_format.py +76 -0
- venv/Lib/site-packages/pip/_vendor/rich/_extension.py +10 -0
- venv/Lib/site-packages/pip/_vendor/rich/_fileno.py +24 -0
- venv/Lib/site-packages/pip/_vendor/rich/_inspect.py +268 -0
- venv/Lib/site-packages/pip/_vendor/rich/_log_render.py +94 -0
- venv/Lib/site-packages/pip/_vendor/rich/_loop.py +43 -0
- venv/Lib/site-packages/pip/_vendor/rich/_null_file.py +69 -0
- venv/Lib/site-packages/pip/_vendor/rich/_palettes.py +309 -0
- venv/Lib/site-packages/pip/_vendor/rich/_pick.py +17 -0
- venv/Lib/site-packages/pip/_vendor/rich/_ratio.py +153 -0
- venv/Lib/site-packages/pip/_vendor/rich/_spinners.py +482 -0
- venv/Lib/site-packages/pip/_vendor/rich/_stack.py +16 -0
- venv/Lib/site-packages/pip/_vendor/rich/_timer.py +19 -0
- venv/Lib/site-packages/pip/_vendor/rich/_win32_console.py +661 -0
- venv/Lib/site-packages/pip/_vendor/rich/_windows.py +71 -0
- venv/Lib/site-packages/pip/_vendor/rich/_windows_renderer.py +56 -0
- venv/Lib/site-packages/pip/_vendor/rich/_wrap.py +93 -0
- venv/Lib/site-packages/pip/_vendor/rich/abc.py +33 -0
- venv/Lib/site-packages/pip/_vendor/rich/align.py +306 -0
- venv/Lib/site-packages/pip/_vendor/rich/ansi.py +241 -0
- venv/Lib/site-packages/pip/_vendor/rich/bar.py +93 -0
- venv/Lib/site-packages/pip/_vendor/rich/box.py +474 -0
- venv/Lib/site-packages/pip/_vendor/rich/cells.py +174 -0
- venv/Lib/site-packages/pip/_vendor/rich/color.py +621 -0
- venv/Lib/site-packages/pip/_vendor/rich/color_triplet.py +38 -0
- venv/Lib/site-packages/pip/_vendor/rich/columns.py +187 -0
- venv/Lib/site-packages/pip/_vendor/rich/console.py +2680 -0
- venv/Lib/site-packages/pip/_vendor/rich/constrain.py +37 -0
- venv/Lib/site-packages/pip/_vendor/rich/containers.py +167 -0
- venv/Lib/site-packages/pip/_vendor/rich/control.py +219 -0
- venv/Lib/site-packages/pip/_vendor/rich/default_styles.py +193 -0
- venv/Lib/site-packages/pip/_vendor/rich/diagnose.py +39 -0
- venv/Lib/site-packages/pip/_vendor/rich/emoji.py +91 -0
- venv/Lib/site-packages/pip/_vendor/rich/errors.py +34 -0
- venv/Lib/site-packages/pip/_vendor/rich/file_proxy.py +57 -0
- venv/Lib/site-packages/pip/_vendor/rich/filesize.py +88 -0
- venv/Lib/site-packages/pip/_vendor/rich/highlighter.py +232 -0
- venv/Lib/site-packages/pip/_vendor/rich/json.py +139 -0
- venv/Lib/site-packages/pip/_vendor/rich/jupyter.py +101 -0
- venv/Lib/site-packages/pip/_vendor/rich/layout.py +442 -0
- venv/Lib/site-packages/pip/_vendor/rich/live.py +400 -0
- venv/Lib/site-packages/pip/_vendor/rich/live_render.py +106 -0
- venv/Lib/site-packages/pip/_vendor/rich/logging.py +297 -0
- venv/Lib/site-packages/pip/_vendor/rich/markup.py +251 -0
- venv/Lib/site-packages/pip/_vendor/rich/measure.py +151 -0
- venv/Lib/site-packages/pip/_vendor/rich/padding.py +141 -0
- venv/Lib/site-packages/pip/_vendor/rich/pager.py +34 -0
- venv/Lib/site-packages/pip/_vendor/rich/palette.py +100 -0
- venv/Lib/site-packages/pip/_vendor/rich/panel.py +317 -0
- venv/Lib/site-packages/pip/_vendor/rich/pretty.py +1016 -0
- venv/Lib/site-packages/pip/_vendor/rich/progress.py +1715 -0
- venv/Lib/site-packages/pip/_vendor/rich/progress_bar.py +223 -0
- venv/Lib/site-packages/pip/_vendor/rich/prompt.py +400 -0
- venv/Lib/site-packages/pip/_vendor/rich/protocol.py +42 -0
- venv/Lib/site-packages/pip/_vendor/rich/py.typed +0 -0
- venv/Lib/site-packages/pip/_vendor/rich/region.py +10 -0
- venv/Lib/site-packages/pip/_vendor/rich/repr.py +149 -0
- venv/Lib/site-packages/pip/_vendor/rich/rule.py +130 -0
- venv/Lib/site-packages/pip/_vendor/rich/scope.py +86 -0
- venv/Lib/site-packages/pip/_vendor/rich/screen.py +54 -0
- venv/Lib/site-packages/pip/_vendor/rich/segment.py +752 -0
- venv/Lib/site-packages/pip/_vendor/rich/spinner.py +132 -0
- venv/Lib/site-packages/pip/_vendor/rich/status.py +131 -0
- venv/Lib/site-packages/pip/_vendor/rich/style.py +796 -0
- venv/Lib/site-packages/pip/_vendor/rich/styled.py +42 -0
- venv/Lib/site-packages/pip/_vendor/rich/syntax.py +985 -0
- venv/Lib/site-packages/pip/_vendor/rich/table.py +1006 -0
- venv/Lib/site-packages/pip/_vendor/rich/terminal_theme.py +153 -0
- venv/Lib/site-packages/pip/_vendor/rich/text.py +1361 -0
- venv/Lib/site-packages/pip/_vendor/rich/theme.py +115 -0
- venv/Lib/site-packages/pip/_vendor/rich/themes.py +5 -0
- venv/Lib/site-packages/pip/_vendor/rich/traceback.py +899 -0
- venv/Lib/site-packages/pip/_vendor/rich/tree.py +257 -0
- venv/Lib/site-packages/pip/_vendor/tomli/__init__.py +8 -0
- venv/Lib/site-packages/pip/_vendor/tomli/_parser.py +770 -0
- venv/Lib/site-packages/pip/_vendor/tomli/_re.py +112 -0
- venv/Lib/site-packages/pip/_vendor/tomli/_types.py +10 -0
- venv/Lib/site-packages/pip/_vendor/tomli/py.typed +1 -0
- venv/Lib/site-packages/pip/_vendor/tomli_w/__init__.py +4 -0
- venv/Lib/site-packages/pip/_vendor/tomli_w/_writer.py +229 -0
- venv/Lib/site-packages/pip/_vendor/tomli_w/py.typed +1 -0
- venv/Lib/site-packages/pip/_vendor/truststore/__init__.py +36 -0
- venv/Lib/site-packages/pip/_vendor/truststore/_api.py +333 -0
- venv/Lib/site-packages/pip/_vendor/truststore/_macos.py +571 -0
- venv/Lib/site-packages/pip/_vendor/truststore/_openssl.py +66 -0
- venv/Lib/site-packages/pip/_vendor/truststore/_ssl_constants.py +31 -0
- venv/Lib/site-packages/pip/_vendor/truststore/_windows.py +567 -0
- venv/Lib/site-packages/pip/_vendor/truststore/py.typed +0 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/__init__.py +102 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/_collections.py +355 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/_version.py +2 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/connection.py +572 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/connectionpool.py +1140 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/contrib/__init__.py +0 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/contrib/_appengine_environ.py +36 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/contrib/_securetransport/__init__.py +0 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/contrib/_securetransport/bindings.py +519 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/contrib/_securetransport/low_level.py +397 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/contrib/appengine.py +314 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/contrib/ntlmpool.py +130 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py +518 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/contrib/securetransport.py +920 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/contrib/socks.py +216 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/exceptions.py +323 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/fields.py +274 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/filepost.py +98 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/packages/__init__.py +0 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/packages/backports/__init__.py +0 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/packages/backports/makefile.py +51 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/packages/backports/weakref_finalize.py +155 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/packages/six.py +1076 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/poolmanager.py +540 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/request.py +191 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/response.py +879 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/util/__init__.py +49 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/util/connection.py +149 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/util/proxy.py +57 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/util/queue.py +22 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/util/request.py +137 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/util/response.py +107 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/util/retry.py +622 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/util/ssl_.py +504 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/util/ssl_match_hostname.py +159 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/util/ssltransport.py +221 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/util/timeout.py +271 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/util/url.py +435 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/util/wait.py +152 -0
- venv/Lib/site-packages/pip/py.typed +4 -0
- cli_ih-0.6.3.dist-info/RECORD +0 -8
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
from __future__ import absolute_import
|
|
2
|
+
|
|
3
|
+
import email.utils
|
|
4
|
+
import mimetypes
|
|
5
|
+
import re
|
|
6
|
+
|
|
7
|
+
from .packages import six
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def guess_content_type(filename, default="application/octet-stream"):
|
|
11
|
+
"""
|
|
12
|
+
Guess the "Content-Type" of a file.
|
|
13
|
+
|
|
14
|
+
:param filename:
|
|
15
|
+
The filename to guess the "Content-Type" of using :mod:`mimetypes`.
|
|
16
|
+
:param default:
|
|
17
|
+
If no "Content-Type" can be guessed, default to `default`.
|
|
18
|
+
"""
|
|
19
|
+
if filename:
|
|
20
|
+
return mimetypes.guess_type(filename)[0] or default
|
|
21
|
+
return default
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def format_header_param_rfc2231(name, value):
|
|
25
|
+
"""
|
|
26
|
+
Helper function to format and quote a single header parameter using the
|
|
27
|
+
strategy defined in RFC 2231.
|
|
28
|
+
|
|
29
|
+
Particularly useful for header parameters which might contain
|
|
30
|
+
non-ASCII values, like file names. This follows
|
|
31
|
+
`RFC 2388 Section 4.4 <https://tools.ietf.org/html/rfc2388#section-4.4>`_.
|
|
32
|
+
|
|
33
|
+
:param name:
|
|
34
|
+
The name of the parameter, a string expected to be ASCII only.
|
|
35
|
+
:param value:
|
|
36
|
+
The value of the parameter, provided as ``bytes`` or `str``.
|
|
37
|
+
:ret:
|
|
38
|
+
An RFC-2231-formatted unicode string.
|
|
39
|
+
"""
|
|
40
|
+
if isinstance(value, six.binary_type):
|
|
41
|
+
value = value.decode("utf-8")
|
|
42
|
+
|
|
43
|
+
if not any(ch in value for ch in '"\\\r\n'):
|
|
44
|
+
result = u'%s="%s"' % (name, value)
|
|
45
|
+
try:
|
|
46
|
+
result.encode("ascii")
|
|
47
|
+
except (UnicodeEncodeError, UnicodeDecodeError):
|
|
48
|
+
pass
|
|
49
|
+
else:
|
|
50
|
+
return result
|
|
51
|
+
|
|
52
|
+
if six.PY2: # Python 2:
|
|
53
|
+
value = value.encode("utf-8")
|
|
54
|
+
|
|
55
|
+
# encode_rfc2231 accepts an encoded string and returns an ascii-encoded
|
|
56
|
+
# string in Python 2 but accepts and returns unicode strings in Python 3
|
|
57
|
+
value = email.utils.encode_rfc2231(value, "utf-8")
|
|
58
|
+
value = "%s*=%s" % (name, value)
|
|
59
|
+
|
|
60
|
+
if six.PY2: # Python 2:
|
|
61
|
+
value = value.decode("utf-8")
|
|
62
|
+
|
|
63
|
+
return value
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
_HTML5_REPLACEMENTS = {
|
|
67
|
+
u"\u0022": u"%22",
|
|
68
|
+
# Replace "\" with "\\".
|
|
69
|
+
u"\u005C": u"\u005C\u005C",
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
# All control characters from 0x00 to 0x1F *except* 0x1B.
|
|
73
|
+
_HTML5_REPLACEMENTS.update(
|
|
74
|
+
{
|
|
75
|
+
six.unichr(cc): u"%{:02X}".format(cc)
|
|
76
|
+
for cc in range(0x00, 0x1F + 1)
|
|
77
|
+
if cc not in (0x1B,)
|
|
78
|
+
}
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def _replace_multiple(value, needles_and_replacements):
|
|
83
|
+
def replacer(match):
|
|
84
|
+
return needles_and_replacements[match.group(0)]
|
|
85
|
+
|
|
86
|
+
pattern = re.compile(
|
|
87
|
+
r"|".join([re.escape(needle) for needle in needles_and_replacements.keys()])
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
result = pattern.sub(replacer, value)
|
|
91
|
+
|
|
92
|
+
return result
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def format_header_param_html5(name, value):
|
|
96
|
+
"""
|
|
97
|
+
Helper function to format and quote a single header parameter using the
|
|
98
|
+
HTML5 strategy.
|
|
99
|
+
|
|
100
|
+
Particularly useful for header parameters which might contain
|
|
101
|
+
non-ASCII values, like file names. This follows the `HTML5 Working Draft
|
|
102
|
+
Section 4.10.22.7`_ and matches the behavior of curl and modern browsers.
|
|
103
|
+
|
|
104
|
+
.. _HTML5 Working Draft Section 4.10.22.7:
|
|
105
|
+
https://w3c.github.io/html/sec-forms.html#multipart-form-data
|
|
106
|
+
|
|
107
|
+
:param name:
|
|
108
|
+
The name of the parameter, a string expected to be ASCII only.
|
|
109
|
+
:param value:
|
|
110
|
+
The value of the parameter, provided as ``bytes`` or `str``.
|
|
111
|
+
:ret:
|
|
112
|
+
A unicode string, stripped of troublesome characters.
|
|
113
|
+
"""
|
|
114
|
+
if isinstance(value, six.binary_type):
|
|
115
|
+
value = value.decode("utf-8")
|
|
116
|
+
|
|
117
|
+
value = _replace_multiple(value, _HTML5_REPLACEMENTS)
|
|
118
|
+
|
|
119
|
+
return u'%s="%s"' % (name, value)
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
# For backwards-compatibility.
|
|
123
|
+
format_header_param = format_header_param_html5
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
class RequestField(object):
|
|
127
|
+
"""
|
|
128
|
+
A data container for request body parameters.
|
|
129
|
+
|
|
130
|
+
:param name:
|
|
131
|
+
The name of this request field. Must be unicode.
|
|
132
|
+
:param data:
|
|
133
|
+
The data/value body.
|
|
134
|
+
:param filename:
|
|
135
|
+
An optional filename of the request field. Must be unicode.
|
|
136
|
+
:param headers:
|
|
137
|
+
An optional dict-like object of headers to initially use for the field.
|
|
138
|
+
:param header_formatter:
|
|
139
|
+
An optional callable that is used to encode and format the headers. By
|
|
140
|
+
default, this is :func:`format_header_param_html5`.
|
|
141
|
+
"""
|
|
142
|
+
|
|
143
|
+
def __init__(
|
|
144
|
+
self,
|
|
145
|
+
name,
|
|
146
|
+
data,
|
|
147
|
+
filename=None,
|
|
148
|
+
headers=None,
|
|
149
|
+
header_formatter=format_header_param_html5,
|
|
150
|
+
):
|
|
151
|
+
self._name = name
|
|
152
|
+
self._filename = filename
|
|
153
|
+
self.data = data
|
|
154
|
+
self.headers = {}
|
|
155
|
+
if headers:
|
|
156
|
+
self.headers = dict(headers)
|
|
157
|
+
self.header_formatter = header_formatter
|
|
158
|
+
|
|
159
|
+
@classmethod
|
|
160
|
+
def from_tuples(cls, fieldname, value, header_formatter=format_header_param_html5):
|
|
161
|
+
"""
|
|
162
|
+
A :class:`~urllib3.fields.RequestField` factory from old-style tuple parameters.
|
|
163
|
+
|
|
164
|
+
Supports constructing :class:`~urllib3.fields.RequestField` from
|
|
165
|
+
parameter of key/value strings AND key/filetuple. A filetuple is a
|
|
166
|
+
(filename, data, MIME type) tuple where the MIME type is optional.
|
|
167
|
+
For example::
|
|
168
|
+
|
|
169
|
+
'foo': 'bar',
|
|
170
|
+
'fakefile': ('foofile.txt', 'contents of foofile'),
|
|
171
|
+
'realfile': ('barfile.txt', open('realfile').read()),
|
|
172
|
+
'typedfile': ('bazfile.bin', open('bazfile').read(), 'image/jpeg'),
|
|
173
|
+
'nonamefile': 'contents of nonamefile field',
|
|
174
|
+
|
|
175
|
+
Field names and filenames must be unicode.
|
|
176
|
+
"""
|
|
177
|
+
if isinstance(value, tuple):
|
|
178
|
+
if len(value) == 3:
|
|
179
|
+
filename, data, content_type = value
|
|
180
|
+
else:
|
|
181
|
+
filename, data = value
|
|
182
|
+
content_type = guess_content_type(filename)
|
|
183
|
+
else:
|
|
184
|
+
filename = None
|
|
185
|
+
content_type = None
|
|
186
|
+
data = value
|
|
187
|
+
|
|
188
|
+
request_param = cls(
|
|
189
|
+
fieldname, data, filename=filename, header_formatter=header_formatter
|
|
190
|
+
)
|
|
191
|
+
request_param.make_multipart(content_type=content_type)
|
|
192
|
+
|
|
193
|
+
return request_param
|
|
194
|
+
|
|
195
|
+
def _render_part(self, name, value):
|
|
196
|
+
"""
|
|
197
|
+
Overridable helper function to format a single header parameter. By
|
|
198
|
+
default, this calls ``self.header_formatter``.
|
|
199
|
+
|
|
200
|
+
:param name:
|
|
201
|
+
The name of the parameter, a string expected to be ASCII only.
|
|
202
|
+
:param value:
|
|
203
|
+
The value of the parameter, provided as a unicode string.
|
|
204
|
+
"""
|
|
205
|
+
|
|
206
|
+
return self.header_formatter(name, value)
|
|
207
|
+
|
|
208
|
+
def _render_parts(self, header_parts):
|
|
209
|
+
"""
|
|
210
|
+
Helper function to format and quote a single header.
|
|
211
|
+
|
|
212
|
+
Useful for single headers that are composed of multiple items. E.g.,
|
|
213
|
+
'Content-Disposition' fields.
|
|
214
|
+
|
|
215
|
+
:param header_parts:
|
|
216
|
+
A sequence of (k, v) tuples or a :class:`dict` of (k, v) to format
|
|
217
|
+
as `k1="v1"; k2="v2"; ...`.
|
|
218
|
+
"""
|
|
219
|
+
parts = []
|
|
220
|
+
iterable = header_parts
|
|
221
|
+
if isinstance(header_parts, dict):
|
|
222
|
+
iterable = header_parts.items()
|
|
223
|
+
|
|
224
|
+
for name, value in iterable:
|
|
225
|
+
if value is not None:
|
|
226
|
+
parts.append(self._render_part(name, value))
|
|
227
|
+
|
|
228
|
+
return u"; ".join(parts)
|
|
229
|
+
|
|
230
|
+
def render_headers(self):
|
|
231
|
+
"""
|
|
232
|
+
Renders the headers for this request field.
|
|
233
|
+
"""
|
|
234
|
+
lines = []
|
|
235
|
+
|
|
236
|
+
sort_keys = ["Content-Disposition", "Content-Type", "Content-Location"]
|
|
237
|
+
for sort_key in sort_keys:
|
|
238
|
+
if self.headers.get(sort_key, False):
|
|
239
|
+
lines.append(u"%s: %s" % (sort_key, self.headers[sort_key]))
|
|
240
|
+
|
|
241
|
+
for header_name, header_value in self.headers.items():
|
|
242
|
+
if header_name not in sort_keys:
|
|
243
|
+
if header_value:
|
|
244
|
+
lines.append(u"%s: %s" % (header_name, header_value))
|
|
245
|
+
|
|
246
|
+
lines.append(u"\r\n")
|
|
247
|
+
return u"\r\n".join(lines)
|
|
248
|
+
|
|
249
|
+
def make_multipart(
|
|
250
|
+
self, content_disposition=None, content_type=None, content_location=None
|
|
251
|
+
):
|
|
252
|
+
"""
|
|
253
|
+
Makes this request field into a multipart request field.
|
|
254
|
+
|
|
255
|
+
This method overrides "Content-Disposition", "Content-Type" and
|
|
256
|
+
"Content-Location" headers to the request parameter.
|
|
257
|
+
|
|
258
|
+
:param content_type:
|
|
259
|
+
The 'Content-Type' of the request body.
|
|
260
|
+
:param content_location:
|
|
261
|
+
The 'Content-Location' of the request body.
|
|
262
|
+
|
|
263
|
+
"""
|
|
264
|
+
self.headers["Content-Disposition"] = content_disposition or u"form-data"
|
|
265
|
+
self.headers["Content-Disposition"] += u"; ".join(
|
|
266
|
+
[
|
|
267
|
+
u"",
|
|
268
|
+
self._render_parts(
|
|
269
|
+
((u"name", self._name), (u"filename", self._filename))
|
|
270
|
+
),
|
|
271
|
+
]
|
|
272
|
+
)
|
|
273
|
+
self.headers["Content-Type"] = content_type
|
|
274
|
+
self.headers["Content-Location"] = content_location
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
from __future__ import absolute_import
|
|
2
|
+
|
|
3
|
+
import binascii
|
|
4
|
+
import codecs
|
|
5
|
+
import os
|
|
6
|
+
from io import BytesIO
|
|
7
|
+
|
|
8
|
+
from .fields import RequestField
|
|
9
|
+
from .packages import six
|
|
10
|
+
from .packages.six import b
|
|
11
|
+
|
|
12
|
+
writer = codecs.lookup("utf-8")[3]
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def choose_boundary():
|
|
16
|
+
"""
|
|
17
|
+
Our embarrassingly-simple replacement for mimetools.choose_boundary.
|
|
18
|
+
"""
|
|
19
|
+
boundary = binascii.hexlify(os.urandom(16))
|
|
20
|
+
if not six.PY2:
|
|
21
|
+
boundary = boundary.decode("ascii")
|
|
22
|
+
return boundary
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def iter_field_objects(fields):
|
|
26
|
+
"""
|
|
27
|
+
Iterate over fields.
|
|
28
|
+
|
|
29
|
+
Supports list of (k, v) tuples and dicts, and lists of
|
|
30
|
+
:class:`~urllib3.fields.RequestField`.
|
|
31
|
+
|
|
32
|
+
"""
|
|
33
|
+
if isinstance(fields, dict):
|
|
34
|
+
i = six.iteritems(fields)
|
|
35
|
+
else:
|
|
36
|
+
i = iter(fields)
|
|
37
|
+
|
|
38
|
+
for field in i:
|
|
39
|
+
if isinstance(field, RequestField):
|
|
40
|
+
yield field
|
|
41
|
+
else:
|
|
42
|
+
yield RequestField.from_tuples(*field)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def iter_fields(fields):
|
|
46
|
+
"""
|
|
47
|
+
.. deprecated:: 1.6
|
|
48
|
+
|
|
49
|
+
Iterate over fields.
|
|
50
|
+
|
|
51
|
+
The addition of :class:`~urllib3.fields.RequestField` makes this function
|
|
52
|
+
obsolete. Instead, use :func:`iter_field_objects`, which returns
|
|
53
|
+
:class:`~urllib3.fields.RequestField` objects.
|
|
54
|
+
|
|
55
|
+
Supports list of (k, v) tuples and dicts.
|
|
56
|
+
"""
|
|
57
|
+
if isinstance(fields, dict):
|
|
58
|
+
return ((k, v) for k, v in six.iteritems(fields))
|
|
59
|
+
|
|
60
|
+
return ((k, v) for k, v in fields)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def encode_multipart_formdata(fields, boundary=None):
|
|
64
|
+
"""
|
|
65
|
+
Encode a dictionary of ``fields`` using the multipart/form-data MIME format.
|
|
66
|
+
|
|
67
|
+
:param fields:
|
|
68
|
+
Dictionary of fields or list of (key, :class:`~urllib3.fields.RequestField`).
|
|
69
|
+
|
|
70
|
+
:param boundary:
|
|
71
|
+
If not specified, then a random boundary will be generated using
|
|
72
|
+
:func:`urllib3.filepost.choose_boundary`.
|
|
73
|
+
"""
|
|
74
|
+
body = BytesIO()
|
|
75
|
+
if boundary is None:
|
|
76
|
+
boundary = choose_boundary()
|
|
77
|
+
|
|
78
|
+
for field in iter_field_objects(fields):
|
|
79
|
+
body.write(b("--%s\r\n" % (boundary)))
|
|
80
|
+
|
|
81
|
+
writer(body).write(field.render_headers())
|
|
82
|
+
data = field.data
|
|
83
|
+
|
|
84
|
+
if isinstance(data, int):
|
|
85
|
+
data = str(data) # Backwards compatibility
|
|
86
|
+
|
|
87
|
+
if isinstance(data, six.text_type):
|
|
88
|
+
writer(body).write(data)
|
|
89
|
+
else:
|
|
90
|
+
body.write(data)
|
|
91
|
+
|
|
92
|
+
body.write(b"\r\n")
|
|
93
|
+
|
|
94
|
+
body.write(b("--%s--\r\n" % (boundary)))
|
|
95
|
+
|
|
96
|
+
content_type = str("multipart/form-data; boundary=%s" % boundary)
|
|
97
|
+
|
|
98
|
+
return body.getvalue(), content_type
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
backports.makefile
|
|
4
|
+
~~~~~~~~~~~~~~~~~~
|
|
5
|
+
|
|
6
|
+
Backports the Python 3 ``socket.makefile`` method for use with anything that
|
|
7
|
+
wants to create a "fake" socket object.
|
|
8
|
+
"""
|
|
9
|
+
import io
|
|
10
|
+
from socket import SocketIO
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def backport_makefile(
|
|
14
|
+
self, mode="r", buffering=None, encoding=None, errors=None, newline=None
|
|
15
|
+
):
|
|
16
|
+
"""
|
|
17
|
+
Backport of ``socket.makefile`` from Python 3.5.
|
|
18
|
+
"""
|
|
19
|
+
if not set(mode) <= {"r", "w", "b"}:
|
|
20
|
+
raise ValueError("invalid mode %r (only r, w, b allowed)" % (mode,))
|
|
21
|
+
writing = "w" in mode
|
|
22
|
+
reading = "r" in mode or not writing
|
|
23
|
+
assert reading or writing
|
|
24
|
+
binary = "b" in mode
|
|
25
|
+
rawmode = ""
|
|
26
|
+
if reading:
|
|
27
|
+
rawmode += "r"
|
|
28
|
+
if writing:
|
|
29
|
+
rawmode += "w"
|
|
30
|
+
raw = SocketIO(self, rawmode)
|
|
31
|
+
self._makefile_refs += 1
|
|
32
|
+
if buffering is None:
|
|
33
|
+
buffering = -1
|
|
34
|
+
if buffering < 0:
|
|
35
|
+
buffering = io.DEFAULT_BUFFER_SIZE
|
|
36
|
+
if buffering == 0:
|
|
37
|
+
if not binary:
|
|
38
|
+
raise ValueError("unbuffered streams must be binary")
|
|
39
|
+
return raw
|
|
40
|
+
if reading and writing:
|
|
41
|
+
buffer = io.BufferedRWPair(raw, raw, buffering)
|
|
42
|
+
elif reading:
|
|
43
|
+
buffer = io.BufferedReader(raw, buffering)
|
|
44
|
+
else:
|
|
45
|
+
assert writing
|
|
46
|
+
buffer = io.BufferedWriter(raw, buffering)
|
|
47
|
+
if binary:
|
|
48
|
+
return buffer
|
|
49
|
+
text = io.TextIOWrapper(buffer, encoding, errors, newline)
|
|
50
|
+
text.mode = mode
|
|
51
|
+
return text
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
backports.weakref_finalize
|
|
4
|
+
~~~~~~~~~~~~~~~~~~
|
|
5
|
+
|
|
6
|
+
Backports the Python 3 ``weakref.finalize`` method.
|
|
7
|
+
"""
|
|
8
|
+
from __future__ import absolute_import
|
|
9
|
+
|
|
10
|
+
import itertools
|
|
11
|
+
import sys
|
|
12
|
+
from weakref import ref
|
|
13
|
+
|
|
14
|
+
__all__ = ["weakref_finalize"]
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class weakref_finalize(object):
|
|
18
|
+
"""Class for finalization of weakrefable objects
|
|
19
|
+
finalize(obj, func, *args, **kwargs) returns a callable finalizer
|
|
20
|
+
object which will be called when obj is garbage collected. The
|
|
21
|
+
first time the finalizer is called it evaluates func(*arg, **kwargs)
|
|
22
|
+
and returns the result. After this the finalizer is dead, and
|
|
23
|
+
calling it just returns None.
|
|
24
|
+
When the program exits any remaining finalizers for which the
|
|
25
|
+
atexit attribute is true will be run in reverse order of creation.
|
|
26
|
+
By default atexit is true.
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
# Finalizer objects don't have any state of their own. They are
|
|
30
|
+
# just used as keys to lookup _Info objects in the registry. This
|
|
31
|
+
# ensures that they cannot be part of a ref-cycle.
|
|
32
|
+
|
|
33
|
+
__slots__ = ()
|
|
34
|
+
_registry = {}
|
|
35
|
+
_shutdown = False
|
|
36
|
+
_index_iter = itertools.count()
|
|
37
|
+
_dirty = False
|
|
38
|
+
_registered_with_atexit = False
|
|
39
|
+
|
|
40
|
+
class _Info(object):
|
|
41
|
+
__slots__ = ("weakref", "func", "args", "kwargs", "atexit", "index")
|
|
42
|
+
|
|
43
|
+
def __init__(self, obj, func, *args, **kwargs):
|
|
44
|
+
if not self._registered_with_atexit:
|
|
45
|
+
# We may register the exit function more than once because
|
|
46
|
+
# of a thread race, but that is harmless
|
|
47
|
+
import atexit
|
|
48
|
+
|
|
49
|
+
atexit.register(self._exitfunc)
|
|
50
|
+
weakref_finalize._registered_with_atexit = True
|
|
51
|
+
info = self._Info()
|
|
52
|
+
info.weakref = ref(obj, self)
|
|
53
|
+
info.func = func
|
|
54
|
+
info.args = args
|
|
55
|
+
info.kwargs = kwargs or None
|
|
56
|
+
info.atexit = True
|
|
57
|
+
info.index = next(self._index_iter)
|
|
58
|
+
self._registry[self] = info
|
|
59
|
+
weakref_finalize._dirty = True
|
|
60
|
+
|
|
61
|
+
def __call__(self, _=None):
|
|
62
|
+
"""If alive then mark as dead and return func(*args, **kwargs);
|
|
63
|
+
otherwise return None"""
|
|
64
|
+
info = self._registry.pop(self, None)
|
|
65
|
+
if info and not self._shutdown:
|
|
66
|
+
return info.func(*info.args, **(info.kwargs or {}))
|
|
67
|
+
|
|
68
|
+
def detach(self):
|
|
69
|
+
"""If alive then mark as dead and return (obj, func, args, kwargs);
|
|
70
|
+
otherwise return None"""
|
|
71
|
+
info = self._registry.get(self)
|
|
72
|
+
obj = info and info.weakref()
|
|
73
|
+
if obj is not None and self._registry.pop(self, None):
|
|
74
|
+
return (obj, info.func, info.args, info.kwargs or {})
|
|
75
|
+
|
|
76
|
+
def peek(self):
|
|
77
|
+
"""If alive then return (obj, func, args, kwargs);
|
|
78
|
+
otherwise return None"""
|
|
79
|
+
info = self._registry.get(self)
|
|
80
|
+
obj = info and info.weakref()
|
|
81
|
+
if obj is not None:
|
|
82
|
+
return (obj, info.func, info.args, info.kwargs or {})
|
|
83
|
+
|
|
84
|
+
@property
|
|
85
|
+
def alive(self):
|
|
86
|
+
"""Whether finalizer is alive"""
|
|
87
|
+
return self in self._registry
|
|
88
|
+
|
|
89
|
+
@property
|
|
90
|
+
def atexit(self):
|
|
91
|
+
"""Whether finalizer should be called at exit"""
|
|
92
|
+
info = self._registry.get(self)
|
|
93
|
+
return bool(info) and info.atexit
|
|
94
|
+
|
|
95
|
+
@atexit.setter
|
|
96
|
+
def atexit(self, value):
|
|
97
|
+
info = self._registry.get(self)
|
|
98
|
+
if info:
|
|
99
|
+
info.atexit = bool(value)
|
|
100
|
+
|
|
101
|
+
def __repr__(self):
|
|
102
|
+
info = self._registry.get(self)
|
|
103
|
+
obj = info and info.weakref()
|
|
104
|
+
if obj is None:
|
|
105
|
+
return "<%s object at %#x; dead>" % (type(self).__name__, id(self))
|
|
106
|
+
else:
|
|
107
|
+
return "<%s object at %#x; for %r at %#x>" % (
|
|
108
|
+
type(self).__name__,
|
|
109
|
+
id(self),
|
|
110
|
+
type(obj).__name__,
|
|
111
|
+
id(obj),
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
@classmethod
|
|
115
|
+
def _select_for_exit(cls):
|
|
116
|
+
# Return live finalizers marked for exit, oldest first
|
|
117
|
+
L = [(f, i) for (f, i) in cls._registry.items() if i.atexit]
|
|
118
|
+
L.sort(key=lambda item: item[1].index)
|
|
119
|
+
return [f for (f, i) in L]
|
|
120
|
+
|
|
121
|
+
@classmethod
|
|
122
|
+
def _exitfunc(cls):
|
|
123
|
+
# At shutdown invoke finalizers for which atexit is true.
|
|
124
|
+
# This is called once all other non-daemonic threads have been
|
|
125
|
+
# joined.
|
|
126
|
+
reenable_gc = False
|
|
127
|
+
try:
|
|
128
|
+
if cls._registry:
|
|
129
|
+
import gc
|
|
130
|
+
|
|
131
|
+
if gc.isenabled():
|
|
132
|
+
reenable_gc = True
|
|
133
|
+
gc.disable()
|
|
134
|
+
pending = None
|
|
135
|
+
while True:
|
|
136
|
+
if pending is None or weakref_finalize._dirty:
|
|
137
|
+
pending = cls._select_for_exit()
|
|
138
|
+
weakref_finalize._dirty = False
|
|
139
|
+
if not pending:
|
|
140
|
+
break
|
|
141
|
+
f = pending.pop()
|
|
142
|
+
try:
|
|
143
|
+
# gc is disabled, so (assuming no daemonic
|
|
144
|
+
# threads) the following is the only line in
|
|
145
|
+
# this function which might trigger creation
|
|
146
|
+
# of a new finalizer
|
|
147
|
+
f()
|
|
148
|
+
except Exception:
|
|
149
|
+
sys.excepthook(*sys.exc_info())
|
|
150
|
+
assert f not in cls._registry
|
|
151
|
+
finally:
|
|
152
|
+
# prevent any more finalizers from executing during shutdown
|
|
153
|
+
weakref_finalize._shutdown = True
|
|
154
|
+
if reenable_gc:
|
|
155
|
+
gc.enable()
|