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
naftaliharris/tauthon
5587ceec329b75f7caf6d65a036db61ac1bae214
Lib/lib2to3/fixes/fix_urllib.py
python
FixUrllib.transform_member
(self, node, results)
Transform for imports of specific module elements. Replaces the module to be imported from with the appropriate new module.
Transform for imports of specific module elements. Replaces the module to be imported from with the appropriate new module.
[ "Transform", "for", "imports", "of", "specific", "module", "elements", ".", "Replaces", "the", "module", "to", "be", "imported", "from", "with", "the", "appropriate", "new", "module", "." ]
def transform_member(self, node, results): """Transform for imports of specific module elements. Replaces the module to be imported from with the appropriate new module. """ mod_member = results.get("mod_member") pref = mod_member.prefix member = results.get...
[ "def", "transform_member", "(", "self", ",", "node", ",", "results", ")", ":", "mod_member", "=", "results", ".", "get", "(", "\"mod_member\"", ")", "pref", "=", "mod_member", ".", "prefix", "member", "=", "results", ".", "get", "(", "\"member\"", ")", "...
https://github.com/naftaliharris/tauthon/blob/5587ceec329b75f7caf6d65a036db61ac1bae214/Lib/lib2to3/fixes/fix_urllib.py#L93-L167
lxc/pylxd
d82e4bbf81cb2a932d62179e895c955c489066fd
pylxd/models/storage_pool.py
python
StorageVolume.put
(self, put_object, wait=False)
Put the storage volume. Implements: PUT /1.0/storage-pools/<pool>/volumes/<type>/<name> Note that this is functionality equivalent to :meth:`~pyxld.models.storage_pool.StorageVolume.save` but by using a new object (`put_object`) rather than modifying the object and then calling...
Put the storage volume.
[ "Put", "the", "storage", "volume", "." ]
def put(self, put_object, wait=False): """Put the storage volume. Implements: PUT /1.0/storage-pools/<pool>/volumes/<type>/<name> Note that this is functionality equivalent to :meth:`~pyxld.models.storage_pool.StorageVolume.save` but by using a new object (`put_object`) rather ...
[ "def", "put", "(", "self", ",", "put_object", ",", "wait", "=", "False", ")", ":", "# Note this method exists so that it is documented via sphinx.", "super", "(", ")", ".", "put", "(", "put_object", ",", "wait", ")" ]
https://github.com/lxc/pylxd/blob/d82e4bbf81cb2a932d62179e895c955c489066fd/pylxd/models/storage_pool.py#L521-L550
prompt-toolkit/pymux
3f66e62b9de4b2251c7f9afad6c516dc5a30ec67
pymux/commands/commands.py
python
display_panes
(pymux, variables)
Display the pane numbers.
Display the pane numbers.
[ "Display", "the", "pane", "numbers", "." ]
def display_panes(pymux, variables): " Display the pane numbers. " pymux.display_pane_numbers = True
[ "def", "display_panes", "(", "pymux", ",", "variables", ")", ":", "pymux", ".", "display_pane_numbers", "=", "True" ]
https://github.com/prompt-toolkit/pymux/blob/3f66e62b9de4b2251c7f9afad6c516dc5a30ec67/pymux/commands/commands.py#L589-L591
joelbarmettlerUZH/auto-tinder
7654c2dff57e24bb5177a5e458d10931457b1c7e
retrain.py
python
run_final_eval
(train_session, module_spec, class_count, image_lists, jpeg_data_tensor, decoded_image_tensor, resized_image_tensor, bottleneck_tensor)
Runs a final evaluation on an eval graph using the test data set. Args: train_session: Session for the train graph with the tensors below. module_spec: The hub.ModuleSpec for the image module being used. class_count: Number of classes image_lists: OrderedDict of training images for each lab...
Runs a final evaluation on an eval graph using the test data set.
[ "Runs", "a", "final", "evaluation", "on", "an", "eval", "graph", "using", "the", "test", "data", "set", "." ]
def run_final_eval(train_session, module_spec, class_count, image_lists, jpeg_data_tensor, decoded_image_tensor, resized_image_tensor, bottleneck_tensor): """Runs a final evaluation on an eval graph using the test data set. Args: train_session: Session for the train ...
[ "def", "run_final_eval", "(", "train_session", ",", "module_spec", ",", "class_count", ",", "image_lists", ",", "jpeg_data_tensor", ",", "decoded_image_tensor", ",", "resized_image_tensor", ",", "bottleneck_tensor", ")", ":", "test_bottlenecks", ",", "test_ground_truth", ...
https://github.com/joelbarmettlerUZH/auto-tinder/blob/7654c2dff57e24bb5177a5e458d10931457b1c7e/retrain.py#L825-L864
onaio/onadata
89ad16744e8f247fb748219476f6ac295869a95f
onadata/apps/viewer/models/parsed_instance.py
python
_parse_sort_fields
(fields)
[]
def _parse_sort_fields(fields): for field in fields: key = field.lstrip('-') if field.startswith('-') and key in NONE_JSON_FIELDS.keys(): field = NONE_JSON_FIELDS.get(key) yield f'-{field}' else: yield NONE_JSON_FIELDS.get(field, field)
[ "def", "_parse_sort_fields", "(", "fields", ")", ":", "for", "field", "in", "fields", ":", "key", "=", "field", ".", "lstrip", "(", "'-'", ")", "if", "field", ".", "startswith", "(", "'-'", ")", "and", "key", "in", "NONE_JSON_FIELDS", ".", "keys", "(",...
https://github.com/onaio/onadata/blob/89ad16744e8f247fb748219476f6ac295869a95f/onadata/apps/viewer/models/parsed_instance.py#L72-L79
yeti-platform/yeti
fcd3ee3d3d064df772d0392c20c22aad2bc4c8e6
core/web/api/links.py
python
Link.delete
(self, id)
return render({"deleted": id})
Deletes the corresponding entry from the database :query ObjectID id: Element ID :>json string deleted: The deleted element's ObjectID
Deletes the corresponding entry from the database
[ "Deletes", "the", "corresponding", "entry", "from", "the", "database" ]
def delete(self, id): """Deletes the corresponding entry from the database :query ObjectID id: Element ID :>json string deleted: The deleted element's ObjectID """ obj = self.objectmanager.objects.get(id=id) for i, inv in enumerate(Investigation.objects(links__id=id)): ...
[ "def", "delete", "(", "self", ",", "id", ")", ":", "obj", "=", "self", ".", "objectmanager", ".", "objects", ".", "get", "(", "id", "=", "id", ")", "for", "i", ",", "inv", "in", "enumerate", "(", "Investigation", ".", "objects", "(", "links__id", "...
https://github.com/yeti-platform/yeti/blob/fcd3ee3d3d064df772d0392c20c22aad2bc4c8e6/core/web/api/links.py#L26-L39
jupyterhub/jupyterhub
e58cf0670690d11631f9dc6e1ab702c60f7bfd13
jupyterhub/apihandlers/base.py
python
APIHandler._filter_model
(self, model, access_map, entity, kind, keys=None)
return model
Filter the model based on the available scopes and the entity requested for. If keys is a dictionary, update it with the allowed keys for the model.
Filter the model based on the available scopes and the entity requested for. If keys is a dictionary, update it with the allowed keys for the model.
[ "Filter", "the", "model", "based", "on", "the", "available", "scopes", "and", "the", "entity", "requested", "for", ".", "If", "keys", "is", "a", "dictionary", "update", "it", "with", "the", "allowed", "keys", "for", "the", "model", "." ]
def _filter_model(self, model, access_map, entity, kind, keys=None): """ Filter the model based on the available scopes and the entity requested for. If keys is a dictionary, update it with the allowed keys for the model. """ allowed_keys = set() for scope in access_map: ...
[ "def", "_filter_model", "(", "self", ",", "model", ",", "access_map", ",", "entity", ",", "kind", ",", "keys", "=", "None", ")", ":", "allowed_keys", "=", "set", "(", ")", "for", "scope", "in", "access_map", ":", "scope_filter", "=", "self", ".", "get_...
https://github.com/jupyterhub/jupyterhub/blob/e58cf0670690d11631f9dc6e1ab702c60f7bfd13/jupyterhub/apihandlers/base.py#L238-L251
larryhastings/gilectomy
4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a
Lib/tkinter/__init__.py
python
Misc.winfo_rooty
(self)
return self.tk.getint( self.tk.call('winfo', 'rooty', self._w))
Return y coordinate of upper left corner of this widget on the root window.
Return y coordinate of upper left corner of this widget on the root window.
[ "Return", "y", "coordinate", "of", "upper", "left", "corner", "of", "this", "widget", "on", "the", "root", "window", "." ]
def winfo_rooty(self): """Return y coordinate of upper left corner of this widget on the root window.""" return self.tk.getint( self.tk.call('winfo', 'rooty', self._w))
[ "def", "winfo_rooty", "(", "self", ")", ":", "return", "self", ".", "tk", ".", "getint", "(", "self", ".", "tk", ".", "call", "(", "'winfo'", ",", "'rooty'", ",", "self", ".", "_w", ")", ")" ]
https://github.com/larryhastings/gilectomy/blob/4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a/Lib/tkinter/__init__.py#L899-L903
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/uwsgidecorators.py
python
farm.__call__
(self, f)
[]
def __call__(self, f): postfork_chain.append(farm_loop(f, self.name))
[ "def", "__call__", "(", "self", ",", "f", ")", ":", "postfork_chain", ".", "append", "(", "farm_loop", "(", "f", ",", "self", ".", "name", ")", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/uwsgidecorators.py#L233-L234
yt-project/yt
dc7b24f9b266703db4c843e329c6c8644d47b824
yt/frontends/ramses/data_structures.py
python
RAMSESDomainSubset.__init__
( self, base_region, domain, ds, over_refine_factor=1, num_ghost_zones=0, base_grid=None, )
[]
def __init__( self, base_region, domain, ds, over_refine_factor=1, num_ghost_zones=0, base_grid=None, ): super().__init__(base_region, domain, ds, over_refine_factor, num_ghost_zones) self._base_grid = base_grid if num_ghost_zones > 0...
[ "def", "__init__", "(", "self", ",", "base_region", ",", "domain", ",", "ds", ",", "over_refine_factor", "=", "1", ",", "num_ghost_zones", "=", "0", ",", "base_grid", "=", "None", ",", ")", ":", "super", "(", ")", ".", "__init__", "(", "base_region", "...
https://github.com/yt-project/yt/blob/dc7b24f9b266703db4c843e329c6c8644d47b824/yt/frontends/ramses/data_structures.py#L283-L310
1012598167/flask_mongodb_game
60c7e0351586656ec38f851592886338e50b4110
python_flask/venv/Lib/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/requests/cookies.py
python
morsel_to_cookie
(morsel)
return create_cookie( comment=morsel['comment'], comment_url=bool(morsel['comment']), discard=False, domain=morsel['domain'], expires=expires, name=morsel.key, path=morsel['path'], port=None, rest={'HttpOnly': morsel['httponly']}, rfc2109=F...
Convert a Morsel object into a Cookie containing the one k/v pair.
Convert a Morsel object into a Cookie containing the one k/v pair.
[ "Convert", "a", "Morsel", "object", "into", "a", "Cookie", "containing", "the", "one", "k", "/", "v", "pair", "." ]
def morsel_to_cookie(morsel): """Convert a Morsel object into a Cookie containing the one k/v pair.""" expires = None if morsel['max-age']: try: expires = int(time.time() + int(morsel['max-age'])) except ValueError: raise TypeError('max-age: %s must be integer' % mor...
[ "def", "morsel_to_cookie", "(", "morsel", ")", ":", "expires", "=", "None", "if", "morsel", "[", "'max-age'", "]", ":", "try", ":", "expires", "=", "int", "(", "time", ".", "time", "(", ")", "+", "int", "(", "morsel", "[", "'max-age'", "]", ")", ")...
https://github.com/1012598167/flask_mongodb_game/blob/60c7e0351586656ec38f851592886338e50b4110/python_flask/venv/Lib/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/requests/cookies.py#L477-L505
oilshell/oil
94388e7d44a9ad879b12615f6203b38596b5a2d3
Python-2.7.13/Lib/email/header.py
python
Header.append
(self, s, charset=None, errors='strict')
Append a string to the MIME header. Optional charset, if given, should be a Charset instance or the name of a character set (which will be converted to a Charset instance). A value of None (the default) means that the charset given in the constructor is used. s may be a byte s...
Append a string to the MIME header.
[ "Append", "a", "string", "to", "the", "MIME", "header", "." ]
def append(self, s, charset=None, errors='strict'): """Append a string to the MIME header. Optional charset, if given, should be a Charset instance or the name of a character set (which will be converted to a Charset instance). A value of None (the default) means that the charset given...
[ "def", "append", "(", "self", ",", "s", ",", "charset", "=", "None", ",", "errors", "=", "'strict'", ")", ":", "if", "charset", "is", "None", ":", "charset", "=", "self", ".", "_charset", "elif", "not", "isinstance", "(", "charset", ",", "Charset", "...
https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/email/header.py#L233-L286
keiffster/program-y
8c99b56f8c32f01a7b9887b5daae9465619d0385
src/programy/parser/pattern/nodes/template.py
python
PatternTemplateNode.to_string
(self, verbose=True)
return "PTEMPLATE"
[]
def to_string(self, verbose=True): if verbose is True: return "PTEMPLATE [%s] [%s]" % (self.userid, self._child_count(verbose)) return "PTEMPLATE"
[ "def", "to_string", "(", "self", ",", "verbose", "=", "True", ")", ":", "if", "verbose", "is", "True", ":", "return", "\"PTEMPLATE [%s] [%s]\"", "%", "(", "self", ".", "userid", ",", "self", ".", "_child_count", "(", "verbose", ")", ")", "return", "\"PTE...
https://github.com/keiffster/program-y/blob/8c99b56f8c32f01a7b9887b5daae9465619d0385/src/programy/parser/pattern/nodes/template.py#L61-L64
tensorflow/agents
1407001d242f7f77fb9407f9b1ac78bcd8f73a09
tf_agents/environments/random_tf_environment.py
python
RandomTFEnvironment._current_time_step
(self)
return tf.nest.map_structure(tf.identity, self._time_step_variables)
Returns the current `TimeStep`.
Returns the current `TimeStep`.
[ "Returns", "the", "current", "TimeStep", "." ]
def _current_time_step(self): """Returns the current `TimeStep`.""" return tf.nest.map_structure(tf.identity, self._time_step_variables)
[ "def", "_current_time_step", "(", "self", ")", ":", "return", "tf", ".", "nest", ".", "map_structure", "(", "tf", ".", "identity", ",", "self", ".", "_time_step_variables", ")" ]
https://github.com/tensorflow/agents/blob/1407001d242f7f77fb9407f9b1ac78bcd8f73a09/tf_agents/environments/random_tf_environment.py#L72-L74
openstack/nova
b49b7663e1c3073917d5844b81d38db8e86d05c4
nova/virt/libvirt/designer.py
python
set_vif_host_backend_vhostuser_config
(conf, mode, path, rx_queue_size, tx_queue_size, tapname=None)
Populate a LibvirtConfigGuestInterface instance with host backend details for vhostuser socket. NOTE: @rx_queue_size and @tx_queue_size can be None
Populate a LibvirtConfigGuestInterface instance with host backend details for vhostuser socket.
[ "Populate", "a", "LibvirtConfigGuestInterface", "instance", "with", "host", "backend", "details", "for", "vhostuser", "socket", "." ]
def set_vif_host_backend_vhostuser_config(conf, mode, path, rx_queue_size, tx_queue_size, tapname=None): """Populate a LibvirtConfigGuestInterface instance with host backend details for vhostuser socket. NOTE: @rx_queue_size and @tx_queue_size can be None """ ...
[ "def", "set_vif_host_backend_vhostuser_config", "(", "conf", ",", "mode", ",", "path", ",", "rx_queue_size", ",", "tx_queue_size", ",", "tapname", "=", "None", ")", ":", "conf", ".", "net_type", "=", "\"vhostuser\"", "conf", ".", "vhostuser_type", "=", "\"unix\"...
https://github.com/openstack/nova/blob/b49b7663e1c3073917d5844b81d38db8e86d05c4/nova/virt/libvirt/designer.py#L135-L151
SeldonIO/alibi
ce961caf995d22648a8338857822c90428af4765
alibi/explainers/shap_wrappers.py
python
TreeShap._check_inputs
(background_data: Union[pd.DataFrame, np.ndarray])
This function warns the user if slow runtime can occur due to the background dataset. Parameters ---------- background_data Background dataset.
This function warns the user if slow runtime can occur due to the background dataset.
[ "This", "function", "warns", "the", "user", "if", "slow", "runtime", "can", "occur", "due", "to", "the", "background", "dataset", "." ]
def _check_inputs(background_data: Union[pd.DataFrame, np.ndarray]) -> None: """ This function warns the user if slow runtime can occur due to the background dataset. Parameters ---------- background_data Background dataset. """ if background_data.sh...
[ "def", "_check_inputs", "(", "background_data", ":", "Union", "[", "pd", ".", "DataFrame", ",", "np", ".", "ndarray", "]", ")", "->", "None", ":", "if", "background_data", ".", "shape", "[", "0", "]", ">", "TREE_SHAP_BACKGROUND_WARNING_THRESHOLD", ":", "msg"...
https://github.com/SeldonIO/alibi/blob/ce961caf995d22648a8338857822c90428af4765/alibi/explainers/shap_wrappers.py#L1183-L1199
4shadoww/hakkuframework
409a11fc3819d251f86faa3473439f8c19066a21
lib/prettytable/prettytable.py
python
PrettyTable.min_width
(self)
return self._min_width
Controls minimum width of fields Arguments: min_width - minimum width integer
Controls minimum width of fields Arguments:
[ "Controls", "minimum", "width", "of", "fields", "Arguments", ":" ]
def min_width(self): """Controls minimum width of fields Arguments: min_width - minimum width integer""" return self._min_width
[ "def", "min_width", "(", "self", ")", ":", "return", "self", ".", "_min_width" ]
https://github.com/4shadoww/hakkuframework/blob/409a11fc3819d251f86faa3473439f8c19066a21/lib/prettytable/prettytable.py#L543-L548
quic/aimet
dae9bae9a77ca719aa7553fefde4768270fc3518
TrainingExtensions/torch/src/python/aimet_torch/cross_layer_equalization.py
python
CrossLayerScaling.scale_cls_set
(cls_set: ClsSet)
return scale_factor
Scale a CLS set :param cls_set: Either a pair or regular conv layers or a triplet of depthwise separable layers :return: Scaling factor calculated and applied
Scale a CLS set :param cls_set: Either a pair or regular conv layers or a triplet of depthwise separable layers :return: Scaling factor calculated and applied
[ "Scale", "a", "CLS", "set", ":", "param", "cls_set", ":", "Either", "a", "pair", "or", "regular", "conv", "layers", "or", "a", "triplet", "of", "depthwise", "separable", "layers", ":", "return", ":", "Scaling", "factor", "calculated", "and", "applied" ]
def scale_cls_set(cls_set: ClsSet) -> ScaleFactor: """ Scale a CLS set :param cls_set: Either a pair or regular conv layers or a triplet of depthwise separable layers :return: Scaling factor calculated and applied """ if len(cls_set) == 3: scale_factor = Cross...
[ "def", "scale_cls_set", "(", "cls_set", ":", "ClsSet", ")", "->", "ScaleFactor", ":", "if", "len", "(", "cls_set", ")", "==", "3", ":", "scale_factor", "=", "CrossLayerScaling", ".", "scale_cls_set_with_depthwise_layers", "(", "cls_set", ")", "else", ":", "sca...
https://github.com/quic/aimet/blob/dae9bae9a77ca719aa7553fefde4768270fc3518/TrainingExtensions/torch/src/python/aimet_torch/cross_layer_equalization.py#L271-L282
pypa/pipenv
b21baade71a86ab3ee1429f71fbc14d4f95fb75d
pipenv/vendor/more_itertools/more.py
python
always_iterable
(obj, base_type=(str, bytes))
If *obj* is iterable, return an iterator over its items:: >>> obj = (1, 2, 3) >>> list(always_iterable(obj)) [1, 2, 3] If *obj* is not iterable, return a one-item iterable containing *obj*:: >>> obj = 1 >>> list(always_iterable(obj)) [1] If *obj* is ``None``, ...
If *obj* is iterable, return an iterator over its items::
[ "If", "*", "obj", "*", "is", "iterable", "return", "an", "iterator", "over", "its", "items", "::" ]
def always_iterable(obj, base_type=(str, bytes)): """If *obj* is iterable, return an iterator over its items:: >>> obj = (1, 2, 3) >>> list(always_iterable(obj)) [1, 2, 3] If *obj* is not iterable, return a one-item iterable containing *obj*:: >>> obj = 1 >>> list(alwa...
[ "def", "always_iterable", "(", "obj", ",", "base_type", "=", "(", "str", ",", "bytes", ")", ")", ":", "if", "obj", "is", "None", ":", "return", "iter", "(", "(", ")", ")", "if", "(", "base_type", "is", "not", "None", ")", "and", "isinstance", "(", ...
https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/vendor/more_itertools/more.py#L1752-L1802
Sierkinhane/mtcnn-pytorch
ab8c28ee6f060680bcdaf9084a419a577d75b0ed
mtcnn/core/detect.py
python
MtcnnDetector.pad
(self, bboxes, w, h)
return return_list
pad the the boxes Parameters: ---------- bboxes: numpy array, n x 5 input bboxes w: float number width of the input image h: float number height of the input image Returns : ------ dy, dx : nu...
pad the the boxes Parameters: ---------- bboxes: numpy array, n x 5 input bboxes w: float number width of the input image h: float number height of the input image Returns : ------ dy, dx : nu...
[ "pad", "the", "the", "boxes", "Parameters", ":", "----------", "bboxes", ":", "numpy", "array", "n", "x", "5", "input", "bboxes", "w", ":", "float", "number", "width", "of", "the", "input", "image", "h", ":", "float", "number", "height", "of", "the", "...
def pad(self, bboxes, w, h): """ pad the the boxes Parameters: ---------- bboxes: numpy array, n x 5 input bboxes w: float number width of the input image h: float number height of the input image ...
[ "def", "pad", "(", "self", ",", "bboxes", ",", "w", ",", "h", ")", ":", "# width and height", "tmpw", "=", "(", "bboxes", "[", ":", ",", "2", "]", "-", "bboxes", "[", ":", ",", "0", "]", "+", "1", ")", ".", "astype", "(", "np", ".", "int32", ...
https://github.com/Sierkinhane/mtcnn-pytorch/blob/ab8c28ee6f060680bcdaf9084a419a577d75b0ed/mtcnn/core/detect.py#L197-L252
counsyl/hgvs
ab9b95f21466fbb3265b5bd818ccab0c926ca59f
pyhgvs/variants.py
python
NormalizedVariant.__init__
(self, position, ref_allele, alt_alleles, seq_5p='', seq_3p='', genome=None, justify='left')
position: a 0-index genomic Position. ref_allele: the reference allele sequence. alt_alleles: a list of alternate allele sequences. seq_5p: 5 prime flanking sequence of variant. seq_3p: 3 prime flanking sequence of variant. genome: a pygr compatible genome object (optional).
position: a 0-index genomic Position. ref_allele: the reference allele sequence. alt_alleles: a list of alternate allele sequences. seq_5p: 5 prime flanking sequence of variant. seq_3p: 3 prime flanking sequence of variant. genome: a pygr compatible genome object (optional).
[ "position", ":", "a", "0", "-", "index", "genomic", "Position", ".", "ref_allele", ":", "the", "reference", "allele", "sequence", ".", "alt_alleles", ":", "a", "list", "of", "alternate", "allele", "sequences", ".", "seq_5p", ":", "5", "prime", "flanking", ...
def __init__(self, position, ref_allele, alt_alleles, seq_5p='', seq_3p='', genome=None, justify='left'): """ position: a 0-index genomic Position. ref_allele: the reference allele sequence. alt_alleles: a list of alternate allele sequences. seq_5p: 5 prime flank...
[ "def", "__init__", "(", "self", ",", "position", ",", "ref_allele", ",", "alt_alleles", ",", "seq_5p", "=", "''", ",", "seq_3p", "=", "''", ",", "genome", "=", "None", ",", "justify", "=", "'left'", ")", ":", "self", ".", "position", "=", "position", ...
https://github.com/counsyl/hgvs/blob/ab9b95f21466fbb3265b5bd818ccab0c926ca59f/pyhgvs/variants.py#L144-L166
kangasbros/django-bitcoin
78bd509d815cfa27dbfd0a743aa742af644d27bf
django_bitcoin/pywallet.py
python
strip_PKCS7_padding
(s)
return s[:-numpads]
return s stripped of PKCS7 padding
return s stripped of PKCS7 padding
[ "return", "s", "stripped", "of", "PKCS7", "padding" ]
def strip_PKCS7_padding(s): """return s stripped of PKCS7 padding""" if len(s)%16 or not s: raise ValueError("String of len %d can't be PCKS7-padded" % len(s)) numpads = ord(s[-1]) if numpads > 16: raise ValueError("String ending with %r can't be PCKS7-padded" % s[-1]) return s[:-num...
[ "def", "strip_PKCS7_padding", "(", "s", ")", ":", "if", "len", "(", "s", ")", "%", "16", "or", "not", "s", ":", "raise", "ValueError", "(", "\"String of len %d can't be PCKS7-padded\"", "%", "len", "(", "s", ")", ")", "numpads", "=", "ord", "(", "s", "...
https://github.com/kangasbros/django-bitcoin/blob/78bd509d815cfa27dbfd0a743aa742af644d27bf/django_bitcoin/pywallet.py#L60-L67
revalo/pishot
ec10a72e20b8e573bab0712164e60552690d6d47
pishot.py
python
write_frex_registers
()
Enables FREX mode on the ov5647 camera module. And sets the integration time to the maximum allowed.
Enables FREX mode on the ov5647 camera module. And sets the integration time to the maximum allowed.
[ "Enables", "FREX", "mode", "on", "the", "ov5647", "camera", "module", ".", "And", "sets", "the", "integration", "time", "to", "the", "maximum", "allowed", "." ]
def write_frex_registers(): """Enables FREX mode on the ov5647 camera module. And sets the integration time to the maximum allowed. """ process = subprocess.Popen("./i2cwrite /dev/i2c-0 3002 ff".split()) process.wait() process = subprocess.Popen( "./i2cwrite /dev/i2c-0 3b01 00 08 00 ff...
[ "def", "write_frex_registers", "(", ")", ":", "process", "=", "subprocess", ".", "Popen", "(", "\"./i2cwrite /dev/i2c-0 3002 ff\"", ".", "split", "(", ")", ")", "process", ".", "wait", "(", ")", "process", "=", "subprocess", ".", "Popen", "(", "\"./i2cwrite /d...
https://github.com/revalo/pishot/blob/ec10a72e20b8e573bab0712164e60552690d6d47/pishot.py#L29-L40
libertysoft3/saidit
271c7d03adb369f82921d811360b00812e42da24
r2/r2/models/token.py
python
extra_oauth2_scope
(*scopes)
return extra_oauth2_wrapper
Wrap a function so that it only returns data if user has all `scopes` When not in an OAuth2 context, function returns normally. In an OAuth2 context, the function will not be run unless the user has granted all scopes required of this function. Instead, the function will raise an OAuth2Scope.Insufficie...
Wrap a function so that it only returns data if user has all `scopes`
[ "Wrap", "a", "function", "so", "that", "it", "only", "returns", "data", "if", "user", "has", "all", "scopes" ]
def extra_oauth2_scope(*scopes): """Wrap a function so that it only returns data if user has all `scopes` When not in an OAuth2 context, function returns normally. In an OAuth2 context, the function will not be run unless the user has granted all scopes required of this function. Instead, the function ...
[ "def", "extra_oauth2_scope", "(", "*", "scopes", ")", ":", "def", "extra_oauth2_wrapper", "(", "fn", ")", ":", "@", "functools", ".", "wraps", "(", "fn", ")", "def", "wrapper_fn", "(", "*", "a", ",", "*", "*", "kw", ")", ":", "if", "not", "c", ".",...
https://github.com/libertysoft3/saidit/blob/271c7d03adb369f82921d811360b00812e42da24/r2/r2/models/token.py#L353-L375
OpenMDAO/OpenMDAO-Framework
f2e37b7de3edeaaeb2d251b375917adec059db9b
openmdao.main/src/openmdao/main/linearsolver.py
python
LinearGS.__init__
(self, system)
Set up LinearGS object
Set up LinearGS object
[ "Set", "up", "LinearGS", "object" ]
def __init__(self, system): """ Set up LinearGS object """ super(LinearGS, self).__init__(system) lsize = np.sum(system.local_var_sizes[system.mpi.rank, :]) system.sol_buf = np.zeros(lsize) system.rhs_buf = np.zeros(lsize)
[ "def", "__init__", "(", "self", ",", "system", ")", ":", "super", "(", "LinearGS", ",", "self", ")", ".", "__init__", "(", "system", ")", "lsize", "=", "np", ".", "sum", "(", "system", ".", "local_var_sizes", "[", "system", ".", "mpi", ".", "rank", ...
https://github.com/OpenMDAO/OpenMDAO-Framework/blob/f2e37b7de3edeaaeb2d251b375917adec059db9b/openmdao.main/src/openmdao/main/linearsolver.py#L451-L458
kozec/sc-controller
ce92c773b8b26f6404882e9209aff212c4053170
scc/drivers/usb.py
python
USBDevice.close
(self)
Called after device is disconnected
Called after device is disconnected
[ "Called", "after", "device", "is", "disconnected" ]
def close(self): """ Called after device is disconnected """ try: self.unclaim() except: pass try: self.handle.resetDevice() self.handle.close() except: pass
[ "def", "close", "(", "self", ")", ":", "try", ":", "self", ".", "unclaim", "(", ")", "except", ":", "pass", "try", ":", "self", ".", "handle", ".", "resetDevice", "(", ")", "self", ".", "handle", ".", "close", "(", ")", "except", ":", "pass" ]
https://github.com/kozec/sc-controller/blob/ce92c773b8b26f6404882e9209aff212c4053170/scc/drivers/usb.py#L170-L178
google/clusterfuzz
f358af24f414daa17a3649b143e71ea71871ef59
src/clusterfuzz/_internal/metrics/fuzzer_stats.py
python
get_gcs_stats_path
(kind, fuzzer, timestamp)
return path
Return gcs path in the format "/bucket/path/to/containing_dir/" for the given fuzzer, job, and timestamp or revision.
Return gcs path in the format "/bucket/path/to/containing_dir/" for the given fuzzer, job, and timestamp or revision.
[ "Return", "gcs", "path", "in", "the", "format", "/", "bucket", "/", "path", "/", "to", "/", "containing_dir", "/", "for", "the", "given", "fuzzer", "job", "and", "timestamp", "or", "revision", "." ]
def get_gcs_stats_path(kind, fuzzer, timestamp): """Return gcs path in the format "/bucket/path/to/containing_dir/" for the given fuzzer, job, and timestamp or revision.""" bucket_name = big_query.get_bucket() if not bucket_name: return None datetime_value = datetime.datetime.utcfromtimestamp(timestamp) ...
[ "def", "get_gcs_stats_path", "(", "kind", ",", "fuzzer", ",", "timestamp", ")", ":", "bucket_name", "=", "big_query", ".", "get_bucket", "(", ")", "if", "not", "bucket_name", ":", "return", "None", "datetime_value", "=", "datetime", ".", "datetime", ".", "ut...
https://github.com/google/clusterfuzz/blob/f358af24f414daa17a3649b143e71ea71871ef59/src/clusterfuzz/_internal/metrics/fuzzer_stats.py#L1021-L1032
vlachoudis/bCNC
67126b4894dabf6579baf47af8d0f9b7de35e6e3
bCNC/CNCCanvas.py
python
CanvasFrame.drawGrid
(self, value=None)
[]
def drawGrid(self, value=None): if value is not None: self.draw_grid.set(value) self.canvas.draw_grid = self.draw_grid.get() self.canvas.drawGrid()
[ "def", "drawGrid", "(", "self", ",", "value", "=", "None", ")", ":", "if", "value", "is", "not", "None", ":", "self", ".", "draw_grid", ".", "set", "(", "value", ")", "self", ".", "canvas", ".", "draw_grid", "=", "self", ".", "draw_grid", ".", "get...
https://github.com/vlachoudis/bCNC/blob/67126b4894dabf6579baf47af8d0f9b7de35e6e3/bCNC/CNCCanvas.py#L2261-L2264
blurstudio/cross3d
277968d1227de740fc87ef61005c75034420eadf
cross3d/maya/mayasceneobject.py
python
MayaSceneObject._typeOfNativeObject
(cls, nativeObject)
return AbstractSceneObject._typeOfNativeObject(nativeObject)
\remarks reimplements the AbstractSceneObject._typeOfNativeObject method to returns the ObjectType of the nativeObject applied \param <Py3dsMax.mxs.Object> nativeObject || None \return <bool> success
\remarks reimplements the AbstractSceneObject._typeOfNativeObject method to returns the ObjectType of the nativeObject applied \param <Py3dsMax.mxs.Object> nativeObject || None \return <bool> success
[ "\\", "remarks", "reimplements", "the", "AbstractSceneObject", ".", "_typeOfNativeObject", "method", "to", "returns", "the", "ObjectType", "of", "the", "nativeObject", "applied", "\\", "param", "<Py3dsMax", ".", "mxs", ".", "Object", ">", "nativeObject", "||", "No...
def _typeOfNativeObject(cls, nativeObject): """ \remarks reimplements the AbstractSceneObject._typeOfNativeObject method to returns the ObjectType of the nativeObject applied \param <Py3dsMax.mxs.Object> nativeObject || None \return <bool> success """ # Make sure the nativeObject is a OpenMaya.MObject ...
[ "def", "_typeOfNativeObject", "(", "cls", ",", "nativeObject", ")", ":", "# Make sure the nativeObject is a OpenMaya.MObject", "# TODO: Move this into a cross3d private function the __new__ factory can call.", "nativeObject", "=", "cls", ".", "_asMOBject", "(", "nativeObject", ")",...
https://github.com/blurstudio/cross3d/blob/277968d1227de740fc87ef61005c75034420eadf/cross3d/maya/mayasceneobject.py#L216-L241
blaze/blaze
6c377268f691c8e50c8c9ade1893b29889da0b61
blaze/compute/core.py
python
pre_compute
(leaf, data, scope=None, **kwargs)
return data
Transform data prior to calling ``compute``
Transform data prior to calling ``compute``
[ "Transform", "data", "prior", "to", "calling", "compute" ]
def pre_compute(leaf, data, scope=None, **kwargs): """ Transform data prior to calling ``compute`` """ return data
[ "def", "pre_compute", "(", "leaf", ",", "data", ",", "scope", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "data" ]
https://github.com/blaze/blaze/blob/6c377268f691c8e50c8c9ade1893b29889da0b61/blaze/compute/core.py#L47-L49
DataDog/integrations-core
934674b29d94b70ccc008f76ea172d0cdae05e1e
datadog_checks_dev/datadog_checks/dev/tooling/manifest_validator/v2/validator.py
python
DisplayOnPublicValidator.validate
(self, check_name, decoded, fix)
[]
def validate(self, check_name, decoded, fix): correct_is_public = True path = '/display_on_public_website' is_public = decoded.get_path(path) if not isinstance(is_public, bool): output = ' required boolean: display_on_public_website' if fix: deco...
[ "def", "validate", "(", "self", ",", "check_name", ",", "decoded", ",", "fix", ")", ":", "correct_is_public", "=", "True", "path", "=", "'/display_on_public_website'", "is_public", "=", "decoded", ".", "get_path", "(", "path", ")", "if", "not", "isinstance", ...
https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/datadog_checks_dev/datadog_checks/dev/tooling/manifest_validator/v2/validator.py#L23-L41
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/geometry/polyhedron/constructor.py
python
Polyhedron
(vertices=None, rays=None, lines=None, ieqs=None, eqns=None, ambient_dim=None, base_ring=None, minimize=True, verbose=False, backend=None, mutable=False)
return parent(Vrep, Hrep, convert=convert, verbose=verbose, mutable=mutable)
r""" Construct a polyhedron object. You may either define it with vertex/ray/line or inequalities/equations data, but not both. Redundant data will automatically be removed (unless ``minimize=False``), and the complementary representation will be computed. INPUT: - ``vertices`` -- list of...
r""" Construct a polyhedron object.
[ "r", "Construct", "a", "polyhedron", "object", "." ]
def Polyhedron(vertices=None, rays=None, lines=None, ieqs=None, eqns=None, ambient_dim=None, base_ring=None, minimize=True, verbose=False, backend=None, mutable=False): r""" Construct a polyhedron object. You may either define it with vertex/ray/line or ineq...
[ "def", "Polyhedron", "(", "vertices", "=", "None", ",", "rays", "=", "None", ",", "lines", "=", "None", ",", "ieqs", "=", "None", ",", "eqns", "=", "None", ",", "ambient_dim", "=", "None", ",", "base_ring", "=", "None", ",", "minimize", "=", "True", ...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/geometry/polyhedron/constructor.py#L303-L683
yuxiaokui/Intranet-Penetration
f57678a204840c83cbf3308e3470ae56c5ff514b
proxy/XX-Net/code/default/gae_proxy/server/lib/google/appengine/tools/appcfg.py
python
AppCfgApp.InferRemoteApiUrl
(self, appyaml)
return None
Uses app.yaml to determine the remote_api endpoint. Args: appyaml: A parsed app.yaml file. Returns: The url of the remote_api endpoint as a string, or None
Uses app.yaml to determine the remote_api endpoint.
[ "Uses", "app", ".", "yaml", "to", "determine", "the", "remote_api", "endpoint", "." ]
def InferRemoteApiUrl(self, appyaml): """Uses app.yaml to determine the remote_api endpoint. Args: appyaml: A parsed app.yaml file. Returns: The url of the remote_api endpoint as a string, or None """ handlers = appyaml.handlers handler_suffixes = ['remote_api/handler.py', ...
[ "def", "InferRemoteApiUrl", "(", "self", ",", "appyaml", ")", ":", "handlers", "=", "appyaml", ".", "handlers", "handler_suffixes", "=", "[", "'remote_api/handler.py'", ",", "'remote_api.handler.application'", "]", "app_id", "=", "appyaml", ".", "application", "for"...
https://github.com/yuxiaokui/Intranet-Penetration/blob/f57678a204840c83cbf3308e3470ae56c5ff514b/proxy/XX-Net/code/default/gae_proxy/server/lib/google/appengine/tools/appcfg.py#L4683-L4714
googledatalab/pydatalab
1c86e26a0d24e3bc8097895ddeab4d0607be4c40
solutionbox/image_classification/mltoolbox/image/classification/_preprocess.py
python
TFExampleFromImageDoFn.process
(self, element)
[]
def process(self, element): import tensorflow as tf def _bytes_feature(value): return tf.train.Feature(bytes_list=tf.train.BytesList(value=value)) def _float_feature(value): return tf.train.Feature(float_list=tf.train.FloatList(value=value)) uri, label_id, image_bytes = element try:...
[ "def", "process", "(", "self", ",", "element", ")", ":", "import", "tensorflow", "as", "tf", "def", "_bytes_feature", "(", "value", ")", ":", "return", "tf", ".", "train", ".", "Feature", "(", "bytes_list", "=", "tf", ".", "train", ".", "BytesList", "(...
https://github.com/googledatalab/pydatalab/blob/1c86e26a0d24e3bc8097895ddeab4d0607be4c40/solutionbox/image_classification/mltoolbox/image/classification/_preprocess.py#L237-L268
bungnoid/glTools
8ff0899de43784a18bd4543285655e68e28fb5e5
tools/stretchyIkSpline.py
python
stretchyIkSpline_arcLength
( ikHandle, scaleAxis='x', scaleAttr='', blendControl='', blendAttr='stretchScale', prefix='' )
return [crvInfo,multDbl,blendNode]
Build stretchy IK spline setup using the arc length of the input curve. @param ikHandle: IK Handle to create stretchy setup for @type ikHandle: str @param scaleAxis: Axis along which the ik joints will be scaled @type scaleAxis: str @param scaleAttr: World scale attribute @type scaleAttr: str @param blendControl...
Build stretchy IK spline setup using the arc length of the input curve.
[ "Build", "stretchy", "IK", "spline", "setup", "using", "the", "arc", "length", "of", "the", "input", "curve", "." ]
def stretchyIkSpline_arcLength( ikHandle, scaleAxis='x', scaleAttr='', blendControl='', blendAttr='stretchScale', prefix='' ): ''' Build stretchy IK spline setup using the arc length of the input curve. @param ikHandle: IK Handle to create stretchy setup for @type ikHandle: s...
[ "def", "stretchyIkSpline_arcLength", "(", "ikHandle", ",", "scaleAxis", "=", "'x'", ",", "scaleAttr", "=", "''", ",", "blendControl", "=", "''", ",", "blendAttr", "=", "'stretchScale'", ",", "prefix", "=", "''", ")", ":", "# Check prefix", "if", "not", "pref...
https://github.com/bungnoid/glTools/blob/8ff0899de43784a18bd4543285655e68e28fb5e5/tools/stretchyIkSpline.py#L193-L259
swaroopch/byte-of-python
239134197cc453397b0540fa051392af6b47f9f3
programs/oop_objvar.py
python
Robot.say_hi
(self)
Greeting by the robot. Yeah, they can do that.
Greeting by the robot.
[ "Greeting", "by", "the", "robot", "." ]
def say_hi(self): """Greeting by the robot. Yeah, they can do that.""" print("Greetings, my masters call me {}.".format(self.name))
[ "def", "say_hi", "(", "self", ")", ":", "print", "(", "\"Greetings, my masters call me {}.\"", ".", "format", "(", "self", ".", "name", ")", ")" ]
https://github.com/swaroopch/byte-of-python/blob/239134197cc453397b0540fa051392af6b47f9f3/programs/oop_objvar.py#L28-L32
gramps-project/gramps
04d4651a43eb210192f40a9f8c2bad8ee8fa3753
gramps/gui/plug/report/_bookdialog.py
python
BookSelector.on_add_clicked
(self, obj)
Add an item to the current selections. Use the selected available item to get the item's name in the registry.
Add an item to the current selections.
[ "Add", "an", "item", "to", "the", "current", "selections", "." ]
def on_add_clicked(self, obj): """ Add an item to the current selections. Use the selected available item to get the item's name in the registry. """ store, the_iter = self.avail_model.get_selected() if not the_iter: return data = self.avail_model.get...
[ "def", "on_add_clicked", "(", "self", ",", "obj", ")", ":", "store", ",", "the_iter", "=", "self", ".", "avail_model", ".", "get_selected", "(", ")", "if", "not", "the_iter", ":", "return", "data", "=", "self", ".", "avail_model", ".", "get_data", "(", ...
https://github.com/gramps-project/gramps/blob/04d4651a43eb210192f40a9f8c2bad8ee8fa3753/gramps/gui/plug/report/_bookdialog.py#L492-L507
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/OpenSSL/SSL.py
python
Context.add_client_ca
(self, certificate_authority)
Add the CA certificate to the list of preferred signers for this context. The list of certificate authorities will be sent to the client when the server requests a client certificate. :param certificate_authority: certificate authority's X509 certificate. :return: None ...
Add the CA certificate to the list of preferred signers for this context.
[ "Add", "the", "CA", "certificate", "to", "the", "list", "of", "preferred", "signers", "for", "this", "context", "." ]
def add_client_ca(self, certificate_authority): """ Add the CA certificate to the list of preferred signers for this context. The list of certificate authorities will be sent to the client when the server requests a client certificate. :param certificate_authority: cert...
[ "def", "add_client_ca", "(", "self", ",", "certificate_authority", ")", ":", "if", "not", "isinstance", "(", "certificate_authority", ",", "X509", ")", ":", "raise", "TypeError", "(", "\"certificate_authority must be an X509 instance\"", ")", "add_result", "=", "_lib"...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/OpenSSL/SSL.py#L1240-L1258
ganglia/gmond_python_modules
2f7fcab3d27926ef4a2feb1b53c09af16a43e729
storm_topology/python_modules/storm_topology.py
python
get_avg
(arr)
return sum(arr) / len(arr)
[]
def get_avg(arr): if len(arr) < 1: return 0 return sum(arr) / len(arr)
[ "def", "get_avg", "(", "arr", ")", ":", "if", "len", "(", "arr", ")", "<", "1", ":", "return", "0", "return", "sum", "(", "arr", ")", "/", "len", "(", "arr", ")" ]
https://github.com/ganglia/gmond_python_modules/blob/2f7fcab3d27926ef4a2feb1b53c09af16a43e729/storm_topology/python_modules/storm_topology.py#L80-L83
playframework/play1
0ecac3bc2421ae2dbec27a368bf671eda1c9cba5
python/Lib/sysconfig.py
python
_parse_makefile
(filename, vars=None)
return vars
Parse a Makefile-style file. A dictionary containing name/value pairs is returned. If an optional dictionary is passed in as the second argument, it is used instead of a new dictionary.
Parse a Makefile-style file.
[ "Parse", "a", "Makefile", "-", "style", "file", "." ]
def _parse_makefile(filename, vars=None): """Parse a Makefile-style file. A dictionary containing name/value pairs is returned. If an optional dictionary is passed in as the second argument, it is used instead of a new dictionary. """ import re # Regexes needed for parsing Makefile (and si...
[ "def", "_parse_makefile", "(", "filename", ",", "vars", "=", "None", ")", ":", "import", "re", "# Regexes needed for parsing Makefile (and similar syntaxes,", "# like old-style Setup files).", "_variable_rx", "=", "re", ".", "compile", "(", "\"([a-zA-Z][a-zA-Z0-9_]+)\\s*=\\s*...
https://github.com/playframework/play1/blob/0ecac3bc2421ae2dbec27a368bf671eda1c9cba5/python/Lib/sysconfig.py#L190-L273
DataDog/integrations-core
934674b29d94b70ccc008f76ea172d0cdae05e1e
dotnetclr/datadog_checks/dotnetclr/config_models/__init__.py
python
ConfigMixin.shared_config
(self)
return self._config_model_shared
[]
def shared_config(self) -> SharedConfig: return self._config_model_shared
[ "def", "shared_config", "(", "self", ")", "->", "SharedConfig", ":", "return", "self", ".", "_config_model_shared" ]
https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/dotnetclr/datadog_checks/dotnetclr/config_models/__init__.py#L23-L24
HKUST-KnowComp/DeepGraphCNNforTexts
bf0bb5441ecea58c5556a9969064bec074325c7a
TextCNN/p7_TextCNN_model_multilayers.py
python
TextCNNMultilayers.instantiate_weights
(self)
define all weights here
define all weights here
[ "define", "all", "weights", "here" ]
def instantiate_weights(self): """define all weights here""" with tf.name_scope("embedding"): # embedding matrix self.Embedding = tf.get_variable("Embedding",shape=[self.vocab_size, self.embed_size],initializer=self.initializer) #[vocab_size,embed_size] tf.random_uniform([self.vocab_size, se...
[ "def", "instantiate_weights", "(", "self", ")", ":", "with", "tf", ".", "name_scope", "(", "\"embedding\"", ")", ":", "# embedding matrix", "self", ".", "Embedding", "=", "tf", ".", "get_variable", "(", "\"Embedding\"", ",", "shape", "=", "[", "self", ".", ...
https://github.com/HKUST-KnowComp/DeepGraphCNNforTexts/blob/bf0bb5441ecea58c5556a9969064bec074325c7a/TextCNN/p7_TextCNN_model_multilayers.py#L52-L57
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/lib-python/3/xml/etree/ElementTree.py
python
iselement
(element)
return hasattr(element, 'tag')
Return True if *element* appears to be an Element.
Return True if *element* appears to be an Element.
[ "Return", "True", "if", "*", "element", "*", "appears", "to", "be", "an", "Element", "." ]
def iselement(element): """Return True if *element* appears to be an Element.""" return hasattr(element, 'tag')
[ "def", "iselement", "(", "element", ")", ":", "return", "hasattr", "(", "element", ",", "'tag'", ")" ]
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/xml/etree/ElementTree.py#L120-L122
bikalims/bika.lims
35e4bbdb5a3912cae0b5eb13e51097c8b0486349
bika/lims/browser/reports/qualitycontrol_analysesoutofrange.py
python
Report.__init__
(self, context, request, report=None)
[]
def __init__(self, context, request, report=None): self.report = report BrowserView.__init__(self, context, request)
[ "def", "__init__", "(", "self", ",", "context", ",", "request", ",", "report", "=", "None", ")", ":", "self", ".", "report", "=", "report", "BrowserView", ".", "__init__", "(", "self", ",", "context", ",", "request", ")" ]
https://github.com/bikalims/bika.lims/blob/35e4bbdb5a3912cae0b5eb13e51097c8b0486349/bika/lims/browser/reports/qualitycontrol_analysesoutofrange.py#L23-L25
saltstack/salt
fae5bc757ad0f1716483ce7ae180b451545c2058
salt/states/nftables.py
python
chain_present
( name, table="filter", table_type=None, hook=None, priority=None, family="ipv4" )
.. versionadded:: 2014.7.0 .. versionchanged:: 3002 Verify a chain exists in a table. name A user-defined chain name. table The table to own the chain. family Networking family, either ipv4 or ipv6
.. versionadded:: 2014.7.0
[ "..", "versionadded", "::", "2014", ".", "7", ".", "0" ]
def chain_present( name, table="filter", table_type=None, hook=None, priority=None, family="ipv4" ): """ .. versionadded:: 2014.7.0 .. versionchanged:: 3002 Verify a chain exists in a table. name A user-defined chain name. table The table to own the chain. family ...
[ "def", "chain_present", "(", "name", ",", "table", "=", "\"filter\"", ",", "table_type", "=", "None", ",", "hook", "=", "None", ",", "priority", "=", "None", ",", "family", "=", "\"ipv4\"", ")", ":", "ret", "=", "{", "\"name\"", ":", "name", ",", "\"...
https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/states/nftables.py#L129-L183
IronLanguages/main
a949455434b1fda8c783289e897e78a9a0caabb5
External.LCA_RESTRICTED/Languages/CPython/27/Lib/lib-tk/Tkinter.py
python
Text.tag_lower
(self, tagName, belowThis=None)
Change the priority of tag TAGNAME such that it is lower than the priority of BELOWTHIS.
Change the priority of tag TAGNAME such that it is lower than the priority of BELOWTHIS.
[ "Change", "the", "priority", "of", "tag", "TAGNAME", "such", "that", "it", "is", "lower", "than", "the", "priority", "of", "BELOWTHIS", "." ]
def tag_lower(self, tagName, belowThis=None): """Change the priority of tag TAGNAME such that it is lower than the priority of BELOWTHIS.""" self.tk.call(self._w, 'tag', 'lower', tagName, belowThis)
[ "def", "tag_lower", "(", "self", ",", "tagName", ",", "belowThis", "=", "None", ")", ":", "self", ".", "tk", ".", "call", "(", "self", ".", "_w", ",", "'tag'", ",", "'lower'", ",", "tagName", ",", "belowThis", ")" ]
https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/CPython/27/Lib/lib-tk/Tkinter.py#L3071-L3074
depthsecurity/armory
93793e4a1d7b60615d282867cb22317272dd6404
armory2/armory_main/included/modules/Gowitness.py
python
Module.process_output
(self, cmds)
Not really any output to process with this module, but you need to cwd into directory to make database generation work, so I'll do that here.
Not really any output to process with this module, but you need to cwd into directory to make database generation work, so I'll do that here.
[ "Not", "really", "any", "output", "to", "process", "with", "this", "module", "but", "you", "need", "to", "cwd", "into", "directory", "to", "make", "database", "generation", "work", "so", "I", "ll", "do", "that", "here", "." ]
def process_output(self, cmds): """ Not really any output to process with this module, but you need to cwd into directory to make database generation work, so I'll do that here. """ cwd = os.getcwd() # ver_pat = re.compile("gowitness:\s?(?P<ver>\d+\.\d+\.\d+)") #...
[ "def", "process_output", "(", "self", ",", "cmds", ")", ":", "cwd", "=", "os", ".", "getcwd", "(", ")", "# ver_pat = re.compile(\"gowitness:\\s?(?P<ver>\\d+\\.\\d+\\.\\d+)\")", "# version = subprocess.getoutput(\"gowitness version\")", "# command_change = LooseVersion(\"1.0.8\")", ...
https://github.com/depthsecurity/armory/blob/93793e4a1d7b60615d282867cb22317272dd6404/armory2/armory_main/included/modules/Gowitness.py#L139-L221
Kyubyong/neural_chinese_transliterator
132cc624cde87d41625c77416581280571218174
data_load.py
python
load_test_data
()
return nums, X, ys
Embeds and vectorize words in input corpus
Embeds and vectorize words in input corpus
[ "Embeds", "and", "vectorize", "words", "in", "input", "corpus" ]
def load_test_data(): '''Embeds and vectorize words in input corpus''' try: lines = [line for line in codecs.open('eval/input.csv', 'r', 'utf-8').read().splitlines()[1:]] except IOError: raise IOError("Write the sentences you want to test line by line in `data/input.csv` file.") pnyn2id...
[ "def", "load_test_data", "(", ")", ":", "try", ":", "lines", "=", "[", "line", "for", "line", "in", "codecs", ".", "open", "(", "'eval/input.csv'", ",", "'r'", ",", "'utf-8'", ")", ".", "read", "(", ")", ".", "splitlines", "(", ")", "[", "1", ":", ...
https://github.com/Kyubyong/neural_chinese_transliterator/blob/132cc624cde87d41625c77416581280571218174/data_load.py#L56-L76
googleads/google-ads-python
2a1d6062221f6aad1992a6bcca0e7e4a93d2db86
google/ads/googleads/v7/services/services/campaign_label_service/client.py
python
CampaignLabelServiceClient.parse_campaign_path
(path: str)
return m.groupdict() if m else {}
Parse a campaign path into its component segments.
Parse a campaign path into its component segments.
[ "Parse", "a", "campaign", "path", "into", "its", "component", "segments", "." ]
def parse_campaign_path(path: str) -> Dict[str, str]: """Parse a campaign path into its component segments.""" m = re.match( r"^customers/(?P<customer_id>.+?)/campaigns/(?P<campaign_id>.+?)$", path, ) return m.groupdict() if m else {}
[ "def", "parse_campaign_path", "(", "path", ":", "str", ")", "->", "Dict", "[", "str", ",", "str", "]", ":", "m", "=", "re", ".", "match", "(", "r\"^customers/(?P<customer_id>.+?)/campaigns/(?P<campaign_id>.+?)$\"", ",", "path", ",", ")", "return", "m", ".", ...
https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v7/services/services/campaign_label_service/client.py#L167-L173
typemytype/drawbot
b64569bfb352acf3ac54d2a91f0a987985685466
drawBot/context/baseContext.py
python
BezierPath.oval
(self, x, y, w, h)
Add a oval at possition `x`, `y` with a size of `w`, `h`
Add a oval at possition `x`, `y` with a size of `w`, `h`
[ "Add", "a", "oval", "at", "possition", "x", "y", "with", "a", "size", "of", "w", "h" ]
def oval(self, x, y, w, h): """ Add a oval at possition `x`, `y` with a size of `w`, `h` """ self._path.appendBezierPathWithOvalInRect_(((x, y), (w, h))) self.closePath()
[ "def", "oval", "(", "self", ",", "x", ",", "y", ",", "w", ",", "h", ")", ":", "self", ".", "_path", ".", "appendBezierPathWithOvalInRect_", "(", "(", "(", "x", ",", "y", ")", ",", "(", "w", ",", "h", ")", ")", ")", "self", ".", "closePath", "...
https://github.com/typemytype/drawbot/blob/b64569bfb352acf3ac54d2a91f0a987985685466/drawBot/context/baseContext.py#L309-L314
josiah-wolf-oberholtzer/supriya
5ca725a6b97edfbe016a75666d420ecfdf49592f
dev/etc/pending_ugens/ModDif.py
python
ModDif.ar
( cls, mod=1, x=0, y=0, )
return ugen
Constructs an audio-rate ModDif. :: >>> mod_dif = supriya.ugens.ModDif.ar( ... mod=1, ... x=0, ... y=0, ... ) >>> mod_dif ModDif.ar() Returns ugen graph.
Constructs an audio-rate ModDif.
[ "Constructs", "an", "audio", "-", "rate", "ModDif", "." ]
def ar( cls, mod=1, x=0, y=0, ): """ Constructs an audio-rate ModDif. :: >>> mod_dif = supriya.ugens.ModDif.ar( ... mod=1, ... x=0, ... y=0, ... ) >>> mod_dif ...
[ "def", "ar", "(", "cls", ",", "mod", "=", "1", ",", "x", "=", "0", ",", "y", "=", "0", ",", ")", ":", "import", "supriya", ".", "synthdefs", "calculation_rate", "=", "supriya", ".", "CalculationRate", ".", "AUDIO", "ugen", "=", "cls", ".", "_new_ex...
https://github.com/josiah-wolf-oberholtzer/supriya/blob/5ca725a6b97edfbe016a75666d420ecfdf49592f/dev/etc/pending_ugens/ModDif.py#L51-L80
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/wagtail/wagtailcore/permission_policies/base.py
python
AuthenticationOnlyPermissionPolicy.users_with_any_permission
(self, actions)
return get_user_model().objects.filter(is_active=True)
[]
def users_with_any_permission(self, actions): return get_user_model().objects.filter(is_active=True)
[ "def", "users_with_any_permission", "(", "self", ",", "actions", ")", ":", "return", "get_user_model", "(", ")", ".", "objects", ".", "filter", "(", "is_active", "=", "True", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/wagtail/wagtailcore/permission_policies/base.py#L159-L160
ultrabug/py3status
80ec45a9db0712b0de55f83291c321f6fceb6a6d
py3status/py3.py
python
Py3.check_commands
(self, cmd_list)
Checks to see if commands in list are available using shutil.which(). returns the first available command. If a string is passed then that command will be checked for.
Checks to see if commands in list are available using shutil.which().
[ "Checks", "to", "see", "if", "commands", "in", "list", "are", "available", "using", "shutil", ".", "which", "()", "." ]
def check_commands(self, cmd_list): """ Checks to see if commands in list are available using shutil.which(). returns the first available command. If a string is passed then that command will be checked for. """ # if a string is passed then convert it to a list. This p...
[ "def", "check_commands", "(", "self", ",", "cmd_list", ")", ":", "# if a string is passed then convert it to a list. This prevents an", "# easy mistake that could be made", "if", "isinstance", "(", "cmd_list", ",", "str", ")", ":", "cmd_list", "=", "[", "cmd_list", "]", ...
https://github.com/ultrabug/py3status/blob/80ec45a9db0712b0de55f83291c321f6fceb6a6d/py3status/py3.py#L929-L944
junsukchoe/ADL
dab2e78163bd96970ec9ae41de62835332dbf4fe
tensorpack/models/layer_norm.py
python
LayerNorm
( x, epsilon=1e-5, use_bias=True, use_scale=True, gamma_init=None, data_format='channels_last')
return ret
Layer Normalization layer, as described in the paper: `Layer Normalization <https://arxiv.org/abs/1607.06450>`_. Args: x (tf.Tensor): a 4D or 2D tensor. When 4D, the layout should match data_format. epsilon (float): epsilon to avoid divide-by-zero. use_scale, use_bias (bool): whether to...
Layer Normalization layer, as described in the paper: `Layer Normalization <https://arxiv.org/abs/1607.06450>`_.
[ "Layer", "Normalization", "layer", "as", "described", "in", "the", "paper", ":", "Layer", "Normalization", "<https", ":", "//", "arxiv", ".", "org", "/", "abs", "/", "1607", ".", "06450", ">", "_", "." ]
def LayerNorm( x, epsilon=1e-5, use_bias=True, use_scale=True, gamma_init=None, data_format='channels_last'): """ Layer Normalization layer, as described in the paper: `Layer Normalization <https://arxiv.org/abs/1607.06450>`_. Args: x (tf.Tensor): a 4D or 2D tensor. When...
[ "def", "LayerNorm", "(", "x", ",", "epsilon", "=", "1e-5", ",", "use_bias", "=", "True", ",", "use_scale", "=", "True", ",", "gamma_init", "=", "None", ",", "data_format", "=", "'channels_last'", ")", ":", "data_format", "=", "get_data_format", "(", "data_...
https://github.com/junsukchoe/ADL/blob/dab2e78163bd96970ec9ae41de62835332dbf4fe/tensorpack/models/layer_norm.py#L14-L63
huggingface/transformers
623b4f7c63f60cce917677ee704d6c93ee960b4b
templates/adding_a_new_example_script/{{cookiecutter.directory_name}}/run_{{cookiecutter.example_shortcut}}.py
python
main
()
[]
def main(): args = parse_args() # Initialize the accelerator. We will let the accelerator handle device placement for us in this example. accelerator = Accelerator() # Make one log on every process with the configuration for debugging. logging.basicConfig( format="%(asctime)s - %(levelname)...
[ "def", "main", "(", ")", ":", "args", "=", "parse_args", "(", ")", "# Initialize the accelerator. We will let the accelerator handle device placement for us in this example.", "accelerator", "=", "Accelerator", "(", ")", "# Make one log on every process with the configuration for deb...
https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/templates/adding_a_new_example_script/{{cookiecutter.directory_name}}/run_{{cookiecutter.example_shortcut}}.py#L661-L707
santatic/web2attack
44b6e481a3d56cf0d98073ae0fb69833dda563d9
w2a/modules/tools/export_2.py
python
Module.__init__
(self, *args, **kwargs)
[]
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) ############################ self.version = 1 self.author = ['Kid'] self.description = 'Sort data in file or directory' self.detailed_description = 'This module retreives sort and remove duplicate line...
[ "def", "__init__", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "super", "(", ")", ".", "__init__", "(", "*", "args", ",", "*", "*", "kwargs", ")", "############################", "self", ".", "version", "=", "1", "self", ".", ...
https://github.com/santatic/web2attack/blob/44b6e481a3d56cf0d98073ae0fb69833dda563d9/w2a/modules/tools/export_2.py#L11-L21
ricklupton/floweaver
1b2c66a3c41f77b7f165176d516ff6507bb1b34f
floweaver/augment_view_graph.py
python
elsewhere_bundles
(sankey_definition, add_elsewhere_waypoints=True)
return new_waypoints, new_bundles
Find new bundles and waypoints needed, so that every process group has a bundle to Elsewhere and a bundle from Elsewhere. If `add_elsewhere_waypoints` is True (the default), then new Waypoints are created for these Bundles to flow through. Otherwise, the Bundles are created without Waypoints, which wil...
Find new bundles and waypoints needed, so that every process group has a bundle to Elsewhere and a bundle from Elsewhere.
[ "Find", "new", "bundles", "and", "waypoints", "needed", "so", "that", "every", "process", "group", "has", "a", "bundle", "to", "Elsewhere", "and", "a", "bundle", "from", "Elsewhere", "." ]
def elsewhere_bundles(sankey_definition, add_elsewhere_waypoints=True): """Find new bundles and waypoints needed, so that every process group has a bundle to Elsewhere and a bundle from Elsewhere. If `add_elsewhere_waypoints` is True (the default), then new Waypoints are created for these Bundles to fl...
[ "def", "elsewhere_bundles", "(", "sankey_definition", ",", "add_elsewhere_waypoints", "=", "True", ")", ":", "# Build set of existing bundles to/from elsewhere.", "has_to_elsewhere", "=", "set", "(", ")", "has_from_elsewhere", "=", "set", "(", ")", "for", "bundle", "in"...
https://github.com/ricklupton/floweaver/blob/1b2c66a3c41f77b7f165176d516ff6507bb1b34f/floweaver/augment_view_graph.py#L5-L72
evennia/evennia
fa79110ba6b219932f22297838e8ac72ebc0be0e
evennia/comms/models.py
python
TempMsg.access
(self, accessing_obj, access_type="read", default=False)
return self.locks.check(accessing_obj, access_type=access_type, default=default)
Checks lock access. Args: accessing_obj (Object or Account): The object trying to gain access. access_type (str, optional): The type of lock access to check. default (bool): Fallback to use if `access_type` lock is not defined. Returns: result (bool): If...
Checks lock access.
[ "Checks", "lock", "access", "." ]
def access(self, accessing_obj, access_type="read", default=False): """ Checks lock access. Args: accessing_obj (Object or Account): The object trying to gain access. access_type (str, optional): The type of lock access to check. default (bool): Fallback to u...
[ "def", "access", "(", "self", ",", "accessing_obj", ",", "access_type", "=", "\"read\"", ",", "default", "=", "False", ")", ":", "return", "self", ".", "locks", ".", "check", "(", "accessing_obj", ",", "access_type", "=", "access_type", ",", "default", "="...
https://github.com/evennia/evennia/blob/fa79110ba6b219932f22297838e8ac72ebc0be0e/evennia/comms/models.py#L519-L532
makerbot/ReplicatorG
d6f2b07785a5a5f1e172fb87cb4303b17c575d5d
skein_engines/skeinforge-35/fabmetheus_utilities/geometry/geometry_utilities/evaluate.py
python
Evaluator.executeBracket
( self, bracketBeginIndex, bracketEndIndex, evaluators )
Execute the bracket.
Execute the bracket.
[ "Execute", "the", "bracket", "." ]
def executeBracket( self, bracketBeginIndex, bracketEndIndex, evaluators ): 'Execute the bracket.' pass
[ "def", "executeBracket", "(", "self", ",", "bracketBeginIndex", ",", "bracketEndIndex", ",", "evaluators", ")", ":", "pass" ]
https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-35/fabmetheus_utilities/geometry/geometry_utilities/evaluate.py#L962-L964
reddit-archive/reddit
753b17407e9a9dca09558526805922de24133d53
r2/r2/models/link.py
python
Comment.link_slow
(self)
return Link._byID(self.link_id, data=True, return_dict=False)
Fetch a comment's Link and return it. In most cases the Link is already on the wrapped comment (as .link), and that should be used when possible.
Fetch a comment's Link and return it.
[ "Fetch", "a", "comment", "s", "Link", "and", "return", "it", "." ]
def link_slow(self): """Fetch a comment's Link and return it. In most cases the Link is already on the wrapped comment (as .link), and that should be used when possible. """ return Link._byID(self.link_id, data=True, return_dict=False)
[ "def", "link_slow", "(", "self", ")", ":", "return", "Link", ".", "_byID", "(", "self", ".", "link_id", ",", "data", "=", "True", ",", "return_dict", "=", "False", ")" ]
https://github.com/reddit-archive/reddit/blob/753b17407e9a9dca09558526805922de24133d53/r2/r2/models/link.py#L1453-L1459
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/lib-python/3/reprlib.py
python
Repr.repr_int
(self, x, level)
return s
[]
def repr_int(self, x, level): s = builtins.repr(x) # XXX Hope this isn't too slow... if len(s) > self.maxlong: i = max(0, (self.maxlong-3)//2) j = max(0, self.maxlong-3-i) s = s[:i] + '...' + s[len(s)-j:] return s
[ "def", "repr_int", "(", "self", ",", "x", ",", "level", ")", ":", "s", "=", "builtins", ".", "repr", "(", "x", ")", "# XXX Hope this isn't too slow...", "if", "len", "(", "s", ")", ">", "self", ".", "maxlong", ":", "i", "=", "max", "(", "0", ",", ...
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/reprlib.py#L129-L135
kozec/sc-controller
ce92c773b8b26f6404882e9209aff212c4053170
scc/lib/usb1.py
python
USBDevice.__init__
(self, context, device_p, can_load_configuration=True)
You should not instanciate this class directly. Call USBContext methods to receive instances of this class.
You should not instanciate this class directly. Call USBContext methods to receive instances of this class.
[ "You", "should", "not", "instanciate", "this", "class", "directly", ".", "Call", "USBContext", "methods", "to", "receive", "instances", "of", "this", "class", "." ]
def __init__(self, context, device_p, can_load_configuration=True): """ You should not instanciate this class directly. Call USBContext methods to receive instances of this class. """ self.__context = context self.__close_set = WeakSet() libusb1.libusb_ref_device(...
[ "def", "__init__", "(", "self", ",", "context", ",", "device_p", ",", "can_load_configuration", "=", "True", ")", ":", "self", ".", "__context", "=", "context", "self", ".", "__close_set", "=", "WeakSet", "(", ")", "libusb1", ".", "libusb_ref_device", "(", ...
https://github.com/kozec/sc-controller/blob/ce92c773b8b26f6404882e9209aff212c4053170/scc/lib/usb1.py#L1679-L1711
plotly/plotly.py
cfad7862594b35965c0e000813bd7805e8494a5b
packages/python/plotly/plotly/graph_objs/parcats/line/_colorbar.py
python
ColorBar.ticks
(self)
return self["ticks"]
Determines whether ticks are drawn or not. If "", this axis' ticks are not drawn. If "outside" ("inside"), this axis' are drawn outside (inside) the axis lines. The 'ticks' property is an enumeration that may be specified as: - One of the following enumeration values: ...
Determines whether ticks are drawn or not. If "", this axis' ticks are not drawn. If "outside" ("inside"), this axis' are drawn outside (inside) the axis lines. The 'ticks' property is an enumeration that may be specified as: - One of the following enumeration values: ...
[ "Determines", "whether", "ticks", "are", "drawn", "or", "not", ".", "If", "this", "axis", "ticks", "are", "not", "drawn", ".", "If", "outside", "(", "inside", ")", "this", "axis", "are", "drawn", "outside", "(", "inside", ")", "the", "axis", "lines", "...
def ticks(self): """ Determines whether ticks are drawn or not. If "", this axis' ticks are not drawn. If "outside" ("inside"), this axis' are drawn outside (inside) the axis lines. The 'ticks' property is an enumeration that may be specified as: - One of the follo...
[ "def", "ticks", "(", "self", ")", ":", "return", "self", "[", "\"ticks\"", "]" ]
https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/parcats/line/_colorbar.py#L996-L1010
pventuzelo/octopus
e8b8c5a9d5f6d9c63605afe9ef1528ab481ec983
octopus/arch/wasm/cfg.py
python
enum_func_call_edges
(functions, len_imports)
return call_edges
return a list of tuple with (index_func_node_from, index_func_node_to)
return a list of tuple with (index_func_node_from, index_func_node_to)
[ "return", "a", "list", "of", "tuple", "with", "(", "index_func_node_from", "index_func_node_to", ")" ]
def enum_func_call_edges(functions, len_imports): ''' return a list of tuple with (index_func_node_from, index_func_node_to) ''' call_edges = list() # iterate over functions for index, func in enumerate(functions): node_from = len_imports + index # iterates over instruction ...
[ "def", "enum_func_call_edges", "(", "functions", ",", "len_imports", ")", ":", "call_edges", "=", "list", "(", ")", "# iterate over functions", "for", "index", ",", "func", "in", "enumerate", "(", "functions", ")", ":", "node_from", "=", "len_imports", "+", "i...
https://github.com/pventuzelo/octopus/blob/e8b8c5a9d5f6d9c63605afe9ef1528ab481ec983/octopus/arch/wasm/cfg.py#L74-L105
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/blueprint/importer.py
python
_get_github_import_url
(url: str)
return f"https://raw.githubusercontent.com/{repo}/{path}"
Convert a GitHub url to the raw content. Async friendly.
Convert a GitHub url to the raw content.
[ "Convert", "a", "GitHub", "url", "to", "the", "raw", "content", "." ]
def _get_github_import_url(url: str) -> str: """Convert a GitHub url to the raw content. Async friendly. """ if url.startswith("https://raw.githubusercontent.com/"): return url if (match := GITHUB_FILE_PATTERN.match(url)) is None: raise UnsupportedUrl("Not a GitHub file url") ...
[ "def", "_get_github_import_url", "(", "url", ":", "str", ")", "->", "str", ":", "if", "url", ".", "startswith", "(", "\"https://raw.githubusercontent.com/\"", ")", ":", "return", "url", "if", "(", "match", ":=", "GITHUB_FILE_PATTERN", ".", "match", "(", "url",...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/blueprint/importer.py#L54-L67
plotly/plotly.py
cfad7862594b35965c0e000813bd7805e8494a5b
packages/python/plotly/plotly/matplotlylib/mplexporter/exporter.py
python
Exporter.draw_patch
(self, ax, patch, force_trans=None)
Process a matplotlib patch object and call renderer.draw_path
Process a matplotlib patch object and call renderer.draw_path
[ "Process", "a", "matplotlib", "patch", "object", "and", "call", "renderer", ".", "draw_path" ]
def draw_patch(self, ax, patch, force_trans=None): """Process a matplotlib patch object and call renderer.draw_path""" vertices, pathcodes = utils.SVG_path(patch.get_path()) transform = patch.get_transform() coordinates, vertices = self.process_transform( transform, ax, verti...
[ "def", "draw_patch", "(", "self", ",", "ax", ",", "patch", ",", "force_trans", "=", "None", ")", ":", "vertices", ",", "pathcodes", "=", "utils", ".", "SVG_path", "(", "patch", ".", "get_path", "(", ")", ")", "transform", "=", "patch", ".", "get_transf...
https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/matplotlylib/mplexporter/exporter.py#L233-L247
stanfordnlp/stanza
e44d1c88340e33bf9813e6f5a6bd24387eefc4b2
stanza/models/classifiers/cnn_classifier.py
python
CNNClassifier.__init__
(self, pretrain, extra_vocab, labels, charmodel_forward, charmodel_backward, args)
pretrain is a pretrained word embedding. should have .emb and .vocab extra_vocab is a collection of words in the training data to be used for the delta word embedding, if used. can be set to None if delta word embedding is not used. labels is the list of labels we expect in the train...
pretrain is a pretrained word embedding. should have .emb and .vocab
[ "pretrain", "is", "a", "pretrained", "word", "embedding", ".", "should", "have", ".", "emb", "and", ".", "vocab" ]
def __init__(self, pretrain, extra_vocab, labels, charmodel_forward, charmodel_backward, args): """ pretrain is a pretrained word embedding. should have .emb and .vocab extra_vocab is a collection of words in the training data to be used for the delta ...
[ "def", "__init__", "(", "self", ",", "pretrain", ",", "extra_vocab", ",", "labels", ",", "charmodel_forward", ",", "charmodel_backward", ",", "args", ")", ":", "super", "(", "CNNClassifier", ",", "self", ")", ".", "__init__", "(", ")", "self", ".", "labels...
https://github.com/stanfordnlp/stanza/blob/e44d1c88340e33bf9813e6f5a6bd24387eefc4b2/stanza/models/classifiers/cnn_classifier.py#L44-L170
CouchPotato/CouchPotatoServer
7260c12f72447ddb6f062367c6dfbda03ecd4e9c
libs/tornado/platform/interface.py
python
Waker.close
(self)
Closes the waker's file descriptor(s).
Closes the waker's file descriptor(s).
[ "Closes", "the", "waker", "s", "file", "descriptor", "(", "s", ")", "." ]
def close(self): """Closes the waker's file descriptor(s).""" raise NotImplementedError()
[ "def", "close", "(", "self", ")", ":", "raise", "NotImplementedError", "(", ")" ]
https://github.com/CouchPotato/CouchPotatoServer/blob/7260c12f72447ddb6f062367c6dfbda03ecd4e9c/libs/tornado/platform/interface.py#L61-L63
plotly/plotly.py
cfad7862594b35965c0e000813bd7805e8494a5b
packages/python/plotly/plotly/graph_objs/_funnel.py
python
Funnel.yaxis
(self)
return self["yaxis"]
Sets a reference between this trace's y coordinates and a 2D cartesian y axis. If "y" (the default value), the y coordinates refer to `layout.yaxis`. If "y2", the y coordinates refer to `layout.yaxis2`, and so on. The 'yaxis' property is an identifier of a particular subplot...
Sets a reference between this trace's y coordinates and a 2D cartesian y axis. If "y" (the default value), the y coordinates refer to `layout.yaxis`. If "y2", the y coordinates refer to `layout.yaxis2`, and so on. The 'yaxis' property is an identifier of a particular subplot...
[ "Sets", "a", "reference", "between", "this", "trace", "s", "y", "coordinates", "and", "a", "2D", "cartesian", "y", "axis", ".", "If", "y", "(", "the", "default", "value", ")", "the", "y", "coordinates", "refer", "to", "layout", ".", "yaxis", ".", "If",...
def yaxis(self): """ Sets a reference between this trace's y coordinates and a 2D cartesian y axis. If "y" (the default value), the y coordinates refer to `layout.yaxis`. If "y2", the y coordinates refer to `layout.yaxis2`, and so on. The 'yaxis' property is an ident...
[ "def", "yaxis", "(", "self", ")", ":", "return", "self", "[", "\"yaxis\"", "]" ]
https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/_funnel.py#L1678-L1694
microsoft/unilm
65f15af2a307ebb64cfb25adf54375b002e6fe8d
infoxlm/fairseq/fairseq/models/fairseq_model.py
python
FairseqEncoderDecoderModel.extract_features
(self, src_tokens, src_lengths, prev_output_tokens, **kwargs)
return features
Similar to *forward* but only return features. Returns: tuple: - the decoder's features of shape `(batch, tgt_len, embed_dim)` - a dictionary with any model-specific outputs
Similar to *forward* but only return features.
[ "Similar", "to", "*", "forward", "*", "but", "only", "return", "features", "." ]
def extract_features(self, src_tokens, src_lengths, prev_output_tokens, **kwargs): """ Similar to *forward* but only return features. Returns: tuple: - the decoder's features of shape `(batch, tgt_len, embed_dim)` - a dictionary with any model-specifi...
[ "def", "extract_features", "(", "self", ",", "src_tokens", ",", "src_lengths", ",", "prev_output_tokens", ",", "*", "*", "kwargs", ")", ":", "encoder_out", "=", "self", ".", "encoder", "(", "src_tokens", ",", "src_lengths", "=", "src_lengths", ",", "*", "*",...
https://github.com/microsoft/unilm/blob/65f15af2a307ebb64cfb25adf54375b002e6fe8d/infoxlm/fairseq/fairseq/models/fairseq_model.py#L230-L241
emesene/emesene
4548a4098310e21b16437bb36223a7f632a4f7bc
emesene/e3/papylib/papyon/papyon/service/AddressBook/scenario/contacts/block_contact.py
python
BlockContactScenario.__init__
(self, sharing, callback, errback, account='', network=NetworkID.MSN, membership=Membership.NONE, state='Accepted')
Blocks a contact. @param sharing: the membership service @param callback: tuple(callable, *args) @param errback: tuple(callable, *args)
Blocks a contact.
[ "Blocks", "a", "contact", "." ]
def __init__(self, sharing, callback, errback, account='', network=NetworkID.MSN, membership=Membership.NONE, state='Accepted'): """Blocks a contact. @param sharing: the membership service @param callback: tuple(callable, *args) @param errba...
[ "def", "__init__", "(", "self", ",", "sharing", ",", "callback", ",", "errback", ",", "account", "=", "''", ",", "network", "=", "NetworkID", ".", "MSN", ",", "membership", "=", "Membership", ".", "NONE", ",", "state", "=", "'Accepted'", ")", ":", "Bas...
https://github.com/emesene/emesene/blob/4548a4098310e21b16437bb36223a7f632a4f7bc/emesene/e3/papylib/papyon/papyon/service/AddressBook/scenario/contacts/block_contact.py#L29-L44
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/cwp/v20180228/models.py
python
DescribeLogStorageStatisticResponse.__init__
(self)
r""" :param TotalSize: 总容量(单位:GB) :type TotalSize: int :param UsedSize: 已使用容量(单位:GB) :type UsedSize: int :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str
r""" :param TotalSize: 总容量(单位:GB) :type TotalSize: int :param UsedSize: 已使用容量(单位:GB) :type UsedSize: int :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str
[ "r", ":", "param", "TotalSize", ":", "总容量(单位:GB)", ":", "type", "TotalSize", ":", "int", ":", "param", "UsedSize", ":", "已使用容量(单位:GB)", ":", "type", "UsedSize", ":", "int", ":", "param", "RequestId", ":", "唯一请求", "ID,每次请求都会返回。定位问题时需要提供该次请求的", "RequestId。", ":"...
def __init__(self): r""" :param TotalSize: 总容量(单位:GB) :type TotalSize: int :param UsedSize: 已使用容量(单位:GB) :type UsedSize: int :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str """ self.TotalSize = None self.Us...
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "TotalSize", "=", "None", "self", ".", "UsedSize", "=", "None", "self", ".", "RequestId", "=", "None" ]
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/cwp/v20180228/models.py#L9481-L9492
kaaedit/kaa
e6a8819a5ecba04b7db8303bd5736b5a7c9b822d
kaa/commands/toolcommand.py
python
ToolCommands.spellchecker
(self, wnd)
[]
def spellchecker(self, wnd): try: pass except ImportError: kaa.app.messagebar.set_message( 'PyEnchant module is not installed.') return from kaa.ui.spellchecker import spellcheckermode spellcheckermode.run_spellchecker(wnd)
[ "def", "spellchecker", "(", "self", ",", "wnd", ")", ":", "try", ":", "pass", "except", "ImportError", ":", "kaa", ".", "app", ".", "messagebar", ".", "set_message", "(", "'PyEnchant module is not installed.'", ")", "return", "from", "kaa", ".", "ui", ".", ...
https://github.com/kaaedit/kaa/blob/e6a8819a5ecba04b7db8303bd5736b5a7c9b822d/kaa/commands/toolcommand.py#L161-L170
seathiefwang/MGN-pytorch
384e82002e40b71157506e23d71e6709fa830757
utils/n_adam.py
python
NAdam.step
(self, closure=None)
return loss
Performs a single optimization step. Arguments: closure (callable, optional): A closure that reevaluates the model and returns the loss.
Performs a single optimization step. Arguments: closure (callable, optional): A closure that reevaluates the model and returns the loss.
[ "Performs", "a", "single", "optimization", "step", ".", "Arguments", ":", "closure", "(", "callable", "optional", ")", ":", "A", "closure", "that", "reevaluates", "the", "model", "and", "returns", "the", "loss", "." ]
def step(self, closure=None): """Performs a single optimization step. Arguments: closure (callable, optional): A closure that reevaluates the model and returns the loss. """ loss = None if closure is not None: loss = closure() for ...
[ "def", "step", "(", "self", ",", "closure", "=", "None", ")", ":", "loss", "=", "None", "if", "closure", "is", "not", "None", ":", "loss", "=", "closure", "(", ")", "for", "group", "in", "self", ".", "param_groups", ":", "for", "p", "in", "group", ...
https://github.com/seathiefwang/MGN-pytorch/blob/384e82002e40b71157506e23d71e6709fa830757/utils/n_adam.py#L56-L122
django-haystack/django-haystack
b6dd72e6b5c97b782f5436b7bb4e8227ba6e3b06
haystack/utils/loading.py
python
UnifiedIndex.collect_indexes
(self)
return indexes
[]
def collect_indexes(self): indexes = [] for app_mod in haystack_get_app_modules(): try: search_index_module = importlib.import_module( "%s.search_indexes" % app_mod.__name__ ) except ImportError: if module_has_s...
[ "def", "collect_indexes", "(", "self", ")", ":", "indexes", "=", "[", "]", "for", "app_mod", "in", "haystack_get_app_modules", "(", ")", ":", "try", ":", "search_index_module", "=", "importlib", ".", "import_module", "(", "\"%s.search_indexes\"", "%", "app_mod",...
https://github.com/django-haystack/django-haystack/blob/b6dd72e6b5c97b782f5436b7bb4e8227ba6e3b06/haystack/utils/loading.py#L196-L228
maas/maas
db2f89970c640758a51247c59bf1ec6f60cf4ab5
src/maasserver/node_action.py
python
Unlock.get_node_action_audit_description
(self, action)
return self.audit_description % action.node.hostname
Retrieve the node action audit description.
Retrieve the node action audit description.
[ "Retrieve", "the", "node", "action", "audit", "description", "." ]
def get_node_action_audit_description(self, action): """Retrieve the node action audit description.""" return self.audit_description % action.node.hostname
[ "def", "get_node_action_audit_description", "(", "self", ",", "action", ")", ":", "return", "self", ".", "audit_description", "%", "action", ".", "node", ".", "hostname" ]
https://github.com/maas/maas/blob/db2f89970c640758a51247c59bf1ec6f60cf4ab5/src/maasserver/node_action.py#L800-L802
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/cwp/v20180228/models.py
python
DescribeVulTopRequest.__init__
(self)
r""" :param Top: 漏洞风险服务器top,1-100 :type Top: int :param VulCategory: 1:web-cms 漏洞,2.应用漏洞 3:安全基线 4: Linux软件漏洞 5: windows系统漏洞 6:应急漏洞 :type VulCategory: int
r""" :param Top: 漏洞风险服务器top,1-100 :type Top: int :param VulCategory: 1:web-cms 漏洞,2.应用漏洞 3:安全基线 4: Linux软件漏洞 5: windows系统漏洞 6:应急漏洞 :type VulCategory: int
[ "r", ":", "param", "Top", ":", "漏洞风险服务器top,1", "-", "100", ":", "type", "Top", ":", "int", ":", "param", "VulCategory", ":", "1", ":", "web", "-", "cms", "漏洞,2", ".", "应用漏洞", "3", ":", "安全基线", "4", ":", "Linux软件漏洞", "5", ":", "windows系统漏洞", "6", ...
def __init__(self): r""" :param Top: 漏洞风险服务器top,1-100 :type Top: int :param VulCategory: 1:web-cms 漏洞,2.应用漏洞 3:安全基线 4: Linux软件漏洞 5: windows系统漏洞 6:应急漏洞 :type VulCategory: int """ self.Top = None self.VulCategory = None
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "Top", "=", "None", "self", ".", "VulCategory", "=", "None" ]
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/cwp/v20180228/models.py#L13149-L13157
aws/aws-sam-cli
2aa7bf01b2e0b0864ef63b1898a8b30577443acc
samcli/cli/global_config.py
python
GlobalConfig.set_value
(self, config_entry: ConfigEntry, value: Any, is_flag: bool = False, flush: bool = True)
Set the value of a configuration. The associated env var will be updated as well. Parameters ---------- config_entry : ConfigEntry Configuration entry to be set value : Any Value of the configuration is_flag : bool, optional If is_flag is True...
Set the value of a configuration. The associated env var will be updated as well.
[ "Set", "the", "value", "of", "a", "configuration", ".", "The", "associated", "env", "var", "will", "be", "updated", "as", "well", "." ]
def set_value(self, config_entry: ConfigEntry, value: Any, is_flag: bool = False, flush: bool = True) -> None: """Set the value of a configuration. The associated env var will be updated as well. Parameters ---------- config_entry : ConfigEntry Configuration entry to be set ...
[ "def", "set_value", "(", "self", ",", "config_entry", ":", "ConfigEntry", ",", "value", ":", "Any", ",", "is_flag", ":", "bool", "=", "False", ",", "flush", ":", "bool", "=", "True", ")", "->", "None", ":", "with", "self", ".", "_access_lock", ":", "...
https://github.com/aws/aws-sam-cli/blob/2aa7bf01b2e0b0864ef63b1898a8b30577443acc/samcli/cli/global_config.py#L255-L273
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/celery/worker/loops.py
python
asynloop
(obj, connection, consumer, blueprint, hub, qos, heartbeat, clock, hbrate=2.0)
Non-blocking event loop.
Non-blocking event loop.
[ "Non", "-", "blocking", "event", "loop", "." ]
def asynloop(obj, connection, consumer, blueprint, hub, qos, heartbeat, clock, hbrate=2.0): """Non-blocking event loop.""" RUN = bootsteps.RUN update_qos = qos.update errors = connection.connection_errors on_task_received = obj.create_task_handler() _enable_amqheartbeats(hub.timer...
[ "def", "asynloop", "(", "obj", ",", "connection", ",", "consumer", ",", "blueprint", ",", "hub", ",", "qos", ",", "heartbeat", ",", "clock", ",", "hbrate", "=", "2.0", ")", ":", "RUN", "=", "bootsteps", ".", "RUN", "update_qos", "=", "qos", ".", "upd...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/celery/worker/loops.py#L35-L96
intel/CeTune
fdc523971dc6d52cbbefb24ff9504fdc934b31ca
visualizer/excel_summary_generator.py
python
getChart
(fileObj, ci)
return chars
[]
def getChart(fileObj, ci): chars = [] #CPU char tmpChart1 = fileObj.add_chart({'type': 'column', 'subtype': 'stacked'}) tmpChart1.add_series({ 'name': ['Detail', ci+1, 2], 'categories': ['Detail', ci, 3, ci, 5], 'values': ['Detail', ci + 1, 3, ci + 1, 5], }) tmpChart1.add...
[ "def", "getChart", "(", "fileObj", ",", "ci", ")", ":", "chars", "=", "[", "]", "#CPU char", "tmpChart1", "=", "fileObj", ".", "add_chart", "(", "{", "'type'", ":", "'column'", ",", "'subtype'", ":", "'stacked'", "}", ")", "tmpChart1", ".", "add_series",...
https://github.com/intel/CeTune/blob/fdc523971dc6d52cbbefb24ff9504fdc934b31ca/visualizer/excel_summary_generator.py#L60-L238
facelessuser/ColorHelper
cfed17c35dbae4db49a14165ef222407c48a3014
lib/coloraide/spaces/luv.py
python
Luv.v
(self)
return self._coords[2]
V channel.
V channel.
[ "V", "channel", "." ]
def v(self) -> float: """V channel.""" return self._coords[2]
[ "def", "v", "(", "self", ")", "->", "float", ":", "return", "self", ".", "_coords", "[", "2", "]" ]
https://github.com/facelessuser/ColorHelper/blob/cfed17c35dbae4db49a14165ef222407c48a3014/lib/coloraide/spaces/luv.py#L98-L101
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
SecurityContextConstraints.groups
(self)
return self._groups
groups property getter
groups property getter
[ "groups", "property", "getter" ]
def groups(self): ''' groups property getter ''' if self._groups is None: self._groups = self.get_groups() return self._groups
[ "def", "groups", "(", "self", ")", ":", "if", "self", ".", "_groups", "is", "None", ":", "self", ".", "_groups", "=", "self", ".", "get_groups", "(", ")", "return", "self", ".", "_groups" ]
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#L1886-L1890
natashamjaques/neural_chat
ddb977bb4602a67c460d02231e7bbf7b2cb49a97
ParlAI/parlai/agents/tfidf_retriever/build_tfidf.py
python
get_count_matrix
(args, db_opts)
return count_matrix
Form a sparse word to document count matrix (inverted index). M[i, j] = # times word i appears in document j.
Form a sparse word to document count matrix (inverted index).
[ "Form", "a", "sparse", "word", "to", "document", "count", "matrix", "(", "inverted", "index", ")", "." ]
def get_count_matrix(args, db_opts): """Form a sparse word to document count matrix (inverted index). M[i, j] = # times word i appears in document j. """ global MAX_SZ with DocDB(**db_opts) as doc_db: doc_ids = doc_db.get_doc_ids() # Setup worker pool tok_class = tokenizers.get_cla...
[ "def", "get_count_matrix", "(", "args", ",", "db_opts", ")", ":", "global", "MAX_SZ", "with", "DocDB", "(", "*", "*", "db_opts", ")", "as", "doc_db", ":", "doc_ids", "=", "doc_db", ".", "get_doc_ids", "(", ")", "# Setup worker pool", "tok_class", "=", "tok...
https://github.com/natashamjaques/neural_chat/blob/ddb977bb4602a67c460d02231e7bbf7b2cb49a97/ParlAI/parlai/agents/tfidf_retriever/build_tfidf.py#L197-L239
DSE-MSU/DeepRobust
2bcde200a5969dae32cddece66206a52c87c43e8
deeprobust/graph/data/dataset.py
python
Dataset.download_file
(self, url, file)
[]
def download_file(self, url, file): print('Dowloading from {} to {}'.format(url, file)) try: urllib.request.urlretrieve(url, file) except: raise Exception("Download failed! Make sure you have \ stable Internet connection and enter the right name")
[ "def", "download_file", "(", "self", ",", "url", ",", "file", ")", ":", "print", "(", "'Dowloading from {} to {}'", ".", "format", "(", "url", ",", "file", ")", ")", "try", ":", "urllib", ".", "request", ".", "urlretrieve", "(", "url", ",", "file", ")"...
https://github.com/DSE-MSU/DeepRobust/blob/2bcde200a5969dae32cddece66206a52c87c43e8/deeprobust/graph/data/dataset.py#L118-L124
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/sphinx/sphinx/ext/autodoc.py
python
Documenter.get_doc
(self, encoding=None, ignore=1)
return []
Decode and return lines of the docstring(s) for the object.
Decode and return lines of the docstring(s) for the object.
[ "Decode", "and", "return", "lines", "of", "the", "docstring", "(", "s", ")", "for", "the", "object", "." ]
def get_doc(self, encoding=None, ignore=1): """Decode and return lines of the docstring(s) for the object.""" docstring = self.get_attr(self.object, '__doc__', None) # make sure we have Unicode docstrings, then sanitize and split # into lines if isinstance(docstring, unicode): ...
[ "def", "get_doc", "(", "self", ",", "encoding", "=", "None", ",", "ignore", "=", "1", ")", ":", "docstring", "=", "self", ".", "get_attr", "(", "self", ".", "object", ",", "'__doc__'", ",", "None", ")", "# make sure we have Unicode docstrings, then sanitize an...
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/sphinx/sphinx/ext/autodoc.py#L446-L456
meduza-corp/interstellar
40a801ccd7856491726f5a126621d9318cabe2e1
gsutil/gslib/boto_translation.py
python
BotoTranslation._AddPreconditionsToHeaders
(self, preconditions, headers)
Adds preconditions (if any) to headers.
Adds preconditions (if any) to headers.
[ "Adds", "preconditions", "(", "if", "any", ")", "to", "headers", "." ]
def _AddPreconditionsToHeaders(self, preconditions, headers): """Adds preconditions (if any) to headers.""" if preconditions and self.provider == 'gs': if preconditions.gen_match is not None: headers['x-goog-if-generation-match'] = preconditions.gen_match if preconditions.meta_gen_match is n...
[ "def", "_AddPreconditionsToHeaders", "(", "self", ",", "preconditions", ",", "headers", ")", ":", "if", "preconditions", "and", "self", ".", "provider", "==", "'gs'", ":", "if", "preconditions", ".", "gen_match", "is", "not", "None", ":", "headers", "[", "'x...
https://github.com/meduza-corp/interstellar/blob/40a801ccd7856491726f5a126621d9318cabe2e1/gsutil/gslib/boto_translation.py#L952-L958
oracle/oci-python-sdk
3c1604e4e212008fb6718e2f68cdb5ef71fd5793
examples/showoci/showoci_output.py
python
ShowOCIOutput.__print_database_db_exacc_infra
(self, list_exadata)
[]
def __print_database_db_exacc_infra(self, list_exadata): try: for dbs in list_exadata: print("") print(self.taba + "ExaCC : " + dbs['name']) print(self.tabs + "Created : " + dbs['time_created'][0:16]) if 'cpus_enabled...
[ "def", "__print_database_db_exacc_infra", "(", "self", ",", "list_exadata", ")", ":", "try", ":", "for", "dbs", "in", "list_exadata", ":", "print", "(", "\"\"", ")", "print", "(", "self", ".", "taba", "+", "\"ExaCC : \"", "+", "dbs", "[", "'name'", ...
https://github.com/oracle/oci-python-sdk/blob/3c1604e4e212008fb6718e2f68cdb5ef71fd5793/examples/showoci/showoci_output.py#L1136-L1254
huggingface/datasets
249b4a38390bf1543f5b6e2f3dc208b5689c1c13
src/datasets/features/features.py
python
list_of_np_array_to_pyarrow_listarray
(l_arr: List[np.ndarray], type: pa.DataType = None)
Build a PyArrow ListArray from a possibly nested list of NumPy arrays
Build a PyArrow ListArray from a possibly nested list of NumPy arrays
[ "Build", "a", "PyArrow", "ListArray", "from", "a", "possibly", "nested", "list", "of", "NumPy", "arrays" ]
def list_of_np_array_to_pyarrow_listarray(l_arr: List[np.ndarray], type: pa.DataType = None) -> pa.ListArray: """Build a PyArrow ListArray from a possibly nested list of NumPy arrays""" if len(l_arr) > 0: return list_of_pa_arrays_to_pyarrow_listarray( [numpy_to_pyarrow_listarray(arr, type=ty...
[ "def", "list_of_np_array_to_pyarrow_listarray", "(", "l_arr", ":", "List", "[", "np", ".", "ndarray", "]", ",", "type", ":", "pa", ".", "DataType", "=", "None", ")", "->", "pa", ".", "ListArray", ":", "if", "len", "(", "l_arr", ")", ">", "0", ":", "r...
https://github.com/huggingface/datasets/blob/249b4a38390bf1543f5b6e2f3dc208b5689c1c13/src/datasets/features/features.py#L993-L1000
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/twisted/twisted/internet/win32eventreactor.py
python
Win32Reactor.removeWriter
(self, writer)
Remove a Selectable for notification of data available to write.
Remove a Selectable for notification of data available to write.
[ "Remove", "a", "Selectable", "for", "notification", "of", "data", "available", "to", "write", "." ]
def removeWriter(self, writer): """Remove a Selectable for notification of data available to write. """ if writer in self._writes: del self._writes[writer]
[ "def", "removeWriter", "(", "self", ",", "writer", ")", ":", "if", "writer", "in", "self", ".", "_writes", ":", "del", "self", ".", "_writes", "[", "writer", "]" ]
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/twisted/twisted/internet/win32eventreactor.py#L143-L147
gramps-project/gramps
04d4651a43eb210192f40a9f8c2bad8ee8fa3753
gramps/plugins/webreport/repository.py
python
RepositoryPages.display_pages
(self, the_lang, the_title)
Generate and output the pages under the Repository tab, namely the repository index and the individual repository pages. @param: the_lang -- The lang to process @param: the_title -- The title page related to the language
Generate and output the pages under the Repository tab, namely the repository index and the individual repository pages.
[ "Generate", "and", "output", "the", "pages", "under", "the", "Repository", "tab", "namely", "the", "repository", "index", "and", "the", "individual", "repository", "pages", "." ]
def display_pages(self, the_lang, the_title): """ Generate and output the pages under the Repository tab, namely the repository index and the individual repository pages. @param: the_lang -- The lang to process @param: the_title -- The title page related to the language ...
[ "def", "display_pages", "(", "self", ",", "the_lang", ",", "the_title", ")", ":", "LOG", ".", "debug", "(", "\"obj_dict[Person]\"", ")", "for", "item", "in", "self", ".", "report", ".", "obj_dict", "[", "Repository", "]", ".", "items", "(", ")", ":", "...
https://github.com/gramps-project/gramps/blob/04d4651a43eb210192f40a9f8c2bad8ee8fa3753/gramps/plugins/webreport/repository.py#L92-L129
django-nonrel/django-nonrel
4fbfe7344481a5eab8698f79207f09124310131b
django/core/management/color.py
python
color_style
()
return style
Returns a Style object with the Django color scheme.
Returns a Style object with the Django color scheme.
[ "Returns", "a", "Style", "object", "with", "the", "Django", "color", "scheme", "." ]
def color_style(): """Returns a Style object with the Django color scheme.""" if not supports_color(): style = no_style() else: DJANGO_COLORS = os.environ.get('DJANGO_COLORS', '') color_settings = termcolors.parse_color_setting(DJANGO_COLORS) if color_settings: cl...
[ "def", "color_style", "(", ")", ":", "if", "not", "supports_color", "(", ")", ":", "style", "=", "no_style", "(", ")", "else", ":", "DJANGO_COLORS", "=", "os", ".", "environ", ".", "get", "(", "'DJANGO_COLORS'", ",", "''", ")", "color_settings", "=", "...
https://github.com/django-nonrel/django-nonrel/blob/4fbfe7344481a5eab8698f79207f09124310131b/django/core/management/color.py#L22-L43
skorch-dev/skorch
cf6615be4e62a16af6f8d83a47e8b59b5c48a58c
skorch/callbacks/scoring.py
python
_cache_net_forward_iter
(net, use_caching, y_preds)
Caching context for ``skorch.NeuralNet`` instance. Returns a modified version of the net whose ``forward_iter`` method will subsequently return cached predictions. Leaving the context will undo the overwrite of the ``forward_iter`` method.
Caching context for ``skorch.NeuralNet`` instance.
[ "Caching", "context", "for", "skorch", ".", "NeuralNet", "instance", "." ]
def _cache_net_forward_iter(net, use_caching, y_preds): """Caching context for ``skorch.NeuralNet`` instance. Returns a modified version of the net whose ``forward_iter`` method will subsequently return cached predictions. Leaving the context will undo the overwrite of the ``forward_iter`` method. ...
[ "def", "_cache_net_forward_iter", "(", "net", ",", "use_caching", ",", "y_preds", ")", ":", "if", "not", "use_caching", ":", "yield", "net", "return", "y_preds", "=", "iter", "(", "y_preds", ")", "# pylint: disable=unused-argument", "def", "cached_forward_iter", "...
https://github.com/skorch-dev/skorch/blob/cf6615be4e62a16af6f8d83a47e8b59b5c48a58c/skorch/callbacks/scoring.py#L65-L91
caiiiac/Machine-Learning-with-Python
1a26c4467da41ca4ebc3d5bd789ea942ef79422f
MachineLearning/venv/lib/python3.5/site-packages/pandas/core/indexing.py
python
_LocationIndexer._get_slice_axis
(self, slice_obj, axis=0)
this is pretty simple as we just have to deal with labels
this is pretty simple as we just have to deal with labels
[ "this", "is", "pretty", "simple", "as", "we", "just", "have", "to", "deal", "with", "labels" ]
def _get_slice_axis(self, slice_obj, axis=0): """ this is pretty simple as we just have to deal with labels """ obj = self.obj if not need_slice(slice_obj): return obj labels = obj._get_axis(axis) indexer = labels.slice_indexer(slice_obj.start, slice_obj.stop, ...
[ "def", "_get_slice_axis", "(", "self", ",", "slice_obj", ",", "axis", "=", "0", ")", ":", "obj", "=", "self", ".", "obj", "if", "not", "need_slice", "(", "slice_obj", ")", ":", "return", "obj", "labels", "=", "obj", ".", "_get_axis", "(", "axis", ")"...
https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/pandas/core/indexing.py#L1348-L1361
liquidctl/liquidctl
73962574632f94050c2a75f517e929a29797b5e2
liquidctl/driver/smart_device.py
python
_CommonSmartDeviceDriver.__init__
(self, device, description, speed_channels, color_channels, **kwargs)
Instantiate a driver with a device handle.
Instantiate a driver with a device handle.
[ "Instantiate", "a", "driver", "with", "a", "device", "handle", "." ]
def __init__(self, device, description, speed_channels, color_channels, **kwargs): """Instantiate a driver with a device handle.""" super().__init__(device, description) self._speed_channels = speed_channels self._color_channels = color_channels
[ "def", "__init__", "(", "self", ",", "device", ",", "description", ",", "speed_channels", ",", "color_channels", ",", "*", "*", "kwargs", ")", ":", "super", "(", ")", ".", "__init__", "(", "device", ",", "description", ")", "self", ".", "_speed_channels", ...
https://github.com/liquidctl/liquidctl/blob/73962574632f94050c2a75f517e929a29797b5e2/liquidctl/driver/smart_device.py#L127-L131
sightmachine/SimpleCV
6c4d61b6d1d9d856b471910107cad0838954d2b2
SimpleCV/ImageClass.py
python
Image.skeletonize
(self, radius = 5)
return Image(retVal)
**SUMMARY** Skeletonization is the process of taking in a set of blobs (here blobs are white on a black background) and finding a squigly line that would be the back bone of the blobs were they some sort of vertebrate animal. Another way of thinking about skeletonization is that it find...
**SUMMARY**
[ "**", "SUMMARY", "**" ]
def skeletonize(self, radius = 5): """ **SUMMARY** Skeletonization is the process of taking in a set of blobs (here blobs are white on a black background) and finding a squigly line that would be the back bone of the blobs were they some sort of vertebrate animal. Another way of...
[ "def", "skeletonize", "(", "self", ",", "radius", "=", "5", ")", ":", "img", "=", "self", ".", "toGray", "(", ")", ".", "getNumpy", "(", ")", "[", ":", ",", ":", ",", "0", "]", "distance_img", "=", "ndimage", ".", "distance_transform_edt", "(", "im...
https://github.com/sightmachine/SimpleCV/blob/6c4d61b6d1d9d856b471910107cad0838954d2b2/SimpleCV/ImageClass.py#L9270-L9313
tomplus/kubernetes_asyncio
f028cc793e3a2c519be6a52a49fb77ff0b014c9b
kubernetes_asyncio/client/models/v1_pod_status.py
python
V1PodStatus.pod_i_ps
(self, pod_i_ps)
Sets the pod_i_ps of this V1PodStatus. podIPs holds the IP addresses allocated to the pod. If this field is specified, the 0th entry must match the podIP field. Pods may be allocated at most 1 value for each of IPv4 and IPv6. This list is empty if no IPs have been allocated yet. # noqa: E501 :param p...
Sets the pod_i_ps of this V1PodStatus.
[ "Sets", "the", "pod_i_ps", "of", "this", "V1PodStatus", "." ]
def pod_i_ps(self, pod_i_ps): """Sets the pod_i_ps of this V1PodStatus. podIPs holds the IP addresses allocated to the pod. If this field is specified, the 0th entry must match the podIP field. Pods may be allocated at most 1 value for each of IPv4 and IPv6. This list is empty if no IPs have been alloc...
[ "def", "pod_i_ps", "(", "self", ",", "pod_i_ps", ")", ":", "self", ".", "_pod_i_ps", "=", "pod_i_ps" ]
https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/models/v1_pod_status.py#L334-L343
simoncadman/CUPS-Cloud-Print
5d96eaa5ba1d3ffe40845498917879b0e907f6bd
printer.py
python
Printer._encodeMultiPart
(self, fields)
return '\r\n'.join(lines)
Encodes list of parameters for HTTP multipart format. Args: fields: list of tuples containing name and value of parameters. Returns: A string to be sent as data for the HTTP post request.
Encodes list of parameters for HTTP multipart format.
[ "Encodes", "list", "of", "parameters", "for", "HTTP", "multipart", "format", "." ]
def _encodeMultiPart(self, fields): """Encodes list of parameters for HTTP multipart format. Args: fields: list of tuples containing name and value of parameters. Returns: A string to be sent as data for the HTTP post request. """ lines = [] for (key,...
[ "def", "_encodeMultiPart", "(", "self", ",", "fields", ")", ":", "lines", "=", "[", "]", "for", "(", "key", ",", "value", ")", "in", "fields", ":", "lines", ".", "append", "(", "'--'", "+", "self", ".", "_getMimeBoundary", "(", ")", ")", "lines", "...
https://github.com/simoncadman/CUPS-Cloud-Print/blob/5d96eaa5ba1d3ffe40845498917879b0e907f6bd/printer.py#L395-L411
brannondorsey/PassGAN
5eeca016908d3ecc7a78a2d2b66154cb61d19f44
models.py
python
ResBlock
(name, inputs, dim)
return inputs + (0.3*output)
[]
def ResBlock(name, inputs, dim): output = inputs output = tf.nn.relu(output) output = lib.ops.conv1d.Conv1D(name+'.1', dim, dim, 5, output) output = tf.nn.relu(output) output = lib.ops.conv1d.Conv1D(name+'.2', dim, dim, 5, output) return inputs + (0.3*output)
[ "def", "ResBlock", "(", "name", ",", "inputs", ",", "dim", ")", ":", "output", "=", "inputs", "output", "=", "tf", ".", "nn", ".", "relu", "(", "output", ")", "output", "=", "lib", ".", "ops", ".", "conv1d", ".", "Conv1D", "(", "name", "+", "'.1'...
https://github.com/brannondorsey/PassGAN/blob/5eeca016908d3ecc7a78a2d2b66154cb61d19f44/models.py#L6-L12
isce-framework/isce2
0e5114a8bede3caf1d533d98e44dfe4b983e3f48
contrib/stack/stripmapStack/prepRawSensors.py
python
createParser
()
return parser
Create command line parser.
Create command line parser.
[ "Create", "command", "line", "parser", "." ]
def createParser(): ''' Create command line parser. ''' parser = argparse.ArgumentParser(description='Script that attempts to recognize the sensor automatically and then call the correspodning unzips/unpacks command.') parser.add_argument('-i', '--input', dest='input', type=str, required=True, ...
[ "def", "createParser", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'Script that attempts to recognize the sensor automatically and then call the correspodning unzips/unpacks command.'", ")", "parser", ".", "add_argument", "(", "'-i...
https://github.com/isce-framework/isce2/blob/0e5114a8bede3caf1d533d98e44dfe4b983e3f48/contrib/stack/stripmapStack/prepRawSensors.py#L11-L26
IronLanguages/ironpython2
51fdedeeda15727717fb8268a805f71b06c0b9f1
Src/StdLib/Lib/tabnanny.py
python
check
(file)
check(file_or_dir) If file_or_dir is a directory and not a symbolic link, then recursively descend the directory tree named by file_or_dir, checking all .py files along the way. If file_or_dir is an ordinary Python source file, it is checked for whitespace related problems. The diagnostic messages are ...
check(file_or_dir)
[ "check", "(", "file_or_dir", ")" ]
def check(file): """check(file_or_dir) If file_or_dir is a directory and not a symbolic link, then recursively descend the directory tree named by file_or_dir, checking all .py files along the way. If file_or_dir is an ordinary Python source file, it is checked for whitespace related problems. The ...
[ "def", "check", "(", "file", ")", ":", "if", "os", ".", "path", ".", "isdir", "(", "file", ")", "and", "not", "os", ".", "path", ".", "islink", "(", "file", ")", ":", "if", "verbose", ":", "print", "\"%r: listing directory\"", "%", "(", "file", ","...
https://github.com/IronLanguages/ironpython2/blob/51fdedeeda15727717fb8268a805f71b06c0b9f1/Src/StdLib/Lib/tabnanny.py#L74-L130