partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
valid | tui.keys | List names of options and positional arguments. | tui/__init__.py | def keys(self):
"""List names of options and positional arguments."""
return self.options.keys() + [p.name for p in self.positional_args] | def keys(self):
"""List names of options and positional arguments."""
return self.options.keys() + [p.name for p in self.positional_args] | [
"List",
"names",
"of",
"options",
"and",
"positional",
"arguments",
"."
] | yohell/python-tui | python | https://github.com/yohell/python-tui/blob/de2e678e2f00e5940de52c000214dbcb8812a222/tui/__init__.py#L1112-L1114 | [
"def",
"keys",
"(",
"self",
")",
":",
"return",
"self",
".",
"options",
".",
"keys",
"(",
")",
"+",
"[",
"p",
".",
"name",
"for",
"p",
"in",
"self",
".",
"positional_args",
"]"
] | de2e678e2f00e5940de52c000214dbcb8812a222 |
valid | tui.values | List values of options and positional arguments. | tui/__init__.py | def values(self):
"""List values of options and positional arguments."""
return self.options.values() + [p.value for p in self.positional_args] | def values(self):
"""List values of options and positional arguments."""
return self.options.values() + [p.value for p in self.positional_args] | [
"List",
"values",
"of",
"options",
"and",
"positional",
"arguments",
"."
] | yohell/python-tui | python | https://github.com/yohell/python-tui/blob/de2e678e2f00e5940de52c000214dbcb8812a222/tui/__init__.py#L1116-L1118 | [
"def",
"values",
"(",
"self",
")",
":",
"return",
"self",
".",
"options",
".",
"values",
"(",
")",
"+",
"[",
"p",
".",
"value",
"for",
"p",
"in",
"self",
".",
"positional_args",
"]"
] | de2e678e2f00e5940de52c000214dbcb8812a222 |
valid | tui.items | List values of options and positional arguments. | tui/__init__.py | def items(self):
"""List values of options and positional arguments."""
return [(p.name, p.value) for p in self.options.values() + self.positional_args] | def items(self):
"""List values of options and positional arguments."""
return [(p.name, p.value) for p in self.options.values() + self.positional_args] | [
"List",
"values",
"of",
"options",
"and",
"positional",
"arguments",
"."
] | yohell/python-tui | python | https://github.com/yohell/python-tui/blob/de2e678e2f00e5940de52c000214dbcb8812a222/tui/__init__.py#L1120-L1122 | [
"def",
"items",
"(",
"self",
")",
":",
"return",
"[",
"(",
"p",
".",
"name",
",",
"p",
".",
"value",
")",
"for",
"p",
"in",
"self",
".",
"options",
".",
"values",
"(",
")",
"+",
"self",
".",
"positional_args",
"]"
] | de2e678e2f00e5940de52c000214dbcb8812a222 |
valid | tui.getparam | Get option or positional argument, by name, index or abbreviation.
Abbreviations must be prefixed by a '-' character, like so: ui['-a'] | tui/__init__.py | def getparam(self, key):
"""Get option or positional argument, by name, index or abbreviation.
Abbreviations must be prefixed by a '-' character, like so: ui['-a']
"""
try:
return self.options[key]
except:
pass
for posarg in self.positiona... | def getparam(self, key):
"""Get option or positional argument, by name, index or abbreviation.
Abbreviations must be prefixed by a '-' character, like so: ui['-a']
"""
try:
return self.options[key]
except:
pass
for posarg in self.positiona... | [
"Get",
"option",
"or",
"positional",
"argument",
"by",
"name",
"index",
"or",
"abbreviation",
".",
"Abbreviations",
"must",
"be",
"prefixed",
"by",
"a",
"-",
"character",
"like",
"so",
":",
"ui",
"[",
"-",
"a",
"]"
] | yohell/python-tui | python | https://github.com/yohell/python-tui/blob/de2e678e2f00e5940de52c000214dbcb8812a222/tui/__init__.py#L1131-L1146 | [
"def",
"getparam",
"(",
"self",
",",
"key",
")",
":",
"try",
":",
"return",
"self",
".",
"options",
"[",
"key",
"]",
"except",
":",
"pass",
"for",
"posarg",
"in",
"self",
".",
"positional_args",
":",
"if",
"posarg",
".",
"name",
"==",
"key",
":",
"... | de2e678e2f00e5940de52c000214dbcb8812a222 |
valid | tui._add_option | Add an Option object to the user interface. | tui/__init__.py | def _add_option(self, option):
"""Add an Option object to the user interface."""
if option.name in self.options:
raise ValueError('name already in use')
if option.abbreviation in self.abbreviations:
raise ValueError('abbreviation already in use')
if option.name in... | def _add_option(self, option):
"""Add an Option object to the user interface."""
if option.name in self.options:
raise ValueError('name already in use')
if option.abbreviation in self.abbreviations:
raise ValueError('abbreviation already in use')
if option.name in... | [
"Add",
"an",
"Option",
"object",
"to",
"the",
"user",
"interface",
"."
] | yohell/python-tui | python | https://github.com/yohell/python-tui/blob/de2e678e2f00e5940de52c000214dbcb8812a222/tui/__init__.py#L1148-L1159 | [
"def",
"_add_option",
"(",
"self",
",",
"option",
")",
":",
"if",
"option",
".",
"name",
"in",
"self",
".",
"options",
":",
"raise",
"ValueError",
"(",
"'name already in use'",
")",
"if",
"option",
".",
"abbreviation",
"in",
"self",
".",
"abbreviations",
"... | de2e678e2f00e5940de52c000214dbcb8812a222 |
valid | tui._add_positional_argument | Append a positional argument to the user interface.
Optional positional arguments must be added after the required ones.
The user interface can have at most one recurring positional argument,
and if present, that argument must be the last one. | tui/__init__.py | def _add_positional_argument(self, posarg):
"""Append a positional argument to the user interface.
Optional positional arguments must be added after the required ones.
The user interface can have at most one recurring positional argument,
and if present, that argument must be the last... | def _add_positional_argument(self, posarg):
"""Append a positional argument to the user interface.
Optional positional arguments must be added after the required ones.
The user interface can have at most one recurring positional argument,
and if present, that argument must be the last... | [
"Append",
"a",
"positional",
"argument",
"to",
"the",
"user",
"interface",
"."
] | yohell/python-tui | python | https://github.com/yohell/python-tui/blob/de2e678e2f00e5940de52c000214dbcb8812a222/tui/__init__.py#L1161-L1173 | [
"def",
"_add_positional_argument",
"(",
"self",
",",
"posarg",
")",
":",
"if",
"self",
".",
"positional_args",
":",
"if",
"self",
".",
"positional_args",
"[",
"-",
"1",
"]",
".",
"recurring",
":",
"raise",
"ValueError",
"(",
"\"recurring positional arguments mus... | de2e678e2f00e5940de52c000214dbcb8812a222 |
valid | tui.read_docs | Read program documentation from a DocParser compatible file.
docsfiles is a list of paths to potential docsfiles: parse if present.
A string is taken as a list of one item. | tui/__init__.py | def read_docs(self, docsfiles):
"""Read program documentation from a DocParser compatible file.
docsfiles is a list of paths to potential docsfiles: parse if present.
A string is taken as a list of one item.
"""
updates = DocParser()
for docsfile in _list(docsfiles):
... | def read_docs(self, docsfiles):
"""Read program documentation from a DocParser compatible file.
docsfiles is a list of paths to potential docsfiles: parse if present.
A string is taken as a list of one item.
"""
updates = DocParser()
for docsfile in _list(docsfiles):
... | [
"Read",
"program",
"documentation",
"from",
"a",
"DocParser",
"compatible",
"file",
"."
] | yohell/python-tui | python | https://github.com/yohell/python-tui/blob/de2e678e2f00e5940de52c000214dbcb8812a222/tui/__init__.py#L1175-L1190 | [
"def",
"read_docs",
"(",
"self",
",",
"docsfiles",
")",
":",
"updates",
"=",
"DocParser",
"(",
")",
"for",
"docsfile",
"in",
"_list",
"(",
"docsfiles",
")",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"docsfile",
")",
":",
"updates",
".",
"pars... | de2e678e2f00e5940de52c000214dbcb8812a222 |
valid | tui.parse_files | Parse configfiles.
files <list str>, <str> or None:
What files to parse. None means use self.configfiles. New
values override old ones. A string value will be interpreted
as a list of one item.
sections <list str>, <str> or None:
Which sections to parse f... | tui/__init__.py | def parse_files(self, files=None, sections=None):
"""Parse configfiles.
files <list str>, <str> or None:
What files to parse. None means use self.configfiles. New
values override old ones. A string value will be interpreted
as a list of one item.
sections <li... | def parse_files(self, files=None, sections=None):
"""Parse configfiles.
files <list str>, <str> or None:
What files to parse. None means use self.configfiles. New
values override old ones. A string value will be interpreted
as a list of one item.
sections <li... | [
"Parse",
"configfiles",
".",
"files",
"<list",
"str",
">",
"<str",
">",
"or",
"None",
":",
"What",
"files",
"to",
"parse",
".",
"None",
"means",
"use",
"self",
".",
"configfiles",
".",
"New",
"values",
"override",
"old",
"ones",
".",
"A",
"string",
"va... | yohell/python-tui | python | https://github.com/yohell/python-tui/blob/de2e678e2f00e5940de52c000214dbcb8812a222/tui/__init__.py#L1223-L1255 | [
"def",
"parse_files",
"(",
"self",
",",
"files",
"=",
"None",
",",
"sections",
"=",
"None",
")",
":",
"files",
"=",
"_list",
"(",
"files",
",",
"self",
".",
"configfiles",
")",
"sections",
"=",
"_list",
"(",
"sections",
",",
"self",
".",
"sections",
... | de2e678e2f00e5940de52c000214dbcb8812a222 |
valid | tui._parse_options | Parse the options part of an argument list.
IN:
lsArgs <list str>:
List of arguments. Will be altered.
location <str>:
A user friendly string describing where this data came from. | tui/__init__.py | def _parse_options(self, argv, location):
"""Parse the options part of an argument list.
IN:
lsArgs <list str>:
List of arguments. Will be altered.
location <str>:
A user friendly string describing where this data came from.
"""
observ... | def _parse_options(self, argv, location):
"""Parse the options part of an argument list.
IN:
lsArgs <list str>:
List of arguments. Will be altered.
location <str>:
A user friendly string describing where this data came from.
"""
observ... | [
"Parse",
"the",
"options",
"part",
"of",
"an",
"argument",
"list",
".",
"IN",
":",
"lsArgs",
"<list",
"str",
">",
":",
"List",
"of",
"arguments",
".",
"Will",
"be",
"altered",
".",
"location",
"<str",
">",
":",
"A",
"user",
"friendly",
"string",
"descr... | yohell/python-tui | python | https://github.com/yohell/python-tui/blob/de2e678e2f00e5940de52c000214dbcb8812a222/tui/__init__.py#L1257-L1300 | [
"def",
"_parse_options",
"(",
"self",
",",
"argv",
",",
"location",
")",
":",
"observed",
"=",
"[",
"]",
"while",
"argv",
":",
"if",
"argv",
"[",
"0",
"]",
".",
"startswith",
"(",
"'--'",
")",
":",
"name",
"=",
"argv",
".",
"pop",
"(",
"0",
")",
... | de2e678e2f00e5940de52c000214dbcb8812a222 |
valid | tui._parse_positional_arguments | Parse the positional arguments part of an argument list.
argv <list str>:
List of arguments. Will be altered. | tui/__init__.py | def _parse_positional_arguments(self, argv):
"""Parse the positional arguments part of an argument list.
argv <list str>:
List of arguments. Will be altered.
"""
for posarg in self.positional_args:
posarg.parse(argv)
if argv:
if None in [p.narg... | def _parse_positional_arguments(self, argv):
"""Parse the positional arguments part of an argument list.
argv <list str>:
List of arguments. Will be altered.
"""
for posarg in self.positional_args:
posarg.parse(argv)
if argv:
if None in [p.narg... | [
"Parse",
"the",
"positional",
"arguments",
"part",
"of",
"an",
"argument",
"list",
".",
"argv",
"<list",
"str",
">",
":",
"List",
"of",
"arguments",
".",
"Will",
"be",
"altered",
"."
] | yohell/python-tui | python | https://github.com/yohell/python-tui/blob/de2e678e2f00e5940de52c000214dbcb8812a222/tui/__init__.py#L1302-L1316 | [
"def",
"_parse_positional_arguments",
"(",
"self",
",",
"argv",
")",
":",
"for",
"posarg",
"in",
"self",
".",
"positional_args",
":",
"posarg",
".",
"parse",
"(",
"argv",
")",
"if",
"argv",
":",
"if",
"None",
"in",
"[",
"p",
".",
"nargs",
"for",
"p",
... | de2e678e2f00e5940de52c000214dbcb8812a222 |
valid | tui.parse_argv | Parse command line arguments.
args <list str> or None:
The argument list to parse. None means use a copy of sys.argv. argv[0] is
ignored.
location = '' <str>:
A user friendly string describing where the parser got this
data from. '' means use "Com... | tui/__init__.py | def parse_argv(self, argv=None, location='Command line.'):
"""Parse command line arguments.
args <list str> or None:
The argument list to parse. None means use a copy of sys.argv. argv[0] is
ignored.
location = '' <str>:
A user friendly string describ... | def parse_argv(self, argv=None, location='Command line.'):
"""Parse command line arguments.
args <list str> or None:
The argument list to parse. None means use a copy of sys.argv. argv[0] is
ignored.
location = '' <str>:
A user friendly string describ... | [
"Parse",
"command",
"line",
"arguments",
".",
"args",
"<list",
"str",
">",
"or",
"None",
":",
"The",
"argument",
"list",
"to",
"parse",
".",
"None",
"means",
"use",
"a",
"copy",
"of",
"sys",
".",
"argv",
".",
"argv",
"[",
"0",
"]",
"is",
"ignored",
... | yohell/python-tui | python | https://github.com/yohell/python-tui/blob/de2e678e2f00e5940de52c000214dbcb8812a222/tui/__init__.py#L1318-L1334 | [
"def",
"parse_argv",
"(",
"self",
",",
"argv",
"=",
"None",
",",
"location",
"=",
"'Command line.'",
")",
":",
"if",
"argv",
"is",
"None",
":",
"argv",
"=",
"list",
"(",
"sys",
".",
"argv",
")",
"argv",
".",
"pop",
"(",
"0",
")",
"self",
".",
"_p... | de2e678e2f00e5940de52c000214dbcb8812a222 |
valid | tui.optionhelp | Return user friendly help on program options. | tui/__init__.py | def optionhelp(self, indent=0, maxindent=25, width=79):
"""Return user friendly help on program options."""
def makelabels(option):
labels = '%*s--%s' % (indent, ' ', option.name)
if option.abbreviation:
labels += ', -' + option.abbreviation
return lab... | def optionhelp(self, indent=0, maxindent=25, width=79):
"""Return user friendly help on program options."""
def makelabels(option):
labels = '%*s--%s' % (indent, ' ', option.name)
if option.abbreviation:
labels += ', -' + option.abbreviation
return lab... | [
"Return",
"user",
"friendly",
"help",
"on",
"program",
"options",
"."
] | yohell/python-tui | python | https://github.com/yohell/python-tui/blob/de2e678e2f00e5940de52c000214dbcb8812a222/tui/__init__.py#L1336-L1351 | [
"def",
"optionhelp",
"(",
"self",
",",
"indent",
"=",
"0",
",",
"maxindent",
"=",
"25",
",",
"width",
"=",
"79",
")",
":",
"def",
"makelabels",
"(",
"option",
")",
":",
"labels",
"=",
"'%*s--%s'",
"%",
"(",
"indent",
",",
"' '",
",",
"option",
".",... | de2e678e2f00e5940de52c000214dbcb8812a222 |
valid | tui.posarghelp | Return user friendly help on positional arguments in the program. | tui/__init__.py | def posarghelp(self, indent=0, maxindent=25, width=79):
"""Return user friendly help on positional arguments in the program."""
docs = []
makelabel = lambda posarg: ' ' * indent + posarg.displayname + ': '
helpindent = _autoindent([makelabel(p) for p in self.positional_args], indent, max... | def posarghelp(self, indent=0, maxindent=25, width=79):
"""Return user friendly help on positional arguments in the program."""
docs = []
makelabel = lambda posarg: ' ' * indent + posarg.displayname + ': '
helpindent = _autoindent([makelabel(p) for p in self.positional_args], indent, max... | [
"Return",
"user",
"friendly",
"help",
"on",
"positional",
"arguments",
"in",
"the",
"program",
"."
] | yohell/python-tui | python | https://github.com/yohell/python-tui/blob/de2e678e2f00e5940de52c000214dbcb8812a222/tui/__init__.py#L1353-L1363 | [
"def",
"posarghelp",
"(",
"self",
",",
"indent",
"=",
"0",
",",
"maxindent",
"=",
"25",
",",
"width",
"=",
"79",
")",
":",
"docs",
"=",
"[",
"]",
"makelabel",
"=",
"lambda",
"posarg",
":",
"' '",
"*",
"indent",
"+",
"posarg",
".",
"displayname",
"+... | de2e678e2f00e5940de52c000214dbcb8812a222 |
valid | tui.format_usage | Return a formatted usage string.
If usage is None, use self.docs['usage'], and if that is also None,
generate one. | tui/__init__.py | def format_usage(self, usage=None):
"""Return a formatted usage string.
If usage is None, use self.docs['usage'], and if that is also None,
generate one.
"""
if usage is None:
usage = self.docs['usage']
if usage is not None:
return usage... | def format_usage(self, usage=None):
"""Return a formatted usage string.
If usage is None, use self.docs['usage'], and if that is also None,
generate one.
"""
if usage is None:
usage = self.docs['usage']
if usage is not None:
return usage... | [
"Return",
"a",
"formatted",
"usage",
"string",
".",
"If",
"usage",
"is",
"None",
"use",
"self",
".",
"docs",
"[",
"usage",
"]",
"and",
"if",
"that",
"is",
"also",
"None",
"generate",
"one",
"."
] | yohell/python-tui | python | https://github.com/yohell/python-tui/blob/de2e678e2f00e5940de52c000214dbcb8812a222/tui/__init__.py#L1365-L1390 | [
"def",
"format_usage",
"(",
"self",
",",
"usage",
"=",
"None",
")",
":",
"if",
"usage",
"is",
"None",
":",
"usage",
"=",
"self",
".",
"docs",
"[",
"'usage'",
"]",
"if",
"usage",
"is",
"not",
"None",
":",
"return",
"usage",
"[",
"0",
"]",
"%",
"se... | de2e678e2f00e5940de52c000214dbcb8812a222 |
valid | tui._wrap | Textwrap an indented paragraph.
ARGS:
width = 0 <int>:
Maximum allowed page width. 0 means use default from
self.iMaxHelpWidth. | tui/__init__.py | def _wrap(self, text, indent=0, width=0):
"""Textwrap an indented paragraph.
ARGS:
width = 0 <int>:
Maximum allowed page width. 0 means use default from
self.iMaxHelpWidth.
"""
text = _list(text)
if not width:
width = self.width
... | def _wrap(self, text, indent=0, width=0):
"""Textwrap an indented paragraph.
ARGS:
width = 0 <int>:
Maximum allowed page width. 0 means use default from
self.iMaxHelpWidth.
"""
text = _list(text)
if not width:
width = self.width
... | [
"Textwrap",
"an",
"indented",
"paragraph",
".",
"ARGS",
":",
"width",
"=",
"0",
"<int",
">",
":",
"Maximum",
"allowed",
"page",
"width",
".",
"0",
"means",
"use",
"default",
"from",
"self",
".",
"iMaxHelpWidth",
"."
] | yohell/python-tui | python | https://github.com/yohell/python-tui/blob/de2e678e2f00e5940de52c000214dbcb8812a222/tui/__init__.py#L1392-L1406 | [
"def",
"_wrap",
"(",
"self",
",",
"text",
",",
"indent",
"=",
"0",
",",
"width",
"=",
"0",
")",
":",
"text",
"=",
"_list",
"(",
"text",
")",
"if",
"not",
"width",
":",
"width",
"=",
"self",
".",
"width",
"paragraph",
"=",
"text",
"[",
"0",
"]",... | de2e678e2f00e5940de52c000214dbcb8812a222 |
valid | tui._wraptext | Shorthand for '\n'.join(self._wrap(par, indent, width) for par in text). | tui/__init__.py | def _wraptext(self, text, indent=0, width=0):
"""Shorthand for '\n'.join(self._wrap(par, indent, width) for par in text)."""
return '\n'.join(self._wrap(par, indent, width) for par in text) | def _wraptext(self, text, indent=0, width=0):
"""Shorthand for '\n'.join(self._wrap(par, indent, width) for par in text)."""
return '\n'.join(self._wrap(par, indent, width) for par in text) | [
"Shorthand",
"for",
"\\",
"n",
".",
"join",
"(",
"self",
".",
"_wrap",
"(",
"par",
"indent",
"width",
")",
"for",
"par",
"in",
"text",
")",
"."
] | yohell/python-tui | python | https://github.com/yohell/python-tui/blob/de2e678e2f00e5940de52c000214dbcb8812a222/tui/__init__.py#L1408-L1410 | [
"def",
"_wraptext",
"(",
"self",
",",
"text",
",",
"indent",
"=",
"0",
",",
"width",
"=",
"0",
")",
":",
"return",
"'\\n'",
".",
"join",
"(",
"self",
".",
"_wrap",
"(",
"par",
",",
"indent",
",",
"width",
")",
"for",
"par",
"in",
"text",
")"
] | de2e678e2f00e5940de52c000214dbcb8812a222 |
valid | tui._wrapusage | Textwrap usage instructions.
ARGS:
width = 0 <int>:
Maximum allowed page width. 0 means use default from
self.iMaxHelpWidth. | tui/__init__.py | def _wrapusage(self, usage=None, width=0):
"""Textwrap usage instructions.
ARGS:
width = 0 <int>:
Maximum allowed page width. 0 means use default from
self.iMaxHelpWidth.
"""
if not width:
width = self.width
return textwrap.fill('USAGE... | def _wrapusage(self, usage=None, width=0):
"""Textwrap usage instructions.
ARGS:
width = 0 <int>:
Maximum allowed page width. 0 means use default from
self.iMaxHelpWidth.
"""
if not width:
width = self.width
return textwrap.fill('USAGE... | [
"Textwrap",
"usage",
"instructions",
".",
"ARGS",
":",
"width",
"=",
"0",
"<int",
">",
":",
"Maximum",
"allowed",
"page",
"width",
".",
"0",
"means",
"use",
"default",
"from",
"self",
".",
"iMaxHelpWidth",
"."
] | yohell/python-tui | python | https://github.com/yohell/python-tui/blob/de2e678e2f00e5940de52c000214dbcb8812a222/tui/__init__.py#L1422-L1432 | [
"def",
"_wrapusage",
"(",
"self",
",",
"usage",
"=",
"None",
",",
"width",
"=",
"0",
")",
":",
"if",
"not",
"width",
":",
"width",
"=",
"self",
".",
"width",
"return",
"textwrap",
".",
"fill",
"(",
"'USAGE: '",
"+",
"self",
".",
"format_usage",
"(",
... | de2e678e2f00e5940de52c000214dbcb8812a222 |
valid | tui.shorthelp | Return brief help containing Title and usage instructions.
ARGS:
width = 0 <int>:
Maximum allowed page width. 0 means use default from
self.iMaxHelpWidth. | tui/__init__.py | def shorthelp(self, width=0):
"""Return brief help containing Title and usage instructions.
ARGS:
width = 0 <int>:
Maximum allowed page width. 0 means use default from
self.iMaxHelpWidth.
"""
out = []
out.append(self._wrap(self.docs['title'], widt... | def shorthelp(self, width=0):
"""Return brief help containing Title and usage instructions.
ARGS:
width = 0 <int>:
Maximum allowed page width. 0 means use default from
self.iMaxHelpWidth.
"""
out = []
out.append(self._wrap(self.docs['title'], widt... | [
"Return",
"brief",
"help",
"containing",
"Title",
"and",
"usage",
"instructions",
".",
"ARGS",
":",
"width",
"=",
"0",
"<int",
">",
":",
"Maximum",
"allowed",
"page",
"width",
".",
"0",
"means",
"use",
"default",
"from",
"self",
".",
"iMaxHelpWidth",
"."
] | yohell/python-tui | python | https://github.com/yohell/python-tui/blob/de2e678e2f00e5940de52c000214dbcb8812a222/tui/__init__.py#L1441-L1456 | [
"def",
"shorthelp",
"(",
"self",
",",
"width",
"=",
"0",
")",
":",
"out",
"=",
"[",
"]",
"out",
".",
"append",
"(",
"self",
".",
"_wrap",
"(",
"self",
".",
"docs",
"[",
"'title'",
"]",
",",
"width",
"=",
"width",
")",
")",
"if",
"self",
".",
... | de2e678e2f00e5940de52c000214dbcb8812a222 |
valid | tui.strsettings | Return user friendly help on positional arguments.
indent is the number of spaces preceeding the text on each line.
The indent of the documentation is dependent on the length of the
longest label that is shorter than maxindent. A label longer than
maxindent will be p... | tui/__init__.py | def strsettings(self, indent=0, maxindent=25, width=0):
"""Return user friendly help on positional arguments.
indent is the number of spaces preceeding the text on each line.
The indent of the documentation is dependent on the length of the
longest label that is short... | def strsettings(self, indent=0, maxindent=25, width=0):
"""Return user friendly help on positional arguments.
indent is the number of spaces preceeding the text on each line.
The indent of the documentation is dependent on the length of the
longest label that is short... | [
"Return",
"user",
"friendly",
"help",
"on",
"positional",
"arguments",
"."
] | yohell/python-tui | python | https://github.com/yohell/python-tui/blob/de2e678e2f00e5940de52c000214dbcb8812a222/tui/__init__.py#L1513-L1533 | [
"def",
"strsettings",
"(",
"self",
",",
"indent",
"=",
"0",
",",
"maxindent",
"=",
"25",
",",
"width",
"=",
"0",
")",
":",
"out",
"=",
"[",
"]",
"makelabel",
"=",
"lambda",
"name",
":",
"' '",
"*",
"indent",
"+",
"name",
"+",
"': '",
"settingsinden... | de2e678e2f00e5940de52c000214dbcb8812a222 |
valid | tui.settingshelp | Return a summary of program options, their values and origins.
width is maximum allowed page width, use self.width if 0. | tui/__init__.py | def settingshelp(self, width=0):
"""Return a summary of program options, their values and origins.
width is maximum allowed page width, use self.width if 0.
"""
out = []
out.append(self._wrap(self.docs['title'], width=width))
if self.docs['description']:
... | def settingshelp(self, width=0):
"""Return a summary of program options, their values and origins.
width is maximum allowed page width, use self.width if 0.
"""
out = []
out.append(self._wrap(self.docs['title'], width=width))
if self.docs['description']:
... | [
"Return",
"a",
"summary",
"of",
"program",
"options",
"their",
"values",
"and",
"origins",
".",
"width",
"is",
"maximum",
"allowed",
"page",
"width",
"use",
"self",
".",
"width",
"if",
"0",
"."
] | yohell/python-tui | python | https://github.com/yohell/python-tui/blob/de2e678e2f00e5940de52c000214dbcb8812a222/tui/__init__.py#L1535-L1548 | [
"def",
"settingshelp",
"(",
"self",
",",
"width",
"=",
"0",
")",
":",
"out",
"=",
"[",
"]",
"out",
".",
"append",
"(",
"self",
".",
"_wrap",
"(",
"self",
".",
"docs",
"[",
"'title'",
"]",
",",
"width",
"=",
"width",
")",
")",
"if",
"self",
".",... | de2e678e2f00e5940de52c000214dbcb8812a222 |
valid | tui.launch | Do the usual stuff to initiallize the program.
Read config files and parse arguments, and if the user has used any
of the help/version/settings options, display help and exit.
If debug_parser is false, don't catch ParseErrors and exit with user
friendly help. Crash wit... | tui/__init__.py | def launch(self,
argv=None,
showusageonnoargs=False,
width=0,
helphint="Use with --help for more information.\n",
debug_parser=False):
"""Do the usual stuff to initiallize the program.
Read config files and parse argumen... | def launch(self,
argv=None,
showusageonnoargs=False,
width=0,
helphint="Use with --help for more information.\n",
debug_parser=False):
"""Do the usual stuff to initiallize the program.
Read config files and parse argumen... | [
"Do",
"the",
"usual",
"stuff",
"to",
"initiallize",
"the",
"program",
".",
"Read",
"config",
"files",
"and",
"parse",
"arguments",
"and",
"if",
"the",
"user",
"has",
"used",
"any",
"of",
"the",
"help",
"/",
"version",
"/",
"settings",
"options",
"display",... | yohell/python-tui | python | https://github.com/yohell/python-tui/blob/de2e678e2f00e5940de52c000214dbcb8812a222/tui/__init__.py#L1550-L1599 | [
"def",
"launch",
"(",
"self",
",",
"argv",
"=",
"None",
",",
"showusageonnoargs",
"=",
"False",
",",
"width",
"=",
"0",
",",
"helphint",
"=",
"\"Use with --help for more information.\\n\"",
",",
"debug_parser",
"=",
"False",
")",
":",
"if",
"showusageonnoargs",
... | de2e678e2f00e5940de52c000214dbcb8812a222 |
valid | TextBlockParser.parse | Parse text blocks from a file. | tui/textblockparser.py | def parse(self, file):
"""Parse text blocks from a file."""
if isinstance(file, basestring):
file = open(file)
line_number = 0
label = None
block = self.untagged
for line in file:
line_number += 1
line = line.rstrip('\n')
if... | def parse(self, file):
"""Parse text blocks from a file."""
if isinstance(file, basestring):
file = open(file)
line_number = 0
label = None
block = self.untagged
for line in file:
line_number += 1
line = line.rstrip('\n')
if... | [
"Parse",
"text",
"blocks",
"from",
"a",
"file",
"."
] | yohell/python-tui | python | https://github.com/yohell/python-tui/blob/de2e678e2f00e5940de52c000214dbcb8812a222/tui/textblockparser.py#L180-L217 | [
"def",
"parse",
"(",
"self",
",",
"file",
")",
":",
"if",
"isinstance",
"(",
"file",
",",
"basestring",
")",
":",
"file",
"=",
"open",
"(",
"file",
")",
"line_number",
"=",
"0",
"label",
"=",
"None",
"block",
"=",
"self",
".",
"untagged",
"for",
"l... | de2e678e2f00e5940de52c000214dbcb8812a222 |
valid | get_format | Get a format object.
If format is a format object, return unchanged. If it is a string
matching one of the BaseFormat subclasses in the tui.formats module
(case insensitive), return an instance of that class. Otherwise assume
it'a factory function for Formats (such as a class) so call and return,... | tui/formats.py | def get_format(format):
"""Get a format object.
If format is a format object, return unchanged. If it is a string
matching one of the BaseFormat subclasses in the tui.formats module
(case insensitive), return an instance of that class. Otherwise assume
it'a factory function for Formats (such ... | def get_format(format):
"""Get a format object.
If format is a format object, return unchanged. If it is a string
matching one of the BaseFormat subclasses in the tui.formats module
(case insensitive), return an instance of that class. Otherwise assume
it'a factory function for Formats (such ... | [
"Get",
"a",
"format",
"object",
".",
"If",
"format",
"is",
"a",
"format",
"object",
"return",
"unchanged",
".",
"If",
"it",
"is",
"a",
"string",
"matching",
"one",
"of",
"the",
"BaseFormat",
"subclasses",
"in",
"the",
"tui",
".",
"formats",
"module",
"("... | yohell/python-tui | python | https://github.com/yohell/python-tui/blob/de2e678e2f00e5940de52c000214dbcb8812a222/tui/formats.py#L123-L143 | [
"def",
"get_format",
"(",
"format",
")",
":",
"if",
"isinstance",
"(",
"format",
",",
"BaseFormat",
")",
":",
"return",
"format",
"if",
"isinstance",
"(",
"format",
",",
"basestring",
")",
":",
"for",
"name",
",",
"formatclass",
"in",
"globals",
"(",
")"... | de2e678e2f00e5940de52c000214dbcb8812a222 |
valid | BaseFormat.parsestr | Parse arguments found in settings files.
argstr is the string that should be parsed. Use e.g. '""' to pass an
empty string.
if self.nargs > 1 a list of parsed values will be returned.
NOTE: formats with nargs == 0 or None probably want to override this
method. | tui/formats.py | def parsestr(self, argstr):
"""Parse arguments found in settings files.
argstr is the string that should be parsed. Use e.g. '""' to pass an
empty string.
if self.nargs > 1 a list of parsed values will be returned.
NOTE: formats with nargs == 0 or None probably want to... | def parsestr(self, argstr):
"""Parse arguments found in settings files.
argstr is the string that should be parsed. Use e.g. '""' to pass an
empty string.
if self.nargs > 1 a list of parsed values will be returned.
NOTE: formats with nargs == 0 or None probably want to... | [
"Parse",
"arguments",
"found",
"in",
"settings",
"files",
".",
"argstr",
"is",
"the",
"string",
"that",
"should",
"be",
"parsed",
".",
"Use",
"e",
".",
"g",
".",
"to",
"pass",
"an",
"empty",
"string",
"."
] | yohell/python-tui | python | https://github.com/yohell/python-tui/blob/de2e678e2f00e5940de52c000214dbcb8812a222/tui/formats.py#L101-L115 | [
"def",
"parsestr",
"(",
"self",
",",
"argstr",
")",
":",
"argv",
"=",
"shlex",
".",
"split",
"(",
"argstr",
",",
"comments",
"=",
"True",
")",
"if",
"len",
"(",
"argv",
")",
"!=",
"self",
".",
"nargs",
":",
"raise",
"BadNumberOfArguments",
"(",
"self... | de2e678e2f00e5940de52c000214dbcb8812a222 |
valid | Format.parse_argument | Parse a single argument.
Lookup arg in self.specials, or call .to_python() if absent. Raise
BadArgument on errors. | tui/formats.py | def parse_argument(self, arg):
"""Parse a single argument.
Lookup arg in self.specials, or call .to_python() if absent. Raise
BadArgument on errors.
"""
lookup = self.casesensitive and arg or arg.lower()
if lookup in self.special:
return self.special... | def parse_argument(self, arg):
"""Parse a single argument.
Lookup arg in self.specials, or call .to_python() if absent. Raise
BadArgument on errors.
"""
lookup = self.casesensitive and arg or arg.lower()
if lookup in self.special:
return self.special... | [
"Parse",
"a",
"single",
"argument",
".",
"Lookup",
"arg",
"in",
"self",
".",
"specials",
"or",
"call",
".",
"to_python",
"()",
"if",
"absent",
".",
"Raise",
"BadArgument",
"on",
"errors",
"."
] | yohell/python-tui | python | https://github.com/yohell/python-tui/blob/de2e678e2f00e5940de52c000214dbcb8812a222/tui/formats.py#L187-L199 | [
"def",
"parse_argument",
"(",
"self",
",",
"arg",
")",
":",
"lookup",
"=",
"self",
".",
"casesensitive",
"and",
"arg",
"or",
"arg",
".",
"lower",
"(",
")",
"if",
"lookup",
"in",
"self",
".",
"special",
":",
"return",
"self",
".",
"special",
"[",
"loo... | de2e678e2f00e5940de52c000214dbcb8812a222 |
valid | Format.parse | Pop, parse and return the first self.nargs items from args.
if self.nargs > 1 a list of parsed values will be returned.
Raise BadNumberOfArguments or BadArgument on errors.
NOTE: argv may be modified in place by this method. | tui/formats.py | def parse(self, argv):
"""Pop, parse and return the first self.nargs items from args.
if self.nargs > 1 a list of parsed values will be returned.
Raise BadNumberOfArguments or BadArgument on errors.
NOTE: argv may be modified in place by this method.
"""
... | def parse(self, argv):
"""Pop, parse and return the first self.nargs items from args.
if self.nargs > 1 a list of parsed values will be returned.
Raise BadNumberOfArguments or BadArgument on errors.
NOTE: argv may be modified in place by this method.
"""
... | [
"Pop",
"parse",
"and",
"return",
"the",
"first",
"self",
".",
"nargs",
"items",
"from",
"args",
"."
] | yohell/python-tui | python | https://github.com/yohell/python-tui/blob/de2e678e2f00e5940de52c000214dbcb8812a222/tui/formats.py#L201-L214 | [
"def",
"parse",
"(",
"self",
",",
"argv",
")",
":",
"if",
"len",
"(",
"argv",
")",
"<",
"self",
".",
"nargs",
":",
"raise",
"BadNumberOfArguments",
"(",
"self",
".",
"nargs",
",",
"len",
"(",
"argv",
")",
")",
"if",
"self",
".",
"nargs",
"==",
"1... | de2e678e2f00e5940de52c000214dbcb8812a222 |
valid | Format.present | Return a user-friendly representation of a value.
Lookup value in self.specials, or call .to_literal() if absent. | tui/formats.py | def present(self, value):
"""Return a user-friendly representation of a value.
Lookup value in self.specials, or call .to_literal() if absent.
"""
for k, v in self.special.items():
if v == value:
return k
return self.to_literal(value, *self.ar... | def present(self, value):
"""Return a user-friendly representation of a value.
Lookup value in self.specials, or call .to_literal() if absent.
"""
for k, v in self.special.items():
if v == value:
return k
return self.to_literal(value, *self.ar... | [
"Return",
"a",
"user",
"-",
"friendly",
"representation",
"of",
"a",
"value",
".",
"Lookup",
"value",
"in",
"self",
".",
"specials",
"or",
"call",
".",
"to_literal",
"()",
"if",
"absent",
"."
] | yohell/python-tui | python | https://github.com/yohell/python-tui/blob/de2e678e2f00e5940de52c000214dbcb8812a222/tui/formats.py#L216-L224 | [
"def",
"present",
"(",
"self",
",",
"value",
")",
":",
"for",
"k",
",",
"v",
"in",
"self",
".",
"special",
".",
"items",
"(",
")",
":",
"if",
"v",
"==",
"value",
":",
"return",
"k",
"return",
"self",
".",
"to_literal",
"(",
"value",
",",
"*",
"... | de2e678e2f00e5940de52c000214dbcb8812a222 |
valid | Flag.parsestr | Parse arguments found in settings files.
Use the values in self.true for True in settings files, or those in
self.false for False, case insensitive. | tui/formats.py | def parsestr(self, argstr):
"""Parse arguments found in settings files.
Use the values in self.true for True in settings files, or those in
self.false for False, case insensitive.
"""
argv = shlex.split(argstr, comments=True)
if len(argv) != 1:
raise... | def parsestr(self, argstr):
"""Parse arguments found in settings files.
Use the values in self.true for True in settings files, or those in
self.false for False, case insensitive.
"""
argv = shlex.split(argstr, comments=True)
if len(argv) != 1:
raise... | [
"Parse",
"arguments",
"found",
"in",
"settings",
"files",
".",
"Use",
"the",
"values",
"in",
"self",
".",
"true",
"for",
"True",
"in",
"settings",
"files",
"or",
"those",
"in",
"self",
".",
"false",
"for",
"False",
"case",
"insensitive",
"."
] | yohell/python-tui | python | https://github.com/yohell/python-tui/blob/de2e678e2f00e5940de52c000214dbcb8812a222/tui/formats.py#L239-L254 | [
"def",
"parsestr",
"(",
"self",
",",
"argstr",
")",
":",
"argv",
"=",
"shlex",
".",
"split",
"(",
"argstr",
",",
"comments",
"=",
"True",
")",
"if",
"len",
"(",
"argv",
")",
"!=",
"1",
":",
"raise",
"BadNumberOfArguments",
"(",
"1",
",",
"len",
"("... | de2e678e2f00e5940de52c000214dbcb8812a222 |
valid | List.parse | Pop, parse and return the first arg from argv.
The arg will be .split() based on self.separator and the (optionally
stripped) items will be parsed by self.format and returned as a list.
Raise BadNumberOfArguments or BadArgument on errors.
NOTE: args will be modified... | tui/formats.py | def parse(self, argv):
"""Pop, parse and return the first arg from argv.
The arg will be .split() based on self.separator and the (optionally
stripped) items will be parsed by self.format and returned as a list.
Raise BadNumberOfArguments or BadArgument on errors.
... | def parse(self, argv):
"""Pop, parse and return the first arg from argv.
The arg will be .split() based on self.separator and the (optionally
stripped) items will be parsed by self.format and returned as a list.
Raise BadNumberOfArguments or BadArgument on errors.
... | [
"Pop",
"parse",
"and",
"return",
"the",
"first",
"arg",
"from",
"argv",
".",
"The",
"arg",
"will",
"be",
".",
"split",
"()",
"based",
"on",
"self",
".",
"separator",
"and",
"the",
"(",
"optionally",
"stripped",
")",
"items",
"will",
"be",
"parsed",
"by... | yohell/python-tui | python | https://github.com/yohell/python-tui/blob/de2e678e2f00e5940de52c000214dbcb8812a222/tui/formats.py#L499-L519 | [
"def",
"parse",
"(",
"self",
",",
"argv",
")",
":",
"if",
"not",
"argv",
":",
"raise",
"BadNumberOfArguments",
"(",
"1",
",",
"0",
")",
"argument",
"=",
"argv",
".",
"pop",
"(",
"0",
")",
"lookup",
"=",
"self",
".",
"casesensitive",
"and",
"argument"... | de2e678e2f00e5940de52c000214dbcb8812a222 |
valid | List.present | Return a user-friendly representation of a value.
Lookup value in self.specials, or call .to_literal() if absent. | tui/formats.py | def present(self, value):
"""Return a user-friendly representation of a value.
Lookup value in self.specials, or call .to_literal() if absent.
"""
for k, v in self.special.items():
if v == value:
return k
return self.separator.join(self.format... | def present(self, value):
"""Return a user-friendly representation of a value.
Lookup value in self.specials, or call .to_literal() if absent.
"""
for k, v in self.special.items():
if v == value:
return k
return self.separator.join(self.format... | [
"Return",
"a",
"user",
"-",
"friendly",
"representation",
"of",
"a",
"value",
".",
"Lookup",
"value",
"in",
"self",
".",
"specials",
"or",
"call",
".",
"to_literal",
"()",
"if",
"absent",
"."
] | yohell/python-tui | python | https://github.com/yohell/python-tui/blob/de2e678e2f00e5940de52c000214dbcb8812a222/tui/formats.py#L521-L529 | [
"def",
"present",
"(",
"self",
",",
"value",
")",
":",
"for",
"k",
",",
"v",
"in",
"self",
".",
"special",
".",
"items",
"(",
")",
":",
"if",
"v",
"==",
"value",
":",
"return",
"k",
"return",
"self",
".",
"separator",
".",
"join",
"(",
"self",
... | de2e678e2f00e5940de52c000214dbcb8812a222 |
valid | Tuple.get_separator | Return the separator that preceding format i, or '' for i == 0. | tui/formats.py | def get_separator(self, i):
"""Return the separator that preceding format i, or '' for i == 0."""
return i and self.separator[min(i - 1, len(self.separator) - 1)] or '' | def get_separator(self, i):
"""Return the separator that preceding format i, or '' for i == 0."""
return i and self.separator[min(i - 1, len(self.separator) - 1)] or '' | [
"Return",
"the",
"separator",
"that",
"preceding",
"format",
"i",
"or",
"for",
"i",
"==",
"0",
"."
] | yohell/python-tui | python | https://github.com/yohell/python-tui/blob/de2e678e2f00e5940de52c000214dbcb8812a222/tui/formats.py#L561-L563 | [
"def",
"get_separator",
"(",
"self",
",",
"i",
")",
":",
"return",
"i",
"and",
"self",
".",
"separator",
"[",
"min",
"(",
"i",
"-",
"1",
",",
"len",
"(",
"self",
".",
"separator",
")",
"-",
"1",
")",
"]",
"or",
"''"
] | de2e678e2f00e5940de52c000214dbcb8812a222 |
valid | Tuple.parse | Pop, parse and return the first arg from argv.
The arg will be repeatedly .split(x, 1) based on self.get_separator() and the
(optionally stripped) items will be parsed by self.format and returned
as a list.
Raise BadNumberOfArguments or BadArgument on errors.
... | tui/formats.py | def parse(self, argv):
"""Pop, parse and return the first arg from argv.
The arg will be repeatedly .split(x, 1) based on self.get_separator() and the
(optionally stripped) items will be parsed by self.format and returned
as a list.
Raise BadNumberOfArguments or BadAr... | def parse(self, argv):
"""Pop, parse and return the first arg from argv.
The arg will be repeatedly .split(x, 1) based on self.get_separator() and the
(optionally stripped) items will be parsed by self.format and returned
as a list.
Raise BadNumberOfArguments or BadAr... | [
"Pop",
"parse",
"and",
"return",
"the",
"first",
"arg",
"from",
"argv",
".",
"The",
"arg",
"will",
"be",
"repeatedly",
".",
"split",
"(",
"x",
"1",
")",
"based",
"on",
"self",
".",
"get_separator",
"()",
"and",
"the",
"(",
"optionally",
"stripped",
")"... | yohell/python-tui | python | https://github.com/yohell/python-tui/blob/de2e678e2f00e5940de52c000214dbcb8812a222/tui/formats.py#L591-L621 | [
"def",
"parse",
"(",
"self",
",",
"argv",
")",
":",
"if",
"not",
"argv",
":",
"raise",
"BadNumberOfArguments",
"(",
"1",
",",
"0",
")",
"remainder",
"=",
"argv",
".",
"pop",
"(",
"0",
")",
"lookup",
"=",
"self",
".",
"casesensitive",
"and",
"remainde... | de2e678e2f00e5940de52c000214dbcb8812a222 |
valid | Tuple.present | Return a user-friendly representation of a value.
Lookup value in self.specials, or call .to_literal() if absent. | tui/formats.py | def present(self, value):
"""Return a user-friendly representation of a value.
Lookup value in self.specials, or call .to_literal() if absent.
"""
for k, v in self.special.items():
if v == value:
return k
return ''.join(self.get_separator(i) +... | def present(self, value):
"""Return a user-friendly representation of a value.
Lookup value in self.specials, or call .to_literal() if absent.
"""
for k, v in self.special.items():
if v == value:
return k
return ''.join(self.get_separator(i) +... | [
"Return",
"a",
"user",
"-",
"friendly",
"representation",
"of",
"a",
"value",
".",
"Lookup",
"value",
"in",
"self",
".",
"specials",
"or",
"call",
".",
"to_literal",
"()",
"if",
"absent",
"."
] | yohell/python-tui | python | https://github.com/yohell/python-tui/blob/de2e678e2f00e5940de52c000214dbcb8812a222/tui/formats.py#L623-L631 | [
"def",
"present",
"(",
"self",
",",
"value",
")",
":",
"for",
"k",
",",
"v",
"in",
"self",
".",
"special",
".",
"items",
"(",
")",
":",
"if",
"v",
"==",
"value",
":",
"return",
"k",
"return",
"''",
".",
"join",
"(",
"self",
".",
"get_separator",
... | de2e678e2f00e5940de52c000214dbcb8812a222 |
valid | MixcloudOauth.authorize_url | Return a URL to redirect the user to for OAuth authentication. | mixcloud/__init__.py | def authorize_url(self):
"""
Return a URL to redirect the user to for OAuth authentication.
"""
auth_url = OAUTH_ROOT + '/authorize'
params = {
'client_id': self.client_id,
'redirect_uri': self.redirect_uri,
}
return "{}?{}".format(auth_url... | def authorize_url(self):
"""
Return a URL to redirect the user to for OAuth authentication.
"""
auth_url = OAUTH_ROOT + '/authorize'
params = {
'client_id': self.client_id,
'redirect_uri': self.redirect_uri,
}
return "{}?{}".format(auth_url... | [
"Return",
"a",
"URL",
"to",
"redirect",
"the",
"user",
"to",
"for",
"OAuth",
"authentication",
"."
] | emillon/mixcloud | python | https://github.com/emillon/mixcloud/blob/da4c7a70444c7f1712ee13e3a93eb1cd9c3f4ab8/mixcloud/__init__.py#L46-L55 | [
"def",
"authorize_url",
"(",
"self",
")",
":",
"auth_url",
"=",
"OAUTH_ROOT",
"+",
"'/authorize'",
"params",
"=",
"{",
"'client_id'",
":",
"self",
".",
"client_id",
",",
"'redirect_uri'",
":",
"self",
".",
"redirect_uri",
",",
"}",
"return",
"\"{}?{}\"",
"."... | da4c7a70444c7f1712ee13e3a93eb1cd9c3f4ab8 |
valid | MixcloudOauth.exchange_token | Exchange the authorization code for an access token. | mixcloud/__init__.py | def exchange_token(self, code):
"""
Exchange the authorization code for an access token.
"""
access_token_url = OAUTH_ROOT + '/access_token'
params = {
'client_id': self.client_id,
'client_secret': self.client_secret,
'redirect_uri': self.redir... | def exchange_token(self, code):
"""
Exchange the authorization code for an access token.
"""
access_token_url = OAUTH_ROOT + '/access_token'
params = {
'client_id': self.client_id,
'client_secret': self.client_secret,
'redirect_uri': self.redir... | [
"Exchange",
"the",
"authorization",
"code",
"for",
"an",
"access",
"token",
"."
] | emillon/mixcloud | python | https://github.com/emillon/mixcloud/blob/da4c7a70444c7f1712ee13e3a93eb1cd9c3f4ab8/mixcloud/__init__.py#L57-L71 | [
"def",
"exchange_token",
"(",
"self",
",",
"code",
")",
":",
"access_token_url",
"=",
"OAUTH_ROOT",
"+",
"'/access_token'",
"params",
"=",
"{",
"'client_id'",
":",
"self",
".",
"client_id",
",",
"'client_secret'",
":",
"self",
".",
"client_secret",
",",
"'redi... | da4c7a70444c7f1712ee13e3a93eb1cd9c3f4ab8 |
valid | get_open_port | Gets a PORT that will (probably) be available on the machine.
It is possible that in-between the time in which the open PORT of found and when it is used, another process may
bind to it instead.
:return: the (probably) available PORT | hgicommon/helpers.py | def get_open_port() -> int:
"""
Gets a PORT that will (probably) be available on the machine.
It is possible that in-between the time in which the open PORT of found and when it is used, another process may
bind to it instead.
:return: the (probably) available PORT
"""
free_socket = socket.s... | def get_open_port() -> int:
"""
Gets a PORT that will (probably) be available on the machine.
It is possible that in-between the time in which the open PORT of found and when it is used, another process may
bind to it instead.
:return: the (probably) available PORT
"""
free_socket = socket.s... | [
"Gets",
"a",
"PORT",
"that",
"will",
"(",
"probably",
")",
"be",
"available",
"on",
"the",
"machine",
".",
"It",
"is",
"possible",
"that",
"in",
"-",
"between",
"the",
"time",
"in",
"which",
"the",
"open",
"PORT",
"of",
"found",
"and",
"when",
"it",
... | wtsi-hgi/python-common | python | https://github.com/wtsi-hgi/python-common/blob/0376a6b574ff46e82e509e90b6cb3693a3dbb577/hgicommon/helpers.py#L19-L31 | [
"def",
"get_open_port",
"(",
")",
"->",
"int",
":",
"free_socket",
"=",
"socket",
".",
"socket",
"(",
"socket",
".",
"AF_INET",
",",
"socket",
".",
"SOCK_STREAM",
")",
"free_socket",
".",
"bind",
"(",
"(",
"\"\"",
",",
"0",
")",
")",
"free_socket",
"."... | 0376a6b574ff46e82e509e90b6cb3693a3dbb577 |
valid | extract_version_number | Extracts a version from a string in the form: `.*[0-9]+(_[0-9]+)*.*`, e.g. Irods4_1_9CompatibleController.
If the string contains multiple version numbers, the first (from left) is extracted.
Will raise a `ValueError` if there is no version number in the given string.
:param string: the string containing ... | hgicommon/helpers.py | def extract_version_number(string: str) -> str:
"""
Extracts a version from a string in the form: `.*[0-9]+(_[0-9]+)*.*`, e.g. Irods4_1_9CompatibleController.
If the string contains multiple version numbers, the first (from left) is extracted.
Will raise a `ValueError` if there is no version number in... | def extract_version_number(string: str) -> str:
"""
Extracts a version from a string in the form: `.*[0-9]+(_[0-9]+)*.*`, e.g. Irods4_1_9CompatibleController.
If the string contains multiple version numbers, the first (from left) is extracted.
Will raise a `ValueError` if there is no version number in... | [
"Extracts",
"a",
"version",
"from",
"a",
"string",
"in",
"the",
"form",
":",
".",
"*",
"[",
"0",
"-",
"9",
"]",
"+",
"(",
"_",
"[",
"0",
"-",
"9",
"]",
"+",
")",
"*",
".",
"*",
"e",
".",
"g",
".",
"Irods4_1_9CompatibleController",
"."
] | wtsi-hgi/python-common | python | https://github.com/wtsi-hgi/python-common/blob/0376a6b574ff46e82e509e90b6cb3693a3dbb577/hgicommon/helpers.py#L34-L47 | [
"def",
"extract_version_number",
"(",
"string",
":",
"str",
")",
"->",
"str",
":",
"matched",
"=",
"_EXTRACT_VERSION_PATTERN",
".",
"search",
"(",
"string",
")",
"if",
"matched",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"No version number in string\"",
"... | 0376a6b574ff46e82e509e90b6cb3693a3dbb577 |
valid | CountingLock.acquire | Wraps Lock.acquire | hgicommon/threading/counting_lock.py | def acquire(self, *args, **kwargs):
""" Wraps Lock.acquire """
with self._stat_lock:
self._waiting += 1
self._lock.acquire(*args, **kwargs)
with self._stat_lock:
self._locked = True
self._waiting -= 1 | def acquire(self, *args, **kwargs):
""" Wraps Lock.acquire """
with self._stat_lock:
self._waiting += 1
self._lock.acquire(*args, **kwargs)
with self._stat_lock:
self._locked = True
self._waiting -= 1 | [
"Wraps",
"Lock",
".",
"acquire"
] | wtsi-hgi/python-common | python | https://github.com/wtsi-hgi/python-common/blob/0376a6b574ff46e82e509e90b6cb3693a3dbb577/hgicommon/threading/counting_lock.py#L44-L53 | [
"def",
"acquire",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"with",
"self",
".",
"_stat_lock",
":",
"self",
".",
"_waiting",
"+=",
"1",
"self",
".",
"_lock",
".",
"acquire",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
... | 0376a6b574ff46e82e509e90b6cb3693a3dbb577 |
valid | CountingLock.release | Wraps Lock.release | hgicommon/threading/counting_lock.py | def release(self):
""" Wraps Lock.release """
self._lock.release()
with self._stat_lock:
self._locked = False
self._last_released = datetime.now() | def release(self):
""" Wraps Lock.release """
self._lock.release()
with self._stat_lock:
self._locked = False
self._last_released = datetime.now() | [
"Wraps",
"Lock",
".",
"release"
] | wtsi-hgi/python-common | python | https://github.com/wtsi-hgi/python-common/blob/0376a6b574ff46e82e509e90b6cb3693a3dbb577/hgicommon/threading/counting_lock.py#L55-L61 | [
"def",
"release",
"(",
"self",
")",
":",
"self",
".",
"_lock",
".",
"release",
"(",
")",
"with",
"self",
".",
"_stat_lock",
":",
"self",
".",
"_locked",
"=",
"False",
"self",
".",
"_last_released",
"=",
"datetime",
".",
"now",
"(",
")"
] | 0376a6b574ff46e82e509e90b6cb3693a3dbb577 |
valid | DefaultCustomTypeCodec.default_decoder | Handle a dict that might contain a wrapped state for a custom type. | asphalt/serialization/object_codec.py | def default_decoder(self, obj):
"""Handle a dict that might contain a wrapped state for a custom type."""
typename, marshalled_state = self.unwrap_callback(obj)
if typename is None:
return obj
try:
cls, unmarshaller = self.serializer.unmarshallers[typename]
... | def default_decoder(self, obj):
"""Handle a dict that might contain a wrapped state for a custom type."""
typename, marshalled_state = self.unwrap_callback(obj)
if typename is None:
return obj
try:
cls, unmarshaller = self.serializer.unmarshallers[typename]
... | [
"Handle",
"a",
"dict",
"that",
"might",
"contain",
"a",
"wrapped",
"state",
"for",
"a",
"custom",
"type",
"."
] | asphalt-framework/asphalt-serialization | python | https://github.com/asphalt-framework/asphalt-serialization/blob/866d172972cbd25d288161317b85d7332d0517c6/asphalt/serialization/object_codec.py#L38-L54 | [
"def",
"default_decoder",
"(",
"self",
",",
"obj",
")",
":",
"typename",
",",
"marshalled_state",
"=",
"self",
".",
"unwrap_callback",
"(",
"obj",
")",
"if",
"typename",
"is",
"None",
":",
"return",
"obj",
"try",
":",
"cls",
",",
"unmarshaller",
"=",
"se... | 866d172972cbd25d288161317b85d7332d0517c6 |
valid | DefaultCustomTypeCodec.wrap_state_dict | Wrap the marshalled state in a dictionary.
The returned dictionary has two keys, corresponding to the ``type_key`` and ``state_key``
options. The former holds the type name and the latter holds the marshalled state.
:param typename: registered name of the custom type
:param state: the ... | asphalt/serialization/object_codec.py | def wrap_state_dict(self, typename: str, state) -> Dict[str, Any]:
"""
Wrap the marshalled state in a dictionary.
The returned dictionary has two keys, corresponding to the ``type_key`` and ``state_key``
options. The former holds the type name and the latter holds the marshalled state.
... | def wrap_state_dict(self, typename: str, state) -> Dict[str, Any]:
"""
Wrap the marshalled state in a dictionary.
The returned dictionary has two keys, corresponding to the ``type_key`` and ``state_key``
options. The former holds the type name and the latter holds the marshalled state.
... | [
"Wrap",
"the",
"marshalled",
"state",
"in",
"a",
"dictionary",
"."
] | asphalt-framework/asphalt-serialization | python | https://github.com/asphalt-framework/asphalt-serialization/blob/866d172972cbd25d288161317b85d7332d0517c6/asphalt/serialization/object_codec.py#L56-L68 | [
"def",
"wrap_state_dict",
"(",
"self",
",",
"typename",
":",
"str",
",",
"state",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"return",
"{",
"self",
".",
"type_key",
":",
"typename",
",",
"self",
".",
"state_key",
":",
"state",
"}"
] | 866d172972cbd25d288161317b85d7332d0517c6 |
valid | DefaultCustomTypeCodec.unwrap_state_dict | Unwraps a marshalled state previously wrapped using :meth:`wrap_state_dict`. | asphalt/serialization/object_codec.py | def unwrap_state_dict(self, obj: Dict[str, Any]) -> Union[Tuple[str, Any], Tuple[None, None]]:
"""Unwraps a marshalled state previously wrapped using :meth:`wrap_state_dict`."""
if len(obj) == 2:
typename = obj.get(self.type_key)
state = obj.get(self.state_key)
if typ... | def unwrap_state_dict(self, obj: Dict[str, Any]) -> Union[Tuple[str, Any], Tuple[None, None]]:
"""Unwraps a marshalled state previously wrapped using :meth:`wrap_state_dict`."""
if len(obj) == 2:
typename = obj.get(self.type_key)
state = obj.get(self.state_key)
if typ... | [
"Unwraps",
"a",
"marshalled",
"state",
"previously",
"wrapped",
"using",
":",
"meth",
":",
"wrap_state_dict",
"."
] | asphalt-framework/asphalt-serialization | python | https://github.com/asphalt-framework/asphalt-serialization/blob/866d172972cbd25d288161317b85d7332d0517c6/asphalt/serialization/object_codec.py#L70-L78 | [
"def",
"unwrap_state_dict",
"(",
"self",
",",
"obj",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
")",
"->",
"Union",
"[",
"Tuple",
"[",
"str",
",",
"Any",
"]",
",",
"Tuple",
"[",
"None",
",",
"None",
"]",
"]",
":",
"if",
"len",
"(",
"obj",
")",
... | 866d172972cbd25d288161317b85d7332d0517c6 |
valid | publish | Enable HTTP access to a dataset.
This only works on datasets in some systems. For example, datasets stored
in AWS S3 object storage and Microsoft Azure Storage can be published as
datasets accessible over HTTP. A published dataset is world readable. | dtool_create/publish.py | def publish(quiet, dataset_uri):
"""Enable HTTP access to a dataset.
This only works on datasets in some systems. For example, datasets stored
in AWS S3 object storage and Microsoft Azure Storage can be published as
datasets accessible over HTTP. A published dataset is world readable.
"""
acces... | def publish(quiet, dataset_uri):
"""Enable HTTP access to a dataset.
This only works on datasets in some systems. For example, datasets stored
in AWS S3 object storage and Microsoft Azure Storage can be published as
datasets accessible over HTTP. A published dataset is world readable.
"""
acces... | [
"Enable",
"HTTP",
"access",
"to",
"a",
"dataset",
"."
] | jic-dtool/dtool-create | python | https://github.com/jic-dtool/dtool-create/blob/12172363d14eaedba2db4c452ef995b14f1b630d/dtool_create/publish.py#L15-L25 | [
"def",
"publish",
"(",
"quiet",
",",
"dataset_uri",
")",
":",
"access_uri",
"=",
"http_publish",
"(",
"dataset_uri",
")",
"if",
"not",
"quiet",
":",
"click",
".",
"secho",
"(",
"\"Dataset accessible at \"",
",",
"nl",
"=",
"False",
",",
"fg",
"=",
"\"green... | 12172363d14eaedba2db4c452ef995b14f1b630d |
valid | CustomizableSerializer.register_custom_type | Register a marshaller and/or unmarshaller for the given class.
The state object returned by the marshaller and passed to the unmarshaller can be any
serializable type. Usually a dictionary mapping of attribute names to values is used.
.. warning:: Registering marshallers/unmarshallers for any ... | asphalt/serialization/api.py | def register_custom_type(
self, cls: type, marshaller: Optional[Callable[[Any], Any]] = default_marshaller,
unmarshaller: Union[Callable[[Any, Any], None],
Callable[[Any], Any], None] = default_unmarshaller, *,
typename: str = None, wrap_state: bool = ... | def register_custom_type(
self, cls: type, marshaller: Optional[Callable[[Any], Any]] = default_marshaller,
unmarshaller: Union[Callable[[Any, Any], None],
Callable[[Any], Any], None] = default_unmarshaller, *,
typename: str = None, wrap_state: bool = ... | [
"Register",
"a",
"marshaller",
"and",
"/",
"or",
"unmarshaller",
"for",
"the",
"given",
"class",
"."
] | asphalt-framework/asphalt-serialization | python | https://github.com/asphalt-framework/asphalt-serialization/blob/866d172972cbd25d288161317b85d7332d0517c6/asphalt/serialization/api.py#L61-L102 | [
"def",
"register_custom_type",
"(",
"self",
",",
"cls",
":",
"type",
",",
"marshaller",
":",
"Optional",
"[",
"Callable",
"[",
"[",
"Any",
"]",
",",
"Any",
"]",
"]",
"=",
"default_marshaller",
",",
"unmarshaller",
":",
"Union",
"[",
"Callable",
"[",
"[",... | 866d172972cbd25d288161317b85d7332d0517c6 |
valid | _prompt_for_values | Update the descriptive metadata interactively.
Uses values entered by the user. Note that the function keeps recursing
whenever a value is another ``CommentedMap`` or a ``list``. The
function works as passing dictionaries and lists into a function edits
the values in place. | dtool_create/dataset.py | def _prompt_for_values(d):
"""Update the descriptive metadata interactively.
Uses values entered by the user. Note that the function keeps recursing
whenever a value is another ``CommentedMap`` or a ``list``. The
function works as passing dictionaries and lists into a function edits
the values in p... | def _prompt_for_values(d):
"""Update the descriptive metadata interactively.
Uses values entered by the user. Note that the function keeps recursing
whenever a value is another ``CommentedMap`` or a ``list``. The
function works as passing dictionaries and lists into a function edits
the values in p... | [
"Update",
"the",
"descriptive",
"metadata",
"interactively",
"."
] | jic-dtool/dtool-create | python | https://github.com/jic-dtool/dtool-create/blob/12172363d14eaedba2db4c452ef995b14f1b630d/dtool_create/dataset.py#L74-L96 | [
"def",
"_prompt_for_values",
"(",
"d",
")",
":",
"for",
"key",
",",
"value",
"in",
"d",
".",
"items",
"(",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"CommentedMap",
")",
":",
"_prompt_for_values",
"(",
"value",
")",
"elif",
"isinstance",
"(",
"v... | 12172363d14eaedba2db4c452ef995b14f1b630d |
valid | create | Create a proto dataset. | dtool_create/dataset.py | def create(quiet, name, base_uri, symlink_path):
"""Create a proto dataset."""
_validate_name(name)
admin_metadata = dtoolcore.generate_admin_metadata(name)
parsed_base_uri = dtoolcore.utils.generous_parse_uri(base_uri)
if parsed_base_uri.scheme == "symlink":
if symlink_path is None:
... | def create(quiet, name, base_uri, symlink_path):
"""Create a proto dataset."""
_validate_name(name)
admin_metadata = dtoolcore.generate_admin_metadata(name)
parsed_base_uri = dtoolcore.utils.generous_parse_uri(base_uri)
if parsed_base_uri.scheme == "symlink":
if symlink_path is None:
... | [
"Create",
"a",
"proto",
"dataset",
"."
] | jic-dtool/dtool-create | python | https://github.com/jic-dtool/dtool-create/blob/12172363d14eaedba2db4c452ef995b14f1b630d/dtool_create/dataset.py#L119-L189 | [
"def",
"create",
"(",
"quiet",
",",
"name",
",",
"base_uri",
",",
"symlink_path",
")",
":",
"_validate_name",
"(",
"name",
")",
"admin_metadata",
"=",
"dtoolcore",
".",
"generate_admin_metadata",
"(",
"name",
")",
"parsed_base_uri",
"=",
"dtoolcore",
".",
"uti... | 12172363d14eaedba2db4c452ef995b14f1b630d |
valid | name | Report / update the name of the dataset.
It is only possible to update the name of a proto dataset,
i.e. a dataset that has not yet been frozen. | dtool_create/dataset.py | def name(dataset_uri, new_name):
"""
Report / update the name of the dataset.
It is only possible to update the name of a proto dataset,
i.e. a dataset that has not yet been frozen.
"""
if new_name != "":
_validate_name(new_name)
try:
dataset = dtoolcore.ProtoDataSe... | def name(dataset_uri, new_name):
"""
Report / update the name of the dataset.
It is only possible to update the name of a proto dataset,
i.e. a dataset that has not yet been frozen.
"""
if new_name != "":
_validate_name(new_name)
try:
dataset = dtoolcore.ProtoDataSe... | [
"Report",
"/",
"update",
"the",
"name",
"of",
"the",
"dataset",
"."
] | jic-dtool/dtool-create | python | https://github.com/jic-dtool/dtool-create/blob/12172363d14eaedba2db4c452ef995b14f1b630d/dtool_create/dataset.py#L195-L222 | [
"def",
"name",
"(",
"dataset_uri",
",",
"new_name",
")",
":",
"if",
"new_name",
"!=",
"\"\"",
":",
"_validate_name",
"(",
"new_name",
")",
"try",
":",
"dataset",
"=",
"dtoolcore",
".",
"ProtoDataSet",
".",
"from_uri",
"(",
"uri",
"=",
"dataset_uri",
",",
... | 12172363d14eaedba2db4c452ef995b14f1b630d |
valid | interactive | Interactive prompting to populate the readme. | dtool_create/dataset.py | def interactive(proto_dataset_uri):
"""Interactive prompting to populate the readme."""
proto_dataset = dtoolcore.ProtoDataSet.from_uri(
uri=proto_dataset_uri,
config_path=CONFIG_PATH)
# Create an CommentedMap representation of the yaml readme template.
readme_template = _get_readme_tem... | def interactive(proto_dataset_uri):
"""Interactive prompting to populate the readme."""
proto_dataset = dtoolcore.ProtoDataSet.from_uri(
uri=proto_dataset_uri,
config_path=CONFIG_PATH)
# Create an CommentedMap representation of the yaml readme template.
readme_template = _get_readme_tem... | [
"Interactive",
"prompting",
"to",
"populate",
"the",
"readme",
"."
] | jic-dtool/dtool-create | python | https://github.com/jic-dtool/dtool-create/blob/12172363d14eaedba2db4c452ef995b14f1b630d/dtool_create/dataset.py#L235-L261 | [
"def",
"interactive",
"(",
"proto_dataset_uri",
")",
":",
"proto_dataset",
"=",
"dtoolcore",
".",
"ProtoDataSet",
".",
"from_uri",
"(",
"uri",
"=",
"proto_dataset_uri",
",",
"config_path",
"=",
"CONFIG_PATH",
")",
"# Create an CommentedMap representation of the yaml readm... | 12172363d14eaedba2db4c452ef995b14f1b630d |
valid | edit | Default editor updating of readme content. | dtool_create/dataset.py | def edit(dataset_uri):
"""Default editor updating of readme content.
"""
try:
dataset = dtoolcore.ProtoDataSet.from_uri(
uri=dataset_uri,
config_path=CONFIG_PATH
)
except dtoolcore.DtoolCoreTypeError:
dataset = dtoolcore.DataSet.from_uri(
uri=d... | def edit(dataset_uri):
"""Default editor updating of readme content.
"""
try:
dataset = dtoolcore.ProtoDataSet.from_uri(
uri=dataset_uri,
config_path=CONFIG_PATH
)
except dtoolcore.DtoolCoreTypeError:
dataset = dtoolcore.DataSet.from_uri(
uri=d... | [
"Default",
"editor",
"updating",
"of",
"readme",
"content",
"."
] | jic-dtool/dtool-create | python | https://github.com/jic-dtool/dtool-create/blob/12172363d14eaedba2db4c452ef995b14f1b630d/dtool_create/dataset.py#L287-L314 | [
"def",
"edit",
"(",
"dataset_uri",
")",
":",
"try",
":",
"dataset",
"=",
"dtoolcore",
".",
"ProtoDataSet",
".",
"from_uri",
"(",
"uri",
"=",
"dataset_uri",
",",
"config_path",
"=",
"CONFIG_PATH",
")",
"except",
"dtoolcore",
".",
"DtoolCoreTypeError",
":",
"d... | 12172363d14eaedba2db4c452ef995b14f1b630d |
valid | show | Show the descriptive metadata in the readme. | dtool_create/dataset.py | def show(dataset_uri):
"""Show the descriptive metadata in the readme."""
try:
dataset = dtoolcore.ProtoDataSet.from_uri(
uri=dataset_uri,
config_path=CONFIG_PATH
)
except dtoolcore.DtoolCoreTypeError:
dataset = dtoolcore.DataSet.from_uri(
uri=data... | def show(dataset_uri):
"""Show the descriptive metadata in the readme."""
try:
dataset = dtoolcore.ProtoDataSet.from_uri(
uri=dataset_uri,
config_path=CONFIG_PATH
)
except dtoolcore.DtoolCoreTypeError:
dataset = dtoolcore.DataSet.from_uri(
uri=data... | [
"Show",
"the",
"descriptive",
"metadata",
"in",
"the",
"readme",
"."
] | jic-dtool/dtool-create | python | https://github.com/jic-dtool/dtool-create/blob/12172363d14eaedba2db4c452ef995b14f1b630d/dtool_create/dataset.py#L319-L332 | [
"def",
"show",
"(",
"dataset_uri",
")",
":",
"try",
":",
"dataset",
"=",
"dtoolcore",
".",
"ProtoDataSet",
".",
"from_uri",
"(",
"uri",
"=",
"dataset_uri",
",",
"config_path",
"=",
"CONFIG_PATH",
")",
"except",
"dtoolcore",
".",
"DtoolCoreTypeError",
":",
"d... | 12172363d14eaedba2db4c452ef995b14f1b630d |
valid | write | Use YAML from a file or stdin to populate the readme.
To stream content from stdin use "-", e.g.
echo "desc: my data" | dtool readme write <DS_URI> - | dtool_create/dataset.py | def write(proto_dataset_uri, input):
"""Use YAML from a file or stdin to populate the readme.
To stream content from stdin use "-", e.g.
echo "desc: my data" | dtool readme write <DS_URI> -
"""
proto_dataset = dtoolcore.ProtoDataSet.from_uri(
uri=proto_dataset_uri
)
_validate_and_p... | def write(proto_dataset_uri, input):
"""Use YAML from a file or stdin to populate the readme.
To stream content from stdin use "-", e.g.
echo "desc: my data" | dtool readme write <DS_URI> -
"""
proto_dataset = dtoolcore.ProtoDataSet.from_uri(
uri=proto_dataset_uri
)
_validate_and_p... | [
"Use",
"YAML",
"from",
"a",
"file",
"or",
"stdin",
"to",
"populate",
"the",
"readme",
"."
] | jic-dtool/dtool-create | python | https://github.com/jic-dtool/dtool-create/blob/12172363d14eaedba2db4c452ef995b14f1b630d/dtool_create/dataset.py#L338-L348 | [
"def",
"write",
"(",
"proto_dataset_uri",
",",
"input",
")",
":",
"proto_dataset",
"=",
"dtoolcore",
".",
"ProtoDataSet",
".",
"from_uri",
"(",
"uri",
"=",
"proto_dataset_uri",
")",
"_validate_and_put_readme",
"(",
"proto_dataset",
",",
"input",
".",
"read",
"("... | 12172363d14eaedba2db4c452ef995b14f1b630d |
valid | item | Add a file to the proto dataset. | dtool_create/dataset.py | def item(proto_dataset_uri, input_file, relpath_in_dataset):
"""Add a file to the proto dataset."""
proto_dataset = dtoolcore.ProtoDataSet.from_uri(
proto_dataset_uri,
config_path=CONFIG_PATH)
if relpath_in_dataset == "":
relpath_in_dataset = os.path.basename(input_file)
proto_da... | def item(proto_dataset_uri, input_file, relpath_in_dataset):
"""Add a file to the proto dataset."""
proto_dataset = dtoolcore.ProtoDataSet.from_uri(
proto_dataset_uri,
config_path=CONFIG_PATH)
if relpath_in_dataset == "":
relpath_in_dataset = os.path.basename(input_file)
proto_da... | [
"Add",
"a",
"file",
"to",
"the",
"proto",
"dataset",
"."
] | jic-dtool/dtool-create | python | https://github.com/jic-dtool/dtool-create/blob/12172363d14eaedba2db4c452ef995b14f1b630d/dtool_create/dataset.py#L360-L367 | [
"def",
"item",
"(",
"proto_dataset_uri",
",",
"input_file",
",",
"relpath_in_dataset",
")",
":",
"proto_dataset",
"=",
"dtoolcore",
".",
"ProtoDataSet",
".",
"from_uri",
"(",
"proto_dataset_uri",
",",
"config_path",
"=",
"CONFIG_PATH",
")",
"if",
"relpath_in_dataset... | 12172363d14eaedba2db4c452ef995b14f1b630d |
valid | metadata | Add metadata to a file in the proto dataset. | dtool_create/dataset.py | def metadata(proto_dataset_uri, relpath_in_dataset, key, value):
"""Add metadata to a file in the proto dataset."""
proto_dataset = dtoolcore.ProtoDataSet.from_uri(
uri=proto_dataset_uri,
config_path=CONFIG_PATH)
proto_dataset.add_item_metadata(
handle=relpath_in_dataset,
key... | def metadata(proto_dataset_uri, relpath_in_dataset, key, value):
"""Add metadata to a file in the proto dataset."""
proto_dataset = dtoolcore.ProtoDataSet.from_uri(
uri=proto_dataset_uri,
config_path=CONFIG_PATH)
proto_dataset.add_item_metadata(
handle=relpath_in_dataset,
key... | [
"Add",
"metadata",
"to",
"a",
"file",
"in",
"the",
"proto",
"dataset",
"."
] | jic-dtool/dtool-create | python | https://github.com/jic-dtool/dtool-create/blob/12172363d14eaedba2db4c452ef995b14f1b630d/dtool_create/dataset.py#L375-L383 | [
"def",
"metadata",
"(",
"proto_dataset_uri",
",",
"relpath_in_dataset",
",",
"key",
",",
"value",
")",
":",
"proto_dataset",
"=",
"dtoolcore",
".",
"ProtoDataSet",
".",
"from_uri",
"(",
"uri",
"=",
"proto_dataset_uri",
",",
"config_path",
"=",
"CONFIG_PATH",
")"... | 12172363d14eaedba2db4c452ef995b14f1b630d |
valid | freeze | Convert a proto dataset into a dataset.
This step is carried out after all files have been added to the dataset.
Freezing a dataset finalizes it with a stamp marking it as frozen. | dtool_create/dataset.py | def freeze(proto_dataset_uri):
"""Convert a proto dataset into a dataset.
This step is carried out after all files have been added to the dataset.
Freezing a dataset finalizes it with a stamp marking it as frozen.
"""
proto_dataset = dtoolcore.ProtoDataSet.from_uri(
uri=proto_dataset_uri,
... | def freeze(proto_dataset_uri):
"""Convert a proto dataset into a dataset.
This step is carried out after all files have been added to the dataset.
Freezing a dataset finalizes it with a stamp marking it as frozen.
"""
proto_dataset = dtoolcore.ProtoDataSet.from_uri(
uri=proto_dataset_uri,
... | [
"Convert",
"a",
"proto",
"dataset",
"into",
"a",
"dataset",
"."
] | jic-dtool/dtool-create | python | https://github.com/jic-dtool/dtool-create/blob/12172363d14eaedba2db4c452ef995b14f1b630d/dtool_create/dataset.py#L388-L441 | [
"def",
"freeze",
"(",
"proto_dataset_uri",
")",
":",
"proto_dataset",
"=",
"dtoolcore",
".",
"ProtoDataSet",
".",
"from_uri",
"(",
"uri",
"=",
"proto_dataset_uri",
",",
"config_path",
"=",
"CONFIG_PATH",
")",
"num_items",
"=",
"len",
"(",
"list",
"(",
"proto_d... | 12172363d14eaedba2db4c452ef995b14f1b630d |
valid | copy | DEPRECATED: Copy a dataset to a different location. | dtool_create/dataset.py | def copy(resume, quiet, dataset_uri, dest_base_uri):
"""DEPRECATED: Copy a dataset to a different location."""
click.secho(
"The ``dtool copy`` command is deprecated",
fg="red",
err=True
)
click.secho(
"Use ``dtool cp`` instead",
fg="red",
err=True
)
... | def copy(resume, quiet, dataset_uri, dest_base_uri):
"""DEPRECATED: Copy a dataset to a different location."""
click.secho(
"The ``dtool copy`` command is deprecated",
fg="red",
err=True
)
click.secho(
"Use ``dtool cp`` instead",
fg="red",
err=True
)
... | [
"DEPRECATED",
":",
"Copy",
"a",
"dataset",
"to",
"a",
"different",
"location",
"."
] | jic-dtool/dtool-create | python | https://github.com/jic-dtool/dtool-create/blob/12172363d14eaedba2db4c452ef995b14f1b630d/dtool_create/dataset.py#L499-L511 | [
"def",
"copy",
"(",
"resume",
",",
"quiet",
",",
"dataset_uri",
",",
"dest_base_uri",
")",
":",
"click",
".",
"secho",
"(",
"\"The ``dtool copy`` command is deprecated\"",
",",
"fg",
"=",
"\"red\"",
",",
"err",
"=",
"True",
")",
"click",
".",
"secho",
"(",
... | 12172363d14eaedba2db4c452ef995b14f1b630d |
valid | cp | Copy a dataset to a different location. | dtool_create/dataset.py | def cp(resume, quiet, dataset_uri, dest_base_uri):
"""Copy a dataset to a different location."""
_copy(resume, quiet, dataset_uri, dest_base_uri) | def cp(resume, quiet, dataset_uri, dest_base_uri):
"""Copy a dataset to a different location."""
_copy(resume, quiet, dataset_uri, dest_base_uri) | [
"Copy",
"a",
"dataset",
"to",
"a",
"different",
"location",
"."
] | jic-dtool/dtool-create | python | https://github.com/jic-dtool/dtool-create/blob/12172363d14eaedba2db4c452ef995b14f1b630d/dtool_create/dataset.py#L519-L521 | [
"def",
"cp",
"(",
"resume",
",",
"quiet",
",",
"dataset_uri",
",",
"dest_base_uri",
")",
":",
"_copy",
"(",
"resume",
",",
"quiet",
",",
"dataset_uri",
",",
"dest_base_uri",
")"
] | 12172363d14eaedba2db4c452ef995b14f1b630d |
valid | compress | Compress anything to bytes or string.
:params obj:
:params level:
:params return_type: if bytes, then return bytes; if str, then return
base64.b64encode bytes in utf-8 string. | superjson/pkg/compresslib.py | def compress(obj, level=6, return_type="bytes"):
"""Compress anything to bytes or string.
:params obj:
:params level:
:params return_type: if bytes, then return bytes; if str, then return
base64.b64encode bytes in utf-8 string.
"""
if isinstance(obj, binary_type):
b = zlib.comp... | def compress(obj, level=6, return_type="bytes"):
"""Compress anything to bytes or string.
:params obj:
:params level:
:params return_type: if bytes, then return bytes; if str, then return
base64.b64encode bytes in utf-8 string.
"""
if isinstance(obj, binary_type):
b = zlib.comp... | [
"Compress",
"anything",
"to",
"bytes",
"or",
"string",
"."
] | MacHu-GWU/superjson-project | python | https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/pkg/compresslib.py#L58-L78 | [
"def",
"compress",
"(",
"obj",
",",
"level",
"=",
"6",
",",
"return_type",
"=",
"\"bytes\"",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"binary_type",
")",
":",
"b",
"=",
"zlib",
".",
"compress",
"(",
"obj",
",",
"level",
")",
"elif",
"isinstance... | 782ca4b2edbd4b4018b8cedee42eeae7c921b917 |
valid | _parsems | Parse a I[.F] seconds value into (seconds, microseconds). | superjson/pkg/dateutil/parser.py | def _parsems(value):
"""Parse a I[.F] seconds value into (seconds, microseconds)."""
if "." not in value:
return int(value), 0
else:
i, f = value.split(".")
return int(i), int(f.ljust(6, "0")[:6]) | def _parsems(value):
"""Parse a I[.F] seconds value into (seconds, microseconds)."""
if "." not in value:
return int(value), 0
else:
i, f = value.split(".")
return int(i), int(f.ljust(6, "0")[:6]) | [
"Parse",
"a",
"I",
"[",
".",
"F",
"]",
"seconds",
"value",
"into",
"(",
"seconds",
"microseconds",
")",
"."
] | MacHu-GWU/superjson-project | python | https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/pkg/dateutil/parser.py#L1368-L1374 | [
"def",
"_parsems",
"(",
"value",
")",
":",
"if",
"\".\"",
"not",
"in",
"value",
":",
"return",
"int",
"(",
"value",
")",
",",
"0",
"else",
":",
"i",
",",
"f",
"=",
"value",
".",
"split",
"(",
"\".\"",
")",
"return",
"int",
"(",
"i",
")",
",",
... | 782ca4b2edbd4b4018b8cedee42eeae7c921b917 |
valid | _timelex.get_token | This function breaks the time string into lexical units (tokens), which
can be parsed by the parser. Lexical units are demarcated by changes in
the character set, so any continuous string of letters is considered
one unit, any continuous string of numbers is considered one unit.
The mai... | superjson/pkg/dateutil/parser.py | def get_token(self):
"""
This function breaks the time string into lexical units (tokens), which
can be parsed by the parser. Lexical units are demarcated by changes in
the character set, so any continuous string of letters is considered
one unit, any continuous string of numbers... | def get_token(self):
"""
This function breaks the time string into lexical units (tokens), which
can be parsed by the parser. Lexical units are demarcated by changes in
the character set, so any continuous string of letters is considered
one unit, any continuous string of numbers... | [
"This",
"function",
"breaks",
"the",
"time",
"string",
"into",
"lexical",
"units",
"(",
"tokens",
")",
"which",
"can",
"be",
"parsed",
"by",
"the",
"parser",
".",
"Lexical",
"units",
"are",
"demarcated",
"by",
"changes",
"in",
"the",
"character",
"set",
"s... | MacHu-GWU/superjson-project | python | https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/pkg/dateutil/parser.py#L68-L175 | [
"def",
"get_token",
"(",
"self",
")",
":",
"if",
"self",
".",
"tokenstack",
":",
"return",
"self",
".",
"tokenstack",
".",
"pop",
"(",
"0",
")",
"seenletters",
"=",
"False",
"token",
"=",
"None",
"state",
"=",
"None",
"while",
"not",
"self",
".",
"eo... | 782ca4b2edbd4b4018b8cedee42eeae7c921b917 |
valid | _ymd.find_probable_year_index | attempt to deduce if a pre 100 year was lost
due to padded zeros being taken off | superjson/pkg/dateutil/parser.py | def find_probable_year_index(self, tokens):
"""
attempt to deduce if a pre 100 year was lost
due to padded zeros being taken off
"""
for index, token in enumerate(self):
potential_year_tokens = _ymd.find_potential_year_tokens(
token, tokens)
... | def find_probable_year_index(self, tokens):
"""
attempt to deduce if a pre 100 year was lost
due to padded zeros being taken off
"""
for index, token in enumerate(self):
potential_year_tokens = _ymd.find_potential_year_tokens(
token, tokens)
... | [
"attempt",
"to",
"deduce",
"if",
"a",
"pre",
"100",
"year",
"was",
"lost",
"due",
"to",
"padded",
"zeros",
"being",
"taken",
"off"
] | MacHu-GWU/superjson-project | python | https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/pkg/dateutil/parser.py#L391-L400 | [
"def",
"find_probable_year_index",
"(",
"self",
",",
"tokens",
")",
":",
"for",
"index",
",",
"token",
"in",
"enumerate",
"(",
"self",
")",
":",
"potential_year_tokens",
"=",
"_ymd",
".",
"find_potential_year_tokens",
"(",
"token",
",",
"tokens",
")",
"if",
... | 782ca4b2edbd4b4018b8cedee42eeae7c921b917 |
valid | parser.parse | Parse the date/time string into a :class:`datetime.datetime` object.
:param timestr:
Any date/time string using the supported formats.
:param default:
The default datetime object, if this is a datetime object and not
``None``, elements specified in ``timestr`` repla... | superjson/pkg/dateutil/parser.py | def parse(self, timestr, default=None, ignoretz=False, tzinfos=None, **kwargs):
"""
Parse the date/time string into a :class:`datetime.datetime` object.
:param timestr:
Any date/time string using the supported formats.
:param default:
The default datetime object... | def parse(self, timestr, default=None, ignoretz=False, tzinfos=None, **kwargs):
"""
Parse the date/time string into a :class:`datetime.datetime` object.
:param timestr:
Any date/time string using the supported formats.
:param default:
The default datetime object... | [
"Parse",
"the",
"date",
"/",
"time",
"string",
"into",
"a",
":",
"class",
":",
"datetime",
".",
"datetime",
"object",
"."
] | MacHu-GWU/superjson-project | python | https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/pkg/dateutil/parser.py#L490-L616 | [
"def",
"parse",
"(",
"self",
",",
"timestr",
",",
"default",
"=",
"None",
",",
"ignoretz",
"=",
"False",
",",
"tzinfos",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"default",
"is",
"None",
":",
"default",
"=",
"datetime",
".",
"datetime",
... | 782ca4b2edbd4b4018b8cedee42eeae7c921b917 |
valid | parser._parse | Private method which performs the heavy lifting of parsing, called from
``parse()``, which passes on its ``kwargs`` to this function.
:param timestr:
The string to parse.
:param dayfirst:
Whether to interpret the first value in an ambiguous 3-integer date
(e... | superjson/pkg/dateutil/parser.py | def _parse(self, timestr, dayfirst=None, yearfirst=None, fuzzy=False,
fuzzy_with_tokens=False):
"""
Private method which performs the heavy lifting of parsing, called from
``parse()``, which passes on its ``kwargs`` to this function.
:param timestr:
The string... | def _parse(self, timestr, dayfirst=None, yearfirst=None, fuzzy=False,
fuzzy_with_tokens=False):
"""
Private method which performs the heavy lifting of parsing, called from
``parse()``, which passes on its ``kwargs`` to this function.
:param timestr:
The string... | [
"Private",
"method",
"which",
"performs",
"the",
"heavy",
"lifting",
"of",
"parsing",
"called",
"from",
"parse",
"()",
"which",
"passes",
"on",
"its",
"kwargs",
"to",
"this",
"function",
"."
] | MacHu-GWU/superjson-project | python | https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/pkg/dateutil/parser.py#L623-L1069 | [
"def",
"_parse",
"(",
"self",
",",
"timestr",
",",
"dayfirst",
"=",
"None",
",",
"yearfirst",
"=",
"None",
",",
"fuzzy",
"=",
"False",
",",
"fuzzy_with_tokens",
"=",
"False",
")",
":",
"if",
"fuzzy_with_tokens",
":",
"fuzzy",
"=",
"True",
"info",
"=",
... | 782ca4b2edbd4b4018b8cedee42eeae7c921b917 |
valid | tzname_in_python2 | Change unicode output into bytestrings in Python 2
tzname() API changed in Python 3. It used to return bytes, but was changed
to unicode strings | superjson/pkg/dateutil/tz/_common.py | def tzname_in_python2(namefunc):
"""Change unicode output into bytestrings in Python 2
tzname() API changed in Python 3. It used to return bytes, but was changed
to unicode strings
"""
def adjust_encoding(*args, **kwargs):
name = namefunc(*args, **kwargs)
if name is not None and not... | def tzname_in_python2(namefunc):
"""Change unicode output into bytestrings in Python 2
tzname() API changed in Python 3. It used to return bytes, but was changed
to unicode strings
"""
def adjust_encoding(*args, **kwargs):
name = namefunc(*args, **kwargs)
if name is not None and not... | [
"Change",
"unicode",
"output",
"into",
"bytestrings",
"in",
"Python",
"2"
] | MacHu-GWU/superjson-project | python | https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/pkg/dateutil/tz/_common.py#L13-L26 | [
"def",
"tzname_in_python2",
"(",
"namefunc",
")",
":",
"def",
"adjust_encoding",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"name",
"=",
"namefunc",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"if",
"name",
"is",
"not",
"None",
"and",
... | 782ca4b2edbd4b4018b8cedee42eeae7c921b917 |
valid | _validate_fromutc_inputs | The CPython version of ``fromutc`` checks that the input is a ``datetime``
object and that ``self`` is attached as its ``tzinfo``. | superjson/pkg/dateutil/tz/_common.py | def _validate_fromutc_inputs(f):
"""
The CPython version of ``fromutc`` checks that the input is a ``datetime``
object and that ``self`` is attached as its ``tzinfo``.
"""
@wraps(f)
def fromutc(self, dt):
if not isinstance(dt, datetime):
raise TypeError("fromutc() requires a ... | def _validate_fromutc_inputs(f):
"""
The CPython version of ``fromutc`` checks that the input is a ``datetime``
object and that ``self`` is attached as its ``tzinfo``.
"""
@wraps(f)
def fromutc(self, dt):
if not isinstance(dt, datetime):
raise TypeError("fromutc() requires a ... | [
"The",
"CPython",
"version",
"of",
"fromutc",
"checks",
"that",
"the",
"input",
"is",
"a",
"datetime",
"object",
"and",
"that",
"self",
"is",
"attached",
"as",
"its",
"tzinfo",
"."
] | MacHu-GWU/superjson-project | python | https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/pkg/dateutil/tz/_common.py#L98-L112 | [
"def",
"_validate_fromutc_inputs",
"(",
"f",
")",
":",
"@",
"wraps",
"(",
"f",
")",
"def",
"fromutc",
"(",
"self",
",",
"dt",
")",
":",
"if",
"not",
"isinstance",
"(",
"dt",
",",
"datetime",
")",
":",
"raise",
"TypeError",
"(",
"\"fromutc() requires a da... | 782ca4b2edbd4b4018b8cedee42eeae7c921b917 |
valid | _tzinfo.is_ambiguous | Whether or not the "wall time" of a given datetime is ambiguous in this
zone.
:param dt:
A :py:class:`datetime.datetime`, naive or time zone aware.
:return:
Returns ``True`` if ambiguous, ``False`` otherwise.
.. versionadded:: 2.6.0 | superjson/pkg/dateutil/tz/_common.py | def is_ambiguous(self, dt):
"""
Whether or not the "wall time" of a given datetime is ambiguous in this
zone.
:param dt:
A :py:class:`datetime.datetime`, naive or time zone aware.
:return:
Returns ``True`` if ambiguous, ``False`` otherwise.
.. ... | def is_ambiguous(self, dt):
"""
Whether or not the "wall time" of a given datetime is ambiguous in this
zone.
:param dt:
A :py:class:`datetime.datetime`, naive or time zone aware.
:return:
Returns ``True`` if ambiguous, ``False`` otherwise.
.. ... | [
"Whether",
"or",
"not",
"the",
"wall",
"time",
"of",
"a",
"given",
"datetime",
"is",
"ambiguous",
"in",
"this",
"zone",
"."
] | MacHu-GWU/superjson-project | python | https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/pkg/dateutil/tz/_common.py#L120-L143 | [
"def",
"is_ambiguous",
"(",
"self",
",",
"dt",
")",
":",
"dt",
"=",
"dt",
".",
"replace",
"(",
"tzinfo",
"=",
"self",
")",
"wall_0",
"=",
"enfold",
"(",
"dt",
",",
"fold",
"=",
"0",
")",
"wall_1",
"=",
"enfold",
"(",
"dt",
",",
"fold",
"=",
"1"... | 782ca4b2edbd4b4018b8cedee42eeae7c921b917 |
valid | _tzinfo._fold_status | Determine the fold status of a "wall" datetime, given a representation
of the same datetime as a (naive) UTC datetime. This is calculated based
on the assumption that ``dt.utcoffset() - dt.dst()`` is constant for all
datetimes, and that this offset is the actual number of hours separating
... | superjson/pkg/dateutil/tz/_common.py | def _fold_status(self, dt_utc, dt_wall):
"""
Determine the fold status of a "wall" datetime, given a representation
of the same datetime as a (naive) UTC datetime. This is calculated based
on the assumption that ``dt.utcoffset() - dt.dst()`` is constant for all
datetimes, and tha... | def _fold_status(self, dt_utc, dt_wall):
"""
Determine the fold status of a "wall" datetime, given a representation
of the same datetime as a (naive) UTC datetime. This is calculated based
on the assumption that ``dt.utcoffset() - dt.dst()`` is constant for all
datetimes, and tha... | [
"Determine",
"the",
"fold",
"status",
"of",
"a",
"wall",
"datetime",
"given",
"a",
"representation",
"of",
"the",
"same",
"datetime",
"as",
"a",
"(",
"naive",
")",
"UTC",
"datetime",
".",
"This",
"is",
"calculated",
"based",
"on",
"the",
"assumption",
"tha... | MacHu-GWU/superjson-project | python | https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/pkg/dateutil/tz/_common.py#L145-L168 | [
"def",
"_fold_status",
"(",
"self",
",",
"dt_utc",
",",
"dt_wall",
")",
":",
"if",
"self",
".",
"is_ambiguous",
"(",
"dt_wall",
")",
":",
"delta_wall",
"=",
"dt_wall",
"-",
"dt_utc",
"_fold",
"=",
"int",
"(",
"delta_wall",
"==",
"(",
"dt_utc",
".",
"ut... | 782ca4b2edbd4b4018b8cedee42eeae7c921b917 |
valid | _tzinfo._fromutc | Given a timezone-aware datetime in a given timezone, calculates a
timezone-aware datetime in a new timezone.
Since this is the one time that we *know* we have an unambiguous
datetime object, we take this opportunity to determine whether the
datetime is ambiguous and in a "fold" state (e... | superjson/pkg/dateutil/tz/_common.py | def _fromutc(self, dt):
"""
Given a timezone-aware datetime in a given timezone, calculates a
timezone-aware datetime in a new timezone.
Since this is the one time that we *know* we have an unambiguous
datetime object, we take this opportunity to determine whether the
da... | def _fromutc(self, dt):
"""
Given a timezone-aware datetime in a given timezone, calculates a
timezone-aware datetime in a new timezone.
Since this is the one time that we *know* we have an unambiguous
datetime object, we take this opportunity to determine whether the
da... | [
"Given",
"a",
"timezone",
"-",
"aware",
"datetime",
"in",
"a",
"given",
"timezone",
"calculates",
"a",
"timezone",
"-",
"aware",
"datetime",
"in",
"a",
"new",
"timezone",
"."
] | MacHu-GWU/superjson-project | python | https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/pkg/dateutil/tz/_common.py#L173-L208 | [
"def",
"_fromutc",
"(",
"self",
",",
"dt",
")",
":",
"# Re-implement the algorithm from Python's datetime.py",
"dtoff",
"=",
"dt",
".",
"utcoffset",
"(",
")",
"if",
"dtoff",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"fromutc() requires a non-None utcoffset() \"... | 782ca4b2edbd4b4018b8cedee42eeae7c921b917 |
valid | _tzinfo.fromutc | Given a timezone-aware datetime in a given timezone, calculates a
timezone-aware datetime in a new timezone.
Since this is the one time that we *know* we have an unambiguous
datetime object, we take this opportunity to determine whether the
datetime is ambiguous and in a "fold" state (e... | superjson/pkg/dateutil/tz/_common.py | def fromutc(self, dt):
"""
Given a timezone-aware datetime in a given timezone, calculates a
timezone-aware datetime in a new timezone.
Since this is the one time that we *know* we have an unambiguous
datetime object, we take this opportunity to determine whether the
dat... | def fromutc(self, dt):
"""
Given a timezone-aware datetime in a given timezone, calculates a
timezone-aware datetime in a new timezone.
Since this is the one time that we *know* we have an unambiguous
datetime object, we take this opportunity to determine whether the
dat... | [
"Given",
"a",
"timezone",
"-",
"aware",
"datetime",
"in",
"a",
"given",
"timezone",
"calculates",
"a",
"timezone",
"-",
"aware",
"datetime",
"in",
"a",
"new",
"timezone",
"."
] | MacHu-GWU/superjson-project | python | https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/pkg/dateutil/tz/_common.py#L211-L230 | [
"def",
"fromutc",
"(",
"self",
",",
"dt",
")",
":",
"dt_wall",
"=",
"self",
".",
"_fromutc",
"(",
"dt",
")",
"# Calculate the fold status given the two datetimes.",
"_fold",
"=",
"self",
".",
"_fold_status",
"(",
"dt",
",",
"dt_wall",
")",
"# Set the default fol... | 782ca4b2edbd4b4018b8cedee42eeae7c921b917 |
valid | tzrangebase.fromutc | Given a datetime in UTC, return local time | superjson/pkg/dateutil/tz/_common.py | def fromutc(self, dt):
""" Given a datetime in UTC, return local time """
if not isinstance(dt, datetime):
raise TypeError("fromutc() requires a datetime argument")
if dt.tzinfo is not self:
raise ValueError("dt.tzinfo is not self")
# Get transitions - if there ... | def fromutc(self, dt):
""" Given a datetime in UTC, return local time """
if not isinstance(dt, datetime):
raise TypeError("fromutc() requires a datetime argument")
if dt.tzinfo is not self:
raise ValueError("dt.tzinfo is not self")
# Get transitions - if there ... | [
"Given",
"a",
"datetime",
"in",
"UTC",
"return",
"local",
"time"
] | MacHu-GWU/superjson-project | python | https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/pkg/dateutil/tz/_common.py#L286-L317 | [
"def",
"fromutc",
"(",
"self",
",",
"dt",
")",
":",
"if",
"not",
"isinstance",
"(",
"dt",
",",
"datetime",
")",
":",
"raise",
"TypeError",
"(",
"\"fromutc() requires a datetime argument\"",
")",
"if",
"dt",
".",
"tzinfo",
"is",
"not",
"self",
":",
"raise",... | 782ca4b2edbd4b4018b8cedee42eeae7c921b917 |
valid | tzrangebase.is_ambiguous | Whether or not the "wall time" of a given datetime is ambiguous in this
zone.
:param dt:
A :py:class:`datetime.datetime`, naive or time zone aware.
:return:
Returns ``True`` if ambiguous, ``False`` otherwise.
.. versionadded:: 2.6.0 | superjson/pkg/dateutil/tz/_common.py | def is_ambiguous(self, dt):
"""
Whether or not the "wall time" of a given datetime is ambiguous in this
zone.
:param dt:
A :py:class:`datetime.datetime`, naive or time zone aware.
:return:
Returns ``True`` if ambiguous, ``False`` otherwise.
.. ... | def is_ambiguous(self, dt):
"""
Whether or not the "wall time" of a given datetime is ambiguous in this
zone.
:param dt:
A :py:class:`datetime.datetime`, naive or time zone aware.
:return:
Returns ``True`` if ambiguous, ``False`` otherwise.
.. ... | [
"Whether",
"or",
"not",
"the",
"wall",
"time",
"of",
"a",
"given",
"datetime",
"is",
"ambiguous",
"in",
"this",
"zone",
"."
] | MacHu-GWU/superjson-project | python | https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/pkg/dateutil/tz/_common.py#L319-L339 | [
"def",
"is_ambiguous",
"(",
"self",
",",
"dt",
")",
":",
"if",
"not",
"self",
".",
"hasdst",
":",
"return",
"False",
"start",
",",
"end",
"=",
"self",
".",
"transitions",
"(",
"dt",
".",
"year",
")",
"dt",
"=",
"dt",
".",
"replace",
"(",
"tzinfo",
... | 782ca4b2edbd4b4018b8cedee42eeae7c921b917 |
valid | strip_comment_line_with_symbol | Strip comments from line string. | superjson/comments.py | def strip_comment_line_with_symbol(line, start):
"""Strip comments from line string.
"""
parts = line.split(start)
counts = [len(findall(r'(?:^|[^"\\]|(?:\\\\|\\")+)(")', part))
for part in parts]
total = 0
for nr, count in enumerate(counts):
total += count
if total... | def strip_comment_line_with_symbol(line, start):
"""Strip comments from line string.
"""
parts = line.split(start)
counts = [len(findall(r'(?:^|[^"\\]|(?:\\\\|\\")+)(")', part))
for part in parts]
total = 0
for nr, count in enumerate(counts):
total += count
if total... | [
"Strip",
"comments",
"from",
"line",
"string",
"."
] | MacHu-GWU/superjson-project | python | https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/comments.py#L41-L53 | [
"def",
"strip_comment_line_with_symbol",
"(",
"line",
",",
"start",
")",
":",
"parts",
"=",
"line",
".",
"split",
"(",
"start",
")",
"counts",
"=",
"[",
"len",
"(",
"findall",
"(",
"r'(?:^|[^\"\\\\]|(?:\\\\\\\\|\\\\\")+)(\")'",
",",
"part",
")",
")",
"for",
... | 782ca4b2edbd4b4018b8cedee42eeae7c921b917 |
valid | strip_comments | Strip comments from json string.
:param string: A string containing json with comments started by comment_symbols.
:param comment_symbols: Iterable of symbols that start a line comment (default # or //).
:return: The string with the comments removed. | superjson/comments.py | def strip_comments(string, comment_symbols=frozenset(('#', '//'))):
"""Strip comments from json string.
:param string: A string containing json with comments started by comment_symbols.
:param comment_symbols: Iterable of symbols that start a line comment (default # or //).
:return: The string with the... | def strip_comments(string, comment_symbols=frozenset(('#', '//'))):
"""Strip comments from json string.
:param string: A string containing json with comments started by comment_symbols.
:param comment_symbols: Iterable of symbols that start a line comment (default # or //).
:return: The string with the... | [
"Strip",
"comments",
"from",
"json",
"string",
"."
] | MacHu-GWU/superjson-project | python | https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/comments.py#L56-L67 | [
"def",
"strip_comments",
"(",
"string",
",",
"comment_symbols",
"=",
"frozenset",
"(",
"(",
"'#'",
",",
"'//'",
")",
")",
")",
":",
"lines",
"=",
"string",
".",
"splitlines",
"(",
")",
"for",
"k",
"in",
"range",
"(",
"len",
"(",
"lines",
")",
")",
... | 782ca4b2edbd4b4018b8cedee42eeae7c921b917 |
valid | rebuild | Rebuild the internal timezone info in dateutil/zoneinfo/zoneinfo*tar*
filename is the timezone tarball from ftp.iana.org/tz. | superjson/pkg/dateutil/zoneinfo/rebuild.py | def rebuild(filename, tag=None, format="gz", zonegroups=[], metadata=None):
"""Rebuild the internal timezone info in dateutil/zoneinfo/zoneinfo*tar*
filename is the timezone tarball from ftp.iana.org/tz.
"""
tmpdir = tempfile.mkdtemp()
zonedir = os.path.join(tmpdir, "zoneinfo")
moduledir = os.... | def rebuild(filename, tag=None, format="gz", zonegroups=[], metadata=None):
"""Rebuild the internal timezone info in dateutil/zoneinfo/zoneinfo*tar*
filename is the timezone tarball from ftp.iana.org/tz.
"""
tmpdir = tempfile.mkdtemp()
zonedir = os.path.join(tmpdir, "zoneinfo")
moduledir = os.... | [
"Rebuild",
"the",
"internal",
"timezone",
"info",
"in",
"dateutil",
"/",
"zoneinfo",
"/",
"zoneinfo",
"*",
"tar",
"*"
] | MacHu-GWU/superjson-project | python | https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/pkg/dateutil/zoneinfo/rebuild.py#L14-L42 | [
"def",
"rebuild",
"(",
"filename",
",",
"tag",
"=",
"None",
",",
"format",
"=",
"\"gz\"",
",",
"zonegroups",
"=",
"[",
"]",
",",
"metadata",
"=",
"None",
")",
":",
"tmpdir",
"=",
"tempfile",
".",
"mkdtemp",
"(",
")",
"zonedir",
"=",
"os",
".",
"pat... | 782ca4b2edbd4b4018b8cedee42eeae7c921b917 |
valid | picknthweekday | dayofweek == 0 means Sunday, whichweek 5 means last instance | superjson/pkg/dateutil/tz/win.py | def picknthweekday(year, month, dayofweek, hour, minute, whichweek):
""" dayofweek == 0 means Sunday, whichweek 5 means last instance """
first = datetime.datetime(year, month, 1, hour, minute)
# This will work if dayofweek is ISO weekday (1-7) or Microsoft-style (0-6),
# Because 7 % 7 = 0
weekdayo... | def picknthweekday(year, month, dayofweek, hour, minute, whichweek):
""" dayofweek == 0 means Sunday, whichweek 5 means last instance """
first = datetime.datetime(year, month, 1, hour, minute)
# This will work if dayofweek is ISO weekday (1-7) or Microsoft-style (0-6),
# Because 7 % 7 = 0
weekdayo... | [
"dayofweek",
"==",
"0",
"means",
"Sunday",
"whichweek",
"5",
"means",
"last",
"instance"
] | MacHu-GWU/superjson-project | python | https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/pkg/dateutil/tz/win.py#L297-L308 | [
"def",
"picknthweekday",
"(",
"year",
",",
"month",
",",
"dayofweek",
",",
"hour",
",",
"minute",
",",
"whichweek",
")",
":",
"first",
"=",
"datetime",
".",
"datetime",
"(",
"year",
",",
"month",
",",
"1",
",",
"hour",
",",
"minute",
")",
"# This will ... | 782ca4b2edbd4b4018b8cedee42eeae7c921b917 |
valid | valuestodict | Convert a registry key's values to a dictionary. | superjson/pkg/dateutil/tz/win.py | def valuestodict(key):
"""Convert a registry key's values to a dictionary."""
dout = {}
size = winreg.QueryInfoKey(key)[1]
tz_res = None
for i in range(size):
key_name, value, dtype = winreg.EnumValue(key, i)
if dtype == winreg.REG_DWORD or dtype == winreg.REG_DWORD_LITTLE_ENDIAN:
... | def valuestodict(key):
"""Convert a registry key's values to a dictionary."""
dout = {}
size = winreg.QueryInfoKey(key)[1]
tz_res = None
for i in range(size):
key_name, value, dtype = winreg.EnumValue(key, i)
if dtype == winreg.REG_DWORD or dtype == winreg.REG_DWORD_LITTLE_ENDIAN:
... | [
"Convert",
"a",
"registry",
"key",
"s",
"values",
"to",
"a",
"dictionary",
"."
] | MacHu-GWU/superjson-project | python | https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/pkg/dateutil/tz/win.py#L311-L334 | [
"def",
"valuestodict",
"(",
"key",
")",
":",
"dout",
"=",
"{",
"}",
"size",
"=",
"winreg",
".",
"QueryInfoKey",
"(",
"key",
")",
"[",
"1",
"]",
"tz_res",
"=",
"None",
"for",
"i",
"in",
"range",
"(",
"size",
")",
":",
"key_name",
",",
"value",
","... | 782ca4b2edbd4b4018b8cedee42eeae7c921b917 |
valid | tzres.load_name | Load a timezone name from a DLL offset (integer).
>>> from dateutil.tzwin import tzres
>>> tzr = tzres()
>>> print(tzr.load_name(112))
'Eastern Standard Time'
:param offset:
A positive integer value referring to a string from the tzres dll.
..note:
... | superjson/pkg/dateutil/tz/win.py | def load_name(self, offset):
"""
Load a timezone name from a DLL offset (integer).
>>> from dateutil.tzwin import tzres
>>> tzr = tzres()
>>> print(tzr.load_name(112))
'Eastern Standard Time'
:param offset:
A positive integer value referring to a str... | def load_name(self, offset):
"""
Load a timezone name from a DLL offset (integer).
>>> from dateutil.tzwin import tzres
>>> tzr = tzres()
>>> print(tzr.load_name(112))
'Eastern Standard Time'
:param offset:
A positive integer value referring to a str... | [
"Load",
"a",
"timezone",
"name",
"from",
"a",
"DLL",
"offset",
"(",
"integer",
")",
"."
] | MacHu-GWU/superjson-project | python | https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/pkg/dateutil/tz/win.py#L63-L83 | [
"def",
"load_name",
"(",
"self",
",",
"offset",
")",
":",
"resource",
"=",
"self",
".",
"p_wchar",
"(",
")",
"lpBuffer",
"=",
"ctypes",
".",
"cast",
"(",
"ctypes",
".",
"byref",
"(",
"resource",
")",
",",
"wintypes",
".",
"LPWSTR",
")",
"nchar",
"=",... | 782ca4b2edbd4b4018b8cedee42eeae7c921b917 |
valid | tzres.name_from_string | Parse strings as returned from the Windows registry into the time zone
name as defined in the registry.
>>> from dateutil.tzwin import tzres
>>> tzr = tzres()
>>> print(tzr.name_from_string('@tzres.dll,-251'))
'Dateline Daylight Time'
>>> print(tzr.name_from_string('East... | superjson/pkg/dateutil/tz/win.py | def name_from_string(self, tzname_str):
"""
Parse strings as returned from the Windows registry into the time zone
name as defined in the registry.
>>> from dateutil.tzwin import tzres
>>> tzr = tzres()
>>> print(tzr.name_from_string('@tzres.dll,-251'))
'Dateline... | def name_from_string(self, tzname_str):
"""
Parse strings as returned from the Windows registry into the time zone
name as defined in the registry.
>>> from dateutil.tzwin import tzres
>>> tzr = tzres()
>>> print(tzr.name_from_string('@tzres.dll,-251'))
'Dateline... | [
"Parse",
"strings",
"as",
"returned",
"from",
"the",
"Windows",
"registry",
"into",
"the",
"time",
"zone",
"name",
"as",
"defined",
"in",
"the",
"registry",
"."
] | MacHu-GWU/superjson-project | python | https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/pkg/dateutil/tz/win.py#L85-L113 | [
"def",
"name_from_string",
"(",
"self",
",",
"tzname_str",
")",
":",
"if",
"not",
"tzname_str",
".",
"startswith",
"(",
"'@'",
")",
":",
"return",
"tzname_str",
"name_splt",
"=",
"tzname_str",
".",
"split",
"(",
"',-'",
")",
"try",
":",
"offset",
"=",
"i... | 782ca4b2edbd4b4018b8cedee42eeae7c921b917 |
valid | tzwinbase.transitions | For a given year, get the DST on and off transition times, expressed
always on the standard time side. For zones with no transitions, this
function returns ``None``.
:param year:
The year whose transitions you would like to query.
:return:
Returns a :class:`tupl... | superjson/pkg/dateutil/tz/win.py | def transitions(self, year):
"""
For a given year, get the DST on and off transition times, expressed
always on the standard time side. For zones with no transitions, this
function returns ``None``.
:param year:
The year whose transitions you would like to query.
... | def transitions(self, year):
"""
For a given year, get the DST on and off transition times, expressed
always on the standard time side. For zones with no transitions, this
function returns ``None``.
:param year:
The year whose transitions you would like to query.
... | [
"For",
"a",
"given",
"year",
"get",
"the",
"DST",
"on",
"and",
"off",
"transition",
"times",
"expressed",
"always",
"on",
"the",
"standard",
"time",
"side",
".",
"For",
"zones",
"with",
"no",
"transitions",
"this",
"function",
"returns",
"None",
"."
] | MacHu-GWU/superjson-project | python | https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/pkg/dateutil/tz/win.py#L152-L181 | [
"def",
"transitions",
"(",
"self",
",",
"year",
")",
":",
"if",
"not",
"self",
".",
"hasdst",
":",
"return",
"None",
"dston",
"=",
"picknthweekday",
"(",
"year",
",",
"self",
".",
"_dstmonth",
",",
"self",
".",
"_dstdayofweek",
",",
"self",
".",
"_dsth... | 782ca4b2edbd4b4018b8cedee42eeae7c921b917 |
valid | get_zonefile_instance | This is a convenience function which provides a :class:`ZoneInfoFile`
instance using the data provided by the ``dateutil`` package. By default, it
caches a single instance of the ZoneInfoFile object and returns that.
:param new_instance:
If ``True``, a new instance of :class:`ZoneInfoFile` is insta... | superjson/pkg/dateutil/zoneinfo/__init__.py | def get_zonefile_instance(new_instance=False):
"""
This is a convenience function which provides a :class:`ZoneInfoFile`
instance using the data provided by the ``dateutil`` package. By default, it
caches a single instance of the ZoneInfoFile object and returns that.
:param new_instance:
If... | def get_zonefile_instance(new_instance=False):
"""
This is a convenience function which provides a :class:`ZoneInfoFile`
instance using the data provided by the ``dateutil`` package. By default, it
caches a single instance of the ZoneInfoFile object and returns that.
:param new_instance:
If... | [
"This",
"is",
"a",
"convenience",
"function",
"which",
"provides",
"a",
":",
"class",
":",
"ZoneInfoFile",
"instance",
"using",
"the",
"data",
"provided",
"by",
"the",
"dateutil",
"package",
".",
"By",
"default",
"it",
"caches",
"a",
"single",
"instance",
"o... | MacHu-GWU/superjson-project | python | https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/pkg/dateutil/zoneinfo/__init__.py#L99-L125 | [
"def",
"get_zonefile_instance",
"(",
"new_instance",
"=",
"False",
")",
":",
"if",
"new_instance",
":",
"zif",
"=",
"None",
"else",
":",
"zif",
"=",
"getattr",
"(",
"get_zonefile_instance",
",",
"'_cached_instance'",
",",
"None",
")",
"if",
"zif",
"is",
"Non... | 782ca4b2edbd4b4018b8cedee42eeae7c921b917 |
valid | gettz | This retrieves a time zone from the local zoneinfo tarball that is packaged
with dateutil.
:param name:
An IANA-style time zone name, as found in the zoneinfo file.
:return:
Returns a :class:`dateutil.tz.tzfile` time zone object.
.. warning::
It is generally inadvisable to use... | superjson/pkg/dateutil/zoneinfo/__init__.py | def gettz(name):
"""
This retrieves a time zone from the local zoneinfo tarball that is packaged
with dateutil.
:param name:
An IANA-style time zone name, as found in the zoneinfo file.
:return:
Returns a :class:`dateutil.tz.tzfile` time zone object.
.. warning::
It is... | def gettz(name):
"""
This retrieves a time zone from the local zoneinfo tarball that is packaged
with dateutil.
:param name:
An IANA-style time zone name, as found in the zoneinfo file.
:return:
Returns a :class:`dateutil.tz.tzfile` time zone object.
.. warning::
It is... | [
"This",
"retrieves",
"a",
"time",
"zone",
"from",
"the",
"local",
"zoneinfo",
"tarball",
"that",
"is",
"packaged",
"with",
"dateutil",
"."
] | MacHu-GWU/superjson-project | python | https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/pkg/dateutil/zoneinfo/__init__.py#L128-L163 | [
"def",
"gettz",
"(",
"name",
")",
":",
"warnings",
".",
"warn",
"(",
"\"zoneinfo.gettz() will be removed in future versions, \"",
"\"to use the dateutil-provided zoneinfo files, instantiate a \"",
"\"ZoneInfoFile object and use ZoneInfoFile.zones.get() \"",
"\"instead. See the documentatio... | 782ca4b2edbd4b4018b8cedee42eeae7c921b917 |
valid | gettz_db_metadata | Get the zonefile metadata
See `zonefile_metadata`_
:returns:
A dictionary with the database metadata
.. deprecated:: 2.6
See deprecation warning in :func:`zoneinfo.gettz`. To get metadata,
query the attribute ``zoneinfo.ZoneInfoFile.metadata``. | superjson/pkg/dateutil/zoneinfo/__init__.py | def gettz_db_metadata():
""" Get the zonefile metadata
See `zonefile_metadata`_
:returns:
A dictionary with the database metadata
.. deprecated:: 2.6
See deprecation warning in :func:`zoneinfo.gettz`. To get metadata,
query the attribute ``zoneinfo.ZoneInfoFile.metadata``.
... | def gettz_db_metadata():
""" Get the zonefile metadata
See `zonefile_metadata`_
:returns:
A dictionary with the database metadata
.. deprecated:: 2.6
See deprecation warning in :func:`zoneinfo.gettz`. To get metadata,
query the attribute ``zoneinfo.ZoneInfoFile.metadata``.
... | [
"Get",
"the",
"zonefile",
"metadata"
] | MacHu-GWU/superjson-project | python | https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/pkg/dateutil/zoneinfo/__init__.py#L166-L186 | [
"def",
"gettz_db_metadata",
"(",
")",
":",
"warnings",
".",
"warn",
"(",
"\"zoneinfo.gettz_db_metadata() will be removed in future \"",
"\"versions, to use the dateutil-provided zoneinfo files, \"",
"\"ZoneInfoFile object and query the 'metadata' attribute \"",
"\"instead. See the documentat... | 782ca4b2edbd4b4018b8cedee42eeae7c921b917 |
valid | get_config | Get the configuration for the given JID based on XMPP_HTTP_UPLOAD_ACCESS.
If the JID does not match any rule, ``False`` is returned. | xmpp_http_upload/utils.py | def get_config(jid):
"""Get the configuration for the given JID based on XMPP_HTTP_UPLOAD_ACCESS.
If the JID does not match any rule, ``False`` is returned.
"""
acls = getattr(settings, 'XMPP_HTTP_UPLOAD_ACCESS', (('.*', False), ))
for regex, config in acls:
if isinstance(regex, six.strin... | def get_config(jid):
"""Get the configuration for the given JID based on XMPP_HTTP_UPLOAD_ACCESS.
If the JID does not match any rule, ``False`` is returned.
"""
acls = getattr(settings, 'XMPP_HTTP_UPLOAD_ACCESS', (('.*', False), ))
for regex, config in acls:
if isinstance(regex, six.strin... | [
"Get",
"the",
"configuration",
"for",
"the",
"given",
"JID",
"based",
"on",
"XMPP_HTTP_UPLOAD_ACCESS",
"."
] | mathiasertl/django-xmpp-http-upload | python | https://github.com/mathiasertl/django-xmpp-http-upload/blob/819cb8794647c4609bb4cb7855e2ad4bd51b9ea1/xmpp_http_upload/utils.py#L25-L41 | [
"def",
"get_config",
"(",
"jid",
")",
":",
"acls",
"=",
"getattr",
"(",
"settings",
",",
"'XMPP_HTTP_UPLOAD_ACCESS'",
",",
"(",
"(",
"'.*'",
",",
"False",
")",
",",
")",
")",
"for",
"regex",
",",
"config",
"in",
"acls",
":",
"if",
"isinstance",
"(",
... | 819cb8794647c4609bb4cb7855e2ad4bd51b9ea1 |
valid | datetime_exists | Given a datetime and a time zone, determine whether or not a given datetime
would fall in a gap.
:param dt:
A :class:`datetime.datetime` (whose time zone will be ignored if ``tz``
is provided.)
:param tz:
A :class:`datetime.tzinfo` with support for the ``fold`` attribute. If
... | superjson/pkg/dateutil/tz/tz.py | def datetime_exists(dt, tz=None):
"""
Given a datetime and a time zone, determine whether or not a given datetime
would fall in a gap.
:param dt:
A :class:`datetime.datetime` (whose time zone will be ignored if ``tz``
is provided.)
:param tz:
A :class:`datetime.tzinfo` with... | def datetime_exists(dt, tz=None):
"""
Given a datetime and a time zone, determine whether or not a given datetime
would fall in a gap.
:param dt:
A :class:`datetime.datetime` (whose time zone will be ignored if ``tz``
is provided.)
:param tz:
A :class:`datetime.tzinfo` with... | [
"Given",
"a",
"datetime",
"and",
"a",
"time",
"zone",
"determine",
"whether",
"or",
"not",
"a",
"given",
"datetime",
"would",
"fall",
"in",
"a",
"gap",
"."
] | MacHu-GWU/superjson-project | python | https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/pkg/dateutil/tz/tz.py#L1419-L1447 | [
"def",
"datetime_exists",
"(",
"dt",
",",
"tz",
"=",
"None",
")",
":",
"if",
"tz",
"is",
"None",
":",
"if",
"dt",
".",
"tzinfo",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"'Datetime is naive and no time zone provided.'",
")",
"tz",
"=",
"dt",
".",
"... | 782ca4b2edbd4b4018b8cedee42eeae7c921b917 |
valid | datetime_ambiguous | Given a datetime and a time zone, determine whether or not a given datetime
is ambiguous (i.e if there are two times differentiated only by their DST
status).
:param dt:
A :class:`datetime.datetime` (whose time zone will be ignored if ``tz``
is provided.)
:param tz:
A :class:`d... | superjson/pkg/dateutil/tz/tz.py | def datetime_ambiguous(dt, tz=None):
"""
Given a datetime and a time zone, determine whether or not a given datetime
is ambiguous (i.e if there are two times differentiated only by their DST
status).
:param dt:
A :class:`datetime.datetime` (whose time zone will be ignored if ``tz``
... | def datetime_ambiguous(dt, tz=None):
"""
Given a datetime and a time zone, determine whether or not a given datetime
is ambiguous (i.e if there are two times differentiated only by their DST
status).
:param dt:
A :class:`datetime.datetime` (whose time zone will be ignored if ``tz``
... | [
"Given",
"a",
"datetime",
"and",
"a",
"time",
"zone",
"determine",
"whether",
"or",
"not",
"a",
"given",
"datetime",
"is",
"ambiguous",
"(",
"i",
".",
"e",
"if",
"there",
"are",
"two",
"times",
"differentiated",
"only",
"by",
"their",
"DST",
"status",
")... | MacHu-GWU/superjson-project | python | https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/pkg/dateutil/tz/tz.py#L1450-L1493 | [
"def",
"datetime_ambiguous",
"(",
"dt",
",",
"tz",
"=",
"None",
")",
":",
"if",
"tz",
"is",
"None",
":",
"if",
"dt",
".",
"tzinfo",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"'Datetime is naive and no time zone provided.'",
")",
"tz",
"=",
"dt",
".",
... | 782ca4b2edbd4b4018b8cedee42eeae7c921b917 |
valid | tzlocal.is_ambiguous | Whether or not the "wall time" of a given datetime is ambiguous in this
zone.
:param dt:
A :py:class:`datetime.datetime`, naive or time zone aware.
:return:
Returns ``True`` if ambiguous, ``False`` otherwise.
.. versionadded:: 2.6.0 | superjson/pkg/dateutil/tz/tz.py | def is_ambiguous(self, dt):
"""
Whether or not the "wall time" of a given datetime is ambiguous in this
zone.
:param dt:
A :py:class:`datetime.datetime`, naive or time zone aware.
:return:
Returns ``True`` if ambiguous, ``False`` otherwise.
.. ... | def is_ambiguous(self, dt):
"""
Whether or not the "wall time" of a given datetime is ambiguous in this
zone.
:param dt:
A :py:class:`datetime.datetime`, naive or time zone aware.
:return:
Returns ``True`` if ambiguous, ``False`` otherwise.
.. ... | [
"Whether",
"or",
"not",
"the",
"wall",
"time",
"of",
"a",
"given",
"datetime",
"is",
"ambiguous",
"in",
"this",
"zone",
"."
] | MacHu-GWU/superjson-project | python | https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/pkg/dateutil/tz/tz.py#L199-L215 | [
"def",
"is_ambiguous",
"(",
"self",
",",
"dt",
")",
":",
"naive_dst",
"=",
"self",
".",
"_naive_is_dst",
"(",
"dt",
")",
"return",
"(",
"not",
"naive_dst",
"and",
"(",
"naive_dst",
"!=",
"self",
".",
"_naive_is_dst",
"(",
"dt",
"-",
"self",
".",
"_dst_... | 782ca4b2edbd4b4018b8cedee42eeae7c921b917 |
valid | tzfile._set_tzdata | Set the time zone data of this object from a _tzfile object | superjson/pkg/dateutil/tz/tz.py | def _set_tzdata(self, tzobj):
""" Set the time zone data of this object from a _tzfile object """
# Copy the relevant attributes over as private attributes
for attr in _tzfile.attrs:
setattr(self, '_' + attr, getattr(tzobj, attr)) | def _set_tzdata(self, tzobj):
""" Set the time zone data of this object from a _tzfile object """
# Copy the relevant attributes over as private attributes
for attr in _tzfile.attrs:
setattr(self, '_' + attr, getattr(tzobj, attr)) | [
"Set",
"the",
"time",
"zone",
"data",
"of",
"this",
"object",
"from",
"a",
"_tzfile",
"object"
] | MacHu-GWU/superjson-project | python | https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/pkg/dateutil/tz/tz.py#L383-L387 | [
"def",
"_set_tzdata",
"(",
"self",
",",
"tzobj",
")",
":",
"# Copy the relevant attributes over as private attributes",
"for",
"attr",
"in",
"_tzfile",
".",
"attrs",
":",
"setattr",
"(",
"self",
",",
"'_'",
"+",
"attr",
",",
"getattr",
"(",
"tzobj",
",",
"attr... | 782ca4b2edbd4b4018b8cedee42eeae7c921b917 |
valid | tzfile.fromutc | The ``tzfile`` implementation of :py:func:`datetime.tzinfo.fromutc`.
:param dt:
A :py:class:`datetime.datetime` object.
:raises TypeError:
Raised if ``dt`` is not a :py:class:`datetime.datetime` object.
:raises ValueError:
Raised if this is called with a ``... | superjson/pkg/dateutil/tz/tz.py | def fromutc(self, dt):
"""
The ``tzfile`` implementation of :py:func:`datetime.tzinfo.fromutc`.
:param dt:
A :py:class:`datetime.datetime` object.
:raises TypeError:
Raised if ``dt`` is not a :py:class:`datetime.datetime` object.
:raises ValueError:
... | def fromutc(self, dt):
"""
The ``tzfile`` implementation of :py:func:`datetime.tzinfo.fromutc`.
:param dt:
A :py:class:`datetime.datetime` object.
:raises TypeError:
Raised if ``dt`` is not a :py:class:`datetime.datetime` object.
:raises ValueError:
... | [
"The",
"tzfile",
"implementation",
"of",
":",
"py",
":",
"func",
":",
"datetime",
".",
"tzinfo",
".",
"fromutc",
"."
] | MacHu-GWU/superjson-project | python | https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/pkg/dateutil/tz/tz.py#L640-L674 | [
"def",
"fromutc",
"(",
"self",
",",
"dt",
")",
":",
"# These isinstance checks are in datetime.tzinfo, so we'll preserve",
"# them, even if we don't care about duck typing.",
"if",
"not",
"isinstance",
"(",
"dt",
",",
"datetime",
".",
"datetime",
")",
":",
"raise",
"TypeE... | 782ca4b2edbd4b4018b8cedee42eeae7c921b917 |
valid | tzfile.is_ambiguous | Whether or not the "wall time" of a given datetime is ambiguous in this
zone.
:param dt:
A :py:class:`datetime.datetime`, naive or time zone aware.
:return:
Returns ``True`` if ambiguous, ``False`` otherwise.
.. versionadded:: 2.6.0 | superjson/pkg/dateutil/tz/tz.py | def is_ambiguous(self, dt, idx=None):
"""
Whether or not the "wall time" of a given datetime is ambiguous in this
zone.
:param dt:
A :py:class:`datetime.datetime`, naive or time zone aware.
:return:
Returns ``True`` if ambiguous, ``False`` otherwise.
... | def is_ambiguous(self, dt, idx=None):
"""
Whether or not the "wall time" of a given datetime is ambiguous in this
zone.
:param dt:
A :py:class:`datetime.datetime`, naive or time zone aware.
:return:
Returns ``True`` if ambiguous, ``False`` otherwise.
... | [
"Whether",
"or",
"not",
"the",
"wall",
"time",
"of",
"a",
"given",
"datetime",
"is",
"ambiguous",
"in",
"this",
"zone",
"."
] | MacHu-GWU/superjson-project | python | https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/pkg/dateutil/tz/tz.py#L676-L703 | [
"def",
"is_ambiguous",
"(",
"self",
",",
"dt",
",",
"idx",
"=",
"None",
")",
":",
"if",
"idx",
"is",
"None",
":",
"idx",
"=",
"self",
".",
"_find_last_transition",
"(",
"dt",
")",
"# Calculate the difference in offsets from current to previous",
"timestamp",
"="... | 782ca4b2edbd4b4018b8cedee42eeae7c921b917 |
valid | tzrange.transitions | For a given year, get the DST on and off transition times, expressed
always on the standard time side. For zones with no transitions, this
function returns ``None``.
:param year:
The year whose transitions you would like to query.
:return:
Returns a :class:`tupl... | superjson/pkg/dateutil/tz/tz.py | def transitions(self, year):
"""
For a given year, get the DST on and off transition times, expressed
always on the standard time side. For zones with no transitions, this
function returns ``None``.
:param year:
The year whose transitions you would like to query.
... | def transitions(self, year):
"""
For a given year, get the DST on and off transition times, expressed
always on the standard time side. For zones with no transitions, this
function returns ``None``.
:param year:
The year whose transitions you would like to query.
... | [
"For",
"a",
"given",
"year",
"get",
"the",
"DST",
"on",
"and",
"off",
"transition",
"times",
"expressed",
"always",
"on",
"the",
"standard",
"time",
"side",
".",
"For",
"zones",
"with",
"no",
"transitions",
"this",
"function",
"returns",
"None",
"."
] | MacHu-GWU/superjson-project | python | https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/pkg/dateutil/tz/tz.py#L893-L915 | [
"def",
"transitions",
"(",
"self",
",",
"year",
")",
":",
"if",
"not",
"self",
".",
"hasdst",
":",
"return",
"None",
"base_year",
"=",
"datetime",
".",
"datetime",
"(",
"year",
",",
"1",
",",
"1",
")",
"start",
"=",
"base_year",
"+",
"self",
".",
"... | 782ca4b2edbd4b4018b8cedee42eeae7c921b917 |
valid | tzical.get | Retrieve a :py:class:`datetime.tzinfo` object by its ``tzid``.
:param tzid:
If there is exactly one time zone available, omitting ``tzid``
or passing :py:const:`None` value returns it. Otherwise a valid
key (which can be retrieved from :func:`keys`) is required.
:ra... | superjson/pkg/dateutil/tz/tz.py | def get(self, tzid=None):
"""
Retrieve a :py:class:`datetime.tzinfo` object by its ``tzid``.
:param tzid:
If there is exactly one time zone available, omitting ``tzid``
or passing :py:const:`None` value returns it. Otherwise a valid
key (which can be retrieve... | def get(self, tzid=None):
"""
Retrieve a :py:class:`datetime.tzinfo` object by its ``tzid``.
:param tzid:
If there is exactly one time zone available, omitting ``tzid``
or passing :py:const:`None` value returns it. Otherwise a valid
key (which can be retrieve... | [
"Retrieve",
"a",
":",
"py",
":",
"class",
":",
"datetime",
".",
"tzinfo",
"object",
"by",
"its",
"tzid",
"."
] | MacHu-GWU/superjson-project | python | https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/pkg/dateutil/tz/tz.py#L1168-L1193 | [
"def",
"get",
"(",
"self",
",",
"tzid",
"=",
"None",
")",
":",
"if",
"tzid",
"is",
"None",
":",
"if",
"len",
"(",
"self",
".",
"_vtz",
")",
"==",
"0",
":",
"raise",
"ValueError",
"(",
"\"no timezones defined\"",
")",
"elif",
"len",
"(",
"self",
"."... | 782ca4b2edbd4b4018b8cedee42eeae7c921b917 |
valid | relativedelta.normalized | Return a version of this object represented entirely using integer
values for the relative attributes.
>>> relativedelta(days=1.5, hours=2).normalized()
relativedelta(days=1, hours=14)
:return:
Returns a :class:`dateutil.relativedelta.relativedelta` object. | superjson/pkg/dateutil/relativedelta.py | def normalized(self):
"""
Return a version of this object represented entirely using integer
values for the relative attributes.
>>> relativedelta(days=1.5, hours=2).normalized()
relativedelta(days=1, hours=14)
:return:
Returns a :class:`dateutil.relativedel... | def normalized(self):
"""
Return a version of this object represented entirely using integer
values for the relative attributes.
>>> relativedelta(days=1.5, hours=2).normalized()
relativedelta(days=1, hours=14)
:return:
Returns a :class:`dateutil.relativedel... | [
"Return",
"a",
"version",
"of",
"this",
"object",
"represented",
"entirely",
"using",
"integer",
"values",
"for",
"the",
"relative",
"attributes",
"."
] | MacHu-GWU/superjson-project | python | https://github.com/MacHu-GWU/superjson-project/blob/782ca4b2edbd4b4018b8cedee42eeae7c921b917/superjson/pkg/dateutil/relativedelta.py#L268-L302 | [
"def",
"normalized",
"(",
"self",
")",
":",
"# Cascade remainders down (rounding each to roughly nearest",
"# microsecond)",
"days",
"=",
"int",
"(",
"self",
".",
"days",
")",
"hours_f",
"=",
"round",
"(",
"self",
".",
"hours",
"+",
"24",
"*",
"(",
"self",
"."... | 782ca4b2edbd4b4018b8cedee42eeae7c921b917 |
valid | get_algorithm | :param alg: The name of the requested `JSON Web Algorithm <https://tools.ietf.org/html/rfc7519#ref-JWA>`_. `RFC7518 <https://tools.ietf.org/html/rfc7518#section-3.2>`_ is related.
:type alg: str
:return: The requested algorithm.
:rtype: Callable
:raises: ValueError | simplejwt/jwt.py | def get_algorithm(alg: str) -> Callable:
"""
:param alg: The name of the requested `JSON Web Algorithm <https://tools.ietf.org/html/rfc7519#ref-JWA>`_. `RFC7518 <https://tools.ietf.org/html/rfc7518#section-3.2>`_ is related.
:type alg: str
:return: The requested algorithm.
:rtype: Callable
:rais... | def get_algorithm(alg: str) -> Callable:
"""
:param alg: The name of the requested `JSON Web Algorithm <https://tools.ietf.org/html/rfc7519#ref-JWA>`_. `RFC7518 <https://tools.ietf.org/html/rfc7518#section-3.2>`_ is related.
:type alg: str
:return: The requested algorithm.
:rtype: Callable
:rais... | [
":",
"param",
"alg",
":",
"The",
"name",
"of",
"the",
"requested",
"JSON",
"Web",
"Algorithm",
"<https",
":",
"//",
"tools",
".",
"ietf",
".",
"org",
"/",
"html",
"/",
"rfc7519#ref",
"-",
"JWA",
">",
"_",
".",
"RFC7518",
"<https",
":",
"//",
"tools",... | jmwri/simplejwt | python | https://github.com/jmwri/simplejwt/blob/0828eaace0846918d2d202f5a60167a003e88b71/simplejwt/jwt.py#L30-L40 | [
"def",
"get_algorithm",
"(",
"alg",
":",
"str",
")",
"->",
"Callable",
":",
"if",
"alg",
"not",
"in",
"algorithms",
":",
"raise",
"ValueError",
"(",
"'Invalid algorithm: {:s}'",
".",
"format",
"(",
"alg",
")",
")",
"return",
"algorithms",
"[",
"alg",
"]"
] | 0828eaace0846918d2d202f5a60167a003e88b71 |
valid | _hash | Create a new HMAC hash.
:param secret: The secret used when hashing data.
:type secret: bytes
:param data: The data to hash.
:type data: bytes
:param alg: The algorithm to use when hashing `data`.
:type alg: str
:return: New HMAC hash.
:rtype: bytes | simplejwt/jwt.py | def _hash(secret: bytes, data: bytes, alg: str) -> bytes:
"""
Create a new HMAC hash.
:param secret: The secret used when hashing data.
:type secret: bytes
:param data: The data to hash.
:type data: bytes
:param alg: The algorithm to use when hashing `data`.
:type alg: str
:return: ... | def _hash(secret: bytes, data: bytes, alg: str) -> bytes:
"""
Create a new HMAC hash.
:param secret: The secret used when hashing data.
:type secret: bytes
:param data: The data to hash.
:type data: bytes
:param alg: The algorithm to use when hashing `data`.
:type alg: str
:return: ... | [
"Create",
"a",
"new",
"HMAC",
"hash",
"."
] | jmwri/simplejwt | python | https://github.com/jmwri/simplejwt/blob/0828eaace0846918d2d202f5a60167a003e88b71/simplejwt/jwt.py#L43-L59 | [
"def",
"_hash",
"(",
"secret",
":",
"bytes",
",",
"data",
":",
"bytes",
",",
"alg",
":",
"str",
")",
"->",
"bytes",
":",
"algorithm",
"=",
"get_algorithm",
"(",
"alg",
")",
"return",
"hmac",
".",
"new",
"(",
"secret",
",",
"msg",
"=",
"data",
",",
... | 0828eaace0846918d2d202f5a60167a003e88b71 |
valid | encode | :param secret: The secret used to encode the token.
:type secret: Union[str, bytes]
:param payload: The payload to be encoded in the token.
:type payload: dict
:param alg: The algorithm used to hash the token.
:type alg: str
:param header: The header to be encoded in the token.
:type header:... | simplejwt/jwt.py | def encode(secret: Union[str, bytes], payload: dict = None,
alg: str = default_alg, header: dict = None) -> str:
"""
:param secret: The secret used to encode the token.
:type secret: Union[str, bytes]
:param payload: The payload to be encoded in the token.
:type payload: dict
:param a... | def encode(secret: Union[str, bytes], payload: dict = None,
alg: str = default_alg, header: dict = None) -> str:
"""
:param secret: The secret used to encode the token.
:type secret: Union[str, bytes]
:param payload: The payload to be encoded in the token.
:type payload: dict
:param a... | [
":",
"param",
"secret",
":",
"The",
"secret",
"used",
"to",
"encode",
"the",
"token",
".",
":",
"type",
"secret",
":",
"Union",
"[",
"str",
"bytes",
"]",
":",
"param",
"payload",
":",
"The",
"payload",
"to",
"be",
"encoded",
"in",
"the",
"token",
"."... | jmwri/simplejwt | python | https://github.com/jmwri/simplejwt/blob/0828eaace0846918d2d202f5a60167a003e88b71/simplejwt/jwt.py#L365-L394 | [
"def",
"encode",
"(",
"secret",
":",
"Union",
"[",
"str",
",",
"bytes",
"]",
",",
"payload",
":",
"dict",
"=",
"None",
",",
"alg",
":",
"str",
"=",
"default_alg",
",",
"header",
":",
"dict",
"=",
"None",
")",
"->",
"str",
":",
"secret",
"=",
"uti... | 0828eaace0846918d2d202f5a60167a003e88b71 |
valid | decode | Decodes the given token's header and payload and validates the signature.
:param secret: The secret used to decode the token. Must match the
secret used when creating the token.
:type secret: Union[str, bytes]
:param token: The token to decode.
:type token: Union[str, bytes]
:param alg: The... | simplejwt/jwt.py | def decode(secret: Union[str, bytes], token: Union[str, bytes],
alg: str = default_alg) -> Tuple[dict, dict]:
"""
Decodes the given token's header and payload and validates the signature.
:param secret: The secret used to decode the token. Must match the
secret used when creating the tok... | def decode(secret: Union[str, bytes], token: Union[str, bytes],
alg: str = default_alg) -> Tuple[dict, dict]:
"""
Decodes the given token's header and payload and validates the signature.
:param secret: The secret used to decode the token. Must match the
secret used when creating the tok... | [
"Decodes",
"the",
"given",
"token",
"s",
"header",
"and",
"payload",
"and",
"validates",
"the",
"signature",
"."
] | jmwri/simplejwt | python | https://github.com/jmwri/simplejwt/blob/0828eaace0846918d2d202f5a60167a003e88b71/simplejwt/jwt.py#L397-L438 | [
"def",
"decode",
"(",
"secret",
":",
"Union",
"[",
"str",
",",
"bytes",
"]",
",",
"token",
":",
"Union",
"[",
"str",
",",
"bytes",
"]",
",",
"alg",
":",
"str",
"=",
"default_alg",
")",
"->",
"Tuple",
"[",
"dict",
",",
"dict",
"]",
":",
"secret",
... | 0828eaace0846918d2d202f5a60167a003e88b71 |
valid | compare_signature | Compares the given signatures.
:param expected: The expected signature.
:type expected: Union[str, bytes]
:param actual: The actual signature.
:type actual: Union[str, bytes]
:return: Do the signatures match?
:rtype: bool | simplejwt/jwt.py | def compare_signature(expected: Union[str, bytes],
actual: Union[str, bytes]) -> bool:
"""
Compares the given signatures.
:param expected: The expected signature.
:type expected: Union[str, bytes]
:param actual: The actual signature.
:type actual: Union[str, bytes]
:re... | def compare_signature(expected: Union[str, bytes],
actual: Union[str, bytes]) -> bool:
"""
Compares the given signatures.
:param expected: The expected signature.
:type expected: Union[str, bytes]
:param actual: The actual signature.
:type actual: Union[str, bytes]
:re... | [
"Compares",
"the",
"given",
"signatures",
"."
] | jmwri/simplejwt | python | https://github.com/jmwri/simplejwt/blob/0828eaace0846918d2d202f5a60167a003e88b71/simplejwt/jwt.py#L441-L455 | [
"def",
"compare_signature",
"(",
"expected",
":",
"Union",
"[",
"str",
",",
"bytes",
"]",
",",
"actual",
":",
"Union",
"[",
"str",
",",
"bytes",
"]",
")",
"->",
"bool",
":",
"expected",
"=",
"util",
".",
"to_bytes",
"(",
"expected",
")",
"actual",
"=... | 0828eaace0846918d2d202f5a60167a003e88b71 |
valid | compare_token | Compares the given tokens.
:param expected: The expected token.
:type expected: Union[str, bytes]
:param actual: The actual token.
:type actual: Union[str, bytes]
:return: Do the tokens match?
:rtype: bool | simplejwt/jwt.py | def compare_token(expected: Union[str, bytes],
actual: Union[str, bytes]) -> bool:
"""
Compares the given tokens.
:param expected: The expected token.
:type expected: Union[str, bytes]
:param actual: The actual token.
:type actual: Union[str, bytes]
:return: Do the tokens ... | def compare_token(expected: Union[str, bytes],
actual: Union[str, bytes]) -> bool:
"""
Compares the given tokens.
:param expected: The expected token.
:type expected: Union[str, bytes]
:param actual: The actual token.
:type actual: Union[str, bytes]
:return: Do the tokens ... | [
"Compares",
"the",
"given",
"tokens",
"."
] | jmwri/simplejwt | python | https://github.com/jmwri/simplejwt/blob/0828eaace0846918d2d202f5a60167a003e88b71/simplejwt/jwt.py#L458-L476 | [
"def",
"compare_token",
"(",
"expected",
":",
"Union",
"[",
"str",
",",
"bytes",
"]",
",",
"actual",
":",
"Union",
"[",
"str",
",",
"bytes",
"]",
")",
"->",
"bool",
":",
"expected",
"=",
"util",
".",
"to_bytes",
"(",
"expected",
")",
"actual",
"=",
... | 0828eaace0846918d2d202f5a60167a003e88b71 |
valid | Jwt.header | :return: Token header.
:rtype: dict | simplejwt/jwt.py | def header(self) -> dict:
"""
:return: Token header.
:rtype: dict
"""
header = {}
if isinstance(self._header, dict):
header = self._header.copy()
header.update(self._header)
header.update({
'type': 'JWT',
'alg': self... | def header(self) -> dict:
"""
:return: Token header.
:rtype: dict
"""
header = {}
if isinstance(self._header, dict):
header = self._header.copy()
header.update(self._header)
header.update({
'type': 'JWT',
'alg': self... | [
":",
"return",
":",
"Token",
"header",
".",
":",
"rtype",
":",
"dict"
] | jmwri/simplejwt | python | https://github.com/jmwri/simplejwt/blob/0828eaace0846918d2d202f5a60167a003e88b71/simplejwt/jwt.py#L119-L132 | [
"def",
"header",
"(",
"self",
")",
"->",
"dict",
":",
"header",
"=",
"{",
"}",
"if",
"isinstance",
"(",
"self",
".",
"_header",
",",
"dict",
")",
":",
"header",
"=",
"self",
".",
"_header",
".",
"copy",
"(",
")",
"header",
".",
"update",
"(",
"se... | 0828eaace0846918d2d202f5a60167a003e88b71 |
valid | Jwt.valid | Is the token valid? This method only checks the timestamps within the
token and compares them against the current time if none is provided.
:param time: The timestamp to validate against
:type time: Union[int, None]
:return: The validity of the token.
:rtype: bool | simplejwt/jwt.py | def valid(self, time: int = None) -> bool:
"""
Is the token valid? This method only checks the timestamps within the
token and compares them against the current time if none is provided.
:param time: The timestamp to validate against
:type time: Union[int, None]
:return:... | def valid(self, time: int = None) -> bool:
"""
Is the token valid? This method only checks the timestamps within the
token and compares them against the current time if none is provided.
:param time: The timestamp to validate against
:type time: Union[int, None]
:return:... | [
"Is",
"the",
"token",
"valid?",
"This",
"method",
"only",
"checks",
"the",
"timestamps",
"within",
"the",
"token",
"and",
"compares",
"them",
"against",
"the",
"current",
"time",
"if",
"none",
"is",
"provided",
"."
] | jmwri/simplejwt | python | https://github.com/jmwri/simplejwt/blob/0828eaace0846918d2d202f5a60167a003e88b71/simplejwt/jwt.py#L271-L289 | [
"def",
"valid",
"(",
"self",
",",
"time",
":",
"int",
"=",
"None",
")",
"->",
"bool",
":",
"if",
"time",
"is",
"None",
":",
"epoch",
"=",
"datetime",
"(",
"1970",
",",
"1",
",",
"1",
",",
"0",
",",
"0",
",",
"0",
")",
"now",
"=",
"datetime",
... | 0828eaace0846918d2d202f5a60167a003e88b71 |
valid | Jwt._pop_claims_from_payload | Check for registered claims in the payload and move them to the
registered_claims property, overwriting any extant claims. | simplejwt/jwt.py | def _pop_claims_from_payload(self):
"""
Check for registered claims in the payload and move them to the
registered_claims property, overwriting any extant claims.
"""
claims_in_payload = [k for k in self.payload.keys() if
k in registered_claims.values... | def _pop_claims_from_payload(self):
"""
Check for registered claims in the payload and move them to the
registered_claims property, overwriting any extant claims.
"""
claims_in_payload = [k for k in self.payload.keys() if
k in registered_claims.values... | [
"Check",
"for",
"registered",
"claims",
"in",
"the",
"payload",
"and",
"move",
"them",
"to",
"the",
"registered_claims",
"property",
"overwriting",
"any",
"extant",
"claims",
"."
] | jmwri/simplejwt | python | https://github.com/jmwri/simplejwt/blob/0828eaace0846918d2d202f5a60167a003e88b71/simplejwt/jwt.py#L291-L299 | [
"def",
"_pop_claims_from_payload",
"(",
"self",
")",
":",
"claims_in_payload",
"=",
"[",
"k",
"for",
"k",
"in",
"self",
".",
"payload",
".",
"keys",
"(",
")",
"if",
"k",
"in",
"registered_claims",
".",
"values",
"(",
")",
"]",
"for",
"name",
"in",
"cla... | 0828eaace0846918d2d202f5a60167a003e88b71 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.