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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
tendenci/tendenci | 0f2c348cc0e7d41bc56f50b00ce05544b083bf1d | tendenci/apps/memberships/templatetags/membership_tags.py | python | get_membership_app | (context, app_id) | return membership_app | Get membership app by id. | Get membership app by id. | [
"Get",
"membership",
"app",
"by",
"id",
"."
] | def get_membership_app(context, app_id):
"""
Get membership app by id.
"""
from tendenci.apps.memberships.models import MembershipApp
from tendenci.apps.perms.utils import has_perm
request = context.get('request')
if not has_perm(request.user, 'memberships.view_membershipapp'):
... | [
"def",
"get_membership_app",
"(",
"context",
",",
"app_id",
")",
":",
"from",
"tendenci",
".",
"apps",
".",
"memberships",
".",
"models",
"import",
"MembershipApp",
"from",
"tendenci",
".",
"apps",
".",
"perms",
".",
"utils",
"import",
"has_perm",
"request",
... | https://github.com/tendenci/tendenci/blob/0f2c348cc0e7d41bc56f50b00ce05544b083bf1d/tendenci/apps/memberships/templatetags/membership_tags.py#L99-L115 | |
uqfoundation/multiprocess | 028cc73f02655e6451d92e5147d19d8c10aebe50 | py3.2/multiprocess/util.py | python | log_to_stderr | (level=None) | return _logger | Turn on logging and add a handler which prints to stderr | Turn on logging and add a handler which prints to stderr | [
"Turn",
"on",
"logging",
"and",
"add",
"a",
"handler",
"which",
"prints",
"to",
"stderr"
] | def log_to_stderr(level=None):
'''
Turn on logging and add a handler which prints to stderr
'''
global _log_to_stderr
import logging
logger = get_logger()
formatter = logging.Formatter(DEFAULT_LOGGING_FORMAT)
handler = logging.StreamHandler()
handler.setFormatter(formatter)
logg... | [
"def",
"log_to_stderr",
"(",
"level",
"=",
"None",
")",
":",
"global",
"_log_to_stderr",
"import",
"logging",
"logger",
"=",
"get_logger",
"(",
")",
"formatter",
"=",
"logging",
".",
"Formatter",
"(",
"DEFAULT_LOGGING_FORMAT",
")",
"handler",
"=",
"logging",
"... | https://github.com/uqfoundation/multiprocess/blob/028cc73f02655e6451d92e5147d19d8c10aebe50/py3.2/multiprocess/util.py#L111-L127 | |
tensorflow/federated | 5a60a032360087b8f4c7fcfd97ed1c0131c3eac3 | tensorflow_federated/python/core/impl/types/type_analysis.py | python | is_numeric_dtype | (dtype) | return dtype.is_integer or dtype.is_floating or dtype.is_complex | Returns True iff `dtype` is numeric.
Args:
dtype: An instance of tf.DType.
Returns:
True iff `dtype` is numeric, i.e., integer, float, or complex. | Returns True iff `dtype` is numeric. | [
"Returns",
"True",
"iff",
"dtype",
"is",
"numeric",
"."
] | def is_numeric_dtype(dtype):
"""Returns True iff `dtype` is numeric.
Args:
dtype: An instance of tf.DType.
Returns:
True iff `dtype` is numeric, i.e., integer, float, or complex.
"""
py_typecheck.check_type(dtype, tf.DType)
return dtype.is_integer or dtype.is_floating or dtype.is_complex | [
"def",
"is_numeric_dtype",
"(",
"dtype",
")",
":",
"py_typecheck",
".",
"check_type",
"(",
"dtype",
",",
"tf",
".",
"DType",
")",
"return",
"dtype",
".",
"is_integer",
"or",
"dtype",
".",
"is_floating",
"or",
"dtype",
".",
"is_complex"
] | https://github.com/tensorflow/federated/blob/5a60a032360087b8f4c7fcfd97ed1c0131c3eac3/tensorflow_federated/python/core/impl/types/type_analysis.py#L273-L283 | |
pupil-labs/pupil | a712f94c9f38afddd64c841362e167b8ce293769 | pupil_src/shared_modules/head_pose_tracker/function/utils.py | python | rod_to_euler | (rotation_pose) | return np.rad2deg([x, y, z]) | :param rotation_pose: Compact Rodrigues rotation vector, representing
the rotation axis with its length encoding the angle in radians to rotate
:return: x,y,z: Orientation in the Pitch, Roll and Yaw axes as Euler angles
according to 'right hand' convention | :param rotation_pose: Compact Rodrigues rotation vector, representing
the rotation axis with its length encoding the angle in radians to rotate
:return: x,y,z: Orientation in the Pitch, Roll and Yaw axes as Euler angles
according to 'right hand' convention | [
":",
"param",
"rotation_pose",
":",
"Compact",
"Rodrigues",
"rotation",
"vector",
"representing",
"the",
"rotation",
"axis",
"with",
"its",
"length",
"encoding",
"the",
"angle",
"in",
"radians",
"to",
"rotate",
":",
"return",
":",
"x",
"y",
"z",
":",
"Orient... | def rod_to_euler(rotation_pose):
"""
:param rotation_pose: Compact Rodrigues rotation vector, representing
the rotation axis with its length encoding the angle in radians to rotate
:return: x,y,z: Orientation in the Pitch, Roll and Yaw axes as Euler angles
according to 'right hand' convention
""... | [
"def",
"rod_to_euler",
"(",
"rotation_pose",
")",
":",
"# convert Rodrigues rotation vector to matrix",
"rot",
"=",
"cv2",
".",
"Rodrigues",
"(",
"rotation_pose",
")",
"[",
"0",
"]",
"# rotate 180 degrees in y- and z-axes (corresponds to yaw and roll) to align",
"# with right h... | https://github.com/pupil-labs/pupil/blob/a712f94c9f38afddd64c841362e167b8ce293769/pupil_src/shared_modules/head_pose_tracker/function/utils.py#L62-L88 | |
lmjohns3/theanets | 79db9f878ef2071f2f576a1cf5d43a752a55894a | theanets/regularizers.py | python | WeightL2.loss | (self, layers, outputs) | return sum((v * v).mean() for v in variables) / len(variables) | [] | def loss(self, layers, outputs):
matches = util.params_matching(layers, self.pattern)
variables = [var for _, var in matches if var.ndim > 1]
if not variables:
return 0
return sum((v * v).mean() for v in variables) / len(variables) | [
"def",
"loss",
"(",
"self",
",",
"layers",
",",
"outputs",
")",
":",
"matches",
"=",
"util",
".",
"params_matching",
"(",
"layers",
",",
"self",
".",
"pattern",
")",
"variables",
"=",
"[",
"var",
"for",
"_",
",",
"var",
"in",
"matches",
"if",
"var",
... | https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/regularizers.py#L255-L260 | |||
DonnchaC/shadowbrokers-exploits | 42d8265db860b634717da4faa668b2670457cf7e | windows/fuzzbunch/plugin.py | python | Plugin.hasValidValue | (self, name) | return self._trch_hasvalidvalue(name) | Check if a parameter of the whole set has a valid value | Check if a parameter of the whole set has a valid value | [
"Check",
"if",
"a",
"parameter",
"of",
"the",
"whole",
"set",
"has",
"a",
"valid",
"value"
] | def hasValidValue(self, name):
"""Check if a parameter of the whole set has a valid value"""
return self._trch_hasvalidvalue(name) | [
"def",
"hasValidValue",
"(",
"self",
",",
"name",
")",
":",
"return",
"self",
".",
"_trch_hasvalidvalue",
"(",
"name",
")"
] | https://github.com/DonnchaC/shadowbrokers-exploits/blob/42d8265db860b634717da4faa668b2670457cf7e/windows/fuzzbunch/plugin.py#L289-L291 | |
OpenMDAO/OpenMDAO1 | 791a6fbbb7d266f3dcbc1f7bde3ae03a70dc1317 | openmdao/core/system.py | python | _SysData._scoped_abs_name | (self, name) | Args
----
name : str
The absolute pathname of a variable.
Returns
-------
str
The given name as seen from the 'scope' of the current `System`. | Args
----
name : str
The absolute pathname of a variable. | [
"Args",
"----",
"name",
":",
"str",
"The",
"absolute",
"pathname",
"of",
"a",
"variable",
"."
] | def _scoped_abs_name(self, name):
"""
Args
----
name : str
The absolute pathname of a variable.
Returns
-------
str
The given name as seen from the 'scope' of the current `System`.
"""
if self.pathname:
return n... | [
"def",
"_scoped_abs_name",
"(",
"self",
",",
"name",
")",
":",
"if",
"self",
".",
"pathname",
":",
"return",
"name",
"[",
"len",
"(",
"self",
".",
"pathname",
")",
"+",
"1",
":",
"]",
"else",
":",
"return",
"name"
] | https://github.com/OpenMDAO/OpenMDAO1/blob/791a6fbbb7d266f3dcbc1f7bde3ae03a70dc1317/openmdao/core/system.py#L78-L93 | ||
ganglia/gmond_python_modules | 2f7fcab3d27926ef4a2feb1b53c09af16a43e729 | nginx_status/python_modules/nginx_status.py | python | UpdateNginxThread.refresh_settings | (self) | return True | [] | def refresh_settings(self):
logging.debug(' refreshing server settings')
try:
p = subprocess.Popen(executable=self.nginx_bin, args=[self.nginx_bin, '-v'], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = p.communicate()
except:
logging.w... | [
"def",
"refresh_settings",
"(",
"self",
")",
":",
"logging",
".",
"debug",
"(",
"' refreshing server settings'",
")",
"try",
":",
"p",
"=",
"subprocess",
".",
"Popen",
"(",
"executable",
"=",
"self",
".",
"nginx_bin",
",",
"args",
"=",
"[",
"self",
".",
... | https://github.com/ganglia/gmond_python_modules/blob/2f7fcab3d27926ef4a2feb1b53c09af16a43e729/nginx_status/python_modules/nginx_status.py#L110-L144 | |||
dmlc/dgl | 8d14a739bc9e446d6c92ef83eafe5782398118de | python/dgl/distributed/graph_partition_book.py | python | GraphPartitionBook.num_partitions | (self) | Return the number of partitions.
Returns
-------
int
number of partitions | Return the number of partitions. | [
"Return",
"the",
"number",
"of",
"partitions",
"."
] | def num_partitions(self):
"""Return the number of partitions.
Returns
-------
int
number of partitions
""" | [
"def",
"num_partitions",
"(",
"self",
")",
":"
] | https://github.com/dmlc/dgl/blob/8d14a739bc9e446d6c92ef83eafe5782398118de/python/dgl/distributed/graph_partition_book.py#L220-L227 | ||
seopbo/nlp_classification | 21ea6e3f5737e7074bdd8dd190e5f5172f86f6bf | BERT_pairwise_text_classification/model/metric.py | python | evaluate | (model, data_loader, metrics, device) | return summary | [] | def evaluate(model, data_loader, metrics, device):
if model.training:
model.eval()
summary = {metric: 0 for metric in metrics}
for step, mb in tqdm(enumerate(data_loader), desc='steps', total=len(data_loader)):
x_mb, x_types_mb, y_mb = map(lambda elm: elm.to(device), mb)
with torc... | [
"def",
"evaluate",
"(",
"model",
",",
"data_loader",
",",
"metrics",
",",
"device",
")",
":",
"if",
"model",
".",
"training",
":",
"model",
".",
"eval",
"(",
")",
"summary",
"=",
"{",
"metric",
":",
"0",
"for",
"metric",
"in",
"metrics",
"}",
"for",
... | https://github.com/seopbo/nlp_classification/blob/21ea6e3f5737e7074bdd8dd190e5f5172f86f6bf/BERT_pairwise_text_classification/model/metric.py#L5-L23 | |||
hirofumi0810/neural_sp | b91877c6d2a11f06026480ab422176274d88cbf2 | neural_sp/models/lm/rnnlm.py | python | RNNLM.zero_state | (self, batch_size) | return state | Initialize hidden state.
Args:
batch_size (int): batch size
Returns:
state (dict):
hxs (FloatTensor): `[n_layers, B, n_units]`
cxs (FloatTensor): `[n_layers, B, n_units]` | Initialize hidden state. | [
"Initialize",
"hidden",
"state",
"."
] | def zero_state(self, batch_size):
"""Initialize hidden state.
Args:
batch_size (int): batch size
Returns:
state (dict):
hxs (FloatTensor): `[n_layers, B, n_units]`
cxs (FloatTensor): `[n_layers, B, n_units]`
"""
w = next(s... | [
"def",
"zero_state",
"(",
"self",
",",
"batch_size",
")",
":",
"w",
"=",
"next",
"(",
"self",
".",
"parameters",
"(",
")",
")",
"state",
"=",
"{",
"'hxs'",
":",
"None",
",",
"'cxs'",
":",
"None",
"}",
"state",
"[",
"'hxs'",
"]",
"=",
"w",
".",
... | https://github.com/hirofumi0810/neural_sp/blob/b91877c6d2a11f06026480ab422176274d88cbf2/neural_sp/models/lm/rnnlm.py#L231-L246 | |
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/full/idlelib/debugger.py | python | Debugger.clear_file_breaks | (self, filename) | [] | def clear_file_breaks(self, filename):
self.idb.clear_all_file_breaks(filename) | [
"def",
"clear_file_breaks",
"(",
"self",
",",
"filename",
")",
":",
"self",
".",
"idb",
".",
"clear_all_file_breaks",
"(",
"filename",
")"
] | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/idlelib/debugger.py#L362-L363 | ||||
LinOTP/LinOTP | bb3940bbaccea99550e6c063ff824f258dd6d6d7 | linotp/controllers/manage.py | python | ManageController._flexi_error | (self, error) | return json.dumps(
{
"page": 1,
"total": 1,
"rows": [
{
"id": "error",
"cell": ["E r r o r", error, "", "", "", "", "", ""],
}
],
},
... | [] | def _flexi_error(self, error):
return json.dumps(
{
"page": 1,
"total": 1,
"rows": [
{
"id": "error",
"cell": ["E r r o r", error, "", "", "", "", "", ""],
}
... | [
"def",
"_flexi_error",
"(",
"self",
",",
"error",
")",
":",
"return",
"json",
".",
"dumps",
"(",
"{",
"\"page\"",
":",
"1",
",",
"\"total\"",
":",
"1",
",",
"\"rows\"",
":",
"[",
"{",
"\"id\"",
":",
"\"error\"",
",",
"\"cell\"",
":",
"[",
"\"E r r o ... | https://github.com/LinOTP/LinOTP/blob/bb3940bbaccea99550e6c063ff824f258dd6d6d7/linotp/controllers/manage.py#L363-L376 | |||
my8100/scrapydweb | 7a3b81dba2cba4279c9465064a693bb277ac20e9 | scrapydweb/views/operations/deploy.py | python | DeployView.parse_scrapy_cfg | (self) | [] | def parse_scrapy_cfg(self):
for (idx, scrapy_cfg) in enumerate(self.scrapy_cfg_list):
folder = self.folders[idx]
key = '%s (%s)' % (folder, self.modification_times[idx])
project = folder_project_dict.get(key, '')
if project:
self.projects.append(p... | [
"def",
"parse_scrapy_cfg",
"(",
"self",
")",
":",
"for",
"(",
"idx",
",",
"scrapy_cfg",
")",
"in",
"enumerate",
"(",
"self",
".",
"scrapy_cfg_list",
")",
":",
"folder",
"=",
"self",
".",
"folders",
"[",
"idx",
"]",
"key",
"=",
"'%s (%s)'",
"%",
"(",
... | https://github.com/my8100/scrapydweb/blob/7a3b81dba2cba4279c9465064a693bb277ac20e9/scrapydweb/views/operations/deploy.py#L142-L175 | ||||
carnal0wnage/weirdAAL | c14e36d7bb82447f38a43da203f4bc29429f4cf4 | libs/aws/config.py | python | delete_config_rule | (rule_name, region) | delete config rule (makes sure you passed a rule name) | delete config rule (makes sure you passed a rule name) | [
"delete",
"config",
"rule",
"(",
"makes",
"sure",
"you",
"passed",
"a",
"rule",
"name",
")"
] | def delete_config_rule(rule_name, region):
'''
delete config rule (makes sure you passed a rule name)
'''
if rule_name:
delete_rule(rule_name, region) | [
"def",
"delete_config_rule",
"(",
"rule_name",
",",
"region",
")",
":",
"if",
"rule_name",
":",
"delete_rule",
"(",
"rule_name",
",",
"region",
")"
] | https://github.com/carnal0wnage/weirdAAL/blob/c14e36d7bb82447f38a43da203f4bc29429f4cf4/libs/aws/config.py#L167-L172 | ||
klmitch/turnstile | 8fe9a359b45e505d3192ab193ecf9be177ab1a17 | turnstile/limits.py | python | Bucket.dehydrate | (self) | return result | Return a dict representing this bucket. | Return a dict representing this bucket. | [
"Return",
"a",
"dict",
"representing",
"this",
"bucket",
"."
] | def dehydrate(self):
"""Return a dict representing this bucket."""
# Only concerned about very specific attributes
result = {}
for attr in self.attrs:
result[attr] = getattr(self, attr)
return result | [
"def",
"dehydrate",
"(",
"self",
")",
":",
"# Only concerned about very specific attributes",
"result",
"=",
"{",
"}",
"for",
"attr",
"in",
"self",
".",
"attrs",
":",
"result",
"[",
"attr",
"]",
"=",
"getattr",
"(",
"self",
",",
"attr",
")",
"return",
"res... | https://github.com/klmitch/turnstile/blob/8fe9a359b45e505d3192ab193ecf9be177ab1a17/turnstile/limits.py#L464-L472 | |
CSTR-Edinburgh/merlin | 33fa6e65ddb903ed5633ccb66c74d3e7c128667f | src/layers/lhuc_layer.py | python | LstmBase_LHUC.lstm_as_activation_function | (self) | A genetic recurrent activation function for variants of LSTM architectures.
The function is called by self.recurrent_fn(). | A genetic recurrent activation function for variants of LSTM architectures.
The function is called by self.recurrent_fn(). | [
"A",
"genetic",
"recurrent",
"activation",
"function",
"for",
"variants",
"of",
"LSTM",
"architectures",
".",
"The",
"function",
"is",
"called",
"by",
"self",
".",
"recurrent_fn",
"()",
"."
] | def lstm_as_activation_function(self):
""" A genetic recurrent activation function for variants of LSTM architectures.
The function is called by self.recurrent_fn().
"""
pass | [
"def",
"lstm_as_activation_function",
"(",
"self",
")",
":",
"pass"
] | https://github.com/CSTR-Edinburgh/merlin/blob/33fa6e65ddb903ed5633ccb66c74d3e7c128667f/src/layers/lhuc_layer.py#L186-L191 | ||
sympy/sympy | d822fcba181155b85ff2b29fe525adbafb22b448 | sympy/polys/matrices/domainmatrix.py | python | DomainMatrix.transpose | (self) | return self.from_rep(self.rep.transpose()) | Matrix transpose of ``self`` | Matrix transpose of ``self`` | [
"Matrix",
"transpose",
"of",
"self"
] | def transpose(self):
"""Matrix transpose of ``self``"""
return self.from_rep(self.rep.transpose()) | [
"def",
"transpose",
"(",
"self",
")",
":",
"return",
"self",
".",
"from_rep",
"(",
"self",
".",
"rep",
".",
"transpose",
"(",
")",
")"
] | https://github.com/sympy/sympy/blob/d822fcba181155b85ff2b29fe525adbafb22b448/sympy/polys/matrices/domainmatrix.py#L678-L680 | |
greedo/python-xbrl | 42ec8a9cb80c5d5bdbd423a0d427ed89823a3fd2 | xbrl/xbrl.py | python | XBRL.__str__ | (self) | return "" | [] | def __str__(self):
return "" | [
"def",
"__str__",
"(",
"self",
")",
":",
"return",
"\"\""
] | https://github.com/greedo/python-xbrl/blob/42ec8a9cb80c5d5bdbd423a0d427ed89823a3fd2/xbrl/xbrl.py#L783-L784 | |||
kylebebak/Requester | 4a9f9f051fa5fc951a8f7ad098a328261ca2db97 | deps/graphql/parser.py | python | GraphQLParser.p_selection_set | (self, p) | selection_set : BRACE_L selection_list BRACE_R | selection_set : BRACE_L selection_list BRACE_R | [
"selection_set",
":",
"BRACE_L",
"selection_list",
"BRACE_R"
] | def p_selection_set(self, p):
"""
selection_set : BRACE_L selection_list BRACE_R
"""
p[0] = p[2] | [
"def",
"p_selection_set",
"(",
"self",
",",
"p",
")",
":",
"p",
"[",
"0",
"]",
"=",
"p",
"[",
"2",
"]"
] | https://github.com/kylebebak/Requester/blob/4a9f9f051fa5fc951a8f7ad098a328261ca2db97/deps/graphql/parser.py#L173-L177 | ||
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-darwin/x64/tornado/escape.py | python | _convert_entity | (m) | [] | def _convert_entity(m):
if m.group(1) == "#":
try:
if m.group(2)[:1].lower() == 'x':
return unichr(int(m.group(2)[1:], 16))
else:
return unichr(int(m.group(2)))
except ValueError:
return "&#%s;" % m.group(2)
try:
return ... | [
"def",
"_convert_entity",
"(",
"m",
")",
":",
"if",
"m",
".",
"group",
"(",
"1",
")",
"==",
"\"#\"",
":",
"try",
":",
"if",
"m",
".",
"group",
"(",
"2",
")",
"[",
":",
"1",
"]",
".",
"lower",
"(",
")",
"==",
"'x'",
":",
"return",
"unichr",
... | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-darwin/x64/tornado/escape.py#L377-L389 | ||||
elcodigok/wphardening | 634daf3a0b8dcc92484a7775a39abdfa9a846173 | lib/minify/cssmin.py | python | remove_unnecessary_whitespace | (css) | return css | Remove unnecessary whitespace characters. | Remove unnecessary whitespace characters. | [
"Remove",
"unnecessary",
"whitespace",
"characters",
"."
] | def remove_unnecessary_whitespace(css):
"""Remove unnecessary whitespace characters."""
def pseudoclasscolon(css):
"""
Prevents 'p :link' from becoming 'p:link'.
Translates 'p :link' into 'p ___PSEUDOCLASSCOLON___link'; this is
translated back again later.
"""
... | [
"def",
"remove_unnecessary_whitespace",
"(",
"css",
")",
":",
"def",
"pseudoclasscolon",
"(",
"css",
")",
":",
"\"\"\"\n Prevents 'p :link' from becoming 'p:link'.\n\n Translates 'p :link' into 'p ___PSEUDOCLASSCOLON___link'; this is\n translated back again later.\n ... | https://github.com/elcodigok/wphardening/blob/634daf3a0b8dcc92484a7775a39abdfa9a846173/lib/minify/cssmin.py#L48-L88 | |
IJDykeman/wangTiles | 7c1ee2095ebdf7f72bce07d94c6484915d5cae8b | experimental_code/tiles_3d/venv_mac/lib/python2.7/site-packages/pip/vcs/__init__.py | python | VersionControl.get_revision | (self, location) | Return the current revision of the files at location
Used in get_info | Return the current revision of the files at location
Used in get_info | [
"Return",
"the",
"current",
"revision",
"of",
"the",
"files",
"at",
"location",
"Used",
"in",
"get_info"
] | def get_revision(self, location):
"""
Return the current revision of the files at location
Used in get_info
"""
raise NotImplementedError | [
"def",
"get_revision",
"(",
"self",
",",
"location",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/tiles_3d/venv_mac/lib/python2.7/site-packages/pip/vcs/__init__.py#L304-L309 | ||
GNS3/gns3-server | aff06572d4173df945ad29ea8feb274f7885d9e4 | gns3server/compute/vmware/vmware_vm.py | python | VMwareVM._set_network_options | (self) | Set up VMware networking. | Set up VMware networking. | [
"Set",
"up",
"VMware",
"networking",
"."
] | def _set_network_options(self):
"""
Set up VMware networking.
"""
# first some sanity checks
for adapter_number in range(0, self._adapters):
# we want the vmnet interface to be connected when starting the VM
connected = "ethernet{}.startConnected".format... | [
"def",
"_set_network_options",
"(",
"self",
")",
":",
"# first some sanity checks",
"for",
"adapter_number",
"in",
"range",
"(",
"0",
",",
"self",
".",
"_adapters",
")",
":",
"# we want the vmnet interface to be connected when starting the VM",
"connected",
"=",
"\"ethern... | https://github.com/GNS3/gns3-server/blob/aff06572d4173df945ad29ea8feb274f7885d9e4/gns3server/compute/vmware/vmware_vm.py#L244-L319 | ||
crits/crits_services | c7abf91f1865d913cffad4b966599da204f8ae43 | rtfmeta_service/rtf_parser.py | python | RtfParser.parse_bliptag | (self) | [] | def parse_bliptag(self):
bliptags = re.findall(r'\\(bliptag[\d]+)', self.data)
bliptags = self.unique_list(bliptags)
bliptags = [x.decode('utf-8') for x in bliptags]
self.features.update({'bliptag': bliptags}) | [
"def",
"parse_bliptag",
"(",
"self",
")",
":",
"bliptags",
"=",
"re",
".",
"findall",
"(",
"r'\\\\(bliptag[\\d]+)'",
",",
"self",
".",
"data",
")",
"bliptags",
"=",
"self",
".",
"unique_list",
"(",
"bliptags",
")",
"bliptags",
"=",
"[",
"x",
".",
"decode... | https://github.com/crits/crits_services/blob/c7abf91f1865d913cffad4b966599da204f8ae43/rtfmeta_service/rtf_parser.py#L459-L463 | ||||
SteveDoyle2/pyNastran | eda651ac2d4883d95a34951f8a002ff94f642a1a | pyNastran/bdf/cards/aero/aero.py | python | CAERO3.repr_fields | (self) | return list_fields | Gets the fields in their simplified form
Returns
-------
fields : list
The fields that define the card | Gets the fields in their simplified form | [
"Gets",
"the",
"fields",
"in",
"their",
"simplified",
"form"
] | def repr_fields(self):
"""
Gets the fields in their simplified form
Returns
-------
fields : list
The fields that define the card
"""
cp = set_blank_if_default(self.Cp(), 0)
list_fields = (['CAERO3', self.eid, self.Pid(), cp, self.List_w(),
... | [
"def",
"repr_fields",
"(",
"self",
")",
":",
"cp",
"=",
"set_blank_if_default",
"(",
"self",
".",
"Cp",
"(",
")",
",",
"0",
")",
"list_fields",
"=",
"(",
"[",
"'CAERO3'",
",",
"self",
".",
"eid",
",",
"self",
".",
"Pid",
"(",
")",
",",
"cp",
",",... | https://github.com/SteveDoyle2/pyNastran/blob/eda651ac2d4883d95a34951f8a002ff94f642a1a/pyNastran/bdf/cards/aero/aero.py#L2872-L2886 | |
robotlearn/pyrobolearn | 9cd7c060723fda7d2779fa255ac998c2c82b8436 | pyrobolearn/simulators/simulator.py | python | Simulator.remove_body | (self, body_id) | Remove a particular body in the simulator.
Args:
body_id (int): unique body id. | Remove a particular body in the simulator. | [
"Remove",
"a",
"particular",
"body",
"in",
"the",
"simulator",
"."
] | def remove_body(self, body_id):
"""Remove a particular body in the simulator.
Args:
body_id (int): unique body id.
"""
pass | [
"def",
"remove_body",
"(",
"self",
",",
"body_id",
")",
":",
"pass"
] | https://github.com/robotlearn/pyrobolearn/blob/9cd7c060723fda7d2779fa255ac998c2c82b8436/pyrobolearn/simulators/simulator.py#L845-L851 | ||
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/octoprint/binary_sensor.py | python | OctoPrintPrintingErrorBinarySensor.__init__ | (
self, coordinator: OctoprintDataUpdateCoordinator, device_id: str
) | Initialize a new OctoPrint sensor. | Initialize a new OctoPrint sensor. | [
"Initialize",
"a",
"new",
"OctoPrint",
"sensor",
"."
] | def __init__(
self, coordinator: OctoprintDataUpdateCoordinator, device_id: str
) -> None:
"""Initialize a new OctoPrint sensor."""
super().__init__(coordinator, "Printing Error", device_id) | [
"def",
"__init__",
"(",
"self",
",",
"coordinator",
":",
"OctoprintDataUpdateCoordinator",
",",
"device_id",
":",
"str",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"coordinator",
",",
"\"Printing Error\"",
",",
"device_id",
")"
] | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/octoprint/binary_sensor.py#L95-L99 | ||
jython/frozen-mirror | b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99 | lib-python/2.7/cookielib.py | python | FileCookieJar.revert | (self, filename=None,
ignore_discard=False, ignore_expires=False) | Clear all cookies and reload cookies from a saved file.
Raises LoadError (or IOError) if reversion is not successful; the
object's state will not be altered if this happens. | Clear all cookies and reload cookies from a saved file. | [
"Clear",
"all",
"cookies",
"and",
"reload",
"cookies",
"from",
"a",
"saved",
"file",
"."
] | def revert(self, filename=None,
ignore_discard=False, ignore_expires=False):
"""Clear all cookies and reload cookies from a saved file.
Raises LoadError (or IOError) if reversion is not successful; the
object's state will not be altered if this happens.
"""
if fi... | [
"def",
"revert",
"(",
"self",
",",
"filename",
"=",
"None",
",",
"ignore_discard",
"=",
"False",
",",
"ignore_expires",
"=",
"False",
")",
":",
"if",
"filename",
"is",
"None",
":",
"if",
"self",
".",
"filename",
"is",
"not",
"None",
":",
"filename",
"=... | https://github.com/jython/frozen-mirror/blob/b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99/lib-python/2.7/cookielib.py#L1767-L1791 | ||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/graphs/graph_decompositions/modular_decomposition.py | python | check_prime | (graph, root, left, right,
source_index, mu, vertex_dist,
vertices_in_component) | return [True, new_left_index] | Assemble the forest to create a prime module.
INPUT:
- ``root`` -- forest which needs to be assembled
- ``left`` -- the leftmost fragment of the last module
- ``right`` -- the rightmost fragment of the last module
- ``source_index`` -- index of the tree containing the source vertex
- ``mu`... | Assemble the forest to create a prime module. | [
"Assemble",
"the",
"forest",
"to",
"create",
"a",
"prime",
"module",
"."
] | def check_prime(graph, root, left, right,
source_index, mu, vertex_dist,
vertices_in_component):
"""
Assemble the forest to create a prime module.
INPUT:
- ``root`` -- forest which needs to be assembled
- ``left`` -- the leftmost fragment of the last module
- ... | [
"def",
"check_prime",
"(",
"graph",
",",
"root",
",",
"left",
",",
"right",
",",
"source_index",
",",
"mu",
",",
"vertex_dist",
",",
"vertices_in_component",
")",
":",
"# stores the index of rightmost component included in the prime module",
"new_right_index",
"=",
"sou... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/graphs/graph_decompositions/modular_decomposition.py#L860-L1042 | |
brython-dev/brython | 9cba5fb7f43a9b52fff13e89b403e02a1dfaa5f3 | www/src/Lib/ipaddress.py | python | IPv4Address.packed | (self) | return v4_int_to_packed(self._ip) | The binary representation of this address. | The binary representation of this address. | [
"The",
"binary",
"representation",
"of",
"this",
"address",
"."
] | def packed(self):
"""The binary representation of this address."""
return v4_int_to_packed(self._ip) | [
"def",
"packed",
"(",
"self",
")",
":",
"return",
"v4_int_to_packed",
"(",
"self",
".",
"_ip",
")"
] | https://github.com/brython-dev/brython/blob/9cba5fb7f43a9b52fff13e89b403e02a1dfaa5f3/www/src/Lib/ipaddress.py#L1311-L1313 | |
SiCKRAGE/SiCKRAGE | 45fb67c0c730fc22a34c695b5a62b11970621c53 | sickrage/series_providers/thetvdb.py | python | TheTVDB.get_series_info | (self, sid, language='eng', dvd_order=False, enable_cache=True) | return self.cache[int(sid)] | Takes a series id, gets the episodes URL and parses the TVDB | Takes a series id, gets the episodes URL and parses the TVDB | [
"Takes",
"a",
"series",
"id",
"gets",
"the",
"episodes",
"URL",
"and",
"parses",
"the",
"TVDB"
] | def get_series_info(self, sid, language='eng', dvd_order=False, enable_cache=True):
"""
Takes a series id, gets the episodes URL and parses the TVDB
"""
# check if series is in cache
if sid in self.cache and enable_cache:
search_result = self.cache[sid]
i... | [
"def",
"get_series_info",
"(",
"self",
",",
"sid",
",",
"language",
"=",
"'eng'",
",",
"dvd_order",
"=",
"False",
",",
"enable_cache",
"=",
"True",
")",
":",
"# check if series is in cache",
"if",
"sid",
"in",
"self",
".",
"cache",
"and",
"enable_cache",
":"... | https://github.com/SiCKRAGE/SiCKRAGE/blob/45fb67c0c730fc22a34c695b5a62b11970621c53/sickrage/series_providers/thetvdb.py#L89-L147 | |
makinacorpus/django-safedelete | bd5225f66b86c2a81b37185f5cd9f544aecdeb34 | safedelete/query.py | python | SafeDeleteQuery._filter_visibility | (self) | Add deleted filters to the current QuerySet.
Unlike QuerySet.filter, this does not return a clone.
This is because QuerySet._fetch_all cannot work with a clone. | Add deleted filters to the current QuerySet. | [
"Add",
"deleted",
"filters",
"to",
"the",
"current",
"QuerySet",
"."
] | def _filter_visibility(self):
"""Add deleted filters to the current QuerySet.
Unlike QuerySet.filter, this does not return a clone.
This is because QuerySet._fetch_all cannot work with a clone.
"""
if not self.can_filter() or self._safedelete_filter_applied:
return
... | [
"def",
"_filter_visibility",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"can_filter",
"(",
")",
"or",
"self",
".",
"_safedelete_filter_applied",
":",
"return",
"force_visibility",
"=",
"getattr",
"(",
"self",
",",
"'_safedelete_force_visibility'",
",",
"No... | https://github.com/makinacorpus/django-safedelete/blob/bd5225f66b86c2a81b37185f5cd9f544aecdeb34/safedelete/query.py#L31-L54 | ||
CiscoDevNet/webexteamssdk | 673312779b8e05cf0535bea8b96599015cccbff1 | webexteamssdk/api/__init__.py | python | WebexTeamsAPI.from_oauth_refresh | (cls, client_id, client_secret, refresh_token) | return cls(access_token=token_obj.access_token) | Create a new WebexTeamsAPI connection object using an OAuth refresh.
Exchange a refresh token for an Access Token, then use the access
token to create a new WebexTeamsAPI connection object.
Args:
client_id(basestring): Provided when you created your integration.
client_... | Create a new WebexTeamsAPI connection object using an OAuth refresh. | [
"Create",
"a",
"new",
"WebexTeamsAPI",
"connection",
"object",
"using",
"an",
"OAuth",
"refresh",
"."
] | def from_oauth_refresh(cls, client_id, client_secret, refresh_token):
"""Create a new WebexTeamsAPI connection object using an OAuth refresh.
Exchange a refresh token for an Access Token, then use the access
token to create a new WebexTeamsAPI connection object.
Args:
clien... | [
"def",
"from_oauth_refresh",
"(",
"cls",
",",
"client_id",
",",
"client_secret",
",",
"refresh_token",
")",
":",
"token_obj",
"=",
"cls",
".",
"access_tokens",
".",
"refresh",
"(",
"client_id",
",",
"client_secret",
",",
"refresh_token",
")",
"return",
"cls",
... | https://github.com/CiscoDevNet/webexteamssdk/blob/673312779b8e05cf0535bea8b96599015cccbff1/webexteamssdk/api/__init__.py#L278-L301 | |
matrix-org/matrix-python-sdk | 887f5d55e16518a0a2bef4f2d6bff6ecf48d18c1 | matrix_client/api.py | python | MatrixHttpApi.key_changes | (self, from_token, to_token) | return self._send("GET", "/keys/changes", query_params=params) | Gets a list of users who have updated their device identity keys.
Args:
from_token (str): The desired start point of the list. Should be the
next_batch field from a response to an earlier call to /sync.
to_token (str): The desired end point of the list. Should be the nex... | Gets a list of users who have updated their device identity keys. | [
"Gets",
"a",
"list",
"of",
"users",
"who",
"have",
"updated",
"their",
"device",
"identity",
"keys",
"."
] | def key_changes(self, from_token, to_token):
"""Gets a list of users who have updated their device identity keys.
Args:
from_token (str): The desired start point of the list. Should be the
next_batch field from a response to an earlier call to /sync.
to_token (st... | [
"def",
"key_changes",
"(",
"self",
",",
"from_token",
",",
"to_token",
")",
":",
"params",
"=",
"{",
"\"from\"",
":",
"from_token",
",",
"\"to\"",
":",
"to_token",
"}",
"return",
"self",
".",
"_send",
"(",
"\"GET\"",
",",
"\"/keys/changes\"",
",",
"query_p... | https://github.com/matrix-org/matrix-python-sdk/blob/887f5d55e16518a0a2bef4f2d6bff6ecf48d18c1/matrix_client/api.py#L1055-L1065 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py | python | ParseResults.asXML | ( self, doctag=None, namedItemsOnly=False, indent="", formatted=True ) | return "".join(out) | (Deprecated) Returns the parse results as XML. Tags are created for tokens and lists that have defined results names. | (Deprecated) Returns the parse results as XML. Tags are created for tokens and lists that have defined results names. | [
"(",
"Deprecated",
")",
"Returns",
"the",
"parse",
"results",
"as",
"XML",
".",
"Tags",
"are",
"created",
"for",
"tokens",
"and",
"lists",
"that",
"have",
"defined",
"results",
"names",
"."
] | def asXML( self, doctag=None, namedItemsOnly=False, indent="", formatted=True ):
"""
(Deprecated) Returns the parse results as XML. Tags are created for tokens and lists that have defined results names.
"""
nl = "\n"
out = []
namedItems = dict((v[1],k) for (k,vlist) in se... | [
"def",
"asXML",
"(",
"self",
",",
"doctag",
"=",
"None",
",",
"namedItemsOnly",
"=",
"False",
",",
"indent",
"=",
"\"\"",
",",
"formatted",
"=",
"True",
")",
":",
"nl",
"=",
"\"\\n\"",
"out",
"=",
"[",
"]",
"namedItems",
"=",
"dict",
"(",
"(",
"v",... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py#L743-L802 | |
heitzmann/gdspy | c0473ce3a34d0462be8e6275f8f164ed14e8d059 | gdspy/polygon.py | python | PolygonSet.to_svg | (self, outfile, scaling, precision) | Write an SVG fragment representation of this object.
Parameters
----------
outfile : open file
Output to write the SVG representation.
scaling : number
Scaling factor for the geometry.
precision : positive integer or `None`
Maximal number of d... | Write an SVG fragment representation of this object. | [
"Write",
"an",
"SVG",
"fragment",
"representation",
"of",
"this",
"object",
"."
] | def to_svg(self, outfile, scaling, precision):
"""
Write an SVG fragment representation of this object.
Parameters
----------
outfile : open file
Output to write the SVG representation.
scaling : number
Scaling factor for the geometry.
pre... | [
"def",
"to_svg",
"(",
"self",
",",
"outfile",
",",
"scaling",
",",
"precision",
")",
":",
"for",
"p",
",",
"l",
",",
"d",
"in",
"zip",
"(",
"self",
".",
"polygons",
",",
"self",
".",
"layers",
",",
"self",
".",
"datatypes",
")",
":",
"outfile",
"... | https://github.com/heitzmann/gdspy/blob/c0473ce3a34d0462be8e6275f8f164ed14e8d059/gdspy/polygon.py#L254-L284 | ||
QuantFans/quantdigger | 8b6c436509e7dfe63798300c0e31ea04eace9779 | quantdigger/widgets/plotter.py | python | Plotter.plot_line | (self, *args, **kwargs) | 画线
Args:
*args (tuple): [_xdata], ydata, style
**kwargs (dict): lw, ms | 画线 | [
"画线"
] | def plot_line(self, *args, **kwargs):
""" 画线
Args:
*args (tuple): [_xdata], ydata, style
**kwargs (dict): lw, ms
"""
# 区分向量绘图和逐步绘图。
lw = kwargs.get('lw', 1)
ms = kwargs.get('ms', 10)
if len(args[0]) > 0:
if len(args) == 2:
... | [
"def",
"plot_line",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# 区分向量绘图和逐步绘图。",
"lw",
"=",
"kwargs",
".",
"get",
"(",
"'lw'",
",",
"1",
")",
"ms",
"=",
"kwargs",
".",
"get",
"(",
"'ms'",
",",
"10",
")",
"if",
"len",
"(",... | https://github.com/QuantFans/quantdigger/blob/8b6c436509e7dfe63798300c0e31ea04eace9779/quantdigger/widgets/plotter.py#L108-L135 | ||
cupy/cupy | a47ad3105f0fe817a4957de87d98ddccb8c7491f | cupy/random/_sample.py | python | multinomial | (n, pvals, size=None) | return ys | Returns an array from multinomial distribution.
Args:
n (int): Number of trials.
pvals (cupy.ndarray): Probabilities of each of the ``p`` different
outcomes. The sum of these values must be 1.
size (int or tuple of ints or None): Shape of a sample in each trial.
For ... | Returns an array from multinomial distribution. | [
"Returns",
"an",
"array",
"from",
"multinomial",
"distribution",
"."
] | def multinomial(n, pvals, size=None):
"""Returns an array from multinomial distribution.
Args:
n (int): Number of trials.
pvals (cupy.ndarray): Probabilities of each of the ``p`` different
outcomes. The sum of these values must be 1.
size (int or tuple of ints or None): Shap... | [
"def",
"multinomial",
"(",
"n",
",",
"pvals",
",",
"size",
"=",
"None",
")",
":",
"if",
"size",
"is",
"None",
":",
"m",
"=",
"1",
"size",
"=",
"(",
")",
"elif",
"isinstance",
"(",
"size",
",",
"int",
")",
":",
"m",
"=",
"size",
"size",
"=",
"... | https://github.com/cupy/cupy/blob/a47ad3105f0fe817a4957de87d98ddccb8c7491f/cupy/random/_sample.py#L199-L239 | |
facebook/fbzmq | 9a253be318c536c0302a4e06ffd01754805bceb0 | build/fbcode_builder/getdeps/fetcher.py | python | ChangeStatus.sources_changed | (self) | return self.source_files > 0 | Returns true if any source files were changed during
an update operation. This will typically be used to decide
that the build system to be run on the source dir in an
incremental mode | Returns true if any source files were changed during
an update operation. This will typically be used to decide
that the build system to be run on the source dir in an
incremental mode | [
"Returns",
"true",
"if",
"any",
"source",
"files",
"were",
"changed",
"during",
"an",
"update",
"operation",
".",
"This",
"will",
"typically",
"be",
"used",
"to",
"decide",
"that",
"the",
"build",
"system",
"to",
"be",
"run",
"on",
"the",
"source",
"dir",
... | def sources_changed(self):
"""Returns true if any source files were changed during
an update operation. This will typically be used to decide
that the build system to be run on the source dir in an
incremental mode"""
return self.source_files > 0 | [
"def",
"sources_changed",
"(",
"self",
")",
":",
"return",
"self",
".",
"source_files",
">",
"0"
] | https://github.com/facebook/fbzmq/blob/9a253be318c536c0302a4e06ffd01754805bceb0/build/fbcode_builder/getdeps/fetcher.py#L92-L97 | |
cls1991/leetcode | 0fd165afa2ec339a6f194bc57f8810e66cd2822b | Array/26_RemoveDuplicatesFromSortedArray.py | python | Solution.removeDuplicates | (self, nums) | return cursor + 1 | :type nums: List[int]
:rtype: int | :type nums: List[int]
:rtype: int | [
":",
"type",
"nums",
":",
"List",
"[",
"int",
"]",
":",
"rtype",
":",
"int"
] | def removeDuplicates(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
if not nums:
return 0
cursor = 0
for i in range(1, len(nums)):
if nums[cursor] != nums[i]:
cursor += 1
nums[cursor] = nums[i]
... | [
"def",
"removeDuplicates",
"(",
"self",
",",
"nums",
")",
":",
"if",
"not",
"nums",
":",
"return",
"0",
"cursor",
"=",
"0",
"for",
"i",
"in",
"range",
"(",
"1",
",",
"len",
"(",
"nums",
")",
")",
":",
"if",
"nums",
"[",
"cursor",
"]",
"!=",
"nu... | https://github.com/cls1991/leetcode/blob/0fd165afa2ec339a6f194bc57f8810e66cd2822b/Array/26_RemoveDuplicatesFromSortedArray.py#L24-L38 | |
fabioz/PyDev.Debugger | 0f8c02a010fe5690405da1dd30ed72326191ce63 | pydevd_attach_to_process/winappdbg/process.py | python | Process.__fixup_labels | (self, disasm) | Private method used when disassembling from process memory.
It has no return value because the list is modified in place. On return
all raw memory addresses are replaced by labels when possible.
@type disasm: list of tuple(int, int, str, str)
@param disasm: Output of one of the dissas... | Private method used when disassembling from process memory. | [
"Private",
"method",
"used",
"when",
"disassembling",
"from",
"process",
"memory",
"."
] | def __fixup_labels(self, disasm):
"""
Private method used when disassembling from process memory.
It has no return value because the list is modified in place. On return
all raw memory addresses are replaced by labels when possible.
@type disasm: list of tuple(int, int, str, s... | [
"def",
"__fixup_labels",
"(",
"self",
",",
"disasm",
")",
":",
"for",
"index",
"in",
"compat",
".",
"xrange",
"(",
"len",
"(",
"disasm",
")",
")",
":",
"(",
"address",
",",
"size",
",",
"text",
",",
"dump",
")",
"=",
"disasm",
"[",
"index",
"]",
... | https://github.com/fabioz/PyDev.Debugger/blob/0f8c02a010fe5690405da1dd30ed72326191ce63/pydevd_attach_to_process/winappdbg/process.py#L490-L514 | ||
ckan/ckan | b3b01218ad88ed3fb914b51018abe8b07b07bff3 | ckan/views/dataset.py | python | _sort_by | (params_nosort, package_type, fields) | return search_url(params, package_type) | Sort by the given list of fields.
Each entry in the list is a 2-tuple: (fieldname, sort_order)
eg - [(u'metadata_modified', u'desc'), (u'name', u'asc')]
If fields is empty, then the default ordering is used. | Sort by the given list of fields. | [
"Sort",
"by",
"the",
"given",
"list",
"of",
"fields",
"."
] | def _sort_by(params_nosort, package_type, fields):
"""Sort by the given list of fields.
Each entry in the list is a 2-tuple: (fieldname, sort_order)
eg - [(u'metadata_modified', u'desc'), (u'name', u'asc')]
If fields is empty, then the default ordering is used.
"""
params = params_nosort[:]
... | [
"def",
"_sort_by",
"(",
"params_nosort",
",",
"package_type",
",",
"fields",
")",
":",
"params",
"=",
"params_nosort",
"[",
":",
"]",
"if",
"fields",
":",
"sort_string",
"=",
"u', '",
".",
"join",
"(",
"u'%s %s'",
"%",
"f",
"for",
"f",
"in",
"fields",
... | https://github.com/ckan/ckan/blob/b3b01218ad88ed3fb914b51018abe8b07b07bff3/ckan/views/dataset.py#L102-L114 | |
CouchPotato/CouchPotatoV1 | 135b3331d1b88ef645e29b76f2d4cc4a732c9232 | library/sqlalchemy/orm/collections.py | python | CollectionAdapter.remove_with_event | (self, item, initiator=None) | Remove an entity from the collection, firing mutation events. | Remove an entity from the collection, firing mutation events. | [
"Remove",
"an",
"entity",
"from",
"the",
"collection",
"firing",
"mutation",
"events",
"."
] | def remove_with_event(self, item, initiator=None):
"""Remove an entity from the collection, firing mutation events."""
getattr(self._data(), '_sa_remover')(item, _sa_initiator=initiator) | [
"def",
"remove_with_event",
"(",
"self",
",",
"item",
",",
"initiator",
"=",
"None",
")",
":",
"getattr",
"(",
"self",
".",
"_data",
"(",
")",
",",
"'_sa_remover'",
")",
"(",
"item",
",",
"_sa_initiator",
"=",
"initiator",
")"
] | https://github.com/CouchPotato/CouchPotatoV1/blob/135b3331d1b88ef645e29b76f2d4cc4a732c9232/library/sqlalchemy/orm/collections.py#L556-L558 | ||
apple/ccs-calendarserver | 13c706b985fb728b9aab42dc0fef85aae21921c3 | calendarserver/tools/migrate_verify.py | python | MigrateVerifyOptions.openOutput | (self) | Open the appropriate output file based on the '--output' option. | Open the appropriate output file based on the '--output' option. | [
"Open",
"the",
"appropriate",
"output",
"file",
"based",
"on",
"the",
"--",
"output",
"option",
"."
] | def openOutput(self):
"""
Open the appropriate output file based on the '--output' option.
"""
if self.outputName == '-':
return sys.stdout
else:
return open(self.outputName, 'wb') | [
"def",
"openOutput",
"(",
"self",
")",
":",
"if",
"self",
".",
"outputName",
"==",
"'-'",
":",
"return",
"sys",
".",
"stdout",
"else",
":",
"return",
"open",
"(",
"self",
".",
"outputName",
",",
"'wb'",
")"
] | https://github.com/apple/ccs-calendarserver/blob/13c706b985fb728b9aab42dc0fef85aae21921c3/calendarserver/tools/migrate_verify.py#L104-L111 | ||
galaxyproject/galaxy | 4c03520f05062e0f4a1b3655dc0b7452fda69943 | lib/galaxy/webapps/galaxy/api/__init__.py | python | Router.put | (self, *args, **kwd) | return super().put(*args, **self._handle_galaxy_kwd(kwd)) | Extend FastAPI.put to accept a require_admin Galaxy flag. | Extend FastAPI.put to accept a require_admin Galaxy flag. | [
"Extend",
"FastAPI",
".",
"put",
"to",
"accept",
"a",
"require_admin",
"Galaxy",
"flag",
"."
] | def put(self, *args, **kwd):
"""Extend FastAPI.put to accept a require_admin Galaxy flag."""
return super().put(*args, **self._handle_galaxy_kwd(kwd)) | [
"def",
"put",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwd",
")",
":",
"return",
"super",
"(",
")",
".",
"put",
"(",
"*",
"args",
",",
"*",
"*",
"self",
".",
"_handle_galaxy_kwd",
"(",
"kwd",
")",
")"
] | https://github.com/galaxyproject/galaxy/blob/4c03520f05062e0f4a1b3655dc0b7452fda69943/lib/galaxy/webapps/galaxy/api/__init__.py#L244-L246 | |
kamalkraj/ALBERT-TF2.0 | 8d0cc211361e81a648bf846d8ec84225273db0e4 | create_pretraining_data.py | python | _is_start_piece_sp | (piece) | Check if the current word piece is the starting piece (sentence piece). | Check if the current word piece is the starting piece (sentence piece). | [
"Check",
"if",
"the",
"current",
"word",
"piece",
"is",
"the",
"starting",
"piece",
"(",
"sentence",
"piece",
")",
"."
] | def _is_start_piece_sp(piece):
"""Check if the current word piece is the starting piece (sentence piece)."""
special_pieces = set(list('!"#$%&\"()*+,-./:;?@[\\]^_`{|}~'))
special_pieces.add(u"€".encode("utf-8"))
special_pieces.add(u"£".encode("utf-8"))
# Note(mingdachen):
# For foreign characters, we always... | [
"def",
"_is_start_piece_sp",
"(",
"piece",
")",
":",
"special_pieces",
"=",
"set",
"(",
"list",
"(",
"'!\"#$%&\\\"()*+,-./:;?@[\\\\]^_`{|}~'",
")",
")",
"special_pieces",
".",
"add",
"(",
"u\"€\".e",
"n",
"code(\"",
"u",
"tf-8\"))",
"",
"",
"special_pieces",
"."... | https://github.com/kamalkraj/ALBERT-TF2.0/blob/8d0cc211361e81a648bf846d8ec84225273db0e4/create_pretraining_data.py#L405-L419 | ||
cowrie/cowrie | 86488fa4eed1559574653eee4c76b4a33d1b42db | src/cowrie/ssh_proxy/server_transport.py | python | FrontendSSHTransport.connectionLost | (self, reason) | This seems to be the only reliable place of catching lost connection | This seems to be the only reliable place of catching lost connection | [
"This",
"seems",
"to",
"be",
"the",
"only",
"reliable",
"place",
"of",
"catching",
"lost",
"connection"
] | def connectionLost(self, reason):
"""
This seems to be the only reliable place of catching lost connection
"""
self.setTimeout(None)
transport.SSHServerTransport.connectionLost(self, reason)
self.transport.connectionLost(reason)
self.transport = None
# ... | [
"def",
"connectionLost",
"(",
"self",
",",
"reason",
")",
":",
"self",
".",
"setTimeout",
"(",
"None",
")",
"transport",
".",
"SSHServerTransport",
".",
"connectionLost",
"(",
"self",
",",
"reason",
")",
"self",
".",
"transport",
".",
"connectionLost",
"(",
... | https://github.com/cowrie/cowrie/blob/86488fa4eed1559574653eee4c76b4a33d1b42db/src/cowrie/ssh_proxy/server_transport.py#L355-L384 | ||
Nuitka/Nuitka | 39262276993757fa4e299f497654065600453fc9 | nuitka/Version.py | python | getCommercialVersion | () | Return Nuitka commercial version if installed. | Return Nuitka commercial version if installed. | [
"Return",
"Nuitka",
"commercial",
"version",
"if",
"installed",
"."
] | def getCommercialVersion():
"""Return Nuitka commercial version if installed."""
try:
from nuitka.tools.commercial import Version
except ImportError:
return None
else:
return Version.__version__ | [
"def",
"getCommercialVersion",
"(",
")",
":",
"try",
":",
"from",
"nuitka",
".",
"tools",
".",
"commercial",
"import",
"Version",
"except",
"ImportError",
":",
"return",
"None",
"else",
":",
"return",
"Version",
".",
"__version__"
] | https://github.com/Nuitka/Nuitka/blob/39262276993757fa4e299f497654065600453fc9/nuitka/Version.py#L41-L48 | ||
wikimedia/pywikibot | 81a01ffaec7271bf5b4b170f85a80388420a4e78 | pywikibot/proofreadpage.py | python | ProofreadPage._do_hocr | (self) | return self._ocr_callback(cmd_uri,
parser_func=parse_hocr_text,
ocr_tool=self._PHETOOLS) | Do hocr using https://phetools.toolforge.org/hocr_cgi.py?cmd=hocr.
This is the main method for 'phetools'.
Fallback method is ocr.
:raise ImportError: if bs4 is not installed, _bs4_soup() will raise | Do hocr using https://phetools.toolforge.org/hocr_cgi.py?cmd=hocr. | [
"Do",
"hocr",
"using",
"https",
":",
"//",
"phetools",
".",
"toolforge",
".",
"org",
"/",
"hocr_cgi",
".",
"py?cmd",
"=",
"hocr",
"."
] | def _do_hocr(self) -> Tuple[bool, Union[str, Exception]]:
"""Do hocr using https://phetools.toolforge.org/hocr_cgi.py?cmd=hocr.
This is the main method for 'phetools'.
Fallback method is ocr.
:raise ImportError: if bs4 is not installed, _bs4_soup() will raise
"""
def pa... | [
"def",
"_do_hocr",
"(",
"self",
")",
"->",
"Tuple",
"[",
"bool",
",",
"Union",
"[",
"str",
",",
"Exception",
"]",
"]",
":",
"def",
"parse_hocr_text",
"(",
"txt",
":",
"str",
")",
"->",
"str",
":",
"\"\"\"Parse hocr text.\"\"\"",
"soup",
"=",
"_bs4_soup",... | https://github.com/wikimedia/pywikibot/blob/81a01ffaec7271bf5b4b170f85a80388420a4e78/pywikibot/proofreadpage.py#L669-L699 | |
mozilla/bugbug | 89ddd317ff9348bd620f0b155dad16af4ea1e848 | http_service/bugbug_http/app.py | python | compress_response | (data: dict, status_code: int) | return response | Compress data using gzip compressor and frame response
:param data: data
:type data: dict
:param status_code: response status code
:type status_code: int
:return: response with gzip compressed data
:rtype: Response | Compress data using gzip compressor and frame response | [
"Compress",
"data",
"using",
"gzip",
"compressor",
"and",
"frame",
"response"
] | def compress_response(data: dict, status_code: int):
"""Compress data using gzip compressor and frame response
:param data: data
:type data: dict
:param status_code: response status code
:type status_code: int
:return: response with gzip compressed data
:rtype: Response
"""
gzip_bu... | [
"def",
"compress_response",
"(",
"data",
":",
"dict",
",",
"status_code",
":",
"int",
")",
":",
"gzip_buffer",
"=",
"gzip",
".",
"compress",
"(",
"orjson",
".",
"dumps",
"(",
"data",
")",
",",
"compresslevel",
"=",
"9",
")",
"response",
"=",
"Response",
... | https://github.com/mozilla/bugbug/blob/89ddd317ff9348bd620f0b155dad16af4ea1e848/http_service/bugbug_http/app.py#L378-L397 | |
cdhigh/KindleEar | 7c4ecf9625239f12a829210d1760b863ef5a23aa | lib/sendgrid/helpers/mail/bypass_list_management.py | python | BypassListManagement.enable | (self) | return self._enable | Indicates if this setting is enabled.
:rtype: boolean | Indicates if this setting is enabled. | [
"Indicates",
"if",
"this",
"setting",
"is",
"enabled",
"."
] | def enable(self):
"""Indicates if this setting is enabled.
:rtype: boolean
"""
return self._enable | [
"def",
"enable",
"(",
"self",
")",
":",
"return",
"self",
".",
"_enable"
] | https://github.com/cdhigh/KindleEar/blob/7c4ecf9625239f12a829210d1760b863ef5a23aa/lib/sendgrid/helpers/mail/bypass_list_management.py#L19-L24 | |
apachecn/AiLearning | 228b62a905a2a9bf6066f65c16d53056b10ec610 | src/py3.x/dl/linear_unit.py | python | LinearUnit.__init__ | (self, input_num) | 初始化线性单元,设置输入参数的个数 | 初始化线性单元,设置输入参数的个数 | [
"初始化线性单元,设置输入参数的个数"
] | def __init__(self, input_num):
'''初始化线性单元,设置输入参数的个数'''
Perceptron.__init__(self, input_num, f) | [
"def",
"__init__",
"(",
"self",
",",
"input_num",
")",
":",
"Perceptron",
".",
"__init__",
"(",
"self",
",",
"input_num",
",",
"f",
")"
] | https://github.com/apachecn/AiLearning/blob/228b62a905a2a9bf6066f65c16d53056b10ec610/src/py3.x/dl/linear_unit.py#L130-L132 | ||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/astropy-4.0-py3.7-macosx-10.9-x86_64.egg/astropy/_erfa/core.py | python | fane03 | (t) | return c_retval | Wrapper for ERFA function ``eraFane03``.
Parameters
----------
t : double array
Returns
-------
c_retval : double array
Notes
-----
The ERFA documentation is below.
- - - - - - - - - -
e r a F a n e 0 3
- - - - - - - - - -
Fundamental argument, IERS Conventions ... | Wrapper for ERFA function ``eraFane03``. | [
"Wrapper",
"for",
"ERFA",
"function",
"eraFane03",
"."
] | def fane03(t):
"""
Wrapper for ERFA function ``eraFane03``.
Parameters
----------
t : double array
Returns
-------
c_retval : double array
Notes
-----
The ERFA documentation is below.
- - - - - - - - - -
e r a F a n e 0 3
- - - - - - - - - -
Fundamental ... | [
"def",
"fane03",
"(",
"t",
")",
":",
"c_retval",
"=",
"ufunc",
".",
"fane03",
"(",
"t",
")",
"return",
"c_retval"
] | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/astropy-4.0-py3.7-macosx-10.9-x86_64.egg/astropy/_erfa/core.py#L5587-L5637 | |
tosher/Mediawiker | 81bf97cace59bedcb1668e7830b85c36e014428e | lib/Crypto.win.x64/Crypto/PublicKey/RSA.py | python | RsaKey.size_in_bytes | (self) | return (self._n.size_in_bits() - 1) // 8 + 1 | The minimal amount of bytes that can hold the RSA modulus | The minimal amount of bytes that can hold the RSA modulus | [
"The",
"minimal",
"amount",
"of",
"bytes",
"that",
"can",
"hold",
"the",
"RSA",
"modulus"
] | def size_in_bytes(self):
"""The minimal amount of bytes that can hold the RSA modulus"""
return (self._n.size_in_bits() - 1) // 8 + 1 | [
"def",
"size_in_bytes",
"(",
"self",
")",
":",
"return",
"(",
"self",
".",
"_n",
".",
"size_in_bits",
"(",
")",
"-",
"1",
")",
"//",
"8",
"+",
"1"
] | https://github.com/tosher/Mediawiker/blob/81bf97cace59bedcb1668e7830b85c36e014428e/lib/Crypto.win.x64/Crypto/PublicKey/RSA.py#L138-L140 | |
wbond/asn1crypto | 9ae350f212532dfee7f185f6b3eda24753249cf3 | asn1crypto/x509.py | python | Name.__eq__ | (self, other) | return self.chosen == other.chosen | Equality as defined by https://tools.ietf.org/html/rfc5280#section-7.1
:param other:
Another Name object
:return:
A boolean | Equality as defined by https://tools.ietf.org/html/rfc5280#section-7.1 | [
"Equality",
"as",
"defined",
"by",
"https",
":",
"//",
"tools",
".",
"ietf",
".",
"org",
"/",
"html",
"/",
"rfc5280#section",
"-",
"7",
".",
"1"
] | def __eq__(self, other):
"""
Equality as defined by https://tools.ietf.org/html/rfc5280#section-7.1
:param other:
Another Name object
:return:
A boolean
"""
if not isinstance(other, Name):
return False
return self.chosen == o... | [
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"Name",
")",
":",
"return",
"False",
"return",
"self",
".",
"chosen",
"==",
"other",
".",
"chosen"
] | https://github.com/wbond/asn1crypto/blob/9ae350f212532dfee7f185f6b3eda24753249cf3/asn1crypto/x509.py#L1057-L1070 | |
collinsctk/PyQYT | 7af3673955f94ff1b2df2f94220cd2dab2e252af | ExtentionPackages/scapy/layers/inet6.py | python | names2dnsrepr | (x) | return b"".join(res) | Take as input a list of DNS names or a single DNS name
and encode it in DNS format (with possible compression)
If a string that is already a DNS name in DNS format
is passed, it is returned unmodified. Result is a string.
!!! At the moment, compression is not implemented !!! | Take as input a list of DNS names or a single DNS name
and encode it in DNS format (with possible compression)
If a string that is already a DNS name in DNS format
is passed, it is returned unmodified. Result is a string.
!!! At the moment, compression is not implemented !!! | [
"Take",
"as",
"input",
"a",
"list",
"of",
"DNS",
"names",
"or",
"a",
"single",
"DNS",
"name",
"and",
"encode",
"it",
"in",
"DNS",
"format",
"(",
"with",
"possible",
"compression",
")",
"If",
"a",
"string",
"that",
"is",
"already",
"a",
"DNS",
"name",
... | def names2dnsrepr(x):
"""
Take as input a list of DNS names or a single DNS name
and encode it in DNS format (with possible compression)
If a string that is already a DNS name in DNS format
is passed, it is returned unmodified. Result is a string.
!!! At the moment, compression is not implement... | [
"def",
"names2dnsrepr",
"(",
"x",
")",
":",
"if",
"type",
"(",
"x",
")",
"is",
"str",
":",
"if",
"x",
"and",
"x",
"[",
"-",
"1",
"]",
"==",
"'\\x00'",
":",
"# stupid heuristic",
"return",
"x",
".",
"encode",
"(",
"'ascii'",
")",
"x",
"=",
"[",
... | https://github.com/collinsctk/PyQYT/blob/7af3673955f94ff1b2df2f94220cd2dab2e252af/ExtentionPackages/scapy/layers/inet6.py#L1899-L1926 | |
IronLanguages/ironpython2 | 51fdedeeda15727717fb8268a805f71b06c0b9f1 | Src/StdLib/Lib/compiler/pyassem.py | python | PyFlowGraph.flattenGraph | (self) | Arrange the blocks in order and resolve jumps | Arrange the blocks in order and resolve jumps | [
"Arrange",
"the",
"blocks",
"in",
"order",
"and",
"resolve",
"jumps"
] | def flattenGraph(self):
"""Arrange the blocks in order and resolve jumps"""
assert self.stage == RAW
self.insts = insts = []
pc = 0
begin = {}
end = {}
for b in self.getBlocksInOrder():
begin[b] = pc
for inst in b.getInstructions():
... | [
"def",
"flattenGraph",
"(",
"self",
")",
":",
"assert",
"self",
".",
"stage",
"==",
"RAW",
"self",
".",
"insts",
"=",
"insts",
"=",
"[",
"]",
"pc",
"=",
"0",
"begin",
"=",
"{",
"}",
"end",
"=",
"{",
"}",
"for",
"b",
"in",
"self",
".",
"getBlock... | https://github.com/IronLanguages/ironpython2/blob/51fdedeeda15727717fb8268a805f71b06c0b9f1/Src/StdLib/Lib/compiler/pyassem.py#L365-L396 | ||
buke/GreenOdoo | 3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df | source/addons/mrp_byproduct/mrp_byproduct.py | python | mrp_production.action_confirm | (self, cr, uid, ids, context=None) | return picking_id | Confirms production order and calculates quantity based on subproduct_type.
@return: Newly generated picking Id. | Confirms production order and calculates quantity based on subproduct_type. | [
"Confirms",
"production",
"order",
"and",
"calculates",
"quantity",
"based",
"on",
"subproduct_type",
"."
] | def action_confirm(self, cr, uid, ids, context=None):
""" Confirms production order and calculates quantity based on subproduct_type.
@return: Newly generated picking Id.
"""
move_obj = self.pool.get('stock.move')
picking_id = super(mrp_production,self).action_confirm(cr, uid, id... | [
"def",
"action_confirm",
"(",
"self",
",",
"cr",
",",
"uid",
",",
"ids",
",",
"context",
"=",
"None",
")",
":",
"move_obj",
"=",
"self",
".",
"pool",
".",
"get",
"(",
"'stock.move'",
")",
"picking_id",
"=",
"super",
"(",
"mrp_production",
",",
"self",
... | https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/source/addons/mrp_byproduct/mrp_byproduct.py#L83-L113 | |
mypaint/mypaint | 90b36dbc7b8bd2f323383f7edf608a5e0a3a1a33 | lib/layer/data.py | python | StrokemappedPaintingLayer.clear | (self) | Clear both the surface and the strokemap | Clear both the surface and the strokemap | [
"Clear",
"both",
"the",
"surface",
"and",
"the",
"strokemap"
] | def clear(self):
"""Clear both the surface and the strokemap"""
super(StrokemappedPaintingLayer, self).clear()
self.strokes = [] | [
"def",
"clear",
"(",
"self",
")",
":",
"super",
"(",
"StrokemappedPaintingLayer",
",",
"self",
")",
".",
"clear",
"(",
")",
"self",
".",
"strokes",
"=",
"[",
"]"
] | https://github.com/mypaint/mypaint/blob/90b36dbc7b8bd2f323383f7edf608a5e0a3a1a33/lib/layer/data.py#L1452-L1455 | ||
Yuliang-Liu/Box_Discretization_Network | 5b3a30c97429ef8e5c5e1c4e2476c7d9abdc03e6 | maskrcnn_benchmark/config/paths_catalog.py | python | ModelCatalog.get_c2_imagenet_pretrained | (name) | return url | [] | def get_c2_imagenet_pretrained(name):
prefix = ModelCatalog.S3_C2_DETECTRON_URL
name = name[len("ImageNetPretrained/"):]
name = ModelCatalog.C2_IMAGENET_MODELS[name]
url = "/".join([prefix, name])
return url | [
"def",
"get_c2_imagenet_pretrained",
"(",
"name",
")",
":",
"prefix",
"=",
"ModelCatalog",
".",
"S3_C2_DETECTRON_URL",
"name",
"=",
"name",
"[",
"len",
"(",
"\"ImageNetPretrained/\"",
")",
":",
"]",
"name",
"=",
"ModelCatalog",
".",
"C2_IMAGENET_MODELS",
"[",
"n... | https://github.com/Yuliang-Liu/Box_Discretization_Network/blob/5b3a30c97429ef8e5c5e1c4e2476c7d9abdc03e6/maskrcnn_benchmark/config/paths_catalog.py#L184-L189 | |||
twopirllc/pandas-ta | b92e45c0b8f035ac76292f8f130be32ec49b2ef4 | pandas_ta/statistics/entropy.py | python | entropy | (close, length=None, base=None, offset=None, **kwargs) | return entropy | Indicator: Entropy (ENTP) | Indicator: Entropy (ENTP) | [
"Indicator",
":",
"Entropy",
"(",
"ENTP",
")"
] | def entropy(close, length=None, base=None, offset=None, **kwargs):
"""Indicator: Entropy (ENTP)"""
# Validate Arguments
length = int(length) if length and length > 0 else 10
base = float(base) if base and base > 0 else 2.0
close = verify_series(close, length)
offset = get_offset(offset)
if ... | [
"def",
"entropy",
"(",
"close",
",",
"length",
"=",
"None",
",",
"base",
"=",
"None",
",",
"offset",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# Validate Arguments",
"length",
"=",
"int",
"(",
"length",
")",
"if",
"length",
"and",
"length",
">... | https://github.com/twopirllc/pandas-ta/blob/b92e45c0b8f035ac76292f8f130be32ec49b2ef4/pandas_ta/statistics/entropy.py#L6-L34 | |
collinsctk/PyQYT | 7af3673955f94ff1b2df2f94220cd2dab2e252af | ExtentionPackages/scapy/contrib/gsm_um.py | python | vgcsUplinkGrant | () | return packet | VGCS UPLINK GRANT Section 9.1.49 | VGCS UPLINK GRANT Section 9.1.49 | [
"VGCS",
"UPLINK",
"GRANT",
"Section",
"9",
".",
"1",
".",
"49"
] | def vgcsUplinkGrant():
"""VGCS UPLINK GRANT Section 9.1.49"""
a = TpPd(pd=0x6)
b = MessageType(mesType=0x9) # 00001001
c = RrCause()
d = RequestReference()
e = TimingAdvance()
packet = a / b / c / d / e
return packet | [
"def",
"vgcsUplinkGrant",
"(",
")",
":",
"a",
"=",
"TpPd",
"(",
"pd",
"=",
"0x6",
")",
"b",
"=",
"MessageType",
"(",
"mesType",
"=",
"0x9",
")",
"# 00001001",
"c",
"=",
"RrCause",
"(",
")",
"d",
"=",
"RequestReference",
"(",
")",
"e",
"=",
"TimingA... | https://github.com/collinsctk/PyQYT/blob/7af3673955f94ff1b2df2f94220cd2dab2e252af/ExtentionPackages/scapy/contrib/gsm_um.py#L1258-L1266 | |
ropnop/impacket_static_binaries | 9b5dedf7c851db6867cbd7750e7103e51957d7c4 | impacket/dot11.py | python | Dot11WPA2Data.set_MIC | (self, value) | Set the \'WPA2Data MIC\' field | Set the \'WPA2Data MIC\' field | [
"Set",
"the",
"\\",
"WPA2Data",
"MIC",
"\\",
"field"
] | def set_MIC(self, value):
'Set the \'WPA2Data MIC\' field'
#Padding to 8 bytes with 0x00's
value.ljust(8,b'\x00')
#Stripping to 8 bytes
value=value[:8]
self.tail.set_bytes_from_string(value) | [
"def",
"set_MIC",
"(",
"self",
",",
"value",
")",
":",
"#Padding to 8 bytes with 0x00's ",
"value",
".",
"ljust",
"(",
"8",
",",
"b'\\x00'",
")",
"#Stripping to 8 bytes",
"value",
"=",
"value",
"[",
":",
"8",
"]",
"self",
".",
"tail",
".",
"set_bytes_from_st... | https://github.com/ropnop/impacket_static_binaries/blob/9b5dedf7c851db6867cbd7750e7103e51957d7c4/impacket/dot11.py#L1443-L1449 | ||
edfungus/Crouton | ada98b3930192938a48909072b45cb84b945f875 | clients/python_clients/cf_demo_client/cf_env/lib/python2.7/site-packages/pkg_resources/__init__.py | python | Distribution.clone | (self,**kw) | return self.__class__(**kw) | Copy this distribution, substituting in any changed keyword args | Copy this distribution, substituting in any changed keyword args | [
"Copy",
"this",
"distribution",
"substituting",
"in",
"any",
"changed",
"keyword",
"args"
] | def clone(self,**kw):
"""Copy this distribution, substituting in any changed keyword args"""
names = 'project_name version py_version platform location precedence'
for attr in names.split():
kw.setdefault(attr, getattr(self, attr, None))
kw.setdefault('metadata', self._provid... | [
"def",
"clone",
"(",
"self",
",",
"*",
"*",
"kw",
")",
":",
"names",
"=",
"'project_name version py_version platform location precedence'",
"for",
"attr",
"in",
"names",
".",
"split",
"(",
")",
":",
"kw",
".",
"setdefault",
"(",
"attr",
",",
"getattr",
"(",
... | https://github.com/edfungus/Crouton/blob/ada98b3930192938a48909072b45cb84b945f875/clients/python_clients/cf_demo_client/cf_env/lib/python2.7/site-packages/pkg_resources/__init__.py#L2770-L2776 | |
mcfletch/pyopengl | 02d11dad9ff18e50db10e975c4756e17bf198464 | OpenGL/WGL/NV/multisample_coverage.py | python | glInitMultisampleCoverageNV | () | return extensions.hasGLExtension( _EXTENSION_NAME ) | Return boolean indicating whether this extension is available | Return boolean indicating whether this extension is available | [
"Return",
"boolean",
"indicating",
"whether",
"this",
"extension",
"is",
"available"
] | def glInitMultisampleCoverageNV():
'''Return boolean indicating whether this extension is available'''
from OpenGL import extensions
return extensions.hasGLExtension( _EXTENSION_NAME ) | [
"def",
"glInitMultisampleCoverageNV",
"(",
")",
":",
"from",
"OpenGL",
"import",
"extensions",
"return",
"extensions",
".",
"hasGLExtension",
"(",
"_EXTENSION_NAME",
")"
] | https://github.com/mcfletch/pyopengl/blob/02d11dad9ff18e50db10e975c4756e17bf198464/OpenGL/WGL/NV/multisample_coverage.py#L43-L46 | |
goldsborough/ig | b7f9d88c7d1a524333609fa40735cfb4987183b9 | ig/graph.py | python | Graph.is_empty | (self) | return len(self.nodes) == 0 | Returns:
True if the graph has no nodes at all, else False. | Returns:
True if the graph has no nodes at all, else False. | [
"Returns",
":",
"True",
"if",
"the",
"graph",
"has",
"no",
"nodes",
"at",
"all",
"else",
"False",
"."
] | def is_empty(self):
'''
Returns:
True if the graph has no nodes at all, else False.
'''
return len(self.nodes) == 0 | [
"def",
"is_empty",
"(",
"self",
")",
":",
"return",
"len",
"(",
"self",
".",
"nodes",
")",
"==",
"0"
] | https://github.com/goldsborough/ig/blob/b7f9d88c7d1a524333609fa40735cfb4987183b9/ig/graph.py#L78-L83 | |
stefanhoelzl/vue.py | f4256454256ddfe54a8be6dea493d3fc915ef1a2 | examples/todo_mvc/app.py | python | App.remove_todo | (self, todo) | [] | def remove_todo(self, todo):
del self.todos[self.todos.index(todo)] | [
"def",
"remove_todo",
"(",
"self",
",",
"todo",
")",
":",
"del",
"self",
".",
"todos",
"[",
"self",
".",
"todos",
".",
"index",
"(",
"todo",
")",
"]"
] | https://github.com/stefanhoelzl/vue.py/blob/f4256454256ddfe54a8be6dea493d3fc915ef1a2/examples/todo_mvc/app.py#L93-L94 | ||||
lisa-lab/pylearn2 | af81e5c362f0df4df85c3e54e23b2adeec026055 | pylearn2/utils/logger.py | python | CustomStreamHandler.emit | (self, record) | Emit a record.
If a formatter is specified, it is used to format the record.
The record is then written to the stream with a trailing newline. If
exception information is present, it is formatted using
traceback.print_exception and appended to the stream. If the stream
has an ... | Emit a record. | [
"Emit",
"a",
"record",
"."
] | def emit(self, record):
"""
Emit a record.
If a formatter is specified, it is used to format the record.
The record is then written to the stream with a trailing newline. If
exception information is present, it is formatted using
traceback.print_exception and appended t... | [
"def",
"emit",
"(",
"self",
",",
"record",
")",
":",
"try",
":",
"msg",
"=",
"self",
".",
"format",
"(",
"record",
")",
"if",
"record",
".",
"levelno",
">",
"logging",
".",
"INFO",
":",
"stream",
"=",
"self",
".",
"stderr",
"else",
":",
"stream",
... | https://github.com/lisa-lab/pylearn2/blob/af81e5c362f0df4df85c3e54e23b2adeec026055/pylearn2/utils/logger.py#L161-L211 | ||
open-io/oio-sds | 16041950b6056a55d5ce7ca77795defe6dfa6c61 | oio/api/object_storage.py | python | ObjectStorageApi.account_show | (self, account, **kwargs) | return self.account.account_show(account, **kwargs) | Get information about an account. | Get information about an account. | [
"Get",
"information",
"about",
"an",
"account",
"."
] | def account_show(self, account, **kwargs):
"""
Get information about an account.
"""
return self.account.account_show(account, **kwargs) | [
"def",
"account_show",
"(",
"self",
",",
"account",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"account",
".",
"account_show",
"(",
"account",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/open-io/oio-sds/blob/16041950b6056a55d5ce7ca77795defe6dfa6c61/oio/api/object_storage.py#L200-L204 | |
IntelPython/sdc | 1ebf55c00ef38dfbd401a70b3945e352a5a38b87 | sdc/sdc_autogenerated.py | python | sdc_pandas_series_ne | (self, other, level=None, fill_value=None, axis=0) | return series_ne_wrapper | Intel Scalable Dataframe Compiler User Guide
********************************************
Pandas API: pandas.Series.ne
Limitations
-----------
Parameters ``level`` and ``axis`` are currently unsupported by Intel Scalable Dataframe Compiler
Examples
--------
.. literalinclude:: ../../.... | Intel Scalable Dataframe Compiler User Guide
******************************************** | [
"Intel",
"Scalable",
"Dataframe",
"Compiler",
"User",
"Guide",
"********************************************"
] | def sdc_pandas_series_ne(self, other, level=None, fill_value=None, axis=0):
"""
Intel Scalable Dataframe Compiler User Guide
********************************************
Pandas API: pandas.Series.ne
Limitations
-----------
Parameters ``level`` and ``axis`` are currently unsupported by Inte... | [
"def",
"sdc_pandas_series_ne",
"(",
"self",
",",
"other",
",",
"level",
"=",
"None",
",",
"fill_value",
"=",
"None",
",",
"axis",
"=",
"0",
")",
":",
"_func_name",
"=",
"'Method ne().'",
"ty_checker",
"=",
"TypeChecker",
"(",
"_func_name",
")",
"ty_checker",... | https://github.com/IntelPython/sdc/blob/1ebf55c00ef38dfbd401a70b3945e352a5a38b87/sdc/sdc_autogenerated.py#L1742-L1813 | |
mihaip/mail-trends | 312b5be7f8f0a5933b05c75e229eda8e44c3c920 | stats/distribution.py | python | MeSenderDistribution.__init__ | (self, year) | [] | def __init__(self, year):
Distribution.__init__(self, year, "sender") | [
"def",
"__init__",
"(",
"self",
",",
"year",
")",
":",
"Distribution",
".",
"__init__",
"(",
"self",
",",
"year",
",",
"\"sender\"",
")"
] | https://github.com/mihaip/mail-trends/blob/312b5be7f8f0a5933b05c75e229eda8e44c3c920/stats/distribution.py#L198-L199 | ||||
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/matplotlib/text.py | python | _AnnotationBase.get_annotation_clip | (self) | return self._annotation_clip | Return *annotation_clip* attribute.
See :meth:`set_annotation_clip` for the meaning of return values. | Return *annotation_clip* attribute.
See :meth:`set_annotation_clip` for the meaning of return values. | [
"Return",
"*",
"annotation_clip",
"*",
"attribute",
".",
"See",
":",
"meth",
":",
"set_annotation_clip",
"for",
"the",
"meaning",
"of",
"return",
"values",
"."
] | def get_annotation_clip(self):
"""
Return *annotation_clip* attribute.
See :meth:`set_annotation_clip` for the meaning of return values.
"""
return self._annotation_clip | [
"def",
"get_annotation_clip",
"(",
"self",
")",
":",
"return",
"self",
".",
"_annotation_clip"
] | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/matplotlib/text.py#L1921-L1926 | |
brightmart/albert_zh | 652faed6b362c730eb046e9a2e5620d898736a01 | run_classifier.py | python | LCQMCPairClassificationProcessor.get_dev_examples | (self, data_dir) | return self._create_examples(
self._read_tsv(os.path.join(data_dir, "dev.txt")), "dev") | See base class. | See base class. | [
"See",
"base",
"class",
"."
] | def get_dev_examples(self, data_dir):
"""See base class."""
return self._create_examples(
self._read_tsv(os.path.join(data_dir, "dev.txt")), "dev") | [
"def",
"get_dev_examples",
"(",
"self",
",",
"data_dir",
")",
":",
"return",
"self",
".",
"_create_examples",
"(",
"self",
".",
"_read_tsv",
"(",
"os",
".",
"path",
".",
"join",
"(",
"data_dir",
",",
"\"dev.txt\"",
")",
")",
",",
"\"dev\"",
")"
] | https://github.com/brightmart/albert_zh/blob/652faed6b362c730eb046e9a2e5620d898736a01/run_classifier.py#L621-L624 | |
rwth-i6/returnn | f2d718a197a280b0d5f0fd91a7fcb8658560dddb | returnn/theano/engine.py | python | Engine.forward_single | (self, dataset, seq_idx, output_layer_name=None) | return output[:, 0] | Forwards a single sequence.
If you want to perform search, and get a number of hyps out, use :func:`search_single`.
:param Dataset.Dataset dataset:
:param int seq_idx:
:param str|None output_layer_name: e.g. "output". if not set, will read from config "forward_output_layer"
:return: numpy array, ou... | Forwards a single sequence.
If you want to perform search, and get a number of hyps out, use :func:`search_single`. | [
"Forwards",
"a",
"single",
"sequence",
".",
"If",
"you",
"want",
"to",
"perform",
"search",
"and",
"get",
"a",
"number",
"of",
"hyps",
"out",
"use",
":",
"func",
":",
"search_single",
"."
] | def forward_single(self, dataset, seq_idx, output_layer_name=None):
"""
Forwards a single sequence.
If you want to perform search, and get a number of hyps out, use :func:`search_single`.
:param Dataset.Dataset dataset:
:param int seq_idx:
:param str|None output_layer_name: e.g. "output". if no... | [
"def",
"forward_single",
"(",
"self",
",",
"dataset",
",",
"seq_idx",
",",
"output_layer_name",
"=",
"None",
")",
":",
"from",
"returnn",
".",
"engine",
".",
"batch",
"import",
"Batch",
",",
"BatchSetGenerator",
"batch",
"=",
"Batch",
"(",
")",
"batch",
".... | https://github.com/rwth-i6/returnn/blob/f2d718a197a280b0d5f0fd91a7fcb8658560dddb/returnn/theano/engine.py#L422-L443 | |
pfalcon/pycopy-lib | 56ebf2110f3caa63a3785d439ce49b11e13c75c0 | uu/uu.py | python | encode | (in_file, out_file, name=None, mode=None) | Uuencode file | Uuencode file | [
"Uuencode",
"file"
] | def encode(in_file, out_file, name=None, mode=None):
"""Uuencode file"""
#
# If in_file is a pathname open it and change defaults
#
opened_files = []
try:
if in_file == '-':
in_file = sys.stdin.buffer
elif isinstance(in_file, str):
if name is None:
... | [
"def",
"encode",
"(",
"in_file",
",",
"out_file",
",",
"name",
"=",
"None",
",",
"mode",
"=",
"None",
")",
":",
"#",
"# If in_file is a pathname open it and change defaults",
"#",
"opened_files",
"=",
"[",
"]",
"try",
":",
"if",
"in_file",
"==",
"'-'",
":",
... | https://github.com/pfalcon/pycopy-lib/blob/56ebf2110f3caa63a3785d439ce49b11e13c75c0/uu/uu.py#L42-L87 | ||
openstack/openstacksdk | 58384268487fa854f21c470b101641ab382c9897 | openstack/load_balancer/v2/_proxy.py | python | Proxy.get_l7_rule | (self, l7rule, l7_policy) | return self._get(_l7rule.L7Rule, l7rule,
l7policy_id=l7policyobj.id) | Get a single l7rule
:param l7rule: The l7rule can be the ID of a l7rule or a
:class:`~openstack.load_balancer.v2.l7_rule.L7Rule`
instance.
:param l7_policy: The l7_policy can be either the ID of a l7policy or
:class:`~openstack.load_bal... | Get a single l7rule | [
"Get",
"a",
"single",
"l7rule"
] | def get_l7_rule(self, l7rule, l7_policy):
"""Get a single l7rule
:param l7rule: The l7rule can be the ID of a l7rule or a
:class:`~openstack.load_balancer.v2.l7_rule.L7Rule`
instance.
:param l7_policy: The l7_policy can be either the ID of a l7polic... | [
"def",
"get_l7_rule",
"(",
"self",
",",
"l7rule",
",",
"l7_policy",
")",
":",
"l7policyobj",
"=",
"self",
".",
"_get_resource",
"(",
"_l7policy",
".",
"L7Policy",
",",
"l7_policy",
")",
"return",
"self",
".",
"_get",
"(",
"_l7rule",
".",
"L7Rule",
",",
"... | https://github.com/openstack/openstacksdk/blob/58384268487fa854f21c470b101641ab382c9897/openstack/load_balancer/v2/_proxy.py#L673-L689 | |
AutodeskRoboticsLab/Mimic | 85447f0d346be66988303a6a054473d92f1ed6f4 | mFIZ/scripts/mFIZ_extern/serial/tools/list_ports_common.py | python | ListPortInfo.__getitem__ | (self, index) | Item access: backwards compatible -> (port, desc, hwid) | Item access: backwards compatible -> (port, desc, hwid) | [
"Item",
"access",
":",
"backwards",
"compatible",
"-",
">",
"(",
"port",
"desc",
"hwid",
")"
] | def __getitem__(self, index):
"""Item access: backwards compatible -> (port, desc, hwid)"""
if index == 0:
return self.device
elif index == 1:
return self.description
elif index == 2:
return self.hwid
else:
raise IndexError('{} > 2'... | [
"def",
"__getitem__",
"(",
"self",
",",
"index",
")",
":",
"if",
"index",
"==",
"0",
":",
"return",
"self",
".",
"device",
"elif",
"index",
"==",
"1",
":",
"return",
"self",
".",
"description",
"elif",
"index",
"==",
"2",
":",
"return",
"self",
".",
... | https://github.com/AutodeskRoboticsLab/Mimic/blob/85447f0d346be66988303a6a054473d92f1ed6f4/mFIZ/scripts/mFIZ_extern/serial/tools/list_ports_common.py#L77-L86 | ||
huggingface/transformers | 623b4f7c63f60cce917677ee704d6c93ee960b4b | src/transformers/convert_slow_tokenizer.py | python | MBart50Converter.unk_id | (self, proto) | return 3 | [] | def unk_id(self, proto):
return 3 | [
"def",
"unk_id",
"(",
"self",
",",
"proto",
")",
":",
"return",
"3"
] | https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/convert_slow_tokenizer.py#L642-L643 | |||
google/caliban | 56f96e7e05b1d33ebdebc01620dc867f7ec54df3 | caliban/history/types.py | python | Experiment.__init__ | (
self,
args: Optional[List[str]] = None,
kwargs: Optional[Dict[str, Any]] = None,
) | Experiment
Args:
args: positional arguments for this experiment
kwargs: keyword-args for this experiment | Experiment | [
"Experiment"
] | def __init__(
self,
args: Optional[List[str]] = None,
kwargs: Optional[Dict[str, Any]] = None,
):
'''Experiment
Args:
args: positional arguments for this experiment
kwargs: keyword-args for this experiment
'''
self.args = args
self.kwargs = sorted_dict(kwargs)
self.c... | [
"def",
"__init__",
"(",
"self",
",",
"args",
":",
"Optional",
"[",
"List",
"[",
"str",
"]",
"]",
"=",
"None",
",",
"kwargs",
":",
"Optional",
"[",
"Dict",
"[",
"str",
",",
"Any",
"]",
"]",
"=",
"None",
",",
")",
":",
"self",
".",
"args",
"=",
... | https://github.com/google/caliban/blob/56f96e7e05b1d33ebdebc01620dc867f7ec54df3/caliban/history/types.py#L318-L331 | ||
lohriialo/photoshop-scripting-python | 6b97da967a5d0a45e54f7c99631b29773b923f09 | api_reference/photoshop_2020.py | python | _ActionDescriptor.HasKey | (self, Key=defaultNamedNotOptArg) | return self._oleobj_.InvokeTypes(1296118320, LCID, 1, (11, 0), ((3, 1),),Key
) | does the descriptor contain the provided key? | does the descriptor contain the provided key? | [
"does",
"the",
"descriptor",
"contain",
"the",
"provided",
"key?"
] | def HasKey(self, Key=defaultNamedNotOptArg):
'does the descriptor contain the provided key?'
return self._oleobj_.InvokeTypes(1296118320, LCID, 1, (11, 0), ((3, 1),),Key
) | [
"def",
"HasKey",
"(",
"self",
",",
"Key",
"=",
"defaultNamedNotOptArg",
")",
":",
"return",
"self",
".",
"_oleobj_",
".",
"InvokeTypes",
"(",
"1296118320",
",",
"LCID",
",",
"1",
",",
"(",
"11",
",",
"0",
")",
",",
"(",
"(",
"3",
",",
"1",
")",
"... | https://github.com/lohriialo/photoshop-scripting-python/blob/6b97da967a5d0a45e54f7c99631b29773b923f09/api_reference/photoshop_2020.py#L3447-L3450 | |
WooYun/TangScan | f4fd60228ec09ad10bd3dd3ef3b67e58bcdd4aa5 | tangscan/thirdparty/requests/sessions.py | python | Session.get | (self, url, **kwargs) | return self.request('GET', url, **kwargs) | Sends a GET request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes. | Sends a GET request. Returns :class:`Response` object. | [
"Sends",
"a",
"GET",
"request",
".",
"Returns",
":",
"class",
":",
"Response",
"object",
"."
] | def get(self, url, **kwargs):
"""Sends a GET request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
"""
kwargs.setdefault('allow_redirects', True)
return self.request(... | [
"def",
"get",
"(",
"self",
",",
"url",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
".",
"setdefault",
"(",
"'allow_redirects'",
",",
"True",
")",
"return",
"self",
".",
"request",
"(",
"'GET'",
",",
"url",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/WooYun/TangScan/blob/f4fd60228ec09ad10bd3dd3ef3b67e58bcdd4aa5/tangscan/thirdparty/requests/sessions.py#L455-L463 | |
alanhamlett/pip-update-requirements | ce875601ef278c8ce00ad586434a978731525561 | pur/packages/pip/_internal/utils/misc.py | python | dist_is_editable | (dist) | return False | Return True if given Distribution is an editable install. | Return True if given Distribution is an editable install. | [
"Return",
"True",
"if",
"given",
"Distribution",
"is",
"an",
"editable",
"install",
"."
] | def dist_is_editable(dist):
# type: (Distribution) -> bool
"""
Return True if given Distribution is an editable install.
"""
for path_item in sys.path:
egg_link = os.path.join(path_item, dist.project_name + '.egg-link')
if os.path.isfile(egg_link):
return True
return ... | [
"def",
"dist_is_editable",
"(",
"dist",
")",
":",
"# type: (Distribution) -> bool",
"for",
"path_item",
"in",
"sys",
".",
"path",
":",
"egg_link",
"=",
"os",
".",
"path",
".",
"join",
"(",
"path_item",
",",
"dist",
".",
"project_name",
"+",
"'.egg-link'",
")... | https://github.com/alanhamlett/pip-update-requirements/blob/ce875601ef278c8ce00ad586434a978731525561/pur/packages/pip/_internal/utils/misc.py#L358-L367 | |
triaquae/triaquae | bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9 | TriAquae/models/Ubuntu_13/pyasn1/type/base.py | python | AbstractSimpleAsn1Item.prettyOut | (self, value) | return str(value) | [] | def prettyOut(self, value): return str(value) | [
"def",
"prettyOut",
"(",
"self",
",",
"value",
")",
":",
"return",
"str",
"(",
"value",
")"
] | https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/Ubuntu_13/pyasn1/type/base.py#L121-L121 | |||
pymedusa/Medusa | 1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38 | ext/boto/swf/layer2.py | python | Domain.deprecate | (self) | DeprecateDomain | DeprecateDomain | [
"DeprecateDomain"
] | def deprecate(self):
"""DeprecateDomain"""
self._swf.deprecate_domain(self.name) | [
"def",
"deprecate",
"(",
"self",
")",
":",
"self",
".",
"_swf",
".",
"deprecate_domain",
"(",
"self",
".",
"name",
")"
] | https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/ext/boto/swf/layer2.py#L59-L61 | ||
Qirky/Troop | 529c5eb14e456f683e6d23fd4adcddc8446aa115 | src/OSC3.py | python | OSCMessage.itervalues | (self) | return iter(list(self.values())) | Returns an iterator of the OSCMessage's arguments | Returns an iterator of the OSCMessage's arguments | [
"Returns",
"an",
"iterator",
"of",
"the",
"OSCMessage",
"s",
"arguments"
] | def itervalues(self):
"""Returns an iterator of the OSCMessage's arguments
"""
return iter(list(self.values())) | [
"def",
"itervalues",
"(",
"self",
")",
":",
"return",
"iter",
"(",
"list",
"(",
"self",
".",
"values",
"(",
")",
")",
")"
] | https://github.com/Qirky/Troop/blob/529c5eb14e456f683e6d23fd4adcddc8446aa115/src/OSC3.py#L564-L567 | |
xmengli/H-DenseUNet | 06cc436a43196310fe933d114a353839907cc176 | Keras-2.0.8/keras/models.py | python | _clone_sequential_model | (model, input_tensors=None) | Clone a `Sequential` model instance.
Model cloning is similar to calling a model on new inputs,
except that it creates new layers (and thus new weights) instead
of sharing the weights of the existing layers.
# Arguments
model: Instance of `Sequential`.
input_tensors: optional list of i... | Clone a `Sequential` model instance. | [
"Clone",
"a",
"Sequential",
"model",
"instance",
"."
] | def _clone_sequential_model(model, input_tensors=None):
"""Clone a `Sequential` model instance.
Model cloning is similar to calling a model on new inputs,
except that it creates new layers (and thus new weights) instead
of sharing the weights of the existing layers.
# Arguments
model: Inst... | [
"def",
"_clone_sequential_model",
"(",
"model",
",",
"input_tensors",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"model",
",",
"Sequential",
")",
":",
"raise",
"ValueError",
"(",
"'Expected `model` argument '",
"'to be a `Sequential` model instance, '",
"'... | https://github.com/xmengli/H-DenseUNet/blob/06cc436a43196310fe933d114a353839907cc176/Keras-2.0.8/keras/models.py#L1444-L1495 | ||
scikit-multiflow/scikit-multiflow | d073a706b5006cba2584761286b7fa17e74e87be | src/skmultiflow/trees/extremely_fast_decision_tree.py | python | ExtremelyFastDecisionTreeClassifier._partial_fit | (self, X, y, sample_weight) | Trains the model on samples X and corresponding targets y.
Private function where actual training is carried on.
Parameters
----------
X: numpy.ndarray of shape (1, n_features)
Instance attributes.
y: int
Class label for sample X.
sample_weight: ... | Trains the model on samples X and corresponding targets y. | [
"Trains",
"the",
"model",
"on",
"samples",
"X",
"and",
"corresponding",
"targets",
"y",
"."
] | def _partial_fit(self, X, y, sample_weight):
""" Trains the model on samples X and corresponding targets y.
Private function where actual training is carried on.
Parameters
----------
X: numpy.ndarray of shape (1, n_features)
Instance attributes.
y: int
... | [
"def",
"_partial_fit",
"(",
"self",
",",
"X",
",",
"y",
",",
"sample_weight",
")",
":",
"if",
"self",
".",
"_tree_root",
"is",
"None",
":",
"self",
".",
"_tree_root",
"=",
"self",
".",
"_new_learning_node",
"(",
")",
"self",
".",
"_active_leaf_node_cnt",
... | https://github.com/scikit-multiflow/scikit-multiflow/blob/d073a706b5006cba2584761286b7fa17e74e87be/src/skmultiflow/trees/extremely_fast_decision_tree.py#L227-L251 | ||
PyMVPA/PyMVPA | 76c476b3de8264b0bb849bf226da5674d659564e | mvpa2/base/node.py | python | Node._get_call_kwargs | (self, ds) | return {} | Helper to provide _call kwargs, to be overriden in sub-classes
To be used if the same state variables should be set/used by
.generate or direct __call__ | Helper to provide _call kwargs, to be overriden in sub-classes | [
"Helper",
"to",
"provide",
"_call",
"kwargs",
"to",
"be",
"overriden",
"in",
"sub",
"-",
"classes"
] | def _get_call_kwargs(self, ds):
"""Helper to provide _call kwargs, to be overriden in sub-classes
To be used if the same state variables should be set/used by
.generate or direct __call__
"""
return {} | [
"def",
"_get_call_kwargs",
"(",
"self",
",",
"ds",
")",
":",
"return",
"{",
"}"
] | https://github.com/PyMVPA/PyMVPA/blob/76c476b3de8264b0bb849bf226da5674d659564e/mvpa2/base/node.py#L106-L112 | |
SCSSoftware/BlenderTools | 96f323d3bdf2d8cb8ed7f882dcdf036277a802dd | addon/io_scs_tools/utils/path.py | python | repair_path | (filepath) | return filepath | Takes a Blender filepath and tries to make it a valid absolute path. | Takes a Blender filepath and tries to make it a valid absolute path. | [
"Takes",
"a",
"Blender",
"filepath",
"and",
"tries",
"to",
"make",
"it",
"a",
"valid",
"absolute",
"path",
"."
] | def repair_path(filepath):
"""Takes a Blender filepath and tries to make it a valid absolute path."""
if filepath != '':
# print('0 filepath:\n"%s"' % filepath)
filepath = bpy.path.abspath(filepath, start=None, library=None) # make the path absolute
# print('1 filepath:\n"%s"' % filepat... | [
"def",
"repair_path",
"(",
"filepath",
")",
":",
"if",
"filepath",
"!=",
"''",
":",
"# print('0 filepath:\\n\"%s\"' % filepath)",
"filepath",
"=",
"bpy",
".",
"path",
".",
"abspath",
"(",
"filepath",
",",
"start",
"=",
"None",
",",
"library",
"=",
"None",
")... | https://github.com/SCSSoftware/BlenderTools/blob/96f323d3bdf2d8cb8ed7f882dcdf036277a802dd/addon/io_scs_tools/utils/path.py#L65-L73 | |
linxid/Machine_Learning_Study_Path | 558e82d13237114bbb8152483977806fc0c222af | Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/tarfile.py | python | TarFile.extractfile | (self, member) | Extract a member from the archive as a file object. `member' may be
a filename or a TarInfo object. If `member' is a regular file or a
link, an io.BufferedReader object is returned. Otherwise, None is
returned. | Extract a member from the archive as a file object. `member' may be
a filename or a TarInfo object. If `member' is a regular file or a
link, an io.BufferedReader object is returned. Otherwise, None is
returned. | [
"Extract",
"a",
"member",
"from",
"the",
"archive",
"as",
"a",
"file",
"object",
".",
"member",
"may",
"be",
"a",
"filename",
"or",
"a",
"TarInfo",
"object",
".",
"If",
"member",
"is",
"a",
"regular",
"file",
"or",
"a",
"link",
"an",
"io",
".",
"Buff... | def extractfile(self, member):
"""Extract a member from the archive as a file object. `member' may be
a filename or a TarInfo object. If `member' is a regular file or a
link, an io.BufferedReader object is returned. Otherwise, None is
returned.
"""
self._check("r... | [
"def",
"extractfile",
"(",
"self",
",",
"member",
")",
":",
"self",
".",
"_check",
"(",
"\"r\"",
")",
"if",
"isinstance",
"(",
"member",
",",
"str",
")",
":",
"tarinfo",
"=",
"self",
".",
"getmember",
"(",
"member",
")",
"else",
":",
"tarinfo",
"=",
... | https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/tarfile.py#L2064-L2093 | ||
pythonzm/Ops | e6fdddad2cd6bc697805a2bdba521a26bacada50 | projs/utils/git_tools.py | python | GitTools.clone | (self, prev_cmds, username='', password='', git_port=22) | :param prev_cmds: 代码检出前的操作
:param username: git仓库用户名,当repo_url使用http(s)协议时需要指定
:param password: git仓库密码,当repo_url使用http(s)协议时需要指定
:param git_port: git仓库端口,默认是22.当repo_url使用ssh协议时需要指定
:return: | :param prev_cmds: 代码检出前的操作
:param username: git仓库用户名,当repo_url使用http(s)协议时需要指定
:param password: git仓库密码,当repo_url使用http(s)协议时需要指定
:param git_port: git仓库端口,默认是22.当repo_url使用ssh协议时需要指定
:return: | [
":",
"param",
"prev_cmds",
":",
"代码检出前的操作",
":",
"param",
"username",
":",
"git仓库用户名,当repo_url使用http",
"(",
"s",
")",
"协议时需要指定",
":",
"param",
"password",
":",
"git仓库密码,当repo_url使用http",
"(",
"s",
")",
"协议时需要指定",
":",
"param",
"git_port",
":",
"git仓库端口,默认是22",
... | def clone(self, prev_cmds, username='', password='', git_port=22):
"""
:param prev_cmds: 代码检出前的操作
:param username: git仓库用户名,当repo_url使用http(s)协议时需要指定
:param password: git仓库密码,当repo_url使用http(s)协议时需要指定
:param git_port: git仓库端口,默认是22.当repo_url使用ssh协议时需要指定
:return:
"... | [
"def",
"clone",
"(",
"self",
",",
"prev_cmds",
",",
"username",
"=",
"''",
",",
"password",
"=",
"''",
",",
"git_port",
"=",
"22",
")",
":",
"try",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"base_path",
")",
":",
"os",... | https://github.com/pythonzm/Ops/blob/e6fdddad2cd6bc697805a2bdba521a26bacada50/projs/utils/git_tools.py#L34-L62 | ||
OpenXenManager/openxenmanager | 1cb5c1cb13358ba584856e99a94f9669d17670ff | src/pygtk_chart/line_chart.py | python | LineChart._do_draw_axes | (self, context, rect) | Draw x and y axis.
@type context: cairo.Context
@param context: The context to draw on.
@type rect: gtk.gdk.Rectangle
@param rect: A rectangle representing the charts area. | Draw x and y axis. | [
"Draw",
"x",
"and",
"y",
"axis",
"."
] | def _do_draw_axes(self, context, rect):
"""
Draw x and y axis.
@type context: cairo.Context
@param context: The context to draw on.
@type rect: gtk.gdk.Rectangle
@param rect: A rectangle representing the charts area.
"""
self.xaxis.draw(context, rect, sel... | [
"def",
"_do_draw_axes",
"(",
"self",
",",
"context",
",",
"rect",
")",
":",
"self",
".",
"xaxis",
".",
"draw",
"(",
"context",
",",
"rect",
",",
"self",
".",
"yaxis",
")",
"self",
".",
"yaxis",
".",
"draw",
"(",
"context",
",",
"rect",
",",
"self",... | https://github.com/OpenXenManager/openxenmanager/blob/1cb5c1cb13358ba584856e99a94f9669d17670ff/src/pygtk_chart/line_chart.py#L367-L377 | ||
sahana/eden | 1696fa50e90ce967df69f66b571af45356cc18da | modules/templates/RMS/controllers.py | python | org_SiteRepresent.bulk | (self, values, rows=None, list_type=False, show_link=True, include_blank=True) | return labels | Represent multiple values as dict {value: representation}
Args:
values: list of values
rows: the referenced rows (if values are foreign keys)
show_link: render each representation as link
include_blank: Also include a blank value
... | Represent multiple values as dict {value: representation} | [
"Represent",
"multiple",
"values",
"as",
"dict",
"{",
"value",
":",
"representation",
"}"
] | def bulk(self, values, rows=None, list_type=False, show_link=True, include_blank=True):
"""
Represent multiple values as dict {value: representation}
Args:
values: list of values
rows: the referenced rows (if values are foreign keys)
show_... | [
"def",
"bulk",
"(",
"self",
",",
"values",
",",
"rows",
"=",
"None",
",",
"list_type",
"=",
"False",
",",
"show_link",
"=",
"True",
",",
"include_blank",
"=",
"True",
")",
":",
"show_link",
"=",
"show_link",
"and",
"self",
".",
"show_link",
"if",
"show... | https://github.com/sahana/eden/blob/1696fa50e90ce967df69f66b571af45356cc18da/modules/templates/RMS/controllers.py#L942-L983 | |
entropy1337/infernal-twin | 10995cd03312e39a48ade0f114ebb0ae3a711bb8 | Modules/build/pillow/PIL/Image.py | python | Image.transform | (self, size, method, data=None, resample=NEAREST, fill=1) | return im | Transforms this image. This method creates a new image with the
given size, and the same mode as the original, and copies data
to the new image using the given transform.
:param size: The output size.
:param method: The transformation method. This is one of
:py:attr:`PIL.Ima... | Transforms this image. This method creates a new image with the
given size, and the same mode as the original, and copies data
to the new image using the given transform. | [
"Transforms",
"this",
"image",
".",
"This",
"method",
"creates",
"a",
"new",
"image",
"with",
"the",
"given",
"size",
"and",
"the",
"same",
"mode",
"as",
"the",
"original",
"and",
"copies",
"data",
"to",
"the",
"new",
"image",
"using",
"the",
"given",
"t... | def transform(self, size, method, data=None, resample=NEAREST, fill=1):
"""
Transforms this image. This method creates a new image with the
given size, and the same mode as the original, and copies data
to the new image using the given transform.
:param size: The output size.
... | [
"def",
"transform",
"(",
"self",
",",
"size",
",",
"method",
",",
"data",
"=",
"None",
",",
"resample",
"=",
"NEAREST",
",",
"fill",
"=",
"1",
")",
":",
"if",
"self",
".",
"mode",
"==",
"'RGBA'",
":",
"return",
"self",
".",
"convert",
"(",
"'RGBa'"... | https://github.com/entropy1337/infernal-twin/blob/10995cd03312e39a48ade0f114ebb0ae3a711bb8/Modules/build/pillow/PIL/Image.py#L1825-L1869 | |
rhinstaller/anaconda | 63edc8680f1b05cbfe11bef28703acba808c5174 | pyanaconda/modules/payloads/payload/dnf/dnf_manager.py | python | DNFManager.reset_base | (self) | Reset the DNF base. | Reset the DNF base. | [
"Reset",
"the",
"DNF",
"base",
"."
] | def reset_base(self):
"""Reset the DNF base."""
self.__base = None
self._ignore_missing_packages = False
self._ignore_broken_packages = False
self._download_location = None
self._md_hashes = {}
log.debug("The DNF base has been reset.") | [
"def",
"reset_base",
"(",
"self",
")",
":",
"self",
".",
"__base",
"=",
"None",
"self",
".",
"_ignore_missing_packages",
"=",
"False",
"self",
".",
"_ignore_broken_packages",
"=",
"False",
"self",
".",
"_download_location",
"=",
"None",
"self",
".",
"_md_hashe... | https://github.com/rhinstaller/anaconda/blob/63edc8680f1b05cbfe11bef28703acba808c5174/pyanaconda/modules/payloads/payload/dnf/dnf_manager.py#L155-L162 | ||
cagbal/ros_people_object_detection_tensorflow | 982ffd4a54b8059638f5cd4aa167299c7fc9e61f | src/object_detection/core/box_list.py | python | BoxList.get_extra_fields | (self) | return [k for k in self.data.keys() if k != 'boxes'] | Returns all non-box fields (i.e., everything not named 'boxes'). | Returns all non-box fields (i.e., everything not named 'boxes'). | [
"Returns",
"all",
"non",
"-",
"box",
"fields",
"(",
"i",
".",
"e",
".",
"everything",
"not",
"named",
"boxes",
")",
"."
] | def get_extra_fields(self):
"""Returns all non-box fields (i.e., everything not named 'boxes')."""
return [k for k in self.data.keys() if k != 'boxes'] | [
"def",
"get_extra_fields",
"(",
"self",
")",
":",
"return",
"[",
"k",
"for",
"k",
"in",
"self",
".",
"data",
".",
"keys",
"(",
")",
"if",
"k",
"!=",
"'boxes'",
"]"
] | https://github.com/cagbal/ros_people_object_detection_tensorflow/blob/982ffd4a54b8059638f5cd4aa167299c7fc9e61f/src/object_detection/core/box_list.py#L82-L84 | |
xinntao/EDVR | b02e63a0fc5854cad7b11a87f74601612e356eff | basicsr/models/losses/losses.py | python | gradient_penalty_loss | (discriminator, real_data, fake_data, weight=None) | return gradients_penalty | Calculate gradient penalty for wgan-gp.
Args:
discriminator (nn.Module): Network for the discriminator.
real_data (Tensor): Real input data.
fake_data (Tensor): Fake input data.
weight (Tensor): Weight tensor. Default: None.
Returns:
Tensor: A tensor for gradient penalt... | Calculate gradient penalty for wgan-gp. | [
"Calculate",
"gradient",
"penalty",
"for",
"wgan",
"-",
"gp",
"."
] | def gradient_penalty_loss(discriminator, real_data, fake_data, weight=None):
"""Calculate gradient penalty for wgan-gp.
Args:
discriminator (nn.Module): Network for the discriminator.
real_data (Tensor): Real input data.
fake_data (Tensor): Fake input data.
weight (Tensor): Weig... | [
"def",
"gradient_penalty_loss",
"(",
"discriminator",
",",
"real_data",
",",
"fake_data",
",",
"weight",
"=",
"None",
")",
":",
"batch_size",
"=",
"real_data",
".",
"size",
"(",
"0",
")",
"alpha",
"=",
"real_data",
".",
"new_tensor",
"(",
"torch",
".",
"ra... | https://github.com/xinntao/EDVR/blob/b02e63a0fc5854cad7b11a87f74601612e356eff/basicsr/models/losses/losses.py#L406-L442 | |
aws-samples/aws-kube-codesuite | ab4e5ce45416b83bffb947ab8d234df5437f4fca | src/kubernetes/client/models/v1_replication_controller_spec.py | python | V1ReplicationControllerSpec.selector | (self) | return self._selector | Gets the selector of this V1ReplicationControllerSpec.
Selector is a label query over pods that should match the Replicas count. If Selector is empty, it is defaulted to the labels present on the Pod template. Label keys and values that must match in order to be controlled by this replication controller, if emp... | Gets the selector of this V1ReplicationControllerSpec.
Selector is a label query over pods that should match the Replicas count. If Selector is empty, it is defaulted to the labels present on the Pod template. Label keys and values that must match in order to be controlled by this replication controller, if emp... | [
"Gets",
"the",
"selector",
"of",
"this",
"V1ReplicationControllerSpec",
".",
"Selector",
"is",
"a",
"label",
"query",
"over",
"pods",
"that",
"should",
"match",
"the",
"Replicas",
"count",
".",
"If",
"Selector",
"is",
"empty",
"it",
"is",
"defaulted",
"to",
... | def selector(self):
"""
Gets the selector of this V1ReplicationControllerSpec.
Selector is a label query over pods that should match the Replicas count. If Selector is empty, it is defaulted to the labels present on the Pod template. Label keys and values that must match in order to be controlle... | [
"def",
"selector",
"(",
"self",
")",
":",
"return",
"self",
".",
"_selector"
] | https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/kubernetes/client/models/v1_replication_controller_spec.py#L99-L107 | |
pantsbuild/pex | 473c6ac732ed4bc338b4b20a9ec930d1d722c9b4 | pex/vendor/_vendored/setuptools/setuptools/package_index.py | python | distros_for_url | (url, metadata=None) | Yield egg or source distribution objects that might be found at a URL | Yield egg or source distribution objects that might be found at a URL | [
"Yield",
"egg",
"or",
"source",
"distribution",
"objects",
"that",
"might",
"be",
"found",
"at",
"a",
"URL"
] | def distros_for_url(url, metadata=None):
"""Yield egg or source distribution objects that might be found at a URL"""
base, fragment = egg_info_for_url(url)
for dist in distros_for_location(url, base, metadata):
yield dist
if fragment:
match = EGG_FRAGMENT.match(fragment)
if match... | [
"def",
"distros_for_url",
"(",
"url",
",",
"metadata",
"=",
"None",
")",
":",
"base",
",",
"fragment",
"=",
"egg_info_for_url",
"(",
"url",
")",
"for",
"dist",
"in",
"distros_for_location",
"(",
"url",
",",
"base",
",",
"metadata",
")",
":",
"yield",
"di... | https://github.com/pantsbuild/pex/blob/473c6ac732ed4bc338b4b20a9ec930d1d722c9b4/pex/vendor/_vendored/setuptools/setuptools/package_index.py#L132-L143 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.