repo
stringlengths
7
55
path
stringlengths
4
223
url
stringlengths
87
315
code
stringlengths
75
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
avg_line_len
float64
7.91
980
OpenTreeOfLife/peyotl
peyotl/amendments/amendments_shard.py
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/amendments/amendments_shard.py#L128-L137
def get_configuration_dict(self, secret_attrs=False): """Overrides superclass method and renames some properties""" cd = super(TaxonomicAmendmentsShard, self).get_configuration_dict(secret_attrs=secret_attrs) # "rename" some keys in the dict provided cd['number of amendments'] = cd.pop('...
[ "def", "get_configuration_dict", "(", "self", ",", "secret_attrs", "=", "False", ")", ":", "cd", "=", "super", "(", "TaxonomicAmendmentsShard", ",", "self", ")", ".", "get_configuration_dict", "(", "secret_attrs", "=", "secret_attrs", ")", "# \"rename\" some keys in...
Overrides superclass method and renames some properties
[ "Overrides", "superclass", "method", "and", "renames", "some", "properties" ]
python
train
54.4
codelv/enaml-native
src/enamlnative/android/android_wifi.py
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_wifi.py#L232-L262
def disconnect(cls): """ Disconnect from the current network (if connected). Returns -------- result: future A future that resolves to true if the disconnect was successful. Will be set to None if the change network pe...
[ "def", "disconnect", "(", "cls", ")", ":", "app", "=", "AndroidApplication", ".", "instance", "(", ")", "f", "=", "app", ".", "create_future", "(", ")", "def", "on_permission_result", "(", "result", ")", ":", "if", "not", "result", ":", "f", ".", "set_...
Disconnect from the current network (if connected). Returns -------- result: future A future that resolves to true if the disconnect was successful. Will be set to None if the change network permission is denied.
[ "Disconnect", "from", "the", "current", "network", "(", "if", "connected", ")", ".", "Returns", "--------", "result", ":", "future", "A", "future", "that", "resolves", "to", "true", "if", "the", "disconnect", "was", "successful", ".", "Will", "be", "set", ...
python
train
28.064516
nutechsoftware/alarmdecoder
alarmdecoder/decoder.py
https://github.com/nutechsoftware/alarmdecoder/blob/b0c014089e24455228cb4402cf30ba98157578cd/alarmdecoder/decoder.py#L388-L397
def _wire_events(self): """ Wires up the internal device events. """ self._device.on_open += self._on_open self._device.on_close += self._on_close self._device.on_read += self._on_read self._device.on_write += self._on_write self._zonetracker.on_fault += s...
[ "def", "_wire_events", "(", "self", ")", ":", "self", ".", "_device", ".", "on_open", "+=", "self", ".", "_on_open", "self", ".", "_device", ".", "on_close", "+=", "self", ".", "_on_close", "self", ".", "_device", ".", "on_read", "+=", "self", ".", "_o...
Wires up the internal device events.
[ "Wires", "up", "the", "internal", "device", "events", "." ]
python
train
39.1
pricingassistant/mongokat
mongokat/document.py
https://github.com/pricingassistant/mongokat/blob/61eaf4bc1c4cc359c6f9592ec97b9a04d9561411/mongokat/document.py#L102-L112
def refetch_fields(self, missing_fields): """ Refetches a list of fields from the DB """ db_fields = self.mongokat_collection.find_one({"_id": self["_id"]}, fields={k: 1 for k in missing_fields}) self._fetched_fields += tuple(missing_fields) if not db_fields: return ...
[ "def", "refetch_fields", "(", "self", ",", "missing_fields", ")", ":", "db_fields", "=", "self", ".", "mongokat_collection", ".", "find_one", "(", "{", "\"_id\"", ":", "self", "[", "\"_id\"", "]", "}", ",", "fields", "=", "{", "k", ":", "1", "for", "k"...
Refetches a list of fields from the DB
[ "Refetches", "a", "list", "of", "fields", "from", "the", "DB" ]
python
train
33.272727
GoogleCloudPlatform/flask-talisman
flask_talisman/talisman.py
https://github.com/GoogleCloudPlatform/flask-talisman/blob/c45a9a5b2671b9667856e281d2726c8bfd0f0fd7/flask_talisman/talisman.py#L193-L218
def _force_https(self): """Redirect any non-https requests to https. Based largely on flask-sslify. """ if self.session_cookie_secure: if not self.app.debug: self.app.config['SESSION_COOKIE_SECURE'] = True criteria = [ self.app.debug, ...
[ "def", "_force_https", "(", "self", ")", ":", "if", "self", ".", "session_cookie_secure", ":", "if", "not", "self", ".", "app", ".", "debug", ":", "self", ".", "app", ".", "config", "[", "'SESSION_COOKIE_SECURE'", "]", "=", "True", "criteria", "=", "[", ...
Redirect any non-https requests to https. Based largely on flask-sslify.
[ "Redirect", "any", "non", "-", "https", "requests", "to", "https", "." ]
python
train
32.461538
pydata/pandas-gbq
pandas_gbq/gbq.py
https://github.com/pydata/pandas-gbq/blob/e590317b3325939ede7563f49aa6b163bb803b77/pandas_gbq/gbq.py#L1351-L1374
def create(self, dataset_id): """ Create a dataset in Google BigQuery Parameters ---------- dataset : str Name of dataset to be written """ from google.cloud.bigquery import Dataset if self.exists(dataset_id): raise DatasetCreationError( ...
[ "def", "create", "(", "self", ",", "dataset_id", ")", ":", "from", "google", ".", "cloud", ".", "bigquery", "import", "Dataset", "if", "self", ".", "exists", "(", "dataset_id", ")", ":", "raise", "DatasetCreationError", "(", "\"Dataset {0} already \"", "\"exis...
Create a dataset in Google BigQuery Parameters ---------- dataset : str Name of dataset to be written
[ "Create", "a", "dataset", "in", "Google", "BigQuery" ]
python
train
27.541667
xtream1101/web-wrapper
web_wrapper/driver_selenium_phantomjs.py
https://github.com/xtream1101/web-wrapper/blob/2bfc63caa7d316564088951f01a490db493ea240/web_wrapper/driver_selenium_phantomjs.py#L92-L100
def _create_session(self): """ Creates a fresh session with no/default headers and proxies """ logger.debug("Create new phantomjs web driver") self.driver = webdriver.PhantomJS(desired_capabilities=self.dcap, **self.driver_args) s...
[ "def", "_create_session", "(", "self", ")", ":", "logger", ".", "debug", "(", "\"Create new phantomjs web driver\"", ")", "self", ".", "driver", "=", "webdriver", ".", "PhantomJS", "(", "desired_capabilities", "=", "self", ".", "dcap", ",", "*", "*", "self", ...
Creates a fresh session with no/default headers and proxies
[ "Creates", "a", "fresh", "session", "with", "no", "/", "default", "headers", "and", "proxies" ]
python
train
44.111111
duniter/duniter-python-api
duniterpy/documents/transaction.py
https://github.com/duniter/duniter-python-api/blob/3a1e5d61a2f72f5afaf29d010c6cf4dff3648165/duniterpy/documents/transaction.py#L722-L760
def compact(self) -> str: """ Return a transaction in its compact format from the instance :return: """ """TX:VERSION:NB_ISSUERS:NB_INPUTS:NB_UNLOCKS:NB_OUTPUTS:HAS_COMMENT:LOCKTIME PUBLIC_KEY:INDEX ... INDEX:SOURCE:FINGERPRINT:AMOUNT ... PUBLIC_KEY:AMOUNT ... COMMENT """ ...
[ "def", "compact", "(", "self", ")", "->", "str", ":", "\"\"\"TX:VERSION:NB_ISSUERS:NB_INPUTS:NB_UNLOCKS:NB_OUTPUTS:HAS_COMMENT:LOCKTIME\nPUBLIC_KEY:INDEX\n...\nINDEX:SOURCE:FINGERPRINT:AMOUNT\n...\nPUBLIC_KEY:AMOUNT\n...\nCOMMENT\n\"\"\"", "doc", "=", "\"TX:{0}:{1}:{2}:{3}:{4}:{5}:{6}\\n\"", ...
Return a transaction in its compact format from the instance :return:
[ "Return", "a", "transaction", "in", "its", "compact", "format", "from", "the", "instance" ]
python
train
35.358974
saltstack/salt
salt/runners/http.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/http.py#L18-L45
def query(url, output=True, **kwargs): ''' Query a resource, and decode the return data Passes through all the parameters described in the :py:func:`utils.http.query function <salt.utils.http.query>`: CLI Example: .. code-block:: bash salt-run http.query http://somelink.com/ ...
[ "def", "query", "(", "url", ",", "output", "=", "True", ",", "*", "*", "kwargs", ")", ":", "if", "output", "is", "not", "True", ":", "log", ".", "warning", "(", "'Output option has been deprecated. Please use --quiet.'", ")", "if", "'node'", "not", "in", "...
Query a resource, and decode the return data Passes through all the parameters described in the :py:func:`utils.http.query function <salt.utils.http.query>`: CLI Example: .. code-block:: bash salt-run http.query http://somelink.com/ salt-run http.query http://somelink.com/ method=POS...
[ "Query", "a", "resource", "and", "decode", "the", "return", "data" ]
python
train
30.785714
hughsie/python-appstream
appstream/component.py
https://github.com/hughsie/python-appstream/blob/f2606380278c5728ee7f8e7d19914c54fca05e76/appstream/component.py#L243-L251
def _parse_tree(self, node): """ Parse a <image> object """ if 'type' in node.attrib: self.kind = node.attrib['type'] if 'width' in node.attrib: self.width = int(node.attrib['width']) if 'height' in node.attrib: self.height = int(node.attrib['height'])...
[ "def", "_parse_tree", "(", "self", ",", "node", ")", ":", "if", "'type'", "in", "node", ".", "attrib", ":", "self", ".", "kind", "=", "node", ".", "attrib", "[", "'type'", "]", "if", "'width'", "in", "node", ".", "attrib", ":", "self", ".", "width"...
Parse a <image> object
[ "Parse", "a", "<image", ">", "object" ]
python
train
37.888889
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/graphs/graph.py
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/graphs/graph.py#L177-L226
def set_data(self, adjacency_mat=None, **kwargs): """Set the data Parameters ---------- adjacency_mat : ndarray | None The adjacency matrix. **kwargs : dict Keyword arguments to pass to the arrows. """ if adjacency_mat is not None: ...
[ "def", "set_data", "(", "self", ",", "adjacency_mat", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "adjacency_mat", "is", "not", "None", ":", "if", "adjacency_mat", ".", "shape", "[", "0", "]", "!=", "adjacency_mat", ".", "shape", "[", "1", ...
Set the data Parameters ---------- adjacency_mat : ndarray | None The adjacency matrix. **kwargs : dict Keyword arguments to pass to the arrows.
[ "Set", "the", "data" ]
python
train
33.54
kamikaze/webdav
src/webdav/client.py
https://github.com/kamikaze/webdav/blob/6facff7224023d3e28c8e1592f3c58401c91a0e6/src/webdav/client.py#L254-L262
def free(self): """Returns an amount of free space on remote WebDAV server. More information you can find by link http://webdav.org/specs/rfc4918.html#METHOD_PROPFIND :return: an amount of free space in bytes. """ data = WebDavXmlUtils.create_free_space_request_content() ...
[ "def", "free", "(", "self", ")", ":", "data", "=", "WebDavXmlUtils", ".", "create_free_space_request_content", "(", ")", "response", "=", "self", ".", "execute_request", "(", "action", "=", "'free'", ",", "path", "=", "''", ",", "data", "=", "data", ")", ...
Returns an amount of free space on remote WebDAV server. More information you can find by link http://webdav.org/specs/rfc4918.html#METHOD_PROPFIND :return: an amount of free space in bytes.
[ "Returns", "an", "amount", "of", "free", "space", "on", "remote", "WebDAV", "server", ".", "More", "information", "you", "can", "find", "by", "link", "http", ":", "//", "webdav", ".", "org", "/", "specs", "/", "rfc4918", ".", "html#METHOD_PROPFIND" ]
python
train
52.777778
deginner/mq-client
mq_client.py
https://github.com/deginner/mq-client/blob/a20ab50ea18870c01e8d142b049233c355858872/mq_client.py#L10-L33
def _on_message(channel, method, header, body): """ Invoked by pika when a message is delivered from RabbitMQ. The channel is passed for your convenience. The basic_deliver object that is passed in carries the exchange, routing key, delivery tag and a redelivered flag for the message. The properties...
[ "def", "_on_message", "(", "channel", ",", "method", ",", "header", ",", "body", ")", ":", "print", "\"Message:\"", "print", "\"\\t%r\"", "%", "method", "print", "\"\\t%r\"", "%", "header", "print", "\"\\t%r\"", "%", "body", "# Acknowledge message receipt", "cha...
Invoked by pika when a message is delivered from RabbitMQ. The channel is passed for your convenience. The basic_deliver object that is passed in carries the exchange, routing key, delivery tag and a redelivered flag for the message. The properties passed in is an instance of BasicProperties with the me...
[ "Invoked", "by", "pika", "when", "a", "message", "is", "delivered", "from", "RabbitMQ", ".", "The", "channel", "is", "passed", "for", "your", "convenience", ".", "The", "basic_deliver", "object", "that", "is", "passed", "in", "carries", "the", "exchange", "r...
python
train
37.75
cmck/pybrowserstack-screenshots
browserstack_screenshots/__init__.py
https://github.com/cmck/pybrowserstack-screenshots/blob/598358fc5b9a41678b3f913f2c082a288011322d/browserstack_screenshots/__init__.py#L79-L87
def generate_screenshots(self): """ Take a config file as input and generate screenshots """ headers = {'content-type': 'application/json', 'Accept': 'application/json'} resp = requests.post(self.api_url, data=json.dumps(self.config), \ headers=header...
[ "def", "generate_screenshots", "(", "self", ")", ":", "headers", "=", "{", "'content-type'", ":", "'application/json'", ",", "'Accept'", ":", "'application/json'", "}", "resp", "=", "requests", ".", "post", "(", "self", ".", "api_url", ",", "data", "=", "jso...
Take a config file as input and generate screenshots
[ "Take", "a", "config", "file", "as", "input", "and", "generate", "screenshots" ]
python
train
44.555556
lduchesne/python-openstacksdk-hubic
hubic/hubic.py
https://github.com/lduchesne/python-openstacksdk-hubic/blob/25e752f847613bb7e068c05e094a8abadaa7925a/hubic/hubic.py#L94-L117
def get_endpoint(self, session, **kwargs): """Get the HubiC storage endpoint uri. If the current session has not been authenticated, this will trigger a new authentication to the HubiC OAuth service. :param keystoneclient.Session session: The session object to use for ...
[ "def", "get_endpoint", "(", "self", ",", "session", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "endpoint", "is", "None", ":", "try", ":", "self", ".", "_refresh_tokens", "(", "session", ")", "self", ".", "_fetch_credentials", "(", "session", ...
Get the HubiC storage endpoint uri. If the current session has not been authenticated, this will trigger a new authentication to the HubiC OAuth service. :param keystoneclient.Session session: The session object to use for queries. :raise...
[ "Get", "the", "HubiC", "storage", "endpoint", "uri", "." ]
python
train
34.666667
blackecho/Deep-Learning-TensorFlow
yadlt/models/autoencoders/stacked_denoising_autoencoder.py
https://github.com/blackecho/Deep-Learning-TensorFlow/blob/ddeb1f2848da7b7bee166ad2152b4afc46bb2086/yadlt/models/autoencoders/stacked_denoising_autoencoder.py#L210-L237
def _create_variables_no_pretrain(self, n_features): """Create model variables (no previous unsupervised pretraining). :param n_features: number of features :return: self """ self.encoding_w_ = [] self.encoding_b_ = [] for l, layer in enumerate(self.layers): ...
[ "def", "_create_variables_no_pretrain", "(", "self", ",", "n_features", ")", ":", "self", ".", "encoding_w_", "=", "[", "]", "self", ".", "encoding_b_", "=", "[", "]", "for", "l", ",", "layer", "in", "enumerate", "(", "self", ".", "layers", ")", ":", "...
Create model variables (no previous unsupervised pretraining). :param n_features: number of features :return: self
[ "Create", "model", "variables", "(", "no", "previous", "unsupervised", "pretraining", ")", "." ]
python
train
33.214286
robinandeer/puzzle
puzzle/plugins/gemini/mixins/case.py
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/plugins/gemini/mixins/case.py#L70-L82
def individual(self, ind_id=None): """Return a individual object Args: ind_id (str): A individual id Returns: individual (puzzle.models.individual) """ for ind_obj in self.individuals: if ind_obj.ind_id == ...
[ "def", "individual", "(", "self", ",", "ind_id", "=", "None", ")", ":", "for", "ind_obj", "in", "self", ".", "individuals", ":", "if", "ind_obj", ".", "ind_id", "==", "ind_id", ":", "return", "ind_obj", "return", "None" ]
Return a individual object Args: ind_id (str): A individual id Returns: individual (puzzle.models.individual)
[ "Return", "a", "individual", "object", "Args", ":", "ind_id", "(", "str", ")", ":", "A", "individual", "id", "Returns", ":", "individual", "(", "puzzle", ".", "models", ".", "individual", ")" ]
python
train
28.153846
bachya/pyopenuv
pyopenuv/client.py
https://github.com/bachya/pyopenuv/blob/f7c2f9dd99dd4e3b8b1f9e501ea17ce62a7ace46/pyopenuv/client.py#L27-L59
async def request( self, method: str, endpoint: str, *, headers: dict = None, params: dict = None) -> dict: """Make a request against air-matters.com.""" url = '{0}/{1}'.format(API_URL_SCAFFOLD, endpoint) if not headers: ...
[ "async", "def", "request", "(", "self", ",", "method", ":", "str", ",", "endpoint", ":", "str", ",", "*", ",", "headers", ":", "dict", "=", "None", ",", "params", ":", "dict", "=", "None", ")", "->", "dict", ":", "url", "=", "'{0}/{1}'", ".", "fo...
Make a request against air-matters.com.
[ "Make", "a", "request", "against", "air", "-", "matters", ".", "com", "." ]
python
train
34.939394
boriel/zxbasic
zxbparser.py
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbparser.py#L2343-L2346
def p_expr_BAND_expr(p): """ expr : expr BAND expr """ p[0] = make_binary(p.lineno(2), 'BAND', p[1], p[3], lambda x, y: x & y)
[ "def", "p_expr_BAND_expr", "(", "p", ")", ":", "p", "[", "0", "]", "=", "make_binary", "(", "p", ".", "lineno", "(", "2", ")", ",", "'BAND'", ",", "p", "[", "1", "]", ",", "p", "[", "3", "]", ",", "lambda", "x", ",", "y", ":", "x", "&", "...
expr : expr BAND expr
[ "expr", ":", "expr", "BAND", "expr" ]
python
train
33.75
anomaly/prestans
prestans/types/model.py
https://github.com/anomaly/prestans/blob/13f5b2467bfd403dcd2d085f15cbf4644044f105/prestans/types/model.py#L294-L318
def attribute_rewrite_map(self): """ Example: long_name -> a_b :return: the rewrite map :rtype: dict """ rewrite_map = dict() token_rewrite_map = self.generate_attribute_token_rewrite_map() for attribute_name, type_instance in self.getmembers(): ...
[ "def", "attribute_rewrite_map", "(", "self", ")", ":", "rewrite_map", "=", "dict", "(", ")", "token_rewrite_map", "=", "self", ".", "generate_attribute_token_rewrite_map", "(", ")", "for", "attribute_name", ",", "type_instance", "in", "self", ".", "getmembers", "(...
Example: long_name -> a_b :return: the rewrite map :rtype: dict
[ "Example", ":", "long_name", "-", ">", "a_b" ]
python
train
31.88
colab/colab
colab/accounts/views.py
https://github.com/colab/colab/blob/2ad099231e620bec647363b27d38006eca71e13b/colab/accounts/views.py#L151-L178
def delete(self, request, key): """Remove an email address, validated or not.""" request.DELETE = http.QueryDict(request.body) email_addr = request.DELETE.get('email') user_id = request.DELETE.get('user') if not email_addr: return http.HttpResponseBadRequest() ...
[ "def", "delete", "(", "self", ",", "request", ",", "key", ")", ":", "request", ".", "DELETE", "=", "http", ".", "QueryDict", "(", "request", ".", "body", ")", "email_addr", "=", "request", ".", "DELETE", ".", "get", "(", "'email'", ")", "user_id", "=...
Remove an email address, validated or not.
[ "Remove", "an", "email", "address", "validated", "or", "not", "." ]
python
train
32.642857
matrix-org/matrix-python-sdk
matrix_client/api.py
https://github.com/matrix-org/matrix-python-sdk/blob/e734cce3ccd35f2d355c6a19a7a701033472498a/matrix_client/api.py#L223-L234
def join_room(self, room_id_or_alias): """Performs /join/$room_id Args: room_id_or_alias (str): The room ID or room alias to join. """ if not room_id_or_alias: raise MatrixError("No alias or room ID to join.") path = "/join/%s" % quote(room_id_or_alias) ...
[ "def", "join_room", "(", "self", ",", "room_id_or_alias", ")", ":", "if", "not", "room_id_or_alias", ":", "raise", "MatrixError", "(", "\"No alias or room ID to join.\"", ")", "path", "=", "\"/join/%s\"", "%", "quote", "(", "room_id_or_alias", ")", "return", "self...
Performs /join/$room_id Args: room_id_or_alias (str): The room ID or room alias to join.
[ "Performs", "/", "join", "/", "$room_id" ]
python
train
29.083333
qiniu/python-sdk
qiniu/auth.py
https://github.com/qiniu/python-sdk/blob/a69fbef4e3e6ea1ebe09f4610a5b18bb2c17de59/qiniu/auth.py#L107-L125
def private_download_url(self, url, expires=3600): """生成私有资源下载链接 Args: url: 私有空间资源的原始URL expires: 下载凭证有效期,默认为3600s Returns: 私有资源的下载链接 """ deadline = int(time.time()) + expires if '?' in url: url += '&' else: ...
[ "def", "private_download_url", "(", "self", ",", "url", ",", "expires", "=", "3600", ")", ":", "deadline", "=", "int", "(", "time", ".", "time", "(", ")", ")", "+", "expires", "if", "'?'", "in", "url", ":", "url", "+=", "'&'", "else", ":", "url", ...
生成私有资源下载链接 Args: url: 私有空间资源的原始URL expires: 下载凭证有效期,默认为3600s Returns: 私有资源的下载链接
[ "生成私有资源下载链接" ]
python
train
24.052632
openxc/openxc-python
openxc/sources/trace.py
https://github.com/openxc/openxc-python/blob/4becb4a6310bd658c125195ef6ffea4deaf7d7e7/openxc/sources/trace.py#L54-L70
def read(self): """Read a line of data from the input source at a time.""" line = self.trace_file.readline() if line == '': if self.loop: self._reopen_file() else: self.trace_file.close() self.trace_file = None ...
[ "def", "read", "(", "self", ")", ":", "line", "=", "self", ".", "trace_file", ".", "readline", "(", ")", "if", "line", "==", "''", ":", "if", "self", ".", "loop", ":", "self", ".", "_reopen_file", "(", ")", "else", ":", "self", ".", "trace_file", ...
Read a line of data from the input source at a time.
[ "Read", "a", "line", "of", "data", "from", "the", "input", "source", "at", "a", "time", "." ]
python
train
37.294118
IdentityPython/fedoidcmsg
src/fedoidcmsg/signing_service.py
https://github.com/IdentityPython/fedoidcmsg/blob/d30107be02521fa6cdfe285da3b6b0cdd153c8cc/src/fedoidcmsg/signing_service.py#L265-L275
def create(self, req, **kwargs): """ Uses POST to send a first metadata statement signing request to a signing service. :param req: The metadata statement that the entity wants signed :return: returns a dictionary with 'sms' and 'loc' as keys. """ response = req...
[ "def", "create", "(", "self", ",", "req", ",", "*", "*", "kwargs", ")", ":", "response", "=", "requests", ".", "post", "(", "self", ".", "url", ",", "json", "=", "req", ",", "*", "*", "self", ".", "req_args", "(", ")", ")", "return", "self", "....
Uses POST to send a first metadata statement signing request to a signing service. :param req: The metadata statement that the entity wants signed :return: returns a dictionary with 'sms' and 'loc' as keys.
[ "Uses", "POST", "to", "send", "a", "first", "metadata", "statement", "signing", "request", "to", "a", "signing", "service", "." ]
python
test
36.727273
pteichman/cobe
cobe/brain.py
https://github.com/pteichman/cobe/blob/b0dc2a707035035b9a689105c8f833894fb59eb7/cobe/brain.py#L154-L165
def _to_graph(self, contexts): """This is an iterator that returns each edge of our graph with its two nodes""" prev = None for context in contexts: if prev is None: prev = context continue yield prev[0], context[1], context[0] ...
[ "def", "_to_graph", "(", "self", ",", "contexts", ")", ":", "prev", "=", "None", "for", "context", "in", "contexts", ":", "if", "prev", "is", "None", ":", "prev", "=", "context", "continue", "yield", "prev", "[", "0", "]", ",", "context", "[", "1", ...
This is an iterator that returns each edge of our graph with its two nodes
[ "This", "is", "an", "iterator", "that", "returns", "each", "edge", "of", "our", "graph", "with", "its", "two", "nodes" ]
python
train
27.083333
all-umass/graphs
graphs/base/base.py
https://github.com/all-umass/graphs/blob/4fbeb025dfe33340335f34300f58dd3809228822/graphs/base/base.py#L139-L148
def to_igraph(self, weighted=None): '''Converts this Graph object to an igraph-compatible object. Requires the python-igraph library.''' # Import here to avoid ImportErrors when igraph isn't available. import igraph ig = igraph.Graph(n=self.num_vertices(), edges=self.pairs().tolist(), ...
[ "def", "to_igraph", "(", "self", ",", "weighted", "=", "None", ")", ":", "# Import here to avoid ImportErrors when igraph isn't available.", "import", "igraph", "ig", "=", "igraph", ".", "Graph", "(", "n", "=", "self", ".", "num_vertices", "(", ")", ",", "edges"...
Converts this Graph object to an igraph-compatible object. Requires the python-igraph library.
[ "Converts", "this", "Graph", "object", "to", "an", "igraph", "-", "compatible", "object", ".", "Requires", "the", "python", "-", "igraph", "library", "." ]
python
train
45.8
fabiobatalha/crossrefapi
crossref/restful.py
https://github.com/fabiobatalha/crossrefapi/blob/53f84ee0d8a8fc6ad9b2493f51c5151e66d2faf7/crossref/restful.py#L901-L959
def doi(self, doi, only_message=True): """ This method retrieve the DOI metadata related to a given DOI number. args: Crossref DOI id (String) return: JSON Example: >>> from crossref.restful import Works >>> works = Works() >>> works...
[ "def", "doi", "(", "self", ",", "doi", ",", "only_message", "=", "True", ")", ":", "request_url", "=", "build_url_endpoint", "(", "'/'", ".", "join", "(", "[", "self", ".", "ENDPOINT", ",", "doi", "]", ")", ")", "request_params", "=", "{", "}", "resu...
This method retrieve the DOI metadata related to a given DOI number. args: Crossref DOI id (String) return: JSON Example: >>> from crossref.restful import Works >>> works = Works() >>> works.doi('10.1590/S0004-28032013005000001') {'is-re...
[ "This", "method", "retrieve", "the", "DOI", "metadata", "related", "to", "a", "given", "DOI", "number", "." ]
python
train
54.271186
inasafe/inasafe
safe/gis/raster/zonal_statistics.py
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gis/raster/zonal_statistics.py#L37-L154
def zonal_stats(raster, vector): """Reclassify a continuous raster layer. Issue https://github.com/inasafe/inasafe/issues/3190 The algorithm will take care about projections. We don't want to reproject the raster layer. So if CRS are different, we reproject the vector layer and then we do a lo...
[ "def", "zonal_stats", "(", "raster", ",", "vector", ")", ":", "output_layer_name", "=", "zonal_stats_steps", "[", "'output_layer_name'", "]", "exposure", "=", "raster", ".", "keywords", "[", "'exposure'", "]", "if", "raster", ".", "crs", "(", ")", ".", "auth...
Reclassify a continuous raster layer. Issue https://github.com/inasafe/inasafe/issues/3190 The algorithm will take care about projections. We don't want to reproject the raster layer. So if CRS are different, we reproject the vector layer and then we do a lookup from the reprojected layer to the o...
[ "Reclassify", "a", "continuous", "raster", "layer", "." ]
python
train
34.974576
senaite/senaite.core
bika/lims/workflow/analysis/guards.py
https://github.com/senaite/senaite.core/blob/7602ce2ea2f9e81eb34e20ce17b98a3e70713f85/bika/lims/workflow/analysis/guards.py#L104-L145
def guard_submit(analysis): """Return whether the transition "submit" can be performed or not """ # Cannot submit without a result if not analysis.getResult(): return False # Cannot submit with interims without value for interim in analysis.getInterimFields(): if not interim.get...
[ "def", "guard_submit", "(", "analysis", ")", ":", "# Cannot submit without a result", "if", "not", "analysis", ".", "getResult", "(", ")", ":", "return", "False", "# Cannot submit with interims without value", "for", "interim", "in", "analysis", ".", "getInterimFields",...
Return whether the transition "submit" can be performed or not
[ "Return", "whether", "the", "transition", "submit", "can", "be", "performed", "or", "not" ]
python
train
39.261905
flo-compbio/genometools
genometools/ncbi/geo/generate_sample_sheet.py
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/ncbi/geo/generate_sample_sheet.py#L38-L73
def get_argument_parser(): """Create the argument parser for the script. Parameters ---------- Returns ------- `argparse.ArgumentParser` The arguemnt parser. """ desc = 'Generate a sample sheet based on a GEO series matrix.' parser = cli.get_argument_parser(desc=desc) ...
[ "def", "get_argument_parser", "(", ")", ":", "desc", "=", "'Generate a sample sheet based on a GEO series matrix.'", "parser", "=", "cli", ".", "get_argument_parser", "(", "desc", "=", "desc", ")", "g", "=", "parser", ".", "add_argument_group", "(", "'Input and output...
Create the argument parser for the script. Parameters ---------- Returns ------- `argparse.ArgumentParser` The arguemnt parser.
[ "Create", "the", "argument", "parser", "for", "the", "script", "." ]
python
train
24.805556
cloud9ers/gurumate
environment/lib/python2.7/site-packages/nose/twistedtools.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/twistedtools.py#L86-L172
def deferred(timeout=None): """ By wrapping a test function with this decorator, you can return a twisted Deferred and the test will wait for the deferred to be triggered. The whole test function will run inside the Twisted event loop. The optional timeout parameter specifies the maximum duration o...
[ "def", "deferred", "(", "timeout", "=", "None", ")", ":", "reactor", ",", "reactor_thread", "=", "threaded_reactor", "(", ")", "if", "reactor", "is", "None", ":", "raise", "ImportError", "(", "\"twisted is not available or could not be imported\"", ")", "# Check for...
By wrapping a test function with this decorator, you can return a twisted Deferred and the test will wait for the deferred to be triggered. The whole test function will run inside the Twisted event loop. The optional timeout parameter specifies the maximum duration of the test. The difference with time...
[ "By", "wrapping", "a", "test", "function", "with", "this", "decorator", "you", "can", "return", "a", "twisted", "Deferred", "and", "the", "test", "will", "wait", "for", "the", "deferred", "to", "be", "triggered", ".", "The", "whole", "test", "function", "w...
python
test
36.689655
bspaans/python-mingus
mingus/core/intervals.py
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/core/intervals.py#L292-L302
def invert(interval): """Invert an interval. Example: >>> invert(['C', 'E']) ['E', 'C'] """ interval.reverse() res = list(interval) interval.reverse() return res
[ "def", "invert", "(", "interval", ")", ":", "interval", ".", "reverse", "(", ")", "res", "=", "list", "(", "interval", ")", "interval", ".", "reverse", "(", ")", "return", "res" ]
Invert an interval. Example: >>> invert(['C', 'E']) ['E', 'C']
[ "Invert", "an", "interval", "." ]
python
train
17.090909
PyThaiNLP/pythainlp
pythainlp/tag/__init__.py
https://github.com/PyThaiNLP/pythainlp/blob/e9a300b8a99dfd1a67a955e7c06f62e4afe0fbca/pythainlp/tag/__init__.py#L160-L180
def pos_tag_sents( sentences: List[List[str]], engine: str = "perceptron", corpus: str = "orchid" ) -> List[List[Tuple[str, str]]]: """ Part of Speech tagging Sentence function. :param list sentences: a list of lists of tokenized words :param str engine: * unigram - unigram tagger *...
[ "def", "pos_tag_sents", "(", "sentences", ":", "List", "[", "List", "[", "str", "]", "]", ",", "engine", ":", "str", "=", "\"perceptron\"", ",", "corpus", ":", "str", "=", "\"orchid\"", ")", "->", "List", "[", "List", "[", "Tuple", "[", "str", ",", ...
Part of Speech tagging Sentence function. :param list sentences: a list of lists of tokenized words :param str engine: * unigram - unigram tagger * perceptron - perceptron tagger (default) * artagger - RDR POS tagger :param str corpus: * orchid - annotated Thai academic arti...
[ "Part", "of", "Speech", "tagging", "Sentence", "function", "." ]
python
train
38.952381
ellmetha/django-machina
machina/apps/forum_permission/handler.py
https://github.com/ellmetha/django-machina/blob/89ac083c1eaf1cfdeae6686ee094cc86362e8c69/machina/apps/forum_permission/handler.py#L225-L234
def can_unsubscribe_from_topic(self, topic, user): """ Given a topic, checks whether the user can remove it from their subscription list. """ # A user can unsubscribe from topics if they are authenticated and if they have the # permission to read the related forum. Of course a user can unsubscri...
[ "def", "can_unsubscribe_from_topic", "(", "self", ",", "topic", ",", "user", ")", ":", "# A user can unsubscribe from topics if they are authenticated and if they have the", "# permission to read the related forum. Of course a user can unsubscribe only if they are", "# already a subscriber ...
Given a topic, checks whether the user can remove it from their subscription list.
[ "Given", "a", "topic", "checks", "whether", "the", "user", "can", "remove", "it", "from", "their", "subscription", "list", "." ]
python
train
58.1
lsst-sqre/documenteer
documenteer/stackdocs/build.py
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/stackdocs/build.py#L159-L198
def discover_setup_packages(): """Summarize packages currently set up by EUPS, listing their set up directories and EUPS version names. Returns ------- packages : `dict` Dictionary with keys that are EUPS package names. Values are dictionaries with fields: - ``'dir'``: absolut...
[ "def", "discover_setup_packages", "(", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", "__name__", ")", "# Not a PyPI dependency; assumed to be available in the build environment.", "import", "eups", "eups_client", "=", "eups", ".", "Eups", "(", ")", "product...
Summarize packages currently set up by EUPS, listing their set up directories and EUPS version names. Returns ------- packages : `dict` Dictionary with keys that are EUPS package names. Values are dictionaries with fields: - ``'dir'``: absolute directory path of the set up package...
[ "Summarize", "packages", "currently", "set", "up", "by", "EUPS", "listing", "their", "set", "up", "directories", "and", "EUPS", "version", "names", "." ]
python
train
29.85
timgabets/bpc8583
examples/isoClient.py
https://github.com/timgabets/bpc8583/blob/1b8e95d73ad273ad9d11bff40d1af3f06f0f3503/examples/isoClient.py#L301-L314
def show_help(name): """ Show help and basic usage """ print('Usage: python3 {} [OPTIONS]... '.format(name)) print('ISO8583 message client') print(' -v, --verbose\t\tRun transactions verbosely') print(' -p, --port=[PORT]\t\tTCP port to connect to, 1337 by default') print(' -s, --serve...
[ "def", "show_help", "(", "name", ")", ":", "print", "(", "'Usage: python3 {} [OPTIONS]... '", ".", "format", "(", "name", ")", ")", "print", "(", "'ISO8583 message client'", ")", "print", "(", "' -v, --verbose\\t\\tRun transactions verbosely'", ")", "print", "(", "...
Show help and basic usage
[ "Show", "help", "and", "basic", "usage" ]
python
train
62.285714
bcbio/bcbio-nextgen
bcbio/variation/population.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/population.py#L56-L71
def _back_compatible_gemini(conf_files, data): """Provide old install directory for configuration with GEMINI supplied tidy VCFs. Handles new style (bcbio installed) and old style (GEMINI installed) configuration and data locations. """ if vcfanno.is_human(data, builds=["37"]): for f in con...
[ "def", "_back_compatible_gemini", "(", "conf_files", ",", "data", ")", ":", "if", "vcfanno", ".", "is_human", "(", "data", ",", "builds", "=", "[", "\"37\"", "]", ")", ":", "for", "f", "in", "conf_files", ":", "if", "f", "and", "os", ".", "path", "."...
Provide old install directory for configuration with GEMINI supplied tidy VCFs. Handles new style (bcbio installed) and old style (GEMINI installed) configuration and data locations.
[ "Provide", "old", "install", "directory", "for", "configuration", "with", "GEMINI", "supplied", "tidy", "VCFs", "." ]
python
train
47.625
DAI-Lab/Copulas
copulas/univariate/base.py
https://github.com/DAI-Lab/Copulas/blob/821df61c3d36a6b81ef2883935f935c2eaaa862c/copulas/univariate/base.py#L267-L296
def fit(self, X, *args, **kwargs): """Fit scipy model to an array of values. Args: X(`np.ndarray` or `pd.DataFrame`): Datapoints to be estimated from. Must be 1-d Returns: None """ self.constant_value = self._get_constant_value(X) if self.cons...
[ "def", "fit", "(", "self", ",", "X", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "constant_value", "=", "self", ".", "_get_constant_value", "(", "X", ")", "if", "self", ".", "constant_value", "is", "None", ":", "if", "self", "...
Fit scipy model to an array of values. Args: X(`np.ndarray` or `pd.DataFrame`): Datapoints to be estimated from. Must be 1-d Returns: None
[ "Fit", "scipy", "model", "to", "an", "array", "of", "values", "." ]
python
train
32.4
tcalmant/ipopo
pelix/threadpool.py
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/threadpool.py#L97-L103
def set(self, data=None): """ Sets the event """ self.__data = data self.__exception = None self.__event.set()
[ "def", "set", "(", "self", ",", "data", "=", "None", ")", ":", "self", ".", "__data", "=", "data", "self", ".", "__exception", "=", "None", "self", ".", "__event", ".", "set", "(", ")" ]
Sets the event
[ "Sets", "the", "event" ]
python
train
21.714286
rkhleics/wagtailmodeladmin
wagtailmodeladmin/options.py
https://github.com/rkhleics/wagtailmodeladmin/blob/7fddc853bab2ff3868b8c7a03329308c55f16358/wagtailmodeladmin/options.py#L589-L598
def get_permissions_for_registration(self): """ Utilised by Wagtail's 'register_permissions' hook to allow permissions for a all models grouped by this class to be assigned to Groups in settings. """ qs = Permission.objects.none() for instance in self.modeladmin_i...
[ "def", "get_permissions_for_registration", "(", "self", ")", ":", "qs", "=", "Permission", ".", "objects", ".", "none", "(", ")", "for", "instance", "in", "self", ".", "modeladmin_instances", ":", "qs", "=", "qs", "|", "instance", ".", "get_permissions_for_reg...
Utilised by Wagtail's 'register_permissions' hook to allow permissions for a all models grouped by this class to be assigned to Groups in settings.
[ "Utilised", "by", "Wagtail", "s", "register_permissions", "hook", "to", "allow", "permissions", "for", "a", "all", "models", "grouped", "by", "this", "class", "to", "be", "assigned", "to", "Groups", "in", "settings", "." ]
python
train
40.4
angr/angr
angr/analyses/cfg/cfg_emulated.py
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_emulated.py#L873-L904
def _pre_analysis(self): """ Initialization work. Executed prior to the analysis. :return: None """ # Fill up self._starts for item in self._starts: callstack = None if isinstance(item, tuple): # (addr, jumpkind) i...
[ "def", "_pre_analysis", "(", "self", ")", ":", "# Fill up self._starts", "for", "item", "in", "self", ".", "_starts", ":", "callstack", "=", "None", "if", "isinstance", "(", "item", ",", "tuple", ")", ":", "# (addr, jumpkind)", "ip", "=", "item", "[", "0",...
Initialization work. Executed prior to the analysis. :return: None
[ "Initialization", "work", ".", "Executed", "prior", "to", "the", "analysis", "." ]
python
train
35.96875
openego/eDisGo
edisgo/grid/components.py
https://github.com/openego/eDisGo/blob/e6245bdaf236f9c49dbda5a18c1c458290f41e2b/edisgo/grid/components.py#L772-L836
def timeseries(self): """ Feed-in time series of generator It returns the actual time series used in power flow analysis. If :attr:`_timeseries` is not :obj:`None`, it is returned. Otherwise, :meth:`timeseries` looks for generation and curtailment time series of the acco...
[ "def", "timeseries", "(", "self", ")", ":", "if", "self", ".", "_timeseries", "is", "None", ":", "# get time series for active power depending on if they are", "# differentiated by weather cell ID or not", "if", "isinstance", "(", "self", ".", "grid", ".", "network", "....
Feed-in time series of generator It returns the actual time series used in power flow analysis. If :attr:`_timeseries` is not :obj:`None`, it is returned. Otherwise, :meth:`timeseries` looks for generation and curtailment time series of the according type of technology (and weather cell...
[ "Feed", "-", "in", "time", "series", "of", "generator" ]
python
train
42.2
Cornices/cornice.ext.swagger
cornice_swagger/swagger.py
https://github.com/Cornices/cornice.ext.swagger/blob/c31a5cc8d5dd112b11dc41ccb6d09b423b537abc/cornice_swagger/swagger.py#L110-L145
def from_schema(self, schema_node): """ Creates a list of Swagger params from a colander request schema. :param schema_node: Request schema to be transformed into Swagger. :param validators: Validators used in colander with the schema. :rtype: list ...
[ "def", "from_schema", "(", "self", ",", "schema_node", ")", ":", "params", "=", "[", "]", "for", "param_schema", "in", "schema_node", ".", "children", ":", "location", "=", "param_schema", ".", "name", "if", "location", "is", "'body'", ":", "name", "=", ...
Creates a list of Swagger params from a colander request schema. :param schema_node: Request schema to be transformed into Swagger. :param validators: Validators used in colander with the schema. :rtype: list :returns: List of Swagger parameters.
[ "Creates", "a", "list", "of", "Swagger", "params", "from", "a", "colander", "request", "schema", "." ]
python
valid
35.472222
kblin/ncbi-genome-download
ncbi_genome_download/core.py
https://github.com/kblin/ncbi-genome-download/blob/dc55382d351c29e1027be8fa3876701762c1d752/ncbi_genome_download/core.py#L213-L235
def select_candidates(config): """Select candidates to download. Parameters ---------- config: NgdConfig Runtime configuration object Returns ------- list of (<candidate entry>, <taxonomic group>) """ download_candidates = [] for group in config.group: summary...
[ "def", "select_candidates", "(", "config", ")", ":", "download_candidates", "=", "[", "]", "for", "group", "in", "config", ".", "group", ":", "summary_file", "=", "get_summary", "(", "config", ".", "section", ",", "group", ",", "config", ".", "uri", ",", ...
Select candidates to download. Parameters ---------- config: NgdConfig Runtime configuration object Returns ------- list of (<candidate entry>, <taxonomic group>)
[ "Select", "candidates", "to", "download", "." ]
python
train
24.26087
quantopian/zipline
zipline/finance/ledger.py
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/finance/ledger.py#L582-L621
def process_dividends(self, next_session, asset_finder, adjustment_reader): """Process dividends for the next session. This will earn us any dividends whose ex-date is the next session as well as paying out any dividends whose pay-date is the next session """ position_tracker = ...
[ "def", "process_dividends", "(", "self", ",", "next_session", ",", "asset_finder", ",", "adjustment_reader", ")", ":", "position_tracker", "=", "self", ".", "position_tracker", "# Earn dividends whose ex_date is the next trading day. We need to", "# check if we own any of these s...
Process dividends for the next session. This will earn us any dividends whose ex-date is the next session as well as paying out any dividends whose pay-date is the next session
[ "Process", "dividends", "for", "the", "next", "session", "." ]
python
train
36.75
ray-project/ray
python/ray/tune/ray_trial_executor.py
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/ray_trial_executor.py#L258-L276
def reset_trial(self, trial, new_config, new_experiment_tag): """Tries to invoke `Trainable.reset_config()` to reset trial. Args: trial (Trial): Trial to be reset. new_config (dict): New configuration for Trial trainable. new_experiment_tag (str): New...
[ "def", "reset_trial", "(", "self", ",", "trial", ",", "new_config", ",", "new_experiment_tag", ")", ":", "trial", ".", "experiment_tag", "=", "new_experiment_tag", "trial", ".", "config", "=", "new_config", "trainable", "=", "trial", ".", "runner", "with", "wa...
Tries to invoke `Trainable.reset_config()` to reset trial. Args: trial (Trial): Trial to be reset. new_config (dict): New configuration for Trial trainable. new_experiment_tag (str): New experiment name for trial. Returns: ...
[ "Tries", "to", "invoke", "Trainable", ".", "reset_config", "()", "to", "reset", "trial", "." ]
python
train
36.631579
quodlibet/mutagen
mutagen/easymp4.py
https://github.com/quodlibet/mutagen/blob/e393df5971ba41ba5a50de9c2c9e7e5484d82c4e/mutagen/easymp4.py#L83-L101
def RegisterTextKey(cls, key, atomid): """Register a text key. If the key you need to register is a simple one-to-one mapping of MP4 atom name to EasyMP4Tags key, then you can use this function:: EasyMP4Tags.RegisterTextKey("artist", "\xa9ART") """ def gette...
[ "def", "RegisterTextKey", "(", "cls", ",", "key", ",", "atomid", ")", ":", "def", "getter", "(", "tags", ",", "key", ")", ":", "return", "tags", "[", "atomid", "]", "def", "setter", "(", "tags", ",", "key", ",", "value", ")", ":", "tags", "[", "a...
Register a text key. If the key you need to register is a simple one-to-one mapping of MP4 atom name to EasyMP4Tags key, then you can use this function:: EasyMP4Tags.RegisterTextKey("artist", "\xa9ART")
[ "Register", "a", "text", "key", "." ]
python
train
28.263158
watson-developer-cloud/python-sdk
ibm_watson/visual_recognition_v3.py
https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/visual_recognition_v3.py#L722-L731
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'class_name') and self.class_name is not None: _dict['class'] = self.class_name if hasattr(self, 'score') and self.score is not None: _dict['score'] = self.scor...
[ "def", "_to_dict", "(", "self", ")", ":", "_dict", "=", "{", "}", "if", "hasattr", "(", "self", ",", "'class_name'", ")", "and", "self", ".", "class_name", "is", "not", "None", ":", "_dict", "[", "'class'", "]", "=", "self", ".", "class_name", "if", ...
Return a json dictionary representing this model.
[ "Return", "a", "json", "dictionary", "representing", "this", "model", "." ]
python
train
47.1
bitshares/uptick
uptick/markets.py
https://github.com/bitshares/uptick/blob/66c102200fdbf96cef4fd55cc69d00e690f62001/uptick/markets.py#L56-L64
def ticker(ctx, market): """ Show ticker of a market """ market = Market(market, bitshares_instance=ctx.bitshares) ticker = market.ticker() t = [["key", "value"]] for key in ticker: t.append([key, str(ticker[key])]) print_table(t)
[ "def", "ticker", "(", "ctx", ",", "market", ")", ":", "market", "=", "Market", "(", "market", ",", "bitshares_instance", "=", "ctx", ".", "bitshares", ")", "ticker", "=", "market", ".", "ticker", "(", ")", "t", "=", "[", "[", "\"key\"", ",", "\"value...
Show ticker of a market
[ "Show", "ticker", "of", "a", "market" ]
python
train
28.666667
pytest-dev/pytest-xdist
xdist/dsession.py
https://github.com/pytest-dev/pytest-xdist/blob/9fcf8fa636bc69ee6cac9348a6ec20c87f2bb5e4/xdist/dsession.py#L210-L236
def worker_collectionfinish(self, node, ids): """worker has finished test collection. This adds the collection for this node to the scheduler. If the scheduler indicates collection is finished (i.e. all initial nodes have submitted their collections), then tells the scheduler t...
[ "def", "worker_collectionfinish", "(", "self", ",", "node", ",", "ids", ")", ":", "if", "self", ".", "shuttingdown", ":", "return", "self", ".", "config", ".", "hook", ".", "pytest_xdist_node_collection_finished", "(", "node", "=", "node", ",", "ids", "=", ...
worker has finished test collection. This adds the collection for this node to the scheduler. If the scheduler indicates collection is finished (i.e. all initial nodes have submitted their collections), then tells the scheduler to schedule the collected items. When initiating ...
[ "worker", "has", "finished", "test", "collection", "." ]
python
train
49.666667
tensorflow/tensor2tensor
tensor2tensor/utils/metrics.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/metrics.py#L286-L294
def rounding_accuracy(predictions, labels, weights_fn=common_layers.weights_nonzero): """Rounding accuracy for L1/L2 losses: round down the predictions to ints.""" outputs = tf.squeeze(tf.to_int32(predictions)) labels = tf.squeeze(labels) weights = weights_fn(labels) ...
[ "def", "rounding_accuracy", "(", "predictions", ",", "labels", ",", "weights_fn", "=", "common_layers", ".", "weights_nonzero", ")", ":", "outputs", "=", "tf", ".", "squeeze", "(", "tf", ".", "to_int32", "(", "predictions", ")", ")", "labels", "=", "tf", "...
Rounding accuracy for L1/L2 losses: round down the predictions to ints.
[ "Rounding", "accuracy", "for", "L1", "/", "L2", "losses", ":", "round", "down", "the", "predictions", "to", "ints", "." ]
python
train
44.333333
wonambi-python/wonambi
wonambi/viz/base.py
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/viz/base.py#L30-L37
def _repr_png_(self): """This is used by ipython to plot inline. """ app.process_events() QApplication.processEvents() img = read_pixels() return bytes(_make_png(img))
[ "def", "_repr_png_", "(", "self", ")", ":", "app", ".", "process_events", "(", ")", "QApplication", ".", "processEvents", "(", ")", "img", "=", "read_pixels", "(", ")", "return", "bytes", "(", "_make_png", "(", "img", ")", ")" ]
This is used by ipython to plot inline.
[ "This", "is", "used", "by", "ipython", "to", "plot", "inline", "." ]
python
train
26.125
chatfirst/chatfirst
chatfirst/client.py
https://github.com/chatfirst/chatfirst/blob/11e023fc372e034dfd3417b61b67759ef8c37ad6/chatfirst/client.py#L29-L36
def bots_create(self, bot): """ Save new bot :param bot: bot object to save :type bot: Bot """ self.client.bots(_method="POST", _json=bot.to_json(), _params=dict(userToken=self.token))
[ "def", "bots_create", "(", "self", ",", "bot", ")", ":", "self", ".", "client", ".", "bots", "(", "_method", "=", "\"POST\"", ",", "_json", "=", "bot", ".", "to_json", "(", ")", ",", "_params", "=", "dict", "(", "userToken", "=", "self", ".", "toke...
Save new bot :param bot: bot object to save :type bot: Bot
[ "Save", "new", "bot" ]
python
train
28.25
nteract/papermill
papermill/execute.py
https://github.com/nteract/papermill/blob/7423a303f3fa22ec6d03edf5fd9700d659b5a6fa/papermill/execute.py#L143-L181
def raise_for_execution_errors(nb, output_path): """Assigned parameters into the appropriate place in the input notebook Parameters ---------- nb : NotebookNode Executable notebook object output_path : str Path to write executed notebook """ error = None for cell in nb.cel...
[ "def", "raise_for_execution_errors", "(", "nb", ",", "output_path", ")", ":", "error", "=", "None", "for", "cell", "in", "nb", ".", "cells", ":", "if", "cell", ".", "get", "(", "\"outputs\"", ")", "is", "None", ":", "continue", "for", "output", "in", "...
Assigned parameters into the appropriate place in the input notebook Parameters ---------- nb : NotebookNode Executable notebook object output_path : str Path to write executed notebook
[ "Assigned", "parameters", "into", "the", "appropriate", "place", "in", "the", "input", "notebook" ]
python
train
33.74359
angr/angr
angr/storage/file.py
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/storage/file.py#L413-L477
def read(self, pos, size, **kwargs): """ Read a packet from the stream. :param int pos: The packet number to read from the sequence of the stream. May be None to append to the stream. :param size: The size to read. May be symbolic. :param short_reads: Whether to repla...
[ "def", "read", "(", "self", ",", "pos", ",", "size", ",", "*", "*", "kwargs", ")", ":", "short_reads", "=", "kwargs", ".", "pop", "(", "'short_reads'", ",", "None", ")", "# sanity check on read/write modes", "if", "self", ".", "write_mode", "is", "None", ...
Read a packet from the stream. :param int pos: The packet number to read from the sequence of the stream. May be None to append to the stream. :param size: The size to read. May be symbolic. :param short_reads: Whether to replace the size with a symbolic value constrained to less tha...
[ "Read", "a", "packet", "from", "the", "stream", "." ]
python
train
55.169231
poppy-project/pypot
pypot/vrep/remoteApiBindings/vrep.py
https://github.com/poppy-project/pypot/blob/d9c6551bbc87d45d9d1f0bc15e35b616d0002afd/pypot/vrep/remoteApiBindings/vrep.py#L725-L733
def simxGetDistanceHandle(clientID, distanceObjectName, operationMode): ''' Please have a look at the function description/documentation in the V-REP user manual ''' handle = ct.c_int() if (sys.version_info[0] == 3) and (type(distanceObjectName) is str): distanceObjectName=distanceObjectNam...
[ "def", "simxGetDistanceHandle", "(", "clientID", ",", "distanceObjectName", ",", "operationMode", ")", ":", "handle", "=", "ct", ".", "c_int", "(", ")", "if", "(", "sys", ".", "version_info", "[", "0", "]", "==", "3", ")", "and", "(", "type", "(", "dis...
Please have a look at the function description/documentation in the V-REP user manual
[ "Please", "have", "a", "look", "at", "the", "function", "description", "/", "documentation", "in", "the", "V", "-", "REP", "user", "manual" ]
python
train
48.555556
xeroc/python-graphenelib
graphenestorage/masterpassword.py
https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenestorage/masterpassword.py#L116-L131
def _new_masterpassword(self, password): """ Generate a new random masterkey, encrypt it with the password and store it in the store. :param str password: Password to use for en-/de-cryption """ # make sure to not overwrite an existing key if self.config_key in s...
[ "def", "_new_masterpassword", "(", "self", ",", "password", ")", ":", "# make sure to not overwrite an existing key", "if", "self", ".", "config_key", "in", "self", ".", "config", "and", "self", ".", "config", "[", "self", ".", "config_key", "]", ":", "raise", ...
Generate a new random masterkey, encrypt it with the password and store it in the store. :param str password: Password to use for en-/de-cryption
[ "Generate", "a", "new", "random", "masterkey", "encrypt", "it", "with", "the", "password", "and", "store", "it", "in", "the", "store", "." ]
python
valid
39.6875
nabla-c0d3/sslyze
sslyze/plugins/utils/certificate_utils.py
https://github.com/nabla-c0d3/sslyze/blob/0fb3ae668453d7ecf616d0755f237ca7be9f62fa/sslyze/plugins/utils/certificate_utils.py#L95-L108
def has_ocsp_must_staple_extension(certificate: cryptography.x509.Certificate) -> bool: """Return True if the certificate has the OCSP Must-Staple extension defined in RFC 6066. """ has_ocsp_must_staple = False try: tls_feature_ext = certificate.extensions.get_extension_for_o...
[ "def", "has_ocsp_must_staple_extension", "(", "certificate", ":", "cryptography", ".", "x509", ".", "Certificate", ")", "->", "bool", ":", "has_ocsp_must_staple", "=", "False", "try", ":", "tls_feature_ext", "=", "certificate", ".", "extensions", ".", "get_extension...
Return True if the certificate has the OCSP Must-Staple extension defined in RFC 6066.
[ "Return", "True", "if", "the", "certificate", "has", "the", "OCSP", "Must", "-", "Staple", "extension", "defined", "in", "RFC", "6066", "." ]
python
train
45.428571
PyCQA/pydocstyle
src/pydocstyle/config.py
https://github.com/PyCQA/pydocstyle/blob/2549847f9efad225789f931e83dfe782418ca13e/src/pydocstyle/config.py#L515-L545
def _fix_set_options(cls, options): """Alter the set options from None/strings to sets in place.""" optional_set_options = ('ignore', 'select') mandatory_set_options = ('add_ignore', 'add_select') def _get_set(value_str): """Split `value_str` by the delimiter `,` and return ...
[ "def", "_fix_set_options", "(", "cls", ",", "options", ")", ":", "optional_set_options", "=", "(", "'ignore'", ",", "'select'", ")", "mandatory_set_options", "=", "(", "'add_ignore'", ",", "'add_select'", ")", "def", "_get_set", "(", "value_str", ")", ":", "\"...
Alter the set options from None/strings to sets in place.
[ "Alter", "the", "set", "options", "from", "None", "/", "strings", "to", "sets", "in", "place", "." ]
python
train
32.354839
google/apitools
ez_setup.py
https://github.com/google/apitools/blob/f3745a7ea535aa0e88b0650c16479b696d6fd446/ez_setup.py#L232-L259
def update_md5(filenames): """Update our built-in md5 registry""" import re for name in filenames: base = os.path.basename(name) f = open(name,'rb') md5_data[base] = md5(f.read()).hexdigest() f.close() data = [" %r: %r,\n" % it for it in md5_data.items()] data.s...
[ "def", "update_md5", "(", "filenames", ")", ":", "import", "re", "for", "name", "in", "filenames", ":", "base", "=", "os", ".", "path", ".", "basename", "(", "name", ")", "f", "=", "open", "(", "name", ",", "'rb'", ")", "md5_data", "[", "base", "]"...
Update our built-in md5 registry
[ "Update", "our", "built", "-", "in", "md5", "registry" ]
python
train
25.5
saltstack/salt
salt/states/pcs.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pcs.py#L360-L444
def auth(name, nodes, pcsuser='hacluster', pcspasswd='hacluster', extra_args=None): ''' Ensure all nodes are authorized to the cluster name Irrelevant, not used (recommended: pcs_auth__auth) nodes a list of nodes which should be authorized to the cluster pcsuser user for com...
[ "def", "auth", "(", "name", ",", "nodes", ",", "pcsuser", "=", "'hacluster'", ",", "pcspasswd", "=", "'hacluster'", ",", "extra_args", "=", "None", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", ":", "True", ",", "'comment'", ":", ...
Ensure all nodes are authorized to the cluster name Irrelevant, not used (recommended: pcs_auth__auth) nodes a list of nodes which should be authorized to the cluster pcsuser user for communication with pcs (default: hacluster) pcspasswd password for pcsuser (default: ha...
[ "Ensure", "all", "nodes", "are", "authorized", "to", "the", "cluster" ]
python
train
34.411765
zhanglab/psamm
psamm/balancecheck.py
https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/balancecheck.py#L31-L43
def reaction_charge(reaction, compound_charge): """Calculate the overall charge for the specified reaction. Args: reaction: :class:`psamm.reaction.Reaction`. compound_charge: a map from each compound to charge values. """ charge_sum = 0.0 for compound, value in reaction.compounds: ...
[ "def", "reaction_charge", "(", "reaction", ",", "compound_charge", ")", ":", "charge_sum", "=", "0.0", "for", "compound", ",", "value", "in", "reaction", ".", "compounds", ":", "charge", "=", "compound_charge", ".", "get", "(", "compound", ".", "name", ",", ...
Calculate the overall charge for the specified reaction. Args: reaction: :class:`psamm.reaction.Reaction`. compound_charge: a map from each compound to charge values.
[ "Calculate", "the", "overall", "charge", "for", "the", "specified", "reaction", "." ]
python
train
33.769231
camptocamp/Studio
studio/lib/helpers.py
https://github.com/camptocamp/Studio/blob/43cb7298434fb606b15136801b79b03571a2f27e/studio/lib/helpers.py#L39-L44
def gen_mapname(): """ Generate a uniq mapfile pathname. """ filepath = None while (filepath is None) or (os.path.exists(os.path.join(config['mapfiles_dir'], filepath))): filepath = '%s.map' % _gen_string() return filepath
[ "def", "gen_mapname", "(", ")", ":", "filepath", "=", "None", "while", "(", "filepath", "is", "None", ")", "or", "(", "os", ".", "path", ".", "exists", "(", "os", ".", "path", ".", "join", "(", "config", "[", "'mapfiles_dir'", "]", ",", "filepath", ...
Generate a uniq mapfile pathname.
[ "Generate", "a", "uniq", "mapfile", "pathname", "." ]
python
train
40.166667
RI-imaging/ODTbrain
odtbrain/_alg3d_bpp.py
https://github.com/RI-imaging/ODTbrain/blob/abbab8b790f10c0c7aea8d858d7d60f2fdd7161e/odtbrain/_alg3d_bpp.py#L84-L547
def backpropagate_3d(uSin, angles, res, nm, lD=0, coords=None, weight_angles=True, onlyreal=False, padding=(True, True), padfac=1.75, padval=None, intp_order=2, dtype=None, num_cores=ncores, save_memory=False, ...
[ "def", "backpropagate_3d", "(", "uSin", ",", "angles", ",", "res", ",", "nm", ",", "lD", "=", "0", ",", "coords", "=", "None", ",", "weight_angles", "=", "True", ",", "onlyreal", "=", "False", ",", "padding", "=", "(", "True", ",", "True", ")", ","...
r"""3D backpropagation Three-dimensional diffraction tomography reconstruction algorithm for scattering of a plane wave :math:`u_0(\mathbf{r}) = u_0(x,y,z)` by a dielectric object with refractive index :math:`n(x,y,z)`. This method implements the 3D backpropagation algorithm :cite:`Mueller...
[ "r", "3D", "backpropagation" ]
python
train
35.724138
trec-kba/streamcorpus-pipeline
streamcorpus_pipeline/config.py
https://github.com/trec-kba/streamcorpus-pipeline/blob/8bb82ea1beb83c6b40ed03fa1659df2897c2292a/streamcorpus_pipeline/config.py#L62-L96
def replace_config(config, name): '''Replace the top-level pipeline configurable object. This investigates a number of sources, including `external_stages_path` and `external_stages_modules` configuration and `streamcorpus_pipeline.stages` entry points, and uses these to find the actual :data:`sub_...
[ "def", "replace_config", "(", "config", ",", "name", ")", ":", "global", "static_stages", "if", "static_stages", "is", "None", ":", "static_stages", "=", "PipelineStages", "(", ")", "stages", "=", "static_stages", "if", "'external_stages_path'", "in", "config", ...
Replace the top-level pipeline configurable object. This investigates a number of sources, including `external_stages_path` and `external_stages_modules` configuration and `streamcorpus_pipeline.stages` entry points, and uses these to find the actual :data:`sub_modules` for :mod:`streamcorpus_pipel...
[ "Replace", "the", "top", "-", "level", "pipeline", "configurable", "object", "." ]
python
test
41.4
boriel/zxbasic
arch/zx48k/backend/__init__.py
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__init__.py#L1374-L1380
def _ret8(ins): """ Returns from a procedure / function an 8bits value """ output = _8bit_oper(ins.quad[1]) output.append('#pragma opt require a') output.append('jp %s' % str(ins.quad[2])) return output
[ "def", "_ret8", "(", "ins", ")", ":", "output", "=", "_8bit_oper", "(", "ins", ".", "quad", "[", "1", "]", ")", "output", ".", "append", "(", "'#pragma opt require a'", ")", "output", ".", "append", "(", "'jp %s'", "%", "str", "(", "ins", ".", "quad"...
Returns from a procedure / function an 8bits value
[ "Returns", "from", "a", "procedure", "/", "function", "an", "8bits", "value" ]
python
train
31.428571
bram85/topydo
topydo/lib/TodoList.py
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/TodoList.py#L240-L247
def children(self, p_todo, p_only_direct=False): """ Returns a list of child todos that the given todo (in)directly depends on. """ children = \ self._depgraph.outgoing_neighbors(hash(p_todo), not p_only_direct) return [self._tododict[child] for child in child...
[ "def", "children", "(", "self", ",", "p_todo", ",", "p_only_direct", "=", "False", ")", ":", "children", "=", "self", ".", "_depgraph", ".", "outgoing_neighbors", "(", "hash", "(", "p_todo", ")", ",", "not", "p_only_direct", ")", "return", "[", "self", "...
Returns a list of child todos that the given todo (in)directly depends on.
[ "Returns", "a", "list", "of", "child", "todos", "that", "the", "given", "todo", "(", "in", ")", "directly", "depends", "on", "." ]
python
train
39.625
pbrisk/businessdate
businessdate/businessdate.py
https://github.com/pbrisk/businessdate/blob/79a0c5a4e557cbacca82a430403b18413404a9bc/businessdate/businessdate.py#L319-L338
def is_businessdate(in_date): """ checks whether the provided date is a date :param BusinessDate, int or float in_date: :return bool: """ # Note: if the data range has been created from pace_xl, then all the dates are bank dates # and here it remains to check the ...
[ "def", "is_businessdate", "(", "in_date", ")", ":", "# Note: if the data range has been created from pace_xl, then all the dates are bank dates", "# and here it remains to check the validity.", "# !!! However, if the data has been read from json string via json.load() function", "# it does not rec...
checks whether the provided date is a date :param BusinessDate, int or float in_date: :return bool:
[ "checks", "whether", "the", "provided", "date", "is", "a", "date", ":", "param", "BusinessDate", "int", "or", "float", "in_date", ":", ":", "return", "bool", ":" ]
python
valid
48.65
sony/nnabla
python/src/nnabla/experimental/graph_converters/batch_normalization_linear.py
https://github.com/sony/nnabla/blob/aaf3d33b7cbb38f2a03aa754178ba8f7c8481320/python/src/nnabla/experimental/graph_converters/batch_normalization_linear.py#L27-L53
def convert(self, vroot, entry_variables): """ All functions are replaced with the same `new` function. Args: vroot (:obj:`Variable`): NNabla Variable entry_variables (:obj:`Variable`): Entry variable from which the conversion starts. """ self.graph_info ...
[ "def", "convert", "(", "self", ",", "vroot", ",", "entry_variables", ")", ":", "self", ".", "graph_info", "=", "GraphInfo", "(", "vroot", ")", "self", ".", "entry_variables", "=", "entry_variables", "cnt", "=", "0", "with", "nn", ".", "parameter_scope", "(...
All functions are replaced with the same `new` function. Args: vroot (:obj:`Variable`): NNabla Variable entry_variables (:obj:`Variable`): Entry variable from which the conversion starts.
[ "All", "functions", "are", "replaced", "with", "the", "same", "new", "function", "." ]
python
train
37.925926
merll/docker-map
dockermap/map/config/client.py
https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/config/client.py#L89-L102
def get_init_kwargs(self): """ Generates keyword arguments for creating a new Docker client instance. :return: Keyword arguments as defined through this configuration. :rtype: dict """ init_kwargs = {} for k in self.init_kwargs: if k in self.core_prop...
[ "def", "get_init_kwargs", "(", "self", ")", ":", "init_kwargs", "=", "{", "}", "for", "k", "in", "self", ".", "init_kwargs", ":", "if", "k", "in", "self", ".", "core_property_set", ":", "init_kwargs", "[", "k", "]", "=", "getattr", "(", "self", ",", ...
Generates keyword arguments for creating a new Docker client instance. :return: Keyword arguments as defined through this configuration. :rtype: dict
[ "Generates", "keyword", "arguments", "for", "creating", "a", "new", "Docker", "client", "instance", "." ]
python
train
33
cloud9ers/gurumate
environment/lib/python2.7/site-packages/IPython/frontend/qt/console/completion_html.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/completion_html.py#L78-L95
def current(self, value): """set current cursor position""" current = min(max(self._min, value), self._max) self._current = current if current > self._stop : self._stop = current self._start = current-self._width elif current < self._start : ...
[ "def", "current", "(", "self", ",", "value", ")", ":", "current", "=", "min", "(", "max", "(", "self", ".", "_min", ",", "value", ")", ",", "self", ".", "_max", ")", "self", ".", "_current", "=", "current", "if", "current", ">", "self", ".", "_st...
set current cursor position
[ "set", "current", "cursor", "position" ]
python
test
32.388889
codeinn/vcs
vcs/utils/lockfiles.py
https://github.com/codeinn/vcs/blob/e6cd94188e9c36d273411bf3adc0584ac6ab92a0/vcs/utils/lockfiles.py#L55-L72
def _release_lock(self): """Release our lock if we have one""" if not self._has_lock(): return # if someone removed our file beforhand, lets just flag this issue # instead of failing, to make it more usable. lfp = self._lock_file_path() try: # on ...
[ "def", "_release_lock", "(", "self", ")", ":", "if", "not", "self", ".", "_has_lock", "(", ")", ":", "return", "# if someone removed our file beforhand, lets just flag this issue", "# instead of failing, to make it more usable.", "lfp", "=", "self", ".", "_lock_file_path", ...
Release our lock if we have one
[ "Release", "our", "lock", "if", "we", "have", "one" ]
python
train
32.722222
Jarn/jarn.mkrelease
jarn/mkrelease/exit.py
https://github.com/Jarn/jarn.mkrelease/blob/844377f37a3cdc0a154148790a926f991019ec4a/jarn/mkrelease/exit.py#L27-L31
def trace(msg): """Print a trace message to stderr if environment variable is set. """ if os.environ.get('JARN_TRACE') == '1': print('TRACE:', msg, file=sys.stderr)
[ "def", "trace", "(", "msg", ")", ":", "if", "os", ".", "environ", ".", "get", "(", "'JARN_TRACE'", ")", "==", "'1'", ":", "print", "(", "'TRACE:'", ",", "msg", ",", "file", "=", "sys", ".", "stderr", ")" ]
Print a trace message to stderr if environment variable is set.
[ "Print", "a", "trace", "message", "to", "stderr", "if", "environment", "variable", "is", "set", "." ]
python
train
36
openvax/varcode
varcode/util.py
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/util.py#L29-L92
def random_variants( count, genome_name="GRCh38", deletions=True, insertions=True, random_seed=None): """ Generate a VariantCollection with random variants that overlap at least one complete coding transcript. """ rng = random.Random(random_seed) ensembl =...
[ "def", "random_variants", "(", "count", ",", "genome_name", "=", "\"GRCh38\"", ",", "deletions", "=", "True", ",", "insertions", "=", "True", ",", "random_seed", "=", "None", ")", ":", "rng", "=", "random", ".", "Random", "(", "random_seed", ")", "ensembl"...
Generate a VariantCollection with random variants that overlap at least one complete coding transcript.
[ "Generate", "a", "VariantCollection", "with", "random", "variants", "that", "overlap", "at", "least", "one", "complete", "coding", "transcript", "." ]
python
train
34.09375
aiidalab/aiidalab-widgets-base
aiidalab_widgets_base/crystal_sim_crystal.py
https://github.com/aiidalab/aiidalab-widgets-base/blob/291a9b159eac902aee655862322670ec1b0cd5b1/aiidalab_widgets_base/crystal_sim_crystal.py#L15-L56
def check_crystal_equivalence(crystal_a, crystal_b): """Function that identifies whether two crystals are equivalent""" # getting symmetry datasets for both crystals cryst_a = spglib.get_symmetry_dataset(ase_to_spgcell(crystal_a), symprec=1e-5, angle_tolerance=-1.0, hall_number=0) cryst_b = spglib.get_...
[ "def", "check_crystal_equivalence", "(", "crystal_a", ",", "crystal_b", ")", ":", "# getting symmetry datasets for both crystals", "cryst_a", "=", "spglib", ".", "get_symmetry_dataset", "(", "ase_to_spgcell", "(", "crystal_a", ")", ",", "symprec", "=", "1e-5", ",", "a...
Function that identifies whether two crystals are equivalent
[ "Function", "that", "identifies", "whether", "two", "crystals", "are", "equivalent" ]
python
train
52.380952
lambdalisue/maidenhair
src/maidenhair/statistics/__init__.py
https://github.com/lambdalisue/maidenhair/blob/d5095c1087d1f4d71cc57410492151d2803a9f0d/src/maidenhair/statistics/__init__.py#L190-L215
def simple_moving_matrix(x, n=10): """ Create simple moving matrix. Parameters ---------- x : ndarray A numpy array n : integer The number of sample points used to make average Returns ------- ndarray A n x n numpy array which will be useful for calculating ...
[ "def", "simple_moving_matrix", "(", "x", ",", "n", "=", "10", ")", ":", "if", "x", ".", "ndim", ">", "1", "and", "len", "(", "x", "[", "0", "]", ")", ">", "1", ":", "x", "=", "np", ".", "average", "(", "x", ",", "axis", "=", "1", ")", "h"...
Create simple moving matrix. Parameters ---------- x : ndarray A numpy array n : integer The number of sample points used to make average Returns ------- ndarray A n x n numpy array which will be useful for calculating confidentail interval of simple moving ...
[ "Create", "simple", "moving", "matrix", "." ]
python
train
22.192308
drj11/pypng
code/texttopng.py
https://github.com/drj11/pypng/blob/b8220ca9f58e4c5bc1d507e713744fcb8c049225/code/texttopng.py#L118-L127
def char(i): """Get image data for the character `i` (a one character string). Returned as a list of rows. Each row is a tuple containing the packed pixels. """ i = ord(i) if i not in font: return [(0,)] * 8 return [(ord(row),) for row in font[i].decode('hex')]
[ "def", "char", "(", "i", ")", ":", "i", "=", "ord", "(", "i", ")", "if", "i", "not", "in", "font", ":", "return", "[", "(", "0", ",", ")", "]", "*", "8", "return", "[", "(", "ord", "(", "row", ")", ",", ")", "for", "row", "in", "font", ...
Get image data for the character `i` (a one character string). Returned as a list of rows. Each row is a tuple containing the packed pixels.
[ "Get", "image", "data", "for", "the", "character", "i", "(", "a", "one", "character", "string", ")", ".", "Returned", "as", "a", "list", "of", "rows", ".", "Each", "row", "is", "a", "tuple", "containing", "the", "packed", "pixels", "." ]
python
train
29
LuminosoInsight/wordfreq
wordfreq/preprocess.py
https://github.com/LuminosoInsight/wordfreq/blob/170e3c6536854b06dc63da8d873e8cc4f9ef6180/wordfreq/preprocess.py#L211-L218
def casefold_with_i_dots(text): """ Convert capital I's and capital dotted İ's to lowercase in the way that's appropriate for Turkish and related languages, then case-fold the rest of the letters. """ text = unicodedata.normalize('NFC', text).replace('İ', 'i').replace('I', 'ı') return text.c...
[ "def", "casefold_with_i_dots", "(", "text", ")", ":", "text", "=", "unicodedata", ".", "normalize", "(", "'NFC'", ",", "text", ")", ".", "replace", "(", "'İ',", " ", "i')", ".", "r", "eplace(", "'", "I',", " ", "ı')", "", "return", "text", ".", "case...
Convert capital I's and capital dotted İ's to lowercase in the way that's appropriate for Turkish and related languages, then case-fold the rest of the letters.
[ "Convert", "capital", "I", "s", "and", "capital", "dotted", "İ", "s", "to", "lowercase", "in", "the", "way", "that", "s", "appropriate", "for", "Turkish", "and", "related", "languages", "then", "case", "-", "fold", "the", "rest", "of", "the", "letters", ...
python
train
40.25
Microsoft/azure-devops-python-api
azure-devops/azure/devops/v5_0/gallery/gallery_client.py
https://github.com/Microsoft/azure-devops-python-api/blob/4777ffda2f5052fabbaddb2abe9cb434e0cf1aa8/azure-devops/azure/devops/v5_0/gallery/gallery_client.py#L1175-L1186
def query_publishers(self, publisher_query): """QueryPublishers. [Preview API] :param :class:`<PublisherQuery> <azure.devops.v5_0.gallery.models.PublisherQuery>` publisher_query: :rtype: :class:`<PublisherQueryResult> <azure.devops.v5_0.gallery.models.PublisherQueryResult>` """ ...
[ "def", "query_publishers", "(", "self", ",", "publisher_query", ")", ":", "content", "=", "self", ".", "_serialize", ".", "body", "(", "publisher_query", ",", "'PublisherQuery'", ")", "response", "=", "self", ".", "_send", "(", "http_method", "=", "'POST'", ...
QueryPublishers. [Preview API] :param :class:`<PublisherQuery> <azure.devops.v5_0.gallery.models.PublisherQuery>` publisher_query: :rtype: :class:`<PublisherQueryResult> <azure.devops.v5_0.gallery.models.PublisherQueryResult>`
[ "QueryPublishers", ".", "[", "Preview", "API", "]", ":", "param", ":", "class", ":", "<PublisherQuery", ">", "<azure", ".", "devops", ".", "v5_0", ".", "gallery", ".", "models", ".", "PublisherQuery", ">", "publisher_query", ":", ":", "rtype", ":", ":", ...
python
train
56.833333
tariqdaouda/rabaDB
rabaDB/filters.py
https://github.com/tariqdaouda/rabaDB/blob/42e0d6ee65149ae4f1e4c380cc695a9e7d2d1bbc/rabaDB/filters.py#L76-L128
def addFilter(self, *lstFilters, **dctFilters) : "add a new filter to the query" dstF = {} if len(lstFilters) > 0 : if type(lstFilters[0]) is types.DictType : dstF = lstFilters[0] lstFilters = lstFilters[1:] if len(dctFilters) > 0 : dstF = dict(dstF, **dctFilters) filts = {} for k, v in dst...
[ "def", "addFilter", "(", "self", ",", "*", "lstFilters", ",", "*", "*", "dctFilters", ")", ":", "dstF", "=", "{", "}", "if", "len", "(", "lstFilters", ")", ">", "0", ":", "if", "type", "(", "lstFilters", "[", "0", "]", ")", "is", "types", ".", ...
add a new filter to the query
[ "add", "a", "new", "filter", "to", "the", "query" ]
python
train
24.830189
ultrabug/py3status
py3status/udev_monitor.py
https://github.com/ultrabug/py3status/blob/4c105f1b44f7384ca4f7da5f821a47e468c7dee2/py3status/udev_monitor.py#L74-L84
def trigger_actions(self, subsystem): """ Refresh all modules which subscribed to the given subsystem. """ for py3_module, trigger_action in self.udev_consumers[subsystem]: if trigger_action in ON_TRIGGER_ACTIONS: self.py3_wrapper.log( "%s ...
[ "def", "trigger_actions", "(", "self", ",", "subsystem", ")", ":", "for", "py3_module", ",", "trigger_action", "in", "self", ".", "udev_consumers", "[", "subsystem", "]", ":", "if", "trigger_action", "in", "ON_TRIGGER_ACTIONS", ":", "self", ".", "py3_wrapper", ...
Refresh all modules which subscribed to the given subsystem.
[ "Refresh", "all", "modules", "which", "subscribed", "to", "the", "given", "subsystem", "." ]
python
train
42.272727
neighbordog/deviantart
deviantart/api.py
https://github.com/neighbordog/deviantart/blob/5612f1d5e2139a48c9d793d7fd19cde7e162d7b1/deviantart/api.py#L1156-L1176
def post_status(self, body="", id="", parentid="", stashid=""): """Post a status :param username: The body of the status :param id: The id of the object you wish to share :param parentid: The parentid of the object you wish to share :param stashid: The stashid of the object you...
[ "def", "post_status", "(", "self", ",", "body", "=", "\"\"", ",", "id", "=", "\"\"", ",", "parentid", "=", "\"\"", ",", "stashid", "=", "\"\"", ")", ":", "if", "self", ".", "standard_grant_type", "is", "not", "\"authorization_code\"", ":", "raise", "Devi...
Post a status :param username: The body of the status :param id: The id of the object you wish to share :param parentid: The parentid of the object you wish to share :param stashid: The stashid of the object you wish to add to the status
[ "Post", "a", "status" ]
python
train
36.571429
fermiPy/fermipy
fermipy/scripts/cluster_sources.py
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/scripts/cluster_sources.py#L187-L258
def make_clusters(span_tree, cut_value): """ Find clusters from the spanning tree Parameters ---------- span_tree : a sparse nsrcs x nsrcs array Filled with zeros except for the active edges, which are filled with the edge measures (either distances or sigmas cut_value : float ...
[ "def", "make_clusters", "(", "span_tree", ",", "cut_value", ")", ":", "iv0", ",", "iv1", "=", "span_tree", ".", "nonzero", "(", ")", "# This is the dictionary of all the pairings for each source", "match_dict", "=", "{", "}", "for", "i0", ",", "i1", "in", "zip",...
Find clusters from the spanning tree Parameters ---------- span_tree : a sparse nsrcs x nsrcs array Filled with zeros except for the active edges, which are filled with the edge measures (either distances or sigmas cut_value : float Value used to cluster group. All links with mea...
[ "Find", "clusters", "from", "the", "spanning", "tree" ]
python
train
30.111111
pydata/xarray
xarray/backends/api.py
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/backends/api.py#L735-L826
def to_netcdf(dataset, path_or_file=None, mode='w', format=None, group=None, engine=None, encoding=None, unlimited_dims=None, compute=True, multifile=False): """This function creates an appropriate datastore for writing a dataset to disk as a netCDF file See `Dataset.to_netcdf` ...
[ "def", "to_netcdf", "(", "dataset", ",", "path_or_file", "=", "None", ",", "mode", "=", "'w'", ",", "format", "=", "None", ",", "group", "=", "None", ",", "engine", "=", "None", ",", "encoding", "=", "None", ",", "unlimited_dims", "=", "None", ",", "...
This function creates an appropriate datastore for writing a dataset to disk as a netCDF file See `Dataset.to_netcdf` for full API docs. The ``multifile`` argument is only for the private use of save_mfdataset.
[ "This", "function", "creates", "an", "appropriate", "datastore", "for", "writing", "a", "dataset", "to", "disk", "as", "a", "netCDF", "file" ]
python
train
35.01087
jmbhughes/suvi-trainer
suvitrainer/gui.py
https://github.com/jmbhughes/suvi-trainer/blob/3d89894a4a037286221974c7eb5634d229b4f5d4/suvitrainer/gui.py#L179-L196
def interpret_header(self): """ Read pertinent information from the image headers, especially location and radius of the Sun to calculate the default thematic map :return: setes self.date, self.cy, self.cx, and self.sun_radius_pixel """ # handle special cases since date-...
[ "def", "interpret_header", "(", "self", ")", ":", "# handle special cases since date-obs field changed names", "if", "'DATE_OBS'", "in", "self", ".", "header", ":", "self", ".", "date", "=", "self", ".", "header", "[", "'DATE_OBS'", "]", "elif", "'DATE-OBS'", "in"...
Read pertinent information from the image headers, especially location and radius of the Sun to calculate the default thematic map :return: setes self.date, self.cy, self.cx, and self.sun_radius_pixel
[ "Read", "pertinent", "information", "from", "the", "image", "headers", "especially", "location", "and", "radius", "of", "the", "Sun", "to", "calculate", "the", "default", "thematic", "map", ":", "return", ":", "setes", "self", ".", "date", "self", ".", "cy",...
python
train
49.444444
esterhui/pypu
pypu/pusher.py
https://github.com/esterhui/pypu/blob/cc3e259d59f024c2c4c0fbb9c8a1547e51de75ec/pypu/pusher.py#L89-L118
def _computeStatus(self, dfile, service): """Computes status for file, basically this means if more than one service handles the file, it will place a 'C' (for complicated) otherwise if status matches between all services, will place that status""" # If only one service request...
[ "def", "_computeStatus", "(", "self", ",", "dfile", ",", "service", ")", ":", "# If only one service requested", "if", "service", ":", "if", "not", "dfile", "[", "'services'", "]", ".", "has_key", "(", "service", ")", ":", "return", "self", ".", "ST_UNTRACKE...
Computes status for file, basically this means if more than one service handles the file, it will place a 'C' (for complicated) otherwise if status matches between all services, will place that status
[ "Computes", "status", "for", "file", "basically", "this", "means", "if", "more", "than", "one", "service", "handles", "the", "file", "it", "will", "place", "a", "C", "(", "for", "complicated", ")", "otherwise", "if", "status", "matches", "between", "all", ...
python
train
36.066667
apache/incubator-heron
heron/instance/src/python/instance/st_heron_instance.py
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/instance/src/python/instance/st_heron_instance.py#L205-L223
def _handle_state_change_msg(self, new_helper): """Called when state change is commanded by stream manager""" assert self.my_pplan_helper is not None assert self.my_instance is not None and self.my_instance.py_class is not None if self.my_pplan_helper.get_topology_state() != new_helper.get_topology_sta...
[ "def", "_handle_state_change_msg", "(", "self", ",", "new_helper", ")", ":", "assert", "self", ".", "my_pplan_helper", "is", "not", "None", "assert", "self", ".", "my_instance", "is", "not", "None", "and", "self", ".", "my_instance", ".", "py_class", "is", "...
Called when state change is commanded by stream manager
[ "Called", "when", "state", "change", "is", "commanded", "by", "stream", "manager" ]
python
valid
45.157895
major/supernova
supernova/utils.py
https://github.com/major/supernova/blob/4a217ae53c1c05567014b047c0b6b9dea2d383b3/supernova/utils.py#L87-L102
def is_valid_group(group_name, nova_creds): """ Checks to see if the configuration file contains a SUPERNOVA_GROUP configuration option. """ valid_groups = [] for key, value in nova_creds.items(): supernova_groups = value.get('SUPERNOVA_GROUP', []) if hasattr(supernova_groups, 's...
[ "def", "is_valid_group", "(", "group_name", ",", "nova_creds", ")", ":", "valid_groups", "=", "[", "]", "for", "key", ",", "value", "in", "nova_creds", ".", "items", "(", ")", ":", "supernova_groups", "=", "value", ".", "get", "(", "'SUPERNOVA_GROUP'", ","...
Checks to see if the configuration file contains a SUPERNOVA_GROUP configuration option.
[ "Checks", "to", "see", "if", "the", "configuration", "file", "contains", "a", "SUPERNOVA_GROUP", "configuration", "option", "." ]
python
train
33.125
pyQode/pyqode.core
pyqode/core/panels/folding.py
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/panels/folding.py#L348-L385
def _draw_fold_indicator(self, top, mouse_over, collapsed, painter): """ Draw the fold indicator/trigger (arrow). :param top: Top position :param mouse_over: Whether the mouse is over the indicator :param collapsed: Whether the trigger is collapsed or not. :param painter...
[ "def", "_draw_fold_indicator", "(", "self", ",", "top", ",", "mouse_over", ",", "collapsed", ",", "painter", ")", ":", "rect", "=", "QtCore", ".", "QRect", "(", "0", ",", "top", ",", "self", ".", "sizeHint", "(", ")", ".", "width", "(", ")", ",", "...
Draw the fold indicator/trigger (arrow). :param top: Top position :param mouse_over: Whether the mouse is over the indicator :param collapsed: Whether the trigger is collapsed or not. :param painter: QPainter
[ "Draw", "the", "fold", "indicator", "/", "trigger", "(", "arrow", ")", "." ]
python
train
43.605263
intel-analytics/BigDL
pyspark/bigdl/util/common.py
https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/util/common.py#L520-L541
def get_spark_context(conf=None): """ Get the current active spark context and create one if no active instance :param conf: combining bigdl configs into spark conf :return: SparkContext """ if hasattr(SparkContext, "getOrCreate"): with SparkContext._lock: if SparkContext._ac...
[ "def", "get_spark_context", "(", "conf", "=", "None", ")", ":", "if", "hasattr", "(", "SparkContext", ",", "\"getOrCreate\"", ")", ":", "with", "SparkContext", ".", "_lock", ":", "if", "SparkContext", ".", "_active_spark_context", "is", "None", ":", "spark_con...
Get the current active spark context and create one if no active instance :param conf: combining bigdl configs into spark conf :return: SparkContext
[ "Get", "the", "current", "active", "spark", "context", "and", "create", "one", "if", "no", "active", "instance", ":", "param", "conf", ":", "combining", "bigdl", "configs", "into", "spark", "conf", ":", "return", ":", "SparkContext" ]
python
test
40.454545
astropy/astropy-helpers
astropy_helpers/distutils_helpers.py
https://github.com/astropy/astropy-helpers/blob/f5a27d3f84a98ea0eebb85e0cf3e7214c6bc0d09/astropy_helpers/distutils_helpers.py#L226-L254
def get_distutils_display_options(): """ Returns a set of all the distutils display options in their long and short forms. These are the setup.py arguments such as --name or --version which print the project's metadata and then exit. Returns ------- opts : set The long and short form d...
[ "def", "get_distutils_display_options", "(", ")", ":", "short_display_opts", "=", "set", "(", "'-'", "+", "o", "[", "1", "]", "for", "o", "in", "Distribution", ".", "display_options", "if", "o", "[", "1", "]", ")", "long_display_opts", "=", "set", "(", "...
Returns a set of all the distutils display options in their long and short forms. These are the setup.py arguments such as --name or --version which print the project's metadata and then exit. Returns ------- opts : set The long and short form display option arguments, including the - or -...
[ "Returns", "a", "set", "of", "all", "the", "distutils", "display", "options", "in", "their", "long", "and", "short", "forms", ".", "These", "are", "the", "setup", ".", "py", "arguments", "such", "as", "--", "name", "or", "--", "version", "which", "print"...
python
train
39.448276
ContextLab/hypertools
hypertools/tools/cluster.py
https://github.com/ContextLab/hypertools/blob/b76c7ac8061998b560e969ff8e4f4c915088e7a0/hypertools/tools/cluster.py#L28-L100
def cluster(x, cluster='KMeans', n_clusters=3, ndims=None, format_data=True): """ Performs clustering analysis and returns a list of cluster labels Parameters ---------- x : A Numpy array, Pandas Dataframe or list of arrays/dfs The data to be clustered. You can pass a single array/df or a ...
[ "def", "cluster", "(", "x", ",", "cluster", "=", "'KMeans'", ",", "n_clusters", "=", "3", ",", "ndims", "=", "None", ",", "format_data", "=", "True", ")", ":", "if", "cluster", "==", "None", ":", "return", "x", "elif", "(", "isinstance", "(", "cluste...
Performs clustering analysis and returns a list of cluster labels Parameters ---------- x : A Numpy array, Pandas Dataframe or list of arrays/dfs The data to be clustered. You can pass a single array/df or a list. If a list is passed, the arrays will be stacked and the clustering w...
[ "Performs", "clustering", "analysis", "and", "returns", "a", "list", "of", "cluster", "labels" ]
python
train
34.369863
robinandeer/puzzle
puzzle/plugins/sql/mixins/actions/gemini.py
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/plugins/sql/mixins/actions/gemini.py#L10-L17
def gemini_query(self, query_id): """Return a gemini query Args: name (str) """ logger.debug("Looking for query with id {0}".format(query_id)) return self.query(GeminiQuery).filter_by(id=query_id).first()
[ "def", "gemini_query", "(", "self", ",", "query_id", ")", ":", "logger", ".", "debug", "(", "\"Looking for query with id {0}\"", ".", "format", "(", "query_id", ")", ")", "return", "self", ".", "query", "(", "GeminiQuery", ")", ".", "filter_by", "(", "id", ...
Return a gemini query Args: name (str)
[ "Return", "a", "gemini", "query" ]
python
train
31.25
SmokinCaterpillar/pypet
pypet/utils/decorators.py
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/decorators.py#L48-L72
def deprecated(msg=''): """This is a decorator which can be used to mark functions as deprecated. It will result in a warning being emitted when the function is used. :param msg: Additional message added to the warning. """ def wrapper(func): @functools.wraps(func) de...
[ "def", "deprecated", "(", "msg", "=", "''", ")", ":", "def", "wrapper", "(", "func", ")", ":", "@", "functools", ".", "wraps", "(", "func", ")", "def", "new_func", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "warning_string", "=", "\"Call ...
This is a decorator which can be used to mark functions as deprecated. It will result in a warning being emitted when the function is used. :param msg: Additional message added to the warning.
[ "This", "is", "a", "decorator", "which", "can", "be", "used", "to", "mark", "functions", "as", "deprecated", ".", "It", "will", "result", "in", "a", "warning", "being", "emitted", "when", "the", "function", "is", "used", "." ]
python
test
27.08
PMEAL/OpenPNM
openpnm/topotools/topotools.py
https://github.com/PMEAL/OpenPNM/blob/0547b5724ffedc0a593aae48639d36fe10e0baed/openpnm/topotools/topotools.py#L1791-L1814
def template_sphere_shell(outer_radius, inner_radius=0): r""" This method generates an image array of a sphere-shell. It is useful for passing to Cubic networks as a ``template`` to make spherical shaped networks. Parameters ---------- outer_radius : int Number of nodes in the outer...
[ "def", "template_sphere_shell", "(", "outer_radius", ",", "inner_radius", "=", "0", ")", ":", "img", "=", "_template_sphere_disc", "(", "dim", "=", "3", ",", "outer_radius", "=", "outer_radius", ",", "inner_radius", "=", "inner_radius", ")", "return", "img" ]
r""" This method generates an image array of a sphere-shell. It is useful for passing to Cubic networks as a ``template`` to make spherical shaped networks. Parameters ---------- outer_radius : int Number of nodes in the outer radius of the sphere. inner_radius : int Number...
[ "r", "This", "method", "generates", "an", "image", "array", "of", "a", "sphere", "-", "shell", ".", "It", "is", "useful", "for", "passing", "to", "Cubic", "networks", "as", "a", "template", "to", "make", "spherical", "shaped", "networks", "." ]
python
train
29.791667
ToFuProject/tofu
tofu/pathfile.py
https://github.com/ToFuProject/tofu/blob/39d6b2e7ced9e13666572dfd37e19403f1d6ff8d/tofu/pathfile.py#L73-L121
def get_PolyFromPolyFileObj(PolyFileObj, SavePathInp=None, units='m', comments='#', skiprows=0, shape0=2): """ Return a polygon as a np.ndarray, extracted from a txt file or from a ToFu object, with appropriate units Useful for :meth:`tofu.plugins.AUG.Ves._create()` Parameters ---------- PolyFileO...
[ "def", "get_PolyFromPolyFileObj", "(", "PolyFileObj", ",", "SavePathInp", "=", "None", ",", "units", "=", "'m'", ",", "comments", "=", "'#'", ",", "skiprows", "=", "0", ",", "shape0", "=", "2", ")", ":", "assert", "type", "(", "PolyFileObj", ")", "in", ...
Return a polygon as a np.ndarray, extracted from a txt file or from a ToFu object, with appropriate units Useful for :meth:`tofu.plugins.AUG.Ves._create()` Parameters ---------- PolyFileObj : str / :mod:`tofu.geom` object / np.ndarray The source where the polygon is to be found, either: ...
[ "Return", "a", "polygon", "as", "a", "np", ".", "ndarray", "extracted", "from", "a", "txt", "file", "or", "from", "a", "ToFu", "object", "with", "appropriate", "units" ]
python
train
56.77551
inveniosoftware-attic/invenio-upgrader
invenio_upgrader/engine.py
https://github.com/inveniosoftware-attic/invenio-upgrader/blob/cee4bcb118515463ecf6de1421642007f79a9fcd/invenio_upgrader/engine.py#L341-L353
def get_upgrades(self, remove_applied=True): """Get upgrades (ordered according to their dependencies). :param remove_applied: Set to false to return all upgrades, otherwise already applied upgrades are removed from their graph (incl. all their dependencies. """ ...
[ "def", "get_upgrades", "(", "self", ",", "remove_applied", "=", "True", ")", ":", "if", "self", ".", "upgrades", "is", "None", ":", "plugins", "=", "self", ".", "_load_upgrades", "(", "remove_applied", "=", "remove_applied", ")", "# List of un-applied upgrades i...
Get upgrades (ordered according to their dependencies). :param remove_applied: Set to false to return all upgrades, otherwise already applied upgrades are removed from their graph (incl. all their dependencies.
[ "Get", "upgrades", "(", "ordered", "according", "to", "their", "dependencies", ")", "." ]
python
train
43.846154
GNS3/gns3-server
gns3server/controller/import_project.py
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/import_project.py#L191-L200
def _upload_file(compute, project_id, file_path, path): """ Upload a file to a remote project :param file_path: File path on the controller file system :param path: File path on the remote system relative to project directory """ path = "/projects/{}/files/{}".format(project_id, path.replace("\...
[ "def", "_upload_file", "(", "compute", ",", "project_id", ",", "file_path", ",", "path", ")", ":", "path", "=", "\"/projects/{}/files/{}\"", ".", "format", "(", "project_id", ",", "path", ".", "replace", "(", "\"\\\\\"", ",", "\"/\"", ")", ")", "with", "op...
Upload a file to a remote project :param file_path: File path on the controller file system :param path: File path on the remote system relative to project directory
[ "Upload", "a", "file", "to", "a", "remote", "project" ]
python
train
42.6
wilson-eft/wilson
wilson/run/wet/rge.py
https://github.com/wilson-eft/wilson/blob/4164f55ff663d4f668c6e2b4575fd41562662cc9/wilson/run/wet/rge.py#L38-L50
def admeig(classname, f, m_u, m_d, m_s, m_c, m_b, m_e, m_mu, m_tau): """Compute the eigenvalues and eigenvectors for a QCD anomalous dimension matrix that is defined in `adm.adm_s_X` where X is the name of the sector. Supports memoization. Output analogous to `np.linalg.eig`.""" args = f, m_u, m_d, m_s...
[ "def", "admeig", "(", "classname", ",", "f", ",", "m_u", ",", "m_d", ",", "m_s", ",", "m_c", ",", "m_b", ",", "m_e", ",", "m_mu", ",", "m_tau", ")", ":", "args", "=", "f", ",", "m_u", ",", "m_d", ",", "m_s", ",", "m_c", ",", "m_b", ",", "m_...
Compute the eigenvalues and eigenvectors for a QCD anomalous dimension matrix that is defined in `adm.adm_s_X` where X is the name of the sector. Supports memoization. Output analogous to `np.linalg.eig`.
[ "Compute", "the", "eigenvalues", "and", "eigenvectors", "for", "a", "QCD", "anomalous", "dimension", "matrix", "that", "is", "defined", "in", "adm", ".", "adm_s_X", "where", "X", "is", "the", "name", "of", "the", "sector", "." ]
python
train
46.461538