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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
rikdz/GraphWriter | f228420aa48697dfb7a1ced3a62f955031664ed3 | models/beam.py | python | Beam.dup_obj | (self,obj) | return new_obj | [] | def dup_obj(self,obj):
new_obj = beam_obj(None,None,None,None,None)
new_obj.words = [x for x in obj.words]
new_obj.score = obj.score
new_obj.prevent = obj.prevent
new_obj.firstwords = [x for x in obj.firstwords]
new_obj.isstart = obj.isstart
return new_obj | [
"def",
"dup_obj",
"(",
"self",
",",
"obj",
")",
":",
"new_obj",
"=",
"beam_obj",
"(",
"None",
",",
"None",
",",
"None",
",",
"None",
",",
"None",
")",
"new_obj",
".",
"words",
"=",
"[",
"x",
"for",
"x",
"in",
"obj",
".",
"words",
"]",
"new_obj",
... | https://github.com/rikdz/GraphWriter/blob/f228420aa48697dfb7a1ced3a62f955031664ed3/models/beam.py#L38-L45 | |||
tensorflow/tfx | b4a6b83269815ed12ba9df9e9154c7376fef2ea0 | tfx/examples/cifar10/cifar10_utils_native_keras.py | python | run_fn | (fn_args: FnArgs) | Train the model based on given args.
Args:
fn_args: Holds args used to train the model as name/value pairs.
Raises:
ValueError: if invalid inputs. | Train the model based on given args. | [
"Train",
"the",
"model",
"based",
"on",
"given",
"args",
"."
] | def run_fn(fn_args: FnArgs):
"""Train the model based on given args.
Args:
fn_args: Holds args used to train the model as name/value pairs.
Raises:
ValueError: if invalid inputs.
"""
tf_transform_output = tft.TFTransformOutput(fn_args.transform_output)
train_dataset = _input_fn(
fn_args.tra... | [
"def",
"run_fn",
"(",
"fn_args",
":",
"FnArgs",
")",
":",
"tf_transform_output",
"=",
"tft",
".",
"TFTransformOutput",
"(",
"fn_args",
".",
"transform_output",
")",
"train_dataset",
"=",
"_input_fn",
"(",
"fn_args",
".",
"train_files",
",",
"fn_args",
".",
"da... | https://github.com/tensorflow/tfx/blob/b4a6b83269815ed12ba9df9e9154c7376fef2ea0/tfx/examples/cifar10/cifar10_utils_native_keras.py#L304-L405 | ||
fedora-infra/bodhi | 2b1df12d85eb2e575d8e481a3936c4f92d1fe29a | bodhi/server/migrations/versions/5c86a3f9dc03_drop_support_for_cve_tracking.py | python | downgrade | () | Recreate the cves table and related association tables. | Recreate the cves table and related association tables. | [
"Recreate",
"the",
"cves",
"table",
"and",
"related",
"association",
"tables",
"."
] | def downgrade():
"""Recreate the cves table and related association tables."""
op.create_table(
'cves',
sa.Column('id', sa.INTEGER(), server_default=sa.text("nextval('cves_id_seq'::regclass)"),
autoincrement=True, nullable=False),
sa.Column('cve_id', sa.VARCHAR(length=1... | [
"def",
"downgrade",
"(",
")",
":",
"op",
".",
"create_table",
"(",
"'cves'",
",",
"sa",
".",
"Column",
"(",
"'id'",
",",
"sa",
".",
"INTEGER",
"(",
")",
",",
"server_default",
"=",
"sa",
".",
"text",
"(",
"\"nextval('cves_id_seq'::regclass)\"",
")",
",",... | https://github.com/fedora-infra/bodhi/blob/2b1df12d85eb2e575d8e481a3936c4f92d1fe29a/bodhi/server/migrations/versions/5c86a3f9dc03_drop_support_for_cve_tracking.py#L41-L63 | ||
lovelylain/pyctp | fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d | example/pyctp2/trader/position.py | python | Position.volume_accomplished2 | (self) | return num_opened - num_closed | [] | def volume_accomplished2(self):
num_opened = self._get_accomplished2(self._open_orders)
num_closed = self._get_accomplished2(self._close_orders)
return num_opened - num_closed | [
"def",
"volume_accomplished2",
"(",
"self",
")",
":",
"num_opened",
"=",
"self",
".",
"_get_accomplished2",
"(",
"self",
".",
"_open_orders",
")",
"num_closed",
"=",
"self",
".",
"_get_accomplished2",
"(",
"self",
".",
"_close_orders",
")",
"return",
"num_opened... | https://github.com/lovelylain/pyctp/blob/fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d/example/pyctp2/trader/position.py#L395-L398 | |||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_vendored_deps/library/oc_adm_router.py | python | DeploymentConfig.update_env_var | (self, key, value) | return True | place an env in the env var list | place an env in the env var list | [
"place",
"an",
"env",
"in",
"the",
"env",
"var",
"list"
] | def update_env_var(self, key, value):
'''place an env in the env var list'''
env_vars_array = self.get_env_vars()
idx = None
for env_idx, env_var in enumerate(env_vars_array):
if env_var['name'] == key:
idx = env_idx
break
if idx:
... | [
"def",
"update_env_var",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"env_vars_array",
"=",
"self",
".",
"get_env_vars",
"(",
")",
"idx",
"=",
"None",
"for",
"env_idx",
",",
"env_var",
"in",
"enumerate",
"(",
"env_vars_array",
")",
":",
"if",
"env_v... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_vendored_deps/library/oc_adm_router.py#L1942-L1957 | |
python/cpython | e13cdca0f5224ec4e23bdd04bb3120506964bc8b | Lib/_pydecimal.py | python | Context.copy | (self) | return nc | Returns a deep copy from self. | Returns a deep copy from self. | [
"Returns",
"a",
"deep",
"copy",
"from",
"self",
"."
] | def copy(self):
"""Returns a deep copy from self."""
nc = Context(self.prec, self.rounding, self.Emin, self.Emax,
self.capitals, self.clamp,
self.flags.copy(), self.traps.copy(),
self._ignored_flags)
return nc | [
"def",
"copy",
"(",
"self",
")",
":",
"nc",
"=",
"Context",
"(",
"self",
".",
"prec",
",",
"self",
".",
"rounding",
",",
"self",
".",
"Emin",
",",
"self",
".",
"Emax",
",",
"self",
".",
"capitals",
",",
"self",
".",
"clamp",
",",
"self",
".",
"... | https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/_pydecimal.py#L4015-L4021 | |
tendenci/tendenci | 0f2c348cc0e7d41bc56f50b00ce05544b083bf1d | tendenci/apps/make_payments/utils.py | python | make_payment_inv_add | (user, make_payment, **kwargs) | return inv | [] | def make_payment_inv_add(user, make_payment, **kwargs):
inv = Invoice()
# field to be populated to invoice
inv.title = _("Make Payment Invoice")
inv.bill_to = make_payment.first_name + ' ' + make_payment.last_name
inv.bill_to_first_name = make_payment.first_name
inv.bill_to_last_name = make_pay... | [
"def",
"make_payment_inv_add",
"(",
"user",
",",
"make_payment",
",",
"*",
"*",
"kwargs",
")",
":",
"inv",
"=",
"Invoice",
"(",
")",
"# field to be populated to invoice",
"inv",
".",
"title",
"=",
"_",
"(",
"\"Make Payment Invoice\"",
")",
"inv",
".",
"bill_to... | https://github.com/tendenci/tendenci/blob/0f2c348cc0e7d41bc56f50b00ce05544b083bf1d/tendenci/apps/make_payments/utils.py#L8-L59 | |||
SheffieldML/GPy | bb1bc5088671f9316bc92a46d356734e34c2d5c0 | GPy/inference/latent_function_inference/var_dtc_parallel.py | python | VarDTC_minibatch.inference_minibatch | (self, kern, X, Z, likelihood, Y) | return isEnd, (n_start,n_end), grad_dict | The second phase of inference: Computing the derivatives over a minibatch of Y
Compute: dL_dpsi0, dL_dpsi1, dL_dpsi2, dL_dthetaL
return a flag showing whether it reached the end of Y (isEnd) | The second phase of inference: Computing the derivatives over a minibatch of Y
Compute: dL_dpsi0, dL_dpsi1, dL_dpsi2, dL_dthetaL
return a flag showing whether it reached the end of Y (isEnd) | [
"The",
"second",
"phase",
"of",
"inference",
":",
"Computing",
"the",
"derivatives",
"over",
"a",
"minibatch",
"of",
"Y",
"Compute",
":",
"dL_dpsi0",
"dL_dpsi1",
"dL_dpsi2",
"dL_dthetaL",
"return",
"a",
"flag",
"showing",
"whether",
"it",
"reached",
"the",
"en... | def inference_minibatch(self, kern, X, Z, likelihood, Y):
"""
The second phase of inference: Computing the derivatives over a minibatch of Y
Compute: dL_dpsi0, dL_dpsi1, dL_dpsi2, dL_dthetaL
return a flag showing whether it reached the end of Y (isEnd)
"""
num_data, outp... | [
"def",
"inference_minibatch",
"(",
"self",
",",
"kern",
",",
"X",
",",
"Z",
",",
"likelihood",
",",
"Y",
")",
":",
"num_data",
",",
"output_dim",
"=",
"Y",
".",
"shape",
"if",
"isinstance",
"(",
"X",
",",
"VariationalPosterior",
")",
":",
"uncertain_inpu... | https://github.com/SheffieldML/GPy/blob/bb1bc5088671f9316bc92a46d356734e34c2d5c0/GPy/inference/latent_function_inference/var_dtc_parallel.py#L229-L334 | |
awslabs/autogluon | 7309118f2ab1c9519f25acf61a283a95af95842b | tabular/src/autogluon/tabular/models/fastainn/tabular_nn_fastai.py | python | NNFastAiTabularModel.__get_objective_func_to_monitor | (self, objective_func_name) | return objective_func_name_to_monitor | [] | def __get_objective_func_to_monitor(self, objective_func_name):
monitor_obj_func = {
**{k: m.name if hasattr(m, 'name') else m.__name__ for k, m in self.__get_metrics_map().items() if m is not None},
'log_loss': 'valid_loss'
}
objective_func_name_to_monitor = objective_fu... | [
"def",
"__get_objective_func_to_monitor",
"(",
"self",
",",
"objective_func_name",
")",
":",
"monitor_obj_func",
"=",
"{",
"*",
"*",
"{",
"k",
":",
"m",
".",
"name",
"if",
"hasattr",
"(",
"m",
",",
"'name'",
")",
"else",
"m",
".",
"__name__",
"for",
"k",... | https://github.com/awslabs/autogluon/blob/7309118f2ab1c9519f25acf61a283a95af95842b/tabular/src/autogluon/tabular/models/fastainn/tabular_nn_fastai.py#L365-L373 | |||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/tkinter/__init__.py | python | Listbox.itemconfigure | (self, index, cnf=None, **kw) | return self._configure(('itemconfigure', index), cnf, kw) | Configure resources of an ITEM.
The values for resources are specified as keyword arguments.
To get an overview about the allowed keyword arguments
call the method without arguments.
Valid resource names: background, bg, foreground, fg,
selectbackground, selectforeground. | Configure resources of an ITEM. | [
"Configure",
"resources",
"of",
"an",
"ITEM",
"."
] | def itemconfigure(self, index, cnf=None, **kw):
"""Configure resources of an ITEM.
The values for resources are specified as keyword arguments.
To get an overview about the allowed keyword arguments
call the method without arguments.
Valid resource names: background, bg, foregro... | [
"def",
"itemconfigure",
"(",
"self",
",",
"index",
",",
"cnf",
"=",
"None",
",",
"*",
"*",
"kw",
")",
":",
"return",
"self",
".",
"_configure",
"(",
"(",
"'itemconfigure'",
",",
"index",
")",
",",
"cnf",
",",
"kw",
")"
] | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/tkinter/__init__.py#L2848-L2856 | |
mapillary/seamseg | 77195ff7829af6e3076caefe49c4c69c817e30d6 | seamseg/utils/misc.py | python | norm_act_from_config | (body_config) | return norm_act_static, norm_act_dynamic | Make normalization + activation function from configuration
Available normalization modes are:
- `bn`: Standard In-Place Batch Normalization
- `syncbn`: Synchronized In-Place Batch Normalization
- `syncbn+bn`: Synchronized In-Place Batch Normalization in the "static" part of the network, Standard... | Make normalization + activation function from configuration | [
"Make",
"normalization",
"+",
"activation",
"function",
"from",
"configuration"
] | def norm_act_from_config(body_config):
"""Make normalization + activation function from configuration
Available normalization modes are:
- `bn`: Standard In-Place Batch Normalization
- `syncbn`: Synchronized In-Place Batch Normalization
- `syncbn+bn`: Synchronized In-Place Batch Normalization... | [
"def",
"norm_act_from_config",
"(",
"body_config",
")",
":",
"mode",
"=",
"body_config",
"[",
"\"normalization_mode\"",
"]",
"activation",
"=",
"body_config",
"[",
"\"activation\"",
"]",
"slope",
"=",
"body_config",
".",
"getfloat",
"(",
"\"activation_slope\"",
")",... | https://github.com/mapillary/seamseg/blob/77195ff7829af6e3076caefe49c4c69c817e30d6/seamseg/utils/misc.py#L75-L129 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Lib/xml/sax/saxutils.py | python | XMLFilterBase.warning | (self, exception) | [] | def warning(self, exception):
self._err_handler.warning(exception) | [
"def",
"warning",
"(",
"self",
",",
"exception",
")",
":",
"self",
".",
"_err_handler",
".",
"warning",
"(",
"exception",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/xml/sax/saxutils.py#L219-L220 | ||||
linuxscout/mishkal | 4f4ae0ebc2d6acbeb3de3f0303151ec7b54d2f76 | interfaces/web/lib/paste/wsgiwrappers.py | python | WSGIRequest.urlvars | (self) | Return any variables matched in the URL (e.g.,
``wsgiorg.routing_args``). | Return any variables matched in the URL (e.g.,
``wsgiorg.routing_args``). | [
"Return",
"any",
"variables",
"matched",
"in",
"the",
"URL",
"(",
"e",
".",
"g",
".",
"wsgiorg",
".",
"routing_args",
")",
"."
] | def urlvars(self):
"""
Return any variables matched in the URL (e.g.,
``wsgiorg.routing_args``).
"""
if 'paste.urlvars' in self.environ:
return self.environ['paste.urlvars']
elif 'wsgiorg.routing_args' in self.environ:
return self.environ['wsgiorg.... | [
"def",
"urlvars",
"(",
"self",
")",
":",
"if",
"'paste.urlvars'",
"in",
"self",
".",
"environ",
":",
"return",
"self",
".",
"environ",
"[",
"'paste.urlvars'",
"]",
"elif",
"'wsgiorg.routing_args'",
"in",
"self",
".",
"environ",
":",
"return",
"self",
".",
... | https://github.com/linuxscout/mishkal/blob/4f4ae0ebc2d6acbeb3de3f0303151ec7b54d2f76/interfaces/web/lib/paste/wsgiwrappers.py#L128-L138 | ||
emesene/emesene | 4548a4098310e21b16437bb36223a7f632a4f7bc | emesene/e3/xmpp/SleekXMPP/sleekxmpp/stanza/htmlim.py | python | HTMLIM.del_body | (self) | Remove the HTML body contents. | Remove the HTML body contents. | [
"Remove",
"the",
"HTML",
"body",
"contents",
"."
] | def del_body(self):
"""Remove the HTML body contents."""
if self.parent is not None:
self.parent().xml.remove(self.xml) | [
"def",
"del_body",
"(",
"self",
")",
":",
"if",
"self",
".",
"parent",
"is",
"not",
"None",
":",
"self",
".",
"parent",
"(",
")",
".",
"xml",
".",
"remove",
"(",
"self",
".",
"xml",
")"
] | https://github.com/emesene/emesene/blob/4548a4098310e21b16437bb36223a7f632a4f7bc/emesene/e3/xmpp/SleekXMPP/sleekxmpp/stanza/htmlim.py#L74-L77 | ||
Azure/azure-linux-extensions | a42ef718c746abab2b3c6a21da87b29e76364558 | AzureMonitorAgent/agent.py | python | set_os_arch | () | Checks if the current system architecture is present in the SupportedArch set and replaces
the package name accordingly | Checks if the current system architecture is present in the SupportedArch set and replaces
the package name accordingly | [
"Checks",
"if",
"the",
"current",
"system",
"architecture",
"is",
"present",
"in",
"the",
"SupportedArch",
"set",
"and",
"replaces",
"the",
"package",
"name",
"accordingly"
] | def set_os_arch():
"""
Checks if the current system architecture is present in the SupportedArch set and replaces
the package name accordingly
"""
global BundleFileName, SupportedArch
current_arch = platform.machine()
if current_arch in SupportedArch:
BundleFileName = BundleFileNam... | [
"def",
"set_os_arch",
"(",
")",
":",
"global",
"BundleFileName",
",",
"SupportedArch",
"current_arch",
"=",
"platform",
".",
"machine",
"(",
")",
"if",
"current_arch",
"in",
"SupportedArch",
":",
"BundleFileName",
"=",
"BundleFileName",
".",
"replace",
"(",
"'x8... | https://github.com/Azure/azure-linux-extensions/blob/a42ef718c746abab2b3c6a21da87b29e76364558/AzureMonitorAgent/agent.py#L1005-L1014 | ||
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | apps/rdbms/src/rdbms/views.py | python | execute_query | (request, design_id=None, query_history_id=None) | return render('execute.mako', request, {
'action': action,
'doc_id': json.dumps(design.id and design.doc.get().id or -1),
'design': design,
'autocomplete_base_url': reverse('rdbms:api_autocomplete_databases', kwargs={}),
'can_edit_name': design.id and not design.is_auto,
}) | View function for executing an arbitrary synchronously query. | View function for executing an arbitrary synchronously query. | [
"View",
"function",
"for",
"executing",
"an",
"arbitrary",
"synchronously",
"query",
"."
] | def execute_query(request, design_id=None, query_history_id=None):
"""
View function for executing an arbitrary synchronously query.
"""
action = request.path
app_name = get_app_name(request)
query_type = beeswax_models.SavedQuery.TYPES_MAPPING[app_name]
design = safe_get_design(request, query_type, desig... | [
"def",
"execute_query",
"(",
"request",
",",
"design_id",
"=",
"None",
",",
"query_history_id",
"=",
"None",
")",
":",
"action",
"=",
"request",
".",
"path",
"app_name",
"=",
"get_app_name",
"(",
"request",
")",
"query_type",
"=",
"beeswax_models",
".",
"Sav... | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/apps/rdbms/src/rdbms/views.py#L69-L84 | |
hatRiot/zarp | 2e772350a01c2aeed3f4da9685cd0cc5d6b3ecad | src/modules/scanner/service_scan.py | python | service_scan.ftp_info | (self, ip) | [] | def ftp_info(self, ip):
con = FTP(ip)
banner = con.getwelcome()
# dump banner
for line in banner.split('\n'):
print '\t |-' + line
print '\t [+] Checking anonymous access...'
try:
con.login()
except:
print '\t [-] No anonymo... | [
"def",
"ftp_info",
"(",
"self",
",",
"ip",
")",
":",
"con",
"=",
"FTP",
"(",
"ip",
")",
"banner",
"=",
"con",
".",
"getwelcome",
"(",
")",
"# dump banner",
"for",
"line",
"in",
"banner",
".",
"split",
"(",
"'\\n'",
")",
":",
"print",
"'\\t |-'",
"... | https://github.com/hatRiot/zarp/blob/2e772350a01c2aeed3f4da9685cd0cc5d6b3ecad/src/modules/scanner/service_scan.py#L180-L200 | ||||
hatRiot/zarp | 2e772350a01c2aeed3f4da9685cd0cc5d6b3ecad | src/lib/libmproxy/contrib/html2text.py | python | HTML2Text.replaceEntities | (self, s) | [] | def replaceEntities(self, s):
s = s.group(1)
if s[0] == "#":
return self.charref(s[1:])
else: return self.entityref(s) | [
"def",
"replaceEntities",
"(",
"self",
",",
"s",
")",
":",
"s",
"=",
"s",
".",
"group",
"(",
"1",
")",
"if",
"s",
"[",
"0",
"]",
"==",
"\"#\"",
":",
"return",
"self",
".",
"charref",
"(",
"s",
"[",
"1",
":",
"]",
")",
"else",
":",
"return",
... | https://github.com/hatRiot/zarp/blob/2e772350a01c2aeed3f4da9685cd0cc5d6b3ecad/src/lib/libmproxy/contrib/html2text.py#L675-L679 | ||||
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Lib/mimetools.py | python | Message.parsetype | (self) | [] | def parsetype(self):
str = self.typeheader
if str is None:
str = 'text/plain'
if ';' in str:
i = str.index(';')
self.plisttext = str[i:]
str = str[:i]
else:
self.plisttext = ''
fields = str.split('/')
for i in ra... | [
"def",
"parsetype",
"(",
"self",
")",
":",
"str",
"=",
"self",
".",
"typeheader",
"if",
"str",
"is",
"None",
":",
"str",
"=",
"'text/plain'",
"if",
"';'",
"in",
"str",
":",
"i",
"=",
"str",
".",
"index",
"(",
"';'",
")",
"self",
".",
"plisttext",
... | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/mimetools.py#L33-L48 | ||||
clinton-hall/nzbToMedia | 27669389216902d1085660167e7bda0bd8527ecf | libs/common/beets/ui/__init__.py | python | CommonOptionsParser.add_album_option | (self, flags=('-a', '--album')) | Add a -a/--album option to match albums instead of tracks.
If used then the format option can auto-detect whether we're setting
the format for items or albums.
Sets the album property on the options extracted from the CLI. | Add a -a/--album option to match albums instead of tracks. | [
"Add",
"a",
"-",
"a",
"/",
"--",
"album",
"option",
"to",
"match",
"albums",
"instead",
"of",
"tracks",
"."
] | def add_album_option(self, flags=('-a', '--album')):
"""Add a -a/--album option to match albums instead of tracks.
If used then the format option can auto-detect whether we're setting
the format for items or albums.
Sets the album property on the options extracted from the CLI.
... | [
"def",
"add_album_option",
"(",
"self",
",",
"flags",
"=",
"(",
"'-a'",
",",
"'--album'",
")",
")",
":",
"album",
"=",
"optparse",
".",
"Option",
"(",
"*",
"flags",
",",
"action",
"=",
"'store_true'",
",",
"help",
"=",
"u'match albums instead of tracks'",
... | https://github.com/clinton-hall/nzbToMedia/blob/27669389216902d1085660167e7bda0bd8527ecf/libs/common/beets/ui/__init__.py#L823-L833 | ||
awslabs/deeplearning-benchmark | 3e9a906422b402869537f91056ae771b66487a8e | image_classification/predict_image.py | python | InferenceTesting.__getImage | (self) | return img | [] | def __getImage(self):
try:
fname = mx.test_utils.download(self.url)
except Exception as e:
print("Error in downloading the image {}".format(e))
img = cv2.cvtColor(cv2.imread(fname), cv2.COLOR_BGR2RGB)
if img is None:
return None
# convert into ... | [
"def",
"__getImage",
"(",
"self",
")",
":",
"try",
":",
"fname",
"=",
"mx",
".",
"test_utils",
".",
"download",
"(",
"self",
".",
"url",
")",
"except",
"Exception",
"as",
"e",
":",
"print",
"(",
"\"Error in downloading the image {}\"",
".",
"format",
"(",
... | https://github.com/awslabs/deeplearning-benchmark/blob/3e9a906422b402869537f91056ae771b66487a8e/image_classification/predict_image.py#L51-L64 | |||
malicialab/avclass | 707c06e0a5e362b6a2f08e4cb1c6c81787c08a8d | avclass2/avclass2_update_module.py | python | Update.is_blacklisted_rel | (self, rel) | return (rel.t1 in self.blist) or (rel.t2 in self.blist) | Return true if relationship is blacklisted | Return true if relationship is blacklisted | [
"Return",
"true",
"if",
"relationship",
"is",
"blacklisted"
] | def is_blacklisted_rel(self, rel):
''' Return true if relationship is blacklisted '''
return (rel.t1 in self.blist) or (rel.t2 in self.blist) | [
"def",
"is_blacklisted_rel",
"(",
"self",
",",
"rel",
")",
":",
"return",
"(",
"rel",
".",
"t1",
"in",
"self",
".",
"blist",
")",
"or",
"(",
"rel",
".",
"t2",
"in",
"self",
".",
"blist",
")"
] | https://github.com/malicialab/avclass/blob/707c06e0a5e362b6a2f08e4cb1c6c81787c08a8d/avclass2/avclass2_update_module.py#L71-L73 | |
garywiz/chaperone | 9ff2c3a5b9c6820f8750320a564ea214042df06f | chaperone/cutil/notify.py | python | NotifyListener.is_client | (self) | return False | [] | def is_client(self):
return False | [
"def",
"is_client",
"(",
"self",
")",
":",
"return",
"False"
] | https://github.com/garywiz/chaperone/blob/9ff2c3a5b9c6820f8750320a564ea214042df06f/chaperone/cutil/notify.py#L29-L30 | |||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py | python | Environment.__getitem__ | (self, project_name) | return self._distmap.get(distribution_key, []) | Return a newest-to-oldest list of distributions for `project_name`
Uses case-insensitive `project_name` comparison, assuming all the
project's distributions use their project's name converted to all
lowercase as their key. | Return a newest-to-oldest list of distributions for `project_name` | [
"Return",
"a",
"newest",
"-",
"to",
"-",
"oldest",
"list",
"of",
"distributions",
"for",
"project_name"
] | def __getitem__(self, project_name):
"""Return a newest-to-oldest list of distributions for `project_name`
Uses case-insensitive `project_name` comparison, assuming all the
project's distributions use their project's name converted to all
lowercase as their key.
"""
dis... | [
"def",
"__getitem__",
"(",
"self",
",",
"project_name",
")",
":",
"distribution_key",
"=",
"project_name",
".",
"lower",
"(",
")",
"return",
"self",
".",
"_distmap",
".",
"get",
"(",
"distribution_key",
",",
"[",
"]",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py#L1007-L1016 | |
JiYou/openstack | 8607dd488bde0905044b303eb6e52bdea6806923 | packages/source/nova/nova/virt/xenapi/agent.py | python | _call_agent | (session, instance, vm_ref, method, addl_args=None,
timeout=None) | Abstracts out the interaction with the agent xenapi plugin. | Abstracts out the interaction with the agent xenapi plugin. | [
"Abstracts",
"out",
"the",
"interaction",
"with",
"the",
"agent",
"xenapi",
"plugin",
"."
] | def _call_agent(session, instance, vm_ref, method, addl_args=None,
timeout=None):
"""Abstracts out the interaction with the agent xenapi plugin."""
if addl_args is None:
addl_args = {}
if timeout is None:
timeout = CONF.agent_timeout
vm_rec = session.call_xenapi("VM.get_... | [
"def",
"_call_agent",
"(",
"session",
",",
"instance",
",",
"vm_ref",
",",
"method",
",",
"addl_args",
"=",
"None",
",",
"timeout",
"=",
"None",
")",
":",
"if",
"addl_args",
"is",
"None",
":",
"addl_args",
"=",
"{",
"}",
"if",
"timeout",
"is",
"None",
... | https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/nova/nova/virt/xenapi/agent.py#L66-L111 | ||
pwnieexpress/pwn_plug_sources | 1a23324f5dc2c3de20f9c810269b6a29b2758cad | src/plecost/xgoogle/search.py | python | GoogleSearch._get_page | (self) | return self._page | [] | def _get_page(self):
return self._page | [
"def",
"_get_page",
"(",
"self",
")",
":",
"return",
"self",
".",
"_page"
] | https://github.com/pwnieexpress/pwn_plug_sources/blob/1a23324f5dc2c3de20f9c810269b6a29b2758cad/src/plecost/xgoogle/search.py#L79-L80 | |||
clinton-hall/nzbToMedia | 27669389216902d1085660167e7bda0bd8527ecf | libs/common/setuptools/py33compat.py | python | Bytecode_compat.__iter__ | (self) | Yield '(op,arg)' pair for each operation in code object 'code | Yield '(op,arg)' pair for each operation in code object 'code | [
"Yield",
"(",
"op",
"arg",
")",
"pair",
"for",
"each",
"operation",
"in",
"code",
"object",
"code"
] | def __iter__(self):
"""Yield '(op,arg)' pair for each operation in code object 'code'"""
bytes = array.array('b', self.code.co_code)
eof = len(self.code.co_code)
ptr = 0
extended_arg = 0
while ptr < eof:
op = bytes[ptr]
if op >= dis.HAVE_ARGUM... | [
"def",
"__iter__",
"(",
"self",
")",
":",
"bytes",
"=",
"array",
".",
"array",
"(",
"'b'",
",",
"self",
".",
"code",
".",
"co_code",
")",
"eof",
"=",
"len",
"(",
"self",
".",
"code",
".",
"co_code",
")",
"ptr",
"=",
"0",
"extended_arg",
"=",
"0",... | https://github.com/clinton-hall/nzbToMedia/blob/27669389216902d1085660167e7bda0bd8527ecf/libs/common/setuptools/py33compat.py#L22-L49 | ||
wger-project/wger | 3a17a2cf133d242d1f8c357faa53cf675a7b3223 | wger/core/models/language.py | python | Language.get_absolute_url | (self) | return reverse('core:language:view', kwargs={'pk': self.id}) | Returns the canonical URL to view a language | Returns the canonical URL to view a language | [
"Returns",
"the",
"canonical",
"URL",
"to",
"view",
"a",
"language"
] | def get_absolute_url(self):
"""
Returns the canonical URL to view a language
"""
return reverse('core:language:view', kwargs={'pk': self.id}) | [
"def",
"get_absolute_url",
"(",
"self",
")",
":",
"return",
"reverse",
"(",
"'core:language:view'",
",",
"kwargs",
"=",
"{",
"'pk'",
":",
"self",
".",
"id",
"}",
")"
] | https://github.com/wger-project/wger/blob/3a17a2cf133d242d1f8c357faa53cf675a7b3223/wger/core/models/language.py#L51-L55 | |
jazzband/tablib | 94ffe67e50eb5bfd99d73a4f010e463478a98928 | src/tablib/core.py | python | Dataset.rpop | (self) | return cache | Removes and returns the last row of the :class:`Dataset`. | Removes and returns the last row of the :class:`Dataset`. | [
"Removes",
"and",
"returns",
"the",
"last",
"row",
"of",
"the",
":",
"class",
":",
"Dataset",
"."
] | def rpop(self):
"""Removes and returns the last row of the :class:`Dataset`."""
cache = self[-1]
del self[-1]
return cache | [
"def",
"rpop",
"(",
"self",
")",
":",
"cache",
"=",
"self",
"[",
"-",
"1",
"]",
"del",
"self",
"[",
"-",
"1",
"]",
"return",
"cache"
] | https://github.com/jazzband/tablib/blob/94ffe67e50eb5bfd99d73a4f010e463478a98928/src/tablib/core.py#L482-L488 | |
kozistr/Awesome-GANs | b4b9a3b8c3fd1d32c864dc5655d80c0650aebee1 | awesome_gans/ebgan/ebgan_model.py | python | EBGAN.encoder | (self, x, reuse=None) | (64)4c2s - (128)4c2s - (256)4c2s
:param x: images
:param reuse: re-usable
:return: logits | (64)4c2s - (128)4c2s - (256)4c2s
:param x: images
:param reuse: re-usable
:return: logits | [
"(",
"64",
")",
"4c2s",
"-",
"(",
"128",
")",
"4c2s",
"-",
"(",
"256",
")",
"4c2s",
":",
"param",
"x",
":",
"images",
":",
"param",
"reuse",
":",
"re",
"-",
"usable",
":",
"return",
":",
"logits"
] | def encoder(self, x, reuse=None):
"""
(64)4c2s - (128)4c2s - (256)4c2s
:param x: images
:param reuse: re-usable
:return: logits
"""
with tf.variable_scope('encoder', reuse=reuse):
x = t.conv2d(x, self.df_dim * 1, 4, 2, name='enc-conv2d-1')
... | [
"def",
"encoder",
"(",
"self",
",",
"x",
",",
"reuse",
"=",
"None",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"'encoder'",
",",
"reuse",
"=",
"reuse",
")",
":",
"x",
"=",
"t",
".",
"conv2d",
"(",
"x",
",",
"self",
".",
"df_dim",
"*",
... | https://github.com/kozistr/Awesome-GANs/blob/b4b9a3b8c3fd1d32c864dc5655d80c0650aebee1/awesome_gans/ebgan/ebgan_model.py#L104-L122 | ||
mozillazg/pypy | 2ff5cd960c075c991389f842c6d59e71cf0cb7d0 | rpython/rtyper/lltypesystem/lltype.py | python | _ptr._expose | (self, offset, val) | return val | XXX A nice docstring here | XXX A nice docstring here | [
"XXX",
"A",
"nice",
"docstring",
"here"
] | def _expose(self, offset, val):
"""XXX A nice docstring here"""
T = typeOf(val)
if isinstance(T, ContainerType):
if (self._T._gckind == 'gc' and T._gckind == 'raw' and
not isinstance(T, OpaqueType)):
val = _interior_ptr(T, self._obj, [offset])
... | [
"def",
"_expose",
"(",
"self",
",",
"offset",
",",
"val",
")",
":",
"T",
"=",
"typeOf",
"(",
"val",
")",
"if",
"isinstance",
"(",
"T",
",",
"ContainerType",
")",
":",
"if",
"(",
"self",
".",
"_T",
".",
"_gckind",
"==",
"'gc'",
"and",
"T",
".",
... | https://github.com/mozillazg/pypy/blob/2ff5cd960c075c991389f842c6d59e71cf0cb7d0/rpython/rtyper/lltypesystem/lltype.py#L1506-L1515 | |
google/ml-fairness-gym | 5b1cd336b844059aa4e4426b54d1f0e6b8c4c7e9 | environments/lending.py | python | BaseLendingEnv.render | (self, mode='human') | Renders the history and current state using matplotlib.
Args:
mode: string indicating the rendering mode. The only supported mode is
`human`. | Renders the history and current state using matplotlib. | [
"Renders",
"the",
"history",
"and",
"current",
"state",
"using",
"matplotlib",
"."
] | def render(self, mode='human'):
"""Renders the history and current state using matplotlib.
Args:
mode: string indicating the rendering mode. The only supported mode is
`human`.
"""
if mode == 'human':
if self.state.params.applicant_distribution.dim != 2:
raise NotImplemente... | [
"def",
"render",
"(",
"self",
",",
"mode",
"=",
"'human'",
")",
":",
"if",
"mode",
"==",
"'human'",
":",
"if",
"self",
".",
"state",
".",
"params",
".",
"applicant_distribution",
".",
"dim",
"!=",
"2",
":",
"raise",
"NotImplementedError",
"(",
"'Cannot r... | https://github.com/google/ml-fairness-gym/blob/5b1cd336b844059aa4e4426b54d1f0e6b8c4c7e9/environments/lending.py#L195-L237 | ||
guoruoqian/DetNet_pytorch | 735e2c51eea0ee4e91d2ec3f28e441ac4e076551 | lib/model/rpn/bbox_transform.py | python | bbox_overlaps_batch | (anchors, gt_boxes) | return overlaps | anchors: (N, 4) ndarray of float
gt_boxes: (b, K, 5) ndarray of float
overlaps: (N, K) ndarray of overlap between boxes and query_boxes | anchors: (N, 4) ndarray of float
gt_boxes: (b, K, 5) ndarray of float | [
"anchors",
":",
"(",
"N",
"4",
")",
"ndarray",
"of",
"float",
"gt_boxes",
":",
"(",
"b",
"K",
"5",
")",
"ndarray",
"of",
"float"
] | def bbox_overlaps_batch(anchors, gt_boxes):
"""
anchors: (N, 4) ndarray of float
gt_boxes: (b, K, 5) ndarray of float
overlaps: (N, K) ndarray of overlap between boxes and query_boxes
"""
batch_size = gt_boxes.size(0)
if anchors.dim() == 2:
N = anchors.size(0)
K = gt_boxe... | [
"def",
"bbox_overlaps_batch",
"(",
"anchors",
",",
"gt_boxes",
")",
":",
"batch_size",
"=",
"gt_boxes",
".",
"size",
"(",
"0",
")",
"if",
"anchors",
".",
"dim",
"(",
")",
"==",
"2",
":",
"N",
"=",
"anchors",
".",
"size",
"(",
"0",
")",
"K",
"=",
... | https://github.com/guoruoqian/DetNet_pytorch/blob/735e2c51eea0ee4e91d2ec3f28e441ac4e076551/lib/model/rpn/bbox_transform.py#L168-L257 | |
openstack/trove | be86b79119d16ee77f596172f43b0c97cb2617bd | trove/guestagent/common/configuration.py | python | ConfigurationManager.get_value | (self, key, section=None, default=None) | return self._value_cache.get(key, default) | Return the current value at a given key or 'default'. | Return the current value at a given key or 'default'. | [
"Return",
"the",
"current",
"value",
"at",
"a",
"given",
"key",
"or",
"default",
"."
] | def get_value(self, key, section=None, default=None):
"""Return the current value at a given key or 'default'.
"""
if self._value_cache is None:
self.refresh_cache()
if section:
return self._value_cache.get(section, {}).get(key, default)
return self._val... | [
"def",
"get_value",
"(",
"self",
",",
"key",
",",
"section",
"=",
"None",
",",
"default",
"=",
"None",
")",
":",
"if",
"self",
".",
"_value_cache",
"is",
"None",
":",
"self",
".",
"refresh_cache",
"(",
")",
"if",
"section",
":",
"return",
"self",
"."... | https://github.com/openstack/trove/blob/be86b79119d16ee77f596172f43b0c97cb2617bd/trove/guestagent/common/configuration.py#L107-L116 | |
lbryio/lbry-sdk | f78e3825ca0f130834d3876a824f9d380501ced8 | lbry/wallet/server/session.py | python | LBRYElectrumX.transaction_broadcast | (self, raw_tx) | Broadcast a raw transaction to the network.
raw_tx: the raw transaction as a hexadecimal string | Broadcast a raw transaction to the network. | [
"Broadcast",
"a",
"raw",
"transaction",
"to",
"the",
"network",
"."
] | async def transaction_broadcast(self, raw_tx):
"""Broadcast a raw transaction to the network.
raw_tx: the raw transaction as a hexadecimal string"""
# This returns errors as JSON RPC errors, as is natural
try:
hex_hash = await self.session_mgr.broadcast_transaction(raw_tx)
... | [
"async",
"def",
"transaction_broadcast",
"(",
"self",
",",
"raw_tx",
")",
":",
"# This returns errors as JSON RPC errors, as is natural",
"try",
":",
"hex_hash",
"=",
"await",
"self",
".",
"session_mgr",
".",
"broadcast_transaction",
"(",
"raw_tx",
")",
"self",
".",
... | https://github.com/lbryio/lbry-sdk/blob/f78e3825ca0f130834d3876a824f9d380501ced8/lbry/wallet/server/session.py#L1432-L1448 | ||
XinJCheng/CSPN | b3e487bdcdcd8a63333656e69b3268698e543181 | cspn_pytorch/data_transform.py | python | Rotation.__call__ | (self, img) | return img.rotate(self.degrees, self.resample, self.expand, self.center) | img (PIL Image): Image to be rotated.
Returns:
PIL Image: Rotated image. | img (PIL Image): Image to be rotated.
Returns:
PIL Image: Rotated image. | [
"img",
"(",
"PIL",
"Image",
")",
":",
"Image",
"to",
"be",
"rotated",
".",
"Returns",
":",
"PIL",
"Image",
":",
"Rotated",
"image",
"."
] | def __call__(self, img):
"""
img (PIL Image): Image to be rotated.
Returns:
PIL Image: Rotated image.
"""
if not _is_pil_image(img):
raise TypeError('img should be PIL Image. Got {}'.format(type(img)))
return img.rotate(self.degrees, self.res... | [
"def",
"__call__",
"(",
"self",
",",
"img",
")",
":",
"if",
"not",
"_is_pil_image",
"(",
"img",
")",
":",
"raise",
"TypeError",
"(",
"'img should be PIL Image. Got {}'",
".",
"format",
"(",
"type",
"(",
"img",
")",
")",
")",
"return",
"img",
".",
"rotate... | https://github.com/XinJCheng/CSPN/blob/b3e487bdcdcd8a63333656e69b3268698e543181/cspn_pytorch/data_transform.py#L480-L490 | |
iMoonLab/MeshNet | 70f9115a121cef71f62d774088771337c3beaf4b | models/layers.py | python | FaceRotateConvolution.__init__ | (self) | [] | def __init__(self):
super(FaceRotateConvolution, self).__init__()
self.rotate_mlp = nn.Sequential(
nn.Conv1d(6, 32, 1),
nn.BatchNorm1d(32),
nn.ReLU(),
nn.Conv1d(32, 32, 1),
nn.BatchNorm1d(32),
nn.ReLU()
)
self.fusion... | [
"def",
"__init__",
"(",
"self",
")",
":",
"super",
"(",
"FaceRotateConvolution",
",",
"self",
")",
".",
"__init__",
"(",
")",
"self",
".",
"rotate_mlp",
"=",
"nn",
".",
"Sequential",
"(",
"nn",
".",
"Conv1d",
"(",
"6",
",",
"32",
",",
"1",
")",
","... | https://github.com/iMoonLab/MeshNet/blob/70f9115a121cef71f62d774088771337c3beaf4b/models/layers.py#L9-L26 | ||||
biolab/orange3 | 41685e1c7b1d1babe680113685a2d44bcc9fec0b | Orange/widgets/data/owtable.py | python | TableSliceProxy.setRowSlice | (self, rowslice) | [] | def setRowSlice(self, rowslice):
if rowslice.step is not None and rowslice.step != 1:
raise ValueError("invalid stride")
if self.__rowslice != rowslice:
self.beginResetModel()
self.__rowslice = rowslice
self.endResetModel() | [
"def",
"setRowSlice",
"(",
"self",
",",
"rowslice",
")",
":",
"if",
"rowslice",
".",
"step",
"is",
"not",
"None",
"and",
"rowslice",
".",
"step",
"!=",
"1",
":",
"raise",
"ValueError",
"(",
"\"invalid stride\"",
")",
"if",
"self",
".",
"__rowslice",
"!="... | https://github.com/biolab/orange3/blob/41685e1c7b1d1babe680113685a2d44bcc9fec0b/Orange/widgets/data/owtable.py#L130-L137 | ||||
microsoft/bistring | e23443e495f762967b09670b27bb1ff46ff4fef1 | python/bistring/_builder.py | python | BistrBuilder.current | (self) | return self._original.modified | The current string before modifications. | The current string before modifications. | [
"The",
"current",
"string",
"before",
"modifications",
"."
] | def current(self) -> str:
"""
The current string before modifications.
"""
return self._original.modified | [
"def",
"current",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_original",
".",
"modified"
] | https://github.com/microsoft/bistring/blob/e23443e495f762967b09670b27bb1ff46ff4fef1/python/bistring/_builder.py#L84-L88 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/django/forms/models.py | python | ModelChoiceIterator.choice | (self, obj) | return (self.field.prepare_value(obj), self.field.label_from_instance(obj)) | [] | def choice(self, obj):
return (self.field.prepare_value(obj), self.field.label_from_instance(obj)) | [
"def",
"choice",
"(",
"self",
",",
"obj",
")",
":",
"return",
"(",
"self",
".",
"field",
".",
"prepare_value",
"(",
"obj",
")",
",",
"self",
".",
"field",
".",
"label_from_instance",
"(",
"obj",
")",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/django/forms/models.py#L1124-L1125 | |||
misterch0c/shadowbroker | e3a069bea47a2c1009697941ac214adc6f90aa8d | windows/Resources/Python/Core/Lib/logging/handlers.py | python | NTEventLogHandler.emit | (self, record) | Emit a record.
Determine the message ID, event category and event type. Then
log the message in the NT event log. | Emit a record.
Determine the message ID, event category and event type. Then
log the message in the NT event log. | [
"Emit",
"a",
"record",
".",
"Determine",
"the",
"message",
"ID",
"event",
"category",
"and",
"event",
"type",
".",
"Then",
"log",
"the",
"message",
"in",
"the",
"NT",
"event",
"log",
"."
] | def emit(self, record):
"""
Emit a record.
Determine the message ID, event category and event type. Then
log the message in the NT event log.
"""
if self._welu:
try:
id = self.getMessageID(record)
cat = self.getEventCat... | [
"def",
"emit",
"(",
"self",
",",
"record",
")",
":",
"if",
"self",
".",
"_welu",
":",
"try",
":",
"id",
"=",
"self",
".",
"getMessageID",
"(",
"record",
")",
"cat",
"=",
"self",
".",
"getEventCategory",
"(",
"record",
")",
"type",
"=",
"self",
".",... | https://github.com/misterch0c/shadowbroker/blob/e3a069bea47a2c1009697941ac214adc6f90aa8d/windows/Resources/Python/Core/Lib/logging/handlers.py#L890-L907 | ||
Te-k/harpoon | 654381fff282aacc7e3c8264fd4cead40eedf48d | harpoon/lib/koodous.py | python | Koodous.analysis | (self, hash) | return self._query("/" + hash + "/analysis") | [] | def analysis(self, hash):
return self._query("/" + hash + "/analysis") | [
"def",
"analysis",
"(",
"self",
",",
"hash",
")",
":",
"return",
"self",
".",
"_query",
"(",
"\"/\"",
"+",
"hash",
"+",
"\"/analysis\"",
")"
] | https://github.com/Te-k/harpoon/blob/654381fff282aacc7e3c8264fd4cead40eedf48d/harpoon/lib/koodous.py#L42-L43 | |||
microsoft/azure-devops-python-api | 451cade4c475482792cbe9e522c1fee32393139e | azure-devops/azure/devops/v6_0/feature_availability/feature_availability_client.py | python | FeatureAvailabilityClient.get_all_feature_flags | (self, user_email=None) | return self._deserialize('[FeatureFlag]', self._unwrap_collection(response)) | GetAllFeatureFlags.
[Preview API] Retrieve a listing of all feature flags and their current states for a user
:param str user_email: The email of the user to check
:rtype: [FeatureFlag] | GetAllFeatureFlags.
[Preview API] Retrieve a listing of all feature flags and their current states for a user
:param str user_email: The email of the user to check
:rtype: [FeatureFlag] | [
"GetAllFeatureFlags",
".",
"[",
"Preview",
"API",
"]",
"Retrieve",
"a",
"listing",
"of",
"all",
"feature",
"flags",
"and",
"their",
"current",
"states",
"for",
"a",
"user",
":",
"param",
"str",
"user_email",
":",
"The",
"email",
"of",
"the",
"user",
"to",
... | def get_all_feature_flags(self, user_email=None):
"""GetAllFeatureFlags.
[Preview API] Retrieve a listing of all feature flags and their current states for a user
:param str user_email: The email of the user to check
:rtype: [FeatureFlag]
"""
query_parameters = {}
... | [
"def",
"get_all_feature_flags",
"(",
"self",
",",
"user_email",
"=",
"None",
")",
":",
"query_parameters",
"=",
"{",
"}",
"if",
"user_email",
"is",
"not",
"None",
":",
"query_parameters",
"[",
"'userEmail'",
"]",
"=",
"self",
".",
"_serialize",
".",
"query",... | https://github.com/microsoft/azure-devops-python-api/blob/451cade4c475482792cbe9e522c1fee32393139e/azure-devops/azure/devops/v6_0/feature_availability/feature_availability_client.py#L28-L41 | |
Azure/azure-devops-cli-extension | 11334cd55806bef0b99c3bee5a438eed71e44037 | azure-devops/azext_devops/devops_sdk/released/work_item_tracking/work_item_tracking_client.py | python | WorkItemTrackingClient.get_update | (self, id, update_number, project=None) | return self._deserialize('WorkItemUpdate', response) | GetUpdate.
Returns a single update for a work item
:param int id:
:param int update_number:
:param str project: Project ID or project name
:rtype: :class:`<WorkItemUpdate> <azure.devops.v5_1.work_item_tracking.models.WorkItemUpdate>` | GetUpdate.
Returns a single update for a work item
:param int id:
:param int update_number:
:param str project: Project ID or project name
:rtype: :class:`<WorkItemUpdate> <azure.devops.v5_1.work_item_tracking.models.WorkItemUpdate>` | [
"GetUpdate",
".",
"Returns",
"a",
"single",
"update",
"for",
"a",
"work",
"item",
":",
"param",
"int",
"id",
":",
":",
"param",
"int",
"update_number",
":",
":",
"param",
"str",
"project",
":",
"Project",
"ID",
"or",
"project",
"name",
":",
"rtype",
":... | def get_update(self, id, update_number, project=None):
"""GetUpdate.
Returns a single update for a work item
:param int id:
:param int update_number:
:param str project: Project ID or project name
:rtype: :class:`<WorkItemUpdate> <azure.devops.v5_1.work_item_tracking.mode... | [
"def",
"get_update",
"(",
"self",
",",
"id",
",",
"update_number",
",",
"project",
"=",
"None",
")",
":",
"route_values",
"=",
"{",
"}",
"if",
"project",
"is",
"not",
"None",
":",
"route_values",
"[",
"'project'",
"]",
"=",
"self",
".",
"_serialize",
"... | https://github.com/Azure/azure-devops-cli-extension/blob/11334cd55806bef0b99c3bee5a438eed71e44037/azure-devops/azext_devops/devops_sdk/released/work_item_tracking/work_item_tracking_client.py#L657-L676 | |
chaoss/grimoirelab-perceval | ba19bfd5e40bffdd422ca8e68526326b47f97491 | perceval/backends/core/gitlab.py | python | GitLab.fetch_items | (self, category, **kwargs) | return items | Fetch the items (issues or merge_requests)
:param category: the category of items to fetch
:param kwargs: backend arguments
:returns: a generator of items | Fetch the items (issues or merge_requests) | [
"Fetch",
"the",
"items",
"(",
"issues",
"or",
"merge_requests",
")"
] | def fetch_items(self, category, **kwargs):
"""Fetch the items (issues or merge_requests)
:param category: the category of items to fetch
:param kwargs: backend arguments
:returns: a generator of items
"""
from_date = kwargs['from_date']
if category == CATEGORY_... | [
"def",
"fetch_items",
"(",
"self",
",",
"category",
",",
"*",
"*",
"kwargs",
")",
":",
"from_date",
"=",
"kwargs",
"[",
"'from_date'",
"]",
"if",
"category",
"==",
"CATEGORY_ISSUE",
":",
"items",
"=",
"self",
".",
"__fetch_issues",
"(",
"from_date",
")",
... | https://github.com/chaoss/grimoirelab-perceval/blob/ba19bfd5e40bffdd422ca8e68526326b47f97491/perceval/backends/core/gitlab.py#L178-L193 | |
CJWorkbench/cjworkbench | e0b878d8ff819817fa049a4126efcbfcec0b50e6 | renderer/execute/renderprep.py | python | _Cleaner._ | (self, schema: ParamSchema.File, value: Optional[str]) | return value | Convert a `file` String-encoded UUID to a tempfile `pathlib.Path`.
The return value:
* Points to a temporary file containing all bytes
* Has the same suffix as the originally-uploaded file
* Will have its file deleted when it goes out of scope
If the file is in the database bu... | Convert a `file` String-encoded UUID to a tempfile `pathlib.Path`. | [
"Convert",
"a",
"file",
"String",
"-",
"encoded",
"UUID",
"to",
"a",
"tempfile",
"pathlib",
".",
"Path",
"."
] | def _(self, schema: ParamSchema.File, value: Optional[str]) -> Optional[Path]:
"""Convert a `file` String-encoded UUID to a tempfile `pathlib.Path`.
The return value:
* Points to a temporary file containing all bytes
* Has the same suffix as the originally-uploaded file
* Will ... | [
"def",
"_",
"(",
"self",
",",
"schema",
":",
"ParamSchema",
".",
"File",
",",
"value",
":",
"Optional",
"[",
"str",
"]",
")",
"->",
"Optional",
"[",
"Path",
"]",
":",
"if",
"value",
"is",
"None",
":",
"return",
"None",
"try",
":",
"uploaded_file",
... | https://github.com/CJWorkbench/cjworkbench/blob/e0b878d8ff819817fa049a4126efcbfcec0b50e6/renderer/execute/renderprep.py#L168-L207 | |
ayoolaolafenwa/PixelLib | ae56003c416a98780141a1170c9d888fe9a31317 | pixellib/torchbackend/instance/engine/train_loop.py | python | TrainerBase.train | (self, start_iter: int, max_iter: int) | Args:
start_iter, max_iter (int): See docs above | Args:
start_iter, max_iter (int): See docs above | [
"Args",
":",
"start_iter",
"max_iter",
"(",
"int",
")",
":",
"See",
"docs",
"above"
] | def train(self, start_iter: int, max_iter: int):
"""
Args:
start_iter, max_iter (int): See docs above
"""
logger = logging.getLogger(__name__)
logger.info("Starting training from iteration {}".format(start_iter))
self.iter = self.start_iter = start_iter
... | [
"def",
"train",
"(",
"self",
",",
"start_iter",
":",
"int",
",",
"max_iter",
":",
"int",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"logger",
".",
"info",
"(",
"\"Starting training from iteration {}\"",
".",
"format",
"(",
... | https://github.com/ayoolaolafenwa/PixelLib/blob/ae56003c416a98780141a1170c9d888fe9a31317/pixellib/torchbackend/instance/engine/train_loop.py#L133-L159 | ||
tobegit3hub/deep_image_model | 8a53edecd9e00678b278bb10f6fb4bdb1e4ee25e | java_predict_client/src/main/proto/tensorflow/python/ops/control_flow_grad.py | python | _EnterGrad | (op, grad) | return result | Gradients for an Enter are calculated using an Exit op.
For loop variables, grad is the gradient so just add an exit.
For loop invariants, we need to add an accumulator loop. | Gradients for an Enter are calculated using an Exit op. | [
"Gradients",
"for",
"an",
"Enter",
"are",
"calculated",
"using",
"an",
"Exit",
"op",
"."
] | def _EnterGrad(op, grad):
"""Gradients for an Enter are calculated using an Exit op.
For loop variables, grad is the gradient so just add an exit.
For loop invariants, we need to add an accumulator loop.
"""
graph = ops.get_default_graph()
# pylint: disable=protected-access
grad_ctxt = graph._get_control... | [
"def",
"_EnterGrad",
"(",
"op",
",",
"grad",
")",
":",
"graph",
"=",
"ops",
".",
"get_default_graph",
"(",
")",
"# pylint: disable=protected-access",
"grad_ctxt",
"=",
"graph",
".",
"_get_control_flow_context",
"(",
")",
"# pylint: enable=protected-access",
"if",
"n... | https://github.com/tobegit3hub/deep_image_model/blob/8a53edecd9e00678b278bb10f6fb4bdb1e4ee25e/java_predict_client/src/main/proto/tensorflow/python/ops/control_flow_grad.py#L190-L218 | |
peeringdb/peeringdb | 47c6a699267b35663898f8d261159bdae9720f04 | peeringdb_server/mock.py | python | Mock.create | (self, reftag, **kwargs) | return obj | Create a new instance of model specified in `reftag`
Any arguments passed as kwargs will override mock field values.
Note: Unless there are no relationships passed in kwargs, required parent
objects will be automatically created as well.
Returns: The created instance. | Create a new instance of model specified in `reftag` | [
"Create",
"a",
"new",
"instance",
"of",
"model",
"specified",
"in",
"reftag"
] | def create(self, reftag, **kwargs):
"""
Create a new instance of model specified in `reftag`
Any arguments passed as kwargs will override mock field values.
Note: Unless there are no relationships passed in kwargs, required parent
objects will be automatically created as well.
... | [
"def",
"create",
"(",
"self",
",",
"reftag",
",",
"*",
"*",
"kwargs",
")",
":",
"model",
"=",
"REFTAG_MAP",
".",
"get",
"(",
"reftag",
")",
"data",
"=",
"{",
"}",
"data",
".",
"update",
"(",
"*",
"*",
"kwargs",
")",
"# first we create any required pare... | https://github.com/peeringdb/peeringdb/blob/47c6a699267b35663898f8d261159bdae9720f04/peeringdb_server/mock.py#L67-L152 | |
pymedusa/Medusa | 1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38 | ext/github/Repository.py | python | Repository.edit | (
self,
name=None,
description=github.GithubObject.NotSet,
homepage=github.GithubObject.NotSet,
private=github.GithubObject.NotSet,
has_issues=github.GithubObject.NotSet,
has_projects=github.GithubObject.NotSet,
has_wiki=github.GithubObject.NotSet,
... | :calls: `PATCH /repos/:owner/:repo <http://developer.github.com/v3/repos>`_
:param name: string
:param description: string
:param homepage: string
:param private: bool
:param has_issues: bool
:param has_projects: bool
:param has_wiki: bool
:param has_downl... | :calls: `PATCH /repos/:owner/:repo <http://developer.github.com/v3/repos>`_
:param name: string
:param description: string
:param homepage: string
:param private: bool
:param has_issues: bool
:param has_projects: bool
:param has_wiki: bool
:param has_downl... | [
":",
"calls",
":",
"PATCH",
"/",
"repos",
"/",
":",
"owner",
"/",
":",
"repo",
"<http",
":",
"//",
"developer",
".",
"github",
".",
"com",
"/",
"v3",
"/",
"repos",
">",
"_",
":",
"param",
"name",
":",
"string",
":",
"param",
"description",
":",
"... | def edit(
self,
name=None,
description=github.GithubObject.NotSet,
homepage=github.GithubObject.NotSet,
private=github.GithubObject.NotSet,
has_issues=github.GithubObject.NotSet,
has_projects=github.GithubObject.NotSet,
has_wiki=github.GithubObject.NotSet,... | [
"def",
"edit",
"(",
"self",
",",
"name",
"=",
"None",
",",
"description",
"=",
"github",
".",
"GithubObject",
".",
"NotSet",
",",
"homepage",
"=",
"github",
".",
"GithubObject",
".",
"NotSet",
",",
"private",
"=",
"github",
".",
"GithubObject",
".",
"Not... | https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/ext/github/Repository.py#L1395-L1497 | ||
jsonpickle/jsonpickle | 1594d3fdb6717cb06d05c79e46f93330cc38eb36 | jsonpickle/pickler.py | python | _mktyperef | (obj) | return {tags.TYPE: util.importable_name(obj)} | Return a typeref dictionary
>>> _mktyperef(AssertionError) == {'py/type': 'builtins.AssertionError'}
True | Return a typeref dictionary | [
"Return",
"a",
"typeref",
"dictionary"
] | def _mktyperef(obj):
"""Return a typeref dictionary
>>> _mktyperef(AssertionError) == {'py/type': 'builtins.AssertionError'}
True
"""
return {tags.TYPE: util.importable_name(obj)} | [
"def",
"_mktyperef",
"(",
"obj",
")",
":",
"return",
"{",
"tags",
".",
"TYPE",
":",
"util",
".",
"importable_name",
"(",
"obj",
")",
"}"
] | https://github.com/jsonpickle/jsonpickle/blob/1594d3fdb6717cb06d05c79e46f93330cc38eb36/jsonpickle/pickler.py#L743-L750 | |
hubblestack/hubble | 763142474edcecdec5fd25591dc29c3536e8f969 | hubblestack/modules/win_status.py | python | uptime | (human_readable=False) | return str(uptime) if human_readable else uptime.total_seconds() | .. versionadded:: 2015.8.0
Return the system uptime for the machine
Args:
human_readable (bool):
Return uptime in human readable format if ``True``, otherwise
return seconds. Default is ``False``
.. note::
Human readable format is ``days, hours:min... | .. versionadded:: 2015.8.0 | [
"..",
"versionadded",
"::",
"2015",
".",
"8",
".",
"0"
] | def uptime(human_readable=False):
'''
.. versionadded:: 2015.8.0
Return the system uptime for the machine
Args:
human_readable (bool):
Return uptime in human readable format if ``True``, otherwise
return seconds. Default is ``False``
.. note::
... | [
"def",
"uptime",
"(",
"human_readable",
"=",
"False",
")",
":",
"# Get startup time",
"startup_time",
"=",
"datetime",
".",
"datetime",
".",
"fromtimestamp",
"(",
"psutil",
".",
"boot_time",
"(",
")",
")",
"# Subtract startup time from current time to get the uptime of ... | https://github.com/hubblestack/hubble/blob/763142474edcecdec5fd25591dc29c3536e8f969/hubblestack/modules/win_status.py#L74-L108 | |
Qirky/FoxDot | 76318f9630bede48ff3994146ed644affa27bfa4 | FoxDot/lib/ServerManager.py | python | SCLangServerManager.set_midi_nudge | (self, value) | return | [] | def set_midi_nudge(self, value):
self.midi_nudge = value
return | [
"def",
"set_midi_nudge",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"midi_nudge",
"=",
"value",
"return"
] | https://github.com/Qirky/FoxDot/blob/76318f9630bede48ff3994146ed644affa27bfa4/FoxDot/lib/ServerManager.py#L301-L303 | |||
TengXiaoDai/DistributedCrawling | f5c2439e6ce68dd9b49bde084d76473ff9ed4963 | Lib/random.py | python | Random.vonmisesvariate | (self, mu, kappa) | return theta | Circular data distribution.
mu is the mean angle, expressed in radians between 0 and 2*pi, and
kappa is the concentration parameter, which must be greater than or
equal to zero. If kappa is equal to zero, this distribution reduces
to a uniform random angle over the range 0 to 2*pi. | Circular data distribution. | [
"Circular",
"data",
"distribution",
"."
] | def vonmisesvariate(self, mu, kappa):
"""Circular data distribution.
mu is the mean angle, expressed in radians between 0 and 2*pi, and
kappa is the concentration parameter, which must be greater than or
equal to zero. If kappa is equal to zero, this distribution reduces
to a u... | [
"def",
"vonmisesvariate",
"(",
"self",
",",
"mu",
",",
"kappa",
")",
":",
"# mu: mean angle (in radians between 0 and 2*pi)",
"# kappa: concentration parameter kappa (>= 0)",
"# if kappa = 0 generate uniform random angle",
"# Based upon an algorithm published in: Fisher, N.I.,",
"# \"... | https://github.com/TengXiaoDai/DistributedCrawling/blob/f5c2439e6ce68dd9b49bde084d76473ff9ed4963/Lib/random.py#L435-L479 | |
smart-mobile-software/gitstack | d9fee8f414f202143eb6e620529e8e5539a2af56 | python/Lib/site-packages/django/core/files/uploadhandler.py | python | load_handler | (path, *args, **kwargs) | return cls(*args, **kwargs) | Given a path to a handler, return an instance of that handler.
E.g.::
>>> load_handler('django.core.files.uploadhandler.TemporaryFileUploadHandler', request)
<TemporaryFileUploadHandler object at 0x...> | Given a path to a handler, return an instance of that handler. | [
"Given",
"a",
"path",
"to",
"a",
"handler",
"return",
"an",
"instance",
"of",
"that",
"handler",
"."
] | def load_handler(path, *args, **kwargs):
"""
Given a path to a handler, return an instance of that handler.
E.g.::
>>> load_handler('django.core.files.uploadhandler.TemporaryFileUploadHandler', request)
<TemporaryFileUploadHandler object at 0x...>
"""
i = path.rfind('.')
module... | [
"def",
"load_handler",
"(",
"path",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"i",
"=",
"path",
".",
"rfind",
"(",
"'.'",
")",
"module",
",",
"attr",
"=",
"path",
"[",
":",
"i",
"]",
",",
"path",
"[",
"i",
"+",
"1",
":",
"]",
"tr... | https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/site-packages/django/core/files/uploadhandler.py#L194-L215 | |
openhatch/oh-mainline | ce29352a034e1223141dcc2f317030bbc3359a51 | vendor/packages/twisted/twisted/names/client.py | python | lookupResponsibility | (name, timeout=None) | return getResolver().lookupResponsibility(name, timeout) | Perform an RP record lookup.
@type name: C{str}
@param name: DNS name to resolve.
@type timeout: Sequence of C{int}
@param timeout: Number of seconds after which to reissue the query.
When the last timeout expires, the query is considered failed.
@rtype: C{Deferred} | Perform an RP record lookup. | [
"Perform",
"an",
"RP",
"record",
"lookup",
"."
] | def lookupResponsibility(name, timeout=None):
"""
Perform an RP record lookup.
@type name: C{str}
@param name: DNS name to resolve.
@type timeout: Sequence of C{int}
@param timeout: Number of seconds after which to reissue the query.
When the last timeout expires, the query is considered f... | [
"def",
"lookupResponsibility",
"(",
"name",
",",
"timeout",
"=",
"None",
")",
":",
"return",
"getResolver",
"(",
")",
".",
"lookupResponsibility",
"(",
"name",
",",
"timeout",
")"
] | https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/twisted/twisted/names/client.py#L869-L882 | |
kozec/syncthing-gtk | 01eeeb9ed485232e145bf39d90142832e1c9751e | syncthing_gtk/foldereditor.py | python | FolderEditorDialog.mark_device | (self, nid) | Marks (checks) checkbox for specified device | Marks (checks) checkbox for specified device | [
"Marks",
"(",
"checks",
")",
"checkbox",
"for",
"specified",
"device"
] | def mark_device(self, nid):
""" Marks (checks) checkbox for specified device """
if "vdevices" in self: # ... only if there are checkboxes here
for child in self["vdevices"].get_children():
if child.get_tooltip_text() == nid:
l = child.get_children()[0] # Label in checkbox
l.set_markup("<b>%s</b>" ... | [
"def",
"mark_device",
"(",
"self",
",",
"nid",
")",
":",
"if",
"\"vdevices\"",
"in",
"self",
":",
"# ... only if there are checkboxes here",
"for",
"child",
"in",
"self",
"[",
"\"vdevices\"",
"]",
".",
"get_children",
"(",
")",
":",
"if",
"child",
".",
"get_... | https://github.com/kozec/syncthing-gtk/blob/01eeeb9ed485232e145bf39d90142832e1c9751e/syncthing_gtk/foldereditor.py#L296-L303 | ||
MDAnalysis/mdanalysis | 3488df3cdb0c29ed41c4fb94efe334b541e31b21 | package/MDAnalysis/core/groups.py | python | SegmentGroup.n_atoms | (self) | return len(self.atoms) | Number of atoms present in the :class:`SegmentGroup`, including
duplicate segments (and thus, duplicate atoms).
Equivalent to ``len(self.atoms)``. | Number of atoms present in the :class:`SegmentGroup`, including
duplicate segments (and thus, duplicate atoms). | [
"Number",
"of",
"atoms",
"present",
"in",
"the",
":",
"class",
":",
"SegmentGroup",
"including",
"duplicate",
"segments",
"(",
"and",
"thus",
"duplicate",
"atoms",
")",
"."
] | def n_atoms(self):
"""Number of atoms present in the :class:`SegmentGroup`, including
duplicate segments (and thus, duplicate atoms).
Equivalent to ``len(self.atoms)``.
"""
return len(self.atoms) | [
"def",
"n_atoms",
"(",
"self",
")",
":",
"return",
"len",
"(",
"self",
".",
"atoms",
")"
] | https://github.com/MDAnalysis/mdanalysis/blob/3488df3cdb0c29ed41c4fb94efe334b541e31b21/package/MDAnalysis/core/groups.py#L3797-L3803 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/sqlalchemy/orm/instrumentation.py | python | ClassManager.__init__ | (self, class_) | [] | def __init__(self, class_):
self.class_ = class_
self.info = {}
self.new_init = None
self.local_attrs = {}
self.originals = {}
self._bases = [mgr for mgr in [
manager_of_class(base)
for base in self.class_.__bases__
if isinstance(base,... | [
"def",
"__init__",
"(",
"self",
",",
"class_",
")",
":",
"self",
".",
"class_",
"=",
"class_",
"self",
".",
"info",
"=",
"{",
"}",
"self",
".",
"new_init",
"=",
"None",
"self",
".",
"local_attrs",
"=",
"{",
"}",
"self",
".",
"originals",
"=",
"{",
... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/sqlalchemy/orm/instrumentation.py#L55-L86 | ||||
feliam/pysymemu | ad02e52122099d537372eb4d11fd5024b8a3857f | cpu.py | python | Cpu.JNZ | (cpu, target) | Jumps short if not zero.
@param cpu: current CPU.
@param target: destination operand. | Jumps short if not zero. | [
"Jumps",
"short",
"if",
"not",
"zero",
"."
] | def JNZ(cpu, target):
'''
Jumps short if not zero.
@param cpu: current CPU.
@param target: destination operand.
'''
cpu.JNE(target) | [
"def",
"JNZ",
"(",
"cpu",
",",
"target",
")",
":",
"cpu",
".",
"JNE",
"(",
"target",
")"
] | https://github.com/feliam/pysymemu/blob/ad02e52122099d537372eb4d11fd5024b8a3857f/cpu.py#L3507-L3514 | ||
xolox/python-humanfriendly | 6758ac61f906cd8528682003070a57febe4ad3cf | humanfriendly/prompts.py | python | prompt_for_confirmation | (question, default=None, padding=True) | Prompt the user for confirmation.
:param question: The text that explains what the user is confirming (a string).
:param default: The default value (a boolean) or :data:`None`.
:param padding: Refer to the documentation of :func:`prompt_for_input()`.
:returns: - If the user enters 'yes' or 'y' then :da... | Prompt the user for confirmation. | [
"Prompt",
"the",
"user",
"for",
"confirmation",
"."
] | def prompt_for_confirmation(question, default=None, padding=True):
"""
Prompt the user for confirmation.
:param question: The text that explains what the user is confirming (a string).
:param default: The default value (a boolean) or :data:`None`.
:param padding: Refer to the documentation of :func... | [
"def",
"prompt_for_confirmation",
"(",
"question",
",",
"default",
"=",
"None",
",",
"padding",
"=",
"True",
")",
":",
"# Generate the text for the prompt.",
"prompt_text",
"=",
"prepare_prompt_text",
"(",
"question",
",",
"bold",
"=",
"True",
")",
"# Append the val... | https://github.com/xolox/python-humanfriendly/blob/6758ac61f906cd8528682003070a57febe4ad3cf/humanfriendly/prompts.py#L54-L117 | ||
IronLanguages/main | a949455434b1fda8c783289e897e78a9a0caabb5 | External.LCA_RESTRICTED/Languages/IronPython/27/Lib/_strptime.py | python | _strptime | (data_string, format="%a %b %d %H:%M:%S %Y") | return (time.struct_time((year, month, day,
hour, minute, second,
weekday, julian, tz)), fraction) | Return a time struct based on the input string and the format string. | Return a time struct based on the input string and the format string. | [
"Return",
"a",
"time",
"struct",
"based",
"on",
"the",
"input",
"string",
"and",
"the",
"format",
"string",
"."
] | def _strptime(data_string, format="%a %b %d %H:%M:%S %Y"):
"""Return a time struct based on the input string and the format string."""
global _TimeRE_cache, _regex_cache
with _cache_lock:
locale_time = _TimeRE_cache.locale_time
if (_getlang() != locale_time.lang or
time.tzname !=... | [
"def",
"_strptime",
"(",
"data_string",
",",
"format",
"=",
"\"%a %b %d %H:%M:%S %Y\"",
")",
":",
"global",
"_TimeRE_cache",
",",
"_regex_cache",
"with",
"_cache_lock",
":",
"locale_time",
"=",
"_TimeRE_cache",
".",
"locale_time",
"if",
"(",
"_getlang",
"(",
")",
... | https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/IronPython/27/Lib/_strptime.py#L299-L475 | |
gxcuizy/Python | 72167d12439a615a8fd4b935eae1fb6516ed4e69 | 从零学Python-掘金活动/day22/matplotlib_use.py | python | fun_8 | () | Image 图片 | Image 图片 | [
"Image",
"图片"
] | def fun_8():
"""Image 图片"""
# 用这样 3x3 的 2D-array 来表示点的颜色
a = numpy.array(
[0.313660827978, 0.365348418405, 0.423733120134, 0.365348418405, 0.439599930621, 0.525083754405, 0.423733120134,
0.525083754405, 0.651536351379]).reshape(3, 3)
pyplot.imshow(a, interpolation='nearest', cmap='bone'... | [
"def",
"fun_8",
"(",
")",
":",
"# 用这样 3x3 的 2D-array 来表示点的颜色",
"a",
"=",
"numpy",
".",
"array",
"(",
"[",
"0.313660827978",
",",
"0.365348418405",
",",
"0.423733120134",
",",
"0.365348418405",
",",
"0.439599930621",
",",
"0.525083754405",
",",
"0.423733120134",
",... | https://github.com/gxcuizy/Python/blob/72167d12439a615a8fd4b935eae1fb6516ed4e69/从零学Python-掘金活动/day22/matplotlib_use.py#L163-L175 | ||
roam-qgis/Roam | 6bfa836a2735f611b7f26de18ae4a4581f7e83ef | src/configmanager/ui/layerwidgets.py | python | InfoNode.update_panel_status | (self, *args) | Update if the SQL panel is enabled or disable if the source is SQL Server or SQLite. | Update if the SQL panel is enabled or disable if the source is SQL Server or SQLite. | [
"Update",
"if",
"the",
"SQL",
"panel",
"is",
"enabled",
"or",
"disable",
"if",
"the",
"source",
"is",
"SQL",
"Server",
"or",
"SQLite",
"."
] | def update_panel_status(self, *args):
"""
Update if the SQL panel is enabled or disable if the source is SQL Server or SQLite.
"""
layer = self.layer
if not layer:
self.queryframe.setEnabled(False)
return False
source = layer.source()
nam... | [
"def",
"update_panel_status",
"(",
"self",
",",
"*",
"args",
")",
":",
"layer",
"=",
"self",
".",
"layer",
"if",
"not",
"layer",
":",
"self",
".",
"queryframe",
".",
"setEnabled",
"(",
"False",
")",
"return",
"False",
"source",
"=",
"layer",
".",
"sour... | https://github.com/roam-qgis/Roam/blob/6bfa836a2735f611b7f26de18ae4a4581f7e83ef/src/configmanager/ui/layerwidgets.py#L951-L982 | ||
fab-jul/imgcomp-cvpr | f03ce0bfa846f7ba1bf9b7ba415b082efe5c192c | code/inputpipeline.py | python | InputPipeline.get_batch | (self) | return self._batch | [] | def get_batch(self):
return self._batch | [
"def",
"get_batch",
"(",
"self",
")",
":",
"return",
"self",
".",
"_batch"
] | https://github.com/fab-jul/imgcomp-cvpr/blob/f03ce0bfa846f7ba1bf9b7ba415b082efe5c192c/code/inputpipeline.py#L168-L169 | |||
brainix/pottery | 0a57ef51949e13f10ffbe5a8b499ea9cb1909ffc | pottery/base.py | python | Primitive.key | (self) | return self.__key | [] | def key(self) -> str:
return self.__key | [
"def",
"key",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"__key"
] | https://github.com/brainix/pottery/blob/0a57ef51949e13f10ffbe5a8b499ea9cb1909ffc/pottery/base.py#L327-L328 | |||
robotlearn/pyrobolearn | 9cd7c060723fda7d2779fa255ac998c2c82b8436 | pyrobolearn/distributions/gmm.py | python | GMM.__mul__ | (self, other) | return self.multiply(other) | r"""
Multiply two GMMs, or a GMM by a Gaussian, matrix, or float. See the `multiply` method for more information.
Warnings: the multiplication of two GMMs performed here is NOT the one that multiply the components
element-wise. For this one, have a look at `multiply_element_wise` method, or... | r"""
Multiply two GMMs, or a GMM by a Gaussian, matrix, or float. See the `multiply` method for more information. | [
"r",
"Multiply",
"two",
"GMMs",
"or",
"a",
"GMM",
"by",
"a",
"Gaussian",
"matrix",
"or",
"float",
".",
"See",
"the",
"multiply",
"method",
"for",
"more",
"information",
"."
] | def __mul__(self, other):
r"""
Multiply two GMMs, or a GMM by a Gaussian, matrix, or float. See the `multiply` method for more information.
Warnings: the multiplication of two GMMs performed here is NOT the one that multiply the components
element-wise. For this one, have a look at ... | [
"def",
"__mul__",
"(",
"self",
",",
"other",
")",
":",
"return",
"self",
".",
"multiply",
"(",
"other",
")"
] | https://github.com/robotlearn/pyrobolearn/blob/9cd7c060723fda7d2779fa255ac998c2c82b8436/pyrobolearn/distributions/gmm.py#L1578-L1591 | |
autotest/autotest | 4614ae5f550cc888267b9a419e4b90deb54f8fae | client/harness.py | python | harness.run_complete | (self) | A run within this job is completing (all done) | A run within this job is completing (all done) | [
"A",
"run",
"within",
"this",
"job",
"is",
"completing",
"(",
"all",
"done",
")"
] | def run_complete(self):
"""A run within this job is completing (all done)"""
pass | [
"def",
"run_complete",
"(",
"self",
")",
":",
"pass"
] | https://github.com/autotest/autotest/blob/4614ae5f550cc888267b9a419e4b90deb54f8fae/client/harness.py#L64-L66 | ||
ClusterHQ/flocker | eaa586248986d7cd681c99c948546c2b507e44de | flocker/control/_model.py | python | DeploymentState.update_node | (self, node_state) | return self.transform(["nodes", updated_node.uuid], updated_node) | Create new ``DeploymentState`` based on this one which updates an
existing ``NodeState`` with any known information from the given
``NodeState``. Attributes which are set to ``None` on the given
update, indicating ignorance, will not be changed in the result.
The given ``NodeState`` wi... | Create new ``DeploymentState`` based on this one which updates an
existing ``NodeState`` with any known information from the given
``NodeState``. Attributes which are set to ``None` on the given
update, indicating ignorance, will not be changed in the result. | [
"Create",
"new",
"DeploymentState",
"based",
"on",
"this",
"one",
"which",
"updates",
"an",
"existing",
"NodeState",
"with",
"any",
"known",
"information",
"from",
"the",
"given",
"NodeState",
".",
"Attributes",
"which",
"are",
"set",
"to",
"None",
"on",
"the"... | def update_node(self, node_state):
"""
Create new ``DeploymentState`` based on this one which updates an
existing ``NodeState`` with any known information from the given
``NodeState``. Attributes which are set to ``None` on the given
update, indicating ignorance, will not be cha... | [
"def",
"update_node",
"(",
"self",
",",
"node_state",
")",
":",
"original_node",
"=",
"self",
".",
"nodes",
".",
"get",
"(",
"node_state",
".",
"uuid",
")",
"if",
"original_node",
"is",
"None",
":",
"return",
"self",
".",
"transform",
"(",
"[",
"\"nodes\... | https://github.com/ClusterHQ/flocker/blob/eaa586248986d7cd681c99c948546c2b507e44de/flocker/control/_model.py#L1168-L1192 | |
spectacles/CodeComplice | 8ca8ee4236f72b58caa4209d2fbd5fa56bd31d62 | libs/langinfo.py | python | LangInfo.__init__ | (self, db) | [] | def __init__(self, db):
self._db = db | [
"def",
"__init__",
"(",
"self",
",",
"db",
")",
":",
"self",
".",
"_db",
"=",
"db"
] | https://github.com/spectacles/CodeComplice/blob/8ca8ee4236f72b58caa4209d2fbd5fa56bd31d62/libs/langinfo.py#L177-L178 | ||||
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/full/tarfile.py | python | _LowLevelFile.read | (self, size) | return os.read(self.fd, size) | [] | def read(self, size):
return os.read(self.fd, size) | [
"def",
"read",
"(",
"self",
",",
"size",
")",
":",
"return",
"os",
".",
"read",
"(",
"self",
".",
"fd",
",",
"size",
")"
] | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/tarfile.py#L322-L323 | |||
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/django-1.5/django/contrib/gis/gdal/geomtype.py | python | OGRGeomType.__eq__ | (self, other) | Does an equivalence test on the OGR type with the given
other OGRGeomType, the short-hand string, or the integer. | Does an equivalence test on the OGR type with the given
other OGRGeomType, the short-hand string, or the integer. | [
"Does",
"an",
"equivalence",
"test",
"on",
"the",
"OGR",
"type",
"with",
"the",
"given",
"other",
"OGRGeomType",
"the",
"short",
"-",
"hand",
"string",
"or",
"the",
"integer",
"."
] | def __eq__(self, other):
"""
Does an equivalence test on the OGR type with the given
other OGRGeomType, the short-hand string, or the integer.
"""
if isinstance(other, OGRGeomType):
return self.num == other.num
elif isinstance(other, six.string_types):
... | [
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"OGRGeomType",
")",
":",
"return",
"self",
".",
"num",
"==",
"other",
".",
"num",
"elif",
"isinstance",
"(",
"other",
",",
"six",
".",
"string_types",
")",
"... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.5/django/contrib/gis/gdal/geomtype.py#L57-L69 | ||
deanishe/alfred-fakeum | 12a7e64d9c099c0f11416ee99fae064d6360aab2 | src/libs/faker/providers/address/ja_JP/__init__.py | python | Provider.town | (self) | return self.random_element(self.towns) | :example '浅草' | :example '浅草' | [
":",
"example",
"浅草"
] | def town(self):
"""
:example '浅草'
"""
return self.random_element(self.towns) | [
"def",
"town",
"(",
"self",
")",
":",
"return",
"self",
".",
"random_element",
"(",
"self",
".",
"towns",
")"
] | https://github.com/deanishe/alfred-fakeum/blob/12a7e64d9c099c0f11416ee99fae064d6360aab2/src/libs/faker/providers/address/ja_JP/__init__.py#L320-L324 | |
chromium/web-page-replay | 472351e1122bb1beb936952c7e75ae58bf8a69f1 | third_party/dns/message.py | python | Message.want_dnssec | (self, wanted=True) | Enable or disable 'DNSSEC desired' flag in requests.
@param wanted: Is DNSSEC desired? If True, EDNS is enabled if
required, and then the DO bit is set. If False, the DO bit is
cleared if EDNS is enabled.
@type wanted: bool | Enable or disable 'DNSSEC desired' flag in requests. | [
"Enable",
"or",
"disable",
"DNSSEC",
"desired",
"flag",
"in",
"requests",
"."
] | def want_dnssec(self, wanted=True):
"""Enable or disable 'DNSSEC desired' flag in requests.
@param wanted: Is DNSSEC desired? If True, EDNS is enabled if
required, and then the DO bit is set. If False, the DO bit is
cleared if EDNS is enabled.
@type wanted: bool
"""
... | [
"def",
"want_dnssec",
"(",
"self",
",",
"wanted",
"=",
"True",
")",
":",
"if",
"wanted",
":",
"if",
"self",
".",
"edns",
"<",
"0",
":",
"self",
".",
"use_edns",
"(",
")",
"self",
".",
"ednsflags",
"|=",
"dns",
".",
"flags",
".",
"DO",
"elif",
"se... | https://github.com/chromium/web-page-replay/blob/472351e1122bb1beb936952c7e75ae58bf8a69f1/third_party/dns/message.py#L507-L519 | ||
JetBrains/python-skeletons | 95ad24b666e475998e5d1cc02ed53a2188036167 | numpy/core/__init__.py | python | generic.trace | (self, *args, **kwargs) | Not implemented (virtual attribute)
Class generic exists solely to derive numpy scalars from, and possesses,
albeit unimplemented, all the attributes of the ndarray class
so as to provide a uniform API.
See Also
--------
The corresponding attribu... | Not implemented (virtual attribute) | [
"Not",
"implemented",
"(",
"virtual",
"attribute",
")"
] | def trace(self, *args, **kwargs): # real signature unknown
"""
Not implemented (virtual attribute)
Class generic exists solely to derive numpy scalars from, and possesses,
albeit unimplemented, all the attributes of the ndarray class
so as to provide a uniform API.
... | [
"def",
"trace",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# real signature unknown",
"pass"
] | https://github.com/JetBrains/python-skeletons/blob/95ad24b666e475998e5d1cc02ed53a2188036167/numpy/core/__init__.py#L702-L714 | ||
sabnzbd/sabnzbd | 52d21e94d3cc6e30764a833fe2a256783d1a8931 | sabnzbd/scheduler.py | python | enable_server | (server) | Enable server (scheduler only) | Enable server (scheduler only) | [
"Enable",
"server",
"(",
"scheduler",
"only",
")"
] | def enable_server(server):
"""Enable server (scheduler only)"""
try:
config.get_config("servers", server).enable.set(1)
except:
logging.warning(T("Trying to set status of non-existing server %s"), server)
return
config.save_config()
sabnzbd.Downloader.update_server(server, se... | [
"def",
"enable_server",
"(",
"server",
")",
":",
"try",
":",
"config",
".",
"get_config",
"(",
"\"servers\"",
",",
"server",
")",
".",
"enable",
".",
"set",
"(",
"1",
")",
"except",
":",
"logging",
".",
"warning",
"(",
"T",
"(",
"\"Trying to set status o... | https://github.com/sabnzbd/sabnzbd/blob/52d21e94d3cc6e30764a833fe2a256783d1a8931/sabnzbd/scheduler.py#L488-L496 | ||
adobe/antialiased-cnns | b27a34a26f3ab039113d44d83c54d0428598ac9c | antialiased_cnns/resnet.py | python | conv3x3 | (in_planes, out_planes, stride=1, groups=1, dilation=1) | return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride,
padding=dilation, groups=groups, bias=False, dilation=dilation) | 3x3 convolution with padding | 3x3 convolution with padding | [
"3x3",
"convolution",
"with",
"padding"
] | def conv3x3(in_planes, out_planes, stride=1, groups=1, dilation=1):
"""3x3 convolution with padding"""
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride,
padding=dilation, groups=groups, bias=False, dilation=dilation) | [
"def",
"conv3x3",
"(",
"in_planes",
",",
"out_planes",
",",
"stride",
"=",
"1",
",",
"groups",
"=",
"1",
",",
"dilation",
"=",
"1",
")",
":",
"return",
"nn",
".",
"Conv2d",
"(",
"in_planes",
",",
"out_planes",
",",
"kernel_size",
"=",
"3",
",",
"stri... | https://github.com/adobe/antialiased-cnns/blob/b27a34a26f3ab039113d44d83c54d0428598ac9c/antialiased_cnns/resnet.py#L77-L80 | |
mesonbuild/meson | a22d0f9a0a787df70ce79b05d0c45de90a970048 | mesonbuild/compilers/mixins/clike.py | python | CLikeCompiler.compiler_args | (self, args: T.Optional[T.Iterable[str]] = None) | return CLikeCompilerArgs(self, args) | [] | def compiler_args(self, args: T.Optional[T.Iterable[str]] = None) -> CLikeCompilerArgs:
# This is correct, mypy just doesn't understand co-operative inheritance
return CLikeCompilerArgs(self, args) | [
"def",
"compiler_args",
"(",
"self",
",",
"args",
":",
"T",
".",
"Optional",
"[",
"T",
".",
"Iterable",
"[",
"str",
"]",
"]",
"=",
"None",
")",
"->",
"CLikeCompilerArgs",
":",
"# This is correct, mypy just doesn't understand co-operative inheritance",
"return",
"C... | https://github.com/mesonbuild/meson/blob/a22d0f9a0a787df70ce79b05d0c45de90a970048/mesonbuild/compilers/mixins/clike.py#L148-L150 | |||
stepjam/PyRep | d778d5d4ffa3be366d4e699f6e2941553fd47ecc | pyrep/objects/shape.py | python | Shape.add_force_and_torque | (self, force: np.ndarray, torque: np.ndarray,
reset_force: bool = False,
reset_torque: bool = False) | Adds a force and/or torque to a shape object that is dynamically
enabled. Forces are applied at the center of mass.
Added forces and torques are cumulative.
:param force: The force (in absolute coordinates) to add.
:param torque: The torque (in absolute coordinates) to add.
:par... | Adds a force and/or torque to a shape object that is dynamically
enabled. Forces are applied at the center of mass.
Added forces and torques are cumulative. | [
"Adds",
"a",
"force",
"and",
"/",
"or",
"torque",
"to",
"a",
"shape",
"object",
"that",
"is",
"dynamically",
"enabled",
".",
"Forces",
"are",
"applied",
"at",
"the",
"center",
"of",
"mass",
".",
"Added",
"forces",
"and",
"torques",
"are",
"cumulative",
"... | def add_force_and_torque(self, force: np.ndarray, torque: np.ndarray,
reset_force: bool = False,
reset_torque: bool = False) -> None:
"""
Adds a force and/or torque to a shape object that is dynamically
enabled. Forces are applied at the ... | [
"def",
"add_force_and_torque",
"(",
"self",
",",
"force",
":",
"np",
".",
"ndarray",
",",
"torque",
":",
"np",
".",
"ndarray",
",",
"reset_force",
":",
"bool",
"=",
"False",
",",
"reset_torque",
":",
"bool",
"=",
"False",
")",
"->",
"None",
":",
"h",
... | https://github.com/stepjam/PyRep/blob/d778d5d4ffa3be366d4e699f6e2941553fd47ecc/pyrep/objects/shape.py#L561-L581 | ||
Azure/azure-linux-extensions | a42ef718c746abab2b3c6a21da87b29e76364558 | Common/libpsutil/py2.6-glibc-2.12-pre/psutil/_pswindows.py | python | net_connections | (kind, _pid=-1) | return ret | Return socket connections. If pid == -1 return system-wide
connections (as opposed to connections opened by one process only). | Return socket connections. If pid == -1 return system-wide
connections (as opposed to connections opened by one process only). | [
"Return",
"socket",
"connections",
".",
"If",
"pid",
"==",
"-",
"1",
"return",
"system",
"-",
"wide",
"connections",
"(",
"as",
"opposed",
"to",
"connections",
"opened",
"by",
"one",
"process",
"only",
")",
"."
] | def net_connections(kind, _pid=-1):
"""Return socket connections. If pid == -1 return system-wide
connections (as opposed to connections opened by one process only).
"""
if kind not in conn_tmap:
raise ValueError("invalid %r kind argument; choose between %s"
% (kind, ',... | [
"def",
"net_connections",
"(",
"kind",
",",
"_pid",
"=",
"-",
"1",
")",
":",
"if",
"kind",
"not",
"in",
"conn_tmap",
":",
"raise",
"ValueError",
"(",
"\"invalid %r kind argument; choose between %s\"",
"%",
"(",
"kind",
",",
"', '",
".",
"join",
"(",
"[",
"... | https://github.com/Azure/azure-linux-extensions/blob/a42ef718c746abab2b3c6a21da87b29e76364558/Common/libpsutil/py2.6-glibc-2.12-pre/psutil/_pswindows.py#L161-L179 | |
limodou/ulipad | 4c7d590234f39cac80bb1d36dca095b646e287fb | mixins/ShellWindow.py | python | NEInterpreter.push | (self, command) | return more | Send command to the interpreter to be executed.
Because this may be called recursively, we append a new list
onto the commandBuffer list and then append commands into
that. If the passed in command is part of a multi-line
command we keep appending the pieces to the last list in
... | Send command to the interpreter to be executed. | [
"Send",
"command",
"to",
"the",
"interpreter",
"to",
"be",
"executed",
"."
] | def push(self, command):
"""Send command to the interpreter to be executed.
Because this may be called recursively, we append a new list
onto the commandBuffer list and then append commands into
that. If the passed in command is part of a multi-line
command we keep appending th... | [
"def",
"push",
"(",
"self",
",",
"command",
")",
":",
"if",
"isinstance",
"(",
"command",
",",
"types",
".",
"UnicodeType",
")",
":",
"command",
"=",
"command",
".",
"encode",
"(",
"common",
".",
"defaultencoding",
")",
"if",
"not",
"self",
".",
"more"... | https://github.com/limodou/ulipad/blob/4c7d590234f39cac80bb1d36dca095b646e287fb/mixins/ShellWindow.py#L232-L253 | |
ctxis/canape | 5f0e03424577296bcc60c2008a60a98ec5307e4b | CANAPE.Scripting/Lib/logging/__init__.py | python | Manager.setLoggerClass | (self, klass) | Set the class to be used when instantiating a logger with this Manager. | Set the class to be used when instantiating a logger with this Manager. | [
"Set",
"the",
"class",
"to",
"be",
"used",
"when",
"instantiating",
"a",
"logger",
"with",
"this",
"Manager",
"."
] | def setLoggerClass(self, klass):
"""
Set the class to be used when instantiating a logger with this Manager.
"""
if klass != Logger:
if not issubclass(klass, Logger):
raise TypeError("logger not derived from logging.Logger: "
+ ... | [
"def",
"setLoggerClass",
"(",
"self",
",",
"klass",
")",
":",
"if",
"klass",
"!=",
"Logger",
":",
"if",
"not",
"issubclass",
"(",
"klass",
",",
"Logger",
")",
":",
"raise",
"TypeError",
"(",
"\"logger not derived from logging.Logger: \"",
"+",
"klass",
".",
... | https://github.com/ctxis/canape/blob/5f0e03424577296bcc60c2008a60a98ec5307e4b/CANAPE.Scripting/Lib/logging/__init__.py#L1026-L1034 | ||
knipknap/exscript | a20e83ae3a78ea7e5ba25f07c1d9de4e9b961e83 | Exscript/protocols/telnetlib.py | python | Telnet.read_lazy | (self) | return self.read_very_lazy() | Process and return data that's already in the queues (lazy).
Raise EOFError if connection closed and no data available.
Return '' if no cooked data available otherwise. Don't block
unless in the midst of an IAC sequence. | Process and return data that's already in the queues (lazy). | [
"Process",
"and",
"return",
"data",
"that",
"s",
"already",
"in",
"the",
"queues",
"(",
"lazy",
")",
"."
] | def read_lazy(self):
"""Process and return data that's already in the queues (lazy).
Raise EOFError if connection closed and no data available.
Return '' if no cooked data available otherwise. Don't block
unless in the midst of an IAC sequence.
"""
self.process_rawq()
... | [
"def",
"read_lazy",
"(",
"self",
")",
":",
"self",
".",
"process_rawq",
"(",
")",
"return",
"self",
".",
"read_very_lazy",
"(",
")"
] | https://github.com/knipknap/exscript/blob/a20e83ae3a78ea7e5ba25f07c1d9de4e9b961e83/Exscript/protocols/telnetlib.py#L368-L377 | |
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/benchmarks/src/benchmarks/sympy/sympy/geometry/line.py | python | LinearEntity.is_similar | (self, other) | return _norm(*self.coefficients) == _norm(*other.coefficients) | Return True if self and other are contained in the same line.
Examples
========
>>> from sympy import Point, Line
>>> p1, p2, p3 = Point(0, 1), Point(3, 4), Point(2, 3)
>>> l1 = Line(p1, p2)
>>> l2 = Line(p1, p3)
>>> l1.is_similar(l2)
True | Return True if self and other are contained in the same line. | [
"Return",
"True",
"if",
"self",
"and",
"other",
"are",
"contained",
"in",
"the",
"same",
"line",
"."
] | def is_similar(self, other):
"""
Return True if self and other are contained in the same line.
Examples
========
>>> from sympy import Point, Line
>>> p1, p2, p3 = Point(0, 1), Point(3, 4), Point(2, 3)
>>> l1 = Line(p1, p2)
>>> l2 = Line(p1, p3)
... | [
"def",
"is_similar",
"(",
"self",
",",
"other",
")",
":",
"def",
"_norm",
"(",
"a",
",",
"b",
",",
"c",
")",
":",
"if",
"a",
"!=",
"0",
":",
"return",
"1",
",",
"b",
"/",
"a",
",",
"c",
"/",
"a",
"elif",
"b",
"!=",
"0",
":",
"return",
"a"... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/geometry/line.py#L905-L926 | |
BigBrotherBot/big-brother-bot | 848823c71413c86e7f1ff9584f43e08d40a7f2c0 | b3/plugins/customcommands/__init__.py | python | CustomcommandsPlugin._validate_cmd_template | (self, template) | Makes sure a command template is correct.
Raise ValueError if invalid. | Makes sure a command template is correct.
Raise ValueError if invalid. | [
"Makes",
"sure",
"a",
"command",
"template",
"is",
"correct",
".",
"Raise",
"ValueError",
"if",
"invalid",
"."
] | def _validate_cmd_template(self, template):
"""
Makes sure a command template is correct.
Raise ValueError if invalid.
"""
assert template is not None
if template.strip() == '':
raise ValueError("command template cannot be blank")
if template.count("<A... | [
"def",
"_validate_cmd_template",
"(",
"self",
",",
"template",
")",
":",
"assert",
"template",
"is",
"not",
"None",
"if",
"template",
".",
"strip",
"(",
")",
"==",
"''",
":",
"raise",
"ValueError",
"(",
"\"command template cannot be blank\"",
")",
"if",
"templ... | https://github.com/BigBrotherBot/big-brother-bot/blob/848823c71413c86e7f1ff9584f43e08d40a7f2c0/b3/plugins/customcommands/__init__.py#L145-L154 | ||
ramusus/kinopoiskpy | e49b41eff7ae4252987636ec14c060109a50fad6 | kinopoisk/utils.py | python | Manager.get_url_with_params | (self, query) | return 'http://www.kinopoisk.ru/index.php', {'kp_query': query} | [] | def get_url_with_params(self, query):
return 'http://www.kinopoisk.ru/index.php', {'kp_query': query} | [
"def",
"get_url_with_params",
"(",
"self",
",",
"query",
")",
":",
"return",
"'http://www.kinopoisk.ru/index.php'",
",",
"{",
"'kp_query'",
":",
"query",
"}"
] | https://github.com/ramusus/kinopoiskpy/blob/e49b41eff7ae4252987636ec14c060109a50fad6/kinopoisk/utils.py#L52-L53 | |||
google/vimdoc | 58b7b8b0c0d153ca3f689928f64c20953c14ded0 | vimdoc/output.py | python | Helpfile.Print | (self, line, end='\n', wide=False) | Outputs a line to the file. | Outputs a line to the file. | [
"Outputs",
"a",
"line",
"to",
"the",
"file",
"."
] | def Print(self, line, end='\n', wide=False):
"""Outputs a line to the file."""
if not wide:
assert len(line) <= self.WIDTH
if self.file is None:
raise ValueError('Helpfile writer not yet given helpfile to write.')
self.file.write(line + end) | [
"def",
"Print",
"(",
"self",
",",
"line",
",",
"end",
"=",
"'\\n'",
",",
"wide",
"=",
"False",
")",
":",
"if",
"not",
"wide",
":",
"assert",
"len",
"(",
"line",
")",
"<=",
"self",
".",
"WIDTH",
"if",
"self",
".",
"file",
"is",
"None",
":",
"rai... | https://github.com/google/vimdoc/blob/58b7b8b0c0d153ca3f689928f64c20953c14ded0/vimdoc/output.py#L192-L198 | ||
learningequality/kolibri | d056dbc477aaf651ab843caa141a6a1e0a491046 | kolibri/utils/server.py | python | get_status | () | return pid, LISTEN_ADDRESS, listen_port | Tries to get the PID of a running server.
The behavior is also quite redundant given that `kolibri start` should
always create a PID file, and if its been started directly with the
runserver command, then its up to the developer to know what's happening.
:returns: (PID, address, port), where address i... | Tries to get the PID of a running server. | [
"Tries",
"to",
"get",
"the",
"PID",
"of",
"a",
"running",
"server",
"."
] | def get_status(): # noqa: max-complexity=16
"""
Tries to get the PID of a running server.
The behavior is also quite redundant given that `kolibri start` should
always create a PID file, and if its been started directly with the
runserver command, then its up to the developer to know what's happen... | [
"def",
"get_status",
"(",
")",
":",
"# noqa: max-complexity=16",
"# PID file exists and startup has finished, check if it is running",
"pid",
",",
"port",
",",
"_",
",",
"status",
"=",
"_read_pid_file",
"(",
"PID_FILE",
")",
"if",
"status",
"not",
"in",
"IS_RUNNING",
... | https://github.com/learningequality/kolibri/blob/d056dbc477aaf651ab843caa141a6a1e0a491046/kolibri/utils/server.py#L817-L894 | |
pymedusa/Medusa | 1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38 | medusa/tv/series.py | python | SeriesIdentifier.from_id | (cls, indexer, indexer_id) | return SeriesIdentifier(indexer, indexer_id) | Create SeriesIdentifier from tuple (indexer, indexer_id). | Create SeriesIdentifier from tuple (indexer, indexer_id). | [
"Create",
"SeriesIdentifier",
"from",
"tuple",
"(",
"indexer",
"indexer_id",
")",
"."
] | def from_id(cls, indexer, indexer_id):
"""Create SeriesIdentifier from tuple (indexer, indexer_id)."""
return SeriesIdentifier(indexer, indexer_id) | [
"def",
"from_id",
"(",
"cls",
",",
"indexer",
",",
"indexer_id",
")",
":",
"return",
"SeriesIdentifier",
"(",
"indexer",
",",
"indexer_id",
")"
] | https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/medusa/tv/series.py#L158-L160 | |
biolab/orange3 | 41685e1c7b1d1babe680113685a2d44bcc9fec0b | Orange/widgets/visualize/owviolinplot.py | python | BoxItem._create_box_plot | (data: np.ndarray) | return min_, q25, q75, max_ | [] | def _create_box_plot(data: np.ndarray) -> Tuple:
if data.size == 0:
return (0,) * 4
q25, q75 = np.percentile(data, [25, 75])
whisker_lim = 1.5 * stats.iqr(data)
min_ = np.min(data[data >= (q25 - whisker_lim)])
max_ = np.max(data[data <= (q75 + whisker_lim)])
... | [
"def",
"_create_box_plot",
"(",
"data",
":",
"np",
".",
"ndarray",
")",
"->",
"Tuple",
":",
"if",
"data",
".",
"size",
"==",
"0",
":",
"return",
"(",
"0",
",",
")",
"*",
"4",
"q25",
",",
"q75",
"=",
"np",
".",
"percentile",
"(",
"data",
",",
"[... | https://github.com/biolab/orange3/blob/41685e1c7b1d1babe680113685a2d44bcc9fec0b/Orange/widgets/visualize/owviolinplot.py#L284-L292 | |||
peterbrittain/asciimatics | 9a490faddf484ee5b9b845316f921f5888b23b18 | samples/terminal.py | python | Terminal._add_stream | (self, value) | Process any output from the TTY. | Process any output from the TTY. | [
"Process",
"any",
"output",
"from",
"the",
"TTY",
"."
] | def _add_stream(self, value):
"""
Process any output from the TTY.
"""
lines = value.split("\n")
for i, line in enumerate(lines):
self._parser.reset(line, self._current_colours)
for offset, command, params in self._parser.parse():
if comman... | [
"def",
"_add_stream",
"(",
"self",
",",
"value",
")",
":",
"lines",
"=",
"value",
".",
"split",
"(",
"\"\\n\"",
")",
"for",
"i",
",",
"line",
"in",
"enumerate",
"(",
"lines",
")",
":",
"self",
".",
"_parser",
".",
"reset",
"(",
"line",
",",
"self",... | https://github.com/peterbrittain/asciimatics/blob/9a490faddf484ee5b9b845316f921f5888b23b18/samples/terminal.py#L114-L186 | ||
spacetx/starfish | 0e879d995d5c49b6f5a842e201e3be04c91afc7e | starfish/core/spots/AssignTargets/_base.py | python | AssignTargetsAlgorithm.run | (
self,
masks: BinaryMaskCollection,
decoded_intensity_table: DecodedIntensityTable,
verbose: bool = False,
in_place: bool = False,
) | Performs target (e.g. gene) assignment given the spots and the regions. | Performs target (e.g. gene) assignment given the spots and the regions. | [
"Performs",
"target",
"(",
"e",
".",
"g",
".",
"gene",
")",
"assignment",
"given",
"the",
"spots",
"and",
"the",
"regions",
"."
] | def run(
self,
masks: BinaryMaskCollection,
decoded_intensity_table: DecodedIntensityTable,
verbose: bool = False,
in_place: bool = False,
) -> DecodedIntensityTable:
"""Performs target (e.g. gene) assignment given the spots and the regions."""
... | [
"def",
"run",
"(",
"self",
",",
"masks",
":",
"BinaryMaskCollection",
",",
"decoded_intensity_table",
":",
"DecodedIntensityTable",
",",
"verbose",
":",
"bool",
"=",
"False",
",",
"in_place",
":",
"bool",
"=",
"False",
",",
")",
"->",
"DecodedIntensityTable",
... | https://github.com/spacetx/starfish/blob/0e879d995d5c49b6f5a842e201e3be04c91afc7e/starfish/core/spots/AssignTargets/_base.py#L15-L23 | ||
ym2011/ScanBackdoor | 3a10de49c3ebd90c2f0eb62304877e00d2a52396 | scan.py | python | Version | () | [] | def Version():
print 'scan 0.02 BASE' | [
"def",
"Version",
"(",
")",
":",
"print",
"'scan 0.02 BASE'"
] | https://github.com/ym2011/ScanBackdoor/blob/3a10de49c3ebd90c2f0eb62304877e00d2a52396/scan.py#L19-L20 | ||||
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/graph_objs/barpolar/marker/colorbar/_title.py | python | Title.side | (self) | return self["side"] | Determines the location of color bar's title with respect to
the color bar. Defaults to "top" when `orientation` if "v" and
defaults to "right" when `orientation` if "h". Note that the
title's location used to be set by the now deprecated
`titleside` attribute.
The 'side' pr... | Determines the location of color bar's title with respect to
the color bar. Defaults to "top" when `orientation` if "v" and
defaults to "right" when `orientation` if "h". Note that the
title's location used to be set by the now deprecated
`titleside` attribute.
The 'side' pr... | [
"Determines",
"the",
"location",
"of",
"color",
"bar",
"s",
"title",
"with",
"respect",
"to",
"the",
"color",
"bar",
".",
"Defaults",
"to",
"top",
"when",
"orientation",
"if",
"v",
"and",
"defaults",
"to",
"right",
"when",
"orientation",
"if",
"h",
".",
... | def side(self):
"""
Determines the location of color bar's title with respect to
the color bar. Defaults to "top" when `orientation` if "v" and
defaults to "right" when `orientation` if "h". Note that the
title's location used to be set by the now deprecated
`titleside` a... | [
"def",
"side",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"side\"",
"]"
] | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/barpolar/marker/colorbar/_title.py#L63-L79 | |
maas/maas | db2f89970c640758a51247c59bf1ec6f60cf4ab5 | src/provisioningserver/utils/network.py | python | IPRangeStatistics.available_percentage | (self) | return float(self.num_available) / float(self.total_addresses) | Returns the utilization percentage for this set of addresses.
:return:float | Returns the utilization percentage for this set of addresses.
:return:float | [
"Returns",
"the",
"utilization",
"percentage",
"for",
"this",
"set",
"of",
"addresses",
".",
":",
"return",
":",
"float"
] | def available_percentage(self):
"""Returns the utilization percentage for this set of addresses.
:return:float"""
return float(self.num_available) / float(self.total_addresses) | [
"def",
"available_percentage",
"(",
"self",
")",
":",
"return",
"float",
"(",
"self",
".",
"num_available",
")",
"/",
"float",
"(",
"self",
".",
"total_addresses",
")"
] | https://github.com/maas/maas/blob/db2f89970c640758a51247c59bf1ec6f60cf4ab5/src/provisioningserver/utils/network.py#L332-L335 | |
wucng/TensorExpand | 4ea58f64f5c5082b278229b799c9f679536510b7 | TensorExpand/Object detection/faster rcnn/CharlesShang-TFFRCNN-master/lib/datasets/nthu.py | python | nthu.image_path_at | (self, i) | return self.image_path_from_index(self.image_index[i]) | Return the absolute path to image i in the image sequence. | Return the absolute path to image i in the image sequence. | [
"Return",
"the",
"absolute",
"path",
"to",
"image",
"i",
"in",
"the",
"image",
"sequence",
"."
] | def image_path_at(self, i):
"""
Return the absolute path to image i in the image sequence.
"""
return self.image_path_from_index(self.image_index[i]) | [
"def",
"image_path_at",
"(",
"self",
",",
"i",
")",
":",
"return",
"self",
".",
"image_path_from_index",
"(",
"self",
".",
"image_index",
"[",
"i",
"]",
")"
] | https://github.com/wucng/TensorExpand/blob/4ea58f64f5c5082b278229b799c9f679536510b7/TensorExpand/Object detection/faster rcnn/CharlesShang-TFFRCNN-master/lib/datasets/nthu.py#L62-L66 | |
ceph/ceph-deploy | a16316fc4dd364135b11226df42d9df65c0c60a2 | ceph_deploy/mon.py | python | get_mon_initial_members | (args, error_on_empty=False, _cfg=None) | return mon_initial_members | Read the Ceph config file and return the value of mon_initial_members
Optionally, a NeedHostError can be raised if the value is None. | Read the Ceph config file and return the value of mon_initial_members
Optionally, a NeedHostError can be raised if the value is None. | [
"Read",
"the",
"Ceph",
"config",
"file",
"and",
"return",
"the",
"value",
"of",
"mon_initial_members",
"Optionally",
"a",
"NeedHostError",
"can",
"be",
"raised",
"if",
"the",
"value",
"is",
"None",
"."
] | def get_mon_initial_members(args, error_on_empty=False, _cfg=None):
"""
Read the Ceph config file and return the value of mon_initial_members
Optionally, a NeedHostError can be raised if the value is None.
"""
if _cfg:
cfg = _cfg
else:
cfg = conf.ceph.load(args)
mon_initial_m... | [
"def",
"get_mon_initial_members",
"(",
"args",
",",
"error_on_empty",
"=",
"False",
",",
"_cfg",
"=",
"None",
")",
":",
"if",
"_cfg",
":",
"cfg",
"=",
"_cfg",
"else",
":",
"cfg",
"=",
"conf",
".",
"ceph",
".",
"load",
"(",
"args",
")",
"mon_initial_mem... | https://github.com/ceph/ceph-deploy/blob/a16316fc4dd364135b11226df42d9df65c0c60a2/ceph_deploy/mon.py#L552-L569 | |
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/lib-python/3/modulefinder.py | python | ModuleFinder.replace_paths_in_code | (self, co) | return types.CodeType(co.co_argcount, co.co_nlocals, co.co_stacksize,
co.co_flags, co.co_code, tuple(consts), co.co_names,
co.co_varnames, new_filename, co.co_name,
co.co_firstlineno, co.co_lnotab,
co.co_freevars, co.co_... | [] | 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/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/modulefinder.py#L574-L599 | |||
CheckPointSW/Karta | b845928487b50a5b41acd532ae0399177a4356aa | src/thumbs_up/utils/switch_table.py | python | SwitchIdentifier.isSwitchCase | (self, ea) | return ea in self._switch_case_cases | Check if the given address is the beginning of a seen switch case.
Args:
ea (int): effective address to be checked
Return Value:
True iff the given address matches the beginning of a seen switch case | Check if the given address is the beginning of a seen switch case. | [
"Check",
"if",
"the",
"given",
"address",
"is",
"the",
"beginning",
"of",
"a",
"seen",
"switch",
"case",
"."
] | def isSwitchCase(self, ea):
"""Check if the given address is the beginning of a seen switch case.
Args:
ea (int): effective address to be checked
Return Value:
True iff the given address matches the beginning of a seen switch case
"""
return ea in self._... | [
"def",
"isSwitchCase",
"(",
"self",
",",
"ea",
")",
":",
"return",
"ea",
"in",
"self",
".",
"_switch_case_cases"
] | https://github.com/CheckPointSW/Karta/blob/b845928487b50a5b41acd532ae0399177a4356aa/src/thumbs_up/utils/switch_table.py#L123-L132 | |
sony/nnabla-examples | 068be490aacf73740502a1c3b10f8b2d15a52d32 | language-modeling/BERT-finetuning/external/processors.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/sony/nnabla-examples/blob/068be490aacf73740502a1c3b10f8b2d15a52d32/language-modeling/BERT-finetuning/external/processors.py#L184-L186 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.