repo
stringlengths
7
55
path
stringlengths
4
223
url
stringlengths
87
315
code
stringlengths
75
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
avg_line_len
float64
7.91
980
tensorflow/tensorboard
tensorboard/plugins/pr_curve/metadata.py
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/pr_curve/metadata.py#L63-L83
def parse_plugin_metadata(content): """Parse summary metadata to a Python object. Arguments: content: The `content` field of a `SummaryMetadata` proto corresponding to the pr_curves plugin. Returns: A `PrCurvesPlugin` protobuf object. """ if not isinstance(content, bytes): raise TypeError(...
[ "def", "parse_plugin_metadata", "(", "content", ")", ":", "if", "not", "isinstance", "(", "content", ",", "bytes", ")", ":", "raise", "TypeError", "(", "'Content type must be bytes'", ")", "result", "=", "plugin_data_pb2", ".", "PrCurvePluginData", ".", "FromStrin...
Parse summary metadata to a Python object. Arguments: content: The `content` field of a `SummaryMetadata` proto corresponding to the pr_curves plugin. Returns: A `PrCurvesPlugin` protobuf object.
[ "Parse", "summary", "metadata", "to", "a", "Python", "object", "." ]
python
train
32
inveniosoftware/invenio-admin
invenio_admin/views.py
https://github.com/inveniosoftware/invenio-admin/blob/b5ff8f7de66d1d6b67efc9f81ff094eb2428f969/invenio_admin/views.py#L34-L43
def init_menu(): """Initialize menu before first request.""" # Register settings menu item = current_menu.submenu('settings.admin') item.register( "admin.index", # NOTE: Menu item text (icon replaced by a cogs icon). _('%(icon)s Administration', icon='<i class="fa fa-cogs fa-fw">...
[ "def", "init_menu", "(", ")", ":", "# Register settings menu", "item", "=", "current_menu", ".", "submenu", "(", "'settings.admin'", ")", "item", ".", "register", "(", "\"admin.index\"", ",", "# NOTE: Menu item text (icon replaced by a cogs icon).", "_", "(", "'%(icon)s...
Initialize menu before first request.
[ "Initialize", "menu", "before", "first", "request", "." ]
python
train
37.7
greenbender/pynntp
nntp/nntp.py
https://github.com/greenbender/pynntp/blob/991a76331cdf5d8f9dbf5b18f6e29adc80749a2f/nntp/nntp.py#L395-L441
def command(self, verb, args=None): """Call a command on the server. If the user has not authenticated then authentication will be done as part of calling the command on the server. For commands that don't return a status message the status message will default to an empty stri...
[ "def", "command", "(", "self", ",", "verb", ",", "args", "=", "None", ")", ":", "if", "self", ".", "__generating", ":", "raise", "NNTPSyncError", "(", "\"Command issued while a generator is active\"", ")", "cmd", "=", "verb", "if", "args", ":", "cmd", "+=", ...
Call a command on the server. If the user has not authenticated then authentication will be done as part of calling the command on the server. For commands that don't return a status message the status message will default to an empty string. Args: verb: The verb o...
[ "Call", "a", "command", "on", "the", "server", "." ]
python
test
33.297872
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/model.py
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/model.py#L820-L855
def from_request(cls, request): """Create new TransientShardState from webapp request.""" mapreduce_spec = MapreduceSpec.from_json_str(request.get("mapreduce_spec")) mapper_spec = mapreduce_spec.mapper input_reader_spec_dict = json.loads(request.get("input_reader_state"), ...
[ "def", "from_request", "(", "cls", ",", "request", ")", ":", "mapreduce_spec", "=", "MapreduceSpec", ".", "from_json_str", "(", "request", ".", "get", "(", "\"mapreduce_spec\"", ")", ")", "mapper_spec", "=", "mapreduce_spec", ".", "mapper", "input_reader_spec_dict...
Create new TransientShardState from webapp request.
[ "Create", "new", "TransientShardState", "from", "webapp", "request", "." ]
python
train
45.75
saltstack/salt
salt/config/__init__.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L2151-L2178
def _read_conf_file(path): ''' Read in a config file from a given path and process it into a dictionary ''' log.debug('Reading configuration from %s', path) with salt.utils.files.fopen(path, 'r') as conf_file: try: conf_opts = salt.utils.yaml.safe_load(conf_file) or {} ex...
[ "def", "_read_conf_file", "(", "path", ")", ":", "log", ".", "debug", "(", "'Reading configuration from %s'", ",", "path", ")", "with", "salt", ".", "utils", ".", "files", ".", "fopen", "(", "path", ",", "'r'", ")", "as", "conf_file", ":", "try", ":", ...
Read in a config file from a given path and process it into a dictionary
[ "Read", "in", "a", "config", "file", "from", "a", "given", "path", "and", "process", "it", "into", "a", "dictionary" ]
python
train
46
productml/blurr
blurr/core/aggregate.py
https://github.com/productml/blurr/blob/1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa/blurr/core/aggregate.py#L97-L102
def _persist(self) -> None: """ Persists the current data group """ if self._store: self._store.save(self._key, self._snapshot)
[ "def", "_persist", "(", "self", ")", "->", "None", ":", "if", "self", ".", "_store", ":", "self", ".", "_store", ".", "save", "(", "self", ".", "_key", ",", "self", ".", "_snapshot", ")" ]
Persists the current data group
[ "Persists", "the", "current", "data", "group" ]
python
train
27.666667
cloud9ers/gurumate
environment/lib/python2.7/site-packages/IPython/frontend/qt/console/ipython_widget.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/ipython_widget.py#L178-L209
def _handle_history_reply(self, msg): """ Implemented to handle history tail replies, which are only supported by the IPython kernel. """ content = msg['content'] if 'history' not in content: self.log.error("History request failed: %r"%content) if cont...
[ "def", "_handle_history_reply", "(", "self", ",", "msg", ")", ":", "content", "=", "msg", "[", "'content'", "]", "if", "'history'", "not", "in", "content", ":", "self", ".", "log", ".", "error", "(", "\"History request failed: %r\"", "%", "content", ")", "...
Implemented to handle history tail replies, which are only supported by the IPython kernel.
[ "Implemented", "to", "handle", "history", "tail", "replies", "which", "are", "only", "supported", "by", "the", "IPython", "kernel", "." ]
python
test
45.78125
bjodah/pycodeexport
pycodeexport/util.py
https://github.com/bjodah/pycodeexport/blob/7d1d733745ea4e54fdcee8f16fea313794a4c11b/pycodeexport/util.py#L18-L91
def render_mako_template_to( template, outpath, subsd, only_update=False, cwd=None, prev_subsd=None, create_dest_dirs=False, logger=None, pass_warn_string=True, **kwargs): """ template: either string of path or file like obj. Beware of the only_update option, it pays no attention to...
[ "def", "render_mako_template_to", "(", "template", ",", "outpath", ",", "subsd", ",", "only_update", "=", "False", ",", "cwd", "=", "None", ",", "prev_subsd", "=", "None", ",", "create_dest_dirs", "=", "False", ",", "logger", "=", "None", ",", "pass_warn_str...
template: either string of path or file like obj. Beware of the only_update option, it pays no attention to an updated subsd. pass_warn_string: defult True if True or instance of str: an extra vairable named '_warning_in_the_generated_file_not_to_edit' is passed with a preset (True) or string ...
[ "template", ":", "either", "string", "of", "path", "or", "file", "like", "obj", "." ]
python
train
34.621622
VingtCinq/python-mailchimp
mailchimp3/entities/filemanagerfiles.py
https://github.com/VingtCinq/python-mailchimp/blob/1b472f1b64fdde974732ac4b7ed48908bb707260/mailchimp3/entities/filemanagerfiles.py#L111-L119
def delete(self, file_id): """ Remove a specific file from the File Manager. :param file_id: The unique id for the File Manager file. :type file_id: :py:class:`str` """ self.file_id = file_id return self._mc_client._delete(url=self._build_path(file_id))
[ "def", "delete", "(", "self", ",", "file_id", ")", ":", "self", ".", "file_id", "=", "file_id", "return", "self", ".", "_mc_client", ".", "_delete", "(", "url", "=", "self", ".", "_build_path", "(", "file_id", ")", ")" ]
Remove a specific file from the File Manager. :param file_id: The unique id for the File Manager file. :type file_id: :py:class:`str`
[ "Remove", "a", "specific", "file", "from", "the", "File", "Manager", "." ]
python
valid
33.555556
dhermes/bezier
docs/make_images.py
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/docs/make_images.py#L1141-L1174
def _edges_classify_intersection9(): """The edges for the curved polygon intersection used below. Helper for :func:`classify_intersection9`. """ edges1 = ( bezier.Curve.from_nodes( np.asfortranarray([[32.0, 30.0], [20.0, 25.0]]) ), bezier.Curve.from_nodes( ...
[ "def", "_edges_classify_intersection9", "(", ")", ":", "edges1", "=", "(", "bezier", ".", "Curve", ".", "from_nodes", "(", "np", ".", "asfortranarray", "(", "[", "[", "32.0", ",", "30.0", "]", ",", "[", "20.0", ",", "25.0", "]", "]", ")", ")", ",", ...
The edges for the curved polygon intersection used below. Helper for :func:`classify_intersection9`.
[ "The", "edges", "for", "the", "curved", "polygon", "intersection", "used", "below", "." ]
python
train
31.470588
chrisspen/burlap
burlap/vagrant.py
https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/vagrant.py#L182-L200
def vagrant_settings(self, name='', *args, **kwargs): """ Context manager that sets a vagrant VM as the remote host. Use this context manager inside a task to run commands on your current Vagrant box:: from burlap.vagrant import vagrant_settings with va...
[ "def", "vagrant_settings", "(", "self", ",", "name", "=", "''", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "config", "=", "self", ".", "ssh_config", "(", "name", ")", "extra_args", "=", "self", ".", "_settings_dict", "(", "config", ")", "kw...
Context manager that sets a vagrant VM as the remote host. Use this context manager inside a task to run commands on your current Vagrant box:: from burlap.vagrant import vagrant_settings with vagrant_settings(): run('hostname')
[ "Context", "manager", "that", "sets", "a", "vagrant", "VM", "as", "the", "remote", "host", "." ]
python
valid
28.052632
dmwm/DBS
Server/Python/src/dbs/web/DBSReaderModel.py
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/web/DBSReaderModel.py#L1138-L1155
def listDatasetParents(self, dataset=''): """ API to list A datasets parents in DBS. :param dataset: dataset (Required) :type dataset: str :returns: List of dictionaries containing the following keys (this_dataset, parent_dataset_id, parent_dataset) :rtype: list of dicts...
[ "def", "listDatasetParents", "(", "self", ",", "dataset", "=", "''", ")", ":", "try", ":", "return", "self", ".", "dbsDataset", ".", "listDatasetParents", "(", "dataset", ")", "except", "dbsException", "as", "de", ":", "dbsExceptionHandler", "(", "de", ".", ...
API to list A datasets parents in DBS. :param dataset: dataset (Required) :type dataset: str :returns: List of dictionaries containing the following keys (this_dataset, parent_dataset_id, parent_dataset) :rtype: list of dicts
[ "API", "to", "list", "A", "datasets", "parents", "in", "DBS", "." ]
python
train
46.166667
PyCQA/astroid
astroid/node_classes.py
https://github.com/PyCQA/astroid/blob/e0a298df55b15abcb77c2a93253f5ab7be52d0fb/astroid/node_classes.py#L3896-L3902
def _wrap_attribute(self, attr): """Wrap the empty attributes of the Slice in a Const node.""" if not attr: const = const_factory(attr) const.parent = self return const return attr
[ "def", "_wrap_attribute", "(", "self", ",", "attr", ")", ":", "if", "not", "attr", ":", "const", "=", "const_factory", "(", "attr", ")", "const", ".", "parent", "=", "self", "return", "const", "return", "attr" ]
Wrap the empty attributes of the Slice in a Const node.
[ "Wrap", "the", "empty", "attributes", "of", "the", "Slice", "in", "a", "Const", "node", "." ]
python
train
33.428571
pybel/pybel
src/pybel/tokens.py
https://github.com/pybel/pybel/blob/c8a7a1bdae4c475fa2a8c77f3a9a5f6d79556ca0/src/pybel/tokens.py#L79-L91
def _fusion_range_to_dsl(tokens) -> FusionRangeBase: """Convert a PyParsing data dictionary into a PyBEL. :type tokens: ParseResult """ if FUSION_MISSING in tokens: return missing_fusion_range() return fusion_range( reference=tokens[FUSION_REFERENCE], start=tokens[FUSION_ST...
[ "def", "_fusion_range_to_dsl", "(", "tokens", ")", "->", "FusionRangeBase", ":", "if", "FUSION_MISSING", "in", "tokens", ":", "return", "missing_fusion_range", "(", ")", "return", "fusion_range", "(", "reference", "=", "tokens", "[", "FUSION_REFERENCE", "]", ",", ...
Convert a PyParsing data dictionary into a PyBEL. :type tokens: ParseResult
[ "Convert", "a", "PyParsing", "data", "dictionary", "into", "a", "PyBEL", "." ]
python
train
27.076923
brunato/lograptor
lograptor/core.py
https://github.com/brunato/lograptor/blob/b1f09fe1b429ed15110610092704ef12d253f3c9/lograptor/core.py#L289-L302
def matcher(self): """ Matcher engine: ruled, unruled, unparsed. """ if self.args.matcher is None: return 'ruled' elif self.args.matcher.startswith('-'): matcher = self.args.matcher.strip('-').replace('-', '_') else: matcher = self.args...
[ "def", "matcher", "(", "self", ")", ":", "if", "self", ".", "args", ".", "matcher", "is", "None", ":", "return", "'ruled'", "elif", "self", ".", "args", ".", "matcher", ".", "startswith", "(", "'-'", ")", ":", "matcher", "=", "self", ".", "args", "...
Matcher engine: ruled, unruled, unparsed.
[ "Matcher", "engine", ":", "ruled", "unruled", "unparsed", "." ]
python
train
35.142857
tensorpack/tensorpack
tensorpack/utils/viz.py
https://github.com/tensorpack/tensorpack/blob/d7a13cb74c9066bc791d7aafc3b744b60ee79a9f/tensorpack/utils/viz.py#L206-L262
def gen_stack_patches(patch_list, nr_row=None, nr_col=None, border=None, max_width=1000, max_height=1000, bgcolor=255, viz=False, lclick_cb=None): """ Similar to :func:`stack_patches` but with a generator interface. It takes a much-longer lis...
[ "def", "gen_stack_patches", "(", "patch_list", ",", "nr_row", "=", "None", ",", "nr_col", "=", "None", ",", "border", "=", "None", ",", "max_width", "=", "1000", ",", "max_height", "=", "1000", ",", "bgcolor", "=", "255", ",", "viz", "=", "False", ",",...
Similar to :func:`stack_patches` but with a generator interface. It takes a much-longer list and yields stacked results one by one. For example, if ``patch_list`` contains 1000 images and ``nr_row==nr_col==10``, this generator yields 10 stacked images. Args: nr_row(int), nr_col(int): rows and c...
[ "Similar", "to", ":", "func", ":", "stack_patches", "but", "with", "a", "generator", "interface", ".", "It", "takes", "a", "much", "-", "longer", "list", "and", "yields", "stacked", "results", "one", "by", "one", ".", "For", "example", "if", "patch_list", ...
python
train
34.421053
saltstack/salt
salt/modules/boto_kms.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_kms.py#L131-L153
def create_key(policy=None, description=None, key_usage=None, region=None, key=None, keyid=None, profile=None): ''' Creates a master key. CLI example:: salt myminion boto_kms.create_key '{"Statement":...}' "My master key" ''' conn = _get_conn(region=region, key=key, keyid=ke...
[ "def", "create_key", "(", "policy", "=", "None", ",", "description", "=", "None", ",", "key_usage", "=", "None", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "conn", "=", "_g...
Creates a master key. CLI example:: salt myminion boto_kms.create_key '{"Statement":...}' "My master key"
[ "Creates", "a", "master", "key", "." ]
python
train
30.565217
autokey/autokey
lib/autokey/iomediator/_iomediator.py
https://github.com/autokey/autokey/blob/35decb72f286ce68cd2a1f09ace8891a520b58d1/lib/autokey/iomediator/_iomediator.py#L218-L223
def send_backspace(self, count): """ Sends the given number of backspace key presses. """ for i in range(count): self.interface.send_key(Key.BACKSPACE)
[ "def", "send_backspace", "(", "self", ",", "count", ")", ":", "for", "i", "in", "range", "(", "count", ")", ":", "self", ".", "interface", ".", "send_key", "(", "Key", ".", "BACKSPACE", ")" ]
Sends the given number of backspace key presses.
[ "Sends", "the", "given", "number", "of", "backspace", "key", "presses", "." ]
python
train
31.666667
BD2KGenomics/protect
src/protect/alignment/common.py
https://github.com/BD2KGenomics/protect/blob/06310682c50dcf8917b912c8e551299ff7ee41ce/src/protect/alignment/common.py#L33-L74
def index_bamfile(job, bamfile, sample_type, univ_options, samtools_options, sample_info=None, export=True): """ Index `bamfile` using samtools :param toil.fileStore.FileID bamfile: fsID for the bam file :param str sample_type: Description of the sample to inject into the filename ...
[ "def", "index_bamfile", "(", "job", ",", "bamfile", ",", "sample_type", ",", "univ_options", ",", "samtools_options", ",", "sample_info", "=", "None", ",", "export", "=", "True", ")", ":", "work_dir", "=", "os", ".", "getcwd", "(", ")", "in_bamfile", "=", ...
Index `bamfile` using samtools :param toil.fileStore.FileID bamfile: fsID for the bam file :param str sample_type: Description of the sample to inject into the filename :param dict univ_options: Dict of universal options used by almost all tools :param dict samtools_options: Options specific to samtool...
[ "Index", "bamfile", "using", "samtools" ]
python
train
50.666667
chaoss/grimoirelab-perceval
perceval/backends/core/pipermail.py
https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/pipermail.py#L240-L255
def mboxes(self): """Get the mboxes managed by this mailing list. Returns the archives sorted by date in ascending order. :returns: a list of `.MBoxArchive` objects """ archives = [] for mbox in super().mboxes: dt = self._parse_date_from_filepath(mbox.filep...
[ "def", "mboxes", "(", "self", ")", ":", "archives", "=", "[", "]", "for", "mbox", "in", "super", "(", ")", ".", "mboxes", ":", "dt", "=", "self", ".", "_parse_date_from_filepath", "(", "mbox", ".", "filepath", ")", "archives", ".", "append", "(", "("...
Get the mboxes managed by this mailing list. Returns the archives sorted by date in ascending order. :returns: a list of `.MBoxArchive` objects
[ "Get", "the", "mboxes", "managed", "by", "this", "mailing", "list", "." ]
python
test
27.0625
numenta/nupic
src/nupic/regions/record_sensor.py
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/record_sensor.py#L272-L301
def getNextRecord(self): """ Get the next record to encode. Includes getting a record from the `dataSource` and applying filters. If the filters request more data from the `dataSource` continue to get data from the `dataSource` until all filters are satisfied. This method is separate from :meth:`...
[ "def", "getNextRecord", "(", "self", ")", ":", "allFiltersHaveEnoughData", "=", "False", "while", "not", "allFiltersHaveEnoughData", ":", "# Get the data from the dataSource", "data", "=", "self", ".", "dataSource", ".", "getNextRecordDict", "(", ")", "if", "not", "...
Get the next record to encode. Includes getting a record from the `dataSource` and applying filters. If the filters request more data from the `dataSource` continue to get data from the `dataSource` until all filters are satisfied. This method is separate from :meth:`.RecordSensor.compute` so that we can...
[ "Get", "the", "next", "record", "to", "encode", ".", "Includes", "getting", "a", "record", "from", "the", "dataSource", "and", "applying", "filters", ".", "If", "the", "filters", "request", "more", "data", "from", "the", "dataSource", "continue", "to", "get"...
python
valid
32.633333
rhiever/datacleaner
datacleaner/datacleaner.py
https://github.com/rhiever/datacleaner/blob/f6f92d763ab385013b72776acf990857d4949e66/datacleaner/datacleaner.py#L100-L177
def autoclean_cv(training_dataframe, testing_dataframe, drop_nans=False, copy=False, encoder=None, encoder_kwargs=None, ignore_update_check=False): """Performs a series of automated data cleaning transformations on the provided training and testing data sets Unlike `autoclean()`, this function...
[ "def", "autoclean_cv", "(", "training_dataframe", ",", "testing_dataframe", ",", "drop_nans", "=", "False", ",", "copy", "=", "False", ",", "encoder", "=", "None", ",", "encoder_kwargs", "=", "None", ",", "ignore_update_check", "=", "False", ")", ":", "global"...
Performs a series of automated data cleaning transformations on the provided training and testing data sets Unlike `autoclean()`, this function takes cross-validation into account by learning the data transformations from only the training set, then applying those transformations to both the training and testi...
[ "Performs", "a", "series", "of", "automated", "data", "cleaning", "transformations", "on", "the", "provided", "training", "and", "testing", "data", "sets" ]
python
train
43.512821
clalancette/pycdlib
pycdlib/utils.py
https://github.com/clalancette/pycdlib/blob/1e7b77a809e905d67dc71e12d70e850be26b6233/pycdlib/utils.py#L93-L151
def copy_data(data_length, blocksize, infp, outfp): # type: (int, int, BinaryIO, BinaryIO) -> None ''' A utility function to copy data from the input file object to the output file object. This function will use the most efficient copy method available, which is often sendfile. Parameters: ...
[ "def", "copy_data", "(", "data_length", ",", "blocksize", ",", "infp", ",", "outfp", ")", ":", "# type: (int, int, BinaryIO, BinaryIO) -> None", "use_sendfile", "=", "False", "if", "have_sendfile", ":", "# Python 3 implements the fileno method for all file-like objects, so", ...
A utility function to copy data from the input file object to the output file object. This function will use the most efficient copy method available, which is often sendfile. Parameters: data_length - The amount of data to copy. blocksize - How much data to copy per iteration. infp - The f...
[ "A", "utility", "function", "to", "copy", "data", "from", "the", "input", "file", "object", "to", "the", "output", "file", "object", ".", "This", "function", "will", "use", "the", "most", "efficient", "copy", "method", "available", "which", "is", "often", ...
python
train
43.677966
foremast/foremast
src/foremast/utils/apps.py
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/utils/apps.py#L28-L44
def get_all_apps(): """Get a list of all applications in Spinnaker. Returns: requests.models.Response: Response from Gate containing list of all apps. """ LOG.info('Retreiving list of all Spinnaker applications') url = '{}/applications'.format(API_URL) response = requests.get(url, veri...
[ "def", "get_all_apps", "(", ")", ":", "LOG", ".", "info", "(", "'Retreiving list of all Spinnaker applications'", ")", "url", "=", "'{}/applications'", ".", "format", "(", "API_URL", ")", "response", "=", "requests", ".", "get", "(", "url", ",", "verify", "=",...
Get a list of all applications in Spinnaker. Returns: requests.models.Response: Response from Gate containing list of all apps.
[ "Get", "a", "list", "of", "all", "applications", "in", "Spinnaker", "." ]
python
train
30.176471
rene-aguirre/pywinusb
pywinusb/hid/core.py
https://github.com/rene-aguirre/pywinusb/blob/954c4b2105d9f01cb0c50e24500bb747d4ecdc43/pywinusb/hid/core.py#L168-L182
def get_devices_by_parent(self, hid_filter=None): """Group devices returned from filter query in order \ by devcice parent id. """ all_devs = self.get_devices(hid_filter) dev_group = dict() for hid_device in all_devs: #keep a list of known devices match...
[ "def", "get_devices_by_parent", "(", "self", ",", "hid_filter", "=", "None", ")", ":", "all_devs", "=", "self", ".", "get_devices", "(", "hid_filter", ")", "dev_group", "=", "dict", "(", ")", "for", "hid_device", "in", "all_devs", ":", "#keep a list of known d...
Group devices returned from filter query in order \ by devcice parent id.
[ "Group", "devices", "returned", "from", "filter", "query", "in", "order", "\\", "by", "devcice", "parent", "id", "." ]
python
train
42.2
asascience-open/paegan-transport
paegan/transport/utils/asasuncycles.py
https://github.com/asascience-open/paegan-transport/blob/99a7f4ea24f0f42d9b34d1fb0e87ab2c49315bd3/paegan/transport/utils/asasuncycles.py#L91-L177
def _calc(cls, **kwargs): """ Calculate sunrise or sunset based on: Parameters: jd: Julian Day lat: latitude lon: longitude stage: sunrise or sunset """ zenith = 90.833333 # offical value jd = kwargs.get("jd", None) ...
[ "def", "_calc", "(", "cls", ",", "*", "*", "kwargs", ")", ":", "zenith", "=", "90.833333", "# offical value", "jd", "=", "kwargs", ".", "get", "(", "\"jd\"", ",", "None", ")", "lat", "=", "kwargs", ".", "get", "(", "\"lat\"", ",", "None", ")", "lon...
Calculate sunrise or sunset based on: Parameters: jd: Julian Day lat: latitude lon: longitude stage: sunrise or sunset
[ "Calculate", "sunrise", "or", "sunset", "based", "on", ":", "Parameters", ":", "jd", ":", "Julian", "Day", "lat", ":", "latitude", "lon", ":", "longitude", "stage", ":", "sunrise", "or", "sunset" ]
python
train
35.356322
tanghaibao/jcvi
jcvi/assembly/postprocess.py
https://github.com/tanghaibao/jcvi/blob/d2e31a77b6ade7f41f3b321febc2b4744d1cdeca/jcvi/assembly/postprocess.py#L149-L174
def dust(args): """ %prog dust assembly.fasta Remove low-complexity contigs within assembly. """ p = OptionParser(dust.__doc__) opts, args = p.parse_args(args) if len(args) != 1: sys.exit(not p.print_help()) fastafile, = args dustfastafile = fastafile.rsplit(".", 1)[0] + "...
[ "def", "dust", "(", "args", ")", ":", "p", "=", "OptionParser", "(", "dust", ".", "__doc__", ")", "opts", ",", "args", "=", "p", ".", "parse_args", "(", "args", ")", "if", "len", "(", "args", ")", "!=", "1", ":", "sys", ".", "exit", "(", "not",...
%prog dust assembly.fasta Remove low-complexity contigs within assembly.
[ "%prog", "dust", "assembly", ".", "fasta" ]
python
train
28.576923
mpg-age-bioinformatics/AGEpy
AGEpy/kegg.py
https://github.com/mpg-age-bioinformatics/AGEpy/blob/887808a7a2c1504f39ce8d8cb36c15c1721cd29f/AGEpy/kegg.py#L194-L232
def biomaRtTOkegg(df): """ Transforms a pandas dataframe with the columns 'ensembl_gene_id','kegg_enzyme' to dataframe ready for use in ... :param df: a pandas dataframe with the following columns: 'ensembl_gene_id','kegg_enzyme' :returns: a pandas dataframe with the following columns: 'ensembl_ge...
[ "def", "biomaRtTOkegg", "(", "df", ")", ":", "df", "=", "df", ".", "dropna", "(", ")", "ECcols", "=", "df", ".", "columns", ".", "tolist", "(", ")", "df", ".", "reset_index", "(", "inplace", "=", "True", ",", "drop", "=", "True", ")", "# field = EC...
Transforms a pandas dataframe with the columns 'ensembl_gene_id','kegg_enzyme' to dataframe ready for use in ... :param df: a pandas dataframe with the following columns: 'ensembl_gene_id','kegg_enzyme' :returns: a pandas dataframe with the following columns: 'ensembl_gene_id','kegg_enzyme'
[ "Transforms", "a", "pandas", "dataframe", "with", "the", "columns", "ensembl_gene_id", "kegg_enzyme", "to", "dataframe", "ready", "for", "use", "in", "..." ]
python
train
37.666667
obilaniu/Nauka
src/nauka/exp/experiment.py
https://github.com/obilaniu/Nauka/blob/1492a4f9d204a868c1a8a1d327bd108490b856b4/src/nauka/exp/experiment.py#L136-L146
def snapshot (self): """Take a snapshot of the experiment. Returns `self`.""" nextSnapshotNum = self.nextSnapshotNum nextSnapshotPath = self.getFullPathToSnapshot(nextSnapshotNum) if os.path.lexists(nextSnapshotPath): self.rmR(nextSnapshotPath) self.mkdirp(os.path.join(nextSnapshotPath...
[ "def", "snapshot", "(", "self", ")", ":", "nextSnapshotNum", "=", "self", ".", "nextSnapshotNum", "nextSnapshotPath", "=", "self", ".", "getFullPathToSnapshot", "(", "nextSnapshotNum", ")", "if", "os", ".", "path", ".", "lexists", "(", "nextSnapshotPath", ")", ...
Take a snapshot of the experiment. Returns `self`.
[ "Take", "a", "snapshot", "of", "the", "experiment", ".", "Returns", "self", "." ]
python
train
35.818182
saltstack/salt
salt/cloud/clouds/ec2.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L2555-L2931
def create(vm_=None, call=None): ''' Create a single VM from a data dict ''' if call: raise SaltCloudSystemExit( 'You cannot create an instance with -a or -f.' ) try: # Check for required profile parameters before sending any API calls. if vm_['profile'] ...
[ "def", "create", "(", "vm_", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", ":", "raise", "SaltCloudSystemExit", "(", "'You cannot create an instance with -a or -f.'", ")", "try", ":", "# Check for required profile parameters before sending any API calls."...
Create a single VM from a data dict
[ "Create", "a", "single", "VM", "from", "a", "data", "dict" ]
python
train
34.209549
divio/cmsplugin-filer
cmsplugin_filer_utils/migration.py
https://github.com/divio/cmsplugin-filer/blob/4f9b0307dd768852ead64e651b743a165b3efccb/cmsplugin_filer_utils/migration.py#L4-L18
def rename_tables(db, table_mapping, reverse=False): """ renames tables from source to destination name, if the source exists and the destination does not exist yet. """ from django.db import connection if reverse: table_mapping = [(dst, src) for src, dst in table_mapping] table_name...
[ "def", "rename_tables", "(", "db", ",", "table_mapping", ",", "reverse", "=", "False", ")", ":", "from", "django", ".", "db", "import", "connection", "if", "reverse", ":", "table_mapping", "=", "[", "(", "dst", ",", "src", ")", "for", "src", ",", "dst"...
renames tables from source to destination name, if the source exists and the destination does not exist yet.
[ "renames", "tables", "from", "source", "to", "destination", "name", "if", "the", "source", "exists", "and", "the", "destination", "does", "not", "exist", "yet", "." ]
python
train
51.933333
apache/airflow
airflow/_vendor/nvd3/NVD3Chart.py
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/_vendor/nvd3/NVD3Chart.py#L419-L448
def create_x_axis(self, name, label=None, format=None, date=False, custom_format=False): """Create X-axis""" axis = {} if custom_format and format: axis['tickFormat'] = format elif format: if format == 'AM_PM': axis['tickFormat'] = "function(d) { r...
[ "def", "create_x_axis", "(", "self", ",", "name", ",", "label", "=", "None", ",", "format", "=", "None", ",", "date", "=", "False", ",", "custom_format", "=", "False", ")", ":", "axis", "=", "{", "}", "if", "custom_format", "and", "format", ":", "axi...
Create X-axis
[ "Create", "X", "-", "axis" ]
python
test
37.7
danilobellini/audiolazy
audiolazy/lazy_stream.py
https://github.com/danilobellini/audiolazy/blob/dba0a278937909980ed40b976d866b8e97c35dee/audiolazy/lazy_stream.py#L569-L626
def thub(data, n): """ Tee or "T" hub auto-copier to help working with Stream instances as well as with numbers. Parameters ---------- data : Input to be copied. Can be anything. n : Number of copies. Returns ------- A StreamTeeHub instance, if input data is iterable. The data itself, ot...
[ "def", "thub", "(", "data", ",", "n", ")", ":", "return", "StreamTeeHub", "(", "data", ",", "n", ")", "if", "isinstance", "(", "data", ",", "Iterable", ")", "else", "data" ]
Tee or "T" hub auto-copier to help working with Stream instances as well as with numbers. Parameters ---------- data : Input to be copied. Can be anything. n : Number of copies. Returns ------- A StreamTeeHub instance, if input data is iterable. The data itself, otherwise. Examples ----...
[ "Tee", "or", "T", "hub", "auto", "-", "copier", "to", "help", "working", "with", "Stream", "instances", "as", "well", "as", "with", "numbers", "." ]
python
train
23.241379
linkedin/pyexchange
pyexchange/base/calendar.py
https://github.com/linkedin/pyexchange/blob/d568f4edd326adb451b915ddf66cf1a37820e3ca/pyexchange/base/calendar.py#L273-L283
def add_resources(self, resources): """ Adds new resources to the event. *resources* can be a list of email addresses or :class:`ExchangeEventAttendee` objects. """ new_resources = self._build_resource_dictionary(resources) for key in new_resources: self._resources[key] = new_resources[k...
[ "def", "add_resources", "(", "self", ",", "resources", ")", ":", "new_resources", "=", "self", ".", "_build_resource_dictionary", "(", "resources", ")", "for", "key", "in", "new_resources", ":", "self", ".", "_resources", "[", "key", "]", "=", "new_resources",...
Adds new resources to the event. *resources* can be a list of email addresses or :class:`ExchangeEventAttendee` objects.
[ "Adds", "new", "resources", "to", "the", "event", "." ]
python
train
32.545455
qacafe/cdrouter.py
cdrouter/jobs.py
https://github.com/qacafe/cdrouter.py/blob/aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5/cdrouter/jobs.py#L153-L165
def edit(self, resource): """Edit a job. :param resource: :class:`jobs.Job <jobs.Job>` object :return: :class:`jobs.Job <jobs.Job>` object :rtype: jobs.Job """ schema = JobSchema(exclude=('id', 'status', 'options', 'package_name', 'config_name', 'device_name', 'result_id...
[ "def", "edit", "(", "self", ",", "resource", ")", ":", "schema", "=", "JobSchema", "(", "exclude", "=", "(", "'id'", ",", "'status'", ",", "'options'", ",", "'package_name'", ",", "'config_name'", ",", "'device_name'", ",", "'result_id'", ",", "'user_id'", ...
Edit a job. :param resource: :class:`jobs.Job <jobs.Job>` object :return: :class:`jobs.Job <jobs.Job>` object :rtype: jobs.Job
[ "Edit", "a", "job", "." ]
python
train
43.384615
Clarify/clarify_python
clarify_python/helper.py
https://github.com/Clarify/clarify_python/blob/1a00a5e39f77af9ad7f2e08480a3ab14e7d72aeb/clarify_python/helper.py#L91-L115
def get_embedded_items(result_collection): """ Given a result_collection (returned by a previous API call that returns a collection, like get_bundle_list() or search()), return a list of embedded items with each item in the returned list considered a result object. 'result_collection' a JSON ob...
[ "def", "get_embedded_items", "(", "result_collection", ")", ":", "# Argument error checking.", "assert", "result_collection", "is", "not", "None", "result", "=", "[", "]", "embedded_objects", "=", "result_collection", ".", "get", "(", "'_embedded'", ")", "if", "embe...
Given a result_collection (returned by a previous API call that returns a collection, like get_bundle_list() or search()), return a list of embedded items with each item in the returned list considered a result object. 'result_collection' a JSON object returned by a previous API call. The parameter...
[ "Given", "a", "result_collection", "(", "returned", "by", "a", "previous", "API", "call", "that", "returns", "a", "collection", "like", "get_bundle_list", "()", "or", "search", "()", ")", "return", "a", "list", "of", "embedded", "items", "with", "each", "ite...
python
train
34.32
googleapis/google-cloud-python
logging/google/cloud/logging/_gapic.py
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/_gapic.py#L518-L534
def _item_to_metric(iterator, log_metric_pb): """Convert a metric protobuf to the native object. :type iterator: :class:`~google.api_core.page_iterator.Iterator` :param iterator: The iterator that is currently in use. :type log_metric_pb: :class:`.logging_metrics_pb2.LogMetric` :param log_...
[ "def", "_item_to_metric", "(", "iterator", ",", "log_metric_pb", ")", ":", "# NOTE: LogMetric message type does not have an ``Any`` field", "# so `MessageToDict`` can safely be used.", "resource", "=", "MessageToDict", "(", "log_metric_pb", ")", "return", "Metric", ".", "...
Convert a metric protobuf to the native object. :type iterator: :class:`~google.api_core.page_iterator.Iterator` :param iterator: The iterator that is currently in use. :type log_metric_pb: :class:`.logging_metrics_pb2.LogMetric` :param log_metric_pb: Metric protobuf returned from the API. ...
[ "Convert", "a", "metric", "protobuf", "to", "the", "native", "object", "." ]
python
train
40.176471
horejsek/python-webdriverwrapper
webdriverwrapper/wrapper.py
https://github.com/horejsek/python-webdriverwrapper/blob/a492f79ab60ed83d860dd817b6a0961500d7e3f5/webdriverwrapper/wrapper.py#L495-L514
def switch_to_window(self, window_name=None, title=None, url=None): """ WebDriver implements switching to other window only by it's name. With wrapper there is also option to switch by title of window or URL. URL can be also relative path. """ if window_name: ...
[ "def", "switch_to_window", "(", "self", ",", "window_name", "=", "None", ",", "title", "=", "None", ",", "url", "=", "None", ")", ":", "if", "window_name", ":", "self", ".", "switch_to", ".", "window", "(", "window_name", ")", "return", "if", "url", ":...
WebDriver implements switching to other window only by it's name. With wrapper there is also option to switch by title of window or URL. URL can be also relative path.
[ "WebDriver", "implements", "switching", "to", "other", "window", "only", "by", "it", "s", "name", ".", "With", "wrapper", "there", "is", "also", "option", "to", "switch", "by", "title", "of", "window", "or", "URL", ".", "URL", "can", "be", "also", "relat...
python
train
37.8
wal-e/wal-e
wal_e/worker/pg/wal_transfer.py
https://github.com/wal-e/wal-e/blob/027263860e72a403bc0e1497bb3e67523138e7a2/wal_e/worker/pg/wal_transfer.py#L164-L192
def _complete_execution(self, g): """Forward any raised exceptions across a channel.""" # Triggered via completion callback. # # Runs in its own greenlet, so take care to forward the # exception, if any, to fail the entire transfer in event of # trouble. assert g...
[ "def", "_complete_execution", "(", "self", ",", "g", ")", ":", "# Triggered via completion callback.", "#", "# Runs in its own greenlet, so take care to forward the", "# exception, if any, to fail the entire transfer in event of", "# trouble.", "assert", "g", ".", "ready", "(", "...
Forward any raised exceptions across a channel.
[ "Forward", "any", "raised", "exceptions", "across", "a", "channel", "." ]
python
train
30.275862
tensorflow/tensor2tensor
tensor2tensor/data_generators/multi_problem_v2.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/multi_problem_v2.py#L139-L181
def normalize_example(self, example, hparams): """Assumes that example contains both inputs and targets.""" length = self.max_length(hparams) def _to_constant_shape(tensor): tensor = tensor[:length] tensor = tf.pad(tensor, [(0, length - tf.shape(tensor)[0])]) return tf.reshape(tensor, [le...
[ "def", "normalize_example", "(", "self", ",", "example", ",", "hparams", ")", ":", "length", "=", "self", ".", "max_length", "(", "hparams", ")", "def", "_to_constant_shape", "(", "tensor", ")", ":", "tensor", "=", "tensor", "[", ":", "length", "]", "ten...
Assumes that example contains both inputs and targets.
[ "Assumes", "that", "example", "contains", "both", "inputs", "and", "targets", "." ]
python
train
43.744186
pyQode/pyqode.core
pyqode/core/modes/checker.py
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/modes/checker.py#L274-L284
def clear_messages(self): """ Clears all messages. """ while len(self._messages): msg = self._messages.pop(0) usd = msg.block.userData() if usd and hasattr(usd, 'messages'): usd.messages[:] = [] if msg.decoration: ...
[ "def", "clear_messages", "(", "self", ")", ":", "while", "len", "(", "self", ".", "_messages", ")", ":", "msg", "=", "self", ".", "_messages", ".", "pop", "(", "0", ")", "usd", "=", "msg", ".", "block", ".", "userData", "(", ")", "if", "usd", "an...
Clears all messages.
[ "Clears", "all", "messages", "." ]
python
train
32.909091
obriencj/python-javatools
javatools/distdiff.py
https://github.com/obriencj/python-javatools/blob/9e2332b452ddc508bed0615937dddcb2cf051557/javatools/distdiff.py#L620-L640
def create_optparser(progname=None): """ an OptionParser instance filled with options and groups appropriate for use with the distdiff command """ from . import report parser = ArgumentParser(prog=progname) parser.add_argument("dist", nargs=2, help="distributions to ...
[ "def", "create_optparser", "(", "progname", "=", "None", ")", ":", "from", ".", "import", "report", "parser", "=", "ArgumentParser", "(", "prog", "=", "progname", ")", "parser", ".", "add_argument", "(", "\"dist\"", ",", "nargs", "=", "2", ",", "help", "...
an OptionParser instance filled with options and groups appropriate for use with the distdiff command
[ "an", "OptionParser", "instance", "filled", "with", "options", "and", "groups", "appropriate", "for", "use", "with", "the", "distdiff", "command" ]
python
train
28.571429
Capitains/flask-capitains-nemo
flask_nemo/chunker.py
https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/chunker.py#L78-L110
def level_grouper(text, getreffs, level=None, groupby=20): """ Alternative to level_chunker: groups levels together at the latest level :param text: Text object :param getreffs: GetValidReff query callback :param level: Level of citation to retrieve :param groupby: Number of level to groupby :r...
[ "def", "level_grouper", "(", "text", ",", "getreffs", ",", "level", "=", "None", ",", "groupby", "=", "20", ")", ":", "if", "level", "is", "None", "or", "level", ">", "len", "(", "text", ".", "citation", ")", ":", "level", "=", "len", "(", "text", ...
Alternative to level_chunker: groups levels together at the latest level :param text: Text object :param getreffs: GetValidReff query callback :param level: Level of citation to retrieve :param groupby: Number of level to groupby :return: Automatically curated references
[ "Alternative", "to", "level_chunker", ":", "groups", "levels", "together", "at", "the", "latest", "level" ]
python
valid
29.545455
katerina7479/pypdflite
pypdflite/pdflite.py
https://github.com/katerina7479/pypdflite/blob/ac2501f30d6619eae9dea5644717575ca9263d0a/pypdflite/pdflite.py#L122-L146
def _put_pages(self): """ First, the Document object does the heavy-lifting for the individual page objects and content. Then, the overall "Pages" object is generated. """ self.document._get_orientation_changes() self.document._output_pages() ...
[ "def", "_put_pages", "(", "self", ")", ":", "self", ".", "document", ".", "_get_orientation_changes", "(", ")", "self", ".", "document", ".", "_output_pages", "(", ")", "# Pages Object, provides reference to page objects (Kids list).\r", "self", ".", "session", ".", ...
First, the Document object does the heavy-lifting for the individual page objects and content. Then, the overall "Pages" object is generated.
[ "First", "the", "Document", "object", "does", "the", "heavy", "-", "lifting", "for", "the", "individual", "page", "objects", "and", "content", ".", "Then", "the", "overall", "Pages", "object", "is", "generated", "." ]
python
test
38.44
the01/python-paps
paps/si/sensorClientAdapter.py
https://github.com/the01/python-paps/blob/2dde5a71913e4c7b22901cf05c6ecedd890919c4/paps/si/sensorClientAdapter.py#L48-L70
def on_person_new(self, people): """ Add new people All people supported need to be added simultaneously, since on every call a unjoin() followed by a join() is issued :param people: People to add :type people: list[paps.people.People] :rtype: None :rais...
[ "def", "on_person_new", "(", "self", ",", "people", ")", ":", "try", ":", "self", ".", "on_person_leave", "(", "[", "]", ")", "except", ":", "# Already caught and logged", "pass", "try", ":", "self", ".", "sensor_client", ".", "join", "(", "people", ")", ...
Add new people All people supported need to be added simultaneously, since on every call a unjoin() followed by a join() is issued :param people: People to add :type people: list[paps.people.People] :rtype: None :raises Exception: On error (for now just an exception)
[ "Add", "new", "people" ]
python
train
28.956522
espressif/esptool
ecdsa/ecdsa.py
https://github.com/espressif/esptool/blob/c583756c118039cfcfe256f7a3285618914d16a5/ecdsa/ecdsa.py#L127-L151
def sign( self, hash, random_k ): """Return a signature for the provided hash, using the provided random nonce. It is absolutely vital that random_k be an unpredictable number in the range [1, self.public_key.point.order()-1]. If an attacker can guess random_k, he can compute our private key from a ...
[ "def", "sign", "(", "self", ",", "hash", ",", "random_k", ")", ":", "G", "=", "self", ".", "public_key", ".", "generator", "n", "=", "G", ".", "order", "(", ")", "k", "=", "random_k", "%", "n", "p1", "=", "k", "*", "G", "r", "=", "p1", ".", ...
Return a signature for the provided hash, using the provided random nonce. It is absolutely vital that random_k be an unpredictable number in the range [1, self.public_key.point.order()-1]. If an attacker can guess random_k, he can compute our private key from a single signature. Also, if an attacker...
[ "Return", "a", "signature", "for", "the", "provided", "hash", "using", "the", "provided", "random", "nonce", ".", "It", "is", "absolutely", "vital", "that", "random_k", "be", "an", "unpredictable", "number", "in", "the", "range", "[", "1", "self", ".", "pu...
python
train
43.32
fabioz/PyDev.Debugger
third_party/pep8/lib2to3/lib2to3/pytree.py
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/third_party/pep8/lib2to3/lib2to3/pytree.py#L767-L794
def _iterative_matches(self, nodes): """Helper to iteratively yield the matches.""" nodelen = len(nodes) if 0 >= self.min: yield 0, {} results = [] # generate matches that use just one alt from self.content for alt in self.content: for c, r in gen...
[ "def", "_iterative_matches", "(", "self", ",", "nodes", ")", ":", "nodelen", "=", "len", "(", "nodes", ")", "if", "0", ">=", "self", ".", "min", ":", "yield", "0", ",", "{", "}", "results", "=", "[", "]", "# generate matches that use just one alt from self...
Helper to iteratively yield the matches.
[ "Helper", "to", "iteratively", "yield", "the", "matches", "." ]
python
train
38.392857
jorbas/GADDAG
gaddag/node.py
https://github.com/jorbas/GADDAG/blob/a0ede3def715c586e1f273d96e9fc0d537cd9561/gaddag/node.py#L75-L83
def letter_set(self): """ Return the letter set of this node. """ end_str = ctypes.create_string_buffer(MAX_CHARS) cgaddag.gdg_letter_set(self.gdg, self.node, end_str) return [char for char in end_str.value.decode("ascii")]
[ "def", "letter_set", "(", "self", ")", ":", "end_str", "=", "ctypes", ".", "create_string_buffer", "(", "MAX_CHARS", ")", "cgaddag", ".", "gdg_letter_set", "(", "self", ".", "gdg", ",", "self", ".", "node", ",", "end_str", ")", "return", "[", "char", "fo...
Return the letter set of this node.
[ "Return", "the", "letter", "set", "of", "this", "node", "." ]
python
train
29.444444
gouthambs/Flask-Blogging
flask_blogging/sqlastorage.py
https://github.com/gouthambs/Flask-Blogging/blob/6636b8941175e9910f116a329521f96b8b05a9ac/flask_blogging/sqlastorage.py#L268-L334
def get_posts(self, count=10, offset=0, recent=True, tag=None, user_id=None, include_draft=False): """ Get posts given by filter criteria :param count: The number of posts to retrieve (default 10) :type count: int :param offset: The number of posts to offset (d...
[ "def", "get_posts", "(", "self", ",", "count", "=", "10", ",", "offset", "=", "0", ",", "recent", "=", "True", ",", "tag", "=", "None", ",", "user_id", "=", "None", ",", "include_draft", "=", "False", ")", ":", "user_id", "=", "str", "(", "user_id"...
Get posts given by filter criteria :param count: The number of posts to retrieve (default 10) :type count: int :param offset: The number of posts to offset (default 0) :type offset: int :param recent: Order by recent posts or not :type recent: bool :param tag: Fi...
[ "Get", "posts", "given", "by", "filter", "criteria" ]
python
train
41.179104
tisimst/mcerp
mcerp/__init__.py
https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/__init__.py#L783-L796
def Burr(c, k, tag=None): """ A Burr random variate Parameters ---------- c : scalar The first shape parameter k : scalar The second shape parameter """ assert c > 0 and k > 0, 'Burr "c" and "k" parameters must be greater than zero' return uv(ss.burr(c, k), ...
[ "def", "Burr", "(", "c", ",", "k", ",", "tag", "=", "None", ")", ":", "assert", "c", ">", "0", "and", "k", ">", "0", ",", "'Burr \"c\" and \"k\" parameters must be greater than zero'", "return", "uv", "(", "ss", ".", "burr", "(", "c", ",", "k", ")", ...
A Burr random variate Parameters ---------- c : scalar The first shape parameter k : scalar The second shape parameter
[ "A", "Burr", "random", "variate", "Parameters", "----------", "c", ":", "scalar", "The", "first", "shape", "parameter", "k", ":", "scalar", "The", "second", "shape", "parameter" ]
python
train
22.5
FutunnOpen/futuquant
futuquant/quote/open_quote_context.py
https://github.com/FutunnOpen/futuquant/blob/1512b321845f92ec9c578ce2689aa4e8482669e4/futuquant/quote/open_quote_context.py#L99-L138
def get_trading_days(self, market, start=None, end=None): """获取交易日 :param market: 市场类型,Market_ :param start: 起始日期。例如'2018-01-01'。 :param end: 结束日期。例如'2018-01-01'。 start和end的组合如下: ========== ========== ======================================== start类型 ...
[ "def", "get_trading_days", "(", "self", ",", "market", ",", "start", "=", "None", ",", "end", "=", "None", ")", ":", "if", "market", "is", "None", "or", "is_str", "(", "market", ")", "is", "False", ":", "error_str", "=", "ERROR_STR_PREFIX", "+", "\"the...
获取交易日 :param market: 市场类型,Market_ :param start: 起始日期。例如'2018-01-01'。 :param end: 结束日期。例如'2018-01-01'。 start和end的组合如下: ========== ========== ======================================== start类型 end类型 说明 ========== ========== =================...
[ "获取交易日", ":", "param", "market", ":", "市场类型,Market_", ":", "param", "start", ":", "起始日期。例如", "2018", "-", "01", "-", "01", "。", ":", "param", "end", ":", "结束日期。例如", "2018", "-", "01", "-", "01", "。", "start和end的组合如下:", "==========", "==========", "======...
python
train
40.525
nschloe/meshplex
meshplex/mesh_tetra.py
https://github.com/nschloe/meshplex/blob/376cfe8ce7b9917e5398c5d60c87455ff5590913/meshplex/mesh_tetra.py#L504-L579
def show_edge(self, edge_id): """Displays edge with ce_ratio. :param edge_id: Edge ID for which to show the ce_ratio. :type edge_id: int """ # pylint: disable=unused-variable,relative-import from mpl_toolkits.mplot3d import Axes3D from matplotlib import pyplot as...
[ "def", "show_edge", "(", "self", ",", "edge_id", ")", ":", "# pylint: disable=unused-variable,relative-import", "from", "mpl_toolkits", ".", "mplot3d", "import", "Axes3D", "from", "matplotlib", "import", "pyplot", "as", "plt", "if", "\"faces\"", "not", "in", "self",...
Displays edge with ce_ratio. :param edge_id: Edge ID for which to show the ce_ratio. :type edge_id: int
[ "Displays", "edge", "with", "ce_ratio", "." ]
python
train
35.657895
bitesofcode/projexui
projexui/widgets/xlistwidget.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xlistwidget.py#L87-L106
def setMovie(self, movie): """ Sets the movie that will play for the given column. :param movie | <QtGui.QMovie> || None """ mov = self.movie() if mov is not None: mov.frameChanged.disconnect(self._updateFrame) if movi...
[ "def", "setMovie", "(", "self", ",", "movie", ")", ":", "mov", "=", "self", ".", "movie", "(", ")", "if", "mov", "is", "not", "None", ":", "mov", ".", "frameChanged", ".", "disconnect", "(", "self", ".", "_updateFrame", ")", "if", "movie", "is", "n...
Sets the movie that will play for the given column. :param movie | <QtGui.QMovie> || None
[ "Sets", "the", "movie", "that", "will", "play", "for", "the", "given", "column", ".", ":", "param", "movie", "|", "<QtGui", ".", "QMovie", ">", "||", "None" ]
python
train
31.8
fastai/fastai
fastai/callbacks/tensorboard.py
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/callbacks/tensorboard.py#L340-L343
def _write_min_gradient(self)->None: "Writes the minimum of the gradients to Tensorboard." min_gradient = min(x.data.min() for x in self.gradients) self._add_gradient_scalar('min_gradient', scalar_value=min_gradient)
[ "def", "_write_min_gradient", "(", "self", ")", "->", "None", ":", "min_gradient", "=", "min", "(", "x", ".", "data", ".", "min", "(", ")", "for", "x", "in", "self", ".", "gradients", ")", "self", ".", "_add_gradient_scalar", "(", "'min_gradient'", ",", ...
Writes the minimum of the gradients to Tensorboard.
[ "Writes", "the", "minimum", "of", "the", "gradients", "to", "Tensorboard", "." ]
python
train
59.25
samfoo/vt102
vt102/__init__.py
https://github.com/samfoo/vt102/blob/ff5be883bc9a880a422b09bb87b210d7c408cf2c/vt102/__init__.py#L820-L834
def _text_attr(self, attr): """ Given a text attribute, set the current cursor appropriately. """ attr = text[attr] if attr == "reset": self.cursor_attributes = self.default_attributes elif attr == "underline-off": self.cursor_attributes = self._re...
[ "def", "_text_attr", "(", "self", ",", "attr", ")", ":", "attr", "=", "text", "[", "attr", "]", "if", "attr", "==", "\"reset\"", ":", "self", ".", "cursor_attributes", "=", "self", ".", "default_attributes", "elif", "attr", "==", "\"underline-off\"", ":", ...
Given a text attribute, set the current cursor appropriately.
[ "Given", "a", "text", "attribute", "set", "the", "current", "cursor", "appropriately", "." ]
python
train
41.333333
Fantomas42/django-blog-zinnia
zinnia/ping.py
https://github.com/Fantomas42/django-blog-zinnia/blob/b4949304b104a8e1a7a7a0773cbfd024313c3a15/zinnia/ping.py#L139-L149
def find_pingback_href(self, content): """ Try to find LINK markups to pingback URL. """ soup = BeautifulSoup(content, 'html.parser') for link in soup.find_all('link'): dict_attr = dict(link.attrs) if 'rel' in dict_attr and 'href' in dict_attr: ...
[ "def", "find_pingback_href", "(", "self", ",", "content", ")", ":", "soup", "=", "BeautifulSoup", "(", "content", ",", "'html.parser'", ")", "for", "link", "in", "soup", ".", "find_all", "(", "'link'", ")", ":", "dict_attr", "=", "dict", "(", "link", "."...
Try to find LINK markups to pingback URL.
[ "Try", "to", "find", "LINK", "markups", "to", "pingback", "URL", "." ]
python
train
41.272727
objectrocket/python-client
scripts/check_docs.py
https://github.com/objectrocket/python-client/blob/a65868c7511ff49a5fbe304e53bf592b7fc6d5ef/scripts/check_docs.py#L89-L97
def build_pyfile_path_from_docname(self, docfile): """Build the expected Python file name based on the given documentation file name. :param str docfile: The documentation file name from which to build the Python file name. :rtype: str """ name, ext = os.path.splitext(docfile) ...
[ "def", "build_pyfile_path_from_docname", "(", "self", ",", "docfile", ")", ":", "name", ",", "ext", "=", "os", ".", "path", ".", "splitext", "(", "docfile", ")", "expected_py_name", "=", "name", ".", "replace", "(", "'.'", ",", "'/'", ")", "+", "'.py'", ...
Build the expected Python file name based on the given documentation file name. :param str docfile: The documentation file name from which to build the Python file name. :rtype: str
[ "Build", "the", "expected", "Python", "file", "name", "based", "on", "the", "given", "documentation", "file", "name", "." ]
python
train
44.444444
kevinconway/confpy
confpy/parser.py
https://github.com/kevinconway/confpy/blob/1ee8afcab46ac6915a5ff4184180434ac7b84a60/confpy/parser.py#L199-L231
def parse_options(files, env_prefix='CONFPY', strict=True): """Parse configuration options and return a configuration object. Args: files (iter of str): File paths which identify configuration files. These files are processed in order with values in later files overwriting value...
[ "def", "parse_options", "(", "files", ",", "env_prefix", "=", "'CONFPY'", ",", "strict", "=", "True", ")", ":", "return", "check_for_missing_options", "(", "config", "=", "set_cli_options", "(", "config", "=", "set_environment_var_options", "(", "config", "=", "...
Parse configuration options and return a configuration object. Args: files (iter of str): File paths which identify configuration files. These files are processed in order with values in later files overwriting values in earlier files. env_prefix (str): The static prefix pre...
[ "Parse", "configuration", "options", "and", "return", "a", "configuration", "object", "." ]
python
train
40.090909
NaPs/Kolekto
kolekto/commands/list.py
https://github.com/NaPs/Kolekto/blob/29c5469da8782780a06bf9a76c59414bb6fd8fe3/kolekto/commands/list.py#L45-L58
def _config(self, args, config): """ Get configuration for the current used listing. """ listings = dict((x.args, x) for x in config.subsections('listing')) listing = listings.get(args.listing) if listing is None: if args.listing == u'default': return ...
[ "def", "_config", "(", "self", ",", "args", ",", "config", ")", ":", "listings", "=", "dict", "(", "(", "x", ".", "args", ",", "x", ")", "for", "x", "in", "config", ".", "subsections", "(", "'listing'", ")", ")", "listing", "=", "listings", ".", ...
Get configuration for the current used listing.
[ "Get", "configuration", "for", "the", "current", "used", "listing", "." ]
python
train
45.571429
tritemio/PyBroMo
pybromo/diffusion.py
https://github.com/tritemio/PyBroMo/blob/b75f82a4551ff37e7c7a7e6954c536451f3e6d06/pybromo/diffusion.py#L283-L301
def _get_group_randomstate(rs, seed, group): """Return a RandomState, equal to the input unless rs is None. When rs is None, try to get the random state from the 'last_random_state' attribute in `group`. When not available, use `seed` to generate a random state. When seed is None the re...
[ "def", "_get_group_randomstate", "(", "rs", ",", "seed", ",", "group", ")", ":", "if", "rs", "is", "None", ":", "rs", "=", "np", ".", "random", ".", "RandomState", "(", "seed", "=", "seed", ")", "# Try to set the random state from the last session to preserve", ...
Return a RandomState, equal to the input unless rs is None. When rs is None, try to get the random state from the 'last_random_state' attribute in `group`. When not available, use `seed` to generate a random state. When seed is None the returned random state will have a random seed.
[ "Return", "a", "RandomState", "equal", "to", "the", "input", "unless", "rs", "is", "None", "." ]
python
valid
49.684211
mlperf/training
image_classification/tensorflow/official/resnet/imagenet_preprocessing.py
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/image_classification/tensorflow/official/resnet/imagenet_preprocessing.py#L254-L291
def preprocess_image(image_buffer, output_height, output_width, num_channels, is_training=False): """Preprocesses the given image. Preprocessing includes decoding, cropping, and resizing for both training and eval images. Training preprocessing, however, introduces some random distortion o...
[ "def", "preprocess_image", "(", "image_buffer", ",", "output_height", ",", "output_width", ",", "num_channels", ",", "is_training", "=", "False", ")", ":", "if", "is_training", ":", "# For training, we want to randomize some of the distortions.", "image", "=", "_decode_cr...
Preprocesses the given image. Preprocessing includes decoding, cropping, and resizing for both training and eval images. Training preprocessing, however, introduces some random distortion of the image to improve accuracy. Args: image_buffer: scalar string Tensor representing the raw JPEG image buffer. ...
[ "Preprocesses", "the", "given", "image", "." ]
python
train
42.131579
PyCQA/pydocstyle
src/pydocstyle/violations.py
https://github.com/PyCQA/pydocstyle/blob/2549847f9efad225789f931e83dfe782418ca13e/src/pydocstyle/violations.py#L62-L80
def lines(self) -> str: """Return the source code lines for this error.""" if self.definition is None: return '' source = '' lines = self.definition.source offset = self.definition.start # type: ignore lines_stripped = list(reversed(list(dropwhile(is_blank, ...
[ "def", "lines", "(", "self", ")", "->", "str", ":", "if", "self", ".", "definition", "is", "None", ":", "return", "''", "source", "=", "''", "lines", "=", "self", ".", "definition", ".", "source", "offset", "=", "self", ".", "definition", ".", "start...
Return the source code lines for this error.
[ "Return", "the", "source", "code", "lines", "for", "this", "error", "." ]
python
train
40.421053
Knoema/knoema-python-driver
knoema/api_client.py
https://github.com/Knoema/knoema-python-driver/blob/e98b13db3e4df51c208c272e2977bfbe4c6e5532/knoema/api_client.py#L98-L102
def get_dataset(self, datasetid): """The method is getting information about dataset byt it's id""" path = '/api/1.0/meta/dataset/{}' return self._api_get(definition.Dataset, path.format(datasetid))
[ "def", "get_dataset", "(", "self", ",", "datasetid", ")", ":", "path", "=", "'/api/1.0/meta/dataset/{}'", "return", "self", ".", "_api_get", "(", "definition", ".", "Dataset", ",", "path", ".", "format", "(", "datasetid", ")", ")" ]
The method is getting information about dataset byt it's id
[ "The", "method", "is", "getting", "information", "about", "dataset", "byt", "it", "s", "id" ]
python
train
44.6
yyuu/botornado
boto/ec2/snapshot.py
https://github.com/yyuu/botornado/blob/fffb056f5ff2324d1d5c1304014cfb1d899f602e/boto/ec2/snapshot.py#L71-L87
def update(self, validate=False): """ Update the data associated with this snapshot by querying EC2. :type validate: bool :param validate: By default, if EC2 returns no data about the snapshot the update method returns quietly. If the v...
[ "def", "update", "(", "self", ",", "validate", "=", "False", ")", ":", "rs", "=", "self", ".", "connection", ".", "get_all_snapshots", "(", "[", "self", ".", "id", "]", ")", "if", "len", "(", "rs", ")", ">", "0", ":", "self", ".", "_update", "(",...
Update the data associated with this snapshot by querying EC2. :type validate: bool :param validate: By default, if EC2 returns no data about the snapshot the update method returns quietly. If the validate param is True, however, it will ...
[ "Update", "the", "data", "associated", "with", "this", "snapshot", "by", "querying", "EC2", "." ]
python
train
41.470588
google/grr
grr/server/grr_response_server/queue_manager.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/queue_manager.py#L608-L621
def FetchResponses(self, session_id): """Retrieves responses for a well known flow. Args: session_id: The session_id to get the requests/responses for. Yields: The retrieved responses. """ timestamp = (0, self.frozen_timestamp or rdfvalue.RDFDatetime.Now()) for response in self.da...
[ "def", "FetchResponses", "(", "self", ",", "session_id", ")", ":", "timestamp", "=", "(", "0", ",", "self", ".", "frozen_timestamp", "or", "rdfvalue", ".", "RDFDatetime", ".", "Now", "(", ")", ")", "for", "response", "in", "self", ".", "data_store", ".",...
Retrieves responses for a well known flow. Args: session_id: The session_id to get the requests/responses for. Yields: The retrieved responses.
[ "Retrieves", "responses", "for", "a", "well", "known", "flow", "." ]
python
train
30.785714
stlehmann/pyads
pyads/pyads_ex.py
https://github.com/stlehmann/pyads/blob/44bd84394db2785332ac44b2948373916bea0f02/pyads/pyads_ex.py#L166-L181
def adsPortOpenEx(): # type: () -> int """Connect to the TwinCAT message router. :rtype: int :return: port number """ port_open_ex = _adsDLL.AdsPortOpenEx port_open_ex.restype = ctypes.c_long port = port_open_ex() if port == 0: raise RuntimeError("Failed to open port on AM...
[ "def", "adsPortOpenEx", "(", ")", ":", "# type: () -> int", "port_open_ex", "=", "_adsDLL", ".", "AdsPortOpenEx", "port_open_ex", ".", "restype", "=", "ctypes", ".", "c_long", "port", "=", "port_open_ex", "(", ")", "if", "port", "==", "0", ":", "raise", "Run...
Connect to the TwinCAT message router. :rtype: int :return: port number
[ "Connect", "to", "the", "TwinCAT", "message", "router", "." ]
python
valid
20.8125
mapbox/mapboxgl-jupyter
mapboxgl/utils.py
https://github.com/mapbox/mapboxgl-jupyter/blob/f6e403c13eaa910e70659c7d179e8e32ce95ae34/mapboxgl/utils.py#L117-L135
def convert_date_columns(df, date_format='epoch'): """Convert dates/datetimes to preferred string format if specified i.e. '%Y-%m-%d', 'epoch', 'iso' """ if date_format not in ['epoch', 'iso']: if '%' in date_format: try: datetime.datetime.now().strftime(date_for...
[ "def", "convert_date_columns", "(", "df", ",", "date_format", "=", "'epoch'", ")", ":", "if", "date_format", "not", "in", "[", "'epoch'", ",", "'iso'", "]", ":", "if", "'%'", "in", "date_format", ":", "try", ":", "datetime", ".", "datetime", ".", "now", ...
Convert dates/datetimes to preferred string format if specified i.e. '%Y-%m-%d', 'epoch', 'iso'
[ "Convert", "dates", "/", "datetimes", "to", "preferred", "string", "format", "if", "specified", "i", ".", "e", ".", "%Y", "-", "%m", "-", "%d", "epoch", "iso" ]
python
train
42.210526
ocaballeror/LyricFetch
lyricfetch/stats.py
https://github.com/ocaballeror/LyricFetch/blob/86e62fb39c4c413ad7e1acf5bf0d28c9ed7c8fcb/lyricfetch/stats.py#L132-L175
def print_stats(self): """ Print a series of relevant stats about a full execution. This function is meant to be called at the end of the program. """ stats = self.calculate() total_time = '%d:%02d:%02d' % (stats['total_time'] / 3600, ...
[ "def", "print_stats", "(", "self", ")", ":", "stats", "=", "self", ".", "calculate", "(", ")", "total_time", "=", "'%d:%02d:%02d'", "%", "(", "stats", "[", "'total_time'", "]", "/", "3600", ",", "(", "stats", "[", "'total_time'", "]", "/", "3600", ")",...
Print a series of relevant stats about a full execution. This function is meant to be called at the end of the program.
[ "Print", "a", "series", "of", "relevant", "stats", "about", "a", "full", "execution", ".", "This", "function", "is", "meant", "to", "be", "called", "at", "the", "end", "of", "the", "program", "." ]
python
train
46.590909
okpy/ok-client
client/sources/common/interpreter.py
https://github.com/okpy/ok-client/blob/517f57dd76284af40ba9766e42d9222b644afd9c/client/sources/common/interpreter.py#L158-L170
def load(self, code, setup='', teardown=''): """Prepares a set of setup, test, and teardown code to be run in the console. PARAMETERS: code -- list; processed lines of code. Elements in the list are either strings (input) or CodeAnswer objects (output) se...
[ "def", "load", "(", "self", ",", "code", ",", "setup", "=", "''", ",", "teardown", "=", "''", ")", ":", "self", ".", "_setup", "=", "textwrap", ".", "dedent", "(", "setup", ")", ".", "splitlines", "(", ")", "self", ".", "_code", "=", "code", "sel...
Prepares a set of setup, test, and teardown code to be run in the console. PARAMETERS: code -- list; processed lines of code. Elements in the list are either strings (input) or CodeAnswer objects (output) setup -- str; raw setup code teardown -- str; r...
[ "Prepares", "a", "set", "of", "setup", "test", "and", "teardown", "code", "to", "be", "run", "in", "the", "console", "." ]
python
train
41.538462
xiyouMc/ncmbot
ncmbot/core.py
https://github.com/xiyouMc/ncmbot/blob/c4832f3ee7630ba104a89559f09c1fc366d1547b/ncmbot/core.py#L248-L261
def user_play_list(uid, offset=0, limit=1000): """获取用户歌单,包含收藏的歌单 :param uid: 用户的ID,可通过登录或者其他接口获取 :param offset: (optional) 分段起始位置,默认 0 :param limit: (optional) 数据上限多少行,默认 1000 """ if uid is None: raise ParamsError() r = NCloudBot() r.method = 'USER_PLAY_LIST' r.data = {'...
[ "def", "user_play_list", "(", "uid", ",", "offset", "=", "0", ",", "limit", "=", "1000", ")", ":", "if", "uid", "is", "None", ":", "raise", "ParamsError", "(", ")", "r", "=", "NCloudBot", "(", ")", "r", ".", "method", "=", "'USER_PLAY_LIST'", "r", ...
获取用户歌单,包含收藏的歌单 :param uid: 用户的ID,可通过登录或者其他接口获取 :param offset: (optional) 分段起始位置,默认 0 :param limit: (optional) 数据上限多少行,默认 1000
[ "获取用户歌单,包含收藏的歌单", ":", "param", "uid", ":", "用户的ID,可通过登录或者其他接口获取", ":", "param", "offset", ":", "(", "optional", ")", "分段起始位置,默认", "0", ":", "param", "limit", ":", "(", "optional", ")", "数据上限多少行,默认", "1000" ]
python
train
28.857143
beathan/django-akamai
django_akamai/purge.py
https://github.com/beathan/django-akamai/blob/00cab2dd5fab3745742721185e75a55a5c26fe7e/django_akamai/purge.py#L149-L167
def add(self, urls): """ Add the provided urls to this purge request The urls argument can be a single string, a list of strings, a queryset or model instance. Models must implement `get_absolute_url()`. """ if isinstance(urls, (list, tuple)): self.urls.exte...
[ "def", "add", "(", "self", ",", "urls", ")", ":", "if", "isinstance", "(", "urls", ",", "(", "list", ",", "tuple", ")", ")", ":", "self", ".", "urls", ".", "extend", "(", "urls", ")", "elif", "isinstance", "(", "urls", ",", "basestring", ")", ":"...
Add the provided urls to this purge request The urls argument can be a single string, a list of strings, a queryset or model instance. Models must implement `get_absolute_url()`.
[ "Add", "the", "provided", "urls", "to", "this", "purge", "request" ]
python
train
36.684211
uw-it-aca/uw-restclients-canvas
uw_canvas/reports.py
https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/reports.py#L166-L176
def delete_report(self, report): """ Deletes a generated report instance. https://canvas.instructure.com/doc/api/account_reports.html#method.account_reports.destroy """ url = ACCOUNTS_API.format(report.account_id) + "/reports/{}/{}".format( report.type, report.report...
[ "def", "delete_report", "(", "self", ",", "report", ")", ":", "url", "=", "ACCOUNTS_API", ".", "format", "(", "report", ".", "account_id", ")", "+", "\"/reports/{}/{}\"", ".", "format", "(", "report", ".", "type", ",", "report", ".", "report_id", ")", "r...
Deletes a generated report instance. https://canvas.instructure.com/doc/api/account_reports.html#method.account_reports.destroy
[ "Deletes", "a", "generated", "report", "instance", "." ]
python
test
34.636364
inveniosoftware/invenio-oauthclient
invenio_oauthclient/contrib/cern.py
https://github.com/inveniosoftware/invenio-oauthclient/blob/2500dc6935738107617aeade79e050d7608004bb/invenio_oauthclient/contrib/cern.py#L330-L347
def disconnect_handler(remote, *args, **kwargs): """Handle unlinking of remote account.""" if not current_user.is_authenticated: return current_app.login_manager.unauthorized() account = RemoteAccount.get(user_id=current_user.get_id(), client_id=remote.consumer_key) ...
[ "def", "disconnect_handler", "(", "remote", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "current_user", ".", "is_authenticated", ":", "return", "current_app", ".", "login_manager", ".", "unauthorized", "(", ")", "account", "=", "RemoteA...
Handle unlinking of remote account.
[ "Handle", "unlinking", "of", "remote", "account", "." ]
python
train
35.5
google/grr
grr/server/grr_response_server/aff4.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/aff4.py#L363-L409
def _UpdateChildIndex(self, urn, mutation_pool): """Update the child indexes. This function maintains the index for direct child relations. When we set an AFF4 path, we always add an attribute like index:dir/%(childname)s to its parent. This is written asynchronously to its parent. In order to...
[ "def", "_UpdateChildIndex", "(", "self", ",", "urn", ",", "mutation_pool", ")", ":", "try", ":", "# Create navigation aids by touching intermediate subject names.", "while", "urn", ".", "Path", "(", ")", "!=", "\"/\"", ":", "basename", "=", "urn", ".", "Basename",...
Update the child indexes. This function maintains the index for direct child relations. When we set an AFF4 path, we always add an attribute like index:dir/%(childname)s to its parent. This is written asynchronously to its parent. In order to query for all direct children of an AFF4 object, we the...
[ "Update", "the", "child", "indexes", "." ]
python
train
34.468085
aiogram/aiogram
aiogram/dispatcher/handler.py
https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/dispatcher/handler.py#L85-L133
async def notify(self, *args): """ Notify handlers :param args: :return: """ from .filters import check_filters, FilterNotPassed results = [] data = {} ctx_data.set(data) if self.middleware_key: try: await se...
[ "async", "def", "notify", "(", "self", ",", "*", "args", ")", ":", "from", ".", "filters", "import", "check_filters", ",", "FilterNotPassed", "results", "=", "[", "]", "data", "=", "{", "}", "ctx_data", ".", "set", "(", "data", ")", "if", "self", "."...
Notify handlers :param args: :return:
[ "Notify", "handlers" ]
python
train
36.571429
Bystroushaak/BalancedDiscStorage
src/BalancedDiscStorage/balanced_disc_storage.py
https://github.com/Bystroushaak/BalancedDiscStorage/blob/d96854e2afdd70c814b16d177ff6308841b34b24/src/BalancedDiscStorage/balanced_disc_storage.py#L100-L151
def _create_dir_path(self, file_hash, path=None, hash_list=None): """ Create proper filesystem paths for given `file_hash`. Args: file_hash (str): Hash of the file for which the path should be created. path (str, default None): Recursion argument, d...
[ "def", "_create_dir_path", "(", "self", ",", "file_hash", ",", "path", "=", "None", ",", "hash_list", "=", "None", ")", ":", "# first, non-recursive call - parse `file_hash`", "if", "hash_list", "is", "None", ":", "hash_list", "=", "list", "(", "file_hash", ")",...
Create proper filesystem paths for given `file_hash`. Args: file_hash (str): Hash of the file for which the path should be created. path (str, default None): Recursion argument, don't set this. hash_list (list, default None): Recursion argument, don't s...
[ "Create", "proper", "filesystem", "paths", "for", "given", "file_hash", "." ]
python
train
30.596154
openstack/networking-cisco
networking_cisco/apps/saf/agent/vdp/lldpad.py
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/agent/vdp/lldpad.py#L302-L320
def gen_cisco_vdp_oui(self, oui_id, oui_data): """Cisco specific handler for constructing OUI arguments. """ oui_list = [] vm_name = oui_data.get('vm_name') if vm_name is not None: oui_str = "oui=%s," % oui_id oui_name_str = oui_str + "vm_name=" + vm_name ...
[ "def", "gen_cisco_vdp_oui", "(", "self", ",", "oui_id", ",", "oui_data", ")", ":", "oui_list", "=", "[", "]", "vm_name", "=", "oui_data", ".", "get", "(", "'vm_name'", ")", "if", "vm_name", "is", "not", "None", ":", "oui_str", "=", "\"oui=%s,\"", "%", ...
Cisco specific handler for constructing OUI arguments.
[ "Cisco", "specific", "handler", "for", "constructing", "OUI", "arguments", "." ]
python
train
41.421053
twilio/twilio-python
twilio/rest/api/v2010/account/sip/ip_access_control_list/__init__.py
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/api/v2010/account/sip/ip_access_control_list/__init__.py#L141-L150
def get(self, sid): """ Constructs a IpAccessControlListContext :param sid: A string that identifies the resource to fetch :returns: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListContext :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_l...
[ "def", "get", "(", "self", ",", "sid", ")", ":", "return", "IpAccessControlListContext", "(", "self", ".", "_version", ",", "account_sid", "=", "self", ".", "_solution", "[", "'account_sid'", "]", ",", "sid", "=", "sid", ",", ")" ]
Constructs a IpAccessControlListContext :param sid: A string that identifies the resource to fetch :returns: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListContext :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListContext
[ "Constructs", "a", "IpAccessControlListContext" ]
python
train
46.4
Shizmob/pydle
pydle/features/ircv3/cap.py
https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/ircv3/cap.py#L179-L185
async def on_raw_410(self, message): """ Unknown CAP subcommand or CAP error. Force-end negotiations. """ self.logger.error('Server sent "Unknown CAP subcommand: %s". Aborting capability negotiation.', message.params[0]) self._capabilities_requested = set() self._capabilities_negotiatin...
[ "async", "def", "on_raw_410", "(", "self", ",", "message", ")", ":", "self", ".", "logger", ".", "error", "(", "'Server sent \"Unknown CAP subcommand: %s\". Aborting capability negotiation.'", ",", "message", ".", "params", "[", "0", "]", ")", "self", ".", "_capab...
Unknown CAP subcommand or CAP error. Force-end negotiations.
[ "Unknown", "CAP", "subcommand", "or", "CAP", "error", ".", "Force", "-", "end", "negotiations", "." ]
python
train
51.857143
erikdejonge/arguments
fallbackdocopt/__init__.py
https://github.com/erikdejonge/arguments/blob/fc222d3989d459343a81944cabb56854014335ed/fallbackdocopt/__init__.py#L494-L581
def docopt(doc, argv=None, help=True, version=None, options_first=False): """Parse `argv` based on command-line interface described in `doc`. `docopt` creates your command-line interface based on its description that you pass as `doc`. Such description can contain --options, <positional-argument>, comm...
[ "def", "docopt", "(", "doc", ",", "argv", "=", "None", ",", "help", "=", "True", ",", "version", "=", "None", ",", "options_first", "=", "False", ")", ":", "if", "argv", "is", "None", ":", "argv", "=", "sys", ".", "argv", "[", "1", ":", "]", "D...
Parse `argv` based on command-line interface described in `doc`. `docopt` creates your command-line interface based on its description that you pass as `doc`. Such description can contain --options, <positional-argument>, commands, which could be [optional], (required), (mutually | exclusive) or repeat...
[ "Parse", "argv", "based", "on", "command", "-", "line", "interface", "described", "in", "doc", "." ]
python
train
34.875
jaraco/jaraco.itertools
jaraco/itertools.py
https://github.com/jaraco/jaraco.itertools/blob/0dc47c8924fa3d9ab676c3a6e195f03f728b72c6/jaraco/itertools.py#L931-L952
def suppress_exceptions(callables, *exceptions): """ Call each callable in callables, suppressing any exceptions supplied. If no exception classes are supplied, all Exceptions will be suppressed. >>> import functools >>> c1 = functools.partial(int, 'a') >>> c2 = functools.partial(int, '10') >>> list(suppress_ex...
[ "def", "suppress_exceptions", "(", "callables", ",", "*", "exceptions", ")", ":", "if", "not", "exceptions", ":", "exceptions", "=", "Exception", ",", "for", "callable", "in", "callables", ":", "try", ":", "yield", "callable", "(", ")", "except", "exceptions...
Call each callable in callables, suppressing any exceptions supplied. If no exception classes are supplied, all Exceptions will be suppressed. >>> import functools >>> c1 = functools.partial(int, 'a') >>> c2 = functools.partial(int, '10') >>> list(suppress_exceptions((c1, c2))) [10] >>> list(suppress_exceptions...
[ "Call", "each", "callable", "in", "callables", "suppressing", "any", "exceptions", "supplied", ".", "If", "no", "exception", "classes", "are", "supplied", "all", "Exceptions", "will", "be", "suppressed", "." ]
python
test
27.636364
TUT-ARG/sed_eval
sed_eval/util/event_roll.py
https://github.com/TUT-ARG/sed_eval/blob/0cb1b6d11ceec4fe500cc9b31079c9d8666ed6eb/sed_eval/util/event_roll.py#L74-L96
def pad_event_roll(event_roll, length): """Pad event roll's length to given length Parameters ---------- event_roll: np.ndarray, shape=(m,k) Event roll length : int Length to be padded Returns ------- event_roll: np.ndarray, shape=(m,k) Padded event roll "...
[ "def", "pad_event_roll", "(", "event_roll", ",", "length", ")", ":", "if", "length", ">", "event_roll", ".", "shape", "[", "0", "]", ":", "padding", "=", "numpy", ".", "zeros", "(", "(", "length", "-", "event_roll", ".", "shape", "[", "0", "]", ",", ...
Pad event roll's length to given length Parameters ---------- event_roll: np.ndarray, shape=(m,k) Event roll length : int Length to be padded Returns ------- event_roll: np.ndarray, shape=(m,k) Padded event roll
[ "Pad", "event", "roll", "s", "length", "to", "given", "length" ]
python
train
21.695652
Telefonica/toolium
toolium/driver_wrapper.py
https://github.com/Telefonica/toolium/blob/56847c243b3a98876df74c184b75e43f8810e475/toolium/driver_wrapper.py#L148-L175
def update_visual_baseline(self): """Configure baseline directory after driver is created""" # Update baseline with real platformVersion value if '{PlatformVersion}' in self.baseline_name: try: platform_version = self.driver.desired_capabilities['platformVersion'] ...
[ "def", "update_visual_baseline", "(", "self", ")", ":", "# Update baseline with real platformVersion value", "if", "'{PlatformVersion}'", "in", "self", ".", "baseline_name", ":", "try", ":", "platform_version", "=", "self", ".", "driver", ".", "desired_capabilities", "[...
Configure baseline directory after driver is created
[ "Configure", "baseline", "directory", "after", "driver", "is", "created" ]
python
train
57.642857
urbn/Caesium
caesium/handler.py
https://github.com/urbn/Caesium/blob/2a14fe79724c38fe9a1b20f7b8f518f8c6d50df1/caesium/handler.py#L153-L165
def json_obj_to_cursor(self, json): """(Deprecated) Converts a JSON object to a mongo db cursor :param str json: A json string :returns: dictionary with ObjectId type :rtype: dict """ cursor = json_util.loads(json) if "id" in json: cursor["_id"] = Obj...
[ "def", "json_obj_to_cursor", "(", "self", ",", "json", ")", ":", "cursor", "=", "json_util", ".", "loads", "(", "json", ")", "if", "\"id\"", "in", "json", ":", "cursor", "[", "\"_id\"", "]", "=", "ObjectId", "(", "cursor", "[", "\"id\"", "]", ")", "d...
(Deprecated) Converts a JSON object to a mongo db cursor :param str json: A json string :returns: dictionary with ObjectId type :rtype: dict
[ "(", "Deprecated", ")", "Converts", "a", "JSON", "object", "to", "a", "mongo", "db", "cursor" ]
python
train
29.153846
jmoiron/gaspar
gaspar/consumers.py
https://github.com/jmoiron/gaspar/blob/cc9d7403a4d86382b10a7e96c6d0a020cc5e1b12/gaspar/consumers.py#L29-L42
def start(self): """Start the consumer. This starts a listen loop on a zmq.PULL socket, calling ``self.handle`` on each incoming request and pushing the response on a zmq.PUSH socket back to the producer.""" if not self.initialized: raise Exception("Consumer not initialized ...
[ "def", "start", "(", "self", ")", ":", "if", "not", "self", ".", "initialized", ":", "raise", "Exception", "(", "\"Consumer not initialized (no Producer).\"", ")", "producer", "=", "self", ".", "producer", "context", "=", "zmq", ".", "_Context", "(", ")", "s...
Start the consumer. This starts a listen loop on a zmq.PULL socket, calling ``self.handle`` on each incoming request and pushing the response on a zmq.PUSH socket back to the producer.
[ "Start", "the", "consumer", ".", "This", "starts", "a", "listen", "loop", "on", "a", "zmq", ".", "PULL", "socket", "calling", "self", ".", "handle", "on", "each", "incoming", "request", "and", "pushing", "the", "response", "on", "a", "zmq", ".", "PUSH", ...
python
train
52.285714
briancappello/flask-unchained
flask_unchained/bundles/api/model_resource.py
https://github.com/briancappello/flask-unchained/blob/4d536cb90e2cc4829c1c05f2c74d3e22901a1399/flask_unchained/bundles/api/model_resource.py#L336-L346
def put(self, instance, errors): """ Update a model instance. :param instance: The model instance. :param errors: Any errors. :return: The updated model instance, or a dictionary of errors. """ if errors: return self.errors(errors) return self...
[ "def", "put", "(", "self", ",", "instance", ",", "errors", ")", ":", "if", "errors", ":", "return", "self", ".", "errors", "(", "errors", ")", "return", "self", ".", "updated", "(", "instance", ")" ]
Update a model instance. :param instance: The model instance. :param errors: Any errors. :return: The updated model instance, or a dictionary of errors.
[ "Update", "a", "model", "instance", "." ]
python
train
29.818182
Azure/azure-cli-extensions
src/alias/azext_alias/util.py
https://github.com/Azure/azure-cli-extensions/blob/3d4854205b0f0d882f688cfa12383d14506c2e35/src/alias/azext_alias/util.py#L47-L65
def is_alias_command(subcommands, args): """ Check if the user is invoking one of the comments in 'subcommands' in the from az alias . Args: subcommands: The list of subcommands to check through. args: The CLI arguments to process. Returns: True if the user is invoking 'az ali...
[ "def", "is_alias_command", "(", "subcommands", ",", "args", ")", ":", "if", "not", "args", ":", "return", "False", "for", "subcommand", "in", "subcommands", ":", "if", "args", "[", ":", "2", "]", "==", "[", "'alias'", ",", "subcommand", "]", ":", "retu...
Check if the user is invoking one of the comments in 'subcommands' in the from az alias . Args: subcommands: The list of subcommands to check through. args: The CLI arguments to process. Returns: True if the user is invoking 'az alias {command}'.
[ "Check", "if", "the", "user", "is", "invoking", "one", "of", "the", "comments", "in", "subcommands", "in", "the", "from", "az", "alias", "." ]
python
train
25.578947
bitesofcode/projexui
projexui/widgets/xviewwidget/xviewwidget.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xviewwidget/xviewwidget.py#L215-L241
def importProfile(self, filename=''): """ Exports the current profile to a file. :param filename | <str> """ if not (filename and isinstance(filename, basestring)): filename = QtGui.QFileDialog.getOpenFileName(self, ...
[ "def", "importProfile", "(", "self", ",", "filename", "=", "''", ")", ":", "if", "not", "(", "filename", "and", "isinstance", "(", "filename", ",", "basestring", ")", ")", ":", "filename", "=", "QtGui", ".", "QFileDialog", ".", "getOpenFileName", "(", "s...
Exports the current profile to a file. :param filename | <str>
[ "Exports", "the", "current", "profile", "to", "a", "file", ".", ":", "param", "filename", "|", "<str", ">" ]
python
train
34.259259
nchopin/particles
particles/smc_samplers.py
https://github.com/nchopin/particles/blob/3faa97a1073db45c5889eef3e015dd76ef350b52/particles/smc_samplers.py#L272-L289
def copyto_at(self, n, src, m): """Copy to at a given location. Parameters ---------- n: int index where to copy src: `ThetaParticles` object source m: int index of the element to be copied Note ---- Basical...
[ "def", "copyto_at", "(", "self", ",", "n", ",", "src", ",", "m", ")", ":", "for", "k", "in", "self", ".", "containers", ":", "self", ".", "__dict__", "[", "k", "]", "[", "n", "]", "=", "src", ".", "__dict__", "[", "k", "]", "[", "m", "]" ]
Copy to at a given location. Parameters ---------- n: int index where to copy src: `ThetaParticles` object source m: int index of the element to be copied Note ---- Basically, does self[n] <- src[m]
[ "Copy", "to", "at", "a", "given", "location", "." ]
python
train
23.777778
AkihikoITOH/capybara
capybara/virtualenv/lib/python2.7/site-packages/flask/helpers.py
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/helpers.py#L319-L339
def get_template_attribute(template_name, attribute): """Loads a macro (or variable) a template exports. This can be used to invoke a macro from within Python code. If you for example have a template named `_cider.html` with the following contents: .. sourcecode:: html+jinja {% macro hello(na...
[ "def", "get_template_attribute", "(", "template_name", ",", "attribute", ")", ":", "return", "getattr", "(", "current_app", ".", "jinja_env", ".", "get_template", "(", "template_name", ")", ".", "module", ",", "attribute", ")" ]
Loads a macro (or variable) a template exports. This can be used to invoke a macro from within Python code. If you for example have a template named `_cider.html` with the following contents: .. sourcecode:: html+jinja {% macro hello(name) %}Hello {{ name }}!{% endmacro %} You can access thi...
[ "Loads", "a", "macro", "(", "or", "variable", ")", "a", "template", "exports", ".", "This", "can", "be", "used", "to", "invoke", "a", "macro", "from", "within", "Python", "code", ".", "If", "you", "for", "example", "have", "a", "template", "named", "_c...
python
test
35.47619
pypa/pipenv
pipenv/vendor/pyparsing.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L5146-L5186
def originalTextFor(expr, asString=True): """Helper to return the original, untokenized text for a given expression. Useful to restore the parsed fields of an HTML start tag into the raw tag text itself, or to revert separate tokens with intervening whitespace back to the original matching input text. ...
[ "def", "originalTextFor", "(", "expr", ",", "asString", "=", "True", ")", ":", "locMarker", "=", "Empty", "(", ")", ".", "setParseAction", "(", "lambda", "s", ",", "loc", ",", "t", ":", "loc", ")", "endlocMarker", "=", "locMarker", ".", "copy", "(", ...
Helper to return the original, untokenized text for a given expression. Useful to restore the parsed fields of an HTML start tag into the raw tag text itself, or to revert separate tokens with intervening whitespace back to the original matching input text. By default, returns astring containing the or...
[ "Helper", "to", "return", "the", "original", "untokenized", "text", "for", "a", "given", "expression", ".", "Useful", "to", "restore", "the", "parsed", "fields", "of", "an", "HTML", "start", "tag", "into", "the", "raw", "tag", "text", "itself", "or", "to",...
python
train
41.829268
not-na/peng3d
peng3d/util/__init__.py
https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/util/__init__.py#L243-L257
def normalizeName(self,in_name): """ Takes in an object and normalizes it to its name/string. Currently, only integers and strings may be passed in, else a :py:exc:`TypeError` will be thrown. """ if isinstance(in_name,str): assert in_name in self._dat...
[ "def", "normalizeName", "(", "self", ",", "in_name", ")", ":", "if", "isinstance", "(", "in_name", ",", "str", ")", ":", "assert", "in_name", "in", "self", ".", "_data", "[", "\"reg\"", "]", ".", "inv", "return", "in_name", "elif", "isinstance", "(", "...
Takes in an object and normalizes it to its name/string. Currently, only integers and strings may be passed in, else a :py:exc:`TypeError` will be thrown.
[ "Takes", "in", "an", "object", "and", "normalizes", "it", "to", "its", "name", "/", "string", ".", "Currently", "only", "integers", "and", "strings", "may", "be", "passed", "in", "else", "a", ":", "py", ":", "exc", ":", "TypeError", "will", "be", "thro...
python
test
37.666667
saltstack/salt
salt/modules/win_dns_client.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dns_client.py#L30-L54
def get_dns_servers(interface='Local Area Connection'): ''' Return a list of the configured DNS servers of the specified interface CLI Example: .. code-block:: bash salt '*' win_dns_client.get_dns_servers 'Local Area Connection' ''' # remove any escape characters interface = inter...
[ "def", "get_dns_servers", "(", "interface", "=", "'Local Area Connection'", ")", ":", "# remove any escape characters", "interface", "=", "interface", ".", "split", "(", "'\\\\'", ")", "interface", "=", "''", ".", "join", "(", "interface", ")", "with", "salt", "...
Return a list of the configured DNS servers of the specified interface CLI Example: .. code-block:: bash salt '*' win_dns_client.get_dns_servers 'Local Area Connection'
[ "Return", "a", "list", "of", "the", "configured", "DNS", "servers", "of", "the", "specified", "interface" ]
python
train
33.24
Alignak-monitoring/alignak
alignak/util.py
https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/util.py#L999-L1016
def filter_host_by_tag(tpl): """Filter for host Filter on tag :param tpl: tag to filter :type tpl: str :return: Filter :rtype: bool """ def inner_filter(items): """Inner filter for host. Accept if tag in host.tags""" host = items["host"] if host is None: ...
[ "def", "filter_host_by_tag", "(", "tpl", ")", ":", "def", "inner_filter", "(", "items", ")", ":", "\"\"\"Inner filter for host. Accept if tag in host.tags\"\"\"", "host", "=", "items", "[", "\"host\"", "]", "if", "host", "is", "None", ":", "return", "False", "retu...
Filter for host Filter on tag :param tpl: tag to filter :type tpl: str :return: Filter :rtype: bool
[ "Filter", "for", "host", "Filter", "on", "tag" ]
python
train
22.111111
ibis-project/ibis
ibis/expr/api.py
https://github.com/ibis-project/ibis/blob/1e39a5fd9ef088b45c155e8a5f541767ee8ef2e7/ibis/expr/api.py#L1625-L1639
def geo_length(arg, use_spheroid=None): """ Compute length of a geo spatial data Parameters ---------- arg : geometry or geography use_spheroid : default None Returns ------- length : double scalar """ op = ops.GeoLength(arg, use_spheroid) return op.to_expr()
[ "def", "geo_length", "(", "arg", ",", "use_spheroid", "=", "None", ")", ":", "op", "=", "ops", ".", "GeoLength", "(", "arg", ",", "use_spheroid", ")", "return", "op", ".", "to_expr", "(", ")" ]
Compute length of a geo spatial data Parameters ---------- arg : geometry or geography use_spheroid : default None Returns ------- length : double scalar
[ "Compute", "length", "of", "a", "geo", "spatial", "data" ]
python
train
19.666667
Azure/blobxfer
blobxfer/operations/upload.py
https://github.com/Azure/blobxfer/blob/3eccbe7530cc6a20ab2d30f9e034b6f021817f34/blobxfer/operations/upload.py#L330-L339
def _wait_for_disk_threads(self, terminate): # type: (Uploader, bool) -> None """Wait for disk threads :param Uploader self: this :param bool terminate: terminate threads """ if terminate: self._upload_terminate = terminate for thr in self._disk_thread...
[ "def", "_wait_for_disk_threads", "(", "self", ",", "terminate", ")", ":", "# type: (Uploader, bool) -> None", "if", "terminate", ":", "self", ".", "_upload_terminate", "=", "terminate", "for", "thr", "in", "self", ".", "_disk_threads", ":", "thr", ".", "join", "...
Wait for disk threads :param Uploader self: this :param bool terminate: terminate threads
[ "Wait", "for", "disk", "threads", ":", "param", "Uploader", "self", ":", "this", ":", "param", "bool", "terminate", ":", "terminate", "threads" ]
python
train
33.6
saltstack/salt
salt/modules/lxd.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxd.py#L2542-L2600
def image_get(fingerprint, remote_addr=None, cert=None, key=None, verify_cert=True, _raw=False): ''' Get an image by its fingerprint fingerprint : The fingerprint of the image to retrieve remote_addr : An...
[ "def", "image_get", "(", "fingerprint", ",", "remote_addr", "=", "None", ",", "cert", "=", "None", ",", "key", "=", "None", ",", "verify_cert", "=", "True", ",", "_raw", "=", "False", ")", ":", "client", "=", "pylxd_client_get", "(", "remote_addr", ",", ...
Get an image by its fingerprint fingerprint : The fingerprint of the image to retrieve remote_addr : An URL to a remote Server, you also have to give cert and key if you provide remote_addr and its a TCP Address! Examples: https://myserv...
[ "Get", "an", "image", "by", "its", "fingerprint" ]
python
train
25.491525
lingthio/Flask-User
flask_user/user_manager__views.py
https://github.com/lingthio/Flask-User/blob/a379fa0a281789618c484b459cb41236779b95b1/flask_user/user_manager__views.py#L215-L254
def email_action_view(self, id, action): """ Perform action 'action' on UserEmail object 'id' """ # Retrieve UserEmail by id user_email = self.db_manager.get_user_email_by_id(id=id) # Users may only change their own UserEmails if not user_email or user_email.user_id != ...
[ "def", "email_action_view", "(", "self", ",", "id", ",", "action", ")", ":", "# Retrieve UserEmail by id", "user_email", "=", "self", ".", "db_manager", ".", "get_user_email_by_id", "(", "id", "=", "id", ")", "# Users may only change their own UserEmails", "if", "no...
Perform action 'action' on UserEmail object 'id'
[ "Perform", "action", "action", "on", "UserEmail", "object", "id" ]
python
train
37.325
Damgaard/PyImgur
pyimgur/__init__.py
https://github.com/Damgaard/PyImgur/blob/606f17078d24158632f807430f8d0b9b3cd8b312/pyimgur/__init__.py#L220-L229
def refresh(self): """ Refresh this objects attributes to the newest values. Attributes that weren't added to the object before, due to lazy loading, will be added by calling refresh. """ resp = self._imgur._send_request(self._INFO_URL) self._populate(resp) ...
[ "def", "refresh", "(", "self", ")", ":", "resp", "=", "self", ".", "_imgur", ".", "_send_request", "(", "self", ".", "_INFO_URL", ")", "self", ".", "_populate", "(", "resp", ")", "self", ".", "_has_fetched", "=", "True" ]
Refresh this objects attributes to the newest values. Attributes that weren't added to the object before, due to lazy loading, will be added by calling refresh.
[ "Refresh", "this", "objects", "attributes", "to", "the", "newest", "values", "." ]
python
train
33.8
workforce-data-initiative/skills-utils
skills_utils/fs.py
https://github.com/workforce-data-initiative/skills-utils/blob/4cf9b7c2938984f34bbcc33d45482d23c52c7539/skills_utils/fs.py#L10-L32
def cache_json(filename): """Caches the JSON-serializable output of the function to a given file Args: filename (str) The filename (sans directory) to store the output Returns: decorator, applicable to a function that produces JSON-serializable output """ def cache_decorator(cacheable_func...
[ "def", "cache_json", "(", "filename", ")", ":", "def", "cache_decorator", "(", "cacheable_function", ")", ":", "@", "wraps", "(", "cacheable_function", ")", "def", "cache_wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "path", "=", "CACHE_DI...
Caches the JSON-serializable output of the function to a given file Args: filename (str) The filename (sans directory) to store the output Returns: decorator, applicable to a function that produces JSON-serializable output
[ "Caches", "the", "JSON", "-", "serializable", "output", "of", "the", "function", "to", "a", "given", "file" ]
python
train
38.26087