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
mcordts/cityscapesScripts
aeb7b82531f86185ce287705be28f452ba3ddbb8
cityscapesscripts/helpers/annotation.py
python
CsBbox2d.bbox_modal
(self)
return [ self.bbox_modal_xywh[0], self.bbox_modal_xywh[1], self.bbox_modal_xywh[0] + self.bbox_modal_xywh[2], self.bbox_modal_xywh[1] + self.bbox_modal_xywh[3] ]
Returns the 2d box as [xmin, ymin, xmax, ymax]
Returns the 2d box as [xmin, ymin, xmax, ymax]
[ "Returns", "the", "2d", "box", "as", "[", "xmin", "ymin", "xmax", "ymax", "]" ]
def bbox_modal(self): """Returns the 2d box as [xmin, ymin, xmax, ymax]""" return [ self.bbox_modal_xywh[0], self.bbox_modal_xywh[1], self.bbox_modal_xywh[0] + self.bbox_modal_xywh[2], self.bbox_modal_xywh[1] + self.bbox_modal_xywh[3] ]
[ "def", "bbox_modal", "(", "self", ")", ":", "return", "[", "self", ".", "bbox_modal_xywh", "[", "0", "]", ",", "self", ".", "bbox_modal_xywh", "[", "1", "]", ",", "self", ".", "bbox_modal_xywh", "[", "0", "]", "+", "self", ".", "bbox_modal_xywh", "[", ...
https://github.com/mcordts/cityscapesScripts/blob/aeb7b82531f86185ce287705be28f452ba3ddbb8/cityscapesscripts/helpers/annotation.py#L199-L206
wucng/TensorExpand
4ea58f64f5c5082b278229b799c9f679536510b7
TensorExpand/Object detection/SSD/balancap-SSD-Tensorflow/nets/ssd_vgg_512.py
python
ssd_arg_scope_caffe
(caffe_scope)
Caffe scope definition. Args: caffe_scope: Caffe scope object with loaded weights. Returns: An arg_scope.
Caffe scope definition.
[ "Caffe", "scope", "definition", "." ]
def ssd_arg_scope_caffe(caffe_scope): """Caffe scope definition. Args: caffe_scope: Caffe scope object with loaded weights. Returns: An arg_scope. """ # Default network arg scope. with slim.arg_scope([slim.conv2d], activation_fn=tf.nn.relu, ...
[ "def", "ssd_arg_scope_caffe", "(", "caffe_scope", ")", ":", "# Default network arg scope.", "with", "slim", ".", "arg_scope", "(", "[", "slim", ".", "conv2d", "]", ",", "activation_fn", "=", "tf", ".", "nn", ".", "relu", ",", "weights_initializer", "=", "caffe...
https://github.com/wucng/TensorExpand/blob/4ea58f64f5c5082b278229b799c9f679536510b7/TensorExpand/Object detection/SSD/balancap-SSD-Tensorflow/nets/ssd_vgg_512.py#L490-L510
nedbat/coveragepy
d004b18a1ad59ec89b89c96c03a789a55cc51693
coverage/misc.py
python
human_sorted_items
(items, reverse=False)
return sorted(items, key=lambda pair: (human_key(pair[0]), pair[1]), reverse=reverse)
Sort the (string, value) items the way humans expect. Returns the sorted list of items.
Sort the (string, value) items the way humans expect.
[ "Sort", "the", "(", "string", "value", ")", "items", "the", "way", "humans", "expect", "." ]
def human_sorted_items(items, reverse=False): """Sort the (string, value) items the way humans expect. Returns the sorted list of items. """ return sorted(items, key=lambda pair: (human_key(pair[0]), pair[1]), reverse=reverse)
[ "def", "human_sorted_items", "(", "items", ",", "reverse", "=", "False", ")", ":", "return", "sorted", "(", "items", ",", "key", "=", "lambda", "pair", ":", "(", "human_key", "(", "pair", "[", "0", "]", ")", ",", "pair", "[", "1", "]", ")", ",", ...
https://github.com/nedbat/coveragepy/blob/d004b18a1ad59ec89b89c96c03a789a55cc51693/coverage/misc.py#L390-L395
microsoft/TextWorld
c419bb63a92c7f6960aa004a367fb18894043e7f
textworld/core.py
python
GameState.copy
(self)
return state
Returns a deepcopy of this game state.
Returns a deepcopy of this game state.
[ "Returns", "a", "deepcopy", "of", "this", "game", "state", "." ]
def copy(self) -> "GameState": """ Returns a deepcopy of this game state. """ state = GameState(self) for key in self: state[key] = deepcopy(self[key]) return state
[ "def", "copy", "(", "self", ")", "->", "\"GameState\"", ":", "state", "=", "GameState", "(", "self", ")", "for", "key", "in", "self", ":", "state", "[", "key", "]", "=", "deepcopy", "(", "self", "[", "key", "]", ")", "return", "state" ]
https://github.com/microsoft/TextWorld/blob/c419bb63a92c7f6960aa004a367fb18894043e7f/textworld/core.py#L133-L139
AutodeskRoboticsLab/Mimic
85447f0d346be66988303a6a054473d92f1ed6f4
mimic/scripts/extern/pyqtgraph_0_11_0_dev0/pyqtgraph/widgets/SpinBox.py
python
SpinBox.selectNumber
(self)
Select the numerical portion of the text to allow quick editing by the user.
Select the numerical portion of the text to allow quick editing by the user.
[ "Select", "the", "numerical", "portion", "of", "the", "text", "to", "allow", "quick", "editing", "by", "the", "user", "." ]
def selectNumber(self): """ Select the numerical portion of the text to allow quick editing by the user. """ le = self.lineEdit() text = asUnicode(le.text()) m = self.opts['regex'].match(text) if m is None: return s,e = m.start('number'), m.end...
[ "def", "selectNumber", "(", "self", ")", ":", "le", "=", "self", ".", "lineEdit", "(", ")", "text", "=", "asUnicode", "(", "le", ".", "text", "(", ")", ")", "m", "=", "self", ".", "opts", "[", "'regex'", "]", ".", "match", "(", "text", ")", "if...
https://github.com/AutodeskRoboticsLab/Mimic/blob/85447f0d346be66988303a6a054473d92f1ed6f4/mimic/scripts/extern/pyqtgraph_0_11_0_dev0/pyqtgraph/widgets/SpinBox.py#L293-L303
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/pandas-0.24.2-py3.7-macosx-10.9-x86_64.egg/pandas/core/generic.py
python
NDFrame.clip_upper
(self, threshold, axis=None, inplace=False)
return self._clip_with_one_bound(threshold, method=self.le, axis=axis, inplace=inplace)
Trim values above a given threshold. .. deprecated:: 0.24.0 Use clip(upper=threshold) instead. Elements above the `threshold` will be changed to match the `threshold` value(s). Threshold can be a single value or an array, in the latter case it performs the truncation elemen...
Trim values above a given threshold.
[ "Trim", "values", "above", "a", "given", "threshold", "." ]
def clip_upper(self, threshold, axis=None, inplace=False): """ Trim values above a given threshold. .. deprecated:: 0.24.0 Use clip(upper=threshold) instead. Elements above the `threshold` will be changed to match the `threshold` value(s). Threshold can be a single ...
[ "def", "clip_upper", "(", "self", ",", "threshold", ",", "axis", "=", "None", ",", "inplace", "=", "False", ")", ":", "warnings", ".", "warn", "(", "'clip_upper(threshold) is deprecated, '", "'use clip(upper=threshold) instead'", ",", "FutureWarning", ",", "stacklev...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/pandas-0.24.2-py3.7-macosx-10.9-x86_64.egg/pandas/core/generic.py#L7318-L7396
aws/Trusted-Advisor-Tools
09c353c78810f534ee22bd28254d56f0ab7166c9
ExposedAccessKeys/lambda_functions/notify_security.py
python
publish_msg
(subject, message)
Publishes message to SNS topic. Args: subject (string): Subject of message to be published to topic. message (string): Content of message to be published to topic. Returns: (None)
Publishes message to SNS topic.
[ "Publishes", "message", "to", "SNS", "topic", "." ]
def publish_msg(subject, message): """ Publishes message to SNS topic. Args: subject (string): Subject of message to be published to topic. message (string): Content of message to be published to topic. Returns: (None) """ try: sns.publish( TopicArn=TOP...
[ "def", "publish_msg", "(", "subject", ",", "message", ")", ":", "try", ":", "sns", ".", "publish", "(", "TopicArn", "=", "TOPIC_ARN", ",", "Message", "=", "message", ",", "Subject", "=", "subject", ",", "MessageStructure", "=", "'string'", ")", "except", ...
https://github.com/aws/Trusted-Advisor-Tools/blob/09c353c78810f534ee22bd28254d56f0ab7166c9/ExposedAccessKeys/lambda_functions/notify_security.py#L64-L85
dipy/dipy
be956a529465b28085f8fc435a756947ddee1c89
dipy/reconst/csdeconv.py
python
AxSymShResponse.basis
(self, sphere)
return real_sh_descoteaux_from_index(self.m, self.n, theta, phi)
A basis that maps the response coefficients onto a sphere.
A basis that maps the response coefficients onto a sphere.
[ "A", "basis", "that", "maps", "the", "response", "coefficients", "onto", "a", "sphere", "." ]
def basis(self, sphere): """A basis that maps the response coefficients onto a sphere.""" theta = sphere.theta[:, None] phi = sphere.phi[:, None] return real_sh_descoteaux_from_index(self.m, self.n, theta, phi)
[ "def", "basis", "(", "self", ",", "sphere", ")", ":", "theta", "=", "sphere", ".", "theta", "[", ":", ",", "None", "]", "phi", "=", "sphere", ".", "phi", "[", ":", ",", "None", "]", "return", "real_sh_descoteaux_from_index", "(", "self", ".", "m", ...
https://github.com/dipy/dipy/blob/be956a529465b28085f8fc435a756947ddee1c89/dipy/reconst/csdeconv.py#L157-L161
pypa/pipenv
b21baade71a86ab3ee1429f71fbc14d4f95fb75d
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
python
EntryPoint.parse_map
(cls, data, dist=None)
return maps
Parse a map of entry point groups
Parse a map of entry point groups
[ "Parse", "a", "map", "of", "entry", "point", "groups" ]
def parse_map(cls, data, dist=None): """Parse a map of entry point groups""" if isinstance(data, dict): data = data.items() else: data = split_sections(data) maps = {} for group, lines in data: if group is None: if not lines: ...
[ "def", "parse_map", "(", "cls", ",", "data", ",", "dist", "=", "None", ")", ":", "if", "isinstance", "(", "data", ",", "dict", ")", ":", "data", "=", "data", ".", "items", "(", ")", "else", ":", "data", "=", "split_sections", "(", "data", ")", "m...
https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L2520-L2536
python/cpython
e13cdca0f5224ec4e23bdd04bb3120506964bc8b
Lib/pathlib.py
python
Path.is_dir
(self)
Whether this path is a directory.
Whether this path is a directory.
[ "Whether", "this", "path", "is", "a", "directory", "." ]
def is_dir(self): """ Whether this path is a directory. """ try: return S_ISDIR(self.stat().st_mode) except OSError as e: if not _ignore_error(e): raise # Path doesn't exist or is a broken symlink # (see http://web.a...
[ "def", "is_dir", "(", "self", ")", ":", "try", ":", "return", "S_ISDIR", "(", "self", ".", "stat", "(", ")", ".", "st_mode", ")", "except", "OSError", "as", "e", ":", "if", "not", "_ignore_error", "(", "e", ")", ":", "raise", "# Path doesn't exist or i...
https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/pathlib.py#L1298-L1312
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_vendored_deps/filter_plugins/openshift_master.py
python
OpenIDIdentityProvider.validate
(self)
validate this idp instance
validate this idp instance
[ "validate", "this", "idp", "instance" ]
def validate(self): ''' validate this idp instance ''' if not isinstance(self.provider['claims'], dict): raise errors.AnsibleFilterError("|failed claims for provider {0} " "must be a dictionary".format(self.__class__.__name__)) for var, va...
[ "def", "validate", "(", "self", ")", ":", "if", "not", "isinstance", "(", "self", ".", "provider", "[", "'claims'", "]", ",", "dict", ")", ":", "raise", "errors", ".", "AnsibleFilterError", "(", "\"|failed claims for provider {0} \"", "\"must be a dictionary\"", ...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_vendored_deps/filter_plugins/openshift_master.py#L361-L409
Trusted-AI/AIX360
36459f2a585d0e2a2e8582562bf226d4402b57d6
aix360/algorithms/lime/lime_wrapper.py
python
LimeTabularExplainer.__init__
(self, *argv, **kwargs)
Initialize lime Tabular Explainer object
Initialize lime Tabular Explainer object
[ "Initialize", "lime", "Tabular", "Explainer", "object" ]
def __init__(self, *argv, **kwargs): """ Initialize lime Tabular Explainer object """ super(LimeTabularExplainer, self).__init__(*argv, **kwargs) self.explainer = lime_tabular.LimeTabularExplainer(*argv, **kwargs)
[ "def", "__init__", "(", "self", ",", "*", "argv", ",", "*", "*", "kwargs", ")", ":", "super", "(", "LimeTabularExplainer", ",", "self", ")", ".", "__init__", "(", "*", "argv", ",", "*", "*", "kwargs", ")", "self", ".", "explainer", "=", "lime_tabular...
https://github.com/Trusted-AI/AIX360/blob/36459f2a585d0e2a2e8582562bf226d4402b57d6/aix360/algorithms/lime/lime_wrapper.py#L77-L83
oilshell/oil
94388e7d44a9ad879b12615f6203b38596b5a2d3
Python-2.7.13/Lib/symtable.py
python
SymbolTable.get_type
(self)
[]
def get_type(self): if self._table.type == _symtable.TYPE_MODULE: return "module" if self._table.type == _symtable.TYPE_FUNCTION: return "function" if self._table.type == _symtable.TYPE_CLASS: return "class" assert self._table.type in (1, 2, 3), \ ...
[ "def", "get_type", "(", "self", ")", ":", "if", "self", ".", "_table", ".", "type", "==", "_symtable", ".", "TYPE_MODULE", ":", "return", "\"module\"", "if", "self", ".", "_table", ".", "type", "==", "_symtable", ".", "TYPE_FUNCTION", ":", "return", "\"f...
https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/symtable.py#L57-L65
accel-brain/accel-brain-code
86f489dc9be001a3bae6d053f48d6b57c0bedb95
Accel-Brain-Base/accelbrainbase/iteratabledata/_mxnet/unlabeled_t_hot_txt_iterator.py
python
UnlabeledTHotTXTIterator.generate_learned_samples
(self)
Draw and generate data. Returns: `Tuple` data. The shape is ... - `mxnet.ndarray` of observed data points in training. - `mxnet.ndarray` of supervised data in training. - `mxnet.ndarray` of observed data points in test. - `mxnet.ndarray` of supervised...
Draw and generate data.
[ "Draw", "and", "generate", "data", "." ]
def generate_learned_samples(self): ''' Draw and generate data. Returns: `Tuple` data. The shape is ... - `mxnet.ndarray` of observed data points in training. - `mxnet.ndarray` of supervised data in training. - `mxnet.ndarray` of observed data poi...
[ "def", "generate_learned_samples", "(", "self", ")", ":", "for", "_", "in", "range", "(", "self", ".", "iter_n", ")", ":", "training_batch_arr", "=", "np", ".", "zeros", "(", "(", "self", ".", "batch_size", ",", "1", ",", "self", ".", "seq_len", ",", ...
https://github.com/accel-brain/accel-brain-code/blob/86f489dc9be001a3bae6d053f48d6b57c0bedb95/Accel-Brain-Base/accelbrainbase/iteratabledata/_mxnet/unlabeled_t_hot_txt_iterator.py#L115-L183
pyqt/examples
843bb982917cecb2350b5f6d7f42c9b7fb142ec1
src/pyqt-official/designer/plugins/widgets/datetimeedit.py
python
PyDateEdit.mousePressEvent
(self, event)
[]
def mousePressEvent(self, event): super(PyDateEdit, self).mousePressEvent(event) if not self.__cw: self.__cw = self.findChild(QCalendarWidget) if self.__cw: self.__cw.setFirstDayOfWeek(self.__firstDayOfWeek) self.__cw.setGridVisible(self.__gridVis...
[ "def", "mousePressEvent", "(", "self", ",", "event", ")", ":", "super", "(", "PyDateEdit", ",", "self", ")", ".", "mousePressEvent", "(", "event", ")", "if", "not", "self", ".", "__cw", ":", "self", ".", "__cw", "=", "self", ".", "findChild", "(", "Q...
https://github.com/pyqt/examples/blob/843bb982917cecb2350b5f6d7f42c9b7fb142ec1/src/pyqt-official/designer/plugins/widgets/datetimeedit.py#L57-L67
uqfoundation/multiprocess
028cc73f02655e6451d92e5147d19d8c10aebe50
pypy3.7/multiprocess/pool.py
python
Pool._map_async
(self, func, iterable, mapper, chunksize=None, callback=None, error_callback=None)
return result
Helper function to implement map, starmap and their async counterparts.
Helper function to implement map, starmap and their async counterparts.
[ "Helper", "function", "to", "implement", "map", "starmap", "and", "their", "async", "counterparts", "." ]
def _map_async(self, func, iterable, mapper, chunksize=None, callback=None, error_callback=None): ''' Helper function to implement map, starmap and their async counterparts. ''' if self._state != RUN: raise ValueError("Pool not running") if not hasattr(ite...
[ "def", "_map_async", "(", "self", ",", "func", ",", "iterable", ",", "mapper", ",", "chunksize", "=", "None", ",", "callback", "=", "None", ",", "error_callback", "=", "None", ")", ":", "if", "self", ".", "_state", "!=", "RUN", ":", "raise", "ValueErro...
https://github.com/uqfoundation/multiprocess/blob/028cc73f02655e6451d92e5147d19d8c10aebe50/pypy3.7/multiprocess/pool.py#L375-L403
SALib/SALib
b6b6b5cab3388f3b80590c98d66aca7dc784d894
src/SALib/analyze/fast.py
python
compute_orders
(outputs, N, M, omega)
return (D1 / V), (1.0 - Dt / V)
[]
def compute_orders(outputs, N, M, omega): f = np.fft.fft(outputs) Sp = np.power(np.absolute(f[np.arange(1, int((N + 1) / 2))]) / N, 2) V = 2.0 * np.sum(Sp) # Calculate first and total order D1 = 2.0 * np.sum(Sp[np.arange(1, M + 1) * int(omega) - 1]) Dt = 2.0 * np.sum(Sp[np.arange(int(omega / 2....
[ "def", "compute_orders", "(", "outputs", ",", "N", ",", "M", ",", "omega", ")", ":", "f", "=", "np", ".", "fft", ".", "fft", "(", "outputs", ")", "Sp", "=", "np", ".", "power", "(", "np", ".", "absolute", "(", "f", "[", "np", ".", "arange", "...
https://github.com/SALib/SALib/blob/b6b6b5cab3388f3b80590c98d66aca7dc784d894/src/SALib/analyze/fast.py#L98-L107
huggingface/transformers
623b4f7c63f60cce917677ee704d6c93ee960b4b
src/transformers/models/marian/convert_marian_to_pytorch.py
python
unzip
(zip_path: str, dest_dir: str)
[]
def unzip(zip_path: str, dest_dir: str) -> None: with ZipFile(zip_path, "r") as zipObj: zipObj.extractall(dest_dir)
[ "def", "unzip", "(", "zip_path", ":", "str", ",", "dest_dir", ":", "str", ")", "->", "None", ":", "with", "ZipFile", "(", "zip_path", ",", "\"r\"", ")", "as", "zipObj", ":", "zipObj", ".", "extractall", "(", "dest_dir", ")" ]
https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/models/marian/convert_marian_to_pytorch.py#L629-L631
weinbe58/QuSpin
5bbc3204dbf5c227a87a44f0dacf39509cba580c
quspin/basis/photon.py
python
photon_basis.__init__
(self,basis_constructor,*constructor_args,**blocks)
Initialises the `photon_basis` object. Parameters ----------- basis_constructor: :obj:`basis` `basis` constructor for the lattice part of the `photon_basis`. constructor_args: obj Required arguments required by the specific `basis_constructor`. blocks: obj Optional keyword arguments for `basis_const...
Initialises the `photon_basis` object.
[ "Initialises", "the", "photon_basis", "object", "." ]
def __init__(self,basis_constructor,*constructor_args,**blocks): """Initialises the `photon_basis` object. Parameters ----------- basis_constructor: :obj:`basis` `basis` constructor for the lattice part of the `photon_basis`. constructor_args: obj Required arguments required by the specific `basis_cons...
[ "def", "__init__", "(", "self", ",", "basis_constructor", ",", "*", "constructor_args", ",", "*", "*", "blocks", ")", ":", "Ntot", "=", "blocks", ".", "get", "(", "\"Ntot\"", ")", "Nph", "=", "blocks", ".", "get", "(", "\"Nph\"", ")", "self", ".", "_...
https://github.com/weinbe58/QuSpin/blob/5bbc3204dbf5c227a87a44f0dacf39509cba580c/quspin/basis/photon.py#L120-L173
google-research/morph-net
be4d79dea816c473007c5967d45ab4036306c21c
examples/keras/model.py
python
MorphNetModel.initialize_model
(self, input_tensor=None)
Initialize the model. Args: input_tensor: Input tensor to the model. tf.placeholder variable or tf.Keras.Input instance. If not provided, use the default inputs from the the base model.
Initialize the model. Args: input_tensor: Input tensor to the model. tf.placeholder variable or tf.Keras.Input instance. If not provided, use the default inputs from the the base model.
[ "Initialize", "the", "model", ".", "Args", ":", "input_tensor", ":", "Input", "tensor", "to", "the", "model", ".", "tf", ".", "placeholder", "variable", "or", "tf", ".", "Keras", ".", "Input", "instance", ".", "If", "not", "provided", "use", "the", "defa...
def initialize_model(self, input_tensor=None): """ Initialize the model. Args: input_tensor: Input tensor to the model. tf.placeholder variable or tf.Keras.Input instance. If not provided, use the default inputs from the the base model. """ with tf.device(self.main_tr...
[ "def", "initialize_model", "(", "self", ",", "input_tensor", "=", "None", ")", ":", "with", "tf", ".", "device", "(", "self", ".", "main_train_device", ")", ":", "base_model", "=", "self", ".", "base_model", "(", "weights", "=", "None", ",", "include_top",...
https://github.com/google-research/morph-net/blob/be4d79dea816c473007c5967d45ab4036306c21c/examples/keras/model.py#L82-L105
cleverhans-lab/cleverhans
e5d00e537ce7ad6119ed5a8db1f0e9736d1f6e1d
cleverhans_v3.1.0/cleverhans/model_zoo/madry_lab_challenges/cifar10_model.py
python
Input.fprop
(self, x)
[]
def fprop(self, x): with tf.variable_scope("input", reuse=tf.AUTO_REUSE): input_standardized = tf.map_fn( lambda img: tf.image.per_image_standardization(img), x ) return _conv("init_conv", input_standardized, 3, 3, 16, _stride_arr(1))
[ "def", "fprop", "(", "self", ",", "x", ")", ":", "with", "tf", ".", "variable_scope", "(", "\"input\"", ",", "reuse", "=", "tf", ".", "AUTO_REUSE", ")", ":", "input_standardized", "=", "tf", ".", "map_fn", "(", "lambda", "img", ":", "tf", ".", "image...
https://github.com/cleverhans-lab/cleverhans/blob/e5d00e537ce7ad6119ed5a8db1f0e9736d1f6e1d/cleverhans_v3.1.0/cleverhans/model_zoo/madry_lab_challenges/cifar10_model.py#L128-L133
buke/GreenOdoo
3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df
source/addons/fetchmail/fetchmail.py
python
fetchmail_server.fetch_mail
(self, cr, uid, ids, context=None)
return True
WARNING: meant for cron usage only - will commit() after each email!
WARNING: meant for cron usage only - will commit() after each email!
[ "WARNING", ":", "meant", "for", "cron", "usage", "only", "-", "will", "commit", "()", "after", "each", "email!" ]
def fetch_mail(self, cr, uid, ids, context=None): """WARNING: meant for cron usage only - will commit() after each email!""" context = dict(context or {}) context['fetchmail_cron_running'] = True mail_thread = self.pool.get('mail.thread') action_pool = self.pool.get('ir.actions.s...
[ "def", "fetch_mail", "(", "self", ",", "cr", ",", "uid", ",", "ids", ",", "context", "=", "None", ")", ":", "context", "=", "dict", "(", "context", "or", "{", "}", ")", "context", "[", "'fetchmail_cron_running'", "]", "=", "True", "mail_thread", "=", ...
https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/source/addons/fetchmail/fetchmail.py#L189-L264
Mailu/Mailu
1e53530164e9eaf77a89c322e34bff447ace5a28
core/admin/mailu/utils.py
python
handle_needs_login
()
return flask.redirect( flask.url_for('sso.login') )
redirect unauthorized requests to login page
redirect unauthorized requests to login page
[ "redirect", "unauthorized", "requests", "to", "login", "page" ]
def handle_needs_login(): """ redirect unauthorized requests to login page """ return flask.redirect( flask.url_for('sso.login') )
[ "def", "handle_needs_login", "(", ")", ":", "return", "flask", ".", "redirect", "(", "flask", ".", "url_for", "(", "'sso.login'", ")", ")" ]
https://github.com/Mailu/Mailu/blob/1e53530164e9eaf77a89c322e34bff447ace5a28/core/admin/mailu/utils.py#L42-L46
linxid/Machine_Learning_Study_Path
558e82d13237114bbb8152483977806fc0c222af
Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/site-packages/setuptools/package_index.py
python
PackageIndex.download
(self, spec, tmpdir)
return getattr(self.fetch_distribution(spec, tmpdir), 'location', None)
Locate and/or download `spec` to `tmpdir`, returning a local path `spec` may be a ``Requirement`` object, or a string containing a URL, an existing local filename, or a project/version requirement spec (i.e. the string form of a ``Requirement`` object). If it is the URL of a .py file w...
Locate and/or download `spec` to `tmpdir`, returning a local path
[ "Locate", "and", "/", "or", "download", "spec", "to", "tmpdir", "returning", "a", "local", "path" ]
def download(self, spec, tmpdir): """Locate and/or download `spec` to `tmpdir`, returning a local path `spec` may be a ``Requirement`` object, or a string containing a URL, an existing local filename, or a project/version requirement spec (i.e. the string form of a ``Requirement`` objec...
[ "def", "download", "(", "self", ",", "spec", ",", "tmpdir", ")", ":", "if", "not", "isinstance", "(", "spec", ",", "Requirement", ")", ":", "scheme", "=", "URL_SCHEME", "(", "spec", ")", "if", "scheme", ":", "# It's a url, download it to tmpdir", "found", ...
https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/site-packages/setuptools/package_index.py#L559-L591
samuelclay/NewsBlur
2c45209df01a1566ea105e04d499367f32ac9ad2
apps/social/views.py
python
mute_story
(request, secret_token, shared_story_id)
return {}
[]
def mute_story(request, secret_token, shared_story_id): user_profile = Profile.objects.get(secret_token=secret_token) shared_story = MSharedStory.objects.get(id=shared_story_id) shared_story.mute_for_user(user_profile.user_id) return {}
[ "def", "mute_story", "(", "request", ",", "secret_token", ",", "shared_story_id", ")", ":", "user_profile", "=", "Profile", ".", "objects", ".", "get", "(", "secret_token", "=", "secret_token", ")", "shared_story", "=", "MSharedStory", ".", "objects", ".", "ge...
https://github.com/samuelclay/NewsBlur/blob/2c45209df01a1566ea105e04d499367f32ac9ad2/apps/social/views.py#L899-L904
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/iai/v20200303/models.py
python
Hair.__init__
(self)
r""" :param Length: 头发长度信息。 AttributeItem对应的Type为 —— 0:光头,1:短发,2:中发,3:长发,4:绑发。 :type Length: :class:`tencentcloud.iai.v20200303.models.AttributeItem` :param Bang: 刘海信息。 AttributeItem对应的Type为 —— 0:无刘海,1:有刘海。 :type Bang: :class:`tencentcloud.iai.v20200303.models.AttributeItem` :par...
r""" :param Length: 头发长度信息。 AttributeItem对应的Type为 —— 0:光头,1:短发,2:中发,3:长发,4:绑发。 :type Length: :class:`tencentcloud.iai.v20200303.models.AttributeItem` :param Bang: 刘海信息。 AttributeItem对应的Type为 —— 0:无刘海,1:有刘海。 :type Bang: :class:`tencentcloud.iai.v20200303.models.AttributeItem` :par...
[ "r", ":", "param", "Length", ":", "头发长度信息。", "AttributeItem对应的Type为", "——", "0:光头,1:短发,2:中发,3:长发,4:绑发。", ":", "type", "Length", ":", ":", "class", ":", "tencentcloud", ".", "iai", ".", "v20200303", ".", "models", ".", "AttributeItem", ":", "param", "Bang", ":"...
def __init__(self): r""" :param Length: 头发长度信息。 AttributeItem对应的Type为 —— 0:光头,1:短发,2:中发,3:长发,4:绑发。 :type Length: :class:`tencentcloud.iai.v20200303.models.AttributeItem` :param Bang: 刘海信息。 AttributeItem对应的Type为 —— 0:无刘海,1:有刘海。 :type Bang: :class:`tencentcloud.iai.v20200303.models...
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "Length", "=", "None", "self", ".", "Bang", "=", "None", "self", ".", "Color", "=", "None" ]
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/iai/v20200303/models.py#L3063-L3077
pysmt/pysmt
ade4dc2a825727615033a96d31c71e9f53ce4764
pysmt/smtlib/printers.py
python
SmtPrinter._walk_quantifier
(self, operator, formula)
[]
def _walk_quantifier(self, operator, formula): assert len(formula.quantifier_vars()) > 0 self.write("(%s (" % operator) for s in formula.quantifier_vars(): self.write("(") yield s self.write(" %s)" % s.symbol_type().as_smtlib(False)) self.write(") ")...
[ "def", "_walk_quantifier", "(", "self", ",", "operator", ",", "formula", ")", ":", "assert", "len", "(", "formula", ".", "quantifier_vars", "(", ")", ")", ">", "0", "self", ".", "write", "(", "\"(%s (\"", "%", "operator", ")", "for", "s", "in", "formul...
https://github.com/pysmt/pysmt/blob/ade4dc2a825727615033a96d31c71e9f53ce4764/pysmt/smtlib/printers.py#L134-L145
edisonlz/fastor
342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3
base/site-packages/django/contrib/auth/models.py
python
AbstractUser.email_user
(self, subject, message, from_email=None)
Sends an email to this User.
Sends an email to this User.
[ "Sends", "an", "email", "to", "this", "User", "." ]
def email_user(self, subject, message, from_email=None): """ Sends an email to this User. """ send_mail(subject, message, from_email, [self.email])
[ "def", "email_user", "(", "self", ",", "subject", ",", "message", ",", "from_email", "=", "None", ")", ":", "send_mail", "(", "subject", ",", "message", ",", "from_email", ",", "[", "self", ".", "email", "]", ")" ]
https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/django/contrib/auth/models.py#L409-L413
Veil-Framework/Veil
c825577bbc97db04be5c47e004369038491f6b7a
tools/evasion/evasion_common/encryption.py
python
buildAryaLauncher
(raw)
return payload_code
Takes a raw set of bytes and builds a launcher shell to b64decode/decrypt a string rep of the bytes, and then use reflection to invoke the original .exe
Takes a raw set of bytes and builds a launcher shell to b64decode/decrypt a string rep of the bytes, and then use reflection to invoke the original .exe
[ "Takes", "a", "raw", "set", "of", "bytes", "and", "builds", "a", "launcher", "shell", "to", "b64decode", "/", "decrypt", "a", "string", "rep", "of", "the", "bytes", "and", "then", "use", "reflection", "to", "invoke", "the", "original", ".", "exe" ]
def buildAryaLauncher(raw): """ Takes a raw set of bytes and builds a launcher shell to b64decode/decrypt a string rep of the bytes, and then use reflection to invoke the original .exe """ # the 'key' is a randomized alpha lookup table [a-zA-Z] used for substitution key = ''.join(sorted(lis...
[ "def", "buildAryaLauncher", "(", "raw", ")", ":", "# the 'key' is a randomized alpha lookup table [a-zA-Z] used for substitution", "key", "=", "''", ".", "join", "(", "sorted", "(", "list", "(", "string", ".", "ascii_letters", ")", ",", "key", "=", "lambda", "*", ...
https://github.com/Veil-Framework/Veil/blob/c825577bbc97db04be5c47e004369038491f6b7a/tools/evasion/evasion_common/encryption.py#L69-L113
donnemartin/gitsome
d7c57abc7cb66e9c910a844f15d4536866da3310
xonsh/ast.py
python
load_attribute_chain
(name, lineno=None, col=None)
return node
Creates an AST that loads variable name that may (or may not) have attribute chains. For example, "a.b.c"
Creates an AST that loads variable name that may (or may not) have attribute chains. For example, "a.b.c"
[ "Creates", "an", "AST", "that", "loads", "variable", "name", "that", "may", "(", "or", "may", "not", ")", "have", "attribute", "chains", ".", "For", "example", "a", ".", "b", ".", "c" ]
def load_attribute_chain(name, lineno=None, col=None): """Creates an AST that loads variable name that may (or may not) have attribute chains. For example, "a.b.c" """ names = name.split(".") node = Name(id=names.pop(0), ctx=Load(), lineno=lineno, col_offset=col) for attr in names: node ...
[ "def", "load_attribute_chain", "(", "name", ",", "lineno", "=", "None", ",", "col", "=", "None", ")", ":", "names", "=", "name", ".", "split", "(", "\".\"", ")", "node", "=", "Name", "(", "id", "=", "names", ".", "pop", "(", "0", ")", ",", "ctx",...
https://github.com/donnemartin/gitsome/blob/d7c57abc7cb66e9c910a844f15d4536866da3310/xonsh/ast.py#L271-L281
Fallen-Breath/MCDReforged
fdb1d2520b35f916123f265dbd94603981bb2b0c
mcdreforged/permission/permission_manager.py
python
PermissionManager._pre_save
(self, data)
[]
def _pre_save(self, data): # Deduplicate the permission data= for key, value in data.items(): if key in PermissionLevel.NAMES and isinstance(value, list): data[key] = misc_util.unique_list(data[key]) # Change empty list to None for nicer look in the .yml file for key, value in data.items(): if key in ...
[ "def", "_pre_save", "(", "self", ",", "data", ")", ":", "# Deduplicate the permission data=", "for", "key", ",", "value", "in", "data", ".", "items", "(", ")", ":", "if", "key", "in", "PermissionLevel", ".", "NAMES", "and", "isinstance", "(", "value", ",",...
https://github.com/Fallen-Breath/MCDReforged/blob/fdb1d2520b35f916123f265dbd94603981bb2b0c/mcdreforged/permission/permission_manager.py#L32-L40
wbond/packagecontrol.io
9f5eb7e3392e6bc2ad979ad32d3dd27ef9c00b20
app/lib/package_control/deps/asn1crypto/x509.py
python
IPAddress.parse
(self, spec=None, spec_params=None)
This method is not applicable to IP addresses
This method is not applicable to IP addresses
[ "This", "method", "is", "not", "applicable", "to", "IP", "addresses" ]
def parse(self, spec=None, spec_params=None): """ This method is not applicable to IP addresses """ raise ValueError(unwrap( ''' IP address values can not be parsed ''' ))
[ "def", "parse", "(", "self", ",", "spec", "=", "None", ",", "spec_params", "=", "None", ")", ":", "raise", "ValueError", "(", "unwrap", "(", "'''\n IP address values can not be parsed\n '''", ")", ")" ]
https://github.com/wbond/packagecontrol.io/blob/9f5eb7e3392e6bc2ad979ad32d3dd27ef9c00b20/app/lib/package_control/deps/asn1crypto/x509.py#L295-L304
demisto/content
5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07
Packs/epo/Integrations/epoV2/epoV2.py
python
Client.get_system_group_path
(self, group_id: int)
return ''
return the system group path for giving group_id Args: group_id (str): the groupID to find Returns (str): returns the system group path for a giving group id
return the system group path for giving group_id Args: group_id (str): the groupID to find Returns (str): returns the system group path for a giving group id
[ "return", "the", "system", "group", "path", "for", "giving", "group_id", "Args", ":", "group_id", "(", "str", ")", ":", "the", "groupID", "to", "find", "Returns", "(", "str", ")", ":", "returns", "the", "system", "group", "path", "for", "a", "giving", ...
def get_system_group_path(self, group_id: int) -> str: """ return the system group path for giving group_id Args: group_id (str): the groupID to find Returns (str): returns the system group path for a giving group id """ response_json, response = self.get_syst...
[ "def", "get_system_group_path", "(", "self", ",", "group_id", ":", "int", ")", "->", "str", ":", "response_json", ",", "response", "=", "self", ".", "get_system_tree_groups", "(", "search_text", "=", "''", ")", "if", "response", "is", "None", ":", "return", ...
https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/epo/Integrations/epoV2/epoV2.py#L279-L293
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework
cb692f527e4e819b6c228187c5702d990a180043
external/Scripting Engine/Xenotix Python Scripting Engine/Lib/wsgiref/util.py
python
request_uri
(environ, include_query=1)
return url
Return the full request URI, optionally including the query string
Return the full request URI, optionally including the query string
[ "Return", "the", "full", "request", "URI", "optionally", "including", "the", "query", "string" ]
def request_uri(environ, include_query=1): """Return the full request URI, optionally including the query string""" url = application_uri(environ) from urllib import quote path_info = quote(environ.get('PATH_INFO',''),safe='/;=,') if not environ.get('SCRIPT_NAME'): url += path_info[1:] e...
[ "def", "request_uri", "(", "environ", ",", "include_query", "=", "1", ")", ":", "url", "=", "application_uri", "(", "environ", ")", "from", "urllib", "import", "quote", "path_info", "=", "quote", "(", "environ", ".", "get", "(", "'PATH_INFO'", ",", "''", ...
https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/Lib/wsgiref/util.py#L63-L74
ericgazoni/openpyxl
c55988e4904d4337ce4c35ab8b7dc305bca9de23
openpyxl/writer/workbook.py
python
write_workbook_rels
(workbook)
return get_document_content(root)
Write the workbook relationships xml.
Write the workbook relationships xml.
[ "Write", "the", "workbook", "relationships", "xml", "." ]
def write_workbook_rels(workbook): """Write the workbook relationships xml.""" root = Element('{%s}Relationships' % PKG_REL_NS) for i in range(1, len(workbook.worksheets) + 1): SubElement(root, '{%s}Relationship' % PKG_REL_NS, {'Id': 'rId%d' % i, 'Target': 'worksheets/sheet%s.xml'...
[ "def", "write_workbook_rels", "(", "workbook", ")", ":", "root", "=", "Element", "(", "'{%s}Relationships'", "%", "PKG_REL_NS", ")", "for", "i", "in", "range", "(", "1", ",", "len", "(", "workbook", ".", "worksheets", ")", "+", "1", ")", ":", "SubElement...
https://github.com/ericgazoni/openpyxl/blob/c55988e4904d4337ce4c35ab8b7dc305bca9de23/openpyxl/writer/workbook.py#L287-L308
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_openshift/library/oc_adm_policy_user.py
python
RoleBinding.add_subject
(self, inc_subject)
return True
add a subject
add a subject
[ "add", "a", "subject" ]
def add_subject(self, inc_subject): ''' add a subject ''' if self.subjects: # pylint: disable=no-member self.subjects.append(inc_subject) else: self.put(RoleBinding.subjects_path, [inc_subject]) return True
[ "def", "add_subject", "(", "self", ",", "inc_subject", ")", ":", "if", "self", ".", "subjects", ":", "# pylint: disable=no-member", "self", ".", "subjects", ".", "append", "(", "inc_subject", ")", "else", ":", "self", ".", "put", "(", "RoleBinding", ".", "...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_openshift/library/oc_adm_policy_user.py#L1601-L1609
ENCODE-DCC/atac-seq-pipeline
d777eb707d481156fcc21089fe9c3e6f2aec933e
src/encode_lib_genomic.py
python
get_samtools_res_param
(subcmd, nth=1, mem_gb=None)
return res_param
Make resource parameters (-@, -m) for samtools. -@: This means number of total/additional threads. -m: This means memory per thread (for samtools sort only). It's clipped between 1 and DEFAULT_SAMTOOLS_MAX_MEM_MB_PER_THREAD MBs. Tested with samtools 1.9. Lowe...
Make resource parameters (-@, -m) for samtools. -@: This means number of total/additional threads. -m: This means memory per thread (for samtools sort only). It's clipped between 1 and DEFAULT_SAMTOOLS_MAX_MEM_MB_PER_THREAD MBs.
[ "Make", "resource", "parameters", "(", "-", "@", "-", "m", ")", "for", "samtools", ".", "-", "@", ":", "This", "means", "number", "of", "total", "/", "additional", "threads", ".", "-", "m", ":", "This", "means", "memory", "per", "thread", "(", "for",...
def get_samtools_res_param(subcmd, nth=1, mem_gb=None): """Make resource parameters (-@, -m) for samtools. -@: This means number of total/additional threads. -m: This means memory per thread (for samtools sort only). It's clipped between 1 and DEFAULT_SAMTOOLS_MAX...
[ "def", "get_samtools_res_param", "(", "subcmd", ",", "nth", "=", "1", ",", "mem_gb", "=", "None", ")", ":", "res_param", "=", "''", "if", "subcmd", "==", "'index'", ":", "res_param", "+=", "'-@ {num_total_threads} '", ".", "format", "(", "num_total_threads", ...
https://github.com/ENCODE-DCC/atac-seq-pipeline/blob/d777eb707d481156fcc21089fe9c3e6f2aec933e/src/encode_lib_genomic.py#L96-L136
rowliny/DiffHelper
ab3a96f58f9579d0023aed9ebd785f4edf26f8af
Tool/SitePackages/nltk/grammar.py
python
ProbabilisticDependencyGrammar.__str__
(self)
return str
Return a verbose string representation of the ``ProbabilisticDependencyGrammar`` :rtype: str
Return a verbose string representation of the ``ProbabilisticDependencyGrammar``
[ "Return", "a", "verbose", "string", "representation", "of", "the", "ProbabilisticDependencyGrammar" ]
def __str__(self): """ Return a verbose string representation of the ``ProbabilisticDependencyGrammar`` :rtype: str """ str = "Statistical dependency grammar with %d productions" % len( self._productions ) for production in self._productions: ...
[ "def", "__str__", "(", "self", ")", ":", "str", "=", "\"Statistical dependency grammar with %d productions\"", "%", "len", "(", "self", ".", "_productions", ")", "for", "production", "in", "self", ".", "_productions", ":", "str", "+=", "\"\\n %s\"", "%", "produ...
https://github.com/rowliny/DiffHelper/blob/ab3a96f58f9579d0023aed9ebd785f4edf26f8af/Tool/SitePackages/nltk/grammar.py#L1158-L1175
samgranger/EQGRP
fa0a1e1460767b8312839dc4be922f26ecdd250b
Firewall/EXPLOITS/EXBA/scapy/utils.py
python
RawPcapReader.next
(self)
return pkt
impliment the iterator protocol on a set of packets in a pcap file
impliment the iterator protocol on a set of packets in a pcap file
[ "impliment", "the", "iterator", "protocol", "on", "a", "set", "of", "packets", "in", "a", "pcap", "file" ]
def next(self): """impliment the iterator protocol on a set of packets in a pcap file""" pkt = self.read_packet() if pkt == None: raise StopIteration return pkt
[ "def", "next", "(", "self", ")", ":", "pkt", "=", "self", ".", "read_packet", "(", ")", "if", "pkt", "==", "None", ":", "raise", "StopIteration", "return", "pkt" ]
https://github.com/samgranger/EQGRP/blob/fa0a1e1460767b8312839dc4be922f26ecdd250b/Firewall/EXPLOITS/EXBA/scapy/utils.py#L505-L510
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/lfunctions/dokchitser.py
python
Dokchitser.num_coeffs
(self, T=1)
return Integer(self._gp_call_inst('cflength', T))
Return number of coefficients `a_n` that are needed in order to perform most relevant `L`-function computations to the desired precision. EXAMPLES:: sage: E = EllipticCurve('11a') sage: L = E.lseries().dokchitser(algorithm='gp') sage: L.num_coeffs() ...
Return number of coefficients `a_n` that are needed in order to perform most relevant `L`-function computations to the desired precision.
[ "Return", "number", "of", "coefficients", "a_n", "that", "are", "needed", "in", "order", "to", "perform", "most", "relevant", "L", "-", "function", "computations", "to", "the", "desired", "precision", "." ]
def num_coeffs(self, T=1): """ Return number of coefficients `a_n` that are needed in order to perform most relevant `L`-function computations to the desired precision. EXAMPLES:: sage: E = EllipticCurve('11a') sage: L = E.lseries().dokchitser(algorithm=...
[ "def", "num_coeffs", "(", "self", ",", "T", "=", "1", ")", ":", "return", "Integer", "(", "self", ".", "_gp_call_inst", "(", "'cflength'", ",", "T", ")", ")" ]
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/lfunctions/dokchitser.py#L347-L376
python-diamond/Diamond
7000e16cfdf4508ed9291fc4b3800592557b2431
src/collectors/squid/squid.py
python
SquidCollector.get_default_config_help
(self)
return config_help
[]
def get_default_config_help(self): config_help = super(SquidCollector, self).get_default_config_help() config_help.update({ 'hosts': 'List of hosts to collect from. Format is ' + '[nickname@]host[:port], [nickname@]host[:port], etc', }) return config_help
[ "def", "get_default_config_help", "(", "self", ")", ":", "config_help", "=", "super", "(", "SquidCollector", ",", "self", ")", ".", "get_default_config_help", "(", ")", "config_help", ".", "update", "(", "{", "'hosts'", ":", "'List of hosts to collect from. Format i...
https://github.com/python-diamond/Diamond/blob/7000e16cfdf4508ed9291fc4b3800592557b2431/src/collectors/squid/squid.py#L45-L51
graalvm/mx
29c0debab406352df3af246be2f8973be5db69ae
mx.py
python
MavenRepo.getSnapshotUrl
(self, groupId, artifactId, version)
return "{0}/{1}/{2}/{3}/maven-metadata.xml".format(self.repourl, groupId.replace('.', '/'), artifactId, version)
[]
def getSnapshotUrl(self, groupId, artifactId, version): return "{0}/{1}/{2}/{3}/maven-metadata.xml".format(self.repourl, groupId.replace('.', '/'), artifactId, version)
[ "def", "getSnapshotUrl", "(", "self", ",", "groupId", ",", "artifactId", ",", "version", ")", ":", "return", "\"{0}/{1}/{2}/{3}/maven-metadata.xml\"", ".", "format", "(", "self", ".", "repourl", ",", "groupId", ".", "replace", "(", "'.'", ",", "'/'", ")", ",...
https://github.com/graalvm/mx/blob/29c0debab406352df3af246be2f8973be5db69ae/mx.py#L10891-L10892
wistbean/learn_python3_spider
73c873f4845f4385f097e5057407d03dd37a117b
stackoverflow/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/pkg_resources/__init__.py
python
_ReqExtras.markers_pass
(self, req, extras=None)
return not req.marker or any(extra_evals)
Evaluate markers for req against each extra that demanded it. Return False if the req has a marker and fails evaluation. Otherwise, return True.
Evaluate markers for req against each extra that demanded it.
[ "Evaluate", "markers", "for", "req", "against", "each", "extra", "that", "demanded", "it", "." ]
def markers_pass(self, req, extras=None): """ Evaluate markers for req against each extra that demanded it. Return False if the req has a marker and fails evaluation. Otherwise, return True. """ extra_evals = ( req.marker.evaluate({'extra': extra}) ...
[ "def", "markers_pass", "(", "self", ",", "req", ",", "extras", "=", "None", ")", ":", "extra_evals", "=", "(", "req", ".", "marker", ".", "evaluate", "(", "{", "'extra'", ":", "extra", "}", ")", "for", "extra", "in", "self", ".", "get", "(", "req",...
https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/pkg_resources/__init__.py#L942-L954
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/hassio/__init__.py
python
async_setup
(hass: HomeAssistant, config: ConfigType)
return True
Set up the Hass.io component.
Set up the Hass.io component.
[ "Set", "up", "the", "Hass", ".", "io", "component", "." ]
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: # noqa: C901 """Set up the Hass.io component.""" # Check local setup for env in ("HASSIO", "HASSIO_TOKEN"): if os.environ.get(env): continue _LOGGER.error("Missing %s environment variable", env) if c...
[ "async", "def", "async_setup", "(", "hass", ":", "HomeAssistant", ",", "config", ":", "ConfigType", ")", "->", "bool", ":", "# noqa: C901", "# Check local setup", "for", "env", "in", "(", "\"HASSIO\"", ",", "\"HASSIO_TOKEN\"", ")", ":", "if", "os", ".", "env...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/hassio/__init__.py#L413-L640
pyqt/examples
843bb982917cecb2350b5f6d7f42c9b7fb142ec1
src/pyqt-official/desktop/systray/systray_rc.py
python
qInitResources
()
[]
def qInitResources(): QtCore.qRegisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data)
[ "def", "qInitResources", "(", ")", ":", "QtCore", ".", "qRegisterResourceData", "(", "0x01", ",", "qt_resource_struct", ",", "qt_resource_name", ",", "qt_resource_data", ")" ]
https://github.com/pyqt/examples/blob/843bb982917cecb2350b5f6d7f42c9b7fb142ec1/src/pyqt-official/desktop/systray/systray_rc.py#L2574-L2575
ray-project/ray
703c1610348615dcb8c2d141a0c46675084660f5
python/ray/_private/services.py
python
_find_gcs_address_or_die
()
return gcs_addresses.pop()
Find one GCS address unambiguously, or raise an error. Callers outside of this module should use get_ray_address_to_use_or_die()
Find one GCS address unambiguously, or raise an error.
[ "Find", "one", "GCS", "address", "unambiguously", "or", "raise", "an", "error", "." ]
def _find_gcs_address_or_die(): """Find one GCS address unambiguously, or raise an error. Callers outside of this module should use get_ray_address_to_use_or_die() """ gcs_addresses = _find_address_from_flag("--gcs-address") if len(gcs_addresses) > 1: raise ConnectionError( f"Fo...
[ "def", "_find_gcs_address_or_die", "(", ")", ":", "gcs_addresses", "=", "_find_address_from_flag", "(", "\"--gcs-address\"", ")", "if", "len", "(", "gcs_addresses", ")", ">", "1", ":", "raise", "ConnectionError", "(", "f\"Found multiple active Ray instances: {gcs_addresse...
https://github.com/ray-project/ray/blob/703c1610348615dcb8c2d141a0c46675084660f5/python/ray/_private/services.py#L318-L335
llSourcell/AI_Artist
3038c06c2e389b9c919c881c9a169efe2fd7810e
lib/python2.7/site-packages/pip/_vendor/packaging/specifiers.py
python
Specifier.prereleases
(self, value)
[]
def prereleases(self, value): self._prereleases = value
[ "def", "prereleases", "(", "self", ",", "value", ")", ":", "self", ".", "_prereleases", "=", "value" ]
https://github.com/llSourcell/AI_Artist/blob/3038c06c2e389b9c919c881c9a169efe2fd7810e/lib/python2.7/site-packages/pip/_vendor/packaging/specifiers.py#L544-L545
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/ft/v20200304/models.py
python
QueryFaceMorphJobResponse.__init__
(self)
r""" :param JobStatus: 当前任务状态:排队中、处理中、处理失败或者处理完成 :type JobStatus: str :param FaceMorphOutput: 人像渐变输出的结果信息 注意:此字段可能返回 null,表示取不到有效值。 :type FaceMorphOutput: :class:`tencentcloud.ft.v20200304.models.FaceMorphOutput` :param JobStatusCode: 当前任务状态码:1:排队中、3: 处理中、5: 处理失败、7:处理完成 注意:此字段可能返...
r""" :param JobStatus: 当前任务状态:排队中、处理中、处理失败或者处理完成 :type JobStatus: str :param FaceMorphOutput: 人像渐变输出的结果信息 注意:此字段可能返回 null,表示取不到有效值。 :type FaceMorphOutput: :class:`tencentcloud.ft.v20200304.models.FaceMorphOutput` :param JobStatusCode: 当前任务状态码:1:排队中、3: 处理中、5: 处理失败、7:处理完成 注意:此字段可能返...
[ "r", ":", "param", "JobStatus", ":", "当前任务状态:排队中、处理中、处理失败或者处理完成", ":", "type", "JobStatus", ":", "str", ":", "param", "FaceMorphOutput", ":", "人像渐变输出的结果信息", "注意:此字段可能返回", "null,表示取不到有效值。", ":", "type", "FaceMorphOutput", ":", ":", "class", ":", "tencentcloud", "."...
def __init__(self): r""" :param JobStatus: 当前任务状态:排队中、处理中、处理失败或者处理完成 :type JobStatus: str :param FaceMorphOutput: 人像渐变输出的结果信息 注意:此字段可能返回 null,表示取不到有效值。 :type FaceMorphOutput: :class:`tencentcloud.ft.v20200304.models.FaceMorphOutput` :param JobStatusCode: 当前任务状态码:1:排队中、3: ...
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "JobStatus", "=", "None", "self", ".", "FaceMorphOutput", "=", "None", "self", ".", "JobStatusCode", "=", "None", "self", ".", "RequestId", "=", "None" ]
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/ft/v20200304/models.py#L477-L493
buke/GreenOdoo
3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df
runtime/python/lib/python2.7/imputil.py
python
ImportManager._reload_hook
(self, module)
Python calls this hook to reload a module.
Python calls this hook to reload a module.
[ "Python", "calls", "this", "hook", "to", "reload", "a", "module", "." ]
def _reload_hook(self, module): "Python calls this hook to reload a module." # reloading of a module may or may not be possible (depending on the # importer), but at least we can validate that it's ours to reload importer = module.__dict__.get('__importer__') if not importer: ...
[ "def", "_reload_hook", "(", "self", ",", "module", ")", ":", "# reloading of a module may or may not be possible (depending on the", "# importer), but at least we can validate that it's ours to reload", "importer", "=", "module", ".", "__dict__", ".", "get", "(", "'__importer__'"...
https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/imputil.py#L200-L214
ckan/ckan
b3b01218ad88ed3fb914b51018abe8b07b07bff3
ckanext/datastore/backend/postgres.py
python
_programming_error_summary
(pe)
return message.split(u') ', 1)[-1]
u''' return the text description of a sqlalchemy DatabaseError without the actual SQL included, for raising as a ValidationError to send back to API users
u''' return the text description of a sqlalchemy DatabaseError without the actual SQL included, for raising as a ValidationError to send back to API users
[ "u", "return", "the", "text", "description", "of", "a", "sqlalchemy", "DatabaseError", "without", "the", "actual", "SQL", "included", "for", "raising", "as", "a", "ValidationError", "to", "send", "back", "to", "API", "users" ]
def _programming_error_summary(pe): u''' return the text description of a sqlalchemy DatabaseError without the actual SQL included, for raising as a ValidationError to send back to API users ''' # first line only, after the '(ProgrammingError)' text message = six.ensure_text(pe.args[0].split...
[ "def", "_programming_error_summary", "(", "pe", ")", ":", "# first line only, after the '(ProgrammingError)' text", "message", "=", "six", ".", "ensure_text", "(", "pe", ".", "args", "[", "0", "]", ".", "split", "(", "'\\n'", ")", "[", "0", "]", ")", "return",...
https://github.com/ckan/ckan/blob/b3b01218ad88ed3fb914b51018abe8b07b07bff3/ckanext/datastore/backend/postgres.py#L2257-L2265
n1nj4sec/pupy
a5d766ea81fdfe3bc2c38c9bdaf10e9b75af3b39
pupy/library_patches/Crypto/Util/_raw_api.py
python
load_pycryptodome_raw_lib
(name, cdecl)
Load a shared library and return a handle to it. @name, the name of the library expressed as a PyCryptodome module, for instance Crypto.Cipher._raw_cbc. @cdecl, the C function declarations.
Load a shared library and return a handle to it.
[ "Load", "a", "shared", "library", "and", "return", "a", "handle", "to", "it", "." ]
def load_pycryptodome_raw_lib(name, cdecl): """Load a shared library and return a handle to it. @name, the name of the library expressed as a PyCryptodome module, for instance Crypto.Cipher._raw_cbc. @cdecl, the C function declarations. """ attempts = [] basename = '/'.join(name....
[ "def", "load_pycryptodome_raw_lib", "(", "name", ",", "cdecl", ")", ":", "attempts", "=", "[", "]", "basename", "=", "'/'", ".", "join", "(", "name", ".", "split", "(", "'.'", ")", ")", "for", "ext", "in", "extension_suffixes", ":", "try", ":", "filena...
https://github.com/n1nj4sec/pupy/blob/a5d766ea81fdfe3bc2c38c9bdaf10e9b75af3b39/pupy/library_patches/Crypto/Util/_raw_api.py#L176-L194
wrobstory/sticky
0cc9ea8ce433eecdf6292d5610dd1e4cba4874ca
sticky/c3.py
python
C3.width
(self, width)
return self
Chart width: integer
Chart width: integer
[ "Chart", "width", ":", "integer" ]
def width(self, width): """Chart width: integer""" self.model_width = width return self
[ "def", "width", "(", "self", ",", "width", ")", ":", "self", ".", "model_width", "=", "width", "return", "self" ]
https://github.com/wrobstory/sticky/blob/0cc9ea8ce433eecdf6292d5610dd1e4cba4874ca/sticky/c3.py#L117-L120
hakril/PythonForWindows
61e027a678d5b87aa64fcf8a37a6661a86236589
windows/winobject/event_log.py
python
EvtEvent.time_created
(self)
return self.value("Event/System/TimeCreated/@SystemTime")
The creation time of the Event
The creation time of the Event
[ "The", "creation", "time", "of", "the", "Event" ]
def time_created(self): """The creation time of the Event""" return self.value("Event/System/TimeCreated/@SystemTime")
[ "def", "time_created", "(", "self", ")", ":", "return", "self", ".", "value", "(", "\"Event/System/TimeCreated/@SystemTime\"", ")" ]
https://github.com/hakril/PythonForWindows/blob/61e027a678d5b87aa64fcf8a37a6661a86236589/windows/winobject/event_log.py#L249-L251
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/pycryptodomex-3.9.7/lib/Cryptodome/Cipher/AES.py
python
new
(key, mode, *args, **kwargs)
return _create_cipher(sys.modules[__name__], key, mode, *args, **kwargs)
Create a new AES cipher. :param key: The secret key to use in the symmetric cipher. It must be 16, 24 or 32 bytes long (respectively for *AES-128*, *AES-192* or *AES-256*). For ``MODE_SIV`` only, it doubles to 32, 48, or 64 bytes. :type key: bytes/bytearray/memoryview :pa...
Create a new AES cipher.
[ "Create", "a", "new", "AES", "cipher", "." ]
def new(key, mode, *args, **kwargs): """Create a new AES cipher. :param key: The secret key to use in the symmetric cipher. It must be 16, 24 or 32 bytes long (respectively for *AES-128*, *AES-192* or *AES-256*). For ``MODE_SIV`` only, it doubles to 32, 48, or 64 bytes. :t...
[ "def", "new", "(", "key", ",", "mode", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "\"add_aes_modes\"", "]", "=", "True", "return", "_create_cipher", "(", "sys", ".", "modules", "[", "__name__", "]", ",", "key", ",", "mode", ...
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/pycryptodomex-3.9.7/lib/Cryptodome/Cipher/AES.py#L130-L232
microsoft/nni
31f11f51249660930824e888af0d4e022823285c
nni/algorithms/hpo/networkmorphism_tuner/graph.py
python
Graph.extract_descriptor
(self)
return ret
Extract the the description of the Graph as an instance of NetworkDescriptor.
Extract the the description of the Graph as an instance of NetworkDescriptor.
[ "Extract", "the", "the", "description", "of", "the", "Graph", "as", "an", "instance", "of", "NetworkDescriptor", "." ]
def extract_descriptor(self): """Extract the the description of the Graph as an instance of NetworkDescriptor.""" main_chain = self.get_main_chain() index_in_main_chain = {} for index, u in enumerate(main_chain): index_in_main_chain[u] = index ret = NetworkDescriptor...
[ "def", "extract_descriptor", "(", "self", ")", ":", "main_chain", "=", "self", ".", "get_main_chain", "(", ")", "index_in_main_chain", "=", "{", "}", "for", "index", ",", "u", "in", "enumerate", "(", "main_chain", ")", ":", "index_in_main_chain", "[", "u", ...
https://github.com/microsoft/nni/blob/31f11f51249660930824e888af0d4e022823285c/nni/algorithms/hpo/networkmorphism_tuner/graph.py#L581-L628
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/astropy-4.0-py3.7-macosx-10.9-x86_64.egg/astropy/io/votable/tree.py
python
Table.format
(self)
return self._format
[*required*] The serialization format of the table. Must be one of: 'tabledata' (TABLEDATA_), 'binary' (BINARY_), 'binary2' (BINARY2_) 'fits' (FITS_). Note that the 'fits' format, since it requires an external file, can not be written out. Any file read in with 'fits' ...
[*required*] The serialization format of the table. Must be one of:
[ "[", "*", "required", "*", "]", "The", "serialization", "format", "of", "the", "table", ".", "Must", "be", "one", "of", ":" ]
def format(self): """ [*required*] The serialization format of the table. Must be one of: 'tabledata' (TABLEDATA_), 'binary' (BINARY_), 'binary2' (BINARY2_) 'fits' (FITS_). Note that the 'fits' format, since it requires an external file, can not be written ...
[ "def", "format", "(", "self", ")", ":", "return", "self", ".", "_format" ]
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/io/votable/tree.py#L2227-L2241
khanhnamle1994/natural-language-processing
01d450d5ac002b0156ef4cf93a07cb508c1bcdc5
assignment1/.env/lib/python2.7/site-packages/scipy/signal/filter_design.py
python
band_stop_obj
(wp, ind, passb, stopb, gpass, gstop, type)
return n
Band Stop Objective Function for order minimization. Returns the non-integer order for an analog band stop filter. Parameters ---------- wp : scalar Edge of passband `passb`. ind : int, {0, 1} Index specifying which `passb` edge to vary (0 or 1). passb : ndarray Two ele...
Band Stop Objective Function for order minimization.
[ "Band", "Stop", "Objective", "Function", "for", "order", "minimization", "." ]
def band_stop_obj(wp, ind, passb, stopb, gpass, gstop, type): """ Band Stop Objective Function for order minimization. Returns the non-integer order for an analog band stop filter. Parameters ---------- wp : scalar Edge of passband `passb`. ind : int, {0, 1} Index specifyin...
[ "def", "band_stop_obj", "(", "wp", ",", "ind", ",", "passb", ",", "stopb", ",", "gpass", ",", "gstop", ",", "type", ")", ":", "passbC", "=", "passb", ".", "copy", "(", ")", "passbC", "[", "ind", "]", "=", "wp", "nat", "=", "(", "stopb", "*", "(...
https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/scipy/signal/filter_design.py#L1558-L1611
PySimpleGUI/PySimpleGUI
6c0d1fb54f493d45e90180b322fbbe70f7a5af3c
DemoPrograms/Demo_Matplotlib_Image_Elem_Spetrogram_Animated.py
python
draw_figure
(element, figure)
Draws the previously created "figure" in the supplied Image Element :param element: an Image Element :param figure: a Matplotlib figure :return: The figure canvas
Draws the previously created "figure" in the supplied Image Element
[ "Draws", "the", "previously", "created", "figure", "in", "the", "supplied", "Image", "Element" ]
def draw_figure(element, figure): """ Draws the previously created "figure" in the supplied Image Element :param element: an Image Element :param figure: a Matplotlib figure :return: The figure canvas """ plt.close('all') # erases previously drawn plots canv = FigureCanvasAgg(figure) ...
[ "def", "draw_figure", "(", "element", ",", "figure", ")", ":", "plt", ".", "close", "(", "'all'", ")", "# erases previously drawn plots", "canv", "=", "FigureCanvasAgg", "(", "figure", ")", "buf", "=", "io", ".", "BytesIO", "(", ")", "canv", ".", "print_fi...
https://github.com/PySimpleGUI/PySimpleGUI/blob/6c0d1fb54f493d45e90180b322fbbe70f7a5af3c/DemoPrograms/Demo_Matplotlib_Image_Elem_Spetrogram_Animated.py#L90-L108
JacquesLucke/animation_nodes
b1e3ace8dcb0a771fd882fc3ac4e490b009fa0d1
animation_nodes/nodes/text/text_file_reader.py
python
TextFileReaderNode.create
(self)
[]
def create(self): self.newInput("Text", "Path", "path", showFileChooser = True) self.newInput("Text", "Encoding", "encoding", value = "ascii") self.newOutput("Text", "Text", "text")
[ "def", "create", "(", "self", ")", ":", "self", ".", "newInput", "(", "\"Text\"", ",", "\"Path\"", ",", "\"path\"", ",", "showFileChooser", "=", "True", ")", "self", ".", "newInput", "(", "\"Text\"", ",", "\"Encoding\"", ",", "\"encoding\"", ",", "value", ...
https://github.com/JacquesLucke/animation_nodes/blob/b1e3ace8dcb0a771fd882fc3ac4e490b009fa0d1/animation_nodes/nodes/text/text_file_reader.py#L17-L20
facebookresearch/demucs
7317db81a34349e028ec943b199c9b9cdda47a12
demucs/wav.py
python
build_metadata
(path, sources, normalize=True, ext=EXT)
return meta
Build the metadata for `Wavset`. Args: path (str or Path): path to dataset. sources (list[str]): list of sources to look for. normalize (bool): if True, loads full track and store normalization values based on the mixture file. ext (str): extension of audio files (defaul...
Build the metadata for `Wavset`.
[ "Build", "the", "metadata", "for", "Wavset", "." ]
def build_metadata(path, sources, normalize=True, ext=EXT): """ Build the metadata for `Wavset`. Args: path (str or Path): path to dataset. sources (list[str]): list of sources to look for. normalize (bool): if True, loads full track and store normalization values based ...
[ "def", "build_metadata", "(", "path", ",", "sources", ",", "normalize", "=", "True", ",", "ext", "=", "EXT", ")", ":", "meta", "=", "{", "}", "path", "=", "Path", "(", "path", ")", "pendings", "=", "[", "]", "from", "concurrent", ".", "futures", "i...
https://github.com/facebookresearch/demucs/blob/7317db81a34349e028ec943b199c9b9cdda47a12/demucs/wav.py#L67-L93
apple/ccs-calendarserver
13c706b985fb728b9aab42dc0fef85aae21921c3
calendarserver/tools/dashview.py
python
safeDivision
(value, total, factor=1)
return value * factor / total if total else 0
[]
def safeDivision(value, total, factor=1): return value * factor / total if total else 0
[ "def", "safeDivision", "(", "value", ",", "total", ",", "factor", "=", "1", ")", ":", "return", "value", "*", "factor", "/", "total", "if", "total", "else", "0" ]
https://github.com/apple/ccs-calendarserver/blob/13c706b985fb728b9aab42dc0fef85aae21921c3/calendarserver/tools/dashview.py#L113-L114
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/scf/v20180416/scf_client.py
python
ScfClient.GetAsyncEventStatus
(self, request)
获取函数异步执行事件状态,事件状态保留 3 * 24 小时(从事件完成开始计时)。 :param request: Request instance for GetAsyncEventStatus. :type request: :class:`tencentcloud.scf.v20180416.models.GetAsyncEventStatusRequest` :rtype: :class:`tencentcloud.scf.v20180416.models.GetAsyncEventStatusResponse`
获取函数异步执行事件状态,事件状态保留 3 * 24 小时(从事件完成开始计时)。
[ "获取函数异步执行事件状态,事件状态保留", "3", "*", "24", "小时(从事件完成开始计时)。" ]
def GetAsyncEventStatus(self, request): """获取函数异步执行事件状态,事件状态保留 3 * 24 小时(从事件完成开始计时)。 :param request: Request instance for GetAsyncEventStatus. :type request: :class:`tencentcloud.scf.v20180416.models.GetAsyncEventStatusRequest` :rtype: :class:`tencentcloud.scf.v20180416.models.GetAsyncE...
[ "def", "GetAsyncEventStatus", "(", "self", ",", "request", ")", ":", "try", ":", "params", "=", "request", ".", "_serialize", "(", ")", "body", "=", "self", ".", "call", "(", "\"GetAsyncEventStatus\"", ",", "params", ")", "response", "=", "json", ".", "l...
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/scf/v20180416/scf_client.py#L428-L453
pyansys/pymapdl
c07291fc062b359abf0e92b95a92d753a95ef3d7
ansys/mapdl/core/_commands/preproc/status.py
python
Status.areas
(self, **kwargs)
return self.run(command, **kwargs)
Specifies "Areas" as the subsequent status topic. APDL Command: AREAS Notes ----- This is a status [STAT] topic command. Status topic commands are generated by the GUI and will appear in the log file (Jobname.LOG) if status is requested for some items under Utility Men...
Specifies "Areas" as the subsequent status topic.
[ "Specifies", "Areas", "as", "the", "subsequent", "status", "topic", "." ]
def areas(self, **kwargs): """Specifies "Areas" as the subsequent status topic. APDL Command: AREAS Notes ----- This is a status [STAT] topic command. Status topic commands are generated by the GUI and will appear in the log file (Jobname.LOG) if status is requ...
[ "def", "areas", "(", "self", ",", "*", "*", "kwargs", ")", ":", "command", "=", "f\"AREAS,\"", "return", "self", ".", "run", "(", "command", ",", "*", "*", "kwargs", ")" ]
https://github.com/pyansys/pymapdl/blob/c07291fc062b359abf0e92b95a92d753a95ef3d7/ansys/mapdl/core/_commands/preproc/status.py#L5-L22
oilshell/oil
94388e7d44a9ad879b12615f6203b38596b5a2d3
Python-2.7.13/Lib/lib-tk/ttk.py
python
Widget.identify
(self, x, y)
return self.tk.call(self._w, "identify", x, y)
Returns the name of the element at position x, y, or the empty string if the point does not lie within any element. x and y are pixel coordinates relative to the widget.
Returns the name of the element at position x, y, or the empty string if the point does not lie within any element.
[ "Returns", "the", "name", "of", "the", "element", "at", "position", "x", "y", "or", "the", "empty", "string", "if", "the", "point", "does", "not", "lie", "within", "any", "element", "." ]
def identify(self, x, y): """Returns the name of the element at position x, y, or the empty string if the point does not lie within any element. x and y are pixel coordinates relative to the widget.""" return self.tk.call(self._w, "identify", x, y)
[ "def", "identify", "(", "self", ",", "x", ",", "y", ")", ":", "return", "self", ".", "tk", ".", "call", "(", "self", ".", "_w", ",", "\"identify\"", ",", "x", ",", "y", ")" ]
https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/lib-tk/ttk.py#L558-L563
ptone/jiffylab
c98e4ed260efe680bce2d671d92d4652dfdecd88
webapp/app.py
python
slugify
(text, delim=u'-')
return unicode(delim.join(result))
Generates a slightly worse ASCII-only slug.
Generates a slightly worse ASCII-only slug.
[ "Generates", "a", "slightly", "worse", "ASCII", "-", "only", "slug", "." ]
def slugify(text, delim=u'-'): """Generates a slightly worse ASCII-only slug.""" result = [] for word in _punct_re.split(text.lower()): word = normalize('NFKD', word).encode('ascii', 'ignore') if word: result.append(word) return unicode(delim.join(result))
[ "def", "slugify", "(", "text", ",", "delim", "=", "u'-'", ")", ":", "result", "=", "[", "]", "for", "word", "in", "_punct_re", ".", "split", "(", "text", ".", "lower", "(", ")", ")", ":", "word", "=", "normalize", "(", "'NFKD'", ",", "word", ")",...
https://github.com/ptone/jiffylab/blob/c98e4ed260efe680bce2d671d92d4652dfdecd88/webapp/app.py#L72-L79
pyrocko/pyrocko
b6baefb7540fb7fce6ed9b856ec0c413961a4320
src/trace.py
python
Trace.mult
(self, other, interpolate=True)
Muliply with values of other trace ``(self *= other)``. Multiply values of ``other`` trace to the values of ``self``, where it intersects with ``other``. This method does not change the extent of ``self``. If ``interpolate`` is ``True`` (the default), the values of ``other`` to be mult...
Muliply with values of other trace ``(self *= other)``.
[ "Muliply", "with", "values", "of", "other", "trace", "(", "self", "*", "=", "other", ")", "." ]
def mult(self, other, interpolate=True): ''' Muliply with values of other trace ``(self *= other)``. Multiply values of ``other`` trace to the values of ``self``, where it intersects with ``other``. This method does not change the extent of ``self``. If ``interpolate`` is ``Tru...
[ "def", "mult", "(", "self", ",", "other", ",", "interpolate", "=", "True", ")", ":", "if", "interpolate", ":", "assert", "self", ".", "deltat", "<=", "other", ".", "deltat", "or", "same_sampling_rate", "(", "self", ",", "other", ")", "other_xdata", "=", ...
https://github.com/pyrocko/pyrocko/blob/b6baefb7540fb7fce6ed9b856ec0c413961a4320/src/trace.py#L289-L323
hzy46/Deep-Learning-21-Examples
15c2d9edccad090cd67b033f24a43c544e5cba3e
chapter_5/research/object_detection/core/preprocessor.py
python
random_adjust_contrast
(image, min_delta=0.8, max_delta=1.25)
Randomly adjusts contrast. Makes sure the output image is still between 0 and 1. Args: image: rank 3 float32 tensor contains 1 image -> [height, width, channels] with pixel values varying between [0, 1]. min_delta: see max_delta. max_delta: how much to change the contrast. Contrast will cha...
Randomly adjusts contrast.
[ "Randomly", "adjusts", "contrast", "." ]
def random_adjust_contrast(image, min_delta=0.8, max_delta=1.25): """Randomly adjusts contrast. Makes sure the output image is still between 0 and 1. Args: image: rank 3 float32 tensor contains 1 image -> [height, width, channels] with pixel values varying between [0, 1]. min_delta: see max_d...
[ "def", "random_adjust_contrast", "(", "image", ",", "min_delta", "=", "0.8", ",", "max_delta", "=", "1.25", ")", ":", "with", "tf", ".", "name_scope", "(", "'RandomAdjustContrast'", ",", "values", "=", "[", "image", "]", ")", ":", "image", "=", "tf", "."...
https://github.com/hzy46/Deep-Learning-21-Examples/blob/15c2d9edccad090cd67b033f24a43c544e5cba3e/chapter_5/research/object_detection/core/preprocessor.py#L451-L470
DinoTools/dionaea
4e459f1b672a5b4c1e8335c0bff1b93738019215
modules/python/dionaea/__init__.py
python
SubTimer.cancel
(self)
Stop the timer if it hasn't finished yet.
Stop the timer if it hasn't finished yet.
[ "Stop", "the", "timer", "if", "it", "hasn", "t", "finished", "yet", "." ]
def cancel(self): """Stop the timer if it hasn't finished yet.""" self.finished.set()
[ "def", "cancel", "(", "self", ")", ":", "self", ".", "finished", ".", "set", "(", ")" ]
https://github.com/DinoTools/dionaea/blob/4e459f1b672a5b4c1e8335c0bff1b93738019215/modules/python/dionaea/__init__.py#L80-L82
thu-ml/tianshou
a2d76d1276bef334bba537a355a5ea12f4279410
tianshou/exploration/random.py
python
BaseNoise.__call__
(self, size: Sequence[int])
Generate new noise.
Generate new noise.
[ "Generate", "new", "noise", "." ]
def __call__(self, size: Sequence[int]) -> np.ndarray: """Generate new noise.""" raise NotImplementedError
[ "def", "__call__", "(", "self", ",", "size", ":", "Sequence", "[", "int", "]", ")", "->", "np", ".", "ndarray", ":", "raise", "NotImplementedError" ]
https://github.com/thu-ml/tianshou/blob/a2d76d1276bef334bba537a355a5ea12f4279410/tianshou/exploration/random.py#L18-L20
tensorflow/tfx
b4a6b83269815ed12ba9df9e9154c7376fef2ea0
tfx/types/artifact.py
python
Artifact.__getattr__
(self, name: str)
Custom __getattr__ to allow access to artifact properties.
Custom __getattr__ to allow access to artifact properties.
[ "Custom", "__getattr__", "to", "allow", "access", "to", "artifact", "properties", "." ]
def __getattr__(self, name: str) -> Any: """Custom __getattr__ to allow access to artifact properties.""" if name == '_artifact_type': # Prevent infinite recursion when used with copy.deepcopy(). raise AttributeError() if name not in self._artifact_type.properties: raise AttributeError('Ar...
[ "def", "__getattr__", "(", "self", ",", "name", ":", "str", ")", "->", "Any", ":", "if", "name", "==", "'_artifact_type'", ":", "# Prevent infinite recursion when used with copy.deepcopy().", "raise", "AttributeError", "(", ")", "if", "name", "not", "in", "self", ...
https://github.com/tensorflow/tfx/blob/b4a6b83269815ed12ba9df9e9154c7376fef2ea0/tfx/types/artifact.py#L265-L303
mrJean1/PyGeodesy
7da5ca71aa3edb7bc49e219e0b8190686e1a7965
pygeodesy/latlonBase.py
python
LatLonBase.lat
(self, lat)
Set the latitude. @arg lat: New latitude (C{str[N|S]} or C{degrees}). @raise ValueError: Invalid B{C{lat}}.
Set the latitude.
[ "Set", "the", "latitude", "." ]
def lat(self, lat): '''Set the latitude. @arg lat: New latitude (C{str[N|S]} or C{degrees}). @raise ValueError: Invalid B{C{lat}}. ''' lat = Lat(lat) # parseDMS(lat, suffix=_NS_, clip=90) self._update(lat != self._lat) self._lat = lat
[ "def", "lat", "(", "self", ",", "lat", ")", ":", "lat", "=", "Lat", "(", "lat", ")", "# parseDMS(lat, suffix=_NS_, clip=90)", "self", ".", "_update", "(", "lat", "!=", "self", ".", "_lat", ")", "self", ".", "_lat", "=", "lat" ]
https://github.com/mrJean1/PyGeodesy/blob/7da5ca71aa3edb7bc49e219e0b8190686e1a7965/pygeodesy/latlonBase.py#L759-L768
RasaHQ/rasa
54823b68c1297849ba7ae841a4246193cd1223a1
rasa/nlu/featurizers/featurizer.py
python
Featurizer.get_default_config
()
return {FEATURIZER_CLASS_ALIAS: None}
Returns the component's default config.
Returns the component's default config.
[ "Returns", "the", "component", "s", "default", "config", "." ]
def get_default_config() -> Dict[Text, Any]: """Returns the component's default config.""" return {FEATURIZER_CLASS_ALIAS: None}
[ "def", "get_default_config", "(", ")", "->", "Dict", "[", "Text", ",", "Any", "]", ":", "return", "{", "FEATURIZER_CLASS_ALIAS", ":", "None", "}" ]
https://github.com/RasaHQ/rasa/blob/54823b68c1297849ba7ae841a4246193cd1223a1/rasa/nlu/featurizers/featurizer.py#L19-L21
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/Jinja2/jinja2/ext.py
python
InternationalizationExtension.parse
(self, parser)
Parse a translatable tag.
Parse a translatable tag.
[ "Parse", "a", "translatable", "tag", "." ]
def parse(self, parser): """Parse a translatable tag.""" lineno = next(parser.stream).lineno num_called_num = False # find all the variables referenced. Additionally a variable can be # defined in the body of the trans block too, but this is checked at # a later state. ...
[ "def", "parse", "(", "self", ",", "parser", ")", ":", "lineno", "=", "next", "(", "parser", ".", "stream", ")", ".", "lineno", "num_called_num", "=", "False", "# find all the variables referenced. Additionally a variable can be", "# defined in the body of the trans block...
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/Jinja2/jinja2/ext.py#L215-L307
fedora-infra/anitya
cc01878ac023790646a76eb4cbef45d639e2372c
anitya/db/models.py
python
Run.last_entry
(cls, session)
return query.first()
Return the last log about the cron run.
Return the last log about the cron run.
[ "Return", "the", "last", "log", "about", "the", "cron", "run", "." ]
def last_entry(cls, session): """Return the last log about the cron run.""" query = session.query(cls).order_by(cls.created_on.desc()) return query.first()
[ "def", "last_entry", "(", "cls", ",", "session", ")", ":", "query", "=", "session", ".", "query", "(", "cls", ")", ".", "order_by", "(", "cls", ".", "created_on", ".", "desc", "(", ")", ")", "return", "query", ".", "first", "(", ")" ]
https://github.com/fedora-infra/anitya/blob/cc01878ac023790646a76eb4cbef45d639e2372c/anitya/db/models.py#L809-L813
huggingface/transformers
623b4f7c63f60cce917677ee704d6c93ee960b4b
src/transformers/generation_utils.py
python
GenerationMixin._update_model_kwargs_for_generation
( outputs: ModelOutput, model_kwargs: Dict[str, Any], is_encoder_decoder: bool = False )
return model_kwargs
[]
def _update_model_kwargs_for_generation( outputs: ModelOutput, model_kwargs: Dict[str, Any], is_encoder_decoder: bool = False ) -> Dict[str, Any]: # update past if "past_key_values" in outputs: model_kwargs["past"] = outputs.past_key_values elif "mems" in outputs: ...
[ "def", "_update_model_kwargs_for_generation", "(", "outputs", ":", "ModelOutput", ",", "model_kwargs", ":", "Dict", "[", "str", ",", "Any", "]", ",", "is_encoder_decoder", ":", "bool", "=", "False", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "# u...
https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/generation_utils.py#L572-L598
oilshell/oil
94388e7d44a9ad879b12615f6203b38596b5a2d3
Python-2.7.13/Lib/bdb.py
python
Bdb.get_file_breaks
(self, filename)
[]
def get_file_breaks(self, filename): filename = self.canonic(filename) if filename in self.breaks: return self.breaks[filename] else: return []
[ "def", "get_file_breaks", "(", "self", ",", "filename", ")", ":", "filename", "=", "self", ".", "canonic", "(", "filename", ")", "if", "filename", "in", "self", ".", "breaks", ":", "return", "self", ".", "breaks", "[", "filename", "]", "else", ":", "re...
https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/bdb.py#L328-L333
django/django
0a17666045de6739ae1c2ac695041823d5f827f7
django/contrib/admin/widgets.py
python
AutocompleteMixin.build_attrs
(self, base_attrs, extra_attrs=None)
return attrs
Set select2's AJAX attributes. Attributes can be set using the html5 data attribute. Nested attributes require a double dash as per https://select2.org/configuration/data-attributes#nested-subkey-options
Set select2's AJAX attributes.
[ "Set", "select2", "s", "AJAX", "attributes", "." ]
def build_attrs(self, base_attrs, extra_attrs=None): """ Set select2's AJAX attributes. Attributes can be set using the html5 data attribute. Nested attributes require a double dash as per https://select2.org/configuration/data-attributes#nested-subkey-options """ ...
[ "def", "build_attrs", "(", "self", ",", "base_attrs", ",", "extra_attrs", "=", "None", ")", ":", "attrs", "=", "super", "(", ")", ".", "build_attrs", "(", "base_attrs", ",", "extra_attrs", "=", "extra_attrs", ")", "attrs", ".", "setdefault", "(", "'class'"...
https://github.com/django/django/blob/0a17666045de6739ae1c2ac695041823d5f827f7/django/contrib/admin/widgets.py#L399-L423
odlgroup/odl
0b088df8dc4621c68b9414c3deff9127f4c4f11d
odl/operator/pspace_ops.py
python
DiagonalOperator.derivative
(self, point)
return DiagonalOperator(*derivs, domain=self.domain, range=self.range)
Derivative of this operator. For example, if A and B are operators [[A, 0], [0, B]] The derivative is given by: [[A', 0], [0, B']] This is only well defined if each sub-operator has a derivative Parameters ---------- ...
Derivative of this operator.
[ "Derivative", "of", "this", "operator", "." ]
def derivative(self, point): """Derivative of this operator. For example, if A and B are operators [[A, 0], [0, B]] The derivative is given by: [[A', 0], [0, B']] This is only well defined if each sub-operator has a derivative ...
[ "def", "derivative", "(", "self", ",", "point", ")", ":", "point", "=", "self", ".", "domain", ".", "element", "(", "point", ")", "derivs", "=", "[", "op", ".", "derivative", "(", "p", ")", "for", "op", ",", "p", "in", "zip", "(", "self", ".", ...
https://github.com/odlgroup/odl/blob/0b088df8dc4621c68b9414c3deff9127f4c4f11d/odl/operator/pspace_ops.py#L1171-L1204
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_vendored_deps/library/oc_adm_router.py
python
DeploymentConfig.get_replicas
(self)
return self.get(DeploymentConfig.replicas_path)
return replicas setting
return replicas setting
[ "return", "replicas", "setting" ]
def get_replicas(self): ''' return replicas setting ''' return self.get(DeploymentConfig.replicas_path)
[ "def", "get_replicas", "(", "self", ")", ":", "return", "self", ".", "get", "(", "DeploymentConfig", ".", "replicas_path", ")" ]
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_vendored_deps/library/oc_adm_router.py#L1999-L2001
tristandeleu/pytorch-meta
d55d89ebd47f340180267106bde3e4b723f23762
torchmeta/datasets/utils.py
python
download_file_from_google_drive
(file_id, root, filename=None, md5=None)
Download a Google Drive file from and place it in root. Args: file_id (str): id of file to be downloaded root (str): Directory to place downloaded file in filename (str, optional): Name to save the file under. If None, use the id of the file. md5 (str, optional): MD5 checksum of th...
Download a Google Drive file from and place it in root.
[ "Download", "a", "Google", "Drive", "file", "from", "and", "place", "it", "in", "root", "." ]
def download_file_from_google_drive(file_id, root, filename=None, md5=None): """Download a Google Drive file from and place it in root. Args: file_id (str): id of file to be downloaded root (str): Directory to place downloaded file in filename (str, optional): Name to save the file und...
[ "def", "download_file_from_google_drive", "(", "file_id", ",", "root", ",", "filename", "=", "None", ",", "md5", "=", "None", ")", ":", "# Based on https://stackoverflow.com/questions/38511444/python-download-files-from-google-drive-using-url", "import", "requests", "url", "=...
https://github.com/tristandeleu/pytorch-meta/blob/d55d89ebd47f340180267106bde3e4b723f23762/torchmeta/datasets/utils.py#L47-L87
pypr/pysph
9cb9a859934939307c65a25cbf73e4ecc83fea4a
pysph/tools/ipy_viewer.py
python
Viewer1D._configure_plot
(self)
Set attributes for plotting.
Set attributes for plotting.
[ "Set", "attributes", "for", "plotting", "." ]
def _configure_plot(self): ''' Set attributes for plotting. ''' self.figure, temp = plt.subplots() self.add_axes = False self._scatters_ax = {'host': temp} self._scatters = {} self._solver_time_ax = {} self.figure.show()
[ "def", "_configure_plot", "(", "self", ")", ":", "self", ".", "figure", ",", "temp", "=", "plt", ".", "subplots", "(", ")", "self", ".", "add_axes", "=", "False", "self", ".", "_scatters_ax", "=", "{", "'host'", ":", "temp", "}", "self", ".", "_scatt...
https://github.com/pypr/pysph/blob/9cb9a859934939307c65a25cbf73e4ecc83fea4a/pysph/tools/ipy_viewer.py#L799-L811
onnx/onnx-coreml
141fc33d7217674ea8bda36494fa8089a543a3f3
onnx_coreml/_operators_nd.py
python
_convert_acos
(builder, node, graph, err)
convert to CoreML Acos Layer: https://github.com/apple/coremltools/blob/655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492/mlmodel/format/NeuralNetwork.proto#L3793
convert to CoreML Acos Layer: https://github.com/apple/coremltools/blob/655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492/mlmodel/format/NeuralNetwork.proto#L3793
[ "convert", "to", "CoreML", "Acos", "Layer", ":", "https", ":", "//", "github", ".", "com", "/", "apple", "/", "coremltools", "/", "blob", "/", "655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492", "/", "mlmodel", "/", "format", "/", "NeuralNetwork", ".", "proto#L3793" ]
def _convert_acos(builder, node, graph, err): ''' convert to CoreML Acos Layer: https://github.com/apple/coremltools/blob/655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492/mlmodel/format/NeuralNetwork.proto#L3793 ''' load_input_constants(builder, node, graph, err) builder.add_acos( name=node.name...
[ "def", "_convert_acos", "(", "builder", ",", "node", ",", "graph", ",", "err", ")", ":", "load_input_constants", "(", "builder", ",", "node", ",", "graph", ",", "err", ")", "builder", ".", "add_acos", "(", "name", "=", "node", ".", "name", ",", "input_...
https://github.com/onnx/onnx-coreml/blob/141fc33d7217674ea8bda36494fa8089a543a3f3/onnx_coreml/_operators_nd.py#L181-L191
dongrixinyu/JioNLP
2c5b11439915891f0f24955b7de4f637f38a4b44
jionlp/rule/extractor.py
python
Extractor.extract_email
(self, text, detail=False)
提取文本中的 E-mail Args: text(str): 字符串文本 detail(bool): 是否携带 offset (E-mail 在文本中的位置信息) Returns: list: email列表
提取文本中的 E-mail
[ "提取文本中的", "E", "-", "mail" ]
def extract_email(self, text, detail=False): """ 提取文本中的 E-mail Args: text(str): 字符串文本 detail(bool): 是否携带 offset (E-mail 在文本中的位置信息) Returns: list: email列表 """ if self.email_pattern is None: self.email_pattern = re.compile(EMAIL_PA...
[ "def", "extract_email", "(", "self", ",", "text", ",", "detail", "=", "False", ")", ":", "if", "self", ".", "email_pattern", "is", "None", ":", "self", ".", "email_pattern", "=", "re", ".", "compile", "(", "EMAIL_PATTERN", ")", "text", "=", "''", ".", ...
https://github.com/dongrixinyu/JioNLP/blob/2c5b11439915891f0f24955b7de4f637f38a4b44/jionlp/rule/extractor.py#L145-L174
orendv/learning_to_sample
99e977e1c53ec0fa8b2b8a5151a56d0d088f6f78
reconstruction/src/in_out.py
python
PointCloudDataSet.__init__
(self, point_clouds, noise=None, labels=None, copy=True, init_shuffle=True)
Construct a DataSet. Args: init_shuffle, shuffle data before first epoch has been reached. Output: original_pclouds, labels, (None or Feed) # TODO Rename
Construct a DataSet. Args: init_shuffle, shuffle data before first epoch has been reached. Output: original_pclouds, labels, (None or Feed) # TODO Rename
[ "Construct", "a", "DataSet", ".", "Args", ":", "init_shuffle", "shuffle", "data", "before", "first", "epoch", "has", "been", "reached", ".", "Output", ":", "original_pclouds", "labels", "(", "None", "or", "Feed", ")", "#", "TODO", "Rename" ]
def __init__(self, point_clouds, noise=None, labels=None, copy=True, init_shuffle=True): '''Construct a DataSet. Args: init_shuffle, shuffle data before first epoch has been reached. Output: original_pclouds, labels, (None or Feed) # TODO Rename ''' self....
[ "def", "__init__", "(", "self", ",", "point_clouds", ",", "noise", "=", "None", ",", "labels", "=", "None", ",", "copy", "=", "True", ",", "init_shuffle", "=", "True", ")", ":", "self", ".", "num_examples", "=", "point_clouds", ".", "shape", "[", "0", ...
https://github.com/orendv/learning_to_sample/blob/99e977e1c53ec0fa8b2b8a5151a56d0d088f6f78/reconstruction/src/in_out.py#L189-L227
IBM/pytorchpipe
9cb17271666061cb19fe24197ecd5e4c8d32c5da
ptp/configuration/config_registry.py
python
ConfigRegistry.del_config_params
(self, keypath: list)
Removes an entry from the `config` parameter dict of the current :py:class:`ConfigRegistry`, \ and update the resulting parameters dict. The entry can either be a subtree or a leaf of the `config` parameter dict. :param keypath: list of keys to subtree / leaf in the `config` parameter dict. ...
Removes an entry from the `config` parameter dict of the current :py:class:`ConfigRegistry`, \ and update the resulting parameters dict.
[ "Removes", "an", "entry", "from", "the", "config", "parameter", "dict", "of", "the", "current", ":", "py", ":", "class", ":", "ConfigRegistry", "\\", "and", "update", "the", "resulting", "parameters", "dict", "." ]
def del_config_params(self, keypath: list): """ Removes an entry from the `config` parameter dict of the current :py:class:`ConfigRegistry`, \ and update the resulting parameters dict. The entry can either be a subtree or a leaf of the `config` parameter dict. :param keypath: l...
[ "def", "del_config_params", "(", "self", ",", "keypath", ":", "list", ")", ":", "self", ".", "delete_subtree", "(", "self", ".", "_superseding_config_params", ",", "keypath", ")", "self", ".", "_update_params", "(", ")" ]
https://github.com/IBM/pytorchpipe/blob/9cb17271666061cb19fe24197ecd5e4c8d32c5da/ptp/configuration/config_registry.py#L148-L160
python-babel/flask-babel
ec7ae9ed2e22c7aebd4e732c1c3dc6d45fe8db76
flask_babel/__init__.py
python
format_timedelta
(datetime_or_timedelta, granularity='second', add_direction=False, threshold=0.85)
return dates.format_timedelta( datetime_or_timedelta, granularity, threshold=threshold, add_direction=add_direction, locale=get_locale() )
Format the elapsed time from the given date to now or the given timedelta. This function is also available in the template context as filter named `timedeltaformat`.
Format the elapsed time from the given date to now or the given timedelta.
[ "Format", "the", "elapsed", "time", "from", "the", "given", "date", "to", "now", "or", "the", "given", "timedelta", "." ]
def format_timedelta(datetime_or_timedelta, granularity='second', add_direction=False, threshold=0.85): """Format the elapsed time from the given date to now or the given timedelta. This function is also available in the template context as filter named `timedeltaformat`. """ ...
[ "def", "format_timedelta", "(", "datetime_or_timedelta", ",", "granularity", "=", "'second'", ",", "add_direction", "=", "False", ",", "threshold", "=", "0.85", ")", ":", "if", "isinstance", "(", "datetime_or_timedelta", ",", "datetime", ")", ":", "datetime_or_tim...
https://github.com/python-babel/flask-babel/blob/ec7ae9ed2e22c7aebd4e732c1c3dc6d45fe8db76/flask_babel/__init__.py#L411-L427
devbisme/KiPart
3e5d9ae927ea27fb29998ee8d613fdc26a019243
kipart/kipart.py
python
do_bundling
(pin_data, bundle, fuzzy_match)
Handle bundling for power pins. Unbundle everything else.
Handle bundling for power pins. Unbundle everything else.
[ "Handle", "bundling", "for", "power", "pins", ".", "Unbundle", "everything", "else", "." ]
def do_bundling(pin_data, bundle, fuzzy_match): """Handle bundling for power pins. Unbundle everything else.""" for unit in list(pin_data.values()): for side in list(unit.values()): for name, pins in list(side.items()): if len(pins) > 1: for index, p in en...
[ "def", "do_bundling", "(", "pin_data", ",", "bundle", ",", "fuzzy_match", ")", ":", "for", "unit", "in", "list", "(", "pin_data", ".", "values", "(", ")", ")", ":", "for", "side", "in", "list", "(", "unit", ".", "values", "(", ")", ")", ":", "for",...
https://github.com/devbisme/KiPart/blob/3e5d9ae927ea27fb29998ee8d613fdc26a019243/kipart/kipart.py#L767-L778
gnuradio/pybombs
17044241bf835b93571026b112f179f2db7448a4
pybombs/packagers/port.py
python
ExternalPort.update
(self, pkgname)
update package with 'port upgrade'
update package with 'port upgrade'
[ "update", "package", "with", "port", "upgrade" ]
def update(self, pkgname): """ update package with 'port upgrade' """ try: subproc.monitor_process(["port", "upgrade", pkgname], elevate=True, throw=True) return True except Exception as ex: self.log.error("Running port upgrade failed.") ...
[ "def", "update", "(", "self", ",", "pkgname", ")", ":", "try", ":", "subproc", ".", "monitor_process", "(", "[", "\"port\"", ",", "\"upgrade\"", ",", "pkgname", "]", ",", "elevate", "=", "True", ",", "throw", "=", "True", ")", "return", "True", "except...
https://github.com/gnuradio/pybombs/blob/17044241bf835b93571026b112f179f2db7448a4/pybombs/packagers/port.py#L83-L92
therne/dmn-tensorflow
c107d6c08e29cfad219bc1b9421f1bac56b72cc3
utils/nn.py
python
bias
(name, dim, initial_value=0.0)
return tf.get_variable(name, dims, initializer=tf.constant_initializer(initial_value))
Initializes bias parameter. :param name: Variable name :param dim: Tensor size (list or int) :param initial_value: Initial bias term :return: Variable
Initializes bias parameter. :param name: Variable name :param dim: Tensor size (list or int) :param initial_value: Initial bias term :return: Variable
[ "Initializes", "bias", "parameter", ".", ":", "param", "name", ":", "Variable", "name", ":", "param", "dim", ":", "Tensor", "size", "(", "list", "or", "int", ")", ":", "param", "initial_value", ":", "Initial", "bias", "term", ":", "return", ":", "Variabl...
def bias(name, dim, initial_value=0.0): """ Initializes bias parameter. :param name: Variable name :param dim: Tensor size (list or int) :param initial_value: Initial bias term :return: Variable """ dims = dim if isinstance(dim, list) else [dim] return tf.get_variable(name, dims, initial...
[ "def", "bias", "(", "name", ",", "dim", ",", "initial_value", "=", "0.0", ")", ":", "dims", "=", "dim", "if", "isinstance", "(", "dim", ",", "list", ")", "else", "[", "dim", "]", "return", "tf", ".", "get_variable", "(", "name", ",", "dims", ",", ...
https://github.com/therne/dmn-tensorflow/blob/c107d6c08e29cfad219bc1b9421f1bac56b72cc3/utils/nn.py#L44-L52
reviewboard/reviewboard
7395902e4c181bcd1d633f61105012ffb1d18e1b
reviewboard/datagrids/sidebar.py
python
Sidebar.__init__
(self, item_classes, default_view_id=None, css_classes=[])
Initialize the sidebar. Args: item_classes (list of type): The list of :py:class:`BaseSidebarItem` subclasses to include by default in the sidebar. default_view_id (unicode, optional): The default "view" of the datagrid to display. This c...
Initialize the sidebar.
[ "Initialize", "the", "sidebar", "." ]
def __init__(self, item_classes, default_view_id=None, css_classes=[]): """Initialize the sidebar. Args: item_classes (list of type): The list of :py:class:`BaseSidebarItem` subclasses to include by default in the sidebar. default_view_id (unicod...
[ "def", "__init__", "(", "self", ",", "item_classes", ",", "default_view_id", "=", "None", ",", "css_classes", "=", "[", "]", ")", ":", "self", ".", "_item_classes", "=", "[", "]", "self", ".", "css_classes", "=", "css_classes", "self", ".", "default_view_i...
https://github.com/reviewboard/reviewboard/blob/7395902e4c181bcd1d633f61105012ffb1d18e1b/reviewboard/datagrids/sidebar.py#L349-L369
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/networkx/algorithms/operators/all.py
python
intersection_all
(graphs)
return R
Returns a new graph that contains only the edges that exist in all graphs. All supplied graphs must have the same node set. Parameters ---------- graphs : list List of NetworkX graphs Returns ------- R : A new graph with the same type as the first graph in list Raises ...
Returns a new graph that contains only the edges that exist in all graphs.
[ "Returns", "a", "new", "graph", "that", "contains", "only", "the", "edges", "that", "exist", "in", "all", "graphs", "." ]
def intersection_all(graphs): """Returns a new graph that contains only the edges that exist in all graphs. All supplied graphs must have the same node set. Parameters ---------- graphs : list List of NetworkX graphs Returns ------- R : A new graph with the same type as the...
[ "def", "intersection_all", "(", "graphs", ")", ":", "if", "not", "graphs", ":", "raise", "ValueError", "(", "'cannot apply intersection_all to an empty list'", ")", "graphs", "=", "iter", "(", "graphs", ")", "R", "=", "next", "(", "graphs", ")", "for", "H", ...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/networkx/algorithms/operators/all.py#L145-L176
jkkummerfeld/text2sql-data
2905ab815b4893d99ea061a20fb55860ecb1f92e
systems/sequence-to-sequence/bin/tools/profile.py
python
param_analysis_options
(output_dir)
return "scope", options
Options for model parameter analysis
Options for model parameter analysis
[ "Options", "for", "model", "parameter", "analysis" ]
def param_analysis_options(output_dir): """Options for model parameter analysis """ options = model_analyzer.TRAINABLE_VARS_PARAMS_STAT_OPTIONS.copy() options["select"] = ["params", "bytes"] options["order_by"] = "params" options["account_type_regexes"] = ["Variable"] if output_dir: options["dump_to_f...
[ "def", "param_analysis_options", "(", "output_dir", ")", ":", "options", "=", "model_analyzer", ".", "TRAINABLE_VARS_PARAMS_STAT_OPTIONS", ".", "copy", "(", ")", "options", "[", "\"select\"", "]", "=", "[", "\"params\"", ",", "\"bytes\"", "]", "options", "[", "\...
https://github.com/jkkummerfeld/text2sql-data/blob/2905ab815b4893d99ea061a20fb55860ecb1f92e/systems/sequence-to-sequence/bin/tools/profile.py#L124-L133
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/modular/modform/element.py
python
Newform._atkin_lehner_eigenvalue_from_qexp
(self, Q)
return l
Return the arithmetically-normalized `W_Q`-pseudoeigenvalue of ``self``, using a formula based on `q`-expansions (Theorem 2.1 of [AL1978]_). INPUT: - ``self`` -- a newform `f` - ``Q`` -- an integer exactly dividing the level of ``self`` .. NOTE:: This met...
Return the arithmetically-normalized `W_Q`-pseudoeigenvalue of ``self``, using a formula based on `q`-expansions (Theorem 2.1 of [AL1978]_).
[ "Return", "the", "arithmetically", "-", "normalized", "W_Q", "-", "pseudoeigenvalue", "of", "self", "using", "a", "formula", "based", "on", "q", "-", "expansions", "(", "Theorem", "2", ".", "1", "of", "[", "AL1978", "]", "_", ")", "." ]
def _atkin_lehner_eigenvalue_from_qexp(self, Q): """ Return the arithmetically-normalized `W_Q`-pseudoeigenvalue of ``self``, using a formula based on `q`-expansions (Theorem 2.1 of [AL1978]_). INPUT: - ``self`` -- a newform `f` - ``Q`` -- an integer exactly di...
[ "def", "_atkin_lehner_eigenvalue_from_qexp", "(", "self", ",", "Q", ")", ":", "if", "Q", "==", "1", ":", "return", "ZZ", "(", "1", ")", "a_Q", "=", "self", "[", "Q", "]", "if", "not", "a_Q", ":", "raise", "ValueError", "(", "\"a_Q must be nonzero\"", "...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/modular/modform/element.py#L1740-L1788
indygreg/python-build-standalone
1dfe9d4186e37bd57c544b09402690e968a225be
pythonbuild/utils.py
python
add_licenses_to_extension_entry
(entry)
Add licenses keys to a ``extensions`` entry for JSON distribution info.
Add licenses keys to a ``extensions`` entry for JSON distribution info.
[ "Add", "licenses", "keys", "to", "a", "extensions", "entry", "for", "JSON", "distribution", "info", "." ]
def add_licenses_to_extension_entry(entry): """Add licenses keys to a ``extensions`` entry for JSON distribution info.""" have_licenses = False licenses = set() license_paths = set() license_public_domain = None have_local_link = False for link in entry["links"]: name = link["name...
[ "def", "add_licenses_to_extension_entry", "(", "entry", ")", ":", "have_licenses", "=", "False", "licenses", "=", "set", "(", ")", "license_paths", "=", "set", "(", ")", "license_public_domain", "=", "None", "have_local_link", "=", "False", "for", "link", "in", ...
https://github.com/indygreg/python-build-standalone/blob/1dfe9d4186e37bd57c544b09402690e968a225be/pythonbuild/utils.py#L435-L474
oilshell/oil
94388e7d44a9ad879b12615f6203b38596b5a2d3
Python-2.7.13/Lib/macpath.py
python
abspath
(path)
return normpath(path)
Return an absolute path.
Return an absolute path.
[ "Return", "an", "absolute", "path", "." ]
def abspath(path): """Return an absolute path.""" if not isabs(path): if isinstance(path, _unicode): cwd = os.getcwdu() else: cwd = os.getcwd() path = join(cwd, path) return normpath(path)
[ "def", "abspath", "(", "path", ")", ":", "if", "not", "isabs", "(", "path", ")", ":", "if", "isinstance", "(", "path", ",", "_unicode", ")", ":", "cwd", "=", "os", ".", "getcwdu", "(", ")", "else", ":", "cwd", "=", "os", ".", "getcwd", "(", ")"...
https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/macpath.py#L187-L195
GoogleCloudPlatform/gsutil
5be882803e76608e2fd29cf8c504ccd1fe0a7746
gslib/commands/autoclass.py
python
AutoclassCommand.RunCommand
(self)
Command entry point for the autoclass command.
Command entry point for the autoclass command.
[ "Command", "entry", "point", "for", "the", "autoclass", "command", "." ]
def RunCommand(self): """Command entry point for the autoclass command.""" action_subcommand = self.args[0] self.ParseSubOpts(check_args=True) if action_subcommand == 'get' or action_subcommand == 'set': metrics.LogCommandParams(sub_opts=self.sub_opts) metrics.LogCommandParams(subcommands=[...
[ "def", "RunCommand", "(", "self", ")", ":", "action_subcommand", "=", "self", ".", "args", "[", "0", "]", "self", ".", "ParseSubOpts", "(", "check_args", "=", "True", ")", "if", "action_subcommand", "==", "'get'", "or", "action_subcommand", "==", "'set'", ...
https://github.com/GoogleCloudPlatform/gsutil/blob/5be882803e76608e2fd29cf8c504ccd1fe0a7746/gslib/commands/autoclass.py#L186-L197
mesonbuild/meson
a22d0f9a0a787df70ce79b05d0c45de90a970048
mesonbuild/environment.py
python
Environment.get_static_lib_dir
(self)
return self.get_libdir()
Install dir for the static library
Install dir for the static library
[ "Install", "dir", "for", "the", "static", "library" ]
def get_static_lib_dir(self) -> str: "Install dir for the static library" return self.get_libdir()
[ "def", "get_static_lib_dir", "(", "self", ")", "->", "str", ":", "return", "self", ".", "get_libdir", "(", ")" ]
https://github.com/mesonbuild/meson/blob/a22d0f9a0a787df70ce79b05d0c45de90a970048/mesonbuild/environment.py#L817-L819
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
ansible/roles/lib_statuspageio/library/statuspage_incident.py
python
StatusPageIncident.__init__
(self, api_key, page_id, name=None, scheduled=None, unresolved=None, org_id=None, incident_type='realtime', status='investigating', update_twitter=False, ...
Constructor for OCVolume
Constructor for OCVolume
[ "Constructor", "for", "OCVolume" ]
def __init__(self, api_key, page_id, name=None, scheduled=None, unresolved=None, org_id=None, incident_type='realtime', status='investigating', update_twitter=False, ...
[ "def", "__init__", "(", "self", ",", "api_key", ",", "page_id", ",", "name", "=", "None", ",", "scheduled", "=", "None", ",", "unresolved", "=", "None", ",", "org_id", "=", "None", ",", "incident_type", "=", "'realtime'", ",", "status", "=", "'investigat...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/ansible/roles/lib_statuspageio/library/statuspage_incident.py#L330-L371
eth-brownie/brownie
754bda9f0a294b2beb86453d5eca4ff769a877c8
brownie/network/web3.py
python
Web3.genesis_hash
(self)
return self._genesis_hash
The genesis hash of the currently active network.
The genesis hash of the currently active network.
[ "The", "genesis", "hash", "of", "the", "currently", "active", "network", "." ]
def genesis_hash(self) -> str: """The genesis hash of the currently active network.""" if self.provider is None: raise ConnectionError("web3 is not currently connected") if self._genesis_hash is None: self._genesis_hash = self.eth.get_block(0)["hash"].hex()[2:] re...
[ "def", "genesis_hash", "(", "self", ")", "->", "str", ":", "if", "self", ".", "provider", "is", "None", ":", "raise", "ConnectionError", "(", "\"web3 is not currently connected\"", ")", "if", "self", ".", "_genesis_hash", "is", "None", ":", "self", ".", "_ge...
https://github.com/eth-brownie/brownie/blob/754bda9f0a294b2beb86453d5eca4ff769a877c8/brownie/network/web3.py#L147-L153
buke/GreenOdoo
3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df
runtime/python/lib/python2.7/mailbox.py
python
Mailbox.flush
(self)
Write any pending changes to the disk.
Write any pending changes to the disk.
[ "Write", "any", "pending", "changes", "to", "the", "disk", "." ]
def flush(self): """Write any pending changes to the disk.""" raise NotImplementedError('Method must be implemented by subclass')
[ "def", "flush", "(", "self", ")", ":", "raise", "NotImplementedError", "(", "'Method must be implemented by subclass'", ")" ]
https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/mailbox.py#L184-L186