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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
cloudera/impyla | 0c736af4cad2bade9b8e313badc08ec50e81c948 | impala/_thrift_gen/hive_metastore/ThriftHiveMetastore.py | python | drop_function_args.read | (self, iprot) | [] | def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
return
iprot.readStructBegin()
while True:
... | [
"def",
"read",
"(",
"self",
",",
"iprot",
")",
":",
"if",
"iprot",
".",
"_fast_decode",
"is",
"not",
"None",
"and",
"isinstance",
"(",
"iprot",
".",
"trans",
",",
"TTransport",
".",
"CReadableTransport",
")",
"and",
"self",
".",
"thrift_spec",
"is",
"not... | https://github.com/cloudera/impyla/blob/0c736af4cad2bade9b8e313badc08ec50e81c948/impala/_thrift_gen/hive_metastore/ThriftHiveMetastore.py#L27546-L27568 | ||||
materialsvirtuallab/megnet | debbb7f6ff987f196bb3914749713a9160215d4b | megnet/utils/preprocessing.py | python | StandardScaler.from_training_data | (
cls, structures: List[StructureOrMolecule], targets: VectorLike, is_intensive: bool = True
) | return cls(mean, std, is_intensive) | Generate a target scaler from a list of input structures/molecules,
a target value vector and an indicator for intensiveness of the
property
Args:
structures (list): list of structures/molecules
targets (list): vector of target properties
is_intensive (bool):... | Generate a target scaler from a list of input structures/molecules,
a target value vector and an indicator for intensiveness of the
property | [
"Generate",
"a",
"target",
"scaler",
"from",
"a",
"list",
"of",
"input",
"structures",
"/",
"molecules",
"a",
"target",
"value",
"vector",
"and",
"an",
"indicator",
"for",
"intensiveness",
"of",
"the",
"property"
] | def from_training_data(
cls, structures: List[StructureOrMolecule], targets: VectorLike, is_intensive: bool = True
) -> "StandardScaler":
"""
Generate a target scaler from a list of input structures/molecules,
a target value vector and an indicator for intensiveness of the
pr... | [
"def",
"from_training_data",
"(",
"cls",
",",
"structures",
":",
"List",
"[",
"StructureOrMolecule",
"]",
",",
"targets",
":",
"VectorLike",
",",
"is_intensive",
":",
"bool",
"=",
"True",
")",
"->",
"\"StandardScaler\"",
":",
"if",
"is_intensive",
":",
"new_ta... | https://github.com/materialsvirtuallab/megnet/blob/debbb7f6ff987f196bb3914749713a9160215d4b/megnet/utils/preprocessing.py#L104-L126 | |
MegviiDetection/video_analyst | f4d1bccb1c698961fed3cb70808f1177fab13bdd | videoanalyst/pipeline/utils/misc.py | python | imarray_to_tensor | (arr) | return torch.from_numpy(arr) | r"""
Transpose & convert from numpy.array to torch.Tensor
:param arr: numpy.array, (H, W, C)
:return: torch.Tensor, (1, C, H, W) | r"""
Transpose & convert from numpy.array to torch.Tensor
:param arr: numpy.array, (H, W, C)
:return: torch.Tensor, (1, C, H, W) | [
"r",
"Transpose",
"&",
"convert",
"from",
"numpy",
".",
"array",
"to",
"torch",
".",
"Tensor",
":",
"param",
"arr",
":",
"numpy",
".",
"array",
"(",
"H",
"W",
"C",
")",
":",
"return",
":",
"torch",
".",
"Tensor",
"(",
"1",
"C",
"H",
"W",
")"
] | def imarray_to_tensor(arr):
r"""
Transpose & convert from numpy.array to torch.Tensor
:param arr: numpy.array, (H, W, C)
:return: torch.Tensor, (1, C, H, W)
"""
arr = np.ascontiguousarray(
arr.transpose(2, 0, 1)[np.newaxis, ...], np.float32)
return torch.from_numpy(arr) | [
"def",
"imarray_to_tensor",
"(",
"arr",
")",
":",
"arr",
"=",
"np",
".",
"ascontiguousarray",
"(",
"arr",
".",
"transpose",
"(",
"2",
",",
"0",
",",
"1",
")",
"[",
"np",
".",
"newaxis",
",",
"...",
"]",
",",
"np",
".",
"float32",
")",
"return",
"... | https://github.com/MegviiDetection/video_analyst/blob/f4d1bccb1c698961fed3cb70808f1177fab13bdd/videoanalyst/pipeline/utils/misc.py#L8-L16 | |
fluentpython/example-code | d5133ad6e4a48eac0980d2418ed39d7ff693edbe | 16-coroutine/taxi_sim.py | python | Simulator.run | (self, end_time) | Schedule and display events until time is up | Schedule and display events until time is up | [
"Schedule",
"and",
"display",
"events",
"until",
"time",
"is",
"up"
] | def run(self, end_time): # <1>
"""Schedule and display events until time is up"""
# schedule the first event for each cab
for _, proc in sorted(self.procs.items()): # <2>
first_event = next(proc) # <3>
self.events.put(first_event) # <4>
# main loop of the sim... | [
"def",
"run",
"(",
"self",
",",
"end_time",
")",
":",
"# <1>",
"# schedule the first event for each cab",
"for",
"_",
",",
"proc",
"in",
"sorted",
"(",
"self",
".",
"procs",
".",
"items",
"(",
")",
")",
":",
"# <2>",
"first_event",
"=",
"next",
"(",
"pro... | https://github.com/fluentpython/example-code/blob/d5133ad6e4a48eac0980d2418ed39d7ff693edbe/16-coroutine/taxi_sim.py#L86-L113 | ||
vyapp/vy | 4ba0d379e21744fd79a740e8aeaba3a0a779973c | vyapp/dap.py | python | DAP.run | (self, event) | To be implemented. | To be implemented. | [
"To",
"be",
"implemented",
"."
] | def run(self, event):
"""
To be implemented.
""" | [
"def",
"run",
"(",
"self",
",",
"event",
")",
":"
] | https://github.com/vyapp/vy/blob/4ba0d379e21744fd79a740e8aeaba3a0a779973c/vyapp/dap.py#L59-L62 | ||
androguard/androguard | 8d091cbb309c0c50bf239f805cc1e0931b8dcddc | androguard/core/bytecodes/dvm.py | python | DalvikVMFormat.fix_checksums | (self, buff) | return buff | Fix a dex format buffer by setting all checksums
:rtype: string | Fix a dex format buffer by setting all checksums | [
"Fix",
"a",
"dex",
"format",
"buffer",
"by",
"setting",
"all",
"checksums"
] | def fix_checksums(self, buff):
"""
Fix a dex format buffer by setting all checksums
:rtype: string
"""
signature = hashlib.sha1(buff[32:]).digest()
buff = buff[:12] + signature + buff[32:]
checksum = zlib.adler32(buff[12:])
buff = buff[:8] + self.CM... | [
"def",
"fix_checksums",
"(",
"self",
",",
"buff",
")",
":",
"signature",
"=",
"hashlib",
".",
"sha1",
"(",
"buff",
"[",
"32",
":",
"]",
")",
".",
"digest",
"(",
")",
"buff",
"=",
"buff",
"[",
":",
"12",
"]",
"+",
"signature",
"+",
"buff",
"[",
... | https://github.com/androguard/androguard/blob/8d091cbb309c0c50bf239f805cc1e0931b8dcddc/androguard/core/bytecodes/dvm.py#L7920-L7936 | |
chaimleib/intervaltree | 328d6db96596a0b7180dd3ad3fae4f6ff7301e01 | intervaltree/intervaltree.py | python | IntervalTree.addi | (self, begin, end, data=None) | return self.add(Interval(begin, end, data)) | Shortcut for add(Interval(begin, end, data)).
Completes in O(log n) time. | Shortcut for add(Interval(begin, end, data)). | [
"Shortcut",
"for",
"add",
"(",
"Interval",
"(",
"begin",
"end",
"data",
"))",
"."
] | def addi(self, begin, end, data=None):
"""
Shortcut for add(Interval(begin, end, data)).
Completes in O(log n) time.
"""
return self.add(Interval(begin, end, data)) | [
"def",
"addi",
"(",
"self",
",",
"begin",
",",
"end",
",",
"data",
"=",
"None",
")",
":",
"return",
"self",
".",
"add",
"(",
"Interval",
"(",
"begin",
",",
"end",
",",
"data",
")",
")"
] | https://github.com/chaimleib/intervaltree/blob/328d6db96596a0b7180dd3ad3fae4f6ff7301e01/intervaltree/intervaltree.py#L337-L343 | |
econ-ark/HARK | 9562cafef854d9c3d6b4aba2540e3e442ba6ec6c | HARK/ConsumptionSaving/TractableBufferStockModel.py | python | TractableConsumerType.transition | (self) | return bLvlNow, mLvlNow | Calculate market resources for all agents this period.
Parameters
----------
None
Returns
-------
None | Calculate market resources for all agents this period. | [
"Calculate",
"market",
"resources",
"for",
"all",
"agents",
"this",
"period",
"."
] | def transition(self):
"""
Calculate market resources for all agents this period.
Parameters
----------
None
Returns
-------
None
"""
bLvlNow = self.Rfree * self.state_prev['aLvl']
mLvlNow = bLvlNow + self.shocks["eStateNow"]
... | [
"def",
"transition",
"(",
"self",
")",
":",
"bLvlNow",
"=",
"self",
".",
"Rfree",
"*",
"self",
".",
"state_prev",
"[",
"'aLvl'",
"]",
"mLvlNow",
"=",
"bLvlNow",
"+",
"self",
".",
"shocks",
"[",
"\"eStateNow\"",
"]",
"return",
"bLvlNow",
",",
"mLvlNow"
] | https://github.com/econ-ark/HARK/blob/9562cafef854d9c3d6b4aba2540e3e442ba6ec6c/HARK/ConsumptionSaving/TractableBufferStockModel.py#L633-L648 | |
mit-han-lab/once-for-all | 4f6fce3652ee4553ea811d38f32f90ac8b1bc378 | ofa/imagenet_classification/networks/resnets.py | python | ResNets.config | (self) | return {
'name': ResNets.__name__,
'bn': self.get_bn_param(),
'input_stem': [
layer.config for layer in self.input_stem
],
'blocks': [
block.config for block in self.blocks
],
'classifier': self.classifier.config,
} | [] | def config(self):
return {
'name': ResNets.__name__,
'bn': self.get_bn_param(),
'input_stem': [
layer.config for layer in self.input_stem
],
'blocks': [
block.config for block in self.blocks
],
'classifier': self.classifier.config,
} | [
"def",
"config",
"(",
"self",
")",
":",
"return",
"{",
"'name'",
":",
"ResNets",
".",
"__name__",
",",
"'bn'",
":",
"self",
".",
"get_bn_param",
"(",
")",
",",
"'input_stem'",
":",
"[",
"layer",
".",
"config",
"for",
"layer",
"in",
"self",
".",
"inpu... | https://github.com/mit-han-lab/once-for-all/blob/4f6fce3652ee4553ea811d38f32f90ac8b1bc378/ofa/imagenet_classification/networks/resnets.py#L47-L58 | |||
yaksok/yaksok | 73f14863d04f054eef2926f25a091f72f60352a5 | yaksok/yacc.py | python | p_term_factor | (t) | term : factor | term : factor | [
"term",
":",
"factor"
] | def p_term_factor(t):
'''term : factor'''
t[0] = t[1] | [
"def",
"p_term_factor",
"(",
"t",
")",
":",
"t",
"[",
"0",
"]",
"=",
"t",
"[",
"1",
"]"
] | https://github.com/yaksok/yaksok/blob/73f14863d04f054eef2926f25a091f72f60352a5/yaksok/yacc.py#L585-L587 | ||
LexPredict/openedgar | 1d1b8bc8faa3c59e05d9883e53039b6328b7d831 | lexpredict_openedgar/openedgar/tasks.py | python | process_filing_index | (client_type: str, file_path: str, filing_index_buffer: Union[str, bytes] = None,
form_type_list: Iterable[str] = None, store_raw: bool = False, store_text: bool = False) | Process a filing index from an S3 path or buffer.
:param file_path: S3 or local path to process; if filing_index_buffer is none, retrieved from here
:param filing_index_buffer: buffer; if not present, s3_path must be set
:param form_type_list: optional list of form type to process
:param store_raw:
... | Process a filing index from an S3 path or buffer.
:param file_path: S3 or local path to process; if filing_index_buffer is none, retrieved from here
:param filing_index_buffer: buffer; if not present, s3_path must be set
:param form_type_list: optional list of form type to process
:param store_raw:
... | [
"Process",
"a",
"filing",
"index",
"from",
"an",
"S3",
"path",
"or",
"buffer",
".",
":",
"param",
"file_path",
":",
"S3",
"or",
"local",
"path",
"to",
"process",
";",
"if",
"filing_index_buffer",
"is",
"none",
"retrieved",
"from",
"here",
":",
"param",
"... | def process_filing_index(client_type: str, file_path: str, filing_index_buffer: Union[str, bytes] = None,
form_type_list: Iterable[str] = None, store_raw: bool = False, store_text: bool = False):
"""
Process a filing index from an S3 path or buffer.
:param file_path: S3 or local pat... | [
"def",
"process_filing_index",
"(",
"client_type",
":",
"str",
",",
"file_path",
":",
"str",
",",
"filing_index_buffer",
":",
"Union",
"[",
"str",
",",
"bytes",
"]",
"=",
"None",
",",
"form_type_list",
":",
"Iterable",
"[",
"str",
"]",
"=",
"None",
",",
... | https://github.com/LexPredict/openedgar/blob/1d1b8bc8faa3c59e05d9883e53039b6328b7d831/lexpredict_openedgar/openedgar/tasks.py#L189-L301 | ||
lixinsu/RCZoo | 37fcb7962fbd4c751c561d4a0c84173881ea8339 | reader/qanet/utils.py | python | load_answers | (filename) | return ans | Load the answers only of a SQuAD dataset. Store as qid -> [answers]. | Load the answers only of a SQuAD dataset. Store as qid -> [answers]. | [
"Load",
"the",
"answers",
"only",
"of",
"a",
"SQuAD",
"dataset",
".",
"Store",
"as",
"qid",
"-",
">",
"[",
"answers",
"]",
"."
] | def load_answers(filename):
"""Load the answers only of a SQuAD dataset. Store as qid -> [answers]."""
# Load JSON file
with open(filename) as f:
examples = json.load(f)['data']
ans = {}
for article in examples:
for paragraph in article['paragraphs']:
for qa in paragraph... | [
"def",
"load_answers",
"(",
"filename",
")",
":",
"# Load JSON file",
"with",
"open",
"(",
"filename",
")",
"as",
"f",
":",
"examples",
"=",
"json",
".",
"load",
"(",
"f",
")",
"[",
"'data'",
"]",
"ans",
"=",
"{",
"}",
"for",
"article",
"in",
"exampl... | https://github.com/lixinsu/RCZoo/blob/37fcb7962fbd4c751c561d4a0c84173881ea8339/reader/qanet/utils.py#L71-L82 | |
GeorgeSeif/Semantic-Segmentation-Suite | f04c94c2077a957bca0e8509b8ed2861769c4ba6 | utils/utils.py | python | _lovasz_softmax_flat | (probas, labels, only_present=True) | return losses_tensor | Multi-class Lovasz-Softmax loss
probas: [P, C] Variable, class probabilities at each prediction (between 0 and 1)
labels: [P] Tensor, ground truth labels (between 0 and C - 1)
only_present: average only on classes present in ground truth | Multi-class Lovasz-Softmax loss
probas: [P, C] Variable, class probabilities at each prediction (between 0 and 1)
labels: [P] Tensor, ground truth labels (between 0 and C - 1)
only_present: average only on classes present in ground truth | [
"Multi",
"-",
"class",
"Lovasz",
"-",
"Softmax",
"loss",
"probas",
":",
"[",
"P",
"C",
"]",
"Variable",
"class",
"probabilities",
"at",
"each",
"prediction",
"(",
"between",
"0",
"and",
"1",
")",
"labels",
":",
"[",
"P",
"]",
"Tensor",
"ground",
"truth... | def _lovasz_softmax_flat(probas, labels, only_present=True):
"""
Multi-class Lovasz-Softmax loss
probas: [P, C] Variable, class probabilities at each prediction (between 0 and 1)
labels: [P] Tensor, ground truth labels (between 0 and C - 1)
only_present: average only on classes present in grou... | [
"def",
"_lovasz_softmax_flat",
"(",
"probas",
",",
"labels",
",",
"only_present",
"=",
"True",
")",
":",
"C",
"=",
"probas",
".",
"shape",
"[",
"1",
"]",
"losses",
"=",
"[",
"]",
"present",
"=",
"[",
"]",
"for",
"c",
"in",
"range",
"(",
"C",
")",
... | https://github.com/GeorgeSeif/Semantic-Segmentation-Suite/blob/f04c94c2077a957bca0e8509b8ed2861769c4ba6/utils/utils.py#L116-L141 | |
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/polys/densearith.py | python | dmp_sub_ground | (f, c, u, K) | return dmp_sub_term(f, dmp_ground(c, u - 1), 0, u, K) | Subtract an element of the ground domain from ``f``.
Examples
========
>>> from sympy.polys import ring, ZZ
>>> R, x,y = ring("x,y", ZZ)
>>> R.dmp_sub_ground(x**3 + 2*x**2 + 3*x + 4, ZZ(4))
x**3 + 2*x**2 + 3*x | Subtract an element of the ground domain from ``f``. | [
"Subtract",
"an",
"element",
"of",
"the",
"ground",
"domain",
"from",
"f",
"."
] | def dmp_sub_ground(f, c, u, K):
"""
Subtract an element of the ground domain from ``f``.
Examples
========
>>> from sympy.polys import ring, ZZ
>>> R, x,y = ring("x,y", ZZ)
>>> R.dmp_sub_ground(x**3 + 2*x**2 + 3*x + 4, ZZ(4))
x**3 + 2*x**2 + 3*x
"""
return dmp_sub_term(f, dmp... | [
"def",
"dmp_sub_ground",
"(",
"f",
",",
"c",
",",
"u",
",",
"K",
")",
":",
"return",
"dmp_sub_term",
"(",
"f",
",",
"dmp_ground",
"(",
"c",
",",
"u",
"-",
"1",
")",
",",
"0",
",",
"u",
",",
"K",
")"
] | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/polys/densearith.py#L243-L257 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/mochad/switch.py | python | MochadSwitch.turn_on | (self, **kwargs) | Turn the switch on. | Turn the switch on. | [
"Turn",
"the",
"switch",
"on",
"."
] | def turn_on(self, **kwargs):
"""Turn the switch on."""
_LOGGER.debug("Reconnect %s:%s", self._controller.server, self._controller.port)
with REQ_LOCK:
try:
# Recycle socket on new command to recover mochad connection
self._controller.reconnect()
... | [
"def",
"turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Reconnect %s:%s\"",
",",
"self",
".",
"_controller",
".",
"server",
",",
"self",
".",
"_controller",
".",
"port",
")",
"with",
"REQ_LOCK",
":",
"try",
":... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/mochad/switch.py#L71-L85 | ||
cuthbertLab/music21 | bd30d4663e52955ed922c10fdf541419d8c67671 | music21/scale/intervalNetwork.py | python | IntervalNetwork.getPitchFromNodeDegree | (self,
pitchReference,
nodeName,
nodeDegreeTarget,
direction=DIRECTION_ASCENDING,
minPitch=None,
maxPitch=None,
... | Given a reference pitch assigned to node id,
determine the pitch for the target node degree.
>>> edgeList = ['M2', 'M2', 'm2', 'M2', 'M2', 'M2', 'm2']
>>> net = scale.intervalNetwork.IntervalNetwork(edgeList)
>>> [str(p) for p in net.realizePitch(pitch.Pitch('e-2')) ]
['E-2', 'F... | Given a reference pitch assigned to node id,
determine the pitch for the target node degree. | [
"Given",
"a",
"reference",
"pitch",
"assigned",
"to",
"node",
"id",
"determine",
"the",
"pitch",
"for",
"the",
"target",
"node",
"degree",
"."
] | def getPitchFromNodeDegree(self,
pitchReference,
nodeName,
nodeDegreeTarget,
direction=DIRECTION_ASCENDING,
minPitch=None,
maxPitch=No... | [
"def",
"getPitchFromNodeDegree",
"(",
"self",
",",
"pitchReference",
",",
"nodeName",
",",
"nodeDegreeTarget",
",",
"direction",
"=",
"DIRECTION_ASCENDING",
",",
"minPitch",
"=",
"None",
",",
"maxPitch",
"=",
"None",
",",
"alteredDegrees",
"=",
"None",
",",
"equ... | https://github.com/cuthbertLab/music21/blob/bd30d4663e52955ed922c10fdf541419d8c67671/music21/scale/intervalNetwork.py#L2526-L2644 | ||
IJDykeman/wangTiles | 7c1ee2095ebdf7f72bce07d94c6484915d5cae8b | experimental_code/tiles_3d/venv_mac_py3/lib/python2.7/site-packages/pip/_vendor/urllib3/util/response.py | python | is_response_to_head | (response) | return method.upper() == 'HEAD' | Checks whether the request of a response has been a HEAD-request.
Handles the quirks of AppEngine.
:param conn:
:type conn: :class:`httplib.HTTPResponse` | Checks whether the request of a response has been a HEAD-request.
Handles the quirks of AppEngine. | [
"Checks",
"whether",
"the",
"request",
"of",
"a",
"response",
"has",
"been",
"a",
"HEAD",
"-",
"request",
".",
"Handles",
"the",
"quirks",
"of",
"AppEngine",
"."
] | def is_response_to_head(response):
"""
Checks whether the request of a response has been a HEAD-request.
Handles the quirks of AppEngine.
:param conn:
:type conn: :class:`httplib.HTTPResponse`
"""
# FIXME: Can we do this somehow without accessing private httplib _method?
method = respon... | [
"def",
"is_response_to_head",
"(",
"response",
")",
":",
"# FIXME: Can we do this somehow without accessing private httplib _method?",
"method",
"=",
"response",
".",
"_method",
"if",
"isinstance",
"(",
"method",
",",
"int",
")",
":",
"# Platform-specific: Appengine",
"retu... | https://github.com/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/tiles_3d/venv_mac_py3/lib/python2.7/site-packages/pip/_vendor/urllib3/util/response.py#L69-L81 | |
qutip/qutip | 52d01da181a21b810c3407812c670f35fdc647e8 | qutip/control/propcomp.py | python | PropCompApproxGrad._compute_diff_prop | (self, k, j, epsilon) | return prop_eps | Calculate the propagator from the current point to a trial point
a distance 'epsilon' (change in amplitude)
in the direction the given control j in timeslot k
Returns the propagator | Calculate the propagator from the current point to a trial point
a distance 'epsilon' (change in amplitude)
in the direction the given control j in timeslot k
Returns the propagator | [
"Calculate",
"the",
"propagator",
"from",
"the",
"current",
"point",
"to",
"a",
"trial",
"point",
"a",
"distance",
"epsilon",
"(",
"change",
"in",
"amplitude",
")",
"in",
"the",
"direction",
"the",
"given",
"control",
"j",
"in",
"timeslot",
"k",
"Returns",
... | def _compute_diff_prop(self, k, j, epsilon):
"""
Calculate the propagator from the current point to a trial point
a distance 'epsilon' (change in amplitude)
in the direction the given control j in timeslot k
Returns the propagator
"""
dyn = self.parent
dgt... | [
"def",
"_compute_diff_prop",
"(",
"self",
",",
"k",
",",
"j",
",",
"epsilon",
")",
":",
"dyn",
"=",
"self",
".",
"parent",
"dgt_eps",
"=",
"(",
"dyn",
".",
"_get_phased_dyn_gen",
"(",
"k",
")",
"+",
"epsilon",
"*",
"dyn",
".",
"_get_phased_ctrl_dyn_gen",... | https://github.com/qutip/qutip/blob/52d01da181a21b810c3407812c670f35fdc647e8/qutip/control/propcomp.py#L177-L193 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/combinat/integer_vector_weighted.py | python | WeightedIntegerVectors.__contains__ | (self, x) | return s == self._n | EXAMPLES::
sage: [] in WeightedIntegerVectors(0, [])
True
sage: [] in WeightedIntegerVectors(1, [])
False
sage: [3,0,0] in WeightedIntegerVectors(6, [2,1,1])
True
sage: [1] in WeightedIntegerVectors(1, [1])
True
... | EXAMPLES:: | [
"EXAMPLES",
"::"
] | def __contains__(self, x):
"""
EXAMPLES::
sage: [] in WeightedIntegerVectors(0, [])
True
sage: [] in WeightedIntegerVectors(1, [])
False
sage: [3,0,0] in WeightedIntegerVectors(6, [2,1,1])
True
sage: [1] in WeightedInte... | [
"def",
"__contains__",
"(",
"self",
",",
"x",
")",
":",
"if",
"not",
"isinstance",
"(",
"x",
",",
"(",
"list",
",",
"IntegerVector",
",",
"Permutation",
")",
")",
":",
"return",
"False",
"if",
"len",
"(",
"self",
".",
"_weights",
")",
"!=",
"len",
... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/integer_vector_weighted.py#L153-L189 | |
kanzure/nanoengineer | 874e4c9f8a9190f093625b267f9767e19f82e6c4 | cad/src/dna/updater/fix_atom_classes.py | python | fix_atom_classes | ( changed_atoms) | return | Fix classes of PAM atoms in changed_atoms, ignoring bondpoints
and/or killed atoms.
(Also patch changed_atoms with replaced atoms if necessary.) | Fix classes of PAM atoms in changed_atoms, ignoring bondpoints
and/or killed atoms.
(Also patch changed_atoms with replaced atoms if necessary.) | [
"Fix",
"classes",
"of",
"PAM",
"atoms",
"in",
"changed_atoms",
"ignoring",
"bondpoints",
"and",
"/",
"or",
"killed",
"atoms",
".",
"(",
"Also",
"patch",
"changed_atoms",
"with",
"replaced",
"atoms",
"if",
"necessary",
".",
")"
] | def fix_atom_classes( changed_atoms): #e rename, real_atom; call differently, see comment above ### @@@
"""
Fix classes of PAM atoms in changed_atoms, ignoring bondpoints
and/or killed atoms.
(Also patch changed_atoms with replaced atoms if necessary.)
"""
for atom in changed_atoms.itervalues():... | [
"def",
"fix_atom_classes",
"(",
"changed_atoms",
")",
":",
"#e rename, real_atom; call differently, see comment above ### @@@",
"for",
"atom",
"in",
"changed_atoms",
".",
"itervalues",
"(",
")",
":",
"if",
"not",
"atom",
".",
"killed",
"(",
")",
"and",
"not",
"atom"... | https://github.com/kanzure/nanoengineer/blob/874e4c9f8a9190f093625b267f9767e19f82e6c4/cad/src/dna/updater/fix_atom_classes.py#L73-L91 | |
zachwill/flask-engine | 7c8ad4bfe36382a8c9286d873ec7b785715832a4 | libs/jinja2/environment.py | python | create_cache | (size) | return LRUCache(size) | Return the cache class for the given size. | Return the cache class for the given size. | [
"Return",
"the",
"cache",
"class",
"for",
"the",
"given",
"size",
"."
] | def create_cache(size):
"""Return the cache class for the given size."""
if size == 0:
return None
if size < 0:
return {}
return LRUCache(size) | [
"def",
"create_cache",
"(",
"size",
")",
":",
"if",
"size",
"==",
"0",
":",
"return",
"None",
"if",
"size",
"<",
"0",
":",
"return",
"{",
"}",
"return",
"LRUCache",
"(",
"size",
")"
] | https://github.com/zachwill/flask-engine/blob/7c8ad4bfe36382a8c9286d873ec7b785715832a4/libs/jinja2/environment.py#L50-L56 | |
QUANTAXIS/QUANTAXIS | d6eccb97c8385854aa596d6ba8d70ec0655519ff | QUANTAXIS/QAData/base_datastruct.py | python | _quotation_base.code | (self) | return self.index.levels[1].map(lambda x: x[0:6]) | 返回结构体中的代码 | 返回结构体中的代码 | [
"返回结构体中的代码"
] | def code(self):
'返回结构体中的代码'
return self.index.levels[1].map(lambda x: x[0:6]) | [
"def",
"code",
"(",
"self",
")",
":",
"return",
"self",
".",
"index",
".",
"levels",
"[",
"1",
"]",
".",
"map",
"(",
"lambda",
"x",
":",
"x",
"[",
"0",
":",
"6",
"]",
")"
] | https://github.com/QUANTAXIS/QUANTAXIS/blob/d6eccb97c8385854aa596d6ba8d70ec0655519ff/QUANTAXIS/QAData/base_datastruct.py#L659-L661 | |
mcfletch/pyopengl | 02d11dad9ff18e50db10e975c4756e17bf198464 | OpenGL/GL/KHR/parallel_shader_compile.py | python | glInitParallelShaderCompileKHR | () | return extensions.hasGLExtension( _EXTENSION_NAME ) | Return boolean indicating whether this extension is available | Return boolean indicating whether this extension is available | [
"Return",
"boolean",
"indicating",
"whether",
"this",
"extension",
"is",
"available"
] | def glInitParallelShaderCompileKHR():
'''Return boolean indicating whether this extension is available'''
from OpenGL import extensions
return extensions.hasGLExtension( _EXTENSION_NAME ) | [
"def",
"glInitParallelShaderCompileKHR",
"(",
")",
":",
"from",
"OpenGL",
"import",
"extensions",
"return",
"extensions",
".",
"hasGLExtension",
"(",
"_EXTENSION_NAME",
")"
] | https://github.com/mcfletch/pyopengl/blob/02d11dad9ff18e50db10e975c4756e17bf198464/OpenGL/GL/KHR/parallel_shader_compile.py#L26-L29 | |
007gzs/dingtalk-sdk | 7979da2e259fdbc571728cae2425a04dbc65850a | dingtalk/client/api/taobao.py | python | TbDingDing.dingtalk_corp_smartdevice_addrecognizenotify | (
self,
notify_vo
) | return self._top_request(
"dingtalk.corp.smartdevice.addrecognizenotify",
{
"notify_vo": notify_vo
}
) | 添加用户识别成功后的通知
当M2成功识别指定用户后,如需向指定用户发消息通知,使用些接口
文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=33417
:param notify_vo: 通知数据 | 添加用户识别成功后的通知
当M2成功识别指定用户后,如需向指定用户发消息通知,使用些接口
文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=33417 | [
"添加用户识别成功后的通知",
"当M2成功识别指定用户后,如需向指定用户发消息通知,使用些接口",
"文档地址:https",
":",
"//",
"open",
"-",
"doc",
".",
"dingtalk",
".",
"com",
"/",
"docs",
"/",
"api",
".",
"htm?apiId",
"=",
"33417"
] | def dingtalk_corp_smartdevice_addrecognizenotify(
self,
notify_vo
):
"""
添加用户识别成功后的通知
当M2成功识别指定用户后,如需向指定用户发消息通知,使用些接口
文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=33417
:param notify_vo: 通知数据
"""
return self._top_request(
... | [
"def",
"dingtalk_corp_smartdevice_addrecognizenotify",
"(",
"self",
",",
"notify_vo",
")",
":",
"return",
"self",
".",
"_top_request",
"(",
"\"dingtalk.corp.smartdevice.addrecognizenotify\"",
",",
"{",
"\"notify_vo\"",
":",
"notify_vo",
"}",
")"
] | https://github.com/007gzs/dingtalk-sdk/blob/7979da2e259fdbc571728cae2425a04dbc65850a/dingtalk/client/api/taobao.py#L1328-L1344 | |
openedx/edx-platform | 68dd185a0ab45862a2a61e0f803d7e03d2be71b5 | common/djangoapps/third_party_auth/models.py | python | ProviderConfig.clean | (self) | Ensure that at most `icon_class` or `icon_image` is set | Ensure that at most `icon_class` or `icon_image` is set | [
"Ensure",
"that",
"at",
"most",
"icon_class",
"or",
"icon_image",
"is",
"set"
] | def clean(self):
""" Ensure that at most `icon_class` or `icon_image` is set """
super().clean()
if bool(self.icon_class) and bool(self.icon_image):
raise ValidationError('Either an icon class or an icon image must be given (but not both)') | [
"def",
"clean",
"(",
"self",
")",
":",
"super",
"(",
")",
".",
"clean",
"(",
")",
"if",
"bool",
"(",
"self",
".",
"icon_class",
")",
"and",
"bool",
"(",
"self",
".",
"icon_image",
")",
":",
"raise",
"ValidationError",
"(",
"'Either an icon class or an ic... | https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/common/djangoapps/third_party_auth/models.py#L235-L239 | ||
SCons/scons | 309f0234d1d9cc76955818be47c5c722f577dac6 | SCons/Node/__init__.py | python | Node.is_literal | (self) | return 1 | Always pass the string representation of a Node to
the command interpreter literally. | Always pass the string representation of a Node to
the command interpreter literally. | [
"Always",
"pass",
"the",
"string",
"representation",
"of",
"a",
"Node",
"to",
"the",
"command",
"interpreter",
"literally",
"."
] | def is_literal(self):
"""Always pass the string representation of a Node to
the command interpreter literally."""
return 1 | [
"def",
"is_literal",
"(",
"self",
")",
":",
"return",
"1"
] | https://github.com/SCons/scons/blob/309f0234d1d9cc76955818be47c5c722f577dac6/SCons/Node/__init__.py#L1537-L1540 | |
albertz/music-player | d23586f5bf657cbaea8147223be7814d117ae73d | mac/pyobjc-framework-Cocoa/Examples/AppKit/PyObjCLauncher/MyDocument.py | python | MyDocument.updateDisplay | (self) | [] | def updateDisplay(self):
dct = self.settings.fileSettingsAsDict()
self.interpreter.setStringValue_(dct['interpreter'])
self.honourhashbang.setState_(dct['honourhashbang'])
self.debug.setState_(dct['verbose'])
self.inspect.setState_(dct['inspect'])
self.optimize.setState_(... | [
"def",
"updateDisplay",
"(",
"self",
")",
":",
"dct",
"=",
"self",
".",
"settings",
".",
"fileSettingsAsDict",
"(",
")",
"self",
".",
"interpreter",
".",
"setStringValue_",
"(",
"dct",
"[",
"'interpreter'",
"]",
")",
"self",
".",
"honourhashbang",
".",
"se... | https://github.com/albertz/music-player/blob/d23586f5bf657cbaea8147223be7814d117ae73d/mac/pyobjc-framework-Cocoa/Examples/AppKit/PyObjCLauncher/MyDocument.py#L41-L53 | ||||
PaddlePaddle/PaddleSlim | f895aebe441b2bef79ecc434626d3cac4b3cbd09 | paddleslim/dygraph/dist/distill.py | python | Distill._prepare_outputs | (self, hook_layers, in_forward=False) | return outputs_tensor | Add hook to get the output tensor of target layer. | Add hook to get the output tensor of target layer. | [
"Add",
"hook",
"to",
"get",
"the",
"output",
"tensor",
"of",
"target",
"layer",
"."
] | def _prepare_outputs(self, hook_layers, in_forward=False):
"""
Add hook to get the output tensor of target layer.
"""
outputs_tensor = {}
for idx, m in enumerate(self._student_models):
tmp_hook_layers = hook_layers['student_{}'.format(idx)]
stu_outs = coll... | [
"def",
"_prepare_outputs",
"(",
"self",
",",
"hook_layers",
",",
"in_forward",
"=",
"False",
")",
":",
"outputs_tensor",
"=",
"{",
"}",
"for",
"idx",
",",
"m",
"in",
"enumerate",
"(",
"self",
".",
"_student_models",
")",
":",
"tmp_hook_layers",
"=",
"hook_... | https://github.com/PaddlePaddle/PaddleSlim/blob/f895aebe441b2bef79ecc434626d3cac4b3cbd09/paddleslim/dygraph/dist/distill.py#L196-L211 | |
dmlc/dgl | 8d14a739bc9e446d6c92ef83eafe5782398118de | python/dgl/contrib/dis_kvstore.py | python | KVClient.push | (self, name, id_tensor, data_tensor) | Push data to KVServer.
Note that push() is an async operation that will return immediately after calling.
Parameters
----------
name : str
data name
id_tensor : tensor (mx.ndarray or torch.tensor)
a vector storing the global data ID
data_tensor :... | Push data to KVServer. | [
"Push",
"data",
"to",
"KVServer",
"."
] | def push(self, name, id_tensor, data_tensor):
"""Push data to KVServer.
Note that push() is an async operation that will return immediately after calling.
Parameters
----------
name : str
data name
id_tensor : tensor (mx.ndarray or torch.tensor)
... | [
"def",
"push",
"(",
"self",
",",
"name",
",",
"id_tensor",
",",
"data_tensor",
")",
":",
"assert",
"len",
"(",
"name",
")",
">",
"0",
",",
"'name cannot be empty.'",
"assert",
"F",
".",
"ndim",
"(",
"id_tensor",
")",
"==",
"1",
",",
"'ID must be a vector... | https://github.com/dmlc/dgl/blob/8d14a739bc9e446d6c92ef83eafe5782398118de/python/dgl/contrib/dis_kvstore.py#L992-L1054 | ||
gnuradio/pybombs | 17044241bf835b93571026b112f179f2db7448a4 | pybombs/packagers/dummy.py | python | Dummy.install | (self, recipe, static=False) | return True | Pseudo-install package | Pseudo-install package | [
"Pseudo",
"-",
"install",
"package"
] | def install(self, recipe, static=False):
"""
Pseudo-install package
"""
self.log.info("Pretending to install package {0}.".format(recipe.id))
return True | [
"def",
"install",
"(",
"self",
",",
"recipe",
",",
"static",
"=",
"False",
")",
":",
"self",
".",
"log",
".",
"info",
"(",
"\"Pretending to install package {0}.\"",
".",
"format",
"(",
"recipe",
".",
"id",
")",
")",
"return",
"True"
] | https://github.com/gnuradio/pybombs/blob/17044241bf835b93571026b112f179f2db7448a4/pybombs/packagers/dummy.py#L48-L53 | |
kiibohd/kll | b6d997b810006326d31fc570c89d396fd0b70569 | kll/common/emitter.py | python | TextEmitter.load_template | (self, template) | Loads template file
Looks for <|tags|> to replace in the template
@param template: Path to template | Loads template file | [
"Loads",
"template",
"file"
] | def load_template(self, template):
'''
Loads template file
Looks for <|tags|> to replace in the template
@param template: Path to template
'''
# Does template exist?
if not os.path.isfile(template):
print("{0} '{1}' does not exist...".format(ERROR, ... | [
"def",
"load_template",
"(",
"self",
",",
"template",
")",
":",
"# Does template exist?",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"template",
")",
":",
"print",
"(",
"\"{0} '{1}' does not exist...\"",
".",
"format",
"(",
"ERROR",
",",
"template",
... | https://github.com/kiibohd/kll/blob/b6d997b810006326d31fc570c89d396fd0b70569/kll/common/emitter.py#L177-L198 | ||
trailofbits/manticore | b050fdf0939f6c63f503cdf87ec0ab159dd41159 | manticore/platforms/linux_syscall_stubs.py | python | SyscallStubs.sys_finit_module | (self, fd, uargs, flags) | return self.simple_returns() | AUTOGENERATED UNIMPLEMENTED STUB | AUTOGENERATED UNIMPLEMENTED STUB | [
"AUTOGENERATED",
"UNIMPLEMENTED",
"STUB"
] | def sys_finit_module(self, fd, uargs, flags) -> int:
""" AUTOGENERATED UNIMPLEMENTED STUB """
return self.simple_returns() | [
"def",
"sys_finit_module",
"(",
"self",
",",
"fd",
",",
"uargs",
",",
"flags",
")",
"->",
"int",
":",
"return",
"self",
".",
"simple_returns",
"(",
")"
] | https://github.com/trailofbits/manticore/blob/b050fdf0939f6c63f503cdf87ec0ab159dd41159/manticore/platforms/linux_syscall_stubs.py#L217-L219 | |
UCL-INGI/INGInious | 60f10cb4c375ce207471043e76bd813220b95399 | inginious/frontend/pages/course_admin/utils.py | python | UnicodeWriter.writerow | (self, row) | Writes a row to the CSV file | Writes a row to the CSV file | [
"Writes",
"a",
"row",
"to",
"the",
"CSV",
"file"
] | def writerow(self, row):
""" Writes a row to the CSV file """
self.writer.writerow(row)
# Fetch UTF-8 output from the queue ...
data = self.queue.getvalue()
# write to the target stream
self.stream.write(data)
# empty queue
self.queue.truncate(0)
s... | [
"def",
"writerow",
"(",
"self",
",",
"row",
")",
":",
"self",
".",
"writer",
".",
"writerow",
"(",
"row",
")",
"# Fetch UTF-8 output from the queue ...",
"data",
"=",
"self",
".",
"queue",
".",
"getvalue",
"(",
")",
"# write to the target stream",
"self",
".",... | https://github.com/UCL-INGI/INGInious/blob/60f10cb4c375ce207471043e76bd813220b95399/inginious/frontend/pages/course_admin/utils.py#L263-L272 | ||
tensorflow/models | 6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3 | official/projects/assemblenet/modeling/assemblenet.py | python | _ApplyEdgeWeight.__init__ | (self,
weights_shape,
index: Optional[int] = None,
use_5d_mode: bool = False,
model_edge_weights: Optional[List[Any]] = None,
**kwargs) | Constructor.
Args:
weights_shape: shape of the weights. Should equals to [len(inputs)].
index: `int` index of the block within the AssembleNet architecture. Used
for summation weight initial loading.
use_5d_mode: `bool` indicating whether the inputs are in 5D tensor or 4D.
model_edg... | Constructor. | [
"Constructor",
"."
] | def __init__(self,
weights_shape,
index: Optional[int] = None,
use_5d_mode: bool = False,
model_edge_weights: Optional[List[Any]] = None,
**kwargs):
"""Constructor.
Args:
weights_shape: shape of the weights. Should equals to [len(... | [
"def",
"__init__",
"(",
"self",
",",
"weights_shape",
",",
"index",
":",
"Optional",
"[",
"int",
"]",
"=",
"None",
",",
"use_5d_mode",
":",
"bool",
"=",
"False",
",",
"model_edge_weights",
":",
"Optional",
"[",
"List",
"[",
"Any",
"]",
"]",
"=",
"None"... | https://github.com/tensorflow/models/blob/6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3/official/projects/assemblenet/modeling/assemblenet.py#L412-L436 | ||
out0fmemory/GoAgent-Always-Available | c4254984fea633ce3d1893fe5901debd9f22c2a9 | server/lib/google/appengine/ext/blobstore/blobstore.py | python | BlobReferenceProperty.validate | (self, value) | return super(BlobReferenceProperty, self).validate(value) | Validate that assigned value is BlobInfo.
Automatically converts from strings and BlobKey instances. | Validate that assigned value is BlobInfo. | [
"Validate",
"that",
"assigned",
"value",
"is",
"BlobInfo",
"."
] | def validate(self, value):
"""Validate that assigned value is BlobInfo.
Automatically converts from strings and BlobKey instances.
"""
if isinstance(value, (basestring)):
value = BlobInfo(BlobKey(value))
elif isinstance(value, BlobKey):
value = BlobInfo(value)
return super(BlobRefer... | [
"def",
"validate",
"(",
"self",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"(",
"basestring",
")",
")",
":",
"value",
"=",
"BlobInfo",
"(",
"BlobKey",
"(",
"value",
")",
")",
"elif",
"isinstance",
"(",
"value",
",",
"BlobKey",
")"... | https://github.com/out0fmemory/GoAgent-Always-Available/blob/c4254984fea633ce3d1893fe5901debd9f22c2a9/server/lib/google/appengine/ext/blobstore/blobstore.py#L638-L647 | |
holoviz/holoviews | cc6b27f01710402fdfee2aeef1507425ca78c91f | holoviews/ipython/archive.py | python | NotebookArchive._export_with_html | (self) | Computes substitutions before using nbconvert with preprocessors | Computes substitutions before using nbconvert with preprocessors | [
"Computes",
"substitutions",
"before",
"using",
"nbconvert",
"with",
"preprocessors"
] | def _export_with_html(self): # pragma: no cover
"Computes substitutions before using nbconvert with preprocessors"
self.export_success = False
try:
tstamp = time.strftime(self.timestamp_format, self._timestamp)
substitutions = {}
for (basena... | [
"def",
"_export_with_html",
"(",
"self",
")",
":",
"# pragma: no cover",
"self",
".",
"export_success",
"=",
"False",
"try",
":",
"tstamp",
"=",
"time",
".",
"strftime",
"(",
"self",
".",
"timestamp_format",
",",
"self",
".",
"_timestamp",
")",
"substitutions"... | https://github.com/holoviz/holoviews/blob/cc6b27f01710402fdfee2aeef1507425ca78c91f/holoviews/ipython/archive.py#L227-L276 | ||
nilearn/nilearn | 9edba4471747efacf21260bf470a346307f52706 | nilearn/externals/tempita/_looper.py | python | loop_pos.last | (self) | return self.pos == len(self.seq) - 1 | [] | def last(self):
return self.pos == len(self.seq) - 1 | [
"def",
"last",
"(",
"self",
")",
":",
"return",
"self",
".",
"pos",
"==",
"len",
"(",
"self",
".",
"seq",
")",
"-",
"1"
] | https://github.com/nilearn/nilearn/blob/9edba4471747efacf21260bf470a346307f52706/nilearn/externals/tempita/_looper.py#L118-L119 | |||
veusz/veusz | 5a1e2af5f24df0eb2a2842be51f2997c4999c7fb | veusz/setting/setting.py | python | _distRatio | (match, painter) | return painter.maxdim * float(match.group(1)) | Convert from a simple 0.xx ratio of maxdim. | Convert from a simple 0.xx ratio of maxdim. | [
"Convert",
"from",
"a",
"simple",
"0",
".",
"xx",
"ratio",
"of",
"maxdim",
"."
] | def _distRatio(match, painter):
"""Convert from a simple 0.xx ratio of maxdim."""
# if it's greater than 1 then assume it's a point measurement
if float(match.group(1)) > 1.:
return _distPhys(match, painter, 1)
return painter.maxdim * float(match.group(1)) | [
"def",
"_distRatio",
"(",
"match",
",",
"painter",
")",
":",
"# if it's greater than 1 then assume it's a point measurement",
"if",
"float",
"(",
"match",
".",
"group",
"(",
"1",
")",
")",
">",
"1.",
":",
"return",
"_distPhys",
"(",
"match",
",",
"painter",
",... | https://github.com/veusz/veusz/blob/5a1e2af5f24df0eb2a2842be51f2997c4999c7fb/veusz/setting/setting.py#L621-L628 | |
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Tools/msi/msilib.py | python | MakeInstaller | () | return _Installer | [] | def MakeInstaller():
global _Installer
if _Installer is None:
EnsureMSI()
_Installer = win32com.client.Dispatch('WindowsInstaller.Installer',
resultCLSID='{000C1090-0000-0000-C000-000000000046}')
return _Installer | [
"def",
"MakeInstaller",
"(",
")",
":",
"global",
"_Installer",
"if",
"_Installer",
"is",
"None",
":",
"EnsureMSI",
"(",
")",
"_Installer",
"=",
"win32com",
".",
"client",
".",
"Dispatch",
"(",
"'WindowsInstaller.Installer'",
",",
"resultCLSID",
"=",
"'{000C1090-... | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Tools/msi/msilib.py#L65-L71 | |||
morganstanley/treadmill | f18267c665baf6def4374d21170198f63ff1cde4 | lib/python/treadmill/scheduler/masterapi.py | python | update_appmonitor | (zkclient, monitor_id, count, policy=None) | return data | Configures app monitor. | Configures app monitor. | [
"Configures",
"app",
"monitor",
"."
] | def update_appmonitor(zkclient, monitor_id, count, policy=None):
"""Configures app monitor."""
data = get_appmonitor(zkclient, monitor_id)
if data is None:
data = {}
if count is not None:
data['count'] = count
if policy is not None:
data['policy'] = policy
node = z.path... | [
"def",
"update_appmonitor",
"(",
"zkclient",
",",
"monitor_id",
",",
"count",
",",
"policy",
"=",
"None",
")",
":",
"data",
"=",
"get_appmonitor",
"(",
"zkclient",
",",
"monitor_id",
")",
"if",
"data",
"is",
"None",
":",
"data",
"=",
"{",
"}",
"if",
"c... | https://github.com/morganstanley/treadmill/blob/f18267c665baf6def4374d21170198f63ff1cde4/lib/python/treadmill/scheduler/masterapi.py#L316-L332 | |
ales-tsurko/cells | 4cf7e395cd433762bea70cdc863a346f3a6fe1d0 | packaging/macos/python/lib/python3.7/turtle.py | python | RawTurtle.clear | (self) | Delete the turtle's drawings from the screen. Do not move turtle.
No arguments.
Delete the turtle's drawings from the screen. Do not move turtle.
State and position of the turtle as well as drawings of other
turtles are not affected.
Examples (for a Turtle instance named turtl... | Delete the turtle's drawings from the screen. Do not move turtle. | [
"Delete",
"the",
"turtle",
"s",
"drawings",
"from",
"the",
"screen",
".",
"Do",
"not",
"move",
"turtle",
"."
] | def clear(self):
"""Delete the turtle's drawings from the screen. Do not move turtle.
No arguments.
Delete the turtle's drawings from the screen. Do not move turtle.
State and position of the turtle as well as drawings of other
turtles are not affected.
Examples (for a... | [
"def",
"clear",
"(",
"self",
")",
":",
"self",
".",
"_clear",
"(",
")",
"self",
".",
"_update",
"(",
")"
] | https://github.com/ales-tsurko/cells/blob/4cf7e395cd433762bea70cdc863a346f3a6fe1d0/packaging/macos/python/lib/python3.7/turtle.py#L2630-L2643 | ||
BillBillBillBill/Tickeys-linux | 2df31b8665004c58a5d4ab05277f245267d96364 | tickeys/kivy_32/kivy/network/urlrequest.py | python | UrlRequest.resp_status | (self) | return self._resp_status | Return the status code of the response if the request is complete,
otherwise return None. | Return the status code of the response if the request is complete,
otherwise return None. | [
"Return",
"the",
"status",
"code",
"of",
"the",
"response",
"if",
"the",
"request",
"is",
"complete",
"otherwise",
"return",
"None",
"."
] | def resp_status(self):
'''Return the status code of the response if the request is complete,
otherwise return None.
'''
return self._resp_status | [
"def",
"resp_status",
"(",
"self",
")",
":",
"return",
"self",
".",
"_resp_status"
] | https://github.com/BillBillBillBill/Tickeys-linux/blob/2df31b8665004c58a5d4ab05277f245267d96364/tickeys/kivy_32/kivy/network/urlrequest.py#L457-L461 | |
edisonlz/fastor | 342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3 | base/site-packages/docutils/parsers/rst/states.py | python | Text.text | (self, match, context, next_state) | return [], next_state, [] | Paragraph. | Paragraph. | [
"Paragraph",
"."
] | def text(self, match, context, next_state):
"""Paragraph."""
startline = self.state_machine.abs_line_number() - 1
msg = None
try:
block = self.state_machine.get_text_block(flush_left=1)
except statemachine.UnexpectedIndentationError, instance:
block, sourc... | [
"def",
"text",
"(",
"self",
",",
"match",
",",
"context",
",",
"next_state",
")",
":",
"startline",
"=",
"self",
".",
"state_machine",
".",
"abs_line_number",
"(",
")",
"-",
"1",
"msg",
"=",
"None",
"try",
":",
"block",
"=",
"self",
".",
"state_machine... | https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/docutils/parsers/rst/states.py#L2681-L2701 | |
twisted/twisted | dee676b040dd38b847ea6fb112a712cb5e119490 | src/twisted/trial/runner.py | python | isPackage | (module) | return basename == "__init__" | Given an object return True if the object looks like a package | Given an object return True if the object looks like a package | [
"Given",
"an",
"object",
"return",
"True",
"if",
"the",
"object",
"looks",
"like",
"a",
"package"
] | def isPackage(module):
"""Given an object return True if the object looks like a package"""
if not isinstance(module, types.ModuleType):
return False
basename = os.path.splitext(os.path.basename(module.__file__))[0]
return basename == "__init__" | [
"def",
"isPackage",
"(",
"module",
")",
":",
"if",
"not",
"isinstance",
"(",
"module",
",",
"types",
".",
"ModuleType",
")",
":",
"return",
"False",
"basename",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"os",
".",
"path",
".",
"basename",
"(",
"m... | https://github.com/twisted/twisted/blob/dee676b040dd38b847ea6fb112a712cb5e119490/src/twisted/trial/runner.py#L56-L61 | |
ewrfcas/bert_cn_finetune | ec3ccedae5a88f557fe6a407e61af403ac39d9d7 | models/xlnet_modeling.py | python | post_attention | (h, attn_vec, d_model, n_head, d_head, dropout, is_training,
kernel_initializer, residual=True) | return output | Post-attention processing. | Post-attention processing. | [
"Post",
"-",
"attention",
"processing",
"."
] | def post_attention(h, attn_vec, d_model, n_head, d_head, dropout, is_training,
kernel_initializer, residual=True):
"""Post-attention processing."""
# post-attention projection (back to `d_model`)
proj_o = tf.get_variable('o/kernel', [d_model, n_head, d_head],
... | [
"def",
"post_attention",
"(",
"h",
",",
"attn_vec",
",",
"d_model",
",",
"n_head",
",",
"d_head",
",",
"dropout",
",",
"is_training",
",",
"kernel_initializer",
",",
"residual",
"=",
"True",
")",
":",
"# post-attention projection (back to `d_model`)",
"proj_o",
"=... | https://github.com/ewrfcas/bert_cn_finetune/blob/ec3ccedae5a88f557fe6a407e61af403ac39d9d7/models/xlnet_modeling.py#L116-L132 | |
otsaloma/gaupol | 6dec7826654d223c71a8d3279dcd967e95c46714 | aeidon/scripts.py | python | _init_scripts_json | (path) | Initialize the dictionary mapping codes to names. | Initialize the dictionary mapping codes to names. | [
"Initialize",
"the",
"dictionary",
"mapping",
"codes",
"to",
"names",
"."
] | def _init_scripts_json(path):
"""Initialize the dictionary mapping codes to names."""
with open(path, "r", encoding="utf_8") as f:
iso = json.load(f)
for script in iso["15924"]:
code = script.get("alpha_4", None)
name = script.get("name", None)
if not code or not name: contin... | [
"def",
"_init_scripts_json",
"(",
"path",
")",
":",
"with",
"open",
"(",
"path",
",",
"\"r\"",
",",
"encoding",
"=",
"\"utf_8\"",
")",
"as",
"f",
":",
"iso",
"=",
"json",
".",
"load",
"(",
"f",
")",
"for",
"script",
"in",
"iso",
"[",
"\"15924\"",
"... | https://github.com/otsaloma/gaupol/blob/6dec7826654d223c71a8d3279dcd967e95c46714/aeidon/scripts.py#L39-L47 | ||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift_tools/monitoring/ocutil.py | python | OCUtil.get_dc | (self, name) | return self._run_cmd_yaml("get dc {}".format(name)) | Get deployment config details | Get deployment config details | [
"Get",
"deployment",
"config",
"details"
] | def get_dc(self, name):
""" Get deployment config details """
return self._run_cmd_yaml("get dc {}".format(name)) | [
"def",
"get_dc",
"(",
"self",
",",
"name",
")",
":",
"return",
"self",
".",
"_run_cmd_yaml",
"(",
"\"get dc {}\"",
".",
"format",
"(",
"name",
")",
")"
] | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift_tools/monitoring/ocutil.py#L112-L114 | |
rockyzhengwu/FoolNLTK | 5e2cb40c98e98b7397684193ca232e33289a2354 | train/tf_metrics.py | python | precision | (labels, predictions, num_classes, pos_indices=None,
weights=None, average='micro') | return (pr, op) | Multi-class precision metric for Tensorflow
Parameters
----------
labels : Tensor of tf.int32 or tf.int64
The true labels
predictions : Tensor of tf.int32 or tf.int64
The predictions, same shape as labels
num_classes : int
The number of classes
pos_indices : list of int, ... | Multi-class precision metric for Tensorflow
Parameters
----------
labels : Tensor of tf.int32 or tf.int64
The true labels
predictions : Tensor of tf.int32 or tf.int64
The predictions, same shape as labels
num_classes : int
The number of classes
pos_indices : list of int, ... | [
"Multi",
"-",
"class",
"precision",
"metric",
"for",
"Tensorflow",
"Parameters",
"----------",
"labels",
":",
"Tensor",
"of",
"tf",
".",
"int32",
"or",
"tf",
".",
"int64",
"The",
"true",
"labels",
"predictions",
":",
"Tensor",
"of",
"tf",
".",
"int32",
"or... | def precision(labels, predictions, num_classes, pos_indices=None,
weights=None, average='micro'):
"""Multi-class precision metric for Tensorflow
Parameters
----------
labels : Tensor of tf.int32 or tf.int64
The true labels
predictions : Tensor of tf.int32 or tf.int64
Th... | [
"def",
"precision",
"(",
"labels",
",",
"predictions",
",",
"num_classes",
",",
"pos_indices",
"=",
"None",
",",
"weights",
"=",
"None",
",",
"average",
"=",
"'micro'",
")",
":",
"cm",
",",
"op",
"=",
"_streaming_confusion_matrix",
"(",
"labels",
",",
"pre... | https://github.com/rockyzhengwu/FoolNLTK/blob/5e2cb40c98e98b7397684193ca232e33289a2354/train/tf_metrics.py#L17-L52 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_openshift/library/oc_adm_policy_group.py | python | RoleBinding.add_role_ref | (self, inc_role_ref) | return False | add a role_ref | add a role_ref | [
"add",
"a",
"role_ref"
] | def add_role_ref(self, inc_role_ref):
''' add a role_ref '''
if not self.role_ref:
self.put(RoleBinding.role_ref_path, {"name": inc_role_ref})
return True
return False | [
"def",
"add_role_ref",
"(",
"self",
",",
"inc_role_ref",
")",
":",
"if",
"not",
"self",
".",
"role_ref",
":",
"self",
".",
"put",
"(",
"RoleBinding",
".",
"role_ref_path",
",",
"{",
"\"name\"",
":",
"inc_role_ref",
"}",
")",
"return",
"True",
"return",
"... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_openshift/library/oc_adm_policy_group.py#L1593-L1599 | |
ctxis/canape | 5f0e03424577296bcc60c2008a60a98ec5307e4b | CANAPE.Scripting/Lib/inspect.py | python | getinnerframes | (tb, context=1) | return framelist | Get a list of records for a traceback's frame and all lower frames.
Each record contains a frame object, filename, line number, function
name, a list of lines of context, and index within the context. | Get a list of records for a traceback's frame and all lower frames. | [
"Get",
"a",
"list",
"of",
"records",
"for",
"a",
"traceback",
"s",
"frame",
"and",
"all",
"lower",
"frames",
"."
] | def getinnerframes(tb, context=1):
"""Get a list of records for a traceback's frame and all lower frames.
Each record contains a frame object, filename, line number, function
name, a list of lines of context, and index within the context."""
framelist = []
while tb:
framelist.append((tb.tb_... | [
"def",
"getinnerframes",
"(",
"tb",
",",
"context",
"=",
"1",
")",
":",
"framelist",
"=",
"[",
"]",
"while",
"tb",
":",
"framelist",
".",
"append",
"(",
"(",
"tb",
".",
"tb_frame",
",",
")",
"+",
"getframeinfo",
"(",
"tb",
",",
"context",
")",
")",... | https://github.com/ctxis/canape/blob/5f0e03424577296bcc60c2008a60a98ec5307e4b/CANAPE.Scripting/Lib/inspect.py#L1034-L1043 | |
llSourcell/AI_Artist | 3038c06c2e389b9c919c881c9a169efe2fd7810e | lib/python2.7/site-packages/pip/download.py | python | LocalFSAdapter.send | (self, request, stream=None, timeout=None, verify=None, cert=None,
proxies=None) | return resp | [] | def send(self, request, stream=None, timeout=None, verify=None, cert=None,
proxies=None):
pathname = url_to_path(request.url)
resp = Response()
resp.status_code = 200
resp.url = request.url
try:
stats = os.stat(pathname)
except OSError as exc:
... | [
"def",
"send",
"(",
"self",
",",
"request",
",",
"stream",
"=",
"None",
",",
"timeout",
"=",
"None",
",",
"verify",
"=",
"None",
",",
"cert",
"=",
"None",
",",
"proxies",
"=",
"None",
")",
":",
"pathname",
"=",
"url_to_path",
"(",
"request",
".",
"... | https://github.com/llSourcell/AI_Artist/blob/3038c06c2e389b9c919c881c9a169efe2fd7810e/lib/python2.7/site-packages/pip/download.py#L205-L230 | |||
glumpy/glumpy | 46a7635c08d3a200478397edbe0371a6c59cd9d7 | glumpy/glm.py | python | yrotate | (M, theta) | return M | Rotate about the Y axis
Parameters
----------
M : array
Original transformation (4x4).
theta : float
Specifies the angle of rotation, in degrees.
Returns
-------
M : array
Updated transformation (4x4). Note that this function operates
in-place. | Rotate about the Y axis | [
"Rotate",
"about",
"the",
"Y",
"axis"
] | def yrotate(M, theta):
"""Rotate about the Y axis
Parameters
----------
M : array
Original transformation (4x4).
theta : float
Specifies the angle of rotation, in degrees.
Returns
-------
M : array
Updated transformation (4x4). Note that this function operates
... | [
"def",
"yrotate",
"(",
"M",
",",
"theta",
")",
":",
"t",
"=",
"math",
".",
"pi",
"*",
"theta",
"/",
"180",
"cosT",
"=",
"math",
".",
"cos",
"(",
"t",
")",
"sinT",
"=",
"math",
".",
"sin",
"(",
"t",
")",
"R",
"=",
"np",
".",
"array",
"(",
... | https://github.com/glumpy/glumpy/blob/46a7635c08d3a200478397edbe0371a6c59cd9d7/glumpy/glm.py#L132-L157 | |
keras-team/keras | 5caa668b6a415675064a730f5eb46ecc08e40f65 | keras/layers/core/tf_op_layer.py | python | _delegate_method | (keras_tensor_cls, method_name) | Register method on a KerasTensor class.
Calling this function times with the same arguments should be a no-op.
This method exposes an instance method on the KerasTensor class that will use
an `InstanceMethod` layer to run the desired method on the represented
intermediate values in the model.
Args:
ker... | Register method on a KerasTensor class. | [
"Register",
"method",
"on",
"a",
"KerasTensor",
"class",
"."
] | def _delegate_method(keras_tensor_cls, method_name): # pylint: disable=invalid-name
"""Register method on a KerasTensor class.
Calling this function times with the same arguments should be a no-op.
This method exposes an instance method on the KerasTensor class that will use
an `InstanceMethod` layer to run ... | [
"def",
"_delegate_method",
"(",
"keras_tensor_cls",
",",
"method_name",
")",
":",
"# pylint: disable=invalid-name",
"def",
"delegate",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"InstanceMethod",
"(",
"method_name",
")",
"(",
"... | https://github.com/keras-team/keras/blob/5caa668b6a415675064a730f5eb46ecc08e40f65/keras/layers/core/tf_op_layer.py#L353-L371 | ||
tendenci/tendenci | 0f2c348cc0e7d41bc56f50b00ce05544b083bf1d | tendenci/apps/registration/forms.py | python | RegistrationForm.clean | (self) | return self.cleaned_data | Verifiy that the values entered into the two password fields
match. Note that an error here will end up in
``non_field_errors()`` because it doesn't apply to a single
field. | Verifiy that the values entered into the two password fields
match. Note that an error here will end up in
``non_field_errors()`` because it doesn't apply to a single
field. | [
"Verifiy",
"that",
"the",
"values",
"entered",
"into",
"the",
"two",
"password",
"fields",
"match",
".",
"Note",
"that",
"an",
"error",
"here",
"will",
"end",
"up",
"in",
"non_field_errors",
"()",
"because",
"it",
"doesn",
"t",
"apply",
"to",
"a",
"single"... | def clean(self):
"""
Verifiy that the values entered into the two password fields
match. Note that an error here will end up in
``non_field_errors()`` because it doesn't apply to a single
field.
"""
if 'password1' in self.cleaned_data and 'password2' in self.clea... | [
"def",
"clean",
"(",
"self",
")",
":",
"if",
"'password1'",
"in",
"self",
".",
"cleaned_data",
"and",
"'password2'",
"in",
"self",
".",
"cleaned_data",
":",
"if",
"self",
".",
"cleaned_data",
"[",
"'password1'",
"]",
"!=",
"self",
".",
"cleaned_data",
"[",... | https://github.com/tendenci/tendenci/blob/0f2c348cc0e7d41bc56f50b00ce05544b083bf1d/tendenci/apps/registration/forms.py#L59-L70 | |
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/gunicorn-19.9.0/docs/sitemap_gen.py | python | Sitemap.FlushSet | (self) | Flush the current set of URLs to the output. This is a little
slow because we like to sort them all and normalize the priorities
before dumping. | Flush the current set of URLs to the output. This is a little
slow because we like to sort them all and normalize the priorities
before dumping. | [
"Flush",
"the",
"current",
"set",
"of",
"URLs",
"to",
"the",
"output",
".",
"This",
"is",
"a",
"little",
"slow",
"because",
"we",
"like",
"to",
"sort",
"them",
"all",
"and",
"normalize",
"the",
"priorities",
"before",
"dumping",
"."
] | def FlushSet(self):
"""
Flush the current set of URLs to the output. This is a little
slow because we like to sort them all and normalize the priorities
before dumping.
"""
# Sort and normalize
output.Log('Sorting and normalizing collected URLs.', 1)
self._set.sort()
for url in sel... | [
"def",
"FlushSet",
"(",
"self",
")",
":",
"# Sort and normalize",
"output",
".",
"Log",
"(",
"'Sorting and normalizing collected URLs.'",
",",
"1",
")",
"self",
".",
"_set",
".",
"sort",
"(",
")",
"for",
"url",
"in",
"self",
".",
"_set",
":",
"hash",
"=",
... | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/gunicorn-19.9.0/docs/sitemap_gen.py#L1846-L1900 | ||
xmengli/H-DenseUNet | 06cc436a43196310fe933d114a353839907cc176 | Keras-2.0.8/keras/engine/topology.py | python | _collect_previous_mask | (input_tensors) | return masks | Retrieves the output mask(s) of the previous node.
# Arguments
input_tensors: A tensor or list of tensors.
# Returns
A mask tensor or list of mask tensors. | Retrieves the output mask(s) of the previous node. | [
"Retrieves",
"the",
"output",
"mask",
"(",
"s",
")",
"of",
"the",
"previous",
"node",
"."
] | def _collect_previous_mask(input_tensors):
"""Retrieves the output mask(s) of the previous node.
# Arguments
input_tensors: A tensor or list of tensors.
# Returns
A mask tensor or list of mask tensors.
"""
input_tensors = _to_list(input_tensors)
masks = []
for x in input_te... | [
"def",
"_collect_previous_mask",
"(",
"input_tensors",
")",
":",
"input_tensors",
"=",
"_to_list",
"(",
"input_tensors",
")",
"masks",
"=",
"[",
"]",
"for",
"x",
"in",
"input_tensors",
":",
"if",
"hasattr",
"(",
"x",
",",
"'_keras_history'",
")",
":",
"inbou... | https://github.com/xmengli/H-DenseUNet/blob/06cc436a43196310fe933d114a353839907cc176/Keras-2.0.8/keras/engine/topology.py#L2792-L2813 | |
ailabx/ailabx | 4a8c701a3604bbc34157167224588041944ac1a2 | codes/qlib-main/qlib/contrib/online/user.py | python | User.__init__ | (self, account, strategy, model, verbose=False) | A user in online system, which contains account, strategy and model three module.
Parameter
account : Account()
strategy :
a strategy instance
model :
a model instance
report_save_path : string
... | A user in online system, which contains account, strategy and model three module.
Parameter
account : Account()
strategy :
a strategy instance
model :
a model instance
report_save_path : string
... | [
"A",
"user",
"in",
"online",
"system",
"which",
"contains",
"account",
"strategy",
"and",
"model",
"three",
"module",
".",
"Parameter",
"account",
":",
"Account",
"()",
"strategy",
":",
"a",
"strategy",
"instance",
"model",
":",
"a",
"model",
"instance",
"re... | def __init__(self, account, strategy, model, verbose=False):
"""
A user in online system, which contains account, strategy and model three module.
Parameter
account : Account()
strategy :
a strategy instance
model :
... | [
"def",
"__init__",
"(",
"self",
",",
"account",
",",
"strategy",
",",
"model",
",",
"verbose",
"=",
"False",
")",
":",
"self",
".",
"logger",
"=",
"get_module_logger",
"(",
"\"User\"",
",",
"level",
"=",
"logging",
".",
"INFO",
")",
"self",
".",
"accou... | https://github.com/ailabx/ailabx/blob/4a8c701a3604bbc34157167224588041944ac1a2/codes/qlib-main/qlib/contrib/online/user.py#L12-L30 | ||
PaddlePaddle/Research | 2da0bd6c72d60e9df403aff23a7802779561c4a1 | NLP/EMNLP2021-SgSum/src/data_preprocess/roberta/roberta_tokenization.py | python | _is_punctuation | (char) | return False | Checks whether `chars` is a punctuation character. | Checks whether `chars` is a punctuation character. | [
"Checks",
"whether",
"chars",
"is",
"a",
"punctuation",
"character",
"."
] | def _is_punctuation(char):
"""Checks whether `chars` is a punctuation character."""
cp = ord(char)
# We treat all non-letter/number ASCII as punctuation.
# Characters such as "^", "$", and "`" are not in the Unicode
# Punctuation class but we treat them as punctuation anyways, for
# consistency.... | [
"def",
"_is_punctuation",
"(",
"char",
")",
":",
"cp",
"=",
"ord",
"(",
"char",
")",
"# We treat all non-letter/number ASCII as punctuation.",
"# Characters such as \"^\", \"$\", and \"`\" are not in the Unicode",
"# Punctuation class but we treat them as punctuation anyways, for",
"# ... | https://github.com/PaddlePaddle/Research/blob/2da0bd6c72d60e9df403aff23a7802779561c4a1/NLP/EMNLP2021-SgSum/src/data_preprocess/roberta/roberta_tokenization.py#L534-L547 | |
WeblateOrg/weblate | 8126f3dda9d24f2846b755955132a8b8410866c8 | weblate/lang/models.py | python | Language.save | (self, *args, **kwargs) | return super().save(*args, **kwargs) | Set default direction for language. | Set default direction for language. | [
"Set",
"default",
"direction",
"for",
"language",
"."
] | def save(self, *args, **kwargs):
"""Set default direction for language."""
if not self.direction:
self.direction = self.guess_direction()
return super().save(*args, **kwargs) | [
"def",
"save",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"self",
".",
"direction",
":",
"self",
".",
"direction",
"=",
"self",
".",
"guess_direction",
"(",
")",
"return",
"super",
"(",
")",
".",
"save",
"(",
"... | https://github.com/WeblateOrg/weblate/blob/8126f3dda9d24f2846b755955132a8b8410866c8/weblate/lang/models.py#L503-L507 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/combinat/rigged_configurations/kr_tableaux.py | python | KRTableauxTypeFromRC.module_generators | (self) | return self._build_module_generators() | The module generators of ``self``.
EXAMPLES::
sage: KRT = crystals.KirillovReshetikhin(['D',4,3], 2, 1, model='KR')
sage: KRT.module_generators
([[1], [2]], [[1], [0]], [[1], [E]], [[E], [E]]) | The module generators of ``self``. | [
"The",
"module",
"generators",
"of",
"self",
"."
] | def module_generators(self):
"""
The module generators of ``self``.
EXAMPLES::
sage: KRT = crystals.KirillovReshetikhin(['D',4,3], 2, 1, model='KR')
sage: KRT.module_generators
([[1], [2]], [[1], [0]], [[1], [E]], [[E], [E]])
"""
return self.... | [
"def",
"module_generators",
"(",
"self",
")",
":",
"return",
"self",
".",
"_build_module_generators",
"(",
")"
] | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/rigged_configurations/kr_tableaux.py#L1807-L1817 | |
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/lib-python/3/ftplib.py | python | parse257 | (resp) | return dirname | Parse the '257' response for a MKD or PWD request.
This is a response to a MKD or PWD request: a directory name.
Returns the directoryname in the 257 reply. | Parse the '257' response for a MKD or PWD request.
This is a response to a MKD or PWD request: a directory name.
Returns the directoryname in the 257 reply. | [
"Parse",
"the",
"257",
"response",
"for",
"a",
"MKD",
"or",
"PWD",
"request",
".",
"This",
"is",
"a",
"response",
"to",
"a",
"MKD",
"or",
"PWD",
"request",
":",
"a",
"directory",
"name",
".",
"Returns",
"the",
"directoryname",
"in",
"the",
"257",
"repl... | def parse257(resp):
'''Parse the '257' response for a MKD or PWD request.
This is a response to a MKD or PWD request: a directory name.
Returns the directoryname in the 257 reply.'''
if resp[:3] != '257':
raise error_reply(resp)
if resp[3:5] != ' "':
return '' # Not compliant to RFC... | [
"def",
"parse257",
"(",
"resp",
")",
":",
"if",
"resp",
"[",
":",
"3",
"]",
"!=",
"'257'",
":",
"raise",
"error_reply",
"(",
"resp",
")",
"if",
"resp",
"[",
"3",
":",
"5",
"]",
"!=",
"' \"'",
":",
"return",
"''",
"# Not compliant to RFC 959, but UNIX f... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/ftplib.py#L872-L892 | |
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/Xenotix Python Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/codecs.py | python | StreamWriter.write | (self, object) | Writes the object's contents encoded to self.stream. | Writes the object's contents encoded to self.stream. | [
"Writes",
"the",
"object",
"s",
"contents",
"encoded",
"to",
"self",
".",
"stream",
"."
] | def write(self, object):
""" Writes the object's contents encoded to self.stream.
"""
data, consumed = self.encode(object, self.errors)
self.stream.write(data) | [
"def",
"write",
"(",
"self",
",",
"object",
")",
":",
"data",
",",
"consumed",
"=",
"self",
".",
"encode",
"(",
"object",
",",
"self",
".",
"errors",
")",
"self",
".",
"stream",
".",
"write",
"(",
"data",
")"
] | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/codecs.py#L347-L352 | ||
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/states/disk.py | python | _validate_int | (name, value, limits=(), strip="%") | return value, comment | Validate the named integer within the supplied limits inclusive and
strip supplied unit characters | Validate the named integer within the supplied limits inclusive and
strip supplied unit characters | [
"Validate",
"the",
"named",
"integer",
"within",
"the",
"supplied",
"limits",
"inclusive",
"and",
"strip",
"supplied",
"unit",
"characters"
] | def _validate_int(name, value, limits=(), strip="%"):
"""
Validate the named integer within the supplied limits inclusive and
strip supplied unit characters
"""
comment = ""
# Must be integral
try:
if isinstance(value, str):
value = value.strip(" " + strip)
value ... | [
"def",
"_validate_int",
"(",
"name",
",",
"value",
",",
"limits",
"=",
"(",
")",
",",
"strip",
"=",
"\"%\"",
")",
":",
"comment",
"=",
"\"\"",
"# Must be integral",
"try",
":",
"if",
"isinstance",
"(",
"value",
",",
"str",
")",
":",
"value",
"=",
"va... | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/states/disk.py#L53-L73 | |
zetaops/ulakbus | bcc05abf17bbd6dbeec93809e4ad30885e94e83e | ulakbus/views/personel/atama.py | python | PersonelAtama.kadro_durumunu_kontrol_et | (self) | Açık kadroların olup olmadığını kontrol eder. | Açık kadroların olup olmadığını kontrol eder. | [
"Açık",
"kadroların",
"olup",
"olmadığını",
"kontrol",
"eder",
"."
] | def kadro_durumunu_kontrol_et(self):
"""
Açık kadroların olup olmadığını kontrol eder.
"""
if not prepare_choices_for_model(Kadro, durum=2):
self.current.task_data['kadro_bos'] = False
self.current.output['msgbox'] = {
'type': 'info', "title": _(u... | [
"def",
"kadro_durumunu_kontrol_et",
"(",
"self",
")",
":",
"if",
"not",
"prepare_choices_for_model",
"(",
"Kadro",
",",
"durum",
"=",
"2",
")",
":",
"self",
".",
"current",
".",
"task_data",
"[",
"'kadro_bos'",
"]",
"=",
"False",
"self",
".",
"current",
".... | https://github.com/zetaops/ulakbus/blob/bcc05abf17bbd6dbeec93809e4ad30885e94e83e/ulakbus/views/personel/atama.py#L78-L90 | ||
huchunxu/ros_exploring | d09506c4dcb4487be791cceb52ba7c764e614fd8 | robot_learning/tensorflow_object_detection/object_detection/box_coders/faster_rcnn_box_coder.py | python | FasterRcnnBoxCoder._decode | (self, rel_codes, anchors) | return box_list.BoxList(tf.transpose(tf.stack([ymin, xmin, ymax, xmax]))) | Decode relative codes to boxes.
Args:
rel_codes: a tensor representing N anchor-encoded boxes.
anchors: BoxList of anchors.
Returns:
boxes: BoxList holding N bounding boxes. | Decode relative codes to boxes. | [
"Decode",
"relative",
"codes",
"to",
"boxes",
"."
] | def _decode(self, rel_codes, anchors):
"""Decode relative codes to boxes.
Args:
rel_codes: a tensor representing N anchor-encoded boxes.
anchors: BoxList of anchors.
Returns:
boxes: BoxList holding N bounding boxes.
"""
ycenter_a, xcenter_a, ha, wa = anchors.get_center_coordinate... | [
"def",
"_decode",
"(",
"self",
",",
"rel_codes",
",",
"anchors",
")",
":",
"ycenter_a",
",",
"xcenter_a",
",",
"ha",
",",
"wa",
"=",
"anchors",
".",
"get_center_coordinates_and_sizes",
"(",
")",
"ty",
",",
"tx",
",",
"th",
",",
"tw",
"=",
"tf",
".",
... | https://github.com/huchunxu/ros_exploring/blob/d09506c4dcb4487be791cceb52ba7c764e614fd8/robot_learning/tensorflow_object_detection/object_detection/box_coders/faster_rcnn_box_coder.py#L92-L118 | |
datamllab/rlcard | c21ea82519c453a42e3bdc6848bd3356e9b6ac43 | rlcard/games/limitholdem/utils.py | python | Hand._get_Two_Pair_cards | (self) | return Two_Pair_cards | Get the two pair cards among a player's cards
Returns:
(list): best five hand cards after sort | Get the two pair cards among a player's cards
Returns:
(list): best five hand cards after sort | [
"Get",
"the",
"two",
"pair",
"cards",
"among",
"a",
"player",
"s",
"cards",
"Returns",
":",
"(",
"list",
")",
":",
"best",
"five",
"hand",
"cards",
"after",
"sort"
] | def _get_Two_Pair_cards(self):
'''
Get the two pair cards among a player's cards
Returns:
(list): best five hand cards after sort
'''
Two_Pair_cards = []
cards_by_rank = self.cards_by_rank
cards_len = len(cards_by_rank)
for i in reversed(range(... | [
"def",
"_get_Two_Pair_cards",
"(",
"self",
")",
":",
"Two_Pair_cards",
"=",
"[",
"]",
"cards_by_rank",
"=",
"self",
".",
"cards_by_rank",
"cards_len",
"=",
"len",
"(",
"cards_by_rank",
")",
"for",
"i",
"in",
"reversed",
"(",
"range",
"(",
"cards_len",
")",
... | https://github.com/datamllab/rlcard/blob/c21ea82519c453a42e3bdc6848bd3356e9b6ac43/rlcard/games/limitholdem/utils.py#L363-L378 | |
foxmask/django-th | 29aa84f8d4aa945dbef6cf580593b435cc708e31 | th_taiga/api/views.py | python | WikiPage.create | (self, taiga_obj, data) | return data | :param taiga_obj: taiga object
:param data: data to return
:return: data | [] | def create(self, taiga_obj, data):
"""
:param taiga_obj: taiga object
:param data: data to return
:return: data
"""
if taiga_obj.notify_wikipage_create:
data['type_action'] = 'New Wikipage created'
return data | [
"def",
"create",
"(",
"self",
",",
"taiga_obj",
",",
"data",
")",
":",
"if",
"taiga_obj",
".",
"notify_wikipage_create",
":",
"data",
"[",
"'type_action'",
"]",
"=",
"'New Wikipage created'",
"return",
"data"
] | https://github.com/foxmask/django-th/blob/29aa84f8d4aa945dbef6cf580593b435cc708e31/th_taiga/api/views.py#L178-L187 | ||
great-expectations/great_expectations | 45224cb890aeae725af25905923d0dbbab2d969d | great_expectations/validator/validator.py | python | Validator.batches | (self) | return self._batches | Getter for batches | Getter for batches | [
"Getter",
"for",
"batches"
] | def batches(self) -> Dict[str, Batch]:
"""Getter for batches"""
return self._batches | [
"def",
"batches",
"(",
"self",
")",
"->",
"Dict",
"[",
"str",
",",
"Batch",
"]",
":",
"return",
"self",
".",
"_batches"
] | https://github.com/great-expectations/great_expectations/blob/45224cb890aeae725af25905923d0dbbab2d969d/great_expectations/validator/validator.py#L875-L877 | |
buke/GreenOdoo | 3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df | runtime/python/lib/python2.7/site-packages/Werkzeug-0.8.3-py2.7.egg/werkzeug/local.py | python | LocalManager.cleanup | (self) | Manually clean up the data in the locals for this context. Call
this at the end of the request or use `make_middleware()`. | Manually clean up the data in the locals for this context. Call
this at the end of the request or use `make_middleware()`. | [
"Manually",
"clean",
"up",
"the",
"data",
"in",
"the",
"locals",
"for",
"this",
"context",
".",
"Call",
"this",
"at",
"the",
"end",
"of",
"the",
"request",
"or",
"use",
"make_middleware",
"()",
"."
] | def cleanup(self):
"""Manually clean up the data in the locals for this context. Call
this at the end of the request or use `make_middleware()`.
"""
for local in self.locals:
release_local(local) | [
"def",
"cleanup",
"(",
"self",
")",
":",
"for",
"local",
"in",
"self",
".",
"locals",
":",
"release_local",
"(",
"local",
")"
] | https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/site-packages/Werkzeug-0.8.3-py2.7.egg/werkzeug/local.py#L211-L216 | ||
spesmilo/electrum | bdbd59300fbd35b01605e66145458e5f396108e8 | electrum/storage.py | python | WalletStorage.is_encrypted_with_user_pw | (self) | return self.get_encryption_version() == StorageEncryptionVersion.USER_PASSWORD | [] | def is_encrypted_with_user_pw(self):
return self.get_encryption_version() == StorageEncryptionVersion.USER_PASSWORD | [
"def",
"is_encrypted_with_user_pw",
"(",
"self",
")",
":",
"return",
"self",
".",
"get_encryption_version",
"(",
")",
"==",
"StorageEncryptionVersion",
".",
"USER_PASSWORD"
] | https://github.com/spesmilo/electrum/blob/bdbd59300fbd35b01605e66145458e5f396108e8/electrum/storage.py#L118-L119 | |||
rembo10/headphones | b3199605be1ebc83a7a8feab6b1e99b64014187c | lib/requests/models.py | python | Request.prepare | (self) | return p | Constructs a :class:`PreparedRequest <PreparedRequest>` for transmission and returns it. | Constructs a :class:`PreparedRequest <PreparedRequest>` for transmission and returns it. | [
"Constructs",
"a",
":",
"class",
":",
"PreparedRequest",
"<PreparedRequest",
">",
"for",
"transmission",
"and",
"returns",
"it",
"."
] | def prepare(self):
"""Constructs a :class:`PreparedRequest <PreparedRequest>` for transmission and returns it."""
p = PreparedRequest()
p.prepare(
method=self.method,
url=self.url,
headers=self.headers,
files=self.files,
data=self.data,... | [
"def",
"prepare",
"(",
"self",
")",
":",
"p",
"=",
"PreparedRequest",
"(",
")",
"p",
".",
"prepare",
"(",
"method",
"=",
"self",
".",
"method",
",",
"url",
"=",
"self",
".",
"url",
",",
"headers",
"=",
"self",
".",
"headers",
",",
"files",
"=",
"... | https://github.com/rembo10/headphones/blob/b3199605be1ebc83a7a8feab6b1e99b64014187c/lib/requests/models.py#L236-L251 | |
playframework/play1 | 0ecac3bc2421ae2dbec27a368bf671eda1c9cba5 | python/Lib/decimal.py | python | Context.number_class | (self, a) | return a.number_class(context=self) | Returns an indication of the class of the operand.
The class is one of the following strings:
-sNaN
-NaN
-Infinity
-Normal
-Subnormal
-Zero
+Zero
+Subnormal
+Normal
+Infinity
>>> c = Context(ExtendedCon... | Returns an indication of the class of the operand. | [
"Returns",
"an",
"indication",
"of",
"the",
"class",
"of",
"the",
"operand",
"."
] | def number_class(self, a):
"""Returns an indication of the class of the operand.
The class is one of the following strings:
-sNaN
-NaN
-Infinity
-Normal
-Subnormal
-Zero
+Zero
+Subnormal
+Normal
+Infinit... | [
"def",
"number_class",
"(",
"self",
",",
"a",
")",
":",
"a",
"=",
"_convert_other",
"(",
"a",
",",
"raiseit",
"=",
"True",
")",
"return",
"a",
".",
"number_class",
"(",
"context",
"=",
"self",
")"
] | https://github.com/playframework/play1/blob/0ecac3bc2421ae2dbec27a368bf671eda1c9cba5/python/Lib/decimal.py#L4898-L4946 | |
numba/numba | bf480b9e0da858a65508c2b17759a72ee6a44c51 | numba/core/dataflow.py | python | DataFlowAnalysis._unaryop | (self, info, inst) | [] | def _unaryop(self, info, inst):
val = info.pop()
res = info.make_temp()
info.append(inst, value=val, res=res)
info.push(res) | [
"def",
"_unaryop",
"(",
"self",
",",
"info",
",",
"inst",
")",
":",
"val",
"=",
"info",
".",
"pop",
"(",
")",
"res",
"=",
"info",
".",
"make_temp",
"(",
")",
"info",
".",
"append",
"(",
"inst",
",",
"value",
"=",
"val",
",",
"res",
"=",
"res",
... | https://github.com/numba/numba/blob/bf480b9e0da858a65508c2b17759a72ee6a44c51/numba/core/dataflow.py#L422-L426 | ||||
buke/GreenOdoo | 3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df | runtime/common/lib/python2.7/site-packages/libxml2.py | python | uCSIsLinearBSyllabary | (code) | return ret | Check whether the character is part of LinearBSyllabary UCS
Block | Check whether the character is part of LinearBSyllabary UCS
Block | [
"Check",
"whether",
"the",
"character",
"is",
"part",
"of",
"LinearBSyllabary",
"UCS",
"Block"
] | def uCSIsLinearBSyllabary(code):
"""Check whether the character is part of LinearBSyllabary UCS
Block """
ret = libxml2mod.xmlUCSIsLinearBSyllabary(code)
return ret | [
"def",
"uCSIsLinearBSyllabary",
"(",
"code",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlUCSIsLinearBSyllabary",
"(",
"code",
")",
"return",
"ret"
] | https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/common/lib/python2.7/site-packages/libxml2.py#L2653-L2657 | |
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/simpy/core.py | python | Environment.now | (self) | return self._now | The current simulation time. | The current simulation time. | [
"The",
"current",
"simulation",
"time",
"."
] | def now(self):
"""The current simulation time."""
return self._now | [
"def",
"now",
"(",
"self",
")",
":",
"return",
"self",
".",
"_now"
] | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/simpy/core.py#L156-L158 | |
TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials | 5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e | tensorflow_dl_models/research/tcn/dataset/webcam.py | python | capture_webcam | (camera, display_queue, reconcile_queue) | Captures images from simultaneous webcams, writes them to queues.
Args:
camera: A cv2.VideoCapture object representing an open webcam stream.
display_queue: An ImageQueue.
reconcile_queue: An ImageQueue. | Captures images from simultaneous webcams, writes them to queues. | [
"Captures",
"images",
"from",
"simultaneous",
"webcams",
"writes",
"them",
"to",
"queues",
"."
] | def capture_webcam(camera, display_queue, reconcile_queue):
"""Captures images from simultaneous webcams, writes them to queues.
Args:
camera: A cv2.VideoCapture object representing an open webcam stream.
display_queue: An ImageQueue.
reconcile_queue: An ImageQueue.
"""
# Take some ramp images to a... | [
"def",
"capture_webcam",
"(",
"camera",
",",
"display_queue",
",",
"reconcile_queue",
")",
":",
"# Take some ramp images to allow cams to adjust for brightness etc.",
"for",
"i",
"in",
"range",
"(",
"60",
")",
":",
"tf",
".",
"logging",
".",
"info",
"(",
"'Taking ra... | https://github.com/TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials/blob/5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e/tensorflow_dl_models/research/tcn/dataset/webcam.py#L235-L260 | ||
KalleHallden/AutoTimer | 2d954216700c4930baa154e28dbddc34609af7ce | env/lib/python2.7/site-packages/pip/_internal/cli/cmdoptions.py | python | no_binary | () | return Option(
"--no-binary", dest="format_control", action="callback",
callback=_handle_no_binary, type="str",
default=format_control,
help="Do not use binary packages. Can be supplied multiple times, and "
"each time adds to the existing value. Accepts either :all: to "
... | [] | def no_binary():
# type: () -> Option
format_control = FormatControl(set(), set())
return Option(
"--no-binary", dest="format_control", action="callback",
callback=_handle_no_binary, type="str",
default=format_control,
help="Do not use binary packages. Can be supplied multipl... | [
"def",
"no_binary",
"(",
")",
":",
"# type: () -> Option",
"format_control",
"=",
"FormatControl",
"(",
"set",
"(",
")",
",",
"set",
"(",
")",
")",
"return",
"Option",
"(",
"\"--no-binary\"",
",",
"dest",
"=",
"\"format_control\"",
",",
"action",
"=",
"\"cal... | https://github.com/KalleHallden/AutoTimer/blob/2d954216700c4930baa154e28dbddc34609af7ce/env/lib/python2.7/site-packages/pip/_internal/cli/cmdoptions.py#L469-L482 | |||
c0rv4x/project-black | 2d3df00ba1b1453c99ec5a247793a74e11adba2a | black/workers/masscan/masscan_task.py | python | MasscanTask.read_stderr | (self) | Similar to read_stdout | Similar to read_stdout | [
"Similar",
"to",
"read_stdout"
] | async def read_stderr(self):
""" Similar to read_stdout """
if self.status == 'New' or self.status == 'Working':
stderr_chunk = await self.proc.stderr.read(1024)
stderr_chunk_decoded = stderr_chunk.decode('utf-8')
# Strip is a hack which allows not stroing long white... | [
"async",
"def",
"read_stderr",
"(",
"self",
")",
":",
"if",
"self",
".",
"status",
"==",
"'New'",
"or",
"self",
".",
"status",
"==",
"'Working'",
":",
"stderr_chunk",
"=",
"await",
"self",
".",
"proc",
".",
"stderr",
".",
"read",
"(",
"1024",
")",
"s... | https://github.com/c0rv4x/project-black/blob/2d3df00ba1b1453c99ec5a247793a74e11adba2a/black/workers/masscan/masscan_task.py#L88-L115 | ||
tendenci/tendenci | 0f2c348cc0e7d41bc56f50b00ce05544b083bf1d | tendenci/apps/redirects/search_indexes.py | python | RedirectIndex.get_updated_field | (self) | return 'update_dt' | [] | def get_updated_field(self):
return 'update_dt' | [
"def",
"get_updated_field",
"(",
"self",
")",
":",
"return",
"'update_dt'"
] | https://github.com/tendenci/tendenci/blob/0f2c348cc0e7d41bc56f50b00ce05544b083bf1d/tendenci/apps/redirects/search_indexes.py#L25-L26 | |||
sourmash-bio/sourmash | 73aeb155befd7c94042ddb8ca277a69986f25a55 | src/sourmash/signature.py | python | save_signatures | (siglist, fp=None, compression=0) | Save multiple signatures into a JSON string (or into file handle 'fp') | Save multiple signatures into a JSON string (or into file handle 'fp') | [
"Save",
"multiple",
"signatures",
"into",
"a",
"JSON",
"string",
"(",
"or",
"into",
"file",
"handle",
"fp",
")"
] | def save_signatures(siglist, fp=None, compression=0):
"Save multiple signatures into a JSON string (or into file handle 'fp')"
attached_refs = weakref.WeakKeyDictionary()
# get list of rust objects
collected = []
for obj in siglist:
rv = obj._get_objptr()
attached_refs[rv] = obj
... | [
"def",
"save_signatures",
"(",
"siglist",
",",
"fp",
"=",
"None",
",",
"compression",
"=",
"0",
")",
":",
"attached_refs",
"=",
"weakref",
".",
"WeakKeyDictionary",
"(",
")",
"# get list of rust objects",
"collected",
"=",
"[",
"]",
"for",
"obj",
"in",
"sigl... | https://github.com/sourmash-bio/sourmash/blob/73aeb155befd7c94042ddb8ca277a69986f25a55/src/sourmash/signature.py#L338-L371 | ||
CvvT/dumpDex | 92ab3b7e996194a06bf1dd5538a4954e8a5ee9c1 | python/idaapi.py | python | gen_comvar | (*args) | return _idaapi.gen_comvar(*args) | gen_comvar(ea, name) -> bool | gen_comvar(ea, name) -> bool | [
"gen_comvar",
"(",
"ea",
"name",
")",
"-",
">",
"bool"
] | def gen_comvar(*args):
"""
gen_comvar(ea, name) -> bool
"""
return _idaapi.gen_comvar(*args) | [
"def",
"gen_comvar",
"(",
"*",
"args",
")",
":",
"return",
"_idaapi",
".",
"gen_comvar",
"(",
"*",
"args",
")"
] | https://github.com/CvvT/dumpDex/blob/92ab3b7e996194a06bf1dd5538a4954e8a5ee9c1/python/idaapi.py#L4348-L4352 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/bokeh-1.4.0-py3.7.egg/bokeh/server/tornado.py | python | BokehTornado.get_sessions | (self, app_path) | return list(self._applications[app_path].sessions) | Gets all currently active sessions for an application.
Args:
app_path (str) :
The configured application path for the application to return
sessions for.
Returns:
list[ServerSession] | Gets all currently active sessions for an application. | [
"Gets",
"all",
"currently",
"active",
"sessions",
"for",
"an",
"application",
"."
] | def get_sessions(self, app_path):
''' Gets all currently active sessions for an application.
Args:
app_path (str) :
The configured application path for the application to return
sessions for.
Returns:
list[ServerSession]
'''
... | [
"def",
"get_sessions",
"(",
"self",
",",
"app_path",
")",
":",
"if",
"app_path",
"not",
"in",
"self",
".",
"_applications",
":",
"raise",
"ValueError",
"(",
"\"Application %s does not exist on this server\"",
"%",
"app_path",
")",
"return",
"list",
"(",
"self",
... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/bokeh-1.4.0-py3.7.egg/bokeh/server/tornado.py#L516-L530 | |
HexHive/T-Fuzz | 7d150e493237db72c421d423f9a315401cb94e44 | tfuzz/tprogram.py | python | TProgram.is_cgc | (self) | return ret | QUICK HACK by checking the magic values | QUICK HACK by checking the magic values | [
"QUICK",
"HACK",
"by",
"checking",
"the",
"magic",
"values"
] | def is_cgc(self):
'''
QUICK HACK by checking the magic values
'''
ret = False
with open(self.program_path, 'r') as f:
f4 = f.read(4)
if f4[1:] == "CGC":
ret = True
return ret | [
"def",
"is_cgc",
"(",
"self",
")",
":",
"ret",
"=",
"False",
"with",
"open",
"(",
"self",
".",
"program_path",
",",
"'r'",
")",
"as",
"f",
":",
"f4",
"=",
"f",
".",
"read",
"(",
"4",
")",
"if",
"f4",
"[",
"1",
":",
"]",
"==",
"\"CGC\"",
":",
... | https://github.com/HexHive/T-Fuzz/blob/7d150e493237db72c421d423f9a315401cb94e44/tfuzz/tprogram.py#L55-L64 | |
utiasSTARS/pykitti | d3e1bb81676e831886726cc5ed79ce1f049aef2c | pykitti/raw.py | python | raw.__init__ | (self, base_path, date, drive, **kwargs) | Set the path and pre-load calibration data and timestamps. | Set the path and pre-load calibration data and timestamps. | [
"Set",
"the",
"path",
"and",
"pre",
"-",
"load",
"calibration",
"data",
"and",
"timestamps",
"."
] | def __init__(self, base_path, date, drive, **kwargs):
"""Set the path and pre-load calibration data and timestamps."""
self.dataset = kwargs.get('dataset', 'sync')
self.drive = date + '_drive_' + drive + '_' + self.dataset
self.calib_path = os.path.join(base_path, date)
self.data... | [
"def",
"__init__",
"(",
"self",
",",
"base_path",
",",
"date",
",",
"drive",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"dataset",
"=",
"kwargs",
".",
"get",
"(",
"'dataset'",
",",
"'sync'",
")",
"self",
".",
"drive",
"=",
"date",
"+",
"'_driv... | https://github.com/utiasSTARS/pykitti/blob/d3e1bb81676e831886726cc5ed79ce1f049aef2c/pykitti/raw.py#L19-L36 | ||
ARISE-Initiative/robosuite | a5dfaf03cd769170881a1931d8f19c8eb72f531a | robosuite/controllers/interpolators/linear_interpolator.py | python | LinearInterpolator.set_states | (self, dim=None, ori=None) | Updates self.dim and self.ori_interpolate.
Initializes self.start and self.goal with correct dimensions.
Args:
ndim (None or int): Number of dimensions to interpolate
ori_interpolate (None or str): If set, assumes that we are interpolating angles (orientation)
... | Updates self.dim and self.ori_interpolate. | [
"Updates",
"self",
".",
"dim",
"and",
"self",
".",
"ori_interpolate",
"."
] | def set_states(self, dim=None, ori=None):
"""
Updates self.dim and self.ori_interpolate.
Initializes self.start and self.goal with correct dimensions.
Args:
ndim (None or int): Number of dimensions to interpolate
ori_interpolate (None or str): If set, assumes t... | [
"def",
"set_states",
"(",
"self",
",",
"dim",
"=",
"None",
",",
"ori",
"=",
"None",
")",
":",
"# Update self.dim and self.ori_interpolate",
"self",
".",
"dim",
"=",
"dim",
"if",
"dim",
"is",
"not",
"None",
"else",
"self",
".",
"dim",
"self",
".",
"ori_in... | https://github.com/ARISE-Initiative/robosuite/blob/a5dfaf03cd769170881a1931d8f19c8eb72f531a/robosuite/controllers/interpolators/linear_interpolator.py#L52-L79 | ||
xfgryujk/blivedm | d8f7f6b7828069cb6c1fd13f756cfd891f0b1a46 | sample.py | python | run_single_client | () | 演示监听一个直播间 | 演示监听一个直播间 | [
"演示监听一个直播间"
] | async def run_single_client():
"""
演示监听一个直播间
"""
room_id = random.choice(TEST_ROOM_IDS)
# 如果SSL验证失败就把ssl设为False,B站真的有过忘续证书的情况
client = blivedm.BLiveClient(room_id, ssl=True)
handler = MyHandler()
client.add_handler(handler)
client.start()
try:
# 演示5秒后停止
await asy... | [
"async",
"def",
"run_single_client",
"(",
")",
":",
"room_id",
"=",
"random",
".",
"choice",
"(",
"TEST_ROOM_IDS",
")",
"# 如果SSL验证失败就把ssl设为False,B站真的有过忘续证书的情况",
"client",
"=",
"blivedm",
".",
"BLiveClient",
"(",
"room_id",
",",
"ssl",
"=",
"True",
")",
"handler"... | https://github.com/xfgryujk/blivedm/blob/d8f7f6b7828069cb6c1fd13f756cfd891f0b1a46/sample.py#L22-L40 | ||
wrr/wwwhisper | 38a55dd9c828fbb1b5a8234ea3ddf2242e684983 | wwwhisper_auth/http.py | python | HttpResponseNotAuthenticated.__init__ | (self, html_response=None) | Sets WWW-Authenticate header required by the HTTP standard. | Sets WWW-Authenticate header required by the HTTP standard. | [
"Sets",
"WWW",
"-",
"Authenticate",
"header",
"required",
"by",
"the",
"HTTP",
"standard",
"."
] | def __init__(self, html_response=None):
"""Sets WWW-Authenticate header required by the HTTP standard."""
if html_response is None:
body, content_type = 'Authentication required.', TEXT_MIME_TYPE
else:
body, content_type = html_response, HTML_MIME_TYPE
super(HttpR... | [
"def",
"__init__",
"(",
"self",
",",
"html_response",
"=",
"None",
")",
":",
"if",
"html_response",
"is",
"None",
":",
"body",
",",
"content_type",
"=",
"'Authentication required.'",
",",
"TEXT_MIME_TYPE",
"else",
":",
"body",
",",
"content_type",
"=",
"html_r... | https://github.com/wrr/wwwhisper/blob/38a55dd9c828fbb1b5a8234ea3ddf2242e684983/wwwhisper_auth/http.py#L121-L129 | ||
matt852/netconfig | 7d3df1d0678974d5196f534d6f228351758befe0 | app/views.py | python | resultsCfgCmdCustom | () | return render_template("results/resultscfgcmdcustom.html",
host=host,
command=command,
result=result) | Display results from bulk configuration command execution on device. | Display results from bulk configuration command execution on device. | [
"Display",
"results",
"from",
"bulk",
"configuration",
"command",
"execution",
"on",
"device",
"."
] | def resultsCfgCmdCustom():
"""Display results from bulk configuration command execution on device."""
initialChecks()
host = datahandler.getHostByID(session['HOSTID'])
activeSession = sshhandler.retrieveSSHSession(host)
command = session['COMMAND']
result = host.run_multiple_config_commands(... | [
"def",
"resultsCfgCmdCustom",
"(",
")",
":",
"initialChecks",
"(",
")",
"host",
"=",
"datahandler",
".",
"getHostByID",
"(",
"session",
"[",
"'HOSTID'",
"]",
")",
"activeSession",
"=",
"sshhandler",
".",
"retrieveSSHSession",
"(",
"host",
")",
"command",
"=",
... | https://github.com/matt852/netconfig/blob/7d3df1d0678974d5196f534d6f228351758befe0/app/views.py#L673-L694 | |
aws-samples/aws-kube-codesuite | ab4e5ce45416b83bffb947ab8d234df5437f4fca | src/kubernetes/client/models/v1beta1_daemon_set_list.py | python | V1beta1DaemonSetList.to_dict | (self) | return result | Returns the model properties as a dict | Returns the model properties as a dict | [
"Returns",
"the",
"model",
"properties",
"as",
"a",
"dict"
] | def to_dict(self):
"""
Returns the model properties as a dict
"""
result = {}
for attr, _ in iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to... | [
"def",
"to_dict",
"(",
"self",
")",
":",
"result",
"=",
"{",
"}",
"for",
"attr",
",",
"_",
"in",
"iteritems",
"(",
"self",
".",
"swagger_types",
")",
":",
"value",
"=",
"getattr",
"(",
"self",
",",
"attr",
")",
"if",
"isinstance",
"(",
"value",
","... | https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/kubernetes/client/models/v1beta1_daemon_set_list.py#L146-L170 | |
CGATOxford/cgat | 326aad4694bdfae8ddc194171bb5d73911243947 | CGAT/Fastq.py | python | getOffset | (format, raises=True) | return RANGES[format][0] | returns the ASCII offset for a certain format.
If `raises` is set a ValueError is raised if there is not a single
offset. Otherwise, a minimum offset is returned.
Returns
-------
offset : int
The quality score offset | returns the ASCII offset for a certain format. | [
"returns",
"the",
"ASCII",
"offset",
"for",
"a",
"certain",
"format",
"."
] | def getOffset(format, raises=True):
'''returns the ASCII offset for a certain format.
If `raises` is set a ValueError is raised if there is not a single
offset. Otherwise, a minimum offset is returned.
Returns
-------
offset : int
The quality score offset
'''
if type(format) in... | [
"def",
"getOffset",
"(",
"format",
",",
"raises",
"=",
"True",
")",
":",
"if",
"type",
"(",
"format",
")",
"in",
"(",
"set",
",",
"list",
",",
"tuple",
")",
":",
"offsets",
"=",
"set",
"(",
"[",
"RANGES",
"[",
"f",
"]",
"[",
"0",
"]",
"for",
... | https://github.com/CGATOxford/cgat/blob/326aad4694bdfae8ddc194171bb5d73911243947/CGAT/Fastq.py#L395-L417 | |
dfki-ric/phobos | 63ac5f8496df4d6f0b224878936e8cc45d661854 | phobos/operators/editing.py | python | BatchEditPropertyOperator.execute | (self, context) | return {'FINISHED'} | Args:
context:
Returns: | [] | def execute(self, context):
"""
Args:
context:
Returns:
"""
value = gUtils.parse_number(self.property_value)
# delete property when value is empty
if value == '':
for obj in context.selected_objects:
eUtils.removeProperties... | [
"def",
"execute",
"(",
"self",
",",
"context",
")",
":",
"value",
"=",
"gUtils",
".",
"parse_number",
"(",
"self",
".",
"property_value",
")",
"# delete property when value is empty",
"if",
"value",
"==",
"''",
":",
"for",
"obj",
"in",
"context",
".",
"selec... | https://github.com/dfki-ric/phobos/blob/63ac5f8496df4d6f0b224878936e8cc45d661854/phobos/operators/editing.py#L549-L567 | ||
charlesq34/frustum-pointnets | 2ffdd345e1fce4775ecb508d207e0ad465bcca80 | kitti/kitti_util.py | python | Calibration.project_image_to_rect | (self, uv_depth) | return pts_3d_rect | Input: nx3 first two channels are uv, 3rd channel
is depth in rect camera coord.
Output: nx3 points in rect camera coord. | Input: nx3 first two channels are uv, 3rd channel
is depth in rect camera coord.
Output: nx3 points in rect camera coord. | [
"Input",
":",
"nx3",
"first",
"two",
"channels",
"are",
"uv",
"3rd",
"channel",
"is",
"depth",
"in",
"rect",
"camera",
"coord",
".",
"Output",
":",
"nx3",
"points",
"in",
"rect",
"camera",
"coord",
"."
] | def project_image_to_rect(self, uv_depth):
''' Input: nx3 first two channels are uv, 3rd channel
is depth in rect camera coord.
Output: nx3 points in rect camera coord.
'''
n = uv_depth.shape[0]
x = ((uv_depth[:,0]-self.c_u)*uv_depth[:,2])/self.f_u + self.b... | [
"def",
"project_image_to_rect",
"(",
"self",
",",
"uv_depth",
")",
":",
"n",
"=",
"uv_depth",
".",
"shape",
"[",
"0",
"]",
"x",
"=",
"(",
"(",
"uv_depth",
"[",
":",
",",
"0",
"]",
"-",
"self",
".",
"c_u",
")",
"*",
"uv_depth",
"[",
":",
",",
"2... | https://github.com/charlesq34/frustum-pointnets/blob/2ffdd345e1fce4775ecb508d207e0ad465bcca80/kitti/kitti_util.py#L200-L212 | |
econ-ark/HARK | 9562cafef854d9c3d6b4aba2540e3e442ba6ec6c | HARK/interpolation.py | python | HARKinterpolator3D.derivativeY | (self, x, y, z) | return (self._derY(xa.flatten(), ya.flatten(), za.flatten())).reshape(xa.shape) | Evaluates the partial derivative of the interpolated function with respect
to y (the second argument) at the given input.
Parameters
----------
x : np.array or float
Real values to be evaluated in the interpolated function.
y : np.array or float
Real valu... | Evaluates the partial derivative of the interpolated function with respect
to y (the second argument) at the given input. | [
"Evaluates",
"the",
"partial",
"derivative",
"of",
"the",
"interpolated",
"function",
"with",
"respect",
"to",
"y",
"(",
"the",
"second",
"argument",
")",
"at",
"the",
"given",
"input",
"."
] | def derivativeY(self, x, y, z):
"""
Evaluates the partial derivative of the interpolated function with respect
to y (the second argument) at the given input.
Parameters
----------
x : np.array or float
Real values to be evaluated in the interpolated function.... | [
"def",
"derivativeY",
"(",
"self",
",",
"x",
",",
"y",
",",
"z",
")",
":",
"xa",
"=",
"np",
".",
"asarray",
"(",
"x",
")",
"ya",
"=",
"np",
".",
"asarray",
"(",
"y",
")",
"za",
"=",
"np",
".",
"asarray",
"(",
"z",
")",
"return",
"(",
"self"... | https://github.com/econ-ark/HARK/blob/9562cafef854d9c3d6b4aba2540e3e442ba6ec6c/HARK/interpolation.py#L302-L327 | |
obspy/obspy | 0ee5a0d2db293c8d5d4c3b1f148a6c5a85fea55f | obspy/io/pdas/core.py | python | _is_pdas | (filename) | Checks whether a file is a PDAS file or not.
:type filename: str
:param filename: Name of file to be checked.
:rtype: bool
:return: ``True`` if a PDAS file. | Checks whether a file is a PDAS file or not. | [
"Checks",
"whether",
"a",
"file",
"is",
"a",
"PDAS",
"file",
"or",
"not",
"."
] | def _is_pdas(filename):
"""
Checks whether a file is a PDAS file or not.
:type filename: str
:param filename: Name of file to be checked.
:rtype: bool
:return: ``True`` if a PDAS file.
"""
try:
with open(filename, "rb") as fh:
header_fields = [fh.readline().split()[0... | [
"def",
"_is_pdas",
"(",
"filename",
")",
":",
"try",
":",
"with",
"open",
"(",
"filename",
",",
"\"rb\"",
")",
"as",
"fh",
":",
"header_fields",
"=",
"[",
"fh",
".",
"readline",
"(",
")",
".",
"split",
"(",
")",
"[",
"0",
"]",
".",
"decode",
"(",... | https://github.com/obspy/obspy/blob/0ee5a0d2db293c8d5d4c3b1f148a6c5a85fea55f/obspy/io/pdas/core.py#L17-L38 | ||
BigBrotherBot/big-brother-bot | 848823c71413c86e7f1ff9584f43e08d40a7f2c0 | b3/plugins/netblocker/netblock/netblock.py | python | convert | (s, strict = 1) | Return a (low,high) IP number tuple for s, regardless of
whether s is a CIDR, an IP address, or a range. strict is
whether the CIDR is allowed to be an odd CIDR. | Return a (low,high) IP number tuple for s, regardless of
whether s is a CIDR, an IP address, or a range. strict is
whether the CIDR is allowed to be an odd CIDR. | [
"Return",
"a",
"(",
"low",
"high",
")",
"IP",
"number",
"tuple",
"for",
"s",
"regardless",
"of",
"whether",
"s",
"is",
"a",
"CIDR",
"an",
"IP",
"address",
"or",
"a",
"range",
".",
"strict",
"is",
"whether",
"the",
"CIDR",
"is",
"allowed",
"to",
"be",... | def convert(s, strict = 1):
"""Return a (low,high) IP number tuple for s, regardless of
whether s is a CIDR, an IP address, or a range. strict is
whether the CIDR is allowed to be an odd CIDR."""
if s[-1] == '.':
return convtcpwr(s)
elif '/' in s:
return convcidr(s, strict)
elif '-' in s:
return convrange(s... | [
"def",
"convert",
"(",
"s",
",",
"strict",
"=",
"1",
")",
":",
"if",
"s",
"[",
"-",
"1",
"]",
"==",
"'.'",
":",
"return",
"convtcpwr",
"(",
"s",
")",
"elif",
"'/'",
"in",
"s",
":",
"return",
"convcidr",
"(",
"s",
",",
"strict",
")",
"elif",
"... | https://github.com/BigBrotherBot/big-brother-bot/blob/848823c71413c86e7f1ff9584f43e08d40a7f2c0/b3/plugins/netblocker/netblock/netblock.py#L118-L129 | ||
bjmayor/hacker | e3ce2ad74839c2733b27dac6c0f495e0743e1866 | venv/lib/python3.5/site-packages/mechanize/_beautifulsoup.py | python | BeautifulStoneSoup.handle_pi | (self, text) | Propagate processing instructions right through. | Propagate processing instructions right through. | [
"Propagate",
"processing",
"instructions",
"right",
"through",
"."
] | def handle_pi(self, text):
"Propagate processing instructions right through."
self.handle_data("<?%s>" % text) | [
"def",
"handle_pi",
"(",
"self",
",",
"text",
")",
":",
"self",
".",
"handle_data",
"(",
"\"<?%s>\"",
"%",
"text",
")"
] | https://github.com/bjmayor/hacker/blob/e3ce2ad74839c2733b27dac6c0f495e0743e1866/venv/lib/python3.5/site-packages/mechanize/_beautifulsoup.py#L853-L855 | ||
mfessenden/SceneGraph | 0fa3429059c77c881d1b58b28e89dcb44c609909 | ui/settings.py | python | Settings.deleteFile | (self) | return os.remove(self.fileName()) | Delete the preferences file on disk. | Delete the preferences file on disk. | [
"Delete",
"the",
"preferences",
"file",
"on",
"disk",
"."
] | def deleteFile(self):
"""
Delete the preferences file on disk.
"""
log.info('deleting settings: "%s"' % self.fileName())
return os.remove(self.fileName()) | [
"def",
"deleteFile",
"(",
"self",
")",
":",
"log",
".",
"info",
"(",
"'deleting settings: \"%s\"'",
"%",
"self",
".",
"fileName",
"(",
")",
")",
"return",
"os",
".",
"remove",
"(",
"self",
".",
"fileName",
"(",
")",
")"
] | https://github.com/mfessenden/SceneGraph/blob/0fa3429059c77c881d1b58b28e89dcb44c609909/ui/settings.py#L246-L251 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/PIL/PSDraw.py | python | PSDraw.image | (self, box, im, dpi=None) | Draw a PIL image, centered in the given box. | Draw a PIL image, centered in the given box. | [
"Draw",
"a",
"PIL",
"image",
"centered",
"in",
"the",
"given",
"box",
"."
] | def image(self, box, im, dpi=None):
"""Draw a PIL image, centered in the given box."""
# default resolution depends on mode
if not dpi:
if im.mode == "1":
dpi = 200 # fax
else:
dpi = 100 # greyscale
# image size (on paper)
... | [
"def",
"image",
"(",
"self",
",",
"box",
",",
"im",
",",
"dpi",
"=",
"None",
")",
":",
"# default resolution depends on mode",
"if",
"not",
"dpi",
":",
"if",
"im",
".",
"mode",
"==",
"\"1\"",
":",
"dpi",
"=",
"200",
"# fax",
"else",
":",
"dpi",
"=",
... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/PIL/PSDraw.py#L113-L142 | ||
openhatch/oh-mainline | ce29352a034e1223141dcc2f317030bbc3359a51 | vendor/packages/Django/django/core/mail/backends/filebased.py | python | EmailBackend._get_filename | (self) | return self._fname | Return a unique file name. | Return a unique file name. | [
"Return",
"a",
"unique",
"file",
"name",
"."
] | def _get_filename(self):
"""Return a unique file name."""
if self._fname is None:
timestamp = datetime.datetime.now().strftime("%Y%m%d-%H%M%S")
fname = "%s-%s.log" % (timestamp, abs(id(self)))
self._fname = os.path.join(self.file_path, fname)
return self._fnam... | [
"def",
"_get_filename",
"(",
"self",
")",
":",
"if",
"self",
".",
"_fname",
"is",
"None",
":",
"timestamp",
"=",
"datetime",
".",
"datetime",
".",
"now",
"(",
")",
".",
"strftime",
"(",
"\"%Y%m%d-%H%M%S\"",
")",
"fname",
"=",
"\"%s-%s.log\"",
"%",
"(",
... | https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/Django/django/core/mail/backends/filebased.py#L40-L46 | |
dabeaz/python-cookbook | 6e46b78e5644b3e5bf7426d900e2203b7cc630da | src/12/defining_an_actor_task/actor.py | python | Actor.recv | (self) | return msg | Receive an incoming message | Receive an incoming message | [
"Receive",
"an",
"incoming",
"message"
] | def recv(self):
'''
Receive an incoming message
'''
msg = self._mailbox.get()
if msg is ActorExit:
raise ActorExit()
return msg | [
"def",
"recv",
"(",
"self",
")",
":",
"msg",
"=",
"self",
".",
"_mailbox",
".",
"get",
"(",
")",
"if",
"msg",
"is",
"ActorExit",
":",
"raise",
"ActorExit",
"(",
")",
"return",
"msg"
] | https://github.com/dabeaz/python-cookbook/blob/6e46b78e5644b3e5bf7426d900e2203b7cc630da/src/12/defining_an_actor_task/actor.py#L18-L25 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.