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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
anshumanbh/kubebot | 3558ddc593c861a9805731052c1ac5e71879fdf5 | utils/wfuzzbasicauthbrute/wfuzz/framework/fuzzer/base.py | python | BaseFuzzRequest.fr_host | (self) | return | Returns HTTP request host | Returns HTTP request host | [
"Returns",
"HTTP",
"request",
"host"
] | def fr_host(self):
"""
Returns HTTP request host
"""
return | [
"def",
"fr_host",
"(",
"self",
")",
":",
"return"
] | https://github.com/anshumanbh/kubebot/blob/3558ddc593c861a9805731052c1ac5e71879fdf5/utils/wfuzzbasicauthbrute/wfuzz/framework/fuzzer/base.py#L74-L78 | |
Mellcap/MellPlayer | 90b3210eaaed675552fd69717b6b953fd0e0b07d | mellplayer/player.py | python | Player.run_player | (self) | 启动播放器 | 启动播放器 | [
"启动播放器"
] | def run_player(self):
'''
启动播放器
'''
if self.playlist_detail and self.playlist_ids:
song_id = self.playlist_ids[self.playlist_index]
song_info = self.playlist_detail.get(song_id, {})
if not song_info:
mell_logger.error('Can not get song_... | [
"def",
"run_player",
"(",
"self",
")",
":",
"if",
"self",
".",
"playlist_detail",
"and",
"self",
".",
"playlist_ids",
":",
"song_id",
"=",
"self",
".",
"playlist_ids",
"[",
"self",
".",
"playlist_index",
"]",
"song_info",
"=",
"self",
".",
"playlist_detail",... | https://github.com/Mellcap/MellPlayer/blob/90b3210eaaed675552fd69717b6b953fd0e0b07d/mellplayer/player.py#L226-L242 | ||
biopython/biopython | 2dd97e71762af7b046d7f7f8a4f1e38db6b06c86 | Bio/PDB/Entity.py | python | Entity.__ge__ | (self, other) | Test greater or equal. | Test greater or equal. | [
"Test",
"greater",
"or",
"equal",
"."
] | def __ge__(self, other):
"""Test greater or equal."""
if isinstance(other, type(self)):
if self.parent is None:
return self.id >= other.id
else:
return self.full_id[1:] >= other.full_id[1:]
else:
return NotImplemented | [
"def",
"__ge__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"type",
"(",
"self",
")",
")",
":",
"if",
"self",
".",
"parent",
"is",
"None",
":",
"return",
"self",
".",
"id",
">=",
"other",
".",
"id",
"else",
":",
... | https://github.com/biopython/biopython/blob/2dd97e71762af7b046d7f7f8a4f1e38db6b06c86/Bio/PDB/Entity.py#L91-L99 | ||
kuri65536/python-for-android | 26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891 | python3-alpha/python-libs/gdata/docs/client.py | python | DocsClient.delete_archive | (self, entry, **kwargs) | return super(DocsClient, self).delete(entry, force=True, **kwargs) | Aborts the given Archive operation, or deletes the Archive.
Args:
entry: gdata.docs.data.Archive to delete.
kwargs: Other args to pass to gdata.client.GDClient.Delete()
Returns:
Result of delete request. | Aborts the given Archive operation, or deletes the Archive.
Args:
entry: gdata.docs.data.Archive to delete.
kwargs: Other args to pass to gdata.client.GDClient.Delete()
Returns:
Result of delete request. | [
"Aborts",
"the",
"given",
"Archive",
"operation",
"or",
"deletes",
"the",
"Archive",
".",
"Args",
":",
"entry",
":",
"gdata",
".",
"docs",
".",
"data",
".",
"Archive",
"to",
"delete",
".",
"kwargs",
":",
"Other",
"args",
"to",
"pass",
"to",
"gdata",
".... | def delete_archive(self, entry, **kwargs):
"""Aborts the given Archive operation, or deletes the Archive.
Args:
entry: gdata.docs.data.Archive to delete.
kwargs: Other args to pass to gdata.client.GDClient.Delete()
Returns:
Result of delete request.
"""
return super(DocsC... | [
"def",
"delete_archive",
"(",
"self",
",",
"entry",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"super",
"(",
"DocsClient",
",",
"self",
")",
".",
"delete",
"(",
"entry",
",",
"force",
"=",
"True",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/kuri65536/python-for-android/blob/26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891/python3-alpha/python-libs/gdata/docs/client.py#L974-L984 | |
laughingman7743/PyAthena | 417749914247cabca2325368c6eda337b28b47f0 | pyathena/result_set.py | python | AthenaDictResultSet._get_rows | (
self, offset: int, meta_data: Tuple[Any, ...], rows: List[Dict[str, Any]]
) | return [
self.dict_type(
[
(
meta.get("Name"),
self._converter.convert(
meta.get("Type", None), row.get("VarCharValue", None)
),
)
f... | [] | def _get_rows(
self, offset: int, meta_data: Tuple[Any, ...], rows: List[Dict[str, Any]]
) -> List[Union[Tuple[Optional[Any], ...], Dict[Any, Optional[Any]]]]:
return [
self.dict_type(
[
(
meta.get("Name"),
... | [
"def",
"_get_rows",
"(",
"self",
",",
"offset",
":",
"int",
",",
"meta_data",
":",
"Tuple",
"[",
"Any",
",",
"...",
"]",
",",
"rows",
":",
"List",
"[",
"Dict",
"[",
"str",
",",
"Any",
"]",
"]",
")",
"->",
"List",
"[",
"Union",
"[",
"Tuple",
"["... | https://github.com/laughingman7743/PyAthena/blob/417749914247cabca2325368c6eda337b28b47f0/pyathena/result_set.py#L351-L367 | |||
seppius-xbmc-repo/ru | d0879d56ec8243b2c7af44fda5cf3d1ff77fd2e2 | plugin.video.ndr/simpleplugin.py | python | MemStorage.__init__ | (self, storage_id, window_id=10000) | :type storage_id: str
:type window_id: int | :type storage_id: str
:type window_id: int | [
":",
"type",
"storage_id",
":",
"str",
":",
"type",
"window_id",
":",
"int"
] | def __init__(self, storage_id, window_id=10000):
"""
:type storage_id: str
:type window_id: int
"""
self._id = storage_id
self._window = xbmcgui.Window(window_id)
try:
self['__keys__']
except:
self['__keys__'] = [] | [
"def",
"__init__",
"(",
"self",
",",
"storage_id",
",",
"window_id",
"=",
"10000",
")",
":",
"self",
".",
"_id",
"=",
"storage_id",
"self",
".",
"_window",
"=",
"xbmcgui",
".",
"Window",
"(",
"window_id",
")",
"try",
":",
"self",
"[",
"'__keys__'",
"]"... | https://github.com/seppius-xbmc-repo/ru/blob/d0879d56ec8243b2c7af44fda5cf3d1ff77fd2e2/plugin.video.ndr/simpleplugin.py#L297-L307 | ||
Yam-cn/pyalgotrade-cn | d8ba00e9a2bb609e3e925db17a9a97929c57f672 | pyalgotrade/broker/__init__.py | python | Broker.createStopOrder | (self, action, instrument, stopPrice, quantity) | Creates a Stop order.
A stop order, also referred to as a stop-loss order, is an order to buy or sell a stock once the price of the stock
reaches a specified price, known as the stop price.
When the stop price is reached, a stop order becomes a market order.
A buy stop order is entered a... | Creates a Stop order.
A stop order, also referred to as a stop-loss order, is an order to buy or sell a stock once the price of the stock
reaches a specified price, known as the stop price.
When the stop price is reached, a stop order becomes a market order.
A buy stop order is entered a... | [
"Creates",
"a",
"Stop",
"order",
".",
"A",
"stop",
"order",
"also",
"referred",
"to",
"as",
"a",
"stop",
"-",
"loss",
"order",
"is",
"an",
"order",
"to",
"buy",
"or",
"sell",
"a",
"stock",
"once",
"the",
"price",
"of",
"the",
"stock",
"reaches",
"a",... | def createStopOrder(self, action, instrument, stopPrice, quantity):
"""Creates a Stop order.
A stop order, also referred to as a stop-loss order, is an order to buy or sell a stock once the price of the stock
reaches a specified price, known as the stop price.
When the stop price is reac... | [
"def",
"createStopOrder",
"(",
"self",
",",
"action",
",",
"instrument",
",",
"stopPrice",
",",
"quantity",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/Yam-cn/pyalgotrade-cn/blob/d8ba00e9a2bb609e3e925db17a9a97929c57f672/pyalgotrade/broker/__init__.py#L602-L622 | ||
LinkedInAttic/indextank-service | 880c6295ce8e7a3a55bf9b3777cc35c7680e0d7e | api/boto/ec2/connection.py | python | EC2Connection.get_all_snapshots | (self, snapshot_ids=None, owner=None, restorable_by=None) | return self.get_list('DescribeSnapshots', params, [('item', Snapshot)]) | Get all EBS Snapshots associated with the current credentials.
:type snapshot_ids: list
:param snapshot_ids: Optional list of snapshot ids. If this list is present,
only the Snapshots associated with these snapshot ids
will be returned.
:t... | Get all EBS Snapshots associated with the current credentials. | [
"Get",
"all",
"EBS",
"Snapshots",
"associated",
"with",
"the",
"current",
"credentials",
"."
] | def get_all_snapshots(self, snapshot_ids=None, owner=None, restorable_by=None):
"""
Get all EBS Snapshots associated with the current credentials.
:type snapshot_ids: list
:param snapshot_ids: Optional list of snapshot ids. If this list is present,
only the S... | [
"def",
"get_all_snapshots",
"(",
"self",
",",
"snapshot_ids",
"=",
"None",
",",
"owner",
"=",
"None",
",",
"restorable_by",
"=",
"None",
")",
":",
"params",
"=",
"{",
"}",
"if",
"snapshot_ids",
":",
"self",
".",
"build_list_params",
"(",
"params",
",",
"... | https://github.com/LinkedInAttic/indextank-service/blob/880c6295ce8e7a3a55bf9b3777cc35c7680e0d7e/api/boto/ec2/connection.py#L1060-L1088 | |
openwpm/OpenWPM | 771b6db4169374a7f7b6eb5ce6e59ea763f26df4 | openwpm/storage/storage_providers.py | python | UnstructuredStorageProvider._compress | (blob: bytes) | return out_f | Takes a byte blob and compresses it with gzip
The returned BytesIO object is at stream position 0.
This means it can be treated like a zip file on disk. | Takes a byte blob and compresses it with gzip
The returned BytesIO object is at stream position 0.
This means it can be treated like a zip file on disk. | [
"Takes",
"a",
"byte",
"blob",
"and",
"compresses",
"it",
"with",
"gzip",
"The",
"returned",
"BytesIO",
"object",
"is",
"at",
"stream",
"position",
"0",
".",
"This",
"means",
"it",
"can",
"be",
"treated",
"like",
"a",
"zip",
"file",
"on",
"disk",
"."
] | def _compress(blob: bytes) -> io.BytesIO:
"""Takes a byte blob and compresses it with gzip
The returned BytesIO object is at stream position 0.
This means it can be treated like a zip file on disk.
"""
out_f = io.BytesIO()
with gzip.GzipFile(fileobj=out_f, mode="w") as wr... | [
"def",
"_compress",
"(",
"blob",
":",
"bytes",
")",
"->",
"io",
".",
"BytesIO",
":",
"out_f",
"=",
"io",
".",
"BytesIO",
"(",
")",
"with",
"gzip",
".",
"GzipFile",
"(",
"fileobj",
"=",
"out_f",
",",
"mode",
"=",
"\"w\"",
")",
"as",
"writer",
":",
... | https://github.com/openwpm/OpenWPM/blob/771b6db4169374a7f7b6eb5ce6e59ea763f26df4/openwpm/storage/storage_providers.py#L105-L114 | |
huggingface/transformers | 623b4f7c63f60cce917677ee704d6c93ee960b4b | src/transformers/models/distilbert/modeling_distilbert.py | python | TransformerBlock.__init__ | (self, config) | [] | def __init__(self, config):
super().__init__()
assert config.dim % config.n_heads == 0
self.attention = MultiHeadSelfAttention(config)
self.sa_layer_norm = nn.LayerNorm(normalized_shape=config.dim, eps=1e-12)
self.ffn = FFN(config)
self.output_layer_norm = nn.LayerNorm... | [
"def",
"__init__",
"(",
"self",
",",
"config",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
")",
"assert",
"config",
".",
"dim",
"%",
"config",
".",
"n_heads",
"==",
"0",
"self",
".",
"attention",
"=",
"MultiHeadSelfAttention",
"(",
"config",
")"... | https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/models/distilbert/modeling_distilbert.py#L249-L258 | ||||
bear/python-twitter | 1a148ead5029d06bec58c1cbc879764aa4b2bc74 | twitter/api.py | python | Api._UploadMediaChunkedFinalize | (self, media_id) | return data | Finalize chunked upload to Twitter.
Args:
media_id (int):
ID of the media file for which to finalize the upload.
Returns:
json: JSON string of data from Twitter. | Finalize chunked upload to Twitter. | [
"Finalize",
"chunked",
"upload",
"to",
"Twitter",
"."
] | def _UploadMediaChunkedFinalize(self, media_id):
"""Finalize chunked upload to Twitter.
Args:
media_id (int):
ID of the media file for which to finalize the upload.
Returns:
json: JSON string of data from Twitter.
"""
url = '%s/media/uplo... | [
"def",
"_UploadMediaChunkedFinalize",
"(",
"self",
",",
"media_id",
")",
":",
"url",
"=",
"'%s/media/upload.json'",
"%",
"self",
".",
"upload_url",
"parameters",
"=",
"{",
"'command'",
":",
"'FINALIZE'",
",",
"'media_id'",
":",
"media_id",
"}",
"resp",
"=",
"s... | https://github.com/bear/python-twitter/blob/1a148ead5029d06bec58c1cbc879764aa4b2bc74/twitter/api.py#L1380-L1400 | |
apache/tvm | 6eb4ed813ebcdcd9558f0906a1870db8302ff1e0 | python/tvm/relay/scope_builder.py | python | ScopeBuilder.type_of | (self, expr) | return ity | Compute the type of an expression.
Parameters
----------
expr: relay.Expr
The expression to compute the type of. | Compute the type of an expression. | [
"Compute",
"the",
"type",
"of",
"an",
"expression",
"."
] | def type_of(self, expr):
"""
Compute the type of an expression.
Parameters
----------
expr: relay.Expr
The expression to compute the type of.
"""
if isinstance(expr, _expr.Var):
return expr.type_annotation
ity = _ty.IncompleteType... | [
"def",
"type_of",
"(",
"self",
",",
"expr",
")",
":",
"if",
"isinstance",
"(",
"expr",
",",
"_expr",
".",
"Var",
")",
":",
"return",
"expr",
".",
"type_annotation",
"ity",
"=",
"_ty",
".",
"IncompleteType",
"(",
")",
"var",
"=",
"_expr",
".",
"var",
... | https://github.com/apache/tvm/blob/6eb4ed813ebcdcd9558f0906a1870db8302ff1e0/python/tvm/relay/scope_builder.py#L181-L196 | |
google-research/rigl | f18abc7d82ae3acc6736068408a0186c9efa575c | rigl/experimental/jax/datasets/dataset_base.py | python | Dataset.get_train | (self) | return iter(tfds.as_numpy(self._train_ds)) | Returns the training dataset. | Returns the training dataset. | [
"Returns",
"the",
"training",
"dataset",
"."
] | def get_train(self):
"""Returns the training dataset."""
return iter(tfds.as_numpy(self._train_ds)) | [
"def",
"get_train",
"(",
"self",
")",
":",
"return",
"iter",
"(",
"tfds",
".",
"as_numpy",
"(",
"self",
".",
"_train_ds",
")",
")"
] | https://github.com/google-research/rigl/blob/f18abc7d82ae3acc6736068408a0186c9efa575c/rigl/experimental/jax/datasets/dataset_base.py#L100-L102 | |
XX-net/XX-Net | a9898cfcf0084195fb7e69b6bc834e59aecdf14f | python3.8.2/Lib/posixpath.py | python | commonpath | (paths) | Given a sequence of path names, returns the longest common sub-path. | Given a sequence of path names, returns the longest common sub-path. | [
"Given",
"a",
"sequence",
"of",
"path",
"names",
"returns",
"the",
"longest",
"common",
"sub",
"-",
"path",
"."
] | def commonpath(paths):
"""Given a sequence of path names, returns the longest common sub-path."""
if not paths:
raise ValueError('commonpath() arg is an empty sequence')
paths = tuple(map(os.fspath, paths))
if isinstance(paths[0], bytes):
sep = b'/'
curdir = b'.'
else:
... | [
"def",
"commonpath",
"(",
"paths",
")",
":",
"if",
"not",
"paths",
":",
"raise",
"ValueError",
"(",
"'commonpath() arg is an empty sequence'",
")",
"paths",
"=",
"tuple",
"(",
"map",
"(",
"os",
".",
"fspath",
",",
"paths",
")",
")",
"if",
"isinstance",
"("... | https://github.com/XX-net/XX-Net/blob/a9898cfcf0084195fb7e69b6bc834e59aecdf14f/python3.8.2/Lib/posixpath.py#L490-L525 | ||
nosmokingbandit/watcher | dadacd21a5790ee609058a98a17fcc8954d24439 | lib/transmissionrpc/torrent.py | python | Torrent.ratio | (self) | return float(self._fields['uploadRatio'].value) | Get the upload/download ratio. | Get the upload/download ratio. | [
"Get",
"the",
"upload",
"/",
"download",
"ratio",
"."
] | def ratio(self):
"""Get the upload/download ratio."""
return float(self._fields['uploadRatio'].value) | [
"def",
"ratio",
"(",
"self",
")",
":",
"return",
"float",
"(",
"self",
".",
"_fields",
"[",
"'uploadRatio'",
"]",
".",
"value",
")"
] | https://github.com/nosmokingbandit/watcher/blob/dadacd21a5790ee609058a98a17fcc8954d24439/lib/transmissionrpc/torrent.py#L199-L201 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Lib/bsddb/dbshelve.py | python | DBShelfCursor.next | (self, flags=0) | return self.get_1(flags|db.DB_NEXT) | [] | def next(self, flags=0): return self.get_1(flags|db.DB_NEXT) | [
"def",
"next",
"(",
"self",
",",
"flags",
"=",
"0",
")",
":",
"return",
"self",
".",
"get_1",
"(",
"flags",
"|",
"db",
".",
"DB_NEXT",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/bsddb/dbshelve.py#L336-L336 | |||
uber-archive/plato-research-dialogue-system | 1db30be390df6903be89fdf5a515debc7d7defb4 | plato/agent/component/dialogue_policy/reinforcement_learning/minimax_q_policy.py | python | MinimaxQPolicy.load | (self, path) | Load the model from the path provided
:param path: path to load the model from
:return: nothing | Load the model from the path provided | [
"Load",
"the",
"model",
"from",
"the",
"path",
"provided"
] | def load(self, path):
"""
Load the model from the path provided
:param path: path to load the model from
:return: nothing
"""
if not path:
print('No dialogue_policy loaded.')
return
if isinstance(path, str):
if os.path.isfile... | [
"def",
"load",
"(",
"self",
",",
"path",
")",
":",
"if",
"not",
"path",
":",
"print",
"(",
"'No dialogue_policy loaded.'",
")",
"return",
"if",
"isinstance",
"(",
"path",
",",
"str",
")",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"path",
")",... | https://github.com/uber-archive/plato-research-dialogue-system/blob/1db30be390df6903be89fdf5a515debc7d7defb4/plato/agent/component/dialogue_policy/reinforcement_learning/minimax_q_policy.py#L603-L639 | ||
GraphSAINT/GraphSAINT | 7386fe58c4c10873f3ba7ada22bffa8c413c6392 | graphsaint/graph_samplers.py | python | edge_sampling.__init__ | (self,adj_train,node_train,num_edges_subgraph) | The sampler picks edges from the training graph independently, following
a pre-computed edge probability distribution. i.e.,
p_{u,v} \\propto 1 / deg_u + 1 / deg_v
Such prob. dist. is derived to minimize the variance of the minibatch
estimator (see Thm 3.2 of the GraphSAINT paper). | The sampler picks edges from the training graph independently, following
a pre-computed edge probability distribution. i.e.,
p_{u,v} \\propto 1 / deg_u + 1 / deg_v
Such prob. dist. is derived to minimize the variance of the minibatch
estimator (see Thm 3.2 of the GraphSAINT paper). | [
"The",
"sampler",
"picks",
"edges",
"from",
"the",
"training",
"graph",
"independently",
"following",
"a",
"pre",
"-",
"computed",
"edge",
"probability",
"distribution",
".",
"i",
".",
"e",
".",
"p_",
"{",
"u",
"v",
"}",
"\\\\",
"propto",
"1",
"/",
"deg_... | def __init__(self,adj_train,node_train,num_edges_subgraph):
"""
The sampler picks edges from the training graph independently, following
a pre-computed edge probability distribution. i.e.,
p_{u,v} \\propto 1 / deg_u + 1 / deg_v
Such prob. dist. is derived to minimize the vari... | [
"def",
"__init__",
"(",
"self",
",",
"adj_train",
",",
"node_train",
",",
"num_edges_subgraph",
")",
":",
"self",
".",
"num_edges_subgraph",
"=",
"num_edges_subgraph",
"# num subgraph nodes may not be num_edges_subgraph * 2 in many cases,",
"# but it is not too important to have ... | https://github.com/GraphSAINT/GraphSAINT/blob/7386fe58c4c10873f3ba7ada22bffa8c413c6392/graphsaint/graph_samplers.py#L154-L180 | ||
edfungus/Crouton | ada98b3930192938a48909072b45cb84b945f875 | clients/esp8266_clients/venv/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.py | python | TarFile.next | (self) | return tarinfo | Return the next member of the archive as a TarInfo object, when
TarFile is opened for reading. Return None if there is no more
available. | Return the next member of the archive as a TarInfo object, when
TarFile is opened for reading. Return None if there is no more
available. | [
"Return",
"the",
"next",
"member",
"of",
"the",
"archive",
"as",
"a",
"TarInfo",
"object",
"when",
"TarFile",
"is",
"opened",
"for",
"reading",
".",
"Return",
"None",
"if",
"there",
"is",
"no",
"more",
"available",
"."
] | def next(self):
"""Return the next member of the archive as a TarInfo object, when
TarFile is opened for reading. Return None if there is no more
available.
"""
self._check("ra")
if self.firstmember is not None:
m = self.firstmember
self.firs... | [
"def",
"next",
"(",
"self",
")",
":",
"self",
".",
"_check",
"(",
"\"ra\"",
")",
"if",
"self",
".",
"firstmember",
"is",
"not",
"None",
":",
"m",
"=",
"self",
".",
"firstmember",
"self",
".",
"firstmember",
"=",
"None",
"return",
"m",
"# Read the next ... | https://github.com/edfungus/Crouton/blob/ada98b3930192938a48909072b45cb84b945f875/clients/esp8266_clients/venv/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.py#L2414-L2458 | |
opencobra/cobrapy | 0b9ea70cb0ffe78568d445ce3361ad10ec6b02a2 | src/cobra/summary/model_summary.py | python | ModelSummary._string_table | (frame: pd.DataFrame, float_format: str, column_width: int) | return frame.to_string(
header=True,
index=False,
na_rep="",
formatters={
"Flux": f"{{:{float_format}}}".format,
"Range": lambda pair: f"[{pair[0]:{float_format}}; "
f"{pair[1]:{float_format}}]",
},
m... | Create a pretty string representation of the data frame.
Parameters
----------
frame : pandas.DataFrame
A pandas DataFrame of fluxes.
float_format : str
Format string for floats.
column_width : int
The maximum column width for each row.
... | Create a pretty string representation of the data frame. | [
"Create",
"a",
"pretty",
"string",
"representation",
"of",
"the",
"data",
"frame",
"."
] | def _string_table(frame: pd.DataFrame, float_format: str, column_width: int) -> str:
"""
Create a pretty string representation of the data frame.
Parameters
----------
frame : pandas.DataFrame
A pandas DataFrame of fluxes.
float_format : str
Forma... | [
"def",
"_string_table",
"(",
"frame",
":",
"pd",
".",
"DataFrame",
",",
"float_format",
":",
"str",
",",
"column_width",
":",
"int",
")",
"->",
"str",
":",
"frame",
".",
"columns",
"=",
"[",
"header",
".",
"title",
"(",
")",
"for",
"header",
"in",
"f... | https://github.com/opencobra/cobrapy/blob/0b9ea70cb0ffe78568d445ce3361ad10ec6b02a2/src/cobra/summary/model_summary.py#L281-L311 | |
caiiiac/Machine-Learning-with-Python | 1a26c4467da41ca4ebc3d5bd789ea942ef79422f | MachineLearning/venv/lib/python3.5/site-packages/scipy/linalg/_solvers.py | python | solve_lyapunov | (a, q) | return solve_sylvester(a, a.conj().transpose(), q) | Solves the continuous Lyapunov equation :math:`AX + XA^H = Q`.
Uses the Bartels-Stewart algorithm to find :math:`X`.
Parameters
----------
a : array_like
A square matrix
q : array_like
Right-hand side square matrix
Returns
-------
x : array_like
Solution to th... | Solves the continuous Lyapunov equation :math:`AX + XA^H = Q`. | [
"Solves",
"the",
"continuous",
"Lyapunov",
"equation",
":",
"math",
":",
"AX",
"+",
"XA^H",
"=",
"Q",
"."
] | def solve_lyapunov(a, q):
"""
Solves the continuous Lyapunov equation :math:`AX + XA^H = Q`.
Uses the Bartels-Stewart algorithm to find :math:`X`.
Parameters
----------
a : array_like
A square matrix
q : array_like
Right-hand side square matrix
Returns
-------
... | [
"def",
"solve_lyapunov",
"(",
"a",
",",
"q",
")",
":",
"return",
"solve_sylvester",
"(",
"a",
",",
"a",
".",
"conj",
"(",
")",
".",
"transpose",
"(",
")",
",",
"q",
")"
] | https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/scipy/linalg/_solvers.py#L91-L124 | |
larryhastings/gilectomy | 4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a | Lib/tkinter/__init__.py | python | Menu.entrycget | (self, index, option) | return self.tk.call(self._w, 'entrycget', index, '-' + option) | Return the resource value of a menu item for OPTION at INDEX. | Return the resource value of a menu item for OPTION at INDEX. | [
"Return",
"the",
"resource",
"value",
"of",
"a",
"menu",
"item",
"for",
"OPTION",
"at",
"INDEX",
"."
] | def entrycget(self, index, option):
"""Return the resource value of a menu item for OPTION at INDEX."""
return self.tk.call(self._w, 'entrycget', index, '-' + option) | [
"def",
"entrycget",
"(",
"self",
",",
"index",
",",
"option",
")",
":",
"return",
"self",
".",
"tk",
".",
"call",
"(",
"self",
".",
"_w",
",",
"'entrycget'",
",",
"index",
",",
"'-'",
"+",
"option",
")"
] | https://github.com/larryhastings/gilectomy/blob/4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a/Lib/tkinter/__init__.py#L2758-L2760 | |
meraki/dashboard-api-python | aef5e6fe5d23a40d435d5c64ff30580a28af07f1 | meraki/aio/api/appliance.py | python | AsyncAppliance.getNetworkApplianceClientSecurityEvents | (self, networkId: str, clientId: str, total_pages=1, direction='next', **kwargs) | return self._session.get_pages(metadata, resource, params, total_pages, direction) | **List the security events for a client**
https://developer.cisco.com/meraki/api-v1/#!get-network-appliance-client-security-events
- networkId (string): (required)
- clientId (string): (required)
- total_pages (integer or string): use with perPage to get total results up to total_pages*... | **List the security events for a client**
https://developer.cisco.com/meraki/api-v1/#!get-network-appliance-client-security-events | [
"**",
"List",
"the",
"security",
"events",
"for",
"a",
"client",
"**",
"https",
":",
"//",
"developer",
".",
"cisco",
".",
"com",
"/",
"meraki",
"/",
"api",
"-",
"v1",
"/",
"#!get",
"-",
"network",
"-",
"appliance",
"-",
"client",
"-",
"security",
"-... | def getNetworkApplianceClientSecurityEvents(self, networkId: str, clientId: str, total_pages=1, direction='next', **kwargs):
"""
**List the security events for a client**
https://developer.cisco.com/meraki/api-v1/#!get-network-appliance-client-security-events
- networkId (string): (requ... | [
"def",
"getNetworkApplianceClientSecurityEvents",
"(",
"self",
",",
"networkId",
":",
"str",
",",
"clientId",
":",
"str",
",",
"total_pages",
"=",
"1",
",",
"direction",
"=",
"'next'",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
".",
"update",
"(",
"local... | https://github.com/meraki/dashboard-api-python/blob/aef5e6fe5d23a40d435d5c64ff30580a28af07f1/meraki/aio/api/appliance.py#L44-L77 | |
jankrepl/deepdow | eb6c85845c45f89e0743b8e8c29ddb69cb78da4f | deepdow/losses.py | python | LargestWeight.__call__ | (self, weights, *args) | return weights.max(dim=1)[0] | Compute largest weight.
Parameters
----------
weights : torch.Tensor
Tensor of shape `(n_samples, n_assets)` representing the predicted weights by our portfolio optimizer.
args : list
Additional arguments. Just used for compatibility. Not used.
Returns
... | Compute largest weight. | [
"Compute",
"largest",
"weight",
"."
] | def __call__(self, weights, *args):
"""Compute largest weight.
Parameters
----------
weights : torch.Tensor
Tensor of shape `(n_samples, n_assets)` representing the predicted weights by our portfolio optimizer.
args : list
Additional arguments. Just used... | [
"def",
"__call__",
"(",
"self",
",",
"weights",
",",
"*",
"args",
")",
":",
"return",
"weights",
".",
"max",
"(",
"dim",
"=",
"1",
")",
"[",
"0",
"]"
] | https://github.com/jankrepl/deepdow/blob/eb6c85845c45f89e0743b8e8c29ddb69cb78da4f/deepdow/losses.py#L497-L514 | |
Wangler2333/tcp_udp_web_tools-pyqt5 | 791df73791e3e6f61643f10613c84810cdf2ffc2 | tcp_udp_web_tools_all_in_one.py | python | Ui_TCP.web_server_concurrency | (self) | 功能函数,供创建线程的方法;
使用子线程用于监听并创建连接,使主线程可以继续运行,以免无响应
使用非阻塞式并发用于接收客户端消息,减少系统资源浪费,使软件轻量化
:return:None | 功能函数,供创建线程的方法;
使用子线程用于监听并创建连接,使主线程可以继续运行,以免无响应
使用非阻塞式并发用于接收客户端消息,减少系统资源浪费,使软件轻量化
:return:None | [
"功能函数,供创建线程的方法;",
"使用子线程用于监听并创建连接,使主线程可以继续运行,以免无响应",
"使用非阻塞式并发用于接收客户端消息,减少系统资源浪费,使软件轻量化",
":",
"return",
":",
"None"
] | def web_server_concurrency(self):
"""
功能函数,供创建线程的方法;
使用子线程用于监听并创建连接,使主线程可以继续运行,以免无响应
使用非阻塞式并发用于接收客户端消息,减少系统资源浪费,使软件轻量化
:return:None
"""
while True:
try:
self.client_socket, self.client_address = self.tcp_socket.accept()
exce... | [
"def",
"web_server_concurrency",
"(",
"self",
")",
":",
"while",
"True",
":",
"try",
":",
"self",
".",
"client_socket",
",",
"self",
".",
"client_address",
"=",
"self",
".",
"tcp_socket",
".",
"accept",
"(",
")",
"except",
"Exception",
"as",
"ret",
":",
... | https://github.com/Wangler2333/tcp_udp_web_tools-pyqt5/blob/791df73791e3e6f61643f10613c84810cdf2ffc2/tcp_udp_web_tools_all_in_one.py#L551-L587 | ||
IJDykeman/wangTiles | 7c1ee2095ebdf7f72bce07d94c6484915d5cae8b | experimental_code/tiles_3d/venv_mac/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.py | python | TarInfo.create_pax_global_header | (cls, pax_headers) | return cls._create_pax_generic_header(pax_headers, XGLTYPE, "utf8") | Return the object as a pax global header block sequence. | Return the object as a pax global header block sequence. | [
"Return",
"the",
"object",
"as",
"a",
"pax",
"global",
"header",
"block",
"sequence",
"."
] | def create_pax_global_header(cls, pax_headers):
"""Return the object as a pax global header block sequence.
"""
return cls._create_pax_generic_header(pax_headers, XGLTYPE, "utf8") | [
"def",
"create_pax_global_header",
"(",
"cls",
",",
"pax_headers",
")",
":",
"return",
"cls",
".",
"_create_pax_generic_header",
"(",
"pax_headers",
",",
"XGLTYPE",
",",
"\"utf8\"",
")"
] | https://github.com/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/tiles_3d/venv_mac/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.py#L1093-L1096 | |
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/django-1.3/django/contrib/gis/geos/point.py | python | Point.set_x | (self, value) | Sets the X component of the Point. | Sets the X component of the Point. | [
"Sets",
"the",
"X",
"component",
"of",
"the",
"Point",
"."
] | def set_x(self, value):
"Sets the X component of the Point."
self._cs.setOrdinate(0, 0, value) | [
"def",
"set_x",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"_cs",
".",
"setOrdinate",
"(",
"0",
",",
"0",
",",
"value",
")"
] | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.3/django/contrib/gis/geos/point.py#L93-L95 | ||
khanhnamle1994/natural-language-processing | 01d450d5ac002b0156ef4cf93a07cb508c1bcdc5 | assignment1/.env/lib/python2.7/site-packages/IPython/utils/path.py | python | get_long_path_name | (path) | return _get_long_path_name(path) | Expand a path into its long form.
On Windows this expands any ~ in the paths. On other platforms, it is
a null operation. | Expand a path into its long form. | [
"Expand",
"a",
"path",
"into",
"its",
"long",
"form",
"."
] | def get_long_path_name(path):
"""Expand a path into its long form.
On Windows this expands any ~ in the paths. On other platforms, it is
a null operation.
"""
return _get_long_path_name(path) | [
"def",
"get_long_path_name",
"(",
"path",
")",
":",
"return",
"_get_long_path_name",
"(",
"path",
")"
] | https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/IPython/utils/path.py#L74-L80 | |
omkar13/MaskTrack | d669ad1ae9bb9808fc34696e150675cc99b7cd78 | training/utility_functions.py | python | apply_custom_transform | (img, label, df, inputRes=None) | return img,label,df | Data augmentations | Data augmentations | [
"Data",
"augmentations"
] | def apply_custom_transform(img, label, df, inputRes=None):
rots = (-30, 30)
scales = (0.5, 1.3)
"""Data augmentations"""
rot = (rots[1] - rots[0]) * random.random() - (rots[1] - rots[0]) / 2
sc = (scales[1] - scales[0]) * random.random() + scales[0]
horz_flip = False
if random.random() < ... | [
"def",
"apply_custom_transform",
"(",
"img",
",",
"label",
",",
"df",
",",
"inputRes",
"=",
"None",
")",
":",
"rots",
"=",
"(",
"-",
"30",
",",
"30",
")",
"scales",
"=",
"(",
"0.5",
",",
"1.3",
")",
"rot",
"=",
"(",
"rots",
"[",
"1",
"]",
"-",
... | https://github.com/omkar13/MaskTrack/blob/d669ad1ae9bb9808fc34696e150675cc99b7cd78/training/utility_functions.py#L333-L350 | |
pyparallel/pyparallel | 11e8c6072d48c8f13641925d17b147bf36ee0ba3 | Lib/abc.py | python | ABCMeta.__subclasscheck__ | (cls, subclass) | return False | Override for issubclass(subclass, cls). | Override for issubclass(subclass, cls). | [
"Override",
"for",
"issubclass",
"(",
"subclass",
"cls",
")",
"."
] | def __subclasscheck__(cls, subclass):
"""Override for issubclass(subclass, cls)."""
# Check cache
if subclass in cls._abc_cache:
return True
# Check negative cache; may have to invalidate
if cls._abc_negative_cache_version < ABCMeta._abc_invalidation_counter:
... | [
"def",
"__subclasscheck__",
"(",
"cls",
",",
"subclass",
")",
":",
"# Check cache",
"if",
"subclass",
"in",
"cls",
".",
"_abc_cache",
":",
"return",
"True",
"# Check negative cache; may have to invalidate",
"if",
"cls",
".",
"_abc_negative_cache_version",
"<",
"ABCMet... | https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/abc.py#L191-L228 | |
tomplus/kubernetes_asyncio | f028cc793e3a2c519be6a52a49fb77ff0b014c9b | kubernetes_asyncio/client/models/v1_downward_api_volume_source.py | python | V1DownwardAPIVolumeSource.items | (self) | return self._items | Gets the items of this V1DownwardAPIVolumeSource. # noqa: E501
Items is a list of downward API volume file # noqa: E501
:return: The items of this V1DownwardAPIVolumeSource. # noqa: E501
:rtype: list[V1DownwardAPIVolumeFile] | Gets the items of this V1DownwardAPIVolumeSource. # noqa: E501 | [
"Gets",
"the",
"items",
"of",
"this",
"V1DownwardAPIVolumeSource",
".",
"#",
"noqa",
":",
"E501"
] | def items(self):
"""Gets the items of this V1DownwardAPIVolumeSource. # noqa: E501
Items is a list of downward API volume file # noqa: E501
:return: The items of this V1DownwardAPIVolumeSource. # noqa: E501
:rtype: list[V1DownwardAPIVolumeFile]
"""
return self._items | [
"def",
"items",
"(",
"self",
")",
":",
"return",
"self",
".",
"_items"
] | https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/models/v1_downward_api_volume_source.py#L84-L92 | |
PaddlePaddle/PaddleX | 2bab73f81ab54e328204e7871e6ae4a82e719f5d | static/paddlex/utils/logging.py | python | error | (message="", use_color=True, exit=True) | [] | def error(message="", use_color=True, exit=True):
log(level=0, message=message, use_color=use_color)
if exit:
sys.exit(-1) | [
"def",
"error",
"(",
"message",
"=",
"\"\"",
",",
"use_color",
"=",
"True",
",",
"exit",
"=",
"True",
")",
":",
"log",
"(",
"level",
"=",
"0",
",",
"message",
"=",
"message",
",",
"use_color",
"=",
"use_color",
")",
"if",
"exit",
":",
"sys",
".",
... | https://github.com/PaddlePaddle/PaddleX/blob/2bab73f81ab54e328204e7871e6ae4a82e719f5d/static/paddlex/utils/logging.py#L53-L56 | ||||
hatRiot/zarp | 2e772350a01c2aeed3f4da9685cd0cc5d6b3ecad | src/lib/scapy/layers/l2.py | python | DestMACField.i2m | (self, pkt, x) | return MACField.i2m(self, pkt, self.i2h(pkt, x)) | [] | def i2m(self, pkt, x):
return MACField.i2m(self, pkt, self.i2h(pkt, x)) | [
"def",
"i2m",
"(",
"self",
",",
"pkt",
",",
"x",
")",
":",
"return",
"MACField",
".",
"i2m",
"(",
"self",
",",
"pkt",
",",
"self",
".",
"i2h",
"(",
"pkt",
",",
"x",
")",
")"
] | https://github.com/hatRiot/zarp/blob/2e772350a01c2aeed3f4da9685cd0cc5d6b3ecad/src/lib/scapy/layers/l2.py#L89-L90 | |||
tjweir/liftbook | e977a7face13ade1a4558e1909a6951d2f8928dd | elyxer.py | python | Abstract.process | (self) | [] | def process(self):
self.type = 'abstract'
self.output.tag = 'div class="abstract"'
if Abstract.done:
return
message = Translator.translate('abstract')
tagged = TaggedText().constant(message, 'p class="abstract-message"', True)
self.contents.insert(0, tagged)
Abstract.done = True | [
"def",
"process",
"(",
"self",
")",
":",
"self",
".",
"type",
"=",
"'abstract'",
"self",
".",
"output",
".",
"tag",
"=",
"'div class=\"abstract\"'",
"if",
"Abstract",
".",
"done",
":",
"return",
"message",
"=",
"Translator",
".",
"translate",
"(",
"'abstra... | https://github.com/tjweir/liftbook/blob/e977a7face13ade1a4558e1909a6951d2f8928dd/elyxer.py#L5359-L5367 | ||||
colour-science/colour | 38782ac059e8ddd91939f3432bf06811c16667f0 | colour/models/rgb/transfer_functions/gopro.py | python | log_encoding_Protune | (x) | return from_range_1(y) | Defines the *Protune* log encoding curve / opto-electronic transfer
function.
Parameters
----------
x : numeric or array_like
Linear data :math:`x`.
Returns
-------
numeric or ndarray
Non-linear data :math:`y`.
Notes
-----
+------------+-----------------------... | Defines the *Protune* log encoding curve / opto-electronic transfer
function. | [
"Defines",
"the",
"*",
"Protune",
"*",
"log",
"encoding",
"curve",
"/",
"opto",
"-",
"electronic",
"transfer",
"function",
"."
] | def log_encoding_Protune(x):
"""
Defines the *Protune* log encoding curve / opto-electronic transfer
function.
Parameters
----------
x : numeric or array_like
Linear data :math:`x`.
Returns
-------
numeric or ndarray
Non-linear data :math:`y`.
Notes
-----
... | [
"def",
"log_encoding_Protune",
"(",
"x",
")",
":",
"x",
"=",
"to_domain_1",
"(",
"x",
")",
"y",
"=",
"np",
".",
"log",
"(",
"x",
"*",
"112",
"+",
"1",
")",
"/",
"np",
".",
"log",
"(",
"113",
")",
"return",
"from_range_1",
"(",
"y",
")"
] | https://github.com/colour-science/colour/blob/38782ac059e8ddd91939f3432bf06811c16667f0/colour/models/rgb/transfer_functions/gopro.py#L36-L80 | |
etetoolkit/ete | 2b207357dc2a40ccad7bfd8f54964472c72e4726 | ete3/nexml/_nexml.py | python | Trees.exportChildren | (self, outfile, level, namespace_='', name_='Trees', fromsubclass_=False) | [] | def exportChildren(self, outfile, level, namespace_='', name_='Trees', fromsubclass_=False):
super(Trees, self).exportChildren(outfile, level, namespace_, name_, True)
for network_ in self.get_network():
network_.export(outfile, level, namespace_, name_='network')
for tree_ in self.g... | [
"def",
"exportChildren",
"(",
"self",
",",
"outfile",
",",
"level",
",",
"namespace_",
"=",
"''",
",",
"name_",
"=",
"'Trees'",
",",
"fromsubclass_",
"=",
"False",
")",
":",
"super",
"(",
"Trees",
",",
"self",
")",
".",
"exportChildren",
"(",
"outfile",
... | https://github.com/etetoolkit/ete/blob/2b207357dc2a40ccad7bfd8f54964472c72e4726/ete3/nexml/_nexml.py#L8263-L8270 | ||||
snipsco/snips-nlu | 74b2893c91fc0bafc919a7e088ecb0b2bd611acf | snips_nlu/result.py | python | resolved_slot | (match_range, raw_value, resolved_value, entity, slot_name) | return {
RES_MATCH_RANGE: match_range,
RES_RAW_VALUE: raw_value,
RES_VALUE: resolved_value,
RES_ENTITY: entity,
RES_SLOT_NAME: slot_name
} | Creates a resolved slot
Args:
match_range (dict): Range of the slot within the sentence
(ex: {"start": 3, "end": 10})
raw_value (str): Slot value as it appears in the sentence
resolved_value (dict): Resolved value of the slot
entity (str): Entity which the slot belongs t... | Creates a resolved slot | [
"Creates",
"a",
"resolved",
"slot"
] | def resolved_slot(match_range, raw_value, resolved_value, entity, slot_name):
"""Creates a resolved slot
Args:
match_range (dict): Range of the slot within the sentence
(ex: {"start": 3, "end": 10})
raw_value (str): Slot value as it appears in the sentence
resolved_value (di... | [
"def",
"resolved_slot",
"(",
"match_range",
",",
"raw_value",
",",
"resolved_value",
",",
"entity",
",",
"slot_name",
")",
":",
"return",
"{",
"RES_MATCH_RANGE",
":",
"match_range",
",",
"RES_RAW_VALUE",
":",
"raw_value",
",",
"RES_VALUE",
":",
"resolved_value",
... | https://github.com/snipsco/snips-nlu/blob/74b2893c91fc0bafc919a7e088ecb0b2bd611acf/snips_nlu/result.py#L131-L177 | |
mesonbuild/meson | a22d0f9a0a787df70ce79b05d0c45de90a970048 | mesonbuild/rewriter.py | python | MTypeList.supported_element_nodes | (self) | return [] | [] | def supported_element_nodes(self):
# Overwrite in derived class
return [] | [
"def",
"supported_element_nodes",
"(",
"self",
")",
":",
"# Overwrite in derived class",
"return",
"[",
"]"
] | https://github.com/mesonbuild/meson/blob/a22d0f9a0a787df70ce79b05d0c45de90a970048/mesonbuild/rewriter.py#L214-L216 | |||
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/modules/virt.py | python | get_graphics | (vm_, **kwargs) | return graphics | Returns the information on vnc for a given vm
:param vm_: name of the domain
:param connection: libvirt connection URI, overriding defaults
.. versionadded:: 2019.2.0
:param username: username to connect with, overriding defaults
.. versionadded:: 2019.2.0
:param password: password to... | Returns the information on vnc for a given vm | [
"Returns",
"the",
"information",
"on",
"vnc",
"for",
"a",
"given",
"vm"
] | def get_graphics(vm_, **kwargs):
"""
Returns the information on vnc for a given vm
:param vm_: name of the domain
:param connection: libvirt connection URI, overriding defaults
.. versionadded:: 2019.2.0
:param username: username to connect with, overriding defaults
.. versionadde... | [
"def",
"get_graphics",
"(",
"vm_",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"__get_conn",
"(",
"*",
"*",
"kwargs",
")",
"graphics",
"=",
"_get_graphics",
"(",
"_get_domain",
"(",
"conn",
",",
"vm_",
")",
")",
"conn",
".",
"close",
"(",
")",
... | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/virt.py#L4673-L4697 | |
CyberZHG/keras-bert | f8bb7ab399f62832badf4c618520264bc91bdff1 | keras_bert/layers/embedding.py | python | EmbeddingSimilarity.__init__ | (self,
initializer='zeros',
regularizer=None,
constraint=None,
**kwargs) | Initialize the layer.
:param output_dim: Same as embedding output dimension.
:param initializer: Initializer for bias.
:param regularizer: Regularizer for bias.
:param constraint: Constraint for bias.
:param kwargs: Arguments for parent class. | Initialize the layer. | [
"Initialize",
"the",
"layer",
"."
] | def __init__(self,
initializer='zeros',
regularizer=None,
constraint=None,
**kwargs):
"""Initialize the layer.
:param output_dim: Same as embedding output dimension.
:param initializer: Initializer for bias.
:param regu... | [
"def",
"__init__",
"(",
"self",
",",
"initializer",
"=",
"'zeros'",
",",
"regularizer",
"=",
"None",
",",
"constraint",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"EmbeddingSimilarity",
",",
"self",
")",
".",
"__init__",
"(",
"*",
"*... | https://github.com/CyberZHG/keras-bert/blob/f8bb7ab399f62832badf4c618520264bc91bdff1/keras_bert/layers/embedding.py#L60-L78 | ||
ktbyers/netmiko | 4c3732346eea1a4a608abd9e09d65eeb2f577810 | netmiko/base_connection.py | python | BaseConnection.set_base_prompt | (
self,
pri_prompt_terminator: str = "#",
alt_prompt_terminator: str = ">",
delay_factor: float = 1.0,
) | return self.base_prompt | Sets self.base_prompt
Used as delimiter for stripping of trailing prompt in output.
Should be set to something that is general and applies in multiple contexts. For Cisco
devices this will be set to router hostname (i.e. prompt without > or #).
This will be set on entering user exec o... | Sets self.base_prompt | [
"Sets",
"self",
".",
"base_prompt"
] | def set_base_prompt(
self,
pri_prompt_terminator: str = "#",
alt_prompt_terminator: str = ">",
delay_factor: float = 1.0,
) -> str:
"""Sets self.base_prompt
Used as delimiter for stripping of trailing prompt in output.
Should be set to something that is gene... | [
"def",
"set_base_prompt",
"(",
"self",
",",
"pri_prompt_terminator",
":",
"str",
"=",
"\"#\"",
",",
"alt_prompt_terminator",
":",
"str",
"=",
"\">\"",
",",
"delay_factor",
":",
"float",
"=",
"1.0",
",",
")",
"->",
"str",
":",
"prompt",
"=",
"self",
".",
... | https://github.com/ktbyers/netmiko/blob/4c3732346eea1a4a608abd9e09d65eeb2f577810/netmiko/base_connection.py#L1228-L1255 | |
davidbau/ganseeing | 93cea2c8f391aef001ddf9dcb35c43990681a47c | seeing/encoder_net.py | python | add_adjustment | (x, idecoder, attr) | return x | [] | def add_adjustment(x, idecoder, attr):
adjustment = getattr(idecoder, attr)
x = x + adjustment
return x | [
"def",
"add_adjustment",
"(",
"x",
",",
"idecoder",
",",
"attr",
")",
":",
"adjustment",
"=",
"getattr",
"(",
"idecoder",
",",
"attr",
")",
"x",
"=",
"x",
"+",
"adjustment",
"return",
"x"
] | https://github.com/davidbau/ganseeing/blob/93cea2c8f391aef001ddf9dcb35c43990681a47c/seeing/encoder_net.py#L292-L295 | |||
getting-things-gnome/gtg | 4b02c43744b32a00facb98174f04ec5953bd055d | GTG/plugins/dev_console/console.py | python | DevConsolePlugin.open_window | (self, widget=None, unsued=None) | Open developer console. | Open developer console. | [
"Open",
"developer",
"console",
"."
] | def open_window(self, widget=None, unsued=None) -> None:
"""Open developer console."""
self.window.show_all()
self.window.set_keep_above(True) | [
"def",
"open_window",
"(",
"self",
",",
"widget",
"=",
"None",
",",
"unsued",
"=",
"None",
")",
"->",
"None",
":",
"self",
".",
"window",
".",
"show_all",
"(",
")",
"self",
".",
"window",
".",
"set_keep_above",
"(",
"True",
")"
] | https://github.com/getting-things-gnome/gtg/blob/4b02c43744b32a00facb98174f04ec5953bd055d/GTG/plugins/dev_console/console.py#L135-L139 | ||
CamDavidsonPilon/lifelines | 9be26a9a8720e8536e9828e954bb91d559a3016f | lifelines/statistics.py | python | logrank_test | (
durations_A,
durations_B,
event_observed_A=None,
event_observed_B=None,
t_0=-1,
weights_A=None,
weights_B=None,
weightings=None,
**kwargs
) | return multivariate_logrank_test(
event_times, groups, event_observed, t_0=t_0, weights=weights, test_name="logrank_test", weightings=weightings, **kwargs
) | r"""
Measures and reports on whether two intensity processes are different. That is, given two
event series, determines whether the data generating processes are statistically different.
The test-statistic is chi-squared under the null hypothesis. Let :math:`h_i(t)` be the hazard ratio of
group :math:`i... | r"""
Measures and reports on whether two intensity processes are different. That is, given two
event series, determines whether the data generating processes are statistically different.
The test-statistic is chi-squared under the null hypothesis. Let :math:`h_i(t)` be the hazard ratio of
group :math:`i... | [
"r",
"Measures",
"and",
"reports",
"on",
"whether",
"two",
"intensity",
"processes",
"are",
"different",
".",
"That",
"is",
"given",
"two",
"event",
"series",
"determines",
"whether",
"the",
"data",
"generating",
"processes",
"are",
"statistically",
"different",
... | def logrank_test(
durations_A,
durations_B,
event_observed_A=None,
event_observed_B=None,
t_0=-1,
weights_A=None,
weights_B=None,
weightings=None,
**kwargs
) -> StatisticalResult:
r"""
Measures and reports on whether two intensity processes are different. That is, given two
... | [
"def",
"logrank_test",
"(",
"durations_A",
",",
"durations_B",
",",
"event_observed_A",
"=",
"None",
",",
"event_observed_B",
"=",
"None",
",",
"t_0",
"=",
"-",
"1",
",",
"weights_A",
"=",
"None",
",",
"weights_B",
"=",
"None",
",",
"weightings",
"=",
"Non... | https://github.com/CamDavidsonPilon/lifelines/blob/9be26a9a8720e8536e9828e954bb91d559a3016f/lifelines/statistics.py#L442-L580 | |
gramps-project/gramps | 04d4651a43eb210192f40a9f8c2bad8ee8fa3753 | gramps/gui/views/treemodels/flatbasemodel.py | python | FlatBaseModel.on_get_n_columns | (self) | Return the number of columns. Must be implemented in the child objects
See Gtk.TreeModel. Inherit as needed | Return the number of columns. Must be implemented in the child objects
See Gtk.TreeModel. Inherit as needed | [
"Return",
"the",
"number",
"of",
"columns",
".",
"Must",
"be",
"implemented",
"in",
"the",
"child",
"objects",
"See",
"Gtk",
".",
"TreeModel",
".",
"Inherit",
"as",
"needed"
] | def on_get_n_columns(self):
"""
Return the number of columns. Must be implemented in the child objects
See Gtk.TreeModel. Inherit as needed
"""
#print 'do_get_n_col'
raise NotImplementedError | [
"def",
"on_get_n_columns",
"(",
"self",
")",
":",
"#print 'do_get_n_col'",
"raise",
"NotImplementedError"
] | https://github.com/gramps-project/gramps/blob/04d4651a43eb210192f40a9f8c2bad8ee8fa3753/gramps/gui/views/treemodels/flatbasemodel.py#L722-L728 | ||
opendevops-cn/opendevops | 538dc9b93bd7c08f36a2d6a7eb8df848f7d7f3d0 | scripts/tornado_source_code/tornado/ioloop.py | python | IOLoop.add_callback_from_signal | (
self, callback: Callable, *args: Any, **kwargs: Any
) | Calls the given callback on the next I/O loop iteration.
Safe for use from a Python signal handler; should not be used
otherwise. | Calls the given callback on the next I/O loop iteration. | [
"Calls",
"the",
"given",
"callback",
"on",
"the",
"next",
"I",
"/",
"O",
"loop",
"iteration",
"."
] | def add_callback_from_signal(
self, callback: Callable, *args: Any, **kwargs: Any
) -> None:
"""Calls the given callback on the next I/O loop iteration.
Safe for use from a Python signal handler; should not be used
otherwise.
"""
raise NotImplementedError() | [
"def",
"add_callback_from_signal",
"(",
"self",
",",
"callback",
":",
"Callable",
",",
"*",
"args",
":",
"Any",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"None",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/opendevops-cn/opendevops/blob/538dc9b93bd7c08f36a2d6a7eb8df848f7d7f3d0/scripts/tornado_source_code/tornado/ioloop.py#L646-L654 | ||
phantomcyber/playbooks | 9e850ecc44cb98c5dde53784744213a1ed5799bd | excessive_account_lockouts_enrichment_and_response.py | python | format_user_risk_mod | (action=None, success=None, container=None, results=None, handle=None, filtered_artifacts=None, filtered_results=None, custom_function=None, **kwargs) | return | [] | def format_user_risk_mod(action=None, success=None, container=None, results=None, handle=None, filtered_artifacts=None, filtered_results=None, custom_function=None, **kwargs):
phantom.debug('format_user_risk_mod() called')
template = """| from datamodel:Risk.All_Risk | search risk_object_type=user risk_obj... | [
"def",
"format_user_risk_mod",
"(",
"action",
"=",
"None",
",",
"success",
"=",
"None",
",",
"container",
"=",
"None",
",",
"results",
"=",
"None",
",",
"handle",
"=",
"None",
",",
"filtered_artifacts",
"=",
"None",
",",
"filtered_results",
"=",
"None",
",... | https://github.com/phantomcyber/playbooks/blob/9e850ecc44cb98c5dde53784744213a1ed5799bd/excessive_account_lockouts_enrichment_and_response.py#L197-L211 | |||
cuemacro/findatapy | 8ce72b17cc4dd3e3f53f0ab8adf58b6eeae29c10 | findatapy/timeseries/filter.py | python | Filter.filter_time_series_by_excluded_keyword | (self, keyword, data_frame) | return self.filter_time_series_by_columns(columns, data_frame) | Filter time series to exclude columns which contain keyword
Parameters
----------
keyword : str
columns to be excluded with this keyword
data_frame : DataFrame
data frame to be filtered
Returns
-------
DataFrame | Filter time series to exclude columns which contain keyword | [
"Filter",
"time",
"series",
"to",
"exclude",
"columns",
"which",
"contain",
"keyword"
] | def filter_time_series_by_excluded_keyword(self, keyword, data_frame):
"""Filter time series to exclude columns which contain keyword
Parameters
----------
keyword : str
columns to be excluded with this keyword
data_frame : DataFrame
data frame to be filt... | [
"def",
"filter_time_series_by_excluded_keyword",
"(",
"self",
",",
"keyword",
",",
"data_frame",
")",
":",
"if",
"not",
"(",
"isinstance",
"(",
"keyword",
",",
"list",
")",
")",
":",
"keyword",
"=",
"[",
"keyword",
"]",
"columns",
"=",
"[",
"]",
"for",
"... | https://github.com/cuemacro/findatapy/blob/8ce72b17cc4dd3e3f53f0ab8adf58b6eeae29c10/findatapy/timeseries/filter.py#L542-L567 | |
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/iotvideo/v20201215/models.py | python | CreateDataForwardResponse.__init__ | (self) | r"""
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str | r"""
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str | [
"r",
":",
"param",
"RequestId",
":",
"唯一请求",
"ID,每次请求都会返回。定位问题时需要提供该次请求的",
"RequestId。",
":",
"type",
"RequestId",
":",
"str"
] | def __init__(self):
r"""
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.RequestId = None | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"RequestId",
"=",
"None"
] | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/iotvideo/v20201215/models.py#L1044-L1049 | ||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/categories/covariant_functorial_construction.py | python | CovariantFunctorialConstruction.__call__ | (self, args, **kwargs) | return getattr(args[0], self._functor_name)(*args[1:], **kwargs) | Functorial construction application
INPUT:
- ``self``: a covariant functorial construction `F`
- ``args``: a tuple (or iterable) of parents or elements
Returns `F(args)`
EXAMPLES::
sage: E = CombinatorialFreeModule(QQ, ["a", "b", "c"]); E.rename("E")
... | Functorial construction application | [
"Functorial",
"construction",
"application"
] | def __call__(self, args, **kwargs):
"""
Functorial construction application
INPUT:
- ``self``: a covariant functorial construction `F`
- ``args``: a tuple (or iterable) of parents or elements
Returns `F(args)`
EXAMPLES::
sage: E = CombinatorialFr... | [
"def",
"__call__",
"(",
"self",
",",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"args",
"=",
"tuple",
"(",
"args",
")",
"# a bit brute force; let's see if this becomes a bottleneck later",
"assert",
"(",
"all",
"(",
"hasattr",
"(",
"arg",
",",
"self",
".",
"... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/categories/covariant_functorial_construction.py#L203-L222 | |
spesmilo/electrum | bdbd59300fbd35b01605e66145458e5f396108e8 | electrum/gui/stdio.py | python | ElectrumGui.get_balance | (self) | return(msg) | [] | def get_balance(self):
if self.wallet.network.is_connected():
if not self.wallet.up_to_date:
msg = _("Synchronizing...")
else:
c, u, x = self.wallet.get_balance()
msg = _("Balance")+": %f "%(Decimal(c) / COIN)
if u:
... | [
"def",
"get_balance",
"(",
"self",
")",
":",
"if",
"self",
".",
"wallet",
".",
"network",
".",
"is_connected",
"(",
")",
":",
"if",
"not",
"self",
".",
"wallet",
".",
"up_to_date",
":",
"msg",
"=",
"_",
"(",
"\"Synchronizing...\"",
")",
"else",
":",
... | https://github.com/spesmilo/electrum/blob/bdbd59300fbd35b01605e66145458e5f396108e8/electrum/gui/stdio.py#L119-L133 | |||
turian/neural-language-model | f7559a6cc4e9f4c34a553fbda974762f2d3f781b | scripts/monolingual/vocabulary.py | python | write | (wordmap, name="") | Write the word ID map, passed as a parameter. | Write the word ID map, passed as a parameter. | [
"Write",
"the",
"word",
"ID",
"map",
"passed",
"as",
"a",
"parameter",
"."
] | def write(wordmap, name=""):
"""
Write the word ID map, passed as a parameter.
"""
print >> sys.stderr, "Writing word map to %s..." % _wordmap_filename(name)
cPickle.dump(wordmap, myopen(_wordmap_filename(name), "w")) | [
"def",
"write",
"(",
"wordmap",
",",
"name",
"=",
"\"\"",
")",
":",
"print",
">>",
"sys",
".",
"stderr",
",",
"\"Writing word map to %s...\"",
"%",
"_wordmap_filename",
"(",
"name",
")",
"cPickle",
".",
"dump",
"(",
"wordmap",
",",
"myopen",
"(",
"_wordmap... | https://github.com/turian/neural-language-model/blob/f7559a6cc4e9f4c34a553fbda974762f2d3f781b/scripts/monolingual/vocabulary.py#L20-L25 | ||
wakatime/legacy-python-cli | 9b64548b16ab5ef16603d9a6c2620a16d0df8d46 | wakatime/packages/requests/models.py | python | PreparedRequest.prepare_hooks | (self, hooks) | Prepares the given hooks. | Prepares the given hooks. | [
"Prepares",
"the",
"given",
"hooks",
"."
] | def prepare_hooks(self, hooks):
"""Prepares the given hooks."""
# hooks can be passed as None to the prepare method and to this
# method. To prevent iterating over None, simply use an empty list
# if hooks is False-y
hooks = hooks or []
for event in hooks:
sel... | [
"def",
"prepare_hooks",
"(",
"self",
",",
"hooks",
")",
":",
"# hooks can be passed as None to the prepare method and to this",
"# method. To prevent iterating over None, simply use an empty list",
"# if hooks is False-y",
"hooks",
"=",
"hooks",
"or",
"[",
"]",
"for",
"event",
... | https://github.com/wakatime/legacy-python-cli/blob/9b64548b16ab5ef16603d9a6c2620a16d0df8d46/wakatime/packages/requests/models.py#L568-L575 | ||
timonwong/OmniMarkupPreviewer | 21921ac7a99d2b5924a2219b33679a5b53621392 | OmniMarkupLib/Renderers/libs/python3/docutils/parsers/rst/states.py | python | Body.option_marker | (self, match, context, next_state) | return [], next_state, [] | Option list item. | Option list item. | [
"Option",
"list",
"item",
"."
] | def option_marker(self, match, context, next_state):
"""Option list item."""
optionlist = nodes.option_list()
try:
listitem, blank_finish = self.option_list_item(match)
except MarkupError as error:
# This shouldn't happen; pattern won't match.
msg = se... | [
"def",
"option_marker",
"(",
"self",
",",
"match",
",",
"context",
",",
"next_state",
")",
":",
"optionlist",
"=",
"nodes",
".",
"option_list",
"(",
")",
"try",
":",
"listitem",
",",
"blank_finish",
"=",
"self",
".",
"option_list_item",
"(",
"match",
")",
... | https://github.com/timonwong/OmniMarkupPreviewer/blob/21921ac7a99d2b5924a2219b33679a5b53621392/OmniMarkupLib/Renderers/libs/python3/docutils/parsers/rst/states.py#L1464-L1492 | |
adlnet/ADL_LRS | 2c3d8a8bc716da38fe2ba40ad8edc38e2c446c59 | oauth_provider/store/__init__.py | python | Store.get_consumer_for_access_token | (self, request, oauth_request, access_token) | Return the Consumer associated with the `access_token` Token.
`request`: The Django request object.
`oauth_request`: The `oauth2.Request` object.
`access_token`: The access Token to get the consumer for. | Return the Consumer associated with the `access_token` Token. | [
"Return",
"the",
"Consumer",
"associated",
"with",
"the",
"access_token",
"Token",
"."
] | def get_consumer_for_access_token(self, request, oauth_request, access_token):
"""
Return the Consumer associated with the `access_token` Token.
`request`: The Django request object.
`oauth_request`: The `oauth2.Request` object.
`access_token`: The access Token to get the consum... | [
"def",
"get_consumer_for_access_token",
"(",
"self",
",",
"request",
",",
"oauth_request",
",",
"access_token",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/adlnet/ADL_LRS/blob/2c3d8a8bc716da38fe2ba40ad8edc38e2c446c59/oauth_provider/store/__init__.py#L64-L72 | ||
FederatedAI/FATE | 32540492623568ecd1afcb367360133616e02fa3 | python/fate_client/pipeline/backend/_operation.py | python | ModelConvert._feed_homo_conf | (self, framework_name) | return conf | [] | def _feed_homo_conf(self, framework_name):
model_info = self.pipeline_obj.get_model_info()
conf = {"role": self.pipeline_obj._initiator.role,
"party_id": self.pipeline_obj._initiator.party_id,
"model_id": model_info.model_id,
"model_version": model_info.mo... | [
"def",
"_feed_homo_conf",
"(",
"self",
",",
"framework_name",
")",
":",
"model_info",
"=",
"self",
".",
"pipeline_obj",
".",
"get_model_info",
"(",
")",
"conf",
"=",
"{",
"\"role\"",
":",
"self",
".",
"pipeline_obj",
".",
"_initiator",
".",
"role",
",",
"\... | https://github.com/FederatedAI/FATE/blob/32540492623568ecd1afcb367360133616e02fa3/python/fate_client/pipeline/backend/_operation.py#L71-L80 | |||
theotherp/nzbhydra | 4b03d7f769384b97dfc60dade4806c0fc987514e | libs/OpenSSL/crypto.py | python | verify | (cert, signature, data, digest) | Verify a signature
:param cert: signing certificate (X509 object)
:param signature: signature returned by sign function
:param data: data to be verified
:param digest: message digest to use
:return: None if the signature is correct, raise exception otherwise | Verify a signature | [
"Verify",
"a",
"signature"
] | def verify(cert, signature, data, digest):
"""
Verify a signature
:param cert: signing certificate (X509 object)
:param signature: signature returned by sign function
:param data: data to be verified
:param digest: message digest to use
:return: None if the signature is correct, raise excep... | [
"def",
"verify",
"(",
"cert",
",",
"signature",
",",
"data",
",",
"digest",
")",
":",
"data",
"=",
"_text_to_bytes_and_warn",
"(",
"\"data\"",
",",
"data",
")",
"digest_obj",
"=",
"_lib",
".",
"EVP_get_digestbyname",
"(",
"_byte_string",
"(",
"digest",
")",
... | https://github.com/theotherp/nzbhydra/blob/4b03d7f769384b97dfc60dade4806c0fc987514e/libs/OpenSSL/crypto.py#L2423-L2453 | ||
openstack/keystone | 771c943ad2116193e7bb118c74993c829d93bd71 | keystone/federation/backends/base.py | python | FederationDriverBase.get_idp | (self, idp_id) | Get an identity provider by ID.
:param idp_id: ID of IdP object
:type idp_id: string
:raises keystone.exception.IdentityProviderNotFound: If the IdP
doesn't exist.
:returns: idp ref
:rtype: dict | Get an identity provider by ID. | [
"Get",
"an",
"identity",
"provider",
"by",
"ID",
"."
] | def get_idp(self, idp_id):
"""Get an identity provider by ID.
:param idp_id: ID of IdP object
:type idp_id: string
:raises keystone.exception.IdentityProviderNotFound: If the IdP
doesn't exist.
:returns: idp ref
:rtype: dict
"""
raise excepti... | [
"def",
"get_idp",
"(",
"self",
",",
"idp_id",
")",
":",
"raise",
"exception",
".",
"NotImplemented",
"(",
")"
] | https://github.com/openstack/keystone/blob/771c943ad2116193e7bb118c74993c829d93bd71/keystone/federation/backends/base.py#L49-L60 | ||
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/min/nntplib.py | python | _parse_overview | (lines, fmt, data_process_func=None) | return overview | Parse the response to an OVER or XOVER command according to the
overview format `fmt`. | Parse the response to an OVER or XOVER command according to the
overview format `fmt`. | [
"Parse",
"the",
"response",
"to",
"an",
"OVER",
"or",
"XOVER",
"command",
"according",
"to",
"the",
"overview",
"format",
"fmt",
"."
] | def _parse_overview(lines, fmt, data_process_func=None):
"""Parse the response to an OVER or XOVER command according to the
overview format `fmt`."""
n_defaults = len(_DEFAULT_OVERVIEW_FMT)
overview = []
for line in lines:
fields = {}
article_number, *tokens = line.split('\t')
... | [
"def",
"_parse_overview",
"(",
"lines",
",",
"fmt",
",",
"data_process_func",
"=",
"None",
")",
":",
"n_defaults",
"=",
"len",
"(",
"_DEFAULT_OVERVIEW_FMT",
")",
"overview",
"=",
"[",
"]",
"for",
"line",
"in",
"lines",
":",
"fields",
"=",
"{",
"}",
"arti... | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/min/nntplib.py#L203-L230 | |
Remmeauth/remme-core | 3a8ac8d8f6ba1a1126c028c81d350c9475fe9834 | remme/shared/messaging.py | python | _MessageRouter.fail_all | (self, err) | Fail all the expected replies with a given error. | Fail all the expected replies with a given error. | [
"Fail",
"all",
"the",
"expected",
"replies",
"with",
"a",
"given",
"error",
"."
] | def fail_all(self, err):
"""Fail all the expected replies with a given error.
"""
for c_id in self._futures:
self._fail_reply(c_id, err) | [
"def",
"fail_all",
"(",
"self",
",",
"err",
")",
":",
"for",
"c_id",
"in",
"self",
".",
"_futures",
":",
"self",
".",
"_fail_reply",
"(",
"c_id",
",",
"err",
")"
] | https://github.com/Remmeauth/remme-core/blob/3a8ac8d8f6ba1a1126c028c81d350c9475fe9834/remme/shared/messaging.py#L219-L223 | ||
arrayfire/arrayfire-python | 96fa9768ee02e5fb5ffcaf3d1f744c898b141637 | arrayfire/device.py | python | get_device | () | return c_dev.value | Returns the id of the current device. | Returns the id of the current device. | [
"Returns",
"the",
"id",
"of",
"the",
"current",
"device",
"."
] | def get_device():
"""
Returns the id of the current device.
"""
c_dev = c_int_t(0)
safe_call(backend.get().af_get_device(c_pointer(c_dev)))
return c_dev.value | [
"def",
"get_device",
"(",
")",
":",
"c_dev",
"=",
"c_int_t",
"(",
"0",
")",
"safe_call",
"(",
"backend",
".",
"get",
"(",
")",
".",
"af_get_device",
"(",
"c_pointer",
"(",
"c_dev",
")",
")",
")",
"return",
"c_dev",
".",
"value"
] | https://github.com/arrayfire/arrayfire-python/blob/96fa9768ee02e5fb5ffcaf3d1f744c898b141637/arrayfire/device.py#L66-L72 | |
pantsbuild/pex | 473c6ac732ed4bc338b4b20a9ec930d1d722c9b4 | pex/vendor/_vendored/setuptools/pkg_resources/_vendor/appdirs.py | python | AppDirs.site_config_dir | (self) | return site_config_dir(self.appname, self.appauthor,
version=self.version, multipath=self.multipath) | [] | def site_config_dir(self):
return site_config_dir(self.appname, self.appauthor,
version=self.version, multipath=self.multipath) | [
"def",
"site_config_dir",
"(",
"self",
")",
":",
"return",
"site_config_dir",
"(",
"self",
".",
"appname",
",",
"self",
".",
"appauthor",
",",
"version",
"=",
"self",
".",
"version",
",",
"multipath",
"=",
"self",
".",
"multipath",
")"
] | https://github.com/pantsbuild/pex/blob/473c6ac732ed4bc338b4b20a9ec930d1d722c9b4/pex/vendor/_vendored/setuptools/pkg_resources/_vendor/appdirs.py#L433-L435 | |||
danirus/django-comments-xtd | c2ec50226d219d98fe0faeae4e66e8a676b47e5b | django_comments_xtd/compat.py | python | import_by_path | (dotted_path, error_prefix='') | return attr | Import a dotted module path and return the attribute/class designated by the
last name in the path. Raise ImproperlyConfigured if something goes wrong. | Import a dotted module path and return the attribute/class designated by the
last name in the path. Raise ImproperlyConfigured if something goes wrong. | [
"Import",
"a",
"dotted",
"module",
"path",
"and",
"return",
"the",
"attribute",
"/",
"class",
"designated",
"by",
"the",
"last",
"name",
"in",
"the",
"path",
".",
"Raise",
"ImproperlyConfigured",
"if",
"something",
"goes",
"wrong",
"."
] | def import_by_path(dotted_path, error_prefix=''):
"""
Import a dotted module path and return the attribute/class designated by the
last name in the path. Raise ImproperlyConfigured if something goes wrong.
"""
try:
module_path, class_name = dotted_path.rsplit('.', 1)
except ValueError:
... | [
"def",
"import_by_path",
"(",
"dotted_path",
",",
"error_prefix",
"=",
"''",
")",
":",
"try",
":",
"module_path",
",",
"class_name",
"=",
"dotted_path",
".",
"rsplit",
"(",
"'.'",
",",
"1",
")",
"except",
"ValueError",
":",
"raise",
"ImproperlyConfigured",
"... | https://github.com/danirus/django-comments-xtd/blob/c2ec50226d219d98fe0faeae4e66e8a676b47e5b/django_comments_xtd/compat.py#L9-L32 | |
Komodo/KomodoEdit | 61edab75dce2bdb03943b387b0608ea36f548e8e | src/codeintel/bin/ciperf.py | python | perf_python_scan | (dbpath) | Time scanning and loading a "real world" Python script into the CIDB.
To run this time test:
ciperf -f perf.db -t python_scan | Time scanning and loading a "real world" Python script into the CIDB.
To run this time test:
ciperf -f perf.db -t python_scan | [
"Time",
"scanning",
"and",
"loading",
"a",
"real",
"world",
"Python",
"script",
"into",
"the",
"CIDB",
".",
"To",
"run",
"this",
"time",
"test",
":",
"ciperf",
"-",
"f",
"perf",
".",
"db",
"-",
"t",
"python_scan"
] | def perf_python_scan(dbpath):
"""Time scanning and loading a "real world" Python script into the CIDB.
To run this time test:
ciperf -f perf.db -t python_scan
"""
import which
import codeintel
import threading
# Some real-world examples
scripts = glob.glob(os.path.join(... | [
"def",
"perf_python_scan",
"(",
"dbpath",
")",
":",
"import",
"which",
"import",
"codeintel",
"import",
"threading",
"# Some real-world examples",
"scripts",
"=",
"glob",
".",
"glob",
"(",
"os",
".",
"path",
".",
"join",
"(",
"g_corpus_dir",
",",
"\"*.py\"",
"... | https://github.com/Komodo/KomodoEdit/blob/61edab75dce2bdb03943b387b0608ea36f548e8e/src/codeintel/bin/ciperf.py#L360-L395 | ||
caiiiac/Machine-Learning-with-Python | 1a26c4467da41ca4ebc3d5bd789ea942ef79422f | MachineLearning/venv/lib/python3.5/site-packages/numpy/ma/core.py | python | MaskedArray.dot | (self, b, out=None, strict=False) | return dot(self, b, out=out, strict=strict) | a.dot(b, out=None)
Masked dot product of two arrays. Note that `out` and `strict` are
located in different positions than in `ma.dot`. In order to
maintain compatibility with the functional version, it is
recommended that the optional arguments be treated as keyword only.
At som... | a.dot(b, out=None) | [
"a",
".",
"dot",
"(",
"b",
"out",
"=",
"None",
")"
] | def dot(self, b, out=None, strict=False):
"""
a.dot(b, out=None)
Masked dot product of two arrays. Note that `out` and `strict` are
located in different positions than in `ma.dot`. In order to
maintain compatibility with the functional version, it is
recommended that the... | [
"def",
"dot",
"(",
"self",
",",
"b",
",",
"out",
"=",
"None",
",",
"strict",
"=",
"False",
")",
":",
"return",
"dot",
"(",
"self",
",",
"b",
",",
"out",
"=",
"out",
",",
"strict",
"=",
"strict",
")"
] | https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/numpy/ma/core.py#L4827-L4864 | |
triaquae/triaquae | bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9 | TriAquae/models/django/templatetags/i18n.py | python | language | (parser, token) | return LanguageNode(nodelist, language) | This will enable the given language just for this block.
Usage::
{% language "de" %}
This is {{ bar }} and {{ boo }}.
{% endlanguage %} | This will enable the given language just for this block. | [
"This",
"will",
"enable",
"the",
"given",
"language",
"just",
"for",
"this",
"block",
"."
] | def language(parser, token):
"""
This will enable the given language just for this block.
Usage::
{% language "de" %}
This is {{ bar }} and {{ boo }}.
{% endlanguage %}
"""
bits = token.split_contents()
if len(bits) != 2:
raise TemplateSyntaxError("'%s' tak... | [
"def",
"language",
"(",
"parser",
",",
"token",
")",
":",
"bits",
"=",
"token",
".",
"split_contents",
"(",
")",
"if",
"len",
"(",
"bits",
")",
"!=",
"2",
":",
"raise",
"TemplateSyntaxError",
"(",
"\"'%s' takes one argument (language)\"",
"%",
"bits",
"[",
... | https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/django/templatetags/i18n.py#L462-L479 | |
mpenning/ciscoconfparse | a6a176e6ceac7c5f3e974272fa70273476ba84a3 | ciscoconfparse/models_junos.py | python | BaseJunosIntfLine.port | (self) | return self.ordinal_list[-1] | r"""Return the interface's port number
Returns:
- int. The interface number.
This example illustrates use of the method.
.. code-block:: python
:emphasize-lines: 17,20
>>> config = [
... '!',
... 'interface FastEthernet1/0',
... | r"""Return the interface's port number | [
"r",
"Return",
"the",
"interface",
"s",
"port",
"number"
] | def port(self):
r"""Return the interface's port number
Returns:
- int. The interface number.
This example illustrates use of the method.
.. code-block:: python
:emphasize-lines: 17,20
>>> config = [
... '!',
... 'interf... | [
"def",
"port",
"(",
"self",
")",
":",
"return",
"self",
".",
"ordinal_list",
"[",
"-",
"1",
"]"
] | https://github.com/mpenning/ciscoconfparse/blob/a6a176e6ceac7c5f3e974272fa70273476ba84a3/ciscoconfparse/models_junos.py#L403-L437 | |
securityclippy/elasticintel | aa08d3e9f5ab1c000128e95161139ce97ff0e334 | ingest_feed_lambda/numpy/ma/core.py | python | ndim | (obj) | return np.ndim(getdata(obj)) | maskedarray version of the numpy function. | maskedarray version of the numpy function. | [
"maskedarray",
"version",
"of",
"the",
"numpy",
"function",
"."
] | def ndim(obj):
"""
maskedarray version of the numpy function.
"""
return np.ndim(getdata(obj)) | [
"def",
"ndim",
"(",
"obj",
")",
":",
"return",
"np",
".",
"ndim",
"(",
"getdata",
"(",
"obj",
")",
")"
] | https://github.com/securityclippy/elasticintel/blob/aa08d3e9f5ab1c000128e95161139ce97ff0e334/ingest_feed_lambda/numpy/ma/core.py#L7029-L7034 | |
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/Xenotix Python Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/SimpleHTTPServer.py | python | SimpleHTTPRequestHandler.translate_path | (self, path) | return path | Translate a /-separated PATH to the local filename syntax.
Components that mean special things to the local file system
(e.g. drive or directory names) are ignored. (XXX They should
probably be diagnosed.) | Translate a /-separated PATH to the local filename syntax. | [
"Translate",
"a",
"/",
"-",
"separated",
"PATH",
"to",
"the",
"local",
"filename",
"syntax",
"."
] | def translate_path(self, path):
"""Translate a /-separated PATH to the local filename syntax.
Components that mean special things to the local file system
(e.g. drive or directory names) are ignored. (XXX They should
probably be diagnosed.)
"""
# abandon query paramete... | [
"def",
"translate_path",
"(",
"self",
",",
"path",
")",
":",
"# abandon query parameters",
"path",
"=",
"path",
".",
"split",
"(",
"'?'",
",",
"1",
")",
"[",
"0",
"]",
"path",
"=",
"path",
".",
"split",
"(",
"'#'",
",",
"1",
")",
"[",
"0",
"]",
"... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/SimpleHTTPServer.py#L141-L161 | |
getsentry/sentry | 83b1f25aac3e08075e0e2495bc29efaf35aca18a | src/sentry/web/frontend/auth_login.py | python | AdditionalContext.add_callback | (self, callback) | callback should take a request object and return a dict of key-value pairs
to add to the context. | callback should take a request object and return a dict of key-value pairs
to add to the context. | [
"callback",
"should",
"take",
"a",
"request",
"object",
"and",
"return",
"a",
"dict",
"of",
"key",
"-",
"value",
"pairs",
"to",
"add",
"to",
"the",
"context",
"."
] | def add_callback(self, callback):
"""callback should take a request object and return a dict of key-value pairs
to add to the context."""
self._callbacks.add(callback) | [
"def",
"add_callback",
"(",
"self",
",",
"callback",
")",
":",
"self",
".",
"_callbacks",
".",
"add",
"(",
"callback",
")"
] | https://github.com/getsentry/sentry/blob/83b1f25aac3e08075e0e2495bc29efaf35aca18a/src/sentry/web/frontend/auth_login.py#L41-L44 | ||
kivy/plyer | 7a71707bdf99979cdacf2240d823aefa13d18f00 | plyer/tools/pep8checker/pep8.py | python | StyleGuide.get_checks | (self, argument_name) | return sorted(checks) | Find all globally visible functions where the first argument name
starts with argument_name and which contain selected tests. | Find all globally visible functions where the first argument name
starts with argument_name and which contain selected tests. | [
"Find",
"all",
"globally",
"visible",
"functions",
"where",
"the",
"first",
"argument",
"name",
"starts",
"with",
"argument_name",
"and",
"which",
"contain",
"selected",
"tests",
"."
] | def get_checks(self, argument_name):
"""
Find all globally visible functions where the first argument name
starts with argument_name and which contain selected tests.
"""
checks = []
for name, codes, function, args in find_checks(argument_name):
if any(not (co... | [
"def",
"get_checks",
"(",
"self",
",",
"argument_name",
")",
":",
"checks",
"=",
"[",
"]",
"for",
"name",
",",
"codes",
",",
"function",
",",
"args",
"in",
"find_checks",
"(",
"argument_name",
")",
":",
"if",
"any",
"(",
"not",
"(",
"code",
"and",
"s... | https://github.com/kivy/plyer/blob/7a71707bdf99979cdacf2240d823aefa13d18f00/plyer/tools/pep8checker/pep8.py#L1661-L1670 | |
pydicom/pydicom | 935de3b4ac94a5f520f3c91b42220ff0f13bce54 | pydicom/encoders/base.py | python | Encoder._encode_array | (
self,
arr: "numpy.ndarray",
idx: Optional[int] = None,
encoding_plugin: str = '',
**kwargs: Any,
) | return self._process(src, encoding_plugin, **kwargs) | Return a single encoded frame from `arr`. | Return a single encoded frame from `arr`. | [
"Return",
"a",
"single",
"encoded",
"frame",
"from",
"arr",
"."
] | def _encode_array(
self,
arr: "numpy.ndarray",
idx: Optional[int] = None,
encoding_plugin: str = '',
**kwargs: Any,
) -> bytes:
"""Return a single encoded frame from `arr`."""
self._check_kwargs(kwargs)
if len(arr.shape) > 4:
raise ValueEr... | [
"def",
"_encode_array",
"(",
"self",
",",
"arr",
":",
"\"numpy.ndarray\"",
",",
"idx",
":",
"Optional",
"[",
"int",
"]",
"=",
"None",
",",
"encoding_plugin",
":",
"str",
"=",
"''",
",",
"*",
"*",
"kwargs",
":",
"Any",
",",
")",
"->",
"bytes",
":",
... | https://github.com/pydicom/pydicom/blob/935de3b4ac94a5f520f3c91b42220ff0f13bce54/pydicom/encoders/base.py#L200-L222 | |
getsentry/sentry | 83b1f25aac3e08075e0e2495bc29efaf35aca18a | src/social_auth/utils.py | python | dsa_urlopen | (*args, **kwargs) | return urlopen(*args, **kwargs) | Like urllib2.urlopen but sets a timeout defined by
SOCIAL_AUTH_URLOPEN_TIMEOUT setting if defined (and not already in
kwargs). | Like urllib2.urlopen but sets a timeout defined by
SOCIAL_AUTH_URLOPEN_TIMEOUT setting if defined (and not already in
kwargs). | [
"Like",
"urllib2",
".",
"urlopen",
"but",
"sets",
"a",
"timeout",
"defined",
"by",
"SOCIAL_AUTH_URLOPEN_TIMEOUT",
"setting",
"if",
"defined",
"(",
"and",
"not",
"already",
"in",
"kwargs",
")",
"."
] | def dsa_urlopen(*args, **kwargs):
"""Like urllib2.urlopen but sets a timeout defined by
SOCIAL_AUTH_URLOPEN_TIMEOUT setting if defined (and not already in
kwargs)."""
timeout = setting("SOCIAL_AUTH_URLOPEN_TIMEOUT")
if timeout and "timeout" not in kwargs:
kwargs["timeout"] = timeout
retu... | [
"def",
"dsa_urlopen",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"timeout",
"=",
"setting",
"(",
"\"SOCIAL_AUTH_URLOPEN_TIMEOUT\"",
")",
"if",
"timeout",
"and",
"\"timeout\"",
"not",
"in",
"kwargs",
":",
"kwargs",
"[",
"\"timeout\"",
"]",
"=",
"t... | https://github.com/getsentry/sentry/blob/83b1f25aac3e08075e0e2495bc29efaf35aca18a/src/social_auth/utils.py#L112-L119 | |
VirtueSecurity/aws-extender | d123b7e1a845847709ba3a481f11996bddc68a1c | BappModules/boto/awslambda/layer1.py | python | AWSLambdaConnection.upload_function | (self, function_name, function_zip, runtime, role,
handler, mode, description=None, timeout=None,
memory_size=None) | return self.make_request('PUT', uri, expected_status=201,
data=function_zip, headers=headers,
params=query_params) | Creates a new Lambda function or updates an existing function.
The function metadata is created from the request parameters,
and the code for the function is provided by a .zip file in
the request body. If the function name already exists, the
existing Lambda function is updated with the... | Creates a new Lambda function or updates an existing function.
The function metadata is created from the request parameters,
and the code for the function is provided by a .zip file in
the request body. If the function name already exists, the
existing Lambda function is updated with the... | [
"Creates",
"a",
"new",
"Lambda",
"function",
"or",
"updates",
"an",
"existing",
"function",
".",
"The",
"function",
"metadata",
"is",
"created",
"from",
"the",
"request",
"parameters",
"and",
"the",
"code",
"for",
"the",
"function",
"is",
"provided",
"by",
"... | def upload_function(self, function_name, function_zip, runtime, role,
handler, mode, description=None, timeout=None,
memory_size=None):
"""
Creates a new Lambda function or updates an existing function.
The function metadata is created from the req... | [
"def",
"upload_function",
"(",
"self",
",",
"function_name",
",",
"function_zip",
",",
"runtime",
",",
"role",
",",
"handler",
",",
"mode",
",",
"description",
"=",
"None",
",",
"timeout",
"=",
"None",
",",
"memory_size",
"=",
"None",
")",
":",
"uri",
"=... | https://github.com/VirtueSecurity/aws-extender/blob/d123b7e1a845847709ba3a481f11996bddc68a1c/BappModules/boto/awslambda/layer1.py#L405-L501 | |
AstroPrint/AstroBox | e7e3b8a7d33ea85fcb6b2696869c0d719ceb8b75 | src/octoprint/timelapse.py | python | Timelapse.captureImage | (self) | return filename | [] | def captureImage(self):
if self._captureDir is None:
self._logger.warn("Cannot capture image, capture directory is unset")
return
with self._captureMutex:
filename = os.path.join(self._captureDir, "tmp_%05d.jpg" % (self._imageNumber))
self._imageNumber += 1
self._logger.debug("Capturing image to %s" ... | [
"def",
"captureImage",
"(",
"self",
")",
":",
"if",
"self",
".",
"_captureDir",
"is",
"None",
":",
"self",
".",
"_logger",
".",
"warn",
"(",
"\"Cannot capture image, capture directory is unset\"",
")",
"return",
"with",
"self",
".",
"_captureMutex",
":",
"filena... | https://github.com/AstroPrint/AstroBox/blob/e7e3b8a7d33ea85fcb6b2696869c0d719ceb8b75/src/octoprint/timelapse.py#L225-L237 | |||
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/graph_objs/_heatmapgl.py | python | Heatmapgl.customdatasrc | (self) | return self["customdatasrc"] | Sets the source reference on Chart Studio Cloud for
`customdata`.
The 'customdatasrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str | Sets the source reference on Chart Studio Cloud for
`customdata`.
The 'customdatasrc' property must be specified as a string or
as a plotly.grid_objs.Column object | [
"Sets",
"the",
"source",
"reference",
"on",
"Chart",
"Studio",
"Cloud",
"for",
"customdata",
".",
"The",
"customdatasrc",
"property",
"must",
"be",
"specified",
"as",
"a",
"string",
"or",
"as",
"a",
"plotly",
".",
"grid_objs",
".",
"Column",
"object"
] | def customdatasrc(self):
"""
Sets the source reference on Chart Studio Cloud for
`customdata`.
The 'customdatasrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["cust... | [
"def",
"customdatasrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"customdatasrc\"",
"]"
] | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/_heatmapgl.py#L450-L462 | |
caiiiac/Machine-Learning-with-Python | 1a26c4467da41ca4ebc3d5bd789ea942ef79422f | MachineLearning/venv/lib/python3.5/site-packages/numpy/lib/recfunctions.py | python | get_fieldstructure | (adtype, lastname=None, parents=None,) | return parents or None | Returns a dictionary with fields indexing lists of their parent fields.
This function is used to simplify access to fields nested in other fields.
Parameters
----------
adtype : np.dtype
Input datatype
lastname : optional
Last processed field name (used internally during recursion)... | Returns a dictionary with fields indexing lists of their parent fields. | [
"Returns",
"a",
"dictionary",
"with",
"fields",
"indexing",
"lists",
"of",
"their",
"parent",
"fields",
"."
] | def get_fieldstructure(adtype, lastname=None, parents=None,):
"""
Returns a dictionary with fields indexing lists of their parent fields.
This function is used to simplify access to fields nested in other fields.
Parameters
----------
adtype : np.dtype
Input datatype
lastname : opt... | [
"def",
"get_fieldstructure",
"(",
"adtype",
",",
"lastname",
"=",
"None",
",",
"parents",
"=",
"None",
",",
")",
":",
"if",
"parents",
"is",
"None",
":",
"parents",
"=",
"{",
"}",
"names",
"=",
"adtype",
".",
"names",
"for",
"name",
"in",
"names",
":... | https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/numpy/lib/recfunctions.py#L187-L231 | |
midgetspy/Sick-Beard | 171a607e41b7347a74cc815f6ecce7968d9acccf | lib/simplejson/__init__.py | python | dumps | (obj, skipkeys=False, ensure_ascii=True, check_circular=True,
allow_nan=True, cls=None, indent=None, separators=None,
encoding='utf-8', default=None, **kw) | return cls(
skipkeys=skipkeys, ensure_ascii=ensure_ascii,
check_circular=check_circular, allow_nan=allow_nan, indent=indent,
separators=separators, encoding=encoding, default=default,
**kw).encode(obj) | Serialize ``obj`` to a JSON formatted ``str``.
If ``skipkeys`` is false then ``dict`` keys that are not basic types
(``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``)
will be skipped instead of raising a ``TypeError``.
If ``ensure_ascii`` is false, then the return value will be a... | Serialize ``obj`` to a JSON formatted ``str``. | [
"Serialize",
"obj",
"to",
"a",
"JSON",
"formatted",
"str",
"."
] | def dumps(obj, skipkeys=False, ensure_ascii=True, check_circular=True,
allow_nan=True, cls=None, indent=None, separators=None,
encoding='utf-8', default=None, **kw):
"""Serialize ``obj`` to a JSON formatted ``str``.
If ``skipkeys`` is false then ``dict`` keys that are not basic types
(``str... | [
"def",
"dumps",
"(",
"obj",
",",
"skipkeys",
"=",
"False",
",",
"ensure_ascii",
"=",
"True",
",",
"check_circular",
"=",
"True",
",",
"allow_nan",
"=",
"True",
",",
"cls",
"=",
"None",
",",
"indent",
"=",
"None",
",",
"separators",
"=",
"None",
",",
... | https://github.com/midgetspy/Sick-Beard/blob/171a607e41b7347a74cc815f6ecce7968d9acccf/lib/simplejson/__init__.py#L184-L237 | |
liaopeiyuan/ml-arsenal-public | f8938ce3cb58b35fc7cc20d096c39a85ec9780b2 | projects/Doodle/earhian/models/modelZoo/resnet.py | python | resnet18 | (pretrained=False, **kwargs) | return model | Constructs a ResNet-18 model.
Args:
pretrained (bool): If True, returns a model pre-trained on ImageNet | Constructs a ResNet-18 model. | [
"Constructs",
"a",
"ResNet",
"-",
"18",
"model",
"."
] | def resnet18(pretrained=False, **kwargs):
"""Constructs a ResNet-18 model.
Args:
pretrained (bool): If True, returns a model pre-trained on ImageNet
"""
model = ResNet(BasicBlock, [2, 2, 2, 2], **kwargs)
if pretrained:
model.load_state_dict(model_zoo.load_url(model_urls['resnet18'])... | [
"def",
"resnet18",
"(",
"pretrained",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"model",
"=",
"ResNet",
"(",
"BasicBlock",
",",
"[",
"2",
",",
"2",
",",
"2",
",",
"2",
"]",
",",
"*",
"*",
"kwargs",
")",
"if",
"pretrained",
":",
"model",
... | https://github.com/liaopeiyuan/ml-arsenal-public/blob/f8938ce3cb58b35fc7cc20d096c39a85ec9780b2/projects/Doodle/earhian/models/modelZoo/resnet.py#L153-L162 | |
aio-libs/aiohttp | f68304d78a586af9cfca07aef4998c2477c4bb9d | aiohttp/web_request.py | python | BaseRequest.raw_path | (self) | return self._message.path | The URL including raw *PATH INFO* without the host or scheme.
Warning, the path is unquoted and may contains non valid URL characters
E.g., ``/my%2Fpath%7Cwith%21some%25strange%24characters`` | The URL including raw *PATH INFO* without the host or scheme. | [
"The",
"URL",
"including",
"raw",
"*",
"PATH",
"INFO",
"*",
"without",
"the",
"host",
"or",
"scheme",
"."
] | def raw_path(self) -> str:
"""The URL including raw *PATH INFO* without the host or scheme.
Warning, the path is unquoted and may contains non valid URL characters
E.g., ``/my%2Fpath%7Cwith%21some%25strange%24characters``
"""
return self._message.path | [
"def",
"raw_path",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_message",
".",
"path"
] | https://github.com/aio-libs/aiohttp/blob/f68304d78a586af9cfca07aef4998c2477c4bb9d/aiohttp/web_request.py#L461-L468 | |
tz28/deep-learning | 9baa081a487aac1e9dceb15b9a1a0ed73608280a | deep_neural_network_ng.py | python | relu_backward | (dA, cache) | return dZ | Implement the backward propagation for a single RELU unit.
Arguments:
dA -- post-activation gradient, of any shape
cache -- 'Z' where we store for computing backward propagation efficiently
Returns:
dZ -- Gradient of the cost with respect to Z | Implement the backward propagation for a single RELU unit. | [
"Implement",
"the",
"backward",
"propagation",
"for",
"a",
"single",
"RELU",
"unit",
"."
] | def relu_backward(dA, cache):
"""
Implement the backward propagation for a single RELU unit.
Arguments:
dA -- post-activation gradient, of any shape
cache -- 'Z' where we store for computing backward propagation efficiently
Returns:
dZ -- Gradient of the cost with respect to Z
"""
Z = cache
dZ = dA * np.int... | [
"def",
"relu_backward",
"(",
"dA",
",",
"cache",
")",
":",
"Z",
"=",
"cache",
"dZ",
"=",
"dA",
"*",
"np",
".",
"int64",
"(",
"Z",
">",
"0",
")",
"#",
"return",
"dZ"
] | https://github.com/tz28/deep-learning/blob/9baa081a487aac1e9dceb15b9a1a0ed73608280a/deep_neural_network_ng.py#L143-L156 | |
SheffieldML/GPy | bb1bc5088671f9316bc92a46d356734e34c2d5c0 | GPy/plotting/matplot_dep/visualize.py | python | lvm.on_click | (self, event) | [] | def on_click(self, event):
if event.inaxes!=self.latent_axes: return
if self.disable_drag:
self.move_on = True
self.called = True
self.on_move(event)
else:
self.move_on = not self.move_on
self.called = True | [
"def",
"on_click",
"(",
"self",
",",
"event",
")",
":",
"if",
"event",
".",
"inaxes",
"!=",
"self",
".",
"latent_axes",
":",
"return",
"if",
"self",
".",
"disable_drag",
":",
"self",
".",
"move_on",
"=",
"True",
"self",
".",
"called",
"=",
"True",
"s... | https://github.com/SheffieldML/GPy/blob/bb1bc5088671f9316bc92a46d356734e34c2d5c0/GPy/plotting/matplot_dep/visualize.py#L150-L158 | ||||
pyinvoke/invoke | 45dc9d03639dac5b6d1445831bf270e686ef88b4 | invoke/runners.py | python | Runner.start | (self, command, shell, env) | Initiate execution of ``command`` (via ``shell``, with ``env``).
Typically this means use of a forked subprocess or requesting start of
execution on a remote system.
In most cases, this method will also set subclass-specific member
variables used in other methods such as `wait` and/or ... | Initiate execution of ``command`` (via ``shell``, with ``env``). | [
"Initiate",
"execution",
"of",
"command",
"(",
"via",
"shell",
"with",
"env",
")",
"."
] | def start(self, command, shell, env):
"""
Initiate execution of ``command`` (via ``shell``, with ``env``).
Typically this means use of a forked subprocess or requesting start of
execution on a remote system.
In most cases, this method will also set subclass-specific member
... | [
"def",
"start",
"(",
"self",
",",
"command",
",",
"shell",
",",
"env",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/pyinvoke/invoke/blob/45dc9d03639dac5b6d1445831bf270e686ef88b4/invoke/runners.py#L1008-L1029 | ||
PaddlePaddle/PaddleHub | 107ee7e1a49d15e9c94da3956475d88a53fc165f | modules/text/text_generation/plato2_en_large/models/model_base.py | python | Model._get_feed | (self, inputs, is_infer=False) | return inputs | Convert `inputs` into model's feed data format. | Convert `inputs` into model's feed data format. | [
"Convert",
"inputs",
"into",
"model",
"s",
"feed",
"data",
"format",
"."
] | def _get_feed(self, inputs, is_infer=False):
"""
Convert `inputs` into model's feed data format.
"""
if isinstance(inputs, list):
# return list direclty which is used in `get_data_loader`.
return inputs
for k in inputs:
if isinstance(inputs[k],... | [
"def",
"_get_feed",
"(",
"self",
",",
"inputs",
",",
"is_infer",
"=",
"False",
")",
":",
"if",
"isinstance",
"(",
"inputs",
",",
"list",
")",
":",
"# return list direclty which is used in `get_data_loader`.",
"return",
"inputs",
"for",
"k",
"in",
"inputs",
":",
... | https://github.com/PaddlePaddle/PaddleHub/blob/107ee7e1a49d15e9c94da3956475d88a53fc165f/modules/text/text_generation/plato2_en_large/models/model_base.py#L170-L180 | |
KalleHallden/AutoTimer | 2d954216700c4930baa154e28dbddc34609af7ce | env/lib/python2.7/site-packages/pip/_internal/download.py | python | MultiDomainBasicAuth._get_new_credentials | (self, original_url, allow_netrc=True,
allow_keyring=True) | return username, password | Find and return credentials for the specified URL. | Find and return credentials for the specified URL. | [
"Find",
"and",
"return",
"credentials",
"for",
"the",
"specified",
"URL",
"."
] | def _get_new_credentials(self, original_url, allow_netrc=True,
allow_keyring=True):
"""Find and return credentials for the specified URL."""
# Split the credentials and netloc from the url.
url, netloc, url_user_password = split_auth_netloc_from_url(
orig... | [
"def",
"_get_new_credentials",
"(",
"self",
",",
"original_url",
",",
"allow_netrc",
"=",
"True",
",",
"allow_keyring",
"=",
"True",
")",
":",
"# Split the credentials and netloc from the url.",
"url",
",",
"netloc",
",",
"url_user_password",
"=",
"split_auth_netloc_fro... | https://github.com/KalleHallden/AutoTimer/blob/2d954216700c4930baa154e28dbddc34609af7ce/env/lib/python2.7/site-packages/pip/_internal/download.py#L253-L298 | |
sabri-zaki/EasY_HaCk | 2a39ac384dd0d6fc51c0dd22e8d38cece683fdb9 | .modules/.sqlmap/lib/parse/configfile.py | python | configFileParser | (configFile) | Parse configuration file and save settings into the configuration
advanced dictionary. | Parse configuration file and save settings into the configuration
advanced dictionary. | [
"Parse",
"configuration",
"file",
"and",
"save",
"settings",
"into",
"the",
"configuration",
"advanced",
"dictionary",
"."
] | def configFileParser(configFile):
"""
Parse configuration file and save settings into the configuration
advanced dictionary.
"""
global config
debugMsg = "parsing configuration file"
logger.debug(debugMsg)
checkFile(configFile)
configFP = openFile(configFile, "rb")
try:
... | [
"def",
"configFileParser",
"(",
"configFile",
")",
":",
"global",
"config",
"debugMsg",
"=",
"\"parsing configuration file\"",
"logger",
".",
"debug",
"(",
"debugMsg",
")",
"checkFile",
"(",
"configFile",
")",
"configFP",
"=",
"openFile",
"(",
"configFile",
",",
... | https://github.com/sabri-zaki/EasY_HaCk/blob/2a39ac384dd0d6fc51c0dd22e8d38cece683fdb9/.modules/.sqlmap/lib/parse/configfile.py#L57-L97 | ||
ansible-community/ansible-lint | be43b50f17f829e40845a53d0be4d4ccb2cc1728 | src/ansiblelint/runner.py | python | Runner.__init__ | (
self,
*lintables: Union[Lintable, str],
rules: "RulesCollection",
tags: FrozenSet[Any] = frozenset(),
skip_list: List[str] = [],
exclude_paths: List[str] = [],
verbosity: int = 0,
checked_files: Optional[Set[Lintable]] = None
) | Initialize a Runner instance. | Initialize a Runner instance. | [
"Initialize",
"a",
"Runner",
"instance",
"."
] | def __init__(
self,
*lintables: Union[Lintable, str],
rules: "RulesCollection",
tags: FrozenSet[Any] = frozenset(),
skip_list: List[str] = [],
exclude_paths: List[str] = [],
verbosity: int = 0,
checked_files: Optional[Set[Lintable]] = None
) -> None:
... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"lintables",
":",
"Union",
"[",
"Lintable",
",",
"str",
"]",
",",
"rules",
":",
"\"RulesCollection\"",
",",
"tags",
":",
"FrozenSet",
"[",
"Any",
"]",
"=",
"frozenset",
"(",
")",
",",
"skip_list",
":",
"List",
... | https://github.com/ansible-community/ansible-lint/blob/be43b50f17f829e40845a53d0be4d4ccb2cc1728/src/ansiblelint/runner.py#L38-L67 | ||
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/lib-python/3/multiprocessing/managers.py | python | IteratorProxy.__next__ | (self, *args) | return self._callmethod('__next__', args) | [] | def __next__(self, *args):
return self._callmethod('__next__', args) | [
"def",
"__next__",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"self",
".",
"_callmethod",
"(",
"'__next__'",
",",
"args",
")"
] | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/multiprocessing/managers.py#L973-L974 | |||
PaddlePaddle/PaddleX | 2bab73f81ab54e328204e7871e6ae4a82e719f5d | paddlex/paddleseg/cvlibs/config.py | python | Config.train_dataset_class | (self) | return self._load_component(dataset_type) | [] | def train_dataset_class(self) -> Generic:
dataset_type = self.train_dataset_config['type']
return self._load_component(dataset_type) | [
"def",
"train_dataset_class",
"(",
"self",
")",
"->",
"Generic",
":",
"dataset_type",
"=",
"self",
".",
"train_dataset_config",
"[",
"'type'",
"]",
"return",
"self",
".",
"_load_component",
"(",
"dataset_type",
")"
] | https://github.com/PaddlePaddle/PaddleX/blob/2bab73f81ab54e328204e7871e6ae4a82e719f5d/paddlex/paddleseg/cvlibs/config.py#L294-L296 | |||
OpenXenManager/openxenmanager | 1cb5c1cb13358ba584856e99a94f9669d17670ff | src/OXM/window_host.py | python | oxcWindowHost.on_btjoindomain_clicked | (self, widget, data=None) | Press "Join Domain" on Users tab | Press "Join Domain" on Users tab | [
"Press",
"Join",
"Domain",
"on",
"Users",
"tab"
] | def on_btjoindomain_clicked(self, widget, data=None):
"""
Press "Join Domain" on Users tab
"""
pass | [
"def",
"on_btjoindomain_clicked",
"(",
"self",
",",
"widget",
",",
"data",
"=",
"None",
")",
":",
"pass"
] | https://github.com/OpenXenManager/openxenmanager/blob/1cb5c1cb13358ba584856e99a94f9669d17670ff/src/OXM/window_host.py#L41-L45 | ||
materialsproject/pymatgen | 8128f3062a334a2edd240e4062b5b9bdd1ae6f58 | pymatgen/io/abinit/abiobjects.py | python | SpinMode.as_spinmode | (cls, obj) | Converts obj into a `SpinMode` instance | Converts obj into a `SpinMode` instance | [
"Converts",
"obj",
"into",
"a",
"SpinMode",
"instance"
] | def as_spinmode(cls, obj):
"""Converts obj into a `SpinMode` instance"""
if isinstance(obj, cls):
return obj
# Assume a string with mode
try:
return _mode2spinvars[obj]
except KeyError:
raise KeyError("Wrong value for spin_mode: %s" % str(obj)... | [
"def",
"as_spinmode",
"(",
"cls",
",",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"cls",
")",
":",
"return",
"obj",
"# Assume a string with mode",
"try",
":",
"return",
"_mode2spinvars",
"[",
"obj",
"]",
"except",
"KeyError",
":",
"raise",
"KeyE... | https://github.com/materialsproject/pymatgen/blob/8128f3062a334a2edd240e4062b5b9bdd1ae6f58/pymatgen/io/abinit/abiobjects.py#L379-L388 | ||
XX-net/XX-Net | a9898cfcf0084195fb7e69b6bc834e59aecdf14f | python3.8.2/Lib/zipfile.py | python | ZipFile.setpassword | (self, pwd) | Set default password for encrypted files. | Set default password for encrypted files. | [
"Set",
"default",
"password",
"for",
"encrypted",
"files",
"."
] | def setpassword(self, pwd):
"""Set default password for encrypted files."""
if pwd and not isinstance(pwd, bytes):
raise TypeError("pwd: expected bytes, got %s" % type(pwd).__name__)
if pwd:
self.pwd = pwd
else:
self.pwd = None | [
"def",
"setpassword",
"(",
"self",
",",
"pwd",
")",
":",
"if",
"pwd",
"and",
"not",
"isinstance",
"(",
"pwd",
",",
"bytes",
")",
":",
"raise",
"TypeError",
"(",
"\"pwd: expected bytes, got %s\"",
"%",
"type",
"(",
"pwd",
")",
".",
"__name__",
")",
"if",
... | https://github.com/XX-net/XX-Net/blob/a9898cfcf0084195fb7e69b6bc834e59aecdf14f/python3.8.2/Lib/zipfile.py#L1446-L1453 | ||
ungarj/mapchete | dc085b4af4bd4101d342e3d08440e165d07f4070 | mapchete/commons/clip.py | python | clip_array_with_vector | (
array, array_affine, geometries, inverted=False, clip_buffer=0
) | Clip input array with a vector list.
Parameters
----------
array : array
input raster data
array_affine : Affine
Affine object describing the raster's geolocation
geometries : iterable
iterable of dictionaries, where every entry has a 'geometry' and
'properties' key.... | Clip input array with a vector list. | [
"Clip",
"input",
"array",
"with",
"a",
"vector",
"list",
"."
] | def clip_array_with_vector(
array, array_affine, geometries, inverted=False, clip_buffer=0
):
"""
Clip input array with a vector list.
Parameters
----------
array : array
input raster data
array_affine : Affine
Affine object describing the raster's geolocation
geometries... | [
"def",
"clip_array_with_vector",
"(",
"array",
",",
"array_affine",
",",
"geometries",
",",
"inverted",
"=",
"False",
",",
"clip_buffer",
"=",
"0",
")",
":",
"# buffer input geometries and clean up",
"buffered_geometries",
"=",
"[",
"]",
"for",
"feature",
"in",
"g... | https://github.com/ungarj/mapchete/blob/dc085b4af4bd4101d342e3d08440e165d07f4070/mapchete/commons/clip.py#L10-L70 | ||
deepmind/dm_control | 806a10e896e7c887635328bfa8352604ad0fedae | dm_control/suite/cheetah.py | python | Cheetah.get_observation | (self, physics) | return obs | Returns an observation of the state, ignoring horizontal position. | Returns an observation of the state, ignoring horizontal position. | [
"Returns",
"an",
"observation",
"of",
"the",
"state",
"ignoring",
"horizontal",
"position",
"."
] | def get_observation(self, physics):
"""Returns an observation of the state, ignoring horizontal position."""
obs = collections.OrderedDict()
# Ignores horizontal position to maintain translational invariance.
obs['position'] = physics.data.qpos[1:].copy()
obs['velocity'] = physics.velocity()
ret... | [
"def",
"get_observation",
"(",
"self",
",",
"physics",
")",
":",
"obs",
"=",
"collections",
".",
"OrderedDict",
"(",
")",
"# Ignores horizontal position to maintain translational invariance.",
"obs",
"[",
"'position'",
"]",
"=",
"physics",
".",
"data",
".",
"qpos",
... | https://github.com/deepmind/dm_control/blob/806a10e896e7c887635328bfa8352604ad0fedae/dm_control/suite/cheetah.py#L79-L85 | |
WikidPad/WikidPad | 558109638807bc76b4672922686e416ab2d5f79c | WikidPad/lib/whoosh/highlight.py | python | UppercaseFormatter.__init__ | (self, between="...") | :param between: the text to add between fragments. | :param between: the text to add between fragments. | [
":",
"param",
"between",
":",
"the",
"text",
"to",
"add",
"between",
"fragments",
"."
] | def __init__(self, between="..."):
"""
:param between: the text to add between fragments.
"""
self.between = between | [
"def",
"__init__",
"(",
"self",
",",
"between",
"=",
"\"...\"",
")",
":",
"self",
".",
"between",
"=",
"between"
] | https://github.com/WikidPad/WikidPad/blob/558109638807bc76b4672922686e416ab2d5f79c/WikidPad/lib/whoosh/highlight.py#L636-L641 | ||
novoic/surfboard | 700d1b26e80fbd06d2a9c682260e6c635d6c0d40 | surfboard/sound.py | python | Waveform.loudness_slidingwindow | (self, frame_length_seconds=1, hop_length_seconds=0.25) | Compute the loudness of self.waveform over time. See self.loudness for
more details.
Args:
frame_length_seconds (float): Length of the sliding window in seconds.
hop_length_seconds (float): How much the sliding window moves by
Returns:
[1, T / hop_length]: T... | Compute the loudness of self.waveform over time. See self.loudness for
more details. | [
"Compute",
"the",
"loudness",
"of",
"self",
".",
"waveform",
"over",
"time",
".",
"See",
"self",
".",
"loudness",
"for",
"more",
"details",
"."
] | def loudness_slidingwindow(self, frame_length_seconds=1, hop_length_seconds=0.25):
"""Compute the loudness of self.waveform over time. See self.loudness for
more details.
Args:
frame_length_seconds (float): Length of the sliding window in seconds.
hop_length_seconds (flo... | [
"def",
"loudness_slidingwindow",
"(",
"self",
",",
"frame_length_seconds",
"=",
"1",
",",
"hop_length_seconds",
"=",
"0.25",
")",
":",
"try",
":",
"return",
"get_loudness_slidingwindow",
"(",
"self",
".",
"waveform",
",",
"self",
".",
"sample_rate",
",",
"frame_... | https://github.com/novoic/surfboard/blob/700d1b26e80fbd06d2a9c682260e6c635d6c0d40/surfboard/sound.py#L442-L460 | ||
cylc/cylc-flow | 5ec221143476c7c616c156b74158edfbcd83794a | cylc/flow/parsec/validate.py | python | CylcConfigValidator.coerce_cycle_point_time_zone | (cls, value, keys) | return value | Coerce value to a cycle point time zone format.
Examples:
>>> CylcConfigValidator.coerce_cycle_point_time_zone(
... 'Z', None)
'Z'
>>> CylcConfigValidator.coerce_cycle_point_time_zone(
... '+13', None)
'+13'
>>> CylcCon... | Coerce value to a cycle point time zone format. | [
"Coerce",
"value",
"to",
"a",
"cycle",
"point",
"time",
"zone",
"format",
"."
] | def coerce_cycle_point_time_zone(cls, value, keys):
"""Coerce value to a cycle point time zone format.
Examples:
>>> CylcConfigValidator.coerce_cycle_point_time_zone(
... 'Z', None)
'Z'
>>> CylcConfigValidator.coerce_cycle_point_time_zone(
... | [
"def",
"coerce_cycle_point_time_zone",
"(",
"cls",
",",
"value",
",",
"keys",
")",
":",
"value",
"=",
"cls",
".",
"strip_and_unquote",
"(",
"keys",
",",
"value",
")",
"if",
"not",
"value",
":",
"return",
"None",
"test_timepoint",
"=",
"TimePoint",
"(",
"ye... | https://github.com/cylc/cylc-flow/blob/5ec221143476c7c616c156b74158edfbcd83794a/cylc/flow/parsec/validate.py#L792-L822 | |
IronLanguages/main | a949455434b1fda8c783289e897e78a9a0caabb5 | External.LCA_RESTRICTED/Languages/IronPython/27/Lib/quopri.py | python | decode | (input, output, header = 0) | Read 'input', apply quoted-printable decoding, and write to 'output'.
'input' and 'output' are files with readline() and write() methods.
If 'header' is true, decode underscore as space (per RFC 1522). | Read 'input', apply quoted-printable decoding, and write to 'output'.
'input' and 'output' are files with readline() and write() methods.
If 'header' is true, decode underscore as space (per RFC 1522). | [
"Read",
"input",
"apply",
"quoted",
"-",
"printable",
"decoding",
"and",
"write",
"to",
"output",
".",
"input",
"and",
"output",
"are",
"files",
"with",
"readline",
"()",
"and",
"write",
"()",
"methods",
".",
"If",
"header",
"is",
"true",
"decode",
"unders... | def decode(input, output, header = 0):
"""Read 'input', apply quoted-printable decoding, and write to 'output'.
'input' and 'output' are files with readline() and write() methods.
If 'header' is true, decode underscore as space (per RFC 1522)."""
if a2b_qp is not None:
data = input.read()
... | [
"def",
"decode",
"(",
"input",
",",
"output",
",",
"header",
"=",
"0",
")",
":",
"if",
"a2b_qp",
"is",
"not",
"None",
":",
"data",
"=",
"input",
".",
"read",
"(",
")",
"odata",
"=",
"a2b_qp",
"(",
"data",
",",
"header",
"=",
"header",
")",
"outpu... | https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/IronPython/27/Lib/quopri.py#L116-L157 | ||
cagbal/ros_people_object_detection_tensorflow | 982ffd4a54b8059638f5cd4aa167299c7fc9e61f | src/object_detection/utils/json_utils.py | python | Dumps | (obj, float_digits=-1, **params) | return output | Wrapper of json.dumps that allows specifying the float precision used.
Args:
obj: The object to dump.
float_digits: The number of digits of precision when writing floats out.
**params: Additional parameters to pass to json.dumps.
Returns:
output: JSON string representation of obj. | Wrapper of json.dumps that allows specifying the float precision used. | [
"Wrapper",
"of",
"json",
".",
"dumps",
"that",
"allows",
"specifying",
"the",
"float",
"precision",
"used",
"."
] | def Dumps(obj, float_digits=-1, **params):
"""Wrapper of json.dumps that allows specifying the float precision used.
Args:
obj: The object to dump.
float_digits: The number of digits of precision when writing floats out.
**params: Additional parameters to pass to json.dumps.
Returns:
output: JSO... | [
"def",
"Dumps",
"(",
"obj",
",",
"float_digits",
"=",
"-",
"1",
",",
"*",
"*",
"params",
")",
":",
"original_encoder",
"=",
"encoder",
".",
"FLOAT_REPR",
"original_c_make_encoder",
"=",
"encoder",
".",
"c_make_encoder",
"if",
"float_digits",
">=",
"0",
":",
... | https://github.com/cagbal/ros_people_object_detection_tensorflow/blob/982ffd4a54b8059638f5cd4aa167299c7fc9e61f/src/object_detection/utils/json_utils.py#L42-L64 | |
openmc-dev/openmc | 0cf7d9283786677e324bfbdd0984a54d1c86dacc | openmc/mgxs/mgxs.py | python | MGXS.build_hdf5_store | (self, filename='mgxs.h5', directory='mgxs',
subdomains='all', nuclides='all',
xs_type='macro', row_column='inout', append=True,
libver='earliest') | Export the multi-group cross section data to an HDF5 binary file.
This method constructs an HDF5 file which stores the multi-group
cross section data. The data is stored in a hierarchy of HDF5 groups
from the domain type, domain id, subdomain id (for distribcell domains),
nuclides and c... | Export the multi-group cross section data to an HDF5 binary file. | [
"Export",
"the",
"multi",
"-",
"group",
"cross",
"section",
"data",
"to",
"an",
"HDF5",
"binary",
"file",
"."
] | def build_hdf5_store(self, filename='mgxs.h5', directory='mgxs',
subdomains='all', nuclides='all',
xs_type='macro', row_column='inout', append=True,
libver='earliest'):
"""Export the multi-group cross section data to an HDF5 binary file.... | [
"def",
"build_hdf5_store",
"(",
"self",
",",
"filename",
"=",
"'mgxs.h5'",
",",
"directory",
"=",
"'mgxs'",
",",
"subdomains",
"=",
"'all'",
",",
"nuclides",
"=",
"'all'",
",",
"xs_type",
"=",
"'macro'",
",",
"row_column",
"=",
"'inout'",
",",
"append",
"=... | https://github.com/openmc-dev/openmc/blob/0cf7d9283786677e324bfbdd0984a54d1c86dacc/openmc/mgxs/mgxs.py#L1808-L1943 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.