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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
baidu/CUP | 79ab2f3ad6eaab1461aa3b4cca37d3262240194a | cup/storage/obj.py | python | ObjectInterface.put | (self, dest, localfile) | :param dest:
system path
:param localfile:
localfile
:return:
{
'returncode': 0 for success, others for failure,
'msg': 'if any'
} | :param dest:
system path
:param localfile:
localfile | [
":",
"param",
"dest",
":",
"system",
"path",
":",
"param",
"localfile",
":",
"localfile"
] | def put(self, dest, localfile):
"""
:param dest:
system path
:param localfile:
localfile
:return:
{
'returncode': 0 for success, others for failure,
'msg': 'if any'
}
""" | [
"def",
"put",
"(",
"self",
",",
"dest",
",",
"localfile",
")",
":"
] | https://github.com/baidu/CUP/blob/79ab2f3ad6eaab1461aa3b4cca37d3262240194a/cup/storage/obj.py#L56-L68 | ||
openedx/edx-platform | 68dd185a0ab45862a2a61e0f803d7e03d2be71b5 | lms/djangoapps/instructor_task/subtasks.py | python | SubtaskStatus.__repr__ | (self) | return f'SubtaskStatus<{self.to_dict()!r}>' | Return print representation of a SubtaskStatus object. | Return print representation of a SubtaskStatus object. | [
"Return",
"print",
"representation",
"of",
"a",
"SubtaskStatus",
"object",
"."
] | def __repr__(self):
"""Return print representation of a SubtaskStatus object."""
return f'SubtaskStatus<{self.to_dict()!r}>' | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"f'SubtaskStatus<{self.to_dict()!r}>'"
] | https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/lms/djangoapps/instructor_task/subtasks.py#L203-L205 | |
enthought/traitsui | b7c38c7a47bf6ae7971f9ddab70c8a358647dd25 | traitsui/qt4/button_editor.py | python | SimpleEditor.dispose | (self) | Disposes of the contents of an editor. | Disposes of the contents of an editor. | [
"Disposes",
"of",
"the",
"contents",
"of",
"an",
"editor",
"."
] | def dispose(self):
"""Disposes of the contents of an editor."""
if self.factory.values_trait:
self.object.observe(
self._update_menu,
self.factory.values_trait + ".items",
remove=True,
)
if self.control is not None:
... | [
"def",
"dispose",
"(",
"self",
")",
":",
"if",
"self",
".",
"factory",
".",
"values_trait",
":",
"self",
".",
"object",
".",
"observe",
"(",
"self",
".",
"_update_menu",
",",
"self",
".",
"factory",
".",
"values_trait",
"+",
"\".items\"",
",",
"remove",
... | https://github.com/enthought/traitsui/blob/b7c38c7a47bf6ae7971f9ddab70c8a358647dd25/traitsui/qt4/button_editor.py#L85-L97 | ||
SigmaHQ/sigma | 6f7d28b52a6468b2430e8d7dfefb79dc01e2f1af | tools/sigma/backends/humio.py | python | HumioBackend.generateANDNode | (self, node) | [] | def generateANDNode(self, node):
generated = [self.generateNode(val) for val in node]
filtered = [g for g in generated if g is not None]
if filtered:
if self.sort_condition_lists:
filtered = sorted(filtered)
if any([item for item in filtered if "regex" in ... | [
"def",
"generateANDNode",
"(",
"self",
",",
"node",
")",
":",
"generated",
"=",
"[",
"self",
".",
"generateNode",
"(",
"val",
")",
"for",
"val",
"in",
"node",
"]",
"filtered",
"=",
"[",
"g",
"for",
"g",
"in",
"generated",
"if",
"g",
"is",
"not",
"N... | https://github.com/SigmaHQ/sigma/blob/6f7d28b52a6468b2430e8d7dfefb79dc01e2f1af/tools/sigma/backends/humio.py#L63-L81 | ||||
pycket/pycket | 05ebd9885efa3a0ae54e77c1a1f07ea441b445c6 | pycket/small_list.py | python | inline_small_list | (sizemax=11, sizemin=0, immutable=False, unbox_num=False, nonull=False,
attrname="list", factoryname="make", listgettername="_get_full_list",
listsizename="_get_size_list", gettername="_get_list",
settername="_set_list") | return wrapper | This function is helpful if you have a class with a field storing a
list and the list is often very small. Calling this function will inline
the list into instances for the small sizes. This works by adding the
following methods (names customizable) to the class:
_get_list(self, i): return ith element ... | This function is helpful if you have a class with a field storing a
list and the list is often very small. Calling this function will inline
the list into instances for the small sizes. This works by adding the
following methods (names customizable) to the class: | [
"This",
"function",
"is",
"helpful",
"if",
"you",
"have",
"a",
"class",
"with",
"a",
"field",
"storing",
"a",
"list",
"and",
"the",
"list",
"is",
"often",
"very",
"small",
".",
"Calling",
"this",
"function",
"will",
"inline",
"the",
"list",
"into",
"inst... | def inline_small_list(sizemax=11, sizemin=0, immutable=False, unbox_num=False, nonull=False,
attrname="list", factoryname="make", listgettername="_get_full_list",
listsizename="_get_size_list", gettername="_get_list",
settername="_set_list"):
"""
... | [
"def",
"inline_small_list",
"(",
"sizemax",
"=",
"11",
",",
"sizemin",
"=",
"0",
",",
"immutable",
"=",
"False",
",",
"unbox_num",
"=",
"False",
",",
"nonull",
"=",
"False",
",",
"attrname",
"=",
"\"list\"",
",",
"factoryname",
"=",
"\"make\"",
",",
"lis... | https://github.com/pycket/pycket/blob/05ebd9885efa3a0ae54e77c1a1f07ea441b445c6/pycket/small_list.py#L13-L200 | |
hzlzh/AlfredWorkflow.com | 7055f14f6922c80ea5943839eb0caff11ae57255 | Sources/Workflows/快递速查/requests/sessions.py | python | Session.request | (self, method, url,
params=None,
data=None,
headers=None,
cookies=None,
files=None,
auth=None,
timeout=None,
allow_redirects=True,
proxies=None,
hooks=None,
stream=None,
verify=None,
cert=None) | return resp | Constructs a :class:`Request <Request>`, prepares it and sends it.
Returns :class:`Response <Response>` object.
:param method: method for the new :class:`Request` object.
:param url: URL for the new :class:`Request` object.
:param params: (optional) Dictionary or bytes to be sent in the... | Constructs a :class:`Request <Request>`, prepares it and sends it.
Returns :class:`Response <Response>` object. | [
"Constructs",
"a",
":",
"class",
":",
"Request",
"<Request",
">",
"prepares",
"it",
"and",
"sends",
"it",
".",
"Returns",
":",
"class",
":",
"Response",
"<Response",
">",
"object",
"."
] | def request(self, method, url,
params=None,
data=None,
headers=None,
cookies=None,
files=None,
auth=None,
timeout=None,
allow_redirects=True,
proxies=None,
hooks=None,
stream=None,
verify=None,
cert=None):
""... | [
"def",
"request",
"(",
"self",
",",
"method",
",",
"url",
",",
"params",
"=",
"None",
",",
"data",
"=",
"None",
",",
"headers",
"=",
"None",
",",
"cookies",
"=",
"None",
",",
"files",
"=",
"None",
",",
"auth",
"=",
"None",
",",
"timeout",
"=",
"N... | https://github.com/hzlzh/AlfredWorkflow.com/blob/7055f14f6922c80ea5943839eb0caff11ae57255/Sources/Workflows/快递速查/requests/sessions.py#L235-L346 | |
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/Xenotix Python Scripting Engine/bin/x86/Debug/Lib/pprint.py | python | pprint | (object, stream=None, indent=1, width=80, depth=None) | Pretty-print a Python object to a stream [default is sys.stdout]. | Pretty-print a Python object to a stream [default is sys.stdout]. | [
"Pretty",
"-",
"print",
"a",
"Python",
"object",
"to",
"a",
"stream",
"[",
"default",
"is",
"sys",
".",
"stdout",
"]",
"."
] | def pprint(object, stream=None, indent=1, width=80, depth=None):
"""Pretty-print a Python object to a stream [default is sys.stdout]."""
printer = PrettyPrinter(
stream=stream, indent=indent, width=width, depth=depth)
printer.pprint(object) | [
"def",
"pprint",
"(",
"object",
",",
"stream",
"=",
"None",
",",
"indent",
"=",
"1",
",",
"width",
"=",
"80",
",",
"depth",
"=",
"None",
")",
":",
"printer",
"=",
"PrettyPrinter",
"(",
"stream",
"=",
"stream",
",",
"indent",
"=",
"indent",
",",
"wi... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/bin/x86/Debug/Lib/pprint.py#L52-L56 | ||
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/apps/aggregate_ucrs/models.py | python | AggregateTableDefinition.get_secondary_tables_and_adapters | (self) | return [
(table, get_indicator_adapter(table.data_source).get_table())
for table in self.secondary_tables.all()
] | [] | def get_secondary_tables_and_adapters(self):
return [
(table, get_indicator_adapter(table.data_source).get_table())
for table in self.secondary_tables.all()
] | [
"def",
"get_secondary_tables_and_adapters",
"(",
"self",
")",
":",
"return",
"[",
"(",
"table",
",",
"get_indicator_adapter",
"(",
"table",
".",
"data_source",
")",
".",
"get_table",
"(",
")",
")",
"for",
"table",
"in",
"self",
".",
"secondary_tables",
".",
... | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/aggregate_ucrs/models.py#L141-L145 | |||
PaddlePaddle/PGL | e48545f2814523c777b8a9a9188bf5a7f00d6e52 | legacy/pgl/graph_wrapper.py | python | StaticGraphWrapper.__create_graph_node_feat | (self, node_feat, collector) | Convert node features into paddlepaddle tensor. | Convert node features into paddlepaddle tensor. | [
"Convert",
"node",
"features",
"into",
"paddlepaddle",
"tensor",
"."
] | def __create_graph_node_feat(self, node_feat, collector):
"""Convert node features into paddlepaddle tensor.
"""
for node_feat_name, node_feat_value in node_feat.items():
node_feat_shape = node_feat_value.shape
node_feat_dtype = node_feat_value.dtype
self.node... | [
"def",
"__create_graph_node_feat",
"(",
"self",
",",
"node_feat",
",",
"collector",
")",
":",
"for",
"node_feat_name",
",",
"node_feat_value",
"in",
"node_feat",
".",
"items",
"(",
")",
":",
"node_feat_shape",
"=",
"node_feat_value",
".",
"shape",
"node_feat_dtype... | https://github.com/PaddlePaddle/PGL/blob/e48545f2814523c777b8a9a9188bf5a7f00d6e52/legacy/pgl/graph_wrapper.py#L438-L450 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/werkzeug/contrib/cache.py | python | RedisCache.clear | (self) | return status | [] | def clear(self):
status = False
if self.key_prefix:
keys = self._client.keys(self.key_prefix + '*')
if keys:
status = self._client.delete(*keys)
else:
status = self._client.flushdb()
return status | [
"def",
"clear",
"(",
"self",
")",
":",
"status",
"=",
"False",
"if",
"self",
".",
"key_prefix",
":",
"keys",
"=",
"self",
".",
"_client",
".",
"keys",
"(",
"self",
".",
"key_prefix",
"+",
"'*'",
")",
"if",
"keys",
":",
"status",
"=",
"self",
".",
... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/werkzeug/contrib/cache.py#L670-L678 | |||
LinOTP/LinOTP | bb3940bbaccea99550e6c063ff824f258dd6d6d7 | linotp/lib/resolver.py | python | _flush_user_resolver_cache | (resolver_spec) | flush the user realm cache
in case of a change of the resolver, all realms which use
this resolver must be flushed
:param resolver_spec: the resolve which has been updated
:return: - nothing - | flush the user realm cache
in case of a change of the resolver, all realms which use
this resolver must be flushed | [
"flush",
"the",
"user",
"realm",
"cache",
"in",
"case",
"of",
"a",
"change",
"of",
"the",
"resolver",
"all",
"realms",
"which",
"use",
"this",
"resolver",
"must",
"be",
"flushed"
] | def _flush_user_resolver_cache(resolver_spec):
"""
flush the user realm cache
in case of a change of the resolver, all realms which use
this resolver must be flushed
:param resolver_spec: the resolve which has been updated
:return: - nothing -
"""
from linotp.lib.user import (
... | [
"def",
"_flush_user_resolver_cache",
"(",
"resolver_spec",
")",
":",
"from",
"linotp",
".",
"lib",
".",
"user",
"import",
"(",
"delete_realm_resolver_cache",
",",
"delete_resolver_user_cache",
",",
")",
"delete_resolver_user_cache",
"(",
"resolver_spec",
")",
"config",
... | https://github.com/LinOTP/LinOTP/blob/bb3940bbaccea99550e6c063ff824f258dd6d6d7/linotp/lib/resolver.py#L685-L709 | ||
eandersson/amqpstorm | 7f57cf1291c8b3817527c10aae317aa1702654bc | amqpstorm/io.py | python | IO._process_incoming_data | (self) | Retrieve and process any incoming data.
:return: | Retrieve and process any incoming data. | [
"Retrieve",
"and",
"process",
"any",
"incoming",
"data",
"."
] | def _process_incoming_data(self):
"""Retrieve and process any incoming data.
:return:
"""
while self._running.is_set():
if self.poller.is_ready:
self.data_in += self._receive()
self.data_in = self._on_read_impl(self.data_in) | [
"def",
"_process_incoming_data",
"(",
"self",
")",
":",
"while",
"self",
".",
"_running",
".",
"is_set",
"(",
")",
":",
"if",
"self",
".",
"poller",
".",
"is_ready",
":",
"self",
".",
"data_in",
"+=",
"self",
".",
"_receive",
"(",
")",
"self",
".",
"... | https://github.com/eandersson/amqpstorm/blob/7f57cf1291c8b3817527c10aae317aa1702654bc/amqpstorm/io.py#L253-L261 | ||
msracver/Deformable-ConvNets | 6aeda878a95bcb55eadffbe125804e730574de8d | deeplab/core/module.py | python | Module.load | (prefix, epoch, load_optimizer_states=False, **kwargs) | return mod | Create a model from previously saved checkpoint.
Parameters
----------
prefix : str
path prefix of saved model files. You should have
"prefix-symbol.json", "prefix-xxxx.params", and
optionally "prefix-xxxx.states", where xxxx is the
epoch number.
... | Create a model from previously saved checkpoint. | [
"Create",
"a",
"model",
"from",
"previously",
"saved",
"checkpoint",
"."
] | def load(prefix, epoch, load_optimizer_states=False, **kwargs):
"""Create a model from previously saved checkpoint.
Parameters
----------
prefix : str
path prefix of saved model files. You should have
"prefix-symbol.json", "prefix-xxxx.params", and
op... | [
"def",
"load",
"(",
"prefix",
",",
"epoch",
",",
"load_optimizer_states",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"sym",
",",
"args",
",",
"auxs",
"=",
"load_checkpoint",
"(",
"prefix",
",",
"epoch",
")",
"mod",
"=",
"Module",
"(",
"symbol",
... | https://github.com/msracver/Deformable-ConvNets/blob/6aeda878a95bcb55eadffbe125804e730574de8d/deeplab/core/module.py#L110-L146 | |
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Lib/repr.py | python | Repr.repr_set | (self, x, level) | return self._repr_iterable(x, level, 'set([', '])', self.maxset) | [] | def repr_set(self, x, level):
x = _possibly_sorted(x)
return self._repr_iterable(x, level, 'set([', '])', self.maxset) | [
"def",
"repr_set",
"(",
"self",
",",
"x",
",",
"level",
")",
":",
"x",
"=",
"_possibly_sorted",
"(",
"x",
")",
"return",
"self",
".",
"_repr_iterable",
"(",
"x",
",",
"level",
",",
"'set(['",
",",
"'])'",
",",
"self",
".",
"maxset",
")"
] | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/repr.py#L64-L66 | |||
mlcommons/ck | 558a22c5970eb0d6708d0edc080e62a92566bab0 | ck/repo/module/result/module.py | python | postprocess_html | (i) | return {'return':0, 'html':h} | Input: {
html - html to post-process
original_input (dict) - passing extra parameters from URL
}
Output: {
return - return code = 0, if successful
> 0, if error
(error) - error text if return... | Input: {
html - html to post-process | [
"Input",
":",
"{",
"html",
"-",
"html",
"to",
"post",
"-",
"process"
] | def postprocess_html(i):
"""
Input: {
html - html to post-process
original_input (dict) - passing extra parameters from URL
}
Output: {
return - return code = 0, if successful
> 0, if error
... | [
"def",
"postprocess_html",
"(",
"i",
")",
":",
"h",
"=",
"i",
"[",
"'html'",
"]",
"# Substitutions",
"sub",
"=",
"{",
"'ck_html_title'",
":",
"''",
",",
"'ck_html_title_main'",
":",
"''",
",",
"'ck_html_title_note'",
":",
"''",
",",
"'ck_html_end_note'",
":"... | https://github.com/mlcommons/ck/blob/558a22c5970eb0d6708d0edc080e62a92566bab0/ck/repo/module/result/module.py#L234-L291 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/django/contrib/gis/db/backends/mysql/schema.py | python | MySQLGISSchemaEditor.remove_field | (self, model, field) | [] | def remove_field(self, model, field):
if isinstance(field, GeometryField) and field.spatial_index:
qn = self.connection.ops.quote_name
sql = self.sql_drop_spatial_index % {
'index': qn(self._create_spatial_index_name(model, field)),
'table': qn(model._meta... | [
"def",
"remove_field",
"(",
"self",
",",
"model",
",",
"field",
")",
":",
"if",
"isinstance",
"(",
"field",
",",
"GeometryField",
")",
"and",
"field",
".",
"spatial_index",
":",
"qn",
"=",
"self",
".",
"connection",
".",
"ops",
".",
"quote_name",
"sql",
... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/django/contrib/gis/db/backends/mysql/schema.py#L48-L63 | ||||
Pylons/substanced | a897f4a0518c51b6e093cc5af39fa326f23752c2 | substanced/event/__init__.py | python | add_content_subscriber | (config, subscriber, iface=None, **predicates) | Configurator directive that works like Pyramid's ``add_subscriber``,
except it wraps the subscriber in something that first adds the
``registry`` attribute to the event being sent before the wrapped
subscriber is called. | Configurator directive that works like Pyramid's ``add_subscriber``,
except it wraps the subscriber in something that first adds the
``registry`` attribute to the event being sent before the wrapped
subscriber is called. | [
"Configurator",
"directive",
"that",
"works",
"like",
"Pyramid",
"s",
"add_subscriber",
"except",
"it",
"wraps",
"the",
"subscriber",
"in",
"something",
"that",
"first",
"adds",
"the",
"registry",
"attribute",
"to",
"the",
"event",
"being",
"sent",
"before",
"th... | def add_content_subscriber(config, subscriber, iface=None, **predicates):
""" Configurator directive that works like Pyramid's ``add_subscriber``,
except it wraps the subscriber in something that first adds the
``registry`` attribute to the event being sent before the wrapped
subscriber is called."""
... | [
"def",
"add_content_subscriber",
"(",
"config",
",",
"subscriber",
",",
"iface",
"=",
"None",
",",
"*",
"*",
"predicates",
")",
":",
"registry",
"=",
"config",
".",
"registry",
"def",
"wrapper",
"(",
"event",
",",
"*",
"arg",
")",
":",
"# *arg ignored, XXX... | https://github.com/Pylons/substanced/blob/a897f4a0518c51b6e093cc5af39fa326f23752c2/substanced/event/__init__.py#L271-L283 | ||
merkremont/LineVodka | c2fa74107cecf00dd17416b62e4eb579e2c7bbaf | LineAlpha/LineThrift/TalkService.py | python | Client.report | (self, syncOpRevision, category, report) | Parameters:
- syncOpRevision
- category
- report | Parameters:
- syncOpRevision
- category
- report | [
"Parameters",
":",
"-",
"syncOpRevision",
"-",
"category",
"-",
"report"
] | def report(self, syncOpRevision, category, report):
"""
Parameters:
- syncOpRevision
- category
- report
"""
self.send_report(syncOpRevision, category, report)
self.recv_report() | [
"def",
"report",
"(",
"self",
",",
"syncOpRevision",
",",
"category",
",",
"report",
")",
":",
"self",
".",
"send_report",
"(",
"syncOpRevision",
",",
"category",
",",
"report",
")",
"self",
".",
"recv_report",
"(",
")"
] | https://github.com/merkremont/LineVodka/blob/c2fa74107cecf00dd17416b62e4eb579e2c7bbaf/LineAlpha/LineThrift/TalkService.py#L5920-L5928 | ||
Abjad/abjad | d0646dfbe83db3dc5ab268f76a0950712b87b7fd | abjad/parsers/parser.py | python | LilyPondSyntacticalDefinition.p_post_event_nofinger__Chr94__fingering | (self, p) | post_event_nofinger : '^' fingering | post_event_nofinger : '^' fingering | [
"post_event_nofinger",
":",
"^",
"fingering"
] | def p_post_event_nofinger__Chr94__fingering(self, p):
"post_event_nofinger : '^' fingering"
p[0] = None | [
"def",
"p_post_event_nofinger__Chr94__fingering",
"(",
"self",
",",
"p",
")",
":",
"p",
"[",
"0",
"]",
"=",
"None"
] | https://github.com/Abjad/abjad/blob/d0646dfbe83db3dc5ab268f76a0950712b87b7fd/abjad/parsers/parser.py#L6074-L6076 | ||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/sandpiles/sandpile.py | python | SandpileDivisor.deg | (self) | return self._deg | r"""
The degree of the divisor.
OUTPUT:
integer
EXAMPLES::
sage: S = sandpiles.Cycle(3)
sage: D = SandpileDivisor(S, [1,2,3])
sage: D.deg()
6 | r"""
The degree of the divisor. | [
"r",
"The",
"degree",
"of",
"the",
"divisor",
"."
] | def deg(self):
r"""
The degree of the divisor.
OUTPUT:
integer
EXAMPLES::
sage: S = sandpiles.Cycle(3)
sage: D = SandpileDivisor(S, [1,2,3])
sage: D.deg()
6
"""
return self._deg | [
"def",
"deg",
"(",
"self",
")",
":",
"return",
"self",
".",
"_deg"
] | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/sandpiles/sandpile.py#L4433-L4448 | |
FederatedAI/FATE | 32540492623568ecd1afcb367360133616e02fa3 | python/federatedml/ensemble/boosting/homo/homo_secureboosting_aggregator.py | python | DecisionTreeArbiterAggregator.__init__ | (self, verbose=False) | [] | def __init__(self, verbose=False):
self.aggregator = secure_sum_aggregator.Server(enable_secure_aggregate=True)
self.scatter = loss_scatter.Server()
self.verbose = verbose | [
"def",
"__init__",
"(",
"self",
",",
"verbose",
"=",
"False",
")",
":",
"self",
".",
"aggregator",
"=",
"secure_sum_aggregator",
".",
"Server",
"(",
"enable_secure_aggregate",
"=",
"True",
")",
"self",
".",
"scatter",
"=",
"loss_scatter",
".",
"Server",
"(",... | https://github.com/FederatedAI/FATE/blob/32540492623568ecd1afcb367360133616e02fa3/python/federatedml/ensemble/boosting/homo/homo_secureboosting_aggregator.py#L51-L54 | ||||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/billiard/_win.py | python | get_processtree_pids | (pid, include_parent=True) | return list(pids) | Return a list with all the pids of a process tree | Return a list with all the pids of a process tree | [
"Return",
"a",
"list",
"with",
"all",
"the",
"pids",
"of",
"a",
"process",
"tree"
] | def get_processtree_pids(pid, include_parent=True):
"""Return a list with all the pids of a process tree"""
parents = get_all_processes_pids()
all_pids = list(parents.keys())
pids = {pid}
while 1:
pids_new = pids.copy()
for _pid in all_pids:
if parents[_pid] in pids:
... | [
"def",
"get_processtree_pids",
"(",
"pid",
",",
"include_parent",
"=",
"True",
")",
":",
"parents",
"=",
"get_all_processes_pids",
"(",
")",
"all_pids",
"=",
"list",
"(",
"parents",
".",
"keys",
"(",
")",
")",
"pids",
"=",
"{",
"pid",
"}",
"while",
"1",
... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/billiard/_win.py#L88-L108 | |
iniqua/plecost | ef0d89bfdf1ef870bd11b1d8bdf93a8ce9ec6ca0 | plecost_lib/libs/db.py | python | db_query | (data) | return _actions[data.action](data, db) | Query the database and return a text with the information.
:param data: PlecostDatabaseQuery object
:type data: PlecostDatabaseQuery
:return: results of query
:rtype: str | Query the database and return a text with the information. | [
"Query",
"the",
"database",
"and",
"return",
"a",
"text",
"with",
"the",
"information",
"."
] | def db_query(data):
"""
Query the database and return a text with the information.
:param data: PlecostDatabaseQuery object
:type data: PlecostDatabaseQuery
:return: results of query
:rtype: str
"""
if not isinstance(data, PlecostDatabaseQuery):
raise TypeError("Expected Pleco... | [
"def",
"db_query",
"(",
"data",
")",
":",
"if",
"not",
"isinstance",
"(",
"data",
",",
"PlecostDatabaseQuery",
")",
":",
"raise",
"TypeError",
"(",
"\"Expected PlecostDatabaseQuery, got '%s' instead\"",
"%",
"type",
"(",
"data",
")",
")",
"_actions",
"=",
"dict"... | https://github.com/iniqua/plecost/blob/ef0d89bfdf1ef870bd11b1d8bdf93a8ce9ec6ca0/plecost_lib/libs/db.py#L373-L393 | |
Alexander-H-Liu/End-to-end-ASR-Pytorch | 1103d144423e8e692f1d18cd9db27a96cb49fb9d | src/asr.py | python | Decoder.forward | (self, x) | return char, x | Decode and transform into vocab | Decode and transform into vocab | [
"Decode",
"and",
"transform",
"into",
"vocab"
] | def forward(self, x):
''' Decode and transform into vocab '''
if not self.training:
self.layers.flatten_parameters()
x, self.hidden_state = self.layers(x.unsqueeze(1), self.hidden_state)
x = x.squeeze(1)
char = self.char_trans(self.final_dropout(x))
return cha... | [
"def",
"forward",
"(",
"self",
",",
"x",
")",
":",
"if",
"not",
"self",
".",
"training",
":",
"self",
".",
"layers",
".",
"flatten_parameters",
"(",
")",
"x",
",",
"self",
".",
"hidden_state",
"=",
"self",
".",
"layers",
"(",
"x",
".",
"unsqueeze",
... | https://github.com/Alexander-H-Liu/End-to-end-ASR-Pytorch/blob/1103d144423e8e692f1d18cd9db27a96cb49fb9d/src/asr.py#L214-L221 | |
wannabeOG/Mask-RCNN | b6ce3d8795eeaccbbde6d91ec827a38df3a88a4c | utils.py | python | Dataset.prepare | (self, class_map=None) | Prepares the Dataset class for use.
TODO: class map is not supported yet. When done, it should handle mapping
classes from different datasets to the same class ID. | Prepares the Dataset class for use. | [
"Prepares",
"the",
"Dataset",
"class",
"for",
"use",
"."
] | def prepare(self, class_map=None):
"""Prepares the Dataset class for use.
TODO: class map is not supported yet. When done, it should handle mapping
classes from different datasets to the same class ID.
"""
def clean_name(name):
"""Returns a shorter version of o... | [
"def",
"prepare",
"(",
"self",
",",
"class_map",
"=",
"None",
")",
":",
"def",
"clean_name",
"(",
"name",
")",
":",
"\"\"\"Returns a shorter version of object names for cleaner display.\"\"\"",
"return",
"\",\"",
".",
"join",
"(",
"name",
".",
"split",
"(",
"\",\"... | https://github.com/wannabeOG/Mask-RCNN/blob/b6ce3d8795eeaccbbde6d91ec827a38df3a88a4c/utils.py#L203-L233 | ||
NVlabs/stylegan2 | bf0fe0baba9fc7039eae0cac575c1778be1ce3e3 | dnnlib/tflib/optimizer.py | python | SimpleAdam.apply_gradients | (self, grads_and_vars) | [] | def apply_gradients(self, grads_and_vars):
with tf.name_scope(self.name):
state_vars = []
update_ops = []
# Adjust learning rate to deal with startup bias.
with tf.control_dependencies(None):
b1pow_var = tf.Variable(dtype=tf.float32, initial_value... | [
"def",
"apply_gradients",
"(",
"self",
",",
"grads_and_vars",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"self",
".",
"name",
")",
":",
"state_vars",
"=",
"[",
"]",
"update_ops",
"=",
"[",
"]",
"# Adjust learning rate to deal with startup bias.",
"with",
... | https://github.com/NVlabs/stylegan2/blob/bf0fe0baba9fc7039eae0cac575c1778be1ce3e3/dnnlib/tflib/optimizer.py#L342-L370 | ||||
ConvLab/ConvLab | a04582a77537c1a706fbf64715baa9ad0be1301a | convlab/modules/dst/state_tracker.py | python | Tracker.init_session | (self) | Init the Tracker to start a new session. | Init the Tracker to start a new session. | [
"Init",
"the",
"Tracker",
"to",
"start",
"a",
"new",
"session",
"."
] | def init_session(self):
"""Init the Tracker to start a new session."""
pass | [
"def",
"init_session",
"(",
"self",
")",
":",
"pass"
] | https://github.com/ConvLab/ConvLab/blob/a04582a77537c1a706fbf64715baa9ad0be1301a/convlab/modules/dst/state_tracker.py#L27-L29 | ||
pikpikcu/Pentest-Tools-Framework | cd6e6107764a809943dc4e073cde8149c1a2cd03 | modules/xsser/build/bdist.linux-armv7l/egg/core/main.py | python | xsser.get_payloads | (self) | return payloads | Process payload options and make up the payload list for the attack. | Process payload options and make up the payload list for the attack. | [
"Process",
"payload",
"options",
"and",
"make",
"up",
"the",
"payload",
"list",
"for",
"the",
"attack",
"."
] | def get_payloads(self):
"""
Process payload options and make up the payload list for the attack.
"""
options = self.options
# payloading sources
payloads_fuzz = core.fuzzing.vectors.vectors
payloads_dcp = core.fuzzing.DCP.DCPvectors
payloads_dom = core.fuzzing.DO... | [
"def",
"get_payloads",
"(",
"self",
")",
":",
"options",
"=",
"self",
".",
"options",
"# payloading sources",
"payloads_fuzz",
"=",
"core",
".",
"fuzzing",
".",
"vectors",
".",
"vectors",
"payloads_dcp",
"=",
"core",
".",
"fuzzing",
".",
"DCP",
".",
"DCPvect... | https://github.com/pikpikcu/Pentest-Tools-Framework/blob/cd6e6107764a809943dc4e073cde8149c1a2cd03/modules/xsser/build/bdist.linux-armv7l/egg/core/main.py#L271-L471 | |
brendano/tweetmotif | 1b0b1e3a941745cd5a26eba01f554688b7c4b27e | everything_else/djfrontend/django-1.0.2/db/models/sql/subqueries.py | python | UpdateQuery.pre_sql_setup | (self) | If the update depends on results from other tables, we need to do some
munging of the "where" conditions to match the format required for
(portable) SQL updates. That is done here.
Further, if we are going to be running multiple updates, we pull out
the id values to update at this point... | If the update depends on results from other tables, we need to do some
munging of the "where" conditions to match the format required for
(portable) SQL updates. That is done here. | [
"If",
"the",
"update",
"depends",
"on",
"results",
"from",
"other",
"tables",
"we",
"need",
"to",
"do",
"some",
"munging",
"of",
"the",
"where",
"conditions",
"to",
"match",
"the",
"format",
"required",
"for",
"(",
"portable",
")",
"SQL",
"updates",
".",
... | def pre_sql_setup(self):
"""
If the update depends on results from other tables, we need to do some
munging of the "where" conditions to match the format required for
(portable) SQL updates. That is done here.
Further, if we are going to be running multiple updates, we pull out
... | [
"def",
"pre_sql_setup",
"(",
"self",
")",
":",
"self",
".",
"select_related",
"=",
"False",
"self",
".",
"clear_ordering",
"(",
"True",
")",
"super",
"(",
"UpdateQuery",
",",
"self",
")",
".",
"pre_sql_setup",
"(",
")",
"count",
"=",
"self",
".",
"count_... | https://github.com/brendano/tweetmotif/blob/1b0b1e3a941745cd5a26eba01f554688b7c4b27e/everything_else/djfrontend/django-1.0.2/db/models/sql/subqueries.py#L149-L203 | ||
Cadene/tensorflow-model-zoo.torch | 990b10ffc22d4c8eacb2a502f20415b4f70c74c2 | models/research/swivel/prep.py | python | words | (line) | return line.strip().split() | Splits a line of text into tokens. | Splits a line of text into tokens. | [
"Splits",
"a",
"line",
"of",
"text",
"into",
"tokens",
"."
] | def words(line):
"""Splits a line of text into tokens."""
return line.strip().split() | [
"def",
"words",
"(",
"line",
")",
":",
"return",
"line",
".",
"strip",
"(",
")",
".",
"split",
"(",
")"
] | https://github.com/Cadene/tensorflow-model-zoo.torch/blob/990b10ffc22d4c8eacb2a502f20415b4f70c74c2/models/research/swivel/prep.py#L86-L88 | |
Teradata/stacki | a8085dce179dbe903f65f136f4b63bcc076cc057 | common/src/stack/pylib/stack/file.py | python | RPMFile.installPackage | (self, root, flags="") | return retval | Installs the RPM at the given root directory. This is
used for patching RPMs into the distribution and making
bootable CDs | Installs the RPM at the given root directory. This is
used for patching RPMs into the distribution and making
bootable CDs | [
"Installs",
"the",
"RPM",
"at",
"the",
"given",
"root",
"directory",
".",
"This",
"is",
"used",
"for",
"patching",
"RPMs",
"into",
"the",
"distribution",
"and",
"making",
"bootable",
"CDs"
] | def installPackage(self, root, flags=""):
"""Installs the RPM at the given root directory. This is
used for patching RPMs into the distribution and making
bootable CDs"""
pass
dbdir = os.path.join(root, 'var', 'lib', 'rpm')
if not os.path.isdir(dbdir):
os.makedirs(dbdir)
cmd = 'rpm -i --nomd5 --f... | [
"def",
"installPackage",
"(",
"self",
",",
"root",
",",
"flags",
"=",
"\"\"",
")",
":",
"pass",
"dbdir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"root",
",",
"'var'",
",",
"'lib'",
",",
"'rpm'",
")",
"if",
"not",
"os",
".",
"path",
".",
"isdir"... | https://github.com/Teradata/stacki/blob/a8085dce179dbe903f65f136f4b63bcc076cc057/common/src/stack/pylib/stack/file.py#L218-L243 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/sympy/integrals/risch.py | python | integrate_hyperexponential | (a, d, DE, z=None, conds='piecewise') | return (ret, i, b) | Integration of hyperexponential functions.
Given a hyperexponential monomial t over k and f in k(t), return g
elementary over k(t), i in k(t), and a bool b in {True, False} such that
i = f - Dg is in k if b is True or i = f - Dg does not have an elementary
integral over k(t) if b is False.
This fu... | Integration of hyperexponential functions. | [
"Integration",
"of",
"hyperexponential",
"functions",
"."
] | def integrate_hyperexponential(a, d, DE, z=None, conds='piecewise'):
"""
Integration of hyperexponential functions.
Given a hyperexponential monomial t over k and f in k(t), return g
elementary over k(t), i in k(t), and a bool b in {True, False} such that
i = f - Dg is in k if b is True or i = f - ... | [
"def",
"integrate_hyperexponential",
"(",
"a",
",",
"d",
",",
"DE",
",",
"z",
"=",
"None",
",",
"conds",
"=",
"'piecewise'",
")",
":",
"# XXX: a and d must be canceled, or this might return incorrect results",
"z",
"=",
"z",
"or",
"Dummy",
"(",
"\"z\"",
")",
"s"... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/sympy/integrals/risch.py#L1465-L1524 | |
linxid/Machine_Learning_Study_Path | 558e82d13237114bbb8152483977806fc0c222af | Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/site-packages/pip/pep425tags.py | python | is_manylinux1_compatible | () | return pip.utils.glibc.have_compatible_glibc(2, 5) | [] | def is_manylinux1_compatible():
# Only Linux, and only x86-64 / i686
if get_platform() not in ("linux_x86_64", "linux_i686"):
return False
# Check for presence of _manylinux module
try:
import _manylinux
return bool(_manylinux.manylinux1_compatible)
except (ImportError, Attr... | [
"def",
"is_manylinux1_compatible",
"(",
")",
":",
"# Only Linux, and only x86-64 / i686",
"if",
"get_platform",
"(",
")",
"not",
"in",
"(",
"\"linux_x86_64\"",
",",
"\"linux_i686\"",
")",
":",
"return",
"False",
"# Check for presence of _manylinux module",
"try",
":",
"... | https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/site-packages/pip/pep425tags.py#L148-L162 | |||
tecladocode/rest-apis-flask-python | d2d40872012dcf1b63ffde4bbd2dd447fec98eca | section2/10_args_and_kwargs.py | python | what_are_args | (*args) | [] | def what_are_args(*args):
print(args) | [
"def",
"what_are_args",
"(",
"*",
"args",
")",
":",
"print",
"(",
"args",
")"
] | https://github.com/tecladocode/rest-apis-flask-python/blob/d2d40872012dcf1b63ffde4bbd2dd447fec98eca/section2/10_args_and_kwargs.py#L16-L17 | ||||
keiffster/program-y | 8c99b56f8c32f01a7b9887b5daae9465619d0385 | src/programy/utils/email/config.py | python | EmailConfiguration.password | (self) | return self._password | [] | def password(self):
return self._password | [
"def",
"password",
"(",
"self",
")",
":",
"return",
"self",
".",
"_password"
] | https://github.com/keiffster/program-y/blob/8c99b56f8c32f01a7b9887b5daae9465619d0385/src/programy/utils/email/config.py#L47-L48 | |||
MDAnalysis/mdanalysis | 3488df3cdb0c29ed41c4fb94efe334b541e31b21 | package/MDAnalysis/coordinates/TRZ.py | python | TRZReader._get_dt | (self) | The amount of time between frames in ps
Assumes that this step is constant (ie. 2 trajectories with different
steps haven't been stitched together).
Returns ``AttributeError`` in case of ``StopIteration``
(which makes :attr:`dt` return 1.0).
.. versionchanged:: 2.1.0
... | The amount of time between frames in ps | [
"The",
"amount",
"of",
"time",
"between",
"frames",
"in",
"ps"
] | def _get_dt(self):
"""The amount of time between frames in ps
Assumes that this step is constant (ie. 2 trajectories with different
steps haven't been stitched together).
Returns ``AttributeError`` in case of ``StopIteration``
(which makes :attr:`dt` return 1.0).
.. ver... | [
"def",
"_get_dt",
"(",
"self",
")",
":",
"curr_frame",
"=",
"self",
".",
"ts",
".",
"frame",
"try",
":",
"t0",
"=",
"self",
".",
"ts",
".",
"time",
"self",
".",
"next",
"(",
")",
"t1",
"=",
"self",
".",
"ts",
".",
"time",
"dt",
"=",
"t1",
"-"... | https://github.com/MDAnalysis/mdanalysis/blob/3488df3cdb0c29ed41c4fb94efe334b541e31b21/package/MDAnalysis/coordinates/TRZ.py#L260-L283 | ||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/combinat/sloane_functions.py | python | A083105.__init__ | (self) | r"""
Second-order linear recurrence sequence with
`a(n) = a(n-1) + a(n-2)`.
`a(0) = 62638280004239857`,
`a(1) = 49463435743205655`. This is the second-order linear
recurrence sequence with `a(0)` and `a(1)`
co-prime. It was found by Donald Knuth in 1990.
INPUT:
... | r"""
Second-order linear recurrence sequence with
`a(n) = a(n-1) + a(n-2)`. | [
"r",
"Second",
"-",
"order",
"linear",
"recurrence",
"sequence",
"with",
"a",
"(",
"n",
")",
"=",
"a",
"(",
"n",
"-",
"1",
")",
"+",
"a",
"(",
"n",
"-",
"2",
")",
"."
] | def __init__(self):
r"""
Second-order linear recurrence sequence with
`a(n) = a(n-1) + a(n-2)`.
`a(0) = 62638280004239857`,
`a(1) = 49463435743205655`. This is the second-order linear
recurrence sequence with `a(0)` and `a(1)`
co-prime. It was found by Donald Knu... | [
"def",
"__init__",
"(",
"self",
")",
":",
"SloaneSequence",
".",
"__init__",
"(",
"self",
",",
"offset",
"=",
"0",
")",
"self",
".",
"_b",
"=",
"[",
"]",
"self",
".",
"_params",
"=",
"(",
"62638280004239857",
",",
"49463435743205655",
",",
"1",
",",
... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/sloane_functions.py#L7959-L8003 | ||
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/renderers/stateconf.py | python | state_name | (sname) | return sname.split(".", 1)[0] | Return the name of the state regardless if sname is
just the state name or a state.func name. | Return the name of the state regardless if sname is
just the state name or a state.func name. | [
"Return",
"the",
"name",
"of",
"the",
"state",
"regardless",
"if",
"sname",
"is",
"just",
"the",
"state",
"name",
"or",
"a",
"state",
".",
"func",
"name",
"."
] | def state_name(sname):
"""
Return the name of the state regardless if sname is
just the state name or a state.func name.
"""
return sname.split(".", 1)[0] | [
"def",
"state_name",
"(",
"sname",
")",
":",
"return",
"sname",
".",
"split",
"(",
"\".\"",
",",
"1",
")",
"[",
"0",
"]"
] | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/renderers/stateconf.py#L535-L540 | |
JimmXinu/FanFicFare | bc149a2deb2636320fe50a3e374af6eef8f61889 | included_dependencies/html2text/utils.py | python | escape_md | (text) | return config.RE_MD_CHARS_MATCHER.sub(r"\\\1", text) | Escapes markdown-sensitive characters within other markdown
constructs. | Escapes markdown-sensitive characters within other markdown
constructs. | [
"Escapes",
"markdown",
"-",
"sensitive",
"characters",
"within",
"other",
"markdown",
"constructs",
"."
] | def escape_md(text):
"""
Escapes markdown-sensitive characters within other markdown
constructs.
"""
return config.RE_MD_CHARS_MATCHER.sub(r"\\\1", text) | [
"def",
"escape_md",
"(",
"text",
")",
":",
"return",
"config",
".",
"RE_MD_CHARS_MATCHER",
".",
"sub",
"(",
"r\"\\\\\\1\"",
",",
"text",
")"
] | https://github.com/JimmXinu/FanFicFare/blob/bc149a2deb2636320fe50a3e374af6eef8f61889/included_dependencies/html2text/utils.py#L224-L229 | |
WeblateOrg/weblate | 8126f3dda9d24f2846b755955132a8b8410866c8 | weblate/utils/ratelimit.py | python | get_cache_key | (scope, request=None, address=None, user=None) | return f"ratelimit-{origin}-{scope}-{key}" | Generate cache key for request. | Generate cache key for request. | [
"Generate",
"cache",
"key",
"for",
"request",
"."
] | def get_cache_key(scope, request=None, address=None, user=None):
"""Generate cache key for request."""
if (request and request.user.is_authenticated) or user:
if user:
key = user.id
else:
key = request.user.id
origin = "user"
else:
if address is None:
... | [
"def",
"get_cache_key",
"(",
"scope",
",",
"request",
"=",
"None",
",",
"address",
"=",
"None",
",",
"user",
"=",
"None",
")",
":",
"if",
"(",
"request",
"and",
"request",
".",
"user",
".",
"is_authenticated",
")",
"or",
"user",
":",
"if",
"user",
":... | https://github.com/WeblateOrg/weblate/blob/8126f3dda9d24f2846b755955132a8b8410866c8/weblate/utils/ratelimit.py#L33-L46 | |
wwqgtxx/wwqLyParse | 33136508e52821babd9294fdecffbdf02d73a6fc | wwqLyParse/lib/python-3.7.2-embed-amd64/Crypto/Util/RFC1751.py | python | key_to_english | (key) | return english[:-1] | Transform an arbitrary key into a string containing English words.
Example::
>>> from Crypto.Util.RFC1751 import key_to_english
>>> key_to_english(b'66666666')
'RAM LOIS GOAD CREW CARE HIT'
Args:
key (byte string):
The key to convert. Its length must be a multiple of 8.
... | Transform an arbitrary key into a string containing English words. | [
"Transform",
"an",
"arbitrary",
"key",
"into",
"a",
"string",
"containing",
"English",
"words",
"."
] | def key_to_english (key):
"""Transform an arbitrary key into a string containing English words.
Example::
>>> from Crypto.Util.RFC1751 import key_to_english
>>> key_to_english(b'66666666')
'RAM LOIS GOAD CREW CARE HIT'
Args:
key (byte string):
The key to convert. Its... | [
"def",
"key_to_english",
"(",
"key",
")",
":",
"english",
"=",
"''",
"for",
"index",
"in",
"range",
"(",
"0",
",",
"len",
"(",
"key",
")",
",",
"8",
")",
":",
"# Loop over 8-byte subkeys",
"subkey",
"=",
"key",
"[",
"index",
":",
"index",
"+",
"8",
... | https://github.com/wwqgtxx/wwqLyParse/blob/33136508e52821babd9294fdecffbdf02d73a6fc/wwqLyParse/lib/python-3.7.2-embed-amd64/Crypto/Util/RFC1751.py#L47-L74 | |
aceisace/Inkycal | 552744bc5d80769c1015d48fd8b13201683ee679 | inkycal/display/drivers/epd_7_in_5_colour.py | python | EPD.__init__ | (self) | [] | def __init__(self):
self.reset_pin = epdconfig.RST_PIN
self.dc_pin = epdconfig.DC_PIN
self.busy_pin = epdconfig.BUSY_PIN
self.cs_pin = epdconfig.CS_PIN
self.width = EPD_WIDTH
self.height = EPD_HEIGHT | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"reset_pin",
"=",
"epdconfig",
".",
"RST_PIN",
"self",
".",
"dc_pin",
"=",
"epdconfig",
".",
"DC_PIN",
"self",
".",
"busy_pin",
"=",
"epdconfig",
".",
"BUSY_PIN",
"self",
".",
"cs_pin",
"=",
"epdconf... | https://github.com/aceisace/Inkycal/blob/552744bc5d80769c1015d48fd8b13201683ee679/inkycal/display/drivers/epd_7_in_5_colour.py#L39-L45 | ||||
scikit-image/scikit-image | ed642e2bc822f362504d24379dee94978d6fa9de | skimage/morphology/_util.py | python | _resolve_neighborhood | (footprint, connectivity, ndim) | return footprint | Validate or create a footprint (structuring element).
Depending on the values of `connectivity` and `footprint` this function
either creates a new footprint (`footprint` is None) using `connectivity`
or validates the given footprint (`footprint` is not None).
Parameters
----------
footprint : ... | Validate or create a footprint (structuring element). | [
"Validate",
"or",
"create",
"a",
"footprint",
"(",
"structuring",
"element",
")",
"."
] | def _resolve_neighborhood(footprint, connectivity, ndim):
"""Validate or create a footprint (structuring element).
Depending on the values of `connectivity` and `footprint` this function
either creates a new footprint (`footprint` is None) using `connectivity`
or validates the given footprint (`footpri... | [
"def",
"_resolve_neighborhood",
"(",
"footprint",
",",
"connectivity",
",",
"ndim",
")",
":",
"if",
"footprint",
"is",
"None",
":",
"if",
"connectivity",
"is",
"None",
":",
"connectivity",
"=",
"ndim",
"footprint",
"=",
"ndi",
".",
"generate_binary_structure",
... | https://github.com/scikit-image/scikit-image/blob/ed642e2bc822f362504d24379dee94978d6fa9de/skimage/morphology/_util.py#L210-L264 | |
LinkedInAttic/indextank-service | 880c6295ce8e7a3a55bf9b3777cc35c7680e0d7e | storefront/boto/vpc/__init__.py | python | VPCConnection.get_all_customer_gateways | (self, customer_gateway_ids=None, filters=None) | return self.get_list('DescribeCustomerGateways', params, [('item', CustomerGateway)]) | Retrieve information about your CustomerGateways. You can filter results to
return information only about those CustomerGateways that match your search
parameters. Otherwise, all CustomerGateways associated with your account
are returned.
:type customer_gateway_ids: list
... | Retrieve information about your CustomerGateways. You can filter results to
return information only about those CustomerGateways that match your search
parameters. Otherwise, all CustomerGateways associated with your account
are returned.
:type customer_gateway_ids: list
... | [
"Retrieve",
"information",
"about",
"your",
"CustomerGateways",
".",
"You",
"can",
"filter",
"results",
"to",
"return",
"information",
"only",
"about",
"those",
"CustomerGateways",
"that",
"match",
"your",
"search",
"parameters",
".",
"Otherwise",
"all",
"CustomerGa... | def get_all_customer_gateways(self, customer_gateway_ids=None, filters=None):
"""
Retrieve information about your CustomerGateways. You can filter results to
return information only about those CustomerGateways that match your search
parameters. Otherwise, all CustomerGateways associat... | [
"def",
"get_all_customer_gateways",
"(",
"self",
",",
"customer_gateway_ids",
"=",
"None",
",",
"filters",
"=",
"None",
")",
":",
"params",
"=",
"{",
"}",
"if",
"customer_gateway_ids",
":",
"self",
".",
"build_list_params",
"(",
"params",
",",
"customer_gateway_... | https://github.com/LinkedInAttic/indextank-service/blob/880c6295ce8e7a3a55bf9b3777cc35c7680e0d7e/storefront/boto/vpc/__init__.py#L104-L137 | |
thatbrguy/Pedestrian-Detection | b11c7d6bed0ff320811726fe1c429be26a87da9e | object_detection/anchor_generators/multiple_grid_anchor_generator.py | python | MultipleGridAnchorGenerator.num_anchors_per_location | (self) | return [len(box_specs) for box_specs in self._box_specs] | Returns the number of anchors per spatial location.
Returns:
a list of integers, one for each expected feature map to be passed to
the Generate function. | Returns the number of anchors per spatial location. | [
"Returns",
"the",
"number",
"of",
"anchors",
"per",
"spatial",
"location",
"."
] | def num_anchors_per_location(self):
"""Returns the number of anchors per spatial location.
Returns:
a list of integers, one for each expected feature map to be passed to
the Generate function.
"""
return [len(box_specs) for box_specs in self._box_specs] | [
"def",
"num_anchors_per_location",
"(",
"self",
")",
":",
"return",
"[",
"len",
"(",
"box_specs",
")",
"for",
"box_specs",
"in",
"self",
".",
"_box_specs",
"]"
] | https://github.com/thatbrguy/Pedestrian-Detection/blob/b11c7d6bed0ff320811726fe1c429be26a87da9e/object_detection/anchor_generators/multiple_grid_anchor_generator.py#L131-L138 | |
Komodo/KomodoEdit | 61edab75dce2bdb03943b387b0608ea36f548e8e | src/python-sitelib/pyxpcomProfiler.py | python | getXPCOMRecorder | (xpcomObject) | return recorder | Return the base xpcom recorder object for this python xpcom object.
Tries to record all the same xpcom instances for one interface in the same
recorder object. | Return the base xpcom recorder object for this python xpcom object. | [
"Return",
"the",
"base",
"xpcom",
"recorder",
"object",
"for",
"this",
"python",
"xpcom",
"object",
"."
] | def getXPCOMRecorder(xpcomObject):
"""Return the base xpcom recorder object for this python xpcom object.
Tries to record all the same xpcom instances for one interface in the same
recorder object.
"""
names = None
if hasattr(xpcomObject, "_interface_names_"):
names = [x.name for x in x... | [
"def",
"getXPCOMRecorder",
"(",
"xpcomObject",
")",
":",
"names",
"=",
"None",
"if",
"hasattr",
"(",
"xpcomObject",
",",
"\"_interface_names_\"",
")",
":",
"names",
"=",
"[",
"x",
".",
"name",
"for",
"x",
"in",
"xpcomObject",
".",
"_interface_names_",
"]",
... | https://github.com/Komodo/KomodoEdit/blob/61edab75dce2bdb03943b387b0608ea36f548e8e/src/python-sitelib/pyxpcomProfiler.py#L122-L146 | |
quantumlib/Cirq | 89f88b01d69222d3f1ec14d649b7b3a85ed9211f | dev_tools/pr_monitor.py | python | get_repo_ref | (repo: GithubRepository, ref: str) | return payload | Get a given github reference.
References:
https://developer.github.com/v3/git/refs/#get-a-reference
Args:
repo: The github repo to get the reference from.
ref: The id of the reference.
Returns:
The raw response of the request for the reference..
Raises:
Runtim... | Get a given github reference. | [
"Get",
"a",
"given",
"github",
"reference",
"."
] | def get_repo_ref(repo: GithubRepository, ref: str) -> Dict[str, Any]:
"""Get a given github reference.
References:
https://developer.github.com/v3/git/refs/#get-a-reference
Args:
repo: The github repo to get the reference from.
ref: The id of the reference.
Returns:
Th... | [
"def",
"get_repo_ref",
"(",
"repo",
":",
"GithubRepository",
",",
"ref",
":",
"str",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"url",
"=",
"f\"https://api.github.com/repos/{repo.organization}/{repo.name}/git/refs/{ref}\"",
"response",
"=",
"repo",
".",
... | https://github.com/quantumlib/Cirq/blob/89f88b01d69222d3f1ec14d649b7b3a85ed9211f/dev_tools/pr_monitor.py#L574-L600 | |
menpo/menpo | a61500656c4fc2eea82497684f13cc31a605550b | menpo/model/linear.py | python | MeanLinearVectorModel.mean | (self) | return self._mean | r"""
Return the mean of the model.
:type: `ndarray` | r"""
Return the mean of the model. | [
"r",
"Return",
"the",
"mean",
"of",
"the",
"model",
"."
] | def mean(self):
r"""
Return the mean of the model.
:type: `ndarray`
"""
return self._mean | [
"def",
"mean",
"(",
"self",
")",
":",
"return",
"self",
".",
"_mean"
] | https://github.com/menpo/menpo/blob/a61500656c4fc2eea82497684f13cc31a605550b/menpo/model/linear.py#L315-L321 | |
Cisco-Talos/GhIDA | a396916ae53e46adf3dca918b810f5db046af015 | ghida_plugin/idaxml.py | python | XmlExporter.export_typeinfo_cmt | (self, cmt) | Exports comment containing type information for data and functions.
Args:
cmt: String containing type info. | Exports comment containing type information for data and functions. | [
"Exports",
"comment",
"containing",
"type",
"information",
"for",
"data",
"and",
"functions",
"."
] | def export_typeinfo_cmt(self, cmt):
"""
Exports comment containing type information for data and functions.
Args:
cmt: String containing type info.
"""
# older versions of IDAPython returned a '\n' at end of cmt
if(len(cmt) > 0):
while cmt[-1] == ... | [
"def",
"export_typeinfo_cmt",
"(",
"self",
",",
"cmt",
")",
":",
"# older versions of IDAPython returned a '\\n' at end of cmt",
"if",
"(",
"len",
"(",
"cmt",
")",
">",
"0",
")",
":",
"while",
"cmt",
"[",
"-",
"1",
"]",
"==",
"'\\n'",
":",
"cmt",
"=",
"cmt... | https://github.com/Cisco-Talos/GhIDA/blob/a396916ae53e46adf3dca918b810f5db046af015/ghida_plugin/idaxml.py#L1676-L1687 | ||
cloudera/impyla | 0c736af4cad2bade9b8e313badc08ec50e81c948 | impala/_thrift_gen/hive_metastore/ThriftHiveMetastore.py | python | Iface.alter_table_with_environment_context | (self, dbname, tbl_name, new_tbl, environment_context) | Parameters:
- dbname
- tbl_name
- new_tbl
- environment_context | Parameters:
- dbname
- tbl_name
- new_tbl
- environment_context | [
"Parameters",
":",
"-",
"dbname",
"-",
"tbl_name",
"-",
"new_tbl",
"-",
"environment_context"
] | def alter_table_with_environment_context(self, dbname, tbl_name, new_tbl, environment_context):
"""
Parameters:
- dbname
- tbl_name
- new_tbl
- environment_context
"""
pass | [
"def",
"alter_table_with_environment_context",
"(",
"self",
",",
"dbname",
",",
"tbl_name",
",",
"new_tbl",
",",
"environment_context",
")",
":",
"pass"
] | https://github.com/cloudera/impyla/blob/0c736af4cad2bade9b8e313badc08ec50e81c948/impala/_thrift_gen/hive_metastore/ThriftHiveMetastore.py#L265-L273 | ||
keras-team/keras | 5caa668b6a415675064a730f5eb46ecc08e40f65 | keras/saving/saved_model/base_serialization.py | python | SavedModelSaver.list_extra_dependencies_for_serialization | (self, serialization_cache) | return self.objects_to_serialize(serialization_cache) | Lists extra dependencies to serialize to SavedModel.
By overriding this method, extra dependencies can be attached to the
serialized Layer. For example, this is used to save the list of `variables`
and `trainable_variables`, which are python properties in a Layer object,
but are represented as a static... | Lists extra dependencies to serialize to SavedModel. | [
"Lists",
"extra",
"dependencies",
"to",
"serialize",
"to",
"SavedModel",
"."
] | def list_extra_dependencies_for_serialization(self, serialization_cache):
"""Lists extra dependencies to serialize to SavedModel.
By overriding this method, extra dependencies can be attached to the
serialized Layer. For example, this is used to save the list of `variables`
and `trainable_variables`, w... | [
"def",
"list_extra_dependencies_for_serialization",
"(",
"self",
",",
"serialization_cache",
")",
":",
"if",
"not",
"utils",
".",
"should_save_traces",
"(",
")",
":",
"return",
"{",
"}",
"return",
"self",
".",
"objects_to_serialize",
"(",
"serialization_cache",
")"
... | https://github.com/keras-team/keras/blob/5caa668b6a415675064a730f5eb46ecc08e40f65/keras/saving/saved_model/base_serialization.py#L56-L77 | |
jobovy/galpy | 8e6a230bbe24ce16938db10053f92eb17fe4bb52 | galpy/df/surfaceSigmaProfile.py | python | expSurfaceSigmaProfile.sigma2Derivative | (self,R,log=False) | NAME:
sigmaDerivative
PURPOSE:
return the derivative wrt R of the sigma_R^2 profile at this R
INPUT:
R - Galactocentric radius (/ro)
log - if True, return the derivative of the log (default: False)
OUTPUT:
Sigma_R^2'(R) or (log Sigma_R^2(r) ... | NAME:
sigmaDerivative
PURPOSE:
return the derivative wrt R of the sigma_R^2 profile at this R
INPUT:
R - Galactocentric radius (/ro)
log - if True, return the derivative of the log (default: False)
OUTPUT:
Sigma_R^2'(R) or (log Sigma_R^2(r) ... | [
"NAME",
":",
"sigmaDerivative",
"PURPOSE",
":",
"return",
"the",
"derivative",
"wrt",
"R",
"of",
"the",
"sigma_R^2",
"profile",
"at",
"this",
"R",
"INPUT",
":",
"R",
"-",
"Galactocentric",
"radius",
"(",
"/",
"ro",
")",
"log",
"-",
"if",
"True",
"return"... | def sigma2Derivative(self,R,log=False):
"""
NAME:
sigmaDerivative
PURPOSE:
return the derivative wrt R of the sigma_R^2 profile at this R
INPUT:
R - Galactocentric radius (/ro)
log - if True, return the derivative of the log (default: False)
... | [
"def",
"sigma2Derivative",
"(",
"self",
",",
"R",
",",
"log",
"=",
"False",
")",
":",
"if",
"log",
":",
"return",
"-",
"2.",
"/",
"self",
".",
"_params",
"[",
"1",
"]",
"else",
":",
"return",
"self",
".",
"_params",
"[",
"2",
"]",
"**",
"2.",
"... | https://github.com/jobovy/galpy/blob/8e6a230bbe24ce16938db10053f92eb17fe4bb52/galpy/df/surfaceSigmaProfile.py#L159-L177 | ||
s-leger/archipack | 5a6243bf1edf08a6b429661ce291dacb551e5f8a | pygeos/op_relate.py | python | RelateComputer.labelIsolatedNode | (self, node, targetIndex: int) | * Label an isolated node with its relationship to the target geometry. | * Label an isolated node with its relationship to the target geometry. | [
"*",
"Label",
"an",
"isolated",
"node",
"with",
"its",
"relationship",
"to",
"the",
"target",
"geometry",
"."
] | def labelIsolatedNode(self, node, targetIndex: int) -> None:
"""
* Label an isolated node with its relationship to the target geometry.
"""
loc = self.ptLocator.locate(node.coord, self.arg[targetIndex].geom)
node.label.setAllLocations(targetIndex, loc) | [
"def",
"labelIsolatedNode",
"(",
"self",
",",
"node",
",",
"targetIndex",
":",
"int",
")",
"->",
"None",
":",
"loc",
"=",
"self",
".",
"ptLocator",
".",
"locate",
"(",
"node",
".",
"coord",
",",
"self",
".",
"arg",
"[",
"targetIndex",
"]",
".",
"geom... | https://github.com/s-leger/archipack/blob/5a6243bf1edf08a6b429661ce291dacb551e5f8a/pygeos/op_relate.py#L776-L781 | ||
redhat-imaging/imagefactory | 176f6e045e1df049d50f33a924653128d5ab8b27 | imgfac/rest/bottle.py | python | BaseTemplate.search | (cls, name, lookup=[]) | Search name in all directories specified in lookup.
First without, then with common extensions. Return first hit. | Search name in all directories specified in lookup.
First without, then with common extensions. Return first hit. | [
"Search",
"name",
"in",
"all",
"directories",
"specified",
"in",
"lookup",
".",
"First",
"without",
"then",
"with",
"common",
"extensions",
".",
"Return",
"first",
"hit",
"."
] | def search(cls, name, lookup=[]):
""" Search name in all directories specified in lookup.
First without, then with common extensions. Return first hit. """
if not lookup:
depr('The template lookup path list should not be empty.') #0.12
lookup = ['.']
if os.path.i... | [
"def",
"search",
"(",
"cls",
",",
"name",
",",
"lookup",
"=",
"[",
"]",
")",
":",
"if",
"not",
"lookup",
":",
"depr",
"(",
"'The template lookup path list should not be empty.'",
")",
"#0.12",
"lookup",
"=",
"[",
"'.'",
"]",
"if",
"os",
".",
"path",
".",... | https://github.com/redhat-imaging/imagefactory/blob/176f6e045e1df049d50f33a924653128d5ab8b27/imgfac/rest/bottle.py#L3230-L3248 | ||
joerick/pyinstrument | d3c45164a385021f366c1081baec18a1a226a573 | pyinstrument/renderers/speedscope.py | python | SpeedscopeRenderer.render_frame | (self, frame: BaseFrame | None) | return events_array | Builds up a list of speedscope events that are used to populate the
"events" array in speedscope-formatted JSON.
This method has two notable side effects:
* it populates the self._frame_to_index dictionary that matches
speedscope frames with their positions in the "shared" array of
... | Builds up a list of speedscope events that are used to populate the
"events" array in speedscope-formatted JSON. | [
"Builds",
"up",
"a",
"list",
"of",
"speedscope",
"events",
"that",
"are",
"used",
"to",
"populate",
"the",
"events",
"array",
"in",
"speedscope",
"-",
"formatted",
"JSON",
"."
] | def render_frame(self, frame: BaseFrame | None) -> list[SpeedscopeEvent]:
"""
Builds up a list of speedscope events that are used to populate the
"events" array in speedscope-formatted JSON.
This method has two notable side effects:
* it populates the self._frame_to_index dicti... | [
"def",
"render_frame",
"(",
"self",
",",
"frame",
":",
"BaseFrame",
"|",
"None",
")",
"->",
"list",
"[",
"SpeedscopeEvent",
"]",
":",
"# if frame is None, recursion bottoms out; no event frames",
"# need to be added",
"if",
"frame",
"is",
"None",
":",
"return",
"[",... | https://github.com/joerick/pyinstrument/blob/d3c45164a385021f366c1081baec18a1a226a573/pyinstrument/renderers/speedscope.py#L144-L203 | |
NVIDIA/DeepLearningExamples | 589604d49e016cd9ef4525f7abcc9c7b826cfc5e | PyTorch/Translation/Transformer/fairseq/data/dictionary.py | python | Dictionary.update | (self, new_dict) | Updates counts from new dictionary. | Updates counts from new dictionary. | [
"Updates",
"counts",
"from",
"new",
"dictionary",
"."
] | def update(self, new_dict):
"""Updates counts from new dictionary."""
for word in new_dict.symbols:
idx2 = new_dict.indices[word]
if word in self.indices:
idx = self.indices[word]
self.count[idx] = self.count[idx] + new_dict.count[idx2]
... | [
"def",
"update",
"(",
"self",
",",
"new_dict",
")",
":",
"for",
"word",
"in",
"new_dict",
".",
"symbols",
":",
"idx2",
"=",
"new_dict",
".",
"indices",
"[",
"word",
"]",
"if",
"word",
"in",
"self",
".",
"indices",
":",
"idx",
"=",
"self",
".",
"ind... | https://github.com/NVIDIA/DeepLearningExamples/blob/589604d49e016cd9ef4525f7abcc9c7b826cfc5e/PyTorch/Translation/Transformer/fairseq/data/dictionary.py#L85-L96 | ||
feisuzhu/thbattle | ac0dee1b2d86de7664289cf432b157ef25427ba1 | src/pyglet/font/base.py | python | Glyph.draw_quad_vertices | (self) | Debug method.
Use the higher level APIs for performance and kerning. | Debug method. | [
"Debug",
"method",
"."
] | def draw_quad_vertices(self):
'''Debug method.
Use the higher level APIs for performance and kerning.
'''
glTexCoord3f(*self.tex_coords[:3])
glVertex2f(self.vertices[0], self.vertices[1])
glTexCoord3f(*self.tex_coords[3:6])
glVertex2f(self.vertices[2], self.vert... | [
"def",
"draw_quad_vertices",
"(",
"self",
")",
":",
"glTexCoord3f",
"(",
"*",
"self",
".",
"tex_coords",
"[",
":",
"3",
"]",
")",
"glVertex2f",
"(",
"self",
".",
"vertices",
"[",
"0",
"]",
",",
"self",
".",
"vertices",
"[",
"1",
"]",
")",
"glTexCoord... | https://github.com/feisuzhu/thbattle/blob/ac0dee1b2d86de7664289cf432b157ef25427ba1/src/pyglet/font/base.py#L189-L201 | ||
IdentityPython/pysaml2 | 6badb32d212257bd83ffcc816f9b625f68281b47 | src/saml2/authn_context/ppt.py | python | identification_type__from_string | (xml_string) | return saml2.create_class_from_xml_string(IdentificationType_, xml_string) | [] | def identification_type__from_string(xml_string):
return saml2.create_class_from_xml_string(IdentificationType_, xml_string) | [
"def",
"identification_type__from_string",
"(",
"xml_string",
")",
":",
"return",
"saml2",
".",
"create_class_from_xml_string",
"(",
"IdentificationType_",
",",
"xml_string",
")"
] | https://github.com/IdentityPython/pysaml2/blob/6badb32d212257bd83ffcc816f9b625f68281b47/src/saml2/authn_context/ppt.py#L1447-L1448 | |||
aws/sagemaker-tensorflow-training-toolkit | 38db16c9d3fcbda6f9d8bc31261398fb4617bfc8 | benchmarks/horovod-resnet/train_imagenet_resnet_hvd.py | python | LayerBuilder.dense_linear | (self, inputs, units, **kwargs) | return tf.layers.dense(inputs, units, activation=None) | [] | def dense_linear(self, inputs, units, **kwargs):
return tf.layers.dense(inputs, units, activation=None) | [
"def",
"dense_linear",
"(",
"self",
",",
"inputs",
",",
"units",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"tf",
".",
"layers",
".",
"dense",
"(",
"inputs",
",",
"units",
",",
"activation",
"=",
"None",
")"
] | https://github.com/aws/sagemaker-tensorflow-training-toolkit/blob/38db16c9d3fcbda6f9d8bc31261398fb4617bfc8/benchmarks/horovod-resnet/train_imagenet_resnet_hvd.py#L155-L156 | |||
openembedded/bitbake | 98407efc8c670abd71d3fa88ec3776ee9b5c38f3 | lib/bb/pysh/pyshyacc.py | python | parse | (input, eof=False, debug=False) | return yacc.parse(lexer=lexer, debug=debug), remaining | Parse a whole script at once and return the generated AST and unconsumed
data in a tuple.
NOTE: eof is probably meaningless for now, the parser being unable to work
in pull mode. It should be set to True. | Parse a whole script at once and return the generated AST and unconsumed
data in a tuple.
NOTE: eof is probably meaningless for now, the parser being unable to work
in pull mode. It should be set to True. | [
"Parse",
"a",
"whole",
"script",
"at",
"once",
"and",
"return",
"the",
"generated",
"AST",
"and",
"unconsumed",
"data",
"in",
"a",
"tuple",
".",
"NOTE",
":",
"eof",
"is",
"probably",
"meaningless",
"for",
"now",
"the",
"parser",
"being",
"unable",
"to",
... | def parse(input, eof=False, debug=False):
"""Parse a whole script at once and return the generated AST and unconsumed
data in a tuple.
NOTE: eof is probably meaningless for now, the parser being unable to work
in pull mode. It should be set to True.
"""
lexer = pyshlex.PLYLexer()
remain... | [
"def",
"parse",
"(",
"input",
",",
"eof",
"=",
"False",
",",
"debug",
"=",
"False",
")",
":",
"lexer",
"=",
"pyshlex",
".",
"PLYLexer",
"(",
")",
"remaining",
"=",
"lexer",
".",
"add",
"(",
"input",
",",
"eof",
")",
"if",
"lexer",
".",
"is_empty",
... | https://github.com/openembedded/bitbake/blob/98407efc8c670abd71d3fa88ec3776ee9b5c38f3/lib/bb/pysh/pyshyacc.py#L664-L677 | |
rndusr/stig | 334f03e2e3eda7c1856dd5489f0265a47b9861b6 | stig/client/filters/utils.py | python | _either_past_or_future | (item_value, user_value) | return item_value_in_future == user_value_in_future | Return True if `item_value` and `user_value` are equal, both in the past or
both in the future, False otherwise | Return True if `item_value` and `user_value` are equal, both in the past or
both in the future, False otherwise | [
"Return",
"True",
"if",
"item_value",
"and",
"user_value",
"are",
"equal",
"both",
"in",
"the",
"past",
"or",
"both",
"in",
"the",
"future",
"False",
"otherwise"
] | def _either_past_or_future(item_value, user_value):
"""
Return True if `item_value` and `user_value` are equal, both in the past or
both in the future, False otherwise
"""
type_item_value = type(item_value)
type_user_value = type(user_value)
if type_user_value is Timestamp:
user_val... | [
"def",
"_either_past_or_future",
"(",
"item_value",
",",
"user_value",
")",
":",
"type_item_value",
"=",
"type",
"(",
"item_value",
")",
"type_user_value",
"=",
"type",
"(",
"user_value",
")",
"if",
"type_user_value",
"is",
"Timestamp",
":",
"user_value_in_future",
... | https://github.com/rndusr/stig/blob/334f03e2e3eda7c1856dd5489f0265a47b9861b6/stig/client/filters/utils.py#L98-L116 | |
python/cpython | e13cdca0f5224ec4e23bdd04bb3120506964bc8b | Lib/idlelib/config.py | python | IdleConf.__GetRawExtensionKeys | (self,extensionName) | return extKeys | Return dict {configurable extensionName event : keybinding list}.
Events come from default config extension_cfgBindings section.
Keybindings list come from the splitting of GetOption, which
tries user config before default config. | Return dict {configurable extensionName event : keybinding list}. | [
"Return",
"dict",
"{",
"configurable",
"extensionName",
"event",
":",
"keybinding",
"list",
"}",
"."
] | def __GetRawExtensionKeys(self,extensionName):
"""Return dict {configurable extensionName event : keybinding list}.
Events come from default config extension_cfgBindings section.
Keybindings list come from the splitting of GetOption, which
tries user config before default config.
... | [
"def",
"__GetRawExtensionKeys",
"(",
"self",
",",
"extensionName",
")",
":",
"keysName",
"=",
"extensionName",
"+",
"'_cfgBindings'",
"extKeys",
"=",
"{",
"}",
"if",
"self",
".",
"defaultCfg",
"[",
"'extensions'",
"]",
".",
"has_section",
"(",
"keysName",
")",... | https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/idlelib/config.py#L489-L505 | |
IBM/lale | b4d6829c143a4735b06083a0e6c70d2cca244162 | lale/lib/lale/observing.py | python | observe | (f) | return wrapper | [] | def observe(f):
@wraps(f)
def wrapper(self, *args, **kwds):
name = f.__name__
self.startObserving(name, *args, **kwds)
try:
ret = f(self, *args, **kwds)
self.endObserving(name, ret)
except BaseException as e:
self.failObserving(name, e)
... | [
"def",
"observe",
"(",
"f",
")",
":",
"@",
"wraps",
"(",
"f",
")",
"def",
"wrapper",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwds",
")",
":",
"name",
"=",
"f",
".",
"__name__",
"self",
".",
"startObserving",
"(",
"name",
",",
"*",
"args"... | https://github.com/IBM/lale/blob/b4d6829c143a4735b06083a0e6c70d2cca244162/lale/lib/lale/observing.py#L27-L40 | |||
emmetio/livestyle-sublime-old | c42833c046e9b2f53ebce3df3aa926528f5a33b5 | tornado/web.py | python | TemplateModule._get_resources | (self, key) | return (r[key] for r in self._resource_list if key in r) | [] | def _get_resources(self, key):
return (r[key] for r in self._resource_list if key in r) | [
"def",
"_get_resources",
"(",
"self",
",",
"key",
")",
":",
"return",
"(",
"r",
"[",
"key",
"]",
"for",
"r",
"in",
"self",
".",
"_resource_list",
"if",
"key",
"in",
"r",
")"
] | https://github.com/emmetio/livestyle-sublime-old/blob/c42833c046e9b2f53ebce3df3aa926528f5a33b5/tornado/web.py#L2388-L2389 | |||
pcyin/NL2code | f9732f1f5caafa73a0f767cc4f5ce9f5961c46d6 | lang/py/parse.py | python | parse | (code) | return tree | parse a python code into a tree structure
code -> AST tree -> AST tree to internal tree structure | parse a python code into a tree structure
code -> AST tree -> AST tree to internal tree structure | [
"parse",
"a",
"python",
"code",
"into",
"a",
"tree",
"structure",
"code",
"-",
">",
"AST",
"tree",
"-",
">",
"AST",
"tree",
"to",
"internal",
"tree",
"structure"
] | def parse(code):
"""
parse a python code into a tree structure
code -> AST tree -> AST tree to internal tree structure
"""
code = canonicalize_code(code)
py_ast = ast.parse(code)
tree = python_ast_to_parse_tree(py_ast.body[0])
tree = add_root(tree)
return tree | [
"def",
"parse",
"(",
"code",
")",
":",
"code",
"=",
"canonicalize_code",
"(",
"code",
")",
"py_ast",
"=",
"ast",
".",
"parse",
"(",
"code",
")",
"tree",
"=",
"python_ast_to_parse_tree",
"(",
"py_ast",
".",
"body",
"[",
"0",
"]",
")",
"tree",
"=",
"ad... | https://github.com/pcyin/NL2code/blob/f9732f1f5caafa73a0f767cc4f5ce9f5961c46d6/lang/py/parse.py#L254-L267 | |
JaniceWuo/MovieRecommend | 4c86db64ca45598917d304f535413df3bc9fea65 | movierecommend/venv1/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/lockfile/symlinklockfile.py | python | SymlinkLockFile.release | (self) | [] | def release(self):
if not self.is_locked():
raise NotLocked("%s is not locked" % self.path)
elif not self.i_am_locking():
raise NotMyLock("%s is locked, but not by me" % self.path)
os.unlink(self.lock_file) | [
"def",
"release",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"is_locked",
"(",
")",
":",
"raise",
"NotLocked",
"(",
"\"%s is not locked\"",
"%",
"self",
".",
"path",
")",
"elif",
"not",
"self",
".",
"i_am_locking",
"(",
")",
":",
"raise",
"NotMyL... | https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/lockfile/symlinklockfile.py#L54-L59 | ||||
wbond/asn1crypto | 9ae350f212532dfee7f185f6b3eda24753249cf3 | asn1crypto/core.py | python | OctetString.set | (self, value) | Sets the value of the object
:param value:
A byte string | Sets the value of the object | [
"Sets",
"the",
"value",
"of",
"the",
"object"
] | def set(self, value):
"""
Sets the value of the object
:param value:
A byte string
"""
if not isinstance(value, byte_cls):
raise TypeError(unwrap(
'''
%s value must be a byte string, not %s
''',
... | [
"def",
"set",
"(",
"self",
",",
"value",
")",
":",
"if",
"not",
"isinstance",
"(",
"value",
",",
"byte_cls",
")",
":",
"raise",
"TypeError",
"(",
"unwrap",
"(",
"'''\n %s value must be a byte string, not %s\n '''",
",",
"type_name",
"("... | https://github.com/wbond/asn1crypto/blob/9ae350f212532dfee7f185f6b3eda24753249cf3/asn1crypto/core.py#L2565-L2589 | ||
eriklindernoren/PyTorch-GAN | 36d3c77e5ff20ebe0aeefd322326a134a279b93e | implementations/munit/models.py | python | MultiDiscriminator.compute_loss | (self, x, gt) | return loss | Computes the MSE between model output and scalar gt | Computes the MSE between model output and scalar gt | [
"Computes",
"the",
"MSE",
"between",
"model",
"output",
"and",
"scalar",
"gt"
] | def compute_loss(self, x, gt):
"""Computes the MSE between model output and scalar gt"""
loss = sum([torch.mean((out - gt) ** 2) for out in self.forward(x)])
return loss | [
"def",
"compute_loss",
"(",
"self",
",",
"x",
",",
"gt",
")",
":",
"loss",
"=",
"sum",
"(",
"[",
"torch",
".",
"mean",
"(",
"(",
"out",
"-",
"gt",
")",
"**",
"2",
")",
"for",
"out",
"in",
"self",
".",
"forward",
"(",
"x",
")",
"]",
")",
"re... | https://github.com/eriklindernoren/PyTorch-GAN/blob/36d3c77e5ff20ebe0aeefd322326a134a279b93e/implementations/munit/models.py#L225-L228 | |
GraylinKim/sc2reader | d69feb4e0be597581040588193579d29e8241431 | sc2reader/decoders.py | python | ByteDecoder.__init__ | (self, contents, endian) | Accepts both strings and files implementing ``read()`` and
decodes them in the specified endian format. | Accepts both strings and files implementing ``read()`` and
decodes them in the specified endian format. | [
"Accepts",
"both",
"strings",
"and",
"files",
"implementing",
"read",
"()",
"and",
"decodes",
"them",
"in",
"the",
"specified",
"endian",
"format",
"."
] | def __init__(self, contents, endian):
""" Accepts both strings and files implementing ``read()`` and
decodes them in the specified endian format.
"""
if hasattr(contents, 'read'):
self._contents = contents.read()
else:
self._contents = contents
se... | [
"def",
"__init__",
"(",
"self",
",",
"contents",
",",
"endian",
")",
":",
"if",
"hasattr",
"(",
"contents",
",",
"'read'",
")",
":",
"self",
".",
"_contents",
"=",
"contents",
".",
"read",
"(",
")",
"else",
":",
"self",
".",
"_contents",
"=",
"conten... | https://github.com/GraylinKim/sc2reader/blob/d69feb4e0be597581040588193579d29e8241431/sc2reader/decoders.py#L33-L63 | ||
aws-samples/aws-kube-codesuite | ab4e5ce45416b83bffb947ab8d234df5437f4fca | src/kubernetes/client/apis/authorization_v1beta1_api.py | python | AuthorizationV1beta1Api.create_subject_access_review_with_http_info | (self, body, **kwargs) | return self.api_client.call_api(resource_path, 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_... | create a SubjectAccessReview
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
... | create a SubjectAccessReview
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
... | [
"create",
"a",
"SubjectAccessReview",
"This",
"method",
"makes",
"a",
"synchronous",
"HTTP",
"request",
"by",
"default",
".",
"To",
"make",
"an",
"asynchronous",
"HTTP",
"request",
"please",
"define",
"a",
"callback",
"function",
"to",
"be",
"invoked",
"when",
... | def create_subject_access_review_with_http_info(self, body, **kwargs):
"""
create a SubjectAccessReview
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
... | [
"def",
"create_subject_access_review_with_http_info",
"(",
"self",
",",
"body",
",",
"*",
"*",
"kwargs",
")",
":",
"all_params",
"=",
"[",
"'body'",
",",
"'pretty'",
"]",
"all_params",
".",
"append",
"(",
"'callback'",
")",
"all_params",
".",
"append",
"(",
... | https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/kubernetes/client/apis/authorization_v1beta1_api.py#L294-L375 | |
hyperspy/hyperspy | 1ffb3fab33e607045a37f30c1463350b72617e10 | hyperspy/events.py | python | Events.__delattr__ | (self, name) | Magic to enable having `Event`s as attributes, and keeping them
separate from other attributes.
Deletes attribute from self._events if present, otherwise delete
attribute in normal way. | Magic to enable having `Event`s as attributes, and keeping them
separate from other attributes. | [
"Magic",
"to",
"enable",
"having",
"Event",
"s",
"as",
"attributes",
"and",
"keeping",
"them",
"separate",
"from",
"other",
"attributes",
"."
] | def __delattr__(self, name):
"""
Magic to enable having `Event`s as attributes, and keeping them
separate from other attributes.
Deletes attribute from self._events if present, otherwise delete
attribute in normal way.
"""
if name in self._events:
del... | [
"def",
"__delattr__",
"(",
"self",
",",
"name",
")",
":",
"if",
"name",
"in",
"self",
".",
"_events",
":",
"del",
"self",
".",
"_events",
"[",
"name",
"]",
"self",
".",
"_update_doc",
"(",
")",
"else",
":",
"super",
"(",
"Events",
",",
"self",
")",... | https://github.com/hyperspy/hyperspy/blob/1ffb3fab33e607045a37f30c1463350b72617e10/hyperspy/events.py#L109-L121 | ||
google/turbinia | 4559d4af9267762a8995cfc415099a80a22ee4d3 | turbinia/workers/analysis/wordpress_creds.py | python | WordpressCredsAnalysisTask._analyse_wordpress_creds | (self, creds, hashnames, timeout=300) | return (report, priority, summary) | Attempt to brute force extracted Wordpress credentials.
Args:
creds (list): List of strings containing raw extracted credentials
hashnames (dict): Dict mapping hash back to username for convenience.
timeout (int): How long to spend cracking.
Returns:
Tuple(
report_text(st... | Attempt to brute force extracted Wordpress credentials. | [
"Attempt",
"to",
"brute",
"force",
"extracted",
"Wordpress",
"credentials",
"."
] | def _analyse_wordpress_creds(self, creds, hashnames, timeout=300):
"""Attempt to brute force extracted Wordpress credentials.
Args:
creds (list): List of strings containing raw extracted credentials
hashnames (dict): Dict mapping hash back to username for convenience.
timeout (int): How... | [
"def",
"_analyse_wordpress_creds",
"(",
"self",
",",
"creds",
",",
"hashnames",
",",
"timeout",
"=",
"300",
")",
":",
"report",
"=",
"[",
"]",
"summary",
"=",
"'No weak passwords found'",
"priority",
"=",
"Priority",
".",
"LOW",
"# 1000 is \"phpass\"",
"weak_pas... | https://github.com/google/turbinia/blob/4559d4af9267762a8995cfc415099a80a22ee4d3/turbinia/workers/analysis/wordpress_creds.py#L164-L201 | |
isce-framework/isce2 | 0e5114a8bede3caf1d533d98e44dfe4b983e3f48 | contrib/stack/topsStack/VRTManager.py | python | VRTConstructor.addBurst | (self, burst, infile, yoff, xoff, band=1, validOnly=True) | Add one burst to the VRT. | Add one burst to the VRT. | [
"Add",
"one",
"burst",
"to",
"the",
"VRT",
"."
] | def addBurst(self, burst, infile, yoff, xoff, band=1, validOnly=True):
'''
Add one burst to the VRT.
'''
tysize = burst.numberOfLines
txsize = burst.numberOfSamples
if validOnly:
tyoff = int(burst.firstValidLine)
txoff = int(burst.firstValidSamp... | [
"def",
"addBurst",
"(",
"self",
",",
"burst",
",",
"infile",
",",
"yoff",
",",
"xoff",
",",
"band",
"=",
"1",
",",
"validOnly",
"=",
"True",
")",
":",
"tysize",
"=",
"burst",
".",
"numberOfLines",
"txsize",
"=",
"burst",
".",
"numberOfSamples",
"if",
... | https://github.com/isce-framework/isce2/blob/0e5114a8bede3caf1d533d98e44dfe4b983e3f48/contrib/stack/topsStack/VRTManager.py#L165-L204 | ||
rwth-i6/returnn | f2d718a197a280b0d5f0fd91a7fcb8658560dddb | returnn/util/basic.py | python | hdf5_dimension | (filename, dimension) | return res | :param str filename:
:param str dimension:
:rtype: numpy.ndarray|int | :param str filename:
:param str dimension:
:rtype: numpy.ndarray|int | [
":",
"param",
"str",
"filename",
":",
":",
"param",
"str",
"dimension",
":",
":",
"rtype",
":",
"numpy",
".",
"ndarray|int"
] | def hdf5_dimension(filename, dimension):
"""
:param str filename:
:param str dimension:
:rtype: numpy.ndarray|int
"""
fin = h5py.File(filename, "r")
if '/' in dimension:
res = fin['/'.join(dimension.split('/')[:-1])].attrs[dimension.split('/')[-1]]
else:
res = fin.attrs[dimension]
fin.close()
... | [
"def",
"hdf5_dimension",
"(",
"filename",
",",
"dimension",
")",
":",
"fin",
"=",
"h5py",
".",
"File",
"(",
"filename",
",",
"\"r\"",
")",
"if",
"'/'",
"in",
"dimension",
":",
"res",
"=",
"fin",
"[",
"'/'",
".",
"join",
"(",
"dimension",
".",
"split"... | https://github.com/rwth-i6/returnn/blob/f2d718a197a280b0d5f0fd91a7fcb8658560dddb/returnn/util/basic.py#L526-L538 | |
spyder-ide/spyder | 55da47c032dfcf519600f67f8b30eab467f965e7 | spyder/widgets/reporterror.py | python | DescriptionWidget.keyPressEvent | (self, event) | Reimplemented Qt Method to avoid removing the header. | Reimplemented Qt Method to avoid removing the header. | [
"Reimplemented",
"Qt",
"Method",
"to",
"avoid",
"removing",
"the",
"header",
"."
] | def keyPressEvent(self, event):
"""Reimplemented Qt Method to avoid removing the header."""
event, text, key, ctrl, shift = restore_keyevent(event)
cursor_position = self.get_position('cursor')
if cursor_position < self.header_end_pos:
self.restrict_cursor_position(self.head... | [
"def",
"keyPressEvent",
"(",
"self",
",",
"event",
")",
":",
"event",
",",
"text",
",",
"key",
",",
"ctrl",
",",
"shift",
"=",
"restore_keyevent",
"(",
"event",
")",
"cursor_position",
"=",
"self",
".",
"get_position",
"(",
"'cursor'",
")",
"if",
"cursor... | https://github.com/spyder-ide/spyder/blob/55da47c032dfcf519600f67f8b30eab467f965e7/spyder/widgets/reporterror.py#L76-L93 | ||
pandas-dev/pandas | 5ba7d714014ae8feaccc0dd4a98890828cf2832d | pandas/core/indexes/datetimes.py | python | bdate_range | (
start=None,
end=None,
periods: int | None = None,
freq="B",
tz=None,
normalize: bool = True,
name: Hashable = None,
weekmask=None,
holidays=None,
closed: lib.NoDefault = lib.no_default,
inclusive: str | None = None,
**kwargs,
) | return date_range(
start=start,
end=end,
periods=periods,
freq=freq,
tz=tz,
normalize=normalize,
name=name,
closed=closed,
inclusive=inclusive,
**kwargs,
) | Return a fixed frequency DatetimeIndex, with business day as the default
frequency.
Parameters
----------
start : str or datetime-like, default None
Left bound for generating dates.
end : str or datetime-like, default None
Right bound for generating dates.
periods : int, default... | Return a fixed frequency DatetimeIndex, with business day as the default
frequency. | [
"Return",
"a",
"fixed",
"frequency",
"DatetimeIndex",
"with",
"business",
"day",
"as",
"the",
"default",
"frequency",
"."
] | def bdate_range(
start=None,
end=None,
periods: int | None = None,
freq="B",
tz=None,
normalize: bool = True,
name: Hashable = None,
weekmask=None,
holidays=None,
closed: lib.NoDefault = lib.no_default,
inclusive: str | None = None,
**kwargs,
) -> DatetimeIndex:
"""
... | [
"def",
"bdate_range",
"(",
"start",
"=",
"None",
",",
"end",
"=",
"None",
",",
"periods",
":",
"int",
"|",
"None",
"=",
"None",
",",
"freq",
"=",
"\"B\"",
",",
"tz",
"=",
"None",
",",
"normalize",
":",
"bool",
"=",
"True",
",",
"name",
":",
"Hash... | https://github.com/pandas-dev/pandas/blob/5ba7d714014ae8feaccc0dd4a98890828cf2832d/pandas/core/indexes/datetimes.py#L1083-L1192 | |
learnables/learn2learn | c664e3c8643efb1cc1cf7bb11668843e2ee8ebbe | learn2learn/vision/benchmarks/fc100_benchmark.py | python | fc100_tasksets | (
train_ways=5,
train_samples=10,
test_ways=5,
test_samples=10,
root='~/data',
device=None,
**kwargs,
) | return _datasets, _transforms | Tasksets for FC100 benchmarks. | Tasksets for FC100 benchmarks. | [
"Tasksets",
"for",
"FC100",
"benchmarks",
"."
] | def fc100_tasksets(
train_ways=5,
train_samples=10,
test_ways=5,
test_samples=10,
root='~/data',
device=None,
**kwargs,
):
"""Tasksets for FC100 benchmarks."""
data_transform = tv.transforms.ToTensor()
train_dataset = l2l.vision.datasets.FC100(root=root,
... | [
"def",
"fc100_tasksets",
"(",
"train_ways",
"=",
"5",
",",
"train_samples",
"=",
"10",
",",
"test_ways",
"=",
"5",
",",
"test_samples",
"=",
"10",
",",
"root",
"=",
"'~/data'",
",",
"device",
"=",
"None",
",",
"*",
"*",
"kwargs",
",",
")",
":",
"data... | https://github.com/learnables/learn2learn/blob/c664e3c8643efb1cc1cf7bb11668843e2ee8ebbe/learn2learn/vision/benchmarks/fc100_benchmark.py#L9-L73 | |
kupferlauncher/kupfer | 1c1e9bcbce05a82f503f68f8b3955c20b02639b3 | oldplugins/vim/plugin.py | python | stop_plugin_service | (plugin_id) | Return True if it was running and was stopped | Return True if it was running and was stopped | [
"Return",
"True",
"if",
"it",
"was",
"running",
"and",
"was",
"stopped"
] | def stop_plugin_service(plugin_id):
"""
Return True if it was running and was stopped
"""
plug_iface = get_plugin_service_obj(plugin_id, activate=False)
if plug_iface:
plug_iface.Exit(reply_handler=_dummy_handler,
error_handler=_dummy_handler) | [
"def",
"stop_plugin_service",
"(",
"plugin_id",
")",
":",
"plug_iface",
"=",
"get_plugin_service_obj",
"(",
"plugin_id",
",",
"activate",
"=",
"False",
")",
"if",
"plug_iface",
":",
"plug_iface",
".",
"Exit",
"(",
"reply_handler",
"=",
"_dummy_handler",
",",
"er... | https://github.com/kupferlauncher/kupfer/blob/1c1e9bcbce05a82f503f68f8b3955c20b02639b3/oldplugins/vim/plugin.py#L132-L139 | ||
HuangYG123/CurricularFace | 68c8727fb7cd2243ecbfd7e09c35efc87c6e2de4 | backbone/model_irse.py | python | IR_101 | (input_size) | return model | Constructs a ir-101 model. | Constructs a ir-101 model. | [
"Constructs",
"a",
"ir",
"-",
"101",
"model",
"."
] | def IR_101(input_size):
"""Constructs a ir-101 model.
"""
model = Backbone(input_size, 100, 'ir')
return model | [
"def",
"IR_101",
"(",
"input_size",
")",
":",
"model",
"=",
"Backbone",
"(",
"input_size",
",",
"100",
",",
"'ir'",
")",
"return",
"model"
] | https://github.com/HuangYG123/CurricularFace/blob/68c8727fb7cd2243ecbfd7e09c35efc87c6e2de4/backbone/model_irse.py#L199-L204 | |
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/sqlalchemy/ext/declarative/api.py | python | declarative_base | (bind=None, metadata=None, mapper=None, cls=object,
name='Base', constructor=_declarative_constructor,
class_registry=None,
metaclass=DeclarativeMeta) | return metaclass(name, bases, class_dict) | Construct a base class for declarative class definitions.
The new base class will be given a metaclass that produces
appropriate :class:`~sqlalchemy.schema.Table` objects and makes
the appropriate :func:`~sqlalchemy.orm.mapper` calls based on the
information provided declaratively in the class and any ... | Construct a base class for declarative class definitions. | [
"Construct",
"a",
"base",
"class",
"for",
"declarative",
"class",
"definitions",
"."
] | def declarative_base(bind=None, metadata=None, mapper=None, cls=object,
name='Base', constructor=_declarative_constructor,
class_registry=None,
metaclass=DeclarativeMeta):
"""Construct a base class for declarative class definitions.
The new base cl... | [
"def",
"declarative_base",
"(",
"bind",
"=",
"None",
",",
"metadata",
"=",
"None",
",",
"mapper",
"=",
"None",
",",
"cls",
"=",
"object",
",",
"name",
"=",
"'Base'",
",",
"constructor",
"=",
"_declarative_constructor",
",",
"class_registry",
"=",
"None",
"... | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/sqlalchemy/ext/declarative/api.py#L168-L247 | |
ghostop14/sparrow-wifi | 4b8289773ea4304872062f65a6ffc9352612b08e | plugins/falconwifi.py | python | FalconWirelessEngine.testWEPCapture | (apMacAddr, capFile) | [] | def testWEPCapture(apMacAddr, capFile):
# aircrack-ng -a2 -b D8:EB:97:2F:DD:CE -w /opt/wordlists/TopPasswords3-2.txt falconcap-01.cap
params = ['aircrack-ng','-f','4','-1','-b', apMacAddr, capFile]
result = subprocess.run(params, stdout=subprocess.PIPE,stderr=subprocess.DEVNULL)
... | [
"def",
"testWEPCapture",
"(",
"apMacAddr",
",",
"capFile",
")",
":",
"# aircrack-ng -a2 -b D8:EB:97:2F:DD:CE -w /opt/wordlists/TopPasswords3-2.txt falconcap-01.cap",
"params",
"=",
"[",
"'aircrack-ng'",
",",
"'-f'",
",",
"'4'",
",",
"'-1'",
",",
"'-b'",
",",
"apMacAddr",
... | https://github.com/ghostop14/sparrow-wifi/blob/4b8289773ea4304872062f65a6ffc9352612b08e/plugins/falconwifi.py#L675-L722 | ||||
EtienneCmb/visbrain | b599038e095919dc193b12d5e502d127de7d03c9 | visbrain/gui/brain/interface/ui_elements/ui_objects.py | python | UiObjects._fcn_obj_name | (self) | Change object name. | Change object name. | [
"Change",
"object",
"name",
"."
] | def _fcn_obj_name(self):
"""Change object name."""
idx_type = self._obj_type_lst.currentIndex()
if idx_type == 4: # Sources
fcn = self._sources_to_gui
elif idx_type == 5: # Connectivity
fcn = self._connect_to_gui
elif idx_type == 6: # time-series
... | [
"def",
"_fcn_obj_name",
"(",
"self",
")",
":",
"idx_type",
"=",
"self",
".",
"_obj_type_lst",
".",
"currentIndex",
"(",
")",
"if",
"idx_type",
"==",
"4",
":",
"# Sources",
"fcn",
"=",
"self",
".",
"_sources_to_gui",
"elif",
"idx_type",
"==",
"5",
":",
"#... | https://github.com/EtienneCmb/visbrain/blob/b599038e095919dc193b12d5e502d127de7d03c9/visbrain/gui/brain/interface/ui_elements/ui_objects.py#L58-L74 | ||
aws-cloudformation/cfn-lint | 16df5d0ca0d8ebcf9330ebea701e83d883b47217 | src/cfnlint/rules/resources/elb/Elb.py | python | Elb.__init__ | (self) | Init | Init | [
"Init"
] | def __init__(self):
""" Init """
super(Elb, self).__init__()
self.resource_property_types = ['AWS::ElasticLoadBalancingV2::LoadBalancer'] | [
"def",
"__init__",
"(",
"self",
")",
":",
"super",
"(",
"Elb",
",",
"self",
")",
".",
"__init__",
"(",
")",
"self",
".",
"resource_property_types",
"=",
"[",
"'AWS::ElasticLoadBalancingV2::LoadBalancer'",
"]"
] | https://github.com/aws-cloudformation/cfn-lint/blob/16df5d0ca0d8ebcf9330ebea701e83d883b47217/src/cfnlint/rules/resources/elb/Elb.py#L19-L22 | ||
chribsen/simple-machine-learning-examples | dc94e52a4cebdc8bb959ff88b81ff8cfeca25022 | venv/lib/python2.7/site-packages/pip/_vendor/lockfile/__init__.py | python | SQLiteFileLock | (*args, **kwds) | return _fl_helper(sqlitelockfile.SQLiteLockFile, "lockfile.sqlitelockfile",
*args, **kwds) | Factory function provided for backwards compatibility.
Do not use in new code. Instead, import SQLiteLockFile from the
lockfile.mkdirlockfile module. | Factory function provided for backwards compatibility. | [
"Factory",
"function",
"provided",
"for",
"backwards",
"compatibility",
"."
] | def SQLiteFileLock(*args, **kwds):
"""Factory function provided for backwards compatibility.
Do not use in new code. Instead, import SQLiteLockFile from the
lockfile.mkdirlockfile module.
"""
from . import sqlitelockfile
return _fl_helper(sqlitelockfile.SQLiteLockFile, "lockfile.sqlitelockfile... | [
"def",
"SQLiteFileLock",
"(",
"*",
"args",
",",
"*",
"*",
"kwds",
")",
":",
"from",
".",
"import",
"sqlitelockfile",
"return",
"_fl_helper",
"(",
"sqlitelockfile",
".",
"SQLiteLockFile",
",",
"\"lockfile.sqlitelockfile\"",
",",
"*",
"args",
",",
"*",
"*",
"k... | https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/pip/_vendor/lockfile/__init__.py#L304-L312 | |
donnemartin/viz | dc1ed0690ed3d8cb515c9dbac43bafc59a704789 | site/fabfile.py | python | rebuild | () | `clean` then `build` | `clean` then `build` | [
"clean",
"then",
"build"
] | def rebuild():
"""`clean` then `build`"""
clean()
build() | [
"def",
"rebuild",
"(",
")",
":",
"clean",
"(",
")",
"build",
"(",
")"
] | https://github.com/donnemartin/viz/blob/dc1ed0690ed3d8cb515c9dbac43bafc59a704789/site/fabfile.py#L39-L42 | ||
jimmysong/pb-exercises | c5e64075c47503a40063aa836c06a452af14246d | session3/answers.py | python | parse_txin | (cls, s) | return cls(prev_tx, prev_index, script_sig, sequence) | Takes a byte stream and parses the tx_input at the start
return a TxIn object | Takes a byte stream and parses the tx_input at the start
return a TxIn object | [
"Takes",
"a",
"byte",
"stream",
"and",
"parses",
"the",
"tx_input",
"at",
"the",
"start",
"return",
"a",
"TxIn",
"object"
] | def parse_txin(cls, s):
'''Takes a byte stream and parses the tx_input at the start
return a TxIn object
'''
prev_tx = s.read(32)[::-1]
prev_index = little_endian_to_int(s.read(4))
script_sig = Script.parse(s)
sequence = little_endian_to_int(s.read(4))
return cls(prev_tx, prev_index, scr... | [
"def",
"parse_txin",
"(",
"cls",
",",
"s",
")",
":",
"prev_tx",
"=",
"s",
".",
"read",
"(",
"32",
")",
"[",
":",
":",
"-",
"1",
"]",
"prev_index",
"=",
"little_endian_to_int",
"(",
"s",
".",
"read",
"(",
"4",
")",
")",
"script_sig",
"=",
"Script"... | https://github.com/jimmysong/pb-exercises/blob/c5e64075c47503a40063aa836c06a452af14246d/session3/answers.py#L204-L212 | |
KoreLogicSecurity/mastiff | 04d569e4fa59513572e77c74b049cad82f9b0310 | mastiff/core.py | python | Mastiff.__del__ | (self) | Class destructor. | Class destructor. | [
"Class",
"destructor",
"."
] | def __del__(self):
"""
Class destructor.
"""
# Close down all logging file handles so we don't have any open file descriptors
log = logging.getLogger("Mastiff")
handles = list(log.handlers)
for file_handle in handles:
log.removeHandler(file_handle)
... | [
"def",
"__del__",
"(",
"self",
")",
":",
"# Close down all logging file handles so we don't have any open file descriptors",
"log",
"=",
"logging",
".",
"getLogger",
"(",
"\"Mastiff\"",
")",
"handles",
"=",
"list",
"(",
"log",
".",
"handlers",
")",
"for",
"file_handle... | https://github.com/KoreLogicSecurity/mastiff/blob/04d569e4fa59513572e77c74b049cad82f9b0310/mastiff/core.py#L231-L240 | ||
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/tiia/v20190529/models.py | python | RecognizeCarRequest.__init__ | (self) | r"""
:param ImageUrl: 图片URL地址。
图片限制:
• 图片格式:PNG、JPG、JPEG。
• 图片大小:所下载图片经Base64编码后不超过4M。图片下载时间不超过3秒。
建议:
• 图片像素:大于50*50像素,否则影响识别效果;
• 长宽比:长边:短边<5;
接口响应时间会受到图片下载时间的影响,建议使用更可靠的存储服务,推荐将图片存储在腾讯云COS。
:type ImageUrl: str
:param ImageBase64: 图片经过base64编码的内容。最大不超过4M。与ImageUrl同时存在时优先使用ImageUrl字段。
**注... | r"""
:param ImageUrl: 图片URL地址。
图片限制:
• 图片格式:PNG、JPG、JPEG。
• 图片大小:所下载图片经Base64编码后不超过4M。图片下载时间不超过3秒。
建议:
• 图片像素:大于50*50像素,否则影响识别效果;
• 长宽比:长边:短边<5;
接口响应时间会受到图片下载时间的影响,建议使用更可靠的存储服务,推荐将图片存储在腾讯云COS。
:type ImageUrl: str
:param ImageBase64: 图片经过base64编码的内容。最大不超过4M。与ImageUrl同时存在时优先使用ImageUrl字段。
**注... | [
"r",
":",
"param",
"ImageUrl",
":",
"图片URL地址。",
"图片限制:",
"•",
"图片格式:PNG、JPG、JPEG。",
"•",
"图片大小:所下载图片经Base64编码后不超过4M。图片下载时间不超过3秒。",
"建议:",
"•",
"图片像素:大于50",
"*",
"50像素,否则影响识别效果;",
"•",
"长宽比:长边:短边<5;",
"接口响应时间会受到图片下载时间的影响,建议使用更可靠的存储服务,推荐将图片存储在腾讯云COS。",
":",
"type",
"ImageUrl"... | def __init__(self):
r"""
:param ImageUrl: 图片URL地址。
图片限制:
• 图片格式:PNG、JPG、JPEG。
• 图片大小:所下载图片经Base64编码后不超过4M。图片下载时间不超过3秒。
建议:
• 图片像素:大于50*50像素,否则影响识别效果;
• 长宽比:长边:短边<5;
接口响应时间会受到图片下载时间的影响,建议使用更可靠的存储服务,推荐将图片存储在腾讯云COS。
:type ImageUrl: str
:param ImageBase64: 图片经过base64编码的内容。最大不超过4M。与Imag... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"ImageUrl",
"=",
"None",
"self",
".",
"ImageBase64",
"=",
"None"
] | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/tiia/v20190529/models.py#L1728-L1745 | ||
qutebrowser/qutebrowser | 3a2aaaacbf97f4bf0c72463f3da94ed2822a5442 | qutebrowser/browser/history.py | python | debug_dump_history | (dest) | Dump the history to a file in the old pre-SQL format.
Args:
dest: Where to write the file to. | Dump the history to a file in the old pre-SQL format. | [
"Dump",
"the",
"history",
"to",
"a",
"file",
"in",
"the",
"old",
"pre",
"-",
"SQL",
"format",
"."
] | def debug_dump_history(dest):
"""Dump the history to a file in the old pre-SQL format.
Args:
dest: Where to write the file to.
"""
dest = os.path.expanduser(dest)
lines = (f'{int(x.atime)}{"-r" * x.redirect} {x.url} {x.title}'
for x in web_history.select(sort_by='atime', sort_... | [
"def",
"debug_dump_history",
"(",
"dest",
")",
":",
"dest",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"dest",
")",
"lines",
"=",
"(",
"f'{int(x.atime)}{\"-r\" * x.redirect} {x.url} {x.title}'",
"for",
"x",
"in",
"web_history",
".",
"select",
"(",
"sort_by"... | https://github.com/qutebrowser/qutebrowser/blob/3a2aaaacbf97f4bf0c72463f3da94ed2822a5442/qutebrowser/browser/history.py#L463-L479 | ||
1012598167/flask_mongodb_game | 60c7e0351586656ec38f851592886338e50b4110 | python_flask/venv/Lib/site-packages/itsdangerous/_compat.py | python | _constant_time_compare | (val1, val2) | return result == 0 | Return ``True`` if the two strings are equal, ``False``
otherwise.
The time taken is independent of the number of characters that
match. Do not use this function for anything else than comparision
with known length targets.
This is should be implemented in C in order to get it completely
right... | Return ``True`` if the two strings are equal, ``False``
otherwise. | [
"Return",
"True",
"if",
"the",
"two",
"strings",
"are",
"equal",
"False",
"otherwise",
"."
] | def _constant_time_compare(val1, val2):
"""Return ``True`` if the two strings are equal, ``False``
otherwise.
The time taken is independent of the number of characters that
match. Do not use this function for anything else than comparision
with known length targets.
This is should be implement... | [
"def",
"_constant_time_compare",
"(",
"val1",
",",
"val2",
")",
":",
"len_eq",
"=",
"len",
"(",
"val1",
")",
"==",
"len",
"(",
"val2",
")",
"if",
"len_eq",
":",
"result",
"=",
"0",
"left",
"=",
"val1",
"else",
":",
"result",
"=",
"1",
"left",
"=",
... | https://github.com/1012598167/flask_mongodb_game/blob/60c7e0351586656ec38f851592886338e50b4110/python_flask/venv/Lib/site-packages/itsdangerous/_compat.py#L19-L41 | |
openhatch/oh-mainline | ce29352a034e1223141dcc2f317030bbc3359a51 | vendor/packages/twisted/twisted/protocols/tls.py | python | TLSMemoryBIOProtocol.getHandle | (self) | return self._tlsConnection | Return the L{OpenSSL.SSL.Connection} object being used to encrypt and
decrypt this connection.
This is done for the benefit of L{twisted.internet.ssl.Certificate}'s
C{peerFromTransport} and C{hostFromTransport} methods only. A
different system handle may be returned by future versions ... | Return the L{OpenSSL.SSL.Connection} object being used to encrypt and
decrypt this connection. | [
"Return",
"the",
"L",
"{",
"OpenSSL",
".",
"SSL",
".",
"Connection",
"}",
"object",
"being",
"used",
"to",
"encrypt",
"and",
"decrypt",
"this",
"connection",
"."
] | def getHandle(self):
"""
Return the L{OpenSSL.SSL.Connection} object being used to encrypt and
decrypt this connection.
This is done for the benefit of L{twisted.internet.ssl.Certificate}'s
C{peerFromTransport} and C{hostFromTransport} methods only. A
different system h... | [
"def",
"getHandle",
"(",
"self",
")",
":",
"return",
"self",
".",
"_tlsConnection"
] | https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/twisted/twisted/protocols/tls.py#L113-L123 | |
tav/pylibs | 3c16b843681f54130ee6a022275289cadb2f2a69 | paramiko/sftp_file.py | python | SFTPFile._check_exception | (self) | if there's a saved exception, raise & clear it | if there's a saved exception, raise & clear it | [
"if",
"there",
"s",
"a",
"saved",
"exception",
"raise",
"&",
"clear",
"it"
] | def _check_exception(self):
"if there's a saved exception, raise & clear it"
if self._saved_exception is not None:
x = self._saved_exception
self._saved_exception = None
raise x | [
"def",
"_check_exception",
"(",
"self",
")",
":",
"if",
"self",
".",
"_saved_exception",
"is",
"not",
"None",
":",
"x",
"=",
"self",
".",
"_saved_exception",
"self",
".",
"_saved_exception",
"=",
"None",
"raise",
"x"
] | https://github.com/tav/pylibs/blob/3c16b843681f54130ee6a022275289cadb2f2a69/paramiko/sftp_file.py#L471-L476 | ||
scikit-learn/scikit-learn | 1d1aadd0711b87d2a11c80aad15df6f8cf156712 | sklearn/_loss/glm_distribution.py | python | ExponentialDispersionModel.unit_variance | (self, y_pred) | r"""Compute the unit variance function.
The unit variance :math:`v(y_\textrm{pred})` determines the variance as
a function of the mean :math:`y_\textrm{pred}` by
:math:`\mathrm{Var}[Y_i] = \phi/s_i*v(y_\textrm{pred}_i)`.
It can also be derived from the unit deviance
:math:`d(y,y... | r"""Compute the unit variance function. | [
"r",
"Compute",
"the",
"unit",
"variance",
"function",
"."
] | def unit_variance(self, y_pred):
r"""Compute the unit variance function.
The unit variance :math:`v(y_\textrm{pred})` determines the variance as
a function of the mean :math:`y_\textrm{pred}` by
:math:`\mathrm{Var}[Y_i] = \phi/s_i*v(y_\textrm{pred}_i)`.
It can also be derived fr... | [
"def",
"unit_variance",
"(",
"self",
",",
"y_pred",
")",
":"
] | https://github.com/scikit-learn/scikit-learn/blob/1d1aadd0711b87d2a11c80aad15df6f8cf156712/sklearn/_loss/glm_distribution.py#L69-L88 | ||
jstockwin/py-pdf-parser | 29d4656799876b35d95c82fd1230a2a92d24d6a6 | py_pdf_parser/components.py | python | PDFElement.font | (self) | return self.__font | The name and size of the font, separated by a comma with no spaces.
This will be taken from the pdf itself, using the first character in the
element.
If you have provided a font_mapping, this is the string you should map. If
the string is mapped in your font_mapping then the mapped val... | The name and size of the font, separated by a comma with no spaces. | [
"The",
"name",
"and",
"size",
"of",
"the",
"font",
"separated",
"by",
"a",
"comma",
"with",
"no",
"spaces",
"."
] | def font(self) -> str:
"""
The name and size of the font, separated by a comma with no spaces.
This will be taken from the pdf itself, using the first character in the
element.
If you have provided a font_mapping, this is the string you should map. If
the string is mapp... | [
"def",
"font",
"(",
"self",
")",
"->",
"str",
":",
"if",
"self",
".",
"__font",
"is",
"not",
"None",
":",
"return",
"self",
".",
"__font",
"font",
"=",
"f\"{self.font_name},{self.font_size}\"",
"if",
"self",
".",
"document",
".",
"_font_mapping_is_regex",
":... | https://github.com/jstockwin/py-pdf-parser/blob/29d4656799876b35d95c82fd1230a2a92d24d6a6/py_pdf_parser/components.py#L213-L237 | |
googlearchive/appengine-flask-skeleton | 8c25461d003a0bd99a9ff3b339c2791ee6919242 | lib/jinja2/bccache.py | python | Bucket.load_bytecode | (self, f) | Loads bytecode from a file or file like object. | Loads bytecode from a file or file like object. | [
"Loads",
"bytecode",
"from",
"a",
"file",
"or",
"file",
"like",
"object",
"."
] | def load_bytecode(self, f):
"""Loads bytecode from a file or file like object."""
# make sure the magic header is correct
magic = f.read(len(bc_magic))
if magic != bc_magic:
self.reset()
return
# the source code of the file changed, we need to reload
... | [
"def",
"load_bytecode",
"(",
"self",
",",
"f",
")",
":",
"# make sure the magic header is correct",
"magic",
"=",
"f",
".",
"read",
"(",
"len",
"(",
"bc_magic",
")",
")",
"if",
"magic",
"!=",
"bc_magic",
":",
"self",
".",
"reset",
"(",
")",
"return",
"# ... | https://github.com/googlearchive/appengine-flask-skeleton/blob/8c25461d003a0bd99a9ff3b339c2791ee6919242/lib/jinja2/bccache.py#L79-L96 | ||
G-Wang/WaveRNN-Pytorch | 7149631c777ad9c64d502e3628250830c30cefda | preprocess.py | python | process_data | (wav_dir, output_path, mel_path, wav_path) | given wav directory and output directory, process wav files and save quantized wav and mel
spectrogram to output directory | given wav directory and output directory, process wav files and save quantized wav and mel
spectrogram to output directory | [
"given",
"wav",
"directory",
"and",
"output",
"directory",
"process",
"wav",
"files",
"and",
"save",
"quantized",
"wav",
"and",
"mel",
"spectrogram",
"to",
"output",
"directory"
] | def process_data(wav_dir, output_path, mel_path, wav_path):
"""
given wav directory and output directory, process wav files and save quantized wav and mel
spectrogram to output directory
"""
dataset_ids = []
# get list of wav files
wav_files = os.listdir(wav_dir)
# check wav_file
ass... | [
"def",
"process_data",
"(",
"wav_dir",
",",
"output_path",
",",
"mel_path",
",",
"wav_path",
")",
":",
"dataset_ids",
"=",
"[",
"]",
"# get list of wav files",
"wav_files",
"=",
"os",
".",
"listdir",
"(",
"wav_dir",
")",
"# check wav_file",
"assert",
"len",
"(... | https://github.com/G-Wang/WaveRNN-Pytorch/blob/7149631c777ad9c64d502e3628250830c30cefda/preprocess.py#L40-L77 | ||
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/messaging/v1/service/us_app_to_person.py | python | UsAppToPersonInstance._proxy | (self) | return self._context | Generate an instance context for the instance, the context is capable of
performing various actions. All instance actions are proxied to the context
:returns: UsAppToPersonContext for this UsAppToPersonInstance
:rtype: twilio.rest.messaging.v1.service.us_app_to_person.UsAppToPersonContext | Generate an instance context for the instance, the context is capable of
performing various actions. All instance actions are proxied to the context | [
"Generate",
"an",
"instance",
"context",
"for",
"the",
"instance",
"the",
"context",
"is",
"capable",
"of",
"performing",
"various",
"actions",
".",
"All",
"instance",
"actions",
"are",
"proxied",
"to",
"the",
"context"
] | def _proxy(self):
"""
Generate an instance context for the instance, the context is capable of
performing various actions. All instance actions are proxied to the context
:returns: UsAppToPersonContext for this UsAppToPersonInstance
:rtype: twilio.rest.messaging.v1.service.us_a... | [
"def",
"_proxy",
"(",
"self",
")",
":",
"if",
"self",
".",
"_context",
"is",
"None",
":",
"self",
".",
"_context",
"=",
"UsAppToPersonContext",
"(",
"self",
".",
"_version",
",",
"messaging_service_sid",
"=",
"self",
".",
"_solution",
"[",
"'messaging_servic... | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/messaging/v1/service/us_app_to_person.py#L331-L345 | |
xinntao/EDVR | b02e63a0fc5854cad7b11a87f74601612e356eff | basicsr/data/data_util.py | python | paired_paths_from_meta_info_file | (folders, keys, meta_info_file,
filename_tmpl) | return paths | Generate paired paths from an meta information file.
Each line in the meta information file contains the image names and
image shape (usually for gt), separated by a white space.
Example of an meta information file:
```
0001_s001.png (480,480,3)
0001_s002.png (480,480,3)
```
Args:
... | Generate paired paths from an meta information file. | [
"Generate",
"paired",
"paths",
"from",
"an",
"meta",
"information",
"file",
"."
] | def paired_paths_from_meta_info_file(folders, keys, meta_info_file,
filename_tmpl):
"""Generate paired paths from an meta information file.
Each line in the meta information file contains the image names and
image shape (usually for gt), separated by a white space.
... | [
"def",
"paired_paths_from_meta_info_file",
"(",
"folders",
",",
"keys",
",",
"meta_info_file",
",",
"filename_tmpl",
")",
":",
"assert",
"len",
"(",
"folders",
")",
"==",
"2",
",",
"(",
"'The len of folders should be 2 with [input_folder, gt_folder]. '",
"f'But got {len(f... | https://github.com/xinntao/EDVR/blob/b02e63a0fc5854cad7b11a87f74601612e356eff/basicsr/data/data_util.py#L157-L204 | |
mdiazcl/fuzzbunch-debian | 2b76c2249ade83a389ae3badb12a1bd09901fd2c | windows/Resources/Python/Core/Lib/lib-tk/Tkinter.py | python | OptionMenu.__init__ | (self, master, variable, value, *values, **kwargs) | Construct an optionmenu widget with the parent MASTER, with
the resource textvariable set to VARIABLE, the initially selected
value VALUE, the other menu values VALUES and an additional
keyword argument command. | Construct an optionmenu widget with the parent MASTER, with
the resource textvariable set to VARIABLE, the initially selected
value VALUE, the other menu values VALUES and an additional
keyword argument command. | [
"Construct",
"an",
"optionmenu",
"widget",
"with",
"the",
"parent",
"MASTER",
"with",
"the",
"resource",
"textvariable",
"set",
"to",
"VARIABLE",
"the",
"initially",
"selected",
"value",
"VALUE",
"the",
"other",
"menu",
"values",
"VALUES",
"and",
"an",
"addition... | def __init__(self, master, variable, value, *values, **kwargs):
"""Construct an optionmenu widget with the parent MASTER, with
the resource textvariable set to VARIABLE, the initially selected
value VALUE, the other menu values VALUES and an additional
keyword argument command."""
... | [
"def",
"__init__",
"(",
"self",
",",
"master",
",",
"variable",
",",
"value",
",",
"*",
"values",
",",
"*",
"*",
"kwargs",
")",
":",
"kw",
"=",
"{",
"'borderwidth'",
":",
"2",
",",
"'textvariable'",
":",
"variable",
",",
"'indicatoron'",
":",
"1",
",... | https://github.com/mdiazcl/fuzzbunch-debian/blob/2b76c2249ade83a389ae3badb12a1bd09901fd2c/windows/Resources/Python/Core/Lib/lib-tk/Tkinter.py#L3558-L3579 | ||
GoogleCloudPlatform/gsutil | 5be882803e76608e2fd29cf8c504ccd1fe0a7746 | gslib/utils/hashing_helper.py | python | _CrcMultiply | (p, q) | return result | Multiplies two polynomials together modulo CASTAGNOLI_POLY.
Args:
p: The first polynomial.
q: The second polynomial.
Returns:
Result of the multiplication. | Multiplies two polynomials together modulo CASTAGNOLI_POLY. | [
"Multiplies",
"two",
"polynomials",
"together",
"modulo",
"CASTAGNOLI_POLY",
"."
] | def _CrcMultiply(p, q):
"""Multiplies two polynomials together modulo CASTAGNOLI_POLY.
Args:
p: The first polynomial.
q: The second polynomial.
Returns:
Result of the multiplication.
"""
result = 0
top_bit = 1 << DEGREE
for _ in range(DEGREE):
if p & 1:
result ^= q
q <<= 1
... | [
"def",
"_CrcMultiply",
"(",
"p",
",",
"q",
")",
":",
"result",
"=",
"0",
"top_bit",
"=",
"1",
"<<",
"DEGREE",
"for",
"_",
"in",
"range",
"(",
"DEGREE",
")",
":",
"if",
"p",
"&",
"1",
":",
"result",
"^=",
"q",
"q",
"<<=",
"1",
"if",
"q",
"&",
... | https://github.com/GoogleCloudPlatform/gsutil/blob/5be882803e76608e2fd29cf8c504ccd1fe0a7746/gslib/utils/hashing_helper.py#L127-L147 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.