id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
40,800 | greenape/mktheapidocs | mktheapidocs/mkapi.py | refs_section | def refs_section(doc):
"""
Generate a References section.
Parameters
----------
doc : dict
Dictionary produced by numpydoc
Returns
-------
list of str
Markdown for references section
"""
lines = []
if "References" in doc and len(doc["References"]) > 0:
... | python | def refs_section(doc):
"""
Generate a References section.
Parameters
----------
doc : dict
Dictionary produced by numpydoc
Returns
-------
list of str
Markdown for references section
"""
lines = []
if "References" in doc and len(doc["References"]) > 0:
... | [
"def",
"refs_section",
"(",
"doc",
")",
":",
"lines",
"=",
"[",
"]",
"if",
"\"References\"",
"in",
"doc",
"and",
"len",
"(",
"doc",
"[",
"\"References\"",
"]",
")",
">",
"0",
":",
"# print(\"Found refs\")",
"for",
"ref",
"in",
"doc",
"[",
"\"References\"... | Generate a References section.
Parameters
----------
doc : dict
Dictionary produced by numpydoc
Returns
-------
list of str
Markdown for references section | [
"Generate",
"a",
"References",
"section",
"."
] | a45e8b43ddd80ed360fe1e98d4f73dc11c4e7bf7 | https://github.com/greenape/mktheapidocs/blob/a45e8b43ddd80ed360fe1e98d4f73dc11c4e7bf7/mktheapidocs/mkapi.py#L231-L256 |
40,801 | greenape/mktheapidocs | mktheapidocs/mkapi.py | examples_section | def examples_section(doc, header_level):
"""
Generate markdown for Examples section.
Parameters
----------
doc : dict
Dict from numpydoc
header_level : int
Number of `#`s to use for header
Returns
-------
list of str
Markdown for examples section
"""
... | python | def examples_section(doc, header_level):
"""
Generate markdown for Examples section.
Parameters
----------
doc : dict
Dict from numpydoc
header_level : int
Number of `#`s to use for header
Returns
-------
list of str
Markdown for examples section
"""
... | [
"def",
"examples_section",
"(",
"doc",
",",
"header_level",
")",
":",
"lines",
"=",
"[",
"]",
"if",
"\"Examples\"",
"in",
"doc",
"and",
"len",
"(",
"doc",
"[",
"\"Examples\"",
"]",
")",
">",
"0",
":",
"lines",
".",
"append",
"(",
"f\"{'#'*(header_level+1... | Generate markdown for Examples section.
Parameters
----------
doc : dict
Dict from numpydoc
header_level : int
Number of `#`s to use for header
Returns
-------
list of str
Markdown for examples section | [
"Generate",
"markdown",
"for",
"Examples",
"section",
"."
] | a45e8b43ddd80ed360fe1e98d4f73dc11c4e7bf7 | https://github.com/greenape/mktheapidocs/blob/a45e8b43ddd80ed360fe1e98d4f73dc11c4e7bf7/mktheapidocs/mkapi.py#L259-L280 |
40,802 | greenape/mktheapidocs | mktheapidocs/mkapi.py | returns_section | def returns_section(thing, doc, header_level):
"""
Generate markdown for Returns section.
Parameters
----------
thing : function
Function to produce returns for
doc : dict
Dict from numpydoc
header_level : int
Number of `#`s to use for header
Returns
-------... | python | def returns_section(thing, doc, header_level):
"""
Generate markdown for Returns section.
Parameters
----------
thing : function
Function to produce returns for
doc : dict
Dict from numpydoc
header_level : int
Number of `#`s to use for header
Returns
-------... | [
"def",
"returns_section",
"(",
"thing",
",",
"doc",
",",
"header_level",
")",
":",
"lines",
"=",
"[",
"]",
"return_type",
"=",
"None",
"try",
":",
"return_type",
"=",
"thing",
".",
"__annotations__",
"[",
"\"return\"",
"]",
"except",
"AttributeError",
":",
... | Generate markdown for Returns section.
Parameters
----------
thing : function
Function to produce returns for
doc : dict
Dict from numpydoc
header_level : int
Number of `#`s to use for header
Returns
-------
list of str
Markdown for examples section | [
"Generate",
"markdown",
"for",
"Returns",
"section",
"."
] | a45e8b43ddd80ed360fe1e98d4f73dc11c4e7bf7 | https://github.com/greenape/mktheapidocs/blob/a45e8b43ddd80ed360fe1e98d4f73dc11c4e7bf7/mktheapidocs/mkapi.py#L283-L357 |
40,803 | greenape/mktheapidocs | mktheapidocs/mkapi.py | summary | def summary(doc):
"""
Generate markdown for summary section.
Parameters
----------
doc : dict
Output from numpydoc
Returns
-------
list of str
Markdown strings
"""
lines = []
if "Summary" in doc and len(doc["Summary"]) > 0:
lines.append(fix_footnotes... | python | def summary(doc):
"""
Generate markdown for summary section.
Parameters
----------
doc : dict
Output from numpydoc
Returns
-------
list of str
Markdown strings
"""
lines = []
if "Summary" in doc and len(doc["Summary"]) > 0:
lines.append(fix_footnotes... | [
"def",
"summary",
"(",
"doc",
")",
":",
"lines",
"=",
"[",
"]",
"if",
"\"Summary\"",
"in",
"doc",
"and",
"len",
"(",
"doc",
"[",
"\"Summary\"",
"]",
")",
">",
"0",
":",
"lines",
".",
"append",
"(",
"fix_footnotes",
"(",
"\" \"",
".",
"join",
"(",
... | Generate markdown for summary section.
Parameters
----------
doc : dict
Output from numpydoc
Returns
-------
list of str
Markdown strings | [
"Generate",
"markdown",
"for",
"summary",
"section",
"."
] | a45e8b43ddd80ed360fe1e98d4f73dc11c4e7bf7 | https://github.com/greenape/mktheapidocs/blob/a45e8b43ddd80ed360fe1e98d4f73dc11c4e7bf7/mktheapidocs/mkapi.py#L360-L381 |
40,804 | greenape/mktheapidocs | mktheapidocs/mkapi.py | params_section | def params_section(thing, doc, header_level):
"""
Generate markdown for Parameters section.
Parameters
----------
thing : functuon
Function to produce parameters from
doc : dict
Dict from numpydoc
header_level : int
Number of `#`s to use for header
Returns
-... | python | def params_section(thing, doc, header_level):
"""
Generate markdown for Parameters section.
Parameters
----------
thing : functuon
Function to produce parameters from
doc : dict
Dict from numpydoc
header_level : int
Number of `#`s to use for header
Returns
-... | [
"def",
"params_section",
"(",
"thing",
",",
"doc",
",",
"header_level",
")",
":",
"lines",
"=",
"[",
"]",
"class_doc",
"=",
"doc",
"[",
"\"Parameters\"",
"]",
"return",
"type_list",
"(",
"inspect",
".",
"signature",
"(",
"thing",
")",
",",
"class_doc",
"... | Generate markdown for Parameters section.
Parameters
----------
thing : functuon
Function to produce parameters from
doc : dict
Dict from numpydoc
header_level : int
Number of `#`s to use for header
Returns
-------
list of str
Markdown for examples secti... | [
"Generate",
"markdown",
"for",
"Parameters",
"section",
"."
] | a45e8b43ddd80ed360fe1e98d4f73dc11c4e7bf7 | https://github.com/greenape/mktheapidocs/blob/a45e8b43ddd80ed360fe1e98d4f73dc11c4e7bf7/mktheapidocs/mkapi.py#L384-L409 |
40,805 | greenape/mktheapidocs | mktheapidocs/mkapi.py | string_annotation | def string_annotation(typ, default):
"""
Construct a string representation of a type annotation.
Parameters
----------
typ : type
Type to turn into a string
default : any
Default value (if any) of the type
Returns
-------
str
String version of the type annot... | python | def string_annotation(typ, default):
"""
Construct a string representation of a type annotation.
Parameters
----------
typ : type
Type to turn into a string
default : any
Default value (if any) of the type
Returns
-------
str
String version of the type annot... | [
"def",
"string_annotation",
"(",
"typ",
",",
"default",
")",
":",
"try",
":",
"type_string",
"=",
"(",
"f\"`{typ.__name__}`\"",
"if",
"typ",
".",
"__module__",
"==",
"\"builtins\"",
"else",
"f\"`{typ.__module__}.{typ.__name__}`\"",
")",
"except",
"AttributeError",
"... | Construct a string representation of a type annotation.
Parameters
----------
typ : type
Type to turn into a string
default : any
Default value (if any) of the type
Returns
-------
str
String version of the type annotation | [
"Construct",
"a",
"string",
"representation",
"of",
"a",
"type",
"annotation",
"."
] | a45e8b43ddd80ed360fe1e98d4f73dc11c4e7bf7 | https://github.com/greenape/mktheapidocs/blob/a45e8b43ddd80ed360fe1e98d4f73dc11c4e7bf7/mktheapidocs/mkapi.py#L519-L549 |
40,806 | greenape/mktheapidocs | mktheapidocs/mkapi.py | type_list | def type_list(signature, doc, header):
"""
Construct a list of types, preferring type annotations to
docstrings if they are available.
Parameters
----------
signature : Signature
Signature of thing
doc : list of tuple
Numpydoc's type list section
Returns
-------
... | python | def type_list(signature, doc, header):
"""
Construct a list of types, preferring type annotations to
docstrings if they are available.
Parameters
----------
signature : Signature
Signature of thing
doc : list of tuple
Numpydoc's type list section
Returns
-------
... | [
"def",
"type_list",
"(",
"signature",
",",
"doc",
",",
"header",
")",
":",
"lines",
"=",
"[",
"]",
"docced",
"=",
"set",
"(",
")",
"lines",
".",
"append",
"(",
"header",
")",
"try",
":",
"for",
"names",
",",
"types",
",",
"description",
"in",
"doc"... | Construct a list of types, preferring type annotations to
docstrings if they are available.
Parameters
----------
signature : Signature
Signature of thing
doc : list of tuple
Numpydoc's type list section
Returns
-------
list of str
Markdown formatted type list | [
"Construct",
"a",
"list",
"of",
"types",
"preferring",
"type",
"annotations",
"to",
"docstrings",
"if",
"they",
"are",
"available",
"."
] | a45e8b43ddd80ed360fe1e98d4f73dc11c4e7bf7 | https://github.com/greenape/mktheapidocs/blob/a45e8b43ddd80ed360fe1e98d4f73dc11c4e7bf7/mktheapidocs/mkapi.py#L552-L612 |
40,807 | greenape/mktheapidocs | mktheapidocs/mkapi.py | attributes_section | def attributes_section(thing, doc, header_level):
"""
Generate an attributes section for classes.
Prefers type annotations, if they are present.
Parameters
----------
thing : class
Class to document
doc : dict
Numpydoc output
header_level : int
Number of `#`s to... | python | def attributes_section(thing, doc, header_level):
"""
Generate an attributes section for classes.
Prefers type annotations, if they are present.
Parameters
----------
thing : class
Class to document
doc : dict
Numpydoc output
header_level : int
Number of `#`s to... | [
"def",
"attributes_section",
"(",
"thing",
",",
"doc",
",",
"header_level",
")",
":",
"# Get Attributes",
"if",
"not",
"inspect",
".",
"isclass",
"(",
"thing",
")",
":",
"return",
"[",
"]",
"props",
",",
"class_doc",
"=",
"_split_props",
"(",
"thing",
",",... | Generate an attributes section for classes.
Prefers type annotations, if they are present.
Parameters
----------
thing : class
Class to document
doc : dict
Numpydoc output
header_level : int
Number of `#`s to use for header
Returns
-------
list of str
... | [
"Generate",
"an",
"attributes",
"section",
"for",
"classes",
"."
] | a45e8b43ddd80ed360fe1e98d4f73dc11c4e7bf7 | https://github.com/greenape/mktheapidocs/blob/a45e8b43ddd80ed360fe1e98d4f73dc11c4e7bf7/mktheapidocs/mkapi.py#L635-L666 |
40,808 | greenape/mktheapidocs | mktheapidocs/mkapi.py | enum_doc | def enum_doc(name, enum, header_level, source_location):
"""
Generate markdown for an enum
Parameters
----------
name : str
Name of the thing being documented
enum : EnumMeta
Enum to document
header_level : int
Heading level
source_location : str
URL of r... | python | def enum_doc(name, enum, header_level, source_location):
"""
Generate markdown for an enum
Parameters
----------
name : str
Name of the thing being documented
enum : EnumMeta
Enum to document
header_level : int
Heading level
source_location : str
URL of r... | [
"def",
"enum_doc",
"(",
"name",
",",
"enum",
",",
"header_level",
",",
"source_location",
")",
":",
"lines",
"=",
"[",
"f\"{'#'*header_level} Enum **{name}**\\n\\n\"",
"]",
"lines",
".",
"append",
"(",
"f\"```python\\n{name}\\n```\\n\"",
")",
"lines",
".",
"append",... | Generate markdown for an enum
Parameters
----------
name : str
Name of the thing being documented
enum : EnumMeta
Enum to document
header_level : int
Heading level
source_location : str
URL of repo containing source code | [
"Generate",
"markdown",
"for",
"an",
"enum"
] | a45e8b43ddd80ed360fe1e98d4f73dc11c4e7bf7 | https://github.com/greenape/mktheapidocs/blob/a45e8b43ddd80ed360fe1e98d4f73dc11c4e7bf7/mktheapidocs/mkapi.py#L669-L695 |
40,809 | greenape/mktheapidocs | mktheapidocs/mkapi.py | to_doc | def to_doc(name, thing, header_level, source_location):
"""
Generate markdown for a class or function
Parameters
----------
name : str
Name of the thing being documented
thing : class or function
Class or function to document
header_level : int
Heading level
sour... | python | def to_doc(name, thing, header_level, source_location):
"""
Generate markdown for a class or function
Parameters
----------
name : str
Name of the thing being documented
thing : class or function
Class or function to document
header_level : int
Heading level
sour... | [
"def",
"to_doc",
"(",
"name",
",",
"thing",
",",
"header_level",
",",
"source_location",
")",
":",
"if",
"type",
"(",
"thing",
")",
"is",
"enum",
".",
"EnumMeta",
":",
"return",
"enum_doc",
"(",
"name",
",",
"thing",
",",
"header_level",
",",
"source_loc... | Generate markdown for a class or function
Parameters
----------
name : str
Name of the thing being documented
thing : class or function
Class or function to document
header_level : int
Heading level
source_location : str
URL of repo containing source code | [
"Generate",
"markdown",
"for",
"a",
"class",
"or",
"function"
] | a45e8b43ddd80ed360fe1e98d4f73dc11c4e7bf7 | https://github.com/greenape/mktheapidocs/blob/a45e8b43ddd80ed360fe1e98d4f73dc11c4e7bf7/mktheapidocs/mkapi.py#L698-L738 |
40,810 | greenape/mktheapidocs | mktheapidocs/mkapi.py | doc_module | def doc_module(module_name, module, output_dir, source_location, leaf):
"""
Document a module
Parameters
----------
module_name : str
module : module
output_dir : str
source_location : str
leaf : bool
"""
path = pathlib.Path(output_dir).joinpath(*module.__name__.split("."))
... | python | def doc_module(module_name, module, output_dir, source_location, leaf):
"""
Document a module
Parameters
----------
module_name : str
module : module
output_dir : str
source_location : str
leaf : bool
"""
path = pathlib.Path(output_dir).joinpath(*module.__name__.split("."))
... | [
"def",
"doc_module",
"(",
"module_name",
",",
"module",
",",
"output_dir",
",",
"source_location",
",",
"leaf",
")",
":",
"path",
"=",
"pathlib",
".",
"Path",
"(",
"output_dir",
")",
".",
"joinpath",
"(",
"*",
"module",
".",
"__name__",
".",
"split",
"("... | Document a module
Parameters
----------
module_name : str
module : module
output_dir : str
source_location : str
leaf : bool | [
"Document",
"a",
"module"
] | a45e8b43ddd80ed360fe1e98d4f73dc11c4e7bf7 | https://github.com/greenape/mktheapidocs/blob/a45e8b43ddd80ed360fe1e98d4f73dc11c4e7bf7/mktheapidocs/mkapi.py#L741-L789 |
40,811 | MisanthropicBit/colorise | colorise/__init__.py | set_color | def set_color(fg=None, bg=None):
"""Set the current colors.
If no arguments are given, sets default colors.
"""
if fg or bg:
_color_manager.set_color(fg, bg)
else:
_color_manager.set_defaults() | python | def set_color(fg=None, bg=None):
"""Set the current colors.
If no arguments are given, sets default colors.
"""
if fg or bg:
_color_manager.set_color(fg, bg)
else:
_color_manager.set_defaults() | [
"def",
"set_color",
"(",
"fg",
"=",
"None",
",",
"bg",
"=",
"None",
")",
":",
"if",
"fg",
"or",
"bg",
":",
"_color_manager",
".",
"set_color",
"(",
"fg",
",",
"bg",
")",
"else",
":",
"_color_manager",
".",
"set_defaults",
"(",
")"
] | Set the current colors.
If no arguments are given, sets default colors. | [
"Set",
"the",
"current",
"colors",
"."
] | e630df74b8b27680a43c370ddbe98766be50158c | https://github.com/MisanthropicBit/colorise/blob/e630df74b8b27680a43c370ddbe98766be50158c/colorise/__init__.py#L69-L78 |
40,812 | MisanthropicBit/colorise | colorise/__init__.py | cprint | def cprint(string, fg=None, bg=None, end='\n', target=sys.stdout):
"""Print a colored string to the target handle.
fg and bg specify foreground- and background colors, respectively. The
remaining keyword arguments are the same as for Python's built-in print
function. Colors are returned to their defaul... | python | def cprint(string, fg=None, bg=None, end='\n', target=sys.stdout):
"""Print a colored string to the target handle.
fg and bg specify foreground- and background colors, respectively. The
remaining keyword arguments are the same as for Python's built-in print
function. Colors are returned to their defaul... | [
"def",
"cprint",
"(",
"string",
",",
"fg",
"=",
"None",
",",
"bg",
"=",
"None",
",",
"end",
"=",
"'\\n'",
",",
"target",
"=",
"sys",
".",
"stdout",
")",
":",
"_color_manager",
".",
"set_color",
"(",
"fg",
",",
"bg",
")",
"target",
".",
"write",
"... | Print a colored string to the target handle.
fg and bg specify foreground- and background colors, respectively. The
remaining keyword arguments are the same as for Python's built-in print
function. Colors are returned to their defaults before the function
returns. | [
"Print",
"a",
"colored",
"string",
"to",
"the",
"target",
"handle",
"."
] | e630df74b8b27680a43c370ddbe98766be50158c | https://github.com/MisanthropicBit/colorise/blob/e630df74b8b27680a43c370ddbe98766be50158c/colorise/__init__.py#L81-L93 |
40,813 | MisanthropicBit/colorise | colorise/__init__.py | fprint | def fprint(fmt, *args, **kwargs):
"""Parse and print a colored and perhaps formatted string.
The remaining keyword arguments are the same as for Python's built-in print
function. Colors are returning to their defaults before the function
returns.
"""
if not fmt:
return
hascolor = ... | python | def fprint(fmt, *args, **kwargs):
"""Parse and print a colored and perhaps formatted string.
The remaining keyword arguments are the same as for Python's built-in print
function. Colors are returning to their defaults before the function
returns.
"""
if not fmt:
return
hascolor = ... | [
"def",
"fprint",
"(",
"fmt",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"fmt",
":",
"return",
"hascolor",
"=",
"False",
"target",
"=",
"kwargs",
".",
"get",
"(",
"\"target\"",
",",
"sys",
".",
"stdout",
")",
"# Format the strin... | Parse and print a colored and perhaps formatted string.
The remaining keyword arguments are the same as for Python's built-in print
function. Colors are returning to their defaults before the function
returns. | [
"Parse",
"and",
"print",
"a",
"colored",
"and",
"perhaps",
"formatted",
"string",
"."
] | e630df74b8b27680a43c370ddbe98766be50158c | https://github.com/MisanthropicBit/colorise/blob/e630df74b8b27680a43c370ddbe98766be50158c/colorise/__init__.py#L96-L127 |
40,814 | MisanthropicBit/colorise | colorise/__init__.py | formatcolor | def formatcolor(string, fg=None, bg=None):
"""Wrap color syntax around a string and return it.
fg and bg specify foreground- and background colors, respectively.
"""
if fg is bg is None:
return string
temp = (['fg='+fg] if fg else []) +\
(['bg='+bg] if bg else [])
fmt = _co... | python | def formatcolor(string, fg=None, bg=None):
"""Wrap color syntax around a string and return it.
fg and bg specify foreground- and background colors, respectively.
"""
if fg is bg is None:
return string
temp = (['fg='+fg] if fg else []) +\
(['bg='+bg] if bg else [])
fmt = _co... | [
"def",
"formatcolor",
"(",
"string",
",",
"fg",
"=",
"None",
",",
"bg",
"=",
"None",
")",
":",
"if",
"fg",
"is",
"bg",
"is",
"None",
":",
"return",
"string",
"temp",
"=",
"(",
"[",
"'fg='",
"+",
"fg",
"]",
"if",
"fg",
"else",
"[",
"]",
")",
"... | Wrap color syntax around a string and return it.
fg and bg specify foreground- and background colors, respectively. | [
"Wrap",
"color",
"syntax",
"around",
"a",
"string",
"and",
"return",
"it",
"."
] | e630df74b8b27680a43c370ddbe98766be50158c | https://github.com/MisanthropicBit/colorise/blob/e630df74b8b27680a43c370ddbe98766be50158c/colorise/__init__.py#L130-L145 |
40,815 | MisanthropicBit/colorise | colorise/__init__.py | formatbyindex | def formatbyindex(string, fg=None, bg=None, indices=[]):
"""Wrap color syntax around characters using indices and return it.
fg and bg specify foreground- and background colors, respectively.
"""
if not string or not indices or (fg is bg is None):
return string
result, p = '', 0
# Th... | python | def formatbyindex(string, fg=None, bg=None, indices=[]):
"""Wrap color syntax around characters using indices and return it.
fg and bg specify foreground- and background colors, respectively.
"""
if not string or not indices or (fg is bg is None):
return string
result, p = '', 0
# Th... | [
"def",
"formatbyindex",
"(",
"string",
",",
"fg",
"=",
"None",
",",
"bg",
"=",
"None",
",",
"indices",
"=",
"[",
"]",
")",
":",
"if",
"not",
"string",
"or",
"not",
"indices",
"or",
"(",
"fg",
"is",
"bg",
"is",
"None",
")",
":",
"return",
"string"... | Wrap color syntax around characters using indices and return it.
fg and bg specify foreground- and background colors, respectively. | [
"Wrap",
"color",
"syntax",
"around",
"characters",
"using",
"indices",
"and",
"return",
"it",
"."
] | e630df74b8b27680a43c370ddbe98766be50158c | https://github.com/MisanthropicBit/colorise/blob/e630df74b8b27680a43c370ddbe98766be50158c/colorise/__init__.py#L148-L173 |
40,816 | MisanthropicBit/colorise | colorise/__init__.py | highlight | def highlight(string, fg=None, bg=None, indices=[], end='\n',
target=sys.stdout):
"""Highlight characters using indices and print it to the target handle.
fg and bg specify foreground- and background colors, respectively. The
remaining keyword arguments are the same as for Python's built-in p... | python | def highlight(string, fg=None, bg=None, indices=[], end='\n',
target=sys.stdout):
"""Highlight characters using indices and print it to the target handle.
fg and bg specify foreground- and background colors, respectively. The
remaining keyword arguments are the same as for Python's built-in p... | [
"def",
"highlight",
"(",
"string",
",",
"fg",
"=",
"None",
",",
"bg",
"=",
"None",
",",
"indices",
"=",
"[",
"]",
",",
"end",
"=",
"'\\n'",
",",
"target",
"=",
"sys",
".",
"stdout",
")",
":",
"if",
"not",
"string",
"or",
"not",
"indices",
"or",
... | Highlight characters using indices and print it to the target handle.
fg and bg specify foreground- and background colors, respectively. The
remaining keyword arguments are the same as for Python's built-in print
function. | [
"Highlight",
"characters",
"using",
"indices",
"and",
"print",
"it",
"to",
"the",
"target",
"handle",
"."
] | e630df74b8b27680a43c370ddbe98766be50158c | https://github.com/MisanthropicBit/colorise/blob/e630df74b8b27680a43c370ddbe98766be50158c/colorise/__init__.py#L176-L206 |
40,817 | envi-idl/envipyarclib | envipyarclib/gptool/parameter/builder.py | create_param_info | def create_param_info(task_params, parameter_map):
"""
Builds the code block for the GPTool GetParameterInfo method based on the input task_params.
:param task_params: A list of task parameters to map to GPTool parameters.
:return: A string representing the code block to the GPTool GetParameterInfo met... | python | def create_param_info(task_params, parameter_map):
"""
Builds the code block for the GPTool GetParameterInfo method based on the input task_params.
:param task_params: A list of task parameters to map to GPTool parameters.
:return: A string representing the code block to the GPTool GetParameterInfo met... | [
"def",
"create_param_info",
"(",
"task_params",
",",
"parameter_map",
")",
":",
"gp_params",
"=",
"[",
"]",
"gp_param_list",
"=",
"[",
"]",
"gp_param_idx_list",
"=",
"[",
"]",
"gp_param_idx",
"=",
"0",
"for",
"task_param",
"in",
"task_params",
":",
"# Setup to... | Builds the code block for the GPTool GetParameterInfo method based on the input task_params.
:param task_params: A list of task parameters to map to GPTool parameters.
:return: A string representing the code block to the GPTool GetParameterInfo method. | [
"Builds",
"the",
"code",
"block",
"for",
"the",
"GPTool",
"GetParameterInfo",
"method",
"based",
"on",
"the",
"input",
"task_params",
"."
] | 90135652510c3d53c5f51177252c1fea2639bf22 | https://github.com/envi-idl/envipyarclib/blob/90135652510c3d53c5f51177252c1fea2639bf22/envipyarclib/gptool/parameter/builder.py#L100-L163 |
40,818 | envi-idl/envipyarclib | envipyarclib/gptool/parameter/builder.py | create_update_parameter | def create_update_parameter(task_params, parameter_map):
"""
Builds the code block for the GPTool UpdateParameter method based on the input task_params.
:param task_params: A list of task parameters from the task info structure.
:return: A string representing the code block to the GPTool UpdateParamete... | python | def create_update_parameter(task_params, parameter_map):
"""
Builds the code block for the GPTool UpdateParameter method based on the input task_params.
:param task_params: A list of task parameters from the task info structure.
:return: A string representing the code block to the GPTool UpdateParamete... | [
"def",
"create_update_parameter",
"(",
"task_params",
",",
"parameter_map",
")",
":",
"gp_params",
"=",
"[",
"]",
"for",
"param",
"in",
"task_params",
":",
"if",
"param",
"[",
"'direction'",
"]",
".",
"upper",
"(",
")",
"==",
"'OUTPUT'",
":",
"continue",
"... | Builds the code block for the GPTool UpdateParameter method based on the input task_params.
:param task_params: A list of task parameters from the task info structure.
:return: A string representing the code block to the GPTool UpdateParameter method. | [
"Builds",
"the",
"code",
"block",
"for",
"the",
"GPTool",
"UpdateParameter",
"method",
"based",
"on",
"the",
"input",
"task_params",
"."
] | 90135652510c3d53c5f51177252c1fea2639bf22 | https://github.com/envi-idl/envipyarclib/blob/90135652510c3d53c5f51177252c1fea2639bf22/envipyarclib/gptool/parameter/builder.py#L166-L186 |
40,819 | envi-idl/envipyarclib | envipyarclib/gptool/parameter/builder.py | create_pre_execute | def create_pre_execute(task_params, parameter_map):
"""
Builds the code block for the GPTool Execute method before the job is
submitted based on the input task_params.
:param task_params: A list of task parameters from the task info structure.
:return: A string representing the code block to the GP... | python | def create_pre_execute(task_params, parameter_map):
"""
Builds the code block for the GPTool Execute method before the job is
submitted based on the input task_params.
:param task_params: A list of task parameters from the task info structure.
:return: A string representing the code block to the GP... | [
"def",
"create_pre_execute",
"(",
"task_params",
",",
"parameter_map",
")",
":",
"gp_params",
"=",
"[",
"_PRE_EXECUTE_INIT_TEMPLATE",
"]",
"for",
"task_param",
"in",
"task_params",
":",
"if",
"task_param",
"[",
"'direction'",
"]",
".",
"upper",
"(",
")",
"==",
... | Builds the code block for the GPTool Execute method before the job is
submitted based on the input task_params.
:param task_params: A list of task parameters from the task info structure.
:return: A string representing the code block to the GPTool Execute method. | [
"Builds",
"the",
"code",
"block",
"for",
"the",
"GPTool",
"Execute",
"method",
"before",
"the",
"job",
"is",
"submitted",
"based",
"on",
"the",
"input",
"task_params",
"."
] | 90135652510c3d53c5f51177252c1fea2639bf22 | https://github.com/envi-idl/envipyarclib/blob/90135652510c3d53c5f51177252c1fea2639bf22/envipyarclib/gptool/parameter/builder.py#L207-L229 |
40,820 | envi-idl/envipyarclib | envipyarclib/gptool/parameter/builder.py | create_post_execute | def create_post_execute(task_params, parameter_map):
"""
Builds the code block for the GPTool Execute method after the job is
submitted based on the input task_params.
:param task_params: A list of task parameters from the task info structure.
:return: A string representing the code block to the GP... | python | def create_post_execute(task_params, parameter_map):
"""
Builds the code block for the GPTool Execute method after the job is
submitted based on the input task_params.
:param task_params: A list of task parameters from the task info structure.
:return: A string representing the code block to the GP... | [
"def",
"create_post_execute",
"(",
"task_params",
",",
"parameter_map",
")",
":",
"gp_params",
"=",
"[",
"]",
"for",
"task_param",
"in",
"task_params",
":",
"if",
"task_param",
"[",
"'direction'",
"]",
".",
"upper",
"(",
")",
"==",
"'INPUT'",
":",
"continue"... | Builds the code block for the GPTool Execute method after the job is
submitted based on the input task_params.
:param task_params: A list of task parameters from the task info structure.
:return: A string representing the code block to the GPTool Execute method. | [
"Builds",
"the",
"code",
"block",
"for",
"the",
"GPTool",
"Execute",
"method",
"after",
"the",
"job",
"is",
"submitted",
"based",
"on",
"the",
"input",
"task_params",
"."
] | 90135652510c3d53c5f51177252c1fea2639bf22 | https://github.com/envi-idl/envipyarclib/blob/90135652510c3d53c5f51177252c1fea2639bf22/envipyarclib/gptool/parameter/builder.py#L232-L254 |
40,821 | envi-idl/envipyarclib | envipyarclib/gptool/parameter/builder.py | ParameterMap.load_default_templates | def load_default_templates(self):
"""Load the default templates"""
for importer, modname, is_pkg in pkgutil.iter_modules(templates.__path__):
self.register_template('.'.join((templates.__name__, modname))) | python | def load_default_templates(self):
"""Load the default templates"""
for importer, modname, is_pkg in pkgutil.iter_modules(templates.__path__):
self.register_template('.'.join((templates.__name__, modname))) | [
"def",
"load_default_templates",
"(",
"self",
")",
":",
"for",
"importer",
",",
"modname",
",",
"is_pkg",
"in",
"pkgutil",
".",
"iter_modules",
"(",
"templates",
".",
"__path__",
")",
":",
"self",
".",
"register_template",
"(",
"'.'",
".",
"join",
"(",
"("... | Load the default templates | [
"Load",
"the",
"default",
"templates"
] | 90135652510c3d53c5f51177252c1fea2639bf22 | https://github.com/envi-idl/envipyarclib/blob/90135652510c3d53c5f51177252c1fea2639bf22/envipyarclib/gptool/parameter/builder.py#L70-L73 |
40,822 | ponty/confduino | confduino/hwpackremove.py | remove_hwpack | def remove_hwpack(name):
"""remove hardware package.
:param name: hardware package name (e.g. 'Sanguino')
:rtype: None
"""
targ_dlib = hwpack_dir() / name
log.debug('remove %s', targ_dlib)
targ_dlib.rmtree() | python | def remove_hwpack(name):
"""remove hardware package.
:param name: hardware package name (e.g. 'Sanguino')
:rtype: None
"""
targ_dlib = hwpack_dir() / name
log.debug('remove %s', targ_dlib)
targ_dlib.rmtree() | [
"def",
"remove_hwpack",
"(",
"name",
")",
":",
"targ_dlib",
"=",
"hwpack_dir",
"(",
")",
"/",
"name",
"log",
".",
"debug",
"(",
"'remove %s'",
",",
"targ_dlib",
")",
"targ_dlib",
".",
"rmtree",
"(",
")"
] | remove hardware package.
:param name: hardware package name (e.g. 'Sanguino')
:rtype: None | [
"remove",
"hardware",
"package",
"."
] | f4c261e5e84997f145a8bdd001f471db74c9054b | https://github.com/ponty/confduino/blob/f4c261e5e84997f145a8bdd001f471db74c9054b/confduino/hwpackremove.py#L9-L18 |
40,823 | pbrisk/timewave | timewave/stochasticconsumer.py | StatisticsConsumer.finalize | def finalize(self):
"""finalize for StatisticsConsumer"""
super(StatisticsConsumer, self).finalize()
# run statistics on timewave slice w at grid point g
# self.result = [(g, self.statistics(w)) for g, w in zip(self.grid, self.result)]
# self.result = zip(self.grid, (self.statist... | python | def finalize(self):
"""finalize for StatisticsConsumer"""
super(StatisticsConsumer, self).finalize()
# run statistics on timewave slice w at grid point g
# self.result = [(g, self.statistics(w)) for g, w in zip(self.grid, self.result)]
# self.result = zip(self.grid, (self.statist... | [
"def",
"finalize",
"(",
"self",
")",
":",
"super",
"(",
"StatisticsConsumer",
",",
"self",
")",
".",
"finalize",
"(",
")",
"# run statistics on timewave slice w at grid point g",
"# self.result = [(g, self.statistics(w)) for g, w in zip(self.grid, self.result)]",
"# self.result =... | finalize for StatisticsConsumer | [
"finalize",
"for",
"StatisticsConsumer"
] | cf641391d1607a424042724c8b990d43ee270ef6 | https://github.com/pbrisk/timewave/blob/cf641391d1607a424042724c8b990d43ee270ef6/timewave/stochasticconsumer.py#L63-L69 |
40,824 | pbrisk/timewave | timewave/stochasticconsumer.py | StochasticProcessStatisticsConsumer.finalize | def finalize(self):
"""finalize for StochasticProcessStatisticsConsumer"""
super(StochasticProcessStatisticsConsumer, self).finalize()
class StochasticProcessStatistics(self.statistics):
"""local version to store statistics"""
def __str__(self):
s = [k.r... | python | def finalize(self):
"""finalize for StochasticProcessStatisticsConsumer"""
super(StochasticProcessStatisticsConsumer, self).finalize()
class StochasticProcessStatistics(self.statistics):
"""local version to store statistics"""
def __str__(self):
s = [k.r... | [
"def",
"finalize",
"(",
"self",
")",
":",
"super",
"(",
"StochasticProcessStatisticsConsumer",
",",
"self",
")",
".",
"finalize",
"(",
")",
"class",
"StochasticProcessStatistics",
"(",
"self",
".",
"statistics",
")",
":",
"\"\"\"local version to store statistics\"\"\"... | finalize for StochasticProcessStatisticsConsumer | [
"finalize",
"for",
"StochasticProcessStatisticsConsumer"
] | cf641391d1607a424042724c8b990d43ee270ef6 | https://github.com/pbrisk/timewave/blob/cf641391d1607a424042724c8b990d43ee270ef6/timewave/stochasticconsumer.py#L77-L105 |
40,825 | contains-io/rcli | rcli/autodetect.py | setup_keyword | def setup_keyword(dist, _, value):
# type: (setuptools.dist.Distribution, str, bool) -> None
"""Add autodetected commands as entry points.
Args:
dist: The distutils Distribution object for the project being
installed.
_: The keyword used in the setup function. Unused.
va... | python | def setup_keyword(dist, _, value):
# type: (setuptools.dist.Distribution, str, bool) -> None
"""Add autodetected commands as entry points.
Args:
dist: The distutils Distribution object for the project being
installed.
_: The keyword used in the setup function. Unused.
va... | [
"def",
"setup_keyword",
"(",
"dist",
",",
"_",
",",
"value",
")",
":",
"# type: (setuptools.dist.Distribution, str, bool) -> None",
"if",
"value",
"is",
"not",
"True",
":",
"return",
"dist",
".",
"entry_points",
"=",
"_ensure_entry_points_is_dict",
"(",
"dist",
".",... | Add autodetected commands as entry points.
Args:
dist: The distutils Distribution object for the project being
installed.
_: The keyword used in the setup function. Unused.
value: The value set to the keyword in the setup function. If the value
is not True, this func... | [
"Add",
"autodetected",
"commands",
"as",
"entry",
"points",
"."
] | cdd6191a0e0a19bc767f84921650835d099349cf | https://github.com/contains-io/rcli/blob/cdd6191a0e0a19bc767f84921650835d099349cf/rcli/autodetect.py#L30-L51 |
40,826 | contains-io/rcli | rcli/autodetect.py | egg_info_writer | def egg_info_writer(cmd, basename, filename):
# type: (setuptools.command.egg_info.egg_info, str, str) -> None
"""Read rcli configuration and write it out to the egg info.
Args:
cmd: An egg info command instance to use for writing.
basename: The basename of the file to write.
filena... | python | def egg_info_writer(cmd, basename, filename):
# type: (setuptools.command.egg_info.egg_info, str, str) -> None
"""Read rcli configuration and write it out to the egg info.
Args:
cmd: An egg info command instance to use for writing.
basename: The basename of the file to write.
filena... | [
"def",
"egg_info_writer",
"(",
"cmd",
",",
"basename",
",",
"filename",
")",
":",
"# type: (setuptools.command.egg_info.egg_info, str, str) -> None",
"setupcfg",
"=",
"next",
"(",
"(",
"f",
"for",
"f",
"in",
"setuptools",
".",
"findall",
"(",
")",
"if",
"os",
".... | Read rcli configuration and write it out to the egg info.
Args:
cmd: An egg info command instance to use for writing.
basename: The basename of the file to write.
filename: The full path of the file to write into the egg info. | [
"Read",
"rcli",
"configuration",
"and",
"write",
"it",
"out",
"to",
"the",
"egg",
"info",
"."
] | cdd6191a0e0a19bc767f84921650835d099349cf | https://github.com/contains-io/rcli/blob/cdd6191a0e0a19bc767f84921650835d099349cf/rcli/autodetect.py#L66-L94 |
40,827 | contains-io/rcli | rcli/autodetect.py | _get_commands | def _get_commands(dist # type: setuptools.dist.Distribution
):
# type: (...) -> typing.Dict[str, typing.Set[str]]
"""Find all commands belonging to the given distribution.
Args:
dist: The Distribution to search for docopt-compatible docstrings that
can be used to gene... | python | def _get_commands(dist # type: setuptools.dist.Distribution
):
# type: (...) -> typing.Dict[str, typing.Set[str]]
"""Find all commands belonging to the given distribution.
Args:
dist: The Distribution to search for docopt-compatible docstrings that
can be used to gene... | [
"def",
"_get_commands",
"(",
"dist",
"# type: setuptools.dist.Distribution",
")",
":",
"# type: (...) -> typing.Dict[str, typing.Set[str]]",
"py_files",
"=",
"(",
"f",
"for",
"f",
"in",
"setuptools",
".",
"findall",
"(",
")",
"if",
"os",
".",
"path",
".",
"splitext"... | Find all commands belonging to the given distribution.
Args:
dist: The Distribution to search for docopt-compatible docstrings that
can be used to generate command entry points.
Returns:
A dictionary containing a mapping of primary commands to sets of
subcommands. | [
"Find",
"all",
"commands",
"belonging",
"to",
"the",
"given",
"distribution",
"."
] | cdd6191a0e0a19bc767f84921650835d099349cf | https://github.com/contains-io/rcli/blob/cdd6191a0e0a19bc767f84921650835d099349cf/rcli/autodetect.py#L97-L121 |
40,828 | contains-io/rcli | rcli/autodetect.py | _append_commands | def _append_commands(dct, # type: typing.Dict[str, typing.Set[str]]
module_name, # type: str
commands # type:typing.Iterable[_EntryPoint]
):
# type: (...) -> None
"""Append entry point strings representing the given Command objects.
Args:
... | python | def _append_commands(dct, # type: typing.Dict[str, typing.Set[str]]
module_name, # type: str
commands # type:typing.Iterable[_EntryPoint]
):
# type: (...) -> None
"""Append entry point strings representing the given Command objects.
Args:
... | [
"def",
"_append_commands",
"(",
"dct",
",",
"# type: typing.Dict[str, typing.Set[str]]",
"module_name",
",",
"# type: str",
"commands",
"# type:typing.Iterable[_EntryPoint]",
")",
":",
"# type: (...) -> None",
"for",
"command",
"in",
"commands",
":",
"entry_point",
"=",
"'{... | Append entry point strings representing the given Command objects.
Args:
dct: The dictionary to append with entry point strings. Each key will
be a primary command with a value containing a list of entry point
strings representing a Command.
module_name: The name of the modu... | [
"Append",
"entry",
"point",
"strings",
"representing",
"the",
"given",
"Command",
"objects",
"."
] | cdd6191a0e0a19bc767f84921650835d099349cf | https://github.com/contains-io/rcli/blob/cdd6191a0e0a19bc767f84921650835d099349cf/rcli/autodetect.py#L124-L148 |
40,829 | contains-io/rcli | rcli/autodetect.py | _get_module_commands | def _get_module_commands(module):
# type: (ast.Module) -> typing.Generator[_EntryPoint, None, None]
"""Yield all Command objects represented by the python module.
Module commands consist of a docopt-style module docstring and a callable
Command class.
Args:
module: An ast.Module object use... | python | def _get_module_commands(module):
# type: (ast.Module) -> typing.Generator[_EntryPoint, None, None]
"""Yield all Command objects represented by the python module.
Module commands consist of a docopt-style module docstring and a callable
Command class.
Args:
module: An ast.Module object use... | [
"def",
"_get_module_commands",
"(",
"module",
")",
":",
"# type: (ast.Module) -> typing.Generator[_EntryPoint, None, None]",
"cls",
"=",
"next",
"(",
"(",
"n",
"for",
"n",
"in",
"module",
".",
"body",
"if",
"isinstance",
"(",
"n",
",",
"ast",
".",
"ClassDef",
")... | Yield all Command objects represented by the python module.
Module commands consist of a docopt-style module docstring and a callable
Command class.
Args:
module: An ast.Module object used to retrieve docopt-style commands.
Yields:
Command objects that represent entry points to append... | [
"Yield",
"all",
"Command",
"objects",
"represented",
"by",
"the",
"python",
"module",
"."
] | cdd6191a0e0a19bc767f84921650835d099349cf | https://github.com/contains-io/rcli/blob/cdd6191a0e0a19bc767f84921650835d099349cf/rcli/autodetect.py#L178-L200 |
40,830 | contains-io/rcli | rcli/autodetect.py | _get_function_commands | def _get_function_commands(module):
# type: (ast.Module) -> typing.Generator[_EntryPoint, None, None]
"""Yield all Command objects represented by python functions in the module.
Function commands consist of all top-level functions that contain
docopt-style docstrings.
Args:
module: An ast.... | python | def _get_function_commands(module):
# type: (ast.Module) -> typing.Generator[_EntryPoint, None, None]
"""Yield all Command objects represented by python functions in the module.
Function commands consist of all top-level functions that contain
docopt-style docstrings.
Args:
module: An ast.... | [
"def",
"_get_function_commands",
"(",
"module",
")",
":",
"# type: (ast.Module) -> typing.Generator[_EntryPoint, None, None]",
"nodes",
"=",
"(",
"n",
"for",
"n",
"in",
"module",
".",
"body",
"if",
"isinstance",
"(",
"n",
",",
"ast",
".",
"FunctionDef",
")",
")",
... | Yield all Command objects represented by python functions in the module.
Function commands consist of all top-level functions that contain
docopt-style docstrings.
Args:
module: An ast.Module object used to retrieve docopt-style commands.
Yields:
Command objects that represent entry p... | [
"Yield",
"all",
"Command",
"objects",
"represented",
"by",
"python",
"functions",
"in",
"the",
"module",
"."
] | cdd6191a0e0a19bc767f84921650835d099349cf | https://github.com/contains-io/rcli/blob/cdd6191a0e0a19bc767f84921650835d099349cf/rcli/autodetect.py#L226-L244 |
40,831 | tslight/pdu | pdu/du.py | convert | def convert(b):
'''
takes a number of bytes as an argument and returns the most suitable human
readable unit conversion.
'''
if b > 1024**3:
hr = round(b/1024**3)
unit = "GB"
elif b > 1024**2:
hr = round(b/1024**2)
unit = "MB"
else:
hr = round(b/1024)
... | python | def convert(b):
'''
takes a number of bytes as an argument and returns the most suitable human
readable unit conversion.
'''
if b > 1024**3:
hr = round(b/1024**3)
unit = "GB"
elif b > 1024**2:
hr = round(b/1024**2)
unit = "MB"
else:
hr = round(b/1024)
... | [
"def",
"convert",
"(",
"b",
")",
":",
"if",
"b",
">",
"1024",
"**",
"3",
":",
"hr",
"=",
"round",
"(",
"b",
"/",
"1024",
"**",
"3",
")",
"unit",
"=",
"\"GB\"",
"elif",
"b",
">",
"1024",
"**",
"2",
":",
"hr",
"=",
"round",
"(",
"b",
"/",
"... | takes a number of bytes as an argument and returns the most suitable human
readable unit conversion. | [
"takes",
"a",
"number",
"of",
"bytes",
"as",
"an",
"argument",
"and",
"returns",
"the",
"most",
"suitable",
"human",
"readable",
"unit",
"conversion",
"."
] | b6dfc5e8f6773b1e4e3047496b0ab72fef267a27 | https://github.com/tslight/pdu/blob/b6dfc5e8f6773b1e4e3047496b0ab72fef267a27/pdu/du.py#L7-L21 |
40,832 | tslight/pdu | pdu/du.py | calc | def calc(path):
'''
Takes a path as an argument and returns the total size in bytes of the file
or directory. If the path is a directory the size will be calculated
recursively.
'''
total = 0
err = None
if os.path.isdir(path):
try:
for entry in os.scandir(path):
... | python | def calc(path):
'''
Takes a path as an argument and returns the total size in bytes of the file
or directory. If the path is a directory the size will be calculated
recursively.
'''
total = 0
err = None
if os.path.isdir(path):
try:
for entry in os.scandir(path):
... | [
"def",
"calc",
"(",
"path",
")",
":",
"total",
"=",
"0",
"err",
"=",
"None",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"path",
")",
":",
"try",
":",
"for",
"entry",
"in",
"os",
".",
"scandir",
"(",
"path",
")",
":",
"try",
":",
"is_dir",
"=... | Takes a path as an argument and returns the total size in bytes of the file
or directory. If the path is a directory the size will be calculated
recursively. | [
"Takes",
"a",
"path",
"as",
"an",
"argument",
"and",
"returns",
"the",
"total",
"size",
"in",
"bytes",
"of",
"the",
"file",
"or",
"directory",
".",
"If",
"the",
"path",
"is",
"a",
"directory",
"the",
"size",
"will",
"be",
"calculated",
"recursively",
"."... | b6dfc5e8f6773b1e4e3047496b0ab72fef267a27 | https://github.com/tslight/pdu/blob/b6dfc5e8f6773b1e4e3047496b0ab72fef267a27/pdu/du.py#L24-L57 |
40,833 | tslight/pdu | pdu/du.py | du | def du(path):
'''
Put it all together!
'''
size, err = calc(path)
if err:
return err
else:
hr, unit = convert(size)
hr = str(hr)
result = hr + " " + unit
return result | python | def du(path):
'''
Put it all together!
'''
size, err = calc(path)
if err:
return err
else:
hr, unit = convert(size)
hr = str(hr)
result = hr + " " + unit
return result | [
"def",
"du",
"(",
"path",
")",
":",
"size",
",",
"err",
"=",
"calc",
"(",
"path",
")",
"if",
"err",
":",
"return",
"err",
"else",
":",
"hr",
",",
"unit",
"=",
"convert",
"(",
"size",
")",
"hr",
"=",
"str",
"(",
"hr",
")",
"result",
"=",
"hr",... | Put it all together! | [
"Put",
"it",
"all",
"together!"
] | b6dfc5e8f6773b1e4e3047496b0ab72fef267a27 | https://github.com/tslight/pdu/blob/b6dfc5e8f6773b1e4e3047496b0ab72fef267a27/pdu/du.py#L60-L71 |
40,834 | tBaxter/activity-monitor | activity_monitor/management/commands/register_timeline_content.py | Command.handle | def handle(self, **kwargs):
"""
Simply re-saves all objects from models listed in settings.TIMELINE_MODELS. Since the timeline
app is now following these models, it will register each item as it is re-saved. The purpose of this
script is to register content in your database that existed prior to... | python | def handle(self, **kwargs):
"""
Simply re-saves all objects from models listed in settings.TIMELINE_MODELS. Since the timeline
app is now following these models, it will register each item as it is re-saved. The purpose of this
script is to register content in your database that existed prior to... | [
"def",
"handle",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"item",
"in",
"settings",
".",
"ACTIVITY_MONITOR_MODELS",
":",
"app_label",
",",
"model",
"=",
"item",
"[",
"'model'",
"]",
".",
"split",
"(",
"'.'",
",",
"1",
")",
"content_type",... | Simply re-saves all objects from models listed in settings.TIMELINE_MODELS. Since the timeline
app is now following these models, it will register each item as it is re-saved. The purpose of this
script is to register content in your database that existed prior to installing the timeline app. | [
"Simply",
"re",
"-",
"saves",
"all",
"objects",
"from",
"models",
"listed",
"in",
"settings",
".",
"TIMELINE_MODELS",
".",
"Since",
"the",
"timeline",
"app",
"is",
"now",
"following",
"these",
"models",
"it",
"will",
"register",
"each",
"item",
"as",
"it",
... | be6c6edc7c6b4141923b47376502cde0f785eb68 | https://github.com/tBaxter/activity-monitor/blob/be6c6edc7c6b4141923b47376502cde0f785eb68/activity_monitor/management/commands/register_timeline_content.py#L12-L29 |
40,835 | andy29485/embypy | embypy/objects/misc.py | Audio.album_primary_image_url | def album_primary_image_url(self):
'''The image of the album'''
path = '/Items/{}/Images/Primary'.format(self.album_id)
return self.connector.get_url(path, attach_api_key=False) | python | def album_primary_image_url(self):
'''The image of the album'''
path = '/Items/{}/Images/Primary'.format(self.album_id)
return self.connector.get_url(path, attach_api_key=False) | [
"def",
"album_primary_image_url",
"(",
"self",
")",
":",
"path",
"=",
"'/Items/{}/Images/Primary'",
".",
"format",
"(",
"self",
".",
"album_id",
")",
"return",
"self",
".",
"connector",
".",
"get_url",
"(",
"path",
",",
"attach_api_key",
"=",
"False",
")"
] | The image of the album | [
"The",
"image",
"of",
"the",
"album"
] | cde658d380965caaf4789d4d182d045b0346797b | https://github.com/andy29485/embypy/blob/cde658d380965caaf4789d4d182d045b0346797b/embypy/objects/misc.py#L118-L121 |
40,836 | andy29485/embypy | embypy/objects/misc.py | Audio.stream_url | def stream_url(self):
'''stream for this song - not re-encoded'''
path = '/Audio/{}/universal'.format(self.id)
return self.connector.get_url(path,
userId=self.connector.userid,
MaxStreamingBitrate=140000000,
Container='opus',
TranscodingContainer='opus... | python | def stream_url(self):
'''stream for this song - not re-encoded'''
path = '/Audio/{}/universal'.format(self.id)
return self.connector.get_url(path,
userId=self.connector.userid,
MaxStreamingBitrate=140000000,
Container='opus',
TranscodingContainer='opus... | [
"def",
"stream_url",
"(",
"self",
")",
":",
"path",
"=",
"'/Audio/{}/universal'",
".",
"format",
"(",
"self",
".",
"id",
")",
"return",
"self",
".",
"connector",
".",
"get_url",
"(",
"path",
",",
"userId",
"=",
"self",
".",
"connector",
".",
"userid",
... | stream for this song - not re-encoded | [
"stream",
"for",
"this",
"song",
"-",
"not",
"re",
"-",
"encoded"
] | cde658d380965caaf4789d4d182d045b0346797b | https://github.com/andy29485/embypy/blob/cde658d380965caaf4789d4d182d045b0346797b/embypy/objects/misc.py#L132-L143 |
40,837 | koehlma/pygrooveshark | src/grooveshark/classes/picture.py | Picture.data | def data(self):
"""
raw image data
"""
if self._data is None:
request = urllib.Request(self._url, headers={'User-Agent': USER_AGENT})
with contextlib.closing(self._connection.urlopen(request)) as response:
self._data = response.read()
retur... | python | def data(self):
"""
raw image data
"""
if self._data is None:
request = urllib.Request(self._url, headers={'User-Agent': USER_AGENT})
with contextlib.closing(self._connection.urlopen(request)) as response:
self._data = response.read()
retur... | [
"def",
"data",
"(",
"self",
")",
":",
"if",
"self",
".",
"_data",
"is",
"None",
":",
"request",
"=",
"urllib",
".",
"Request",
"(",
"self",
".",
"_url",
",",
"headers",
"=",
"{",
"'User-Agent'",
":",
"USER_AGENT",
"}",
")",
"with",
"contextlib",
".",... | raw image data | [
"raw",
"image",
"data"
] | 17673758ac12f54dc26ac879c30ea44f13b81057 | https://github.com/koehlma/pygrooveshark/blob/17673758ac12f54dc26ac879c30ea44f13b81057/src/grooveshark/classes/picture.py#L51-L59 |
40,838 | helixyte/everest | everest/url.py | UrlPartsConverter.make_filter_string | def make_filter_string(cls, filter_specification):
"""
Converts the given filter specification to a CQL filter expression.
"""
registry = get_current_registry()
visitor_cls = registry.getUtility(IFilterSpecificationVisitor,
name=EXPRESSIO... | python | def make_filter_string(cls, filter_specification):
"""
Converts the given filter specification to a CQL filter expression.
"""
registry = get_current_registry()
visitor_cls = registry.getUtility(IFilterSpecificationVisitor,
name=EXPRESSIO... | [
"def",
"make_filter_string",
"(",
"cls",
",",
"filter_specification",
")",
":",
"registry",
"=",
"get_current_registry",
"(",
")",
"visitor_cls",
"=",
"registry",
".",
"getUtility",
"(",
"IFilterSpecificationVisitor",
",",
"name",
"=",
"EXPRESSION_KINDS",
".",
"CQL"... | Converts the given filter specification to a CQL filter expression. | [
"Converts",
"the",
"given",
"filter",
"specification",
"to",
"a",
"CQL",
"filter",
"expression",
"."
] | 70c9b93c3061db5cb62428349d18b8fb8566411b | https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/url.py#L161-L170 |
40,839 | helixyte/everest | everest/url.py | UrlPartsConverter.make_order_string | def make_order_string(cls, order_specification):
"""
Converts the given order specification to a CQL order expression.
"""
registry = get_current_registry()
visitor_cls = registry.getUtility(IOrderSpecificationVisitor,
name=EXPRESSION_KIN... | python | def make_order_string(cls, order_specification):
"""
Converts the given order specification to a CQL order expression.
"""
registry = get_current_registry()
visitor_cls = registry.getUtility(IOrderSpecificationVisitor,
name=EXPRESSION_KIN... | [
"def",
"make_order_string",
"(",
"cls",
",",
"order_specification",
")",
":",
"registry",
"=",
"get_current_registry",
"(",
")",
"visitor_cls",
"=",
"registry",
".",
"getUtility",
"(",
"IOrderSpecificationVisitor",
",",
"name",
"=",
"EXPRESSION_KINDS",
".",
"CQL",
... | Converts the given order specification to a CQL order expression. | [
"Converts",
"the",
"given",
"order",
"specification",
"to",
"a",
"CQL",
"order",
"expression",
"."
] | 70c9b93c3061db5cb62428349d18b8fb8566411b | https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/url.py#L183-L192 |
40,840 | helixyte/everest | everest/url.py | UrlPartsConverter.make_slice_key | def make_slice_key(cls, start_string, size_string):
"""
Converts the given start and size query parts to a slice key.
:return: slice key
:rtype: slice
"""
try:
start = int(start_string)
except ValueError:
raise ValueError('Query parameter ... | python | def make_slice_key(cls, start_string, size_string):
"""
Converts the given start and size query parts to a slice key.
:return: slice key
:rtype: slice
"""
try:
start = int(start_string)
except ValueError:
raise ValueError('Query parameter ... | [
"def",
"make_slice_key",
"(",
"cls",
",",
"start_string",
",",
"size_string",
")",
":",
"try",
":",
"start",
"=",
"int",
"(",
"start_string",
")",
"except",
"ValueError",
":",
"raise",
"ValueError",
"(",
"'Query parameter \"start\" must be a number.'",
")",
"if",
... | Converts the given start and size query parts to a slice key.
:return: slice key
:rtype: slice | [
"Converts",
"the",
"given",
"start",
"and",
"size",
"query",
"parts",
"to",
"a",
"slice",
"key",
"."
] | 70c9b93c3061db5cb62428349d18b8fb8566411b | https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/url.py#L195-L216 |
40,841 | helixyte/everest | everest/url.py | UrlPartsConverter.make_slice_strings | def make_slice_strings(cls, slice_key):
"""
Converts the given slice key to start and size query parts.
"""
start = slice_key.start
size = slice_key.stop - start
return (str(start), str(size)) | python | def make_slice_strings(cls, slice_key):
"""
Converts the given slice key to start and size query parts.
"""
start = slice_key.start
size = slice_key.stop - start
return (str(start), str(size)) | [
"def",
"make_slice_strings",
"(",
"cls",
",",
"slice_key",
")",
":",
"start",
"=",
"slice_key",
".",
"start",
"size",
"=",
"slice_key",
".",
"stop",
"-",
"start",
"return",
"(",
"str",
"(",
"start",
")",
",",
"str",
"(",
"size",
")",
")"
] | Converts the given slice key to start and size query parts. | [
"Converts",
"the",
"given",
"slice",
"key",
"to",
"start",
"and",
"size",
"query",
"parts",
"."
] | 70c9b93c3061db5cb62428349d18b8fb8566411b | https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/url.py#L219-L225 |
40,842 | BlackEarth/bxml | bxml/xt.py | XT.match | def match(self, expression=None, xpath=None, namespaces=None):
"""decorator that allows us to match by expression or by xpath for each transformation method"""
class MatchObject(Dict):
pass
def _match(function):
self.matches.append(
MatchObject(expression... | python | def match(self, expression=None, xpath=None, namespaces=None):
"""decorator that allows us to match by expression or by xpath for each transformation method"""
class MatchObject(Dict):
pass
def _match(function):
self.matches.append(
MatchObject(expression... | [
"def",
"match",
"(",
"self",
",",
"expression",
"=",
"None",
",",
"xpath",
"=",
"None",
",",
"namespaces",
"=",
"None",
")",
":",
"class",
"MatchObject",
"(",
"Dict",
")",
":",
"pass",
"def",
"_match",
"(",
"function",
")",
":",
"self",
".",
"matches... | decorator that allows us to match by expression or by xpath for each transformation method | [
"decorator",
"that",
"allows",
"us",
"to",
"match",
"by",
"expression",
"or",
"by",
"xpath",
"for",
"each",
"transformation",
"method"
] | 8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77 | https://github.com/BlackEarth/bxml/blob/8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77/bxml/xt.py#L16-L26 |
40,843 | BlackEarth/bxml | bxml/xt.py | XT.get_match | def get_match(self, elem):
"""for the given elem, return the @match function that will be applied"""
for m in self.matches:
if (m.expression is not None and eval(m.expression)==True) \
or (m.xpath is not None and len(elem.xpath(m.xpath, namespaces=m.namespaces)) > 0):
... | python | def get_match(self, elem):
"""for the given elem, return the @match function that will be applied"""
for m in self.matches:
if (m.expression is not None and eval(m.expression)==True) \
or (m.xpath is not None and len(elem.xpath(m.xpath, namespaces=m.namespaces)) > 0):
... | [
"def",
"get_match",
"(",
"self",
",",
"elem",
")",
":",
"for",
"m",
"in",
"self",
".",
"matches",
":",
"if",
"(",
"m",
".",
"expression",
"is",
"not",
"None",
"and",
"eval",
"(",
"m",
".",
"expression",
")",
"==",
"True",
")",
"or",
"(",
"m",
"... | for the given elem, return the @match function that will be applied | [
"for",
"the",
"given",
"elem",
"return",
"the"
] | 8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77 | https://github.com/BlackEarth/bxml/blob/8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77/bxml/xt.py#L45-L51 |
40,844 | BlackEarth/bxml | bxml/xt.py | XT.Element | def Element(self, elem, **params):
"""Ensure that the input element is immutable by the transformation. Returns a single element."""
res = self.__call__(deepcopy(elem), **params)
if len(res) > 0:
return res[0]
else:
return None | python | def Element(self, elem, **params):
"""Ensure that the input element is immutable by the transformation. Returns a single element."""
res = self.__call__(deepcopy(elem), **params)
if len(res) > 0:
return res[0]
else:
return None | [
"def",
"Element",
"(",
"self",
",",
"elem",
",",
"*",
"*",
"params",
")",
":",
"res",
"=",
"self",
".",
"__call__",
"(",
"deepcopy",
"(",
"elem",
")",
",",
"*",
"*",
"params",
")",
"if",
"len",
"(",
"res",
")",
">",
"0",
":",
"return",
"res",
... | Ensure that the input element is immutable by the transformation. Returns a single element. | [
"Ensure",
"that",
"the",
"input",
"element",
"is",
"immutable",
"by",
"the",
"transformation",
".",
"Returns",
"a",
"single",
"element",
"."
] | 8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77 | https://github.com/BlackEarth/bxml/blob/8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77/bxml/xt.py#L53-L59 |
40,845 | ponty/confduino | confduino/util.py | read_properties | def read_properties(filename):
"""read properties file into bunch.
:param filename: string
:rtype: bunch (dict like and object like)
"""
s = path(filename).text()
dummy_section = 'xxx'
cfgparser = configparser.RawConfigParser()
# avoid converting options to lower case
cfgparser.op... | python | def read_properties(filename):
"""read properties file into bunch.
:param filename: string
:rtype: bunch (dict like and object like)
"""
s = path(filename).text()
dummy_section = 'xxx'
cfgparser = configparser.RawConfigParser()
# avoid converting options to lower case
cfgparser.op... | [
"def",
"read_properties",
"(",
"filename",
")",
":",
"s",
"=",
"path",
"(",
"filename",
")",
".",
"text",
"(",
")",
"dummy_section",
"=",
"'xxx'",
"cfgparser",
"=",
"configparser",
".",
"RawConfigParser",
"(",
")",
"# avoid converting options to lower case",
"cf... | read properties file into bunch.
:param filename: string
:rtype: bunch (dict like and object like) | [
"read",
"properties",
"file",
"into",
"bunch",
"."
] | f4c261e5e84997f145a8bdd001f471db74c9054b | https://github.com/ponty/confduino/blob/f4c261e5e84997f145a8bdd001f471db74c9054b/confduino/util.py#L58-L76 |
40,846 | shawnsilva/steamwebapi | steamwebapi/api.py | _SteamWebAPI.create_request_url | def create_request_url(self, interface, method, version, parameters):
"""Create the URL to submit to the Steam Web API
interface: Steam Web API interface containing methods.
method: The method to call.
version: The version of the method.
paramters: Parameters to supply to the me... | python | def create_request_url(self, interface, method, version, parameters):
"""Create the URL to submit to the Steam Web API
interface: Steam Web API interface containing methods.
method: The method to call.
version: The version of the method.
paramters: Parameters to supply to the me... | [
"def",
"create_request_url",
"(",
"self",
",",
"interface",
",",
"method",
",",
"version",
",",
"parameters",
")",
":",
"if",
"'format'",
"in",
"parameters",
":",
"parameters",
"[",
"'key'",
"]",
"=",
"self",
".",
"apikey",
"else",
":",
"parameters",
".",
... | Create the URL to submit to the Steam Web API
interface: Steam Web API interface containing methods.
method: The method to call.
version: The version of the method.
paramters: Parameters to supply to the method. | [
"Create",
"the",
"URL",
"to",
"submit",
"to",
"the",
"Steam",
"Web",
"API"
] | dc16538ebe985cc7ea170f660169ebc2366efbf2 | https://github.com/shawnsilva/steamwebapi/blob/dc16538ebe985cc7ea170f660169ebc2366efbf2/steamwebapi/api.py#L56-L72 |
40,847 | shawnsilva/steamwebapi | steamwebapi/api.py | _SteamWebAPI.retrieve_request | def retrieve_request(self, url):
"""Open the given url and decode and return the response
url: The url to open.
"""
try:
data = urlopen(url)
except:
print("Error Retrieving Data from Steam")
sys.exit(2)
return data.read().decode('utf-... | python | def retrieve_request(self, url):
"""Open the given url and decode and return the response
url: The url to open.
"""
try:
data = urlopen(url)
except:
print("Error Retrieving Data from Steam")
sys.exit(2)
return data.read().decode('utf-... | [
"def",
"retrieve_request",
"(",
"self",
",",
"url",
")",
":",
"try",
":",
"data",
"=",
"urlopen",
"(",
"url",
")",
"except",
":",
"print",
"(",
"\"Error Retrieving Data from Steam\"",
")",
"sys",
".",
"exit",
"(",
"2",
")",
"return",
"data",
".",
"read",... | Open the given url and decode and return the response
url: The url to open. | [
"Open",
"the",
"given",
"url",
"and",
"decode",
"and",
"return",
"the",
"response"
] | dc16538ebe985cc7ea170f660169ebc2366efbf2 | https://github.com/shawnsilva/steamwebapi/blob/dc16538ebe985cc7ea170f660169ebc2366efbf2/steamwebapi/api.py#L74-L85 |
40,848 | shawnsilva/steamwebapi | steamwebapi/api.py | _SteamWebAPI.return_data | def return_data(self, data, format=None):
"""Format and return data appropriate to the requested API format.
data: The data retured by the api request
"""
if format is None:
format = self.format
if format == "json":
formatted_data = json.loads(data)
... | python | def return_data(self, data, format=None):
"""Format and return data appropriate to the requested API format.
data: The data retured by the api request
"""
if format is None:
format = self.format
if format == "json":
formatted_data = json.loads(data)
... | [
"def",
"return_data",
"(",
"self",
",",
"data",
",",
"format",
"=",
"None",
")",
":",
"if",
"format",
"is",
"None",
":",
"format",
"=",
"self",
".",
"format",
"if",
"format",
"==",
"\"json\"",
":",
"formatted_data",
"=",
"json",
".",
"loads",
"(",
"d... | Format and return data appropriate to the requested API format.
data: The data retured by the api request | [
"Format",
"and",
"return",
"data",
"appropriate",
"to",
"the",
"requested",
"API",
"format",
"."
] | dc16538ebe985cc7ea170f660169ebc2366efbf2 | https://github.com/shawnsilva/steamwebapi/blob/dc16538ebe985cc7ea170f660169ebc2366efbf2/steamwebapi/api.py#L87-L99 |
40,849 | shawnsilva/steamwebapi | steamwebapi/api.py | ISteamUser.get_friends_list | def get_friends_list(self, steamID, relationship='all', format=None):
"""Request the friends list of a given steam ID filtered by role.
steamID: The user ID
relationship: Type of friend to request (all, friend)
format: Return format. None defaults to json. (json, xml, vdf)
"""
... | python | def get_friends_list(self, steamID, relationship='all', format=None):
"""Request the friends list of a given steam ID filtered by role.
steamID: The user ID
relationship: Type of friend to request (all, friend)
format: Return format. None defaults to json. (json, xml, vdf)
"""
... | [
"def",
"get_friends_list",
"(",
"self",
",",
"steamID",
",",
"relationship",
"=",
"'all'",
",",
"format",
"=",
"None",
")",
":",
"parameters",
"=",
"{",
"'steamid'",
":",
"steamID",
",",
"'relationship'",
":",
"relationship",
"}",
"if",
"format",
"is",
"no... | Request the friends list of a given steam ID filtered by role.
steamID: The user ID
relationship: Type of friend to request (all, friend)
format: Return format. None defaults to json. (json, xml, vdf) | [
"Request",
"the",
"friends",
"list",
"of",
"a",
"given",
"steam",
"ID",
"filtered",
"by",
"role",
"."
] | dc16538ebe985cc7ea170f660169ebc2366efbf2 | https://github.com/shawnsilva/steamwebapi/blob/dc16538ebe985cc7ea170f660169ebc2366efbf2/steamwebapi/api.py#L106-L120 |
40,850 | shawnsilva/steamwebapi | steamwebapi/api.py | ISteamUser.get_player_bans | def get_player_bans(self, steamIDS, format=None):
"""Request the communities a steam id is banned in.
steamIDS: Comma-delimited list of SteamIDs
format: Return format. None defaults to json. (json, xml, vdf)
"""
parameters = {'steamids' : steamIDS}
if format is not None... | python | def get_player_bans(self, steamIDS, format=None):
"""Request the communities a steam id is banned in.
steamIDS: Comma-delimited list of SteamIDs
format: Return format. None defaults to json. (json, xml, vdf)
"""
parameters = {'steamids' : steamIDS}
if format is not None... | [
"def",
"get_player_bans",
"(",
"self",
",",
"steamIDS",
",",
"format",
"=",
"None",
")",
":",
"parameters",
"=",
"{",
"'steamids'",
":",
"steamIDS",
"}",
"if",
"format",
"is",
"not",
"None",
":",
"parameters",
"[",
"'format'",
"]",
"=",
"format",
"url",
... | Request the communities a steam id is banned in.
steamIDS: Comma-delimited list of SteamIDs
format: Return format. None defaults to json. (json, xml, vdf) | [
"Request",
"the",
"communities",
"a",
"steam",
"id",
"is",
"banned",
"in",
"."
] | dc16538ebe985cc7ea170f660169ebc2366efbf2 | https://github.com/shawnsilva/steamwebapi/blob/dc16538ebe985cc7ea170f660169ebc2366efbf2/steamwebapi/api.py#L122-L135 |
40,851 | shawnsilva/steamwebapi | steamwebapi/api.py | ISteamUser.get_user_group_list | def get_user_group_list(self, steamID, format=None):
"""Request a list of groups a user is subscribed to.
steamID: User ID
format: Return format. None defaults to json. (json, xml, vdf)
"""
parameters = {'steamid' : steamID}
if format is not None:
parameters... | python | def get_user_group_list(self, steamID, format=None):
"""Request a list of groups a user is subscribed to.
steamID: User ID
format: Return format. None defaults to json. (json, xml, vdf)
"""
parameters = {'steamid' : steamID}
if format is not None:
parameters... | [
"def",
"get_user_group_list",
"(",
"self",
",",
"steamID",
",",
"format",
"=",
"None",
")",
":",
"parameters",
"=",
"{",
"'steamid'",
":",
"steamID",
"}",
"if",
"format",
"is",
"not",
"None",
":",
"parameters",
"[",
"'format'",
"]",
"=",
"format",
"url",... | Request a list of groups a user is subscribed to.
steamID: User ID
format: Return format. None defaults to json. (json, xml, vdf) | [
"Request",
"a",
"list",
"of",
"groups",
"a",
"user",
"is",
"subscribed",
"to",
"."
] | dc16538ebe985cc7ea170f660169ebc2366efbf2 | https://github.com/shawnsilva/steamwebapi/blob/dc16538ebe985cc7ea170f660169ebc2366efbf2/steamwebapi/api.py#L153-L166 |
40,852 | shawnsilva/steamwebapi | steamwebapi/api.py | ISteamUser.resolve_vanity_url | def resolve_vanity_url(self, vanityURL, url_type=1, format=None):
"""Request the steam id associated with a vanity url.
vanityURL: The users vanity URL
url_type: The type of vanity URL. 1 (default): Individual profile,
2: Group, 3: Official game group
format: Return ... | python | def resolve_vanity_url(self, vanityURL, url_type=1, format=None):
"""Request the steam id associated with a vanity url.
vanityURL: The users vanity URL
url_type: The type of vanity URL. 1 (default): Individual profile,
2: Group, 3: Official game group
format: Return ... | [
"def",
"resolve_vanity_url",
"(",
"self",
",",
"vanityURL",
",",
"url_type",
"=",
"1",
",",
"format",
"=",
"None",
")",
":",
"parameters",
"=",
"{",
"'vanityurl'",
":",
"vanityURL",
",",
"\"url_type\"",
":",
"url_type",
"}",
"if",
"format",
"is",
"not",
... | Request the steam id associated with a vanity url.
vanityURL: The users vanity URL
url_type: The type of vanity URL. 1 (default): Individual profile,
2: Group, 3: Official game group
format: Return format. None defaults to json. (json, xml, vdf) | [
"Request",
"the",
"steam",
"id",
"associated",
"with",
"a",
"vanity",
"url",
"."
] | dc16538ebe985cc7ea170f660169ebc2366efbf2 | https://github.com/shawnsilva/steamwebapi/blob/dc16538ebe985cc7ea170f660169ebc2366efbf2/steamwebapi/api.py#L168-L183 |
40,853 | shawnsilva/steamwebapi | steamwebapi/api.py | ISteamUserStats.get_global_achievement_percentages_for_app | def get_global_achievement_percentages_for_app(self, gameID, format=None):
"""Request statistics showing global achievements that have been
unlocked.
gameID: The id of the game.
format: Return format. None defaults to json. (json, xml, vdf)
"""
parameters = {'gameid' : ... | python | def get_global_achievement_percentages_for_app(self, gameID, format=None):
"""Request statistics showing global achievements that have been
unlocked.
gameID: The id of the game.
format: Return format. None defaults to json. (json, xml, vdf)
"""
parameters = {'gameid' : ... | [
"def",
"get_global_achievement_percentages_for_app",
"(",
"self",
",",
"gameID",
",",
"format",
"=",
"None",
")",
":",
"parameters",
"=",
"{",
"'gameid'",
":",
"gameID",
"}",
"if",
"format",
"is",
"not",
"None",
":",
"parameters",
"[",
"'format'",
"]",
"=",
... | Request statistics showing global achievements that have been
unlocked.
gameID: The id of the game.
format: Return format. None defaults to json. (json, xml, vdf) | [
"Request",
"statistics",
"showing",
"global",
"achievements",
"that",
"have",
"been",
"unlocked",
"."
] | dc16538ebe985cc7ea170f660169ebc2366efbf2 | https://github.com/shawnsilva/steamwebapi/blob/dc16538ebe985cc7ea170f660169ebc2366efbf2/steamwebapi/api.py#L190-L204 |
40,854 | shawnsilva/steamwebapi | steamwebapi/api.py | ISteamUserStats.get_global_stats_for_game | def get_global_stats_for_game(self, appID, count, names, startdate,
enddate, format=None):
"""Request global stats for a give game.
appID: The app ID
count: Number of stats to get.
names: A list of names of stats to get.
startdate: The start time to gather stats. Uni... | python | def get_global_stats_for_game(self, appID, count, names, startdate,
enddate, format=None):
"""Request global stats for a give game.
appID: The app ID
count: Number of stats to get.
names: A list of names of stats to get.
startdate: The start time to gather stats. Uni... | [
"def",
"get_global_stats_for_game",
"(",
"self",
",",
"appID",
",",
"count",
",",
"names",
",",
"startdate",
",",
"enddate",
",",
"format",
"=",
"None",
")",
":",
"parameters",
"=",
"{",
"'appid'",
":",
"appID",
",",
"'count'",
":",
"count",
",",
"'start... | Request global stats for a give game.
appID: The app ID
count: Number of stats to get.
names: A list of names of stats to get.
startdate: The start time to gather stats. Unix timestamp
enddate: The end time to gather stats. Unix timestamp
format: Return format. None defa... | [
"Request",
"global",
"stats",
"for",
"a",
"give",
"game",
"."
] | dc16538ebe985cc7ea170f660169ebc2366efbf2 | https://github.com/shawnsilva/steamwebapi/blob/dc16538ebe985cc7ea170f660169ebc2366efbf2/steamwebapi/api.py#L206-L234 |
40,855 | shawnsilva/steamwebapi | steamwebapi/api.py | ISteamUserStats.get_number_of_current_players | def get_number_of_current_players(self, appID, format=None):
"""Request the current number of players for a given app.
appID: The app ID
format: Return format. None defaults to json. (json, xml, vdf)
"""
parameters = {'appid' : appID}
if format is not None:
... | python | def get_number_of_current_players(self, appID, format=None):
"""Request the current number of players for a given app.
appID: The app ID
format: Return format. None defaults to json. (json, xml, vdf)
"""
parameters = {'appid' : appID}
if format is not None:
... | [
"def",
"get_number_of_current_players",
"(",
"self",
",",
"appID",
",",
"format",
"=",
"None",
")",
":",
"parameters",
"=",
"{",
"'appid'",
":",
"appID",
"}",
"if",
"format",
"is",
"not",
"None",
":",
"parameters",
"[",
"'format'",
"]",
"=",
"format",
"u... | Request the current number of players for a given app.
appID: The app ID
format: Return format. None defaults to json. (json, xml, vdf) | [
"Request",
"the",
"current",
"number",
"of",
"players",
"for",
"a",
"given",
"app",
"."
] | dc16538ebe985cc7ea170f660169ebc2366efbf2 | https://github.com/shawnsilva/steamwebapi/blob/dc16538ebe985cc7ea170f660169ebc2366efbf2/steamwebapi/api.py#L236-L249 |
40,856 | shawnsilva/steamwebapi | steamwebapi/api.py | ISteamUserStats.get_player_achievements | def get_player_achievements(self, steamID, appID, language=None,
format=None):
"""Request the achievements for a given app and steam id.
steamID: Users steam ID
appID: The app id
language: The language to return the results in. None uses default.
format: Return forma... | python | def get_player_achievements(self, steamID, appID, language=None,
format=None):
"""Request the achievements for a given app and steam id.
steamID: Users steam ID
appID: The app id
language: The language to return the results in. None uses default.
format: Return forma... | [
"def",
"get_player_achievements",
"(",
"self",
",",
"steamID",
",",
"appID",
",",
"language",
"=",
"None",
",",
"format",
"=",
"None",
")",
":",
"parameters",
"=",
"{",
"'steamid'",
":",
"steamID",
",",
"'appid'",
":",
"appID",
"}",
"if",
"format",
"is",... | Request the achievements for a given app and steam id.
steamID: Users steam ID
appID: The app id
language: The language to return the results in. None uses default.
format: Return format. None defaults to json. (json, xml, vdf) | [
"Request",
"the",
"achievements",
"for",
"a",
"given",
"app",
"and",
"steam",
"id",
"."
] | dc16538ebe985cc7ea170f660169ebc2366efbf2 | https://github.com/shawnsilva/steamwebapi/blob/dc16538ebe985cc7ea170f660169ebc2366efbf2/steamwebapi/api.py#L251-L271 |
40,857 | shawnsilva/steamwebapi | steamwebapi/api.py | ISteamUserStats.get_schema_for_game | def get_schema_for_game(self, appID, language=None, format=None):
"""Request the available achievements and stats for a game.
appID: The app id
language: The language to return the results in. None uses default.
format: Return format. None defaults to json. (json, xml, vdf)
"""... | python | def get_schema_for_game(self, appID, language=None, format=None):
"""Request the available achievements and stats for a game.
appID: The app id
language: The language to return the results in. None uses default.
format: Return format. None defaults to json. (json, xml, vdf)
"""... | [
"def",
"get_schema_for_game",
"(",
"self",
",",
"appID",
",",
"language",
"=",
"None",
",",
"format",
"=",
"None",
")",
":",
"parameters",
"=",
"{",
"'appid'",
":",
"appID",
"}",
"if",
"format",
"is",
"not",
"None",
":",
"parameters",
"[",
"'format'",
... | Request the available achievements and stats for a game.
appID: The app id
language: The language to return the results in. None uses default.
format: Return format. None defaults to json. (json, xml, vdf) | [
"Request",
"the",
"available",
"achievements",
"and",
"stats",
"for",
"a",
"game",
"."
] | dc16538ebe985cc7ea170f660169ebc2366efbf2 | https://github.com/shawnsilva/steamwebapi/blob/dc16538ebe985cc7ea170f660169ebc2366efbf2/steamwebapi/api.py#L273-L291 |
40,858 | shawnsilva/steamwebapi | steamwebapi/api.py | ISteamUserStats.get_user_stats_for_game | def get_user_stats_for_game(self, steamID, appID, format=None):
"""Request the user stats for a given game.
steamID: The users ID
appID: The app id
format: Return format. None defaults to json. (json, xml, vdf)
"""
parameters = {'steamid' : steamID, 'appid' : appID}
... | python | def get_user_stats_for_game(self, steamID, appID, format=None):
"""Request the user stats for a given game.
steamID: The users ID
appID: The app id
format: Return format. None defaults to json. (json, xml, vdf)
"""
parameters = {'steamid' : steamID, 'appid' : appID}
... | [
"def",
"get_user_stats_for_game",
"(",
"self",
",",
"steamID",
",",
"appID",
",",
"format",
"=",
"None",
")",
":",
"parameters",
"=",
"{",
"'steamid'",
":",
"steamID",
",",
"'appid'",
":",
"appID",
"}",
"if",
"format",
"is",
"not",
"None",
":",
"paramete... | Request the user stats for a given game.
steamID: The users ID
appID: The app id
format: Return format. None defaults to json. (json, xml, vdf) | [
"Request",
"the",
"user",
"stats",
"for",
"a",
"given",
"game",
"."
] | dc16538ebe985cc7ea170f660169ebc2366efbf2 | https://github.com/shawnsilva/steamwebapi/blob/dc16538ebe985cc7ea170f660169ebc2366efbf2/steamwebapi/api.py#L293-L307 |
40,859 | shawnsilva/steamwebapi | steamwebapi/api.py | IPlayerService.get_recently_played_games | def get_recently_played_games(self, steamID, count=0, format=None):
"""Request a list of recently played games by a given steam id.
steamID: The users ID
count: Number of games to return. (0 is all recent games.)
format: Return format. None defaults to json. (json, xml, vdf)
""... | python | def get_recently_played_games(self, steamID, count=0, format=None):
"""Request a list of recently played games by a given steam id.
steamID: The users ID
count: Number of games to return. (0 is all recent games.)
format: Return format. None defaults to json. (json, xml, vdf)
""... | [
"def",
"get_recently_played_games",
"(",
"self",
",",
"steamID",
",",
"count",
"=",
"0",
",",
"format",
"=",
"None",
")",
":",
"parameters",
"=",
"{",
"'steamid'",
":",
"steamID",
",",
"'count'",
":",
"count",
"}",
"if",
"format",
"is",
"not",
"None",
... | Request a list of recently played games by a given steam id.
steamID: The users ID
count: Number of games to return. (0 is all recent games.)
format: Return format. None defaults to json. (json, xml, vdf) | [
"Request",
"a",
"list",
"of",
"recently",
"played",
"games",
"by",
"a",
"given",
"steam",
"id",
"."
] | dc16538ebe985cc7ea170f660169ebc2366efbf2 | https://github.com/shawnsilva/steamwebapi/blob/dc16538ebe985cc7ea170f660169ebc2366efbf2/steamwebapi/api.py#L316-L330 |
40,860 | shawnsilva/steamwebapi | steamwebapi/api.py | IPlayerService.get_owned_games | def get_owned_games(self, steamID, include_appinfo=1,
include_played_free_games=0, appids_filter=None, format=None):
"""Request a list of games owned by a given steam id.
steamID: The users id
include_appinfo: boolean.
include_played_free_games: boolean.
appids_filte... | python | def get_owned_games(self, steamID, include_appinfo=1,
include_played_free_games=0, appids_filter=None, format=None):
"""Request a list of games owned by a given steam id.
steamID: The users id
include_appinfo: boolean.
include_played_free_games: boolean.
appids_filte... | [
"def",
"get_owned_games",
"(",
"self",
",",
"steamID",
",",
"include_appinfo",
"=",
"1",
",",
"include_played_free_games",
"=",
"0",
",",
"appids_filter",
"=",
"None",
",",
"format",
"=",
"None",
")",
":",
"parameters",
"=",
"{",
"'steamid'",
":",
"steamID",... | Request a list of games owned by a given steam id.
steamID: The users id
include_appinfo: boolean.
include_played_free_games: boolean.
appids_filter: a json encoded list of app ids.
format: Return format. None defaults to json. (json, xml, vdf) | [
"Request",
"a",
"list",
"of",
"games",
"owned",
"by",
"a",
"given",
"steam",
"id",
"."
] | dc16538ebe985cc7ea170f660169ebc2366efbf2 | https://github.com/shawnsilva/steamwebapi/blob/dc16538ebe985cc7ea170f660169ebc2366efbf2/steamwebapi/api.py#L332-L355 |
40,861 | shawnsilva/steamwebapi | steamwebapi/api.py | IPlayerService.get_community_badge_progress | def get_community_badge_progress(self, steamID, badgeID, format=None):
"""Gets all the quests needed to get the specified badge, and which are completed.
steamID: The users ID
badgeID: The badge we're asking about
format: Return format. None defaults to json. (json, xml, vdf)
"... | python | def get_community_badge_progress(self, steamID, badgeID, format=None):
"""Gets all the quests needed to get the specified badge, and which are completed.
steamID: The users ID
badgeID: The badge we're asking about
format: Return format. None defaults to json. (json, xml, vdf)
"... | [
"def",
"get_community_badge_progress",
"(",
"self",
",",
"steamID",
",",
"badgeID",
",",
"format",
"=",
"None",
")",
":",
"parameters",
"=",
"{",
"'steamid'",
":",
"steamID",
",",
"'badgeid'",
":",
"badgeID",
"}",
"if",
"format",
"is",
"not",
"None",
":",
... | Gets all the quests needed to get the specified badge, and which are completed.
steamID: The users ID
badgeID: The badge we're asking about
format: Return format. None defaults to json. (json, xml, vdf) | [
"Gets",
"all",
"the",
"quests",
"needed",
"to",
"get",
"the",
"specified",
"badge",
"and",
"which",
"are",
"completed",
"."
] | dc16538ebe985cc7ea170f660169ebc2366efbf2 | https://github.com/shawnsilva/steamwebapi/blob/dc16538ebe985cc7ea170f660169ebc2366efbf2/steamwebapi/api.py#L387-L401 |
40,862 | shawnsilva/steamwebapi | steamwebapi/api.py | IPlayerService.is_playing_shared_game | def is_playing_shared_game(self, steamID, appid_playing, format=None):
"""Returns valid lender SteamID if game currently played is borrowed.
steamID: The users ID
appid_playing: The game player is currently playing
format: Return format. None defaults to json. (json, xml, vdf)
... | python | def is_playing_shared_game(self, steamID, appid_playing, format=None):
"""Returns valid lender SteamID if game currently played is borrowed.
steamID: The users ID
appid_playing: The game player is currently playing
format: Return format. None defaults to json. (json, xml, vdf)
... | [
"def",
"is_playing_shared_game",
"(",
"self",
",",
"steamID",
",",
"appid_playing",
",",
"format",
"=",
"None",
")",
":",
"parameters",
"=",
"{",
"'steamid'",
":",
"steamID",
",",
"'appid_playing'",
":",
"appid_playing",
"}",
"if",
"format",
"is",
"not",
"No... | Returns valid lender SteamID if game currently played is borrowed.
steamID: The users ID
appid_playing: The game player is currently playing
format: Return format. None defaults to json. (json, xml, vdf) | [
"Returns",
"valid",
"lender",
"SteamID",
"if",
"game",
"currently",
"played",
"is",
"borrowed",
"."
] | dc16538ebe985cc7ea170f660169ebc2366efbf2 | https://github.com/shawnsilva/steamwebapi/blob/dc16538ebe985cc7ea170f660169ebc2366efbf2/steamwebapi/api.py#L403-L417 |
40,863 | shawnsilva/steamwebapi | steamwebapi/api.py | ISteamWebAPIUtil.get_server_info | def get_server_info(self, format=None):
"""Request the Steam Web API status and time.
format: Return format. None defaults to json. (json, xml, vdf)
"""
parameters = {}
if format is not None:
parameters['format'] = format
url = self.create_request_url(self.i... | python | def get_server_info(self, format=None):
"""Request the Steam Web API status and time.
format: Return format. None defaults to json. (json, xml, vdf)
"""
parameters = {}
if format is not None:
parameters['format'] = format
url = self.create_request_url(self.i... | [
"def",
"get_server_info",
"(",
"self",
",",
"format",
"=",
"None",
")",
":",
"parameters",
"=",
"{",
"}",
"if",
"format",
"is",
"not",
"None",
":",
"parameters",
"[",
"'format'",
"]",
"=",
"format",
"url",
"=",
"self",
".",
"create_request_url",
"(",
"... | Request the Steam Web API status and time.
format: Return format. None defaults to json. (json, xml, vdf) | [
"Request",
"the",
"Steam",
"Web",
"API",
"status",
"and",
"time",
"."
] | dc16538ebe985cc7ea170f660169ebc2366efbf2 | https://github.com/shawnsilva/steamwebapi/blob/dc16538ebe985cc7ea170f660169ebc2366efbf2/steamwebapi/api.py#L424-L436 |
40,864 | shawnsilva/steamwebapi | steamwebapi/api.py | SteamCommunityXML.create_request_url | def create_request_url(self, profile_type, steamID):
"""Create the url to submit to the Steam Community XML feed."""
regex = re.compile('^\d{17,}$')
if regex.match(steamID):
if profile_type == self.USER:
url = "http://steamcommunity.com/profiles/%s/?xml=1" % (steamID)... | python | def create_request_url(self, profile_type, steamID):
"""Create the url to submit to the Steam Community XML feed."""
regex = re.compile('^\d{17,}$')
if regex.match(steamID):
if profile_type == self.USER:
url = "http://steamcommunity.com/profiles/%s/?xml=1" % (steamID)... | [
"def",
"create_request_url",
"(",
"self",
",",
"profile_type",
",",
"steamID",
")",
":",
"regex",
"=",
"re",
".",
"compile",
"(",
"'^\\d{17,}$'",
")",
"if",
"regex",
".",
"match",
"(",
"steamID",
")",
":",
"if",
"profile_type",
"==",
"self",
".",
"USER",... | Create the url to submit to the Steam Community XML feed. | [
"Create",
"the",
"url",
"to",
"submit",
"to",
"the",
"Steam",
"Community",
"XML",
"feed",
"."
] | dc16538ebe985cc7ea170f660169ebc2366efbf2 | https://github.com/shawnsilva/steamwebapi/blob/dc16538ebe985cc7ea170f660169ebc2366efbf2/steamwebapi/api.py#L459-L472 |
40,865 | shawnsilva/steamwebapi | steamwebapi/api.py | SteamCommunityXML.get_user_info | def get_user_info(self, steamID):
"""Request the Steam Community XML feed for a specific user."""
url = self.create_request_url(self.USER, steamID)
data = self.retrieve_request(url)
return self.return_data(data, format='xml') | python | def get_user_info(self, steamID):
"""Request the Steam Community XML feed for a specific user."""
url = self.create_request_url(self.USER, steamID)
data = self.retrieve_request(url)
return self.return_data(data, format='xml') | [
"def",
"get_user_info",
"(",
"self",
",",
"steamID",
")",
":",
"url",
"=",
"self",
".",
"create_request_url",
"(",
"self",
".",
"USER",
",",
"steamID",
")",
"data",
"=",
"self",
".",
"retrieve_request",
"(",
"url",
")",
"return",
"self",
".",
"return_dat... | Request the Steam Community XML feed for a specific user. | [
"Request",
"the",
"Steam",
"Community",
"XML",
"feed",
"for",
"a",
"specific",
"user",
"."
] | dc16538ebe985cc7ea170f660169ebc2366efbf2 | https://github.com/shawnsilva/steamwebapi/blob/dc16538ebe985cc7ea170f660169ebc2366efbf2/steamwebapi/api.py#L487-L491 |
40,866 | shawnsilva/steamwebapi | steamwebapi/api.py | SteamCommunityXML.get_group_info | def get_group_info(self, steamID):
"""Request the Steam Community XML feed for a specific group."""
url = self.create_request_url(self.GROUP, steamID)
data = self.retrieve_request(url)
return self.return_data(data, format='xml') | python | def get_group_info(self, steamID):
"""Request the Steam Community XML feed for a specific group."""
url = self.create_request_url(self.GROUP, steamID)
data = self.retrieve_request(url)
return self.return_data(data, format='xml') | [
"def",
"get_group_info",
"(",
"self",
",",
"steamID",
")",
":",
"url",
"=",
"self",
".",
"create_request_url",
"(",
"self",
".",
"GROUP",
",",
"steamID",
")",
"data",
"=",
"self",
".",
"retrieve_request",
"(",
"url",
")",
"return",
"self",
".",
"return_d... | Request the Steam Community XML feed for a specific group. | [
"Request",
"the",
"Steam",
"Community",
"XML",
"feed",
"for",
"a",
"specific",
"group",
"."
] | dc16538ebe985cc7ea170f660169ebc2366efbf2 | https://github.com/shawnsilva/steamwebapi/blob/dc16538ebe985cc7ea170f660169ebc2366efbf2/steamwebapi/api.py#L493-L497 |
40,867 | asascience-open/paegan-transport | paegan/transport/export.py | Trackline.export | def export(cls, folder, particles, datetimes):
"""
Export trackline data to GeoJSON file
"""
normalized_locations = [particle.normalized_locations(datetimes) for particle in particles]
track_coords = []
for x in xrange(0, len(datetimes)):
points = MultiPo... | python | def export(cls, folder, particles, datetimes):
"""
Export trackline data to GeoJSON file
"""
normalized_locations = [particle.normalized_locations(datetimes) for particle in particles]
track_coords = []
for x in xrange(0, len(datetimes)):
points = MultiPo... | [
"def",
"export",
"(",
"cls",
",",
"folder",
",",
"particles",
",",
"datetimes",
")",
":",
"normalized_locations",
"=",
"[",
"particle",
".",
"normalized_locations",
"(",
"datetimes",
")",
"for",
"particle",
"in",
"particles",
"]",
"track_coords",
"=",
"[",
"... | Export trackline data to GeoJSON file | [
"Export",
"trackline",
"data",
"to",
"GeoJSON",
"file"
] | 99a7f4ea24f0f42d9b34d1fb0e87ab2c49315bd3 | https://github.com/asascience-open/paegan-transport/blob/99a7f4ea24f0f42d9b34d1fb0e87ab2c49315bd3/paegan/transport/export.py#L31-L50 |
40,868 | asascience-open/paegan-transport | paegan/transport/export.py | Pickle.export | def export(cls, folder, particles, datetimes):
"""
Export particle and datetime data to Pickled objects.
This can be used to debug or to generate different output
in the future.
"""
if not os.path.exists(folder):
os.makedirs(folder)
partic... | python | def export(cls, folder, particles, datetimes):
"""
Export particle and datetime data to Pickled objects.
This can be used to debug or to generate different output
in the future.
"""
if not os.path.exists(folder):
os.makedirs(folder)
partic... | [
"def",
"export",
"(",
"cls",
",",
"folder",
",",
"particles",
",",
"datetimes",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"folder",
")",
":",
"os",
".",
"makedirs",
"(",
"folder",
")",
"particle_path",
"=",
"os",
".",
"path",
".... | Export particle and datetime data to Pickled objects.
This can be used to debug or to generate different output
in the future. | [
"Export",
"particle",
"and",
"datetime",
"data",
"to",
"Pickled",
"objects",
".",
"This",
"can",
"be",
"used",
"to",
"debug",
"or",
"to",
"generate",
"different",
"output",
"in",
"the",
"future",
"."
] | 99a7f4ea24f0f42d9b34d1fb0e87ab2c49315bd3 | https://github.com/asascience-open/paegan-transport/blob/99a7f4ea24f0f42d9b34d1fb0e87ab2c49315bd3/paegan/transport/export.py#L357-L374 |
40,869 | django-fluent/django-fluent-utils | fluent_utils/load.py | import_settings_class | def import_settings_class(setting_name):
"""
Return the class pointed to be an app setting variable.
"""
config_value = getattr(settings, setting_name)
if config_value is None:
raise ImproperlyConfigured("Required setting not found: {0}".format(setting_name))
return import_class(config_... | python | def import_settings_class(setting_name):
"""
Return the class pointed to be an app setting variable.
"""
config_value = getattr(settings, setting_name)
if config_value is None:
raise ImproperlyConfigured("Required setting not found: {0}".format(setting_name))
return import_class(config_... | [
"def",
"import_settings_class",
"(",
"setting_name",
")",
":",
"config_value",
"=",
"getattr",
"(",
"settings",
",",
"setting_name",
")",
"if",
"config_value",
"is",
"None",
":",
"raise",
"ImproperlyConfigured",
"(",
"\"Required setting not found: {0}\"",
".",
"format... | Return the class pointed to be an app setting variable. | [
"Return",
"the",
"class",
"pointed",
"to",
"be",
"an",
"app",
"setting",
"variable",
"."
] | 5f93e5aa20f33a44133ad49fde4df0bfe1bc9f0b | https://github.com/django-fluent/django-fluent-utils/blob/5f93e5aa20f33a44133ad49fde4df0bfe1bc9f0b/fluent_utils/load.py#L24-L32 |
40,870 | django-fluent/django-fluent-utils | fluent_utils/load.py | import_class | def import_class(import_path, setting_name=None):
"""
Import a class by name.
"""
mod_name, class_name = import_path.rsplit('.', 1)
# import module
mod = import_module_or_none(mod_name)
if mod is not None:
# Loaded module, get attribute
try:
return getattr(mod, c... | python | def import_class(import_path, setting_name=None):
"""
Import a class by name.
"""
mod_name, class_name = import_path.rsplit('.', 1)
# import module
mod = import_module_or_none(mod_name)
if mod is not None:
# Loaded module, get attribute
try:
return getattr(mod, c... | [
"def",
"import_class",
"(",
"import_path",
",",
"setting_name",
"=",
"None",
")",
":",
"mod_name",
",",
"class_name",
"=",
"import_path",
".",
"rsplit",
"(",
"'.'",
",",
"1",
")",
"# import module",
"mod",
"=",
"import_module_or_none",
"(",
"mod_name",
")",
... | Import a class by name. | [
"Import",
"a",
"class",
"by",
"name",
"."
] | 5f93e5aa20f33a44133ad49fde4df0bfe1bc9f0b | https://github.com/django-fluent/django-fluent-utils/blob/5f93e5aa20f33a44133ad49fde4df0bfe1bc9f0b/fluent_utils/load.py#L35-L54 |
40,871 | django-fluent/django-fluent-utils | fluent_utils/load.py | import_module_or_none | def import_module_or_none(module_label):
"""
Imports the module with the given name.
Returns None if the module doesn't exist,
but it does propagates import errors in deeper modules.
"""
try:
# On Python 3, importlib has much more functionality compared to Python 2.
return impor... | python | def import_module_or_none(module_label):
"""
Imports the module with the given name.
Returns None if the module doesn't exist,
but it does propagates import errors in deeper modules.
"""
try:
# On Python 3, importlib has much more functionality compared to Python 2.
return impor... | [
"def",
"import_module_or_none",
"(",
"module_label",
")",
":",
"try",
":",
"# On Python 3, importlib has much more functionality compared to Python 2.",
"return",
"importlib",
".",
"import_module",
"(",
"module_label",
")",
"except",
"ImportError",
":",
"# Based on code from dj... | Imports the module with the given name.
Returns None if the module doesn't exist,
but it does propagates import errors in deeper modules. | [
"Imports",
"the",
"module",
"with",
"the",
"given",
"name",
"."
] | 5f93e5aa20f33a44133ad49fde4df0bfe1bc9f0b | https://github.com/django-fluent/django-fluent-utils/blob/5f93e5aa20f33a44133ad49fde4df0bfe1bc9f0b/fluent_utils/load.py#L70-L101 |
40,872 | mitgr81/flog | flog/flog.py | get_logger | def get_logger(name):
"""Gets a logger
Arguments:
name - the name you wish to log as
Returns:
A logger!
"""
logger = logging.getLogger(name)
logger.addHandler(logging.NullHandler())
return logger | python | def get_logger(name):
"""Gets a logger
Arguments:
name - the name you wish to log as
Returns:
A logger!
"""
logger = logging.getLogger(name)
logger.addHandler(logging.NullHandler())
return logger | [
"def",
"get_logger",
"(",
"name",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"name",
")",
"logger",
".",
"addHandler",
"(",
"logging",
".",
"NullHandler",
"(",
")",
")",
"return",
"logger"
] | Gets a logger
Arguments:
name - the name you wish to log as
Returns:
A logger! | [
"Gets",
"a",
"logger"
] | 4c86b98bcc083d6f86741024e2bcad5e94fc9b37 | https://github.com/mitgr81/flog/blob/4c86b98bcc083d6f86741024e2bcad5e94fc9b37/flog/flog.py#L26-L37 |
40,873 | MKLab-ITI/reveal-user-annotation | reveal_user_annotation/twitter/user_lookup.py | check_suspension | def check_suspension(user_twitter_id_list):
"""
Looks up a list of user ids and checks whether they are currently suspended.
Input: - user_twitter_id_list: A python list of Twitter user ids in integer format to be looked-up.
Outputs: - suspended_user_twitter_id_list: A python list of suspended Twitter... | python | def check_suspension(user_twitter_id_list):
"""
Looks up a list of user ids and checks whether they are currently suspended.
Input: - user_twitter_id_list: A python list of Twitter user ids in integer format to be looked-up.
Outputs: - suspended_user_twitter_id_list: A python list of suspended Twitter... | [
"def",
"check_suspension",
"(",
"user_twitter_id_list",
")",
":",
"####################################################################################################################",
"# Log into my application.",
"###################################################################################... | Looks up a list of user ids and checks whether they are currently suspended.
Input: - user_twitter_id_list: A python list of Twitter user ids in integer format to be looked-up.
Outputs: - suspended_user_twitter_id_list: A python list of suspended Twitter user ids in integer format.
- non_suspende... | [
"Looks",
"up",
"a",
"list",
"of",
"user",
"ids",
"and",
"checks",
"whether",
"they",
"are",
"currently",
"suspended",
"."
] | ed019c031857b091e5601f53ba3f01a499a0e3ef | https://github.com/MKLab-ITI/reveal-user-annotation/blob/ed019c031857b091e5601f53ba3f01a499a0e3ef/reveal_user_annotation/twitter/user_lookup.py#L12-L74 |
40,874 | andy29485/embypy | embypy/utils/connector.py | WebSocket.handler | async def handler(self):
'''Handle loop, get and process messages'''
self.ws = await websockets.connect(self.url, ssl=self.ssl)
while self.ws:
message = await self.ws.recv()
for handle in self.on_message:
if asyncio.iscoroutinefunction(handle):
await handle(self, message)
... | python | async def handler(self):
'''Handle loop, get and process messages'''
self.ws = await websockets.connect(self.url, ssl=self.ssl)
while self.ws:
message = await self.ws.recv()
for handle in self.on_message:
if asyncio.iscoroutinefunction(handle):
await handle(self, message)
... | [
"async",
"def",
"handler",
"(",
"self",
")",
":",
"self",
".",
"ws",
"=",
"await",
"websockets",
".",
"connect",
"(",
"self",
".",
"url",
",",
"ssl",
"=",
"self",
".",
"ssl",
")",
"while",
"self",
".",
"ws",
":",
"message",
"=",
"await",
"self",
... | Handle loop, get and process messages | [
"Handle",
"loop",
"get",
"and",
"process",
"messages"
] | cde658d380965caaf4789d4d182d045b0346797b | https://github.com/andy29485/embypy/blob/cde658d380965caaf4789d4d182d045b0346797b/embypy/utils/connector.py#L39-L48 |
40,875 | andy29485/embypy | embypy/utils/connector.py | Connector.get_url | def get_url(self, path='/', websocket=False, remote=True,
attach_api_key=True, userId=None, pass_uid=False, **query):
'''construct a url for an emby request
Parameters
----------
path : str
uri path(excluding domain and port) of get request for emby
websocket : bool, optional
... | python | def get_url(self, path='/', websocket=False, remote=True,
attach_api_key=True, userId=None, pass_uid=False, **query):
'''construct a url for an emby request
Parameters
----------
path : str
uri path(excluding domain and port) of get request for emby
websocket : bool, optional
... | [
"def",
"get_url",
"(",
"self",
",",
"path",
"=",
"'/'",
",",
"websocket",
"=",
"False",
",",
"remote",
"=",
"True",
",",
"attach_api_key",
"=",
"True",
",",
"userId",
"=",
"None",
",",
"pass_uid",
"=",
"False",
",",
"*",
"*",
"query",
")",
":",
"us... | construct a url for an emby request
Parameters
----------
path : str
uri path(excluding domain and port) of get request for emby
websocket : bool, optional
if true, then `ws(s)` are used instead of `http(s)`
remote : bool, optional
if true, remote-address is used (default True)
... | [
"construct",
"a",
"url",
"for",
"an",
"emby",
"request"
] | cde658d380965caaf4789d4d182d045b0346797b | https://github.com/andy29485/embypy/blob/cde658d380965caaf4789d4d182d045b0346797b/embypy/utils/connector.py#L201-L257 |
40,876 | andy29485/embypy | embypy/utils/connector.py | Connector.get | async def get(self, path, **query):
'''return a get request
Parameters
----------
path : str
same as get_url
query : kargs dict
additional info to pass to get_url
See Also
--------
get_url :
getJson :
Returns
-------
requests.models.Response
the r... | python | async def get(self, path, **query):
'''return a get request
Parameters
----------
path : str
same as get_url
query : kargs dict
additional info to pass to get_url
See Also
--------
get_url :
getJson :
Returns
-------
requests.models.Response
the r... | [
"async",
"def",
"get",
"(",
"self",
",",
"path",
",",
"*",
"*",
"query",
")",
":",
"url",
"=",
"self",
".",
"get_url",
"(",
"path",
",",
"*",
"*",
"query",
")",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"tries",
"+",
"1",
")",
":",
"try",
... | return a get request
Parameters
----------
path : str
same as get_url
query : kargs dict
additional info to pass to get_url
See Also
--------
get_url :
getJson :
Returns
-------
requests.models.Response
the response that was given | [
"return",
"a",
"get",
"request"
] | cde658d380965caaf4789d4d182d045b0346797b | https://github.com/andy29485/embypy/blob/cde658d380965caaf4789d4d182d045b0346797b/embypy/utils/connector.py#L270-L303 |
40,877 | andy29485/embypy | embypy/utils/connector.py | Connector.post | async def post(self, path, data={}, send_raw=False, **params):
'''sends post request
Parameters
----------
path : str
same as get_url
query : kargs dict
additional info to pass to get_url
See Also
--------
get_url :
Returns
-------
requests.models.Response
... | python | async def post(self, path, data={}, send_raw=False, **params):
'''sends post request
Parameters
----------
path : str
same as get_url
query : kargs dict
additional info to pass to get_url
See Also
--------
get_url :
Returns
-------
requests.models.Response
... | [
"async",
"def",
"post",
"(",
"self",
",",
"path",
",",
"data",
"=",
"{",
"}",
",",
"send_raw",
"=",
"False",
",",
"*",
"*",
"params",
")",
":",
"url",
"=",
"self",
".",
"get_url",
"(",
"path",
",",
"*",
"*",
"params",
")",
"jstr",
"=",
"json",
... | sends post request
Parameters
----------
path : str
same as get_url
query : kargs dict
additional info to pass to get_url
See Also
--------
get_url :
Returns
-------
requests.models.Response
the response that was given | [
"sends",
"post",
"request"
] | cde658d380965caaf4789d4d182d045b0346797b | https://github.com/andy29485/embypy/blob/cde658d380965caaf4789d4d182d045b0346797b/embypy/utils/connector.py#L339-L375 |
40,878 | andy29485/embypy | embypy/utils/connector.py | Connector.getJson | async def getJson(self, path, **query):
'''wrapper for get, parses response as json
Parameters
----------
path : str
same as get_url
query : kargs dict
additional info to pass to get_url
See Also
--------
get_url :
get :
Returns
-------
dict
the r... | python | async def getJson(self, path, **query):
'''wrapper for get, parses response as json
Parameters
----------
path : str
same as get_url
query : kargs dict
additional info to pass to get_url
See Also
--------
get_url :
get :
Returns
-------
dict
the r... | [
"async",
"def",
"getJson",
"(",
"self",
",",
"path",
",",
"*",
"*",
"query",
")",
":",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"tries",
"+",
"1",
")",
":",
"try",
":",
"return",
"await",
"(",
"await",
"self",
".",
"get",
"(",
"path",
",",
... | wrapper for get, parses response as json
Parameters
----------
path : str
same as get_url
query : kargs dict
additional info to pass to get_url
See Also
--------
get_url :
get :
Returns
-------
dict
the response content as a dict | [
"wrapper",
"for",
"get",
"parses",
"response",
"as",
"json"
] | cde658d380965caaf4789d4d182d045b0346797b | https://github.com/andy29485/embypy/blob/cde658d380965caaf4789d4d182d045b0346797b/embypy/utils/connector.py#L378-L403 |
40,879 | limix/geno-sugar | geno_sugar/preprocess.py | standardize | def standardize():
"""
return variant standarize function
"""
def f(G, bim):
G_out = standardize_snps(G)
return G_out, bim
return f | python | def standardize():
"""
return variant standarize function
"""
def f(G, bim):
G_out = standardize_snps(G)
return G_out, bim
return f | [
"def",
"standardize",
"(",
")",
":",
"def",
"f",
"(",
"G",
",",
"bim",
")",
":",
"G_out",
"=",
"standardize_snps",
"(",
"G",
")",
"return",
"G_out",
",",
"bim",
"return",
"f"
] | return variant standarize function | [
"return",
"variant",
"standarize",
"function"
] | 76754e6f103a1fe9883e94ec3993ff7f76e29e2f | https://github.com/limix/geno-sugar/blob/76754e6f103a1fe9883e94ec3993ff7f76e29e2f/geno_sugar/preprocess.py#L37-L46 |
40,880 | limix/geno-sugar | geno_sugar/preprocess.py | impute | def impute(imputer):
"""
return impute function
"""
def f(G, bim):
return imputer.fit_transform(G), bim
return f | python | def impute(imputer):
"""
return impute function
"""
def f(G, bim):
return imputer.fit_transform(G), bim
return f | [
"def",
"impute",
"(",
"imputer",
")",
":",
"def",
"f",
"(",
"G",
",",
"bim",
")",
":",
"return",
"imputer",
".",
"fit_transform",
"(",
"G",
")",
",",
"bim",
"return",
"f"
] | return impute function | [
"return",
"impute",
"function"
] | 76754e6f103a1fe9883e94ec3993ff7f76e29e2f | https://github.com/limix/geno-sugar/blob/76754e6f103a1fe9883e94ec3993ff7f76e29e2f/geno_sugar/preprocess.py#L49-L57 |
40,881 | limix/geno-sugar | geno_sugar/preprocess.py | compose | def compose(func_list):
"""
composion of preprocessing functions
"""
def f(G, bim):
for func in func_list:
G, bim = func(G, bim)
return G, bim
return f | python | def compose(func_list):
"""
composion of preprocessing functions
"""
def f(G, bim):
for func in func_list:
G, bim = func(G, bim)
return G, bim
return f | [
"def",
"compose",
"(",
"func_list",
")",
":",
"def",
"f",
"(",
"G",
",",
"bim",
")",
":",
"for",
"func",
"in",
"func_list",
":",
"G",
",",
"bim",
"=",
"func",
"(",
"G",
",",
"bim",
")",
"return",
"G",
",",
"bim",
"return",
"f"
] | composion of preprocessing functions | [
"composion",
"of",
"preprocessing",
"functions"
] | 76754e6f103a1fe9883e94ec3993ff7f76e29e2f | https://github.com/limix/geno-sugar/blob/76754e6f103a1fe9883e94ec3993ff7f76e29e2f/geno_sugar/preprocess.py#L60-L70 |
40,882 | grimwm/py-dictobj | dictobj.py | DictionaryObject.asdict | def asdict(self):
"""
Copy the data back out of here and into a dict. Then return it.
Some libraries may check specifically for dict objects, such
as the json library; so, this makes it convenient to get the data
back out.
>>> import dictobj
>>> d = {'a':1, 'b':2}
>>> dictobj.Dictionar... | python | def asdict(self):
"""
Copy the data back out of here and into a dict. Then return it.
Some libraries may check specifically for dict objects, such
as the json library; so, this makes it convenient to get the data
back out.
>>> import dictobj
>>> d = {'a':1, 'b':2}
>>> dictobj.Dictionar... | [
"def",
"asdict",
"(",
"self",
")",
":",
"items",
"=",
"{",
"}",
"for",
"name",
"in",
"self",
".",
"_items",
":",
"value",
"=",
"self",
".",
"_items",
"[",
"name",
"]",
"if",
"isinstance",
"(",
"value",
",",
"DictionaryObject",
")",
":",
"items",
"[... | Copy the data back out of here and into a dict. Then return it.
Some libraries may check specifically for dict objects, such
as the json library; so, this makes it convenient to get the data
back out.
>>> import dictobj
>>> d = {'a':1, 'b':2}
>>> dictobj.DictionaryObject(d).asdict() == d
T... | [
"Copy",
"the",
"data",
"back",
"out",
"of",
"here",
"and",
"into",
"a",
"dict",
".",
"Then",
"return",
"it",
".",
"Some",
"libraries",
"may",
"check",
"specifically",
"for",
"dict",
"objects",
"such",
"as",
"the",
"json",
"library",
";",
"so",
"this",
... | d825014e3991a14313e6b4dda65d6a892db3033f | https://github.com/grimwm/py-dictobj/blob/d825014e3991a14313e6b4dda65d6a892db3033f/dictobj.py#L176-L198 |
40,883 | seancallaway/laughs | laughs/laughs.py | get_joke | def get_joke():
"""Return a jokes from one of the random services."""
joke = None
while joke is None:
service_num = randint(1, NUM_SERVICES)
joke = load_joke(service_num)
return joke | python | def get_joke():
"""Return a jokes from one of the random services."""
joke = None
while joke is None:
service_num = randint(1, NUM_SERVICES)
joke = load_joke(service_num)
return joke | [
"def",
"get_joke",
"(",
")",
":",
"joke",
"=",
"None",
"while",
"joke",
"is",
"None",
":",
"service_num",
"=",
"randint",
"(",
"1",
",",
"NUM_SERVICES",
")",
"joke",
"=",
"load_joke",
"(",
"service_num",
")",
"return",
"joke"
] | Return a jokes from one of the random services. | [
"Return",
"a",
"jokes",
"from",
"one",
"of",
"the",
"random",
"services",
"."
] | e13ca6f16b12401b0384bbf1fea86c081e52143d | https://github.com/seancallaway/laughs/blob/e13ca6f16b12401b0384bbf1fea86c081e52143d/laughs/laughs.py#L16-L23 |
40,884 | seancallaway/laughs | laughs/laughs.py | load_joke | def load_joke(service_num=1):
"""Pulls the joke from the service based on the argument.
It is expected that all services used will return a string
when successful or None otherwise.
"""
result = {
1 : ronswanson.get_joke(),
2 : chucknorris.get_joke(),
3 : catfacts.get_joke(),
... | python | def load_joke(service_num=1):
"""Pulls the joke from the service based on the argument.
It is expected that all services used will return a string
when successful or None otherwise.
"""
result = {
1 : ronswanson.get_joke(),
2 : chucknorris.get_joke(),
3 : catfacts.get_joke(),
... | [
"def",
"load_joke",
"(",
"service_num",
"=",
"1",
")",
":",
"result",
"=",
"{",
"1",
":",
"ronswanson",
".",
"get_joke",
"(",
")",
",",
"2",
":",
"chucknorris",
".",
"get_joke",
"(",
")",
",",
"3",
":",
"catfacts",
".",
"get_joke",
"(",
")",
",",
... | Pulls the joke from the service based on the argument.
It is expected that all services used will return a string
when successful or None otherwise. | [
"Pulls",
"the",
"joke",
"from",
"the",
"service",
"based",
"on",
"the",
"argument",
".",
"It",
"is",
"expected",
"that",
"all",
"services",
"used",
"will",
"return",
"a",
"string",
"when",
"successful",
"or",
"None",
"otherwise",
"."
] | e13ca6f16b12401b0384bbf1fea86c081e52143d | https://github.com/seancallaway/laughs/blob/e13ca6f16b12401b0384bbf1fea86c081e52143d/laughs/laughs.py#L26-L39 |
40,885 | brews/snakebacon | snakebacon/records.py | read_14c | def read_14c(fl):
"""Create CalibCurve instance from Bacon curve file
"""
indata = pd.read_csv(fl, index_col=None, skiprows=11, header=None,
names=['calbp', 'c14age', 'error', 'delta14c', 'sigma'])
outcurve = CalibCurve(calbp=indata['calbp'],
c14age=ind... | python | def read_14c(fl):
"""Create CalibCurve instance from Bacon curve file
"""
indata = pd.read_csv(fl, index_col=None, skiprows=11, header=None,
names=['calbp', 'c14age', 'error', 'delta14c', 'sigma'])
outcurve = CalibCurve(calbp=indata['calbp'],
c14age=ind... | [
"def",
"read_14c",
"(",
"fl",
")",
":",
"indata",
"=",
"pd",
".",
"read_csv",
"(",
"fl",
",",
"index_col",
"=",
"None",
",",
"skiprows",
"=",
"11",
",",
"header",
"=",
"None",
",",
"names",
"=",
"[",
"'calbp'",
",",
"'c14age'",
",",
"'error'",
",",... | Create CalibCurve instance from Bacon curve file | [
"Create",
"CalibCurve",
"instance",
"from",
"Bacon",
"curve",
"file"
] | f5363d0d1225912adc30031bf2c13b54000de8f2 | https://github.com/brews/snakebacon/blob/f5363d0d1225912adc30031bf2c13b54000de8f2/snakebacon/records.py#L14-L24 |
40,886 | brews/snakebacon | snakebacon/records.py | read_chron | def read_chron(fl):
"""Create ChronRecord instance from Bacon file
"""
indata = pd.read_csv(fl, sep=r'\s*\,\s*', index_col=None, engine='python')
outcore = ChronRecord(age=indata['age'],
error=indata['error'],
depth=indata['depth'],
... | python | def read_chron(fl):
"""Create ChronRecord instance from Bacon file
"""
indata = pd.read_csv(fl, sep=r'\s*\,\s*', index_col=None, engine='python')
outcore = ChronRecord(age=indata['age'],
error=indata['error'],
depth=indata['depth'],
... | [
"def",
"read_chron",
"(",
"fl",
")",
":",
"indata",
"=",
"pd",
".",
"read_csv",
"(",
"fl",
",",
"sep",
"=",
"r'\\s*\\,\\s*'",
",",
"index_col",
"=",
"None",
",",
"engine",
"=",
"'python'",
")",
"outcore",
"=",
"ChronRecord",
"(",
"age",
"=",
"indata",
... | Create ChronRecord instance from Bacon file | [
"Create",
"ChronRecord",
"instance",
"from",
"Bacon",
"file"
] | f5363d0d1225912adc30031bf2c13b54000de8f2 | https://github.com/brews/snakebacon/blob/f5363d0d1225912adc30031bf2c13b54000de8f2/snakebacon/records.py#L27-L35 |
40,887 | brews/snakebacon | snakebacon/records.py | read_proxy | def read_proxy(fl):
"""Read a file to create a proxy record instance
"""
outcore = ProxyRecord(data=pd.read_csv(fl, sep=r'\s*\,\s*', index_col=None, engine='python'))
return outcore | python | def read_proxy(fl):
"""Read a file to create a proxy record instance
"""
outcore = ProxyRecord(data=pd.read_csv(fl, sep=r'\s*\,\s*', index_col=None, engine='python'))
return outcore | [
"def",
"read_proxy",
"(",
"fl",
")",
":",
"outcore",
"=",
"ProxyRecord",
"(",
"data",
"=",
"pd",
".",
"read_csv",
"(",
"fl",
",",
"sep",
"=",
"r'\\s*\\,\\s*'",
",",
"index_col",
"=",
"None",
",",
"engine",
"=",
"'python'",
")",
")",
"return",
"outcore"... | Read a file to create a proxy record instance | [
"Read",
"a",
"file",
"to",
"create",
"a",
"proxy",
"record",
"instance"
] | f5363d0d1225912adc30031bf2c13b54000de8f2 | https://github.com/brews/snakebacon/blob/f5363d0d1225912adc30031bf2c13b54000de8f2/snakebacon/records.py#L38-L42 |
40,888 | brews/snakebacon | snakebacon/records.py | DatedProxyRecord.to_pandas | def to_pandas(self):
"""Convert record to pandas.DataFrame"""
agedepthdf = pd.DataFrame(self.age, index=self.data.depth)
agedepthdf.columns = list(range(self.n_members()))
out = (agedepthdf.join(self.data.set_index('depth'))
.reset_index()
.melt(id_vars=self... | python | def to_pandas(self):
"""Convert record to pandas.DataFrame"""
agedepthdf = pd.DataFrame(self.age, index=self.data.depth)
agedepthdf.columns = list(range(self.n_members()))
out = (agedepthdf.join(self.data.set_index('depth'))
.reset_index()
.melt(id_vars=self... | [
"def",
"to_pandas",
"(",
"self",
")",
":",
"agedepthdf",
"=",
"pd",
".",
"DataFrame",
"(",
"self",
".",
"age",
",",
"index",
"=",
"self",
".",
"data",
".",
"depth",
")",
"agedepthdf",
".",
"columns",
"=",
"list",
"(",
"range",
"(",
"self",
".",
"n_... | Convert record to pandas.DataFrame | [
"Convert",
"record",
"to",
"pandas",
".",
"DataFrame"
] | f5363d0d1225912adc30031bf2c13b54000de8f2 | https://github.com/brews/snakebacon/blob/f5363d0d1225912adc30031bf2c13b54000de8f2/snakebacon/records.py#L89-L99 |
40,889 | ktdreyer/treq-kerberos | treq_kerberos/__init__.py | negotiate_header | def negotiate_header(url):
"""
Return the "Authorization" HTTP header value to use for this URL.
"""
hostname = urlparse(url).hostname
_, krb_context = kerberos.authGSSClientInit('HTTP@%s' % hostname)
# authGSSClientStep goes over the network to the KDC (ie blocking).
yield threads.deferToTh... | python | def negotiate_header(url):
"""
Return the "Authorization" HTTP header value to use for this URL.
"""
hostname = urlparse(url).hostname
_, krb_context = kerberos.authGSSClientInit('HTTP@%s' % hostname)
# authGSSClientStep goes over the network to the KDC (ie blocking).
yield threads.deferToTh... | [
"def",
"negotiate_header",
"(",
"url",
")",
":",
"hostname",
"=",
"urlparse",
"(",
"url",
")",
".",
"hostname",
"_",
",",
"krb_context",
"=",
"kerberos",
".",
"authGSSClientInit",
"(",
"'HTTP@%s'",
"%",
"hostname",
")",
"# authGSSClientStep goes over the network t... | Return the "Authorization" HTTP header value to use for this URL. | [
"Return",
"the",
"Authorization",
"HTTP",
"header",
"value",
"to",
"use",
"for",
"this",
"URL",
"."
] | 8331867cf2bade6b4f9d6d7035b72679c4eafc28 | https://github.com/ktdreyer/treq-kerberos/blob/8331867cf2bade6b4f9d6d7035b72679c4eafc28/treq_kerberos/__init__.py#L73-L83 |
40,890 | openspending/ckanext-budgets | ckanext/budgets/lib/budgetdatapackage.py | BudgetDataPackage._get_specification | def _get_specification(self, specification):
"""
Read the specification provided. It can either be a url or a file
location.
"""
result = six.moves.urllib.parse.urlparse(specification)
# If the specification has an http or an https scheme we can
# retrieve it via... | python | def _get_specification(self, specification):
"""
Read the specification provided. It can either be a url or a file
location.
"""
result = six.moves.urllib.parse.urlparse(specification)
# If the specification has an http or an https scheme we can
# retrieve it via... | [
"def",
"_get_specification",
"(",
"self",
",",
"specification",
")",
":",
"result",
"=",
"six",
".",
"moves",
".",
"urllib",
".",
"parse",
".",
"urlparse",
"(",
"specification",
")",
"# If the specification has an http or an https scheme we can",
"# retrieve it via an H... | Read the specification provided. It can either be a url or a file
location. | [
"Read",
"the",
"specification",
"provided",
".",
"It",
"can",
"either",
"be",
"a",
"url",
"or",
"a",
"file",
"location",
"."
] | 07dde5a4fdec6b36ceb812b70f0c31cdecb40cfc | https://github.com/openspending/ckanext-budgets/blob/07dde5a4fdec6b36ceb812b70f0c31cdecb40cfc/ckanext/budgets/lib/budgetdatapackage.py#L25-L42 |
40,891 | openspending/ckanext-budgets | ckanext/budgets/lib/budgetdatapackage.py | BudgetDataPackage._get_headers | def _get_headers(self, resource):
"""
Get CSV file headers from the provided resource.
"""
# If the resource is a file we just open it up with the csv
# reader (after being sure we're reading from the beginning
# of the file
if type(resource) == file:
... | python | def _get_headers(self, resource):
"""
Get CSV file headers from the provided resource.
"""
# If the resource is a file we just open it up with the csv
# reader (after being sure we're reading from the beginning
# of the file
if type(resource) == file:
... | [
"def",
"_get_headers",
"(",
"self",
",",
"resource",
")",
":",
"# If the resource is a file we just open it up with the csv",
"# reader (after being sure we're reading from the beginning",
"# of the file",
"if",
"type",
"(",
"resource",
")",
"==",
"file",
":",
"resource",
"."... | Get CSV file headers from the provided resource. | [
"Get",
"CSV",
"file",
"headers",
"from",
"the",
"provided",
"resource",
"."
] | 07dde5a4fdec6b36ceb812b70f0c31cdecb40cfc | https://github.com/openspending/ckanext-budgets/blob/07dde5a4fdec6b36ceb812b70f0c31cdecb40cfc/ckanext/budgets/lib/budgetdatapackage.py#L44-L77 |
40,892 | openspending/ckanext-budgets | ckanext/budgets/lib/budgetdatapackage.py | BudgetDataPackage.schema | def schema(self):
"""
The generated budget data package schema for this resource.
If the resource has any fields that do not conform to the
provided specification this will raise a
NotABudgetDataPackageException.
"""
if self.headers is None:
raise exc... | python | def schema(self):
"""
The generated budget data package schema for this resource.
If the resource has any fields that do not conform to the
provided specification this will raise a
NotABudgetDataPackageException.
"""
if self.headers is None:
raise exc... | [
"def",
"schema",
"(",
"self",
")",
":",
"if",
"self",
".",
"headers",
"is",
"None",
":",
"raise",
"exceptions",
".",
"NoResourceLoadedException",
"(",
"'Resource must be loaded to find schema'",
")",
"try",
":",
"fields",
"=",
"self",
".",
"specification",
".",
... | The generated budget data package schema for this resource.
If the resource has any fields that do not conform to the
provided specification this will raise a
NotABudgetDataPackageException. | [
"The",
"generated",
"budget",
"data",
"package",
"schema",
"for",
"this",
"resource",
".",
"If",
"the",
"resource",
"has",
"any",
"fields",
"that",
"do",
"not",
"conform",
"to",
"the",
"provided",
"specification",
"this",
"will",
"raise",
"a",
"NotABudgetDataP... | 07dde5a4fdec6b36ceb812b70f0c31cdecb40cfc | https://github.com/openspending/ckanext-budgets/blob/07dde5a4fdec6b36ceb812b70f0c31cdecb40cfc/ckanext/budgets/lib/budgetdatapackage.py#L95-L119 |
40,893 | RI-imaging/qpformat | qpformat/file_formats/single_tif_phasics.py | SingleTifPhasics.get_time | def get_time(self, idx=0):
"""Return the time of the tif data since the epoch
The time is stored in the "61238" tag.
"""
timestr = SingleTifPhasics._get_meta_data(path=self.path,
section="acquisition info",
... | python | def get_time(self, idx=0):
"""Return the time of the tif data since the epoch
The time is stored in the "61238" tag.
"""
timestr = SingleTifPhasics._get_meta_data(path=self.path,
section="acquisition info",
... | [
"def",
"get_time",
"(",
"self",
",",
"idx",
"=",
"0",
")",
":",
"timestr",
"=",
"SingleTifPhasics",
".",
"_get_meta_data",
"(",
"path",
"=",
"self",
".",
"path",
",",
"section",
"=",
"\"acquisition info\"",
",",
"name",
"=",
"\"date & heure\"",
")",
"if",
... | Return the time of the tif data since the epoch
The time is stored in the "61238" tag. | [
"Return",
"the",
"time",
"of",
"the",
"tif",
"data",
"since",
"the",
"epoch"
] | 364e29d7d9e8b9f1d7a4a25c753d1baf9d73d5eb | https://github.com/RI-imaging/qpformat/blob/364e29d7d9e8b9f1d7a4a25c753d1baf9d73d5eb/qpformat/file_formats/single_tif_phasics.py#L95-L113 |
40,894 | calmjs/nunja | src/nunja/registry.py | MoldRegistry._generate_and_store_mold_id_map | def _generate_and_store_mold_id_map(self, template_map, molds):
"""
Not a pure generator expression as this has the side effect of
storing the resulting id and map it into a local dict. Produces
a list of all valid mold_ids from the input template_keys.
Internal function; NOT m... | python | def _generate_and_store_mold_id_map(self, template_map, molds):
"""
Not a pure generator expression as this has the side effect of
storing the resulting id and map it into a local dict. Produces
a list of all valid mold_ids from the input template_keys.
Internal function; NOT m... | [
"def",
"_generate_and_store_mold_id_map",
"(",
"self",
",",
"template_map",
",",
"molds",
")",
":",
"name",
"=",
"self",
".",
"req_tmpl_name",
"for",
"key",
"in",
"sorted",
"(",
"template_map",
".",
"keys",
"(",
")",
",",
"reverse",
"=",
"True",
")",
":",
... | Not a pure generator expression as this has the side effect of
storing the resulting id and map it into a local dict. Produces
a list of all valid mold_ids from the input template_keys.
Internal function; NOT meant to be used outside of this class. | [
"Not",
"a",
"pure",
"generator",
"expression",
"as",
"this",
"has",
"the",
"side",
"effect",
"of",
"storing",
"the",
"resulting",
"id",
"and",
"map",
"it",
"into",
"a",
"local",
"dict",
".",
"Produces",
"a",
"list",
"of",
"all",
"valid",
"mold_ids",
"fro... | 37ba114ca2239322718fd9994bb078c037682c33 | https://github.com/calmjs/nunja/blob/37ba114ca2239322718fd9994bb078c037682c33/src/nunja/registry.py#L134-L148 |
40,895 | calmjs/nunja | src/nunja/registry.py | MoldRegistry.mold_id_to_path | def mold_id_to_path(self, mold_id, default=_marker):
"""
Lookup the filesystem path of a mold identifier.
"""
def handle_default(debug_msg=None):
if debug_msg:
logger.debug('mold_id_to_path:' + debug_msg, mold_id)
if default is _marker:
... | python | def mold_id_to_path(self, mold_id, default=_marker):
"""
Lookup the filesystem path of a mold identifier.
"""
def handle_default(debug_msg=None):
if debug_msg:
logger.debug('mold_id_to_path:' + debug_msg, mold_id)
if default is _marker:
... | [
"def",
"mold_id_to_path",
"(",
"self",
",",
"mold_id",
",",
"default",
"=",
"_marker",
")",
":",
"def",
"handle_default",
"(",
"debug_msg",
"=",
"None",
")",
":",
"if",
"debug_msg",
":",
"logger",
".",
"debug",
"(",
"'mold_id_to_path:'",
"+",
"debug_msg",
... | Lookup the filesystem path of a mold identifier. | [
"Lookup",
"the",
"filesystem",
"path",
"of",
"a",
"mold",
"identifier",
"."
] | 37ba114ca2239322718fd9994bb078c037682c33 | https://github.com/calmjs/nunja/blob/37ba114ca2239322718fd9994bb078c037682c33/src/nunja/registry.py#L204-L233 |
40,896 | calmjs/nunja | src/nunja/registry.py | MoldRegistry.lookup_path | def lookup_path(self, mold_id_path, default=_marker):
"""
For the given mold_id_path, look up the mold_id and translate
that path to its filesystem equivalent.
"""
fragments = mold_id_path.split('/')
mold_id = '/'.join(fragments[:2])
try:
subpath = []... | python | def lookup_path(self, mold_id_path, default=_marker):
"""
For the given mold_id_path, look up the mold_id and translate
that path to its filesystem equivalent.
"""
fragments = mold_id_path.split('/')
mold_id = '/'.join(fragments[:2])
try:
subpath = []... | [
"def",
"lookup_path",
"(",
"self",
",",
"mold_id_path",
",",
"default",
"=",
"_marker",
")",
":",
"fragments",
"=",
"mold_id_path",
".",
"split",
"(",
"'/'",
")",
"mold_id",
"=",
"'/'",
".",
"join",
"(",
"fragments",
"[",
":",
"2",
"]",
")",
"try",
"... | For the given mold_id_path, look up the mold_id and translate
that path to its filesystem equivalent. | [
"For",
"the",
"given",
"mold_id_path",
"look",
"up",
"the",
"mold_id",
"and",
"translate",
"that",
"path",
"to",
"its",
"filesystem",
"equivalent",
"."
] | 37ba114ca2239322718fd9994bb078c037682c33 | https://github.com/calmjs/nunja/blob/37ba114ca2239322718fd9994bb078c037682c33/src/nunja/registry.py#L235-L257 |
40,897 | calmjs/nunja | src/nunja/registry.py | MoldRegistry.verify_path | def verify_path(self, mold_id_path):
"""
Lookup and verify path.
"""
try:
path = self.lookup_path(mold_id_path)
if not exists(path):
raise KeyError
except KeyError:
raise_os_error(ENOENT)
return path | python | def verify_path(self, mold_id_path):
"""
Lookup and verify path.
"""
try:
path = self.lookup_path(mold_id_path)
if not exists(path):
raise KeyError
except KeyError:
raise_os_error(ENOENT)
return path | [
"def",
"verify_path",
"(",
"self",
",",
"mold_id_path",
")",
":",
"try",
":",
"path",
"=",
"self",
".",
"lookup_path",
"(",
"mold_id_path",
")",
"if",
"not",
"exists",
"(",
"path",
")",
":",
"raise",
"KeyError",
"except",
"KeyError",
":",
"raise_os_error",... | Lookup and verify path. | [
"Lookup",
"and",
"verify",
"path",
"."
] | 37ba114ca2239322718fd9994bb078c037682c33 | https://github.com/calmjs/nunja/blob/37ba114ca2239322718fd9994bb078c037682c33/src/nunja/registry.py#L260-L271 |
40,898 | hatemile/hatemile-for-python | hatemile/implementation/navig.py | AccessibleNavigationImplementation._get_skippers | def _get_skippers(configure, file_name=None):
"""
Returns the skippers of configuration.
:param configure: The configuration of HaTeMiLe.
:type configure: hatemile.util.configure.Configure
:param file_name: The file path of skippers configuration.
:type file_name: str
... | python | def _get_skippers(configure, file_name=None):
"""
Returns the skippers of configuration.
:param configure: The configuration of HaTeMiLe.
:type configure: hatemile.util.configure.Configure
:param file_name: The file path of skippers configuration.
:type file_name: str
... | [
"def",
"_get_skippers",
"(",
"configure",
",",
"file_name",
"=",
"None",
")",
":",
"skippers",
"=",
"[",
"]",
"if",
"file_name",
"is",
"None",
":",
"file_name",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
... | Returns the skippers of configuration.
:param configure: The configuration of HaTeMiLe.
:type configure: hatemile.util.configure.Configure
:param file_name: The file path of skippers configuration.
:type file_name: str
:return: The skippers of configuration.
:rtype: list... | [
"Returns",
"the",
"skippers",
"of",
"configuration",
"."
] | 1e914f9aa09f6f8d78282af131311546ecba9fb8 | https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/navig.py#L134-L163 |
40,899 | hatemile/hatemile-for-python | hatemile/implementation/navig.py | AccessibleNavigationImplementation._generate_list_skippers | def _generate_list_skippers(self):
"""
Generate the list of skippers of page.
:return: The list of skippers of page.
:rtype: hatemile.util.html.htmldomelement.HTMLDOMElement
"""
container = self.parser.find(
'#'
+ AccessibleNavigationImplementati... | python | def _generate_list_skippers(self):
"""
Generate the list of skippers of page.
:return: The list of skippers of page.
:rtype: hatemile.util.html.htmldomelement.HTMLDOMElement
"""
container = self.parser.find(
'#'
+ AccessibleNavigationImplementati... | [
"def",
"_generate_list_skippers",
"(",
"self",
")",
":",
"container",
"=",
"self",
".",
"parser",
".",
"find",
"(",
"'#'",
"+",
"AccessibleNavigationImplementation",
".",
"ID_CONTAINER_SKIPPERS",
")",
".",
"first_result",
"(",
")",
"html_list",
"=",
"None",
"if"... | Generate the list of skippers of page.
:return: The list of skippers of page.
:rtype: hatemile.util.html.htmldomelement.HTMLDOMElement | [
"Generate",
"the",
"list",
"of",
"skippers",
"of",
"page",
"."
] | 1e914f9aa09f6f8d78282af131311546ecba9fb8 | https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/navig.py#L165-L196 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.