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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
awslabs/aws-ec2rescue-linux | 8ecf40e7ea0d2563dac057235803fca2221029d2 | lib/botocore/httpsession.py | python | ProxyConfiguration.proxy_url_for | (self, url) | return proxy | Retrirves the corresponding proxy url for a given url. | Retrirves the corresponding proxy url for a given url. | [
"Retrirves",
"the",
"corresponding",
"proxy",
"url",
"for",
"a",
"given",
"url",
"."
] | def proxy_url_for(self, url):
"""Retrirves the corresponding proxy url for a given url. """
parsed_url = urlparse(url)
proxy = self._proxies.get(parsed_url.scheme)
if proxy:
proxy = self._fix_proxy_url(proxy)
return proxy | [
"def",
"proxy_url_for",
"(",
"self",
",",
"url",
")",
":",
"parsed_url",
"=",
"urlparse",
"(",
"url",
")",
"proxy",
"=",
"self",
".",
"_proxies",
".",
"get",
"(",
"parsed_url",
".",
"scheme",
")",
"if",
"proxy",
":",
"proxy",
"=",
"self",
".",
"_fix_... | https://github.com/awslabs/aws-ec2rescue-linux/blob/8ecf40e7ea0d2563dac057235803fca2221029d2/lib/botocore/httpsession.py#L99-L105 | |
pilotmoon/PopClip-Extensions | 29fc472befc09ee350092ac70283bd9fdb456cb6 | source/Trello/requests/cookies.py | python | merge_cookies | (cookiejar, cookies) | return cookiejar | Add cookies to cookiejar and returns a merged CookieJar.
:param cookiejar: CookieJar object to add the cookies to.
:param cookies: Dictionary or CookieJar object to be added. | Add cookies to cookiejar and returns a merged CookieJar. | [
"Add",
"cookies",
"to",
"cookiejar",
"and",
"returns",
"a",
"merged",
"CookieJar",
"."
] | def merge_cookies(cookiejar, cookies):
"""Add cookies to cookiejar and returns a merged CookieJar.
:param cookiejar: CookieJar object to add the cookies to.
:param cookies: Dictionary or CookieJar object to be added.
"""
if not isinstance(cookiejar, cookielib.CookieJar):
raise ValueError('Y... | [
"def",
"merge_cookies",
"(",
"cookiejar",
",",
"cookies",
")",
":",
"if",
"not",
"isinstance",
"(",
"cookiejar",
",",
"cookielib",
".",
"CookieJar",
")",
":",
"raise",
"ValueError",
"(",
"'You can only merge into CookieJar'",
")",
"if",
"isinstance",
"(",
"cooki... | https://github.com/pilotmoon/PopClip-Extensions/blob/29fc472befc09ee350092ac70283bd9fdb456cb6/source/Trello/requests/cookies.py#L444-L463 | |
fonttools/fonttools | 892322aaff6a89bea5927379ec06bc0da3dfb7df | Lib/fontTools/ttLib/tables/otBase.py | python | BaseTTXConverter.toXML | (self, writer, font) | [] | def toXML(self, writer, font):
self.table.toXML2(writer, font) | [
"def",
"toXML",
"(",
"self",
",",
"writer",
",",
"font",
")",
":",
"self",
".",
"table",
".",
"toXML2",
"(",
"writer",
",",
"font",
")"
] | https://github.com/fonttools/fonttools/blob/892322aaff6a89bea5927379ec06bc0da3dfb7df/Lib/fontTools/ttLib/tables/otBase.py#L100-L101 | ||||
Ultimaker/Cura | a1622c77ea7259ecb956acd6de07b7d34b7ac52b | cura/OAuth2/AuthorizationHelpers.py | python | AuthorizationHelpers.settings | (self) | return self._settings | The OAuth2 settings object. | The OAuth2 settings object. | [
"The",
"OAuth2",
"settings",
"object",
"."
] | def settings(self) -> "OAuth2Settings":
"""The OAuth2 settings object."""
return self._settings | [
"def",
"settings",
"(",
"self",
")",
"->",
"\"OAuth2Settings\"",
":",
"return",
"self",
".",
"_settings"
] | https://github.com/Ultimaker/Cura/blob/a1622c77ea7259ecb956acd6de07b7d34b7ac52b/cura/OAuth2/AuthorizationHelpers.py#L29-L32 | |
cltk/cltk | 1a8c2f5ef72389e2579dfce1fa5af8e59ebc9ec1 | src/cltk/phonology/non/transcription.py | python | OldNorsePhonology.phonetic_i_umlaut | (sound: Vowel) | >>> umlaut_a = OldNorsePhonology.phonetic_i_umlaut(a)
>>> umlaut_a.ipar
'ɛ'
>>> umlaut_au = OldNorsePhonology.phonetic_i_umlaut(DIPHTHONGS_IPA_class["au"])
>>> umlaut_au.ipar
'ɐy'
:param sound: vowel
:return: transformed vowel | >>> umlaut_a = OldNorsePhonology.phonetic_i_umlaut(a)
>>> umlaut_a.ipar
'ɛ' | [
">>>",
"umlaut_a",
"=",
"OldNorsePhonology",
".",
"phonetic_i_umlaut",
"(",
"a",
")",
">>>",
"umlaut_a",
".",
"ipar",
"ɛ"
] | def phonetic_i_umlaut(sound: Vowel) -> Vowel:
"""
>>> umlaut_a = OldNorsePhonology.phonetic_i_umlaut(a)
>>> umlaut_a.ipar
'ɛ'
>>> umlaut_au = OldNorsePhonology.phonetic_i_umlaut(DIPHTHONGS_IPA_class["au"])
>>> umlaut_au.ipar
'ɐy'
:param sound: vowel
... | [
"def",
"phonetic_i_umlaut",
"(",
"sound",
":",
"Vowel",
")",
"->",
"Vowel",
":",
"if",
"sound",
".",
"is_equal",
"(",
"a",
")",
":",
"return",
"ee",
"elif",
"sound",
".",
"is_equal",
"(",
"a",
".",
"lengthen",
"(",
")",
")",
":",
"return",
"ee",
".... | https://github.com/cltk/cltk/blob/1a8c2f5ef72389e2579dfce1fa5af8e59ebc9ec1/src/cltk/phonology/non/transcription.py#L33-L59 | ||
TesterlifeRaymond/doraemon | d5cb6e34bd5f2aa97273ce0c0c9303e32beaa333 | venv/lib/python3.6/site-packages/click/termui.py | python | style | (text, fg=None, bg=None, bold=None, dim=None, underline=None,
blink=None, reverse=None, reset=True) | return ''.join(bits) | Styles a text with ANSI styles and returns the new string. By
default the styling is self contained which means that at the end
of the string a reset code is issued. This can be prevented by
passing ``reset=False``.
Examples::
click.echo(click.style('Hello World!', fg='green'))
click... | Styles a text with ANSI styles and returns the new string. By
default the styling is self contained which means that at the end
of the string a reset code is issued. This can be prevented by
passing ``reset=False``. | [
"Styles",
"a",
"text",
"with",
"ANSI",
"styles",
"and",
"returns",
"the",
"new",
"string",
".",
"By",
"default",
"the",
"styling",
"is",
"self",
"contained",
"which",
"means",
"that",
"at",
"the",
"end",
"of",
"the",
"string",
"a",
"reset",
"code",
"is",... | def style(text, fg=None, bg=None, bold=None, dim=None, underline=None,
blink=None, reverse=None, reset=True):
"""Styles a text with ANSI styles and returns the new string. By
default the styling is self contained which means that at the end
of the string a reset code is issued. This can be preve... | [
"def",
"style",
"(",
"text",
",",
"fg",
"=",
"None",
",",
"bg",
"=",
"None",
",",
"bold",
"=",
"None",
",",
"dim",
"=",
"None",
",",
"underline",
"=",
"None",
",",
"blink",
"=",
"None",
",",
"reverse",
"=",
"None",
",",
"reset",
"=",
"True",
")... | https://github.com/TesterlifeRaymond/doraemon/blob/d5cb6e34bd5f2aa97273ce0c0c9303e32beaa333/venv/lib/python3.6/site-packages/click/termui.py#L327-L393 | |
openstack/python-neutronclient | 517bef2c5454dde2eba5cc2194ee857be6be7164 | neutronclient/v2_0/client.py | python | Client.update_network | (self, network, body=None, revision_number=None) | return self._update_resource(self.network_path % (network), body=body,
revision_number=revision_number) | Updates a network. | Updates a network. | [
"Updates",
"a",
"network",
"."
] | def update_network(self, network, body=None, revision_number=None):
"""Updates a network."""
return self._update_resource(self.network_path % (network), body=body,
revision_number=revision_number) | [
"def",
"update_network",
"(",
"self",
",",
"network",
",",
"body",
"=",
"None",
",",
"revision_number",
"=",
"None",
")",
":",
"return",
"self",
".",
"_update_resource",
"(",
"self",
".",
"network_path",
"%",
"(",
"network",
")",
",",
"body",
"=",
"body"... | https://github.com/openstack/python-neutronclient/blob/517bef2c5454dde2eba5cc2194ee857be6be7164/neutronclient/v2_0/client.py#L869-L872 | |
scrapinghub/spidermon | f2b21e45e70796f583bbb97f39b823c31d242b17 | spidermon/core/monitors.py | python | Monitor.method_level | (self) | return self.method.options.level | [] | def method_level(self):
return self.method.options.level | [
"def",
"method_level",
"(",
"self",
")",
":",
"return",
"self",
".",
"method",
".",
"options",
".",
"level"
] | https://github.com/scrapinghub/spidermon/blob/f2b21e45e70796f583bbb97f39b823c31d242b17/spidermon/core/monitors.py#L81-L82 | |||
biocore/qiime | 76d633c0389671e93febbe1338b5ded658eba31f | qiime/pick_otus.py | python | PrefixSuffixOtuPicker.__call__ | (self, seq_path, result_path=None, log_path=None,
prefix_length=50, suffix_length=50) | return result | Returns dict mapping {otu_id:[seq_ids]} for each otu.
Parameters:
seq_path: path to file of sequences
result_path: path to file of results. If specified,
dumps the result to the desired path instead of returning it.
log_path: path to log, which includes dump of params.
p... | Returns dict mapping {otu_id:[seq_ids]} for each otu. | [
"Returns",
"dict",
"mapping",
"{",
"otu_id",
":",
"[",
"seq_ids",
"]",
"}",
"for",
"each",
"otu",
"."
] | def __call__(self, seq_path, result_path=None, log_path=None,
prefix_length=50, suffix_length=50):
"""Returns dict mapping {otu_id:[seq_ids]} for each otu.
Parameters:
seq_path: path to file of sequences
result_path: path to file of results. If specified,
dumps ... | [
"def",
"__call__",
"(",
"self",
",",
"seq_path",
",",
"result_path",
"=",
"None",
",",
"log_path",
"=",
"None",
",",
"prefix_length",
"=",
"50",
",",
"suffix_length",
"=",
"50",
")",
":",
"log_lines",
"=",
"[",
"]",
"log_lines",
".",
"append",
"(",
"'P... | https://github.com/biocore/qiime/blob/76d633c0389671e93febbe1338b5ded658eba31f/qiime/pick_otus.py#L836-L889 | |
UDST/urbansim | 0db75668ada0005352b7c7e0a405265f78ccadd7 | urbansim/models/transition.py | python | TabularGrowthRateTransition.transition | (self, data, year) | return updated, added_indexes, copied_indexes, removed_indexes | Add or remove rows to/from a table according to the prescribed
growth rate for this model and year.
Parameters
----------
data : pandas.DataFrame
Rows will be removed from or added to this table.
year : None, optional
Here for compatibility with other tra... | Add or remove rows to/from a table according to the prescribed
growth rate for this model and year. | [
"Add",
"or",
"remove",
"rows",
"to",
"/",
"from",
"a",
"table",
"according",
"to",
"the",
"prescribed",
"growth",
"rate",
"for",
"this",
"model",
"and",
"year",
"."
] | def transition(self, data, year):
"""
Add or remove rows to/from a table according to the prescribed
growth rate for this model and year.
Parameters
----------
data : pandas.DataFrame
Rows will be removed from or added to this table.
year : None, opti... | [
"def",
"transition",
"(",
"self",
",",
"data",
",",
"year",
")",
":",
"logger",
".",
"debug",
"(",
"'start: tabular transition'",
")",
"if",
"year",
"not",
"in",
"self",
".",
"_config_table",
".",
"index",
":",
"raise",
"ValueError",
"(",
"'No targets for gi... | https://github.com/UDST/urbansim/blob/0db75668ada0005352b7c7e0a405265f78ccadd7/urbansim/models/transition.py#L261-L335 | |
rocket-league-replays/rocket-league-replays | 23db6dbf2161c1d8b334e5c75f27e38ba04a6514 | rocket_league/apps/replays/views.py | python | ReplayViewSet.get_serializer_class | (self) | Look for serializer class in self.serializer_action_classes, which
should be a dict mapping action name (key) to serializer class (value),
i.e.:
class MyViewSet(MultiSerializerViewSetMixin, ViewSet):
serializer_class = serializers.MyDefaultSerializer
serializer_action_cl... | Look for serializer class in self.serializer_action_classes, which
should be a dict mapping action name (key) to serializer class (value),
i.e.: | [
"Look",
"for",
"serializer",
"class",
"in",
"self",
".",
"serializer_action_classes",
"which",
"should",
"be",
"a",
"dict",
"mapping",
"action",
"name",
"(",
"key",
")",
"to",
"serializer",
"class",
"(",
"value",
")",
"i",
".",
"e",
".",
":"
] | def get_serializer_class(self):
"""
Look for serializer class in self.serializer_action_classes, which
should be a dict mapping action name (key) to serializer class (value),
i.e.:
class MyViewSet(MultiSerializerViewSetMixin, ViewSet):
serializer_class = serializers.... | [
"def",
"get_serializer_class",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"serializer_action_classes",
"[",
"self",
".",
"action",
"]",
"except",
"(",
"KeyError",
",",
"AttributeError",
")",
":",
"return",
"super",
"(",
"ReplayViewSet",
",",
"... | https://github.com/rocket-league-replays/rocket-league-replays/blob/23db6dbf2161c1d8b334e5c75f27e38ba04a6514/rocket_league/apps/replays/views.py#L412-L438 | ||
travisgoodspeed/goodfet | 1750cc1e8588af5470385e52fa098ca7364c2863 | client/intelhex.py | python | hex2bin | (fin, fout, start=None, end=None, size=None, pad=0xFF) | return 0 | Hex-to-Bin convertor engine.
@return 0 if all OK
@param fin input hex file (filename or file-like object)
@param fout output bin file (filename or file-like object)
@param start start of address range (optional)
@param end end of address range (optional)
@param size s... | Hex-to-Bin convertor engine.
@return 0 if all OK | [
"Hex",
"-",
"to",
"-",
"Bin",
"convertor",
"engine",
".",
"@return",
"0",
"if",
"all",
"OK"
] | def hex2bin(fin, fout, start=None, end=None, size=None, pad=0xFF):
"""Hex-to-Bin convertor engine.
@return 0 if all OK
@param fin input hex file (filename or file-like object)
@param fout output bin file (filename or file-like object)
@param start start of address range (optional)... | [
"def",
"hex2bin",
"(",
"fin",
",",
"fout",
",",
"start",
"=",
"None",
",",
"end",
"=",
"None",
",",
"size",
"=",
"None",
",",
"pad",
"=",
"0xFF",
")",
":",
"try",
":",
"h",
"=",
"IntelHex",
"(",
"fin",
")",
"except",
"HexReaderError",
",",
"e",
... | https://github.com/travisgoodspeed/goodfet/blob/1750cc1e8588af5470385e52fa098ca7364c2863/client/intelhex.py#L837-L872 | |
CouchPotato/CouchPotatoV1 | 135b3331d1b88ef645e29b76f2d4cc4a732c9232 | library/imdb/parser/sql/alchemyadapter.py | python | TableAdapter.select | (self, conditions=None) | return ResultAdapter(result, self.table, colMap=self.colMap) | Return a list of results. | Return a list of results. | [
"Return",
"a",
"list",
"of",
"results",
"."
] | def select(self, conditions=None):
"""Return a list of results."""
result = self._ta_select(conditions).execute()
return ResultAdapter(result, self.table, colMap=self.colMap) | [
"def",
"select",
"(",
"self",
",",
"conditions",
"=",
"None",
")",
":",
"result",
"=",
"self",
".",
"_ta_select",
"(",
"conditions",
")",
".",
"execute",
"(",
")",
"return",
"ResultAdapter",
"(",
"result",
",",
"self",
".",
"table",
",",
"colMap",
"=",... | https://github.com/CouchPotato/CouchPotatoV1/blob/135b3331d1b88ef645e29b76f2d4cc4a732c9232/library/imdb/parser/sql/alchemyadapter.py#L281-L284 | |
django/django | 0a17666045de6739ae1c2ac695041823d5f827f7 | django/contrib/auth/base_user.py | python | AbstractBaseUser.is_anonymous | (self) | return False | Always return False. This is a way of comparing User objects to
anonymous users. | Always return False. This is a way of comparing User objects to
anonymous users. | [
"Always",
"return",
"False",
".",
"This",
"is",
"a",
"way",
"of",
"comparing",
"User",
"objects",
"to",
"anonymous",
"users",
"."
] | def is_anonymous(self):
"""
Always return False. This is a way of comparing User objects to
anonymous users.
"""
return False | [
"def",
"is_anonymous",
"(",
"self",
")",
":",
"return",
"False"
] | https://github.com/django/django/blob/0a17666045de6739ae1c2ac695041823d5f827f7/django/contrib/auth/base_user.py#L82-L87 | |
Chaffelson/nipyapi | d3b186fd701ce308c2812746d98af9120955e810 | nipyapi/nifi/models/versioned_flow.py | python | VersionedFlow.version_count | (self, version_count) | Sets the version_count of this VersionedFlow.
The number of versions of this flow.
:param version_count: The version_count of this VersionedFlow.
:type: int | Sets the version_count of this VersionedFlow.
The number of versions of this flow. | [
"Sets",
"the",
"version_count",
"of",
"this",
"VersionedFlow",
".",
"The",
"number",
"of",
"versions",
"of",
"this",
"flow",
"."
] | def version_count(self, version_count):
"""
Sets the version_count of this VersionedFlow.
The number of versions of this flow.
:param version_count: The version_count of this VersionedFlow.
:type: int
"""
if version_count is not None and version_count < 0:
... | [
"def",
"version_count",
"(",
"self",
",",
"version_count",
")",
":",
"if",
"version_count",
"is",
"not",
"None",
"and",
"version_count",
"<",
"0",
":",
"raise",
"ValueError",
"(",
"\"Invalid value for `version_count`, must be a value greater than or equal to `0`\"",
")",
... | https://github.com/Chaffelson/nipyapi/blob/d3b186fd701ce308c2812746d98af9120955e810/nipyapi/nifi/models/versioned_flow.py#L361-L372 | ||
taowen/es-monitor | c4deceb4964857f495d13bfaf2d92f36734c9e1c | es_sql/executors/select_from_leaf_executor.py | python | SelectFromLeafExecutor.select_response | (self, response) | return rows | [] | def select_response(self, response):
rows = []
for input in response['hits']['hits']:
row = {}
for selector in self.selectors:
selector(input, row)
rows.append(row)
return rows | [
"def",
"select_response",
"(",
"self",
",",
"response",
")",
":",
"rows",
"=",
"[",
"]",
"for",
"input",
"in",
"response",
"[",
"'hits'",
"]",
"[",
"'hits'",
"]",
":",
"row",
"=",
"{",
"}",
"for",
"selector",
"in",
"self",
".",
"selectors",
":",
"s... | https://github.com/taowen/es-monitor/blob/c4deceb4964857f495d13bfaf2d92f36734c9e1c/es_sql/executors/select_from_leaf_executor.py#L58-L65 | |||
andreikop/enki | 3170059e5cb46dcc77d7fb1457c38a8a5f13af66 | enki/core/locator.py | python | _CompleterLoaderThread.terminate | (self) | Set termination flag
Works in the GUI thread | Set termination flag
Works in the GUI thread | [
"Set",
"termination",
"flag",
"Works",
"in",
"the",
"GUI",
"thread"
] | def terminate(self):
"""Set termination flag
Works in the GUI thread
"""
if self.is_alive():
self._stopEvent.set()
self._taskQueue.put(None)
self._checkResultQueueTimer.stop()
self.join() | [
"def",
"terminate",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_alive",
"(",
")",
":",
"self",
".",
"_stopEvent",
".",
"set",
"(",
")",
"self",
".",
"_taskQueue",
".",
"put",
"(",
"None",
")",
"self",
".",
"_checkResultQueueTimer",
".",
"stop",
"("... | https://github.com/andreikop/enki/blob/3170059e5cb46dcc77d7fb1457c38a8a5f13af66/enki/core/locator.py#L521-L529 | ||
Pymol-Scripts/Pymol-script-repo | bcd7bb7812dc6db1595953dfa4471fa15fb68c77 | modules/pdb2pqr/contrib/numpy-1.1.0/numpy/oldnumeric/ma.py | python | inner | (a, b) | return masked_array(numeric.inner(fa, fb)) | inner(a,b) returns the dot product of two arrays, which has
shape a.shape[:-1] + b.shape[:-1] with elements computed by summing the
product of the elements from the last dimensions of a and b.
Masked elements are replace by zeros. | inner(a,b) returns the dot product of two arrays, which has
shape a.shape[:-1] + b.shape[:-1] with elements computed by summing the
product of the elements from the last dimensions of a and b.
Masked elements are replace by zeros. | [
"inner",
"(",
"a",
"b",
")",
"returns",
"the",
"dot",
"product",
"of",
"two",
"arrays",
"which",
"has",
"shape",
"a",
".",
"shape",
"[",
":",
"-",
"1",
"]",
"+",
"b",
".",
"shape",
"[",
":",
"-",
"1",
"]",
"with",
"elements",
"computed",
"by",
... | def inner(a, b):
"""inner(a,b) returns the dot product of two arrays, which has
shape a.shape[:-1] + b.shape[:-1] with elements computed by summing the
product of the elements from the last dimensions of a and b.
Masked elements are replace by zeros.
"""
fa = filled(a, 0)
fb = filled(b, 0)
... | [
"def",
"inner",
"(",
"a",
",",
"b",
")",
":",
"fa",
"=",
"filled",
"(",
"a",
",",
"0",
")",
"fb",
"=",
"filled",
"(",
"b",
",",
"0",
")",
"if",
"len",
"(",
"fa",
".",
"shape",
")",
"==",
"0",
":",
"fa",
".",
"shape",
"=",
"(",
"1",
",",... | https://github.com/Pymol-Scripts/Pymol-script-repo/blob/bcd7bb7812dc6db1595953dfa4471fa15fb68c77/modules/pdb2pqr/contrib/numpy-1.1.0/numpy/oldnumeric/ma.py#L1901-L1911 | |
orbingol/NURBS-Python | 8ae8b127eb0b130a25a6c81e98e90f319733bca0 | geomdl/linalg.py | python | lu_decomposition | (matrix_a) | return _linalg.doolittle(matrix_a) | LU-Factorization method using Doolittle's Method for solution of linear systems.
Decomposes the matrix :math:`A` such that :math:`A = LU`.
The input matrix is represented by a list or a tuple. The input matrix is **2-dimensional**, i.e. list of lists of
integers and/or floats.
:param matrix_a: Input ... | LU-Factorization method using Doolittle's Method for solution of linear systems. | [
"LU",
"-",
"Factorization",
"method",
"using",
"Doolittle",
"s",
"Method",
"for",
"solution",
"of",
"linear",
"systems",
"."
] | def lu_decomposition(matrix_a):
""" LU-Factorization method using Doolittle's Method for solution of linear systems.
Decomposes the matrix :math:`A` such that :math:`A = LU`.
The input matrix is represented by a list or a tuple. The input matrix is **2-dimensional**, i.e. list of lists of
integers and... | [
"def",
"lu_decomposition",
"(",
"matrix_a",
")",
":",
"# Check if the 2-dimensional input matrix is a square matrix",
"q",
"=",
"len",
"(",
"matrix_a",
")",
"for",
"idx",
",",
"m_a",
"in",
"enumerate",
"(",
"matrix_a",
")",
":",
"if",
"len",
"(",
"m_a",
")",
"... | https://github.com/orbingol/NURBS-Python/blob/8ae8b127eb0b130a25a6c81e98e90f319733bca0/geomdl/linalg.py#L555-L576 | |
WerWolv/EdiZon_CheatsConfigsAndScripts | d16d36c7509c01dca770f402babd83ff2e9ae6e7 | Scripts/lib/python3.5/_pydecimal.py | python | Context.compare_total | (self, a, b) | return a.compare_total(b) | Compares two operands using their abstract representation.
This is not like the standard compare, which use their numerical
value. Note that a total ordering is defined for all possible abstract
representations.
>>> ExtendedContext.compare_total(Decimal('12.73'), Decimal('127.9'))
... | Compares two operands using their abstract representation. | [
"Compares",
"two",
"operands",
"using",
"their",
"abstract",
"representation",
"."
] | def compare_total(self, a, b):
"""Compares two operands using their abstract representation.
This is not like the standard compare, which use their numerical
value. Note that a total ordering is defined for all possible abstract
representations.
>>> ExtendedContext.compare_tota... | [
"def",
"compare_total",
"(",
"self",
",",
"a",
",",
"b",
")",
":",
"a",
"=",
"_convert_other",
"(",
"a",
",",
"raiseit",
"=",
"True",
")",
"return",
"a",
".",
"compare_total",
"(",
"b",
")"
] | https://github.com/WerWolv/EdiZon_CheatsConfigsAndScripts/blob/d16d36c7509c01dca770f402babd83ff2e9ae6e7/Scripts/lib/python3.5/_pydecimal.py#L4245-L4272 | |
aws-samples/aws-kube-codesuite | ab4e5ce45416b83bffb947ab8d234df5437f4fca | src/dateutil/tz/_common.py | python | tzrangebase.is_ambiguous | (self, dt) | return (end <= dt < end + self._dst_base_offset) | Whether or not the "wall time" of a given datetime is ambiguous in this
zone.
:param dt:
A :py:class:`datetime.datetime`, naive or time zone aware.
:return:
Returns ``True`` if ambiguous, ``False`` otherwise.
.. versionadded:: 2.6.0 | Whether or not the "wall time" of a given datetime is ambiguous in this
zone. | [
"Whether",
"or",
"not",
"the",
"wall",
"time",
"of",
"a",
"given",
"datetime",
"is",
"ambiguous",
"in",
"this",
"zone",
"."
] | def is_ambiguous(self, dt):
"""
Whether or not the "wall time" of a given datetime is ambiguous in this
zone.
:param dt:
A :py:class:`datetime.datetime`, naive or time zone aware.
:return:
Returns ``True`` if ambiguous, ``False`` otherwise.
.. ... | [
"def",
"is_ambiguous",
"(",
"self",
",",
"dt",
")",
":",
"if",
"not",
"self",
".",
"hasdst",
":",
"return",
"False",
"start",
",",
"end",
"=",
"self",
".",
"transitions",
"(",
"dt",
".",
"year",
")",
"dt",
"=",
"dt",
".",
"replace",
"(",
"tzinfo",
... | https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/dateutil/tz/_common.py#L318-L338 | |
keon/algorithms | 23d4e85a506eaeaff315e855be12f8dbe47a7ec3 | algorithms/arrays/delete_nth.py | python | delete_nth_naive | (array, n) | return ans | [] | def delete_nth_naive(array, n):
ans = []
for num in array:
if ans.count(num) < n:
ans.append(num)
return ans | [
"def",
"delete_nth_naive",
"(",
"array",
",",
"n",
")",
":",
"ans",
"=",
"[",
"]",
"for",
"num",
"in",
"array",
":",
"if",
"ans",
".",
"count",
"(",
"num",
")",
"<",
"n",
":",
"ans",
".",
"append",
"(",
"num",
")",
"return",
"ans"
] | https://github.com/keon/algorithms/blob/23d4e85a506eaeaff315e855be12f8dbe47a7ec3/algorithms/arrays/delete_nth.py#L13-L18 | |||
pyqt/examples | 843bb982917cecb2350b5f6d7f42c9b7fb142ec1 | src/pyqt-official/itemviews/editabletreemodel/editabletreemodel.py | python | TreeItem.removeChildren | (self, position, count) | return True | [] | def removeChildren(self, position, count):
if position < 0 or position + count > len(self.childItems):
return False
for row in range(count):
self.childItems.pop(position)
return True | [
"def",
"removeChildren",
"(",
"self",
",",
"position",
",",
"count",
")",
":",
"if",
"position",
"<",
"0",
"or",
"position",
"+",
"count",
">",
"len",
"(",
"self",
".",
"childItems",
")",
":",
"return",
"False",
"for",
"row",
"in",
"range",
"(",
"cou... | https://github.com/pyqt/examples/blob/843bb982917cecb2350b5f6d7f42c9b7fb142ec1/src/pyqt-official/itemviews/editabletreemodel/editabletreemodel.py#L102-L109 | |||
googleapis/google-auth-library-python | 87cd2455aca96ac3fbc4a8b2f8e4c0bba568a70b | google/auth/jwt.py | python | _verify_iat_and_exp | (payload, clock_skew_in_seconds=0) | Verifies the ``iat`` (Issued At) and ``exp`` (Expires) claims in a token
payload.
Args:
payload (Mapping[str, str]): The JWT payload.
clock_skew_in_seconds (int): The clock skew used for `iat` and `exp`
validation.
Raises:
ValueError: if any checks failed. | Verifies the ``iat`` (Issued At) and ``exp`` (Expires) claims in a token
payload. | [
"Verifies",
"the",
"iat",
"(",
"Issued",
"At",
")",
"and",
"exp",
"(",
"Expires",
")",
"claims",
"in",
"a",
"token",
"payload",
"."
] | def _verify_iat_and_exp(payload, clock_skew_in_seconds=0):
"""Verifies the ``iat`` (Issued At) and ``exp`` (Expires) claims in a token
payload.
Args:
payload (Mapping[str, str]): The JWT payload.
clock_skew_in_seconds (int): The clock skew used for `iat` and `exp`
validation.
... | [
"def",
"_verify_iat_and_exp",
"(",
"payload",
",",
"clock_skew_in_seconds",
"=",
"0",
")",
":",
"now",
"=",
"_helpers",
".",
"datetime_to_secs",
"(",
"_helpers",
".",
"utcnow",
"(",
")",
")",
"# Make sure the iat and exp claims are present.",
"for",
"key",
"in",
"... | https://github.com/googleapis/google-auth-library-python/blob/87cd2455aca96ac3fbc4a8b2f8e4c0bba568a70b/google/auth/jwt.py#L175-L212 | ||
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/ex-submodules/dimagi/utils/read_only.py | python | ReadOnlyObject.__getitem__ | (self, item) | return self._obj[item] | [] | def __getitem__(self, item):
return self._obj[item] | [
"def",
"__getitem__",
"(",
"self",
",",
"item",
")",
":",
"return",
"self",
".",
"_obj",
"[",
"item",
"]"
] | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/ex-submodules/dimagi/utils/read_only.py#L9-L10 | |||
pyparallel/pyparallel | 11e8c6072d48c8f13641925d17b147bf36ee0ba3 | Lib/lib2to3/pytree.py | python | LeafPattern._submatch | (self, node, results=None) | return self.content == node.value | Match the pattern's content to the node's children.
This assumes the node type matches and self.content is not None.
Returns True if it matches, False if not.
If results is not None, it must be a dict which will be
updated with the nodes matching named subpatterns.
When retur... | Match the pattern's content to the node's children. | [
"Match",
"the",
"pattern",
"s",
"content",
"to",
"the",
"node",
"s",
"children",
"."
] | def _submatch(self, node, results=None):
"""
Match the pattern's content to the node's children.
This assumes the node type matches and self.content is not None.
Returns True if it matches, False if not.
If results is not None, it must be a dict which will be
updated w... | [
"def",
"_submatch",
"(",
"self",
",",
"node",
",",
"results",
"=",
"None",
")",
":",
"return",
"self",
".",
"content",
"==",
"node",
".",
"value"
] | https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/lib2to3/pytree.py#L542-L555 | |
explosion/spaCy | a784b12eff48df9281b184cb7005e66bbd2e3aca | spacy/language.py | python | _Sender.step | (self) | Tell sender that comsumed one item. Data is sent to the workers after
every chunk_size calls. | Tell sender that comsumed one item. Data is sent to the workers after
every chunk_size calls. | [
"Tell",
"sender",
"that",
"comsumed",
"one",
"item",
".",
"Data",
"is",
"sent",
"to",
"the",
"workers",
"after",
"every",
"chunk_size",
"calls",
"."
] | def step(self) -> None:
"""Tell sender that comsumed one item. Data is sent to the workers after
every chunk_size calls.
"""
self.count += 1
if self.count >= self.chunk_size:
self.count = 0
self.send() | [
"def",
"step",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"count",
"+=",
"1",
"if",
"self",
".",
"count",
">=",
"self",
".",
"chunk_size",
":",
"self",
".",
"count",
"=",
"0",
"self",
".",
"send",
"(",
")"
] | https://github.com/explosion/spaCy/blob/a784b12eff48df9281b184cb7005e66bbd2e3aca/spacy/language.py#L2213-L2220 | ||
Pymol-Scripts/Pymol-script-repo | bcd7bb7812dc6db1595953dfa4471fa15fb68c77 | tmalign.py | python | mmalign | (mobile, target, args='', exe='MMalign', ter=0, transform=1, quiet=0) | return tmalign(mobile, target, args, exe, ter, transform, quiet=quiet) | DESCRIPTION
MMalign wrapper
Reference: S. Mukherjee and Y. Zhang, Nucleic Acids Research 2009; 37: e83
http://zhanglab.ccmb.med.umich.edu/MM-align/
SEE ALSO
tmalign, tmscore | DESCRIPTION | [
"DESCRIPTION"
] | def mmalign(mobile, target, args='', exe='MMalign', ter=0, transform=1, quiet=0):
'''
DESCRIPTION
MMalign wrapper
Reference: S. Mukherjee and Y. Zhang, Nucleic Acids Research 2009; 37: e83
http://zhanglab.ccmb.med.umich.edu/MM-align/
SEE ALSO
tmalign, tmscore
'''
return tmalign(mobile, t... | [
"def",
"mmalign",
"(",
"mobile",
",",
"target",
",",
"args",
"=",
"''",
",",
"exe",
"=",
"'MMalign'",
",",
"ter",
"=",
"0",
",",
"transform",
"=",
"1",
",",
"quiet",
"=",
"0",
")",
":",
"return",
"tmalign",
"(",
"mobile",
",",
"target",
",",
"arg... | https://github.com/Pymol-Scripts/Pymol-script-repo/blob/bcd7bb7812dc6db1595953dfa4471fa15fb68c77/tmalign.py#L232-L245 | |
prompt-toolkit/python-prompt-toolkit | e9eac2eb59ec385e81742fa2ac623d4b8de00925 | prompt_toolkit/formatted_text/base.py | python | to_formatted_text | (
value: AnyFormattedText, style: str = "", auto_convert: bool = False
) | Convert the given value (which can be formatted text) into a list of text
fragments. (Which is the canonical form of formatted text.) The outcome is
always a `FormattedText` instance, which is a list of (style, text) tuples.
It can take a plain text string, an `HTML` or `ANSI` object, anything that
imp... | Convert the given value (which can be formatted text) into a list of text
fragments. (Which is the canonical form of formatted text.) The outcome is
always a `FormattedText` instance, which is a list of (style, text) tuples. | [
"Convert",
"the",
"given",
"value",
"(",
"which",
"can",
"be",
"formatted",
"text",
")",
"into",
"a",
"list",
"of",
"text",
"fragments",
".",
"(",
"Which",
"is",
"the",
"canonical",
"form",
"of",
"formatted",
"text",
".",
")",
"The",
"outcome",
"is",
"... | def to_formatted_text(
value: AnyFormattedText, style: str = "", auto_convert: bool = False
) -> "FormattedText":
"""
Convert the given value (which can be formatted text) into a list of text
fragments. (Which is the canonical form of formatted text.) The outcome is
always a `FormattedText` instance... | [
"def",
"to_formatted_text",
"(",
"value",
":",
"AnyFormattedText",
",",
"style",
":",
"str",
"=",
"\"\"",
",",
"auto_convert",
":",
"bool",
"=",
"False",
")",
"->",
"\"FormattedText\"",
":",
"result",
":",
"Union",
"[",
"FormattedText",
",",
"StyleAndTextTuple... | https://github.com/prompt-toolkit/python-prompt-toolkit/blob/e9eac2eb59ec385e81742fa2ac623d4b8de00925/prompt_toolkit/formatted_text/base.py#L51-L101 | ||
CalebBell/thermo | 572a47d1b03d49fe609b8d5f826fa6a7cde00828 | thermo/phases/phase.py | python | Phase.d2V_dPdT | (self) | return -(d2P_dTdV*dP_dV - dP_dT*d2P_dV2)*inverse_dP_dV3 | r'''Method to calculate and return the derivative of pressure and then
the derivative of temperature of volume of the phase.
.. math::
\left(\frac{\partial^2 V}{\partial T\partial P}\right) =
- \left[\left(\frac{\partial^2 P}{\partial T \partial V}\right)
\left(\frac... | r'''Method to calculate and return the derivative of pressure and then
the derivative of temperature of volume of the phase. | [
"r",
"Method",
"to",
"calculate",
"and",
"return",
"the",
"derivative",
"of",
"pressure",
"and",
"then",
"the",
"derivative",
"of",
"temperature",
"of",
"volume",
"of",
"the",
"phase",
"."
] | def d2V_dPdT(self):
r'''Method to calculate and return the derivative of pressure and then
the derivative of temperature of volume of the phase.
.. math::
\left(\frac{\partial^2 V}{\partial T\partial P}\right) =
- \left[\left(\frac{\partial^2 P}{\partial T \partial V}\ri... | [
"def",
"d2V_dPdT",
"(",
"self",
")",
":",
"dP_dT",
"=",
"self",
".",
"dP_dT",
"(",
")",
"dP_dV",
"=",
"self",
".",
"dP_dV",
"(",
")",
"d2P_dTdV",
"=",
"self",
".",
"d2P_dTdV",
"(",
")",
"d2P_dV2",
"=",
"self",
".",
"d2P_dV2",
"(",
")",
"inverse_dP_... | https://github.com/CalebBell/thermo/blob/572a47d1b03d49fe609b8d5f826fa6a7cde00828/thermo/phases/phase.py#L2450-L2480 | |
cedrickchee/capsule-net-pytorch | 7707ea0c3faaf6dded753d7c16641617a9954d9a | utils.py | python | load_data | (args) | Load dataset. | Load dataset. | [
"Load",
"dataset",
"."
] | def load_data(args):
"""
Load dataset.
"""
dst = args.dataset
if dst == 'mnist':
return load_mnist(args)
elif dst == 'cifar10':
return load_cifar10(args)
else:
raise Exception('Invalid dataset, please check the name of dataset:', dst) | [
"def",
"load_data",
"(",
"args",
")",
":",
"dst",
"=",
"args",
".",
"dataset",
"if",
"dst",
"==",
"'mnist'",
":",
"return",
"load_mnist",
"(",
"args",
")",
"elif",
"dst",
"==",
"'cifar10'",
":",
"return",
"load_cifar10",
"(",
"args",
")",
"else",
":",
... | https://github.com/cedrickchee/capsule-net-pytorch/blob/7707ea0c3faaf6dded753d7c16641617a9954d9a/utils.py#L97-L108 | ||
yt-project/yt | dc7b24f9b266703db4c843e329c6c8644d47b824 | yt/visualization/volume_rendering/lens.py | python | FisheyeLens._get_sampler_params | (self, camera, render_source) | return sampler_params | [] | def _get_sampler_params(self, camera, render_source):
vp = -arr_fisheye_vectors(camera.resolution[0], self.fov)
vp.shape = (camera.resolution[0], camera.resolution[0], 3)
vp = vp.dot(np.linalg.inv(self.rotation_matrix))
vp *= self.radius
uv = np.ones(3, dtype="float64")
p... | [
"def",
"_get_sampler_params",
"(",
"self",
",",
"camera",
",",
"render_source",
")",
":",
"vp",
"=",
"-",
"arr_fisheye_vectors",
"(",
"camera",
".",
"resolution",
"[",
"0",
"]",
",",
"self",
".",
"fov",
")",
"vp",
".",
"shape",
"=",
"(",
"camera",
".",... | https://github.com/yt-project/yt/blob/dc7b24f9b266703db4c843e329c6c8644d47b824/yt/visualization/volume_rendering/lens.py#L554-L582 | |||
HunterMcGushion/hyperparameter_hunter | 28b1d48e01a993818510811b82a677e0a7a232b2 | hyperparameter_hunter/i_o/reporting.py | python | ReportingHandler.warn | (self, content, **kwargs) | Placeholder method before proper initialization | Placeholder method before proper initialization | [
"Placeholder",
"method",
"before",
"proper",
"initialization"
] | def warn(self, content, **kwargs):
"""Placeholder method before proper initialization""" | [
"def",
"warn",
"(",
"self",
",",
"content",
",",
"*",
"*",
"kwargs",
")",
":"
] | https://github.com/HunterMcGushion/hyperparameter_hunter/blob/28b1d48e01a993818510811b82a677e0a7a232b2/hyperparameter_hunter/i_o/reporting.py#L208-L209 | ||
golismero/golismero | 7d605b937e241f51c1ca4f47b20f755eeefb9d76 | thirdparty_libs/requests/packages/charade/chardistribution.py | python | CharDistributionAnalysis.feed | (self, aBuf, aCharLen) | feed a character with known length | feed a character with known length | [
"feed",
"a",
"character",
"with",
"known",
"length"
] | def feed(self, aBuf, aCharLen):
"""feed a character with known length"""
if aCharLen == 2:
# we only care about 2-bytes character in our distribution analysis
order = self.get_order(aBuf)
else:
order = -1
if order >= 0:
self._mTotalChars +=... | [
"def",
"feed",
"(",
"self",
",",
"aBuf",
",",
"aCharLen",
")",
":",
"if",
"aCharLen",
"==",
"2",
":",
"# we only care about 2-bytes character in our distribution analysis",
"order",
"=",
"self",
".",
"get_order",
"(",
"aBuf",
")",
"else",
":",
"order",
"=",
"-... | https://github.com/golismero/golismero/blob/7d605b937e241f51c1ca4f47b20f755eeefb9d76/thirdparty_libs/requests/packages/charade/chardistribution.py#L68-L80 | ||
aws-samples/aws-kube-codesuite | ab4e5ce45416b83bffb947ab8d234df5437f4fca | src/kubernetes/client/models/v1_node_status.py | python | V1NodeStatus.images | (self) | return self._images | Gets the images of this V1NodeStatus.
List of container images on this node
:return: The images of this V1NodeStatus.
:rtype: list[V1ContainerImage] | Gets the images of this V1NodeStatus.
List of container images on this node | [
"Gets",
"the",
"images",
"of",
"this",
"V1NodeStatus",
".",
"List",
"of",
"container",
"images",
"on",
"this",
"node"
] | def images(self):
"""
Gets the images of this V1NodeStatus.
List of container images on this node
:return: The images of this V1NodeStatus.
:rtype: list[V1ContainerImage]
"""
return self._images | [
"def",
"images",
"(",
"self",
")",
":",
"return",
"self",
".",
"_images"
] | https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/kubernetes/client/models/v1_node_status.py#L186-L194 | |
facebookresearch/nevergrad | c1e83e279d5e16ff7ce6c82854425ec3fd17e981 | nevergrad/benchmark/experiments.py | python | parahdbo4d | (seed: tp.Optional[int] = None) | All Bayesian optimization methods on various functions. Parallel version
Dimension 20 and 2000.
Budget 25, 31, 37, 43, 50, 60.
Sphere, Cigar, Hm, Ellipsoid.
No rotation. | All Bayesian optimization methods on various functions. Parallel version
Dimension 20 and 2000.
Budget 25, 31, 37, 43, 50, 60.
Sphere, Cigar, Hm, Ellipsoid.
No rotation. | [
"All",
"Bayesian",
"optimization",
"methods",
"on",
"various",
"functions",
".",
"Parallel",
"version",
"Dimension",
"20",
"and",
"2000",
".",
"Budget",
"25",
"31",
"37",
"43",
"50",
"60",
".",
"Sphere",
"Cigar",
"Hm",
"Ellipsoid",
".",
"No",
"rotation",
"... | def parahdbo4d(seed: tp.Optional[int] = None) -> tp.Iterator[Experiment]:
"""All Bayesian optimization methods on various functions. Parallel version
Dimension 20 and 2000.
Budget 25, 31, 37, 43, 50, 60.
Sphere, Cigar, Hm, Ellipsoid.
No rotation.
"""
seedg = create_seed_generator(seed)
f... | [
"def",
"parahdbo4d",
"(",
"seed",
":",
"tp",
".",
"Optional",
"[",
"int",
"]",
"=",
"None",
")",
"->",
"tp",
".",
"Iterator",
"[",
"Experiment",
"]",
":",
"seedg",
"=",
"create_seed_generator",
"(",
"seed",
")",
"for",
"budget",
"in",
"[",
"25",
",",... | https://github.com/facebookresearch/nevergrad/blob/c1e83e279d5e16ff7ce6c82854425ec3fd17e981/nevergrad/benchmark/experiments.py#L1002-L1029 | ||
HITFRobot/happy-spiders | df30bc43f2b99ff70c380bbadeec4bcc285d481b | scrapy_templates/14-sports/soccer/soccer/spiders/middlewares/proxyMiddleware.py | python | proxyMiddleware.fecth_new_proxy | (self) | 获取新的代理,目前从两个网站抓取代理,每个网站开一个线程抓取代理,后续增加 | 获取新的代理,目前从两个网站抓取代理,每个网站开一个线程抓取代理,后续增加 | [
"获取新的代理,目前从两个网站抓取代理,每个网站开一个线程抓取代理,后续增加"
] | def fecth_new_proxy(self):
"""
获取新的代理,目前从两个网站抓取代理,每个网站开一个线程抓取代理,后续增加
"""
logger.debug('开始爬取代理')
urls = ['xici', 'ip3336']
threads = []
for url in urls:
t = getProxy(self.proxyes, url)
threads.append(t)
t.start()
for t in... | [
"def",
"fecth_new_proxy",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"'开始爬取代理')",
"",
"urls",
"=",
"[",
"'xici'",
",",
"'ip3336'",
"]",
"threads",
"=",
"[",
"]",
"for",
"url",
"in",
"urls",
":",
"t",
"=",
"getProxy",
"(",
"self",
".",
"pro... | https://github.com/HITFRobot/happy-spiders/blob/df30bc43f2b99ff70c380bbadeec4bcc285d481b/scrapy_templates/14-sports/soccer/soccer/spiders/middlewares/proxyMiddleware.py#L204-L216 | ||
automl/Auto-PyTorch | 06e67de5017b4cccad9398e24a3d9f0bd8176da3 | autoPyTorch/pipeline/components/setup/network_embedding/__init__.py | python | NetworkEmbeddingChoice.get_available_components | (
self,
dataset_properties: Optional[Dict[str, BaseDatasetPropertiesType]] = None,
include: List[str] = None,
exclude: List[str] = None,
) | return components_dict | Filters out components based on user provided
include/exclude directives, as well as the dataset properties
Args:
include (Optional[Dict[str, Any]]): what hyper-parameter configurations
to honor when creating the configuration space
exclude (Optional[Dict[str, Any]]): what... | Filters out components based on user provided
include/exclude directives, as well as the dataset properties | [
"Filters",
"out",
"components",
"based",
"on",
"user",
"provided",
"include",
"/",
"exclude",
"directives",
"as",
"well",
"as",
"the",
"dataset",
"properties"
] | def get_available_components(
self,
dataset_properties: Optional[Dict[str, BaseDatasetPropertiesType]] = None,
include: List[str] = None,
exclude: List[str] = None,
) -> Dict[str, autoPyTorchComponent]:
"""Filters out components based on user provided
include/exclude ... | [
"def",
"get_available_components",
"(",
"self",
",",
"dataset_properties",
":",
"Optional",
"[",
"Dict",
"[",
"str",
",",
"BaseDatasetPropertiesType",
"]",
"]",
"=",
"None",
",",
"include",
":",
"List",
"[",
"str",
"]",
"=",
"None",
",",
"exclude",
":",
"L... | https://github.com/automl/Auto-PyTorch/blob/06e67de5017b4cccad9398e24a3d9f0bd8176da3/autoPyTorch/pipeline/components/setup/network_embedding/__init__.py#L49-L110 | |
rbonghi/jetson_stats | 628b07d935a2d980eac158c242812a0510e4efb8 | jtop/jtop.py | python | jtop.restore | (self, max_counter=10) | This block method will restore all jtop configuration, in order:
* **switch off** jetson_clocks
* **Disable** jetson_clocks on boot
* **fan**
* set to **default**, please follow the fan reference :func:`~jtop.jtop.jtop.fan`
* set fan speed to 0 (This operation can requir... | This block method will restore all jtop configuration, in order: | [
"This",
"block",
"method",
"will",
"restore",
"all",
"jtop",
"configuration",
"in",
"order",
":"
] | def restore(self, max_counter=10):
"""
This block method will restore all jtop configuration, in order:
* **switch off** jetson_clocks
* **Disable** jetson_clocks on boot
* **fan**
* set to **default**, please follow the fan reference :func:`~jtop.jtop.jtop.fan`
... | [
"def",
"restore",
"(",
"self",
",",
"max_counter",
"=",
"10",
")",
":",
"# Reset jetson_clocks",
"if",
"self",
".",
"jetson_clocks",
"is",
"not",
"None",
":",
"# Disable jetson_clocks",
"self",
".",
"jetson_clocks",
"=",
"False",
"# Wait jetson_clocks boot",
"coun... | https://github.com/rbonghi/jetson_stats/blob/628b07d935a2d980eac158c242812a0510e4efb8/jtop/jtop.py#L199-L276 | ||
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/enocean/dongle.py | python | EnOceanDongle.async_setup | (self) | Finish the setup of the bridge and supported platforms. | Finish the setup of the bridge and supported platforms. | [
"Finish",
"the",
"setup",
"of",
"the",
"bridge",
"and",
"supported",
"platforms",
"."
] | async def async_setup(self):
"""Finish the setup of the bridge and supported platforms."""
self._communicator.start()
self.dispatcher_disconnect_handle = async_dispatcher_connect(
self.hass, SIGNAL_SEND_MESSAGE, self._send_message_callback
) | [
"async",
"def",
"async_setup",
"(",
"self",
")",
":",
"self",
".",
"_communicator",
".",
"start",
"(",
")",
"self",
".",
"dispatcher_disconnect_handle",
"=",
"async_dispatcher_connect",
"(",
"self",
".",
"hass",
",",
"SIGNAL_SEND_MESSAGE",
",",
"self",
".",
"_... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/enocean/dongle.py#L35-L40 | ||
spywhere/Javatar | e273ec40c209658247a71b109bb90cd126984a29 | core/logger.py | python | _Logger.none | (self, message) | Print a message | Print a message | [
"Print",
"a",
"message"
] | def none(self, message):
"""
Print a message
"""
print("%s" % (str(message))) | [
"def",
"none",
"(",
"self",
",",
"message",
")",
":",
"print",
"(",
"\"%s\"",
"%",
"(",
"str",
"(",
"message",
")",
")",
")"
] | https://github.com/spywhere/Javatar/blob/e273ec40c209658247a71b109bb90cd126984a29/core/logger.py#L30-L34 | ||
golismero/golismero | 7d605b937e241f51c1ca4f47b20f755eeefb9d76 | golismero/api/data/information/dns.py | python | DnsRegisterAFSDB.hostname | (self) | return self.__hostname | :return: the hostname value
:rtype: str | :return: the hostname value
:rtype: str | [
":",
"return",
":",
"the",
"hostname",
"value",
":",
"rtype",
":",
"str"
] | def hostname(self):
"""
:return: the hostname value
:rtype: str
"""
return self.__hostname | [
"def",
"hostname",
"(",
"self",
")",
":",
"return",
"self",
".",
"__hostname"
] | https://github.com/golismero/golismero/blob/7d605b937e241f51c1ca4f47b20f755eeefb9d76/golismero/api/data/information/dns.py#L549-L554 | |
spyder-ide/spyder | 55da47c032dfcf519600f67f8b30eab467f965e7 | spyder/plugins/completion/providers/kite/widgets/status.py | python | KiteStatusWidget.set_value | (self, value) | Return Kite completions state. | Return Kite completions state. | [
"Return",
"Kite",
"completions",
"state",
"."
] | def set_value(self, value):
"""Return Kite completions state."""
kite_enabled = self.provider.get_conf(('enabled_providers', 'kite'),
default=True,
section='completions')
is_installing = self.is_installin... | [
"def",
"set_value",
"(",
"self",
",",
"value",
")",
":",
"kite_enabled",
"=",
"self",
".",
"provider",
".",
"get_conf",
"(",
"(",
"'enabled_providers'",
",",
"'kite'",
")",
",",
"default",
"=",
"True",
",",
"section",
"=",
"'completions'",
")",
"is_install... | https://github.com/spyder-ide/spyder/blob/55da47c032dfcf519600f67f8b30eab467f965e7/spyder/plugins/completion/providers/kite/widgets/status.py#L54-L83 | ||
matplotlib/matplotlib | 8d7a2b9d2a38f01ee0d6802dd4f9e98aec812322 | lib/matplotlib/pyplot.py | python | draw_if_interactive | (*args, **kwargs) | return _backend_mod.draw_if_interactive(*args, **kwargs) | Redraw the current figure if in interactive mode.
.. warning::
End users will typically not have to call this function because the
the interactive mode takes care of this. | Redraw the current figure if in interactive mode. | [
"Redraw",
"the",
"current",
"figure",
"if",
"in",
"interactive",
"mode",
"."
] | def draw_if_interactive(*args, **kwargs):
"""
Redraw the current figure if in interactive mode.
.. warning::
End users will typically not have to call this function because the
the interactive mode takes care of this.
"""
return _backend_mod.draw_if_interactive(*args, **kwargs) | [
"def",
"draw_if_interactive",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_backend_mod",
".",
"draw_if_interactive",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/matplotlib/matplotlib/blob/8d7a2b9d2a38f01ee0d6802dd4f9e98aec812322/lib/matplotlib/pyplot.py#L315-L324 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/whoosh/support/bench.py | python | WhooshModule.finish | (self, merge=True, optimize=False) | [] | def finish(self, merge=True, optimize=False):
self.writer.commit(merge=merge, optimize=optimize) | [
"def",
"finish",
"(",
"self",
",",
"merge",
"=",
"True",
",",
"optimize",
"=",
"False",
")",
":",
"self",
".",
"writer",
".",
"commit",
"(",
"merge",
"=",
"merge",
",",
"optimize",
"=",
"optimize",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/whoosh/support/bench.py#L166-L167 | ||||
projectatomic/atomic | d5f3f19c4f18b24d5ccf47a10d39dbc99af4697a | Atomic/help.py | python | AtomicHelp.man_help | (self, docker_id) | Display the help for a container or image using the default
method of displaying a man formatted page
:param docker_id: docker object to get help for
:return: None | Display the help for a container or image using the default
method of displaying a man formatted page
:param docker_id: docker object to get help for
:return: None | [
"Display",
"the",
"help",
"for",
"a",
"container",
"or",
"image",
"using",
"the",
"default",
"method",
"of",
"displaying",
"a",
"man",
"formatted",
"page",
":",
"param",
"docker_id",
":",
"docker",
"object",
"to",
"get",
"help",
"for",
":",
"return",
":",
... | def man_help(self, docker_id):
"""
Display the help for a container or image using the default
method of displaying a man formatted page
:param docker_id: docker object to get help for
:return: None
"""
mount_location = tempfile.mkdtemp(prefix=self.ATOMIC_DIR)
... | [
"def",
"man_help",
"(",
"self",
",",
"docker_id",
")",
":",
"mount_location",
"=",
"tempfile",
".",
"mkdtemp",
"(",
"prefix",
"=",
"self",
".",
"ATOMIC_DIR",
")",
"try",
":",
"dm",
"=",
"mount",
".",
"DockerMount",
"(",
"mount_location",
")",
"with",
"mo... | https://github.com/projectatomic/atomic/blob/d5f3f19c4f18b24d5ccf47a10d39dbc99af4697a/Atomic/help.py#L85-L125 | ||
ailabx/ailabx | 4a8c701a3604bbc34157167224588041944ac1a2 | codes/qlib-main/examples/benchmarks/TFT/data_formatters/qlib_Alpha158.py | python | Alpha158Formatter.__init__ | (self) | Initialises formatter. | Initialises formatter. | [
"Initialises",
"formatter",
"."
] | def __init__(self):
"""Initialises formatter."""
self.identifiers = None
self._real_scalers = None
self._cat_scalers = None
self._target_scaler = None
self._num_classes_per_cat_input = None | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"identifiers",
"=",
"None",
"self",
".",
"_real_scalers",
"=",
"None",
"self",
".",
"_cat_scalers",
"=",
"None",
"self",
".",
"_target_scaler",
"=",
"None",
"self",
".",
"_num_classes_per_cat_input",
"="... | https://github.com/ailabx/ailabx/blob/4a8c701a3604bbc34157167224588041944ac1a2/codes/qlib-main/examples/benchmarks/TFT/data_formatters/qlib_Alpha158.py#L70-L77 | ||
IronLanguages/ironpython2 | 51fdedeeda15727717fb8268a805f71b06c0b9f1 | Src/StdLib/Lib/sysconfig.py | python | _init_posix | (vars) | Initialize the module as appropriate for POSIX systems. | Initialize the module as appropriate for POSIX systems. | [
"Initialize",
"the",
"module",
"as",
"appropriate",
"for",
"POSIX",
"systems",
"."
] | def _init_posix(vars):
"""Initialize the module as appropriate for POSIX systems."""
# _sysconfigdata is generated at build time, see _generate_posix_vars()
from _sysconfigdata import build_time_vars
vars.update(build_time_vars) | [
"def",
"_init_posix",
"(",
"vars",
")",
":",
"# _sysconfigdata is generated at build time, see _generate_posix_vars()",
"from",
"_sysconfigdata",
"import",
"build_time_vars",
"vars",
".",
"update",
"(",
"build_time_vars",
")"
] | https://github.com/IronLanguages/ironpython2/blob/51fdedeeda15727717fb8268a805f71b06c0b9f1/Src/StdLib/Lib/sysconfig.py#L360-L364 | ||
krintoxi/NoobSec-Toolkit | 38738541cbc03cedb9a3b3ed13b629f781ad64f6 | NoobSecToolkit - MAC OSX/tools/inject/thirdparty/bottle/bottle.py | python | tob | (s, enc='utf8') | return s.encode(enc) if isinstance(s, unicode) else bytes(s) | [] | def tob(s, enc='utf8'):
return s.encode(enc) if isinstance(s, unicode) else bytes(s) | [
"def",
"tob",
"(",
"s",
",",
"enc",
"=",
"'utf8'",
")",
":",
"return",
"s",
".",
"encode",
"(",
"enc",
")",
"if",
"isinstance",
"(",
"s",
",",
"unicode",
")",
"else",
"bytes",
"(",
"s",
")"
] | https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit - MAC OSX/tools/inject/thirdparty/bottle/bottle.py#L112-L113 | |||
evennia/evennia | fa79110ba6b219932f22297838e8ac72ebc0be0e | evennia/contrib/wilderness.py | python | WildernessRoom.at_object_leave | (self, moved_obj, target_location) | Called just before an object leaves from inside this object. This is a
default Evennia hook.
Args:
moved_obj (Object): The object leaving
target_location (Object): Where `moved_obj` is going. | Called just before an object leaves from inside this object. This is a
default Evennia hook. | [
"Called",
"just",
"before",
"an",
"object",
"leaves",
"from",
"inside",
"this",
"object",
".",
"This",
"is",
"a",
"default",
"Evennia",
"hook",
"."
] | def at_object_leave(self, moved_obj, target_location):
"""
Called just before an object leaves from inside this object. This is a
default Evennia hook.
Args:
moved_obj (Object): The object leaving
target_location (Object): Where `moved_obj` is going.
"""... | [
"def",
"at_object_leave",
"(",
"self",
",",
"moved_obj",
",",
"target_location",
")",
":",
"self",
".",
"wilderness",
".",
"at_after_object_leave",
"(",
"moved_obj",
")"
] | https://github.com/evennia/evennia/blob/fa79110ba6b219932f22297838e8ac72ebc0be0e/evennia/contrib/wilderness.py#L544-L554 | ||
cisco/mindmeld | 809c36112e9ea8019fe29d54d136ca14eb4fd8db | mindmeld/models/auto_model.py | python | AutoModel.from_config | (cls, model_config: Union[dict, ModelConfig]) | return model_class(model_config) | Loads a valid model from the specified model configs | Loads a valid model from the specified model configs | [
"Loads",
"a",
"valid",
"model",
"from",
"the",
"specified",
"model",
"configs"
] | def from_config(cls, model_config: Union[dict, ModelConfig]) -> Type[AbstractModel]:
"""
Loads a valid model from the specified model configs
"""
if not (model_config and isinstance(model_config, (ModelConfig, dict))):
msg = f"Need a valid model config to create a text/tagge... | [
"def",
"from_config",
"(",
"cls",
",",
"model_config",
":",
"Union",
"[",
"dict",
",",
"ModelConfig",
"]",
")",
"->",
"Type",
"[",
"AbstractModel",
"]",
":",
"if",
"not",
"(",
"model_config",
"and",
"isinstance",
"(",
"model_config",
",",
"(",
"ModelConfig... | https://github.com/cisco/mindmeld/blob/809c36112e9ea8019fe29d54d136ca14eb4fd8db/mindmeld/models/auto_model.py#L45-L65 | |
danforthcenter/plantcv | aecd599d917884770aa0c7dec15bc9d1c53f36c4 | plantcv/plantcv/photosynthesis/read_cropreporter.py | python | read_cropreporter | (filename) | return fdark, fmin, fmax | Read in, reshape, and subset a datacube of fluorescence snapshots
Inputs:
filename = Fluorescence .DAT filename
Returns:
fdark = fdark (F0) image
fmin = fmin image
fmax = fmax image
:param filename: str
... | Read in, reshape, and subset a datacube of fluorescence snapshots | [
"Read",
"in",
"reshape",
"and",
"subset",
"a",
"datacube",
"of",
"fluorescence",
"snapshots"
] | def read_cropreporter(filename):
"""Read in, reshape, and subset a datacube of fluorescence snapshots
Inputs:
filename = Fluorescence .DAT filename
Returns:
fdark = fdark (F0) image
fmin = fmin image
fmax = f... | [
"def",
"read_cropreporter",
"(",
"filename",
")",
":",
"# Find .INF filename based on the .DAT filename",
"inf_filename",
"=",
"filename",
".",
"replace",
"(",
"\"PSD\"",
",",
"\"HDR\"",
")",
"inf_filename",
"=",
"inf_filename",
".",
"replace",
"(",
"\".DAT\"",
",",
... | https://github.com/danforthcenter/plantcv/blob/aecd599d917884770aa0c7dec15bc9d1c53f36c4/plantcv/plantcv/photosynthesis/read_cropreporter.py#L10-L84 | |
awslabs/autogluon | 7309118f2ab1c9519f25acf61a283a95af95842b | core/src/autogluon/core/models/abstract/abstract_model.py | python | AbstractModel._hyperparameter_tune | (self, X, y, X_val, y_val, scheduler_options, **kwargs) | return self._get_hpo_results(scheduler=scheduler, scheduler_params=scheduler_params, time_start=time_start) | Hyperparameter tune the model.
This usually does not need to be overwritten by models. | Hyperparameter tune the model. | [
"Hyperparameter",
"tune",
"the",
"model",
"."
] | def _hyperparameter_tune(self, X, y, X_val, y_val, scheduler_options, **kwargs):
"""
Hyperparameter tune the model.
This usually does not need to be overwritten by models.
"""
# verbosity = kwargs.get('verbosity', 2)
time_start = time.time()
logger.log(15, "Start... | [
"def",
"_hyperparameter_tune",
"(",
"self",
",",
"X",
",",
"y",
",",
"X_val",
",",
"y_val",
",",
"scheduler_options",
",",
"*",
"*",
"kwargs",
")",
":",
"# verbosity = kwargs.get('verbosity', 2)",
"time_start",
"=",
"time",
".",
"time",
"(",
")",
"logger",
"... | https://github.com/awslabs/autogluon/blob/7309118f2ab1c9519f25acf61a283a95af95842b/core/src/autogluon/core/models/abstract/abstract_model.py#L868-L917 | |
mcfletch/pyopengl | 02d11dad9ff18e50db10e975c4756e17bf198464 | OpenGL/GL/ARB/spirv_extensions.py | python | glInitSpirvExtensionsARB | () | return extensions.hasGLExtension( _EXTENSION_NAME ) | Return boolean indicating whether this extension is available | Return boolean indicating whether this extension is available | [
"Return",
"boolean",
"indicating",
"whether",
"this",
"extension",
"is",
"available"
] | def glInitSpirvExtensionsARB():
'''Return boolean indicating whether this extension is available'''
from OpenGL import extensions
return extensions.hasGLExtension( _EXTENSION_NAME ) | [
"def",
"glInitSpirvExtensionsARB",
"(",
")",
":",
"from",
"OpenGL",
"import",
"extensions",
"return",
"extensions",
".",
"hasGLExtension",
"(",
"_EXTENSION_NAME",
")"
] | https://github.com/mcfletch/pyopengl/blob/02d11dad9ff18e50db10e975c4756e17bf198464/OpenGL/GL/ARB/spirv_extensions.py#L43-L46 | |
wistbean/learn_python3_spider | 73c873f4845f4385f097e5057407d03dd37a117b | stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/client/knownhosts.py | python | _hmacedString | (key, string) | return hash.digest() | Return the SHA-1 HMAC hash of the given key and string.
@param key: The HMAC key.
@type key: L{bytes}
@param string: The string to be hashed.
@type string: L{bytes}
@return: The keyed hash value.
@rtype: L{bytes} | Return the SHA-1 HMAC hash of the given key and string. | [
"Return",
"the",
"SHA",
"-",
"1",
"HMAC",
"hash",
"of",
"the",
"given",
"key",
"and",
"string",
"."
] | def _hmacedString(key, string):
"""
Return the SHA-1 HMAC hash of the given key and string.
@param key: The HMAC key.
@type key: L{bytes}
@param string: The string to be hashed.
@type string: L{bytes}
@return: The keyed hash value.
@rtype: L{bytes}
"""
hash = hmac.HMAC(key, di... | [
"def",
"_hmacedString",
"(",
"key",
",",
"string",
")",
":",
"hash",
"=",
"hmac",
".",
"HMAC",
"(",
"key",
",",
"digestmod",
"=",
"sha1",
")",
"if",
"isinstance",
"(",
"string",
",",
"unicode",
")",
":",
"string",
"=",
"string",
".",
"encode",
"(",
... | https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/client/knownhosts.py#L230-L247 | |
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/graph_objs/splom/_hoverlabel.py | python | Hoverlabel.bgcolor | (self) | return self["bgcolor"] | Sets the background color of the hover labels for this trace
The 'bgcolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g.... | Sets the background color of the hover labels for this trace
The 'bgcolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g.... | [
"Sets",
"the",
"background",
"color",
"of",
"the",
"hover",
"labels",
"for",
"this",
"trace",
"The",
"bgcolor",
"property",
"is",
"a",
"color",
"and",
"may",
"be",
"specified",
"as",
":",
"-",
"A",
"hex",
"string",
"(",
"e",
".",
"g",
".",
"#ff0000",
... | def bgcolor(self):
"""
Sets the background color of the hover labels for this trace
The 'bgcolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)... | [
"def",
"bgcolor",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"bgcolor\"",
"]"
] | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/splom/_hoverlabel.py#L70-L121 | |
mfessenden/SceneGraph | 0fa3429059c77c881d1b58b28e89dcb44c609909 | ui/node_widgets.py | python | DotWidget.getConnection | (self, name) | Returns a named connection.
returns:
(DotConnection) - connection widget. | Returns a named connection. | [
"Returns",
"a",
"named",
"connection",
"."
] | def getConnection(self, name):
"""
Returns a named connection.
returns:
(DotConnection) - connection widget.
"""
if name not in self.inputs and name not in self.outputs:
return
if name in self.inputs:
return self.connections.get(name... | [
"def",
"getConnection",
"(",
"self",
",",
"name",
")",
":",
"if",
"name",
"not",
"in",
"self",
".",
"inputs",
"and",
"name",
"not",
"in",
"self",
".",
"outputs",
":",
"return",
"if",
"name",
"in",
"self",
".",
"inputs",
":",
"return",
"self",
".",
... | https://github.com/mfessenden/SceneGraph/blob/0fa3429059c77c881d1b58b28e89dcb44c609909/ui/node_widgets.py#L1900-L1914 | ||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_vendored_deps/library/oc_edit.py | python | Yedit.delete | (self, path, index=None, value=None) | return (True, self.yaml_dict) | remove path from a dict | remove path from a dict | [
"remove",
"path",
"from",
"a",
"dict"
] | def delete(self, path, index=None, value=None):
''' remove path from a dict'''
try:
entry = Yedit.get_entry(self.yaml_dict, path, self.separator)
except KeyError:
entry = None
if entry is None:
return (False, self.yaml_dict)
result = Yedit.re... | [
"def",
"delete",
"(",
"self",
",",
"path",
",",
"index",
"=",
"None",
",",
"value",
"=",
"None",
")",
":",
"try",
":",
"entry",
"=",
"Yedit",
".",
"get_entry",
"(",
"self",
".",
"yaml_dict",
",",
"path",
",",
"self",
".",
"separator",
")",
"except"... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_vendored_deps/library/oc_edit.py#L525-L539 | |
nottombrown/rl-teacher | b2c2201e9d2457b13185424a19da7209364f23df | agents/pposgd-mpi/pposgd_mpi/cnn_policy.py | python | CnnPolicy.get_trainable_variables | (self) | return tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES, self.scope) | [] | def get_trainable_variables(self):
return tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES, self.scope) | [
"def",
"get_trainable_variables",
"(",
"self",
")",
":",
"return",
"tf",
".",
"get_collection",
"(",
"tf",
".",
"GraphKeys",
".",
"TRAINABLE_VARIABLES",
",",
"self",
".",
"scope",
")"
] | https://github.com/nottombrown/rl-teacher/blob/b2c2201e9d2457b13185424a19da7209364f23df/agents/pposgd-mpi/pposgd_mpi/cnn_policy.py#L53-L54 | |||
ZhenYangIACAS/NMT_GAN | e27f9468112b117509f065f0f8f298f5b80b5602 | tensor2tensor/expert_utils.py | python | NoisyTopKGating.__init__ | (self, hp, name) | Create a NoisyTopKGating network.
Args:
hp: a hyperparameters created by NoisyTopKGatingParams()
name: a string | Create a NoisyTopKGating network. | [
"Create",
"a",
"NoisyTopKGating",
"network",
"."
] | def __init__(self, hp, name):
"""Create a NoisyTopKGating network.
Args:
hp: a hyperparameters created by NoisyTopKGatingParams()
name: a string
"""
self._vars = []
self._hp = hp
self._w_gate = tf.get_variable('%s_gate' % name,
[hp.input_size,
... | [
"def",
"__init__",
"(",
"self",
",",
"hp",
",",
"name",
")",
":",
"self",
".",
"_vars",
"=",
"[",
"]",
"self",
".",
"_hp",
"=",
"hp",
"self",
".",
"_w_gate",
"=",
"tf",
".",
"get_variable",
"(",
"'%s_gate'",
"%",
"name",
",",
"[",
"hp",
".",
"i... | https://github.com/ZhenYangIACAS/NMT_GAN/blob/e27f9468112b117509f065f0f8f298f5b80b5602/tensor2tensor/expert_utils.py#L517-L534 | ||
ganglia/gmond_python_modules | 2f7fcab3d27926ef4a2feb1b53c09af16a43e729 | network/netstats/python_modules/netstats.py | python | UpdateMetricThread.shutdown | (self) | [] | def shutdown(self):
self.shuttingdown = True
if not self.running:
return
self.join() | [
"def",
"shutdown",
"(",
"self",
")",
":",
"self",
".",
"shuttingdown",
"=",
"True",
"if",
"not",
"self",
".",
"running",
":",
"return",
"self",
".",
"join",
"(",
")"
] | https://github.com/ganglia/gmond_python_modules/blob/2f7fcab3d27926ef4a2feb1b53c09af16a43e729/network/netstats/python_modules/netstats.py#L46-L52 | ||||
celery/django-celery-beat | fa73034be892052893e4ef17926ef3a5d4a21ea2 | django_celery_beat/schedulers.py | python | DatabaseScheduler.install_default_entries | (self, data) | [] | def install_default_entries(self, data):
entries = {}
if self.app.conf.result_expires:
entries.setdefault(
'celery.backend_cleanup', {
'task': 'celery.backend_cleanup',
'schedule': schedules.crontab('0', '4', '*'),
'... | [
"def",
"install_default_entries",
"(",
"self",
",",
"data",
")",
":",
"entries",
"=",
"{",
"}",
"if",
"self",
".",
"app",
".",
"conf",
".",
"result_expires",
":",
"entries",
".",
"setdefault",
"(",
"'celery.backend_cleanup'",
",",
"{",
"'task'",
":",
"'cel... | https://github.com/celery/django-celery-beat/blob/fa73034be892052893e4ef17926ef3a5d4a21ea2/django_celery_beat/schedulers.py#L331-L341 | ||||
openstack/ironic | b392dc19bcd29cef5a69ec00d2f18a7a19a679e5 | ironic/common/policy.py | python | get_enforcer | () | return _ENFORCER | Provides access to the single instance of Policy enforcer. | Provides access to the single instance of Policy enforcer. | [
"Provides",
"access",
"to",
"the",
"single",
"instance",
"of",
"Policy",
"enforcer",
"."
] | def get_enforcer():
"""Provides access to the single instance of Policy enforcer."""
if not _ENFORCER:
init_enforcer()
return _ENFORCER | [
"def",
"get_enforcer",
"(",
")",
":",
"if",
"not",
"_ENFORCER",
":",
"init_enforcer",
"(",
")",
"return",
"_ENFORCER"
] | https://github.com/openstack/ironic/blob/b392dc19bcd29cef5a69ec00d2f18a7a19a679e5/ironic/common/policy.py#L1815-L1821 | |
oracle/graalpython | 577e02da9755d916056184ec441c26e00b70145c | graalpython/lib-python/3/pickle.py | python | _Pickler.memoize | (self, obj) | Store an object in the memo. | Store an object in the memo. | [
"Store",
"an",
"object",
"in",
"the",
"memo",
"."
] | def memoize(self, obj):
"""Store an object in the memo."""
# The Pickler memo is a dictionary mapping object ids to 2-tuples
# that contain the Unpickler memo key and the object being memoized.
# The memo key is written to the pickle and will become
# the key in the Unpickler's ... | [
"def",
"memoize",
"(",
"self",
",",
"obj",
")",
":",
"# The Pickler memo is a dictionary mapping object ids to 2-tuples",
"# that contain the Unpickler memo key and the object being memoized.",
"# The memo key is written to the pickle and will become",
"# the key in the Unpickler's memo. The ... | https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/pickle.py#L489-L509 | ||
pyqtgraph/pyqtgraph | ac3887abfca4e529aac44f022f8e40556a2587b0 | pyqtgraph/canvas/CanvasItem.py | python | CanvasItem.selectBoxFromUser | (self) | Move the selection box to match the current userTransform | Move the selection box to match the current userTransform | [
"Move",
"the",
"selection",
"box",
"to",
"match",
"the",
"current",
"userTransform"
] | def selectBoxFromUser(self):
"""Move the selection box to match the current userTransform"""
## user transform
#trans = QtGui.QTransform()
#trans.translate(*self.userTranslate)
#trans.rotate(-self.userRotate)
#x2, y2 = trans.map(*self.selectBoxBase['pos'])
... | [
"def",
"selectBoxFromUser",
"(",
"self",
")",
":",
"## user transform",
"#trans = QtGui.QTransform()",
"#trans.translate(*self.userTranslate)",
"#trans.rotate(-self.userRotate)",
"#x2, y2 = trans.map(*self.selectBoxBase['pos'])",
"self",
".",
"selectBox",
".",
"blockSignals",
"(",
... | https://github.com/pyqtgraph/pyqtgraph/blob/ac3887abfca4e529aac44f022f8e40556a2587b0/pyqtgraph/canvas/CanvasItem.py#L357-L371 | ||
tendenci/tendenci | 0f2c348cc0e7d41bc56f50b00ce05544b083bf1d | tendenci/apps/news/migrations/0010_auto_20190816_1445.py | python | remove_fb_like_from_custom_templates | (apps, schema_editor) | Remove facebook like buttons from custom templates (the templates pulled down to site).
1) news/meta.html
Remove facebook like block
{% if show_fb_connect|default:False %}
<li>{% fb_like_button_iframe news.get_absolute_url height=20 %}</li>
{% endif %}
2) ne... | Remove facebook like buttons from custom templates (the templates pulled down to site).
1) news/meta.html
Remove facebook like block
{% if show_fb_connect|default:False %}
<li>{% fb_like_button_iframe news.get_absolute_url height=20 %}</li>
{% endif %}
2) ne... | [
"Remove",
"facebook",
"like",
"buttons",
"from",
"custom",
"templates",
"(",
"the",
"templates",
"pulled",
"down",
"to",
"site",
")",
".",
"1",
")",
"news",
"/",
"meta",
".",
"html",
"Remove",
"facebook",
"like",
"block",
"{",
"%",
"if",
"show_fb_connect|d... | def remove_fb_like_from_custom_templates(apps, schema_editor):
"""
Remove facebook like buttons from custom templates (the templates pulled down to site).
1) news/meta.html
Remove facebook like block
{% if show_fb_connect|default:False %}
<li>{% fb_like_button_iframe n... | [
"def",
"remove_fb_like_from_custom_templates",
"(",
"apps",
",",
"schema_editor",
")",
":",
"import",
"re",
"import",
"os",
"from",
"tendenci",
".",
"apps",
".",
"theme",
".",
"utils",
"import",
"get_theme_root",
"dir_path",
"=",
"get_theme_root",
"(",
")",
"# n... | https://github.com/tendenci/tendenci/blob/0f2c348cc0e7d41bc56f50b00ce05544b083bf1d/tendenci/apps/news/migrations/0010_auto_20190816_1445.py#L7-L50 | ||
plaid/plaid-python | 8c60fca608e426f3ff30da8857775946d29e122c | plaid/model/standalone_currency_code_list.py | python | StandaloneCurrencyCodeList.__init__ | (self, iso_currency_code, unofficial_currency_code, *args, **kwargs) | StandaloneCurrencyCodeList - a model defined in OpenAPI
Args:
iso_currency_code (str): Plaid supports all ISO 4217 currency codes.
unofficial_currency_code (str): List of unofficial currency codes
Keyword Args:
_check_type (bool): if True, values for parameters in o... | StandaloneCurrencyCodeList - a model defined in OpenAPI | [
"StandaloneCurrencyCodeList",
"-",
"a",
"model",
"defined",
"in",
"OpenAPI"
] | def __init__(self, iso_currency_code, unofficial_currency_code, *args, **kwargs): # noqa: E501
"""StandaloneCurrencyCodeList - a model defined in OpenAPI
Args:
iso_currency_code (str): Plaid supports all ISO 4217 currency codes.
unofficial_currency_code (str): List of unofficia... | [
"def",
"__init__",
"(",
"self",
",",
"iso_currency_code",
",",
"unofficial_currency_code",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# noqa: E501",
"_check_type",
"=",
"kwargs",
".",
"pop",
"(",
"'_check_type'",
",",
"True",
")",
"_spec_property_na... | https://github.com/plaid/plaid-python/blob/8c60fca608e426f3ff30da8857775946d29e122c/plaid/model/standalone_currency_code_list.py#L105-L177 | ||
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/django-1.3/django/contrib/formtools/wizard.py | python | FormWizard.num_steps | (self) | return len(self.form_list) | Helper method that returns the number of steps. | Helper method that returns the number of steps. | [
"Helper",
"method",
"that",
"returns",
"the",
"number",
"of",
"steps",
"."
] | def num_steps(self):
"Helper method that returns the number of steps."
# You might think we should just set "self.num_steps = len(form_list)"
# in __init__(), but this calculation needs to be dynamic, because some
# hook methods might alter self.form_list.
return len(self.form_li... | [
"def",
"num_steps",
"(",
"self",
")",
":",
"# You might think we should just set \"self.num_steps = len(form_list)\"",
"# in __init__(), but this calculation needs to be dynamic, because some",
"# hook methods might alter self.form_list.",
"return",
"len",
"(",
"self",
".",
"form_list",
... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.3/django/contrib/formtools/wizard.py#L50-L55 | |
CGCookie/retopoflow | 3d8b3a47d1d661f99ab0aeb21d31370bf15de35e | addon_common/common/updater_core.py | python | SingletonUpdater.print_verbose | (self, msg) | Print out a verbose logging message if verbose is true. | Print out a verbose logging message if verbose is true. | [
"Print",
"out",
"a",
"verbose",
"logging",
"message",
"if",
"verbose",
"is",
"true",
"."
] | def print_verbose(self, msg):
"""Print out a verbose logging message if verbose is true."""
if not self._verbose:
return
print("{} addon: ".format(self.addon) + msg) | [
"def",
"print_verbose",
"(",
"self",
",",
"msg",
")",
":",
"if",
"not",
"self",
".",
"_verbose",
":",
"return",
"print",
"(",
"\"{} addon: \"",
".",
"format",
"(",
"self",
".",
"addon",
")",
"+",
"msg",
")"
] | https://github.com/CGCookie/retopoflow/blob/3d8b3a47d1d661f99ab0aeb21d31370bf15de35e/addon_common/common/updater_core.py#L139-L143 | ||
mozilla/addons-server | cbfb29e5be99539c30248d70b93bb15e1c1bc9d7 | src/olympia/addons/models.py | python | from_upload | (
cls,
upload,
selected_apps,
channel=amo.RELEASE_CHANNEL_LISTED,
parsed_data=None,
user=None,
) | return addon | Create an Addon instance, a Version and corresponding File(s) from a
FileUpload, a list of compatible app ids, a channel id and the
parsed_data generated by parse_addon().
Note that it's the caller's responsability to ensure the file is valid.
We can't check for that here because an adm... | Create an Addon instance, a Version and corresponding File(s) from a
FileUpload, a list of compatible app ids, a channel id and the
parsed_data generated by parse_addon(). | [
"Create",
"an",
"Addon",
"instance",
"a",
"Version",
"and",
"corresponding",
"File",
"(",
"s",
")",
"from",
"a",
"FileUpload",
"a",
"list",
"of",
"compatible",
"app",
"ids",
"a",
"channel",
"id",
"and",
"the",
"parsed_data",
"generated",
"by",
"parse_addon",... | def from_upload(
cls,
upload,
selected_apps,
channel=amo.RELEASE_CHANNEL_LISTED,
parsed_data=None,
user=None,
):
"""
Create an Addon instance, a Version and corresponding File(s) from a
FileUpload, a list of compatible app ids, a channel id and... | [
"def",
"from_upload",
"(",
"cls",
",",
"upload",
",",
"selected_apps",
",",
"channel",
"=",
"amo",
".",
"RELEASE_CHANNEL_LISTED",
",",
"parsed_data",
"=",
"None",
",",
"user",
"=",
"None",
",",
")",
":",
"assert",
"parsed_data",
"is",
"not",
"None",
"addon... | https://github.com/mozilla/addons-server/blob/cbfb29e5be99539c30248d70b93bb15e1c1bc9d7/src/olympia/addons/models.py#L899-L931 | |
Source-Python-Dev-Team/Source.Python | d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb | addons/source-python/packages/site-packages/sqlalchemy/sql/annotation.py | python | _deep_deannotate | (element, values=None) | return element | Deep copy the given element, removing annotations. | Deep copy the given element, removing annotations. | [
"Deep",
"copy",
"the",
"given",
"element",
"removing",
"annotations",
"."
] | def _deep_deannotate(element, values=None):
"""Deep copy the given element, removing annotations."""
cloned = util.column_dict()
def clone(elem):
# if a values dict is given,
# the elem must be cloned each time it appears,
# as there may be different annotations in source
#... | [
"def",
"_deep_deannotate",
"(",
"element",
",",
"values",
"=",
"None",
")",
":",
"cloned",
"=",
"util",
".",
"column_dict",
"(",
")",
"def",
"clone",
"(",
"elem",
")",
":",
"# if a values dict is given,",
"# the elem must be cloned each time it appears,",
"# as ther... | https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/packages/site-packages/sqlalchemy/sql/annotation.py#L130-L153 | |
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/trunking/v1/trunk/__init__.py | python | TrunkList.get | (self, sid) | return TrunkContext(self._version, sid=sid, ) | Constructs a TrunkContext
:param sid: The unique string that identifies the resource
:returns: twilio.rest.trunking.v1.trunk.TrunkContext
:rtype: twilio.rest.trunking.v1.trunk.TrunkContext | Constructs a TrunkContext | [
"Constructs",
"a",
"TrunkContext"
] | def get(self, sid):
"""
Constructs a TrunkContext
:param sid: The unique string that identifies the resource
:returns: twilio.rest.trunking.v1.trunk.TrunkContext
:rtype: twilio.rest.trunking.v1.trunk.TrunkContext
"""
return TrunkContext(self._version, sid=sid, ) | [
"def",
"get",
"(",
"self",
",",
"sid",
")",
":",
"return",
"TrunkContext",
"(",
"self",
".",
"_version",
",",
"sid",
"=",
"sid",
",",
")"
] | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/trunking/v1/trunk/__init__.py#L151-L160 | |
fortharris/Pcode | 147962d160a834c219e12cb456abc130826468e4 | rope/base/project.py | python | _FileListCacher._add_files | (self, folder) | [] | def _add_files(self, folder):
for child in folder.get_children():
if child.is_folder():
self._add_files(child)
elif not self.project.is_ignored(child):
self.files.add(child) | [
"def",
"_add_files",
"(",
"self",
",",
"folder",
")",
":",
"for",
"child",
"in",
"folder",
".",
"get_children",
"(",
")",
":",
"if",
"child",
".",
"is_folder",
"(",
")",
":",
"self",
".",
"_add_files",
"(",
"child",
")",
"elif",
"not",
"self",
".",
... | https://github.com/fortharris/Pcode/blob/147962d160a834c219e12cb456abc130826468e4/rope/base/project.py#L272-L277 | ||||
jeffball55/rop_compiler | 27cfba9149a7d854425b5c42c7f383a22be72b49 | pyrop/rop_compiler/utils.py | python | get_contents | (filename) | return contents | Convenience method that reads a file on disk and returns the contents | Convenience method that reads a file on disk and returns the contents | [
"Convenience",
"method",
"that",
"reads",
"a",
"file",
"on",
"disk",
"and",
"returns",
"the",
"contents"
] | def get_contents(filename):
"""Convenience method that reads a file on disk and returns the contents"""
fd = open(filename, "r")
contents = fd.read()
fd.close()
return contents | [
"def",
"get_contents",
"(",
"filename",
")",
":",
"fd",
"=",
"open",
"(",
"filename",
",",
"\"r\"",
")",
"contents",
"=",
"fd",
".",
"read",
"(",
")",
"fd",
".",
"close",
"(",
")",
"return",
"contents"
] | https://github.com/jeffball55/rop_compiler/blob/27cfba9149a7d854425b5c42c7f383a22be72b49/pyrop/rop_compiler/utils.py#L23-L28 | |
translate/translate | 72816df696b5263abfe80ab59129b299b85ae749 | translate/storage/statistics.py | python | Statistics.classifyunits | (self) | Makes a dictionary of which units fall into which classifications.
This method iterates over all units. | Makes a dictionary of which units fall into which classifications. | [
"Makes",
"a",
"dictionary",
"of",
"which",
"units",
"fall",
"into",
"which",
"classifications",
"."
] | def classifyunits(self):
"""Makes a dictionary of which units fall into which classifications.
This method iterates over all units.
"""
self.classification = {}
self.classification["fuzzy"] = []
self.classification["blank"] = []
self.classification["translated"] ... | [
"def",
"classifyunits",
"(",
"self",
")",
":",
"self",
".",
"classification",
"=",
"{",
"}",
"self",
".",
"classification",
"[",
"\"fuzzy\"",
"]",
"=",
"[",
"]",
"self",
".",
"classification",
"[",
"\"blank\"",
"]",
"=",
"[",
"]",
"self",
".",
"classif... | https://github.com/translate/translate/blob/72816df696b5263abfe80ab59129b299b85ae749/translate/storage/statistics.py#L147-L169 | ||
edfungus/Crouton | ada98b3930192938a48909072b45cb84b945f875 | clients/python_clients/cf_demo_client/cf_env/lib/python2.7/site-packages/flask/blueprints.py | python | Blueprint.before_request | (self, f) | return f | Like :meth:`Flask.before_request` but for a blueprint. This function
is only executed before each request that is handled by a function of
that blueprint. | Like :meth:`Flask.before_request` but for a blueprint. This function
is only executed before each request that is handled by a function of
that blueprint. | [
"Like",
":",
"meth",
":",
"Flask",
".",
"before_request",
"but",
"for",
"a",
"blueprint",
".",
"This",
"function",
"is",
"only",
"executed",
"before",
"each",
"request",
"that",
"is",
"handled",
"by",
"a",
"function",
"of",
"that",
"blueprint",
"."
] | def before_request(self, f):
"""Like :meth:`Flask.before_request` but for a blueprint. This function
is only executed before each request that is handled by a function of
that blueprint.
"""
self.record_once(lambda s: s.app.before_request_funcs
.setdefault(self.name,... | [
"def",
"before_request",
"(",
"self",
",",
"f",
")",
":",
"self",
".",
"record_once",
"(",
"lambda",
"s",
":",
"s",
".",
"app",
".",
"before_request_funcs",
".",
"setdefault",
"(",
"self",
".",
"name",
",",
"[",
"]",
")",
".",
"append",
"(",
"f",
"... | https://github.com/edfungus/Crouton/blob/ada98b3930192938a48909072b45cb84b945f875/clients/python_clients/cf_demo_client/cf_env/lib/python2.7/site-packages/flask/blueprints.py#L268-L275 | |
yt-project/yt | dc7b24f9b266703db4c843e329c6c8644d47b824 | yt/data_objects/static_output.py | python | Dataset.quan | (self) | return self._quan | Converts an scalar into a :class:`yt.units.yt_array.YTQuantity`
The returned YTQuantity will be dimensionless by default, but can be
cast to arbitrary units using the ``units`` keyword argument.
Parameters
----------
input_scalar : an integer or floating point scalar
... | Converts an scalar into a :class:`yt.units.yt_array.YTQuantity` | [
"Converts",
"an",
"scalar",
"into",
"a",
":",
"class",
":",
"yt",
".",
"units",
".",
"yt_array",
".",
"YTQuantity"
] | def quan(self):
"""Converts an scalar into a :class:`yt.units.yt_array.YTQuantity`
The returned YTQuantity will be dimensionless by default, but can be
cast to arbitrary units using the ``units`` keyword argument.
Parameters
----------
input_scalar : an integer or floa... | [
"def",
"quan",
"(",
"self",
")",
":",
"if",
"self",
".",
"_quan",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_quan",
"self",
".",
"_quan",
"=",
"functools",
".",
"partial",
"(",
"YTQuantity",
",",
"registry",
"=",
"self",
".",
"unit_registry",
... | https://github.com/yt-project/yt/blob/dc7b24f9b266703db4c843e329c6c8644d47b824/yt/data_objects/static_output.py#L1466-L1509 | |
buke/GreenOdoo | 3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df | runtime/python/lib/python2.7/site-packages/PIL/Image.py | python | Image.filter | (self, filter) | return merge(self.mode, ims) | Apply environment filter to image | Apply environment filter to image | [
"Apply",
"environment",
"filter",
"to",
"image"
] | def filter(self, filter):
"Apply environment filter to image"
self.load()
if callable(filter):
filter = filter()
if not hasattr(filter, "filter"):
raise TypeError("filter argument should be ImageFilter.Filter instance or class")
if self.im.bands == 1:
... | [
"def",
"filter",
"(",
"self",
",",
"filter",
")",
":",
"self",
".",
"load",
"(",
")",
"if",
"callable",
"(",
"filter",
")",
":",
"filter",
"=",
"filter",
"(",
")",
"if",
"not",
"hasattr",
"(",
"filter",
",",
"\"filter\"",
")",
":",
"raise",
"TypeEr... | https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/site-packages/PIL/Image.py#L802-L818 | |
pypa/pip | 7f8a6844037fb7255cfd0d34ff8e8cf44f2598d4 | src/pip/_vendor/requests/sessions.py | python | SessionRedirectMixin.rebuild_method | (self, prepared_request, response) | When being redirected we may want to change the method of the request
based on certain specs or browser behavior. | When being redirected we may want to change the method of the request
based on certain specs or browser behavior. | [
"When",
"being",
"redirected",
"we",
"may",
"want",
"to",
"change",
"the",
"method",
"of",
"the",
"request",
"based",
"on",
"certain",
"specs",
"or",
"browser",
"behavior",
"."
] | def rebuild_method(self, prepared_request, response):
"""When being redirected we may want to change the method of the request
based on certain specs or browser behavior.
"""
method = prepared_request.method
# https://tools.ietf.org/html/rfc7231#section-6.4.4
if response... | [
"def",
"rebuild_method",
"(",
"self",
",",
"prepared_request",
",",
"response",
")",
":",
"method",
"=",
"prepared_request",
".",
"method",
"# https://tools.ietf.org/html/rfc7231#section-6.4.4",
"if",
"response",
".",
"status_code",
"==",
"codes",
".",
"see_other",
"a... | https://github.com/pypa/pip/blob/7f8a6844037fb7255cfd0d34ff8e8cf44f2598d4/src/pip/_vendor/requests/sessions.py#L314-L334 | ||
edisonlz/fastor | 342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3 | base/site-packages/wi_model_util/imodel.py | python | attach_raw_foreignkey | (objects, field, qs) | Shortcut method which handles a pythonic LEFT OUTER JOIN.
``attach_raw_foreignkey(posts, thread, Thread.objects)``
param:
objects: object
fields: the field and point to other object
qs:default is None list of object | Shortcut method which handles a pythonic LEFT OUTER JOIN.
``attach_raw_foreignkey(posts, thread, Thread.objects)``
param:
objects: object
fields: the field and point to other object
qs:default is None list of object | [
"Shortcut",
"method",
"which",
"handles",
"a",
"pythonic",
"LEFT",
"OUTER",
"JOIN",
".",
"attach_raw_foreignkey",
"(",
"posts",
"thread",
"Thread",
".",
"objects",
")",
"param",
":",
"objects",
":",
"object",
"fields",
":",
"the",
"field",
"and",
"point",
"t... | def attach_raw_foreignkey(objects, field, qs):
"""
Shortcut method which handles a pythonic LEFT OUTER JOIN.
``attach_raw_foreignkey(posts, thread, Thread.objects)``
param:
objects: object
fields: the field and point to other object
qs:default is None list of object
"""
qs = qs.filter(pk__in=distinct(getat... | [
"def",
"attach_raw_foreignkey",
"(",
"objects",
",",
"field",
",",
"qs",
")",
":",
"qs",
"=",
"qs",
".",
"filter",
"(",
"pk__in",
"=",
"distinct",
"(",
"getattr",
"(",
"o",
",",
"field",
")",
"for",
"o",
"in",
"objects",
")",
")",
"#if select_related:"... | https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/wi_model_util/imodel.py#L85-L99 | ||
golismero/golismero | 7d605b937e241f51c1ca4f47b20f755eeefb9d76 | thirdparty_libs/django/core/cache/backends/base.py | python | BaseCache.make_key | (self, key, version=None) | return new_key | Constructs the key used by all other methods. By default it
uses the key_func to generate a key (which, by default,
prepends the `key_prefix' and 'version'). An different key
function can be provided at the time of cache construction;
alternatively, you can subclass the cache backend to ... | Constructs the key used by all other methods. By default it
uses the key_func to generate a key (which, by default,
prepends the `key_prefix' and 'version'). An different key
function can be provided at the time of cache construction;
alternatively, you can subclass the cache backend to ... | [
"Constructs",
"the",
"key",
"used",
"by",
"all",
"other",
"methods",
".",
"By",
"default",
"it",
"uses",
"the",
"key_func",
"to",
"generate",
"a",
"key",
"(",
"which",
"by",
"default",
"prepends",
"the",
"key_prefix",
"and",
"version",
")",
".",
"An",
"d... | def make_key(self, key, version=None):
"""Constructs the key used by all other methods. By default it
uses the key_func to generate a key (which, by default,
prepends the `key_prefix' and 'version'). An different key
function can be provided at the time of cache construction;
alt... | [
"def",
"make_key",
"(",
"self",
",",
"key",
",",
"version",
"=",
"None",
")",
":",
"if",
"version",
"is",
"None",
":",
"version",
"=",
"self",
".",
"version",
"new_key",
"=",
"self",
".",
"key_func",
"(",
"key",
",",
"self",
".",
"key_prefix",
",",
... | https://github.com/golismero/golismero/blob/7d605b937e241f51c1ca4f47b20f755eeefb9d76/thirdparty_libs/django/core/cache/backends/base.py#L70-L82 | |
oddt/oddt | 8cf555820d97a692ade81c101ebe10e28bcb3722 | oddt/interactions.py | python | halogenbond_acceptor_halogen | (mol1,
mol2,
tolerance=30,
cutoff=4) | Returns pairs of acceptor-halogen atoms, which meet halogen bond criteria
Parameters
----------
mol1, mol2 : oddt.toolkit.Molecule object
Molecules to compute halogen bond acceptor and halogen pairs
cutoff : float, (default=4)
Distance cutoff for A-H pairs
tolerance : int, (defaul... | Returns pairs of acceptor-halogen atoms, which meet halogen bond criteria | [
"Returns",
"pairs",
"of",
"acceptor",
"-",
"halogen",
"atoms",
"which",
"meet",
"halogen",
"bond",
"criteria"
] | def halogenbond_acceptor_halogen(mol1,
mol2,
tolerance=30,
cutoff=4):
"""Returns pairs of acceptor-halogen atoms, which meet halogen bond criteria
Parameters
----------
mol1, mol2 : oddt.toolkit.Molecule ... | [
"def",
"halogenbond_acceptor_halogen",
"(",
"mol1",
",",
"mol2",
",",
"tolerance",
"=",
"30",
",",
"cutoff",
"=",
"4",
")",
":",
"a",
",",
"h",
"=",
"close_contacts",
"(",
"mol1",
".",
"atom_dict",
"[",
"mol1",
".",
"atom_dict",
"[",
"'isacceptor'",
"]",... | https://github.com/oddt/oddt/blob/8cf555820d97a692ade81c101ebe10e28bcb3722/oddt/interactions.py#L162-L206 | ||
Nitrate/Nitrate | 7eacef697a15dcbb7ae90c8a1dbf769cba6d1bb1 | src/tcms/issuetracker/services.py | python | IssueTrackerService.tracker_model | (self) | return self._model | Property to access issue tracker model | Property to access issue tracker model | [
"Property",
"to",
"access",
"issue",
"tracker",
"model"
] | def tracker_model(self) -> IssueTracker:
"""Property to access issue tracker model"""
return self._model | [
"def",
"tracker_model",
"(",
"self",
")",
"->",
"IssueTracker",
":",
"return",
"self",
".",
"_model"
] | https://github.com/Nitrate/Nitrate/blob/7eacef697a15dcbb7ae90c8a1dbf769cba6d1bb1/src/tcms/issuetracker/services.py#L55-L57 | |
ChineseGLUE/ChineseGLUE | 1591b85cf5427c2ff60f718d359ecb71d2b44879 | baselines/models/bert/run_classifier.py | python | DataProcessor.get_train_examples | (self, data_dir) | Gets a collection of `InputExample`s for the train set. | Gets a collection of `InputExample`s for the train set. | [
"Gets",
"a",
"collection",
"of",
"InputExample",
"s",
"for",
"the",
"train",
"set",
"."
] | def get_train_examples(self, data_dir):
"""Gets a collection of `InputExample`s for the train set."""
raise NotImplementedError() | [
"def",
"get_train_examples",
"(",
"self",
",",
"data_dir",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/ChineseGLUE/ChineseGLUE/blob/1591b85cf5427c2ff60f718d359ecb71d2b44879/baselines/models/bert/run_classifier.py#L185-L187 | ||
timonwong/OmniMarkupPreviewer | 21921ac7a99d2b5924a2219b33679a5b53621392 | OmniMarkupLib/Renderers/libs/python2/docutils/utils/math/math2html.py | python | TextPosition.extract | (self, length) | return self.text[self.pos : self.pos + length] | Extract the next string of the given length, or None if not enough text. | Extract the next string of the given length, or None if not enough text. | [
"Extract",
"the",
"next",
"string",
"of",
"the",
"given",
"length",
"or",
"None",
"if",
"not",
"enough",
"text",
"."
] | def extract(self, length):
"Extract the next string of the given length, or None if not enough text."
if self.pos + length > len(self.text):
return None
return self.text[self.pos : self.pos + length] | [
"def",
"extract",
"(",
"self",
",",
"length",
")",
":",
"if",
"self",
".",
"pos",
"+",
"length",
">",
"len",
"(",
"self",
".",
"text",
")",
":",
"return",
"None",
"return",
"self",
".",
"text",
"[",
"self",
".",
"pos",
":",
"self",
".",
"pos",
... | https://github.com/timonwong/OmniMarkupPreviewer/blob/21921ac7a99d2b5924a2219b33679a5b53621392/OmniMarkupLib/Renderers/libs/python2/docutils/utils/math/math2html.py#L2002-L2006 | |
AppDaemon/appdaemon | 553c670c26bf6a04a17c5a230c1c4f10b4cd6ba7 | appdaemon/adapi.py | python | ADAPI.fire_event | (self, event: str, **kwargs: Optional[Any]) | Fires an event on the AppDaemon bus, for apps and plugins.
Args:
event: Name of the event. Can be a standard Home Assistant event such as
`service_registered` or an arbitrary custom event such as "MODE_CHANGE".
**kwargs (optional): Zero or more keyword arguments.
... | Fires an event on the AppDaemon bus, for apps and plugins. | [
"Fires",
"an",
"event",
"on",
"the",
"AppDaemon",
"bus",
"for",
"apps",
"and",
"plugins",
"."
] | async def fire_event(self, event: str, **kwargs: Optional[Any]) -> None:
"""Fires an event on the AppDaemon bus, for apps and plugins.
Args:
event: Name of the event. Can be a standard Home Assistant event such as
`service_registered` or an arbitrary custom event such as "MO... | [
"async",
"def",
"fire_event",
"(",
"self",
",",
"event",
":",
"str",
",",
"*",
"*",
"kwargs",
":",
"Optional",
"[",
"Any",
"]",
")",
"->",
"None",
":",
"namespace",
"=",
"self",
".",
"_get_namespace",
"(",
"*",
"*",
"kwargs",
")",
"if",
"\"namespace\... | https://github.com/AppDaemon/appdaemon/blob/553c670c26bf6a04a17c5a230c1c4f10b4cd6ba7/appdaemon/adapi.py#L1936-L1963 | ||
USC-ACTLab/crazyswarm | 424d074f7e37d616847ea11dd3a448f89ec3c457 | ros_ws/src/crazyswarm/scripts/pycrazyswarm/crazyflie.py | python | CrazyflieServer.takeoff | (self, targetHeight, duration, groupMask = 0) | Broadcasted takeoff - fly straight up, then hover indefinitely.
Broadcast version of :meth:`Crazyflie.takeoff()`. All robots that match the
groupMask take off at exactly the same time. Use for synchronized
movement. Asynchronous command; returns immediately.
Args:
targetHei... | Broadcasted takeoff - fly straight up, then hover indefinitely. | [
"Broadcasted",
"takeoff",
"-",
"fly",
"straight",
"up",
"then",
"hover",
"indefinitely",
"."
] | def takeoff(self, targetHeight, duration, groupMask = 0):
"""Broadcasted takeoff - fly straight up, then hover indefinitely.
Broadcast version of :meth:`Crazyflie.takeoff()`. All robots that match the
groupMask take off at exactly the same time. Use for synchronized
movement. Asynchrono... | [
"def",
"takeoff",
"(",
"self",
",",
"targetHeight",
",",
"duration",
",",
"groupMask",
"=",
"0",
")",
":",
"self",
".",
"takeoffService",
"(",
"groupMask",
",",
"targetHeight",
",",
"rospy",
".",
"Duration",
".",
"from_sec",
"(",
"duration",
")",
")"
] | https://github.com/USC-ACTLab/crazyswarm/blob/424d074f7e37d616847ea11dd3a448f89ec3c457/ros_ws/src/crazyswarm/scripts/pycrazyswarm/crazyflie.py#L613-L625 | ||
JaniceWuo/MovieRecommend | 4c86db64ca45598917d304f535413df3bc9fea65 | movierecommend/venv1/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/structures.py | python | CaseInsensitiveDict.__eq__ | (self, other) | return dict(self.lower_items()) == dict(other.lower_items()) | [] | def __eq__(self, other):
if isinstance(other, collections.Mapping):
other = CaseInsensitiveDict(other)
else:
return NotImplemented
# Compare insensitively
return dict(self.lower_items()) == dict(other.lower_items()) | [
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"collections",
".",
"Mapping",
")",
":",
"other",
"=",
"CaseInsensitiveDict",
"(",
"other",
")",
"else",
":",
"return",
"NotImplemented",
"# Compare insensitively",
... | https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/structures.py#L73-L79 | |||
ANTsX/ANTsPy | c24bc0f47ab52a9bdc9ba325a07538ea6dcc8cb2 | ants/core/ants_image.py | python | copy_image_info | (reference, target) | return target | Copy origin, direction, and spacing from one antsImage to another
ANTsR function: `antsCopyImageInfo`
Arguments
---------
reference : ANTsImage
Image to get values from.
target : ANTsImAGE
Image to copy values to
Returns
-------
ANTsImage
Target image w... | Copy origin, direction, and spacing from one antsImage to another
ANTsR function: `antsCopyImageInfo` | [
"Copy",
"origin",
"direction",
"and",
"spacing",
"from",
"one",
"antsImage",
"to",
"another",
"ANTsR",
"function",
":",
"antsCopyImageInfo"
] | def copy_image_info(reference, target):
"""
Copy origin, direction, and spacing from one antsImage to another
ANTsR function: `antsCopyImageInfo`
Arguments
---------
reference : ANTsImage
Image to get values from.
target : ANTsImAGE
Image to copy values to
Retu... | [
"def",
"copy_image_info",
"(",
"reference",
",",
"target",
")",
":",
"target",
".",
"set_origin",
"(",
"reference",
".",
"origin",
")",
"target",
".",
"set_direction",
"(",
"reference",
".",
"direction",
")",
"target",
".",
"set_spacing",
"(",
"reference",
"... | https://github.com/ANTsX/ANTsPy/blob/c24bc0f47ab52a9bdc9ba325a07538ea6dcc8cb2/ants/core/ants_image.py#L808-L829 | |
statsmodels/statsmodels | debbe7ea6ba28fe5bdb78f09f8cac694bef98722 | statsmodels/tsa/vector_ar/var_model.py | python | VARResults.resid_corr | (self) | return self.resid_acorr(0)[0] | Centered residual correlation matrix | Centered residual correlation matrix | [
"Centered",
"residual",
"correlation",
"matrix"
] | def resid_corr(self):
"""
Centered residual correlation matrix
"""
return self.resid_acorr(0)[0] | [
"def",
"resid_corr",
"(",
"self",
")",
":",
"return",
"self",
".",
"resid_acorr",
"(",
"0",
")",
"[",
"0",
"]"
] | https://github.com/statsmodels/statsmodels/blob/debbe7ea6ba28fe5bdb78f09f8cac694bef98722/statsmodels/tsa/vector_ar/var_model.py#L1479-L1483 | |
giswqs/whitebox-python | b4df0bbb10a1dee3bd0f6b3482511f7c829b38fe | whitebox/whitebox_tools.py | python | WhiteboxTools.fill_missing_data | (self, i, output, filter=11, weight=2.0, no_edges=True, callback=None) | return self.run_tool('fill_missing_data', args, callback) | Fills NoData holes in a DEM.
Keyword arguments:
i -- Input raster file.
output -- Output raster file.
filter -- Filter size (cells).
weight -- IDW weight value.
no_edges -- Optional flag indicating whether to exclude NoData cells in edge regions.
callback -... | Fills NoData holes in a DEM. | [
"Fills",
"NoData",
"holes",
"in",
"a",
"DEM",
"."
] | def fill_missing_data(self, i, output, filter=11, weight=2.0, no_edges=True, callback=None):
"""Fills NoData holes in a DEM.
Keyword arguments:
i -- Input raster file.
output -- Output raster file.
filter -- Filter size (cells).
weight -- IDW weight value.
n... | [
"def",
"fill_missing_data",
"(",
"self",
",",
"i",
",",
"output",
",",
"filter",
"=",
"11",
",",
"weight",
"=",
"2.0",
",",
"no_edges",
"=",
"True",
",",
"callback",
"=",
"None",
")",
":",
"args",
"=",
"[",
"]",
"args",
".",
"append",
"(",
"\"--inp... | https://github.com/giswqs/whitebox-python/blob/b4df0bbb10a1dee3bd0f6b3482511f7c829b38fe/whitebox/whitebox_tools.py#L2893-L2911 | |
beetbox/beets | 2fea53c34dd505ba391cb345424e0613901c8025 | extra/release.py | python | get_version | (index=0) | Read the current version from the changelog. | Read the current version from the changelog. | [
"Read",
"the",
"current",
"version",
"from",
"the",
"changelog",
"."
] | def get_version(index=0):
"""Read the current version from the changelog.
"""
with open(CHANGELOG) as f:
cur_index = 0
for line in f:
match = re.search(r'^\d+\.\d+\.\d+', line)
if match:
if cur_index == index:
return match.group(0)
... | [
"def",
"get_version",
"(",
"index",
"=",
"0",
")",
":",
"with",
"open",
"(",
"CHANGELOG",
")",
"as",
"f",
":",
"cur_index",
"=",
"0",
"for",
"line",
"in",
"f",
":",
"match",
"=",
"re",
".",
"search",
"(",
"r'^\\d+\\.\\d+\\.\\d+'",
",",
"line",
")",
... | https://github.com/beetbox/beets/blob/2fea53c34dd505ba391cb345424e0613901c8025/extra/release.py#L217-L228 | ||
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | bin/x86/Debug/scripting_engine/Lib/site-packages/lxml/__init__.py | python | get_include | () | return includes | Returns a list of header include paths (for lxml itself, libxml2
and libxslt) needed to compile C code against lxml if it was built
with statically linked libraries. | Returns a list of header include paths (for lxml itself, libxml2
and libxslt) needed to compile C code against lxml if it was built
with statically linked libraries. | [
"Returns",
"a",
"list",
"of",
"header",
"include",
"paths",
"(",
"for",
"lxml",
"itself",
"libxml2",
"and",
"libxslt",
")",
"needed",
"to",
"compile",
"C",
"code",
"against",
"lxml",
"if",
"it",
"was",
"built",
"with",
"statically",
"linked",
"libraries",
... | def get_include():
"""
Returns a list of header include paths (for lxml itself, libxml2
and libxslt) needed to compile C code against lxml if it was built
with statically linked libraries.
"""
import os
lxml_path = __path__[0]
include_path = os.path.join(lxml_path, 'includes')
includ... | [
"def",
"get_include",
"(",
")",
":",
"import",
"os",
"lxml_path",
"=",
"__path__",
"[",
"0",
"]",
"include_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"lxml_path",
",",
"'includes'",
")",
"includes",
"=",
"[",
"include_path",
",",
"lxml_path",
"]",
... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/bin/x86/Debug/scripting_engine/Lib/site-packages/lxml/__init__.py#L3-L19 | |
tensorflow/lingvo | ce10019243d954c3c3ebe739f7589b5eebfdf907 | lingvo/tasks/mt/input_generator.py | python | _GetDescriptorSetForTextInput | () | return b'bytes://' + file_descriptor_set.SerializeToString() | Returns a string for tf.io.decode_proto's descriptor_source. | Returns a string for tf.io.decode_proto's descriptor_source. | [
"Returns",
"a",
"string",
"for",
"tf",
".",
"io",
".",
"decode_proto",
"s",
"descriptor_source",
"."
] | def _GetDescriptorSetForTextInput():
"""Returns a string for tf.io.decode_proto's descriptor_source."""
file_descriptor_set = descriptor_pb2.FileDescriptorSet()
text_input_pb2.DESCRIPTOR.CopyToProto(file_descriptor_set.file.add())
return b'bytes://' + file_descriptor_set.SerializeToString() | [
"def",
"_GetDescriptorSetForTextInput",
"(",
")",
":",
"file_descriptor_set",
"=",
"descriptor_pb2",
".",
"FileDescriptorSet",
"(",
")",
"text_input_pb2",
".",
"DESCRIPTOR",
".",
"CopyToProto",
"(",
"file_descriptor_set",
".",
"file",
".",
"add",
"(",
")",
")",
"r... | https://github.com/tensorflow/lingvo/blob/ce10019243d954c3c3ebe739f7589b5eebfdf907/lingvo/tasks/mt/input_generator.py#L394-L398 | |
peering-manager/peering-manager | 62c870fb9caa6dfc056feb77c595d45bc3c4988a | utils/views.py | python | TagDetails.get | (self, request, pk) | return render(
request, "utils/tag/details.html", {"tag": tag, "items_count": tagged_items}
) | [] | def get(self, request, pk):
tag = get_object_or_404(Tag, pk=pk)
tagged_items = TaggedItem.objects.filter(tag=tag).count()
return render(
request, "utils/tag/details.html", {"tag": tag, "items_count": tagged_items}
) | [
"def",
"get",
"(",
"self",
",",
"request",
",",
"pk",
")",
":",
"tag",
"=",
"get_object_or_404",
"(",
"Tag",
",",
"pk",
"=",
"pk",
")",
"tagged_items",
"=",
"TaggedItem",
".",
"objects",
".",
"filter",
"(",
"tag",
"=",
"tag",
")",
".",
"count",
"("... | https://github.com/peering-manager/peering-manager/blob/62c870fb9caa6dfc056feb77c595d45bc3c4988a/utils/views.py#L844-L850 | |||
mckinziebrandon/DeepChatModels | 4fef8a6ce00d92235a2fb0e427d2ec60833022d2 | chatbot/legacy/legacy_models.py | python | ChatBot._get_projections | (num_buckets, unprojected_vals, projection_operator) | return projected_vals | Apply _projection operator to unprojected_vals, a tuple of length num_buckets.
:param num_buckets: the number of projections that will be applied.
:param unprojected_vals: tuple of length num_buckets.
:param projection_operator: (in the mathematical meaning) tuple of shape unprojecte... | Apply _projection operator to unprojected_vals, a tuple of length num_buckets. | [
"Apply",
"_projection",
"operator",
"to",
"unprojected_vals",
"a",
"tuple",
"of",
"length",
"num_buckets",
"."
] | def _get_projections(num_buckets, unprojected_vals, projection_operator):
"""Apply _projection operator to unprojected_vals, a tuple of length num_buckets.
:param num_buckets: the number of projections that will be applied.
:param unprojected_vals: tuple of length num_buckets.
... | [
"def",
"_get_projections",
"(",
"num_buckets",
",",
"unprojected_vals",
",",
"projection_operator",
")",
":",
"projected_vals",
"=",
"unprojected_vals",
"for",
"b",
"in",
"range",
"(",
"num_buckets",
")",
":",
"projected_vals",
"[",
"b",
"]",
"=",
"[",
"tf",
"... | https://github.com/mckinziebrandon/DeepChatModels/blob/4fef8a6ce00d92235a2fb0e427d2ec60833022d2/chatbot/legacy/legacy_models.py#L187-L199 | |
princewen/leetcode_python | 79e6e760e4d81824c96903e6c996630c24d01932 | sort_by_myself/meidum/数组/406. Queue Reconstruction by Height.py | python | Solution.reconstructQueue | (self, people) | return res | :type people: List[List[int]]
:rtype: List[List[int]] | :type people: List[List[int]]
:rtype: List[List[int]] | [
":",
"type",
"people",
":",
"List",
"[",
"List",
"[",
"int",
"]]",
":",
"rtype",
":",
"List",
"[",
"List",
"[",
"int",
"]]"
] | def reconstructQueue(self, people):
"""
:type people: List[List[int]]
:rtype: List[List[int]]
"""
if not people:
return []
peopledict, height, res = {}, [], []
for p in people:
if p[0] in peopledict:
peopledict[p[0]].append(... | [
"def",
"reconstructQueue",
"(",
"self",
",",
"people",
")",
":",
"if",
"not",
"people",
":",
"return",
"[",
"]",
"peopledict",
",",
"height",
",",
"res",
"=",
"{",
"}",
",",
"[",
"]",
",",
"[",
"]",
"for",
"p",
"in",
"people",
":",
"if",
"p",
"... | https://github.com/princewen/leetcode_python/blob/79e6e760e4d81824c96903e6c996630c24d01932/sort_by_myself/meidum/数组/406. Queue Reconstruction by Height.py#L21-L40 | |
sangwoomo/instagan | f9c1d9c9b7d2c21491317921f24a5200a02a823d | models/networks.py | python | NLayerDiscriminator.__init__ | (self, input_nc, ndf=64, n_layers=3, norm_layer=nn.BatchNorm2d, use_sigmoid=False) | [] | def __init__(self, input_nc, ndf=64, n_layers=3, norm_layer=nn.BatchNorm2d, use_sigmoid=False):
super(NLayerDiscriminator, self).__init__()
if type(norm_layer) == functools.partial:
use_bias = norm_layer.func == nn.InstanceNorm2d
else:
use_bias = norm_layer == nn.Instance... | [
"def",
"__init__",
"(",
"self",
",",
"input_nc",
",",
"ndf",
"=",
"64",
",",
"n_layers",
"=",
"3",
",",
"norm_layer",
"=",
"nn",
".",
"BatchNorm2d",
",",
"use_sigmoid",
"=",
"False",
")",
":",
"super",
"(",
"NLayerDiscriminator",
",",
"self",
")",
".",... | https://github.com/sangwoomo/instagan/blob/f9c1d9c9b7d2c21491317921f24a5200a02a823d/models/networks.py#L451-L493 | ||||
aneisch/home-assistant-config | 86e381fde9609cb8871c439c433c12989e4e225d | custom_components/hacs/base.py | python | HacsBase.handle_critical_repositories_startup | (self) | Handled critical repositories during startup. | Handled critical repositories during startup. | [
"Handled",
"critical",
"repositories",
"during",
"startup",
"."
] | async def handle_critical_repositories_startup(self) -> None:
"""Handled critical repositories during startup."""
alert = False
critical = await async_load_from_store(self.hass, "critical")
if not critical:
return
for repo in critical:
if not repo["acknowl... | [
"async",
"def",
"handle_critical_repositories_startup",
"(",
"self",
")",
"->",
"None",
":",
"alert",
"=",
"False",
"critical",
"=",
"await",
"async_load_from_store",
"(",
"self",
".",
"hass",
",",
"\"critical\"",
")",
"if",
"not",
"critical",
":",
"return",
"... | https://github.com/aneisch/home-assistant-config/blob/86e381fde9609cb8871c439c433c12989e4e225d/custom_components/hacs/base.py#L588-L601 | ||
flask-api/flask-api | 8247d4680a06c0be0436d4b9dedc8f0e68ec2830 | scent.py | python | call | (command, title, retry) | return not failure | Run a command-line program and display the result. | Run a command-line program and display the result. | [
"Run",
"a",
"command",
"-",
"line",
"program",
"and",
"display",
"the",
"result",
"."
] | def call(command, title, retry):
"""Run a command-line program and display the result."""
if Options.rerun_args:
command, title, retry = Options.rerun_args
Options.rerun_args = None
success = call(command, title, retry)
if not success:
return False
print("")
... | [
"def",
"call",
"(",
"command",
",",
"title",
",",
"retry",
")",
":",
"if",
"Options",
".",
"rerun_args",
":",
"command",
",",
"title",
",",
"retry",
"=",
"Options",
".",
"rerun_args",
"Options",
".",
"rerun_args",
"=",
"None",
"success",
"=",
"call",
"... | https://github.com/flask-api/flask-api/blob/8247d4680a06c0be0436d4b9dedc8f0e68ec2830/scent.py#L67-L83 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.