repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
pypa/pipenv
pipenv/patched/notpip/_internal/utils/misc.py
redact_netloc
def redact_netloc(netloc): # type: (str) -> str """ Replace the password in a netloc with "****", if it exists. For example, "user:pass@example.com" returns "user:****@example.com". """ netloc, (user, password) = split_auth_from_netloc(netloc) if user is None: return netloc pass...
python
def redact_netloc(netloc): # type: (str) -> str """ Replace the password in a netloc with "****", if it exists. For example, "user:pass@example.com" returns "user:****@example.com". """ netloc, (user, password) = split_auth_from_netloc(netloc) if user is None: return netloc pass...
[ "def", "redact_netloc", "(", "netloc", ")", ":", "# type: (str) -> str", "netloc", ",", "(", "user", ",", "password", ")", "=", "split_auth_from_netloc", "(", "netloc", ")", "if", "user", "is", "None", ":", "return", "netloc", "password", "=", "''", "if", ...
Replace the password in a netloc with "****", if it exists. For example, "user:pass@example.com" returns "user:****@example.com".
[ "Replace", "the", "password", "in", "a", "netloc", "with", "****", "if", "it", "exists", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/misc.py#L969-L982
train
pypa/pipenv
pipenv/patched/notpip/_internal/utils/misc.py
protect_pip_from_modification_on_windows
def protect_pip_from_modification_on_windows(modifying_pip): """Protection of pip.exe from modification on Windows On Windows, any operation modifying pip should be run as: python -m pip ... """ pip_names = [ "pip.exe", "pip{}.exe".format(sys.version_info[0]), "pip{}.{}....
python
def protect_pip_from_modification_on_windows(modifying_pip): """Protection of pip.exe from modification on Windows On Windows, any operation modifying pip should be run as: python -m pip ... """ pip_names = [ "pip.exe", "pip{}.exe".format(sys.version_info[0]), "pip{}.{}....
[ "def", "protect_pip_from_modification_on_windows", "(", "modifying_pip", ")", ":", "pip_names", "=", "[", "\"pip.exe\"", ",", "\"pip{}.exe\"", ".", "format", "(", "sys", ".", "version_info", "[", "0", "]", ")", ",", "\"pip{}.{}.exe\"", ".", "format", "(", "*", ...
Protection of pip.exe from modification on Windows On Windows, any operation modifying pip should be run as: python -m pip ...
[ "Protection", "of", "pip", ".", "exe", "from", "modification", "on", "Windows" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/misc.py#L1014-L1040
train
pypa/pipenv
pipenv/patched/notpip/_internal/utils/packaging.py
check_requires_python
def check_requires_python(requires_python): # type: (Optional[str]) -> bool """ Check if the python version in use match the `requires_python` specifier. Returns `True` if the version of python in use matches the requirement. Returns `False` if the version of python in use does not matches the ...
python
def check_requires_python(requires_python): # type: (Optional[str]) -> bool """ Check if the python version in use match the `requires_python` specifier. Returns `True` if the version of python in use matches the requirement. Returns `False` if the version of python in use does not matches the ...
[ "def", "check_requires_python", "(", "requires_python", ")", ":", "# type: (Optional[str]) -> bool", "if", "requires_python", "is", "None", ":", "# The package provides no information", "return", "True", "requires_python_specifier", "=", "specifiers", ".", "SpecifierSet", "("...
Check if the python version in use match the `requires_python` specifier. Returns `True` if the version of python in use matches the requirement. Returns `False` if the version of python in use does not matches the requirement. Raises an InvalidSpecifier if `requires_python` have an invalid format.
[ "Check", "if", "the", "python", "version", "in", "use", "match", "the", "requires_python", "specifier", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/utils/packaging.py#L23-L41
train
pypa/pipenv
pipenv/vendor/click_completion/__init__.py
init
def init(complete_options=False, match_incomplete=None): """Initialize the enhanced click completion Parameters ---------- complete_options : bool always complete the options, even when the user hasn't typed a first dash (Default value = False) match_incomplete : func a function wit...
python
def init(complete_options=False, match_incomplete=None): """Initialize the enhanced click completion Parameters ---------- complete_options : bool always complete the options, even when the user hasn't typed a first dash (Default value = False) match_incomplete : func a function wit...
[ "def", "init", "(", "complete_options", "=", "False", ",", "match_incomplete", "=", "None", ")", ":", "global", "_initialized", "if", "not", "_initialized", ":", "_patch", "(", ")", "completion_configuration", ".", "complete_options", "=", "complete_options", "if"...
Initialize the enhanced click completion Parameters ---------- complete_options : bool always complete the options, even when the user hasn't typed a first dash (Default value = False) match_incomplete : func a function with two parameters choice and incomplete. Must return True ...
[ "Initialize", "the", "enhanced", "click", "completion" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click_completion/__init__.py#L27-L44
train
pypa/pipenv
pipenv/patched/notpip/_internal/commands/search.py
transform_hits
def transform_hits(hits): """ The list from pypi is really a list of versions. We want a list of packages with the list of versions stored inline. This converts the list from pypi into one we can use. """ packages = OrderedDict() for hit in hits: name = hit['name'] summary = ...
python
def transform_hits(hits): """ The list from pypi is really a list of versions. We want a list of packages with the list of versions stored inline. This converts the list from pypi into one we can use. """ packages = OrderedDict() for hit in hits: name = hit['name'] summary = ...
[ "def", "transform_hits", "(", "hits", ")", ":", "packages", "=", "OrderedDict", "(", ")", "for", "hit", "in", "hits", ":", "name", "=", "hit", "[", "'name'", "]", "summary", "=", "hit", "[", "'summary'", "]", "version", "=", "hit", "[", "'version'", ...
The list from pypi is really a list of versions. We want a list of packages with the list of versions stored inline. This converts the list from pypi into one we can use.
[ "The", "list", "from", "pypi", "is", "really", "a", "list", "of", "versions", ".", "We", "want", "a", "list", "of", "packages", "with", "the", "list", "of", "versions", "stored", "inline", ".", "This", "converts", "the", "list", "from", "pypi", "into", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/commands/search.py#L69-L94
train
pypa/pipenv
pipenv/patched/notpip/_internal/req/req_set.py
RequirementSet.add_requirement
def add_requirement( self, install_req, # type: InstallRequirement parent_req_name=None, # type: Optional[str] extras_requested=None # type: Optional[Iterable[str]] ): # type: (...) -> Tuple[List[InstallRequirement], Optional[InstallRequirement]] # noqa: E501 """A...
python
def add_requirement( self, install_req, # type: InstallRequirement parent_req_name=None, # type: Optional[str] extras_requested=None # type: Optional[Iterable[str]] ): # type: (...) -> Tuple[List[InstallRequirement], Optional[InstallRequirement]] # noqa: E501 """A...
[ "def", "add_requirement", "(", "self", ",", "install_req", ",", "# type: InstallRequirement", "parent_req_name", "=", "None", ",", "# type: Optional[str]", "extras_requested", "=", "None", "# type: Optional[Iterable[str]]", ")", ":", "# type: (...) -> Tuple[List[InstallRequirem...
Add install_req as a requirement to install. :param parent_req_name: The name of the requirement that needed this added. The name is used because when multiple unnamed requirements resolve to the same name, we could otherwise end up with dependency links that point outside t...
[ "Add", "install_req", "as", "a", "requirement", "to", "install", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_set.py#L52-L167
train
pypa/pipenv
pipenv/patched/notpip/_internal/resolve.py
Resolver.resolve
def resolve(self, requirement_set): # type: (RequirementSet) -> None """Resolve what operations need to be done As a side-effect of this method, the packages (and their dependencies) are downloaded, unpacked and prepared for installation. This preparation is done by ``pip.operat...
python
def resolve(self, requirement_set): # type: (RequirementSet) -> None """Resolve what operations need to be done As a side-effect of this method, the packages (and their dependencies) are downloaded, unpacked and prepared for installation. This preparation is done by ``pip.operat...
[ "def", "resolve", "(", "self", ",", "requirement_set", ")", ":", "# type: (RequirementSet) -> None", "# make the wheelhouse", "if", "self", ".", "preparer", ".", "wheel_download_dir", ":", "ensure_dir", "(", "self", ".", "preparer", ".", "wheel_download_dir", ")", "...
Resolve what operations need to be done As a side-effect of this method, the packages (and their dependencies) are downloaded, unpacked and prepared for installation. This preparation is done by ``pip.operations.prepare``. Once PyPI has static dependency metadata available, it would be...
[ "Resolve", "what", "operations", "need", "to", "be", "done" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/resolve.py#L96-L144
train
pypa/pipenv
pipenv/patched/notpip/_internal/resolve.py
Resolver._set_req_to_reinstall
def _set_req_to_reinstall(self, req): # type: (InstallRequirement) -> None """ Set a requirement to be installed. """ # Don't uninstall the conflict if doing a user install and the # conflict is not a user install. if not self.use_user_site or dist_in_usersite(req...
python
def _set_req_to_reinstall(self, req): # type: (InstallRequirement) -> None """ Set a requirement to be installed. """ # Don't uninstall the conflict if doing a user install and the # conflict is not a user install. if not self.use_user_site or dist_in_usersite(req...
[ "def", "_set_req_to_reinstall", "(", "self", ",", "req", ")", ":", "# type: (InstallRequirement) -> None", "# Don't uninstall the conflict if doing a user install and the", "# conflict is not a user install.", "if", "not", "self", ".", "use_user_site", "or", "dist_in_usersite", "...
Set a requirement to be installed.
[ "Set", "a", "requirement", "to", "be", "installed", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/resolve.py#L156-L165
train
pypa/pipenv
pipenv/patched/notpip/_internal/resolve.py
Resolver._check_skip_installed
def _check_skip_installed(self, req_to_install): # type: (InstallRequirement) -> Optional[str] """Check if req_to_install should be skipped. This will check if the req is installed, and whether we should upgrade or reinstall it, taking into account all the relevant user options. ...
python
def _check_skip_installed(self, req_to_install): # type: (InstallRequirement) -> Optional[str] """Check if req_to_install should be skipped. This will check if the req is installed, and whether we should upgrade or reinstall it, taking into account all the relevant user options. ...
[ "def", "_check_skip_installed", "(", "self", ",", "req_to_install", ")", ":", "# type: (InstallRequirement) -> Optional[str]", "if", "self", ".", "ignore_installed", ":", "return", "None", "req_to_install", ".", "check_if_exists", "(", "self", ".", "use_user_site", ")",...
Check if req_to_install should be skipped. This will check if the req is installed, and whether we should upgrade or reinstall it, taking into account all the relevant user options. After calling this req_to_install will only have satisfied_by set to None if the req_to_install is to be...
[ "Check", "if", "req_to_install", "should", "be", "skipped", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/resolve.py#L168-L219
train
pypa/pipenv
pipenv/patched/notpip/_internal/resolve.py
Resolver._get_abstract_dist_for
def _get_abstract_dist_for(self, req): # type: (InstallRequirement) -> DistAbstraction """Takes a InstallRequirement and returns a single AbstractDist \ representing a prepared variant of the same. """ assert self.require_hashes is not None, ( "require_hashes should h...
python
def _get_abstract_dist_for(self, req): # type: (InstallRequirement) -> DistAbstraction """Takes a InstallRequirement and returns a single AbstractDist \ representing a prepared variant of the same. """ assert self.require_hashes is not None, ( "require_hashes should h...
[ "def", "_get_abstract_dist_for", "(", "self", ",", "req", ")", ":", "# type: (InstallRequirement) -> DistAbstraction", "assert", "self", ".", "require_hashes", "is", "not", "None", ",", "(", "\"require_hashes should have been set in Resolver.resolve()\"", ")", "if", "req", ...
Takes a InstallRequirement and returns a single AbstractDist \ representing a prepared variant of the same.
[ "Takes", "a", "InstallRequirement", "and", "returns", "a", "single", "AbstractDist", "\\", "representing", "a", "prepared", "variant", "of", "the", "same", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/resolve.py#L221-L277
train
pypa/pipenv
pipenv/patched/notpip/_internal/resolve.py
Resolver._resolve_one
def _resolve_one( self, requirement_set, # type: RequirementSet req_to_install, # type: InstallRequirement ignore_requires_python=False # type: bool ): # type: (...) -> List[InstallRequirement] """Prepare a single requirements file. :return: A list of addi...
python
def _resolve_one( self, requirement_set, # type: RequirementSet req_to_install, # type: InstallRequirement ignore_requires_python=False # type: bool ): # type: (...) -> List[InstallRequirement] """Prepare a single requirements file. :return: A list of addi...
[ "def", "_resolve_one", "(", "self", ",", "requirement_set", ",", "# type: RequirementSet", "req_to_install", ",", "# type: InstallRequirement", "ignore_requires_python", "=", "False", "# type: bool", ")", ":", "# type: (...) -> List[InstallRequirement]", "# Tell user what we are ...
Prepare a single requirements file. :return: A list of additional InstallRequirements to also install.
[ "Prepare", "a", "single", "requirements", "file", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/resolve.py#L279-L397
train
pypa/pipenv
pipenv/patched/notpip/_internal/resolve.py
Resolver.get_installation_order
def get_installation_order(self, req_set): # type: (RequirementSet) -> List[InstallRequirement] """Create the installation order. The installation order is topological - requirements are installed before the requiring thing. We break cycles at an arbitrary point, and make no oth...
python
def get_installation_order(self, req_set): # type: (RequirementSet) -> List[InstallRequirement] """Create the installation order. The installation order is topological - requirements are installed before the requiring thing. We break cycles at an arbitrary point, and make no oth...
[ "def", "get_installation_order", "(", "self", ",", "req_set", ")", ":", "# type: (RequirementSet) -> List[InstallRequirement]", "# The current implementation, which we may change at any point", "# installs the user specified things in the order given, except when", "# dependencies must come ea...
Create the installation order. The installation order is topological - requirements are installed before the requiring thing. We break cycles at an arbitrary point, and make no other guarantees.
[ "Create", "the", "installation", "order", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/resolve.py#L399-L425
train
pypa/pipenv
pipenv/vendor/pyparsing.py
_xml_escape
def _xml_escape(data): """Escape &, <, >, ", ', etc. in a string of data.""" # ampersand must be replaced first from_symbols = '&><"\'' to_symbols = ('&'+s+';' for s in "amp gt lt quot apos".split()) for from_,to_ in zip(from_symbols, to_symbols): data = data.replace(from_, to_) return ...
python
def _xml_escape(data): """Escape &, <, >, ", ', etc. in a string of data.""" # ampersand must be replaced first from_symbols = '&><"\'' to_symbols = ('&'+s+';' for s in "amp gt lt quot apos".split()) for from_,to_ in zip(from_symbols, to_symbols): data = data.replace(from_, to_) return ...
[ "def", "_xml_escape", "(", "data", ")", ":", "# ampersand must be replaced first", "from_symbols", "=", "'&><\"\\''", "to_symbols", "=", "(", "'&'", "+", "s", "+", "';'", "for", "s", "in", "\"amp gt lt quot apos\"", ".", "split", "(", ")", ")", "for", "from_",...
Escape &, <, >, ", ', etc. in a string of data.
[ "Escape", "&", "<", ">", "etc", ".", "in", "a", "string", "of", "data", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L219-L227
train
pypa/pipenv
pipenv/vendor/pyparsing.py
line
def line( loc, strg ): """Returns the line of text containing loc within a string, counting newlines as line separators. """ lastCR = strg.rfind("\n", 0, loc) nextCR = strg.find("\n", loc) if nextCR >= 0: return strg[lastCR+1:nextCR] else: return strg[lastCR+1:]
python
def line( loc, strg ): """Returns the line of text containing loc within a string, counting newlines as line separators. """ lastCR = strg.rfind("\n", 0, loc) nextCR = strg.find("\n", loc) if nextCR >= 0: return strg[lastCR+1:nextCR] else: return strg[lastCR+1:]
[ "def", "line", "(", "loc", ",", "strg", ")", ":", "lastCR", "=", "strg", ".", "rfind", "(", "\"\\n\"", ",", "0", ",", "loc", ")", "nextCR", "=", "strg", ".", "find", "(", "\"\\n\"", ",", "loc", ")", "if", "nextCR", ">=", "0", ":", "return", "st...
Returns the line of text containing loc within a string, counting newlines as line separators.
[ "Returns", "the", "line", "of", "text", "containing", "loc", "within", "a", "string", "counting", "newlines", "as", "line", "separators", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L1124-L1132
train
pypa/pipenv
pipenv/vendor/pyparsing.py
traceParseAction
def traceParseAction(f): """Decorator for debugging parse actions. When the parse action is called, this decorator will print ``">> entering method-name(line:<current_source_line>, <parse_location>, <matched_tokens>)"``. When the parse action completes, the decorator will print ``"<<"`` followed by...
python
def traceParseAction(f): """Decorator for debugging parse actions. When the parse action is called, this decorator will print ``">> entering method-name(line:<current_source_line>, <parse_location>, <matched_tokens>)"``. When the parse action completes, the decorator will print ``"<<"`` followed by...
[ "def", "traceParseAction", "(", "f", ")", ":", "f", "=", "_trim_arity", "(", "f", ")", "def", "z", "(", "*", "paArgs", ")", ":", "thisFunc", "=", "f", ".", "__name__", "s", ",", "l", ",", "t", "=", "paArgs", "[", "-", "3", ":", "]", "if", "le...
Decorator for debugging parse actions. When the parse action is called, this decorator will print ``">> entering method-name(line:<current_source_line>, <parse_location>, <matched_tokens>)"``. When the parse action completes, the decorator will print ``"<<"`` followed by the returned value, or any exce...
[ "Decorator", "for", "debugging", "parse", "actions", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L4846-L4889
train
pypa/pipenv
pipenv/vendor/pyparsing.py
delimitedList
def delimitedList( expr, delim=",", combine=False ): """Helper to define a delimited list of expressions - the delimiter defaults to ','. By default, the list elements and delimiters can have intervening whitespace, and comments, but this can be overridden by passing ``combine=True`` in the constructor....
python
def delimitedList( expr, delim=",", combine=False ): """Helper to define a delimited list of expressions - the delimiter defaults to ','. By default, the list elements and delimiters can have intervening whitespace, and comments, but this can be overridden by passing ``combine=True`` in the constructor....
[ "def", "delimitedList", "(", "expr", ",", "delim", "=", "\",\"", ",", "combine", "=", "False", ")", ":", "dlName", "=", "_ustr", "(", "expr", ")", "+", "\" [\"", "+", "_ustr", "(", "delim", ")", "+", "\" \"", "+", "_ustr", "(", "expr", ")", "+", ...
Helper to define a delimited list of expressions - the delimiter defaults to ','. By default, the list elements and delimiters can have intervening whitespace, and comments, but this can be overridden by passing ``combine=True`` in the constructor. If ``combine`` is set to ``True``, the matching tokens ...
[ "Helper", "to", "define", "a", "delimited", "list", "of", "expressions", "-", "the", "delimiter", "defaults", "to", ".", "By", "default", "the", "list", "elements", "and", "delimiters", "can", "have", "intervening", "whitespace", "and", "comments", "but", "thi...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L4894-L4913
train
pypa/pipenv
pipenv/vendor/pyparsing.py
originalTextFor
def originalTextFor(expr, asString=True): """Helper to return the original, untokenized text for a given expression. Useful to restore the parsed fields of an HTML start tag into the raw tag text itself, or to revert separate tokens with intervening whitespace back to the original matching input text. ...
python
def originalTextFor(expr, asString=True): """Helper to return the original, untokenized text for a given expression. Useful to restore the parsed fields of an HTML start tag into the raw tag text itself, or to revert separate tokens with intervening whitespace back to the original matching input text. ...
[ "def", "originalTextFor", "(", "expr", ",", "asString", "=", "True", ")", ":", "locMarker", "=", "Empty", "(", ")", ".", "setParseAction", "(", "lambda", "s", ",", "loc", ",", "t", ":", "loc", ")", "endlocMarker", "=", "locMarker", ".", "copy", "(", ...
Helper to return the original, untokenized text for a given expression. Useful to restore the parsed fields of an HTML start tag into the raw tag text itself, or to revert separate tokens with intervening whitespace back to the original matching input text. By default, returns astring containing the or...
[ "Helper", "to", "return", "the", "original", "untokenized", "text", "for", "a", "given", "expression", ".", "Useful", "to", "restore", "the", "parsed", "fields", "of", "an", "HTML", "start", "tag", "into", "the", "raw", "tag", "text", "itself", "or", "to",...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L5146-L5186
train
pypa/pipenv
pipenv/vendor/pyparsing.py
locatedExpr
def locatedExpr(expr): """Helper to decorate a returned token with its starting and ending locations in the input string. This helper adds the following results names: - locn_start = location where matched expression begins - locn_end = location where matched expression ends - value = the a...
python
def locatedExpr(expr): """Helper to decorate a returned token with its starting and ending locations in the input string. This helper adds the following results names: - locn_start = location where matched expression begins - locn_end = location where matched expression ends - value = the a...
[ "def", "locatedExpr", "(", "expr", ")", ":", "locator", "=", "Empty", "(", ")", ".", "setParseAction", "(", "lambda", "s", ",", "l", ",", "t", ":", "l", ")", "return", "Group", "(", "locator", "(", "\"locn_start\"", ")", "+", "expr", "(", "\"value\""...
Helper to decorate a returned token with its starting and ending locations in the input string. This helper adds the following results names: - locn_start = location where matched expression begins - locn_end = location where matched expression ends - value = the actual parsed results Be c...
[ "Helper", "to", "decorate", "a", "returned", "token", "with", "its", "starting", "and", "ending", "locations", "in", "the", "input", "string", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L5194-L5220
train
pypa/pipenv
pipenv/vendor/pyparsing.py
srange
def srange(s): r"""Helper to easily define string ranges for use in Word construction. Borrows syntax from regexp '[]' string range definitions:: srange("[0-9]") -> "0123456789" srange("[a-z]") -> "abcdefghijklmnopqrstuvwxyz" srange("[a-z$_]") -> "abcdefghijklmnopqrstuvwxyz$_" ...
python
def srange(s): r"""Helper to easily define string ranges for use in Word construction. Borrows syntax from regexp '[]' string range definitions:: srange("[0-9]") -> "0123456789" srange("[a-z]") -> "abcdefghijklmnopqrstuvwxyz" srange("[a-z$_]") -> "abcdefghijklmnopqrstuvwxyz$_" ...
[ "def", "srange", "(", "s", ")", ":", "_expanded", "=", "lambda", "p", ":", "p", "if", "not", "isinstance", "(", "p", ",", "ParseResults", ")", "else", "''", ".", "join", "(", "unichr", "(", "c", ")", "for", "c", "in", "range", "(", "ord", "(", ...
r"""Helper to easily define string ranges for use in Word construction. Borrows syntax from regexp '[]' string range definitions:: srange("[0-9]") -> "0123456789" srange("[a-z]") -> "abcdefghijklmnopqrstuvwxyz" srange("[a-z$_]") -> "abcdefghijklmnopqrstuvwxyz$_" The input strin...
[ "r", "Helper", "to", "easily", "define", "string", "ranges", "for", "use", "in", "Word", "construction", ".", "Borrows", "syntax", "from", "regexp", "[]", "string", "range", "definitions", "::" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L5237-L5267
train
pypa/pipenv
pipenv/vendor/pyparsing.py
matchOnlyAtCol
def matchOnlyAtCol(n): """Helper method for defining parse actions that require matching at a specific column in the input text. """ def verifyCol(strg,locn,toks): if col(locn,strg) != n: raise ParseException(strg,locn,"matched token not at column %d" % n) return verifyCol
python
def matchOnlyAtCol(n): """Helper method for defining parse actions that require matching at a specific column in the input text. """ def verifyCol(strg,locn,toks): if col(locn,strg) != n: raise ParseException(strg,locn,"matched token not at column %d" % n) return verifyCol
[ "def", "matchOnlyAtCol", "(", "n", ")", ":", "def", "verifyCol", "(", "strg", ",", "locn", ",", "toks", ")", ":", "if", "col", "(", "locn", ",", "strg", ")", "!=", "n", ":", "raise", "ParseException", "(", "strg", ",", "locn", ",", "\"matched token n...
Helper method for defining parse actions that require matching at a specific column in the input text.
[ "Helper", "method", "for", "defining", "parse", "actions", "that", "require", "matching", "at", "a", "specific", "column", "in", "the", "input", "text", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L5269-L5276
train
pypa/pipenv
pipenv/vendor/pyparsing.py
tokenMap
def tokenMap(func, *args): """Helper to define a parse action by mapping a function to all elements of a ParseResults list. If any additional args are passed, they are forwarded to the given function as additional arguments after the token, as in ``hex_integer = Word(hexnums).setParseAction(tokenMap...
python
def tokenMap(func, *args): """Helper to define a parse action by mapping a function to all elements of a ParseResults list. If any additional args are passed, they are forwarded to the given function as additional arguments after the token, as in ``hex_integer = Word(hexnums).setParseAction(tokenMap...
[ "def", "tokenMap", "(", "func", ",", "*", "args", ")", ":", "def", "pa", "(", "s", ",", "l", ",", "t", ")", ":", "return", "[", "func", "(", "tokn", ",", "*", "args", ")", "for", "tokn", "in", "t", "]", "try", ":", "func_name", "=", "getattr"...
Helper to define a parse action by mapping a function to all elements of a ParseResults list. If any additional args are passed, they are forwarded to the given function as additional arguments after the token, as in ``hex_integer = Word(hexnums).setParseAction(tokenMap(int, 16))``, which will conve...
[ "Helper", "to", "define", "a", "parse", "action", "by", "mapping", "a", "function", "to", "all", "elements", "of", "a", "ParseResults", "list", ".", "If", "any", "additional", "args", "are", "passed", "they", "are", "forwarded", "to", "the", "given", "func...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L5308-L5354
train
pypa/pipenv
pipenv/vendor/pyparsing.py
withAttribute
def withAttribute(*args,**attrDict): """Helper to create a validating parse action to be used with start tags created with :class:`makeXMLTags` or :class:`makeHTMLTags`. Use ``withAttribute`` to qualify a starting tag with a required attribute value, to avoid false matches on common tags such as ``<...
python
def withAttribute(*args,**attrDict): """Helper to create a validating parse action to be used with start tags created with :class:`makeXMLTags` or :class:`makeHTMLTags`. Use ``withAttribute`` to qualify a starting tag with a required attribute value, to avoid false matches on common tags such as ``<...
[ "def", "withAttribute", "(", "*", "args", ",", "*", "*", "attrDict", ")", ":", "if", "args", ":", "attrs", "=", "args", "[", ":", "]", "else", ":", "attrs", "=", "attrDict", ".", "items", "(", ")", "attrs", "=", "[", "(", "k", ",", "v", ")", ...
Helper to create a validating parse action to be used with start tags created with :class:`makeXMLTags` or :class:`makeHTMLTags`. Use ``withAttribute`` to qualify a starting tag with a required attribute value, to avoid false matches on common tags such as ``<TD>`` or ``<DIV>``. Call ``withAttribut...
[ "Helper", "to", "create", "a", "validating", "parse", "action", "to", "be", "used", "with", "start", "tags", "created", "with", ":", "class", ":", "makeXMLTags", "or", ":", "class", ":", "makeHTMLTags", ".", "Use", "withAttribute", "to", "qualify", "a", "s...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L5425-L5493
train
pypa/pipenv
pipenv/vendor/pyparsing.py
nestedExpr
def nestedExpr(opener="(", closer=")", content=None, ignoreExpr=quotedString.copy()): """Helper method for defining nested lists enclosed in opening and closing delimiters ("(" and ")" are the default). Parameters: - opener - opening character for a nested list (default= ``"("``); can also be a...
python
def nestedExpr(opener="(", closer=")", content=None, ignoreExpr=quotedString.copy()): """Helper method for defining nested lists enclosed in opening and closing delimiters ("(" and ")" are the default). Parameters: - opener - opening character for a nested list (default= ``"("``); can also be a...
[ "def", "nestedExpr", "(", "opener", "=", "\"(\"", ",", "closer", "=", "\")\"", ",", "content", "=", "None", ",", "ignoreExpr", "=", "quotedString", ".", "copy", "(", ")", ")", ":", "if", "opener", "==", "closer", ":", "raise", "ValueError", "(", "\"ope...
Helper method for defining nested lists enclosed in opening and closing delimiters ("(" and ")" are the default). Parameters: - opener - opening character for a nested list (default= ``"("``); can also be a pyparsing expression - closer - closing character for a nested list (default= ``...
[ "Helper", "method", "for", "defining", "nested", "lists", "enclosed", "in", "opening", "and", "closing", "delimiters", "(", "(", "and", ")", "are", "the", "default", ")", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L5677-L5772
train
pypa/pipenv
pipenv/vendor/pyparsing.py
ParseBaseException._from_exception
def _from_exception(cls, pe): """ internal factory method to simplify creating one type of ParseException from another - avoids having __init__ signature conflicts among subclasses """ return cls(pe.pstr, pe.loc, pe.msg, pe.parserElement)
python
def _from_exception(cls, pe): """ internal factory method to simplify creating one type of ParseException from another - avoids having __init__ signature conflicts among subclasses """ return cls(pe.pstr, pe.loc, pe.msg, pe.parserElement)
[ "def", "_from_exception", "(", "cls", ",", "pe", ")", ":", "return", "cls", "(", "pe", ".", "pstr", ",", "pe", ".", "loc", ",", "pe", ".", "msg", ",", "pe", ".", "parserElement", ")" ]
internal factory method to simplify creating one type of ParseException from another - avoids having __init__ signature conflicts among subclasses
[ "internal", "factory", "method", "to", "simplify", "creating", "one", "type", "of", "ParseException", "from", "another", "-", "avoids", "having", "__init__", "signature", "conflicts", "among", "subclasses" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L252-L257
train
pypa/pipenv
pipenv/vendor/pyparsing.py
ParseBaseException.markInputline
def markInputline( self, markerString = ">!<" ): """Extracts the exception line from the input string, and marks the location of the exception with a special symbol. """ line_str = self.line line_column = self.column - 1 if markerString: line_str = "".join(...
python
def markInputline( self, markerString = ">!<" ): """Extracts the exception line from the input string, and marks the location of the exception with a special symbol. """ line_str = self.line line_column = self.column - 1 if markerString: line_str = "".join(...
[ "def", "markInputline", "(", "self", ",", "markerString", "=", "\">!<\"", ")", ":", "line_str", "=", "self", ".", "line", "line_column", "=", "self", ".", "column", "-", "1", "if", "markerString", ":", "line_str", "=", "\"\"", ".", "join", "(", "(", "l...
Extracts the exception line from the input string, and marks the location of the exception with a special symbol.
[ "Extracts", "the", "exception", "line", "from", "the", "input", "string", "and", "marks", "the", "location", "of", "the", "exception", "with", "a", "special", "symbol", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L279-L288
train
pypa/pipenv
pipenv/vendor/pyparsing.py
ParseException.explain
def explain(exc, depth=16): """ Method to take an exception and translate the Python internal traceback into a list of the pyparsing expressions that caused the exception to be raised. Parameters: - exc - exception raised during parsing (need not be a ParseException, in suppor...
python
def explain(exc, depth=16): """ Method to take an exception and translate the Python internal traceback into a list of the pyparsing expressions that caused the exception to be raised. Parameters: - exc - exception raised during parsing (need not be a ParseException, in suppor...
[ "def", "explain", "(", "exc", ",", "depth", "=", "16", ")", ":", "import", "inspect", "if", "depth", "is", "None", ":", "depth", "=", "sys", ".", "getrecursionlimit", "(", ")", "ret", "=", "[", "]", "if", "isinstance", "(", "exc", ",", "ParseBaseExce...
Method to take an exception and translate the Python internal traceback into a list of the pyparsing expressions that caused the exception to be raised. Parameters: - exc - exception raised during parsing (need not be a ParseException, in support of Python exceptions that might be ...
[ "Method", "to", "take", "an", "exception", "and", "translate", "the", "Python", "internal", "traceback", "into", "a", "list", "of", "the", "pyparsing", "expressions", "that", "caused", "the", "exception", "to", "be", "raised", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L316-L382
train
pypa/pipenv
pipenv/vendor/pyparsing.py
ParseResults.pop
def pop( self, *args, **kwargs): """ Removes and returns item at specified index (default= ``last``). Supports both ``list`` and ``dict`` semantics for ``pop()``. If passed no argument or an integer argument, it will use ``list`` semantics and pop tokens from the list of parsed t...
python
def pop( self, *args, **kwargs): """ Removes and returns item at specified index (default= ``last``). Supports both ``list`` and ``dict`` semantics for ``pop()``. If passed no argument or an integer argument, it will use ``list`` semantics and pop tokens from the list of parsed t...
[ "def", "pop", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "args", ":", "args", "=", "[", "-", "1", "]", "for", "k", ",", "v", "in", "kwargs", ".", "items", "(", ")", ":", "if", "k", "==", "'default'", ":",...
Removes and returns item at specified index (default= ``last``). Supports both ``list`` and ``dict`` semantics for ``pop()``. If passed no argument or an integer argument, it will use ``list`` semantics and pop tokens from the list of parsed tokens. If passed a non-integer argument (most...
[ "Removes", "and", "returns", "item", "at", "specified", "index", "(", "default", "=", "last", ")", ".", "Supports", "both", "list", "and", "dict", "semantics", "for", "pop", "()", ".", "If", "passed", "no", "argument", "or", "an", "integer", "argument", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L622-L675
train
pypa/pipenv
pipenv/vendor/pyparsing.py
ParseResults.extend
def extend( self, itemseq ): """ Add sequence of elements to end of ParseResults list of elements. Example:: patt = OneOrMore(Word(alphas)) # use a parse action to append the reverse of the matched strings, to make a palindrome def make_palindrome(tokens): ...
python
def extend( self, itemseq ): """ Add sequence of elements to end of ParseResults list of elements. Example:: patt = OneOrMore(Word(alphas)) # use a parse action to append the reverse of the matched strings, to make a palindrome def make_palindrome(tokens): ...
[ "def", "extend", "(", "self", ",", "itemseq", ")", ":", "if", "isinstance", "(", "itemseq", ",", "ParseResults", ")", ":", "self", "+=", "itemseq", "else", ":", "self", ".", "__toklist", ".", "extend", "(", "itemseq", ")" ]
Add sequence of elements to end of ParseResults list of elements. Example:: patt = OneOrMore(Word(alphas)) # use a parse action to append the reverse of the matched strings, to make a palindrome def make_palindrome(tokens): tokens.extend(reversed([t[::-1] f...
[ "Add", "sequence", "of", "elements", "to", "end", "of", "ParseResults", "list", "of", "elements", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L736-L753
train
pypa/pipenv
pipenv/vendor/pyparsing.py
ParseResults.asList
def asList( self ): """ Returns the parse results as a nested list of matching tokens, all converted to strings. Example:: patt = OneOrMore(Word(alphas)) result = patt.parseString("sldkj lsdkj sldkj") # even though the result prints in string-like form, it i...
python
def asList( self ): """ Returns the parse results as a nested list of matching tokens, all converted to strings. Example:: patt = OneOrMore(Word(alphas)) result = patt.parseString("sldkj lsdkj sldkj") # even though the result prints in string-like form, it i...
[ "def", "asList", "(", "self", ")", ":", "return", "[", "res", ".", "asList", "(", ")", "if", "isinstance", "(", "res", ",", "ParseResults", ")", "else", "res", "for", "res", "in", "self", ".", "__toklist", "]" ]
Returns the parse results as a nested list of matching tokens, all converted to strings. Example:: patt = OneOrMore(Word(alphas)) result = patt.parseString("sldkj lsdkj sldkj") # even though the result prints in string-like form, it is actually a pyparsing ParseResults ...
[ "Returns", "the", "parse", "results", "as", "a", "nested", "list", "of", "matching", "tokens", "all", "converted", "to", "strings", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L822-L837
train
pypa/pipenv
pipenv/vendor/pyparsing.py
ParseResults.asDict
def asDict( self ): """ Returns the named parse results as a nested dictionary. Example:: integer = Word(nums) date_str = integer("year") + '/' + integer("month") + '/' + integer("day") result = date_str.parseString('12/31/1999') print(type(resu...
python
def asDict( self ): """ Returns the named parse results as a nested dictionary. Example:: integer = Word(nums) date_str = integer("year") + '/' + integer("month") + '/' + integer("day") result = date_str.parseString('12/31/1999') print(type(resu...
[ "def", "asDict", "(", "self", ")", ":", "if", "PY_3", ":", "item_fn", "=", "self", ".", "items", "else", ":", "item_fn", "=", "self", ".", "iteritems", "def", "toItem", "(", "obj", ")", ":", "if", "isinstance", "(", "obj", ",", "ParseResults", ")", ...
Returns the named parse results as a nested dictionary. Example:: integer = Word(nums) date_str = integer("year") + '/' + integer("month") + '/' + integer("day") result = date_str.parseString('12/31/1999') print(type(result), repr(result)) # -> <class 'pyparsin...
[ "Returns", "the", "named", "parse", "results", "as", "a", "nested", "dictionary", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L839-L873
train
pypa/pipenv
pipenv/vendor/pyparsing.py
ParseResults.getName
def getName(self): r""" Returns the results name for this token expression. Useful when several different expressions might match at a particular location. Example:: integer = Word(nums) ssn_expr = Regex(r"\d\d\d-\d\d-\d\d\d\d") house_number_expr = S...
python
def getName(self): r""" Returns the results name for this token expression. Useful when several different expressions might match at a particular location. Example:: integer = Word(nums) ssn_expr = Regex(r"\d\d\d-\d\d-\d\d\d\d") house_number_expr = S...
[ "def", "getName", "(", "self", ")", ":", "if", "self", ".", "__name", ":", "return", "self", ".", "__name", "elif", "self", ".", "__parent", ":", "par", "=", "self", ".", "__parent", "(", ")", "if", "par", ":", "return", "par", ".", "__lookup", "("...
r""" Returns the results name for this token expression. Useful when several different expressions might match at a particular location. Example:: integer = Word(nums) ssn_expr = Regex(r"\d\d\d-\d\d-\d\d\d\d") house_number_expr = Suppress('#') + Word(nums, a...
[ "r", "Returns", "the", "results", "name", "for", "this", "token", "expression", ".", "Useful", "when", "several", "different", "expressions", "might", "match", "at", "a", "particular", "location", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L954-L992
train
pypa/pipenv
pipenv/vendor/pyparsing.py
ParseResults.dump
def dump(self, indent='', depth=0, full=True): """ Diagnostic method for listing out the contents of a :class:`ParseResults`. Accepts an optional ``indent`` argument so that this string can be embedded in a nested display of other data. Example:: integer = Word(nums...
python
def dump(self, indent='', depth=0, full=True): """ Diagnostic method for listing out the contents of a :class:`ParseResults`. Accepts an optional ``indent`` argument so that this string can be embedded in a nested display of other data. Example:: integer = Word(nums...
[ "def", "dump", "(", "self", ",", "indent", "=", "''", ",", "depth", "=", "0", ",", "full", "=", "True", ")", ":", "out", "=", "[", "]", "NL", "=", "'\\n'", "out", ".", "append", "(", "indent", "+", "_ustr", "(", "self", ".", "asList", "(", ")...
Diagnostic method for listing out the contents of a :class:`ParseResults`. Accepts an optional ``indent`` argument so that this string can be embedded in a nested display of other data. Example:: integer = Word(nums) date_str = integer("year") + '/' + integer("month") +...
[ "Diagnostic", "method", "for", "listing", "out", "the", "contents", "of", "a", ":", "class", ":", "ParseResults", ".", "Accepts", "an", "optional", "indent", "argument", "so", "that", "this", "string", "can", "be", "embedded", "in", "a", "nested", "display",...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L994-L1040
train
pypa/pipenv
pipenv/vendor/pyparsing.py
ParseResults.pprint
def pprint(self, *args, **kwargs): """ Pretty-printer for parsed results as a list, using the `pprint <https://docs.python.org/3/library/pprint.html>`_ module. Accepts additional positional or keyword args as defined for `pprint.pprint <https://docs.python.org/3/library/pprint.ht...
python
def pprint(self, *args, **kwargs): """ Pretty-printer for parsed results as a list, using the `pprint <https://docs.python.org/3/library/pprint.html>`_ module. Accepts additional positional or keyword args as defined for `pprint.pprint <https://docs.python.org/3/library/pprint.ht...
[ "def", "pprint", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "pprint", ".", "pprint", "(", "self", ".", "asList", "(", ")", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
Pretty-printer for parsed results as a list, using the `pprint <https://docs.python.org/3/library/pprint.html>`_ module. Accepts additional positional or keyword args as defined for `pprint.pprint <https://docs.python.org/3/library/pprint.html#pprint.pprint>`_ . Example:: i...
[ "Pretty", "-", "printer", "for", "parsed", "results", "as", "a", "list", "using", "the", "pprint", "<https", ":", "//", "docs", ".", "python", ".", "org", "/", "3", "/", "library", "/", "pprint", ".", "html", ">", "_", "module", ".", "Accepts", "addi...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L1042-L1067
train
pypa/pipenv
pipenv/vendor/pyparsing.py
ParserElement.copy
def copy( self ): """ Make a copy of this :class:`ParserElement`. Useful for defining different parse actions for the same parsing pattern, using copies of the original parse element. Example:: integer = Word(nums).setParseAction(lambda toks: int(toks[0])) ...
python
def copy( self ): """ Make a copy of this :class:`ParserElement`. Useful for defining different parse actions for the same parsing pattern, using copies of the original parse element. Example:: integer = Word(nums).setParseAction(lambda toks: int(toks[0])) ...
[ "def", "copy", "(", "self", ")", ":", "cpy", "=", "copy", ".", "copy", "(", "self", ")", "cpy", ".", "parseAction", "=", "self", ".", "parseAction", "[", ":", "]", "cpy", ".", "ignoreExprs", "=", "self", ".", "ignoreExprs", "[", ":", "]", "if", "...
Make a copy of this :class:`ParserElement`. Useful for defining different parse actions for the same parsing pattern, using copies of the original parse element. Example:: integer = Word(nums).setParseAction(lambda toks: int(toks[0])) integerK = integer.copy().addParse...
[ "Make", "a", "copy", "of", "this", ":", "class", ":", "ParserElement", ".", "Useful", "for", "defining", "different", "parse", "actions", "for", "the", "same", "parsing", "pattern", "using", "copies", "of", "the", "original", "parse", "element", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L1300-L1327
train
pypa/pipenv
pipenv/vendor/pyparsing.py
ParserElement.setName
def setName( self, name ): """ Define name for this expression, makes debugging and exception messages clearer. Example:: Word(nums).parseString("ABC") # -> Exception: Expected W:(0123...) (at char 0), (line:1, col:1) Word(nums).setName("integer").parseString("ABC") #...
python
def setName( self, name ): """ Define name for this expression, makes debugging and exception messages clearer. Example:: Word(nums).parseString("ABC") # -> Exception: Expected W:(0123...) (at char 0), (line:1, col:1) Word(nums).setName("integer").parseString("ABC") #...
[ "def", "setName", "(", "self", ",", "name", ")", ":", "self", ".", "name", "=", "name", "self", ".", "errmsg", "=", "\"Expected \"", "+", "self", ".", "name", "if", "hasattr", "(", "self", ",", "\"exception\"", ")", ":", "self", ".", "exception", "."...
Define name for this expression, makes debugging and exception messages clearer. Example:: Word(nums).parseString("ABC") # -> Exception: Expected W:(0123...) (at char 0), (line:1, col:1) Word(nums).setName("integer").parseString("ABC") # -> Exception: Expected integer (at char 0), (l...
[ "Define", "name", "for", "this", "expression", "makes", "debugging", "and", "exception", "messages", "clearer", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L1329-L1342
train
pypa/pipenv
pipenv/vendor/pyparsing.py
ParserElement.setResultsName
def setResultsName( self, name, listAllMatches=False ): """ Define name for referencing matching tokens as a nested attribute of the returned parse results. NOTE: this returns a *copy* of the original :class:`ParserElement` object; this is so that the client can define a basic el...
python
def setResultsName( self, name, listAllMatches=False ): """ Define name for referencing matching tokens as a nested attribute of the returned parse results. NOTE: this returns a *copy* of the original :class:`ParserElement` object; this is so that the client can define a basic el...
[ "def", "setResultsName", "(", "self", ",", "name", ",", "listAllMatches", "=", "False", ")", ":", "newself", "=", "self", ".", "copy", "(", ")", "if", "name", ".", "endswith", "(", "\"*\"", ")", ":", "name", "=", "name", "[", ":", "-", "1", "]", ...
Define name for referencing matching tokens as a nested attribute of the returned parse results. NOTE: this returns a *copy* of the original :class:`ParserElement` object; this is so that the client can define a basic element, such as an integer, and reference it in multiple places with ...
[ "Define", "name", "for", "referencing", "matching", "tokens", "as", "a", "nested", "attribute", "of", "the", "returned", "parse", "results", ".", "NOTE", ":", "this", "returns", "a", "*", "copy", "*", "of", "the", "original", ":", "class", ":", "ParserElem...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L1344-L1371
train
pypa/pipenv
pipenv/vendor/pyparsing.py
ParserElement.addCondition
def addCondition(self, *fns, **kwargs): """Add a boolean predicate function to expression's list of parse actions. See :class:`setParseAction` for function call signatures. Unlike ``setParseAction``, functions passed to ``addCondition`` need to return boolean success/fail of the condition. ...
python
def addCondition(self, *fns, **kwargs): """Add a boolean predicate function to expression's list of parse actions. See :class:`setParseAction` for function call signatures. Unlike ``setParseAction``, functions passed to ``addCondition`` need to return boolean success/fail of the condition. ...
[ "def", "addCondition", "(", "self", ",", "*", "fns", ",", "*", "*", "kwargs", ")", ":", "msg", "=", "kwargs", ".", "get", "(", "\"message\"", ",", "\"failed user-defined condition\"", ")", "exc_type", "=", "ParseFatalException", "if", "kwargs", ".", "get", ...
Add a boolean predicate function to expression's list of parse actions. See :class:`setParseAction` for function call signatures. Unlike ``setParseAction``, functions passed to ``addCondition`` need to return boolean success/fail of the condition. Optional keyword arguments: - message =...
[ "Add", "a", "boolean", "predicate", "function", "to", "expression", "s", "list", "of", "parse", "actions", ".", "See", ":", "class", ":", "setParseAction", "for", "function", "call", "signatures", ".", "Unlike", "setParseAction", "functions", "passed", "to", "...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L1442-L1469
train
pypa/pipenv
pipenv/vendor/pyparsing.py
ParserElement.enablePackrat
def enablePackrat(cache_size_limit=128): """Enables "packrat" parsing, which adds memoizing to the parsing logic. Repeated parse attempts at the same string location (which happens often in many complex grammars) can immediately return a cached value, instead of re-executing par...
python
def enablePackrat(cache_size_limit=128): """Enables "packrat" parsing, which adds memoizing to the parsing logic. Repeated parse attempts at the same string location (which happens often in many complex grammars) can immediately return a cached value, instead of re-executing par...
[ "def", "enablePackrat", "(", "cache_size_limit", "=", "128", ")", ":", "if", "not", "ParserElement", ".", "_packratEnabled", ":", "ParserElement", ".", "_packratEnabled", "=", "True", "if", "cache_size_limit", "is", "None", ":", "ParserElement", ".", "packrat_cach...
Enables "packrat" parsing, which adds memoizing to the parsing logic. Repeated parse attempts at the same string location (which happens often in many complex grammars) can immediately return a cached value, instead of re-executing parsing/validating code. Memoizing is done of ...
[ "Enables", "packrat", "parsing", "which", "adds", "memoizing", "to", "the", "parsing", "logic", ".", "Repeated", "parse", "attempts", "at", "the", "same", "string", "location", "(", "which", "happens", "often", "in", "many", "complex", "grammars", ")", "can", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L1732-L1764
train
pypa/pipenv
pipenv/vendor/pyparsing.py
ParserElement.parseString
def parseString( self, instring, parseAll=False ): """ Execute the parse expression with the given string. This is the main interface to the client code, once the complete expression has been built. If you want the grammar to require that the entire input string be succe...
python
def parseString( self, instring, parseAll=False ): """ Execute the parse expression with the given string. This is the main interface to the client code, once the complete expression has been built. If you want the grammar to require that the entire input string be succe...
[ "def", "parseString", "(", "self", ",", "instring", ",", "parseAll", "=", "False", ")", ":", "ParserElement", ".", "resetCache", "(", ")", "if", "not", "self", ".", "streamlined", ":", "self", ".", "streamline", "(", ")", "#~ self.saveAsList = True", "for", ...
Execute the parse expression with the given string. This is the main interface to the client code, once the complete expression has been built. If you want the grammar to require that the entire input string be successfully parsed, then set ``parseAll`` to True (equivalent to ending ...
[ "Execute", "the", "parse", "expression", "with", "the", "given", "string", ".", "This", "is", "the", "main", "interface", "to", "the", "client", "code", "once", "the", "complete", "expression", "has", "been", "built", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L1766-L1816
train
pypa/pipenv
pipenv/vendor/pyparsing.py
ParserElement.searchString
def searchString( self, instring, maxMatches=_MAX_INT ): """ Another extension to :class:`scanString`, simplifying the access to the tokens found to match the given parse expression. May be called with optional ``maxMatches`` argument, to clip searching after 'n' matches are found. ...
python
def searchString( self, instring, maxMatches=_MAX_INT ): """ Another extension to :class:`scanString`, simplifying the access to the tokens found to match the given parse expression. May be called with optional ``maxMatches`` argument, to clip searching after 'n' matches are found. ...
[ "def", "searchString", "(", "self", ",", "instring", ",", "maxMatches", "=", "_MAX_INT", ")", ":", "try", ":", "return", "ParseResults", "(", "[", "t", "for", "t", ",", "s", ",", "e", "in", "self", ".", "scanString", "(", "instring", ",", "maxMatches",...
Another extension to :class:`scanString`, simplifying the access to the tokens found to match the given parse expression. May be called with optional ``maxMatches`` argument, to clip searching after 'n' matches are found. Example:: # a capitalized word starts with an uppercase let...
[ "Another", "extension", "to", ":", "class", ":", "scanString", "simplifying", "the", "access", "to", "the", "tokens", "found", "to", "match", "the", "given", "parse", "expression", ".", "May", "be", "called", "with", "optional", "maxMatches", "argument", "to",...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L1936-L1964
train
pypa/pipenv
pipenv/vendor/pyparsing.py
ParserElement.split
def split(self, instring, maxsplit=_MAX_INT, includeSeparators=False): """ Generator method to split a string using the given expression as a separator. May be called with optional ``maxsplit`` argument, to limit the number of splits; and the optional ``includeSeparators`` argument (defa...
python
def split(self, instring, maxsplit=_MAX_INT, includeSeparators=False): """ Generator method to split a string using the given expression as a separator. May be called with optional ``maxsplit`` argument, to limit the number of splits; and the optional ``includeSeparators`` argument (defa...
[ "def", "split", "(", "self", ",", "instring", ",", "maxsplit", "=", "_MAX_INT", ",", "includeSeparators", "=", "False", ")", ":", "splits", "=", "0", "last", "=", "0", "for", "t", ",", "s", ",", "e", "in", "self", ".", "scanString", "(", "instring", ...
Generator method to split a string using the given expression as a separator. May be called with optional ``maxsplit`` argument, to limit the number of splits; and the optional ``includeSeparators`` argument (default= ``False``), if the separating matching text should be included in the split re...
[ "Generator", "method", "to", "split", "a", "string", "using", "the", "given", "expression", "as", "a", "separator", ".", "May", "be", "called", "with", "optional", "maxsplit", "argument", "to", "limit", "the", "number", "of", "splits", ";", "and", "the", "...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L1966-L1989
train
pypa/pipenv
pipenv/vendor/pyparsing.py
ParserElement.setWhitespaceChars
def setWhitespaceChars( self, chars ): """ Overrides the default whitespace chars """ self.skipWhitespace = True self.whiteChars = chars self.copyDefaultWhiteChars = False return self
python
def setWhitespaceChars( self, chars ): """ Overrides the default whitespace chars """ self.skipWhitespace = True self.whiteChars = chars self.copyDefaultWhiteChars = False return self
[ "def", "setWhitespaceChars", "(", "self", ",", "chars", ")", ":", "self", ".", "skipWhitespace", "=", "True", "self", ".", "whiteChars", "=", "chars", "self", ".", "copyDefaultWhiteChars", "=", "False", "return", "self" ]
Overrides the default whitespace chars
[ "Overrides", "the", "default", "whitespace", "chars" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L2235-L2242
train
pypa/pipenv
pipenv/vendor/pyparsing.py
ParserElement.ignore
def ignore( self, other ): """ Define expression to be ignored (e.g., comments) while doing pattern matching; may be called repeatedly, to define multiple comment or other ignorable patterns. Example:: patt = OneOrMore(Word(alphas)) patt.parseString('abl...
python
def ignore( self, other ): """ Define expression to be ignored (e.g., comments) while doing pattern matching; may be called repeatedly, to define multiple comment or other ignorable patterns. Example:: patt = OneOrMore(Word(alphas)) patt.parseString('abl...
[ "def", "ignore", "(", "self", ",", "other", ")", ":", "if", "isinstance", "(", "other", ",", "basestring", ")", ":", "other", "=", "Suppress", "(", "other", ")", "if", "isinstance", "(", "other", ",", "Suppress", ")", ":", "if", "other", "not", "in",...
Define expression to be ignored (e.g., comments) while doing pattern matching; may be called repeatedly, to define multiple comment or other ignorable patterns. Example:: patt = OneOrMore(Word(alphas)) patt.parseString('ablaj /* comment */ lskjd') # -> ['ablaj'] ...
[ "Define", "expression", "to", "be", "ignored", "(", "e", ".", "g", ".", "comments", ")", "while", "doing", "pattern", "matching", ";", "may", "be", "called", "repeatedly", "to", "define", "multiple", "comment", "or", "other", "ignorable", "patterns", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L2253-L2275
train
pypa/pipenv
pipenv/vendor/pyparsing.py
ParserElement.setDebugActions
def setDebugActions( self, startAction, successAction, exceptionAction ): """ Enable display of debugging messages while doing pattern matching. """ self.debugActions = (startAction or _defaultStartDebugAction, successAction or _defaultSuccessDebugAction, ...
python
def setDebugActions( self, startAction, successAction, exceptionAction ): """ Enable display of debugging messages while doing pattern matching. """ self.debugActions = (startAction or _defaultStartDebugAction, successAction or _defaultSuccessDebugAction, ...
[ "def", "setDebugActions", "(", "self", ",", "startAction", ",", "successAction", ",", "exceptionAction", ")", ":", "self", ".", "debugActions", "=", "(", "startAction", "or", "_defaultStartDebugAction", ",", "successAction", "or", "_defaultSuccessDebugAction", ",", ...
Enable display of debugging messages while doing pattern matching.
[ "Enable", "display", "of", "debugging", "messages", "while", "doing", "pattern", "matching", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L2277-L2285
train
pypa/pipenv
pipenv/vendor/pyparsing.py
ParserElement.setDebug
def setDebug( self, flag=True ): """ Enable display of debugging messages while doing pattern matching. Set ``flag`` to True to enable, False to disable. Example:: wd = Word(alphas).setName("alphaword") integer = Word(nums).setName("numword") term = ...
python
def setDebug( self, flag=True ): """ Enable display of debugging messages while doing pattern matching. Set ``flag`` to True to enable, False to disable. Example:: wd = Word(alphas).setName("alphaword") integer = Word(nums).setName("numword") term = ...
[ "def", "setDebug", "(", "self", ",", "flag", "=", "True", ")", ":", "if", "flag", ":", "self", ".", "setDebugActions", "(", "_defaultStartDebugAction", ",", "_defaultSuccessDebugAction", ",", "_defaultExceptionDebugAction", ")", "else", ":", "self", ".", "debug"...
Enable display of debugging messages while doing pattern matching. Set ``flag`` to True to enable, False to disable. Example:: wd = Word(alphas).setName("alphaword") integer = Word(nums).setName("numword") term = wd | integer # turn on debugging for wd ...
[ "Enable", "display", "of", "debugging", "messages", "while", "doing", "pattern", "matching", ".", "Set", "flag", "to", "True", "to", "enable", "False", "to", "disable", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L2287-L2328
train
pypa/pipenv
pipenv/vendor/pyparsing.py
ParserElement.parseFile
def parseFile( self, file_or_filename, parseAll=False ): """ Execute the parse expression on the given file or filename. If a filename is specified (instead of a file object), the entire file is opened, read, and closed before parsing. """ try: file_contents =...
python
def parseFile( self, file_or_filename, parseAll=False ): """ Execute the parse expression on the given file or filename. If a filename is specified (instead of a file object), the entire file is opened, read, and closed before parsing. """ try: file_contents =...
[ "def", "parseFile", "(", "self", ",", "file_or_filename", ",", "parseAll", "=", "False", ")", ":", "try", ":", "file_contents", "=", "file_or_filename", ".", "read", "(", ")", "except", "AttributeError", ":", "with", "open", "(", "file_or_filename", ",", "\"...
Execute the parse expression on the given file or filename. If a filename is specified (instead of a file object), the entire file is opened, read, and closed before parsing.
[ "Execute", "the", "parse", "expression", "on", "the", "given", "file", "or", "filename", ".", "If", "a", "filename", "is", "specified", "(", "instead", "of", "a", "file", "object", ")", "the", "entire", "file", "is", "opened", "read", "and", "closed", "b...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L2350-L2368
train
pypa/pipenv
pipenv/vendor/pyparsing.py
Regex.sub
def sub(self, repl): """ Return Regex with an attached parse action to transform the parsed result as if called using `re.sub(expr, repl, string) <https://docs.python.org/3/library/re.html#re.sub>`_. Example:: make_html = Regex(r"(\w+):(.*?):").sub(r"<\1>\2</\1>") ...
python
def sub(self, repl): """ Return Regex with an attached parse action to transform the parsed result as if called using `re.sub(expr, repl, string) <https://docs.python.org/3/library/re.html#re.sub>`_. Example:: make_html = Regex(r"(\w+):(.*?):").sub(r"<\1>\2</\1>") ...
[ "def", "sub", "(", "self", ",", "repl", ")", ":", "if", "self", ".", "asGroupList", ":", "warnings", ".", "warn", "(", "\"cannot use sub() with Regex(asGroupList=True)\"", ",", "SyntaxWarning", ",", "stacklevel", "=", "2", ")", "raise", "SyntaxError", "(", ")"...
Return Regex with an attached parse action to transform the parsed result as if called using `re.sub(expr, repl, string) <https://docs.python.org/3/library/re.html#re.sub>`_. Example:: make_html = Regex(r"(\w+):(.*?):").sub(r"<\1>\2</\1>") print(make_html.transformString("h1:ma...
[ "Return", "Regex", "with", "an", "attached", "parse", "action", "to", "transform", "the", "parsed", "result", "as", "if", "called", "using", "re", ".", "sub", "(", "expr", "repl", "string", ")", "<https", ":", "//", "docs", ".", "python", ".", "org", "...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L3067-L3094
train
pypa/pipenv
pipenv/vendor/pyparsing.py
ParseExpression.leaveWhitespace
def leaveWhitespace( self ): """Extends ``leaveWhitespace`` defined in base class, and also invokes ``leaveWhitespace`` on all contained expressions.""" self.skipWhitespace = False self.exprs = [ e.copy() for e in self.exprs ] for e in self.exprs: e.leaveWhitespace...
python
def leaveWhitespace( self ): """Extends ``leaveWhitespace`` defined in base class, and also invokes ``leaveWhitespace`` on all contained expressions.""" self.skipWhitespace = False self.exprs = [ e.copy() for e in self.exprs ] for e in self.exprs: e.leaveWhitespace...
[ "def", "leaveWhitespace", "(", "self", ")", ":", "self", ".", "skipWhitespace", "=", "False", "self", ".", "exprs", "=", "[", "e", ".", "copy", "(", ")", "for", "e", "in", "self", ".", "exprs", "]", "for", "e", "in", "self", ".", "exprs", ":", "e...
Extends ``leaveWhitespace`` defined in base class, and also invokes ``leaveWhitespace`` on all contained expressions.
[ "Extends", "leaveWhitespace", "defined", "in", "base", "class", "and", "also", "invokes", "leaveWhitespace", "on", "all", "contained", "expressions", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L3586-L3593
train
pypa/pipenv
pipenv/vendor/pyparsing.py
pyparsing_common.convertToDate
def convertToDate(fmt="%Y-%m-%d"): """ Helper to create a parse action for converting parsed date string to Python datetime.date Params - - fmt - format to be passed to datetime.strptime (default= ``"%Y-%m-%d"``) Example:: date_expr = pyparsing_common.iso8601_date...
python
def convertToDate(fmt="%Y-%m-%d"): """ Helper to create a parse action for converting parsed date string to Python datetime.date Params - - fmt - format to be passed to datetime.strptime (default= ``"%Y-%m-%d"``) Example:: date_expr = pyparsing_common.iso8601_date...
[ "def", "convertToDate", "(", "fmt", "=", "\"%Y-%m-%d\"", ")", ":", "def", "cvt_fn", "(", "s", ",", "l", ",", "t", ")", ":", "try", ":", "return", "datetime", ".", "strptime", "(", "t", "[", "0", "]", ",", "fmt", ")", ".", "date", "(", ")", "exc...
Helper to create a parse action for converting parsed date string to Python datetime.date Params - - fmt - format to be passed to datetime.strptime (default= ``"%Y-%m-%d"``) Example:: date_expr = pyparsing_common.iso8601_date.copy() date_expr.setParseAction(pyparsing_...
[ "Helper", "to", "create", "a", "parse", "action", "for", "converting", "parsed", "date", "string", "to", "Python", "datetime", ".", "date" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L6136-L6158
train
pypa/pipenv
pipenv/vendor/pyparsing.py
pyparsing_common.convertToDatetime
def convertToDatetime(fmt="%Y-%m-%dT%H:%M:%S.%f"): """Helper to create a parse action for converting parsed datetime string to Python datetime.datetime Params - - fmt - format to be passed to datetime.strptime (default= ``"%Y-%m-%dT%H:%M:%S.%f"``) Example:: dt_exp...
python
def convertToDatetime(fmt="%Y-%m-%dT%H:%M:%S.%f"): """Helper to create a parse action for converting parsed datetime string to Python datetime.datetime Params - - fmt - format to be passed to datetime.strptime (default= ``"%Y-%m-%dT%H:%M:%S.%f"``) Example:: dt_exp...
[ "def", "convertToDatetime", "(", "fmt", "=", "\"%Y-%m-%dT%H:%M:%S.%f\"", ")", ":", "def", "cvt_fn", "(", "s", ",", "l", ",", "t", ")", ":", "try", ":", "return", "datetime", ".", "strptime", "(", "t", "[", "0", "]", ",", "fmt", ")", "except", "ValueE...
Helper to create a parse action for converting parsed datetime string to Python datetime.datetime Params - - fmt - format to be passed to datetime.strptime (default= ``"%Y-%m-%dT%H:%M:%S.%f"``) Example:: dt_expr = pyparsing_common.iso8601_datetime.copy() dt_ex...
[ "Helper", "to", "create", "a", "parse", "action", "for", "converting", "parsed", "datetime", "string", "to", "Python", "datetime", ".", "datetime" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L6161-L6183
train
pypa/pipenv
pipenv/patched/notpip/_internal/index.py
_match_vcs_scheme
def _match_vcs_scheme(url): # type: (str) -> Optional[str] """Look for VCS schemes in the URL. Returns the matched VCS scheme, or None if there's no match. """ from pipenv.patched.notpip._internal.vcs import VcsSupport for scheme in VcsSupport.schemes: if url.lower().startswith(scheme) ...
python
def _match_vcs_scheme(url): # type: (str) -> Optional[str] """Look for VCS schemes in the URL. Returns the matched VCS scheme, or None if there's no match. """ from pipenv.patched.notpip._internal.vcs import VcsSupport for scheme in VcsSupport.schemes: if url.lower().startswith(scheme) ...
[ "def", "_match_vcs_scheme", "(", "url", ")", ":", "# type: (str) -> Optional[str]", "from", "pipenv", ".", "patched", ".", "notpip", ".", "_internal", ".", "vcs", "import", "VcsSupport", "for", "scheme", "in", "VcsSupport", ".", "schemes", ":", "if", "url", "....
Look for VCS schemes in the URL. Returns the matched VCS scheme, or None if there's no match.
[ "Look", "for", "VCS", "schemes", "in", "the", "URL", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/index.py#L77-L87
train
pypa/pipenv
pipenv/patched/notpip/_internal/index.py
_is_url_like_archive
def _is_url_like_archive(url): # type: (str) -> bool """Return whether the URL looks like an archive. """ filename = Link(url).filename for bad_ext in ARCHIVE_EXTENSIONS: if filename.endswith(bad_ext): return True return False
python
def _is_url_like_archive(url): # type: (str) -> bool """Return whether the URL looks like an archive. """ filename = Link(url).filename for bad_ext in ARCHIVE_EXTENSIONS: if filename.endswith(bad_ext): return True return False
[ "def", "_is_url_like_archive", "(", "url", ")", ":", "# type: (str) -> bool", "filename", "=", "Link", "(", "url", ")", ".", "filename", "for", "bad_ext", "in", "ARCHIVE_EXTENSIONS", ":", "if", "filename", ".", "endswith", "(", "bad_ext", ")", ":", "return", ...
Return whether the URL looks like an archive.
[ "Return", "whether", "the", "URL", "looks", "like", "an", "archive", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/index.py#L90-L98
train
pypa/pipenv
pipenv/patched/notpip/_internal/index.py
_ensure_html_header
def _ensure_html_header(response): # type: (Response) -> None """Check the Content-Type header to ensure the response contains HTML. Raises `_NotHTML` if the content type is not text/html. """ content_type = response.headers.get("Content-Type", "") if not content_type.lower().startswith("text/h...
python
def _ensure_html_header(response): # type: (Response) -> None """Check the Content-Type header to ensure the response contains HTML. Raises `_NotHTML` if the content type is not text/html. """ content_type = response.headers.get("Content-Type", "") if not content_type.lower().startswith("text/h...
[ "def", "_ensure_html_header", "(", "response", ")", ":", "# type: (Response) -> None", "content_type", "=", "response", ".", "headers", ".", "get", "(", "\"Content-Type\"", ",", "\"\"", ")", "if", "not", "content_type", ".", "lower", "(", ")", ".", "startswith",...
Check the Content-Type header to ensure the response contains HTML. Raises `_NotHTML` if the content type is not text/html.
[ "Check", "the", "Content", "-", "Type", "header", "to", "ensure", "the", "response", "contains", "HTML", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/index.py#L109-L117
train
pypa/pipenv
pipenv/patched/notpip/_internal/index.py
_ensure_html_response
def _ensure_html_response(url, session): # type: (str, PipSession) -> None """Send a HEAD request to the URL, and ensure the response contains HTML. Raises `_NotHTTP` if the URL is not available for a HEAD request, or `_NotHTML` if the content type is not text/html. """ scheme, netloc, path, qu...
python
def _ensure_html_response(url, session): # type: (str, PipSession) -> None """Send a HEAD request to the URL, and ensure the response contains HTML. Raises `_NotHTTP` if the URL is not available for a HEAD request, or `_NotHTML` if the content type is not text/html. """ scheme, netloc, path, qu...
[ "def", "_ensure_html_response", "(", "url", ",", "session", ")", ":", "# type: (str, PipSession) -> None", "scheme", ",", "netloc", ",", "path", ",", "query", ",", "fragment", "=", "urllib_parse", ".", "urlsplit", "(", "url", ")", "if", "scheme", "not", "in", ...
Send a HEAD request to the URL, and ensure the response contains HTML. Raises `_NotHTTP` if the URL is not available for a HEAD request, or `_NotHTML` if the content type is not text/html.
[ "Send", "a", "HEAD", "request", "to", "the", "URL", "and", "ensure", "the", "response", "contains", "HTML", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/index.py#L124-L138
train
pypa/pipenv
pipenv/patched/notpip/_internal/index.py
_get_html_response
def _get_html_response(url, session): # type: (str, PipSession) -> Response """Access an HTML page with GET, and return the response. This consists of three parts: 1. If the URL looks suspiciously like an archive, send a HEAD first to check the Content-Type is HTML, to avoid downloading a large...
python
def _get_html_response(url, session): # type: (str, PipSession) -> Response """Access an HTML page with GET, and return the response. This consists of three parts: 1. If the URL looks suspiciously like an archive, send a HEAD first to check the Content-Type is HTML, to avoid downloading a large...
[ "def", "_get_html_response", "(", "url", ",", "session", ")", ":", "# type: (str, PipSession) -> Response", "if", "_is_url_like_archive", "(", "url", ")", ":", "_ensure_html_response", "(", "url", ",", "session", "=", "session", ")", "logger", ".", "debug", "(", ...
Access an HTML page with GET, and return the response. This consists of three parts: 1. If the URL looks suspiciously like an archive, send a HEAD first to check the Content-Type is HTML, to avoid downloading a large file. Raise `_NotHTTP` if the content type cannot be determined, or `_No...
[ "Access", "an", "HTML", "page", "with", "GET", "and", "return", "the", "response", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/index.py#L141-L189
train
pypa/pipenv
pipenv/patched/notpip/_internal/index.py
_find_name_version_sep
def _find_name_version_sep(egg_info, canonical_name): # type: (str, str) -> int """Find the separator's index based on the package's canonical name. `egg_info` must be an egg info string for the given package, and `canonical_name` must be the package's canonical name. This function is needed since...
python
def _find_name_version_sep(egg_info, canonical_name): # type: (str, str) -> int """Find the separator's index based on the package's canonical name. `egg_info` must be an egg info string for the given package, and `canonical_name` must be the package's canonical name. This function is needed since...
[ "def", "_find_name_version_sep", "(", "egg_info", ",", "canonical_name", ")", ":", "# type: (str, str) -> int", "# Project name and version must be separated by one single dash. Find all", "# occurrences of dashes; if the string in front of it matches the canonical", "# name, this is the one s...
Find the separator's index based on the package's canonical name. `egg_info` must be an egg info string for the given package, and `canonical_name` must be the package's canonical name. This function is needed since the canonicalized name does not necessarily have the same length as the egg info's nam...
[ "Find", "the", "separator", "s", "index", "based", "on", "the", "package", "s", "canonical", "name", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/index.py#L896-L919
train
pypa/pipenv
pipenv/patched/notpip/_internal/index.py
_egg_info_matches
def _egg_info_matches(egg_info, canonical_name): # type: (str, str) -> Optional[str] """Pull the version part out of a string. :param egg_info: The string to parse. E.g. foo-2.1 :param canonical_name: The canonicalized name of the package this belongs to. """ try: version_start ...
python
def _egg_info_matches(egg_info, canonical_name): # type: (str, str) -> Optional[str] """Pull the version part out of a string. :param egg_info: The string to parse. E.g. foo-2.1 :param canonical_name: The canonicalized name of the package this belongs to. """ try: version_start ...
[ "def", "_egg_info_matches", "(", "egg_info", ",", "canonical_name", ")", ":", "# type: (str, str) -> Optional[str]", "try", ":", "version_start", "=", "_find_name_version_sep", "(", "egg_info", ",", "canonical_name", ")", "+", "1", "except", "ValueError", ":", "return...
Pull the version part out of a string. :param egg_info: The string to parse. E.g. foo-2.1 :param canonical_name: The canonicalized name of the package this belongs to.
[ "Pull", "the", "version", "part", "out", "of", "a", "string", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/index.py#L922-L937
train
pypa/pipenv
pipenv/patched/notpip/_internal/index.py
_determine_base_url
def _determine_base_url(document, page_url): """Determine the HTML document's base URL. This looks for a ``<base>`` tag in the HTML document. If present, its href attribute denotes the base URL of anchor tags in the document. If there is no such tag (or if it does not have a valid href attribute), the ...
python
def _determine_base_url(document, page_url): """Determine the HTML document's base URL. This looks for a ``<base>`` tag in the HTML document. If present, its href attribute denotes the base URL of anchor tags in the document. If there is no such tag (or if it does not have a valid href attribute), the ...
[ "def", "_determine_base_url", "(", "document", ",", "page_url", ")", ":", "for", "base", "in", "document", ".", "findall", "(", "\".//base\"", ")", ":", "href", "=", "base", ".", "get", "(", "\"href\"", ")", "if", "href", "is", "not", "None", ":", "ret...
Determine the HTML document's base URL. This looks for a ``<base>`` tag in the HTML document. If present, its href attribute denotes the base URL of anchor tags in the document. If there is no such tag (or if it does not have a valid href attribute), the HTML file's URL is used as the base URL. :p...
[ "Determine", "the", "HTML", "document", "s", "base", "URL", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/index.py#L940-L956
train
pypa/pipenv
pipenv/patched/notpip/_internal/index.py
_get_encoding_from_headers
def _get_encoding_from_headers(headers): """Determine if we have any encoding information in our headers. """ if headers and "Content-Type" in headers: content_type, params = cgi.parse_header(headers["Content-Type"]) if "charset" in params: return params['charset'] return Non...
python
def _get_encoding_from_headers(headers): """Determine if we have any encoding information in our headers. """ if headers and "Content-Type" in headers: content_type, params = cgi.parse_header(headers["Content-Type"]) if "charset" in params: return params['charset'] return Non...
[ "def", "_get_encoding_from_headers", "(", "headers", ")", ":", "if", "headers", "and", "\"Content-Type\"", "in", "headers", ":", "content_type", ",", "params", "=", "cgi", ".", "parse_header", "(", "headers", "[", "\"Content-Type\"", "]", ")", "if", "\"charset\"...
Determine if we have any encoding information in our headers.
[ "Determine", "if", "we", "have", "any", "encoding", "information", "in", "our", "headers", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/index.py#L959-L966
train
pypa/pipenv
pipenv/patched/notpip/_internal/index.py
PackageFinder._candidate_sort_key
def _candidate_sort_key(self, candidate, ignore_compatibility=True): # type: (InstallationCandidate, bool) -> CandidateSortingKey """ Function used to generate link sort key for link tuples. The greater the return value, the more preferred it is. If not finding wheels, then sorte...
python
def _candidate_sort_key(self, candidate, ignore_compatibility=True): # type: (InstallationCandidate, bool) -> CandidateSortingKey """ Function used to generate link sort key for link tuples. The greater the return value, the more preferred it is. If not finding wheels, then sorte...
[ "def", "_candidate_sort_key", "(", "self", ",", "candidate", ",", "ignore_compatibility", "=", "True", ")", ":", "# type: (InstallationCandidate, bool) -> CandidateSortingKey", "support_num", "=", "len", "(", "self", ".", "valid_tags", ")", "build_tag", "=", "tuple", ...
Function used to generate link sort key for link tuples. The greater the return value, the more preferred it is. If not finding wheels, then sorted by version only. If finding wheels, then the sort order is by version, then: 1. existing installs 2. wheels ordered via Wheel.su...
[ "Function", "used", "to", "generate", "link", "sort", "key", "for", "link", "tuples", ".", "The", "greater", "the", "return", "value", "the", "more", "preferred", "it", "is", ".", "If", "not", "finding", "wheels", "then", "sorted", "by", "version", "only",...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/index.py#L450-L489
train
pypa/pipenv
pipenv/patched/notpip/_internal/index.py
PackageFinder._get_index_urls_locations
def _get_index_urls_locations(self, project_name): # type: (str) -> List[str] """Returns the locations found via self.index_urls Checks the url_name on the main (first in the list) index and use this url_name to produce all locations """ def mkurl_pypi_url(url): ...
python
def _get_index_urls_locations(self, project_name): # type: (str) -> List[str] """Returns the locations found via self.index_urls Checks the url_name on the main (first in the list) index and use this url_name to produce all locations """ def mkurl_pypi_url(url): ...
[ "def", "_get_index_urls_locations", "(", "self", ",", "project_name", ")", ":", "# type: (str) -> List[str]", "def", "mkurl_pypi_url", "(", "url", ")", ":", "loc", "=", "posixpath", ".", "join", "(", "url", ",", "urllib_parse", ".", "quote", "(", "canonicalize_n...
Returns the locations found via self.index_urls Checks the url_name on the main (first in the list) index and use this url_name to produce all locations
[ "Returns", "the", "locations", "found", "via", "self", ".", "index_urls" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/index.py#L565-L586
train
pypa/pipenv
pipenv/patched/notpip/_internal/index.py
PackageFinder.find_all_candidates
def find_all_candidates(self, project_name): # type: (str) -> List[Optional[InstallationCandidate]] """Find all available InstallationCandidate for project_name This checks index_urls and find_links. All versions found are returned as an InstallationCandidate list. See _link_pa...
python
def find_all_candidates(self, project_name): # type: (str) -> List[Optional[InstallationCandidate]] """Find all available InstallationCandidate for project_name This checks index_urls and find_links. All versions found are returned as an InstallationCandidate list. See _link_pa...
[ "def", "find_all_candidates", "(", "self", ",", "project_name", ")", ":", "# type: (str) -> List[Optional[InstallationCandidate]]", "index_locations", "=", "self", ".", "_get_index_urls_locations", "(", "project_name", ")", "index_file_loc", ",", "index_url_loc", "=", "self...
Find all available InstallationCandidate for project_name This checks index_urls and find_links. All versions found are returned as an InstallationCandidate list. See _link_package_versions for details on which files are accepted
[ "Find", "all", "available", "InstallationCandidate", "for", "project_name" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/index.py#L588-L656
train
pypa/pipenv
pipenv/patched/notpip/_internal/index.py
PackageFinder.find_requirement
def find_requirement(self, req, upgrade, ignore_compatibility=False): # type: (InstallRequirement, bool, bool) -> Optional[Link] """Try to find a Link matching req Expects req, an InstallRequirement and upgrade, a boolean Returns a Link if found, Raises DistributionNotFound or B...
python
def find_requirement(self, req, upgrade, ignore_compatibility=False): # type: (InstallRequirement, bool, bool) -> Optional[Link] """Try to find a Link matching req Expects req, an InstallRequirement and upgrade, a boolean Returns a Link if found, Raises DistributionNotFound or B...
[ "def", "find_requirement", "(", "self", ",", "req", ",", "upgrade", ",", "ignore_compatibility", "=", "False", ")", ":", "# type: (InstallRequirement, bool, bool) -> Optional[Link]", "all_candidates", "=", "self", ".", "find_all_candidates", "(", "req", ".", "name", "...
Try to find a Link matching req Expects req, an InstallRequirement and upgrade, a boolean Returns a Link if found, Raises DistributionNotFound or BestVersionAlreadyInstalled otherwise
[ "Try", "to", "find", "a", "Link", "matching", "req" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/index.py#L658-L756
train
pypa/pipenv
pipenv/patched/notpip/_internal/index.py
PackageFinder._get_pages
def _get_pages(self, locations, project_name): # type: (Iterable[Link], str) -> Iterable[HTMLPage] """ Yields (page, page_url) from the given locations, skipping locations that have errors. """ seen = set() # type: Set[Link] for location in locations: ...
python
def _get_pages(self, locations, project_name): # type: (Iterable[Link], str) -> Iterable[HTMLPage] """ Yields (page, page_url) from the given locations, skipping locations that have errors. """ seen = set() # type: Set[Link] for location in locations: ...
[ "def", "_get_pages", "(", "self", ",", "locations", ",", "project_name", ")", ":", "# type: (Iterable[Link], str) -> Iterable[HTMLPage]", "seen", "=", "set", "(", ")", "# type: Set[Link]", "for", "location", "in", "locations", ":", "if", "location", "in", "seen", ...
Yields (page, page_url) from the given locations, skipping locations that have errors.
[ "Yields", "(", "page", "page_url", ")", "from", "the", "given", "locations", "skipping", "locations", "that", "have", "errors", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/index.py#L758-L774
train
pypa/pipenv
pipenv/patched/notpip/_internal/index.py
PackageFinder._link_package_versions
def _link_package_versions(self, link, search, ignore_compatibility=True): # type: (Link, Search, bool) -> Optional[InstallationCandidate] """Return an InstallationCandidate or None""" version = None if link.egg_fragment: egg_info = link.egg_fragment ext = link.ex...
python
def _link_package_versions(self, link, search, ignore_compatibility=True): # type: (Link, Search, bool) -> Optional[InstallationCandidate] """Return an InstallationCandidate or None""" version = None if link.egg_fragment: egg_info = link.egg_fragment ext = link.ex...
[ "def", "_link_package_versions", "(", "self", ",", "link", ",", "search", ",", "ignore_compatibility", "=", "True", ")", ":", "# type: (Link, Search, bool) -> Optional[InstallationCandidate]", "version", "=", "None", "if", "link", ".", "egg_fragment", ":", "egg_info", ...
Return an InstallationCandidate or None
[ "Return", "an", "InstallationCandidate", "or", "None" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/index.py#L814-L893
train
pypa/pipenv
pipenv/patched/notpip/_internal/index.py
HTMLPage.iter_links
def iter_links(self): # type: () -> Iterable[Link] """Yields all links in the page""" document = html5lib.parse( self.content, transport_encoding=_get_encoding_from_headers(self.headers), namespaceHTMLElements=False, ) base_url = _determine_bas...
python
def iter_links(self): # type: () -> Iterable[Link] """Yields all links in the page""" document = html5lib.parse( self.content, transport_encoding=_get_encoding_from_headers(self.headers), namespaceHTMLElements=False, ) base_url = _determine_bas...
[ "def", "iter_links", "(", "self", ")", ":", "# type: () -> Iterable[Link]", "document", "=", "html5lib", ".", "parse", "(", "self", ".", "content", ",", "transport_encoding", "=", "_get_encoding_from_headers", "(", "self", ".", "headers", ")", ",", "namespaceHTMLE...
Yields all links in the page
[ "Yields", "all", "links", "in", "the", "page" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/index.py#L992-L1007
train
pypa/pipenv
pipenv/vendor/pexpect/run.py
run
def run(command, timeout=30, withexitstatus=False, events=None, extra_args=None, logfile=None, cwd=None, env=None, **kwargs): ''' This function runs the given command; waits for it to finish; then returns all output as a string. STDERR is included in output. If the full path to the command is n...
python
def run(command, timeout=30, withexitstatus=False, events=None, extra_args=None, logfile=None, cwd=None, env=None, **kwargs): ''' This function runs the given command; waits for it to finish; then returns all output as a string. STDERR is included in output. If the full path to the command is n...
[ "def", "run", "(", "command", ",", "timeout", "=", "30", ",", "withexitstatus", "=", "False", ",", "events", "=", "None", ",", "extra_args", "=", "None", ",", "logfile", "=", "None", ",", "cwd", "=", "None", ",", "env", "=", "None", ",", "*", "*", ...
This function runs the given command; waits for it to finish; then returns all output as a string. STDERR is included in output. If the full path to the command is not given then the path is searched. Note that lines are terminated by CR/LF (\\r\\n) combination even on UNIX-like systems because this is...
[ "This", "function", "runs", "the", "given", "command", ";", "waits", "for", "it", "to", "finish", ";", "then", "returns", "all", "output", "as", "a", "string", ".", "STDERR", "is", "included", "in", "output", ".", "If", "the", "full", "path", "to", "th...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/run.py#L7-L148
train
pypa/pipenv
pipenv/vendor/pexpect/run.py
runu
def runu(command, timeout=30, withexitstatus=False, events=None, extra_args=None, logfile=None, cwd=None, env=None, **kwargs): """Deprecated: pass encoding to run() instead. """ kwargs.setdefault('encoding', 'utf-8') return run(command, timeout=timeout, withexitstatus=withexitstatus, ...
python
def runu(command, timeout=30, withexitstatus=False, events=None, extra_args=None, logfile=None, cwd=None, env=None, **kwargs): """Deprecated: pass encoding to run() instead. """ kwargs.setdefault('encoding', 'utf-8') return run(command, timeout=timeout, withexitstatus=withexitstatus, ...
[ "def", "runu", "(", "command", ",", "timeout", "=", "30", ",", "withexitstatus", "=", "False", ",", "events", "=", "None", ",", "extra_args", "=", "None", ",", "logfile", "=", "None", ",", "cwd", "=", "None", ",", "env", "=", "None", ",", "*", "*",...
Deprecated: pass encoding to run() instead.
[ "Deprecated", ":", "pass", "encoding", "to", "run", "()", "instead", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/run.py#L150-L157
train
pypa/pipenv
pipenv/vendor/shellingham/posix/_default.py
get_process_mapping
def get_process_mapping(): """Try to look up the process tree via the output of `ps`. """ output = subprocess.check_output([ 'ps', '-ww', '-o', 'pid=', '-o', 'ppid=', '-o', 'args=', ]) if not isinstance(output, str): output = output.decode(sys.stdout.encoding) processes = {} ...
python
def get_process_mapping(): """Try to look up the process tree via the output of `ps`. """ output = subprocess.check_output([ 'ps', '-ww', '-o', 'pid=', '-o', 'ppid=', '-o', 'args=', ]) if not isinstance(output, str): output = output.decode(sys.stdout.encoding) processes = {} ...
[ "def", "get_process_mapping", "(", ")", ":", "output", "=", "subprocess", ".", "check_output", "(", "[", "'ps'", ",", "'-ww'", ",", "'-o'", ",", "'pid='", ",", "'-o'", ",", "'ppid='", ",", "'-o'", ",", "'args='", ",", "]", ")", "if", "not", "isinstance...
Try to look up the process tree via the output of `ps`.
[ "Try", "to", "look", "up", "the", "process", "tree", "via", "the", "output", "of", "ps", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/shellingham/posix/_default.py#L10-L27
train
pypa/pipenv
pipenv/vendor/requests/models.py
RequestEncodingMixin.path_url
def path_url(self): """Build the path URL to use.""" url = [] p = urlsplit(self.url) path = p.path if not path: path = '/' url.append(path) query = p.query if query: url.append('?') url.append(query) return...
python
def path_url(self): """Build the path URL to use.""" url = [] p = urlsplit(self.url) path = p.path if not path: path = '/' url.append(path) query = p.query if query: url.append('?') url.append(query) return...
[ "def", "path_url", "(", "self", ")", ":", "url", "=", "[", "]", "p", "=", "urlsplit", "(", "self", ".", "url", ")", "path", "=", "p", ".", "path", "if", "not", "path", ":", "path", "=", "'/'", "url", ".", "append", "(", "path", ")", "query", ...
Build the path URL to use.
[ "Build", "the", "path", "URL", "to", "use", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/models.py#L62-L80
train
pypa/pipenv
pipenv/vendor/requests/models.py
RequestEncodingMixin._encode_params
def _encode_params(data): """Encode parameters in a piece of data. Will successfully encode parameters when passed as a dict or a list of 2-tuples. Order is retained if data is a list of 2-tuples but arbitrary if parameters are supplied as a dict. """ if isinstance(data...
python
def _encode_params(data): """Encode parameters in a piece of data. Will successfully encode parameters when passed as a dict or a list of 2-tuples. Order is retained if data is a list of 2-tuples but arbitrary if parameters are supplied as a dict. """ if isinstance(data...
[ "def", "_encode_params", "(", "data", ")", ":", "if", "isinstance", "(", "data", ",", "(", "str", ",", "bytes", ")", ")", ":", "return", "data", "elif", "hasattr", "(", "data", ",", "'read'", ")", ":", "return", "data", "elif", "hasattr", "(", "data"...
Encode parameters in a piece of data. Will successfully encode parameters when passed as a dict or a list of 2-tuples. Order is retained if data is a list of 2-tuples but arbitrary if parameters are supplied as a dict.
[ "Encode", "parameters", "in", "a", "piece", "of", "data", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/models.py#L83-L107
train
pypa/pipenv
pipenv/vendor/requests/models.py
RequestEncodingMixin._encode_files
def _encode_files(files, data): """Build the body for a multipart/form-data request. Will successfully encode files when passed as a dict or a list of tuples. Order is retained if data is a list of tuples but arbitrary if parameters are supplied as a dict. The tuples may be 2-tu...
python
def _encode_files(files, data): """Build the body for a multipart/form-data request. Will successfully encode files when passed as a dict or a list of tuples. Order is retained if data is a list of tuples but arbitrary if parameters are supplied as a dict. The tuples may be 2-tu...
[ "def", "_encode_files", "(", "files", ",", "data", ")", ":", "if", "(", "not", "files", ")", ":", "raise", "ValueError", "(", "\"Files must be provided.\"", ")", "elif", "isinstance", "(", "data", ",", "basestring", ")", ":", "raise", "ValueError", "(", "\...
Build the body for a multipart/form-data request. Will successfully encode files when passed as a dict or a list of tuples. Order is retained if data is a list of tuples but arbitrary if parameters are supplied as a dict. The tuples may be 2-tuples (filename, fileobj), 3-tuples (filenam...
[ "Build", "the", "body", "for", "a", "multipart", "/", "form", "-", "data", "request", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/models.py#L110-L171
train
pypa/pipenv
pipenv/vendor/requests/models.py
RequestHooksMixin.register_hook
def register_hook(self, event, hook): """Properly register a hook.""" if event not in self.hooks: raise ValueError('Unsupported event specified, with event name "%s"' % (event)) if isinstance(hook, Callable): self.hooks[event].append(hook) elif hasattr(hook, '__...
python
def register_hook(self, event, hook): """Properly register a hook.""" if event not in self.hooks: raise ValueError('Unsupported event specified, with event name "%s"' % (event)) if isinstance(hook, Callable): self.hooks[event].append(hook) elif hasattr(hook, '__...
[ "def", "register_hook", "(", "self", ",", "event", ",", "hook", ")", ":", "if", "event", "not", "in", "self", ".", "hooks", ":", "raise", "ValueError", "(", "'Unsupported event specified, with event name \"%s\"'", "%", "(", "event", ")", ")", "if", "isinstance...
Properly register a hook.
[ "Properly", "register", "a", "hook", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/models.py#L175-L184
train
pypa/pipenv
pipenv/vendor/requests/models.py
RequestHooksMixin.deregister_hook
def deregister_hook(self, event, hook): """Deregister a previously registered hook. Returns True if the hook existed, False if not. """ try: self.hooks[event].remove(hook) return True except ValueError: return False
python
def deregister_hook(self, event, hook): """Deregister a previously registered hook. Returns True if the hook existed, False if not. """ try: self.hooks[event].remove(hook) return True except ValueError: return False
[ "def", "deregister_hook", "(", "self", ",", "event", ",", "hook", ")", ":", "try", ":", "self", ".", "hooks", "[", "event", "]", ".", "remove", "(", "hook", ")", "return", "True", "except", "ValueError", ":", "return", "False" ]
Deregister a previously registered hook. Returns True if the hook existed, False if not.
[ "Deregister", "a", "previously", "registered", "hook", ".", "Returns", "True", "if", "the", "hook", "existed", "False", "if", "not", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/models.py#L186-L195
train
pypa/pipenv
pipenv/vendor/requests/models.py
PreparedRequest.prepare
def prepare(self, method=None, url=None, headers=None, files=None, data=None, params=None, auth=None, cookies=None, hooks=None, json=None): """Prepares the entire request with the given parameters.""" self.prepare_method(method) self.prepare_url(url, params) self...
python
def prepare(self, method=None, url=None, headers=None, files=None, data=None, params=None, auth=None, cookies=None, hooks=None, json=None): """Prepares the entire request with the given parameters.""" self.prepare_method(method) self.prepare_url(url, params) self...
[ "def", "prepare", "(", "self", ",", "method", "=", "None", ",", "url", "=", "None", ",", "headers", "=", "None", ",", "files", "=", "None", ",", "data", "=", "None", ",", "params", "=", "None", ",", "auth", "=", "None", ",", "cookies", "=", "None...
Prepares the entire request with the given parameters.
[ "Prepares", "the", "entire", "request", "with", "the", "given", "parameters", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/models.py#L307-L323
train
pypa/pipenv
pipenv/vendor/requests/models.py
PreparedRequest.prepare_body
def prepare_body(self, data, files, json=None): """Prepares the given HTTP body data.""" # Check if file, fo, generator, iterator. # If not, run through normal process. # Nottin' on you. body = None content_type = None if not data and json is not None: ...
python
def prepare_body(self, data, files, json=None): """Prepares the given HTTP body data.""" # Check if file, fo, generator, iterator. # If not, run through normal process. # Nottin' on you. body = None content_type = None if not data and json is not None: ...
[ "def", "prepare_body", "(", "self", ",", "data", ",", "files", ",", "json", "=", "None", ")", ":", "# Check if file, fo, generator, iterator.", "# If not, run through normal process.", "# Nottin' on you.", "body", "=", "None", "content_type", "=", "None", "if", "not",...
Prepares the given HTTP body data.
[ "Prepares", "the", "given", "HTTP", "body", "data", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/models.py#L452-L519
train
pypa/pipenv
pipenv/vendor/requests/models.py
PreparedRequest.prepare_content_length
def prepare_content_length(self, body): """Prepare Content-Length header based on request method and body""" if body is not None: length = super_len(body) if length: # If length exists, set it. Otherwise, we fallback # to Transfer-Encoding: chunked...
python
def prepare_content_length(self, body): """Prepare Content-Length header based on request method and body""" if body is not None: length = super_len(body) if length: # If length exists, set it. Otherwise, we fallback # to Transfer-Encoding: chunked...
[ "def", "prepare_content_length", "(", "self", ",", "body", ")", ":", "if", "body", "is", "not", "None", ":", "length", "=", "super_len", "(", "body", ")", "if", "length", ":", "# If length exists, set it. Otherwise, we fallback", "# to Transfer-Encoding: chunked.", ...
Prepare Content-Length header based on request method and body
[ "Prepare", "Content", "-", "Length", "header", "based", "on", "request", "method", "and", "body" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/models.py#L521-L532
train
pypa/pipenv
pipenv/vendor/requests/models.py
PreparedRequest.prepare_auth
def prepare_auth(self, auth, url=''): """Prepares the given HTTP auth data.""" # If no Auth is explicitly provided, extract it from the URL first. if auth is None: url_auth = get_auth_from_url(self.url) auth = url_auth if any(url_auth) else None if auth: ...
python
def prepare_auth(self, auth, url=''): """Prepares the given HTTP auth data.""" # If no Auth is explicitly provided, extract it from the URL first. if auth is None: url_auth = get_auth_from_url(self.url) auth = url_auth if any(url_auth) else None if auth: ...
[ "def", "prepare_auth", "(", "self", ",", "auth", ",", "url", "=", "''", ")", ":", "# If no Auth is explicitly provided, extract it from the URL first.", "if", "auth", "is", "None", ":", "url_auth", "=", "get_auth_from_url", "(", "self", ".", "url", ")", "auth", ...
Prepares the given HTTP auth data.
[ "Prepares", "the", "given", "HTTP", "auth", "data", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/models.py#L534-L554
train
pypa/pipenv
pipenv/vendor/requests/models.py
PreparedRequest.prepare_cookies
def prepare_cookies(self, cookies): """Prepares the given HTTP cookie data. This function eventually generates a ``Cookie`` header from the given cookies using cookielib. Due to cookielib's design, the header will not be regenerated if it already exists, meaning this function ca...
python
def prepare_cookies(self, cookies): """Prepares the given HTTP cookie data. This function eventually generates a ``Cookie`` header from the given cookies using cookielib. Due to cookielib's design, the header will not be regenerated if it already exists, meaning this function ca...
[ "def", "prepare_cookies", "(", "self", ",", "cookies", ")", ":", "if", "isinstance", "(", "cookies", ",", "cookielib", ".", "CookieJar", ")", ":", "self", ".", "_cookies", "=", "cookies", "else", ":", "self", ".", "_cookies", "=", "cookiejar_from_dict", "(...
Prepares the given HTTP cookie data. This function eventually generates a ``Cookie`` header from the given cookies using cookielib. Due to cookielib's design, the header will not be regenerated if it already exists, meaning this function can only be called once for the life of the ...
[ "Prepares", "the", "given", "HTTP", "cookie", "data", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/models.py#L556-L574
train
pypa/pipenv
pipenv/vendor/requests/models.py
PreparedRequest.prepare_hooks
def prepare_hooks(self, hooks): """Prepares the given hooks.""" # hooks can be passed as None to the prepare method and to this # method. To prevent iterating over None, simply use an empty list # if hooks is False-y hooks = hooks or [] for event in hooks: sel...
python
def prepare_hooks(self, hooks): """Prepares the given hooks.""" # hooks can be passed as None to the prepare method and to this # method. To prevent iterating over None, simply use an empty list # if hooks is False-y hooks = hooks or [] for event in hooks: sel...
[ "def", "prepare_hooks", "(", "self", ",", "hooks", ")", ":", "# hooks can be passed as None to the prepare method and to this", "# method. To prevent iterating over None, simply use an empty list", "# if hooks is False-y", "hooks", "=", "hooks", "or", "[", "]", "for", "event", ...
Prepares the given hooks.
[ "Prepares", "the", "given", "hooks", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/models.py#L576-L583
train
pypa/pipenv
pipenv/vendor/requests/models.py
Response.is_permanent_redirect
def is_permanent_redirect(self): """True if this Response one of the permanent versions of redirect.""" return ('location' in self.headers and self.status_code in (codes.moved_permanently, codes.permanent_redirect))
python
def is_permanent_redirect(self): """True if this Response one of the permanent versions of redirect.""" return ('location' in self.headers and self.status_code in (codes.moved_permanently, codes.permanent_redirect))
[ "def", "is_permanent_redirect", "(", "self", ")", ":", "return", "(", "'location'", "in", "self", ".", "headers", "and", "self", ".", "status_code", "in", "(", "codes", ".", "moved_permanently", ",", "codes", ".", "permanent_redirect", ")", ")" ]
True if this Response one of the permanent versions of redirect.
[ "True", "if", "this", "Response", "one", "of", "the", "permanent", "versions", "of", "redirect", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/models.py#L715-L717
train
pypa/pipenv
pipenv/vendor/requests/models.py
Response.text
def text(self): """Content of the response, in unicode. If Response.encoding is None, encoding will be guessed using ``chardet``. The encoding of the response content is determined based solely on HTTP headers, following RFC 2616 to the letter. If you can take advantage of ...
python
def text(self): """Content of the response, in unicode. If Response.encoding is None, encoding will be guessed using ``chardet``. The encoding of the response content is determined based solely on HTTP headers, following RFC 2616 to the letter. If you can take advantage of ...
[ "def", "text", "(", "self", ")", ":", "# Try charset from content-type", "content", "=", "None", "encoding", "=", "self", ".", "encoding", "if", "not", "self", ".", "content", ":", "return", "str", "(", "''", ")", "# Fallback to auto-detected encoding.", "if", ...
Content of the response, in unicode. If Response.encoding is None, encoding will be guessed using ``chardet``. The encoding of the response content is determined based solely on HTTP headers, following RFC 2616 to the letter. If you can take advantage of non-HTTP knowledge to m...
[ "Content", "of", "the", "response", "in", "unicode", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/models.py#L836-L871
train
pypa/pipenv
pipenv/vendor/requests/models.py
Response.raise_for_status
def raise_for_status(self): """Raises stored :class:`HTTPError`, if one occurred.""" http_error_msg = '' if isinstance(self.reason, bytes): # We attempt to decode utf-8 first because some servers # choose to localize their reason strings. If the string # isn'...
python
def raise_for_status(self): """Raises stored :class:`HTTPError`, if one occurred.""" http_error_msg = '' if isinstance(self.reason, bytes): # We attempt to decode utf-8 first because some servers # choose to localize their reason strings. If the string # isn'...
[ "def", "raise_for_status", "(", "self", ")", ":", "http_error_msg", "=", "''", "if", "isinstance", "(", "self", ".", "reason", ",", "bytes", ")", ":", "# We attempt to decode utf-8 first because some servers", "# choose to localize their reason strings. If the string", "# i...
Raises stored :class:`HTTPError`, if one occurred.
[ "Raises", "stored", ":", "class", ":", "HTTPError", "if", "one", "occurred", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/models.py#L917-L940
train
pypa/pipenv
pipenv/vendor/requests/models.py
Response.close
def close(self): """Releases the connection back to the pool. Once this method has been called the underlying ``raw`` object must not be accessed again. *Note: Should not normally need to be called explicitly.* """ if not self._content_consumed: self.raw.close() ...
python
def close(self): """Releases the connection back to the pool. Once this method has been called the underlying ``raw`` object must not be accessed again. *Note: Should not normally need to be called explicitly.* """ if not self._content_consumed: self.raw.close() ...
[ "def", "close", "(", "self", ")", ":", "if", "not", "self", ".", "_content_consumed", ":", "self", ".", "raw", ".", "close", "(", ")", "release_conn", "=", "getattr", "(", "self", ".", "raw", ",", "'release_conn'", ",", "None", ")", "if", "release_conn...
Releases the connection back to the pool. Once this method has been called the underlying ``raw`` object must not be accessed again. *Note: Should not normally need to be called explicitly.*
[ "Releases", "the", "connection", "back", "to", "the", "pool", ".", "Once", "this", "method", "has", "been", "called", "the", "underlying", "raw", "object", "must", "not", "be", "accessed", "again", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/models.py#L942-L953
train
pypa/pipenv
pipenv/patched/notpip/_internal/commands/install.py
create_env_error_message
def create_env_error_message(error, show_traceback, using_user_site): """Format an error message for an EnvironmentError It may occur anytime during the execution of the install command. """ parts = [] # Mention the error if we are not going to show a traceback parts.append("Could not install ...
python
def create_env_error_message(error, show_traceback, using_user_site): """Format an error message for an EnvironmentError It may occur anytime during the execution of the install command. """ parts = [] # Mention the error if we are not going to show a traceback parts.append("Could not install ...
[ "def", "create_env_error_message", "(", "error", ",", "show_traceback", ",", "using_user_site", ")", ":", "parts", "=", "[", "]", "# Mention the error if we are not going to show a traceback", "parts", ".", "append", "(", "\"Could not install packages due to an EnvironmentError...
Format an error message for an EnvironmentError It may occur anytime during the execution of the install command.
[ "Format", "an", "error", "message", "for", "an", "EnvironmentError" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/commands/install.py#L533-L566
train
pypa/pipenv
pipenv/vendor/urllib3/connectionpool.py
_ipv6_host
def _ipv6_host(host, scheme): """ Process IPv6 address literals """ # httplib doesn't like it when we include brackets in IPv6 addresses # Specifically, if we include brackets but also pass the port then # httplib crazily doubles up the square brackets on the Host header. # Instead, we need...
python
def _ipv6_host(host, scheme): """ Process IPv6 address literals """ # httplib doesn't like it when we include brackets in IPv6 addresses # Specifically, if we include brackets but also pass the port then # httplib crazily doubles up the square brackets on the Host header. # Instead, we need...
[ "def", "_ipv6_host", "(", "host", ",", "scheme", ")", ":", "# httplib doesn't like it when we include brackets in IPv6 addresses", "# Specifically, if we include brackets but also pass the port then", "# httplib crazily doubles up the square brackets on the Host header.", "# Instead, we need t...
Process IPv6 address literals
[ "Process", "IPv6", "address", "literals" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/connectionpool.py#L878-L896
train
pypa/pipenv
pipenv/vendor/urllib3/connectionpool.py
HTTPConnectionPool._get_conn
def _get_conn(self, timeout=None): """ Get a connection. Will return a pooled connection if one is available. If no connections are available and :prop:`.block` is ``False``, then a fresh connection is returned. :param timeout: Seconds to wait before giving up and r...
python
def _get_conn(self, timeout=None): """ Get a connection. Will return a pooled connection if one is available. If no connections are available and :prop:`.block` is ``False``, then a fresh connection is returned. :param timeout: Seconds to wait before giving up and r...
[ "def", "_get_conn", "(", "self", ",", "timeout", "=", "None", ")", ":", "conn", "=", "None", "try", ":", "conn", "=", "self", ".", "pool", ".", "get", "(", "block", "=", "self", ".", "block", ",", "timeout", "=", "timeout", ")", "except", "Attribut...
Get a connection. Will return a pooled connection if one is available. If no connections are available and :prop:`.block` is ``False``, then a fresh connection is returned. :param timeout: Seconds to wait before giving up and raising :class:`urllib3.exceptions.EmptyPool...
[ "Get", "a", "connection", ".", "Will", "return", "a", "pooled", "connection", "if", "one", "is", "available", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/connectionpool.py#L212-L248
train
pypa/pipenv
pipenv/vendor/urllib3/connectionpool.py
HTTPConnectionPool._get_timeout
def _get_timeout(self, timeout): """ Helper that always returns a :class:`urllib3.util.Timeout` """ if timeout is _Default: return self.timeout.clone() if isinstance(timeout, Timeout): return timeout.clone() else: # User passed us an int/float. This i...
python
def _get_timeout(self, timeout): """ Helper that always returns a :class:`urllib3.util.Timeout` """ if timeout is _Default: return self.timeout.clone() if isinstance(timeout, Timeout): return timeout.clone() else: # User passed us an int/float. This i...
[ "def", "_get_timeout", "(", "self", ",", "timeout", ")", ":", "if", "timeout", "is", "_Default", ":", "return", "self", ".", "timeout", ".", "clone", "(", ")", "if", "isinstance", "(", "timeout", ",", "Timeout", ")", ":", "return", "timeout", ".", "clo...
Helper that always returns a :class:`urllib3.util.Timeout`
[ "Helper", "that", "always", "returns", "a", ":", "class", ":", "urllib3", ".", "util", ".", "Timeout" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/connectionpool.py#L290-L300
train
pypa/pipenv
pipenv/vendor/urllib3/connectionpool.py
HTTPConnectionPool._raise_timeout
def _raise_timeout(self, err, url, timeout_value): """Is the error actually a timeout? Will raise a ReadTimeout or pass""" if isinstance(err, SocketTimeout): raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value) # See the above comment about EAGAIN ...
python
def _raise_timeout(self, err, url, timeout_value): """Is the error actually a timeout? Will raise a ReadTimeout or pass""" if isinstance(err, SocketTimeout): raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value) # See the above comment about EAGAIN ...
[ "def", "_raise_timeout", "(", "self", ",", "err", ",", "url", ",", "timeout_value", ")", ":", "if", "isinstance", "(", "err", ",", "SocketTimeout", ")", ":", "raise", "ReadTimeoutError", "(", "self", ",", "url", ",", "\"Read timed out. (read timeout=%s)\"", "%...
Is the error actually a timeout? Will raise a ReadTimeout or pass
[ "Is", "the", "error", "actually", "a", "timeout?", "Will", "raise", "a", "ReadTimeout", "or", "pass" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/connectionpool.py#L302-L317
train
pypa/pipenv
pipenv/vendor/urllib3/connectionpool.py
HTTPConnectionPool.urlopen
def urlopen(self, method, url, body=None, headers=None, retries=None, redirect=True, assert_same_host=True, timeout=_Default, pool_timeout=None, release_conn=None, chunked=False, body_pos=None, **response_kw): """ Get a connection from the pool and perform...
python
def urlopen(self, method, url, body=None, headers=None, retries=None, redirect=True, assert_same_host=True, timeout=_Default, pool_timeout=None, release_conn=None, chunked=False, body_pos=None, **response_kw): """ Get a connection from the pool and perform...
[ "def", "urlopen", "(", "self", ",", "method", ",", "url", ",", "body", "=", "None", ",", "headers", "=", "None", ",", "retries", "=", "None", ",", "redirect", "=", "True", ",", "assert_same_host", "=", "True", ",", "timeout", "=", "_Default", ",", "p...
Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method provided by :class:`.RequestMethods`, such ...
[ "Get", "a", "connection", "from", "the", "pool", "and", "perform", "an", "HTTP", "request", ".", "This", "is", "the", "lowest", "level", "call", "for", "making", "a", "request", "so", "you", "ll", "need", "to", "specify", "all", "the", "raw", "details", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/connectionpool.py#L446-L733
train
pypa/pipenv
pipenv/vendor/urllib3/connectionpool.py
HTTPSConnectionPool._prepare_conn
def _prepare_conn(self, conn): """ Prepare the ``connection`` for :meth:`urllib3.util.ssl_wrap_socket` and establish the tunnel if proxy is used. """ if isinstance(conn, VerifiedHTTPSConnection): conn.set_cert(key_file=self.key_file, cert_fi...
python
def _prepare_conn(self, conn): """ Prepare the ``connection`` for :meth:`urllib3.util.ssl_wrap_socket` and establish the tunnel if proxy is used. """ if isinstance(conn, VerifiedHTTPSConnection): conn.set_cert(key_file=self.key_file, cert_fi...
[ "def", "_prepare_conn", "(", "self", ",", "conn", ")", ":", "if", "isinstance", "(", "conn", ",", "VerifiedHTTPSConnection", ")", ":", "conn", ".", "set_cert", "(", "key_file", "=", "self", ".", "key_file", ",", "cert_file", "=", "self", ".", "cert_file", ...
Prepare the ``connection`` for :meth:`urllib3.util.ssl_wrap_socket` and establish the tunnel if proxy is used.
[ "Prepare", "the", "connection", "for", ":", "meth", ":", "urllib3", ".", "util", ".", "ssl_wrap_socket", "and", "establish", "the", "tunnel", "if", "proxy", "is", "used", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/connectionpool.py#L782-L797
train
pypa/pipenv
pipenv/vendor/urllib3/connectionpool.py
HTTPSConnectionPool._prepare_proxy
def _prepare_proxy(self, conn): """ Establish tunnel connection early, because otherwise httplib would improperly set Host: header to proxy's IP:port. """ conn.set_tunnel(self._proxy_host, self.port, self.proxy_headers) conn.connect()
python
def _prepare_proxy(self, conn): """ Establish tunnel connection early, because otherwise httplib would improperly set Host: header to proxy's IP:port. """ conn.set_tunnel(self._proxy_host, self.port, self.proxy_headers) conn.connect()
[ "def", "_prepare_proxy", "(", "self", ",", "conn", ")", ":", "conn", ".", "set_tunnel", "(", "self", ".", "_proxy_host", ",", "self", ".", "port", ",", "self", ".", "proxy_headers", ")", "conn", ".", "connect", "(", ")" ]
Establish tunnel connection early, because otherwise httplib would improperly set Host: header to proxy's IP:port.
[ "Establish", "tunnel", "connection", "early", "because", "otherwise", "httplib", "would", "improperly", "set", "Host", ":", "header", "to", "proxy", "s", "IP", ":", "port", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/connectionpool.py#L799-L805
train
pypa/pipenv
pipenv/vendor/pythonfinder/pythonfinder.py
Finder.reload_system_path
def reload_system_path(self): # type: () -> None """ Rebuilds the base system path and all of the contained finders within it. This will re-apply any changes to the environment or any version changes on the system. """ if self._system_path is not None: self....
python
def reload_system_path(self): # type: () -> None """ Rebuilds the base system path and all of the contained finders within it. This will re-apply any changes to the environment or any version changes on the system. """ if self._system_path is not None: self....
[ "def", "reload_system_path", "(", "self", ")", ":", "# type: () -> None", "if", "self", ".", "_system_path", "is", "not", "None", ":", "self", ".", "_system_path", ".", "clear_caches", "(", ")", "self", ".", "_system_path", "=", "None", "six", ".", "moves", ...
Rebuilds the base system path and all of the contained finders within it. This will re-apply any changes to the environment or any version changes on the system.
[ "Rebuilds", "the", "base", "system", "path", "and", "all", "of", "the", "contained", "finders", "within", "it", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pythonfinder/pythonfinder.py#L78-L90
train
pypa/pipenv
pipenv/vendor/pythonfinder/pythonfinder.py
Finder.find_python_version
def find_python_version( self, major=None, minor=None, patch=None, pre=None, dev=None, arch=None, name=None ): # type: (Optional[Union[str, int]], Optional[int], Optional[int], Optional[bool], Optional[bool], Optional[str], Optional[str]) -> PathEntry """ Find the python version whic...
python
def find_python_version( self, major=None, minor=None, patch=None, pre=None, dev=None, arch=None, name=None ): # type: (Optional[Union[str, int]], Optional[int], Optional[int], Optional[bool], Optional[bool], Optional[str], Optional[str]) -> PathEntry """ Find the python version whic...
[ "def", "find_python_version", "(", "self", ",", "major", "=", "None", ",", "minor", "=", "None", ",", "patch", "=", "None", ",", "pre", "=", "None", ",", "dev", "=", "None", ",", "arch", "=", "None", ",", "name", "=", "None", ")", ":", "# type: (Op...
Find the python version which corresponds most closely to the version requested. :param Union[str, int] major: The major version to look for, or the full version, or the name of the target version. :param Optional[int] minor: The minor version. If provided, disables string-based lookups from the major ...
[ "Find", "the", "python", "version", "which", "corresponds", "most", "closely", "to", "the", "version", "requested", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pythonfinder/pythonfinder.py#L122-L223
train
pypa/pipenv
pipenv/vendor/shellingham/posix.py
get_shell
def get_shell(pid=None, max_depth=6): """Get the shell that the supplied pid or os.getpid() is running in. """ pid = str(pid or os.getpid()) mapping = _get_process_mapping() login_shell = os.environ.get('SHELL', '') for _ in range(max_depth): try: proc = mapping[pid] ...
python
def get_shell(pid=None, max_depth=6): """Get the shell that the supplied pid or os.getpid() is running in. """ pid = str(pid or os.getpid()) mapping = _get_process_mapping() login_shell = os.environ.get('SHELL', '') for _ in range(max_depth): try: proc = mapping[pid] ...
[ "def", "get_shell", "(", "pid", "=", "None", ",", "max_depth", "=", "6", ")", ":", "pid", "=", "str", "(", "pid", "or", "os", ".", "getpid", "(", ")", ")", "mapping", "=", "_get_process_mapping", "(", ")", "login_shell", "=", "os", ".", "environ", ...
Get the shell that the supplied pid or os.getpid() is running in.
[ "Get", "the", "shell", "that", "the", "supplied", "pid", "or", "os", ".", "getpid", "()", "is", "running", "in", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/shellingham/posix.py#L33-L56
train
pypa/pipenv
pipenv/vendor/backports/enum/__init__.py
_make_class_unpicklable
def _make_class_unpicklable(cls): """Make the given class un-picklable.""" def _break_on_call_reduce(self, protocol=None): raise TypeError('%r cannot be pickled' % self) cls.__reduce_ex__ = _break_on_call_reduce cls.__module__ = '<unknown>'
python
def _make_class_unpicklable(cls): """Make the given class un-picklable.""" def _break_on_call_reduce(self, protocol=None): raise TypeError('%r cannot be pickled' % self) cls.__reduce_ex__ = _break_on_call_reduce cls.__module__ = '<unknown>'
[ "def", "_make_class_unpicklable", "(", "cls", ")", ":", "def", "_break_on_call_reduce", "(", "self", ",", "protocol", "=", "None", ")", ":", "raise", "TypeError", "(", "'%r cannot be pickled'", "%", "self", ")", "cls", ".", "__reduce_ex__", "=", "_break_on_call_...
Make the given class un-picklable.
[ "Make", "the", "given", "class", "un", "-", "picklable", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/backports/enum/__init__.py#L86-L91
train
pypa/pipenv
pipenv/vendor/backports/enum/__init__.py
_convert
def _convert(cls, name, module, filter, source=None): """ Create a new Enum subclass that replaces a collection of global constants """ # convert all constants from source (or module) that pass filter() to # a new Enum called name, and export the enum and its members back to # module; # also...
python
def _convert(cls, name, module, filter, source=None): """ Create a new Enum subclass that replaces a collection of global constants """ # convert all constants from source (or module) that pass filter() to # a new Enum called name, and export the enum and its members back to # module; # also...
[ "def", "_convert", "(", "cls", ",", "name", ",", "module", ",", "filter", ",", "source", "=", "None", ")", ":", "# convert all constants from source (or module) that pass filter() to", "# a new Enum called name, and export the enum and its members back to", "# module;", "# also...
Create a new Enum subclass that replaces a collection of global constants
[ "Create", "a", "new", "Enum", "subclass", "that", "replaces", "a", "collection", "of", "global", "constants" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/backports/enum/__init__.py#L789-L808
train
pypa/pipenv
pipenv/vendor/backports/enum/__init__.py
unique
def unique(enumeration): """Class decorator that ensures only unique members exist in an enumeration.""" duplicates = [] for name, member in enumeration.__members__.items(): if name != member.name: duplicates.append((name, member.name)) if duplicates: duplicate_names = ', '.j...
python
def unique(enumeration): """Class decorator that ensures only unique members exist in an enumeration.""" duplicates = [] for name, member in enumeration.__members__.items(): if name != member.name: duplicates.append((name, member.name)) if duplicates: duplicate_names = ', '.j...
[ "def", "unique", "(", "enumeration", ")", ":", "duplicates", "=", "[", "]", "for", "name", ",", "member", "in", "enumeration", ".", "__members__", ".", "items", "(", ")", ":", "if", "name", "!=", "member", ".", "name", ":", "duplicates", ".", "append",...
Class decorator that ensures only unique members exist in an enumeration.
[ "Class", "decorator", "that", "ensures", "only", "unique", "members", "exist", "in", "an", "enumeration", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/backports/enum/__init__.py#L824-L837
train
pypa/pipenv
pipenv/vendor/backports/enum/__init__.py
EnumMeta._create_
def _create_(cls, class_name, names=None, module=None, type=None, start=1): """Convenience method to create a new Enum class. `names` can be: * A string containing member names, separated either with spaces or commas. Values are auto-numbered from 1. * An iterable of member ...
python
def _create_(cls, class_name, names=None, module=None, type=None, start=1): """Convenience method to create a new Enum class. `names` can be: * A string containing member names, separated either with spaces or commas. Values are auto-numbered from 1. * An iterable of member ...
[ "def", "_create_", "(", "cls", ",", "class_name", ",", "names", "=", "None", ",", "module", "=", "None", ",", "type", "=", "None", ",", "start", "=", "1", ")", ":", "if", "pyver", "<", "3.0", ":", "# if class_name is unicode, attempt a conversion to ASCII", ...
Convenience method to create a new Enum class. `names` can be: * A string containing member names, separated either with spaces or commas. Values are auto-numbered from 1. * An iterable of member names. Values are auto-numbered from 1. * An iterable of (member name, value) ...
[ "Convenience", "method", "to", "create", "a", "new", "Enum", "class", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/backports/enum/__init__.py#L422-L481
train
pypa/pipenv
pipenv/vendor/backports/enum/__init__.py
EnumMeta._get_mixins_
def _get_mixins_(bases): """Returns the type for creating enum members, and the first inherited enum class. bases: the tuple of bases that was given to __new__ """ if not bases or Enum is None: return object, Enum # double check that we are not subclassing...
python
def _get_mixins_(bases): """Returns the type for creating enum members, and the first inherited enum class. bases: the tuple of bases that was given to __new__ """ if not bases or Enum is None: return object, Enum # double check that we are not subclassing...
[ "def", "_get_mixins_", "(", "bases", ")", ":", "if", "not", "bases", "or", "Enum", "is", "None", ":", "return", "object", ",", "Enum", "# double check that we are not subclassing a class with existing", "# enumeration members; while we're at it, see if any other data", "# typ...
Returns the type for creating enum members, and the first inherited enum class. bases: the tuple of bases that was given to __new__
[ "Returns", "the", "type", "for", "creating", "enum", "members", "and", "the", "first", "inherited", "enum", "class", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/backports/enum/__init__.py#L484-L527
train