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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
SCons/scons | 309f0234d1d9cc76955818be47c5c722f577dac6 | SCons/Debug.py | python | caller_trace | (back=0) | Trace caller stack and save info into global dicts, which
are printed automatically at the end of SCons execution. | Trace caller stack and save info into global dicts, which
are printed automatically at the end of SCons execution. | [
"Trace",
"caller",
"stack",
"and",
"save",
"info",
"into",
"global",
"dicts",
"which",
"are",
"printed",
"automatically",
"at",
"the",
"end",
"of",
"SCons",
"execution",
"."
] | def caller_trace(back=0):
"""
Trace caller stack and save info into global dicts, which
are printed automatically at the end of SCons execution.
"""
global caller_bases, caller_dicts
import traceback
tb = traceback.extract_stack(limit=3+back)
tb.reverse()
callee = tb[1][:3]
calle... | [
"def",
"caller_trace",
"(",
"back",
"=",
"0",
")",
":",
"global",
"caller_bases",
",",
"caller_dicts",
"import",
"traceback",
"tb",
"=",
"traceback",
".",
"extract_stack",
"(",
"limit",
"=",
"3",
"+",
"back",
")",
"tb",
".",
"reverse",
"(",
")",
"callee"... | https://github.com/SCons/scons/blob/309f0234d1d9cc76955818be47c5c722f577dac6/SCons/Debug.py#L135-L153 | ||
apple/ccs-calendarserver | 13c706b985fb728b9aab42dc0fef85aae21921c3 | contrib/od/setup_directory.py | python | ODError.__init__ | (self, error) | [] | def __init__(self, error):
self.message = (str(error), error.code()) | [
"def",
"__init__",
"(",
"self",
",",
"error",
")",
":",
"self",
".",
"message",
"=",
"(",
"str",
"(",
"error",
")",
",",
"error",
".",
"code",
"(",
")",
")"
] | https://github.com/apple/ccs-calendarserver/blob/13c706b985fb728b9aab42dc0fef85aae21921c3/contrib/od/setup_directory.py#L422-L423 | ||||
inventree/InvenTree | 4a5e4a88ac3e91d64a21e8cab3708ecbc6e2bd8b | InvenTree/plugin/models.py | python | PluginConfig.__init__ | (self, *args, **kwargs) | Override to set original state of the plugin-config instance | Override to set original state of the plugin-config instance | [
"Override",
"to",
"set",
"original",
"state",
"of",
"the",
"plugin",
"-",
"config",
"instance"
] | def __init__(self, *args, **kwargs):
"""
Override to set original state of the plugin-config instance
"""
super().__init__(*args, **kwargs)
self.__org_active = self.active
# append settings from registry
self.plugin = plugin_registry.plugins.get(self.key, None)
... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"self",
".",
"__org_active",
"=",
"self",
".",
"active",
"# append settings from ... | https://github.com/inventree/InvenTree/blob/4a5e4a88ac3e91d64a21e8cab3708ecbc6e2bd8b/InvenTree/plugin/models.py#L66-L86 | ||
francisck/DanderSpritz_docs | 86bb7caca5a957147f120b18bb5c31f299914904 | Python/Core/Lib/nntplib.py | python | NNTP.artcmd | (self, line, file=None) | return (
resp, nr, id, list) | Internal: process a HEAD, BODY or ARTICLE command. | Internal: process a HEAD, BODY or ARTICLE command. | [
"Internal",
":",
"process",
"a",
"HEAD",
"BODY",
"or",
"ARTICLE",
"command",
"."
] | def artcmd(self, line, file=None):
"""Internal: process a HEAD, BODY or ARTICLE command."""
resp, list = self.longcmd(line, file)
resp, nr, id = self.statparse(resp)
return (
resp, nr, id, list) | [
"def",
"artcmd",
"(",
"self",
",",
"line",
",",
"file",
"=",
"None",
")",
":",
"resp",
",",
"list",
"=",
"self",
".",
"longcmd",
"(",
"line",
",",
"file",
")",
"resp",
",",
"nr",
",",
"id",
"=",
"self",
".",
"statparse",
"(",
"resp",
")",
"retu... | https://github.com/francisck/DanderSpritz_docs/blob/86bb7caca5a957147f120b18bb5c31f299914904/Python/Core/Lib/nntplib.py#L375-L380 | |
softlayer/softlayer-python | cdef7d63c66413197a9a97b0414de9f95887a82a | SoftLayer/CLI/globalip/cancel.py | python | cli | (env, identifier) | Cancel global IP. | Cancel global IP. | [
"Cancel",
"global",
"IP",
"."
] | def cli(env, identifier):
"""Cancel global IP."""
mgr = SoftLayer.NetworkManager(env.client)
global_ip_id = helpers.resolve_id(mgr.resolve_global_ip_ids, identifier,
name='global ip')
if not (env.skip_confirmations or formatting.no_going_back(global_ip_id)):
... | [
"def",
"cli",
"(",
"env",
",",
"identifier",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"NetworkManager",
"(",
"env",
".",
"client",
")",
"global_ip_id",
"=",
"helpers",
".",
"resolve_id",
"(",
"mgr",
".",
"resolve_global_ip_ids",
",",
"identifier",
",",
"nam... | https://github.com/softlayer/softlayer-python/blob/cdef7d63c66413197a9a97b0414de9f95887a82a/SoftLayer/CLI/globalip/cancel.py#L16-L26 | ||
edfungus/Crouton | ada98b3930192938a48909072b45cb84b945f875 | clients/python_clients/cf_demo_client/cf_env/lib/python2.7/site-packages/pkg_resources/__init__.py | python | ResourceManager.resource_exists | (self, package_or_requirement, resource_name) | return get_provider(package_or_requirement).has_resource(resource_name) | Does the named resource exist? | Does the named resource exist? | [
"Does",
"the",
"named",
"resource",
"exist?"
] | def resource_exists(self, package_or_requirement, resource_name):
"""Does the named resource exist?"""
return get_provider(package_or_requirement).has_resource(resource_name) | [
"def",
"resource_exists",
"(",
"self",
",",
"package_or_requirement",
",",
"resource_name",
")",
":",
"return",
"get_provider",
"(",
"package_or_requirement",
")",
".",
"has_resource",
"(",
"resource_name",
")"
] | https://github.com/edfungus/Crouton/blob/ada98b3930192938a48909072b45cb84b945f875/clients/python_clients/cf_demo_client/cf_env/lib/python2.7/site-packages/pkg_resources/__init__.py#L1148-L1150 | |
triaquae/triaquae | bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9 | TriAquae/models/Centos_6.4/paramiko/sftp.py | python | BaseSFTP._read_all | (self, n) | return out | [] | def _read_all(self, n):
out = ''
while n > 0:
if isinstance(self.sock, socket.socket):
# sometimes sftp is used directly over a socket instead of
# through a paramiko channel. in this case, check periodically
# if the socket is closed. (for s... | [
"def",
"_read_all",
"(",
"self",
",",
"n",
")",
":",
"out",
"=",
"''",
"while",
"n",
">",
"0",
":",
"if",
"isinstance",
"(",
"self",
".",
"sock",
",",
"socket",
".",
"socket",
")",
":",
"# sometimes sftp is used directly over a socket instead of",
"# through... | https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/Centos_6.4/paramiko/sftp.py#L144-L165 | |||
Nuitka/Nuitka | 39262276993757fa4e299f497654065600453fc9 | nuitka/Options.py | python | getMainArgs | () | return tuple(extra_args) | *tuple*, arguments following the optional arguments | *tuple*, arguments following the optional arguments | [
"*",
"tuple",
"*",
"arguments",
"following",
"the",
"optional",
"arguments"
] | def getMainArgs():
"""*tuple*, arguments following the optional arguments"""
return tuple(extra_args) | [
"def",
"getMainArgs",
"(",
")",
":",
"return",
"tuple",
"(",
"extra_args",
")"
] | https://github.com/Nuitka/Nuitka/blob/39262276993757fa4e299f497654065600453fc9/nuitka/Options.py#L810-L812 | |
MrH0wl/Cloudmare | 65e5bc9888f9d362ab2abfb103ea6c1e869d67aa | thirdparty/dns/set.py | python | Set.difference | (self, other) | return obj | Return a new set which ``self`` - ``other``, i.e. the items
in ``self`` which are not also in ``other``.
Returns the same Set type as this set. | Return a new set which ``self`` - ``other``, i.e. the items
in ``self`` which are not also in ``other``. | [
"Return",
"a",
"new",
"set",
"which",
"self",
"-",
"other",
"i",
".",
"e",
".",
"the",
"items",
"in",
"self",
"which",
"are",
"not",
"also",
"in",
"other",
"."
] | def difference(self, other):
"""Return a new set which ``self`` - ``other``, i.e. the items
in ``self`` which are not also in ``other``.
Returns the same Set type as this set.
"""
obj = self._clone()
obj.difference_update(other)
return obj | [
"def",
"difference",
"(",
"self",
",",
"other",
")",
":",
"obj",
"=",
"self",
".",
"_clone",
"(",
")",
"obj",
".",
"difference_update",
"(",
"other",
")",
"return",
"obj"
] | https://github.com/MrH0wl/Cloudmare/blob/65e5bc9888f9d362ab2abfb103ea6c1e869d67aa/thirdparty/dns/set.py#L165-L174 | |
shaneshixiang/rllabplusplus | 4d55f96ec98e3fe025b7991945e3e6a54fd5449f | rllab/rllab_mujoco_py/glfw.py | python | set_monitor_callback | (cbfun) | Sets the monitor configuration callback.
Wrapper for:
GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun cbfun); | Sets the monitor configuration callback. | [
"Sets",
"the",
"monitor",
"configuration",
"callback",
"."
] | def set_monitor_callback(cbfun):
'''
Sets the monitor configuration callback.
Wrapper for:
GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun cbfun);
'''
global _monitor_callback
previous_callback = _monitor_callback
if cbfun is None:
cbfun = 0
c_cbfun = _GLFWmonitorfu... | [
"def",
"set_monitor_callback",
"(",
"cbfun",
")",
":",
"global",
"_monitor_callback",
"previous_callback",
"=",
"_monitor_callback",
"if",
"cbfun",
"is",
"None",
":",
"cbfun",
"=",
"0",
"c_cbfun",
"=",
"_GLFWmonitorfun",
"(",
"cbfun",
")",
"_monitor_callback",
"="... | https://github.com/shaneshixiang/rllabplusplus/blob/4d55f96ec98e3fe025b7991945e3e6a54fd5449f/rllab/rllab_mujoco_py/glfw.py#L671-L687 | ||
oaubert/python-vlc | 908ffdbd0844dc1849728c456e147788798c99da | generated/dev/vlc.py | python | Instance.media_player_new | (self, uri=None) | return p | Create a new MediaPlayer instance.
@param uri: an optional URI to play in the player as a str, bytes or PathLike object. | Create a new MediaPlayer instance. | [
"Create",
"a",
"new",
"MediaPlayer",
"instance",
"."
] | def media_player_new(self, uri=None):
"""Create a new MediaPlayer instance.
@param uri: an optional URI to play in the player as a str, bytes or PathLike object.
"""
p = libvlc_media_player_new(self)
if uri:
p.set_media(self.media_new(uri))
p._instance = self... | [
"def",
"media_player_new",
"(",
"self",
",",
"uri",
"=",
"None",
")",
":",
"p",
"=",
"libvlc_media_player_new",
"(",
"self",
")",
"if",
"uri",
":",
"p",
".",
"set_media",
"(",
"self",
".",
"media_new",
"(",
"uri",
")",
")",
"p",
".",
"_instance",
"="... | https://github.com/oaubert/python-vlc/blob/908ffdbd0844dc1849728c456e147788798c99da/generated/dev/vlc.py#L2096-L2105 | |
rspivak/slimit | 3533eba9ad5b39f3a015ae6269670022ab310847 | src/slimit/parser.py | python | Parser.p_case_clauses | (self, p) | case_clauses : case_clause
| case_clauses case_clause | case_clauses : case_clause
| case_clauses case_clause | [
"case_clauses",
":",
"case_clause",
"|",
"case_clauses",
"case_clause"
] | def p_case_clauses(self, p):
"""case_clauses : case_clause
| case_clauses case_clause
"""
if len(p) == 2:
p[0] = [p[1]]
else:
p[1].append(p[2])
p[0] = p[1] | [
"def",
"p_case_clauses",
"(",
"self",
",",
"p",
")",
":",
"if",
"len",
"(",
"p",
")",
"==",
"2",
":",
"p",
"[",
"0",
"]",
"=",
"[",
"p",
"[",
"1",
"]",
"]",
"else",
":",
"p",
"[",
"1",
"]",
".",
"append",
"(",
"p",
"[",
"2",
"]",
")",
... | https://github.com/rspivak/slimit/blob/3533eba9ad5b39f3a015ae6269670022ab310847/src/slimit/parser.py#L1109-L1117 | ||
Source-Python-Dev-Team/Source.Python | d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb | addons/source-python/Python3/encodings/punycode.py | python | insertion_unsort | (str, extended) | return result | 3.2 Insertion unsort coding | 3.2 Insertion unsort coding | [
"3",
".",
"2",
"Insertion",
"unsort",
"coding"
] | def insertion_unsort(str, extended):
"""3.2 Insertion unsort coding"""
oldchar = 0x80
result = []
oldindex = -1
for c in extended:
index = pos = -1
char = ord(c)
curlen = selective_len(str, char)
delta = (curlen+1) * (char - oldchar)
while 1:
index... | [
"def",
"insertion_unsort",
"(",
"str",
",",
"extended",
")",
":",
"oldchar",
"=",
"0x80",
"result",
"=",
"[",
"]",
"oldindex",
"=",
"-",
"1",
"for",
"c",
"in",
"extended",
":",
"index",
"=",
"pos",
"=",
"-",
"1",
"char",
"=",
"ord",
"(",
"c",
")"... | https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/Python3/encodings/punycode.py#L48-L68 | |
Amulet-Team/Amulet-Core | a57aeaa4216806401ff35a2dba38782a35abc42e | amulet/level/formats/sponge_schem/interface.py | python | SpongeSchemInterface.decode | (
self, cx: int, cz: int, data: SpongeSchemChunk
) | return chunk, palette | Create an amulet.api.chunk.Chunk object from raw data given by the format
:param cx: chunk x coordinate
:param cz: chunk z coordinate
:param data: Raw chunk data provided by the format.
:return: Chunk object in version-specific format, along with the block_palette for that chunk. | Create an amulet.api.chunk.Chunk object from raw data given by the format
:param cx: chunk x coordinate
:param cz: chunk z coordinate
:param data: Raw chunk data provided by the format.
:return: Chunk object in version-specific format, along with the block_palette for that chunk. | [
"Create",
"an",
"amulet",
".",
"api",
".",
"chunk",
".",
"Chunk",
"object",
"from",
"raw",
"data",
"given",
"by",
"the",
"format",
":",
"param",
"cx",
":",
"chunk",
"x",
"coordinate",
":",
"param",
"cz",
":",
"chunk",
"z",
"coordinate",
":",
"param",
... | def decode(
self, cx: int, cz: int, data: SpongeSchemChunk
) -> Tuple["Chunk", AnyNDArray]:
"""
Create an amulet.api.chunk.Chunk object from raw data given by the format
:param cx: chunk x coordinate
:param cz: chunk z coordinate
:param data: Raw chunk data provided b... | [
"def",
"decode",
"(",
"self",
",",
"cx",
":",
"int",
",",
"cz",
":",
"int",
",",
"data",
":",
"SpongeSchemChunk",
")",
"->",
"Tuple",
"[",
"\"Chunk\"",
",",
"AnyNDArray",
"]",
":",
"palette",
"=",
"numpy",
".",
"empty",
"(",
"len",
"(",
"data",
"."... | https://github.com/Amulet-Team/Amulet-Core/blob/a57aeaa4216806401ff35a2dba38782a35abc42e/amulet/level/formats/sponge_schem/interface.py#L26-L56 | |
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Lib/xml/sax/xmlreader.py | python | InputSource.getEncoding | (self) | return self.__encoding | Get the character encoding of this InputSource. | Get the character encoding of this InputSource. | [
"Get",
"the",
"character",
"encoding",
"of",
"this",
"InputSource",
"."
] | def getEncoding(self):
"Get the character encoding of this InputSource."
return self.__encoding | [
"def",
"getEncoding",
"(",
"self",
")",
":",
"return",
"self",
".",
"__encoding"
] | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/xml/sax/xmlreader.py#L236-L238 | |
TensorMSA/tensormsa | c36b565159cd934533636429add3c7d7263d622b | master/workflow/data/workflow_data_image.py | python | WorkFlowDataImage.set_preview_data | (self) | return None | :param type:
:param conn:
:return: | [] | def set_preview_data(self):
"""
:param type:
:param conn:
:return:
"""
return None | [
"def",
"set_preview_data",
"(",
"self",
")",
":",
"return",
"None"
] | https://github.com/TensorMSA/tensormsa/blob/c36b565159cd934533636429add3c7d7263d622b/master/workflow/data/workflow_data_image.py#L23-L30 | ||
pandas-dev/pandas | 5ba7d714014ae8feaccc0dd4a98890828cf2832d | pandas/core/dtypes/astype.py | python | astype_td64_unit_conversion | (
values: np.ndarray, dtype: np.dtype, copy: bool
) | return result | By pandas convention, converting to non-nano timedelta64
returns an int64-dtyped array with ints representing multiples
of the desired timedelta unit. This is essentially division.
Parameters
----------
values : np.ndarray[timedelta64[ns]]
dtype : np.dtype
timedelta64 with unit not-nec... | By pandas convention, converting to non-nano timedelta64
returns an int64-dtyped array with ints representing multiples
of the desired timedelta unit. This is essentially division. | [
"By",
"pandas",
"convention",
"converting",
"to",
"non",
"-",
"nano",
"timedelta64",
"returns",
"an",
"int64",
"-",
"dtyped",
"array",
"with",
"ints",
"representing",
"multiples",
"of",
"the",
"desired",
"timedelta",
"unit",
".",
"This",
"is",
"essentially",
"... | def astype_td64_unit_conversion(
values: np.ndarray, dtype: np.dtype, copy: bool
) -> np.ndarray:
"""
By pandas convention, converting to non-nano timedelta64
returns an int64-dtyped array with ints representing multiples
of the desired timedelta unit. This is essentially division.
Parameters
... | [
"def",
"astype_td64_unit_conversion",
"(",
"values",
":",
"np",
".",
"ndarray",
",",
"dtype",
":",
"np",
".",
"dtype",
",",
"copy",
":",
"bool",
")",
"->",
"np",
".",
"ndarray",
":",
"if",
"is_dtype_equal",
"(",
"values",
".",
"dtype",
",",
"dtype",
")... | https://github.com/pandas-dev/pandas/blob/5ba7d714014ae8feaccc0dd4a98890828cf2832d/pandas/core/dtypes/astype.py#L307-L337 | |
openstack/rally | 58b12c2e0bfa541bdb038be6e1679c5117b98484 | rally/cli/cliutils.py | python | print_dict | (obj, fields=None, formatters=None, mixed_case_fields=False,
normalize_field_names=False, property_label="Property",
value_label="Value", table_label=None, print_header=True,
print_border=True, wrap=0, out=sys.stdout) | Print dict as a table.
:param obj: dict to print
:param fields: `dict` of keys to print from d. Defaults to all keys
:param formatters: `dict` of callables for field formatting
:param mixed_case_fields: fields corresponding to object attributes that
have mixed case names (e.g., 'serverId')
... | Print dict as a table. | [
"Print",
"dict",
"as",
"a",
"table",
"."
] | def print_dict(obj, fields=None, formatters=None, mixed_case_fields=False,
normalize_field_names=False, property_label="Property",
value_label="Value", table_label=None, print_header=True,
print_border=True, wrap=0, out=sys.stdout):
"""Print dict as a table.
:param ... | [
"def",
"print_dict",
"(",
"obj",
",",
"fields",
"=",
"None",
",",
"formatters",
"=",
"None",
",",
"mixed_case_fields",
"=",
"False",
",",
"normalize_field_names",
"=",
"False",
",",
"property_label",
"=",
"\"Property\"",
",",
"value_label",
"=",
"\"Value\"",
"... | https://github.com/openstack/rally/blob/58b12c2e0bfa541bdb038be6e1679c5117b98484/rally/cli/cliutils.py#L171-L253 | ||
pyglet/pyglet | 2833c1df902ca81aeeffa786c12e7e87d402434b | pyglet/media/drivers/xaudio2/lib_xaudio2.py | python | load_xaudio2 | (dll_name) | return xaudio2_lib, x3d_lib | This will attempt to load a version of XAudio2. Versions supported: 2.9, 2.8.
While Windows 8 ships with 2.8 and Windows 10 ships with version 2.9, it is possible to install 2.9 on 8/8.1. | This will attempt to load a version of XAudio2. Versions supported: 2.9, 2.8.
While Windows 8 ships with 2.8 and Windows 10 ships with version 2.9, it is possible to install 2.9 on 8/8.1. | [
"This",
"will",
"attempt",
"to",
"load",
"a",
"version",
"of",
"XAudio2",
".",
"Versions",
"supported",
":",
"2",
".",
"9",
"2",
".",
"8",
".",
"While",
"Windows",
"8",
"ships",
"with",
"2",
".",
"8",
"and",
"Windows",
"10",
"ships",
"with",
"version... | def load_xaudio2(dll_name):
"""This will attempt to load a version of XAudio2. Versions supported: 2.9, 2.8.
While Windows 8 ships with 2.8 and Windows 10 ships with version 2.9, it is possible to install 2.9 on 8/8.1.
"""
xaudio2 = dll_name
# System32 and SysWOW64 folders are opposite perception... | [
"def",
"load_xaudio2",
"(",
"dll_name",
")",
":",
"xaudio2",
"=",
"dll_name",
"# System32 and SysWOW64 folders are opposite perception in Windows x64.",
"# System32 = x64 dll's | SysWOW64 = x86 dlls",
"# By default ctypes only seems to look in system32 regardless of Python architecture, which ... | https://github.com/pyglet/pyglet/blob/2833c1df902ca81aeeffa786c12e7e87d402434b/pyglet/media/drivers/xaudio2/lib_xaudio2.py#L12-L28 | |
ChenRocks/UNITER | 1dbfa62bb8ddb1f2b11d20775ce324c5e45a3ab4 | data/nlvr2.py | python | Nlvr2PairedDataset.__getitem__ | (self, i) | return tuple(outs), target | [[txt, img1],
[txt, img2]] | [[txt, img1],
[txt, img2]] | [
"[[",
"txt",
"img1",
"]",
"[",
"txt",
"img2",
"]]"
] | def __getitem__(self, i):
"""
[[txt, img1],
[txt, img2]]
"""
example = super().__getitem__(i)
target = example['target']
outs = []
for i, img in enumerate(example['img_fname']):
img_feat, img_pos_feat, num_bb = self._get_img_feat(img)
... | [
"def",
"__getitem__",
"(",
"self",
",",
"i",
")",
":",
"example",
"=",
"super",
"(",
")",
".",
"__getitem__",
"(",
"i",
")",
"target",
"=",
"example",
"[",
"'target'",
"]",
"outs",
"=",
"[",
"]",
"for",
"i",
",",
"img",
"in",
"enumerate",
"(",
"e... | https://github.com/ChenRocks/UNITER/blob/1dbfa62bb8ddb1f2b11d20775ce324c5e45a3ab4/data/nlvr2.py#L33-L58 | |
PyMySQL/mysqlclient | 2316313fc6777591494e870ba0c5da0d3dcd6dc6 | MySQLdb/connections.py | python | Connection.literal | (self, o) | return s | If o is a single object, returns an SQL literal as a string.
If o is a non-string sequence, the items of the sequence are
converted and returned as a sequence.
Non-standard. For internal use; do not use this in your
applications. | If o is a single object, returns an SQL literal as a string.
If o is a non-string sequence, the items of the sequence are
converted and returned as a sequence. | [
"If",
"o",
"is",
"a",
"single",
"object",
"returns",
"an",
"SQL",
"literal",
"as",
"a",
"string",
".",
"If",
"o",
"is",
"a",
"non",
"-",
"string",
"sequence",
"the",
"items",
"of",
"the",
"sequence",
"are",
"converted",
"and",
"returned",
"as",
"a",
... | def literal(self, o):
"""If o is a single object, returns an SQL literal as a string.
If o is a non-string sequence, the items of the sequence are
converted and returned as a sequence.
Non-standard. For internal use; do not use this in your
applications.
"""
if i... | [
"def",
"literal",
"(",
"self",
",",
"o",
")",
":",
"if",
"isinstance",
"(",
"o",
",",
"str",
")",
":",
"s",
"=",
"self",
".",
"string_literal",
"(",
"o",
".",
"encode",
"(",
"self",
".",
"encoding",
")",
")",
"elif",
"isinstance",
"(",
"o",
",",
... | https://github.com/PyMySQL/mysqlclient/blob/2316313fc6777591494e870ba0c5da0d3dcd6dc6/MySQLdb/connections.py#L266-L287 | |
python-discord/bot | 26c5587ac13e5414361bb6e7ada42983b81014d2 | bot/rules/burst_shared.py | python | apply | (
last_message: Message, recent_messages: List[Message], config: Dict[str, int]
) | return None | Detects repeated messages sent by multiple users. | Detects repeated messages sent by multiple users. | [
"Detects",
"repeated",
"messages",
"sent",
"by",
"multiple",
"users",
"."
] | async def apply(
last_message: Message, recent_messages: List[Message], config: Dict[str, int]
) -> Optional[Tuple[str, Iterable[Member], Iterable[Message]]]:
"""Detects repeated messages sent by multiple users."""
total_recent = len(recent_messages)
if total_recent > config['max']:
return (
... | [
"async",
"def",
"apply",
"(",
"last_message",
":",
"Message",
",",
"recent_messages",
":",
"List",
"[",
"Message",
"]",
",",
"config",
":",
"Dict",
"[",
"str",
",",
"int",
"]",
")",
"->",
"Optional",
"[",
"Tuple",
"[",
"str",
",",
"Iterable",
"[",
"M... | https://github.com/python-discord/bot/blob/26c5587ac13e5414361bb6e7ada42983b81014d2/bot/rules/burst_shared.py#L6-L18 | |
HypoX64/DeepMosaics | b311aaac319439a0a1e8004b4a64c4222c55f38c | models/pix2pix_model.py | python | ResnetBlock.forward | (self, x) | return out | Forward function (with skip connections) | Forward function (with skip connections) | [
"Forward",
"function",
"(",
"with",
"skip",
"connections",
")"
] | def forward(self, x):
"""Forward function (with skip connections)"""
out = x + self.conv_block(x) # add skip connections
return out | [
"def",
"forward",
"(",
"self",
",",
"x",
")",
":",
"out",
"=",
"x",
"+",
"self",
".",
"conv_block",
"(",
"x",
")",
"# add skip connections",
"return",
"out"
] | https://github.com/HypoX64/DeepMosaics/blob/b311aaac319439a0a1e8004b4a64c4222c55f38c/models/pix2pix_model.py#L449-L452 | |
PhoenixDL/rising | 6de193375dcaac35605163c35cec259c9a2116d1 | rising/transforms/format.py | python | MapToSeq.forward | (self, **data) | return tuple(data[_k] for _k in self.keys) | Convert input
Args:
data: input dict
Returns:
tuple: mapped data | Convert input | [
"Convert",
"input"
] | def forward(self, **data) -> tuple:
"""
Convert input
Args:
data: input dict
Returns:
tuple: mapped data
"""
return tuple(data[_k] for _k in self.keys) | [
"def",
"forward",
"(",
"self",
",",
"*",
"*",
"data",
")",
"->",
"tuple",
":",
"return",
"tuple",
"(",
"data",
"[",
"_k",
"]",
"for",
"_k",
"in",
"self",
".",
"keys",
")"
] | https://github.com/PhoenixDL/rising/blob/6de193375dcaac35605163c35cec259c9a2116d1/rising/transforms/format.py#L27-L37 | |
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/asn1crypto-0.24.0/asn1crypto/keys.py | python | PrivateKeyInfo.fingerprint | (self) | return self._fingerprint | Creates a fingerprint that can be compared with a public key to see if
the two form a pair.
This fingerprint is not compatible with fingerprints generated by any
other software.
:return:
A byte string that is a sha256 hash of selected components (based
on the ke... | Creates a fingerprint that can be compared with a public key to see if
the two form a pair. | [
"Creates",
"a",
"fingerprint",
"that",
"can",
"be",
"compared",
"with",
"a",
"public",
"key",
"to",
"see",
"if",
"the",
"two",
"form",
"a",
"pair",
"."
] | def fingerprint(self):
"""
Creates a fingerprint that can be compared with a public key to see if
the two form a pair.
This fingerprint is not compatible with fingerprints generated by any
other software.
:return:
A byte string that is a sha256 hash of selec... | [
"def",
"fingerprint",
"(",
"self",
")",
":",
"if",
"self",
".",
"_fingerprint",
"is",
"None",
":",
"params",
"=",
"self",
"[",
"'private_key_algorithm'",
"]",
"[",
"'parameters'",
"]",
"key",
"=",
"self",
"[",
"'private_key'",
"]",
".",
"parsed",
"if",
"... | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/asn1crypto-0.24.0/asn1crypto/keys.py#L826-L883 | |
frenetic-lang/pyretic | 30462692f3e9675158862755955b44f3a37ea21c | pyretic/core/language.py | python | CountBucket.clear_existing_rule_flag | (self, entry) | Clear the "existing rule" flag for the provided entry in
self.matches. This method should only be called in the context of
holding the bucket's in_update_cv since it updates the matches
structure. | Clear the "existing rule" flag for the provided entry in
self.matches. This method should only be called in the context of
holding the bucket's in_update_cv since it updates the matches
structure. | [
"Clear",
"the",
"existing",
"rule",
"flag",
"for",
"the",
"provided",
"entry",
"in",
"self",
".",
"matches",
".",
"This",
"method",
"should",
"only",
"be",
"called",
"in",
"the",
"context",
"of",
"holding",
"the",
"bucket",
"s",
"in_update_cv",
"since",
"i... | def clear_existing_rule_flag(self, entry):
"""Clear the "existing rule" flag for the provided entry in
self.matches. This method should only be called in the context of
holding the bucket's in_update_cv since it updates the matches
structure.
"""
assert k in self.matches
... | [
"def",
"clear_existing_rule_flag",
"(",
"self",
",",
"entry",
")",
":",
"assert",
"k",
"in",
"self",
".",
"matches",
"self",
".",
"matches",
"[",
"k",
"]",
".",
"existing_rule",
"=",
"False"
] | https://github.com/frenetic-lang/pyretic/blob/30462692f3e9675158862755955b44f3a37ea21c/pyretic/core/language.py#L1306-L1313 | ||
chribsen/simple-machine-learning-examples | dc94e52a4cebdc8bb959ff88b81ff8cfeca25022 | venv/lib/python2.7/site-packages/pandas/core/frame.py | python | DataFrame.from_items | (cls, items, columns=None, orient='columns') | Convert (key, value) pairs to DataFrame. The keys will be the axis
index (usually the columns, but depends on the specified
orientation). The values should be arrays or Series.
Parameters
----------
items : sequence of (key, value) pairs
Values should be arrays or Se... | Convert (key, value) pairs to DataFrame. The keys will be the axis
index (usually the columns, but depends on the specified
orientation). The values should be arrays or Series. | [
"Convert",
"(",
"key",
"value",
")",
"pairs",
"to",
"DataFrame",
".",
"The",
"keys",
"will",
"be",
"the",
"axis",
"index",
"(",
"usually",
"the",
"columns",
"but",
"depends",
"on",
"the",
"specified",
"orientation",
")",
".",
"The",
"values",
"should",
"... | def from_items(cls, items, columns=None, orient='columns'):
"""
Convert (key, value) pairs to DataFrame. The keys will be the axis
index (usually the columns, but depends on the specified
orientation). The values should be arrays or Series.
Parameters
----------
... | [
"def",
"from_items",
"(",
"cls",
",",
"items",
",",
"columns",
"=",
"None",
",",
"orient",
"=",
"'columns'",
")",
":",
"keys",
",",
"values",
"=",
"lzip",
"(",
"*",
"items",
")",
"if",
"orient",
"==",
"'columns'",
":",
"if",
"columns",
"is",
"not",
... | https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/pandas/core/frame.py#L1116-L1167 | ||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/combinat/cluster_complex.py | python | ClusterComplexFacet.upper_cluster | (self) | return [beta for beta in self.cluster() if sum(beta) > 0] | Return the part of the cluster that contains positive roots
EXAMPLES::
sage: C = ClusterComplex(['A', 2])
sage: F = C((0, 1))
sage: F.upper_cluster()
[] | Return the part of the cluster that contains positive roots | [
"Return",
"the",
"part",
"of",
"the",
"cluster",
"that",
"contains",
"positive",
"roots"
] | def upper_cluster(self):
"""
Return the part of the cluster that contains positive roots
EXAMPLES::
sage: C = ClusterComplex(['A', 2])
sage: F = C((0, 1))
sage: F.upper_cluster()
[]
"""
return [beta for beta in self.cluster() if s... | [
"def",
"upper_cluster",
"(",
"self",
")",
":",
"return",
"[",
"beta",
"for",
"beta",
"in",
"self",
".",
"cluster",
"(",
")",
"if",
"sum",
"(",
"beta",
")",
">",
"0",
"]"
] | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/cluster_complex.py#L78-L89 | |
Droidtown/ArticutAPI | ee415bb30c9722a85334d54d7015d5ad3870205f | ArticutAPI/WS_ArticutAPI.py | python | WS_Articut.getQuestionLIST | (self, parseResultDICT, indexWithPOS=True) | return self.POS.getQuestionLIST(parseResultDICT, indexWithPOS) | 取出斷詞結果中含有 (CLAUSE_Q) 標籤的句子。
此處指的是
<CLAUSE_AnotAQ>: A-not-A 問句
<CLAUSE_YesNoQ>: 是非問句
<CLAUSE_WhoQ">: 「誰」問句
<CLAUSE_WhatQ>: 「物」問句
<CLAUSE_WhereQ>: 「何地」問句
<CLAUSE_WhenQ>: 「何時」問句
<CLAUSE_HowQ>: 「程度/過程」問句
<CLAUSE_WhyQ>: 「... | 取出斷詞結果中含有 (CLAUSE_Q) 標籤的句子。
此處指的是
<CLAUSE_AnotAQ>: A-not-A 問句
<CLAUSE_YesNoQ>: 是非問句
<CLAUSE_WhoQ">: 「誰」問句
<CLAUSE_WhatQ>: 「物」問句
<CLAUSE_WhereQ>: 「何地」問句
<CLAUSE_WhenQ>: 「何時」問句
<CLAUSE_HowQ>: 「程度/過程」問句
<CLAUSE_WhyQ>: 「... | [
"取出斷詞結果中含有",
"(",
"CLAUSE_Q",
")",
"標籤的句子。",
"此處指的是",
"<CLAUSE_AnotAQ",
">",
":",
"A",
"-",
"not",
"-",
"A",
"問句",
"<CLAUSE_YesNoQ",
">",
":",
"是非問句",
"<CLAUSE_WhoQ",
">",
":",
"「誰」問句",
"<CLAUSE_WhatQ",
">",
":",
"「物」問句",
"<CLAUSE_WhereQ",
">",
":",
"「何地」問... | def getQuestionLIST(self, parseResultDICT, indexWithPOS=True):
'''
取出斷詞結果中含有 (CLAUSE_Q) 標籤的句子。
此處指的是
<CLAUSE_AnotAQ>: A-not-A 問句
<CLAUSE_YesNoQ>: 是非問句
<CLAUSE_WhoQ">: 「誰」問句
<CLAUSE_WhatQ>: 「物」問句
<CLAUSE_WhereQ>: 「何地」問句
<CLAU... | [
"def",
"getQuestionLIST",
"(",
"self",
",",
"parseResultDICT",
",",
"indexWithPOS",
"=",
"True",
")",
":",
"return",
"self",
".",
"POS",
".",
"getQuestionLIST",
"(",
"parseResultDICT",
",",
"indexWithPOS",
")"
] | https://github.com/Droidtown/ArticutAPI/blob/ee415bb30c9722a85334d54d7015d5ad3870205f/ArticutAPI/WS_ArticutAPI.py#L311-L325 | |
altair-viz/altair | fb9e82eb378f68bad7a10c639f95e9a3991ac18d | altair/vegalite/v3/api.py | python | TopLevelMixin._set_resolve | (self, **kwargs) | return copy | Copy the chart and update the resolve property with kwargs | Copy the chart and update the resolve property with kwargs | [
"Copy",
"the",
"chart",
"and",
"update",
"the",
"resolve",
"property",
"with",
"kwargs"
] | def _set_resolve(self, **kwargs):
"""Copy the chart and update the resolve property with kwargs"""
if not hasattr(self, "resolve"):
raise ValueError(
"{} object has no attribute " "'resolve'".format(self.__class__)
)
copy = self.copy(deep=["resolve"])
... | [
"def",
"_set_resolve",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"\"resolve\"",
")",
":",
"raise",
"ValueError",
"(",
"\"{} object has no attribute \"",
"\"'resolve'\"",
".",
"format",
"(",
"self",
".",
"__clas... | https://github.com/altair-viz/altair/blob/fb9e82eb378f68bad7a10c639f95e9a3991ac18d/altair/vegalite/v3/api.py#L1515-L1526 | |
shaneshixiang/rllabplusplus | 4d55f96ec98e3fe025b7991945e3e6a54fd5449f | sandbox/rocky/tf/regressors/categorical_mlp_regressor.py | python | CategoricalMLPRegressor.__init__ | (
self,
name,
input_shape,
output_dim,
prob_network=None,
hidden_sizes=(32, 32),
hidden_nonlinearity=tf.nn.tanh,
optimizer=None,
tr_optimizer=None,
use_trust_region=True,
step_size=0.01,
... | :param input_shape: Shape of the input data.
:param output_dim: Dimension of output.
:param hidden_sizes: Number of hidden units of each layer of the mean network.
:param hidden_nonlinearity: Non-linearity used for each layer of the mean network.
:param optimizer: Optimizer for minimizin... | :param input_shape: Shape of the input data.
:param output_dim: Dimension of output.
:param hidden_sizes: Number of hidden units of each layer of the mean network.
:param hidden_nonlinearity: Non-linearity used for each layer of the mean network.
:param optimizer: Optimizer for minimizin... | [
":",
"param",
"input_shape",
":",
"Shape",
"of",
"the",
"input",
"data",
".",
":",
"param",
"output_dim",
":",
"Dimension",
"of",
"output",
".",
":",
"param",
"hidden_sizes",
":",
"Number",
"of",
"hidden",
"units",
"of",
"each",
"layer",
"of",
"the",
"me... | def __init__(
self,
name,
input_shape,
output_dim,
prob_network=None,
hidden_sizes=(32, 32),
hidden_nonlinearity=tf.nn.tanh,
optimizer=None,
tr_optimizer=None,
use_trust_region=True,
step_... | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"input_shape",
",",
"output_dim",
",",
"prob_network",
"=",
"None",
",",
"hidden_sizes",
"=",
"(",
"32",
",",
"32",
")",
",",
"hidden_nonlinearity",
"=",
"tf",
".",
"nn",
".",
"tanh",
",",
"optimizer",
... | https://github.com/shaneshixiang/rllabplusplus/blob/4d55f96ec98e3fe025b7991945e3e6a54fd5449f/sandbox/rocky/tf/regressors/categorical_mlp_regressor.py#L28-L125 | ||
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/pandas/core/strings.py | python | str_translate | (arr, table, deletechars=None) | return _na_map(f, arr) | Map all characters in the string through the given mapping table.
Equivalent to standard :meth:`str.translate`. Note that the optional
argument deletechars is only valid if you are using python 2. For python 3,
character deletion should be specified via the table argument.
Parameters
----------
... | Map all characters in the string through the given mapping table.
Equivalent to standard :meth:`str.translate`. Note that the optional
argument deletechars is only valid if you are using python 2. For python 3,
character deletion should be specified via the table argument. | [
"Map",
"all",
"characters",
"in",
"the",
"string",
"through",
"the",
"given",
"mapping",
"table",
".",
"Equivalent",
"to",
"standard",
":",
"meth",
":",
"str",
".",
"translate",
".",
"Note",
"that",
"the",
"optional",
"argument",
"deletechars",
"is",
"only",... | def str_translate(arr, table, deletechars=None):
"""
Map all characters in the string through the given mapping table.
Equivalent to standard :meth:`str.translate`. Note that the optional
argument deletechars is only valid if you are using python 2. For python 3,
character deletion should be specifi... | [
"def",
"str_translate",
"(",
"arr",
",",
"table",
",",
"deletechars",
"=",
"None",
")",
":",
"if",
"deletechars",
"is",
"None",
":",
"f",
"=",
"lambda",
"x",
":",
"x",
".",
"translate",
"(",
"table",
")",
"else",
":",
"if",
"compat",
".",
"PY3",
":... | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/pandas/core/strings.py#L1592-L1627 | |
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-windows/x86/PIL/PsdImagePlugin.py | python | PsdImageFile._close__fp | (self) | [] | def _close__fp(self):
try:
if self.__fp != self.fp:
self.__fp.close()
except AttributeError:
pass
finally:
self.__fp = None | [
"def",
"_close__fp",
"(",
"self",
")",
":",
"try",
":",
"if",
"self",
".",
"__fp",
"!=",
"self",
".",
"fp",
":",
"self",
".",
"__fp",
".",
"close",
"(",
")",
"except",
"AttributeError",
":",
"pass",
"finally",
":",
"self",
".",
"__fp",
"=",
"None"
... | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-windows/x86/PIL/PsdImagePlugin.py#L168-L175 | ||||
pyload/pyload | 4410827ca7711f1a3cf91a0b11e967b81bbbcaa2 | src/pyload/plugins/addons/UpdateManager.py | python | UpdateManager.update | (self) | Check for updates. | Check for updates. | [
"Check",
"for",
"updates",
"."
] | def update(self):
"""
Check for updates.
"""
if self._update() != 2 or not self.config.get("autorestart"):
return
if not self.pyload.api.status_downloads():
self.pyload.api.restart()
else:
self.log_warning(
self._("pyLo... | [
"def",
"update",
"(",
"self",
")",
":",
"if",
"self",
".",
"_update",
"(",
")",
"!=",
"2",
"or",
"not",
"self",
".",
"config",
".",
"get",
"(",
"\"autorestart\"",
")",
":",
"return",
"if",
"not",
"self",
".",
"pyload",
".",
"api",
".",
"status_down... | https://github.com/pyload/pyload/blob/4410827ca7711f1a3cf91a0b11e967b81bbbcaa2/src/pyload/plugins/addons/UpdateManager.py#L163-L180 | ||
spotify/luigi | c3b66f4a5fa7eaa52f9a72eb6704b1049035c789 | luigi/contrib/salesforce.py | python | SalesforceAPI.get_batch_results | (self, job_id, batch_id) | return self.get_batch_result_ids(job_id, batch_id)[0] | DEPRECATED: Use `get_batch_result_ids` | DEPRECATED: Use `get_batch_result_ids` | [
"DEPRECATED",
":",
"Use",
"get_batch_result_ids"
] | def get_batch_results(self, job_id, batch_id):
"""
DEPRECATED: Use `get_batch_result_ids`
"""
warnings.warn("get_batch_results is deprecated and only returns one batch result. Please use get_batch_result_ids")
return self.get_batch_result_ids(job_id, batch_id)[0] | [
"def",
"get_batch_results",
"(",
"self",
",",
"job_id",
",",
"batch_id",
")",
":",
"warnings",
".",
"warn",
"(",
"\"get_batch_results is deprecated and only returns one batch result. Please use get_batch_result_ids\"",
")",
"return",
"self",
".",
"get_batch_result_ids",
"(",
... | https://github.com/spotify/luigi/blob/c3b66f4a5fa7eaa52f9a72eb6704b1049035c789/luigi/contrib/salesforce.py#L509-L514 | |
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/venv/lib/python3.7/site-packages/pip/_vendor/cachecontrol/heuristics.py | python | BaseHeuristic.update_headers | (self, response) | return {} | Update the response headers with any new headers.
NOTE: This SHOULD always include some Warning header to
signify that the response was cached by the client, not
by way of the provided headers. | Update the response headers with any new headers. | [
"Update",
"the",
"response",
"headers",
"with",
"any",
"new",
"headers",
"."
] | def update_headers(self, response):
"""Update the response headers with any new headers.
NOTE: This SHOULD always include some Warning header to
signify that the response was cached by the client, not
by way of the provided headers.
"""
return {} | [
"def",
"update_headers",
"(",
"self",
",",
"response",
")",
":",
"return",
"{",
"}"
] | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/venv/lib/python3.7/site-packages/pip/_vendor/cachecontrol/heuristics.py#L33-L40 | |
tmadl/semisup-learn | 483698be0453f08e550a4c705fc7ad522708708c | methods/qns3vm.py | python | QN_S3VM_Dense.getPredictions | (self, X, real_valued=False) | Computes the predicted labels for a given set of patterns
Keyword arguments:
X -- The set of patterns
real_valued -- If True, then the real prediction values are returned
Returns:
The predictions for the list X of patterns. | Computes the predicted labels for a given set of patterns | [
"Computes",
"the",
"predicted",
"labels",
"for",
"a",
"given",
"set",
"of",
"patterns"
] | def getPredictions(self, X, real_valued=False):
"""
Computes the predicted labels for a given set of patterns
Keyword arguments:
X -- The set of patterns
real_valued -- If True, then the real prediction values are returned
Returns:
The predictions for the list X... | [
"def",
"getPredictions",
"(",
"self",
",",
"X",
",",
"real_valued",
"=",
"False",
")",
":",
"KNR",
"=",
"self",
".",
"__kernel",
".",
"computeKernelMatrix",
"(",
"X",
",",
"self",
".",
"__Xreg",
")",
"KNU_bar",
"=",
"self",
".",
"__kernel",
".",
"compu... | https://github.com/tmadl/semisup-learn/blob/483698be0453f08e550a4c705fc7ad522708708c/methods/qns3vm.py#L252-L271 | ||
machine-perception-robotics-group/attention_branch_network | ced1d97303792ac6d56442571d71bb0572b3efd8 | models/cifar/resnext.py | python | resnext | (**kwargs) | return model | Constructs a ResNeXt. | Constructs a ResNeXt. | [
"Constructs",
"a",
"ResNeXt",
"."
] | def resnext(**kwargs):
"""Constructs a ResNeXt.
"""
model = CifarResNeXt(**kwargs)
return model | [
"def",
"resnext",
"(",
"*",
"*",
"kwargs",
")",
":",
"model",
"=",
"CifarResNeXt",
"(",
"*",
"*",
"kwargs",
")",
"return",
"model"
] | https://github.com/machine-perception-robotics-group/attention_branch_network/blob/ced1d97303792ac6d56442571d71bb0572b3efd8/models/cifar/resnext.py#L152-L156 | |
Pyomo/pyomo | dbd4faee151084f343b893cc2b0c04cf2b76fd92 | pyomo/contrib/pynumero/interfaces/nlp.py | python | ExtendedNLP.n_ineq_constraints | (self) | Returns number of inequality constraints | Returns number of inequality constraints | [
"Returns",
"number",
"of",
"inequality",
"constraints"
] | def n_ineq_constraints(self):
"""
Returns number of inequality constraints
"""
pass | [
"def",
"n_ineq_constraints",
"(",
"self",
")",
":",
"pass"
] | https://github.com/Pyomo/pyomo/blob/dbd4faee151084f343b893cc2b0c04cf2b76fd92/pyomo/contrib/pynumero/interfaces/nlp.py#L384-L388 | ||
linuxerwang/rkflashkit | c6b422afa372bf1d498fcddb6a6b95360021d2a6 | src/rkflashkit/main.py | python | MainWindow.__reboot_device | (self, widget) | [] | def __reboot_device(self, widget):
# Reboot device
device_info, = self.__device_liststore.get(
self.__device_selector.get_active_iter(), 1)
if confirm(self, MESSAGE_REBOOT):
op = None
try:
op = rktalk.RkOperation(self.__logger, device_info[0], device_info[1])
op.reboot()
... | [
"def",
"__reboot_device",
"(",
"self",
",",
"widget",
")",
":",
"# Reboot device",
"device_info",
",",
"=",
"self",
".",
"__device_liststore",
".",
"get",
"(",
"self",
".",
"__device_selector",
".",
"get_active_iter",
"(",
")",
",",
"1",
")",
"if",
"confirm"... | https://github.com/linuxerwang/rkflashkit/blob/c6b422afa372bf1d498fcddb6a6b95360021d2a6/src/rkflashkit/main.py#L357-L367 | ||||
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/matplotlib/patches.py | python | Arc.__init__ | (self, xy, width, height, angle=0.0,
theta1=0.0, theta2=360.0, **kwargs) | The following args are supported:
*xy*
center of ellipse
*width*
length of horizontal axis
*height*
length of vertical axis
*angle*
rotation in degrees (anti-clockwise)
*theta1*
starting angle of the arc in degrees
*... | The following args are supported: | [
"The",
"following",
"args",
"are",
"supported",
":"
] | def __init__(self, xy, width, height, angle=0.0,
theta1=0.0, theta2=360.0, **kwargs):
"""
The following args are supported:
*xy*
center of ellipse
*width*
length of horizontal axis
*height*
length of vertical axis
*angle*... | [
"def",
"__init__",
"(",
"self",
",",
"xy",
",",
"width",
",",
"height",
",",
"angle",
"=",
"0.0",
",",
"theta1",
"=",
"0.0",
",",
"theta2",
"=",
"360.0",
",",
"*",
"*",
"kwargs",
")",
":",
"fill",
"=",
"kwargs",
".",
"setdefault",
"(",
"'fill'",
... | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/matplotlib/patches.py#L1321-L1360 | ||
RasaHQ/rasa | 54823b68c1297849ba7ae841a4246193cd1223a1 | rasa/shared/nlu/training_data/training_data.py | python | TrainingData.persist | (
self, dir_name: Text, filename: Text = DEFAULT_TRAINING_DATA_OUTPUT_PATH
) | return {"training_data": relpath(nlu_data_file, dir_name)} | Persists this training data to disk and returns necessary
information to load it again. | Persists this training data to disk and returns necessary
information to load it again. | [
"Persists",
"this",
"training",
"data",
"to",
"disk",
"and",
"returns",
"necessary",
"information",
"to",
"load",
"it",
"again",
"."
] | def persist(
self, dir_name: Text, filename: Text = DEFAULT_TRAINING_DATA_OUTPUT_PATH
) -> Dict[Text, Any]:
"""Persists this training data to disk and returns necessary
information to load it again."""
if not os.path.exists(dir_name):
os.makedirs(dir_name)
nlu_d... | [
"def",
"persist",
"(",
"self",
",",
"dir_name",
":",
"Text",
",",
"filename",
":",
"Text",
"=",
"DEFAULT_TRAINING_DATA_OUTPUT_PATH",
")",
"->",
"Dict",
"[",
"Text",
",",
"Any",
"]",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"dir_name",
"... | https://github.com/RasaHQ/rasa/blob/54823b68c1297849ba7ae841a4246193cd1223a1/rasa/shared/nlu/training_data/training_data.py#L431-L444 | |
PaddlePaddle/PGL | e48545f2814523c777b8a9a9188bf5a7f00d6e52 | docs/markdown2rst.py | python | RestRenderer.footnotes | (self, text) | Wrapper for all footnotes.
:param text: contents of all footnotes. | Wrapper for all footnotes. | [
"Wrapper",
"for",
"all",
"footnotes",
"."
] | def footnotes(self, text):
"""Wrapper for all footnotes.
:param text: contents of all footnotes.
"""
if text:
return '\n\n' + text
else:
return '' | [
"def",
"footnotes",
"(",
"self",
",",
"text",
")",
":",
"if",
"text",
":",
"return",
"'\\n\\n'",
"+",
"text",
"else",
":",
"return",
"''"
] | https://github.com/PaddlePaddle/PGL/blob/e48545f2814523c777b8a9a9188bf5a7f00d6e52/docs/markdown2rst.py#L483-L491 | ||
stevearc/pypicloud | 046126f0b2a692b7bd382ae5cd3bf7af2f58103c | pypicloud/access/base.py | python | get_pwd_context | (
preferred_hash: Optional[str] = None, rounds: Optional[int] = None
) | return LazyCryptContext(schemes=schemes, default=schemes[0], **default_rounds) | Create a passlib context for hashing passwords | Create a passlib context for hashing passwords | [
"Create",
"a",
"passlib",
"context",
"for",
"hashing",
"passwords"
] | def get_pwd_context(
preferred_hash: Optional[str] = None, rounds: Optional[int] = None
) -> LazyCryptContext:
"""Create a passlib context for hashing passwords"""
if preferred_hash is None or preferred_hash == "sha":
preferred_hash = "sha256_crypt" if sys_bits < 64 else "sha512_crypt"
if prefer... | [
"def",
"get_pwd_context",
"(",
"preferred_hash",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
"rounds",
":",
"Optional",
"[",
"int",
"]",
"=",
"None",
")",
"->",
"LazyCryptContext",
":",
"if",
"preferred_hash",
"is",
"None",
"or",
"preferred_hash",
... | https://github.com/stevearc/pypicloud/blob/046126f0b2a692b7bd382ae5cd3bf7af2f58103c/pypicloud/access/base.py#L40-L64 | |
CGCookie/retopoflow | 3d8b3a47d1d661f99ab0aeb21d31370bf15de35e | addon_common/common/ui_styling.py | python | _print_trie | (self, full_trie=True) | [] | def _print_trie(self, full_trie=True):
def p(node_cur, depth):
for | [
"def",
"_print_trie",
"(",
"self",
",",
"full_trie",
"=",
"True",
")",
":",
"def",
"p",
"(",
"node_cur",
",",
"depth",
")",
":",
"for"
] | https://github.com/CGCookie/retopoflow/blob/3d8b3a47d1d661f99ab0aeb21d31370bf15de35e/addon_common/common/ui_styling.py#L671-L673 | ||||
SymbiFlow/prjxray | 5349556bc2c230801d6df0cf11bccb9cfd171639 | prjxray/lms_solver.py | python | dump_solution_to_csv | (fp, all_tags, all_bits, X) | Dumps solution data to CSV.
Parameters
----------
fp:
An open file or stream
all_tags:
List of considered tags.
all_bits:
List of considered bits.
X:
Matrix with raw solution (floats). | Dumps solution data to CSV. | [
"Dumps",
"solution",
"data",
"to",
"CSV",
"."
] | def dump_solution_to_csv(fp, all_tags, all_bits, X):
"""
Dumps solution data to CSV.
Parameters
----------
fp:
An open file or stream
all_tags:
List of considered tags.
all_bits:
List of considered bits.
X:
Matrix with raw solution (floats).
"""
... | [
"def",
"dump_solution_to_csv",
"(",
"fp",
",",
"all_tags",
",",
"all_bits",
",",
"X",
")",
":",
"# Bits",
"line",
"=",
"\",\"",
"for",
"bit",
"in",
"all_bits",
":",
"line",
"+=",
"bit",
"+",
"\",\"",
"fp",
".",
"write",
"(",
"line",
"[",
":",
"-",
... | https://github.com/SymbiFlow/prjxray/blob/5349556bc2c230801d6df0cf11bccb9cfd171639/prjxray/lms_solver.py#L268-L296 | ||
RasaHQ/rasa | 54823b68c1297849ba7ae841a4246193cd1223a1 | rasa/core/actions/action.py | python | Action.__str__ | (self) | return f"{self.__class__.__name__}('{self.name()}')" | Returns text representation of form. | Returns text representation of form. | [
"Returns",
"text",
"representation",
"of",
"form",
"."
] | def __str__(self) -> Text:
"""Returns text representation of form."""
return f"{self.__class__.__name__}('{self.name()}')" | [
"def",
"__str__",
"(",
"self",
")",
"->",
"Text",
":",
"return",
"f\"{self.__class__.__name__}('{self.name()}')\""
] | https://github.com/RasaHQ/rasa/blob/54823b68c1297849ba7ae841a4246193cd1223a1/rasa/core/actions/action.py#L250-L252 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/matplotlib-3.0.3-py3.7-macosx-10.9-x86_64.egg/mpl_toolkits/axisartist/axis_artist.py | python | TickLabels.set_axis_direction | (self, label_direction) | Adjust the text angle and text alignment of ticklabels
according to the matplotlib convention.
The *label_direction* must be one of [left, right, bottom,
top].
===================== ========== ========= ========== ==========
property left bottom righ... | Adjust the text angle and text alignment of ticklabels
according to the matplotlib convention. | [
"Adjust",
"the",
"text",
"angle",
"and",
"text",
"alignment",
"of",
"ticklabels",
"according",
"to",
"the",
"matplotlib",
"convention",
"."
] | def set_axis_direction(self, label_direction):
"""
Adjust the text angle and text alignment of ticklabels
according to the matplotlib convention.
The *label_direction* must be one of [left, right, bottom,
top].
===================== ========== ========= ========== ==... | [
"def",
"set_axis_direction",
"(",
"self",
",",
"label_direction",
")",
":",
"if",
"label_direction",
"not",
"in",
"[",
"\"left\"",
",",
"\"right\"",
",",
"\"top\"",
",",
"\"bottom\"",
"]",
":",
"raise",
"ValueError",
"(",
"'direction must be one of \"left\", \"right... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/matplotlib-3.0.3-py3.7-macosx-10.9-x86_64.egg/mpl_toolkits/axisartist/axis_artist.py#L580-L608 | ||
ganeti/ganeti | d340a9ddd12f501bef57da421b5f9b969a4ba905 | qa/qa_rapi.py | python | TestTags | (kind, name, tags) | Tests .../tags resources. | Tests .../tags resources. | [
"Tests",
"...",
"/",
"tags",
"resources",
"."
] | def TestTags(kind, name, tags):
"""Tests .../tags resources.
"""
if kind == constants.TAG_CLUSTER:
uri = "/2/tags"
elif kind == constants.TAG_NODE:
uri = "/2/nodes/%s/tags" % name
elif kind == constants.TAG_INSTANCE:
uri = "/2/instances/%s/tags" % name
elif kind == constants.TAG_NODEGROUP:
... | [
"def",
"TestTags",
"(",
"kind",
",",
"name",
",",
"tags",
")",
":",
"if",
"kind",
"==",
"constants",
".",
"TAG_CLUSTER",
":",
"uri",
"=",
"\"/2/tags\"",
"elif",
"kind",
"==",
"constants",
".",
"TAG_NODE",
":",
"uri",
"=",
"\"/2/nodes/%s/tags\"",
"%",
"na... | https://github.com/ganeti/ganeti/blob/d340a9ddd12f501bef57da421b5f9b969a4ba905/qa/qa_rapi.py#L753-L790 | ||
albermax/innvestigate | db8a58e6a6d54d1a25618fe653954166782e891c | src/innvestigate/utils/keras/graph.py | python | pre_softmax_tensors | (Xs: Tensor, should_find_softmax: bool = True) | return ret | Finds the tensors that were preceeding a potential softmax. | Finds the tensors that were preceeding a potential softmax. | [
"Finds",
"the",
"tensors",
"that",
"were",
"preceeding",
"a",
"potential",
"softmax",
"."
] | def pre_softmax_tensors(Xs: Tensor, should_find_softmax: bool = True) -> List[Tensor]:
"""Finds the tensors that were preceeding a potential softmax."""
softmax_found = False
Xs = iutils.to_list(Xs)
ret = []
for x in Xs:
layer, node_index, _tensor_index = x._keras_history
if kchecks... | [
"def",
"pre_softmax_tensors",
"(",
"Xs",
":",
"Tensor",
",",
"should_find_softmax",
":",
"bool",
"=",
"True",
")",
"->",
"List",
"[",
"Tensor",
"]",
":",
"softmax_found",
"=",
"False",
"Xs",
"=",
"iutils",
".",
"to_list",
"(",
"Xs",
")",
"ret",
"=",
"[... | https://github.com/albermax/innvestigate/blob/db8a58e6a6d54d1a25618fe653954166782e891c/src/innvestigate/utils/keras/graph.py#L356-L375 | |
geekan/scrapy-examples | edb1cb116bd6def65a6ef01f953b58eb43e54305 | tutorial/tutorial/pipelines.py | python | JsonWithEncodingPipeline.process_item | (self, item, spider) | return item | [] | def process_item(self, item, spider):
line = json.dumps(dict(item), ensure_ascii=False) + "\n"
self.file.write(line)
return item | [
"def",
"process_item",
"(",
"self",
",",
"item",
",",
"spider",
")",
":",
"line",
"=",
"json",
".",
"dumps",
"(",
"dict",
"(",
"item",
")",
",",
"ensure_ascii",
"=",
"False",
")",
"+",
"\"\\n\"",
"self",
".",
"file",
".",
"write",
"(",
"line",
")",... | https://github.com/geekan/scrapy-examples/blob/edb1cb116bd6def65a6ef01f953b58eb43e54305/tutorial/tutorial/pipelines.py#L53-L56 | |||
LGE-ARC-AdvancedAI/auptimizer | 50f6e3b4e0cb9146ca90fd74b9b24ca97ae22617 | src/aup/convert.py | python | add_main | (script) | return script + """\nif __name__ == "__main__":
import sys
from aup import BasicConfig, print_result
if len(sys.argv) != 2:
print("config file required")
exit(1)
config = BasicConfig().load(sys.argv[1])
aup_wrapper(config)\n""" | Adds a main function to the executable Python file. | Adds a main function to the executable Python file. | [
"Adds",
"a",
"main",
"function",
"to",
"the",
"executable",
"Python",
"file",
"."
] | def add_main(script):
"""
Adds a main function to the executable Python file.
"""
if "__main__" in script:
logging.critical("__main__ is already defined in the script. Make sure no duplicated __main__ blocks in output.")
return script + """\nif __name__ == "__main__":
import sys
fro... | [
"def",
"add_main",
"(",
"script",
")",
":",
"if",
"\"__main__\"",
"in",
"script",
":",
"logging",
".",
"critical",
"(",
"\"__main__ is already defined in the script. Make sure no duplicated __main__ blocks in output.\"",
")",
"return",
"script",
"+",
"\"\"\"\\nif __name__ ==... | https://github.com/LGE-ARC-AdvancedAI/auptimizer/blob/50f6e3b4e0cb9146ca90fd74b9b24ca97ae22617/src/aup/convert.py#L86-L99 | |
auth0/auth0-python | 511b016ac9853c7f4ee66769be7ad315c5585735 | auth0/v3/management/clients.py | python | Clients.rotate_secret | (self, id) | return self.client.post(url, data=data) | Rotate a client secret. The generated secret is NOT base64 encoded.
Args:
id (str): Client ID of the application.
See: https://auth0.com/docs/api/management/v2#!/Clients/post_rotate_secret | Rotate a client secret. The generated secret is NOT base64 encoded. | [
"Rotate",
"a",
"client",
"secret",
".",
"The",
"generated",
"secret",
"is",
"NOT",
"base64",
"encoded",
"."
] | def rotate_secret(self, id):
"""Rotate a client secret. The generated secret is NOT base64 encoded.
Args:
id (str): Client ID of the application.
See: https://auth0.com/docs/api/management/v2#!/Clients/post_rotate_secret
"""
data = {'id': id}
url = self._ur... | [
"def",
"rotate_secret",
"(",
"self",
",",
"id",
")",
":",
"data",
"=",
"{",
"'id'",
":",
"id",
"}",
"url",
"=",
"self",
".",
"_url",
"(",
"'%s/rotate-secret'",
"%",
"id",
")",
"return",
"self",
".",
"client",
".",
"post",
"(",
"url",
",",
"data",
... | https://github.com/auth0/auth0-python/blob/511b016ac9853c7f4ee66769be7ad315c5585735/auth0/v3/management/clients.py#L133-L145 | |
hhyo/Archery | c9b057d37e47894ca8531e5cd10afdb064cd0122 | sql/engines/inception.py | python | InceptionEngine.get_variables | (self, variables=None) | return self.query(sql=sql) | 获取实例参数 | 获取实例参数 | [
"获取实例参数"
] | def get_variables(self, variables=None):
"""获取实例参数"""
if variables:
sql = f"inception get variables '{variables[0]}';"
else:
sql = "inception get variables;"
return self.query(sql=sql) | [
"def",
"get_variables",
"(",
"self",
",",
"variables",
"=",
"None",
")",
":",
"if",
"variables",
":",
"sql",
"=",
"f\"inception get variables '{variables[0]}';\"",
"else",
":",
"sql",
"=",
"\"inception get variables;\"",
"return",
"self",
".",
"query",
"(",
"sql",... | https://github.com/hhyo/Archery/blob/c9b057d37e47894ca8531e5cd10afdb064cd0122/sql/engines/inception.py#L233-L239 | |
IJDykeman/wangTiles | 7c1ee2095ebdf7f72bce07d94c6484915d5cae8b | experimental_code/tiles_3d/venv_mac_py3/lib/python2.7/site-packages/setuptools/_vendor/pyparsing.py | python | ParserElement.runTests | (self, tests, parseAll=True, comment='#', fullDump=True, printResults=True, failureTests=False) | return success, allResults | Execute the parse expression on a series of test strings, showing each
test, the parsed results or where the parse failed. Quick and easy way to
run a parse expression against a list of sample strings.
Parameters:
- tests - a list of separate test strings, or a multiline str... | Execute the parse expression on a series of test strings, showing each
test, the parsed results or where the parse failed. Quick and easy way to
run a parse expression against a list of sample strings.
Parameters:
- tests - a list of separate test strings, or a multiline str... | [
"Execute",
"the",
"parse",
"expression",
"on",
"a",
"series",
"of",
"test",
"strings",
"showing",
"each",
"test",
"the",
"parsed",
"results",
"or",
"where",
"the",
"parse",
"failed",
".",
"Quick",
"and",
"easy",
"way",
"to",
"run",
"a",
"parse",
"expressio... | def runTests(self, tests, parseAll=True, comment='#', fullDump=True, printResults=True, failureTests=False):
"""
Execute the parse expression on a series of test strings, showing each
test, the parsed results or where the parse failed. Quick and easy way to
run a parse expression against... | [
"def",
"runTests",
"(",
"self",
",",
"tests",
",",
"parseAll",
"=",
"True",
",",
"comment",
"=",
"'#'",
",",
"fullDump",
"=",
"True",
",",
"printResults",
"=",
"True",
",",
"failureTests",
"=",
"False",
")",
":",
"if",
"isinstance",
"(",
"tests",
",",
... | https://github.com/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/tiles_3d/venv_mac_py3/lib/python2.7/site-packages/setuptools/_vendor/pyparsing.py#L2232-L2361 | |
tensorflow/models | 6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3 | research/object_detection/utils/visualization_utils.py | python | draw_side_by_side_evaluation_image | (eval_dict,
category_index,
max_boxes_to_draw=20,
min_score_thresh=0.2,
use_normalized_coordinates=True,
keypoint_edges=None) | return images_with_detections_list | Creates a side-by-side image with detections and groundtruth.
Bounding boxes (and instance masks, if available) are visualized on both
subimages.
Args:
eval_dict: The evaluation dictionary returned by
eval_util.result_dict_for_batched_example() or
eval_util.result_dict_for_single_example().
... | Creates a side-by-side image with detections and groundtruth. | [
"Creates",
"a",
"side",
"-",
"by",
"-",
"side",
"image",
"with",
"detections",
"and",
"groundtruth",
"."
] | def draw_side_by_side_evaluation_image(eval_dict,
category_index,
max_boxes_to_draw=20,
min_score_thresh=0.2,
use_normalized_coordinates=True,
... | [
"def",
"draw_side_by_side_evaluation_image",
"(",
"eval_dict",
",",
"category_index",
",",
"max_boxes_to_draw",
"=",
"20",
",",
"min_score_thresh",
"=",
"0.2",
",",
"use_normalized_coordinates",
"=",
"True",
",",
"keypoint_edges",
"=",
"None",
")",
":",
"detection_fie... | https://github.com/tensorflow/models/blob/6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3/research/object_detection/utils/visualization_utils.py#L625-L807 | |
ryanlayer/samplot | 34a3f37eb7042b30e074df4fb3937708b1164460 | samplot/samplot.py | python | get_long_read_max_gap | (read_name, long_reads) | return max_gap | Finds the largest gap between alignments in LongRead alignments,
plus lengths of the alignments
Returns the integer max gap | Finds the largest gap between alignments in LongRead alignments,
plus lengths of the alignments | [
"Finds",
"the",
"largest",
"gap",
"between",
"alignments",
"in",
"LongRead",
"alignments",
"plus",
"lengths",
"of",
"the",
"alignments"
] | def get_long_read_max_gap(read_name, long_reads):
"""Finds the largest gap between alignments in LongRead alignments,
plus lengths of the alignments
Returns the integer max gap
"""
alignments = []
for long_read in long_reads[read_name]:
for alignment in long_read.alignments:
... | [
"def",
"get_long_read_max_gap",
"(",
"read_name",
",",
"long_reads",
")",
":",
"alignments",
"=",
"[",
"]",
"for",
"long_read",
"in",
"long_reads",
"[",
"read_name",
"]",
":",
"for",
"alignment",
"in",
"long_read",
".",
"alignments",
":",
"alignments",
".",
... | https://github.com/ryanlayer/samplot/blob/34a3f37eb7042b30e074df4fb3937708b1164460/samplot/samplot.py#L1669-L1686 | |
pysmt/pysmt | ade4dc2a825727615033a96d31c71e9f53ce4764 | pysmt/oracles.py | python | AtomsOracle.walk_ite | (self, formula, args, **kwargs) | [] | def walk_ite(self, formula, args, **kwargs):
#pylint: disable=unused-argument
if any(a is None for a in args):
# Theory ITE
return None
else:
return frozenset(x for a in args for x in a) | [
"def",
"walk_ite",
"(",
"self",
",",
"formula",
",",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"#pylint: disable=unused-argument",
"if",
"any",
"(",
"a",
"is",
"None",
"for",
"a",
"in",
"args",
")",
":",
"# Theory ITE",
"return",
"None",
"else",
":",
... | https://github.com/pysmt/pysmt/blob/ade4dc2a825727615033a96d31c71e9f53ce4764/pysmt/oracles.py#L439-L445 | ||||
PokemonGoF/PokemonGo-Bot | 5e80f20760f32478a84a8f0ced7ca24cdf41fe03 | pokemongo_bot/walkers/polyline_generator.py | python | PolylineObjectHandler.cached_polyline | (origin, destination, google_map_api_key=None) | return PolylineObjectHandler._cache | Google API has limits, so we can't generate new Polyline at every tick... | Google API has limits, so we can't generate new Polyline at every tick... | [
"Google",
"API",
"has",
"limits",
"so",
"we",
"can",
"t",
"generate",
"new",
"Polyline",
"at",
"every",
"tick",
"..."
] | def cached_polyline(origin, destination, google_map_api_key=None):
'''
Google API has limits, so we can't generate new Polyline at every tick...
'''
# Absolute offset between bot origin and PolyLine get_last_pos() (in meters)
if PolylineObjectHandler._cache and PolylineObjectHan... | [
"def",
"cached_polyline",
"(",
"origin",
",",
"destination",
",",
"google_map_api_key",
"=",
"None",
")",
":",
"# Absolute offset between bot origin and PolyLine get_last_pos() (in meters)",
"if",
"PolylineObjectHandler",
".",
"_cache",
"and",
"PolylineObjectHandler",
".",
"_... | https://github.com/PokemonGoF/PokemonGo-Bot/blob/5e80f20760f32478a84a8f0ced7ca24cdf41fe03/pokemongo_bot/walkers/polyline_generator.py#L25-L58 | |
openai/mujoco-py | f1312cceeeebbba17e78d5d77fbffa091eed9a3a | mujoco_py/mjrenderpool.py | python | MjRenderPool._worker_render | (worker_id, state, width, height,
camera_name, randomize) | Main target function for the workers. | Main target function for the workers. | [
"Main",
"target",
"function",
"for",
"the",
"workers",
"."
] | def _worker_render(worker_id, state, width, height,
camera_name, randomize):
"""
Main target function for the workers.
"""
s = _render_pool_storage
forward = False
if state is not None:
s.sim.set_state(state)
forward = True
... | [
"def",
"_worker_render",
"(",
"worker_id",
",",
"state",
",",
"width",
",",
"height",
",",
"camera_name",
",",
"randomize",
")",
":",
"s",
"=",
"_render_pool_storage",
"forward",
"=",
"False",
"if",
"state",
"is",
"not",
"None",
":",
"s",
".",
"sim",
"."... | https://github.com/openai/mujoco-py/blob/f1312cceeeebbba17e78d5d77fbffa091eed9a3a/mujoco_py/mjrenderpool.py#L140-L169 | ||
SFDO-Tooling/CumulusCI | 825ae1f122b25dc41761c52a4ddfa1938d2a4b6e | cumulusci/tasks/datadictionary.py | python | GenerateDataDictionary._write_field_results | (self, file_handle) | Write to the given handle an output CSV containing the data dictionary for fields. | Write to the given handle an output CSV containing the data dictionary for fields. | [
"Write",
"to",
"the",
"given",
"handle",
"an",
"output",
"CSV",
"containing",
"the",
"data",
"dictionary",
"for",
"fields",
"."
] | def _write_field_results(self, file_handle):
"""Write to the given handle an output CSV containing the data dictionary for fields."""
writer = csv.writer(file_handle)
writer.writerow(
[
"Object Label",
"Object API Name",
"Field Label",... | [
"def",
"_write_field_results",
"(",
"self",
",",
"file_handle",
")",
":",
"writer",
"=",
"csv",
".",
"writer",
"(",
"file_handle",
")",
"writer",
".",
"writerow",
"(",
"[",
"\"Object Label\"",
",",
"\"Object API Name\"",
",",
"\"Field Label\"",
",",
"\"Field API... | https://github.com/SFDO-Tooling/CumulusCI/blob/825ae1f122b25dc41761c52a4ddfa1938d2a4b6e/cumulusci/tasks/datadictionary.py#L646-L735 | ||
edfungus/Crouton | ada98b3930192938a48909072b45cb84b945f875 | clients/python_clients/cf_demo_client/cf_env/lib/python2.7/site-packages/pip/utils/logging.py | python | IndentingFormatter.format | (self, record) | return formatted | Calls the standard formatter, but will indent all of the log messages
by our current indentation level. | Calls the standard formatter, but will indent all of the log messages
by our current indentation level. | [
"Calls",
"the",
"standard",
"formatter",
"but",
"will",
"indent",
"all",
"of",
"the",
"log",
"messages",
"by",
"our",
"current",
"indentation",
"level",
"."
] | def format(self, record):
"""
Calls the standard formatter, but will indent all of the log messages
by our current indentation level.
"""
formatted = logging.Formatter.format(self, record)
formatted = "".join([
(" " * get_indentation()) + line
for ... | [
"def",
"format",
"(",
"self",
",",
"record",
")",
":",
"formatted",
"=",
"logging",
".",
"Formatter",
".",
"format",
"(",
"self",
",",
"record",
")",
"formatted",
"=",
"\"\"",
".",
"join",
"(",
"[",
"(",
"\" \"",
"*",
"get_indentation",
"(",
")",
")"... | https://github.com/edfungus/Crouton/blob/ada98b3930192938a48909072b45cb84b945f875/clients/python_clients/cf_demo_client/cf_env/lib/python2.7/site-packages/pip/utils/logging.py#L47-L57 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/pip/_vendor/urllib3/util/ssl_.py | python | create_urllib3_context | (ssl_version=None, cert_reqs=None,
options=None, ciphers=None) | return context | All arguments have the same meaning as ``ssl_wrap_socket``.
By default, this function does a lot of the same work that
``ssl.create_default_context`` does on Python 3.4+. It:
- Disables SSLv2, SSLv3, and compression
- Sets a restricted set of server ciphers
If you wish to enable SSLv3, you can do... | All arguments have the same meaning as ``ssl_wrap_socket``. | [
"All",
"arguments",
"have",
"the",
"same",
"meaning",
"as",
"ssl_wrap_socket",
"."
] | def create_urllib3_context(ssl_version=None, cert_reqs=None,
options=None, ciphers=None):
"""All arguments have the same meaning as ``ssl_wrap_socket``.
By default, this function does a lot of the same work that
``ssl.create_default_context`` does on Python 3.4+. It:
- Disab... | [
"def",
"create_urllib3_context",
"(",
"ssl_version",
"=",
"None",
",",
"cert_reqs",
"=",
"None",
",",
"options",
"=",
"None",
",",
"ciphers",
"=",
"None",
")",
":",
"context",
"=",
"SSLContext",
"(",
"ssl_version",
"or",
"ssl",
".",
"PROTOCOL_SSLv23",
")",
... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/pip/_vendor/urllib3/util/ssl_.py#L229-L288 | |
rwightman/pytorch-image-models | ccfeb06936549f19c453b7f1f27e8e632cfbe1c2 | timm/models/vision_transformer.py | python | vit_small_patch32_224_in21k | (pretrained=False, **kwargs) | return model | ViT-Small (ViT-S/16)
ImageNet-21k weights @ 224x224, source https://github.com/google-research/vision_transformer.
NOTE: this model has valid 21k classifier head and no representation (pre-logits) layer | ViT-Small (ViT-S/16)
ImageNet-21k weights | [
"ViT",
"-",
"Small",
"(",
"ViT",
"-",
"S",
"/",
"16",
")",
"ImageNet",
"-",
"21k",
"weights"
] | def vit_small_patch32_224_in21k(pretrained=False, **kwargs):
""" ViT-Small (ViT-S/16)
ImageNet-21k weights @ 224x224, source https://github.com/google-research/vision_transformer.
NOTE: this model has valid 21k classifier head and no representation (pre-logits) layer
"""
model_kwargs = dict(patch_si... | [
"def",
"vit_small_patch32_224_in21k",
"(",
"pretrained",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"model_kwargs",
"=",
"dict",
"(",
"patch_size",
"=",
"32",
",",
"embed_dim",
"=",
"384",
",",
"depth",
"=",
"12",
",",
"num_heads",
"=",
"6",
",",
... | https://github.com/rwightman/pytorch-image-models/blob/ccfeb06936549f19c453b7f1f27e8e632cfbe1c2/timm/models/vision_transformer.py#L730-L737 | |
leo-editor/leo-editor | 383d6776d135ef17d73d935a2f0ecb3ac0e99494 | leo/plugins/viewrendered3.py | python | ViewRenderedController3.set_md_stylesheet | (self) | Verify or create css stylesheet for Markdown node.
If there is no custom css stylesheet specified by self.md_stylesheet,
check if there is one at the standard location. If not, create
a default stylesheet and write it to a file at that place.
The default location is assumed to be at l... | Verify or create css stylesheet for Markdown node. | [
"Verify",
"or",
"create",
"css",
"stylesheet",
"for",
"Markdown",
"node",
"."
] | def set_md_stylesheet(self):
"""Verify or create css stylesheet for Markdown node.
If there is no custom css stylesheet specified by self.md_stylesheet,
check if there is one at the standard location. If not, create
a default stylesheet and write it to a file at that place.
Th... | [
"def",
"set_md_stylesheet",
"(",
"self",
")",
":",
"# If no custom stylesheet specified, use standard one.",
"if",
"not",
"self",
".",
"md_stylesheet",
":",
"# Look for the standard one",
"vr_style_dir",
"=",
"g",
".",
"os_path_join",
"(",
"g",
".",
"app",
".",
"leoDi... | https://github.com/leo-editor/leo-editor/blob/383d6776d135ef17d73d935a2f0ecb3ac0e99494/leo/plugins/viewrendered3.py#L1809-L1844 | ||
translate/translate | 72816df696b5263abfe80ab59129b299b85ae749 | translate/convert/ical2po.py | python | ical2po.convert_store | (self) | Convert a single source format file to a target format file. | Convert a single source format file to a target format file. | [
"Convert",
"a",
"single",
"source",
"format",
"file",
"to",
"a",
"target",
"format",
"file",
"."
] | def convert_store(self):
"""Convert a single source format file to a target format file."""
self.extraction_msg = "extracted from %s" % self.source_store.filename
for source_unit in self.source_store.units:
self.target_store.addunit(self.convert_unit(source_unit)) | [
"def",
"convert_store",
"(",
"self",
")",
":",
"self",
".",
"extraction_msg",
"=",
"\"extracted from %s\"",
"%",
"self",
".",
"source_store",
".",
"filename",
"for",
"source_unit",
"in",
"self",
".",
"source_store",
".",
"units",
":",
"self",
".",
"target_stor... | https://github.com/translate/translate/blob/72816df696b5263abfe80ab59129b299b85ae749/translate/convert/ical2po.py#L66-L71 | ||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/modular/modform_hecketriangle/abstract_ring.py | python | FormsRing_abstract.f_i | (self) | return self.extend_type("holo", ring=True)(y).reduce() | r"""
Return a normalized modular form ``f_i`` with exactly one simple
zero at ``i`` (up to the group action).
It lies in a (holomorphic) extension of the graded ring of ``self``.
In case ``has_reduce_hom`` is ``True`` it is given as an element of
the corresponding space of homog... | r"""
Return a normalized modular form ``f_i`` with exactly one simple
zero at ``i`` (up to the group action). | [
"r",
"Return",
"a",
"normalized",
"modular",
"form",
"f_i",
"with",
"exactly",
"one",
"simple",
"zero",
"at",
"i",
"(",
"up",
"to",
"the",
"group",
"action",
")",
"."
] | def f_i(self):
r"""
Return a normalized modular form ``f_i`` with exactly one simple
zero at ``i`` (up to the group action).
It lies in a (holomorphic) extension of the graded ring of ``self``.
In case ``has_reduce_hom`` is ``True`` it is given as an element of
the corre... | [
"def",
"f_i",
"(",
"self",
")",
":",
"(",
"x",
",",
"y",
",",
"z",
",",
"d",
")",
"=",
"self",
".",
"_pol_ring",
".",
"gens",
"(",
")",
"return",
"self",
".",
"extend_type",
"(",
"\"holo\"",
",",
"ring",
"=",
"True",
")",
"(",
"y",
")",
".",
... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/modular/modform_hecketriangle/abstract_ring.py#L1240-L1302 | |
scanny/python-pptx | 71d1ca0b2b3b9178d64cdab565e8503a25a54e0b | pptx/oxml/xmlchemy.py | python | RequiredAttribute._getter | (self) | return get_attr_value | Return a function object suitable for the "get" side of the attribute
property descriptor. | Return a function object suitable for the "get" side of the attribute
property descriptor. | [
"Return",
"a",
"function",
"object",
"suitable",
"for",
"the",
"get",
"side",
"of",
"the",
"attribute",
"property",
"descriptor",
"."
] | def _getter(self):
"""
Return a function object suitable for the "get" side of the attribute
property descriptor.
"""
def get_attr_value(obj):
attr_str_value = obj.get(self._clark_name)
if attr_str_value is None:
raise InvalidXmlError(
... | [
"def",
"_getter",
"(",
"self",
")",
":",
"def",
"get_attr_value",
"(",
"obj",
")",
":",
"attr_str_value",
"=",
"obj",
".",
"get",
"(",
"self",
".",
"_clark_name",
")",
"if",
"attr_str_value",
"is",
"None",
":",
"raise",
"InvalidXmlError",
"(",
"\"required ... | https://github.com/scanny/python-pptx/blob/71d1ca0b2b3b9178d64cdab565e8503a25a54e0b/pptx/oxml/xmlchemy.py#L231-L247 | |
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Lib/compiler/ast.py | python | UnaryAdd.__init__ | (self, expr, lineno=None) | [] | def __init__(self, expr, lineno=None):
self.expr = expr
self.lineno = lineno | [
"def",
"__init__",
"(",
"self",
",",
"expr",
",",
"lineno",
"=",
"None",
")",
":",
"self",
".",
"expr",
"=",
"expr",
"self",
".",
"lineno",
"=",
"lineno"
] | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/compiler/ast.py#L1326-L1328 | ||||
SolidCode/SolidPython | 4715c827ad90db26ee37df57bc425e6f2de3cf8d | solid/utils.py | python | nut | (screw_type:str='m3') | return ret | [] | def nut(screw_type:str='m3') -> OpenSCADObject:
dims = screw_dimensions[screw_type.lower()]
outer_rad = dims['nut_outer_diam']
inner_rad = dims['screw_outer_diam']
ret = difference()(
circle(outer_rad, segments=6),
circle(inner_rad)
)
return ret | [
"def",
"nut",
"(",
"screw_type",
":",
"str",
"=",
"'m3'",
")",
"->",
"OpenSCADObject",
":",
"dims",
"=",
"screw_dimensions",
"[",
"screw_type",
".",
"lower",
"(",
")",
"]",
"outer_rad",
"=",
"dims",
"[",
"'nut_outer_diam'",
"]",
"inner_rad",
"=",
"dims",
... | https://github.com/SolidCode/SolidPython/blob/4715c827ad90db26ee37df57bc425e6f2de3cf8d/solid/utils.py#L667-L676 | |||
adisonhuang/pay-python | bc1b926cd5e6d42fcd945b6c7dc9c3c003aab571 | all_pay/wx/__init__.py | python | WxPay.enterprise_pay | (self, **kwargs) | return self._verify_return_data(data) | 使用企业对个人付款功能
详细规则参考 https://pay.weixin.qq.com/wiki/doc/api/tools/mch_pay.php?chapter=14_2
:param api_cert_path: 微信支付商户证书路径,此证书(apiclient_cert.pem)需要先到微信支付商户平台获取,下载后保存至服务器
:param api_key_path: 微信支付商户证书路径,此证书(apiclient_key.pem)需要先到微信支付商户平台获取,下载后保存至服务器
:param data: openid, check_name, re_us... | 使用企业对个人付款功能
详细规则参考 https://pay.weixin.qq.com/wiki/doc/api/tools/mch_pay.php?chapter=14_2 | [
"使用企业对个人付款功能",
"详细规则参考",
"https",
":",
"//",
"pay",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"doc",
"/",
"api",
"/",
"tools",
"/",
"mch_pay",
".",
"php?chapter",
"=",
"14_2"
] | def enterprise_pay(self, **kwargs):
"""
使用企业对个人付款功能
详细规则参考 https://pay.weixin.qq.com/wiki/doc/api/tools/mch_pay.php?chapter=14_2
:param api_cert_path: 微信支付商户证书路径,此证书(apiclient_cert.pem)需要先到微信支付商户平台获取,下载后保存至服务器
:param api_key_path: 微信支付商户证书路径,此证书(apiclient_key.pem)需要先到微信支付商户平台获取,... | [
"def",
"enterprise_pay",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"self",
".",
"_api_cert_path",
"or",
"not",
"self",
".",
"_api_key_path",
":",
"raise",
"PayError",
"(",
"message",
"=",
"'miss parameter _api_cert_path or _api_key_path'",
")"... | https://github.com/adisonhuang/pay-python/blob/bc1b926cd5e6d42fcd945b6c7dc9c3c003aab571/all_pay/wx/__init__.py#L356-L390 | |
wger-project/wger | 3a17a2cf133d242d1f8c357faa53cf675a7b3223 | wger/utils/helpers.py | python | next_weekday | (date, weekday) | return date + datetime.timedelta(days_ahead) | Helper function to find the next weekday after a given date,
e.g. the first Monday after the 2013-12-05
See link for more details:
* http://stackoverflow.com/questions/6558535/python-find-the-date-for-the-first-monday-after-a
:param date: the start date
:param weekday: weekday (0, Monday, 1 Tuesda... | Helper function to find the next weekday after a given date,
e.g. the first Monday after the 2013-12-05 | [
"Helper",
"function",
"to",
"find",
"the",
"next",
"weekday",
"after",
"a",
"given",
"date",
"e",
".",
"g",
".",
"the",
"first",
"Monday",
"after",
"the",
"2013",
"-",
"12",
"-",
"05"
] | def next_weekday(date, weekday):
"""
Helper function to find the next weekday after a given date,
e.g. the first Monday after the 2013-12-05
See link for more details:
* http://stackoverflow.com/questions/6558535/python-find-the-date-for-the-first-monday-after-a
:param date: the start date
... | [
"def",
"next_weekday",
"(",
"date",
",",
"weekday",
")",
":",
"days_ahead",
"=",
"weekday",
"-",
"date",
".",
"weekday",
"(",
")",
"if",
"days_ahead",
"<=",
"0",
":",
"days_ahead",
"+=",
"7",
"return",
"date",
"+",
"datetime",
".",
"timedelta",
"(",
"d... | https://github.com/wger-project/wger/blob/3a17a2cf133d242d1f8c357faa53cf675a7b3223/wger/utils/helpers.py#L94-L111 | |
Blockstream/satellite | ceb46a00e176c43a6b4170359f6948663a0616bb | blocksatcli/sdr.py | python | _monitor_demod_info | (info_pipe, monitor) | Monitor leandvb's demodulator information
Continuously read the demodulator information printed by leandvb into the
descriptor pointed by --fd-info, which is tied to an unnamed pipe
file. Then, feed the information into the monitor object.
Args:
info_pipe : Pipe object pointing to the pipe fil... | Monitor leandvb's demodulator information | [
"Monitor",
"leandvb",
"s",
"demodulator",
"information"
] | def _monitor_demod_info(info_pipe, monitor):
"""Monitor leandvb's demodulator information
Continuously read the demodulator information printed by leandvb into the
descriptor pointed by --fd-info, which is tied to an unnamed pipe
file. Then, feed the information into the monitor object.
Args:
... | [
"def",
"_monitor_demod_info",
"(",
"info_pipe",
",",
"monitor",
")",
":",
"assert",
"(",
"isinstance",
"(",
"info_pipe",
",",
"util",
".",
"Pipe",
")",
")",
"# \"Standard\" status format accepted by the Monitor class",
"status",
"=",
"{",
"'lock'",
":",
"(",
"Fals... | https://github.com/Blockstream/satellite/blob/ceb46a00e176c43a6b4170359f6948663a0616bb/blocksatcli/sdr.py#L90-L138 | ||
nlloyd/SubliminalCollaborator | 5c619e17ddbe8acb9eea8996ec038169ddcd50a1 | libs/twisted/trial/reporter.py | python | _AnsiColorizer.supported | (cls, stream=sys.stdout) | A class method that returns True if the current platform supports
coloring terminal output using this method. Returns False otherwise. | A class method that returns True if the current platform supports
coloring terminal output using this method. Returns False otherwise. | [
"A",
"class",
"method",
"that",
"returns",
"True",
"if",
"the",
"current",
"platform",
"supports",
"coloring",
"terminal",
"output",
"using",
"this",
"method",
".",
"Returns",
"False",
"otherwise",
"."
] | def supported(cls, stream=sys.stdout):
"""
A class method that returns True if the current platform supports
coloring terminal output using this method. Returns False otherwise.
"""
if not stream.isatty():
return False # auto color only on TTYs
try:
... | [
"def",
"supported",
"(",
"cls",
",",
"stream",
"=",
"sys",
".",
"stdout",
")",
":",
"if",
"not",
"stream",
".",
"isatty",
"(",
")",
":",
"return",
"False",
"# auto color only on TTYs",
"try",
":",
"import",
"curses",
"except",
"ImportError",
":",
"return",... | https://github.com/nlloyd/SubliminalCollaborator/blob/5c619e17ddbe8acb9eea8996ec038169ddcd50a1/libs/twisted/trial/reporter.py#L834-L854 | ||
crossbario/crossbar | ed350b7ba1c8421f3640b9c2e94a21ed4cfdff64 | crossbar/bridge/mqtt/wamp.py | python | WampMQTTServerFactory._get_payload_format | (self, topic) | Map a WAMP topic URI to MQTT payload format.
:param topic: WAMP URI.
:type topic: str
:returns: Payload format metadata.
:rtype: dict | Map a WAMP topic URI to MQTT payload format.
:param topic: WAMP URI.
:type topic: str | [
"Map",
"a",
"WAMP",
"topic",
"URI",
"to",
"MQTT",
"payload",
"format",
".",
":",
"param",
"topic",
":",
"WAMP",
"URI",
".",
":",
"type",
"topic",
":",
"str"
] | def _get_payload_format(self, topic):
"""
Map a WAMP topic URI to MQTT payload format.
:param topic: WAMP URI.
:type topic: str
:returns: Payload format metadata.
:rtype: dict
"""
try:
pmap = self._payload_mapping.longest_prefix_value(topic)
... | [
"def",
"_get_payload_format",
"(",
"self",
",",
"topic",
")",
":",
"try",
":",
"pmap",
"=",
"self",
".",
"_payload_mapping",
".",
"longest_prefix_value",
"(",
"topic",
")",
"except",
"KeyError",
":",
"return",
"None",
"else",
":",
"return",
"pmap"
] | https://github.com/crossbario/crossbar/blob/ed350b7ba1c8421f3640b9c2e94a21ed4cfdff64/crossbar/bridge/mqtt/wamp.py#L500-L514 | ||
JulianEberius/SublimePythonIDE | d70e40abc0c9f347af3204c7b910e0d6bfd6e459 | server/lib/python2/rope/base/prefs.py | python | Prefs.set | (self, key, value) | Set the value of `key` preference to `value`. | Set the value of `key` preference to `value`. | [
"Set",
"the",
"value",
"of",
"key",
"preference",
"to",
"value",
"."
] | def set(self, key, value):
"""Set the value of `key` preference to `value`."""
if key in self.callbacks:
self.callbacks[key](value)
else:
self.prefs[key] = value | [
"def",
"set",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"if",
"key",
"in",
"self",
".",
"callbacks",
":",
"self",
".",
"callbacks",
"[",
"key",
"]",
"(",
"value",
")",
"else",
":",
"self",
".",
"prefs",
"[",
"key",
"]",
"=",
"value"
] | https://github.com/JulianEberius/SublimePythonIDE/blob/d70e40abc0c9f347af3204c7b910e0d6bfd6e459/server/lib/python2/rope/base/prefs.py#L7-L12 | ||
kamalgill/flask-appengine-template | 11760f83faccbb0d0afe416fc58e67ecfb4643c2 | src/lib/wtforms/fields/core.py | python | StringField.process_formdata | (self, valuelist) | [] | def process_formdata(self, valuelist):
if valuelist:
self.data = valuelist[0]
else:
self.data = '' | [
"def",
"process_formdata",
"(",
"self",
",",
"valuelist",
")",
":",
"if",
"valuelist",
":",
"self",
".",
"data",
"=",
"valuelist",
"[",
"0",
"]",
"else",
":",
"self",
".",
"data",
"=",
"''"
] | https://github.com/kamalgill/flask-appengine-template/blob/11760f83faccbb0d0afe416fc58e67ecfb4643c2/src/lib/wtforms/fields/core.py#L526-L530 | ||||
oracle/oci-python-sdk | 3c1604e4e212008fb6718e2f68cdb5ef71fd5793 | src/oci/log_analytics/log_analytics_client.py | python | LogAnalyticsClient.list_sources | (self, namespace_name, compartment_id, **kwargs) | Returns a list of sources, containing detailed information about them. You may limit the number of results, provide sorting order, and filter by information such as display name, description and entity type.
:param str namespace_name: (required)
The Logging Analytics namespace used for the request... | Returns a list of sources, containing detailed information about them. You may limit the number of results, provide sorting order, and filter by information such as display name, description and entity type. | [
"Returns",
"a",
"list",
"of",
"sources",
"containing",
"detailed",
"information",
"about",
"them",
".",
"You",
"may",
"limit",
"the",
"number",
"of",
"results",
"provide",
"sorting",
"order",
"and",
"filter",
"by",
"information",
"such",
"as",
"display",
"name... | def list_sources(self, namespace_name, compartment_id, **kwargs):
"""
Returns a list of sources, containing detailed information about them. You may limit the number of results, provide sorting order, and filter by information such as display name, description and entity type.
:param str names... | [
"def",
"list_sources",
"(",
"self",
",",
"namespace_name",
",",
"compartment_id",
",",
"*",
"*",
"kwargs",
")",
":",
"resource_path",
"=",
"\"/namespaces/{namespaceName}/sources\"",
"method",
"=",
"\"GET\"",
"# Don't accept unknown kwargs",
"expected_kwargs",
"=",
"[",
... | https://github.com/oracle/oci-python-sdk/blob/3c1604e4e212008fb6718e2f68cdb5ef71fd5793/src/oci/log_analytics/log_analytics_client.py#L12755-L12933 | ||
deanishe/alfred-pwgen | 7966df5c5e05f2fca5b9406fb2a6116f7030608a | src/workflow/update.py | python | Version.__gt__ | (self, other) | return other.__lt__(self) | Implement comparison. | Implement comparison. | [
"Implement",
"comparison",
"."
] | def __gt__(self, other):
"""Implement comparison."""
if not isinstance(other, Version):
raise ValueError('not a Version instance: {0!r}'.format(other))
return other.__lt__(self) | [
"def",
"__gt__",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"Version",
")",
":",
"raise",
"ValueError",
"(",
"'not a Version instance: {0!r}'",
".",
"format",
"(",
"other",
")",
")",
"return",
"other",
".",
"__lt__",... | https://github.com/deanishe/alfred-pwgen/blob/7966df5c5e05f2fca5b9406fb2a6116f7030608a/src/workflow/update.py#L317-L321 | |
IJDykeman/wangTiles | 7c1ee2095ebdf7f72bce07d94c6484915d5cae8b | experimental_code/tiles_3d/venv_mac/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.py | python | TreeBuilder.getDocument | (self) | return self.document | Return the final tree | Return the final tree | [
"Return",
"the",
"final",
"tree"
] | def getDocument(self):
"Return the final tree"
return self.document | [
"def",
"getDocument",
"(",
"self",
")",
":",
"return",
"self",
".",
"document"
] | https://github.com/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/tiles_3d/venv_mac/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.py#L369-L371 | |
metabrainz/picard | 535bf8c7d9363ffc7abb3f69418ec11823c38118 | picard/ui/options/plugins.py | python | PluginsOptionsPage.selected_item | (self) | [] | def selected_item(self):
try:
return self.ui.plugins.selectedItems()[COLUMN_NAME]
except IndexError:
return None | [
"def",
"selected_item",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"ui",
".",
"plugins",
".",
"selectedItems",
"(",
")",
"[",
"COLUMN_NAME",
"]",
"except",
"IndexError",
":",
"return",
"None"
] | https://github.com/metabrainz/picard/blob/535bf8c7d9363ffc7abb3f69418ec11823c38118/picard/ui/options/plugins.py#L271-L275 | ||||
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/boto-2.46.1/boto/dynamodb/table.py | python | Table.batch_get_item | (self, keys, attributes_to_get=None) | return TableBatchGenerator(self, keys, attributes_to_get) | Return a set of attributes for a multiple items from a single table
using their primary keys. This abstraction removes the 100 Items per
batch limitations as well as the "UnprocessedKeys" logic.
:type keys: list
:param keys: A list of scalar or tuple values. Each element in the
... | Return a set of attributes for a multiple items from a single table
using their primary keys. This abstraction removes the 100 Items per
batch limitations as well as the "UnprocessedKeys" logic. | [
"Return",
"a",
"set",
"of",
"attributes",
"for",
"a",
"multiple",
"items",
"from",
"a",
"single",
"table",
"using",
"their",
"primary",
"keys",
".",
"This",
"abstraction",
"removes",
"the",
"100",
"Items",
"per",
"batch",
"limitations",
"as",
"well",
"as",
... | def batch_get_item(self, keys, attributes_to_get=None):
"""
Return a set of attributes for a multiple items from a single table
using their primary keys. This abstraction removes the 100 Items per
batch limitations as well as the "UnprocessedKeys" logic.
:type keys: list
... | [
"def",
"batch_get_item",
"(",
"self",
",",
"keys",
",",
"attributes_to_get",
"=",
"None",
")",
":",
"return",
"TableBatchGenerator",
"(",
"self",
",",
"keys",
",",
"attributes_to_get",
")"
] | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/boto-2.46.1/boto/dynamodb/table.py#L520-L546 | |
ganeti/ganeti | d340a9ddd12f501bef57da421b5f9b969a4ba905 | lib/hooksmaster.py | python | HooksMaster.RunConfigUpdate | (self) | Run the special configuration update hook
This is a special hook that runs only on the master after each
top-level LI if the configuration has been updated. | Run the special configuration update hook | [
"Run",
"the",
"special",
"configuration",
"update",
"hook"
] | def RunConfigUpdate(self):
"""Run the special configuration update hook
This is a special hook that runs only on the master after each
top-level LI if the configuration has been updated.
"""
phase = constants.HOOKS_PHASE_POST
hpath = constants.HOOKS_NAME_CFGUPDATE
nodes = [self.master_name... | [
"def",
"RunConfigUpdate",
"(",
"self",
")",
":",
"phase",
"=",
"constants",
".",
"HOOKS_PHASE_POST",
"hpath",
"=",
"constants",
".",
"HOOKS_NAME_CFGUPDATE",
"nodes",
"=",
"[",
"self",
".",
"master_name",
"]",
"self",
".",
"_RunWrapper",
"(",
"nodes",
",",
"h... | https://github.com/ganeti/ganeti/blob/d340a9ddd12f501bef57da421b5f9b969a4ba905/lib/hooksmaster.py#L262-L272 | ||
dj-stripe/dj-stripe | cf15b07c754525077098e2b906108425a1f657e0 | djstripe/models/payment_methods.py | python | LegacySourceMixin.api_retrieve | (self, api_key=None, stripe_account=None) | [] | def api_retrieve(self, api_key=None, stripe_account=None):
# OVERRIDING the parent version of this function
# Cards & Banks Accounts must be manipulated through a customer or account.
api_key = api_key or self.default_api_key
if self.customer:
return stripe.Customer.retriev... | [
"def",
"api_retrieve",
"(",
"self",
",",
"api_key",
"=",
"None",
",",
"stripe_account",
"=",
"None",
")",
":",
"# OVERRIDING the parent version of this function",
"# Cards & Banks Accounts must be manipulated through a customer or account.",
"api_key",
"=",
"api_key",
"or",
"... | https://github.com/dj-stripe/dj-stripe/blob/cf15b07c754525077098e2b906108425a1f657e0/djstripe/models/payment_methods.py#L288-L311 | ||||
GoogleCloudPlatform/deploymentmanager-samples | 9cc562d7d048a9890572587ca299816c0cd3bb38 | examples/v2/ha-service/container_instance_template.py | python | GenerateConfig | (context) | return {'resources': [instance_template]} | Generates config. | Generates config. | [
"Generates",
"config",
"."
] | def GenerateConfig(context):
"""Generates config."""
image = ''.join(['https://www.googleapis.com/compute/v1/',
'projects/cos-cloud/global/images/',
context.properties['containerImage']])
default_network = ''.join(['https://www.googleapis.com/compute/v1/projects/',
... | [
"def",
"GenerateConfig",
"(",
"context",
")",
":",
"image",
"=",
"''",
".",
"join",
"(",
"[",
"'https://www.googleapis.com/compute/v1/'",
",",
"'projects/cos-cloud/global/images/'",
",",
"context",
".",
"properties",
"[",
"'containerImage'",
"]",
"]",
")",
"default_... | https://github.com/GoogleCloudPlatform/deploymentmanager-samples/blob/9cc562d7d048a9890572587ca299816c0cd3bb38/examples/v2/ha-service/container_instance_template.py#L20-L61 | |
vivisect/vivisect | 37b0b655d8dedfcf322e86b0f144b096e48d547e | vivisect/__init__.py | python | VivWorkspace.getLocationByName | (self, name) | return self.getLocation(va) | Return a location object by the name of the
location. | Return a location object by the name of the
location. | [
"Return",
"a",
"location",
"object",
"by",
"the",
"name",
"of",
"the",
"location",
"."
] | def getLocationByName(self, name):
"""
Return a location object by the name of the
location.
"""
va = self.vaByName(name)
if va is None:
raise InvalidLocation(0, "Unknown Name: %s" % name)
return self.getLocation(va) | [
"def",
"getLocationByName",
"(",
"self",
",",
"name",
")",
":",
"va",
"=",
"self",
".",
"vaByName",
"(",
"name",
")",
"if",
"va",
"is",
"None",
":",
"raise",
"InvalidLocation",
"(",
"0",
",",
"\"Unknown Name: %s\"",
"%",
"name",
")",
"return",
"self",
... | https://github.com/vivisect/vivisect/blob/37b0b655d8dedfcf322e86b0f144b096e48d547e/vivisect/__init__.py#L2518-L2526 | |
SBCV/Blender-Addon-Photogrammetry-Importer | d964ef04cefde73320749cc346113e16be5bd73b | photogrammetry_importer/panels/screenshot_operators.py | python | ExportScreenshotImageOperator.poll | (cls, context) | return True | Return the availability status of the operator. | Return the availability status of the operator. | [
"Return",
"the",
"availability",
"status",
"of",
"the",
"operator",
"."
] | def poll(cls, context):
"""Return the availability status of the operator."""
return True | [
"def",
"poll",
"(",
"cls",
",",
"context",
")",
":",
"return",
"True"
] | https://github.com/SBCV/Blender-Addon-Photogrammetry-Importer/blob/d964ef04cefde73320749cc346113e16be5bd73b/photogrammetry_importer/panels/screenshot_operators.py#L28-L30 | |
hannes-brt/hebel | 1e2c3a9309c2646103901b26a55be4e312dd5005 | hebel/pycuda_ops/cudart.py | python | cudaCheckStatus | (status) | Raise CUDA exception.
Raise an exception corresponding to the specified CUDA runtime error
code.
Parameters
----------
status : int
CUDA runtime error code.
See Also
--------
cudaExceptions | Raise CUDA exception. | [
"Raise",
"CUDA",
"exception",
"."
] | def cudaCheckStatus(status):
"""
Raise CUDA exception.
Raise an exception corresponding to the specified CUDA runtime error
code.
Parameters
----------
status : int
CUDA runtime error code.
See Also
--------
cudaExceptions
"""
if status != 0:
try:
... | [
"def",
"cudaCheckStatus",
"(",
"status",
")",
":",
"if",
"status",
"!=",
"0",
":",
"try",
":",
"raise",
"cudaExceptions",
"[",
"status",
"]",
"except",
"KeyError",
":",
"raise",
"cudaError"
] | https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/pycuda_ops/cudart.py#L457-L479 | ||
bojone/bert4keras | 347310ee0562139cc5de29ccc40dad9a41eb8595 | examples/task_sequence_labeling_cws_crf.py | python | predict_to_file | (in_file, out_file) | 预测结果到文件,便于用官方脚本评测
使用示例:
predict_to_file('/root/icwb2-data/testing/pku_test.utf8', 'myresult.txt')
官方评测代码示例:
data_dir="/root/icwb2-data"
$data_dir/scripts/score $data_dir/gold/pku_training_words.utf8 $data_dir/gold/pku_test_gold.utf8 myresult.txt > myscore.txt
(执行完毕后查看myscore.txt的内容末尾) | 预测结果到文件,便于用官方脚本评测
使用示例:
predict_to_file('/root/icwb2-data/testing/pku_test.utf8', 'myresult.txt')
官方评测代码示例:
data_dir="/root/icwb2-data"
$data_dir/scripts/score $data_dir/gold/pku_training_words.utf8 $data_dir/gold/pku_test_gold.utf8 myresult.txt > myscore.txt
(执行完毕后查看myscore.txt的内容末尾) | [
"预测结果到文件,便于用官方脚本评测",
"使用示例:",
"predict_to_file",
"(",
"/",
"root",
"/",
"icwb2",
"-",
"data",
"/",
"testing",
"/",
"pku_test",
".",
"utf8",
"myresult",
".",
"txt",
")",
"官方评测代码示例:",
"data_dir",
"=",
"/",
"root",
"/",
"icwb2",
"-",
"data",
"$data_dir",
"/",... | def predict_to_file(in_file, out_file):
"""预测结果到文件,便于用官方脚本评测
使用示例:
predict_to_file('/root/icwb2-data/testing/pku_test.utf8', 'myresult.txt')
官方评测代码示例:
data_dir="/root/icwb2-data"
$data_dir/scripts/score $data_dir/gold/pku_training_words.utf8 $data_dir/gold/pku_test_gold.utf8 myresult.txt > mysco... | [
"def",
"predict_to_file",
"(",
"in_file",
",",
"out_file",
")",
":",
"fw",
"=",
"open",
"(",
"out_file",
",",
"'w'",
",",
"encoding",
"=",
"'utf-8'",
")",
"with",
"open",
"(",
"in_file",
",",
"encoding",
"=",
"'utf-8'",
")",
"as",
"fr",
":",
"for",
"... | https://github.com/bojone/bert4keras/blob/347310ee0562139cc5de29ccc40dad9a41eb8595/examples/task_sequence_labeling_cws_crf.py#L171-L187 | ||
dagster-io/dagster | b27d569d5fcf1072543533a0c763815d96f90b8f | examples/docs_snippets/docs_snippets/concepts/io_management/subselection.py | python | op2 | (dataframe) | Do stuff | Do stuff | [
"Do",
"stuff"
] | def op2(dataframe):
"""Do stuff""" | [
"def",
"op2",
"(",
"dataframe",
")",
":"
] | https://github.com/dagster-io/dagster/blob/b27d569d5fcf1072543533a0c763815d96f90b8f/examples/docs_snippets/docs_snippets/concepts/io_management/subselection.py#L39-L40 | ||
NVIDIA/Megatron-LM | 9a8b89acd8f6ba096860170d0e30ddc0bc2bacd4 | pretrain_t5.py | python | get_batch | (data_iterator) | return tokens_enc, tokens_dec, loss_mask, labels, \
enc_mask, dec_mask, enc_dec_mask | Build the batch. | Build the batch. | [
"Build",
"the",
"batch",
"."
] | def get_batch(data_iterator):
"""Build the batch."""
keys = ['text_enc', 'text_dec', 'labels', 'loss_mask',
'enc_mask', 'dec_mask', 'enc_dec_mask']
datatype = torch.int64
# Broadcast data.
if data_iterator is not None:
data = next(data_iterator)
else:
data = None
... | [
"def",
"get_batch",
"(",
"data_iterator",
")",
":",
"keys",
"=",
"[",
"'text_enc'",
",",
"'text_dec'",
",",
"'labels'",
",",
"'loss_mask'",
",",
"'enc_mask'",
",",
"'dec_mask'",
",",
"'enc_dec_mask'",
"]",
"datatype",
"=",
"torch",
".",
"int64",
"# Broadcast d... | https://github.com/NVIDIA/Megatron-LM/blob/9a8b89acd8f6ba096860170d0e30ddc0bc2bacd4/pretrain_t5.py#L84-L109 | |
kuri65536/python-for-android | 26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891 | python-build/python-libs/gdata/build/lib/gdata/service.py | python | GDataService.SetOAuthInputParameters | (self, signature_method, consumer_key,
consumer_secret=None, rsa_key=None,
two_legged_oauth=False, requestor_id=None) | Sets parameters required for using OAuth authentication mechanism.
NOTE: Though consumer_secret and rsa_key are optional, either of the two
is required depending on the value of the signature_method.
Args:
signature_method: class which provides implementation for strategy class
oauth.oauth... | Sets parameters required for using OAuth authentication mechanism. | [
"Sets",
"parameters",
"required",
"for",
"using",
"OAuth",
"authentication",
"mechanism",
"."
] | def SetOAuthInputParameters(self, signature_method, consumer_key,
consumer_secret=None, rsa_key=None,
two_legged_oauth=False, requestor_id=None):
"""Sets parameters required for using OAuth authentication mechanism.
NOTE: Though consumer_secret and rs... | [
"def",
"SetOAuthInputParameters",
"(",
"self",
",",
"signature_method",
",",
"consumer_key",
",",
"consumer_secret",
"=",
"None",
",",
"rsa_key",
"=",
"None",
",",
"two_legged_oauth",
"=",
"False",
",",
"requestor_id",
"=",
"None",
")",
":",
"self",
".",
"_oau... | https://github.com/kuri65536/python-for-android/blob/26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891/python-build/python-libs/gdata/build/lib/gdata/service.py#L349-L380 | ||
encode/django-rest-framework | c5be86a6dbf3d21b00a296af5994fa075826bf0b | rest_framework/pagination.py | python | CursorPagination.decode_cursor | (self, request) | return Cursor(offset=offset, reverse=reverse, position=position) | Given a request with a cursor, return a `Cursor` instance. | Given a request with a cursor, return a `Cursor` instance. | [
"Given",
"a",
"request",
"with",
"a",
"cursor",
"return",
"a",
"Cursor",
"instance",
"."
] | def decode_cursor(self, request):
"""
Given a request with a cursor, return a `Cursor` instance.
"""
# Determine if we have a cursor, and if so then decode it.
encoded = request.query_params.get(self.cursor_query_param)
if encoded is None:
return None
... | [
"def",
"decode_cursor",
"(",
"self",
",",
"request",
")",
":",
"# Determine if we have a cursor, and if so then decode it.",
"encoded",
"=",
"request",
".",
"query_params",
".",
"get",
"(",
"self",
".",
"cursor_query_param",
")",
"if",
"encoded",
"is",
"None",
":",
... | https://github.com/encode/django-rest-framework/blob/c5be86a6dbf3d21b00a296af5994fa075826bf0b/rest_framework/pagination.py#L845-L868 | |
jcmgray/quimb | a54b22c61534be8acbc9efe4da97fb5c7f12057d | quimb/tensor/tensor_2d_tebd.py | python | SimpleUpdate.gauges | (self) | return self._gauges | The dictionary of bond pair coordinates to Tensors describing the
weights (``t = gauges[pair]; t.data``) and index
(``t = gauges[pair]; t.inds[0]``) of all the gauges. | The dictionary of bond pair coordinates to Tensors describing the
weights (``t = gauges[pair]; t.data``) and index
(``t = gauges[pair]; t.inds[0]``) of all the gauges. | [
"The",
"dictionary",
"of",
"bond",
"pair",
"coordinates",
"to",
"Tensors",
"describing",
"the",
"weights",
"(",
"t",
"=",
"gauges",
"[",
"pair",
"]",
";",
"t",
".",
"data",
")",
"and",
"index",
"(",
"t",
"=",
"gauges",
"[",
"pair",
"]",
";",
"t",
"... | def gauges(self):
"""The dictionary of bond pair coordinates to Tensors describing the
weights (``t = gauges[pair]; t.data``) and index
(``t = gauges[pair]; t.inds[0]``) of all the gauges.
"""
return self._gauges | [
"def",
"gauges",
"(",
"self",
")",
":",
"return",
"self",
".",
"_gauges"
] | https://github.com/jcmgray/quimb/blob/a54b22c61534be8acbc9efe4da97fb5c7f12057d/quimb/tensor/tensor_2d_tebd.py#L542-L547 | |
inejc/paragraph-vectors | 33f6465208f738a5dac69810d709459cc99ed704 | paragraphvec/models.py | python | DM.forward | (self, context_ids, doc_ids, target_noise_ids) | return torch.bmm(
x.unsqueeze(1),
self._O[:, target_noise_ids].permute(1, 0, 2)).squeeze() | Sparse computation of scores (unnormalized log probabilities)
that should be passed to the negative sampling loss.
Parameters
----------
context_ids: torch.Tensor of size (batch_size, num_context_words)
Vocabulary indices of context words.
doc_ids: torch.Tensor of s... | Sparse computation of scores (unnormalized log probabilities)
that should be passed to the negative sampling loss. | [
"Sparse",
"computation",
"of",
"scores",
"(",
"unnormalized",
"log",
"probabilities",
")",
"that",
"should",
"be",
"passed",
"to",
"the",
"negative",
"sampling",
"loss",
"."
] | def forward(self, context_ids, doc_ids, target_noise_ids):
"""Sparse computation of scores (unnormalized log probabilities)
that should be passed to the negative sampling loss.
Parameters
----------
context_ids: torch.Tensor of size (batch_size, num_context_words)
Vo... | [
"def",
"forward",
"(",
"self",
",",
"context_ids",
",",
"doc_ids",
",",
"target_noise_ids",
")",
":",
"# combine a paragraph vector with word vectors of",
"# input (context) words",
"x",
"=",
"torch",
".",
"add",
"(",
"self",
".",
"_D",
"[",
"doc_ids",
",",
":",
... | https://github.com/inejc/paragraph-vectors/blob/33f6465208f738a5dac69810d709459cc99ed704/paragraphvec/models.py#L31-L61 | |
rlabbe/filterpy | a437893597957764fb6b415bfb5640bb117f5b99 | filterpy/leastsq/least_squares.py | python | LeastSquaresFilter.errors | (self) | return error, std | Computes and returns the error and standard deviation of the
filter at this time step.
Returns
-------
error : np.array size 1xorder+1
std : np.array size 1xorder+1 | Computes and returns the error and standard deviation of the
filter at this time step. | [
"Computes",
"and",
"returns",
"the",
"error",
"and",
"standard",
"deviation",
"of",
"the",
"filter",
"at",
"this",
"time",
"step",
"."
] | def errors(self):
"""
Computes and returns the error and standard deviation of the
filter at this time step.
Returns
-------
error : np.array size 1xorder+1
std : np.array size 1xorder+1
"""
n = self.n
dt = self.dt
order = self._... | [
"def",
"errors",
"(",
"self",
")",
":",
"n",
"=",
"self",
".",
"n",
"dt",
"=",
"self",
".",
"dt",
"order",
"=",
"self",
".",
"_order",
"sigma",
"=",
"self",
".",
"sigma",
"error",
"=",
"np",
".",
"zeros",
"(",
"order",
"+",
"1",
")",
"std",
"... | https://github.com/rlabbe/filterpy/blob/a437893597957764fb6b415bfb5640bb117f5b99/filterpy/leastsq/least_squares.py#L157-L205 | |
GoSecure/pyrdp | abd8b8762b6d7fd0e49d4a927b529f892b412743 | pyrdp/parser/rdp/orders/secondary.py | python | CacheBitmapV1.__str__ | (self) | return (f'<CacheBitmapV1 {self.width}x{self.height}x{self.bpp}'
f' Cache={self.cacheId}:{self.cacheIndex}>') | [] | def __str__(self):
return (f'<CacheBitmapV1 {self.width}x{self.height}x{self.bpp}'
f' Cache={self.cacheId}:{self.cacheIndex}>') | [
"def",
"__str__",
"(",
"self",
")",
":",
"return",
"(",
"f'<CacheBitmapV1 {self.width}x{self.height}x{self.bpp}'",
"f' Cache={self.cacheId}:{self.cacheIndex}>'",
")"
] | https://github.com/GoSecure/pyrdp/blob/abd8b8762b6d7fd0e49d4a927b529f892b412743/pyrdp/parser/rdp/orders/secondary.py#L116-L118 | |||
conorpp/btproxy | cd1c90688502852b55f139cc5202b487e7068c89 | libbtproxy/utils.py | python | print_verbose | (*args) | [] | def print_verbose(*args):
global print_lock
if argparser.args.verbose:
with print_lock:
print(*args) | [
"def",
"print_verbose",
"(",
"*",
"args",
")",
":",
"global",
"print_lock",
"if",
"argparser",
".",
"args",
".",
"verbose",
":",
"with",
"print_lock",
":",
"print",
"(",
"*",
"args",
")"
] | https://github.com/conorpp/btproxy/blob/cd1c90688502852b55f139cc5202b487e7068c89/libbtproxy/utils.py#L27-L31 | ||||
yuxiaokui/Intranet-Penetration | f57678a204840c83cbf3308e3470ae56c5ff514b | proxy/XX-Net/code/default/python27/1.0/lib/darwin/gevent/ssl.py | python | sslwrap_simple | (sock, keyfile=None, certfile=None) | return SSLSocket(sock, keyfile, certfile) | A replacement for the old socket.ssl function. Designed
for compability with Python 2.5 and earlier. Will disappear in
Python 3.0. | A replacement for the old socket.ssl function. Designed
for compability with Python 2.5 and earlier. Will disappear in
Python 3.0. | [
"A",
"replacement",
"for",
"the",
"old",
"socket",
".",
"ssl",
"function",
".",
"Designed",
"for",
"compability",
"with",
"Python",
"2",
".",
"5",
"and",
"earlier",
".",
"Will",
"disappear",
"in",
"Python",
"3",
".",
"0",
"."
] | def sslwrap_simple(sock, keyfile=None, certfile=None):
"""A replacement for the old socket.ssl function. Designed
for compability with Python 2.5 and earlier. Will disappear in
Python 3.0."""
return SSLSocket(sock, keyfile, certfile) | [
"def",
"sslwrap_simple",
"(",
"sock",
",",
"keyfile",
"=",
"None",
",",
"certfile",
"=",
"None",
")",
":",
"return",
"SSLSocket",
"(",
"sock",
",",
"keyfile",
",",
"certfile",
")"
] | https://github.com/yuxiaokui/Intranet-Penetration/blob/f57678a204840c83cbf3308e3470ae56c5ff514b/proxy/XX-Net/code/default/python27/1.0/lib/darwin/gevent/ssl.py#L405-L409 | |
hacktoolkit/django-htk | 902f3780630f1308aa97a70b9b62a5682239ff2d | lib/stripe_lib/utils.py | python | _log_event_rollbar | (event, request=None, log_level='info', message=None) | Log the Stripe event `event` to Rollbar | Log the Stripe event `event` to Rollbar | [
"Log",
"the",
"Stripe",
"event",
"event",
"to",
"Rollbar"
] | def _log_event_rollbar(event, request=None, log_level='info', message=None):
"""Log the Stripe event `event` to Rollbar
"""
if message:
message = '%s - Stripe Event: %s' % (message, get_event_type(event),)
else:
message = 'Stripe Event: %s' % get_event_type(event)
extra_data = {
... | [
"def",
"_log_event_rollbar",
"(",
"event",
",",
"request",
"=",
"None",
",",
"log_level",
"=",
"'info'",
",",
"message",
"=",
"None",
")",
":",
"if",
"message",
":",
"message",
"=",
"'%s - Stripe Event: %s'",
"%",
"(",
"message",
",",
"get_event_type",
"(",
... | https://github.com/hacktoolkit/django-htk/blob/902f3780630f1308aa97a70b9b62a5682239ff2d/lib/stripe_lib/utils.py#L266-L276 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.