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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/graph_objs/layout/scene/annotation/_hoverlabel.py | python | Hoverlabel.bgcolor | (self) | return self["bgcolor"] | Sets the background color of the hover label. By default uses
the annotation's `bgcolor` made opaque, or white if it was
transparent.
The 'bgcolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
... | Sets the background color of the hover label. By default uses
the annotation's `bgcolor` made opaque, or white if it was
transparent.
The 'bgcolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
... | [
"Sets",
"the",
"background",
"color",
"of",
"the",
"hover",
"label",
".",
"By",
"default",
"uses",
"the",
"annotation",
"s",
"bgcolor",
"made",
"opaque",
"or",
"white",
"if",
"it",
"was",
"transparent",
".",
"The",
"bgcolor",
"property",
"is",
"a",
"color"... | def bgcolor(self):
"""
Sets the background color of the hover label. By default uses
the annotation's `bgcolor` made opaque, or white if it was
transparent.
The 'bgcolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rg... | [
"def",
"bgcolor",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"bgcolor\"",
"]"
] | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/layout/scene/annotation/_hoverlabel.py#L16-L68 | |
pwnieexpress/pwn_plug_sources | 1a23324f5dc2c3de20f9c810269b6a29b2758cad | src/voiper/sulley/impacket/dcerpc/dcerpc.py | python | MSRPCBindNak.get_frag_len | (self) | return self.get_word(8, '<') | [] | def get_frag_len(self):
return self.get_word(8, '<') | [
"def",
"get_frag_len",
"(",
"self",
")",
":",
"return",
"self",
".",
"get_word",
"(",
"8",
",",
"'<'",
")"
] | https://github.com/pwnieexpress/pwn_plug_sources/blob/1a23324f5dc2c3de20f9c810269b6a29b2758cad/src/voiper/sulley/impacket/dcerpc/dcerpc.py#L586-L587 | |||
DetectionTeamUCAS/R2CNN_Faster-RCNN_Tensorflow | 0bcc4209defefebd7b3644c6f4a0dcaaa6170c3f | tools/camera_demo.py | python | parse_args | () | return args | Parse input arguments | Parse input arguments | [
"Parse",
"input",
"arguments"
] | def parse_args():
"""
Parse input arguments
"""
parser = argparse.ArgumentParser(description='Train a R2CNN network')
parser.add_argument('--gpu', dest='gpu',
help='gpu',
default='0', type=str)
if len(sys.argv) == 1:
parser.print_help()
... | [
"def",
"parse_args",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"'Train a R2CNN network'",
")",
"parser",
".",
"add_argument",
"(",
"'--gpu'",
",",
"dest",
"=",
"'gpu'",
",",
"help",
"=",
"'gpu'",
",",
"default"... | https://github.com/DetectionTeamUCAS/R2CNN_Faster-RCNN_Tensorflow/blob/0bcc4209defefebd7b3644c6f4a0dcaaa6170c3f/tools/camera_demo.py#L112-L126 | |
zqfang/GSEApy | 763dd2e222eee9483fd71d58a1aadcaec98c29b8 | gseapy/algorithm.py | python | enrichment_score_tensor | (gene_mat, cor_mat, gene_sets, weighted_score_type, nperm=1000,
seed=None, single=False, scale=False) | return es, esnull, hit_ind, RES | Next generation algorithm of GSEA and ssGSEA. Works for 3d array
:param gene_mat: the ordered gene list(vector) with or without gene indices matrix.
:param cor_mat: correlation vector or matrix (e.g. signal to noise scores)
corresponding to the genes in t... | Next generation algorithm of GSEA and ssGSEA. Works for 3d array | [
"Next",
"generation",
"algorithm",
"of",
"GSEA",
"and",
"ssGSEA",
".",
"Works",
"for",
"3d",
"array"
] | def enrichment_score_tensor(gene_mat, cor_mat, gene_sets, weighted_score_type, nperm=1000,
seed=None, single=False, scale=False):
"""Next generation algorithm of GSEA and ssGSEA. Works for 3d array
:param gene_mat: the ordered gene list(vector) with or without gene indice... | [
"def",
"enrichment_score_tensor",
"(",
"gene_mat",
",",
"cor_mat",
",",
"gene_sets",
",",
"weighted_score_type",
",",
"nperm",
"=",
"1000",
",",
"seed",
"=",
"None",
",",
"single",
"=",
"False",
",",
"scale",
"=",
"False",
")",
":",
"rs",
"=",
"np",
".",... | https://github.com/zqfang/GSEApy/blob/763dd2e222eee9483fd71d58a1aadcaec98c29b8/gseapy/algorithm.py#L89-L189 | |
rixwew/pytorch-fm | f74ad19771eda104e99874d19dc892e988ec53fa | torchfm/layer.py | python | CompressedInteractionNetwork.forward | (self, x) | return self.fc(torch.sum(torch.cat(xs, dim=1), 2)) | :param x: Float tensor of size ``(batch_size, num_fields, embed_dim)`` | :param x: Float tensor of size ``(batch_size, num_fields, embed_dim)`` | [
":",
"param",
"x",
":",
"Float",
"tensor",
"of",
"size",
"(",
"batch_size",
"num_fields",
"embed_dim",
")"
] | def forward(self, x):
"""
:param x: Float tensor of size ``(batch_size, num_fields, embed_dim)``
"""
xs = list()
x0, h = x.unsqueeze(2), x
for i in range(self.num_layers):
x = x0 * h.unsqueeze(1)
batch_size, f0_dim, fin_dim, embed_dim = x.shape
... | [
"def",
"forward",
"(",
"self",
",",
"x",
")",
":",
"xs",
"=",
"list",
"(",
")",
"x0",
",",
"h",
"=",
"x",
".",
"unsqueeze",
"(",
"2",
")",
",",
"x",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"num_layers",
")",
":",
"x",
"=",
"x0",
"*",
... | https://github.com/rixwew/pytorch-fm/blob/f74ad19771eda104e99874d19dc892e988ec53fa/torchfm/layer.py#L221-L237 | |
HKUST-KnowComp/MnemonicReader | 76aeb1d9021eaecb8d6d26caa00464ebeca8e87e | utils.py | python | load_text | (filename) | return texts | Load the paragraphs only of a SQuAD dataset. Store as qid -> text. | Load the paragraphs only of a SQuAD dataset. Store as qid -> text. | [
"Load",
"the",
"paragraphs",
"only",
"of",
"a",
"SQuAD",
"dataset",
".",
"Store",
"as",
"qid",
"-",
">",
"text",
"."
] | def load_text(filename):
"""Load the paragraphs only of a SQuAD dataset. Store as qid -> text."""
# Load JSON file
with open(filename) as f:
examples = json.load(f)['data']
texts = {}
for article in examples:
for paragraph in article['paragraphs']:
for qa in paragraph['q... | [
"def",
"load_text",
"(",
"filename",
")",
":",
"# Load JSON file",
"with",
"open",
"(",
"filename",
")",
"as",
"f",
":",
"examples",
"=",
"json",
".",
"load",
"(",
"f",
")",
"[",
"'data'",
"]",
"texts",
"=",
"{",
"}",
"for",
"article",
"in",
"example... | https://github.com/HKUST-KnowComp/MnemonicReader/blob/76aeb1d9021eaecb8d6d26caa00464ebeca8e87e/utils.py#L57-L68 | |
blampe/IbPy | cba912d2ecc669b0bf2980357ea7942e49c0825e | ib/ext/EWrapperMsgGenerator.py | python | EWrapperMsgGenerator.commissionReport | (cls, commissionReport) | return msg | generated source for method commissionReport | generated source for method commissionReport | [
"generated",
"source",
"for",
"method",
"commissionReport"
] | def commissionReport(cls, commissionReport):
""" generated source for method commissionReport """
msg = "commission report:" \
+ " execId=" + str(commissionReport.m_execId) \
+ " commission=" + Util.DoubleMaxString(commissionReport.m_commission) \
+ " currency="... | [
"def",
"commissionReport",
"(",
"cls",
",",
"commissionReport",
")",
":",
"msg",
"=",
"\"commission report:\"",
"+",
"\" execId=\"",
"+",
"str",
"(",
"commissionReport",
".",
"m_execId",
")",
"+",
"\" commission=\"",
"+",
"Util",
".",
"DoubleMaxString",
"(",
"co... | https://github.com/blampe/IbPy/blob/cba912d2ecc669b0bf2980357ea7942e49c0825e/ib/ext/EWrapperMsgGenerator.py#L512-L522 | |
pyparallel/pyparallel | 11e8c6072d48c8f13641925d17b147bf36ee0ba3 | Lib/site-packages/pandas-0.17.0-py3.3-win-amd64.egg/pandas/tseries/tdi.py | python | TimedeltaIndex.seconds | (self) | return self._get_field('seconds') | Number of seconds (>= 0 and less than 1 day) for each element. | Number of seconds (>= 0 and less than 1 day) for each element. | [
"Number",
"of",
"seconds",
"(",
">",
"=",
"0",
"and",
"less",
"than",
"1",
"day",
")",
"for",
"each",
"element",
"."
] | def seconds(self):
""" Number of seconds (>= 0 and less than 1 day) for each element. """
return self._get_field('seconds') | [
"def",
"seconds",
"(",
"self",
")",
":",
"return",
"self",
".",
"_get_field",
"(",
"'seconds'",
")"
] | https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/site-packages/pandas-0.17.0-py3.3-win-amd64.egg/pandas/tseries/tdi.py#L359-L361 | |
Netflix/metaflow | 25887ae77494f818d76bfa5f1560cf103cd15604 | metaflow/decorators.py | python | _base_step_decorator | (decotype, *args, **kwargs) | Decorator prototype for all step decorators. This function gets specialized
and imported for all decorators types by _import_plugin_decorators(). | Decorator prototype for all step decorators. This function gets specialized
and imported for all decorators types by _import_plugin_decorators(). | [
"Decorator",
"prototype",
"for",
"all",
"step",
"decorators",
".",
"This",
"function",
"gets",
"specialized",
"and",
"imported",
"for",
"all",
"decorators",
"types",
"by",
"_import_plugin_decorators",
"()",
"."
] | def _base_step_decorator(decotype, *args, **kwargs):
"""
Decorator prototype for all step decorators. This function gets specialized
and imported for all decorators types by _import_plugin_decorators().
"""
if args:
# No keyword arguments specified for the decorator, e.g. @foobar.
# ... | [
"def",
"_base_step_decorator",
"(",
"decotype",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"args",
":",
"# No keyword arguments specified for the decorator, e.g. @foobar.",
"# The first argument is the function to be decorated.",
"func",
"=",
"args",
"[",
... | https://github.com/Netflix/metaflow/blob/25887ae77494f818d76bfa5f1560cf103cd15604/metaflow/decorators.py#L393-L419 | ||
mesalock-linux/mesapy | ed546d59a21b36feb93e2309d5c6b75aa0ad95c9 | lib-python/2.7/decimal.py | python | Decimal.is_canonical | (self) | return True | Return True if self is canonical; otherwise return False.
Currently, the encoding of a Decimal instance is always
canonical, so this method returns True for any Decimal. | Return True if self is canonical; otherwise return False. | [
"Return",
"True",
"if",
"self",
"is",
"canonical",
";",
"otherwise",
"return",
"False",
"."
] | def is_canonical(self):
"""Return True if self is canonical; otherwise return False.
Currently, the encoding of a Decimal instance is always
canonical, so this method returns True for any Decimal.
"""
return True | [
"def",
"is_canonical",
"(",
"self",
")",
":",
"return",
"True"
] | https://github.com/mesalock-linux/mesapy/blob/ed546d59a21b36feb93e2309d5c6b75aa0ad95c9/lib-python/2.7/decimal.py#L3005-L3011 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_openshift/library/oc_adm_policy_group.py | python | Yedit.separator | (self) | return self._separator | getter method for separator | getter method for separator | [
"getter",
"method",
"for",
"separator"
] | def separator(self):
''' getter method for separator '''
return self._separator | [
"def",
"separator",
"(",
"self",
")",
":",
"return",
"self",
".",
"_separator"
] | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_openshift/library/oc_adm_policy_group.py#L176-L178 | |
triaquae/triaquae | bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9 | TriAquae/models/Centos_6.4/Crypto/Signature/PKCS1_PSS.py | python | EMSA_PSS_VERIFY | (mhash, em, emBits, mgf, sLen) | return True | Implement the ``EMSA-PSS-VERIFY`` function, as defined
in PKCS#1 v2.1 (RFC3447, 9.1.2).
``EMSA-PSS-VERIFY`` actually accepts the message ``M`` as input,
and hash it internally. Here, we expect that the message has already
been hashed instead.
:Parameters:
mhash : hash object
The h... | Implement the ``EMSA-PSS-VERIFY`` function, as defined
in PKCS#1 v2.1 (RFC3447, 9.1.2). | [
"Implement",
"the",
"EMSA",
"-",
"PSS",
"-",
"VERIFY",
"function",
"as",
"defined",
"in",
"PKCS#1",
"v2",
".",
"1",
"(",
"RFC3447",
"9",
".",
"1",
".",
"2",
")",
"."
] | def EMSA_PSS_VERIFY(mhash, em, emBits, mgf, sLen):
"""
Implement the ``EMSA-PSS-VERIFY`` function, as defined
in PKCS#1 v2.1 (RFC3447, 9.1.2).
``EMSA-PSS-VERIFY`` actually accepts the message ``M`` as input,
and hash it internally. Here, we expect that the message has already
been hashed instea... | [
"def",
"EMSA_PSS_VERIFY",
"(",
"mhash",
",",
"em",
",",
"emBits",
",",
"mgf",
",",
"sLen",
")",
":",
"emLen",
"=",
"ceil_div",
"(",
"emBits",
",",
"8",
")",
"# Bitmask of digits that fill up",
"lmask",
"=",
"0",
"for",
"i",
"in",
"xrange",
"(",
"8",
"*... | https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/Centos_6.4/Crypto/Signature/PKCS1_PSS.py#L269-L335 | |
davidoren/CuckooSploit | 3fce8183bee8f7917e08f765ce2a01c921f86354 | lib/cuckoo/core/database.py | python | Database.guest_start | (self, task_id, name, label, manager) | Logs guest start.
@param task_id: task identifier
@param name: vm name
@param label: vm label
@param manager: vm manager
@return: guest row id | Logs guest start. | [
"Logs",
"guest",
"start",
"."
] | def guest_start(self, task_id, name, label, manager):
"""Logs guest start.
@param task_id: task identifier
@param name: vm name
@param label: vm label
@param manager: vm manager
@return: guest row id
"""
session = self.Session()
guest = Guest(name,... | [
"def",
"guest_start",
"(",
"self",
",",
"task_id",
",",
"name",
",",
"label",
",",
"manager",
")",
":",
"session",
"=",
"self",
".",
"Session",
"(",
")",
"guest",
"=",
"Guest",
"(",
"name",
",",
"label",
",",
"manager",
")",
"try",
":",
"session",
... | https://github.com/davidoren/CuckooSploit/blob/3fce8183bee8f7917e08f765ce2a01c921f86354/lib/cuckoo/core/database.py#L540-L560 | ||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/matplotlib-3.0.3-py3.7-macosx-10.9-x86_64.egg/matplotlib/cm.py | python | ScalarMappable.set_array | (self, A) | Set the image array from numpy array *A*.
Parameters
----------
A : ndarray | Set the image array from numpy array *A*. | [
"Set",
"the",
"image",
"array",
"from",
"numpy",
"array",
"*",
"A",
"*",
"."
] | def set_array(self, A):
"""Set the image array from numpy array *A*.
Parameters
----------
A : ndarray
"""
self._A = A
self.update_dict['array'] = True | [
"def",
"set_array",
"(",
"self",
",",
"A",
")",
":",
"self",
".",
"_A",
"=",
"A",
"self",
".",
"update_dict",
"[",
"'array'",
"]",
"=",
"True"
] | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/matplotlib-3.0.3-py3.7-macosx-10.9-x86_64.egg/matplotlib/cm.py#L292-L300 | ||
coreemu/core | 7e18a7a72023a69a92ad61d87461bd659ba27f7c | daemon/core/configservice/base.py | python | ConfigService.wait_validation | (self) | Waits for a period of time to consider service started successfully.
:return: nothing | Waits for a period of time to consider service started successfully. | [
"Waits",
"for",
"a",
"period",
"of",
"time",
"to",
"consider",
"service",
"started",
"successfully",
"."
] | def wait_validation(self) -> None:
"""
Waits for a period of time to consider service started successfully.
:return: nothing
"""
time.sleep(self.validation_timer) | [
"def",
"wait_validation",
"(",
"self",
")",
"->",
"None",
":",
"time",
".",
"sleep",
"(",
"self",
".",
"validation_timer",
")"
] | https://github.com/coreemu/core/blob/7e18a7a72023a69a92ad61d87461bd659ba27f7c/daemon/core/configservice/base.py#L278-L284 | ||
VinF/deer | f5015b37ad70181537152243a2569c94b55cad92 | deer/learning_algos/CRAR_keras.py | python | CRAR._resetQHat | (self) | Set the target Q-network weights equal to the main Q-network weights | Set the target Q-network weights equal to the main Q-network weights | [
"Set",
"the",
"target",
"Q",
"-",
"network",
"weights",
"equal",
"to",
"the",
"main",
"Q",
"-",
"network",
"weights"
] | def _resetQHat(self):
""" Set the target Q-network weights equal to the main Q-network weights
"""
for i,(param,next_param) in enumerate(zip(self.params, self.params_target)):
K.set_value(next_param,K.get_value(param)) | [
"def",
"_resetQHat",
"(",
"self",
")",
":",
"for",
"i",
",",
"(",
"param",
",",
"next_param",
")",
"in",
"enumerate",
"(",
"zip",
"(",
"self",
".",
"params",
",",
"self",
".",
"params_target",
")",
")",
":",
"K",
".",
"set_value",
"(",
"next_param",
... | https://github.com/VinF/deer/blob/f5015b37ad70181537152243a2569c94b55cad92/deer/learning_algos/CRAR_keras.py#L559-L563 | ||
ilastik/ilastik | 6acd2c554bc517e9c8ddad3623a7aaa2e6970c28 | ilastik/workflows/examples/dataConversion/dataConversionWorkflow.py | python | DataConversionWorkflow.handleNewLanesAdded | (self) | Overridden from Workflow base class.
Called immediately AFTER connectLane() and the dataset is loaded into the workflow. | Overridden from Workflow base class.
Called immediately AFTER connectLane() and the dataset is loaded into the workflow. | [
"Overridden",
"from",
"Workflow",
"base",
"class",
".",
"Called",
"immediately",
"AFTER",
"connectLane",
"()",
"and",
"the",
"dataset",
"is",
"loaded",
"into",
"the",
"workflow",
"."
] | def handleNewLanesAdded(self):
"""
Overridden from Workflow base class.
Called immediately AFTER connectLane() and the dataset is loaded into the workflow.
"""
# No special handling required.
pass | [
"def",
"handleNewLanesAdded",
"(",
"self",
")",
":",
"# No special handling required.",
"pass"
] | https://github.com/ilastik/ilastik/blob/6acd2c554bc517e9c8ddad3623a7aaa2e6970c28/ilastik/workflows/examples/dataConversion/dataConversionWorkflow.py#L158-L164 | ||
tomplus/kubernetes_asyncio | f028cc793e3a2c519be6a52a49fb77ff0b014c9b | kubernetes_asyncio/client/models/v1_service_port.py | python | V1ServicePort.to_str | (self) | return pprint.pformat(self.to_dict()) | Returns the string representation of the model | Returns the string representation of the model | [
"Returns",
"the",
"string",
"representation",
"of",
"the",
"model"
] | def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict()) | [
"def",
"to_str",
"(",
"self",
")",
":",
"return",
"pprint",
".",
"pformat",
"(",
"self",
".",
"to_dict",
"(",
")",
")"
] | https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/models/v1_service_port.py#L243-L245 | |
galaxyproject/galaxy | 4c03520f05062e0f4a1b3655dc0b7452fda69943 | lib/galaxy/webapps/galaxy/controllers/history.py | python | HistoryController.list | (self, trans, **kwargs) | return self.stored_list_grid(trans, **kwargs) | List all available histories | List all available histories | [
"List",
"all",
"available",
"histories"
] | def list(self, trans, **kwargs):
"""List all available histories"""
current_history = trans.get_history()
message = kwargs.get('message')
status = kwargs.get('status')
if 'operation' in kwargs:
operation = kwargs['operation'].lower()
history_ids = listify(... | [
"def",
"list",
"(",
"self",
",",
"trans",
",",
"*",
"*",
"kwargs",
")",
":",
"current_history",
"=",
"trans",
".",
"get_history",
"(",
")",
"message",
"=",
"kwargs",
".",
"get",
"(",
"'message'",
")",
"status",
"=",
"kwargs",
".",
"get",
"(",
"'statu... | https://github.com/galaxyproject/galaxy/blob/4c03520f05062e0f4a1b3655dc0b7452fda69943/lib/galaxy/webapps/galaxy/controllers/history.py#L268-L316 | |
openstack/swift | b8d7c3dcb817504dcc0959ba52cc4ed2cf66c100 | swift/proxy/controllers/account.py | python | AccountController.GETorHEAD | (self, req) | return resp | Handler for HTTP GET/HEAD requests. | Handler for HTTP GET/HEAD requests. | [
"Handler",
"for",
"HTTP",
"GET",
"/",
"HEAD",
"requests",
"."
] | def GETorHEAD(self, req):
"""Handler for HTTP GET/HEAD requests."""
length_limit = self.get_name_length_limit()
if len(self.account_name) > length_limit:
resp = HTTPBadRequest(request=req)
resp.body = b'Account name length of %d longer than %d' % \
... | [
"def",
"GETorHEAD",
"(",
"self",
",",
"req",
")",
":",
"length_limit",
"=",
"self",
".",
"get_name_length_limit",
"(",
")",
"if",
"len",
"(",
"self",
".",
"account_name",
")",
">",
"length_limit",
":",
"resp",
"=",
"HTTPBadRequest",
"(",
"request",
"=",
... | https://github.com/openstack/swift/blob/b8d7c3dcb817504dcc0959ba52cc4ed2cf66c100/swift/proxy/controllers/account.py#L51-L105 | |
demisto/content | 5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07 | Packs/AzureStorageContainer/Integrations/AzureStorageContainer/AzureStorageContainer.py | python | list_blobs_command | (client: Client, args: Dict[str, Any]) | return command_results | List Blobs under the specified container.
Args:
client (Client): Azure Blob Storage API client.
args (dict): Command arguments from XSOAR.
Returns:
CommandResults: outputs, readable outputs and raw response for XSOAR. | List Blobs under the specified container. | [
"List",
"Blobs",
"under",
"the",
"specified",
"container",
"."
] | def list_blobs_command(client: Client, args: Dict[str, Any]) -> CommandResults:
"""
List Blobs under the specified container.
Args:
client (Client): Azure Blob Storage API client.
args (dict): Command arguments from XSOAR.
Returns:
CommandResults: outputs, readable outputs and ... | [
"def",
"list_blobs_command",
"(",
"client",
":",
"Client",
",",
"args",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
")",
"->",
"CommandResults",
":",
"container_name",
"=",
"args",
"[",
"'container_name'",
"]",
"limit",
"=",
"args",
".",
"get",
"(",
"'limi... | https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/AzureStorageContainer/Integrations/AzureStorageContainer/AzureStorageContainer.py#L477-L547 | |
sahana/eden | 1696fa50e90ce967df69f66b571af45356cc18da | modules/s3/s3track.py | python | S3Trackable.__init__ | (self,
table = None,
tablename = None,
record = None,
query = None,
record_id = None,
record_ids = None,
rtable = None,
) | Args:
table: a Table object
tablename: a Str tablename
record: a Row object
query: a Query object
record_id: a record ID (if object is a Table)
record_ids: a list of record IDs (if object is a Table)
... | Args:
table: a Table object
tablename: a Str tablename
record: a Row object
query: a Query object
record_id: a record ID (if object is a Table)
record_ids: a list of record IDs (if object is a Table)
... | [
"Args",
":",
"table",
":",
"a",
"Table",
"object",
"tablename",
":",
"a",
"Str",
"tablename",
"record",
":",
"a",
"Row",
"object",
"query",
":",
"a",
"Query",
"object",
"record_id",
":",
"a",
"record",
"ID",
"(",
"if",
"object",
"is",
"a",
"Table",
"... | def __init__(self,
table = None,
tablename = None,
record = None,
query = None,
record_id = None,
record_ids = None,
rtable = None,
):
"""
Args:
tab... | [
"def",
"__init__",
"(",
"self",
",",
"table",
"=",
"None",
",",
"tablename",
"=",
"None",
",",
"record",
"=",
"None",
",",
"query",
"=",
"None",
",",
"record_id",
"=",
"None",
",",
"record_ids",
"=",
"None",
",",
"rtable",
"=",
"None",
",",
")",
":... | https://github.com/sahana/eden/blob/1696fa50e90ce967df69f66b571af45356cc18da/modules/s3/s3track.py#L58-L202 | ||
ipython/ipython | c0abea7a6dfe52c1f74c9d0387d4accadba7cc14 | IPython/core/interactiveshell.py | python | InteractiveShell.find_cell_magic | (self, magic_name) | return self.magics_manager.magics['cell'].get(magic_name) | Find and return a cell magic by name.
Returns None if the magic isn't found. | Find and return a cell magic by name. | [
"Find",
"and",
"return",
"a",
"cell",
"magic",
"by",
"name",
"."
] | def find_cell_magic(self, magic_name):
"""Find and return a cell magic by name.
Returns None if the magic isn't found."""
return self.magics_manager.magics['cell'].get(magic_name) | [
"def",
"find_cell_magic",
"(",
"self",
",",
"magic_name",
")",
":",
"return",
"self",
".",
"magics_manager",
".",
"magics",
"[",
"'cell'",
"]",
".",
"get",
"(",
"magic_name",
")"
] | https://github.com/ipython/ipython/blob/c0abea7a6dfe52c1f74c9d0387d4accadba7cc14/IPython/core/interactiveshell.py#L2266-L2270 | |
007gzs/dingtalk-sdk | 7979da2e259fdbc571728cae2425a04dbc65850a | dingtalk/client/api/taobao.py | python | TbDingDing.dingtalk_corp_ding_create | (
self,
creator_userid,
receiver_userids,
remind_type,
remind_time,
text_content,
attachment=None
) | return self._top_request(
"dingtalk.corp.ding.create",
{
"creator_userid": creator_userid,
"receiver_userids": receiver_userids,
"remind_type": remind_type,
"remind_time": remind_time,
"text_content": text_content,
... | 发DING通知
通过此接口发DING通知给企业内部员工, 支持短信DING和应用内DING.
该接口正在灰度内测中, 暂不对外开放
文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=32841
:param creator_userid: 发送者工号
:param receiver_userids: 接收者工号列表
:param remind_type: 提醒类型:1-应用内;2-短信
:param remind_time: 发送时间(单位:毫秒)
... | 发DING通知
通过此接口发DING通知给企业内部员工, 支持短信DING和应用内DING.
该接口正在灰度内测中, 暂不对外开放
文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=32841 | [
"发DING通知",
"通过此接口发DING通知给企业内部员工",
"支持短信DING和应用内DING",
".",
"该接口正在灰度内测中",
"暂不对外开放",
"文档地址:https",
":",
"//",
"open",
"-",
"doc",
".",
"dingtalk",
".",
"com",
"/",
"docs",
"/",
"api",
".",
"htm?apiId",
"=",
"32841"
] | def dingtalk_corp_ding_create(
self,
creator_userid,
receiver_userids,
remind_type,
remind_time,
text_content,
attachment=None
):
"""
发DING通知
通过此接口发DING通知给企业内部员工, 支持短信DING和应用内DING.
该接口正在灰度内测中, 暂不对外开放
... | [
"def",
"dingtalk_corp_ding_create",
"(",
"self",
",",
"creator_userid",
",",
"receiver_userids",
",",
"remind_type",
",",
"remind_time",
",",
"text_content",
",",
"attachment",
"=",
"None",
")",
":",
"return",
"self",
".",
"_top_request",
"(",
"\"dingtalk.corp.ding.... | https://github.com/007gzs/dingtalk-sdk/blob/7979da2e259fdbc571728cae2425a04dbc65850a/dingtalk/client/api/taobao.py#L1037-L1069 | |
s3ql/s3ql | 19493c29990e849ebaa261cb0549bbda4d7819ab | src/s3ql/fsck.py | python | Fsck.resolve_free | (self, path, name) | return (inode_p, newname) | Return parent inode and name of an unused directory entry
The directory entry will be in `path`. If an entry `name` already
exists there, we append a numeric suffix. | Return parent inode and name of an unused directory entry | [
"Return",
"parent",
"inode",
"and",
"name",
"of",
"an",
"unused",
"directory",
"entry"
] | def resolve_free(self, path, name):
'''Return parent inode and name of an unused directory entry
The directory entry will be in `path`. If an entry `name` already
exists there, we append a numeric suffix.
'''
if not isinstance(path, bytes):
raise TypeError('path mus... | [
"def",
"resolve_free",
"(",
"self",
",",
"path",
",",
"name",
")",
":",
"if",
"not",
"isinstance",
"(",
"path",
",",
"bytes",
")",
":",
"raise",
"TypeError",
"(",
"'path must be of type bytes'",
")",
"if",
"not",
"isinstance",
"(",
"name",
",",
"bytes",
... | https://github.com/s3ql/s3ql/blob/19493c29990e849ebaa261cb0549bbda4d7819ab/src/s3ql/fsck.py#L1056-L1088 | |
google/jax | bebe9845a873b3203f8050395255f173ba3bbb71 | examples/datasets.py | python | _one_hot | (x, k, dtype=np.float32) | return np.array(x[:, None] == np.arange(k), dtype) | Create a one-hot encoding of x of size k. | Create a one-hot encoding of x of size k. | [
"Create",
"a",
"one",
"-",
"hot",
"encoding",
"of",
"x",
"of",
"size",
"k",
"."
] | def _one_hot(x, k, dtype=np.float32):
"""Create a one-hot encoding of x of size k."""
return np.array(x[:, None] == np.arange(k), dtype) | [
"def",
"_one_hot",
"(",
"x",
",",
"k",
",",
"dtype",
"=",
"np",
".",
"float32",
")",
":",
"return",
"np",
".",
"array",
"(",
"x",
"[",
":",
",",
"None",
"]",
"==",
"np",
".",
"arange",
"(",
"k",
")",
",",
"dtype",
")"
] | https://github.com/google/jax/blob/bebe9845a873b3203f8050395255f173ba3bbb71/examples/datasets.py#L46-L48 | |
PowerScript/KatanaFramework | 0f6ad90a88de865d58ec26941cb4460501e75496 | lib/future/src/future/backports/email/_policybase.py | python | Policy.fold | (self, name, value) | Given the header name and the value from the model, return a string
containing linesep characters that implement the folding of the header
according to the policy controls. The value passed in by the email
package may contain surrogateescaped binary data if the lines were
parsed by a By... | Given the header name and the value from the model, return a string
containing linesep characters that implement the folding of the header
according to the policy controls. The value passed in by the email
package may contain surrogateescaped binary data if the lines were
parsed by a By... | [
"Given",
"the",
"header",
"name",
"and",
"the",
"value",
"from",
"the",
"model",
"return",
"a",
"string",
"containing",
"linesep",
"characters",
"that",
"implement",
"the",
"folding",
"of",
"the",
"header",
"according",
"to",
"the",
"policy",
"controls",
".",
... | def fold(self, name, value):
"""Given the header name and the value from the model, return a string
containing linesep characters that implement the folding of the header
according to the policy controls. The value passed in by the email
package may contain surrogateescaped binary data ... | [
"def",
"fold",
"(",
"self",
",",
"name",
",",
"value",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/PowerScript/KatanaFramework/blob/0f6ad90a88de865d58ec26941cb4460501e75496/lib/future/src/future/backports/email/_policybase.py#L246-L255 | ||
pwnieexpress/pwn_plug_sources | 1a23324f5dc2c3de20f9c810269b6a29b2758cad | src/wifitap/scapy.py | python | SndRcvList._elt2sum | (self, elt) | return "%s ==> %s" % (elt[0].summary(),elt[1].summary()) | [] | def _elt2sum(self, elt):
return "%s ==> %s" % (elt[0].summary(),elt[1].summary()) | [
"def",
"_elt2sum",
"(",
"self",
",",
"elt",
")",
":",
"return",
"\"%s ==> %s\"",
"%",
"(",
"elt",
"[",
"0",
"]",
".",
"summary",
"(",
")",
",",
"elt",
"[",
"1",
"]",
".",
"summary",
"(",
")",
")"
] | https://github.com/pwnieexpress/pwn_plug_sources/blob/1a23324f5dc2c3de20f9c810269b6a29b2758cad/src/wifitap/scapy.py#L3193-L3194 | |||
google/tangent | 6533e83af09de7345d1b438512679992f080dcc9 | tangent/grad_util.py | python | autodiff_tree | (func, wrt, motion, mode, preserve_result, check_dims,
verbose) | return final, namespace | Perform AD on all functions in a call tree.
This function walks the call tree and differentiates each function in it. It
also ensures that the global namespaces that each function in the call tree
was in are merged.
The `tangent` and `numpy` packages are added to the namespace here, so that
the gradient tem... | Perform AD on all functions in a call tree. | [
"Perform",
"AD",
"on",
"all",
"functions",
"in",
"a",
"call",
"tree",
"."
] | def autodiff_tree(func, wrt, motion, mode, preserve_result, check_dims,
verbose):
"""Perform AD on all functions in a call tree.
This function walks the call tree and differentiates each function in it. It
also ensures that the global namespaces that each function in the call tree
was in are ... | [
"def",
"autodiff_tree",
"(",
"func",
",",
"wrt",
",",
"motion",
",",
"mode",
",",
"preserve_result",
",",
"check_dims",
",",
"verbose",
")",
":",
"# Imported here to avoid circular imports",
"import",
"tangent",
"namespace",
"=",
"{",
"'tangent'",
":",
"tangent",
... | https://github.com/google/tangent/blob/6533e83af09de7345d1b438512679992f080dcc9/tangent/grad_util.py#L116-L172 | |
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/output/highstate.py | python | output | (data, **kwargs) | return "" | The HighState Outputter is only meant to be used with the state.highstate
function, or a function that returns highstate return data. | The HighState Outputter is only meant to be used with the state.highstate
function, or a function that returns highstate return data. | [
"The",
"HighState",
"Outputter",
"is",
"only",
"meant",
"to",
"be",
"used",
"with",
"the",
"state",
".",
"highstate",
"function",
"or",
"a",
"function",
"that",
"returns",
"highstate",
"return",
"data",
"."
] | def output(data, **kwargs): # pylint: disable=unused-argument
"""
The HighState Outputter is only meant to be used with the state.highstate
function, or a function that returns highstate return data.
"""
# If additional information is passed through via the "data" dictionary to
# the highstate ... | [
"def",
"output",
"(",
"data",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=unused-argument",
"# If additional information is passed through via the \"data\" dictionary to",
"# the highstate outputter, such as \"outputter\" or \"retcode\", discard it.",
"# We only want the state da... | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/output/highstate.py#L134-L184 | |
git-cola/git-cola | b48b8028e0c3baf47faf7b074b9773737358163d | cola/widgets/gitignore.py | python | AddToGitIgnore.resize_widget | (self, parent) | Set the initial size of the widget | Set the initial size of the widget | [
"Set",
"the",
"initial",
"size",
"of",
"the",
"widget"
] | def resize_widget(self, parent):
"""Set the initial size of the widget"""
width, height = qtutils.default_size(parent, 720, 400)
self.resize(width, max(400, height // 2)) | [
"def",
"resize_widget",
"(",
"self",
",",
"parent",
")",
":",
"width",
",",
"height",
"=",
"qtutils",
".",
"default_size",
"(",
"parent",
",",
"720",
",",
"400",
")",
"self",
".",
"resize",
"(",
"width",
",",
"max",
"(",
"400",
",",
"height",
"//",
... | https://github.com/git-cola/git-cola/blob/b48b8028e0c3baf47faf7b074b9773737358163d/cola/widgets/gitignore.py#L96-L99 | ||
andresriancho/w3af | cd22e5252243a87aaa6d0ddea47cf58dacfe00a9 | w3af/plugins/attack/payloads/base_payload.py | python | Payload.__init__ | (self, shell_obj) | [] | def __init__(self, shell_obj):
self.shell = shell_obj
self.worker_pool = self.shell.worker_pool | [
"def",
"__init__",
"(",
"self",
",",
"shell_obj",
")",
":",
"self",
".",
"shell",
"=",
"shell_obj",
"self",
".",
"worker_pool",
"=",
"self",
".",
"shell",
".",
"worker_pool"
] | https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/plugins/attack/payloads/base_payload.py#L35-L37 | ||||
PyHDI/Pyverilog | 2a42539bebd1b4587ee577d491ff002d0cc7295d | pyverilog/vparser/parser.py | python | VerilogParser.p_floatnumber | (self, p) | floatnumber : FLOATNUMBER | floatnumber : FLOATNUMBER | [
"floatnumber",
":",
"FLOATNUMBER"
] | def p_floatnumber(self, p):
'floatnumber : FLOATNUMBER'
p[0] = p[1]
p.set_lineno(0, p.lineno(1)) | [
"def",
"p_floatnumber",
"(",
"self",
",",
"p",
")",
":",
"p",
"[",
"0",
"]",
"=",
"p",
"[",
"1",
"]",
"p",
".",
"set_lineno",
"(",
"0",
",",
"p",
".",
"lineno",
"(",
"1",
")",
")"
] | https://github.com/PyHDI/Pyverilog/blob/2a42539bebd1b4587ee577d491ff002d0cc7295d/pyverilog/vparser/parser.py#L1271-L1274 | ||
megvii-research/NIPS2017-LearningToRunACE | 35f7ee74fbe43e150b14599743825d1f679335d7 | baseline/ActorNetwork.py | python | ActorNetwork.train | (self, states, action_grads, learning_rate) | [] | def train(self, states, action_grads, learning_rate):
self.sess.run(self.optimize, feed_dict={
self.state: states,
self.action_gradient: action_grads,
self.LEARNING_RATE : learning_rate
}) | [
"def",
"train",
"(",
"self",
",",
"states",
",",
"action_grads",
",",
"learning_rate",
")",
":",
"self",
".",
"sess",
".",
"run",
"(",
"self",
".",
"optimize",
",",
"feed_dict",
"=",
"{",
"self",
".",
"state",
":",
"states",
",",
"self",
".",
"action... | https://github.com/megvii-research/NIPS2017-LearningToRunACE/blob/35f7ee74fbe43e150b14599743825d1f679335d7/baseline/ActorNetwork.py#L38-L44 | ||||
Garvit244/Leetcode | a1d31ff0f9f251f3dd0bee5cc8b191b7ebbccc29 | 1000-1100q/1027.py | python | Solution.longestArithSeqLength | (self, A) | return max(dp.itervalues())+1 | :type A: List[int]
:rtype: int | :type A: List[int]
:rtype: int | [
":",
"type",
"A",
":",
"List",
"[",
"int",
"]",
":",
"rtype",
":",
"int"
] | def longestArithSeqLength(self, A):
"""
:type A: List[int]
:rtype: int
"""
from collections import defaultdict
dp = defaultdict(int)
# print dp
for index_i in range(len(A)):
for index_j in range(index_i):
diff = A[index_i] - A[... | [
"def",
"longestArithSeqLength",
"(",
"self",
",",
"A",
")",
":",
"from",
"collections",
"import",
"defaultdict",
"dp",
"=",
"defaultdict",
"(",
"int",
")",
"# print dp",
"for",
"index_i",
"in",
"range",
"(",
"len",
"(",
"A",
")",
")",
":",
"for",
"index_... | https://github.com/Garvit244/Leetcode/blob/a1d31ff0f9f251f3dd0bee5cc8b191b7ebbccc29/1000-1100q/1027.py#L23-L37 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/mqtt/climate.py | python | async_setup_platform | (
hass: HomeAssistant,
config: ConfigType,
async_add_entities: AddEntitiesCallback,
discovery_info: DiscoveryInfoType | None = None,
) | Set up MQTT climate device through configuration.yaml. | Set up MQTT climate device through configuration.yaml. | [
"Set",
"up",
"MQTT",
"climate",
"device",
"through",
"configuration",
".",
"yaml",
"."
] | async def async_setup_platform(
hass: HomeAssistant,
config: ConfigType,
async_add_entities: AddEntitiesCallback,
discovery_info: DiscoveryInfoType | None = None,
) -> None:
"""Set up MQTT climate device through configuration.yaml."""
await async_setup_reload_service(hass, DOMAIN, PLATFORMS)
... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"ConfigType",
",",
"async_add_entities",
":",
"AddEntitiesCallback",
",",
"discovery_info",
":",
"DiscoveryInfoType",
"|",
"None",
"=",
"None",
",",
")",
"->",
"None",
... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/mqtt/climate.py#L299-L307 | ||
caiiiac/Machine-Learning-with-Python | 1a26c4467da41ca4ebc3d5bd789ea942ef79422f | MachineLearning/venv/lib/python3.5/site-packages/numpy/lib/recfunctions.py | python | stack_arrays | (arrays, defaults=None, usemask=True, asrecarray=False,
autoconvert=False) | return _fix_output(_fix_defaults(output, defaults),
usemask=usemask, asrecarray=asrecarray) | Superposes arrays fields by fields
Parameters
----------
arrays : array or sequence
Sequence of input arrays.
defaults : dictionary, optional
Dictionary mapping field names to the corresponding default values.
usemask : {True, False}, optional
Whether to return a MaskedArray... | Superposes arrays fields by fields | [
"Superposes",
"arrays",
"fields",
"by",
"fields"
] | def stack_arrays(arrays, defaults=None, usemask=True, asrecarray=False,
autoconvert=False):
"""
Superposes arrays fields by fields
Parameters
----------
arrays : array or sequence
Sequence of input arrays.
defaults : dictionary, optional
Dictionary mapping field... | [
"def",
"stack_arrays",
"(",
"arrays",
",",
"defaults",
"=",
"None",
",",
"usemask",
"=",
"True",
",",
"asrecarray",
"=",
"False",
",",
"autoconvert",
"=",
"False",
")",
":",
"if",
"isinstance",
"(",
"arrays",
",",
"ndarray",
")",
":",
"return",
"arrays",... | https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/numpy/lib/recfunctions.py#L679-L766 | |
tomplus/kubernetes_asyncio | f028cc793e3a2c519be6a52a49fb77ff0b014c9b | kubernetes_asyncio/client/models/v1beta1_role_list.py | python | V1beta1RoleList.__repr__ | (self) | return self.to_str() | For `print` and `pprint` | For `print` and `pprint` | [
"For",
"print",
"and",
"pprint"
] | def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str() | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"self",
".",
"to_str",
"(",
")"
] | https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/models/v1beta1_role_list.py#L189-L191 | |
pycassa/pycassa | b314d5fa4e6ba1219850f50d767aa0be5ed5ca5f | pycassa/cassandra/Cassandra.py | python | Client.remove | (self, key, column_path, timestamp, consistency_level) | Remove data from the row specified by key at the granularity specified by column_path, and the given timestamp. Note
that all the values in column_path besides column_path.column_family are truly optional: you can remove the entire
row by just specifying the ColumnFamily, or you can remove a SuperColumn or a si... | Remove data from the row specified by key at the granularity specified by column_path, and the given timestamp. Note
that all the values in column_path besides column_path.column_family are truly optional: you can remove the entire
row by just specifying the ColumnFamily, or you can remove a SuperColumn or a si... | [
"Remove",
"data",
"from",
"the",
"row",
"specified",
"by",
"key",
"at",
"the",
"granularity",
"specified",
"by",
"column_path",
"and",
"the",
"given",
"timestamp",
".",
"Note",
"that",
"all",
"the",
"values",
"in",
"column_path",
"besides",
"column_path",
".",... | def remove(self, key, column_path, timestamp, consistency_level):
"""
Remove data from the row specified by key at the granularity specified by column_path, and the given timestamp. Note
that all the values in column_path besides column_path.column_family are truly optional: you can remove the entire
ro... | [
"def",
"remove",
"(",
"self",
",",
"key",
",",
"column_path",
",",
"timestamp",
",",
"consistency_level",
")",
":",
"self",
".",
"send_remove",
"(",
"key",
",",
"column_path",
",",
"timestamp",
",",
"consistency_level",
")",
"self",
".",
"recv_remove",
"(",
... | https://github.com/pycassa/pycassa/blob/b314d5fa4e6ba1219850f50d767aa0be5ed5ca5f/pycassa/cassandra/Cassandra.py#L963-L976 | ||
triaquae/triaquae | bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9 | TriAquae/models/Centos_5.9/ecdsa/numbertheory.py | python | carmichael_of_ppower | ( pp ) | Carmichael function of the given power of the given prime. | Carmichael function of the given power of the given prime. | [
"Carmichael",
"function",
"of",
"the",
"given",
"power",
"of",
"the",
"given",
"prime",
"."
] | def carmichael_of_ppower( pp ):
"""Carmichael function of the given power of the given prime.
"""
p, a = pp
if p == 2 and a > 2: return 2**(a-2)
else: return (p-1) * p**(a-1) | [
"def",
"carmichael_of_ppower",
"(",
"pp",
")",
":",
"p",
",",
"a",
"=",
"pp",
"if",
"p",
"==",
"2",
"and",
"a",
">",
"2",
":",
"return",
"2",
"**",
"(",
"a",
"-",
"2",
")",
"else",
":",
"return",
"(",
"p",
"-",
"1",
")",
"*",
"p",
"**",
"... | https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/Centos_5.9/ecdsa/numbertheory.py#L337-L343 | ||
riptideio/pymodbus | c5772b35ae3f29d1947f3ab453d8d00df846459f | examples/gui/bottle/frontend.py | python | build_application | (server) | return register | Helper method to create and initiailze a bottle application
:param server: The modbus server to pull instance data from
:returns: An initialized bottle application | Helper method to create and initiailze a bottle application | [
"Helper",
"method",
"to",
"create",
"and",
"initiailze",
"a",
"bottle",
"application"
] | def build_application(server):
""" Helper method to create and initiailze a bottle application
:param server: The modbus server to pull instance data from
:returns: An initialized bottle application
"""
log.info("building web application")
api = ModbusApiWebApp(server)
register = Bottle()
... | [
"def",
"build_application",
"(",
"server",
")",
":",
"log",
".",
"info",
"(",
"\"building web application\"",
")",
"api",
"=",
"ModbusApiWebApp",
"(",
"server",
")",
"register",
"=",
"Bottle",
"(",
")",
"register_api_routes",
"(",
"api",
",",
"register",
")",
... | https://github.com/riptideio/pymodbus/blob/c5772b35ae3f29d1947f3ab453d8d00df846459f/examples/gui/bottle/frontend.py#L222-L233 | |
jhao104/proxy_pool | 394072d49b34062d5a8ed1f1c60baa13fb98b59e | db/redisClient.py | python | RedisClient.exists | (self, proxy_str) | return self.__conn.hexists(self.name, proxy_str) | 判断指定代理是否存在, 使用changeTable指定hash name
:param proxy_str: proxy str
:return: | 判断指定代理是否存在, 使用changeTable指定hash name
:param proxy_str: proxy str
:return: | [
"判断指定代理是否存在",
"使用changeTable指定hash",
"name",
":",
"param",
"proxy_str",
":",
"proxy",
"str",
":",
"return",
":"
] | def exists(self, proxy_str):
"""
判断指定代理是否存在, 使用changeTable指定hash name
:param proxy_str: proxy str
:return:
"""
return self.__conn.hexists(self.name, proxy_str) | [
"def",
"exists",
"(",
"self",
",",
"proxy_str",
")",
":",
"return",
"self",
".",
"__conn",
".",
"hexists",
"(",
"self",
".",
"name",
",",
"proxy_str",
")"
] | https://github.com/jhao104/proxy_pool/blob/394072d49b34062d5a8ed1f1c60baa13fb98b59e/db/redisClient.py#L91-L97 | |
TheAlgorithms/Python | 9af2eef9b3761bf51580dedfb6fa7136ca0c5c2c | machine_learning/multilayer_perceptron_classifier.py | python | wrapper | (Y) | return list(Y) | >>> wrapper(Y)
[0, 0, 1] | >>> wrapper(Y)
[0, 0, 1] | [
">>>",
"wrapper",
"(",
"Y",
")",
"[",
"0",
"0",
"1",
"]"
] | def wrapper(Y):
"""
>>> wrapper(Y)
[0, 0, 1]
"""
return list(Y) | [
"def",
"wrapper",
"(",
"Y",
")",
":",
"return",
"list",
"(",
"Y",
")"
] | https://github.com/TheAlgorithms/Python/blob/9af2eef9b3761bf51580dedfb6fa7136ca0c5c2c/machine_learning/multilayer_perceptron_classifier.py#L18-L23 | |
pypa/pipenv | b21baade71a86ab3ee1429f71fbc14d4f95fb75d | pipenv/patched/notpip/_vendor/distlib/_backport/tarfile.py | python | TarIter.__init__ | (self, tarfile) | Construct a TarIter object. | Construct a TarIter object. | [
"Construct",
"a",
"TarIter",
"object",
"."
] | def __init__(self, tarfile):
"""Construct a TarIter object.
"""
self.tarfile = tarfile
self.index = 0 | [
"def",
"__init__",
"(",
"self",
",",
"tarfile",
")",
":",
"self",
".",
"tarfile",
"=",
"tarfile",
"self",
".",
"index",
"=",
"0"
] | https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/patched/notpip/_vendor/distlib/_backport/tarfile.py#L2560-L2564 | ||
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/lib-python/3/datetime.py | python | date.__sub__ | (self, other) | return NotImplemented | Subtract two dates, or a date and a timedelta. | Subtract two dates, or a date and a timedelta. | [
"Subtract",
"two",
"dates",
"or",
"a",
"date",
"and",
"a",
"timedelta",
"."
] | def __sub__(self, other):
"""Subtract two dates, or a date and a timedelta."""
if isinstance(other, timedelta):
return self + timedelta(-other.days)
if isinstance(other, date):
days1 = self.toordinal()
days2 = other.toordinal()
return timedelta(day... | [
"def",
"__sub__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"timedelta",
")",
":",
"return",
"self",
"+",
"timedelta",
"(",
"-",
"other",
".",
"days",
")",
"if",
"isinstance",
"(",
"other",
",",
"date",
")",
":",
"... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/datetime.py#L867-L875 | |
DataDog/integrations-core | 934674b29d94b70ccc008f76ea172d0cdae05e1e | kubernetes_state/datadog_checks/kubernetes_state/kubernetes_state.py | python | KubernetesState.kube_job_status_failed | (self, metric, scraper_config) | [] | def kube_job_status_failed(self, metric, scraper_config):
for sample in metric.samples:
job_ts = None
tags = [] + scraper_config['custom_tags']
for label_name, label_value in iteritems(sample[self.SAMPLE_LABELS]):
if label_name == 'job' or label_name == 'job_n... | [
"def",
"kube_job_status_failed",
"(",
"self",
",",
"metric",
",",
"scraper_config",
")",
":",
"for",
"sample",
"in",
"metric",
".",
"samples",
":",
"job_ts",
"=",
"None",
"tags",
"=",
"[",
"]",
"+",
"scraper_config",
"[",
"'custom_tags'",
"]",
"for",
"labe... | https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/kubernetes_state/datadog_checks/kubernetes_state/kubernetes_state.py#L693-L709 | ||||
horovod/horovod | 976a87958d48b4359834b33564c95e808d005dab | horovod/tensorflow/keras/__init__.py | python | broadcast | (value, root_rank, name=None) | return _impl.broadcast(K, value, root_rank, name) | Perform a broadcast on a tensor-compatible value.
Arguments:
value: A tensor-compatible value to reduce.
The shape of the input must be identical across all ranks.
root_rank: Rank of the process from which global variables will be
broadcasted to all other processes... | Perform a broadcast on a tensor-compatible value. | [
"Perform",
"a",
"broadcast",
"on",
"a",
"tensor",
"-",
"compatible",
"value",
"."
] | def broadcast(value, root_rank, name=None):
"""
Perform a broadcast on a tensor-compatible value.
Arguments:
value: A tensor-compatible value to reduce.
The shape of the input must be identical across all ranks.
root_rank: Rank of the process from which global variables will ... | [
"def",
"broadcast",
"(",
"value",
",",
"root_rank",
",",
"name",
"=",
"None",
")",
":",
"return",
"_impl",
".",
"broadcast",
"(",
"K",
",",
"value",
",",
"root_rank",
",",
"name",
")"
] | https://github.com/horovod/horovod/blob/976a87958d48b4359834b33564c95e808d005dab/horovod/tensorflow/keras/__init__.py#L202-L213 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/groups/abelian_gps/abelian_aut.py | python | AbelianGroupAutomorphismGroup.__init__ | (self, AbelianGroupGap) | Constructor.
EXAMPLES::
sage: from sage.groups.abelian_gps.abelian_group_gap import AbelianGroupGap
sage: G = AbelianGroupGap([2,3,4,5])
sage: aut = G.aut()
sage: TestSuite(aut).run() | Constructor. | [
"Constructor",
"."
] | def __init__(self, AbelianGroupGap):
"""
Constructor.
EXAMPLES::
sage: from sage.groups.abelian_gps.abelian_group_gap import AbelianGroupGap
sage: G = AbelianGroupGap([2,3,4,5])
sage: aut = G.aut()
sage: TestSuite(aut).run()
"""
s... | [
"def",
"__init__",
"(",
"self",
",",
"AbelianGroupGap",
")",
":",
"self",
".",
"_domain",
"=",
"AbelianGroupGap",
"if",
"not",
"isinstance",
"(",
"AbelianGroupGap",
",",
"AbelianGroup_gap",
")",
":",
"raise",
"ValueError",
"(",
"\"not an abelian group with GAP backe... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/groups/abelian_gps/abelian_aut.py#L438-L460 | ||
robinhood/faust | 01b4c0ad8390221db71751d80001b0fd879291e2 | faust/utils/codegen.py | python | build_function | (name: str, source: str,
*,
return_type: Any = MISSING,
globals: Dict[str, Any] = None,
locals: Dict[str, Any] = None) | return cast(Callable, obj) | Generate function from Python from source code string. | Generate function from Python from source code string. | [
"Generate",
"function",
"from",
"Python",
"from",
"source",
"code",
"string",
"."
] | def build_function(name: str, source: str,
*,
return_type: Any = MISSING,
globals: Dict[str, Any] = None,
locals: Dict[str, Any] = None) -> Callable:
"""Generate function from Python from source code string."""
assert locals is not None... | [
"def",
"build_function",
"(",
"name",
":",
"str",
",",
"source",
":",
"str",
",",
"*",
",",
"return_type",
":",
"Any",
"=",
"MISSING",
",",
"globals",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
"=",
"None",
",",
"locals",
":",
"Dict",
"[",
"str",
... | https://github.com/robinhood/faust/blob/01b4c0ad8390221db71751d80001b0fd879291e2/faust/utils/codegen.py#L96-L108 | |
meraki/dashboard-api-python | aef5e6fe5d23a40d435d5c64ff30580a28af07f1 | meraki/api/switch.py | python | Switch.updateNetworkSwitchSettings | (self, networkId: str, **kwargs) | return self._session.put(metadata, resource, payload) | **Update switch network settings**
https://developer.cisco.com/meraki/api-v1/#!update-network-switch-settings
- networkId (string): (required)
- vlan (integer): Management VLAN
- useCombinedPower (boolean): The use Combined Power as the default behavior of secondary power supplies on su... | **Update switch network settings**
https://developer.cisco.com/meraki/api-v1/#!update-network-switch-settings | [
"**",
"Update",
"switch",
"network",
"settings",
"**",
"https",
":",
"//",
"developer",
".",
"cisco",
".",
"com",
"/",
"meraki",
"/",
"api",
"-",
"v1",
"/",
"#!update",
"-",
"network",
"-",
"switch",
"-",
"settings"
] | def updateNetworkSwitchSettings(self, networkId: str, **kwargs):
"""
**Update switch network settings**
https://developer.cisco.com/meraki/api-v1/#!update-network-switch-settings
- networkId (string): (required)
- vlan (integer): Management VLAN
- useCombinedPower (boole... | [
"def",
"updateNetworkSwitchSettings",
"(",
"self",
",",
"networkId",
":",
"str",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
".",
"update",
"(",
"locals",
"(",
")",
")",
"metadata",
"=",
"{",
"'tags'",
":",
"[",
"'switch'",
",",
"'configure'",
",",
"'... | https://github.com/meraki/dashboard-api-python/blob/aef5e6fe5d23a40d435d5c64ff30580a28af07f1/meraki/api/switch.py#L1452-L1474 | |
meraki/dashboard-api-python | aef5e6fe5d23a40d435d5c64ff30580a28af07f1 | meraki/aio/api/appliance.py | python | AsyncAppliance.updateNetworkApplianceFirewallCellularFirewallRules | (self, networkId: str, **kwargs) | return self._session.put(metadata, resource, payload) | **Update the cellular firewall rules of an MX network**
https://developer.cisco.com/meraki/api-v1/#!update-network-appliance-firewall-cellular-firewall-rules
- networkId (string): (required)
- rules (array): An ordered array of the firewall rules (not including the default rule) | **Update the cellular firewall rules of an MX network**
https://developer.cisco.com/meraki/api-v1/#!update-network-appliance-firewall-cellular-firewall-rules | [
"**",
"Update",
"the",
"cellular",
"firewall",
"rules",
"of",
"an",
"MX",
"network",
"**",
"https",
":",
"//",
"developer",
".",
"cisco",
".",
"com",
"/",
"meraki",
"/",
"api",
"-",
"v1",
"/",
"#!update",
"-",
"network",
"-",
"appliance",
"-",
"firewal... | def updateNetworkApplianceFirewallCellularFirewallRules(self, networkId: str, **kwargs):
"""
**Update the cellular firewall rules of an MX network**
https://developer.cisco.com/meraki/api-v1/#!update-network-appliance-firewall-cellular-firewall-rules
- networkId (string): (required)
... | [
"def",
"updateNetworkApplianceFirewallCellularFirewallRules",
"(",
"self",
",",
"networkId",
":",
"str",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
".",
"update",
"(",
"locals",
"(",
")",
")",
"metadata",
"=",
"{",
"'tags'",
":",
"[",
"'appliance'",
",",
... | https://github.com/meraki/dashboard-api-python/blob/aef5e6fe5d23a40d435d5c64ff30580a28af07f1/meraki/aio/api/appliance.py#L208-L228 | |
python/cpython | e13cdca0f5224ec4e23bdd04bb3120506964bc8b | Lib/email/_header_value_parser.py | python | parse_content_type_header | (value) | return ctype | maintype "/" subtype *( ";" parameter )
The maintype and substype are tokens. Theoretically they could
be checked against the official IANA list + x-token, but we
don't do that. | maintype "/" subtype *( ";" parameter ) | [
"maintype",
"/",
"subtype",
"*",
"(",
";",
"parameter",
")"
] | def parse_content_type_header(value):
""" maintype "/" subtype *( ";" parameter )
The maintype and substype are tokens. Theoretically they could
be checked against the official IANA list + x-token, but we
don't do that.
"""
ctype = ContentType()
recover = False
if not value:
ct... | [
"def",
"parse_content_type_header",
"(",
"value",
")",
":",
"ctype",
"=",
"ContentType",
"(",
")",
"recover",
"=",
"False",
"if",
"not",
"value",
":",
"ctype",
".",
"defects",
".",
"append",
"(",
"errors",
".",
"HeaderMissingRequiredValue",
"(",
"\"Missing con... | https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/email/_header_value_parser.py#L2621-L2676 | |
bryanthowell-tableau/tableau_tools | 60881a99a32c7d9e03afbb0e1161deefaa854904 | tableau_rest_api/published_content.py | python | PublishedContent.replicate_permissions_direct_xml | (self, orig_content, username_map=None) | :type orig_content: PublishedContent
:type username_map: dict[unicode, unicode]
:return: | :type orig_content: PublishedContent
:type username_map: dict[unicode, unicode]
:return: | [
":",
"type",
"orig_content",
":",
"PublishedContent",
":",
"type",
"username_map",
":",
"dict",
"[",
"unicode",
"unicode",
"]",
":",
"return",
":"
] | def replicate_permissions_direct_xml(self, orig_content, username_map=None):
"""
:type orig_content: PublishedContent
:type username_map: dict[unicode, unicode]
:return:
"""
self.start_log_block()
self.clear_all_permissions()
# This is for the project Pe... | [
"def",
"replicate_permissions_direct_xml",
"(",
"self",
",",
"orig_content",
",",
"username_map",
"=",
"None",
")",
":",
"self",
".",
"start_log_block",
"(",
")",
"self",
".",
"clear_all_permissions",
"(",
")",
"# This is for the project Permissions. Handle defaults down ... | https://github.com/bryanthowell-tableau/tableau_tools/blob/60881a99a32c7d9e03afbb0e1161deefaa854904/tableau_rest_api/published_content.py#L256-L276 | ||
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/docutils-0.14/docutils/utils/math/math2html.py | python | Options.processoptions | (self) | Process all options parsed. | Process all options parsed. | [
"Process",
"all",
"options",
"parsed",
"."
] | def processoptions(self):
"Process all options parsed."
if Options.help:
self.usage()
if Options.version:
self.showversion()
if Options.hardversion:
self.showhardversion()
if Options.versiondate:
self.showversiondate()
if Options.lyxformat:
self.showlyxformat()
... | [
"def",
"processoptions",
"(",
"self",
")",
":",
"if",
"Options",
".",
"help",
":",
"self",
".",
"usage",
"(",
")",
"if",
"Options",
".",
"version",
":",
"self",
".",
"showversion",
"(",
")",
"if",
"Options",
".",
"hardversion",
":",
"self",
".",
"sho... | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/docutils-0.14/docutils/utils/math/math2html.py#L1131-L1175 | ||
thaines/helit | 04bd36ee0fb6b762c63d746e2cd8813641dceda9 | gmm/mixture.py | python | Mixture.setData | (self,data) | Sets the data for the object, should be same form as returned from getData. | Sets the data for the object, should be same form as returned from getData. | [
"Sets",
"the",
"data",
"for",
"the",
"object",
"should",
"be",
"same",
"form",
"as",
"returned",
"from",
"getData",
"."
] | def setData(self,data):
"""Sets the data for the object, should be same form as returned from getData."""
raise exceptions.NotImplementedError() | [
"def",
"setData",
"(",
"self",
",",
"data",
")",
":",
"raise",
"exceptions",
".",
"NotImplementedError",
"(",
")"
] | https://github.com/thaines/helit/blob/04bd36ee0fb6b762c63d746e2cd8813641dceda9/gmm/mixture.py#L144-L146 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/flask/app.py | python | Flask.route | (self, rule, **options) | return decorator | A decorator that is used to register a view function for a
given URL rule. This does the same thing as :meth:`add_url_rule`
but is intended for decorator usage::
@app.route('/')
def index():
return 'Hello World'
For more information refer to :ref:`url-r... | A decorator that is used to register a view function for a
given URL rule. This does the same thing as :meth:`add_url_rule`
but is intended for decorator usage:: | [
"A",
"decorator",
"that",
"is",
"used",
"to",
"register",
"a",
"view",
"function",
"for",
"a",
"given",
"URL",
"rule",
".",
"This",
"does",
"the",
"same",
"thing",
"as",
":",
"meth",
":",
"add_url_rule",
"but",
"is",
"intended",
"for",
"decorator",
"usag... | def route(self, rule, **options):
"""A decorator that is used to register a view function for a
given URL rule. This does the same thing as :meth:`add_url_rule`
but is intended for decorator usage::
@app.route('/')
def index():
return 'Hello World'
... | [
"def",
"route",
"(",
"self",
",",
"rule",
",",
"*",
"*",
"options",
")",
":",
"def",
"decorator",
"(",
"f",
")",
":",
"endpoint",
"=",
"options",
".",
"pop",
"(",
"'endpoint'",
",",
"None",
")",
"self",
".",
"add_url_rule",
"(",
"rule",
",",
"endpo... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/flask/app.py#L1224-L1252 | |
pytorch/fairseq | 1575f30dd0a9f7b3c499db0b4767aa4e9f79056c | examples/textless_nlp/gslm/unit2speech/tacotron2/text.py | python | text_to_sequence | (text, cleaner_names) | return sequence | Converts a string of text to a sequence of IDs corresponding to the symbols in the text.
The text can optionally have ARPAbet sequences enclosed in curly braces embedded
in it. For example, "Turn left on {HH AW1 S S T AH0 N} Street."
Args:
text: string to convert to a sequence
cleaner_names: n... | Converts a string of text to a sequence of IDs corresponding to the symbols in the text. | [
"Converts",
"a",
"string",
"of",
"text",
"to",
"a",
"sequence",
"of",
"IDs",
"corresponding",
"to",
"the",
"symbols",
"in",
"the",
"text",
"."
] | def text_to_sequence(text, cleaner_names):
'''Converts a string of text to a sequence of IDs corresponding to the symbols in the text.
The text can optionally have ARPAbet sequences enclosed in curly braces embedded
in it. For example, "Turn left on {HH AW1 S S T AH0 N} Street."
Args:
text: string... | [
"def",
"text_to_sequence",
"(",
"text",
",",
"cleaner_names",
")",
":",
"sequence",
"=",
"[",
"]",
"# Check for curly braces and treat their contents as ARPAbet:",
"while",
"len",
"(",
"text",
")",
":",
"m",
"=",
"_curly_re",
".",
"match",
"(",
"text",
")",
"if"... | https://github.com/pytorch/fairseq/blob/1575f30dd0a9f7b3c499db0b4767aa4e9f79056c/examples/textless_nlp/gslm/unit2speech/tacotron2/text.py#L19-L44 | |
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/oauth2client-4.1.3/oauth2client/client.py | python | DeviceFlowInfo.FromResponse | (cls, response) | return cls(**kwargs) | Create a DeviceFlowInfo from a server response.
The response should be a dict containing entries as described here:
http://tools.ietf.org/html/draft-ietf-oauth-v2-05#section-3.7.1 | Create a DeviceFlowInfo from a server response. | [
"Create",
"a",
"DeviceFlowInfo",
"from",
"a",
"server",
"response",
"."
] | def FromResponse(cls, response):
"""Create a DeviceFlowInfo from a server response.
The response should be a dict containing entries as described here:
http://tools.ietf.org/html/draft-ietf-oauth-v2-05#section-3.7.1
"""
# device_code, user_code, and verification_url are require... | [
"def",
"FromResponse",
"(",
"cls",
",",
"response",
")",
":",
"# device_code, user_code, and verification_url are required.",
"kwargs",
"=",
"{",
"'device_code'",
":",
"response",
"[",
"'device_code'",
"]",
",",
"'user_code'",
":",
"response",
"[",
"'user_code'",
"]",... | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/oauth2client-4.1.3/oauth2client/client.py#L1746-L1775 | |
olivierkes/manuskript | 2b992e70c617325013e347b470246af66f6d2690 | manuskript/models/plotModel.py | python | plotModel.removeSubPlot | (self) | Remove all selected subplots / plot steps, in mw.lstSubPlots. | Remove all selected subplots / plot steps, in mw.lstSubPlots. | [
"Remove",
"all",
"selected",
"subplots",
"/",
"plot",
"steps",
"in",
"mw",
".",
"lstSubPlots",
"."
] | def removeSubPlot(self):
"""
Remove all selected subplots / plot steps, in mw.lstSubPlots.
"""
parent = self.mw.lstSubPlots.rootIndex()
if not parent.isValid():
return
parentItem = self.itemFromIndex(parent)
while self.mw.lstSubPlots.selectionModel().... | [
"def",
"removeSubPlot",
"(",
"self",
")",
":",
"parent",
"=",
"self",
".",
"mw",
".",
"lstSubPlots",
".",
"rootIndex",
"(",
")",
"if",
"not",
"parent",
".",
"isValid",
"(",
")",
":",
"return",
"parentItem",
"=",
"self",
".",
"itemFromIndex",
"(",
"pare... | https://github.com/olivierkes/manuskript/blob/2b992e70c617325013e347b470246af66f6d2690/manuskript/models/plotModel.py#L198-L209 | ||
pythonarcade/arcade | 1ee3eb1900683213e8e8df93943327c2ea784564 | arcade/examples/array_backed_grid.py | python | MyGame.__init__ | (self, width, height, title) | Set up the application. | Set up the application. | [
"Set",
"up",
"the",
"application",
"."
] | def __init__(self, width, height, title):
"""
Set up the application.
"""
super().__init__(width, height, title)
# Create a 2 dimensional array. A two dimensional
# array is simply a list of lists.
self.grid = []
for row in range(ROW_COUNT):
... | [
"def",
"__init__",
"(",
"self",
",",
"width",
",",
"height",
",",
"title",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"width",
",",
"height",
",",
"title",
")",
"# Create a 2 dimensional array. A two dimensional",
"# array is simply a list of lists.",
"sel... | https://github.com/pythonarcade/arcade/blob/1ee3eb1900683213e8e8df93943327c2ea784564/arcade/examples/array_backed_grid.py#L41-L58 | ||
wummel/linkchecker | c2ce810c3fb00b895a841a7be6b2e78c64e7b042 | linkcheck/plugins/markdowncheck.py | python | MarkdownCheck.applies_to | (self, url_data, pagetype=None) | return self.filename_re.search(url_data.base_url) is not None | Check for Markdown file. | Check for Markdown file. | [
"Check",
"for",
"Markdown",
"file",
"."
] | def applies_to(self, url_data, pagetype=None):
"""Check for Markdown file."""
return self.filename_re.search(url_data.base_url) is not None | [
"def",
"applies_to",
"(",
"self",
",",
"url_data",
",",
"pagetype",
"=",
"None",
")",
":",
"return",
"self",
".",
"filename_re",
".",
"search",
"(",
"url_data",
".",
"base_url",
")",
"is",
"not",
"None"
] | https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/linkcheck/plugins/markdowncheck.py#L91-L93 | |
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | apps/beeswax/gen-py/hive_metastore/ThriftHiveMetastore.py | python | Client.show_compact | (self, rqst) | return self.recv_show_compact() | Parameters:
- rqst | Parameters:
- rqst | [
"Parameters",
":",
"-",
"rqst"
] | def show_compact(self, rqst):
"""
Parameters:
- rqst
"""
self.send_show_compact(rqst)
return self.recv_show_compact() | [
"def",
"show_compact",
"(",
"self",
",",
"rqst",
")",
":",
"self",
".",
"send_show_compact",
"(",
"rqst",
")",
"return",
"self",
".",
"recv_show_compact",
"(",
")"
] | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/apps/beeswax/gen-py/hive_metastore/ThriftHiveMetastore.py#L6554-L6561 | |
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | lib/mako/_ast_util.py | python | SourceGenerator.decorators | (self, node) | [] | def decorators(self, node):
for decorator in node.decorator_list:
self.newline()
self.write("@")
self.visit(decorator) | [
"def",
"decorators",
"(",
"self",
",",
"node",
")",
":",
"for",
"decorator",
"in",
"node",
".",
"decorator_list",
":",
"self",
".",
"newline",
"(",
")",
"self",
".",
"write",
"(",
"\"@\"",
")",
"self",
".",
"visit",
"(",
"decorator",
")"
] | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/mako/_ast_util.py#L274-L278 | ||||
myaooo/RNNVis | 3bb2b099f236648d77885cc19e6cda5d85d6db28 | rnnvis/rnn/config_utils.py | python | TrainConfig.load | (file_or_dict) | return TrainConfig(**config_dict) | Load an TrainConfig from config file
:param file_path: path of the config file
:return: an instance of TrainConfig | Load an TrainConfig from config file
:param file_path: path of the config file
:return: an instance of TrainConfig | [
"Load",
"an",
"TrainConfig",
"from",
"config",
"file",
":",
"param",
"file_path",
":",
"path",
"of",
"the",
"config",
"file",
":",
"return",
":",
"an",
"instance",
"of",
"TrainConfig"
] | def load(file_or_dict):
"""
Load an TrainConfig from config file
:param file_path: path of the config file
:return: an instance of TrainConfig
"""
if isinstance(file_or_dict, dict):
config_dict = file_or_dict['train']
else:
with open(file_o... | [
"def",
"load",
"(",
"file_or_dict",
")",
":",
"if",
"isinstance",
"(",
"file_or_dict",
",",
"dict",
")",
":",
"config_dict",
"=",
"file_or_dict",
"[",
"'train'",
"]",
"else",
":",
"with",
"open",
"(",
"file_or_dict",
")",
"as",
"f",
":",
"try",
":",
"c... | https://github.com/myaooo/RNNVis/blob/3bb2b099f236648d77885cc19e6cda5d85d6db28/rnnvis/rnn/config_utils.py#L171-L185 | |
CatalinVoss/cnn-assignments | 908e977d905711483c974186821079c15090a24c | assignment1/cs231n/data_utils.py | python | load_CIFAR10 | (ROOT) | return Xtr, Ytr, Xte, Yte | load all of cifar | load all of cifar | [
"load",
"all",
"of",
"cifar"
] | def load_CIFAR10(ROOT):
""" load all of cifar """
xs = []
ys = []
for b in range(1,6):
f = os.path.join(ROOT, 'data_batch_%d' % (b, ))
X, Y = load_CIFAR_batch(f)
xs.append(X)
ys.append(Y)
Xtr = np.concatenate(xs)
Ytr = np.concatenate(ys)
del X, Y
Xte, Yte = load_CIFAR_batch(os.path.j... | [
"def",
"load_CIFAR10",
"(",
"ROOT",
")",
":",
"xs",
"=",
"[",
"]",
"ys",
"=",
"[",
"]",
"for",
"b",
"in",
"range",
"(",
"1",
",",
"6",
")",
":",
"f",
"=",
"os",
".",
"path",
".",
"join",
"(",
"ROOT",
",",
"'data_batch_%d'",
"%",
"(",
"b",
"... | https://github.com/CatalinVoss/cnn-assignments/blob/908e977d905711483c974186821079c15090a24c/assignment1/cs231n/data_utils.py#L15-L28 | |
Azure/azure-devops-cli-extension | 11334cd55806bef0b99c3bee5a438eed71e44037 | azure-devops/azext_devops/devops_sdk/released/policy/policy_client.py | python | PolicyClient.get_policy_configurations | (self, project, scope=None, top=None, continuation_token=None, policy_type=None) | return self.GetPolicyConfigurationsResponseValue(response_value, continuation_token) | GetPolicyConfigurations.
Get a list of policy configurations in a project.
:param str project: Project ID or project name
:param str scope: [Provided for legacy reasons] The scope on which a subset of policies is defined.
:param int top: Maximum number of policies to return.
:par... | GetPolicyConfigurations.
Get a list of policy configurations in a project.
:param str project: Project ID or project name
:param str scope: [Provided for legacy reasons] The scope on which a subset of policies is defined.
:param int top: Maximum number of policies to return.
:par... | [
"GetPolicyConfigurations",
".",
"Get",
"a",
"list",
"of",
"policy",
"configurations",
"in",
"a",
"project",
".",
":",
"param",
"str",
"project",
":",
"Project",
"ID",
"or",
"project",
"name",
":",
"param",
"str",
"scope",
":",
"[",
"Provided",
"for",
"lega... | def get_policy_configurations(self, project, scope=None, top=None, continuation_token=None, policy_type=None):
"""GetPolicyConfigurations.
Get a list of policy configurations in a project.
:param str project: Project ID or project name
:param str scope: [Provided for legacy reasons] The ... | [
"def",
"get_policy_configurations",
"(",
"self",
",",
"project",
",",
"scope",
"=",
"None",
",",
"top",
"=",
"None",
",",
"continuation_token",
"=",
"None",
",",
"policy_type",
"=",
"None",
")",
":",
"route_values",
"=",
"{",
"}",
"if",
"project",
"is",
... | https://github.com/Azure/azure-devops-cli-extension/blob/11334cd55806bef0b99c3bee5a438eed71e44037/azure-devops/azext_devops/devops_sdk/released/policy/policy_client.py#L83-L112 | |
tensorflow/quantum | 864f9ce0774d7e58fb3b4c7d0b12d810042a2dbd | benchmarks/scripts/benchmark_random_circuit.py | python | RandomCircuitBenchmarksTest.testBenchmarkRandomCircuit | (self, params) | Test that Op constructs and runs correctly. | Test that Op constructs and runs correctly. | [
"Test",
"that",
"Op",
"constructs",
"and",
"runs",
"correctly",
"."
] | def testBenchmarkRandomCircuit(self, params):
"""Test that Op constructs and runs correctly."""
proto_file_path = os.path.join(
SRC, "reports/",
"RandomCircuitBenchmarks.benchmark_random_circuit_{}_{}_{}".format(
params.n_rows, params.n_cols, params.n_moments))
... | [
"def",
"testBenchmarkRandomCircuit",
"(",
"self",
",",
"params",
")",
":",
"proto_file_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"SRC",
",",
"\"reports/\"",
",",
"\"RandomCircuitBenchmarks.benchmark_random_circuit_{}_{}_{}\"",
".",
"format",
"(",
"params",
".... | https://github.com/tensorflow/quantum/blob/864f9ce0774d7e58fb3b4c7d0b12d810042a2dbd/benchmarks/scripts/benchmark_random_circuit.py#L52-L74 | ||
tav/pylibs | 3c16b843681f54130ee6a022275289cadb2f2a69 | docutils/writers/latex2e/__init__.py | python | Table.get_column_width | (self) | return '%.2f\\DUtablewidth' % self._col_width[self._cell_in_row-1] | Return columnwidth for current cell (not multicell). | Return columnwidth for current cell (not multicell). | [
"Return",
"columnwidth",
"for",
"current",
"cell",
"(",
"not",
"multicell",
")",
"."
] | def get_column_width(self):
"""Return columnwidth for current cell (not multicell)."""
return '%.2f\\DUtablewidth' % self._col_width[self._cell_in_row-1] | [
"def",
"get_column_width",
"(",
"self",
")",
":",
"return",
"'%.2f\\\\DUtablewidth'",
"%",
"self",
".",
"_col_width",
"[",
"self",
".",
"_cell_in_row",
"-",
"1",
"]"
] | https://github.com/tav/pylibs/blob/3c16b843681f54130ee6a022275289cadb2f2a69/docutils/writers/latex2e/__init__.py#L727-L729 | |
googleads/google-ads-python | 2a1d6062221f6aad1992a6bcca0e7e4a93d2db86 | examples/campaign_management/add_complete_campaigns_using_batch_job.py | python | _build_campaign_budget_operation | (client, customer_id) | return campaign_budget_operation | Builds a new campaign budget operation for the given customer ID.
Args:
client: an initialized GoogleAdsClient instance.
customer_id: a str of a customer ID.
Returns: a CampaignBudgetOperation instance. | Builds a new campaign budget operation for the given customer ID. | [
"Builds",
"a",
"new",
"campaign",
"budget",
"operation",
"for",
"the",
"given",
"customer",
"ID",
"."
] | def _build_campaign_budget_operation(client, customer_id):
"""Builds a new campaign budget operation for the given customer ID.
Args:
client: an initialized GoogleAdsClient instance.
customer_id: a str of a customer ID.
Returns: a CampaignBudgetOperation instance.
"""
campaign_budg... | [
"def",
"_build_campaign_budget_operation",
"(",
"client",
",",
"customer_id",
")",
":",
"campaign_budget_service",
"=",
"client",
".",
"get_service",
"(",
"\"CampaignBudgetService\"",
")",
"campaign_budget_operation",
"=",
"client",
".",
"get_type",
"(",
"\"CampaignBudget... | https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/examples/campaign_management/add_complete_campaigns_using_batch_job.py#L252-L274 | |
briancappello/flask-react-spa | b9e4c4b6b27e22e4273d4b4857d78717cdbdc1cc | backend/commands/clean.py | python | clean | () | Recursively remove *.pyc and *.pyo files. | Recursively remove *.pyc and *.pyo files. | [
"Recursively",
"remove",
"*",
".",
"pyc",
"and",
"*",
".",
"pyo",
"files",
"."
] | def clean():
"""Recursively remove *.pyc and *.pyo files."""
for dirpath, dirnames, filenames in os.walk('.'):
for filename in filenames:
if filename.endswith('.pyc') or filename.endswith('.pyo'):
filepath = os.path.join(dirpath, filename)
click.echo(f'Removin... | [
"def",
"clean",
"(",
")",
":",
"for",
"dirpath",
",",
"dirnames",
",",
"filenames",
"in",
"os",
".",
"walk",
"(",
"'.'",
")",
":",
"for",
"filename",
"in",
"filenames",
":",
"if",
"filename",
".",
"endswith",
"(",
"'.pyc'",
")",
"or",
"filename",
"."... | https://github.com/briancappello/flask-react-spa/blob/b9e4c4b6b27e22e4273d4b4857d78717cdbdc1cc/backend/commands/clean.py#L10-L17 | ||
ales-tsurko/cells | 4cf7e395cd433762bea70cdc863a346f3a6fe1d0 | packaging/macos/python/lib/python3.7/site-packages/setuptools/command/easy_install.py | python | easy_install.install_script | (self, dist, script_name, script_text, dev_path=None) | Generate a legacy script wrapper and install it | Generate a legacy script wrapper and install it | [
"Generate",
"a",
"legacy",
"script",
"wrapper",
"and",
"install",
"it"
] | def install_script(self, dist, script_name, script_text, dev_path=None):
"""Generate a legacy script wrapper and install it"""
spec = str(dist.as_requirement())
is_script = is_python_script(script_text, script_name)
if is_script:
body = self._load_template(dev_path) % locals... | [
"def",
"install_script",
"(",
"self",
",",
"dist",
",",
"script_name",
",",
"script_text",
",",
"dev_path",
"=",
"None",
")",
":",
"spec",
"=",
"str",
"(",
"dist",
".",
"as_requirement",
"(",
")",
")",
"is_script",
"=",
"is_python_script",
"(",
"script_tex... | https://github.com/ales-tsurko/cells/blob/4cf7e395cd433762bea70cdc863a346f3a6fe1d0/packaging/macos/python/lib/python3.7/site-packages/setuptools/command/easy_install.py#L803-L811 | ||
mchristopher/PokemonGo-DesktopMap | ec37575f2776ee7d64456e2a1f6b6b78830b4fe0 | app/pywin/Lib/decimal.py | python | Decimal.rotate | (self, other, context=None) | return _dec_from_triple(self._sign,
rotated.lstrip('0') or '0', self._exp) | Returns a rotated copy of self, value-of-other times. | Returns a rotated copy of self, value-of-other times. | [
"Returns",
"a",
"rotated",
"copy",
"of",
"self",
"value",
"-",
"of",
"-",
"other",
"times",
"."
] | def rotate(self, other, context=None):
"""Returns a rotated copy of self, value-of-other times."""
if context is None:
context = getcontext()
other = _convert_other(other, raiseit=True)
ans = self._check_nans(other, context)
if ans:
return ans
i... | [
"def",
"rotate",
"(",
"self",
",",
"other",
",",
"context",
"=",
"None",
")",
":",
"if",
"context",
"is",
"None",
":",
"context",
"=",
"getcontext",
"(",
")",
"other",
"=",
"_convert_other",
"(",
"other",
",",
"raiseit",
"=",
"True",
")",
"ans",
"=",... | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/ec37575f2776ee7d64456e2a1f6b6b78830b4fe0/app/pywin/Lib/decimal.py#L3531-L3562 | |
blackfeather-wang/ISDA-for-Deep-Networks | b66a594482557dada126211d65a4e9b6f4328423 | Semantic segmentation on Cityscapes/networks/pspnet_isda.py | python | conv3x3 | (in_planes, out_planes, stride=1) | return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride,
padding=1, bias=False) | 3x3 convolution with padding | 3x3 convolution with padding | [
"3x3",
"convolution",
"with",
"padding"
] | def conv3x3(in_planes, out_planes, stride=1):
"3x3 convolution with padding"
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride,
padding=1, bias=False) | [
"def",
"conv3x3",
"(",
"in_planes",
",",
"out_planes",
",",
"stride",
"=",
"1",
")",
":",
"return",
"nn",
".",
"Conv2d",
"(",
"in_planes",
",",
"out_planes",
",",
"kernel_size",
"=",
"3",
",",
"stride",
"=",
"stride",
",",
"padding",
"=",
"1",
",",
"... | https://github.com/blackfeather-wang/ISDA-for-Deep-Networks/blob/b66a594482557dada126211d65a4e9b6f4328423/Semantic segmentation on Cityscapes/networks/pspnet_isda.py#L20-L23 | |
OpenMDAO/OpenMDAO-Framework | f2e37b7de3edeaaeb2d251b375917adec059db9b | openmdao.main/src/openmdao/main/component.py | python | Component.linearize | (self, first=False, second=False) | return J | Component wrapper for the ProvideJ hook. This function should not
be overriden.
first: Bool
Set to True to calculate first derivatives.
second: Bool
Set to True to calculate second derivatives. This is not cuurrently supported. | Component wrapper for the ProvideJ hook. This function should not
be overriden. | [
"Component",
"wrapper",
"for",
"the",
"ProvideJ",
"hook",
".",
"This",
"function",
"should",
"not",
"be",
"overriden",
"."
] | def linearize(self, first=False, second=False):
"""Component wrapper for the ProvideJ hook. This function should not
be overriden.
first: Bool
Set to True to calculate first derivatives.
second: Bool
Set to True to calculate second derivatives. This is not cuurr... | [
"def",
"linearize",
"(",
"self",
",",
"first",
"=",
"False",
",",
"second",
"=",
"False",
")",
":",
"J",
"=",
"None",
"# Allow user to force finite difference on a comp.",
"if",
"self",
".",
"force_fd",
"is",
"True",
":",
"return",
"# Calculate first derivatives u... | https://github.com/OpenMDAO/OpenMDAO-Framework/blob/f2e37b7de3edeaaeb2d251b375917adec059db9b/openmdao.main/src/openmdao/main/component.py#L483-L507 | |
Supervisor/supervisor | 7de6215c9677d1418e7f0a72e7065c1fa69174d4 | supervisor/medusa/http_server.py | python | http_request.done | (self) | finalize this transaction - send output to the http channel | finalize this transaction - send output to the http channel | [
"finalize",
"this",
"transaction",
"-",
"send",
"output",
"to",
"the",
"http",
"channel"
] | def done (self):
"""finalize this transaction - send output to the http channel"""
# ----------------------------------------
# persistent connection management
# ----------------------------------------
# --- BUCKLE UP! ----
connection = get_header(CONNECTION, self.h... | [
"def",
"done",
"(",
"self",
")",
":",
"# ----------------------------------------",
"# persistent connection management",
"# ----------------------------------------",
"# --- BUCKLE UP! ----",
"connection",
"=",
"get_header",
"(",
"CONNECTION",
",",
"self",
".",
"header",
")",... | https://github.com/Supervisor/supervisor/blob/7de6215c9677d1418e7f0a72e7065c1fa69174d4/supervisor/medusa/http_server.py#L296-L370 | ||
django-erp/django-erp | 7783404723a3070b391e8a65525ad5d7e456a626 | djangoerp/core/utils/__init__.py | python | set_path_kwargs | (request, **kwargs) | return path | Adds/sets the given kwargs to request path and returns the result.
If a kwarg's value is None, it will be removed from path. | Adds/sets the given kwargs to request path and returns the result.
If a kwarg's value is None, it will be removed from path. | [
"Adds",
"/",
"sets",
"the",
"given",
"kwargs",
"to",
"request",
"path",
"and",
"returns",
"the",
"result",
".",
"If",
"a",
"kwarg",
"s",
"value",
"is",
"None",
"it",
"will",
"be",
"removed",
"from",
"path",
"."
] | def set_path_kwargs(request, **kwargs):
"""Adds/sets the given kwargs to request path and returns the result.
If a kwarg's value is None, it will be removed from path.
"""
path = request.META['PATH_INFO']
path_kwargs = {}
for k, v in list(request.GET.items()):
if not k in kwarg... | [
"def",
"set_path_kwargs",
"(",
"request",
",",
"*",
"*",
"kwargs",
")",
":",
"path",
"=",
"request",
".",
"META",
"[",
"'PATH_INFO'",
"]",
"path_kwargs",
"=",
"{",
"}",
"for",
"k",
",",
"v",
"in",
"list",
"(",
"request",
".",
"GET",
".",
"items",
"... | https://github.com/django-erp/django-erp/blob/7783404723a3070b391e8a65525ad5d7e456a626/djangoerp/core/utils/__init__.py#L32-L53 | |
maas/maas | db2f89970c640758a51247c59bf1ec6f60cf4ab5 | src/maasserver/preseed_network.py | python | InterfaceConfiguration._generate_bridge_operation | (self, version=1) | return bridge_operation | Generate bridge operation for this interface. | Generate bridge operation for this interface. | [
"Generate",
"bridge",
"operation",
"for",
"this",
"interface",
"."
] | def _generate_bridge_operation(self, version=1):
"""Generate bridge operation for this interface."""
addrs = self._generate_addresses(version=version)
bridge_operation = self._get_initial_params()
if version == 1:
bridge_operation.update(
{
... | [
"def",
"_generate_bridge_operation",
"(",
"self",
",",
"version",
"=",
"1",
")",
":",
"addrs",
"=",
"self",
".",
"_generate_addresses",
"(",
"version",
"=",
"version",
")",
"bridge_operation",
"=",
"self",
".",
"_get_initial_params",
"(",
")",
"if",
"version",... | https://github.com/maas/maas/blob/db2f89970c640758a51247c59bf1ec6f60cf4ab5/src/maasserver/preseed_network.py#L499-L541 | |
nodesign/weio | 1d67d705a5c36a2e825ad13feab910b0aca9a2e8 | weioLib/weioGpio.py | python | WeioGpio.pwmWrite | (self, pin, value) | Pulse with modulation is available at 6 pins from 19-24 and has 16bits of precision. By default WeIO sets PWM frequency at 20000ms and 8bit precision or from 0-255. This setup is well situated for driving LED lighting. Precision and frequency can be changed separately by calling additional functions for other uses : se... | Pulse with modulation is available at 6 pins from 19-24 and has 16bits of precision. By default WeIO sets PWM frequency at 20000ms and 8bit precision or from 0-255. This setup is well situated for driving LED lighting. Precision and frequency can be changed separately by calling additional functions for other uses : se... | [
"Pulse",
"with",
"modulation",
"is",
"available",
"at",
"6",
"pins",
"from",
"19",
"-",
"24",
"and",
"has",
"16bits",
"of",
"precision",
".",
"By",
"default",
"WeIO",
"sets",
"PWM",
"frequency",
"at",
"20000ms",
"and",
"8bit",
"precision",
"or",
"from",
... | def pwmWrite(self, pin, value) :
"""Pulse with modulation is available at 6 pins from 19-24 and has 16bits of precision. By default WeIO sets PWM frequency at 20000ms and 8bit precision or from 0-255. This setup is well situated for driving LED lighting. Precision and frequency can be changed separately by call... | [
"def",
"pwmWrite",
"(",
"self",
",",
"pin",
",",
"value",
")",
":",
"weioRunnerGlobals",
".",
"DECLARED_PINS",
"[",
"pin",
"]",
"=",
"GPIO",
".",
"OUTPUT",
"pwm",
"=",
"self",
".",
"u",
".",
"PWM",
"(",
"pin",
")",
"pwm",
".",
"set_duty_cycle",
"(",
... | https://github.com/nodesign/weio/blob/1d67d705a5c36a2e825ad13feab910b0aca9a2e8/weioLib/weioGpio.py#L166-L170 | ||
JulianEberius/SublimeRope | c6ac5179ce8c1e7af0c2c1134589f945252c362d | rope/base/resources.py | python | Resource.name | (self) | return self.path.split('/')[-1] | Return the name of this resource | Return the name of this resource | [
"Return",
"the",
"name",
"of",
"this",
"resource"
] | def name(self):
"""Return the name of this resource"""
return self.path.split('/')[-1] | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"path",
".",
"split",
"(",
"'/'",
")",
"[",
"-",
"1",
"]"
] | https://github.com/JulianEberius/SublimeRope/blob/c6ac5179ce8c1e7af0c2c1134589f945252c362d/rope/base/resources.py#L50-L52 | |
jeongyoonlee/Kaggler | 71370d3dabcf27d23b29b369e73c6f62eb894c7a | kaggler/preprocessing/categorical.py | python | OneHotEncoder.fit_transform | (self, X, y=None) | return self.transform(X) | Encode categorical columns into sparse matrix with one-hot-encoding.
Args:
X (pandas.DataFrame): categorical columns to encode
Returns:
sparse matrix encoding categorical variables into dummy variables | Encode categorical columns into sparse matrix with one-hot-encoding. | [
"Encode",
"categorical",
"columns",
"into",
"sparse",
"matrix",
"with",
"one",
"-",
"hot",
"-",
"encoding",
"."
] | def fit_transform(self, X, y=None):
"""Encode categorical columns into sparse matrix with one-hot-encoding.
Args:
X (pandas.DataFrame): categorical columns to encode
Returns:
sparse matrix encoding categorical variables into dummy variables
"""
self.lab... | [
"def",
"fit_transform",
"(",
"self",
",",
"X",
",",
"y",
"=",
"None",
")",
":",
"self",
".",
"label_encoder",
".",
"fit",
"(",
"X",
")",
"return",
"self",
".",
"transform",
"(",
"X",
")"
] | https://github.com/jeongyoonlee/Kaggler/blob/71370d3dabcf27d23b29b369e73c6f62eb894c7a/kaggler/preprocessing/categorical.py#L225-L237 | |
clinton-hall/nzbToMedia | 27669389216902d1085660167e7bda0bd8527ecf | libs/common/validate.py | python | is_list | (value, min=None, max=None) | return list(value) | Check that the value is a list of values.
You can optionally specify the minimum and maximum number of members.
It does no check on list members.
>>> vtor.check('list', ())
[]
>>> vtor.check('list', [])
[]
>>> vtor.check('list', (1, 2))
[1, 2]
>>> vtor.check('list', [1... | Check that the value is a list of values.
You can optionally specify the minimum and maximum number of members.
It does no check on list members.
>>> vtor.check('list', ())
[]
>>> vtor.check('list', [])
[]
>>> vtor.check('list', (1, 2))
[1, 2]
>>> vtor.check('list', [1... | [
"Check",
"that",
"the",
"value",
"is",
"a",
"list",
"of",
"values",
".",
"You",
"can",
"optionally",
"specify",
"the",
"minimum",
"and",
"maximum",
"number",
"of",
"members",
".",
"It",
"does",
"no",
"check",
"on",
"list",
"members",
".",
">>>",
"vtor",
... | def is_list(value, min=None, max=None):
"""
Check that the value is a list of values.
You can optionally specify the minimum and maximum number of members.
It does no check on list members.
>>> vtor.check('list', ())
[]
>>> vtor.check('list', [])
[]
>>> vtor.check('lis... | [
"def",
"is_list",
"(",
"value",
",",
"min",
"=",
"None",
",",
"max",
"=",
"None",
")",
":",
"(",
"min_len",
",",
"max_len",
")",
"=",
"_is_num_param",
"(",
"(",
"'min'",
",",
"'max'",
")",
",",
"(",
"min",
",",
"max",
")",
")",
"if",
"isinstance"... | https://github.com/clinton-hall/nzbToMedia/blob/27669389216902d1085660167e7bda0bd8527ecf/libs/common/validate.py#L994-L1036 | |
Xilinx/brevitas | 32cc847fc7cd6ca4c0201fd6b7d185c1103ae088 | src/brevitas/fx/backport/torch_function/signatures.py | python | get_testing_overrides | () | return ret | Return a dict containing dummy overrides for all overridable functions
Returns
-------
A dictionary that maps overridable functions in the PyTorch API to
lambda functions that have the same signature as the real function
and unconditionally return -1. These lambda functions are useful
for testi... | Return a dict containing dummy overrides for all overridable functions | [
"Return",
"a",
"dict",
"containing",
"dummy",
"overrides",
"for",
"all",
"overridable",
"functions"
] | def get_testing_overrides() -> Dict[Callable, Callable]:
"""Return a dict containing dummy overrides for all overridable functions
Returns
-------
A dictionary that maps overridable functions in the PyTorch API to
lambda functions that have the same signature as the real function
and unconditio... | [
"def",
"get_testing_overrides",
"(",
")",
"->",
"Dict",
"[",
"Callable",
",",
"Callable",
"]",
":",
"# Every function in the PyTorch API that can be overriden needs an entry",
"# in this dict.",
"#",
"# Optimally we would use inspect to get the function signature and define",
"# the ... | https://github.com/Xilinx/brevitas/blob/32cc847fc7cd6ca4c0201fd6b7d185c1103ae088/src/brevitas/fx/backport/torch_function/signatures.py#L761-L782 | |
jerryli27/TwinGAN | 4e5593445778dfb77af9f815b3f4fcafc35758dc | util_misc.py | python | safe_one_hot_encoding | (tensor, num_classes, dtype=None) | return tensor | Given a (possibly out of range) vector of labels, transform them into one-hot encoding. | Given a (possibly out of range) vector of labels, transform them into one-hot encoding. | [
"Given",
"a",
"(",
"possibly",
"out",
"of",
"range",
")",
"vector",
"of",
"labels",
"transform",
"them",
"into",
"one",
"-",
"hot",
"encoding",
"."
] | def safe_one_hot_encoding(tensor, num_classes, dtype=None):
"""Given a (possibly out of range) vector of labels, transform them into one-hot encoding."""
one_hot_encoded = slim.one_hot_encoding(
tensor, num_classes, on_value=tf.constant(1, tf.int64),
off_value=tf.constant(0, tf.int64))
# This makes sure ... | [
"def",
"safe_one_hot_encoding",
"(",
"tensor",
",",
"num_classes",
",",
"dtype",
"=",
"None",
")",
":",
"one_hot_encoded",
"=",
"slim",
".",
"one_hot_encoding",
"(",
"tensor",
",",
"num_classes",
",",
"on_value",
"=",
"tf",
".",
"constant",
"(",
"1",
",",
... | https://github.com/jerryli27/TwinGAN/blob/4e5593445778dfb77af9f815b3f4fcafc35758dc/util_misc.py#L89-L101 | |
pandas-dev/pandas | 5ba7d714014ae8feaccc0dd4a98890828cf2832d | pandas/core/series.py | python | Series.between | (self, left, right, inclusive="both") | return lmask & rmask | Return boolean Series equivalent to left <= series <= right.
This function returns a boolean vector containing `True` wherever the
corresponding Series element is between the boundary values `left` and
`right`. NA values are treated as `False`.
Parameters
----------
lef... | Return boolean Series equivalent to left <= series <= right. | [
"Return",
"boolean",
"Series",
"equivalent",
"to",
"left",
"<",
"=",
"series",
"<",
"=",
"right",
"."
] | def between(self, left, right, inclusive="both") -> Series:
"""
Return boolean Series equivalent to left <= series <= right.
This function returns a boolean vector containing `True` wherever the
corresponding Series element is between the boundary values `left` and
`right`. NA v... | [
"def",
"between",
"(",
"self",
",",
"left",
",",
"right",
",",
"inclusive",
"=",
"\"both\"",
")",
"->",
"Series",
":",
"if",
"inclusive",
"is",
"True",
"or",
"inclusive",
"is",
"False",
":",
"warnings",
".",
"warn",
"(",
"\"Boolean inputs to the `inclusive` ... | https://github.com/pandas-dev/pandas/blob/5ba7d714014ae8feaccc0dd4a98890828cf2832d/pandas/core/series.py#L5140-L5237 | |
yeephycho/nasnet-tensorflow | 189e22f2de9d6ee1b4abd0a65275d5e6a6c04c45 | nets/pix2pix.py | python | upsample | (net, num_outputs, kernel_size, method='nn_upsample_conv') | return net | Upsamples the given inputs.
Args:
net: A `Tensor` of size [batch_size, height, width, filters].
num_outputs: The number of output filters.
kernel_size: A list of 2 scalars or a 1x2 `Tensor` indicating the scale,
relative to the inputs, of the output dimensions. For example, if kernel
size is ... | Upsamples the given inputs. | [
"Upsamples",
"the",
"given",
"inputs",
"."
] | def upsample(net, num_outputs, kernel_size, method='nn_upsample_conv'):
"""Upsamples the given inputs.
Args:
net: A `Tensor` of size [batch_size, height, width, filters].
num_outputs: The number of output filters.
kernel_size: A list of 2 scalars or a 1x2 `Tensor` indicating the scale,
relative t... | [
"def",
"upsample",
"(",
"net",
",",
"num_outputs",
",",
"kernel_size",
",",
"method",
"=",
"'nn_upsample_conv'",
")",
":",
"net_shape",
"=",
"tf",
".",
"shape",
"(",
"net",
")",
"height",
"=",
"net_shape",
"[",
"1",
"]",
"width",
"=",
"net_shape",
"[",
... | https://github.com/yeephycho/nasnet-tensorflow/blob/189e22f2de9d6ee1b4abd0a65275d5e6a6c04c45/nets/pix2pix.py#L63-L95 | |
Chaffelson/nipyapi | d3b186fd701ce308c2812746d98af9120955e810 | nipyapi/nifi/models/activate_controller_services_entity.py | python | ActivateControllerServicesEntity.state | (self, state) | Sets the state of this ActivateControllerServicesEntity.
The desired state of the descendant components
:param state: The state of this ActivateControllerServicesEntity.
:type: str | Sets the state of this ActivateControllerServicesEntity.
The desired state of the descendant components | [
"Sets",
"the",
"state",
"of",
"this",
"ActivateControllerServicesEntity",
".",
"The",
"desired",
"state",
"of",
"the",
"descendant",
"components"
] | def state(self, state):
"""
Sets the state of this ActivateControllerServicesEntity.
The desired state of the descendant components
:param state: The state of this ActivateControllerServicesEntity.
:type: str
"""
allowed_values = ["ENABLED", "DISABLED"]
i... | [
"def",
"state",
"(",
"self",
",",
"state",
")",
":",
"allowed_values",
"=",
"[",
"\"ENABLED\"",
",",
"\"DISABLED\"",
"]",
"if",
"state",
"not",
"in",
"allowed_values",
":",
"raise",
"ValueError",
"(",
"\"Invalid value for `state` ({0}), must be one of {1}\"",
".",
... | https://github.com/Chaffelson/nipyapi/blob/d3b186fd701ce308c2812746d98af9120955e810/nipyapi/nifi/models/activate_controller_services_entity.py#L101-L116 | ||
KunpengLi1994/VSRN | 777ae74326fdb6abe69dbd3911d0e545322520d1 | cocoapi-master/PythonAPI/pycocotools/cocoeval.py | python | COCOeval.evaluateImg | (self, imgId, catId, aRng, maxDet) | return {
'image_id': imgId,
'category_id': catId,
'aRng': aRng,
'maxDet': maxDet,
'dtIds': [d['id'] for d in dt],
'gtIds': [g['id'] for g in gt],
'dtMatches': dtm,
... | perform evaluation for single category and image
:return: dict (single image results) | perform evaluation for single category and image
:return: dict (single image results) | [
"perform",
"evaluation",
"for",
"single",
"category",
"and",
"image",
":",
"return",
":",
"dict",
"(",
"single",
"image",
"results",
")"
] | def evaluateImg(self, imgId, catId, aRng, maxDet):
'''
perform evaluation for single category and image
:return: dict (single image results)
'''
p = self.params
if p.useCats:
gt = self._gts[imgId,catId]
dt = self._dts[imgId,catId]
else:
... | [
"def",
"evaluateImg",
"(",
"self",
",",
"imgId",
",",
"catId",
",",
"aRng",
",",
"maxDet",
")",
":",
"p",
"=",
"self",
".",
"params",
"if",
"p",
".",
"useCats",
":",
"gt",
"=",
"self",
".",
"_gts",
"[",
"imgId",
",",
"catId",
"]",
"dt",
"=",
"s... | https://github.com/KunpengLi1994/VSRN/blob/777ae74326fdb6abe69dbd3911d0e545322520d1/cocoapi-master/PythonAPI/pycocotools/cocoeval.py#L236-L314 | |
cylc/cylc-flow | 5ec221143476c7c616c156b74158edfbcd83794a | cylc/flow/task_outputs.py | python | TaskOutputs.is_incomplete | (self) | return any(
not completed
and trigger in self._required
for trigger, (_, _, completed) in self._by_trigger.items()
) | Return True if any required outputs are not complete. | Return True if any required outputs are not complete. | [
"Return",
"True",
"if",
"any",
"required",
"outputs",
"are",
"not",
"complete",
"."
] | def is_incomplete(self):
"""Return True if any required outputs are not complete."""
return any(
not completed
and trigger in self._required
for trigger, (_, _, completed) in self._by_trigger.items()
) | [
"def",
"is_incomplete",
"(",
"self",
")",
":",
"return",
"any",
"(",
"not",
"completed",
"and",
"trigger",
"in",
"self",
".",
"_required",
"for",
"trigger",
",",
"(",
"_",
",",
"_",
",",
"completed",
")",
"in",
"self",
".",
"_by_trigger",
".",
"items",... | https://github.com/cylc/cylc-flow/blob/5ec221143476c7c616c156b74158edfbcd83794a/cylc/flow/task_outputs.py#L176-L182 | |
brain-research/nngp | aaaebfc3f74a9e6e499751b6355f65360dd64107 | nngp.py | python | NNGPKernel._get_batch_size_and_count | (self, input1, input2) | return batch_size, batch_count | Compute batch size and number to split when input size is large.
Args:
input1: tensor, input tensor to covariance matrix
input2: tensor, second input tensor to covariance matrix
Returns:
batch_size: int, size of each batch
batch_count: int, number of batches | Compute batch size and number to split when input size is large. | [
"Compute",
"batch",
"size",
"and",
"number",
"to",
"split",
"when",
"input",
"size",
"is",
"large",
"."
] | def _get_batch_size_and_count(self, input1, input2):
"""Compute batch size and number to split when input size is large.
Args:
input1: tensor, input tensor to covariance matrix
input2: tensor, second input tensor to covariance matrix
Returns:
batch_size: int, size of each batch
bat... | [
"def",
"_get_batch_size_and_count",
"(",
"self",
",",
"input1",
",",
"input2",
")",
":",
"input1_size",
"=",
"input1",
".",
"shape",
"[",
"0",
"]",
".",
"value",
"input2_size",
"=",
"input2",
".",
"shape",
"[",
"0",
"]",
".",
"value",
"batch_size",
"=",
... | https://github.com/brain-research/nngp/blob/aaaebfc3f74a9e6e499751b6355f65360dd64107/nngp.py#L270-L290 | |
CleanCut/green | 55625649869d44f8c9577f5f10626b1cbdcc48ad | green/loader.py | python | findDottedModuleAndParentDir | (file_path) | return (dotted_module, parent_dir) | I return a tuple (dotted_module, parent_dir) where dotted_module is the
full dotted name of the module with respect to the package it is in, and
parent_dir is the absolute path to the parent directory of the package.
If the python file is not part of a package, I return (None, None).
For for filepath ... | I return a tuple (dotted_module, parent_dir) where dotted_module is the
full dotted name of the module with respect to the package it is in, and
parent_dir is the absolute path to the parent directory of the package. | [
"I",
"return",
"a",
"tuple",
"(",
"dotted_module",
"parent_dir",
")",
"where",
"dotted_module",
"is",
"the",
"full",
"dotted",
"name",
"of",
"the",
"module",
"with",
"respect",
"to",
"the",
"package",
"it",
"is",
"in",
"and",
"parent_dir",
"is",
"the",
"ab... | def findDottedModuleAndParentDir(file_path):
"""
I return a tuple (dotted_module, parent_dir) where dotted_module is the
full dotted name of the module with respect to the package it is in, and
parent_dir is the absolute path to the parent directory of the package.
If the python file is not part of... | [
"def",
"findDottedModuleAndParentDir",
"(",
"file_path",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"file_path",
")",
":",
"raise",
"ValueError",
"(",
"\"'{}' is not a file.\"",
".",
"format",
"(",
"file_path",
")",
")",
"parent_dir",
"=",
... | https://github.com/CleanCut/green/blob/55625649869d44f8c9577f5f10626b1cbdcc48ad/green/loader.py#L439-L458 | |
wbond/packagecontrol.io | 9f5eb7e3392e6bc2ad979ad32d3dd27ef9c00b20 | app/lib/package_control/deps/oscrypto/_win/asymmetric.py | python | PrivateKey.fingerprint | (self) | return self._fingerprint | Creates a fingerprint that can be compared with a public key to see if
the two form a pair.
This fingerprint is not compatible with fingerprints generated by any
other software.
:return:
A byte string that is a sha256 hash of selected components (based
on the ke... | Creates a fingerprint that can be compared with a public key to see if
the two form a pair. | [
"Creates",
"a",
"fingerprint",
"that",
"can",
"be",
"compared",
"with",
"a",
"public",
"key",
"to",
"see",
"if",
"the",
"two",
"form",
"a",
"pair",
"."
] | def fingerprint(self):
"""
Creates a fingerprint that can be compared with a public key to see if
the two form a pair.
This fingerprint is not compatible with fingerprints generated by any
other software.
:return:
A byte string that is a sha256 hash of selec... | [
"def",
"fingerprint",
"(",
"self",
")",
":",
"if",
"self",
".",
"_fingerprint",
"is",
"None",
":",
"self",
".",
"_fingerprint",
"=",
"_fingerprint",
"(",
"self",
".",
"asn1",
",",
"load_private_key",
")",
"return",
"self",
".",
"_fingerprint"
] | https://github.com/wbond/packagecontrol.io/blob/9f5eb7e3392e6bc2ad979ad32d3dd27ef9c00b20/app/lib/package_control/deps/oscrypto/_win/asymmetric.py#L487-L502 | |
albertwy/BiLSTM | 78153783d8f4eae6c193607dca9f482b9a04672a | main_batch.py | python | train | (model, training_data, args, optimizer, criterion) | Prepare data and prediction | Prepare data and prediction | [
"Prepare",
"data",
"and",
"prediction"
] | def train(model, training_data, args, optimizer, criterion):
model.train()
batch_size = args.batch_size
sentences, sentences_seqlen, sentences_mask, labels = training_data
# print batch_size, len(sentences), len(labels)
assert batch_size == len(sentences) == len(labels)
''' Prepare data and... | [
"def",
"train",
"(",
"model",
",",
"training_data",
",",
"args",
",",
"optimizer",
",",
"criterion",
")",
":",
"model",
".",
"train",
"(",
")",
"batch_size",
"=",
"args",
".",
"batch_size",
"sentences",
",",
"sentences_seqlen",
",",
"sentences_mask",
",",
... | https://github.com/albertwy/BiLSTM/blob/78153783d8f4eae6c193607dca9f482b9a04672a/main_batch.py#L120-L145 | ||
titu1994/keras-efficientnets | ea5fa5a3703d25c796f4899c2d018eef6ed52d6c | keras_efficientnets/efficientnet.py | python | round_filters | (filters, width_coefficient, depth_divisor, min_depth) | return int(new_filters) | Round number of filters based on depth multiplier. | Round number of filters based on depth multiplier. | [
"Round",
"number",
"of",
"filters",
"based",
"on",
"depth",
"multiplier",
"."
] | def round_filters(filters, width_coefficient, depth_divisor, min_depth):
"""Round number of filters based on depth multiplier."""
multiplier = float(width_coefficient)
divisor = int(depth_divisor)
min_depth = min_depth
if not multiplier:
return filters
filters *= multiplier
min_dep... | [
"def",
"round_filters",
"(",
"filters",
",",
"width_coefficient",
",",
"depth_divisor",
",",
"min_depth",
")",
":",
"multiplier",
"=",
"float",
"(",
"width_coefficient",
")",
"divisor",
"=",
"int",
"(",
"depth_divisor",
")",
"min_depth",
"=",
"min_depth",
"if",
... | https://github.com/titu1994/keras-efficientnets/blob/ea5fa5a3703d25c796f4899c2d018eef6ed52d6c/keras_efficientnets/efficientnet.py#L55-L71 | |
google/deepvariant | 9cf1c7b0e2342d013180aa153cba3c9331c9aef7 | third_party/nucleus/util/ranges.py | python | bedpe_parser | (filename) | Parses Range objects from a BEDPE-formatted file object.
See http://bedtools.readthedocs.org/en/latest/content/general-usage.html
for more information on the BEDPE format.
Skips events that span across chromosomes. For example, if the starting
location is on chr1 and the ending location is on chr2, that recor... | Parses Range objects from a BEDPE-formatted file object. | [
"Parses",
"Range",
"objects",
"from",
"a",
"BEDPE",
"-",
"formatted",
"file",
"object",
"."
] | def bedpe_parser(filename):
"""Parses Range objects from a BEDPE-formatted file object.
See http://bedtools.readthedocs.org/en/latest/content/general-usage.html
for more information on the BEDPE format.
Skips events that span across chromosomes. For example, if the starting
location is on chr1 and the endin... | [
"def",
"bedpe_parser",
"(",
"filename",
")",
":",
"for",
"line",
"in",
"gfile",
".",
"Open",
"(",
"filename",
")",
":",
"parts",
"=",
"line",
".",
"split",
"(",
"'\\t'",
")",
"if",
"parts",
"[",
"0",
"]",
"==",
"parts",
"[",
"3",
"]",
":",
"# onl... | https://github.com/google/deepvariant/blob/9cf1c7b0e2342d013180aa153cba3c9331c9aef7/third_party/nucleus/util/ranges.py#L423-L443 | ||
kbandla/ImmunityDebugger | 2abc03fb15c8f3ed0914e1175c4d8933977c73e3 | 1.85/Libs/x86smt/sequenceanalyzer.py | python | StateMachine.mergeState | (self, statemachine) | merge a given state machine to the current one, using the current as a base for the new one.
Example:
currentEAX=2
to-mergeEAX=EAX+2
--------
mergedEAX=4 | merge a given state machine to the current one, using the current as a base for the new one.
Example:
currentEAX=2
to-mergeEAX=EAX+2
--------
mergedEAX=4 | [
"merge",
"a",
"given",
"state",
"machine",
"to",
"the",
"current",
"one",
"using",
"the",
"current",
"as",
"a",
"base",
"for",
"the",
"new",
"one",
".",
"Example",
":",
"currentEAX",
"=",
"2",
"to",
"-",
"mergeEAX",
"=",
"EAX",
"+",
"2",
"--------",
... | def mergeState(self, statemachine):
"""
merge a given state machine to the current one, using the current as a base for the new one.
Example:
currentEAX=2
to-mergeEAX=EAX+2
--------
mergedEAX=4
"""
#create our substitution diction... | [
"def",
"mergeState",
"(",
"self",
",",
"statemachine",
")",
":",
"#create our substitution dictionary",
"sub",
"=",
"{",
"}",
"for",
"k",
",",
"v",
"in",
"self",
".",
"regs",
".",
"iteritems",
"(",
")",
":",
"sub",
"[",
"k",
"]",
"=",
"v",
"for",
"k"... | https://github.com/kbandla/ImmunityDebugger/blob/2abc03fb15c8f3ed0914e1175c4d8933977c73e3/1.85/Libs/x86smt/sequenceanalyzer.py#L637-L709 | ||
pyscaffold/pyscaffold | ee61243caf6bbaa0a88e0af11fe50ed0d6d34ae4 | src/pyscaffold/extensions/interactive.py | python | alternative_flags | (action: Action) | return f"(or alternatively: {' '.join(flags)})" if flags else "" | Get the alternative flags (i.e. not the long one) of a :obj:`argparse.Action` | Get the alternative flags (i.e. not the long one) of a :obj:`argparse.Action` | [
"Get",
"the",
"alternative",
"flags",
"(",
"i",
".",
"e",
".",
"not",
"the",
"long",
"one",
")",
"of",
"a",
":",
"obj",
":",
"argparse",
".",
"Action"
] | def alternative_flags(action: Action):
"""Get the alternative flags (i.e. not the long one) of a :obj:`argparse.Action`"""
flags = sorted(action.option_strings, key=len)[:-1]
return f"(or alternatively: {' '.join(flags)})" if flags else "" | [
"def",
"alternative_flags",
"(",
"action",
":",
"Action",
")",
":",
"flags",
"=",
"sorted",
"(",
"action",
".",
"option_strings",
",",
"key",
"=",
"len",
")",
"[",
":",
"-",
"1",
"]",
"return",
"f\"(or alternatively: {' '.join(flags)})\"",
"if",
"flags",
"el... | https://github.com/pyscaffold/pyscaffold/blob/ee61243caf6bbaa0a88e0af11fe50ed0d6d34ae4/src/pyscaffold/extensions/interactive.py#L157-L160 | |
andresriancho/w3af | cd22e5252243a87aaa6d0ddea47cf58dacfe00a9 | w3af/core/ui/gui/profiles.py | python | ProfileList._changeAtempt | (self, widget, event) | return False | Let the user change profile if the actual is saved. | Let the user change profile if the actual is saved. | [
"Let",
"the",
"user",
"change",
"profile",
"if",
"the",
"actual",
"is",
"saved",
"."
] | def _changeAtempt(self, widget, event):
"""Let the user change profile if the actual is saved."""
path = self.get_cursor()[0]
if not path:
return
row = self.liststore[path]
if row[3]:
# The profile is changed
if event.button != 1:
... | [
"def",
"_changeAtempt",
"(",
"self",
",",
"widget",
",",
"event",
")",
":",
"path",
"=",
"self",
".",
"get_cursor",
"(",
")",
"[",
"0",
"]",
"if",
"not",
"path",
":",
"return",
"row",
"=",
"self",
".",
"liststore",
"[",
"path",
"]",
"if",
"row",
... | https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/core/ui/gui/profiles.py#L245-L274 | |
SoCo/SoCo | e83fef84d2645d05265dbd574598518655a9c125 | soco/ms_data_structures.py | python | MusicServiceItem.from_xml | (cls, xml, service, parent_id) | return cls.from_dict(content) | Return a Music Service item generated from xml.
:param xml: Object XML. All items containing text are added to the
content of the item. The class variable ``valid_fields`` of each of
the classes list the valid fields (after translating the camel
case to underscore notation).... | Return a Music Service item generated from xml. | [
"Return",
"a",
"Music",
"Service",
"item",
"generated",
"from",
"xml",
"."
] | def from_xml(cls, xml, service, parent_id):
"""Return a Music Service item generated from xml.
:param xml: Object XML. All items containing text are added to the
content of the item. The class variable ``valid_fields`` of each of
the classes list the valid fields (after translat... | [
"def",
"from_xml",
"(",
"cls",
",",
"xml",
",",
"service",
",",
"parent_id",
")",
":",
"# Add a few extra pieces of information",
"content",
"=",
"{",
"\"description\"",
":",
"service",
".",
"description",
",",
"\"service_id\"",
":",
"service",
".",
"service_id",
... | https://github.com/SoCo/SoCo/blob/e83fef84d2645d05265dbd574598518655a9c125/soco/ms_data_structures.py#L57-L145 | |
pyparallel/pyparallel | 11e8c6072d48c8f13641925d17b147bf36ee0ba3 | Lib/site-packages/pandas-0.17.0-py3.3-win-amd64.egg/pandas/core/algorithms.py | python | isin | (comps, values) | return f(comps, values) | Compute the isin boolean array
Parameters
----------
comps: array-like
values: array-like
Returns
-------
boolean array same length as comps | Compute the isin boolean array | [
"Compute",
"the",
"isin",
"boolean",
"array"
] | def isin(comps, values):
"""
Compute the isin boolean array
Parameters
----------
comps: array-like
values: array-like
Returns
-------
boolean array same length as comps
"""
if not com.is_list_like(comps):
raise TypeError("only list-like objects are allowed to be p... | [
"def",
"isin",
"(",
"comps",
",",
"values",
")",
":",
"if",
"not",
"com",
".",
"is_list_like",
"(",
"comps",
")",
":",
"raise",
"TypeError",
"(",
"\"only list-like objects are allowed to be passed\"",
"\" to isin(), you passed a \"",
"\"[{0}]\"",
".",
"format",
"(",... | https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/site-packages/pandas-0.17.0-py3.3-win-amd64.egg/pandas/core/algorithms.py#L70-L116 | |
demisto/content | 5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07 | Packs/TAXIIServer/Integrations/TAXIIServer/TAXIIServer.py | python | TAXIIServer.__init__ | (self, url_scheme: str, host: str, port: int, collections: dict, certificate: str, private_key: str,
http_server: bool, credentials: dict, service_address: Optional[str] = None) | Class for a TAXII Server configuration.
Args:
url_scheme: The URL scheme (http / https)
host: The server address.
port: The server port.
collections: The JSON string of collections of indicator queries.
certificate: The server certificate for SSL.
... | Class for a TAXII Server configuration.
Args:
url_scheme: The URL scheme (http / https)
host: The server address.
port: The server port.
collections: The JSON string of collections of indicator queries.
certificate: The server certificate for SSL.
... | [
"Class",
"for",
"a",
"TAXII",
"Server",
"configuration",
".",
"Args",
":",
"url_scheme",
":",
"The",
"URL",
"scheme",
"(",
"http",
"/",
"https",
")",
"host",
":",
"The",
"server",
"address",
".",
"port",
":",
"The",
"server",
"port",
".",
"collections",
... | def __init__(self, url_scheme: str, host: str, port: int, collections: dict, certificate: str, private_key: str,
http_server: bool, credentials: dict, service_address: Optional[str] = None):
"""
Class for a TAXII Server configuration.
Args:
url_scheme: The URL scheme... | [
"def",
"__init__",
"(",
"self",
",",
"url_scheme",
":",
"str",
",",
"host",
":",
"str",
",",
"port",
":",
"int",
",",
"collections",
":",
"dict",
",",
"certificate",
":",
"str",
",",
"private_key",
":",
"str",
",",
"http_server",
":",
"bool",
",",
"c... | https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/TAXIIServer/Integrations/TAXIIServer/TAXIIServer.py#L83-L122 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.