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
martinrusev/solid-python
solidpy/utils/wsgi.py
https://github.com/martinrusev/solid-python/blob/c5c39ad43c19e6746ea0297e0d440a2fccfb25ed/solidpy/utils/wsgi.py#L2-L12
def get_headers(environ): """ Returns only proper HTTP headers. """ for key, value in environ.iteritems(): key = str(key) if key.startswith('HTTP_') and key not in \ ('HTTP_CONTENT_TYPE', 'HTTP_CONTENT_LENGTH'): yield key[5:].replace('_', '-').title(), value ...
[ "def", "get_headers", "(", "environ", ")", ":", "for", "key", ",", "value", "in", "environ", ".", "iteritems", "(", ")", ":", "key", "=", "str", "(", "key", ")", "if", "key", ".", "startswith", "(", "'HTTP_'", ")", "and", "key", "not", "in", "(", ...
Returns only proper HTTP headers.
[ "Returns", "only", "proper", "HTTP", "headers", "." ]
python
train
cloudera/impyla
impala/_thrift_gen/hive_metastore/ThriftHiveMetastore.py
https://github.com/cloudera/impyla/blob/547fa2ba3b6151e2a98b3544301471a643212dc3/impala/_thrift_gen/hive_metastore/ThriftHiveMetastore.py#L4838-L4845
def drop_function(self, dbName, funcName): """ Parameters: - dbName - funcName """ self.send_drop_function(dbName, funcName) self.recv_drop_function()
[ "def", "drop_function", "(", "self", ",", "dbName", ",", "funcName", ")", ":", "self", ".", "send_drop_function", "(", "dbName", ",", "funcName", ")", "self", ".", "recv_drop_function", "(", ")" ]
Parameters: - dbName - funcName
[ "Parameters", ":", "-", "dbName", "-", "funcName" ]
python
train
pytroll/satpy
satpy/readers/aapp_l1b.py
https://github.com/pytroll/satpy/blob/1f21d20ac686b745fb0da9b4030d139893e066dd/satpy/readers/aapp_l1b.py#L193-L220
def navigate(self): """Return the longitudes and latitudes of the scene. """ tic = datetime.now() lons40km = self._data["pos"][:, :, 1] * 1e-4 lats40km = self._data["pos"][:, :, 0] * 1e-4 try: from geotiepoints import SatelliteInterpolator except Impo...
[ "def", "navigate", "(", "self", ")", ":", "tic", "=", "datetime", ".", "now", "(", ")", "lons40km", "=", "self", ".", "_data", "[", "\"pos\"", "]", "[", ":", ",", ":", ",", "1", "]", "*", "1e-4", "lats40km", "=", "self", ".", "_data", "[", "\"p...
Return the longitudes and latitudes of the scene.
[ "Return", "the", "longitudes", "and", "latitudes", "of", "the", "scene", "." ]
python
train
kressi/terminalplot
terminalplot/terminalplot.py
https://github.com/kressi/terminalplot/blob/af05f3fe0793c957cc0b0ebf4afbe54c72d18b66/terminalplot/terminalplot.py#L7-L38
def plot(x, y, rows=None, columns=None): """ x, y list of values on x- and y-axis plot those values within canvas size (rows and columns) """ if not rows or not columns: rows, columns = get_terminal_size() # offset for caption rows -= 4 # Scale points such that they fit on canva...
[ "def", "plot", "(", "x", ",", "y", ",", "rows", "=", "None", ",", "columns", "=", "None", ")", ":", "if", "not", "rows", "or", "not", "columns", ":", "rows", ",", "columns", "=", "get_terminal_size", "(", ")", "# offset for caption", "rows", "-=", "4...
x, y list of values on x- and y-axis plot those values within canvas size (rows and columns)
[ "x", "y", "list", "of", "values", "on", "x", "-", "and", "y", "-", "axis", "plot", "those", "values", "within", "canvas", "size", "(", "rows", "and", "columns", ")" ]
python
train
Cadair/jupyter_environment_kernels
environment_kernels/activate_helper.py
https://github.com/Cadair/jupyter_environment_kernels/blob/3da304550b511bda7d5d39280379b5ca39bb31bc/environment_kernels/activate_helper.py#L244-L271
def _is_executable_file(path): """Checks that path is an executable regular file, or a symlink towards one. This is roughly ``os.path isfile(path) and os.access(path, os.X_OK)``. This function was forked from pexpect originally: Copyright (c) 2013-2014, Pexpect development team Copyright (c) 2012,...
[ "def", "_is_executable_file", "(", "path", ")", ":", "# follow symlinks,", "fpath", "=", "os", ".", "path", ".", "realpath", "(", "path", ")", "if", "not", "os", ".", "path", ".", "isfile", "(", "fpath", ")", ":", "# non-files (directories, fifo, etc.)", "re...
Checks that path is an executable regular file, or a symlink towards one. This is roughly ``os.path isfile(path) and os.access(path, os.X_OK)``. This function was forked from pexpect originally: Copyright (c) 2013-2014, Pexpect development team Copyright (c) 2012, Noah Spurrier <noah@noah.org> PE...
[ "Checks", "that", "path", "is", "an", "executable", "regular", "file", "or", "a", "symlink", "towards", "one", ".", "This", "is", "roughly", "os", ".", "path", "isfile", "(", "path", ")", "and", "os", ".", "access", "(", "path", "os", ".", "X_OK", ")...
python
train
saltstack/salt
salt/states/bigip.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/bigip.py#L73-L106
def _check_for_changes(entity_type, ret, existing, modified): ''' take an existing entity and a modified entity and check for changes. ''' ret['result'] = True #were there any changes? generation always changes, remove it. if isinstance(existing, dict) and isinstance(modified, dict): ...
[ "def", "_check_for_changes", "(", "entity_type", ",", "ret", ",", "existing", ",", "modified", ")", ":", "ret", "[", "'result'", "]", "=", "True", "#were there any changes? generation always changes, remove it.", "if", "isinstance", "(", "existing", ",", "dict", ")"...
take an existing entity and a modified entity and check for changes.
[ "take", "an", "existing", "entity", "and", "a", "modified", "entity", "and", "check", "for", "changes", "." ]
python
train
apache/airflow
airflow/executors/local_executor.py
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/executors/local_executor.py#L73-L92
def execute_work(self, key, command): """ Executes command received and stores result state in queue. :param key: the key to identify the TI :type key: tuple(dag_id, task_id, execution_date) :param command: the command to execute :type command: str """ if ...
[ "def", "execute_work", "(", "self", ",", "key", ",", "command", ")", ":", "if", "key", "is", "None", ":", "return", "self", ".", "log", ".", "info", "(", "\"%s running %s\"", ",", "self", ".", "__class__", ".", "__name__", ",", "command", ")", "try", ...
Executes command received and stores result state in queue. :param key: the key to identify the TI :type key: tuple(dag_id, task_id, execution_date) :param command: the command to execute :type command: str
[ "Executes", "command", "received", "and", "stores", "result", "state", "in", "queue", ".", ":", "param", "key", ":", "the", "key", "to", "identify", "the", "TI", ":", "type", "key", ":", "tuple", "(", "dag_id", "task_id", "execution_date", ")", ":", "par...
python
test
Yelp/kafka-utils
kafka_utils/util/zookeeper.py
https://github.com/Yelp/kafka-utils/blob/cdb4d64308f3079ee0873250bf7b34d0d94eca50/kafka_utils/util/zookeeper.py#L390-L399
def _fetch_partition_info(self, topic_id, partition_id): """Fetch partition info for given topic-partition.""" info_path = "/brokers/topics/{topic_id}/partitions/{p_id}" try: _, partition_info = self.get( info_path.format(topic_id=topic_id, p_id=partition_id), ...
[ "def", "_fetch_partition_info", "(", "self", ",", "topic_id", ",", "partition_id", ")", ":", "info_path", "=", "\"/brokers/topics/{topic_id}/partitions/{p_id}\"", "try", ":", "_", ",", "partition_info", "=", "self", ".", "get", "(", "info_path", ".", "format", "("...
Fetch partition info for given topic-partition.
[ "Fetch", "partition", "info", "for", "given", "topic", "-", "partition", "." ]
python
train
matrix-org/matrix-python-sdk
matrix_client/client.py
https://github.com/matrix-org/matrix-python-sdk/blob/e734cce3ccd35f2d355c6a19a7a701033472498a/matrix_client/client.py#L219-L236
def login_with_password_no_sync(self, username, password): """Deprecated. Use ``login`` with ``sync=False``. Login to the homeserver. Args: username (str): Account username password (str): Account password Returns: str: Access token Raises:...
[ "def", "login_with_password_no_sync", "(", "self", ",", "username", ",", "password", ")", ":", "warn", "(", "\"login_with_password_no_sync is deprecated. Use login with sync=False.\"", ",", "DeprecationWarning", ")", "return", "self", ".", "login", "(", "username", ",", ...
Deprecated. Use ``login`` with ``sync=False``. Login to the homeserver. Args: username (str): Account username password (str): Account password Returns: str: Access token Raises: MatrixRequestError
[ "Deprecated", ".", "Use", "login", "with", "sync", "=", "False", "." ]
python
train
eonpatapon/contrail-api-cli
contrail_api_cli/resource.py
https://github.com/eonpatapon/contrail-api-cli/blob/1571bf523fa054f3d6bf83dba43a224fea173a73/contrail_api_cli/resource.py#L575-L591
def save(self): """Save the resource to the API server If the resource doesn't have a uuid the resource will be created. If uuid is present the resource is updated. :rtype: Resource """ if self.path.is_collection: self.session.post_json(self.href, ...
[ "def", "save", "(", "self", ")", ":", "if", "self", ".", "path", ".", "is_collection", ":", "self", ".", "session", ".", "post_json", "(", "self", ".", "href", ",", "{", "self", ".", "type", ":", "dict", "(", "self", ".", "data", ")", "}", ",", ...
Save the resource to the API server If the resource doesn't have a uuid the resource will be created. If uuid is present the resource is updated. :rtype: Resource
[ "Save", "the", "resource", "to", "the", "API", "server" ]
python
train
gr33ndata/dysl
dysl/dyslib/lm.py
https://github.com/gr33ndata/dysl/blob/649c1d6a1761f47d49a9842e7389f6df52039155/dysl/dyslib/lm.py#L290-L308
def add_doc(self, doc_id ='', doc_terms=[], doc_length=-1): ''' Add new document to our Language Model (training phase) doc_id is used here, so we build seperate LF for each doc_id I.e. if you call it more than once with same doc_id, then all terms given via doc_terms will contri...
[ "def", "add_doc", "(", "self", ",", "doc_id", "=", "''", ",", "doc_terms", "=", "[", "]", ",", "doc_length", "=", "-", "1", ")", ":", "if", "doc_length", "==", "-", "1", ":", "self", ".", "update_lengths", "(", "doc_id", "=", "doc_id", ",", "doc_le...
Add new document to our Language Model (training phase) doc_id is used here, so we build seperate LF for each doc_id I.e. if you call it more than once with same doc_id, then all terms given via doc_terms will contribute to same LM doc_terms: list of words in document to be added ...
[ "Add", "new", "document", "to", "our", "Language", "Model", "(", "training", "phase", ")", "doc_id", "is", "used", "here", "so", "we", "build", "seperate", "LF", "for", "each", "doc_id", "I", ".", "e", ".", "if", "you", "call", "it", "more", "than", ...
python
train
bitesofcode/projexui
projexui/widgets/xdocktoolbar.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xdocktoolbar.py#L654-L664
def setMinimumPixmapSize(self, size): """ Sets the minimum pixmap size that will be displayed to the user for the dock widget. :param size | <int> """ self._minimumPixmapSize = size position = self.position() self._position = None ...
[ "def", "setMinimumPixmapSize", "(", "self", ",", "size", ")", ":", "self", ".", "_minimumPixmapSize", "=", "size", "position", "=", "self", ".", "position", "(", ")", "self", ".", "_position", "=", "None", "self", ".", "setPosition", "(", "position", ")" ]
Sets the minimum pixmap size that will be displayed to the user for the dock widget. :param size | <int>
[ "Sets", "the", "minimum", "pixmap", "size", "that", "will", "be", "displayed", "to", "the", "user", "for", "the", "dock", "widget", ".", ":", "param", "size", "|", "<int", ">" ]
python
train
google/brotli
research/brotlidump.py
https://github.com/google/brotli/blob/4b2b2d4f83ffeaac7708e44409fe34896a01a278/research/brotlidump.py#L1145-L1165
def value(self, dcode, dextra): """Decode value of symbol together with the extra bits. >>> d = DistanceAlphabet('D', NPOSTFIX=2, NDIRECT=10) >>> d[34].value(2) (0, 35) """ if dcode<16: return [(1,0),(2,0),(3,0),(4,0), (1,-1),(1,+1),(1,-2),...
[ "def", "value", "(", "self", ",", "dcode", ",", "dextra", ")", ":", "if", "dcode", "<", "16", ":", "return", "[", "(", "1", ",", "0", ")", ",", "(", "2", ",", "0", ")", ",", "(", "3", ",", "0", ")", ",", "(", "4", ",", "0", ")", ",", ...
Decode value of symbol together with the extra bits. >>> d = DistanceAlphabet('D', NPOSTFIX=2, NDIRECT=10) >>> d[34].value(2) (0, 35)
[ "Decode", "value", "of", "symbol", "together", "with", "the", "extra", "bits", ".", ">>>", "d", "=", "DistanceAlphabet", "(", "D", "NPOSTFIX", "=", "2", "NDIRECT", "=", "10", ")", ">>>", "d", "[", "34", "]", ".", "value", "(", "2", ")", "(", "0", ...
python
test
noahbenson/neuropythy
neuropythy/commands/surface_to_image.py
https://github.com/noahbenson/neuropythy/blob/b588889f6db36ddb9602ae4a72c1c0d3f41586b2/neuropythy/commands/surface_to_image.py#L83-L187
def main(args): ''' surface_to_rubbon.main(args) can be given a list of arguments, such as sys.argv[1:]; these arguments may include any options and must include exactly one subject id and one output filename. Additionally one or two surface input filenames must be given. The surface files are proje...
[ "def", "main", "(", "args", ")", ":", "# Parse the arguments", "(", "args", ",", "opts", ")", "=", "_surface_to_ribbon_parser", "(", "args", ")", "# First, help?", "if", "opts", "[", "'help'", "]", ":", "print", "(", "info", ",", "file", "=", "sys", ".",...
surface_to_rubbon.main(args) can be given a list of arguments, such as sys.argv[1:]; these arguments may include any options and must include exactly one subject id and one output filename. Additionally one or two surface input filenames must be given. The surface files are projected into the ribbon and wri...
[ "surface_to_rubbon", ".", "main", "(", "args", ")", "can", "be", "given", "a", "list", "of", "arguments", "such", "as", "sys", ".", "argv", "[", "1", ":", "]", ";", "these", "arguments", "may", "include", "any", "options", "and", "must", "include", "ex...
python
train
ewiger/mlab
src/mlab/awmstools.py
https://github.com/ewiger/mlab/blob/72a98adf6499f548848ad44c604f74d68f07fe4f/src/mlab/awmstools.py#L358-L366
def strToTempfile(s, suffix=None, prefix=None, dir=None, binary=False): """Create a new tempfile, write ``s`` to it and return the filename. `suffix`, `prefix` and `dir` are like in `tempfile.mkstemp`. """ fd, filename = tempfile.mkstemp(**dict((k,v) for (k,v) in ...
[ "def", "strToTempfile", "(", "s", ",", "suffix", "=", "None", ",", "prefix", "=", "None", ",", "dir", "=", "None", ",", "binary", "=", "False", ")", ":", "fd", ",", "filename", "=", "tempfile", ".", "mkstemp", "(", "*", "*", "dict", "(", "(", "k"...
Create a new tempfile, write ``s`` to it and return the filename. `suffix`, `prefix` and `dir` are like in `tempfile.mkstemp`.
[ "Create", "a", "new", "tempfile", "write", "s", "to", "it", "and", "return", "the", "filename", ".", "suffix", "prefix", "and", "dir", "are", "like", "in", "tempfile", ".", "mkstemp", "." ]
python
train
helixyte/everest
everest/entities/attributes.py
https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/entities/attributes.py#L127-L134
def get_domain_class_relationship_attribute_iterator(ent): """ Returns an iterator over all terminal attributes in the given registered resource. """ for attr in itervalues_(ent.__everest_attributes__): if attr.kind != RESOURCE_ATTRIBUTE_KINDS.TERMINAL: yield attr
[ "def", "get_domain_class_relationship_attribute_iterator", "(", "ent", ")", ":", "for", "attr", "in", "itervalues_", "(", "ent", ".", "__everest_attributes__", ")", ":", "if", "attr", ".", "kind", "!=", "RESOURCE_ATTRIBUTE_KINDS", ".", "TERMINAL", ":", "yield", "a...
Returns an iterator over all terminal attributes in the given registered resource.
[ "Returns", "an", "iterator", "over", "all", "terminal", "attributes", "in", "the", "given", "registered", "resource", "." ]
python
train
chaoss/grimoirelab-sortinghat
sortinghat/db/api.py
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/db/api.py#L396-L450
def withdraw(session, uidentity, organization, from_date=MIN_PERIOD_DATE, to_date=MAX_PERIOD_DATE): """Withdraw a unique identity from an organization. Removes all the enrollments between the unique identity in `uidentity` and the given 'organization'. When a period of time is given using...
[ "def", "withdraw", "(", "session", ",", "uidentity", ",", "organization", ",", "from_date", "=", "MIN_PERIOD_DATE", ",", "to_date", "=", "MAX_PERIOD_DATE", ")", ":", "if", "not", "from_date", ":", "raise", "ValueError", "(", "\"'from_date' cannot be None\"", ")", ...
Withdraw a unique identity from an organization. Removes all the enrollments between the unique identity in `uidentity` and the given 'organization'. When a period of time is given using `from_date` and `to_date` parameters, the function will remove those periods on which `from_date` <= enrollment...
[ "Withdraw", "a", "unique", "identity", "from", "an", "organization", "." ]
python
train
spyder-ide/spyder
spyder/plugins/variableexplorer/widgets/dataframeeditor.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L213-L243
def max_min_col_update(self): """ Determines the maximum and minimum number in each column. The result is a list whose k-th entry is [vmax, vmin], where vmax and vmin denote the maximum and minimum of the k-th column (ignoring NaN). This list is stored in self.max_min_col...
[ "def", "max_min_col_update", "(", "self", ")", ":", "if", "self", ".", "df", ".", "shape", "[", "0", "]", "==", "0", ":", "# If no rows to compute max/min then return\r", "return", "self", ".", "max_min_col", "=", "[", "]", "for", "dummy", ",", "col", "in"...
Determines the maximum and minimum number in each column. The result is a list whose k-th entry is [vmax, vmin], where vmax and vmin denote the maximum and minimum of the k-th column (ignoring NaN). This list is stored in self.max_min_col. If the k-th column has a non-numerical ...
[ "Determines", "the", "maximum", "and", "minimum", "number", "in", "each", "column", ".", "The", "result", "is", "a", "list", "whose", "k", "-", "th", "entry", "is", "[", "vmax", "vmin", "]", "where", "vmax", "and", "vmin", "denote", "the", "maximum", "...
python
train
biolink/ontobio
ontobio/lexmap.py
https://github.com/biolink/ontobio/blob/4e512a7831cfe6bc1b32f2c3be2ba41bc5cf7345/ontobio/lexmap.py#L531-L644
def weighted_axioms(self, x, y, xg): """ return a tuple (sub,sup,equiv,other) indicating estimated prior probabilities for an interpretation of a mapping between x and y. See kboom paper """ # TODO: allow additional weighting # weights are log odds w=log(p/(1-p))...
[ "def", "weighted_axioms", "(", "self", ",", "x", ",", "y", ",", "xg", ")", ":", "# TODO: allow additional weighting", "# weights are log odds w=log(p/(1-p))", "# (Sub,Sup,Eq,Other)", "scope_pairs", "=", "[", "(", "'label'", ",", "'label'", ",", "0.0", ",", "0.0", ...
return a tuple (sub,sup,equiv,other) indicating estimated prior probabilities for an interpretation of a mapping between x and y. See kboom paper
[ "return", "a", "tuple", "(", "sub", "sup", "equiv", "other", ")", "indicating", "estimated", "prior", "probabilities", "for", "an", "interpretation", "of", "a", "mapping", "between", "x", "and", "y", "." ]
python
train
tcalmant/ipopo
pelix/framework.py
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/framework.py#L1686-L1701
def install_package(self, path, recursive=False): # type: (str, bool) -> tuple """ Installs all the modules found in the given package (directory). It is a utility method working like :meth:`~pelix.framework.BundleContext.install_visiting`, with a visitor accepting every ...
[ "def", "install_package", "(", "self", ",", "path", ",", "recursive", "=", "False", ")", ":", "# type: (str, bool) -> tuple", "return", "self", ".", "__framework", ".", "install_package", "(", "path", ",", "recursive", ")" ]
Installs all the modules found in the given package (directory). It is a utility method working like :meth:`~pelix.framework.BundleContext.install_visiting`, with a visitor accepting every module found. :param path: Path of the package (folder) :param recursive: If True, install...
[ "Installs", "all", "the", "modules", "found", "in", "the", "given", "package", "(", "directory", ")", ".", "It", "is", "a", "utility", "method", "working", "like", ":", "meth", ":", "~pelix", ".", "framework", ".", "BundleContext", ".", "install_visiting", ...
python
train
mitsei/dlkit
dlkit/json_/authorization/sessions.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/authorization/sessions.py#L3183-L3202
def is_child_of_vault(self, id_, vault_id): """Tests if a vault is a direct child of another. arg: id (osid.id.Id): an ``Id`` arg: vault_id (osid.id.Id): the ``Id`` of a vault return: (boolean) - ``true`` if the ``id`` is a child of ``vault_id,`` ``false`` otherwi...
[ "def", "is_child_of_vault", "(", "self", ",", "id_", ",", "vault_id", ")", ":", "# Implemented from template for", "# osid.resource.BinHierarchySession.is_child_of_bin", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "return", "self", ".", "_catalog_se...
Tests if a vault is a direct child of another. arg: id (osid.id.Id): an ``Id`` arg: vault_id (osid.id.Id): the ``Id`` of a vault return: (boolean) - ``true`` if the ``id`` is a child of ``vault_id,`` ``false`` otherwise raise: NotFound - ``vault_id`` not found ...
[ "Tests", "if", "a", "vault", "is", "a", "direct", "child", "of", "another", "." ]
python
train
genialis/resolwe
resolwe/flow/executors/run.py
https://github.com/genialis/resolwe/blob/f7bb54932c81ec0cfc5b5e80d238fceaeaa48d86/resolwe/flow/executors/run.py#L96-L104
async def update_data_status(self, **kwargs): """Update (PATCH) Data object. :param kwargs: The dictionary of :class:`~resolwe.flow.models.Data` attributes to be changed. """ await self._send_manager_command(ExecutorProtocol.UPDATE, extra_fields={ ExecutorProtoco...
[ "async", "def", "update_data_status", "(", "self", ",", "*", "*", "kwargs", ")", ":", "await", "self", ".", "_send_manager_command", "(", "ExecutorProtocol", ".", "UPDATE", ",", "extra_fields", "=", "{", "ExecutorProtocol", ".", "UPDATE_CHANGESET", ":", "kwargs"...
Update (PATCH) Data object. :param kwargs: The dictionary of :class:`~resolwe.flow.models.Data` attributes to be changed.
[ "Update", "(", "PATCH", ")", "Data", "object", "." ]
python
train
alex-kostirin/pyatomac
atomac/AXClasses.py
https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/AXClasses.py#L48-L59
def _getRunningApps(cls): """Get a list of the running applications.""" def runLoopAndExit(): AppHelper.stopEventLoop() AppHelper.callLater(1, runLoopAndExit) AppHelper.runConsoleEventLoop() # Get a list of running applications ws = AppKit.NSWorkspace.shared...
[ "def", "_getRunningApps", "(", "cls", ")", ":", "def", "runLoopAndExit", "(", ")", ":", "AppHelper", ".", "stopEventLoop", "(", ")", "AppHelper", ".", "callLater", "(", "1", ",", "runLoopAndExit", ")", "AppHelper", ".", "runConsoleEventLoop", "(", ")", "# Ge...
Get a list of the running applications.
[ "Get", "a", "list", "of", "the", "running", "applications", "." ]
python
valid
guaix-ucm/pyemir
emirdrp/tools/rect_wpoly_for_mos.py
https://github.com/guaix-ucm/pyemir/blob/fef6bbabcb13f80123cafd1800a0f508a3c21702/emirdrp/tools/rect_wpoly_for_mos.py#L65-L434
def main(args=None): # parse command-line options parser = argparse.ArgumentParser(prog='rect_wpoly_for_mos') # required arguments parser.add_argument("input_list", help="TXT file with list JSON files derived from " "longslit data") parser.add_ar...
[ "def", "main", "(", "args", "=", "None", ")", ":", "# parse command-line options", "parser", "=", "argparse", ".", "ArgumentParser", "(", "prog", "=", "'rect_wpoly_for_mos'", ")", "# required arguments", "parser", ".", "add_argument", "(", "\"input_list\"", ",", "...
with open(args.out_MOSlibrary.name + '_old', 'w') as fstream: json.dump(outdict, fstream, indent=2, sort_keys=True) print('>>> Saving file ' + args.out_MOSlibrary.name + '_old')
[ "with", "open", "(", "args", ".", "out_MOSlibrary", ".", "name", "+", "_old", "w", ")", "as", "fstream", ":", "json", ".", "dump", "(", "outdict", "fstream", "indent", "=", "2", "sort_keys", "=", "True", ")", "print", "(", ">>>", "Saving", "file", "+...
python
train
globocom/GloboNetworkAPI-client-python
networkapiclient/GrupoL3.py
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/GrupoL3.py#L58-L80
def inserir(self, name): """Inserts a new Group L3 and returns its identifier. :param name: Group L3 name. String with a minimum 2 and maximum of 80 characters :return: Dictionary with the following structure: :: {'group_l3': {'id': < id_group_l3 >}} :raise Inval...
[ "def", "inserir", "(", "self", ",", "name", ")", ":", "group_l3_map", "=", "dict", "(", ")", "group_l3_map", "[", "'name'", "]", "=", "name", "code", ",", "xml", "=", "self", ".", "submit", "(", "{", "'group_l3'", ":", "group_l3_map", "}", ",", "'POS...
Inserts a new Group L3 and returns its identifier. :param name: Group L3 name. String with a minimum 2 and maximum of 80 characters :return: Dictionary with the following structure: :: {'group_l3': {'id': < id_group_l3 >}} :raise InvalidParameterError: Name is null and i...
[ "Inserts", "a", "new", "Group", "L3", "and", "returns", "its", "identifier", "." ]
python
train
googleapis/google-cloud-python
storage/google/cloud/storage/bucket.py
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/bucket.py#L1195-L1211
def labels(self, mapping): """Set labels assigned to this bucket. See https://cloud.google.com/storage/docs/json_api/v1/buckets#labels :type mapping: :class:`dict` :param mapping: Name-value pairs (string->string) labelling the bucket. """ # If any labels have b...
[ "def", "labels", "(", "self", ",", "mapping", ")", ":", "# If any labels have been expressly removed, we need to track this", "# so that a future .patch() call can do the correct thing.", "existing", "=", "set", "(", "[", "k", "for", "k", "in", "self", ".", "labels", ".",...
Set labels assigned to this bucket. See https://cloud.google.com/storage/docs/json_api/v1/buckets#labels :type mapping: :class:`dict` :param mapping: Name-value pairs (string->string) labelling the bucket.
[ "Set", "labels", "assigned", "to", "this", "bucket", "." ]
python
train
pypa/bandersnatch
src/bandersnatch_filter_plugins/prerelease_name.py
https://github.com/pypa/bandersnatch/blob/8b702c3bc128c5a1cbdd18890adede2f7f17fad4/src/bandersnatch_filter_plugins/prerelease_name.py#L29-L35
def filter(self, info, releases): """ Remove all release versions that match any of the specificed patterns. """ for version in list(releases.keys()): if any(pattern.match(version) for pattern in self.patterns): del releases[version]
[ "def", "filter", "(", "self", ",", "info", ",", "releases", ")", ":", "for", "version", "in", "list", "(", "releases", ".", "keys", "(", ")", ")", ":", "if", "any", "(", "pattern", ".", "match", "(", "version", ")", "for", "pattern", "in", "self", ...
Remove all release versions that match any of the specificed patterns.
[ "Remove", "all", "release", "versions", "that", "match", "any", "of", "the", "specificed", "patterns", "." ]
python
train
nickmckay/LiPD-utilities
Python/lipd/__init__.py
https://github.com/nickmckay/LiPD-utilities/blob/5dab6bbeffc5effd68e3a6beaca6b76aa928e860/Python/lipd/__init__.py#L535-L573
def queryTs(ts, expression): """ Find the indices of the time series entries that match the given expression. | Example: | D = lipd.loadLipd() | ts = lipd.extractTs(D) | matches = queryTs(ts, "archiveType == marine sediment") | matches = queryTs(ts, "geo_meanElev <= 2000") :param str e...
[ "def", "queryTs", "(", "ts", ",", "expression", ")", ":", "# Make a copy of the ts. We're going to work directly on it.", "_idx", "=", "[", "]", "# User provided a single query string", "if", "isinstance", "(", "expressions", ",", "str", ")", ":", "# Use some magic to tur...
Find the indices of the time series entries that match the given expression. | Example: | D = lipd.loadLipd() | ts = lipd.extractTs(D) | matches = queryTs(ts, "archiveType == marine sediment") | matches = queryTs(ts, "geo_meanElev <= 2000") :param str expression: Expression :param list ts:...
[ "Find", "the", "indices", "of", "the", "time", "series", "entries", "that", "match", "the", "given", "expression", "." ]
python
train
brunato/lograptor
lograptor/filemap.py
https://github.com/brunato/lograptor/blob/b1f09fe1b429ed15110610092704ef12d253f3c9/lograptor/filemap.py#L212-L224
def add(self, files, items): """ Add a list of files with a reference to a list of objects. """ if isinstance(files, (str, bytes)): files = iter([files]) for pathname in files: try: values = self._filemap[pathname] except KeyErr...
[ "def", "add", "(", "self", ",", "files", ",", "items", ")", ":", "if", "isinstance", "(", "files", ",", "(", "str", ",", "bytes", ")", ")", ":", "files", "=", "iter", "(", "[", "files", "]", ")", "for", "pathname", "in", "files", ":", "try", ":...
Add a list of files with a reference to a list of objects.
[ "Add", "a", "list", "of", "files", "with", "a", "reference", "to", "a", "list", "of", "objects", "." ]
python
train
securestate/termineter
lib/termineter/interface.py
https://github.com/securestate/termineter/blob/d657d25d97c7739e650b951c396404e857e56625/lib/termineter/interface.py#L535-L562
def do_show(self, args): """Valid parameters for the "show" command are: modules, options""" self.print_line('') if args.thing == 'modules': self.print_line('Modules' + os.linesep + '=======') headers = ('Name', 'Description') rows = [(module.path, module.description) for module in self.frmwk.modules.val...
[ "def", "do_show", "(", "self", ",", "args", ")", ":", "self", ".", "print_line", "(", "''", ")", "if", "args", ".", "thing", "==", "'modules'", ":", "self", ".", "print_line", "(", "'Modules'", "+", "os", ".", "linesep", "+", "'======='", ")", "heade...
Valid parameters for the "show" command are: modules, options
[ "Valid", "parameters", "for", "the", "show", "command", "are", ":", "modules", "options" ]
python
train
paolodragone/pymzn
pymzn/dzn/marsh.py
https://github.com/paolodragone/pymzn/blob/35b04cfb244918551649b9bb8a0ab65d37c31fe4/pymzn/dzn/marsh.py#L394-L417
def rebase_array(d, recursive=False): """Transform an indexed dictionary (such as those returned by the dzn2dict function when parsing arrays) into an multi-dimensional list. Parameters ---------- d : dict The indexed dictionary to convert. bool : recursive Whether to rebase the...
[ "def", "rebase_array", "(", "d", ",", "recursive", "=", "False", ")", ":", "arr", "=", "[", "]", "min_val", ",", "max_val", "=", "_extremes", "(", "d", ".", "keys", "(", ")", ")", "for", "idx", "in", "range", "(", "min_val", ",", "max_val", "+", ...
Transform an indexed dictionary (such as those returned by the dzn2dict function when parsing arrays) into an multi-dimensional list. Parameters ---------- d : dict The indexed dictionary to convert. bool : recursive Whether to rebase the array recursively. Returns ------- ...
[ "Transform", "an", "indexed", "dictionary", "(", "such", "as", "those", "returned", "by", "the", "dzn2dict", "function", "when", "parsing", "arrays", ")", "into", "an", "multi", "-", "dimensional", "list", "." ]
python
train
ianmiell/shutit
shutit_class.py
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L117-L126
def get_config_set(self, section, option): """Returns a set with each value per config file in it. """ values = set() for cp, filename, fp in self.layers: filename = filename # pylint fp = fp # pylint if cp.has_option(section, option): values.add(cp.get(section, option)) return values
[ "def", "get_config_set", "(", "self", ",", "section", ",", "option", ")", ":", "values", "=", "set", "(", ")", "for", "cp", ",", "filename", ",", "fp", "in", "self", ".", "layers", ":", "filename", "=", "filename", "# pylint", "fp", "=", "fp", "# pyl...
Returns a set with each value per config file in it.
[ "Returns", "a", "set", "with", "each", "value", "per", "config", "file", "in", "it", "." ]
python
train
jalanb/pysyte
pysyte/decorators.py
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/decorators.py#L135-L143
def globber(main_method, globs): """Recognise globs in args""" import os from glob import glob def main(arguments): lists_of_paths = [_ for _ in arguments if glob(pathname, recursive=True)] return main_method(arguments, lists_of_paths) return main
[ "def", "globber", "(", "main_method", ",", "globs", ")", ":", "import", "os", "from", "glob", "import", "glob", "def", "main", "(", "arguments", ")", ":", "lists_of_paths", "=", "[", "_", "for", "_", "in", "arguments", "if", "glob", "(", "pathname", ",...
Recognise globs in args
[ "Recognise", "globs", "in", "args" ]
python
train
ClericPy/torequests
torequests/utils.py
https://github.com/ClericPy/torequests/blob/1793261688d7a47e1c3a0830d83f8552f5e3e5d9/torequests/utils.py#L1460-L1499
def find_one(cls, pattern, string, flags=0): """JS-like match object. Use index number to get groups, if not match or no group, will return ''. Basic Usage:: >>> from torequests.utils import find_one >>> string = "abcd" >>> find_one("a.*", string) <toreq...
[ "def", "find_one", "(", "cls", ",", "pattern", ",", "string", ",", "flags", "=", "0", ")", ":", "item", "=", "re", ".", "search", "(", "pattern", ",", "string", ",", "flags", "=", "flags", ")", "return", "cls", "(", "item", ")" ]
JS-like match object. Use index number to get groups, if not match or no group, will return ''. Basic Usage:: >>> from torequests.utils import find_one >>> string = "abcd" >>> find_one("a.*", string) <torequests.utils.RegMatch object at 0x0705F1D0> >...
[ "JS", "-", "like", "match", "object", ".", "Use", "index", "number", "to", "get", "groups", "if", "not", "match", "or", "no", "group", "will", "return", "." ]
python
train
mosdef-hub/mbuild
mbuild/utils/geometry.py
https://github.com/mosdef-hub/mbuild/blob/dcb80a2becd5d0e6a7e3e7bcb1b59793c46a2dd3/mbuild/utils/geometry.py#L6-L26
def calc_dihedral(point1, point2, point3, point4): """Calculates a dihedral angle Here, two planes are defined by (point1, point2, point3) and (point2, point3, point4). The angle between them is returned. Parameters ---------- point1, point2, point3, point4 : array-like, shape=(3,), dtype=floa...
[ "def", "calc_dihedral", "(", "point1", ",", "point2", ",", "point3", ",", "point4", ")", ":", "points", "=", "np", ".", "array", "(", "[", "point1", ",", "point2", ",", "point3", ",", "point4", "]", ")", "x", "=", "np", ".", "cross", "(", "points",...
Calculates a dihedral angle Here, two planes are defined by (point1, point2, point3) and (point2, point3, point4). The angle between them is returned. Parameters ---------- point1, point2, point3, point4 : array-like, shape=(3,), dtype=float Four points that define two planes Returns ...
[ "Calculates", "a", "dihedral", "angle" ]
python
train
6809/dragonlib
dragonlib/core/basic.py
https://github.com/6809/dragonlib/blob/faa4011e76c5857db96efdb4199e2fd49711e999/dragonlib/core/basic.py#L136-L149
def pformat_tokens(self, tokens): """ format a tokenized BASIC program line. Useful for debugging. returns a list of formated string lines. """ result = [] for token_value in self.iter_token_values(tokens): char = self.token2ascii(token_value) if t...
[ "def", "pformat_tokens", "(", "self", ",", "tokens", ")", ":", "result", "=", "[", "]", "for", "token_value", "in", "self", ".", "iter_token_values", "(", "tokens", ")", ":", "char", "=", "self", ".", "token2ascii", "(", "token_value", ")", "if", "token_...
format a tokenized BASIC program line. Useful for debugging. returns a list of formated string lines.
[ "format", "a", "tokenized", "BASIC", "program", "line", ".", "Useful", "for", "debugging", ".", "returns", "a", "list", "of", "formated", "string", "lines", "." ]
python
train
anteater/anteater
anteater/src/virus_total.py
https://github.com/anteater/anteater/blob/a980adbed8563ef92494f565acd371e91f50f155/anteater/src/virus_total.py#L156-L172
def url_report(self, scan_url, apikey): """ Send URLS for list of past malicous associations """ url = self.base_url + "url/report" params = {"apikey": apikey, 'resource': scan_url} rate_limit_clear = self.rate_limit() if rate_limit_clear: response = r...
[ "def", "url_report", "(", "self", ",", "scan_url", ",", "apikey", ")", ":", "url", "=", "self", ".", "base_url", "+", "\"url/report\"", "params", "=", "{", "\"apikey\"", ":", "apikey", ",", "'resource'", ":", "scan_url", "}", "rate_limit_clear", "=", "self...
Send URLS for list of past malicous associations
[ "Send", "URLS", "for", "list", "of", "past", "malicous", "associations" ]
python
train
apache/incubator-heron
heronpy/api/metrics.py
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heronpy/api/metrics.py#L58-L62
def incr(self, key, to_add=1): """Increments the value of a given key by ``to_add``""" if key not in self.value: self.value[key] = CountMetric() self.value[key].incr(to_add)
[ "def", "incr", "(", "self", ",", "key", ",", "to_add", "=", "1", ")", ":", "if", "key", "not", "in", "self", ".", "value", ":", "self", ".", "value", "[", "key", "]", "=", "CountMetric", "(", ")", "self", ".", "value", "[", "key", "]", ".", "...
Increments the value of a given key by ``to_add``
[ "Increments", "the", "value", "of", "a", "given", "key", "by", "to_add" ]
python
valid
dmlc/xgboost
python-package/xgboost/core.py
https://github.com/dmlc/xgboost/blob/253fdd8a42d5ec6b819788199584d27bf9ea6253/python-package/xgboost/core.py#L445-L459
def _init_from_csc(self, csc): """ Initialize data from a CSC matrix. """ if len(csc.indices) != len(csc.data): raise ValueError('length mismatch: {} vs {}'.format(len(csc.indices), len(csc.data))) handle = ctypes.c_void_p() _check_call(_LIB.XGDMatrixCreateFro...
[ "def", "_init_from_csc", "(", "self", ",", "csc", ")", ":", "if", "len", "(", "csc", ".", "indices", ")", "!=", "len", "(", "csc", ".", "data", ")", ":", "raise", "ValueError", "(", "'length mismatch: {} vs {}'", ".", "format", "(", "len", "(", "csc", ...
Initialize data from a CSC matrix.
[ "Initialize", "data", "from", "a", "CSC", "matrix", "." ]
python
train
threeML/astromodels
astromodels/core/tree.py
https://github.com/threeML/astromodels/blob/9aac365a372f77603039533df9a6b694c1e360d5/astromodels/core/tree.py#L299-L329
def _find_instances(self, cls): """ Find all the instances of cls below this node. :return: a dictionary of instances of cls """ instances = collections.OrderedDict() for child_name, child in self._children.iteritems(): if isinstance(child, cls): ...
[ "def", "_find_instances", "(", "self", ",", "cls", ")", ":", "instances", "=", "collections", ".", "OrderedDict", "(", ")", "for", "child_name", ",", "child", "in", "self", ".", "_children", ".", "iteritems", "(", ")", ":", "if", "isinstance", "(", "chil...
Find all the instances of cls below this node. :return: a dictionary of instances of cls
[ "Find", "all", "the", "instances", "of", "cls", "below", "this", "node", "." ]
python
train
alkivi-sas/python-alkivi-logger
alkivi/logger/logger.py
https://github.com/alkivi-sas/python-alkivi-logger/blob/e96d5a987a5c8789c51d4fa7541709e05b1f51e1/alkivi/logger/logger.py#L93-L96
def warning(self, message, *args, **kwargs): """Alias to warn """ self._log(logging.WARNING, message, *args, **kwargs)
[ "def", "warning", "(", "self", ",", "message", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_log", "(", "logging", ".", "WARNING", ",", "message", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
Alias to warn
[ "Alias", "to", "warn" ]
python
train
materialsvirtuallab/monty
monty/io.py
https://github.com/materialsvirtuallab/monty/blob/d99d6f3c68372d83489d28ff515566c93cd569e2/monty/io.py#L252-L260
def release(self): """ Get rid of the lock by deleting the lockfile. When working in a `with` statement, this gets automatically called at the end. """ if self.is_locked: os.close(self.fd) os.unlink(self.lockfile) self.is_locked = False
[ "def", "release", "(", "self", ")", ":", "if", "self", ".", "is_locked", ":", "os", ".", "close", "(", "self", ".", "fd", ")", "os", ".", "unlink", "(", "self", ".", "lockfile", ")", "self", ".", "is_locked", "=", "False" ]
Get rid of the lock by deleting the lockfile. When working in a `with` statement, this gets automatically called at the end.
[ "Get", "rid", "of", "the", "lock", "by", "deleting", "the", "lockfile", ".", "When", "working", "in", "a", "with", "statement", "this", "gets", "automatically", "called", "at", "the", "end", "." ]
python
train
Qiskit/qiskit-terra
qiskit/pulse/pulse_lib/continuous.py
https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/pulse/pulse_lib/continuous.py#L75-L84
def cos(times: np.ndarray, amp: complex, freq: float, phase: float = 0) -> np.ndarray: """Continuous cosine wave. Args: times: Times to output wave for. amp: Pulse amplitude. freq: Pulse frequency, units of 1/dt. phase: Pulse phase. """ return amp*np.cos(2*np.pi*freq*tim...
[ "def", "cos", "(", "times", ":", "np", ".", "ndarray", ",", "amp", ":", "complex", ",", "freq", ":", "float", ",", "phase", ":", "float", "=", "0", ")", "->", "np", ".", "ndarray", ":", "return", "amp", "*", "np", ".", "cos", "(", "2", "*", "...
Continuous cosine wave. Args: times: Times to output wave for. amp: Pulse amplitude. freq: Pulse frequency, units of 1/dt. phase: Pulse phase.
[ "Continuous", "cosine", "wave", "." ]
python
test
DataONEorg/d1_python
lib_common/src/d1_common/resource_map.py
https://github.com/DataONEorg/d1_python/blob/3ac4d4f3ca052d3e8641a6a329cab526c8ddcb0d/lib_common/src/d1_common/resource_map.py#L371-L388
def setDocumentedBy(self, documented_pid, documenting_pid): """Add a CiTO, the Citation Typing Ontology, triple asserting that ``documented_pid`` isDocumentedBy ``documenting_pid``. Adds assertion: ``documented_pid cito:isDocumentedBy documenting_pid`` Args: documented_pid: s...
[ "def", "setDocumentedBy", "(", "self", ",", "documented_pid", ",", "documenting_pid", ")", ":", "self", ".", "_check_initialized", "(", ")", "documented_id", "=", "self", ".", "getObjectByPid", "(", "documented_pid", ")", "documenting_id", "=", "self", ".", "get...
Add a CiTO, the Citation Typing Ontology, triple asserting that ``documented_pid`` isDocumentedBy ``documenting_pid``. Adds assertion: ``documented_pid cito:isDocumentedBy documenting_pid`` Args: documented_pid: str PID of a Science Object that is documented by ``document...
[ "Add", "a", "CiTO", "the", "Citation", "Typing", "Ontology", "triple", "asserting", "that", "documented_pid", "isDocumentedBy", "documenting_pid", "." ]
python
train
saltstack/salt
salt/modules/highstate_doc.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/highstate_doc.py#L424-L461
def render(jinja_template_text=None, jinja_template_function='highstate_doc.markdown_default_jinja_template', **kwargs): ''' Render highstate to a text format (default Markdown) if `jinja_template_text` is not set, `jinja_template_function` is used. jinja_template_text: jinja text that the render uses...
[ "def", "render", "(", "jinja_template_text", "=", "None", ",", "jinja_template_function", "=", "'highstate_doc.markdown_default_jinja_template'", ",", "*", "*", "kwargs", ")", ":", "config", "=", "_get_config", "(", "*", "*", "kwargs", ")", "lowstates", "=", "proc...
Render highstate to a text format (default Markdown) if `jinja_template_text` is not set, `jinja_template_function` is used. jinja_template_text: jinja text that the render uses to create the document. jinja_template_function: a salt module call that returns template text. options: hig...
[ "Render", "highstate", "to", "a", "text", "format", "(", "default", "Markdown", ")" ]
python
train
edaniszewski/pylint-quotes
pylint_quotes/checker.py
https://github.com/edaniszewski/pylint-quotes/blob/f13529541d6d787b5b37611a080937f5adba6357/pylint_quotes/checker.py#L364-L377
def _invalid_triple_quote(self, quote, row, col=None): """Add a message for an invalid triple quote. Args: quote: The quote characters that were found. row: The row number the quote characters were found on. col: The column the quote characters were found on. ...
[ "def", "_invalid_triple_quote", "(", "self", ",", "quote", ",", "row", ",", "col", "=", "None", ")", ":", "self", ".", "add_message", "(", "'invalid-triple-quote'", ",", "line", "=", "row", ",", "args", "=", "(", "quote", ",", "TRIPLE_QUOTE_OPTS", ".", "...
Add a message for an invalid triple quote. Args: quote: The quote characters that were found. row: The row number the quote characters were found on. col: The column the quote characters were found on.
[ "Add", "a", "message", "for", "an", "invalid", "triple", "quote", "." ]
python
train
coinbase/coinbase-python
coinbase/wallet/client.py
https://github.com/coinbase/coinbase-python/blob/497c28158f529e8c7d0228521b4386a890baf088/coinbase/wallet/client.py#L411-L414
def get_reports(self, **params): """https://developers.coinbase.com/api/v2#list-all-reports""" response = self._get('v2', 'reports', data=params) return self._make_api_object(response, Report)
[ "def", "get_reports", "(", "self", ",", "*", "*", "params", ")", ":", "response", "=", "self", ".", "_get", "(", "'v2'", ",", "'reports'", ",", "data", "=", "params", ")", "return", "self", ".", "_make_api_object", "(", "response", ",", "Report", ")" ]
https://developers.coinbase.com/api/v2#list-all-reports
[ "https", ":", "//", "developers", ".", "coinbase", ".", "com", "/", "api", "/", "v2#list", "-", "all", "-", "reports" ]
python
train
ratt-ru/PyMORESANE
pymoresane/main.py
https://github.com/ratt-ru/PyMORESANE/blob/b024591ad0bbb69320d08841f28a2c27f62ae1af/pymoresane/main.py#L53-L521
def moresane(self, subregion=None, scale_count=None, sigma_level=4, loop_gain=0.1, tolerance=0.75, accuracy=1e-6, major_loop_miter=100, minor_loop_miter=30, all_on_gpu=False, decom_mode="ser", core_count=1, conv_device='cpu', conv_mode='linear', extraction_mode='cpu', enforce_positivit...
[ "def", "moresane", "(", "self", ",", "subregion", "=", "None", ",", "scale_count", "=", "None", ",", "sigma_level", "=", "4", ",", "loop_gain", "=", "0.1", ",", "tolerance", "=", "0.75", ",", "accuracy", "=", "1e-6", ",", "major_loop_miter", "=", "100", ...
Primary method for wavelet analysis and subsequent deconvolution. INPUTS: subregion (default=None): Size, in pixels, of the central region to be analyzed and deconvolved. scale_count (default=None): Maximum scale to be considered - maximum scale considered during ...
[ "Primary", "method", "for", "wavelet", "analysis", "and", "subsequent", "deconvolution", "." ]
python
train
Robin8Put/pmes
ams/utils/tornado_components/mongo.py
https://github.com/Robin8Put/pmes/blob/338bec94162098f05b75bad035417317e1252fd2/ams/utils/tornado_components/mongo.py#L36-L58
async def read(self, *_id): """Read data from database table. Accepts ids of entries. Returns list of results if success or string with error code and explanation. read(*id) => [(result), (result)] (if success) read(*id) => [] (if missed) read() => {"error":400, "reason":"Missed required fields"} """ ...
[ "async", "def", "read", "(", "self", ",", "*", "_id", ")", ":", "if", "not", "_id", ":", "return", "{", "\"error\"", ":", "400", ",", "\"reason\"", ":", "\"Missed required fields\"", "}", "result", "=", "[", "]", "for", "i", "in", "_id", ":", "docume...
Read data from database table. Accepts ids of entries. Returns list of results if success or string with error code and explanation. read(*id) => [(result), (result)] (if success) read(*id) => [] (if missed) read() => {"error":400, "reason":"Missed required fields"}
[ "Read", "data", "from", "database", "table", ".", "Accepts", "ids", "of", "entries", ".", "Returns", "list", "of", "results", "if", "success", "or", "string", "with", "error", "code", "and", "explanation", "." ]
python
train
mbedmicro/pyOCD
pyocd/target/pack/flash_algo.py
https://github.com/mbedmicro/pyOCD/blob/41a174718a9739f3cbe785c2ba21cb7fd1310c6f/pyocd/target/pack/flash_algo.py#L177-L188
def _extract_symbols(self, symbols, default=None): """! @brief Fill 'symbols' field with required flash algo symbols""" to_ret = {} for symbol in symbols: symbolInfo = self.elf.symbol_decoder.get_symbol_for_name(symbol) if symbolInfo is None: if default is...
[ "def", "_extract_symbols", "(", "self", ",", "symbols", ",", "default", "=", "None", ")", ":", "to_ret", "=", "{", "}", "for", "symbol", "in", "symbols", ":", "symbolInfo", "=", "self", ".", "elf", ".", "symbol_decoder", ".", "get_symbol_for_name", "(", ...
! @brief Fill 'symbols' field with required flash algo symbols
[ "!" ]
python
train
sqreen/PyMiniRacer
py_mini_racer/py_mini_racer.py
https://github.com/sqreen/PyMiniRacer/blob/86747cddb13895ccaba990704ad68e5e059587f9/py_mini_racer/py_mini_racer.py#L168-L180
def call(self, identifier, *args, **kwargs): """ Call the named function with provided arguments You can pass a custom JSON encoder by passing it in the encoder keyword only argument. """ encoder = kwargs.get('encoder', None) timeout = kwargs.get('timeout', 0) ma...
[ "def", "call", "(", "self", ",", "identifier", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "encoder", "=", "kwargs", ".", "get", "(", "'encoder'", ",", "None", ")", "timeout", "=", "kwargs", ".", "get", "(", "'timeout'", ",", "0", ")", "...
Call the named function with provided arguments You can pass a custom JSON encoder by passing it in the encoder keyword only argument.
[ "Call", "the", "named", "function", "with", "provided", "arguments", "You", "can", "pass", "a", "custom", "JSON", "encoder", "by", "passing", "it", "in", "the", "encoder", "keyword", "only", "argument", "." ]
python
train
Hackerfleet/hfos
hfos/component.py
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/hfos/component.py#L255-L267
def _read_config(self): """Read this component's configuration from the database""" try: self.config = self.componentmodel.find_one( {'name': self.uniquename}) except ServerSelectionTimeoutError: # pragma: no cover self.log("No database access! Check if ...
[ "def", "_read_config", "(", "self", ")", ":", "try", ":", "self", ".", "config", "=", "self", ".", "componentmodel", ".", "find_one", "(", "{", "'name'", ":", "self", ".", "uniquename", "}", ")", "except", "ServerSelectionTimeoutError", ":", "# pragma: no co...
Read this component's configuration from the database
[ "Read", "this", "component", "s", "configuration", "from", "the", "database" ]
python
train
SheffieldML/GPy
GPy/core/symbolic.py
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/core/symbolic.py#L255-L283
def update_expression_list(self): """Extract a list of expressions from the dictionary of expressions.""" self.expression_list = [] # code arrives in dictionary, but is passed in this list self.expression_keys = [] # Keep track of the dictionary keys. self.expression_order = [] # This ma...
[ "def", "update_expression_list", "(", "self", ")", ":", "self", ".", "expression_list", "=", "[", "]", "# code arrives in dictionary, but is passed in this list", "self", ".", "expression_keys", "=", "[", "]", "# Keep track of the dictionary keys.", "self", ".", "expressi...
Extract a list of expressions from the dictionary of expressions.
[ "Extract", "a", "list", "of", "expressions", "from", "the", "dictionary", "of", "expressions", "." ]
python
train
astropy/astropy-helpers
astropy_helpers/setup_helpers.py
https://github.com/astropy/astropy-helpers/blob/f5a27d3f84a98ea0eebb85e0cf3e7214c6bc0d09/astropy_helpers/setup_helpers.py#L357-L369
def update_package_files(srcdir, extensions, package_data, packagenames, package_dirs): """ This function is deprecated and maintained for backward compatibility with affiliated packages. Affiliated packages should update their setup.py to use `get_package_info` instead. ""...
[ "def", "update_package_files", "(", "srcdir", ",", "extensions", ",", "package_data", ",", "packagenames", ",", "package_dirs", ")", ":", "info", "=", "get_package_info", "(", "srcdir", ")", "extensions", ".", "extend", "(", "info", "[", "'ext_modules'", "]", ...
This function is deprecated and maintained for backward compatibility with affiliated packages. Affiliated packages should update their setup.py to use `get_package_info` instead.
[ "This", "function", "is", "deprecated", "and", "maintained", "for", "backward", "compatibility", "with", "affiliated", "packages", ".", "Affiliated", "packages", "should", "update", "their", "setup", ".", "py", "to", "use", "get_package_info", "instead", "." ]
python
train
proycon/clam
clam/common/parameters.py
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/parameters.py#L582-L594
def set(self, value): """This parameter method attempts to set a specific value for this parameter. The value will be validated first, and if it can not be set. An error message will be set in the error property of this parameter""" if self.validate(value): #print "Parameter " + self.id + " ...
[ "def", "set", "(", "self", ",", "value", ")", ":", "if", "self", ".", "validate", "(", "value", ")", ":", "#print \"Parameter \" + self.id + \" successfully set to \" + repr(value)", "self", ".", "hasvalue", "=", "True", "if", "isinstance", "(", "value", ",", "f...
This parameter method attempts to set a specific value for this parameter. The value will be validated first, and if it can not be set. An error message will be set in the error property of this parameter
[ "This", "parameter", "method", "attempts", "to", "set", "a", "specific", "value", "for", "this", "parameter", ".", "The", "value", "will", "be", "validated", "first", "and", "if", "it", "can", "not", "be", "set", ".", "An", "error", "message", "will", "b...
python
train
lalinsky/python-phoenixdb
phoenixdb/cursor.py
https://github.com/lalinsky/python-phoenixdb/blob/1bb34488dd530ca65f91b29ef16aa7b71f26b806/phoenixdb/cursor.py#L86-L102
def close(self): """Closes the cursor. No further operations are allowed once the cursor is closed. If the cursor is used in a ``with`` statement, this method will be automatically called at the end of the ``with`` block. """ if self._closed: raise Programmin...
[ "def", "close", "(", "self", ")", ":", "if", "self", ".", "_closed", ":", "raise", "ProgrammingError", "(", "'the cursor is already closed'", ")", "if", "self", ".", "_id", "is", "not", "None", ":", "self", ".", "_connection", ".", "_client", ".", "close_s...
Closes the cursor. No further operations are allowed once the cursor is closed. If the cursor is used in a ``with`` statement, this method will be automatically called at the end of the ``with`` block.
[ "Closes", "the", "cursor", ".", "No", "further", "operations", "are", "allowed", "once", "the", "cursor", "is", "closed", "." ]
python
train
django-parler/django-parler
parler/models.py
https://github.com/django-parler/django-parler/blob/11ae4af5e8faddb74c69c848870122df4006a54e/parler/models.py#L678-L700
def save_translations(self, *args, **kwargs): """ The method to save all translations. This can be overwritten to implement any custom additions. This method calls :func:`save_translation` for every fetched language. :param args: Any custom arguments to pass to :func:`save`. ...
[ "def", "save_translations", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# Copy cache, new objects (e.g. fallbacks) might be fetched if users override save_translation()", "# Not looping over the cache, but using _parler_meta so the translations are processed in the...
The method to save all translations. This can be overwritten to implement any custom additions. This method calls :func:`save_translation` for every fetched language. :param args: Any custom arguments to pass to :func:`save`. :param kwargs: Any custom arguments to pass to :func:`save`.
[ "The", "method", "to", "save", "all", "translations", ".", "This", "can", "be", "overwritten", "to", "implement", "any", "custom", "additions", ".", "This", "method", "calls", ":", "func", ":", "save_translation", "for", "every", "fetched", "language", "." ]
python
train
astraw/stdeb
stdeb/util.py
https://github.com/astraw/stdeb/blob/493ab88e8a60be053b1baef81fb39b45e17ceef5/stdeb/util.py#L261-L269
def get_date_822(): """return output of 822-date command""" cmd = '/bin/date' if not os.path.exists(cmd): raise ValueError('%s command does not exist.'%cmd) args = [cmd,'-R'] result = get_cmd_stdout(args).strip() result = normstr(result) return result
[ "def", "get_date_822", "(", ")", ":", "cmd", "=", "'/bin/date'", "if", "not", "os", ".", "path", ".", "exists", "(", "cmd", ")", ":", "raise", "ValueError", "(", "'%s command does not exist.'", "%", "cmd", ")", "args", "=", "[", "cmd", ",", "'-R'", "]"...
return output of 822-date command
[ "return", "output", "of", "822", "-", "date", "command" ]
python
train
skorch-dev/skorch
skorch/net.py
https://github.com/skorch-dev/skorch/blob/5b9b8b7b7712cb6e5aaa759d9608ea6269d5bcd3/skorch/net.py#L504-L535
def initialize_optimizer(self, triggered_directly=True): """Initialize the model optimizer. If ``self.optimizer__lr`` is not set, use ``self.lr`` instead. Parameters ---------- triggered_directly : bool (default=True) Only relevant when optimizer is re-initialized. ...
[ "def", "initialize_optimizer", "(", "self", ",", "triggered_directly", "=", "True", ")", ":", "args", ",", "kwargs", "=", "self", ".", "_get_params_for_optimizer", "(", "'optimizer'", ",", "self", ".", "module_", ".", "named_parameters", "(", ")", ")", "if", ...
Initialize the model optimizer. If ``self.optimizer__lr`` is not set, use ``self.lr`` instead. Parameters ---------- triggered_directly : bool (default=True) Only relevant when optimizer is re-initialized. Initialization of the optimizer can be triggered directly ...
[ "Initialize", "the", "model", "optimizer", ".", "If", "self", ".", "optimizer__lr", "is", "not", "set", "use", "self", ".", "lr", "instead", "." ]
python
train
twilio/twilio-python
twilio/rest/studio/v1/flow/engagement/step/__init__.py
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/studio/v1/flow/engagement/step/__init__.py#L255-L269
def step_context(self): """ Access the step_context :returns: twilio.rest.studio.v1.flow.engagement.step.step_context.StepContextList :rtype: twilio.rest.studio.v1.flow.engagement.step.step_context.StepContextList """ if self._step_context is None: self._step...
[ "def", "step_context", "(", "self", ")", ":", "if", "self", ".", "_step_context", "is", "None", ":", "self", ".", "_step_context", "=", "StepContextList", "(", "self", ".", "_version", ",", "flow_sid", "=", "self", ".", "_solution", "[", "'flow_sid'", "]",...
Access the step_context :returns: twilio.rest.studio.v1.flow.engagement.step.step_context.StepContextList :rtype: twilio.rest.studio.v1.flow.engagement.step.step_context.StepContextList
[ "Access", "the", "step_context" ]
python
train
HDI-Project/MLPrimitives
mlprimitives/candidates/timeseries_errors.py
https://github.com/HDI-Project/MLPrimitives/blob/bf415f9f751724ff545a1156ddfd7524e320f469/mlprimitives/candidates/timeseries_errors.py#L128-L183
def compute_threshold(smoothed_errors, error_buffer, sd_limit=12.0): """Helper method for `extract_anomalies` method. Calculates the epsilon (threshold) for anomalies. """ mu = np.mean(smoothed_errors) sigma = np.std(smoothed_errors) max_epsilon = 0 sd_threshold = sd_limit # The tresho...
[ "def", "compute_threshold", "(", "smoothed_errors", ",", "error_buffer", ",", "sd_limit", "=", "12.0", ")", ":", "mu", "=", "np", ".", "mean", "(", "smoothed_errors", ")", "sigma", "=", "np", ".", "std", "(", "smoothed_errors", ")", "max_epsilon", "=", "0"...
Helper method for `extract_anomalies` method. Calculates the epsilon (threshold) for anomalies.
[ "Helper", "method", "for", "extract_anomalies", "method", ".", "Calculates", "the", "epsilon", "(", "threshold", ")", "for", "anomalies", "." ]
python
train
Yubico/yubikey-manager
ykman/cli/piv.py
https://github.com/Yubico/yubikey-manager/blob/3ac27bc59ae76a59db9d09a530494add2edbbabf/ykman/cli/piv.py#L635-L670
def change_pin(ctx, pin, new_pin): """ Change the PIN code. The PIN must be between 6 and 8 characters long, and supports any type of alphanumeric characters. For cross-platform compatibility, numeric digits are recommended. """ controller = ctx.obj['controller'] if not pin: p...
[ "def", "change_pin", "(", "ctx", ",", "pin", ",", "new_pin", ")", ":", "controller", "=", "ctx", ".", "obj", "[", "'controller'", "]", "if", "not", "pin", ":", "pin", "=", "_prompt_pin", "(", "ctx", ",", "prompt", "=", "'Enter your current PIN'", ")", ...
Change the PIN code. The PIN must be between 6 and 8 characters long, and supports any type of alphanumeric characters. For cross-platform compatibility, numeric digits are recommended.
[ "Change", "the", "PIN", "code", "." ]
python
train
foremast/foremast
src/foremast/awslambda/cloudwatch_event/destroy_cloudwatch_event/destroy_cloudwatch_event.py
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/awslambda/cloudwatch_event/destroy_cloudwatch_event/destroy_cloudwatch_event.py#L26-L45
def destroy_cloudwatch_event(app='', env='dev', region=''): """Destroy Cloudwatch event subscription. Args: app (str): Spinnaker Application name. env (str): Deployment environment. region (str): AWS region. Returns: bool: True upon successful completion. """ sessio...
[ "def", "destroy_cloudwatch_event", "(", "app", "=", "''", ",", "env", "=", "'dev'", ",", "region", "=", "''", ")", ":", "session", "=", "boto3", ".", "Session", "(", "profile_name", "=", "env", ",", "region_name", "=", "region", ")", "cloudwatch_client", ...
Destroy Cloudwatch event subscription. Args: app (str): Spinnaker Application name. env (str): Deployment environment. region (str): AWS region. Returns: bool: True upon successful completion.
[ "Destroy", "Cloudwatch", "event", "subscription", "." ]
python
train
MacHu-GWU/angora-project
angora/text/strtemplate.py
https://github.com/MacHu-GWU/angora-project/blob/689a60da51cd88680ddbe26e28dbe81e6b01d275/angora/text/strtemplate.py#L98-L102
def box_show(text, width=100, height=3, corner="+", horizontal="-", vertical="|"): """Print a formatted ascii text box. """ print(StrTemplate.box(text=text, width=width, height=height, corner=corner, horizontal=horizontal, vertical=vertical))
[ "def", "box_show", "(", "text", ",", "width", "=", "100", ",", "height", "=", "3", ",", "corner", "=", "\"+\"", ",", "horizontal", "=", "\"-\"", ",", "vertical", "=", "\"|\"", ")", ":", "print", "(", "StrTemplate", ".", "box", "(", "text", "=", "te...
Print a formatted ascii text box.
[ "Print", "a", "formatted", "ascii", "text", "box", "." ]
python
train
Vital-Fernandez/dazer
bin/lib/Astro_Libraries/f2n.py
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/bin/lib/Astro_Libraries/f2n.py#L656-L663
def loadtitlefont(self): """Auxiliary method to load font if not yet done.""" if self.titlefont == None: # print 'the bloody fonts dir is????', fontsdir # print 'pero esto que hace??', os.path.join(fontsdir, "courR18.pil") # /home/vital/Workspace/pyResources/Scientifi...
[ "def", "loadtitlefont", "(", "self", ")", ":", "if", "self", ".", "titlefont", "==", "None", ":", "# print 'the bloody fonts dir is????', fontsdir", "# print 'pero esto que hace??', os.path.join(fontsdir, \"courR18.pil\")", "# /home/vital/Workspace/p...
Auxiliary method to load font if not yet done.
[ "Auxiliary", "method", "to", "load", "font", "if", "not", "yet", "done", "." ]
python
train
spyder-ide/spyder
spyder/plugins/editor/plugin.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/plugin.py#L1373-L1379
def refresh_save_all_action(self): """Enable 'Save All' if there are files to be saved""" editorstack = self.get_current_editorstack() if editorstack: state = any(finfo.editor.document().isModified() or finfo.newly_created for finfo in editorstack.data) ...
[ "def", "refresh_save_all_action", "(", "self", ")", ":", "editorstack", "=", "self", ".", "get_current_editorstack", "(", ")", "if", "editorstack", ":", "state", "=", "any", "(", "finfo", ".", "editor", ".", "document", "(", ")", ".", "isModified", "(", ")...
Enable 'Save All' if there are files to be saved
[ "Enable", "Save", "All", "if", "there", "are", "files", "to", "be", "saved" ]
python
train
quodlibet/mutagen
mutagen/asf/__init__.py
https://github.com/quodlibet/mutagen/blob/e393df5971ba41ba5a50de9c2c9e7e5484d82c4e/mutagen/asf/__init__.py#L228-L251
def load(self, filething): """load(filething) Args: filething (filething) Raises: mutagen.MutagenError """ fileobj = filething.fileobj self.info = ASFInfo() self.tags = ASFTags() self._tags = {} self._header = HeaderObje...
[ "def", "load", "(", "self", ",", "filething", ")", ":", "fileobj", "=", "filething", ".", "fileobj", "self", ".", "info", "=", "ASFInfo", "(", ")", "self", ".", "tags", "=", "ASFTags", "(", ")", "self", ".", "_tags", "=", "{", "}", "self", ".", "...
load(filething) Args: filething (filething) Raises: mutagen.MutagenError
[ "load", "(", "filething", ")" ]
python
train
tanghaibao/goatools
goatools/go_enrichment.py
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/go_enrichment.py#L532-L535
def print_results(self, results, min_ratio=None, indent=False, pval=0.05, prt=sys.stdout): """Print GOEA results with some additional statistics calculated.""" results_adj = self.get_adj_records(results, min_ratio, pval) self.print_results_adj(results_adj, indent, prt)
[ "def", "print_results", "(", "self", ",", "results", ",", "min_ratio", "=", "None", ",", "indent", "=", "False", ",", "pval", "=", "0.05", ",", "prt", "=", "sys", ".", "stdout", ")", ":", "results_adj", "=", "self", ".", "get_adj_records", "(", "result...
Print GOEA results with some additional statistics calculated.
[ "Print", "GOEA", "results", "with", "some", "additional", "statistics", "calculated", "." ]
python
train
Skype4Py/Skype4Py
Skype4Py/skype.py
https://github.com/Skype4Py/Skype4Py/blob/c48d83f7034109fe46315d45a066126002c6e0d4/Skype4Py/skype.py#L818-L830
def SendVoicemail(self, Username): """Sends a voicemail to a specified user. :Parameters: Username : str Skypename of the user. :note: Should return a `Voicemail` object. This is not implemented yet. """ if self._Api.protocol >= 6: self._DoComm...
[ "def", "SendVoicemail", "(", "self", ",", "Username", ")", ":", "if", "self", ".", "_Api", ".", "protocol", ">=", "6", ":", "self", ".", "_DoCommand", "(", "'CALLVOICEMAIL %s'", "%", "Username", ")", "else", ":", "self", ".", "_DoCommand", "(", "'VOICEMA...
Sends a voicemail to a specified user. :Parameters: Username : str Skypename of the user. :note: Should return a `Voicemail` object. This is not implemented yet.
[ "Sends", "a", "voicemail", "to", "a", "specified", "user", "." ]
python
train
nigma/django-twilio-sms
src/decorators.py
https://github.com/nigma/django-twilio-sms/blob/386999c3da545e001cb8977c78b67408e33aba11/src/decorators.py#L23-L103
def twilio_view(f): """This decorator provides several helpful shortcuts for writing Twilio views. - It ensures that only requests from Twilio are passed through. This helps protect you from forged requests. - It ensures your view is exempt from CSRF checks via Django's @cs...
[ "def", "twilio_view", "(", "f", ")", ":", "@", "csrf_exempt", "@", "wraps", "(", "f", ")", "def", "decorator", "(", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# Attempt to gather all required information to allow us to check the", "# incomi...
This decorator provides several helpful shortcuts for writing Twilio views. - It ensures that only requests from Twilio are passed through. This helps protect you from forged requests. - It ensures your view is exempt from CSRF checks via Django's @csrf_exempt decorator. This i...
[ "This", "decorator", "provides", "several", "helpful", "shortcuts", "for", "writing", "Twilio", "views", "." ]
python
test
Asana/python-asana
asana/resources/attachments.py
https://github.com/Asana/python-asana/blob/6deb7a34495db23f44858e53b6bb2c9eccff7872/asana/resources/attachments.py#L7-L10
def create_on_task(self, task_id, file_content, file_name, file_content_type=None, **options): """Upload an attachment for a task. Accepts a file object or string, file name, and optional file Content-Type""" path = '/tasks/%d/attachments' % (task_id) return self.client.request('post', path, fil...
[ "def", "create_on_task", "(", "self", ",", "task_id", ",", "file_content", ",", "file_name", ",", "file_content_type", "=", "None", ",", "*", "*", "options", ")", ":", "path", "=", "'/tasks/%d/attachments'", "%", "(", "task_id", ")", "return", "self", ".", ...
Upload an attachment for a task. Accepts a file object or string, file name, and optional file Content-Type
[ "Upload", "an", "attachment", "for", "a", "task", ".", "Accepts", "a", "file", "object", "or", "string", "file", "name", "and", "optional", "file", "Content", "-", "Type" ]
python
train
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/brocade_system_monitor.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/brocade_system_monitor.py#L38-L49
def system_monitor_fan_alert_state(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") system_monitor = ET.SubElement(config, "system-monitor", xmlns="urn:brocade.com:mgmt:brocade-system-monitor") fan = ET.SubElement(system_monitor, "fan") alert = ET...
[ "def", "system_monitor_fan_alert_state", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "system_monitor", "=", "ET", ".", "SubElement", "(", "config", ",", "\"system-monitor\"", ",", "xmlns", "=",...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
amzn/ion-python
amazon/ion/reader_managed.py
https://github.com/amzn/ion-python/blob/0b21fa3ba7755f55f745e4aa970d86343b82449d/amazon/ion/reader_managed.py#L40-L52
def resolve(self, token): """Attempts to resolve the :class:`SymbolToken` against the current table. If the ``text`` is not None, the token is returned, otherwise, a token in the table is attempted to be retrieved. If not token is found, then this method will raise. """ ...
[ "def", "resolve", "(", "self", ",", "token", ")", ":", "if", "token", ".", "text", "is", "not", "None", ":", "return", "token", "resolved_token", "=", "self", ".", "symbol_table", ".", "get", "(", "token", ".", "sid", ",", "None", ")", "if", "resolve...
Attempts to resolve the :class:`SymbolToken` against the current table. If the ``text`` is not None, the token is returned, otherwise, a token in the table is attempted to be retrieved. If not token is found, then this method will raise.
[ "Attempts", "to", "resolve", "the", ":", "class", ":", "SymbolToken", "against", "the", "current", "table", "." ]
python
train
apache/airflow
airflow/jobs.py
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/jobs.py#L2071-L2101
def _task_instances_for_dag_run(self, dag_run, session=None): """ Returns a map of task instance key to task instance object for the tasks to run in the given dag run. :param dag_run: the dag run to get the tasks from :type dag_run: airflow.models.DagRun :param session: ...
[ "def", "_task_instances_for_dag_run", "(", "self", ",", "dag_run", ",", "session", "=", "None", ")", ":", "tasks_to_run", "=", "{", "}", "if", "dag_run", "is", "None", ":", "return", "tasks_to_run", "# check if we have orphaned tasks", "self", ".", "reset_state_fo...
Returns a map of task instance key to task instance object for the tasks to run in the given dag run. :param dag_run: the dag run to get the tasks from :type dag_run: airflow.models.DagRun :param session: the database session object :type session: sqlalchemy.orm.session.Session
[ "Returns", "a", "map", "of", "task", "instance", "key", "to", "task", "instance", "object", "for", "the", "tasks", "to", "run", "in", "the", "given", "dag", "run", "." ]
python
test
brocade/pynos
pynos/versions/ver_7/ver_7_1_0/yang/brocade_vswitch.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_7/ver_7_1_0/yang/brocade_vswitch.py#L106-L118
def get_vnetwork_hosts_output_vnetwork_hosts_mac(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") get_vnetwork_hosts = ET.Element("get_vnetwork_hosts") config = get_vnetwork_hosts output = ET.SubElement(get_vnetwork_hosts, "output") vnetwo...
[ "def", "get_vnetwork_hosts_output_vnetwork_hosts_mac", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "get_vnetwork_hosts", "=", "ET", ".", "Element", "(", "\"get_vnetwork_hosts\"", ")", "config", "="...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
pantsbuild/pex
pex/util.py
https://github.com/pantsbuild/pex/blob/87b2129d860250d3b9edce75b9cb62f9789ee521/pex/util.py#L135-L142
def zip_hash(cls, zf, prefix=''): """Return the hash of the contents of a zipfile, comparable with a cls.dir_hash.""" prefix_length = len(prefix) names = sorted(name[prefix_length:] for name in zf.namelist() if name.startswith(prefix) and not name.endswith('.pyc') and not name.endswith('/')) def...
[ "def", "zip_hash", "(", "cls", ",", "zf", ",", "prefix", "=", "''", ")", ":", "prefix_length", "=", "len", "(", "prefix", ")", "names", "=", "sorted", "(", "name", "[", "prefix_length", ":", "]", "for", "name", "in", "zf", ".", "namelist", "(", ")"...
Return the hash of the contents of a zipfile, comparable with a cls.dir_hash.
[ "Return", "the", "hash", "of", "the", "contents", "of", "a", "zipfile", "comparable", "with", "a", "cls", ".", "dir_hash", "." ]
python
train
agoragames/kairos
kairos/timeseries.py
https://github.com/agoragames/kairos/blob/0b062d543b0f4a46df460fa0eb6ec281232ab179/kairos/timeseries.py#L971-L979
def _condense(self, data): ''' Condense by returning the last real value of the gauge. ''' if data: data = filter(None,data.values()) if data: return data[-1] return None
[ "def", "_condense", "(", "self", ",", "data", ")", ":", "if", "data", ":", "data", "=", "filter", "(", "None", ",", "data", ".", "values", "(", ")", ")", "if", "data", ":", "return", "data", "[", "-", "1", "]", "return", "None" ]
Condense by returning the last real value of the gauge.
[ "Condense", "by", "returning", "the", "last", "real", "value", "of", "the", "gauge", "." ]
python
train
python-visualization/folium
folium/utilities.py
https://github.com/python-visualization/folium/blob/8595240517135d1637ca4cf7cc624045f1d911b3/folium/utilities.py#L321-L340
def iter_coords(obj): """ Returns all the coordinate tuples from a geometry or feature. """ if isinstance(obj, (tuple, list)): coords = obj elif 'features' in obj: coords = [geom['geometry']['coordinates'] for geom in obj['features']] elif 'geometry' in obj: coords = obj...
[ "def", "iter_coords", "(", "obj", ")", ":", "if", "isinstance", "(", "obj", ",", "(", "tuple", ",", "list", ")", ")", ":", "coords", "=", "obj", "elif", "'features'", "in", "obj", ":", "coords", "=", "[", "geom", "[", "'geometry'", "]", "[", "'coor...
Returns all the coordinate tuples from a geometry or feature.
[ "Returns", "all", "the", "coordinate", "tuples", "from", "a", "geometry", "or", "feature", "." ]
python
train
pycontribs/pyrax
pyrax/object_storage.py
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/object_storage.py#L2055-L2083
def download(self, obj, directory, structure=True): """ Fetches the object from storage, and writes it to the specified directory. The directory must exist before calling this method. If the object name represents a nested folder structure, such as "foo/bar/baz.txt", that folder...
[ "def", "download", "(", "self", ",", "obj", ",", "directory", ",", "structure", "=", "True", ")", ":", "if", "not", "os", ".", "path", ".", "isdir", "(", "directory", ")", ":", "raise", "exc", ".", "FolderNotFound", "(", "\"The directory '%s' does not exis...
Fetches the object from storage, and writes it to the specified directory. The directory must exist before calling this method. If the object name represents a nested folder structure, such as "foo/bar/baz.txt", that folder structure will be created in the target directory by default. I...
[ "Fetches", "the", "object", "from", "storage", "and", "writes", "it", "to", "the", "specified", "directory", ".", "The", "directory", "must", "exist", "before", "calling", "this", "method", "." ]
python
train
Metatab/geoid
geoid/util.py
https://github.com/Metatab/geoid/blob/4b7769406b00e59376fb6046b42a2f8ed706b33b/geoid/util.py#L40-L51
def isimplify(geoids): """Iteratively simplify until the set stops getting smaller. """ s0 = list(geoids) for i in range(10): s1 = simplify(s0) if len(s1) == len(s0): return s1 s0 = s1
[ "def", "isimplify", "(", "geoids", ")", ":", "s0", "=", "list", "(", "geoids", ")", "for", "i", "in", "range", "(", "10", ")", ":", "s1", "=", "simplify", "(", "s0", ")", "if", "len", "(", "s1", ")", "==", "len", "(", "s0", ")", ":", "return"...
Iteratively simplify until the set stops getting smaller.
[ "Iteratively", "simplify", "until", "the", "set", "stops", "getting", "smaller", "." ]
python
train
peri-source/peri
peri/opt/optimize.py
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/opt/optimize.py#L116-L140
def name_globals(s, remove_params=None): """ Returns a list of the global parameter names. Parameters ---------- s : :class:`peri.states.ImageState` The state to name the globals of. remove_params : Set or None A set of unique additional parameters to remove from...
[ "def", "name_globals", "(", "s", ",", "remove_params", "=", "None", ")", ":", "all_params", "=", "s", ".", "params", "for", "p", "in", "s", ".", "param_particle", "(", "np", ".", "arange", "(", "s", ".", "obj_get_positions", "(", ")", ".", "shape", "...
Returns a list of the global parameter names. Parameters ---------- s : :class:`peri.states.ImageState` The state to name the globals of. remove_params : Set or None A set of unique additional parameters to remove from the globals list. Returns -----...
[ "Returns", "a", "list", "of", "the", "global", "parameter", "names", "." ]
python
valid
ronhanson/python-tbx
tbx/process.py
https://github.com/ronhanson/python-tbx/blob/87f72ae0cadecafbcd144f1e930181fba77f6b83/tbx/process.py#L198-L256
def daemonize(umask=0, work_dir="/", max_fd=1024, redirect="/dev/null"): """ When this function is called, the process is daemonized (by forking + killing its parent). It becomes a background task. It is useful to release the console. """ if not redirect: redirect = "/dev/null" if h...
[ "def", "daemonize", "(", "umask", "=", "0", ",", "work_dir", "=", "\"/\"", ",", "max_fd", "=", "1024", ",", "redirect", "=", "\"/dev/null\"", ")", ":", "if", "not", "redirect", ":", "redirect", "=", "\"/dev/null\"", "if", "hasattr", "(", "os", ",", "\"...
When this function is called, the process is daemonized (by forking + killing its parent). It becomes a background task. It is useful to release the console.
[ "When", "this", "function", "is", "called", "the", "process", "is", "daemonized", "(", "by", "forking", "+", "killing", "its", "parent", ")", ".", "It", "becomes", "a", "background", "task", ".", "It", "is", "useful", "to", "release", "the", "console", "...
python
train
dmtucker/keysmith
keysmith.py
https://github.com/dmtucker/keysmith/blob/a0d7388e0f4e36baac93bece933b0e8d7b3c6e3c/keysmith.py#L26-L62
def build_parser(parser: argparse.ArgumentParser) -> None: """Build a parser for CLI arguments and options.""" parser.add_argument( '--delimiter', help='a delimiter for the samples (teeth) in the key', default=' ', ) parser.add_argument( '--encoding', help='the en...
[ "def", "build_parser", "(", "parser", ":", "argparse", ".", "ArgumentParser", ")", "->", "None", ":", "parser", ".", "add_argument", "(", "'--delimiter'", ",", "help", "=", "'a delimiter for the samples (teeth) in the key'", ",", "default", "=", "' '", ",", ")", ...
Build a parser for CLI arguments and options.
[ "Build", "a", "parser", "for", "CLI", "arguments", "and", "options", "." ]
python
train
pypa/pipenv
pipenv/vendor/pathlib2/__init__.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L1126-L1131
def is_absolute(self): """True if the path is absolute (has both a root and, if applicable, a drive).""" if not self._root: return False return not self._flavour.has_drv or bool(self._drv)
[ "def", "is_absolute", "(", "self", ")", ":", "if", "not", "self", ".", "_root", ":", "return", "False", "return", "not", "self", ".", "_flavour", ".", "has_drv", "or", "bool", "(", "self", ".", "_drv", ")" ]
True if the path is absolute (has both a root and, if applicable, a drive).
[ "True", "if", "the", "path", "is", "absolute", "(", "has", "both", "a", "root", "and", "if", "applicable", "a", "drive", ")", "." ]
python
train
cloudera/impyla
impala/_thrift_gen/hive_metastore/ThriftHiveMetastore.py
https://github.com/cloudera/impyla/blob/547fa2ba3b6151e2a98b3544301471a643212dc3/impala/_thrift_gen/hive_metastore/ThriftHiveMetastore.py#L1632-L1639
def get_fields(self, db_name, table_name): """ Parameters: - db_name - table_name """ self.send_get_fields(db_name, table_name) return self.recv_get_fields()
[ "def", "get_fields", "(", "self", ",", "db_name", ",", "table_name", ")", ":", "self", ".", "send_get_fields", "(", "db_name", ",", "table_name", ")", "return", "self", ".", "recv_get_fields", "(", ")" ]
Parameters: - db_name - table_name
[ "Parameters", ":", "-", "db_name", "-", "table_name" ]
python
train
ArduPilot/MAVProxy
MAVProxy/modules/lib/wxhorizon_ui.py
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/wxhorizon_ui.py#L191-L207
def adjustNorthPointer(self): '''Adjust the position and orientation of the north pointer.''' self.headingNorthText.set_size(self.fontSize) headingRotate = mpl.transforms.Affine2D().rotate_deg_around(0.0,0.0,self.heading)+self.axes.transData self.headingNorthText.set_transform(h...
[ "def", "adjustNorthPointer", "(", "self", ")", ":", "self", ".", "headingNorthText", ".", "set_size", "(", "self", ".", "fontSize", ")", "headingRotate", "=", "mpl", ".", "transforms", ".", "Affine2D", "(", ")", ".", "rotate_deg_around", "(", "0.0", ",", "...
Adjust the position and orientation of the north pointer.
[ "Adjust", "the", "position", "and", "orientation", "of", "the", "north", "pointer", "." ]
python
train
saltstack/salt
salt/modules/boto_vpc.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L1330-L1380
def create_nat_gateway(subnet_id=None, subnet_name=None, allocation_id=None, region=None, key=None, keyid=None, profile=None): ''' Create a NAT Gateway within an existing subnet. If allocation_id is specified, the elastic IP address it references is associated w...
[ "def", "create_nat_gateway", "(", "subnet_id", "=", "None", ",", "subnet_name", "=", "None", ",", "allocation_id", "=", "None", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "try"...
Create a NAT Gateway within an existing subnet. If allocation_id is specified, the elastic IP address it references is associated with the gateway. Otherwise, a new allocation_id is created and used. This function requires boto3 to be installed. Returns the nat gateway id if the nat gateway was create...
[ "Create", "a", "NAT", "Gateway", "within", "an", "existing", "subnet", ".", "If", "allocation_id", "is", "specified", "the", "elastic", "IP", "address", "it", "references", "is", "associated", "with", "the", "gateway", ".", "Otherwise", "a", "new", "allocation...
python
train
etscrivner/nose-perfdump
perfdump/models.py
https://github.com/etscrivner/nose-perfdump/blob/a203a68495d30346fab43fb903cb60cd29b17d49/perfdump/models.py#L159-L163
def get_cursor(cls): """Return a message list cursor that returns sqlite3.Row objects""" db = SqliteConnection.get() db.row_factory = sqlite3.Row return db.cursor()
[ "def", "get_cursor", "(", "cls", ")", ":", "db", "=", "SqliteConnection", ".", "get", "(", ")", "db", ".", "row_factory", "=", "sqlite3", ".", "Row", "return", "db", ".", "cursor", "(", ")" ]
Return a message list cursor that returns sqlite3.Row objects
[ "Return", "a", "message", "list", "cursor", "that", "returns", "sqlite3", ".", "Row", "objects" ]
python
train
CalebBell/thermo
thermo/eos.py
https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/eos.py#L1090-L1115
def Yu_Lu(self, T, full=True, quick=True): r'''Method to calculate `a_alpha` and its first and second derivatives according to Yu and Lu (1987) [1]_. Returns `a_alpha`, `da_alpha_dT`, and `d2a_alpha_dT2`. See `GCEOS.a_alpha_and_derivatives` for more documentation. Four coefficients ne...
[ "def", "Yu_Lu", "(", "self", ",", "T", ",", "full", "=", "True", ",", "quick", "=", "True", ")", ":", "c1", ",", "c2", ",", "c3", ",", "c4", "=", "self", ".", "alpha_function_coeffs", "T", ",", "Tc", ",", "a", "=", "self", ".", "T", ",", "sel...
r'''Method to calculate `a_alpha` and its first and second derivatives according to Yu and Lu (1987) [1]_. Returns `a_alpha`, `da_alpha_dT`, and `d2a_alpha_dT2`. See `GCEOS.a_alpha_and_derivatives` for more documentation. Four coefficients needed. .. math:: \alpha...
[ "r", "Method", "to", "calculate", "a_alpha", "and", "its", "first", "and", "second", "derivatives", "according", "to", "Yu", "and", "Lu", "(", "1987", ")", "[", "1", "]", "_", ".", "Returns", "a_alpha", "da_alpha_dT", "and", "d2a_alpha_dT2", ".", "See", ...
python
valid
ECRL/ecabc
ecabc/bees.py
https://github.com/ECRL/ecabc/blob/4e73125ff90bfeeae359a5ab1badba8894d70eaa/ecabc/bees.py#L78-L100
def calculate_positions(self, first_bee_val, second_bee_val, value_range): '''Calculate the new value/position for two given bee values Args: first_bee_val (int or float): value from the first bee second_bee_val (int or float): value from the second bee value_ranges ...
[ "def", "calculate_positions", "(", "self", ",", "first_bee_val", ",", "second_bee_val", ",", "value_range", ")", ":", "value", "=", "first_bee_val", "+", "np", ".", "random", ".", "uniform", "(", "-", "1", ",", "1", ")", "*", "(", "first_bee_val", "-", "...
Calculate the new value/position for two given bee values Args: first_bee_val (int or float): value from the first bee second_bee_val (int or float): value from the second bee value_ranges (tuple): "(value type, (min_val, max_val))" for the given value ...
[ "Calculate", "the", "new", "value", "/", "position", "for", "two", "given", "bee", "values" ]
python
train
saltstack/salt
salt/ext/ipaddress.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/ext/ipaddress.py#L967-L1027
def subnets(self, prefixlen_diff=1, new_prefix=None): """The subnets which join to make the current subnet. In the case that self contains only one IP (self._prefixlen == 32 for IPv4 or self._prefixlen == 128 for IPv6), yield an iterator with just ourself. Args: pre...
[ "def", "subnets", "(", "self", ",", "prefixlen_diff", "=", "1", ",", "new_prefix", "=", "None", ")", ":", "if", "self", ".", "_prefixlen", "==", "self", ".", "_max_prefixlen", ":", "yield", "self", "return", "if", "new_prefix", "is", "not", "None", ":", ...
The subnets which join to make the current subnet. In the case that self contains only one IP (self._prefixlen == 32 for IPv4 or self._prefixlen == 128 for IPv6), yield an iterator with just ourself. Args: prefixlen_diff: An integer, the amount the prefix length ...
[ "The", "subnets", "which", "join", "to", "make", "the", "current", "subnet", "." ]
python
train
Microsoft/azure-devops-python-api
azure-devops/azure/devops/v5_0/build/build_client.py
https://github.com/Microsoft/azure-devops-python-api/blob/4777ffda2f5052fabbaddb2abe9cb434e0cf1aa8/azure-devops/azure/devops/v5_0/build/build_client.py#L327-L341
def delete_build(self, project, build_id): """DeleteBuild. Deletes a build. :param str project: Project ID or project name :param int build_id: The ID of the build. """ route_values = {} if project is not None: route_values['project'] = self._serialize...
[ "def", "delete_build", "(", "self", ",", "project", ",", "build_id", ")", ":", "route_values", "=", "{", "}", "if", "project", "is", "not", "None", ":", "route_values", "[", "'project'", "]", "=", "self", ".", "_serialize", ".", "url", "(", "'project'", ...
DeleteBuild. Deletes a build. :param str project: Project ID or project name :param int build_id: The ID of the build.
[ "DeleteBuild", ".", "Deletes", "a", "build", ".", ":", "param", "str", "project", ":", "Project", "ID", "or", "project", "name", ":", "param", "int", "build_id", ":", "The", "ID", "of", "the", "build", "." ]
python
train
alecthomas/injector
injector/__init__.py
https://github.com/alecthomas/injector/blob/07c7200166dcf5abc3bd425607f6c20206b8fe65/injector/__init__.py#L293-L304
def bind(self, interface, to=None, scope=None): """Bind an interface to an implementation. :param interface: Interface or :func:`Key` to bind. :param to: Instance or class to bind to, or an explicit :class:`Provider` subclass. :param scope: Optional :class:`Scope` in which ...
[ "def", "bind", "(", "self", ",", "interface", ",", "to", "=", "None", ",", "scope", "=", "None", ")", ":", "if", "type", "(", "interface", ")", "is", "type", "and", "issubclass", "(", "interface", ",", "(", "BaseMappingKey", ",", "BaseSequenceKey", ")"...
Bind an interface to an implementation. :param interface: Interface or :func:`Key` to bind. :param to: Instance or class to bind to, or an explicit :class:`Provider` subclass. :param scope: Optional :class:`Scope` in which to bind.
[ "Bind", "an", "interface", "to", "an", "implementation", "." ]
python
train
elastic/elasticsearch-py
elasticsearch/client/indices.py
https://github.com/elastic/elasticsearch-py/blob/2aab285c8f506f3863cbdaba3c90a685c510ba00/elasticsearch/client/indices.py#L395-L413
def put_alias(self, index, name, body=None, params=None): """ Create an alias for a specific index/indices. `<http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html>`_ :arg index: A comma-separated list of index names the alias should point to (s...
[ "def", "put_alias", "(", "self", ",", "index", ",", "name", ",", "body", "=", "None", ",", "params", "=", "None", ")", ":", "for", "param", "in", "(", "index", ",", "name", ")", ":", "if", "param", "in", "SKIP_IN_PATH", ":", "raise", "ValueError", ...
Create an alias for a specific index/indices. `<http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html>`_ :arg index: A comma-separated list of index names the alias should point to (supports wildcards); use `_all` to perform the operation on all ind...
[ "Create", "an", "alias", "for", "a", "specific", "index", "/", "indices", ".", "<http", ":", "//", "www", ".", "elastic", ".", "co", "/", "guide", "/", "en", "/", "elasticsearch", "/", "reference", "/", "current", "/", "indices", "-", "aliases", ".", ...
python
train
relwell/corenlp-xml-lib
corenlp_xml/document.py
https://github.com/relwell/corenlp-xml-lib/blob/9b0f8c912ba3ecedd34473f74a9f2d033a75baf9/corenlp_xml/document.py#L246-L258
def basic_dependencies(self): """ Accesses basic dependencies from the XML output :getter: Returns the dependency graph for basic dependencies :type: corenlp_xml.dependencies.DependencyGraph """ if self._basic_dependencies is None: deps = self._element.xpath...
[ "def", "basic_dependencies", "(", "self", ")", ":", "if", "self", ".", "_basic_dependencies", "is", "None", ":", "deps", "=", "self", ".", "_element", ".", "xpath", "(", "'dependencies[@type=\"basic-dependencies\"]'", ")", "if", "len", "(", "deps", ")", ">", ...
Accesses basic dependencies from the XML output :getter: Returns the dependency graph for basic dependencies :type: corenlp_xml.dependencies.DependencyGraph
[ "Accesses", "basic", "dependencies", "from", "the", "XML", "output" ]
python
train
quantmind/pulsar
pulsar/utils/pylib/events.py
https://github.com/quantmind/pulsar/blob/fee44e871954aa6ca36d00bb5a3739abfdb89b26/pulsar/utils/pylib/events.py#L156-L172
def copy_many_times_events(self, other): '''Copy :ref:`many times events <many-times-event>` from ``other``. All many times events of ``other`` are copied to this handler provided the events handlers already exist. ''' events = self.events() other_events = other.events(...
[ "def", "copy_many_times_events", "(", "self", ",", "other", ")", ":", "events", "=", "self", ".", "events", "(", ")", "other_events", "=", "other", ".", "events", "(", ")", "if", "events", "and", "other_events", ":", "for", "name", ",", "event", "in", ...
Copy :ref:`many times events <many-times-event>` from ``other``. All many times events of ``other`` are copied to this handler provided the events handlers already exist.
[ "Copy", ":", "ref", ":", "many", "times", "events", "<many", "-", "times", "-", "event", ">", "from", "other", "." ]
python
train
gwpy/gwpy
gwpy/timeseries/timeseries.py
https://github.com/gwpy/gwpy/blob/7a92b917e7dd2d99b15895293a1fa1d66cdb210a/gwpy/timeseries/timeseries.py#L1581-L1672
def gate(self, tzero=1.0, tpad=0.5, whiten=True, threshold=50., cluster_window=0.5, **whiten_kwargs): """Removes high amplitude peaks from data using inverse Planck window. Points will be discovered automatically using a provided threshold and clustered within a provided time window...
[ "def", "gate", "(", "self", ",", "tzero", "=", "1.0", ",", "tpad", "=", "0.5", ",", "whiten", "=", "True", ",", "threshold", "=", "50.", ",", "cluster_window", "=", "0.5", ",", "*", "*", "whiten_kwargs", ")", ":", "try", ":", "from", "scipy", ".", ...
Removes high amplitude peaks from data using inverse Planck window. Points will be discovered automatically using a provided threshold and clustered within a provided time window. Parameters ---------- tzero : `int`, optional half-width time duration in which the tim...
[ "Removes", "high", "amplitude", "peaks", "from", "data", "using", "inverse", "Planck", "window", ".", "Points", "will", "be", "discovered", "automatically", "using", "a", "provided", "threshold", "and", "clustered", "within", "a", "provided", "time", "window", "...
python
train
nerdvegas/rez
src/rez/utils/graph_utils.py
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/graph_utils.py#L153-L198
def prune_graph(graph_str, package_name): """Prune a package graph so it only contains nodes accessible from the given package. Args: graph_str (str): Dot-language graph string. package_name (str): Name of package of interest. Returns: Pruned graph, as a string. """ # f...
[ "def", "prune_graph", "(", "graph_str", ",", "package_name", ")", ":", "# find nodes of interest", "g", "=", "read_dot", "(", "graph_str", ")", "nodes", "=", "set", "(", ")", "for", "node", ",", "attrs", "in", "g", ".", "node_attr", ".", "iteritems", "(", ...
Prune a package graph so it only contains nodes accessible from the given package. Args: graph_str (str): Dot-language graph string. package_name (str): Name of package of interest. Returns: Pruned graph, as a string.
[ "Prune", "a", "package", "graph", "so", "it", "only", "contains", "nodes", "accessible", "from", "the", "given", "package", "." ]
python
train
YeoLab/anchor
anchor/infotheory.py
https://github.com/YeoLab/anchor/blob/1f9c9d6d30235b1e77b945e6ef01db5a0e55d53a/anchor/infotheory.py#L12-L29
def bin_range_strings(bins, fmt=':g'): """Given a list of bins, make a list of strings of those bin ranges Parameters ---------- bins : list_like List of anything, usually values of bin edges Returns ------- bin_ranges : list List of bin ranges >>> bin_range_strings((0...
[ "def", "bin_range_strings", "(", "bins", ",", "fmt", "=", "':g'", ")", ":", "return", "[", "(", "'{'", "+", "fmt", "+", "'}-{'", "+", "fmt", "+", "'}'", ")", ".", "format", "(", "i", ",", "j", ")", "for", "i", ",", "j", "in", "zip", "(", "bin...
Given a list of bins, make a list of strings of those bin ranges Parameters ---------- bins : list_like List of anything, usually values of bin edges Returns ------- bin_ranges : list List of bin ranges >>> bin_range_strings((0, 0.5, 1)) ['0-0.5', '0.5-1']
[ "Given", "a", "list", "of", "bins", "make", "a", "list", "of", "strings", "of", "those", "bin", "ranges" ]
python
train
psss/did
did/base.py
https://github.com/psss/did/blob/04e4ee6f1aa14c0cae3ba9f9803871f3f98279cb/did/base.py#L261-L266
def last_quarter(): """ Return start and end date of this quarter. """ since, until = Date.this_quarter() since = since.date - delta(months=3) until = until.date - delta(months=3) return Date(since), Date(until)
[ "def", "last_quarter", "(", ")", ":", "since", ",", "until", "=", "Date", ".", "this_quarter", "(", ")", "since", "=", "since", ".", "date", "-", "delta", "(", "months", "=", "3", ")", "until", "=", "until", ".", "date", "-", "delta", "(", "months"...
Return start and end date of this quarter.
[ "Return", "start", "and", "end", "date", "of", "this", "quarter", "." ]
python
train