repo
stringlengths
7
54
path
stringlengths
4
192
url
stringlengths
87
284
code
stringlengths
78
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
libyal/dtfabric
dtfabric/runtime/runtime.py
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/runtime.py#L172-L197
def CreateClass(cls, data_type_definition): """Creates a new structure values class. Args: data_type_definition (DataTypeDefinition): data type definition. Returns: class: structure values class. """ cls._ValidateDataTypeDefinition(data_type_definition) class_definition = cls._Cre...
[ "def", "CreateClass", "(", "cls", ",", "data_type_definition", ")", ":", "cls", ".", "_ValidateDataTypeDefinition", "(", "data_type_definition", ")", "class_definition", "=", "cls", ".", "_CreateClassTemplate", "(", "data_type_definition", ")", "namespace", "=", "{", ...
Creates a new structure values class. Args: data_type_definition (DataTypeDefinition): data type definition. Returns: class: structure values class.
[ "Creates", "a", "new", "structure", "values", "class", "." ]
python
train
biocore/burrito-fillings
bfillings/vsearch.py
https://github.com/biocore/burrito-fillings/blob/02ab71a46119b40793bd56a4ae00ca15f6dc3329/bfillings/vsearch.py#L175-L213
def _get_result_paths(self, data): """ Set the result paths """ result = {} result['Output'] = ResultPath( Path=self.Parameters['--output'].Value, IsWritten=self.Parameters['--output'].isOn()) result['ClusterFile'] = ResultPath( Path=self.Parameters...
[ "def", "_get_result_paths", "(", "self", ",", "data", ")", ":", "result", "=", "{", "}", "result", "[", "'Output'", "]", "=", "ResultPath", "(", "Path", "=", "self", ".", "Parameters", "[", "'--output'", "]", ".", "Value", ",", "IsWritten", "=", "self"...
Set the result paths
[ "Set", "the", "result", "paths" ]
python
train
deepmind/pysc2
pysc2/env/host_remote_agent.py
https://github.com/deepmind/pysc2/blob/df4cc4b00f07a2242be9ba153d4a7f4ad2017897/pysc2/env/host_remote_agent.py#L208-L215
def close(self): """Shutdown and free all resources.""" if self._controller is not None: self._controller.quit() self._controller = None if self._process is not None: self._process.close() self._process = None
[ "def", "close", "(", "self", ")", ":", "if", "self", ".", "_controller", "is", "not", "None", ":", "self", ".", "_controller", ".", "quit", "(", ")", "self", ".", "_controller", "=", "None", "if", "self", ".", "_process", "is", "not", "None", ":", ...
Shutdown and free all resources.
[ "Shutdown", "and", "free", "all", "resources", "." ]
python
train
mbedmicro/pyOCD
pyocd/flash/loader.py
https://github.com/mbedmicro/pyOCD/blob/41a174718a9739f3cbe785c2ba21cb7fd1310c6f/pyocd/flash/loader.py#L478-L515
def commit(self): """! @brief Write all collected data to flash. This routine ensures that chip erase is only used once if either the auto mode or chip erase mode are used. As an example, if two regions are to be written to and True was passed to the constructor for chip_erase (...
[ "def", "commit", "(", "self", ")", ":", "didChipErase", "=", "False", "perfList", "=", "[", "]", "# Iterate over builders we've created and program the data.", "for", "builder", "in", "sorted", "(", "self", ".", "_builders", ".", "values", "(", ")", ",", "key", ...
! @brief Write all collected data to flash. This routine ensures that chip erase is only used once if either the auto mode or chip erase mode are used. As an example, if two regions are to be written to and True was passed to the constructor for chip_erase (or if the session option was ...
[ "!" ]
python
train
flatangle/flatlib
flatlib/predictives/primarydirections.py
https://github.com/flatangle/flatlib/blob/44e05b2991a296c678adbc17a1d51b6a21bc867c/flatlib/predictives/primarydirections.py#L187-L195
def N(self, ID, asp=0): """ Returns the conjunction or opposition aspect of an object. """ obj = self.chart.get(ID).copy() obj.relocate(obj.lon + asp) ID = 'N_%s_%s' % (ID, asp) return self.G(ID, obj.lat, obj.lon)
[ "def", "N", "(", "self", ",", "ID", ",", "asp", "=", "0", ")", ":", "obj", "=", "self", ".", "chart", ".", "get", "(", "ID", ")", ".", "copy", "(", ")", "obj", ".", "relocate", "(", "obj", ".", "lon", "+", "asp", ")", "ID", "=", "'N_%s_%s'"...
Returns the conjunction or opposition aspect of an object.
[ "Returns", "the", "conjunction", "or", "opposition", "aspect", "of", "an", "object", "." ]
python
train
DLR-RM/RAFCON
source/rafcon/gui/controllers/state_editor/semantic_data_editor.py
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/state_editor/semantic_data_editor.py#L127-L136
def get_selected_object(self): """ Gets the selected object in the treeview :return: """ model, paths = self.tree_view.get_selection().get_selected_rows() if len(paths) == 1: return self.tree_store.get_iter(paths[0]), paths[0] else: return None, p...
[ "def", "get_selected_object", "(", "self", ")", ":", "model", ",", "paths", "=", "self", ".", "tree_view", ".", "get_selection", "(", ")", ".", "get_selected_rows", "(", ")", "if", "len", "(", "paths", ")", "==", "1", ":", "return", "self", ".", "tree_...
Gets the selected object in the treeview :return:
[ "Gets", "the", "selected", "object", "in", "the", "treeview" ]
python
train
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/util/event.py
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/event.py#L719-L729
def connect(self, callback, ref=False, position='first', before=None, after=None): """ Connect the callback to the event group. The callback will receive events from *all* of the emitters in the group. See :func:`EventEmitter.connect() <vispy.event.EventEmitter.connect>` ...
[ "def", "connect", "(", "self", ",", "callback", ",", "ref", "=", "False", ",", "position", "=", "'first'", ",", "before", "=", "None", ",", "after", "=", "None", ")", ":", "self", ".", "_connect_emitters", "(", "True", ")", "return", "EventEmitter", "....
Connect the callback to the event group. The callback will receive events from *all* of the emitters in the group. See :func:`EventEmitter.connect() <vispy.event.EventEmitter.connect>` for arguments.
[ "Connect", "the", "callback", "to", "the", "event", "group", ".", "The", "callback", "will", "receive", "events", "from", "*", "all", "*", "of", "the", "emitters", "in", "the", "group", "." ]
python
train
SamLau95/nbinteract
nbinteract/cli.py
https://github.com/SamLau95/nbinteract/blob/9f346452283831aad3f4416c04879f1d187ec3b7/nbinteract/cli.py#L360-L389
def expand_folder(notebook_or_folder, recursive=False): """ If notebook_or_folder is a folder, returns a list containing all notebooks in the folder. Otherwise, returns a list containing the notebook name. If recursive is True, recurses into subdirectories. """ is_file = os.path.isfile(notebook...
[ "def", "expand_folder", "(", "notebook_or_folder", ",", "recursive", "=", "False", ")", ":", "is_file", "=", "os", ".", "path", ".", "isfile", "(", "notebook_or_folder", ")", "is_dir", "=", "os", ".", "path", ".", "isdir", "(", "notebook_or_folder", ")", "...
If notebook_or_folder is a folder, returns a list containing all notebooks in the folder. Otherwise, returns a list containing the notebook name. If recursive is True, recurses into subdirectories.
[ "If", "notebook_or_folder", "is", "a", "folder", "returns", "a", "list", "containing", "all", "notebooks", "in", "the", "folder", ".", "Otherwise", "returns", "a", "list", "containing", "the", "notebook", "name", "." ]
python
train
buildbot/buildbot
master/buildbot/worker/openstack.py
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/worker/openstack.py#L106-L120
def _constructClient(client_version, username, user_domain, password, project_name, project_domain, auth_url): """Return a novaclient from the given args.""" loader = loading.get_plugin_loader('password') # These only work with v3 if user_domain is not None or p...
[ "def", "_constructClient", "(", "client_version", ",", "username", ",", "user_domain", ",", "password", ",", "project_name", ",", "project_domain", ",", "auth_url", ")", ":", "loader", "=", "loading", ".", "get_plugin_loader", "(", "'password'", ")", "# These only...
Return a novaclient from the given args.
[ "Return", "a", "novaclient", "from", "the", "given", "args", "." ]
python
train
lokhman/pydbal
pydbal/connection.py
https://github.com/lokhman/pydbal/blob/53f396a2a18826e9fff178cd2c0636c1656cbaea/pydbal/connection.py#L402-L421
def set_auto_commit(self, auto_commit): """Sets auto-commit mode for this connection. If a connection is in auto-commit mode, then all its SQL statements will be executed and committed as individual transactions. Otherwise, its SQL statements are grouped into transactions that are terminated by...
[ "def", "set_auto_commit", "(", "self", ",", "auto_commit", ")", ":", "auto_commit", "=", "bool", "(", "auto_commit", ")", "if", "auto_commit", "==", "self", ".", "_auto_commit", ":", "return", "self", ".", "_auto_commit", "=", "auto_commit", "if", "self", "....
Sets auto-commit mode for this connection. If a connection is in auto-commit mode, then all its SQL statements will be executed and committed as individual transactions. Otherwise, its SQL statements are grouped into transactions that are terminated by a call to either the method commit or the ...
[ "Sets", "auto", "-", "commit", "mode", "for", "this", "connection", "." ]
python
train
assemblerflow/flowcraft
flowcraft/templates/assembly_report.py
https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/templates/assembly_report.py#L143-L181
def _parse_assembly(self, assembly_file): """Parse an assembly file in fasta format. This is a Fasta parsing method that populates the :py:attr:`Assembly.contigs` attribute with data for each contig in the assembly. Parameters ---------- assembly_file : str ...
[ "def", "_parse_assembly", "(", "self", ",", "assembly_file", ")", ":", "with", "open", "(", "assembly_file", ")", "as", "fh", ":", "header", "=", "None", "logger", ".", "debug", "(", "\"Starting iteration of assembly file: {}\"", ".", "format", "(", "assembly_fi...
Parse an assembly file in fasta format. This is a Fasta parsing method that populates the :py:attr:`Assembly.contigs` attribute with data for each contig in the assembly. Parameters ---------- assembly_file : str Path to the assembly fasta file.
[ "Parse", "an", "assembly", "file", "in", "fasta", "format", "." ]
python
test
COLORFULBOARD/revision
revision/client.py
https://github.com/COLORFULBOARD/revision/blob/2f22e72cce5b60032a80c002ac45c2ecef0ed987/revision/client.py#L149-L162
def filename(self): """ :return: :rtype: str """ filename = self.key if self.has_revision_file() and self.history.current_revision: filename += "-" filename += self.history.current_revision.revision_id filename += ".zip" return f...
[ "def", "filename", "(", "self", ")", ":", "filename", "=", "self", ".", "key", "if", "self", ".", "has_revision_file", "(", ")", "and", "self", ".", "history", ".", "current_revision", ":", "filename", "+=", "\"-\"", "filename", "+=", "self", ".", "histo...
:return: :rtype: str
[ ":", "return", ":", ":", "rtype", ":", "str" ]
python
train
inveniosoftware-contrib/invenio-groups
invenio_groups/models.py
https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/models.py#L581-L586
def query_invitations(cls, user, eager=False): """Get all invitations for given user.""" if eager: eager = [Membership.group] return cls.query_by_user(user, state=MembershipState.PENDING_USER, eager=eager)
[ "def", "query_invitations", "(", "cls", ",", "user", ",", "eager", "=", "False", ")", ":", "if", "eager", ":", "eager", "=", "[", "Membership", ".", "group", "]", "return", "cls", ".", "query_by_user", "(", "user", ",", "state", "=", "MembershipState", ...
Get all invitations for given user.
[ "Get", "all", "invitations", "for", "given", "user", "." ]
python
valid
kxepal/viivakoodi
barcode/base.py
https://github.com/kxepal/viivakoodi/blob/79f5e866465f481982f9870c31f49a815e921c28/barcode/base.py#L87-L103
def render(self, writer_options=None): """Renders the barcode using `self.writer`. :parameters: writer_options : Dict Options for `self.writer`, see writer docs for details. :returns: Output of the writers render method. """ options = Barcode.default...
[ "def", "render", "(", "self", ",", "writer_options", "=", "None", ")", ":", "options", "=", "Barcode", ".", "default_writer_options", ".", "copy", "(", ")", "options", ".", "update", "(", "writer_options", "or", "{", "}", ")", "if", "options", "[", "'wri...
Renders the barcode using `self.writer`. :parameters: writer_options : Dict Options for `self.writer`, see writer docs for details. :returns: Output of the writers render method.
[ "Renders", "the", "barcode", "using", "self", ".", "writer", "." ]
python
test
rackerlabs/simpl
simpl/git.py
https://github.com/rackerlabs/simpl/blob/60ed3336a931cd6a7a7246e60f26165d9dc7c99c/simpl/git.py#L262-L288
def git_ls_remote(repo_dir, remote='origin', refs=None): """Run git ls-remote. 'remote' can be a remote ref in a local repo, e.g. origin, or url of a remote repository. Return format: .. code-block:: python {<ref1>: <commit_hash1>, <ref2>: <commit_hash2>, ..., ...
[ "def", "git_ls_remote", "(", "repo_dir", ",", "remote", "=", "'origin'", ",", "refs", "=", "None", ")", ":", "command", "=", "[", "'git'", ",", "'ls-remote'", ",", "pipes", ".", "quote", "(", "remote", ")", "]", "if", "refs", ":", "if", "isinstance", ...
Run git ls-remote. 'remote' can be a remote ref in a local repo, e.g. origin, or url of a remote repository. Return format: .. code-block:: python {<ref1>: <commit_hash1>, <ref2>: <commit_hash2>, ..., <refN>: <commit_hashN>, }
[ "Run", "git", "ls", "-", "remote", "." ]
python
train
waqasbhatti/astrobase
astrobase/periodbase/zgls.py
https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/periodbase/zgls.py#L269-L351
def generalized_lsp_value_notau(times, mags, errs, omega): ''' This is the simplified version not using tau. The relations used are:: W = sum (1.0/(errs*errs) ) w_i = (1/W)*(1/(errs*errs)) Y = sum( w_i*y_i ) C = sum( w_i*cos(wt_i) ) S = sum( w_i*sin(wt_i) ) ...
[ "def", "generalized_lsp_value_notau", "(", "times", ",", "mags", ",", "errs", ",", "omega", ")", ":", "one_over_errs2", "=", "1.0", "/", "(", "errs", "*", "errs", ")", "W", "=", "npsum", "(", "one_over_errs2", ")", "wi", "=", "one_over_errs2", "/", "W", ...
This is the simplified version not using tau. The relations used are:: W = sum (1.0/(errs*errs) ) w_i = (1/W)*(1/(errs*errs)) Y = sum( w_i*y_i ) C = sum( w_i*cos(wt_i) ) S = sum( w_i*sin(wt_i) ) YY = sum( w_i*y_i*y_i ) - Y*Y YC = sum( w_i*y_i*cos(wt_i) ) -...
[ "This", "is", "the", "simplified", "version", "not", "using", "tau", "." ]
python
valid
ucfopen/canvasapi
canvasapi/upload.py
https://github.com/ucfopen/canvasapi/blob/319064b5fc97ba54250af683eb98723ef3f76cf8/canvasapi/upload.py#L72-L103
def upload(self, response, file): """ Upload the file. :param response: The response from the upload request. :type response: dict :param file: A file handler pointing to the file to upload. :returns: True if the file uploaded successfully, False otherwise, \ ...
[ "def", "upload", "(", "self", ",", "response", ",", "file", ")", ":", "response", "=", "response", ".", "json", "(", ")", "if", "not", "response", ".", "get", "(", "'upload_url'", ")", ":", "raise", "ValueError", "(", "'Bad API response. No upload_url.'", ...
Upload the file. :param response: The response from the upload request. :type response: dict :param file: A file handler pointing to the file to upload. :returns: True if the file uploaded successfully, False otherwise, \ and the JSON response from the API. :rtype: t...
[ "Upload", "the", "file", "." ]
python
train
LonamiWebs/Telethon
telethon/network/mtprotosender.py
https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/network/mtprotosender.py#L484-L523
async def _handle_rpc_result(self, message): """ Handles the result for Remote Procedure Calls: rpc_result#f35c6d01 req_msg_id:long result:bytes = RpcResult; This is where the future results for sent requests are set. """ rpc_result = message.obj state = sel...
[ "async", "def", "_handle_rpc_result", "(", "self", ",", "message", ")", ":", "rpc_result", "=", "message", ".", "obj", "state", "=", "self", ".", "_pending_state", ".", "pop", "(", "rpc_result", ".", "req_msg_id", ",", "None", ")", "self", ".", "_log", "...
Handles the result for Remote Procedure Calls: rpc_result#f35c6d01 req_msg_id:long result:bytes = RpcResult; This is where the future results for sent requests are set.
[ "Handles", "the", "result", "for", "Remote", "Procedure", "Calls", ":" ]
python
train
singingwolfboy/flask-dance
flask_dance/contrib/gitlab.py
https://github.com/singingwolfboy/flask-dance/blob/87d45328bbdaff833559a6d3da71461fe4579592/flask_dance/contrib/gitlab.py#L16-L86
def make_gitlab_blueprint( client_id=None, client_secret=None, scope=None, redirect_url=None, redirect_to=None, login_url=None, authorized_url=None, session_class=None, storage=None, hostname="gitlab.com", ): """ Make a blueprint for authenticating with GitLab using OAuth...
[ "def", "make_gitlab_blueprint", "(", "client_id", "=", "None", ",", "client_secret", "=", "None", ",", "scope", "=", "None", ",", "redirect_url", "=", "None", ",", "redirect_to", "=", "None", ",", "login_url", "=", "None", ",", "authorized_url", "=", "None",...
Make a blueprint for authenticating with GitLab using OAuth 2. This requires a client ID and client secret from GitLab. You should either pass them to this constructor, or make sure that your Flask application config defines them, using the variables :envvar:`GITLAB_OAUTH_CLIENT_ID` and :envvar:`GITLAB_...
[ "Make", "a", "blueprint", "for", "authenticating", "with", "GitLab", "using", "OAuth", "2", ".", "This", "requires", "a", "client", "ID", "and", "client", "secret", "from", "GitLab", ".", "You", "should", "either", "pass", "them", "to", "this", "constructor"...
python
train
sdss/sdss_access
python/sdss_access/path/path.py
https://github.com/sdss/sdss_access/blob/76375bbf37d39d2e4ccbed90bdfa9a4298784470/python/sdss_access/path/path.py#L681-L700
def spectrodir(self, filetype, **kwargs): """Returns :envvar:`SPECTRO_REDUX` or :envvar:`BOSS_SPECTRO_REDUX` depending on the value of `run2d`. Parameters ---------- filetype : str File type parameter. run2d : int or str 2D Reduction ID. ...
[ "def", "spectrodir", "(", "self", ",", "filetype", ",", "*", "*", "kwargs", ")", ":", "if", "str", "(", "kwargs", "[", "'run2d'", "]", ")", "in", "(", "'26'", ",", "'103'", ",", "'104'", ")", ":", "return", "os", ".", "environ", "[", "'SPECTRO_REDU...
Returns :envvar:`SPECTRO_REDUX` or :envvar:`BOSS_SPECTRO_REDUX` depending on the value of `run2d`. Parameters ---------- filetype : str File type parameter. run2d : int or str 2D Reduction ID. Returns ------- spectrodir : str ...
[ "Returns", ":", "envvar", ":", "SPECTRO_REDUX", "or", ":", "envvar", ":", "BOSS_SPECTRO_REDUX", "depending", "on", "the", "value", "of", "run2d", "." ]
python
train
iotile/coretools
iotilesensorgraph/iotile/sg/sensor_log.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/sensor_log.py#L207-L242
def create_walker(self, selector, skip_all=True): """Create a stream walker based on the given selector. This function returns a StreamWalker subclass that will remain up to date and allow iterating over and popping readings from the stream(s) specified by the selector. When th...
[ "def", "create_walker", "(", "self", ",", "selector", ",", "skip_all", "=", "True", ")", ":", "if", "selector", ".", "buffered", ":", "walker", "=", "BufferedStreamWalker", "(", "selector", ",", "self", ".", "_engine", ",", "skip_all", "=", "skip_all", ")"...
Create a stream walker based on the given selector. This function returns a StreamWalker subclass that will remain up to date and allow iterating over and popping readings from the stream(s) specified by the selector. When the stream walker is done, it should be passed to destr...
[ "Create", "a", "stream", "walker", "based", "on", "the", "given", "selector", "." ]
python
train
BernardFW/bernard
src/bernard/misc/start_project/_base.py
https://github.com/BernardFW/bernard/blob/9c55703e5ffe5717c9fa39793df59dbfa5b4c5ab/src/bernard/misc/start_project/_base.py#L71-L76
def make_file_path(project_dir, project_name, root, name): """ Generates the target path for a file """ return path.join(make_dir_path(project_dir, root, project_name), name)
[ "def", "make_file_path", "(", "project_dir", ",", "project_name", ",", "root", ",", "name", ")", ":", "return", "path", ".", "join", "(", "make_dir_path", "(", "project_dir", ",", "root", ",", "project_name", ")", ",", "name", ")" ]
Generates the target path for a file
[ "Generates", "the", "target", "path", "for", "a", "file" ]
python
train
simon-anders/htseq
python3/HTSeq/__init__.py
https://github.com/simon-anders/htseq/blob/6f7d66e757e610228c33ebf2bb5dc8cc5051c7f0/python3/HTSeq/__init__.py#L742-L824
def pair_SAM_alignments_with_buffer( alignments, max_buffer_size=30000000, primary_only=False): '''Iterate over SAM aligments with buffer, position-sorted paired-end Args: alignments (iterator of SAM/BAM alignments): the alignments to wrap max_buffer_size (int): maxmal n...
[ "def", "pair_SAM_alignments_with_buffer", "(", "alignments", ",", "max_buffer_size", "=", "30000000", ",", "primary_only", "=", "False", ")", ":", "almnt_buffer", "=", "{", "}", "ambiguous_pairing_counter", "=", "0", "for", "almnt", "in", "alignments", ":", "if", ...
Iterate over SAM aligments with buffer, position-sorted paired-end Args: alignments (iterator of SAM/BAM alignments): the alignments to wrap max_buffer_size (int): maxmal numer of alignments to keep in memory. primary_only (bool): for each read, consider only the primary line (S...
[ "Iterate", "over", "SAM", "aligments", "with", "buffer", "position", "-", "sorted", "paired", "-", "end" ]
python
train
python-diamond/Diamond
src/diamond/handler/signalfx.py
https://github.com/python-diamond/Diamond/blob/0f3eb04327d6d3ed5e53a9967d6c9d2c09714a47/src/diamond/handler/signalfx.py#L103-L110
def process(self, metric): """ Queue a metric. Flushing queue if batch size reached """ if self._match_metric(metric): self.metrics.append(metric) if self.should_flush(): self._send()
[ "def", "process", "(", "self", ",", "metric", ")", ":", "if", "self", ".", "_match_metric", "(", "metric", ")", ":", "self", ".", "metrics", ".", "append", "(", "metric", ")", "if", "self", ".", "should_flush", "(", ")", ":", "self", ".", "_send", ...
Queue a metric. Flushing queue if batch size reached
[ "Queue", "a", "metric", ".", "Flushing", "queue", "if", "batch", "size", "reached" ]
python
train
ryan-roemer/django-cloud-browser
cloud_browser/cloud/base.py
https://github.com/ryan-roemer/django-cloud-browser/blob/b06cdd24885a6309e843ed924dbf1705b67e7f48/cloud_browser/cloud/base.py#L82-L91
def smart_content_encoding(self): """Smart content encoding.""" encoding = self.content_encoding if not encoding: base_list = self.basename.split('.') while (not encoding) and len(base_list) > 1: _, encoding = mimetypes.guess_type('.'.join(base_list)) ...
[ "def", "smart_content_encoding", "(", "self", ")", ":", "encoding", "=", "self", ".", "content_encoding", "if", "not", "encoding", ":", "base_list", "=", "self", ".", "basename", ".", "split", "(", "'.'", ")", "while", "(", "not", "encoding", ")", "and", ...
Smart content encoding.
[ "Smart", "content", "encoding", "." ]
python
train
dh1tw/pyhamtools
pyhamtools/lookuplib.py
https://github.com/dh1tw/pyhamtools/blob/ee7e4b8732e23c298da10e07163748156c16d0fa/pyhamtools/lookuplib.py#L453-L482
def _check_inv_operation_for_date(self, item, timestamp, data_dict, data_index_dict): """ Checks if the callsign is marked as an invalid operation for a given timestamp. In case the operation is invalid, True is returned. Otherwise a KeyError is raised. """ if item in data_index...
[ "def", "_check_inv_operation_for_date", "(", "self", ",", "item", ",", "timestamp", ",", "data_dict", ",", "data_index_dict", ")", ":", "if", "item", "in", "data_index_dict", ":", "for", "item", "in", "data_index_dict", "[", "item", "]", ":", "# startdate < time...
Checks if the callsign is marked as an invalid operation for a given timestamp. In case the operation is invalid, True is returned. Otherwise a KeyError is raised.
[ "Checks", "if", "the", "callsign", "is", "marked", "as", "an", "invalid", "operation", "for", "a", "given", "timestamp", ".", "In", "case", "the", "operation", "is", "invalid", "True", "is", "returned", ".", "Otherwise", "a", "KeyError", "is", "raised", "....
python
train
openearth/bmi-python
bmi/wrapper.py
https://github.com/openearth/bmi-python/blob/2f53f24d45515eb0711c2d28ddd6c1582045248f/bmi/wrapper.py#L328-L362
def initialize(self, configfile=None): """Initialize and load the Fortran library (and model, if applicable). The Fortran library is loaded and ctypes is used to annotate functions inside the library. The Fortran library's initialization is called. Normally a path to an ``*.ini`` model...
[ "def", "initialize", "(", "self", ",", "configfile", "=", "None", ")", ":", "if", "configfile", "is", "not", "None", ":", "self", ".", "configfile", "=", "configfile", "try", ":", "self", ".", "configfile", "except", "AttributeError", ":", "raise", "ValueE...
Initialize and load the Fortran library (and model, if applicable). The Fortran library is loaded and ctypes is used to annotate functions inside the library. The Fortran library's initialization is called. Normally a path to an ``*.ini`` model file is passed to the :meth:`__init__`. I...
[ "Initialize", "and", "load", "the", "Fortran", "library", "(", "and", "model", "if", "applicable", ")", "." ]
python
train
saltstack/salt
salt/fileserver/s3fs.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/s3fs.py#L348-L368
def _init(): ''' Connect to S3 and download the metadata for each file in all buckets specified and cache the data to disk. ''' cache_file = _get_buckets_cache_filename() exp = time.time() - S3_CACHE_EXPIRE # check mtime of the buckets files cache metadata = None try: if os....
[ "def", "_init", "(", ")", ":", "cache_file", "=", "_get_buckets_cache_filename", "(", ")", "exp", "=", "time", ".", "time", "(", ")", "-", "S3_CACHE_EXPIRE", "# check mtime of the buckets files cache", "metadata", "=", "None", "try", ":", "if", "os", ".", "pat...
Connect to S3 and download the metadata for each file in all buckets specified and cache the data to disk.
[ "Connect", "to", "S3", "and", "download", "the", "metadata", "for", "each", "file", "in", "all", "buckets", "specified", "and", "cache", "the", "data", "to", "disk", "." ]
python
train
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L8636-L8645
def system_time_send(self, time_unix_usec, time_boot_ms, force_mavlink1=False): ''' The system time is the time of the master clock, typically the computer clock of the main onboard computer. time_unix_usec : Timestamp of the master clock in mi...
[ "def", "system_time_send", "(", "self", ",", "time_unix_usec", ",", "time_boot_ms", ",", "force_mavlink1", "=", "False", ")", ":", "return", "self", ".", "send", "(", "self", ".", "system_time_encode", "(", "time_unix_usec", ",", "time_boot_ms", ")", ",", "for...
The system time is the time of the master clock, typically the computer clock of the main onboard computer. time_unix_usec : Timestamp of the master clock in microseconds since UNIX epoch. (uint64_t) time_boot_ms : Timestamp of the component clock...
[ "The", "system", "time", "is", "the", "time", "of", "the", "master", "clock", "typically", "the", "computer", "clock", "of", "the", "main", "onboard", "computer", "." ]
python
train
mapbox/mapbox-sdk-py
mapbox/services/directions.py
https://github.com/mapbox/mapbox-sdk-py/blob/72d19dbcf2d254a6ea08129a726471fd21f13023/mapbox/services/directions.py#L143-L249
def directions(self, features, profile='mapbox/driving', alternatives=None, geometries=None, overview=None, steps=None, continue_straight=None, waypoint_snapping=None, annotations=None, language=None, **kwargs): """Request directions for waypoints encoded...
[ "def", "directions", "(", "self", ",", "features", ",", "profile", "=", "'mapbox/driving'", ",", "alternatives", "=", "None", ",", "geometries", "=", "None", ",", "overview", "=", "None", ",", "steps", "=", "None", ",", "continue_straight", "=", "None", ",...
Request directions for waypoints encoded as GeoJSON features. Parameters ---------- features : iterable An collection of GeoJSON features profile : str Name of a Mapbox profile such as 'mapbox.driving' alternatives : bool Whether to try to ret...
[ "Request", "directions", "for", "waypoints", "encoded", "as", "GeoJSON", "features", "." ]
python
train
sethmlarson/virtualbox-python
virtualbox/library.py
https://github.com/sethmlarson/virtualbox-python/blob/706c8e3f6e3aee17eb06458e73cbb4bc2d37878b/virtualbox/library.py#L26606-L26616
def unload_plug_in(self, name): """Unloads a DBGF plug-in. in name of type str The plug-in name or DLL. Special name 'all' unloads all plug-ins. """ if not isinstance(name, basestring): raise TypeError("name can only be an instance of type basestring") s...
[ "def", "unload_plug_in", "(", "self", ",", "name", ")", ":", "if", "not", "isinstance", "(", "name", ",", "basestring", ")", ":", "raise", "TypeError", "(", "\"name can only be an instance of type basestring\"", ")", "self", ".", "_call", "(", "\"unloadPlugIn\"", ...
Unloads a DBGF plug-in. in name of type str The plug-in name or DLL. Special name 'all' unloads all plug-ins.
[ "Unloads", "a", "DBGF", "plug", "-", "in", "." ]
python
train
peakwinter/python-nginx
nginx.py
https://github.com/peakwinter/python-nginx/blob/4ecd1cd2e1f11ffb633d188a578a004712eaae16/nginx.py#L58-L75
def filter(self, btype='', name=''): """ Return child object(s) of this Conf that satisfy certain criteria. :param str btype: Type of object to filter by (e.g. 'Key') :param str name: Name of key OR container value to filter by :returns: full list of matching child objects ...
[ "def", "filter", "(", "self", ",", "btype", "=", "''", ",", "name", "=", "''", ")", ":", "filtered", "=", "[", "]", "for", "x", "in", "self", ".", "children", ":", "if", "name", "and", "isinstance", "(", "x", ",", "Key", ")", "and", "x", ".", ...
Return child object(s) of this Conf that satisfy certain criteria. :param str btype: Type of object to filter by (e.g. 'Key') :param str name: Name of key OR container value to filter by :returns: full list of matching child objects
[ "Return", "child", "object", "(", "s", ")", "of", "this", "Conf", "that", "satisfy", "certain", "criteria", "." ]
python
train
scnerd/miniutils
miniutils/timing.py
https://github.com/scnerd/miniutils/blob/fe927e26afc5877416dead28dabdf6604387f42c/miniutils/timing.py#L8-L21
def timed_call(func, *args, log_level='DEBUG', **kwargs): """Logs a function's run time :param func: The function to run :param args: The args to pass to the function :param kwargs: The keyword args to pass to the function :param log_level: The log level at which to print the run time :return: ...
[ "def", "timed_call", "(", "func", ",", "*", "args", ",", "log_level", "=", "'DEBUG'", ",", "*", "*", "kwargs", ")", ":", "start", "=", "time", "(", ")", "r", "=", "func", "(", "*", "args", ",", "*", "*", "kwargs", ")", "t", "=", "time", "(", ...
Logs a function's run time :param func: The function to run :param args: The args to pass to the function :param kwargs: The keyword args to pass to the function :param log_level: The log level at which to print the run time :return: The function's return value
[ "Logs", "a", "function", "s", "run", "time" ]
python
train
gccxml/pygccxml
pygccxml/parser/scanner.py
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/parser/scanner.py#L345-L349
def __read_byte_offset(decl, attrs): """Using duck typing to set the offset instead of in constructor""" offset = attrs.get(XML_AN_OFFSET, 0) # Make sure the size is in bytes instead of bits decl.byte_offset = int(offset) / 8
[ "def", "__read_byte_offset", "(", "decl", ",", "attrs", ")", ":", "offset", "=", "attrs", ".", "get", "(", "XML_AN_OFFSET", ",", "0", ")", "# Make sure the size is in bytes instead of bits", "decl", ".", "byte_offset", "=", "int", "(", "offset", ")", "/", "8" ...
Using duck typing to set the offset instead of in constructor
[ "Using", "duck", "typing", "to", "set", "the", "offset", "instead", "of", "in", "constructor" ]
python
train
schneiderfelipe/pyrrole
pyrrole/core.py
https://github.com/schneiderfelipe/pyrrole/blob/13e26accc9a059f0ab69773648b24292fe1fbfd6/pyrrole/core.py#L114-L154
def _check_data(data): """ Check a data object for inconsistencies. Parameters ---------- data : `pandas.DataFrame` A `data` object, i.e., a table whose rows store information about chemical species, indexed by chemical species. Warns ----- UserWarning Warned if...
[ "def", "_check_data", "(", "data", ")", ":", "if", "\"vibfreqs\"", "in", "data", ".", "columns", ":", "for", "species", "in", "data", ".", "index", ":", "vibfreqs", "=", "data", ".", "loc", "[", "species", ",", "\"vibfreqs\"", "]", "nimagvibfreqs", "=", ...
Check a data object for inconsistencies. Parameters ---------- data : `pandas.DataFrame` A `data` object, i.e., a table whose rows store information about chemical species, indexed by chemical species. Warns ----- UserWarning Warned if a ground state species has one or ...
[ "Check", "a", "data", "object", "for", "inconsistencies", "." ]
python
train
JukeboxPipeline/jukebox-core
src/jukeboxcore/gui/widgets/reftrackwidget.py
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/reftrackwidget.py#L126-L142
def setup_signals(self, ): """Connect the signals with the slots to make the ui functional :returns: None :rtype: None :raises: None """ self.duplicate_tb.clicked.connect(self.duplicate) self.delete_tb.clicked.connect(self.delete) self.load_tb.clicked.con...
[ "def", "setup_signals", "(", "self", ",", ")", ":", "self", ".", "duplicate_tb", ".", "clicked", ".", "connect", "(", "self", ".", "duplicate", ")", "self", ".", "delete_tb", ".", "clicked", ".", "connect", "(", "self", ".", "delete", ")", "self", ".",...
Connect the signals with the slots to make the ui functional :returns: None :rtype: None :raises: None
[ "Connect", "the", "signals", "with", "the", "slots", "to", "make", "the", "ui", "functional" ]
python
train
gwastro/pycbc
pycbc/workflow/pegasus_workflow.py
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/workflow/pegasus_workflow.py#L182-L186
def add_output_opt(self, opt, out): """ Add an option that determines an output """ self.add_opt(opt, out._dax_repr()) self._add_output(out)
[ "def", "add_output_opt", "(", "self", ",", "opt", ",", "out", ")", ":", "self", ".", "add_opt", "(", "opt", ",", "out", ".", "_dax_repr", "(", ")", ")", "self", ".", "_add_output", "(", "out", ")" ]
Add an option that determines an output
[ "Add", "an", "option", "that", "determines", "an", "output" ]
python
train
Genida/archan
src/archan/config.py
https://github.com/Genida/archan/blob/a026d3105c7e86f30e6c9507b93ceb736684bfdc/src/archan/config.py#L433-L449
def print_plugins(self): """Print the available plugins.""" width = console_width() line = Style.BRIGHT + '=' * width + '\n' middle = int(width / 2) if self.available_providers: print(line + ' ' * middle + 'PROVIDERS') for provider in sorted(self.available...
[ "def", "print_plugins", "(", "self", ")", ":", "width", "=", "console_width", "(", ")", "line", "=", "Style", ".", "BRIGHT", "+", "'='", "*", "width", "+", "'\\n'", "middle", "=", "int", "(", "width", "/", "2", ")", "if", "self", ".", "available_prov...
Print the available plugins.
[ "Print", "the", "available", "plugins", "." ]
python
train
zero-os/zerotier_client
zerotier/network_service.py
https://github.com/zero-os/zerotier_client/blob/03993da11e69d837a0308a2f41ae7b378692fd82/zerotier/network_service.py#L7-L13
def deleteMember(self, address, id, headers=None, query_params=None, content_type="application/json"): """ Delete member from network It is method for DELETE /network/{id}/member/{address} """ uri = self.client.base_url + "/network/"+id+"/member/"+address return self.clie...
[ "def", "deleteMember", "(", "self", ",", "address", ",", "id", ",", "headers", "=", "None", ",", "query_params", "=", "None", ",", "content_type", "=", "\"application/json\"", ")", ":", "uri", "=", "self", ".", "client", ".", "base_url", "+", "\"/network/\...
Delete member from network It is method for DELETE /network/{id}/member/{address}
[ "Delete", "member", "from", "network", "It", "is", "method", "for", "DELETE", "/", "network", "/", "{", "id", "}", "/", "member", "/", "{", "address", "}" ]
python
train
facelessuser/backrefs
backrefs/bre.py
https://github.com/facelessuser/backrefs/blob/3b3d60f5d57b02044f880aa29c9c5add0e31a34f/backrefs/bre.py#L310-L323
def compile(pattern, flags=0, auto_compile=None): # noqa A001 """Compile both the search or search and replace into one object.""" if isinstance(pattern, Bre): if auto_compile is not None: raise ValueError("Cannot compile Bre with a different auto_compile!") elif flags != 0: ...
[ "def", "compile", "(", "pattern", ",", "flags", "=", "0", ",", "auto_compile", "=", "None", ")", ":", "# noqa A001", "if", "isinstance", "(", "pattern", ",", "Bre", ")", ":", "if", "auto_compile", "is", "not", "None", ":", "raise", "ValueError", "(", "...
Compile both the search or search and replace into one object.
[ "Compile", "both", "the", "search", "or", "search", "and", "replace", "into", "one", "object", "." ]
python
train
ayust/kitnirc
kitnirc/client.py
https://github.com/ayust/kitnirc/blob/cf19fe39219da75f053e1a3976bf21331b6fefea/kitnirc/client.py#L804-L829
def _parse_namreply(client, command, actor, args): """Parse NAMREPLY and update a Channel object.""" prefixes = client._get_prefixes() channelinfo, _, useritems = args.partition(' :') _, _, channel = channelinfo.rpartition(' ') # channeltype channelname c = client.server.get_channel(channel) ...
[ "def", "_parse_namreply", "(", "client", ",", "command", ",", "actor", ",", "args", ")", ":", "prefixes", "=", "client", ".", "_get_prefixes", "(", ")", "channelinfo", ",", "_", ",", "useritems", "=", "args", ".", "partition", "(", "' :'", ")", "_", ",...
Parse NAMREPLY and update a Channel object.
[ "Parse", "NAMREPLY", "and", "update", "a", "Channel", "object", "." ]
python
train
pyQode/pyqode.core
pyqode/core/widgets/output_window.py
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/output_window.py#L537-L737
def parse_text(self, formatted_text): """ Retursn a list of operations (draw, cup, ed,...). Each operation consist of a command and its associated data. :param formatted_text: text to parse with the default char format to apply. :return: list of Operation """ as...
[ "def", "parse_text", "(", "self", ",", "formatted_text", ")", ":", "assert", "isinstance", "(", "formatted_text", ",", "FormattedText", ")", "ret_val", "=", "[", "]", "fmt", "=", "formatted_text", ".", "fmt", "if", "self", ".", "_prev_fmt_closed", "else", "s...
Retursn a list of operations (draw, cup, ed,...). Each operation consist of a command and its associated data. :param formatted_text: text to parse with the default char format to apply. :return: list of Operation
[ "Retursn", "a", "list", "of", "operations", "(", "draw", "cup", "ed", "...", ")", "." ]
python
train
ratcave/ratcave
ratcave/experimental.py
https://github.com/ratcave/ratcave/blob/e3862cdaba100ac2c6c78c08c4b09638e0c88fd4/ratcave/experimental.py#L4-L31
def draw_vr_anaglyph(cube_fbo, vr_scene, active_scene, eye_poses=(.035, -.035)): """ Experimental anaglyph drawing function for VR system with red/blue glasses, used in Sirota lab. Draws a virtual scene in red and blue, from subject's (heda trackers) perspective in active scene. Note: assumes shader us...
[ "def", "draw_vr_anaglyph", "(", "cube_fbo", ",", "vr_scene", ",", "active_scene", ",", "eye_poses", "=", "(", ".035", ",", "-", ".035", ")", ")", ":", "color_masks", "=", "[", "(", "True", ",", "False", ",", "False", ",", "True", ")", ",", "(", "Fals...
Experimental anaglyph drawing function for VR system with red/blue glasses, used in Sirota lab. Draws a virtual scene in red and blue, from subject's (heda trackers) perspective in active scene. Note: assumes shader uses playerPos like ratcave's default shader Args: cube_fbo: texture frameBuffer o...
[ "Experimental", "anaglyph", "drawing", "function", "for", "VR", "system", "with", "red", "/", "blue", "glasses", "used", "in", "Sirota", "lab", ".", "Draws", "a", "virtual", "scene", "in", "red", "and", "blue", "from", "subject", "s", "(", "heda", "tracker...
python
train
vals/umis
umis/barcodes.py
https://github.com/vals/umis/blob/e8adb8486d9e9134ab8a6cad9811a7e74dcc4a2c/umis/barcodes.py#L194-L199
def acgt_match(string): """ returns True if sting consist of only "A "C" "G" "T" """ search = re.compile(r'[^ACGT]').search return not bool(search(string))
[ "def", "acgt_match", "(", "string", ")", ":", "search", "=", "re", ".", "compile", "(", "r'[^ACGT]'", ")", ".", "search", "return", "not", "bool", "(", "search", "(", "string", ")", ")" ]
returns True if sting consist of only "A "C" "G" "T"
[ "returns", "True", "if", "sting", "consist", "of", "only", "A", "C", "G", "T" ]
python
train
freelancer/freelancer-sdk-python
freelancersdk/resources/projects/projects.py
https://github.com/freelancer/freelancer-sdk-python/blob/e09034936d6f13b3909a9464ee329c81c1834941/freelancersdk/resources/projects/projects.py#L475-L497
def post_track(session, user_id, project_id, latitude, longitude): """ Start tracking a project by creating a track """ tracking_data = { 'user_id': user_id, 'project_id': project_id, 'track_point': { 'latitude': latitude, 'longitude': longitude } ...
[ "def", "post_track", "(", "session", ",", "user_id", ",", "project_id", ",", "latitude", ",", "longitude", ")", ":", "tracking_data", "=", "{", "'user_id'", ":", "user_id", ",", "'project_id'", ":", "project_id", ",", "'track_point'", ":", "{", "'latitude'", ...
Start tracking a project by creating a track
[ "Start", "tracking", "a", "project", "by", "creating", "a", "track" ]
python
valid
synw/dataswim
dataswim/charts/bokeh.py
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/charts/bokeh.py#L77-L88
def _sline_bokeh(self, window_size, y_label): """ Returns a chart with a smooth line from a serie """ try: ds2 = self.clone_() window = np.ones(int(window_size)) / float(window_size) ds2.df[y_label] = np.convolve(self.df[self.y], window, 'same') ...
[ "def", "_sline_bokeh", "(", "self", ",", "window_size", ",", "y_label", ")", ":", "try", ":", "ds2", "=", "self", ".", "clone_", "(", ")", "window", "=", "np", ".", "ones", "(", "int", "(", "window_size", ")", ")", "/", "float", "(", "window_size", ...
Returns a chart with a smooth line from a serie
[ "Returns", "a", "chart", "with", "a", "smooth", "line", "from", "a", "serie" ]
python
train
saltstack/salt
salt/modules/panos.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/panos.py#L265-L297
def download_software_version(version=None, synch=False): ''' Download software packages by version number. Args: version(str): The version of the PANOS file to download. synch (bool): If true then the file will synch to the peer unit. CLI Example: .. code-block:: bash s...
[ "def", "download_software_version", "(", "version", "=", "None", ",", "synch", "=", "False", ")", ":", "if", "not", "version", ":", "raise", "CommandExecutionError", "(", "\"Version option must not be none.\"", ")", "if", "not", "isinstance", "(", "synch", ",", ...
Download software packages by version number. Args: version(str): The version of the PANOS file to download. synch (bool): If true then the file will synch to the peer unit. CLI Example: .. code-block:: bash salt '*' panos.download_software_version 8.0.0 salt '*' panos.d...
[ "Download", "software", "packages", "by", "version", "number", "." ]
python
train
rsgalloway/grit
grit/server/cherrypy/__init__.py
https://github.com/rsgalloway/grit/blob/e6434ad8a1f4ac5d0903ebad630c81f8a5164d78/grit/server/cherrypy/__init__.py#L1397-L1406
def start(self): """Start the pool of threads.""" for i in range(self.min): self._threads.append(WorkerThread(self.server)) for worker in self._threads: worker.setName("CP Server " + worker.getName()) worker.start() for worker in self._threads: ...
[ "def", "start", "(", "self", ")", ":", "for", "i", "in", "range", "(", "self", ".", "min", ")", ":", "self", ".", "_threads", ".", "append", "(", "WorkerThread", "(", "self", ".", "server", ")", ")", "for", "worker", "in", "self", ".", "_threads", ...
Start the pool of threads.
[ "Start", "the", "pool", "of", "threads", "." ]
python
train
VingtCinq/python-mailchimp
mailchimp3/entities/segments.py
https://github.com/VingtCinq/python-mailchimp/blob/1b472f1b64fdde974732ac4b7ed48908bb707260/mailchimp3/entities/segments.py#L17-L21
def get(self, list_id, segment_id): """ returns the specified list segment. """ return self._mc_client._get(url=self._build_path(list_id, 'segments', segment_id))
[ "def", "get", "(", "self", ",", "list_id", ",", "segment_id", ")", ":", "return", "self", ".", "_mc_client", ".", "_get", "(", "url", "=", "self", ".", "_build_path", "(", "list_id", ",", "'segments'", ",", "segment_id", ")", ")" ]
returns the specified list segment.
[ "returns", "the", "specified", "list", "segment", "." ]
python
valid
Netflix-Skunkworks/cloudaux
cloudaux/aws/s3.py
https://github.com/Netflix-Skunkworks/cloudaux/blob/c4b0870c3ac68b1c69e71d33cf78b6a8bdf437ea/cloudaux/aws/s3.py#L165-L173
def list_bucket_inventory_configurations(client=None, **kwargs): """ Bucket='string' """ result = client.list_bucket_inventory_configurations(**kwargs) if not result.get("InventoryConfigurationList"): result.update({"InventoryConfigurationList": []}) return result
[ "def", "list_bucket_inventory_configurations", "(", "client", "=", "None", ",", "*", "*", "kwargs", ")", ":", "result", "=", "client", ".", "list_bucket_inventory_configurations", "(", "*", "*", "kwargs", ")", "if", "not", "result", ".", "get", "(", "\"Invento...
Bucket='string'
[ "Bucket", "=", "string" ]
python
valid
shopkick/flawless
flawless/server/server.py
https://github.com/shopkick/flawless/blob/c54b63ca1991c153e6f75080536f6df445aacc64/flawless/server/server.py#L101-L151
def serve(conf_path, storage_factory=None): """This method starts the server. There are two processes, one is an HTTP server that shows and admin interface and the second is a Thrift server that the client code calls. Arguments: `conf_path` - The path to your flawless.cfg file `storage_fact...
[ "def", "serve", "(", "conf_path", ",", "storage_factory", "=", "None", ")", ":", "flawless", ".", "lib", ".", "config", ".", "init_config", "(", "conf_path", ")", "# Try and create datadir if it doesn't exist. For instance it might be in /tmp", "if", "not", "os", ".",...
This method starts the server. There are two processes, one is an HTTP server that shows and admin interface and the second is a Thrift server that the client code calls. Arguments: `conf_path` - The path to your flawless.cfg file `storage_factory` - You can pass in your own storage class that ...
[ "This", "method", "starts", "the", "server", ".", "There", "are", "two", "processes", "one", "is", "an", "HTTP", "server", "that", "shows", "and", "admin", "interface", "and", "the", "second", "is", "a", "Thrift", "server", "that", "the", "client", "code",...
python
test
JNRowe/jnrbase
jnrbase/i18n.py
https://github.com/JNRowe/jnrbase/blob/ae505ef69a9feb739b5f4e62c5a8e6533104d3ea/jnrbase/i18n.py#L27-L40
def setup(__pkg: ModuleType) -> Tuple[Callable[[str], str], Callable[[str, str, int], str]]: """Configure ``gettext`` for given package. Args: __pkg: Package to use as location for :program:`gettext` files Returns: :program:`gettext` functions for singu...
[ "def", "setup", "(", "__pkg", ":", "ModuleType", ")", "->", "Tuple", "[", "Callable", "[", "[", "str", "]", ",", "str", "]", ",", "Callable", "[", "[", "str", ",", "str", ",", "int", "]", ",", "str", "]", "]", ":", "package_locale", "=", "path", ...
Configure ``gettext`` for given package. Args: __pkg: Package to use as location for :program:`gettext` files Returns: :program:`gettext` functions for singular and plural translations
[ "Configure", "gettext", "for", "given", "package", "." ]
python
train
sawcordwell/pymdptoolbox
src/experimental/mdpsql.py
https://github.com/sawcordwell/pymdptoolbox/blob/7c96789cc80e280437005c12065cf70266c11636/src/experimental/mdpsql.py#L230-L242
def _calculatePolicy(self): """This implements argmax() over the actions of Q.""" cmd = ''' UPDATE policy SET action = ( SELECT action FROM (SELECT state, action, MAX(value) FROM Q ...
[ "def", "_calculatePolicy", "(", "self", ")", ":", "cmd", "=", "'''\n UPDATE policy\n SET action = (\n SELECT action\n FROM (SELECT state, action, MAX(value)\n FROM Q\n GR...
This implements argmax() over the actions of Q.
[ "This", "implements", "argmax", "()", "over", "the", "actions", "of", "Q", "." ]
python
train
jason-weirather/py-seq-tools
seqtools/range/__init__.py
https://github.com/jason-weirather/py-seq-tools/blob/f642c2c73ffef2acc83656a78059a476fc734ca1/seqtools/range/__init__.py#L208-L245
def overlaps(self,in_genomic_range,padding=0): """do the ranges overlap? :param in_genomic_range: range to compare to :param padding: add to the ends this many (default 0) :type in_genomic_range: GenomicRange :type padding: int :return: True if they overlap :rtype: bool """ if pad...
[ "def", "overlaps", "(", "self", ",", "in_genomic_range", ",", "padding", "=", "0", ")", ":", "if", "padding", ">", "0", ":", "in_genomic_range", "=", "GenomicRange", "(", "in_genomic_range", ".", "chr", ",", "max", "(", "[", "1", ",", "in_genomic_range", ...
do the ranges overlap? :param in_genomic_range: range to compare to :param padding: add to the ends this many (default 0) :type in_genomic_range: GenomicRange :type padding: int :return: True if they overlap :rtype: bool
[ "do", "the", "ranges", "overlap?" ]
python
train
openvax/pyensembl
pyensembl/genome.py
https://github.com/openvax/pyensembl/blob/4b995fb72e848206d6fbf11950cf30964cd9b3aa/pyensembl/genome.py#L644-L658
def genes(self, contig=None, strand=None): """ Returns all Gene objects in the database. Can be restricted to a particular contig/chromosome and strand by the following arguments: Parameters ---------- contig : str Only return genes on the given contig. ...
[ "def", "genes", "(", "self", ",", "contig", "=", "None", ",", "strand", "=", "None", ")", ":", "gene_ids", "=", "self", ".", "gene_ids", "(", "contig", "=", "contig", ",", "strand", "=", "strand", ")", "return", "[", "self", ".", "gene_by_id", "(", ...
Returns all Gene objects in the database. Can be restricted to a particular contig/chromosome and strand by the following arguments: Parameters ---------- contig : str Only return genes on the given contig. strand : str Only return genes on this strand.
[ "Returns", "all", "Gene", "objects", "in", "the", "database", ".", "Can", "be", "restricted", "to", "a", "particular", "contig", "/", "chromosome", "and", "strand", "by", "the", "following", "arguments", ":" ]
python
train
ansible/molecule
molecule/provisioner/ansible.py
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/provisioner/ansible.py#L709-L717
def verify(self): """ Executes ``ansible-playbook`` against the verify playbook and returns None. :return: None """ pb = self._get_ansible_playbook(self.playbooks.verify) pb.execute()
[ "def", "verify", "(", "self", ")", ":", "pb", "=", "self", ".", "_get_ansible_playbook", "(", "self", ".", "playbooks", ".", "verify", ")", "pb", ".", "execute", "(", ")" ]
Executes ``ansible-playbook`` against the verify playbook and returns None. :return: None
[ "Executes", "ansible", "-", "playbook", "against", "the", "verify", "playbook", "and", "returns", "None", "." ]
python
train
mabuchilab/QNET
src/qnet/algebra/pattern_matching/__init__.py
https://github.com/mabuchilab/QNET/blob/cc20d26dad78691d34c67173e5cd67dcac94208a/src/qnet/algebra/pattern_matching/__init__.py#L248-L268
def _check_last_arg_pattern(self, current_arg_pattern, last_arg_pattern): """Given a "current" arg pattern (that was used to match the last actual argument of an expression), and another ("last") argument pattern, raise a ValueError, unless the "last" argument pattern is a "zero or more"...
[ "def", "_check_last_arg_pattern", "(", "self", ",", "current_arg_pattern", ",", "last_arg_pattern", ")", ":", "try", ":", "if", "last_arg_pattern", ".", "mode", "==", "self", ".", "single", ":", "raise", "ValueError", "(", "\"insufficient number of arguments\"", ")"...
Given a "current" arg pattern (that was used to match the last actual argument of an expression), and another ("last") argument pattern, raise a ValueError, unless the "last" argument pattern is a "zero or more" wildcard. In that case, return a dict that maps the wildcard name to an empt...
[ "Given", "a", "current", "arg", "pattern", "(", "that", "was", "used", "to", "match", "the", "last", "actual", "argument", "of", "an", "expression", ")", "and", "another", "(", "last", ")", "argument", "pattern", "raise", "a", "ValueError", "unless", "the"...
python
train
gautammishra/lyft-rides-python-sdk
lyft_rides/client.py
https://github.com/gautammishra/lyft-rides-python-sdk/blob/b6d96a0fceaf7dc3425153c418a8e25c57803431/lyft_rides/client.py#L179-L232
def request_ride( self, ride_type=None, start_latitude=None, start_longitude=None, start_address=None, end_latitude=None, end_longitude=None, end_address=None, primetime_confirmation_token=None, ): """Request a ride on behalf of an Lyft...
[ "def", "request_ride", "(", "self", ",", "ride_type", "=", "None", ",", "start_latitude", "=", "None", ",", "start_longitude", "=", "None", ",", "start_address", "=", "None", ",", "end_latitude", "=", "None", ",", "end_longitude", "=", "None", ",", "end_addr...
Request a ride on behalf of an Lyft user. Parameters ride_type (str) Name of the type of ride you're requesting. E.g., lyft, lyft_plus start_latitude (float) Latitude component of a start location. start_longitude (float) ...
[ "Request", "a", "ride", "on", "behalf", "of", "an", "Lyft", "user", ".", "Parameters", "ride_type", "(", "str", ")", "Name", "of", "the", "type", "of", "ride", "you", "re", "requesting", ".", "E", ".", "g", ".", "lyft", "lyft_plus", "start_latitude", "...
python
train
GNS3/gns3-server
gns3server/controller/gns3vm/vmware_gns3_vm.py
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/gns3vm/vmware_gns3_vm.py#L123-L180
def start(self): """ Starts the GNS3 VM. """ vms = yield from self.list() for vm in vms: if vm["vmname"] == self.vmname: self._vmx_path = vm["vmx_path"] break # check we have a valid VMX file path if not self._vmx_path...
[ "def", "start", "(", "self", ")", ":", "vms", "=", "yield", "from", "self", ".", "list", "(", ")", "for", "vm", "in", "vms", ":", "if", "vm", "[", "\"vmname\"", "]", "==", "self", ".", "vmname", ":", "self", ".", "_vmx_path", "=", "vm", "[", "\...
Starts the GNS3 VM.
[ "Starts", "the", "GNS3", "VM", "." ]
python
train
rameshg87/pyremotevbox
pyremotevbox/ZSI/twisted/wsgi.py
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/twisted/wsgi.py#L158-L172
def _request_cb(self, env, start_response): """process request, """ if env['REQUEST_METHOD'] == 'GET': return self._handle_GET(env, start_response) if env['REQUEST_METHOD'] == 'POST': return self._handle_POST(env, start_response) start_respo...
[ "def", "_request_cb", "(", "self", ",", "env", ",", "start_response", ")", ":", "if", "env", "[", "'REQUEST_METHOD'", "]", "==", "'GET'", ":", "return", "self", ".", "_handle_GET", "(", "env", ",", "start_response", ")", "if", "env", "[", "'REQUEST_METHOD'...
process request,
[ "process", "request" ]
python
train
tomnor/channelpack
channelpack/pullxl.py
https://github.com/tomnor/channelpack/blob/9ad3cd11c698aed4c0fc178385b2ba38a7d0efae/channelpack/pullxl.py#L384-L419
def letter2num(letters, zbase=False): """A = 1, C = 3 and so on. Convert spreadsheet style column enumeration to a number. Answers: A = 1, Z = 26, AA = 27, AZ = 52, ZZ = 702, AMJ = 1024 >>> from channelpack.pullxl import letter2num >>> letter2num('A') == 1 True >>> letter2num('Z') == ...
[ "def", "letter2num", "(", "letters", ",", "zbase", "=", "False", ")", ":", "letters", "=", "letters", ".", "upper", "(", ")", "res", "=", "0", "weight", "=", "len", "(", "letters", ")", "-", "1", "assert", "weight", ">=", "0", ",", "letters", "for"...
A = 1, C = 3 and so on. Convert spreadsheet style column enumeration to a number. Answers: A = 1, Z = 26, AA = 27, AZ = 52, ZZ = 702, AMJ = 1024 >>> from channelpack.pullxl import letter2num >>> letter2num('A') == 1 True >>> letter2num('Z') == 26 True >>> letter2num('AZ') == 52 ...
[ "A", "=", "1", "C", "=", "3", "and", "so", "on", ".", "Convert", "spreadsheet", "style", "column", "enumeration", "to", "a", "number", "." ]
python
train
hobson/aima
aima/nlp.py
https://github.com/hobson/aima/blob/3572b2fb92039b4a1abe384be8545560fbd3d470/aima/nlp.py#L20-L27
def Lexicon(**rules): """Create a dictionary mapping symbols to alternative words. >>> Lexicon(Art = "the | a | an") {'Art': ['the', 'a', 'an']} """ for (lhs, rhs) in rules.items(): rules[lhs] = [word.strip() for word in rhs.split('|')] return rules
[ "def", "Lexicon", "(", "*", "*", "rules", ")", ":", "for", "(", "lhs", ",", "rhs", ")", "in", "rules", ".", "items", "(", ")", ":", "rules", "[", "lhs", "]", "=", "[", "word", ".", "strip", "(", ")", "for", "word", "in", "rhs", ".", "split", ...
Create a dictionary mapping symbols to alternative words. >>> Lexicon(Art = "the | a | an") {'Art': ['the', 'a', 'an']}
[ "Create", "a", "dictionary", "mapping", "symbols", "to", "alternative", "words", ".", ">>>", "Lexicon", "(", "Art", "=", "the", "|", "a", "|", "an", ")", "{", "Art", ":", "[", "the", "a", "an", "]", "}" ]
python
valid
MycroftAI/mycroft-precise
precise/scripts/train_generated.py
https://github.com/MycroftAI/mycroft-precise/blob/e17cebdd171906dbd8a16e282d8a7966fba2eeba/precise/scripts/train_generated.py#L122-L129
def generate_wakeword_pieces(self, volume): """Generates chunks of audio that represent the wakeword stream""" while True: target = 1 if random() > 0.5 else 0 it = self.pos_files_it if target else self.neg_files_it sample_file = next(it) yield self.layer_w...
[ "def", "generate_wakeword_pieces", "(", "self", ",", "volume", ")", ":", "while", "True", ":", "target", "=", "1", "if", "random", "(", ")", ">", "0.5", "else", "0", "it", "=", "self", ".", "pos_files_it", "if", "target", "else", "self", ".", "neg_file...
Generates chunks of audio that represent the wakeword stream
[ "Generates", "chunks", "of", "audio", "that", "represent", "the", "wakeword", "stream" ]
python
train
pandas-dev/pandas
pandas/core/nanops.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/nanops.py#L984-L1016
def nanprod(values, axis=None, skipna=True, min_count=0, mask=None): """ Parameters ---------- values : ndarray[dtype] axis: int, optional skipna : bool, default True min_count: int, default 0 mask : ndarray[bool], optional nan-mask if known Returns ------- result : ...
[ "def", "nanprod", "(", "values", ",", "axis", "=", "None", ",", "skipna", "=", "True", ",", "min_count", "=", "0", ",", "mask", "=", "None", ")", ":", "if", "mask", "is", "None", ":", "mask", "=", "isna", "(", "values", ")", "if", "skipna", "and"...
Parameters ---------- values : ndarray[dtype] axis: int, optional skipna : bool, default True min_count: int, default 0 mask : ndarray[bool], optional nan-mask if known Returns ------- result : dtype Examples -------- >>> import pandas.core.nanops as nanops ...
[ "Parameters", "----------", "values", ":", "ndarray", "[", "dtype", "]", "axis", ":", "int", "optional", "skipna", ":", "bool", "default", "True", "min_count", ":", "int", "default", "0", "mask", ":", "ndarray", "[", "bool", "]", "optional", "nan", "-", ...
python
train
Azure/blobxfer
blobxfer/operations/azure/file.py
https://github.com/Azure/blobxfer/blob/3eccbe7530cc6a20ab2d30f9e034b6f021817f34/blobxfer/operations/azure/file.py#L105-L135
def get_file_properties( client, fileshare, prefix, timeout=None, snapshot=None): # type: (azure.storage.file.FileService, str, str, int, str) -> # azure.storage.file.models.File """Get file properties :param FileService client: blob client :param str fileshare: file share name :p...
[ "def", "get_file_properties", "(", "client", ",", "fileshare", ",", "prefix", ",", "timeout", "=", "None", ",", "snapshot", "=", "None", ")", ":", "# type: (azure.storage.file.FileService, str, str, int, str) ->", "# azure.storage.file.models.File", "dirname", ",", ...
Get file properties :param FileService client: blob client :param str fileshare: file share name :param str prefix: path prefix :param int timeout: timeout :param str snapshot: snapshot :rtype: azure.storage.file.models.File :return: file properties
[ "Get", "file", "properties", ":", "param", "FileService", "client", ":", "blob", "client", ":", "param", "str", "fileshare", ":", "file", "share", "name", ":", "param", "str", "prefix", ":", "path", "prefix", ":", "param", "int", "timeout", ":", "timeout",...
python
train
Metatab/metatab
metatab/terms.py
https://github.com/Metatab/metatab/blob/8336ec3e4bd8da84a9a5cb86de1c1086e14b8b22/metatab/terms.py#L199-L204
def new_children(self, **kwargs): """Create new children from kwargs""" for k, v in kwargs.items(): self.new_child(k, v) return self
[ "def", "new_children", "(", "self", ",", "*", "*", "kwargs", ")", ":", "for", "k", ",", "v", "in", "kwargs", ".", "items", "(", ")", ":", "self", ".", "new_child", "(", "k", ",", "v", ")", "return", "self" ]
Create new children from kwargs
[ "Create", "new", "children", "from", "kwargs" ]
python
train
jeffrimko/Auxly
lib/auxly/shell.py
https://github.com/jeffrimko/Auxly/blob/5aae876bcb6ca117c81d904f9455764cdc78cd48/lib/auxly/shell.py#L64-L83
def iterstd(cmd, std="out", **kwargs): """Iterates through the lines of a stderr/stdout stream for the given shell command.""" def _readline(): while True: line = getattr(proc, "std"+std).readline() if line != b"": yield line.rstrip().decode("UTF-8", "replace"...
[ "def", "iterstd", "(", "cmd", ",", "std", "=", "\"out\"", ",", "*", "*", "kwargs", ")", ":", "def", "_readline", "(", ")", ":", "while", "True", ":", "line", "=", "getattr", "(", "proc", ",", "\"std\"", "+", "std", ")", ".", "readline", "(", ")",...
Iterates through the lines of a stderr/stdout stream for the given shell command.
[ "Iterates", "through", "the", "lines", "of", "a", "stderr", "/", "stdout", "stream", "for", "the", "given", "shell", "command", "." ]
python
train
pkkid/python-plexapi
plexapi/utils.py
https://github.com/pkkid/python-plexapi/blob/9efbde96441c2bfbf410eacfb46e811e108e8bbc/plexapi/utils.py#L98-L126
def rget(obj, attrstr, default=None, delim='.'): # pragma: no cover """ Returns the value at the specified attrstr location within a nexted tree of dicts, lists, tuples, functions, classes, etc. The lookup is done recursivley for each key in attrstr (split by by the delimiter) This function is heav...
[ "def", "rget", "(", "obj", ",", "attrstr", ",", "default", "=", "None", ",", "delim", "=", "'.'", ")", ":", "# pragma: no cover", "try", ":", "parts", "=", "attrstr", ".", "split", "(", "delim", ",", "1", ")", "attr", "=", "parts", "[", "0", "]", ...
Returns the value at the specified attrstr location within a nexted tree of dicts, lists, tuples, functions, classes, etc. The lookup is done recursivley for each key in attrstr (split by by the delimiter) This function is heavily influenced by the lookups used in Django templates. Para...
[ "Returns", "the", "value", "at", "the", "specified", "attrstr", "location", "within", "a", "nexted", "tree", "of", "dicts", "lists", "tuples", "functions", "classes", "etc", ".", "The", "lookup", "is", "done", "recursivley", "for", "each", "key", "in", "attr...
python
train
rocky/python3-trepan
trepan/lib/file.py
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/file.py#L74-L97
def parse_position(errmsg, arg): """parse_position(errmsg, arg)->(fn, name, lineno) Parse arg as [filename|module:]lineno Make sure it works for C:\foo\bar.py:12 """ colon = arg.rfind(':') if colon >= 0: filename = arg[:colon].rstrip() m, f = lookupmodule(filename) if no...
[ "def", "parse_position", "(", "errmsg", ",", "arg", ")", ":", "colon", "=", "arg", ".", "rfind", "(", "':'", ")", "if", "colon", ">=", "0", ":", "filename", "=", "arg", "[", ":", "colon", "]", ".", "rstrip", "(", ")", "m", ",", "f", "=", "looku...
parse_position(errmsg, arg)->(fn, name, lineno) Parse arg as [filename|module:]lineno Make sure it works for C:\foo\bar.py:12
[ "parse_position", "(", "errmsg", "arg", ")", "-", ">", "(", "fn", "name", "lineno", ")" ]
python
test
astroswego/plotypus
src/plotypus/utils.py
https://github.com/astroswego/plotypus/blob/b1162194ca1d4f6c00e79afe3e6fb40f0eaffcb9/src/plotypus/utils.py#L44-L86
def pmap(func, args, processes=None, callback=lambda *_, **__: None, **kwargs): """pmap(func, args, processes=None, callback=do_nothing, **kwargs) Parallel equivalent of ``map(func, args)``, with the additional ability of providing keyword arguments to func, and a callback function which is applied to ...
[ "def", "pmap", "(", "func", ",", "args", ",", "processes", "=", "None", ",", "callback", "=", "lambda", "*", "_", ",", "*", "*", "__", ":", "None", ",", "*", "*", "kwargs", ")", ":", "if", "processes", "is", "1", ":", "results", "=", "[", "]", ...
pmap(func, args, processes=None, callback=do_nothing, **kwargs) Parallel equivalent of ``map(func, args)``, with the additional ability of providing keyword arguments to func, and a callback function which is applied to each element in the returned list. Unlike map, the output is a non-lazy list. If *p...
[ "pmap", "(", "func", "args", "processes", "=", "None", "callback", "=", "do_nothing", "**", "kwargs", ")" ]
python
train
ghukill/pyfc4
pyfc4/models.py
https://github.com/ghukill/pyfc4/blob/59011df592f08978c4a901a908862d112a5dcf02/pyfc4/models.py#L1829-L1859
def range(self, byte_start, byte_end, stream=True): ''' method to return a particular byte range from NonRDF resource's binary data https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html Args: byte_start(int): position of range start byte_end(int): position of range end Returns: (requests.Respons...
[ "def", "range", "(", "self", ",", "byte_start", ",", "byte_end", ",", "stream", "=", "True", ")", ":", "response", "=", "self", ".", "resource", ".", "repo", ".", "api", ".", "http_request", "(", "'GET'", ",", "self", ".", "resource", ".", "uri", ","...
method to return a particular byte range from NonRDF resource's binary data https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html Args: byte_start(int): position of range start byte_end(int): position of range end Returns: (requests.Response): streamable response
[ "method", "to", "return", "a", "particular", "byte", "range", "from", "NonRDF", "resource", "s", "binary", "data", "https", ":", "//", "www", ".", "w3", ".", "org", "/", "Protocols", "/", "rfc2616", "/", "rfc2616", "-", "sec14", ".", "html" ]
python
train
bcbio/bcbio-nextgen
bcbio/broad/picardrun.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/picardrun.py#L244-L257
def picard_fixmate(picard, align_bam): """Run Picard's FixMateInformation generating an aligned output file. """ base, ext = os.path.splitext(align_bam) out_file = "%s-sort%s" % (base, ext) if not file_exists(out_file): with tx_tmpdir(picard._config) as tmp_dir: with file_transac...
[ "def", "picard_fixmate", "(", "picard", ",", "align_bam", ")", ":", "base", ",", "ext", "=", "os", ".", "path", ".", "splitext", "(", "align_bam", ")", "out_file", "=", "\"%s-sort%s\"", "%", "(", "base", ",", "ext", ")", "if", "not", "file_exists", "("...
Run Picard's FixMateInformation generating an aligned output file.
[ "Run", "Picard", "s", "FixMateInformation", "generating", "an", "aligned", "output", "file", "." ]
python
train
hydpy-dev/hydpy
hydpy/models/dam/dam_model.py
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/dam/dam_model.py#L877-L930
def calc_requiredrelease_v2(self): """Calculate the water release (immediately downstream) required for reducing drought events. Required control parameter: |NearDischargeMinimumThreshold| Required derived parameter: |dam_derived.TOY| Calculated flux sequence: |RequiredRelease| ...
[ "def", "calc_requiredrelease_v2", "(", "self", ")", ":", "con", "=", "self", ".", "parameters", ".", "control", ".", "fastaccess", "der", "=", "self", ".", "parameters", ".", "derived", ".", "fastaccess", "flu", "=", "self", ".", "sequences", ".", "fluxes"...
Calculate the water release (immediately downstream) required for reducing drought events. Required control parameter: |NearDischargeMinimumThreshold| Required derived parameter: |dam_derived.TOY| Calculated flux sequence: |RequiredRelease| Basic equation: :math:`Required...
[ "Calculate", "the", "water", "release", "(", "immediately", "downstream", ")", "required", "for", "reducing", "drought", "events", "." ]
python
train
peergradeio/flask-mongo-profiler
flask_mongo_profiler/contrib/flask_admin/formatters/profiling.py
https://github.com/peergradeio/flask-mongo-profiler/blob/a267eeb49fea07c9a24fb370bd9d7a90ed313ccf/flask_mongo_profiler/contrib/flask_admin/formatters/profiling.py#L48-L63
def profiling_request_formatter(view, context, model, name): """Wrap HTTP method value in a bs3 label.""" document = model[name] return Markup( ''.join( [ '<p class="profiling-request">', '<a href="{}">'.format(document.get_admin_url(_external=True)), ...
[ "def", "profiling_request_formatter", "(", "view", ",", "context", ",", "model", ",", "name", ")", ":", "document", "=", "model", "[", "name", "]", "return", "Markup", "(", "''", ".", "join", "(", "[", "'<p class=\"profiling-request\">'", ",", "'<a href=\"{}\"...
Wrap HTTP method value in a bs3 label.
[ "Wrap", "HTTP", "method", "value", "in", "a", "bs3", "label", "." ]
python
train
zomux/deepy
deepy/dataset/basic.py
https://github.com/zomux/deepy/blob/090fbad22a08a809b12951cd0d4984f5bd432698/deepy/dataset/basic.py#L51-L60
def vectorize_target(self, size): """ Make targets be one-hot vectors. """ if self._train_set: self._train_set = self._vectorize_set(self._train_set, size) if self._valid_set: self._valid_set = self._vectorize_set(self._valid_set, size) if self._te...
[ "def", "vectorize_target", "(", "self", ",", "size", ")", ":", "if", "self", ".", "_train_set", ":", "self", ".", "_train_set", "=", "self", ".", "_vectorize_set", "(", "self", ".", "_train_set", ",", "size", ")", "if", "self", ".", "_valid_set", ":", ...
Make targets be one-hot vectors.
[ "Make", "targets", "be", "one", "-", "hot", "vectors", "." ]
python
test
nrcharles/caelum
caelum/tools.py
https://github.com/nrcharles/caelum/blob/9a8e65806385978556d7bb2e6870f003ff82023e/caelum/tools.py#L32-L46
def download_extract(url): """download and extract file.""" logger.info("Downloading %s", url) request = urllib2.Request(url) request.add_header('User-Agent', 'caelum/0.1 +https://github.com/nrcharles/caelum') opener = urllib2.build_opener() with tempfile.TemporaryFile(suf...
[ "def", "download_extract", "(", "url", ")", ":", "logger", ".", "info", "(", "\"Downloading %s\"", ",", "url", ")", "request", "=", "urllib2", ".", "Request", "(", "url", ")", "request", ".", "add_header", "(", "'User-Agent'", ",", "'caelum/0.1 +https://github...
download and extract file.
[ "download", "and", "extract", "file", "." ]
python
train
hsolbrig/pyjsg
pyjsg/parser_impl/jsg_pairdef_parser.py
https://github.com/hsolbrig/pyjsg/blob/9b2b8fa8e3b8448abe70b09f804a79f0f31b32b7/pyjsg/parser_impl/jsg_pairdef_parser.py#L161-L165
def visitName(self, ctx: jsgParser.NameContext): """ name: ID | STRING """ rtkn = get_terminal(ctx) tkn = esc_kw(rtkn) self._names[rtkn] = tkn
[ "def", "visitName", "(", "self", ",", "ctx", ":", "jsgParser", ".", "NameContext", ")", ":", "rtkn", "=", "get_terminal", "(", "ctx", ")", "tkn", "=", "esc_kw", "(", "rtkn", ")", "self", ".", "_names", "[", "rtkn", "]", "=", "tkn" ]
name: ID | STRING
[ "name", ":", "ID", "|", "STRING" ]
python
train
tensorflow/cleverhans
examples/nips17_adversarial_competition/eval_infra/code/eval_lib/image_batches.py
https://github.com/tensorflow/cleverhans/blob/97488e215760547b81afc53f5e5de8ba7da5bd98/examples/nips17_adversarial_competition/eval_infra/code/eval_lib/image_batches.py#L135-L144
def add_image(self, batch_id, image_id, image_properties=None): """Adds image to given batch.""" if batch_id not in self._data: raise KeyError('Batch with ID "{0}" does not exist'.format(batch_id)) if image_properties is None: image_properties = {} if not isinstance(image_properties, dict): ...
[ "def", "add_image", "(", "self", ",", "batch_id", ",", "image_id", ",", "image_properties", "=", "None", ")", ":", "if", "batch_id", "not", "in", "self", ".", "_data", ":", "raise", "KeyError", "(", "'Batch with ID \"{0}\" does not exist'", ".", "format", "(",...
Adds image to given batch.
[ "Adds", "image", "to", "given", "batch", "." ]
python
train
yahoo/TensorFlowOnSpark
examples/imagenet/inception/data/process_bounding_boxes.py
https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/imagenet/inception/data/process_bounding_boxes.py#L119-L168
def ProcessXMLAnnotation(xml_file): """Process a single XML file containing a bounding box.""" # pylint: disable=broad-except try: tree = ET.parse(xml_file) except Exception: print('Failed to parse: ' + xml_file, file=sys.stderr) return None # pylint: enable=broad-except root = tree.getroot() ...
[ "def", "ProcessXMLAnnotation", "(", "xml_file", ")", ":", "# pylint: disable=broad-except", "try", ":", "tree", "=", "ET", ".", "parse", "(", "xml_file", ")", "except", "Exception", ":", "print", "(", "'Failed to parse: '", "+", "xml_file", ",", "file", "=", "...
Process a single XML file containing a bounding box.
[ "Process", "a", "single", "XML", "file", "containing", "a", "bounding", "box", "." ]
python
train
juju/charm-helpers
charmhelpers/contrib/openstack/amulet/utils.py
https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L534-L546
def get_keystone_endpoint(self, keystone_ip, api_version=None, admin_port=False): """Return keystone endpoint""" port = 5000 if admin_port: port = 35357 base_ep = "http://{}:{}".format(keystone_ip.strip().decode('utf-8'), ...
[ "def", "get_keystone_endpoint", "(", "self", ",", "keystone_ip", ",", "api_version", "=", "None", ",", "admin_port", "=", "False", ")", ":", "port", "=", "5000", "if", "admin_port", ":", "port", "=", "35357", "base_ep", "=", "\"http://{}:{}\"", ".", "format"...
Return keystone endpoint
[ "Return", "keystone", "endpoint" ]
python
train
unixsurfer/anycast_healthchecker
anycast_healthchecker/utils.py
https://github.com/unixsurfer/anycast_healthchecker/blob/3ab9c1d65d550eb30621ced2434252f61d1fdd33/anycast_healthchecker/utils.py#L781-L827
def write_temp_bird_conf(dummy_ip_prefix, config_file, variable_name, prefixes): """Write in a temporary file the list of IP-Prefixes. A failure to create and write the temporary file will exit main program. Arguments: dumm...
[ "def", "write_temp_bird_conf", "(", "dummy_ip_prefix", ",", "config_file", ",", "variable_name", ",", "prefixes", ")", ":", "log", "=", "logging", ".", "getLogger", "(", "PROGRAM_NAME", ")", "comment", "=", "(", "\"# {i} is a dummy IP Prefix. It should NOT be used and \...
Write in a temporary file the list of IP-Prefixes. A failure to create and write the temporary file will exit main program. Arguments: dummy_ip_prefix (str): The dummy IP prefix, which must be always config_file (str): The file name of bird configuration variable_name (str): The name o...
[ "Write", "in", "a", "temporary", "file", "the", "list", "of", "IP", "-", "Prefixes", "." ]
python
train
Netflix-Skunkworks/cloudaux
cloudaux/orchestration/aws/lambda_function.py
https://github.com/Netflix-Skunkworks/cloudaux/blob/c4b0870c3ac68b1c69e71d33cf78b6a8bdf437ea/cloudaux/orchestration/aws/lambda_function.py#L13-L45
def _get_policy(lambda_function, **conn): """Get LambdaFunction Policies. (there can be many of these!) Lambda Function Policies are overly complicated. They can be attached to a label, a version, and there is also a default policy. This method attempts to gather all three types. AW...
[ "def", "_get_policy", "(", "lambda_function", ",", "*", "*", "conn", ")", ":", "policies", "=", "dict", "(", "Versions", "=", "dict", "(", ")", ",", "Aliases", "=", "dict", "(", ")", ",", "DEFAULT", "=", "dict", "(", ")", ")", "for", "version", "in...
Get LambdaFunction Policies. (there can be many of these!) Lambda Function Policies are overly complicated. They can be attached to a label, a version, and there is also a default policy. This method attempts to gather all three types. AWS returns an exception if the policy requested do...
[ "Get", "LambdaFunction", "Policies", ".", "(", "there", "can", "be", "many", "of", "these!", ")", "Lambda", "Function", "Policies", "are", "overly", "complicated", ".", "They", "can", "be", "attached", "to", "a", "label", "a", "version", "and", "there", "i...
python
valid
geophysics-ubonn/reda
lib/reda/containers/sEIT.py
https://github.com/geophysics-ubonn/reda/blob/46a939729e40c7c4723315c03679c40761152e9e/lib/reda/containers/sEIT.py#L307-L355
def filter_incomplete_spectra(self, flimit=1000, percAccept=85): """Remove all data points that belong to spectra that did not retain at least **percAccept** percent of the number of data points. ..warning:: This function does not honor additional dimensions (e.g., time...
[ "def", "filter_incomplete_spectra", "(", "self", ",", "flimit", "=", "1000", ",", "percAccept", "=", "85", ")", ":", "assert", "percAccept", ">", "0", "and", "percAccept", "<", "100", "def", "_retain_only_complete_spectra", "(", "item", ",", "fmax", ",", "ac...
Remove all data points that belong to spectra that did not retain at least **percAccept** percent of the number of data points. ..warning:: This function does not honor additional dimensions (e.g., timesteps) yet!
[ "Remove", "all", "data", "points", "that", "belong", "to", "spectra", "that", "did", "not", "retain", "at", "least", "**", "percAccept", "**", "percent", "of", "the", "number", "of", "data", "points", "." ]
python
train
BD2KGenomics/protect
src/protect/common.py
https://github.com/BD2KGenomics/protect/blob/06310682c50dcf8917b912c8e551299ff7ee41ce/src/protect/common.py#L557-L582
def chrom_sorted(in_chroms): """ Sort a list of chromosomes in the order 1..22, X, Y, M, <others in alphabetical order>. :param list in_chroms: Input chromosomes :return: Sorted chromosomes :rtype: list[str] """ in_chroms.sort() canonicals = [str(c) for c in range(1, 23)] + ['X', 'Y', '...
[ "def", "chrom_sorted", "(", "in_chroms", ")", ":", "in_chroms", ".", "sort", "(", ")", "canonicals", "=", "[", "str", "(", "c", ")", "for", "c", "in", "range", "(", "1", ",", "23", ")", "]", "+", "[", "'X'", ",", "'Y'", ",", "'M'", ",", "'MT'",...
Sort a list of chromosomes in the order 1..22, X, Y, M, <others in alphabetical order>. :param list in_chroms: Input chromosomes :return: Sorted chromosomes :rtype: list[str]
[ "Sort", "a", "list", "of", "chromosomes", "in", "the", "order", "1", "..", "22", "X", "Y", "M", "<others", "in", "alphabetical", "order", ">", "." ]
python
train
cggh/scikit-allel
allel/stats/sf.py
https://github.com/cggh/scikit-allel/blob/3c979a57a100240ba959dd13f98839349530f215/allel/stats/sf.py#L753-L775
def plot_joint_sfs_scaled(*args, **kwargs): """Plot a scaled joint site frequency spectrum. Parameters ---------- s : array_like, int, shape (n_chromosomes_pop1, n_chromosomes_pop2) Joint site frequency spectrum. ax : axes, optional Axes on which to draw. If not provided, a new figu...
[ "def", "plot_joint_sfs_scaled", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "imshow_kwargs", "=", "kwargs", ".", "get", "(", "'imshow_kwargs'", ",", "dict", "(", ")", ")", "imshow_kwargs", ".", "setdefault", "(", "'norm'", ",", "None", ")", "kwa...
Plot a scaled joint site frequency spectrum. Parameters ---------- s : array_like, int, shape (n_chromosomes_pop1, n_chromosomes_pop2) Joint site frequency spectrum. ax : axes, optional Axes on which to draw. If not provided, a new figure will be created. imshow_kwargs : dict-like ...
[ "Plot", "a", "scaled", "joint", "site", "frequency", "spectrum", "." ]
python
train
litaotao/IPython-Dashboard
dashboard/server/resources/storage.py
https://github.com/litaotao/IPython-Dashboard/blob/b28a6b447c86bcec562e554efe96c64660ddf7a2/dashboard/server/resources/storage.py#L40-L47
def get(self, key): """Get a key-value from storage according to the key name. """ data = r_kv.get(key) # data = json.dumps(data) if isinstance(data, str) else data # data = json.loads(data) if data else {} return build_response(dict(data=data, code=200))
[ "def", "get", "(", "self", ",", "key", ")", ":", "data", "=", "r_kv", ".", "get", "(", "key", ")", "# data = json.dumps(data) if isinstance(data, str) else data", "# data = json.loads(data) if data else {}", "return", "build_response", "(", "dict", "(", "data", "=", ...
Get a key-value from storage according to the key name.
[ "Get", "a", "key", "-", "value", "from", "storage", "according", "to", "the", "key", "name", "." ]
python
train
pypa/setuptools
setuptools/command/egg_info.py
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/command/egg_info.py#L701-L713
def get_pkg_info_revision(): """ Get a -r### off of PKG-INFO Version in case this is an sdist of a subversion revision. """ warnings.warn("get_pkg_info_revision is deprecated.", EggInfoDeprecationWarning) if os.path.exists('PKG-INFO'): with io.open('PKG-INFO') as f: for line ...
[ "def", "get_pkg_info_revision", "(", ")", ":", "warnings", ".", "warn", "(", "\"get_pkg_info_revision is deprecated.\"", ",", "EggInfoDeprecationWarning", ")", "if", "os", ".", "path", ".", "exists", "(", "'PKG-INFO'", ")", ":", "with", "io", ".", "open", "(", ...
Get a -r### off of PKG-INFO Version in case this is an sdist of a subversion revision.
[ "Get", "a", "-", "r###", "off", "of", "PKG", "-", "INFO", "Version", "in", "case", "this", "is", "an", "sdist", "of", "a", "subversion", "revision", "." ]
python
train
mitsei/dlkit
dlkit/json_/proxy/rules.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/proxy/rules.py#L358-L369
def set_http_request(self, http_request): """Support the HTTPRequest ProxyConditionRecordType and checks for special effective agent ids""" self._http_request = http_request if 'HTTP_LTI_USER_ID' in http_request.META: try: authority = http_request.META['HTTP_LTI_TOOL_...
[ "def", "set_http_request", "(", "self", ",", "http_request", ")", ":", "self", ".", "_http_request", "=", "http_request", "if", "'HTTP_LTI_USER_ID'", "in", "http_request", ".", "META", ":", "try", ":", "authority", "=", "http_request", ".", "META", "[", "'HTTP...
Support the HTTPRequest ProxyConditionRecordType and checks for special effective agent ids
[ "Support", "the", "HTTPRequest", "ProxyConditionRecordType", "and", "checks", "for", "special", "effective", "agent", "ids" ]
python
train
erdewit/ib_insync
ib_insync/ib.py
https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L1397-L1416
def calculateOptionPrice( self, contract: Contract, volatility: float, underPrice: float, optPrcOptions=None) -> OptionComputation: """ Calculate the option price given the volatility. This method is blocking. https://interactivebrokers.github.io/tws...
[ "def", "calculateOptionPrice", "(", "self", ",", "contract", ":", "Contract", ",", "volatility", ":", "float", ",", "underPrice", ":", "float", ",", "optPrcOptions", "=", "None", ")", "->", "OptionComputation", ":", "return", "self", ".", "_run", "(", "self"...
Calculate the option price given the volatility. This method is blocking. https://interactivebrokers.github.io/tws-api/option_computations.html Args: contract: Option contract. volatility: Option volatility to use in calculation. underPrice: Price of the un...
[ "Calculate", "the", "option", "price", "given", "the", "volatility", "." ]
python
train
go-macaroon-bakery/py-macaroon-bakery
macaroonbakery/httpbakery/_client.py
https://github.com/go-macaroon-bakery/py-macaroon-bakery/blob/63ce1ef1dabe816eb8aaec48fbb46761c34ddf77/macaroonbakery/httpbakery/_client.py#L347-L358
def _add_json_binary_field(b, serialized, field): '''' Set the given field to the given val (bytes) in the serialized dictionary. If the value isn't valid utf-8, we base64 encode it and use field+"64" as the field name. ''' try: val = b.decode('utf-8') serialized[field] = val ...
[ "def", "_add_json_binary_field", "(", "b", ",", "serialized", ",", "field", ")", ":", "try", ":", "val", "=", "b", ".", "decode", "(", "'utf-8'", ")", "serialized", "[", "field", "]", "=", "val", "except", "UnicodeDecodeError", ":", "val", "=", "base64",...
Set the given field to the given val (bytes) in the serialized dictionary. If the value isn't valid utf-8, we base64 encode it and use field+"64" as the field name.
[ "Set", "the", "given", "field", "to", "the", "given", "val", "(", "bytes", ")", "in", "the", "serialized", "dictionary", ".", "If", "the", "value", "isn", "t", "valid", "utf", "-", "8", "we", "base64", "encode", "it", "and", "use", "field", "+", "64"...
python
train
apache/airflow
airflow/task/task_runner/base_task_runner.py
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/task/task_runner/base_task_runner.py#L157-L165
def on_finish(self): """ A callback that should be called when this is done running. """ if self._cfg_path and os.path.isfile(self._cfg_path): if self.run_as_user: subprocess.call(['sudo', 'rm', self._cfg_path], close_fds=True) else: ...
[ "def", "on_finish", "(", "self", ")", ":", "if", "self", ".", "_cfg_path", "and", "os", ".", "path", ".", "isfile", "(", "self", ".", "_cfg_path", ")", ":", "if", "self", ".", "run_as_user", ":", "subprocess", ".", "call", "(", "[", "'sudo'", ",", ...
A callback that should be called when this is done running.
[ "A", "callback", "that", "should", "be", "called", "when", "this", "is", "done", "running", "." ]
python
test
benley/butcher
butcher/address.py
https://github.com/benley/butcher/blob/8b18828ea040af56b7835beab5fd03eab23cc9ee/butcher/address.py#L115-L158
def __parse_target(targetstr, current_repo=None): """Parse a build target string. General form: //repo[gitref]/dir/path:target. These are all valid: //repo //repo[a038fi31d9e8bc11582ef1b1b1982d8fc] //repo[a039aa30853298]:foo //repo/dir //repo[a...
[ "def", "__parse_target", "(", "targetstr", ",", "current_repo", "=", "None", ")", ":", "# 'blah' -> ':blah'", "if", "not", "(", "':'", "in", "targetstr", "or", "'/'", "in", "targetstr", ")", ":", "targetstr", "=", "':%s'", "%", "targetstr", "match", "=", "...
Parse a build target string. General form: //repo[gitref]/dir/path:target. These are all valid: //repo //repo[a038fi31d9e8bc11582ef1b1b1982d8fc] //repo[a039aa30853298]:foo //repo/dir //repo[a037928734]/dir //repo/dir/path //repo/dir...
[ "Parse", "a", "build", "target", "string", "." ]
python
train
SpriteLink/NIPAP
nipap/nipap/backend.py
https://github.com/SpriteLink/NIPAP/blob/f96069f11ab952d80b13cab06e0528f2d24b3de9/nipap/nipap/backend.py#L2240-L2309
def smart_search_pool(self, auth, query_str, search_options=None, extra_query=None): """ Perform a smart search on pool list. * `auth` [BaseAuth] AAA options. * `query_str` [string] Search string * `search_options` [options_dict] ...
[ "def", "smart_search_pool", "(", "self", ",", "auth", ",", "query_str", ",", "search_options", "=", "None", ",", "extra_query", "=", "None", ")", ":", "if", "search_options", "is", "None", ":", "search_options", "=", "{", "}", "self", ".", "_logger", ".", ...
Perform a smart search on pool list. * `auth` [BaseAuth] AAA options. * `query_str` [string] Search string * `search_options` [options_dict] Search options. See :func:`search_pool`. * `extra_query` [dict_to_sql] ...
[ "Perform", "a", "smart", "search", "on", "pool", "list", "." ]
python
train
ml4ai/delphi
delphi/apps/rest_api/api.py
https://github.com/ml4ai/delphi/blob/6d03d8aafeab99610387c51b89c99738ff2abbe3/delphi/apps/rest_api/api.py#L55-L59
def getICMByUUID(uuid: str): """ Fetch an ICM by UUID""" _metadata = ICMMetadata.query.filter_by(id=uuid).first().deserialize() del _metadata["model_id"] return jsonify(_metadata)
[ "def", "getICMByUUID", "(", "uuid", ":", "str", ")", ":", "_metadata", "=", "ICMMetadata", ".", "query", ".", "filter_by", "(", "id", "=", "uuid", ")", ".", "first", "(", ")", ".", "deserialize", "(", ")", "del", "_metadata", "[", "\"model_id\"", "]", ...
Fetch an ICM by UUID
[ "Fetch", "an", "ICM", "by", "UUID" ]
python
train
collectiveacuity/labPack
labpack/events/meetup.py
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/events/meetup.py#L2040-L2099
def join_event(self, group_url, event_id, additional_guests=0, attendance_answers=None, payment_service='', payment_code=''): ''' a method to create an rsvp for a meetup event :param group_url: string with meetup urlname for group :param event_id: integer with meetup id for event ...
[ "def", "join_event", "(", "self", ",", "group_url", ",", "event_id", ",", "additional_guests", "=", "0", ",", "attendance_answers", "=", "None", ",", "payment_service", "=", "''", ",", "payment_code", "=", "''", ")", ":", "# https://www.meetup.com/meetup_api/docs/...
a method to create an rsvp for a meetup event :param group_url: string with meetup urlname for group :param event_id: integer with meetup id for event :param additional_guests: [optional] integer with number of additional guests :param attendance_answers: [optional] list with id & ...
[ "a", "method", "to", "create", "an", "rsvp", "for", "a", "meetup", "event", ":", "param", "group_url", ":", "string", "with", "meetup", "urlname", "for", "group", ":", "param", "event_id", ":", "integer", "with", "meetup", "id", "for", "event", ":", "par...
python
train
pyviz/imagen
imagen/image.py
https://github.com/pyviz/imagen/blob/53c5685c880f54b42795964d8db50b02e8590e88/imagen/image.py#L322-L332
def _process_channels(self,p,**params_to_override): """ Add the channel information to the channel_data attribute. """ orig_image = self._image for i in range(len(self._channel_data)): self._image = self._original_channel_data[i] self._channel_data[i] = s...
[ "def", "_process_channels", "(", "self", ",", "p", ",", "*", "*", "params_to_override", ")", ":", "orig_image", "=", "self", ".", "_image", "for", "i", "in", "range", "(", "len", "(", "self", ".", "_channel_data", ")", ")", ":", "self", ".", "_image", ...
Add the channel information to the channel_data attribute.
[ "Add", "the", "channel", "information", "to", "the", "channel_data", "attribute", "." ]
python
train
rwl/pylon
pylon/util.py
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pylon/util.py#L243-L256
def fair_max(x): """ Takes a single iterable as an argument and returns the same output as the built-in function max with two output parameters, except that where the maximum value occurs at more than one position in the vector, the index is chosen randomly from these positions as opposed to just choos...
[ "def", "fair_max", "(", "x", ")", ":", "value", "=", "max", "(", "x", ")", "# List indexes of max value.", "i", "=", "[", "x", ".", "index", "(", "v", ")", "for", "v", "in", "x", "if", "v", "==", "value", "]", "# Select index randomly among occurances.",...
Takes a single iterable as an argument and returns the same output as the built-in function max with two output parameters, except that where the maximum value occurs at more than one position in the vector, the index is chosen randomly from these positions as opposed to just choosing the first occuran...
[ "Takes", "a", "single", "iterable", "as", "an", "argument", "and", "returns", "the", "same", "output", "as", "the", "built", "-", "in", "function", "max", "with", "two", "output", "parameters", "except", "that", "where", "the", "maximum", "value", "occurs", ...
python
train
ArtoLabs/SimpleSteem
simplesteem/simplesteem.py
https://github.com/ArtoLabs/SimpleSteem/blob/ce8be0ae81f8878b460bc156693f1957f7dd34a3/simplesteem/simplesteem.py#L117-L135
def steem_instance(self): ''' Returns the steem instance if it already exists otherwise uses the goodnode method to fetch a node and instantiate the Steem class. ''' if self.s: return self.s for num_of_retries in range(default.max_retry): node = se...
[ "def", "steem_instance", "(", "self", ")", ":", "if", "self", ".", "s", ":", "return", "self", ".", "s", "for", "num_of_retries", "in", "range", "(", "default", ".", "max_retry", ")", ":", "node", "=", "self", ".", "util", ".", "goodnode", "(", "self...
Returns the steem instance if it already exists otherwise uses the goodnode method to fetch a node and instantiate the Steem class.
[ "Returns", "the", "steem", "instance", "if", "it", "already", "exists", "otherwise", "uses", "the", "goodnode", "method", "to", "fetch", "a", "node", "and", "instantiate", "the", "Steem", "class", "." ]
python
train
AndrewAnnex/SpiceyPy
spiceypy/spiceypy.py
https://github.com/AndrewAnnex/SpiceyPy/blob/fc20a9b9de68b58eed5b332f0c051fb343a6e335/spiceypy/spiceypy.py#L11017-L11034
def scs2e(sc, sclkch): """ Convert a spacecraft clock string to ephemeris seconds past J2000 (ET). http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/scs2e_c.html :param sc: NAIF integer code for a spacecraft. :type sc: int :param sclkch: An SCLK string. :type sclkch: str :return:...
[ "def", "scs2e", "(", "sc", ",", "sclkch", ")", ":", "sc", "=", "ctypes", ".", "c_int", "(", "sc", ")", "sclkch", "=", "stypes", ".", "stringToCharP", "(", "sclkch", ")", "et", "=", "ctypes", ".", "c_double", "(", ")", "libspice", ".", "scs2e_c", "(...
Convert a spacecraft clock string to ephemeris seconds past J2000 (ET). http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/scs2e_c.html :param sc: NAIF integer code for a spacecraft. :type sc: int :param sclkch: An SCLK string. :type sclkch: str :return: Ephemeris time, seconds past J2000...
[ "Convert", "a", "spacecraft", "clock", "string", "to", "ephemeris", "seconds", "past", "J2000", "(", "ET", ")", "." ]
python
train
manns/pyspread
pyspread/src/actions/_main_window_actions.py
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/actions/_main_window_actions.py#L695-L705
def execute_macros(self): """Executes macros and marks grid as changed""" # Mark content as changed post_command_event(self.main_window, self.ContentChangedMsg) (result, err) = self.grid.code_array.execute_macros() # Post event to macro dialog post_command_event(self.m...
[ "def", "execute_macros", "(", "self", ")", ":", "# Mark content as changed", "post_command_event", "(", "self", ".", "main_window", ",", "self", ".", "ContentChangedMsg", ")", "(", "result", ",", "err", ")", "=", "self", ".", "grid", ".", "code_array", ".", ...
Executes macros and marks grid as changed
[ "Executes", "macros", "and", "marks", "grid", "as", "changed" ]
python
train