repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
jmgilman/Neolib
neolib/user/SDB.py
SDB.load
def load(self): """ Loads the user's SDB inventory Raises parseException """ self.inventory = SDBInventory(self.usr) self.forms = self.inventory.forms
python
def load(self): """ Loads the user's SDB inventory Raises parseException """ self.inventory = SDBInventory(self.usr) self.forms = self.inventory.forms
[ "def", "load", "(", "self", ")", ":", "self", ".", "inventory", "=", "SDBInventory", "(", "self", ".", "usr", ")", "self", ".", "forms", "=", "self", ".", "inventory", ".", "forms" ]
Loads the user's SDB inventory Raises parseException
[ "Loads", "the", "user", "s", "SDB", "inventory", "Raises", "parseException" ]
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/user/SDB.py#L43-L50
jmgilman/Neolib
neolib/user/SDB.py
SDB.update
def update(self): """ Upates the user's SDB inventory Loops through all items on a page and checks for an item that has changed. A changed item is identified as the remove attribute being set to anything greater than 0. It will then update each page accordingly with the ...
python
def update(self): """ Upates the user's SDB inventory Loops through all items on a page and checks for an item that has changed. A changed item is identified as the remove attribute being set to anything greater than 0. It will then update each page accordingly with the ...
[ "def", "update", "(", "self", ")", ":", "for", "x", "in", "range", "(", "1", ",", "self", ".", "inventory", ".", "pages", "+", "1", ")", ":", "if", "self", ".", "_hasPageChanged", "(", "x", ")", ":", "form", "=", "self", ".", "_updateForm", "(", ...
Upates the user's SDB inventory Loops through all items on a page and checks for an item that has changed. A changed item is identified as the remove attribute being set to anything greater than 0. It will then update each page accordingly with the changed items. ...
[ "Upates", "the", "user", "s", "SDB", "inventory", "Loops", "through", "all", "items", "on", "a", "page", "and", "checks", "for", "an", "item", "that", "has", "changed", ".", "A", "changed", "item", "is", "identified", "as", "the", "remove", "attribute", ...
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/user/SDB.py#L52-L74
tempodb/tempodb-python
tempodb/client.py
make_series_url
def make_series_url(key): """For internal use. Given a series key, generate a valid URL to the series endpoint for that key. :param string key: the series key :rtype: string""" url = urlparse.urljoin(endpoint.SERIES_ENDPOINT, 'key/') url = urlparse.urljoin(url, urllib.quote(key)) return ur...
python
def make_series_url(key): """For internal use. Given a series key, generate a valid URL to the series endpoint for that key. :param string key: the series key :rtype: string""" url = urlparse.urljoin(endpoint.SERIES_ENDPOINT, 'key/') url = urlparse.urljoin(url, urllib.quote(key)) return ur...
[ "def", "make_series_url", "(", "key", ")", ":", "url", "=", "urlparse", ".", "urljoin", "(", "endpoint", ".", "SERIES_ENDPOINT", ",", "'key/'", ")", "url", "=", "urlparse", ".", "urljoin", "(", "url", ",", "urllib", ".", "quote", "(", "key", ")", ")", ...
For internal use. Given a series key, generate a valid URL to the series endpoint for that key. :param string key: the series key :rtype: string
[ "For", "internal", "use", ".", "Given", "a", "series", "key", "generate", "a", "valid", "URL", "to", "the", "series", "endpoint", "for", "that", "key", "." ]
train
https://github.com/tempodb/tempodb-python/blob/8ce45231bd728c6c97ef799cf0f1513ea3a9a7d3/tempodb/client.py#L11-L20
tempodb/tempodb-python
tempodb/client.py
Client.create_series
def create_series(self, key=None, tags=[], attrs={}): """Create a new series with an optional string key. A list of tags and a map of attributes can also be optionally supplied. :param string key: (optional) a string key for the series :param list tags: (optional) the tags to create th...
python
def create_series(self, key=None, tags=[], attrs={}): """Create a new series with an optional string key. A list of tags and a map of attributes can also be optionally supplied. :param string key: (optional) a string key for the series :param list tags: (optional) the tags to create th...
[ "def", "create_series", "(", "self", ",", "key", "=", "None", ",", "tags", "=", "[", "]", ",", "attrs", "=", "{", "}", ")", ":", "body", "=", "protocol", ".", "make_series_key", "(", "key", ",", "tags", ",", "attrs", ")", "resp", "=", "self", "."...
Create a new series with an optional string key. A list of tags and a map of attributes can also be optionally supplied. :param string key: (optional) a string key for the series :param list tags: (optional) the tags to create the series with :param dict attrs: (optional) the attribute...
[ "Create", "a", "new", "series", "with", "an", "optional", "string", "key", ".", "A", "list", "of", "tags", "and", "a", "map", "of", "attributes", "can", "also", "be", "optionally", "supplied", "." ]
train
https://github.com/tempodb/tempodb-python/blob/8ce45231bd728c6c97ef799cf0f1513ea3a9a7d3/tempodb/client.py#L133-L145
tempodb/tempodb-python
tempodb/client.py
Client.delete_series
def delete_series(self, keys=None, tags=None, attrs=None, allow_truncation=False): """Delete a series according to the given criteria. **Note:** for the key argument, the filter will return the *union* of those values. For the tag and attr arguments, the filter will retur...
python
def delete_series(self, keys=None, tags=None, attrs=None, allow_truncation=False): """Delete a series according to the given criteria. **Note:** for the key argument, the filter will return the *union* of those values. For the tag and attr arguments, the filter will retur...
[ "def", "delete_series", "(", "self", ",", "keys", "=", "None", ",", "tags", "=", "None", ",", "attrs", "=", "None", ",", "allow_truncation", "=", "False", ")", ":", "params", "=", "{", "'key'", ":", "keys", ",", "'tag'", ":", "tags", ",", "'attr'", ...
Delete a series according to the given criteria. **Note:** for the key argument, the filter will return the *union* of those values. For the tag and attr arguments, the filter will return the *intersection* of those values. :param keys: filter by one or more series keys :type ...
[ "Delete", "a", "series", "according", "to", "the", "given", "criteria", "." ]
train
https://github.com/tempodb/tempodb-python/blob/8ce45231bd728c6c97ef799cf0f1513ea3a9a7d3/tempodb/client.py#L148-L174
tempodb/tempodb-python
tempodb/client.py
Client.get_series
def get_series(self, key): """Get a series object from TempoDB given its key. :param string key: a string name for the series :rtype: :class:`tempodb.response.Response` with a :class:`tempodb.protocol.objects.Series` data payload""" url = make_series_url(key) re...
python
def get_series(self, key): """Get a series object from TempoDB given its key. :param string key: a string name for the series :rtype: :class:`tempodb.response.Response` with a :class:`tempodb.protocol.objects.Series` data payload""" url = make_series_url(key) re...
[ "def", "get_series", "(", "self", ",", "key", ")", ":", "url", "=", "make_series_url", "(", "key", ")", "resp", "=", "self", ".", "session", ".", "get", "(", "url", ")", "return", "resp" ]
Get a series object from TempoDB given its key. :param string key: a string name for the series :rtype: :class:`tempodb.response.Response` with a :class:`tempodb.protocol.objects.Series` data payload
[ "Get", "a", "series", "object", "from", "TempoDB", "given", "its", "key", "." ]
train
https://github.com/tempodb/tempodb-python/blob/8ce45231bd728c6c97ef799cf0f1513ea3a9a7d3/tempodb/client.py#L177-L186
tempodb/tempodb-python
tempodb/client.py
Client.list_series
def list_series(self, keys=None, tags=None, attrs=None, limit=1000): """Get a list of all series matching the given criteria. **Note:** for the key argument, the filter will return the *union* of those values. For the tag and attr arguments, the filter will return t...
python
def list_series(self, keys=None, tags=None, attrs=None, limit=1000): """Get a list of all series matching the given criteria. **Note:** for the key argument, the filter will return the *union* of those values. For the tag and attr arguments, the filter will return t...
[ "def", "list_series", "(", "self", ",", "keys", "=", "None", ",", "tags", "=", "None", ",", "attrs", "=", "None", ",", "limit", "=", "1000", ")", ":", "params", "=", "{", "'key'", ":", "keys", ",", "'tag'", ":", "tags", ",", "'attr'", ":", "attrs...
Get a list of all series matching the given criteria. **Note:** for the key argument, the filter will return the *union* of those values. For the tag and attr arguments, the filter will return the *intersection* of those values. :param keys: filter by one or more series keys :...
[ "Get", "a", "list", "of", "all", "series", "matching", "the", "given", "criteria", "." ]
train
https://github.com/tempodb/tempodb-python/blob/8ce45231bd728c6c97ef799cf0f1513ea3a9a7d3/tempodb/client.py#L189-L215
tempodb/tempodb-python
tempodb/client.py
Client.update_series
def update_series(self, series): """Update a series with new attributes. This does not change any of the data written to this series. The recommended workflow for series updates is to pull a Series object down using the :meth:`get_series` method, change its attributes, then pass it into...
python
def update_series(self, series): """Update a series with new attributes. This does not change any of the data written to this series. The recommended workflow for series updates is to pull a Series object down using the :meth:`get_series` method, change its attributes, then pass it into...
[ "def", "update_series", "(", "self", ",", "series", ")", ":", "url", "=", "make_series_url", "(", "series", ".", "key", ")", "resp", "=", "self", ".", "session", ".", "put", "(", "url", ",", "series", ".", "to_json", "(", ")", ")", "return", "resp" ]
Update a series with new attributes. This does not change any of the data written to this series. The recommended workflow for series updates is to pull a Series object down using the :meth:`get_series` method, change its attributes, then pass it into this method. :param series...
[ "Update", "a", "series", "with", "new", "attributes", ".", "This", "does", "not", "change", "any", "of", "the", "data", "written", "to", "this", "series", ".", "The", "recommended", "workflow", "for", "series", "updates", "is", "to", "pull", "a", "Series",...
train
https://github.com/tempodb/tempodb-python/blob/8ce45231bd728c6c97ef799cf0f1513ea3a9a7d3/tempodb/client.py#L218-L233
tempodb/tempodb-python
tempodb/client.py
Client.read_data
def read_data(self, key, start=None, end=None, rollup=None, period=None, interpolationf=None, interpolation_period=None, tz=None, limit=1000): """Read data from a series given its ID or key. Start and end times must be supplied. They can either be ISO8601 encoded st...
python
def read_data(self, key, start=None, end=None, rollup=None, period=None, interpolationf=None, interpolation_period=None, tz=None, limit=1000): """Read data from a series given its ID or key. Start and end times must be supplied. They can either be ISO8601 encoded st...
[ "def", "read_data", "(", "self", ",", "key", ",", "start", "=", "None", ",", "end", "=", "None", ",", "rollup", "=", "None", ",", "period", "=", "None", ",", "interpolationf", "=", "None", ",", "interpolation_period", "=", "None", ",", "tz", "=", "No...
Read data from a series given its ID or key. Start and end times must be supplied. They can either be ISO8601 encoded strings (i.e. 2012-01-08T00:21:54.000+0000) or Python Datetime objects, which will be converted for you. The rollup parameter is optional and can include string values...
[ "Read", "data", "from", "a", "series", "given", "its", "ID", "or", "key", ".", "Start", "and", "end", "times", "must", "be", "supplied", ".", "They", "can", "either", "be", "ISO8601", "encoded", "strings", "(", "i", ".", "e", ".", "2012", "-", "01", ...
train
https://github.com/tempodb/tempodb-python/blob/8ce45231bd728c6c97ef799cf0f1513ea3a9a7d3/tempodb/client.py#L237-L307
tempodb/tempodb-python
tempodb/client.py
Client.get_summary
def get_summary(self, key, start, end, tz=None): """Get a summary for the series from *start* to *end*. The summary is a map containing keys *count*, *min*, *max*, *mean*, *sum*, and *stddev*. :param string key: the series key to use :param start: the start time for the data po...
python
def get_summary(self, key, start, end, tz=None): """Get a summary for the series from *start* to *end*. The summary is a map containing keys *count*, *min*, *max*, *mean*, *sum*, and *stddev*. :param string key: the series key to use :param start: the start time for the data po...
[ "def", "get_summary", "(", "self", ",", "key", ",", "start", ",", "end", ",", "tz", "=", "None", ")", ":", "url", "=", "make_series_url", "(", "key", ")", "url", "=", "urlparse", ".", "urljoin", "(", "url", "+", "'/'", ",", "'summary'", ")", "vstar...
Get a summary for the series from *start* to *end*. The summary is a map containing keys *count*, *min*, *max*, *mean*, *sum*, and *stddev*. :param string key: the series key to use :param start: the start time for the data points :type start: string or Datetime :param ...
[ "Get", "a", "summary", "for", "the", "series", "from", "*", "start", "*", "to", "*", "end", "*", ".", "The", "summary", "is", "a", "map", "containing", "keys", "*", "count", "*", "*", "min", "*", "*", "max", "*", "*", "mean", "*", "*", "sum", "...
train
https://github.com/tempodb/tempodb-python/blob/8ce45231bd728c6c97ef799cf0f1513ea3a9a7d3/tempodb/client.py#L310-L337
tempodb/tempodb-python
tempodb/client.py
Client.aggregate_data
def aggregate_data(self, start, end, aggregation, keys=[], tags=[], attrs={}, rollup=None, period=None, interpolationf=None, interpolation_period=None, tz=None, limit=1000): """Read data from multiple series according to a filter and apply a function across ...
python
def aggregate_data(self, start, end, aggregation, keys=[], tags=[], attrs={}, rollup=None, period=None, interpolationf=None, interpolation_period=None, tz=None, limit=1000): """Read data from multiple series according to a filter and apply a function across ...
[ "def", "aggregate_data", "(", "self", ",", "start", ",", "end", ",", "aggregation", ",", "keys", "=", "[", "]", ",", "tags", "=", "[", "]", ",", "attrs", "=", "{", "}", ",", "rollup", "=", "None", ",", "period", "=", "None", ",", "interpolationf", ...
Read data from multiple series according to a filter and apply a function across all the returned series to put the datapoints together into one aggregrate series. See the :meth:`list_series` method for a description of how the filter criteria are applied, and the :meth:`read_data` meth...
[ "Read", "data", "from", "multiple", "series", "according", "to", "a", "filter", "and", "apply", "a", "function", "across", "all", "the", "returned", "series", "to", "put", "the", "datapoints", "together", "into", "one", "aggregrate", "series", "." ]
train
https://github.com/tempodb/tempodb-python/blob/8ce45231bd728c6c97ef799cf0f1513ea3a9a7d3/tempodb/client.py#L433-L489
tempodb/tempodb-python
tempodb/client.py
Client.write_data
def write_data(self, key, data, tags=[], attrs={}): """Write a set a datapoints into a series by its key. For now, the tags and attributes arguments are ignored. :param string key: the series to write data into :param list data: a list of DataPoints to write :rtype: :class:`tem...
python
def write_data(self, key, data, tags=[], attrs={}): """Write a set a datapoints into a series by its key. For now, the tags and attributes arguments are ignored. :param string key: the series to write data into :param list data: a list of DataPoints to write :rtype: :class:`tem...
[ "def", "write_data", "(", "self", ",", "key", ",", "data", ",", "tags", "=", "[", "]", ",", "attrs", "=", "{", "}", ")", ":", "url", "=", "make_series_url", "(", "key", ")", "url", "=", "urlparse", ".", "urljoin", "(", "url", "+", "'/'", ",", "...
Write a set a datapoints into a series by its key. For now, the tags and attributes arguments are ignored. :param string key: the series to write data into :param list data: a list of DataPoints to write :rtype: :class:`tempodb.response.Response` object
[ "Write", "a", "set", "a", "datapoints", "into", "a", "series", "by", "its", "key", ".", "For", "now", "the", "tags", "and", "attributes", "arguments", "are", "ignored", "." ]
train
https://github.com/tempodb/tempodb-python/blob/8ce45231bd728c6c97ef799cf0f1513ea3a9a7d3/tempodb/client.py#L545-L568
tempodb/tempodb-python
tempodb/client.py
Client.write_multi
def write_multi(self, data): """Write a set a datapoints into multiple series by key or series ID. Each :class:`tempodb.protocol.objects.DataPoint` object should have either a key or id attribute set that indicates which series it will be written into:: [ {"t...
python
def write_multi(self, data): """Write a set a datapoints into multiple series by key or series ID. Each :class:`tempodb.protocol.objects.DataPoint` object should have either a key or id attribute set that indicates which series it will be written into:: [ {"t...
[ "def", "write_multi", "(", "self", ",", "data", ")", ":", "url", "=", "'multi/'", "dlist", "=", "[", "d", ".", "to_dictionary", "(", ")", "for", "d", "in", "data", "]", "body", "=", "json", ".", "dumps", "(", "dlist", ")", "resp", "=", "self", "....
Write a set a datapoints into multiple series by key or series ID. Each :class:`tempodb.protocol.objects.DataPoint` object should have either a key or id attribute set that indicates which series it will be written into:: [ {"t": "2012-...", "key": "foo", "v": 1}, ...
[ "Write", "a", "set", "a", "datapoints", "into", "multiple", "series", "by", "key", "or", "series", "ID", ".", "Each", ":", "class", ":", "tempodb", ".", "protocol", ".", "objects", ".", "DataPoint", "object", "should", "have", "either", "a", "key", "or",...
train
https://github.com/tempodb/tempodb-python/blob/8ce45231bd728c6c97ef799cf0f1513ea3a9a7d3/tempodb/client.py#L571-L593
tempodb/tempodb-python
tempodb/client.py
Client.single_value
def single_value(self, key, ts=None, direction=None): """Return a single value for a series. You can supply a timestamp as the ts argument, otherwise the search defaults to the current time. The direction argument can be one of "exact", "before", "after", or "nearest". ...
python
def single_value(self, key, ts=None, direction=None): """Return a single value for a series. You can supply a timestamp as the ts argument, otherwise the search defaults to the current time. The direction argument can be one of "exact", "before", "after", or "nearest". ...
[ "def", "single_value", "(", "self", ",", "key", ",", "ts", "=", "None", ",", "direction", "=", "None", ")", ":", "url", "=", "make_series_url", "(", "key", ")", "url", "=", "urlparse", ".", "urljoin", "(", "url", "+", "'/'", ",", "'single'", ")", "...
Return a single value for a series. You can supply a timestamp as the ts argument, otherwise the search defaults to the current time. The direction argument can be one of "exact", "before", "after", or "nearest". :param string key: the key for the series to use :param ...
[ "Return", "a", "single", "value", "for", "a", "series", ".", "You", "can", "supply", "a", "timestamp", "as", "the", "ts", "argument", "otherwise", "the", "search", "defaults", "to", "the", "current", "time", "." ]
train
https://github.com/tempodb/tempodb-python/blob/8ce45231bd728c6c97ef799cf0f1513ea3a9a7d3/tempodb/client.py#L621-L653
tempodb/tempodb-python
tempodb/client.py
Client.multi_series_single_value
def multi_series_single_value(self, keys=None, ts=None, direction=None, attrs={}, tags=[]): """Return a single value for multiple series. You can supply a timestamp as the ts argument, otherwise the search defaults to the current time. The direction ar...
python
def multi_series_single_value(self, keys=None, ts=None, direction=None, attrs={}, tags=[]): """Return a single value for multiple series. You can supply a timestamp as the ts argument, otherwise the search defaults to the current time. The direction ar...
[ "def", "multi_series_single_value", "(", "self", ",", "keys", "=", "None", ",", "ts", "=", "None", ",", "direction", "=", "None", ",", "attrs", "=", "{", "}", ",", "tags", "=", "[", "]", ")", ":", "url", "=", "'single/'", "if", "ts", "is", "not", ...
Return a single value for multiple series. You can supply a timestamp as the ts argument, otherwise the search defaults to the current time. The direction argument can be one of "exact", "before", "after", or "nearest". The id, key, tag, and attr arguments allow you to filter ...
[ "Return", "a", "single", "value", "for", "multiple", "series", ".", "You", "can", "supply", "a", "timestamp", "as", "the", "ts", "argument", "otherwise", "the", "search", "defaults", "to", "the", "current", "time", "." ]
train
https://github.com/tempodb/tempodb-python/blob/8ce45231bd728c6c97ef799cf0f1513ea3a9a7d3/tempodb/client.py#L656-L696
dacut/meterer
meterer/client.py
Meterer.allow_resource_access
def allow_resource_access(self, resource_name, when=None): """ meterer.allow_resource_access(resource_name, when=None) -> bool Indicate whether access to the specified resource should be allowed. This checks the limit(s) for the pool associated with the resource and records the ...
python
def allow_resource_access(self, resource_name, when=None): """ meterer.allow_resource_access(resource_name, when=None) -> bool Indicate whether access to the specified resource should be allowed. This checks the limit(s) for the pool associated with the resource and records the ...
[ "def", "allow_resource_access", "(", "self", ",", "resource_name", ",", "when", "=", "None", ")", ":", "# The period strings of interest to us", "period_strs", "=", "self", ".", "get_period_strs", "(", "when", ")", "# Get the pool and limits for the pool.", "pool", "=",...
meterer.allow_resource_access(resource_name, when=None) -> bool Indicate whether access to the specified resource should be allowed. This checks the limit(s) for the pool associated with the resource and records the attempt. If the attempt falls below the limit, the allowance is also re...
[ "meterer", ".", "allow_resource_access", "(", "resource_name", "when", "=", "None", ")", "-", ">", "bool" ]
train
https://github.com/dacut/meterer/blob/441e7f021e3302597f56876948a40fe8799a3375/meterer/client.py#L47-L101
dacut/meterer
meterer/client.py
Meterer.resource_size
def resource_size(self, resource_name): # pylint: disable=R0201 """ meterer.resource_size(resource_name) -> int Retrieve the size of the given resource. """ cached_size = self.get_cached_resource_size(resource_name) if cached_size is not None: return cached_s...
python
def resource_size(self, resource_name): # pylint: disable=R0201 """ meterer.resource_size(resource_name) -> int Retrieve the size of the given resource. """ cached_size = self.get_cached_resource_size(resource_name) if cached_size is not None: return cached_s...
[ "def", "resource_size", "(", "self", ",", "resource_name", ")", ":", "# pylint: disable=R0201", "cached_size", "=", "self", ".", "get_cached_resource_size", "(", "resource_name", ")", "if", "cached_size", "is", "not", "None", ":", "return", "cached_size", "[", "\"...
meterer.resource_size(resource_name) -> int Retrieve the size of the given resource.
[ "meterer", ".", "resource_size", "(", "resource_name", ")", "-", ">", "int" ]
train
https://github.com/dacut/meterer/blob/441e7f021e3302597f56876948a40fe8799a3375/meterer/client.py#L112-L126
dacut/meterer
meterer/client.py
Meterer.get_limits_for_pool
def get_limits_for_pool(self, pool): """ meterer.get_limits_for_pool(pool) -> dict Returns the limits for the given pool. If the pool does not have limits set, {} is returned. The resulting dict has the following format. Each item is optional and indicates no limit for ...
python
def get_limits_for_pool(self, pool): """ meterer.get_limits_for_pool(pool) -> dict Returns the limits for the given pool. If the pool does not have limits set, {} is returned. The resulting dict has the following format. Each item is optional and indicates no limit for ...
[ "def", "get_limits_for_pool", "(", "self", ",", "pool", ")", ":", "pool_limits", "=", "self", ".", "cache", ".", "get", "(", "\"LIMIT:%s\"", "%", "pool", ")", "if", "pool_limits", "is", "None", ":", "return", "{", "}", "return", "json_loads", "(", "pool_...
meterer.get_limits_for_pool(pool) -> dict Returns the limits for the given pool. If the pool does not have limits set, {} is returned. The resulting dict has the following format. Each item is optional and indicates no limit for the specified time period. { "year": ...
[ "meterer", ".", "get_limits_for_pool", "(", "pool", ")", "-", ">", "dict" ]
train
https://github.com/dacut/meterer/blob/441e7f021e3302597f56876948a40fe8799a3375/meterer/client.py#L128-L149
dacut/meterer
meterer/client.py
Meterer.set_limits_for_pool
def set_limits_for_pool(self, pool, **kw): """ meterer.set_limits_for_pool(pool, [time_period=value]) Sets the limits for the given pool. The valid time_periods are: year, month, week, day, hour. """ pool_limits = {} for time_period in ["year", "month", "week", ...
python
def set_limits_for_pool(self, pool, **kw): """ meterer.set_limits_for_pool(pool, [time_period=value]) Sets the limits for the given pool. The valid time_periods are: year, month, week, day, hour. """ pool_limits = {} for time_period in ["year", "month", "week", ...
[ "def", "set_limits_for_pool", "(", "self", ",", "pool", ",", "*", "*", "kw", ")", ":", "pool_limits", "=", "{", "}", "for", "time_period", "in", "[", "\"year\"", ",", "\"month\"", ",", "\"week\"", ",", "\"day\"", ",", "\"hour\"", "]", ":", "if", "time_...
meterer.set_limits_for_pool(pool, [time_period=value]) Sets the limits for the given pool. The valid time_periods are: year, month, week, day, hour.
[ "meterer", ".", "set_limits_for_pool", "(", "pool", "[", "time_period", "=", "value", "]", ")" ]
train
https://github.com/dacut/meterer/blob/441e7f021e3302597f56876948a40fe8799a3375/meterer/client.py#L151-L175
dacut/meterer
meterer/client.py
Meterer.get_cached_resource_size
def get_cached_resource_size(self, resource_name): """ meterer.get_cached_resource_size(resource_name) -> dict Retrieve cached information about the given resource. The resulting dict has the following structure: { "size": int, # Size of the resource ...
python
def get_cached_resource_size(self, resource_name): """ meterer.get_cached_resource_size(resource_name) -> dict Retrieve cached information about the given resource. The resulting dict has the following structure: { "size": int, # Size of the resource ...
[ "def", "get_cached_resource_size", "(", "self", ",", "resource_name", ")", ":", "size_data", "=", "self", ".", "cache", ".", "get", "(", "\"SIZE:%s\"", "%", "resource_name", ")", "if", "size_data", "is", "None", ":", "return", "None", "return", "json_loads", ...
meterer.get_cached_resource_size(resource_name) -> dict Retrieve cached information about the given resource. The resulting dict has the following structure: { "size": int, # Size of the resource "recorded_time": float, # Unix timestamp when this was g...
[ "meterer", ".", "get_cached_resource_size", "(", "resource_name", ")", "-", ">", "dict" ]
train
https://github.com/dacut/meterer/blob/441e7f021e3302597f56876948a40fe8799a3375/meterer/client.py#L177-L192
dacut/meterer
meterer/client.py
Meterer.set_cached_resource_size
def set_cached_resource_size(self, resource_name, size): """ meterer.set_cached_resource_size(resource_name) Set cached information about the given resource. """ size_data = json_dumps({"size": size, "recorded_time": time()}) self.cache.set( "SIZE:%s" % resou...
python
def set_cached_resource_size(self, resource_name, size): """ meterer.set_cached_resource_size(resource_name) Set cached information about the given resource. """ size_data = json_dumps({"size": size, "recorded_time": time()}) self.cache.set( "SIZE:%s" % resou...
[ "def", "set_cached_resource_size", "(", "self", ",", "resource_name", ",", "size", ")", ":", "size_data", "=", "json_dumps", "(", "{", "\"size\"", ":", "size", ",", "\"recorded_time\"", ":", "time", "(", ")", "}", ")", "self", ".", "cache", ".", "set", "...
meterer.set_cached_resource_size(resource_name) Set cached information about the given resource.
[ "meterer", ".", "set_cached_resource_size", "(", "resource_name", ")" ]
train
https://github.com/dacut/meterer/blob/441e7f021e3302597f56876948a40fe8799a3375/meterer/client.py#L194-L204
dacut/meterer
meterer/client.py
Meterer.get_period_strs
def get_period_strs(self, now=None): """ meterer.get_period_strings() Return the period strings for the specified time (defaulting to the current time if not specified). """ if now is None: now = self.dt.utcnow() year_str = "%04d" % now.year ...
python
def get_period_strs(self, now=None): """ meterer.get_period_strings() Return the period strings for the specified time (defaulting to the current time if not specified). """ if now is None: now = self.dt.utcnow() year_str = "%04d" % now.year ...
[ "def", "get_period_strs", "(", "self", ",", "now", "=", "None", ")", ":", "if", "now", "is", "None", ":", "now", "=", "self", ".", "dt", ".", "utcnow", "(", ")", "year_str", "=", "\"%04d\"", "%", "now", ".", "year", "month_str", "=", "\"%04d-%02d\"",...
meterer.get_period_strings() Return the period strings for the specified time (defaulting to the current time if not specified).
[ "meterer", ".", "get_period_strings", "()" ]
train
https://github.com/dacut/meterer/blob/441e7f021e3302597f56876948a40fe8799a3375/meterer/client.py#L216-L243
rorr73/LifeSOSpy
lifesospy/client.py
Client.async_open
async def async_open(self) -> None: """Opens connection to the LifeSOS ethernet interface.""" await self._loop.create_connection( lambda: self, self._host, self._port)
python
async def async_open(self) -> None: """Opens connection to the LifeSOS ethernet interface.""" await self._loop.create_connection( lambda: self, self._host, self._port)
[ "async", "def", "async_open", "(", "self", ")", "->", "None", ":", "await", "self", ".", "_loop", ".", "create_connection", "(", "lambda", ":", "self", ",", "self", ".", "_host", ",", "self", ".", "_port", ")" ]
Opens connection to the LifeSOS ethernet interface.
[ "Opens", "connection", "to", "the", "LifeSOS", "ethernet", "interface", "." ]
train
https://github.com/rorr73/LifeSOSpy/blob/62360fbab2e90bf04d52b547093bdab2d4e389b4/lifesospy/client.py#L44-L50
jeroyang/cateye
cateye/cateye.py
load_abbr
def load_abbr(abbr_file=ABBREVIATION_FILE): """ Load the abbr2long from file """ abbr2long = dict() with open(abbr_file) as f: lines = f.read().split('\n') for line in lines: m = re.match(r'(\w+)\t(.+)', line) if m: abbr2long[m.group(1)] = m.gr...
python
def load_abbr(abbr_file=ABBREVIATION_FILE): """ Load the abbr2long from file """ abbr2long = dict() with open(abbr_file) as f: lines = f.read().split('\n') for line in lines: m = re.match(r'(\w+)\t(.+)', line) if m: abbr2long[m.group(1)] = m.gr...
[ "def", "load_abbr", "(", "abbr_file", "=", "ABBREVIATION_FILE", ")", ":", "abbr2long", "=", "dict", "(", ")", "with", "open", "(", "abbr_file", ")", "as", "f", ":", "lines", "=", "f", ".", "read", "(", ")", ".", "split", "(", "'\\n'", ")", "for", "...
Load the abbr2long from file
[ "Load", "the", "abbr2long", "from", "file" ]
train
https://github.com/jeroyang/cateye/blob/8f181d6428d113d2928e3eb31703705ce0779eae/cateye/cateye.py#L17-L28
jeroyang/cateye
cateye/cateye.py
load_spelling
def load_spelling(spell_file=SPELLING_FILE): """ Load the term_freq from spell_file """ with open(spell_file) as f: tokens = f.read().split('\n') size = len(tokens) term_freq = {token: size - i for i, token in enumerate(tokens)} return term_freq
python
def load_spelling(spell_file=SPELLING_FILE): """ Load the term_freq from spell_file """ with open(spell_file) as f: tokens = f.read().split('\n') size = len(tokens) term_freq = {token: size - i for i, token in enumerate(tokens)} return term_freq
[ "def", "load_spelling", "(", "spell_file", "=", "SPELLING_FILE", ")", ":", "with", "open", "(", "spell_file", ")", "as", "f", ":", "tokens", "=", "f", ".", "read", "(", ")", ".", "split", "(", "'\\n'", ")", "size", "=", "len", "(", "tokens", ")", "...
Load the term_freq from spell_file
[ "Load", "the", "term_freq", "from", "spell_file" ]
train
https://github.com/jeroyang/cateye/blob/8f181d6428d113d2928e3eb31703705ce0779eae/cateye/cateye.py#L31-L39
jeroyang/cateye
cateye/cateye.py
load_search_freq
def load_search_freq(fp=SEARCH_FREQ_JSON): """ Load the search_freq from JSON file """ try: with open(fp) as f: return Counter(json.load(f)) except FileNotFoundError: return Counter()
python
def load_search_freq(fp=SEARCH_FREQ_JSON): """ Load the search_freq from JSON file """ try: with open(fp) as f: return Counter(json.load(f)) except FileNotFoundError: return Counter()
[ "def", "load_search_freq", "(", "fp", "=", "SEARCH_FREQ_JSON", ")", ":", "try", ":", "with", "open", "(", "fp", ")", "as", "f", ":", "return", "Counter", "(", "json", ".", "load", "(", "f", ")", ")", "except", "FileNotFoundError", ":", "return", "Count...
Load the search_freq from JSON file
[ "Load", "the", "search_freq", "from", "JSON", "file" ]
train
https://github.com/jeroyang/cateye/blob/8f181d6428d113d2928e3eb31703705ce0779eae/cateye/cateye.py#L41-L49
jeroyang/cateye
cateye/cateye.py
tokenize
def tokenize(s): """ A simple tokneizer """ s = re.sub(r'(?a)(\w+)\'s', r'\1', s) # clean the 's from Crohn's disease #s = re.sub(r'(?a)\b', ' ', s) # split the borders of chinese and english chars split_pattern = r'[{} ]+'.format(re.escape(STOPCHARS)) tokens = [token for token in re.split(...
python
def tokenize(s): """ A simple tokneizer """ s = re.sub(r'(?a)(\w+)\'s', r'\1', s) # clean the 's from Crohn's disease #s = re.sub(r'(?a)\b', ' ', s) # split the borders of chinese and english chars split_pattern = r'[{} ]+'.format(re.escape(STOPCHARS)) tokens = [token for token in re.split(...
[ "def", "tokenize", "(", "s", ")", ":", "s", "=", "re", ".", "sub", "(", "r'(?a)(\\w+)\\'s'", ",", "r'\\1'", ",", "s", ")", "# clean the 's from Crohn's disease", "#s = re.sub(r'(?a)\\b', ' ', s) # split the borders of chinese and english chars", "split_pattern", "=", "r'[...
A simple tokneizer
[ "A", "simple", "tokneizer" ]
train
https://github.com/jeroyang/cateye/blob/8f181d6428d113d2928e3eb31703705ce0779eae/cateye/cateye.py#L71-L80
jeroyang/cateye
cateye/cateye.py
invert_index
def invert_index(source_dir, index_url=INDEX_URL, init=False): """ Build the invert index from give source_dir Output a Shove object built on the store_path Input: source_dir: a directory on the filesystem index_url: the store_path for the Shove object init: clear the old index a...
python
def invert_index(source_dir, index_url=INDEX_URL, init=False): """ Build the invert index from give source_dir Output a Shove object built on the store_path Input: source_dir: a directory on the filesystem index_url: the store_path for the Shove object init: clear the old index a...
[ "def", "invert_index", "(", "source_dir", ",", "index_url", "=", "INDEX_URL", ",", "init", "=", "False", ")", ":", "raw_index", "=", "defaultdict", "(", "list", ")", "for", "base", ",", "dir_list", ",", "fn_list", "in", "os", ".", "walk", "(", "source_di...
Build the invert index from give source_dir Output a Shove object built on the store_path Input: source_dir: a directory on the filesystem index_url: the store_path for the Shove object init: clear the old index and rebuild from scratch Output: index: a Shove object
[ "Build", "the", "invert", "index", "from", "give", "source_dir", "Output", "a", "Shove", "object", "built", "on", "the", "store_path", "Input", ":", "source_dir", ":", "a", "directory", "on", "the", "filesystem", "index_url", ":", "the", "store_path", "for", ...
train
https://github.com/jeroyang/cateye/blob/8f181d6428d113d2928e3eb31703705ce0779eae/cateye/cateye.py#L94-L119
jeroyang/cateye
cateye/cateye.py
write_spelling
def write_spelling(token_folder, spelling_file): """ Generate the spelling correction file form token_folder and save to spelling_file """ token_pattern = r'[a-z]{3,}' tokens = [] for base, dirlist, fnlist in os.walk(token_folder): for fn in fnlist: fp = os.path.join(base, fn...
python
def write_spelling(token_folder, spelling_file): """ Generate the spelling correction file form token_folder and save to spelling_file """ token_pattern = r'[a-z]{3,}' tokens = [] for base, dirlist, fnlist in os.walk(token_folder): for fn in fnlist: fp = os.path.join(base, fn...
[ "def", "write_spelling", "(", "token_folder", ",", "spelling_file", ")", ":", "token_pattern", "=", "r'[a-z]{3,}'", "tokens", "=", "[", "]", "for", "base", ",", "dirlist", ",", "fnlist", "in", "os", ".", "walk", "(", "token_folder", ")", ":", "for", "fn", ...
Generate the spelling correction file form token_folder and save to spelling_file
[ "Generate", "the", "spelling", "correction", "file", "form", "token_folder", "and", "save", "to", "spelling_file" ]
train
https://github.com/jeroyang/cateye/blob/8f181d6428d113d2928e3eb31703705ce0779eae/cateye/cateye.py#L121-L136
jeroyang/cateye
cateye/cateye.py
get_hints
def get_hints(code_list, k=10, hint_folder=HINT_FOLDER, current_tokens=None): """ Fetch first k hints for given code_list """ def hint_score(v, size): """ The formula for hint score """ return 1.0 - abs(v / (size + 1) - 0.5) if len(code_list) <= 1: return []...
python
def get_hints(code_list, k=10, hint_folder=HINT_FOLDER, current_tokens=None): """ Fetch first k hints for given code_list """ def hint_score(v, size): """ The formula for hint score """ return 1.0 - abs(v / (size + 1) - 0.5) if len(code_list) <= 1: return []...
[ "def", "get_hints", "(", "code_list", ",", "k", "=", "10", ",", "hint_folder", "=", "HINT_FOLDER", ",", "current_tokens", "=", "None", ")", ":", "def", "hint_score", "(", "v", ",", "size", ")", ":", "\"\"\"\n The formula for hint score\n \"\"\"", "...
Fetch first k hints for given code_list
[ "Fetch", "first", "k", "hints", "for", "given", "code_list" ]
train
https://github.com/jeroyang/cateye/blob/8f181d6428d113d2928e3eb31703705ce0779eae/cateye/cateye.py#L138-L177
jeroyang/cateye
cateye/cateye.py
fetch
def fetch(index, tokens): """ Fetch the codes from given tokens """ if len(tokens) == 0: return set() return set.intersection(*[set(index.get(token, [])) for token in tokens])
python
def fetch(index, tokens): """ Fetch the codes from given tokens """ if len(tokens) == 0: return set() return set.intersection(*[set(index.get(token, [])) for token in tokens])
[ "def", "fetch", "(", "index", ",", "tokens", ")", ":", "if", "len", "(", "tokens", ")", "==", "0", ":", "return", "set", "(", ")", "return", "set", ".", "intersection", "(", "*", "[", "set", "(", "index", ".", "get", "(", "token", ",", "[", "]"...
Fetch the codes from given tokens
[ "Fetch", "the", "codes", "from", "given", "tokens" ]
train
https://github.com/jeroyang/cateye/blob/8f181d6428d113d2928e3eb31703705ce0779eae/cateye/cateye.py#L179-L185
jeroyang/cateye
cateye/cateye.py
get_snippets
def get_snippets(code_list, base=SNIPPET_FOLDER): """ Get the snippets """ output = [] for code in code_list: path = gen_path(base, code) fp = os.path.join(path, code) try: with open(fp) as f: output.append(f.read()) except FileNotFoundErro...
python
def get_snippets(code_list, base=SNIPPET_FOLDER): """ Get the snippets """ output = [] for code in code_list: path = gen_path(base, code) fp = os.path.join(path, code) try: with open(fp) as f: output.append(f.read()) except FileNotFoundErro...
[ "def", "get_snippets", "(", "code_list", ",", "base", "=", "SNIPPET_FOLDER", ")", ":", "output", "=", "[", "]", "for", "code", "in", "code_list", ":", "path", "=", "gen_path", "(", "base", ",", "code", ")", "fp", "=", "os", ".", "path", ".", "join", ...
Get the snippets
[ "Get", "the", "snippets" ]
train
https://github.com/jeroyang/cateye/blob/8f181d6428d113d2928e3eb31703705ce0779eae/cateye/cateye.py#L187-L202
jeroyang/cateye
cateye/cateye.py
_ed1
def _ed1(token): """ Return tokens the edit distance of which is one from the given token """ insertion = {letter.join([token[:i], token[i:]]) for letter in string.ascii_lowercase for i in range(1, len(token) + 1)} deletion = {''.join([token[:i], token[i+1:]]) for i in range(1, len(token) + 1)} ...
python
def _ed1(token): """ Return tokens the edit distance of which is one from the given token """ insertion = {letter.join([token[:i], token[i:]]) for letter in string.ascii_lowercase for i in range(1, len(token) + 1)} deletion = {''.join([token[:i], token[i+1:]]) for i in range(1, len(token) + 1)} ...
[ "def", "_ed1", "(", "token", ")", ":", "insertion", "=", "{", "letter", ".", "join", "(", "[", "token", "[", ":", "i", "]", ",", "token", "[", "i", ":", "]", "]", ")", "for", "letter", "in", "string", ".", "ascii_lowercase", "for", "i", "in", "...
Return tokens the edit distance of which is one from the given token
[ "Return", "tokens", "the", "edit", "distance", "of", "which", "is", "one", "from", "the", "given", "token" ]
train
https://github.com/jeroyang/cateye/blob/8f181d6428d113d2928e3eb31703705ce0779eae/cateye/cateye.py#L216-L224
jeroyang/cateye
cateye/cateye.py
_correct
def _correct(token, term_freq): """ Correct a single token according to the term_freq """ if token.lower() in term_freq: return token e1 = [t for t in _ed1(token) if t in term_freq] if len(e1) > 0: e1.sort(key=term_freq.get) return e1[0] e2 = [t for t in _ed2(token) i...
python
def _correct(token, term_freq): """ Correct a single token according to the term_freq """ if token.lower() in term_freq: return token e1 = [t for t in _ed1(token) if t in term_freq] if len(e1) > 0: e1.sort(key=term_freq.get) return e1[0] e2 = [t for t in _ed2(token) i...
[ "def", "_correct", "(", "token", ",", "term_freq", ")", ":", "if", "token", ".", "lower", "(", ")", "in", "term_freq", ":", "return", "token", "e1", "=", "[", "t", "for", "t", "in", "_ed1", "(", "token", ")", "if", "t", "in", "term_freq", "]", "i...
Correct a single token according to the term_freq
[ "Correct", "a", "single", "token", "according", "to", "the", "term_freq" ]
train
https://github.com/jeroyang/cateye/blob/8f181d6428d113d2928e3eb31703705ce0779eae/cateye/cateye.py#L232-L246
jeroyang/cateye
cateye/cateye.py
correct
def correct(tokens, term_freq): """ Correct a list of tokens, according to the term_freq """ log = [] output = [] for token in tokens: corrected = _correct(token, term_freq) if corrected != token: log.append((token, corrected)) output.append(corrected) ret...
python
def correct(tokens, term_freq): """ Correct a list of tokens, according to the term_freq """ log = [] output = [] for token in tokens: corrected = _correct(token, term_freq) if corrected != token: log.append((token, corrected)) output.append(corrected) ret...
[ "def", "correct", "(", "tokens", ",", "term_freq", ")", ":", "log", "=", "[", "]", "output", "=", "[", "]", "for", "token", "in", "tokens", ":", "corrected", "=", "_correct", "(", "token", ",", "term_freq", ")", "if", "corrected", "!=", "token", ":",...
Correct a list of tokens, according to the term_freq
[ "Correct", "a", "list", "of", "tokens", "according", "to", "the", "term_freq" ]
train
https://github.com/jeroyang/cateye/blob/8f181d6428d113d2928e3eb31703705ce0779eae/cateye/cateye.py#L248-L259
jeroyang/cateye
cateye/cateye.py
result_sort_key
def result_sort_key(response_item): """ The sort key function for the search results Input: response_item: the tuple of (code, snippet) output: sortable value, the greatest first """ code, snippet = response_item snippet_length = len(snippet) freq = search_freq.get(code,...
python
def result_sort_key(response_item): """ The sort key function for the search results Input: response_item: the tuple of (code, snippet) output: sortable value, the greatest first """ code, snippet = response_item snippet_length = len(snippet) freq = search_freq.get(code,...
[ "def", "result_sort_key", "(", "response_item", ")", ":", "code", ",", "snippet", "=", "response_item", "snippet_length", "=", "len", "(", "snippet", ")", "freq", "=", "search_freq", ".", "get", "(", "code", ",", "0", ")", "beta", "=", "0.05", "score", "...
The sort key function for the search results Input: response_item: the tuple of (code, snippet) output: sortable value, the greatest first
[ "The", "sort", "key", "function", "for", "the", "search", "results", "Input", ":", "response_item", ":", "the", "tuple", "of", "(", "code", "snippet", ")", "output", ":", "sortable", "value", "the", "greatest", "first" ]
train
https://github.com/jeroyang/cateye/blob/8f181d6428d113d2928e3eb31703705ce0779eae/cateye/cateye.py#L261-L276
jeroyang/cateye
cateye/cateye.py
search
def search(index, query, snippet_folder=SNIPPET_FOLDER, term_freq=term_freq): """ The highest level of search function """ fallback_log = [] code_list = [] tokens = tokenize(query) tokens, abbr_log = abbr_expand(tokens) tokens, correct_log = correct(tokens, term_freq) tokens = lemmat...
python
def search(index, query, snippet_folder=SNIPPET_FOLDER, term_freq=term_freq): """ The highest level of search function """ fallback_log = [] code_list = [] tokens = tokenize(query) tokens, abbr_log = abbr_expand(tokens) tokens, correct_log = correct(tokens, term_freq) tokens = lemmat...
[ "def", "search", "(", "index", ",", "query", ",", "snippet_folder", "=", "SNIPPET_FOLDER", ",", "term_freq", "=", "term_freq", ")", ":", "fallback_log", "=", "[", "]", "code_list", "=", "[", "]", "tokens", "=", "tokenize", "(", "query", ")", "tokens", ",...
The highest level of search function
[ "The", "highest", "level", "of", "search", "function" ]
train
https://github.com/jeroyang/cateye/blob/8f181d6428d113d2928e3eb31703705ce0779eae/cateye/cateye.py#L278-L308
benchmarking-suite/benchsuite-core
src/benchsuite/core/config.py
ControllerConfiguration.list_available_providers
def list_available_providers(self): """ Lists all the ServiceProvider configuration files found in the configuration folders :return: """ providers = [] if self.alternative_config_dir: for f in os.listdir(os.path.join(self.alternative_config_dir, self.CLOUD_...
python
def list_available_providers(self): """ Lists all the ServiceProvider configuration files found in the configuration folders :return: """ providers = [] if self.alternative_config_dir: for f in os.listdir(os.path.join(self.alternative_config_dir, self.CLOUD_...
[ "def", "list_available_providers", "(", "self", ")", ":", "providers", "=", "[", "]", "if", "self", ".", "alternative_config_dir", ":", "for", "f", "in", "os", ".", "listdir", "(", "os", ".", "path", ".", "join", "(", "self", ".", "alternative_config_dir",...
Lists all the ServiceProvider configuration files found in the configuration folders :return:
[ "Lists", "all", "the", "ServiceProvider", "configuration", "files", "found", "in", "the", "configuration", "folders", ":", "return", ":" ]
train
https://github.com/benchmarking-suite/benchsuite-core/blob/deb2cba97861fcd71e184553dbcaa6ce591b67de/src/benchsuite/core/config.py#L120-L145
benchmarking-suite/benchsuite-core
src/benchsuite/core/config.py
ControllerConfiguration.list_available_tools
def list_available_tools(self): """ Lists all the Benchmarks configuration files found in the configuration folders :return: """ benchmarks = [] if self.alternative_config_dir: for n in glob.glob(os.path.join(self.alternative_config_dir, self.BENCHMARKS_DIR,...
python
def list_available_tools(self): """ Lists all the Benchmarks configuration files found in the configuration folders :return: """ benchmarks = [] if self.alternative_config_dir: for n in glob.glob(os.path.join(self.alternative_config_dir, self.BENCHMARKS_DIR,...
[ "def", "list_available_tools", "(", "self", ")", ":", "benchmarks", "=", "[", "]", "if", "self", ".", "alternative_config_dir", ":", "for", "n", "in", "glob", ".", "glob", "(", "os", ".", "path", ".", "join", "(", "self", ".", "alternative_config_dir", "...
Lists all the Benchmarks configuration files found in the configuration folders :return:
[ "Lists", "all", "the", "Benchmarks", "configuration", "files", "found", "in", "the", "configuration", "folders", ":", "return", ":" ]
train
https://github.com/benchmarking-suite/benchsuite-core/blob/deb2cba97861fcd71e184553dbcaa6ce591b67de/src/benchsuite/core/config.py#L147-L161
benchmarking-suite/benchsuite-core
src/benchsuite/core/config.py
ControllerConfiguration.get_storage_config_file
def get_storage_config_file(self): """ Returns the configuration file for the storage. :return: """ if self.alternative_config_dir: file = os.path.join(self.alternative_config_dir, self.STORAGE_CONFIG_FILE) if os.path.isfile(file): return ...
python
def get_storage_config_file(self): """ Returns the configuration file for the storage. :return: """ if self.alternative_config_dir: file = os.path.join(self.alternative_config_dir, self.STORAGE_CONFIG_FILE) if os.path.isfile(file): return ...
[ "def", "get_storage_config_file", "(", "self", ")", ":", "if", "self", ".", "alternative_config_dir", ":", "file", "=", "os", ".", "path", ".", "join", "(", "self", ".", "alternative_config_dir", ",", "self", ".", "STORAGE_CONFIG_FILE", ")", "if", "os", ".",...
Returns the configuration file for the storage. :return:
[ "Returns", "the", "configuration", "file", "for", "the", "storage", ".", ":", "return", ":" ]
train
https://github.com/benchmarking-suite/benchsuite-core/blob/deb2cba97861fcd71e184553dbcaa6ce591b67de/src/benchsuite/core/config.py#L179-L201
knagra/farnsworth
base/forms.py
ProfileRequestForm.is_valid
def is_valid(self): ''' Validate form. Return True if Django validates the form, the username obeys the parameters, and passwords match. Return False otherwise. ''' if not super(ProfileRequestForm, self).is_valid(): return False validity = True if self...
python
def is_valid(self): ''' Validate form. Return True if Django validates the form, the username obeys the parameters, and passwords match. Return False otherwise. ''' if not super(ProfileRequestForm, self).is_valid(): return False validity = True if self...
[ "def", "is_valid", "(", "self", ")", ":", "if", "not", "super", "(", "ProfileRequestForm", ",", "self", ")", ".", "is_valid", "(", ")", ":", "return", "False", "validity", "=", "True", "if", "self", ".", "cleaned_data", "[", "'password'", "]", "!=", "s...
Validate form. Return True if Django validates the form, the username obeys the parameters, and passwords match. Return False otherwise.
[ "Validate", "form", ".", "Return", "True", "if", "Django", "validates", "the", "form", "the", "username", "obeys", "the", "parameters", "and", "passwords", "match", ".", "Return", "False", "otherwise", "." ]
train
https://github.com/knagra/farnsworth/blob/1b6589f0d9fea154f0a1e2231ed906764ed26d26/base/forms.py#L65-L77
knagra/farnsworth
base/forms.py
AddUserForm.is_valid
def is_valid(self): ''' Validate form. Return True if Django validates the form, the username obeys the parameters, and passwords match. Return False otherwise. ''' if not super(AddUserForm, self).is_valid(): return False first_name = self.cleaned_data['first_...
python
def is_valid(self): ''' Validate form. Return True if Django validates the form, the username obeys the parameters, and passwords match. Return False otherwise. ''' if not super(AddUserForm, self).is_valid(): return False first_name = self.cleaned_data['first_...
[ "def", "is_valid", "(", "self", ")", ":", "if", "not", "super", "(", "AddUserForm", ",", "self", ")", ".", "is_valid", "(", ")", ":", "return", "False", "first_name", "=", "self", ".", "cleaned_data", "[", "'first_name'", "]", "last_name", "=", "self", ...
Validate form. Return True if Django validates the form, the username obeys the parameters, and passwords match. Return False otherwise.
[ "Validate", "form", ".", "Return", "True", "if", "Django", "validates", "the", "form", "the", "username", "obeys", "the", "parameters", "and", "passwords", "match", ".", "Return", "False", "otherwise", "." ]
train
https://github.com/knagra/farnsworth/blob/1b6589f0d9fea154f0a1e2231ed906764ed26d26/base/forms.py#L157-L176
knagra/farnsworth
base/forms.py
DeleteUserForm.is_valid
def is_valid(self): ''' Validate form. Return True if Django validates the form, the username obeys the parameters, and passwords match. Return False otherwise. ''' if not super(DeleteUserForm, self).is_valid(): return False if self.user == self.request.user: ...
python
def is_valid(self): ''' Validate form. Return True if Django validates the form, the username obeys the parameters, and passwords match. Return False otherwise. ''' if not super(DeleteUserForm, self).is_valid(): return False if self.user == self.request.user: ...
[ "def", "is_valid", "(", "self", ")", ":", "if", "not", "super", "(", "DeleteUserForm", ",", "self", ")", ".", "is_valid", "(", ")", ":", "return", "False", "if", "self", ".", "user", "==", "self", ".", "request", ".", "user", ":", "self", ".", "_er...
Validate form. Return True if Django validates the form, the username obeys the parameters, and passwords match. Return False otherwise.
[ "Validate", "form", ".", "Return", "True", "if", "Django", "validates", "the", "form", "the", "username", "obeys", "the", "parameters", "and", "passwords", "match", ".", "Return", "False", "otherwise", "." ]
train
https://github.com/knagra/farnsworth/blob/1b6589f0d9fea154f0a1e2231ed906764ed26d26/base/forms.py#L239-L249
xgvargas/smartside
smartside/signal.py
SmartSignal._do_connection
def _do_connection(self, wgt, sig, func): """ Make a connection between a GUI widget and a callable. wgt and sig are strings with widget and signal name func is a callable for that signal """ #new style (we use this) #self.btn_name.clicked.connect(self.on_btn_na...
python
def _do_connection(self, wgt, sig, func): """ Make a connection between a GUI widget and a callable. wgt and sig are strings with widget and signal name func is a callable for that signal """ #new style (we use this) #self.btn_name.clicked.connect(self.on_btn_na...
[ "def", "_do_connection", "(", "self", ",", "wgt", ",", "sig", ",", "func", ")", ":", "#new style (we use this)", "#self.btn_name.clicked.connect(self.on_btn_name_clicked)", "#old style", "#self.connect(self.btn_name, SIGNAL('clicked()'), self.on_btn_name_clicked)", "if", "hasattr"...
Make a connection between a GUI widget and a callable. wgt and sig are strings with widget and signal name func is a callable for that signal
[ "Make", "a", "connection", "between", "a", "GUI", "widget", "and", "a", "callable", "." ]
train
https://github.com/xgvargas/smartside/blob/c63acb7d628b161f438e877eca12d550647de34d/smartside/signal.py#L17-L36
xgvargas/smartside
smartside/signal.py
SmartSignal._process_list
def _process_list(self, l): """ Processes a list of widget names. If any name is between `` then it is supposed to be a regex. """ if hasattr(self, l): t = getattr(self, l) def proc(inp): w = inp.strip() if w.startswith('...
python
def _process_list(self, l): """ Processes a list of widget names. If any name is between `` then it is supposed to be a regex. """ if hasattr(self, l): t = getattr(self, l) def proc(inp): w = inp.strip() if w.startswith('...
[ "def", "_process_list", "(", "self", ",", "l", ")", ":", "if", "hasattr", "(", "self", ",", "l", ")", ":", "t", "=", "getattr", "(", "self", ",", "l", ")", "def", "proc", "(", "inp", ")", ":", "w", "=", "inp", ".", "strip", "(", ")", "if", ...
Processes a list of widget names. If any name is between `` then it is supposed to be a regex.
[ "Processes", "a", "list", "of", "widget", "names", "." ]
train
https://github.com/xgvargas/smartside/blob/c63acb7d628b161f438e877eca12d550647de34d/smartside/signal.py#L38-L58
xgvargas/smartside
smartside/signal.py
SmartSignal.auto_connect
def auto_connect(self): """ Make a connection between every member function to a GUI signal. Every member function whose name is in format: '_on_' + <widget_name> + '__' + <widget_signal_name> are connected to the signal of a GUI widget if it exists. Also, every funct...
python
def auto_connect(self): """ Make a connection between every member function to a GUI signal. Every member function whose name is in format: '_on_' + <widget_name> + '__' + <widget_signal_name> are connected to the signal of a GUI widget if it exists. Also, every funct...
[ "def", "auto_connect", "(", "self", ")", ":", "for", "o", "in", "dir", "(", "self", ")", ":", "if", "o", ".", "startswith", "(", "'_on_'", ")", "and", "'__'", "in", "o", ":", "func", "=", "getattr", "(", "self", ",", "o", ")", "wgt", ",", "sig"...
Make a connection between every member function to a GUI signal. Every member function whose name is in format: '_on_' + <widget_name> + '__' + <widget_signal_name> are connected to the signal of a GUI widget if it exists. Also, every function with format: '_when_' + <group_...
[ "Make", "a", "connection", "between", "every", "member", "function", "to", "a", "GUI", "signal", "." ]
train
https://github.com/xgvargas/smartside/blob/c63acb7d628b161f438e877eca12d550647de34d/smartside/signal.py#L60-L96
xgvargas/smartside
smartside/signal.py
SmartSignal.print_signals_and_slots
def print_signals_and_slots(self): """ List all active Slots and Signal. Credits to: http://visitusers.org/index.php?title=PySide_Recipes#Debugging """ for i in xrange(self.metaObject().methodCount()): m = self.metaObject().method(i) if m.methodType() =...
python
def print_signals_and_slots(self): """ List all active Slots and Signal. Credits to: http://visitusers.org/index.php?title=PySide_Recipes#Debugging """ for i in xrange(self.metaObject().methodCount()): m = self.metaObject().method(i) if m.methodType() =...
[ "def", "print_signals_and_slots", "(", "self", ")", ":", "for", "i", "in", "xrange", "(", "self", ".", "metaObject", "(", ")", ".", "methodCount", "(", ")", ")", ":", "m", "=", "self", ".", "metaObject", "(", ")", ".", "method", "(", "i", ")", "if"...
List all active Slots and Signal. Credits to: http://visitusers.org/index.php?title=PySide_Recipes#Debugging
[ "List", "all", "active", "Slots", "and", "Signal", "." ]
train
https://github.com/xgvargas/smartside/blob/c63acb7d628b161f438e877eca12d550647de34d/smartside/signal.py#L98-L109
xgvargas/smartside
smartside/signal.py
SmartSignal.print_all_signals
def print_all_signals(self): """ Prints out every signal available for this widget and childs. """ for o in dir(self): obj= getattr(self, o) #print o, type(obj) div = False for c in dir(obj): cobj = getattr(obj, c) ...
python
def print_all_signals(self): """ Prints out every signal available for this widget and childs. """ for o in dir(self): obj= getattr(self, o) #print o, type(obj) div = False for c in dir(obj): cobj = getattr(obj, c) ...
[ "def", "print_all_signals", "(", "self", ")", ":", "for", "o", "in", "dir", "(", "self", ")", ":", "obj", "=", "getattr", "(", "self", ",", "o", ")", "#print o, type(obj)", "div", "=", "False", "for", "c", "in", "dir", "(", "obj", ")", ":", "cobj",...
Prints out every signal available for this widget and childs.
[ "Prints", "out", "every", "signal", "available", "for", "this", "widget", "and", "childs", "." ]
train
https://github.com/xgvargas/smartside/blob/c63acb7d628b161f438e877eca12d550647de34d/smartside/signal.py#L111-L125
misli/django-staticfiles-downloader
staticfiles_downloader/__init__.py
DownloaderStorage.open
def open(self, name, mode='rb'): """ Retrieves the specified file from storage. """ self.request = urlopen(self.url) if self.algorithm: self.hash = hashlib.new(self.algorithm) return self
python
def open(self, name, mode='rb'): """ Retrieves the specified file from storage. """ self.request = urlopen(self.url) if self.algorithm: self.hash = hashlib.new(self.algorithm) return self
[ "def", "open", "(", "self", ",", "name", ",", "mode", "=", "'rb'", ")", ":", "self", ".", "request", "=", "urlopen", "(", "self", ".", "url", ")", "if", "self", ".", "algorithm", ":", "self", ".", "hash", "=", "hashlib", ".", "new", "(", "self", ...
Retrieves the specified file from storage.
[ "Retrieves", "the", "specified", "file", "from", "storage", "." ]
train
https://github.com/misli/django-staticfiles-downloader/blob/f6440f6998d8e31fae986a25a03a8061d587af5a/staticfiles_downloader/__init__.py#L42-L49
misli/django-staticfiles-downloader
staticfiles_downloader/__init__.py
DownloaderFinder.find
def find(self, path, all=False): ''' Looks for files in the app directories. ''' found = os.path.join(settings.STATIC_ROOT, path) if all: return [found] else: return found
python
def find(self, path, all=False): ''' Looks for files in the app directories. ''' found = os.path.join(settings.STATIC_ROOT, path) if all: return [found] else: return found
[ "def", "find", "(", "self", ",", "path", ",", "all", "=", "False", ")", ":", "found", "=", "os", ".", "path", ".", "join", "(", "settings", ".", "STATIC_ROOT", ",", "path", ")", "if", "all", ":", "return", "[", "found", "]", "else", ":", "return"...
Looks for files in the app directories.
[ "Looks", "for", "files", "in", "the", "app", "directories", "." ]
train
https://github.com/misli/django-staticfiles-downloader/blob/f6440f6998d8e31fae986a25a03a8061d587af5a/staticfiles_downloader/__init__.py#L160-L168
daknuett/py_register_machine2
engine_tools/output/gpu_alike/rendering.py
Renderer.interrupt
def interrupt(self): """ Invoked on a write operation into the IR of the RendererDevice. """ if(self.device.read(9) & 0x01): self.handle_request() self.device.clear_IR()
python
def interrupt(self): """ Invoked on a write operation into the IR of the RendererDevice. """ if(self.device.read(9) & 0x01): self.handle_request() self.device.clear_IR()
[ "def", "interrupt", "(", "self", ")", ":", "if", "(", "self", ".", "device", ".", "read", "(", "9", ")", "&", "0x01", ")", ":", "self", ".", "handle_request", "(", ")", "self", ".", "device", ".", "clear_IR", "(", ")" ]
Invoked on a write operation into the IR of the RendererDevice.
[ "Invoked", "on", "a", "write", "operation", "into", "the", "IR", "of", "the", "RendererDevice", "." ]
train
https://github.com/daknuett/py_register_machine2/blob/599c53cd7576297d0d7a53344ed5d9aa98acc751/engine_tools/output/gpu_alike/rendering.py#L65-L71
daknuett/py_register_machine2
engine_tools/output/gpu_alike/rendering.py
Renderer.put_char
def put_char(self, char, r, g, b): """ Puts the character ``char`` into the char_buffer. Special characters: "\n" cursor[0] += 1 cursor[1] = 0 "\r" cursor[1] = 0 "\t" cursor[1] += 8 0 equals " " """ r, g, b = r & 0xff, g & 0xff, b & 0xff if(char == 0): char = " " if(char == ...
python
def put_char(self, char, r, g, b): """ Puts the character ``char`` into the char_buffer. Special characters: "\n" cursor[0] += 1 cursor[1] = 0 "\r" cursor[1] = 0 "\t" cursor[1] += 8 0 equals " " """ r, g, b = r & 0xff, g & 0xff, b & 0xff if(char == 0): char = " " if(char == ...
[ "def", "put_char", "(", "self", ",", "char", ",", "r", ",", "g", ",", "b", ")", ":", "r", ",", "g", ",", "b", "=", "r", "&", "0xff", ",", "g", "&", "0xff", ",", "b", "&", "0xff", "if", "(", "char", "==", "0", ")", ":", "char", "=", "\" ...
Puts the character ``char`` into the char_buffer. Special characters: "\n" cursor[0] += 1 cursor[1] = 0 "\r" cursor[1] = 0 "\t" cursor[1] += 8 0 equals " "
[ "Puts", "the", "character", "char", "into", "the", "char_buffer", ".", "Special", "characters", ":", "\\", "n", "cursor", "[", "0", "]", "+", "=", "1", "cursor", "[", "1", "]", "=", "0", "\\", "r", "cursor", "[", "1", "]", "=", "0", "\\", "t", ...
train
https://github.com/daknuett/py_register_machine2/blob/599c53cd7576297d0d7a53344ed5d9aa98acc751/engine_tools/output/gpu_alike/rendering.py#L82-L127
daknuett/py_register_machine2
engine_tools/output/gpu_alike/rendering.py
Renderer.draw_char_screen
def draw_char_screen(self): """ Draws the output buffered in the char_buffer. """ self.screen = Image.new("RGB", (self.height, self.width)) self.drawer = ImageDraw.Draw(self.screen) for sy, line in enumerate(self.char_buffer): for sx, tinfo in enumerate(line): self.drawer.text((sx * 6, sy * 9), tinf...
python
def draw_char_screen(self): """ Draws the output buffered in the char_buffer. """ self.screen = Image.new("RGB", (self.height, self.width)) self.drawer = ImageDraw.Draw(self.screen) for sy, line in enumerate(self.char_buffer): for sx, tinfo in enumerate(line): self.drawer.text((sx * 6, sy * 9), tinf...
[ "def", "draw_char_screen", "(", "self", ")", ":", "self", ".", "screen", "=", "Image", ".", "new", "(", "\"RGB\"", ",", "(", "self", ".", "height", ",", "self", ".", "width", ")", ")", "self", ".", "drawer", "=", "ImageDraw", ".", "Draw", "(", "sel...
Draws the output buffered in the char_buffer.
[ "Draws", "the", "output", "buffered", "in", "the", "char_buffer", "." ]
train
https://github.com/daknuett/py_register_machine2/blob/599c53cd7576297d0d7a53344ed5d9aa98acc751/engine_tools/output/gpu_alike/rendering.py#L129-L139
anrosent/cli
cli.py
CLI.add_func
def add_func(self, callback, names, *args): """Adds a command to the CLI - specify args as you would to argparse.ArgumentParser.add_argument() """ if isinstance(names, list): for name in names: self.add_func(callback, name, *args) self.aliases...
python
def add_func(self, callback, names, *args): """Adds a command to the CLI - specify args as you would to argparse.ArgumentParser.add_argument() """ if isinstance(names, list): for name in names: self.add_func(callback, name, *args) self.aliases...
[ "def", "add_func", "(", "self", ",", "callback", ",", "names", ",", "*", "args", ")", ":", "if", "isinstance", "(", "names", ",", "list", ")", ":", "for", "name", "in", "names", ":", "self", ".", "add_func", "(", "callback", ",", "name", ",", "*", ...
Adds a command to the CLI - specify args as you would to argparse.ArgumentParser.add_argument()
[ "Adds", "a", "command", "to", "the", "CLI", "-", "specify", "args", "as", "you", "would", "to", "argparse", ".", "ArgumentParser", ".", "add_argument", "()" ]
train
https://github.com/anrosent/cli/blob/8f89df4564c5124c95aaa288441f9d574dfa89a3/cli.py#L33-L50
anrosent/cli
cli.py
CLI.add_cli
def add_cli(self, prefix, other_cli): """Adds the functionality of the other CLI to this one, where all commands to the other CLI are prefixed by the given prefix plus a hyphen. e.g. To execute command `greet anson 5` on other cli given prefix cli2, you can execute the following with th...
python
def add_cli(self, prefix, other_cli): """Adds the functionality of the other CLI to this one, where all commands to the other CLI are prefixed by the given prefix plus a hyphen. e.g. To execute command `greet anson 5` on other cli given prefix cli2, you can execute the following with th...
[ "def", "add_cli", "(", "self", ",", "prefix", ",", "other_cli", ")", ":", "if", "prefix", "not", "in", "self", ".", "clis", "and", "prefix", "not", "in", "self", ".", "cmds", ":", "self", ".", "clis", "[", "prefix", "]", "=", "other_cli", "else", "...
Adds the functionality of the other CLI to this one, where all commands to the other CLI are prefixed by the given prefix plus a hyphen. e.g. To execute command `greet anson 5` on other cli given prefix cli2, you can execute the following with this CLI: cli2 greet anson 5
[ "Adds", "the", "functionality", "of", "the", "other", "CLI", "to", "this", "one", "where", "all", "commands", "to", "the", "other", "CLI", "are", "prefixed", "by", "the", "given", "prefix", "plus", "a", "hyphen", "." ]
train
https://github.com/anrosent/cli/blob/8f89df4564c5124c95aaa288441f9d574dfa89a3/cli.py#L52-L64
anrosent/cli
cli.py
CLI._dispatch
def _dispatch(self, cmd, args): """Attempt to run the given command with the given arguments """ if cmd in self.clis: extern_cmd, args = args[0], args[1:] self.clis[cmd]._dispatch(extern_cmd, args) else: if cmd in self.cmds: callback, p...
python
def _dispatch(self, cmd, args): """Attempt to run the given command with the given arguments """ if cmd in self.clis: extern_cmd, args = args[0], args[1:] self.clis[cmd]._dispatch(extern_cmd, args) else: if cmd in self.cmds: callback, p...
[ "def", "_dispatch", "(", "self", ",", "cmd", ",", "args", ")", ":", "if", "cmd", "in", "self", ".", "clis", ":", "extern_cmd", ",", "args", "=", "args", "[", "0", "]", ",", "args", "[", "1", ":", "]", "self", ".", "clis", "[", "cmd", "]", "."...
Attempt to run the given command with the given arguments
[ "Attempt", "to", "run", "the", "given", "command", "with", "the", "given", "arguments" ]
train
https://github.com/anrosent/cli/blob/8f89df4564c5124c95aaa288441f9d574dfa89a3/cli.py#L69-L84
anrosent/cli
cli.py
CLI.exec_cmd
def exec_cmd(self, cmdstr): """Parse line from CLI read loop and execute provided command """ parts = cmdstr.split() if len(parts): cmd, args = parts[0], parts[1:] self._dispatch(cmd, args) else: pass
python
def exec_cmd(self, cmdstr): """Parse line from CLI read loop and execute provided command """ parts = cmdstr.split() if len(parts): cmd, args = parts[0], parts[1:] self._dispatch(cmd, args) else: pass
[ "def", "exec_cmd", "(", "self", ",", "cmdstr", ")", ":", "parts", "=", "cmdstr", ".", "split", "(", ")", "if", "len", "(", "parts", ")", ":", "cmd", ",", "args", "=", "parts", "[", "0", "]", ",", "parts", "[", "1", ":", "]", "self", ".", "_di...
Parse line from CLI read loop and execute provided command
[ "Parse", "line", "from", "CLI", "read", "loop", "and", "execute", "provided", "command" ]
train
https://github.com/anrosent/cli/blob/8f89df4564c5124c95aaa288441f9d574dfa89a3/cli.py#L86-L94
anrosent/cli
cli.py
CLI.print_help
def print_help(self): """Prints usage of all registered commands, collapsing aliases into one record """ seen_aliases = set() print('-'*80) for cmd in sorted(self.cmds): if cmd not in self.builtin_cmds: if cmd not in seen_aliases: ...
python
def print_help(self): """Prints usage of all registered commands, collapsing aliases into one record """ seen_aliases = set() print('-'*80) for cmd in sorted(self.cmds): if cmd not in self.builtin_cmds: if cmd not in seen_aliases: ...
[ "def", "print_help", "(", "self", ")", ":", "seen_aliases", "=", "set", "(", ")", "print", "(", "'-'", "*", "80", ")", "for", "cmd", "in", "sorted", "(", "self", ".", "cmds", ")", ":", "if", "cmd", "not", "in", "self", ".", "builtin_cmds", ":", "...
Prints usage of all registered commands, collapsing aliases into one record
[ "Prints", "usage", "of", "all", "registered", "commands", "collapsing", "aliases", "into", "one", "record" ]
train
https://github.com/anrosent/cli/blob/8f89df4564c5124c95aaa288441f9d574dfa89a3/cli.py#L99-L116
anrosent/cli
cli.py
CLI.run
def run(self, instream=sys.stdin): """Runs the CLI, reading from sys.stdin by default """ sys.stdout.write(self.prompt) sys.stdout.flush() while True: line = instream.readline() try: self.exec_cmd(line) except Exception as e: ...
python
def run(self, instream=sys.stdin): """Runs the CLI, reading from sys.stdin by default """ sys.stdout.write(self.prompt) sys.stdout.flush() while True: line = instream.readline() try: self.exec_cmd(line) except Exception as e: ...
[ "def", "run", "(", "self", ",", "instream", "=", "sys", ".", "stdin", ")", ":", "sys", ".", "stdout", ".", "write", "(", "self", ".", "prompt", ")", "sys", ".", "stdout", ".", "flush", "(", ")", "while", "True", ":", "line", "=", "instream", ".",...
Runs the CLI, reading from sys.stdin by default
[ "Runs", "the", "CLI", "reading", "from", "sys", ".", "stdin", "by", "default" ]
train
https://github.com/anrosent/cli/blob/8f89df4564c5124c95aaa288441f9d574dfa89a3/cli.py#L124-L137
jmvrbanac/PackMap
packmap/cli.py
PackMapClient.execute_finder
def execute_finder(self, manager, package_name): """ Execute finder script within the temporary venv context. """ filename = '{env_path}/results.json'.format(env_path=manager.env_path) subprocess.call([ manager.venv_python, self._finder_path, package_name, filename ]) ...
python
def execute_finder(self, manager, package_name): """ Execute finder script within the temporary venv context. """ filename = '{env_path}/results.json'.format(env_path=manager.env_path) subprocess.call([ manager.venv_python, self._finder_path, package_name, filename ]) ...
[ "def", "execute_finder", "(", "self", ",", "manager", ",", "package_name", ")", ":", "filename", "=", "'{env_path}/results.json'", ".", "format", "(", "env_path", "=", "manager", ".", "env_path", ")", "subprocess", ".", "call", "(", "[", "manager", ".", "ven...
Execute finder script within the temporary venv context.
[ "Execute", "finder", "script", "within", "the", "temporary", "venv", "context", "." ]
train
https://github.com/jmvrbanac/PackMap/blob/e35d12d21ab109cae1175e0dc94d7f4855256b23/packmap/cli.py#L65-L74
corydodt/Crosscap
crosscap/urltool.py
_iterClass
def _iterClass(cls, prefix=''): """ Descend a Klein()'s url_map, and generate ConvertedRule() for each one """ iterableRules = [(prefix, cls, cls.app.url_map.iter_rules())] for prefix, currentClass, i in iter(iterableRules): for rule in i: converted = dumpRule(currentClass, rule,...
python
def _iterClass(cls, prefix=''): """ Descend a Klein()'s url_map, and generate ConvertedRule() for each one """ iterableRules = [(prefix, cls, cls.app.url_map.iter_rules())] for prefix, currentClass, i in iter(iterableRules): for rule in i: converted = dumpRule(currentClass, rule,...
[ "def", "_iterClass", "(", "cls", ",", "prefix", "=", "''", ")", ":", "iterableRules", "=", "[", "(", "prefix", ",", "cls", ",", "cls", ".", "app", ".", "url_map", ".", "iter_rules", "(", ")", ")", "]", "for", "prefix", ",", "currentClass", ",", "i"...
Descend a Klein()'s url_map, and generate ConvertedRule() for each one
[ "Descend", "a", "Klein", "()", "s", "url_map", "and", "generate", "ConvertedRule", "()", "for", "each", "one" ]
train
https://github.com/corydodt/Crosscap/blob/388a2ec36b8aa85e8f1ed692bb6e43474ba76c8e/crosscap/urltool.py#L24-L39
corydodt/Crosscap
crosscap/urltool.py
urltool
def urltool(classqname, filt, reverse): """ Dump all urls branching from a class as OpenAPI 3 documentation The class must be given as a FQPN which points to a Klein() instance. Apply optional [FILT] as a regular expression searching within urls. For example, to match all urls beginning with api, ...
python
def urltool(classqname, filt, reverse): """ Dump all urls branching from a class as OpenAPI 3 documentation The class must be given as a FQPN which points to a Klein() instance. Apply optional [FILT] as a regular expression searching within urls. For example, to match all urls beginning with api, ...
[ "def", "urltool", "(", "classqname", ",", "filt", ",", "reverse", ")", ":", "filt", "=", "re", ".", "compile", "(", "filt", "or", "'.*'", ")", "rootCls", "=", "namedAny", "(", "classqname", ")", "rules", "=", "list", "(", "_iterClass", "(", "rootCls", ...
Dump all urls branching from a class as OpenAPI 3 documentation The class must be given as a FQPN which points to a Klein() instance. Apply optional [FILT] as a regular expression searching within urls. For example, to match all urls beginning with api, you might use '^/api'
[ "Dump", "all", "urls", "branching", "from", "a", "class", "as", "OpenAPI", "3", "documentation" ]
train
https://github.com/corydodt/Crosscap/blob/388a2ec36b8aa85e8f1ed692bb6e43474ba76c8e/crosscap/urltool.py#L46-L75
corydodt/Crosscap
crosscap/urltool.py
dumpRule
def dumpRule(serviceCls, rule, prefix): """ Create an in-between representation of the rule, so we can eventually convert it to OpenAPIPathItem with OpenAPIOperation(s) """ rulePath = prefix + rule.rule rulePath = re.sub('/{2,}', '/', rulePath) cor = ConvertedRule( rulePath=rulePath...
python
def dumpRule(serviceCls, rule, prefix): """ Create an in-between representation of the rule, so we can eventually convert it to OpenAPIPathItem with OpenAPIOperation(s) """ rulePath = prefix + rule.rule rulePath = re.sub('/{2,}', '/', rulePath) cor = ConvertedRule( rulePath=rulePath...
[ "def", "dumpRule", "(", "serviceCls", ",", "rule", ",", "prefix", ")", ":", "rulePath", "=", "prefix", "+", "rule", ".", "rule", "rulePath", "=", "re", ".", "sub", "(", "'/{2,}'", ",", "'/'", ",", "rulePath", ")", "cor", "=", "ConvertedRule", "(", "r...
Create an in-between representation of the rule, so we can eventually convert it to OpenAPIPathItem with OpenAPIOperation(s)
[ "Create", "an", "in", "-", "between", "representation", "of", "the", "rule", "so", "we", "can", "eventually", "convert", "it", "to", "OpenAPIPathItem", "with", "OpenAPIOperation", "(", "s", ")" ]
train
https://github.com/corydodt/Crosscap/blob/388a2ec36b8aa85e8f1ed692bb6e43474ba76c8e/crosscap/urltool.py#L159-L188
corydodt/Crosscap
crosscap/urltool.py
literal_unicode_representer
def literal_unicode_representer(dumper, data): """ Use |- literal syntax for long strings """ if '\n' in data: return dumper.represent_scalar(u'tag:yaml.org,2002:str', data, style='|') else: return dumper.represent_scalar(u'tag:yaml.org,2002:str', data)
python
def literal_unicode_representer(dumper, data): """ Use |- literal syntax for long strings """ if '\n' in data: return dumper.represent_scalar(u'tag:yaml.org,2002:str', data, style='|') else: return dumper.represent_scalar(u'tag:yaml.org,2002:str', data)
[ "def", "literal_unicode_representer", "(", "dumper", ",", "data", ")", ":", "if", "'\\n'", "in", "data", ":", "return", "dumper", ".", "represent_scalar", "(", "u'tag:yaml.org,2002:str'", ",", "data", ",", "style", "=", "'|'", ")", "else", ":", "return", "du...
Use |- literal syntax for long strings
[ "Use", "|", "-", "literal", "syntax", "for", "long", "strings" ]
train
https://github.com/corydodt/Crosscap/blob/388a2ec36b8aa85e8f1ed692bb6e43474ba76c8e/crosscap/urltool.py#L191-L198
ramrod-project/database-brain
schema/brain/queries/decorators.py
wrap_job_cursor
def wrap_job_cursor(func_, *args, **kwargs): """ wraps a filter generator. Types should be appropriate before passed to rethinkdb somewhat specific to the _jobs_cursor function :param func_: <callable function> :param args: <must have at least 3 arguments> :param kwargs: :return: retur...
python
def wrap_job_cursor(func_, *args, **kwargs): """ wraps a filter generator. Types should be appropriate before passed to rethinkdb somewhat specific to the _jobs_cursor function :param func_: <callable function> :param args: <must have at least 3 arguments> :param kwargs: :return: retur...
[ "def", "wrap_job_cursor", "(", "func_", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "assert", "isinstance", "(", "args", "[", "0", "]", ",", "str", ")", "assert", "isinstance", "(", "args", "[", "1", "]", ",", "(", "str", ",", "type", "(...
wraps a filter generator. Types should be appropriate before passed to rethinkdb somewhat specific to the _jobs_cursor function :param func_: <callable function> :param args: <must have at least 3 arguments> :param kwargs: :return: returned value from func_
[ "wraps", "a", "filter", "generator", ".", "Types", "should", "be", "appropriate", "before", "passed", "to", "rethinkdb" ]
train
https://github.com/ramrod-project/database-brain/blob/b024cb44f34cabb9d80af38271ddb65c25767083/schema/brain/queries/decorators.py#L15-L32
ramrod-project/database-brain
schema/brain/queries/decorators.py
wrap_rethink_errors
def wrap_rethink_errors(func_, *args, **kwargs): """ Wraps rethinkdb specific errors as builtin/Brain errors :param func_: <function> to call :param args: <tuple> positional arguments :param kwargs: <dict> keyword arguments :return: inherits from the called function """ try: re...
python
def wrap_rethink_errors(func_, *args, **kwargs): """ Wraps rethinkdb specific errors as builtin/Brain errors :param func_: <function> to call :param args: <tuple> positional arguments :param kwargs: <dict> keyword arguments :return: inherits from the called function """ try: re...
[ "def", "wrap_rethink_errors", "(", "func_", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "try", ":", "return", "func_", "(", "*", "args", ",", "*", "*", "kwargs", ")", "except", "WRAP_RETHINK_ERRORS", "as", "reql_err", ":", "raise", "ValueError",...
Wraps rethinkdb specific errors as builtin/Brain errors :param func_: <function> to call :param args: <tuple> positional arguments :param kwargs: <dict> keyword arguments :return: inherits from the called function
[ "Wraps", "rethinkdb", "specific", "errors", "as", "builtin", "/", "Brain", "errors" ]
train
https://github.com/ramrod-project/database-brain/blob/b024cb44f34cabb9d80af38271ddb65c25767083/schema/brain/queries/decorators.py#L36-L48
ramrod-project/database-brain
schema/brain/queries/decorators.py
wrap_connection
def wrap_connection(func_, *args, **kwargs): """ conn (connection) must be the last positional argument in all wrapped functions :param func_: <function> to call :param args: <tuple> positional arguments :param kwargs: <dict> keyword arguments :return: """ if not args[-1]: ...
python
def wrap_connection(func_, *args, **kwargs): """ conn (connection) must be the last positional argument in all wrapped functions :param func_: <function> to call :param args: <tuple> positional arguments :param kwargs: <dict> keyword arguments :return: """ if not args[-1]: ...
[ "def", "wrap_connection", "(", "func_", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "args", "[", "-", "1", "]", ":", "new_args", "=", "list", "(", "args", ")", "new_args", "[", "-", "1", "]", "=", "connect", "(", ")", "arg...
conn (connection) must be the last positional argument in all wrapped functions :param func_: <function> to call :param args: <tuple> positional arguments :param kwargs: <dict> keyword arguments :return:
[ "conn", "(", "connection", ")", "must", "be", "the", "last", "positional", "argument", "in", "all", "wrapped", "functions" ]
train
https://github.com/ramrod-project/database-brain/blob/b024cb44f34cabb9d80af38271ddb65c25767083/schema/brain/queries/decorators.py#L96-L110
obiwanus/django-qurl
qurl/__init__.py
qurl
def qurl(url, add=None, exclude=None, remove=None): """ Returns the url with changed parameters """ urlp = list(urlparse(url)) qp = parse_qsl(urlp[4]) # Add parameters add = add if add else {} for name, value in add.items(): if isinstance(value, (list, tuple)): # App...
python
def qurl(url, add=None, exclude=None, remove=None): """ Returns the url with changed parameters """ urlp = list(urlparse(url)) qp = parse_qsl(urlp[4]) # Add parameters add = add if add else {} for name, value in add.items(): if isinstance(value, (list, tuple)): # App...
[ "def", "qurl", "(", "url", ",", "add", "=", "None", ",", "exclude", "=", "None", ",", "remove", "=", "None", ")", ":", "urlp", "=", "list", "(", "urlparse", "(", "url", ")", ")", "qp", "=", "parse_qsl", "(", "urlp", "[", "4", "]", ")", "# Add p...
Returns the url with changed parameters
[ "Returns", "the", "url", "with", "changed", "parameters" ]
train
https://github.com/obiwanus/django-qurl/blob/745992fc4241fd7a2f034c202f6fe05da7437683/qurl/__init__.py#L11-L45
pjuren/pyokit
src/pyokit/datastruct/read.py
clip_adaptor
def clip_adaptor(read, adaptor): """ Clip an adaptor sequence from this sequence. We assume it's in the 3' end. This is basically a convenience wrapper for clipThreePrime. It requires 8 out of 10 of the first bases in the adaptor sequence to match for clipping to occur. :param adaptor: sequence to look for...
python
def clip_adaptor(read, adaptor): """ Clip an adaptor sequence from this sequence. We assume it's in the 3' end. This is basically a convenience wrapper for clipThreePrime. It requires 8 out of 10 of the first bases in the adaptor sequence to match for clipping to occur. :param adaptor: sequence to look for...
[ "def", "clip_adaptor", "(", "read", ",", "adaptor", ")", ":", "missmatches", "=", "2", "adaptor", "=", "adaptor", ".", "truncate", "(", "10", ")", "read", ".", "clip_end", "(", "adaptor", ",", "len", "(", "adaptor", ")", "-", "missmatches", ")" ]
Clip an adaptor sequence from this sequence. We assume it's in the 3' end. This is basically a convenience wrapper for clipThreePrime. It requires 8 out of 10 of the first bases in the adaptor sequence to match for clipping to occur. :param adaptor: sequence to look for. We only use the first 10 bases; ...
[ "Clip", "an", "adaptor", "sequence", "from", "this", "sequence", ".", "We", "assume", "it", "s", "in", "the", "3", "end", ".", "This", "is", "basically", "a", "convenience", "wrapper", "for", "clipThreePrime", ".", "It", "requires", "8", "out", "of", "10...
train
https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/datastruct/read.py#L276-L288
pjuren/pyokit
src/pyokit/datastruct/read.py
contains_adaptor
def contains_adaptor(read, adaptor): """ Check whether this sequence contains adaptor contamination. If it exists, we assume it's in the 3' end. This function requires 8 out of 10 of the first bases in the adaptor sequence to match for an occurrence to be reported. :param adaptor: sequence to look for. We ...
python
def contains_adaptor(read, adaptor): """ Check whether this sequence contains adaptor contamination. If it exists, we assume it's in the 3' end. This function requires 8 out of 10 of the first bases in the adaptor sequence to match for an occurrence to be reported. :param adaptor: sequence to look for. We ...
[ "def", "contains_adaptor", "(", "read", ",", "adaptor", ")", ":", "origSeq", "=", "read", ".", "sequenceData", "clip_adaptor", "(", "read", ",", "adaptor", ")", "res", "=", "False", "if", "read", ".", "sequenceData", "!=", "origSeq", ":", "res", "=", "Tr...
Check whether this sequence contains adaptor contamination. If it exists, we assume it's in the 3' end. This function requires 8 out of 10 of the first bases in the adaptor sequence to match for an occurrence to be reported. :param adaptor: sequence to look for. We only use first 10 bases; must be ...
[ "Check", "whether", "this", "sequence", "contains", "adaptor", "contamination", ".", "If", "it", "exists", "we", "assume", "it", "s", "in", "the", "3", "end", ".", "This", "function", "requires", "8", "out", "of", "10", "of", "the", "first", "bases", "in...
train
https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/datastruct/read.py#L291-L308
pjuren/pyokit
src/pyokit/datastruct/read.py
NGSRead.truncate
def truncate(self, size): """ truncate this fastqSequence in-place so it is only <size> nucleotides long :param size: the number of nucleotides to truncate to. """ if size > len(self): raise NGSReadError("Trying to truncate NGS read to size " + str(size) + "...
python
def truncate(self, size): """ truncate this fastqSequence in-place so it is only <size> nucleotides long :param size: the number of nucleotides to truncate to. """ if size > len(self): raise NGSReadError("Trying to truncate NGS read to size " + str(size) + "...
[ "def", "truncate", "(", "self", ",", "size", ")", ":", "if", "size", ">", "len", "(", "self", ")", ":", "raise", "NGSReadError", "(", "\"Trying to truncate NGS read to size \"", "+", "str", "(", "size", ")", "+", "\", but read is only \"", "+", "str", "(", ...
truncate this fastqSequence in-place so it is only <size> nucleotides long :param size: the number of nucleotides to truncate to.
[ "truncate", "this", "fastqSequence", "in", "-", "place", "so", "it", "is", "only", "<size", ">", "nucleotides", "long" ]
train
https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/datastruct/read.py#L120-L134
pjuren/pyokit
src/pyokit/datastruct/read.py
NGSRead.trimRight
def trimRight(self, amount): """ Trim this fastqSequence in-place by removing <amount> nucleotides from the 3' end (right end). :param amount: the number of nucleotides to trim from the right-side of this sequence. """ if amount == 0: return self.sequenceDat...
python
def trimRight(self, amount): """ Trim this fastqSequence in-place by removing <amount> nucleotides from the 3' end (right end). :param amount: the number of nucleotides to trim from the right-side of this sequence. """ if amount == 0: return self.sequenceDat...
[ "def", "trimRight", "(", "self", ",", "amount", ")", ":", "if", "amount", "==", "0", ":", "return", "self", ".", "sequenceData", "=", "self", ".", "sequenceData", "[", ":", "-", "amount", "]", "self", ".", "seq_qual", "=", "self", ".", "seq_qual", "[...
Trim this fastqSequence in-place by removing <amount> nucleotides from the 3' end (right end). :param amount: the number of nucleotides to trim from the right-side of this sequence.
[ "Trim", "this", "fastqSequence", "in", "-", "place", "by", "removing", "<amount", ">", "nucleotides", "from", "the", "3", "end", "(", "right", "end", ")", "." ]
train
https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/datastruct/read.py#L136-L147
pjuren/pyokit
src/pyokit/datastruct/read.py
NGSRead.trimLeft
def trimLeft(self, amount): """ Trim this fastqSequence in-place by removing <amount> nucleotides from the 5' end (left end). :param amount: the number of nucleotides to trim from the left-side of this sequence. """ if amount == 0: return self.sequenceData =...
python
def trimLeft(self, amount): """ Trim this fastqSequence in-place by removing <amount> nucleotides from the 5' end (left end). :param amount: the number of nucleotides to trim from the left-side of this sequence. """ if amount == 0: return self.sequenceData =...
[ "def", "trimLeft", "(", "self", ",", "amount", ")", ":", "if", "amount", "==", "0", ":", "return", "self", ".", "sequenceData", "=", "self", ".", "sequenceData", "[", "amount", ":", "]", "self", ".", "sequenceQual", "=", "self", ".", "sequenceQual", "[...
Trim this fastqSequence in-place by removing <amount> nucleotides from the 5' end (left end). :param amount: the number of nucleotides to trim from the left-side of this sequence.
[ "Trim", "this", "fastqSequence", "in", "-", "place", "by", "removing", "<amount", ">", "nucleotides", "from", "the", "5", "end", "(", "left", "end", ")", "." ]
train
https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/datastruct/read.py#L149-L160
pjuren/pyokit
src/pyokit/datastruct/read.py
NGSRead.getRelativeQualityScore
def getRelativeQualityScore(self, i, score_type="ILLUMINA_PHRED_PLUS_33"): """ Get the realtive quality score (i.e. the phred quality score) for a given base. :raise: NGSReadError if the index is less than 0 or more than l-1 where l is the length of the read; NGSReadError if the encoded qua...
python
def getRelativeQualityScore(self, i, score_type="ILLUMINA_PHRED_PLUS_33"): """ Get the realtive quality score (i.e. the phred quality score) for a given base. :raise: NGSReadError if the index is less than 0 or more than l-1 where l is the length of the read; NGSReadError if the encoded qua...
[ "def", "getRelativeQualityScore", "(", "self", ",", "i", ",", "score_type", "=", "\"ILLUMINA_PHRED_PLUS_33\"", ")", ":", "# error out if no quality string, or index is out of range", "if", "self", ".", "seq_qual", "is", "None", ":", "raise", "NGSReadError", "(", "\"Erro...
Get the realtive quality score (i.e. the phred quality score) for a given base. :raise: NGSReadError if the index is less than 0 or more than l-1 where l is the length of the read; NGSReadError if the encoded quality score at the given location is outside the expected range; ...
[ "Get", "the", "realtive", "quality", "score", "(", "i", ".", "e", ".", "the", "phred", "quality", "score", ")", "for", "a", "given", "base", "." ]
train
https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/datastruct/read.py#L162-L190
pjuren/pyokit
src/pyokit/datastruct/read.py
NGSRead.reverse_complement
def reverse_complement(self, is_RNA=None): """ Reverse complement this read in-place. """ Sequence.reverseComplement(self, is_RNA) self.seq_qual = self.seq_qual[::-1]
python
def reverse_complement(self, is_RNA=None): """ Reverse complement this read in-place. """ Sequence.reverseComplement(self, is_RNA) self.seq_qual = self.seq_qual[::-1]
[ "def", "reverse_complement", "(", "self", ",", "is_RNA", "=", "None", ")", ":", "Sequence", ".", "reverseComplement", "(", "self", ",", "is_RNA", ")", "self", ".", "seq_qual", "=", "self", ".", "seq_qual", "[", ":", ":", "-", "1", "]" ]
Reverse complement this read in-place.
[ "Reverse", "complement", "this", "read", "in", "-", "place", "." ]
train
https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/datastruct/read.py#L192-L197
pjuren/pyokit
src/pyokit/datastruct/read.py
NGSRead.split
def split(self, point=None): """ Split this read into two halves. Original sequence is left unaltered. The name of the resultant reads will have '.1' and '.2' appended to the name from the original read. :param point: the point (index, starting from 0) at which to split this read...
python
def split(self, point=None): """ Split this read into two halves. Original sequence is left unaltered. The name of the resultant reads will have '.1' and '.2' appended to the name from the original read. :param point: the point (index, starting from 0) at which to split this read...
[ "def", "split", "(", "self", ",", "point", "=", "None", ")", ":", "if", "point", "is", "None", ":", "point", "=", "len", "(", "self", ")", "/", "2", "if", "point", "<", "0", ":", "raise", "NGSReadError", "(", "\"Cannot split read at index less than 0 \""...
Split this read into two halves. Original sequence is left unaltered. The name of the resultant reads will have '.1' and '.2' appended to the name from the original read. :param point: the point (index, starting from 0) at which to split this read -- everything before this index will be ...
[ "Split", "this", "read", "into", "two", "halves", ".", "Original", "sequence", "is", "left", "unaltered", "." ]
train
https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/datastruct/read.py#L199-L230
pjuren/pyokit
src/pyokit/datastruct/read.py
NGSRead.merge
def merge(self, other, forceMerge=False): """ Merge two reads by concatenating their sequence data and their quality data (<self> first, then <other>); <self> and <other> must have the same sequence name. A new merged FastqSequence object is returned; <Self> and <other> are left unaltered. ...
python
def merge(self, other, forceMerge=False): """ Merge two reads by concatenating their sequence data and their quality data (<self> first, then <other>); <self> and <other> must have the same sequence name. A new merged FastqSequence object is returned; <Self> and <other> are left unaltered. ...
[ "def", "merge", "(", "self", ",", "other", ",", "forceMerge", "=", "False", ")", ":", "if", "self", ".", "sequenceName", "!=", "other", ".", "sequenceName", "and", "not", "forceMerge", ":", "raise", "NGSReadError", "(", "\"cannot merge \"", "+", "self", "....
Merge two reads by concatenating their sequence data and their quality data (<self> first, then <other>); <self> and <other> must have the same sequence name. A new merged FastqSequence object is returned; <Self> and <other> are left unaltered. :param other: the other sequence to merge with sel...
[ "Merge", "two", "reads", "by", "concatenating", "their", "sequence", "data", "and", "their", "quality", "data", "(", "<self", ">", "first", "then", "<other", ">", ")", ";", "<self", ">", "and", "<other", ">", "must", "have", "the", "same", "sequence", "n...
train
https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/datastruct/read.py#L232-L256
pjuren/pyokit
src/pyokit/datastruct/read.py
NGSRead.to_fastq_str
def to_fastq_str(self): """ :return: string representation of this NGS read in FastQ format """ return "@" + self.name + "\n" + self.sequenceData +\ "\n" + "+" + self.name + "\n" + self.seq_qual
python
def to_fastq_str(self): """ :return: string representation of this NGS read in FastQ format """ return "@" + self.name + "\n" + self.sequenceData +\ "\n" + "+" + self.name + "\n" + self.seq_qual
[ "def", "to_fastq_str", "(", "self", ")", ":", "return", "\"@\"", "+", "self", ".", "name", "+", "\"\\n\"", "+", "self", ".", "sequenceData", "+", "\"\\n\"", "+", "\"+\"", "+", "self", ".", "name", "+", "\"\\n\"", "+", "self", ".", "seq_qual" ]
:return: string representation of this NGS read in FastQ format
[ ":", "return", ":", "string", "representation", "of", "this", "NGS", "read", "in", "FastQ", "format" ]
train
https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/datastruct/read.py#L264-L269
noxdafox/clipspy
clips/classes.py
ClassSlot.public
def public(self): """True if the Slot is public.""" return bool(lib.EnvSlotPublicP(self._env, self._cls, self._name))
python
def public(self): """True if the Slot is public.""" return bool(lib.EnvSlotPublicP(self._env, self._cls, self._name))
[ "def", "public", "(", "self", ")", ":", "return", "bool", "(", "lib", ".", "EnvSlotPublicP", "(", "self", ".", "_env", ",", "self", ".", "_cls", ",", "self", ".", "_name", ")", ")" ]
True if the Slot is public.
[ "True", "if", "the", "Slot", "is", "public", "." ]
train
https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L441-L443
noxdafox/clipspy
clips/classes.py
ClassSlot.initializable
def initializable(self): """True if the Slot is initializable.""" return bool(lib.EnvSlotInitableP(self._env, self._cls, self._name))
python
def initializable(self): """True if the Slot is initializable.""" return bool(lib.EnvSlotInitableP(self._env, self._cls, self._name))
[ "def", "initializable", "(", "self", ")", ":", "return", "bool", "(", "lib", ".", "EnvSlotInitableP", "(", "self", ".", "_env", ",", "self", ".", "_cls", ",", "self", ".", "_name", ")", ")" ]
True if the Slot is initializable.
[ "True", "if", "the", "Slot", "is", "initializable", "." ]
train
https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L446-L448
noxdafox/clipspy
clips/classes.py
ClassSlot.writable
def writable(self): """True if the Slot is writable.""" return bool(lib.EnvSlotWritableP(self._env, self._cls, self._name))
python
def writable(self): """True if the Slot is writable.""" return bool(lib.EnvSlotWritableP(self._env, self._cls, self._name))
[ "def", "writable", "(", "self", ")", ":", "return", "bool", "(", "lib", ".", "EnvSlotWritableP", "(", "self", ".", "_env", ",", "self", ".", "_cls", ",", "self", ".", "_name", ")", ")" ]
True if the Slot is writable.
[ "True", "if", "the", "Slot", "is", "writable", "." ]
train
https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L451-L453
noxdafox/clipspy
clips/classes.py
ClassSlot.accessible
def accessible(self): """True if the Slot is directly accessible.""" return bool(lib.EnvSlotDirectAccessP(self._env, self._cls, self._name))
python
def accessible(self): """True if the Slot is directly accessible.""" return bool(lib.EnvSlotDirectAccessP(self._env, self._cls, self._name))
[ "def", "accessible", "(", "self", ")", ":", "return", "bool", "(", "lib", ".", "EnvSlotDirectAccessP", "(", "self", ".", "_env", ",", "self", ".", "_cls", ",", "self", ".", "_name", ")", ")" ]
True if the Slot is directly accessible.
[ "True", "if", "the", "Slot", "is", "directly", "accessible", "." ]
train
https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L456-L458
noxdafox/clipspy
clips/classes.py
ClassSlot.types
def types(self): """A tuple containing the value types for this Slot. The Python equivalent of the CLIPS slot-types function. """ data = clips.data.DataObject(self._env) lib.EnvSlotTypes(self._env, self._cls, self._name, data.byref) return tuple(data.value) if isinsta...
python
def types(self): """A tuple containing the value types for this Slot. The Python equivalent of the CLIPS slot-types function. """ data = clips.data.DataObject(self._env) lib.EnvSlotTypes(self._env, self._cls, self._name, data.byref) return tuple(data.value) if isinsta...
[ "def", "types", "(", "self", ")", ":", "data", "=", "clips", ".", "data", ".", "DataObject", "(", "self", ".", "_env", ")", "lib", ".", "EnvSlotTypes", "(", "self", ".", "_env", ",", "self", ".", "_cls", ",", "self", ".", "_name", ",", "data", "....
A tuple containing the value types for this Slot. The Python equivalent of the CLIPS slot-types function.
[ "A", "tuple", "containing", "the", "value", "types", "for", "this", "Slot", "." ]
train
https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L461-L471
noxdafox/clipspy
clips/classes.py
ClassSlot.sources
def sources(self): """A tuple containing the names of the Class sources for this Slot. The Python equivalent of the CLIPS slot-sources function. """ data = clips.data.DataObject(self._env) lib.EnvSlotSources(self._env, self._cls, self._name, data.byref) return tuple(d...
python
def sources(self): """A tuple containing the names of the Class sources for this Slot. The Python equivalent of the CLIPS slot-sources function. """ data = clips.data.DataObject(self._env) lib.EnvSlotSources(self._env, self._cls, self._name, data.byref) return tuple(d...
[ "def", "sources", "(", "self", ")", ":", "data", "=", "clips", ".", "data", ".", "DataObject", "(", "self", ".", "_env", ")", "lib", ".", "EnvSlotSources", "(", "self", ".", "_env", ",", "self", ".", "_cls", ",", "self", ".", "_name", ",", "data", ...
A tuple containing the names of the Class sources for this Slot. The Python equivalent of the CLIPS slot-sources function.
[ "A", "tuple", "containing", "the", "names", "of", "the", "Class", "sources", "for", "this", "Slot", "." ]
train
https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L474-L484
noxdafox/clipspy
clips/classes.py
ClassSlot.range
def range(self): """A tuple containing the numeric range for this Slot. The Python equivalent of the CLIPS slot-range function. """ data = clips.data.DataObject(self._env) lib.EnvSlotRange(self._env, self._cls, self._name, data.byref) return tuple(data.value) if isins...
python
def range(self): """A tuple containing the numeric range for this Slot. The Python equivalent of the CLIPS slot-range function. """ data = clips.data.DataObject(self._env) lib.EnvSlotRange(self._env, self._cls, self._name, data.byref) return tuple(data.value) if isins...
[ "def", "range", "(", "self", ")", ":", "data", "=", "clips", ".", "data", ".", "DataObject", "(", "self", ".", "_env", ")", "lib", ".", "EnvSlotRange", "(", "self", ".", "_env", ",", "self", ".", "_cls", ",", "self", ".", "_name", ",", "data", "....
A tuple containing the numeric range for this Slot. The Python equivalent of the CLIPS slot-range function.
[ "A", "tuple", "containing", "the", "numeric", "range", "for", "this", "Slot", "." ]
train
https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L487-L497
noxdafox/clipspy
clips/classes.py
ClassSlot.facets
def facets(self): """A tuple containing the facets for this Slot. The Python equivalent of the CLIPS slot-facets function. """ data = clips.data.DataObject(self._env) lib.EnvSlotFacets(self._env, self._cls, self._name, data.byref) return tuple(data.value) if isinstanc...
python
def facets(self): """A tuple containing the facets for this Slot. The Python equivalent of the CLIPS slot-facets function. """ data = clips.data.DataObject(self._env) lib.EnvSlotFacets(self._env, self._cls, self._name, data.byref) return tuple(data.value) if isinstanc...
[ "def", "facets", "(", "self", ")", ":", "data", "=", "clips", ".", "data", ".", "DataObject", "(", "self", ".", "_env", ")", "lib", ".", "EnvSlotFacets", "(", "self", ".", "_env", ",", "self", ".", "_cls", ",", "self", ".", "_name", ",", "data", ...
A tuple containing the facets for this Slot. The Python equivalent of the CLIPS slot-facets function.
[ "A", "tuple", "containing", "the", "facets", "for", "this", "Slot", "." ]
train
https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L500-L510
noxdafox/clipspy
clips/classes.py
ClassSlot.cardinality
def cardinality(self): """A tuple containing the cardinality for this Slot. The Python equivalent of the CLIPS slot-cardinality function. """ data = clips.data.DataObject(self._env) lib.EnvSlotCardinality( self._env, self._cls, self._name, data.byref) retu...
python
def cardinality(self): """A tuple containing the cardinality for this Slot. The Python equivalent of the CLIPS slot-cardinality function. """ data = clips.data.DataObject(self._env) lib.EnvSlotCardinality( self._env, self._cls, self._name, data.byref) retu...
[ "def", "cardinality", "(", "self", ")", ":", "data", "=", "clips", ".", "data", ".", "DataObject", "(", "self", ".", "_env", ")", "lib", ".", "EnvSlotCardinality", "(", "self", ".", "_env", ",", "self", ".", "_cls", ",", "self", ".", "_name", ",", ...
A tuple containing the cardinality for this Slot. The Python equivalent of the CLIPS slot-cardinality function.
[ "A", "tuple", "containing", "the", "cardinality", "for", "this", "Slot", "." ]
train
https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L513-L524
noxdafox/clipspy
clips/classes.py
ClassSlot.default_value
def default_value(self): """The default value for this Slot. The Python equivalent of the CLIPS slot-default-value function. """ data = clips.data.DataObject(self._env) lib.EnvSlotDefaultValue( self._env, self._cls, self._name, data.byref) return data.valu...
python
def default_value(self): """The default value for this Slot. The Python equivalent of the CLIPS slot-default-value function. """ data = clips.data.DataObject(self._env) lib.EnvSlotDefaultValue( self._env, self._cls, self._name, data.byref) return data.valu...
[ "def", "default_value", "(", "self", ")", ":", "data", "=", "clips", ".", "data", ".", "DataObject", "(", "self", ".", "_env", ")", "lib", ".", "EnvSlotDefaultValue", "(", "self", ".", "_env", ",", "self", ".", "_cls", ",", "self", ".", "_name", ",",...
The default value for this Slot. The Python equivalent of the CLIPS slot-default-value function.
[ "The", "default", "value", "for", "this", "Slot", "." ]
train
https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L527-L538
noxdafox/clipspy
clips/classes.py
ClassSlot.allowed_values
def allowed_values(self): """A tuple containing the allowed values for this Slot. The Python equivalent of the CLIPS slot-allowed-values function. """ data = clips.data.DataObject(self._env) lib.EnvSlotAllowedValues( self._env, self._cls, self._name, data.byref) ...
python
def allowed_values(self): """A tuple containing the allowed values for this Slot. The Python equivalent of the CLIPS slot-allowed-values function. """ data = clips.data.DataObject(self._env) lib.EnvSlotAllowedValues( self._env, self._cls, self._name, data.byref) ...
[ "def", "allowed_values", "(", "self", ")", ":", "data", "=", "clips", ".", "data", ".", "DataObject", "(", "self", ".", "_env", ")", "lib", ".", "EnvSlotAllowedValues", "(", "self", ".", "_env", ",", "self", ".", "_cls", ",", "self", ".", "_name", ",...
A tuple containing the allowed values for this Slot. The Python equivalent of the CLIPS slot-allowed-values function.
[ "A", "tuple", "containing", "the", "allowed", "values", "for", "this", "Slot", "." ]
train
https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L541-L552
noxdafox/clipspy
clips/classes.py
ClassSlot.allowed_classes
def allowed_classes(self): """Iterate over the allowed classes for this slot. The Python equivalent of the CLIPS slot-allowed-classes function. """ data = clips.data.DataObject(self._env) lib.EnvSlotAllowedClasses( self._env, self._cls, self._name, data.byref) ...
python
def allowed_classes(self): """Iterate over the allowed classes for this slot. The Python equivalent of the CLIPS slot-allowed-classes function. """ data = clips.data.DataObject(self._env) lib.EnvSlotAllowedClasses( self._env, self._cls, self._name, data.byref) ...
[ "def", "allowed_classes", "(", "self", ")", ":", "data", "=", "clips", ".", "data", ".", "DataObject", "(", "self", ".", "_env", ")", "lib", ".", "EnvSlotAllowedClasses", "(", "self", ".", "_env", ",", "self", ".", "_cls", ",", "self", ".", "_name", ...
Iterate over the allowed classes for this slot. The Python equivalent of the CLIPS slot-allowed-classes function.
[ "Iterate", "over", "the", "allowed", "classes", "for", "this", "slot", "." ]
train
https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L554-L567
noxdafox/clipspy
clips/classes.py
Instance.name
def name(self): """Instance name.""" return ffi.string(lib.EnvGetInstanceName(self._env, self._ist)).decode()
python
def name(self): """Instance name.""" return ffi.string(lib.EnvGetInstanceName(self._env, self._ist)).decode()
[ "def", "name", "(", "self", ")", ":", "return", "ffi", ".", "string", "(", "lib", ".", "EnvGetInstanceName", "(", "self", ".", "_env", ",", "self", ".", "_ist", ")", ")", ".", "decode", "(", ")" ]
Instance name.
[ "Instance", "name", "." ]
train
https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L627-L629
noxdafox/clipspy
clips/classes.py
Instance.instance_class
def instance_class(self): """Instance class.""" return Class(self._env, lib.EnvGetInstanceClass(self._env, self._ist))
python
def instance_class(self): """Instance class.""" return Class(self._env, lib.EnvGetInstanceClass(self._env, self._ist))
[ "def", "instance_class", "(", "self", ")", ":", "return", "Class", "(", "self", ".", "_env", ",", "lib", ".", "EnvGetInstanceClass", "(", "self", ".", "_env", ",", "self", ".", "_ist", ")", ")" ]
Instance class.
[ "Instance", "class", "." ]
train
https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L632-L634
noxdafox/clipspy
clips/classes.py
Instance.send
def send(self, message, arguments=None): """Send a message to the Instance. Message arguments must be provided as a string. """ output = clips.data.DataObject(self._env) instance = clips.data.DataObject( self._env, dtype=CLIPSType.INSTANCE_ADDRESS) instance....
python
def send(self, message, arguments=None): """Send a message to the Instance. Message arguments must be provided as a string. """ output = clips.data.DataObject(self._env) instance = clips.data.DataObject( self._env, dtype=CLIPSType.INSTANCE_ADDRESS) instance....
[ "def", "send", "(", "self", ",", "message", ",", "arguments", "=", "None", ")", ":", "output", "=", "clips", ".", "data", ".", "DataObject", "(", "self", ".", "_env", ")", "instance", "=", "clips", ".", "data", ".", "DataObject", "(", "self", ".", ...
Send a message to the Instance. Message arguments must be provided as a string.
[ "Send", "a", "message", "to", "the", "Instance", "." ]
train
https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L636-L652
noxdafox/clipspy
clips/classes.py
Instance.delete
def delete(self): """Delete the instance.""" if lib.EnvDeleteInstance(self._env, self._ist) != 1: raise CLIPSError(self._env)
python
def delete(self): """Delete the instance.""" if lib.EnvDeleteInstance(self._env, self._ist) != 1: raise CLIPSError(self._env)
[ "def", "delete", "(", "self", ")", ":", "if", "lib", ".", "EnvDeleteInstance", "(", "self", ".", "_env", ",", "self", ".", "_ist", ")", "!=", "1", ":", "raise", "CLIPSError", "(", "self", ".", "_env", ")" ]
Delete the instance.
[ "Delete", "the", "instance", "." ]
train
https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L654-L657
noxdafox/clipspy
clips/classes.py
Instance.unmake
def unmake(self): """This method is equivalent to delete except that it uses message-passing instead of directly deleting the instance. """ if lib.EnvUnmakeInstance(self._env, self._ist) != 1: raise CLIPSError(self._env)
python
def unmake(self): """This method is equivalent to delete except that it uses message-passing instead of directly deleting the instance. """ if lib.EnvUnmakeInstance(self._env, self._ist) != 1: raise CLIPSError(self._env)
[ "def", "unmake", "(", "self", ")", ":", "if", "lib", ".", "EnvUnmakeInstance", "(", "self", ".", "_env", ",", "self", ".", "_ist", ")", "!=", "1", ":", "raise", "CLIPSError", "(", "self", ".", "_env", ")" ]
This method is equivalent to delete except that it uses message-passing instead of directly deleting the instance.
[ "This", "method", "is", "equivalent", "to", "delete", "except", "that", "it", "uses", "message", "-", "passing", "instead", "of", "directly", "deleting", "the", "instance", "." ]
train
https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L659-L665
noxdafox/clipspy
clips/classes.py
MessageHandler.name
def name(self): """MessageHandler name.""" return ffi.string(lib.EnvGetDefmessageHandlerName( self._env, self._cls, self._idx)).decode()
python
def name(self): """MessageHandler name.""" return ffi.string(lib.EnvGetDefmessageHandlerName( self._env, self._cls, self._idx)).decode()
[ "def", "name", "(", "self", ")", ":", "return", "ffi", ".", "string", "(", "lib", ".", "EnvGetDefmessageHandlerName", "(", "self", ".", "_env", ",", "self", ".", "_cls", ",", "self", ".", "_idx", ")", ")", ".", "decode", "(", ")" ]
MessageHandler name.
[ "MessageHandler", "name", "." ]
train
https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L700-L703
noxdafox/clipspy
clips/classes.py
MessageHandler.type
def type(self): """MessageHandler type.""" return ffi.string(lib.EnvGetDefmessageHandlerType( self._env, self._cls, self._idx)).decode()
python
def type(self): """MessageHandler type.""" return ffi.string(lib.EnvGetDefmessageHandlerType( self._env, self._cls, self._idx)).decode()
[ "def", "type", "(", "self", ")", ":", "return", "ffi", ".", "string", "(", "lib", ".", "EnvGetDefmessageHandlerType", "(", "self", ".", "_env", ",", "self", ".", "_cls", ",", "self", ".", "_idx", ")", ")", ".", "decode", "(", ")" ]
MessageHandler type.
[ "MessageHandler", "type", "." ]
train
https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L706-L709
noxdafox/clipspy
clips/classes.py
MessageHandler.watch
def watch(self): """True if the MessageHandler is being watched.""" return bool(lib.EnvGetDefmessageHandlerWatch( self._env, self._cls, self._idx))
python
def watch(self): """True if the MessageHandler is being watched.""" return bool(lib.EnvGetDefmessageHandlerWatch( self._env, self._cls, self._idx))
[ "def", "watch", "(", "self", ")", ":", "return", "bool", "(", "lib", ".", "EnvGetDefmessageHandlerWatch", "(", "self", ".", "_env", ",", "self", ".", "_cls", ",", "self", ".", "_idx", ")", ")" ]
True if the MessageHandler is being watched.
[ "True", "if", "the", "MessageHandler", "is", "being", "watched", "." ]
train
https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L712-L715
noxdafox/clipspy
clips/classes.py
MessageHandler.watch
def watch(self, flag): """True if the MessageHandler is being watched.""" lib.EnvSetDefmessageHandlerWatch( self._env, int(flag), self._cls, self._idx)
python
def watch(self, flag): """True if the MessageHandler is being watched.""" lib.EnvSetDefmessageHandlerWatch( self._env, int(flag), self._cls, self._idx)
[ "def", "watch", "(", "self", ",", "flag", ")", ":", "lib", ".", "EnvSetDefmessageHandlerWatch", "(", "self", ".", "_env", ",", "int", "(", "flag", ")", ",", "self", ".", "_cls", ",", "self", ".", "_idx", ")" ]
True if the MessageHandler is being watched.
[ "True", "if", "the", "MessageHandler", "is", "being", "watched", "." ]
train
https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L718-L721
noxdafox/clipspy
clips/classes.py
MessageHandler.deletable
def deletable(self): """True if the MessageHandler can be deleted.""" return bool(lib.EnvIsDefmessageHandlerDeletable( self._env, self._cls, self._idx))
python
def deletable(self): """True if the MessageHandler can be deleted.""" return bool(lib.EnvIsDefmessageHandlerDeletable( self._env, self._cls, self._idx))
[ "def", "deletable", "(", "self", ")", ":", "return", "bool", "(", "lib", ".", "EnvIsDefmessageHandlerDeletable", "(", "self", ".", "_env", ",", "self", ".", "_cls", ",", "self", ".", "_idx", ")", ")" ]
True if the MessageHandler can be deleted.
[ "True", "if", "the", "MessageHandler", "can", "be", "deleted", "." ]
train
https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L724-L727