repo
stringlengths
7
54
path
stringlengths
4
192
url
stringlengths
87
284
code
stringlengths
78
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
numenta/nupic
src/nupic/swarming/hypersearch/hs_state.py
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch/hs_state.py#L620-L637
def anyGoodSprintsActive(self): """Return True if there are any more good sprints still being explored. A 'good' sprint is one that is earlier than where we detected an increase in error from sprint to subsequent sprint. """ if self._state['lastGoodSprint'] is not None: goodSprints = self._sta...
[ "def", "anyGoodSprintsActive", "(", "self", ")", ":", "if", "self", ".", "_state", "[", "'lastGoodSprint'", "]", "is", "not", "None", ":", "goodSprints", "=", "self", ".", "_state", "[", "'sprints'", "]", "[", "0", ":", "self", ".", "_state", "[", "'la...
Return True if there are any more good sprints still being explored. A 'good' sprint is one that is earlier than where we detected an increase in error from sprint to subsequent sprint.
[ "Return", "True", "if", "there", "are", "any", "more", "good", "sprints", "still", "being", "explored", ".", "A", "good", "sprint", "is", "one", "that", "is", "earlier", "than", "where", "we", "detected", "an", "increase", "in", "error", "from", "sprint", ...
python
valid
7sDream/zhihu-py3
zhihu/author.py
https://github.com/7sDream/zhihu-py3/blob/bcb4aa8325f8b54d3b44bd0bdc959edd9761fcfc/zhihu/author.py#L118-L137
def motto(self): """获取用户自我介绍,由于历史原因,我还是把这个属性叫做motto吧. :return: 用户自我介绍 :rtype: str """ if self.url is None: return '' else: if self.soup is not None: bar = self.soup.find( 'div', class_='title-section') ...
[ "def", "motto", "(", "self", ")", ":", "if", "self", ".", "url", "is", "None", ":", "return", "''", "else", ":", "if", "self", ".", "soup", "is", "not", "None", ":", "bar", "=", "self", ".", "soup", ".", "find", "(", "'div'", ",", "class_", "="...
获取用户自我介绍,由于历史原因,我还是把这个属性叫做motto吧. :return: 用户自我介绍 :rtype: str
[ "获取用户自我介绍,由于历史原因,我还是把这个属性叫做motto吧", "." ]
python
train
tensorlayer/tensorlayer
tensorlayer/layers/utils.py
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/layers/utils.py#L47-L61
def compute_alpha(x): """Computing the scale parameter.""" threshold = _compute_threshold(x) alpha1_temp1 = tf.where(tf.greater(x, threshold), x, tf.zeros_like(x, tf.float32)) alpha1_temp2 = tf.where(tf.less(x, -threshold), x, tf.zeros_like(x, tf.float32)) alpha_array = tf.add(alpha1_temp1, alpha1_t...
[ "def", "compute_alpha", "(", "x", ")", ":", "threshold", "=", "_compute_threshold", "(", "x", ")", "alpha1_temp1", "=", "tf", ".", "where", "(", "tf", ".", "greater", "(", "x", ",", "threshold", ")", ",", "x", ",", "tf", ".", "zeros_like", "(", "x", ...
Computing the scale parameter.
[ "Computing", "the", "scale", "parameter", "." ]
python
valid
calmjs/calmjs.parse
src/calmjs/parse/unparsers/es5.py
https://github.com/calmjs/calmjs.parse/blob/369f0ee346c5a84c4d5c35a7733a0e63b02eac59/src/calmjs/parse/unparsers/es5.py#L329-L342
def pretty_print(ast, indent_str=' '): """ Simple pretty print function; returns a string rendering of an input AST of an ES5 Program. arguments ast The AST to pretty print indent_str The string used for indentations. Defaults to two spaces. """ return ''.join(chunk....
[ "def", "pretty_print", "(", "ast", ",", "indent_str", "=", "' '", ")", ":", "return", "''", ".", "join", "(", "chunk", ".", "text", "for", "chunk", "in", "pretty_printer", "(", "indent_str", ")", "(", "ast", ")", ")" ]
Simple pretty print function; returns a string rendering of an input AST of an ES5 Program. arguments ast The AST to pretty print indent_str The string used for indentations. Defaults to two spaces.
[ "Simple", "pretty", "print", "function", ";", "returns", "a", "string", "rendering", "of", "an", "input", "AST", "of", "an", "ES5", "Program", "." ]
python
train
adamrehn/ue4cli
ue4cli/UnrealManagerBase.py
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/UnrealManagerBase.py#L297-L314
def cleanDescriptor(self, dir=os.getcwd()): """ Cleans the build artifacts for the Unreal project or plugin in the specified directory """ # Verify that an Unreal project or plugin exists in the specified directory descriptor = self.getDescriptor(dir) # Because performing a clean will also delete the ...
[ "def", "cleanDescriptor", "(", "self", ",", "dir", "=", "os", ".", "getcwd", "(", ")", ")", ":", "# Verify that an Unreal project or plugin exists in the specified directory", "descriptor", "=", "self", ".", "getDescriptor", "(", "dir", ")", "# Because performing a clea...
Cleans the build artifacts for the Unreal project or plugin in the specified directory
[ "Cleans", "the", "build", "artifacts", "for", "the", "Unreal", "project", "or", "plugin", "in", "the", "specified", "directory" ]
python
train
qacafe/cdrouter.py
cdrouter/packages.py
https://github.com/qacafe/cdrouter.py/blob/aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5/cdrouter/packages.py#L218-L227
def get(self, id): # pylint: disable=invalid-name,redefined-builtin """Get a package. :param id: Package ID as an int. :return: :class:`packages.Package <packages.Package>` object :rtype: packages.Package """ schema = PackageSchema() resp = self.service.get_id(se...
[ "def", "get", "(", "self", ",", "id", ")", ":", "# pylint: disable=invalid-name,redefined-builtin", "schema", "=", "PackageSchema", "(", ")", "resp", "=", "self", ".", "service", ".", "get_id", "(", "self", ".", "base", ",", "id", ")", "return", "self", "....
Get a package. :param id: Package ID as an int. :return: :class:`packages.Package <packages.Package>` object :rtype: packages.Package
[ "Get", "a", "package", "." ]
python
train
turicas/rows
rows/utils.py
https://github.com/turicas/rows/blob/c74da41ae9ed091356b803a64f8a30c641c5fc45/rows/utils.py#L727-L755
def uncompressed_size(filename): """Return the uncompressed size for a file by executing commands Note: due to a limitation in gzip format, uncompressed files greather than 4GiB will have a wrong value. """ quoted_filename = shlex.quote(filename) # TODO: get filetype from file-magic, if avail...
[ "def", "uncompressed_size", "(", "filename", ")", ":", "quoted_filename", "=", "shlex", ".", "quote", "(", "filename", ")", "# TODO: get filetype from file-magic, if available", "if", "str", "(", "filename", ")", ".", "lower", "(", ")", ".", "endswith", "(", "\"...
Return the uncompressed size for a file by executing commands Note: due to a limitation in gzip format, uncompressed files greather than 4GiB will have a wrong value.
[ "Return", "the", "uncompressed", "size", "for", "a", "file", "by", "executing", "commands" ]
python
train
iskandr/knnimpute
knnimpute/optimistic.py
https://github.com/iskandr/knnimpute/blob/9a1b8abed9ce6c07a606f3f28cf45333e84d62f4/knnimpute/optimistic.py#L21-L152
def knn_impute_optimistic( X, missing_mask, k, verbose=False, print_interval=100): """ Fill in the given incomplete matrix using k-nearest neighbor imputation. This version assumes that most of the time the same neighbors will be used so first performs the weight...
[ "def", "knn_impute_optimistic", "(", "X", ",", "missing_mask", ",", "k", ",", "verbose", "=", "False", ",", "print_interval", "=", "100", ")", ":", "start_t", "=", "time", ".", "time", "(", ")", "n_rows", ",", "n_cols", "=", "X", ".", "shape", "X_row_m...
Fill in the given incomplete matrix using k-nearest neighbor imputation. This version assumes that most of the time the same neighbors will be used so first performs the weighted average of a row's k-nearest neighbors and checks afterward whether it was valid (due to possible missing values). Has been...
[ "Fill", "in", "the", "given", "incomplete", "matrix", "using", "k", "-", "nearest", "neighbor", "imputation", "." ]
python
train
decryptus/sonicprobe
sonicprobe/libs/workerpool.py
https://github.com/decryptus/sonicprobe/blob/72f73f3a40d2982d79ad68686e36aa31d94b76f8/sonicprobe/libs/workerpool.py#L237-L248
def killall(self, wait = None): """ Kill all active workers. @wait: Seconds to wait until last worker ends. If None it waits forever. """ with self.tasks.mutex: self.tasks.queue.clear() self.count_lock.acquire() self.kill(self.workers) ...
[ "def", "killall", "(", "self", ",", "wait", "=", "None", ")", ":", "with", "self", ".", "tasks", ".", "mutex", ":", "self", ".", "tasks", ".", "queue", ".", "clear", "(", ")", "self", ".", "count_lock", ".", "acquire", "(", ")", "self", ".", "kil...
Kill all active workers. @wait: Seconds to wait until last worker ends. If None it waits forever.
[ "Kill", "all", "active", "workers", "." ]
python
train
yymao/easyquery
easyquery.py
https://github.com/yymao/easyquery/blob/cd94c100e26f59042cd9ffb26d0a7b61cdcd457d/easyquery.py#L266-L282
def count(self, table): """ Use the current Query object to count the number of entries in `table` that satisfy `queries`. Parameters ---------- table : NumPy structured array, astropy Table, etc. Returns ------- count : int """ i...
[ "def", "count", "(", "self", ",", "table", ")", ":", "if", "self", ".", "_operator", "is", "None", "and", "self", ".", "_operands", "is", "None", ":", "return", "self", ".", "_get_table_len", "(", "table", ")", "return", "np", ".", "count_nonzero", "("...
Use the current Query object to count the number of entries in `table` that satisfy `queries`. Parameters ---------- table : NumPy structured array, astropy Table, etc. Returns ------- count : int
[ "Use", "the", "current", "Query", "object", "to", "count", "the", "number", "of", "entries", "in", "table", "that", "satisfy", "queries", "." ]
python
train
santoshphilip/eppy
eppy/results/readhtml.py
https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/results/readhtml.py#L49-L64
def table2matrix(table): """convert a table to a list of lists - a 2D matrix""" if not is_simpletable(table): raise NotSimpleTable("Not able read a cell in the table as a string") rows = [] for tr in table('tr'): row = [] for td in tr('td'): td = tdbr2EOL(td) # conve...
[ "def", "table2matrix", "(", "table", ")", ":", "if", "not", "is_simpletable", "(", "table", ")", ":", "raise", "NotSimpleTable", "(", "\"Not able read a cell in the table as a string\"", ")", "rows", "=", "[", "]", "for", "tr", "in", "table", "(", "'tr'", ")",...
convert a table to a list of lists - a 2D matrix
[ "convert", "a", "table", "to", "a", "list", "of", "lists", "-", "a", "2D", "matrix" ]
python
train
evolbioinfo/pastml
pastml/ml.py
https://github.com/evolbioinfo/pastml/blob/df8a375841525738383e59548eed3441b07dbd3e/pastml/ml.py#L458-L473
def check_marginal_likelihoods(tree, feature): """ Sanity check: combined bottom-up and top-down likelihood of each node of the tree must be the same. :param tree: ete3.Tree, the tree of interest :param feature: str, character for which the likelihood is calculated :return: void, stores the node ma...
[ "def", "check_marginal_likelihoods", "(", "tree", ",", "feature", ")", ":", "lh_feature", "=", "get_personalized_feature_name", "(", "feature", ",", "LH", ")", "lh_sf_feature", "=", "get_personalized_feature_name", "(", "feature", ",", "LH_SF", ")", "for", "node", ...
Sanity check: combined bottom-up and top-down likelihood of each node of the tree must be the same. :param tree: ete3.Tree, the tree of interest :param feature: str, character for which the likelihood is calculated :return: void, stores the node marginal likelihoods in the get_personalised_feature_name(fea...
[ "Sanity", "check", ":", "combined", "bottom", "-", "up", "and", "top", "-", "down", "likelihood", "of", "each", "node", "of", "the", "tree", "must", "be", "the", "same", "." ]
python
train
rwl/pylon
pyreto/continuous/experiment.py
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pyreto/continuous/experiment.py#L249-L258
def reset(self): """ Sets initial conditions for the experiment. """ self.stepid = 0 for task, agent in zip(self.tasks, self.agents): task.reset() agent.module.reset() agent.history.reset()
[ "def", "reset", "(", "self", ")", ":", "self", ".", "stepid", "=", "0", "for", "task", ",", "agent", "in", "zip", "(", "self", ".", "tasks", ",", "self", ".", "agents", ")", ":", "task", ".", "reset", "(", ")", "agent", ".", "module", ".", "res...
Sets initial conditions for the experiment.
[ "Sets", "initial", "conditions", "for", "the", "experiment", "." ]
python
train
Azure/azure-cli-extensions
src/storage-preview/azext_storage_preview/vendored_sdks/azure_storage/v2018_03_28/common/cloudstorageaccount.py
https://github.com/Azure/azure-cli-extensions/blob/3d4854205b0f0d882f688cfa12383d14506c2e35/src/storage-preview/azext_storage_preview/vendored_sdks/azure_storage/v2018_03_28/common/cloudstorageaccount.py#L51-L66
def create_block_blob_service(self): ''' Creates a BlockBlobService object with the settings specified in the CloudStorageAccount. :return: A service object. :rtype: :class:`~azure.storage.blob.blockblobservice.BlockBlobService` ''' try: from azure.s...
[ "def", "create_block_blob_service", "(", "self", ")", ":", "try", ":", "from", "azure", ".", "storage", ".", "blob", ".", "blockblobservice", "import", "BlockBlobService", "return", "BlockBlobService", "(", "self", ".", "account_name", ",", "self", ".", "account...
Creates a BlockBlobService object with the settings specified in the CloudStorageAccount. :return: A service object. :rtype: :class:`~azure.storage.blob.blockblobservice.BlockBlobService`
[ "Creates", "a", "BlockBlobService", "object", "with", "the", "settings", "specified", "in", "the", "CloudStorageAccount", "." ]
python
train
RJT1990/pyflux
pyflux/inference/bbvi.py
https://github.com/RJT1990/pyflux/blob/297f2afc2095acd97c12e827dd500e8ea5da0c0f/pyflux/inference/bbvi.py#L115-L120
def draw_normal(self): """ Draw parameters from a mean-field normal family """ means, scale = self.get_means_and_scales() return np.random.normal(means,scale,size=[self.sims,means.shape[0]]).T
[ "def", "draw_normal", "(", "self", ")", ":", "means", ",", "scale", "=", "self", ".", "get_means_and_scales", "(", ")", "return", "np", ".", "random", ".", "normal", "(", "means", ",", "scale", ",", "size", "=", "[", "self", ".", "sims", ",", "means"...
Draw parameters from a mean-field normal family
[ "Draw", "parameters", "from", "a", "mean", "-", "field", "normal", "family" ]
python
train
mozillazg/python-shanbay
shanbay/api.py
https://github.com/mozillazg/python-shanbay/blob/d505ba614dc13a36afce46969d13fc64e10dde0d/shanbay/api.py#L66-L74
def examples(self, word_id, type=None, url='https://api.shanbay.com/bdc/example/'): """获取单词的例句""" params = { 'vocabulary_id': word_id } if type is not None: params['type'] = type return self._request(url, params=params).json()
[ "def", "examples", "(", "self", ",", "word_id", ",", "type", "=", "None", ",", "url", "=", "'https://api.shanbay.com/bdc/example/'", ")", ":", "params", "=", "{", "'vocabulary_id'", ":", "word_id", "}", "if", "type", "is", "not", "None", ":", "params", "["...
获取单词的例句
[ "获取单词的例句" ]
python
train
Phyks/libbmc
libbmc/tools.py
https://github.com/Phyks/libbmc/blob/9ef1a29d2514157d1edd6c13ecbd61b07ae9315e/libbmc/tools.py#L16-L36
def replace_all(text, replace_dict): """ Replace multiple strings in a text. .. note:: Replacements are made successively, without any warranty on the order \ in which they are made. :param text: Text to replace in. :param replace_dict: Dictionary mapping strings to replace with ...
[ "def", "replace_all", "(", "text", ",", "replace_dict", ")", ":", "for", "i", ",", "j", "in", "replace_dict", ".", "items", "(", ")", ":", "text", "=", "text", ".", "replace", "(", "i", ",", "j", ")", "return", "text" ]
Replace multiple strings in a text. .. note:: Replacements are made successively, without any warranty on the order \ in which they are made. :param text: Text to replace in. :param replace_dict: Dictionary mapping strings to replace with their \ substitution. :returns: T...
[ "Replace", "multiple", "strings", "in", "a", "text", "." ]
python
train
python-cmd2/cmd2
cmd2/cmd2.py
https://github.com/python-cmd2/cmd2/blob/b22c0bd891ed08c8b09df56df9d91f48166a5e2a/cmd2/cmd2.py#L3796-L3827
def disable_command(self, command: str, message_to_print: str) -> None: """ Disable a command and overwrite its functions :param command: the command being disabled :param message_to_print: what to print when this command is run or help is called on it while disabled ...
[ "def", "disable_command", "(", "self", ",", "command", ":", "str", ",", "message_to_print", ":", "str", ")", "->", "None", ":", "import", "functools", "# If the commands is already disabled, then return", "if", "command", "in", "self", ".", "disabled_commands", ":",...
Disable a command and overwrite its functions :param command: the command being disabled :param message_to_print: what to print when this command is run or help is called on it while disabled The variable COMMAND_NAME can be used as a placeholder for the name of the ...
[ "Disable", "a", "command", "and", "overwrite", "its", "functions", ":", "param", "command", ":", "the", "command", "being", "disabled", ":", "param", "message_to_print", ":", "what", "to", "print", "when", "this", "command", "is", "run", "or", "help", "is", ...
python
train
tensorflow/tensor2tensor
tensor2tensor/layers/common_layers.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L206-L210
def shakeshake2_equal_grad(x1, x2, dy): """Overriding gradient for shake-shake of 2 tensors.""" y = shakeshake2_py(x1, x2, equal=True) dx = tf.gradients(ys=[y], xs=[x1, x2], grad_ys=[dy]) return dx
[ "def", "shakeshake2_equal_grad", "(", "x1", ",", "x2", ",", "dy", ")", ":", "y", "=", "shakeshake2_py", "(", "x1", ",", "x2", ",", "equal", "=", "True", ")", "dx", "=", "tf", ".", "gradients", "(", "ys", "=", "[", "y", "]", ",", "xs", "=", "[",...
Overriding gradient for shake-shake of 2 tensors.
[ "Overriding", "gradient", "for", "shake", "-", "shake", "of", "2", "tensors", "." ]
python
train
relwell/corenlp-xml-lib
corenlp_xml/document.py
https://github.com/relwell/corenlp-xml-lib/blob/9b0f8c912ba3ecedd34473f74a9f2d033a75baf9/corenlp_xml/document.py#L386-L398
def character_offset_begin(self): """ Lazy-loads character offset begin node :getter: Returns the integer value of the beginning offset :type: int """ if self._character_offset_begin is None: offsets = self._element.xpath('CharacterOffsetBegin/text()') ...
[ "def", "character_offset_begin", "(", "self", ")", ":", "if", "self", ".", "_character_offset_begin", "is", "None", ":", "offsets", "=", "self", ".", "_element", ".", "xpath", "(", "'CharacterOffsetBegin/text()'", ")", "if", "len", "(", "offsets", ")", ">", ...
Lazy-loads character offset begin node :getter: Returns the integer value of the beginning offset :type: int
[ "Lazy", "-", "loads", "character", "offset", "begin", "node" ]
python
train
jbarlow83/OCRmyPDF
src/ocrmypdf/leptonica.py
https://github.com/jbarlow83/OCRmyPDF/blob/79c84eefa353632a3d7ccddbd398c6678c1c1777/src/ocrmypdf/leptonica.py#L402-L412
def remove_colormap(self, removal_type): """Remove a palette (colormap); if no colormap, returns a copy of this image removal_type - any of lept.REMOVE_CMAP_* """ with _LeptonicaErrorTrap(): return Pix( lept.pixRemoveColormapGeneral(self._cdata, ...
[ "def", "remove_colormap", "(", "self", ",", "removal_type", ")", ":", "with", "_LeptonicaErrorTrap", "(", ")", ":", "return", "Pix", "(", "lept", ".", "pixRemoveColormapGeneral", "(", "self", ".", "_cdata", ",", "removal_type", ",", "lept", ".", "L_COPY", ")...
Remove a palette (colormap); if no colormap, returns a copy of this image removal_type - any of lept.REMOVE_CMAP_*
[ "Remove", "a", "palette", "(", "colormap", ")", ";", "if", "no", "colormap", "returns", "a", "copy", "of", "this", "image" ]
python
train
saimn/sigal
sigal/video.py
https://github.com/saimn/sigal/blob/912ca39991355d358dc85fd55c7aeabdd7acc386/sigal/video.py#L38-L59
def check_subprocess(cmd, source, outname): """Run the command to resize the video and remove the output file if the processing fails. """ logger = logging.getLogger(__name__) try: res = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) exc...
[ "def", "check_subprocess", "(", "cmd", ",", "source", ",", "outname", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", "__name__", ")", "try", ":", "res", "=", "subprocess", ".", "run", "(", "cmd", ",", "stdout", "=", "subprocess", ".", "PIPE...
Run the command to resize the video and remove the output file if the processing fails.
[ "Run", "the", "command", "to", "resize", "the", "video", "and", "remove", "the", "output", "file", "if", "the", "processing", "fails", "." ]
python
valid
tensorflow/tensorboard
tensorboard/plugins/pr_curve/pr_curves_plugin.py
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/pr_curve/pr_curves_plugin.py#L314-L341
def is_active(self): """Determines whether this plugin is active. This plugin is active only if PR curve summary data is read by TensorBoard. Returns: Whether this plugin is active. """ if self._db_connection_provider: # The plugin is active if one relevant tag can be found in the data...
[ "def", "is_active", "(", "self", ")", ":", "if", "self", ".", "_db_connection_provider", ":", "# The plugin is active if one relevant tag can be found in the database.", "db", "=", "self", ".", "_db_connection_provider", "(", ")", "cursor", "=", "db", ".", "execute", ...
Determines whether this plugin is active. This plugin is active only if PR curve summary data is read by TensorBoard. Returns: Whether this plugin is active.
[ "Determines", "whether", "this", "plugin", "is", "active", "." ]
python
train
pycontribs/pyrax
pyrax/object_storage.py
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/object_storage.py#L1649-L1656
def move(self, new_container, new_obj_name=None, extra_info=None): """ Works just like copy_object, except that this object is deleted after a successful copy. This means that this storage_object reference will no longer be valid. """ return self.container.move_object(sel...
[ "def", "move", "(", "self", ",", "new_container", ",", "new_obj_name", "=", "None", ",", "extra_info", "=", "None", ")", ":", "return", "self", ".", "container", ".", "move_object", "(", "self", ",", "new_container", ",", "new_obj_name", "=", "new_obj_name",...
Works just like copy_object, except that this object is deleted after a successful copy. This means that this storage_object reference will no longer be valid.
[ "Works", "just", "like", "copy_object", "except", "that", "this", "object", "is", "deleted", "after", "a", "successful", "copy", ".", "This", "means", "that", "this", "storage_object", "reference", "will", "no", "longer", "be", "valid", "." ]
python
train
SBRG/ssbio
ssbio/protein/sequence/properties/kinetic_folding_rate.py
https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/properties/kinetic_folding_rate.py#L23-L52
def get_foldrate(seq, secstruct): """Submit sequence and structural class to FOLD-RATE calculator (http://www.iitm.ac.in/bioinfo/fold-rate/) to calculate kinetic folding rate. Args: seq (str, Seq, SeqRecord): Amino acid sequence secstruct (str): Structural class: `all-alpha``, ``all-beta``,...
[ "def", "get_foldrate", "(", "seq", ",", "secstruct", ")", ":", "seq", "=", "ssbio", ".", "protein", ".", "sequence", ".", "utils", ".", "cast_to_str", "(", "seq", ")", "url", "=", "'http://www.iitm.ac.in/bioinfo/cgi-bin/fold-rate/foldrateCalculator.pl'", "values", ...
Submit sequence and structural class to FOLD-RATE calculator (http://www.iitm.ac.in/bioinfo/fold-rate/) to calculate kinetic folding rate. Args: seq (str, Seq, SeqRecord): Amino acid sequence secstruct (str): Structural class: `all-alpha``, ``all-beta``, ``mixed``, or ``unknown`` Returns: ...
[ "Submit", "sequence", "and", "structural", "class", "to", "FOLD", "-", "RATE", "calculator", "(", "http", ":", "//", "www", ".", "iitm", ".", "ac", ".", "in", "/", "bioinfo", "/", "fold", "-", "rate", "/", ")", "to", "calculate", "kinetic", "folding", ...
python
train
gwastro/pycbc-glue
pycbc_glue/ligolw/ligolw.py
https://github.com/gwastro/pycbc-glue/blob/a3e906bae59fbfd707c3ff82e5d008d939ec5e24/pycbc_glue/ligolw/ligolw.py#L290-L297
def appendData(self, content): """ Add characters to the element's pcdata. """ if self.pcdata is not None: self.pcdata += content else: self.pcdata = content
[ "def", "appendData", "(", "self", ",", "content", ")", ":", "if", "self", ".", "pcdata", "is", "not", "None", ":", "self", ".", "pcdata", "+=", "content", "else", ":", "self", ".", "pcdata", "=", "content" ]
Add characters to the element's pcdata.
[ "Add", "characters", "to", "the", "element", "s", "pcdata", "." ]
python
train
nugget/python-insteonplm
insteonplm/plm.py
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/plm.py#L188-L203
def start_all_linking(self, mode, group): """Put the IM into All-Linking mode. Puts the IM into All-Linking mode for 4 minutes. Parameters: mode: 0 | 1 | 3 | 255 0 - PLM is responder 1 - PLM is controller 3 - Device that initiat...
[ "def", "start_all_linking", "(", "self", ",", "mode", ",", "group", ")", ":", "msg", "=", "StartAllLinking", "(", "mode", ",", "group", ")", "self", ".", "send_msg", "(", "msg", ")" ]
Put the IM into All-Linking mode. Puts the IM into All-Linking mode for 4 minutes. Parameters: mode: 0 | 1 | 3 | 255 0 - PLM is responder 1 - PLM is controller 3 - Device that initiated All-Linking is Controller 255 = De...
[ "Put", "the", "IM", "into", "All", "-", "Linking", "mode", "." ]
python
train
secynic/ipwhois
ipwhois/experimental.py
https://github.com/secynic/ipwhois/blob/b5d634d36b0b942d538d38d77b3bdcd815f155a0/ipwhois/experimental.py#L113-L457
def bulk_lookup_rdap(addresses=None, inc_raw=False, retry_count=3, depth=0, excluded_entities=None, rate_limit_timeout=60, socket_timeout=10, asn_timeout=240, proxy_openers=None): """ The function for bulk retrieving and parsing whois information for a list of IP ad...
[ "def", "bulk_lookup_rdap", "(", "addresses", "=", "None", ",", "inc_raw", "=", "False", ",", "retry_count", "=", "3", ",", "depth", "=", "0", ",", "excluded_entities", "=", "None", ",", "rate_limit_timeout", "=", "60", ",", "socket_timeout", "=", "10", ","...
The function for bulk retrieving and parsing whois information for a list of IP addresses via HTTP (RDAP). This bulk lookup method uses bulk ASN Whois lookups first to retrieve the ASN for each IP. It then optimizes RDAP queries to achieve the fastest overall time, accounting for rate-limiting RIRs. ...
[ "The", "function", "for", "bulk", "retrieving", "and", "parsing", "whois", "information", "for", "a", "list", "of", "IP", "addresses", "via", "HTTP", "(", "RDAP", ")", ".", "This", "bulk", "lookup", "method", "uses", "bulk", "ASN", "Whois", "lookups", "fir...
python
train
cytoscape/py2cytoscape
py2cytoscape/cyrest/network.py
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/network.py#L600-L617
def load_url(self, url=None, verbose=False): """ Load a new network from a URL that points to a network file type (e.g. SIF, XGMML, etc.). Use network import url to load networks from Excel or csv files. This command will create a new network collection if no current network coll...
[ "def", "load_url", "(", "self", ",", "url", "=", "None", ",", "verbose", "=", "False", ")", ":", "PARAMS", "=", "set_param", "(", "[", "\"url\"", "]", ",", "[", "url", "]", ")", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", ...
Load a new network from a URL that points to a network file type (e.g. SIF, XGMML, etc.). Use network import url to load networks from Excel or csv files. This command will create a new network collection if no current network collection is selected, otherwise it will add the network to the ...
[ "Load", "a", "new", "network", "from", "a", "URL", "that", "points", "to", "a", "network", "file", "type", "(", "e", ".", "g", ".", "SIF", "XGMML", "etc", ".", ")", ".", "Use", "network", "import", "url", "to", "load", "networks", "from", "Excel", ...
python
train
shmir/PyIxExplorer
ixexplorer/ixe_app.py
https://github.com/shmir/PyIxExplorer/blob/d6946b9ce0e8961507cc912062e10c365d4beee2/ixexplorer/ixe_app.py#L197-L204
def wait_transmit(self, *ports): """ Wait for traffic end on ports. :param ports: list of ports to wait for, if empty wait for all ports. """ port_list = self.set_ports_list(*ports) self.api.call_rc('ixCheckTransmitDone {}'.format(port_list))
[ "def", "wait_transmit", "(", "self", ",", "*", "ports", ")", ":", "port_list", "=", "self", ".", "set_ports_list", "(", "*", "ports", ")", "self", ".", "api", ".", "call_rc", "(", "'ixCheckTransmitDone {}'", ".", "format", "(", "port_list", ")", ")" ]
Wait for traffic end on ports. :param ports: list of ports to wait for, if empty wait for all ports.
[ "Wait", "for", "traffic", "end", "on", "ports", "." ]
python
train
inveniosoftware/invenio-oauth2server
invenio_oauth2server/models.py
https://github.com/inveniosoftware/invenio-oauth2server/blob/7033d3495c1a2b830e101e43918e92a37bbb49f2/invenio_oauth2server/models.py#L278-L285
def get_users(self): """Get number of users.""" no_users = Token.query.filter_by( client_id=self.client_id, is_personal=False, is_internal=False ).count() return no_users
[ "def", "get_users", "(", "self", ")", ":", "no_users", "=", "Token", ".", "query", ".", "filter_by", "(", "client_id", "=", "self", ".", "client_id", ",", "is_personal", "=", "False", ",", "is_internal", "=", "False", ")", ".", "count", "(", ")", "retu...
Get number of users.
[ "Get", "number", "of", "users", "." ]
python
train
openpermissions/koi
koi/commands.py
https://github.com/openpermissions/koi/blob/d721f8e1dfa8f07ad265d9dec32e8aaf80a9f281/koi/commands.py#L331-L336
def cli(main, conf_dir=None, commands_dir=None): """Convenience function for initialising a Command CLI For parameter definitions see :class:`.Command` """ return Command(main, conf_dir=conf_dir, commands_dir=commands_dir)()
[ "def", "cli", "(", "main", ",", "conf_dir", "=", "None", ",", "commands_dir", "=", "None", ")", ":", "return", "Command", "(", "main", ",", "conf_dir", "=", "conf_dir", ",", "commands_dir", "=", "commands_dir", ")", "(", ")" ]
Convenience function for initialising a Command CLI For parameter definitions see :class:`.Command`
[ "Convenience", "function", "for", "initialising", "a", "Command", "CLI" ]
python
train
angr/angr
angr/procedures/stubs/format_parser.py
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/stubs/format_parser.py#L517-L525
def _sim_atoi_inner(self, str_addr, region, base=10, read_length=None): """ Return the result of invoking the atoi simprocedure on `str_addr`. """ from .. import SIM_PROCEDURES strtol = SIM_PROCEDURES['libc']['strtol'] return strtol.strtol_inner(str_addr, self.state, re...
[ "def", "_sim_atoi_inner", "(", "self", ",", "str_addr", ",", "region", ",", "base", "=", "10", ",", "read_length", "=", "None", ")", ":", "from", ".", ".", "import", "SIM_PROCEDURES", "strtol", "=", "SIM_PROCEDURES", "[", "'libc'", "]", "[", "'strtol'", ...
Return the result of invoking the atoi simprocedure on `str_addr`.
[ "Return", "the", "result", "of", "invoking", "the", "atoi", "simprocedure", "on", "str_addr", "." ]
python
train
isambard-uob/ampal
src/ampal/base_ampal.py
https://github.com/isambard-uob/ampal/blob/906e2afacb435ffb129b381f262ff8e7bfb324c5/src/ampal/base_ampal.py#L605-L626
def close_monomers(self, group, cutoff=4.0): """Returns a list of Monomers from within a cut off distance of the Monomer Parameters ---------- group: BaseAmpal or Subclass Group to be search for Monomers that are close to this Monomer. cutoff: float Dista...
[ "def", "close_monomers", "(", "self", ",", "group", ",", "cutoff", "=", "4.0", ")", ":", "nearby_residues", "=", "[", "]", "for", "self_atom", "in", "self", ".", "atoms", ".", "values", "(", ")", ":", "nearby_atoms", "=", "group", ".", "is_within", "("...
Returns a list of Monomers from within a cut off distance of the Monomer Parameters ---------- group: BaseAmpal or Subclass Group to be search for Monomers that are close to this Monomer. cutoff: float Distance cut off. Returns ------- ne...
[ "Returns", "a", "list", "of", "Monomers", "from", "within", "a", "cut", "off", "distance", "of", "the", "Monomer" ]
python
train
psd-tools/psd-tools
src/psd_tools/utils.py
https://github.com/psd-tools/psd-tools/blob/4952b57bcf1cf2c1f16fd9d6d51d4fa0b53bce4e/src/psd_tools/utils.py#L28-L38
def read_fmt(fmt, fp): """ Reads data from ``fp`` according to ``fmt``. """ fmt = str(">" + fmt) fmt_size = struct.calcsize(fmt) data = fp.read(fmt_size) assert len(data) == fmt_size, 'read=%d, expected=%d' % ( len(data), fmt_size ) return struct.unpack(fmt, data)
[ "def", "read_fmt", "(", "fmt", ",", "fp", ")", ":", "fmt", "=", "str", "(", "\">\"", "+", "fmt", ")", "fmt_size", "=", "struct", ".", "calcsize", "(", "fmt", ")", "data", "=", "fp", ".", "read", "(", "fmt_size", ")", "assert", "len", "(", "data",...
Reads data from ``fp`` according to ``fmt``.
[ "Reads", "data", "from", "fp", "according", "to", "fmt", "." ]
python
train
fastai/fastai
fastai/vision/data.py
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/vision/data.py#L71-L75
def normalize_funcs(mean:FloatTensor, std:FloatTensor, do_x:bool=True, do_y:bool=False)->Tuple[Callable,Callable]: "Create normalize/denormalize func using `mean` and `std`, can specify `do_y` and `device`." mean,std = tensor(mean),tensor(std) return (partial(_normalize_batch, mean=mean, std=std, do_x=do_x,...
[ "def", "normalize_funcs", "(", "mean", ":", "FloatTensor", ",", "std", ":", "FloatTensor", ",", "do_x", ":", "bool", "=", "True", ",", "do_y", ":", "bool", "=", "False", ")", "->", "Tuple", "[", "Callable", ",", "Callable", "]", ":", "mean", ",", "st...
Create normalize/denormalize func using `mean` and `std`, can specify `do_y` and `device`.
[ "Create", "normalize", "/", "denormalize", "func", "using", "mean", "and", "std", "can", "specify", "do_y", "and", "device", "." ]
python
train
kislyuk/aegea
aegea/packages/github3/issues/issue.py
https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/issues/issue.py#L116-L128
def assign(self, login): """Assigns user ``login`` to this issue. This is a short cut for ``issue.edit``. :param str login: username of the person to assign this issue to :returns: bool """ if not login: return False number = self.milestone.number if ...
[ "def", "assign", "(", "self", ",", "login", ")", ":", "if", "not", "login", ":", "return", "False", "number", "=", "self", ".", "milestone", ".", "number", "if", "self", ".", "milestone", "else", "None", "labels", "=", "[", "str", "(", "l", ")", "f...
Assigns user ``login`` to this issue. This is a short cut for ``issue.edit``. :param str login: username of the person to assign this issue to :returns: bool
[ "Assigns", "user", "login", "to", "this", "issue", ".", "This", "is", "a", "short", "cut", "for", "issue", ".", "edit", "." ]
python
train
celiao/tmdbsimple
tmdbsimple/movies.py
https://github.com/celiao/tmdbsimple/blob/ff17893110c99771d6398a62c35d36dd9735f4b9/tmdbsimple/movies.py#L253-L269
def reviews(self, **kwargs): """ Get the reviews for a particular movie id. Args: page: (optional) Minimum value of 1. Expected value is an integer. language: (optional) ISO 639-1 code. append_to_response: (optional) Comma separated, any movie method. ...
[ "def", "reviews", "(", "self", ",", "*", "*", "kwargs", ")", ":", "path", "=", "self", ".", "_get_id_path", "(", "'reviews'", ")", "response", "=", "self", ".", "_GET", "(", "path", ",", "kwargs", ")", "self", ".", "_set_attrs_to_values", "(", "respons...
Get the reviews for a particular movie id. Args: page: (optional) Minimum value of 1. Expected value is an integer. language: (optional) ISO 639-1 code. append_to_response: (optional) Comma separated, any movie method. Returns: A dict representation of ...
[ "Get", "the", "reviews", "for", "a", "particular", "movie", "id", "." ]
python
test
spyder-ide/spyder
spyder/widgets/calltip.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/calltip.py#L200-L206
def hideEvent(self, event): """ Reimplemented to disconnect signal handlers and event filter. """ super(CallTipWidget, self).hideEvent(event) self._text_edit.cursorPositionChanged.disconnect( self._cursor_position_changed) self._text_edit.removeEventFilter(self)
[ "def", "hideEvent", "(", "self", ",", "event", ")", ":", "super", "(", "CallTipWidget", ",", "self", ")", ".", "hideEvent", "(", "event", ")", "self", ".", "_text_edit", ".", "cursorPositionChanged", ".", "disconnect", "(", "self", ".", "_cursor_position_cha...
Reimplemented to disconnect signal handlers and event filter.
[ "Reimplemented", "to", "disconnect", "signal", "handlers", "and", "event", "filter", "." ]
python
train
tensorforce/tensorforce
tensorforce/core/optimizers/tf_optimizer.py
https://github.com/tensorforce/tensorforce/blob/520a8d992230e382f08e315ede5fc477f5e26bfb/tensorforce/core/optimizers/tf_optimizer.py#L53-L77
def tf_step(self, time, variables, **kwargs): """ Keyword Args: arguments: Dict of arguments for passing to fn_loss as **kwargs. fn_loss: A callable taking arguments as kwargs and returning the loss op of the current model. """ arguments = kwargs["arguments"] ...
[ "def", "tf_step", "(", "self", ",", "time", ",", "variables", ",", "*", "*", "kwargs", ")", ":", "arguments", "=", "kwargs", "[", "\"arguments\"", "]", "fn_loss", "=", "kwargs", "[", "\"fn_loss\"", "]", "loss", "=", "fn_loss", "(", "*", "*", "arguments...
Keyword Args: arguments: Dict of arguments for passing to fn_loss as **kwargs. fn_loss: A callable taking arguments as kwargs and returning the loss op of the current model.
[ "Keyword", "Args", ":", "arguments", ":", "Dict", "of", "arguments", "for", "passing", "to", "fn_loss", "as", "**", "kwargs", ".", "fn_loss", ":", "A", "callable", "taking", "arguments", "as", "kwargs", "and", "returning", "the", "loss", "op", "of", "the",...
python
valid
softlayer/softlayer-python
SoftLayer/CLI/dns/zone_list.py
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/dns/zone_list.py#L13-L30
def cli(env): """List all zones.""" manager = SoftLayer.DNSManager(env.client) zones = manager.list_zones() table = formatting.Table(['id', 'zone', 'serial', 'updated']) table.align['serial'] = 'c' table.align['updated'] = 'c' for zone in zones: table.add_row([ zone['id...
[ "def", "cli", "(", "env", ")", ":", "manager", "=", "SoftLayer", ".", "DNSManager", "(", "env", ".", "client", ")", "zones", "=", "manager", ".", "list_zones", "(", ")", "table", "=", "formatting", ".", "Table", "(", "[", "'id'", ",", "'zone'", ",", ...
List all zones.
[ "List", "all", "zones", "." ]
python
train
apple/turicreate
src/unity/python/turicreate/toolkits/activity_classifier/_activity_classifier.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/activity_classifier/_activity_classifier.py#L745-L795
def classify(self, dataset, output_frequency='per_row'): """ Return a classification, for each ``prediction_window`` examples in the ``dataset``, using the trained activity classification model. The output SFrame contains predictions as both class labels as well as probabilities ...
[ "def", "classify", "(", "self", ",", "dataset", ",", "output_frequency", "=", "'per_row'", ")", ":", "_tkutl", ".", "_check_categorical_option_type", "(", "'output_frequency'", ",", "output_frequency", ",", "[", "'per_window'", ",", "'per_row'", "]", ")", "id_targ...
Return a classification, for each ``prediction_window`` examples in the ``dataset``, using the trained activity classification model. The output SFrame contains predictions as both class labels as well as probabilities that the predicted value is the associated label. Parameters ...
[ "Return", "a", "classification", "for", "each", "prediction_window", "examples", "in", "the", "dataset", "using", "the", "trained", "activity", "classification", "model", ".", "The", "output", "SFrame", "contains", "predictions", "as", "both", "class", "labels", "...
python
train
apache/airflow
airflow/contrib/hooks/gcs_hook.py
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcs_hook.py#L208-L221
def exists(self, bucket_name, object_name): """ Checks for the existence of a file in Google Cloud Storage. :param bucket_name: The Google cloud storage bucket where the object is. :type bucket_name: str :param object_name: The name of the blob_name to check in the Google cloud ...
[ "def", "exists", "(", "self", ",", "bucket_name", ",", "object_name", ")", ":", "client", "=", "self", ".", "get_conn", "(", ")", "bucket", "=", "client", ".", "get_bucket", "(", "bucket_name", "=", "bucket_name", ")", "blob", "=", "bucket", ".", "blob",...
Checks for the existence of a file in Google Cloud Storage. :param bucket_name: The Google cloud storage bucket where the object is. :type bucket_name: str :param object_name: The name of the blob_name to check in the Google cloud storage bucket. :type object_name: str
[ "Checks", "for", "the", "existence", "of", "a", "file", "in", "Google", "Cloud", "Storage", "." ]
python
test
klmitch/policies
policies/instructions.py
https://github.com/klmitch/policies/blob/edf26c5707a5a0cc8e9f59a209a64dee7f79b7a4/policies/instructions.py#L961-L982
def fold(self, elems): """ Perform constant folding. If the result of applying the operator to the elements would be a fixed constant value, returns the result of applying the operator to the operands. Otherwise, returns an instance of ``Instructions`` containing the ins...
[ "def", "fold", "(", "self", ",", "elems", ")", ":", "cond", ",", "if_true", ",", "if_false", "=", "elems", "if", "isinstance", "(", "cond", ",", "Constant", ")", ":", "return", "[", "if_true", "if", "cond", ".", "value", "else", "if_false", "]", "ret...
Perform constant folding. If the result of applying the operator to the elements would be a fixed constant value, returns the result of applying the operator to the operands. Otherwise, returns an instance of ``Instructions`` containing the instructions necessary to apply the operator. ...
[ "Perform", "constant", "folding", ".", "If", "the", "result", "of", "applying", "the", "operator", "to", "the", "elements", "would", "be", "a", "fixed", "constant", "value", "returns", "the", "result", "of", "applying", "the", "operator", "to", "the", "opera...
python
train
etscrivner/nose-perfdump
perfdump/connection.py
https://github.com/etscrivner/nose-perfdump/blob/a203a68495d30346fab43fb903cb60cd29b17d49/perfdump/connection.py#L38-L72
def connect(cls, dbname): """Create a new connection to the SQLite3 database. :param dbname: The database name :type dbname: str """ test_times_schema = """ CREATE TABLE IF NOT EXISTS test_times ( file text, module text, class text,...
[ "def", "connect", "(", "cls", ",", "dbname", ")", ":", "test_times_schema", "=", "\"\"\"\n CREATE TABLE IF NOT EXISTS test_times (\n file text,\n module text,\n class text,\n func text,\n elapsed float\n )\n \"\"\"", "setup_time...
Create a new connection to the SQLite3 database. :param dbname: The database name :type dbname: str
[ "Create", "a", "new", "connection", "to", "the", "SQLite3", "database", "." ]
python
train
pydata/numexpr
numexpr/necompiler.py
https://github.com/pydata/numexpr/blob/364bac13d84524e0e01db892301b2959d822dcff/numexpr/necompiler.py#L765-L834
def evaluate(ex, local_dict=None, global_dict=None, out=None, order='K', casting='safe', **kwargs): """Evaluate a simple array expression element-wise, using the new iterator. ex is a string forming an expression, like "2*a+3*b". The values for "a" and "b" will by default be taken from the cal...
[ "def", "evaluate", "(", "ex", ",", "local_dict", "=", "None", ",", "global_dict", "=", "None", ",", "out", "=", "None", ",", "order", "=", "'K'", ",", "casting", "=", "'safe'", ",", "*", "*", "kwargs", ")", ":", "global", "_numexpr_last", "if", "not"...
Evaluate a simple array expression element-wise, using the new iterator. ex is a string forming an expression, like "2*a+3*b". The values for "a" and "b" will by default be taken from the calling function's frame (through use of sys._getframe()). Alternatively, they can be specifed using the 'local_dic...
[ "Evaluate", "a", "simple", "array", "expression", "element", "-", "wise", "using", "the", "new", "iterator", "." ]
python
train
jmcgeheeiv/pyfakefs
pyfakefs/fake_filesystem.py
https://github.com/jmcgeheeiv/pyfakefs/blob/6c36fb8987108107fc861fc3013620d46c7d2f9c/pyfakefs/fake_filesystem.py#L3181-L3192
def isabs(self, path): """Return True if path is an absolute pathname.""" if self.filesystem.is_windows_fs: path = self.splitdrive(path)[1] path = make_string_path(path) sep = self.filesystem._path_separator(path) altsep = self.filesystem._alternative_path_separator(p...
[ "def", "isabs", "(", "self", ",", "path", ")", ":", "if", "self", ".", "filesystem", ".", "is_windows_fs", ":", "path", "=", "self", ".", "splitdrive", "(", "path", ")", "[", "1", "]", "path", "=", "make_string_path", "(", "path", ")", "sep", "=", ...
Return True if path is an absolute pathname.
[ "Return", "True", "if", "path", "is", "an", "absolute", "pathname", "." ]
python
train
mthh/smoomapy
smoomapy/core.py
https://github.com/mthh/smoomapy/blob/a603a62e76592e84509591fddcde8bfb1e826b84/smoomapy/core.py#L184-L219
def make_regular_points_with_no_res(bounds, nb_points=10000): """ Return a regular grid of points within `bounds` with the specified number of points (or a close approximate value). Parameters ---------- bounds : 4-floats tuple The bbox of the grid, as xmin, ymin, xmax, ymax. nb_poi...
[ "def", "make_regular_points_with_no_res", "(", "bounds", ",", "nb_points", "=", "10000", ")", ":", "minlon", ",", "minlat", ",", "maxlon", ",", "maxlat", "=", "bounds", "minlon", ",", "minlat", ",", "maxlon", ",", "maxlat", "=", "bounds", "offset_lon", "=", ...
Return a regular grid of points within `bounds` with the specified number of points (or a close approximate value). Parameters ---------- bounds : 4-floats tuple The bbox of the grid, as xmin, ymin, xmax, ymax. nb_points : int, optionnal The desired number of points (default: 10000)...
[ "Return", "a", "regular", "grid", "of", "points", "within", "bounds", "with", "the", "specified", "number", "of", "points", "(", "or", "a", "close", "approximate", "value", ")", "." ]
python
train
crossbario/txaio-etcd
txaioetcd/_client_pg.py
https://github.com/crossbario/txaio-etcd/blob/c9aebff7f288a0b219bffc9d2579d22cf543baa5/txaioetcd/_client_pg.py#L173-L261
def get(self, key, range_end=None, count_only=None, keys_only=None, limit=None, max_create_revision=None, min_create_revision=None, min_mod_revision=None, revision=None, serializable=None, ...
[ "def", "get", "(", "self", ",", "key", ",", "range_end", "=", "None", ",", "count_only", "=", "None", ",", "keys_only", "=", "None", ",", "limit", "=", "None", ",", "max_create_revision", "=", "None", ",", "min_create_revision", "=", "None", ",", "min_mo...
Range gets the keys in the range from the key-value store. :param key: key is the first key for the range. If range_end is not given, the request only looks up key. :type key: bytes :param range_end: range_end is the upper bound on the requested range [key, range_end). ...
[ "Range", "gets", "the", "keys", "in", "the", "range", "from", "the", "key", "-", "value", "store", "." ]
python
train
fastai/fastai
fastai/vision/transform.py
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/vision/transform.py#L235-L246
def _find_coeffs(orig_pts:Points, targ_pts:Points)->Tensor: "Find 8 coeff mentioned [here](https://web.archive.org/web/20150222120106/xenia.media.mit.edu/~cwren/interpolator/)." matrix = [] #The equations we'll need to solve. for p1, p2 in zip(targ_pts, orig_pts): matrix.append([p1[0], p1[1], 1,...
[ "def", "_find_coeffs", "(", "orig_pts", ":", "Points", ",", "targ_pts", ":", "Points", ")", "->", "Tensor", ":", "matrix", "=", "[", "]", "#The equations we'll need to solve.", "for", "p1", ",", "p2", "in", "zip", "(", "targ_pts", ",", "orig_pts", ")", ":"...
Find 8 coeff mentioned [here](https://web.archive.org/web/20150222120106/xenia.media.mit.edu/~cwren/interpolator/).
[ "Find", "8", "coeff", "mentioned", "[", "here", "]", "(", "https", ":", "//", "web", ".", "archive", ".", "org", "/", "web", "/", "20150222120106", "/", "xenia", ".", "media", ".", "mit", ".", "edu", "/", "~cwren", "/", "interpolator", "/", ")", "....
python
train
n8henrie/urlmon
urlmon/urlmon.py
https://github.com/n8henrie/urlmon/blob/ebd58358843d7414f708c818a5c5a96feadd176f/urlmon/urlmon.py#L54-L93
def push(self, message, device=None, title=None, url=None, url_title=None, priority=None, timestamp=None, sound=None): """Pushes the notification, returns the Requests response. Arguments: message -- your message Keyword arguments: device -- your user's dev...
[ "def", "push", "(", "self", ",", "message", ",", "device", "=", "None", ",", "title", "=", "None", ",", "url", "=", "None", ",", "url_title", "=", "None", ",", "priority", "=", "None", ",", "timestamp", "=", "None", ",", "sound", "=", "None", ")", ...
Pushes the notification, returns the Requests response. Arguments: message -- your message Keyword arguments: device -- your user's device name to send the message directly to that device, rather than all of the user's devices title -- your message's...
[ "Pushes", "the", "notification", "returns", "the", "Requests", "response", "." ]
python
train
astropy/photutils
photutils/segmentation/properties.py
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L674-L683
def min_value(self): """ The minimum pixel value of the ``data`` within the source segment. """ if self._is_completely_masked: return np.nan * self._data_unit else: return np.min(self.values)
[ "def", "min_value", "(", "self", ")", ":", "if", "self", ".", "_is_completely_masked", ":", "return", "np", ".", "nan", "*", "self", ".", "_data_unit", "else", ":", "return", "np", ".", "min", "(", "self", ".", "values", ")" ]
The minimum pixel value of the ``data`` within the source segment.
[ "The", "minimum", "pixel", "value", "of", "the", "data", "within", "the", "source", "segment", "." ]
python
train
docker/docker-py
docker/api/secret.py
https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/api/secret.py#L51-L65
def inspect_secret(self, id): """ Retrieve secret metadata Args: id (string): Full ID of the secret to remove Returns (dict): A dictionary of metadata Raises: :py:class:`docker.errors.NotFound` if no secret wi...
[ "def", "inspect_secret", "(", "self", ",", "id", ")", ":", "url", "=", "self", ".", "_url", "(", "'/secrets/{0}'", ",", "id", ")", "return", "self", ".", "_result", "(", "self", ".", "_get", "(", "url", ")", ",", "True", ")" ]
Retrieve secret metadata Args: id (string): Full ID of the secret to remove Returns (dict): A dictionary of metadata Raises: :py:class:`docker.errors.NotFound` if no secret with that ID exists
[ "Retrieve", "secret", "metadata" ]
python
train
rbaier/python-urltools
urltools/urltools.py
https://github.com/rbaier/python-urltools/blob/76bf599aeb4cb463df8e38367aa40a7d8ec7d9a1/urltools/urltools.py#L150-L175
def construct(parts): """Construct a new URL from parts.""" url = '' if parts.scheme: if parts.scheme in SCHEMES: url += parts.scheme + '://' else: url += parts.scheme + ':' if parts.username and parts.password: url += parts.username + ':' + parts.password...
[ "def", "construct", "(", "parts", ")", ":", "url", "=", "''", "if", "parts", ".", "scheme", ":", "if", "parts", ".", "scheme", "in", "SCHEMES", ":", "url", "+=", "parts", ".", "scheme", "+", "'://'", "else", ":", "url", "+=", "parts", ".", "scheme"...
Construct a new URL from parts.
[ "Construct", "a", "new", "URL", "from", "parts", "." ]
python
train
pvizeli/ha-alpr
haalpr.py
https://github.com/pvizeli/ha-alpr/blob/93777c20f3caba3ee832c45ec022b08a2ee7efd6/haalpr.py#L29-L75
def recognize_byte(self, image, timeout=10): """Process a byte image buffer.""" result = [] alpr = subprocess.Popen( self._cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL ) # send image try: ...
[ "def", "recognize_byte", "(", "self", ",", "image", ",", "timeout", "=", "10", ")", ":", "result", "=", "[", "]", "alpr", "=", "subprocess", ".", "Popen", "(", "self", ".", "_cmd", ",", "stdin", "=", "subprocess", ".", "PIPE", ",", "stdout", "=", "...
Process a byte image buffer.
[ "Process", "a", "byte", "image", "buffer", "." ]
python
train
qacafe/cdrouter.py
cdrouter/packages.py
https://github.com/qacafe/cdrouter.py/blob/aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5/cdrouter/packages.py#L320-L327
def bulk_copy(self, ids): """Bulk copy a set of packages. :param ids: Int list of package IDs. :return: :class:`packages.Package <packages.Package>` list """ schema = PackageSchema() return self.service.bulk_copy(self.base, self.RESOURCE, ids, schema)
[ "def", "bulk_copy", "(", "self", ",", "ids", ")", ":", "schema", "=", "PackageSchema", "(", ")", "return", "self", ".", "service", ".", "bulk_copy", "(", "self", ".", "base", ",", "self", ".", "RESOURCE", ",", "ids", ",", "schema", ")" ]
Bulk copy a set of packages. :param ids: Int list of package IDs. :return: :class:`packages.Package <packages.Package>` list
[ "Bulk", "copy", "a", "set", "of", "packages", "." ]
python
train
tensorflow/tensor2tensor
tensor2tensor/models/transformer.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/transformer.py#L1808-L1823
def transformer_tall_finetune_tied(): """Tied means fine-tune CNN/DM summarization as LM.""" hparams = transformer_tall() hparams.multiproblem_max_input_length = 750 hparams.multiproblem_max_target_length = 100 hparams.multiproblem_schedule_max_examples = 0 hparams.learning_rate_schedule = ("linear_warmup*c...
[ "def", "transformer_tall_finetune_tied", "(", ")", ":", "hparams", "=", "transformer_tall", "(", ")", "hparams", ".", "multiproblem_max_input_length", "=", "750", "hparams", ".", "multiproblem_max_target_length", "=", "100", "hparams", ".", "multiproblem_schedule_max_exam...
Tied means fine-tune CNN/DM summarization as LM.
[ "Tied", "means", "fine", "-", "tune", "CNN", "/", "DM", "summarization", "as", "LM", "." ]
python
train
pypa/pipenv
pipenv/vendor/jinja2/filters.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/filters.py#L196-L203
def do_title(s): """Return a titlecased version of the value. I.e. words will start with uppercase letters, all remaining characters are lowercase. """ return ''.join( [item[0].upper() + item[1:].lower() for item in _word_beginning_split_re.split(soft_unicode(s)) if item])
[ "def", "do_title", "(", "s", ")", ":", "return", "''", ".", "join", "(", "[", "item", "[", "0", "]", ".", "upper", "(", ")", "+", "item", "[", "1", ":", "]", ".", "lower", "(", ")", "for", "item", "in", "_word_beginning_split_re", ".", "split", ...
Return a titlecased version of the value. I.e. words will start with uppercase letters, all remaining characters are lowercase.
[ "Return", "a", "titlecased", "version", "of", "the", "value", ".", "I", ".", "e", ".", "words", "will", "start", "with", "uppercase", "letters", "all", "remaining", "characters", "are", "lowercase", "." ]
python
train
christophertbrown/bioscripts
ctbBio/strip_align.py
https://github.com/christophertbrown/bioscripts/blob/83b2566b3a5745437ec651cd6cafddd056846240/ctbBio/strip_align.py#L19-L39
def strip_msa_100(msa, threshold, plot = False): """ strip out columns of a MSA that represent gaps for X percent (threshold) of sequences """ msa = [seq for seq in parse_fasta(msa)] columns = [[0, 0] for pos in msa[0][1]] # [[#bases, #gaps], [#bases, #gaps], ...] for seq in msa: for position, base in enumerate...
[ "def", "strip_msa_100", "(", "msa", ",", "threshold", ",", "plot", "=", "False", ")", ":", "msa", "=", "[", "seq", "for", "seq", "in", "parse_fasta", "(", "msa", ")", "]", "columns", "=", "[", "[", "0", ",", "0", "]", "for", "pos", "in", "msa", ...
strip out columns of a MSA that represent gaps for X percent (threshold) of sequences
[ "strip", "out", "columns", "of", "a", "MSA", "that", "represent", "gaps", "for", "X", "percent", "(", "threshold", ")", "of", "sequences" ]
python
train
usc-isi-i2/dig-sparkutil
digSparkUtil/fileUtil.py
https://github.com/usc-isi-i2/dig-sparkutil/blob/d39c6cf957025c170753b0e02e477fea20ee3f2a/digSparkUtil/fileUtil.py#L131-L151
def _load_text_csv_file(self, filename, separator=',', **kwargs): """Return a pair RDD where key is taken from first column, remaining columns are named after their column id as string""" rdd_input = self.sc.textFile(filename) def load_csv_record(line): input_stream = StringIO.Strin...
[ "def", "_load_text_csv_file", "(", "self", ",", "filename", ",", "separator", "=", "','", ",", "*", "*", "kwargs", ")", ":", "rdd_input", "=", "self", ".", "sc", ".", "textFile", "(", "filename", ")", "def", "load_csv_record", "(", "line", ")", ":", "i...
Return a pair RDD where key is taken from first column, remaining columns are named after their column id as string
[ "Return", "a", "pair", "RDD", "where", "key", "is", "taken", "from", "first", "column", "remaining", "columns", "are", "named", "after", "their", "column", "id", "as", "string" ]
python
train
awacha/credolib
credolib/initialization.py
https://github.com/awacha/credolib/blob/11c0be3eea7257d3d6e13697d3e76ce538f2f1b2/credolib/initialization.py#L17-L82
def init_dirs(rootdir_or_loader, outputpath, saveto_dir='data', auximages_dir='auximages', prefix='crd'): """Initialize the directiories. Inputs: rootdir_or_loader: depends on the type: str: the root directory of the SAXSCtrl/CCT software, i.e. ...
[ "def", "init_dirs", "(", "rootdir_or_loader", ",", "outputpath", ",", "saveto_dir", "=", "'data'", ",", "auximages_dir", "=", "'auximages'", ",", "prefix", "=", "'crd'", ")", ":", "ip", "=", "get_ipython", "(", ")", "if", "isinstance", "(", "rootdir_or_loader"...
Initialize the directiories. Inputs: rootdir_or_loader: depends on the type: str: the root directory of the SAXSCtrl/CCT software, i.e. where the subfolders ``eval2d``, ``param``, ``images``, ``mask`` etc. reside. sastool.classes2.Load...
[ "Initialize", "the", "directiories", "." ]
python
train
spotify/gordon
gordon/record_checker.py
https://github.com/spotify/gordon/blob/8dbf54a032cfaa8f003264682456236b6a69c039/gordon/record_checker.py#L54-L94
async def check_record(self, record, timeout=60): """Measures the time for a DNS record to become available. Query a provided DNS server multiple times until the reply matches the information in the record or until timeout is reached. Args: record (dict): DNS record as a di...
[ "async", "def", "check_record", "(", "self", ",", "record", ",", "timeout", "=", "60", ")", ":", "start_time", "=", "time", ".", "time", "(", ")", "name", ",", "rr_data", ",", "r_type", ",", "ttl", "=", "self", ".", "_extract_record_data", "(", "record...
Measures the time for a DNS record to become available. Query a provided DNS server multiple times until the reply matches the information in the record or until timeout is reached. Args: record (dict): DNS record as a dict with record properties. timeout (int): Time th...
[ "Measures", "the", "time", "for", "a", "DNS", "record", "to", "become", "available", "." ]
python
train
tradenity/python-sdk
tradenity/resources/discount_promotion.py
https://github.com/tradenity/python-sdk/blob/d13fbe23f4d6ff22554c6d8d2deaf209371adaf1/tradenity/resources/discount_promotion.py#L892-L913
def update_discount_promotion_by_id(cls, discount_promotion_id, discount_promotion, **kwargs): """Update DiscountPromotion Update attributes of DiscountPromotion This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True ...
[ "def", "update_discount_promotion_by_id", "(", "cls", ",", "discount_promotion_id", ",", "discount_promotion", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async'", ")", ":", ...
Update DiscountPromotion Update attributes of DiscountPromotion This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.update_discount_promotion_by_id(discount_promotion_id, discount_promotion, async=True) ...
[ "Update", "DiscountPromotion" ]
python
train
mrstephenneal/mysql-toolkit
mysql/toolkit/components/structure/keys.py
https://github.com/mrstephenneal/mysql-toolkit/blob/6964f718f4b72eb30f2259adfcfaf3090526c53d/mysql/toolkit/components/structure/keys.py#L15-L18
def set_primary_key(self, table, column): """Create a Primary Key constraint on a specific column when the table is already created.""" self.execute('ALTER TABLE {0} ADD PRIMARY KEY ({1})'.format(wrap(table), column)) self._printer('\tAdded primary key to {0} on column {1}'.format(wrap(table), c...
[ "def", "set_primary_key", "(", "self", ",", "table", ",", "column", ")", ":", "self", ".", "execute", "(", "'ALTER TABLE {0} ADD PRIMARY KEY ({1})'", ".", "format", "(", "wrap", "(", "table", ")", ",", "column", ")", ")", "self", ".", "_printer", "(", "'\\...
Create a Primary Key constraint on a specific column when the table is already created.
[ "Create", "a", "Primary", "Key", "constraint", "on", "a", "specific", "column", "when", "the", "table", "is", "already", "created", "." ]
python
train
mushkevych/scheduler
synergy/system/repeat_timer.py
https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/system/repeat_timer.py#L48-L52
def cancel(self): """ stops the timer. call_back function is not called """ self.event.clear() if self.__timer is not None: self.__timer.cancel()
[ "def", "cancel", "(", "self", ")", ":", "self", ".", "event", ".", "clear", "(", ")", "if", "self", ".", "__timer", "is", "not", "None", ":", "self", ".", "__timer", ".", "cancel", "(", ")" ]
stops the timer. call_back function is not called
[ "stops", "the", "timer", ".", "call_back", "function", "is", "not", "called" ]
python
train
nwilming/ocupy
ocupy/utils.py
https://github.com/nwilming/ocupy/blob/a0bd64f822576feaa502939d6bafd1183b237d16/ocupy/utils.py#L78-L88
def calc_resize_factor(prediction, image_size): """ Calculates how much prediction.shape and image_size differ. """ resize_factor_x = prediction.shape[1] / float(image_size[1]) resize_factor_y = prediction.shape[0] / float(image_size[0]) if abs(resize_factor_x - resize_factor_y) > 1.0/image_size...
[ "def", "calc_resize_factor", "(", "prediction", ",", "image_size", ")", ":", "resize_factor_x", "=", "prediction", ".", "shape", "[", "1", "]", "/", "float", "(", "image_size", "[", "1", "]", ")", "resize_factor_y", "=", "prediction", ".", "shape", "[", "0...
Calculates how much prediction.shape and image_size differ.
[ "Calculates", "how", "much", "prediction", ".", "shape", "and", "image_size", "differ", "." ]
python
train
CellProfiler/centrosome
centrosome/cpmorphology.py
https://github.com/CellProfiler/centrosome/blob/7bd9350a2d4ae1b215b81eabcecfe560bbb1f32a/centrosome/cpmorphology.py#L3185-L3204
def endpoints(image, mask=None): '''Remove all pixels from an image except for endpoints image - a skeletonized image mask - a mask of pixels excluded from consideration 1 0 0 ? 0 0 0 1 0 -> 0 1 0 0 0 0 0 0 0 ''' global endpoints_table if mask is None: masked...
[ "def", "endpoints", "(", "image", ",", "mask", "=", "None", ")", ":", "global", "endpoints_table", "if", "mask", "is", "None", ":", "masked_image", "=", "image", "else", ":", "masked_image", "=", "image", ".", "astype", "(", "bool", ")", ".", "copy", "...
Remove all pixels from an image except for endpoints image - a skeletonized image mask - a mask of pixels excluded from consideration 1 0 0 ? 0 0 0 1 0 -> 0 1 0 0 0 0 0 0 0
[ "Remove", "all", "pixels", "from", "an", "image", "except", "for", "endpoints", "image", "-", "a", "skeletonized", "image", "mask", "-", "a", "mask", "of", "pixels", "excluded", "from", "consideration", "1", "0", "0", "?", "0", "0", "0", "1", "0", "-",...
python
train
chimera0/accel-brain-code
Reinforcement-Learning/pyqlearning/deep_q_learning.py
https://github.com/chimera0/accel-brain-code/blob/03661f6f544bed656269fcd4b3c23c9061629daa/Reinforcement-Learning/pyqlearning/deep_q_learning.py#L237-L244
def get_alpha_value(self): ''' getter Learning rate. ''' if isinstance(self.__alpha_value, float) is False: raise TypeError("The type of __alpha_value must be float.") return self.__alpha_value
[ "def", "get_alpha_value", "(", "self", ")", ":", "if", "isinstance", "(", "self", ".", "__alpha_value", ",", "float", ")", "is", "False", ":", "raise", "TypeError", "(", "\"The type of __alpha_value must be float.\"", ")", "return", "self", ".", "__alpha_value" ]
getter Learning rate.
[ "getter", "Learning", "rate", "." ]
python
train
pgjones/quart
quart/blueprints.py
https://github.com/pgjones/quart/blob/7cb2d3bd98e8746025764f2b933abc12041fa175/quart/blueprints.py#L290-L305
def add_app_template_global(self, func: Callable, name: Optional[str]=None) -> None: """Add an application wide template global. This is designed to be used on the blueprint directly, and has the same arguments as :meth:`~quart.Quart.add_template_global`. An example usage, .. c...
[ "def", "add_app_template_global", "(", "self", ",", "func", ":", "Callable", ",", "name", ":", "Optional", "[", "str", "]", "=", "None", ")", "->", "None", ":", "self", ".", "record_once", "(", "lambda", "state", ":", "state", ".", "register_template_globa...
Add an application wide template global. This is designed to be used on the blueprint directly, and has the same arguments as :meth:`~quart.Quart.add_template_global`. An example usage, .. code-block:: python def global(): ... blueprint = Bluep...
[ "Add", "an", "application", "wide", "template", "global", "." ]
python
train
flashashen/flange
flange/iterutils.py
https://github.com/flashashen/flange/blob/67ebaf70e39887f65ce1163168d182a8e4c2774a/flange/iterutils.py#L701-L725
def same(iterable, ref=_UNSET): """``same()`` returns ``True`` when all values in *iterable* are equal to one another, or optionally a reference value, *ref*. Similar to :func:`all` and :func:`any` in that it evaluates an iterable and returns a :class:`bool`. ``same()`` returns ``True`` for empty it...
[ "def", "same", "(", "iterable", ",", "ref", "=", "_UNSET", ")", ":", "iterator", "=", "iter", "(", "iterable", ")", "if", "ref", "is", "_UNSET", ":", "ref", "=", "next", "(", "iterator", ",", "ref", ")", "return", "all", "(", "val", "==", "ref", ...
``same()`` returns ``True`` when all values in *iterable* are equal to one another, or optionally a reference value, *ref*. Similar to :func:`all` and :func:`any` in that it evaluates an iterable and returns a :class:`bool`. ``same()`` returns ``True`` for empty iterables. >>> same([]) True ...
[ "same", "()", "returns", "True", "when", "all", "values", "in", "*", "iterable", "*", "are", "equal", "to", "one", "another", "or", "optionally", "a", "reference", "value", "*", "ref", "*", ".", "Similar", "to", ":", "func", ":", "all", "and", ":", "...
python
train
markuskiller/textblob-de
textblob_de/np_extractors.py
https://github.com/markuskiller/textblob-de/blob/1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1/textblob_de/np_extractors.py#L120-L146
def _filter_extracted(self, extracted_list): """Filter insignificant words for key noun phrase extraction. determiners, relative pronouns, reflexive pronouns In general, pronouns are not useful, as you need context to know what they refer to. Most of the pronouns, however, are filtered ...
[ "def", "_filter_extracted", "(", "self", ",", "extracted_list", ")", ":", "_filtered", "=", "[", "]", "for", "np", "in", "extracted_list", ":", "_np", "=", "np", ".", "split", "(", ")", "if", "_np", "[", "0", "]", "in", "INSIGNIFICANT", ":", "_np", "...
Filter insignificant words for key noun phrase extraction. determiners, relative pronouns, reflexive pronouns In general, pronouns are not useful, as you need context to know what they refer to. Most of the pronouns, however, are filtered out by blob.noun_phrase method's np length (>1) ...
[ "Filter", "insignificant", "words", "for", "key", "noun", "phrase", "extraction", "." ]
python
train
shoebot/shoebot
shoebot/data/geometry.py
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/data/geometry.py#L374-L385
def contains(self, *a): """ Returns True if the given point or rectangle falls within the bounds. """ if len(a) == 2: a = [Point(a[0], a[1])] if len(a) == 1: a = a[0] if isinstance(a, Point): return a.x >= self.x and a.x <= self.x+self.width...
[ "def", "contains", "(", "self", ",", "*", "a", ")", ":", "if", "len", "(", "a", ")", "==", "2", ":", "a", "=", "[", "Point", "(", "a", "[", "0", "]", ",", "a", "[", "1", "]", ")", "]", "if", "len", "(", "a", ")", "==", "1", ":", "a", ...
Returns True if the given point or rectangle falls within the bounds.
[ "Returns", "True", "if", "the", "given", "point", "or", "rectangle", "falls", "within", "the", "bounds", "." ]
python
valid
boriel/zxbasic
zxbparser.py
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbparser.py#L950-L953
def p_statement_randomize(p): """ statement : RANDOMIZE """ p[0] = make_sentence('RANDOMIZE', make_number(0, lineno=p.lineno(1), type_=TYPE.ulong))
[ "def", "p_statement_randomize", "(", "p", ")", ":", "p", "[", "0", "]", "=", "make_sentence", "(", "'RANDOMIZE'", ",", "make_number", "(", "0", ",", "lineno", "=", "p", ".", "lineno", "(", "1", ")", ",", "type_", "=", "TYPE", ".", "ulong", ")", ")"...
statement : RANDOMIZE
[ "statement", ":", "RANDOMIZE" ]
python
train
SpriteLink/NIPAP
nipap-cli/nipap_cli/nipap_cli.py
https://github.com/SpriteLink/NIPAP/blob/f96069f11ab952d80b13cab06e0528f2d24b3de9/nipap-cli/nipap_cli/nipap_cli.py#L49-L80
def setup_connection(): """ Set up the global pynipap connection object """ # get connection parameters, first from environment variables if they are # defined, otherwise from .nipaprc try: con_params = { 'username': os.getenv('NIPAP_USERNAME') or cfg.get('global', 'username'), ...
[ "def", "setup_connection", "(", ")", ":", "# get connection parameters, first from environment variables if they are", "# defined, otherwise from .nipaprc", "try", ":", "con_params", "=", "{", "'username'", ":", "os", ".", "getenv", "(", "'NIPAP_USERNAME'", ")", "or", "cfg"...
Set up the global pynipap connection object
[ "Set", "up", "the", "global", "pynipap", "connection", "object" ]
python
train
tcalmant/ipopo
pelix/rsa/edef.py
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/edef.py#L468-L478
def write(self, endpoints, filename): # type: (List[EndpointDescription], str) -> None """ Writes the given endpoint descriptions to the given file :param endpoints: A list of EndpointDescription beans :param filename: Name of the file where to write the XML :raise IOErr...
[ "def", "write", "(", "self", ",", "endpoints", ",", "filename", ")", ":", "# type: (List[EndpointDescription], str) -> None", "with", "open", "(", "filename", ",", "\"w\"", ")", "as", "filep", ":", "filep", ".", "write", "(", "self", ".", "to_string", "(", "...
Writes the given endpoint descriptions to the given file :param endpoints: A list of EndpointDescription beans :param filename: Name of the file where to write the XML :raise IOError: Error writing the file
[ "Writes", "the", "given", "endpoint", "descriptions", "to", "the", "given", "file" ]
python
train
inasafe/inasafe
safe/common/parameters/resource_parameter_widget.py
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/common/parameters/resource_parameter_widget.py#L37-L43
def get_parameter(self): """Obtain the parameter object from the current widget state. :returns: A BooleanParameter from the current state of widget """ self._parameter.value = self._input.value() return self._parameter
[ "def", "get_parameter", "(", "self", ")", ":", "self", ".", "_parameter", ".", "value", "=", "self", ".", "_input", ".", "value", "(", ")", "return", "self", ".", "_parameter" ]
Obtain the parameter object from the current widget state. :returns: A BooleanParameter from the current state of widget
[ "Obtain", "the", "parameter", "object", "from", "the", "current", "widget", "state", "." ]
python
train
rbarrois/throttle
throttle/storage/django.py
https://github.com/rbarrois/throttle/blob/cc00e6b446f3938c81826ee258975ebdc12511a2/throttle/storage/django.py#L25-L29
def cache(self): """Memoize access to the cache backend.""" if self._cache is None: self._cache = django_cache.get_cache(self.cache_name) return self._cache
[ "def", "cache", "(", "self", ")", ":", "if", "self", ".", "_cache", "is", "None", ":", "self", ".", "_cache", "=", "django_cache", ".", "get_cache", "(", "self", ".", "cache_name", ")", "return", "self", ".", "_cache" ]
Memoize access to the cache backend.
[ "Memoize", "access", "to", "the", "cache", "backend", "." ]
python
train
icio/evil
evil/__init__.py
https://github.com/icio/evil/blob/6f12d16652951fb60ac238cef203eaa585ec0a28/evil/__init__.py#L140-L161
def expr_tokenizer(expr, operator_tokens): """expr_tokenizer yields the components ("tokens") forming the expression. Tokens are split by whitespace which is never considered a token in its own right. operator_tokens should likely include "(" and ")" and strictly the expression. This means that the wor...
[ "def", "expr_tokenizer", "(", "expr", ",", "operator_tokens", ")", ":", "operator_tokens", ".", "sort", "(", "key", "=", "len", ",", "reverse", "=", "True", ")", "for", "m", "in", "re", ".", "finditer", "(", "r\"\"\"(\\s+) | # Whitespace\n ...
expr_tokenizer yields the components ("tokens") forming the expression. Tokens are split by whitespace which is never considered a token in its own right. operator_tokens should likely include "(" and ")" and strictly the expression. This means that the word 'test' will be split into ['t', 'e', 'st'] i...
[ "expr_tokenizer", "yields", "the", "components", "(", "tokens", ")", "forming", "the", "expression", "." ]
python
train
wummel/linkchecker
linkcheck/plugins/viruscheck.py
https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/linkcheck/plugins/viruscheck.py#L86-L110
def new_scansock (self): """Return a connected socket for sending scan data to it.""" port = None try: self.sock.sendall("STREAM") port = None for dummy in range(60): data = self.sock.recv(self.sock_rcvbuf) i = data.find("PORT")...
[ "def", "new_scansock", "(", "self", ")", ":", "port", "=", "None", "try", ":", "self", ".", "sock", ".", "sendall", "(", "\"STREAM\"", ")", "port", "=", "None", "for", "dummy", "in", "range", "(", "60", ")", ":", "data", "=", "self", ".", "sock", ...
Return a connected socket for sending scan data to it.
[ "Return", "a", "connected", "socket", "for", "sending", "scan", "data", "to", "it", "." ]
python
train
goller/hashring
src/hashring/hashring.py
https://github.com/goller/hashring/blob/9bee95074f7d853b6aa656968dfd359d02b3b710/src/hashring/hashring.py#L150-L157
def gen_key(self, key): """Given a string key it returns a long value, this long value represents a place on the hash ring. md5 is currently used because it mixes well. """ b_key = self._hash_digest(key) return self._hash_val(b_key, lambda x: x)
[ "def", "gen_key", "(", "self", ",", "key", ")", ":", "b_key", "=", "self", ".", "_hash_digest", "(", "key", ")", "return", "self", ".", "_hash_val", "(", "b_key", ",", "lambda", "x", ":", "x", ")" ]
Given a string key it returns a long value, this long value represents a place on the hash ring. md5 is currently used because it mixes well.
[ "Given", "a", "string", "key", "it", "returns", "a", "long", "value", "this", "long", "value", "represents", "a", "place", "on", "the", "hash", "ring", "." ]
python
valid
phareous/insteonlocal
insteonlocal/Hub.py
https://github.com/phareous/insteonlocal/blob/a4544a17d143fb285852cb873e862c270d55dd00/insteonlocal/Hub.py#L1072-L1091
def check_success(self, device_id, sent_cmd1, sent_cmd2): """Check if last command succeeded by checking buffer""" device_id = device_id.upper() self.logger.info('check_success: for device %s cmd1 %s cmd2 %s', device_id, sent_cmd1, sent_cmd2) sleep(2) s...
[ "def", "check_success", "(", "self", ",", "device_id", ",", "sent_cmd1", ",", "sent_cmd2", ")", ":", "device_id", "=", "device_id", ".", "upper", "(", ")", "self", ".", "logger", ".", "info", "(", "'check_success: for device %s cmd1 %s cmd2 %s'", ",", "device_id...
Check if last command succeeded by checking buffer
[ "Check", "if", "last", "command", "succeeded", "by", "checking", "buffer" ]
python
train
pypa/pipenv
pipenv/vendor/requests/sessions.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/sessions.py#L466-L535
def request(self, method, url, params=None, data=None, headers=None, cookies=None, files=None, auth=None, timeout=None, allow_redirects=True, proxies=None, hooks=None, stream=None, verify=None, cert=None, json=None): """Constructs a :class:`Request <Request>`, prepares it and...
[ "def", "request", "(", "self", ",", "method", ",", "url", ",", "params", "=", "None", ",", "data", "=", "None", ",", "headers", "=", "None", ",", "cookies", "=", "None", ",", "files", "=", "None", ",", "auth", "=", "None", ",", "timeout", "=", "N...
Constructs a :class:`Request <Request>`, prepares it and sends it. Returns :class:`Response <Response>` object. :param method: method for the new :class:`Request` object. :param url: URL for the new :class:`Request` object. :param params: (optional) Dictionary or bytes to be sent in the...
[ "Constructs", "a", ":", "class", ":", "Request", "<Request", ">", "prepares", "it", "and", "sends", "it", ".", "Returns", ":", "class", ":", "Response", "<Response", ">", "object", "." ]
python
train
iotile/coretools
iotilebuild/iotile/build/tilebus/block.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/tilebus/block.py#L98-L110
def set_name(self, name): """Set the module name to a 6 byte string If the string is too short it is appended with space characters. """ if len(name) > 6: raise ArgumentError("Name must be at most 6 characters long", name=name) if len(name) < 6: name +=...
[ "def", "set_name", "(", "self", ",", "name", ")", ":", "if", "len", "(", "name", ")", ">", "6", ":", "raise", "ArgumentError", "(", "\"Name must be at most 6 characters long\"", ",", "name", "=", "name", ")", "if", "len", "(", "name", ")", "<", "6", ":...
Set the module name to a 6 byte string If the string is too short it is appended with space characters.
[ "Set", "the", "module", "name", "to", "a", "6", "byte", "string" ]
python
train
biocore/burrito-fillings
bfillings/cd_hit.py
https://github.com/biocore/burrito-fillings/blob/02ab71a46119b40793bd56a4ae00ca15f6dc3329/bfillings/cd_hit.py#L151-L159
def _input_as_multiline_string(self, data): """Writes data to tempfile and sets -i parameter data -- list of lines """ if data: self.Parameters['-i']\ .on(super(CD_HIT,self)._input_as_multiline_string(data)) return ''
[ "def", "_input_as_multiline_string", "(", "self", ",", "data", ")", ":", "if", "data", ":", "self", ".", "Parameters", "[", "'-i'", "]", ".", "on", "(", "super", "(", "CD_HIT", ",", "self", ")", ".", "_input_as_multiline_string", "(", "data", ")", ")", ...
Writes data to tempfile and sets -i parameter data -- list of lines
[ "Writes", "data", "to", "tempfile", "and", "sets", "-", "i", "parameter" ]
python
train
rix0rrr/gcl
gcl/functions.py
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/functions.py#L85-L98
def has_key(tup, key): """has(tuple, string) -> bool Return whether a given tuple has a key and the key is bound. """ if isinstance(tup, framework.TupleLike): return tup.is_bound(key) if isinstance(tup, dict): return key in tup if isinstance(tup, list): if not isinstance(key, int): raise ...
[ "def", "has_key", "(", "tup", ",", "key", ")", ":", "if", "isinstance", "(", "tup", ",", "framework", ".", "TupleLike", ")", ":", "return", "tup", ".", "is_bound", "(", "key", ")", "if", "isinstance", "(", "tup", ",", "dict", ")", ":", "return", "k...
has(tuple, string) -> bool Return whether a given tuple has a key and the key is bound.
[ "has", "(", "tuple", "string", ")", "-", ">", "bool" ]
python
train
rvswift/EB
EB/builder/utilities/classification.py
https://github.com/rvswift/EB/blob/341880b79faf8147dc9fa6e90438531cd09fabcc/EB/builder/utilities/classification.py#L153-L171
def calculate_ef_var(tpf, fpf): """ determine variance due to actives (efvar_a) decoys (efvar_d) and s2, the slope of the ROC curve tangent to the fpf @ which the enrichment factor was calculated :param tpf: float tpf @ which the enrichment factor was calculated :param fpf: float fpf @ which the enr...
[ "def", "calculate_ef_var", "(", "tpf", ",", "fpf", ")", ":", "efvara", "=", "(", "tpf", "*", "(", "1", "-", "tpf", ")", ")", "efvard", "=", "(", "fpf", "*", "(", "1", "-", "fpf", ")", ")", "ef", "=", "tpf", "/", "fpf", "if", "fpf", "==", "1...
determine variance due to actives (efvar_a) decoys (efvar_d) and s2, the slope of the ROC curve tangent to the fpf @ which the enrichment factor was calculated :param tpf: float tpf @ which the enrichment factor was calculated :param fpf: float fpf @ which the enrichment factor was calculated :return ef...
[ "determine", "variance", "due", "to", "actives", "(", "efvar_a", ")", "decoys", "(", "efvar_d", ")", "and", "s2", "the", "slope", "of", "the", "ROC", "curve", "tangent", "to", "the", "fpf" ]
python
train
materialsproject/pymatgen
pymatgen/io/abinit/utils.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/utils.py#L784-L789
def as_condition(cls, obj): """Convert obj into :class:`Condition`""" if isinstance(obj, cls): return obj else: return cls(cmap=obj)
[ "def", "as_condition", "(", "cls", ",", "obj", ")", ":", "if", "isinstance", "(", "obj", ",", "cls", ")", ":", "return", "obj", "else", ":", "return", "cls", "(", "cmap", "=", "obj", ")" ]
Convert obj into :class:`Condition`
[ "Convert", "obj", "into", ":", "class", ":", "Condition" ]
python
train
softlayer/softlayer-python
SoftLayer/CLI/file/access/list.py
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/file/access/list.py#L21-L38
def cli(env, columns, sortby, volume_id): """List ACLs.""" file_manager = SoftLayer.FileStorageManager(env.client) access_list = file_manager.get_file_volume_access_list( volume_id=volume_id) table = formatting.Table(columns.columns) table.sortby = sortby for key, type_name in [('allowe...
[ "def", "cli", "(", "env", ",", "columns", ",", "sortby", ",", "volume_id", ")", ":", "file_manager", "=", "SoftLayer", ".", "FileStorageManager", "(", "env", ".", "client", ")", "access_list", "=", "file_manager", ".", "get_file_volume_access_list", "(", "volu...
List ACLs.
[ "List", "ACLs", "." ]
python
train
samirelanduk/quickplots
quickplots/charts.py
https://github.com/samirelanduk/quickplots/blob/59f5e6ff367b2c1c24ba7cf1805d03552034c6d8/quickplots/charts.py#L164-L172
def add_series(self, series): """Adds a :py:class:`.Series` to the chart. :param Series series: The :py:class:`.Series` to add.""" if not isinstance(series, Series): raise TypeError("'%s' is not a Series" % str(series)) self._all_series.append(series) series._chart ...
[ "def", "add_series", "(", "self", ",", "series", ")", ":", "if", "not", "isinstance", "(", "series", ",", "Series", ")", ":", "raise", "TypeError", "(", "\"'%s' is not a Series\"", "%", "str", "(", "series", ")", ")", "self", ".", "_all_series", ".", "ap...
Adds a :py:class:`.Series` to the chart. :param Series series: The :py:class:`.Series` to add.
[ "Adds", "a", ":", "py", ":", "class", ":", ".", "Series", "to", "the", "chart", "." ]
python
train
pycampers/zproc
zproc/state/state.py
https://github.com/pycampers/zproc/blob/352a3c7166e2ccc3597c28385a8354b5a22afdc2/zproc/state/state.py#L522-L575
def atomic(fn: Callable) -> Callable: """ Wraps a function, to create an atomic operation out of it. This contract guarantees, that while an atomic ``fn`` is running - - No one, except the "callee" may access the state. - If an ``Exception`` occurs while the ``fn`` is running, the state remains un...
[ "def", "atomic", "(", "fn", ":", "Callable", ")", "->", "Callable", ":", "msg", "=", "{", "Msgs", ".", "cmd", ":", "Cmds", ".", "run_fn_atomically", ",", "Msgs", ".", "info", ":", "serializer", ".", "dumps_fn", "(", "fn", ")", ",", "Msgs", ".", "ar...
Wraps a function, to create an atomic operation out of it. This contract guarantees, that while an atomic ``fn`` is running - - No one, except the "callee" may access the state. - If an ``Exception`` occurs while the ``fn`` is running, the state remains unaffected. - | If a signal is sent to the "call...
[ "Wraps", "a", "function", "to", "create", "an", "atomic", "operation", "out", "of", "it", "." ]
python
train
Kyria/EsiPy
esipy/events.py
https://github.com/Kyria/EsiPy/blob/06407a0218a126678f80d8a7e8a67b9729327865/esipy/events.py#L19-L26
def add_receiver(self, receiver): """ Add a receiver to the list of receivers. :param receiver: a callable variable """ if not callable(receiver): raise TypeError("receiver must be callable") self.event_receivers.append(receiver)
[ "def", "add_receiver", "(", "self", ",", "receiver", ")", ":", "if", "not", "callable", "(", "receiver", ")", ":", "raise", "TypeError", "(", "\"receiver must be callable\"", ")", "self", ".", "event_receivers", ".", "append", "(", "receiver", ")" ]
Add a receiver to the list of receivers. :param receiver: a callable variable
[ "Add", "a", "receiver", "to", "the", "list", "of", "receivers", ".", ":", "param", "receiver", ":", "a", "callable", "variable" ]
python
train
mapbox/cligj
cligj/features.py
https://github.com/mapbox/cligj/blob/1815692d99abfb4bc4b2d0411f67fa568f112c05/cligj/features.py#L175-L189
def normalize_feature_objects(feature_objs): """Takes an iterable of GeoJSON-like Feature mappings or an iterable of objects with a geo interface and normalizes it to the former.""" for obj in feature_objs: if hasattr(obj, "__geo_interface__") and \ 'type' in obj.__geo_interface__.key...
[ "def", "normalize_feature_objects", "(", "feature_objs", ")", ":", "for", "obj", "in", "feature_objs", ":", "if", "hasattr", "(", "obj", ",", "\"__geo_interface__\"", ")", "and", "'type'", "in", "obj", ".", "__geo_interface__", ".", "keys", "(", ")", "and", ...
Takes an iterable of GeoJSON-like Feature mappings or an iterable of objects with a geo interface and normalizes it to the former.
[ "Takes", "an", "iterable", "of", "GeoJSON", "-", "like", "Feature", "mappings", "or", "an", "iterable", "of", "objects", "with", "a", "geo", "interface", "and", "normalizes", "it", "to", "the", "former", "." ]
python
train
fastai/fastai
fastai/callback.py
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/callback.py#L29-L34
def new(self, layer_groups:Collection[nn.Module], split_no_wd:bool=True): "Create a new `OptimWrapper` from `self` with another `layer_groups` but the same hyper-parameters." opt_func = getattr(self, 'opt_func', self.opt.__class__) res = self.create(opt_func, self.lr, layer_groups, wd=self.wd, t...
[ "def", "new", "(", "self", ",", "layer_groups", ":", "Collection", "[", "nn", ".", "Module", "]", ",", "split_no_wd", ":", "bool", "=", "True", ")", ":", "opt_func", "=", "getattr", "(", "self", ",", "'opt_func'", ",", "self", ".", "opt", ".", "__cla...
Create a new `OptimWrapper` from `self` with another `layer_groups` but the same hyper-parameters.
[ "Create", "a", "new", "OptimWrapper", "from", "self", "with", "another", "layer_groups", "but", "the", "same", "hyper", "-", "parameters", "." ]
python
train
wdecoster/NanoPlot
nanoplot/NanoPlot.py
https://github.com/wdecoster/NanoPlot/blob/d1601076731df2a07020316bd159b544f497a606/nanoplot/NanoPlot.py#L30-L106
def main(): ''' Organization function -setups logging -gets inputdata -calls plotting function ''' args = get_args() try: utils.make_output_dir(args.outdir) utils.init_logs(args) args.format = nanoplotter.check_valid_format(args.format) settings = vars(arg...
[ "def", "main", "(", ")", ":", "args", "=", "get_args", "(", ")", "try", ":", "utils", ".", "make_output_dir", "(", "args", ".", "outdir", ")", "utils", ".", "init_logs", "(", "args", ")", "args", ".", "format", "=", "nanoplotter", ".", "check_valid_for...
Organization function -setups logging -gets inputdata -calls plotting function
[ "Organization", "function", "-", "setups", "logging", "-", "gets", "inputdata", "-", "calls", "plotting", "function" ]
python
train
wandb/client
wandb/wandb_config.py
https://github.com/wandb/client/blob/7d08954ed5674fee223cd85ed0d8518fe47266b2/wandb/wandb_config.py#L154-L165
def persist(self): """Stores the current configuration for pushing to W&B""" # In dryrun mode, without wandb run, we don't # save config on initial load, because the run directory # may not be created yet (because we don't know if we're # being used in a run context, or as an AP...
[ "def", "persist", "(", "self", ")", ":", "# In dryrun mode, without wandb run, we don't", "# save config on initial load, because the run directory", "# may not be created yet (because we don't know if we're", "# being used in a run context, or as an API).", "# TODO: Defer saving somehow, maybe...
Stores the current configuration for pushing to W&B
[ "Stores", "the", "current", "configuration", "for", "pushing", "to", "W&B" ]
python
train
Koed00/django-q
django_q/admin.py
https://github.com/Koed00/django-q/blob/c84fd11a67c9a47d821786dfcdc189bb258c6f54/django_q/admin.py#L40-L44
def retry_failed(FailAdmin, request, queryset): """Submit selected tasks back to the queue.""" for task in queryset: async_task(task.func, *task.args or (), hook=task.hook, **task.kwargs or {}) task.delete()
[ "def", "retry_failed", "(", "FailAdmin", ",", "request", ",", "queryset", ")", ":", "for", "task", "in", "queryset", ":", "async_task", "(", "task", ".", "func", ",", "*", "task", ".", "args", "or", "(", ")", ",", "hook", "=", "task", ".", "hook", ...
Submit selected tasks back to the queue.
[ "Submit", "selected", "tasks", "back", "to", "the", "queue", "." ]
python
train
pantsbuild/pants
src/python/pants/reporting/json_reporter.py
https://github.com/pantsbuild/pants/blob/b72e650da0df685824ffdcc71988b8c282d0962d/src/python/pants/reporting/json_reporter.py#L88-L101
def do_handle_log(self, workunit, level, *msg_elements): """Implementation of Reporter callback.""" entry_info = { 'level': self._log_level_str[level], 'messages': self._render_messages(*msg_elements), } root_id = str(workunit.root().id) current_stack = self._root_id_to_workunit_stack[...
[ "def", "do_handle_log", "(", "self", ",", "workunit", ",", "level", ",", "*", "msg_elements", ")", ":", "entry_info", "=", "{", "'level'", ":", "self", ".", "_log_level_str", "[", "level", "]", ",", "'messages'", ":", "self", ".", "_render_messages", "(", ...
Implementation of Reporter callback.
[ "Implementation", "of", "Reporter", "callback", "." ]
python
train
msmbuilder/osprey
osprey/plugins/plugin_pylearn2.py
https://github.com/msmbuilder/osprey/blob/ea09da24e45820e1300e24a52fefa6c849f7a986/osprey/plugins/plugin_pylearn2.py#L278-L298
def load(self): """ Load the dataset using pylearn2.config.yaml_parse. """ from pylearn2.config import yaml_parse from pylearn2.datasets import Dataset dataset = yaml_parse.load(self.yaml_string) assert isinstance(dataset, Dataset) data = dataset.iterator...
[ "def", "load", "(", "self", ")", ":", "from", "pylearn2", ".", "config", "import", "yaml_parse", "from", "pylearn2", ".", "datasets", "import", "Dataset", "dataset", "=", "yaml_parse", ".", "load", "(", "self", ".", "yaml_string", ")", "assert", "isinstance"...
Load the dataset using pylearn2.config.yaml_parse.
[ "Load", "the", "dataset", "using", "pylearn2", ".", "config", ".", "yaml_parse", "." ]
python
valid
BernardFW/bernard
src/bernard/platforms/facebook/platform.py
https://github.com/BernardFW/bernard/blob/9c55703e5ffe5717c9fa39793df59dbfa5b4c5ab/src/bernard/platforms/facebook/platform.py#L785-L801
async def _send_generic_template(self, request: Request, stack: Stack): """ Generates and send a generic template. """ gt = stack.get_layer(GenericTemplate) payload = await gt.serialize(request) msg = { 'attachment': { 'type': 'template', ...
[ "async", "def", "_send_generic_template", "(", "self", ",", "request", ":", "Request", ",", "stack", ":", "Stack", ")", ":", "gt", "=", "stack", ".", "get_layer", "(", "GenericTemplate", ")", "payload", "=", "await", "gt", ".", "serialize", "(", "request",...
Generates and send a generic template.
[ "Generates", "and", "send", "a", "generic", "template", "." ]
python
train
PSPC-SPAC-buyandsell/von_anchor
von_anchor/tails.py
https://github.com/PSPC-SPAC-buyandsell/von_anchor/blob/78ac1de67be42a676274f4bf71fe12f66e72f309/von_anchor/tails.py#L97-L109
async def open(self) -> 'Tails': """ Open reader handle and return current object. :return: current object """ LOGGER.debug('Tails.open >>>') self._reader_handle = await blob_storage.open_reader('default', self._tails_config_json) LOGGER.debug('Tails.open <<<'...
[ "async", "def", "open", "(", "self", ")", "->", "'Tails'", ":", "LOGGER", ".", "debug", "(", "'Tails.open >>>'", ")", "self", ".", "_reader_handle", "=", "await", "blob_storage", ".", "open_reader", "(", "'default'", ",", "self", ".", "_tails_config_json", "...
Open reader handle and return current object. :return: current object
[ "Open", "reader", "handle", "and", "return", "current", "object", "." ]
python
train