pip_shims.models

Helper module for shimming functionality across pip versions.

Functions

import_pip()
lookup_current_pip_version()
pip_version_lookup(version, *args, **kwargs)

Classes

ImportTypes
ImportTypesBase alias of pip_shims.models.ImportTypes
PipVersion(version[, round_prereleases_up, …])
PipVersionRange(start, end)
ShimmedPath(name, import_target, …[, …])
ShimmedPathCollection(name, import_type[, paths])
class pip_shims.models.ImportTypes[source]

Bases: pip_shims.models.ImportTypes

ATTRIBUTE = 5
CLASS = 1
CONTEXTMANAGER = 3
FUNCTION = 0
METHOD = 4
MODULE = 2
pip_shims.models.ImportTypesBase

alias of pip_shims.models.ImportTypes

class pip_shims.models.PipVersion(version, round_prereleases_up=True, base_import_path=None, vendor_import_path='pip._vendor')[source]

Bases: collections.abc.Sequence

is_valid(compared_to)[source]
version_key
version_tuple
class pip_shims.models.PipVersionRange(start, end)[source]

Bases: collections.abc.Sequence

base_import_paths
is_valid()[source]
vendor_import_paths
class pip_shims.models.ShimmedPath(name, import_target, import_type, version_range, provided_methods=None, provided_functions=None, provided_classmethods=None, provided_contextmanagers=None, provided_mixins=None, default_args=None)[source]

Bases: object

alias(aliases)[source]
calculated_module_path
is_attribute
is_class
is_contextmanager
is_function
is_method
is_module
is_valid
shim()[source]
shim_attribute(imported, attribute_name)[source]
shim_class(imported, attribute_name)[source]
shim_contextmanager(imported, attribute_name)[source]
shim_function(imported, attribute_name)[source]
shim_module(imported, attribute_name)[source]
shimmed
sort_order
update_sys_modules(imported)[source]
class pip_shims.models.ShimmedPathCollection(name, import_type, paths=None)[source]

Bases: object

add_mixin(mixin)[source]
add_path(path)[source]
alias(aliases)[source]

Takes a list of methods, functions, attributes, etc and ensures they all exist on the object pointing at the same referent.

Parameters:aliases (List[str]) – Names to map to the same functionality if they do not exist.
Returns:None
Return type:None
create_path(import_path, version_start, version_end=None)[source]
classmethod get_registry()[source]
pre_shim(fn)[source]
provide_function(name, fn)[source]
provide_method(name, fn)[source]
register()[source]
set_default(default)[source]
set_default_args(callable_name, *args, **kwargs)[source]
shim()[source]
classmethod traverse(shim)[source]
pip_shims.models.import_pip()[source]
pip_shims.models.lookup_current_pip_version()[source]
pip_shims.models.pip_version_lookup(version, *args, **kwargs)[source]