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
wistbean/learn_python3_spider
73c873f4845f4385f097e5057407d03dd37a117b
stackoverflow/venv/lib/python3.6/site-packages/zope/interface/advice.py
python
isClassAdvisor
(ob)
return isinstance(ob,FunctionType) and hasattr(ob,'previousMetaclass')
True if 'ob' is a class advisor function
True if 'ob' is a class advisor function
[ "True", "if", "ob", "is", "a", "class", "advisor", "function" ]
def isClassAdvisor(ob): """True if 'ob' is a class advisor function""" return isinstance(ob,FunctionType) and hasattr(ob,'previousMetaclass')
[ "def", "isClassAdvisor", "(", "ob", ")", ":", "return", "isinstance", "(", "ob", ",", "FunctionType", ")", "and", "hasattr", "(", "ob", ",", "'previousMetaclass'", ")" ]
https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/zope/interface/advice.py#L154-L156
SHI-Labs/Decoupled-Classification-Refinement
16202b48eb9cbf79a9b130a98e8c209d4f24693e
fpn_dcr/core/module.py
python
MutableModule.fit
(self, train_data, eval_data=None, eval_metric='acc', epoch_end_callback=None, batch_end_callback=None, kvstore='local', optimizer='sgd', optimizer_params=(('learning_rate', 0.01),), eval_end_callback=None, eval_batch_end_callback=None, initializer=Uniform(0.01), ...
Train the module parameters. Parameters ---------- train_data : DataIter eval_data : DataIter If not `None`, will be used as validation set and evaluate the performance after each epoch. eval_metric : str or EvalMetric Default `'acc'`. The per...
Train the module parameters.
[ "Train", "the", "module", "parameters", "." ]
def fit(self, train_data, eval_data=None, eval_metric='acc', epoch_end_callback=None, batch_end_callback=None, kvstore='local', optimizer='sgd', optimizer_params=(('learning_rate', 0.01),), eval_end_callback=None, eval_batch_end_callback=None, initializer=Uniform(0.01), ...
[ "def", "fit", "(", "self", ",", "train_data", ",", "eval_data", "=", "None", ",", "eval_metric", "=", "'acc'", ",", "epoch_end_callback", "=", "None", ",", "batch_end_callback", "=", "None", ",", "kvstore", "=", "'local'", ",", "optimizer", "=", "'sgd'", "...
https://github.com/SHI-Labs/Decoupled-Classification-Refinement/blob/16202b48eb9cbf79a9b130a98e8c209d4f24693e/fpn_dcr/core/module.py#L885-L1021
oilshell/oil
94388e7d44a9ad879b12615f6203b38596b5a2d3
Python-2.7.13/Parser/asdl_c.py
python
StaticVisitor.visit
(self, object)
[]
def visit(self, object): self.emit(self.CODE, 0, reflow=False)
[ "def", "visit", "(", "self", ",", "object", ")", ":", "self", ".", "emit", "(", "self", ".", "CODE", ",", "0", ",", "reflow", "=", "False", ")" ]
https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Parser/asdl_c.py#L989-L990
sourmash-bio/sourmash
73aeb155befd7c94042ddb8ca277a69986f25a55
src/sourmash/minhash.py
python
MinHash.to_mutable
(self)
return self.__copy__()
Return a copy of this MinHash that can be changed.
Return a copy of this MinHash that can be changed.
[ "Return", "a", "copy", "of", "this", "MinHash", "that", "can", "be", "changed", "." ]
def to_mutable(self): "Return a copy of this MinHash that can be changed." return self.__copy__()
[ "def", "to_mutable", "(", "self", ")", ":", "return", "self", ".", "__copy__", "(", ")" ]
https://github.com/sourmash-bio/sourmash/blob/73aeb155befd7c94042ddb8ca277a69986f25a55/src/sourmash/minhash.py#L771-L773
LinkedInAttic/naarad
261e2c0760fd6a6b0ee59064180bd8e3674311fe
src/naarad/utils.py
python
init_logging
(logger, log_file, log_level)
return CONSTANTS.OK
Initialize the naarad logger. :param: logger: logger object to initialize :param: log_file: log file name :param: log_level: log level (debug, info, warn, error)
Initialize the naarad logger. :param: logger: logger object to initialize :param: log_file: log file name :param: log_level: log level (debug, info, warn, error)
[ "Initialize", "the", "naarad", "logger", ".", ":", "param", ":", "logger", ":", "logger", "object", "to", "initialize", ":", "param", ":", "log_file", ":", "log", "file", "name", ":", "param", ":", "log_level", ":", "log", "level", "(", "debug", "info", ...
def init_logging(logger, log_file, log_level): """ Initialize the naarad logger. :param: logger: logger object to initialize :param: log_file: log file name :param: log_level: log level (debug, info, warn, error) """ with open(log_file, 'w'): pass numeric_level = getattr(logging, log_level.upper(), ...
[ "def", "init_logging", "(", "logger", ",", "log_file", ",", "log_level", ")", ":", "with", "open", "(", "log_file", ",", "'w'", ")", ":", "pass", "numeric_level", "=", "getattr", "(", "logging", ",", "log_level", ".", "upper", "(", ")", ",", "None", ")...
https://github.com/LinkedInAttic/naarad/blob/261e2c0760fd6a6b0ee59064180bd8e3674311fe/src/naarad/utils.py#L825-L847
tdamdouni/Pythonista
3e082d53b6b9b501a3c8cf3251a8ad4c8be9c2ad
ui/viewcontroller.py
python
ViewController.bind_actions
(self, view_name, actions)
return
Binds view actions (button presses, etc) to methods of the derived class. Parameters: view_name: STRING which subview to bind actions in actions: DICTIONARY mapping ui element name to call-back functions. Eg: {'big_red_button':'blow_up_world', 'cancel_button':'cancel_action'}. The keys must EXACTLY match the ...
Binds view actions (button presses, etc) to methods of the derived class. Parameters: view_name: STRING which subview to bind actions in actions: DICTIONARY mapping ui element name to call-back functions. Eg: {'big_red_button':'blow_up_world', 'cancel_button':'cancel_action'}. The keys must EXACTLY match the ...
[ "Binds", "view", "actions", "(", "button", "presses", "etc", ")", "to", "methods", "of", "the", "derived", "class", ".", "Parameters", ":", "view_name", ":", "STRING", "which", "subview", "to", "bind", "actions", "in", "actions", ":", "DICTIONARY", "mapping"...
def bind_actions(self, view_name, actions): """Binds view actions (button presses, etc) to methods of the derived class. Parameters: view_name: STRING which subview to bind actions in actions: DICTIONARY mapping ui element name to call-back functions. Eg: {'big_red_button':'blow_up_world', 'cancel_button':'ca...
[ "def", "bind_actions", "(", "self", ",", "view_name", ",", "actions", ")", ":", "view", "=", "self", ".", "views", "[", "view_name", "]", "for", "element", ",", "action", "in", "actions", ".", "items", "(", ")", ":", "view", "[", "element", "]", ".",...
https://github.com/tdamdouni/Pythonista/blob/3e082d53b6b9b501a3c8cf3251a8ad4c8be9c2ad/ui/viewcontroller.py#L24-L37
buke/GreenOdoo
3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df
runtime/python/lib/python2.7/email/message.py
python
Message.set_default_type
(self, ctype)
Set the `default' content type. ctype should be either "text/plain" or "message/rfc822", although this is not enforced. The default content type is not stored in the Content-Type header.
Set the `default' content type.
[ "Set", "the", "default", "content", "type", "." ]
def set_default_type(self, ctype): """Set the `default' content type. ctype should be either "text/plain" or "message/rfc822", although this is not enforced. The default content type is not stored in the Content-Type header. """ self._default_type = ctype
[ "def", "set_default_type", "(", "self", ",", "ctype", ")", ":", "self", ".", "_default_type", "=", "ctype" ]
https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/email/message.py#L483-L490
GalSim-developers/GalSim
a05d4ec3b8d8574f99d3b0606ad882cbba53f345
galsim/phase_screens.py
python
UserScreen.wavefront_gradient
(self, u, v, t=None, theta=None)
return self.table.gradient(u, v)
Evaluate gradient of wavefront from lookup table. Parameters: u: Horizontal pupil coordinate (in meters) at which to evaluate wavefront. Can be a scalar or an iterable. The shapes of u and v must match. v: Vertical pupil coordinate (in meters) at which to...
Evaluate gradient of wavefront from lookup table.
[ "Evaluate", "gradient", "of", "wavefront", "from", "lookup", "table", "." ]
def wavefront_gradient(self, u, v, t=None, theta=None): """ Evaluate gradient of wavefront from lookup table. Parameters: u: Horizontal pupil coordinate (in meters) at which to evaluate wavefront. Can be a scalar or an iterable. The shapes of u and v must match. ...
[ "def", "wavefront_gradient", "(", "self", ",", "u", ",", "v", ",", "t", "=", "None", ",", "theta", "=", "None", ")", ":", "return", "self", ".", "table", ".", "gradient", "(", "u", ",", "v", ")" ]
https://github.com/GalSim-developers/GalSim/blob/a05d4ec3b8d8574f99d3b0606ad882cbba53f345/galsim/phase_screens.py#L1217-L1231
google/grr
8ad8a4d2c5a93c92729206b7771af19d92d4f915
grr/config/grr_response_templates/setup.py
python
Sdist.make_release_tree
(self, base_dir, files)
[]
def make_release_tree(self, base_dir, files): sdist.make_release_tree(self, base_dir, files) sdist_version_ini = os.path.join(base_dir, "version.ini") if os.path.exists(sdist_version_ini): os.unlink(sdist_version_ini) shutil.copy( os.path.join(THIS_DIRECTORY, "../../../version.ini"), sdist...
[ "def", "make_release_tree", "(", "self", ",", "base_dir", ",", "files", ")", ":", "sdist", ".", "make_release_tree", "(", "self", ",", "base_dir", ",", "files", ")", "sdist_version_ini", "=", "os", ".", "path", ".", "join", "(", "base_dir", ",", "\"version...
https://github.com/google/grr/blob/8ad8a4d2c5a93c92729206b7771af19d92d4f915/grr/config/grr_response_templates/setup.py#L72-L78
pyscf/pyscf
0adfb464333f5ceee07b664f291d4084801bae64
pyscf/pbc/tools/pywannier90.py
python
W90.get_M_mat
(self)
return M_matrix_loc
r''' Construct the ovelap matrix: M_{m,n}^{(\mathbf{k,b})} Equation (25) in MV, Phys. Rev. B 56, 12847
r''' Construct the ovelap matrix: M_{m,n}^{(\mathbf{k,b})} Equation (25) in MV, Phys. Rev. B 56, 12847
[ "r", "Construct", "the", "ovelap", "matrix", ":", "M_", "{", "m", "n", "}", "^", "{", "(", "\\", "mathbf", "{", "k", "b", "}", ")", "}", "Equation", "(", "25", ")", "in", "MV", "Phys", ".", "Rev", ".", "B", "56", "12847" ]
def get_M_mat(self): r''' Construct the ovelap matrix: M_{m,n}^{(\mathbf{k,b})} Equation (25) in MV, Phys. Rev. B 56, 12847 ''' M_matrix_loc = np.empty([self.num_kpts_loc, self.nntot_loc, self.num_bands_loc, self.num_bands_loc], ...
[ "def", "get_M_mat", "(", "self", ")", ":", "M_matrix_loc", "=", "np", ".", "empty", "(", "[", "self", ".", "num_kpts_loc", ",", "self", ".", "nntot_loc", ",", "self", ".", "num_bands_loc", ",", "self", ".", "num_bands_loc", "]", ",", "dtype", "=", "np"...
https://github.com/pyscf/pyscf/blob/0adfb464333f5ceee07b664f291d4084801bae64/pyscf/pbc/tools/pywannier90.py#L605-L627
deepgully/me
f7ad65edc2fe435310c6676bc2e322cfe5d4c8f0
libs/sqlalchemy/sql/elements.py
python
AnnotatedColumnElement.name
(self)
return self._Annotated__element.name
pull 'name' from parent, if not present
pull 'name' from parent, if not present
[ "pull", "name", "from", "parent", "if", "not", "present" ]
def name(self): """pull 'name' from parent, if not present""" return self._Annotated__element.name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_Annotated__element", ".", "name" ]
https://github.com/deepgully/me/blob/f7ad65edc2fe435310c6676bc2e322cfe5d4c8f0/libs/sqlalchemy/sql/elements.py#L3434-L3436
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/lib-python/3/zipfile.py
python
ZipExtFile.close
(self)
[]
def close(self): try: if self._close_fileobj: self._fileobj.close() finally: super().close()
[ "def", "close", "(", "self", ")", ":", "try", ":", "if", "self", ".", "_close_fileobj", ":", "self", ".", "_fileobj", ".", "close", "(", ")", "finally", ":", "super", "(", ")", ".", "close", "(", ")" ]
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/zipfile.py#L654-L659
PaddlePaddle/PARL
5fb7a5d2b5d0f0dac57fdf4acb9e79485c7efa96
examples/Baselines/Halite_competition/paddle/rl_trainer/algorithm.py
python
PPO.learn
(self, obs_batch, actions_batch, value_preds_batch, return_batch, old_action_log_probs_batch, adv_targ)
return value_loss.item(), action_loss.item(), dist_entropy.item()
Update rule for ppo algorithm Args: obs_batch (paddle.tensor): a batch of states actions_batch (paddle.tensor): a batch of actions value_preds_batch (paddle.tensor): a batch of predicted state value return_batch (paddle.tensor): a batch of discounted return ...
Update rule for ppo algorithm Args: obs_batch (paddle.tensor): a batch of states actions_batch (paddle.tensor): a batch of actions value_preds_batch (paddle.tensor): a batch of predicted state value return_batch (paddle.tensor): a batch of discounted return ...
[ "Update", "rule", "for", "ppo", "algorithm", "Args", ":", "obs_batch", "(", "paddle", ".", "tensor", ")", ":", "a", "batch", "of", "states", "actions_batch", "(", "paddle", ".", "tensor", ")", ":", "a", "batch", "of", "actions", "value_preds_batch", "(", ...
def learn(self, obs_batch, actions_batch, value_preds_batch, return_batch, old_action_log_probs_batch, adv_targ): """Update rule for ppo algorithm Args: obs_batch (paddle.tensor): a batch of states actions_batch (paddle.tensor): a batch of actions value_...
[ "def", "learn", "(", "self", ",", "obs_batch", ",", "actions_batch", ",", "value_preds_batch", ",", "return_batch", ",", "old_action_log_probs_batch", ",", "adv_targ", ")", ":", "values", "=", "self", ".", "critic", "(", "obs_batch", ")", "probs", "=", "self",...
https://github.com/PaddlePaddle/PARL/blob/5fb7a5d2b5d0f0dac57fdf4acb9e79485c7efa96/examples/Baselines/Halite_competition/paddle/rl_trainer/algorithm.py#L57-L97
caiiiac/Machine-Learning-with-Python
1a26c4467da41ca4ebc3d5bd789ea942ef79422f
MachineLearning/venv/lib/python3.5/site.py
python
fixclasspath
()
Adjust the special classpath sys.path entries for Jython. These entries should follow the base virtualenv lib directories.
Adjust the special classpath sys.path entries for Jython. These entries should follow the base virtualenv lib directories.
[ "Adjust", "the", "special", "classpath", "sys", ".", "path", "entries", "for", "Jython", ".", "These", "entries", "should", "follow", "the", "base", "virtualenv", "lib", "directories", "." ]
def fixclasspath(): """Adjust the special classpath sys.path entries for Jython. These entries should follow the base virtualenv lib directories. """ paths = [] classpaths = [] for path in sys.path: if path == '__classpath__' or path.startswith('__pyclasspath__'): classpaths....
[ "def", "fixclasspath", "(", ")", ":", "paths", "=", "[", "]", "classpaths", "=", "[", "]", "for", "path", "in", "sys", ".", "path", ":", "if", "path", "==", "'__classpath__'", "or", "path", ".", "startswith", "(", "'__pyclasspath__'", ")", ":", "classp...
https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site.py#L646-L658
dragonfly/dragonfly
a579b5eadf452e23b07d4caf27b402703b0012b7
dragonfly/opt/opt_method_evaluator.py
python
OptMethodEvaluator._print_method_result
(self, method, comp_opt_val, num_evals)
Prints the result for this method.
Prints the result for this method.
[ "Prints", "the", "result", "for", "this", "method", "." ]
def _print_method_result(self, method, comp_opt_val, num_evals): """ Prints the result for this method. """ result_str = 'Method: %s achieved max-val %0.5f in %d evaluations.\n'%(method, \ comp_opt_val, num_evals) self.reporter.writeln(result_str)
[ "def", "_print_method_result", "(", "self", ",", "method", ",", "comp_opt_val", ",", "num_evals", ")", ":", "result_str", "=", "'Method: %s achieved max-val %0.5f in %d evaluations.\\n'", "%", "(", "method", ",", "comp_opt_val", ",", "num_evals", ")", "self", ".", "...
https://github.com/dragonfly/dragonfly/blob/a579b5eadf452e23b07d4caf27b402703b0012b7/dragonfly/opt/opt_method_evaluator.py#L126-L130
laspy/laspy
c9d9b9c0e8d84288134c02bf4ecec3964f5afa29
laspy/lasreader.py
python
UncompressedPointReader.close
(self)
[]
def close(self): self.source.close()
[ "def", "close", "(", "self", ")", ":", "self", ".", "source", ".", "close", "(", ")" ]
https://github.com/laspy/laspy/blob/c9d9b9c0e8d84288134c02bf4ecec3964f5afa29/laspy/lasreader.py#L291-L292
SanPen/GridCal
d3f4566d2d72c11c7e910c9d162538ef0e60df31
src/GridCal/Engine/IO/cim/cim_devices.py
python
GeneralContainer.get_xml
(self, level=0)
return xml
Returns an XML representation of the object Args: level: Returns:
Returns an XML representation of the object Args: level:
[ "Returns", "an", "XML", "representation", "of", "the", "object", "Args", ":", "level", ":" ]
def get_xml(self, level=0): """ Returns an XML representation of the object Args: level: Returns: """ """ <cim:IEC61970CIMVersion rdf:ID="version"> <cim:IEC61970CIMVersion.version>IEC61970CIM16v29a</cim:IEC61970CIMVersion.version> ...
[ "def", "get_xml", "(", "self", ",", "level", "=", "0", ")", ":", "\"\"\"\n <cim:IEC61970CIMVersion rdf:ID=\"version\">\n <cim:IEC61970CIMVersion.version>IEC61970CIM16v29a</cim:IEC61970CIMVersion.version>\n <cim:IEC61970CIMVersion.date>2015-07-15</cim:IEC61970CIMVersi...
https://github.com/SanPen/GridCal/blob/d3f4566d2d72c11c7e910c9d162538ef0e60df31/src/GridCal/Engine/IO/cim/cim_devices.py#L161-L203
epiception/CalibNet
a4ae349867d6bbf13a4add671b1cb2636eb29e6f
code/utils/tf_util2.py
python
fully_connected
(inputs, num_outputs, scope, use_xavier=True, stddev=1e-3, weight_decay=0.00001, activation_fn=tf.nn.relu, bn=False, bn_decay=None, use_bias...
Fully connected layer with non-linear operation. Args: inputs: 2-D tensor BxN num_outputs: int Returns: Variable tensor of size B x num_outputs.
Fully connected layer with non-linear operation.
[ "Fully", "connected", "layer", "with", "non", "-", "linear", "operation", "." ]
def fully_connected(inputs, num_outputs, scope, use_xavier=True, stddev=1e-3, weight_decay=0.00001, activation_fn=tf.nn.relu, bn=False, bn_decay=None, ...
[ "def", "fully_connected", "(", "inputs", ",", "num_outputs", ",", "scope", ",", "use_xavier", "=", "True", ",", "stddev", "=", "1e-3", ",", "weight_decay", "=", "0.00001", ",", "activation_fn", "=", "tf", ".", "nn", ".", "relu", ",", "bn", "=", "False", ...
https://github.com/epiception/CalibNet/blob/a4ae349867d6bbf13a4add671b1cb2636eb29e6f/code/utils/tf_util2.py#L89-L128
sfyc23/WechatAddGroupHelper
2a2e83150f11d5baa7bd6b356ecad1b5b15f760c
WechatAddGroupHelper.py
python
stop_scheduler
()
关闭定时器
关闭定时器
[ "关闭定时器" ]
def stop_scheduler(): """ 关闭定时器 """ if scheduler and scheduler.get_jobs(): scheduler.shutdown(wait=False)
[ "def", "stop_scheduler", "(", ")", ":", "if", "scheduler", "and", "scheduler", ".", "get_jobs", "(", ")", ":", "scheduler", ".", "shutdown", "(", "wait", "=", "False", ")" ]
https://github.com/sfyc23/WechatAddGroupHelper/blob/2a2e83150f11d5baa7bd6b356ecad1b5b15f760c/WechatAddGroupHelper.py#L439-L442
deanishe/alfred-convert
97407f4ec8dbca5abbc6952b2b56cf3918624177
src/workflow/workflow.py
python
Workflow._default_datadir
(self)
return os.path.join(os.path.expanduser( '~/Library/Application Support/Alfred 2/Workflow Data/'), self.bundleid)
Alfred 2's default data directory.
Alfred 2's default data directory.
[ "Alfred", "2", "s", "default", "data", "directory", "." ]
def _default_datadir(self): """Alfred 2's default data directory.""" return os.path.join(os.path.expanduser( '~/Library/Application Support/Alfred 2/Workflow Data/'), self.bundleid)
[ "def", "_default_datadir", "(", "self", ")", ":", "return", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "expanduser", "(", "'~/Library/Application Support/Alfred 2/Workflow Data/'", ")", ",", "self", ".", "bundleid", ")" ]
https://github.com/deanishe/alfred-convert/blob/97407f4ec8dbca5abbc6952b2b56cf3918624177/src/workflow/workflow.py#L1283-L1287
unix121/i3wm-themer
3ee6b6e22d259ec7a2a12b40bf9e25830a2aabce
i3wmthemer/models/theme.py
python
Theme.load
(self, configuration)
Batch apply all the themes. :param configuration: the configuration.
Batch apply all the themes.
[ "Batch", "apply", "all", "the", "themes", "." ]
def load(self, configuration): """ Batch apply all the themes. :param configuration: the configuration. """ self.x_resources.load(configuration) self.i3_theme.load(configuration) self.polybar_theme.load(configuration) self.nitrogen_theme.load(configuratio...
[ "def", "load", "(", "self", ",", "configuration", ")", ":", "self", ".", "x_resources", ".", "load", "(", "configuration", ")", "self", ".", "i3_theme", ".", "load", "(", "configuration", ")", "self", ".", "polybar_theme", ".", "load", "(", "configuration"...
https://github.com/unix121/i3wm-themer/blob/3ee6b6e22d259ec7a2a12b40bf9e25830a2aabce/i3wmthemer/models/theme.py#L24-L34
tp4a/teleport
1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad
server/www/packages/packages-windows/x86/idna/intranges.py
python
intranges_contain
(int_, ranges)
return False
Determine if `int_` falls into one of the ranges in `ranges`.
Determine if `int_` falls into one of the ranges in `ranges`.
[ "Determine", "if", "int_", "falls", "into", "one", "of", "the", "ranges", "in", "ranges", "." ]
def intranges_contain(int_, ranges): """Determine if `int_` falls into one of the ranges in `ranges`.""" tuple_ = _encode_range(int_, 0) pos = bisect.bisect_left(ranges, tuple_) # we could be immediately ahead of a tuple (start, end) # with start < int_ <= end if pos > 0: left, right = _...
[ "def", "intranges_contain", "(", "int_", ",", "ranges", ")", ":", "tuple_", "=", "_encode_range", "(", "int_", ",", "0", ")", "pos", "=", "bisect", ".", "bisect_left", "(", "ranges", ",", "tuple_", ")", "# we could be immediately ahead of a tuple (start, end)", ...
https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-windows/x86/idna/intranges.py#L38-L53
analysiscenter/batchflow
294747da0bca309785f925be891441fdd824e9fa
batchflow/sampler.py
python
ApplySampler.sample
(self, size)
return self.transform(self.bases[0].sample(size))
Sampling procedure of a sampler subjugated to a transform. Check out the docstring of `Sampler.apply` for more info.
Sampling procedure of a sampler subjugated to a transform. Check out the docstring of `Sampler.apply` for more info.
[ "Sampling", "procedure", "of", "a", "sampler", "subjugated", "to", "a", "transform", ".", "Check", "out", "the", "docstring", "of", "Sampler", ".", "apply", "for", "more", "info", "." ]
def sample(self, size): """ Sampling procedure of a sampler subjugated to a transform. Check out the docstring of `Sampler.apply` for more info. """ return self.transform(self.bases[0].sample(size))
[ "def", "sample", "(", "self", ",", "size", ")", ":", "return", "self", ".", "transform", "(", "self", ".", "bases", "[", "0", "]", ".", "sample", "(", "size", ")", ")" ]
https://github.com/analysiscenter/batchflow/blob/294747da0bca309785f925be891441fdd824e9fa/batchflow/sampler.py#L266-L270
scipy/scipy
e0a749f01e79046642ccfdc419edbf9e7ca141ad
benchmarks/benchmarks/go_benchmark_functions/go_benchmark.py
python
Benchmark.N
(self)
return self._dimensions
The dimensionality of the problem. Returns ------- N : int The dimensionality of the problem
The dimensionality of the problem.
[ "The", "dimensionality", "of", "the", "problem", "." ]
def N(self): """ The dimensionality of the problem. Returns ------- N : int The dimensionality of the problem """ return self._dimensions
[ "def", "N", "(", "self", ")", ":", "return", "self", ".", "_dimensions" ]
https://github.com/scipy/scipy/blob/e0a749f01e79046642ccfdc419edbf9e7ca141ad/benchmarks/benchmarks/go_benchmark_functions/go_benchmark.py#L174-L183
yoda-pa/yoda
e6b4325737b877488af4d1bf0b86eb1d98b88aed
modules/ciphers/caesar.py
python
CaesarCipher.encrypt
(self, message)
return encrypted_text
Asks the user for the alphabet shift and then encrypts the text.
Asks the user for the alphabet shift and then encrypts the text.
[ "Asks", "the", "user", "for", "the", "alphabet", "shift", "and", "then", "encrypts", "the", "text", "." ]
def encrypt(self, message): """ Asks the user for the alphabet shift and then encrypts the text. """ message = message.upper() shift = int(click.prompt("The shift value")) encryption_dictionary, _ = self.generate_alphabets(shift) encrypted_text = "" for c...
[ "def", "encrypt", "(", "self", ",", "message", ")", ":", "message", "=", "message", ".", "upper", "(", ")", "shift", "=", "int", "(", "click", ".", "prompt", "(", "\"The shift value\"", ")", ")", "encryption_dictionary", ",", "_", "=", "self", ".", "ge...
https://github.com/yoda-pa/yoda/blob/e6b4325737b877488af4d1bf0b86eb1d98b88aed/modules/ciphers/caesar.py#L11-L29
robotlearn/pyrobolearn
9cd7c060723fda7d2779fa255ac998c2c82b8436
pyrobolearn/losses/loss.py
python
Loss.latex
(self)
Return a latex formula of the loss.
Return a latex formula of the loss.
[ "Return", "a", "latex", "formula", "of", "the", "loss", "." ]
def latex(self): # TODO: check when using operators with latex formula """Return a latex formula of the loss.""" pass
[ "def", "latex", "(", "self", ")", ":", "# TODO: check when using operators with latex formula", "pass" ]
https://github.com/robotlearn/pyrobolearn/blob/9cd7c060723fda7d2779fa255ac998c2c82b8436/pyrobolearn/losses/loss.py#L80-L82
misterch0c/shadowbroker
e3a069bea47a2c1009697941ac214adc6f90aa8d
windows/Resources/Python/Core/Lib/decimal.py
python
Decimal.as_tuple
(self)
return DecimalTuple(self._sign, tuple(map(int, self._int)), self._exp)
Represents the number as a triple tuple. To show the internals exactly as they are.
Represents the number as a triple tuple. To show the internals exactly as they are.
[ "Represents", "the", "number", "as", "a", "triple", "tuple", ".", "To", "show", "the", "internals", "exactly", "as", "they", "are", "." ]
def as_tuple(self): """Represents the number as a triple tuple. To show the internals exactly as they are. """ return DecimalTuple(self._sign, tuple(map(int, self._int)), self._exp)
[ "def", "as_tuple", "(", "self", ")", ":", "return", "DecimalTuple", "(", "self", ".", "_sign", ",", "tuple", "(", "map", "(", "int", ",", "self", ".", "_int", ")", ")", ",", "self", ".", "_exp", ")" ]
https://github.com/misterch0c/shadowbroker/blob/e3a069bea47a2c1009697941ac214adc6f90aa8d/windows/Resources/Python/Core/Lib/decimal.py#L854-L859
wistbean/learn_python3_spider
73c873f4845f4385f097e5057407d03dd37a117b
stackoverflow/venv/lib/python3.6/site-packages/pymongo/read_preferences.py
python
_ServerMode.__getstate__
(self)
return {'mode': self.__mode, 'tag_sets': self.__tag_sets, 'max_staleness': self.__max_staleness}
Return value of object for pickling. Needed explicitly because __slots__() defined.
Return value of object for pickling.
[ "Return", "value", "of", "object", "for", "pickling", "." ]
def __getstate__(self): """Return value of object for pickling. Needed explicitly because __slots__() defined. """ return {'mode': self.__mode, 'tag_sets': self.__tag_sets, 'max_staleness': self.__max_staleness}
[ "def", "__getstate__", "(", "self", ")", ":", "return", "{", "'mode'", ":", "self", ".", "__mode", ",", "'tag_sets'", ":", "self", ".", "__tag_sets", ",", "'max_staleness'", ":", "self", ".", "__max_staleness", "}" ]
https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/pymongo/read_preferences.py#L174-L181
xolox/python-rotate-backups
32e966c000eb657da02122ff8e478a98aa8b8d30
rotate_backups/__init__.py
python
Location.ensure_readable
(self, override=False)
return False
Sanity check that the location exists and is readable. :param override: :data:`True` to log a message, :data:`False` to raise an exception (when the sanity check fails). :returns: :data:`True` if the sanity check succeeds, :data:`False` if it fails (and `overr...
Sanity check that the location exists and is readable.
[ "Sanity", "check", "that", "the", "location", "exists", "and", "is", "readable", "." ]
def ensure_readable(self, override=False): """ Sanity check that the location exists and is readable. :param override: :data:`True` to log a message, :data:`False` to raise an exception (when the sanity check fails). :returns: :data:`True` if the sanity check su...
[ "def", "ensure_readable", "(", "self", ",", "override", "=", "False", ")", ":", "# Only sanity check that the location is readable when its", "# existence has been confirmed, to avoid multiple notices", "# about the same underlying problem.", "if", "self", ".", "ensure_exists", "("...
https://github.com/xolox/python-rotate-backups/blob/32e966c000eb657da02122ff8e478a98aa8b8d30/rotate_backups/__init__.py#L862-L887
wwqgtxx/wwqLyParse
33136508e52821babd9294fdecffbdf02d73a6fc
wwqLyParse/lib/python-3.7.2-embed-amd64/Crypto/Hash/SHA3_224.py
python
SHA3_224_Hash.new
(self)
return type(self)(None, self._update_after_digest)
Create a fresh SHA3-224 hash object.
Create a fresh SHA3-224 hash object.
[ "Create", "a", "fresh", "SHA3", "-", "224", "hash", "object", "." ]
def new(self): """Create a fresh SHA3-224 hash object.""" return type(self)(None, self._update_after_digest)
[ "def", "new", "(", "self", ")", ":", "return", "type", "(", "self", ")", "(", "None", ",", "self", ".", "_update_after_digest", ")" ]
https://github.com/wwqgtxx/wwqLyParse/blob/33136508e52821babd9294fdecffbdf02d73a6fc/wwqLyParse/lib/python-3.7.2-embed-amd64/Crypto/Hash/SHA3_224.py#L114-L117
dsoprea/GDriveFS
d307b043ebc235d6444c8c1ae2e0bbb860e788a0
gdrivefs/opened_file.py
python
_OpenedManager.add
(self, opened_file, fh=None)
Registered an OpenedFile object.
Registered an OpenedFile object.
[ "Registered", "an", "OpenedFile", "object", "." ]
def add(self, opened_file, fh=None): """Registered an OpenedFile object.""" cls = self.__class__ assert issubclass(opened_file.__class__, OpenedFile) is True, \ "Can only register an OpenedFile as an opened-file." with cls.__opened_lock: if not fh: ...
[ "def", "add", "(", "self", ",", "opened_file", ",", "fh", "=", "None", ")", ":", "cls", "=", "self", ".", "__class__", "assert", "issubclass", "(", "opened_file", ".", "__class__", ",", "OpenedFile", ")", "is", "True", ",", "\"Can only register an OpenedFile...
https://github.com/dsoprea/GDriveFS/blob/d307b043ebc235d6444c8c1ae2e0bbb860e788a0/gdrivefs/opened_file.py#L86-L113
theotherp/nzbhydra
4b03d7f769384b97dfc60dade4806c0fc987514e
libs/_osx_support.py
python
_find_appropriate_compiler
(_config_vars)
return _config_vars
Find appropriate C compiler for extension module builds
Find appropriate C compiler for extension module builds
[ "Find", "appropriate", "C", "compiler", "for", "extension", "module", "builds" ]
def _find_appropriate_compiler(_config_vars): """Find appropriate C compiler for extension module builds""" # Issue #13590: # The OSX location for the compiler varies between OSX # (or rather Xcode) releases. With older releases (up-to 10.5) # the compiler is in /usr/bin, with newer relea...
[ "def", "_find_appropriate_compiler", "(", "_config_vars", ")", ":", "# Issue #13590:", "# The OSX location for the compiler varies between OSX", "# (or rather Xcode) releases. With older releases (up-to 10.5)", "# the compiler is in /usr/bin, with newer releases the compiler", "# ca...
https://github.com/theotherp/nzbhydra/blob/4b03d7f769384b97dfc60dade4806c0fc987514e/libs/_osx_support.py#L144-L203
CGATOxford/cgat
326aad4694bdfae8ddc194171bb5d73911243947
obsolete/PipelineAnnotator.py
python
buildAnnotatorWorkSpace
(tmpdir, outfile, workspaces=("genomic",), gc_control = False)
return tmpworkspaces, tmpsynonyms
write genomic workspace. Available workspaces are: genomic the full genome all is ignored intronic introns (requires annotator_regions to be set) intergenic introns (requires annotator_regions to be set) geneterritories introns (requires annotator_geneterrito...
write genomic workspace.
[ "write", "genomic", "workspace", "." ]
def buildAnnotatorWorkSpace(tmpdir, outfile, workspaces=("genomic",), gc_control = False): '''write genomic workspace. Available workspaces are: genomic the full genome all is ignored intronic ...
[ "def", "buildAnnotatorWorkSpace", "(", "tmpdir", ",", "outfile", ",", "workspaces", "=", "(", "\"genomic\"", ",", ")", ",", "gc_control", "=", "False", ")", ":", "to_cluster", "=", "True", "job_options", "=", "\"-l mem_free=4000M\"", "tmpworkspaces", "=", "[", ...
https://github.com/CGATOxford/cgat/blob/326aad4694bdfae8ddc194171bb5d73911243947/obsolete/PipelineAnnotator.py#L109-L249
larryhastings/gilectomy
4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a
Lib/ipaddress.py
python
IPv4Address.is_unspecified
(self)
return self == self._constants._unspecified_address
Test if the address is unspecified. Returns: A boolean, True if this is the unspecified address as defined in RFC 5735 3.
Test if the address is unspecified.
[ "Test", "if", "the", "address", "is", "unspecified", "." ]
def is_unspecified(self): """Test if the address is unspecified. Returns: A boolean, True if this is the unspecified address as defined in RFC 5735 3. """ return self == self._constants._unspecified_address
[ "def", "is_unspecified", "(", "self", ")", ":", "return", "self", "==", "self", ".", "_constants", ".", "_unspecified_address" ]
https://github.com/larryhastings/gilectomy/blob/4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a/Lib/ipaddress.py#L1326-L1334
pyrocko/pyrocko
b6baefb7540fb7fce6ed9b856ec0c413961a4320
src/moment_tensor.py
python
MomentTensor.moment_magnitude
(self)
return moment_to_magnitude(self.scalar_moment())
Get moment magnitude of moment tensor.
Get moment magnitude of moment tensor.
[ "Get", "moment", "magnitude", "of", "moment", "tensor", "." ]
def moment_magnitude(self): ''' Get moment magnitude of moment tensor. ''' return moment_to_magnitude(self.scalar_moment())
[ "def", "moment_magnitude", "(", "self", ")", ":", "return", "moment_to_magnitude", "(", "self", ".", "scalar_moment", "(", ")", ")" ]
https://github.com/pyrocko/pyrocko/blob/b6baefb7540fb7fce6ed9b856ec0c413961a4320/src/moment_tensor.py#L816-L820
quantopian/trading_calendars
19c4b677f13147928d34be5a3da50ba4161be45d
trading_calendars/exchange_calendar_xasx.py
python
XASXExchangeCalendar.adhoc_holidays
(self)
return [EasterTuesday2011AdHoc, NYEMonday1984AdHoc, NYEMonday1990AdHoc, Bicentennial1988, Y2KTesting]
[]
def adhoc_holidays(self): return [EasterTuesday2011AdHoc, NYEMonday1984AdHoc, NYEMonday1990AdHoc, Bicentennial1988, Y2KTesting]
[ "def", "adhoc_holidays", "(", "self", ")", ":", "return", "[", "EasterTuesday2011AdHoc", ",", "NYEMonday1984AdHoc", ",", "NYEMonday1990AdHoc", ",", "Bicentennial1988", ",", "Y2KTesting", "]" ]
https://github.com/quantopian/trading_calendars/blob/19c4b677f13147928d34be5a3da50ba4161be45d/trading_calendars/exchange_calendar_xasx.py#L177-L179
tanghaibao/goatools
647e9dd833695f688cd16c2f9ea18f1692e5c6bc
goatools/gosubdag/gosubdag_init.py
python
InitGOs._init_gos
(self, go_sources_arg, relationships_arg)
Initialize GO sources.
Initialize GO sources.
[ "Initialize", "GO", "sources", "." ]
def _init_gos(self, go_sources_arg, relationships_arg): """Initialize GO sources.""" # No GO sources provided if not go_sources_arg: assert self.go2obj_orig, \ "go2obj MUST BE PRESENT IF go_sources IS NOT: {O}".format(O=self.go2obj_orig) self.go_sources = ...
[ "def", "_init_gos", "(", "self", ",", "go_sources_arg", ",", "relationships_arg", ")", ":", "# No GO sources provided", "if", "not", "go_sources_arg", ":", "assert", "self", ".", "go2obj_orig", ",", "\"go2obj MUST BE PRESENT IF go_sources IS NOT: {O}\"", ".", "format", ...
https://github.com/tanghaibao/goatools/blob/647e9dd833695f688cd16c2f9ea18f1692e5c6bc/goatools/gosubdag/gosubdag_init.py#L51-L73
achael/eht-imaging
bbd3aeb06bef52bf89fa1c06de71e5509a5b0015
ehtim/image.py
python
load_fits
(fname, aipscc=False, pulse=ehc.PULSE_DEFAULT, polrep='stokes', pol_prim=None, zero_pol=False)
return ehtim.io.load.load_im_fits(fname, aipscc=aipscc, pulse=pulse, polrep=polrep, pol_prim=pol_prim, zero_pol=zero_pol)
Read in an image from a FITS file. Args: fname (str): path to input fits file aipscc (bool): if True, then AIPS CC table will be loaded pulse (function): The function convolved with the pixel values for continuous image. polrep (str): polarization representation, eith...
Read in an image from a FITS file.
[ "Read", "in", "an", "image", "from", "a", "FITS", "file", "." ]
def load_fits(fname, aipscc=False, pulse=ehc.PULSE_DEFAULT, polrep='stokes', pol_prim=None, zero_pol=False): """Read in an image from a FITS file. Args: fname (str): path to input fits file aipscc (bool): if True, then AIPS CC table will be loaded pulse (functi...
[ "def", "load_fits", "(", "fname", ",", "aipscc", "=", "False", ",", "pulse", "=", "ehc", ".", "PULSE_DEFAULT", ",", "polrep", "=", "'stokes'", ",", "pol_prim", "=", "None", ",", "zero_pol", "=", "False", ")", ":", "return", "ehtim", ".", "io", ".", "...
https://github.com/achael/eht-imaging/blob/bbd3aeb06bef52bf89fa1c06de71e5509a5b0015/ehtim/image.py#L4016-L4033
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/eventlet-0.24.1/eventlet/timeout.py
python
Timeout.pending
(self)
True if the timeout is scheduled to be raised.
True if the timeout is scheduled to be raised.
[ "True", "if", "the", "timeout", "is", "scheduled", "to", "be", "raised", "." ]
def pending(self): """True if the timeout is scheduled to be raised.""" if self.timer is not None: return self.timer.pending else: return False
[ "def", "pending", "(", "self", ")", ":", "if", "self", ".", "timer", "is", "not", "None", ":", "return", "self", ".", "timer", ".", "pending", "else", ":", "return", "False" ]
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/eventlet-0.24.1/eventlet/timeout.py#L74-L79
Map-A-Droid/MAD
81375b5c9ccc5ca3161eb487aa81469d40ded221
mapadroid/db/DbWrapper.py
python
DbWrapper.autofetch_column
(self, sql, args=None, **kwargs)
return self._db_exec.autofetch_column(sql, args=args, **kwargs)
get one field for 0, 1, or more rows in a query and return the result in a list
get one field for 0, 1, or more rows in a query and return the result in a list
[ "get", "one", "field", "for", "0", "1", "or", "more", "rows", "in", "a", "query", "and", "return", "the", "result", "in", "a", "list" ]
def autofetch_column(self, sql, args=None, **kwargs): """ get one field for 0, 1, or more rows in a query and return the result in a list """ return self._db_exec.autofetch_column(sql, args=args, **kwargs)
[ "def", "autofetch_column", "(", "self", ",", "sql", ",", "args", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_db_exec", ".", "autofetch_column", "(", "sql", ",", "args", "=", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/Map-A-Droid/MAD/blob/81375b5c9ccc5ca3161eb487aa81469d40ded221/mapadroid/db/DbWrapper.py#L69-L72
googleapis/python-dialogflow
e48ea001b7c8a4a5c1fe4b162bad49ea397458e9
google/cloud/dialogflow_v2/services/documents/pagers.py
python
ListDocumentsPager.__iter__
(self)
[]
def __iter__(self) -> Iterator[document.Document]: for page in self.pages: yield from page.documents
[ "def", "__iter__", "(", "self", ")", "->", "Iterator", "[", "document", ".", "Document", "]", ":", "for", "page", "in", "self", ".", "pages", ":", "yield", "from", "page", ".", "documents" ]
https://github.com/googleapis/python-dialogflow/blob/e48ea001b7c8a4a5c1fe4b162bad49ea397458e9/google/cloud/dialogflow_v2/services/documents/pagers.py#L84-L86
pymedusa/Medusa
1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38
medusa/databases/utils.py
python
backup_database
(path, version)
Back up the database.
Back up the database.
[ "Back", "up", "the", "database", "." ]
def backup_database(path, version): """Back up the database.""" log.info('Backing up database before upgrade') if not helpers.backup_versioned_file(path, version): log.error('Database backup failed, abort upgrading database') sys.exit(1) else: log.info('Proceeding with upgrade')
[ "def", "backup_database", "(", "path", ",", "version", ")", ":", "log", ".", "info", "(", "'Backing up database before upgrade'", ")", "if", "not", "helpers", ".", "backup_versioned_file", "(", "path", ",", "version", ")", ":", "log", ".", "error", "(", "'Da...
https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/medusa/databases/utils.py#L19-L26
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/interfaces/maxima_abstract.py
python
MaximaAbstract.plot2d_parametric
(self, r, var, trange, nticks=50, options=None)
r""" Plot r = [x(t), y(t)] for t = tmin...tmax using gnuplot with options. INPUT: - ``r`` - a string representing a function (such as r="[x(t),y(t)]") - ``var`` - a string representing the variable (such as var = "t") - ``trange`` - [tmin, tmax] ...
r""" Plot r = [x(t), y(t)] for t = tmin...tmax using gnuplot with options.
[ "r", "Plot", "r", "=", "[", "x", "(", "t", ")", "y", "(", "t", ")", "]", "for", "t", "=", "tmin", "...", "tmax", "using", "gnuplot", "with", "options", "." ]
def plot2d_parametric(self, r, var, trange, nticks=50, options=None): r""" Plot r = [x(t), y(t)] for t = tmin...tmax using gnuplot with options. INPUT: - ``r`` - a string representing a function (such as r="[x(t),y(t)]") - ``var`` - a string representing the...
[ "def", "plot2d_parametric", "(", "self", ",", "r", ",", "var", ",", "trange", ",", "nticks", "=", "50", ",", "options", "=", "None", ")", ":", "tmin", "=", "trange", "[", "0", "]", "tmax", "=", "trange", "[", "1", "]", "cmd", "=", "\"plot2d([parame...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/interfaces/maxima_abstract.py#L714-L757
zhengye1995/Tianchi-2019-Guangdong-Intelligent-identification-of-cloth-defects-rank5
40cc4d35df5ff3e5063dc7dd5cc0da829c909adb
inference/convert_datasets/guangdong_round2.py
python
Fabric2COCO._get_box
(self, points, img_h, img_w)
return [min_x, min_y, w, h]
coco,[x,y,w,h]
coco,[x,y,w,h]
[ "coco", "[", "x", "y", "w", "h", "]" ]
def _get_box(self, points, img_h, img_w): min_x = min_y = np.inf max_x = max_y = 0 for x, y in points: min_x = min(min_x, x) min_y = min(min_y, y) max_x = max(max_x, x) max_y = max(max_y, y) '''coco,[x,y,w,h]''' w = max_x - min_x ...
[ "def", "_get_box", "(", "self", ",", "points", ",", "img_h", ",", "img_w", ")", ":", "min_x", "=", "min_y", "=", "np", ".", "inf", "max_x", "=", "max_y", "=", "0", "for", "x", ",", "y", "in", "points", ":", "min_x", "=", "min", "(", "min_x", ",...
https://github.com/zhengye1995/Tianchi-2019-Guangdong-Intelligent-identification-of-cloth-defects-rank5/blob/40cc4d35df5ff3e5063dc7dd5cc0da829c909adb/inference/convert_datasets/guangdong_round2.py#L110-L125
galaxyproject/galaxy
4c03520f05062e0f4a1b3655dc0b7452fda69943
lib/galaxy/jobs/runners/pbs.py
python
PBSJobRunner.get_stage_in_out
(self, fnames, symlink=False)
return stage
Convenience function to create a stagein/stageout list
Convenience function to create a stagein/stageout list
[ "Convenience", "function", "to", "create", "a", "stagein", "/", "stageout", "list" ]
def get_stage_in_out(self, fnames, symlink=False): """Convenience function to create a stagein/stageout list""" stage = '' for fname in fnames: if os.access(fname, os.R_OK): if stage: stage += ',' # pathnames are now absolute ...
[ "def", "get_stage_in_out", "(", "self", ",", "fnames", ",", "symlink", "=", "False", ")", ":", "stage", "=", "''", "for", "fname", "in", "fnames", ":", "if", "os", ".", "access", "(", "fname", ",", "os", ".", "R_OK", ")", ":", "if", "stage", ":", ...
https://github.com/galaxyproject/galaxy/blob/4c03520f05062e0f4a1b3655dc0b7452fda69943/lib/galaxy/jobs/runners/pbs.py#L486-L499
mozillazg/pypy
2ff5cd960c075c991389f842c6d59e71cf0cb7d0
rpython/flowspace/flowcontext.py
python
FlowContext.exception_match
(self, w_exc_type, w_check_class)
return False
Checks if the given exception type matches 'w_check_class'.
Checks if the given exception type matches 'w_check_class'.
[ "Checks", "if", "the", "given", "exception", "type", "matches", "w_check_class", "." ]
def exception_match(self, w_exc_type, w_check_class): """Checks if the given exception type matches 'w_check_class'.""" if not isinstance(w_check_class, Constant): raise FlowingError("Non-constant except guard.") check_class = w_check_class.value if not isinstance(check_class...
[ "def", "exception_match", "(", "self", ",", "w_exc_type", ",", "w_check_class", ")", ":", "if", "not", "isinstance", "(", "w_check_class", ",", "Constant", ")", ":", "raise", "FlowingError", "(", "\"Non-constant except guard.\"", ")", "check_class", "=", "w_check_...
https://github.com/mozillazg/pypy/blob/2ff5cd960c075c991389f842c6d59e71cf0cb7d0/rpython/flowspace/flowcontext.py#L564-L584
SFDO-Tooling/CumulusCI
825ae1f122b25dc41761c52a4ddfa1938d2a4b6e
cumulusci/utils/yaml/model_parser.py
python
CCIDictModel.get
(self, name, default=None)
return self.__dict__.get(name, default)
Emulate dict.get().
Emulate dict.get().
[ "Emulate", "dict", ".", "get", "()", "." ]
def get(self, name, default=None): "Emulate dict.get()." if name in self._magic_fields: name = self._alias_for_field(name) return self.__dict__.get(name, default)
[ "def", "get", "(", "self", ",", "name", ",", "default", "=", "None", ")", ":", "if", "name", "in", "self", ".", "_magic_fields", ":", "name", "=", "self", ".", "_alias_for_field", "(", "name", ")", "return", "self", ".", "__dict__", ".", "get", "(", ...
https://github.com/SFDO-Tooling/CumulusCI/blob/825ae1f122b25dc41761c52a4ddfa1938d2a4b6e/cumulusci/utils/yaml/model_parser.py#L120-L125
postlund/pyatv
4ed1f5539f37d86d80272663d1f2ea34a6c41ec4
pyatv/support/rtsp.py
python
RtspSession.setup
( self, headers: Optional[Dict[str, Any]] = None, body: Optional[Union[str, bytes]] = None, )
return await self.exchange("SETUP", headers=headers, body=body)
Send SETUP message.
Send SETUP message.
[ "Send", "SETUP", "message", "." ]
async def setup( self, headers: Optional[Dict[str, Any]] = None, body: Optional[Union[str, bytes]] = None, ) -> HttpResponse: """Send SETUP message.""" return await self.exchange("SETUP", headers=headers, body=body)
[ "async", "def", "setup", "(", "self", ",", "headers", ":", "Optional", "[", "Dict", "[", "str", ",", "Any", "]", "]", "=", "None", ",", "body", ":", "Optional", "[", "Union", "[", "str", ",", "bytes", "]", "]", "=", "None", ",", ")", "->", "Htt...
https://github.com/postlund/pyatv/blob/4ed1f5539f37d86d80272663d1f2ea34a6c41ec4/pyatv/support/rtsp.py#L169-L175
Chaffelson/nipyapi
d3b186fd701ce308c2812746d98af9120955e810
nipyapi/nifi/models/jvm_diagnostics_snapshot_dto.py
python
JVMDiagnosticsSnapshotDTO.system_diagnostics_dto
(self, system_diagnostics_dto)
Sets the system_diagnostics_dto of this JVMDiagnosticsSnapshotDTO. System-related diagnostics information :param system_diagnostics_dto: The system_diagnostics_dto of this JVMDiagnosticsSnapshotDTO. :type: JVMSystemDiagnosticsSnapshotDTO
Sets the system_diagnostics_dto of this JVMDiagnosticsSnapshotDTO. System-related diagnostics information
[ "Sets", "the", "system_diagnostics_dto", "of", "this", "JVMDiagnosticsSnapshotDTO", ".", "System", "-", "related", "diagnostics", "information" ]
def system_diagnostics_dto(self, system_diagnostics_dto): """ Sets the system_diagnostics_dto of this JVMDiagnosticsSnapshotDTO. System-related diagnostics information :param system_diagnostics_dto: The system_diagnostics_dto of this JVMDiagnosticsSnapshotDTO. :type: JVMSystemDi...
[ "def", "system_diagnostics_dto", "(", "self", ",", "system_diagnostics_dto", ")", ":", "self", ".", "_system_diagnostics_dto", "=", "system_diagnostics_dto" ]
https://github.com/Chaffelson/nipyapi/blob/d3b186fd701ce308c2812746d98af9120955e810/nipyapi/nifi/models/jvm_diagnostics_snapshot_dto.py#L73-L82
quantumlib/Cirq
89f88b01d69222d3f1ec14d649b7b3a85ed9211f
cirq-core/cirq/experiments/fidelity_estimation.py
python
least_squares_xeb_fidelity_from_probabilities
( hilbert_space_dimension: int, observed_probabilities: Sequence[Sequence[float]], all_probabilities: Sequence[Sequence[float]], observable_from_probability: Optional[Callable[[float], float]] = None, normalize_probabilities: bool = True, )
return least_squares_xeb_fidelity_from_expectations( measured_expectations, exact_expectations, uniform_expectations )
Least squares fidelity estimator with observable based on probabilities. Using the notation from the docstring of `least_squares_xeb_fidelity_from_expectations`, this function computes the least squares fidelity estimate when the observable O_U has eigenvalue corresponding to the computational basis st...
Least squares fidelity estimator with observable based on probabilities.
[ "Least", "squares", "fidelity", "estimator", "with", "observable", "based", "on", "probabilities", "." ]
def least_squares_xeb_fidelity_from_probabilities( hilbert_space_dimension: int, observed_probabilities: Sequence[Sequence[float]], all_probabilities: Sequence[Sequence[float]], observable_from_probability: Optional[Callable[[float], float]] = None, normalize_probabilities: bool = True, ) -> Tuple[f...
[ "def", "least_squares_xeb_fidelity_from_probabilities", "(", "hilbert_space_dimension", ":", "int", ",", "observed_probabilities", ":", "Sequence", "[", "Sequence", "[", "float", "]", "]", ",", "all_probabilities", ":", "Sequence", "[", "Sequence", "[", "float", "]", ...
https://github.com/quantumlib/Cirq/blob/89f88b01d69222d3f1ec14d649b7b3a85ed9211f/cirq-core/cirq/experiments/fidelity_estimation.py#L317-L382
pantsbuild/pex
473c6ac732ed4bc338b4b20a9ec930d1d722c9b4
pex/vendor/_vendored/setuptools/setuptools/command/egg_info.py
python
warn_depends_obsolete
(cmd, basename, filename)
[]
def warn_depends_obsolete(cmd, basename, filename): if os.path.exists(filename): log.warn( "WARNING: 'depends.txt' is not used by setuptools 0.6!\n" "Use the install_requires/extras_require setup() args instead." )
[ "def", "warn_depends_obsolete", "(", "cmd", ",", "basename", ",", "filename", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "filename", ")", ":", "log", ".", "warn", "(", "\"WARNING: 'depends.txt' is not used by setuptools 0.6!\\n\"", "\"Use the install_req...
https://github.com/pantsbuild/pex/blob/473c6ac732ed4bc338b4b20a9ec930d1d722c9b4/pex/vendor/_vendored/setuptools/setuptools/command/egg_info.py#L680-L685
kvfrans/variational-autoencoder
e6c94c6d4cee06b22c710923c3a8bbed84b88794
input_data.py
python
DataSet.next_batch
(self, batch_size, fake_data=False)
return self._images[start:end], self._labels[start:end]
Return the next `batch_size` examples from this data set.
Return the next `batch_size` examples from this data set.
[ "Return", "the", "next", "batch_size", "examples", "from", "this", "data", "set", "." ]
def next_batch(self, batch_size, fake_data=False): """Return the next `batch_size` examples from this data set.""" if fake_data: fake_image = [1.0 for _ in xrange(784)] fake_label = 0 return [fake_image for _ in xrange(batch_size)], [ fake_label for _ ...
[ "def", "next_batch", "(", "self", ",", "batch_size", ",", "fake_data", "=", "False", ")", ":", "if", "fake_data", ":", "fake_image", "=", "[", "1.0", "for", "_", "in", "xrange", "(", "784", ")", "]", "fake_label", "=", "0", "return", "[", "fake_image",...
https://github.com/kvfrans/variational-autoencoder/blob/e6c94c6d4cee06b22c710923c3a8bbed84b88794/input_data.py#L108-L130
mkusner/grammarVAE
ffffe272a8cf1772578dfc92254c55c224cddc02
Theano-master/theano/tensor/nnet/blocksparse.py
python
SparseBlockOuter.make_node
(self, o, x, y, xIdx, yIdx, alpha=None)
return Apply(self, [o, x, y, xIdx, yIdx, alpha], [o.type()])
Compute the dot product of the specified pieces of vectors and matrices. The parameter types are actually their expected shapes relative to each other. Parameters ---------- o : xBlocks, yBlocks, xSize, ySize x : batch, xWin, xSize y : batch, yWin, ySize...
Compute the dot product of the specified pieces of vectors and matrices.
[ "Compute", "the", "dot", "product", "of", "the", "specified", "pieces", "of", "vectors", "and", "matrices", "." ]
def make_node(self, o, x, y, xIdx, yIdx, alpha=None): """ Compute the dot product of the specified pieces of vectors and matrices. The parameter types are actually their expected shapes relative to each other. Parameters ---------- o : xBlocks, yBlocks, ...
[ "def", "make_node", "(", "self", ",", "o", ",", "x", ",", "y", ",", "xIdx", ",", "yIdx", ",", "alpha", "=", "None", ")", ":", "one", "=", "theano", ".", "tensor", ".", "constant", "(", "numpy", ".", "asarray", "(", "1.0", ",", "dtype", "=", "'f...
https://github.com/mkusner/grammarVAE/blob/ffffe272a8cf1772578dfc92254c55c224cddc02/Theano-master/theano/tensor/nnet/blocksparse.py#L152-L197
vitorfs/parsifal
9386a0fb328d4880d052c94e9224ce50a9b2f6a6
parsifal/apps/invites/views.py
python
ManageAccessView.get_success_message
(self, cleaned_data)
return _("An invitation was sent to %s.") % self.object.get_invitee_email()
[]
def get_success_message(self, cleaned_data): return _("An invitation was sent to %s.") % self.object.get_invitee_email()
[ "def", "get_success_message", "(", "self", ",", "cleaned_data", ")", ":", "return", "_", "(", "\"An invitation was sent to %s.\"", ")", "%", "self", ".", "object", ".", "get_invitee_email", "(", ")" ]
https://github.com/vitorfs/parsifal/blob/9386a0fb328d4880d052c94e9224ce50a9b2f6a6/parsifal/apps/invites/views.py#L25-L26
python-pillow/Pillow
fd2b07c454b20e1e9af0cea64923b21250f8f8d6
src/PIL/ImageSequence.py
python
all_frames
(im, func=None)
return [func(im) for im in ims] if func else ims
Applies a given function to all frames in an image or a list of images. The frames are returned as a list of separate images. :param im: An image, or a list of images. :param func: The function to apply to all of the image frames. :returns: A list of images.
Applies a given function to all frames in an image or a list of images. The frames are returned as a list of separate images.
[ "Applies", "a", "given", "function", "to", "all", "frames", "in", "an", "image", "or", "a", "list", "of", "images", ".", "The", "frames", "are", "returned", "as", "a", "list", "of", "separate", "images", "." ]
def all_frames(im, func=None): """ Applies a given function to all frames in an image or a list of images. The frames are returned as a list of separate images. :param im: An image, or a list of images. :param func: The function to apply to all of the image frames. :returns: A list of images. ...
[ "def", "all_frames", "(", "im", ",", "func", "=", "None", ")", ":", "if", "not", "isinstance", "(", "im", ",", "list", ")", ":", "im", "=", "[", "im", "]", "ims", "=", "[", "]", "for", "imSequence", "in", "im", ":", "current", "=", "imSequence", ...
https://github.com/python-pillow/Pillow/blob/fd2b07c454b20e1e9af0cea64923b21250f8f8d6/src/PIL/ImageSequence.py#L56-L75
jhpyle/docassemble
b90c84e57af59aa88b3404d44d0b125c70f832cc
docassemble_base/docassemble/base/util.py
python
DACloudStorage.client
(self)
return server.cloud.client
This property returns a boto3.client('s3') object.
This property returns a boto3.client('s3') object.
[ "This", "property", "returns", "a", "boto3", ".", "client", "(", "s3", ")", "object", "." ]
def client(self): """This property returns a boto3.client('s3') object.""" if self.custom: return server.cloud_custom(self.provider, self.config).client return server.cloud.client
[ "def", "client", "(", "self", ")", ":", "if", "self", ".", "custom", ":", "return", "server", ".", "cloud_custom", "(", "self", ".", "provider", ",", "self", ".", "config", ")", ".", "client", "return", "server", ".", "cloud", ".", "client" ]
https://github.com/jhpyle/docassemble/blob/b90c84e57af59aa88b3404d44d0b125c70f832cc/docassemble_base/docassemble/base/util.py#L5577-L5581
studywolf/control
4e94cb9c10543a5f5e798c0ec2605893bb21c321
studywolf_control/controllers/ilqr.py
python
Control.gen_target
(self, arm)
return self.target.tolist()
Generate a random target
Generate a random target
[ "Generate", "a", "random", "target" ]
def gen_target(self, arm): """Generate a random target""" gain = np.sum(arm.L) * .75 bias = -np.sum(arm.L) * 0 self.target = np.random.random(size=(2,)) * gain + bias return self.target.tolist()
[ "def", "gen_target", "(", "self", ",", "arm", ")", ":", "gain", "=", "np", ".", "sum", "(", "arm", ".", "L", ")", "*", ".75", "bias", "=", "-", "np", ".", "sum", "(", "arm", ".", "L", ")", "*", "0", "self", ".", "target", "=", "np", ".", ...
https://github.com/studywolf/control/blob/4e94cb9c10543a5f5e798c0ec2605893bb21c321/studywolf_control/controllers/ilqr.py#L220-L227
robinhood/faust
01b4c0ad8390221db71751d80001b0fd879291e2
faust/cli/worker.py
python
worker.platform
(self)
return '{py_imp} {py_version} ({system} {machine})'.format( py_imp=platform.python_implementation(), py_version=platform.python_version(), system=platform.system(), machine=platform.machine(), )
Return platform identifier as ANSI string.
Return platform identifier as ANSI string.
[ "Return", "platform", "identifier", "as", "ANSI", "string", "." ]
def platform(self) -> str: """Return platform identifier as ANSI string.""" return '{py_imp} {py_version} ({system} {machine})'.format( py_imp=platform.python_implementation(), py_version=platform.python_version(), system=platform.system(), machine=platfor...
[ "def", "platform", "(", "self", ")", "->", "str", ":", "return", "'{py_imp} {py_version} ({system} {machine})'", ".", "format", "(", "py_imp", "=", "platform", ".", "python_implementation", "(", ")", ",", "py_version", "=", "platform", ".", "python_version", "(", ...
https://github.com/robinhood/faust/blob/01b4c0ad8390221db71751d80001b0fd879291e2/faust/cli/worker.py#L159-L166
odlgroup/odl
0b088df8dc4621c68b9414c3deff9127f4c4f11d
odl/phantom/geometric.py
python
_getshapes_3d
(center, max_radius, shape)
return tuple(idx), tuple(shapes)
Calculate indices and slices for the bounding box of a ball.
Calculate indices and slices for the bounding box of a ball.
[ "Calculate", "indices", "and", "slices", "for", "the", "bounding", "box", "of", "a", "ball", "." ]
def _getshapes_3d(center, max_radius, shape): """Calculate indices and slices for the bounding box of a ball.""" index_mean = shape * center index_radius = max_radius / 2.0 * np.array(shape) min_idx = np.floor(index_mean - index_radius).astype(int) min_idx = np.maximum(min_idx, 0) # avoid negative...
[ "def", "_getshapes_3d", "(", "center", ",", "max_radius", ",", "shape", ")", ":", "index_mean", "=", "shape", "*", "center", "index_radius", "=", "max_radius", "/", "2.0", "*", "np", ".", "array", "(", "shape", ")", "min_idx", "=", "np", ".", "floor", ...
https://github.com/odlgroup/odl/blob/0b088df8dc4621c68b9414c3deff9127f4c4f11d/odl/phantom/geometric.py#L441-L453
happinesslz/TANet
2d4b2ab99b8e57c03671b0f1531eab7dca8f3c1f
pointpillars_with_TANet/torchplus/train/optim.py
python
MixedPrecisionWrapper.__setstate__
(self, state)
return self.optimizer.__setstate__(state)
[]
def __setstate__(self, state): return self.optimizer.__setstate__(state)
[ "def", "__setstate__", "(", "self", ",", "state", ")", ":", "return", "self", ".", "optimizer", ".", "__setstate__", "(", "state", ")" ]
https://github.com/happinesslz/TANet/blob/2d4b2ab99b8e57c03671b0f1531eab7dca8f3c1f/pointpillars_with_TANet/torchplus/train/optim.py#L73-L74
JiaweiZhuang/xESMF
2d2e365065711337286404e36fcb23c0def9eba8
xesmf/frontend.py
python
as_2d_mesh
(lon, lat)
return lon, lat
[]
def as_2d_mesh(lon, lat): if (lon.ndim, lat.ndim) == (2, 2): assert lon.shape == lat.shape, 'lon and lat should have same shape' elif (lon.ndim, lat.ndim) == (1, 1): lon, lat = np.meshgrid(lon, lat) else: raise ValueError('lon and lat should be both 1D or 2D') return lon, lat
[ "def", "as_2d_mesh", "(", "lon", ",", "lat", ")", ":", "if", "(", "lon", ".", "ndim", ",", "lat", ".", "ndim", ")", "==", "(", "2", ",", "2", ")", ":", "assert", "lon", ".", "shape", "==", "lat", ".", "shape", ",", "'lon and lat should have same sh...
https://github.com/JiaweiZhuang/xESMF/blob/2d2e365065711337286404e36fcb23c0def9eba8/xesmf/frontend.py#L21-L30
nosmokingbandit/watcher
dadacd21a5790ee609058a98a17fcc8954d24439
lib/sqlalchemy/util/langhelpers.py
python
decorator
(target)
return update_wrapper(decorate, target)
A signature-matching decorator factory.
A signature-matching decorator factory.
[ "A", "signature", "-", "matching", "decorator", "factory", "." ]
def decorator(target): """A signature-matching decorator factory.""" def decorate(fn): if not inspect.isfunction(fn): raise Exception("not a decoratable function") spec = compat.inspect_getfullargspec(fn) names = tuple(spec[0]) + spec[1:3] + (fn.__name__,) targ_name,...
[ "def", "decorator", "(", "target", ")", ":", "def", "decorate", "(", "fn", ")", ":", "if", "not", "inspect", ".", "isfunction", "(", "fn", ")", ":", "raise", "Exception", "(", "\"not a decoratable function\"", ")", "spec", "=", "compat", ".", "inspect_getf...
https://github.com/nosmokingbandit/watcher/blob/dadacd21a5790ee609058a98a17fcc8954d24439/lib/sqlalchemy/util/langhelpers.py#L111-L134
replit-archive/empythoned
977ec10ced29a3541a4973dc2b59910805695752
cpython/Lib/lib2to3/patcomp.py
python
PatternCompiler.__init__
(self, grammar_file=_PATTERN_GRAMMAR_FILE)
Initializer. Takes an optional alternative filename for the pattern grammar.
Initializer.
[ "Initializer", "." ]
def __init__(self, grammar_file=_PATTERN_GRAMMAR_FILE): """Initializer. Takes an optional alternative filename for the pattern grammar. """ self.grammar = driver.load_grammar(grammar_file) self.syms = pygram.Symbols(self.grammar) self.pygrammar = pygram.python_grammar ...
[ "def", "__init__", "(", "self", ",", "grammar_file", "=", "_PATTERN_GRAMMAR_FILE", ")", ":", "self", ".", "grammar", "=", "driver", ".", "load_grammar", "(", "grammar_file", ")", "self", ".", "syms", "=", "pygram", ".", "Symbols", "(", "self", ".", "gramma...
https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/cpython/Lib/lib2to3/patcomp.py#L45-L54
leo-editor/leo-editor
383d6776d135ef17d73d935a2f0ecb3ac0e99494
leo/core/leoFrame.py
python
LeoTree.scroll_cursor
(self, p)
Scroll the cursor.
Scroll the cursor.
[ "Scroll", "the", "cursor", "." ]
def scroll_cursor(self, p): """Scroll the cursor.""" p.restoreCursorAndScroll()
[ "def", "scroll_cursor", "(", "self", ",", "p", ")", ":", "p", ".", "restoreCursorAndScroll", "(", ")" ]
https://github.com/leo-editor/leo-editor/blob/383d6776d135ef17d73d935a2f0ecb3ac0e99494/leo/core/leoFrame.py#L1620-L1622
nansencenter/DAPPER
406f5a526919286aa73b017add507f5b0cb98233
dapper/tools/viz.py
python
default_fig_adjustments
(tables, xticks_from_data=False)
Beautify. These settings do not generalize well.
Beautify. These settings do not generalize well.
[ "Beautify", ".", "These", "settings", "do", "not", "generalize", "well", "." ]
def default_fig_adjustments(tables, xticks_from_data=False): """Beautify. These settings do not generalize well.""" # Get axs as 2d-array axs = np.array([table.panels for table in tables.values()]).T # Main panels (top row) only: sensible_f = ticker.FormatStrFormatter('%g') for ax in axs[0, :]:...
[ "def", "default_fig_adjustments", "(", "tables", ",", "xticks_from_data", "=", "False", ")", ":", "# Get axs as 2d-array", "axs", "=", "np", ".", "array", "(", "[", "table", ".", "panels", "for", "table", "in", "tables", ".", "values", "(", ")", "]", ")", ...
https://github.com/nansencenter/DAPPER/blob/406f5a526919286aa73b017add507f5b0cb98233/dapper/tools/viz.py#L602-L646
biolab/orange3
41685e1c7b1d1babe680113685a2d44bcc9fec0b
Orange/widgets/visualize/utils/tree/treeadapter.py
python
BaseTreeAdapter.__init__
(self, model)
[]
def __init__(self, model): self.model = model self.domain = model.domain self.instances = model.instances self.instances_transformed = self.instances.transform(self.domain)
[ "def", "__init__", "(", "self", ",", "model", ")", ":", "self", ".", "model", "=", "model", "self", ".", "domain", "=", "model", ".", "domain", "self", ".", "instances", "=", "model", ".", "instances", "self", ".", "instances_transformed", "=", "self", ...
https://github.com/biolab/orange3/blob/41685e1c7b1d1babe680113685a2d44bcc9fec0b/Orange/widgets/visualize/utils/tree/treeadapter.py#L21-L25
BlackLight/platypush
a6b552504e2ac327c94f3a28b607061b6b60cf36
platypush/plugins/music/mpd/__init__.py
python
MusicMpdPlugin.seek
(self, position)
return self._exec('seekcur', position)
Seek to the specified position :param position: Seek position in seconds, or delta string (e.g. '+15' or '-15') to indicate a seek relative to the current position :type position: int
Seek to the specified position
[ "Seek", "to", "the", "specified", "position" ]
def seek(self, position): """ Seek to the specified position :param position: Seek position in seconds, or delta string (e.g. '+15' or '-15') to indicate a seek relative to the current position :type position: int """ return self._exec('seekcur', position)
[ "def", "seek", "(", "self", ",", "position", ")", ":", "return", "self", ".", "_exec", "(", "'seekcur'", ",", "position", ")" ]
https://github.com/BlackLight/platypush/blob/a6b552504e2ac327c94f3a28b607061b6b60cf36/platypush/plugins/music/mpd/__init__.py#L434-L442
openedx/edx-platform
68dd185a0ab45862a2a61e0f803d7e03d2be71b5
lms/djangoapps/courseware/courses.py
python
date_block_key_fn
(block)
return block.date or datetime.max.replace(tzinfo=pytz.UTC)
If the block's date is None, return the maximum datetime in order to force it to the end of the list of displayed blocks.
If the block's date is None, return the maximum datetime in order to force it to the end of the list of displayed blocks.
[ "If", "the", "block", "s", "date", "is", "None", "return", "the", "maximum", "datetime", "in", "order", "to", "force", "it", "to", "the", "end", "of", "the", "list", "of", "displayed", "blocks", "." ]
def date_block_key_fn(block): """ If the block's date is None, return the maximum datetime in order to force it to the end of the list of displayed blocks. """ return block.date or datetime.max.replace(tzinfo=pytz.UTC)
[ "def", "date_block_key_fn", "(", "block", ")", ":", "return", "block", ".", "date", "or", "datetime", ".", "max", ".", "replace", "(", "tzinfo", "=", "pytz", ".", "UTC", ")" ]
https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/lms/djangoapps/courseware/courses.py#L482-L487
GalSim-developers/GalSim
a05d4ec3b8d8574f99d3b0606ad882cbba53f345
devel/external/AEGIS/functions.py
python
select_good_stars
(catalog, nstars=25)
return best_stars
Return indices of nstars with the highest SNR in catalog.
Return indices of nstars with the highest SNR in catalog.
[ "Return", "indices", "of", "nstars", "with", "the", "highest", "SNR", "in", "catalog", "." ]
def select_good_stars(catalog, nstars=25): """Return indices of nstars with the highest SNR in catalog.""" dtype = [('snr', float), ('index',int)] values = np.array([(-np.inf,-1)], dtype=dtype) for i in range(catalog.nrows): if (catalog['IS_STAR'][i] == 1) and (catalog['IN_MASK'][i] == 0): ...
[ "def", "select_good_stars", "(", "catalog", ",", "nstars", "=", "25", ")", ":", "dtype", "=", "[", "(", "'snr'", ",", "float", ")", ",", "(", "'index'", ",", "int", ")", "]", "values", "=", "np", ".", "array", "(", "[", "(", "-", "np", ".", "in...
https://github.com/GalSim-developers/GalSim/blob/a05d4ec3b8d8574f99d3b0606ad882cbba53f345/devel/external/AEGIS/functions.py#L101-L110
visionml/pytracking
3e6a8980db7a2275252abcc398ed0c2494f0ceab
ltr/models/loss/lovasz_loss.py
python
binary_xloss
(logits, labels, ignore=None)
return loss
Binary Cross entropy loss logits: [B, H, W] Variable, logits at each pixel (between -\infty and +\infty) labels: [B, H, W] Tensor, binary ground truth masks (0 or 1) ignore: void class id
Binary Cross entropy loss logits: [B, H, W] Variable, logits at each pixel (between -\infty and +\infty) labels: [B, H, W] Tensor, binary ground truth masks (0 or 1) ignore: void class id
[ "Binary", "Cross", "entropy", "loss", "logits", ":", "[", "B", "H", "W", "]", "Variable", "logits", "at", "each", "pixel", "(", "between", "-", "\\", "infty", "and", "+", "\\", "infty", ")", "labels", ":", "[", "B", "H", "W", "]", "Tensor", "binary...
def binary_xloss(logits, labels, ignore=None): """ Binary Cross entropy loss logits: [B, H, W] Variable, logits at each pixel (between -\infty and +\infty) labels: [B, H, W] Tensor, binary ground truth masks (0 or 1) ignore: void class id """ logits, labels = flatten_binary_scores(logi...
[ "def", "binary_xloss", "(", "logits", ",", "labels", ",", "ignore", "=", "None", ")", ":", "logits", ",", "labels", "=", "flatten_binary_scores", "(", "logits", ",", "labels", ",", "ignore", ")", "loss", "=", "StableBCELoss", "(", ")", "(", "logits", ","...
https://github.com/visionml/pytracking/blob/3e6a8980db7a2275252abcc398ed0c2494f0ceab/ltr/models/loss/lovasz_loss.py#L150-L159
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_openshift/library/oc_env.py
python
DeploymentConfig.exists_env_value
(self, key, value)
return False
return whether a key, value pair exists
return whether a key, value pair exists
[ "return", "whether", "a", "key", "value", "pair", "exists" ]
def exists_env_value(self, key, value): ''' return whether a key, value pair exists ''' results = self.get_env_vars() if not results: return False for result in results: if result['name'] == key: if 'value' not in result: if v...
[ "def", "exists_env_value", "(", "self", ",", "key", ",", "value", ")", ":", "results", "=", "self", ".", "get_env_vars", "(", ")", "if", "not", "results", ":", "return", "False", "for", "result", "in", "results", ":", "if", "result", "[", "'name'", "]"...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_openshift/library/oc_env.py#L1554-L1568
twisted/twisted
dee676b040dd38b847ea6fb112a712cb5e119490
src/twisted/persisted/styles.py
python
Versioned.__getstate__
(self, dict=None)
return dct
Get state, adding a version number to it on its way out.
Get state, adding a version number to it on its way out.
[ "Get", "state", "adding", "a", "version", "number", "to", "it", "on", "its", "way", "out", "." ]
def __getstate__(self, dict=None): """Get state, adding a version number to it on its way out.""" dct = copy.copy(dict or self.__dict__) bases = _aybabtu(self.__class__) bases.reverse() bases.append(self.__class__) # don't forget me!! for base in bases: if "p...
[ "def", "__getstate__", "(", "self", ",", "dict", "=", "None", ")", ":", "dct", "=", "copy", ".", "copy", "(", "dict", "or", "self", ".", "__dict__", ")", "bases", "=", "_aybabtu", "(", "self", ".", "__class__", ")", "bases", ".", "reverse", "(", ")...
https://github.com/twisted/twisted/blob/dee676b040dd38b847ea6fb112a712cb5e119490/src/twisted/persisted/styles.py#L311-L326
fastnlp/fastNLP
fb645d370f4cc1b00c7dbb16c1ff4542327c46e5
fastNLP/core/batch.py
python
TorchLoaderIter.__init__
(self, dataset, collate_fn, batch_size=1, sampler=None, num_workers=0, pin_memory=False, drop_last=False, timeout=0, worker_init_fn=None, batch_sampler=None)
r""" :param dataset: 实现了__getitem__和__len__方法的数据容器。 :param callable collate_fn: 用于将样本组合成batch的函数。输入为[dataset[idx1], dataset[idx2], ...], 即dataset中 __getitem__返回值组成的list,返回值必须为两个dict,其中第一个dict会被认为是input,第二个dict中的内容被认为是target。 需要转换为tensor的数据,需要在collate_fn中转化,但不需要转移到对应device。 ...
r"""
[ "r" ]
def __init__(self, dataset, collate_fn, batch_size=1, sampler=None, num_workers=0, pin_memory=False, drop_last=False, timeout=0, worker_init_fn=None, batch_sampler=None): r""" :param dataset: 实现了__getitem__和__len__方法的数据容器。 :param callable colla...
[ "def", "__init__", "(", "self", ",", "dataset", ",", "collate_fn", ",", "batch_size", "=", "1", ",", "sampler", "=", "None", ",", "num_workers", "=", "0", ",", "pin_memory", "=", "False", ",", "drop_last", "=", "False", ",", "timeout", "=", "0", ",", ...
https://github.com/fastnlp/fastNLP/blob/fb645d370f4cc1b00c7dbb16c1ff4542327c46e5/fastNLP/core/batch.py#L399-L432
nortikin/sverchok
7b460f01317c15f2681bfa3e337c5e7346f3711b
utils/sv_mesh_utils.py
python
non_coincident_edges
(edges)
return edges_out, preseved_mask
Removes edges with repeated indices edges: list of edges - List[List[Int]] or Numpy array with shape (n,2) returns Tuple (valid edges - List[List[Int]] or similar Numpy array, Boolean List with preserved items marked as True - List[bool] or similar numpy array)
Removes edges with repeated indices edges: list of edges - List[List[Int]] or Numpy array with shape (n,2) returns Tuple (valid edges - List[List[Int]] or similar Numpy array, Boolean List with preserved items marked as True - List[bool] or similar numpy array)
[ "Removes", "edges", "with", "repeated", "indices", "edges", ":", "list", "of", "edges", "-", "List", "[", "List", "[", "Int", "]]", "or", "Numpy", "array", "with", "shape", "(", "n", "2", ")", "returns", "Tuple", "(", "valid", "edges", "-", "List", "...
def non_coincident_edges(edges): ''' Removes edges with repeated indices edges: list of edges - List[List[Int]] or Numpy array with shape (n,2) returns Tuple (valid edges - List[List[Int]] or similar Numpy array, Boolean List with preserved items marked as True - List[bool] or similar...
[ "def", "non_coincident_edges", "(", "edges", ")", ":", "if", "isinstance", "(", "edges", ",", "np", ".", "ndarray", ")", ":", "preseved_mask", "=", "edges", "[", ":", ",", "0", "]", "!=", "edges", "[", ":", ",", "1", "]", "edges_out", "=", "edges", ...
https://github.com/nortikin/sverchok/blob/7b460f01317c15f2681bfa3e337c5e7346f3711b/utils/sv_mesh_utils.py#L206-L226
zhaoolee/StarsAndClown
b2d4039cad2f9232b691e5976f787b49a0a2c113
node_modules/npmi/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py
python
_GenerateMSBuildRulePropsFile
(props_path, msbuild_rules)
Generate the .props file.
Generate the .props file.
[ "Generate", "the", ".", "props", "file", "." ]
def _GenerateMSBuildRulePropsFile(props_path, msbuild_rules): """Generate the .props file.""" content = ['Project', {'xmlns': 'http://schemas.microsoft.com/developer/msbuild/2003'}] for rule in msbuild_rules: content.extend([ ['PropertyGroup', {'Condition': "'$(%s)' == '' and '$(...
[ "def", "_GenerateMSBuildRulePropsFile", "(", "props_path", ",", "msbuild_rules", ")", ":", "content", "=", "[", "'Project'", ",", "{", "'xmlns'", ":", "'http://schemas.microsoft.com/developer/msbuild/2003'", "}", "]", "for", "rule", "in", "msbuild_rules", ":", "conten...
https://github.com/zhaoolee/StarsAndClown/blob/b2d4039cad2f9232b691e5976f787b49a0a2c113/node_modules/npmi/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py#L2245-L2274
oracle/oci-python-sdk
3c1604e4e212008fb6718e2f68cdb5ef71fd5793
src/oci/email/email_client.py
python
EmailClient.list_senders
(self, compartment_id, **kwargs)
Gets a collection of approved sender email addresses and sender IDs. :param str compartment_id: (required) The OCID for the compartment. :param str opc_request_id: (optional) The request ID for tracing from the system :param str lifecycle_state: (optional) ...
Gets a collection of approved sender email addresses and sender IDs.
[ "Gets", "a", "collection", "of", "approved", "sender", "email", "addresses", "and", "sender", "IDs", "." ]
def list_senders(self, compartment_id, **kwargs): """ Gets a collection of approved sender email addresses and sender IDs. :param str compartment_id: (required) The OCID for the compartment. :param str opc_request_id: (optional) The request ID for tracing from ...
[ "def", "list_senders", "(", "self", ",", "compartment_id", ",", "*", "*", "kwargs", ")", ":", "resource_path", "=", "\"/senders\"", "method", "=", "\"GET\"", "# Don't accept unknown kwargs", "expected_kwargs", "=", "[", "\"retry_strategy\"", ",", "\"opc_request_id\"",...
https://github.com/oracle/oci-python-sdk/blob/3c1604e4e212008fb6718e2f68cdb5ef71fd5793/src/oci/email/email_client.py#L1648-L1793
saltstack/salt
fae5bc757ad0f1716483ce7ae180b451545c2058
salt/cloud/clouds/linode.py
python
list_nodes_select
(call=None)
return _get_cloud_interface().list_nodes_select(call)
Return a list of the VMs that are on the provider, with select fields.
Return a list of the VMs that are on the provider, with select fields.
[ "Return", "a", "list", "of", "the", "VMs", "that", "are", "on", "the", "provider", "with", "select", "fields", "." ]
def list_nodes_select(call=None): """ Return a list of the VMs that are on the provider, with select fields. """ return _get_cloud_interface().list_nodes_select(call)
[ "def", "list_nodes_select", "(", "call", "=", "None", ")", ":", "return", "_get_cloud_interface", "(", ")", ".", "list_nodes_select", "(", "call", ")" ]
https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/cloud/clouds/linode.py#L2508-L2512
dagwieers/mrepo
a55cbc737d8bade92070d38e4dbb9a24be4b477f
rhn/_internal_xmlrpclib.py
python
Unmarshaller.end_dateTime
(self, data)
[]
def end_dateTime(self, data): value = DateTime() value.decode(data) self.append(value)
[ "def", "end_dateTime", "(", "self", ",", "data", ")", ":", "value", "=", "DateTime", "(", ")", "value", ".", "decode", "(", "data", ")", "self", ".", "append", "(", "value", ")" ]
https://github.com/dagwieers/mrepo/blob/a55cbc737d8bade92070d38e4dbb9a24be4b477f/rhn/_internal_xmlrpclib.py#L806-L809
Netflix/vmaf
e768a2be57116c76bf33be7f8ee3566d8b774664
python/vmaf/core/asset.py
python
Asset.use_path_as_workpath
(self)
If True, use ref_path as ref_workfile_path, and dis_path as dis_workfile_path.
If True, use ref_path as ref_workfile_path, and dis_path as dis_workfile_path.
[ "If", "True", "use", "ref_path", "as", "ref_workfile_path", "and", "dis_path", "as", "dis_workfile_path", "." ]
def use_path_as_workpath(self): """ If True, use ref_path as ref_workfile_path, and dis_path as dis_workfile_path. """ if 'use_path_as_workpath' in self.asset_dict: if self.asset_dict['use_path_as_workpath'] == 1: return True elif self.asse...
[ "def", "use_path_as_workpath", "(", "self", ")", ":", "if", "'use_path_as_workpath'", "in", "self", ".", "asset_dict", ":", "if", "self", ".", "asset_dict", "[", "'use_path_as_workpath'", "]", "==", "1", ":", "return", "True", "elif", "self", ".", "asset_dict"...
https://github.com/Netflix/vmaf/blob/e768a2be57116c76bf33be7f8ee3566d8b774664/python/vmaf/core/asset.py#L745-L758
securityclippy/elasticintel
aa08d3e9f5ab1c000128e95161139ce97ff0e334
ingest_feed_lambda/numpy/lib/nanfunctions.py
python
nancumprod
(a, axis=None, dtype=None, out=None)
return np.cumprod(a, axis=axis, dtype=dtype, out=out)
Return the cumulative product of array elements over a given axis treating Not a Numbers (NaNs) as one. The cumulative product does not change when NaNs are encountered and leading NaNs are replaced by ones. Ones are returned for slices that are all-NaN or empty. .. versionadded:: 1.12.0 Paramet...
Return the cumulative product of array elements over a given axis treating Not a Numbers (NaNs) as one. The cumulative product does not change when NaNs are encountered and leading NaNs are replaced by ones.
[ "Return", "the", "cumulative", "product", "of", "array", "elements", "over", "a", "given", "axis", "treating", "Not", "a", "Numbers", "(", "NaNs", ")", "as", "one", ".", "The", "cumulative", "product", "does", "not", "change", "when", "NaNs", "are", "encou...
def nancumprod(a, axis=None, dtype=None, out=None): """ Return the cumulative product of array elements over a given axis treating Not a Numbers (NaNs) as one. The cumulative product does not change when NaNs are encountered and leading NaNs are replaced by ones. Ones are returned for slices that ...
[ "def", "nancumprod", "(", "a", ",", "axis", "=", "None", ",", "dtype", "=", "None", ",", "out", "=", "None", ")", ":", "a", ",", "mask", "=", "_replace_nan", "(", "a", ",", "1", ")", "return", "np", ".", "cumprod", "(", "a", ",", "axis", "=", ...
https://github.com/securityclippy/elasticintel/blob/aa08d3e9f5ab1c000128e95161139ce97ff0e334/ingest_feed_lambda/numpy/lib/nanfunctions.py#L675-L734
FSecureLABS/Jandroid
e31d0dab58a2bfd6ed8e0a387172b8bd7c893436
libs/platform-tools/platform-tools_darwin/systrace/catapult/devil/devil/android/sdk/gce_adb_wrapper.py
python
GceAdbWrapper._Connect
(self, timeout=adb_wrapper.DEFAULT_TIMEOUT, retries=adb_wrapper.DEFAULT_RETRIES)
Connects ADB to the android gce instance.
Connects ADB to the android gce instance.
[ "Connects", "ADB", "to", "the", "android", "gce", "instance", "." ]
def _Connect(self, timeout=adb_wrapper.DEFAULT_TIMEOUT, retries=adb_wrapper.DEFAULT_RETRIES): """Connects ADB to the android gce instance.""" cmd = ['connect', self._device_serial] output = self._RunAdbCmd(cmd, timeout=timeout, retries=retries) if 'unable to connect' in output: rais...
[ "def", "_Connect", "(", "self", ",", "timeout", "=", "adb_wrapper", ".", "DEFAULT_TIMEOUT", ",", "retries", "=", "adb_wrapper", ".", "DEFAULT_RETRIES", ")", ":", "cmd", "=", "[", "'connect'", ",", "self", ".", "_device_serial", "]", "output", "=", "self", ...
https://github.com/FSecureLABS/Jandroid/blob/e31d0dab58a2bfd6ed8e0a387172b8bd7c893436/libs/platform-tools/platform-tools_darwin/systrace/catapult/devil/devil/android/sdk/gce_adb_wrapper.py#L32-L39
mlachmish/MusicGenreClassification
78443a86eae25fb7f943baee05fe15ab245ff4ab
mfcc/code/lib/hdf5_getters.py
python
get_sections_start
(h5,songidx=0)
return h5.root.analysis.sections_start[h5.root.analysis.songs.cols.idx_sections_start[songidx]: h5.root.analysis.songs.cols.idx_sections_start[songidx+1]]
Get sections start array. Takes care of the proper indexing if we are in aggregate file. By default, return the array for the first song in the h5 file. To get a regular numpy ndarray, cast the result to: numpy.array( )
Get sections start array. Takes care of the proper indexing if we are in aggregate file. By default, return the array for the first song in the h5 file. To get a regular numpy ndarray, cast the result to: numpy.array( )
[ "Get", "sections", "start", "array", ".", "Takes", "care", "of", "the", "proper", "indexing", "if", "we", "are", "in", "aggregate", "file", ".", "By", "default", "return", "the", "array", "for", "the", "first", "song", "in", "the", "h5", "file", ".", "...
def get_sections_start(h5,songidx=0): """ Get sections start array. Takes care of the proper indexing if we are in aggregate file. By default, return the array for the first song in the h5 file. To get a regular numpy ndarray, cast the result to: numpy.array( ) """ if h5.root.analysis.songs.nrow...
[ "def", "get_sections_start", "(", "h5", ",", "songidx", "=", "0", ")", ":", "if", "h5", ".", "root", ".", "analysis", ".", "songs", ".", "nrows", "==", "songidx", "+", "1", ":", "return", "h5", ".", "root", ".", "analysis", ".", "sections_start", "["...
https://github.com/mlachmish/MusicGenreClassification/blob/78443a86eae25fb7f943baee05fe15ab245ff4ab/mfcc/code/lib/hdf5_getters.py#L362-L371
openstack/manila
142990edc027e14839d5deaf4954dd6fc88de15e
manila/share/drivers/netapp/dataontap/client/client_cmode.py
python
NetAppCmodeClient.get_node_data_ports
(self, node)
return self._sort_data_ports_by_speed(ports)
Get applicable data ports on the node.
Get applicable data ports on the node.
[ "Get", "applicable", "data", "ports", "on", "the", "node", "." ]
def get_node_data_ports(self, node): """Get applicable data ports on the node.""" api_args = { 'query': { 'net-port-info': { 'node': node, 'link-status': 'up', 'port-type': 'physical|if_group', 'r...
[ "def", "get_node_data_ports", "(", "self", ",", "node", ")", ":", "api_args", "=", "{", "'query'", ":", "{", "'net-port-info'", ":", "{", "'node'", ":", "node", ",", "'link-status'", ":", "'up'", ",", "'port-type'", ":", "'physical|if_group'", ",", "'role'",...
https://github.com/openstack/manila/blob/142990edc027e14839d5deaf4954dd6fc88de15e/manila/share/drivers/netapp/dataontap/client/client_cmode.py#L548-L586
4shadoww/hakkuframework
409a11fc3819d251f86faa3473439f8c19066a21
lib/scapy/layers/tls/keyexchange.py
python
ServerECDHExplicitPrimeParams.fill_missing
(self)
Note that if it is not set by the user, the cofactor will always be 1. It is true for most, but not all, TLS elliptic curves.
Note that if it is not set by the user, the cofactor will always be 1. It is true for most, but not all, TLS elliptic curves.
[ "Note", "that", "if", "it", "is", "not", "set", "by", "the", "user", "the", "cofactor", "will", "always", "be", "1", ".", "It", "is", "true", "for", "most", "but", "not", "all", "TLS", "elliptic", "curves", "." ]
def fill_missing(self): """ Note that if it is not set by the user, the cofactor will always be 1. It is true for most, but not all, TLS elliptic curves. """ if self.curve_type is None: self.curve_type = _tls_ec_curve_types["explicit_prime"]
[ "def", "fill_missing", "(", "self", ")", ":", "if", "self", ".", "curve_type", "is", "None", ":", "self", ".", "curve_type", "=", "_tls_ec_curve_types", "[", "\"explicit_prime\"", "]" ]
https://github.com/4shadoww/hakkuframework/blob/409a11fc3819d251f86faa3473439f8c19066a21/lib/scapy/layers/tls/keyexchange.py#L512-L518
django-nonrel/django-nonrel
4fbfe7344481a5eab8698f79207f09124310131b
django/contrib/comments/moderation.py
python
CommentModerator._get_delta
(self, now, then)
return now - then
Internal helper which will return a ``datetime.timedelta`` representing the time between ``now`` and ``then``. Assumes ``now`` is a ``datetime.date`` or ``datetime.datetime`` later than ``then``. If ``now`` and ``then`` are not of the same type due to one of them being a ``datet...
Internal helper which will return a ``datetime.timedelta`` representing the time between ``now`` and ``then``. Assumes ``now`` is a ``datetime.date`` or ``datetime.datetime`` later than ``then``.
[ "Internal", "helper", "which", "will", "return", "a", "datetime", ".", "timedelta", "representing", "the", "time", "between", "now", "and", "then", ".", "Assumes", "now", "is", "a", "datetime", ".", "date", "or", "datetime", ".", "datetime", "later", "than",...
def _get_delta(self, now, then): """ Internal helper which will return a ``datetime.timedelta`` representing the time between ``now`` and ``then``. Assumes ``now`` is a ``datetime.date`` or ``datetime.datetime`` later than ``then``. If ``now`` and ``then`` are not of the...
[ "def", "_get_delta", "(", "self", ",", "now", ",", "then", ")", ":", "if", "now", ".", "__class__", "is", "not", "then", ".", "__class__", ":", "now", "=", "datetime", ".", "date", "(", "now", ".", "year", ",", "now", ".", "month", ",", "now", "....
https://github.com/django-nonrel/django-nonrel/blob/4fbfe7344481a5eab8698f79207f09124310131b/django/contrib/comments/moderation.py#L176-L194
PaddlePaddle/PGL
e48545f2814523c777b8a9a9188bf5a7f00d6e52
apps/Graph4KG/models/ke_model.py
python
KGEModel.start_async_update
(self)
Initialize processes for asynchroneous update.
Initialize processes for asynchroneous update.
[ "Initialize", "processes", "for", "asynchroneous", "update", "." ]
def start_async_update(self): """Initialize processes for asynchroneous update. """ if self._ent_emb_on_cpu: self.ent_embedding.start_async_update() if self._rel_emb_on_cpu: self.rel_embedding.start_async_update()
[ "def", "start_async_update", "(", "self", ")", ":", "if", "self", ".", "_ent_emb_on_cpu", ":", "self", ".", "ent_embedding", ".", "start_async_update", "(", ")", "if", "self", ".", "_rel_emb_on_cpu", ":", "self", ".", "rel_embedding", ".", "start_async_update", ...
https://github.com/PaddlePaddle/PGL/blob/e48545f2814523c777b8a9a9188bf5a7f00d6e52/apps/Graph4KG/models/ke_model.py#L320-L326
omz/PythonistaAppTemplate
f560f93f8876d82a21d108977f90583df08d55af
PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/utilities/decorator.py
python
public
(obj)
return obj
Append ``obj``'s name to global ``__all__`` variable (call site). By using this decorator on functions or classes you achieve the same goal as by filling ``__all__`` variables manually, you just don't have to repeat your self (object's name). You also know if object is public at definition site, not at...
Append ``obj``'s name to global ``__all__`` variable (call site).
[ "Append", "obj", "s", "name", "to", "global", "__all__", "variable", "(", "call", "site", ")", "." ]
def public(obj): """ Append ``obj``'s name to global ``__all__`` variable (call site). By using this decorator on functions or classes you achieve the same goal as by filling ``__all__`` variables manually, you just don't have to repeat your self (object's name). You also know if object is public a...
[ "def", "public", "(", "obj", ")", ":", "if", "isinstance", "(", "obj", ",", "types", ".", "FunctionType", ")", ":", "ns", "=", "get_function_globals", "(", "obj", ")", "name", "=", "get_function_name", "(", "obj", ")", "elif", "isinstance", "(", "obj", ...
https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/utilities/decorator.py#L148-L193
oasis-open/cti-python-stix2
17445a085cb84734900603eb8009bcc856892762
stix2/datastore/filesystem.py
python
FileSystemSource.all_versions
(self, stix_id, version=None, _composite_filters=None)
return self.query(query, version=version, _composite_filters=_composite_filters)
Retrieve STIX object from file directory via STIX ID, all versions. Note: Since FileSystem sources/sinks don't handle multiple versions of a STIX object, this operation is unnecessary. Pass call to get(). Args: stix_id (str): The STIX ID of the STIX objects to be retrieved. ...
Retrieve STIX object from file directory via STIX ID, all versions.
[ "Retrieve", "STIX", "object", "from", "file", "directory", "via", "STIX", "ID", "all", "versions", "." ]
def all_versions(self, stix_id, version=None, _composite_filters=None): """Retrieve STIX object from file directory via STIX ID, all versions. Note: Since FileSystem sources/sinks don't handle multiple versions of a STIX object, this operation is unnecessary. Pass call to get(). Args: ...
[ "def", "all_versions", "(", "self", ",", "stix_id", ",", "version", "=", "None", ",", "_composite_filters", "=", "None", ")", ":", "query", "=", "[", "Filter", "(", "\"id\"", ",", "\"=\"", ",", "stix_id", ")", "]", "return", "self", ".", "query", "(", ...
https://github.com/oasis-open/cti-python-stix2/blob/17445a085cb84734900603eb8009bcc856892762/stix2/datastore/filesystem.py#L698-L719
wakatime/legacy-python-cli
9b64548b16ab5ef16603d9a6c2620a16d0df8d46
wakatime/packages/py27/pygments/styles/__init__.py
python
get_all_styles
()
Return an generator for all styles by name, both builtin and plugin.
Return an generator for all styles by name, both builtin and plugin.
[ "Return", "an", "generator", "for", "all", "styles", "by", "name", "both", "builtin", "and", "plugin", "." ]
def get_all_styles(): """Return an generator for all styles by name, both builtin and plugin.""" for name in STYLE_MAP: yield name for name, _ in find_plugin_styles(): yield name
[ "def", "get_all_styles", "(", ")", ":", "for", "name", "in", "STYLE_MAP", ":", "yield", "name", "for", "name", ",", "_", "in", "find_plugin_styles", "(", ")", ":", "yield", "name" ]
https://github.com/wakatime/legacy-python-cli/blob/9b64548b16ab5ef16603d9a6c2620a16d0df8d46/wakatime/packages/py27/pygments/styles/__init__.py#L81-L87
aiidateam/aiida-core
c743a335480f8bb3a5e4ebd2463a31f9f3b9f9b2
aiida/common/progress_reporter.py
python
ProgressReporterAbstract.total
(self)
return self._total
Return the total iterations expected.
Return the total iterations expected.
[ "Return", "the", "total", "iterations", "expected", "." ]
def total(self) -> int: """Return the total iterations expected.""" return self._total
[ "def", "total", "(", "self", ")", "->", "int", ":", "return", "self", ".", "_total" ]
https://github.com/aiidateam/aiida-core/blob/c743a335480f8bb3a5e4ebd2463a31f9f3b9f9b2/aiida/common/progress_reporter.py#L58-L60
pypa/pipenv
b21baade71a86ab3ee1429f71fbc14d4f95fb75d
pipenv/patched/notpip/_internal/utils/models.py
python
KeyBasedCompareMixin.__hash__
(self)
return hash(self._compare_key)
[]
def __hash__(self): # type: () -> int return hash(self._compare_key)
[ "def", "__hash__", "(", "self", ")", ":", "# type: () -> int", "return", "hash", "(", "self", ".", "_compare_key", ")" ]
https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/patched/notpip/_internal/utils/models.py#L18-L20
007gzs/dingtalk-sdk
7979da2e259fdbc571728cae2425a04dbc65850a
dingtalk/client/api/taobao.py
python
TbJiuDianShangPin.taobao_xhotel_rate_get
( self, gid='', rpid='', out_rid='', rateplan_code='', vendor='', rate_id='' )
return self._top_request( "taobao.xhotel.rate.get", { "gid": gid, "rpid": rpid, "out_rid": out_rid, "rateplan_code": rateplan_code, "vendor": vendor, "rate_id": rate_id }, resu...
酒店产品库rate查询 文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=22674 :param gid: gid酒店商品id :param rpid: 酒店RPID :param out_rid: 卖家房型ID, 这是卖家自己系统中的房型ID 注意:需要按照规则组合 :param rateplan_code: 卖家自己系统的Code,简称RateCode :param vendor: 用于标示该宝贝的售卖渠道信息,允许同一个卖家酒店房型在淘宝系统发布多个售卖渠道的宝贝的价格。...
酒店产品库rate查询 文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=22674
[ "酒店产品库rate查询", "文档地址:https", ":", "//", "open", "-", "doc", ".", "dingtalk", ".", "com", "/", "docs", "/", "api", ".", "htm?apiId", "=", "22674" ]
def taobao_xhotel_rate_get( self, gid='', rpid='', out_rid='', rateplan_code='', vendor='', rate_id='' ): """ 酒店产品库rate查询 文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=22674 :param gid: gid酒店...
[ "def", "taobao_xhotel_rate_get", "(", "self", ",", "gid", "=", "''", ",", "rpid", "=", "''", ",", "out_rid", "=", "''", ",", "rateplan_code", "=", "''", ",", "vendor", "=", "''", ",", "rate_id", "=", "''", ")", ":", "return", "self", ".", "_top_reque...
https://github.com/007gzs/dingtalk-sdk/blob/7979da2e259fdbc571728cae2425a04dbc65850a/dingtalk/client/api/taobao.py#L71735-L71766
eirannejad/pyRevit
49c0b7eb54eb343458ce1365425e6552d0c47d44
pyrevitlib/rpw/ui/selection.py
python
Selection.__bool__
(self)
return super(Selection, obj).__bool__()
Returns: bool: `False` if selection is empty, `True` otherwise >>> len(selection) 2 >>> Selection() is True True
Returns: bool: `False` if selection is empty, `True` otherwise
[ "Returns", ":", "bool", ":", "False", "if", "selection", "is", "empty", "True", "otherwise" ]
def __bool__(self): """ Returns: bool: `False` if selection is empty, `True` otherwise >>> len(selection) 2 >>> Selection() is True True """ return super(Selection, obj).__bool__()
[ "def", "__bool__", "(", "self", ")", ":", "return", "super", "(", "Selection", ",", "obj", ")", ".", "__bool__", "(", ")" ]
https://github.com/eirannejad/pyRevit/blob/49c0b7eb54eb343458ce1365425e6552d0c47d44/pyrevitlib/rpw/ui/selection.py#L115-L125
aws/sagemaker-python-sdk
9d259b316f7f43838c16f35c10e98a110b56735b
src/sagemaker/clarify.py
python
BiasConfig.__init__
( self, label_values_or_threshold, facet_name, facet_values_or_threshold=None, group_name=None, )
Initializes a configuration of the sensitive groups in the dataset. Args: label_values_or_threshold (Any): List of label values or threshold to indicate positive outcome used for bias metrics. facet_name (str or [str]): String or List of strings of sensitive attribute(s)...
Initializes a configuration of the sensitive groups in the dataset.
[ "Initializes", "a", "configuration", "of", "the", "sensitive", "groups", "in", "the", "dataset", "." ]
def __init__( self, label_values_or_threshold, facet_name, facet_values_or_threshold=None, group_name=None, ): """Initializes a configuration of the sensitive groups in the dataset. Args: label_values_or_threshold (Any): List of label values or th...
[ "def", "__init__", "(", "self", ",", "label_values_or_threshold", ",", "facet_name", ",", "facet_values_or_threshold", "=", "None", ",", "group_name", "=", "None", ",", ")", ":", "if", "isinstance", "(", "facet_name", ",", "str", ")", ":", "facet", "=", "{",...
https://github.com/aws/sagemaker-python-sdk/blob/9d259b316f7f43838c16f35c10e98a110b56735b/src/sagemaker/clarify.py#L104-L145
sympy/sympy
d822fcba181155b85ff2b29fe525adbafb22b448
sympy/physics/hep/gamma_matrices.py
python
extract_type_tens
(expression, component)
return new_expr, residual_expr
Extract from a ``TensExpr`` all tensors with `component`. Returns two tensor expressions: * the first contains all ``Tensor`` of having `component`. * the second contains all remaining.
Extract from a ``TensExpr`` all tensors with `component`.
[ "Extract", "from", "a", "TensExpr", "all", "tensors", "with", "component", "." ]
def extract_type_tens(expression, component): """ Extract from a ``TensExpr`` all tensors with `component`. Returns two tensor expressions: * the first contains all ``Tensor`` of having `component`. * the second contains all remaining. """ if isinstance(expression, Tensor): sp = ...
[ "def", "extract_type_tens", "(", "expression", ",", "component", ")", ":", "if", "isinstance", "(", "expression", ",", "Tensor", ")", ":", "sp", "=", "[", "expression", "]", "elif", "isinstance", "(", "expression", ",", "TensMul", ")", ":", "sp", "=", "e...
https://github.com/sympy/sympy/blob/d822fcba181155b85ff2b29fe525adbafb22b448/sympy/physics/hep/gamma_matrices.py#L46-L72
GoogleCloudPlatform/ml-on-gcp
ffd88931674e08ef6b0b20de27700ed1da61772c
example_zoo/tensorflow/probability/latent_dirichlet_allocation_distributions/trainer/latent_dirichlet_allocation_distributions.py
python
build_fake_input_fns
(batch_size)
return train_input_fn, eval_input_fn, vocabulary
Build fake data for unit testing.
Build fake data for unit testing.
[ "Build", "fake", "data", "for", "unit", "testing", "." ]
def build_fake_input_fns(batch_size): """Build fake data for unit testing.""" num_words = 1000 vocabulary = [str(i) for i in range(num_words)] random_sample = np.random.randint( 10, size=(batch_size, num_words)).astype(np.float32) def train_input_fn(): dataset = tf.data.Dataset.from_tensor_slices(...
[ "def", "build_fake_input_fns", "(", "batch_size", ")", ":", "num_words", "=", "1000", "vocabulary", "=", "[", "str", "(", "i", ")", "for", "i", "in", "range", "(", "num_words", ")", "]", "random_sample", "=", "np", ".", "random", ".", "randint", "(", "...
https://github.com/GoogleCloudPlatform/ml-on-gcp/blob/ffd88931674e08ef6b0b20de27700ed1da61772c/example_zoo/tensorflow/probability/latent_dirichlet_allocation_distributions/trainer/latent_dirichlet_allocation_distributions.py#L454-L472
gaasedelen/lighthouse
7245a2d2c4e84351cd259ed81dafa4263167909a
plugins/lighthouse/metadata.py
python
DatabaseMetadata.metadata_modified
(self, callback)
Subscribe a callback for metadata modification events.
Subscribe a callback for metadata modification events.
[ "Subscribe", "a", "callback", "for", "metadata", "modification", "events", "." ]
def metadata_modified(self, callback): """ Subscribe a callback for metadata modification events. """ register_callback(self._metadata_modified_callbacks, callback)
[ "def", "metadata_modified", "(", "self", ",", "callback", ")", ":", "register_callback", "(", "self", ".", "_metadata_modified_callbacks", ",", "callback", ")" ]
https://github.com/gaasedelen/lighthouse/blob/7245a2d2c4e84351cd259ed81dafa4263167909a/plugins/lighthouse/metadata.py#L692-L696
pyload/pyload
4410827ca7711f1a3cf91a0b11e967b81bbbcaa2
src/pyload/core/utils/check.py
python
haspropriety
(obj, name)
return attr and not callable(attr)
Check if propriety `name` was defined in obj.
Check if propriety `name` was defined in obj.
[ "Check", "if", "propriety", "name", "was", "defined", "in", "obj", "." ]
def haspropriety(obj, name): """Check if propriety `name` was defined in obj.""" attr = getattr(obj, name, None) return attr and not callable(attr)
[ "def", "haspropriety", "(", "obj", ",", "name", ")", ":", "attr", "=", "getattr", "(", "obj", ",", "name", ",", "None", ")", "return", "attr", "and", "not", "callable", "(", "attr", ")" ]
https://github.com/pyload/pyload/blob/4410827ca7711f1a3cf91a0b11e967b81bbbcaa2/src/pyload/core/utils/check.py#L23-L26
man-group/PythonTrainingExercises
00a2435649fcf53fdafede2d10b40f08463728fe
Beginners/stdlib/theCEOspeech/solution.py
python
write_speech
(n)
Write a speech with the opening words followed by n random phrases interspersed with random inserts.
Write a speech with the opening words followed by n random phrases interspersed with random inserts.
[ "Write", "a", "speech", "with", "the", "opening", "words", "followed", "by", "n", "random", "phrases", "interspersed", "with", "random", "inserts", "." ]
def write_speech(n): """Write a speech with the opening words followed by n random phrases interspersed with random inserts.""" phrases = OPENING_WORDS while n: phrases.extend(get_phrase()) if n > 1: phrases.append(get_insert()) n -= 1 text = ' '.join(phrases) + '...
[ "def", "write_speech", "(", "n", ")", ":", "phrases", "=", "OPENING_WORDS", "while", "n", ":", "phrases", ".", "extend", "(", "get_phrase", "(", ")", ")", "if", "n", ">", "1", ":", "phrases", ".", "append", "(", "get_insert", "(", ")", ")", "n", "-...
https://github.com/man-group/PythonTrainingExercises/blob/00a2435649fcf53fdafede2d10b40f08463728fe/Beginners/stdlib/theCEOspeech/solution.py#L67-L77
changye/AutoTrade
c3e77e22217b9fe39f2d20cf6d2aa7dabea1b339
Tools/Ocr.py
python
RClient.rk_create
(self, im, im_type, timeout=60)
return r.json()
im: 图片字节 im_type: 题目类型
im: 图片字节 im_type: 题目类型
[ "im", ":", "图片字节", "im_type", ":", "题目类型" ]
def rk_create(self, im, im_type, timeout=60): """ im: 图片字节 im_type: 题目类型 """ params = { 'typeid': im_type, 'timeout': timeout, } params.update(self.base_params) files = {'image': ('a.jpg', im)} r = requests.post('http://api....
[ "def", "rk_create", "(", "self", ",", "im", ",", "im_type", ",", "timeout", "=", "60", ")", ":", "params", "=", "{", "'typeid'", ":", "im_type", ",", "'timeout'", ":", "timeout", ",", "}", "params", ".", "update", "(", "self", ".", "base_params", ")"...
https://github.com/changye/AutoTrade/blob/c3e77e22217b9fe39f2d20cf6d2aa7dabea1b339/Tools/Ocr.py#L27-L39