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/vendor/ptyprocess/ptyprocess.py | PtyProcess.close | def close(self, force=True):
'''This closes the connection with the child application. Note that
calling close() more than once is valid. This emulates standard Python
behavior with files. Set force to True if you want to make sure that
the child is terminated (SIGKILL is sent if the chi... | python | def close(self, force=True):
'''This closes the connection with the child application. Note that
calling close() more than once is valid. This emulates standard Python
behavior with files. Set force to True if you want to make sure that
the child is terminated (SIGKILL is sent if the chi... | [
"def",
"close",
"(",
"self",
",",
"force",
"=",
"True",
")",
":",
"if",
"not",
"self",
".",
"closed",
":",
"self",
".",
"flush",
"(",
")",
"self",
".",
"fileobj",
".",
"close",
"(",
")",
"# Closes the file descriptor",
"# Give kernel time to update process s... | This closes the connection with the child application. Note that
calling close() more than once is valid. This emulates standard Python
behavior with files. Set force to True if you want to make sure that
the child is terminated (SIGKILL is sent if the child ignores SIGHUP
and SIGINT). | [
"This",
"closes",
"the",
"connection",
"with",
"the",
"child",
"application",
".",
"Note",
"that",
"calling",
"close",
"()",
"more",
"than",
"once",
"is",
"valid",
".",
"This",
"emulates",
"standard",
"Python",
"behavior",
"with",
"files",
".",
"Set",
"force... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/ptyprocess/ptyprocess.py#L387-L402 | train |
pypa/pipenv | pipenv/vendor/ptyprocess/ptyprocess.py | PtyProcess.getecho | def getecho(self):
'''This returns the terminal echo mode. This returns True if echo is
on or False if echo is off. Child applications that are expecting you
to enter a password often set ECHO False. See waitnoecho().
Not supported on platforms where ``isatty()`` returns False. '''
... | python | def getecho(self):
'''This returns the terminal echo mode. This returns True if echo is
on or False if echo is off. Child applications that are expecting you
to enter a password often set ECHO False. See waitnoecho().
Not supported on platforms where ``isatty()`` returns False. '''
... | [
"def",
"getecho",
"(",
"self",
")",
":",
"try",
":",
"attr",
"=",
"termios",
".",
"tcgetattr",
"(",
"self",
".",
"fd",
")",
"except",
"termios",
".",
"error",
"as",
"err",
":",
"errmsg",
"=",
"'getecho() may not be called on this platform'",
"if",
"err",
"... | This returns the terminal echo mode. This returns True if echo is
on or False if echo is off. Child applications that are expecting you
to enter a password often set ECHO False. See waitnoecho().
Not supported on platforms where ``isatty()`` returns False. | [
"This",
"returns",
"the",
"terminal",
"echo",
"mode",
".",
"This",
"returns",
"True",
"if",
"echo",
"is",
"on",
"or",
"False",
"if",
"echo",
"is",
"off",
".",
"Child",
"applications",
"that",
"are",
"expecting",
"you",
"to",
"enter",
"a",
"password",
"of... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/ptyprocess/ptyprocess.py#L449-L465 | train |
pypa/pipenv | pipenv/vendor/ptyprocess/ptyprocess.py | PtyProcess.setecho | def setecho(self, state):
'''This sets the terminal echo mode on or off. Note that anything the
child sent before the echo will be lost, so you should be sure that
your input buffer is empty before you call setecho(). For example, the
following will work as expected::
p = pe... | python | def setecho(self, state):
'''This sets the terminal echo mode on or off. Note that anything the
child sent before the echo will be lost, so you should be sure that
your input buffer is empty before you call setecho(). For example, the
following will work as expected::
p = pe... | [
"def",
"setecho",
"(",
"self",
",",
"state",
")",
":",
"_setecho",
"(",
"self",
".",
"fd",
",",
"state",
")",
"self",
".",
"echo",
"=",
"state"
] | This sets the terminal echo mode on or off. Note that anything the
child sent before the echo will be lost, so you should be sure that
your input buffer is empty before you call setecho(). For example, the
following will work as expected::
p = pexpect.spawn('cat') # Echo is on by de... | [
"This",
"sets",
"the",
"terminal",
"echo",
"mode",
"on",
"or",
"off",
".",
"Note",
"that",
"anything",
"the",
"child",
"sent",
"before",
"the",
"echo",
"will",
"be",
"lost",
"so",
"you",
"should",
"be",
"sure",
"that",
"your",
"input",
"buffer",
"is",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/ptyprocess/ptyprocess.py#L467-L501 | train |
pypa/pipenv | pipenv/vendor/ptyprocess/ptyprocess.py | PtyProcess.read | def read(self, size=1024):
"""Read and return at most ``size`` bytes from the pty.
Can block if there is nothing to read. Raises :exc:`EOFError` if the
terminal was closed.
Unlike Pexpect's ``read_nonblocking`` method, this doesn't try to deal
with the vagaries of EOF o... | python | def read(self, size=1024):
"""Read and return at most ``size`` bytes from the pty.
Can block if there is nothing to read. Raises :exc:`EOFError` if the
terminal was closed.
Unlike Pexpect's ``read_nonblocking`` method, this doesn't try to deal
with the vagaries of EOF o... | [
"def",
"read",
"(",
"self",
",",
"size",
"=",
"1024",
")",
":",
"try",
":",
"s",
"=",
"self",
".",
"fileobj",
".",
"read1",
"(",
"size",
")",
"except",
"(",
"OSError",
",",
"IOError",
")",
"as",
"err",
":",
"if",
"err",
".",
"args",
"[",
"0",
... | Read and return at most ``size`` bytes from the pty.
Can block if there is nothing to read. Raises :exc:`EOFError` if the
terminal was closed.
Unlike Pexpect's ``read_nonblocking`` method, this doesn't try to deal
with the vagaries of EOF on platforms that do strange things, li... | [
"Read",
"and",
"return",
"at",
"most",
"size",
"bytes",
"from",
"the",
"pty",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/ptyprocess/ptyprocess.py#L503-L528 | train |
pypa/pipenv | pipenv/vendor/ptyprocess/ptyprocess.py | PtyProcess.readline | def readline(self):
"""Read one line from the pseudoterminal, and return it as unicode.
Can block if there is nothing to read. Raises :exc:`EOFError` if the
terminal was closed.
"""
try:
s = self.fileobj.readline()
except (OSError, IOError) as err:
... | python | def readline(self):
"""Read one line from the pseudoterminal, and return it as unicode.
Can block if there is nothing to read. Raises :exc:`EOFError` if the
terminal was closed.
"""
try:
s = self.fileobj.readline()
except (OSError, IOError) as err:
... | [
"def",
"readline",
"(",
"self",
")",
":",
"try",
":",
"s",
"=",
"self",
".",
"fileobj",
".",
"readline",
"(",
")",
"except",
"(",
"OSError",
",",
"IOError",
")",
"as",
"err",
":",
"if",
"err",
".",
"args",
"[",
"0",
"]",
"==",
"errno",
".",
"EI... | Read one line from the pseudoterminal, and return it as unicode.
Can block if there is nothing to read. Raises :exc:`EOFError` if the
terminal was closed. | [
"Read",
"one",
"line",
"from",
"the",
"pseudoterminal",
"and",
"return",
"it",
"as",
"unicode",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/ptyprocess/ptyprocess.py#L530-L549 | train |
pypa/pipenv | pipenv/vendor/ptyprocess/ptyprocess.py | PtyProcess.write | def write(self, s, flush=True):
"""Write bytes to the pseudoterminal.
Returns the number of bytes written.
"""
return self._writeb(s, flush=flush) | python | def write(self, s, flush=True):
"""Write bytes to the pseudoterminal.
Returns the number of bytes written.
"""
return self._writeb(s, flush=flush) | [
"def",
"write",
"(",
"self",
",",
"s",
",",
"flush",
"=",
"True",
")",
":",
"return",
"self",
".",
"_writeb",
"(",
"s",
",",
"flush",
"=",
"flush",
")"
] | Write bytes to the pseudoterminal.
Returns the number of bytes written. | [
"Write",
"bytes",
"to",
"the",
"pseudoterminal",
".",
"Returns",
"the",
"number",
"of",
"bytes",
"written",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/ptyprocess/ptyprocess.py#L557-L562 | train |
pypa/pipenv | pipenv/vendor/ptyprocess/ptyprocess.py | PtyProcess.sendcontrol | def sendcontrol(self, char):
'''Helper method that wraps send() with mnemonic access for sending control
character to the child (such as Ctrl-C or Ctrl-D). For example, to send
Ctrl-G (ASCII 7, bell, '\a')::
child.sendcontrol('g')
See also, sendintr() and sendeof().
... | python | def sendcontrol(self, char):
'''Helper method that wraps send() with mnemonic access for sending control
character to the child (such as Ctrl-C or Ctrl-D). For example, to send
Ctrl-G (ASCII 7, bell, '\a')::
child.sendcontrol('g')
See also, sendintr() and sendeof().
... | [
"def",
"sendcontrol",
"(",
"self",
",",
"char",
")",
":",
"char",
"=",
"char",
".",
"lower",
"(",
")",
"a",
"=",
"ord",
"(",
"char",
")",
"if",
"97",
"<=",
"a",
"<=",
"122",
":",
"a",
"=",
"a",
"-",
"ord",
"(",
"'a'",
")",
"+",
"1",
"byte",... | Helper method that wraps send() with mnemonic access for sending control
character to the child (such as Ctrl-C or Ctrl-D). For example, to send
Ctrl-G (ASCII 7, bell, '\a')::
child.sendcontrol('g')
See also, sendintr() and sendeof(). | [
"Helper",
"method",
"that",
"wraps",
"send",
"()",
"with",
"mnemonic",
"access",
"for",
"sending",
"control",
"character",
"to",
"the",
"child",
"(",
"such",
"as",
"Ctrl",
"-",
"C",
"or",
"Ctrl",
"-",
"D",
")",
".",
"For",
"example",
"to",
"send",
"Ctr... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/ptyprocess/ptyprocess.py#L564-L590 | train |
pypa/pipenv | pipenv/vendor/ptyprocess/ptyprocess.py | PtyProcess.terminate | def terminate(self, force=False):
'''This forces a child process to terminate. It starts nicely with
SIGHUP and SIGINT. If "force" is True then moves onto SIGKILL. This
returns True if the child was terminated. This returns False if the
child could not be terminated. '''
if not ... | python | def terminate(self, force=False):
'''This forces a child process to terminate. It starts nicely with
SIGHUP and SIGINT. If "force" is True then moves onto SIGKILL. This
returns True if the child was terminated. This returns False if the
child could not be terminated. '''
if not ... | [
"def",
"terminate",
"(",
"self",
",",
"force",
"=",
"False",
")",
":",
"if",
"not",
"self",
".",
"isalive",
"(",
")",
":",
"return",
"True",
"try",
":",
"self",
".",
"kill",
"(",
"signal",
".",
"SIGHUP",
")",
"time",
".",
"sleep",
"(",
"self",
".... | This forces a child process to terminate. It starts nicely with
SIGHUP and SIGINT. If "force" is True then moves onto SIGKILL. This
returns True if the child was terminated. This returns False if the
child could not be terminated. | [
"This",
"forces",
"a",
"child",
"process",
"to",
"terminate",
".",
"It",
"starts",
"nicely",
"with",
"SIGHUP",
"and",
"SIGINT",
".",
"If",
"force",
"is",
"True",
"then",
"moves",
"onto",
"SIGKILL",
".",
"This",
"returns",
"True",
"if",
"the",
"child",
"w... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/ptyprocess/ptyprocess.py#L616-L654 | train |
pypa/pipenv | pipenv/vendor/ptyprocess/ptyprocess.py | PtyProcess.wait | def wait(self):
'''This waits until the child exits. This is a blocking call. This will
not read any data from the child, so this will block forever if the
child has unread output and has terminated. In other words, the child
may have printed output then called exit(), but, the child is
... | python | def wait(self):
'''This waits until the child exits. This is a blocking call. This will
not read any data from the child, so this will block forever if the
child has unread output and has terminated. In other words, the child
may have printed output then called exit(), but, the child is
... | [
"def",
"wait",
"(",
"self",
")",
":",
"if",
"self",
".",
"isalive",
"(",
")",
":",
"pid",
",",
"status",
"=",
"os",
".",
"waitpid",
"(",
"self",
".",
"pid",
",",
"0",
")",
"else",
":",
"return",
"self",
".",
"exitstatus",
"self",
".",
"exitstatus... | This waits until the child exits. This is a blocking call. This will
not read any data from the child, so this will block forever if the
child has unread output and has terminated. In other words, the child
may have printed output then called exit(), but, the child is
technically still a... | [
"This",
"waits",
"until",
"the",
"child",
"exits",
".",
"This",
"is",
"a",
"blocking",
"call",
".",
"This",
"will",
"not",
"read",
"any",
"data",
"from",
"the",
"child",
"so",
"this",
"will",
"block",
"forever",
"if",
"the",
"child",
"has",
"unread",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/ptyprocess/ptyprocess.py#L656-L683 | train |
pypa/pipenv | pipenv/vendor/ptyprocess/ptyprocess.py | PtyProcess.isalive | def isalive(self):
'''This tests if the child process is running or not. This is
non-blocking. If the child was terminated then this will read the
exitstatus or signalstatus of the child. This returns True if the child
process appears to be running or False if not. It can take literally
... | python | def isalive(self):
'''This tests if the child process is running or not. This is
non-blocking. If the child was terminated then this will read the
exitstatus or signalstatus of the child. This returns True if the child
process appears to be running or False if not. It can take literally
... | [
"def",
"isalive",
"(",
"self",
")",
":",
"if",
"self",
".",
"terminated",
":",
"return",
"False",
"if",
"self",
".",
"flag_eof",
":",
"# This is for Linux, which requires the blocking form",
"# of waitpid to get the status of a defunct process.",
"# This is super-lame. The fl... | This tests if the child process is running or not. This is
non-blocking. If the child was terminated then this will read the
exitstatus or signalstatus of the child. This returns True if the child
process appears to be running or False if not. It can take literally
SECONDS for Solaris to... | [
"This",
"tests",
"if",
"the",
"child",
"process",
"is",
"running",
"or",
"not",
".",
"This",
"is",
"non",
"-",
"blocking",
".",
"If",
"the",
"child",
"was",
"terminated",
"then",
"this",
"will",
"read",
"the",
"exitstatus",
"or",
"signalstatus",
"of",
"t... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/ptyprocess/ptyprocess.py#L685-L760 | train |
pypa/pipenv | pipenv/vendor/ptyprocess/ptyprocess.py | PtyProcess.kill | def kill(self, sig):
"""Send the given signal to the child application.
In keeping with UNIX tradition it has a misleading name. It does not
necessarily kill the child unless you send the right signal. See the
:mod:`signal` module for constants representing signal numbers.
"""
... | python | def kill(self, sig):
"""Send the given signal to the child application.
In keeping with UNIX tradition it has a misleading name. It does not
necessarily kill the child unless you send the right signal. See the
:mod:`signal` module for constants representing signal numbers.
"""
... | [
"def",
"kill",
"(",
"self",
",",
"sig",
")",
":",
"# Same as os.kill, but the pid is given for you.",
"if",
"self",
".",
"isalive",
"(",
")",
":",
"os",
".",
"kill",
"(",
"self",
".",
"pid",
",",
"sig",
")"
] | Send the given signal to the child application.
In keeping with UNIX tradition it has a misleading name. It does not
necessarily kill the child unless you send the right signal. See the
:mod:`signal` module for constants representing signal numbers. | [
"Send",
"the",
"given",
"signal",
"to",
"the",
"child",
"application",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/ptyprocess/ptyprocess.py#L762-L772 | train |
pypa/pipenv | pipenv/vendor/ptyprocess/ptyprocess.py | PtyProcessUnicode.read | def read(self, size=1024):
"""Read at most ``size`` bytes from the pty, return them as unicode.
Can block if there is nothing to read. Raises :exc:`EOFError` if the
terminal was closed.
The size argument still refers to bytes, not unicode code points.
"""
b = super(PtyP... | python | def read(self, size=1024):
"""Read at most ``size`` bytes from the pty, return them as unicode.
Can block if there is nothing to read. Raises :exc:`EOFError` if the
terminal was closed.
The size argument still refers to bytes, not unicode code points.
"""
b = super(PtyP... | [
"def",
"read",
"(",
"self",
",",
"size",
"=",
"1024",
")",
":",
"b",
"=",
"super",
"(",
"PtyProcessUnicode",
",",
"self",
")",
".",
"read",
"(",
"size",
")",
"return",
"self",
".",
"decoder",
".",
"decode",
"(",
"b",
",",
"final",
"=",
"False",
"... | Read at most ``size`` bytes from the pty, return them as unicode.
Can block if there is nothing to read. Raises :exc:`EOFError` if the
terminal was closed.
The size argument still refers to bytes, not unicode code points. | [
"Read",
"at",
"most",
"size",
"bytes",
"from",
"the",
"pty",
"return",
"them",
"as",
"unicode",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/ptyprocess/ptyprocess.py#L810-L819 | train |
pypa/pipenv | pipenv/vendor/ptyprocess/ptyprocess.py | PtyProcessUnicode.readline | def readline(self):
"""Read one line from the pseudoterminal, and return it as unicode.
Can block if there is nothing to read. Raises :exc:`EOFError` if the
terminal was closed.
"""
b = super(PtyProcessUnicode, self).readline()
return self.decoder.decode(b, final=False) | python | def readline(self):
"""Read one line from the pseudoterminal, and return it as unicode.
Can block if there is nothing to read. Raises :exc:`EOFError` if the
terminal was closed.
"""
b = super(PtyProcessUnicode, self).readline()
return self.decoder.decode(b, final=False) | [
"def",
"readline",
"(",
"self",
")",
":",
"b",
"=",
"super",
"(",
"PtyProcessUnicode",
",",
"self",
")",
".",
"readline",
"(",
")",
"return",
"self",
".",
"decoder",
".",
"decode",
"(",
"b",
",",
"final",
"=",
"False",
")"
] | Read one line from the pseudoterminal, and return it as unicode.
Can block if there is nothing to read. Raises :exc:`EOFError` if the
terminal was closed. | [
"Read",
"one",
"line",
"from",
"the",
"pseudoterminal",
"and",
"return",
"it",
"as",
"unicode",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/ptyprocess/ptyprocess.py#L821-L828 | train |
pypa/pipenv | pipenv/vendor/ptyprocess/ptyprocess.py | PtyProcessUnicode.write | def write(self, s):
"""Write the unicode string ``s`` to the pseudoterminal.
Returns the number of bytes written.
"""
b = s.encode(self.encoding)
return super(PtyProcessUnicode, self).write(b) | python | def write(self, s):
"""Write the unicode string ``s`` to the pseudoterminal.
Returns the number of bytes written.
"""
b = s.encode(self.encoding)
return super(PtyProcessUnicode, self).write(b) | [
"def",
"write",
"(",
"self",
",",
"s",
")",
":",
"b",
"=",
"s",
".",
"encode",
"(",
"self",
".",
"encoding",
")",
"return",
"super",
"(",
"PtyProcessUnicode",
",",
"self",
")",
".",
"write",
"(",
"b",
")"
] | Write the unicode string ``s`` to the pseudoterminal.
Returns the number of bytes written. | [
"Write",
"the",
"unicode",
"string",
"s",
"to",
"the",
"pseudoterminal",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/ptyprocess/ptyprocess.py#L830-L836 | train |
pypa/pipenv | pipenv/vendor/resolvelib/resolvers.py | Criterion.from_requirement | def from_requirement(cls, provider, requirement, parent):
"""Build an instance from a requirement.
"""
candidates = provider.find_matches(requirement)
if not candidates:
raise NoVersionsAvailable(requirement, parent)
return cls(
candidates=candidates,
... | python | def from_requirement(cls, provider, requirement, parent):
"""Build an instance from a requirement.
"""
candidates = provider.find_matches(requirement)
if not candidates:
raise NoVersionsAvailable(requirement, parent)
return cls(
candidates=candidates,
... | [
"def",
"from_requirement",
"(",
"cls",
",",
"provider",
",",
"requirement",
",",
"parent",
")",
":",
"candidates",
"=",
"provider",
".",
"find_matches",
"(",
"requirement",
")",
"if",
"not",
"candidates",
":",
"raise",
"NoVersionsAvailable",
"(",
"requirement",
... | Build an instance from a requirement. | [
"Build",
"an",
"instance",
"from",
"a",
"requirement",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/resolvelib/resolvers.py#L40-L49 | train |
pypa/pipenv | pipenv/vendor/resolvelib/resolvers.py | Criterion.merged_with | def merged_with(self, provider, requirement, parent):
"""Build a new instance from this and a new requirement.
"""
infos = list(self.information)
infos.append(RequirementInformation(requirement, parent))
candidates = [
c for c in self.candidates
if provide... | python | def merged_with(self, provider, requirement, parent):
"""Build a new instance from this and a new requirement.
"""
infos = list(self.information)
infos.append(RequirementInformation(requirement, parent))
candidates = [
c for c in self.candidates
if provide... | [
"def",
"merged_with",
"(",
"self",
",",
"provider",
",",
"requirement",
",",
"parent",
")",
":",
"infos",
"=",
"list",
"(",
"self",
".",
"information",
")",
"infos",
".",
"append",
"(",
"RequirementInformation",
"(",
"requirement",
",",
"parent",
")",
")",... | Build a new instance from this and a new requirement. | [
"Build",
"a",
"new",
"instance",
"from",
"this",
"and",
"a",
"new",
"requirement",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/resolvelib/resolvers.py#L57-L68 | train |
pypa/pipenv | pipenv/vendor/resolvelib/resolvers.py | Resolution._push_new_state | def _push_new_state(self):
"""Push a new state into history.
This new state will be used to hold resolution results of the next
coming round.
"""
try:
base = self._states[-1]
except IndexError:
graph = DirectedGraph()
graph.add(None) ... | python | def _push_new_state(self):
"""Push a new state into history.
This new state will be used to hold resolution results of the next
coming round.
"""
try:
base = self._states[-1]
except IndexError:
graph = DirectedGraph()
graph.add(None) ... | [
"def",
"_push_new_state",
"(",
"self",
")",
":",
"try",
":",
"base",
"=",
"self",
".",
"_states",
"[",
"-",
"1",
"]",
"except",
"IndexError",
":",
"graph",
"=",
"DirectedGraph",
"(",
")",
"graph",
".",
"add",
"(",
"None",
")",
"# Sentinel as root depende... | Push a new state into history.
This new state will be used to hold resolution results of the next
coming round. | [
"Push",
"a",
"new",
"state",
"into",
"history",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/resolvelib/resolvers.py#L110-L127 | train |
pypa/pipenv | pipenv/vendor/resolvelib/resolvers.py | Resolver.resolve | def resolve(self, requirements, max_rounds=20):
"""Take a collection of constraints, spit out the resolution result.
The return value is a representation to the final resolution result. It
is a tuple subclass with two public members:
* `mapping`: A dict of resolved candidates. Each key... | python | def resolve(self, requirements, max_rounds=20):
"""Take a collection of constraints, spit out the resolution result.
The return value is a representation to the final resolution result. It
is a tuple subclass with two public members:
* `mapping`: A dict of resolved candidates. Each key... | [
"def",
"resolve",
"(",
"self",
",",
"requirements",
",",
"max_rounds",
"=",
"20",
")",
":",
"resolution",
"=",
"Resolution",
"(",
"self",
".",
"provider",
",",
"self",
".",
"reporter",
")",
"resolution",
".",
"resolve",
"(",
"requirements",
",",
"max_round... | Take a collection of constraints, spit out the resolution result.
The return value is a representation to the final resolution result. It
is a tuple subclass with two public members:
* `mapping`: A dict of resolved candidates. Each key is an identifier
of a requirement (as returned... | [
"Take",
"a",
"collection",
"of",
"constraints",
"spit",
"out",
"the",
"resolution",
"result",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/resolvelib/resolvers.py#L261-L287 | train |
pypa/pipenv | pipenv/vendor/passa/internals/markers.py | _strip_extra | def _strip_extra(elements):
"""Remove the "extra == ..." operands from the list.
This is not a comprehensive implementation, but relies on an important
characteristic of metadata generation: The "extra == ..." operand is always
associated with an "and" operator. This means that we can simply remove the... | python | def _strip_extra(elements):
"""Remove the "extra == ..." operands from the list.
This is not a comprehensive implementation, but relies on an important
characteristic of metadata generation: The "extra == ..." operand is always
associated with an "and" operator. This means that we can simply remove the... | [
"def",
"_strip_extra",
"(",
"elements",
")",
":",
"extra_indexes",
"=",
"[",
"]",
"for",
"i",
",",
"element",
"in",
"enumerate",
"(",
"elements",
")",
":",
"if",
"isinstance",
"(",
"element",
",",
"list",
")",
":",
"cancelled",
"=",
"_strip_extra",
"(",
... | Remove the "extra == ..." operands from the list.
This is not a comprehensive implementation, but relies on an important
characteristic of metadata generation: The "extra == ..." operand is always
associated with an "and" operator. This means that we can simply remove the
operand and the "and" operator... | [
"Remove",
"the",
"extra",
"==",
"...",
"operands",
"from",
"the",
"list",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/passa/internals/markers.py#L8-L34 | train |
pypa/pipenv | pipenv/vendor/passa/internals/markers.py | get_without_extra | def get_without_extra(marker):
"""Build a new marker without the `extra == ...` part.
The implementation relies very deep into packaging's internals, but I don't
have a better way now (except implementing the whole thing myself).
This could return `None` if the `extra == ...` part is the only one in t... | python | def get_without_extra(marker):
"""Build a new marker without the `extra == ...` part.
The implementation relies very deep into packaging's internals, but I don't
have a better way now (except implementing the whole thing myself).
This could return `None` if the `extra == ...` part is the only one in t... | [
"def",
"get_without_extra",
"(",
"marker",
")",
":",
"# TODO: Why is this very deep in the internals? Why is a better solution",
"# implementing it yourself when someone is already maintaining a codebase",
"# for this? It's literally a grammar implementation that is required to",
"# meet the deman... | Build a new marker without the `extra == ...` part.
The implementation relies very deep into packaging's internals, but I don't
have a better way now (except implementing the whole thing myself).
This could return `None` if the `extra == ...` part is the only one in the
input marker. | [
"Build",
"a",
"new",
"marker",
"without",
"the",
"extra",
"==",
"...",
"part",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/passa/internals/markers.py#L37-L57 | train |
pypa/pipenv | pipenv/vendor/passa/internals/markers.py | get_contained_extras | def get_contained_extras(marker):
"""Collect "extra == ..." operands from a marker.
Returns a list of str. Each str is a speficied extra in this marker.
"""
if not marker:
return set()
marker = Marker(str(marker))
extras = set()
_markers_collect_extras(marker._markers, extras)
r... | python | def get_contained_extras(marker):
"""Collect "extra == ..." operands from a marker.
Returns a list of str. Each str is a speficied extra in this marker.
"""
if not marker:
return set()
marker = Marker(str(marker))
extras = set()
_markers_collect_extras(marker._markers, extras)
r... | [
"def",
"get_contained_extras",
"(",
"marker",
")",
":",
"if",
"not",
"marker",
":",
"return",
"set",
"(",
")",
"marker",
"=",
"Marker",
"(",
"str",
"(",
"marker",
")",
")",
"extras",
"=",
"set",
"(",
")",
"_markers_collect_extras",
"(",
"marker",
".",
... | Collect "extra == ..." operands from a marker.
Returns a list of str. Each str is a speficied extra in this marker. | [
"Collect",
"extra",
"==",
"...",
"operands",
"from",
"a",
"marker",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/passa/internals/markers.py#L71-L81 | train |
pypa/pipenv | pipenv/vendor/passa/internals/markers.py | contains_extra | def contains_extra(marker):
"""Check whehter a marker contains an "extra == ..." operand.
"""
if not marker:
return False
marker = Marker(str(marker))
return _markers_contains_extra(marker._markers) | python | def contains_extra(marker):
"""Check whehter a marker contains an "extra == ..." operand.
"""
if not marker:
return False
marker = Marker(str(marker))
return _markers_contains_extra(marker._markers) | [
"def",
"contains_extra",
"(",
"marker",
")",
":",
"if",
"not",
"marker",
":",
"return",
"False",
"marker",
"=",
"Marker",
"(",
"str",
"(",
"marker",
")",
")",
"return",
"_markers_contains_extra",
"(",
"marker",
".",
"_markers",
")"
] | Check whehter a marker contains an "extra == ..." operand. | [
"Check",
"whehter",
"a",
"marker",
"contains",
"an",
"extra",
"==",
"...",
"operand",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/passa/internals/markers.py#L95-L101 | train |
pypa/pipenv | pipenv/vendor/distlib/locators.py | Locator.get_errors | def get_errors(self):
"""
Return any errors which have occurred.
"""
result = []
while not self.errors.empty(): # pragma: no cover
try:
e = self.errors.get(False)
result.append(e)
except self.errors.Empty:
c... | python | def get_errors(self):
"""
Return any errors which have occurred.
"""
result = []
while not self.errors.empty(): # pragma: no cover
try:
e = self.errors.get(False)
result.append(e)
except self.errors.Empty:
c... | [
"def",
"get_errors",
"(",
"self",
")",
":",
"result",
"=",
"[",
"]",
"while",
"not",
"self",
".",
"errors",
".",
"empty",
"(",
")",
":",
"# pragma: no cover",
"try",
":",
"e",
"=",
"self",
".",
"errors",
".",
"get",
"(",
"False",
")",
"result",
"."... | Return any errors which have occurred. | [
"Return",
"any",
"errors",
"which",
"have",
"occurred",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/locators.py#L121-L133 | train |
pypa/pipenv | pipenv/vendor/distlib/locators.py | Locator.get_project | def get_project(self, name):
"""
For a given project, get a dictionary mapping available versions to Distribution
instances.
This calls _get_project to do all the work, and just implements a caching layer on top.
"""
if self._cache is None: # pragma: no cover
... | python | def get_project(self, name):
"""
For a given project, get a dictionary mapping available versions to Distribution
instances.
This calls _get_project to do all the work, and just implements a caching layer on top.
"""
if self._cache is None: # pragma: no cover
... | [
"def",
"get_project",
"(",
"self",
",",
"name",
")",
":",
"if",
"self",
".",
"_cache",
"is",
"None",
":",
"# pragma: no cover",
"result",
"=",
"self",
".",
"_get_project",
"(",
"name",
")",
"elif",
"name",
"in",
"self",
".",
"_cache",
":",
"result",
"=... | For a given project, get a dictionary mapping available versions to Distribution
instances.
This calls _get_project to do all the work, and just implements a caching layer on top. | [
"For",
"a",
"given",
"project",
"get",
"a",
"dictionary",
"mapping",
"available",
"versions",
"to",
"Distribution",
"instances",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/locators.py#L171-L186 | train |
pypa/pipenv | pipenv/vendor/distlib/locators.py | Locator.score_url | def score_url(self, url):
"""
Give an url a score which can be used to choose preferred URLs
for a given project release.
"""
t = urlparse(url)
basename = posixpath.basename(t.path)
compatible = True
is_wheel = basename.endswith('.whl')
is_download... | python | def score_url(self, url):
"""
Give an url a score which can be used to choose preferred URLs
for a given project release.
"""
t = urlparse(url)
basename = posixpath.basename(t.path)
compatible = True
is_wheel = basename.endswith('.whl')
is_download... | [
"def",
"score_url",
"(",
"self",
",",
"url",
")",
":",
"t",
"=",
"urlparse",
"(",
"url",
")",
"basename",
"=",
"posixpath",
".",
"basename",
"(",
"t",
".",
"path",
")",
"compatible",
"=",
"True",
"is_wheel",
"=",
"basename",
".",
"endswith",
"(",
"'.... | Give an url a score which can be used to choose preferred URLs
for a given project release. | [
"Give",
"an",
"url",
"a",
"score",
"which",
"can",
"be",
"used",
"to",
"choose",
"preferred",
"URLs",
"for",
"a",
"given",
"project",
"release",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/locators.py#L188-L201 | train |
pypa/pipenv | pipenv/vendor/distlib/locators.py | Locator.prefer_url | def prefer_url(self, url1, url2):
"""
Choose one of two URLs where both are candidates for distribution
archives for the same version of a distribution (for example,
.tar.gz vs. zip).
The current implementation favours https:// URLs over http://, archives
from PyPI over ... | python | def prefer_url(self, url1, url2):
"""
Choose one of two URLs where both are candidates for distribution
archives for the same version of a distribution (for example,
.tar.gz vs. zip).
The current implementation favours https:// URLs over http://, archives
from PyPI over ... | [
"def",
"prefer_url",
"(",
"self",
",",
"url1",
",",
"url2",
")",
":",
"result",
"=",
"url2",
"if",
"url1",
":",
"s1",
"=",
"self",
".",
"score_url",
"(",
"url1",
")",
"s2",
"=",
"self",
".",
"score_url",
"(",
"url2",
")",
"if",
"s1",
">",
"s2",
... | Choose one of two URLs where both are candidates for distribution
archives for the same version of a distribution (for example,
.tar.gz vs. zip).
The current implementation favours https:// URLs over http://, archives
from PyPI over those from other locations, wheel compatibility (if a
... | [
"Choose",
"one",
"of",
"two",
"URLs",
"where",
"both",
"are",
"candidates",
"for",
"distribution",
"archives",
"for",
"the",
"same",
"version",
"of",
"a",
"distribution",
"(",
"for",
"example",
".",
"tar",
".",
"gz",
"vs",
".",
"zip",
")",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/locators.py#L203-L223 | train |
pypa/pipenv | pipenv/vendor/distlib/locators.py | Locator._get_digest | def _get_digest(self, info):
"""
Get a digest from a dictionary by looking at keys of the form
'algo_digest'.
Returns a 2-tuple (algo, digest) if found, else None. Currently
looks only for SHA256, then MD5.
"""
result = None
for algo in ('sha256', 'md5'):... | python | def _get_digest(self, info):
"""
Get a digest from a dictionary by looking at keys of the form
'algo_digest'.
Returns a 2-tuple (algo, digest) if found, else None. Currently
looks only for SHA256, then MD5.
"""
result = None
for algo in ('sha256', 'md5'):... | [
"def",
"_get_digest",
"(",
"self",
",",
"info",
")",
":",
"result",
"=",
"None",
"for",
"algo",
"in",
"(",
"'sha256'",
",",
"'md5'",
")",
":",
"key",
"=",
"'%s_digest'",
"%",
"algo",
"if",
"key",
"in",
"info",
":",
"result",
"=",
"(",
"algo",
",",
... | Get a digest from a dictionary by looking at keys of the form
'algo_digest'.
Returns a 2-tuple (algo, digest) if found, else None. Currently
looks only for SHA256, then MD5. | [
"Get",
"a",
"digest",
"from",
"a",
"dictionary",
"by",
"looking",
"at",
"keys",
"of",
"the",
"form",
"algo_digest",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/locators.py#L305-L319 | train |
pypa/pipenv | pipenv/vendor/distlib/locators.py | Page.links | def links(self):
"""
Return the URLs of all the links on a page together with information
about their "rel" attribute, for determining which ones to treat as
downloads and which ones to queue for further scraping.
"""
def clean(url):
"Tidy up an URL."
... | python | def links(self):
"""
Return the URLs of all the links on a page together with information
about their "rel" attribute, for determining which ones to treat as
downloads and which ones to queue for further scraping.
"""
def clean(url):
"Tidy up an URL."
... | [
"def",
"links",
"(",
"self",
")",
":",
"def",
"clean",
"(",
"url",
")",
":",
"\"Tidy up an URL.\"",
"scheme",
",",
"netloc",
",",
"path",
",",
"params",
",",
"query",
",",
"frag",
"=",
"urlparse",
"(",
"url",
")",
"return",
"urlunparse",
"(",
"(",
"s... | Return the URLs of all the links on a page together with information
about their "rel" attribute, for determining which ones to treat as
downloads and which ones to queue for further scraping. | [
"Return",
"the",
"URLs",
"of",
"all",
"the",
"links",
"on",
"a",
"page",
"together",
"with",
"information",
"about",
"their",
"rel",
"attribute",
"for",
"determining",
"which",
"ones",
"to",
"treat",
"as",
"downloads",
"and",
"which",
"ones",
"to",
"queue",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/locators.py#L551-L576 | train |
pypa/pipenv | pipenv/vendor/distlib/locators.py | SimpleScrapingLocator._prepare_threads | def _prepare_threads(self):
"""
Threads are created only when get_project is called, and terminate
before it returns. They are there primarily to parallelise I/O (i.e.
fetching web pages).
"""
self._threads = []
for i in range(self.num_workers):
t = th... | python | def _prepare_threads(self):
"""
Threads are created only when get_project is called, and terminate
before it returns. They are there primarily to parallelise I/O (i.e.
fetching web pages).
"""
self._threads = []
for i in range(self.num_workers):
t = th... | [
"def",
"_prepare_threads",
"(",
"self",
")",
":",
"self",
".",
"_threads",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"num_workers",
")",
":",
"t",
"=",
"threading",
".",
"Thread",
"(",
"target",
"=",
"self",
".",
"_fetch",
")",
"t... | Threads are created only when get_project is called, and terminate
before it returns. They are there primarily to parallelise I/O (i.e.
fetching web pages). | [
"Threads",
"are",
"created",
"only",
"when",
"get_project",
"is",
"called",
"and",
"terminate",
"before",
"it",
"returns",
".",
"They",
"are",
"there",
"primarily",
"to",
"parallelise",
"I",
"/",
"O",
"(",
"i",
".",
"e",
".",
"fetching",
"web",
"pages",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/locators.py#L620-L631 | train |
pypa/pipenv | pipenv/vendor/distlib/locators.py | SimpleScrapingLocator._wait_threads | def _wait_threads(self):
"""
Tell all the threads to terminate (by sending a sentinel value) and
wait for them to do so.
"""
# Note that you need two loops, since you can't say which
# thread will get each sentinel
for t in self._threads:
self._to_fetc... | python | def _wait_threads(self):
"""
Tell all the threads to terminate (by sending a sentinel value) and
wait for them to do so.
"""
# Note that you need two loops, since you can't say which
# thread will get each sentinel
for t in self._threads:
self._to_fetc... | [
"def",
"_wait_threads",
"(",
"self",
")",
":",
"# Note that you need two loops, since you can't say which",
"# thread will get each sentinel",
"for",
"t",
"in",
"self",
".",
"_threads",
":",
"self",
".",
"_to_fetch",
".",
"put",
"(",
"None",
")",
"# sentinel",
"for",
... | Tell all the threads to terminate (by sending a sentinel value) and
wait for them to do so. | [
"Tell",
"all",
"the",
"threads",
"to",
"terminate",
"(",
"by",
"sending",
"a",
"sentinel",
"value",
")",
"and",
"wait",
"for",
"them",
"to",
"do",
"so",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/locators.py#L633-L644 | train |
pypa/pipenv | pipenv/vendor/distlib/locators.py | SimpleScrapingLocator._process_download | def _process_download(self, url):
"""
See if an URL is a suitable download for a project.
If it is, register information in the result dictionary (for
_get_project) about the specific version it's for.
Note that the return value isn't actually used other than as a boolean
... | python | def _process_download(self, url):
"""
See if an URL is a suitable download for a project.
If it is, register information in the result dictionary (for
_get_project) about the specific version it's for.
Note that the return value isn't actually used other than as a boolean
... | [
"def",
"_process_download",
"(",
"self",
",",
"url",
")",
":",
"if",
"self",
".",
"platform_check",
"and",
"self",
".",
"_is_platform_dependent",
"(",
"url",
")",
":",
"info",
"=",
"None",
"else",
":",
"info",
"=",
"self",
".",
"convert_url_to_download_info"... | See if an URL is a suitable download for a project.
If it is, register information in the result dictionary (for
_get_project) about the specific version it's for.
Note that the return value isn't actually used other than as a boolean
value. | [
"See",
"if",
"an",
"URL",
"is",
"a",
"suitable",
"download",
"for",
"a",
"project",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/locators.py#L673-L691 | train |
pypa/pipenv | pipenv/vendor/distlib/locators.py | SimpleScrapingLocator._should_queue | def _should_queue(self, link, referrer, rel):
"""
Determine whether a link URL from a referring page and with a
particular "rel" attribute should be queued for scraping.
"""
scheme, netloc, path, _, _, _ = urlparse(link)
if path.endswith(self.source_extensions + self.bina... | python | def _should_queue(self, link, referrer, rel):
"""
Determine whether a link URL from a referring page and with a
particular "rel" attribute should be queued for scraping.
"""
scheme, netloc, path, _, _, _ = urlparse(link)
if path.endswith(self.source_extensions + self.bina... | [
"def",
"_should_queue",
"(",
"self",
",",
"link",
",",
"referrer",
",",
"rel",
")",
":",
"scheme",
",",
"netloc",
",",
"path",
",",
"_",
",",
"_",
",",
"_",
"=",
"urlparse",
"(",
"link",
")",
"if",
"path",
".",
"endswith",
"(",
"self",
".",
"sour... | Determine whether a link URL from a referring page and with a
particular "rel" attribute should be queued for scraping. | [
"Determine",
"whether",
"a",
"link",
"URL",
"from",
"a",
"referring",
"page",
"and",
"with",
"a",
"particular",
"rel",
"attribute",
"should",
"be",
"queued",
"for",
"scraping",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/locators.py#L693-L720 | train |
pypa/pipenv | pipenv/vendor/distlib/locators.py | SimpleScrapingLocator._fetch | def _fetch(self):
"""
Get a URL to fetch from the work queue, get the HTML page, examine its
links for download candidates and candidates for further scraping.
This is a handy method to run in a thread.
"""
while True:
url = self._to_fetch.get()
t... | python | def _fetch(self):
"""
Get a URL to fetch from the work queue, get the HTML page, examine its
links for download candidates and candidates for further scraping.
This is a handy method to run in a thread.
"""
while True:
url = self._to_fetch.get()
t... | [
"def",
"_fetch",
"(",
"self",
")",
":",
"while",
"True",
":",
"url",
"=",
"self",
".",
"_to_fetch",
".",
"get",
"(",
")",
"try",
":",
"if",
"url",
":",
"page",
"=",
"self",
".",
"get_page",
"(",
"url",
")",
"if",
"page",
"is",
"None",
":",
"# e... | Get a URL to fetch from the work queue, get the HTML page, examine its
links for download candidates and candidates for further scraping.
This is a handy method to run in a thread. | [
"Get",
"a",
"URL",
"to",
"fetch",
"from",
"the",
"work",
"queue",
"get",
"the",
"HTML",
"page",
"examine",
"its",
"links",
"for",
"download",
"candidates",
"and",
"candidates",
"for",
"further",
"scraping",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/locators.py#L722-L753 | train |
pypa/pipenv | pipenv/vendor/distlib/locators.py | SimpleScrapingLocator.get_distribution_names | def get_distribution_names(self):
"""
Return all the distribution names known to this locator.
"""
result = set()
page = self.get_page(self.base_url)
if not page:
raise DistlibException('Unable to get %s' % self.base_url)
for match in self._distname_re... | python | def get_distribution_names(self):
"""
Return all the distribution names known to this locator.
"""
result = set()
page = self.get_page(self.base_url)
if not page:
raise DistlibException('Unable to get %s' % self.base_url)
for match in self._distname_re... | [
"def",
"get_distribution_names",
"(",
"self",
")",
":",
"result",
"=",
"set",
"(",
")",
"page",
"=",
"self",
".",
"get_page",
"(",
"self",
".",
"base_url",
")",
"if",
"not",
"page",
":",
"raise",
"DistlibException",
"(",
"'Unable to get %s'",
"%",
"self",
... | Return all the distribution names known to this locator. | [
"Return",
"all",
"the",
"distribution",
"names",
"known",
"to",
"this",
"locator",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/locators.py#L816-L826 | train |
pypa/pipenv | pipenv/vendor/distlib/locators.py | DirectoryLocator.get_distribution_names | def get_distribution_names(self):
"""
Return all the distribution names known to this locator.
"""
result = set()
for root, dirs, files in os.walk(self.base_dir):
for fn in files:
if self.should_include(fn, root):
fn = os.path.join(... | python | def get_distribution_names(self):
"""
Return all the distribution names known to this locator.
"""
result = set()
for root, dirs, files in os.walk(self.base_dir):
for fn in files:
if self.should_include(fn, root):
fn = os.path.join(... | [
"def",
"get_distribution_names",
"(",
"self",
")",
":",
"result",
"=",
"set",
"(",
")",
"for",
"root",
",",
"dirs",
",",
"files",
"in",
"os",
".",
"walk",
"(",
"self",
".",
"base_dir",
")",
":",
"for",
"fn",
"in",
"files",
":",
"if",
"self",
".",
... | Return all the distribution names known to this locator. | [
"Return",
"all",
"the",
"distribution",
"names",
"known",
"to",
"this",
"locator",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/locators.py#L874-L891 | train |
pypa/pipenv | pipenv/vendor/distlib/locators.py | AggregatingLocator.get_distribution_names | def get_distribution_names(self):
"""
Return all the distribution names known to this locator.
"""
result = set()
for locator in self.locators:
try:
result |= locator.get_distribution_names()
except NotImplementedError:
pass... | python | def get_distribution_names(self):
"""
Return all the distribution names known to this locator.
"""
result = set()
for locator in self.locators:
try:
result |= locator.get_distribution_names()
except NotImplementedError:
pass... | [
"def",
"get_distribution_names",
"(",
"self",
")",
":",
"result",
"=",
"set",
"(",
")",
"for",
"locator",
"in",
"self",
".",
"locators",
":",
"try",
":",
"result",
"|=",
"locator",
".",
"get_distribution_names",
"(",
")",
"except",
"NotImplementedError",
":"... | Return all the distribution names known to this locator. | [
"Return",
"all",
"the",
"distribution",
"names",
"known",
"to",
"this",
"locator",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/locators.py#L1035-L1045 | train |
pypa/pipenv | pipenv/vendor/distlib/locators.py | DependencyFinder.add_distribution | def add_distribution(self, dist):
"""
Add a distribution to the finder. This will update internal information
about who provides what.
:param dist: The distribution to add.
"""
logger.debug('adding distribution %s', dist)
name = dist.key
self.dists_by_name... | python | def add_distribution(self, dist):
"""
Add a distribution to the finder. This will update internal information
about who provides what.
:param dist: The distribution to add.
"""
logger.debug('adding distribution %s', dist)
name = dist.key
self.dists_by_name... | [
"def",
"add_distribution",
"(",
"self",
",",
"dist",
")",
":",
"logger",
".",
"debug",
"(",
"'adding distribution %s'",
",",
"dist",
")",
"name",
"=",
"dist",
".",
"key",
"self",
".",
"dists_by_name",
"[",
"name",
"]",
"=",
"dist",
"self",
".",
"dists",
... | Add a distribution to the finder. This will update internal information
about who provides what.
:param dist: The distribution to add. | [
"Add",
"a",
"distribution",
"to",
"the",
"finder",
".",
"This",
"will",
"update",
"internal",
"information",
"about",
"who",
"provides",
"what",
".",
":",
"param",
"dist",
":",
"The",
"distribution",
"to",
"add",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/locators.py#L1074-L1087 | train |
pypa/pipenv | pipenv/vendor/distlib/locators.py | DependencyFinder.remove_distribution | def remove_distribution(self, dist):
"""
Remove a distribution from the finder. This will update internal
information about who provides what.
:param dist: The distribution to remove.
"""
logger.debug('removing distribution %s', dist)
name = dist.key
del s... | python | def remove_distribution(self, dist):
"""
Remove a distribution from the finder. This will update internal
information about who provides what.
:param dist: The distribution to remove.
"""
logger.debug('removing distribution %s', dist)
name = dist.key
del s... | [
"def",
"remove_distribution",
"(",
"self",
",",
"dist",
")",
":",
"logger",
".",
"debug",
"(",
"'removing distribution %s'",
",",
"dist",
")",
"name",
"=",
"dist",
".",
"key",
"del",
"self",
".",
"dists_by_name",
"[",
"name",
"]",
"del",
"self",
".",
"di... | Remove a distribution from the finder. This will update internal
information about who provides what.
:param dist: The distribution to remove. | [
"Remove",
"a",
"distribution",
"from",
"the",
"finder",
".",
"This",
"will",
"update",
"internal",
"information",
"about",
"who",
"provides",
"what",
".",
":",
"param",
"dist",
":",
"The",
"distribution",
"to",
"remove",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/locators.py#L1089-L1105 | train |
pypa/pipenv | pipenv/vendor/distlib/locators.py | DependencyFinder.get_matcher | def get_matcher(self, reqt):
"""
Get a version matcher for a requirement.
:param reqt: The requirement
:type reqt: str
:return: A version matcher (an instance of
:class:`distlib.version.Matcher`).
"""
try:
matcher = self.scheme.matcher... | python | def get_matcher(self, reqt):
"""
Get a version matcher for a requirement.
:param reqt: The requirement
:type reqt: str
:return: A version matcher (an instance of
:class:`distlib.version.Matcher`).
"""
try:
matcher = self.scheme.matcher... | [
"def",
"get_matcher",
"(",
"self",
",",
"reqt",
")",
":",
"try",
":",
"matcher",
"=",
"self",
".",
"scheme",
".",
"matcher",
"(",
"reqt",
")",
"except",
"UnsupportedVersionError",
":",
"# pragma: no cover",
"# XXX compat-mode if cannot read the version",
"name",
"... | Get a version matcher for a requirement.
:param reqt: The requirement
:type reqt: str
:return: A version matcher (an instance of
:class:`distlib.version.Matcher`). | [
"Get",
"a",
"version",
"matcher",
"for",
"a",
"requirement",
".",
":",
"param",
"reqt",
":",
"The",
"requirement",
":",
"type",
"reqt",
":",
"str",
":",
"return",
":",
"A",
"version",
"matcher",
"(",
"an",
"instance",
"of",
":",
"class",
":",
"distlib"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/locators.py#L1107-L1121 | train |
pypa/pipenv | pipenv/vendor/distlib/locators.py | DependencyFinder.find_providers | def find_providers(self, reqt):
"""
Find the distributions which can fulfill a requirement.
:param reqt: The requirement.
:type reqt: str
:return: A set of distribution which can fulfill the requirement.
"""
matcher = self.get_matcher(reqt)
name = matche... | python | def find_providers(self, reqt):
"""
Find the distributions which can fulfill a requirement.
:param reqt: The requirement.
:type reqt: str
:return: A set of distribution which can fulfill the requirement.
"""
matcher = self.get_matcher(reqt)
name = matche... | [
"def",
"find_providers",
"(",
"self",
",",
"reqt",
")",
":",
"matcher",
"=",
"self",
".",
"get_matcher",
"(",
"reqt",
")",
"name",
"=",
"matcher",
".",
"key",
"# case-insensitive",
"result",
"=",
"set",
"(",
")",
"provided",
"=",
"self",
".",
"provided",... | Find the distributions which can fulfill a requirement.
:param reqt: The requirement.
:type reqt: str
:return: A set of distribution which can fulfill the requirement. | [
"Find",
"the",
"distributions",
"which",
"can",
"fulfill",
"a",
"requirement",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/locators.py#L1123-L1145 | train |
pypa/pipenv | pipenv/vendor/distlib/locators.py | DependencyFinder.try_to_replace | def try_to_replace(self, provider, other, problems):
"""
Attempt to replace one provider with another. This is typically used
when resolving dependencies from multiple sources, e.g. A requires
(B >= 1.0) while C requires (B >= 1.1).
For successful replacement, ``provider`` must ... | python | def try_to_replace(self, provider, other, problems):
"""
Attempt to replace one provider with another. This is typically used
when resolving dependencies from multiple sources, e.g. A requires
(B >= 1.0) while C requires (B >= 1.1).
For successful replacement, ``provider`` must ... | [
"def",
"try_to_replace",
"(",
"self",
",",
"provider",
",",
"other",
",",
"problems",
")",
":",
"rlist",
"=",
"self",
".",
"reqts",
"[",
"other",
"]",
"unmatched",
"=",
"set",
"(",
")",
"for",
"s",
"in",
"rlist",
":",
"matcher",
"=",
"self",
".",
"... | Attempt to replace one provider with another. This is typically used
when resolving dependencies from multiple sources, e.g. A requires
(B >= 1.0) while C requires (B >= 1.1).
For successful replacement, ``provider`` must meet all the requirements
which ``other`` fulfills.
:par... | [
"Attempt",
"to",
"replace",
"one",
"provider",
"with",
"another",
".",
"This",
"is",
"typically",
"used",
"when",
"resolving",
"dependencies",
"from",
"multiple",
"sources",
"e",
".",
"g",
".",
"A",
"requires",
"(",
"B",
">",
"=",
"1",
".",
"0",
")",
"... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/locators.py#L1147-L1185 | train |
pypa/pipenv | pipenv/vendor/distlib/locators.py | DependencyFinder.find | def find(self, requirement, meta_extras=None, prereleases=False):
"""
Find a distribution and all distributions it depends on.
:param requirement: The requirement specifying the distribution to
find, or a Distribution instance.
:param meta_extras: A list of m... | python | def find(self, requirement, meta_extras=None, prereleases=False):
"""
Find a distribution and all distributions it depends on.
:param requirement: The requirement specifying the distribution to
find, or a Distribution instance.
:param meta_extras: A list of m... | [
"def",
"find",
"(",
"self",
",",
"requirement",
",",
"meta_extras",
"=",
"None",
",",
"prereleases",
"=",
"False",
")",
":",
"self",
".",
"provided",
"=",
"{",
"}",
"self",
".",
"dists",
"=",
"{",
"}",
"self",
".",
"dists_by_name",
"=",
"{",
"}",
"... | Find a distribution and all distributions it depends on.
:param requirement: The requirement specifying the distribution to
find, or a Distribution instance.
:param meta_extras: A list of meta extras such as :test:, :build: and
so on.
:par... | [
"Find",
"a",
"distribution",
"and",
"all",
"distributions",
"it",
"depends",
"on",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/locators.py#L1187-L1295 | train |
pypa/pipenv | pipenv/vendor/pexpect/popen_spawn.py | PopenSpawn._read_incoming | def _read_incoming(self):
"""Run in a thread to move output from a pipe to a queue."""
fileno = self.proc.stdout.fileno()
while 1:
buf = b''
try:
buf = os.read(fileno, 1024)
except OSError as e:
self._log(e, 'read')
... | python | def _read_incoming(self):
"""Run in a thread to move output from a pipe to a queue."""
fileno = self.proc.stdout.fileno()
while 1:
buf = b''
try:
buf = os.read(fileno, 1024)
except OSError as e:
self._log(e, 'read')
... | [
"def",
"_read_incoming",
"(",
"self",
")",
":",
"fileno",
"=",
"self",
".",
"proc",
".",
"stdout",
".",
"fileno",
"(",
")",
"while",
"1",
":",
"buf",
"=",
"b''",
"try",
":",
"buf",
"=",
"os",
".",
"read",
"(",
"fileno",
",",
"1024",
")",
"except"... | Run in a thread to move output from a pipe to a queue. | [
"Run",
"in",
"a",
"thread",
"to",
"move",
"output",
"from",
"a",
"pipe",
"to",
"a",
"queue",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/popen_spawn.py#L100-L115 | train |
pypa/pipenv | pipenv/vendor/pexpect/popen_spawn.py | PopenSpawn.send | def send(self, s):
'''Send data to the subprocess' stdin.
Returns the number of bytes written.
'''
s = self._coerce_send_string(s)
self._log(s, 'send')
b = self._encoder.encode(s, final=False)
if PY3:
return self.proc.stdin.write(b)
else:
... | python | def send(self, s):
'''Send data to the subprocess' stdin.
Returns the number of bytes written.
'''
s = self._coerce_send_string(s)
self._log(s, 'send')
b = self._encoder.encode(s, final=False)
if PY3:
return self.proc.stdin.write(b)
else:
... | [
"def",
"send",
"(",
"self",
",",
"s",
")",
":",
"s",
"=",
"self",
".",
"_coerce_send_string",
"(",
"s",
")",
"self",
".",
"_log",
"(",
"s",
",",
"'send'",
")",
"b",
"=",
"self",
".",
"_encoder",
".",
"encode",
"(",
"s",
",",
"final",
"=",
"Fals... | Send data to the subprocess' stdin.
Returns the number of bytes written. | [
"Send",
"data",
"to",
"the",
"subprocess",
"stdin",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/popen_spawn.py#L132-L147 | train |
pypa/pipenv | pipenv/vendor/pexpect/popen_spawn.py | PopenSpawn.sendline | def sendline(self, s=''):
'''Wraps send(), sending string ``s`` to child process, with os.linesep
automatically appended. Returns number of bytes written. '''
n = self.send(s)
return n + self.send(self.linesep) | python | def sendline(self, s=''):
'''Wraps send(), sending string ``s`` to child process, with os.linesep
automatically appended. Returns number of bytes written. '''
n = self.send(s)
return n + self.send(self.linesep) | [
"def",
"sendline",
"(",
"self",
",",
"s",
"=",
"''",
")",
":",
"n",
"=",
"self",
".",
"send",
"(",
"s",
")",
"return",
"n",
"+",
"self",
".",
"send",
"(",
"self",
".",
"linesep",
")"
] | Wraps send(), sending string ``s`` to child process, with os.linesep
automatically appended. Returns number of bytes written. | [
"Wraps",
"send",
"()",
"sending",
"string",
"s",
"to",
"child",
"process",
"with",
"os",
".",
"linesep",
"automatically",
"appended",
".",
"Returns",
"number",
"of",
"bytes",
"written",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/popen_spawn.py#L149-L154 | train |
pypa/pipenv | pipenv/vendor/pexpect/popen_spawn.py | PopenSpawn.wait | def wait(self):
'''Wait for the subprocess to finish.
Returns the exit code.
'''
status = self.proc.wait()
if status >= 0:
self.exitstatus = status
self.signalstatus = None
else:
self.exitstatus = None
self.signalstatus = -... | python | def wait(self):
'''Wait for the subprocess to finish.
Returns the exit code.
'''
status = self.proc.wait()
if status >= 0:
self.exitstatus = status
self.signalstatus = None
else:
self.exitstatus = None
self.signalstatus = -... | [
"def",
"wait",
"(",
"self",
")",
":",
"status",
"=",
"self",
".",
"proc",
".",
"wait",
"(",
")",
"if",
"status",
">=",
"0",
":",
"self",
".",
"exitstatus",
"=",
"status",
"self",
".",
"signalstatus",
"=",
"None",
"else",
":",
"self",
".",
"exitstat... | Wait for the subprocess to finish.
Returns the exit code. | [
"Wait",
"for",
"the",
"subprocess",
"to",
"finish",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/popen_spawn.py#L156-L169 | train |
pypa/pipenv | pipenv/vendor/pexpect/popen_spawn.py | PopenSpawn.kill | def kill(self, sig):
'''Sends a Unix signal to the subprocess.
Use constants from the :mod:`signal` module to specify which signal.
'''
if sys.platform == 'win32':
if sig in [signal.SIGINT, signal.CTRL_C_EVENT]:
sig = signal.CTRL_C_EVENT
elif sig ... | python | def kill(self, sig):
'''Sends a Unix signal to the subprocess.
Use constants from the :mod:`signal` module to specify which signal.
'''
if sys.platform == 'win32':
if sig in [signal.SIGINT, signal.CTRL_C_EVENT]:
sig = signal.CTRL_C_EVENT
elif sig ... | [
"def",
"kill",
"(",
"self",
",",
"sig",
")",
":",
"if",
"sys",
".",
"platform",
"==",
"'win32'",
":",
"if",
"sig",
"in",
"[",
"signal",
".",
"SIGINT",
",",
"signal",
".",
"CTRL_C_EVENT",
"]",
":",
"sig",
"=",
"signal",
".",
"CTRL_C_EVENT",
"elif",
... | Sends a Unix signal to the subprocess.
Use constants from the :mod:`signal` module to specify which signal. | [
"Sends",
"a",
"Unix",
"signal",
"to",
"the",
"subprocess",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/popen_spawn.py#L171-L184 | train |
pypa/pipenv | pipenv/vendor/pep517/build.py | mkdir_p | def mkdir_p(*args, **kwargs):
"""Like `mkdir`, but does not raise an exception if the
directory already exists.
"""
try:
return os.mkdir(*args, **kwargs)
except OSError as exc:
if exc.errno != errno.EEXIST:
raise | python | def mkdir_p(*args, **kwargs):
"""Like `mkdir`, but does not raise an exception if the
directory already exists.
"""
try:
return os.mkdir(*args, **kwargs)
except OSError as exc:
if exc.errno != errno.EEXIST:
raise | [
"def",
"mkdir_p",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"return",
"os",
".",
"mkdir",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"except",
"OSError",
"as",
"exc",
":",
"if",
"exc",
".",
"errno",
"!=",
"errno",
".... | Like `mkdir`, but does not raise an exception if the
directory already exists. | [
"Like",
"mkdir",
"but",
"does",
"not",
"raise",
"an",
"exception",
"if",
"the",
"directory",
"already",
"exists",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pep517/build.py#L45-L53 | train |
pypa/pipenv | pipenv/vendor/parse.py | with_pattern | def with_pattern(pattern, regex_group_count=None):
"""Attach a regular expression pattern matcher to a custom type converter
function.
This annotates the type converter with the :attr:`pattern` attribute.
EXAMPLE:
>>> import parse
>>> @parse.with_pattern(r"\d+")
... def parse_n... | python | def with_pattern(pattern, regex_group_count=None):
"""Attach a regular expression pattern matcher to a custom type converter
function.
This annotates the type converter with the :attr:`pattern` attribute.
EXAMPLE:
>>> import parse
>>> @parse.with_pattern(r"\d+")
... def parse_n... | [
"def",
"with_pattern",
"(",
"pattern",
",",
"regex_group_count",
"=",
"None",
")",
":",
"def",
"decorator",
"(",
"func",
")",
":",
"func",
".",
"pattern",
"=",
"pattern",
"func",
".",
"regex_group_count",
"=",
"regex_group_count",
"return",
"func",
"return",
... | Attach a regular expression pattern matcher to a custom type converter
function.
This annotates the type converter with the :attr:`pattern` attribute.
EXAMPLE:
>>> import parse
>>> @parse.with_pattern(r"\d+")
... def parse_number(text):
... return int(text)
is equi... | [
"Attach",
"a",
"regular",
"expression",
"pattern",
"matcher",
"to",
"a",
"custom",
"type",
"converter",
"function",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/parse.py#L433-L459 | train |
pypa/pipenv | pipenv/vendor/parse.py | int_convert | def int_convert(base):
'''Convert a string to an integer.
The string may start with a sign.
It may be of a base other than 10.
If may start with a base indicator, 0#nnnn, which we assume should
override the specified base.
It may also have other non-numeric characters that we can ignore.
... | python | def int_convert(base):
'''Convert a string to an integer.
The string may start with a sign.
It may be of a base other than 10.
If may start with a base indicator, 0#nnnn, which we assume should
override the specified base.
It may also have other non-numeric characters that we can ignore.
... | [
"def",
"int_convert",
"(",
"base",
")",
":",
"CHARS",
"=",
"'0123456789abcdefghijklmnopqrstuvwxyz'",
"def",
"f",
"(",
"string",
",",
"match",
",",
"base",
"=",
"base",
")",
":",
"if",
"string",
"[",
"0",
"]",
"==",
"'-'",
":",
"sign",
"=",
"-",
"1",
... | Convert a string to an integer.
The string may start with a sign.
It may be of a base other than 10.
If may start with a base indicator, 0#nnnn, which we assume should
override the specified base.
It may also have other non-numeric characters that we can ignore. | [
"Convert",
"a",
"string",
"to",
"an",
"integer",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/parse.py#L462-L496 | train |
pypa/pipenv | pipenv/vendor/parse.py | date_convert | def date_convert(string, match, ymd=None, mdy=None, dmy=None,
d_m_y=None, hms=None, am=None, tz=None, mm=None, dd=None):
'''Convert the incoming string containing some date / time info into a
datetime instance.
'''
groups = match.groups()
time_only = False
if mm and dd:
y=datetim... | python | def date_convert(string, match, ymd=None, mdy=None, dmy=None,
d_m_y=None, hms=None, am=None, tz=None, mm=None, dd=None):
'''Convert the incoming string containing some date / time info into a
datetime instance.
'''
groups = match.groups()
time_only = False
if mm and dd:
y=datetim... | [
"def",
"date_convert",
"(",
"string",
",",
"match",
",",
"ymd",
"=",
"None",
",",
"mdy",
"=",
"None",
",",
"dmy",
"=",
"None",
",",
"d_m_y",
"=",
"None",
",",
"hms",
"=",
"None",
",",
"am",
"=",
"None",
",",
"tz",
"=",
"None",
",",
"mm",
"=",
... | Convert the incoming string containing some date / time info into a
datetime instance. | [
"Convert",
"the",
"incoming",
"string",
"containing",
"some",
"date",
"/",
"time",
"info",
"into",
"a",
"datetime",
"instance",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/parse.py#L551-L636 | train |
pypa/pipenv | pipenv/vendor/parse.py | extract_format | def extract_format(format, extra_types):
'''Pull apart the format [[fill]align][0][width][.precision][type]
'''
fill = align = None
if format[0] in '<>=^':
align = format[0]
format = format[1:]
elif len(format) > 1 and format[1] in '<>=^':
fill = format[0]
align = for... | python | def extract_format(format, extra_types):
'''Pull apart the format [[fill]align][0][width][.precision][type]
'''
fill = align = None
if format[0] in '<>=^':
align = format[0]
format = format[1:]
elif len(format) > 1 and format[1] in '<>=^':
fill = format[0]
align = for... | [
"def",
"extract_format",
"(",
"format",
",",
"extra_types",
")",
":",
"fill",
"=",
"align",
"=",
"None",
"if",
"format",
"[",
"0",
"]",
"in",
"'<>=^'",
":",
"align",
"=",
"format",
"[",
"0",
"]",
"format",
"=",
"format",
"[",
"1",
":",
"]",
"elif",... | Pull apart the format [[fill]align][0][width][.precision][type] | [
"Pull",
"apart",
"the",
"format",
"[[",
"fill",
"]",
"align",
"]",
"[",
"0",
"]",
"[",
"width",
"]",
"[",
".",
"precision",
"]",
"[",
"type",
"]"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/parse.py#L656-L696 | train |
pypa/pipenv | pipenv/vendor/parse.py | parse | def parse(format, string, extra_types=None, evaluate_result=True, case_sensitive=False):
'''Using "format" attempt to pull values from "string".
The format must match the string contents exactly. If the value
you're looking for is instead just a part of the string use
search().
If ``evaluate_resul... | python | def parse(format, string, extra_types=None, evaluate_result=True, case_sensitive=False):
'''Using "format" attempt to pull values from "string".
The format must match the string contents exactly. If the value
you're looking for is instead just a part of the string use
search().
If ``evaluate_resul... | [
"def",
"parse",
"(",
"format",
",",
"string",
",",
"extra_types",
"=",
"None",
",",
"evaluate_result",
"=",
"True",
",",
"case_sensitive",
"=",
"False",
")",
":",
"p",
"=",
"Parser",
"(",
"format",
",",
"extra_types",
"=",
"extra_types",
",",
"case_sensiti... | Using "format" attempt to pull values from "string".
The format must match the string contents exactly. If the value
you're looking for is instead just a part of the string use
search().
If ``evaluate_result`` is True the return value will be an Result instance with two attributes:
.fixed - tupl... | [
"Using",
"format",
"attempt",
"to",
"pull",
"values",
"from",
"string",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/parse.py#L1201-L1228 | train |
pypa/pipenv | pipenv/vendor/parse.py | search | def search(format, string, pos=0, endpos=None, extra_types=None, evaluate_result=True,
case_sensitive=False):
'''Search "string" for the first occurrence of "format".
The format may occur anywhere within the string. If
instead you wish for the format to exactly match the string
use parse().
... | python | def search(format, string, pos=0, endpos=None, extra_types=None, evaluate_result=True,
case_sensitive=False):
'''Search "string" for the first occurrence of "format".
The format may occur anywhere within the string. If
instead you wish for the format to exactly match the string
use parse().
... | [
"def",
"search",
"(",
"format",
",",
"string",
",",
"pos",
"=",
"0",
",",
"endpos",
"=",
"None",
",",
"extra_types",
"=",
"None",
",",
"evaluate_result",
"=",
"True",
",",
"case_sensitive",
"=",
"False",
")",
":",
"p",
"=",
"Parser",
"(",
"format",
"... | Search "string" for the first occurrence of "format".
The format may occur anywhere within the string. If
instead you wish for the format to exactly match the string
use parse().
Optionally start the search at "pos" character index and limit the search
to a maximum index of endpos - equivalent to ... | [
"Search",
"string",
"for",
"the",
"first",
"occurrence",
"of",
"format",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/parse.py#L1231-L1262 | train |
pypa/pipenv | pipenv/vendor/parse.py | Parser.parse | def parse(self, string, evaluate_result=True):
'''Match my format to the string exactly.
Return a Result or Match instance or None if there's no match.
'''
m = self._match_re.match(string)
if m is None:
return None
if evaluate_result:
return self... | python | def parse(self, string, evaluate_result=True):
'''Match my format to the string exactly.
Return a Result or Match instance or None if there's no match.
'''
m = self._match_re.match(string)
if m is None:
return None
if evaluate_result:
return self... | [
"def",
"parse",
"(",
"self",
",",
"string",
",",
"evaluate_result",
"=",
"True",
")",
":",
"m",
"=",
"self",
".",
"_match_re",
".",
"match",
"(",
"string",
")",
"if",
"m",
"is",
"None",
":",
"return",
"None",
"if",
"evaluate_result",
":",
"return",
"... | Match my format to the string exactly.
Return a Result or Match instance or None if there's no match. | [
"Match",
"my",
"format",
"to",
"the",
"string",
"exactly",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/parse.py#L773-L785 | train |
pypa/pipenv | pipenv/vendor/parse.py | Parser.search | def search(self, string, pos=0, endpos=None, evaluate_result=True):
'''Search the string for my format.
Optionally start the search at "pos" character index and limit the
search to a maximum index of endpos - equivalent to
search(string[:endpos]).
If the ``evaluate_result`` arg... | python | def search(self, string, pos=0, endpos=None, evaluate_result=True):
'''Search the string for my format.
Optionally start the search at "pos" character index and limit the
search to a maximum index of endpos - equivalent to
search(string[:endpos]).
If the ``evaluate_result`` arg... | [
"def",
"search",
"(",
"self",
",",
"string",
",",
"pos",
"=",
"0",
",",
"endpos",
"=",
"None",
",",
"evaluate_result",
"=",
"True",
")",
":",
"if",
"endpos",
"is",
"None",
":",
"endpos",
"=",
"len",
"(",
"string",
")",
"m",
"=",
"self",
".",
"_se... | Search the string for my format.
Optionally start the search at "pos" character index and limit the
search to a maximum index of endpos - equivalent to
search(string[:endpos]).
If the ``evaluate_result`` argument is set to ``False`` a
Match instance is returned instead of the a... | [
"Search",
"the",
"string",
"for",
"my",
"format",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/parse.py#L787-L808 | train |
pypa/pipenv | pipenv/vendor/parse.py | Parser.findall | def findall(self, string, pos=0, endpos=None, extra_types=None, evaluate_result=True):
'''Search "string" for all occurrences of "format".
Optionally start the search at "pos" character index and limit the
search to a maximum index of endpos - equivalent to
search(string[:endpos]).
... | python | def findall(self, string, pos=0, endpos=None, extra_types=None, evaluate_result=True):
'''Search "string" for all occurrences of "format".
Optionally start the search at "pos" character index and limit the
search to a maximum index of endpos - equivalent to
search(string[:endpos]).
... | [
"def",
"findall",
"(",
"self",
",",
"string",
",",
"pos",
"=",
"0",
",",
"endpos",
"=",
"None",
",",
"extra_types",
"=",
"None",
",",
"evaluate_result",
"=",
"True",
")",
":",
"if",
"endpos",
"is",
"None",
":",
"endpos",
"=",
"len",
"(",
"string",
... | Search "string" for all occurrences of "format".
Optionally start the search at "pos" character index and limit the
search to a maximum index of endpos - equivalent to
search(string[:endpos]).
Returns an iterator that holds Result or Match instances for each format match
found. | [
"Search",
"string",
"for",
"all",
"occurrences",
"of",
"format",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/parse.py#L810-L822 | train |
pypa/pipenv | pipenv/vendor/parse.py | Parser.evaluate_result | def evaluate_result(self, m):
'''Generate a Result instance for the given regex match object'''
# ok, figure the fixed fields we've pulled out and type convert them
fixed_fields = list(m.groups())
for n in self._fixed_fields:
if n in self._type_conversions:
fi... | python | def evaluate_result(self, m):
'''Generate a Result instance for the given regex match object'''
# ok, figure the fixed fields we've pulled out and type convert them
fixed_fields = list(m.groups())
for n in self._fixed_fields:
if n in self._type_conversions:
fi... | [
"def",
"evaluate_result",
"(",
"self",
",",
"m",
")",
":",
"# ok, figure the fixed fields we've pulled out and type convert them",
"fixed_fields",
"=",
"list",
"(",
"m",
".",
"groups",
"(",
")",
")",
"for",
"n",
"in",
"self",
".",
"_fixed_fields",
":",
"if",
"n"... | Generate a Result instance for the given regex match object | [
"Generate",
"a",
"Result",
"instance",
"for",
"the",
"given",
"regex",
"match",
"object"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/parse.py#L844-L873 | train |
pypa/pipenv | pipenv/cli/command.py | install | def install(
ctx,
state,
**kwargs
):
"""Installs provided packages and adds them to Pipfile, or (if no packages are given), installs all packages from Pipfile."""
from ..core import do_install
retcode = do_install(
dev=state.installstate.dev,
three=state.three,
python=st... | python | def install(
ctx,
state,
**kwargs
):
"""Installs provided packages and adds them to Pipfile, or (if no packages are given), installs all packages from Pipfile."""
from ..core import do_install
retcode = do_install(
dev=state.installstate.dev,
three=state.three,
python=st... | [
"def",
"install",
"(",
"ctx",
",",
"state",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
".",
".",
"core",
"import",
"do_install",
"retcode",
"=",
"do_install",
"(",
"dev",
"=",
"state",
".",
"installstate",
".",
"dev",
",",
"three",
"=",
"state",
".",... | Installs provided packages and adds them to Pipfile, or (if no packages are given), installs all packages from Pipfile. | [
"Installs",
"provided",
"packages",
"and",
"adds",
"them",
"to",
"Pipfile",
"or",
"(",
"if",
"no",
"packages",
"are",
"given",
")",
"installs",
"all",
"packages",
"from",
"Pipfile",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/cli/command.py#L228-L258 | train |
pypa/pipenv | pipenv/cli/command.py | uninstall | def uninstall(
ctx,
state,
all_dev=False,
all=False,
**kwargs
):
"""Un-installs a provided package and removes it from Pipfile."""
from ..core import do_uninstall
retcode = do_uninstall(
packages=state.installstate.packages,
editable_packages=state.installstate.editables,... | python | def uninstall(
ctx,
state,
all_dev=False,
all=False,
**kwargs
):
"""Un-installs a provided package and removes it from Pipfile."""
from ..core import do_uninstall
retcode = do_uninstall(
packages=state.installstate.packages,
editable_packages=state.installstate.editables,... | [
"def",
"uninstall",
"(",
"ctx",
",",
"state",
",",
"all_dev",
"=",
"False",
",",
"all",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
".",
".",
"core",
"import",
"do_uninstall",
"retcode",
"=",
"do_uninstall",
"(",
"packages",
"=",
"state",
... | Un-installs a provided package and removes it from Pipfile. | [
"Un",
"-",
"installs",
"a",
"provided",
"package",
"and",
"removes",
"it",
"from",
"Pipfile",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/cli/command.py#L280-L303 | train |
pypa/pipenv | pipenv/cli/command.py | lock | def lock(
ctx,
state,
**kwargs
):
"""Generates Pipfile.lock."""
from ..core import ensure_project, do_init, do_lock
# Ensure that virtualenv is available.
ensure_project(three=state.three, python=state.python, pypi_mirror=state.pypi_mirror)
if state.installstate.requirementstxt:
... | python | def lock(
ctx,
state,
**kwargs
):
"""Generates Pipfile.lock."""
from ..core import ensure_project, do_init, do_lock
# Ensure that virtualenv is available.
ensure_project(three=state.three, python=state.python, pypi_mirror=state.pypi_mirror)
if state.installstate.requirementstxt:
... | [
"def",
"lock",
"(",
"ctx",
",",
"state",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
".",
".",
"core",
"import",
"ensure_project",
",",
"do_init",
",",
"do_lock",
"# Ensure that virtualenv is available.",
"ensure_project",
"(",
"three",
"=",
"state",
".",
"th... | Generates Pipfile.lock. | [
"Generates",
"Pipfile",
".",
"lock",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/cli/command.py#L310-L333 | train |
pypa/pipenv | pipenv/cli/command.py | shell | def shell(
state,
fancy=False,
shell_args=None,
anyway=False,
):
"""Spawns a shell within the virtualenv."""
from ..core import load_dot_env, do_shell
# Prevent user from activating nested environments.
if "PIPENV_ACTIVE" in os.environ:
# If PIPENV_ACTIVE is set, VIRTUAL_ENV sho... | python | def shell(
state,
fancy=False,
shell_args=None,
anyway=False,
):
"""Spawns a shell within the virtualenv."""
from ..core import load_dot_env, do_shell
# Prevent user from activating nested environments.
if "PIPENV_ACTIVE" in os.environ:
# If PIPENV_ACTIVE is set, VIRTUAL_ENV sho... | [
"def",
"shell",
"(",
"state",
",",
"fancy",
"=",
"False",
",",
"shell_args",
"=",
"None",
",",
"anyway",
"=",
"False",
",",
")",
":",
"from",
".",
".",
"core",
"import",
"load_dot_env",
",",
"do_shell",
"# Prevent user from activating nested environments.",
"i... | Spawns a shell within the virtualenv. | [
"Spawns",
"a",
"shell",
"within",
"the",
"virtualenv",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/cli/command.py#L357-L391 | train |
pypa/pipenv | pipenv/cli/command.py | run | def run(state, command, args):
"""Spawns a command installed into the virtualenv."""
from ..core import do_run
do_run(
command=command, args=args, three=state.three, python=state.python, pypi_mirror=state.pypi_mirror
) | python | def run(state, command, args):
"""Spawns a command installed into the virtualenv."""
from ..core import do_run
do_run(
command=command, args=args, three=state.three, python=state.python, pypi_mirror=state.pypi_mirror
) | [
"def",
"run",
"(",
"state",
",",
"command",
",",
"args",
")",
":",
"from",
".",
".",
"core",
"import",
"do_run",
"do_run",
"(",
"command",
"=",
"command",
",",
"args",
"=",
"args",
",",
"three",
"=",
"state",
".",
"three",
",",
"python",
"=",
"stat... | Spawns a command installed into the virtualenv. | [
"Spawns",
"a",
"command",
"installed",
"into",
"the",
"virtualenv",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/cli/command.py#L403-L408 | train |
pypa/pipenv | pipenv/cli/command.py | check | def check(
state,
unused=False,
style=False,
ignore=None,
args=None,
**kwargs
):
"""Checks for security vulnerabilities and against PEP 508 markers provided in Pipfile."""
from ..core import do_check
do_check(
three=state.three,
python=state.python,
system=st... | python | def check(
state,
unused=False,
style=False,
ignore=None,
args=None,
**kwargs
):
"""Checks for security vulnerabilities and against PEP 508 markers provided in Pipfile."""
from ..core import do_check
do_check(
three=state.three,
python=state.python,
system=st... | [
"def",
"check",
"(",
"state",
",",
"unused",
"=",
"False",
",",
"style",
"=",
"False",
",",
"ignore",
"=",
"None",
",",
"args",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
".",
".",
"core",
"import",
"do_check",
"do_check",
"(",
"three"... | Checks for security vulnerabilities and against PEP 508 markers provided in Pipfile. | [
"Checks",
"for",
"security",
"vulnerabilities",
"and",
"against",
"PEP",
"508",
"markers",
"provided",
"in",
"Pipfile",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/cli/command.py#L431-L450 | train |
pypa/pipenv | pipenv/cli/command.py | update | def update(
ctx,
state,
bare=False,
dry_run=None,
outdated=False,
**kwargs
):
"""Runs lock, then sync."""
from ..core import (
ensure_project,
do_outdated,
do_lock,
do_sync,
project,
)
ensure_project(three=state.three, python=state.python,... | python | def update(
ctx,
state,
bare=False,
dry_run=None,
outdated=False,
**kwargs
):
"""Runs lock, then sync."""
from ..core import (
ensure_project,
do_outdated,
do_lock,
do_sync,
project,
)
ensure_project(three=state.three, python=state.python,... | [
"def",
"update",
"(",
"ctx",
",",
"state",
",",
"bare",
"=",
"False",
",",
"dry_run",
"=",
"None",
",",
"outdated",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
".",
".",
"core",
"import",
"(",
"ensure_project",
",",
"do_outdated",
",",
... | Runs lock, then sync. | [
"Runs",
"lock",
"then",
"sync",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/cli/command.py#L462-L527 | train |
pypa/pipenv | pipenv/cli/command.py | graph | def graph(bare=False, json=False, json_tree=False, reverse=False):
"""Displays currently-installed dependency graph information."""
from ..core import do_graph
do_graph(bare=bare, json=json, json_tree=json_tree, reverse=reverse) | python | def graph(bare=False, json=False, json_tree=False, reverse=False):
"""Displays currently-installed dependency graph information."""
from ..core import do_graph
do_graph(bare=bare, json=json, json_tree=json_tree, reverse=reverse) | [
"def",
"graph",
"(",
"bare",
"=",
"False",
",",
"json",
"=",
"False",
",",
"json_tree",
"=",
"False",
",",
"reverse",
"=",
"False",
")",
":",
"from",
".",
".",
"core",
"import",
"do_graph",
"do_graph",
"(",
"bare",
"=",
"bare",
",",
"json",
"=",
"j... | Displays currently-installed dependency graph information. | [
"Displays",
"currently",
"-",
"installed",
"dependency",
"graph",
"information",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/cli/command.py#L538-L542 | train |
pypa/pipenv | pipenv/cli/command.py | run_open | def run_open(state, module, *args, **kwargs):
"""View a given module in your editor.
This uses the EDITOR environment variable. You can temporarily override it,
for example:
EDITOR=atom pipenv open requests
"""
from ..core import which, ensure_project, inline_activate_virtual_environment
... | python | def run_open(state, module, *args, **kwargs):
"""View a given module in your editor.
This uses the EDITOR environment variable. You can temporarily override it,
for example:
EDITOR=atom pipenv open requests
"""
from ..core import which, ensure_project, inline_activate_virtual_environment
... | [
"def",
"run_open",
"(",
"state",
",",
"module",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
".",
".",
"core",
"import",
"which",
",",
"ensure_project",
",",
"inline_activate_virtual_environment",
"# Ensure that virtualenv is available.",
"ensure_p... | View a given module in your editor.
This uses the EDITOR environment variable. You can temporarily override it,
for example:
EDITOR=atom pipenv open requests | [
"View",
"a",
"given",
"module",
"in",
"your",
"editor",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/cli/command.py#L552-L582 | train |
pypa/pipenv | pipenv/cli/command.py | sync | def sync(
ctx,
state,
bare=False,
user=False,
unused=False,
**kwargs
):
"""Installs all packages specified in Pipfile.lock."""
from ..core import do_sync
retcode = do_sync(
ctx=ctx,
dev=state.installstate.dev,
three=state.three,
python=state.python,
... | python | def sync(
ctx,
state,
bare=False,
user=False,
unused=False,
**kwargs
):
"""Installs all packages specified in Pipfile.lock."""
from ..core import do_sync
retcode = do_sync(
ctx=ctx,
dev=state.installstate.dev,
three=state.three,
python=state.python,
... | [
"def",
"sync",
"(",
"ctx",
",",
"state",
",",
"bare",
"=",
"False",
",",
"user",
"=",
"False",
",",
"unused",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
".",
".",
"core",
"import",
"do_sync",
"retcode",
"=",
"do_sync",
"(",
"ctx",
"... | Installs all packages specified in Pipfile.lock. | [
"Installs",
"all",
"packages",
"specified",
"in",
"Pipfile",
".",
"lock",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/cli/command.py#L593-L618 | train |
pypa/pipenv | pipenv/cli/command.py | clean | def clean(ctx, state, dry_run=False, bare=False, user=False):
"""Uninstalls all packages not specified in Pipfile.lock."""
from ..core import do_clean
do_clean(ctx=ctx, three=state.three, python=state.python, dry_run=dry_run,
system=state.system) | python | def clean(ctx, state, dry_run=False, bare=False, user=False):
"""Uninstalls all packages not specified in Pipfile.lock."""
from ..core import do_clean
do_clean(ctx=ctx, three=state.three, python=state.python, dry_run=dry_run,
system=state.system) | [
"def",
"clean",
"(",
"ctx",
",",
"state",
",",
"dry_run",
"=",
"False",
",",
"bare",
"=",
"False",
",",
"user",
"=",
"False",
")",
":",
"from",
".",
".",
"core",
"import",
"do_clean",
"do_clean",
"(",
"ctx",
"=",
"ctx",
",",
"three",
"=",
"state",
... | Uninstalls all packages not specified in Pipfile.lock. | [
"Uninstalls",
"all",
"packages",
"not",
"specified",
"in",
"Pipfile",
".",
"lock",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/cli/command.py#L632-L636 | train |
pypa/pipenv | pipenv/patched/notpip/_vendor/html5lib/_tokenizer.py | HTMLTokenizer.consumeNumberEntity | def consumeNumberEntity(self, isHex):
"""This function returns either U+FFFD or the character based on the
decimal or hexadecimal representation. It also discards ";" if present.
If not present self.tokenQueue.append({"type": tokenTypes["ParseError"]}) is invoked.
"""
allowed = ... | python | def consumeNumberEntity(self, isHex):
"""This function returns either U+FFFD or the character based on the
decimal or hexadecimal representation. It also discards ";" if present.
If not present self.tokenQueue.append({"type": tokenTypes["ParseError"]}) is invoked.
"""
allowed = ... | [
"def",
"consumeNumberEntity",
"(",
"self",
",",
"isHex",
")",
":",
"allowed",
"=",
"digits",
"radix",
"=",
"10",
"if",
"isHex",
":",
"allowed",
"=",
"hexDigits",
"radix",
"=",
"16",
"charStack",
"=",
"[",
"]",
"# Consume all the characters that are in range whil... | This function returns either U+FFFD or the character based on the
decimal or hexadecimal representation. It also discards ";" if present.
If not present self.tokenQueue.append({"type": tokenTypes["ParseError"]}) is invoked. | [
"This",
"function",
"returns",
"either",
"U",
"+",
"FFFD",
"or",
"the",
"character",
"based",
"on",
"the",
"decimal",
"or",
"hexadecimal",
"representation",
".",
"It",
"also",
"discards",
";",
"if",
"present",
".",
"If",
"not",
"present",
"self",
".",
"tok... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/_tokenizer.py#L65-L135 | train |
pypa/pipenv | pipenv/patched/notpip/_vendor/html5lib/_tokenizer.py | HTMLTokenizer.emitCurrentToken | def emitCurrentToken(self):
"""This method is a generic handler for emitting the tags. It also sets
the state to "data" because that's what's needed after a token has been
emitted.
"""
token = self.currentToken
# Add token to the queue to be yielded
if (token["typ... | python | def emitCurrentToken(self):
"""This method is a generic handler for emitting the tags. It also sets
the state to "data" because that's what's needed after a token has been
emitted.
"""
token = self.currentToken
# Add token to the queue to be yielded
if (token["typ... | [
"def",
"emitCurrentToken",
"(",
"self",
")",
":",
"token",
"=",
"self",
".",
"currentToken",
"# Add token to the queue to be yielded",
"if",
"(",
"token",
"[",
"\"type\"",
"]",
"in",
"tagTokenTypes",
")",
":",
"token",
"[",
"\"name\"",
"]",
"=",
"token",
"[",
... | This method is a generic handler for emitting the tags. It also sets
the state to "data" because that's what's needed after a token has been
emitted. | [
"This",
"method",
"is",
"a",
"generic",
"handler",
"for",
"emitting",
"the",
"tags",
".",
"It",
"also",
"sets",
"the",
"state",
"to",
"data",
"because",
"that",
"s",
"what",
"s",
"needed",
"after",
"a",
"token",
"has",
"been",
"emitted",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/_tokenizer.py#L222-L239 | train |
pypa/pipenv | pipenv/patched/notpip/_internal/operations/check.py | create_package_set_from_installed | def create_package_set_from_installed(**kwargs):
# type: (**Any) -> Tuple[PackageSet, bool]
"""Converts a list of distributions into a PackageSet.
"""
# Default to using all packages installed on the system
if kwargs == {}:
kwargs = {"local_only": False, "skip": ()}
package_set = {}
... | python | def create_package_set_from_installed(**kwargs):
# type: (**Any) -> Tuple[PackageSet, bool]
"""Converts a list of distributions into a PackageSet.
"""
# Default to using all packages installed on the system
if kwargs == {}:
kwargs = {"local_only": False, "skip": ()}
package_set = {}
... | [
"def",
"create_package_set_from_installed",
"(",
"*",
"*",
"kwargs",
")",
":",
"# type: (**Any) -> Tuple[PackageSet, bool]",
"# Default to using all packages installed on the system",
"if",
"kwargs",
"==",
"{",
"}",
":",
"kwargs",
"=",
"{",
"\"local_only\"",
":",
"False",
... | Converts a list of distributions into a PackageSet. | [
"Converts",
"a",
"list",
"of",
"distributions",
"into",
"a",
"PackageSet",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/operations/check.py#L34-L52 | train |
pypa/pipenv | pipenv/patched/notpip/_internal/operations/check.py | check_package_set | def check_package_set(package_set, should_ignore=None):
# type: (PackageSet, Optional[Callable[[str], bool]]) -> CheckResult
"""Check if a package set is consistent
If should_ignore is passed, it should be a callable that takes a
package name and returns a boolean.
"""
if should_ignore is None:... | python | def check_package_set(package_set, should_ignore=None):
# type: (PackageSet, Optional[Callable[[str], bool]]) -> CheckResult
"""Check if a package set is consistent
If should_ignore is passed, it should be a callable that takes a
package name and returns a boolean.
"""
if should_ignore is None:... | [
"def",
"check_package_set",
"(",
"package_set",
",",
"should_ignore",
"=",
"None",
")",
":",
"# type: (PackageSet, Optional[Callable[[str], bool]]) -> CheckResult",
"if",
"should_ignore",
"is",
"None",
":",
"def",
"should_ignore",
"(",
"name",
")",
":",
"return",
"False... | Check if a package set is consistent
If should_ignore is passed, it should be a callable that takes a
package name and returns a boolean. | [
"Check",
"if",
"a",
"package",
"set",
"is",
"consistent"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/operations/check.py#L55-L99 | train |
pypa/pipenv | pipenv/patched/notpip/_internal/operations/check.py | check_install_conflicts | def check_install_conflicts(to_install):
# type: (List[InstallRequirement]) -> Tuple[PackageSet, CheckResult]
"""For checking if the dependency graph would be consistent after \
installing given requirements
"""
# Start from the current state
package_set, _ = create_package_set_from_installed()
... | python | def check_install_conflicts(to_install):
# type: (List[InstallRequirement]) -> Tuple[PackageSet, CheckResult]
"""For checking if the dependency graph would be consistent after \
installing given requirements
"""
# Start from the current state
package_set, _ = create_package_set_from_installed()
... | [
"def",
"check_install_conflicts",
"(",
"to_install",
")",
":",
"# type: (List[InstallRequirement]) -> Tuple[PackageSet, CheckResult]",
"# Start from the current state",
"package_set",
",",
"_",
"=",
"create_package_set_from_installed",
"(",
")",
"# Install packages",
"would_be_instal... | For checking if the dependency graph would be consistent after \
installing given requirements | [
"For",
"checking",
"if",
"the",
"dependency",
"graph",
"would",
"be",
"consistent",
"after",
"\\",
"installing",
"given",
"requirements"
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/operations/check.py#L102-L120 | train |
pypa/pipenv | pipenv/patched/notpip/_internal/operations/check.py | _simulate_installation_of | def _simulate_installation_of(to_install, package_set):
# type: (List[InstallRequirement], PackageSet) -> Set[str]
"""Computes the version of packages after installing to_install.
"""
# Keep track of packages that were installed
installed = set()
# Modify it as installing requirement_set would... | python | def _simulate_installation_of(to_install, package_set):
# type: (List[InstallRequirement], PackageSet) -> Set[str]
"""Computes the version of packages after installing to_install.
"""
# Keep track of packages that were installed
installed = set()
# Modify it as installing requirement_set would... | [
"def",
"_simulate_installation_of",
"(",
"to_install",
",",
"package_set",
")",
":",
"# type: (List[InstallRequirement], PackageSet) -> Set[str]",
"# Keep track of packages that were installed",
"installed",
"=",
"set",
"(",
")",
"# Modify it as installing requirement_set would (assumi... | Computes the version of packages after installing to_install. | [
"Computes",
"the",
"version",
"of",
"packages",
"after",
"installing",
"to_install",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/operations/check.py#L123-L139 | train |
pypa/pipenv | pipenv/vendor/chardet/charsetprober.py | CharSetProber.filter_international_words | def filter_international_words(buf):
"""
We define three types of bytes:
alphabet: english alphabets [a-zA-Z]
international: international characters [\x80-\xFF]
marker: everything else [^a-zA-Z\x80-\xFF]
The input buffer can be thought to contain a series of words delim... | python | def filter_international_words(buf):
"""
We define three types of bytes:
alphabet: english alphabets [a-zA-Z]
international: international characters [\x80-\xFF]
marker: everything else [^a-zA-Z\x80-\xFF]
The input buffer can be thought to contain a series of words delim... | [
"def",
"filter_international_words",
"(",
"buf",
")",
":",
"filtered",
"=",
"bytearray",
"(",
")",
"# This regex expression filters out only words that have at-least one",
"# international character. The word may include one marker character at",
"# the end.",
"words",
"=",
"re",
"... | We define three types of bytes:
alphabet: english alphabets [a-zA-Z]
international: international characters [\x80-\xFF]
marker: everything else [^a-zA-Z\x80-\xFF]
The input buffer can be thought to contain a series of words delimited
by markers. This function works to filter al... | [
"We",
"define",
"three",
"types",
"of",
"bytes",
":",
"alphabet",
":",
"english",
"alphabets",
"[",
"a",
"-",
"zA",
"-",
"Z",
"]",
"international",
":",
"international",
"characters",
"[",
"\\",
"x80",
"-",
"\\",
"xFF",
"]",
"marker",
":",
"everything",
... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/chardet/charsetprober.py#L67-L101 | train |
pypa/pipenv | pipenv/vendor/chardet/charsetprober.py | CharSetProber.filter_with_english_letters | def filter_with_english_letters(buf):
"""
Returns a copy of ``buf`` that retains only the sequences of English
alphabet and high byte characters that are not between <> characters.
Also retains English alphabet and high byte characters immediately
before occurrences of >.
... | python | def filter_with_english_letters(buf):
"""
Returns a copy of ``buf`` that retains only the sequences of English
alphabet and high byte characters that are not between <> characters.
Also retains English alphabet and high byte characters immediately
before occurrences of >.
... | [
"def",
"filter_with_english_letters",
"(",
"buf",
")",
":",
"filtered",
"=",
"bytearray",
"(",
")",
"in_tag",
"=",
"False",
"prev",
"=",
"0",
"for",
"curr",
"in",
"range",
"(",
"len",
"(",
"buf",
")",
")",
":",
"# Slice here to get bytes instead of an int with... | Returns a copy of ``buf`` that retains only the sequences of English
alphabet and high byte characters that are not between <> characters.
Also retains English alphabet and high byte characters immediately
before occurrences of >.
This filter can be applied to all scripts which contain ... | [
"Returns",
"a",
"copy",
"of",
"buf",
"that",
"retains",
"only",
"the",
"sequences",
"of",
"English",
"alphabet",
"and",
"high",
"byte",
"characters",
"that",
"are",
"not",
"between",
"<",
">",
"characters",
".",
"Also",
"retains",
"English",
"alphabet",
"and... | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/chardet/charsetprober.py#L104-L145 | train |
pypa/pipenv | pipenv/vendor/pathlib2/__init__.py | _Flavour.join_parsed_parts | def join_parsed_parts(self, drv, root, parts, drv2, root2, parts2):
"""
Join the two paths represented by the respective
(drive, root, parts) tuples. Return a new (drive, root, parts) tuple.
"""
if root2:
if not drv2 and drv:
return drv, root2, [drv +... | python | def join_parsed_parts(self, drv, root, parts, drv2, root2, parts2):
"""
Join the two paths represented by the respective
(drive, root, parts) tuples. Return a new (drive, root, parts) tuple.
"""
if root2:
if not drv2 and drv:
return drv, root2, [drv +... | [
"def",
"join_parsed_parts",
"(",
"self",
",",
"drv",
",",
"root",
",",
"parts",
",",
"drv2",
",",
"root2",
",",
"parts2",
")",
":",
"if",
"root2",
":",
"if",
"not",
"drv2",
"and",
"drv",
":",
"return",
"drv",
",",
"root2",
",",
"[",
"drv",
"+",
"... | Join the two paths represented by the respective
(drive, root, parts) tuples. Return a new (drive, root, parts) tuple. | [
"Join",
"the",
"two",
"paths",
"represented",
"by",
"the",
"respective",
"(",
"drive",
"root",
"parts",
")",
"tuples",
".",
"Return",
"a",
"new",
"(",
"drive",
"root",
"parts",
")",
"tuple",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L239-L254 | train |
pypa/pipenv | pipenv/vendor/pathlib2/__init__.py | _Selector.select_from | def select_from(self, parent_path):
"""Iterate over all child paths of `parent_path` matched by this
selector. This can contain parent_path itself."""
path_cls = type(parent_path)
is_dir = path_cls.is_dir
exists = path_cls.exists
scandir = parent_path._accessor.scandir
... | python | def select_from(self, parent_path):
"""Iterate over all child paths of `parent_path` matched by this
selector. This can contain parent_path itself."""
path_cls = type(parent_path)
is_dir = path_cls.is_dir
exists = path_cls.exists
scandir = parent_path._accessor.scandir
... | [
"def",
"select_from",
"(",
"self",
",",
"parent_path",
")",
":",
"path_cls",
"=",
"type",
"(",
"parent_path",
")",
"is_dir",
"=",
"path_cls",
".",
"is_dir",
"exists",
"=",
"path_cls",
".",
"exists",
"scandir",
"=",
"parent_path",
".",
"_accessor",
".",
"sc... | Iterate over all child paths of `parent_path` matched by this
selector. This can contain parent_path itself. | [
"Iterate",
"over",
"all",
"child",
"paths",
"of",
"parent_path",
"matched",
"by",
"this",
"selector",
".",
"This",
"can",
"contain",
"parent_path",
"itself",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L639-L648 | train |
pypa/pipenv | pipenv/vendor/pathlib2/__init__.py | PurePath.as_posix | def as_posix(self):
"""Return the string representation of the path with forward (/)
slashes."""
f = self._flavour
return str(self).replace(f.sep, '/') | python | def as_posix(self):
"""Return the string representation of the path with forward (/)
slashes."""
f = self._flavour
return str(self).replace(f.sep, '/') | [
"def",
"as_posix",
"(",
"self",
")",
":",
"f",
"=",
"self",
".",
"_flavour",
"return",
"str",
"(",
"self",
")",
".",
"replace",
"(",
"f",
".",
"sep",
",",
"'/'",
")"
] | Return the string representation of the path with forward (/)
slashes. | [
"Return",
"the",
"string",
"representation",
"of",
"the",
"path",
"with",
"forward",
"(",
"/",
")",
"slashes",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L896-L900 | train |
pypa/pipenv | pipenv/vendor/pathlib2/__init__.py | PurePath.name | def name(self):
"""The final path component, if any."""
parts = self._parts
if len(parts) == (1 if (self._drv or self._root) else 0):
return ''
return parts[-1] | python | def name(self):
"""The final path component, if any."""
parts = self._parts
if len(parts) == (1 if (self._drv or self._root) else 0):
return ''
return parts[-1] | [
"def",
"name",
"(",
"self",
")",
":",
"parts",
"=",
"self",
".",
"_parts",
"if",
"len",
"(",
"parts",
")",
"==",
"(",
"1",
"if",
"(",
"self",
".",
"_drv",
"or",
"self",
".",
"_root",
")",
"else",
"0",
")",
":",
"return",
"''",
"return",
"parts"... | The final path component, if any. | [
"The",
"final",
"path",
"component",
"if",
"any",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L981-L986 | train |
pypa/pipenv | pipenv/vendor/pathlib2/__init__.py | PurePath.suffix | def suffix(self):
"""The final component's last suffix, if any."""
name = self.name
i = name.rfind('.')
if 0 < i < len(name) - 1:
return name[i:]
else:
return '' | python | def suffix(self):
"""The final component's last suffix, if any."""
name = self.name
i = name.rfind('.')
if 0 < i < len(name) - 1:
return name[i:]
else:
return '' | [
"def",
"suffix",
"(",
"self",
")",
":",
"name",
"=",
"self",
".",
"name",
"i",
"=",
"name",
".",
"rfind",
"(",
"'.'",
")",
"if",
"0",
"<",
"i",
"<",
"len",
"(",
"name",
")",
"-",
"1",
":",
"return",
"name",
"[",
"i",
":",
"]",
"else",
":",
... | The final component's last suffix, if any. | [
"The",
"final",
"component",
"s",
"last",
"suffix",
"if",
"any",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L989-L996 | train |
pypa/pipenv | pipenv/vendor/pathlib2/__init__.py | PurePath.suffixes | def suffixes(self):
"""A list of the final component's suffixes, if any."""
name = self.name
if name.endswith('.'):
return []
name = name.lstrip('.')
return ['.' + suffix for suffix in name.split('.')[1:]] | python | def suffixes(self):
"""A list of the final component's suffixes, if any."""
name = self.name
if name.endswith('.'):
return []
name = name.lstrip('.')
return ['.' + suffix for suffix in name.split('.')[1:]] | [
"def",
"suffixes",
"(",
"self",
")",
":",
"name",
"=",
"self",
".",
"name",
"if",
"name",
".",
"endswith",
"(",
"'.'",
")",
":",
"return",
"[",
"]",
"name",
"=",
"name",
".",
"lstrip",
"(",
"'.'",
")",
"return",
"[",
"'.'",
"+",
"suffix",
"for",
... | A list of the final component's suffixes, if any. | [
"A",
"list",
"of",
"the",
"final",
"component",
"s",
"suffixes",
"if",
"any",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L999-L1005 | train |
pypa/pipenv | pipenv/vendor/pathlib2/__init__.py | PurePath.stem | def stem(self):
"""The final path component, minus its last suffix."""
name = self.name
i = name.rfind('.')
if 0 < i < len(name) - 1:
return name[:i]
else:
return name | python | def stem(self):
"""The final path component, minus its last suffix."""
name = self.name
i = name.rfind('.')
if 0 < i < len(name) - 1:
return name[:i]
else:
return name | [
"def",
"stem",
"(",
"self",
")",
":",
"name",
"=",
"self",
".",
"name",
"i",
"=",
"name",
".",
"rfind",
"(",
"'.'",
")",
"if",
"0",
"<",
"i",
"<",
"len",
"(",
"name",
")",
"-",
"1",
":",
"return",
"name",
"[",
":",
"i",
"]",
"else",
":",
... | The final path component, minus its last suffix. | [
"The",
"final",
"path",
"component",
"minus",
"its",
"last",
"suffix",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L1008-L1015 | train |
pypa/pipenv | pipenv/vendor/pathlib2/__init__.py | PurePath.with_name | def with_name(self, name):
"""Return a new path with the file name changed."""
if not self.name:
raise ValueError("%r has an empty name" % (self,))
drv, root, parts = self._flavour.parse_parts((name,))
if (not name or name[-1] in [self._flavour.sep, self._flavour.altsep]
... | python | def with_name(self, name):
"""Return a new path with the file name changed."""
if not self.name:
raise ValueError("%r has an empty name" % (self,))
drv, root, parts = self._flavour.parse_parts((name,))
if (not name or name[-1] in [self._flavour.sep, self._flavour.altsep]
... | [
"def",
"with_name",
"(",
"self",
",",
"name",
")",
":",
"if",
"not",
"self",
".",
"name",
":",
"raise",
"ValueError",
"(",
"\"%r has an empty name\"",
"%",
"(",
"self",
",",
")",
")",
"drv",
",",
"root",
",",
"parts",
"=",
"self",
".",
"_flavour",
".... | Return a new path with the file name changed. | [
"Return",
"a",
"new",
"path",
"with",
"the",
"file",
"name",
"changed",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L1017-L1026 | train |
pypa/pipenv | pipenv/vendor/pathlib2/__init__.py | PurePath.with_suffix | def with_suffix(self, suffix):
"""Return a new path with the file suffix changed (or added, if
none).
"""
# XXX if suffix is None, should the current suffix be removed?
f = self._flavour
if f.sep in suffix or f.altsep and f.altsep in suffix:
raise ValueError("... | python | def with_suffix(self, suffix):
"""Return a new path with the file suffix changed (or added, if
none).
"""
# XXX if suffix is None, should the current suffix be removed?
f = self._flavour
if f.sep in suffix or f.altsep and f.altsep in suffix:
raise ValueError("... | [
"def",
"with_suffix",
"(",
"self",
",",
"suffix",
")",
":",
"# XXX if suffix is None, should the current suffix be removed?",
"f",
"=",
"self",
".",
"_flavour",
"if",
"f",
".",
"sep",
"in",
"suffix",
"or",
"f",
".",
"altsep",
"and",
"f",
".",
"altsep",
"in",
... | Return a new path with the file suffix changed (or added, if
none). | [
"Return",
"a",
"new",
"path",
"with",
"the",
"file",
"suffix",
"changed",
"(",
"or",
"added",
"if",
"none",
")",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L1028-L1047 | train |
pypa/pipenv | pipenv/vendor/pathlib2/__init__.py | PurePath.parts | def parts(self):
"""An object providing sequence-like access to the
components in the filesystem path."""
# We cache the tuple to avoid building a new one each time .parts
# is accessed. XXX is this necessary?
try:
return self._pparts
except AttributeError:
... | python | def parts(self):
"""An object providing sequence-like access to the
components in the filesystem path."""
# We cache the tuple to avoid building a new one each time .parts
# is accessed. XXX is this necessary?
try:
return self._pparts
except AttributeError:
... | [
"def",
"parts",
"(",
"self",
")",
":",
"# We cache the tuple to avoid building a new one each time .parts",
"# is accessed. XXX is this necessary?",
"try",
":",
"return",
"self",
".",
"_pparts",
"except",
"AttributeError",
":",
"self",
".",
"_pparts",
"=",
"tuple",
"(",
... | An object providing sequence-like access to the
components in the filesystem path. | [
"An",
"object",
"providing",
"sequence",
"-",
"like",
"access",
"to",
"the",
"components",
"in",
"the",
"filesystem",
"path",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L1082-L1091 | train |
pypa/pipenv | pipenv/vendor/pathlib2/__init__.py | PurePath.parent | def parent(self):
"""The logical parent of the path."""
drv = self._drv
root = self._root
parts = self._parts
if len(parts) == 1 and (drv or root):
return self
return self._from_parsed_parts(drv, root, parts[:-1]) | python | def parent(self):
"""The logical parent of the path."""
drv = self._drv
root = self._root
parts = self._parts
if len(parts) == 1 and (drv or root):
return self
return self._from_parsed_parts(drv, root, parts[:-1]) | [
"def",
"parent",
"(",
"self",
")",
":",
"drv",
"=",
"self",
".",
"_drv",
"root",
"=",
"self",
".",
"_root",
"parts",
"=",
"self",
".",
"_parts",
"if",
"len",
"(",
"parts",
")",
"==",
"1",
"and",
"(",
"drv",
"or",
"root",
")",
":",
"return",
"se... | The logical parent of the path. | [
"The",
"logical",
"parent",
"of",
"the",
"path",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L1112-L1119 | train |
pypa/pipenv | pipenv/vendor/pathlib2/__init__.py | PurePath.is_absolute | def is_absolute(self):
"""True if the path is absolute (has both a root and, if applicable,
a drive)."""
if not self._root:
return False
return not self._flavour.has_drv or bool(self._drv) | python | def is_absolute(self):
"""True if the path is absolute (has both a root and, if applicable,
a drive)."""
if not self._root:
return False
return not self._flavour.has_drv or bool(self._drv) | [
"def",
"is_absolute",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_root",
":",
"return",
"False",
"return",
"not",
"self",
".",
"_flavour",
".",
"has_drv",
"or",
"bool",
"(",
"self",
".",
"_drv",
")"
] | True if the path is absolute (has both a root and, if applicable,
a drive). | [
"True",
"if",
"the",
"path",
"is",
"absolute",
"(",
"has",
"both",
"a",
"root",
"and",
"if",
"applicable",
"a",
"drive",
")",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L1126-L1131 | train |
pypa/pipenv | pipenv/vendor/pathlib2/__init__.py | PurePath.match | def match(self, path_pattern):
"""
Return True if this path matches the given pattern.
"""
cf = self._flavour.casefold
path_pattern = cf(path_pattern)
drv, root, pat_parts = self._flavour.parse_parts((path_pattern,))
if not pat_parts:
raise ValueError(... | python | def match(self, path_pattern):
"""
Return True if this path matches the given pattern.
"""
cf = self._flavour.casefold
path_pattern = cf(path_pattern)
drv, root, pat_parts = self._flavour.parse_parts((path_pattern,))
if not pat_parts:
raise ValueError(... | [
"def",
"match",
"(",
"self",
",",
"path_pattern",
")",
":",
"cf",
"=",
"self",
".",
"_flavour",
".",
"casefold",
"path_pattern",
"=",
"cf",
"(",
"path_pattern",
")",
"drv",
",",
"root",
",",
"pat_parts",
"=",
"self",
".",
"_flavour",
".",
"parse_parts",
... | Return True if this path matches the given pattern. | [
"Return",
"True",
"if",
"this",
"path",
"matches",
"the",
"given",
"pattern",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L1138-L1161 | train |
pypa/pipenv | pipenv/vendor/pathlib2/__init__.py | Path._raw_open | def _raw_open(self, flags, mode=0o777):
"""
Open the file pointed by this path and return a file descriptor,
as os.open() does.
"""
if self._closed:
self._raise_closed()
return self._accessor.open(self, flags, mode) | python | def _raw_open(self, flags, mode=0o777):
"""
Open the file pointed by this path and return a file descriptor,
as os.open() does.
"""
if self._closed:
self._raise_closed()
return self._accessor.open(self, flags, mode) | [
"def",
"_raw_open",
"(",
"self",
",",
"flags",
",",
"mode",
"=",
"0o777",
")",
":",
"if",
"self",
".",
"_closed",
":",
"self",
".",
"_raise_closed",
"(",
")",
"return",
"self",
".",
"_accessor",
".",
"open",
"(",
"self",
",",
"flags",
",",
"mode",
... | Open the file pointed by this path and return a file descriptor,
as os.open() does. | [
"Open",
"the",
"file",
"pointed",
"by",
"this",
"path",
"and",
"return",
"a",
"file",
"descriptor",
"as",
"os",
".",
"open",
"()",
"does",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L1230-L1237 | train |
pypa/pipenv | pipenv/vendor/pathlib2/__init__.py | Path.samefile | def samefile(self, other_path):
"""Return whether other_path is the same or not as this file
(as returned by os.path.samefile()).
"""
if hasattr(os.path, "samestat"):
st = self.stat()
try:
other_st = other_path.stat()
except AttributeEr... | python | def samefile(self, other_path):
"""Return whether other_path is the same or not as this file
(as returned by os.path.samefile()).
"""
if hasattr(os.path, "samestat"):
st = self.stat()
try:
other_st = other_path.stat()
except AttributeEr... | [
"def",
"samefile",
"(",
"self",
",",
"other_path",
")",
":",
"if",
"hasattr",
"(",
"os",
".",
"path",
",",
"\"samestat\"",
")",
":",
"st",
"=",
"self",
".",
"stat",
"(",
")",
"try",
":",
"other_st",
"=",
"other_path",
".",
"stat",
"(",
")",
"except... | Return whether other_path is the same or not as this file
(as returned by os.path.samefile()). | [
"Return",
"whether",
"other_path",
"is",
"the",
"same",
"or",
"not",
"as",
"this",
"file",
"(",
"as",
"returned",
"by",
"os",
".",
"path",
".",
"samefile",
"()",
")",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L1255-L1271 | train |
pypa/pipenv | pipenv/vendor/pathlib2/__init__.py | Path.iterdir | def iterdir(self):
"""Iterate over the files in this directory. Does not yield any
result for the special paths '.' and '..'.
"""
if self._closed:
self._raise_closed()
for name in self._accessor.listdir(self):
if name in ('.', '..'):
# Yie... | python | def iterdir(self):
"""Iterate over the files in this directory. Does not yield any
result for the special paths '.' and '..'.
"""
if self._closed:
self._raise_closed()
for name in self._accessor.listdir(self):
if name in ('.', '..'):
# Yie... | [
"def",
"iterdir",
"(",
"self",
")",
":",
"if",
"self",
".",
"_closed",
":",
"self",
".",
"_raise_closed",
"(",
")",
"for",
"name",
"in",
"self",
".",
"_accessor",
".",
"listdir",
"(",
"self",
")",
":",
"if",
"name",
"in",
"(",
"'.'",
",",
"'..'",
... | Iterate over the files in this directory. Does not yield any
result for the special paths '.' and '..'. | [
"Iterate",
"over",
"the",
"files",
"in",
"this",
"directory",
".",
"Does",
"not",
"yield",
"any",
"result",
"for",
"the",
"special",
"paths",
".",
"and",
"..",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L1273-L1285 | train |
pypa/pipenv | pipenv/vendor/pathlib2/__init__.py | Path.touch | def touch(self, mode=0o666, exist_ok=True):
"""
Create this file with the given access mode, if it doesn't exist.
"""
if self._closed:
self._raise_closed()
if exist_ok:
# First try to bump modification time
# Implementation note: GNU touch uses... | python | def touch(self, mode=0o666, exist_ok=True):
"""
Create this file with the given access mode, if it doesn't exist.
"""
if self._closed:
self._raise_closed()
if exist_ok:
# First try to bump modification time
# Implementation note: GNU touch uses... | [
"def",
"touch",
"(",
"self",
",",
"mode",
"=",
"0o666",
",",
"exist_ok",
"=",
"True",
")",
":",
"if",
"self",
".",
"_closed",
":",
"self",
".",
"_raise_closed",
"(",
")",
"if",
"exist_ok",
":",
"# First try to bump modification time",
"# Implementation note: G... | Create this file with the given access mode, if it doesn't exist. | [
"Create",
"this",
"file",
"with",
"the",
"given",
"access",
"mode",
"if",
"it",
"doesn",
"t",
"exist",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L1424-L1445 | train |
pypa/pipenv | pipenv/vendor/pathlib2/__init__.py | Path.mkdir | def mkdir(self, mode=0o777, parents=False, exist_ok=False):
"""
Create a new directory at this given path.
"""
if self._closed:
self._raise_closed()
def _try_func():
self._accessor.mkdir(self, mode)
def _exc_func(exc):
if not parents ... | python | def mkdir(self, mode=0o777, parents=False, exist_ok=False):
"""
Create a new directory at this given path.
"""
if self._closed:
self._raise_closed()
def _try_func():
self._accessor.mkdir(self, mode)
def _exc_func(exc):
if not parents ... | [
"def",
"mkdir",
"(",
"self",
",",
"mode",
"=",
"0o777",
",",
"parents",
"=",
"False",
",",
"exist_ok",
"=",
"False",
")",
":",
"if",
"self",
".",
"_closed",
":",
"self",
".",
"_raise_closed",
"(",
")",
"def",
"_try_func",
"(",
")",
":",
"self",
"."... | Create a new directory at this given path. | [
"Create",
"a",
"new",
"directory",
"at",
"this",
"given",
"path",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L1447-L1467 | train |
pypa/pipenv | pipenv/vendor/pathlib2/__init__.py | Path.chmod | def chmod(self, mode):
"""
Change the permissions of the path, like os.chmod().
"""
if self._closed:
self._raise_closed()
self._accessor.chmod(self, mode) | python | def chmod(self, mode):
"""
Change the permissions of the path, like os.chmod().
"""
if self._closed:
self._raise_closed()
self._accessor.chmod(self, mode) | [
"def",
"chmod",
"(",
"self",
",",
"mode",
")",
":",
"if",
"self",
".",
"_closed",
":",
"self",
".",
"_raise_closed",
"(",
")",
"self",
".",
"_accessor",
".",
"chmod",
"(",
"self",
",",
"mode",
")"
] | Change the permissions of the path, like os.chmod(). | [
"Change",
"the",
"permissions",
"of",
"the",
"path",
"like",
"os",
".",
"chmod",
"()",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L1469-L1475 | train |
pypa/pipenv | pipenv/vendor/pathlib2/__init__.py | Path.lchmod | def lchmod(self, mode):
"""
Like chmod(), except if the path points to a symlink, the symlink's
permissions are changed, rather than its target's.
"""
if self._closed:
self._raise_closed()
self._accessor.lchmod(self, mode) | python | def lchmod(self, mode):
"""
Like chmod(), except if the path points to a symlink, the symlink's
permissions are changed, rather than its target's.
"""
if self._closed:
self._raise_closed()
self._accessor.lchmod(self, mode) | [
"def",
"lchmod",
"(",
"self",
",",
"mode",
")",
":",
"if",
"self",
".",
"_closed",
":",
"self",
".",
"_raise_closed",
"(",
")",
"self",
".",
"_accessor",
".",
"lchmod",
"(",
"self",
",",
"mode",
")"
] | Like chmod(), except if the path points to a symlink, the symlink's
permissions are changed, rather than its target's. | [
"Like",
"chmod",
"()",
"except",
"if",
"the",
"path",
"points",
"to",
"a",
"symlink",
"the",
"symlink",
"s",
"permissions",
"are",
"changed",
"rather",
"than",
"its",
"target",
"s",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L1477-L1484 | train |
pypa/pipenv | pipenv/vendor/pathlib2/__init__.py | Path.unlink | def unlink(self):
"""
Remove this file or link.
If the path is a directory, use rmdir() instead.
"""
if self._closed:
self._raise_closed()
self._accessor.unlink(self) | python | def unlink(self):
"""
Remove this file or link.
If the path is a directory, use rmdir() instead.
"""
if self._closed:
self._raise_closed()
self._accessor.unlink(self) | [
"def",
"unlink",
"(",
"self",
")",
":",
"if",
"self",
".",
"_closed",
":",
"self",
".",
"_raise_closed",
"(",
")",
"self",
".",
"_accessor",
".",
"unlink",
"(",
"self",
")"
] | Remove this file or link.
If the path is a directory, use rmdir() instead. | [
"Remove",
"this",
"file",
"or",
"link",
".",
"If",
"the",
"path",
"is",
"a",
"directory",
"use",
"rmdir",
"()",
"instead",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L1486-L1493 | train |
pypa/pipenv | pipenv/vendor/pathlib2/__init__.py | Path.rmdir | def rmdir(self):
"""
Remove this directory. The directory must be empty.
"""
if self._closed:
self._raise_closed()
self._accessor.rmdir(self) | python | def rmdir(self):
"""
Remove this directory. The directory must be empty.
"""
if self._closed:
self._raise_closed()
self._accessor.rmdir(self) | [
"def",
"rmdir",
"(",
"self",
")",
":",
"if",
"self",
".",
"_closed",
":",
"self",
".",
"_raise_closed",
"(",
")",
"self",
".",
"_accessor",
".",
"rmdir",
"(",
"self",
")"
] | Remove this directory. The directory must be empty. | [
"Remove",
"this",
"directory",
".",
"The",
"directory",
"must",
"be",
"empty",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L1495-L1501 | train |
pypa/pipenv | pipenv/vendor/pathlib2/__init__.py | Path.lstat | def lstat(self):
"""
Like stat(), except if the path points to a symlink, the symlink's
status information is returned, rather than its target's.
"""
if self._closed:
self._raise_closed()
return self._accessor.lstat(self) | python | def lstat(self):
"""
Like stat(), except if the path points to a symlink, the symlink's
status information is returned, rather than its target's.
"""
if self._closed:
self._raise_closed()
return self._accessor.lstat(self) | [
"def",
"lstat",
"(",
"self",
")",
":",
"if",
"self",
".",
"_closed",
":",
"self",
".",
"_raise_closed",
"(",
")",
"return",
"self",
".",
"_accessor",
".",
"lstat",
"(",
"self",
")"
] | Like stat(), except if the path points to a symlink, the symlink's
status information is returned, rather than its target's. | [
"Like",
"stat",
"()",
"except",
"if",
"the",
"path",
"points",
"to",
"a",
"symlink",
"the",
"symlink",
"s",
"status",
"information",
"is",
"returned",
"rather",
"than",
"its",
"target",
"s",
"."
] | cae8d76c210b9777e90aab76e9c4b0e53bb19cde | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L1503-L1510 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.