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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
qutebrowser/qutebrowser | 3a2aaaacbf97f4bf0c72463f3da94ed2822a5442 | qutebrowser/completion/models/miscmodels.py | python | process | (*, info) | return model | A CompletionModel filled with processes. | A CompletionModel filled with processes. | [
"A",
"CompletionModel",
"filled",
"with",
"processes",
"."
] | def process(*, info):
"""A CompletionModel filled with processes."""
utils.unused(info)
from qutebrowser.misc import guiprocess
model = completionmodel.CompletionModel(column_widths=(10, 10, 80))
for what, processes in itertools.groupby(
(p for p in guiprocess.all_processes.values() if p... | [
"def",
"process",
"(",
"*",
",",
"info",
")",
":",
"utils",
".",
"unused",
"(",
"info",
")",
"from",
"qutebrowser",
".",
"misc",
"import",
"guiprocess",
"model",
"=",
"completionmodel",
".",
"CompletionModel",
"(",
"column_widths",
"=",
"(",
"10",
",",
"... | https://github.com/qutebrowser/qutebrowser/blob/3a2aaaacbf97f4bf0c72463f3da94ed2822a5442/qutebrowser/completion/models/miscmodels.py#L306-L325 | |
etetoolkit/ete | 2b207357dc2a40ccad7bfd8f54964472c72e4726 | ete3/phyloxml/_phyloxml.py | python | ProteinDomain.build | (self, node) | [] | def build(self, node):
self.buildAttributes(node, node.attrib, [])
self.valueOf_ = get_all_text_(node)
for child in node:
nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
self.buildChildren(child, node, nodeName_) | [
"def",
"build",
"(",
"self",
",",
"node",
")",
":",
"self",
".",
"buildAttributes",
"(",
"node",
",",
"node",
".",
"attrib",
",",
"[",
"]",
")",
"self",
".",
"valueOf_",
"=",
"get_all_text_",
"(",
"node",
")",
"for",
"child",
"in",
"node",
":",
"no... | https://github.com/etetoolkit/ete/blob/2b207357dc2a40ccad7bfd8f54964472c72e4726/ete3/phyloxml/_phyloxml.py#L1997-L2002 | ||||
RunestoneInteractive/RunestoneServer | b20fcca5f08350224f63838250302771656f0951 | controllers/assignments.py | python | student_autograde | () | return json.dumps(res) | This is a safe endpoint that students can call from the assignment page
to get a preliminary grade on their assignment. If in coursera_mode,
the total for the assignment is calculated and stored in the db, and
sent via LTI (if LTI is configured). | This is a safe endpoint that students can call from the assignment page
to get a preliminary grade on their assignment. If in coursera_mode,
the total for the assignment is calculated and stored in the db, and
sent via LTI (if LTI is configured). | [
"This",
"is",
"a",
"safe",
"endpoint",
"that",
"students",
"can",
"call",
"from",
"the",
"assignment",
"page",
"to",
"get",
"a",
"preliminary",
"grade",
"on",
"their",
"assignment",
".",
"If",
"in",
"coursera_mode",
"the",
"total",
"for",
"the",
"assignment"... | def student_autograde():
"""
This is a safe endpoint that students can call from the assignment page
to get a preliminary grade on their assignment. If in coursera_mode,
the total for the assignment is calculated and stored in the db, and
sent via LTI (if LTI is configured).
"""
assignment_i... | [
"def",
"student_autograde",
"(",
")",
":",
"assignment_id",
"=",
"request",
".",
"vars",
".",
"assignment_id",
"timezoneoffset",
"=",
"session",
".",
"timezoneoffset",
"if",
"\"timezoneoffset\"",
"in",
"session",
"else",
"None",
"is_timed",
"=",
"request",
".",
... | https://github.com/RunestoneInteractive/RunestoneServer/blob/b20fcca5f08350224f63838250302771656f0951/controllers/assignments.py#L220-L273 | |
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/matplotlib/lines.py | python | Line2D.get_markevery | (self) | return self._markevery | return the markevery setting | return the markevery setting | [
"return",
"the",
"markevery",
"setting"
] | def get_markevery(self):
"""return the markevery setting"""
return self._markevery | [
"def",
"get_markevery",
"(",
"self",
")",
":",
"return",
"self",
".",
"_markevery"
] | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/matplotlib/lines.py#L361-L363 | |
wistbean/learn_python3_spider | 73c873f4845f4385f097e5057407d03dd37a117b | stackoverflow/venv/lib/python3.6/site-packages/OpenSSL/crypto.py | python | load_crl | (type, buffer) | return result | Load Certificate Revocation List (CRL) data from a string *buffer*.
*buffer* encoded with the type *type*.
:param type: The file type (one of FILETYPE_PEM, FILETYPE_ASN1)
:param buffer: The buffer the CRL is stored in
:return: The PKey object | Load Certificate Revocation List (CRL) data from a string *buffer*.
*buffer* encoded with the type *type*. | [
"Load",
"Certificate",
"Revocation",
"List",
"(",
"CRL",
")",
"data",
"from",
"a",
"string",
"*",
"buffer",
"*",
".",
"*",
"buffer",
"*",
"encoded",
"with",
"the",
"type",
"*",
"type",
"*",
"."
] | def load_crl(type, buffer):
"""
Load Certificate Revocation List (CRL) data from a string *buffer*.
*buffer* encoded with the type *type*.
:param type: The file type (one of FILETYPE_PEM, FILETYPE_ASN1)
:param buffer: The buffer the CRL is stored in
:return: The PKey object
"""
if isin... | [
"def",
"load_crl",
"(",
"type",
",",
"buffer",
")",
":",
"if",
"isinstance",
"(",
"buffer",
",",
"_text_type",
")",
":",
"buffer",
"=",
"buffer",
".",
"encode",
"(",
"\"ascii\"",
")",
"bio",
"=",
"_new_mem_buf",
"(",
"buffer",
")",
"if",
"type",
"==",
... | https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/OpenSSL/crypto.py#L2971-L2998 | |
linxid/Machine_Learning_Study_Path | 558e82d13237114bbb8152483977806fc0c222af | Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/importlib/_bootstrap_external.py | python | _NamespaceLoader.create_module | (self, spec) | Use default semantics for module creation. | Use default semantics for module creation. | [
"Use",
"default",
"semantics",
"for",
"module",
"creation",
"."
] | def create_module(self, spec):
"""Use default semantics for module creation.""" | [
"def",
"create_module",
"(",
"self",
",",
"spec",
")",
":"
] | https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/importlib/_bootstrap_external.py#L1035-L1036 | ||
yongxinz/tech-blog | fb50b7d1abd218df41a937f662964d1d40684a7b | rabbitmq/src/rabbitmq_status.py | python | RabbitMQMoniter.check_server | (self, item, node_name) | return 'Not Found' | check server | check server | [
"check",
"server"
] | def check_server(self, item, node_name):
"""
check server
"""
node_name = node_name.split('.')[0]
for nodeData in self.call_api('nodes'):
if node_name in nodeData['name']:
return nodeData.get(item, 0)
return 'Not Found' | [
"def",
"check_server",
"(",
"self",
",",
"item",
",",
"node_name",
")",
":",
"node_name",
"=",
"node_name",
".",
"split",
"(",
"'.'",
")",
"[",
"0",
"]",
"for",
"nodeData",
"in",
"self",
".",
"call_api",
"(",
"'nodes'",
")",
":",
"if",
"node_name",
"... | https://github.com/yongxinz/tech-blog/blob/fb50b7d1abd218df41a937f662964d1d40684a7b/rabbitmq/src/rabbitmq_status.py#L110-L118 | |
toxinu/pyhn | c36090e33ae730daa16c276e5f54c49baef2d8fe | pyhn/hnapi.py | python | HackerNewsAPI.get_stories | (self, source) | return news_stories | Looks at source, makes stories from it, returns the stories. | Looks at source, makes stories from it, returns the stories. | [
"Looks",
"at",
"source",
"makes",
"stories",
"from",
"it",
"returns",
"the",
"stories",
"."
] | def get_stories(self, source):
"""
Looks at source, makes stories from it, returns the stories.
"""
""" <td align=right valign=top class="title">31.</td> """
self.number_of_stories_on_front_page = source.count(
'span class="rank"')
# Create the empty stories.... | [
"def",
"get_stories",
"(",
"self",
",",
"source",
")",
":",
"\"\"\" <td align=right valign=top class=\"title\">31.</td> \"\"\"",
"self",
".",
"number_of_stories_on_front_page",
"=",
"source",
".",
"count",
"(",
"'span class=\"rank\"'",
")",
"# Create the empty stories.",
"new... | https://github.com/toxinu/pyhn/blob/c36090e33ae730daa16c276e5f54c49baef2d8fe/pyhn/hnapi.py#L224-L302 | |
stratosphereips/StratosphereLinuxIPS | 985ac0f141dd71fe9c6faa8307bcf95a3754951d | modules/ARP/ARP.py | python | Module.detect_unsolicited_arp | (self, profileid, twid, uid, ts, dst_mac, src_mac, dst_hw, src_hw) | Unsolicited ARP is used to update the neighbours' ARP caches but can also be used in ARP spoofing | Unsolicited ARP is used to update the neighbours' ARP caches but can also be used in ARP spoofing | [
"Unsolicited",
"ARP",
"is",
"used",
"to",
"update",
"the",
"neighbours",
"ARP",
"caches",
"but",
"can",
"also",
"be",
"used",
"in",
"ARP",
"spoofing"
] | def detect_unsolicited_arp(self, profileid, twid, uid, ts, dst_mac, src_mac, dst_hw, src_hw):
""" Unsolicited ARP is used to update the neighbours' ARP caches but can also be used in ARP spoofing """
if dst_mac=="ff:ff:ff:ff:ff:ff" and dst_hw=="ff:ff:ff:ff:ff:ff" and src_mac != '00:00:00:00:00:00' and s... | [
"def",
"detect_unsolicited_arp",
"(",
"self",
",",
"profileid",
",",
"twid",
",",
"uid",
",",
"ts",
",",
"dst_mac",
",",
"src_mac",
",",
"dst_hw",
",",
"src_hw",
")",
":",
"if",
"dst_mac",
"==",
"\"ff:ff:ff:ff:ff:ff\"",
"and",
"dst_hw",
"==",
"\"ff:ff:ff:ff:... | https://github.com/stratosphereips/StratosphereLinuxIPS/blob/985ac0f141dd71fe9c6faa8307bcf95a3754951d/modules/ARP/ARP.py#L176-L191 | ||
lisa-lab/pylearn2 | af81e5c362f0df4df85c3e54e23b2adeec026055 | pylearn2/datasets/dense_design_matrix.py | python | DenseDesignMatrix.get_batch_design | (self, batch_size, include_labels=False) | return rx | .. todo::
WRITEME
Parameters
----------
batch_size : int
WRITEME
include_labels : bool
WRITEME | .. todo:: | [
"..",
"todo",
"::"
] | def get_batch_design(self, batch_size, include_labels=False):
"""
.. todo::
WRITEME
Parameters
----------
batch_size : int
WRITEME
include_labels : bool
WRITEME
"""
try:
idx = self.rng.randint(self.X.shape[... | [
"def",
"get_batch_design",
"(",
"self",
",",
"batch_size",
",",
"include_labels",
"=",
"False",
")",
":",
"try",
":",
"idx",
"=",
"self",
".",
"rng",
".",
"randint",
"(",
"self",
".",
"X",
".",
"shape",
"[",
"0",
"]",
"-",
"batch_size",
"+",
"1",
"... | https://github.com/lisa-lab/pylearn2/blob/af81e5c362f0df4df85c3e54e23b2adeec026055/pylearn2/datasets/dense_design_matrix.py#L835-L863 | |
grantjenks/free-python-games | 3f27c6555e2c72a9b1c668c4dd8506d7b8378d09 | freegames/memory.py | python | index | (x, y) | return int((x + 200) // 50 + ((y + 200) // 50) * 8) | Convert (x, y) coordinates to tiles index. | Convert (x, y) coordinates to tiles index. | [
"Convert",
"(",
"x",
"y",
")",
"coordinates",
"to",
"tiles",
"index",
"."
] | def index(x, y):
"""Convert (x, y) coordinates to tiles index."""
return int((x + 200) // 50 + ((y + 200) // 50) * 8) | [
"def",
"index",
"(",
"x",
",",
"y",
")",
":",
"return",
"int",
"(",
"(",
"x",
"+",
"200",
")",
"//",
"50",
"+",
"(",
"(",
"y",
"+",
"200",
")",
"//",
"50",
")",
"*",
"8",
")"
] | https://github.com/grantjenks/free-python-games/blob/3f27c6555e2c72a9b1c668c4dd8506d7b8378d09/freegames/memory.py#L36-L38 | |
CPJKU/madmom | 3bc8334099feb310acfce884ebdb76a28e01670d | madmom/audio/signal.py | python | signal_frame | (signal, index, frame_size, hop_size, origin=0, pad=0) | return frame | This function returns frame at `index` of the `signal`.
Parameters
----------
signal : numpy array
Signal.
index : int
Index of the frame to return.
frame_size : int
Size of each frame in samples.
hop_size : float
Hop size in samples between adjacent frames.
... | This function returns frame at `index` of the `signal`. | [
"This",
"function",
"returns",
"frame",
"at",
"index",
"of",
"the",
"signal",
"."
] | def signal_frame(signal, index, frame_size, hop_size, origin=0, pad=0):
"""
This function returns frame at `index` of the `signal`.
Parameters
----------
signal : numpy array
Signal.
index : int
Index of the frame to return.
frame_size : int
Size of each frame in sam... | [
"def",
"signal_frame",
"(",
"signal",
",",
"index",
",",
"frame_size",
",",
"hop_size",
",",
"origin",
"=",
"0",
",",
"pad",
"=",
"0",
")",
":",
"# cast variables to int",
"frame_size",
"=",
"int",
"(",
"frame_size",
")",
"# length of the signal",
"num_samples... | https://github.com/CPJKU/madmom/blob/3bc8334099feb310acfce884ebdb76a28e01670d/madmom/audio/signal.py#L859-L961 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/rings/semirings/non_negative_integer_semiring.py | python | NonNegativeIntegerSemiring._repr_ | (self) | return "Non negative integer semiring" | r"""
EXAMPLES::
sage: NonNegativeIntegerSemiring()
Non negative integer semiring | r"""
EXAMPLES:: | [
"r",
"EXAMPLES",
"::"
] | def _repr_(self):
r"""
EXAMPLES::
sage: NonNegativeIntegerSemiring()
Non negative integer semiring
"""
return "Non negative integer semiring" | [
"def",
"_repr_",
"(",
"self",
")",
":",
"return",
"\"Non negative integer semiring\""
] | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/rings/semirings/non_negative_integer_semiring.py#L75-L82 | |
blmoistawinde/HarvestText | fae00fff2088f43a379726ef83d5c85567a9cd74 | harvesttext/resources.py | python | get_english_senti_lexicon | (type="LH") | return senti_lexicon | 获得英语情感词汇表
目前默认为来自这里的词汇表
https://www.cs.uic.edu/~liub/FBS/sentiment-analysis.html#lexicon
If you use this list, please cite the following paper:
Minqing Hu and Bing Liu. "Mining and Summarizing Customer Reviews."
Proceedings of the ACM SIGKDD International Conference on Knowledge
... | 获得英语情感词汇表 | [
"获得英语情感词汇表"
] | def get_english_senti_lexicon(type="LH"):
"""
获得英语情感词汇表
目前默认为来自这里的词汇表
https://www.cs.uic.edu/~liub/FBS/sentiment-analysis.html#lexicon
If you use this list, please cite the following paper:
Minqing Hu and Bing Liu. "Mining and Summarizing Customer Reviews."
Proceedings of the AC... | [
"def",
"get_english_senti_lexicon",
"(",
"type",
"=",
"\"LH\"",
")",
":",
"pwd",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"__file__",
")",
")",
"with",
"open",
"(",
"pwd",
"+",
"\"/resources/LH_senti_lexicon.json... | https://github.com/blmoistawinde/HarvestText/blob/fae00fff2088f43a379726ef83d5c85567a9cd74/harvesttext/resources.py#L106-L125 | |
winkidney/weixin2py | dd0fc951a592da5afc4fe010da4dc7472455db4b | weixin2py/__init__.py | python | get_atoken | (app_id, app_secret) | return None | Get AccessToken by appid and appsecret.
:param app_id:
:param app_secret: Tencent appsecret
:return: Access token.
:rtype str or unicode | Get AccessToken by appid and appsecret.
:param app_id:
:param app_secret: Tencent appsecret
:return: Access token.
:rtype str or unicode | [
"Get",
"AccessToken",
"by",
"appid",
"and",
"appsecret",
".",
":",
"param",
"app_id",
":",
":",
"param",
"app_secret",
":",
"Tencent",
"appsecret",
":",
"return",
":",
"Access",
"token",
".",
":",
"rtype",
"str",
"or",
"unicode"
] | def get_atoken(app_id, app_secret):
"""
Get AccessToken by appid and appsecret.
:param app_id:
:param app_secret: Tencent appsecret
:return: Access token.
:rtype str or unicode
"""
url = """https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%(appid)s&secret=%(apps... | [
"def",
"get_atoken",
"(",
"app_id",
",",
"app_secret",
")",
":",
"url",
"=",
"\"\"\"https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%(appid)s&secret=%(appsecret)s\"\"\"",
"%",
"{",
"'appid'",
":",
"app_id",
",",
"'appsecret'",
":",
"app_secret",
"}"... | https://github.com/winkidney/weixin2py/blob/dd0fc951a592da5afc4fe010da4dc7472455db4b/weixin2py/__init__.py#L240-L258 | |
iskandr/parakeet | d9089f999cc4a417d121970b2a447d5e524a3d3b | parakeet/lib/math.py | python | conjugate | (x) | return x | For now we don't have complex numbers so this is just the identity function | For now we don't have complex numbers so this is just the identity function | [
"For",
"now",
"we",
"don",
"t",
"have",
"complex",
"numbers",
"so",
"this",
"is",
"just",
"the",
"identity",
"function"
] | def conjugate(x):
"""
For now we don't have complex numbers so this is just the identity function
"""
return x | [
"def",
"conjugate",
"(",
"x",
")",
":",
"return",
"x"
] | https://github.com/iskandr/parakeet/blob/d9089f999cc4a417d121970b2a447d5e524a3d3b/parakeet/lib/math.py#L8-L12 | |
pyouroboros/ouroboros | fee45f2dbf6eb3fc3ddab7473ca60df515aedc1f | pyouroboros/dataexporters.py | python | DataManager.add | (self, label, socket) | [] | def add(self, label, socket):
if self.config.data_export == "prometheus" and self.enabled:
self.prometheus.update(label, socket)
elif self.config.data_export == "influxdb" and self.enabled:
if label == "all":
self.logger.debug("Total containers updated %s", self.... | [
"def",
"add",
"(",
"self",
",",
"label",
",",
"socket",
")",
":",
"if",
"self",
".",
"config",
".",
"data_export",
"==",
"\"prometheus\"",
"and",
"self",
".",
"enabled",
":",
"self",
".",
"prometheus",
".",
"update",
"(",
"label",
",",
"socket",
")",
... | https://github.com/pyouroboros/ouroboros/blob/fee45f2dbf6eb3fc3ddab7473ca60df515aedc1f/pyouroboros/dataexporters.py#L20-L28 | ||||
chromium/web-page-replay | 472351e1122bb1beb936952c7e75ae58bf8a69f1 | third_party/ipaddr/ipaddr.py | python | _BaseV6.is_unspecified | (self) | return self._ip == 0 and getattr(self, '_prefixlen', 128) == 128 | Test if the address is unspecified.
Returns:
A boolean, True if this is the unspecified address as defined in
RFC 2373 2.5.2. | Test if the address is unspecified. | [
"Test",
"if",
"the",
"address",
"is",
"unspecified",
"."
] | def is_unspecified(self):
"""Test if the address is unspecified.
Returns:
A boolean, True if this is the unspecified address as defined in
RFC 2373 2.5.2.
"""
return self._ip == 0 and getattr(self, '_prefixlen', 128) == 128 | [
"def",
"is_unspecified",
"(",
"self",
")",
":",
"return",
"self",
".",
"_ip",
"==",
"0",
"and",
"getattr",
"(",
"self",
",",
"'_prefixlen'",
",",
"128",
")",
"==",
"128"
] | https://github.com/chromium/web-page-replay/blob/472351e1122bb1beb936952c7e75ae58bf8a69f1/third_party/ipaddr/ipaddr.py#L1647-L1655 | |
nolze/msoffcrypto-tool | 01c5b23ee81bd39a37ea090af2656e6891767be7 | msoffcrypto/format/ppt97.py | python | _parseCryptSession10Container | (blob) | return CryptSession10Container(
rh=rh,
data=data,
) | [] | def _parseCryptSession10Container(blob):
# CryptSession10Container: https://docs.microsoft.com/en-us/openspecs/office_file_formats/ms-ppt/b0963334-4408-4621-879a-ef9c54551fd8
CryptSession10Container = namedtuple(
"CryptSession10Container",
[
"rh",
"data",
],
... | [
"def",
"_parseCryptSession10Container",
"(",
"blob",
")",
":",
"# CryptSession10Container: https://docs.microsoft.com/en-us/openspecs/office_file_formats/ms-ppt/b0963334-4408-4621-879a-ef9c54551fd8",
"CryptSession10Container",
"=",
"namedtuple",
"(",
"\"CryptSession10Container\"",
",",
"["... | https://github.com/nolze/msoffcrypto-tool/blob/01c5b23ee81bd39a37ea090af2656e6891767be7/msoffcrypto/format/ppt97.py#L413-L440 | |||
oracle/oci-python-sdk | 3c1604e4e212008fb6718e2f68cdb5ef71fd5793 | src/oci/database_tools/database_tools_client.py | python | DatabaseToolsClient.create_database_tools_connection | (self, create_database_tools_connection_details, **kwargs) | Creates a new DatabaseToolsConnection.
:param oci.database_tools.models.CreateDatabaseToolsConnectionDetails create_database_tools_connection_details: (required)
Details for the new DatabaseToolsConnection.
:param str opc_retry_token: (optional)
A token that uniquely identifie... | Creates a new DatabaseToolsConnection. | [
"Creates",
"a",
"new",
"DatabaseToolsConnection",
"."
] | def create_database_tools_connection(self, create_database_tools_connection_details, **kwargs):
"""
Creates a new DatabaseToolsConnection.
:param oci.database_tools.models.CreateDatabaseToolsConnectionDetails create_database_tools_connection_details: (required)
Details for the new ... | [
"def",
"create_database_tools_connection",
"(",
"self",
",",
"create_database_tools_connection_details",
",",
"*",
"*",
"kwargs",
")",
":",
"resource_path",
"=",
"\"/databaseToolsConnections\"",
"method",
"=",
"\"POST\"",
"# Don't accept unknown kwargs",
"expected_kwargs",
"=... | https://github.com/oracle/oci-python-sdk/blob/3c1604e4e212008fb6718e2f68cdb5ef71fd5793/src/oci/database_tools/database_tools_client.py#L315-L392 | ||
Alfanous-team/alfanous | 594514729473c24efa3908e3107b45a38255de4b | src/alfanous/Support/whoosh/filedb/structfile.py | python | StructFile.read_8bitfloat | (self, mantissabits=5, zeroexp=2) | return byte_to_float(self.read_byte(), mantissabits, zeroexp) | Reads a byte-sized representation of a floating point value.
:param mantissabits: the number of bits to use for the mantissa
(with the rest used for the exponent).
:param zeroexp: the zero point for the exponent. | Reads a byte-sized representation of a floating point value.
:param mantissabits: the number of bits to use for the mantissa
(with the rest used for the exponent).
:param zeroexp: the zero point for the exponent. | [
"Reads",
"a",
"byte",
"-",
"sized",
"representation",
"of",
"a",
"floating",
"point",
"value",
".",
":",
"param",
"mantissabits",
":",
"the",
"number",
"of",
"bits",
"to",
"use",
"for",
"the",
"mantissa",
"(",
"with",
"the",
"rest",
"used",
"for",
"the",... | def read_8bitfloat(self, mantissabits=5, zeroexp=2):
"""Reads a byte-sized representation of a floating point value.
:param mantissabits: the number of bits to use for the mantissa
(with the rest used for the exponent).
:param zeroexp: the zero point for the exponent.
... | [
"def",
"read_8bitfloat",
"(",
"self",
",",
"mantissabits",
"=",
"5",
",",
"zeroexp",
"=",
"2",
")",
":",
"return",
"byte_to_float",
"(",
"self",
".",
"read_byte",
"(",
")",
",",
"mantissabits",
",",
"zeroexp",
")"
] | https://github.com/Alfanous-team/alfanous/blob/594514729473c24efa3908e3107b45a38255de4b/src/alfanous/Support/whoosh/filedb/structfile.py#L178-L185 | |
davidfoerster/aptsources-cleanup | 8ea6b410be2aa7c6fa9382ae25137be71639443d | src/aptsources_cleanup/util/relations.py | python | FrozensetAltRepr.__str__ | (self) | return self._str_impl(self) | [] | def __str__(self):
return self._str_impl(self) | [
"def",
"__str__",
"(",
"self",
")",
":",
"return",
"self",
".",
"_str_impl",
"(",
"self",
")"
] | https://github.com/davidfoerster/aptsources-cleanup/blob/8ea6b410be2aa7c6fa9382ae25137be71639443d/src/aptsources_cleanup/util/relations.py#L15-L16 | |||
rhinstaller/anaconda | 63edc8680f1b05cbfe11bef28703acba808c5174 | pyanaconda/ui/gui/spokes/installation_source.py | python | SourceSpoke._get_repo_by_id | (self, repo_id) | return None | Return a repository by given name | Return a repository by given name | [
"Return",
"a",
"repository",
"by",
"given",
"name"
] | def _get_repo_by_id(self, repo_id):
""" Return a repository by given name
"""
for repo in self._repo_store:
if repo[REPO_OBJ].repo_id == repo_id:
return repo[REPO_OBJ]
return None | [
"def",
"_get_repo_by_id",
"(",
"self",
",",
"repo_id",
")",
":",
"for",
"repo",
"in",
"self",
".",
"_repo_store",
":",
"if",
"repo",
"[",
"REPO_OBJ",
"]",
".",
"repo_id",
"==",
"repo_id",
":",
"return",
"repo",
"[",
"REPO_OBJ",
"]",
"return",
"None"
] | https://github.com/rhinstaller/anaconda/blob/63edc8680f1b05cbfe11bef28703acba808c5174/pyanaconda/ui/gui/spokes/installation_source.py#L1538-L1544 | |
kanzure/nanoengineer | 874e4c9f8a9190f093625b267f9767e19f82e6c4 | cad/src/commands/BuildAtoms/BuildAtomsPropertyManager.py | python | BuildAtomsPropertyManager._moveSelectedAtom | (self, spinBoxValueJunk = None) | Move the selected atom position based on the value in the X, Y, Z
coordinate spinboxes in the Selection GroupBox.
@param spinBoxValueJunk: This is the Spinbox value from the valueChanged
signal. It is not used. We just want to know
that t... | Move the selected atom position based on the value in the X, Y, Z
coordinate spinboxes in the Selection GroupBox. | [
"Move",
"the",
"selected",
"atom",
"position",
"based",
"on",
"the",
"value",
"in",
"the",
"X",
"Y",
"Z",
"coordinate",
"spinboxes",
"in",
"the",
"Selection",
"GroupBox",
"."
] | def _moveSelectedAtom(self, spinBoxValueJunk = None):
"""
Move the selected atom position based on the value in the X, Y, Z
coordinate spinboxes in the Selection GroupBox.
@param spinBoxValueJunk: This is the Spinbox value from the valueChanged
signal. It... | [
"def",
"_moveSelectedAtom",
"(",
"self",
",",
"spinBoxValueJunk",
"=",
"None",
")",
":",
"if",
"self",
".",
"model_changed_from_glpane",
":",
"#Model is changed from glpane ,do nothing. Fixes bug 2545",
"print",
"\"bug: self.model_changed_from_glpane seen; should never happen after... | https://github.com/kanzure/nanoengineer/blob/874e4c9f8a9190f093625b267f9767e19f82e6c4/cad/src/commands/BuildAtoms/BuildAtomsPropertyManager.py#L369-L416 | ||
buke/GreenOdoo | 3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df | runtime/common/lib/python2.7/site-packages/libxml2.py | python | ValidCtxt.validatePopElement | (self, doc, elem, qname) | return ret | Pop the element end from the validation stack. | Pop the element end from the validation stack. | [
"Pop",
"the",
"element",
"end",
"from",
"the",
"validation",
"stack",
"."
] | def validatePopElement(self, doc, elem, qname):
"""Pop the element end from the validation stack. """
if doc is None: doc__o = None
else: doc__o = doc._o
if elem is None: elem__o = None
else: elem__o = elem._o
ret = libxml2mod.xmlValidatePopElement(self._o, doc__o, elem__... | [
"def",
"validatePopElement",
"(",
"self",
",",
"doc",
",",
"elem",
",",
"qname",
")",
":",
"if",
"doc",
"is",
"None",
":",
"doc__o",
"=",
"None",
"else",
":",
"doc__o",
"=",
"doc",
".",
"_o",
"if",
"elem",
"is",
"None",
":",
"elem__o",
"=",
"None",... | https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/common/lib/python2.7/site-packages/libxml2.py#L7121-L7128 | |
kernel1983/NoMagic | 4ad6e748cf1ba19857ecacad839a0ff9659e3c31 | nomagic/torndb.py | python | Connection.close | (self) | Closes this database connection. | Closes this database connection. | [
"Closes",
"this",
"database",
"connection",
"."
] | def close(self):
"""Closes this database connection."""
if getattr(self, "_db", None) is not None:
self._db.close()
self._db = None | [
"def",
"close",
"(",
"self",
")",
":",
"if",
"getattr",
"(",
"self",
",",
"\"_db\"",
",",
"None",
")",
"is",
"not",
"None",
":",
"self",
".",
"_db",
".",
"close",
"(",
")",
"self",
".",
"_db",
"=",
"None"
] | https://github.com/kernel1983/NoMagic/blob/4ad6e748cf1ba19857ecacad839a0ff9659e3c31/nomagic/torndb.py#L104-L108 | ||
replit-archive/empythoned | 977ec10ced29a3541a4973dc2b59910805695752 | dist/lib/python2.7/lib2to3/fixer_util.py | python | String | (string, prefix=None) | return Leaf(token.STRING, string, prefix=prefix) | A string leaf | A string leaf | [
"A",
"string",
"leaf"
] | def String(string, prefix=None):
"""A string leaf"""
return Leaf(token.STRING, string, prefix=prefix) | [
"def",
"String",
"(",
"string",
",",
"prefix",
"=",
"None",
")",
":",
"return",
"Leaf",
"(",
"token",
".",
"STRING",
",",
"string",
",",
"prefix",
"=",
"prefix",
")"
] | https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/dist/lib/python2.7/lib2to3/fixer_util.py#L85-L87 | |
kubernetes-client/python | 47b9da9de2d02b2b7a34fbe05afb44afd130d73a | kubernetes/client/models/v1_subject_access_review_status.py | python | V1SubjectAccessReviewStatus.__ne__ | (self, other) | return self.to_dict() != other.to_dict() | Returns true if both objects are not equal | Returns true if both objects are not equal | [
"Returns",
"true",
"if",
"both",
"objects",
"are",
"not",
"equal"
] | def __ne__(self, other):
"""Returns true if both objects are not equal"""
if not isinstance(other, V1SubjectAccessReviewStatus):
return True
return self.to_dict() != other.to_dict() | [
"def",
"__ne__",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"V1SubjectAccessReviewStatus",
")",
":",
"return",
"True",
"return",
"self",
".",
"to_dict",
"(",
")",
"!=",
"other",
".",
"to_dict",
"(",
")"
] | https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/v1_subject_access_review_status.py#L202-L207 | |
clips/pattern | d25511f9ca7ed9356b801d8663b8b5168464e68f | pattern/web/__init__.py | python | DBPedia.search | (self, query, type=SPARQL, start=1, count=10, sort=RELEVANCY, size=None, cached=False, **kwargs) | return results | Returns a list of results from DBPedia for the given SPARQL query.
- type : SPARQL,
- start: no maximum,
- count: maximum 1000,
There is a limit of 10 requests/second.
Maximum query execution time is 120 seconds. | Returns a list of results from DBPedia for the given SPARQL query.
- type : SPARQL,
- start: no maximum,
- count: maximum 1000,
There is a limit of 10 requests/second.
Maximum query execution time is 120 seconds. | [
"Returns",
"a",
"list",
"of",
"results",
"from",
"DBPedia",
"for",
"the",
"given",
"SPARQL",
"query",
".",
"-",
"type",
":",
"SPARQL",
"-",
"start",
":",
"no",
"maximum",
"-",
"count",
":",
"maximum",
"1000",
"There",
"is",
"a",
"limit",
"of",
"10",
... | def search(self, query, type=SPARQL, start=1, count=10, sort=RELEVANCY, size=None, cached=False, **kwargs):
""" Returns a list of results from DBPedia for the given SPARQL query.
- type : SPARQL,
- start: no maximum,
- count: maximum 1000,
There is a limit of 10 r... | [
"def",
"search",
"(",
"self",
",",
"query",
",",
"type",
"=",
"SPARQL",
",",
"start",
"=",
"1",
",",
"count",
"=",
"10",
",",
"sort",
"=",
"RELEVANCY",
",",
"size",
"=",
"None",
",",
"cached",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"i... | https://github.com/clips/pattern/blob/d25511f9ca7ed9356b801d8663b8b5168464e68f/pattern/web/__init__.py#L2986-L3032 | |
coderholic/pyradio | cd3ee2d6b369fedfd009371a59aca23ab39b020f | pyradio/radio.py | python | PyRadio._move_cursor_one_down | (self) | [] | def _move_cursor_one_down(self):
self._reset_status_bar_right()
if self.number_of_items > 0:
self.setStation(self.selection + 1)
self._handle_cursor_move_down() | [
"def",
"_move_cursor_one_down",
"(",
"self",
")",
":",
"self",
".",
"_reset_status_bar_right",
"(",
")",
"if",
"self",
".",
"number_of_items",
">",
"0",
":",
"self",
".",
"setStation",
"(",
"self",
".",
"selection",
"+",
"1",
")",
"self",
".",
"_handle_cur... | https://github.com/coderholic/pyradio/blob/cd3ee2d6b369fedfd009371a59aca23ab39b020f/pyradio/radio.py#L4481-L4485 | ||||
plasticityai/magnitude | 7ac0baeaf181263b661c3ae00643d21e3fd90216 | pymagnitude/third_party/allennlp/nn/regularizers/regularizer_applicator.py | python | RegularizerApplicator.__call__ | (self, module ) | return accumulator | u"""
Parameters
----------
module : torch.nn.Module, required
The module to regularize. | u"""
Parameters
----------
module : torch.nn.Module, required
The module to regularize. | [
"u",
"Parameters",
"----------",
"module",
":",
"torch",
".",
"nn",
".",
"Module",
"required",
"The",
"module",
"to",
"regularize",
"."
] | def __call__(self, module ) :
u"""
Parameters
----------
module : torch.nn.Module, required
The module to regularize.
"""
accumulator = 0.0
# For each parameter find the first matching regex.
for name, parameter i... | [
"def",
"__call__",
"(",
"self",
",",
"module",
")",
":",
"accumulator",
"=",
"0.0",
"# For each parameter find the first matching regex.",
"for",
"name",
",",
"parameter",
"in",
"module",
".",
"named_parameters",
"(",
")",
":",
"for",
"regex",
",",
"regularizer",
... | https://github.com/plasticityai/magnitude/blob/7ac0baeaf181263b661c3ae00643d21e3fd90216/pymagnitude/third_party/allennlp/nn/regularizers/regularizer_applicator.py#L27-L43 | |
bitcraze/crazyflie-lib-python | 876f0dc003b91ba5e4de05daae9d0b79cf600f81 | examples/swarm/hl-commander-swarm.py | python | activate_mellinger_controller | (scf, use_mellinger) | [] | def activate_mellinger_controller(scf, use_mellinger):
controller = 1
if use_mellinger:
controller = 2
scf.cf.param.set_value('stabilizer.controller', controller) | [
"def",
"activate_mellinger_controller",
"(",
"scf",
",",
"use_mellinger",
")",
":",
"controller",
"=",
"1",
"if",
"use_mellinger",
":",
"controller",
"=",
"2",
"scf",
".",
"cf",
".",
"param",
".",
"set_value",
"(",
"'stabilizer.controller'",
",",
"controller",
... | https://github.com/bitcraze/crazyflie-lib-python/blob/876f0dc003b91ba5e4de05daae9d0b79cf600f81/examples/swarm/hl-commander-swarm.py#L46-L50 | ||||
crocs-muni/roca | df6071d502f68701427f8b1d409cab22055ad1b7 | roca/detect.py | python | drop_empty | (arr) | return [x for x in arr if not isinstance(x, list) or len(x) > 0] | Drop empty array element
:param arr:
:return: | Drop empty array element
:param arr:
:return: | [
"Drop",
"empty",
"array",
"element",
":",
"param",
"arr",
":",
":",
"return",
":"
] | def drop_empty(arr):
"""
Drop empty array element
:param arr:
:return:
"""
return [x for x in arr if not isinstance(x, list) or len(x) > 0] | [
"def",
"drop_empty",
"(",
"arr",
")",
":",
"return",
"[",
"x",
"for",
"x",
"in",
"arr",
"if",
"not",
"isinstance",
"(",
"x",
",",
"list",
")",
"or",
"len",
"(",
"x",
")",
">",
"0",
"]"
] | https://github.com/crocs-muni/roca/blob/df6071d502f68701427f8b1d409cab22055ad1b7/roca/detect.py#L161-L167 | |
dmlc/dgl | 8d14a739bc9e446d6c92ef83eafe5782398118de | examples/pytorch/graph_matching/ged.py | python | validate_cost_functions | (G1, G2,
node_substitution_cost=None, edge_substitution_cost=None,
G1_node_deletion_cost=None, G1_edge_deletion_cost=None,
G2_node_insertion_cost=None, G2_edge_insertion_cost=None) | return node_substitution_cost, edge_substitution_cost, \
G1_node_deletion_cost, G1_edge_deletion_cost, \
G2_node_insertion_cost, G2_edge_insertion_cost | Validates cost functions (substitution, insertion, deletion) and initializes them with default=0 for substitution
and default=1 for insertion/deletion
if the provided ones are None.
Parameters : see graph_edit_distance | Validates cost functions (substitution, insertion, deletion) and initializes them with default=0 for substitution
and default=1 for insertion/deletion
if the provided ones are None. | [
"Validates",
"cost",
"functions",
"(",
"substitution",
"insertion",
"deletion",
")",
"and",
"initializes",
"them",
"with",
"default",
"=",
"0",
"for",
"substitution",
"and",
"default",
"=",
"1",
"for",
"insertion",
"/",
"deletion",
"if",
"the",
"provided",
"on... | def validate_cost_functions(G1, G2,
node_substitution_cost=None, edge_substitution_cost=None,
G1_node_deletion_cost=None, G1_edge_deletion_cost=None,
G2_node_insertion_cost=None, G2_edge_insertion_cost=None):
"""Validates cost fun... | [
"def",
"validate_cost_functions",
"(",
"G1",
",",
"G2",
",",
"node_substitution_cost",
"=",
"None",
",",
"edge_substitution_cost",
"=",
"None",
",",
"G1_node_deletion_cost",
"=",
"None",
",",
"G1_edge_deletion_cost",
"=",
"None",
",",
"G2_node_insertion_cost",
"=",
... | https://github.com/dmlc/dgl/blob/8d14a739bc9e446d6c92ef83eafe5782398118de/examples/pytorch/graph_matching/ged.py#L11-L62 | |
hypothesis/h | 25ef1b8d94889df86ace5a084f1aa0effd9f4e25 | h/migrations/versions/467ea2898660_fix_document_uri_unique_constraint.py | python | delete_conflicting_document_uris | (session) | Delete NULL DocumentURIs where there's already an empty string one.
Later we're going to be finding all DocumentURIs with NULL for their type
or content_type and changing them to empty strings. But for each one of
these NULL DocumentURIs if there is already a matching DocumentURI - same
claimant_norma... | Delete NULL DocumentURIs where there's already an empty string one. | [
"Delete",
"NULL",
"DocumentURIs",
"where",
"there",
"s",
"already",
"an",
"empty",
"string",
"one",
"."
] | def delete_conflicting_document_uris(session):
"""
Delete NULL DocumentURIs where there's already an empty string one.
Later we're going to be finding all DocumentURIs with NULL for their type
or content_type and changing them to empty strings. But for each one of
these NULL DocumentURIs if there ... | [
"def",
"delete_conflicting_document_uris",
"(",
"session",
")",
":",
"doc_uris",
"=",
"session",
".",
"query",
"(",
"DocumentURI",
")",
".",
"filter",
"(",
"sa",
".",
"or_",
"(",
"DocumentURI",
".",
"type",
"==",
"\"\"",
",",
"DocumentURI",
".",
"content_typ... | https://github.com/hypothesis/h/blob/25ef1b8d94889df86ace5a084f1aa0effd9f4e25/h/migrations/versions/467ea2898660_fix_document_uri_unique_constraint.py#L116-L172 | ||
eternnoir/pyTelegramBotAPI | fdbc0e6a619f671c2ac97afa2f694c17c6dce7d9 | telebot/__init__.py | python | TeleBot.add_chat_join_request_handler | (self, handler_dict) | Adds a chat_join_request handler
:param handler_dict:
:return: | Adds a chat_join_request handler
:param handler_dict:
:return: | [
"Adds",
"a",
"chat_join_request",
"handler",
":",
"param",
"handler_dict",
":",
":",
"return",
":"
] | def add_chat_join_request_handler(self, handler_dict):
"""
Adds a chat_join_request handler
:param handler_dict:
:return:
"""
self.chat_join_request_handlers.append(handler_dict) | [
"def",
"add_chat_join_request_handler",
"(",
"self",
",",
"handler_dict",
")",
":",
"self",
".",
"chat_join_request_handlers",
".",
"append",
"(",
"handler_dict",
")"
] | https://github.com/eternnoir/pyTelegramBotAPI/blob/fdbc0e6a619f671c2ac97afa2f694c17c6dce7d9/telebot/__init__.py#L3316-L3322 | ||
osmr/imgclsmob | f2993d3ce73a2f7ddba05da3891defb08547d504 | tensorflow2/tf2cv/models/simplepose_coco.py | python | get_simplepose | (backbone,
backbone_out_channels,
keypoints,
model_name=None,
data_format="channels_last",
pretrained=False,
root=os.path.join("~", ".tensorflow", "models"),
**kwargs) | return net | Create SimplePose model with specific parameters.
Parameters:
----------
backbone : nn.Sequential
Feature extractor.
backbone_out_channels : int
Number of output channels for the backbone.
keypoints : int
Number of keypoints.
model_name : str or None, default None
... | Create SimplePose model with specific parameters. | [
"Create",
"SimplePose",
"model",
"with",
"specific",
"parameters",
"."
] | def get_simplepose(backbone,
backbone_out_channels,
keypoints,
model_name=None,
data_format="channels_last",
pretrained=False,
root=os.path.join("~", ".tensorflow", "models"),
**kwargs):
... | [
"def",
"get_simplepose",
"(",
"backbone",
",",
"backbone_out_channels",
",",
"keypoints",
",",
"model_name",
"=",
"None",
",",
"data_format",
"=",
"\"channels_last\"",
",",
"pretrained",
"=",
"False",
",",
"root",
"=",
"os",
".",
"path",
".",
"join",
"(",
"\... | https://github.com/osmr/imgclsmob/blob/f2993d3ce73a2f7ddba05da3891defb08547d504/tensorflow2/tf2cv/models/simplepose_coco.py#L93-L144 | |
smart-mobile-software/gitstack | d9fee8f414f202143eb6e620529e8e5539a2af56 | python/Lib/urllib.py | python | thishost | () | return _thishost | Return the IP address of the current host. | Return the IP address of the current host. | [
"Return",
"the",
"IP",
"address",
"of",
"the",
"current",
"host",
"."
] | def thishost():
"""Return the IP address of the current host."""
global _thishost
if _thishost is None:
_thishost = socket.gethostbyname(socket.gethostname())
return _thishost | [
"def",
"thishost",
"(",
")",
":",
"global",
"_thishost",
"if",
"_thishost",
"is",
"None",
":",
"_thishost",
"=",
"socket",
".",
"gethostbyname",
"(",
"socket",
".",
"gethostname",
"(",
")",
")",
"return",
"_thishost"
] | https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/urllib.py#L816-L821 | |
Yonv1943/Python | ecce2153892093d7a13686e4cbfd6b323cb59de8 | ElegantRL/Beta/elegantrl/AgentZoo/ElegantRL-PER/agent.py | python | AgentD3QN.__init__ | (self, net_dim, state_dim, action_dim, learning_rate=1e-4) | Contribution of D3QN (Dueling Double DQN)
There are not contribution of D3QN.
Obviously, DoubleDQN is compatible with DuelingDQN.
Any beginner can come up with this idea (D3QN) independently. | Contribution of D3QN (Dueling Double DQN)
There are not contribution of D3QN.
Obviously, DoubleDQN is compatible with DuelingDQN.
Any beginner can come up with this idea (D3QN) independently. | [
"Contribution",
"of",
"D3QN",
"(",
"Dueling",
"Double",
"DQN",
")",
"There",
"are",
"not",
"contribution",
"of",
"D3QN",
".",
"Obviously",
"DoubleDQN",
"is",
"compatible",
"with",
"DuelingDQN",
".",
"Any",
"beginner",
"can",
"come",
"up",
"with",
"this",
"id... | def __init__(self, net_dim, state_dim, action_dim, learning_rate=1e-4):
super().__init__(net_dim, state_dim, action_dim, learning_rate)
self.explore_rate = 0.25 # epsilon-greedy, the rate of choosing random action
self.act = QNetTwinDuel(net_dim, state_dim, action_dim).to(self.device)
... | [
"def",
"__init__",
"(",
"self",
",",
"net_dim",
",",
"state_dim",
",",
"action_dim",
",",
"learning_rate",
"=",
"1e-4",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"net_dim",
",",
"state_dim",
",",
"action_dim",
",",
"learning_rate",
")",
"self",
... | https://github.com/Yonv1943/Python/blob/ecce2153892093d7a13686e4cbfd6b323cb59de8/ElegantRL/Beta/elegantrl/AgentZoo/ElegantRL-PER/agent.py#L170-L183 | ||
ParmEd/ParmEd | cd763f2e83c98ba9e51676f6dbebf0eebfd5157e | parmed/unit/unit_operators.py | python | _unit_class_rdiv | (self, other) | Divide another object type by a Unit.
Returns a new Quantity with a value of other and units
of the inverse of self. | Divide another object type by a Unit. | [
"Divide",
"another",
"object",
"type",
"by",
"a",
"Unit",
"."
] | def _unit_class_rdiv(self, other):
"""
Divide another object type by a Unit.
Returns a new Quantity with a value of other and units
of the inverse of self.
"""
if is_unit(other):
raise NotImplementedError('programmer is surprised __rtruediv__ was called instead of __truediv__')
else... | [
"def",
"_unit_class_rdiv",
"(",
"self",
",",
"other",
")",
":",
"if",
"is_unit",
"(",
"other",
")",
":",
"raise",
"NotImplementedError",
"(",
"'programmer is surprised __rtruediv__ was called instead of __truediv__'",
")",
"else",
":",
"# print \"R scalar / unit\"",
"unit... | https://github.com/ParmEd/ParmEd/blob/cd763f2e83c98ba9e51676f6dbebf0eebfd5157e/parmed/unit/unit_operators.py#L61-L74 | ||
maqp/tfc | 4bb13da1f19671e1e723db7e8a21be58847209af | src/transmitter/commands.py | python | propagate_setting_effects | (setting: str,
queues: 'QueueDict',
contact_list: 'ContactList',
group_list: 'GroupList',
settings: 'Settings',
window: 'TxWindow'
... | Propagate the effects of the setting. | Propagate the effects of the setting. | [
"Propagate",
"the",
"effects",
"of",
"the",
"setting",
"."
] | def propagate_setting_effects(setting: str,
queues: 'QueueDict',
contact_list: 'ContactList',
group_list: 'GroupList',
settings: 'Settings',
window: ... | [
"def",
"propagate_setting_effects",
"(",
"setting",
":",
"str",
",",
"queues",
":",
"'QueueDict'",
",",
"contact_list",
":",
"'ContactList'",
",",
"group_list",
":",
"'GroupList'",
",",
"settings",
":",
"'Settings'",
",",
"window",
":",
"'TxWindow'",
")",
"->",
... | https://github.com/maqp/tfc/blob/4bb13da1f19671e1e723db7e8a21be58847209af/src/transmitter/commands.py#L647-L668 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/django/db/backends/base/schema.py | python | BaseDatabaseSchemaEditor._rename_field_sql | (self, table, old_field, new_field, new_type) | return self.sql_rename_column % {
"table": self.quote_name(table),
"old_column": self.quote_name(old_field.column),
"new_column": self.quote_name(new_field.column),
"type": new_type,
} | [] | def _rename_field_sql(self, table, old_field, new_field, new_type):
return self.sql_rename_column % {
"table": self.quote_name(table),
"old_column": self.quote_name(old_field.column),
"new_column": self.quote_name(new_field.column),
"type": new_type,
} | [
"def",
"_rename_field_sql",
"(",
"self",
",",
"table",
",",
"old_field",
",",
"new_field",
",",
"new_type",
")",
":",
"return",
"self",
".",
"sql_rename_column",
"%",
"{",
"\"table\"",
":",
"self",
".",
"quote_name",
"(",
"table",
")",
",",
"\"old_column\"",... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/django/db/backends/base/schema.py#L883-L889 | |||
apache/tvm | 6eb4ed813ebcdcd9558f0906a1870db8302ff1e0 | python/tvm/relay/op/strategy/generic.py | python | wrap_compute_multibox_prior | (topi_compute) | return _compute_multibox_prior | Wrap multibox_prior compute | Wrap multibox_prior compute | [
"Wrap",
"multibox_prior",
"compute"
] | def wrap_compute_multibox_prior(topi_compute):
"""Wrap multibox_prior compute"""
def _compute_multibox_prior(attrs, inputs, _):
"""Compute definition of multibox_prior"""
sizes = get_float_tuple(attrs.sizes)
ratios = get_float_tuple(attrs.ratios)
steps = get_float_tuple(attrs.st... | [
"def",
"wrap_compute_multibox_prior",
"(",
"topi_compute",
")",
":",
"def",
"_compute_multibox_prior",
"(",
"attrs",
",",
"inputs",
",",
"_",
")",
":",
"\"\"\"Compute definition of multibox_prior\"\"\"",
"sizes",
"=",
"get_float_tuple",
"(",
"attrs",
".",
"sizes",
")"... | https://github.com/apache/tvm/blob/6eb4ed813ebcdcd9558f0906a1870db8302ff1e0/python/tvm/relay/op/strategy/generic.py#L1107-L1119 | |
OmkarPathak/pyresparser | 36f1242fbc0637a6633371ca81cf1aea4fa7497e | pyresparser/resume_parser.py | python | ResumeParser.__init__ | (
self,
resume,
skills_file=None,
custom_regex=None
) | [] | def __init__(
self,
resume,
skills_file=None,
custom_regex=None
):
nlp = spacy.load('en_core_web_sm')
custom_nlp = spacy.load(os.path.dirname(os.path.abspath(__file__)))
self.__skills_file = skills_file
self.__custom_regex = custom_regex
self._... | [
"def",
"__init__",
"(",
"self",
",",
"resume",
",",
"skills_file",
"=",
"None",
",",
"custom_regex",
"=",
"None",
")",
":",
"nlp",
"=",
"spacy",
".",
"load",
"(",
"'en_core_web_sm'",
")",
"custom_nlp",
"=",
"spacy",
".",
"load",
"(",
"os",
".",
"path",... | https://github.com/OmkarPathak/pyresparser/blob/36f1242fbc0637a6633371ca81cf1aea4fa7497e/pyresparser/resume_parser.py#L14-L48 | ||||
Jenyay/outwiker | 50530cf7b3f71480bb075b2829bc0669773b835b | plugins/markdown/markdown/markdown_plugin_libs/pygments/formatters/img.py | python | FontManager.get_char_size | (self) | return self.fonts['NORMAL'].getsize('M') | Get the character size. | Get the character size. | [
"Get",
"the",
"character",
"size",
"."
] | def get_char_size(self):
"""
Get the character size.
"""
return self.fonts['NORMAL'].getsize('M') | [
"def",
"get_char_size",
"(",
"self",
")",
":",
"return",
"self",
".",
"fonts",
"[",
"'NORMAL'",
"]",
".",
"getsize",
"(",
"'M'",
")"
] | https://github.com/Jenyay/outwiker/blob/50530cf7b3f71480bb075b2829bc0669773b835b/plugins/markdown/markdown/markdown_plugin_libs/pygments/formatters/img.py#L205-L209 | |
trakt/Plex-Trakt-Scrobbler | aeb0bfbe62fad4b06c164f1b95581da7f35dce0b | Trakttv.bundle/Contents/Libraries/Shared/sortedcontainers/sortedlist.py | python | recursive_repr | (func) | return wrapper | Decorator to prevent infinite repr recursion. | Decorator to prevent infinite repr recursion. | [
"Decorator",
"to",
"prevent",
"infinite",
"repr",
"recursion",
"."
] | def recursive_repr(func):
"""Decorator to prevent infinite repr recursion."""
repr_running = set()
@wraps(func)
def wrapper(self):
"Return ellipsis on recursive re-entry to function."
key = id(self), get_ident()
if key in repr_running:
return '...'
repr_run... | [
"def",
"recursive_repr",
"(",
"func",
")",
":",
"repr_running",
"=",
"set",
"(",
")",
"@",
"wraps",
"(",
"func",
")",
"def",
"wrapper",
"(",
"self",
")",
":",
"\"Return ellipsis on recursive re-entry to function.\"",
"key",
"=",
"id",
"(",
"self",
")",
",",
... | https://github.com/trakt/Plex-Trakt-Scrobbler/blob/aeb0bfbe62fad4b06c164f1b95581da7f35dce0b/Trakttv.bundle/Contents/Libraries/Shared/sortedcontainers/sortedlist.py#L31-L50 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/babel/support.py | python | LazyProxy.__rmod__ | (self, other) | return other % self.value | [] | def __rmod__(self, other):
return other % self.value | [
"def",
"__rmod__",
"(",
"self",
",",
"other",
")",
":",
"return",
"other",
"%",
"self",
".",
"value"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/babel/support.py#L218-L219 | |||
dpressel/mead-baseline | 9987e6b37fa6525a4ddc187c305e292a718f59a9 | layers/eight_mile/conlleval.py | python | main | () | Use as a cli tool like conlleval.pl | Use as a cli tool like conlleval.pl | [
"Use",
"as",
"a",
"cli",
"tool",
"like",
"conlleval",
".",
"pl"
] | def main():
"""Use as a cli tool like conlleval.pl"""
usage = "usage: %(prog)s [--span_type {bio,iobes,iob}] [-d delimiterTag] [-v] < file"
parser = argparse.ArgumentParser(
description="Calculate Span level F1 from the CoNLL-2000 shared task.", usage=usage
)
parser.add_argument(
"--... | [
"def",
"main",
"(",
")",
":",
"usage",
"=",
"\"usage: %(prog)s [--span_type {bio,iobes,iob}] [-d delimiterTag] [-v] < file\"",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"\"Calculate Span level F1 from the CoNLL-2000 shared task.\"",
",",
"usage",
... | https://github.com/dpressel/mead-baseline/blob/9987e6b37fa6525a4ddc187c305e292a718f59a9/layers/eight_mile/conlleval.py#L87-L111 | ||
raveberry/raveberry | df0186c94b238b57de86d3fd5c595dcd08a7c708 | backend/core/musiq/spotify_web.py | python | OAuthClient.__init__ | (
self,
base_url,
refresh_url,
client_id=None,
client_secret=None,
proxy_config=None,
expiry_margin=60,
timeout=10,
retries=3,
retry_statuses=(500, 502, 503, 429),
) | [] | def __init__(
self,
base_url,
refresh_url,
client_id=None,
client_secret=None,
proxy_config=None,
expiry_margin=60,
timeout=10,
retries=3,
retry_statuses=(500, 502, 503, 429),
):
if client_id and client_secret:
self... | [
"def",
"__init__",
"(",
"self",
",",
"base_url",
",",
"refresh_url",
",",
"client_id",
"=",
"None",
",",
"client_secret",
"=",
"None",
",",
"proxy_config",
"=",
"None",
",",
"expiry_margin",
"=",
"60",
",",
"timeout",
"=",
"10",
",",
"retries",
"=",
"3",... | https://github.com/raveberry/raveberry/blob/df0186c94b238b57de86d3fd5c595dcd08a7c708/backend/core/musiq/spotify_web.py#L52-L83 | ||||
beetbox/beets | 2fea53c34dd505ba391cb345424e0613901c8025 | beets/importer.py | python | ArchiveImportTask.extract | (self) | Extracts the archive to a temporary directory and sets
`toppath` to that directory. | Extracts the archive to a temporary directory and sets
`toppath` to that directory. | [
"Extracts",
"the",
"archive",
"to",
"a",
"temporary",
"directory",
"and",
"sets",
"toppath",
"to",
"that",
"directory",
"."
] | def extract(self):
"""Extracts the archive to a temporary directory and sets
`toppath` to that directory.
"""
for path_test, handler_class in self.handlers():
if path_test(util.py3_path(self.toppath)):
break
extract_to = mkdtemp()
archive = ha... | [
"def",
"extract",
"(",
"self",
")",
":",
"for",
"path_test",
",",
"handler_class",
"in",
"self",
".",
"handlers",
"(",
")",
":",
"if",
"path_test",
"(",
"util",
".",
"py3_path",
"(",
"self",
".",
"toppath",
")",
")",
":",
"break",
"extract_to",
"=",
... | https://github.com/beetbox/beets/blob/2fea53c34dd505ba391cb345424e0613901c8025/beets/importer.py#L1081-L1096 | ||
kivy/plyer | 7a71707bdf99979cdacf2240d823aefa13d18f00 | plyer/platforms/linux/cpu.py | python | instance | () | return CPU() | Instance for facade proxy. | Instance for facade proxy. | [
"Instance",
"for",
"facade",
"proxy",
"."
] | def instance():
'''
Instance for facade proxy.
'''
import sys
if whereis_exe('nproc'):
return LinuxCPU()
sys.stderr.write("nproc not found.")
return CPU() | [
"def",
"instance",
"(",
")",
":",
"import",
"sys",
"if",
"whereis_exe",
"(",
"'nproc'",
")",
":",
"return",
"LinuxCPU",
"(",
")",
"sys",
".",
"stderr",
".",
"write",
"(",
"\"nproc not found.\"",
")",
"return",
"CPU",
"(",
")"
] | https://github.com/kivy/plyer/blob/7a71707bdf99979cdacf2240d823aefa13d18f00/plyer/platforms/linux/cpu.py#L108-L116 | |
sloria/textblob-aptagger | fb98bbd16a83650cab4819c4b89f0973e60fb3fe | textblob_aptagger/_perceptron.py | python | AveragedPerceptron.load | (self, path) | return None | Load the pickled model weights. | Load the pickled model weights. | [
"Load",
"the",
"pickled",
"model",
"weights",
"."
] | def load(self, path):
'''Load the pickled model weights.'''
self.weights = pickle.load(open(path))
return None | [
"def",
"load",
"(",
"self",
",",
"path",
")",
":",
"self",
".",
"weights",
"=",
"pickle",
".",
"load",
"(",
"open",
"(",
"path",
")",
")",
"return",
"None"
] | https://github.com/sloria/textblob-aptagger/blob/fb98bbd16a83650cab4819c4b89f0973e60fb3fe/textblob_aptagger/_perceptron.py#L79-L82 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/pandas-0.24.2-py3.7-macosx-10.9-x86_64.egg/pandas/io/pytables.py | python | HDFStore.remove | (self, key, where=None, start=None, stop=None) | Remove pandas object partially by specifying the where condition
Parameters
----------
key : string
Node to remove or delete rows from
where : list of Term (or convertible) objects, optional
start : integer (defaults to None), row number to start selection
st... | Remove pandas object partially by specifying the where condition | [
"Remove",
"pandas",
"object",
"partially",
"by",
"specifying",
"the",
"where",
"condition"
] | def remove(self, key, where=None, start=None, stop=None):
"""
Remove pandas object partially by specifying the where condition
Parameters
----------
key : string
Node to remove or delete rows from
where : list of Term (or convertible) objects, optional
... | [
"def",
"remove",
"(",
"self",
",",
"key",
",",
"where",
"=",
"None",
",",
"start",
"=",
"None",
",",
"stop",
"=",
"None",
")",
":",
"where",
"=",
"_ensure_term",
"(",
"where",
",",
"scope_level",
"=",
"1",
")",
"try",
":",
"s",
"=",
"self",
".",
... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/pandas-0.24.2-py3.7-macosx-10.9-x86_64.egg/pandas/io/pytables.py#L891-L939 | ||
dmlc/gluon-cv | 709bc139919c02f7454cb411311048be188cde64 | scripts/datasets/ilsvrc_det.py | python | par_crop | (args) | Dataset curation,crop data and transform the format of a label | Dataset curation,crop data and transform the format of a label | [
"Dataset",
"curation",
"crop",
"data",
"and",
"transform",
"the",
"format",
"of",
"a",
"label"
] | def par_crop(args):
"""
Dataset curation,crop data and transform the format of a label
"""
crop_path = os.path.join(args.download_dir, './crop{:d}'.format(args.instance_size))
if not os.path.isdir(crop_path): makedirs(crop_path)
VID_base_path = os.path.join(args.download_dir, './ILSVRC')
ann... | [
"def",
"par_crop",
"(",
"args",
")",
":",
"crop_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"args",
".",
"download_dir",
",",
"'./crop{:d}'",
".",
"format",
"(",
"args",
".",
"instance_size",
")",
")",
"if",
"not",
"os",
".",
"path",
".",
"isdir... | https://github.com/dmlc/gluon-cv/blob/709bc139919c02f7454cb411311048be188cde64/scripts/datasets/ilsvrc_det.py#L77-L97 | ||
mrJean1/PyGeodesy | 7da5ca71aa3edb7bc49e219e0b8190686e1a7965 | pygeodesy/sphericalNvector.py | python | perimeterOf | (points, closed=False, radius=R_M) | return r if radius is None else (Radius(radius) * r) | Compute the perimeter of a (spherical) polygon (with great circle
arcs joining consecutive points).
@arg points: The polygon points (L{LatLon}[]).
@kwarg closed: Optionally, close the polygon (C{bool}).
@kwarg radius: Mean earth radius (C{meter}) or C{None}.
@return: Polygon perimet... | Compute the perimeter of a (spherical) polygon (with great circle
arcs joining consecutive points). | [
"Compute",
"the",
"perimeter",
"of",
"a",
"(",
"spherical",
")",
"polygon",
"(",
"with",
"great",
"circle",
"arcs",
"joining",
"consecutive",
"points",
")",
"."
] | def perimeterOf(points, closed=False, radius=R_M):
'''Compute the perimeter of a (spherical) polygon (with great circle
arcs joining consecutive points).
@arg points: The polygon points (L{LatLon}[]).
@kwarg closed: Optionally, close the polygon (C{bool}).
@kwarg radius: Mean earth radi... | [
"def",
"perimeterOf",
"(",
"points",
",",
"closed",
"=",
"False",
",",
"radius",
"=",
"R_M",
")",
":",
"def",
"_rads",
"(",
"Ps",
",",
"closed",
")",
":",
"# angular edge lengths in radians",
"v1",
"=",
"Ps",
"[",
"0",
"]",
".",
"_N_vector",
"for",
"p"... | https://github.com/mrJean1/PyGeodesy/blob/7da5ca71aa3edb7bc49e219e0b8190686e1a7965/pygeodesy/sphericalNvector.py#L1024-L1050 | |
lovelylain/pyctp | fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d | example/ctp/futures/ApiStruct.py | python | QryCFMMCTradingAccountKey.__init__ | (self, BrokerID='', InvestorID='') | [] | def __init__(self, BrokerID='', InvestorID=''):
self.BrokerID = '' #经纪公司代码, char[11]
self.InvestorID = '' | [
"def",
"__init__",
"(",
"self",
",",
"BrokerID",
"=",
"''",
",",
"InvestorID",
"=",
"''",
")",
":",
"self",
".",
"BrokerID",
"=",
"''",
"#经纪公司代码, char[11]",
"self",
".",
"InvestorID",
"=",
"''"
] | https://github.com/lovelylain/pyctp/blob/fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d/example/ctp/futures/ApiStruct.py#L4712-L4714 | ||||
fabioz/PyDev.Debugger | 0f8c02a010fe5690405da1dd30ed72326191ce63 | third_party/pep8/autopep8.py | python | _get_indentword | (source) | return indent_word | Return indentation type. | Return indentation type. | [
"Return",
"indentation",
"type",
"."
] | def _get_indentword(source):
"""Return indentation type."""
indent_word = ' ' # Default in case source has no indentation
try:
for t in generate_tokens(source):
if t[0] == token.INDENT:
indent_word = t[1]
break
except (SyntaxError, tokenize.TokenEr... | [
"def",
"_get_indentword",
"(",
"source",
")",
":",
"indent_word",
"=",
"' '",
"# Default in case source has no indentation",
"try",
":",
"for",
"t",
"in",
"generate_tokens",
"(",
"source",
")",
":",
"if",
"t",
"[",
"0",
"]",
"==",
"token",
".",
"INDENT",
... | https://github.com/fabioz/PyDev.Debugger/blob/0f8c02a010fe5690405da1dd30ed72326191ce63/third_party/pep8/autopep8.py#L1417-L1427 | |
openfisca/openfisca-france | 207a58191be6830716693f94d37846f1e5037b51 | openfisca_france/model/prelevements_obligatoires/isf.py | python | isf_inv_pme.formula_2008 | (foyer_fiscal, period, parameters) | return holdings + fip + fcpi + inv_dir_soc | Réductions pour investissements dans les PME
à partir de 2008! | Réductions pour investissements dans les PME
à partir de 2008! | [
"Réductions",
"pour",
"investissements",
"dans",
"les",
"PME",
"à",
"partir",
"de",
"2008!"
] | def formula_2008(foyer_fiscal, period, parameters):
'''
Réductions pour investissements dans les PME
à partir de 2008!
'''
b2mt = foyer_fiscal('b2mt', period)
b2ne = foyer_fiscal('b2ne', period)
b2mv = foyer_fiscal('b2mv', period)
b2nf = foyer_fiscal('b2nf... | [
"def",
"formula_2008",
"(",
"foyer_fiscal",
",",
"period",
",",
"parameters",
")",
":",
"b2mt",
"=",
"foyer_fiscal",
"(",
"'b2mt'",
",",
"period",
")",
"b2ne",
"=",
"foyer_fiscal",
"(",
"'b2ne'",
",",
"period",
")",
"b2mv",
"=",
"foyer_fiscal",
"(",
"'b2mv... | https://github.com/openfisca/openfisca-france/blob/207a58191be6830716693f94d37846f1e5037b51/openfisca_france/model/prelevements_obligatoires/isf.py#L395-L413 | |
davidemms/OrthoFinder | d92c016ccb17be39787614018694844a2c673173 | scripts_of/tree.py | python | TreeNode.is_leaf | (self) | return len(self.children) == 0 | Return True if current node is a leaf. | Return True if current node is a leaf. | [
"Return",
"True",
"if",
"current",
"node",
"is",
"a",
"leaf",
"."
] | def is_leaf(self):
"""
Return True if current node is a leaf.
"""
return len(self.children) == 0 | [
"def",
"is_leaf",
"(",
"self",
")",
":",
"return",
"len",
"(",
"self",
".",
"children",
")",
"==",
"0"
] | https://github.com/davidemms/OrthoFinder/blob/d92c016ccb17be39787614018694844a2c673173/scripts_of/tree.py#L944-L948 | |
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | lib/idna/uts46data.py | python | _seg_63 | () | return [
(0x1D4FC, 'M', 's'),
(0x1D4FD, 'M', 't'),
(0x1D4FE, 'M', 'u'),
(0x1D4FF, 'M', 'v'),
(0x1D500, 'M', 'w'),
(0x1D501, 'M', 'x'),
(0x1D502, 'M', 'y'),
(0x1D503, 'M', 'z'),
(0x1D504, 'M', 'a'),
(0x1D505, 'M', 'b'),
(0x1D506, 'X'),
(0x1D507, 'M', 'd'),
(0x1D508, 'M... | [] | def _seg_63() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]:
return [
(0x1D4FC, 'M', 's'),
(0x1D4FD, 'M', 't'),
(0x1D4FE, 'M', 'u'),
(0x1D4FF, 'M', 'v'),
(0x1D500, 'M', 'w'),
(0x1D501, 'M', 'x'),
(0x1D502, 'M', 'y'),
(0x1D503, 'M', 'z'),
(0x1D504, 'M', 'a'),
(0x1D505,... | [
"def",
"_seg_63",
"(",
")",
"->",
"List",
"[",
"Union",
"[",
"Tuple",
"[",
"int",
",",
"str",
"]",
",",
"Tuple",
"[",
"int",
",",
"str",
",",
"str",
"]",
"]",
"]",
":",
"return",
"[",
"(",
"0x1D4FC",
",",
"'M'",
",",
"'s'",
")",
",",
"(",
"... | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/idna/uts46data.py#L6563-L6665 | |||
MrH0wl/Cloudmare | 65e5bc9888f9d362ab2abfb103ea6c1e869d67aa | thirdparty/bs4/dammit.py | python | UnicodeDammit._to_unicode | (self, data, encoding, errors="strict") | return str(data, encoding, errors) | Given a string and its encoding, decodes the string into Unicode.
:param encoding: The name of an encoding. | Given a string and its encoding, decodes the string into Unicode. | [
"Given",
"a",
"string",
"and",
"its",
"encoding",
"decodes",
"the",
"string",
"into",
"Unicode",
"."
] | def _to_unicode(self, data, encoding, errors="strict"):
"""Given a string and its encoding, decodes the string into Unicode.
:param encoding: The name of an encoding.
"""
return str(data, encoding, errors) | [
"def",
"_to_unicode",
"(",
"self",
",",
"data",
",",
"encoding",
",",
"errors",
"=",
"\"strict\"",
")",
":",
"return",
"str",
"(",
"data",
",",
"encoding",
",",
"errors",
")"
] | https://github.com/MrH0wl/Cloudmare/blob/65e5bc9888f9d362ab2abfb103ea6c1e869d67aa/thirdparty/bs4/dammit.py#L521-L526 | |
PaddlePaddle/Parakeet | 8705a2a8405e3c63f2174d69880d2b5525a6c9fd | parakeet/modules/conv.py | python | Conv1dCell.start_sequence | (self) | Prepare the layer for a series of incremental forward.
Warnings
---------
This method should be called before a sequence of calls to
``add_input``.
Raises
------
Exception
If this method is called when the layer is in training mode. | Prepare the layer for a series of incremental forward.
Warnings
---------
This method should be called before a sequence of calls to
``add_input``. | [
"Prepare",
"the",
"layer",
"for",
"a",
"series",
"of",
"incremental",
"forward",
".",
"Warnings",
"---------",
"This",
"method",
"should",
"be",
"called",
"before",
"a",
"sequence",
"of",
"calls",
"to",
"add_input",
"."
] | def start_sequence(self):
"""Prepare the layer for a series of incremental forward.
Warnings
---------
This method should be called before a sequence of calls to
``add_input``.
Raises
------
Exception
If this method is called when the... | [
"def",
"start_sequence",
"(",
"self",
")",
":",
"if",
"self",
".",
"training",
":",
"raise",
"Exception",
"(",
"\"only use start_sequence in evaluation\"",
")",
"self",
".",
"_buffer",
"=",
"None",
"# NOTE: call self's weight norm hook expliccitly since self.weight ",
"# ... | https://github.com/PaddlePaddle/Parakeet/blob/8705a2a8405e3c63f2174d69880d2b5525a6c9fd/parakeet/modules/conv.py#L103-L128 | ||
PyTorchLightning/pytorch-lightning | 5914fb748fb53d826ab337fc2484feab9883a104 | pytorch_lightning/plugins/environments/lsf_environment.py | python | LSFEnvironment._read_hosts | () | return ret[1:] | Read compute hosts that are a part of the compute job.
LSF uses the Job Step Manager (JSM) to manage job steps. Job steps are executed by the JSM from "launch" nodes.
Each job is assigned a launch node. This launch node will be the first node in the list contained in
``LSB_DJOB_RANKFILE``. | Read compute hosts that are a part of the compute job. | [
"Read",
"compute",
"hosts",
"that",
"are",
"a",
"part",
"of",
"the",
"compute",
"job",
"."
] | def _read_hosts() -> List[str]:
"""Read compute hosts that are a part of the compute job.
LSF uses the Job Step Manager (JSM) to manage job steps. Job steps are executed by the JSM from "launch" nodes.
Each job is assigned a launch node. This launch node will be the first node in the list conta... | [
"def",
"_read_hosts",
"(",
")",
"->",
"List",
"[",
"str",
"]",
":",
"var",
"=",
"\"LSB_DJOB_RANKFILE\"",
"rankfile",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"var",
")",
"if",
"rankfile",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"Did not find ... | https://github.com/PyTorchLightning/pytorch-lightning/blob/5914fb748fb53d826ab337fc2484feab9883a104/pytorch_lightning/plugins/environments/lsf_environment.py#L146-L164 | |
gammapy/gammapy | 735b25cd5bbed35e2004d633621896dcd5295e8b | gammapy/datasets/map.py | python | MapDataset.to_hdulist | (self) | return hdulist | Convert map dataset to list of HDUs.
Returns
-------
hdulist : `~astropy.io.fits.HDUList`
Map dataset list of HDUs. | Convert map dataset to list of HDUs. | [
"Convert",
"map",
"dataset",
"to",
"list",
"of",
"HDUs",
"."
] | def to_hdulist(self):
"""Convert map dataset to list of HDUs.
Returns
-------
hdulist : `~astropy.io.fits.HDUList`
Map dataset list of HDUs.
"""
# TODO: what todo about the model and background model parameters?
exclude_primary = slice(1, None)
... | [
"def",
"to_hdulist",
"(",
"self",
")",
":",
"# TODO: what todo about the model and background model parameters?",
"exclude_primary",
"=",
"slice",
"(",
"1",
",",
"None",
")",
"hdu_primary",
"=",
"fits",
".",
"PrimaryHDU",
"(",
")",
"hdulist",
"=",
"fits",
".",
"HD... | https://github.com/gammapy/gammapy/blob/735b25cd5bbed35e2004d633621896dcd5295e8b/gammapy/datasets/map.py#L999-L1036 | |
matplotlib/matplotlib | 8d7a2b9d2a38f01ee0d6802dd4f9e98aec812322 | lib/matplotlib/backend_bases.py | python | GraphicsContextBase.set_foreground | (self, fg, isRGBA=False) | Set the foreground color.
Parameters
----------
fg : color
isRGBA : bool
If *fg* is known to be an ``(r, g, b, a)`` tuple, *isRGBA* can be
set to True to improve performance. | Set the foreground color. | [
"Set",
"the",
"foreground",
"color",
"."
] | def set_foreground(self, fg, isRGBA=False):
"""
Set the foreground color.
Parameters
----------
fg : color
isRGBA : bool
If *fg* is known to be an ``(r, g, b, a)`` tuple, *isRGBA* can be
set to True to improve performance.
"""
if s... | [
"def",
"set_foreground",
"(",
"self",
",",
"fg",
",",
"isRGBA",
"=",
"False",
")",
":",
"if",
"self",
".",
"_forced_alpha",
"and",
"isRGBA",
":",
"self",
".",
"_rgb",
"=",
"fg",
"[",
":",
"3",
"]",
"+",
"(",
"self",
".",
"_alpha",
",",
")",
"elif... | https://github.com/matplotlib/matplotlib/blob/8d7a2b9d2a38f01ee0d6802dd4f9e98aec812322/lib/matplotlib/backend_bases.py#L930-L948 | ||
hzdg/django-enumfields | bda0a461657a87601d235d78176add73a8875832 | enumfields/enums.py | python | Enum.choices | (cls) | return tuple((m.value, m.label) for m in cls) | Returns a list formatted for use as field choices.
(See https://docs.djangoproject.com/en/dev/ref/models/fields/#choices) | Returns a list formatted for use as field choices.
(See https://docs.djangoproject.com/en/dev/ref/models/fields/#choices) | [
"Returns",
"a",
"list",
"formatted",
"for",
"use",
"as",
"field",
"choices",
".",
"(",
"See",
"https",
":",
"//",
"docs",
".",
"djangoproject",
".",
"com",
"/",
"en",
"/",
"dev",
"/",
"ref",
"/",
"models",
"/",
"fields",
"/",
"#choices",
")"
] | def choices(cls):
"""
Returns a list formatted for use as field choices.
(See https://docs.djangoproject.com/en/dev/ref/models/fields/#choices)
"""
return tuple((m.value, m.label) for m in cls) | [
"def",
"choices",
"(",
"cls",
")",
":",
"return",
"tuple",
"(",
"(",
"m",
".",
"value",
",",
"m",
".",
"label",
")",
"for",
"m",
"in",
"cls",
")"
] | https://github.com/hzdg/django-enumfields/blob/bda0a461657a87601d235d78176add73a8875832/enumfields/enums.py#L34-L39 | |
kubernetes-client/python | 47b9da9de2d02b2b7a34fbe05afb44afd130d73a | kubernetes/client/models/v1_custom_resource_definition_names.py | python | V1CustomResourceDefinitionNames.kind | (self) | return self._kind | Gets the kind of this V1CustomResourceDefinitionNames. # noqa: E501
kind is the serialized kind of the resource. It is normally CamelCase and singular. Custom resource instances will use this value as the `kind` attribute in API calls. # noqa: E501
:return: The kind of this V1CustomResourceDefinitio... | Gets the kind of this V1CustomResourceDefinitionNames. # noqa: E501 | [
"Gets",
"the",
"kind",
"of",
"this",
"V1CustomResourceDefinitionNames",
".",
"#",
"noqa",
":",
"E501"
] | def kind(self):
"""Gets the kind of this V1CustomResourceDefinitionNames. # noqa: E501
kind is the serialized kind of the resource. It is normally CamelCase and singular. Custom resource instances will use this value as the `kind` attribute in API calls. # noqa: E501
:return: The kind of thi... | [
"def",
"kind",
"(",
"self",
")",
":",
"return",
"self",
".",
"_kind"
] | https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/v1_custom_resource_definition_names.py#L102-L110 | |
FederatedAI/FATE | 32540492623568ecd1afcb367360133616e02fa3 | python/federatedml/model_selection/stepwise/hetero_stepwise.py | python | HeteroStepwise.mask2string | (host_mask, guest_mask) | return string_repr | [] | def mask2string(host_mask, guest_mask):
mask = np.append(host_mask, guest_mask)
string_repr = ''.join('1' if i else '0' for i in mask)
return string_repr | [
"def",
"mask2string",
"(",
"host_mask",
",",
"guest_mask",
")",
":",
"mask",
"=",
"np",
".",
"append",
"(",
"host_mask",
",",
"guest_mask",
")",
"string_repr",
"=",
"''",
".",
"join",
"(",
"'1'",
"if",
"i",
"else",
"'0'",
"for",
"i",
"in",
"mask",
")... | https://github.com/FederatedAI/FATE/blob/32540492623568ecd1afcb367360133616e02fa3/python/federatedml/model_selection/stepwise/hetero_stepwise.py#L366-L369 | |||
loli/medpy | 39131b94f0ab5328ab14a874229320efc2f74d98 | medpy/features/intensity.py | python | centerdistance_xdminus1 | (image, dim, voxelspacing = None, mask = slice(None)) | return intensities(o, mask) | r"""
Implementation of `centerdistance` that allows to compute sub-volume wise
centerdistances.
The same notes as for `centerdistance` apply.
Parameters
----------
image : array_like or list/tuple of array_like
A single image or a list/tuple of images (for multi-spectral case)... | r"""
Implementation of `centerdistance` that allows to compute sub-volume wise
centerdistances.
The same notes as for `centerdistance` apply.
Parameters
----------
image : array_like or list/tuple of array_like
A single image or a list/tuple of images (for multi-spectral case)... | [
"r",
"Implementation",
"of",
"centerdistance",
"that",
"allows",
"to",
"compute",
"sub",
"-",
"volume",
"wise",
"centerdistances",
".",
"The",
"same",
"notes",
"as",
"for",
"centerdistance",
"apply",
".",
"Parameters",
"----------",
"image",
":",
"array_like",
"... | def centerdistance_xdminus1(image, dim, voxelspacing = None, mask = slice(None)):
r"""
Implementation of `centerdistance` that allows to compute sub-volume wise
centerdistances.
The same notes as for `centerdistance` apply.
Parameters
----------
image : array_like or list/tuple of ... | [
"def",
"centerdistance_xdminus1",
"(",
"image",
",",
"dim",
",",
"voxelspacing",
"=",
"None",
",",
"mask",
"=",
"slice",
"(",
"None",
")",
")",
":",
"# pre-process arguments",
"if",
"type",
"(",
"image",
")",
"==",
"tuple",
"or",
"type",
"(",
"image",
")... | https://github.com/loli/medpy/blob/39131b94f0ab5328ab14a874229320efc2f74d98/medpy/features/intensity.py#L98-L167 | |
Project-MONAI/MONAI | 83f8b06372a3803ebe9281300cb794a1f3395018 | monai/networks/nets/efficientnet.py | python | BlockArgs.to_string | (self) | return string | Return a block string notation for current BlockArgs object
Returns:
A string notation of BlockArgs object arguments.
Example: "r1_k3_s11_e1_i32_o16_se0.25_noskip". | Return a block string notation for current BlockArgs object | [
"Return",
"a",
"block",
"string",
"notation",
"for",
"current",
"BlockArgs",
"object"
] | def to_string(self):
"""
Return a block string notation for current BlockArgs object
Returns:
A string notation of BlockArgs object arguments.
Example: "r1_k3_s11_e1_i32_o16_se0.25_noskip".
"""
string = "r{}_k{}_s{}{}_e{}_i{}_o{}_se{}".format(
... | [
"def",
"to_string",
"(",
"self",
")",
":",
"string",
"=",
"\"r{}_k{}_s{}{}_e{}_i{}_o{}_se{}\"",
".",
"format",
"(",
"self",
".",
"num_repeat",
",",
"self",
".",
"kernel_size",
",",
"self",
".",
"stride",
",",
"self",
".",
"stride",
",",
"self",
".",
"expan... | https://github.com/Project-MONAI/MONAI/blob/83f8b06372a3803ebe9281300cb794a1f3395018/monai/networks/nets/efficientnet.py#L922-L943 | |
mapnik/Cascadenik | 82f66859340a31dfcb24af127274f262d4f3ad85 | cascadenik/nonposix.py | python | add_drive_by_hash | (drive,valid_posix_path) | [] | def add_drive_by_hash(drive,valid_posix_path):
# cache the drive so we can try to recreate later
global drives
hash = md5(valid_posix_path).hexdigest()[:8]
drives[hash] = drive | [
"def",
"add_drive_by_hash",
"(",
"drive",
",",
"valid_posix_path",
")",
":",
"# cache the drive so we can try to recreate later",
"global",
"drives",
"hash",
"=",
"md5",
"(",
"valid_posix_path",
")",
".",
"hexdigest",
"(",
")",
"[",
":",
"8",
"]",
"drives",
"[",
... | https://github.com/mapnik/Cascadenik/blob/82f66859340a31dfcb24af127274f262d4f3ad85/cascadenik/nonposix.py#L30-L34 | ||||
Cadene/pretrained-models.pytorch | 8aae3d8f1135b6b13fed79c1d431e3449fdbf6e0 | pretrainedmodels/models/torchvision_models.py | python | update_state_dict | (state_dict) | return state_dict | [] | def update_state_dict(state_dict):
# '.'s are no longer allowed in module names, but pervious _DenseLayer
# has keys 'norm.1', 'relu.1', 'conv.1', 'norm.2', 'relu.2', 'conv.2'.
# They are also in the checkpoints in model_urls. This pattern is used
# to find such keys.
pattern = re.compile(
r... | [
"def",
"update_state_dict",
"(",
"state_dict",
")",
":",
"# '.'s are no longer allowed in module names, but pervious _DenseLayer",
"# has keys 'norm.1', 'relu.1', 'conv.1', 'norm.2', 'relu.2', 'conv.2'.",
"# They are also in the checkpoints in model_urls. This pattern is used",
"# to find such key... | https://github.com/Cadene/pretrained-models.pytorch/blob/8aae3d8f1135b6b13fed79c1d431e3449fdbf6e0/pretrainedmodels/models/torchvision_models.py#L98-L111 | |||
airbnb/streamalert | 26cf1d08432ca285fd4f7410511a6198ca104bbb | streamalert_cli/athena/handler.py | python | rebuild_partitions | (table, bucket, config) | return True | Rebuild an Athena table's partitions
Steps:
- Get the list of current partitions
- Destroy existing table
- Re-create tables
- Re-create partitions
Args:
table (str): The name of the table being rebuilt
bucket (str): The s3 bucket to be used as the location for Athena d... | Rebuild an Athena table's partitions | [
"Rebuild",
"an",
"Athena",
"table",
"s",
"partitions"
] | def rebuild_partitions(table, bucket, config):
"""Rebuild an Athena table's partitions
Steps:
- Get the list of current partitions
- Destroy existing table
- Re-create tables
- Re-create partitions
Args:
table (str): The name of the table being rebuilt
bucket (str):... | [
"def",
"rebuild_partitions",
"(",
"table",
",",
"bucket",
",",
"config",
")",
":",
"sanitized_table_name",
"=",
"FirehoseClient",
".",
"sanitized_value",
"(",
"table",
")",
"athena_client",
"=",
"get_athena_client",
"(",
"config",
")",
"# Get the current set of partit... | https://github.com/airbnb/streamalert/blob/26cf1d08432ca285fd4f7410511a6198ca104bbb/streamalert_cli/athena/handler.py#L219-L273 | |
plone/Products.CMFPlone | 83137764e3e7e4fe60d03c36dfc6ba9c7c543324 | Products/CMFPlone/interfaces/patterns.py | python | IPatternsSettings.__call__ | (self) | Return a dict of pattern options | Return a dict of pattern options | [
"Return",
"a",
"dict",
"of",
"pattern",
"options"
] | def __call__(self):
"""
Return a dict of pattern options
"""
pass | [
"def",
"__call__",
"(",
"self",
")",
":",
"pass"
] | https://github.com/plone/Products.CMFPlone/blob/83137764e3e7e4fe60d03c36dfc6ba9c7c543324/Products/CMFPlone/interfaces/patterns.py#L8-L12 | ||
realpython/book2-exercises | cde325eac8e6d8cff2316601c2e5b36bb46af7d0 | web2py/gluon/contrib/feedparser.py | python | _parse_date_iso8601 | (dateString) | return time.localtime(time.mktime(tuple(tm))) | Parse a variety of ISO-8601-compatible formats like 20040105 | Parse a variety of ISO-8601-compatible formats like 20040105 | [
"Parse",
"a",
"variety",
"of",
"ISO",
"-",
"8601",
"-",
"compatible",
"formats",
"like",
"20040105"
] | def _parse_date_iso8601(dateString):
'''Parse a variety of ISO-8601-compatible formats like 20040105'''
m = None
for _iso8601_match in _iso8601_matches:
m = _iso8601_match(dateString)
if m:
break
if not m:
return
if m.span() == (0, 0):
return
params = ... | [
"def",
"_parse_date_iso8601",
"(",
"dateString",
")",
":",
"m",
"=",
"None",
"for",
"_iso8601_match",
"in",
"_iso8601_matches",
":",
"m",
"=",
"_iso8601_match",
"(",
"dateString",
")",
"if",
"m",
":",
"break",
"if",
"not",
"m",
":",
"return",
"if",
"m",
... | https://github.com/realpython/book2-exercises/blob/cde325eac8e6d8cff2316601c2e5b36bb46af7d0/web2py/gluon/contrib/feedparser.py#L3004-L3080 | |
spectacles/CodeComplice | 8ca8ee4236f72b58caa4209d2fbd5fa56bd31d62 | libs/elementtree/ElementTree.py | python | SubElement | (parent, tag, attrib={}, **extra) | return element | [] | def SubElement(parent, tag, attrib={}, **extra):
attrib = attrib.copy()
attrib.update(extra)
element = parent.makeelement(tag, attrib)
parent.append(element)
return element | [
"def",
"SubElement",
"(",
"parent",
",",
"tag",
",",
"attrib",
"=",
"{",
"}",
",",
"*",
"*",
"extra",
")",
":",
"attrib",
"=",
"attrib",
".",
"copy",
"(",
")",
"attrib",
".",
"update",
"(",
"extra",
")",
"element",
"=",
"parent",
".",
"makeelement"... | https://github.com/spectacles/CodeComplice/blob/8ca8ee4236f72b58caa4209d2fbd5fa56bd31d62/libs/elementtree/ElementTree.py#L471-L476 | |||
andresriancho/w3af | cd22e5252243a87aaa6d0ddea47cf58dacfe00a9 | w3af/core/ui/gui/history.py | python | HistorySuggestion.get_texts | (self) | return [k for k, v in info] | Provides the texts, ordered by relevance.
:return: a generator with the texts | Provides the texts, ordered by relevance. | [
"Provides",
"the",
"texts",
"ordered",
"by",
"relevance",
"."
] | def get_texts(self):
"""Provides the texts, ordered by relevance.
:return: a generator with the texts
"""
info = sorted(
self.history.items(), key=operator.itemgetter(1), reverse=True)
return [k for k, v in info] | [
"def",
"get_texts",
"(",
"self",
")",
":",
"info",
"=",
"sorted",
"(",
"self",
".",
"history",
".",
"items",
"(",
")",
",",
"key",
"=",
"operator",
".",
"itemgetter",
"(",
"1",
")",
",",
"reverse",
"=",
"True",
")",
"return",
"[",
"k",
"for",
"k"... | https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/core/ui/gui/history.py#L71-L78 | |
mypaint/mypaint | 90b36dbc7b8bd2f323383f7edf608a5e0a3a1a33 | gui/document.py | python | Document._update_undo_redo | (self, action, stack, cmd_str, plain_str) | Set label, tooltip and sensitivity | Set label, tooltip and sensitivity | [
"Set",
"label",
"tooltip",
"and",
"sensitivity"
] | def _update_undo_redo(self, action, stack, cmd_str, plain_str):
"""Set label, tooltip and sensitivity"""
if len(stack) > 0:
cmd = stack[-1]
desc = cmd_str % cmd.display_name
else:
desc = plain_str
action.set_label(desc)
action.set_tooltip(desc)... | [
"def",
"_update_undo_redo",
"(",
"self",
",",
"action",
",",
"stack",
",",
"cmd_str",
",",
"plain_str",
")",
":",
"if",
"len",
"(",
"stack",
")",
">",
"0",
":",
"cmd",
"=",
"stack",
"[",
"-",
"1",
"]",
"desc",
"=",
"cmd_str",
"%",
"cmd",
".",
"di... | https://github.com/mypaint/mypaint/blob/90b36dbc7b8bd2f323383f7edf608a5e0a3a1a33/gui/document.py#L554-L563 | ||
makerbot/ReplicatorG | d6f2b07785a5a5f1e172fb87cb4303b17c575d5d | skein_engines/skeinforge-47/fabmetheus_utilities/geometry/creation/linear_bearing_cage.py | python | getGeometryOutput | (elementNode) | return extrude.getGeometryOutputByNegativesPositives(elementNode, negatives, positives) | Get vector3 vertexes from attribute dictionary. | Get vector3 vertexes from attribute dictionary. | [
"Get",
"vector3",
"vertexes",
"from",
"attribute",
"dictionary",
"."
] | def getGeometryOutput(elementNode):
'Get vector3 vertexes from attribute dictionary.'
derivation = LinearBearingCageDerivation(elementNode)
negatives = []
positives = []
if derivation.typeStringFirstCharacter == 'a':
addAssemblyCage(derivation, negatives, positives)
else:
addCage(derivation, derivation.height... | [
"def",
"getGeometryOutput",
"(",
"elementNode",
")",
":",
"derivation",
"=",
"LinearBearingCageDerivation",
"(",
"elementNode",
")",
"negatives",
"=",
"[",
"]",
"positives",
"=",
"[",
"]",
"if",
"derivation",
".",
"typeStringFirstCharacter",
"==",
"'a'",
":",
"a... | https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-47/fabmetheus_utilities/geometry/creation/linear_bearing_cage.py#L114-L123 | |
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/django-1.3/django/db/backends/mysql/introspection.py | python | DatabaseIntrospection.get_table_list | (self, cursor) | return [row[0] for row in cursor.fetchall()] | Returns a list of table names in the current database. | Returns a list of table names in the current database. | [
"Returns",
"a",
"list",
"of",
"table",
"names",
"in",
"the",
"current",
"database",
"."
] | def get_table_list(self, cursor):
"Returns a list of table names in the current database."
cursor.execute("SHOW TABLES")
return [row[0] for row in cursor.fetchall()] | [
"def",
"get_table_list",
"(",
"self",
",",
"cursor",
")",
":",
"cursor",
".",
"execute",
"(",
"\"SHOW TABLES\"",
")",
"return",
"[",
"row",
"[",
"0",
"]",
"for",
"row",
"in",
"cursor",
".",
"fetchall",
"(",
")",
"]"
] | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.3/django/db/backends/mysql/introspection.py#L31-L34 | |
pyparallel/pyparallel | 11e8c6072d48c8f13641925d17b147bf36ee0ba3 | Lib/lib2to3/fixer_base.py | python | BaseFix.start_tree | (self, tree, filename) | Some fixers need to maintain tree-wide state.
This method is called once, at the start of tree fix-up.
tree - the root node of the tree to be processed.
filename - the name of the file the tree came from. | Some fixers need to maintain tree-wide state.
This method is called once, at the start of tree fix-up. | [
"Some",
"fixers",
"need",
"to",
"maintain",
"tree",
"-",
"wide",
"state",
".",
"This",
"method",
"is",
"called",
"once",
"at",
"the",
"start",
"of",
"tree",
"fix",
"-",
"up",
"."
] | def start_tree(self, tree, filename):
"""Some fixers need to maintain tree-wide state.
This method is called once, at the start of tree fix-up.
tree - the root node of the tree to be processed.
filename - the name of the file the tree came from.
"""
self.used_names = tre... | [
"def",
"start_tree",
"(",
"self",
",",
"tree",
",",
"filename",
")",
":",
"self",
".",
"used_names",
"=",
"tree",
".",
"used_names",
"self",
".",
"set_filename",
"(",
"filename",
")",
"self",
".",
"numbers",
"=",
"itertools",
".",
"count",
"(",
"1",
")... | https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/lib2to3/fixer_base.py#L148-L158 | ||
meraki/dashboard-api-python | aef5e6fe5d23a40d435d5c64ff30580a28af07f1 | meraki_v0/aio/api/traffic_analysis_settings.py | python | AsyncTrafficAnalysisSettings.getNetworkTrafficAnalysisSettings | (self, networkId: str) | return await self._session.get(metadata, resource) | **Return the traffic analysis settings for a network**
https://developer.cisco.com/meraki/api/#!get-network-traffic-analysis-settings
- networkId (string) | **Return the traffic analysis settings for a network**
https://developer.cisco.com/meraki/api/#!get-network-traffic-analysis-settings
- networkId (string) | [
"**",
"Return",
"the",
"traffic",
"analysis",
"settings",
"for",
"a",
"network",
"**",
"https",
":",
"//",
"developer",
".",
"cisco",
".",
"com",
"/",
"meraki",
"/",
"api",
"/",
"#!get",
"-",
"network",
"-",
"traffic",
"-",
"analysis",
"-",
"settings",
... | async def getNetworkTrafficAnalysisSettings(self, networkId: str):
"""
**Return the traffic analysis settings for a network**
https://developer.cisco.com/meraki/api/#!get-network-traffic-analysis-settings
- networkId (string)
"""
metadata = {
'tags':... | [
"async",
"def",
"getNetworkTrafficAnalysisSettings",
"(",
"self",
",",
"networkId",
":",
"str",
")",
":",
"metadata",
"=",
"{",
"'tags'",
":",
"[",
"'Traffic analysis settings'",
"]",
",",
"'operation'",
":",
"'getNetworkTrafficAnalysisSettings'",
",",
"}",
"resourc... | https://github.com/meraki/dashboard-api-python/blob/aef5e6fe5d23a40d435d5c64ff30580a28af07f1/meraki_v0/aio/api/traffic_analysis_settings.py#L6-L20 | |
friends-of-freeswitch/switchio | dee6e9addcf881b2b411ec1dbb397b0acfbb78cf | switchio/apps/measure/__init__.py | python | Measurers.add | (self, app, name=None, operators={}, **kwargs) | return name | [] | def add(self, app, name=None, operators={}, **kwargs):
name = name or utils.get_name(app)
prepost = getattr(app, 'prepost', None)
if not prepost:
raise AttributeError(
"'{}' must define a `prepost` method".format(name))
args, ppkwargs = utils.get_args(app.prep... | [
"def",
"add",
"(",
"self",
",",
"app",
",",
"name",
"=",
"None",
",",
"operators",
"=",
"{",
"}",
",",
"*",
"*",
"kwargs",
")",
":",
"name",
"=",
"name",
"or",
"utils",
".",
"get_name",
"(",
"app",
")",
"prepost",
"=",
"getattr",
"(",
"app",
",... | https://github.com/friends-of-freeswitch/switchio/blob/dee6e9addcf881b2b411ec1dbb397b0acfbb78cf/switchio/apps/measure/__init__.py#L63-L100 | |||
datamllab/rlcard | c21ea82519c453a42e3bdc6848bd3356e9b6ac43 | rlcard/envs/limitholdem.py | python | LimitholdemEnv.get_payoffs | (self) | return self.game.get_payoffs() | Get the payoff of a game
Returns:
payoffs (list): list of payoffs | Get the payoff of a game | [
"Get",
"the",
"payoff",
"of",
"a",
"game"
] | def get_payoffs(self):
''' Get the payoff of a game
Returns:
payoffs (list): list of payoffs
'''
return self.game.get_payoffs() | [
"def",
"get_payoffs",
"(",
"self",
")",
":",
"return",
"self",
".",
"game",
".",
"get_payoffs",
"(",
")"
] | https://github.com/datamllab/rlcard/blob/c21ea82519c453a42e3bdc6848bd3356e9b6ac43/rlcard/envs/limitholdem.py#L73-L79 | |
numenta/nupic | b9ebedaf54f49a33de22d8d44dff7c765cdb5548 | src/nupic/algorithms/backtracking_tm_cpp.py | python | BacktrackingTMCPP.finishLearning | (self) | Overrides :meth:`nupic.algorithms.backtracking_tm.BacktrackingTM.finishLearning`. | Overrides :meth:`nupic.algorithms.backtracking_tm.BacktrackingTM.finishLearning`. | [
"Overrides",
":",
"meth",
":",
"nupic",
".",
"algorithms",
".",
"backtracking_tm",
".",
"BacktrackingTM",
".",
"finishLearning",
"."
] | def finishLearning(self):
"""
Overrides :meth:`nupic.algorithms.backtracking_tm.BacktrackingTM.finishLearning`.
"""
# Keep weakly formed synapses around because they contain confidence scores
# for paths out of learned sequenced and produce a better prediction than
# chance.
self.trimSegme... | [
"def",
"finishLearning",
"(",
"self",
")",
":",
"# Keep weakly formed synapses around because they contain confidence scores",
"# for paths out of learned sequenced and produce a better prediction than",
"# chance.",
"self",
".",
"trimSegments",
"(",
"minPermanence",
"=",
"0.0001",
... | https://github.com/numenta/nupic/blob/b9ebedaf54f49a33de22d8d44dff7c765cdb5548/src/nupic/algorithms/backtracking_tm_cpp.py#L444-L451 | ||
rowliny/DiffHelper | ab3a96f58f9579d0023aed9ebd785f4edf26f8af | Tool/SitePackages/nltk/cluster/util.py | python | VectorSpaceClusterer.likelihood_vectorspace | (self, vector, cluster) | return 1.0 if cluster == predicted else 0.0 | Returns the likelihood of the vector belonging to the cluster. | Returns the likelihood of the vector belonging to the cluster. | [
"Returns",
"the",
"likelihood",
"of",
"the",
"vector",
"belonging",
"to",
"the",
"cluster",
"."
] | def likelihood_vectorspace(self, vector, cluster):
"""
Returns the likelihood of the vector belonging to the cluster.
"""
predicted = self.classify_vectorspace(vector)
return 1.0 if cluster == predicted else 0.0 | [
"def",
"likelihood_vectorspace",
"(",
"self",
",",
"vector",
",",
"cluster",
")",
":",
"predicted",
"=",
"self",
".",
"classify_vectorspace",
"(",
"vector",
")",
"return",
"1.0",
"if",
"cluster",
"==",
"predicted",
"else",
"0.0"
] | https://github.com/rowliny/DiffHelper/blob/ab3a96f58f9579d0023aed9ebd785f4edf26f8af/Tool/SitePackages/nltk/cluster/util.py#L92-L97 | |
OpenMined/PySyft | f181ca02d307d57bfff9477610358df1a12e3ac9 | packages/syft/src/syft/core/common/serde/serialize.py | python | _serialize | (
obj: object,
to_proto: bool = True,
to_bytes: bool = False,
) | Serialize the object according to the parameters.
This method can be called directly on the syft module::
import syft as sy
serialized_obj = sy.serialize(obj=my_object_to_serialize)
This is the primary serialization method, which processes the above
flags in a particular order. In general... | Serialize the object according to the parameters. | [
"Serialize",
"the",
"object",
"according",
"to",
"the",
"parameters",
"."
] | def _serialize(
obj: object,
to_proto: bool = True,
to_bytes: bool = False,
) -> Union[str, bytes, Message]:
"""Serialize the object according to the parameters.
This method can be called directly on the syft module::
import syft as sy
serialized_obj = sy.serialize(obj=my_object_to... | [
"def",
"_serialize",
"(",
"obj",
":",
"object",
",",
"to_proto",
":",
"bool",
"=",
"True",
",",
"to_bytes",
":",
"bool",
"=",
"False",
",",
")",
"->",
"Union",
"[",
"str",
",",
"bytes",
",",
"Message",
"]",
":",
"# relative",
"from",
".",
".",
".",... | https://github.com/OpenMined/PySyft/blob/f181ca02d307d57bfff9477610358df1a12e3ac9/packages/syft/src/syft/core/common/serde/serialize.py#L14-L90 | ||
jython/frozen-mirror | b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99 | lib-python/2.7/cookielib.py | python | escape_path | (path) | return path | Escape any invalid characters in HTTP URL, and uppercase all escapes. | Escape any invalid characters in HTTP URL, and uppercase all escapes. | [
"Escape",
"any",
"invalid",
"characters",
"in",
"HTTP",
"URL",
"and",
"uppercase",
"all",
"escapes",
"."
] | def escape_path(path):
"""Escape any invalid characters in HTTP URL, and uppercase all escapes."""
# There's no knowing what character encoding was used to create URLs
# containing %-escapes, but since we have to pick one to escape invalid
# path characters, we pick UTF-8, as recommended in the HTML 4.0... | [
"def",
"escape_path",
"(",
"path",
")",
":",
"# There's no knowing what character encoding was used to create URLs",
"# containing %-escapes, but since we have to pick one to escape invalid",
"# path characters, we pick UTF-8, as recommended in the HTML 4.0",
"# specification:",
"# http://www.w3... | https://github.com/jython/frozen-mirror/blob/b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99/lib-python/2.7/cookielib.py#L639-L653 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/qnap/sensor.py | python | QNAPDriveSensor.extra_state_attributes | (self) | Return the state attributes. | Return the state attributes. | [
"Return",
"the",
"state",
"attributes",
"."
] | def extra_state_attributes(self):
"""Return the state attributes."""
if self._api.data:
data = self._api.data["smart_drive_health"][self.monitor_device]
return {
ATTR_DRIVE: data["drive_number"],
ATTR_MODEL: data["model"],
ATTR_SERI... | [
"def",
"extra_state_attributes",
"(",
"self",
")",
":",
"if",
"self",
".",
"_api",
".",
"data",
":",
"data",
"=",
"self",
".",
"_api",
".",
"data",
"[",
"\"smart_drive_health\"",
"]",
"[",
"self",
".",
"monitor_device",
"]",
"return",
"{",
"ATTR_DRIVE",
... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/qnap/sensor.py#L462-L471 | ||
bcj/AttrDict | 8c1883162178a124ee29144ca7abcd83cbd9d222 | attrdict/default.py | python | AttrDefault.__len__ | (self) | return len(self._mapping) | Check the length of the mapping. | Check the length of the mapping. | [
"Check",
"the",
"length",
"of",
"the",
"mapping",
"."
] | def __len__(self):
"""
Check the length of the mapping.
"""
return len(self._mapping) | [
"def",
"__len__",
"(",
"self",
")",
":",
"return",
"len",
"(",
"self",
".",
"_mapping",
")"
] | https://github.com/bcj/AttrDict/blob/8c1883162178a124ee29144ca7abcd83cbd9d222/attrdict/default.py#L63-L67 | |
geekori/pyqt5 | 49b2538fa5afe43b3b2bdadaa0560d0d6ef4924c | src/dialogs/QColorDialog.py | python | QColorDialogDemo.getBGColor | (self) | [] | def getBGColor(self):
color = QColorDialog.getColor()
p = QPalette()
p.setColor(QPalette.Window,color)
self.colorLabel.setAutoFillBackground(True)
self.colorLabel.setPalette(p) | [
"def",
"getBGColor",
"(",
"self",
")",
":",
"color",
"=",
"QColorDialog",
".",
"getColor",
"(",
")",
"p",
"=",
"QPalette",
"(",
")",
"p",
".",
"setColor",
"(",
"QPalette",
".",
"Window",
",",
"color",
")",
"self",
".",
"colorLabel",
".",
"setAutoFillBa... | https://github.com/geekori/pyqt5/blob/49b2538fa5afe43b3b2bdadaa0560d0d6ef4924c/src/dialogs/QColorDialog.py#L44-L49 | ||||
gramps-project/gramps | 04d4651a43eb210192f40a9f8c2bad8ee8fa3753 | gramps/gen/datehandler/_dateparser.py | python | DateParser.match_range | (self, text, cal, ny, qual, date) | return 0 | Try matching range date.
On success, set the date and return 1. On failure return 0. | Try matching range date. | [
"Try",
"matching",
"range",
"date",
"."
] | def match_range(self, text, cal, ny, qual, date):
"""
Try matching range date.
On success, set the date and return 1. On failure return 0.
"""
match = self._range.match(text)
if match:
text_parser = self.parser[cal]
(text1, bc1) = self.match_bce(m... | [
"def",
"match_range",
"(",
"self",
",",
"text",
",",
"cal",
",",
"ny",
",",
"qual",
",",
"date",
")",
":",
"match",
"=",
"self",
".",
"_range",
".",
"match",
"(",
"text",
")",
"if",
"match",
":",
"text_parser",
"=",
"self",
".",
"parser",
"[",
"c... | https://github.com/gramps-project/gramps/blob/04d4651a43eb210192f40a9f8c2bad8ee8fa3753/gramps/gen/datehandler/_dateparser.py#L812-L837 | |
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/Xenotix Python Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/shutil.py | python | _make_zipfile | (base_name, base_dir, verbose=0, dry_run=0, logger=None) | return zip_filename | Create a zip file from all the files under 'base_dir'.
The output zip file will be named 'base_name' + ".zip". Uses either the
"zipfile" Python module (if available) or the InfoZIP "zip" utility
(if installed and found on the default search path). If neither tool is
available, raises ExecError. Retu... | Create a zip file from all the files under 'base_dir'. | [
"Create",
"a",
"zip",
"file",
"from",
"all",
"the",
"files",
"under",
"base_dir",
"."
] | def _make_zipfile(base_name, base_dir, verbose=0, dry_run=0, logger=None):
"""Create a zip file from all the files under 'base_dir'.
The output zip file will be named 'base_name' + ".zip". Uses either the
"zipfile" Python module (if available) or the InfoZIP "zip" utility
(if installed and found on th... | [
"def",
"_make_zipfile",
"(",
"base_name",
",",
"base_dir",
",",
"verbose",
"=",
"0",
",",
"dry_run",
"=",
"0",
",",
"logger",
"=",
"None",
")",
":",
"zip_filename",
"=",
"base_name",
"+",
"\".zip\"",
"archive_dir",
"=",
"os",
".",
"path",
".",
"dirname",... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/shutil.py#L412-L457 | |
apache/tvm | 6eb4ed813ebcdcd9558f0906a1870db8302ff1e0 | python/tvm/relay/op/tensor.py | python | concatenate | (data, axis) | return _make.concatenate(Tuple(data), axis) | Concatenate the input tensors along the given axis.
Parameters
----------
data : Union(List[relay.Expr], Tuple[relay.Expr])
A list of tensors.
axis : int
The axis along which the tensors are concatenated.
Returns
-------
result: relay.Expr
The concatenated tensor. | Concatenate the input tensors along the given axis. | [
"Concatenate",
"the",
"input",
"tensors",
"along",
"the",
"given",
"axis",
"."
] | def concatenate(data, axis):
"""Concatenate the input tensors along the given axis.
Parameters
----------
data : Union(List[relay.Expr], Tuple[relay.Expr])
A list of tensors.
axis : int
The axis along which the tensors are concatenated.
Returns
-------
result: relay.Exp... | [
"def",
"concatenate",
"(",
"data",
",",
"axis",
")",
":",
"data",
"=",
"list",
"(",
"data",
")",
"if",
"not",
"data",
":",
"raise",
"ValueError",
"(",
"\"relay.concatenate requires data to be non-empty.\"",
")",
"if",
"not",
"isinstance",
"(",
"axis",
",",
"... | https://github.com/apache/tvm/blob/6eb4ed813ebcdcd9558f0906a1870db8302ff1e0/python/tvm/relay/op/tensor.py#L1093-L1113 | |
sdaps/sdaps | 51d1072185223f5e48512661e2c1e8399d63e876 | sdaps/setup/buddies.py | python | Head.validate | (self) | [] | def validate(self):
if not self.obj.title:
log.warn(_('Head %(l0)i got no title.') % {'l0': self.obj.id[0]}) | [
"def",
"validate",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"obj",
".",
"title",
":",
"log",
".",
"warn",
"(",
"_",
"(",
"'Head %(l0)i got no title.'",
")",
"%",
"{",
"'l0'",
":",
"self",
".",
"obj",
".",
"id",
"[",
"0",
"]",
"}",
")"
] | https://github.com/sdaps/sdaps/blob/51d1072185223f5e48512661e2c1e8399d63e876/sdaps/setup/buddies.py#L60-L62 | ||||
golismero/golismero | 7d605b937e241f51c1ca4f47b20f755eeefb9d76 | tools/sqlmap/thirdparty/odict/odict.py | python | _OrderedDict.insert | (self, index, key, value) | Takes ``index``, ``key``, and ``value`` as arguments.
Sets ``key`` to ``value``, so that ``key`` is at position ``index`` in
the OrderedDict.
>>> d = OrderedDict(((1, 3), (3, 2), (2, 1)))
>>> d.insert(0, 4, 0)
>>> d
OrderedDict([(4, 0), (1, 3), (3, 2), (2, 1)])
... | Takes ``index``, ``key``, and ``value`` as arguments. | [
"Takes",
"index",
"key",
"and",
"value",
"as",
"arguments",
"."
] | def insert(self, index, key, value):
"""
Takes ``index``, ``key``, and ``value`` as arguments.
Sets ``key`` to ``value``, so that ``key`` is at position ``index`` in
the OrderedDict.
>>> d = OrderedDict(((1, 3), (3, 2), (2, 1)))
>>> d.insert(0, 4, 0)
>>> d
... | [
"def",
"insert",
"(",
"self",
",",
"index",
",",
"key",
",",
"value",
")",
":",
"if",
"key",
"in",
"self",
":",
"# FIXME: efficiency?",
"del",
"self",
"[",
"key",
"]",
"self",
".",
"_sequence",
".",
"insert",
"(",
"index",
",",
"key",
")",
"dict",
... | https://github.com/golismero/golismero/blob/7d605b937e241f51c1ca4f47b20f755eeefb9d76/tools/sqlmap/thirdparty/odict/odict.py#L823-L845 | ||
peterbrittain/asciimatics | 9a490faddf484ee5b9b845316f921f5888b23b18 | samples/maps.py | python | Map._zoom_map | (self, zoom_out=True) | Animate the zoom in/out as appropriate for the displayed map tile. | Animate the zoom in/out as appropriate for the displayed map tile. | [
"Animate",
"the",
"zoom",
"in",
"/",
"out",
"as",
"appropriate",
"for",
"the",
"displayed",
"map",
"tile",
"."
] | def _zoom_map(self, zoom_out=True):
"""Animate the zoom in/out as appropriate for the displayed map tile."""
size_step = 1 / _ZOOM_STEP if zoom_out else _ZOOM_STEP
self._next_update = 1
if self._satellite:
size_step **= _ZOOM_ANIMATION_STEPS
self._size *= size_step
... | [
"def",
"_zoom_map",
"(",
"self",
",",
"zoom_out",
"=",
"True",
")",
":",
"size_step",
"=",
"1",
"/",
"_ZOOM_STEP",
"if",
"zoom_out",
"else",
"_ZOOM_STEP",
"self",
".",
"_next_update",
"=",
"1",
"if",
"self",
".",
"_satellite",
":",
"size_step",
"**=",
"_... | https://github.com/peterbrittain/asciimatics/blob/9a490faddf484ee5b9b845316f921f5888b23b18/samples/maps.py#L406-L424 | ||
cloudera/impyla | 0c736af4cad2bade9b8e313badc08ec50e81c948 | impala/_thrift_gen/beeswax/ttypes.py | python | QueryHandle.__ne__ | (self, other) | return not (self == other) | [] | def __ne__(self, other):
return not (self == other) | [
"def",
"__ne__",
"(",
"self",
",",
"other",
")",
":",
"return",
"not",
"(",
"self",
"==",
"other",
")"
] | https://github.com/cloudera/impyla/blob/0c736af4cad2bade9b8e313badc08ec50e81c948/impala/_thrift_gen/beeswax/ttypes.py#L219-L220 | |||
ales-tsurko/cells | 4cf7e395cd433762bea70cdc863a346f3a6fe1d0 | packaging/macos/python/lib/python3.7/ipaddress.py | python | IPv6Address.is_private | (self) | return any(self in net for net in self._constants._private_networks) | Test if this address is allocated for private networks.
Returns:
A boolean, True if the address is reserved per
iana-ipv6-special-registry. | Test if this address is allocated for private networks. | [
"Test",
"if",
"this",
"address",
"is",
"allocated",
"for",
"private",
"networks",
"."
] | def is_private(self):
"""Test if this address is allocated for private networks.
Returns:
A boolean, True if the address is reserved per
iana-ipv6-special-registry.
"""
return any(self in net for net in self._constants._private_networks) | [
"def",
"is_private",
"(",
"self",
")",
":",
"return",
"any",
"(",
"self",
"in",
"net",
"for",
"net",
"in",
"self",
".",
"_constants",
".",
"_private_networks",
")"
] | https://github.com/ales-tsurko/cells/blob/4cf7e395cd433762bea70cdc863a346f3a6fe1d0/packaging/macos/python/lib/python3.7/ipaddress.py#L1966-L1974 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/climate/__init__.py | python | ClimateEntity.fan_modes | (self) | return self._attr_fan_modes | Return the list of available fan modes.
Requires SUPPORT_FAN_MODE. | Return the list of available fan modes. | [
"Return",
"the",
"list",
"of",
"available",
"fan",
"modes",
"."
] | def fan_modes(self) -> list[str] | None:
"""Return the list of available fan modes.
Requires SUPPORT_FAN_MODE.
"""
return self._attr_fan_modes | [
"def",
"fan_modes",
"(",
"self",
")",
"->",
"list",
"[",
"str",
"]",
"|",
"None",
":",
"return",
"self",
".",
"_attr_fan_modes"
] | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/climate/__init__.py#L415-L420 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.