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/click/core.py
Context.ensure_object
def ensure_object(self, object_type): """Like :meth:`find_object` but sets the innermost object to a new instance of `object_type` if it does not exist. """ rv = self.find_object(object_type) if rv is None: self.obj = rv = object_type() return rv
python
def ensure_object(self, object_type): """Like :meth:`find_object` but sets the innermost object to a new instance of `object_type` if it does not exist. """ rv = self.find_object(object_type) if rv is None: self.obj = rv = object_type() return rv
[ "def", "ensure_object", "(", "self", ",", "object_type", ")", ":", "rv", "=", "self", ".", "find_object", "(", "object_type", ")", "if", "rv", "is", "None", ":", "self", ".", "obj", "=", "rv", "=", "object_type", "(", ")", "return", "rv" ]
Like :meth:`find_object` but sets the innermost object to a new instance of `object_type` if it does not exist.
[ "Like", ":", "meth", ":", "find_object", "but", "sets", "the", "innermost", "object", "to", "a", "new", "instance", "of", "object_type", "if", "it", "does", "not", "exist", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L471-L478
train
pypa/pipenv
pipenv/vendor/click/core.py
Context.lookup_default
def lookup_default(self, name): """Looks up the default for a parameter name. This by default looks into the :attr:`default_map` if available. """ if self.default_map is not None: rv = self.default_map.get(name) if callable(rv): rv = rv() ...
python
def lookup_default(self, name): """Looks up the default for a parameter name. This by default looks into the :attr:`default_map` if available. """ if self.default_map is not None: rv = self.default_map.get(name) if callable(rv): rv = rv() ...
[ "def", "lookup_default", "(", "self", ",", "name", ")", ":", "if", "self", ".", "default_map", "is", "not", "None", ":", "rv", "=", "self", ".", "default_map", ".", "get", "(", "name", ")", "if", "callable", "(", "rv", ")", ":", "rv", "=", "rv", ...
Looks up the default for a parameter name. This by default looks into the :attr:`default_map` if available.
[ "Looks", "up", "the", "default", "for", "a", "parameter", "name", ".", "This", "by", "default", "looks", "into", "the", ":", "attr", ":", "default_map", "if", "available", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L480-L488
train
pypa/pipenv
pipenv/vendor/click/core.py
Context.invoke
def invoke(*args, **kwargs): """Invokes a command callback in exactly the way it expects. There are two ways to invoke this method: 1. the first argument can be a callback and all other arguments and keyword arguments are forwarded directly to the function. 2. the first a...
python
def invoke(*args, **kwargs): """Invokes a command callback in exactly the way it expects. There are two ways to invoke this method: 1. the first argument can be a callback and all other arguments and keyword arguments are forwarded directly to the function. 2. the first a...
[ "def", "invoke", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ",", "callback", "=", "args", "[", ":", "2", "]", "ctx", "=", "self", "# It's also possible to invoke another command which might or", "# might not have a callback. In that case we also fil...
Invokes a command callback in exactly the way it expects. There are two ways to invoke this method: 1. the first argument can be a callback and all other arguments and keyword arguments are forwarded directly to the function. 2. the first argument is a click command object. In t...
[ "Invokes", "a", "command", "callback", "in", "exactly", "the", "way", "it", "expects", ".", "There", "are", "two", "ways", "to", "invoke", "this", "method", ":" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L518-L555
train
pypa/pipenv
pipenv/vendor/click/core.py
Context.forward
def forward(*args, **kwargs): """Similar to :meth:`invoke` but fills in default keyword arguments from the current context if the other command expects it. This cannot invoke callbacks directly, only other commands. """ self, cmd = args[:2] # It's also possible to invok...
python
def forward(*args, **kwargs): """Similar to :meth:`invoke` but fills in default keyword arguments from the current context if the other command expects it. This cannot invoke callbacks directly, only other commands. """ self, cmd = args[:2] # It's also possible to invok...
[ "def", "forward", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ",", "cmd", "=", "args", "[", ":", "2", "]", "# It's also possible to invoke another command which might or", "# might not have a callback.", "if", "not", "isinstance", "(", "cmd", ",...
Similar to :meth:`invoke` but fills in default keyword arguments from the current context if the other command expects it. This cannot invoke callbacks directly, only other commands.
[ "Similar", "to", ":", "meth", ":", "invoke", "but", "fills", "in", "default", "keyword", "arguments", "from", "the", "current", "context", "if", "the", "other", "command", "expects", "it", ".", "This", "cannot", "invoke", "callbacks", "directly", "only", "ot...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L557-L573
train
pypa/pipenv
pipenv/vendor/click/core.py
BaseCommand.main
def main(self, args=None, prog_name=None, complete_var=None, standalone_mode=True, **extra): """This is the way to invoke a script with all the bells and whistles as a command line application. This will always terminate the application after a call. If this is not wanted, ``Syste...
python
def main(self, args=None, prog_name=None, complete_var=None, standalone_mode=True, **extra): """This is the way to invoke a script with all the bells and whistles as a command line application. This will always terminate the application after a call. If this is not wanted, ``Syste...
[ "def", "main", "(", "self", ",", "args", "=", "None", ",", "prog_name", "=", "None", ",", "complete_var", "=", "None", ",", "standalone_mode", "=", "True", ",", "*", "*", "extra", ")", ":", "# If we are in Python 3, we will verify that the environment is", "# sa...
This is the way to invoke a script with all the bells and whistles as a command line application. This will always terminate the application after a call. If this is not wanted, ``SystemExit`` needs to be caught. This method is also available by directly calling the instance of ...
[ "This", "is", "the", "way", "to", "invoke", "a", "script", "with", "all", "the", "bells", "and", "whistles", "as", "a", "command", "line", "application", ".", "This", "will", "always", "terminate", "the", "application", "after", "a", "call", ".", "If", "...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L658-L760
train
pypa/pipenv
pipenv/vendor/click/core.py
Command.format_usage
def format_usage(self, ctx, formatter): """Writes the usage line into the formatter.""" pieces = self.collect_usage_pieces(ctx) formatter.write_usage(ctx.command_path, ' '.join(pieces))
python
def format_usage(self, ctx, formatter): """Writes the usage line into the formatter.""" pieces = self.collect_usage_pieces(ctx) formatter.write_usage(ctx.command_path, ' '.join(pieces))
[ "def", "format_usage", "(", "self", ",", "ctx", ",", "formatter", ")", ":", "pieces", "=", "self", ".", "collect_usage_pieces", "(", "ctx", ")", "formatter", ".", "write_usage", "(", "ctx", ".", "command_path", ",", "' '", ".", "join", "(", "pieces", ")"...
Writes the usage line into the formatter.
[ "Writes", "the", "usage", "line", "into", "the", "formatter", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L830-L833
train
pypa/pipenv
pipenv/vendor/click/core.py
Command.collect_usage_pieces
def collect_usage_pieces(self, ctx): """Returns all the pieces that go into the usage line and returns it as a list of strings. """ rv = [self.options_metavar] for param in self.get_params(ctx): rv.extend(param.get_usage_pieces(ctx)) return rv
python
def collect_usage_pieces(self, ctx): """Returns all the pieces that go into the usage line and returns it as a list of strings. """ rv = [self.options_metavar] for param in self.get_params(ctx): rv.extend(param.get_usage_pieces(ctx)) return rv
[ "def", "collect_usage_pieces", "(", "self", ",", "ctx", ")", ":", "rv", "=", "[", "self", ".", "options_metavar", "]", "for", "param", "in", "self", ".", "get_params", "(", "ctx", ")", ":", "rv", ".", "extend", "(", "param", ".", "get_usage_pieces", "(...
Returns all the pieces that go into the usage line and returns it as a list of strings.
[ "Returns", "all", "the", "pieces", "that", "go", "into", "the", "usage", "line", "and", "returns", "it", "as", "a", "list", "of", "strings", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L835-L842
train
pypa/pipenv
pipenv/vendor/click/core.py
Command.get_help_option_names
def get_help_option_names(self, ctx): """Returns the names for the help option.""" all_names = set(ctx.help_option_names) for param in self.params: all_names.difference_update(param.opts) all_names.difference_update(param.secondary_opts) return all_names
python
def get_help_option_names(self, ctx): """Returns the names for the help option.""" all_names = set(ctx.help_option_names) for param in self.params: all_names.difference_update(param.opts) all_names.difference_update(param.secondary_opts) return all_names
[ "def", "get_help_option_names", "(", "self", ",", "ctx", ")", ":", "all_names", "=", "set", "(", "ctx", ".", "help_option_names", ")", "for", "param", "in", "self", ".", "params", ":", "all_names", ".", "difference_update", "(", "param", ".", "opts", ")", ...
Returns the names for the help option.
[ "Returns", "the", "names", "for", "the", "help", "option", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L844-L850
train
pypa/pipenv
pipenv/vendor/click/core.py
Command.get_help_option
def get_help_option(self, ctx): """Returns the help option object.""" help_options = self.get_help_option_names(ctx) if not help_options or not self.add_help_option: return def show_help(ctx, param, value): if value and not ctx.resilient_parsing: ...
python
def get_help_option(self, ctx): """Returns the help option object.""" help_options = self.get_help_option_names(ctx) if not help_options or not self.add_help_option: return def show_help(ctx, param, value): if value and not ctx.resilient_parsing: ...
[ "def", "get_help_option", "(", "self", ",", "ctx", ")", ":", "help_options", "=", "self", ".", "get_help_option_names", "(", "ctx", ")", "if", "not", "help_options", "or", "not", "self", ".", "add_help_option", ":", "return", "def", "show_help", "(", "ctx", ...
Returns the help option object.
[ "Returns", "the", "help", "option", "object", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L852-L865
train
pypa/pipenv
pipenv/vendor/click/core.py
Command.make_parser
def make_parser(self, ctx): """Creates the underlying option parser for this command.""" parser = OptionParser(ctx) for param in self.get_params(ctx): param.add_to_parser(parser, ctx) return parser
python
def make_parser(self, ctx): """Creates the underlying option parser for this command.""" parser = OptionParser(ctx) for param in self.get_params(ctx): param.add_to_parser(parser, ctx) return parser
[ "def", "make_parser", "(", "self", ",", "ctx", ")", ":", "parser", "=", "OptionParser", "(", "ctx", ")", "for", "param", "in", "self", ".", "get_params", "(", "ctx", ")", ":", "param", ".", "add_to_parser", "(", "parser", ",", "ctx", ")", "return", "...
Creates the underlying option parser for this command.
[ "Creates", "the", "underlying", "option", "parser", "for", "this", "command", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L867-L872
train
pypa/pipenv
pipenv/vendor/click/core.py
Command.get_help
def get_help(self, ctx): """Formats the help into a string and returns it. This creates a formatter and will call into the following formatting methods: """ formatter = ctx.make_formatter() self.format_help(ctx, formatter) return formatter.getvalue().rstrip('\n')
python
def get_help(self, ctx): """Formats the help into a string and returns it. This creates a formatter and will call into the following formatting methods: """ formatter = ctx.make_formatter() self.format_help(ctx, formatter) return formatter.getvalue().rstrip('\n')
[ "def", "get_help", "(", "self", ",", "ctx", ")", ":", "formatter", "=", "ctx", ".", "make_formatter", "(", ")", "self", ".", "format_help", "(", "ctx", ",", "formatter", ")", "return", "formatter", ".", "getvalue", "(", ")", ".", "rstrip", "(", "'\\n'"...
Formats the help into a string and returns it. This creates a formatter and will call into the following formatting methods:
[ "Formats", "the", "help", "into", "a", "string", "and", "returns", "it", ".", "This", "creates", "a", "formatter", "and", "will", "call", "into", "the", "following", "formatting", "methods", ":" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L874-L880
train
pypa/pipenv
pipenv/vendor/click/core.py
Command.get_short_help_str
def get_short_help_str(self, limit=45): """Gets short help for the command or makes it by shortening the long help string.""" return self.short_help or self.help and make_default_short_help(self.help, limit) or ''
python
def get_short_help_str(self, limit=45): """Gets short help for the command or makes it by shortening the long help string.""" return self.short_help or self.help and make_default_short_help(self.help, limit) or ''
[ "def", "get_short_help_str", "(", "self", ",", "limit", "=", "45", ")", ":", "return", "self", ".", "short_help", "or", "self", ".", "help", "and", "make_default_short_help", "(", "self", ".", "help", ",", "limit", ")", "or", "''" ]
Gets short help for the command or makes it by shortening the long help string.
[ "Gets", "short", "help", "for", "the", "command", "or", "makes", "it", "by", "shortening", "the", "long", "help", "string", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L882-L884
train
pypa/pipenv
pipenv/vendor/click/core.py
Command.format_help
def format_help(self, ctx, formatter): """Writes the help into the formatter if it exists. This calls into the following methods: - :meth:`format_usage` - :meth:`format_help_text` - :meth:`format_options` - :meth:`format_epilog` """ self.format_u...
python
def format_help(self, ctx, formatter): """Writes the help into the formatter if it exists. This calls into the following methods: - :meth:`format_usage` - :meth:`format_help_text` - :meth:`format_options` - :meth:`format_epilog` """ self.format_u...
[ "def", "format_help", "(", "self", ",", "ctx", ",", "formatter", ")", ":", "self", ".", "format_usage", "(", "ctx", ",", "formatter", ")", "self", ".", "format_help_text", "(", "ctx", ",", "formatter", ")", "self", ".", "format_options", "(", "ctx", ",",...
Writes the help into the formatter if it exists. This calls into the following methods: - :meth:`format_usage` - :meth:`format_help_text` - :meth:`format_options` - :meth:`format_epilog`
[ "Writes", "the", "help", "into", "the", "formatter", "if", "it", "exists", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L886-L899
train
pypa/pipenv
pipenv/vendor/click/core.py
Command.format_help_text
def format_help_text(self, ctx, formatter): """Writes the help text to the formatter if it exists.""" if self.help: formatter.write_paragraph() with formatter.indentation(): help_text = self.help if self.deprecated: help_text +=...
python
def format_help_text(self, ctx, formatter): """Writes the help text to the formatter if it exists.""" if self.help: formatter.write_paragraph() with formatter.indentation(): help_text = self.help if self.deprecated: help_text +=...
[ "def", "format_help_text", "(", "self", ",", "ctx", ",", "formatter", ")", ":", "if", "self", ".", "help", ":", "formatter", ".", "write_paragraph", "(", ")", "with", "formatter", ".", "indentation", "(", ")", ":", "help_text", "=", "self", ".", "help", ...
Writes the help text to the formatter if it exists.
[ "Writes", "the", "help", "text", "to", "the", "formatter", "if", "it", "exists", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L901-L913
train
pypa/pipenv
pipenv/vendor/click/core.py
Command.format_options
def format_options(self, ctx, formatter): """Writes all the options into the formatter if they exist.""" opts = [] for param in self.get_params(ctx): rv = param.get_help_record(ctx) if rv is not None: opts.append(rv) if opts: with form...
python
def format_options(self, ctx, formatter): """Writes all the options into the formatter if they exist.""" opts = [] for param in self.get_params(ctx): rv = param.get_help_record(ctx) if rv is not None: opts.append(rv) if opts: with form...
[ "def", "format_options", "(", "self", ",", "ctx", ",", "formatter", ")", ":", "opts", "=", "[", "]", "for", "param", "in", "self", ".", "get_params", "(", "ctx", ")", ":", "rv", "=", "param", ".", "get_help_record", "(", "ctx", ")", "if", "rv", "is...
Writes all the options into the formatter if they exist.
[ "Writes", "all", "the", "options", "into", "the", "formatter", "if", "they", "exist", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L915-L925
train
pypa/pipenv
pipenv/vendor/click/core.py
Command.format_epilog
def format_epilog(self, ctx, formatter): """Writes the epilog into the formatter if it exists.""" if self.epilog: formatter.write_paragraph() with formatter.indentation(): formatter.write_text(self.epilog)
python
def format_epilog(self, ctx, formatter): """Writes the epilog into the formatter if it exists.""" if self.epilog: formatter.write_paragraph() with formatter.indentation(): formatter.write_text(self.epilog)
[ "def", "format_epilog", "(", "self", ",", "ctx", ",", "formatter", ")", ":", "if", "self", ".", "epilog", ":", "formatter", ".", "write_paragraph", "(", ")", "with", "formatter", ".", "indentation", "(", ")", ":", "formatter", ".", "write_text", "(", "se...
Writes the epilog into the formatter if it exists.
[ "Writes", "the", "epilog", "into", "the", "formatter", "if", "it", "exists", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L927-L932
train
pypa/pipenv
pipenv/vendor/click/core.py
Command.invoke
def invoke(self, ctx): """Given a context, this invokes the attached callback (if it exists) in the right way. """ _maybe_show_deprecated_notice(self) if self.callback is not None: return ctx.invoke(self.callback, **ctx.params)
python
def invoke(self, ctx): """Given a context, this invokes the attached callback (if it exists) in the right way. """ _maybe_show_deprecated_notice(self) if self.callback is not None: return ctx.invoke(self.callback, **ctx.params)
[ "def", "invoke", "(", "self", ",", "ctx", ")", ":", "_maybe_show_deprecated_notice", "(", "self", ")", "if", "self", ".", "callback", "is", "not", "None", ":", "return", "ctx", ".", "invoke", "(", "self", ".", "callback", ",", "*", "*", "ctx", ".", "...
Given a context, this invokes the attached callback (if it exists) in the right way.
[ "Given", "a", "context", "this", "invokes", "the", "attached", "callback", "(", "if", "it", "exists", ")", "in", "the", "right", "way", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L950-L956
train
pypa/pipenv
pipenv/vendor/click/core.py
MultiCommand.resultcallback
def resultcallback(self, replace=False): """Adds a result callback to the chain command. By default if a result callback is already registered this will chain them but this can be disabled with the `replace` parameter. The result callback is invoked with the return value of the subcomm...
python
def resultcallback(self, replace=False): """Adds a result callback to the chain command. By default if a result callback is already registered this will chain them but this can be disabled with the `replace` parameter. The result callback is invoked with the return value of the subcomm...
[ "def", "resultcallback", "(", "self", ",", "replace", "=", "False", ")", ":", "def", "decorator", "(", "f", ")", ":", "old_callback", "=", "self", ".", "result_callback", "if", "old_callback", "is", "None", "or", "replace", ":", "self", ".", "result_callba...
Adds a result callback to the chain command. By default if a result callback is already registered this will chain them but this can be disabled with the `replace` parameter. The result callback is invoked with the return value of the subcommand (or the list of return values from all s...
[ "Adds", "a", "result", "callback", "to", "the", "chain", "command", ".", "By", "default", "if", "a", "result", "callback", "is", "already", "registered", "this", "will", "chain", "them", "but", "this", "can", "be", "disabled", "with", "the", "replace", "pa...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L1019-L1054
train
pypa/pipenv
pipenv/vendor/click/core.py
MultiCommand.format_commands
def format_commands(self, ctx, formatter): """Extra format methods for multi methods that adds all the commands after the options. """ commands = [] for subcommand in self.list_commands(ctx): cmd = self.get_command(ctx, subcommand) # What is this, the tool...
python
def format_commands(self, ctx, formatter): """Extra format methods for multi methods that adds all the commands after the options. """ commands = [] for subcommand in self.list_commands(ctx): cmd = self.get_command(ctx, subcommand) # What is this, the tool...
[ "def", "format_commands", "(", "self", ",", "ctx", ",", "formatter", ")", ":", "commands", "=", "[", "]", "for", "subcommand", "in", "self", ".", "list_commands", "(", "ctx", ")", ":", "cmd", "=", "self", ".", "get_command", "(", "ctx", ",", "subcomman...
Extra format methods for multi methods that adds all the commands after the options.
[ "Extra", "format", "methods", "for", "multi", "methods", "that", "adds", "all", "the", "commands", "after", "the", "options", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L1056-L1082
train
pypa/pipenv
pipenv/vendor/click/core.py
Group.add_command
def add_command(self, cmd, name=None): """Registers another :class:`Command` with this group. If the name is not provided, the name of the command is used. """ name = name or cmd.name if name is None: raise TypeError('Command has no name.') _check_multicomman...
python
def add_command(self, cmd, name=None): """Registers another :class:`Command` with this group. If the name is not provided, the name of the command is used. """ name = name or cmd.name if name is None: raise TypeError('Command has no name.') _check_multicomman...
[ "def", "add_command", "(", "self", ",", "cmd", ",", "name", "=", "None", ")", ":", "name", "=", "name", "or", "cmd", ".", "name", "if", "name", "is", "None", ":", "raise", "TypeError", "(", "'Command has no name.'", ")", "_check_multicommand", "(", "self...
Registers another :class:`Command` with this group. If the name is not provided, the name of the command is used.
[ "Registers", "another", ":", "class", ":", "Command", "with", "this", "group", ".", "If", "the", "name", "is", "not", "provided", "the", "name", "of", "the", "command", "is", "used", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L1217-L1225
train
pypa/pipenv
pipenv/vendor/click/core.py
Group.command
def command(self, *args, **kwargs): """A shortcut decorator for declaring and attaching a command to the group. This takes the same arguments as :func:`command` but immediately registers the created command with this instance by calling into :meth:`add_command`. """ def ...
python
def command(self, *args, **kwargs): """A shortcut decorator for declaring and attaching a command to the group. This takes the same arguments as :func:`command` but immediately registers the created command with this instance by calling into :meth:`add_command`. """ def ...
[ "def", "command", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "def", "decorator", "(", "f", ")", ":", "cmd", "=", "command", "(", "*", "args", ",", "*", "*", "kwargs", ")", "(", "f", ")", "self", ".", "add_command", "(", ...
A shortcut decorator for declaring and attaching a command to the group. This takes the same arguments as :func:`command` but immediately registers the created command with this instance by calling into :meth:`add_command`.
[ "A", "shortcut", "decorator", "for", "declaring", "and", "attaching", "a", "command", "to", "the", "group", ".", "This", "takes", "the", "same", "arguments", "as", ":", "func", ":", "command", "but", "immediately", "registers", "the", "created", "command", "...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L1227-L1237
train
pypa/pipenv
pipenv/vendor/click/core.py
Group.group
def group(self, *args, **kwargs): """A shortcut decorator for declaring and attaching a group to the group. This takes the same arguments as :func:`group` but immediately registers the created command with this instance by calling into :meth:`add_command`. """ def decora...
python
def group(self, *args, **kwargs): """A shortcut decorator for declaring and attaching a group to the group. This takes the same arguments as :func:`group` but immediately registers the created command with this instance by calling into :meth:`add_command`. """ def decora...
[ "def", "group", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "def", "decorator", "(", "f", ")", ":", "cmd", "=", "group", "(", "*", "args", ",", "*", "*", "kwargs", ")", "(", "f", ")", "self", ".", "add_command", "(", "cm...
A shortcut decorator for declaring and attaching a group to the group. This takes the same arguments as :func:`group` but immediately registers the created command with this instance by calling into :meth:`add_command`.
[ "A", "shortcut", "decorator", "for", "declaring", "and", "attaching", "a", "group", "to", "the", "group", ".", "This", "takes", "the", "same", "arguments", "as", ":", "func", ":", "group", "but", "immediately", "registers", "the", "created", "command", "with...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L1239-L1249
train
pypa/pipenv
pipenv/vendor/click/core.py
Parameter.get_default
def get_default(self, ctx): """Given a context variable this calculates the default value.""" # Otherwise go with the regular default. if callable(self.default): rv = self.default() else: rv = self.default return self.type_cast_value(ctx, rv)
python
def get_default(self, ctx): """Given a context variable this calculates the default value.""" # Otherwise go with the regular default. if callable(self.default): rv = self.default() else: rv = self.default return self.type_cast_value(ctx, rv)
[ "def", "get_default", "(", "self", ",", "ctx", ")", ":", "# Otherwise go with the regular default.", "if", "callable", "(", "self", ".", "default", ")", ":", "rv", "=", "self", ".", "default", "(", ")", "else", ":", "rv", "=", "self", ".", "default", "re...
Given a context variable this calculates the default value.
[ "Given", "a", "context", "variable", "this", "calculates", "the", "default", "value", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L1378-L1385
train
pypa/pipenv
pipenv/vendor/click/core.py
Parameter.type_cast_value
def type_cast_value(self, ctx, value): """Given a value this runs it properly through the type system. This automatically handles things like `nargs` and `multiple` as well as composite types. """ if self.type.is_composite: if self.nargs <= 1: raise Ty...
python
def type_cast_value(self, ctx, value): """Given a value this runs it properly through the type system. This automatically handles things like `nargs` and `multiple` as well as composite types. """ if self.type.is_composite: if self.nargs <= 1: raise Ty...
[ "def", "type_cast_value", "(", "self", ",", "ctx", ",", "value", ")", ":", "if", "self", ".", "type", ".", "is_composite", ":", "if", "self", ".", "nargs", "<=", "1", ":", "raise", "TypeError", "(", "'Attempted to invoke composite type '", "'but nargs has been...
Given a value this runs it properly through the type system. This automatically handles things like `nargs` and `multiple` as well as composite types.
[ "Given", "a", "value", "this", "runs", "it", "properly", "through", "the", "type", "system", ".", "This", "automatically", "handles", "things", "like", "nargs", "and", "multiple", "as", "well", "as", "composite", "types", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L1398-L1417
train
pypa/pipenv
pipenv/vendor/click/core.py
Parameter.get_error_hint
def get_error_hint(self, ctx): """Get a stringified version of the param for use in error messages to indicate which param caused the error. """ hint_list = self.opts or [self.human_readable_name] return ' / '.join('"%s"' % x for x in hint_list)
python
def get_error_hint(self, ctx): """Get a stringified version of the param for use in error messages to indicate which param caused the error. """ hint_list = self.opts or [self.human_readable_name] return ' / '.join('"%s"' % x for x in hint_list)
[ "def", "get_error_hint", "(", "self", ",", "ctx", ")", ":", "hint_list", "=", "self", ".", "opts", "or", "[", "self", ".", "human_readable_name", "]", "return", "' / '", ".", "join", "(", "'\"%s\"'", "%", "x", "for", "x", "in", "hint_list", ")" ]
Get a stringified version of the param for use in error messages to indicate which param caused the error.
[ "Get", "a", "stringified", "version", "of", "the", "param", "for", "use", "in", "error", "messages", "to", "indicate", "which", "param", "caused", "the", "error", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L1492-L1497
train
pypa/pipenv
pipenv/vendor/click/core.py
Option.prompt_for_value
def prompt_for_value(self, ctx): """This is an alternative flow that can be activated in the full value processing if a value does not exist. It will prompt the user until a valid value exists and then returns the processed value as result. """ # Calculate the default be...
python
def prompt_for_value(self, ctx): """This is an alternative flow that can be activated in the full value processing if a value does not exist. It will prompt the user until a valid value exists and then returns the processed value as result. """ # Calculate the default be...
[ "def", "prompt_for_value", "(", "self", ",", "ctx", ")", ":", "# Calculate the default before prompting anything to be stable.", "default", "=", "self", ".", "get_default", "(", "ctx", ")", "# If this is a prompt for a flag we need to handle this", "# differently.", "if", "se...
This is an alternative flow that can be activated in the full value processing if a value does not exist. It will prompt the user until a valid value exists and then returns the processed value as result.
[ "This", "is", "an", "alternative", "flow", "that", "can", "be", "activated", "in", "the", "full", "value", "processing", "if", "a", "value", "does", "not", "exist", ".", "It", "will", "prompt", "the", "user", "until", "a", "valid", "value", "exists", "an...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/click/core.py#L1747-L1764
train
pypa/pipenv
pipenv/vendor/requirementslib/models/dependencies.py
find_all_matches
def find_all_matches(finder, ireq, pre=False): # type: (PackageFinder, InstallRequirement, bool) -> List[InstallationCandidate] """Find all matching dependencies using the supplied finder and the given ireq. :param finder: A package finder for discovering matching candidates. :type finder: :class:`...
python
def find_all_matches(finder, ireq, pre=False): # type: (PackageFinder, InstallRequirement, bool) -> List[InstallationCandidate] """Find all matching dependencies using the supplied finder and the given ireq. :param finder: A package finder for discovering matching candidates. :type finder: :class:`...
[ "def", "find_all_matches", "(", "finder", ",", "ireq", ",", "pre", "=", "False", ")", ":", "# type: (PackageFinder, InstallRequirement, bool) -> List[InstallationCandidate]", "candidates", "=", "clean_requires_python", "(", "finder", ".", "find_all_candidates", "(", "ireq",...
Find all matching dependencies using the supplied finder and the given ireq. :param finder: A package finder for discovering matching candidates. :type finder: :class:`~pip._internal.index.PackageFinder` :param ireq: An install requirement. :type ireq: :class:`~pip._internal.req.req_install.Install...
[ "Find", "all", "matching", "dependencies", "using", "the", "supplied", "finder", "and", "the", "given", "ireq", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/dependencies.py#L57-L77
train
pypa/pipenv
pipenv/vendor/requirementslib/models/dependencies.py
get_abstract_dependencies
def get_abstract_dependencies(reqs, sources=None, parent=None): """Get all abstract dependencies for a given list of requirements. Given a set of requirements, convert each requirement to an Abstract Dependency. :param reqs: A list of Requirements :type reqs: list[:class:`~requirementslib.models.requi...
python
def get_abstract_dependencies(reqs, sources=None, parent=None): """Get all abstract dependencies for a given list of requirements. Given a set of requirements, convert each requirement to an Abstract Dependency. :param reqs: A list of Requirements :type reqs: list[:class:`~requirementslib.models.requi...
[ "def", "get_abstract_dependencies", "(", "reqs", ",", "sources", "=", "None", ",", "parent", "=", "None", ")", ":", "deps", "=", "[", "]", "from", ".", "requirements", "import", "Requirement", "for", "req", "in", "reqs", ":", "if", "isinstance", "(", "re...
Get all abstract dependencies for a given list of requirements. Given a set of requirements, convert each requirement to an Abstract Dependency. :param reqs: A list of Requirements :type reqs: list[:class:`~requirementslib.models.requirements.Requirement`] :param sources: Pipfile-formatted sources, de...
[ "Get", "all", "abstract", "dependencies", "for", "a", "given", "list", "of", "requirements", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/dependencies.py#L262-L297
train
pypa/pipenv
pipenv/vendor/requirementslib/models/dependencies.py
get_dependencies
def get_dependencies(ireq, sources=None, parent=None): # type: (Union[InstallRequirement, InstallationCandidate], Optional[List[Dict[S, Union[S, bool]]]], Optional[AbstractDependency]) -> Set[S, ...] """Get all dependencies for a given install requirement. :param ireq: A single InstallRequirement :type...
python
def get_dependencies(ireq, sources=None, parent=None): # type: (Union[InstallRequirement, InstallationCandidate], Optional[List[Dict[S, Union[S, bool]]]], Optional[AbstractDependency]) -> Set[S, ...] """Get all dependencies for a given install requirement. :param ireq: A single InstallRequirement :type...
[ "def", "get_dependencies", "(", "ireq", ",", "sources", "=", "None", ",", "parent", "=", "None", ")", ":", "# type: (Union[InstallRequirement, InstallationCandidate], Optional[List[Dict[S, Union[S, bool]]]], Optional[AbstractDependency]) -> Set[S, ...]", "if", "not", "isinstance", ...
Get all dependencies for a given install requirement. :param ireq: A single InstallRequirement :type ireq: :class:`~pip._internal.req.req_install.InstallRequirement` :param sources: Pipfile-formatted sources, defaults to None :type sources: list[dict], optional :param parent: The parent of this lis...
[ "Get", "all", "dependencies", "for", "a", "given", "install", "requirement", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/dependencies.py#L300-L334
train
pypa/pipenv
pipenv/vendor/requirementslib/models/dependencies.py
get_dependencies_from_wheel_cache
def get_dependencies_from_wheel_cache(ireq): """Retrieves dependencies for the given install requirement from the wheel cache. :param ireq: A single InstallRequirement :type ireq: :class:`~pip._internal.req.req_install.InstallRequirement` :return: A set of dependency lines for generating new InstallReq...
python
def get_dependencies_from_wheel_cache(ireq): """Retrieves dependencies for the given install requirement from the wheel cache. :param ireq: A single InstallRequirement :type ireq: :class:`~pip._internal.req.req_install.InstallRequirement` :return: A set of dependency lines for generating new InstallReq...
[ "def", "get_dependencies_from_wheel_cache", "(", "ireq", ")", ":", "if", "ireq", ".", "editable", "or", "not", "is_pinned_requirement", "(", "ireq", ")", ":", "return", "matches", "=", "WHEEL_CACHE", ".", "get", "(", "ireq", ".", "link", ",", "name_from_req", ...
Retrieves dependencies for the given install requirement from the wheel cache. :param ireq: A single InstallRequirement :type ireq: :class:`~pip._internal.req.req_install.InstallRequirement` :return: A set of dependency lines for generating new InstallRequirements. :rtype: set(str) or None
[ "Retrieves", "dependencies", "for", "the", "given", "install", "requirement", "from", "the", "wheel", "cache", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/dependencies.py#L337-L354
train
pypa/pipenv
pipenv/vendor/requirementslib/models/dependencies.py
get_dependencies_from_json
def get_dependencies_from_json(ireq): """Retrieves dependencies for the given install requirement from the json api. :param ireq: A single InstallRequirement :type ireq: :class:`~pip._internal.req.req_install.InstallRequirement` :return: A set of dependency lines for generating new InstallRequirements....
python
def get_dependencies_from_json(ireq): """Retrieves dependencies for the given install requirement from the json api. :param ireq: A single InstallRequirement :type ireq: :class:`~pip._internal.req.req_install.InstallRequirement` :return: A set of dependency lines for generating new InstallRequirements....
[ "def", "get_dependencies_from_json", "(", "ireq", ")", ":", "if", "ireq", ".", "editable", "or", "not", "is_pinned_requirement", "(", "ireq", ")", ":", "return", "# It is technically possible to parse extras out of the JSON API's", "# requirement format, but it is such a chore ...
Retrieves dependencies for the given install requirement from the json api. :param ireq: A single InstallRequirement :type ireq: :class:`~pip._internal.req.req_install.InstallRequirement` :return: A set of dependency lines for generating new InstallRequirements. :rtype: set(str) or None
[ "Retrieves", "dependencies", "for", "the", "given", "install", "requirement", "from", "the", "json", "api", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/dependencies.py#L362-L408
train
pypa/pipenv
pipenv/vendor/requirementslib/models/dependencies.py
get_dependencies_from_cache
def get_dependencies_from_cache(ireq): """Retrieves dependencies for the given install requirement from the dependency cache. :param ireq: A single InstallRequirement :type ireq: :class:`~pip._internal.req.req_install.InstallRequirement` :return: A set of dependency lines for generating new InstallRequ...
python
def get_dependencies_from_cache(ireq): """Retrieves dependencies for the given install requirement from the dependency cache. :param ireq: A single InstallRequirement :type ireq: :class:`~pip._internal.req.req_install.InstallRequirement` :return: A set of dependency lines for generating new InstallRequ...
[ "def", "get_dependencies_from_cache", "(", "ireq", ")", ":", "if", "ireq", ".", "editable", "or", "not", "is_pinned_requirement", "(", "ireq", ")", ":", "return", "if", "ireq", "not", "in", "DEPENDENCY_CACHE", ":", "return", "cached", "=", "set", "(", "DEPEN...
Retrieves dependencies for the given install requirement from the dependency cache. :param ireq: A single InstallRequirement :type ireq: :class:`~pip._internal.req.req_install.InstallRequirement` :return: A set of dependency lines for generating new InstallRequirements. :rtype: set(str) or None
[ "Retrieves", "dependencies", "for", "the", "given", "install", "requirement", "from", "the", "dependency", "cache", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/dependencies.py#L411-L445
train
pypa/pipenv
pipenv/vendor/requirementslib/models/dependencies.py
get_dependencies_from_index
def get_dependencies_from_index(dep, sources=None, pip_options=None, wheel_cache=None): """Retrieves dependencies for the given install requirement from the pip resolver. :param dep: A single InstallRequirement :type dep: :class:`~pip._internal.req.req_install.InstallRequirement` :param sources: Pipfil...
python
def get_dependencies_from_index(dep, sources=None, pip_options=None, wheel_cache=None): """Retrieves dependencies for the given install requirement from the pip resolver. :param dep: A single InstallRequirement :type dep: :class:`~pip._internal.req.req_install.InstallRequirement` :param sources: Pipfil...
[ "def", "get_dependencies_from_index", "(", "dep", ",", "sources", "=", "None", ",", "pip_options", "=", "None", ",", "wheel_cache", "=", "None", ")", ":", "finder", "=", "get_finder", "(", "sources", "=", "sources", ",", "pip_options", "=", "pip_options", ")...
Retrieves dependencies for the given install requirement from the pip resolver. :param dep: A single InstallRequirement :type dep: :class:`~pip._internal.req.req_install.InstallRequirement` :param sources: Pipfile-formatted sources, defaults to None :type sources: list[dict], optional :return: A se...
[ "Retrieves", "dependencies", "for", "the", "given", "install", "requirement", "from", "the", "pip", "resolver", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/dependencies.py#L452-L544
train
pypa/pipenv
pipenv/vendor/requirementslib/models/dependencies.py
get_pip_options
def get_pip_options(args=[], sources=None, pip_command=None): """Build a pip command from a list of sources :param args: positional arguments passed through to the pip parser :param sources: A list of pipfile-formatted sources, defaults to None :param sources: list[dict], optional :param pip_comman...
python
def get_pip_options(args=[], sources=None, pip_command=None): """Build a pip command from a list of sources :param args: positional arguments passed through to the pip parser :param sources: A list of pipfile-formatted sources, defaults to None :param sources: list[dict], optional :param pip_comman...
[ "def", "get_pip_options", "(", "args", "=", "[", "]", ",", "sources", "=", "None", ",", "pip_command", "=", "None", ")", ":", "if", "not", "pip_command", ":", "pip_command", "=", "get_pip_command", "(", ")", "if", "not", "sources", ":", "sources", "=", ...
Build a pip command from a list of sources :param args: positional arguments passed through to the pip parser :param sources: A list of pipfile-formatted sources, defaults to None :param sources: list[dict], optional :param pip_command: A pre-built pip command instance :type pip_command: :class:`~p...
[ "Build", "a", "pip", "command", "from", "a", "list", "of", "sources" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/dependencies.py#L547-L570
train
pypa/pipenv
pipenv/vendor/requirementslib/models/dependencies.py
get_finder
def get_finder(sources=None, pip_command=None, pip_options=None): # type: (List[Dict[S, Union[S, bool]]], Optional[Command], Any) -> PackageFinder """Get a package finder for looking up candidates to install :param sources: A list of pipfile-formatted sources, defaults to None :param sources: list[dict...
python
def get_finder(sources=None, pip_command=None, pip_options=None): # type: (List[Dict[S, Union[S, bool]]], Optional[Command], Any) -> PackageFinder """Get a package finder for looking up candidates to install :param sources: A list of pipfile-formatted sources, defaults to None :param sources: list[dict...
[ "def", "get_finder", "(", "sources", "=", "None", ",", "pip_command", "=", "None", ",", "pip_options", "=", "None", ")", ":", "# type: (List[Dict[S, Union[S, bool]]], Optional[Command], Any) -> PackageFinder", "if", "not", "pip_command", ":", "pip_command", "=", "get_pi...
Get a package finder for looking up candidates to install :param sources: A list of pipfile-formatted sources, defaults to None :param sources: list[dict], optional :param pip_command: A pip command instance, defaults to None :type pip_command: :class:`~pip._internal.cli.base_command.Command` :para...
[ "Get", "a", "package", "finder", "for", "looking", "up", "candidates", "to", "install" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/dependencies.py#L573-L604
train
pypa/pipenv
pipenv/vendor/requirementslib/models/dependencies.py
start_resolver
def start_resolver(finder=None, wheel_cache=None): """Context manager to produce a resolver. :param finder: A package finder to use for searching the index :type finder: :class:`~pip._internal.index.PackageFinder` :return: A 3-tuple of finder, preparer, resolver :rtype: (:class:`~pip._internal.oper...
python
def start_resolver(finder=None, wheel_cache=None): """Context manager to produce a resolver. :param finder: A package finder to use for searching the index :type finder: :class:`~pip._internal.index.PackageFinder` :return: A 3-tuple of finder, preparer, resolver :rtype: (:class:`~pip._internal.oper...
[ "def", "start_resolver", "(", "finder", "=", "None", ",", "wheel_cache", "=", "None", ")", ":", "pip_command", "=", "get_pip_command", "(", ")", "pip_options", "=", "get_pip_options", "(", "pip_command", "=", "pip_command", ")", "if", "not", "finder", ":", "...
Context manager to produce a resolver. :param finder: A package finder to use for searching the index :type finder: :class:`~pip._internal.index.PackageFinder` :return: A 3-tuple of finder, preparer, resolver :rtype: (:class:`~pip._internal.operations.prepare.RequirementPreparer`, :class:`~pip._interna...
[ "Context", "manager", "to", "produce", "a", "resolver", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/dependencies.py#L608-L663
train
pypa/pipenv
pipenv/vendor/requirementslib/models/cache.py
DependencyCache.as_cache_key
def as_cache_key(self, ireq): """ Given a requirement, return its cache key. This behavior is a little weird in order to allow backwards compatibility with cache files. For a requirement without extras, this will return, for example: ("ipython", "2.1.0") For a requirement with ...
python
def as_cache_key(self, ireq): """ Given a requirement, return its cache key. This behavior is a little weird in order to allow backwards compatibility with cache files. For a requirement without extras, this will return, for example: ("ipython", "2.1.0") For a requirement with ...
[ "def", "as_cache_key", "(", "self", ",", "ireq", ")", ":", "name", ",", "version", ",", "extras", "=", "as_tuple", "(", "ireq", ")", "if", "not", "extras", ":", "extras_string", "=", "\"\"", "else", ":", "extras_string", "=", "\"[{}]\"", ".", "format", ...
Given a requirement, return its cache key. This behavior is a little weird in order to allow backwards compatibility with cache files. For a requirement without extras, this will return, for example: ("ipython", "2.1.0") For a requirement with extras, the extras will be comma-separated and app...
[ "Given", "a", "requirement", "return", "its", "cache", "key", ".", "This", "behavior", "is", "a", "little", "weird", "in", "order", "to", "allow", "backwards", "compatibility", "with", "cache", "files", ".", "For", "a", "requirement", "without", "extras", "t...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/cache.py#L86-L103
train
pypa/pipenv
pipenv/vendor/requirementslib/models/cache.py
DependencyCache.read_cache
def read_cache(self): """Reads the cached contents into memory.""" if os.path.exists(self._cache_file): self._cache = read_cache_file(self._cache_file) else: self._cache = {}
python
def read_cache(self): """Reads the cached contents into memory.""" if os.path.exists(self._cache_file): self._cache = read_cache_file(self._cache_file) else: self._cache = {}
[ "def", "read_cache", "(", "self", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "self", ".", "_cache_file", ")", ":", "self", ".", "_cache", "=", "read_cache_file", "(", "self", ".", "_cache_file", ")", "else", ":", "self", ".", "_cache", "=...
Reads the cached contents into memory.
[ "Reads", "the", "cached", "contents", "into", "memory", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/cache.py#L105-L110
train
pypa/pipenv
pipenv/vendor/requirementslib/models/cache.py
DependencyCache.write_cache
def write_cache(self): """Writes the cache to disk as JSON.""" doc = { '__format__': 1, 'dependencies': self._cache, } with open(self._cache_file, 'w') as f: json.dump(doc, f, sort_keys=True)
python
def write_cache(self): """Writes the cache to disk as JSON.""" doc = { '__format__': 1, 'dependencies': self._cache, } with open(self._cache_file, 'w') as f: json.dump(doc, f, sort_keys=True)
[ "def", "write_cache", "(", "self", ")", ":", "doc", "=", "{", "'__format__'", ":", "1", ",", "'dependencies'", ":", "self", ".", "_cache", ",", "}", "with", "open", "(", "self", ".", "_cache_file", ",", "'w'", ")", "as", "f", ":", "json", ".", "dum...
Writes the cache to disk as JSON.
[ "Writes", "the", "cache", "to", "disk", "as", "JSON", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/cache.py#L112-L119
train
pypa/pipenv
pipenv/vendor/requirementslib/models/cache.py
DependencyCache.reverse_dependencies
def reverse_dependencies(self, ireqs): """ Returns a lookup table of reverse dependencies for all the given ireqs. Since this is all static, it only works if the dependency cache contains the complete data, otherwise you end up with a partial view. This is typically no problem i...
python
def reverse_dependencies(self, ireqs): """ Returns a lookup table of reverse dependencies for all the given ireqs. Since this is all static, it only works if the dependency cache contains the complete data, otherwise you end up with a partial view. This is typically no problem i...
[ "def", "reverse_dependencies", "(", "self", ",", "ireqs", ")", ":", "ireqs_as_cache_values", "=", "[", "self", ".", "as_cache_key", "(", "ireq", ")", "for", "ireq", "in", "ireqs", "]", "return", "self", ".", "_reverse_dependencies", "(", "ireqs_as_cache_values",...
Returns a lookup table of reverse dependencies for all the given ireqs. Since this is all static, it only works if the dependency cache contains the complete data, otherwise you end up with a partial view. This is typically no problem if you use this function after the entire dependency...
[ "Returns", "a", "lookup", "table", "of", "reverse", "dependencies", "for", "all", "the", "given", "ireqs", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/cache.py#L151-L161
train
pypa/pipenv
pipenv/vendor/requirementslib/models/cache.py
DependencyCache._reverse_dependencies
def _reverse_dependencies(self, cache_keys): """ Returns a lookup table of reverse dependencies for all the given cache keys. Example input: [('pep8', '1.5.7'), ('flake8', '2.4.0'), ('mccabe', '0.3'), ('pyflakes', '0.8.1')] Example ou...
python
def _reverse_dependencies(self, cache_keys): """ Returns a lookup table of reverse dependencies for all the given cache keys. Example input: [('pep8', '1.5.7'), ('flake8', '2.4.0'), ('mccabe', '0.3'), ('pyflakes', '0.8.1')] Example ou...
[ "def", "_reverse_dependencies", "(", "self", ",", "cache_keys", ")", ":", "# First, collect all the dependencies into a sequence of (parent, child) tuples, like [('flake8', 'pep8'),", "# ('flake8', 'mccabe'), ...]", "return", "lookup_table", "(", "(", "key_from_req", "(", "Requiremen...
Returns a lookup table of reverse dependencies for all the given cache keys. Example input: [('pep8', '1.5.7'), ('flake8', '2.4.0'), ('mccabe', '0.3'), ('pyflakes', '0.8.1')] Example output: {'pep8': ['flake8'], 'flake8': []...
[ "Returns", "a", "lookup", "table", "of", "reverse", "dependencies", "for", "all", "the", "given", "cache", "keys", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/cache.py#L163-L186
train
pypa/pipenv
pipenv/vendor/requirementslib/models/cache.py
_JSONCache.as_cache_key
def as_cache_key(self, ireq): """Given a requirement, return its cache key. This behavior is a little weird in order to allow backwards compatibility with cache files. For a requirement without extras, this will return, for example:: ("ipython", "2.1.0") For a requ...
python
def as_cache_key(self, ireq): """Given a requirement, return its cache key. This behavior is a little weird in order to allow backwards compatibility with cache files. For a requirement without extras, this will return, for example:: ("ipython", "2.1.0") For a requ...
[ "def", "as_cache_key", "(", "self", ",", "ireq", ")", ":", "extras", "=", "tuple", "(", "sorted", "(", "ireq", ".", "extras", ")", ")", "if", "not", "extras", ":", "extras_string", "=", "\"\"", "else", ":", "extras_string", "=", "\"[{}]\"", ".", "forma...
Given a requirement, return its cache key. This behavior is a little weird in order to allow backwards compatibility with cache files. For a requirement without extras, this will return, for example:: ("ipython", "2.1.0") For a requirement with extras, the extras will be c...
[ "Given", "a", "requirement", "return", "its", "cache", "key", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/cache.py#L266-L287
train
pypa/pipenv
pipenv/patched/notpip/_vendor/lockfile/__init__.py
locked
def locked(path, timeout=None): """Decorator which enables locks for decorated function. Arguments: - path: path for lockfile. - timeout (optional): Timeout for acquiring lock. Usage: @locked('/var/run/myname', timeout=0) def myname(...): ... """ def decor...
python
def locked(path, timeout=None): """Decorator which enables locks for decorated function. Arguments: - path: path for lockfile. - timeout (optional): Timeout for acquiring lock. Usage: @locked('/var/run/myname', timeout=0) def myname(...): ... """ def decor...
[ "def", "locked", "(", "path", ",", "timeout", "=", "None", ")", ":", "def", "decor", "(", "func", ")", ":", "@", "functools", ".", "wraps", "(", "func", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "lock", "=", "F...
Decorator which enables locks for decorated function. Arguments: - path: path for lockfile. - timeout (optional): Timeout for acquiring lock. Usage: @locked('/var/run/myname', timeout=0) def myname(...): ...
[ "Decorator", "which", "enables", "locks", "for", "decorated", "function", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/lockfile/__init__.py#L315-L337
train
pypa/pipenv
pipenv/patched/notpip/_vendor/html5lib/treewalkers/__init__.py
getTreeWalker
def getTreeWalker(treeType, implementation=None, **kwargs): """Get a TreeWalker class for various types of tree with built-in support :arg str treeType: the name of the tree type required (case-insensitive). Supported values are: * "dom": The xml.dom.minidom DOM implementation * "etree...
python
def getTreeWalker(treeType, implementation=None, **kwargs): """Get a TreeWalker class for various types of tree with built-in support :arg str treeType: the name of the tree type required (case-insensitive). Supported values are: * "dom": The xml.dom.minidom DOM implementation * "etree...
[ "def", "getTreeWalker", "(", "treeType", ",", "implementation", "=", "None", ",", "*", "*", "kwargs", ")", ":", "treeType", "=", "treeType", ".", "lower", "(", ")", "if", "treeType", "not", "in", "treeWalkerCache", ":", "if", "treeType", "==", "\"dom\"", ...
Get a TreeWalker class for various types of tree with built-in support :arg str treeType: the name of the tree type required (case-insensitive). Supported values are: * "dom": The xml.dom.minidom DOM implementation * "etree": A generic walker for tree implementations exposing an ...
[ "Get", "a", "TreeWalker", "class", "for", "various", "types", "of", "tree", "with", "built", "-", "in", "support" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/treewalkers/__init__.py#L21-L62
train
pypa/pipenv
pipenv/patched/notpip/_vendor/html5lib/treewalkers/__init__.py
pprint
def pprint(walker): """Pretty printer for tree walkers Takes a TreeWalker instance and pretty prints the output of walking the tree. :arg walker: a TreeWalker instance """ output = [] indent = 0 for token in concatenateCharacterTokens(walker): type = token["type"] if type ...
python
def pprint(walker): """Pretty printer for tree walkers Takes a TreeWalker instance and pretty prints the output of walking the tree. :arg walker: a TreeWalker instance """ output = [] indent = 0 for token in concatenateCharacterTokens(walker): type = token["type"] if type ...
[ "def", "pprint", "(", "walker", ")", ":", "output", "=", "[", "]", "indent", "=", "0", "for", "token", "in", "concatenateCharacterTokens", "(", "walker", ")", ":", "type", "=", "token", "[", "\"type\"", "]", "if", "type", "in", "(", "\"StartTag\"", ","...
Pretty printer for tree walkers Takes a TreeWalker instance and pretty prints the output of walking the tree. :arg walker: a TreeWalker instance
[ "Pretty", "printer", "for", "tree", "walkers" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/treewalkers/__init__.py#L80-L154
train
pypa/pipenv
pipenv/vendor/yaspin/core.py
Yaspin.hide
def hide(self): """Hide the spinner to allow for custom writing to the terminal.""" thr_is_alive = self._spin_thread and self._spin_thread.is_alive() if thr_is_alive and not self._hide_spin.is_set(): # set the hidden spinner flag self._hide_spin.set() # clea...
python
def hide(self): """Hide the spinner to allow for custom writing to the terminal.""" thr_is_alive = self._spin_thread and self._spin_thread.is_alive() if thr_is_alive and not self._hide_spin.is_set(): # set the hidden spinner flag self._hide_spin.set() # clea...
[ "def", "hide", "(", "self", ")", ":", "thr_is_alive", "=", "self", ".", "_spin_thread", "and", "self", ".", "_spin_thread", ".", "is_alive", "(", ")", "if", "thr_is_alive", "and", "not", "self", ".", "_hide_spin", ".", "is_set", "(", ")", ":", "# set the...
Hide the spinner to allow for custom writing to the terminal.
[ "Hide", "the", "spinner", "to", "allow", "for", "custom", "writing", "to", "the", "terminal", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/yaspin/core.py#L251-L264
train
pypa/pipenv
pipenv/vendor/yaspin/core.py
Yaspin.show
def show(self): """Show the hidden spinner.""" thr_is_alive = self._spin_thread and self._spin_thread.is_alive() if thr_is_alive and self._hide_spin.is_set(): # clear the hidden spinner flag self._hide_spin.clear() # clear the current line so the spinner is ...
python
def show(self): """Show the hidden spinner.""" thr_is_alive = self._spin_thread and self._spin_thread.is_alive() if thr_is_alive and self._hide_spin.is_set(): # clear the hidden spinner flag self._hide_spin.clear() # clear the current line so the spinner is ...
[ "def", "show", "(", "self", ")", ":", "thr_is_alive", "=", "self", ".", "_spin_thread", "and", "self", ".", "_spin_thread", ".", "is_alive", "(", ")", "if", "thr_is_alive", "and", "self", ".", "_hide_spin", ".", "is_set", "(", ")", ":", "# clear the hidden...
Show the hidden spinner.
[ "Show", "the", "hidden", "spinner", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/yaspin/core.py#L266-L276
train
pypa/pipenv
pipenv/vendor/yaspin/core.py
Yaspin.write
def write(self, text): """Write text in the terminal without breaking the spinner.""" # similar to tqdm.write() # https://pypi.python.org/pypi/tqdm#writing-messages sys.stdout.write("\r") self._clear_line() _text = to_unicode(text) if PY2: _text = _te...
python
def write(self, text): """Write text in the terminal without breaking the spinner.""" # similar to tqdm.write() # https://pypi.python.org/pypi/tqdm#writing-messages sys.stdout.write("\r") self._clear_line() _text = to_unicode(text) if PY2: _text = _te...
[ "def", "write", "(", "self", ",", "text", ")", ":", "# similar to tqdm.write()", "# https://pypi.python.org/pypi/tqdm#writing-messages", "sys", ".", "stdout", ".", "write", "(", "\"\\r\"", ")", "self", ".", "_clear_line", "(", ")", "_text", "=", "to_unicode", "(",...
Write text in the terminal without breaking the spinner.
[ "Write", "text", "in", "the", "terminal", "without", "breaking", "the", "spinner", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/yaspin/core.py#L278-L292
train
pypa/pipenv
pipenv/vendor/yaspin/core.py
Yaspin._freeze
def _freeze(self, final_text): """Stop spinner, compose last frame and 'freeze' it.""" text = to_unicode(final_text) self._last_frame = self._compose_out(text, mode="last") # Should be stopped here, otherwise prints after # self._freeze call will mess up the spinner self...
python
def _freeze(self, final_text): """Stop spinner, compose last frame and 'freeze' it.""" text = to_unicode(final_text) self._last_frame = self._compose_out(text, mode="last") # Should be stopped here, otherwise prints after # self._freeze call will mess up the spinner self...
[ "def", "_freeze", "(", "self", ",", "final_text", ")", ":", "text", "=", "to_unicode", "(", "final_text", ")", "self", ".", "_last_frame", "=", "self", ".", "_compose_out", "(", "text", ",", "mode", "=", "\"last\"", ")", "# Should be stopped here, otherwise pr...
Stop spinner, compose last frame and 'freeze' it.
[ "Stop", "spinner", "compose", "last", "frame", "and", "freeze", "it", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/yaspin/core.py#L307-L315
train
pypa/pipenv
pipenv/patched/notpip/_internal/vcs/__init__.py
RevOptions.to_args
def to_args(self): # type: () -> List[str] """ Return the VCS-specific command arguments. """ args = [] # type: List[str] rev = self.arg_rev if rev is not None: args += self.vcs.get_base_rev_args(rev) args += self.extra_args return ar...
python
def to_args(self): # type: () -> List[str] """ Return the VCS-specific command arguments. """ args = [] # type: List[str] rev = self.arg_rev if rev is not None: args += self.vcs.get_base_rev_args(rev) args += self.extra_args return ar...
[ "def", "to_args", "(", "self", ")", ":", "# type: () -> List[str]", "args", "=", "[", "]", "# type: List[str]", "rev", "=", "self", ".", "arg_rev", "if", "rev", "is", "not", "None", ":", "args", "+=", "self", ".", "vcs", ".", "get_base_rev_args", "(", "r...
Return the VCS-specific command arguments.
[ "Return", "the", "VCS", "-", "specific", "command", "arguments", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/vcs/__init__.py#L71-L82
train
pypa/pipenv
pipenv/patched/notpip/_internal/vcs/__init__.py
RevOptions.make_new
def make_new(self, rev): # type: (str) -> RevOptions """ Make a copy of the current instance, but with a new rev. Args: rev: the name of the revision for the new object. """ return self.vcs.make_rev_options(rev, extra_args=self.extra_args)
python
def make_new(self, rev): # type: (str) -> RevOptions """ Make a copy of the current instance, but with a new rev. Args: rev: the name of the revision for the new object. """ return self.vcs.make_rev_options(rev, extra_args=self.extra_args)
[ "def", "make_new", "(", "self", ",", "rev", ")", ":", "# type: (str) -> RevOptions", "return", "self", ".", "vcs", ".", "make_rev_options", "(", "rev", ",", "extra_args", "=", "self", ".", "extra_args", ")" ]
Make a copy of the current instance, but with a new rev. Args: rev: the name of the revision for the new object.
[ "Make", "a", "copy", "of", "the", "current", "instance", "but", "with", "a", "new", "rev", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/vcs/__init__.py#L91-L99
train
pypa/pipenv
pipenv/patched/notpip/_internal/vcs/__init__.py
VcsSupport.get_backend_type
def get_backend_type(self, location): # type: (str) -> Optional[Type[VersionControl]] """ Return the type of the version control backend if found at given location, e.g. vcs.get_backend_type('/path/to/vcs/checkout') """ for vc_type in self._registry.values(): ...
python
def get_backend_type(self, location): # type: (str) -> Optional[Type[VersionControl]] """ Return the type of the version control backend if found at given location, e.g. vcs.get_backend_type('/path/to/vcs/checkout') """ for vc_type in self._registry.values(): ...
[ "def", "get_backend_type", "(", "self", ",", "location", ")", ":", "# type: (str) -> Optional[Type[VersionControl]]", "for", "vc_type", "in", "self", ".", "_registry", ".", "values", "(", ")", ":", "if", "vc_type", ".", "controls_location", "(", "location", ")", ...
Return the type of the version control backend if found at given location, e.g. vcs.get_backend_type('/path/to/vcs/checkout')
[ "Return", "the", "type", "of", "the", "version", "control", "backend", "if", "found", "at", "given", "location", "e", ".", "g", ".", "vcs", ".", "get_backend_type", "(", "/", "path", "/", "to", "/", "vcs", "/", "checkout", ")" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/vcs/__init__.py#L155-L166
train
pypa/pipenv
pipenv/patched/notpip/_internal/vcs/__init__.py
VersionControl._is_local_repository
def _is_local_repository(cls, repo): # type: (str) -> bool """ posix absolute paths start with os.path.sep, win32 ones start with drive (like c:\\folder) """ drive, tail = os.path.splitdrive(repo) return repo.startswith(os.path.sep) or bool(drive)
python
def _is_local_repository(cls, repo): # type: (str) -> bool """ posix absolute paths start with os.path.sep, win32 ones start with drive (like c:\\folder) """ drive, tail = os.path.splitdrive(repo) return repo.startswith(os.path.sep) or bool(drive)
[ "def", "_is_local_repository", "(", "cls", ",", "repo", ")", ":", "# type: (str) -> bool", "drive", ",", "tail", "=", "os", ".", "path", ".", "splitdrive", "(", "repo", ")", "return", "repo", ".", "startswith", "(", "os", ".", "path", ".", "sep", ")", ...
posix absolute paths start with os.path.sep, win32 ones start with drive (like c:\\folder)
[ "posix", "absolute", "paths", "start", "with", "os", ".", "path", ".", "sep", "win32", "ones", "start", "with", "drive", "(", "like", "c", ":", "\\\\", "folder", ")" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/vcs/__init__.py#L214-L221
train
pypa/pipenv
pipenv/patched/notpip/_internal/vcs/__init__.py
VersionControl.get_url_rev_and_auth
def get_url_rev_and_auth(self, url): # type: (str) -> Tuple[str, Optional[str], AuthInfo] """ Parse the repository URL to use, and return the URL, revision, and auth info to use. Returns: (url, rev, (username, password)). """ scheme, netloc, path, query, frag = u...
python
def get_url_rev_and_auth(self, url): # type: (str) -> Tuple[str, Optional[str], AuthInfo] """ Parse the repository URL to use, and return the URL, revision, and auth info to use. Returns: (url, rev, (username, password)). """ scheme, netloc, path, query, frag = u...
[ "def", "get_url_rev_and_auth", "(", "self", ",", "url", ")", ":", "# type: (str) -> Tuple[str, Optional[str], AuthInfo]", "scheme", ",", "netloc", ",", "path", ",", "query", ",", "frag", "=", "urllib_parse", ".", "urlsplit", "(", "url", ")", "if", "'+'", "not", ...
Parse the repository URL to use, and return the URL, revision, and auth info to use. Returns: (url, rev, (username, password)).
[ "Parse", "the", "repository", "URL", "to", "use", "and", "return", "the", "URL", "revision", "and", "auth", "info", "to", "use", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/vcs/__init__.py#L248-L270
train
pypa/pipenv
pipenv/patched/notpip/_internal/vcs/__init__.py
VersionControl.get_url_rev_options
def get_url_rev_options(self, url): # type: (str) -> Tuple[str, RevOptions] """ Return the URL and RevOptions object to use in obtain() and in some cases export(), as a tuple (url, rev_options). """ url, rev, user_pass = self.get_url_rev_and_auth(url) username, pa...
python
def get_url_rev_options(self, url): # type: (str) -> Tuple[str, RevOptions] """ Return the URL and RevOptions object to use in obtain() and in some cases export(), as a tuple (url, rev_options). """ url, rev, user_pass = self.get_url_rev_and_auth(url) username, pa...
[ "def", "get_url_rev_options", "(", "self", ",", "url", ")", ":", "# type: (str) -> Tuple[str, RevOptions]", "url", ",", "rev", ",", "user_pass", "=", "self", ".", "get_url_rev_and_auth", "(", "url", ")", "username", ",", "password", "=", "user_pass", "extra_args",...
Return the URL and RevOptions object to use in obtain() and in some cases export(), as a tuple (url, rev_options).
[ "Return", "the", "URL", "and", "RevOptions", "object", "to", "use", "in", "obtain", "()", "and", "in", "some", "cases", "export", "()", "as", "a", "tuple", "(", "url", "rev_options", ")", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/vcs/__init__.py#L278-L289
train
pypa/pipenv
pipenv/patched/notpip/_internal/vcs/__init__.py
VersionControl.compare_urls
def compare_urls(self, url1, url2): # type: (str, str) -> bool """ Compare two repo URLs for identity, ignoring incidental differences. """ return (self.normalize_url(url1) == self.normalize_url(url2))
python
def compare_urls(self, url1, url2): # type: (str, str) -> bool """ Compare two repo URLs for identity, ignoring incidental differences. """ return (self.normalize_url(url1) == self.normalize_url(url2))
[ "def", "compare_urls", "(", "self", ",", "url1", ",", "url2", ")", ":", "# type: (str, str) -> bool", "return", "(", "self", ".", "normalize_url", "(", "url1", ")", "==", "self", ".", "normalize_url", "(", "url2", ")", ")" ]
Compare two repo URLs for identity, ignoring incidental differences.
[ "Compare", "two", "repo", "URLs", "for", "identity", "ignoring", "incidental", "differences", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/vcs/__init__.py#L299-L304
train
pypa/pipenv
pipenv/patched/notpip/_internal/vcs/__init__.py
VersionControl.obtain
def obtain(self, dest): # type: (str) -> None """ Install or update in editable mode the package represented by this VersionControl object. Args: dest: the repository directory in which to install or update. """ url, rev_options = self.get_url_rev_optio...
python
def obtain(self, dest): # type: (str) -> None """ Install or update in editable mode the package represented by this VersionControl object. Args: dest: the repository directory in which to install or update. """ url, rev_options = self.get_url_rev_optio...
[ "def", "obtain", "(", "self", ",", "dest", ")", ":", "# type: (str) -> None", "url", ",", "rev_options", "=", "self", ".", "get_url_rev_options", "(", "self", ".", "url", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "dest", ")", ":", "self"...
Install or update in editable mode the package represented by this VersionControl object. Args: dest: the repository directory in which to install or update.
[ "Install", "or", "update", "in", "editable", "mode", "the", "package", "represented", "by", "this", "VersionControl", "object", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/vcs/__init__.py#L345-L436
train
pypa/pipenv
pipenv/patched/notpip/_internal/vcs/__init__.py
VersionControl.run_command
def run_command( cls, cmd, # type: List[str] show_stdout=True, # type: bool cwd=None, # type: Optional[str] on_returncode='raise', # type: str extra_ok_returncodes=None, # type: Optional[Iterable[int]] command_desc=None, # type: Optional[str] extra_e...
python
def run_command( cls, cmd, # type: List[str] show_stdout=True, # type: bool cwd=None, # type: Optional[str] on_returncode='raise', # type: str extra_ok_returncodes=None, # type: Optional[Iterable[int]] command_desc=None, # type: Optional[str] extra_e...
[ "def", "run_command", "(", "cls", ",", "cmd", ",", "# type: List[str]", "show_stdout", "=", "True", ",", "# type: bool", "cwd", "=", "None", ",", "# type: Optional[str]", "on_returncode", "=", "'raise'", ",", "# type: str", "extra_ok_returncodes", "=", "None", ","...
Run a VCS subcommand This is simply a wrapper around call_subprocess that adds the VCS command name, and checks that the VCS is available
[ "Run", "a", "VCS", "subcommand", "This", "is", "simply", "a", "wrapper", "around", "call_subprocess", "that", "adds", "the", "VCS", "command", "name", "and", "checks", "that", "the", "VCS", "is", "available" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/vcs/__init__.py#L476-L511
train
pypa/pipenv
pipenv/patched/notpip/_internal/vcs/__init__.py
VersionControl.is_repository_directory
def is_repository_directory(cls, path): # type: (str) -> bool """ Return whether a directory path is a repository directory. """ logger.debug('Checking in %s for %s (%s)...', path, cls.dirname, cls.name) return os.path.exists(os.path.join(path, cls.di...
python
def is_repository_directory(cls, path): # type: (str) -> bool """ Return whether a directory path is a repository directory. """ logger.debug('Checking in %s for %s (%s)...', path, cls.dirname, cls.name) return os.path.exists(os.path.join(path, cls.di...
[ "def", "is_repository_directory", "(", "cls", ",", "path", ")", ":", "# type: (str) -> bool", "logger", ".", "debug", "(", "'Checking in %s for %s (%s)...'", ",", "path", ",", "cls", ".", "dirname", ",", "cls", ".", "name", ")", "return", "os", ".", "path", ...
Return whether a directory path is a repository directory.
[ "Return", "whether", "a", "directory", "path", "is", "a", "repository", "directory", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/vcs/__init__.py#L514-L521
train
pypa/pipenv
pipenv/patched/notpip/_internal/req/req_uninstall.py
_script_names
def _script_names(dist, script_name, is_gui): """Create the fully qualified name of the files created by {console,gui}_scripts for the given ``dist``. Returns the list of file names """ if dist_in_usersite(dist): bin_dir = bin_user else: bin_dir = bin_py exe_name = os.path.jo...
python
def _script_names(dist, script_name, is_gui): """Create the fully qualified name of the files created by {console,gui}_scripts for the given ``dist``. Returns the list of file names """ if dist_in_usersite(dist): bin_dir = bin_user else: bin_dir = bin_py exe_name = os.path.jo...
[ "def", "_script_names", "(", "dist", ",", "script_name", ",", "is_gui", ")", ":", "if", "dist_in_usersite", "(", "dist", ")", ":", "bin_dir", "=", "bin_user", "else", ":", "bin_dir", "=", "bin_py", "exe_name", "=", "os", ".", "path", ".", "join", "(", ...
Create the fully qualified name of the files created by {console,gui}_scripts for the given ``dist``. Returns the list of file names
[ "Create", "the", "fully", "qualified", "name", "of", "the", "files", "created", "by", "{", "console", "gui", "}", "_scripts", "for", "the", "given", "dist", ".", "Returns", "the", "list", "of", "file", "names" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_uninstall.py#L25-L43
train
pypa/pipenv
pipenv/patched/notpip/_internal/req/req_uninstall.py
compact
def compact(paths): """Compact a path set to contain the minimal number of paths necessary to contain all paths in the set. If /a/path/ and /a/path/to/a/file.txt are both in the set, leave only the shorter path.""" sep = os.path.sep short_paths = set() for path in sorted(paths, key=len): ...
python
def compact(paths): """Compact a path set to contain the minimal number of paths necessary to contain all paths in the set. If /a/path/ and /a/path/to/a/file.txt are both in the set, leave only the shorter path.""" sep = os.path.sep short_paths = set() for path in sorted(paths, key=len): ...
[ "def", "compact", "(", "paths", ")", ":", "sep", "=", "os", ".", "path", ".", "sep", "short_paths", "=", "set", "(", ")", "for", "path", "in", "sorted", "(", "paths", ",", "key", "=", "len", ")", ":", "should_skip", "=", "any", "(", "path", ".", ...
Compact a path set to contain the minimal number of paths necessary to contain all paths in the set. If /a/path/ and /a/path/to/a/file.txt are both in the set, leave only the shorter path.
[ "Compact", "a", "path", "set", "to", "contain", "the", "minimal", "number", "of", "paths", "necessary", "to", "contain", "all", "paths", "in", "the", "set", ".", "If", "/", "a", "/", "path", "/", "and", "/", "a", "/", "path", "/", "to", "/", "a", ...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_uninstall.py#L80-L96
train
pypa/pipenv
pipenv/patched/notpip/_internal/req/req_uninstall.py
compress_for_rename
def compress_for_rename(paths): """Returns a set containing the paths that need to be renamed. This set may include directories when the original sequence of paths included every file on disk. """ case_map = dict((os.path.normcase(p), p) for p in paths) remaining = set(case_map) unchecked =...
python
def compress_for_rename(paths): """Returns a set containing the paths that need to be renamed. This set may include directories when the original sequence of paths included every file on disk. """ case_map = dict((os.path.normcase(p), p) for p in paths) remaining = set(case_map) unchecked =...
[ "def", "compress_for_rename", "(", "paths", ")", ":", "case_map", "=", "dict", "(", "(", "os", ".", "path", ".", "normcase", "(", "p", ")", ",", "p", ")", "for", "p", "in", "paths", ")", "remaining", "=", "set", "(", "case_map", ")", "unchecked", "...
Returns a set containing the paths that need to be renamed. This set may include directories when the original sequence of paths included every file on disk.
[ "Returns", "a", "set", "containing", "the", "paths", "that", "need", "to", "be", "renamed", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_uninstall.py#L99-L134
train
pypa/pipenv
pipenv/patched/notpip/_internal/req/req_uninstall.py
compress_for_output_listing
def compress_for_output_listing(paths): """Returns a tuple of 2 sets of which paths to display to user The first set contains paths that would be deleted. Files of a package are not added and the top-level directory of the package has a '*' added at the end - to signify that all it's contents are remov...
python
def compress_for_output_listing(paths): """Returns a tuple of 2 sets of which paths to display to user The first set contains paths that would be deleted. Files of a package are not added and the top-level directory of the package has a '*' added at the end - to signify that all it's contents are remov...
[ "def", "compress_for_output_listing", "(", "paths", ")", ":", "will_remove", "=", "list", "(", "paths", ")", "will_skip", "=", "set", "(", ")", "# Determine folders and files", "folders", "=", "set", "(", ")", "files", "=", "set", "(", ")", "for", "path", ...
Returns a tuple of 2 sets of which paths to display to user The first set contains paths that would be deleted. Files of a package are not added and the top-level directory of the package has a '*' added at the end - to signify that all it's contents are removed. The second set contains files that wou...
[ "Returns", "a", "tuple", "of", "2", "sets", "of", "which", "paths", "to", "display", "to", "user" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_uninstall.py#L137-L183
train
pypa/pipenv
pipenv/patched/notpip/_internal/req/req_uninstall.py
StashedUninstallPathSet._get_directory_stash
def _get_directory_stash(self, path): """Stashes a directory. Directories are stashed adjacent to their original location if possible, or else moved/copied into the user's temp dir.""" try: save_dir = AdjacentTempDirectory(path) save_dir.create() except ...
python
def _get_directory_stash(self, path): """Stashes a directory. Directories are stashed adjacent to their original location if possible, or else moved/copied into the user's temp dir.""" try: save_dir = AdjacentTempDirectory(path) save_dir.create() except ...
[ "def", "_get_directory_stash", "(", "self", ",", "path", ")", ":", "try", ":", "save_dir", "=", "AdjacentTempDirectory", "(", "path", ")", "save_dir", ".", "create", "(", ")", "except", "OSError", ":", "save_dir", "=", "TempDirectory", "(", "kind", "=", "\...
Stashes a directory. Directories are stashed adjacent to their original location if possible, or else moved/copied into the user's temp dir.
[ "Stashes", "a", "directory", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_uninstall.py#L197-L211
train
pypa/pipenv
pipenv/patched/notpip/_internal/req/req_uninstall.py
StashedUninstallPathSet._get_file_stash
def _get_file_stash(self, path): """Stashes a file. If no root has been provided, one will be created for the directory in the user's temp directory.""" path = os.path.normcase(path) head, old_head = os.path.dirname(path), None save_dir = None while head != old_...
python
def _get_file_stash(self, path): """Stashes a file. If no root has been provided, one will be created for the directory in the user's temp directory.""" path = os.path.normcase(path) head, old_head = os.path.dirname(path), None save_dir = None while head != old_...
[ "def", "_get_file_stash", "(", "self", ",", "path", ")", ":", "path", "=", "os", ".", "path", ".", "normcase", "(", "path", ")", "head", ",", "old_head", "=", "os", ".", "path", ".", "dirname", "(", "path", ")", ",", "None", "save_dir", "=", "None"...
Stashes a file. If no root has been provided, one will be created for the directory in the user's temp directory.
[ "Stashes", "a", "file", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_uninstall.py#L213-L239
train
pypa/pipenv
pipenv/patched/notpip/_internal/req/req_uninstall.py
StashedUninstallPathSet.stash
def stash(self, path): """Stashes the directory or file and returns its new location. """ if os.path.isdir(path): new_path = self._get_directory_stash(path) else: new_path = self._get_file_stash(path) self._moves.append((path, new_path)) if os.pat...
python
def stash(self, path): """Stashes the directory or file and returns its new location. """ if os.path.isdir(path): new_path = self._get_directory_stash(path) else: new_path = self._get_file_stash(path) self._moves.append((path, new_path)) if os.pat...
[ "def", "stash", "(", "self", ",", "path", ")", ":", "if", "os", ".", "path", ".", "isdir", "(", "path", ")", ":", "new_path", "=", "self", ".", "_get_directory_stash", "(", "path", ")", "else", ":", "new_path", "=", "self", ".", "_get_file_stash", "(...
Stashes the directory or file and returns its new location.
[ "Stashes", "the", "directory", "or", "file", "and", "returns", "its", "new", "location", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_uninstall.py#L241-L258
train
pypa/pipenv
pipenv/patched/notpip/_internal/req/req_uninstall.py
StashedUninstallPathSet.commit
def commit(self): """Commits the uninstall by removing stashed files.""" for _, save_dir in self._save_dirs.items(): save_dir.cleanup() self._moves = [] self._save_dirs = {}
python
def commit(self): """Commits the uninstall by removing stashed files.""" for _, save_dir in self._save_dirs.items(): save_dir.cleanup() self._moves = [] self._save_dirs = {}
[ "def", "commit", "(", "self", ")", ":", "for", "_", ",", "save_dir", "in", "self", ".", "_save_dirs", ".", "items", "(", ")", ":", "save_dir", ".", "cleanup", "(", ")", "self", ".", "_moves", "=", "[", "]", "self", ".", "_save_dirs", "=", "{", "}...
Commits the uninstall by removing stashed files.
[ "Commits", "the", "uninstall", "by", "removing", "stashed", "files", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_uninstall.py#L260-L265
train
pypa/pipenv
pipenv/patched/notpip/_internal/req/req_uninstall.py
StashedUninstallPathSet.rollback
def rollback(self): """Undoes the uninstall by moving stashed files back.""" for p in self._moves: logging.info("Moving to %s\n from %s", *p) for new_path, path in self._moves: try: logger.debug('Replacing %s from %s', new_path, path) if o...
python
def rollback(self): """Undoes the uninstall by moving stashed files back.""" for p in self._moves: logging.info("Moving to %s\n from %s", *p) for new_path, path in self._moves: try: logger.debug('Replacing %s from %s', new_path, path) if o...
[ "def", "rollback", "(", "self", ")", ":", "for", "p", "in", "self", ".", "_moves", ":", "logging", ".", "info", "(", "\"Moving to %s\\n from %s\"", ",", "*", "p", ")", "for", "new_path", ",", "path", "in", "self", ".", "_moves", ":", "try", ":", "log...
Undoes the uninstall by moving stashed files back.
[ "Undoes", "the", "uninstall", "by", "moving", "stashed", "files", "back", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_uninstall.py#L267-L284
train
pypa/pipenv
pipenv/patched/notpip/_internal/req/req_uninstall.py
UninstallPathSet.remove
def remove(self, auto_confirm=False, verbose=False): """Remove paths in ``self.paths`` with confirmation (unless ``auto_confirm`` is True).""" if not self.paths: logger.info( "Can't uninstall '%s'. No files were found to uninstall.", self.dist.project...
python
def remove(self, auto_confirm=False, verbose=False): """Remove paths in ``self.paths`` with confirmation (unless ``auto_confirm`` is True).""" if not self.paths: logger.info( "Can't uninstall '%s'. No files were found to uninstall.", self.dist.project...
[ "def", "remove", "(", "self", ",", "auto_confirm", "=", "False", ",", "verbose", "=", "False", ")", ":", "if", "not", "self", ".", "paths", ":", "logger", ".", "info", "(", "\"Can't uninstall '%s'. No files were found to uninstall.\"", ",", "self", ".", "dist"...
Remove paths in ``self.paths`` with confirmation (unless ``auto_confirm`` is True).
[ "Remove", "paths", "in", "self", ".", "paths", "with", "confirmation", "(", "unless", "auto_confirm", "is", "True", ")", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_uninstall.py#L337-L366
train
pypa/pipenv
pipenv/patched/notpip/_internal/req/req_uninstall.py
UninstallPathSet._allowed_to_proceed
def _allowed_to_proceed(self, verbose): """Display which files would be deleted and prompt for confirmation """ def _display(msg, paths): if not paths: return logger.info(msg) with indent_log(): for path in sorted(compact(path...
python
def _allowed_to_proceed(self, verbose): """Display which files would be deleted and prompt for confirmation """ def _display(msg, paths): if not paths: return logger.info(msg) with indent_log(): for path in sorted(compact(path...
[ "def", "_allowed_to_proceed", "(", "self", ",", "verbose", ")", ":", "def", "_display", "(", "msg", ",", "paths", ")", ":", "if", "not", "paths", ":", "return", "logger", ".", "info", "(", "msg", ")", "with", "indent_log", "(", ")", ":", "for", "path...
Display which files would be deleted and prompt for confirmation
[ "Display", "which", "files", "would", "be", "deleted", "and", "prompt", "for", "confirmation" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_uninstall.py#L368-L395
train
pypa/pipenv
pipenv/patched/notpip/_internal/req/req_uninstall.py
UninstallPathSet.rollback
def rollback(self): """Rollback the changes previously made by remove().""" if not self._moved_paths.can_rollback: logger.error( "Can't roll back %s; was not uninstalled", self.dist.project_name, ) return False logger.info('Roll...
python
def rollback(self): """Rollback the changes previously made by remove().""" if not self._moved_paths.can_rollback: logger.error( "Can't roll back %s; was not uninstalled", self.dist.project_name, ) return False logger.info('Roll...
[ "def", "rollback", "(", "self", ")", ":", "if", "not", "self", ".", "_moved_paths", ".", "can_rollback", ":", "logger", ".", "error", "(", "\"Can't roll back %s; was not uninstalled\"", ",", "self", ".", "dist", ".", "project_name", ",", ")", "return", "False"...
Rollback the changes previously made by remove().
[ "Rollback", "the", "changes", "previously", "made", "by", "remove", "()", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_uninstall.py#L397-L408
train
pypa/pipenv
pipenv/vendor/yarg/package.py
Package.author
def author(self): """ >>> package = yarg.get('yarg') >>> package.author Author(name=u'Kura', email=u'kura@kura.io') """ author = namedtuple('Author', 'name email') return author(name=self._package['author'], email=self._package['a...
python
def author(self): """ >>> package = yarg.get('yarg') >>> package.author Author(name=u'Kura', email=u'kura@kura.io') """ author = namedtuple('Author', 'name email') return author(name=self._package['author'], email=self._package['a...
[ "def", "author", "(", "self", ")", ":", "author", "=", "namedtuple", "(", "'Author'", ",", "'name email'", ")", "return", "author", "(", "name", "=", "self", ".", "_package", "[", "'author'", "]", ",", "email", "=", "self", ".", "_package", "[", "'auth...
>>> package = yarg.get('yarg') >>> package.author Author(name=u'Kura', email=u'kura@kura.io')
[ ">>>", "package", "=", "yarg", ".", "get", "(", "yarg", ")", ">>>", "package", ".", "author", "Author", "(", "name", "=", "u", "Kura", "email", "=", "u", "kura" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/yarg/package.py#L123-L131
train
pypa/pipenv
pipenv/vendor/yarg/package.py
Package.maintainer
def maintainer(self): """ >>> package = yarg.get('yarg') >>> package.maintainer Maintainer(name=u'Kura', email=u'kura@kura.io') """ maintainer = namedtuple('Maintainer', 'name email') return maintainer(name=self._package['maintainer'], ...
python
def maintainer(self): """ >>> package = yarg.get('yarg') >>> package.maintainer Maintainer(name=u'Kura', email=u'kura@kura.io') """ maintainer = namedtuple('Maintainer', 'name email') return maintainer(name=self._package['maintainer'], ...
[ "def", "maintainer", "(", "self", ")", ":", "maintainer", "=", "namedtuple", "(", "'Maintainer'", ",", "'name email'", ")", "return", "maintainer", "(", "name", "=", "self", ".", "_package", "[", "'maintainer'", "]", ",", "email", "=", "self", ".", "_packa...
>>> package = yarg.get('yarg') >>> package.maintainer Maintainer(name=u'Kura', email=u'kura@kura.io')
[ ">>>", "package", "=", "yarg", ".", "get", "(", "yarg", ")", ">>>", "package", ".", "maintainer", "Maintainer", "(", "name", "=", "u", "Kura", "email", "=", "u", "kura" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/yarg/package.py#L134-L142
train
pypa/pipenv
pipenv/vendor/yarg/package.py
Package.license_from_classifiers
def license_from_classifiers(self): """ >>> package = yarg.get('yarg') >>> package.license_from_classifiers u'MIT License' """ if len(self.classifiers) > 0: for c in self.classifiers: if c.startswith("License"): ...
python
def license_from_classifiers(self): """ >>> package = yarg.get('yarg') >>> package.license_from_classifiers u'MIT License' """ if len(self.classifiers) > 0: for c in self.classifiers: if c.startswith("License"): ...
[ "def", "license_from_classifiers", "(", "self", ")", ":", "if", "len", "(", "self", ".", "classifiers", ")", ">", "0", ":", "for", "c", "in", "self", ".", "classifiers", ":", "if", "c", ".", "startswith", "(", "\"License\"", ")", ":", "return", "c", ...
>>> package = yarg.get('yarg') >>> package.license_from_classifiers u'MIT License'
[ ">>>", "package", "=", "yarg", ".", "get", "(", "yarg", ")", ">>>", "package", ".", "license_from_classifiers", "u", "MIT", "License" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/yarg/package.py#L154-L163
train
pypa/pipenv
pipenv/vendor/yarg/package.py
Package.downloads
def downloads(self): """ >>> package = yarg.get('yarg') >>> package.downloads Downloads(day=50100, week=367941, month=1601938) # I wish """ _downloads = self._package['downloads'] downloads = namedtuple('Downloads', 'day week month') return do...
python
def downloads(self): """ >>> package = yarg.get('yarg') >>> package.downloads Downloads(day=50100, week=367941, month=1601938) # I wish """ _downloads = self._package['downloads'] downloads = namedtuple('Downloads', 'day week month') return do...
[ "def", "downloads", "(", "self", ")", ":", "_downloads", "=", "self", ".", "_package", "[", "'downloads'", "]", "downloads", "=", "namedtuple", "(", "'Downloads'", ",", "'day week month'", ")", "return", "downloads", "(", "day", "=", "_downloads", "[", "'las...
>>> package = yarg.get('yarg') >>> package.downloads Downloads(day=50100, week=367941, month=1601938) # I wish
[ ">>>", "package", "=", "yarg", ".", "get", "(", "yarg", ")", ">>>", "package", ".", "downloads", "Downloads", "(", "day", "=", "50100", "week", "=", "367941", "month", "=", "1601938", ")", "#", "I", "wish" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/yarg/package.py#L166-L176
train
pypa/pipenv
pipenv/vendor/yarg/package.py
Package.python_versions
def python_versions(self): """ Returns a list of Python version strings that the package has listed in :attr:`yarg.Release.classifiers`. >>> package = yarg.get('yarg') >>> package.python_versions [u'2.6', u'2.7', u'3.3', u'3.4'] """ version_re...
python
def python_versions(self): """ Returns a list of Python version strings that the package has listed in :attr:`yarg.Release.classifiers`. >>> package = yarg.get('yarg') >>> package.python_versions [u'2.6', u'2.7', u'3.3', u'3.4'] """ version_re...
[ "def", "python_versions", "(", "self", ")", ":", "version_re", "=", "re", ".", "compile", "(", "r\"\"\"Programming Language \\:\\: \"\"\"", "\"\"\"Python \\:\\: \\d\\.\\d\"\"\"", ")", "return", "[", "c", ".", "split", "(", "' :: '", ")", "[", "-", "1", "]", "for...
Returns a list of Python version strings that the package has listed in :attr:`yarg.Release.classifiers`. >>> package = yarg.get('yarg') >>> package.python_versions [u'2.6', u'2.7', u'3.3', u'3.4']
[ "Returns", "a", "list", "of", "Python", "version", "strings", "that", "the", "package", "has", "listed", "in", ":", "attr", ":", "yarg", ".", "Release", ".", "classifiers", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/yarg/package.py#L190-L202
train
pypa/pipenv
pipenv/vendor/yarg/package.py
Package.release_ids
def release_ids(self): """ >>> package = yarg.get('yarg') >>> package.release_ids [u'0.0.1', u'0.0.5', u'0.1.0'] """ r = [(k, self._releases[k][0]['upload_time']) for k in self._releases.keys() if len(self._releases[k]) > 0] r...
python
def release_ids(self): """ >>> package = yarg.get('yarg') >>> package.release_ids [u'0.0.1', u'0.0.5', u'0.1.0'] """ r = [(k, self._releases[k][0]['upload_time']) for k in self._releases.keys() if len(self._releases[k]) > 0] r...
[ "def", "release_ids", "(", "self", ")", ":", "r", "=", "[", "(", "k", ",", "self", ".", "_releases", "[", "k", "]", "[", "0", "]", "[", "'upload_time'", "]", ")", "for", "k", "in", "self", ".", "_releases", ".", "keys", "(", ")", "if", "len", ...
>>> package = yarg.get('yarg') >>> package.release_ids [u'0.0.1', u'0.0.5', u'0.1.0']
[ ">>>", "package", "=", "yarg", ".", "get", "(", "yarg", ")", ">>>", "package", ".", "release_ids", "[", "u", "0", ".", "0", ".", "1", "u", "0", ".", "0", ".", "5", "u", "0", ".", "1", ".", "0", "]" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/yarg/package.py#L289-L298
train
pypa/pipenv
pipenv/vendor/yarg/package.py
Package.release
def release(self, release_id): """ A list of :class:`yarg.release.Release` objects for each file in a release. :param release_id: A pypi release id. >>> package = yarg.get('yarg') >>> last_release = yarg.releases[-1] >>> package.release(last_release)...
python
def release(self, release_id): """ A list of :class:`yarg.release.Release` objects for each file in a release. :param release_id: A pypi release id. >>> package = yarg.get('yarg') >>> last_release = yarg.releases[-1] >>> package.release(last_release)...
[ "def", "release", "(", "self", ",", "release_id", ")", ":", "if", "release_id", "not", "in", "self", ".", "release_ids", ":", "return", "None", "return", "[", "Release", "(", "release_id", ",", "r", ")", "for", "r", "in", "self", ".", "_releases", "[",...
A list of :class:`yarg.release.Release` objects for each file in a release. :param release_id: A pypi release id. >>> package = yarg.get('yarg') >>> last_release = yarg.releases[-1] >>> package.release(last_release) [<Release 0.1.0>, <Release 0.1.0>]
[ "A", "list", "of", ":", "class", ":", "yarg", ".", "release", ".", "Release", "objects", "for", "each", "file", "in", "a", "release", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/yarg/package.py#L300-L314
train
pypa/pipenv
pipenv/vendor/pexpect/utils.py
is_executable_file
def is_executable_file(path): """Checks that path is an executable regular file, or a symlink towards one. This is roughly ``os.path isfile(path) and os.access(path, os.X_OK)``. """ # follow symlinks, fpath = os.path.realpath(path) if not os.path.isfile(fpath): # non-files (directories...
python
def is_executable_file(path): """Checks that path is an executable regular file, or a symlink towards one. This is roughly ``os.path isfile(path) and os.access(path, os.X_OK)``. """ # follow symlinks, fpath = os.path.realpath(path) if not os.path.isfile(fpath): # non-files (directories...
[ "def", "is_executable_file", "(", "path", ")", ":", "# follow symlinks,", "fpath", "=", "os", ".", "path", ".", "realpath", "(", "path", ")", "if", "not", "os", ".", "path", ".", "isfile", "(", "fpath", ")", ":", "# non-files (directories, fifo, etc.)", "ret...
Checks that path is an executable regular file, or a symlink towards one. This is roughly ``os.path isfile(path) and os.access(path, os.X_OK)``.
[ "Checks", "that", "path", "is", "an", "executable", "regular", "file", "or", "a", "symlink", "towards", "one", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/utils.py#L20-L45
train
pypa/pipenv
pipenv/vendor/pexpect/utils.py
which
def which(filename, env=None): '''This takes a given filename; tries to find it in the environment path; then checks if it is executable. This returns the full path to the filename if found and executable. Otherwise this returns None.''' # Special case where filename contains an explicit path. if o...
python
def which(filename, env=None): '''This takes a given filename; tries to find it in the environment path; then checks if it is executable. This returns the full path to the filename if found and executable. Otherwise this returns None.''' # Special case where filename contains an explicit path. if o...
[ "def", "which", "(", "filename", ",", "env", "=", "None", ")", ":", "# Special case where filename contains an explicit path.", "if", "os", ".", "path", ".", "dirname", "(", "filename", ")", "!=", "''", "and", "is_executable_file", "(", "filename", ")", ":", "...
This takes a given filename; tries to find it in the environment path; then checks if it is executable. This returns the full path to the filename if found and executable. Otherwise this returns None.
[ "This", "takes", "a", "given", "filename", ";", "tries", "to", "find", "it", "in", "the", "environment", "path", ";", "then", "checks", "if", "it", "is", "executable", ".", "This", "returns", "the", "full", "path", "to", "the", "filename", "if", "found",...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/utils.py#L48-L66
train
pypa/pipenv
pipenv/vendor/pexpect/utils.py
split_command_line
def split_command_line(command_line): '''This splits a command line into a list of arguments. It splits arguments on spaces, but handles embedded quotes, doublequotes, and escaped characters. It's impossible to do this with a regular expression, so I wrote a little state machine to parse the command li...
python
def split_command_line(command_line): '''This splits a command line into a list of arguments. It splits arguments on spaces, but handles embedded quotes, doublequotes, and escaped characters. It's impossible to do this with a regular expression, so I wrote a little state machine to parse the command li...
[ "def", "split_command_line", "(", "command_line", ")", ":", "arg_list", "=", "[", "]", "arg", "=", "''", "# Constants to name the states we can be in.", "state_basic", "=", "0", "state_esc", "=", "1", "state_singlequote", "=", "2", "state_doublequote", "=", "3", "...
This splits a command line into a list of arguments. It splits arguments on spaces, but handles embedded quotes, doublequotes, and escaped characters. It's impossible to do this with a regular expression, so I wrote a little state machine to parse the command line.
[ "This", "splits", "a", "command", "line", "into", "a", "list", "of", "arguments", ".", "It", "splits", "arguments", "on", "spaces", "but", "handles", "embedded", "quotes", "doublequotes", "and", "escaped", "characters", ".", "It", "s", "impossible", "to", "d...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/utils.py#L69-L127
train
pypa/pipenv
pipenv/vendor/pexpect/utils.py
select_ignore_interrupts
def select_ignore_interrupts(iwtd, owtd, ewtd, timeout=None): '''This is a wrapper around select.select() that ignores signals. If select.select raises a select.error exception and errno is an EINTR error then it is ignored. Mainly this is used to ignore sigwinch (terminal resize). ''' # if select...
python
def select_ignore_interrupts(iwtd, owtd, ewtd, timeout=None): '''This is a wrapper around select.select() that ignores signals. If select.select raises a select.error exception and errno is an EINTR error then it is ignored. Mainly this is used to ignore sigwinch (terminal resize). ''' # if select...
[ "def", "select_ignore_interrupts", "(", "iwtd", ",", "owtd", ",", "ewtd", ",", "timeout", "=", "None", ")", ":", "# if select() is interrupted by a signal (errno==EINTR) then", "# we loop back and enter the select() again.", "if", "timeout", "is", "not", "None", ":", "end...
This is a wrapper around select.select() that ignores signals. If select.select raises a select.error exception and errno is an EINTR error then it is ignored. Mainly this is used to ignore sigwinch (terminal resize).
[ "This", "is", "a", "wrapper", "around", "select", ".", "select", "()", "that", "ignores", "signals", ".", "If", "select", ".", "select", "raises", "a", "select", ".", "error", "exception", "and", "errno", "is", "an", "EINTR", "error", "then", "it", "is",...
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/utils.py#L130-L156
train
pypa/pipenv
pipenv/vendor/pexpect/utils.py
poll_ignore_interrupts
def poll_ignore_interrupts(fds, timeout=None): '''Simple wrapper around poll to register file descriptors and ignore signals.''' if timeout is not None: end_time = time.time() + timeout poller = select.poll() for fd in fds: poller.register(fd, select.POLLIN | select.POLLPRI | selec...
python
def poll_ignore_interrupts(fds, timeout=None): '''Simple wrapper around poll to register file descriptors and ignore signals.''' if timeout is not None: end_time = time.time() + timeout poller = select.poll() for fd in fds: poller.register(fd, select.POLLIN | select.POLLPRI | selec...
[ "def", "poll_ignore_interrupts", "(", "fds", ",", "timeout", "=", "None", ")", ":", "if", "timeout", "is", "not", "None", ":", "end_time", "=", "time", ".", "time", "(", ")", "+", "timeout", "poller", "=", "select", ".", "poll", "(", ")", "for", "fd"...
Simple wrapper around poll to register file descriptors and ignore signals.
[ "Simple", "wrapper", "around", "poll", "to", "register", "file", "descriptors", "and", "ignore", "signals", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/utils.py#L159-L187
train
pypa/pipenv
pipenv/vendor/distlib/version.py
_suggest_semantic_version
def _suggest_semantic_version(s): """ Try to suggest a semantic form for a version for which _suggest_normalized_version couldn't come up with anything. """ result = s.strip().lower() for pat, repl in _REPLACEMENTS: result = pat.sub(repl, result) if not result: result = '0.0....
python
def _suggest_semantic_version(s): """ Try to suggest a semantic form for a version for which _suggest_normalized_version couldn't come up with anything. """ result = s.strip().lower() for pat, repl in _REPLACEMENTS: result = pat.sub(repl, result) if not result: result = '0.0....
[ "def", "_suggest_semantic_version", "(", "s", ")", ":", "result", "=", "s", ".", "strip", "(", ")", ".", "lower", "(", ")", "for", "pat", ",", "repl", "in", "_REPLACEMENTS", ":", "result", "=", "pat", ".", "sub", "(", "repl", ",", "result", ")", "i...
Try to suggest a semantic form for a version for which _suggest_normalized_version couldn't come up with anything.
[ "Try", "to", "suggest", "a", "semantic", "form", "for", "a", "version", "for", "which", "_suggest_normalized_version", "couldn", "t", "come", "up", "with", "anything", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/version.py#L406-L449
train
pypa/pipenv
pipenv/vendor/distlib/version.py
_suggest_normalized_version
def _suggest_normalized_version(s): """Suggest a normalized version close to the given version string. If you have a version string that isn't rational (i.e. NormalizedVersion doesn't like it) then you might be able to get an equivalent (or close) rational version from this function. This does a n...
python
def _suggest_normalized_version(s): """Suggest a normalized version close to the given version string. If you have a version string that isn't rational (i.e. NormalizedVersion doesn't like it) then you might be able to get an equivalent (or close) rational version from this function. This does a n...
[ "def", "_suggest_normalized_version", "(", "s", ")", ":", "try", ":", "_normalized_key", "(", "s", ")", "return", "s", "# already rational", "except", "UnsupportedVersionError", ":", "pass", "rs", "=", "s", ".", "lower", "(", ")", "# part of this could use maketra...
Suggest a normalized version close to the given version string. If you have a version string that isn't rational (i.e. NormalizedVersion doesn't like it) then you might be able to get an equivalent (or close) rational version from this function. This does a number of simple normalizations to the given...
[ "Suggest", "a", "normalized", "version", "close", "to", "the", "given", "version", "string", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/version.py#L452-L560
train
pypa/pipenv
pipenv/vendor/distlib/version.py
Matcher.match
def match(self, version): """ Check if the provided version matches the constraints. :param version: The version to match against this instance. :type version: String or :class:`Version` instance. """ if isinstance(version, string_types): version = self.versi...
python
def match(self, version): """ Check if the provided version matches the constraints. :param version: The version to match against this instance. :type version: String or :class:`Version` instance. """ if isinstance(version, string_types): version = self.versi...
[ "def", "match", "(", "self", ",", "version", ")", ":", "if", "isinstance", "(", "version", ",", "string_types", ")", ":", "version", "=", "self", ".", "version_class", "(", "version", ")", "for", "operator", ",", "constraint", ",", "prefix", "in", "self"...
Check if the provided version matches the constraints. :param version: The version to match against this instance. :type version: String or :class:`Version` instance.
[ "Check", "if", "the", "provided", "version", "matches", "the", "constraints", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/version.py#L129-L148
train
pypa/pipenv
pipenv/vendor/dotenv/main.py
set_key
def set_key(dotenv_path, key_to_set, value_to_set, quote_mode="always"): """ Adds or Updates a key/value to the given .env If the .env path given doesn't exist, fails instead of risking creating an orphan .env somewhere in the filesystem """ value_to_set = value_to_set.strip("'").strip('"') ...
python
def set_key(dotenv_path, key_to_set, value_to_set, quote_mode="always"): """ Adds or Updates a key/value to the given .env If the .env path given doesn't exist, fails instead of risking creating an orphan .env somewhere in the filesystem """ value_to_set = value_to_set.strip("'").strip('"') ...
[ "def", "set_key", "(", "dotenv_path", ",", "key_to_set", ",", "value_to_set", ",", "quote_mode", "=", "\"always\"", ")", ":", "value_to_set", "=", "value_to_set", ".", "strip", "(", "\"'\"", ")", ".", "strip", "(", "'\"'", ")", "if", "not", "os", ".", "p...
Adds or Updates a key/value to the given .env If the .env path given doesn't exist, fails instead of risking creating an orphan .env somewhere in the filesystem
[ "Adds", "or", "Updates", "a", "key", "/", "value", "to", "the", "given", ".", "env" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/dotenv/main.py#L177-L206
train
pypa/pipenv
pipenv/vendor/dotenv/main.py
unset_key
def unset_key(dotenv_path, key_to_unset, quote_mode="always"): """ Removes a given key from the given .env If the .env path given doesn't exist, fails If the given key doesn't exist in the .env, fails """ if not os.path.exists(dotenv_path): warnings.warn("can't delete from %s - it doesn...
python
def unset_key(dotenv_path, key_to_unset, quote_mode="always"): """ Removes a given key from the given .env If the .env path given doesn't exist, fails If the given key doesn't exist in the .env, fails """ if not os.path.exists(dotenv_path): warnings.warn("can't delete from %s - it doesn...
[ "def", "unset_key", "(", "dotenv_path", ",", "key_to_unset", ",", "quote_mode", "=", "\"always\"", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "dotenv_path", ")", ":", "warnings", ".", "warn", "(", "\"can't delete from %s - it doesn't exist.\""...
Removes a given key from the given .env If the .env path given doesn't exist, fails If the given key doesn't exist in the .env, fails
[ "Removes", "a", "given", "key", "from", "the", "given", ".", "env" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/dotenv/main.py#L209-L232
train
pypa/pipenv
pipenv/vendor/dotenv/main.py
_walk_to_root
def _walk_to_root(path): """ Yield directories starting from the given directory up to the root """ if not os.path.exists(path): raise IOError('Starting path not found') if os.path.isfile(path): path = os.path.dirname(path) last_dir = None current_dir = os.path.abspath(path...
python
def _walk_to_root(path): """ Yield directories starting from the given directory up to the root """ if not os.path.exists(path): raise IOError('Starting path not found') if os.path.isfile(path): path = os.path.dirname(path) last_dir = None current_dir = os.path.abspath(path...
[ "def", "_walk_to_root", "(", "path", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "path", ")", ":", "raise", "IOError", "(", "'Starting path not found'", ")", "if", "os", ".", "path", ".", "isfile", "(", "path", ")", ":", "path", "="...
Yield directories starting from the given directory up to the root
[ "Yield", "directories", "starting", "from", "the", "given", "directory", "up", "to", "the", "root" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/dotenv/main.py#L260-L275
train
pypa/pipenv
pipenv/vendor/dotenv/main.py
run_command
def run_command(command, env): """Run command in sub process. Runs the command in a sub process with the variables from `env` added in the current environment variables. Parameters ---------- command: List[str] The command and it's parameters env: Dict The additional enviro...
python
def run_command(command, env): """Run command in sub process. Runs the command in a sub process with the variables from `env` added in the current environment variables. Parameters ---------- command: List[str] The command and it's parameters env: Dict The additional enviro...
[ "def", "run_command", "(", "command", ",", "env", ")", ":", "# copy the current environment variables and add the vales from", "# `env`", "cmd_env", "=", "os", ".", "environ", ".", "copy", "(", ")", "cmd_env", ".", "update", "(", "env", ")", "p", "=", "Popen", ...
Run command in sub process. Runs the command in a sub process with the variables from `env` added in the current environment variables. Parameters ---------- command: List[str] The command and it's parameters env: Dict The additional environment variables Returns -----...
[ "Run", "command", "in", "sub", "process", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/dotenv/main.py#L317-L348
train
pypa/pipenv
pipenv/vendor/dotenv/main.py
DotEnv.dict
def dict(self): """Return dotenv as dict""" if self._dict: return self._dict values = OrderedDict(self.parse()) self._dict = resolve_nested_variables(values) return self._dict
python
def dict(self): """Return dotenv as dict""" if self._dict: return self._dict values = OrderedDict(self.parse()) self._dict = resolve_nested_variables(values) return self._dict
[ "def", "dict", "(", "self", ")", ":", "if", "self", ".", "_dict", ":", "return", "self", ".", "_dict", "values", "=", "OrderedDict", "(", "self", ".", "parse", "(", ")", ")", "self", ".", "_dict", "=", "resolve_nested_variables", "(", "values", ")", ...
Return dotenv as dict
[ "Return", "dotenv", "as", "dict" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/dotenv/main.py#L110-L117
train
pypa/pipenv
pipenv/vendor/dotenv/main.py
DotEnv.set_as_environment_variables
def set_as_environment_variables(self, override=False): """ Load the current dotenv as system environemt variable. """ for k, v in self.dict().items(): if k in os.environ and not override: continue # With Python2 on Windows, force environment varia...
python
def set_as_environment_variables(self, override=False): """ Load the current dotenv as system environemt variable. """ for k, v in self.dict().items(): if k in os.environ and not override: continue # With Python2 on Windows, force environment varia...
[ "def", "set_as_environment_variables", "(", "self", ",", "override", "=", "False", ")", ":", "for", "k", ",", "v", "in", "self", ".", "dict", "(", ")", ".", "items", "(", ")", ":", "if", "k", "in", "os", ".", "environ", "and", "not", "override", ":...
Load the current dotenv as system environemt variable.
[ "Load", "the", "current", "dotenv", "as", "system", "environemt", "variable", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/dotenv/main.py#L125-L140
train
pypa/pipenv
pipenv/vendor/passa/models/caches.py
_key_from_req
def _key_from_req(req): """Get an all-lowercase version of the requirement's name.""" if hasattr(req, 'key'): # from pkg_resources, such as installed dists for pip-sync key = req.key else: # from packaging, such as install requirements from requirements.txt key = req.name ...
python
def _key_from_req(req): """Get an all-lowercase version of the requirement's name.""" if hasattr(req, 'key'): # from pkg_resources, such as installed dists for pip-sync key = req.key else: # from packaging, such as install requirements from requirements.txt key = req.name ...
[ "def", "_key_from_req", "(", "req", ")", ":", "if", "hasattr", "(", "req", ",", "'key'", ")", ":", "# from pkg_resources, such as installed dists for pip-sync", "key", "=", "req", ".", "key", "else", ":", "# from packaging, such as install requirements from requirements.t...
Get an all-lowercase version of the requirement's name.
[ "Get", "an", "all", "-", "lowercase", "version", "of", "the", "requirement", "s", "name", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/passa/models/caches.py#L77-L87
train
pypa/pipenv
pipenv/vendor/passa/models/caches.py
_JSONCache.read_cache
def read_cache(self): """Reads the cached contents into memory. """ if os.path.exists(self._cache_file): self._cache = _read_cache_file(self._cache_file) else: self._cache = {}
python
def read_cache(self): """Reads the cached contents into memory. """ if os.path.exists(self._cache_file): self._cache = _read_cache_file(self._cache_file) else: self._cache = {}
[ "def", "read_cache", "(", "self", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "self", ".", "_cache_file", ")", ":", "self", ".", "_cache", "=", "_read_cache_file", "(", "self", ".", "_cache_file", ")", "else", ":", "self", ".", "_cache", "...
Reads the cached contents into memory.
[ "Reads", "the", "cached", "contents", "into", "memory", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/passa/models/caches.py#L156-L162
train
pypa/pipenv
pipenv/patched/notpip/_vendor/urllib3/contrib/pyopenssl.py
inject_into_urllib3
def inject_into_urllib3(): 'Monkey-patch urllib3 with PyOpenSSL-backed SSL-support.' _validate_dependencies_met() util.ssl_.SSLContext = PyOpenSSLContext util.HAS_SNI = HAS_SNI util.ssl_.HAS_SNI = HAS_SNI util.IS_PYOPENSSL = True util.ssl_.IS_PYOPENSSL = True
python
def inject_into_urllib3(): 'Monkey-patch urllib3 with PyOpenSSL-backed SSL-support.' _validate_dependencies_met() util.ssl_.SSLContext = PyOpenSSLContext util.HAS_SNI = HAS_SNI util.ssl_.HAS_SNI = HAS_SNI util.IS_PYOPENSSL = True util.ssl_.IS_PYOPENSSL = True
[ "def", "inject_into_urllib3", "(", ")", ":", "_validate_dependencies_met", "(", ")", "util", ".", "ssl_", ".", "SSLContext", "=", "PyOpenSSLContext", "util", ".", "HAS_SNI", "=", "HAS_SNI", "util", ".", "ssl_", ".", "HAS_SNI", "=", "HAS_SNI", "util", ".", "I...
Monkey-patch urllib3 with PyOpenSSL-backed SSL-support.
[ "Monkey", "-", "patch", "urllib3", "with", "PyOpenSSL", "-", "backed", "SSL", "-", "support", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/urllib3/contrib/pyopenssl.py#L115-L124
train
pypa/pipenv
pipenv/patched/notpip/_vendor/urllib3/contrib/pyopenssl.py
_validate_dependencies_met
def _validate_dependencies_met(): """ Verifies that PyOpenSSL's package-level dependencies have been met. Throws `ImportError` if they are not met. """ # Method added in `cryptography==1.1`; not available in older versions from cryptography.x509.extensions import Extensions if getattr(Extens...
python
def _validate_dependencies_met(): """ Verifies that PyOpenSSL's package-level dependencies have been met. Throws `ImportError` if they are not met. """ # Method added in `cryptography==1.1`; not available in older versions from cryptography.x509.extensions import Extensions if getattr(Extens...
[ "def", "_validate_dependencies_met", "(", ")", ":", "# Method added in `cryptography==1.1`; not available in older versions", "from", "cryptography", ".", "x509", ".", "extensions", "import", "Extensions", "if", "getattr", "(", "Extensions", ",", "\"get_extension_for_class\"", ...
Verifies that PyOpenSSL's package-level dependencies have been met. Throws `ImportError` if they are not met.
[ "Verifies", "that", "PyOpenSSL", "s", "package", "-", "level", "dependencies", "have", "been", "met", ".", "Throws", "ImportError", "if", "they", "are", "not", "met", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/urllib3/contrib/pyopenssl.py#L137-L154
train
pypa/pipenv
pipenv/patched/notpip/_vendor/urllib3/contrib/pyopenssl.py
_dnsname_to_stdlib
def _dnsname_to_stdlib(name): """ Converts a dNSName SubjectAlternativeName field to the form used by the standard library on the given Python version. Cryptography produces a dNSName as a unicode string that was idna-decoded from ASCII bytes. We need to idna-encode that string to get it back, and ...
python
def _dnsname_to_stdlib(name): """ Converts a dNSName SubjectAlternativeName field to the form used by the standard library on the given Python version. Cryptography produces a dNSName as a unicode string that was idna-decoded from ASCII bytes. We need to idna-encode that string to get it back, and ...
[ "def", "_dnsname_to_stdlib", "(", "name", ")", ":", "def", "idna_encode", "(", "name", ")", ":", "\"\"\"\n Borrowed wholesale from the Python Cryptography Project. It turns out\n that we can't just safely call `idna.encode`: it can explode for\n wildcard names. This avoi...
Converts a dNSName SubjectAlternativeName field to the form used by the standard library on the given Python version. Cryptography produces a dNSName as a unicode string that was idna-decoded from ASCII bytes. We need to idna-encode that string to get it back, and then on Python 3 we also need to conve...
[ "Converts", "a", "dNSName", "SubjectAlternativeName", "field", "to", "the", "form", "used", "by", "the", "standard", "library", "on", "the", "given", "Python", "version", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/urllib3/contrib/pyopenssl.py#L157-L192
train
pypa/pipenv
pipenv/patched/notpip/_vendor/urllib3/contrib/pyopenssl.py
get_subj_alt_name
def get_subj_alt_name(peer_cert): """ Given an PyOpenSSL certificate, provides all the subject alternative names. """ # Pass the cert to cryptography, which has much better APIs for this. if hasattr(peer_cert, "to_cryptography"): cert = peer_cert.to_cryptography() else: # This is...
python
def get_subj_alt_name(peer_cert): """ Given an PyOpenSSL certificate, provides all the subject alternative names. """ # Pass the cert to cryptography, which has much better APIs for this. if hasattr(peer_cert, "to_cryptography"): cert = peer_cert.to_cryptography() else: # This is...
[ "def", "get_subj_alt_name", "(", "peer_cert", ")", ":", "# Pass the cert to cryptography, which has much better APIs for this.", "if", "hasattr", "(", "peer_cert", ",", "\"to_cryptography\"", ")", ":", "cert", "=", "peer_cert", ".", "to_cryptography", "(", ")", "else", ...
Given an PyOpenSSL certificate, provides all the subject alternative names.
[ "Given", "an", "PyOpenSSL", "certificate", "provides", "all", "the", "subject", "alternative", "names", "." ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/urllib3/contrib/pyopenssl.py#L195-L244
train
pypa/pipenv
pipenv/vendor/chardet/chardistribution.py
CharDistributionAnalysis.feed
def feed(self, char, char_len): """feed a character with known length""" if char_len == 2: # we only care about 2-bytes character in our distribution analysis order = self.get_order(char) else: order = -1 if order >= 0: self._total_chars +=...
python
def feed(self, char, char_len): """feed a character with known length""" if char_len == 2: # we only care about 2-bytes character in our distribution analysis order = self.get_order(char) else: order = -1 if order >= 0: self._total_chars +=...
[ "def", "feed", "(", "self", ",", "char", ",", "char_len", ")", ":", "if", "char_len", "==", "2", ":", "# we only care about 2-bytes character in our distribution analysis", "order", "=", "self", ".", "get_order", "(", "char", ")", "else", ":", "order", "=", "-...
feed a character with known length
[ "feed", "a", "character", "with", "known", "length" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/chardet/chardistribution.py#L70-L82
train
pypa/pipenv
pipenv/vendor/chardet/chardistribution.py
CharDistributionAnalysis.get_confidence
def get_confidence(self): """return confidence based on existing data""" # if we didn't receive any character in our consideration range, # return negative answer if self._total_chars <= 0 or self._freq_chars <= self.MINIMUM_DATA_THRESHOLD: return self.SURE_NO if sel...
python
def get_confidence(self): """return confidence based on existing data""" # if we didn't receive any character in our consideration range, # return negative answer if self._total_chars <= 0 or self._freq_chars <= self.MINIMUM_DATA_THRESHOLD: return self.SURE_NO if sel...
[ "def", "get_confidence", "(", "self", ")", ":", "# if we didn't receive any character in our consideration range,", "# return negative answer", "if", "self", ".", "_total_chars", "<=", "0", "or", "self", ".", "_freq_chars", "<=", "self", ".", "MINIMUM_DATA_THRESHOLD", ":"...
return confidence based on existing data
[ "return", "confidence", "based", "on", "existing", "data" ]
cae8d76c210b9777e90aab76e9c4b0e53bb19cde
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/chardet/chardistribution.py#L84-L98
train