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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
glorotxa/SME | a1aa9fdb790fd356a17cd13d2b7b75feba2d8c82 | model.py | python | SimFnIdx | (fnsim, embeddings, leftop, rightop) | return theano.function([idxl, idxr, idxo], [simi],
on_unused_input='ignore') | This function returns a Theano function to measure the similarity score
for a given triplet of entity indexes.
:param fnsim: similarity function (on Theano variables).
:param embeddings: an Embeddings instance.
:param leftop: class for the 'left' operator.
:param rightop: class for the 'right' oper... | This function returns a Theano function to measure the similarity score
for a given triplet of entity indexes. | [
"This",
"function",
"returns",
"a",
"Theano",
"function",
"to",
"measure",
"the",
"similarity",
"score",
"for",
"a",
"given",
"triplet",
"of",
"entity",
"indexes",
"."
] | def SimFnIdx(fnsim, embeddings, leftop, rightop):
"""
This function returns a Theano function to measure the similarity score
for a given triplet of entity indexes.
:param fnsim: similarity function (on Theano variables).
:param embeddings: an Embeddings instance.
:param leftop: class for the '... | [
"def",
"SimFnIdx",
"(",
"fnsim",
",",
"embeddings",
",",
"leftop",
",",
"rightop",
")",
":",
"embedding",
",",
"relationl",
",",
"relationr",
"=",
"parse_embeddings",
"(",
"embeddings",
")",
"# Inputs",
"idxo",
"=",
"T",
".",
"iscalar",
"(",
"'idxo'",
")",... | https://github.com/glorotxa/SME/blob/a1aa9fdb790fd356a17cd13d2b7b75feba2d8c82/model.py#L544-L576 | |
google/grr | 8ad8a4d2c5a93c92729206b7771af19d92d4f915 | grr/server/grr_response_server/gui/api_plugins/flow.py | python | ApiListFlowDescriptorsHandler.Handle | (self, args, context=None) | return ApiListFlowDescriptorsResult(items=result) | Renders list of descriptors for all the flows. | Renders list of descriptors for all the flows. | [
"Renders",
"list",
"of",
"descriptors",
"for",
"all",
"the",
"flows",
"."
] | def Handle(self, args, context=None):
"""Renders list of descriptors for all the flows."""
result = []
for name, cls in sorted(registry.FlowRegistry.FLOW_REGISTRY.items()):
# Flows without a category do not show up in the GUI.
if not getattr(cls, "category", None):
continue
# On... | [
"def",
"Handle",
"(",
"self",
",",
"args",
",",
"context",
"=",
"None",
")",
":",
"result",
"=",
"[",
"]",
"for",
"name",
",",
"cls",
"in",
"sorted",
"(",
"registry",
".",
"FlowRegistry",
".",
"FLOW_REGISTRY",
".",
"items",
"(",
")",
")",
":",
"# F... | https://github.com/google/grr/blob/8ad8a4d2c5a93c92729206b7771af19d92d4f915/grr/server/grr_response_server/gui/api_plugins/flow.py#L1257-L1276 | |
pulp/pulp | a0a28d804f997b6f81c391378aff2e4c90183df9 | repoauth/pulp/repoauth/repo_cert_utils.py | python | RepoCertUtils.validate_certificate_pem | (self, cert_pem, ca_pem, log_func=None) | return self.x509_verify_cert(cert, ca_chain, log_func=log_func) | Validates a certificate against a CA certificate.
Input expects PEM encoded strings.
@param cert_pem: PEM encoded certificate
@type cert_pem: str
@param ca_pem: PEM encoded CA certificates, allows chain of CA certificates if
concatenated together
@type ca_pem: str
... | Validates a certificate against a CA certificate.
Input expects PEM encoded strings. | [
"Validates",
"a",
"certificate",
"against",
"a",
"CA",
"certificate",
".",
"Input",
"expects",
"PEM",
"encoded",
"strings",
"."
] | def validate_certificate_pem(self, cert_pem, ca_pem, log_func=None):
'''
Validates a certificate against a CA certificate.
Input expects PEM encoded strings.
@param cert_pem: PEM encoded certificate
@type cert_pem: str
@param ca_pem: PEM encoded CA certificates, allows... | [
"def",
"validate_certificate_pem",
"(",
"self",
",",
"cert_pem",
",",
"ca_pem",
",",
"log_func",
"=",
"None",
")",
":",
"if",
"not",
"log_func",
":",
"log_func",
"=",
"LOG",
".",
"info",
"cert",
"=",
"X509",
".",
"load_cert_string",
"(",
"cert_pem",
")",
... | https://github.com/pulp/pulp/blob/a0a28d804f997b6f81c391378aff2e4c90183df9/repoauth/pulp/repoauth/repo_cert_utils.py#L268-L290 | |
Calysto/calysto_scheme | 15bf81987870bcae1264e5a0a06feb9a8ee12b8b | calysto_scheme/scheme.py | python | exception_object_q | (x) | return (list_q(x)) and (numeric_equal(length(x), 7)) and (((x).car) is (symbol_exception_object)) and (valid_exception_type_q((x).cdr.car)) and (string_q((x).cdr.car)) | [] | def exception_object_q(x):
return (list_q(x)) and (numeric_equal(length(x), 7)) and (((x).car) is (symbol_exception_object)) and (valid_exception_type_q((x).cdr.car)) and (string_q((x).cdr.car)) | [
"def",
"exception_object_q",
"(",
"x",
")",
":",
"return",
"(",
"list_q",
"(",
"x",
")",
")",
"and",
"(",
"numeric_equal",
"(",
"length",
"(",
"x",
")",
",",
"7",
")",
")",
"and",
"(",
"(",
"(",
"x",
")",
".",
"car",
")",
"is",
"(",
"symbol_exc... | https://github.com/Calysto/calysto_scheme/blob/15bf81987870bcae1264e5a0a06feb9a8ee12b8b/calysto_scheme/scheme.py#L8244-L8245 | |||
lohriialo/photoshop-scripting-python | 6b97da967a5d0a45e54f7c99631b29773b923f09 | api_reference/photoshop_2020.py | python | CountItem.__iter__ | (self) | return win32com.client.util.Iterator(ob, None) | Return a Python iterator for this object | Return a Python iterator for this object | [
"Return",
"a",
"Python",
"iterator",
"for",
"this",
"object"
] | def __iter__(self):
"Return a Python iterator for this object"
try:
ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),())
except pythoncom.error:
raise TypeError("This object does not support enumeration")
return win32com.client.util.Iterator(ob, None) | [
"def",
"__iter__",
"(",
"self",
")",
":",
"try",
":",
"ob",
"=",
"self",
".",
"_oleobj_",
".",
"InvokeTypes",
"(",
"-",
"4",
",",
"LCID",
",",
"3",
",",
"(",
"13",
",",
"10",
")",
",",
"(",
")",
")",
"except",
"pythoncom",
".",
"error",
":",
... | https://github.com/lohriialo/photoshop-scripting-python/blob/6b97da967a5d0a45e54f7c99631b29773b923f09/api_reference/photoshop_2020.py#L1492-L1498 | |
svpcom/wifibroadcast | 51251b8c484b8c4f548aa3bbb1633e0edbb605dc | telemetry/mavlink.py | python | MAVLink.osd_param_config_reply_send | (self, request_id, result, force_mavlink1=False) | return self.send(self.osd_param_config_reply_encode(request_id, result), force_mavlink1=force_mavlink1) | Configure OSD parameter reply.
request_id : Request ID - copied from request. (type:uint32_t)
result : Config error type. (type:uint8_t, values:OSD_PARAM_CONFIG_ERROR) | Configure OSD parameter reply. | [
"Configure",
"OSD",
"parameter",
"reply",
"."
] | def osd_param_config_reply_send(self, request_id, result, force_mavlink1=False):
'''
Configure OSD parameter reply.
request_id : Request ID - copied from request. (type:uint32_t)
result : Config error type. (type:uint8_t,... | [
"def",
"osd_param_config_reply_send",
"(",
"self",
",",
"request_id",
",",
"result",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"osd_param_config_reply_encode",
"(",
"request_id",
",",
"result",
")",
",",
"f... | https://github.com/svpcom/wifibroadcast/blob/51251b8c484b8c4f548aa3bbb1633e0edbb605dc/telemetry/mavlink.py#L21969-L21977 | |
w3h/isf | 6faf0a3df185465ec17369c90ccc16e2a03a1870 | lib/thirdparty/scapy/contrib/igmp.py | python | isValidMCAddr | (ip) | return (FirstOct >= 224) and (FirstOct <= 239) | convert dotted quad string to long and check the first octet | convert dotted quad string to long and check the first octet | [
"convert",
"dotted",
"quad",
"string",
"to",
"long",
"and",
"check",
"the",
"first",
"octet"
] | def isValidMCAddr(ip):
"""convert dotted quad string to long and check the first octet"""
FirstOct=atol(ip)>>24 & 0xFF
return (FirstOct >= 224) and (FirstOct <= 239) | [
"def",
"isValidMCAddr",
"(",
"ip",
")",
":",
"FirstOct",
"=",
"atol",
"(",
"ip",
")",
">>",
"24",
"&",
"0xFF",
"return",
"(",
"FirstOct",
">=",
"224",
")",
"and",
"(",
"FirstOct",
"<=",
"239",
")"
] | https://github.com/w3h/isf/blob/6faf0a3df185465ec17369c90ccc16e2a03a1870/lib/thirdparty/scapy/contrib/igmp.py#L13-L16 | |
nlloyd/SubliminalCollaborator | 5c619e17ddbe8acb9eea8996ec038169ddcd50a1 | libs/twisted/python/_shellcomp.py | python | ZshArgumentsGenerator.writeHeader | (self) | This is the start of the code that calls _arguments
@return: C{None} | This is the start of the code that calls _arguments | [
"This",
"is",
"the",
"start",
"of",
"the",
"code",
"that",
"calls",
"_arguments"
] | def writeHeader(self):
"""
This is the start of the code that calls _arguments
@return: C{None}
"""
self.file.write('#compdef %s\n\n'
'_arguments -s -A "-*" \\\n' % (self.cmdName,)) | [
"def",
"writeHeader",
"(",
"self",
")",
":",
"self",
".",
"file",
".",
"write",
"(",
"'#compdef %s\\n\\n'",
"'_arguments -s -A \"-*\" \\\\\\n'",
"%",
"(",
"self",
".",
"cmdName",
",",
")",
")"
] | https://github.com/nlloyd/SubliminalCollaborator/blob/5c619e17ddbe8acb9eea8996ec038169ddcd50a1/libs/twisted/python/_shellcomp.py#L349-L355 | ||
CLUEbenchmark/CLUE | 5bd39732734afecb490cf18a5212e692dbf2c007 | baselines/models/xlnet/model_utils.py | python | avg_checkpoints | (model_dir, output_model_dir, last_k) | [] | def avg_checkpoints(model_dir, output_model_dir, last_k):
tf.reset_default_graph()
checkpoint_state = tf.train.get_checkpoint_state(model_dir)
checkpoints = checkpoint_state.all_model_checkpoint_paths[- last_k:]
var_list = tf.contrib.framework.list_variables(checkpoints[0])
var_values, var_dtypes = {}, {}
... | [
"def",
"avg_checkpoints",
"(",
"model_dir",
",",
"output_model_dir",
",",
"last_k",
")",
":",
"tf",
".",
"reset_default_graph",
"(",
")",
"checkpoint_state",
"=",
"tf",
".",
"train",
".",
"get_checkpoint_state",
"(",
"model_dir",
")",
"checkpoints",
"=",
"checkp... | https://github.com/CLUEbenchmark/CLUE/blob/5bd39732734afecb490cf18a5212e692dbf2c007/baselines/models/xlnet/model_utils.py#L224-L263 | ||||
googleads/google-ads-python | 2a1d6062221f6aad1992a6bcca0e7e4a93d2db86 | google/ads/googleads/v9/services/services/customizer_attribute_service/client.py | python | CustomizerAttributeServiceClient.transport | (self) | return self._transport | Return the transport used by the client instance.
Returns:
CustomizerAttributeServiceTransport: The transport used by the client instance. | Return the transport used by the client instance. | [
"Return",
"the",
"transport",
"used",
"by",
"the",
"client",
"instance",
"."
] | def transport(self) -> CustomizerAttributeServiceTransport:
"""Return the transport used by the client instance.
Returns:
CustomizerAttributeServiceTransport: The transport used by the client instance.
"""
return self._transport | [
"def",
"transport",
"(",
"self",
")",
"->",
"CustomizerAttributeServiceTransport",
":",
"return",
"self",
".",
"_transport"
] | https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v9/services/services/customizer_attribute_service/client.py#L158-L164 | |
myles/django-contacts | 4648bce0b0d1455981b2b059f3bf679e376d2737 | contacts/views/company.py | python | detail | (request, pk, slug=None, template='contacts/company/detail.html') | return render_to_response(template, kwvars, RequestContext(request)) | Detail of a company.
:param template: Add a custom template. | Detail of a company. | [
"Detail",
"of",
"a",
"company",
"."
] | def detail(request, pk, slug=None, template='contacts/company/detail.html'):
"""Detail of a company.
:param template: Add a custom template.
"""
try:
company = Company.objects.get(pk__iexact=pk)
except Company.DoesNotExist:
raise Http404
kwvars = {
'object': company,
... | [
"def",
"detail",
"(",
"request",
",",
"pk",
",",
"slug",
"=",
"None",
",",
"template",
"=",
"'contacts/company/detail.html'",
")",
":",
"try",
":",
"company",
"=",
"Company",
".",
"objects",
".",
"get",
"(",
"pk__iexact",
"=",
"pk",
")",
"except",
"Compa... | https://github.com/myles/django-contacts/blob/4648bce0b0d1455981b2b059f3bf679e376d2737/contacts/views/company.py#L51-L66 | |
upsert/lutron-caseta-pro | f5955c991c88c003752fee4df2d65ca028285d75 | custom_components/lutron_caseta_pro/__init__.py | python | Caseta.__getattr__ | (self, name) | return getattr(self.instance, name) | Return getter on the instance. | Return getter on the instance. | [
"Return",
"getter",
"on",
"the",
"instance",
"."
] | def __getattr__(self, name):
"""Return getter on the instance."""
return getattr(self.instance, name) | [
"def",
"__getattr__",
"(",
"self",
",",
"name",
")",
":",
"return",
"getattr",
"(",
"self",
".",
"instance",
",",
"name",
")"
] | https://github.com/upsert/lutron-caseta-pro/blob/f5955c991c88c003752fee4df2d65ca028285d75/custom_components/lutron_caseta_pro/__init__.py#L388-L390 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/interfaces/maxima_lib.py | python | MaximaLib.lisp | (self, cmd) | return ecl_eval(cmd) | Send a lisp command to maxima.
INPUT:
- ``cmd`` - string
OUTPUT: ECL object
.. note::
The output of this command is very raw - not pretty.
EXAMPLES::
sage: from sage.interfaces.maxima_lib import maxima_lib
sage: maxima_lib.lisp("(+ 2 17)"... | Send a lisp command to maxima. | [
"Send",
"a",
"lisp",
"command",
"to",
"maxima",
"."
] | def lisp(self, cmd):
"""
Send a lisp command to maxima.
INPUT:
- ``cmd`` - string
OUTPUT: ECL object
.. note::
The output of this command is very raw - not pretty.
EXAMPLES::
sage: from sage.interfaces.maxima_lib import maxima_lib
... | [
"def",
"lisp",
"(",
"self",
",",
"cmd",
")",
":",
"return",
"ecl_eval",
"(",
"cmd",
")"
] | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/interfaces/maxima_lib.py#L472-L492 | |
materialsproject/pymatgen | 8128f3062a334a2edd240e4062b5b9bdd1ae6f58 | pymatgen/analysis/energy_models.py | python | SymmetryModel.__init__ | (self, symprec=0.1, angle_tolerance=5) | Args:
symprec (float): Symmetry tolerance. Defaults to 0.1.
angle_tolerance (float): Tolerance for angles. Defaults to 5 degrees. | Args:
symprec (float): Symmetry tolerance. Defaults to 0.1.
angle_tolerance (float): Tolerance for angles. Defaults to 5 degrees. | [
"Args",
":",
"symprec",
"(",
"float",
")",
":",
"Symmetry",
"tolerance",
".",
"Defaults",
"to",
"0",
".",
"1",
".",
"angle_tolerance",
"(",
"float",
")",
":",
"Tolerance",
"for",
"angles",
".",
"Defaults",
"to",
"5",
"degrees",
"."
] | def __init__(self, symprec=0.1, angle_tolerance=5):
"""
Args:
symprec (float): Symmetry tolerance. Defaults to 0.1.
angle_tolerance (float): Tolerance for angles. Defaults to 5 degrees.
"""
self.symprec = symprec
self.angle_tolerance = angle_tolerance | [
"def",
"__init__",
"(",
"self",
",",
"symprec",
"=",
"0.1",
",",
"angle_tolerance",
"=",
"5",
")",
":",
"self",
".",
"symprec",
"=",
"symprec",
"self",
".",
"angle_tolerance",
"=",
"angle_tolerance"
] | https://github.com/materialsproject/pymatgen/blob/8128f3062a334a2edd240e4062b5b9bdd1ae6f58/pymatgen/analysis/energy_models.py#L110-L117 | ||
richardaecn/class-balanced-loss | 1d7857208a2abc03d84e35a9d5383af8225d4b4d | tpu/models/experimental/resnet50_keras/resnet50.py | python | learning_rate_schedule | (current_epoch, current_batch) | return learning_rate | Handles linear scaling rule, gradual warmup, and LR decay.
The learning rate starts at 0, then it increases linearly per step.
After 5 epochs we reach the base learning rate (scaled to account
for batch size).
After 30, 60 and 80 epochs the learning rate is divided by 10.
After 90 epochs training stops and... | Handles linear scaling rule, gradual warmup, and LR decay. | [
"Handles",
"linear",
"scaling",
"rule",
"gradual",
"warmup",
"and",
"LR",
"decay",
"."
] | def learning_rate_schedule(current_epoch, current_batch):
"""Handles linear scaling rule, gradual warmup, and LR decay.
The learning rate starts at 0, then it increases linearly per step.
After 5 epochs we reach the base learning rate (scaled to account
for batch size).
After 30, 60 and 80 epochs the learn... | [
"def",
"learning_rate_schedule",
"(",
"current_epoch",
",",
"current_batch",
")",
":",
"epoch",
"=",
"current_epoch",
"+",
"float",
"(",
"current_batch",
")",
"/",
"TRAINING_STEPS_PER_EPOCH",
"warmup_lr_multiplier",
",",
"warmup_end_epoch",
"=",
"LR_SCHEDULE",
"[",
"0... | https://github.com/richardaecn/class-balanced-loss/blob/1d7857208a2abc03d84e35a9d5383af8225d4b4d/tpu/models/experimental/resnet50_keras/resnet50.py#L88-L115 | |
entropy1337/infernal-twin | 10995cd03312e39a48ade0f114ebb0ae3a711bb8 | Modules/build/pip/build/lib.linux-i686-2.7/pip/_vendor/ipaddress.py | python | IPv4Address.is_unspecified | (self) | return self == self._constants._unspecified_address | Test if the address is unspecified.
Returns:
A boolean, True if this is the unspecified address as defined in
RFC 5735 3. | Test if the address is unspecified. | [
"Test",
"if",
"the",
"address",
"is",
"unspecified",
"."
] | def is_unspecified(self):
"""Test if the address is unspecified.
Returns:
A boolean, True if this is the unspecified address as defined in
RFC 5735 3.
"""
return self == self._constants._unspecified_address | [
"def",
"is_unspecified",
"(",
"self",
")",
":",
"return",
"self",
"==",
"self",
".",
"_constants",
".",
"_unspecified_address"
] | https://github.com/entropy1337/infernal-twin/blob/10995cd03312e39a48ade0f114ebb0ae3a711bb8/Modules/build/pip/build/lib.linux-i686-2.7/pip/_vendor/ipaddress.py#L1444-L1452 | |
sympy/sympy | d822fcba181155b85ff2b29fe525adbafb22b448 | sympy/printing/pretty/pretty_symbology.py | python | line_width | (line) | return len(line.translate(_remove_combining)) | Unicode combining symbols (modifiers) are not ever displayed as
separate symbols and thus shouldn't be counted | Unicode combining symbols (modifiers) are not ever displayed as
separate symbols and thus shouldn't be counted | [
"Unicode",
"combining",
"symbols",
"(",
"modifiers",
")",
"are",
"not",
"ever",
"displayed",
"as",
"separate",
"symbols",
"and",
"thus",
"shouldn",
"t",
"be",
"counted"
] | def line_width(line):
"""Unicode combining symbols (modifiers) are not ever displayed as
separate symbols and thus shouldn't be counted
"""
return len(line.translate(_remove_combining)) | [
"def",
"line_width",
"(",
"line",
")",
":",
"return",
"len",
"(",
"line",
".",
"translate",
"(",
"_remove_combining",
")",
")"
] | https://github.com/sympy/sympy/blob/d822fcba181155b85ff2b29fe525adbafb22b448/sympy/printing/pretty/pretty_symbology.py#L635-L639 | |
robclewley/pydstool | 939e3abc9dd1f180d35152bacbde57e24c85ff26 | PyDSTool/Toolbox/dssrt.py | python | plot_psis | (da, cols=None, do_vars=None, do_log=True, use_prefix=True) | da is a dssrt_assistant object.
cols is an optional dictionary mapping names of Psi entries to specific color/style character codes.
Pass do_vars list of Psi names to restrict, otherwise all will be plotted.
Option to plot on vertical log scale.
Option to switch off 'psi_' + da's focus_var as prefix fo... | da is a dssrt_assistant object.
cols is an optional dictionary mapping names of Psi entries to specific color/style character codes.
Pass do_vars list of Psi names to restrict, otherwise all will be plotted.
Option to plot on vertical log scale. | [
"da",
"is",
"a",
"dssrt_assistant",
"object",
".",
"cols",
"is",
"an",
"optional",
"dictionary",
"mapping",
"names",
"of",
"Psi",
"entries",
"to",
"specific",
"color",
"/",
"style",
"character",
"codes",
".",
"Pass",
"do_vars",
"list",
"of",
"Psi",
"names",
... | def plot_psis(da, cols=None, do_vars=None, do_log=True, use_prefix=True):
"""da is a dssrt_assistant object.
cols is an optional dictionary mapping names of Psi entries to specific color/style character codes.
Pass do_vars list of Psi names to restrict, otherwise all will be plotted.
Option to plot on v... | [
"def",
"plot_psis",
"(",
"da",
",",
"cols",
"=",
"None",
",",
"do_vars",
"=",
"None",
",",
"do_log",
"=",
"True",
",",
"use_prefix",
"=",
"True",
")",
":",
"from",
"PyDSTool",
".",
"matplotlib_import",
"import",
"plot",
"pts",
"=",
"da",
".",
"psi_pts"... | https://github.com/robclewley/pydstool/blob/939e3abc9dd1f180d35152bacbde57e24c85ff26/PyDSTool/Toolbox/dssrt.py#L1893-L1931 | ||
cupy/cupy | a47ad3105f0fe817a4957de87d98ddccb8c7491f | cupyx/scipy/sparse/construct.py | python | eye | (m, n=None, k=0, dtype='d', format=None) | return spdiags(diags, k, m, n).asformat(format) | Creates a sparse matrix with ones on diagonal.
Args:
m (int): Number of rows.
n (int or None): Number of columns. If it is ``None``,
it makes a square matrix.
k (int): Diagonal to place ones on.
dtype: Type of a matrix to create.
format (str or None): Format of t... | Creates a sparse matrix with ones on diagonal. | [
"Creates",
"a",
"sparse",
"matrix",
"with",
"ones",
"on",
"diagonal",
"."
] | def eye(m, n=None, k=0, dtype='d', format=None):
"""Creates a sparse matrix with ones on diagonal.
Args:
m (int): Number of rows.
n (int or None): Number of columns. If it is ``None``,
it makes a square matrix.
k (int): Diagonal to place ones on.
dtype: Type of a mat... | [
"def",
"eye",
"(",
"m",
",",
"n",
"=",
"None",
",",
"k",
"=",
"0",
",",
"dtype",
"=",
"'d'",
",",
"format",
"=",
"None",
")",
":",
"if",
"n",
"is",
"None",
":",
"n",
"=",
"m",
"m",
",",
"n",
"=",
"int",
"(",
"m",
")",
",",
"int",
"(",
... | https://github.com/cupy/cupy/blob/a47ad3105f0fe817a4957de87d98ddccb8c7491f/cupyx/scipy/sparse/construct.py#L10-L49 | |
un1t/django-cleanup | 2b02f61c151296571e104670c017db98f3d621f9 | django_cleanup/handlers.py | python | connect | () | Connect signals to the cleanup models | Connect signals to the cleanup models | [
"Connect",
"signals",
"to",
"the",
"cleanup",
"models"
] | def connect():
'''Connect signals to the cleanup models'''
for model in cache.cleanup_models():
key = '{{}}_django_cleanup_{}'.format(cache.get_model_name(model))
post_init.connect(cache_original_post_init, sender=model,
dispatch_uid=key.format('post_init'))
pre... | [
"def",
"connect",
"(",
")",
":",
"for",
"model",
"in",
"cache",
".",
"cleanup_models",
"(",
")",
":",
"key",
"=",
"'{{}}_django_cleanup_{}'",
".",
"format",
"(",
"cache",
".",
"get_model_name",
"(",
"model",
")",
")",
"post_init",
".",
"connect",
"(",
"c... | https://github.com/un1t/django-cleanup/blob/2b02f61c151296571e104670c017db98f3d621f9/django_cleanup/handlers.py#L108-L119 | ||
googledatalab/pydatalab | 1c86e26a0d24e3bc8097895ddeab4d0607be4c40 | datalab/bigquery/_api.py | python | Api.datasets_delete | (self, dataset_name, delete_contents) | return datalab.utils.Http.request(url, method='DELETE', args=args,
credentials=self._credentials, raw_response=True) | Issues a request to delete a dataset.
Args:
dataset_name: the name of the dataset to delete.
delete_contents: if True, any tables in the dataset will be deleted. If False and the
dataset is non-empty an exception will be raised.
Returns:
A parsed result object.
Raises:
Exc... | Issues a request to delete a dataset. | [
"Issues",
"a",
"request",
"to",
"delete",
"a",
"dataset",
"."
] | def datasets_delete(self, dataset_name, delete_contents):
"""Issues a request to delete a dataset.
Args:
dataset_name: the name of the dataset to delete.
delete_contents: if True, any tables in the dataset will be deleted. If False and the
dataset is non-empty an exception will be raised.... | [
"def",
"datasets_delete",
"(",
"self",
",",
"dataset_name",
",",
"delete_contents",
")",
":",
"url",
"=",
"Api",
".",
"_ENDPOINT",
"+",
"(",
"Api",
".",
"_DATASETS_PATH",
"%",
"dataset_name",
")",
"args",
"=",
"{",
"}",
"if",
"delete_contents",
":",
"args"... | https://github.com/googledatalab/pydatalab/blob/1c86e26a0d24e3bc8097895ddeab4d0607be4c40/datalab/bigquery/_api.py#L281-L298 | |
neulab/xnmt | d93f8f3710f986f36eb54e9ff3976a6b683da2a4 | xnmt/losses.py | python | BaseFactoredLossExpr.get_factored_loss_val | (self, comb_method: str = "sum") | Create factored loss values by calling ``.value()`` for each DyNet loss expression and applying batch combination.
Args:
comb_method: method for combining loss across batch elements ('sum' or 'avg').
Returns:
Factored loss values. | Create factored loss values by calling ``.value()`` for each DyNet loss expression and applying batch combination. | [
"Create",
"factored",
"loss",
"values",
"by",
"calling",
".",
"value",
"()",
"for",
"each",
"DyNet",
"loss",
"expression",
"and",
"applying",
"batch",
"combination",
"."
] | def get_factored_loss_val(self, comb_method: str = "sum") -> 'FactoredLossVal':
"""
Create factored loss values by calling ``.value()`` for each DyNet loss expression and applying batch combination.
Args:
comb_method: method for combining loss across batch elements ('sum' or 'avg').
Returns:
... | [
"def",
"get_factored_loss_val",
"(",
"self",
",",
"comb_method",
":",
"str",
"=",
"\"sum\"",
")",
"->",
"'FactoredLossVal'",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/neulab/xnmt/blob/d93f8f3710f986f36eb54e9ff3976a6b683da2a4/xnmt/losses.py#L72-L82 | ||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/rings/asymptotic/misc.py | python | split_str_by_op | (string, op, strip_parentheses=True) | return tuple(strip(f) for f in factors) | r"""
Split the given string into a tuple of substrings arising by
splitting by ``op`` and taking care of parentheses.
INPUT:
- ``string`` -- a string.
- ``op`` -- a string. This is used by
:python:`str.split <library/stdtypes.html#str.split>`.
Thus, if this is ``None``, then any white... | r"""
Split the given string into a tuple of substrings arising by
splitting by ``op`` and taking care of parentheses. | [
"r",
"Split",
"the",
"given",
"string",
"into",
"a",
"tuple",
"of",
"substrings",
"arising",
"by",
"splitting",
"by",
"op",
"and",
"taking",
"care",
"of",
"parentheses",
"."
] | def split_str_by_op(string, op, strip_parentheses=True):
r"""
Split the given string into a tuple of substrings arising by
splitting by ``op`` and taking care of parentheses.
INPUT:
- ``string`` -- a string.
- ``op`` -- a string. This is used by
:python:`str.split <library/stdtypes.html... | [
"def",
"split_str_by_op",
"(",
"string",
",",
"op",
",",
"strip_parentheses",
"=",
"True",
")",
":",
"def",
"is_balanced",
"(",
"s",
")",
":",
"open",
"=",
"0",
"for",
"l",
"in",
"s",
":",
"if",
"l",
"==",
"'('",
":",
"open",
"+=",
"1",
"elif",
"... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/rings/asymptotic/misc.py#L189-L297 | |
PyTorchLightning/pytorch-lightning | 5914fb748fb53d826ab337fc2484feab9883a104 | pytorch_lightning/core/hooks.py | python | ModelHooks.on_train_end | (self) | Called at the end of training before logger experiment is closed. | Called at the end of training before logger experiment is closed. | [
"Called",
"at",
"the",
"end",
"of",
"training",
"before",
"logger",
"experiment",
"is",
"closed",
"."
] | def on_train_end(self) -> None:
"""Called at the end of training before logger experiment is closed.""" | [
"def",
"on_train_end",
"(",
"self",
")",
"->",
"None",
":"
] | https://github.com/PyTorchLightning/pytorch-lightning/blob/5914fb748fb53d826ab337fc2484feab9883a104/pytorch_lightning/core/hooks.py#L43-L44 | ||
cmdmnt/commandment | 17c1dbe3f5301eab0f950f82608c231c15a3ff43 | commandment/vpp/vpp.py | python | VPP.edit_user | (self, client_user_id: str = None, facilitator_member_id: str = None,
email: str = None, managed_apple_id: str = None,
user_id: str = None) | return res.json() | Edit a user's VPP record.
Args:
client_user_id (str): A unique string, usually a UUID to identify the user in the MDM. You can use this OR
the user_id to identify the user.
facilitator_member_id: Currently unused
email (str): Supply an E-mail address ... | Edit a user's VPP record.
Args:
client_user_id (str): A unique string, usually a UUID to identify the user in the MDM. You can use this OR
the user_id to identify the user.
facilitator_member_id: Currently unused
email (str): Supply an E-mail address ... | [
"Edit",
"a",
"user",
"s",
"VPP",
"record",
".",
"Args",
":",
"client_user_id",
"(",
"str",
")",
":",
"A",
"unique",
"string",
"usually",
"a",
"UUID",
"to",
"identify",
"the",
"user",
"in",
"the",
"MDM",
".",
"You",
"can",
"use",
"this",
"OR",
"the",
... | def edit_user(self, client_user_id: str = None, facilitator_member_id: str = None,
email: str = None, managed_apple_id: str = None,
user_id: str = None):
"""
Edit a user's VPP record.
Args:
client_user_id (str): A unique string, usually a ... | [
"def",
"edit_user",
"(",
"self",
",",
"client_user_id",
":",
"str",
"=",
"None",
",",
"facilitator_member_id",
":",
"str",
"=",
"None",
",",
"email",
":",
"str",
"=",
"None",
",",
"managed_apple_id",
":",
"str",
"=",
"None",
",",
"user_id",
":",
"str",
... | https://github.com/cmdmnt/commandment/blob/17c1dbe3f5301eab0f950f82608c231c15a3ff43/commandment/vpp/vpp.py#L388-L418 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/pexpect/pxssh.py | python | pxssh.logout | (self) | Sends exit to the remote shell.
If there are stopped jobs then this automatically sends exit twice. | Sends exit to the remote shell. | [
"Sends",
"exit",
"to",
"the",
"remote",
"shell",
"."
] | def logout (self):
'''Sends exit to the remote shell.
If there are stopped jobs then this automatically sends exit twice.
'''
self.sendline("exit")
index = self.expect([EOF, "(?i)there are stopped jobs"])
if index==1:
self.sendline("exit")
self.ex... | [
"def",
"logout",
"(",
"self",
")",
":",
"self",
".",
"sendline",
"(",
"\"exit\"",
")",
"index",
"=",
"self",
".",
"expect",
"(",
"[",
"EOF",
",",
"\"(?i)there are stopped jobs\"",
"]",
")",
"if",
"index",
"==",
"1",
":",
"self",
".",
"sendline",
"(",
... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/pexpect/pxssh.py#L437-L447 | ||
PyTorchLightning/pytorch-lightning | 5914fb748fb53d826ab337fc2484feab9883a104 | pytorch_lightning/strategies/strategy.py | python | Strategy.setup | (self, trainer: "pl.Trainer") | Setup plugins for the trainer fit and creates optimizers.
Args:
trainer: the trainer instance | Setup plugins for the trainer fit and creates optimizers. | [
"Setup",
"plugins",
"for",
"the",
"trainer",
"fit",
"and",
"creates",
"optimizers",
"."
] | def setup(self, trainer: "pl.Trainer") -> None:
"""Setup plugins for the trainer fit and creates optimizers.
Args:
trainer: the trainer instance
"""
self.accelerator.setup(trainer)
self.setup_optimizers(trainer)
self.setup_precision_plugin()
self._mov... | [
"def",
"setup",
"(",
"self",
",",
"trainer",
":",
"\"pl.Trainer\"",
")",
"->",
"None",
":",
"self",
".",
"accelerator",
".",
"setup",
"(",
"trainer",
")",
"self",
".",
"setup_optimizers",
"(",
"trainer",
")",
"self",
".",
"setup_precision_plugin",
"(",
")"... | https://github.com/PyTorchLightning/pytorch-lightning/blob/5914fb748fb53d826ab337fc2484feab9883a104/pytorch_lightning/strategies/strategy.py#L111-L120 | ||
yuxiaokui/Intranet-Penetration | f57678a204840c83cbf3308e3470ae56c5ff514b | proxy/XX-Net/code/default/python27/1.0/lib/logging/__init__.py | python | Logger.callHandlers | (self, record) | Pass a record to all relevant handlers.
Loop through all handlers for this logger and its parents in the
logger hierarchy. If no handler was found, output a one-off error
message to sys.stderr. Stop searching up the hierarchy whenever a
logger with the "propagate" attribute set to zero ... | Pass a record to all relevant handlers. | [
"Pass",
"a",
"record",
"to",
"all",
"relevant",
"handlers",
"."
] | def callHandlers(self, record):
"""
Pass a record to all relevant handlers.
Loop through all handlers for this logger and its parents in the
logger hierarchy. If no handler was found, output a one-off error
message to sys.stderr. Stop searching up the hierarchy whenever a
... | [
"def",
"callHandlers",
"(",
"self",
",",
"record",
")",
":",
"c",
"=",
"self",
"found",
"=",
"0",
"while",
"c",
":",
"for",
"hdlr",
"in",
"c",
".",
"handlers",
":",
"found",
"=",
"found",
"+",
"1",
"if",
"record",
".",
"levelno",
">=",
"hdlr",
".... | https://github.com/yuxiaokui/Intranet-Penetration/blob/f57678a204840c83cbf3308e3470ae56c5ff514b/proxy/XX-Net/code/default/python27/1.0/lib/logging/__init__.py#L1312-L1336 | ||
baidu/Youtube-8M | 5ad9f3957ebedc2d1d572dea48c1fbcb55365249 | fast_forward_gru/data_provider.py | python | Dequantize | (feat_vector, max_quantized_value=2, min_quantized_value=-2) | return feat_vector * scalar + bias | Dequantize the feature from the byte format to the float format | Dequantize the feature from the byte format to the float format | [
"Dequantize",
"the",
"feature",
"from",
"the",
"byte",
"format",
"to",
"the",
"float",
"format"
] | def Dequantize(feat_vector, max_quantized_value=2, min_quantized_value=-2):
"""
Dequantize the feature from the byte format to the float format
"""
assert max_quantized_value > min_quantized_value
quantized_range = max_quantized_value - min_quantized_value
scalar = quantized_range / 255.0
b... | [
"def",
"Dequantize",
"(",
"feat_vector",
",",
"max_quantized_value",
"=",
"2",
",",
"min_quantized_value",
"=",
"-",
"2",
")",
":",
"assert",
"max_quantized_value",
">",
"min_quantized_value",
"quantized_range",
"=",
"max_quantized_value",
"-",
"min_quantized_value",
... | https://github.com/baidu/Youtube-8M/blob/5ad9f3957ebedc2d1d572dea48c1fbcb55365249/fast_forward_gru/data_provider.py#L30-L40 | |
lightbulb-framework/lightbulb-framework | 9e8d6f37f28c784963dba3d726a0c8022a605baf | lightbulb/core/utils/SimpleWebServer.py | python | SimpleWebServer.__init__ | (self, host, port, handler, delay, wsport) | Args:
host (str): The IP address for the websockets
port (int): The port for the websockets
handler (SocketHandler): The handler for the communication over websockets
Returns:
None | Args:
host (str): The IP address for the websockets
port (int): The port for the websockets
handler (SocketHandler): The handler for the communication over websockets
Returns:
None | [
"Args",
":",
"host",
"(",
"str",
")",
":",
"The",
"IP",
"address",
"for",
"the",
"websockets",
"port",
"(",
"int",
")",
":",
"The",
"port",
"for",
"the",
"websockets",
"handler",
"(",
"SocketHandler",
")",
":",
"The",
"handler",
"for",
"the",
"communic... | def __init__(self, host, port, handler, delay, wsport):
"""
Args:
host (str): The IP address for the websockets
port (int): The port for the websockets
handler (SocketHandler): The handler for the communication over websockets
Returns:
None
... | [
"def",
"__init__",
"(",
"self",
",",
"host",
",",
"port",
",",
"handler",
",",
"delay",
",",
"wsport",
")",
":",
"self",
".",
"websocketclass",
"=",
"handler",
"SocketServer",
".",
"TCPServer",
".",
"allow_reuse_address",
"=",
"True",
"self",
".",
"httpd",... | https://github.com/lightbulb-framework/lightbulb-framework/blob/9e8d6f37f28c784963dba3d726a0c8022a605baf/lightbulb/core/utils/SimpleWebServer.py#L9-L24 | ||
leo-editor/leo-editor | 383d6776d135ef17d73d935a2f0ecb3ac0e99494 | leo/plugins/obsolete/swing_gui.py | python | swingGui.eventChar | (self,event,c=None) | return event and event.char or '' | Return the char field of an event. | Return the char field of an event. | [
"Return",
"the",
"char",
"field",
"of",
"an",
"event",
"."
] | def eventChar (self,event,c=None):
'''Return the char field of an event.'''
return event and event.char or '' | [
"def",
"eventChar",
"(",
"self",
",",
"event",
",",
"c",
"=",
"None",
")",
":",
"return",
"event",
"and",
"event",
".",
"char",
"or",
"''"
] | https://github.com/leo-editor/leo-editor/blob/383d6776d135ef17d73d935a2f0ecb3ac0e99494/leo/plugins/obsolete/swing_gui.py#L6762-L6764 | |
hugapi/hug | 8b5ac00632543addfdcecc326d0475a685a0cba7 | hug/introspect.py | python | arguments | (function, extra_arguments=0) | return function.__code__.co_varnames[: function.__code__.co_argcount + extra_arguments] | Returns the name of all arguments a function takes | Returns the name of all arguments a function takes | [
"Returns",
"the",
"name",
"of",
"all",
"arguments",
"a",
"function",
"takes"
] | def arguments(function, extra_arguments=0):
"""Returns the name of all arguments a function takes"""
if not hasattr(function, "__code__"):
return ()
return function.__code__.co_varnames[: function.__code__.co_argcount + extra_arguments] | [
"def",
"arguments",
"(",
"function",
",",
"extra_arguments",
"=",
"0",
")",
":",
"if",
"not",
"hasattr",
"(",
"function",
",",
"\"__code__\"",
")",
":",
"return",
"(",
")",
"return",
"function",
".",
"__code__",
".",
"co_varnames",
"[",
":",
"function",
... | https://github.com/hugapi/hug/blob/8b5ac00632543addfdcecc326d0475a685a0cba7/hug/introspect.py#L43-L48 | |
yandex/yandex-tank | b41bcc04396c4ed46fc8b28a261197320854fd33 | yandextank/common/util.py | python | AsyncSession.exit_status | (self) | return self.session.recv_exit_status() | [] | def exit_status(self):
return self.session.recv_exit_status() | [
"def",
"exit_status",
"(",
"self",
")",
":",
"return",
"self",
".",
"session",
".",
"recv_exit_status",
"(",
")"
] | https://github.com/yandex/yandex-tank/blob/b41bcc04396c4ed46fc8b28a261197320854fd33/yandextank/common/util.py#L193-L194 | |||
Komodo/KomodoEdit | 61edab75dce2bdb03943b387b0608ea36f548e8e | src/codeintel/lib/codeintel2/database/langlib.py | python | LangZone.get_lib | (self, name, dirs) | return langdirslib | Dev Notes:
We make a lib for a particular sequence of dirs a singleton because:
1. The sequence of dirs for a language's import path tends to
not change, so the same object will tend to get used.
2. This allows caching of filesystem lookups to be done naturally
on the LangD... | Dev Notes:
We make a lib for a particular sequence of dirs a singleton because:
1. The sequence of dirs for a language's import path tends to
not change, so the same object will tend to get used.
2. This allows caching of filesystem lookups to be done naturally
on the LangD... | [
"Dev",
"Notes",
":",
"We",
"make",
"a",
"lib",
"for",
"a",
"particular",
"sequence",
"of",
"dirs",
"a",
"singleton",
"because",
":",
"1",
".",
"The",
"sequence",
"of",
"dirs",
"for",
"a",
"language",
"s",
"import",
"path",
"tends",
"to",
"not",
"change... | def get_lib(self, name, dirs):
"""
Dev Notes:
We make a lib for a particular sequence of dirs a singleton because:
1. The sequence of dirs for a language's import path tends to
not change, so the same object will tend to get used.
2. This allows caching of filesystem l... | [
"def",
"get_lib",
"(",
"self",
",",
"name",
",",
"dirs",
")",
":",
"assert",
"isinstance",
"(",
"dirs",
",",
"(",
"tuple",
",",
"list",
")",
")",
"canon_dirs",
"=",
"tuple",
"(",
"set",
"(",
"abspath",
"(",
"normpath",
"(",
"expanduser",
"(",
"d",
... | https://github.com/Komodo/KomodoEdit/blob/61edab75dce2bdb03943b387b0608ea36f548e8e/src/codeintel/lib/codeintel2/database/langlib.py#L1457-L1485 | |
CouchPotato/CouchPotatoServer | 7260c12f72447ddb6f062367c6dfbda03ecd4e9c | libs/xmpp/auth.py | python | Bind.FeaturesHandler | (self,conn,feats) | Determine if server supports resource binding and set some internal attributes accordingly. | Determine if server supports resource binding and set some internal attributes accordingly. | [
"Determine",
"if",
"server",
"supports",
"resource",
"binding",
"and",
"set",
"some",
"internal",
"attributes",
"accordingly",
"."
] | def FeaturesHandler(self,conn,feats):
""" Determine if server supports resource binding and set some internal attributes accordingly. """
if not feats.getTag('bind',namespace=NS_BIND):
self.bound='failure'
self.DEBUG('Server does not requested binding.','error')
retur... | [
"def",
"FeaturesHandler",
"(",
"self",
",",
"conn",
",",
"feats",
")",
":",
"if",
"not",
"feats",
".",
"getTag",
"(",
"'bind'",
",",
"namespace",
"=",
"NS_BIND",
")",
":",
"self",
".",
"bound",
"=",
"'failure'",
"self",
".",
"DEBUG",
"(",
"'Server does... | https://github.com/CouchPotato/CouchPotatoServer/blob/7260c12f72447ddb6f062367c6dfbda03ecd4e9c/libs/xmpp/auth.py#L230-L238 | ||
tensorflow/tfx | b4a6b83269815ed12ba9df9e9154c7376fef2ea0 | tfx/orchestration/kubeflow/container_entrypoint.py | python | _dump_ui_metadata | (
node: pipeline_pb2.PipelineNode,
execution_info: data_types.ExecutionInfo,
ui_metadata_path: str = '/mlpipeline-ui-metadata.json') | Dump KFP UI metadata json file for visualization purpose.
For general components we just render a simple Markdown file for
exec_properties/inputs/outputs.
Args:
node: associated TFX node.
execution_info: runtime execution info for this component, including
materialized inputs/outputs/execution p... | Dump KFP UI metadata json file for visualization purpose. | [
"Dump",
"KFP",
"UI",
"metadata",
"json",
"file",
"for",
"visualization",
"purpose",
"."
] | def _dump_ui_metadata(
node: pipeline_pb2.PipelineNode,
execution_info: data_types.ExecutionInfo,
ui_metadata_path: str = '/mlpipeline-ui-metadata.json') -> None:
"""Dump KFP UI metadata json file for visualization purpose.
For general components we just render a simple Markdown file for
exec_prope... | [
"def",
"_dump_ui_metadata",
"(",
"node",
":",
"pipeline_pb2",
".",
"PipelineNode",
",",
"execution_info",
":",
"data_types",
".",
"ExecutionInfo",
",",
"ui_metadata_path",
":",
"str",
"=",
"'/mlpipeline-ui-metadata.json'",
")",
"->",
"None",
":",
"exec_properties_list... | https://github.com/tensorflow/tfx/blob/b4a6b83269815ed12ba9df9e9154c7376fef2ea0/tfx/orchestration/kubeflow/container_entrypoint.py#L237-L353 | ||
google/compare_gan | 19922d3004b675c1a49c4d7515c06f6f75acdcc8 | compare_gan/architectures/resnet5.py | python | Generator.apply | (self, z, y, is_training) | return net | Build the generator network for the given inputs.
Args:
z: `Tensor` of shape [batch_size, z_dim] with latent code.
y: `Tensor` of shape [batch_size, num_classes] with one hot encoded
labels.
is_training: boolean, are we in train or eval model.
Returns:
A tensor of size [batch_s... | Build the generator network for the given inputs. | [
"Build",
"the",
"generator",
"network",
"for",
"the",
"given",
"inputs",
"."
] | def apply(self, z, y, is_training):
"""Build the generator network for the given inputs.
Args:
z: `Tensor` of shape [batch_size, z_dim] with latent code.
y: `Tensor` of shape [batch_size, num_classes] with one hot encoded
labels.
is_training: boolean, are we in train or eval model.
... | [
"def",
"apply",
"(",
"self",
",",
"z",
",",
"y",
",",
"is_training",
")",
":",
"# Each block upscales by a factor of 2.",
"seed_size",
"=",
"4",
"image_size",
"=",
"self",
".",
"_image_shape",
"[",
"0",
"]",
"# Map noise to the actual seed.",
"net",
"=",
"ops",
... | https://github.com/google/compare_gan/blob/19922d3004b675c1a49c4d7515c06f6f75acdcc8/compare_gan/architectures/resnet5.py#L44-L93 | |
AstroPrint/AstroBox | e7e3b8a7d33ea85fcb6b2696869c0d719ceb8b75 | src/ext/makerbot_driver/profile.py | python | _getprofiledir | (profiledir) | return profiledir | [] | def _getprofiledir(profiledir):
if None is profiledir:
profiledir = os.path.join(
os.path.abspath(os.path.dirname(__file__)), 'profiles') # Path of the profiles directory
return profiledir | [
"def",
"_getprofiledir",
"(",
"profiledir",
")",
":",
"if",
"None",
"is",
"profiledir",
":",
"profiledir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"__file__",
")",
")",... | https://github.com/AstroPrint/AstroBox/blob/e7e3b8a7d33ea85fcb6b2696869c0d719ceb8b75/src/ext/makerbot_driver/profile.py#L11-L15 | |||
shidenggui/easytrader | dbb166564c6c73da3446588a19d2692ad52716cb | easytrader/xqtrader.py | python | XueQiuTrader._search_stock_info | (self, code) | return stock | 通过雪球的接口获取股票详细信息
:param code: 股票代码 000001
:return: 查询到的股票 {u'stock_id': 1000279, u'code': u'SH600325',
u'name': u'华发股份', u'ind_color': u'#d9633b', u'chg': -1.09,
u'ind_id': 100014, u'percent': -9.31, u'current': 10.62,
u'hasexist': None, u'flag': 1, u'ind_name': u'房地产'... | 通过雪球的接口获取股票详细信息
:param code: 股票代码 000001
:return: 查询到的股票 {u'stock_id': 1000279, u'code': u'SH600325',
u'name': u'华发股份', u'ind_color': u'#d9633b', u'chg': -1.09,
u'ind_id': 100014, u'percent': -9.31, u'current': 10.62,
u'hasexist': None, u'flag': 1, u'ind_name': u'房地产'... | [
"通过雪球的接口获取股票详细信息",
":",
"param",
"code",
":",
"股票代码",
"000001",
":",
"return",
":",
"查询到的股票",
"{",
"u",
"stock_id",
":",
"1000279",
"u",
"code",
":",
"u",
"SH600325",
"u",
"name",
":",
"u",
"华发股份",
"u",
"ind_color",
":",
"u",
"#d9633b",
"u",
"chg",
"... | def _search_stock_info(self, code):
"""
通过雪球的接口获取股票详细信息
:param code: 股票代码 000001
:return: 查询到的股票 {u'stock_id': 1000279, u'code': u'SH600325',
u'name': u'华发股份', u'ind_color': u'#d9633b', u'chg': -1.09,
u'ind_id': 100014, u'percent': -9.31, u'current': 10.62,
... | [
"def",
"_search_stock_info",
"(",
"self",
",",
"code",
")",
":",
"data",
"=",
"{",
"\"code\"",
":",
"str",
"(",
"code",
")",
",",
"\"size\"",
":",
"\"300\"",
",",
"\"key\"",
":",
"\"47bce5c74f\"",
",",
"\"market\"",
":",
"self",
".",
"account_config",
"[... | https://github.com/shidenggui/easytrader/blob/dbb166564c6c73da3446588a19d2692ad52716cb/easytrader/xqtrader.py#L101-L124 | |
ANSSI-FR/polichombr | e2dc3874ae3d78c3b496e9656c9a6d1b88ae91e1 | polichombr/views/apiview.py | python | api_help | () | return response | Try to document the api.
see docs/API.md for more informations | Try to document the api.
see docs/API.md for more informations | [
"Try",
"to",
"document",
"the",
"api",
".",
"see",
"docs",
"/",
"API",
".",
"md",
"for",
"more",
"informations"
] | def api_help():
"""
Try to document the api.
see docs/API.md for more informations
"""
text = """
See docs/API.md for more informations
"""
response = make_response(text)
return response | [
"def",
"api_help",
"(",
")",
":",
"text",
"=",
"\"\"\"\n See docs/API.md for more informations\n \"\"\"",
"response",
"=",
"make_response",
"(",
"text",
")",
"return",
"response"
] | https://github.com/ANSSI-FR/polichombr/blob/e2dc3874ae3d78c3b496e9656c9a6d1b88ae91e1/polichombr/views/apiview.py#L86-L95 | |
veusz/veusz | 5a1e2af5f24df0eb2a2842be51f2997c4999c7fb | veusz/dataimport/defn_fits.py | python | OperationDataImportFITS.readDataFromFile | (self) | return dsread | Read data from fits file and return a dict of names to data. | Read data from fits file and return a dict of names to data. | [
"Read",
"data",
"from",
"fits",
"file",
"and",
"return",
"a",
"dict",
"of",
"names",
"to",
"data",
"."
] | def readDataFromFile(self):
"""Read data from fits file and return a dict of names to data."""
dsread = {}
with fits.open(self.params.filename, 'readonly') as fitsf:
hdunames = fits_hdf5_helpers.getFITSHduNames(fitsf)
for item in self.params.items:
parts... | [
"def",
"readDataFromFile",
"(",
"self",
")",
":",
"dsread",
"=",
"{",
"}",
"with",
"fits",
".",
"open",
"(",
"self",
".",
"params",
".",
"filename",
",",
"'readonly'",
")",
"as",
"fitsf",
":",
"hdunames",
"=",
"fits_hdf5_helpers",
".",
"getFITSHduNames",
... | https://github.com/veusz/veusz/blob/5a1e2af5f24df0eb2a2842be51f2997c4999c7fb/veusz/dataimport/defn_fits.py#L227-L258 | |
python-twitter-tools/twitter | 6a868f43dbc3a05527c339f45d21ea435fa8d1d3 | twitter/api.py | python | TwitterResponse.rate_limit_remaining | (self) | return int(self.headers.get('X-Rate-Limit-Remaining', "0")) | Remaining requests in the current rate-limit. | Remaining requests in the current rate-limit. | [
"Remaining",
"requests",
"in",
"the",
"current",
"rate",
"-",
"limit",
"."
] | def rate_limit_remaining(self):
"""
Remaining requests in the current rate-limit.
"""
return int(self.headers.get('X-Rate-Limit-Remaining', "0")) | [
"def",
"rate_limit_remaining",
"(",
"self",
")",
":",
"return",
"int",
"(",
"self",
".",
"headers",
".",
"get",
"(",
"'X-Rate-Limit-Remaining'",
",",
"\"0\"",
")",
")"
] | https://github.com/python-twitter-tools/twitter/blob/6a868f43dbc3a05527c339f45d21ea435fa8d1d3/twitter/api.py#L111-L115 | |
StackStorm/st2 | 85ae05b73af422efd3097c9c05351f7f1cc8369e | st2common/st2common/transport/announcement.py | python | AnnouncementDispatcher.dispatch | (self, routing_key, payload, trace_context=None) | Method which dispatches the announcement.
:param routing_key: Routing key of the announcement.
:type routing_key: ``str``
:param payload: Announcement payload.
:type payload: ``dict``
:param trace_context: Trace context to associate with Announcement.
:type trace_conte... | Method which dispatches the announcement. | [
"Method",
"which",
"dispatches",
"the",
"announcement",
"."
] | def dispatch(self, routing_key, payload, trace_context=None):
"""
Method which dispatches the announcement.
:param routing_key: Routing key of the announcement.
:type routing_key: ``str``
:param payload: Announcement payload.
:type payload: ``dict``
:param trac... | [
"def",
"dispatch",
"(",
"self",
",",
"routing_key",
",",
"payload",
",",
"trace_context",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"payload",
",",
"(",
"type",
"(",
"None",
")",
",",
"dict",
")",
")",
":",
"raise",
"TypeError",
"(",
"f\... | https://github.com/StackStorm/st2/blob/85ae05b73af422efd3097c9c05351f7f1cc8369e/st2common/st2common/transport/announcement.py#L50-L78 | ||
pculture/miro | d8e4594441939514dd2ac29812bf37087bb3aea5 | tv/lib/frontends/widgets/widgetutil.py | python | draw_rounded_icon | (context, icon, x, y, width, height, inset=0, fraction=1.0) | Draw an icon with the corners rounded.
x, y, width, height define where the box is.
inset creates a margin between where the images is drawn and (x, y, width,
height) | Draw an icon with the corners rounded. | [
"Draw",
"an",
"icon",
"with",
"the",
"corners",
"rounded",
"."
] | def draw_rounded_icon(context, icon, x, y, width, height, inset=0, fraction=1.0):
"""Draw an icon with the corners rounded.
x, y, width, height define where the box is.
inset creates a margin between where the images is drawn and (x, y, width,
height)
"""
context.save()
round_rect(context,... | [
"def",
"draw_rounded_icon",
"(",
"context",
",",
"icon",
",",
"x",
",",
"y",
",",
"width",
",",
"height",
",",
"inset",
"=",
"0",
",",
"fraction",
"=",
"1.0",
")",
":",
"context",
".",
"save",
"(",
")",
"round_rect",
"(",
"context",
",",
"x",
"+",
... | https://github.com/pculture/miro/blob/d8e4594441939514dd2ac29812bf37087bb3aea5/tv/lib/frontends/widgets/widgetutil.py#L120-L133 | ||
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/xiaomi_miio/fan.py | python | XiaomiFanP5.operation_mode_class | (self) | return FanOperationMode | Hold operation mode class. | Hold operation mode class. | [
"Hold",
"operation",
"mode",
"class",
"."
] | def operation_mode_class(self):
"""Hold operation mode class."""
return FanOperationMode | [
"def",
"operation_mode_class",
"(",
"self",
")",
":",
"return",
"FanOperationMode"
] | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/xiaomi_miio/fan.py#L889-L891 | |
pyeventsourcing/eventsourcing | f5a36f434ab2631890092b6c7714b8fb8c94dc7c | eventsourcing/interface.py | python | NotificationLogInterface.get_notifications | (
self, start: int, limit: int, topics: Sequence[str] = ()
) | Returns a serialised list of :class:`~eventsourcing.persistence.Notification`
objects from a notification log. | Returns a serialised list of :class:`~eventsourcing.persistence.Notification`
objects from a notification log. | [
"Returns",
"a",
"serialised",
"list",
"of",
":",
"class",
":",
"~eventsourcing",
".",
"persistence",
".",
"Notification",
"objects",
"from",
"a",
"notification",
"log",
"."
] | def get_notifications(
self, start: int, limit: int, topics: Sequence[str] = ()
) -> str:
"""
Returns a serialised list of :class:`~eventsourcing.persistence.Notification`
objects from a notification log.
""" | [
"def",
"get_notifications",
"(",
"self",
",",
"start",
":",
"int",
",",
"limit",
":",
"int",
",",
"topics",
":",
"Sequence",
"[",
"str",
"]",
"=",
"(",
")",
")",
"->",
"str",
":"
] | https://github.com/pyeventsourcing/eventsourcing/blob/f5a36f434ab2631890092b6c7714b8fb8c94dc7c/eventsourcing/interface.py#L25-L31 | ||
SeldomQA/poium | b95b6d49f31084d9a213de2d51e35803733ca136 | poium/wda/__init__.py | python | Page.assert_text_not_equals | (text_1, text_2, describe) | Asserts that two texts are not equal
Args:
text(list): text | Asserts that two texts are not equal | [
"Asserts",
"that",
"two",
"texts",
"are",
"not",
"equal"
] | def assert_text_not_equals(text_1, text_2, describe):
"""
Asserts that two texts are not equal
Args:
text(list): text
"""
logging.info("预期结果: " + text_1 + "," + text_2 + " 不相等")
if text_1 == text_2:
result = [describe, False]
Setting.... | [
"def",
"assert_text_not_equals",
"(",
"text_1",
",",
"text_2",
",",
"describe",
")",
":",
"logging",
".",
"info",
"(",
"\"预期结果: \" + text_",
" ",
" \",\" +",
"t",
"xt_",
" ",
" \" 不相等",
")",
"",
"",
"if",
"text_1",
"==",
"text_2",
":",
"result",
"=",
"["... | https://github.com/SeldomQA/poium/blob/b95b6d49f31084d9a213de2d51e35803733ca136/poium/wda/__init__.py#L404-L420 | ||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/nbconvert/filters/markdown_mistune.py | python | markdown2html_mistune | (source) | return MarkdownWithMath(renderer=IPythonRenderer(
escape=False)).render(source) | Convert a markdown string to HTML using mistune | Convert a markdown string to HTML using mistune | [
"Convert",
"a",
"markdown",
"string",
"to",
"HTML",
"using",
"mistune"
] | def markdown2html_mistune(source):
"""Convert a markdown string to HTML using mistune"""
return MarkdownWithMath(renderer=IPythonRenderer(
escape=False)).render(source) | [
"def",
"markdown2html_mistune",
"(",
"source",
")",
":",
"return",
"MarkdownWithMath",
"(",
"renderer",
"=",
"IPythonRenderer",
"(",
"escape",
"=",
"False",
")",
")",
".",
"render",
"(",
"source",
")"
] | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/nbconvert/filters/markdown_mistune.py#L148-L151 | |
git-cola/git-cola | b48b8028e0c3baf47faf7b074b9773737358163d | cola/widgets/completion.py | python | GitRefCompletionModel.__init__ | (self, context, parent) | [] | def __init__(self, context, parent):
GitCompletionModel.__init__(self, context, parent)
model = context.model
model.add_observer(model.message_refs_updated, self.emit_model_updated) | [
"def",
"__init__",
"(",
"self",
",",
"context",
",",
"parent",
")",
":",
"GitCompletionModel",
".",
"__init__",
"(",
"self",
",",
"context",
",",
"parent",
")",
"model",
"=",
"context",
".",
"model",
"model",
".",
"add_observer",
"(",
"model",
".",
"mess... | https://github.com/git-cola/git-cola/blob/b48b8028e0c3baf47faf7b074b9773737358163d/cola/widgets/completion.py#L561-L564 | ||||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/whoosh/collectors.py | python | CollapseCollector.collect_matches | (self) | [] | def collect_matches(self):
lists = self.lists
limit = self.limit
keyer = self.keyer
orderer = self.orderer
collapsed_counts = self.collapsed_counts
child = self.child
matcher = child.matcher
offset = child.offset
for sub_docnum in child.matches():... | [
"def",
"collect_matches",
"(",
"self",
")",
":",
"lists",
"=",
"self",
".",
"lists",
"limit",
"=",
"self",
".",
"limit",
"keyer",
"=",
"self",
".",
"keyer",
"orderer",
"=",
"self",
".",
"orderer",
"collapsed_counts",
"=",
"self",
".",
"collapsed_counts",
... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/whoosh/collectors.py#L950-L996 | ||||
Xilinx/finn | d1cc9cf94f1c33354cc169c5a6517314d0e94e3b | src/finn/custom_op/fpgadataflow/pool_batch.py | python | Pool_Batch.get_nodeattr_types | (self) | return my_attrs | [] | def get_nodeattr_types(self):
my_attrs = {
"Channels": ("i", True, 0),
"PE": ("i", True, 1),
"KernelSize": ("i", True, 0),
# Function:
# - MaxPool
# - QuantAvgPool
# TODO add support for AvgPool and AccPool
"Functi... | [
"def",
"get_nodeattr_types",
"(",
"self",
")",
":",
"my_attrs",
"=",
"{",
"\"Channels\"",
":",
"(",
"\"i\"",
",",
"True",
",",
"0",
")",
",",
"\"PE\"",
":",
"(",
"\"i\"",
",",
"True",
",",
"1",
")",
",",
"\"KernelSize\"",
":",
"(",
"\"i\"",
",",
"T... | https://github.com/Xilinx/finn/blob/d1cc9cf94f1c33354cc169c5a6517314d0e94e3b/src/finn/custom_op/fpgadataflow/pool_batch.py#L55-L75 | |||
tobegit3hub/deep_image_model | 8a53edecd9e00678b278bb10f6fb4bdb1e4ee25e | java_predict_client/src/main/proto/tensorflow/contrib/bayesflow/python/ops/stochastic_graph.py | python | _stochastic_dependencies_map | (fixed_losses, stochastic_tensors=None) | return stoch_dependencies_map | Map stochastic tensors to the fixed losses that depend on them.
Args:
fixed_losses: a list of `Tensor`s.
stochastic_tensors: a list of `StochasticTensor`s to map to fixed losses.
If `None`, all `StochasticTensor`s in the graph will be used.
Returns:
A dict `dependencies` that maps `StochasticTen... | Map stochastic tensors to the fixed losses that depend on them. | [
"Map",
"stochastic",
"tensors",
"to",
"the",
"fixed",
"losses",
"that",
"depend",
"on",
"them",
"."
] | def _stochastic_dependencies_map(fixed_losses, stochastic_tensors=None):
"""Map stochastic tensors to the fixed losses that depend on them.
Args:
fixed_losses: a list of `Tensor`s.
stochastic_tensors: a list of `StochasticTensor`s to map to fixed losses.
If `None`, all `StochasticTensor`s in the grap... | [
"def",
"_stochastic_dependencies_map",
"(",
"fixed_losses",
",",
"stochastic_tensors",
"=",
"None",
")",
":",
"stoch_value_collection",
"=",
"stochastic_tensors",
"or",
"ops",
".",
"get_collection",
"(",
"stochastic_tensor",
".",
"STOCHASTIC_TENSOR_COLLECTION",
")",
"if",... | https://github.com/tobegit3hub/deep_image_model/blob/8a53edecd9e00678b278bb10f6fb4bdb1e4ee25e/java_predict_client/src/main/proto/tensorflow/contrib/bayesflow/python/ops/stochastic_graph.py#L53-L92 | |
p-christ/nn_builder | a79b45d15176b4d333dbed094e78bb3b216ed037 | nn_builder/pytorch/RNN.py | python | RNN.get_activation | (self, activations, ix=None) | return activation | Gets the activation function | Gets the activation function | [
"Gets",
"the",
"activation",
"function"
] | def get_activation(self, activations, ix=None):
"""Gets the activation function"""
if isinstance(activations, list):
activation = self.str_to_activations_converter[str(activations[ix]).lower()]
else:
activation = self.str_to_activations_converter[str(activations).lower()]... | [
"def",
"get_activation",
"(",
"self",
",",
"activations",
",",
"ix",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"activations",
",",
"list",
")",
":",
"activation",
"=",
"self",
".",
"str_to_activations_converter",
"[",
"str",
"(",
"activations",
"[",
... | https://github.com/p-christ/nn_builder/blob/a79b45d15176b4d333dbed094e78bb3b216ed037/nn_builder/pytorch/RNN.py#L143-L149 | |
buke/GreenOdoo | 3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df | source/addons/document/document.py | python | node_class.full_path | (self) | return s | Return the components of the full path for some
node.
The returned list only contains the names of nodes. | Return the components of the full path for some
node.
The returned list only contains the names of nodes. | [
"Return",
"the",
"components",
"of",
"the",
"full",
"path",
"for",
"some",
"node",
".",
"The",
"returned",
"list",
"only",
"contains",
"the",
"names",
"of",
"nodes",
"."
] | def full_path(self):
""" Return the components of the full path for some
node.
The returned list only contains the names of nodes.
"""
if self.parent:
s = self.parent.full_path()
else:
s = []
if isinstance(self.path,list):
... | [
"def",
"full_path",
"(",
"self",
")",
":",
"if",
"self",
".",
"parent",
":",
"s",
"=",
"self",
".",
"parent",
".",
"full_path",
"(",
")",
"else",
":",
"s",
"=",
"[",
"]",
"if",
"isinstance",
"(",
"self",
".",
"path",
",",
"list",
")",
":",
"s",... | https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/source/addons/document/document.py#L719-L734 | |
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | opy/compiler2/transformer.py | python | Transformer.atom_lbrace | (self, nodelist) | return self.com_dictorsetmaker(nodelist[1]) | [] | def atom_lbrace(self, nodelist):
if nodelist[1][0] == token.RBRACE:
return Dict((), lineno=nodelist[0][2])
return self.com_dictorsetmaker(nodelist[1]) | [
"def",
"atom_lbrace",
"(",
"self",
",",
"nodelist",
")",
":",
"if",
"nodelist",
"[",
"1",
"]",
"[",
"0",
"]",
"==",
"token",
".",
"RBRACE",
":",
"return",
"Dict",
"(",
"(",
")",
",",
"lineno",
"=",
"nodelist",
"[",
"0",
"]",
"[",
"2",
"]",
")",... | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/opy/compiler2/transformer.py#L835-L838 | |||
tensorflow/models | 6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3 | research/object_detection/predictors/convolutional_keras_box_predictor.py | python | ConvolutionalBoxPredictor.build | (self, input_shapes) | Creates the variables of the layer. | Creates the variables of the layer. | [
"Creates",
"the",
"variables",
"of",
"the",
"layer",
"."
] | def build(self, input_shapes):
"""Creates the variables of the layer."""
if len(input_shapes) != len(self._prediction_heads[BOX_ENCODINGS]):
raise ValueError('This box predictor was constructed with %d heads,'
'but there are %d inputs.' %
(len(self._prediction... | [
"def",
"build",
"(",
"self",
",",
"input_shapes",
")",
":",
"if",
"len",
"(",
"input_shapes",
")",
"!=",
"len",
"(",
"self",
".",
"_prediction_heads",
"[",
"BOX_ENCODINGS",
"]",
")",
":",
"raise",
"ValueError",
"(",
"'This box predictor was constructed with %d h... | https://github.com/tensorflow/models/blob/6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3/research/object_detection/predictors/convolutional_keras_box_predictor.py#L140-L174 | ||
puremourning/vimspector | bc57b1dd14214cf3e3a476ef75e9dcb56cf0c76d | python3/vimspector/vendor/cpuinfo.py | python | Trace.keys | (self, keys, info, new_info) | [] | def keys(self, keys, info, new_info):
if not self._is_active: return
from inspect import stack
frame = stack()[2]
file = frame[1]
line = frame[2]
# List updated keys
self._output.write("\tChanged keys ({0} {1})\n".format(file, line))
changed_keys = [key for key in keys if key in info and key in new_in... | [
"def",
"keys",
"(",
"self",
",",
"keys",
",",
"info",
",",
"new_info",
")",
":",
"if",
"not",
"self",
".",
"_is_active",
":",
"return",
"from",
"inspect",
"import",
"stack",
"frame",
"=",
"stack",
"(",
")",
"[",
"2",
"]",
"file",
"=",
"frame",
"[",... | https://github.com/puremourning/vimspector/blob/bc57b1dd14214cf3e3a476ef75e9dcb56cf0c76d/python3/vimspector/vendor/cpuinfo.py#L125-L152 | ||||
limodou/ulipad | 4c7d590234f39cac80bb1d36dca095b646e287fb | packages/docutils/readers/python/moduleparser.py | python | normalize_parameter_name | (name) | Converts a tuple like ``('a', ('b', 'c'), 'd')`` into ``'(a, (b, c), d)'`` | Converts a tuple like ``('a', ('b', 'c'), 'd')`` into ``'(a, (b, c), d)'`` | [
"Converts",
"a",
"tuple",
"like",
"(",
"a",
"(",
"b",
"c",
")",
"d",
")",
"into",
"(",
"a",
"(",
"b",
"c",
")",
"d",
")"
] | def normalize_parameter_name(name):
"""
Converts a tuple like ``('a', ('b', 'c'), 'd')`` into ``'(a, (b, c), d)'``
"""
if type(name) is tuple:
return '(%s)' % ', '.join([normalize_parameter_name(n) for n in name])
else:
return name | [
"def",
"normalize_parameter_name",
"(",
"name",
")",
":",
"if",
"type",
"(",
"name",
")",
"is",
"tuple",
":",
"return",
"'(%s)'",
"%",
"', '",
".",
"join",
"(",
"[",
"normalize_parameter_name",
"(",
"n",
")",
"for",
"n",
"in",
"name",
"]",
")",
"else",... | https://github.com/limodou/ulipad/blob/4c7d590234f39cac80bb1d36dca095b646e287fb/packages/docutils/readers/python/moduleparser.py#L735-L742 | ||
annoviko/pyclustering | bf4f51a472622292627ec8c294eb205585e50f52 | pyclustering/nnet/som.py | python | som.show_distance_matrix | (self) | !
@brief Shows gray visualization of U-matrix (distance matrix).
@see get_distance_matrix() | ! | [
"!"
] | def show_distance_matrix(self):
"""!
@brief Shows gray visualization of U-matrix (distance matrix).
@see get_distance_matrix()
"""
distance_matrix = self.get_distance_matrix()
plt.imshow(distance_matrix, cmap=plt.get_cmap('hot'), interpolation='kaiser')... | [
"def",
"show_distance_matrix",
"(",
"self",
")",
":",
"distance_matrix",
"=",
"self",
".",
"get_distance_matrix",
"(",
")",
"plt",
".",
"imshow",
"(",
"distance_matrix",
",",
"cmap",
"=",
"plt",
".",
"get_cmap",
"(",
"'hot'",
")",
",",
"interpolation",
"=",
... | https://github.com/annoviko/pyclustering/blob/bf4f51a472622292627ec8c294eb205585e50f52/pyclustering/nnet/som.py#L703-L715 | ||
tholum/PiBunny | 289563fbd8e5334a2889dc1b5a7391465d212a3b | system.d/library/tools_installer/tools_to_install/impacket/impacket/dot11.py | python | Dot11WPA.set_TSC1 | (self, value) | Set the \'WPA TSC1\' field | Set the \'WPA TSC1\' field | [
"Set",
"the",
"\\",
"WPA",
"TSC1",
"\\",
"field"
] | def set_TSC1(self, value):
'Set the \'WPA TSC1\' field'
# set the bits
nb = (value & 0xFF)
self.header.set_byte(0, nb) | [
"def",
"set_TSC1",
"(",
"self",
",",
"value",
")",
":",
"# set the bits",
"nb",
"=",
"(",
"value",
"&",
"0xFF",
")",
"self",
".",
"header",
".",
"set_byte",
"(",
"0",
",",
"nb",
")"
] | https://github.com/tholum/PiBunny/blob/289563fbd8e5334a2889dc1b5a7391465d212a3b/system.d/library/tools_installer/tools_to_install/impacket/impacket/dot11.py#L1185-L1189 | ||
deanishe/alfred-fakeum | 12a7e64d9c099c0f11416ee99fae064d6360aab2 | src/workflow/update.py | python | Version.__str__ | (self) | return vstr | Return semantic version string. | Return semantic version string. | [
"Return",
"semantic",
"version",
"string",
"."
] | def __str__(self):
"""Return semantic version string."""
vstr = '{0}.{1}.{2}'.format(self.major, self.minor, self.patch)
if self.suffix:
vstr = '{0}-{1}'.format(vstr, self.suffix)
if self.build:
vstr = '{0}+{1}'.format(vstr, self.build)
return vstr | [
"def",
"__str__",
"(",
"self",
")",
":",
"vstr",
"=",
"'{0}.{1}.{2}'",
".",
"format",
"(",
"self",
".",
"major",
",",
"self",
".",
"minor",
",",
"self",
".",
"patch",
")",
"if",
"self",
".",
"suffix",
":",
"vstr",
"=",
"'{0}-{1}'",
".",
"format",
"... | https://github.com/deanishe/alfred-fakeum/blob/12a7e64d9c099c0f11416ee99fae064d6360aab2/src/workflow/update.py#L333-L340 | |
gevent/gevent | ae2cb5aeb2aea8987efcb90a4c50ca4e1ee12c31 | src/gevent/greenlet.py | python | Greenlet.exception | (self) | return self._exc_info[1] if self._exc_info is not None else None | Holds the exception instance raised by the function if the
greenlet has finished with an error. Otherwise ``None``. | Holds the exception instance raised by the function if the
greenlet has finished with an error. Otherwise ``None``. | [
"Holds",
"the",
"exception",
"instance",
"raised",
"by",
"the",
"function",
"if",
"the",
"greenlet",
"has",
"finished",
"with",
"an",
"error",
".",
"Otherwise",
"None",
"."
] | def exception(self):
"""
Holds the exception instance raised by the function if the
greenlet has finished with an error. Otherwise ``None``.
"""
return self._exc_info[1] if self._exc_info is not None else None | [
"def",
"exception",
"(",
"self",
")",
":",
"return",
"self",
".",
"_exc_info",
"[",
"1",
"]",
"if",
"self",
".",
"_exc_info",
"is",
"not",
"None",
"else",
"None"
] | https://github.com/gevent/gevent/blob/ae2cb5aeb2aea8987efcb90a4c50ca4e1ee12c31/src/gevent/greenlet.py#L568-L573 | |
deepchem/deepchem | 054eb4b2b082e3df8e1a8e77f36a52137ae6e375 | deepchem/models/chemnet_models.py | python | Smiles2Vec.__init__ | (self,
char_to_idx,
n_tasks=10,
max_seq_len=270,
embedding_dim=50,
n_classes=2,
use_bidir=True,
use_conv=True,
filters=192,
kernel_size=3,
strides=1,
rnn_s... | Parameters
----------
char_to_idx: dict,
char_to_idx contains character to index mapping for SMILES characters
embedding_dim: int, default 50
Size of character embeddings used.
use_bidir: bool, default True
Whether to use BiDirectional RNN Cells
use_conv: bool, default True
... | Parameters
----------
char_to_idx: dict,
char_to_idx contains character to index mapping for SMILES characters
embedding_dim: int, default 50
Size of character embeddings used.
use_bidir: bool, default True
Whether to use BiDirectional RNN Cells
use_conv: bool, default True
... | [
"Parameters",
"----------",
"char_to_idx",
":",
"dict",
"char_to_idx",
"contains",
"character",
"to",
"index",
"mapping",
"for",
"SMILES",
"characters",
"embedding_dim",
":",
"int",
"default",
"50",
"Size",
"of",
"character",
"embeddings",
"used",
".",
"use_bidir",
... | def __init__(self,
char_to_idx,
n_tasks=10,
max_seq_len=270,
embedding_dim=50,
n_classes=2,
use_bidir=True,
use_conv=True,
filters=192,
kernel_size=3,
strides=1,
... | [
"def",
"__init__",
"(",
"self",
",",
"char_to_idx",
",",
"n_tasks",
"=",
"10",
",",
"max_seq_len",
"=",
"270",
",",
"embedding_dim",
"=",
"50",
",",
"n_classes",
"=",
"2",
",",
"use_bidir",
"=",
"True",
",",
"use_conv",
"=",
"True",
",",
"filters",
"="... | https://github.com/deepchem/deepchem/blob/054eb4b2b082e3df8e1a8e77f36a52137ae6e375/deepchem/models/chemnet_models.py#L61-L118 | ||
naftaliharris/tauthon | 5587ceec329b75f7caf6d65a036db61ac1bae214 | Lib/sgmllib.py | python | SGMLParser.__init__ | (self, verbose=0) | Initialize and reset this instance. | Initialize and reset this instance. | [
"Initialize",
"and",
"reset",
"this",
"instance",
"."
] | def __init__(self, verbose=0):
"""Initialize and reset this instance."""
self.verbose = verbose
self.reset() | [
"def",
"__init__",
"(",
"self",
",",
"verbose",
"=",
"0",
")",
":",
"self",
".",
"verbose",
"=",
"verbose",
"self",
".",
"reset",
"(",
")"
] | https://github.com/naftaliharris/tauthon/blob/5587ceec329b75f7caf6d65a036db61ac1bae214/Lib/sgmllib.py#L66-L69 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/pygments/lexers/templates.py | python | HtmlPhpLexer.analyse_text | (text) | return rv | [] | def analyse_text(text):
rv = PhpLexer.analyse_text(text) - 0.01
if html_doctype_matches(text):
rv += 0.5
return rv | [
"def",
"analyse_text",
"(",
"text",
")",
":",
"rv",
"=",
"PhpLexer",
".",
"analyse_text",
"(",
"text",
")",
"-",
"0.01",
"if",
"html_doctype_matches",
"(",
"text",
")",
":",
"rv",
"+=",
"0.5",
"return",
"rv"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/pygments/lexers/templates.py#L1120-L1124 | |||
etetoolkit/ete | 2b207357dc2a40ccad7bfd8f54964472c72e4726 | ete3/coretype/tree.py | python | TreeNode.get_sisters | (self) | Returns an independent list of sister nodes. | Returns an independent list of sister nodes. | [
"Returns",
"an",
"independent",
"list",
"of",
"sister",
"nodes",
"."
] | def get_sisters(self):
"""
Returns an independent list of sister nodes.
"""
if self.up is not None:
return [ch for ch in self.up.children if ch!=self]
else:
return [] | [
"def",
"get_sisters",
"(",
"self",
")",
":",
"if",
"self",
".",
"up",
"is",
"not",
"None",
":",
"return",
"[",
"ch",
"for",
"ch",
"in",
"self",
".",
"up",
".",
"children",
"if",
"ch",
"!=",
"self",
"]",
"else",
":",
"return",
"[",
"]"
] | https://github.com/etetoolkit/ete/blob/2b207357dc2a40ccad7bfd8f54964472c72e4726/ete3/coretype/tree.py#L591-L598 | ||
titusjan/argos | 5a9c31a8a9a2ca825bbf821aa1e685740e3682d7 | argos/utils/masks.py | python | nanPercentileOfSubsampledArrayWithMask | (arrayWithMask, percentiles, subsample, *args, **kwargs) | return _maskedNanPercentile(maskedArray, percentiles, *args, **kwargs) | Sub samples the array and then calls maskedNanPercentile on this.
If subsample is False, no sub sampling is done and it just calls maskedNanPercentile | Sub samples the array and then calls maskedNanPercentile on this. | [
"Sub",
"samples",
"the",
"array",
"and",
"then",
"calls",
"maskedNanPercentile",
"on",
"this",
"."
] | def nanPercentileOfSubsampledArrayWithMask(arrayWithMask, percentiles, subsample, *args, **kwargs):
""" Sub samples the array and then calls maskedNanPercentile on this.
If subsample is False, no sub sampling is done and it just calls maskedNanPercentile
"""
check_class(subsample, bool)
check_c... | [
"def",
"nanPercentileOfSubsampledArrayWithMask",
"(",
"arrayWithMask",
",",
"percentiles",
",",
"subsample",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"check_class",
"(",
"subsample",
",",
"bool",
")",
"check_class",
"(",
"arrayWithMask",
",",
"ArrayW... | https://github.com/titusjan/argos/blob/5a9c31a8a9a2ca825bbf821aa1e685740e3682d7/argos/utils/masks.py#L255-L268 | |
cooelf/SemBERT | f849452f864b5dd47f94e2911cffc15e9f6a5a2a | run_scorer.py | python | STSProcessor.get_dev_examples | (self, data_dir) | return self._create_examples(
self._read_tsv(os.path.join(data_dir, "dev.tsv_tag")), "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.tsv_tag")), "dev") | [
"def",
"get_dev_examples",
"(",
"self",
",",
"data_dir",
")",
":",
"return",
"self",
".",
"_create_examples",
"(",
"self",
".",
"_read_tsv",
"(",
"os",
".",
"path",
".",
"join",
"(",
"data_dir",
",",
"\"dev.tsv_tag\"",
")",
")",
",",
"\"dev\"",
")"
] | https://github.com/cooelf/SemBERT/blob/f849452f864b5dd47f94e2911cffc15e9f6a5a2a/run_scorer.py#L110-L113 | |
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/runners/reactor.py | python | set_leader | (value=True) | Set the current reactor to act as a leader (responding to events). Defaults to True
CLI Example:
.. code-block:: bash
salt-run reactor.set_leader True | Set the current reactor to act as a leader (responding to events). Defaults to True | [
"Set",
"the",
"current",
"reactor",
"to",
"act",
"as",
"a",
"leader",
"(",
"responding",
"to",
"events",
")",
".",
"Defaults",
"to",
"True"
] | def set_leader(value=True):
"""
Set the current reactor to act as a leader (responding to events). Defaults to True
CLI Example:
.. code-block:: bash
salt-run reactor.set_leader True
"""
if not _reactor_system_available():
raise CommandExecutionError("Reactor system is not run... | [
"def",
"set_leader",
"(",
"value",
"=",
"True",
")",
":",
"if",
"not",
"_reactor_system_available",
"(",
")",
":",
"raise",
"CommandExecutionError",
"(",
"\"Reactor system is not running.\"",
")",
"with",
"salt",
".",
"utils",
".",
"event",
".",
"get_event",
"("... | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/runners/reactor.py#L170-L199 | ||
nickstenning/honcho | 279ac41dc8a4dfa90d583b3d1c70da4f7ff38ebc | honcho/environ.py | python | expand_processes | (processes, concurrency=None, env=None, quiet=None, port=None) | return out | Get a list of the processes that need to be started given the specified
list of process types, concurrency, environment, quietness, and base port
number.
Returns a list of ProcessParams objects, which have `name`, `cmd`, `env`,
and `quiet` attributes, corresponding to the parameters to the constructor
... | Get a list of the processes that need to be started given the specified
list of process types, concurrency, environment, quietness, and base port
number. | [
"Get",
"a",
"list",
"of",
"the",
"processes",
"that",
"need",
"to",
"be",
"started",
"given",
"the",
"specified",
"list",
"of",
"process",
"types",
"concurrency",
"environment",
"quietness",
"and",
"base",
"port",
"number",
"."
] | def expand_processes(processes, concurrency=None, env=None, quiet=None, port=None):
"""
Get a list of the processes that need to be started given the specified
list of process types, concurrency, environment, quietness, and base port
number.
Returns a list of ProcessParams objects, which have `name... | [
"def",
"expand_processes",
"(",
"processes",
",",
"concurrency",
"=",
"None",
",",
"env",
"=",
"None",
",",
"quiet",
"=",
"None",
",",
"port",
"=",
"None",
")",
":",
"if",
"env",
"is",
"not",
"None",
"and",
"env",
".",
"get",
"(",
"\"PORT\"",
")",
... | https://github.com/nickstenning/honcho/blob/279ac41dc8a4dfa90d583b3d1c70da4f7ff38ebc/honcho/environ.py#L88-L126 | |
zopefoundation/Zope | ea04dd670d1a48d4d5c879d3db38fc2e9b4330bb | src/Products/PageTemplates/PageTemplateFile.py | python | PageTemplateFile._prepare_html | (self, text) | return text, type_ | [] | def _prepare_html(self, text):
match = meta_pattern.search(text)
if match is not None:
type_, encoding = (x.decode(self.encoding) for x in match.groups())
# TODO: Shouldn't <meta>/<?xml?> stripping
# be in PageTemplate.__call__()?
text = meta_pattern.sub(b... | [
"def",
"_prepare_html",
"(",
"self",
",",
"text",
")",
":",
"match",
"=",
"meta_pattern",
".",
"search",
"(",
"text",
")",
"if",
"match",
"is",
"not",
"None",
":",
"type_",
",",
"encoding",
"=",
"(",
"x",
".",
"decode",
"(",
"self",
".",
"encoding",
... | https://github.com/zopefoundation/Zope/blob/ea04dd670d1a48d4d5c879d3db38fc2e9b4330bb/src/Products/PageTemplates/PageTemplateFile.py#L173-L184 | |||
bokeh/bokeh | a00e59da76beb7b9f83613533cfd3aced1df5f06 | bokeh/events.py | python | Event.decode_json | (cls, dct: EventJson) | return event | Custom JSON decoder for Events.
Can be used as the ``object_hook`` argument of ``json.load`` or
``json.loads``.
Args:
dct (dict) : a JSON dictionary to decode
The dictionary should have keys ``event_name`` and ``event_values``
Raises:
ValueError... | Custom JSON decoder for Events. | [
"Custom",
"JSON",
"decoder",
"for",
"Events",
"."
] | def decode_json(cls, dct: EventJson) -> Event:
''' Custom JSON decoder for Events.
Can be used as the ``object_hook`` argument of ``json.load`` or
``json.loads``.
Args:
dct (dict) : a JSON dictionary to decode
The dictionary should have keys ``event_name`` a... | [
"def",
"decode_json",
"(",
"cls",
",",
"dct",
":",
"EventJson",
")",
"->",
"Event",
":",
"if",
"not",
"(",
"'event_name'",
"in",
"dct",
"and",
"'event_values'",
"in",
"dct",
")",
":",
"return",
"dct",
"event_name",
"=",
"dct",
"[",
"'event_name'",
"]",
... | https://github.com/bokeh/bokeh/blob/a00e59da76beb7b9f83613533cfd3aced1df5f06/bokeh/events.py#L152-L192 | |
quartiq/rayopt | 3890c72b8f56253bdce309b0fe42beda91c6d3e0 | rayopt/simplex.py | python | simplex_iter | (d, m) | Yield index tuples covering the m-scaled d+1 simplex (
d+1 cube corner N^d with edge length m - 1. | Yield index tuples covering the m-scaled d+1 simplex (
d+1 cube corner N^d with edge length m - 1. | [
"Yield",
"index",
"tuples",
"covering",
"the",
"m",
"-",
"scaled",
"d",
"+",
"1",
"simplex",
"(",
"d",
"+",
"1",
"cube",
"corner",
"N^d",
"with",
"edge",
"length",
"m",
"-",
"1",
"."
] | def simplex_iter(d, m):
"""Yield index tuples covering the m-scaled d+1 simplex (
d+1 cube corner N^d with edge length m - 1."""
if d == 0:
yield ()
else:
for i in range(m):
for j in simplex_iter(d - 1, i + 1):
yield (i - sum(j),) + j | [
"def",
"simplex_iter",
"(",
"d",
",",
"m",
")",
":",
"if",
"d",
"==",
"0",
":",
"yield",
"(",
")",
"else",
":",
"for",
"i",
"in",
"range",
"(",
"m",
")",
":",
"for",
"j",
"in",
"simplex_iter",
"(",
"d",
"-",
"1",
",",
"i",
"+",
"1",
")",
... | https://github.com/quartiq/rayopt/blob/3890c72b8f56253bdce309b0fe42beda91c6d3e0/rayopt/simplex.py#L53-L61 | ||
YunoHost/yunohost | 08efbbb9045eaed8e64d3dfc3f5e22e6ac0b5ecd | src/yunohost/backup.py | python | BackupMethod.method_name | (self) | Return the string name of a BackupMethod (eg "tar" or "copy") | Return the string name of a BackupMethod (eg "tar" or "copy") | [
"Return",
"the",
"string",
"name",
"of",
"a",
"BackupMethod",
"(",
"eg",
"tar",
"or",
"copy",
")"
] | def method_name(self):
"""Return the string name of a BackupMethod (eg "tar" or "copy")"""
raise YunohostError("backup_abstract_method") | [
"def",
"method_name",
"(",
"self",
")",
":",
"raise",
"YunohostError",
"(",
"\"backup_abstract_method\"",
")"
] | https://github.com/YunoHost/yunohost/blob/08efbbb9045eaed8e64d3dfc3f5e22e6ac0b5ecd/src/yunohost/backup.py#L1653-L1655 | ||
nelson-liu/paraphrase-id-tensorflow | 108e461dea0dd148464e985e47ac5c6c11818fcb | duplicate_questions/data/data_manager.py | python | DataManager.get_validation_data_from_file | (self, filenames, max_instances=None,
max_lengths=None, pad=True, mode="word") | return _get_validation_data_generator, validation_dataset_size | Given a filename or list of filenames, return a generator for producing
individual instances of data ready for use as validation data in a
model read from those file(s).
Given a string path to a file in the format accepted by the instance,
we use a data_indexer previously fitted on trai... | Given a filename or list of filenames, return a generator for producing
individual instances of data ready for use as validation data in a
model read from those file(s). | [
"Given",
"a",
"filename",
"or",
"list",
"of",
"filenames",
"return",
"a",
"generator",
"for",
"producing",
"individual",
"instances",
"of",
"data",
"ready",
"for",
"use",
"as",
"validation",
"data",
"in",
"a",
"model",
"read",
"from",
"those",
"file",
"(",
... | def get_validation_data_from_file(self, filenames, max_instances=None,
max_lengths=None, pad=True, mode="word"):
"""
Given a filename or list of filenames, return a generator for producing
individual instances of data ready for use as validation data in a
... | [
"def",
"get_validation_data_from_file",
"(",
"self",
",",
"filenames",
",",
"max_instances",
"=",
"None",
",",
"max_lengths",
"=",
"None",
",",
"pad",
"=",
"True",
",",
"mode",
"=",
"\"word\"",
")",
":",
"logger",
".",
"info",
"(",
"\"Getting validation data f... | https://github.com/nelson-liu/paraphrase-id-tensorflow/blob/108e461dea0dd148464e985e47ac5c6c11818fcb/duplicate_questions/data/data_manager.py#L209-L330 | |
makerbot/ReplicatorG | d6f2b07785a5a5f1e172fb87cb4303b17c575d5d | skein_engines/skeinforge-47/fabmetheus_utilities/svg_reader.py | python | MatrixSVG.__init__ | (self, tricomplex=None) | Initialize. | Initialize. | [
"Initialize",
"."
] | def __init__(self, tricomplex=None):
"Initialize."
self.tricomplex = tricomplex | [
"def",
"__init__",
"(",
"self",
",",
"tricomplex",
"=",
"None",
")",
":",
"self",
".",
"tricomplex",
"=",
"tricomplex"
] | https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-47/fabmetheus_utilities/svg_reader.py#L549-L551 | ||
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/rest/data.py | python | RestData.__init__ | (
self,
hass,
method,
resource,
auth,
headers,
params,
data,
verify_ssl,
timeout=DEFAULT_TIMEOUT,
) | Initialize the data object. | Initialize the data object. | [
"Initialize",
"the",
"data",
"object",
"."
] | def __init__(
self,
hass,
method,
resource,
auth,
headers,
params,
data,
verify_ssl,
timeout=DEFAULT_TIMEOUT,
):
"""Initialize the data object."""
self._hass = hass
self._method = method
self._resource = ... | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"method",
",",
"resource",
",",
"auth",
",",
"headers",
",",
"params",
",",
"data",
",",
"verify_ssl",
",",
"timeout",
"=",
"DEFAULT_TIMEOUT",
",",
")",
":",
"self",
".",
"_hass",
"=",
"hass",
"self",
... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/rest/data.py#L17-L42 | ||
jeetsukumaran/DendroPy | 29fd294bf05d890ebf6a8d576c501e471db27ca1 | src/dendropy/utility/container.py | python | ItemAttributeProxyList.__init__ | (self, attr_name, *args) | __init__ calls the list.__init__ with all unnamed args.
``attr_name`` is the name of the attribute or property that should be
returned. | __init__ calls the list.__init__ with all unnamed args. | [
"__init__",
"calls",
"the",
"list",
".",
"__init__",
"with",
"all",
"unnamed",
"args",
"."
] | def __init__(self, attr_name, *args):
"""
__init__ calls the list.__init__ with all unnamed args.
``attr_name`` is the name of the attribute or property that should be
returned.
"""
self.bound_attr_name = attr_name
list.__init__(self, *args) | [
"def",
"__init__",
"(",
"self",
",",
"attr_name",
",",
"*",
"args",
")",
":",
"self",
".",
"bound_attr_name",
"=",
"attr_name",
"list",
".",
"__init__",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/jeetsukumaran/DendroPy/blob/29fd294bf05d890ebf6a8d576c501e471db27ca1/src/dendropy/utility/container.py#L1108-L1116 | ||
caiiiac/Machine-Learning-with-Python | 1a26c4467da41ca4ebc3d5bd789ea942ef79422f | MachineLearning/venv/lib/python3.5/site-packages/pandas/core/nanops.py | python | nanargmin | (values, axis=None, skipna=True) | return result | Returns -1 in the NA case | Returns -1 in the NA case | [
"Returns",
"-",
"1",
"in",
"the",
"NA",
"case"
] | def nanargmin(values, axis=None, skipna=True):
"""
Returns -1 in the NA case
"""
values, mask, dtype, _ = _get_values(values, skipna, fill_value_typ='+inf',
isfinite=True)
result = values.argmin(axis)
result = _maybe_arg_null_out(result, axis, mask, skipn... | [
"def",
"nanargmin",
"(",
"values",
",",
"axis",
"=",
"None",
",",
"skipna",
"=",
"True",
")",
":",
"values",
",",
"mask",
",",
"dtype",
",",
"_",
"=",
"_get_values",
"(",
"values",
",",
"skipna",
",",
"fill_value_typ",
"=",
"'+inf'",
",",
"isfinite",
... | https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/pandas/core/nanops.py#L484-L492 | |
wenhuchen/Table-Fact-Checking | b77519177ea663deef68b46617d44086385b6e9f | code/run_BERT.py | python | DataProcessor.get_dev_examples | (self, data_dir) | Gets a collection of `InputExample`s for the dev set. | Gets a collection of `InputExample`s for the dev set. | [
"Gets",
"a",
"collection",
"of",
"InputExample",
"s",
"for",
"the",
"dev",
"set",
"."
] | def get_dev_examples(self, data_dir):
"""Gets a collection of `InputExample`s for the dev set."""
raise NotImplementedError() | [
"def",
"get_dev_examples",
"(",
"self",
",",
"data_dir",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/wenhuchen/Table-Fact-Checking/blob/b77519177ea663deef68b46617d44086385b6e9f/code/run_BERT.py#L87-L89 | ||
GoogleCloudPlatform/PerfKitBenchmarker | 6e3412d7d5e414b8ca30ed5eaf970cef1d919a67 | perfkitbenchmarker/providers/kubernetes/kubernetes_virtual_machine.py | python | KubernetesVirtualMachine.__init__ | (self, vm_spec) | Initialize a Kubernetes virtual machine.
Args:
vm_spec: KubernetesPodSpec object of the vm. | Initialize a Kubernetes virtual machine. | [
"Initialize",
"a",
"Kubernetes",
"virtual",
"machine",
"."
] | def __init__(self, vm_spec):
"""Initialize a Kubernetes virtual machine.
Args:
vm_spec: KubernetesPodSpec object of the vm.
"""
super(KubernetesVirtualMachine, self).__init__(vm_spec)
self.num_scratch_disks = 0
self.name = self.name.replace('_', '-')
self.user_name = FLAGS.username
... | [
"def",
"__init__",
"(",
"self",
",",
"vm_spec",
")",
":",
"super",
"(",
"KubernetesVirtualMachine",
",",
"self",
")",
".",
"__init__",
"(",
"vm_spec",
")",
"self",
".",
"num_scratch_disks",
"=",
"0",
"self",
".",
"name",
"=",
"self",
".",
"name",
".",
... | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/6e3412d7d5e414b8ca30ed5eaf970cef1d919a67/perfkitbenchmarker/providers/kubernetes/kubernetes_virtual_machine.py#L62-L74 | ||
cdr-stats/cdr-stats | 9c4b7868d44024ab4fca24de6f03d64f62d56e26 | cdr_stats/voip_billing/function_def.py | python | prefix_allowed_to_call | (destination_number, voipplan_id) | return True | Check destination number with ban prefix & voip_plan | Check destination number with ban prefix & voip_plan | [
"Check",
"destination",
"number",
"with",
"ban",
"prefix",
"&",
"voip_plan"
] | def prefix_allowed_to_call(destination_number, voipplan_id):
"""
Check destination number with ban prefix & voip_plan
"""
destination_prefix_list = prefix_list_string(destination_number)
# Cache the voipplan_id & banned_prefix query set
cachekey = "banned_prefix_list_%s" % (str(voipplan_id))
... | [
"def",
"prefix_allowed_to_call",
"(",
"destination_number",
",",
"voipplan_id",
")",
":",
"destination_prefix_list",
"=",
"prefix_list_string",
"(",
"destination_number",
")",
"# Cache the voipplan_id & banned_prefix query set",
"cachekey",
"=",
"\"banned_prefix_list_%s\"",
"%",
... | https://github.com/cdr-stats/cdr-stats/blob/9c4b7868d44024ab4fca24de6f03d64f62d56e26/cdr_stats/voip_billing/function_def.py#L82-L104 | |
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/min/modulefinder.py | python | ModuleFinder.replace_paths_in_code | (self, co) | return co.replace(co_consts=tuple(consts), co_filename=new_filename) | [] | def replace_paths_in_code(self, co):
new_filename = original_filename = os.path.normpath(co.co_filename)
for f, r in self.replace_paths:
if original_filename.startswith(f):
new_filename = r + original_filename[len(f):]
break
if self.debug and original... | [
"def",
"replace_paths_in_code",
"(",
"self",
",",
"co",
")",
":",
"new_filename",
"=",
"original_filename",
"=",
"os",
".",
"path",
".",
"normpath",
"(",
"co",
".",
"co_filename",
")",
"for",
"f",
",",
"r",
"in",
"self",
".",
"replace_paths",
":",
"if",
... | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/min/modulefinder.py#L598-L619 | |||
retresco/Spyder | 9a2de6ec4c25d4dc85802305d5675a52c3ebb750 | src/spyder/core/sqlitequeues.py | python | SQLiteMultipleHostUriQueue.all_uris | (self, queue=None) | A generator for iterating over all available urls.
Note: does not return the full uri object, only the url. This will be
used to refill the unique uri filter upon restart. | A generator for iterating over all available urls. | [
"A",
"generator",
"for",
"iterating",
"over",
"all",
"available",
"urls",
"."
] | def all_uris(self, queue=None):
"""
A generator for iterating over all available urls.
Note: does not return the full uri object, only the url. This will be
used to refill the unique uri filter upon restart.
"""
if queue:
self._cursor.execute("""SELECT url FR... | [
"def",
"all_uris",
"(",
"self",
",",
"queue",
"=",
"None",
")",
":",
"if",
"queue",
":",
"self",
".",
"_cursor",
".",
"execute",
"(",
"\"\"\"SELECT url FROM queues WHERE queue=?\"\"\"",
",",
"queue",
")",
"else",
":",
"self",
".",
"_cursor",
".",
"execute",
... | https://github.com/retresco/Spyder/blob/9a2de6ec4c25d4dc85802305d5675a52c3ebb750/src/spyder/core/sqlitequeues.py#L351-L364 | ||
nfvlabs/openmano | b09eabec0a168aeda8adc3ea99f734e45e810205 | openmano/httpserver.py | python | http_delete_scenario_id | (tenant_id, scenario_id) | delete a scenario from database, can use both uuid or name | delete a scenario from database, can use both uuid or name | [
"delete",
"a",
"scenario",
"from",
"database",
"can",
"use",
"both",
"uuid",
"or",
"name"
] | def http_delete_scenario_id(tenant_id, scenario_id):
'''delete a scenario from database, can use both uuid or name'''
#check valid tenant_id
if tenant_id != "any" and not nfvo.check_tenant(mydb, tenant_id):
print "httpserver.http_delete_scenario_id() tenant '%s' not found" % tenant_id
bottl... | [
"def",
"http_delete_scenario_id",
"(",
"tenant_id",
",",
"scenario_id",
")",
":",
"#check valid tenant_id",
"if",
"tenant_id",
"!=",
"\"any\"",
"and",
"not",
"nfvo",
".",
"check_tenant",
"(",
"mydb",
",",
"tenant_id",
")",
":",
"print",
"\"httpserver.http_delete_sce... | https://github.com/nfvlabs/openmano/blob/b09eabec0a168aeda8adc3ea99f734e45e810205/openmano/httpserver.py#L935-L949 | ||
bookwyrm-social/bookwyrm | 0c2537e27a2cdbc0136880dfbbf170d5fec72986 | bookwyrm/views/follow.py | python | unfollow | (request) | return redirect(request.headers.get("Referer", "/")) | unfollow a user | unfollow a user | [
"unfollow",
"a",
"user"
] | def unfollow(request):
"""unfollow a user"""
username = request.POST["user"]
to_unfollow = get_user_from_username(request.user, username)
try:
models.UserFollows.objects.get(
user_subject=request.user, user_object=to_unfollow
).delete()
except models.UserFollows.DoesNotE... | [
"def",
"unfollow",
"(",
"request",
")",
":",
"username",
"=",
"request",
".",
"POST",
"[",
"\"user\"",
"]",
"to_unfollow",
"=",
"get_user_from_username",
"(",
"request",
".",
"user",
",",
"username",
")",
"try",
":",
"models",
".",
"UserFollows",
".",
"obj... | https://github.com/bookwyrm-social/bookwyrm/blob/0c2537e27a2cdbc0136880dfbbf170d5fec72986/bookwyrm/views/follow.py#L42-L62 | |
ahmetcemturan/SFACT | 7576e29ba72b33e5058049b77b7b558875542747 | skeinforge_application/skeinforge_plugins/craft_plugins/raft.py | python | getCraftedText | ( fileName, text='', repository=None) | return getCraftedTextFromText(archive.getTextIfEmpty(fileName, text), repository) | Raft the file or text. | Raft the file or text. | [
"Raft",
"the",
"file",
"or",
"text",
"."
] | def getCraftedText( fileName, text='', repository=None):
'Raft the file or text.'
return getCraftedTextFromText(archive.getTextIfEmpty(fileName, text), repository) | [
"def",
"getCraftedText",
"(",
"fileName",
",",
"text",
"=",
"''",
",",
"repository",
"=",
"None",
")",
":",
"return",
"getCraftedTextFromText",
"(",
"archive",
".",
"getTextIfEmpty",
"(",
"fileName",
",",
"text",
")",
",",
"repository",
")"
] | https://github.com/ahmetcemturan/SFACT/blob/7576e29ba72b33e5058049b77b7b558875542747/skeinforge_application/skeinforge_plugins/craft_plugins/raft.py#L224-L226 | |
semontesdeoca/MNPR | 8acf9862e38b709eba63a978d35cc658754ec9e9 | scripts/mnpr_nFX.py | python | getNodeNames | (fx, idx) | return controlNodes[fx.controlSet][channelIdx] | Get node names of fx operation for procedural effects
Args:
fx (obj): MNPR_FX object
e.g. MNPR_FX("distortion", "Substrate distortion", "controlSetB", [[1, 0, 0, 0]], ["distort", "revert"], ["noise"])
idx (int): index of fx operation in case two operations are found in the same f... | Get node names of fx operation for procedural effects
Args:
fx (obj): MNPR_FX object
e.g. MNPR_FX("distortion", "Substrate distortion", "controlSetB", [[1, 0, 0, 0]], ["distort", "revert"], ["noise"])
idx (int): index of fx operation in case two operations are found in the same f... | [
"Get",
"node",
"names",
"of",
"fx",
"operation",
"for",
"procedural",
"effects",
"Args",
":",
"fx",
"(",
"obj",
")",
":",
"MNPR_FX",
"object",
"e",
".",
"g",
".",
"MNPR_FX",
"(",
"distortion",
"Substrate",
"distortion",
"controlSetB",
"[[",
"1",
"0",
"0"... | def getNodeNames(fx, idx):
"""
Get node names of fx operation for procedural effects
Args:
fx (obj): MNPR_FX object
e.g. MNPR_FX("distortion", "Substrate distortion", "controlSetB", [[1, 0, 0, 0]], ["distort", "revert"], ["noise"])
idx (int): index of fx operation in case... | [
"def",
"getNodeNames",
"(",
"fx",
",",
"idx",
")",
":",
"# get RGBA channel",
"channelIdx",
"=",
"0",
"for",
"channel",
"in",
"fx",
".",
"channels",
"[",
"idx",
"]",
":",
"if",
"channel",
":",
"channelIdx",
"=",
"fx",
".",
"channels",
"[",
"idx",
"]",
... | https://github.com/semontesdeoca/MNPR/blob/8acf9862e38b709eba63a978d35cc658754ec9e9/scripts/mnpr_nFX.py#L144-L163 | |
DxCx/plugin.video.9anime | 34358c2f701e5ddf19d3276926374a16f63f7b6a | resources/lib/ui/js2py/es6/babel.py | python | PyJs_anonymous_1_ | (require, module, exports, this, arguments, var=var) | [] | def PyJs_anonymous_1_(require, module, exports, this, arguments, var=var):
var = Scope({u'this':this, u'require':require, u'exports':exports, u'module':module, u'arguments':arguments}, var)
var.registers([u'babel', u'require', u'babelPresetEs2015', u'exports', u'module'])
Js(u'use strict')
var.put(u'bab... | [
"def",
"PyJs_anonymous_1_",
"(",
"require",
",",
"module",
",",
"exports",
",",
"this",
",",
"arguments",
",",
"var",
"=",
"var",
")",
":",
"var",
"=",
"Scope",
"(",
"{",
"u'this'",
":",
"this",
",",
"u'require'",
":",
"require",
",",
"u'exports'",
":"... | https://github.com/DxCx/plugin.video.9anime/blob/34358c2f701e5ddf19d3276926374a16f63f7b6a/resources/lib/ui/js2py/es6/babel.py#L13-L20 | ||||
demisto/content | 5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07 | Packs/Exabeam/Integrations/Exabeam/Exabeam.py | python | contents_append_notable_session_details | (session) | return content | Appends a dictionary of data to the base list
Args:
session: session object
Returns:
A contents list with the relevant notable session details | Appends a dictionary of data to the base list | [
"Appends",
"a",
"dictionary",
"of",
"data",
"to",
"the",
"base",
"list"
] | def contents_append_notable_session_details(session) -> Dict:
"""Appends a dictionary of data to the base list
Args:
session: session object
Returns:
A contents list with the relevant notable session details
"""
content = {
'SessionID': session.get('sessionId'),
'In... | [
"def",
"contents_append_notable_session_details",
"(",
"session",
")",
"->",
"Dict",
":",
"content",
"=",
"{",
"'SessionID'",
":",
"session",
".",
"get",
"(",
"'sessionId'",
")",
",",
"'InitialRiskScore'",
":",
"session",
".",
"get",
"(",
"'initialRiskScore'",
"... | https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/Exabeam/Integrations/Exabeam/Exabeam.py#L848-L863 | |
h5py/h5py | aa31f03bef99e5807d1d6381e36233325d944279 | h5py/_hl/dataset.py | python | Dataset.fletcher32 | (self) | return 'fletcher32' in self._filters | Fletcher32 filter is present (T/F) | Fletcher32 filter is present (T/F) | [
"Fletcher32",
"filter",
"is",
"present",
"(",
"T",
"/",
"F",
")"
] | def fletcher32(self):
"""Fletcher32 filter is present (T/F)"""
return 'fletcher32' in self._filters | [
"def",
"fletcher32",
"(",
"self",
")",
":",
"return",
"'fletcher32'",
"in",
"self",
".",
"_filters"
] | https://github.com/h5py/h5py/blob/aa31f03bef99e5807d1d6381e36233325d944279/h5py/_hl/dataset.py#L521-L523 | |
thespianpy/Thespian | f35e5a74ae99ee3401eb9fc7757620a1cf043ee2 | examples/multi_system/act3/encoder.py | python | Encoder.encode | (self, rawstr) | return rawstr | Override this method to change the encoding | Override this method to change the encoding | [
"Override",
"this",
"method",
"to",
"change",
"the",
"encoding"
] | def encode(self, rawstr):
"Override this method to change the encoding"
return rawstr | [
"def",
"encode",
"(",
"self",
",",
"rawstr",
")",
":",
"return",
"rawstr"
] | https://github.com/thespianpy/Thespian/blob/f35e5a74ae99ee3401eb9fc7757620a1cf043ee2/examples/multi_system/act3/encoder.py#L34-L36 | |
lixinsu/RCZoo | 37fcb7962fbd4c751c561d4a0c84173881ea8339 | reader/qanet/vector.py | python | vectorize | (ex, model, single_answer=False) | return document, document_char, question, question_char, start, end, ex['id'] | Torchify a single example. | Torchify a single example. | [
"Torchify",
"a",
"single",
"example",
"."
] | def vectorize(ex, model, single_answer=False):
"""Torchify a single example."""
args = model.args
args.word_len = 15
word_dict = model.word_dict
char_dict = model.char_dict
feature_dict = model.feature_dict
# Index words
document = torch.LongTensor([word_dict[w] for w in ex['document']]... | [
"def",
"vectorize",
"(",
"ex",
",",
"model",
",",
"single_answer",
"=",
"False",
")",
":",
"args",
"=",
"model",
".",
"args",
"args",
".",
"word_len",
"=",
"15",
"word_dict",
"=",
"model",
".",
"word_dict",
"char_dict",
"=",
"model",
".",
"char_dict",
... | https://github.com/lixinsu/RCZoo/blob/37fcb7962fbd4c751c561d4a0c84173881ea8339/reader/qanet/vector.py#L13-L83 | |
digidotcom/xbee-python | 0757f4be0017530c205175fbee8f9f61be9614d1 | digi/xbee/packets/socket.py | python | SocketStatePacket.socket_id | (self) | return self.__socket_id | Returns the socket ID.
Returns:
Integer: the socket ID. | Returns the socket ID. | [
"Returns",
"the",
"socket",
"ID",
"."
] | def socket_id(self):
"""
Returns the socket ID.
Returns:
Integer: the socket ID.
"""
return self.__socket_id | [
"def",
"socket_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"__socket_id"
] | https://github.com/digidotcom/xbee-python/blob/0757f4be0017530c205175fbee8f9f61be9614d1/digi/xbee/packets/socket.py#L3044-L3051 | |
smellslikeml/ActionAI | 8f562ba0ce979e6d82abedb112055e8055937b15 | experimental/person.py | python | PersonTracker.set_pose | (self, pose_dict) | return | Used to encode pose estimates
over a time window | Used to encode pose estimates
over a time window | [
"Used",
"to",
"encode",
"pose",
"estimates",
"over",
"a",
"time",
"window"
] | def set_pose(self, pose_dict):
'''
Used to encode pose estimates
over a time window
'''
self.pose_dict = pose_dict
ft_vec = np.zeros(cfg.pose_vec_dim)
for ky in pose_dict:
idx = cfg.body_idx[ky]
ft_vec[2 * idx: 2 * (idx + 1)] = 2 * (np.arra... | [
"def",
"set_pose",
"(",
"self",
",",
"pose_dict",
")",
":",
"self",
".",
"pose_dict",
"=",
"pose_dict",
"ft_vec",
"=",
"np",
".",
"zeros",
"(",
"cfg",
".",
"pose_vec_dim",
")",
"for",
"ky",
"in",
"pose_dict",
":",
"idx",
"=",
"cfg",
".",
"body_idx",
... | https://github.com/smellslikeml/ActionAI/blob/8f562ba0ce979e6d82abedb112055e8055937b15/experimental/person.py#L50-L63 | |
mher/flower | 47a0eb937a1a132a9cb5b2e137d96b93e4cdc89e | setup.py | python | get_package_version | () | returns package version without importing it | returns package version without importing it | [
"returns",
"package",
"version",
"without",
"importing",
"it"
] | def get_package_version():
"returns package version without importing it"
base = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(base, "flower/__init__.py")) as initf:
for line in initf:
m = version.match(line.strip())
if not m:
continue
... | [
"def",
"get_package_version",
"(",
")",
":",
"base",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"__file__",
")",
")",
"with",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"base",
",",
"\"flower/__init__.... | https://github.com/mher/flower/blob/47a0eb937a1a132a9cb5b2e137d96b93e4cdc89e/setup.py#L11-L19 | ||
horazont/aioxmpp | c701e6399c90a6bb9bec0349018a03bd7b644cde | aioxmpp/stringprep.py | python | resourceprep | (string, allow_unassigned=False) | return "".join(chars) | Process the given `string` using the Resourceprep (`RFC 6122`_) profile. In
the error cases defined in `RFC 3454`_ (stringprep), a :class:`ValueError`
is raised. | Process the given `string` using the Resourceprep (`RFC 6122`_) profile. In
the error cases defined in `RFC 3454`_ (stringprep), a :class:`ValueError`
is raised. | [
"Process",
"the",
"given",
"string",
"using",
"the",
"Resourceprep",
"(",
"RFC",
"6122",
"_",
")",
"profile",
".",
"In",
"the",
"error",
"cases",
"defined",
"in",
"RFC",
"3454",
"_",
"(",
"stringprep",
")",
"a",
":",
"class",
":",
"ValueError",
"is",
"... | def resourceprep(string, allow_unassigned=False):
"""
Process the given `string` using the Resourceprep (`RFC 6122`_) profile. In
the error cases defined in `RFC 3454`_ (stringprep), a :class:`ValueError`
is raised.
"""
chars = list(string)
_resourceprep_do_mapping(chars)
do_normalizati... | [
"def",
"resourceprep",
"(",
"string",
",",
"allow_unassigned",
"=",
"False",
")",
":",
"chars",
"=",
"list",
"(",
"string",
")",
"_resourceprep_do_mapping",
"(",
"chars",
")",
"do_normalization",
"(",
"chars",
")",
"check_prohibited_output",
"(",
"chars",
",",
... | https://github.com/horazont/aioxmpp/blob/c701e6399c90a6bb9bec0349018a03bd7b644cde/aioxmpp/stringprep.py#L198-L232 | |
marionette-tg/marionette | bb40a334a18c82728eec01c9b56330bcb91a28da | marionette_tg/dsl.py | python | t_NULL_KWD | (t) | return t | r'NULL | r'NULL | [
"r",
"NULL"
] | def t_NULL_KWD(t):
r'NULL'
return t | [
"def",
"t_NULL_KWD",
"(",
"t",
")",
":",
"return",
"t"
] | https://github.com/marionette-tg/marionette/blob/bb40a334a18c82728eec01c9b56330bcb91a28da/marionette_tg/dsl.py#L81-L83 | |
Cadene/tensorflow-model-zoo.torch | 990b10ffc22d4c8eacb2a502f20415b4f70c74c2 | models/research/slim/preprocessing/vgg_preprocessing.py | python | _mean_image_subtraction | (image, means) | return tf.concat(axis=2, values=channels) | Subtracts the given means from each image channel.
For example:
means = [123.68, 116.779, 103.939]
image = _mean_image_subtraction(image, means)
Note that the rank of `image` must be known.
Args:
image: a tensor of size [height, width, C].
means: a C-vector of values to subtract from each chann... | Subtracts the given means from each image channel. | [
"Subtracts",
"the",
"given",
"means",
"from",
"each",
"image",
"channel",
"."
] | def _mean_image_subtraction(image, means):
"""Subtracts the given means from each image channel.
For example:
means = [123.68, 116.779, 103.939]
image = _mean_image_subtraction(image, means)
Note that the rank of `image` must be known.
Args:
image: a tensor of size [height, width, C].
means: ... | [
"def",
"_mean_image_subtraction",
"(",
"image",
",",
"means",
")",
":",
"if",
"image",
".",
"get_shape",
"(",
")",
".",
"ndims",
"!=",
"3",
":",
"raise",
"ValueError",
"(",
"'Input must be of size [height, width, C>0]'",
")",
"num_channels",
"=",
"image",
".",
... | https://github.com/Cadene/tensorflow-model-zoo.torch/blob/990b10ffc22d4c8eacb2a502f20415b4f70c74c2/models/research/slim/preprocessing/vgg_preprocessing.py#L198-L228 | |
hylang/hy | 699640f64a89eb90b470a9d536efbb1ace5cc9ec | hy/compiler.py | python | HyASTCompiler._compile_branch | (self, exprs) | return ret | Make a branch out of an iterable of Result objects
This generates a Result from the given sequence of Results, forcing each
expression context as a statement before the next result is used.
We keep the expression context of the last argument for the returned Result | Make a branch out of an iterable of Result objects | [
"Make",
"a",
"branch",
"out",
"of",
"an",
"iterable",
"of",
"Result",
"objects"
] | def _compile_branch(self, exprs):
"""Make a branch out of an iterable of Result objects
This generates a Result from the given sequence of Results, forcing each
expression context as a statement before the next result is used.
We keep the expression context of the last argument for the... | [
"def",
"_compile_branch",
"(",
"self",
",",
"exprs",
")",
":",
"ret",
"=",
"Result",
"(",
")",
"for",
"x",
"in",
"map",
"(",
"self",
".",
"compile",
",",
"exprs",
"[",
":",
"-",
"1",
"]",
")",
":",
"ret",
"+=",
"x",
"ret",
"+=",
"x",
".",
"ex... | https://github.com/hylang/hy/blob/699640f64a89eb90b470a9d536efbb1ace5cc9ec/hy/compiler.py#L414-L428 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.