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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
nabeel-oz/qlik-py-tools | 09d0cd232fadcaa926bb11cebb37d5ae3051bc86 | core/_utils.py | python | fillna | (df, method="zeros") | Fill empty values in a Data Frame with the chosen method.
Valid options for method are: zeros, mean, median, mode | Fill empty values in a Data Frame with the chosen method.
Valid options for method are: zeros, mean, median, mode | [
"Fill",
"empty",
"values",
"in",
"a",
"Data",
"Frame",
"with",
"the",
"chosen",
"method",
".",
"Valid",
"options",
"for",
"method",
"are",
":",
"zeros",
"mean",
"median",
"mode"
] | def fillna(df, method="zeros"):
"""
Fill empty values in a Data Frame with the chosen method.
Valid options for method are: zeros, mean, median, mode
"""
if method == "mean":
return df.fillna(df.mean())
elif method == "median":
return df.fillna(df.median())
elif method == "m... | [
"def",
"fillna",
"(",
"df",
",",
"method",
"=",
"\"zeros\"",
")",
":",
"if",
"method",
"==",
"\"mean\"",
":",
"return",
"df",
".",
"fillna",
"(",
"df",
".",
"mean",
"(",
")",
")",
"elif",
"method",
"==",
"\"median\"",
":",
"return",
"df",
".",
"fil... | https://github.com/nabeel-oz/qlik-py-tools/blob/09d0cd232fadcaa926bb11cebb37d5ae3051bc86/core/_utils.py#L97-L112 | ||
tobegit3hub/tensorflow_template_application | a2be179bf5e2624cdc3c0ed3cf8b5f7eff87777d | util.py | python | get_optimizer_by_name | (optimizer_name, learning_rate) | return optimizer | Get optimizer object by the optimizer name.
Args:
optimizer_name: Name of the optimizer.
learning_rate: The learning rate.
Return:
The optimizer object. | Get optimizer object by the optimizer name.
Args:
optimizer_name: Name of the optimizer.
learning_rate: The learning rate.
Return:
The optimizer object. | [
"Get",
"optimizer",
"object",
"by",
"the",
"optimizer",
"name",
".",
"Args",
":",
"optimizer_name",
":",
"Name",
"of",
"the",
"optimizer",
".",
"learning_rate",
":",
"The",
"learning",
"rate",
".",
"Return",
":",
"The",
"optimizer",
"object",
"."
] | def get_optimizer_by_name(optimizer_name, learning_rate):
"""
Get optimizer object by the optimizer name.
Args:
optimizer_name: Name of the optimizer.
learning_rate: The learning rate.
Return:
The optimizer object.
"""
logging.info("Use the optimizer: {}".format(optimiz... | [
"def",
"get_optimizer_by_name",
"(",
"optimizer_name",
",",
"learning_rate",
")",
":",
"logging",
".",
"info",
"(",
"\"Use the optimizer: {}\"",
".",
"format",
"(",
"optimizer_name",
")",
")",
"if",
"optimizer_name",
"==",
"\"sgd\"",
":",
"optimizer",
"=",
"tf",
... | https://github.com/tobegit3hub/tensorflow_template_application/blob/a2be179bf5e2624cdc3c0ed3cf8b5f7eff87777d/util.py#L10-L37 | |
ireapps/census | 18de79ebc17bd3aae81f8fc269f4d73631c5d506 | censusweb/fabfile.py | python | setup_directories | () | Create directories necessary for deployment. | Create directories necessary for deployment. | [
"Create",
"directories",
"necessary",
"for",
"deployment",
"."
] | def setup_directories():
"""
Create directories necessary for deployment.
"""
run('mkdir -p %(path)s' % env) | [
"def",
"setup_directories",
"(",
")",
":",
"run",
"(",
"'mkdir -p %(path)s'",
"%",
"env",
")"
] | https://github.com/ireapps/census/blob/18de79ebc17bd3aae81f8fc269f4d73631c5d506/censusweb/fabfile.py#L98-L102 | ||
Chaffelson/nipyapi | d3b186fd701ce308c2812746d98af9120955e810 | nipyapi/nifi/models/remote_process_group_status_snapshot_dto.py | python | RemoteProcessGroupStatusSnapshotDTO.group_id | (self) | return self._group_id | Gets the group_id of this RemoteProcessGroupStatusSnapshotDTO.
The id of the parent process group the remote process group resides in.
:return: The group_id of this RemoteProcessGroupStatusSnapshotDTO.
:rtype: str | Gets the group_id of this RemoteProcessGroupStatusSnapshotDTO.
The id of the parent process group the remote process group resides in. | [
"Gets",
"the",
"group_id",
"of",
"this",
"RemoteProcessGroupStatusSnapshotDTO",
".",
"The",
"id",
"of",
"the",
"parent",
"process",
"group",
"the",
"remote",
"process",
"group",
"resides",
"in",
"."
] | def group_id(self):
"""
Gets the group_id of this RemoteProcessGroupStatusSnapshotDTO.
The id of the parent process group the remote process group resides in.
:return: The group_id of this RemoteProcessGroupStatusSnapshotDTO.
:rtype: str
"""
return self._group_id | [
"def",
"group_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_group_id"
] | https://github.com/Chaffelson/nipyapi/blob/d3b186fd701ce308c2812746d98af9120955e810/nipyapi/nifi/models/remote_process_group_status_snapshot_dto.py#L130-L138 | |
fake-name/ReadableWebProxy | ed5c7abe38706acc2684a1e6cd80242a03c5f010 | WebMirror/management/rss_parser_funcs/feed_parse_extract3AmsecretWordpressCom.py | python | extract3AmsecretWordpressCom | (item) | return False | Parser for '3amsecret.wordpress.com' | Parser for '3amsecret.wordpress.com' | [
"Parser",
"for",
"3amsecret",
".",
"wordpress",
".",
"com"
] | def extract3AmsecretWordpressCom(item):
'''
Parser for '3amsecret.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('thwipb', 'the husband who is play... | [
"def",
"extract3AmsecretWordpressCom",
"(",
"item",
")",
":",
"vol",
",",
"chp",
",",
"frag",
",",
"postfix",
"=",
"extractVolChapterFragmentPostfix",
"(",
"item",
"[",
"'title'",
"]",
")",
"if",
"not",
"(",
"chp",
"or",
"vol",
")",
"or",
"\"preview\"",
"i... | https://github.com/fake-name/ReadableWebProxy/blob/ed5c7abe38706acc2684a1e6cd80242a03c5f010/WebMirror/management/rss_parser_funcs/feed_parse_extract3AmsecretWordpressCom.py#L1-L22 | |
DataDog/integrations-core | 934674b29d94b70ccc008f76ea172d0cdae05e1e | nginx_ingress_controller/datadog_checks/nginx_ingress_controller/config_models/defaults.py | python | instance_ignore_metrics_by_labels | (field, value) | return get_default_field_value(field, value) | [] | def instance_ignore_metrics_by_labels(field, value):
return get_default_field_value(field, value) | [
"def",
"instance_ignore_metrics_by_labels",
"(",
"field",
",",
"value",
")",
":",
"return",
"get_default_field_value",
"(",
"field",
",",
"value",
")"
] | https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/nginx_ingress_controller/datadog_checks/nginx_ingress_controller/config_models/defaults.py#L97-L98 | |||
thebjorn/pydeps | 2c0b958b2f4dd6e00f59b37e63c218d53e6e1773 | pydeps/dot.py | python | pipe | (cmd, txt) | return Popen(
cmd2args(cmd),
stdout=subprocess.PIPE,
stdin=subprocess.PIPE,
shell=win32
).communicate(txt)[0] | Pipe `txt` into the command `cmd` and return the output. | Pipe `txt` into the command `cmd` and return the output. | [
"Pipe",
"txt",
"into",
"the",
"command",
"cmd",
"and",
"return",
"the",
"output",
"."
] | def pipe(cmd, txt):
"""Pipe `txt` into the command `cmd` and return the output.
"""
return Popen(
cmd2args(cmd),
stdout=subprocess.PIPE,
stdin=subprocess.PIPE,
shell=win32
).communicate(txt)[0] | [
"def",
"pipe",
"(",
"cmd",
",",
"txt",
")",
":",
"return",
"Popen",
"(",
"cmd2args",
"(",
"cmd",
")",
",",
"stdout",
"=",
"subprocess",
".",
"PIPE",
",",
"stdin",
"=",
"subprocess",
".",
"PIPE",
",",
"shell",
"=",
"win32",
")",
".",
"communicate",
... | https://github.com/thebjorn/pydeps/blob/2c0b958b2f4dd6e00f59b37e63c218d53e6e1773/pydeps/dot.py#L46-L54 | |
pklaus/ds1054z | e93669149d048813f24a1622f964725ddfa27add | ds1054z/__init__.py | python | DS1054Z.waveform_time_values | (self) | return tv | The timestamps that belong to the waveform samples accessed to
to be accessed beforehand.
Access this property only after fetching your waveform data,
otherwise the values will not be correct.
Will be fetched every time you access this property.
:return: sample timestamps (in ... | The timestamps that belong to the waveform samples accessed to
to be accessed beforehand. | [
"The",
"timestamps",
"that",
"belong",
"to",
"the",
"waveform",
"samples",
"accessed",
"to",
"to",
"be",
"accessed",
"beforehand",
"."
] | def waveform_time_values(self):
"""
The timestamps that belong to the waveform samples accessed to
to be accessed beforehand.
Access this property only after fetching your waveform data,
otherwise the values will not be correct.
Will be fetched every time you access thi... | [
"def",
"waveform_time_values",
"(",
"self",
")",
":",
"wp",
"=",
"self",
".",
"waveform_preamble_dict",
"tv",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"memory_depth_curr_waveform",
")",
":",
"tv",
".",
"append",
"(",
"wp",
"[",
"'xinc'... | https://github.com/pklaus/ds1054z/blob/e93669149d048813f24a1622f964725ddfa27add/ds1054z/__init__.py#L399-L416 | |
taolei87/rcnn | 7c45f497d4507047549480c2dc579866c76eec82 | code/rationale/ubuntu/rationale.py | python | Generator.ready | (self) | [] | def ready(self):
embedding_layer = self.embedding_layer
args = self.args
padding_id = self.padding_id
weights = self.weights
dropout = self.dropout = theano.shared(
np.float64(args.dropout).astype(theano.config.floatX)
)
# len*batch
x... | [
"def",
"ready",
"(",
"self",
")",
":",
"embedding_layer",
"=",
"self",
".",
"embedding_layer",
"args",
"=",
"self",
".",
"args",
"padding_id",
"=",
"self",
".",
"padding_id",
"weights",
"=",
"self",
".",
"weights",
"dropout",
"=",
"self",
".",
"dropout",
... | https://github.com/taolei87/rcnn/blob/7c45f497d4507047549480c2dc579866c76eec82/code/rationale/ubuntu/rationale.py#L29-L134 | ||||
mikf/gallery-dl | 58a7921b5c990f5072e2b55b4644d0574512d3e1 | gallery_dl/extractor/tumblr.py | python | TumblrAPI.posts | (self, blog, params) | Retrieve published posts | Retrieve published posts | [
"Retrieve",
"published",
"posts"
] | def posts(self, blog, params):
"""Retrieve published posts"""
params.update({"offset": 0, "limit": 50, "reblog_info": "true"})
if self.posts_type:
params["type"] = self.posts_type
if self.before:
params["before"] = self.before
while True:
data ... | [
"def",
"posts",
"(",
"self",
",",
"blog",
",",
"params",
")",
":",
"params",
".",
"update",
"(",
"{",
"\"offset\"",
":",
"0",
",",
"\"limit\"",
":",
"50",
",",
"\"reblog_info\"",
":",
"\"true\"",
"}",
")",
"if",
"self",
".",
"posts_type",
":",
"param... | https://github.com/mikf/gallery-dl/blob/58a7921b5c990f5072e2b55b4644d0574512d3e1/gallery_dl/extractor/tumblr.py#L348-L361 | ||
mdiazcl/fuzzbunch-debian | 2b76c2249ade83a389ae3badb12a1bd09901fd2c | windows/Resources/Python/Core/Lib/lib2to3/pytree.py | python | WildcardPattern._bare_name_matches | (self, nodes) | return (
count, r) | Special optimized matcher for bare_name. | Special optimized matcher for bare_name. | [
"Special",
"optimized",
"matcher",
"for",
"bare_name",
"."
] | def _bare_name_matches(self, nodes):
"""Special optimized matcher for bare_name."""
count = 0
r = {}
done = False
max = len(nodes)
while not done and count < max:
done = True
for leaf in self.content:
if leaf[0].match(nodes[count], ... | [
"def",
"_bare_name_matches",
"(",
"self",
",",
"nodes",
")",
":",
"count",
"=",
"0",
"r",
"=",
"{",
"}",
"done",
"=",
"False",
"max",
"=",
"len",
"(",
"nodes",
")",
"while",
"not",
"done",
"and",
"count",
"<",
"max",
":",
"done",
"=",
"True",
"fo... | https://github.com/mdiazcl/fuzzbunch-debian/blob/2b76c2249ade83a389ae3badb12a1bd09901fd2c/windows/Resources/Python/Core/Lib/lib2to3/pytree.py#L789-L805 | |
pyparallel/pyparallel | 11e8c6072d48c8f13641925d17b147bf36ee0ba3 | Lib/site-packages/qtconsole-4.1.0-py3.3.egg/qtconsole/completion_widget.py | python | CompletionWidget.eventFilter | (self, obj, event) | return super(CompletionWidget, self).eventFilter(obj, event) | Reimplemented to handle keyboard input and to auto-hide when the
text edit loses focus. | Reimplemented to handle keyboard input and to auto-hide when the
text edit loses focus. | [
"Reimplemented",
"to",
"handle",
"keyboard",
"input",
"and",
"to",
"auto",
"-",
"hide",
"when",
"the",
"text",
"edit",
"loses",
"focus",
"."
] | def eventFilter(self, obj, event):
""" Reimplemented to handle keyboard input and to auto-hide when the
text edit loses focus.
"""
if obj == self._text_edit:
etype = event.type()
if etype == QtCore.QEvent.KeyPress:
key, text = event.key(), eve... | [
"def",
"eventFilter",
"(",
"self",
",",
"obj",
",",
"event",
")",
":",
"if",
"obj",
"==",
"self",
".",
"_text_edit",
":",
"etype",
"=",
"event",
".",
"type",
"(",
")",
"if",
"etype",
"==",
"QtCore",
".",
"QEvent",
".",
"KeyPress",
":",
"key",
",",
... | https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/site-packages/qtconsole-4.1.0-py3.3.egg/qtconsole/completion_widget.py#L35-L60 | |
PaddlePaddle/Research | 2da0bd6c72d60e9df403aff23a7802779561c4a1 | NLP/ACL2019-KTNET/reading_comprehension/src/tokenization.py | python | convert_to_unicode | (text) | Converts `text` to Unicode (if it's not already), assuming utf-8 input. | Converts `text` to Unicode (if it's not already), assuming utf-8 input. | [
"Converts",
"text",
"to",
"Unicode",
"(",
"if",
"it",
"s",
"not",
"already",
")",
"assuming",
"utf",
"-",
"8",
"input",
"."
] | def convert_to_unicode(text):
"""Converts `text` to Unicode (if it's not already), assuming utf-8 input."""
if six.PY3:
if isinstance(text, str):
return text
elif isinstance(text, bytes):
return text.decode("utf-8", "ignore")
else:
raise ValueError("Un... | [
"def",
"convert_to_unicode",
"(",
"text",
")",
":",
"if",
"six",
".",
"PY3",
":",
"if",
"isinstance",
"(",
"text",
",",
"str",
")",
":",
"return",
"text",
"elif",
"isinstance",
"(",
"text",
",",
"bytes",
")",
":",
"return",
"text",
".",
"decode",
"("... | https://github.com/PaddlePaddle/Research/blob/2da0bd6c72d60e9df403aff23a7802779561c4a1/NLP/ACL2019-KTNET/reading_comprehension/src/tokenization.py#L26-L43 | ||
andyzsf/TuShare | 92787ad0cd492614bdb6389b71a19c80d1c8c9ae | tushare/datayes/macro.py | python | Macro.RussiaDataClimateIndex | (self, indicID='', indicName='', beginDate='', endDate='', field='') | return _ret_data(code, result) | 包含俄罗斯景气指数数据,具体指标可参见API文档;历史数据从2009年开始,按月更新。 | 包含俄罗斯景气指数数据,具体指标可参见API文档;历史数据从2009年开始,按月更新。 | [
"包含俄罗斯景气指数数据,具体指标可参见API文档;历史数据从2009年开始,按月更新。"
] | def RussiaDataClimateIndex(self, indicID='', indicName='', beginDate='', endDate='', field=''):
"""
包含俄罗斯景气指数数据,具体指标可参见API文档;历史数据从2009年开始,按月更新。
"""
code, result = self.client.getData(vs.RUSSIADATACLIMATEINDEX%(indicID, indicName, beginDate, endDate, field))
return _ret_data(c... | [
"def",
"RussiaDataClimateIndex",
"(",
"self",
",",
"indicID",
"=",
"''",
",",
"indicName",
"=",
"''",
",",
"beginDate",
"=",
"''",
",",
"endDate",
"=",
"''",
",",
"field",
"=",
"''",
")",
":",
"code",
",",
"result",
"=",
"self",
".",
"client",
".",
... | https://github.com/andyzsf/TuShare/blob/92787ad0cd492614bdb6389b71a19c80d1c8c9ae/tushare/datayes/macro.py#L1739-L1744 | |
guardicore/monkey | 34ff8dabf7614b1d0cf3de38eb4dc77b2f73f623 | monkey/common/cmd/cmd_runner.py | python | CmdRunner.query_command | (self, command_id) | Queries the already run command for more info
:param command_id: The command ID to query
:return: Command info (in any format) | Queries the already run command for more info
:param command_id: The command ID to query
:return: Command info (in any format) | [
"Queries",
"the",
"already",
"run",
"command",
"for",
"more",
"info",
":",
"param",
"command_id",
":",
"The",
"command",
"ID",
"to",
"query",
":",
"return",
":",
"Command",
"info",
"(",
"in",
"any",
"format",
")"
] | def query_command(self, command_id):
"""
Queries the already run command for more info
:param command_id: The command ID to query
:return: Command info (in any format)
"""
raise NotImplementedError() | [
"def",
"query_command",
"(",
"self",
",",
"command_id",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/guardicore/monkey/blob/34ff8dabf7614b1d0cf3de38eb4dc77b2f73f623/monkey/common/cmd/cmd_runner.py#L106-L112 | ||
jliphard/DeepEvolve | 38a760283f6986f157c978dc0697099366ca0f45 | genome.py | python | Genome.set_genes_random | (self) | Create a random genome. | Create a random genome. | [
"Create",
"a",
"random",
"genome",
"."
] | def set_genes_random(self):
"""Create a random genome."""
#print("set_genes_random")
self.parents = [0,0] #very sad - no parents :(
for key in self.all_possible_genes:
self.geneparam[key] = random.choice(self.all_possible_genes[key])
self.update_hash... | [
"def",
"set_genes_random",
"(",
"self",
")",
":",
"#print(\"set_genes_random\")",
"self",
".",
"parents",
"=",
"[",
"0",
",",
"0",
"]",
"#very sad - no parents :(",
"for",
"key",
"in",
"self",
".",
"all_possible_genes",
":",
"self",
".",
"geneparam",
"[",
"key... | https://github.com/jliphard/DeepEvolve/blob/38a760283f6986f157c978dc0697099366ca0f45/genome.py#L49-L57 | ||
CamDavidsonPilon/lifelines | 9be26a9a8720e8536e9828e954bb91d559a3016f | lifelines/fitters/cox_time_varying_fitter.py | python | CoxTimeVaryingFitter.fit | (
self,
df,
event_col,
start_col="start",
stop_col="stop",
weights_col=None,
id_col=None,
show_progress=False,
step_size=None,
robust=False,
strata=None,
initial_point=None,
formula: str = None,
) | return self | Fit the Cox Proportional Hazard model to a time varying dataset. Tied survival times
are handled using Efron's tie-method.
Parameters
-----------
df: DataFrame
a Pandas DataFrame with necessary columns `duration_col` and
`event_col`, plus other covariates. `durati... | Fit the Cox Proportional Hazard model to a time varying dataset. Tied survival times
are handled using Efron's tie-method. | [
"Fit",
"the",
"Cox",
"Proportional",
"Hazard",
"model",
"to",
"a",
"time",
"varying",
"dataset",
".",
"Tied",
"survival",
"times",
"are",
"handled",
"using",
"Efron",
"s",
"tie",
"-",
"method",
"."
] | def fit(
self,
df,
event_col,
start_col="start",
stop_col="stop",
weights_col=None,
id_col=None,
show_progress=False,
step_size=None,
robust=False,
strata=None,
initial_point=None,
formula: str = None,
): # pyli... | [
"def",
"fit",
"(",
"self",
",",
"df",
",",
"event_col",
",",
"start_col",
"=",
"\"start\"",
",",
"stop_col",
"=",
"\"stop\"",
",",
"weights_col",
"=",
"None",
",",
"id_col",
"=",
"None",
",",
"show_progress",
"=",
"False",
",",
"step_size",
"=",
"None",
... | https://github.com/CamDavidsonPilon/lifelines/blob/9be26a9a8720e8536e9828e954bb91d559a3016f/lifelines/fitters/cox_time_varying_fitter.py#L96-L236 | |
openedx/edx-platform | 68dd185a0ab45862a2a61e0f803d7e03d2be71b5 | lms/djangoapps/courseware/model_data.py | python | UserStateCache.set | (self, kvs_key, value) | Set the specified `kvs_key` to the field value `value`.
Arguments:
kvs_key (`DjangoKeyValueStore.Key`): The field value to delete
value: The field value to store | Set the specified `kvs_key` to the field value `value`. | [
"Set",
"the",
"specified",
"kvs_key",
"to",
"the",
"field",
"value",
"value",
"."
] | def set(self, kvs_key, value):
"""
Set the specified `kvs_key` to the field value `value`.
Arguments:
kvs_key (`DjangoKeyValueStore.Key`): The field value to delete
value: The field value to store
"""
self.set_many({kvs_key: value}) | [
"def",
"set",
"(",
"self",
",",
"kvs_key",
",",
"value",
")",
":",
"self",
".",
"set_many",
"(",
"{",
"kvs_key",
":",
"value",
"}",
")"
] | https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/lms/djangoapps/courseware/model_data.py#L360-L368 | ||
bonfy/leetcode | aae6fbb9198aa866937ca66e6212b090e6f5e8c6 | solutions/0313-super-ugly-number/super-ugly-number.py | python | Solution.nthSuperUglyNumber | (self, n, primes) | return uglies[-1] | :type n: int
:type primes: List[int]
:rtype: int | :type n: int
:type primes: List[int]
:rtype: int | [
":",
"type",
"n",
":",
"int",
":",
"type",
"primes",
":",
"List",
"[",
"int",
"]",
":",
"rtype",
":",
"int"
] | def nthSuperUglyNumber(self, n, primes):
"""
:type n: int
:type primes: List[int]
:rtype: int
"""
uglies = [1]
def gen(prime):
for ugly in uglies:
yield ugly * prime
merged = heapq.merge(*map(gen, primes))
whil... | [
"def",
"nthSuperUglyNumber",
"(",
"self",
",",
"n",
",",
"primes",
")",
":",
"uglies",
"=",
"[",
"1",
"]",
"def",
"gen",
"(",
"prime",
")",
":",
"for",
"ugly",
"in",
"uglies",
":",
"yield",
"ugly",
"*",
"prime",
"merged",
"=",
"heapq",
".",
"merge"... | https://github.com/bonfy/leetcode/blob/aae6fbb9198aa866937ca66e6212b090e6f5e8c6/solutions/0313-super-ugly-number/super-ugly-number.py#L28-L43 | |
axcore/tartube | 36dd493642923fe8b9190a41db596c30c043ae90 | tartube/config.py | python | FFmpegOptionsEditWin.on_video_drag_data_received | (self, widget, context, x, y, data, info,
time) | Called from callback in self.setup_videos_tab().
This function is required for detecting when the user drags and drops
data into the Videos tab.
If the data contains full paths to a video/audio file and/or URLs,
then we can search the media data registry, looking for matching
m... | Called from callback in self.setup_videos_tab(). | [
"Called",
"from",
"callback",
"in",
"self",
".",
"setup_videos_tab",
"()",
"."
] | def on_video_drag_data_received(self, widget, context, x, y, data, info,
time):
"""Called from callback in self.setup_videos_tab().
This function is required for detecting when the user drags and drops
data into the Videos tab.
If the data contains full paths to a video/audio file... | [
"def",
"on_video_drag_data_received",
"(",
"self",
",",
"widget",
",",
"context",
",",
"x",
",",
"y",
",",
"data",
",",
"info",
",",
"time",
")",
":",
"text",
"=",
"None",
"if",
"info",
"==",
"0",
":",
"text",
"=",
"data",
".",
"get_text",
"(",
")"... | https://github.com/axcore/tartube/blob/36dd493642923fe8b9190a41db596c30c043ae90/tartube/config.py#L12206-L12289 | ||
devitocodes/devito | 6abd441e3f5f091775ad332be6b95e017b8cbd16 | devito/ir/support/utils.py | python | Stencil.union | (cls, *dicts) | return output | Compute the union of a collection of Stencils. | Compute the union of a collection of Stencils. | [
"Compute",
"the",
"union",
"of",
"a",
"collection",
"of",
"Stencils",
"."
] | def union(cls, *dicts):
"""
Compute the union of a collection of Stencils.
"""
output = Stencil()
for i in dicts:
for k, v in i.items():
output[k] |= v
return output | [
"def",
"union",
"(",
"cls",
",",
"*",
"dicts",
")",
":",
"output",
"=",
"Stencil",
"(",
")",
"for",
"i",
"in",
"dicts",
":",
"for",
"k",
",",
"v",
"in",
"i",
".",
"items",
"(",
")",
":",
"output",
"[",
"k",
"]",
"|=",
"v",
"return",
"output"
... | https://github.com/devitocodes/devito/blob/6abd441e3f5f091775ad332be6b95e017b8cbd16/devito/ir/support/utils.py#L31-L39 | |
realpython/book2-exercises | cde325eac8e6d8cff2316601c2e5b36bb46af7d0 | web2py/venv/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/connection.py | python | HTTPConnection.request_chunked | (self, method, url, body=None, headers=None) | Alternative to the common request method, which sends the
body with chunked encoding and not as one block | Alternative to the common request method, which sends the
body with chunked encoding and not as one block | [
"Alternative",
"to",
"the",
"common",
"request",
"method",
"which",
"sends",
"the",
"body",
"with",
"chunked",
"encoding",
"and",
"not",
"as",
"one",
"block"
] | def request_chunked(self, method, url, body=None, headers=None):
"""
Alternative to the common request method, which sends the
body with chunked encoding and not as one block
"""
headers = HTTPHeaderDict(headers if headers is not None else {})
skip_accept_encoding = 'acce... | [
"def",
"request_chunked",
"(",
"self",
",",
"method",
",",
"url",
",",
"body",
"=",
"None",
",",
"headers",
"=",
"None",
")",
":",
"headers",
"=",
"HTTPHeaderDict",
"(",
"headers",
"if",
"headers",
"is",
"not",
"None",
"else",
"{",
"}",
")",
"skip_acce... | https://github.com/realpython/book2-exercises/blob/cde325eac8e6d8cff2316601c2e5b36bb46af7d0/web2py/venv/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/connection.py#L170-L200 | ||
sabri-zaki/EasY_HaCk | 2a39ac384dd0d6fc51c0dd22e8d38cece683fdb9 | .modules/.sqlmap/lib/core/option.py | python | _setAuthCred | () | Adds authentication credentials (if any) for current target to the password manager
(used by connection handler) | Adds authentication credentials (if any) for current target to the password manager
(used by connection handler) | [
"Adds",
"authentication",
"credentials",
"(",
"if",
"any",
")",
"for",
"current",
"target",
"to",
"the",
"password",
"manager",
"(",
"used",
"by",
"connection",
"handler",
")"
] | def _setAuthCred():
"""
Adds authentication credentials (if any) for current target to the password manager
(used by connection handler)
"""
if kb.passwordMgr and all(_ is not None for _ in (conf.scheme, conf.hostname, conf.port, conf.authUsername, conf.authPassword)):
kb.passwordMgr.add_pa... | [
"def",
"_setAuthCred",
"(",
")",
":",
"if",
"kb",
".",
"passwordMgr",
"and",
"all",
"(",
"_",
"is",
"not",
"None",
"for",
"_",
"in",
"(",
"conf",
".",
"scheme",
",",
"conf",
".",
"hostname",
",",
"conf",
".",
"port",
",",
"conf",
".",
"authUsername... | https://github.com/sabri-zaki/EasY_HaCk/blob/2a39ac384dd0d6fc51c0dd22e8d38cece683fdb9/.modules/.sqlmap/lib/core/option.py#L1137-L1144 | ||
khanhnamle1994/natural-language-processing | 01d450d5ac002b0156ef4cf93a07cb508c1bcdc5 | assignment1/.env/lib/python2.7/site-packages/numpy/ma/core.py | python | MaskedArray.iscontiguous | (self) | return self.flags['CONTIGUOUS'] | Return a boolean indicating whether the data is contiguous.
Parameters
----------
None
Examples
--------
>>> x = np.ma.array([1, 2, 3])
>>> x.iscontiguous()
True
`iscontiguous` returns one of the flags of the masked array:
>>> x.flags
... | Return a boolean indicating whether the data is contiguous. | [
"Return",
"a",
"boolean",
"indicating",
"whether",
"the",
"data",
"is",
"contiguous",
"."
] | def iscontiguous(self):
"""
Return a boolean indicating whether the data is contiguous.
Parameters
----------
None
Examples
--------
>>> x = np.ma.array([1, 2, 3])
>>> x.iscontiguous()
True
`iscontiguous` returns one of the flags... | [
"def",
"iscontiguous",
"(",
"self",
")",
":",
"return",
"self",
".",
"flags",
"[",
"'CONTIGUOUS'",
"]"
] | https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/numpy/ma/core.py#L4252-L4277 | |
facebookarchive/Instadrop | c9bb260bb9e3cbceba86fea4b05549e855d74a2d | oauth/oauth.py | python | OAuthServer.verify_request | (self, oauth_request) | return consumer, token, parameters | Verifies an api call and checks all the parameters. | Verifies an api call and checks all the parameters. | [
"Verifies",
"an",
"api",
"call",
"and",
"checks",
"all",
"the",
"parameters",
"."
] | def verify_request(self, oauth_request):
"""Verifies an api call and checks all the parameters."""
# -> consumer and token
version = self._get_version(oauth_request)
consumer = self._get_consumer(oauth_request)
# Get the access token.
token = self._get_token(oauth_request... | [
"def",
"verify_request",
"(",
"self",
",",
"oauth_request",
")",
":",
"# -> consumer and token",
"version",
"=",
"self",
".",
"_get_version",
"(",
"oauth_request",
")",
"consumer",
"=",
"self",
".",
"_get_consumer",
"(",
"oauth_request",
")",
"# Get the access token... | https://github.com/facebookarchive/Instadrop/blob/c9bb260bb9e3cbceba86fea4b05549e855d74a2d/oauth/oauth.py#L426-L435 | |
Gallopsled/pwntools | 1573957cc8b1957399b7cc9bfae0c6f80630d5d4 | pwnlib/tubes/process.py | python | process.cwd | (self) | return self._cwd | Directory that the process is working in.
Example:
>>> p = process('sh')
>>> p.sendline(b'cd /tmp; echo AAA')
>>> _ = p.recvuntil(b'AAA')
>>> p.cwd == '/tmp'
True
>>> p.sendline(b'cd /proc; echo BBB;')
>>> _ = p.recvuntil(b'BB... | Directory that the process is working in. | [
"Directory",
"that",
"the",
"process",
"is",
"working",
"in",
"."
] | def cwd(self):
"""Directory that the process is working in.
Example:
>>> p = process('sh')
>>> p.sendline(b'cd /tmp; echo AAA')
>>> _ = p.recvuntil(b'AAA')
>>> p.cwd == '/tmp'
True
>>> p.sendline(b'cd /proc; echo BBB;')
... | [
"def",
"cwd",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"_cwd",
"=",
"os",
".",
"readlink",
"(",
"'/proc/%i/cwd'",
"%",
"self",
".",
"pid",
")",
"except",
"Exception",
":",
"pass",
"return",
"self",
".",
"_cwd"
] | https://github.com/Gallopsled/pwntools/blob/1573957cc8b1957399b7cc9bfae0c6f80630d5d4/pwnlib/tubes/process.py#L485-L505 | |
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/graph_objs/_heatmap.py | python | Heatmap.x | (self) | return self["x"] | Sets the x coordinates.
The 'x' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.ndarray | Sets the x coordinates.
The 'x' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series | [
"Sets",
"the",
"x",
"coordinates",
".",
"The",
"x",
"property",
"is",
"an",
"array",
"that",
"may",
"be",
"specified",
"as",
"a",
"tuple",
"list",
"numpy",
"array",
"or",
"pandas",
"Series"
] | def x(self):
"""
Sets the x coordinates.
The 'x' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.ndarray
"""
return self["x"] | [
"def",
"x",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"x\"",
"]"
] | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/_heatmap.py#L1312-L1323 | |
aws/aws-sam-cli | 2aa7bf01b2e0b0864ef63b1898a8b30577443acc | samcli/lib/observability/cw_logs/cw_log_group_provider.py | python | LogGroupProvider.for_lambda_function | (function_name: str) | return "/aws/lambda/{}".format(function_name) | Returns the CloudWatch Log Group Name created by default for the AWS Lambda function with given name
Parameters
----------
function_name : str
Name of the Lambda function
Returns
-------
str
Default Log Group name used by this function | Returns the CloudWatch Log Group Name created by default for the AWS Lambda function with given name | [
"Returns",
"the",
"CloudWatch",
"Log",
"Group",
"Name",
"created",
"by",
"default",
"for",
"the",
"AWS",
"Lambda",
"function",
"with",
"given",
"name"
] | def for_lambda_function(function_name: str) -> str:
"""
Returns the CloudWatch Log Group Name created by default for the AWS Lambda function with given name
Parameters
----------
function_name : str
Name of the Lambda function
Returns
-------
... | [
"def",
"for_lambda_function",
"(",
"function_name",
":",
"str",
")",
"->",
"str",
":",
"return",
"\"/aws/lambda/{}\"",
".",
"format",
"(",
"function_name",
")"
] | https://github.com/aws/aws-sam-cli/blob/2aa7bf01b2e0b0864ef63b1898a8b30577443acc/samcli/lib/observability/cw_logs/cw_log_group_provider.py#L39-L53 | |
celery/py-amqp | 557d98a7d27e171ce7b22e2e3a56baf805ad8e52 | amqp/abstract_channel.py | python | AbstractChannel.dispatch_method | (self, method_sig, payload, content) | [] | def dispatch_method(self, method_sig, payload, content):
if self.is_closing and method_sig not in (
self._ALLOWED_METHODS_WHEN_CLOSING
):
# When channel.close() was called we must ignore all methods except
# Channel.close and Channel.CloseOk
AMQP_LOGGER.wa... | [
"def",
"dispatch_method",
"(",
"self",
",",
"method_sig",
",",
"payload",
",",
"content",
")",
":",
"if",
"self",
".",
"is_closing",
"and",
"method_sig",
"not",
"in",
"(",
"self",
".",
"_ALLOWED_METHODS_WHEN_CLOSING",
")",
":",
"# When channel.close() was called w... | https://github.com/celery/py-amqp/blob/557d98a7d27e171ce7b22e2e3a56baf805ad8e52/amqp/abstract_channel.py#L99-L146 | ||||
kozec/sc-controller | ce92c773b8b26f6404882e9209aff212c4053170 | scc/lib/enum.py | python | EnumMeta.__call__ | (cls, value, names=None, module=None, type=None, start=1) | return cls._create_(value, names, module=module, type=type, start=start) | Either returns an existing member, or creates a new enum class.
This method is used both when an enum class is given a value to match
to an enumeration member (i.e. Color(3)) and for the functional API
(i.e. Color = Enum('Color', names='red green blue')).
When used for the functional A... | Either returns an existing member, or creates a new enum class. | [
"Either",
"returns",
"an",
"existing",
"member",
"or",
"creates",
"a",
"new",
"enum",
"class",
"."
] | def __call__(cls, value, names=None, module=None, type=None, start=1):
"""Either returns an existing member, or creates a new enum class.
This method is used both when an enum class is given a value to match
to an enumeration member (i.e. Color(3)) and for the functional API
(i.e. Color... | [
"def",
"__call__",
"(",
"cls",
",",
"value",
",",
"names",
"=",
"None",
",",
"module",
"=",
"None",
",",
"type",
"=",
"None",
",",
"start",
"=",
"1",
")",
":",
"if",
"names",
"is",
"None",
":",
"# simple value lookup",
"return",
"cls",
".",
"__new__"... | https://github.com/kozec/sc-controller/blob/ce92c773b8b26f6404882e9209aff212c4053170/scc/lib/enum.py#L362-L381 | |
conjure-up/conjure-up | d2bf8ab8e71ff01321d0e691a8d3e3833a047678 | conjureup/ui/widgets/step.py | python | StepForm.set_icon_state | (self, result_code) | updates status icon
Arguments:
icon: icon widget
result_code: 3 types of results, error, waiting, complete | updates status icon | [
"updates",
"status",
"icon"
] | def set_icon_state(self, result_code):
""" updates status icon
Arguments:
icon: icon widget
result_code: 3 types of results, error, waiting, complete
"""
if result_code == "error":
self.icon.set_text(
("error_icon", "\N{BLACK FLAG}"))
... | [
"def",
"set_icon_state",
"(",
"self",
",",
"result_code",
")",
":",
"if",
"result_code",
"==",
"\"error\"",
":",
"self",
".",
"icon",
".",
"set_text",
"(",
"(",
"\"error_icon\"",
",",
"\"\\N{BLACK FLAG}\"",
")",
")",
"elif",
"result_code",
"==",
"\"waiting\"",... | https://github.com/conjure-up/conjure-up/blob/d2bf8ab8e71ff01321d0e691a8d3e3833a047678/conjureup/ui/widgets/step.py#L75-L94 | ||
mu-editor/mu | 5a5d7723405db588f67718a63a0ec0ecabebae33 | mu/interface/main.py | python | Window.remove_repl | (self) | Removes the REPL pane from the application. | Removes the REPL pane from the application. | [
"Removes",
"the",
"REPL",
"pane",
"from",
"the",
"application",
"."
] | def remove_repl(self):
"""
Removes the REPL pane from the application.
"""
if self.repl:
self._repl_area = self.dockWidgetArea(self.repl)
self.repl_pane = None
self.repl.setParent(None)
self.repl.deleteLater()
self.repl = None | [
"def",
"remove_repl",
"(",
"self",
")",
":",
"if",
"self",
".",
"repl",
":",
"self",
".",
"_repl_area",
"=",
"self",
".",
"dockWidgetArea",
"(",
"self",
".",
"repl",
")",
"self",
".",
"repl_pane",
"=",
"None",
"self",
".",
"repl",
".",
"setParent",
"... | https://github.com/mu-editor/mu/blob/5a5d7723405db588f67718a63a0ec0ecabebae33/mu/interface/main.py#L900-L909 | ||
hak5/nano-tetra-modules | aa43cb5e2338b8dbd12a75314104a34ba608263b | PortalAuth/includes/scripts/libs/requests/cookies.py | python | RequestsCookieJar.__getitem__ | (self, name) | return self._find_no_duplicates(name) | Dict-like __getitem__() for compatibility with client code. Throws
exception if there are more than one cookie with name. In that case,
use the more explicit get() method instead.
.. warning:: operation is O(n), not O(1). | Dict-like __getitem__() for compatibility with client code. Throws
exception if there are more than one cookie with name. In that case,
use the more explicit get() method instead. | [
"Dict",
"-",
"like",
"__getitem__",
"()",
"for",
"compatibility",
"with",
"client",
"code",
".",
"Throws",
"exception",
"if",
"there",
"are",
"more",
"than",
"one",
"cookie",
"with",
"name",
".",
"In",
"that",
"case",
"use",
"the",
"more",
"explicit",
"get... | def __getitem__(self, name):
"""Dict-like __getitem__() for compatibility with client code. Throws
exception if there are more than one cookie with name. In that case,
use the more explicit get() method instead.
.. warning:: operation is O(n), not O(1)."""
return self._find_no_... | [
"def",
"__getitem__",
"(",
"self",
",",
"name",
")",
":",
"return",
"self",
".",
"_find_no_duplicates",
"(",
"name",
")"
] | https://github.com/hak5/nano-tetra-modules/blob/aa43cb5e2338b8dbd12a75314104a34ba608263b/PortalAuth/includes/scripts/libs/requests/cookies.py#L275-L282 | |
Source-Python-Dev-Team/Source.Python | d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb | addons/source-python/packages/source-python/engines/sound.py | python | Sound._stop | (self, index, channel) | Stop a sound from being played (internal). | Stop a sound from being played (internal). | [
"Stop",
"a",
"sound",
"from",
"being",
"played",
"(",
"internal",
")",
"."
] | def _stop(self, index, channel):
"""Stop a sound from being played (internal)."""
engine_sound.stop_sound(index, channel, self.sample) | [
"def",
"_stop",
"(",
"self",
",",
"index",
",",
"channel",
")",
":",
"engine_sound",
".",
"stop_sound",
"(",
"index",
",",
"channel",
",",
"self",
".",
"sample",
")"
] | https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/packages/source-python/engines/sound.py#L312-L314 | ||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/Pillow-6.0.0-py3.7-macosx-10.9-x86_64.egg/PIL/ImageStat.py | python | Stat._getsum | (self) | return v | Get sum of all pixels in each layer | Get sum of all pixels in each layer | [
"Get",
"sum",
"of",
"all",
"pixels",
"in",
"each",
"layer"
] | def _getsum(self):
"""Get sum of all pixels in each layer"""
v = []
for i in range(0, len(self.h), 256):
layerSum = 0.0
for j in range(256):
layerSum += j * self.h[i + j]
v.append(layerSum)
return v | [
"def",
"_getsum",
"(",
"self",
")",
":",
"v",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"len",
"(",
"self",
".",
"h",
")",
",",
"256",
")",
":",
"layerSum",
"=",
"0.0",
"for",
"j",
"in",
"range",
"(",
"256",
")",
":",
"layerS... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/Pillow-6.0.0-py3.7-macosx-10.9-x86_64.egg/PIL/ImageStat.py#L77-L86 | |
HiKapok/X-Detector | 1b19e15709635e007494648c4fb519b703a29d84 | xdet_v3_resnet_eval.py | python | xdet_model_fn | (features, labels, mode, params) | Our model_fn for ResNet to be used with our Estimator. | Our model_fn for ResNet to be used with our Estimator. | [
"Our",
"model_fn",
"for",
"ResNet",
"to",
"be",
"used",
"with",
"our",
"Estimator",
"."
] | def xdet_model_fn(features, labels, mode, params):
"""Our model_fn for ResNet to be used with our Estimator."""
num_anchors_list = labels['num_anchors_list']
num_feature_layers = len(num_anchors_list)
shape = labels['targets'][-1]
if mode != tf.estimator.ModeKeys.TRAIN:
org_image = labels['... | [
"def",
"xdet_model_fn",
"(",
"features",
",",
"labels",
",",
"mode",
",",
"params",
")",
":",
"num_anchors_list",
"=",
"labels",
"[",
"'num_anchors_list'",
"]",
"num_feature_layers",
"=",
"len",
"(",
"num_anchors_list",
")",
"shape",
"=",
"labels",
"[",
"'targ... | https://github.com/HiKapok/X-Detector/blob/1b19e15709635e007494648c4fb519b703a29d84/xdet_v3_resnet_eval.py#L304-L442 | ||
clinton-hall/nzbToMedia | 27669389216902d1085660167e7bda0bd8527ecf | libs/common/beets/mediafile.py | python | MediaFile._field_sort_name | (cls, name) | return name | Get a sort key for a field name that determines the order
fields should be written in.
Fields names are kept unchanged, unless they are instances of
:class:`DateItemField`, in which case `year`, `month`, and `day`
are replaced by `date0`, `date1`, and `date2`, respectively, to
m... | Get a sort key for a field name that determines the order
fields should be written in. | [
"Get",
"a",
"sort",
"key",
"for",
"a",
"field",
"name",
"that",
"determines",
"the",
"order",
"fields",
"should",
"be",
"written",
"in",
"."
] | def _field_sort_name(cls, name):
"""Get a sort key for a field name that determines the order
fields should be written in.
Fields names are kept unchanged, unless they are instances of
:class:`DateItemField`, in which case `year`, `month`, and `day`
are replaced by `date0`, `dat... | [
"def",
"_field_sort_name",
"(",
"cls",
",",
"name",
")",
":",
"if",
"isinstance",
"(",
"cls",
".",
"__dict__",
"[",
"name",
"]",
",",
"DateItemField",
")",
":",
"name",
"=",
"re",
".",
"sub",
"(",
"'year'",
",",
"'date0'",
",",
"name",
")",
"name",
... | https://github.com/clinton-hall/nzbToMedia/blob/27669389216902d1085660167e7bda0bd8527ecf/libs/common/beets/mediafile.py#L1530-L1543 | |
qibinlou/SinaWeibo-Emotion-Classification | f336fc104abd68b0ec4180fe2ed80fafe49cb790 | transwarp/mail.py | python | smtp | (host, port=None, username=None, passwd=None, use_tls=False) | return (host, port, username, passwd, use_tls) | Generate a tuple that contains smtp info:
(host, port, username, passwd, use_tls).
e.g.:
('smtp.example.com', 25, 'user', 'passw0rd', False) | Generate a tuple that contains smtp info:
(host, port, username, passwd, use_tls).
e.g.:
('smtp.example.com', 25, 'user', 'passw0rd', False) | [
"Generate",
"a",
"tuple",
"that",
"contains",
"smtp",
"info",
":",
"(",
"host",
"port",
"username",
"passwd",
"use_tls",
")",
".",
"e",
".",
"g",
".",
":",
"(",
"smtp",
".",
"example",
".",
"com",
"25",
"user",
"passw0rd",
"False",
")"
] | def smtp(host, port=None, username=None, passwd=None, use_tls=False):
'''
Generate a tuple that contains smtp info:
(host, port, username, passwd, use_tls).
e.g.:
('smtp.example.com', 25, 'user', 'passw0rd', False)
'''
if port is None:
port = 465 if use_tls else 25
return (host, ... | [
"def",
"smtp",
"(",
"host",
",",
"port",
"=",
"None",
",",
"username",
"=",
"None",
",",
"passwd",
"=",
"None",
",",
"use_tls",
"=",
"False",
")",
":",
"if",
"port",
"is",
"None",
":",
"port",
"=",
"465",
"if",
"use_tls",
"else",
"25",
"return",
... | https://github.com/qibinlou/SinaWeibo-Emotion-Classification/blob/f336fc104abd68b0ec4180fe2ed80fafe49cb790/transwarp/mail.py#L20-L29 | |
glue-viz/glue | 840b4c1364b0fa63bf67c914540c93dd71df41e1 | glue/core/data.py | python | Data.add_component_link | (self, link, label=None) | return dc | Shortcut method for generating a new
:class:`~glue.core.component.DerivedComponent` from a ComponentLink
object, and adding it to a data set.
Parameters
----------
link : :class:`~glue.core.component_link.ComponentLink`
The link to use to generate a new component
... | Shortcut method for generating a new
:class:`~glue.core.component.DerivedComponent` from a ComponentLink
object, and adding it to a data set. | [
"Shortcut",
"method",
"for",
"generating",
"a",
"new",
":",
"class",
":",
"~glue",
".",
"core",
".",
"component",
".",
"DerivedComponent",
"from",
"a",
"ComponentLink",
"object",
"and",
"adding",
"it",
"to",
"a",
"data",
"set",
"."
] | def add_component_link(self, link, label=None):
"""
Shortcut method for generating a new
:class:`~glue.core.component.DerivedComponent` from a ComponentLink
object, and adding it to a data set.
Parameters
----------
link : :class:`~glue.core.component_link.Compon... | [
"def",
"add_component_link",
"(",
"self",
",",
"link",
",",
"label",
"=",
"None",
")",
":",
"if",
"label",
"is",
"not",
"None",
":",
"if",
"not",
"isinstance",
"(",
"label",
",",
"ComponentID",
")",
":",
"label",
"=",
"ComponentID",
"(",
"label",
",",
... | https://github.com/glue-viz/glue/blob/840b4c1364b0fa63bf67c914540c93dd71df41e1/glue/core/data.py#L1073-L1108 | |
HeinleinSupport/check_mk_extensions | aa7d7389b812ed00f91dad61d66fb676284897d8 | wireguard/lib/check_mk/base/plugins/agent_based/wireguard.py | python | discover_wireguard | (section) | [] | def discover_wireguard(section) -> DiscoveryResult:
for interface, peers in section.items():
yield Service(item='%s' % interface)
for peer, data in peers.items():
yield Service(item='%s Peer %s' % (interface, peer),
parameters={'allowed-ips': data['allowed-ips']... | [
"def",
"discover_wireguard",
"(",
"section",
")",
"->",
"DiscoveryResult",
":",
"for",
"interface",
",",
"peers",
"in",
"section",
".",
"items",
"(",
")",
":",
"yield",
"Service",
"(",
"item",
"=",
"'%s'",
"%",
"interface",
")",
"for",
"peer",
",",
"data... | https://github.com/HeinleinSupport/check_mk_extensions/blob/aa7d7389b812ed00f91dad61d66fb676284897d8/wireguard/lib/check_mk/base/plugins/agent_based/wireguard.py#L61-L66 | ||||
openfisca/openfisca-france | 207a58191be6830716693f94d37846f1e5037b51 | openfisca_france/model/prelevements_obligatoires/impot_revenu/reductions_impot.py | python | rpinel.formula_2019_01_01 | (foyer_fiscal, period, parameters) | return reduc_invest_pinel_2019 + report | Investissement locatif privé - Dispositif Pinel
Depuis 2019 | Investissement locatif privé - Dispositif Pinel
Depuis 2019 | [
"Investissement",
"locatif",
"privé",
"-",
"Dispositif",
"Pinel",
"Depuis",
"2019"
] | def formula_2019_01_01(foyer_fiscal, period, parameters):
'''
Investissement locatif privé - Dispositif Pinel
Depuis 2019
'''
f7nb = foyer_fiscal('f7nb', period)
f7nc = foyer_fiscal('f7nc', period)
f7nd = foyer_fiscal('f7nd', period)
f7qi = foyer_fiscal('f... | [
"def",
"formula_2019_01_01",
"(",
"foyer_fiscal",
",",
"period",
",",
"parameters",
")",
":",
"f7nb",
"=",
"foyer_fiscal",
"(",
"'f7nb'",
",",
"period",
")",
"f7nc",
"=",
"foyer_fiscal",
"(",
"'f7nc'",
",",
"period",
")",
"f7nd",
"=",
"foyer_fiscal",
"(",
... | https://github.com/openfisca/openfisca-france/blob/207a58191be6830716693f94d37846f1e5037b51/openfisca_france/model/prelevements_obligatoires/impot_revenu/reductions_impot.py#L4809-L4865 | |
biolab/orange3 | 41685e1c7b1d1babe680113685a2d44bcc9fec0b | Orange/widgets/unsupervised/owtsne.py | python | OWtSNE._add_controls | (self) | [] | def _add_controls(self):
self._add_controls_start_box()
super()._add_controls() | [
"def",
"_add_controls",
"(",
"self",
")",
":",
"self",
".",
"_add_controls_start_box",
"(",
")",
"super",
"(",
")",
".",
"_add_controls",
"(",
")"
] | https://github.com/biolab/orange3/blob/41685e1c7b1d1babe680113685a2d44bcc9fec0b/Orange/widgets/unsupervised/owtsne.py#L294-L296 | ||||
sympy/sympy | d822fcba181155b85ff2b29fe525adbafb22b448 | sympy/integrals/rubi/parsetools/generate_rules.py | python | generate_rules_from_downvalues | () | This function generate rules and saves in file. For more details,
see `https://github.com/sympy/sympy/wiki/Rubi-parsing-guide` | This function generate rules and saves in file. For more details,
see `https://github.com/sympy/sympy/wiki/Rubi-parsing-guide` | [
"This",
"function",
"generate",
"rules",
"and",
"saves",
"in",
"file",
".",
"For",
"more",
"details",
"see",
"https",
":",
"//",
"github",
".",
"com",
"/",
"sympy",
"/",
"sympy",
"/",
"wiki",
"/",
"Rubi",
"-",
"parsing",
"-",
"guide"
] | def generate_rules_from_downvalues():
"""
This function generate rules and saves in file. For more details,
see `https://github.com/sympy/sympy/wiki/Rubi-parsing-guide`
"""
cons_dict = {}
cons_index = 0
index = 0
cons = ''
input = ["Integrand_simplification.txt", "Linear_products.txt... | [
"def",
"generate_rules_from_downvalues",
"(",
")",
":",
"cons_dict",
"=",
"{",
"}",
"cons_index",
"=",
"0",
"index",
"=",
"0",
"cons",
"=",
"''",
"input",
"=",
"[",
"\"Integrand_simplification.txt\"",
",",
"\"Linear_products.txt\"",
",",
"\"Quadratic_products.txt\""... | https://github.com/sympy/sympy/blob/d822fcba181155b85ff2b29fe525adbafb22b448/sympy/integrals/rubi/parsetools/generate_rules.py#L7-L59 | ||
dvlab-research/3DSSD | 8bc7605d4d3a6ec9051e7689e96a23bdac4c4cd9 | lib/utils/box_3d_utils.py | python | get_box3d_corners_helper_np | (centers, headings, sizes) | return corners_3d | Input: (N, 3), (N, ), (N, 3), Output: [N, 8, 3] | Input: (N, 3), (N, ), (N, 3), Output: [N, 8, 3] | [
"Input",
":",
"(",
"N",
"3",
")",
"(",
"N",
")",
"(",
"N",
"3",
")",
"Output",
":",
"[",
"N",
"8",
"3",
"]"
] | def get_box3d_corners_helper_np(centers, headings, sizes):
''' Input: (N, 3), (N, ), (N, 3), Output: [N, 8, 3]'''
N = centers.shape[0]
l = sizes[:, 0]
h = sizes[:, 1]
w = sizes[:, 2]
z = np.zeros_like(l)
x_corners = np.stack([l/2,l/2,-l/2,-l/2,l/2,l/2,-l/2,-l/2], axis=1) # (N,8)
y_corne... | [
"def",
"get_box3d_corners_helper_np",
"(",
"centers",
",",
"headings",
",",
"sizes",
")",
":",
"N",
"=",
"centers",
".",
"shape",
"[",
"0",
"]",
"l",
"=",
"sizes",
"[",
":",
",",
"0",
"]",
"h",
"=",
"sizes",
"[",
":",
",",
"1",
"]",
"w",
"=",
"... | https://github.com/dvlab-research/3DSSD/blob/8bc7605d4d3a6ec9051e7689e96a23bdac4c4cd9/lib/utils/box_3d_utils.py#L62-L87 | |
tobegit3hub/deep_image_model | 8a53edecd9e00678b278bb10f6fb4bdb1e4ee25e | java_predict_client/src/main/proto/tensorflow/contrib/metrics/python/ops/metric_ops.py | python | streaming_mean_squared_error | (predictions, labels, weights=None,
metrics_collections=None,
updates_collections=None,
name=None) | return streaming_mean(squared_error, weights, metrics_collections,
updates_collections, name or 'mean_squared_error') | Computes the mean squared error between the labels and predictions.
The `streaming_mean_squared_error` function creates two local variables,
`total` and `count` that are used to compute the mean squared error.
This average is weighted by `weights`, and it is ultimately returned as
`mean_squared_error`: an idem... | Computes the mean squared error between the labels and predictions. | [
"Computes",
"the",
"mean",
"squared",
"error",
"between",
"the",
"labels",
"and",
"predictions",
"."
] | def streaming_mean_squared_error(predictions, labels, weights=None,
metrics_collections=None,
updates_collections=None,
name=None):
"""Computes the mean squared error between the labels and predictions.
The `streamin... | [
"def",
"streaming_mean_squared_error",
"(",
"predictions",
",",
"labels",
",",
"weights",
"=",
"None",
",",
"metrics_collections",
"=",
"None",
",",
"updates_collections",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"predictions",
",",
"labels",
",",
"wei... | https://github.com/tobegit3hub/deep_image_model/blob/8a53edecd9e00678b278bb10f6fb4bdb1e4ee25e/java_predict_client/src/main/proto/tensorflow/contrib/metrics/python/ops/metric_ops.py#L2303-L2352 | |
cloud-custodian/cloud-custodian | 1ce1deb2d0f0832d6eb8839ef74b4c9e397128de | tools/c7n_policystream/policystream.py | python | org_checkout | (organization, github_url, github_token, clone_dir,
verbose, filter, exclude) | return repos | Checkout repositories from a GitHub organization. | Checkout repositories from a GitHub organization. | [
"Checkout",
"repositories",
"from",
"a",
"GitHub",
"organization",
"."
] | def org_checkout(organization, github_url, github_token, clone_dir,
verbose, filter, exclude):
"""Checkout repositories from a GitHub organization."""
logging.basicConfig(
format="%(asctime)s: %(name)s:%(levelname)s %(message)s",
level=(verbose and logging.DEBUG or logging.INFO)... | [
"def",
"org_checkout",
"(",
"organization",
",",
"github_url",
",",
"github_token",
",",
"clone_dir",
",",
"verbose",
",",
"filter",
",",
"exclude",
")",
":",
"logging",
".",
"basicConfig",
"(",
"format",
"=",
"\"%(asctime)s: %(name)s:%(levelname)s %(message)s\"",
"... | https://github.com/cloud-custodian/cloud-custodian/blob/1ce1deb2d0f0832d6eb8839ef74b4c9e397128de/tools/c7n_policystream/policystream.py#L744-L787 | |
merenlab/anvio | 9b792e2cedc49ecb7c0bed768261595a0d87c012 | anvio/kegg.py | python | KeggMetabolismEstimator.estimate_for_genome | (self, kofam_gene_split_contig) | return genome_metabolism_superdict, genome_ko_superdict | This is the metabolism estimation function for a contigs DB that contains a single genome.
Assuming this contigs DB contains only one genome, it sends all of the splits and their kofam hits to the atomic
estimation function for processing. It then returns the metabolism and ko completion dictionaries f... | This is the metabolism estimation function for a contigs DB that contains a single genome. | [
"This",
"is",
"the",
"metabolism",
"estimation",
"function",
"for",
"a",
"contigs",
"DB",
"that",
"contains",
"a",
"single",
"genome",
"."
] | def estimate_for_genome(self, kofam_gene_split_contig):
"""This is the metabolism estimation function for a contigs DB that contains a single genome.
Assuming this contigs DB contains only one genome, it sends all of the splits and their kofam hits to the atomic
estimation function for processi... | [
"def",
"estimate_for_genome",
"(",
"self",
",",
"kofam_gene_split_contig",
")",
":",
"genome_metabolism_superdict",
"=",
"{",
"}",
"genome_ko_superdict",
"=",
"{",
"}",
"# since all hits belong to one genome, we can take the UNIQUE splits from all the hits",
"splits_in_genome",
"... | https://github.com/merenlab/anvio/blob/9b792e2cedc49ecb7c0bed768261595a0d87c012/anvio/kegg.py#L3044-L3080 | |
owid/covid-19-data | 936aeae6cfbdc0163939ed7bd8ecdbb2582c0a92 | scripts/src/cowidev/vax/incremental/philippines.py | python | Philippines.export | (self) | [] | def export(self):
data = self.read().pipe(self.pipeline)
increment(
location=data["location"],
total_vaccinations=data["total_vaccinations"],
# people_vaccinated=data["people_vaccinated"],
people_fully_vaccinated=data["people_fully_vaccinated"],
... | [
"def",
"export",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"read",
"(",
")",
".",
"pipe",
"(",
"self",
".",
"pipeline",
")",
"increment",
"(",
"location",
"=",
"data",
"[",
"\"location\"",
"]",
",",
"total_vaccinations",
"=",
"data",
"[",
"\"t... | https://github.com/owid/covid-19-data/blob/936aeae6cfbdc0163939ed7bd8ecdbb2582c0a92/scripts/src/cowidev/vax/incremental/philippines.py#L79-L90 | ||||
namlook/mongokit | 04f6cb2703a662c5beb9bd5a7d4dbec3f03d9c6d | mongokit/schema_document.py | python | SchemaDocument.__init__ | (self, doc=None, gen_skel=True, _gen_auth_types=True, _validate=True, lang='en', fallback_lang='en') | doc : a dictionary
gen_skel : if True, generate automatically the skeleton of the doc
filled with NoneType each time validate() is called. Note that
if doc is not {}, gen_skel is always False. If gen_skel is False,
default_values cannot be filled.
gen_auth_types: if T... | doc : a dictionary
gen_skel : if True, generate automatically the skeleton of the doc
filled with NoneType each time validate() is called. Note that
if doc is not {}, gen_skel is always False. If gen_skel is False,
default_values cannot be filled.
gen_auth_types: if T... | [
"doc",
":",
"a",
"dictionary",
"gen_skel",
":",
"if",
"True",
"generate",
"automatically",
"the",
"skeleton",
"of",
"the",
"doc",
"filled",
"with",
"NoneType",
"each",
"time",
"validate",
"()",
"is",
"called",
".",
"Note",
"that",
"if",
"doc",
"is",
"not",... | def __init__(self, doc=None, gen_skel=True, _gen_auth_types=True, _validate=True, lang='en', fallback_lang='en'):
"""
doc : a dictionary
gen_skel : if True, generate automatically the skeleton of the doc
filled with NoneType each time validate() is called. Note that
if do... | [
"def",
"__init__",
"(",
"self",
",",
"doc",
"=",
"None",
",",
"gen_skel",
"=",
"True",
",",
"_gen_auth_types",
"=",
"True",
",",
"_validate",
"=",
"True",
",",
"lang",
"=",
"'en'",
",",
"fallback_lang",
"=",
"'en'",
")",
":",
"super",
"(",
"SchemaDocum... | https://github.com/namlook/mongokit/blob/04f6cb2703a662c5beb9bd5a7d4dbec3f03d9c6d/mongokit/schema_document.py#L349-L379 | ||
accel-brain/accel-brain-code | 86f489dc9be001a3bae6d053f48d6b57c0bedb95 | Accel-Brain-Base/accelbrainbase/observabledata/_mxnet/restrictedboltzmannmachines/deep_boltzmann_machines.py | python | DeepBoltzmannMachines.collect_params | (self, select=None) | return params_dict | Overrided `collect_params` in `mxnet.gluon.HybridBlok`. | Overrided `collect_params` in `mxnet.gluon.HybridBlok`. | [
"Overrided",
"collect_params",
"in",
"mxnet",
".",
"gluon",
".",
"HybridBlok",
"."
] | def collect_params(self, select=None):
'''
Overrided `collect_params` in `mxnet.gluon.HybridBlok`.
'''
params_dict = self.__rbm_list[0].collect_params(select)
for i in range(1, len(self.__rbm_list)):
params_dict.update(self.__rbm_list[i].collect_params(select))
... | [
"def",
"collect_params",
"(",
"self",
",",
"select",
"=",
"None",
")",
":",
"params_dict",
"=",
"self",
".",
"__rbm_list",
"[",
"0",
"]",
".",
"collect_params",
"(",
"select",
")",
"for",
"i",
"in",
"range",
"(",
"1",
",",
"len",
"(",
"self",
".",
... | https://github.com/accel-brain/accel-brain-code/blob/86f489dc9be001a3bae6d053f48d6b57c0bedb95/Accel-Brain-Base/accelbrainbase/observabledata/_mxnet/restrictedboltzmannmachines/deep_boltzmann_machines.py#L128-L135 | |
memray/seq2seq-keyphrase | 9145c63ebdc4c3bc431f8091dc52547a46804012 | emolga/layers/attention.py | python | Attention.__call__ | (self, X, S,
Smask=None,
return_log=False,
Cov=None) | [] | def __call__(self, X, S,
Smask=None,
return_log=False,
Cov=None):
assert X.ndim + 1 == S.ndim, 'source should be one more dimension than target.'
# X is the decoder representation of t-1: (nb_samples, hidden_dims)
# S is the context vector, h... | [
"def",
"__call__",
"(",
"self",
",",
"X",
",",
"S",
",",
"Smask",
"=",
"None",
",",
"return_log",
"=",
"False",
",",
"Cov",
"=",
"None",
")",
":",
"assert",
"X",
".",
"ndim",
"+",
"1",
"==",
"S",
".",
"ndim",
",",
"'source should be one more dimensio... | https://github.com/memray/seq2seq-keyphrase/blob/9145c63ebdc4c3bc431f8091dc52547a46804012/emolga/layers/attention.py#L42-L79 | ||||
pymc-devs/pymc | 38867dd19e96afb0ceccc8ccd74a9795f118dfe3 | pymc/model.py | python | Model.profile | (self, outs, *, n=1000, point=None, profile=True, **kwargs) | return f.profile | Compiles and profiles an Aesara function which returns ``outs`` and
takes values of model vars as a dict as an argument.
Parameters
----------
outs: Aesara variable or iterable of Aesara variables
n: int, default 1000
Number of iterations to run
point: point
... | Compiles and profiles an Aesara function which returns ``outs`` and
takes values of model vars as a dict as an argument. | [
"Compiles",
"and",
"profiles",
"an",
"Aesara",
"function",
"which",
"returns",
"outs",
"and",
"takes",
"values",
"of",
"model",
"vars",
"as",
"a",
"dict",
"as",
"an",
"argument",
"."
] | def profile(self, outs, *, n=1000, point=None, profile=True, **kwargs):
"""Compiles and profiles an Aesara function which returns ``outs`` and
takes values of model vars as a dict as an argument.
Parameters
----------
outs: Aesara variable or iterable of Aesara variables
... | [
"def",
"profile",
"(",
"self",
",",
"outs",
",",
"*",
",",
"n",
"=",
"1000",
",",
"point",
"=",
"None",
",",
"profile",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
".",
"setdefault",
"(",
"\"on_unused_input\"",
",",
"\"ignore\"",
")",
... | https://github.com/pymc-devs/pymc/blob/38867dd19e96afb0ceccc8ccd74a9795f118dfe3/pymc/model.py#L1520-L1548 | |
deanishe/alfred-convert | 97407f4ec8dbca5abbc6952b2b56cf3918624177 | currencies/currencies_crypto.py | python | main | () | Generate list of cryptocurrencies with exchange rates. | Generate list of cryptocurrencies with exchange rates. | [
"Generate",
"list",
"of",
"cryptocurrencies",
"with",
"exchange",
"rates",
"."
] | def main():
"""Generate list of cryptocurrencies with exchange rates."""
r = requests.get(all_currencies_url)
r.raise_for_status()
data = r.json()
all_currencies = []
valid = []
invalid = set()
for k, d in data['Data'].items():
all_currencies.append(Currency(k, d['CoinName']))
... | [
"def",
"main",
"(",
")",
":",
"r",
"=",
"requests",
".",
"get",
"(",
"all_currencies_url",
")",
"r",
".",
"raise_for_status",
"(",
")",
"data",
"=",
"r",
".",
"json",
"(",
")",
"all_currencies",
"=",
"[",
"]",
"valid",
"=",
"[",
"]",
"invalid",
"="... | https://github.com/deanishe/alfred-convert/blob/97407f4ec8dbca5abbc6952b2b56cf3918624177/currencies/currencies_crypto.py#L56-L91 | ||
duo-labs/py_webauthn | fe97b9841328aa84559bd2a282c07d20145845c1 | webauthn/registration/formats/packed.py | python | verify_packed | (
*,
attestation_statement: AttestationStatement,
attestation_object: bytes,
client_data_json: bytes,
credential_public_key: bytes,
pem_root_certs_bytes: List[bytes],
) | return True | Verify a "packed" attestation statement
See https://www.w3.org/TR/webauthn-2/#sctn-packed-attestation | Verify a "packed" attestation statement | [
"Verify",
"a",
"packed",
"attestation",
"statement"
] | def verify_packed(
*,
attestation_statement: AttestationStatement,
attestation_object: bytes,
client_data_json: bytes,
credential_public_key: bytes,
pem_root_certs_bytes: List[bytes],
) -> bool:
"""Verify a "packed" attestation statement
See https://www.w3.org/TR/webauthn-2/#sctn-packed... | [
"def",
"verify_packed",
"(",
"*",
",",
"attestation_statement",
":",
"AttestationStatement",
",",
"attestation_object",
":",
"bytes",
",",
"client_data_json",
":",
"bytes",
",",
"credential_public_key",
":",
"bytes",
",",
"pem_root_certs_bytes",
":",
"List",
"[",
"b... | https://github.com/duo-labs/py_webauthn/blob/fe97b9841328aa84559bd2a282c07d20145845c1/webauthn/registration/formats/packed.py#L22-L110 | |
Pylons/pylons | 8625d5af790560219c5114358611bc7e0edcf12f | scripts/go-pylons.py | python | find_wheels | (projects, search_dirs) | return wheels | Find wheels from which we can import PROJECTS.
Scan through SEARCH_DIRS for a wheel for each PROJECT in turn. Return
a list of the first wheel found for each PROJECT | Find wheels from which we can import PROJECTS. | [
"Find",
"wheels",
"from",
"which",
"we",
"can",
"import",
"PROJECTS",
"."
] | def find_wheels(projects, search_dirs):
"""Find wheels from which we can import PROJECTS.
Scan through SEARCH_DIRS for a wheel for each PROJECT in turn. Return
a list of the first wheel found for each PROJECT
"""
wheels = []
# Look through SEARCH_DIRS for the first suitable wheel. Don't bothe... | [
"def",
"find_wheels",
"(",
"projects",
",",
"search_dirs",
")",
":",
"wheels",
"=",
"[",
"]",
"# Look through SEARCH_DIRS for the first suitable wheel. Don't bother",
"# about version checking here, as this is simply to get something we can",
"# then use to install the correct version.",... | https://github.com/Pylons/pylons/blob/8625d5af790560219c5114358611bc7e0edcf12f/scripts/go-pylons.py#L916-L940 | |
kubernetes-client/python | 47b9da9de2d02b2b7a34fbe05afb44afd130d73a | kubernetes/client/api/core_v1_api.py | python | CoreV1Api.list_namespaced_secret_with_http_info | (self, namespace, **kwargs) | return self.api_client.call_api(
'/api/v1/namespaces/{namespace}/secrets', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='V1SecretList', # n... | list_namespaced_secret # noqa: E501
list or watch objects of kind Secret # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.list_namespaced_secret_with_http_info(namespace, async_req=T... | list_namespaced_secret # noqa: E501 | [
"list_namespaced_secret",
"#",
"noqa",
":",
"E501"
] | def list_namespaced_secret_with_http_info(self, namespace, **kwargs): # noqa: E501
"""list_namespaced_secret # noqa: E501
list or watch objects of kind Secret # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async... | [
"def",
"list_namespaced_secret_with_http_info",
"(",
"self",
",",
"namespace",
",",
"*",
"*",
"kwargs",
")",
":",
"# noqa: E501",
"local_var_params",
"=",
"locals",
"(",
")",
"all_params",
"=",
"[",
"'namespace'",
",",
"'pretty'",
",",
"'allow_watch_bookmarks'",
"... | https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/api/core_v1_api.py#L16081-L16208 | |
QCoDeS/Qcodes | 3cda2cef44812e2aa4672781f2423bf5f816f9f9 | qcodes/instrument_drivers/american_magnetics/AMI430.py | python | AMI430.set_field | (self,
value: float,
*,
block: bool = True,
perform_safety_check: bool = True) | Ramp to a certain field
Args:
value: Value to ramp to.
block: Whether to wait unit the field has finished setting
perform_safety_check: Whether to set the field via a parent
driver (if present), which might perform additional safety
checks. | Ramp to a certain field | [
"Ramp",
"to",
"a",
"certain",
"field"
] | def set_field(self,
value: float,
*,
block: bool = True,
perform_safety_check: bool = True) -> None:
"""
Ramp to a certain field
Args:
value: Value to ramp to.
block: Whether to wait unit the field h... | [
"def",
"set_field",
"(",
"self",
",",
"value",
":",
"float",
",",
"*",
",",
"block",
":",
"bool",
"=",
"True",
",",
"perform_safety_check",
":",
"bool",
"=",
"True",
")",
"->",
"None",
":",
"# Check we aren't violating field limits",
"field_lim",
"=",
"float... | https://github.com/QCoDeS/Qcodes/blob/3cda2cef44812e2aa4672781f2423bf5f816f9f9/qcodes/instrument_drivers/american_magnetics/AMI430.py#L311-L364 | ||
jython/jython3 | def4f8ec47cb7a9c799ea4c745f12badf92c5769 | lib-python/3.5.1/poplib.py | python | POP3.quit | (self) | return resp | Signoff: commit changes on server, unlock mailbox, close connection. | Signoff: commit changes on server, unlock mailbox, close connection. | [
"Signoff",
":",
"commit",
"changes",
"on",
"server",
"unlock",
"mailbox",
"close",
"connection",
"."
] | def quit(self):
"""Signoff: commit changes on server, unlock mailbox, close connection."""
resp = self._shortcmd('QUIT')
self.close()
return resp | [
"def",
"quit",
"(",
"self",
")",
":",
"resp",
"=",
"self",
".",
"_shortcmd",
"(",
"'QUIT'",
")",
"self",
".",
"close",
"(",
")",
"return",
"resp"
] | https://github.com/jython/jython3/blob/def4f8ec47cb7a9c799ea4c745f12badf92c5769/lib-python/3.5.1/poplib.py#L272-L276 | |
VirtueSecurity/aws-extender | d123b7e1a845847709ba3a481f11996bddc68a1c | BappModules/docutils/statemachine.py | python | StateMachine.run | (self, input_lines, input_offset=0, context=None,
input_source=None, initial_state=None) | return results | Run the state machine on `input_lines`. Return results (a list).
Reset `self.line_offset` and `self.current_state`. Run the
beginning-of-file transition. Input one line at a time and check for a
matching transition. If a match is found, call the transition method
and possibly change the... | Run the state machine on `input_lines`. Return results (a list). | [
"Run",
"the",
"state",
"machine",
"on",
"input_lines",
".",
"Return",
"results",
"(",
"a",
"list",
")",
"."
] | def run(self, input_lines, input_offset=0, context=None,
input_source=None, initial_state=None):
"""
Run the state machine on `input_lines`. Return results (a list).
Reset `self.line_offset` and `self.current_state`. Run the
beginning-of-file transition. Input one line at a ... | [
"def",
"run",
"(",
"self",
",",
"input_lines",
",",
"input_offset",
"=",
"0",
",",
"context",
"=",
"None",
",",
"input_source",
"=",
"None",
",",
"initial_state",
"=",
"None",
")",
":",
"self",
".",
"runtime_init",
"(",
")",
"if",
"isinstance",
"(",
"i... | https://github.com/VirtueSecurity/aws-extender/blob/d123b7e1a845847709ba3a481f11996bddc68a1c/BappModules/docutils/statemachine.py#L184-L279 | |
mkusner/grammarVAE | ffffe272a8cf1772578dfc92254c55c224cddc02 | Theano-master/theano/tensor/extra_ops.py | python | fill_diagonal | (a, val) | return fill_diagonal_(a, val) | Returns a copy of an array with all
elements of the main diagonal set to a specified scalar value.
.. versionadded:: 0.6
Parameters
----------
a
Rectangular array of at least two dimensions.
val
Scalar value to fill the diagonal whose type must be
compatible with that o... | Returns a copy of an array with all
elements of the main diagonal set to a specified scalar value. | [
"Returns",
"a",
"copy",
"of",
"an",
"array",
"with",
"all",
"elements",
"of",
"the",
"main",
"diagonal",
"set",
"to",
"a",
"specified",
"scalar",
"value",
"."
] | def fill_diagonal(a, val):
"""
Returns a copy of an array with all
elements of the main diagonal set to a specified scalar value.
.. versionadded:: 0.6
Parameters
----------
a
Rectangular array of at least two dimensions.
val
Scalar value to fill the diagonal whose type... | [
"def",
"fill_diagonal",
"(",
"a",
",",
"val",
")",
":",
"return",
"fill_diagonal_",
"(",
"a",
",",
"val",
")"
] | https://github.com/mkusner/grammarVAE/blob/ffffe272a8cf1772578dfc92254c55c224cddc02/Theano-master/theano/tensor/extra_ops.py#L888-L918 | |
NetEaseGame/iOS-private-api-checker | c9dc24bda7398c0d33553dce2c968d308ee968e7 | db/sqlite_utils.py | python | SqliteHandler.exec_select | (self, sql, params = ()) | ps:执行查询类型的sql语句 | ps:执行查询类型的sql语句 | [
"ps:执行查询类型的sql语句"
] | def exec_select(self, sql, params = ()):
'''
ps:执行查询类型的sql语句
'''
try:
self.cursor.execute(sql, params)
result_set = self.cursor.fetchall()
return result_set
except Exception, e:
print e
return False | [
"def",
"exec_select",
"(",
"self",
",",
"sql",
",",
"params",
"=",
"(",
")",
")",
":",
"try",
":",
"self",
".",
"cursor",
".",
"execute",
"(",
"sql",
",",
"params",
")",
"result_set",
"=",
"self",
".",
"cursor",
".",
"fetchall",
"(",
")",
"return",... | https://github.com/NetEaseGame/iOS-private-api-checker/blob/c9dc24bda7398c0d33553dce2c968d308ee968e7/db/sqlite_utils.py#L44-L54 | ||
facebookresearch/Detectron | 1809dd41c1ffc881c0d6b1c16ea38d08894f8b6d | detectron/utils/keypoints.py | python | scores_to_probs | (scores) | return scores | Transforms CxHxW of scores to probabilities spatially. | Transforms CxHxW of scores to probabilities spatially. | [
"Transforms",
"CxHxW",
"of",
"scores",
"to",
"probabilities",
"spatially",
"."
] | def scores_to_probs(scores):
"""Transforms CxHxW of scores to probabilities spatially."""
channels = scores.shape[0]
for c in range(channels):
temp = scores[c, :, :]
max_score = temp.max()
temp = np.exp(temp - max_score) / np.sum(np.exp(temp - max_score))
scores[c, :, :] = te... | [
"def",
"scores_to_probs",
"(",
"scores",
")",
":",
"channels",
"=",
"scores",
".",
"shape",
"[",
"0",
"]",
"for",
"c",
"in",
"range",
"(",
"channels",
")",
":",
"temp",
"=",
"scores",
"[",
"c",
",",
":",
",",
":",
"]",
"max_score",
"=",
"temp",
"... | https://github.com/facebookresearch/Detectron/blob/1809dd41c1ffc881c0d6b1c16ea38d08894f8b6d/detectron/utils/keypoints.py#L214-L222 | |
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/pyOpenSSL-17.5.0/src/OpenSSL/crypto.py | python | Revoked.get_rev_date | (self) | return _get_asn1_time(dt) | Get the revocation timestamp.
:return: The timestamp of the revocation, as ASN.1 TIME.
:rtype: bytes | Get the revocation timestamp. | [
"Get",
"the",
"revocation",
"timestamp",
"."
] | def get_rev_date(self):
"""
Get the revocation timestamp.
:return: The timestamp of the revocation, as ASN.1 TIME.
:rtype: bytes
"""
dt = _lib.X509_REVOKED_get0_revocationDate(self._revoked)
return _get_asn1_time(dt) | [
"def",
"get_rev_date",
"(",
"self",
")",
":",
"dt",
"=",
"_lib",
".",
"X509_REVOKED_get0_revocationDate",
"(",
"self",
".",
"_revoked",
")",
"return",
"_get_asn1_time",
"(",
"dt",
")"
] | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/pyOpenSSL-17.5.0/src/OpenSSL/crypto.py#L2098-L2106 | |
linxid/Machine_Learning_Study_Path | 558e82d13237114bbb8152483977806fc0c222af | Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/setuptools/dist.py | python | check_nsp | (dist, attr, value) | Verify that namespace packages are valid | Verify that namespace packages are valid | [
"Verify",
"that",
"namespace",
"packages",
"are",
"valid"
] | def check_nsp(dist, attr, value):
"""Verify that namespace packages are valid"""
ns_packages = value
assert_string_list(dist, attr, ns_packages)
for nsp in ns_packages:
if not dist.has_contents_for(nsp):
raise DistutilsSetupError(
"Distribution contains no modules or ... | [
"def",
"check_nsp",
"(",
"dist",
",",
"attr",
",",
"value",
")",
":",
"ns_packages",
"=",
"value",
"assert_string_list",
"(",
"dist",
",",
"attr",
",",
"ns_packages",
")",
"for",
"nsp",
"in",
"ns_packages",
":",
"if",
"not",
"dist",
".",
"has_contents_for"... | https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/setuptools/dist.py#L120-L135 | ||
HonglinChu/SiamTrackers | 8471660b14f970578a43f077b28207d44a27e867 | SiamBAN/SiamBAN/siamban/utils/bbox.py | python | get_min_max_bbox | (region) | return cx, cy, w, h | convert region to (cx, cy, w, h) that represent by mim-max box | convert region to (cx, cy, w, h) that represent by mim-max box | [
"convert",
"region",
"to",
"(",
"cx",
"cy",
"w",
"h",
")",
"that",
"represent",
"by",
"mim",
"-",
"max",
"box"
] | def get_min_max_bbox(region):
""" convert region to (cx, cy, w, h) that represent by mim-max box
"""
nv = region.size
if nv == 8:
cx = np.mean(region[0::2])
cy = np.mean(region[1::2])
x1 = min(region[0::2])
x2 = max(region[0::2])
y1 = min(region[1::2])
y2 ... | [
"def",
"get_min_max_bbox",
"(",
"region",
")",
":",
"nv",
"=",
"region",
".",
"size",
"if",
"nv",
"==",
"8",
":",
"cx",
"=",
"np",
".",
"mean",
"(",
"region",
"[",
"0",
":",
":",
"2",
"]",
")",
"cy",
"=",
"np",
".",
"mean",
"(",
"region",
"["... | https://github.com/HonglinChu/SiamTrackers/blob/8471660b14f970578a43f077b28207d44a27e867/SiamBAN/SiamBAN/siamban/utils/bbox.py#L136-L156 | |
selfboot/LeetCode | 473c0c5451651140d75cbd143309c51cd8fe1cf1 | BinarySearch/153_FindMinimumInRotatedSortedArray.py | python | Solution.findMin | (self, nums) | return nums[left] | [] | def findMin(self, nums):
# assert(nums)
left = 0
right = len(nums) - 1
# Make sure right is always in the right rotated part.
# Left can be either in the left part or the minimum part.
# So, when left and right is the same finally, we find the minimum.
while left ... | [
"def",
"findMin",
"(",
"self",
",",
"nums",
")",
":",
"# assert(nums)",
"left",
"=",
"0",
"right",
"=",
"len",
"(",
"nums",
")",
"-",
"1",
"# Make sure right is always in the right rotated part.",
"# Left can be either in the left part or the minimum part.",
"# So, when l... | https://github.com/selfboot/LeetCode/blob/473c0c5451651140d75cbd143309c51cd8fe1cf1/BinarySearch/153_FindMinimumInRotatedSortedArray.py#L6-L25 | |||
zynga/jasy | 8a2ec2c2ca3f6c0f73cba4306e581c89b30f1b18 | jasy/env/Task.py | python | printTasks | (indent=16) | Prints out a list of all avaible tasks and their descriptions | Prints out a list of all avaible tasks and their descriptions | [
"Prints",
"out",
"a",
"list",
"of",
"all",
"avaible",
"tasks",
"and",
"their",
"descriptions"
] | def printTasks(indent=16):
"""Prints out a list of all avaible tasks and their descriptions"""
for name in sorted(__taskRegistry):
obj = __taskRegistry[name]
formattedName = name
if obj.__doc__:
space = (indent - len(name)) * " "
print(" %s: %s%s" % (form... | [
"def",
"printTasks",
"(",
"indent",
"=",
"16",
")",
":",
"for",
"name",
"in",
"sorted",
"(",
"__taskRegistry",
")",
":",
"obj",
"=",
"__taskRegistry",
"[",
"name",
"]",
"formattedName",
"=",
"name",
"if",
"obj",
".",
"__doc__",
":",
"space",
"=",
"(",
... | https://github.com/zynga/jasy/blob/8a2ec2c2ca3f6c0f73cba4306e581c89b30f1b18/jasy/env/Task.py#L147-L171 | ||
theotherp/nzbhydra | 4b03d7f769384b97dfc60dade4806c0fc987514e | libs/cookielib.py | python | deepvalues | (mapping) | Iterates over nested mapping, depth-first, in sorted order by key. | Iterates over nested mapping, depth-first, in sorted order by key. | [
"Iterates",
"over",
"nested",
"mapping",
"depth",
"-",
"first",
"in",
"sorted",
"order",
"by",
"key",
"."
] | def deepvalues(mapping):
"""Iterates over nested mapping, depth-first, in sorted order by key."""
values = vals_sorted_by_key(mapping)
for obj in values:
mapping = False
try:
obj.items
except AttributeError:
pass
else:
mapping = True
... | [
"def",
"deepvalues",
"(",
"mapping",
")",
":",
"values",
"=",
"vals_sorted_by_key",
"(",
"mapping",
")",
"for",
"obj",
"in",
"values",
":",
"mapping",
"=",
"False",
"try",
":",
"obj",
".",
"items",
"except",
"AttributeError",
":",
"pass",
"else",
":",
"m... | https://github.com/theotherp/nzbhydra/blob/4b03d7f769384b97dfc60dade4806c0fc987514e/libs/cookielib.py#L1196-L1210 | ||
IronLanguages/ironpython3 | 7a7bb2a872eeab0d1009fc8a6e24dca43f65b693 | Src/StdLib/Lib/shelve.py | python | Shelf.__contains__ | (self, key) | return key.encode(self.keyencoding) in self.dict | [] | def __contains__(self, key):
return key.encode(self.keyencoding) in self.dict | [
"def",
"__contains__",
"(",
"self",
",",
"key",
")",
":",
"return",
"key",
".",
"encode",
"(",
"self",
".",
"keyencoding",
")",
"in",
"self",
".",
"dict"
] | https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/shelve.py#L101-L102 | |||
glutanimate/cloze-overlapper | 9eabb6a9d2a6807595478647fd968e8e4bac86fc | src/cloze_overlapper/libaddon/anki/configmanager.py | python | ConfigManager.all | (self) | return self._config | Implements evaluation of self.all
Returns the values of all config storages currently managed
by the config manager instance.
Returns:
dict -- Dictionary of all config values | Implements evaluation of self.all | [
"Implements",
"evaluation",
"of",
"self",
".",
"all"
] | def all(self):
"""
Implements evaluation of self.all
Returns the values of all config storages currently managed
by the config manager instance.
Returns:
dict -- Dictionary of all config values
"""
for storage in self._storages.values():
... | [
"def",
"all",
"(",
"self",
")",
":",
"for",
"storage",
"in",
"self",
".",
"_storages",
".",
"values",
"(",
")",
":",
"if",
"not",
"storage",
"[",
"\"loaded\"",
"]",
":",
"self",
".",
"load",
"(",
")",
"break",
"return",
"self",
".",
"_config"
] | https://github.com/glutanimate/cloze-overlapper/blob/9eabb6a9d2a6807595478647fd968e8e4bac86fc/src/cloze_overlapper/libaddon/anki/configmanager.py#L250-L264 | |
theotherp/nzbhydra | 4b03d7f769384b97dfc60dade4806c0fc987514e | libs/requests/cookies.py | python | RequestsCookieJar.__getstate__ | (self) | return state | Unlike a normal CookieJar, this class is pickleable. | Unlike a normal CookieJar, this class is pickleable. | [
"Unlike",
"a",
"normal",
"CookieJar",
"this",
"class",
"is",
"pickleable",
"."
] | def __getstate__(self):
"""Unlike a normal CookieJar, this class is pickleable."""
state = self.__dict__.copy()
# remove the unpickleable RLock object
state.pop('_cookies_lock')
return state | [
"def",
"__getstate__",
"(",
"self",
")",
":",
"state",
"=",
"self",
".",
"__dict__",
".",
"copy",
"(",
")",
"# remove the unpickleable RLock object",
"state",
".",
"pop",
"(",
"'_cookies_lock'",
")",
"return",
"state"
] | https://github.com/theotherp/nzbhydra/blob/4b03d7f769384b97dfc60dade4806c0fc987514e/libs/requests/cookies.py#L402-L407 | |
pyqt/examples | 843bb982917cecb2350b5f6d7f42c9b7fb142ec1 | src/pyqt-official/graphicsview/embeddeddialogs/embeddeddialogs_rc.py | python | qInitResources | () | [] | def qInitResources():
QtCore.qRegisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data) | [
"def",
"qInitResources",
"(",
")",
":",
"QtCore",
".",
"qRegisterResourceData",
"(",
"0x01",
",",
"qt_resource_struct",
",",
"qt_resource_name",
",",
"qt_resource_data",
")"
] | https://github.com/pyqt/examples/blob/843bb982917cecb2350b5f6d7f42c9b7fb142ec1/src/pyqt-official/graphicsview/embeddeddialogs/embeddeddialogs_rc.py#L1951-L1952 | ||||
Azure/azure-devops-cli-extension | 11334cd55806bef0b99c3bee5a438eed71e44037 | azure-devops/azext_devops/devops_sdk/v5_1/release/release_client.py | python | ReleaseClient.update_release_resource | (self, release_update_metadata, project, release_id) | return self._deserialize('Release', response) | UpdateReleaseResource.
Update few properties of a release.
:param :class:`<ReleaseUpdateMetadata> <azure.devops.v5_1.release.models.ReleaseUpdateMetadata>` release_update_metadata: Properties of release to update.
:param str project: Project ID or project name
:param int release_id: Id o... | UpdateReleaseResource.
Update few properties of a release.
:param :class:`<ReleaseUpdateMetadata> <azure.devops.v5_1.release.models.ReleaseUpdateMetadata>` release_update_metadata: Properties of release to update.
:param str project: Project ID or project name
:param int release_id: Id o... | [
"UpdateReleaseResource",
".",
"Update",
"few",
"properties",
"of",
"a",
"release",
".",
":",
"param",
":",
"class",
":",
"<ReleaseUpdateMetadata",
">",
"<azure",
".",
"devops",
".",
"v5_1",
".",
"release",
".",
"models",
".",
"ReleaseUpdateMetadata",
">",
"rel... | def update_release_resource(self, release_update_metadata, project, release_id):
"""UpdateReleaseResource.
Update few properties of a release.
:param :class:`<ReleaseUpdateMetadata> <azure.devops.v5_1.release.models.ReleaseUpdateMetadata>` release_update_metadata: Properties of release to update... | [
"def",
"update_release_resource",
"(",
"self",
",",
"release_update_metadata",
",",
"project",
",",
"release_id",
")",
":",
"route_values",
"=",
"{",
"}",
"if",
"project",
"is",
"not",
"None",
":",
"route_values",
"[",
"'project'",
"]",
"=",
"self",
".",
"_s... | https://github.com/Azure/azure-devops-cli-extension/blob/11334cd55806bef0b99c3bee5a438eed71e44037/azure-devops/azext_devops/devops_sdk/v5_1/release/release_client.py#L867-L886 | |
CLUEbenchmark/CLUE | 5bd39732734afecb490cf18a5212e692dbf2c007 | baselines/models/roberta_wwm_ext/tokenization.py | python | BasicTokenizer._tokenize_chinese_chars | (self, text) | return "".join(output) | Adds whitespace around any CJK character. | Adds whitespace around any CJK character. | [
"Adds",
"whitespace",
"around",
"any",
"CJK",
"character",
"."
] | def _tokenize_chinese_chars(self, text):
"""Adds whitespace around any CJK character."""
output = []
for char in text:
cp = ord(char)
if self._is_chinese_char(cp):
output.append(" ")
output.append(char)
output.append(" ")
else:
output.append(char)
return... | [
"def",
"_tokenize_chinese_chars",
"(",
"self",
",",
"text",
")",
":",
"output",
"=",
"[",
"]",
"for",
"char",
"in",
"text",
":",
"cp",
"=",
"ord",
"(",
"char",
")",
"if",
"self",
".",
"_is_chinese_char",
"(",
"cp",
")",
":",
"output",
".",
"append",
... | https://github.com/CLUEbenchmark/CLUE/blob/5bd39732734afecb490cf18a5212e692dbf2c007/baselines/models/roberta_wwm_ext/tokenization.py#L251-L262 | |
bwohlberg/sporco | df67462abcf83af6ab1961bcb0d51b87a66483fa | sporco/admm/tvl2.py | python | TVL2Deconv.xstep | (self) | r"""Minimise Augmented Lagrangian with respect to
:math:`\mathbf{x}`. | r"""Minimise Augmented Lagrangian with respect to
:math:`\mathbf{x}`. | [
"r",
"Minimise",
"Augmented",
"Lagrangian",
"with",
"respect",
"to",
":",
"math",
":",
"\\",
"mathbf",
"{",
"x",
"}",
"."
] | def xstep(self):
r"""Minimise Augmented Lagrangian with respect to
:math:`\mathbf{x}`.
"""
b = self.AHSf + self.rho*np.sum(
np.conj(self.Gf)*self.fftn(self.Y-self.U, axes=self.axes),
axis=self.Y.ndim-1)
self.Xf = b / (self.AHAf + self.rho*self.GHGf)
... | [
"def",
"xstep",
"(",
"self",
")",
":",
"b",
"=",
"self",
".",
"AHSf",
"+",
"self",
".",
"rho",
"*",
"np",
".",
"sum",
"(",
"np",
".",
"conj",
"(",
"self",
".",
"Gf",
")",
"*",
"self",
".",
"fftn",
"(",
"self",
".",
"Y",
"-",
"self",
".",
... | https://github.com/bwohlberg/sporco/blob/df67462abcf83af6ab1961bcb0d51b87a66483fa/sporco/admm/tvl2.py#L594-L609 | ||
facebookresearch/pytorch_GAN_zoo | b75dee40918caabb4fe7ec561522717bf096a8cb | models/trainer/progressive_gan_trainer.py | python | ProgressiveGANTrainer.initModel | (self) | r"""
Initialize the GAN model. | r"""
Initialize the GAN model. | [
"r",
"Initialize",
"the",
"GAN",
"model",
"."
] | def initModel(self):
r"""
Initialize the GAN model.
"""
config = {key: value for key, value in vars(self.modelConfig).items()}
config["depthScale0"] = self.modelConfig.depthScales[0]
self.model = ProgressiveGAN(useGPU=self.useGPU, **config) | [
"def",
"initModel",
"(",
"self",
")",
":",
"config",
"=",
"{",
"key",
":",
"value",
"for",
"key",
",",
"value",
"in",
"vars",
"(",
"self",
".",
"modelConfig",
")",
".",
"items",
"(",
")",
"}",
"config",
"[",
"\"depthScale0\"",
"]",
"=",
"self",
"."... | https://github.com/facebookresearch/pytorch_GAN_zoo/blob/b75dee40918caabb4fe7ec561522717bf096a8cb/models/trainer/progressive_gan_trainer.py#L67-L74 | ||
alanhamlett/pip-update-requirements | ce875601ef278c8ce00ad586434a978731525561 | pur/packages/pip/_vendor/distlib/manifest.py | python | Manifest.__init__ | (self, base=None) | Initialise an instance.
:param base: The base directory to explore under. | Initialise an instance. | [
"Initialise",
"an",
"instance",
"."
] | def __init__(self, base=None):
"""
Initialise an instance.
:param base: The base directory to explore under.
"""
self.base = os.path.abspath(os.path.normpath(base or os.getcwd()))
self.prefix = self.base + os.sep
self.allfiles = None
self.files = set() | [
"def",
"__init__",
"(",
"self",
",",
"base",
"=",
"None",
")",
":",
"self",
".",
"base",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"normpath",
"(",
"base",
"or",
"os",
".",
"getcwd",
"(",
")",
")",
")",
"self",
".",
... | https://github.com/alanhamlett/pip-update-requirements/blob/ce875601ef278c8ce00ad586434a978731525561/pur/packages/pip/_vendor/distlib/manifest.py#L42-L51 | ||
NTMC-Community/MatchZoo-py | 0e5c04e1e948aa9277abd5c85ff99d9950d8527f | matchzoo/auto/preparer/prepare.py | python | prepare | (
task: BaseTask,
model_class: typing.Type[BaseModel],
data_pack: mz.DataPack,
callback: typing.Optional[BaseCallback] = None,
preprocessor: typing.Optional[BasePreprocessor] = None,
embedding: typing.Optional['mz.Embedding'] = None,
config: typing.Optional[dict] = None,
) | return preparer.prepare(
model_class=model_class,
data_pack=data_pack,
callback=callback,
preprocessor=preprocessor,
embedding=embedding
) | A simple shorthand for using :class:`matchzoo.Preparer`.
`config` is used to control specific behaviors. The default `config`
will be updated accordingly if a `config` dictionary is passed. e.g. to
override the default `bin_size`, pass `config={'bin_size': 15}`.
:param task: Task.
:param model_cla... | A simple shorthand for using :class:`matchzoo.Preparer`. | [
"A",
"simple",
"shorthand",
"for",
"using",
":",
"class",
":",
"matchzoo",
".",
"Preparer",
"."
] | def prepare(
task: BaseTask,
model_class: typing.Type[BaseModel],
data_pack: mz.DataPack,
callback: typing.Optional[BaseCallback] = None,
preprocessor: typing.Optional[BasePreprocessor] = None,
embedding: typing.Optional['mz.Embedding'] = None,
config: typing.Optional[dict] = None,
):
""... | [
"def",
"prepare",
"(",
"task",
":",
"BaseTask",
",",
"model_class",
":",
"typing",
".",
"Type",
"[",
"BaseModel",
"]",
",",
"data_pack",
":",
"mz",
".",
"DataPack",
",",
"callback",
":",
"typing",
".",
"Optional",
"[",
"BaseCallback",
"]",
"=",
"None",
... | https://github.com/NTMC-Community/MatchZoo-py/blob/0e5c04e1e948aa9277abd5c85ff99d9950d8527f/matchzoo/auto/preparer/prepare.py#L11-L50 | |
kuri65536/python-for-android | 26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891 | python-build/python-libs/xmpppy/xmpp/transports.py | python | TLS.FeaturesHandler | (self, conn, feats) | Used to analyse server <features/> tag for TLS support.
If TLS is supported starts the encryption negotiation. Used internally | Used to analyse server <features/> tag for TLS support.
If TLS is supported starts the encryption negotiation. Used internally | [
"Used",
"to",
"analyse",
"server",
"<features",
"/",
">",
"tag",
"for",
"TLS",
"support",
".",
"If",
"TLS",
"is",
"supported",
"starts",
"the",
"encryption",
"negotiation",
".",
"Used",
"internally"
] | def FeaturesHandler(self, conn, feats):
""" Used to analyse server <features/> tag for TLS support.
If TLS is supported starts the encryption negotiation. Used internally"""
if not feats.getTag('starttls',namespace=NS_TLS):
self.DEBUG("TLS unsupported by remote server.",'warn')
... | [
"def",
"FeaturesHandler",
"(",
"self",
",",
"conn",
",",
"feats",
")",
":",
"if",
"not",
"feats",
".",
"getTag",
"(",
"'starttls'",
",",
"namespace",
"=",
"NS_TLS",
")",
":",
"self",
".",
"DEBUG",
"(",
"\"TLS unsupported by remote server.\"",
",",
"'warn'",
... | https://github.com/kuri65536/python-for-android/blob/26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891/python-build/python-libs/xmpppy/xmpp/transports.py#L295-L305 | ||
marian-margeta/gait-recognition | a9d1a738d4ca9c37355e0de4768a32c5f040d7fc | torchfile.py | python | add_tensor_reader | (typename, dtype) | [] | def add_tensor_reader(typename, dtype):
def read_tensor_generic(reader, version):
# source:
# https://github.com/torch/torch7/blob/master/generic/Tensor.c#L1243
ndim = reader.read_int()
# read size:
size = reader.read_long_array(ndim)
# read stride:
stride = ... | [
"def",
"add_tensor_reader",
"(",
"typename",
",",
"dtype",
")",
":",
"def",
"read_tensor_generic",
"(",
"reader",
",",
"version",
")",
":",
"# source:",
"# https://github.com/torch/torch7/blob/master/generic/Tensor.c#L1243",
"ndim",
"=",
"reader",
".",
"read_int",
"(",
... | https://github.com/marian-margeta/gait-recognition/blob/a9d1a738d4ca9c37355e0de4768a32c5f040d7fc/torchfile.py#L102-L129 | ||||
python/cpython | e13cdca0f5224ec4e23bdd04bb3120506964bc8b | Lib/idlelib/run.py | python | capture_warnings | (capture) | Replace warning.showwarning with idle_showwarning_subproc, or reverse. | Replace warning.showwarning with idle_showwarning_subproc, or reverse. | [
"Replace",
"warning",
".",
"showwarning",
"with",
"idle_showwarning_subproc",
"or",
"reverse",
"."
] | def capture_warnings(capture):
"Replace warning.showwarning with idle_showwarning_subproc, or reverse."
global _warnings_showwarning
if capture:
if _warnings_showwarning is None:
_warnings_showwarning = warnings.showwarning
warnings.showwarning = idle_showwarning_subproc
... | [
"def",
"capture_warnings",
"(",
"capture",
")",
":",
"global",
"_warnings_showwarning",
"if",
"capture",
":",
"if",
"_warnings_showwarning",
"is",
"None",
":",
"_warnings_showwarning",
"=",
"warnings",
".",
"showwarning",
"warnings",
".",
"showwarning",
"=",
"idle_s... | https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/idlelib/run.py#L80-L91 | ||
aroberge/friendly | 0b82326ba1cb982f8612885ac60957f095d7476f | friendly/token_utils.py | python | Token.is_operator | (self) | return self.type == py_tokenize.OP | Returns true if the token is of type OP | Returns true if the token is of type OP | [
"Returns",
"true",
"if",
"the",
"token",
"is",
"of",
"type",
"OP"
] | def is_operator(self):
"""Returns true if the token is of type OP"""
return self.type == py_tokenize.OP | [
"def",
"is_operator",
"(",
"self",
")",
":",
"return",
"self",
".",
"type",
"==",
"py_tokenize",
".",
"OP"
] | https://github.com/aroberge/friendly/blob/0b82326ba1cb982f8612885ac60957f095d7476f/friendly/token_utils.py#L107-L109 | |
volatilityfoundation/volatility | a438e768194a9e05eb4d9ee9338b881c0fa25937 | volatility/plugins/linux/process_info.py | python | read_int_list | ( start, end, addr_space) | return int_list(read_addr_range(start, end, addr_space), end - start) | Read a number of pages and split it into integers.
@param start: Start address
@param end: End address
@param addr_space: The virtual address space
@return: a list of integers. | Read a number of pages and split it into integers. | [
"Read",
"a",
"number",
"of",
"pages",
"and",
"split",
"it",
"into",
"integers",
"."
] | def read_int_list( start, end, addr_space):
"""
Read a number of pages and split it into integers.
@param start: Start address
@param end: End address
@param addr_space: The virtual address space
@return: a list of integers.
"""
return int_list(read_addr_range(start, end, addr_space), e... | [
"def",
"read_int_list",
"(",
"start",
",",
"end",
",",
"addr_space",
")",
":",
"return",
"int_list",
"(",
"read_addr_range",
"(",
"start",
",",
"end",
",",
"addr_space",
")",
",",
"end",
"-",
"start",
")"
] | https://github.com/volatilityfoundation/volatility/blob/a438e768194a9e05eb4d9ee9338b881c0fa25937/volatility/plugins/linux/process_info.py#L136-L145 | |
PokemonGoF/PokemonGo-Bot-Desktop | 4bfa94f0183406c6a86f93645eff7abd3ad4ced8 | build/pywin/Lib/pkgutil.py | python | iter_modules | (path=None, prefix='') | Yields (module_loader, name, ispkg) for all submodules on path,
or, if path is None, all top-level modules on sys.path.
'path' should be either None or a list of paths to look for
modules in.
'prefix' is a string to output on the front of every module name
on output. | Yields (module_loader, name, ispkg) for all submodules on path,
or, if path is None, all top-level modules on sys.path. | [
"Yields",
"(",
"module_loader",
"name",
"ispkg",
")",
"for",
"all",
"submodules",
"on",
"path",
"or",
"if",
"path",
"is",
"None",
"all",
"top",
"-",
"level",
"modules",
"on",
"sys",
".",
"path",
"."
] | def iter_modules(path=None, prefix=''):
"""Yields (module_loader, name, ispkg) for all submodules on path,
or, if path is None, all top-level modules on sys.path.
'path' should be either None or a list of paths to look for
modules in.
'prefix' is a string to output on the front of every module nam... | [
"def",
"iter_modules",
"(",
"path",
"=",
"None",
",",
"prefix",
"=",
"''",
")",
":",
"if",
"path",
"is",
"None",
":",
"importers",
"=",
"iter_importers",
"(",
")",
"else",
":",
"importers",
"=",
"map",
"(",
"get_importer",
",",
"path",
")",
"yielded",
... | https://github.com/PokemonGoF/PokemonGo-Bot-Desktop/blob/4bfa94f0183406c6a86f93645eff7abd3ad4ced8/build/pywin/Lib/pkgutil.py#L129-L150 | ||
gem/oq-engine | 1bdb88f3914e390abcbd285600bfd39477aae47c | openquake/hazardlib/geo/surface/planar.py | python | PlanarSurface.get_middle_point | (self) | return Point(lon, lat, depth) | Compute middle point from surface's corners coordinates. Calls
:meth:`openquake.hazardlib.geo.utils.get_middle_point` | Compute middle point from surface's corners coordinates. Calls
:meth:`openquake.hazardlib.geo.utils.get_middle_point` | [
"Compute",
"middle",
"point",
"from",
"surface",
"s",
"corners",
"coordinates",
".",
"Calls",
":",
"meth",
":",
"openquake",
".",
"hazardlib",
".",
"geo",
".",
"utils",
".",
"get_middle_point"
] | def get_middle_point(self):
"""
Compute middle point from surface's corners coordinates. Calls
:meth:`openquake.hazardlib.geo.utils.get_middle_point`
"""
# compute middle point between upper left and bottom right corners
lon, lat = geo_utils.get_middle_point(self.corner_l... | [
"def",
"get_middle_point",
"(",
"self",
")",
":",
"# compute middle point between upper left and bottom right corners",
"lon",
",",
"lat",
"=",
"geo_utils",
".",
"get_middle_point",
"(",
"self",
".",
"corner_lons",
"[",
"0",
"]",
",",
"self",
".",
"corner_lats",
"["... | https://github.com/gem/oq-engine/blob/1bdb88f3914e390abcbd285600bfd39477aae47c/openquake/hazardlib/geo/surface/planar.py#L664-L676 | |
maas/maas | db2f89970c640758a51247c59bf1ec6f60cf4ab5 | src/maasserver/node_action.py | python | Acquire._execute | (self) | See `NodeAction.execute`. | See `NodeAction.execute`. | [
"See",
"NodeAction",
".",
"execute",
"."
] | def _execute(self):
"""See `NodeAction.execute`."""
with locks.node_acquire:
try:
self.node.acquire(self.user)
except ValidationError as e:
raise NodeActionError(e) | [
"def",
"_execute",
"(",
"self",
")",
":",
"with",
"locks",
".",
"node_acquire",
":",
"try",
":",
"self",
".",
"node",
".",
"acquire",
"(",
"self",
".",
"user",
")",
"except",
"ValidationError",
"as",
"e",
":",
"raise",
"NodeActionError",
"(",
"e",
")"
... | https://github.com/maas/maas/blob/db2f89970c640758a51247c59bf1ec6f60cf4ab5/src/maasserver/node_action.py#L469-L475 | ||
CGATOxford/cgat | 326aad4694bdfae8ddc194171bb5d73911243947 | CGAT/TreeTools.py | python | GetTaxonomicNames | (tree) | return GetTaxa(tree) | get list of taxa. | get list of taxa. | [
"get",
"list",
"of",
"taxa",
"."
] | def GetTaxonomicNames(tree):
"""get list of taxa."""
return GetTaxa(tree) | [
"def",
"GetTaxonomicNames",
"(",
"tree",
")",
":",
"return",
"GetTaxa",
"(",
"tree",
")"
] | https://github.com/CGATOxford/cgat/blob/326aad4694bdfae8ddc194171bb5d73911243947/CGAT/TreeTools.py#L184-L186 | |
pyparallel/pyparallel | 11e8c6072d48c8f13641925d17b147bf36ee0ba3 | Lib/site-packages/pip-7.1.2-py3.3.egg/pip/_vendor/pkg_resources/__init__.py | python | Environment.best_match | (self, req, working_set, installer=None) | return self.obtain(req, installer) | Find distribution best matching `req` and usable on `working_set`
This calls the ``find(req)`` method of the `working_set` to see if a
suitable distribution is already active. (This may raise
``VersionConflict`` if an unsuitable version of the project is already
active in the specified... | Find distribution best matching `req` and usable on `working_set` | [
"Find",
"distribution",
"best",
"matching",
"req",
"and",
"usable",
"on",
"working_set"
] | def best_match(self, req, working_set, installer=None):
"""Find distribution best matching `req` and usable on `working_set`
This calls the ``find(req)`` method of the `working_set` to see if a
suitable distribution is already active. (This may raise
``VersionConflict`` if an unsuitabl... | [
"def",
"best_match",
"(",
"self",
",",
"req",
",",
"working_set",
",",
"installer",
"=",
"None",
")",
":",
"dist",
"=",
"working_set",
".",
"find",
"(",
"req",
")",
"if",
"dist",
"is",
"not",
"None",
":",
"return",
"dist",
"for",
"dist",
"in",
"self"... | https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/site-packages/pip-7.1.2-py3.3.egg/pip/_vendor/pkg_resources/__init__.py#L1055-L1075 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/astropy-4.0-py3.7-macosx-10.9-x86_64.egg/astropy/table/bst.py | python | BST.range_nodes | (self, lower, upper, bounds=(True, True)) | return self._range(lower, upper, op1, op2, self.root, []) | Return nodes in the given range. | Return nodes in the given range. | [
"Return",
"nodes",
"in",
"the",
"given",
"range",
"."
] | def range_nodes(self, lower, upper, bounds=(True, True)):
'''
Return nodes in the given range.
'''
if self.root is None:
return []
# op1 is <= or <, op2 is >= or >
op1 = operator.le if bounds[0] else operator.lt
op2 = operator.ge if bounds[1] else oper... | [
"def",
"range_nodes",
"(",
"self",
",",
"lower",
",",
"upper",
",",
"bounds",
"=",
"(",
"True",
",",
"True",
")",
")",
":",
"if",
"self",
".",
"root",
"is",
"None",
":",
"return",
"[",
"]",
"# op1 is <= or <, op2 is >= or >",
"op1",
"=",
"operator",
".... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/astropy-4.0-py3.7-macosx-10.9-x86_64.egg/astropy/table/bst.py#L408-L417 | |
krintoxi/NoobSec-Toolkit | 38738541cbc03cedb9a3b3ed13b629f781ad64f6 | NoobSecToolkit /scripts/sshbackdoors/backdoors/shell/pupy/pupy/pupylib/PupyJob.py | python | PupyJob.interactive_wait | (self) | return False | [] | def interactive_wait(self):
while True:
if self.is_finished():
break
time.sleep(0.1)
if self.error_happened.is_set():
return True
return False | [
"def",
"interactive_wait",
"(",
"self",
")",
":",
"while",
"True",
":",
"if",
"self",
".",
"is_finished",
"(",
")",
":",
"break",
"time",
".",
"sleep",
"(",
"0.1",
")",
"if",
"self",
".",
"error_happened",
".",
"is_set",
"(",
")",
":",
"return",
"Tru... | https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit /scripts/sshbackdoors/backdoors/shell/pupy/pupy/pupylib/PupyJob.py#L156-L163 | |||
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/graph_objs/histogram2d/_colorbar.py | python | ColorBar.ticktext | (self) | return self["ticktext"] | Sets the text displayed at the ticks position via `tickvals`.
Only has an effect if `tickmode` is set to "array". Used with
`tickvals`.
The 'ticktext' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
... | Sets the text displayed at the ticks position via `tickvals`.
Only has an effect if `tickmode` is set to "array". Used with
`tickvals`.
The 'ticktext' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series | [
"Sets",
"the",
"text",
"displayed",
"at",
"the",
"ticks",
"position",
"via",
"tickvals",
".",
"Only",
"has",
"an",
"effect",
"if",
"tickmode",
"is",
"set",
"to",
"array",
".",
"Used",
"with",
"tickvals",
".",
"The",
"ticktext",
"property",
"is",
"an",
"a... | def ticktext(self):
"""
Sets the text displayed at the ticks position via `tickvals`.
Only has an effect if `tickmode` is set to "array". Used with
`tickvals`.
The 'ticktext' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
... | [
"def",
"ticktext",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"ticktext\"",
"]"
] | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/histogram2d/_colorbar.py#L1040-L1053 | |
riptideio/pymodbus | c5772b35ae3f29d1947f3ab453d8d00df846459f | pymodbus/diag_message.py | python | ForceListenOnlyModeRequest.execute | (self, *args) | return ForceListenOnlyModeResponse() | Execute the diagnostic request on the given device
:returns: The initialized response message | Execute the diagnostic request on the given device | [
"Execute",
"the",
"diagnostic",
"request",
"on",
"the",
"given",
"device"
] | def execute(self, *args):
''' Execute the diagnostic request on the given device
:returns: The initialized response message
'''
_MCB.ListenOnly = True
return ForceListenOnlyModeResponse() | [
"def",
"execute",
"(",
"self",
",",
"*",
"args",
")",
":",
"_MCB",
".",
"ListenOnly",
"=",
"True",
"return",
"ForceListenOnlyModeResponse",
"(",
")"
] | https://github.com/riptideio/pymodbus/blob/c5772b35ae3f29d1947f3ab453d8d00df846459f/pymodbus/diag_message.py#L348-L354 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/shelly/config_flow.py | python | ConfigFlow.async_step_confirm_discovery | (
self, user_input: dict[str, Any] | None = None
) | return self.async_show_form(
step_id="confirm_discovery",
description_placeholders={
"model": get_model_name(self.info),
"host": self.host,
},
errors=errors,
) | Handle discovery confirm. | Handle discovery confirm. | [
"Handle",
"discovery",
"confirm",
"."
] | async def async_step_confirm_discovery(
self, user_input: dict[str, Any] | None = None
) -> FlowResult:
"""Handle discovery confirm."""
errors: dict[str, str] = {}
if user_input is not None:
return self.async_create_entry(
title=self.device_info["title"],
... | [
"async",
"def",
"async_step_confirm_discovery",
"(",
"self",
",",
"user_input",
":",
"dict",
"[",
"str",
",",
"Any",
"]",
"|",
"None",
"=",
"None",
")",
"->",
"FlowResult",
":",
"errors",
":",
"dict",
"[",
"str",
",",
"str",
"]",
"=",
"{",
"}",
"if",... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/shelly/config_flow.py#L216-L241 | |
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/runners/virt.py | python | vm_info | (name, quiet=False) | return _find_vm(name, data, quiet) | Return the information on the named VM | Return the information on the named VM | [
"Return",
"the",
"information",
"on",
"the",
"named",
"VM"
] | def vm_info(name, quiet=False):
"""
Return the information on the named VM
"""
data = query(quiet=True)
return _find_vm(name, data, quiet) | [
"def",
"vm_info",
"(",
"name",
",",
"quiet",
"=",
"False",
")",
":",
"data",
"=",
"query",
"(",
"quiet",
"=",
"True",
")",
"return",
"_find_vm",
"(",
"name",
",",
"data",
",",
"quiet",
")"
] | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/runners/virt.py#L326-L331 | |
atomistic-machine-learning/schnetpack | dacf6076d43509dfd8b6694a846ac8453ae39b5e | src/schnetpack/interfaces/ase_interface.py | python | AseInterface.run_md | (self, steps) | Perform a molecular dynamics simulation using the settings specified
upon initializing the class.
Args:
steps (int): Number of simulation steps performed | Perform a molecular dynamics simulation using the settings specified
upon initializing the class. | [
"Perform",
"a",
"molecular",
"dynamics",
"simulation",
"using",
"the",
"settings",
"specified",
"upon",
"initializing",
"the",
"class",
"."
] | def run_md(self, steps):
"""
Perform a molecular dynamics simulation using the settings specified
upon initializing the class.
Args:
steps (int): Number of simulation steps performed
"""
if not self.dynamics:
raise AttributeError(
... | [
"def",
"run_md",
"(",
"self",
",",
"steps",
")",
":",
"if",
"not",
"self",
".",
"dynamics",
":",
"raise",
"AttributeError",
"(",
"\"Dynamics need to be initialized using the\"",
"\" 'setup_md' function\"",
")",
"self",
".",
"dynamics",
".",
"run",
"(",
"steps",
... | https://github.com/atomistic-machine-learning/schnetpack/blob/dacf6076d43509dfd8b6694a846ac8453ae39b5e/src/schnetpack/interfaces/ase_interface.py#L329-L342 | ||
triaquae/triaquae | bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9 | TriAquae/models/Centos_5.9/paramiko/transport.py | python | Transport.get_security_options | (self) | return SecurityOptions(self) | Return a L{SecurityOptions} object which can be used to tweak the
encryption algorithms this transport will permit, and the order of
preference for them.
@return: an object that can be used to change the preferred algorithms
for encryption, digest (hash), public key, and key exchang... | Return a L{SecurityOptions} object which can be used to tweak the
encryption algorithms this transport will permit, and the order of
preference for them. | [
"Return",
"a",
"L",
"{",
"SecurityOptions",
"}",
"object",
"which",
"can",
"be",
"used",
"to",
"tweak",
"the",
"encryption",
"algorithms",
"this",
"transport",
"will",
"permit",
"and",
"the",
"order",
"of",
"preference",
"for",
"them",
"."
] | def get_security_options(self):
"""
Return a L{SecurityOptions} object which can be used to tweak the
encryption algorithms this transport will permit, and the order of
preference for them.
@return: an object that can be used to change the preferred algorithms
for en... | [
"def",
"get_security_options",
"(",
"self",
")",
":",
"return",
"SecurityOptions",
"(",
"self",
")"
] | https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/Centos_5.9/paramiko/transport.py#L407-L417 | |
JiYou/openstack | 8607dd488bde0905044b303eb6e52bdea6806923 | chap19/monitor/monitor/monitor/openstack/common/rpc/amqp.py | python | call | (conf, context, topic, msg, timeout, connection_pool) | return rv[-1] | Sends a message on a topic and wait for a response. | Sends a message on a topic and wait for a response. | [
"Sends",
"a",
"message",
"on",
"a",
"topic",
"and",
"wait",
"for",
"a",
"response",
"."
] | def call(conf, context, topic, msg, timeout, connection_pool):
"""Sends a message on a topic and wait for a response."""
rv = multicall(conf, context, topic, msg, timeout, connection_pool)
# NOTE(vish): return the last result from the multicall
rv = list(rv)
if not rv:
return
return rv[-... | [
"def",
"call",
"(",
"conf",
",",
"context",
",",
"topic",
",",
"msg",
",",
"timeout",
",",
"connection_pool",
")",
":",
"rv",
"=",
"multicall",
"(",
"conf",
",",
"context",
",",
"topic",
",",
"msg",
",",
"timeout",
",",
"connection_pool",
")",
"# NOTE(... | https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/chap19/monitor/monitor/monitor/openstack/common/rpc/amqp.py#L609-L616 | |
Azure/azure-devops-cli-extension | 11334cd55806bef0b99c3bee5a438eed71e44037 | azure-devops/azext_devops/devops_sdk/v6_0/work_item_tracking/work_item_tracking_client.py | python | WorkItemTrackingClient.get_comment_reactions | (self, project, work_item_id, comment_id) | return self._deserialize('[CommentReaction]', self._unwrap_collection(response)) | GetCommentReactions.
[Preview API] Gets reactions of a comment.
:param str project: Project ID or project name
:param int work_item_id: WorkItem ID
:param int comment_id: Comment ID
:rtype: [CommentReaction] | GetCommentReactions.
[Preview API] Gets reactions of a comment.
:param str project: Project ID or project name
:param int work_item_id: WorkItem ID
:param int comment_id: Comment ID
:rtype: [CommentReaction] | [
"GetCommentReactions",
".",
"[",
"Preview",
"API",
"]",
"Gets",
"reactions",
"of",
"a",
"comment",
".",
":",
"param",
"str",
"project",
":",
"Project",
"ID",
"or",
"project",
"name",
":",
"param",
"int",
"work_item_id",
":",
"WorkItem",
"ID",
":",
"param",... | def get_comment_reactions(self, project, work_item_id, comment_id):
"""GetCommentReactions.
[Preview API] Gets reactions of a comment.
:param str project: Project ID or project name
:param int work_item_id: WorkItem ID
:param int comment_id: Comment ID
:rtype: [CommentRea... | [
"def",
"get_comment_reactions",
"(",
"self",
",",
"project",
",",
"work_item_id",
",",
"comment_id",
")",
":",
"route_values",
"=",
"{",
"}",
"if",
"project",
"is",
"not",
"None",
":",
"route_values",
"[",
"'project'",
"]",
"=",
"self",
".",
"_serialize",
... | https://github.com/Azure/azure-devops-cli-extension/blob/11334cd55806bef0b99c3bee5a438eed71e44037/azure-devops/azext_devops/devops_sdk/v6_0/work_item_tracking/work_item_tracking_client.py#L545-L564 | |
naftaliharris/tauthon | 5587ceec329b75f7caf6d65a036db61ac1bae214 | Lib/ftplib.py | python | FTP.sendeprt | (self, host, port) | return self.voidcmd(cmd) | Send an EPRT command with the current host and the given port number. | Send an EPRT command with the current host and the given port number. | [
"Send",
"an",
"EPRT",
"command",
"with",
"the",
"current",
"host",
"and",
"the",
"given",
"port",
"number",
"."
] | def sendeprt(self, host, port):
'''Send an EPRT command with the current host and the given port number.'''
af = 0
if self.af == socket.AF_INET:
af = 1
if self.af == socket.AF_INET6:
af = 2
if af == 0:
raise error_proto, 'unsupported address fa... | [
"def",
"sendeprt",
"(",
"self",
",",
"host",
",",
"port",
")",
":",
"af",
"=",
"0",
"if",
"self",
".",
"af",
"==",
"socket",
".",
"AF_INET",
":",
"af",
"=",
"1",
"if",
"self",
".",
"af",
"==",
"socket",
".",
"AF_INET6",
":",
"af",
"=",
"2",
"... | https://github.com/naftaliharris/tauthon/blob/5587ceec329b75f7caf6d65a036db61ac1bae214/Lib/ftplib.py#L270-L281 | |
fonttools/fonttools | 892322aaff6a89bea5927379ec06bc0da3dfb7df | Lib/fontTools/ufoLib/utils.py | python | _VersionTupleEnumMixin.default | (cls) | return max(cls.__members__.values()) | [] | def default(cls):
# get the latest defined version (i.e. the max of all versions)
return max(cls.__members__.values()) | [
"def",
"default",
"(",
"cls",
")",
":",
"# get the latest defined version (i.e. the max of all versions)",
"return",
"max",
"(",
"cls",
".",
"__members__",
".",
"values",
"(",
")",
")"
] | https://github.com/fonttools/fonttools/blob/892322aaff6a89bea5927379ec06bc0da3dfb7df/Lib/fontTools/ufoLib/utils.py#L63-L65 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.