nwo stringlengths 5 106 | sha stringlengths 40 40 | path stringlengths 4 174 | language stringclasses 1
value | identifier stringlengths 1 140 | parameters stringlengths 0 87.7k | argument_list stringclasses 1
value | return_statement stringlengths 0 426k | docstring stringlengths 0 64.3k | docstring_summary stringlengths 0 26.3k | docstring_tokens list | function stringlengths 18 4.83M | function_tokens list | url stringlengths 83 304 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ospalh/anki-addons | 4ece13423bd541e29d9b40ebe26ca0999a6962b1 | add_kanji_embeds.py | python | kanji_svg_rest | (txt, *args) | return kanji_svg_var(txt, show_rest=True) | Copy the variant kanji.
... | Copy the variant kanji. | [
"Copy",
"the",
"variant",
"kanji",
"."
] | def kanji_svg_rest(txt, *args):
"""
Copy the variant kanji.
...
"""
return kanji_svg_var(txt, show_rest=True) | [
"def",
"kanji_svg_rest",
"(",
"txt",
",",
"*",
"args",
")",
":",
"return",
"kanji_svg_var",
"(",
"txt",
",",
"show_rest",
"=",
"True",
")"
] | https://github.com/ospalh/anki-addons/blob/4ece13423bd541e29d9b40ebe26ca0999a6962b1/add_kanji_embeds.py#L117-L123 | |
yuxiaokui/Intranet-Penetration | f57678a204840c83cbf3308e3470ae56c5ff514b | proxy/XX-Net/code/default/python27/1.0/lib/logging/__init__.py | python | debug | (msg, *args, **kwargs) | Log a message with severity 'DEBUG' on the root logger. | Log a message with severity 'DEBUG' on the root logger. | [
"Log",
"a",
"message",
"with",
"severity",
"DEBUG",
"on",
"the",
"root",
"logger",
"."
] | def debug(msg, *args, **kwargs):
"""
Log a message with severity 'DEBUG' on the root logger.
"""
if len(root.handlers) == 0:
basicConfig()
root.debug(msg, *args, **kwargs) | [
"def",
"debug",
"(",
"msg",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"len",
"(",
"root",
".",
"handlers",
")",
"==",
"0",
":",
"basicConfig",
"(",
")",
"root",
".",
"debug",
"(",
"msg",
",",
"*",
"args",
",",
"*",
"*",
"kwar... | https://github.com/yuxiaokui/Intranet-Penetration/blob/f57678a204840c83cbf3308e3470ae56c5ff514b/proxy/XX-Net/code/default/python27/1.0/lib/logging/__init__.py#L1623-L1629 | ||
xgi/castero | 766965fb1d3586d62ab6fd6dd144fa510c1e0ecb | castero/perspectives/primaryperspective.py | python | PrimaryPerspective.display | (self) | Draws all windows and sub-features, including titles and borders. | Draws all windows and sub-features, including titles and borders. | [
"Draws",
"all",
"windows",
"and",
"sub",
"-",
"features",
"including",
"titles",
"and",
"borders",
"."
] | def display(self) -> None:
"""Draws all windows and sub-features, including titles and borders."""
# clear dynamic menu headers
self._feed_window.addstr(0, 0, " " * self._feed_window.getmaxyx()[1])
self._episode_window.addstr(0, 0, " " * self._episode_window.getmaxyx()[1])
# add... | [
"def",
"display",
"(",
"self",
")",
"->",
"None",
":",
"# clear dynamic menu headers",
"self",
".",
"_feed_window",
".",
"addstr",
"(",
"0",
",",
"0",
",",
"\" \"",
"*",
"self",
".",
"_feed_window",
".",
"getmaxyx",
"(",
")",
"[",
"1",
"]",
")",
"self"... | https://github.com/xgi/castero/blob/766965fb1d3586d62ab6fd6dd144fa510c1e0ecb/castero/perspectives/primaryperspective.py#L68-L112 | ||
meteorshowers/X-StereoLab | d18a61953991d6b2e2bccea9e6e0a504292cd9e9 | disparity/eval/kitti-object-eval-python/kitti_common.py | python | iou | (boxes1, boxes2, add1=False) | return intersect / union | Computes pairwise intersection-over-union between box collections.
Args:
boxes1: a numpy array with shape [N, 4] holding N boxes.
boxes2: a numpy array with shape [M, 4] holding N boxes.
Returns:
a numpy array with shape [N, M] representing pairwise iou scores. | Computes pairwise intersection-over-union between box collections. | [
"Computes",
"pairwise",
"intersection",
"-",
"over",
"-",
"union",
"between",
"box",
"collections",
"."
] | def iou(boxes1, boxes2, add1=False):
"""Computes pairwise intersection-over-union between box collections.
Args:
boxes1: a numpy array with shape [N, 4] holding N boxes.
boxes2: a numpy array with shape [M, 4] holding N boxes.
Returns:
a numpy array with shape [N, M] representing p... | [
"def",
"iou",
"(",
"boxes1",
",",
"boxes2",
",",
"add1",
"=",
"False",
")",
":",
"intersect",
"=",
"intersection",
"(",
"boxes1",
",",
"boxes2",
",",
"add1",
")",
"area1",
"=",
"area",
"(",
"boxes1",
",",
"add1",
")",
"area2",
"=",
"area",
"(",
"bo... | https://github.com/meteorshowers/X-StereoLab/blob/d18a61953991d6b2e2bccea9e6e0a504292cd9e9/disparity/eval/kitti-object-eval-python/kitti_common.py#L402-L418 | |
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/Xenotix Python Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/optparse.py | python | OptionContainer.add_option | (self, *args, **kwargs) | return option | add_option(Option)
add_option(opt_str, ..., kwarg=val, ...) | add_option(Option)
add_option(opt_str, ..., kwarg=val, ...) | [
"add_option",
"(",
"Option",
")",
"add_option",
"(",
"opt_str",
"...",
"kwarg",
"=",
"val",
"...",
")"
] | def add_option(self, *args, **kwargs):
"""add_option(Option)
add_option(opt_str, ..., kwarg=val, ...)
"""
if type(args[0]) in types.StringTypes:
option = self.option_class(*args, **kwargs)
elif len(args) == 1 and not kwargs:
option = args[0]
... | [
"def",
"add_option",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"type",
"(",
"args",
"[",
"0",
"]",
")",
"in",
"types",
".",
"StringTypes",
":",
"option",
"=",
"self",
".",
"option_class",
"(",
"*",
"args",
",",
"*",
... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/optparse.py#L1007-L1035 | |
leo-editor/leo-editor | 383d6776d135ef17d73d935a2f0ecb3ac0e99494 | leo/plugins/demo.py | python | demo_end | (self, event=None, chain=False) | End the present demo. | End the present demo. | [
"End",
"the",
"present",
"demo",
"."
] | def demo_end(self, event=None, chain=False):
"""End the present demo."""
if getattr(g.app, 'demo', None):
g.app.demo.end()
else:
g.trace('no demo instance') | [
"def",
"demo_end",
"(",
"self",
",",
"event",
"=",
"None",
",",
"chain",
"=",
"False",
")",
":",
"if",
"getattr",
"(",
"g",
".",
"app",
",",
"'demo'",
",",
"None",
")",
":",
"g",
".",
"app",
".",
"demo",
".",
"end",
"(",
")",
"else",
":",
"g"... | https://github.com/leo-editor/leo-editor/blob/383d6776d135ef17d73d935a2f0ecb3ac0e99494/leo/plugins/demo.py#L48-L53 | ||
frescobaldi/frescobaldi | 301cc977fc4ba7caa3df9e4bf905212ad5d06912 | frescobaldi_app/midifile/player.py | python | Player.time_event | (self, msec) | (Private) Called on every time update. | (Private) Called on every time update. | [
"(",
"Private",
")",
"Called",
"on",
"every",
"time",
"update",
"."
] | def time_event(self, msec):
"""(Private) Called on every time update.""" | [
"def",
"time_event",
"(",
"self",
",",
"msec",
")",
":"
] | https://github.com/frescobaldi/frescobaldi/blob/301cc977fc4ba7caa3df9e4bf905212ad5d06912/frescobaldi_app/midifile/player.py#L237-L238 | ||
buke/GreenOdoo | 3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df | runtime/common/lib/python2.7/site-packages/libxml2.py | python | SchemaValidCtxtCore.setValidityErrorHandler | (self, err_func, warn_func, arg=None) | Register error and warning handlers for Schema validation.
These will be called back as f(msg,arg) | Register error and warning handlers for Schema validation.
These will be called back as f(msg,arg) | [
"Register",
"error",
"and",
"warning",
"handlers",
"for",
"Schema",
"validation",
".",
"These",
"will",
"be",
"called",
"back",
"as",
"f",
"(",
"msg",
"arg",
")"
] | def setValidityErrorHandler(self, err_func, warn_func, arg=None):
"""
Register error and warning handlers for Schema validation.
These will be called back as f(msg,arg)
"""
libxml2mod.xmlSchemaSetValidErrors(self._o, err_func, warn_func, arg) | [
"def",
"setValidityErrorHandler",
"(",
"self",
",",
"err_func",
",",
"warn_func",
",",
"arg",
"=",
"None",
")",
":",
"libxml2mod",
".",
"xmlSchemaSetValidErrors",
"(",
"self",
".",
"_o",
",",
"err_func",
",",
"warn_func",
",",
"arg",
")"
] | https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/common/lib/python2.7/site-packages/libxml2.py#L664-L669 | ||
dmlc/dgl | 8d14a739bc9e446d6c92ef83eafe5782398118de | examples/pytorch/graphsage/train_cv_multi_gpu.py | python | evaluate | (model, g, labels, val_mask, batch_size, device) | return compute_acc(pred[val_mask], labels[val_mask]) | Evaluate the model on the validation set specified by ``val_mask``.
g : The entire graph.
inputs : The features of all the nodes.
labels : The labels of all the nodes.
val_mask : A 0-1 mask indicating which nodes do we actually compute the accuracy for.
batch_size : Number of nodes to compute at the... | Evaluate the model on the validation set specified by ``val_mask``.
g : The entire graph.
inputs : The features of all the nodes.
labels : The labels of all the nodes.
val_mask : A 0-1 mask indicating which nodes do we actually compute the accuracy for.
batch_size : Number of nodes to compute at the... | [
"Evaluate",
"the",
"model",
"on",
"the",
"validation",
"set",
"specified",
"by",
"val_mask",
".",
"g",
":",
"The",
"entire",
"graph",
".",
"inputs",
":",
"The",
"features",
"of",
"all",
"the",
"nodes",
".",
"labels",
":",
"The",
"labels",
"of",
"all",
... | def evaluate(model, g, labels, val_mask, batch_size, device):
"""
Evaluate the model on the validation set specified by ``val_mask``.
g : The entire graph.
inputs : The features of all the nodes.
labels : The labels of all the nodes.
val_mask : A 0-1 mask indicating which nodes do we actually co... | [
"def",
"evaluate",
"(",
"model",
",",
"g",
",",
"labels",
",",
"val_mask",
",",
"batch_size",
",",
"device",
")",
":",
"model",
".",
"eval",
"(",
")",
"with",
"th",
".",
"no_grad",
"(",
")",
":",
"inputs",
"=",
"g",
".",
"ndata",
"[",
"'features'",... | https://github.com/dmlc/dgl/blob/8d14a739bc9e446d6c92ef83eafe5782398118de/examples/pytorch/graphsage/train_cv_multi_gpu.py#L155-L170 | |
glitchdotcom/WebPutty | 4f5da5eb2b4668cbf3c15cf002feacd1d95d2ef7 | libs/babel/messages/catalog.py | python | Catalog.__len__ | (self) | return len(self._messages) | The number of messages in the catalog.
This does not include the special ``msgid ""`` entry. | The number of messages in the catalog. | [
"The",
"number",
"of",
"messages",
"in",
"the",
"catalog",
"."
] | def __len__(self):
"""The number of messages in the catalog.
This does not include the special ``msgid ""`` entry.
"""
return len(self._messages) | [
"def",
"__len__",
"(",
"self",
")",
":",
"return",
"len",
"(",
"self",
".",
"_messages",
")"
] | https://github.com/glitchdotcom/WebPutty/blob/4f5da5eb2b4668cbf3c15cf002feacd1d95d2ef7/libs/babel/messages/catalog.py#L508-L513 | |
gnuradio/pybombs | 17044241bf835b93571026b112f179f2db7448a4 | pybombs/commands/deploy.py | python | Deploy.setup_subparser | (parser, cmd=None) | Set up a subparser for 'deploy' | Set up a subparser for 'deploy' | [
"Set",
"up",
"a",
"subparser",
"for",
"deploy"
] | def setup_subparser(parser, cmd=None):
"""
Set up a subparser for 'deploy'
"""
parser.add_argument(
'target', help="Deployment destination",
)
parser.add_argument(
'-t', '--tar',
help="Deploy to .tar",
dest="ttype",
... | [
"def",
"setup_subparser",
"(",
"parser",
",",
"cmd",
"=",
"None",
")",
":",
"parser",
".",
"add_argument",
"(",
"'target'",
",",
"help",
"=",
"\"Deployment destination\"",
",",
")",
"parser",
".",
"add_argument",
"(",
"'-t'",
",",
"'--tar'",
",",
"help",
"... | https://github.com/gnuradio/pybombs/blob/17044241bf835b93571026b112f179f2db7448a4/pybombs/commands/deploy.py#L168-L219 | ||
TengXiaoDai/DistributedCrawling | f5c2439e6ce68dd9b49bde084d76473ff9ed4963 | Lib/stat.py | python | filemode | (mode) | return "".join(perm) | Convert a file's mode to a string of the form '-rwxrwxrwx'. | Convert a file's mode to a string of the form '-rwxrwxrwx'. | [
"Convert",
"a",
"file",
"s",
"mode",
"to",
"a",
"string",
"of",
"the",
"form",
"-",
"rwxrwxrwx",
"."
] | def filemode(mode):
"""Convert a file's mode to a string of the form '-rwxrwxrwx'."""
perm = []
for table in _filemode_table:
for bit, char in table:
if mode & bit == bit:
perm.append(char)
break
else:
perm.append("-")
return "".joi... | [
"def",
"filemode",
"(",
"mode",
")",
":",
"perm",
"=",
"[",
"]",
"for",
"table",
"in",
"_filemode_table",
":",
"for",
"bit",
",",
"char",
"in",
"table",
":",
"if",
"mode",
"&",
"bit",
"==",
"bit",
":",
"perm",
".",
"append",
"(",
"char",
")",
"br... | https://github.com/TengXiaoDai/DistributedCrawling/blob/f5c2439e6ce68dd9b49bde084d76473ff9ed4963/Lib/stat.py#L139-L149 | |
FORTH-ICS-INSPIRE/artemis | f0774af8abc25ef5c6b307960c048ff7528d8a9c | monitor-services/riperistap/core/ripe_ris.py | python | RipeRisTapDataWorker.__init__ | (self, connection, shared_memory_manager_dict) | [] | def __init__(self, connection, shared_memory_manager_dict):
self.connection = connection
self.shared_memory_manager_dict = shared_memory_manager_dict
self.prefixes = self.shared_memory_manager_dict["monitored_prefixes"]
self.hosts = self.shared_memory_manager_dict["hosts"]
# EXC... | [
"def",
"__init__",
"(",
"self",
",",
"connection",
",",
"shared_memory_manager_dict",
")",
":",
"self",
".",
"connection",
"=",
"connection",
"self",
".",
"shared_memory_manager_dict",
"=",
"shared_memory_manager_dict",
"self",
".",
"prefixes",
"=",
"self",
".",
"... | https://github.com/FORTH-ICS-INSPIRE/artemis/blob/f0774af8abc25ef5c6b307960c048ff7528d8a9c/monitor-services/riperistap/core/ripe_ris.py#L370-L381 | ||||
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | lib/html5lib/html5parser.py | python | HTMLParser.documentEncoding | (self) | return self.tokenizer.stream.charEncoding[0].name | Name of the character encoding that was used to decode the input stream, or
:obj:`None` if that is not determined yet | Name of the character encoding that was used to decode the input stream, or
:obj:`None` if that is not determined yet | [
"Name",
"of",
"the",
"character",
"encoding",
"that",
"was",
"used",
"to",
"decode",
"the",
"input",
"stream",
"or",
":",
"obj",
":",
"None",
"if",
"that",
"is",
"not",
"determined",
"yet"
] | def documentEncoding(self):
"""Name of the character encoding that was used to decode the input stream, or
:obj:`None` if that is not determined yet
"""
if not hasattr(self, 'tokenizer'):
return None
return self.tokenizer.stream.charEncoding[0].name | [
"def",
"documentEncoding",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'tokenizer'",
")",
":",
"return",
"None",
"return",
"self",
".",
"tokenizer",
".",
"stream",
".",
"charEncoding",
"[",
"0",
"]",
".",
"name"
] | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/html5lib/html5parser.py#L173-L180 | |
hyperledger/aries-cloudagent-python | 2f36776e99f6053ae92eed8123b5b1b2e891c02a | aries_cloudagent/messaging/agent_message.py | python | AgentMessage.set_signature | (self, field_name: str, signature: SignatureDecorator) | Add or replace the signature for a named field.
Args:
field_name: Field to set signature on
signature: Signature for the field | Add or replace the signature for a named field. | [
"Add",
"or",
"replace",
"the",
"signature",
"for",
"a",
"named",
"field",
"."
] | def set_signature(self, field_name: str, signature: SignatureDecorator):
"""
Add or replace the signature for a named field.
Args:
field_name: Field to set signature on
signature: Signature for the field
"""
self._decorators.field(field_name)["sig"] = si... | [
"def",
"set_signature",
"(",
"self",
",",
"field_name",
":",
"str",
",",
"signature",
":",
"SignatureDecorator",
")",
":",
"self",
".",
"_decorators",
".",
"field",
"(",
"field_name",
")",
"[",
"\"sig\"",
"]",
"=",
"signature"
] | https://github.com/hyperledger/aries-cloudagent-python/blob/2f36776e99f6053ae92eed8123b5b1b2e891c02a/aries_cloudagent/messaging/agent_message.py#L161-L170 | ||
uqfoundation/mystic | 154e6302d1f2f94e8f13e88ecc5f24241cc28ac7 | examples3/ouq.py | python | BaseOUQ.lower_bound | (self, axis=None, **kwds) | return tuple(i.bestEnergy for i in solvers) | find the lower bound on the statistical quantity
Input:
axis: int, the index of y on which to find bound (all, by default)
instance: bool, if True, return the solver instance (False, by default)
Additional Input:
kwds: dict, with updates to the instance's stored kwds
Returns:
... | find the lower bound on the statistical quantity | [
"find",
"the",
"lower",
"bound",
"on",
"the",
"statistical",
"quantity"
] | def lower_bound(self, axis=None, **kwds):
"""find the lower bound on the statistical quantity
Input:
axis: int, the index of y on which to find bound (all, by default)
instance: bool, if True, return the solver instance (False, by default)
Additional Input:
kwds: dict, with upd... | [
"def",
"lower_bound",
"(",
"self",
",",
"axis",
"=",
"None",
",",
"*",
"*",
"kwds",
")",
":",
"full",
"=",
"kwds",
".",
"pop",
"(",
"'instance'",
",",
"False",
")",
"#self._lower.clear() #XXX: good idea?",
"if",
"self",
".",
"axes",
"is",
"None",
"or",
... | https://github.com/uqfoundation/mystic/blob/154e6302d1f2f94e8f13e88ecc5f24241cc28ac7/examples3/ouq.py#L112-L138 | |
ruiminshen/yolo-tf | eae65c8071fe5069f5e3bb1e26f19a761b1b68bc | detect.py | python | std | (image) | return utils.preprocess.per_image_standardization(image) | [] | def std(image):
return utils.preprocess.per_image_standardization(image) | [
"def",
"std",
"(",
"image",
")",
":",
"return",
"utils",
".",
"preprocess",
".",
"per_image_standardization",
"(",
"image",
")"
] | https://github.com/ruiminshen/yolo-tf/blob/eae65c8071fe5069f5e3bb1e26f19a761b1b68bc/detect.py#L33-L34 | |||
enthought/traitsui | b7c38c7a47bf6ae7971f9ddab70c8a358647dd25 | traitsui/qt4/list_str_editor.py | python | _ListStrEditor._selected_changed | (self, selected) | Handles the editor's 'selected' trait being changed. | Handles the editor's 'selected' trait being changed. | [
"Handles",
"the",
"editor",
"s",
"selected",
"trait",
"being",
"changed",
"."
] | def _selected_changed(self, selected):
"""Handles the editor's 'selected' trait being changed."""
if not self._no_update:
try:
selected_index = self.value.index(selected)
except ValueError:
pass
else:
self._selected_inde... | [
"def",
"_selected_changed",
"(",
"self",
",",
"selected",
")",
":",
"if",
"not",
"self",
".",
"_no_update",
":",
"try",
":",
"selected_index",
"=",
"self",
".",
"value",
".",
"index",
"(",
"selected",
")",
"except",
"ValueError",
":",
"pass",
"else",
":"... | https://github.com/enthought/traitsui/blob/b7c38c7a47bf6ae7971f9ddab70c8a358647dd25/traitsui/qt4/list_str_editor.py#L288-L296 | ||
andresriancho/w3af | cd22e5252243a87aaa6d0ddea47cf58dacfe00a9 | w3af/plugins/crawl/wordnet.py | python | wordnet.crawl | (self, fuzzable_request, debugging_id) | :param debugging_id: A unique identifier for this call to discover()
:param fuzzable_request: A fuzzable_request instance that contains
(among other things) the URL to test. | :param debugging_id: A unique identifier for this call to discover()
:param fuzzable_request: A fuzzable_request instance that contains
(among other things) the URL to test. | [
":",
"param",
"debugging_id",
":",
"A",
"unique",
"identifier",
"for",
"this",
"call",
"to",
"discover",
"()",
":",
"param",
"fuzzable_request",
":",
"A",
"fuzzable_request",
"instance",
"that",
"contains",
"(",
"among",
"other",
"things",
")",
"the",
"URL",
... | def crawl(self, fuzzable_request, debugging_id):
"""
:param debugging_id: A unique identifier for this call to discover()
:param fuzzable_request: A fuzzable_request instance that contains
(among other things) the URL to test.
"""
original_resp... | [
"def",
"crawl",
"(",
"self",
",",
"fuzzable_request",
",",
"debugging_id",
")",
":",
"original_response",
"=",
"self",
".",
"_uri_opener",
".",
"send_mutant",
"(",
"fuzzable_request",
")",
"original_response_repeat",
"=",
"repeat",
"(",
"original_response",
")",
"... | https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/plugins/crawl/wordnet.py#L50-L64 | ||
brightmart/multi-label_classification | b5febe17eaf9d937d71cabab56c5da48ee68f7b5 | run_classifier.py | python | MnliProcessor._create_examples | (self, lines, set_type) | return examples | Creates examples for the training and dev sets. | Creates examples for the training and dev sets. | [
"Creates",
"examples",
"for",
"the",
"training",
"and",
"dev",
"sets",
"."
] | def _create_examples(self, lines, set_type):
"""Creates examples for the training and dev sets."""
examples = []
for (i, line) in enumerate(lines):
if i == 0:
continue
guid = "%s-%s" % (set_type, tokenization.convert_to_unicode(line[0]))
text_a = tokenization.convert_to_unicode(lin... | [
"def",
"_create_examples",
"(",
"self",
",",
"lines",
",",
"set_type",
")",
":",
"examples",
"=",
"[",
"]",
"for",
"(",
"i",
",",
"line",
")",
"in",
"enumerate",
"(",
"lines",
")",
":",
"if",
"i",
"==",
"0",
":",
"continue",
"guid",
"=",
"\"%s-%s\"... | https://github.com/brightmart/multi-label_classification/blob/b5febe17eaf9d937d71cabab56c5da48ee68f7b5/run_classifier.py#L276-L291 | |
gkrizek/bash-lambda-layer | 703b0ade8174022d44779d823172ab7ac33a5505 | bin/docutils/utils/math/math2html.py | python | ContainerExtractor.extract | (self, container) | return list | Extract a group of selected containers from elyxer.a container. | Extract a group of selected containers from elyxer.a container. | [
"Extract",
"a",
"group",
"of",
"selected",
"containers",
"from",
"elyxer",
".",
"a",
"container",
"."
] | def extract(self, container):
"Extract a group of selected containers from elyxer.a container."
list = []
locate = lambda c: c.__class__.__name__ in self.allowed + self.cloned
recursive = lambda c: c.__class__.__name__ in self.extracted
process = lambda c: self.process(c, list)
container.recursi... | [
"def",
"extract",
"(",
"self",
",",
"container",
")",
":",
"list",
"=",
"[",
"]",
"locate",
"=",
"lambda",
"c",
":",
"c",
".",
"__class__",
".",
"__name__",
"in",
"self",
".",
"allowed",
"+",
"self",
".",
"cloned",
"recursive",
"=",
"lambda",
"c",
... | https://github.com/gkrizek/bash-lambda-layer/blob/703b0ade8174022d44779d823172ab7ac33a5505/bin/docutils/utils/math/math2html.py#L1350-L1357 | |
UDST/urbansim | 0db75668ada0005352b7c7e0a405265f78ccadd7 | urbansim/models/regression.py | python | RegressionModelGroup._iter_groups | (self, data) | Iterate over the groups in `data` after grouping by
`segmentation_col`. Skips any groups for which there
is no model stored.
Yields tuples of (name, df) where name is the group key
and df is the group DataFrame.
Parameters
----------
data : pandas.DataFrame
... | Iterate over the groups in `data` after grouping by
`segmentation_col`. Skips any groups for which there
is no model stored. | [
"Iterate",
"over",
"the",
"groups",
"in",
"data",
"after",
"grouping",
"by",
"segmentation_col",
".",
"Skips",
"any",
"groups",
"for",
"which",
"there",
"is",
"no",
"model",
"stored",
"."
] | def _iter_groups(self, data):
"""
Iterate over the groups in `data` after grouping by
`segmentation_col`. Skips any groups for which there
is no model stored.
Yields tuples of (name, df) where name is the group key
and df is the group DataFrame.
Parameters
... | [
"def",
"_iter_groups",
"(",
"self",
",",
"data",
")",
":",
"groups",
"=",
"data",
".",
"groupby",
"(",
"self",
".",
"segmentation_col",
")",
"for",
"name",
"in",
"self",
".",
"models",
":",
"yield",
"name",
",",
"groups",
".",
"get_group",
"(",
"name",... | https://github.com/UDST/urbansim/blob/0db75668ada0005352b7c7e0a405265f78ccadd7/urbansim/models/regression.py#L592-L610 | ||
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/modules/dockermod.py | python | get_client_args | (limit=None) | return __utils__["docker.get_client_args"](limit=limit) | .. versionadded:: 2016.3.6,2016.11.4,2017.7.0
.. versionchanged:: 2017.7.0
Replaced the container config args with the ones from the API's
``create_container`` function.
.. versionchanged:: 2018.3.0
Added ability to limit the input to specific client functions
Many functions in Salt... | .. versionadded:: 2016.3.6,2016.11.4,2017.7.0
.. versionchanged:: 2017.7.0
Replaced the container config args with the ones from the API's
``create_container`` function.
.. versionchanged:: 2018.3.0
Added ability to limit the input to specific client functions | [
"..",
"versionadded",
"::",
"2016",
".",
"3",
".",
"6",
"2016",
".",
"11",
".",
"4",
"2017",
".",
"7",
".",
"0",
"..",
"versionchanged",
"::",
"2017",
".",
"7",
".",
"0",
"Replaced",
"the",
"container",
"config",
"args",
"with",
"the",
"ones",
"fro... | def get_client_args(limit=None):
"""
.. versionadded:: 2016.3.6,2016.11.4,2017.7.0
.. versionchanged:: 2017.7.0
Replaced the container config args with the ones from the API's
``create_container`` function.
.. versionchanged:: 2018.3.0
Added ability to limit the input to specific... | [
"def",
"get_client_args",
"(",
"limit",
"=",
"None",
")",
":",
"return",
"__utils__",
"[",
"\"docker.get_client_args\"",
"]",
"(",
"limit",
"=",
"limit",
")"
] | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/dockermod.py#L819-L866 | |
KalleHallden/AutoTimer | 2d954216700c4930baa154e28dbddc34609af7ce | env/lib/python2.7/site-packages/pip/_vendor/packaging/specifiers.py | python | SpecifierSet.filter | (self, iterable, prereleases=None) | [] | def filter(self, iterable, prereleases=None):
# Determine if we're forcing a prerelease or not, if we're not forcing
# one for this particular filter call, then we'll use whatever the
# SpecifierSet thinks for whether or not we should support prereleases.
if prereleases is None:
... | [
"def",
"filter",
"(",
"self",
",",
"iterable",
",",
"prereleases",
"=",
"None",
")",
":",
"# Determine if we're forcing a prerelease or not, if we're not forcing",
"# one for this particular filter call, then we'll use whatever the",
"# SpecifierSet thinks for whether or not we should su... | https://github.com/KalleHallden/AutoTimer/blob/2d954216700c4930baa154e28dbddc34609af7ce/env/lib/python2.7/site-packages/pip/_vendor/packaging/specifiers.py#L704-L749 | ||||
kaaedit/kaa | e6a8819a5ecba04b7db8303bd5736b5a7c9b822d | kaa/ui/inputline/inputlinemode.py | python | InputlineMode.init_keybind | (self) | [] | def init_keybind(self):
super().init_keybind()
self.register_keys(self.keybind, self.KEY_BINDS) | [
"def",
"init_keybind",
"(",
"self",
")",
":",
"super",
"(",
")",
".",
"init_keybind",
"(",
")",
"self",
".",
"register_keys",
"(",
"self",
".",
"keybind",
",",
"self",
".",
"KEY_BINDS",
")"
] | https://github.com/kaaedit/kaa/blob/e6a8819a5ecba04b7db8303bd5736b5a7c9b822d/kaa/ui/inputline/inputlinemode.py#L47-L49 | ||||
tobegit3hub/deep_image_model | 8a53edecd9e00678b278bb10f6fb4bdb1e4ee25e | java_predict_client/src/main/proto/tensorflow/contrib/learn/python/learn/dataframe/transform.py | python | TensorFlowTransform.build_transitive | (self, input_series, cache=None, **kwargs) | return result | Apply this `Transform` to the provided `Series`, producing 'Tensor's.
Args:
input_series: None, a `Series`, or a list of input `Series`, acting as
positional arguments.
cache: a dict from Series reprs to Tensors.
**kwargs: Additional keyword arguments, unused here.
Returns:
A ... | Apply this `Transform` to the provided `Series`, producing 'Tensor's. | [
"Apply",
"this",
"Transform",
"to",
"the",
"provided",
"Series",
"producing",
"Tensor",
"s",
"."
] | def build_transitive(self, input_series, cache=None, **kwargs):
"""Apply this `Transform` to the provided `Series`, producing 'Tensor's.
Args:
input_series: None, a `Series`, or a list of input `Series`, acting as
positional arguments.
cache: a dict from Series reprs to Tensors.
**kw... | [
"def",
"build_transitive",
"(",
"self",
",",
"input_series",
",",
"cache",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=not-callable",
"if",
"cache",
"is",
"None",
":",
"cache",
"=",
"{",
"}",
"if",
"len",
"(",
"input_series",
")",
... | https://github.com/tobegit3hub/deep_image_model/blob/8a53edecd9e00678b278bb10f6fb4bdb1e4ee25e/java_predict_client/src/main/proto/tensorflow/contrib/learn/python/learn/dataframe/transform.py#L271-L310 | |
axnsan12/drf-yasg | d9700dbf8cc80d725a7db485c2d4446c19c29840 | src/drf_yasg/codecs.py | python | OpenAPICodecYaml._dump_dict | (self, spec) | return yaml_sane_dump(spec, binary=True) | Dump ``spec`` into YAML.
:rtype: bytes | Dump ``spec`` into YAML. | [
"Dump",
"spec",
"into",
"YAML",
"."
] | def _dump_dict(self, spec):
"""Dump ``spec`` into YAML.
:rtype: bytes"""
return yaml_sane_dump(spec, binary=True) | [
"def",
"_dump_dict",
"(",
"self",
",",
"spec",
")",
":",
"return",
"yaml_sane_dump",
"(",
"spec",
",",
"binary",
"=",
"True",
")"
] | https://github.com/axnsan12/drf-yasg/blob/d9700dbf8cc80d725a7db485c2d4446c19c29840/src/drf_yasg/codecs.py#L230-L234 | |
tensorflow/lingvo | ce10019243d954c3c3ebe739f7589b5eebfdf907 | lingvo/jax/layers/conformers.py | python | Conformer.fprop | (self, theta: NestedMap, inputs: JTensor,
paddings: JTensor) | return inputs | Conformer layer.
Args:
theta: A `.NestedMap` object containing weights' values of this layer and
its children layers.
inputs: Input sequence JTensor of shape [B, T, H].
paddings: Input paddings JTensor of shape [B, T] (only used in FFN layer).
Returns:
The conformer output with... | Conformer layer. | [
"Conformer",
"layer",
"."
] | def fprop(self, theta: NestedMap, inputs: JTensor,
paddings: JTensor) -> JTensor:
"""Conformer layer.
Args:
theta: A `.NestedMap` object containing weights' values of this layer and
its children layers.
inputs: Input sequence JTensor of shape [B, T, H].
paddings: Input pad... | [
"def",
"fprop",
"(",
"self",
",",
"theta",
":",
"NestedMap",
",",
"inputs",
":",
"JTensor",
",",
"paddings",
":",
"JTensor",
")",
"->",
"JTensor",
":",
"p",
"=",
"self",
".",
"params",
"if",
"self",
".",
"has_fflayer_start",
":",
"inputs",
"=",
"self",... | https://github.com/tensorflow/lingvo/blob/ce10019243d954c3c3ebe739f7589b5eebfdf907/lingvo/jax/layers/conformers.py#L247-L287 | |
xonsh/xonsh | b76d6f994f22a4078f602f8b386f4ec280c8461f | xonsh/openpy.py | python | read_py_url | (url, errors="replace", skip_encoding_cookie=True) | return source_to_unicode(buf, errors, skip_encoding_cookie) | Read a Python file from a URL, using the encoding declared inside the file.
Parameters
----------
url : str
The URL from which to fetch the file.
errors : str
How to handle decoding errors in the file. Options are the same as for
bytes.decode(), but here 'replace' is the default... | Read a Python file from a URL, using the encoding declared inside the file. | [
"Read",
"a",
"Python",
"file",
"from",
"a",
"URL",
"using",
"the",
"encoding",
"declared",
"inside",
"the",
"file",
"."
] | def read_py_url(url, errors="replace", skip_encoding_cookie=True):
"""Read a Python file from a URL, using the encoding declared inside the file.
Parameters
----------
url : str
The URL from which to fetch the file.
errors : str
How to handle decoding errors in the file. Options are... | [
"def",
"read_py_url",
"(",
"url",
",",
"errors",
"=",
"\"replace\"",
",",
"skip_encoding_cookie",
"=",
"True",
")",
":",
"# Deferred import for faster start",
"try",
":",
"from",
"urllib",
".",
"request",
"import",
"urlopen",
"# Py 3",
"except",
"ImportError",
":"... | https://github.com/xonsh/xonsh/blob/b76d6f994f22a4078f602f8b386f4ec280c8461f/xonsh/openpy.py#L95-L121 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | ansible/roles/lib_oa_openshift/library/oc_route.py | python | Route.get_service | (self) | return self.get(Route.service_path) | return service name | return service name | [
"return",
"service",
"name"
] | def get_service(self):
''' return service name '''
return self.get(Route.service_path) | [
"def",
"get_service",
"(",
"self",
")",
":",
"return",
"self",
".",
"get",
"(",
"Route",
".",
"service_path",
")"
] | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/ansible/roles/lib_oa_openshift/library/oc_route.py#L1640-L1642 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/ign_sismologia/geo_location.py | python | IgnSismologiaLocationEvent.longitude | (self) | return self._longitude | Return longitude value of this external event. | Return longitude value of this external event. | [
"Return",
"longitude",
"value",
"of",
"this",
"external",
"event",
"."
] | def longitude(self) -> float | None:
"""Return longitude value of this external event."""
return self._longitude | [
"def",
"longitude",
"(",
"self",
")",
"->",
"float",
"|",
"None",
":",
"return",
"self",
".",
"_longitude"
] | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/ign_sismologia/geo_location.py#L241-L243 | |
CellProfiler/CellProfiler | a90e17e4d258c6f3900238be0f828e0b4bd1b293 | cellprofiler/gui/editobjectsdlg.py | python | EditObjectsDialog.get_area | (artist) | return area | Get the area inside an artist polygon | Get the area inside an artist polygon | [
"Get",
"the",
"area",
"inside",
"an",
"artist",
"polygon"
] | def get_area(artist):
"""Get the area inside an artist polygon"""
#
# Thank you Darel Rex Finley:
#
# http://alienryderflex.com/polygon_area/
#
# Code is public domain
#
x, y = artist.get_data()
area = abs(numpy.sum((x[:-1] + x[1:]) * (y[:-... | [
"def",
"get_area",
"(",
"artist",
")",
":",
"#",
"# Thank you Darel Rex Finley:",
"#",
"# http://alienryderflex.com/polygon_area/",
"#",
"# Code is public domain",
"#",
"x",
",",
"y",
"=",
"artist",
".",
"get_data",
"(",
")",
"area",
"=",
"abs",
"(",
"numpy",
".... | https://github.com/CellProfiler/CellProfiler/blob/a90e17e4d258c6f3900238be0f828e0b4bd1b293/cellprofiler/gui/editobjectsdlg.py#L1762-L1773 | |
square/pylink | a2d9fbd3add62ffd06ba737c5ea82b8491fdc425 | pylink/structs.py | python | JLinkSWOStartInfo.__repr__ | (self) | return self.__str__() | Returns a representation of this instance.
Args:
self (JLinkSWOStartInfo): the ``JLinkSWOStartInfo`` instance
Returns:
The string representation of this instance. | Returns a representation of this instance. | [
"Returns",
"a",
"representation",
"of",
"this",
"instance",
"."
] | def __repr__(self):
"""Returns a representation of this instance.
Args:
self (JLinkSWOStartInfo): the ``JLinkSWOStartInfo`` instance
Returns:
The string representation of this instance.
"""
return self.__str__() | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"self",
".",
"__str__",
"(",
")"
] | https://github.com/square/pylink/blob/a2d9fbd3add62ffd06ba737c5ea82b8491fdc425/pylink/structs.py#L455-L464 | |
biolab/orange3 | 41685e1c7b1d1babe680113685a2d44bcc9fec0b | Orange/widgets/unsupervised/owmanifoldlearning.py | python | TSNEParametersEditor.__init__ | (self, parent) | [] | def __init__(self, parent):
super().__init__(parent)
self._create_combo_parameter("metric", "Metric:")
self._create_spin_parameter("perplexity", 1, 100, "Perplexity:")
self._create_spin_parameter("early_exaggeration", 1, 100,
"Early exaggeration:")
... | [
"def",
"__init__",
"(",
"self",
",",
"parent",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"parent",
")",
"self",
".",
"_create_combo_parameter",
"(",
"\"metric\"",
",",
"\"Metric:\"",
")",
"self",
".",
"_create_spin_parameter",
"(",
"\"perplexity\"",
... | https://github.com/biolab/orange3/blob/41685e1c7b1d1babe680113685a2d44bcc9fec0b/Orange/widgets/unsupervised/owmanifoldlearning.py#L103-L111 | ||||
biolab/orange3 | 41685e1c7b1d1babe680113685a2d44bcc9fec0b | Orange/widgets/evaluate/owliftcurve.py | python | ParameterSetter.update_setters | (self) | [] | def update_setters(self):
self.initial_settings = {
self.LABELS_BOX: {
self.FONT_FAMILY_LABEL: self.FONT_FAMILY_SETTING,
self.TITLE_LABEL: self.FONT_SETTING,
self.AXIS_TITLE_LABEL: self.FONT_SETTING,
self.AXIS_TICKS_LABEL: self.FONT_SET... | [
"def",
"update_setters",
"(",
"self",
")",
":",
"self",
".",
"initial_settings",
"=",
"{",
"self",
".",
"LABELS_BOX",
":",
"{",
"self",
".",
"FONT_FAMILY_LABEL",
":",
"self",
".",
"FONT_FAMILY_SETTING",
",",
"self",
".",
"TITLE_LABEL",
":",
"self",
".",
"F... | https://github.com/biolab/orange3/blob/41685e1c7b1d1babe680113685a2d44bcc9fec0b/Orange/widgets/evaluate/owliftcurve.py#L79-L134 | ||||
golemhq/golem | 84f51478b169cdeab73fc7e2a22a64d0a2a29263 | golem/actions.py | python | assert_element_has_not_focus | (element) | Assert element does not have focus
Parameters:
element : element | Assert element does not have focus | [
"Assert",
"element",
"does",
"not",
"have",
"focus"
] | def assert_element_has_not_focus(element):
"""Assert element does not have focus
Parameters:
element : element
"""
element = get_browser().find(element, timeout=0)
_add_step(f'Assert element {element.name} does not have focus')
_run_wait_hook()
error_msg = f'element {element.name} has f... | [
"def",
"assert_element_has_not_focus",
"(",
"element",
")",
":",
"element",
"=",
"get_browser",
"(",
")",
".",
"find",
"(",
"element",
",",
"timeout",
"=",
"0",
")",
"_add_step",
"(",
"f'Assert element {element.name} does not have focus'",
")",
"_run_wait_hook",
"("... | https://github.com/golemhq/golem/blob/84f51478b169cdeab73fc7e2a22a64d0a2a29263/golem/actions.py#L466-L476 | ||
PyCQA/isort | c6a41965247a858a0afd848fbebfca18b8983917 | isort/wrap.py | python | import_statement | (
import_start: str,
from_imports: List[str],
comments: Sequence[str] = (),
line_separator: str = "\n",
config: Config = DEFAULT_CONFIG,
multi_line_output: Optional[Modes] = None,
) | return statement | Returns a multi-line wrapped form of the provided from import statement. | Returns a multi-line wrapped form of the provided from import statement. | [
"Returns",
"a",
"multi",
"-",
"line",
"wrapped",
"form",
"of",
"the",
"provided",
"from",
"import",
"statement",
"."
] | def import_statement(
import_start: str,
from_imports: List[str],
comments: Sequence[str] = (),
line_separator: str = "\n",
config: Config = DEFAULT_CONFIG,
multi_line_output: Optional[Modes] = None,
) -> str:
"""Returns a multi-line wrapped form of the provided from import statement."""
... | [
"def",
"import_statement",
"(",
"import_start",
":",
"str",
",",
"from_imports",
":",
"List",
"[",
"str",
"]",
",",
"comments",
":",
"Sequence",
"[",
"str",
"]",
"=",
"(",
")",
",",
"line_separator",
":",
"str",
"=",
"\"\\n\"",
",",
"config",
":",
"Con... | https://github.com/PyCQA/isort/blob/c6a41965247a858a0afd848fbebfca18b8983917/isort/wrap.py#L10-L61 | |
EnterpriseDB/barman | 487bad92edec72712531ead4746fad72bb310270 | barman/retention_policies.py | python | RetentionPolicy.report | (self, source=None, context=None) | Report obsolete/valid objects according to the retention policy | Report obsolete/valid objects according to the retention policy | [
"Report",
"obsolete",
"/",
"valid",
"objects",
"according",
"to",
"the",
"retention",
"policy"
] | def report(self, source=None, context=None):
"""Report obsolete/valid objects according to the retention policy"""
if context is None:
context = self.context
# Overrides the list of available backups
if source is None:
source = self.server.available_backups
... | [
"def",
"report",
"(",
"self",
",",
"source",
"=",
"None",
",",
"context",
"=",
"None",
")",
":",
"if",
"context",
"is",
"None",
":",
"context",
"=",
"self",
".",
"context",
"# Overrides the list of available backups",
"if",
"source",
"is",
"None",
":",
"so... | https://github.com/EnterpriseDB/barman/blob/487bad92edec72712531ead4746fad72bb310270/barman/retention_policies.py#L57-L69 | ||
postgres/pgadmin4 | 374c5e952fa594d749fadf1f88076c1cba8c5f64 | web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/__init__.py | python | SynonymView.dependents | (self, gid, sid, did, scid, syid) | return ajax_response(
response=dependents_result,
status=200
) | This function get the dependents and return ajax response
for the Synonym node.
Args:
gid: Server Group ID
sid: Server ID
did: Database ID
scid: Schema ID
syid: Synonym ID | This function get the dependents and return ajax response
for the Synonym node. | [
"This",
"function",
"get",
"the",
"dependents",
"and",
"return",
"ajax",
"response",
"for",
"the",
"Synonym",
"node",
"."
] | def dependents(self, gid, sid, did, scid, syid):
"""
This function get the dependents and return ajax response
for the Synonym node.
Args:
gid: Server Group ID
sid: Server ID
did: Database ID
scid: Schema ID
syid: Synonym ID
... | [
"def",
"dependents",
"(",
"self",
",",
"gid",
",",
"sid",
",",
"did",
",",
"scid",
",",
"syid",
")",
":",
"dependents_result",
"=",
"self",
".",
"get_dependents",
"(",
"self",
".",
"conn",
",",
"syid",
")",
"return",
"ajax_response",
"(",
"response",
"... | https://github.com/postgres/pgadmin4/blob/374c5e952fa594d749fadf1f88076c1cba8c5f64/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/__init__.py#L706-L723 | |
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | bin/x86/Debug/scripting_engine/Lib/SimpleXMLRPCServer.py | python | SimpleXMLRPCDispatcher.system_methodSignature | (self, method_name) | return 'signatures not supported' | system.methodSignature('add') => [double, int, int]
Returns a list describing the signature of the method. In the
above example, the add method takes two integers as arguments
and returns a double result.
This server does NOT support system.methodSignature. | system.methodSignature('add') => [double, int, int] | [
"system",
".",
"methodSignature",
"(",
"add",
")",
"=",
">",
"[",
"double",
"int",
"int",
"]"
] | def system_methodSignature(self, method_name):
"""system.methodSignature('add') => [double, int, int]
Returns a list describing the signature of the method. In the
above example, the add method takes two integers as arguments
and returns a double result.
This server does NOT su... | [
"def",
"system_methodSignature",
"(",
"self",
",",
"method_name",
")",
":",
"# See http://xmlrpc.usefulinc.com/doc/sysmethodsig.html",
"return",
"'signatures not supported'"
] | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/bin/x86/Debug/scripting_engine/Lib/SimpleXMLRPCServer.py#L301-L312 | |
hildogjr/KiCost | 227f246d8c0f5dab145390d15c94ee2c3d6c790c | kicost/spreadsheet.py | python | xl_range | (first_row, first_col, last_row=None, last_col=None) | return range1 + ':' + range2 | [] | def xl_range(first_row, first_col, last_row=None, last_col=None):
if last_row is None:
last_row = first_row
if last_col is None:
last_col = first_col
range1 = xl_rowcol_to_cell(first_row, first_col)
range2 = xl_rowcol_to_cell(last_row, last_col)
if range1 == range2:
return ra... | [
"def",
"xl_range",
"(",
"first_row",
",",
"first_col",
",",
"last_row",
"=",
"None",
",",
"last_col",
"=",
"None",
")",
":",
"if",
"last_row",
"is",
"None",
":",
"last_row",
"=",
"first_row",
"if",
"last_col",
"is",
"None",
":",
"last_col",
"=",
"first_c... | https://github.com/hildogjr/KiCost/blob/227f246d8c0f5dab145390d15c94ee2c3d6c790c/kicost/spreadsheet.py#L57-L66 | |||
python-pillow/Pillow | fd2b07c454b20e1e9af0cea64923b21250f8f8d6 | src/PIL/ImageDraw.py | python | ImageDraw.regular_polygon | (
self, bounding_circle, n_sides, rotation=0, fill=None, outline=None
) | Draw a regular polygon. | Draw a regular polygon. | [
"Draw",
"a",
"regular",
"polygon",
"."
] | def regular_polygon(
self, bounding_circle, n_sides, rotation=0, fill=None, outline=None
):
"""Draw a regular polygon."""
xy = _compute_regular_polygon_vertices(bounding_circle, n_sides, rotation)
self.polygon(xy, fill, outline) | [
"def",
"regular_polygon",
"(",
"self",
",",
"bounding_circle",
",",
"n_sides",
",",
"rotation",
"=",
"0",
",",
"fill",
"=",
"None",
",",
"outline",
"=",
"None",
")",
":",
"xy",
"=",
"_compute_regular_polygon_vertices",
"(",
"bounding_circle",
",",
"n_sides",
... | https://github.com/python-pillow/Pillow/blob/fd2b07c454b20e1e9af0cea64923b21250f8f8d6/src/PIL/ImageDraw.py#L266-L271 | ||
krintoxi/NoobSec-Toolkit | 38738541cbc03cedb9a3b3ed13b629f781ad64f6 | NoobSecToolkit - MAC OSX/scripts/sshbackdoors/backdoors/shell/pupy/pupy/packages/windows/x86/psutil/_pswindows.py | python | Process.name | (self) | Return process name, which on Windows is always the final
part of the executable. | Return process name, which on Windows is always the final
part of the executable. | [
"Return",
"process",
"name",
"which",
"on",
"Windows",
"is",
"always",
"the",
"final",
"part",
"of",
"the",
"executable",
"."
] | def name(self):
"""Return process name, which on Windows is always the final
part of the executable.
"""
# This is how PIDs 0 and 4 are always represented in taskmgr
# and process-hacker.
if self.pid == 0:
return "System Idle Process"
elif self.pid == ... | [
"def",
"name",
"(",
"self",
")",
":",
"# This is how PIDs 0 and 4 are always represented in taskmgr",
"# and process-hacker.",
"if",
"self",
".",
"pid",
"==",
"0",
":",
"return",
"\"System Idle Process\"",
"elif",
"self",
".",
"pid",
"==",
"4",
":",
"return",
"\"Sys... | https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit - MAC OSX/scripts/sshbackdoors/backdoors/shell/pupy/pupy/packages/windows/x86/psutil/_pswindows.py#L302-L318 | ||
X-DataInitiative/tick | bbc561804eb1fdcb4c71b9e3e2d83a66e7b13a48 | tick/hawkes/simulation/hawkes_kernels/hawkes_kernel.py | python | HawkesKernel.get_support | (self) | return self._kernel.get_support() | Returns the upperbound of the support | Returns the upperbound of the support | [
"Returns",
"the",
"upperbound",
"of",
"the",
"support"
] | def get_support(self):
"""Returns the upperbound of the support
"""
return self._kernel.get_support() | [
"def",
"get_support",
"(",
"self",
")",
":",
"return",
"self",
".",
"_kernel",
".",
"get_support",
"(",
")"
] | https://github.com/X-DataInitiative/tick/blob/bbc561804eb1fdcb4c71b9e3e2d83a66e7b13a48/tick/hawkes/simulation/hawkes_kernels/hawkes_kernel.py#L23-L26 | |
beetbox/beets | 2fea53c34dd505ba391cb345424e0613901c8025 | beets/ui/commands.py | python | _do_query | (lib, query, album, also_items=True) | return items, albums | For commands that operate on matched items, performs a query
and returns a list of matching items and a list of matching
albums. (The latter is only nonempty when album is True.) Raises
a UserError if no items match. also_items controls whether, when
fetching albums, the associated items should be fetch... | For commands that operate on matched items, performs a query
and returns a list of matching items and a list of matching
albums. (The latter is only nonempty when album is True.) Raises
a UserError if no items match. also_items controls whether, when
fetching albums, the associated items should be fetch... | [
"For",
"commands",
"that",
"operate",
"on",
"matched",
"items",
"performs",
"a",
"query",
"and",
"returns",
"a",
"list",
"of",
"matching",
"items",
"and",
"a",
"list",
"of",
"matching",
"albums",
".",
"(",
"The",
"latter",
"is",
"only",
"nonempty",
"when",... | def _do_query(lib, query, album, also_items=True):
"""For commands that operate on matched items, performs a query
and returns a list of matching items and a list of matching
albums. (The latter is only nonempty when album is True.) Raises
a UserError if no items match. also_items controls whether, when... | [
"def",
"_do_query",
"(",
"lib",
",",
"query",
",",
"album",
",",
"also_items",
"=",
"True",
")",
":",
"if",
"album",
":",
"albums",
"=",
"list",
"(",
"lib",
".",
"albums",
"(",
"query",
")",
")",
"items",
"=",
"[",
"]",
"if",
"also_items",
":",
"... | https://github.com/beetbox/beets/blob/2fea53c34dd505ba391cb345424e0613901c8025/beets/ui/commands.py#L56-L79 | |
larryhastings/gilectomy | 4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a | Lib/tempfile.py | python | _sanitize_params | (prefix, suffix, dir) | return prefix, suffix, dir, output_type | Common parameter processing for most APIs in this module. | Common parameter processing for most APIs in this module. | [
"Common",
"parameter",
"processing",
"for",
"most",
"APIs",
"in",
"this",
"module",
"."
] | def _sanitize_params(prefix, suffix, dir):
"""Common parameter processing for most APIs in this module."""
output_type = _infer_return_type(prefix, suffix, dir)
if suffix is None:
suffix = output_type()
if prefix is None:
if output_type is str:
prefix = template
else:... | [
"def",
"_sanitize_params",
"(",
"prefix",
",",
"suffix",
",",
"dir",
")",
":",
"output_type",
"=",
"_infer_return_type",
"(",
"prefix",
",",
"suffix",
",",
"dir",
")",
"if",
"suffix",
"is",
"None",
":",
"suffix",
"=",
"output_type",
"(",
")",
"if",
"pref... | https://github.com/larryhastings/gilectomy/blob/4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a/Lib/tempfile.py#L118-L133 | |
facebookresearch/pytorch3d | fddd6a700fa9685c1ce2d4b266c111d7db424ecc | pytorch3d/io/pluggable.py | python | IO.register_meshes_format | (self, interpreter: MeshFormatInterpreter) | Register a new interpreter for a new mesh file format.
Args:
interpreter: the new interpreter to use, which must be an instance
of a class which inherits MeshFormatInterpreter. | Register a new interpreter for a new mesh file format. | [
"Register",
"a",
"new",
"interpreter",
"for",
"a",
"new",
"mesh",
"file",
"format",
"."
] | def register_meshes_format(self, interpreter: MeshFormatInterpreter) -> None:
"""
Register a new interpreter for a new mesh file format.
Args:
interpreter: the new interpreter to use, which must be an instance
of a class which inherits MeshFormatInterpreter.
... | [
"def",
"register_meshes_format",
"(",
"self",
",",
"interpreter",
":",
"MeshFormatInterpreter",
")",
"->",
"None",
":",
"if",
"not",
"isinstance",
"(",
"interpreter",
",",
"MeshFormatInterpreter",
")",
":",
"raise",
"ValueError",
"(",
"\"Invalid interpreter\"",
")",... | https://github.com/facebookresearch/pytorch3d/blob/fddd6a700fa9685c1ce2d4b266c111d7db424ecc/pytorch3d/io/pluggable.py#L84-L94 | ||
scikit-hep/scikit-hep | 506149b352eeb2291f24aef3f40691b5f6be2da7 | skhep/math/vectors.py | python | LorentzVector.rotatez | (self, angle) | return self.rotate(angle, 0, 0, 1) | Rotate vector by a given angle (in radians) around the z axis. | Rotate vector by a given angle (in radians) around the z axis. | [
"Rotate",
"vector",
"by",
"a",
"given",
"angle",
"(",
"in",
"radians",
")",
"around",
"the",
"z",
"axis",
"."
] | def rotatez(self, angle):
"""Rotate vector by a given angle (in radians) around the z axis."""
return self.rotate(angle, 0, 0, 1) | [
"def",
"rotatez",
"(",
"self",
",",
"angle",
")",
":",
"return",
"self",
".",
"rotate",
"(",
"angle",
",",
"0",
",",
"0",
",",
"1",
")"
] | https://github.com/scikit-hep/scikit-hep/blob/506149b352eeb2291f24aef3f40691b5f6be2da7/skhep/math/vectors.py#L1113-L1115 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/pip/_vendor/requests/cookies.py | python | RequestsCookieJar.copy | (self) | return new_cj | Return a copy of this RequestsCookieJar. | Return a copy of this RequestsCookieJar. | [
"Return",
"a",
"copy",
"of",
"this",
"RequestsCookieJar",
"."
] | def copy(self):
"""Return a copy of this RequestsCookieJar."""
new_cj = RequestsCookieJar()
new_cj.set_policy(self.get_policy())
new_cj.update(self)
return new_cj | [
"def",
"copy",
"(",
"self",
")",
":",
"new_cj",
"=",
"RequestsCookieJar",
"(",
")",
"new_cj",
".",
"set_policy",
"(",
"self",
".",
"get_policy",
"(",
")",
")",
"new_cj",
".",
"update",
"(",
"self",
")",
"return",
"new_cj"
] | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/pip/_vendor/requests/cookies.py#L414-L419 | |
home-assistant-libs/pychromecast | d7acb9f5ae2c0daa797d78da1a1e8090b4181d21 | pychromecast/controllers/media.py | python | MediaStatus.supports_stream_volume | (self) | return bool(self.supported_media_commands & CMD_SUPPORT_STREAM_VOLUME) | True if STREAM_VOLUME is supported. | True if STREAM_VOLUME is supported. | [
"True",
"if",
"STREAM_VOLUME",
"is",
"supported",
"."
] | def supports_stream_volume(self):
"""True if STREAM_VOLUME is supported."""
return bool(self.supported_media_commands & CMD_SUPPORT_STREAM_VOLUME) | [
"def",
"supports_stream_volume",
"(",
"self",
")",
":",
"return",
"bool",
"(",
"self",
".",
"supported_media_commands",
"&",
"CMD_SUPPORT_STREAM_VOLUME",
")"
] | https://github.com/home-assistant-libs/pychromecast/blob/d7acb9f5ae2c0daa797d78da1a1e8090b4181d21/pychromecast/controllers/media.py#L229-L231 | |
realpython/book2-exercises | cde325eac8e6d8cff2316601c2e5b36bb46af7d0 | web2py-rest/gluon/contrib/memdb.py | python | Rows.__str__ | (self) | return s.getvalue() | serializes the table into a csv file | serializes the table into a csv file | [
"serializes",
"the",
"table",
"into",
"a",
"csv",
"file"
] | def __str__(self):
"""
serializes the table into a csv file
"""
s = cStringIO.StringIO()
writer = csv.writer(s)
writer.writerow(self.colnames)
c = len(self.colnames)
for i in xrange(len(self)):
row = [self.response[i][j] for j in xrange(c)]
... | [
"def",
"__str__",
"(",
"self",
")",
":",
"s",
"=",
"cStringIO",
".",
"StringIO",
"(",
")",
"writer",
"=",
"csv",
".",
"writer",
"(",
"s",
")",
"writer",
".",
"writerow",
"(",
"self",
".",
"colnames",
")",
"c",
"=",
"len",
"(",
"self",
".",
"colna... | https://github.com/realpython/book2-exercises/blob/cde325eac8e6d8cff2316601c2e5b36bb46af7d0/web2py-rest/gluon/contrib/memdb.py#L749-L764 | |
newfies-dialer/newfies-dialer | 8168b3dd43e9f5ce73a2645b3229def1b2815d47 | newfies/survey/templatetags/survey_tags.py | python | section_type_name | (value) | return get_status_value(value, SECTION_TYPE) | survey section type name
>>> section_type_name(1)
'Play message'
>>> section_type_name(2)
'Multi-choice'
>>> section_type_name(0)
'' | survey section type name | [
"survey",
"section",
"type",
"name"
] | def section_type_name(value):
"""survey section type name
>>> section_type_name(1)
'Play message'
>>> section_type_name(2)
'Multi-choice'
>>> section_type_name(0)
''
"""
return get_status_value(value, SECTION_TYPE) | [
"def",
"section_type_name",
"(",
"value",
")",
":",
"return",
"get_status_value",
"(",
"value",
",",
"SECTION_TYPE",
")"
] | https://github.com/newfies-dialer/newfies-dialer/blob/8168b3dd43e9f5ce73a2645b3229def1b2815d47/newfies/survey/templatetags/survey_tags.py#L24-L36 | |
MontrealCorpusTools/Montreal-Forced-Aligner | 63473f9a4fabd31eec14e1e5022882f85cfdaf31 | montreal_forced_aligner/alignment/pretrained.py | python | PretrainedAligner.workflow_identifier | (self) | return "pretrained_aligner" | Aligner identifier | Aligner identifier | [
"Aligner",
"identifier"
] | def workflow_identifier(self) -> str:
"""Aligner identifier"""
return "pretrained_aligner" | [
"def",
"workflow_identifier",
"(",
"self",
")",
"->",
"str",
":",
"return",
"\"pretrained_aligner\""
] | https://github.com/MontrealCorpusTools/Montreal-Forced-Aligner/blob/63473f9a4fabd31eec14e1e5022882f85cfdaf31/montreal_forced_aligner/alignment/pretrained.py#L248-L250 | |
wxWidgets/Phoenix | b2199e299a6ca6d866aa6f3d0888499136ead9d6 | wx/lib/agw/ultimatelistctrl.py | python | UltimateListCtrl.OnGetItemKind | (self, item) | return 0 | This function **must** be overloaded in the derived class for a control with
``ULC_VIRTUAL`` style. It should return the item kind for the input item.
:param `item`: an integer specifying the item index.
:note: The base class version always returns 0 (a standard item).
:see: :meth:`~U... | This function **must** be overloaded in the derived class for a control with
``ULC_VIRTUAL`` style. It should return the item kind for the input item. | [
"This",
"function",
"**",
"must",
"**",
"be",
"overloaded",
"in",
"the",
"derived",
"class",
"for",
"a",
"control",
"with",
"ULC_VIRTUAL",
"style",
".",
"It",
"should",
"return",
"the",
"item",
"kind",
"for",
"the",
"input",
"item",
"."
] | def OnGetItemKind(self, item):
"""
This function **must** be overloaded in the derived class for a control with
``ULC_VIRTUAL`` style. It should return the item kind for the input item.
:param `item`: an integer specifying the item index.
:note: The base class version always re... | [
"def",
"OnGetItemKind",
"(",
"self",
",",
"item",
")",
":",
"return",
"0"
] | https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/agw/ultimatelistctrl.py#L12730-L12742 | |
IOActive/XDiFF | 552d3394e119ca4ced8115f9fd2d7e26760e40b1 | classes/settings.py | python | set_logger | (settings) | return logger | Insantiate the logging functionality | Insantiate the logging functionality | [
"Insantiate",
"the",
"logging",
"functionality"
] | def set_logger(settings):
"""Insantiate the logging functionality"""
logging.basicConfig(filename='fuzz.log', level=logging.INFO, format='%(asctime)s %(levelname)s %(module)s: %(message)s', datefmt='%Y-%m-%d %H.%M.%S')
console = logging.StreamHandler()
console.setFormatter(logging.Formatter('%(asctime)s %(levelname... | [
"def",
"set_logger",
"(",
"settings",
")",
":",
"logging",
".",
"basicConfig",
"(",
"filename",
"=",
"'fuzz.log'",
",",
"level",
"=",
"logging",
".",
"INFO",
",",
"format",
"=",
"'%(asctime)s %(levelname)s %(module)s: %(message)s'",
",",
"datefmt",
"=",
"'%Y-%m-%d... | https://github.com/IOActive/XDiFF/blob/552d3394e119ca4ced8115f9fd2d7e26760e40b1/classes/settings.py#L79-L90 | |
openstack/swift | b8d7c3dcb817504dcc0959ba52cc4ed2cf66c100 | swift/common/middleware/tempurl.py | python | TempURL.__call__ | (self, env, start_response) | return self.app(env, _start_response) | Main hook into the WSGI paste.deploy filter/app pipeline.
:param env: The WSGI environment dict.
:param start_response: The WSGI start_response hook.
:returns: Response as per WSGI. | Main hook into the WSGI paste.deploy filter/app pipeline. | [
"Main",
"hook",
"into",
"the",
"WSGI",
"paste",
".",
"deploy",
"filter",
"/",
"app",
"pipeline",
"."
] | def __call__(self, env, start_response):
"""
Main hook into the WSGI paste.deploy filter/app pipeline.
:param env: The WSGI environment dict.
:param start_response: The WSGI start_response hook.
:returns: Response as per WSGI.
"""
if env['REQUEST_METHOD'] == 'OPT... | [
"def",
"__call__",
"(",
"self",
",",
"env",
",",
"start_response",
")",
":",
"if",
"env",
"[",
"'REQUEST_METHOD'",
"]",
"==",
"'OPTIONS'",
":",
"return",
"self",
".",
"app",
"(",
"env",
",",
"start_response",
")",
"info",
"=",
"self",
".",
"_get_temp_url... | https://github.com/openstack/swift/blob/b8d7c3dcb817504dcc0959ba52cc4ed2cf66c100/swift/common/middleware/tempurl.py#L490-L642 | |
twopirllc/pandas-ta | b92e45c0b8f035ac76292f8f130be32ec49b2ef4 | pandas_ta/overlap/sma.py | python | sma | (close, length=None, talib=None, offset=None, **kwargs) | return sma | Indicator: Simple Moving Average (SMA) | Indicator: Simple Moving Average (SMA) | [
"Indicator",
":",
"Simple",
"Moving",
"Average",
"(",
"SMA",
")"
] | def sma(close, length=None, talib=None, offset=None, **kwargs):
"""Indicator: Simple Moving Average (SMA)"""
# Validate Arguments
length = int(length) if length and length > 0 else 10
min_periods = int(kwargs["min_periods"]) if "min_periods" in kwargs and kwargs["min_periods"] is not None else length
... | [
"def",
"sma",
"(",
"close",
",",
"length",
"=",
"None",
",",
"talib",
"=",
"None",
",",
"offset",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# Validate Arguments",
"length",
"=",
"int",
"(",
"length",
")",
"if",
"length",
"and",
"length",
">",
... | https://github.com/twopirllc/pandas-ta/blob/b92e45c0b8f035ac76292f8f130be32ec49b2ef4/pandas_ta/overlap/sma.py#L6-L38 | |
cloudinary/pycloudinary | a61a9687c8933f23574c38e27f201358e540ee64 | cloudinary/utils.py | python | build_list_of_dicts | (val) | return val | Converts a value that can be presented as a list of dict.
In case top level item is not a list, it is wrapped with a list
Valid values examples:
- Valid dict: {"k": "v", "k2","v2"}
- List of dict: [{"k": "v"}, {"k2","v2"}]
- JSON decodable string: '{"k": "v"}', or '[{"k": "v"}]'
... | Converts a value that can be presented as a list of dict. | [
"Converts",
"a",
"value",
"that",
"can",
"be",
"presented",
"as",
"a",
"list",
"of",
"dict",
"."
] | def build_list_of_dicts(val):
"""
Converts a value that can be presented as a list of dict.
In case top level item is not a list, it is wrapped with a list
Valid values examples:
- Valid dict: {"k": "v", "k2","v2"}
- List of dict: [{"k": "v"}, {"k2","v2"}]
- JSON decodable stri... | [
"def",
"build_list_of_dicts",
"(",
"val",
")",
":",
"if",
"val",
"is",
"None",
":",
"return",
"[",
"]",
"if",
"isinstance",
"(",
"val",
",",
"str",
")",
":",
"# use OrderedDict to preserve order",
"val",
"=",
"json",
".",
"loads",
"(",
"val",
",",
"objec... | https://github.com/cloudinary/pycloudinary/blob/a61a9687c8933f23574c38e27f201358e540ee64/cloudinary/utils.py#L170-L209 | |
JiYou/openstack | 8607dd488bde0905044b303eb6e52bdea6806923 | packages/source/cinder/cinder/volume/drivers/scality.py | python | ScalityDriver._check_prerequisites | (self) | Sanity checks before attempting to mount SOFS. | Sanity checks before attempting to mount SOFS. | [
"Sanity",
"checks",
"before",
"attempting",
"to",
"mount",
"SOFS",
"."
] | def _check_prerequisites(self):
"""Sanity checks before attempting to mount SOFS."""
# config is mandatory
config = FLAGS.scality_sofs_config
if not config:
msg = _("Value required for 'scality_sofs_config'")
LOG.warn(msg)
raise exception.VolumeBacken... | [
"def",
"_check_prerequisites",
"(",
"self",
")",
":",
"# config is mandatory",
"config",
"=",
"FLAGS",
".",
"scality_sofs_config",
"if",
"not",
"config",
":",
"msg",
"=",
"_",
"(",
"\"Value required for 'scality_sofs_config'\"",
")",
"LOG",
".",
"warn",
"(",
"msg"... | https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/cinder/cinder/volume/drivers/scality.py#L57-L82 | ||
OCA/account-financial-tools | 98d07b6448530d44bec195ff528b7a9452da1eae | account_chart_update/wizard/wizard_chart_update.py | python | WizardUpdateChartsAccounts._update_fiscal_positions | (self) | Process fiscal position templates to create/update. | Process fiscal position templates to create/update. | [
"Process",
"fiscal",
"position",
"templates",
"to",
"create",
"/",
"update",
"."
] | def _update_fiscal_positions(self):
"""Process fiscal position templates to create/update."""
for wiz_fp in self.fiscal_position_ids:
fp, template = (wiz_fp.update_fiscal_position_id, wiz_fp.fiscal_position_id)
if wiz_fp.type == "new":
# Create a new fiscal positi... | [
"def",
"_update_fiscal_positions",
"(",
"self",
")",
":",
"for",
"wiz_fp",
"in",
"self",
".",
"fiscal_position_ids",
":",
"fp",
",",
"template",
"=",
"(",
"wiz_fp",
".",
"update_fiscal_position_id",
",",
"wiz_fp",
".",
"fiscal_position_id",
")",
"if",
"wiz_fp",
... | https://github.com/OCA/account-financial-tools/blob/98d07b6448530d44bec195ff528b7a9452da1eae/account_chart_update/wizard/wizard_chart_update.py#L1052-L1077 | ||
hacktoolkit/django-htk | 902f3780630f1308aa97a70b9b62a5682239ff2d | apps/accounts/api/views.py | python | username | (request) | return response | Update a User's username | Update a User's username | [
"Update",
"a",
"User",
"s",
"username"
] | def username(request):
"""Update a User's username
"""
user = request.user
username_form = ChangeUsernameForm(user, request.POST)
if username_form.is_valid():
username_form.save(user)
response = json_response_okay()
else:
obj = {
HTK_API_JSON_KEY_STATUS: HTK_A... | [
"def",
"username",
"(",
"request",
")",
":",
"user",
"=",
"request",
".",
"user",
"username_form",
"=",
"ChangeUsernameForm",
"(",
"user",
",",
"request",
".",
"POST",
")",
"if",
"username_form",
".",
"is_valid",
"(",
")",
":",
"username_form",
".",
"save"... | https://github.com/hacktoolkit/django-htk/blob/902f3780630f1308aa97a70b9b62a5682239ff2d/apps/accounts/api/views.py#L104-L118 | |
theotherp/nzbhydra | 4b03d7f769384b97dfc60dade4806c0fc987514e | libs/OpenSSL/crypto.py | python | dump_certificate_request | (type, req) | return _bio_to_string(bio) | Dump a certificate request to a buffer
:param type: The file type (one of FILETYPE_PEM, FILETYPE_ASN1)
:param req: The certificate request to dump
:return: The buffer with the dumped certificate request in | Dump a certificate request to a buffer | [
"Dump",
"a",
"certificate",
"request",
"to",
"a",
"buffer"
] | def dump_certificate_request(type, req):
"""
Dump a certificate request to a buffer
:param type: The file type (one of FILETYPE_PEM, FILETYPE_ASN1)
:param req: The certificate request to dump
:return: The buffer with the dumped certificate request in
"""
bio = _new_mem_buf()
if type ==... | [
"def",
"dump_certificate_request",
"(",
"type",
",",
"req",
")",
":",
"bio",
"=",
"_new_mem_buf",
"(",
")",
"if",
"type",
"==",
"FILETYPE_PEM",
":",
"result_code",
"=",
"_lib",
".",
"PEM_write_bio_X509_REQ",
"(",
"bio",
",",
"req",
".",
"_req",
")",
"elif"... | https://github.com/theotherp/nzbhydra/blob/4b03d7f769384b97dfc60dade4806c0fc987514e/libs/OpenSSL/crypto.py#L2331-L2354 | |
OpenAgricultureFoundation/openag-device-software | a51d2de399c0a6781ae51d0dcfaae1583d75f346 | device/peripherals/modules/atlas_co2/scripts/run_driver.py | python | DriverRunner.run | (self, *args: Any, **kwargs: Any) | Runs driver. | Runs driver. | [
"Runs",
"driver",
"."
] | def run(self, *args: Any, **kwargs: Any):
"""Runs driver."""
# Run parent class
super().run(*args, **kwargs)
# Check if reading pH
if self.args.co2:
print("CO2: {} ppm".format(self.driver.read_co2()))
elif self.args.enable_temp:
self.driver.enabl... | [
"def",
"run",
"(",
"self",
",",
"*",
"args",
":",
"Any",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
":",
"# Run parent class",
"super",
"(",
")",
".",
"run",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"# Check if reading pH",
"if",
"self",
".",... | https://github.com/OpenAgricultureFoundation/openag-device-software/blob/a51d2de399c0a6781ae51d0dcfaae1583d75f346/device/peripherals/modules/atlas_co2/scripts/run_driver.py#L48-L62 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/PIL/PngImagePlugin.py | python | _safe_zlib_decompress | (s) | return plaintext | [] | def _safe_zlib_decompress(s):
dobj = zlib.decompressobj()
plaintext = dobj.decompress(s, MAX_TEXT_CHUNK)
if dobj.unconsumed_tail:
raise ValueError("Decompressed Data Too Large")
return plaintext | [
"def",
"_safe_zlib_decompress",
"(",
"s",
")",
":",
"dobj",
"=",
"zlib",
".",
"decompressobj",
"(",
")",
"plaintext",
"=",
"dobj",
".",
"decompress",
"(",
"s",
",",
"MAX_TEXT_CHUNK",
")",
"if",
"dobj",
".",
"unconsumed_tail",
":",
"raise",
"ValueError",
"(... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/PIL/PngImagePlugin.py#L81-L86 | |||
demisto/content | 5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07 | Packs/cisco-ise/Integrations/cisco-ise/cisco-ise.py | python | get_all_nodes_command | () | Returns all nodes in the Cisco ISE Deployment
Also sets isLocalIstance in the output | Returns all nodes in the Cisco ISE Deployment
Also sets isLocalIstance in the output | [
"Returns",
"all",
"nodes",
"in",
"the",
"Cisco",
"ISE",
"Deployment",
"Also",
"sets",
"isLocalIstance",
"in",
"the",
"output"
] | def get_all_nodes_command():
"""
Returns all nodes in the Cisco ISE Deployment
Also sets isLocalIstance in the output
"""
instance_ip = urlparse(BASE_URL).netloc
try:
instance_ip = socket.gethostbyname(instance_ip)
except Exception as e:
err_msg = (f'Failed to get ip address... | [
"def",
"get_all_nodes_command",
"(",
")",
":",
"instance_ip",
"=",
"urlparse",
"(",
"BASE_URL",
")",
".",
"netloc",
"try",
":",
"instance_ip",
"=",
"socket",
".",
"gethostbyname",
"(",
"instance_ip",
")",
"except",
"Exception",
"as",
"e",
":",
"err_msg",
"="... | https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/cisco-ise/Integrations/cisco-ise/cisco-ise.py#L769-L813 | ||
roclark/sportsipy | c19f545d3376d62ded6304b137dc69238ac620a9 | sportsipy/nba/roster.py | python | Roster._pull_team_page | (self, url) | Download the team page.
Download the requested team's season page and create a PyQuery object.
Parameters
----------
url : string
A string of the built URL for the requested team and season.
Returns
-------
PyQuery object
Returns a PyQue... | Download the team page. | [
"Download",
"the",
"team",
"page",
"."
] | def _pull_team_page(self, url):
"""
Download the team page.
Download the requested team's season page and create a PyQuery object.
Parameters
----------
url : string
A string of the built URL for the requested team and season.
Returns
------... | [
"def",
"_pull_team_page",
"(",
"self",
",",
"url",
")",
":",
"try",
":",
"return",
"pq",
"(",
"url",
")",
"except",
"HTTPError",
":",
"return",
"None"
] | https://github.com/roclark/sportsipy/blob/c19f545d3376d62ded6304b137dc69238ac620a9/sportsipy/nba/roster.py#L1408-L1427 | ||
rwth-i6/returnn | f2d718a197a280b0d5f0fd91a7fcb8658560dddb | returnn/datasets/lm.py | python | _expand_number_with_spacing | (m) | return " %s " % _expand_number(m) | :param typing.Match m:
:rtype: str | :param typing.Match m:
:rtype: str | [
":",
"param",
"typing",
".",
"Match",
"m",
":",
":",
"rtype",
":",
"str"
] | def _expand_number_with_spacing(m):
"""
:param typing.Match m:
:rtype: str
"""
return " %s " % _expand_number(m) | [
"def",
"_expand_number_with_spacing",
"(",
"m",
")",
":",
"return",
"\" %s \"",
"%",
"_expand_number",
"(",
"m",
")"
] | https://github.com/rwth-i6/returnn/blob/f2d718a197a280b0d5f0fd91a7fcb8658560dddb/returnn/datasets/lm.py#L1993-L1998 | |
Ha0Tang/SelectionGAN | 80aa7ad9f79f643c28633c40c621f208f3fb0121 | semantic_synthesis/util/visualizer.py | python | Visualizer.save_images | (self, webpage, visuals, image_path) | [] | def save_images(self, webpage, visuals, image_path):
visuals = self.convert_visuals_to_numpy(visuals)
image_dir = webpage.get_image_dir()
short_path = ntpath.basename(image_path[0])
name = os.path.splitext(short_path)[0]
webpage.add_header(name)
... | [
"def",
"save_images",
"(",
"self",
",",
"webpage",
",",
"visuals",
",",
"image_path",
")",
":",
"visuals",
"=",
"self",
".",
"convert_visuals_to_numpy",
"(",
"visuals",
")",
"image_dir",
"=",
"webpage",
".",
"get_image_dir",
"(",
")",
"short_path",
"=",
"ntp... | https://github.com/Ha0Tang/SelectionGAN/blob/80aa7ad9f79f643c28633c40c621f208f3fb0121/semantic_synthesis/util/visualizer.py#L139-L159 | ||||
openbmc/openbmc | 5f4109adae05f4d6925bfe960007d52f98c61086 | poky/scripts/lib/devtool/__init__.py | python | replace_from_file | (path, old, new) | Replace strings on a file | Replace strings on a file | [
"Replace",
"strings",
"on",
"a",
"file"
] | def replace_from_file(path, old, new):
"""Replace strings on a file"""
def read_file(path):
data = None
with open(path) as f:
data = f.read()
return data
def write_file(path, data):
if data is None:
return
wdata = data.rstrip() + "\n"
... | [
"def",
"replace_from_file",
"(",
"path",
",",
"old",
",",
"new",
")",
":",
"def",
"read_file",
"(",
"path",
")",
":",
"data",
"=",
"None",
"with",
"open",
"(",
"path",
")",
"as",
"f",
":",
"data",
"=",
"f",
".",
"read",
"(",
")",
"return",
"data"... | https://github.com/openbmc/openbmc/blob/5f4109adae05f4d6925bfe960007d52f98c61086/poky/scripts/lib/devtool/__init__.py#L274-L309 | ||
dbt-labs/dbt-core | e943b9fc842535e958ef4fd0b8703adc91556bc6 | core/dbt/contracts/graph/unparsed.py | python | Maturity.__ge__ | (self, other) | return self == other or not (self < other) | [] | def __ge__(self, other):
if not isinstance(other, Maturity):
return NotImplemented
return self == other or not (self < other) | [
"def",
"__ge__",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"Maturity",
")",
":",
"return",
"NotImplemented",
"return",
"self",
"==",
"other",
"or",
"not",
"(",
"self",
"<",
"other",
")"
] | https://github.com/dbt-labs/dbt-core/blob/e943b9fc842535e958ef4fd0b8703adc91556bc6/core/dbt/contracts/graph/unparsed.py#L407-L410 | |||
tracim/tracim | a0e9746fde5a4c45b4e0f0bfa2caf9522b8c4e21 | backend/tracim_backend/lib/webdav/resources.py | python | ContentOnlyContainer.createCollection | (self, label: str) | return FolderResource(
folder_path,
self.environ,
content=folder,
tracim_context=self.tracim_context,
workspace=self.workspace,
) | Create a new folder for the current workspace/folder. As it's not possible for the user to choose
which types of content are allowed in this folder, we allow allow all of them.
This method return the DAVCollection created. | Create a new folder for the current workspace/folder. As it's not possible for the user to choose
which types of content are allowed in this folder, we allow allow all of them. | [
"Create",
"a",
"new",
"folder",
"for",
"the",
"current",
"workspace",
"/",
"folder",
".",
"As",
"it",
"s",
"not",
"possible",
"for",
"the",
"user",
"to",
"choose",
"which",
"types",
"of",
"content",
"are",
"allowed",
"in",
"this",
"folder",
"we",
"allow"... | def createCollection(self, label: str) -> "FolderResource":
"""
Create a new folder for the current workspace/folder. As it's not possible for the user to choose
which types of content are allowed in this folder, we allow allow all of them.
This method return the DAVCollection created.
... | [
"def",
"createCollection",
"(",
"self",
",",
"label",
":",
"str",
")",
"->",
"\"FolderResource\"",
":",
"folder_label",
"=",
"webdav_convert_file_name_to_bdd",
"(",
"label",
")",
"try",
":",
"folder",
"=",
"self",
".",
"content_api",
".",
"create",
"(",
"conte... | https://github.com/tracim/tracim/blob/a0e9746fde5a4c45b4e0f0bfa2caf9522b8c4e21/backend/tracim_backend/lib/webdav/resources.py#L377-L407 | |
pwnieexpress/pwn_plug_sources | 1a23324f5dc2c3de20f9c810269b6a29b2758cad | src/fimap/xgoogle/BeautifulSoup.py | python | SoupStrainer.__str__ | (self) | [] | def __str__(self):
if self.text:
return self.text
else:
return "%s|%s" % (self.name, self.attrs) | [
"def",
"__str__",
"(",
"self",
")",
":",
"if",
"self",
".",
"text",
":",
"return",
"self",
".",
"text",
"else",
":",
"return",
"\"%s|%s\"",
"%",
"(",
"self",
".",
"name",
",",
"self",
".",
"attrs",
")"
] | https://github.com/pwnieexpress/pwn_plug_sources/blob/1a23324f5dc2c3de20f9c810269b6a29b2758cad/src/fimap/xgoogle/BeautifulSoup.py#L818-L822 | ||||
Sekunde/3D-SIS | b90018a68df1fd14c4ad6f16702e9c74f309f11f | lib/utils/logger.py | python | Logger.__init__ | (self, log_dir) | Create a summary writer logging to log_dir. | Create a summary writer logging to log_dir. | [
"Create",
"a",
"summary",
"writer",
"logging",
"to",
"log_dir",
"."
] | def __init__(self, log_dir):
"""Create a summary writer logging to log_dir."""
self.writer = tf.summary.FileWriter(log_dir) | [
"def",
"__init__",
"(",
"self",
",",
"log_dir",
")",
":",
"self",
".",
"writer",
"=",
"tf",
".",
"summary",
".",
"FileWriter",
"(",
"log_dir",
")"
] | https://github.com/Sekunde/3D-SIS/blob/b90018a68df1fd14c4ad6f16702e9c74f309f11f/lib/utils/logger.py#L13-L15 | ||
roclark/sportsipy | c19f545d3376d62ded6304b137dc69238ac620a9 | sportsipy/nhl/player.py | python | AbstractPlayer.corsi_for_percentage | (self) | return self._corsi_for_percentage | Returns a ``float`` of the 'Corsi For' percentage, equal to corsi_for /
(corsi_for + corsi_against). Percentage ranges from 0-100. | Returns a ``float`` of the 'Corsi For' percentage, equal to corsi_for /
(corsi_for + corsi_against). Percentage ranges from 0-100. | [
"Returns",
"a",
"float",
"of",
"the",
"Corsi",
"For",
"percentage",
"equal",
"to",
"corsi_for",
"/",
"(",
"corsi_for",
"+",
"corsi_against",
")",
".",
"Percentage",
"ranges",
"from",
"0",
"-",
"100",
"."
] | def corsi_for_percentage(self):
"""
Returns a ``float`` of the 'Corsi For' percentage, equal to corsi_for /
(corsi_for + corsi_against). Percentage ranges from 0-100.
"""
return self._corsi_for_percentage | [
"def",
"corsi_for_percentage",
"(",
"self",
")",
":",
"return",
"self",
".",
"_corsi_for_percentage"
] | https://github.com/roclark/sportsipy/blob/c19f545d3376d62ded6304b137dc69238ac620a9/sportsipy/nhl/player.py#L306-L311 | |
gcollazo/BrowserRefresh-Sublime | daee0eda6480c07f8636ed24e5c555d24e088886 | win/pywinauto/controls/HwndWrapper.py | python | HwndWrapper.SendMessageTimeout | (
self,
message,
wparam = 0 ,
lparam = 0,
timeout = None,
timeoutflags = win32defines.SMTO_NORMAL) | return result.value | Send a message to the control and wait for it to return or to timeout
If no timeout is given then a default timeout of .4 of a second will
be used. | Send a message to the control and wait for it to return or to timeout | [
"Send",
"a",
"message",
"to",
"the",
"control",
"and",
"wait",
"for",
"it",
"to",
"return",
"or",
"to",
"timeout"
] | def SendMessageTimeout(
self,
message,
wparam = 0 ,
lparam = 0,
timeout = None,
timeoutflags = win32defines.SMTO_NORMAL):
"""Send a message to the control and wait for it to return or to timeout
If no timeout is given then a default timeout of .4 of a sec... | [
"def",
"SendMessageTimeout",
"(",
"self",
",",
"message",
",",
"wparam",
"=",
"0",
",",
"lparam",
"=",
"0",
",",
"timeout",
"=",
"None",
",",
"timeoutflags",
"=",
"win32defines",
".",
"SMTO_NORMAL",
")",
":",
"if",
"timeout",
"is",
"None",
":",
"timeout"... | https://github.com/gcollazo/BrowserRefresh-Sublime/blob/daee0eda6480c07f8636ed24e5c555d24e088886/win/pywinauto/controls/HwndWrapper.py#L578-L600 | |
Nuitka/Nuitka | 39262276993757fa4e299f497654065600453fc9 | nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/__init__.py | python | Node.is_derived | (self) | return self.has_builder() or self.side_effect | Returns true if this node is derived (i.e. built).
This should return true only for nodes whose path should be in
the variant directory when duplicate=0 and should contribute their build
signatures when they are used as source files to other derived files. For
example: source with sourc... | Returns true if this node is derived (i.e. built). | [
"Returns",
"true",
"if",
"this",
"node",
"is",
"derived",
"(",
"i",
".",
"e",
".",
"built",
")",
"."
] | def is_derived(self):
"""
Returns true if this node is derived (i.e. built).
This should return true only for nodes whose path should be in
the variant directory when duplicate=0 and should contribute their build
signatures when they are used as source files to other derived fil... | [
"def",
"is_derived",
"(",
"self",
")",
":",
"return",
"self",
".",
"has_builder",
"(",
")",
"or",
"self",
".",
"side_effect"
] | https://github.com/Nuitka/Nuitka/blob/39262276993757fa4e299f497654065600453fc9/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/__init__.py#L539-L549 | |
openstack/manila | 142990edc027e14839d5deaf4954dd6fc88de15e | manila/share/drivers/netapp/dataontap/cluster_mode/lib_base.py | python | NetAppCmodeFileStorageLibrary._sort_export_locations_by_preferred_paths | (self, export_locations) | return sorted(export_locations, key=sort_key) | Sort the export locations to report preferred paths first. | Sort the export locations to report preferred paths first. | [
"Sort",
"the",
"export",
"locations",
"to",
"report",
"preferred",
"paths",
"first",
"."
] | def _sort_export_locations_by_preferred_paths(self, export_locations):
"""Sort the export locations to report preferred paths first."""
sort_key = lambda location: location.get( # noqa: E731
'metadata', {}).get('preferred') is not True
return sorted(export_locations, key=sort_key) | [
"def",
"_sort_export_locations_by_preferred_paths",
"(",
"self",
",",
"export_locations",
")",
":",
"sort_key",
"=",
"lambda",
"location",
":",
"location",
".",
"get",
"(",
"# noqa: E731",
"'metadata'",
",",
"{",
"}",
")",
".",
"get",
"(",
"'preferred'",
")",
... | https://github.com/openstack/manila/blob/142990edc027e14839d5deaf4954dd6fc88de15e/manila/share/drivers/netapp/dataontap/cluster_mode/lib_base.py#L1722-L1728 | |
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/apps/accounting/utils/__init__.py | python | months_from_date | (reference_date, months_from_date) | return datetime.date(year, month, 1) | [] | def months_from_date(reference_date, months_from_date):
year, month = add_months(reference_date.year, reference_date.month, months_from_date)
return datetime.date(year, month, 1) | [
"def",
"months_from_date",
"(",
"reference_date",
",",
"months_from_date",
")",
":",
"year",
",",
"month",
"=",
"add_months",
"(",
"reference_date",
".",
"year",
",",
"reference_date",
".",
"month",
",",
"months_from_date",
")",
"return",
"datetime",
".",
"date"... | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/accounting/utils/__init__.py#L38-L40 | |||
ikalchev/HAP-python | 6c2b95cc6457ea9c8dbee1759455a6954bb14092 | pyhap/loader.py | python | Loader.__init__ | (self, path_char=CHARACTERISTICS_FILE, path_service=SERVICES_FILE) | Initialize a new Loader instance. | Initialize a new Loader instance. | [
"Initialize",
"a",
"new",
"Loader",
"instance",
"."
] | def __init__(self, path_char=CHARACTERISTICS_FILE, path_service=SERVICES_FILE):
"""Initialize a new Loader instance."""
self.char_types = self._read_file(path_char)
self.serv_types = self._read_file(path_service) | [
"def",
"__init__",
"(",
"self",
",",
"path_char",
"=",
"CHARACTERISTICS_FILE",
",",
"path_service",
"=",
"SERVICES_FILE",
")",
":",
"self",
".",
"char_types",
"=",
"self",
".",
"_read_file",
"(",
"path_char",
")",
"self",
".",
"serv_types",
"=",
"self",
".",... | https://github.com/ikalchev/HAP-python/blob/6c2b95cc6457ea9c8dbee1759455a6954bb14092/pyhap/loader.py#L28-L31 | ||
carnal0wnage/weirdAAL | c14e36d7bb82447f38a43da203f4bc29429f4cf4 | modules/aws/ec2.py | python | module_ec2_get_console_screenshot_all_region_list | (*text) | This function gets a screenshot for all EC2 instances in the specified list & region
useful if for some reason one instance-id wont screenshot, pass it a list of instance-ids for a region
-See module_ec2_write_instances_to_file to create the list
python3 weirdAAL.py -m ec2_get_console_screenshot_all_region_... | This function gets a screenshot for all EC2 instances in the specified list & region
useful if for some reason one instance-id wont screenshot, pass it a list of instance-ids for a region
-See module_ec2_write_instances_to_file to create the list
python3 weirdAAL.py -m ec2_get_console_screenshot_all_region_... | [
"This",
"function",
"gets",
"a",
"screenshot",
"for",
"all",
"EC2",
"instances",
"in",
"the",
"specified",
"list",
"&",
"region",
"useful",
"if",
"for",
"some",
"reason",
"one",
"instance",
"-",
"id",
"wont",
"screenshot",
"pass",
"it",
"a",
"list",
"of",
... | def module_ec2_get_console_screenshot_all_region_list(*text):
'''
This function gets a screenshot for all EC2 instances in the specified list & region
useful if for some reason one instance-id wont screenshot, pass it a list of instance-ids for a region
-See module_ec2_write_instances_to_file to create ... | [
"def",
"module_ec2_get_console_screenshot_all_region_list",
"(",
"*",
"text",
")",
":",
"get_console_screenshot_all_region_list",
"(",
"text",
"[",
"0",
"]",
"[",
"0",
"]",
",",
"text",
"[",
"0",
"]",
"[",
"1",
"]",
")"
] | https://github.com/carnal0wnage/weirdAAL/blob/c14e36d7bb82447f38a43da203f4bc29429f4cf4/modules/aws/ec2.py#L154-L161 | ||
bamtercelboo/pytorch_word2vec | 6868ecac64c2801df520b7f9ed63ba79ed100c82 | torch_CBOW.py | python | context_to_tensor | (context, idx_dict) | return Variable(torch.LongTensor(context_idx)) | Converts context list to tensor. | Converts context list to tensor. | [
"Converts",
"context",
"list",
"to",
"tensor",
"."
] | def context_to_tensor(context, idx_dict):
""" Converts context list to tensor. """
context_idx = [idx_dict[word] for word in context]
return Variable(torch.LongTensor(context_idx)) | [
"def",
"context_to_tensor",
"(",
"context",
",",
"idx_dict",
")",
":",
"context_idx",
"=",
"[",
"idx_dict",
"[",
"word",
"]",
"for",
"word",
"in",
"context",
"]",
"return",
"Variable",
"(",
"torch",
".",
"LongTensor",
"(",
"context_idx",
")",
")"
] | https://github.com/bamtercelboo/pytorch_word2vec/blob/6868ecac64c2801df520b7f9ed63ba79ed100c82/torch_CBOW.py#L49-L52 | |
numba/numba | bf480b9e0da858a65508c2b17759a72ee6a44c51 | numba/cuda/libdevice.py | python | rintf | (x) | See https://docs.nvidia.com/cuda/libdevice-users-guide/__nv_rintf.html
:param x: Argument.
:type x: float32
:rtype: float32 | See https://docs.nvidia.com/cuda/libdevice-users-guide/__nv_rintf.html | [
"See",
"https",
":",
"//",
"docs",
".",
"nvidia",
".",
"com",
"/",
"cuda",
"/",
"libdevice",
"-",
"users",
"-",
"guide",
"/",
"__nv_rintf",
".",
"html"
] | def rintf(x):
"""
See https://docs.nvidia.com/cuda/libdevice-users-guide/__nv_rintf.html
:param x: Argument.
:type x: float32
:rtype: float32
""" | [
"def",
"rintf",
"(",
"x",
")",
":"
] | https://github.com/numba/numba/blob/bf480b9e0da858a65508c2b17759a72ee6a44c51/numba/cuda/libdevice.py#L2751-L2758 | ||
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Parser/asdl_c.py | python | ObjVisitor.visitSum | (self, sum, name) | [] | def visitSum(self, sum, name):
if is_simple(sum):
self.simpleSum(sum, name)
return
self.func_begin(name)
self.emit("switch (o->kind) {", 1)
for i in range(len(sum.types)):
t = sum.types[i]
self.visitConstructor(t, i + 1, name)
self.... | [
"def",
"visitSum",
"(",
"self",
",",
"sum",
",",
"name",
")",
":",
"if",
"is_simple",
"(",
"sum",
")",
":",
"self",
".",
"simpleSum",
"(",
"sum",
",",
"name",
")",
"return",
"self",
".",
"func_begin",
"(",
"name",
")",
"self",
".",
"emit",
"(",
"... | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Parser/asdl_c.py#L1017-L1033 | ||||
gmr/rabbitpy | d97fd2b1e983df0d95c2b0e2c6b29f61c79d82b9 | rabbitpy/connection.py | python | Connection._qargs_ssl_validation | (self, values) | return SSL_CERT_MAP[validation] | Return the value mapped from the string value in the query string
for the AMQP URL specifying which level of server certificate
validation is required, if any.
:param dict values: The dict of query values from the AMQP URI
:rtype: int | Return the value mapped from the string value in the query string
for the AMQP URL specifying which level of server certificate
validation is required, if any. | [
"Return",
"the",
"value",
"mapped",
"from",
"the",
"string",
"value",
"in",
"the",
"query",
"string",
"for",
"the",
"AMQP",
"URL",
"specifying",
"which",
"level",
"of",
"server",
"certificate",
"validation",
"is",
"required",
"if",
"any",
"."
] | def _qargs_ssl_validation(self, values):
"""Return the value mapped from the string value in the query string
for the AMQP URL specifying which level of server certificate
validation is required, if any.
:param dict values: The dict of query values from the AMQP URI
:rtype: int
... | [
"def",
"_qargs_ssl_validation",
"(",
"self",
",",
"values",
")",
":",
"validation",
"=",
"self",
".",
"_qargs_mk_value",
"(",
"[",
"'verify'",
",",
"'ssl_validation'",
"]",
",",
"values",
")",
"if",
"not",
"validation",
":",
"return",
"elif",
"validation",
"... | https://github.com/gmr/rabbitpy/blob/d97fd2b1e983df0d95c2b0e2c6b29f61c79d82b9/rabbitpy/connection.py#L538-L554 | |
ebroecker/canmatrix | 219a19adf4639b0b4fd5328f039563c6d4060887 | src/canmatrix/formats/sym.py | python | load | (f, **options) | return db | [] | def load(f, **options): # type: (typing.IO, **typing.Any) -> canmatrix.CanMatrix
if 'symImportEncoding' in options:
sym_import_encoding = options["symImportEncoding"]
else:
sym_import_encoding = 'iso-8859-1'
calc_min_for_none = options.get('calc_min_for_none')
calc_max_for_none = optio... | [
"def",
"load",
"(",
"f",
",",
"*",
"*",
"options",
")",
":",
"# type: (typing.IO, **typing.Any) -> canmatrix.CanMatrix",
"if",
"'symImportEncoding'",
"in",
"options",
":",
"sym_import_encoding",
"=",
"options",
"[",
"\"symImportEncoding\"",
"]",
"else",
":",
"sym_impo... | https://github.com/ebroecker/canmatrix/blob/219a19adf4639b0b4fd5328f039563c6d4060887/src/canmatrix/formats/sym.py#L329-L661 | |||
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/lib-python/3/email/quoprimime.py | python | header_decode | (s) | return re.sub(r'=[a-fA-F0-9]{2}', _unquote_match, s, re.ASCII) | Decode a string encoded with RFC 2045 MIME header `Q' encoding.
This function does not parse a full MIME header value encoded with
quoted-printable (like =?iso-8895-1?q?Hello_World?=) -- please use
the high level email.header class for that functionality. | Decode a string encoded with RFC 2045 MIME header `Q' encoding. | [
"Decode",
"a",
"string",
"encoded",
"with",
"RFC",
"2045",
"MIME",
"header",
"Q",
"encoding",
"."
] | def header_decode(s):
"""Decode a string encoded with RFC 2045 MIME header `Q' encoding.
This function does not parse a full MIME header value encoded with
quoted-printable (like =?iso-8895-1?q?Hello_World?=) -- please use
the high level email.header class for that functionality.
"""
s = s.repl... | [
"def",
"header_decode",
"(",
"s",
")",
":",
"s",
"=",
"s",
".",
"replace",
"(",
"'_'",
",",
"' '",
")",
"return",
"re",
".",
"sub",
"(",
"r'=[a-fA-F0-9]{2}'",
",",
"_unquote_match",
",",
"s",
",",
"re",
".",
"ASCII",
")"
] | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/email/quoprimime.py#L314-L322 | |
rsmusllp/termineter | 9311d6d995a7bf0f80853a00a115a8fa16aa0727 | lib/termineter/core.py | python | Framework.test_serial_connection | (self) | return True | Connect to the serial device and then verifies that the meter is
responding. Once the serial device is open, this function attempts
to retrieve the contents of table #0 (GEN_CONFIG_TBL) to configure
the endianess it will use. Returns True on success. | Connect to the serial device and then verifies that the meter is
responding. Once the serial device is open, this function attempts
to retrieve the contents of table #0 (GEN_CONFIG_TBL) to configure
the endianess it will use. Returns True on success. | [
"Connect",
"to",
"the",
"serial",
"device",
"and",
"then",
"verifies",
"that",
"the",
"meter",
"is",
"responding",
".",
"Once",
"the",
"serial",
"device",
"is",
"open",
"this",
"function",
"attempts",
"to",
"retrieve",
"the",
"contents",
"of",
"table",
"#0",... | def test_serial_connection(self):
"""
Connect to the serial device and then verifies that the meter is
responding. Once the serial device is open, this function attempts
to retrieve the contents of table #0 (GEN_CONFIG_TBL) to configure
the endianess it will use. Returns True on success.
"""
self.serial... | [
"def",
"test_serial_connection",
"(",
"self",
")",
":",
"self",
".",
"serial_connect",
"(",
")",
"username",
"=",
"self",
".",
"options",
"[",
"'USERNAME'",
"]",
"user_id",
"=",
"self",
".",
"options",
"[",
"'USER_ID'",
"]",
"if",
"len",
"(",
"username",
... | https://github.com/rsmusllp/termineter/blob/9311d6d995a7bf0f80853a00a115a8fa16aa0727/lib/termineter/core.py#L407-L453 | |
cyverse/atmosphere | 4a3e522f1f7b58abd9fa944c10b7455dc5cddac1 | api/v1/views/machine.py | python | MachineLicense.get | (self, request, provider_uuid, identity_uuid, machine_id) | return Response(serialized_data, status=status.HTTP_200_OK) | Lookup the machine information
(Lookup using the given provider/identity)
Update on server (If applicable) | Lookup the machine information
(Lookup using the given provider/identity)
Update on server (If applicable) | [
"Lookup",
"the",
"machine",
"information",
"(",
"Lookup",
"using",
"the",
"given",
"provider",
"/",
"identity",
")",
"Update",
"on",
"server",
"(",
"If",
"applicable",
")"
] | def get(self, request, provider_uuid, identity_uuid, machine_id):
"""
Lookup the machine information
(Lookup using the given provider/identity)
Update on server (If applicable)
"""
core_machine = ProviderMachine.objects.filter(
provider__uuid=provider_uuid, id... | [
"def",
"get",
"(",
"self",
",",
"request",
",",
"provider_uuid",
",",
"identity_uuid",
",",
"machine_id",
")",
":",
"core_machine",
"=",
"ProviderMachine",
".",
"objects",
".",
"filter",
"(",
"provider__uuid",
"=",
"provider_uuid",
",",
"identifier",
"=",
"mac... | https://github.com/cyverse/atmosphere/blob/4a3e522f1f7b58abd9fa944c10b7455dc5cddac1/api/v1/views/machine.py#L311-L328 | |
skylander86/lambda-text-extractor | 6da52d077a2fc571e38bfe29c33ae68f6443cd5a | lib-linux_x64/docx/parts/styles.py | python | StylesPart._default_styles_xml | (cls) | return xml_bytes | Return a bytestream containing XML for a default styles part. | Return a bytestream containing XML for a default styles part. | [
"Return",
"a",
"bytestream",
"containing",
"XML",
"for",
"a",
"default",
"styles",
"part",
"."
] | def _default_styles_xml(cls):
"""
Return a bytestream containing XML for a default styles part.
"""
path = os.path.join(
os.path.split(__file__)[0], '..', 'templates',
'default-styles.xml'
)
with open(path, 'rb') as f:
xml_bytes = f.rea... | [
"def",
"_default_styles_xml",
"(",
"cls",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"split",
"(",
"__file__",
")",
"[",
"0",
"]",
",",
"'..'",
",",
"'templates'",
",",
"'default-styles.xml'",
")",
"with",
"op... | https://github.com/skylander86/lambda-text-extractor/blob/6da52d077a2fc571e38bfe29c33ae68f6443cd5a/lib-linux_x64/docx/parts/styles.py#L45-L55 | |
keras-team/keras | 5caa668b6a415675064a730f5eb46ecc08e40f65 | keras/engine/keras_tensor.py | python | type_spec_with_shape | (spec, shape) | Returns a copy of TypeSpec `spec` with its shape set to `shape`. | Returns a copy of TypeSpec `spec` with its shape set to `shape`. | [
"Returns",
"a",
"copy",
"of",
"TypeSpec",
"spec",
"with",
"its",
"shape",
"set",
"to",
"shape",
"."
] | def type_spec_with_shape(spec, shape):
"""Returns a copy of TypeSpec `spec` with its shape set to `shape`."""
if isinstance(spec, tf.TensorSpec):
# pylint: disable=protected-access
# TODO(b/203201161) Figure out why mutation is needed here, and remove it.
# (TensorSpec objects should be immutable; and w... | [
"def",
"type_spec_with_shape",
"(",
"spec",
",",
"shape",
")",
":",
"if",
"isinstance",
"(",
"spec",
",",
"tf",
".",
"TensorSpec",
")",
":",
"# pylint: disable=protected-access",
"# TODO(b/203201161) Figure out why mutation is needed here, and remove it.",
"# (TensorSpec obje... | https://github.com/keras-team/keras/blob/5caa668b6a415675064a730f5eb46ecc08e40f65/keras/engine/keras_tensor.py#L631-L658 | ||
sabri-zaki/EasY_HaCk | 2a39ac384dd0d6fc51c0dd22e8d38cece683fdb9 | .modules/.sqlmap/thirdparty/clientform/clientform.py | python | urlencode | (query,doseq=False,) | return '&'.join(l) | Encode a sequence of two-element tuples or dictionary into a URL query \
string.
If any values in the query arg are sequences and doseq is true, each
sequence element is converted to a separate parameter.
If the query arg is a sequence of two-element tuples, the order of the
parameters in the output w... | Encode a sequence of two-element tuples or dictionary into a URL query \
string. | [
"Encode",
"a",
"sequence",
"of",
"two",
"-",
"element",
"tuples",
"or",
"dictionary",
"into",
"a",
"URL",
"query",
"\\",
"string",
"."
] | def urlencode(query,doseq=False,):
"""Encode a sequence of two-element tuples or dictionary into a URL query \
string.
If any values in the query arg are sequences and doseq is true, each
sequence element is converted to a separate parameter.
If the query arg is a sequence of two-element tuples, the o... | [
"def",
"urlencode",
"(",
"query",
",",
"doseq",
"=",
"False",
",",
")",
":",
"if",
"hasattr",
"(",
"query",
",",
"\"items\"",
")",
":",
"# mapping objects",
"query",
"=",
"query",
".",
"items",
"(",
")",
"else",
":",
"# it's a bother at times that strings an... | https://github.com/sabri-zaki/EasY_HaCk/blob/2a39ac384dd0d6fc51c0dd22e8d38cece683fdb9/.modules/.sqlmap/thirdparty/clientform/clientform.py#L151-L215 | |
GoogleCloudPlatform/appengine-mapreduce | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | python/src/mapreduce/api/map_job/map_job_config.py | python | JobConfig._get_default_mr_params | (cls) | return mr_params | Gets default values for old API. | Gets default values for old API. | [
"Gets",
"default",
"values",
"for",
"old",
"API",
"."
] | def _get_default_mr_params(cls):
"""Gets default values for old API."""
cfg = cls(_lenient=True)
mr_params = cfg._get_mr_params()
mr_params["api_version"] = 0
return mr_params | [
"def",
"_get_default_mr_params",
"(",
"cls",
")",
":",
"cfg",
"=",
"cls",
"(",
"_lenient",
"=",
"True",
")",
"mr_params",
"=",
"cfg",
".",
"_get_mr_params",
"(",
")",
"mr_params",
"[",
"\"api_version\"",
"]",
"=",
"0",
"return",
"mr_params"
] | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/api/map_job/map_job_config.py#L154-L159 | |
wwqgtxx/wwqLyParse | 33136508e52821babd9294fdecffbdf02d73a6fc | wwqLyParse/lib/aiohttp_lib/attr/filters.py | python | _split_what | (what) | return (
frozenset(cls for cls in what if isclass(cls)),
frozenset(cls for cls in what if isinstance(cls, Attribute)),
) | Returns a tuple of `frozenset`s of classes and attributes. | Returns a tuple of `frozenset`s of classes and attributes. | [
"Returns",
"a",
"tuple",
"of",
"frozenset",
"s",
"of",
"classes",
"and",
"attributes",
"."
] | def _split_what(what):
"""
Returns a tuple of `frozenset`s of classes and attributes.
"""
return (
frozenset(cls for cls in what if isclass(cls)),
frozenset(cls for cls in what if isinstance(cls, Attribute)),
) | [
"def",
"_split_what",
"(",
"what",
")",
":",
"return",
"(",
"frozenset",
"(",
"cls",
"for",
"cls",
"in",
"what",
"if",
"isclass",
"(",
"cls",
")",
")",
",",
"frozenset",
"(",
"cls",
"for",
"cls",
"in",
"what",
"if",
"isinstance",
"(",
"cls",
",",
"... | https://github.com/wwqgtxx/wwqLyParse/blob/33136508e52821babd9294fdecffbdf02d73a6fc/wwqLyParse/lib/aiohttp_lib/attr/filters.py#L11-L18 | |
antspy/quantized_distillation | bb500b7ae48a3f6751d6434126de9845b58d2d65 | translation_models/help_fun.py | python | get_bleu_model | (model, dataset, options_model, options_translate=None, percentages_to_show=25, verbose=False) | return bleu | get bleu scores given a model and a dataset. it uses get_bleu_moses to compute the scores | get bleu scores given a model and a dataset. it uses get_bleu_moses to compute the scores | [
"get",
"bleu",
"scores",
"given",
"a",
"model",
"and",
"a",
"dataset",
".",
"it",
"uses",
"get_bleu_moses",
"to",
"compute",
"the",
"scores"
] | def get_bleu_model(model, dataset, options_model, options_translate=None, percentages_to_show=25, verbose=False):
'get bleu scores given a model and a dataset. it uses get_bleu_moses to compute the scores'
reference_file = dataset.testFilesPath[1]
hypothesis_file = get_translation_file_model(model, datase... | [
"def",
"get_bleu_model",
"(",
"model",
",",
"dataset",
",",
"options_model",
",",
"options_translate",
"=",
"None",
",",
"percentages_to_show",
"=",
"25",
",",
"verbose",
"=",
"False",
")",
":",
"reference_file",
"=",
"dataset",
".",
"testFilesPath",
"[",
"1",... | https://github.com/antspy/quantized_distillation/blob/bb500b7ae48a3f6751d6434126de9845b58d2d65/translation_models/help_fun.py#L371-L381 | |
AlexxIT/YandexStation | 34c9fe2b29b856c8d92b186558480c868fe9ec1e | custom_components/yandex_station/core/yandex_session.py | python | YandexSession.get_qr | (self) | return "https://passport.yandex.ru/auth/magic/code/?track_id=" + \
resp["track_id"] | Get link to QR-code auth. | Get link to QR-code auth. | [
"Get",
"link",
"to",
"QR",
"-",
"code",
"auth",
"."
] | async def get_qr(self) -> str:
"""Get link to QR-code auth."""
# step 1: csrf_token
r = await self.session.get(
"https://passport.yandex.ru/am?app_platform=android",
proxy=self.proxy
)
resp = await r.text()
m = re.search(r'"csrf_token" value="([^"]... | [
"async",
"def",
"get_qr",
"(",
"self",
")",
"->",
"str",
":",
"# step 1: csrf_token",
"r",
"=",
"await",
"self",
".",
"session",
".",
"get",
"(",
"\"https://passport.yandex.ru/am?app_platform=android\"",
",",
"proxy",
"=",
"self",
".",
"proxy",
")",
"resp",
"=... | https://github.com/AlexxIT/YandexStation/blob/34c9fe2b29b856c8d92b186558480c868fe9ec1e/custom_components/yandex_station/core/yandex_session.py#L172-L202 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/konnected/binary_sensor.py | python | async_setup_entry | (
hass: HomeAssistant,
config_entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
) | Set up binary sensors attached to a Konnected device from a config entry. | Set up binary sensors attached to a Konnected device from a config entry. | [
"Set",
"up",
"binary",
"sensors",
"attached",
"to",
"a",
"Konnected",
"device",
"from",
"a",
"config",
"entry",
"."
] | async def async_setup_entry(
hass: HomeAssistant,
config_entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
) -> None:
"""Set up binary sensors attached to a Konnected device from a config entry."""
data = hass.data[KONNECTED_DOMAIN]
device_id = config_entry.data["id"]
sensors = [
... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"config_entry",
":",
"ConfigEntry",
",",
"async_add_entities",
":",
"AddEntitiesCallback",
",",
")",
"->",
"None",
":",
"data",
"=",
"hass",
".",
"data",
"[",
"KONNECTED_DOMAIN",
"]",
... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/konnected/binary_sensor.py#L20-L34 | ||
fcurella/django-recommends | e69820f70c9f7935850c63e01b141ac06cf58e0d | recommends/providers/__init__.py | python | RecommendationProvider.get_rating_item | (self, rating) | Returns the rated object. | Returns the rated object. | [
"Returns",
"the",
"rated",
"object",
"."
] | def get_rating_item(self, rating):
"""Returns the rated object."""
raise NotImplementedError | [
"def",
"get_rating_item",
"(",
"self",
",",
"rating",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/fcurella/django-recommends/blob/e69820f70c9f7935850c63e01b141ac06cf58e0d/recommends/providers/__init__.py#L112-L114 | ||
celery/django-celery | c679b05b2abc174e6fa3231b120a07b49ec8f911 | djcelery/schedulers.py | python | ModelEntry.__init__ | (self, model) | [] | def __init__(self, model):
self.app = current_app._get_current_object()
self.name = model.name
self.task = model.task
try:
self.schedule = model.schedule
except model.DoesNotExist:
logger.error('Schedule was removed from database')
logger.warni... | [
"def",
"__init__",
"(",
"self",
",",
"model",
")",
":",
"self",
".",
"app",
"=",
"current_app",
".",
"_get_current_object",
"(",
")",
"self",
".",
"name",
"=",
"model",
".",
"name",
"self",
".",
"task",
"=",
"model",
".",
"task",
"try",
":",
"self",
... | https://github.com/celery/django-celery/blob/c679b05b2abc174e6fa3231b120a07b49ec8f911/djcelery/schedulers.py#L46-L77 | ||||
cherrypy/cherrypy | a7983fe61f7237f2354915437b04295694100372 | cherrypy/lib/sessions.py | python | init | (storage_type=None, path=None, path_header=None, name='session_id',
timeout=60, domain=None, secure=False, clean_freq=5,
persistent=True, httponly=False, debug=False,
# Py27 compat
# *, storage_class=RamSession,
**kwargs) | Initialize session object (using cookies).
storage_class
The Session subclass to use. Defaults to RamSession.
storage_type
(deprecated)
One of 'ram', 'file', memcached'. This will be
used to look up the corresponding class in cherrypy.lib.sessions
globals. For example, ... | Initialize session object (using cookies). | [
"Initialize",
"session",
"object",
"(",
"using",
"cookies",
")",
"."
] | def init(storage_type=None, path=None, path_header=None, name='session_id',
timeout=60, domain=None, secure=False, clean_freq=5,
persistent=True, httponly=False, debug=False,
# Py27 compat
# *, storage_class=RamSession,
**kwargs):
"""Initialize session object (using cook... | [
"def",
"init",
"(",
"storage_type",
"=",
"None",
",",
"path",
"=",
"None",
",",
"path_header",
"=",
"None",
",",
"name",
"=",
"'session_id'",
",",
"timeout",
"=",
"60",
",",
"domain",
"=",
"None",
",",
"secure",
"=",
"False",
",",
"clean_freq",
"=",
... | https://github.com/cherrypy/cherrypy/blob/a7983fe61f7237f2354915437b04295694100372/cherrypy/lib/sessions.py#L722-L836 | ||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/crypto/lwe.py | python | LWE._repr_ | (self) | EXAMPLES::
sage: from sage.stats.distributions.discrete_gaussian_integer import DiscreteGaussianDistributionIntegerSampler
sage: from sage.crypto.lwe import LWE
sage: D = DiscreteGaussianDistributionIntegerSampler(3.0)
sage: lwe = LWE(n=20, q=next_prime(400), D=D); lwe
... | EXAMPLES:: | [
"EXAMPLES",
"::"
] | def _repr_(self):
"""
EXAMPLES::
sage: from sage.stats.distributions.discrete_gaussian_integer import DiscreteGaussianDistributionIntegerSampler
sage: from sage.crypto.lwe import LWE
sage: D = DiscreteGaussianDistributionIntegerSampler(3.0)
sage: lwe = LW... | [
"def",
"_repr_",
"(",
"self",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"secret_dist",
",",
"str",
")",
":",
"return",
"\"LWE(%d, %d, %s, '%s', %s)\"",
"%",
"(",
"self",
".",
"n",
",",
"self",
".",
"K",
".",
"order",
"(",
")",
",",
"self",
".",... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/crypto/lwe.py#L330-L346 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.