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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sympy/sympy | d822fcba181155b85ff2b29fe525adbafb22b448 | sympy/series/limits.py | python | heuristics | (e, z, z0, dir) | return rv | Computes the limit of an expression term-wise.
Parameters are the same as for the ``limit`` function.
Works with the arguments of expression ``e`` one by one, computing
the limit of each and then combining the results. This approach
works only for simple limits, but it is fast. | Computes the limit of an expression term-wise.
Parameters are the same as for the ``limit`` function.
Works with the arguments of expression ``e`` one by one, computing
the limit of each and then combining the results. This approach
works only for simple limits, but it is fast. | [
"Computes",
"the",
"limit",
"of",
"an",
"expression",
"term",
"-",
"wise",
".",
"Parameters",
"are",
"the",
"same",
"as",
"for",
"the",
"limit",
"function",
".",
"Works",
"with",
"the",
"arguments",
"of",
"expression",
"e",
"one",
"by",
"one",
"computing",... | def heuristics(e, z, z0, dir):
"""Computes the limit of an expression term-wise.
Parameters are the same as for the ``limit`` function.
Works with the arguments of expression ``e`` one by one, computing
the limit of each and then combining the results. This approach
works only for simple limits, but... | [
"def",
"heuristics",
"(",
"e",
",",
"z",
",",
"z0",
",",
"dir",
")",
":",
"rv",
"=",
"None",
"if",
"abs",
"(",
"z0",
")",
"is",
"S",
".",
"Infinity",
":",
"rv",
"=",
"limit",
"(",
"e",
".",
"subs",
"(",
"z",
",",
"1",
"/",
"z",
")",
",",
... | https://github.com/sympy/sympy/blob/d822fcba181155b85ff2b29fe525adbafb22b448/sympy/series/limits.py#L70-L128 | |
dragondjf/QMarkdowner | fc79c85ca2949fa9ce3b317606ad7bbcd1299960 | tftpy/TftpContexts.py | python | TftpContext.__init__ | (self, host, port, timeout, dyn_file_func=None) | Constructor for the base context, setting shared instance
variables. | Constructor for the base context, setting shared instance
variables. | [
"Constructor",
"for",
"the",
"base",
"context",
"setting",
"shared",
"instance",
"variables",
"."
] | def __init__(self, host, port, timeout, dyn_file_func=None):
"""Constructor for the base context, setting shared instance
variables."""
self.file_to_transfer = None
self.fileobj = None
self.options = None
self.packethook = None
self.sock = socket.socket(socket.AF_... | [
"def",
"__init__",
"(",
"self",
",",
"host",
",",
"port",
",",
"timeout",
",",
"dyn_file_func",
"=",
"None",
")",
":",
"self",
".",
"file_to_transfer",
"=",
"None",
"self",
".",
"fileobj",
"=",
"None",
"self",
".",
"options",
"=",
"None",
"self",
".",
... | https://github.com/dragondjf/QMarkdowner/blob/fc79c85ca2949fa9ce3b317606ad7bbcd1299960/tftpy/TftpContexts.py#L70-L99 | ||
avocado-framework/avocado | 1f9b3192e8ba47d029c33fe21266bd113d17811f | optional_plugins/varianter_yaml_to_mux/avocado_varianter_yaml_to_mux/mux.py | python | MuxTreeNode.merge | (self, other) | Merges `other` node into this one without checking the name of the
other node. New values are appended, existing values overwritten
and unaffected ones are kept. Then all other node children are
added as children (recursively they get either appended at the end
or merged into existing no... | Merges `other` node into this one without checking the name of the
other node. New values are appended, existing values overwritten
and unaffected ones are kept. Then all other node children are
added as children (recursively they get either appended at the end
or merged into existing no... | [
"Merges",
"other",
"node",
"into",
"this",
"one",
"without",
"checking",
"the",
"name",
"of",
"the",
"other",
"node",
".",
"New",
"values",
"are",
"appended",
"existing",
"values",
"overwritten",
"and",
"unaffected",
"ones",
"are",
"kept",
".",
"Then",
"all"... | def merge(self, other):
"""
Merges `other` node into this one without checking the name of the
other node. New values are appended, existing values overwritten
and unaffected ones are kept. Then all other node children are
added as children (recursively they get either appended a... | [
"def",
"merge",
"(",
"self",
",",
"other",
")",
":",
"for",
"ctrl",
"in",
"other",
".",
"ctrl",
":",
"if",
"isinstance",
"(",
"ctrl",
",",
"Control",
")",
":",
"if",
"ctrl",
".",
"code",
"==",
"REMOVE_NODE",
":",
"remove",
"=",
"[",
"]",
"regexp",
... | https://github.com/avocado-framework/avocado/blob/1f9b3192e8ba47d029c33fe21266bd113d17811f/optional_plugins/varianter_yaml_to_mux/avocado_varianter_yaml_to_mux/mux.py#L323-L353 | ||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_utils/library/yedit.py | python | Yedit.pop | (self, path, key_or_item) | return (False, self.yaml_dict) | remove a key, value pair from a dict or an item for a list | remove a key, value pair from a dict or an item for a list | [
"remove",
"a",
"key",
"value",
"pair",
"from",
"a",
"dict",
"or",
"an",
"item",
"for",
"a",
"list"
] | def pop(self, path, key_or_item):
''' remove a key, value pair from a dict or an item for a list'''
try:
entry = Yedit.get_entry(self.yaml_dict, path, self.separator)
except KeyError:
entry = None
if entry is None:
return (False, self.yaml_dict)
... | [
"def",
"pop",
"(",
"self",
",",
"path",
",",
"key_or_item",
")",
":",
"try",
":",
"entry",
"=",
"Yedit",
".",
"get_entry",
"(",
"self",
".",
"yaml_dict",
",",
"path",
",",
"self",
".",
"separator",
")",
"except",
"KeyError",
":",
"entry",
"=",
"None"... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_utils/library/yedit.py#L521-L551 | |
CoinCheung/BiSeNet | f9231b7c971413e6ebdfcd961fbea53417b18851 | lib/models/bisenetv2.py | python | BiSeNetV2.__init__ | (self, n_classes, aux_mode='train') | [] | def __init__(self, n_classes, aux_mode='train'):
super(BiSeNetV2, self).__init__()
self.aux_mode = aux_mode
self.detail = DetailBranch()
self.segment = SegmentBranch()
self.bga = BGALayer()
## TODO: what is the number of mid chan ?
self.head = SegmentHead(128, 10... | [
"def",
"__init__",
"(",
"self",
",",
"n_classes",
",",
"aux_mode",
"=",
"'train'",
")",
":",
"super",
"(",
"BiSeNetV2",
",",
"self",
")",
".",
"__init__",
"(",
")",
"self",
".",
"aux_mode",
"=",
"aux_mode",
"self",
".",
"detail",
"=",
"DetailBranch",
"... | https://github.com/CoinCheung/BiSeNet/blob/f9231b7c971413e6ebdfcd961fbea53417b18851/lib/models/bisenetv2.py#L314-L329 | ||||
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/modules/rh_service.py | python | status | (name, sig=None) | return results[name] | Return the status for a service.
If the name contains globbing, a dict mapping service name to True/False
values is returned.
.. versionchanged:: 2018.3.0
The service name can now be a glob (e.g. ``salt*``)
Args:
name (str): The name of the service to check
sig (str): Signature... | Return the status for a service.
If the name contains globbing, a dict mapping service name to True/False
values is returned. | [
"Return",
"the",
"status",
"for",
"a",
"service",
".",
"If",
"the",
"name",
"contains",
"globbing",
"a",
"dict",
"mapping",
"service",
"name",
"to",
"True",
"/",
"False",
"values",
"is",
"returned",
"."
] | def status(name, sig=None):
"""
Return the status for a service.
If the name contains globbing, a dict mapping service name to True/False
values is returned.
.. versionchanged:: 2018.3.0
The service name can now be a glob (e.g. ``salt*``)
Args:
name (str): The name of the servi... | [
"def",
"status",
"(",
"name",
",",
"sig",
"=",
"None",
")",
":",
"if",
"sig",
":",
"return",
"bool",
"(",
"__salt__",
"[",
"\"status.pid\"",
"]",
"(",
"sig",
")",
")",
"contains_globbing",
"=",
"bool",
"(",
"re",
".",
"search",
"(",
"r\"\\*|\\?|\\[.+\\... | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/rh_service.py#L495-L541 | |
numba/numba | bf480b9e0da858a65508c2b17759a72ee6a44c51 | numba/core/datamodel/models.py | python | DataModel.traverse | (self, builder) | return [] | Traverse contained members.
Returns a iterable of contained (types, getters).
Each getter is a one-argument function accepting a LLVM value. | Traverse contained members.
Returns a iterable of contained (types, getters).
Each getter is a one-argument function accepting a LLVM value. | [
"Traverse",
"contained",
"members",
".",
"Returns",
"a",
"iterable",
"of",
"contained",
"(",
"types",
"getters",
")",
".",
"Each",
"getter",
"is",
"a",
"one",
"-",
"argument",
"function",
"accepting",
"a",
"LLVM",
"value",
"."
] | def traverse(self, builder):
"""
Traverse contained members.
Returns a iterable of contained (types, getters).
Each getter is a one-argument function accepting a LLVM value.
"""
return [] | [
"def",
"traverse",
"(",
"self",
",",
"builder",
")",
":",
"return",
"[",
"]"
] | https://github.com/numba/numba/blob/bf480b9e0da858a65508c2b17759a72ee6a44c51/numba/core/datamodel/models.py#L89-L95 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/renault/renault_entities.py | python | RenaultEntity.__init__ | (
self,
vehicle: RenaultVehicleProxy,
description: EntityDescription,
) | Initialise entity. | Initialise entity. | [
"Initialise",
"entity",
"."
] | def __init__(
self,
vehicle: RenaultVehicleProxy,
description: EntityDescription,
) -> None:
"""Initialise entity."""
self.vehicle = vehicle
self.entity_description = description
self._attr_device_info = self.vehicle.device_info
self._attr_unique_id = ... | [
"def",
"__init__",
"(",
"self",
",",
"vehicle",
":",
"RenaultVehicleProxy",
",",
"description",
":",
"EntityDescription",
",",
")",
"->",
"None",
":",
"self",
".",
"vehicle",
"=",
"vehicle",
"self",
".",
"entity_description",
"=",
"description",
"self",
".",
... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/renault/renault_entities.py#L33-L42 | ||
meetbill/zabbix_manager | 739e5b51facf19cc6bda2b50f29108f831cf833e | ZabbixTool/lib_zabbix/w_lib/mylib/xlwt/Autofit.py | python | HandleBlankCell | (workBook, row, cell) | return HandleDefaultCell(workBook, row, cell) | Will handle blank cells using the default handler | Will handle blank cells using the default handler | [
"Will",
"handle",
"blank",
"cells",
"using",
"the",
"default",
"handler"
] | def HandleBlankCell(workBook, row, cell):
"""
Will handle blank cells using the default handler
"""
if workBook.emptyCellsAreZero:
return 0
return HandleDefaultCell(workBook, row, cell) | [
"def",
"HandleBlankCell",
"(",
"workBook",
",",
"row",
",",
"cell",
")",
":",
"if",
"workBook",
".",
"emptyCellsAreZero",
":",
"return",
"0",
"return",
"HandleDefaultCell",
"(",
"workBook",
",",
"row",
",",
"cell",
")"
] | https://github.com/meetbill/zabbix_manager/blob/739e5b51facf19cc6bda2b50f29108f831cf833e/ZabbixTool/lib_zabbix/w_lib/mylib/xlwt/Autofit.py#L320-L328 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/interfaces/mathics.py | python | Mathics._object_class | (self) | return MathicsElement | r"""
Return the element class of this parent.
This is used in the interface class.
EXAMPLES::
sage: mathics._object_class()
<class 'sage.interfaces.mathics.MathicsElement'> | r"""
Return the element class of this parent.
This is used in the interface class. | [
"r",
"Return",
"the",
"element",
"class",
"of",
"this",
"parent",
".",
"This",
"is",
"used",
"in",
"the",
"interface",
"class",
"."
] | def _object_class(self):
r"""
Return the element class of this parent.
This is used in the interface class.
EXAMPLES::
sage: mathics._object_class()
<class 'sage.interfaces.mathics.MathicsElement'>
"""
return MathicsElement | [
"def",
"_object_class",
"(",
"self",
")",
":",
"return",
"MathicsElement"
] | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/interfaces/mathics.py#L729-L740 | |
JetBrains/python-skeletons | 95ad24b666e475998e5d1cc02ed53a2188036167 | builtins.py | python | int.__lshift__ | (self, n) | return 0 | x shifted left by n bits.
:type n: numbers.Integral
:rtype: int | x shifted left by n bits. | [
"x",
"shifted",
"left",
"by",
"n",
"bits",
"."
] | def __lshift__(self, n):
"""x shifted left by n bits.
:type n: numbers.Integral
:rtype: int
"""
return 0 | [
"def",
"__lshift__",
"(",
"self",
",",
"n",
")",
":",
"return",
"0"
] | https://github.com/JetBrains/python-skeletons/blob/95ad24b666e475998e5d1cc02ed53a2188036167/builtins.py#L488-L494 | |
molecularsets/moses | 7b8f83b21a9b7ded493349ec8ef292384ce2bb52 | moses/metrics/metrics.py | python | get_all_metrics | (gen, k=None, n_jobs=1,
device='cpu', batch_size=512, pool=None,
test=None, test_scaffolds=None,
ptest=None, ptest_scaffolds=None,
train=None) | return metrics | Computes all available metrics between test (scaffold test)
and generated sets of SMILES.
Parameters:
gen: list of generated SMILES
k: int or list with values for unique@k. Will calculate number of
unique molecules in the first k molecules. Default [1000, 10000]
n_jobs: numbe... | Computes all available metrics between test (scaffold test)
and generated sets of SMILES.
Parameters:
gen: list of generated SMILES
k: int or list with values for unique@k. Will calculate number of
unique molecules in the first k molecules. Default [1000, 10000]
n_jobs: numbe... | [
"Computes",
"all",
"available",
"metrics",
"between",
"test",
"(",
"scaffold",
"test",
")",
"and",
"generated",
"sets",
"of",
"SMILES",
".",
"Parameters",
":",
"gen",
":",
"list",
"of",
"generated",
"SMILES",
"k",
":",
"int",
"or",
"list",
"with",
"values"... | def get_all_metrics(gen, k=None, n_jobs=1,
device='cpu', batch_size=512, pool=None,
test=None, test_scaffolds=None,
ptest=None, ptest_scaffolds=None,
train=None):
"""
Computes all available metrics between test (scaffold test)
a... | [
"def",
"get_all_metrics",
"(",
"gen",
",",
"k",
"=",
"None",
",",
"n_jobs",
"=",
"1",
",",
"device",
"=",
"'cpu'",
",",
"batch_size",
"=",
"512",
",",
"pool",
"=",
"None",
",",
"test",
"=",
"None",
",",
"test_scaffolds",
"=",
"None",
",",
"ptest",
... | https://github.com/molecularsets/moses/blob/7b8f83b21a9b7ded493349ec8ef292384ce2bb52/moses/metrics/metrics.py#L17-L146 | |
researchmm/tasn | 5dba8ccc096cedc63913730eeea14a9647911129 | tasn-mxnet/benchmark/python/sparse/memory_benchmark.py | python | bench_dot | (lhs_row_dim, lhs_col_dim, rhs_col_dim, density,
rhs_density, dot_func, trans_lhs, lhs_stype,
rhs_stype, only_storage, distribution="uniform") | Benchmarking both storage and dot | Benchmarking both storage and dot | [
"Benchmarking",
"both",
"storage",
"and",
"dot"
] | def bench_dot(lhs_row_dim, lhs_col_dim, rhs_col_dim, density,
rhs_density, dot_func, trans_lhs, lhs_stype,
rhs_stype, only_storage, distribution="uniform"):
""" Benchmarking both storage and dot
"""
lhs_nd = rand_ndarray((lhs_row_dim, lhs_col_dim), lhs_stype, density, distributio... | [
"def",
"bench_dot",
"(",
"lhs_row_dim",
",",
"lhs_col_dim",
",",
"rhs_col_dim",
",",
"density",
",",
"rhs_density",
",",
"dot_func",
",",
"trans_lhs",
",",
"lhs_stype",
",",
"rhs_stype",
",",
"only_storage",
",",
"distribution",
"=",
"\"uniform\"",
")",
":",
"... | https://github.com/researchmm/tasn/blob/5dba8ccc096cedc63913730eeea14a9647911129/tasn-mxnet/benchmark/python/sparse/memory_benchmark.py#L79-L89 | ||
Qirky/FoxDot | 76318f9630bede48ff3994146ed644affa27bfa4 | FoxDot/lib/SCLang/SynthDef.py | python | SynthDefBaseClass.get_base_class_variables | (self) | return "var {};".format(", ".join(self.var)) | [] | def get_base_class_variables(self):
return "var {};".format(", ".join(self.var)) | [
"def",
"get_base_class_variables",
"(",
"self",
")",
":",
"return",
"\"var {};\"",
".",
"format",
"(",
"\", \"",
".",
"join",
"(",
"self",
".",
"var",
")",
")"
] | https://github.com/Qirky/FoxDot/blob/76318f9630bede48ff3994146ed644affa27bfa4/FoxDot/lib/SCLang/SynthDef.py#L183-L184 | |||
ctfs/write-ups-2014 | b02bcbb2737907dd0aa39c5d4df1d1e270958f54 | asis-ctf-finals-2014/xorqr/netcatlib/netcatlib.py | python | Netcat.read_some | (self, amount=1) | return buf | Read at least one byte of buffered data unless EOF is hit.
Return '' if EOF is hit. Block if no data is immediately
available. | Read at least one byte of buffered data unless EOF is hit. | [
"Read",
"at",
"least",
"one",
"byte",
"of",
"buffered",
"data",
"unless",
"EOF",
"is",
"hit",
"."
] | def read_some(self, amount=1):
"""Read at least one byte of buffered data unless EOF is hit.
Return '' if EOF is hit. Block if no data is immediately
available.
"""
while not self.buffer and len(self.buffer) < amount and not self.eof:
self.recv_blocking()
b... | [
"def",
"read_some",
"(",
"self",
",",
"amount",
"=",
"1",
")",
":",
"while",
"not",
"self",
".",
"buffer",
"and",
"len",
"(",
"self",
".",
"buffer",
")",
"<",
"amount",
"and",
"not",
"self",
".",
"eof",
":",
"self",
".",
"recv_blocking",
"(",
")",
... | https://github.com/ctfs/write-ups-2014/blob/b02bcbb2737907dd0aa39c5d4df1d1e270958f54/asis-ctf-finals-2014/xorqr/netcatlib/netcatlib.py#L251-L262 | |
NVIDIA/DeepLearningExamples | 589604d49e016cd9ef4525f7abcc9c7b826cfc5e | TensorFlow/Detection/SSD/models/research/object_detection/metrics/coco_tools.py | python | COCOEvalWrapper.GetCategory | (self, category_id) | return self.cocoGt.cats[category_id] | Fetches dictionary holding category information given category id.
Args:
category_id: integer id
Returns:
dictionary holding 'id', 'name'. | Fetches dictionary holding category information given category id. | [
"Fetches",
"dictionary",
"holding",
"category",
"information",
"given",
"category",
"id",
"."
] | def GetCategory(self, category_id):
"""Fetches dictionary holding category information given category id.
Args:
category_id: integer id
Returns:
dictionary holding 'id', 'name'.
"""
return self.cocoGt.cats[category_id] | [
"def",
"GetCategory",
"(",
"self",
",",
"category_id",
")",
":",
"return",
"self",
".",
"cocoGt",
".",
"cats",
"[",
"category_id",
"]"
] | https://github.com/NVIDIA/DeepLearningExamples/blob/589604d49e016cd9ef4525f7abcc9c7b826cfc5e/TensorFlow/Detection/SSD/models/research/object_detection/metrics/coco_tools.py#L175-L183 | |
tyiannak/pyAudioAnalysis | 979c8635e5b6292283b5ee050868d087a55c6371 | pyAudioAnalysis/audioSegmentation.py | python | mid_term_file_classification | (input_file, model_name, model_type,
plot_results=False, gt_file="") | return labels, class_names, accuracy, cm | This function performs mid-term classification of an audio stream.
Towards this end, supervised knowledge is used,
i.e. a pre-trained classifier.
ARGUMENTS:
- input_file: path of the input WAV file
- model_name: name of the classification model
- model_type: svm ... | This function performs mid-term classification of an audio stream.
Towards this end, supervised knowledge is used,
i.e. a pre-trained classifier.
ARGUMENTS:
- input_file: path of the input WAV file
- model_name: name of the classification model
- model_type: svm ... | [
"This",
"function",
"performs",
"mid",
"-",
"term",
"classification",
"of",
"an",
"audio",
"stream",
".",
"Towards",
"this",
"end",
"supervised",
"knowledge",
"is",
"used",
"i",
".",
"e",
".",
"a",
"pre",
"-",
"trained",
"classifier",
".",
"ARGUMENTS",
":"... | def mid_term_file_classification(input_file, model_name, model_type,
plot_results=False, gt_file=""):
"""
This function performs mid-term classification of an audio stream.
Towards this end, supervised knowledge is used,
i.e. a pre-trained classifier.
ARGUMENTS:
... | [
"def",
"mid_term_file_classification",
"(",
"input_file",
",",
"model_name",
",",
"model_type",
",",
"plot_results",
"=",
"False",
",",
"gt_file",
"=",
"\"\"",
")",
":",
"labels",
"=",
"[",
"]",
"accuracy",
"=",
"0.0",
"class_names",
"=",
"[",
"]",
"cm",
"... | https://github.com/tyiannak/pyAudioAnalysis/blob/979c8635e5b6292283b5ee050868d087a55c6371/pyAudioAnalysis/audioSegmentation.py#L518-L597 | |
mkusner/grammarVAE | ffffe272a8cf1772578dfc92254c55c224cddc02 | Theano-master/theano/tensor/opt.py | python | local_add_mul_fusion | (node) | Fuse consecutive add or mul in one such node with more inputs.
It is better to fuse add/mul that way then in a Composite node as
this make the inner graph of the Compiste smaller. This allow to
put more computation in a Composite before hitting the max
recusion limit when pickling Composite. | Fuse consecutive add or mul in one such node with more inputs. | [
"Fuse",
"consecutive",
"add",
"or",
"mul",
"in",
"one",
"such",
"node",
"with",
"more",
"inputs",
"."
] | def local_add_mul_fusion(node):
"""Fuse consecutive add or mul in one such node with more inputs.
It is better to fuse add/mul that way then in a Composite node as
this make the inner graph of the Compiste smaller. This allow to
put more computation in a Composite before hitting the max
recusion li... | [
"def",
"local_add_mul_fusion",
"(",
"node",
")",
":",
"if",
"(",
"not",
"isinstance",
"(",
"node",
".",
"op",
",",
"Elemwise",
")",
"or",
"not",
"isinstance",
"(",
"node",
".",
"op",
".",
"scalar_op",
",",
"(",
"scalar",
".",
"Add",
",",
"scalar",
".... | https://github.com/mkusner/grammarVAE/blob/ffffe272a8cf1772578dfc92254c55c224cddc02/Theano-master/theano/tensor/opt.py#L6745-L6768 | ||
FriedAppleTeam/FRAPL | 89c14d57e0cc77b915fe1e95f60e9e1847699103 | Framework/FridaLink/FridaLink/Core/MemoryEngine.py | python | MemoryEngineProtocol.generateMemoryID | (self, address) | return mem_id | [] | def generateMemoryID(self, address):
idx = 0
mem_id = "0x%X_%d" % (address, idx)
while mem_id in self.memoryMap:
idx += 1
mem_id = "0x%X_%d" % (address, idx)
return mem_id | [
"def",
"generateMemoryID",
"(",
"self",
",",
"address",
")",
":",
"idx",
"=",
"0",
"mem_id",
"=",
"\"0x%X_%d\"",
"%",
"(",
"address",
",",
"idx",
")",
"while",
"mem_id",
"in",
"self",
".",
"memoryMap",
":",
"idx",
"+=",
"1",
"mem_id",
"=",
"\"0x%X_%d\"... | https://github.com/FriedAppleTeam/FRAPL/blob/89c14d57e0cc77b915fe1e95f60e9e1847699103/Framework/FridaLink/FridaLink/Core/MemoryEngine.py#L73-L79 | |||
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/google/appengine/ext/mapreduce/model.py | python | MapperSpec.__init__ | (self,
handler_spec,
input_reader_spec,
params,
shard_count,
output_writer_spec=None) | Creates a new MapperSpec.
Args:
handler_spec: handler specification as string (see class doc for
details).
input_reader_spec: The class name of the input reader to use.
params: Dictionary of additional parameters for the mapper.
shard_count: number of shards to process in parallel.
... | Creates a new MapperSpec. | [
"Creates",
"a",
"new",
"MapperSpec",
"."
] | def __init__(self,
handler_spec,
input_reader_spec,
params,
shard_count,
output_writer_spec=None):
"""Creates a new MapperSpec.
Args:
handler_spec: handler specification as string (see class doc for
details).
input_r... | [
"def",
"__init__",
"(",
"self",
",",
"handler_spec",
",",
"input_reader_spec",
",",
"params",
",",
"shard_count",
",",
"output_writer_spec",
"=",
"None",
")",
":",
"self",
".",
"handler_spec",
"=",
"handler_spec",
"self",
".",
"input_reader_spec",
"=",
"input_re... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/google/appengine/ext/mapreduce/model.py#L375-L401 | ||
quodlibet/quodlibet | e3099c89f7aa6524380795d325cc14630031886c | quodlibet/qltk/songmodel.py | python | PlaylistMux.unqueue | (self, songs) | Remove all occurrences of all passed songs in the queue | Remove all occurrences of all passed songs in the queue | [
"Remove",
"all",
"occurrences",
"of",
"all",
"passed",
"songs",
"in",
"the",
"queue"
] | def unqueue(self, songs):
"""Remove all occurrences of all passed songs in the queue"""
q = self.q
for iter_ in q.find_all(songs):
q.remove(iter_) | [
"def",
"unqueue",
"(",
"self",
",",
"songs",
")",
":",
"q",
"=",
"self",
".",
"q",
"for",
"iter_",
"in",
"q",
".",
"find_all",
"(",
"songs",
")",
":",
"q",
".",
"remove",
"(",
"iter_",
")"
] | https://github.com/quodlibet/quodlibet/blob/e3099c89f7aa6524380795d325cc14630031886c/quodlibet/qltk/songmodel.py#L139-L144 | ||
yt-project/yt | dc7b24f9b266703db4c843e329c6c8644d47b824 | yt/visualization/plot_container.py | python | PlotContainer.get_log | (self, field) | return log | get the transform type of a field.
Parameters
----------
field : string
the field to get a transform
if field == 'all', applies to all plots. | get the transform type of a field. | [
"get",
"the",
"transform",
"type",
"of",
"a",
"field",
"."
] | def get_log(self, field):
"""get the transform type of a field.
Parameters
----------
field : string
the field to get a transform
if field == 'all', applies to all plots.
"""
# devnote : accepts_all_fields decorator is not applicable here because... | [
"def",
"get_log",
"(",
"self",
",",
"field",
")",
":",
"# devnote : accepts_all_fields decorator is not applicable here because",
"# the return variable isn't self",
"log",
"=",
"{",
"}",
"if",
"field",
"==",
"\"all\"",
":",
"fields",
"=",
"list",
"(",
"self",
".",
... | https://github.com/yt-project/yt/blob/dc7b24f9b266703db4c843e329c6c8644d47b824/yt/visualization/plot_container.py#L316-L335 | |
LeGoffLoic/Nodz | 0ee255c62883f7a374a9de6cbcf555e3352e5dec | nodz_main.py | python | SlotItem.paint | (self, painter, option, widget) | Paint the Slot. | Paint the Slot. | [
"Paint",
"the",
"Slot",
"."
] | def paint(self, painter, option, widget):
"""
Paint the Slot.
"""
painter.setBrush(self.brush)
painter.setPen(self.pen)
nodzInst = self.scene().views()[0]
config = nodzInst.config
if nodzInst.drawingConnection:
if self.parentItem() == nodzIns... | [
"def",
"paint",
"(",
"self",
",",
"painter",
",",
"option",
",",
"widget",
")",
":",
"painter",
".",
"setBrush",
"(",
"self",
".",
"brush",
")",
"painter",
".",
"setPen",
"(",
"self",
".",
"pen",
")",
"nodzInst",
"=",
"self",
".",
"scene",
"(",
")"... | https://github.com/LeGoffLoic/Nodz/blob/0ee255c62883f7a374a9de6cbcf555e3352e5dec/nodz_main.py#L1672-L1695 | ||
wistbean/learn_python3_spider | 73c873f4845f4385f097e5057407d03dd37a117b | stackoverflow/venv/lib/python3.6/site-packages/attr/_funcs.py | python | has | (cls) | return getattr(cls, "__attrs_attrs__", None) is not None | Check whether *cls* is a class with ``attrs`` attributes.
:param type cls: Class to introspect.
:raise TypeError: If *cls* is not a class.
:rtype: bool | Check whether *cls* is a class with ``attrs`` attributes. | [
"Check",
"whether",
"*",
"cls",
"*",
"is",
"a",
"class",
"with",
"attrs",
"attributes",
"."
] | def has(cls):
"""
Check whether *cls* is a class with ``attrs`` attributes.
:param type cls: Class to introspect.
:raise TypeError: If *cls* is not a class.
:rtype: bool
"""
return getattr(cls, "__attrs_attrs__", None) is not None | [
"def",
"has",
"(",
"cls",
")",
":",
"return",
"getattr",
"(",
"cls",
",",
"\"__attrs_attrs__\"",
",",
"None",
")",
"is",
"not",
"None"
] | https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/attr/_funcs.py#L215-L224 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/astropy-4.0-py3.7-macosx-10.9-x86_64.egg/astropy/utils/iers/iers.py | python | LeapSeconds.from_erfa | (cls, built_in=False) | Create table from the leap-second list in ERFA.
Parameters
----------
built_in : bool
If `False` (default), retrieve the list currently used by ERFA,
which may have been updated. If `True`, retrieve the list shipped
with erfa. | Create table from the leap-second list in ERFA. | [
"Create",
"table",
"from",
"the",
"leap",
"-",
"second",
"list",
"in",
"ERFA",
"."
] | def from_erfa(cls, built_in=False):
"""Create table from the leap-second list in ERFA.
Parameters
----------
built_in : bool
If `False` (default), retrieve the list currently used by ERFA,
which may have been updated. If `True`, retrieve the list shipped
... | [
"def",
"from_erfa",
"(",
"cls",
",",
"built_in",
"=",
"False",
")",
":",
"current",
"=",
"cls",
"(",
"erfa",
".",
"leap_seconds",
".",
"get",
"(",
")",
")",
"current",
".",
"_expires",
"=",
"Time",
"(",
"'{0.year:04d}-{0.month:02d}-{0.day:02d}'",
".",
"for... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/astropy-4.0-py3.7-macosx-10.9-x86_64.egg/astropy/utils/iers/iers.py#L1100-L1121 | ||
sangwoomo/instagan | f9c1d9c9b7d2c21491317921f24a5200a02a823d | models/cycle_gan_model.py | python | CycleGANModel.initialize | (self, opt) | [] | def initialize(self, opt):
BaseModel.initialize(self, opt)
# specify the training losses you want to print out. The program will call base_model.get_current_losses
self.loss_names = ['D_A', 'G_A', 'cycle_A', 'idt_A', 'D_B', 'G_B', 'cycle_B', 'idt_B']
# specify the images you want to sav... | [
"def",
"initialize",
"(",
"self",
",",
"opt",
")",
":",
"BaseModel",
".",
"initialize",
"(",
"self",
",",
"opt",
")",
"# specify the training losses you want to print out. The program will call base_model.get_current_losses",
"self",
".",
"loss_names",
"=",
"[",
"'D_A'",
... | https://github.com/sangwoomo/instagan/blob/f9c1d9c9b7d2c21491317921f24a5200a02a823d/models/cycle_gan_model.py#L23-L71 | ||||
JaniceWuo/MovieRecommend | 4c86db64ca45598917d304f535413df3bc9fea65 | movierecommend/venv1/Lib/site-packages/django/db/backends/base/schema.py | python | BaseDatabaseSchemaEditor.alter_index_together | (self, model, old_index_together, new_index_together) | Deals with a model changing its index_together.
Note: The input index_togethers must be doubly-nested, not the single-
nested ["foo", "bar"] format. | Deals with a model changing its index_together.
Note: The input index_togethers must be doubly-nested, not the single-
nested ["foo", "bar"] format. | [
"Deals",
"with",
"a",
"model",
"changing",
"its",
"index_together",
".",
"Note",
":",
"The",
"input",
"index_togethers",
"must",
"be",
"doubly",
"-",
"nested",
"not",
"the",
"single",
"-",
"nested",
"[",
"foo",
"bar",
"]",
"format",
"."
] | def alter_index_together(self, model, old_index_together, new_index_together):
"""
Deals with a model changing its index_together.
Note: The input index_togethers must be doubly-nested, not the single-
nested ["foo", "bar"] format.
"""
olds = set(tuple(fields) for fields ... | [
"def",
"alter_index_together",
"(",
"self",
",",
"model",
",",
"old_index_together",
",",
"new_index_together",
")",
":",
"olds",
"=",
"set",
"(",
"tuple",
"(",
"fields",
")",
"for",
"fields",
"in",
"old_index_together",
")",
"news",
"=",
"set",
"(",
"tuple"... | https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/django/db/backends/base/schema.py#L355-L369 | ||
tomplus/kubernetes_asyncio | f028cc793e3a2c519be6a52a49fb77ff0b014c9b | kubernetes_asyncio/client/models/v1_endpoint_port.py | python | V1EndpointPort.name | (self) | return self._name | Gets the name of this V1EndpointPort. # noqa: E501
The name of this port. This must match the 'name' field in the corresponding ServicePort. Must be a DNS_LABEL. Optional only if one port is defined. # noqa: E501
:return: The name of this V1EndpointPort. # noqa: E501
:rtype: str | Gets the name of this V1EndpointPort. # noqa: E501 | [
"Gets",
"the",
"name",
"of",
"this",
"V1EndpointPort",
".",
"#",
"noqa",
":",
"E501"
] | def name(self):
"""Gets the name of this V1EndpointPort. # noqa: E501
The name of this port. This must match the 'name' field in the corresponding ServicePort. Must be a DNS_LABEL. Optional only if one port is defined. # noqa: E501
:return: The name of this V1EndpointPort. # noqa: E501
... | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/models/v1_endpoint_port.py#L93-L101 | |
fmilthaler/FinQuant | 38a2884663eea228540abd094b5c163f96c55aff | finquant/moving_average.py | python | compute_ma | (data, fun, spans, plot=True) | return ma | Computes a band of moving averages (sma or ema, depends on the input argument
`fun`) for a number of different time windows. If `plot` is `True`, it also
computes and sets markers for buy/sell signals based on crossovers of the Moving
Averages with the shortest/longest spans.
:Input:
:data: pandas... | Computes a band of moving averages (sma or ema, depends on the input argument
`fun`) for a number of different time windows. If `plot` is `True`, it also
computes and sets markers for buy/sell signals based on crossovers of the Moving
Averages with the shortest/longest spans. | [
"Computes",
"a",
"band",
"of",
"moving",
"averages",
"(",
"sma",
"or",
"ema",
"depends",
"on",
"the",
"input",
"argument",
"fun",
")",
"for",
"a",
"number",
"of",
"different",
"time",
"windows",
".",
"If",
"plot",
"is",
"True",
"it",
"also",
"computes",
... | def compute_ma(data, fun, spans, plot=True):
"""Computes a band of moving averages (sma or ema, depends on the input argument
`fun`) for a number of different time windows. If `plot` is `True`, it also
computes and sets markers for buy/sell signals based on crossovers of the Moving
Averages with the sho... | [
"def",
"compute_ma",
"(",
"data",
",",
"fun",
",",
"spans",
",",
"plot",
"=",
"True",
")",
":",
"if",
"not",
"isinstance",
"(",
"data",
",",
"pd",
".",
"DataFrame",
")",
":",
"raise",
"ValueError",
"(",
"\"data must be of type pandas.DataFrame\"",
")",
"# ... | https://github.com/fmilthaler/FinQuant/blob/38a2884663eea228540abd094b5c163f96c55aff/finquant/moving_average.py#L15-L82 | |
openmc-dev/openmc | 0cf7d9283786677e324bfbdd0984a54d1c86dacc | openmc/data/reaction.py | python | _get_photon_products_endf | (ev, rx) | return products | Generate photon products from an ENDF evaluation
Parameters
----------
ev : openmc.data.endf.Evaluation
ENDF evaluation to read from
rx : openmc.data.Reaction
Reaction that generates photons
Returns
-------
products : list of openmc.Products
Photons produced from re... | Generate photon products from an ENDF evaluation | [
"Generate",
"photon",
"products",
"from",
"an",
"ENDF",
"evaluation"
] | def _get_photon_products_endf(ev, rx):
"""Generate photon products from an ENDF evaluation
Parameters
----------
ev : openmc.data.endf.Evaluation
ENDF evaluation to read from
rx : openmc.data.Reaction
Reaction that generates photons
Returns
-------
products : list of op... | [
"def",
"_get_photon_products_endf",
"(",
"ev",
",",
"rx",
")",
":",
"products",
"=",
"[",
"]",
"if",
"(",
"12",
",",
"rx",
".",
"mt",
")",
"in",
"ev",
".",
"section",
":",
"file_obj",
"=",
"StringIO",
"(",
"ev",
".",
"section",
"[",
"12",
",",
"r... | https://github.com/openmc-dev/openmc/blob/0cf7d9283786677e324bfbdd0984a54d1c86dacc/openmc/data/reaction.py#L664-L772 | |
google/grr | 8ad8a4d2c5a93c92729206b7771af19d92d4f915 | api_client/python/grr_api_client/hunt.py | python | HuntBase.GetClientCompletionStats | (
self) | return response | [] | def GetClientCompletionStats(
self) -> hunt_pb2.ApiGetHuntClientCompletionStatsResult:
args = hunt_pb2.ApiGetHuntClientCompletionStatsArgs(hunt_id=self.hunt_id)
response = self._context.SendRequest("GetHuntClientCompletionStats", args)
if not isinstance(response, hunt_pb2.ApiGetHuntClientCompletionSt... | [
"def",
"GetClientCompletionStats",
"(",
"self",
")",
"->",
"hunt_pb2",
".",
"ApiGetHuntClientCompletionStatsResult",
":",
"args",
"=",
"hunt_pb2",
".",
"ApiGetHuntClientCompletionStatsArgs",
"(",
"hunt_id",
"=",
"self",
".",
"hunt_id",
")",
"response",
"=",
"self",
... | https://github.com/google/grr/blob/8ad8a4d2c5a93c92729206b7771af19d92d4f915/api_client/python/grr_api_client/hunt.py#L334-L342 | |||
jbjorne/TEES | caf19a4a1352ac59f5dc13a8684cc42ce4342d9d | ExampleBuilders/FeatureBuilders/DrugFeatureBuilder.py | python | DrugFeatureBuilder.buildMTMXFeatures | (self, e1, e2) | [] | def buildMTMXFeatures(self, e1, e2):
names = self.getMTMXAttrs(e1, e2, "mtmxName")
self.setFeature("mtmxNames-" + "-".join(names))
if names[0] == names[1]:
if names[0] in ["", "none"]:
self.setFeature("mtmxNames-both_unknown")
else:
self.se... | [
"def",
"buildMTMXFeatures",
"(",
"self",
",",
"e1",
",",
"e2",
")",
":",
"names",
"=",
"self",
".",
"getMTMXAttrs",
"(",
"e1",
",",
"e2",
",",
"\"mtmxName\"",
")",
"self",
".",
"setFeature",
"(",
"\"mtmxNames-\"",
"+",
"\"-\"",
".",
"join",
"(",
"names... | https://github.com/jbjorne/TEES/blob/caf19a4a1352ac59f5dc13a8684cc42ce4342d9d/ExampleBuilders/FeatureBuilders/DrugFeatureBuilder.py#L96-L129 | ||||
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/voice/v1/byoc_trunk.py | python | ByocTrunkInstance.voice_method | (self) | return self._properties['voice_method'] | :returns: The HTTP method to use with voice_url
:rtype: unicode | :returns: The HTTP method to use with voice_url
:rtype: unicode | [
":",
"returns",
":",
"The",
"HTTP",
"method",
"to",
"use",
"with",
"voice_url",
":",
"rtype",
":",
"unicode"
] | def voice_method(self):
"""
:returns: The HTTP method to use with voice_url
:rtype: unicode
"""
return self._properties['voice_method'] | [
"def",
"voice_method",
"(",
"self",
")",
":",
"return",
"self",
".",
"_properties",
"[",
"'voice_method'",
"]"
] | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/voice/v1/byoc_trunk.py#L390-L395 | |
saimadhu-polamuri/DataAspirant_codes | 4adfdad255a90ef39fca1bf83a927ffb129dda78 | text_preprocessing_techniques/scripts/preprocessing.py | python | Preprocess.emoticons_words | (self, text) | return text | Return :- string after converting emoticons to words
Input :- String
Output :- String | Return :- string after converting emoticons to words
Input :- String
Output :- String | [
"Return",
":",
"-",
"string",
"after",
"converting",
"emoticons",
"to",
"words",
"Input",
":",
"-",
"String",
"Output",
":",
"-",
"String"
] | def emoticons_words(self, text):
"""
Return :- string after converting emoticons to words
Input :- String
Output :- String
"""
for emot in EMOTICONS:
emoticon_pattern = r'('+emot+')'
# replace
emoticon_words = EMOTICONS[emot]
replace_text = emoticon_words.replace(",","")
replace_text = repla... | [
"def",
"emoticons_words",
"(",
"self",
",",
"text",
")",
":",
"for",
"emot",
"in",
"EMOTICONS",
":",
"emoticon_pattern",
"=",
"r'('",
"+",
"emot",
"+",
"')'",
"# replace ",
"emoticon_words",
"=",
"EMOTICONS",
"[",
"emot",
"]",
"replace_text",
"=",
"emoticon_... | https://github.com/saimadhu-polamuri/DataAspirant_codes/blob/4adfdad255a90ef39fca1bf83a927ffb129dda78/text_preprocessing_techniques/scripts/preprocessing.py#L265-L280 | |
pymedusa/Medusa | 1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38 | medusa/providers/torrent/html/anidex.py | python | AniDexProvider.random_sixteen | () | return ''.join(random.choice(
string.ascii_uppercase + string.ascii_lowercase + string.digits
) for _ in range(16)) | Create 16 character string, for cookies.
This will bypass DDos-guard.net protection | Create 16 character string, for cookies. | [
"Create",
"16",
"character",
"string",
"for",
"cookies",
"."
] | def random_sixteen():
"""
Create 16 character string, for cookies.
This will bypass DDos-guard.net protection
"""
return ''.join(random.choice(
string.ascii_uppercase + string.ascii_lowercase + string.digits
) for _ in range(16)) | [
"def",
"random_sixteen",
"(",
")",
":",
"return",
"''",
".",
"join",
"(",
"random",
".",
"choice",
"(",
"string",
".",
"ascii_uppercase",
"+",
"string",
".",
"ascii_lowercase",
"+",
"string",
".",
"digits",
")",
"for",
"_",
"in",
"range",
"(",
"16",
")... | https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/medusa/providers/torrent/html/anidex.py#L53-L61 | |
albertz/music-player | d23586f5bf657cbaea8147223be7814d117ae73d | mac/pyobjc-framework-Quartz/Examples/Programming with Quartz/BasicDrawing/AppDrawing.py | python | doJPEGDocumentWithMultipleProfiles | (context) | [] | def doJPEGDocumentWithMultipleProfiles(context):
url = GetURL(kOurSubstituteJPG)
if url is not None:
Images.drawJPEGDocumentWithMultipleProfiles(context, url) | [
"def",
"doJPEGDocumentWithMultipleProfiles",
"(",
"context",
")",
":",
"url",
"=",
"GetURL",
"(",
"kOurSubstituteJPG",
")",
"if",
"url",
"is",
"not",
"None",
":",
"Images",
".",
"drawJPEGDocumentWithMultipleProfiles",
"(",
"context",
",",
"url",
")"
] | https://github.com/albertz/music-player/blob/d23586f5bf657cbaea8147223be7814d117ae73d/mac/pyobjc-framework-Quartz/Examples/Programming with Quartz/BasicDrawing/AppDrawing.py#L123-L127 | ||||
eirannejad/pyRevit | 49c0b7eb54eb343458ce1365425e6552d0c47d44 | site-packages/sqlalchemy/orm/events.py | python | InstanceEvents.init | (self, target, args, kwargs) | Receive an instance when its constructor is called.
This method is only called during a userland construction of
an object, in conjunction with the object's constructor, e.g.
its ``__init__`` method. It is not called when an object is
loaded from the database; see the :meth:`.InstanceE... | Receive an instance when its constructor is called. | [
"Receive",
"an",
"instance",
"when",
"its",
"constructor",
"is",
"called",
"."
] | def init(self, target, args, kwargs):
"""Receive an instance when its constructor is called.
This method is only called during a userland construction of
an object, in conjunction with the object's constructor, e.g.
its ``__init__`` method. It is not called when an object is
lo... | [
"def",
"init",
"(",
"self",
",",
"target",
",",
"args",
",",
"kwargs",
")",
":"
] | https://github.com/eirannejad/pyRevit/blob/49c0b7eb54eb343458ce1365425e6552d0c47d44/site-packages/sqlalchemy/orm/events.py#L227-L256 | ||
twisted/twisted | dee676b040dd38b847ea6fb112a712cb5e119490 | src/twisted/trial/runner.py | python | isPackageDirectory | (dirname) | return False | Is the directory at path 'dirname' a Python package directory?
Returns the name of the __init__ file (it may have a weird extension)
if dirname is a package directory. Otherwise, returns False | Is the directory at path 'dirname' a Python package directory?
Returns the name of the __init__ file (it may have a weird extension)
if dirname is a package directory. Otherwise, returns False | [
"Is",
"the",
"directory",
"at",
"path",
"dirname",
"a",
"Python",
"package",
"directory?",
"Returns",
"the",
"name",
"of",
"the",
"__init__",
"file",
"(",
"it",
"may",
"have",
"a",
"weird",
"extension",
")",
"if",
"dirname",
"is",
"a",
"package",
"director... | def isPackageDirectory(dirname):
"""
Is the directory at path 'dirname' a Python package directory?
Returns the name of the __init__ file (it may have a weird extension)
if dirname is a package directory. Otherwise, returns False
"""
def _getSuffixes():
return importlib.machinery.all_s... | [
"def",
"isPackageDirectory",
"(",
"dirname",
")",
":",
"def",
"_getSuffixes",
"(",
")",
":",
"return",
"importlib",
".",
"machinery",
".",
"all_suffixes",
"(",
")",
"for",
"ext",
"in",
"_getSuffixes",
"(",
")",
":",
"initFile",
"=",
"\"__init__\"",
"+",
"e... | https://github.com/twisted/twisted/blob/dee676b040dd38b847ea6fb112a712cb5e119490/src/twisted/trial/runner.py#L64-L78 | |
TheSouthFrog/stylealign | 910632d2fccc9db61b00c265ae18a88913113c1d | util/buffer.py | python | BufferedWrapper.__next__ | (self) | return result | [] | def __next__(self):
result = self.buffer_.get()
self._async_next()
return result | [
"def",
"__next__",
"(",
"self",
")",
":",
"result",
"=",
"self",
".",
"buffer_",
".",
"get",
"(",
")",
"self",
".",
"_async_next",
"(",
")",
"return",
"result"
] | https://github.com/TheSouthFrog/stylealign/blob/910632d2fccc9db61b00c265ae18a88913113c1d/util/buffer.py#L17-L20 | |||
ESCOMP/CESM | 4e21488773baa1bd9fb06fb8750db9f9bd12b705 | manage_externals/manic/repository_svn.py | python | SvnRepository.__init__ | (self, component_name, repo, ignore_ancestry=False) | Parse repo (a <repo> XML element). | Parse repo (a <repo> XML element). | [
"Parse",
"repo",
"(",
"a",
"<repo",
">",
"XML",
"element",
")",
"."
] | def __init__(self, component_name, repo, ignore_ancestry=False):
"""
Parse repo (a <repo> XML element).
"""
Repository.__init__(self, component_name, repo)
self._ignore_ancestry = ignore_ancestry
if self._branch:
self._url = os.path.join(self._url, self._branc... | [
"def",
"__init__",
"(",
"self",
",",
"component_name",
",",
"repo",
",",
"ignore_ancestry",
"=",
"False",
")",
":",
"Repository",
".",
"__init__",
"(",
"self",
",",
"component_name",
",",
"repo",
")",
"self",
".",
"_ignore_ancestry",
"=",
"ignore_ancestry",
... | https://github.com/ESCOMP/CESM/blob/4e21488773baa1bd9fb06fb8750db9f9bd12b705/manage_externals/manic/repository_svn.py#L40-L52 | ||
jython/jython3 | def4f8ec47cb7a9c799ea4c745f12badf92c5769 | lib-python/3.5.1/idlelib/SearchDialogBase.py | python | SearchDialogBase.create_command_buttons | (self) | Place buttons in vertical command frame gridded on right. | Place buttons in vertical command frame gridded on right. | [
"Place",
"buttons",
"in",
"vertical",
"command",
"frame",
"gridded",
"on",
"right",
"."
] | def create_command_buttons(self):
"Place buttons in vertical command frame gridded on right."
f = self.buttonframe = Frame(self.top)
f.grid(row=0,column=2,padx=2,pady=2,ipadx=2,ipady=2)
b = self.make_button("close", self.close)
b.lower() | [
"def",
"create_command_buttons",
"(",
"self",
")",
":",
"f",
"=",
"self",
".",
"buttonframe",
"=",
"Frame",
"(",
"self",
".",
"top",
")",
"f",
".",
"grid",
"(",
"row",
"=",
"0",
",",
"column",
"=",
"2",
",",
"padx",
"=",
"2",
",",
"pady",
"=",
... | https://github.com/jython/jython3/blob/def4f8ec47cb7a9c799ea4c745f12badf92c5769/lib-python/3.5.1/idlelib/SearchDialogBase.py#L173-L179 | ||
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/boto-2.46.1/boto/cloudsearch/domain.py | python | Domain.index_documents | (self) | Tells the search domain to start indexing its documents using
the latest text processing options and IndexFields. This
operation must be invoked to make options whose OptionStatus
has OptioState of RequiresIndexDocuments visible in search
results. | Tells the search domain to start indexing its documents using
the latest text processing options and IndexFields. This
operation must be invoked to make options whose OptionStatus
has OptioState of RequiresIndexDocuments visible in search
results. | [
"Tells",
"the",
"search",
"domain",
"to",
"start",
"indexing",
"its",
"documents",
"using",
"the",
"latest",
"text",
"processing",
"options",
"and",
"IndexFields",
".",
"This",
"operation",
"must",
"be",
"invoked",
"to",
"make",
"options",
"whose",
"OptionStatus... | def index_documents(self):
"""
Tells the search domain to start indexing its documents using
the latest text processing options and IndexFields. This
operation must be invoked to make options whose OptionStatus
has OptioState of RequiresIndexDocuments visible in search
re... | [
"def",
"index_documents",
"(",
"self",
")",
":",
"self",
".",
"layer1",
".",
"index_documents",
"(",
"self",
".",
"name",
")"
] | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/boto-2.46.1/boto/cloudsearch/domain.py#L224-L232 | ||
PaddlePaddle/Research | 2da0bd6c72d60e9df403aff23a7802779561c4a1 | NLP/EMNLP2019-MAL/src/beam_search.py | python | BeamSearch.grow_finished | (self, i, finished_seq, finished_scores, finished_flags, curr_seq,
curr_scores, curr_finished) | return self.compute_topk_scores_and_seq(curr_finished_seq, curr_finished_scores,
curr_finished_scores, curr_finished_flags,
pick_finish=True) | grow_finished | grow_finished | [
"grow_finished"
] | def grow_finished(self, i, finished_seq, finished_scores, finished_flags, curr_seq,
curr_scores, curr_finished):
"""
grow_finished
"""
finished_seq = layers.concat([finished_seq,
layers.fill_constant([self.batch_size, self.beam_... | [
"def",
"grow_finished",
"(",
"self",
",",
"i",
",",
"finished_seq",
",",
"finished_scores",
",",
"finished_flags",
",",
"curr_seq",
",",
"curr_scores",
",",
"curr_finished",
")",
":",
"finished_seq",
"=",
"layers",
".",
"concat",
"(",
"[",
"finished_seq",
",",... | https://github.com/PaddlePaddle/Research/blob/2da0bd6c72d60e9df403aff23a7802779561c4a1/NLP/EMNLP2019-MAL/src/beam_search.py#L142-L159 | |
python/cpython | e13cdca0f5224ec4e23bdd04bb3120506964bc8b | Lib/pdb.py | python | Pdb.lookupmodule | (self, filename) | return None | Helper function for break/clear parsing -- may be overridden.
lookupmodule() translates (possibly incomplete) file or module name
into an absolute file name. | Helper function for break/clear parsing -- may be overridden. | [
"Helper",
"function",
"for",
"break",
"/",
"clear",
"parsing",
"--",
"may",
"be",
"overridden",
"."
] | def lookupmodule(self, filename):
"""Helper function for break/clear parsing -- may be overridden.
lookupmodule() translates (possibly incomplete) file or module name
into an absolute file name.
"""
if os.path.isabs(filename) and os.path.exists(filename):
return fil... | [
"def",
"lookupmodule",
"(",
"self",
",",
"filename",
")",
":",
"if",
"os",
".",
"path",
".",
"isabs",
"(",
"filename",
")",
"and",
"os",
".",
"path",
".",
"exists",
"(",
"filename",
")",
":",
"return",
"filename",
"f",
"=",
"os",
".",
"path",
".",
... | https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/pdb.py#L1601-L1623 | |
baidu/knowledge-driven-dialogue | ba85518a1ac2a57988188fc5f2b8fe42e1facf64 | generative_pt/network.py | python | main | () | main | main | [
"main"
] | def main():
"""
main
"""
config = model_config()
if config.check:
config.save_dir = "./tmp/"
config.use_gpu = torch.cuda.is_available() and config.gpu >= 0
device = config.gpu
torch.cuda.set_device(device)
# Data definition
corpus = KnowledgeCorpus(data_dir=config.data_di... | [
"def",
"main",
"(",
")",
":",
"config",
"=",
"model_config",
"(",
")",
"if",
"config",
".",
"check",
":",
"config",
".",
"save_dir",
"=",
"\"./tmp/\"",
"config",
".",
"use_gpu",
"=",
"torch",
".",
"cuda",
".",
"is_available",
"(",
")",
"and",
"config",... | https://github.com/baidu/knowledge-driven-dialogue/blob/ba85518a1ac2a57988188fc5f2b8fe42e1facf64/generative_pt/network.py#L104-L215 | ||
ShuaiW/teach-machine-to-trade | 19dfc2c6537e61ac6eb0102caeb5ed6d32454f99 | model.py | python | mlp | (n_obs, n_action, n_hidden_layer=1, n_neuron_per_layer=32,
activation='relu', loss='mse') | return model | A multi-layer perceptron | A multi-layer perceptron | [
"A",
"multi",
"-",
"layer",
"perceptron"
] | def mlp(n_obs, n_action, n_hidden_layer=1, n_neuron_per_layer=32,
activation='relu', loss='mse'):
""" A multi-layer perceptron """
model = Sequential()
model.add(Dense(n_neuron_per_layer, input_dim=n_obs, activation=activation))
for _ in range(n_hidden_layer):
model.add(Dense(n_neuron_per_layer, act... | [
"def",
"mlp",
"(",
"n_obs",
",",
"n_action",
",",
"n_hidden_layer",
"=",
"1",
",",
"n_neuron_per_layer",
"=",
"32",
",",
"activation",
"=",
"'relu'",
",",
"loss",
"=",
"'mse'",
")",
":",
"model",
"=",
"Sequential",
"(",
")",
"model",
".",
"add",
"(",
... | https://github.com/ShuaiW/teach-machine-to-trade/blob/19dfc2c6537e61ac6eb0102caeb5ed6d32454f99/model.py#L7-L17 | |
rembo10/headphones | b3199605be1ebc83a7a8feab6b1e99b64014187c | lib/html5lib/inputstream.py | python | EncodingBytes.__next__ | (self) | return self[p:p + 1] | [] | def __next__(self):
p = self._position = self._position + 1
if p >= len(self):
raise StopIteration
elif p < 0:
raise TypeError
return self[p:p + 1] | [
"def",
"__next__",
"(",
"self",
")",
":",
"p",
"=",
"self",
".",
"_position",
"=",
"self",
".",
"_position",
"+",
"1",
"if",
"p",
">=",
"len",
"(",
"self",
")",
":",
"raise",
"StopIteration",
"elif",
"p",
"<",
"0",
":",
"raise",
"TypeError",
"retur... | https://github.com/rembo10/headphones/blob/b3199605be1ebc83a7a8feab6b1e99b64014187c/lib/html5lib/inputstream.py#L582-L588 | |||
Georce/lepus | 5b01bae82b5dc1df00c9e058989e2eb9b89ff333 | lepus/pymongo-2.7/pymongo/mongo_replica_set_client.py | python | MongoReplicaSetClient.use_greenlets | (self) | return self.__use_greenlets | Whether calling :meth:`start_request` assigns greenlet-local,
rather than thread-local, sockets.
.. versionadded:: 2.4.2 | Whether calling :meth:`start_request` assigns greenlet-local,
rather than thread-local, sockets. | [
"Whether",
"calling",
":",
"meth",
":",
"start_request",
"assigns",
"greenlet",
"-",
"local",
"rather",
"than",
"thread",
"-",
"local",
"sockets",
"."
] | def use_greenlets(self):
"""Whether calling :meth:`start_request` assigns greenlet-local,
rather than thread-local, sockets.
.. versionadded:: 2.4.2
"""
return self.__use_greenlets | [
"def",
"use_greenlets",
"(",
"self",
")",
":",
"return",
"self",
".",
"__use_greenlets"
] | https://github.com/Georce/lepus/blob/5b01bae82b5dc1df00c9e058989e2eb9b89ff333/lepus/pymongo-2.7/pymongo/mongo_replica_set_client.py#L914-L920 | |
google/grr | 8ad8a4d2c5a93c92729206b7771af19d92d4f915 | grr/server/grr_response_server/flows/general/filesystem.py | python | ListDirectory.NotifyAboutEnd | (self) | Sends a notification that this flow is done. | Sends a notification that this flow is done. | [
"Sends",
"a",
"notification",
"that",
"this",
"flow",
"is",
"done",
"."
] | def NotifyAboutEnd(self):
"""Sends a notification that this flow is done."""
if not self.state.urn:
super().NotifyAboutEnd()
return
st = self.state.stat
ps_path_type = st.pathspec.last.pathtype
path_type = rdf_objects.PathInfo.PathTypeFromPathspecPathType(ps_path_type)
full_path =... | [
"def",
"NotifyAboutEnd",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"state",
".",
"urn",
":",
"super",
"(",
")",
".",
"NotifyAboutEnd",
"(",
")",
"return",
"st",
"=",
"self",
".",
"state",
".",
"stat",
"ps_path_type",
"=",
"st",
".",
"pathspec"... | https://github.com/google/grr/blob/8ad8a4d2c5a93c92729206b7771af19d92d4f915/grr/server/grr_response_server/flows/general/filesystem.py#L161-L186 | ||
LabPy/lantz | 3e878e3f765a4295b0089d04e241d4beb7b8a65b | lantz/drivers/legacy/andor/ccd.py | python | CCD.n_horiz_shift_speeds | (self, channel=0, typ=None) | return n.value | As your Andor SDK system is capable of operating at more than one
horizontal shift speed this function will return the actual number of
speeds available.
Parameters
int channel: the AD channel.
int typ: output amplification.
Valid values: 0 electron multip... | As your Andor SDK system is capable of operating at more than one
horizontal shift speed this function will return the actual number of
speeds available.
Parameters
int channel: the AD channel.
int typ: output amplification.
Valid values: 0 electron multip... | [
"As",
"your",
"Andor",
"SDK",
"system",
"is",
"capable",
"of",
"operating",
"at",
"more",
"than",
"one",
"horizontal",
"shift",
"speed",
"this",
"function",
"will",
"return",
"the",
"actual",
"number",
"of",
"speeds",
"available",
".",
"Parameters",
"int",
"... | def n_horiz_shift_speeds(self, channel=0, typ=None):
""" As your Andor SDK system is capable of operating at more than one
horizontal shift speed this function will return the actual number of
speeds available.
Parameters
int channel: the AD channel.
int typ: outp... | [
"def",
"n_horiz_shift_speeds",
"(",
"self",
",",
"channel",
"=",
"0",
",",
"typ",
"=",
"None",
")",
":",
"if",
"typ",
"is",
"None",
":",
"typ",
"=",
"self",
".",
"amp_typ",
"n",
"=",
"ct",
".",
"c_int",
"(",
")",
"self",
".",
"lib",
".",
"GetNumb... | https://github.com/LabPy/lantz/blob/3e878e3f765a4295b0089d04e241d4beb7b8a65b/lantz/drivers/legacy/andor/ccd.py#L1465-L1484 | |
mnot/nbhttp | 80389f168f3bb3f0dbc7f6aee648e3286eed0a7a | src/server.py | python | test_handler | (method, uri, hdrs, res_start, req_pause) | return dummy, dummy | An extremely simple (and limited) server request_handler. | An extremely simple (and limited) server request_handler. | [
"An",
"extremely",
"simple",
"(",
"and",
"limited",
")",
"server",
"request_handler",
"."
] | def test_handler(method, uri, hdrs, res_start, req_pause):
"""
An extremely simple (and limited) server request_handler.
"""
code = "200"
phrase = "OK"
res_hdrs = [('Content-Type', 'text/plain')]
res_body, res_done = res_start(code, phrase, res_hdrs, dummy)
res_body('foo!')
res_done(... | [
"def",
"test_handler",
"(",
"method",
",",
"uri",
",",
"hdrs",
",",
"res_start",
",",
"req_pause",
")",
":",
"code",
"=",
"\"200\"",
"phrase",
"=",
"\"OK\"",
"res_hdrs",
"=",
"[",
"(",
"'Content-Type'",
",",
"'text/plain'",
")",
"]",
"res_body",
",",
"re... | https://github.com/mnot/nbhttp/blob/80389f168f3bb3f0dbc7f6aee648e3286eed0a7a/src/server.py#L283-L293 | |
snarfed/granary | ab085de2aef0cff8ac31a99b5e21443a249e8419 | granary/facebook.py | python | Facebook._find_all_text | (soup, regexp) | return soup.find_all(lambda tag: any(regexp.match(c.string.strip())
for c in tag.contents if c.string)) | BeautifulSoup utility that searches for text and returns a Tag.
I'd rather just use soup.find(string=...), but it returns a NavigableString
instead of a Tag, and I need a Tag so I can look at the elements inside it.
https://www.crummy.com/software/BeautifulSoup/bs4/doc/#the-string-argument
Args:
... | BeautifulSoup utility that searches for text and returns a Tag. | [
"BeautifulSoup",
"utility",
"that",
"searches",
"for",
"text",
"and",
"returns",
"a",
"Tag",
"."
] | def _find_all_text(soup, regexp):
"""BeautifulSoup utility that searches for text and returns a Tag.
I'd rather just use soup.find(string=...), but it returns a NavigableString
instead of a Tag, and I need a Tag so I can look at the elements inside it.
https://www.crummy.com/software/BeautifulSoup/bs4/... | [
"def",
"_find_all_text",
"(",
"soup",
",",
"regexp",
")",
":",
"regexp",
"=",
"re",
".",
"compile",
"(",
"regexp",
")",
"return",
"soup",
".",
"find_all",
"(",
"lambda",
"tag",
":",
"any",
"(",
"regexp",
".",
"match",
"(",
"c",
".",
"string",
".",
... | https://github.com/snarfed/granary/blob/ab085de2aef0cff8ac31a99b5e21443a249e8419/granary/facebook.py#L1697-L1710 | |
snowflakedb/snowflake-connector-python | 1659ec6b78930d1f947b4eff985c891af614d86c | src/snowflake/connector/auth_webbrowser.py | python | AuthByWebBrowser._process_options | (self, data, socket_client) | return True | Allows JS Ajax access to this endpoint. | Allows JS Ajax access to this endpoint. | [
"Allows",
"JS",
"Ajax",
"access",
"to",
"this",
"endpoint",
"."
] | def _process_options(self, data, socket_client):
"""Allows JS Ajax access to this endpoint."""
for line in data:
if line.startswith("OPTIONS "):
break
else:
return False
self._get_user_agent(data)
requested_headers, requested_origin = self... | [
"def",
"_process_options",
"(",
"self",
",",
"data",
",",
"socket_client",
")",
":",
"for",
"line",
"in",
"data",
":",
"if",
"line",
".",
"startswith",
"(",
"\"OPTIONS \"",
")",
":",
"break",
"else",
":",
"return",
"False",
"self",
".",
"_get_user_agent",
... | https://github.com/snowflakedb/snowflake-connector-python/blob/1659ec6b78930d1f947b4eff985c891af614d86c/src/snowflake/connector/auth_webbrowser.py#L167-L198 | |
pyinvoke/invoke | 45dc9d03639dac5b6d1445831bf270e686ef88b4 | invoke/watchers.py | python | Responder.pattern_matches | (self, stream, pattern, index_attr) | return matches | Generic "search for pattern in stream, using index" behavior.
Used here and in some subclasses that want to track multiple patterns
concurrently.
:param unicode stream: The same data passed to ``submit``.
:param unicode pattern: The pattern to search for.
:param unicode index_a... | Generic "search for pattern in stream, using index" behavior. | [
"Generic",
"search",
"for",
"pattern",
"in",
"stream",
"using",
"index",
"behavior",
"."
] | def pattern_matches(self, stream, pattern, index_attr):
"""
Generic "search for pattern in stream, using index" behavior.
Used here and in some subclasses that want to track multiple patterns
concurrently.
:param unicode stream: The same data passed to ``submit``.
:para... | [
"def",
"pattern_matches",
"(",
"self",
",",
"stream",
",",
"pattern",
",",
"index_attr",
")",
":",
"# NOTE: generifies scanning so it can be used to scan for >1 pattern at",
"# once, e.g. in FailingResponder.",
"# Only look at stream contents we haven't seen yet, to avoid dupes.",
"ind... | https://github.com/pyinvoke/invoke/blob/45dc9d03639dac5b6d1445831bf270e686ef88b4/invoke/watchers.py#L78-L102 | |
apache/libcloud | 90971e17bfd7b6bb97b2489986472c531cc8e140 | libcloud/compute/drivers/vultr.py | python | VultrNodeDriverV2.list_volumes | (self) | return [self._to_volume(item) for item in data] | List storage volumes.
:rtype: ``list`` of :class:`StorageVolume` | List storage volumes. | [
"List",
"storage",
"volumes",
"."
] | def list_volumes(self) -> List[StorageVolume]:
"""List storage volumes.
:rtype: ``list`` of :class:`StorageVolume`
"""
data = self._paginated_request("/v2/blocks", "blocks")
return [self._to_volume(item) for item in data] | [
"def",
"list_volumes",
"(",
"self",
")",
"->",
"List",
"[",
"StorageVolume",
"]",
":",
"data",
"=",
"self",
".",
"_paginated_request",
"(",
"\"/v2/blocks\"",
",",
"\"blocks\"",
")",
"return",
"[",
"self",
".",
"_to_volume",
"(",
"item",
")",
"for",
"item",... | https://github.com/apache/libcloud/blob/90971e17bfd7b6bb97b2489986472c531cc8e140/libcloud/compute/drivers/vultr.py#L1400-L1406 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift_tools/monitoring/metric_sender.py | python | MetricSender.add_dynamic_metric | (self, discovery_key, macro_string, macro_array, host=None, synthetic=False) | apply add_dynamic_metric for each sender | apply add_dynamic_metric for each sender | [
"apply",
"add_dynamic_metric",
"for",
"each",
"sender"
] | def add_dynamic_metric(self, discovery_key, macro_string, macro_array, host=None, synthetic=False):
''' apply add_dynamic_metric for each sender'''
for sender in self.active_senders:
sender.add_dynamic_metric(discovery_key, macro_string, macro_array, host, synthetic) | [
"def",
"add_dynamic_metric",
"(",
"self",
",",
"discovery_key",
",",
"macro_string",
",",
"macro_array",
",",
"host",
"=",
"None",
",",
"synthetic",
"=",
"False",
")",
":",
"for",
"sender",
"in",
"self",
".",
"active_senders",
":",
"sender",
".",
"add_dynami... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift_tools/monitoring/metric_sender.py#L75-L78 | ||
mesalock-linux/mesapy | ed546d59a21b36feb93e2309d5c6b75aa0ad95c9 | lib-python/2.7/decimal.py | python | Decimal.__float__ | (self) | return float(s) | Float representation. | Float representation. | [
"Float",
"representation",
"."
] | def __float__(self):
"""Float representation."""
if self._isnan():
if self.is_snan():
raise ValueError("Cannot convert signaling NaN to float")
s = "-nan" if self._sign else "nan"
else:
s = str(self)
return float(s) | [
"def",
"__float__",
"(",
"self",
")",
":",
"if",
"self",
".",
"_isnan",
"(",
")",
":",
"if",
"self",
".",
"is_snan",
"(",
")",
":",
"raise",
"ValueError",
"(",
"\"Cannot convert signaling NaN to float\"",
")",
"s",
"=",
"\"-nan\"",
"if",
"self",
".",
"_s... | https://github.com/mesalock-linux/mesapy/blob/ed546d59a21b36feb93e2309d5c6b75aa0ad95c9/lib-python/2.7/decimal.py#L1580-L1588 | |
buke/GreenOdoo | 3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df | source/addons/resource/resource.py | python | resource_calendar._interval_hours_get | (self, cr, uid, id, dt_from, dt_to, resource_id=False, timezone_from_uid=None, exclude_leaves=True, context=None) | return self.get_working_hours(
cr, uid, id, dt_from, dt_to,
compute_leaves=(not exclude_leaves), resource_id=resource_id,
default_interval=(8, 16), context=context) | Computes working hours between two dates, taking always same hour/minuts.
:deprecated: OpenERP saas-3. Use get_working_hours instead. Note: since saas-3,
now resets hour/minuts. Now counts leave hours instead of all-day leaves. | Computes working hours between two dates, taking always same hour/minuts. | [
"Computes",
"working",
"hours",
"between",
"two",
"dates",
"taking",
"always",
"same",
"hour",
"/",
"minuts",
"."
] | def _interval_hours_get(self, cr, uid, id, dt_from, dt_to, resource_id=False, timezone_from_uid=None, exclude_leaves=True, context=None):
""" Computes working hours between two dates, taking always same hour/minuts.
:deprecated: OpenERP saas-3. Use get_working_hours instead. Note: since saas-3,
... | [
"def",
"_interval_hours_get",
"(",
"self",
",",
"cr",
",",
"uid",
",",
"id",
",",
"dt_from",
",",
"dt_to",
",",
"resource_id",
"=",
"False",
",",
"timezone_from_uid",
"=",
"None",
",",
"exclude_leaves",
"=",
"True",
",",
"context",
"=",
"None",
")",
":",... | https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/source/addons/resource/resource.py#L627-L635 | |
mozillazg/pypy | 2ff5cd960c075c991389f842c6d59e71cf0cb7d0 | rpython/translator/driver.py | python | TranslationDriver.create_exe | (self) | Copy the compiled executable into current directory, which is
pypy/goal on nightly builds | Copy the compiled executable into current directory, which is
pypy/goal on nightly builds | [
"Copy",
"the",
"compiled",
"executable",
"into",
"current",
"directory",
"which",
"is",
"pypy",
"/",
"goal",
"on",
"nightly",
"builds"
] | def create_exe(self):
""" Copy the compiled executable into current directory, which is
pypy/goal on nightly builds
"""
if self.exe_name is not None:
exename = self.c_entryp
newexename = py.path.local(exename.basename)
shutil_copy(str(exename), str... | [
"def",
"create_exe",
"(",
"self",
")",
":",
"if",
"self",
".",
"exe_name",
"is",
"not",
"None",
":",
"exename",
"=",
"self",
".",
"c_entryp",
"newexename",
"=",
"py",
".",
"path",
".",
"local",
"(",
"exename",
".",
"basename",
")",
"shutil_copy",
"(",
... | https://github.com/mozillazg/pypy/blob/2ff5cd960c075c991389f842c6d59e71cf0cb7d0/rpython/translator/driver.py#L476-L522 | ||
microsoft/debugpy | be8dd607f6837244e0b565345e497aff7a0c08bf | src/debugpy/_vendored/pydevd/third_party/pep8/autopep8.py | python | shorten_comment | (line, max_line_length, last_comment=False) | Return trimmed or split long comment line.
If there are no comments immediately following it, do a text wrap.
Doing this wrapping on all comments in general would lead to jagged
comment text. | Return trimmed or split long comment line. | [
"Return",
"trimmed",
"or",
"split",
"long",
"comment",
"line",
"."
] | def shorten_comment(line, max_line_length, last_comment=False):
"""Return trimmed or split long comment line.
If there are no comments immediately following it, do a text wrap.
Doing this wrapping on all comments in general would lead to jagged
comment text.
"""
assert len(line) > max_line_len... | [
"def",
"shorten_comment",
"(",
"line",
",",
"max_line_length",
",",
"last_comment",
"=",
"False",
")",
":",
"assert",
"len",
"(",
"line",
")",
">",
"max_line_length",
"line",
"=",
"line",
".",
"rstrip",
"(",
")",
"# PEP 8 recommends 72 characters for comment text.... | https://github.com/microsoft/debugpy/blob/be8dd607f6837244e0b565345e497aff7a0c08bf/src/debugpy/_vendored/pydevd/third_party/pep8/autopep8.py#L2927-L2959 | ||
mtivadar/qiew | 87a3b96b43f1745a6b3f1fcfebce5164d2a40a14 | plugins/format/binary.py | python | Binary.getBanners | (self) | return [Banners.FileAddrBanner(self.dataModel, self._viewMode), Banners.TopBanner(self.dataModel, self._viewMode), Banners.BottomBanner(self.dataModel, self._viewMode)] | [] | def getBanners(self):
return [Banners.FileAddrBanner(self.dataModel, self._viewMode), Banners.TopBanner(self.dataModel, self._viewMode), Banners.BottomBanner(self.dataModel, self._viewMode)] | [
"def",
"getBanners",
"(",
"self",
")",
":",
"return",
"[",
"Banners",
".",
"FileAddrBanner",
"(",
"self",
".",
"dataModel",
",",
"self",
".",
"_viewMode",
")",
",",
"Banners",
".",
"TopBanner",
"(",
"self",
".",
"dataModel",
",",
"self",
".",
"_viewMode"... | https://github.com/mtivadar/qiew/blob/87a3b96b43f1745a6b3f1fcfebce5164d2a40a14/plugins/format/binary.py#L48-L49 | |||
opendevops-cn/opendevops | 538dc9b93bd7c08f36a2d6a7eb8df848f7d7f3d0 | scripts/tornado_source_code/tornado/autoreload.py | python | add_reload_hook | (fn: Callable[[], None]) | Add a function to be called before reloading the process.
Note that for open file and socket handles it is generally
preferable to set the ``FD_CLOEXEC`` flag (using `fcntl` or
``tornado.platform.auto.set_close_exec``) instead
of using a reload hook to close them. | Add a function to be called before reloading the process. | [
"Add",
"a",
"function",
"to",
"be",
"called",
"before",
"reloading",
"the",
"process",
"."
] | def add_reload_hook(fn: Callable[[], None]) -> None:
"""Add a function to be called before reloading the process.
Note that for open file and socket handles it is generally
preferable to set the ``FD_CLOEXEC`` flag (using `fcntl` or
``tornado.platform.auto.set_close_exec``) instead
of using a reloa... | [
"def",
"add_reload_hook",
"(",
"fn",
":",
"Callable",
"[",
"[",
"]",
",",
"None",
"]",
")",
"->",
"None",
":",
"_reload_hooks",
".",
"append",
"(",
"fn",
")"
] | https://github.com/opendevops-cn/opendevops/blob/538dc9b93bd7c08f36a2d6a7eb8df848f7d7f3d0/scripts/tornado_source_code/tornado/autoreload.py#L156-L164 | ||
bcbio/bcbio-nextgen | c80f9b6b1be3267d1f981b7035e3b72441d258f2 | bcbio/cwl/workflow.py | python | _merge_wf_inputs | (new, out, wf_outputs, to_ignore, parallel, nested_inputs) | return out, remapped_new | Merge inputs for a sub-workflow, adding any not present inputs in out.
Skips inputs that are internally generated or generated and ignored, keeping
only as inputs those that we do not generate internally. | Merge inputs for a sub-workflow, adding any not present inputs in out. | [
"Merge",
"inputs",
"for",
"a",
"sub",
"-",
"workflow",
"adding",
"any",
"not",
"present",
"inputs",
"in",
"out",
"."
] | def _merge_wf_inputs(new, out, wf_outputs, to_ignore, parallel, nested_inputs):
"""Merge inputs for a sub-workflow, adding any not present inputs in out.
Skips inputs that are internally generated or generated and ignored, keeping
only as inputs those that we do not generate internally.
"""
interna... | [
"def",
"_merge_wf_inputs",
"(",
"new",
",",
"out",
",",
"wf_outputs",
",",
"to_ignore",
",",
"parallel",
",",
"nested_inputs",
")",
":",
"internal_generated_ids",
"=",
"[",
"]",
"for",
"vignore",
"in",
"to_ignore",
":",
"vignore_id",
"=",
"_get_string_vid",
"(... | https://github.com/bcbio/bcbio-nextgen/blob/c80f9b6b1be3267d1f981b7035e3b72441d258f2/bcbio/cwl/workflow.py#L72-L100 | |
keon/algorithms | 23d4e85a506eaeaff315e855be12f8dbe47a7ec3 | algorithms/tree/segment_tree/iterative_segment_tree.py | python | SegmentTree.build_tree | (self) | [] | def build_tree(self):
for i in range(self.size - 1, 0, -1):
self.tree[i] = self.fn(self.tree[i * 2], self.tree[i * 2 + 1]) | [
"def",
"build_tree",
"(",
"self",
")",
":",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"size",
"-",
"1",
",",
"0",
",",
"-",
"1",
")",
":",
"self",
".",
"tree",
"[",
"i",
"]",
"=",
"self",
".",
"fn",
"(",
"self",
".",
"tree",
"[",
"i",
... | https://github.com/keon/algorithms/blob/23d4e85a506eaeaff315e855be12f8dbe47a7ec3/algorithms/tree/segment_tree/iterative_segment_tree.py#L33-L35 | ||||
pantsbuild/pex | 473c6ac732ed4bc338b4b20a9ec930d1d722c9b4 | pex/vendor/_vendored/pip/pip/_vendor/pep517/wrappers.py | python | HookMissing.__init__ | (self, hook_name) | [] | def __init__(self, hook_name):
super(HookMissing, self).__init__(hook_name)
self.hook_name = hook_name | [
"def",
"__init__",
"(",
"self",
",",
"hook_name",
")",
":",
"super",
"(",
"HookMissing",
",",
"self",
")",
".",
"__init__",
"(",
"hook_name",
")",
"self",
".",
"hook_name",
"=",
"hook_name"
] | https://github.com/pantsbuild/pex/blob/473c6ac732ed4bc338b4b20a9ec930d1d722c9b4/pex/vendor/_vendored/pip/pip/_vendor/pep517/wrappers.py#L58-L60 | ||||
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/figure_factory/utils.py | python | annotation_dict_for_label | (
text,
lane,
num_of_lanes,
subplot_spacing,
row_col="col",
flipped=True,
right_side=True,
text_color="#0f0f0f",
) | return annotation_dict | Returns annotation dict for label of n labels of a 1xn or nx1 subplot.
:param (str) text: the text for a label.
:param (int) lane: the label number for text. From 1 to n inclusive.
:param (int) num_of_lanes: the number 'n' of rows or columns in subplot.
:param (float) subplot_spacing: the value for the... | Returns annotation dict for label of n labels of a 1xn or nx1 subplot. | [
"Returns",
"annotation",
"dict",
"for",
"label",
"of",
"n",
"labels",
"of",
"a",
"1xn",
"or",
"nx1",
"subplot",
"."
] | def annotation_dict_for_label(
text,
lane,
num_of_lanes,
subplot_spacing,
row_col="col",
flipped=True,
right_side=True,
text_color="#0f0f0f",
):
"""
Returns annotation dict for label of n labels of a 1xn or nx1 subplot.
:param (str) text: the text for a label.
:param (in... | [
"def",
"annotation_dict_for_label",
"(",
"text",
",",
"lane",
",",
"num_of_lanes",
",",
"subplot_spacing",
",",
"row_col",
"=",
"\"col\"",
",",
"flipped",
"=",
"True",
",",
"right_side",
"=",
"True",
",",
"text_color",
"=",
"\"#0f0f0f\"",
",",
")",
":",
"l",... | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/figure_factory/utils.py#L192-L260 | |
JetBrains/python-skeletons | 95ad24b666e475998e5d1cc02ed53a2188036167 | numpy/core/__init__.py | python | uintc.__divmod__ | (self, *args, **kwargs) | Return divmod(self, value). | Return divmod(self, value). | [
"Return",
"divmod",
"(",
"self",
"value",
")",
"."
] | def __divmod__(self, *args, **kwargs): # real signature unknown
""" Return divmod(self, value). """
pass | [
"def",
"__divmod__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# real signature unknown",
"pass"
] | https://github.com/JetBrains/python-skeletons/blob/95ad24b666e475998e5d1cc02ed53a2188036167/numpy/core/__init__.py#L4627-L4629 | ||
r9y9/deepvoice3_pytorch | a5c24624bad314db5a5dcb0ea320fc3623a94f15 | nikl_preprocess/prepare_metafile.py | python | pe | (cmd, shell=False) | return ret | Print and execute command on system | Print and execute command on system | [
"Print",
"and",
"execute",
"command",
"on",
"system"
] | def pe(cmd, shell=False):
"""
Print and execute command on system
"""
ret = []
for line in execute(cmd, shell=shell):
ret.append(line)
print(line, end="")
return ret | [
"def",
"pe",
"(",
"cmd",
",",
"shell",
"=",
"False",
")",
":",
"ret",
"=",
"[",
"]",
"for",
"line",
"in",
"execute",
"(",
"cmd",
",",
"shell",
"=",
"shell",
")",
":",
"ret",
".",
"append",
"(",
"line",
")",
"print",
"(",
"line",
",",
"end",
"... | https://github.com/r9y9/deepvoice3_pytorch/blob/a5c24624bad314db5a5dcb0ea320fc3623a94f15/nikl_preprocess/prepare_metafile.py#L20-L28 | |
ckan/ckan | b3b01218ad88ed3fb914b51018abe8b07b07bff3 | ckan/logic/action/get.py | python | organization_list_for_user | (context, data_dict) | return orgs_list | Return the organizations that the user has a given permission for.
Specifically it returns the list of organizations that the currently
authorized user has a given permission (for example: "manage_group")
against.
By default this returns the list of organizations that the currently
authorized user... | Return the organizations that the user has a given permission for. | [
"Return",
"the",
"organizations",
"that",
"the",
"user",
"has",
"a",
"given",
"permission",
"for",
"."
] | def organization_list_for_user(context, data_dict):
'''Return the organizations that the user has a given permission for.
Specifically it returns the list of organizations that the currently
authorized user has a given permission (for example: "manage_group")
against.
By default this returns the l... | [
"def",
"organization_list_for_user",
"(",
"context",
",",
"data_dict",
")",
":",
"model",
"=",
"context",
"[",
"'model'",
"]",
"if",
"data_dict",
".",
"get",
"(",
"'id'",
")",
":",
"user_obj",
"=",
"model",
".",
"User",
".",
"get",
"(",
"data_dict",
"[",... | https://github.com/ckan/ckan/blob/b3b01218ad88ed3fb914b51018abe8b07b07bff3/ckan/logic/action/get.py#L609-L717 | |
marshmallow-code/marshmallow | 58c2045b8f272c2f1842458aa79f5c079a01429f | src/marshmallow/schema.py | python | Schema._do_load | (
self,
data: (
typing.Mapping[str, typing.Any]
| typing.Iterable[typing.Mapping[str, typing.Any]]
),
*,
many: bool | None = None,
partial: bool | types.StrSequenceOrSet | None = None,
unknown: str | None = None,
postprocess: bool =... | return result | Deserialize `data`, returning the deserialized result.
This method is private API.
:param data: The data to deserialize.
:param many: Whether to deserialize `data` as a collection. If `None`, the
value for `self.many` is used.
:param partial: Whether to validate required fie... | Deserialize `data`, returning the deserialized result.
This method is private API. | [
"Deserialize",
"data",
"returning",
"the",
"deserialized",
"result",
".",
"This",
"method",
"is",
"private",
"API",
"."
] | def _do_load(
self,
data: (
typing.Mapping[str, typing.Any]
| typing.Iterable[typing.Mapping[str, typing.Any]]
),
*,
many: bool | None = None,
partial: bool | types.StrSequenceOrSet | None = None,
unknown: str | None = None,
postpro... | [
"def",
"_do_load",
"(",
"self",
",",
"data",
":",
"(",
"typing",
".",
"Mapping",
"[",
"str",
",",
"typing",
".",
"Any",
"]",
"|",
"typing",
".",
"Iterable",
"[",
"typing",
".",
"Mapping",
"[",
"str",
",",
"typing",
".",
"Any",
"]",
"]",
")",
",",... | https://github.com/marshmallow-code/marshmallow/blob/58c2045b8f272c2f1842458aa79f5c079a01429f/src/marshmallow/schema.py#L805-L902 | |
linux-system-roles/network | 20667b086068516dff248760e00f844b333eb727 | module_utils/network_lsr/nm_provider.py | python | get_nm_ethtool_feature | (name) | return feature | Translate ethtool feature into Network Manager name
:param name: Name of the feature
:type name: str
:returns: Name of the feature to be used by `NM.SettingEthtool.set_feature()`
:rtype: str | Translate ethtool feature into Network Manager name | [
"Translate",
"ethtool",
"feature",
"into",
"Network",
"Manager",
"name"
] | def get_nm_ethtool_feature(name):
"""
Translate ethtool feature into Network Manager name
:param name: Name of the feature
:type name: str
:returns: Name of the feature to be used by `NM.SettingEthtool.set_feature()`
:rtype: str
"""
name = ETHTOOL_FEATURE_PREFIX + name.upper()
fea... | [
"def",
"get_nm_ethtool_feature",
"(",
"name",
")",
":",
"name",
"=",
"ETHTOOL_FEATURE_PREFIX",
"+",
"name",
".",
"upper",
"(",
")",
"feature",
"=",
"getattr",
"(",
"Util",
".",
"NM",
"(",
")",
",",
"name",
",",
"None",
")",
"return",
"feature"
] | https://github.com/linux-system-roles/network/blob/20667b086068516dff248760e00f844b333eb727/module_utils/network_lsr/nm_provider.py#L16-L29 | |
cbrgm/telegram-robot-rss | 58fe98de427121fdc152c8df0721f1891174e6c9 | venv/lib/python2.7/site-packages/pkg_resources/_vendor/pyparsing.py | python | ParserElement.runTests | (self, tests, parseAll=True, comment='#', fullDump=True, printResults=True, failureTests=False) | return success, allResults | Execute the parse expression on a series of test strings, showing each
test, the parsed results or where the parse failed. Quick and easy way to
run a parse expression against a list of sample strings.
Parameters:
- tests - a list of separate test strings, or a multiline str... | Execute the parse expression on a series of test strings, showing each
test, the parsed results or where the parse failed. Quick and easy way to
run a parse expression against a list of sample strings.
Parameters:
- tests - a list of separate test strings, or a multiline str... | [
"Execute",
"the",
"parse",
"expression",
"on",
"a",
"series",
"of",
"test",
"strings",
"showing",
"each",
"test",
"the",
"parsed",
"results",
"or",
"where",
"the",
"parse",
"failed",
".",
"Quick",
"and",
"easy",
"way",
"to",
"run",
"a",
"parse",
"expressio... | def runTests(self, tests, parseAll=True, comment='#', fullDump=True, printResults=True, failureTests=False):
"""
Execute the parse expression on a series of test strings, showing each
test, the parsed results or where the parse failed. Quick and easy way to
run a parse expression against... | [
"def",
"runTests",
"(",
"self",
",",
"tests",
",",
"parseAll",
"=",
"True",
",",
"comment",
"=",
"'#'",
",",
"fullDump",
"=",
"True",
",",
"printResults",
"=",
"True",
",",
"failureTests",
"=",
"False",
")",
":",
"if",
"isinstance",
"(",
"tests",
",",
... | https://github.com/cbrgm/telegram-robot-rss/blob/58fe98de427121fdc152c8df0721f1891174e6c9/venv/lib/python2.7/site-packages/pkg_resources/_vendor/pyparsing.py#L2191-L2320 | |
pikpikcu/Pentest-Tools-Framework | cd6e6107764a809943dc4e073cde8149c1a2cd03 | modules/xsser/build/lib/core/main.py | python | xsser.generate_real_attack_url | (self, dest_url, description, method, hashing, query_string, payload, orig_url) | return dest_url | Generate a real attack url by using data from a successfull test.
This method also applies DOM stealth mechanisms. | Generate a real attack url by using data from a successfull test. | [
"Generate",
"a",
"real",
"attack",
"url",
"by",
"using",
"data",
"from",
"a",
"successfull",
"test",
"."
] | def generate_real_attack_url(self, dest_url, description, method, hashing, query_string, payload, orig_url):
"""
Generate a real attack url by using data from a successfull test.
This method also applies DOM stealth mechanisms.
"""
user_attack_payload = payload['payload']
if se... | [
"def",
"generate_real_attack_url",
"(",
"self",
",",
"dest_url",
",",
"description",
",",
"method",
",",
"hashing",
",",
"query_string",
",",
"payload",
",",
"orig_url",
")",
":",
"user_attack_payload",
"=",
"payload",
"[",
"'payload'",
"]",
"if",
"self",
".",... | https://github.com/pikpikcu/Pentest-Tools-Framework/blob/cd6e6107764a809943dc4e073cde8149c1a2cd03/modules/xsser/build/lib/core/main.py#L2156-L2202 | |
mozilla/zamboni | 14b1a44658e47b9f048962fa52dbf00a3beaaf30 | mkt/site/views.py | python | cspreport | (request) | return HttpResponse() | Accept CSP reports and log them. | Accept CSP reports and log them. | [
"Accept",
"CSP",
"reports",
"and",
"log",
"them",
"."
] | def cspreport(request):
"""Accept CSP reports and log them."""
report = ('blocked-uri', 'violated-directive', 'original-policy')
if not waffle.sample_is_active('csp-store-reports'):
return HttpResponse()
try:
v = json.loads(request.body)['csp-report']
# If possible, alter the P... | [
"def",
"cspreport",
"(",
"request",
")",
":",
"report",
"=",
"(",
"'blocked-uri'",
",",
"'violated-directive'",
",",
"'original-policy'",
")",
"if",
"not",
"waffle",
".",
"sample_is_active",
"(",
"'csp-store-reports'",
")",
":",
"return",
"HttpResponse",
"(",
")... | https://github.com/mozilla/zamboni/blob/14b1a44658e47b9f048962fa52dbf00a3beaaf30/mkt/site/views.py#L229-L251 | |
Chaffelson/nipyapi | d3b186fd701ce308c2812746d98af9120955e810 | nipyapi/nifi/apis/flow_api.py | python | FlowApi.search_flow_with_http_info | (self, **kwargs) | return self.api_client.call_api('/flow/search-results', 'GET',
path_params,
query_params,
header_params,
body=body_params,
... | Performs a search against this NiFi using the specified search term
Only search results from authorized components will be returned.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when recei... | Performs a search against this NiFi using the specified search term
Only search results from authorized components will be returned.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when recei... | [
"Performs",
"a",
"search",
"against",
"this",
"NiFi",
"using",
"the",
"specified",
"search",
"term",
"Only",
"search",
"results",
"from",
"authorized",
"components",
"will",
"be",
"returned",
".",
"This",
"method",
"makes",
"a",
"synchronous",
"HTTP",
"request",... | def search_flow_with_http_info(self, **kwargs):
"""
Performs a search against this NiFi using the specified search term
Only search results from authorized components will be returned.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, ... | [
"def",
"search_flow_with_http_info",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"all_params",
"=",
"[",
"'q'",
",",
"'a'",
"]",
"all_params",
".",
"append",
"(",
"'callback'",
")",
"all_params",
".",
"append",
"(",
"'_return_http_data_only'",
")",
"all_... | https://github.com/Chaffelson/nipyapi/blob/d3b186fd701ce308c2812746d98af9120955e810/nipyapi/nifi/apis/flow_api.py#L4490-L4568 | |
mangye16/ReID-Survey | 2ce2cfe890d78f6904890c9063ed156532325b60 | video-reid-AWG/utils.py | python | save_gradient_images | (gradient, file_name) | Exports the original gradient image
Args:
gradient (np arr): Numpy array of the gradient with shape (3, 224, 224)
file_name (str): File name to be exported | Exports the original gradient image | [
"Exports",
"the",
"original",
"gradient",
"image"
] | def save_gradient_images(gradient, file_name):
"""
Exports the original gradient image
Args:
gradient (np arr): Numpy array of the gradient with shape (3, 224, 224)
file_name (str): File name to be exported
"""
if not os.path.exists('../results'):
os.makedirs('../results... | [
"def",
"save_gradient_images",
"(",
"gradient",
",",
"file_name",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"'../results'",
")",
":",
"os",
".",
"makedirs",
"(",
"'../results'",
")",
"# Normalize",
"gradient",
"=",
"gradient",
"-",
"gra... | https://github.com/mangye16/ReID-Survey/blob/2ce2cfe890d78f6904890c9063ed156532325b60/video-reid-AWG/utils.py#L176-L191 | ||
hellohaptik/chatbot_ner | 742104790170ae5b73c583c94db6786549337dc4 | ner_v2/detectors/numeral/number_range/standard_number_range_detector.py | python | BaseNumberRangeDetector._detect_max_num_range_with_prefix_variants | (self, number_range_list=None, original_list=None) | return number_range_list, original_list | Method to detect number range containing only max value and keywords which identify value as min present
before them. Example - less than 2 {'less than' => keyword, '2' => max value},
At most seven hundred rupees {'At most' => keyword, 'seven hundred rupees'=>min value}
Ar... | Method to detect number range containing only max value and keywords which identify value as min present
before them. Example - less than 2 {'less than' => keyword, '2' => max value},
At most seven hundred rupees {'At most' => keyword, 'seven hundred rupees'=>min value}
Ar... | [
"Method",
"to",
"detect",
"number",
"range",
"containing",
"only",
"max",
"value",
"and",
"keywords",
"which",
"identify",
"value",
"as",
"min",
"present",
"before",
"them",
".",
"Example",
"-",
"less",
"than",
"2",
"{",
"less",
"than",
"=",
">",
"keyword"... | def _detect_max_num_range_with_prefix_variants(self, number_range_list=None, original_list=None):
"""
Method to detect number range containing only max value and keywords which identify value as min present
before them. Example - less than 2 {'less than' => keyword, '2' => max value},
... | [
"def",
"_detect_max_num_range_with_prefix_variants",
"(",
"self",
",",
"number_range_list",
"=",
"None",
",",
"original_list",
"=",
"None",
")",
":",
"number_range_list",
"=",
"number_range_list",
"or",
"[",
"]",
"original_list",
"=",
"original_list",
"or",
"[",
"]"... | https://github.com/hellohaptik/chatbot_ner/blob/742104790170ae5b73c583c94db6786549337dc4/ner_v2/detectors/numeral/number_range/standard_number_range_detector.py#L330-L358 | |
osmr/imgclsmob | f2993d3ce73a2f7ddba05da3891defb08547d504 | gluon/datasets/coco_hpe3_dataset.py | python | CocoHpe3MetaInfo.add_dataset_parser_arguments | (self,
parser,
work_dir_path) | Create python script parameters (for ImageNet-1K dataset metainfo).
Parameters:
----------
parser : ArgumentParser
ArgumentParser instance.
work_dir_path : str
Path to working directory. | Create python script parameters (for ImageNet-1K dataset metainfo). | [
"Create",
"python",
"script",
"parameters",
"(",
"for",
"ImageNet",
"-",
"1K",
"dataset",
"metainfo",
")",
"."
] | def add_dataset_parser_arguments(self,
parser,
work_dir_path):
"""
Create python script parameters (for ImageNet-1K dataset metainfo).
Parameters:
----------
parser : ArgumentParser
ArgumentPar... | [
"def",
"add_dataset_parser_arguments",
"(",
"self",
",",
"parser",
",",
"work_dir_path",
")",
":",
"super",
"(",
"CocoHpe3MetaInfo",
",",
"self",
")",
".",
"add_dataset_parser_arguments",
"(",
"parser",
",",
"work_dir_path",
")",
"parser",
".",
"add_argument",
"("... | https://github.com/osmr/imgclsmob/blob/f2993d3ce73a2f7ddba05da3891defb08547d504/gluon/datasets/coco_hpe3_dataset.py#L513-L536 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/wagtail/utils/setup.py | python | assets_mixin.compile_assets | (self) | [] | def compile_assets(self):
try:
subprocess.check_call(['npm', 'run', 'build'])
except (OSError, subprocess.CalledProcessError) as e:
print('Error compiling assets: ' + str(e)) # noqa
raise SystemExit(1) | [
"def",
"compile_assets",
"(",
"self",
")",
":",
"try",
":",
"subprocess",
".",
"check_call",
"(",
"[",
"'npm'",
",",
"'run'",
",",
"'build'",
"]",
")",
"except",
"(",
"OSError",
",",
"subprocess",
".",
"CalledProcessError",
")",
"as",
"e",
":",
"print",
... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/wagtail/utils/setup.py#L17-L22 | ||||
dboyd13/DSVR | 56fd0b30294a02dabc8af9178c3ed9980c229c94 | lib/IPy.py | python | _count1Bits | (num) | return ret | Find the highest bit set to 1 in an integer. | Find the highest bit set to 1 in an integer. | [
"Find",
"the",
"highest",
"bit",
"set",
"to",
"1",
"in",
"an",
"integer",
"."
] | def _count1Bits(num):
"""Find the highest bit set to 1 in an integer."""
ret = 0
while num > 0:
num = num >> 1
ret += 1
return ret | [
"def",
"_count1Bits",
"(",
"num",
")",
":",
"ret",
"=",
"0",
"while",
"num",
">",
"0",
":",
"num",
"=",
"num",
">>",
"1",
"ret",
"+=",
"1",
"return",
"ret"
] | https://github.com/dboyd13/DSVR/blob/56fd0b30294a02dabc8af9178c3ed9980c229c94/lib/IPy.py#L1264-L1270 | |
geduldig/TwitterAPI | 1cb89e8fc50b051707fb99d6c2bb235ada5faf1a | TwitterAPI/TwitterAPI.py | python | _hydrate_tweets | (data, includes, field_suffix) | return data | Insert expansion fields back into tweet data by appending
a new field as a sibling to the referenced field.
:param data: "data" property value in JSON response
:param includes: "includes" property value in JSON response
:param field_suffix: Suffix appended to a hydrated field name.
... | Insert expansion fields back into tweet data by appending
a new field as a sibling to the referenced field. | [
"Insert",
"expansion",
"fields",
"back",
"into",
"tweet",
"data",
"by",
"appending",
"a",
"new",
"field",
"as",
"a",
"sibling",
"to",
"the",
"referenced",
"field",
"."
] | def _hydrate_tweets(data, includes, field_suffix):
"""Insert expansion fields back into tweet data by appending
a new field as a sibling to the referenced field.
:param data: "data" property value in JSON response
:param includes: "includes" property value in JSON response
:param field_suffix: Suff... | [
"def",
"_hydrate_tweets",
"(",
"data",
",",
"includes",
",",
"field_suffix",
")",
":",
"new_fields",
"=",
"[",
"]",
"for",
"key",
"in",
"includes",
":",
"incl",
"=",
"includes",
"[",
"key",
"]",
"for",
"obj",
"in",
"incl",
":",
"for",
"field",
"in",
... | https://github.com/geduldig/TwitterAPI/blob/1cb89e8fc50b051707fb99d6c2bb235ada5faf1a/TwitterAPI/TwitterAPI.py#L438-L473 | |
ShreyAmbesh/Traffic-Rule-Violation-Detection-System | ae0c327ce014ce6a427da920b5798a0d4bbf001e | openalpr_api/models/plate_candidate.py | python | PlateCandidate.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/ShreyAmbesh/Traffic-Rule-Violation-Detection-System/blob/ae0c327ce014ce6a427da920b5798a0d4bbf001e/openalpr_api/models/plate_candidate.py#L129-L153 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/pytz/tzinfo.py | python | DstTzInfo.__reduce__ | (self) | return pytz._p, (
self.zone,
_to_seconds(self._utcoffset),
_to_seconds(self._dst),
self._tzname
) | [] | def __reduce__(self):
# Special pickle to zone remains a singleton and to cope with
# database changes.
return pytz._p, (
self.zone,
_to_seconds(self._utcoffset),
_to_seconds(self._dst),
self._tzname
) | [
"def",
"__reduce__",
"(",
"self",
")",
":",
"# Special pickle to zone remains a singleton and to cope with",
"# database changes.",
"return",
"pytz",
".",
"_p",
",",
"(",
"self",
".",
"zone",
",",
"_to_seconds",
"(",
"self",
".",
"_utcoffset",
")",
",",
"_to_seconds... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/pytz/tzinfo.py#L518-L526 | |||
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/gssapi-1.5.1/gssapi/creds.py | python | Credentials.store | (self, store=None, usage='both', mech=None,
overwrite=False, set_default=False) | Store these credentials into the given store
This method stores the current credentials into the specified
credentials store. If the default store is used, support for
:rfc:`5588` is required. Otherwise, support for the credentials
store extension is required.
:requires-ext:`... | Store these credentials into the given store | [
"Store",
"these",
"credentials",
"into",
"the",
"given",
"store"
] | def store(self, store=None, usage='both', mech=None,
overwrite=False, set_default=False):
"""Store these credentials into the given store
This method stores the current credentials into the specified
credentials store. If the default store is used, support for
:rfc:`5588`... | [
"def",
"store",
"(",
"self",
",",
"store",
"=",
"None",
",",
"usage",
"=",
"'both'",
",",
"mech",
"=",
"None",
",",
"overwrite",
"=",
"False",
",",
"set_default",
"=",
"False",
")",
":",
"if",
"store",
"is",
"None",
":",
"if",
"rcred_rfc5588",
"is",
... | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/gssapi-1.5.1/gssapi/creds.py#L153-L203 | ||
biopython/biopython | 2dd97e71762af7b046d7f7f8a4f1e38db6b06c86 | Bio/SearchIO/BlastIO/blast_xml.py | python | BlastXmlWriter._write_elem_block | (self, block_name, map_name, obj, opt_dict=None) | Write sibling XML elements (PRIVATE).
:param block_name: common element name prefix
:type block_name: string
:param map_name: name of mapping between element and attribute names
:type map_name: string
:param obj: object whose attribute value will be used
:type obj: objec... | Write sibling XML elements (PRIVATE). | [
"Write",
"sibling",
"XML",
"elements",
"(",
"PRIVATE",
")",
"."
] | def _write_elem_block(self, block_name, map_name, obj, opt_dict=None):
"""Write sibling XML elements (PRIVATE).
:param block_name: common element name prefix
:type block_name: string
:param map_name: name of mapping between element and attribute names
:type map_name: string
... | [
"def",
"_write_elem_block",
"(",
"self",
",",
"block_name",
",",
"map_name",
",",
"obj",
",",
"opt_dict",
"=",
"None",
")",
":",
"if",
"opt_dict",
"is",
"None",
":",
"opt_dict",
"=",
"{",
"}",
"for",
"elem",
",",
"attr",
"in",
"_WRITE_MAPS",
"[",
"map_... | https://github.com/biopython/biopython/blob/2dd97e71762af7b046d7f7f8a4f1e38db6b06c86/Bio/SearchIO/BlastIO/blast_xml.py#L784-L811 | ||
wikimedia/pywikibot | 81a01ffaec7271bf5b4b170f85a80388420a4e78 | pywikibot/page/__init__.py | python | BaseLink.__str__ | (self) | return self.astext() | Return a str string representation. | Return a str string representation. | [
"Return",
"a",
"str",
"string",
"representation",
"."
] | def __str__(self) -> str:
"""Return a str string representation."""
return self.astext() | [
"def",
"__str__",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"astext",
"(",
")"
] | https://github.com/wikimedia/pywikibot/blob/81a01ffaec7271bf5b4b170f85a80388420a4e78/pywikibot/page/__init__.py#L5210-L5212 | |
mitre-attack/attack-website | 446748b71f412f7125d596a5eae0869559c89f05 | modules/util/stixhelpers.py | python | get_stix_memory_stores | () | return ms, srcs | This function reads the json files for each domain and creates a dict
that contains the memory stores for each domain. | This function reads the json files for each domain and creates a dict
that contains the memory stores for each domain. | [
"This",
"function",
"reads",
"the",
"json",
"files",
"for",
"each",
"domain",
"and",
"creates",
"a",
"dict",
"that",
"contains",
"the",
"memory",
"stores",
"for",
"each",
"domain",
"."
] | def get_stix_memory_stores():
"""This function reads the json files for each domain and creates a dict
that contains the memory stores for each domain.
"""
# suppress InsecureRequestWarning: Unverified HTTPS request is being made
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning... | [
"def",
"get_stix_memory_stores",
"(",
")",
":",
"# suppress InsecureRequestWarning: Unverified HTTPS request is being made",
"urllib3",
".",
"disable_warnings",
"(",
"urllib3",
".",
"exceptions",
".",
"InsecureRequestWarning",
")",
"ms",
"=",
"{",
"}",
"srcs",
"=",
"[",
... | https://github.com/mitre-attack/attack-website/blob/446748b71f412f7125d596a5eae0869559c89f05/modules/util/stixhelpers.py#L374-L416 | |
Staffjoy/suite | 14ed49b21cf8296d2e0696a7f50f91f8e4b65072 | staffjoy/resource.py | python | Resource._delay_for_ratelimits | (cls, start) | If request was shorter than max request time, delay | If request was shorter than max request time, delay | [
"If",
"request",
"was",
"shorter",
"than",
"max",
"request",
"time",
"delay"
] | def _delay_for_ratelimits(cls, start):
"""If request was shorter than max request time, delay"""
stop = datetime.now()
duration_microseconds = (stop-start).microseconds
if duration_microseconds < cls.REQUEST_TIME_MICROSECONDS:
time.sleep((cls.REQUEST_TIME_MICROSECONDS - durat... | [
"def",
"_delay_for_ratelimits",
"(",
"cls",
",",
"start",
")",
":",
"stop",
"=",
"datetime",
".",
"now",
"(",
")",
"duration_microseconds",
"=",
"(",
"stop",
"-",
"start",
")",
".",
"microseconds",
"if",
"duration_microseconds",
"<",
"cls",
".",
"REQUEST_TIM... | https://github.com/Staffjoy/suite/blob/14ed49b21cf8296d2e0696a7f50f91f8e4b65072/staffjoy/resource.py#L202-L207 | ||
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/modules/netaddress.py | python | list_cidr_ips | (cidr) | return [str(ip) for ip in list(ips)] | Get a list of IP addresses from a CIDR.
CLI Example:
.. code-block:: bash
salt myminion netaddress.list_cidr_ips 192.168.0.0/20 | Get a list of IP addresses from a CIDR. | [
"Get",
"a",
"list",
"of",
"IP",
"addresses",
"from",
"a",
"CIDR",
"."
] | def list_cidr_ips(cidr):
"""
Get a list of IP addresses from a CIDR.
CLI Example:
.. code-block:: bash
salt myminion netaddress.list_cidr_ips 192.168.0.0/20
"""
ips = netaddr.IPNetwork(cidr)
return [str(ip) for ip in list(ips)] | [
"def",
"list_cidr_ips",
"(",
"cidr",
")",
":",
"ips",
"=",
"netaddr",
".",
"IPNetwork",
"(",
"cidr",
")",
"return",
"[",
"str",
"(",
"ip",
")",
"for",
"ip",
"in",
"list",
"(",
"ips",
")",
"]"
] | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/netaddress.py#L33-L44 | |
CreatCodeBuild/TensorFlow-and-DeepLearning-Tutorial | b418e9dc381a908b9cb7a3038825b6eb276b98cd | Season1/4-6/load.py | python | normalize | (samples) | return a/128.0 - 1.0 | 并且灰度化: 从三色通道 -> 单色通道 省内存 + 加快训练速度
(R + G + B) / 3
将图片从 0 ~ 255 线性映射到 -1.0 ~ +1.0
@samples: numpy array | 并且灰度化: 从三色通道 -> 单色通道 省内存 + 加快训练速度
(R + G + B) / 3
将图片从 0 ~ 255 线性映射到 -1.0 ~ +1.0 | [
"并且灰度化",
":",
"从三色通道",
"-",
">",
"单色通道",
"省内存",
"+",
"加快训练速度",
"(",
"R",
"+",
"G",
"+",
"B",
")",
"/",
"3",
"将图片从",
"0",
"~",
"255",
"线性映射到",
"-",
"1",
".",
"0",
"~",
"+",
"1",
".",
"0"
] | def normalize(samples):
'''
并且灰度化: 从三色通道 -> 单色通道 省内存 + 加快训练速度
(R + G + B) / 3
将图片从 0 ~ 255 线性映射到 -1.0 ~ +1.0
@samples: numpy array
'''
a = np.add.reduce(samples, keepdims=True, axis=3) # shape (图片数,图片高,图片宽,通道数)
a = a/3.0
return a/128.0 - 1.0 | [
"def",
"normalize",
"(",
"samples",
")",
":",
"a",
"=",
"np",
".",
"add",
".",
"reduce",
"(",
"samples",
",",
"keepdims",
"=",
"True",
",",
"axis",
"=",
"3",
")",
"# shape (图片数,图片高,图片宽,通道数)",
"a",
"=",
"a",
"/",
"3.0",
"return",
"a",
"/",
"128.0",
... | https://github.com/CreatCodeBuild/TensorFlow-and-DeepLearning-Tutorial/blob/b418e9dc381a908b9cb7a3038825b6eb276b98cd/Season1/4-6/load.py#L29-L38 | |
jazzband/django-celery-monitor | 2b86acddc4cf2e65b63c8c7b2db7ecaa037b4b75 | django_celery_monitor/managers.py | python | TaskStateQuerySet.purge | (self) | Purge all expired task states. | Purge all expired task states. | [
"Purge",
"all",
"expired",
"task",
"states",
"."
] | def purge(self):
"""Purge all expired task states."""
with transaction.atomic():
self.using(
router.db_for_write(self.model)
).filter(hidden=True).delete() | [
"def",
"purge",
"(",
"self",
")",
":",
"with",
"transaction",
".",
"atomic",
"(",
")",
":",
"self",
".",
"using",
"(",
"router",
".",
"db_for_write",
"(",
"self",
".",
"model",
")",
")",
".",
"filter",
"(",
"hidden",
"=",
"True",
")",
".",
"delete"... | https://github.com/jazzband/django-celery-monitor/blob/2b86acddc4cf2e65b63c8c7b2db7ecaa037b4b75/django_celery_monitor/managers.py#L86-L91 | ||
yogeshbalaji/Generate_To_Adapt | 622d4984662b71bcdb88c33c5ac67e6ec8bad0ad | models.py | python | _netF.forward | (self, input) | return output.view(-1, 2*self.ndf) | [] | def forward(self, input):
output = self.feature(input)
return output.view(-1, 2*self.ndf) | [
"def",
"forward",
"(",
"self",
",",
"input",
")",
":",
"output",
"=",
"self",
".",
"feature",
"(",
"input",
")",
"return",
"output",
".",
"view",
"(",
"-",
"1",
",",
"2",
"*",
"self",
".",
"ndf",
")"
] | https://github.com/yogeshbalaji/Generate_To_Adapt/blob/622d4984662b71bcdb88c33c5ac67e6ec8bad0ad/models.py#L113-L115 | |||
Dan-in-CA/SIP | 7d08d807d7730bff2b5eaaa57e743665c8b143a6 | web/utils.py | python | group | (seq, size) | return (seq[i : i + size] for i in range(0, len(seq), size)) | Returns an iterator over a series of lists of length size from iterable.
>>> list(group([1,2,3,4], 2))
[[1, 2], [3, 4]]
>>> list(group([1,2,3,4,5], 2))
[[1, 2], [3, 4], [5]] | Returns an iterator over a series of lists of length size from iterable. | [
"Returns",
"an",
"iterator",
"over",
"a",
"series",
"of",
"lists",
"of",
"length",
"size",
"from",
"iterable",
"."
] | def group(seq, size):
"""
Returns an iterator over a series of lists of length size from iterable.
>>> list(group([1,2,3,4], 2))
[[1, 2], [3, 4]]
>>> list(group([1,2,3,4,5], 2))
[[1, 2], [3, 4], [5]]
"""
return (seq[i : i + size] for i in range(0, len(seq), size)) | [
"def",
"group",
"(",
"seq",
",",
"size",
")",
":",
"return",
"(",
"seq",
"[",
"i",
":",
"i",
"+",
"size",
"]",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"len",
"(",
"seq",
")",
",",
"size",
")",
")"
] | https://github.com/Dan-in-CA/SIP/blob/7d08d807d7730bff2b5eaaa57e743665c8b143a6/web/utils.py#L586-L595 | |
AIworx-Labs/chocolate | 0ba4f6f0130eab851d32d5534241c8cac3f6666e | chocolate/connection/sqlite.py | python | SQLiteConnection.all_complementary | (self) | return list(db[self.complementary_table_name].all()) | Get all entries of the complementary information table as a list.
The order is undefined. | Get all entries of the complementary information table as a list.
The order is undefined. | [
"Get",
"all",
"entries",
"of",
"the",
"complementary",
"information",
"table",
"as",
"a",
"list",
".",
"The",
"order",
"is",
"undefined",
"."
] | def all_complementary(self):
"""Get all entries of the complementary information table as a list.
The order is undefined.
"""
gc.collect()
db = dataset.connect(self.url)
return list(db[self.complementary_table_name].all()) | [
"def",
"all_complementary",
"(",
"self",
")",
":",
"gc",
".",
"collect",
"(",
")",
"db",
"=",
"dataset",
".",
"connect",
"(",
"self",
".",
"url",
")",
"return",
"list",
"(",
"db",
"[",
"self",
".",
"complementary_table_name",
"]",
".",
"all",
"(",
")... | https://github.com/AIworx-Labs/chocolate/blob/0ba4f6f0130eab851d32d5534241c8cac3f6666e/chocolate/connection/sqlite.py#L154-L160 | |
psf/black | 33e3bb1e4e326713f85749705179da2e31520670 | src/black/files.py | python | find_project_root | (srcs: Sequence[str]) | return directory, "file system root" | Return a directory containing .git, .hg, or pyproject.toml.
That directory will be a common parent of all files and directories
passed in `srcs`.
If no directory in the tree contains a marker that would specify it's the
project root, the root of the file system is returned.
Returns a two-tuple wi... | Return a directory containing .git, .hg, or pyproject.toml. | [
"Return",
"a",
"directory",
"containing",
".",
"git",
".",
"hg",
"or",
"pyproject",
".",
"toml",
"."
] | def find_project_root(srcs: Sequence[str]) -> Tuple[Path, str]:
"""Return a directory containing .git, .hg, or pyproject.toml.
That directory will be a common parent of all files and directories
passed in `srcs`.
If no directory in the tree contains a marker that would specify it's the
project roo... | [
"def",
"find_project_root",
"(",
"srcs",
":",
"Sequence",
"[",
"str",
"]",
")",
"->",
"Tuple",
"[",
"Path",
",",
"str",
"]",
":",
"if",
"not",
"srcs",
":",
"srcs",
"=",
"[",
"str",
"(",
"Path",
".",
"cwd",
"(",
")",
".",
"resolve",
"(",
")",
")... | https://github.com/psf/black/blob/33e3bb1e4e326713f85749705179da2e31520670/src/black/files.py#L34-L73 | |
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/venv/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py | python | ParserElement.__rand__ | (self, other ) | return other & self | Implementation of & operator when left operand is not a C{L{ParserElement}} | Implementation of & operator when left operand is not a C{L{ParserElement}} | [
"Implementation",
"of",
"&",
"operator",
"when",
"left",
"operand",
"is",
"not",
"a",
"C",
"{",
"L",
"{",
"ParserElement",
"}}"
] | def __rand__(self, other ):
"""
Implementation of & operator when left operand is not a C{L{ParserElement}}
"""
if isinstance( other, basestring ):
other = ParserElement._literalStringClass( other )
if not isinstance( other, ParserElement ):
warnings.warn(... | [
"def",
"__rand__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"ParserElement",
".",
"_literalStringClass",
"(",
"other",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ParserElemen... | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/venv/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py#L2008-L2018 | |
ansible/ansible | 4676c08f188fb5dca98df61630c76dba1f0d2d77 | lib/ansible/module_utils/distro/_distro.py | python | LinuxDistribution._parse_distro_release_file | (self, filepath) | Parse a distro release file.
Parameters:
* filepath: Path name of the distro release file.
Returns:
A dictionary containing all information items. | Parse a distro release file. | [
"Parse",
"a",
"distro",
"release",
"file",
"."
] | def _parse_distro_release_file(self, filepath):
# type: (str) -> Dict[str, str]
"""
Parse a distro release file.
Parameters:
* filepath: Path name of the distro release file.
Returns:
A dictionary containing all information items.
"""
try:
... | [
"def",
"_parse_distro_release_file",
"(",
"self",
",",
"filepath",
")",
":",
"# type: (str) -> Dict[str, str]",
"try",
":",
"with",
"open",
"(",
"filepath",
")",
"as",
"fp",
":",
"# Only parse the first line. For instance, on SLES there",
"# are multiple lines. We don't want ... | https://github.com/ansible/ansible/blob/4676c08f188fb5dca98df61630c76dba1f0d2d77/lib/ansible/module_utils/distro/_distro.py#L1346-L1367 | ||
thearn/Python-Arduino-Command-API | 610171b3ae153542aca42d354fbb26c32027f38f | examples.py | python | softBlink | (led_pin, baud, port="") | Fades an LED off and on, using
Arduino's analogWrite (PWM) function | Fades an LED off and on, using
Arduino's analogWrite (PWM) function | [
"Fades",
"an",
"LED",
"off",
"and",
"on",
"using",
"Arduino",
"s",
"analogWrite",
"(",
"PWM",
")",
"function"
] | def softBlink(led_pin, baud, port=""):
"""
Fades an LED off and on, using
Arduino's analogWrite (PWM) function
"""
board = Arduino(baud, port=port)
i = 0
while True:
i += 1
k = i % 510
if k % 5 == 0:
if k > 255:
k = 510 - k
boar... | [
"def",
"softBlink",
"(",
"led_pin",
",",
"baud",
",",
"port",
"=",
"\"\"",
")",
":",
"board",
"=",
"Arduino",
"(",
"baud",
",",
"port",
"=",
"port",
")",
"i",
"=",
"0",
"while",
"True",
":",
"i",
"+=",
"1",
"k",
"=",
"i",
"%",
"510",
"if",
"k... | https://github.com/thearn/Python-Arduino-Command-API/blob/610171b3ae153542aca42d354fbb26c32027f38f/examples.py#L21-L34 | ||
idapython/src | 839d93ac969bc1a152982464907445bc0d18a1f8 | pywraps/py_kernwin_askform.py | python | Form.SetFocusedField | (self, ctrl) | return _ida_kernwin.formchgcbfa_set_focused_field(self.p_fa, ctrl.id) | Set currently focused input field
@return: False - no such control | Set currently focused input field | [
"Set",
"currently",
"focused",
"input",
"field"
] | def SetFocusedField(self, ctrl):
"""
Set currently focused input field
@return: False - no such control
"""
return _ida_kernwin.formchgcbfa_set_focused_field(self.p_fa, ctrl.id) | [
"def",
"SetFocusedField",
"(",
"self",
",",
"ctrl",
")",
":",
"return",
"_ida_kernwin",
".",
"formchgcbfa_set_focused_field",
"(",
"self",
".",
"p_fa",
",",
"ctrl",
".",
"id",
")"
] | https://github.com/idapython/src/blob/839d93ac969bc1a152982464907445bc0d18a1f8/pywraps/py_kernwin_askform.py#L1269-L1274 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/rpi_camera/camera.py | python | RaspberryCamera.__init__ | (self, device_info) | Initialize Raspberry Pi camera component. | Initialize Raspberry Pi camera component. | [
"Initialize",
"Raspberry",
"Pi",
"camera",
"component",
"."
] | def __init__(self, device_info):
"""Initialize Raspberry Pi camera component."""
super().__init__()
self._name = device_info[CONF_NAME]
self._config = device_info
# Kill if there's raspistill instance
kill_raspistill()
cmd_args = [
"raspistill",
... | [
"def",
"__init__",
"(",
"self",
",",
"device_info",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
")",
"self",
".",
"_name",
"=",
"device_info",
"[",
"CONF_NAME",
"]",
"self",
".",
"_config",
"=",
"device_info",
"# Kill if there's raspistill instance",
... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/rpi_camera/camera.py#L86-L136 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.