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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
skyfielders/python-skyfield | 0e68757a5c1081f784c58fd7a76635c6deb98451 | skyfield/nutationlib.py | python | equation_of_the_equinoxes_complimentary_terms | (jd_tt) | return c_terms | Compute the complementary terms of the equation of the equinoxes.
`jd_tt` - Terrestrial Time: Julian date float, or NumPy array of floats | Compute the complementary terms of the equation of the equinoxes. | [
"Compute",
"the",
"complementary",
"terms",
"of",
"the",
"equation",
"of",
"the",
"equinoxes",
"."
] | def equation_of_the_equinoxes_complimentary_terms(jd_tt):
"""Compute the complementary terms of the equation of the equinoxes.
`jd_tt` - Terrestrial Time: Julian date float, or NumPy array of floats
"""
# Interval between fundamental epoch J2000.0 and current date.
t = (jd_tt - T0) / 36525.0
... | [
"def",
"equation_of_the_equinoxes_complimentary_terms",
"(",
"jd_tt",
")",
":",
"# Interval between fundamental epoch J2000.0 and current date.",
"t",
"=",
"(",
"jd_tt",
"-",
"T0",
")",
"/",
"36525.0",
"# Build array for intermediate results.",
"shape",
"=",
"getattr",
"(",
... | https://github.com/skyfielders/python-skyfield/blob/0e68757a5c1081f784c58fd7a76635c6deb98451/skyfield/nutationlib.py#L93-L183 | |
rgs1/zk_shell | ab4223c8f165a32b7f652932329b0880e43b9922 | zk_shell/shell.py | python | Shell.do_set_acls | (self, params) | \x1b[1mNAME\x1b[0m
set_acls - Sets ACLs for a given path
\x1b[1mSYNOPSIS\x1b[0m
set_acls <path> <acls> [recursive]
\x1b[1mOPTIONS\x1b[0m
* recursive: recursively set the acls on the children
\x1b[1mEXAMPLES\x1b[0m
> set_acls /some/path 'world:anyone:r digest:user:aRxISyaKnTP2+OZ9OmQLk... | \x1b[1mNAME\x1b[0m
set_acls - Sets ACLs for a given path | [
"\\",
"x1b",
"[",
"1mNAME",
"\\",
"x1b",
"[",
"0m",
"set_acls",
"-",
"Sets",
"ACLs",
"for",
"a",
"given",
"path"
] | def do_set_acls(self, params):
"""
\x1b[1mNAME\x1b[0m
set_acls - Sets ACLs for a given path
\x1b[1mSYNOPSIS\x1b[0m
set_acls <path> <acls> [recursive]
\x1b[1mOPTIONS\x1b[0m
* recursive: recursively set the acls on the children
\x1b[1mEXAMPLES\x1b[0m
> set_acls /some/path 'world... | [
"def",
"do_set_acls",
"(",
"self",
",",
"params",
")",
":",
"try",
":",
"acls",
"=",
"ACLReader",
".",
"extract",
"(",
"shlex",
".",
"split",
"(",
"params",
".",
"acls",
")",
")",
"except",
"ACLReader",
".",
"BadACL",
"as",
"ex",
":",
"self",
".",
... | https://github.com/rgs1/zk_shell/blob/ab4223c8f165a32b7f652932329b0880e43b9922/zk_shell/shell.py#L328-L361 | ||
mit-han-lab/once-for-all | 4f6fce3652ee4553ea811d38f32f90ac8b1bc378 | ofa/imagenet_classification/elastic_nn/modules/dynamic_layers.py | python | DynamicMBConvLayer.in_channels | (self) | return max(self.in_channel_list) | [] | def in_channels(self):
return max(self.in_channel_list) | [
"def",
"in_channels",
"(",
"self",
")",
":",
"return",
"max",
"(",
"self",
".",
"in_channel_list",
")"
] | https://github.com/mit-han-lab/once-for-all/blob/4f6fce3652ee4553ea811d38f32f90ac8b1bc378/ofa/imagenet_classification/elastic_nn/modules/dynamic_layers.py#L194-L195 | |||
gecko984/supervenn | 3a29b931a986ab1a80eed940f766b31c117a530d | supervenn/_algorithms.py | python | break_into_chunks | (sets) | return dict(chunks_dict) | Let us have a collection {S_1, ..., S_n} of finite sets and U be the union of all these sets.
For a given subset C = {i_1, ..., i_k} of indices {1, ..., n}, define the 'chunk', corresponding to C, as the set
of elements of U, that belong to S_i_1, ..., S_i_k, but not to any of the other sets.
For example, f... | Let us have a collection {S_1, ..., S_n} of finite sets and U be the union of all these sets.
For a given subset C = {i_1, ..., i_k} of indices {1, ..., n}, define the 'chunk', corresponding to C, as the set
of elements of U, that belong to S_i_1, ..., S_i_k, but not to any of the other sets.
For example, f... | [
"Let",
"us",
"have",
"a",
"collection",
"{",
"S_1",
"...",
"S_n",
"}",
"of",
"finite",
"sets",
"and",
"U",
"be",
"the",
"union",
"of",
"all",
"these",
"sets",
".",
"For",
"a",
"given",
"subset",
"C",
"=",
"{",
"i_1",
"...",
"i_k",
"}",
"of",
"ind... | def break_into_chunks(sets):
"""
Let us have a collection {S_1, ..., S_n} of finite sets and U be the union of all these sets.
For a given subset C = {i_1, ..., i_k} of indices {1, ..., n}, define the 'chunk', corresponding to C, as the set
of elements of U, that belong to S_i_1, ..., S_i_k, but not to ... | [
"def",
"break_into_chunks",
"(",
"sets",
")",
":",
"if",
"not",
"sets",
":",
"raise",
"ValueError",
"(",
"'Sets list is empty.'",
")",
"all_items",
"=",
"set",
".",
"union",
"(",
"*",
"sets",
")",
"if",
"not",
"all_items",
":",
"raise",
"ValueError",
"(",
... | https://github.com/gecko984/supervenn/blob/3a29b931a986ab1a80eed940f766b31c117a530d/supervenn/_algorithms.py#L162-L194 | |
araffin/robotics-rl-srl | eae7c1ab310c79662f6e68c0d255e08641037ffa | real_robots/omnirobot_utils/marker_finder.py | python | MakerFinder.setMarkerCode | (self, marker_id, marker_code, real_length) | TODO
:param marker_id:
:param marker_code:
:param real_length: (int)
:return: | TODO
:param marker_id:
:param marker_code:
:param real_length: (int)
:return: | [
"TODO",
":",
"param",
"marker_id",
":",
":",
"param",
"marker_code",
":",
":",
"param",
"real_length",
":",
"(",
"int",
")",
":",
"return",
":"
] | def setMarkerCode(self, marker_id, marker_code, real_length):
"""
TODO
:param marker_id:
:param marker_code:
:param real_length: (int)
:return:
"""
self.marker_code[marker_id] = np.zeros((4, marker_code.shape[0], marker_code.shape[1]))
sel... | [
"def",
"setMarkerCode",
"(",
"self",
",",
"marker_id",
",",
"marker_code",
",",
"real_length",
")",
":",
"self",
".",
"marker_code",
"[",
"marker_id",
"]",
"=",
"np",
".",
"zeros",
"(",
"(",
"4",
",",
"marker_code",
".",
"shape",
"[",
"0",
"]",
",",
... | https://github.com/araffin/robotics-rl-srl/blob/eae7c1ab310c79662f6e68c0d255e08641037ffa/real_robots/omnirobot_utils/marker_finder.py#L52-L71 | ||
openhatch/oh-mainline | ce29352a034e1223141dcc2f317030bbc3359a51 | vendor/packages/whoosh/src/whoosh/sorting.py | python | Facets.add_query | (self, name, querydict, **kwargs) | return self | Adds a :class:`QueryFacet` under the given ``name``.
:param name: a name for the facet.
:param querydict: a dictionary mapping keys to
:class:`whoosh.query.Query` objects. | Adds a :class:`QueryFacet` under the given ``name``.
:param name: a name for the facet.
:param querydict: a dictionary mapping keys to
:class:`whoosh.query.Query` objects. | [
"Adds",
"a",
":",
"class",
":",
"QueryFacet",
"under",
"the",
"given",
"name",
".",
":",
"param",
"name",
":",
"a",
"name",
"for",
"the",
"facet",
".",
":",
"param",
"querydict",
":",
"a",
"dictionary",
"mapping",
"keys",
"to",
":",
"class",
":",
"wh... | def add_query(self, name, querydict, **kwargs):
"""Adds a :class:`QueryFacet` under the given ``name``.
:param name: a name for the facet.
:param querydict: a dictionary mapping keys to
:class:`whoosh.query.Query` objects.
"""
self.facets[name] = QueryFacet(... | [
"def",
"add_query",
"(",
"self",
",",
"name",
",",
"querydict",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"facets",
"[",
"name",
"]",
"=",
"QueryFacet",
"(",
"querydict",
",",
"*",
"*",
"kwargs",
")",
"return",
"self"
] | https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/whoosh/src/whoosh/sorting.py#L781-L790 | |
openai/jukebox | 08efbbc1d4ed1a3cef96e08a931944c8b4d63bb3 | tensorboardX/tensorboardX/caffe2_graph.py | python | _filter_ops | (ops, filter_fn, perform_filter) | return new_ops | Filter unwanted operators based on criteria in 'filter_fn'.
Args:
ops: List of Caffe2 operators to filter
filter_fn: Criteria function for whether inputs/outputs in an operator
should be filtered.
perform_filter: Boolean passed from _operators_to_graph_def specifying
... | Filter unwanted operators based on criteria in 'filter_fn'. | [
"Filter",
"unwanted",
"operators",
"based",
"on",
"criteria",
"in",
"filter_fn",
"."
] | def _filter_ops(ops, filter_fn, perform_filter):
'''
Filter unwanted operators based on criteria in 'filter_fn'.
Args:
ops: List of Caffe2 operators to filter
filter_fn: Criteria function for whether inputs/outputs in an operator
should be filtered.
perform_filter: Boole... | [
"def",
"_filter_ops",
"(",
"ops",
",",
"filter_fn",
",",
"perform_filter",
")",
":",
"if",
"not",
"perform_filter",
":",
"return",
"ops",
"new_ops",
"=",
"[",
"]",
"for",
"op",
"in",
"ops",
":",
"inputs",
"=",
"list",
"(",
"op",
".",
"input",
")",
"o... | https://github.com/openai/jukebox/blob/08efbbc1d4ed1a3cef96e08a931944c8b4d63bb3/tensorboardX/tensorboardX/caffe2_graph.py#L593-L625 | |
IronLanguages/main | a949455434b1fda8c783289e897e78a9a0caabb5 | External.LCA_RESTRICTED/Languages/CPython/27/Lib/wsgiref/util.py | python | guess_scheme | (environ) | Return a guess for whether 'wsgi.url_scheme' should be 'http' or 'https' | Return a guess for whether 'wsgi.url_scheme' should be 'http' or 'https' | [
"Return",
"a",
"guess",
"for",
"whether",
"wsgi",
".",
"url_scheme",
"should",
"be",
"http",
"or",
"https"
] | def guess_scheme(environ):
"""Return a guess for whether 'wsgi.url_scheme' should be 'http' or 'https'
"""
if environ.get("HTTPS") in ('yes','on','1'):
return 'https'
else:
return 'http' | [
"def",
"guess_scheme",
"(",
"environ",
")",
":",
"if",
"environ",
".",
"get",
"(",
"\"HTTPS\"",
")",
"in",
"(",
"'yes'",
",",
"'on'",
",",
"'1'",
")",
":",
"return",
"'https'",
"else",
":",
"return",
"'http'"
] | https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/CPython/27/Lib/wsgiref/util.py#L35-L41 | ||
corenel/pytorch-adda | 96f2689dd418ef275fcd0b057e5dff89be5762c5 | utils.py | python | init_weights | (layer) | Init weights for layers w.r.t. the original paper. | Init weights for layers w.r.t. the original paper. | [
"Init",
"weights",
"for",
"layers",
"w",
".",
"r",
".",
"t",
".",
"the",
"original",
"paper",
"."
] | def init_weights(layer):
"""Init weights for layers w.r.t. the original paper."""
layer_name = layer.__class__.__name__
if layer_name.find("Conv") != -1:
layer.weight.data.normal_(0.0, 0.02)
elif layer_name.find("BatchNorm") != -1:
layer.weight.data.normal_(1.0, 0.02)
layer.bias.... | [
"def",
"init_weights",
"(",
"layer",
")",
":",
"layer_name",
"=",
"layer",
".",
"__class__",
".",
"__name__",
"if",
"layer_name",
".",
"find",
"(",
"\"Conv\"",
")",
"!=",
"-",
"1",
":",
"layer",
".",
"weight",
".",
"data",
".",
"normal_",
"(",
"0.0",
... | https://github.com/corenel/pytorch-adda/blob/96f2689dd418ef275fcd0b057e5dff89be5762c5/utils.py#L34-L41 | ||
rizar/attention-lvcsr | 1ae52cafdd8419874846f9544a299eef9c758f3b | libs/Theano/theano/tensor/nnet/blocksparse.py | python | SparseBlockGemv.make_node | (self, o, W, h, inputIdx, outputIdx) | return Apply(self, [o, W, h, inputIdx, outputIdx], [o.type()]) | Compute the dot product of the specified pieces of vectors
and matrices.
The parameter types are actually their expected shapes
relative to each other.
Parameters
----------
o : batch, oWin, oSize
output vector
W : iBlocks, oBlocks, iSize, oSize
... | Compute the dot product of the specified pieces of vectors
and matrices. | [
"Compute",
"the",
"dot",
"product",
"of",
"the",
"specified",
"pieces",
"of",
"vectors",
"and",
"matrices",
"."
] | def make_node(self, o, W, h, inputIdx, outputIdx):
"""
Compute the dot product of the specified pieces of vectors
and matrices.
The parameter types are actually their expected shapes
relative to each other.
Parameters
----------
o : batch, oWin, oSize
... | [
"def",
"make_node",
"(",
"self",
",",
"o",
",",
"W",
",",
"h",
",",
"inputIdx",
",",
"outputIdx",
")",
":",
"o",
"=",
"theano",
".",
"tensor",
".",
"as_tensor_variable",
"(",
"o",
")",
"W",
"=",
"theano",
".",
"tensor",
".",
"as_tensor_variable",
"("... | https://github.com/rizar/attention-lvcsr/blob/1ae52cafdd8419874846f9544a299eef9c758f3b/libs/Theano/theano/tensor/nnet/blocksparse.py#L34-L94 | |
burness/tensorflow-101 | c775a54af86542940e6e69b7d90d8d7e8aa9aeb9 | serving/predict_pb2.py | python | PredictionServiceStub.__init__ | (self, channel) | Constructor.
Args:
channel: A grpc.Channel. | Constructor. | [
"Constructor",
"."
] | def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"""
self.Predict = channel.unary_unary(
'/tensorflow.serving.PredictionService/Predict',
request_serializer=PredictRequest.SerializeToString,
response_deserializer=PredictResponse.FromString,
... | [
"def",
"__init__",
"(",
"self",
",",
"channel",
")",
":",
"self",
".",
"Predict",
"=",
"channel",
".",
"unary_unary",
"(",
"'/tensorflow.serving.PredictionService/Predict'",
",",
"request_serializer",
"=",
"PredictRequest",
".",
"SerializeToString",
",",
"response_des... | https://github.com/burness/tensorflow-101/blob/c775a54af86542940e6e69b7d90d8d7e8aa9aeb9/serving/predict_pb2.py#L221-L231 | ||
pymedusa/Medusa | 1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38 | ext/jsonrpclib/jsonrpc.py | python | Fault.__init__ | (
self,
code=-32000,
message="Server error",
rpcid=None,
config=jsonrpclib.config.DEFAULT,
data=None,
) | Sets up the error description
:param code: Fault code
:param message: Associated message
:param rpcid: Request ID
:param config: A JSONRPClib Config instance
:param data: Extra information added to an error description | Sets up the error description | [
"Sets",
"up",
"the",
"error",
"description"
] | def __init__(
self,
code=-32000,
message="Server error",
rpcid=None,
config=jsonrpclib.config.DEFAULT,
data=None,
):
"""
Sets up the error description
:param code: Fault code
:param message: Associated message
:param rpcid: Req... | [
"def",
"__init__",
"(",
"self",
",",
"code",
"=",
"-",
"32000",
",",
"message",
"=",
"\"Server error\"",
",",
"rpcid",
"=",
"None",
",",
"config",
"=",
"jsonrpclib",
".",
"config",
".",
"DEFAULT",
",",
"data",
"=",
"None",
",",
")",
":",
"self",
".",... | https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/ext/jsonrpclib/jsonrpc.py#L1068-L1089 | ||
hthuwal/sign-language-gesture-recognition | 23419bb6193a601f2165063d9bc8b51f7a48004a | retrain.py | python | run_bottleneck_on_image | (sess, image_data, image_data_tensor,
decoded_image_tensor, resized_input_tensor,
bottleneck_tensor) | return bottleneck_values | Runs inference on an image to extract the 'bottleneck' summary layer.
Args:
sess: Current active TensorFlow Session.
image_data: String of raw JPEG data.
image_data_tensor: Input data layer in the graph.
decoded_image_tensor: Output of initial image resizing and preprocessing.
resized_input_tenso... | Runs inference on an image to extract the 'bottleneck' summary layer. | [
"Runs",
"inference",
"on",
"an",
"image",
"to",
"extract",
"the",
"bottleneck",
"summary",
"layer",
"."
] | def run_bottleneck_on_image(sess, image_data, image_data_tensor,
decoded_image_tensor, resized_input_tensor,
bottleneck_tensor):
"""Runs inference on an image to extract the 'bottleneck' summary layer.
Args:
sess: Current active TensorFlow Session.
im... | [
"def",
"run_bottleneck_on_image",
"(",
"sess",
",",
"image_data",
",",
"image_data_tensor",
",",
"decoded_image_tensor",
",",
"resized_input_tensor",
",",
"bottleneck_tensor",
")",
":",
"# First decode the JPEG image, resize it, and rescale the pixel values.",
"resized_input_values... | https://github.com/hthuwal/sign-language-gesture-recognition/blob/23419bb6193a601f2165063d9bc8b51f7a48004a/retrain.py#L314-L337 | |
reahl/reahl | 86aac47c3a9b5b98e9f77dad4939034a02d54d46 | reahl-component/reahl/component/modelinterface.py | python | ValidationConstraint.value | (self) | return self.field.user_input | The current value which failed validation. | The current value which failed validation. | [
"The",
"current",
"value",
"which",
"failed",
"validation",
"."
] | def value(self):
"""The current value which failed validation."""
return self.field.user_input | [
"def",
"value",
"(",
"self",
")",
":",
"return",
"self",
".",
"field",
".",
"user_input"
] | https://github.com/reahl/reahl/blob/86aac47c3a9b5b98e9f77dad4939034a02d54d46/reahl-component/reahl/component/modelinterface.py#L348-L350 | |
BMW-InnovationLab/BMW-TensorFlow-Training-GUI | 4f10d1f00f9ac312ca833e5b28fd0f8952cfee17 | training_api/research/slim/nets/lenet.py | python | lenet | (images, num_classes=10, is_training=False,
dropout_keep_prob=0.5,
prediction_fn=slim.softmax,
scope='LeNet') | return logits, end_points | Creates a variant of the LeNet model.
Note that since the output is a set of 'logits', the values fall in the
interval of (-infinity, infinity). Consequently, to convert the outputs to a
probability distribution over the characters, one will need to convert them
using the softmax function:
logits = le... | Creates a variant of the LeNet model. | [
"Creates",
"a",
"variant",
"of",
"the",
"LeNet",
"model",
"."
] | def lenet(images, num_classes=10, is_training=False,
dropout_keep_prob=0.5,
prediction_fn=slim.softmax,
scope='LeNet'):
"""Creates a variant of the LeNet model.
Note that since the output is a set of 'logits', the values fall in the
interval of (-infinity, infinity). Consequently, t... | [
"def",
"lenet",
"(",
"images",
",",
"num_classes",
"=",
"10",
",",
"is_training",
"=",
"False",
",",
"dropout_keep_prob",
"=",
"0.5",
",",
"prediction_fn",
"=",
"slim",
".",
"softmax",
",",
"scope",
"=",
"'LeNet'",
")",
":",
"end_points",
"=",
"{",
"}",
... | https://github.com/BMW-InnovationLab/BMW-TensorFlow-Training-GUI/blob/4f10d1f00f9ac312ca833e5b28fd0f8952cfee17/training_api/research/slim/nets/lenet.py#L26-L79 | |
angr/angr | 4b04d56ace135018083d36d9083805be8146688b | angr/state_plugins/sim_action.py | python | SimActionExit._copy_objects | (self, c) | [] | def _copy_objects(self, c):
c.exit_type = self.exit_type
c.target = self._copy_object(self.target)
c.condition = self._copy_object(self.condition) | [
"def",
"_copy_objects",
"(",
"self",
",",
"c",
")",
":",
"c",
".",
"exit_type",
"=",
"self",
".",
"exit_type",
"c",
".",
"target",
"=",
"self",
".",
"_copy_object",
"(",
"self",
".",
"target",
")",
"c",
".",
"condition",
"=",
"self",
".",
"_copy_obje... | https://github.com/angr/angr/blob/4b04d56ace135018083d36d9083805be8146688b/angr/state_plugins/sim_action.py#L131-L134 | ||||
jameskermode/f90wrap | 6a6021d3d8c01125e13ecd0ef8faa52f19e5be3e | f90wrap/fortran.py | python | iter_fields | (node) | Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields``
that is present on *node*. | Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields``
that is present on *node*. | [
"Yield",
"a",
"tuple",
"of",
"(",
"fieldname",
"value",
")",
"for",
"each",
"field",
"in",
"node",
".",
"_fields",
"that",
"is",
"present",
"on",
"*",
"node",
"*",
"."
] | def iter_fields(node):
"""
Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields``
that is present on *node*.
"""
for field in node._fields:
try:
yield (field, getattr(node, field))
except AttributeError:
pass | [
"def",
"iter_fields",
"(",
"node",
")",
":",
"for",
"field",
"in",
"node",
".",
"_fields",
":",
"try",
":",
"yield",
"(",
"field",
",",
"getattr",
"(",
"node",
",",
"field",
")",
")",
"except",
"AttributeError",
":",
"pass"
] | https://github.com/jameskermode/f90wrap/blob/6a6021d3d8c01125e13ecd0ef8faa52f19e5be3e/f90wrap/fortran.py#L388-L397 | ||
pantsbuild/pex | 473c6ac732ed4bc338b4b20a9ec930d1d722c9b4 | pex/vendor/_vendored/pip/pip/_vendor/ipaddress.py | python | IPv6Address.is_global | (self) | return not self.is_private | Test if this address is allocated for public networks.
Returns:
A boolean, true if the address is not reserved per
iana-ipv6-special-registry. | Test if this address is allocated for public networks. | [
"Test",
"if",
"this",
"address",
"is",
"allocated",
"for",
"public",
"networks",
"."
] | def is_global(self):
"""Test if this address is allocated for public networks.
Returns:
A boolean, true if the address is not reserved per
iana-ipv6-special-registry.
"""
return not self.is_private | [
"def",
"is_global",
"(",
"self",
")",
":",
"return",
"not",
"self",
".",
"is_private"
] | https://github.com/pantsbuild/pex/blob/473c6ac732ed4bc338b4b20a9ec930d1d722c9b4/pex/vendor/_vendored/pip/pip/_vendor/ipaddress.py#L2103-L2111 | |
postgres/pgadmin4 | 374c5e952fa594d749fadf1f88076c1cba8c5f64 | web/pgadmin/tools/grant_wizard/__init__.py | python | GrantWizardModule.get_exposed_url_endpoints | (self) | return [
'grant_wizard.acl', 'grant_wizard.objects', 'grant_wizard.apply',
'grant_wizard.modified_sql'
] | Returns:
list: URL endpoints for grant-wizard module | Returns:
list: URL endpoints for grant-wizard module | [
"Returns",
":",
"list",
":",
"URL",
"endpoints",
"for",
"grant",
"-",
"wizard",
"module"
] | def get_exposed_url_endpoints(self):
"""
Returns:
list: URL endpoints for grant-wizard module
"""
return [
'grant_wizard.acl', 'grant_wizard.objects', 'grant_wizard.apply',
'grant_wizard.modified_sql'
] | [
"def",
"get_exposed_url_endpoints",
"(",
"self",
")",
":",
"return",
"[",
"'grant_wizard.acl'",
",",
"'grant_wizard.objects'",
",",
"'grant_wizard.apply'",
",",
"'grant_wizard.modified_sql'",
"]"
] | https://github.com/postgres/pgadmin4/blob/374c5e952fa594d749fadf1f88076c1cba8c5f64/web/pgadmin/tools/grant_wizard/__init__.py#L88-L96 | |
moraes/tipfy | 20cc0dab85f5433e399ae2d948d2b32dad051d66 | tipfy/appengine/acl.py | python | AclRules.set_cache | (cls, cache_key, spec) | Sets a memcache value.
:param cache_key:
The Cache key.
:param spec:
Value to be saved. | Sets a memcache value. | [
"Sets",
"a",
"memcache",
"value",
"."
] | def set_cache(cls, cache_key, spec):
"""Sets a memcache value.
:param cache_key:
The Cache key.
:param spec:
Value to be saved.
"""
_rules_map[cache_key] = spec
memcache.set(cache_key, spec, namespace=cls.__name__) | [
"def",
"set_cache",
"(",
"cls",
",",
"cache_key",
",",
"spec",
")",
":",
"_rules_map",
"[",
"cache_key",
"]",
"=",
"spec",
"memcache",
".",
"set",
"(",
"cache_key",
",",
"spec",
",",
"namespace",
"=",
"cls",
".",
"__name__",
")"
] | https://github.com/moraes/tipfy/blob/20cc0dab85f5433e399ae2d948d2b32dad051d66/tipfy/appengine/acl.py#L224-L233 | ||
exaile/exaile | a7b58996c5c15b3aa7b9975ac13ee8f784ef4689 | xlgui/icons.py | python | IconManager.pixbuf_from_icon_name | (
self, icon_name: str, size: Union[int, Gtk.IconSize] = Gtk.IconSize.BUTTON
) | return None | Generates a pixbuf from an icon name
:param icon_name: an icon name
:param size: the size of the icon, will be
tried to converted to a GTK icon size
:returns: the generated pixbuf | Generates a pixbuf from an icon name | [
"Generates",
"a",
"pixbuf",
"from",
"an",
"icon",
"name"
] | def pixbuf_from_icon_name(
self, icon_name: str, size: Union[int, Gtk.IconSize] = Gtk.IconSize.BUTTON
) -> Optional[GdkPixbuf.Pixbuf]:
"""
Generates a pixbuf from an icon name
:param icon_name: an icon name
:param size: the size of the icon, will be
tried to conv... | [
"def",
"pixbuf_from_icon_name",
"(",
"self",
",",
"icon_name",
":",
"str",
",",
"size",
":",
"Union",
"[",
"int",
",",
"Gtk",
".",
"IconSize",
"]",
"=",
"Gtk",
".",
"IconSize",
".",
"BUTTON",
")",
"->",
"Optional",
"[",
"GdkPixbuf",
".",
"Pixbuf",
"]",... | https://github.com/exaile/exaile/blob/a7b58996c5c15b3aa7b9975ac13ee8f784ef4689/xlgui/icons.py#L625-L659 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/input_datetime/__init__.py | python | InputDatetime.capability_attributes | (self) | return {
CONF_HAS_DATE: self.has_date,
CONF_HAS_TIME: self.has_time,
} | Return the capability attributes. | Return the capability attributes. | [
"Return",
"the",
"capability",
"attributes",
"."
] | def capability_attributes(self) -> dict:
"""Return the capability attributes."""
return {
CONF_HAS_DATE: self.has_date,
CONF_HAS_TIME: self.has_time,
} | [
"def",
"capability_attributes",
"(",
"self",
")",
"->",
"dict",
":",
"return",
"{",
"CONF_HAS_DATE",
":",
"self",
".",
"has_date",
",",
"CONF_HAS_TIME",
":",
"self",
".",
"has_time",
",",
"}"
] | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/input_datetime/__init__.py#L339-L344 | |
SymbiFlow/symbiflow-arch-defs | f38793112ff78a06de9f1e3269bd22543e29729f | ice40/utils/ice40_import_routing_from_icebox.py | python | group_hlc_name | (group) | return list(hlcnames.keys())[0] | Get the HLC "global name" from a group local names. | Get the HLC "global name" from a group local names. | [
"Get",
"the",
"HLC",
"global",
"name",
"from",
"a",
"group",
"local",
"names",
"."
] | def group_hlc_name(group):
"""Get the HLC "global name" from a group local names."""
assert_type(group, list)
global ic
hlcnames = defaultdict(int)
hlcnames_details = []
for ipos, localnames in group:
for name in localnames:
assert_type(ipos, PositionIcebox)
hlcna... | [
"def",
"group_hlc_name",
"(",
"group",
")",
":",
"assert_type",
"(",
"group",
",",
"list",
")",
"global",
"ic",
"hlcnames",
"=",
"defaultdict",
"(",
"int",
")",
"hlcnames_details",
"=",
"[",
"]",
"for",
"ipos",
",",
"localnames",
"in",
"group",
":",
"for... | https://github.com/SymbiFlow/symbiflow-arch-defs/blob/f38793112ff78a06de9f1e3269bd22543e29729f/ice40/utils/ice40_import_routing_from_icebox.py#L223-L257 | |
danielgtaylor/python-betterproto | 6dd7baa26cd9930b0013d0f6f0b7eaf84541deed | src/betterproto/casing.py | python | camel_case | (value: str, strict: bool = True) | return lowercase_first(pascal_case(value, strict=strict)) | Capitalize all words except first and remove symbols.
Parameters
-----------
value: :class:`str`
The value to convert.
strict: :class:`bool`
Whether or not to output only alphanumeric characters.
Returns
--------
:class:`str`
The value in camelCase. | Capitalize all words except first and remove symbols. | [
"Capitalize",
"all",
"words",
"except",
"first",
"and",
"remove",
"symbols",
"."
] | def camel_case(value: str, strict: bool = True) -> str:
"""
Capitalize all words except first and remove symbols.
Parameters
-----------
value: :class:`str`
The value to convert.
strict: :class:`bool`
Whether or not to output only alphanumeric characters.
Returns
------... | [
"def",
"camel_case",
"(",
"value",
":",
"str",
",",
"strict",
":",
"bool",
"=",
"True",
")",
"->",
"str",
":",
"return",
"lowercase_first",
"(",
"pascal_case",
"(",
"value",
",",
"strict",
"=",
"strict",
")",
")"
] | https://github.com/danielgtaylor/python-betterproto/blob/6dd7baa26cd9930b0013d0f6f0b7eaf84541deed/src/betterproto/casing.py#L100-L116 | |
Chaffelson/nipyapi | d3b186fd701ce308c2812746d98af9120955e810 | nipyapi/nifi/models/label_dto.py | python | LabelDTO.position | (self) | return self._position | Gets the position of this LabelDTO.
The position of this component in the UI if applicable.
:return: The position of this LabelDTO.
:rtype: PositionDTO | Gets the position of this LabelDTO.
The position of this component in the UI if applicable. | [
"Gets",
"the",
"position",
"of",
"this",
"LabelDTO",
".",
"The",
"position",
"of",
"this",
"component",
"in",
"the",
"UI",
"if",
"applicable",
"."
] | def position(self):
"""
Gets the position of this LabelDTO.
The position of this component in the UI if applicable.
:return: The position of this LabelDTO.
:rtype: PositionDTO
"""
return self._position | [
"def",
"position",
"(",
"self",
")",
":",
"return",
"self",
".",
"_position"
] | https://github.com/Chaffelson/nipyapi/blob/d3b186fd701ce308c2812746d98af9120955e810/nipyapi/nifi/models/label_dto.py#L156-L164 | |
microsoft/MPNet | 081523a788c1556f28dd90cbc629810f48b083fb | pretraining/fairseq/tasks/fairseq_task.py | python | FairseqTask.train_step | (self, sample, model, criterion, optimizer, ignore_grad=False) | return loss, sample_size, logging_output | Do forward and backward, and return the loss as computed by *criterion*
for the given *model* and *sample*.
Args:
sample (dict): the mini-batch. The format is defined by the
:class:`~fairseq.data.FairseqDataset`.
model (~fairseq.models.BaseFairseqModel): the mode... | Do forward and backward, and return the loss as computed by *criterion*
for the given *model* and *sample*. | [
"Do",
"forward",
"and",
"backward",
"and",
"return",
"the",
"loss",
"as",
"computed",
"by",
"*",
"criterion",
"*",
"for",
"the",
"given",
"*",
"model",
"*",
"and",
"*",
"sample",
"*",
"."
] | def train_step(self, sample, model, criterion, optimizer, ignore_grad=False):
"""
Do forward and backward, and return the loss as computed by *criterion*
for the given *model* and *sample*.
Args:
sample (dict): the mini-batch. The format is defined by the
:cl... | [
"def",
"train_step",
"(",
"self",
",",
"sample",
",",
"model",
",",
"criterion",
",",
"optimizer",
",",
"ignore_grad",
"=",
"False",
")",
":",
"model",
".",
"train",
"(",
")",
"loss",
",",
"sample_size",
",",
"logging_output",
"=",
"criterion",
"(",
"mod... | https://github.com/microsoft/MPNet/blob/081523a788c1556f28dd90cbc629810f48b083fb/pretraining/fairseq/tasks/fairseq_task.py#L221-L246 | |
selfteaching/selfteaching-python-camp | 9982ee964b984595e7d664b07c389cddaf158f1e | 19100205/Ceasar1978/pip-19.0.3/src/pip/_vendor/requests/models.py | python | Response.text | (self) | return content | Content of the response, in unicode.
If Response.encoding is None, encoding will be guessed using
``chardet``.
The encoding of the response content is determined based solely on HTTP
headers, following RFC 2616 to the letter. If you can take advantage of
non-HTTP knowledge to m... | Content of the response, in unicode. | [
"Content",
"of",
"the",
"response",
"in",
"unicode",
"."
] | def text(self):
"""Content of the response, in unicode.
If Response.encoding is None, encoding will be guessed using
``chardet``.
The encoding of the response content is determined based solely on HTTP
headers, following RFC 2616 to the letter. If you can take advantage of
... | [
"def",
"text",
"(",
"self",
")",
":",
"# Try charset from content-type",
"content",
"=",
"None",
"encoding",
"=",
"self",
".",
"encoding",
"if",
"not",
"self",
".",
"content",
":",
"return",
"str",
"(",
"''",
")",
"# Fallback to auto-detected encoding.",
"if",
... | https://github.com/selfteaching/selfteaching-python-camp/blob/9982ee964b984595e7d664b07c389cddaf158f1e/19100205/Ceasar1978/pip-19.0.3/src/pip/_vendor/requests/models.py#L836-L871 | |
pymedusa/Medusa | 1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38 | ext/boto/sqs/queue.py | python | Queue.get_timeout | (self) | return int(a['VisibilityTimeout']) | Get the visibility timeout for the queue.
:rtype: int
:return: The number of seconds as an integer. | Get the visibility timeout for the queue. | [
"Get",
"the",
"visibility",
"timeout",
"for",
"the",
"queue",
"."
] | def get_timeout(self):
"""
Get the visibility timeout for the queue.
:rtype: int
:return: The number of seconds as an integer.
"""
a = self.get_attributes('VisibilityTimeout')
return int(a['VisibilityTimeout']) | [
"def",
"get_timeout",
"(",
"self",
")",
":",
"a",
"=",
"self",
".",
"get_attributes",
"(",
"'VisibilityTimeout'",
")",
"return",
"int",
"(",
"a",
"[",
"'VisibilityTimeout'",
"]",
")"
] | https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/ext/boto/sqs/queue.py#L171-L179 | |
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-windows/x86/cryptography/x509/extensions.py | python | Extension.__hash__ | (self) | return hash((self.oid, self.critical, self.value)) | [] | def __hash__(self):
return hash((self.oid, self.critical, self.value)) | [
"def",
"__hash__",
"(",
"self",
")",
":",
"return",
"hash",
"(",
"(",
"self",
".",
"oid",
",",
"self",
".",
"critical",
",",
"self",
".",
"value",
")",
")"
] | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-windows/x86/cryptography/x509/extensions.py#L1197-L1198 | |||
mpatacchiola/dissecting-reinforcement-learning | 38660b0a0d5aed077a46acb4bcb2013565304d9c | src/6/inverted-pendulum/inverted_pendulum.py | python | InvertedPendulum.__init__ | (self, pole_mass=2.0, cart_mass=8.0, pole_lenght=0.5, delta_t=0.1) | Create a new pendulum object.
It is possible to pass the parameter of the simulation.
@param pole_mass: the mass of the pole (default 2.0 Kg)
@param cart_mass: the mass of the cart (default 8.0 Kg)
@param pole_lenght: the lenght of the pole (default 0.5 m)
@param delta... | Create a new pendulum object.
It is possible to pass the parameter of the simulation. | [
"Create",
"a",
"new",
"pendulum",
"object",
".",
"It",
"is",
"possible",
"to",
"pass",
"the",
"parameter",
"of",
"the",
"simulation",
"."
] | def __init__(self, pole_mass=2.0, cart_mass=8.0, pole_lenght=0.5, delta_t=0.1):
""" Create a new pendulum object.
It is possible to pass the parameter of the simulation.
@param pole_mass: the mass of the pole (default 2.0 Kg)
@param cart_mass: the mass of the cart (default 8.0... | [
"def",
"__init__",
"(",
"self",
",",
"pole_mass",
"=",
"2.0",
",",
"cart_mass",
"=",
"8.0",
",",
"pole_lenght",
"=",
"0.5",
",",
"delta_t",
"=",
"0.1",
")",
":",
"self",
".",
"angle_list",
"=",
"list",
"(",
")",
"self",
".",
"gravity",
"=",
"9.8",
... | https://github.com/mpatacchiola/dissecting-reinforcement-learning/blob/38660b0a0d5aed077a46acb4bcb2013565304d9c/src/6/inverted-pendulum/inverted_pendulum.py#L34-L51 | ||
demisto/content | 5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07 | Packs/SafeNet_Trusted_Access/Integrations/SafeNetTrustedAccess/SafeNetTrustedAccess.py | python | get_application_list_sta_command | (client: Client, args: Dict[str, Any]) | return CommandResults(
readable_output=tableToMarkdown("List of applications in the tenant :", response, headers=header_sequence,
headerTransform=pascalToSpace, removeNull=True),
outputs_prefix='STA.APPLICATION',
outputs_key_field=['id'],
outputs=r... | Function for sta-get-application-list command. Get list of all the applications in the tenant. | Function for sta-get-application-list command. Get list of all the applications in the tenant. | [
"Function",
"for",
"sta",
"-",
"get",
"-",
"application",
"-",
"list",
"command",
".",
"Get",
"list",
"of",
"all",
"the",
"applications",
"in",
"the",
"tenant",
"."
] | def get_application_list_sta_command(client: Client, args: Dict[str, Any]) -> CommandResults:
""" Function for sta-get-application-list command. Get list of all the applications in the tenant. """
response = client.get_application_list_sta(limit=args.get('limit'))
if not response:
return CommandRes... | [
"def",
"get_application_list_sta_command",
"(",
"client",
":",
"Client",
",",
"args",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
")",
"->",
"CommandResults",
":",
"response",
"=",
"client",
".",
"get_application_list_sta",
"(",
"limit",
"=",
"args",
".",
"get... | https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/SafeNet_Trusted_Access/Integrations/SafeNetTrustedAccess/SafeNetTrustedAccess.py#L1063-L1078 | |
hatRiot/zarp | 2e772350a01c2aeed3f4da9685cd0cc5d6b3ecad | src/lib/scapy/layers/tftp.py | python | TFTP_RRQ.answers | (self, other) | return 0 | [] | def answers(self, other):
return 0 | [
"def",
"answers",
"(",
"self",
",",
"other",
")",
":",
"return",
"0"
] | https://github.com/hatRiot/zarp/blob/2e772350a01c2aeed3f4da9685cd0cc5d6b3ecad/src/lib/scapy/layers/tftp.py#L27-L28 | |||
WikidPad/WikidPad | 558109638807bc76b4672922686e416ab2d5f79c | WikidPad/lib/pwiki/DocPages.py | python | DocPage.setEditorText | (self, text, dirty=True) | Just set editor text. Derived class overwrites this to set flags | Just set editor text. Derived class overwrites this to set flags | [
"Just",
"set",
"editor",
"text",
".",
"Derived",
"class",
"overwrites",
"this",
"to",
"set",
"flags"
] | def setEditorText(self, text, dirty=True):
"""
Just set editor text. Derived class overwrites this to set flags
"""
with self.textOperationLock:
self.editorText = text
self.livePageAst = None | [
"def",
"setEditorText",
"(",
"self",
",",
"text",
",",
"dirty",
"=",
"True",
")",
":",
"with",
"self",
".",
"textOperationLock",
":",
"self",
".",
"editorText",
"=",
"text",
"self",
".",
"livePageAst",
"=",
"None"
] | https://github.com/WikidPad/WikidPad/blob/558109638807bc76b4672922686e416ab2d5f79c/WikidPad/lib/pwiki/DocPages.py#L82-L88 | ||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_vendored_deps/library/oc_group.py | python | OpenShiftCLIConfig.stringify | (self, ascommalist='') | return rval | return the options hash as cli params in a string
if ascommalist is set to the name of a key, and
the value of that key is a dict, format the dict
as a list of comma delimited key=value pairs | return the options hash as cli params in a string
if ascommalist is set to the name of a key, and
the value of that key is a dict, format the dict
as a list of comma delimited key=value pairs | [
"return",
"the",
"options",
"hash",
"as",
"cli",
"params",
"in",
"a",
"string",
"if",
"ascommalist",
"is",
"set",
"to",
"the",
"name",
"of",
"a",
"key",
"and",
"the",
"value",
"of",
"that",
"key",
"is",
"a",
"dict",
"format",
"the",
"dict",
"as",
"a"... | def stringify(self, ascommalist=''):
''' return the options hash as cli params in a string
if ascommalist is set to the name of a key, and
the value of that key is a dict, format the dict
as a list of comma delimited key=value pairs '''
rval = []
for key in so... | [
"def",
"stringify",
"(",
"self",
",",
"ascommalist",
"=",
"''",
")",
":",
"rval",
"=",
"[",
"]",
"for",
"key",
"in",
"sorted",
"(",
"self",
".",
"config_options",
".",
"keys",
"(",
")",
")",
":",
"data",
"=",
"self",
".",
"config_options",
"[",
"ke... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_vendored_deps/library/oc_group.py#L1426-L1442 | |
cloudera/impyla | 0c736af4cad2bade9b8e313badc08ec50e81c948 | impala/_thrift_gen/hive_metastore/ThriftHiveMetastore.py | python | revoke_role_result.__eq__ | (self, other) | return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ | [] | def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ | [
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":",
"return",
"isinstance",
"(",
"other",
",",
"self",
".",
"__class__",
")",
"and",
"self",
".",
"__dict__",
"==",
"other",
".",
"__dict__"
] | https://github.com/cloudera/impyla/blob/0c736af4cad2bade9b8e313badc08ec50e81c948/impala/_thrift_gen/hive_metastore/ThriftHiveMetastore.py#L29007-L29008 | |||
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/scipy/sparse/compressed.py | python | _cs_matrix._major_index_fancy | (self, idx) | return self.__class__((res_data, res_indices, res_indptr),
shape=new_shape, copy=False) | Index along the major axis where idx is an array of ints. | Index along the major axis where idx is an array of ints. | [
"Index",
"along",
"the",
"major",
"axis",
"where",
"idx",
"is",
"an",
"array",
"of",
"ints",
"."
] | def _major_index_fancy(self, idx):
"""Index along the major axis where idx is an array of ints.
"""
idx_dtype = self.indices.dtype
indices = np.asarray(idx, dtype=idx_dtype).ravel()
_, N = self._swap(self.shape)
M = len(indices)
new_shape = self._swap((M, N))
... | [
"def",
"_major_index_fancy",
"(",
"self",
",",
"idx",
")",
":",
"idx_dtype",
"=",
"self",
".",
"indices",
".",
"dtype",
"indices",
"=",
"np",
".",
"asarray",
"(",
"idx",
",",
"dtype",
"=",
"idx_dtype",
")",
".",
"ravel",
"(",
")",
"_",
",",
"N",
"=... | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/scipy/sparse/compressed.py#L675-L699 | |
JustinhoCHN/SRGAN_Wasserstein | 08cb76028880f95cbeea1353c5bfc5b2b356ae83 | tensorlayer/files.py | python | load_wmt_en_fr_dataset | (path='data/wmt_en_fr/') | return train_path, dev_path | It will download English-to-French translation data from the WMT'15
Website (10^9-French-English corpus), and the 2013 news test from
the same site as development set.
Returns the directories of training data and test data.
Parameters
----------
path : string
Path to download data to, d... | It will download English-to-French translation data from the WMT'15
Website (10^9-French-English corpus), and the 2013 news test from
the same site as development set.
Returns the directories of training data and test data. | [
"It",
"will",
"download",
"English",
"-",
"to",
"-",
"French",
"translation",
"data",
"from",
"the",
"WMT",
"15",
"Website",
"(",
"10^9",
"-",
"French",
"-",
"English",
"corpus",
")",
"and",
"the",
"2013",
"news",
"test",
"from",
"the",
"same",
"site",
... | def load_wmt_en_fr_dataset(path='data/wmt_en_fr/'):
"""It will download English-to-French translation data from the WMT'15
Website (10^9-French-English corpus), and the 2013 news test from
the same site as development set.
Returns the directories of training data and test data.
Parameters
-----... | [
"def",
"load_wmt_en_fr_dataset",
"(",
"path",
"=",
"'data/wmt_en_fr/'",
")",
":",
"# URLs for WMT data.",
"_WMT_ENFR_TRAIN_URL",
"=",
"\"http://www.statmt.org/wmt10/\"",
"_WMT_ENFR_DEV_URL",
"=",
"\"http://www.statmt.org/wmt15/\"",
"def",
"gunzip_file",
"(",
"gz_path",
",",
"... | https://github.com/JustinhoCHN/SRGAN_Wasserstein/blob/08cb76028880f95cbeea1353c5bfc5b2b356ae83/tensorlayer/files.py#L444-L506 | |
Kismuz/btgym | 7fb3316e67f1d7a17c620630fb62fb29428b2cec | btgym/envs/base.py | python | BTgymEnv.close | (self) | Implementation of OpenAI Gym env.close method.
Puts BTgym server in Control Mode. | Implementation of OpenAI Gym env.close method.
Puts BTgym server in Control Mode. | [
"Implementation",
"of",
"OpenAI",
"Gym",
"env",
".",
"close",
"method",
".",
"Puts",
"BTgym",
"server",
"in",
"Control",
"Mode",
"."
] | def close(self):
"""
Implementation of OpenAI Gym env.close method.
Puts BTgym server in Control Mode.
"""
self.log.debug('close.call()')
self._stop_server()
self._stop_data_server()
self.log.info('Environment closed.') | [
"def",
"close",
"(",
"self",
")",
":",
"self",
".",
"log",
".",
"debug",
"(",
"'close.call()'",
")",
"self",
".",
"_stop_server",
"(",
")",
"self",
".",
"_stop_data_server",
"(",
")",
"self",
".",
"log",
".",
"info",
"(",
"'Environment closed.'",
")"
] | https://github.com/Kismuz/btgym/blob/7fb3316e67f1d7a17c620630fb62fb29428b2cec/btgym/envs/base.py#L839-L847 | ||
andreikop/enki | 3170059e5cb46dcc77d7fb1457c38a8a5f13af66 | enki/plugins/preview/__init__.py | python | Plugin._onDockShown | (self) | Dock has been shown by user. Change Enabled option | Dock has been shown by user. Change Enabled option | [
"Dock",
"has",
"been",
"shown",
"by",
"user",
".",
"Change",
"Enabled",
"option"
] | def _onDockShown(self):
"""Dock has been shown by user. Change Enabled option
"""
if not core.config()['Preview']['Enabled']:
core.config()['Preview']['Enabled'] = True
core.config().flush() | [
"def",
"_onDockShown",
"(",
"self",
")",
":",
"if",
"not",
"core",
".",
"config",
"(",
")",
"[",
"'Preview'",
"]",
"[",
"'Enabled'",
"]",
":",
"core",
".",
"config",
"(",
")",
"[",
"'Preview'",
"]",
"[",
"'Enabled'",
"]",
"=",
"True",
"core",
".",
... | https://github.com/andreikop/enki/blob/3170059e5cb46dcc77d7fb1457c38a8a5f13af66/enki/plugins/preview/__init__.py#L526-L531 | ||
saulpw/visidata | 577f34127c09116e3cbe1fcb3f67d54484785ae7 | visidata/cmdlog.py | python | delay | (vd, factor=1) | return acquired or not vd.paused | returns True if delay satisfied | returns True if delay satisfied | [
"returns",
"True",
"if",
"delay",
"satisfied"
] | def delay(vd, factor=1):
'returns True if delay satisfied'
acquired = vd.semaphore.acquire(timeout=options.replay_wait*factor if not vd.paused else None)
return acquired or not vd.paused | [
"def",
"delay",
"(",
"vd",
",",
"factor",
"=",
"1",
")",
":",
"acquired",
"=",
"vd",
".",
"semaphore",
".",
"acquire",
"(",
"timeout",
"=",
"options",
".",
"replay_wait",
"*",
"factor",
"if",
"not",
"vd",
".",
"paused",
"else",
"None",
")",
"return",... | https://github.com/saulpw/visidata/blob/577f34127c09116e3cbe1fcb3f67d54484785ae7/visidata/cmdlog.py#L282-L285 | |
pret/pokemon-reverse-engineering-tools | 5e0715f2579adcfeb683448c9a7826cfd3afa57d | pokemontools/crystal.py | python | Connection.__init__ | (self, address, direction=None, map_group=None, map_id=None, debug=True, smh=None) | [] | def __init__(self, address, direction=None, map_group=None, map_id=None, debug=True, smh=None):
self.address = address
self.direction = direction.lower()
self.map_group = map_group
self.map_id = map_id
self.debug = debug
self.smh = smh
self.last_address = address ... | [
"def",
"__init__",
"(",
"self",
",",
"address",
",",
"direction",
"=",
"None",
",",
"map_group",
"=",
"None",
",",
"map_id",
"=",
"None",
",",
"debug",
"=",
"True",
",",
"smh",
"=",
"None",
")",
":",
"self",
".",
"address",
"=",
"address",
"self",
... | https://github.com/pret/pokemon-reverse-engineering-tools/blob/5e0715f2579adcfeb683448c9a7826cfd3afa57d/pokemontools/crystal.py#L5084-L5094 | ||||
topydo/topydo | 57d7577c987515d4b49d5500f666da29080ca3c2 | topydo/lib/ListFormat.py | python | _unescape_percent_sign | (p_str) | return unescaped_str | Strips backslashes from escaped percent signs in p_str. | Strips backslashes from escaped percent signs in p_str. | [
"Strips",
"backslashes",
"from",
"escaped",
"percent",
"signs",
"in",
"p_str",
"."
] | def _unescape_percent_sign(p_str):
""" Strips backslashes from escaped percent signs in p_str. """
unescaped_str = re.sub(r'\\%', '%', p_str)
return unescaped_str | [
"def",
"_unescape_percent_sign",
"(",
"p_str",
")",
":",
"unescaped_str",
"=",
"re",
".",
"sub",
"(",
"r'\\\\%'",
",",
"'%'",
",",
"p_str",
")",
"return",
"unescaped_str"
] | https://github.com/topydo/topydo/blob/57d7577c987515d4b49d5500f666da29080ca3c2/topydo/lib/ListFormat.py#L87-L91 | |
fossasia/x-mario-center | fe67afe28d995dcf4e2498e305825a4859566172 | build/lib.linux-i686-2.7/softwarecenter/db/database.py | python | StoreDatabase.get_query_list_from_search_entry | (self, search_term,
category_query=None) | return SearchQuery([pkg_query, fuzzy_query]) | get xapian.Query from a search term string and a limit the
search to the given category | get xapian.Query from a search term string and a limit the
search to the given category | [
"get",
"xapian",
".",
"Query",
"from",
"a",
"search",
"term",
"string",
"and",
"a",
"limit",
"the",
"search",
"to",
"the",
"given",
"category"
] | def get_query_list_from_search_entry(self, search_term,
category_query=None):
""" get xapian.Query from a search term string and a limit the
search to the given category
"""
def _add_category_to_query(query):
""" helper that adds the current category to the query"... | [
"def",
"get_query_list_from_search_entry",
"(",
"self",
",",
"search_term",
",",
"category_query",
"=",
"None",
")",
":",
"def",
"_add_category_to_query",
"(",
"query",
")",
":",
"\"\"\" helper that adds the current category to the query\"\"\"",
"if",
"not",
"category_query... | https://github.com/fossasia/x-mario-center/blob/fe67afe28d995dcf4e2498e305825a4859566172/build/lib.linux-i686-2.7/softwarecenter/db/database.py#L290-L354 | |
psychopy/psychopy | 01b674094f38d0e0bd51c45a6f66f671d7041696 | psychopy/visual/elementarray.py | python | ElementArrayStim.setFieldPos | (self, value, operation='', log=None) | Usually you can use 'stim.attribute = value' syntax instead,
but use this method if you need to suppress the log message. | Usually you can use 'stim.attribute = value' syntax instead,
but use this method if you need to suppress the log message. | [
"Usually",
"you",
"can",
"use",
"stim",
".",
"attribute",
"=",
"value",
"syntax",
"instead",
"but",
"use",
"this",
"method",
"if",
"you",
"need",
"to",
"suppress",
"the",
"log",
"message",
"."
] | def setFieldPos(self, value, operation='', log=None):
"""Usually you can use 'stim.attribute = value' syntax instead,
but use this method if you need to suppress the log message.
"""
setAttribute(self, 'fieldPos', value, log, operation) | [
"def",
"setFieldPos",
"(",
"self",
",",
"value",
",",
"operation",
"=",
"''",
",",
"log",
"=",
"None",
")",
":",
"setAttribute",
"(",
"self",
",",
"'fieldPos'",
",",
"value",
",",
"log",
",",
"operation",
")"
] | https://github.com/psychopy/psychopy/blob/01b674094f38d0e0bd51c45a6f66f671d7041696/psychopy/visual/elementarray.py#L475-L479 | ||
elyra-ai/elyra | 5bb2009a7c475bda63f1cc2767eb8c4dfba9a239 | elyra/pipeline/pipeline_definition.py | python | PipelineDefinition.schema_version | (self) | return self._pipeline_definition.get('version') | The schema used by the Pipeline definition
:return: the version | The schema used by the Pipeline definition
:return: the version | [
"The",
"schema",
"used",
"by",
"the",
"Pipeline",
"definition",
":",
"return",
":",
"the",
"version"
] | def schema_version(self) -> str:
"""
The schema used by the Pipeline definition
:return: the version
"""
return self._pipeline_definition.get('version') | [
"def",
"schema_version",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_pipeline_definition",
".",
"get",
"(",
"'version'",
")"
] | https://github.com/elyra-ai/elyra/blob/5bb2009a7c475bda63f1cc2767eb8c4dfba9a239/elyra/pipeline/pipeline_definition.py#L321-L326 | |
bsmali4/xssfork | 515b45dfb0edb9263da544ad91fc1cb5f410bfd1 | thirdparty/requests/utils.py | python | requote_uri | (uri) | return quote(unquote_unreserved(uri), safe="!#$%&'()*+,/:;=?@[]~") | Re-quote the given URI.
This function passes the given URI through an unquote/quote cycle to
ensure that it is fully and consistently quoted. | Re-quote the given URI. | [
"Re",
"-",
"quote",
"the",
"given",
"URI",
"."
] | def requote_uri(uri):
"""Re-quote the given URI.
This function passes the given URI through an unquote/quote cycle to
ensure that it is fully and consistently quoted.
"""
# Unquote only the unreserved characters
# Then quote only illegal characters (do not quote reserved, unreserved,
# or '... | [
"def",
"requote_uri",
"(",
"uri",
")",
":",
"# Unquote only the unreserved characters",
"# Then quote only illegal characters (do not quote reserved, unreserved,",
"# or '%')",
"return",
"quote",
"(",
"unquote_unreserved",
"(",
"uri",
")",
",",
"safe",
"=",
"\"!#$%&'()*+,/:;=?@... | https://github.com/bsmali4/xssfork/blob/515b45dfb0edb9263da544ad91fc1cb5f410bfd1/thirdparty/requests/utils.py#L407-L416 | |
SublimeCodeIntel/SublimeCodeIntel | 904e14f95b1a8d1d795f76d80f6a79d0edfc17ce | settings.py | python | Settings.get | (self, setting, default=None) | return self.settings.get(setting, default) | Return a plugin setting, defaulting to default if not found. | Return a plugin setting, defaulting to default if not found. | [
"Return",
"a",
"plugin",
"setting",
"defaulting",
"to",
"default",
"if",
"not",
"found",
"."
] | def get(self, setting, default=None):
"""Return a plugin setting, defaulting to default if not found."""
return self.settings.get(setting, default) | [
"def",
"get",
"(",
"self",
",",
"setting",
",",
"default",
"=",
"None",
")",
":",
"return",
"self",
".",
"settings",
".",
"get",
"(",
"setting",
",",
"default",
")"
] | https://github.com/SublimeCodeIntel/SublimeCodeIntel/blob/904e14f95b1a8d1d795f76d80f6a79d0edfc17ce/settings.py#L35-L37 | |
SCSSoftware/BlenderTools | 96f323d3bdf2d8cb8ed7f882dcdf036277a802dd | addon/io_scs_tools/internals/shaders/eut2/decalshadow/__init__.py | python | Decalshadow.init | (node_tree) | Initialize node tree with links for this shader.
:param node_tree: node tree on which this shader should be created
:type node_tree: bpy.types.NodeTree | Initialize node tree with links for this shader. | [
"Initialize",
"node",
"tree",
"with",
"links",
"for",
"this",
"shader",
"."
] | def init(node_tree):
"""Initialize node tree with links for this shader.
:param node_tree: node tree on which this shader should be created
:type node_tree: bpy.types.NodeTree
"""
# init parent
Shadowmap.init(node_tree) | [
"def",
"init",
"(",
"node_tree",
")",
":",
"# init parent",
"Shadowmap",
".",
"init",
"(",
"node_tree",
")"
] | https://github.com/SCSSoftware/BlenderTools/blob/96f323d3bdf2d8cb8ed7f882dcdf036277a802dd/addon/io_scs_tools/internals/shaders/eut2/decalshadow/__init__.py#L31-L39 | ||
yaqwsx/KiKit | 14de7f60b64e6d03ce638e78d279915d09bb9ac7 | kikit/stencil.py | python | makeTopRegister | (board, jigFrameSize, jigThickness, pcbThickness,
outerBorder=fromMm(3), innerBorder=fromMm(1),
tolerance=fromMm(0.05)) | return makeRegister(board, jigFrameSize, jigThickness, pcbThickness,
outerBorder, innerBorder, tolerance, True) | Create a SolidPython representation of the top register | Create a SolidPython representation of the top register | [
"Create",
"a",
"SolidPython",
"representation",
"of",
"the",
"top",
"register"
] | def makeTopRegister(board, jigFrameSize, jigThickness, pcbThickness,
outerBorder=fromMm(3), innerBorder=fromMm(1),
tolerance=fromMm(0.05)):
"""
Create a SolidPython representation of the top register
"""
return makeRegister(board, jigFrameSize, jigThickness, pcbTh... | [
"def",
"makeTopRegister",
"(",
"board",
",",
"jigFrameSize",
",",
"jigThickness",
",",
"pcbThickness",
",",
"outerBorder",
"=",
"fromMm",
"(",
"3",
")",
",",
"innerBorder",
"=",
"fromMm",
"(",
"1",
")",
",",
"tolerance",
"=",
"fromMm",
"(",
"0.05",
")",
... | https://github.com/yaqwsx/KiKit/blob/14de7f60b64e6d03ce638e78d279915d09bb9ac7/kikit/stencil.py#L261-L268 | |
khanhnamle1994/natural-language-processing | 01d450d5ac002b0156ef4cf93a07cb508c1bcdc5 | assignment1/.env/lib/python2.7/site-packages/numpy/ma/core.py | python | make_mask_none | (newshape, dtype=None) | return result | Return a boolean mask of the given shape, filled with False.
This function returns a boolean ndarray with all entries False, that can
be used in common mask manipulations. If a complex dtype is specified, the
type of each field is converted to a boolean type.
Parameters
----------
newshape : t... | Return a boolean mask of the given shape, filled with False. | [
"Return",
"a",
"boolean",
"mask",
"of",
"the",
"given",
"shape",
"filled",
"with",
"False",
"."
] | def make_mask_none(newshape, dtype=None):
"""
Return a boolean mask of the given shape, filled with False.
This function returns a boolean ndarray with all entries False, that can
be used in common mask manipulations. If a complex dtype is specified, the
type of each field is converted to a boolean... | [
"def",
"make_mask_none",
"(",
"newshape",
",",
"dtype",
"=",
"None",
")",
":",
"if",
"dtype",
"is",
"None",
":",
"result",
"=",
"np",
".",
"zeros",
"(",
"newshape",
",",
"dtype",
"=",
"MaskType",
")",
"else",
":",
"result",
"=",
"np",
".",
"zeros",
... | https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/numpy/ma/core.py#L1520-L1567 | |
PINTO0309/PINTO_model_zoo | 2924acda7a7d541d8712efd7cc4fd1c61ef5bddd | 082_MediaPipe_Meet_Segmentation/03_segm_lite_v681_tflite_to_pb_saved_model.py | python | make_graph | (ops, op_types, interpreter) | [] | def make_graph(ops, op_types, interpreter):
height = 96
width = 160
tensors = {}
input_details = interpreter.get_input_details()
# output_details = interpreter.get_output_details()
print(input_details)
for input_detail in input_details:
tensors[input_detail['index']] = tf.placehol... | [
"def",
"make_graph",
"(",
"ops",
",",
"op_types",
",",
"interpreter",
")",
":",
"height",
"=",
"96",
"width",
"=",
"160",
"tensors",
"=",
"{",
"}",
"input_details",
"=",
"interpreter",
".",
"get_input_details",
"(",
")",
"# output_details = interpreter.get_outpu... | https://github.com/PINTO0309/PINTO_model_zoo/blob/2924acda7a7d541d8712efd7cc4fd1c61ef5bddd/082_MediaPipe_Meet_Segmentation/03_segm_lite_v681_tflite_to_pb_saved_model.py#L54-L288 | ||||
HeinleinSupport/check_mk_extensions | aa7d7389b812ed00f91dad61d66fb676284897d8 | dir_size/web/plugins/wato/dir_size.py | python | _parameter_valuespec_dir_size | () | return Transform(
Dictionary(
title = _("Limits"),
help = _("Size of all files and subdirectories"),
elements = [
( 'levels_upper',
Tuple(
title = _('Upper levels for the total size'),
elements = [
... | [] | def _parameter_valuespec_dir_size():
return Transform(
Dictionary(
title = _("Limits"),
help = _("Size of all files and subdirectories"),
elements = [
( 'levels_upper',
Tuple(
title = _('Upper levels for the total si... | [
"def",
"_parameter_valuespec_dir_size",
"(",
")",
":",
"return",
"Transform",
"(",
"Dictionary",
"(",
"title",
"=",
"_",
"(",
"\"Limits\"",
")",
",",
"help",
"=",
"_",
"(",
"\"Size of all files and subdirectories\"",
")",
",",
"elements",
"=",
"[",
"(",
"'leve... | https://github.com/HeinleinSupport/check_mk_extensions/blob/aa7d7389b812ed00f91dad61d66fb676284897d8/dir_size/web/plugins/wato/dir_size.py#L39-L57 | |||
openstack/manila | 142990edc027e14839d5deaf4954dd6fc88de15e | manila/share/drivers/quobyte/quobyte.py | python | QuobyteShareDriver.delete_share | (self, context, share, share_server=None) | Delete the corresponding Quobyte volume. | Delete the corresponding Quobyte volume. | [
"Delete",
"the",
"corresponding",
"Quobyte",
"volume",
"."
] | def delete_share(self, context, share, share_server=None):
"""Delete the corresponding Quobyte volume."""
volume_uuid = self._resolve_volume_name(share['name'],
share['project_id'])
if not volume_uuid:
LOG.warning("No volume found for "... | [
"def",
"delete_share",
"(",
"self",
",",
"context",
",",
"share",
",",
"share_server",
"=",
"None",
")",
":",
"volume_uuid",
"=",
"self",
".",
"_resolve_volume_name",
"(",
"share",
"[",
"'name'",
"]",
",",
"share",
"[",
"'project_id'",
"]",
")",
"if",
"n... | https://github.com/openstack/manila/blob/142990edc027e14839d5deaf4954dd6fc88de15e/manila/share/drivers/quobyte/quobyte.py#L260-L276 | ||
adamcharnock/lightbus | 5e7069da06cd37a8131e8c592ee957ccb73603d5 | lightbus/message.py | python | Message.__init__ | (self, id: str = "", native_id: str = None) | [] | def __init__(self, id: str = "", native_id: str = None):
self.id = id or str(uuid1())
self.native_id = native_id | [
"def",
"__init__",
"(",
"self",
",",
"id",
":",
"str",
"=",
"\"\"",
",",
"native_id",
":",
"str",
"=",
"None",
")",
":",
"self",
".",
"id",
"=",
"id",
"or",
"str",
"(",
"uuid1",
"(",
")",
")",
"self",
".",
"native_id",
"=",
"native_id"
] | https://github.com/adamcharnock/lightbus/blob/5e7069da06cd37a8131e8c592ee957ccb73603d5/lightbus/message.py#L14-L16 | ||||
sahana/eden | 1696fa50e90ce967df69f66b571af45356cc18da | modules/s3/s3validators.py | python | IS_NOT_ONE_OF.validate | (self, value, record_id=None) | return value | Validator
Args:
value: the input value
record_id: the current record ID
Returns:
value | Validator | [
"Validator"
] | def validate(self, value, record_id=None):
"""
Validator
Args:
value: the input value
record_id: the current record ID
Returns:
value
"""
value = str(value)
if not value.strip():
# Empty =>... | [
"def",
"validate",
"(",
"self",
",",
"value",
",",
"record_id",
"=",
"None",
")",
":",
"value",
"=",
"str",
"(",
"value",
")",
"if",
"not",
"value",
".",
"strip",
"(",
")",
":",
"# Empty => error",
"raise",
"ValidationError",
"(",
"translate",
"(",
"se... | https://github.com/sahana/eden/blob/1696fa50e90ce967df69f66b571af45356cc18da/modules/s3/s3validators.py#L1311-L1397 | |
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-darwin/x64/PIL/IcoImagePlugin.py | python | IcoImageFile.load_seek | (self) | [] | def load_seek(self):
# Flag the ImageFile.Parser so that it
# just does all the decode at the end.
pass | [
"def",
"load_seek",
"(",
"self",
")",
":",
"# Flag the ImageFile.Parser so that it",
"# just does all the decode at the end.",
"pass"
] | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-darwin/x64/PIL/IcoImagePlugin.py#L274-L277 | ||||
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/matplotlib/font_manager.py | python | findSystemFonts | (fontpaths=None, fontext='ttf') | return [fname for fname in fontfiles.iterkeys() if os.path.exists(fname)] | Search for fonts in the specified font paths. If no paths are
given, will use a standard set of system paths, as well as the
list of fonts tracked by fontconfig if fontconfig is installed and
available. A list of TrueType fonts are returned by default with
AFM fonts as an option. | Search for fonts in the specified font paths. If no paths are
given, will use a standard set of system paths, as well as the
list of fonts tracked by fontconfig if fontconfig is installed and
available. A list of TrueType fonts are returned by default with
AFM fonts as an option. | [
"Search",
"for",
"fonts",
"in",
"the",
"specified",
"font",
"paths",
".",
"If",
"no",
"paths",
"are",
"given",
"will",
"use",
"a",
"standard",
"set",
"of",
"system",
"paths",
"as",
"well",
"as",
"the",
"list",
"of",
"fonts",
"tracked",
"by",
"fontconfig"... | def findSystemFonts(fontpaths=None, fontext='ttf'):
"""
Search for fonts in the specified font paths. If no paths are
given, will use a standard set of system paths, as well as the
list of fonts tracked by fontconfig if fontconfig is installed and
available. A list of TrueType fonts are returned b... | [
"def",
"findSystemFonts",
"(",
"fontpaths",
"=",
"None",
",",
"fontext",
"=",
"'ttf'",
")",
":",
"fontfiles",
"=",
"{",
"}",
"fontexts",
"=",
"get_fontext_synonyms",
"(",
"fontext",
")",
"if",
"fontpaths",
"is",
"None",
":",
"if",
"sys",
".",
"platform",
... | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/matplotlib/font_manager.py#L291-L329 | |
chainer/chainer-chemistry | efe323aa21f63a815130d673781e7cca1ccb72d2 | chainer_chemistry/dataset/preprocessors/wle_io.py | python | create_datasets | (atom_arrays, adj_arrays, teach_signals, wle_arrays=None) | return output_datasets | Expand the atomic_num_arrays with the expanded labels,
then return valid datasets (tuple of NumpyTupleDataset)
Args:
atom_arrays: 3-tuple of list of lists.
atom_arrays[i][j][k] is the id of an atom
i: train/val/test
j: index of a s... | Expand the atomic_num_arrays with the expanded labels,
then return valid datasets (tuple of NumpyTupleDataset) | [
"Expand",
"the",
"atomic_num_arrays",
"with",
"the",
"expanded",
"labels",
"then",
"return",
"valid",
"datasets",
"(",
"tuple",
"of",
"NumpyTupleDataset",
")"
] | def create_datasets(atom_arrays, adj_arrays, teach_signals, wle_arrays=None):
"""
Expand the atomic_num_arrays with the expanded labels,
then return valid datasets (tuple of NumpyTupleDataset)
Args:
atom_arrays: 3-tuple of list of lists.
atom_arrays[i][j][k] is the id of... | [
"def",
"create_datasets",
"(",
"atom_arrays",
",",
"adj_arrays",
",",
"teach_signals",
",",
"wle_arrays",
"=",
"None",
")",
":",
"output_datasets",
"=",
"[",
"]",
"# ToDo: try another indexing: e.g. orignal node label + extneions",
"assert",
"len",
"(",
"atom_arrays",
"... | https://github.com/chainer/chainer-chemistry/blob/efe323aa21f63a815130d673781e7cca1ccb72d2/chainer_chemistry/dataset/preprocessors/wle_io.py#L10-L54 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/isy994/sensor.py | python | ISYSensorVariableEntity.__init__ | (self, vname: str, vobj: object) | Initialize the ISY994 binary sensor program. | Initialize the ISY994 binary sensor program. | [
"Initialize",
"the",
"ISY994",
"binary",
"sensor",
"program",
"."
] | def __init__(self, vname: str, vobj: object) -> None:
"""Initialize the ISY994 binary sensor program."""
super().__init__(vobj)
self._name = vname | [
"def",
"__init__",
"(",
"self",
",",
"vname",
":",
"str",
",",
"vobj",
":",
"object",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"vobj",
")",
"self",
".",
"_name",
"=",
"vname"
] | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/isy994/sensor.py#L110-L113 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.py | python | LegacyMetadata.__iter__ | (self) | [] | def __iter__(self):
for key in self.keys():
yield key | [
"def",
"__iter__",
"(",
"self",
")",
":",
"for",
"key",
"in",
"self",
".",
"keys",
"(",
")",
":",
"yield",
"key"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.py#L634-L636 | ||||
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/celery-4.2.1/celery/utils/time.py | python | adjust_timestamp | (ts, offset, here=utcoffset) | return ts - (offset - here()) * 3600 | Adjust timestamp based on provided utcoffset. | Adjust timestamp based on provided utcoffset. | [
"Adjust",
"timestamp",
"based",
"on",
"provided",
"utcoffset",
"."
] | def adjust_timestamp(ts, offset, here=utcoffset):
"""Adjust timestamp based on provided utcoffset."""
return ts - (offset - here()) * 3600 | [
"def",
"adjust_timestamp",
"(",
"ts",
",",
"offset",
",",
"here",
"=",
"utcoffset",
")",
":",
"return",
"ts",
"-",
"(",
"offset",
"-",
"here",
"(",
")",
")",
"*",
"3600"
] | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/celery-4.2.1/celery/utils/time.py#L387-L389 | |
evennia/evennia | fa79110ba6b219932f22297838e8ac72ebc0be0e | evennia/utils/logger.py | python | log_file | (msg, filename="game.log") | Arbitrary file logger using threads.
Args:
msg (str): String to append to logfile.
filename (str, optional): Defaults to 'game.log'. All logs
will appear in the logs directory and log entries will start
on new lines following datetime info. | Arbitrary file logger using threads. | [
"Arbitrary",
"file",
"logger",
"using",
"threads",
"."
] | def log_file(msg, filename="game.log"):
"""
Arbitrary file logger using threads.
Args:
msg (str): String to append to logfile.
filename (str, optional): Defaults to 'game.log'. All logs
will appear in the logs directory and log entries will start
on new lines followi... | [
"def",
"log_file",
"(",
"msg",
",",
"filename",
"=",
"\"game.log\"",
")",
":",
"def",
"callback",
"(",
"filehandle",
",",
"msg",
")",
":",
"\"\"\"Writing to file and flushing result\"\"\"",
"msg",
"=",
"\"\\n%s [-] %s\"",
"%",
"(",
"timeformat",
"(",
")",
",",
... | https://github.com/evennia/evennia/blob/fa79110ba6b219932f22297838e8ac72ebc0be0e/evennia/utils/logger.py#L453-L481 | ||
gepd/Deviot | 150caea06108369b30210eb287a580fcff4904af | libraries/pyserial/serialutil.py | python | SerialBase.rs485_mode | (self) | return self._rs485_mode | \
Enable RS485 mode and apply new settings, set to None to disable.
See serial.rs485.RS485Settings for more info about the value. | \
Enable RS485 mode and apply new settings, set to None to disable.
See serial.rs485.RS485Settings for more info about the value. | [
"\\",
"Enable",
"RS485",
"mode",
"and",
"apply",
"new",
"settings",
"set",
"to",
"None",
"to",
"disable",
".",
"See",
"serial",
".",
"rs485",
".",
"RS485Settings",
"for",
"more",
"info",
"about",
"the",
"value",
"."
] | def rs485_mode(self):
"""\
Enable RS485 mode and apply new settings, set to None to disable.
See serial.rs485.RS485Settings for more info about the value.
"""
return self._rs485_mode | [
"def",
"rs485_mode",
"(",
"self",
")",
":",
"return",
"self",
".",
"_rs485_mode"
] | https://github.com/gepd/Deviot/blob/150caea06108369b30210eb287a580fcff4904af/libraries/pyserial/serialutil.py#L485-L490 | |
edfungus/Crouton | ada98b3930192938a48909072b45cb84b945f875 | clients/python_clients/venv/lib/python2.7/site-packages/pip/_vendor/requests/models.py | python | PreparedRequest.prepare_auth | (self, auth, url='') | Prepares the given HTTP auth data. | Prepares the given HTTP auth data. | [
"Prepares",
"the",
"given",
"HTTP",
"auth",
"data",
"."
] | def prepare_auth(self, auth, url=''):
"""Prepares the given HTTP auth data."""
# If no Auth is explicitly provided, extract it from the URL first.
if auth is None:
url_auth = get_auth_from_url(self.url)
auth = url_auth if any(url_auth) else None
if auth:
... | [
"def",
"prepare_auth",
"(",
"self",
",",
"auth",
",",
"url",
"=",
"''",
")",
":",
"# If no Auth is explicitly provided, extract it from the URL first.",
"if",
"auth",
"is",
"None",
":",
"url_auth",
"=",
"get_auth_from_url",
"(",
"self",
".",
"url",
")",
"auth",
... | https://github.com/edfungus/Crouton/blob/ada98b3930192938a48909072b45cb84b945f875/clients/python_clients/venv/lib/python2.7/site-packages/pip/_vendor/requests/models.py#L482-L502 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/wagtail_bak/wagtailforms/forms.py | python | FormBuilder.create_multiselect_field | (self, field, options) | return django.forms.MultipleChoiceField(**options) | [] | def create_multiselect_field(self, field, options):
options['choices'] = map(
lambda x: (x.strip(), x.strip()),
field.choices.split(',')
)
return django.forms.MultipleChoiceField(**options) | [
"def",
"create_multiselect_field",
"(",
"self",
",",
"field",
",",
"options",
")",
":",
"options",
"[",
"'choices'",
"]",
"=",
"map",
"(",
"lambda",
"x",
":",
"(",
"x",
".",
"strip",
"(",
")",
",",
"x",
".",
"strip",
"(",
")",
")",
",",
"field",
... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/wagtail_bak/wagtailforms/forms.py#L55-L60 | |||
GNS3/gns3-server | aff06572d4173df945ad29ea8feb274f7885d9e4 | gns3server/compute/dynamips/nodes/router.py | python | Router.dynamips_id | (self) | return self._dynamips_id | Returns the Dynamips VM ID.
:return: Dynamips VM identifier | Returns the Dynamips VM ID. | [
"Returns",
"the",
"Dynamips",
"VM",
"ID",
"."
] | def dynamips_id(self):
"""
Returns the Dynamips VM ID.
:return: Dynamips VM identifier
"""
return self._dynamips_id | [
"def",
"dynamips_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_dynamips_id"
] | https://github.com/GNS3/gns3-server/blob/aff06572d4173df945ad29ea8feb274f7885d9e4/gns3server/compute/dynamips/nodes/router.py#L199-L206 | |
mozilla/moztrap | 93b34a4cd21c9e08f73d3b1a7630cd873f8418a0 | moztrap/view/lists/actions.py | python | actions | (model, allowed_actions, permission=None, fall_through=False) | return decorator | View decorator for handling single-model actions on manage list pages.
Handles any POST keys named "action-method", where "method" must be in
``allowed_actions``. The value of the key should be an ID of a ``model``,
and "method" will be called on it, with any errors handled.
By default, any "POST" req... | View decorator for handling single-model actions on manage list pages. | [
"View",
"decorator",
"for",
"handling",
"single",
"-",
"model",
"actions",
"on",
"manage",
"list",
"pages",
"."
] | def actions(model, allowed_actions, permission=None, fall_through=False):
"""
View decorator for handling single-model actions on manage list pages.
Handles any POST keys named "action-method", where "method" must be in
``allowed_actions``. The value of the key should be an ID of a ``model``,
and "... | [
"def",
"actions",
"(",
"model",
",",
"allowed_actions",
",",
"permission",
"=",
"None",
",",
"fall_through",
"=",
"False",
")",
":",
"def",
"decorator",
"(",
"view_func",
")",
":",
"@",
"wraps",
"(",
"view_func",
")",
"def",
"_wrapped_view",
"(",
"request"... | https://github.com/mozilla/moztrap/blob/93b34a4cd21c9e08f73d3b1a7630cd873f8418a0/moztrap/view/lists/actions.py#L12-L58 | |
Azure/azure-cli | 6c1b085a0910c6c2139006fcbd8ade44006eb6dd | src/azure-cli/azure/cli/command_modules/sql/custom.py | python | _get_identity_object_from_type | (
assignIdentityIsPresent,
resourceIdentityType,
userAssignedIdentities,
existingResourceIdentity) | return identityResult | Gets the resource identity type. | Gets the resource identity type. | [
"Gets",
"the",
"resource",
"identity",
"type",
"."
] | def _get_identity_object_from_type(
assignIdentityIsPresent,
resourceIdentityType,
userAssignedIdentities,
existingResourceIdentity):
'''
Gets the resource identity type.
'''
identityResult = None
if resourceIdentityType is not None and resourceIdentityType == Resour... | [
"def",
"_get_identity_object_from_type",
"(",
"assignIdentityIsPresent",
",",
"resourceIdentityType",
",",
"userAssignedIdentities",
",",
"existingResourceIdentity",
")",
":",
"identityResult",
"=",
"None",
"if",
"resourceIdentityType",
"is",
"not",
"None",
"and",
"resource... | https://github.com/Azure/azure-cli/blob/6c1b085a0910c6c2139006fcbd8ade44006eb6dd/src/azure-cli/azure/cli/command_modules/sql/custom.py#L425-L489 | |
igraph/python-igraph | e9f83e8af08f24ea025596e745917197d8b44d94 | src/igraph/utils.py | python | safemax | (iterable, default=0) | Safer variant of ``max()`` that returns a default value if the iterable
is empty.
Example:
>>> safemax([-5, 6, 4])
6
>>> safemax([])
0
>>> safemax((), 2)
2 | Safer variant of ``max()`` that returns a default value if the iterable
is empty. | [
"Safer",
"variant",
"of",
"max",
"()",
"that",
"returns",
"a",
"default",
"value",
"if",
"the",
"iterable",
"is",
"empty",
"."
] | def safemax(iterable, default=0):
"""Safer variant of ``max()`` that returns a default value if the iterable
is empty.
Example:
>>> safemax([-5, 6, 4])
6
>>> safemax([])
0
>>> safemax((), 2)
2
"""
it = iter(iterable)
try:
first = next(it)... | [
"def",
"safemax",
"(",
"iterable",
",",
"default",
"=",
"0",
")",
":",
"it",
"=",
"iter",
"(",
"iterable",
")",
"try",
":",
"first",
"=",
"next",
"(",
"it",
")",
"except",
"StopIteration",
":",
"return",
"default",
"else",
":",
"return",
"max",
"(",
... | https://github.com/igraph/python-igraph/blob/e9f83e8af08f24ea025596e745917197d8b44d94/src/igraph/utils.py#L362-L381 | ||
chen0040/keras-english-resume-parser-and-analyzer | 900f4a5afab53e1ae80b90ffecff964d8347c9c4 | keras_en_parser_and_analyzer/library/classifiers/ffn.py | python | WordVecGloveFFN.get_architecture_file_path | (model_dir_path) | return model_dir_path + '/' + WordVecGloveFFN.model_name + '_architecture.json' | [] | def get_architecture_file_path(model_dir_path):
return model_dir_path + '/' + WordVecGloveFFN.model_name + '_architecture.json' | [
"def",
"get_architecture_file_path",
"(",
"model_dir_path",
")",
":",
"return",
"model_dir_path",
"+",
"'/'",
"+",
"WordVecGloveFFN",
".",
"model_name",
"+",
"'_architecture.json'"
] | https://github.com/chen0040/keras-english-resume-parser-and-analyzer/blob/900f4a5afab53e1ae80b90ffecff964d8347c9c4/keras_en_parser_and_analyzer/library/classifiers/ffn.py#L36-L37 | |||
morganstanley/treadmill | f18267c665baf6def4374d21170198f63ff1cde4 | lib/python/treadmill/services/_linux_base_service.py | python | LinuxResourceService._run_events | (loop_poll, loop_timeout, loop_callbacks) | return any(results) | Wait for events up to `loop_timeout` and execute each of the
registered handlers.
:returns ``bool``:
True is any of the callbacks returned True | Wait for events up to `loop_timeout` and execute each of the
registered handlers. | [
"Wait",
"for",
"events",
"up",
"to",
"loop_timeout",
"and",
"execute",
"each",
"of",
"the",
"registered",
"handlers",
"."
] | def _run_events(loop_poll, loop_timeout, loop_callbacks):
"""Wait for events up to `loop_timeout` and execute each of the
registered handlers.
:returns ``bool``:
True is any of the callbacks returned True
"""
pending_callbacks = []
try:
# poll ti... | [
"def",
"_run_events",
"(",
"loop_poll",
",",
"loop_timeout",
",",
"loop_callbacks",
")",
":",
"pending_callbacks",
"=",
"[",
"]",
"try",
":",
"# poll timeout is in milliseconds",
"for",
"(",
"fd",
",",
"_event",
")",
"in",
"loop_poll",
".",
"poll",
"(",
"loop_... | https://github.com/morganstanley/treadmill/blob/f18267c665baf6def4374d21170198f63ff1cde4/lib/python/treadmill/services/_linux_base_service.py#L225-L258 | |
travisgoodspeed/goodfet | 1750cc1e8588af5470385e52fa098ca7364c2863 | client/GoodFETCC.py | python | GoodFETCC.test | (self) | [] | def test(self):
self.CCreleasecpu();
self.CChaltcpu();
#print "Status: %s" % self.CCstatusstr();
#Grab ident three times, should be equal.
ident1=self.CCident();
ident2=self.CCident();
ident3=self.CCident();
if(ident1!=ident2 or ident2!=ident3):
... | [
"def",
"test",
"(",
"self",
")",
":",
"self",
".",
"CCreleasecpu",
"(",
")",
"self",
".",
"CChaltcpu",
"(",
")",
"#print \"Status: %s\" % self.CCstatusstr();",
"#Grab ident three times, should be equal.",
"ident1",
"=",
"self",
".",
"CCident",
"(",
")",
"ident2",
... | https://github.com/travisgoodspeed/goodfet/blob/1750cc1e8588af5470385e52fa098ca7364c2863/client/GoodFETCC.py#L703-L740 | ||||
DxCx/plugin.video.9anime | 34358c2f701e5ddf19d3276926374a16f63f7b6a | resources/lib/ui/pyjsparser/pyjsparserdata.py | python | isKeyword | (w) | return w in KEYWORDS | [] | def isKeyword(w):
# 'const' is specialized as Keyword in V8.
# 'yield' and 'let' are for compatibility with SpiderMonkey and ES.next.
# Some others are from future reserved words.
return w in KEYWORDS | [
"def",
"isKeyword",
"(",
"w",
")",
":",
"# 'const' is specialized as Keyword in V8.",
"# 'yield' and 'let' are for compatibility with SpiderMonkey and ES.next.",
"# Some others are from future reserved words.",
"return",
"w",
"in",
"KEYWORDS"
] | https://github.com/DxCx/plugin.video.9anime/blob/34358c2f701e5ddf19d3276926374a16f63f7b6a/resources/lib/ui/pyjsparser/pyjsparserdata.py#L289-L293 | |||
microsoft/unilm | 65f15af2a307ebb64cfb25adf54375b002e6fe8d | xtune/src/transformers/commands/serving.py | python | ServeCommand.detokenize | (
self,
tokens_ids: List[int] = Body(None, embed=True),
skip_special_tokens: bool = Body(False, embed=True),
cleanup_tokenization_spaces: bool = Body(True, embed=True),
) | Detokenize the provided tokens ids to readable text:
- **tokens_ids**: List of tokens ids
- **skip_special_tokens**: Flag indicating to not try to decode special tokens
- **cleanup_tokenization_spaces**: Flag indicating to remove all leading/trailing spaces and intermediate ones. | Detokenize the provided tokens ids to readable text:
- **tokens_ids**: List of tokens ids
- **skip_special_tokens**: Flag indicating to not try to decode special tokens
- **cleanup_tokenization_spaces**: Flag indicating to remove all leading/trailing spaces and intermediate ones. | [
"Detokenize",
"the",
"provided",
"tokens",
"ids",
"to",
"readable",
"text",
":",
"-",
"**",
"tokens_ids",
"**",
":",
"List",
"of",
"tokens",
"ids",
"-",
"**",
"skip_special_tokens",
"**",
":",
"Flag",
"indicating",
"to",
"not",
"try",
"to",
"decode",
"spec... | def detokenize(
self,
tokens_ids: List[int] = Body(None, embed=True),
skip_special_tokens: bool = Body(False, embed=True),
cleanup_tokenization_spaces: bool = Body(True, embed=True),
):
"""
Detokenize the provided tokens ids to readable text:
- **tokens_ids**:... | [
"def",
"detokenize",
"(",
"self",
",",
"tokens_ids",
":",
"List",
"[",
"int",
"]",
"=",
"Body",
"(",
"None",
",",
"embed",
"=",
"True",
")",
",",
"skip_special_tokens",
":",
"bool",
"=",
"Body",
"(",
"False",
",",
"embed",
"=",
"True",
")",
",",
"c... | https://github.com/microsoft/unilm/blob/65f15af2a307ebb64cfb25adf54375b002e6fe8d/xtune/src/transformers/commands/serving.py#L180-L196 | ||
vaexio/vaex | 6c1571f4f1ac030eb7128c1b35b2ccbb5dd29cac | packages/vaex-core/vaex/__init__.py | python | from_scalars | (**kwargs) | return from_arrays(**{k: np.array([v]) for k, v in kwargs.items()}) | Similar to from_arrays, but convenient for a DataFrame of length 1.
Example:
>>> import vaex
>>> df = vaex.from_scalars(x=1, y=2)
:rtype: DataFrame | Similar to from_arrays, but convenient for a DataFrame of length 1. | [
"Similar",
"to",
"from_arrays",
"but",
"convenient",
"for",
"a",
"DataFrame",
"of",
"length",
"1",
"."
] | def from_scalars(**kwargs):
"""Similar to from_arrays, but convenient for a DataFrame of length 1.
Example:
>>> import vaex
>>> df = vaex.from_scalars(x=1, y=2)
:rtype: DataFrame
"""
import numpy as np
return from_arrays(**{k: np.array([v]) for k, v in kwargs.items()}) | [
"def",
"from_scalars",
"(",
"*",
"*",
"kwargs",
")",
":",
"import",
"numpy",
"as",
"np",
"return",
"from_arrays",
"(",
"*",
"*",
"{",
"k",
":",
"np",
".",
"array",
"(",
"[",
"v",
"]",
")",
"for",
"k",
",",
"v",
"in",
"kwargs",
".",
"items",
"("... | https://github.com/vaexio/vaex/blob/6c1571f4f1ac030eb7128c1b35b2ccbb5dd29cac/packages/vaex-core/vaex/__init__.py#L393-L404 | |
naftaliharris/tauthon | 5587ceec329b75f7caf6d65a036db61ac1bae214 | Lib/wsgiref/headers.py | python | Headers.add_header | (self, _name, _value, **_params) | Extended header setting.
_name is the header field to add. keyword arguments can be used to set
additional parameters for the header field, with underscores converted
to dashes. Normally the parameter will be added as key="value" unless
value is None, in which case only the key will b... | Extended header setting. | [
"Extended",
"header",
"setting",
"."
] | def add_header(self, _name, _value, **_params):
"""Extended header setting.
_name is the header field to add. keyword arguments can be used to set
additional parameters for the header field, with underscores converted
to dashes. Normally the parameter will be added as key="value" unle... | [
"def",
"add_header",
"(",
"self",
",",
"_name",
",",
"_value",
",",
"*",
"*",
"_params",
")",
":",
"parts",
"=",
"[",
"]",
"if",
"_value",
"is",
"not",
"None",
":",
"parts",
".",
"append",
"(",
"_value",
")",
"for",
"k",
",",
"v",
"in",
"_params"... | https://github.com/naftaliharris/tauthon/blob/5587ceec329b75f7caf6d65a036db61ac1bae214/Lib/wsgiref/headers.py#L145-L169 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/mistune.py | python | Renderer.image | (self, src, title, text) | return '%s>' % html | Rendering a image with title and text.
:param src: source link of the image.
:param title: title text of the image.
:param text: alt text of the image. | Rendering a image with title and text. | [
"Rendering",
"a",
"image",
"with",
"title",
"and",
"text",
"."
] | def image(self, src, title, text):
"""Rendering a image with title and text.
:param src: source link of the image.
:param title: title text of the image.
:param text: alt text of the image.
"""
src = escape_link(src)
text = escape(text, quote=True)
if tit... | [
"def",
"image",
"(",
"self",
",",
"src",
",",
"title",
",",
"text",
")",
":",
"src",
"=",
"escape_link",
"(",
"src",
")",
"text",
"=",
"escape",
"(",
"text",
",",
"quote",
"=",
"True",
")",
"if",
"title",
":",
"title",
"=",
"escape",
"(",
"title"... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/mistune.py#L868-L884 | |
CGCookie/retopoflow | 3d8b3a47d1d661f99ab0aeb21d31370bf15de35e | retopoflow/rfmesh/rfmesh.py | python | RFMesh.obj_viewport_unhide | (self) | [] | def obj_viewport_unhide(self): self.obj_viewport_hide_set(False) | [
"def",
"obj_viewport_unhide",
"(",
"self",
")",
":",
"self",
".",
"obj_viewport_hide_set",
"(",
"False",
")"
] | https://github.com/CGCookie/retopoflow/blob/3d8b3a47d1d661f99ab0aeb21d31370bf15de35e/retopoflow/rfmesh/rfmesh.py#L267-L267 | ||||
JiYou/openstack | 8607dd488bde0905044b303eb6e52bdea6806923 | packages/source/cinder/cinder/openstack/common/rpc/amqp.py | python | multicall | (conf, context, topic, msg, timeout, connection_pool) | return wait_msg | Make a call that returns multiple times. | Make a call that returns multiple times. | [
"Make",
"a",
"call",
"that",
"returns",
"multiple",
"times",
"."
] | def multicall(conf, context, topic, msg, timeout, connection_pool):
"""Make a call that returns multiple times."""
# TODO(pekowski): Remove all these comments in Havana.
# For amqp_rpc_single_reply_queue = False,
# Can't use 'with' for multicall, as it returns an iterator
# that will continue to use... | [
"def",
"multicall",
"(",
"conf",
",",
"context",
",",
"topic",
",",
"msg",
",",
"timeout",
",",
"connection_pool",
")",
":",
"# TODO(pekowski): Remove all these comments in Havana.",
"# For amqp_rpc_single_reply_queue = False,",
"# Can't use 'with' for multicall, as it returns an... | https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/cinder/cinder/openstack/common/rpc/amqp.py#L574-L606 | |
microsoft/unilm | 65f15af2a307ebb64cfb25adf54375b002e6fe8d | unilm-v1/src/cnndm/bs_pyrouge.py | python | Rouge155.write_config_static | (system_dir, system_filename_pattern,
model_dir, model_filename_pattern,
config_file_path, system_id=None) | Write the ROUGE configuration file, which is basically a list
of system summary files and their corresponding model summary
files.
pyrouge uses regular expressions to automatically find the
matching model summary files for a given system summary file
(cf. docstrings for system_f... | Write the ROUGE configuration file, which is basically a list
of system summary files and their corresponding model summary
files. | [
"Write",
"the",
"ROUGE",
"configuration",
"file",
"which",
"is",
"basically",
"a",
"list",
"of",
"system",
"summary",
"files",
"and",
"their",
"corresponding",
"model",
"summary",
"files",
"."
] | def write_config_static(system_dir, system_filename_pattern,
model_dir, model_filename_pattern,
config_file_path, system_id=None):
"""
Write the ROUGE configuration file, which is basically a list
of system summary files and their correspon... | [
"def",
"write_config_static",
"(",
"system_dir",
",",
"system_filename_pattern",
",",
"model_dir",
",",
"model_filename_pattern",
",",
"config_file_path",
",",
"system_id",
"=",
"None",
")",
":",
"system_filenames",
"=",
"[",
"f",
"for",
"f",
"in",
"os",
".",
"l... | https://github.com/microsoft/unilm/blob/65f15af2a307ebb64cfb25adf54375b002e6fe8d/unilm-v1/src/cnndm/bs_pyrouge.py#L271-L326 | ||
MediaBrowser/plugin.video.emby | 71162fc7704656833d8b228dc9014f88742215b1 | libraries/requests/packages/urllib3/packages/ordered_dict.py | python | OrderedDict.values | (self) | return [self[key] for key in self] | od.values() -> list of values in od | od.values() -> list of values in od | [
"od",
".",
"values",
"()",
"-",
">",
"list",
"of",
"values",
"in",
"od"
] | def values(self):
'od.values() -> list of values in od'
return [self[key] for key in self] | [
"def",
"values",
"(",
"self",
")",
":",
"return",
"[",
"self",
"[",
"key",
"]",
"for",
"key",
"in",
"self",
"]"
] | https://github.com/MediaBrowser/plugin.video.emby/blob/71162fc7704656833d8b228dc9014f88742215b1/libraries/requests/packages/urllib3/packages/ordered_dict.py#L120-L122 | |
mrJean1/PyGeodesy | 7da5ca71aa3edb7bc49e219e0b8190686e1a7965 | pygeodesy/utily.py | python | atan2b | (y, x) | return d | Return C{atan2(B{y}, B{x})} in degrees M{[0..+360]}.
@see: Function L{pygeodesy.atan2d}. | Return C{atan2(B{y}, B{x})} in degrees M{[0..+360]}. | [
"Return",
"C",
"{",
"atan2",
"(",
"B",
"{",
"y",
"}",
"B",
"{",
"x",
"}",
")",
"}",
"in",
"degrees",
"M",
"{",
"[",
"0",
"..",
"+",
"360",
"]",
"}",
"."
] | def atan2b(y, x):
'''Return C{atan2(B{y}, B{x})} in degrees M{[0..+360]}.
@see: Function L{pygeodesy.atan2d}.
'''
d = atan2d(y, x)
if d < 0:
d += _360_0
return d | [
"def",
"atan2b",
"(",
"y",
",",
"x",
")",
":",
"d",
"=",
"atan2d",
"(",
"y",
",",
"x",
")",
"if",
"d",
"<",
"0",
":",
"d",
"+=",
"_360_0",
"return",
"d"
] | https://github.com/mrJean1/PyGeodesy/blob/7da5ca71aa3edb7bc49e219e0b8190686e1a7965/pygeodesy/utily.py#L79-L87 | |
makerbot/ReplicatorG | d6f2b07785a5a5f1e172fb87cb4303b17c575d5d | skein_engines/skeinforge-35/skeinforge_application/skeinforge_plugins/craft_plugins/raft.py | python | RaftSkein.addEmptyLayerSupport | ( self, boundaryLayerIndex ) | Add support material to a layer if it is empty. | Add support material to a layer if it is empty. | [
"Add",
"support",
"material",
"to",
"a",
"layer",
"if",
"it",
"is",
"empty",
"."
] | def addEmptyLayerSupport( self, boundaryLayerIndex ):
"Add support material to a layer if it is empty."
supportLayer = SupportLayer( [] )
self.supportLayers.append( supportLayer )
if len( self.boundaryLayers[ boundaryLayerIndex ].loops ) > 0:
return
aboveXIntersectionsTable = {}
euclidean.addXIntersectio... | [
"def",
"addEmptyLayerSupport",
"(",
"self",
",",
"boundaryLayerIndex",
")",
":",
"supportLayer",
"=",
"SupportLayer",
"(",
"[",
"]",
")",
"self",
".",
"supportLayers",
".",
"append",
"(",
"supportLayer",
")",
"if",
"len",
"(",
"self",
".",
"boundaryLayers",
... | https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-35/skeinforge_application/skeinforge_plugins/craft_plugins/raft.py#L463-L473 | ||
andyzsf/TuShare | 92787ad0cd492614bdb6389b71a19c80d1c8c9ae | tushare/futures/ctp/futures/__init__.py | python | TraderApi.OnRspOrderAction | (self, pInputOrderAction, pRspInfo, nRequestID, bIsLast) | 报单操作请求响应 | 报单操作请求响应 | [
"报单操作请求响应"
] | def OnRspOrderAction(self, pInputOrderAction, pRspInfo, nRequestID, bIsLast):
"""报单操作请求响应""" | [
"def",
"OnRspOrderAction",
"(",
"self",
",",
"pInputOrderAction",
",",
"pRspInfo",
",",
"nRequestID",
",",
"bIsLast",
")",
":"
] | https://github.com/andyzsf/TuShare/blob/92787ad0cd492614bdb6389b71a19c80d1c8c9ae/tushare/futures/ctp/futures/__init__.py#L412-L413 | ||
ermongroup/ncsn | 7f27f4a16471d20a0af3be8b8b4c2ec57c8a0bc1 | models/pix2pix.py | python | GANLoss.__call__ | (self, prediction, target_is_real) | return loss | Calculate loss given Discriminator's output and grount truth labels.
Parameters:
prediction (tensor) - - tpyically the prediction output from a discriminator
target_is_real (bool) - - if the ground truth label is for real images or fake images
Returns:
the calculate... | Calculate loss given Discriminator's output and grount truth labels. | [
"Calculate",
"loss",
"given",
"Discriminator",
"s",
"output",
"and",
"grount",
"truth",
"labels",
"."
] | def __call__(self, prediction, target_is_real):
"""Calculate loss given Discriminator's output and grount truth labels.
Parameters:
prediction (tensor) - - tpyically the prediction output from a discriminator
target_is_real (bool) - - if the ground truth label is for real images... | [
"def",
"__call__",
"(",
"self",
",",
"prediction",
",",
"target_is_real",
")",
":",
"if",
"self",
".",
"gan_mode",
"in",
"[",
"'lsgan'",
",",
"'vanilla'",
"]",
":",
"target_tensor",
"=",
"self",
".",
"get_target_tensor",
"(",
"prediction",
",",
"target_is_re... | https://github.com/ermongroup/ncsn/blob/7f27f4a16471d20a0af3be8b8b4c2ec57c8a0bc1/models/pix2pix.py#L254-L272 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/sympy/core/expr.py | python | Expr.as_coeff_Add | (self, rational=False) | return S.Zero, self | Efficiently extract the coefficient of a summation. | Efficiently extract the coefficient of a summation. | [
"Efficiently",
"extract",
"the",
"coefficient",
"of",
"a",
"summation",
"."
] | def as_coeff_Add(self, rational=False):
"""Efficiently extract the coefficient of a summation. """
return S.Zero, self | [
"def",
"as_coeff_Add",
"(",
"self",
",",
"rational",
"=",
"False",
")",
":",
"return",
"S",
".",
"Zero",
",",
"self"
] | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/sympy/core/expr.py#L3320-L3322 | |
reviewboard/reviewboard | 7395902e4c181bcd1d633f61105012ffb1d18e1b | contrib/internal/prepare-dev.py | python | install_git_hooks | () | Install a post-checkout hook to delete pyc files. | Install a post-checkout hook to delete pyc files. | [
"Install",
"a",
"post",
"-",
"checkout",
"hook",
"to",
"delete",
"pyc",
"files",
"."
] | def install_git_hooks():
"""Install a post-checkout hook to delete pyc files."""
console.header('Setting up your Git tree')
console.print(
'Your Git tree will be set up with a default post-checkout hook '
'that clears any compiled Python files when switching branches.')
try:
git... | [
"def",
"install_git_hooks",
"(",
")",
":",
"console",
".",
"header",
"(",
"'Setting up your Git tree'",
")",
"console",
".",
"print",
"(",
"'Your Git tree will be set up with a default post-checkout hook '",
"'that clears any compiled Python files when switching branches.'",
")",
... | https://github.com/reviewboard/reviewboard/blob/7395902e4c181bcd1d633f61105012ffb1d18e1b/contrib/internal/prepare-dev.py#L101-L170 | ||
mozillazg/pypy | 2ff5cd960c075c991389f842c6d59e71cf0cb7d0 | lib-python/2.7/pydoc.py | python | gui | () | Graphical interface (starts web server and pops up a control window). | Graphical interface (starts web server and pops up a control window). | [
"Graphical",
"interface",
"(",
"starts",
"web",
"server",
"and",
"pops",
"up",
"a",
"control",
"window",
")",
"."
] | def gui():
"""Graphical interface (starts web server and pops up a control window)."""
class GUI:
def __init__(self, window, port=7464):
self.window = window
self.server = None
self.scanner = None
import Tkinter
self.server_frm = Tkinter.Frame... | [
"def",
"gui",
"(",
")",
":",
"class",
"GUI",
":",
"def",
"__init__",
"(",
"self",
",",
"window",
",",
"port",
"=",
"7464",
")",
":",
"self",
".",
"window",
"=",
"window",
"self",
".",
"server",
"=",
"None",
"self",
".",
"scanner",
"=",
"None",
"i... | https://github.com/mozillazg/pypy/blob/2ff5cd960c075c991389f842c6d59e71cf0cb7d0/lib-python/2.7/pydoc.py#L2149-L2331 | ||
OmniSharp/omnisharp-sublime | 19baf3c4d350193af0f8da1ae5a8df0fa6cded61 | lib/view/_view.py | python | rowwidth | (view, row) | return view.rowcol(view.line(view.text_point(row, 0)).end())[1] + 1 | Returns the 1-based number of characters of ``row`` in ``view``. | Returns the 1-based number of characters of ``row`` in ``view``. | [
"Returns",
"the",
"1",
"-",
"based",
"number",
"of",
"characters",
"of",
"row",
"in",
"view",
"."
] | def rowwidth(view, row):
"""Returns the 1-based number of characters of ``row`` in ``view``.
"""
return view.rowcol(view.line(view.text_point(row, 0)).end())[1] + 1 | [
"def",
"rowwidth",
"(",
"view",
",",
"row",
")",
":",
"return",
"view",
".",
"rowcol",
"(",
"view",
".",
"line",
"(",
"view",
".",
"text_point",
"(",
"row",
",",
"0",
")",
")",
".",
"end",
"(",
")",
")",
"[",
"1",
"]",
"+",
"1"
] | https://github.com/OmniSharp/omnisharp-sublime/blob/19baf3c4d350193af0f8da1ae5a8df0fa6cded61/lib/view/_view.py#L141-L144 | |
yeti-platform/yeti | fcd3ee3d3d064df772d0392c20c22aad2bc4c8e6 | extras/yeti_to_elasticsearch.py | python | YetiFeedSender.__init__ | (
self,
elastic_index,
excluded_feeds=set(),
mongo_client=None,
mongo_hostname="localhost",
elastic_instance=None,
elastic_hostname=None,
elastic_port=9200,
elastic_user=None,
elastic_pass=None,
elastic_use_ssl=None,
elastic... | This class connects to YETI's MongoDB and to Elasticsearch.
It parses the observable collection in YETI's MongoDB and sends to Elasticsearch.
:param elastic_index: Elastic Stack index name.
:param excluded_feeds: Set that includes feeds to exclude from indexing.
:param mongo_client: ... | This class connects to YETI's MongoDB and to Elasticsearch.
It parses the observable collection in YETI's MongoDB and sends to Elasticsearch.
:param elastic_index: Elastic Stack index name.
:param excluded_feeds: Set that includes feeds to exclude from indexing.
:param mongo_client: ... | [
"This",
"class",
"connects",
"to",
"YETI",
"s",
"MongoDB",
"and",
"to",
"Elasticsearch",
".",
"It",
"parses",
"the",
"observable",
"collection",
"in",
"YETI",
"s",
"MongoDB",
"and",
"sends",
"to",
"Elasticsearch",
".",
":",
"param",
"elastic_index",
":",
"El... | def __init__(
self,
elastic_index,
excluded_feeds=set(),
mongo_client=None,
mongo_hostname="localhost",
elastic_instance=None,
elastic_hostname=None,
elastic_port=9200,
elastic_user=None,
elastic_pass=None,
elastic_use_ssl=None,
... | [
"def",
"__init__",
"(",
"self",
",",
"elastic_index",
",",
"excluded_feeds",
"=",
"set",
"(",
")",
",",
"mongo_client",
"=",
"None",
",",
"mongo_hostname",
"=",
"\"localhost\"",
",",
"elastic_instance",
"=",
"None",
",",
"elastic_hostname",
"=",
"None",
",",
... | https://github.com/yeti-platform/yeti/blob/fcd3ee3d3d064df772d0392c20c22aad2bc4c8e6/extras/yeti_to_elasticsearch.py#L45-L101 | ||
Kismuz/btgym | 7fb3316e67f1d7a17c620630fb62fb29428b2cec | btgym/research/model_based/aac.py | python | AMLDG.start | (self, sess, summary_writer, **kwargs) | Executes all initializing operations,
starts environment runner[s].
Supposed to be called by parent worker just before training loop starts.
Args:
sess: tf session object.
kwargs: not used by default. | Executes all initializing operations,
starts environment runner[s].
Supposed to be called by parent worker just before training loop starts. | [
"Executes",
"all",
"initializing",
"operations",
"starts",
"environment",
"runner",
"[",
"s",
"]",
".",
"Supposed",
"to",
"be",
"called",
"by",
"parent",
"worker",
"just",
"before",
"training",
"loop",
"starts",
"."
] | def start(self, sess, summary_writer, **kwargs):
"""
Executes all initializing operations,
starts environment runner[s].
Supposed to be called by parent worker just before training loop starts.
Args:
sess: tf session object.
kwargs: not ... | [
"def",
"start",
"(",
"self",
",",
"sess",
",",
"summary_writer",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"# Copy weights from global to local:",
"sess",
".",
"run",
"(",
"self",
".",
"critic_aac",
".",
"sync_pi",
")",
"sess",
".",
"run",
"(",
"sel... | https://github.com/Kismuz/btgym/blob/7fb3316e67f1d7a17c620630fb62fb29428b2cec/btgym/research/model_based/aac.py#L328-L364 | ||
malllabiisc/CompGCN | 3b06f5fec42526faa81afc158df9e64a8382982c | model/compgcn_conv.py | python | CompGCNConv.update | (self, aggr_out) | return aggr_out | [] | def update(self, aggr_out):
return aggr_out | [
"def",
"update",
"(",
"self",
",",
"aggr_out",
")",
":",
"return",
"aggr_out"
] | https://github.com/malllabiisc/CompGCN/blob/3b06f5fec42526faa81afc158df9e64a8382982c/model/compgcn_conv.py#L69-L70 | |||
partho-maple/coding-interview-gym | f9b28916da31935a27900794cfb8b91be3b38b9b | leetcode.com/python/278_First_Bad_Version.py | python | Solution.firstBadVersion | (self, n) | return left | :type n: int
:rtype: int | :type n: int
:rtype: int | [
":",
"type",
"n",
":",
"int",
":",
"rtype",
":",
"int"
] | def firstBadVersion(self, n):
"""
:type n: int
:rtype: int
"""
left, right = 0, n
while left < right:
mid = (left + right) // 2
isBad = isBadVersion(mid)
if isBad:
right = mid
else:
left = mid... | [
"def",
"firstBadVersion",
"(",
"self",
",",
"n",
")",
":",
"left",
",",
"right",
"=",
"0",
",",
"n",
"while",
"left",
"<",
"right",
":",
"mid",
"=",
"(",
"left",
"+",
"right",
")",
"//",
"2",
"isBad",
"=",
"isBadVersion",
"(",
"mid",
")",
"if",
... | https://github.com/partho-maple/coding-interview-gym/blob/f9b28916da31935a27900794cfb8b91be3b38b9b/leetcode.com/python/278_First_Bad_Version.py#L7-L20 | |
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-linux/x64/tornado/web.py | python | StaticFileHandler.should_return_304 | (self) | return False | Returns True if the headers indicate that we should return 304.
.. versionadded:: 3.1 | Returns True if the headers indicate that we should return 304. | [
"Returns",
"True",
"if",
"the",
"headers",
"indicate",
"that",
"we",
"should",
"return",
"304",
"."
] | def should_return_304(self) -> bool:
"""Returns True if the headers indicate that we should return 304.
.. versionadded:: 3.1
"""
# If client sent If-None-Match, use it, ignore If-Modified-Since
if self.request.headers.get("If-None-Match"):
return self.check_etag_hea... | [
"def",
"should_return_304",
"(",
"self",
")",
"->",
"bool",
":",
"# If client sent If-None-Match, use it, ignore If-Modified-Since",
"if",
"self",
".",
"request",
".",
"headers",
".",
"get",
"(",
"\"If-None-Match\"",
")",
":",
"return",
"self",
".",
"check_etag_header... | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-linux/x64/tornado/web.py#L2699-L2719 | |
leapcode/bitmask_client | d2fe20df24fc6eaf146fa5ce1e847de6ab515688 | src/leap/bitmask/gui/passwordwindow.py | python | PasswordWindow._change_password | (self) | TRIGGERS:
self.ui.buttonBox.accepted
Changes the user's password if the inputboxes are correctly filled. | TRIGGERS:
self.ui.buttonBox.accepted | [
"TRIGGERS",
":",
"self",
".",
"ui",
".",
"buttonBox",
".",
"accepted"
] | def _change_password(self):
"""
TRIGGERS:
self.ui.buttonBox.accepted
Changes the user's password if the inputboxes are correctly filled.
"""
current_password = self.ui.current_password_lineedit.text()
new_password = self.ui.new_password_lineedit.text()
... | [
"def",
"_change_password",
"(",
"self",
")",
":",
"current_password",
"=",
"self",
".",
"ui",
".",
"current_password_lineedit",
".",
"text",
"(",
")",
"new_password",
"=",
"self",
".",
"ui",
".",
"new_password_lineedit",
".",
"text",
"(",
")",
"new_password2",... | https://github.com/leapcode/bitmask_client/blob/d2fe20df24fc6eaf146fa5ce1e847de6ab515688/src/leap/bitmask/gui/passwordwindow.py#L152-L183 | ||
mozillazg/pypy | 2ff5cd960c075c991389f842c6d59e71cf0cb7d0 | lib-python/2.7/traceback.py | python | _format_final_exc_line | (etype, value, _encoding=None) | return line | Return a list of a single line -- normal case for format_exception_only | Return a list of a single line -- normal case for format_exception_only | [
"Return",
"a",
"list",
"of",
"a",
"single",
"line",
"--",
"normal",
"case",
"for",
"format_exception_only"
] | def _format_final_exc_line(etype, value, _encoding=None):
"""Return a list of a single line -- normal case for format_exception_only"""
valuestr = _some_str(value, _encoding)
if value is None or not valuestr:
line = "%s\n" % etype
else:
line = "%s: %s\n" % (etype, valuestr)
return li... | [
"def",
"_format_final_exc_line",
"(",
"etype",
",",
"value",
",",
"_encoding",
"=",
"None",
")",
":",
"valuestr",
"=",
"_some_str",
"(",
"value",
",",
"_encoding",
")",
"if",
"value",
"is",
"None",
"or",
"not",
"valuestr",
":",
"line",
"=",
"\"%s\\n\"",
... | https://github.com/mozillazg/pypy/blob/2ff5cd960c075c991389f842c6d59e71cf0cb7d0/lib-python/2.7/traceback.py#L203-L210 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Lib/pkgutil.py | python | ImpLoader._get_delegate | (self) | return ImpImporter(self.filename).find_module('__init__') | [] | def _get_delegate(self):
return ImpImporter(self.filename).find_module('__init__') | [
"def",
"_get_delegate",
"(",
"self",
")",
":",
"return",
"ImpImporter",
"(",
"self",
".",
"filename",
")",
".",
"find_module",
"(",
"'__init__'",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/pkgutil.py#L314-L315 | |||
PaddlePaddle/PaddleSpeech | 26524031d242876b7fdb71582b0b3a7ea45c7d9d | paddlespeech/s2t/decoders/beam_search/beam_search.py | python | BeamSearch.search | (self, running_hyps: List[Hypothesis],
x: paddle.Tensor) | return best_hyps | Search new tokens for running hypotheses and encoded speech x.
Args:
running_hyps (List[Hypothesis]): Running hypotheses on beam
x (paddle.Tensor): Encoded speech feature (T, D)
Returns:
List[Hypotheses]: Best sorted hypotheses | Search new tokens for running hypotheses and encoded speech x. | [
"Search",
"new",
"tokens",
"for",
"running",
"hypotheses",
"and",
"encoded",
"speech",
"x",
"."
] | def search(self, running_hyps: List[Hypothesis],
x: paddle.Tensor) -> List[Hypothesis]:
"""Search new tokens for running hypotheses and encoded speech x.
Args:
running_hyps (List[Hypothesis]): Running hypotheses on beam
x (paddle.Tensor): Encoded speech feature (T... | [
"def",
"search",
"(",
"self",
",",
"running_hyps",
":",
"List",
"[",
"Hypothesis",
"]",
",",
"x",
":",
"paddle",
".",
"Tensor",
")",
"->",
"List",
"[",
"Hypothesis",
"]",
":",
"best_hyps",
"=",
"[",
"]",
"part_ids",
"=",
"paddle",
".",
"arange",
"(",... | https://github.com/PaddlePaddle/PaddleSpeech/blob/26524031d242876b7fdb71582b0b3a7ea45c7d9d/paddlespeech/s2t/decoders/beam_search/beam_search.py#L301-L350 | |
khanhnamle1994/natural-language-processing | 01d450d5ac002b0156ef4cf93a07cb508c1bcdc5 | assignment1/.env/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py | python | get_default_cache | () | return (
os.environ.get('PYTHON_EGG_CACHE')
or appdirs.user_cache_dir(appname='Python-Eggs')
) | Return the ``PYTHON_EGG_CACHE`` environment variable
or a platform-relevant user cache dir for an app
named "Python-Eggs". | Return the ``PYTHON_EGG_CACHE`` environment variable
or a platform-relevant user cache dir for an app
named "Python-Eggs". | [
"Return",
"the",
"PYTHON_EGG_CACHE",
"environment",
"variable",
"or",
"a",
"platform",
"-",
"relevant",
"user",
"cache",
"dir",
"for",
"an",
"app",
"named",
"Python",
"-",
"Eggs",
"."
] | def get_default_cache():
"""
Return the ``PYTHON_EGG_CACHE`` environment variable
or a platform-relevant user cache dir for an app
named "Python-Eggs".
"""
return (
os.environ.get('PYTHON_EGG_CACHE')
or appdirs.user_cache_dir(appname='Python-Eggs')
) | [
"def",
"get_default_cache",
"(",
")",
":",
"return",
"(",
"os",
".",
"environ",
".",
"get",
"(",
"'PYTHON_EGG_CACHE'",
")",
"or",
"appdirs",
".",
"user_cache_dir",
"(",
"appname",
"=",
"'Python-Eggs'",
")",
")"
] | https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py#L1361-L1370 | |
chainer/chainer | e9da1423255c58c37be9733f51b158aa9b39dc93 | chainer/__init__.py | python | is_debug | () | return bool(config.__getattr__('debug')) | Returns if the debug mode is enabled or not in the current thread.
Returns:
bool: ``True`` if the debug mode is enabled. | Returns if the debug mode is enabled or not in the current thread. | [
"Returns",
"if",
"the",
"debug",
"mode",
"is",
"enabled",
"or",
"not",
"in",
"the",
"current",
"thread",
"."
] | def is_debug():
"""Returns if the debug mode is enabled or not in the current thread.
Returns:
bool: ``True`` if the debug mode is enabled.
"""
return bool(config.__getattr__('debug')) | [
"def",
"is_debug",
"(",
")",
":",
"return",
"bool",
"(",
"config",
".",
"__getattr__",
"(",
"'debug'",
")",
")"
] | https://github.com/chainer/chainer/blob/e9da1423255c58c37be9733f51b158aa9b39dc93/chainer/__init__.py#L240-L246 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.