repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
fredrike/pypoint
pypoint/__init__.py
PointSession.read_sensor
def read_sensor(self, device_id, sensor_uri): """Return sensor value based on sensor_uri.""" url = MINUT_DEVICES_URL + "/{device_id}/{sensor_uri}".format( device_id=device_id, sensor_uri=sensor_uri) res = self._request(url, request_type='GET', data={'limit': 1}) if not res.ge...
python
def read_sensor(self, device_id, sensor_uri): """Return sensor value based on sensor_uri.""" url = MINUT_DEVICES_URL + "/{device_id}/{sensor_uri}".format( device_id=device_id, sensor_uri=sensor_uri) res = self._request(url, request_type='GET', data={'limit': 1}) if not res.ge...
[ "def", "read_sensor", "(", "self", ",", "device_id", ",", "sensor_uri", ")", ":", "url", "=", "MINUT_DEVICES_URL", "+", "\"/{device_id}/{sensor_uri}\"", ".", "format", "(", "device_id", "=", "device_id", ",", "sensor_uri", "=", "sensor_uri", ")", "res", "=", "...
Return sensor value based on sensor_uri.
[ "Return", "sensor", "value", "based", "on", "sensor_uri", "." ]
b5c9a701d2b7e24d796aa7f8c410360b61d8ec8a
https://github.com/fredrike/pypoint/blob/b5c9a701d2b7e24d796aa7f8c410360b61d8ec8a/pypoint/__init__.py#L111-L118
train
fredrike/pypoint
pypoint/__init__.py
PointSession._register_webhook
def _register_webhook(self, webhook_url, events): """Register webhook.""" response = self._request( MINUT_WEBHOOKS_URL, request_type='POST', json={ 'url': webhook_url, 'events': events, }, ) return response
python
def _register_webhook(self, webhook_url, events): """Register webhook.""" response = self._request( MINUT_WEBHOOKS_URL, request_type='POST', json={ 'url': webhook_url, 'events': events, }, ) return response
[ "def", "_register_webhook", "(", "self", ",", "webhook_url", ",", "events", ")", ":", "response", "=", "self", ".", "_request", "(", "MINUT_WEBHOOKS_URL", ",", "request_type", "=", "'POST'", ",", "json", "=", "{", "'url'", ":", "webhook_url", ",", "'events'"...
Register webhook.
[ "Register", "webhook", "." ]
b5c9a701d2b7e24d796aa7f8c410360b61d8ec8a
https://github.com/fredrike/pypoint/blob/b5c9a701d2b7e24d796aa7f8c410360b61d8ec8a/pypoint/__init__.py#L129-L139
train
fredrike/pypoint
pypoint/__init__.py
PointSession.remove_webhook
def remove_webhook(self): """Remove webhook.""" if self._webhook.get('hook_id'): self._request( "{}/{}".format(MINUT_WEBHOOKS_URL, self._webhook['hook_id']), request_type='DELETE', )
python
def remove_webhook(self): """Remove webhook.""" if self._webhook.get('hook_id'): self._request( "{}/{}".format(MINUT_WEBHOOKS_URL, self._webhook['hook_id']), request_type='DELETE', )
[ "def", "remove_webhook", "(", "self", ")", ":", "if", "self", ".", "_webhook", ".", "get", "(", "'hook_id'", ")", ":", "self", ".", "_request", "(", "\"{}/{}\"", ".", "format", "(", "MINUT_WEBHOOKS_URL", ",", "self", ".", "_webhook", "[", "'hook_id'", "]...
Remove webhook.
[ "Remove", "webhook", "." ]
b5c9a701d2b7e24d796aa7f8c410360b61d8ec8a
https://github.com/fredrike/pypoint/blob/b5c9a701d2b7e24d796aa7f8c410360b61d8ec8a/pypoint/__init__.py#L141-L147
train
fredrike/pypoint
pypoint/__init__.py
PointSession.update_webhook
def update_webhook(self, webhook_url, webhook_id, events=None): """Register webhook (if it doesn't exit).""" hooks = self._request(MINUT_WEBHOOKS_URL, request_type='GET')['hooks'] try: self._webhook = next( hook for hook in hooks if hook['url'] == webhook_url) ...
python
def update_webhook(self, webhook_url, webhook_id, events=None): """Register webhook (if it doesn't exit).""" hooks = self._request(MINUT_WEBHOOKS_URL, request_type='GET')['hooks'] try: self._webhook = next( hook for hook in hooks if hook['url'] == webhook_url) ...
[ "def", "update_webhook", "(", "self", ",", "webhook_url", ",", "webhook_id", ",", "events", "=", "None", ")", ":", "hooks", "=", "self", ".", "_request", "(", "MINUT_WEBHOOKS_URL", ",", "request_type", "=", "'GET'", ")", "[", "'hooks'", "]", "try", ":", ...
Register webhook (if it doesn't exit).
[ "Register", "webhook", "(", "if", "it", "doesn", "t", "exit", ")", "." ]
b5c9a701d2b7e24d796aa7f8c410360b61d8ec8a
https://github.com/fredrike/pypoint/blob/b5c9a701d2b7e24d796aa7f8c410360b61d8ec8a/pypoint/__init__.py#L149-L161
train
fredrike/pypoint
pypoint/__init__.py
PointSession.update
def update(self): """Update all devices from server.""" with self._lock: devices = self._request_devices(MINUT_DEVICES_URL, 'devices') if devices: self._state = { device['device_id']: device for device in devices ...
python
def update(self): """Update all devices from server.""" with self._lock: devices = self._request_devices(MINUT_DEVICES_URL, 'devices') if devices: self._state = { device['device_id']: device for device in devices ...
[ "def", "update", "(", "self", ")", ":", "with", "self", ".", "_lock", ":", "devices", "=", "self", ".", "_request_devices", "(", "MINUT_DEVICES_URL", ",", "'devices'", ")", "if", "devices", ":", "self", ".", "_state", "=", "{", "device", "[", "'device_id...
Update all devices from server.
[ "Update", "all", "devices", "from", "server", "." ]
b5c9a701d2b7e24d796aa7f8c410360b61d8ec8a
https://github.com/fredrike/pypoint/blob/b5c9a701d2b7e24d796aa7f8c410360b61d8ec8a/pypoint/__init__.py#L168-L183
train
fredrike/pypoint
pypoint/__init__.py
PointSession._set_alarm
def _set_alarm(self, status, home_id): """Set alarm satus.""" response = self._request( MINUT_HOMES_URL + "/{}".format(home_id), request_type='PUT', json={'alarm_status': status}) return response.get('alarm_status', '') == status
python
def _set_alarm(self, status, home_id): """Set alarm satus.""" response = self._request( MINUT_HOMES_URL + "/{}".format(home_id), request_type='PUT', json={'alarm_status': status}) return response.get('alarm_status', '') == status
[ "def", "_set_alarm", "(", "self", ",", "status", ",", "home_id", ")", ":", "response", "=", "self", ".", "_request", "(", "MINUT_HOMES_URL", "+", "\"/{}\"", ".", "format", "(", "home_id", ")", ",", "request_type", "=", "'PUT'", ",", "json", "=", "{", "...
Set alarm satus.
[ "Set", "alarm", "satus", "." ]
b5c9a701d2b7e24d796aa7f8c410360b61d8ec8a
https://github.com/fredrike/pypoint/blob/b5c9a701d2b7e24d796aa7f8c410360b61d8ec8a/pypoint/__init__.py#L193-L199
train
fredrike/pypoint
pypoint/__init__.py
Device.sensor
def sensor(self, sensor_type): """Update and return sensor value.""" _LOGGER.debug("Reading %s sensor.", sensor_type) return self._session.read_sensor(self.device_id, sensor_type)
python
def sensor(self, sensor_type): """Update and return sensor value.""" _LOGGER.debug("Reading %s sensor.", sensor_type) return self._session.read_sensor(self.device_id, sensor_type)
[ "def", "sensor", "(", "self", ",", "sensor_type", ")", ":", "_LOGGER", ".", "debug", "(", "\"Reading %s sensor.\"", ",", "sensor_type", ")", "return", "self", ".", "_session", ".", "read_sensor", "(", "self", ".", "device_id", ",", "sensor_type", ")" ]
Update and return sensor value.
[ "Update", "and", "return", "sensor", "value", "." ]
b5c9a701d2b7e24d796aa7f8c410360b61d8ec8a
https://github.com/fredrike/pypoint/blob/b5c9a701d2b7e24d796aa7f8c410360b61d8ec8a/pypoint/__init__.py#L247-L250
train
fredrike/pypoint
pypoint/__init__.py
Device.device_info
def device_info(self): """Info about device.""" return { 'connections': {('mac', self.device['device_mac'])}, 'identifieres': self.device['device_id'], 'manufacturer': 'Minut', 'model': 'Point v{}'.format(self.device['hardware_version']), 'name...
python
def device_info(self): """Info about device.""" return { 'connections': {('mac', self.device['device_mac'])}, 'identifieres': self.device['device_id'], 'manufacturer': 'Minut', 'model': 'Point v{}'.format(self.device['hardware_version']), 'name...
[ "def", "device_info", "(", "self", ")", ":", "return", "{", "'connections'", ":", "{", "(", "'mac'", ",", "self", ".", "device", "[", "'device_mac'", "]", ")", "}", ",", "'identifieres'", ":", "self", ".", "device", "[", "'device_id'", "]", ",", "'manu...
Info about device.
[ "Info", "about", "device", "." ]
b5c9a701d2b7e24d796aa7f8c410360b61d8ec8a
https://github.com/fredrike/pypoint/blob/b5c9a701d2b7e24d796aa7f8c410360b61d8ec8a/pypoint/__init__.py#L283-L292
train
fredrike/pypoint
pypoint/__init__.py
Device.device_status
def device_status(self): """Status of device.""" return { 'active': self.device['active'], 'offline': self.device['offline'], 'last_update': self.last_update, 'battery_level': self.battery_level, }
python
def device_status(self): """Status of device.""" return { 'active': self.device['active'], 'offline': self.device['offline'], 'last_update': self.last_update, 'battery_level': self.battery_level, }
[ "def", "device_status", "(", "self", ")", ":", "return", "{", "'active'", ":", "self", ".", "device", "[", "'active'", "]", ",", "'offline'", ":", "self", ".", "device", "[", "'offline'", "]", ",", "'last_update'", ":", "self", ".", "last_update", ",", ...
Status of device.
[ "Status", "of", "device", "." ]
b5c9a701d2b7e24d796aa7f8c410360b61d8ec8a
https://github.com/fredrike/pypoint/blob/b5c9a701d2b7e24d796aa7f8c410360b61d8ec8a/pypoint/__init__.py#L295-L302
train
developersociety/django-glitter
glitter/templatetags/glitter.py
glitter_head
def glitter_head(context): """ Template tag which renders the glitter CSS and JavaScript. Any resources which need to be loaded should be added here. This is only shown to users with permission to edit the page. """ user = context.get('user') rendered = '' template_path = 'glitter/includ...
python
def glitter_head(context): """ Template tag which renders the glitter CSS and JavaScript. Any resources which need to be loaded should be added here. This is only shown to users with permission to edit the page. """ user = context.get('user') rendered = '' template_path = 'glitter/includ...
[ "def", "glitter_head", "(", "context", ")", ":", "user", "=", "context", ".", "get", "(", "'user'", ")", "rendered", "=", "''", "template_path", "=", "'glitter/include/head.html'", "if", "user", "is", "not", "None", "and", "user", ".", "is_staff", ":", "te...
Template tag which renders the glitter CSS and JavaScript. Any resources which need to be loaded should be added here. This is only shown to users with permission to edit the page.
[ "Template", "tag", "which", "renders", "the", "glitter", "CSS", "and", "JavaScript", ".", "Any", "resources", "which", "need", "to", "be", "loaded", "should", "be", "added", "here", ".", "This", "is", "only", "shown", "to", "users", "with", "permission", "...
2c0280ec83afee80deee94ee3934fc54239c2e87
https://github.com/developersociety/django-glitter/blob/2c0280ec83afee80deee94ee3934fc54239c2e87/glitter/templatetags/glitter.py#L7-L21
train
developersociety/django-glitter
glitter/templatetags/glitter.py
glitter_startbody
def glitter_startbody(context): """ Template tag which renders the glitter overlay and sidebar. This is only shown to users with permission to edit the page. """ user = context.get('user') path_body = 'glitter/include/startbody.html' path_plus = 'glitter/include/startbody_%s_%s.html' ren...
python
def glitter_startbody(context): """ Template tag which renders the glitter overlay and sidebar. This is only shown to users with permission to edit the page. """ user = context.get('user') path_body = 'glitter/include/startbody.html' path_plus = 'glitter/include/startbody_%s_%s.html' ren...
[ "def", "glitter_startbody", "(", "context", ")", ":", "user", "=", "context", ".", "get", "(", "'user'", ")", "path_body", "=", "'glitter/include/startbody.html'", "path_plus", "=", "'glitter/include/startbody_%s_%s.html'", "rendered", "=", "''", "if", "user", "is",...
Template tag which renders the glitter overlay and sidebar. This is only shown to users with permission to edit the page.
[ "Template", "tag", "which", "renders", "the", "glitter", "overlay", "and", "sidebar", ".", "This", "is", "only", "shown", "to", "users", "with", "permission", "to", "edit", "the", "page", "." ]
2c0280ec83afee80deee94ee3934fc54239c2e87
https://github.com/developersociety/django-glitter/blob/2c0280ec83afee80deee94ee3934fc54239c2e87/glitter/templatetags/glitter.py#L25-L49
train
Karaage-Cluster/python-tldap
tldap/filter.py
escape_filter_chars
def escape_filter_chars(assertion_value, escape_mode=0): """ Replace all special characters found in assertion_value by quoted notation. escape_mode If 0 only special chars mentioned in RFC 4515 are escaped. If 1 all NON-ASCII chars are escaped. If 2 all chars are escaped. "...
python
def escape_filter_chars(assertion_value, escape_mode=0): """ Replace all special characters found in assertion_value by quoted notation. escape_mode If 0 only special chars mentioned in RFC 4515 are escaped. If 1 all NON-ASCII chars are escaped. If 2 all chars are escaped. "...
[ "def", "escape_filter_chars", "(", "assertion_value", ",", "escape_mode", "=", "0", ")", ":", "if", "isinstance", "(", "assertion_value", ",", "six", ".", "text_type", ")", ":", "assertion_value", "=", "assertion_value", ".", "encode", "(", "\"utf_8\"", ")", "...
Replace all special characters found in assertion_value by quoted notation. escape_mode If 0 only special chars mentioned in RFC 4515 are escaped. If 1 all NON-ASCII chars are escaped. If 2 all chars are escaped.
[ "Replace", "all", "special", "characters", "found", "in", "assertion_value", "by", "quoted", "notation", "." ]
61f1af74a3648cb6491e7eeb1ee2eb395d67bf59
https://github.com/Karaage-Cluster/python-tldap/blob/61f1af74a3648cb6491e7eeb1ee2eb395d67bf59/tldap/filter.py#L8-L54
train
Karaage-Cluster/python-tldap
tldap/filter.py
filter_format
def filter_format(filter_template, assertion_values): """ filter_template String containing %s as placeholder for assertion values. assertion_values List or tuple of assertion values. Length must match count of %s in filter_template. """ assert isinstance(filter_templat...
python
def filter_format(filter_template, assertion_values): """ filter_template String containing %s as placeholder for assertion values. assertion_values List or tuple of assertion values. Length must match count of %s in filter_template. """ assert isinstance(filter_templat...
[ "def", "filter_format", "(", "filter_template", ",", "assertion_values", ")", ":", "assert", "isinstance", "(", "filter_template", ",", "bytes", ")", "return", "filter_template", "%", "(", "tuple", "(", "map", "(", "escape_filter_chars", ",", "assertion_values", "...
filter_template String containing %s as placeholder for assertion values. assertion_values List or tuple of assertion values. Length must match count of %s in filter_template.
[ "filter_template", "String", "containing", "%s", "as", "placeholder", "for", "assertion", "values", ".", "assertion_values", "List", "or", "tuple", "of", "assertion", "values", ".", "Length", "must", "match", "count", "of", "%s", "in", "filter_template", "." ]
61f1af74a3648cb6491e7eeb1ee2eb395d67bf59
https://github.com/Karaage-Cluster/python-tldap/blob/61f1af74a3648cb6491e7eeb1ee2eb395d67bf59/tldap/filter.py#L57-L67
train
jamescooke/flake8-aaa
src/flake8_aaa/exceptions.py
ValidationError.to_flake8
def to_flake8(self, checker_cls: type) -> Flake8Error: """ Args: checker_cls: Class performing the check to be passed back to flake8. """ return Flake8Error( line_number=self.line_number, offset=self.offset, text=self.text, ...
python
def to_flake8(self, checker_cls: type) -> Flake8Error: """ Args: checker_cls: Class performing the check to be passed back to flake8. """ return Flake8Error( line_number=self.line_number, offset=self.offset, text=self.text, ...
[ "def", "to_flake8", "(", "self", ",", "checker_cls", ":", "type", ")", "->", "Flake8Error", ":", "return", "Flake8Error", "(", "line_number", "=", "self", ".", "line_number", ",", "offset", "=", "self", ".", "offset", ",", "text", "=", "self", ".", "text...
Args: checker_cls: Class performing the check to be passed back to flake8.
[ "Args", ":", "checker_cls", ":", "Class", "performing", "the", "check", "to", "be", "passed", "back", "to", "flake8", "." ]
29938b96845fe32ced4358ba66af3b3be2a37794
https://github.com/jamescooke/flake8-aaa/blob/29938b96845fe32ced4358ba66af3b3be2a37794/src/flake8_aaa/exceptions.py#L42-L53
train
xenadevel/PyXenaManager
xenamanager/api/xena_rest.py
XenaRestWrapper.add_chassis
def add_chassis(self, chassis): """ :param chassis: chassis object """ res = self._request(RestMethod.post, self.user_url, params={'ip': chassis.ip, 'port': chassis.port}) assert(res.status_code == 201)
python
def add_chassis(self, chassis): """ :param chassis: chassis object """ res = self._request(RestMethod.post, self.user_url, params={'ip': chassis.ip, 'port': chassis.port}) assert(res.status_code == 201)
[ "def", "add_chassis", "(", "self", ",", "chassis", ")", ":", "res", "=", "self", ".", "_request", "(", "RestMethod", ".", "post", ",", "self", ".", "user_url", ",", "params", "=", "{", "'ip'", ":", "chassis", ".", "ip", ",", "'port'", ":", "chassis",...
:param chassis: chassis object
[ ":", "param", "chassis", ":", "chassis", "object" ]
384ca265f73044b8a8b471f5dd7a6103fc54f4df
https://github.com/xenadevel/PyXenaManager/blob/384ca265f73044b8a8b471f5dd7a6103fc54f4df/xenamanager/api/xena_rest.py#L48-L54
train
xenadevel/PyXenaManager
xenamanager/api/xena_rest.py
XenaRestWrapper.send_command
def send_command(self, obj, command, *arguments): """ Send command with no output. :param obj: requested object. :param command: command to send. :param arguments: list of command arguments. """ self._perform_command('{}/{}'.format(self.session_url, obj.ref), command, Op...
python
def send_command(self, obj, command, *arguments): """ Send command with no output. :param obj: requested object. :param command: command to send. :param arguments: list of command arguments. """ self._perform_command('{}/{}'.format(self.session_url, obj.ref), command, Op...
[ "def", "send_command", "(", "self", ",", "obj", ",", "command", ",", "*", "arguments", ")", ":", "self", ".", "_perform_command", "(", "'{}/{}'", ".", "format", "(", "self", ".", "session_url", ",", "obj", ".", "ref", ")", ",", "command", ",", "OperRet...
Send command with no output. :param obj: requested object. :param command: command to send. :param arguments: list of command arguments.
[ "Send", "command", "with", "no", "output", "." ]
384ca265f73044b8a8b471f5dd7a6103fc54f4df
https://github.com/xenadevel/PyXenaManager/blob/384ca265f73044b8a8b471f5dd7a6103fc54f4df/xenamanager/api/xena_rest.py#L60-L67
train
xenadevel/PyXenaManager
xenamanager/api/xena_rest.py
XenaRestWrapper.send_command_return
def send_command_return(self, obj, command, *arguments): """ Send command with single line output. :param obj: requested object. :param command: command to send. :param arguments: list of command arguments. :return: command output. """ return self._perform_comman...
python
def send_command_return(self, obj, command, *arguments): """ Send command with single line output. :param obj: requested object. :param command: command to send. :param arguments: list of command arguments. :return: command output. """ return self._perform_comman...
[ "def", "send_command_return", "(", "self", ",", "obj", ",", "command", ",", "*", "arguments", ")", ":", "return", "self", ".", "_perform_command", "(", "'{}/{}'", ".", "format", "(", "self", ".", "session_url", ",", "obj", ".", "ref", ")", ",", "command"...
Send command with single line output. :param obj: requested object. :param command: command to send. :param arguments: list of command arguments. :return: command output.
[ "Send", "command", "with", "single", "line", "output", "." ]
384ca265f73044b8a8b471f5dd7a6103fc54f4df
https://github.com/xenadevel/PyXenaManager/blob/384ca265f73044b8a8b471f5dd7a6103fc54f4df/xenamanager/api/xena_rest.py#L69-L78
train
xenadevel/PyXenaManager
xenamanager/api/xena_rest.py
XenaRestWrapper.send_command_return_multilines
def send_command_return_multilines(self, obj, command, *arguments): """ Send command with no output. :param obj: requested object. :param command: command to send. :param arguments: list of command arguments. :return: list of command output lines. :rtype: list(str) ...
python
def send_command_return_multilines(self, obj, command, *arguments): """ Send command with no output. :param obj: requested object. :param command: command to send. :param arguments: list of command arguments. :return: list of command output lines. :rtype: list(str) ...
[ "def", "send_command_return_multilines", "(", "self", ",", "obj", ",", "command", ",", "*", "arguments", ")", ":", "return", "self", ".", "_perform_command", "(", "'{}/{}'", ".", "format", "(", "self", ".", "session_url", ",", "obj", ".", "ref", ")", ",", ...
Send command with no output. :param obj: requested object. :param command: command to send. :param arguments: list of command arguments. :return: list of command output lines. :rtype: list(str)
[ "Send", "command", "with", "no", "output", "." ]
384ca265f73044b8a8b471f5dd7a6103fc54f4df
https://github.com/xenadevel/PyXenaManager/blob/384ca265f73044b8a8b471f5dd7a6103fc54f4df/xenamanager/api/xena_rest.py#L80-L90
train
xenadevel/PyXenaManager
xenamanager/api/xena_rest.py
XenaRestWrapper.get_attributes
def get_attributes(self, obj): """ Get all object's attributes. Sends multi-parameter info/config queries and returns the result as dictionary. :param obj: requested object. :returns: dictionary of <name, value> of all attributes returned by the query. :rtype: dict of (str, str...
python
def get_attributes(self, obj): """ Get all object's attributes. Sends multi-parameter info/config queries and returns the result as dictionary. :param obj: requested object. :returns: dictionary of <name, value> of all attributes returned by the query. :rtype: dict of (str, str...
[ "def", "get_attributes", "(", "self", ",", "obj", ")", ":", "return", "self", ".", "_get_attributes", "(", "'{}/{}'", ".", "format", "(", "self", ".", "session_url", ",", "obj", ".", "ref", ")", ")" ]
Get all object's attributes. Sends multi-parameter info/config queries and returns the result as dictionary. :param obj: requested object. :returns: dictionary of <name, value> of all attributes returned by the query. :rtype: dict of (str, str)
[ "Get", "all", "object", "s", "attributes", "." ]
384ca265f73044b8a8b471f5dd7a6103fc54f4df
https://github.com/xenadevel/PyXenaManager/blob/384ca265f73044b8a8b471f5dd7a6103fc54f4df/xenamanager/api/xena_rest.py#L102-L111
train
xenadevel/PyXenaManager
xenamanager/api/xena_rest.py
XenaRestWrapper.set_attributes
def set_attributes(self, obj, **attributes): """ Set attributes. :param obj: requested object. :param attributes: dictionary of {attribute: value} to set """ attributes_url = '{}/{}/attributes'.format(self.session_url, obj.ref) attributes_list = [{u'name': str(name), u'...
python
def set_attributes(self, obj, **attributes): """ Set attributes. :param obj: requested object. :param attributes: dictionary of {attribute: value} to set """ attributes_url = '{}/{}/attributes'.format(self.session_url, obj.ref) attributes_list = [{u'name': str(name), u'...
[ "def", "set_attributes", "(", "self", ",", "obj", ",", "*", "*", "attributes", ")", ":", "attributes_url", "=", "'{}/{}/attributes'", ".", "format", "(", "self", ".", "session_url", ",", "obj", ".", "ref", ")", "attributes_list", "=", "[", "{", "u'name'", ...
Set attributes. :param obj: requested object. :param attributes: dictionary of {attribute: value} to set
[ "Set", "attributes", "." ]
384ca265f73044b8a8b471f5dd7a6103fc54f4df
https://github.com/xenadevel/PyXenaManager/blob/384ca265f73044b8a8b471f5dd7a6103fc54f4df/xenamanager/api/xena_rest.py#L113-L123
train
xenadevel/PyXenaManager
xenamanager/api/xena_rest.py
XenaRestWrapper.get_stats
def get_stats(self, obj, stat_name): """ Send CLI command that returns list of integer counters. :param obj: requested object. :param stat_name: statistics command name. :return: list of counters. :rtype: list(int) """ return [int(v) for v in self.send_command_re...
python
def get_stats(self, obj, stat_name): """ Send CLI command that returns list of integer counters. :param obj: requested object. :param stat_name: statistics command name. :return: list of counters. :rtype: list(int) """ return [int(v) for v in self.send_command_re...
[ "def", "get_stats", "(", "self", ",", "obj", ",", "stat_name", ")", ":", "return", "[", "int", "(", "v", ")", "for", "v", "in", "self", ".", "send_command_return", "(", "obj", ",", "stat_name", ",", "'?'", ")", ".", "split", "(", ")", "]" ]
Send CLI command that returns list of integer counters. :param obj: requested object. :param stat_name: statistics command name. :return: list of counters. :rtype: list(int)
[ "Send", "CLI", "command", "that", "returns", "list", "of", "integer", "counters", "." ]
384ca265f73044b8a8b471f5dd7a6103fc54f4df
https://github.com/xenadevel/PyXenaManager/blob/384ca265f73044b8a8b471f5dd7a6103fc54f4df/xenamanager/api/xena_rest.py#L125-L133
train
qubell/contrib-python-qubell-client
qubell/api/private/environment.py
Environment.init_common_services
def init_common_services(self, with_cloud_account=True, zone_name=None): """ Initialize common service, When 'zone_name' is defined " at $zone_name" is added to service names :param bool with_cloud_account: :param str zone_name: :return: OR tuple(Workflow, Vault), OR tupl...
python
def init_common_services(self, with_cloud_account=True, zone_name=None): """ Initialize common service, When 'zone_name' is defined " at $zone_name" is added to service names :param bool with_cloud_account: :param str zone_name: :return: OR tuple(Workflow, Vault), OR tupl...
[ "def", "init_common_services", "(", "self", ",", "with_cloud_account", "=", "True", ",", "zone_name", "=", "None", ")", ":", "zone_names", "=", "ZoneConstants", "(", "zone_name", ")", "type_to_app", "=", "lambda", "t", ":", "self", ".", "organization", ".", ...
Initialize common service, When 'zone_name' is defined " at $zone_name" is added to service names :param bool with_cloud_account: :param str zone_name: :return: OR tuple(Workflow, Vault), OR tuple(Workflow, Vault, CloudAccount) with services
[ "Initialize", "common", "service", "When", "zone_name", "is", "defined", "at", "$zone_name", "is", "added", "to", "service", "names", ":", "param", "bool", "with_cloud_account", ":", ":", "param", "str", "zone_name", ":", ":", "return", ":", "OR", "tuple", "...
4586ea11d5103c2ff9607d3ed922b5a0991b8845
https://github.com/qubell/contrib-python-qubell-client/blob/4586ea11d5103c2ff9607d3ed922b5a0991b8845/qubell/api/private/environment.py#L333-L370
train
qubell/contrib-python-qubell-client
qubell/api/private/environment.py
Environment.clone
def clone(self, name=None): """ :param name: new env name :rtype: Environment """ resp = self._router.post_env_clone(env_id=self.environmentId, json=dict(name=name) if name else {}).json() return Environment(self.organization, id=resp['id']).init_router(self._router)
python
def clone(self, name=None): """ :param name: new env name :rtype: Environment """ resp = self._router.post_env_clone(env_id=self.environmentId, json=dict(name=name) if name else {}).json() return Environment(self.organization, id=resp['id']).init_router(self._router)
[ "def", "clone", "(", "self", ",", "name", "=", "None", ")", ":", "resp", "=", "self", ".", "_router", ".", "post_env_clone", "(", "env_id", "=", "self", ".", "environmentId", ",", "json", "=", "dict", "(", "name", "=", "name", ")", "if", "name", "e...
:param name: new env name :rtype: Environment
[ ":", "param", "name", ":", "new", "env", "name", ":", "rtype", ":", "Environment" ]
4586ea11d5103c2ff9607d3ed922b5a0991b8845
https://github.com/qubell/contrib-python-qubell-client/blob/4586ea11d5103c2ff9607d3ed922b5a0991b8845/qubell/api/private/environment.py#L395-L401
train
qubell/contrib-python-qubell-client
qubell/api/private/environment.py
EnvironmentList.default
def default(self): """ Returns environment marked as default. When Zone is set marked default makes no sense, special env with proper Zone is returned. """ if ZONE_NAME: log.info("Getting or creating default environment for zone with name '{0}'".format(DEFAULT...
python
def default(self): """ Returns environment marked as default. When Zone is set marked default makes no sense, special env with proper Zone is returned. """ if ZONE_NAME: log.info("Getting or creating default environment for zone with name '{0}'".format(DEFAULT...
[ "def", "default", "(", "self", ")", ":", "if", "ZONE_NAME", ":", "log", ".", "info", "(", "\"Getting or creating default environment for zone with name '{0}'\"", ".", "format", "(", "DEFAULT_ENV_NAME", "(", ")", ")", ")", "zone_id", "=", "self", ".", "organization...
Returns environment marked as default. When Zone is set marked default makes no sense, special env with proper Zone is returned.
[ "Returns", "environment", "marked", "as", "default", ".", "When", "Zone", "is", "set", "marked", "default", "makes", "no", "sense", "special", "env", "with", "proper", "Zone", "is", "returned", "." ]
4586ea11d5103c2ff9607d3ed922b5a0991b8845
https://github.com/qubell/contrib-python-qubell-client/blob/4586ea11d5103c2ff9607d3ed922b5a0991b8845/qubell/api/private/environment.py#L408-L425
train
josiah-wolf-oberholtzer/uqbar
uqbar/sphinx/inheritance.py
build_urls
def build_urls(self: NodeVisitor, node: inheritance_diagram) -> Mapping[str, str]: """ Builds a mapping of class paths to URLs. """ current_filename = self.builder.current_docname + self.builder.out_suffix urls = {} for child in node: # Another document if child.get("refuri") is ...
python
def build_urls(self: NodeVisitor, node: inheritance_diagram) -> Mapping[str, str]: """ Builds a mapping of class paths to URLs. """ current_filename = self.builder.current_docname + self.builder.out_suffix urls = {} for child in node: # Another document if child.get("refuri") is ...
[ "def", "build_urls", "(", "self", ":", "NodeVisitor", ",", "node", ":", "inheritance_diagram", ")", "->", "Mapping", "[", "str", ",", "str", "]", ":", "current_filename", "=", "self", ".", "builder", ".", "current_docname", "+", "self", ".", "builder", "."...
Builds a mapping of class paths to URLs.
[ "Builds", "a", "mapping", "of", "class", "paths", "to", "URLs", "." ]
eca7fefebbbee1e2ae13bf5d6baa838be66b1db6
https://github.com/josiah-wolf-oberholtzer/uqbar/blob/eca7fefebbbee1e2ae13bf5d6baa838be66b1db6/uqbar/sphinx/inheritance.py#L103-L129
train
josiah-wolf-oberholtzer/uqbar
uqbar/sphinx/inheritance.py
html_visit_inheritance_diagram
def html_visit_inheritance_diagram( self: NodeVisitor, node: inheritance_diagram ) -> None: """ Builds HTML output from an :py:class:`~uqbar.sphinx.inheritance.inheritance_diagram` node. """ inheritance_graph = node["graph"] urls = build_urls(self, node) graphviz_graph = inheritance_graph.bu...
python
def html_visit_inheritance_diagram( self: NodeVisitor, node: inheritance_diagram ) -> None: """ Builds HTML output from an :py:class:`~uqbar.sphinx.inheritance.inheritance_diagram` node. """ inheritance_graph = node["graph"] urls = build_urls(self, node) graphviz_graph = inheritance_graph.bu...
[ "def", "html_visit_inheritance_diagram", "(", "self", ":", "NodeVisitor", ",", "node", ":", "inheritance_diagram", ")", "->", "None", ":", "inheritance_graph", "=", "node", "[", "\"graph\"", "]", "urls", "=", "build_urls", "(", "self", ",", "node", ")", "graph...
Builds HTML output from an :py:class:`~uqbar.sphinx.inheritance.inheritance_diagram` node.
[ "Builds", "HTML", "output", "from", "an", ":", "py", ":", "class", ":", "~uqbar", ".", "sphinx", ".", "inheritance", ".", "inheritance_diagram", "node", "." ]
eca7fefebbbee1e2ae13bf5d6baa838be66b1db6
https://github.com/josiah-wolf-oberholtzer/uqbar/blob/eca7fefebbbee1e2ae13bf5d6baa838be66b1db6/uqbar/sphinx/inheritance.py#L132-L156
train
josiah-wolf-oberholtzer/uqbar
uqbar/sphinx/inheritance.py
latex_visit_inheritance_diagram
def latex_visit_inheritance_diagram( self: NodeVisitor, node: inheritance_diagram ) -> None: """ Builds LaTeX output from an :py:class:`~uqbar.sphinx.inheritance.inheritance_diagram` node. """ inheritance_graph = node["graph"] graphviz_graph = inheritance_graph.build_graph() graphviz_graph.a...
python
def latex_visit_inheritance_diagram( self: NodeVisitor, node: inheritance_diagram ) -> None: """ Builds LaTeX output from an :py:class:`~uqbar.sphinx.inheritance.inheritance_diagram` node. """ inheritance_graph = node["graph"] graphviz_graph = inheritance_graph.build_graph() graphviz_graph.a...
[ "def", "latex_visit_inheritance_diagram", "(", "self", ":", "NodeVisitor", ",", "node", ":", "inheritance_diagram", ")", "->", "None", ":", "inheritance_graph", "=", "node", "[", "\"graph\"", "]", "graphviz_graph", "=", "inheritance_graph", ".", "build_graph", "(", ...
Builds LaTeX output from an :py:class:`~uqbar.sphinx.inheritance.inheritance_diagram` node.
[ "Builds", "LaTeX", "output", "from", "an", ":", "py", ":", "class", ":", "~uqbar", ".", "sphinx", ".", "inheritance", ".", "inheritance_diagram", "node", "." ]
eca7fefebbbee1e2ae13bf5d6baa838be66b1db6
https://github.com/josiah-wolf-oberholtzer/uqbar/blob/eca7fefebbbee1e2ae13bf5d6baa838be66b1db6/uqbar/sphinx/inheritance.py#L159-L170
train
josiah-wolf-oberholtzer/uqbar
uqbar/sphinx/inheritance.py
setup
def setup(app) -> Dict[str, Any]: """ Sets up Sphinx extension. """ app.setup_extension("sphinx.ext.graphviz") app.add_node( inheritance_diagram, html=(html_visit_inheritance_diagram, None), latex=(latex_visit_inheritance_diagram, None), man=(skip, None), texi...
python
def setup(app) -> Dict[str, Any]: """ Sets up Sphinx extension. """ app.setup_extension("sphinx.ext.graphviz") app.add_node( inheritance_diagram, html=(html_visit_inheritance_diagram, None), latex=(latex_visit_inheritance_diagram, None), man=(skip, None), texi...
[ "def", "setup", "(", "app", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "app", ".", "setup_extension", "(", "\"sphinx.ext.graphviz\"", ")", "app", ".", "add_node", "(", "inheritance_diagram", ",", "html", "=", "(", "html_visit_inheritance_diagram", ...
Sets up Sphinx extension.
[ "Sets", "up", "Sphinx", "extension", "." ]
eca7fefebbbee1e2ae13bf5d6baa838be66b1db6
https://github.com/josiah-wolf-oberholtzer/uqbar/blob/eca7fefebbbee1e2ae13bf5d6baa838be66b1db6/uqbar/sphinx/inheritance.py#L180-L198
train
MatterMiners/cobald
cobald/daemon/core/main.py
run
def run(configuration: str, level: str, target: str, short_format: bool): """Run the daemon and all its services""" initialise_logging(level=level, target=target, short_format=short_format) logger = logging.getLogger(__package__) logger.info('COBalD %s', cobald.__about__.__version__) logger.info(cob...
python
def run(configuration: str, level: str, target: str, short_format: bool): """Run the daemon and all its services""" initialise_logging(level=level, target=target, short_format=short_format) logger = logging.getLogger(__package__) logger.info('COBalD %s', cobald.__about__.__version__) logger.info(cob...
[ "def", "run", "(", "configuration", ":", "str", ",", "level", ":", "str", ",", "target", ":", "str", ",", "short_format", ":", "bool", ")", ":", "initialise_logging", "(", "level", "=", "level", ",", "target", "=", "target", ",", "short_format", "=", "...
Run the daemon and all its services
[ "Run", "the", "daemon", "and", "all", "its", "services" ]
264138de4382d1c9b53fabcbc6660e10b33a914d
https://github.com/MatterMiners/cobald/blob/264138de4382d1c9b53fabcbc6660e10b33a914d/cobald/daemon/core/main.py#L16-L27
train
MatterMiners/cobald
cobald/daemon/core/main.py
cli_run
def cli_run(): """Run the daemon from a command line interface""" options = CLI.parse_args() run(options.CONFIGURATION, options.log_level, options.log_target, options.log_journal)
python
def cli_run(): """Run the daemon from a command line interface""" options = CLI.parse_args() run(options.CONFIGURATION, options.log_level, options.log_target, options.log_journal)
[ "def", "cli_run", "(", ")", ":", "options", "=", "CLI", ".", "parse_args", "(", ")", "run", "(", "options", ".", "CONFIGURATION", ",", "options", ".", "log_level", ",", "options", ".", "log_target", ",", "options", ".", "log_journal", ")" ]
Run the daemon from a command line interface
[ "Run", "the", "daemon", "from", "a", "command", "line", "interface" ]
264138de4382d1c9b53fabcbc6660e10b33a914d
https://github.com/MatterMiners/cobald/blob/264138de4382d1c9b53fabcbc6660e10b33a914d/cobald/daemon/core/main.py#L30-L33
train
jamescooke/flake8-aaa
src/flake8_aaa/act_node.py
ActNode.build_body
def build_body(cls: Type[AN], body: List[ast.stmt]) -> List: """ Note: Return type is probably ``-> List[AN]``, but can't get it to pass. """ act_nodes = [] # type: List[ActNode] for child_node in body: act_nodes += ActNode.build(child_node) retur...
python
def build_body(cls: Type[AN], body: List[ast.stmt]) -> List: """ Note: Return type is probably ``-> List[AN]``, but can't get it to pass. """ act_nodes = [] # type: List[ActNode] for child_node in body: act_nodes += ActNode.build(child_node) retur...
[ "def", "build_body", "(", "cls", ":", "Type", "[", "AN", "]", ",", "body", ":", "List", "[", "ast", ".", "stmt", "]", ")", "->", "List", ":", "act_nodes", "=", "[", "]", "# type: List[ActNode]", "for", "child_node", "in", "body", ":", "act_nodes", "+...
Note: Return type is probably ``-> List[AN]``, but can't get it to pass.
[ "Note", ":", "Return", "type", "is", "probably", "-", ">", "List", "[", "AN", "]", "but", "can", "t", "get", "it", "to", "pass", "." ]
29938b96845fe32ced4358ba66af3b3be2a37794
https://github.com/jamescooke/flake8-aaa/blob/29938b96845fe32ced4358ba66af3b3be2a37794/src/flake8_aaa/act_node.py#L27-L35
train
jamescooke/flake8-aaa
src/flake8_aaa/act_node.py
ActNode.build
def build(cls: Type[AN], node: ast.stmt) -> List[AN]: """ Starting at this ``node``, check if it's an act node. If it's a context manager, recurse into child nodes. Returns: List of all act nodes found. """ if node_is_result_assignment(node): retu...
python
def build(cls: Type[AN], node: ast.stmt) -> List[AN]: """ Starting at this ``node``, check if it's an act node. If it's a context manager, recurse into child nodes. Returns: List of all act nodes found. """ if node_is_result_assignment(node): retu...
[ "def", "build", "(", "cls", ":", "Type", "[", "AN", "]", ",", "node", ":", "ast", ".", "stmt", ")", "->", "List", "[", "AN", "]", ":", "if", "node_is_result_assignment", "(", "node", ")", ":", "return", "[", "cls", "(", "node", ",", "ActNodeType", ...
Starting at this ``node``, check if it's an act node. If it's a context manager, recurse into child nodes. Returns: List of all act nodes found.
[ "Starting", "at", "this", "node", "check", "if", "it", "s", "an", "act", "node", ".", "If", "it", "s", "a", "context", "manager", "recurse", "into", "child", "nodes", "." ]
29938b96845fe32ced4358ba66af3b3be2a37794
https://github.com/jamescooke/flake8-aaa/blob/29938b96845fe32ced4358ba66af3b3be2a37794/src/flake8_aaa/act_node.py#L38-L62
train
qubell/contrib-python-qubell-client
qubell/api/private/organization.py
Organization.ready
def ready(self): """ Checks if organization properly created. Note: New organization must have 'default' environment and two default services running there. Cannot use DEFAULT_ENV_NAME, because zone could be added there. :rtype: bool """ @retry(tries=3, retry_exc...
python
def ready(self): """ Checks if organization properly created. Note: New organization must have 'default' environment and two default services running there. Cannot use DEFAULT_ENV_NAME, because zone could be added there. :rtype: bool """ @retry(tries=3, retry_exc...
[ "def", "ready", "(", "self", ")", ":", "@", "retry", "(", "tries", "=", "3", ",", "retry_exception", "=", "exceptions", ".", "NotFoundError", ")", "# org init, takes some times", "def", "check_init", "(", ")", ":", "env", "=", "self", ".", "environments", ...
Checks if organization properly created. Note: New organization must have 'default' environment and two default services running there. Cannot use DEFAULT_ENV_NAME, because zone could be added there. :rtype: bool
[ "Checks", "if", "organization", "properly", "created", ".", "Note", ":", "New", "organization", "must", "have", "default", "environment", "and", "two", "default", "services", "running", "there", ".", "Cannot", "use", "DEFAULT_ENV_NAME", "because", "zone", "could",...
4586ea11d5103c2ff9607d3ed922b5a0991b8845
https://github.com/qubell/contrib-python-qubell-client/blob/4586ea11d5103c2ff9607d3ed922b5a0991b8845/qubell/api/private/organization.py#L109-L122
train
qubell/contrib-python-qubell-client
qubell/api/private/organization.py
Organization.create_application
def create_application(self, name=None, manifest=None): """ Creates application and returns Application object. """ if not manifest: raise exceptions.NotEnoughParams('Manifest not set') if not name: name = 'auto-generated-name' from qubell.api.private.appl...
python
def create_application(self, name=None, manifest=None): """ Creates application and returns Application object. """ if not manifest: raise exceptions.NotEnoughParams('Manifest not set') if not name: name = 'auto-generated-name' from qubell.api.private.appl...
[ "def", "create_application", "(", "self", ",", "name", "=", "None", ",", "manifest", "=", "None", ")", ":", "if", "not", "manifest", ":", "raise", "exceptions", ".", "NotEnoughParams", "(", "'Manifest not set'", ")", "if", "not", "name", ":", "name", "=", ...
Creates application and returns Application object.
[ "Creates", "application", "and", "returns", "Application", "object", "." ]
4586ea11d5103c2ff9607d3ed922b5a0991b8845
https://github.com/qubell/contrib-python-qubell-client/blob/4586ea11d5103c2ff9607d3ed922b5a0991b8845/qubell/api/private/organization.py#L174-L182
train
qubell/contrib-python-qubell-client
qubell/api/private/organization.py
Organization.get_application
def get_application(self, id=None, name=None): """ Get application object by name or id. """ log.info("Picking application: %s (%s)" % (name, id)) return self.applications[id or name]
python
def get_application(self, id=None, name=None): """ Get application object by name or id. """ log.info("Picking application: %s (%s)" % (name, id)) return self.applications[id or name]
[ "def", "get_application", "(", "self", ",", "id", "=", "None", ",", "name", "=", "None", ")", ":", "log", ".", "info", "(", "\"Picking application: %s (%s)\"", "%", "(", "name", ",", "id", ")", ")", "return", "self", ".", "applications", "[", "id", "or...
Get application object by name or id.
[ "Get", "application", "object", "by", "name", "or", "id", "." ]
4586ea11d5103c2ff9607d3ed922b5a0991b8845
https://github.com/qubell/contrib-python-qubell-client/blob/4586ea11d5103c2ff9607d3ed922b5a0991b8845/qubell/api/private/organization.py#L184-L188
train
qubell/contrib-python-qubell-client
qubell/api/private/organization.py
Organization.get_or_create_application
def get_or_create_application(self, id=None, manifest=None, name=None): """ Get application by id or name. If not found: create with given or generated parameters """ if id: return self.get_application(id=id) elif name: try: app = self.get_...
python
def get_or_create_application(self, id=None, manifest=None, name=None): """ Get application by id or name. If not found: create with given or generated parameters """ if id: return self.get_application(id=id) elif name: try: app = self.get_...
[ "def", "get_or_create_application", "(", "self", ",", "id", "=", "None", ",", "manifest", "=", "None", ",", "name", "=", "None", ")", ":", "if", "id", ":", "return", "self", ".", "get_application", "(", "id", "=", "id", ")", "elif", "name", ":", "try...
Get application by id or name. If not found: create with given or generated parameters
[ "Get", "application", "by", "id", "or", "name", ".", "If", "not", "found", ":", "create", "with", "given", "or", "generated", "parameters" ]
4586ea11d5103c2ff9607d3ed922b5a0991b8845
https://github.com/qubell/contrib-python-qubell-client/blob/4586ea11d5103c2ff9607d3ed922b5a0991b8845/qubell/api/private/organization.py#L200-L212
train
qubell/contrib-python-qubell-client
qubell/api/private/organization.py
Organization.application
def application(self, id=None, manifest=None, name=None): """ Smart method. Creates, picks or modifies application. If application found by name or id and manifest not changed: return app. If app found by id, but other parameters differs: change them. If no application found, create. ...
python
def application(self, id=None, manifest=None, name=None): """ Smart method. Creates, picks or modifies application. If application found by name or id and manifest not changed: return app. If app found by id, but other parameters differs: change them. If no application found, create. ...
[ "def", "application", "(", "self", ",", "id", "=", "None", ",", "manifest", "=", "None", ",", "name", "=", "None", ")", ":", "modify", "=", "False", "found", "=", "False", "# Try to find application by name or id", "if", "name", "and", "id", ":", "found", ...
Smart method. Creates, picks or modifies application. If application found by name or id and manifest not changed: return app. If app found by id, but other parameters differs: change them. If no application found, create.
[ "Smart", "method", ".", "Creates", "picks", "or", "modifies", "application", ".", "If", "application", "found", "by", "name", "or", "id", "and", "manifest", "not", "changed", ":", "return", "app", ".", "If", "app", "found", "by", "id", "but", "other", "p...
4586ea11d5103c2ff9607d3ed922b5a0991b8845
https://github.com/qubell/contrib-python-qubell-client/blob/4586ea11d5103c2ff9607d3ed922b5a0991b8845/qubell/api/private/organization.py#L214-L249
train
qubell/contrib-python-qubell-client
qubell/api/private/organization.py
Organization.create_instance
def create_instance(self, application, revision=None, environment=None, name=None, parameters=None, submodules=None, destroyInterval=None, manifestVersion=None): """ Launches instance in application and returns Instance object. """ from qubell.api.private.instance import ...
python
def create_instance(self, application, revision=None, environment=None, name=None, parameters=None, submodules=None, destroyInterval=None, manifestVersion=None): """ Launches instance in application and returns Instance object. """ from qubell.api.private.instance import ...
[ "def", "create_instance", "(", "self", ",", "application", ",", "revision", "=", "None", ",", "environment", "=", "None", ",", "name", "=", "None", ",", "parameters", "=", "None", ",", "submodules", "=", "None", ",", "destroyInterval", "=", "None", ",", ...
Launches instance in application and returns Instance object.
[ "Launches", "instance", "in", "application", "and", "returns", "Instance", "object", "." ]
4586ea11d5103c2ff9607d3ed922b5a0991b8845
https://github.com/qubell/contrib-python-qubell-client/blob/4586ea11d5103c2ff9607d3ed922b5a0991b8845/qubell/api/private/organization.py#L254-L260
train
qubell/contrib-python-qubell-client
qubell/api/private/organization.py
Organization.get_instance
def get_instance(self, id=None, name=None): """ Get instance object by name or id. If application set, search within the application. """ log.info("Picking instance: %s (%s)" % (name, id)) if id: # submodule instances are invisible for lists return Instance(id=id, or...
python
def get_instance(self, id=None, name=None): """ Get instance object by name or id. If application set, search within the application. """ log.info("Picking instance: %s (%s)" % (name, id)) if id: # submodule instances are invisible for lists return Instance(id=id, or...
[ "def", "get_instance", "(", "self", ",", "id", "=", "None", ",", "name", "=", "None", ")", ":", "log", ".", "info", "(", "\"Picking instance: %s (%s)\"", "%", "(", "name", ",", "id", ")", ")", "if", "id", ":", "# submodule instances are invisible for lists",...
Get instance object by name or id. If application set, search within the application.
[ "Get", "instance", "object", "by", "name", "or", "id", ".", "If", "application", "set", "search", "within", "the", "application", "." ]
4586ea11d5103c2ff9607d3ed922b5a0991b8845
https://github.com/qubell/contrib-python-qubell-client/blob/4586ea11d5103c2ff9607d3ed922b5a0991b8845/qubell/api/private/organization.py#L262-L269
train
qubell/contrib-python-qubell-client
qubell/api/private/organization.py
Organization.list_instances_json
def list_instances_json(self, application=None, show_only_destroyed=False): """ Get list of instances in json format converted to list""" # todo: application should not be parameter here. Application should do its own list, just in sake of code reuse q_filter = {'sortBy': 'byCreation', 'descendi...
python
def list_instances_json(self, application=None, show_only_destroyed=False): """ Get list of instances in json format converted to list""" # todo: application should not be parameter here. Application should do its own list, just in sake of code reuse q_filter = {'sortBy': 'byCreation', 'descendi...
[ "def", "list_instances_json", "(", "self", ",", "application", "=", "None", ",", "show_only_destroyed", "=", "False", ")", ":", "# todo: application should not be parameter here. Application should do its own list, just in sake of code reuse", "q_filter", "=", "{", "'sortBy'", ...
Get list of instances in json format converted to list
[ "Get", "list", "of", "instances", "in", "json", "format", "converted", "to", "list" ]
4586ea11d5103c2ff9607d3ed922b5a0991b8845
https://github.com/qubell/contrib-python-qubell-client/blob/4586ea11d5103c2ff9607d3ed922b5a0991b8845/qubell/api/private/organization.py#L271-L292
train
qubell/contrib-python-qubell-client
qubell/api/private/organization.py
Organization.get_or_create_instance
def get_or_create_instance(self, id=None, application=None, revision=None, environment=None, name=None, parameters=None, submodules=None, destroyInterval=None): """ Get instance by id or name. If not found: create with given parameters """ try: ...
python
def get_or_create_instance(self, id=None, application=None, revision=None, environment=None, name=None, parameters=None, submodules=None, destroyInterval=None): """ Get instance by id or name. If not found: create with given parameters """ try: ...
[ "def", "get_or_create_instance", "(", "self", ",", "id", "=", "None", ",", "application", "=", "None", ",", "revision", "=", "None", ",", "environment", "=", "None", ",", "name", "=", "None", ",", "parameters", "=", "None", ",", "submodules", "=", "None"...
Get instance by id or name. If not found: create with given parameters
[ "Get", "instance", "by", "id", "or", "name", ".", "If", "not", "found", ":", "create", "with", "given", "parameters" ]
4586ea11d5103c2ff9607d3ed922b5a0991b8845
https://github.com/qubell/contrib-python-qubell-client/blob/4586ea11d5103c2ff9607d3ed922b5a0991b8845/qubell/api/private/organization.py#L294-L306
train
qubell/contrib-python-qubell-client
qubell/api/private/organization.py
Organization.instance
def instance(self, id=None, application=None, name=None, revision=None, environment=None, parameters=None, submodules=None, destroyInterval=None): """ Smart method. It does everything, to return Instance with given parameters within the application. If instance found running and given parameters are act...
python
def instance(self, id=None, application=None, name=None, revision=None, environment=None, parameters=None, submodules=None, destroyInterval=None): """ Smart method. It does everything, to return Instance with given parameters within the application. If instance found running and given parameters are act...
[ "def", "instance", "(", "self", ",", "id", "=", "None", ",", "application", "=", "None", ",", "name", "=", "None", ",", "revision", "=", "None", ",", "environment", "=", "None", ",", "parameters", "=", "None", ",", "submodules", "=", "None", ",", "de...
Smart method. It does everything, to return Instance with given parameters within the application. If instance found running and given parameters are actual: return it. If instance found, but parameters differs - reconfigure instance with new parameters. If instance not found: launch instance wi...
[ "Smart", "method", ".", "It", "does", "everything", "to", "return", "Instance", "with", "given", "parameters", "within", "the", "application", ".", "If", "instance", "found", "running", "and", "given", "parameters", "are", "actual", ":", "return", "it", ".", ...
4586ea11d5103c2ff9607d3ed922b5a0991b8845
https://github.com/qubell/contrib-python-qubell-client/blob/4586ea11d5103c2ff9607d3ed922b5a0991b8845/qubell/api/private/organization.py#L309-L329
train
qubell/contrib-python-qubell-client
qubell/api/private/organization.py
Organization.create_environment
def create_environment(self, name, default=False, zone=None): """ Creates environment and returns Environment object. """ from qubell.api.private.environment import Environment return Environment.new(organization=self, name=name, zone_id=zone, default=default, router=self._router)
python
def create_environment(self, name, default=False, zone=None): """ Creates environment and returns Environment object. """ from qubell.api.private.environment import Environment return Environment.new(organization=self, name=name, zone_id=zone, default=default, router=self._router)
[ "def", "create_environment", "(", "self", ",", "name", ",", "default", "=", "False", ",", "zone", "=", "None", ")", ":", "from", "qubell", ".", "api", ".", "private", ".", "environment", "import", "Environment", "return", "Environment", ".", "new", "(", ...
Creates environment and returns Environment object.
[ "Creates", "environment", "and", "returns", "Environment", "object", "." ]
4586ea11d5103c2ff9607d3ed922b5a0991b8845
https://github.com/qubell/contrib-python-qubell-client/blob/4586ea11d5103c2ff9607d3ed922b5a0991b8845/qubell/api/private/organization.py#L381-L385
train
qubell/contrib-python-qubell-client
qubell/api/private/organization.py
Organization.get_environment
def get_environment(self, id=None, name=None): """ Get environment object by name or id. """ log.info("Picking environment: %s (%s)" % (name, id)) return self.environments[id or name]
python
def get_environment(self, id=None, name=None): """ Get environment object by name or id. """ log.info("Picking environment: %s (%s)" % (name, id)) return self.environments[id or name]
[ "def", "get_environment", "(", "self", ",", "id", "=", "None", ",", "name", "=", "None", ")", ":", "log", ".", "info", "(", "\"Picking environment: %s (%s)\"", "%", "(", "name", ",", "id", ")", ")", "return", "self", ".", "environments", "[", "id", "or...
Get environment object by name or id.
[ "Get", "environment", "object", "by", "name", "or", "id", "." ]
4586ea11d5103c2ff9607d3ed922b5a0991b8845
https://github.com/qubell/contrib-python-qubell-client/blob/4586ea11d5103c2ff9607d3ed922b5a0991b8845/qubell/api/private/organization.py#L390-L394
train
qubell/contrib-python-qubell-client
qubell/api/private/organization.py
Organization.get_or_create_environment
def get_or_create_environment(self, id=None, name=None, zone=None, default=False): """ Get environment by id or name. If not found: create with given or generated parameters """ if id: return self.get_environment(id=id) elif name: try: env ...
python
def get_or_create_environment(self, id=None, name=None, zone=None, default=False): """ Get environment by id or name. If not found: create with given or generated parameters """ if id: return self.get_environment(id=id) elif name: try: env ...
[ "def", "get_or_create_environment", "(", "self", ",", "id", "=", "None", ",", "name", "=", "None", ",", "zone", "=", "None", ",", "default", "=", "False", ")", ":", "if", "id", ":", "return", "self", ".", "get_environment", "(", "id", "=", "id", ")",...
Get environment by id or name. If not found: create with given or generated parameters
[ "Get", "environment", "by", "id", "or", "name", ".", "If", "not", "found", ":", "create", "with", "given", "or", "generated", "parameters" ]
4586ea11d5103c2ff9607d3ed922b5a0991b8845
https://github.com/qubell/contrib-python-qubell-client/blob/4586ea11d5103c2ff9607d3ed922b5a0991b8845/qubell/api/private/organization.py#L404-L419
train
qubell/contrib-python-qubell-client
qubell/api/private/organization.py
Organization.environment
def environment(self, id=None, name=None, zone=None, default=False): """ Smart method. Creates, picks or modifies environment. If environment found by name or id parameters not changed: return env. If env found by id, but other parameters differs: change them. If no environment found, cr...
python
def environment(self, id=None, name=None, zone=None, default=False): """ Smart method. Creates, picks or modifies environment. If environment found by name or id parameters not changed: return env. If env found by id, but other parameters differs: change them. If no environment found, cr...
[ "def", "environment", "(", "self", ",", "id", "=", "None", ",", "name", "=", "None", ",", "zone", "=", "None", ",", "default", "=", "False", ")", ":", "found", "=", "False", "# Try to find environment by name or id", "if", "name", "and", "id", ":", "foun...
Smart method. Creates, picks or modifies environment. If environment found by name or id parameters not changed: return env. If env found by id, but other parameters differs: change them. If no environment found, create with given parameters.
[ "Smart", "method", ".", "Creates", "picks", "or", "modifies", "environment", ".", "If", "environment", "found", "by", "name", "or", "id", "parameters", "not", "changed", ":", "return", "env", ".", "If", "env", "found", "by", "id", "but", "other", "paramete...
4586ea11d5103c2ff9607d3ed922b5a0991b8845
https://github.com/qubell/contrib-python-qubell-client/blob/4586ea11d5103c2ff9607d3ed922b5a0991b8845/qubell/api/private/organization.py#L421-L450
train
qubell/contrib-python-qubell-client
qubell/api/private/organization.py
Organization.get_zone
def get_zone(self, id=None, name=None): """ Get zone object by name or id. """ log.info("Picking zone: %s (%s)" % (name, id)) return self.zones[id or name]
python
def get_zone(self, id=None, name=None): """ Get zone object by name or id. """ log.info("Picking zone: %s (%s)" % (name, id)) return self.zones[id or name]
[ "def", "get_zone", "(", "self", ",", "id", "=", "None", ",", "name", "=", "None", ")", ":", "log", ".", "info", "(", "\"Picking zone: %s (%s)\"", "%", "(", "name", ",", "id", ")", ")", "return", "self", ".", "zones", "[", "id", "or", "name", "]" ]
Get zone object by name or id.
[ "Get", "zone", "object", "by", "name", "or", "id", "." ]
4586ea11d5103c2ff9607d3ed922b5a0991b8845
https://github.com/qubell/contrib-python-qubell-client/blob/4586ea11d5103c2ff9607d3ed922b5a0991b8845/qubell/api/private/organization.py#L465-L469
train
qubell/contrib-python-qubell-client
qubell/api/private/organization.py
Organization.create_role
def create_role(self, name=None, permissions=""): """ Creates role """ name = name or "autocreated-role" from qubell.api.private.role import Role return Role.new(self._router, organization=self, name=name, permissions=permissions)
python
def create_role(self, name=None, permissions=""): """ Creates role """ name = name or "autocreated-role" from qubell.api.private.role import Role return Role.new(self._router, organization=self, name=name, permissions=permissions)
[ "def", "create_role", "(", "self", ",", "name", "=", "None", ",", "permissions", "=", "\"\"", ")", ":", "name", "=", "name", "or", "\"autocreated-role\"", "from", "qubell", ".", "api", ".", "private", ".", "role", "import", "Role", "return", "Role", ".",...
Creates role
[ "Creates", "role" ]
4586ea11d5103c2ff9607d3ed922b5a0991b8845
https://github.com/qubell/contrib-python-qubell-client/blob/4586ea11d5103c2ff9607d3ed922b5a0991b8845/qubell/api/private/organization.py#L481-L485
train
qubell/contrib-python-qubell-client
qubell/api/private/organization.py
Organization.get_role
def get_role(self, id=None, name=None): """ Get role object by name or id. """ log.info("Picking role: %s (%s)" % (name, id)) return self.roles[id or name]
python
def get_role(self, id=None, name=None): """ Get role object by name or id. """ log.info("Picking role: %s (%s)" % (name, id)) return self.roles[id or name]
[ "def", "get_role", "(", "self", ",", "id", "=", "None", ",", "name", "=", "None", ")", ":", "log", ".", "info", "(", "\"Picking role: %s (%s)\"", "%", "(", "name", ",", "id", ")", ")", "return", "self", ".", "roles", "[", "id", "or", "name", "]" ]
Get role object by name or id.
[ "Get", "role", "object", "by", "name", "or", "id", "." ]
4586ea11d5103c2ff9607d3ed922b5a0991b8845
https://github.com/qubell/contrib-python-qubell-client/blob/4586ea11d5103c2ff9607d3ed922b5a0991b8845/qubell/api/private/organization.py#L490-L494
train
qubell/contrib-python-qubell-client
qubell/api/private/organization.py
Organization.get_user
def get_user(self, id=None, name=None, email=None): """ Get user object by email or id. """ log.info("Picking user: %s (%s) (%s)" % (name, email, id)) from qubell.api.private.user import User if email: user = User.get(self._router, organization=self, email=email) ...
python
def get_user(self, id=None, name=None, email=None): """ Get user object by email or id. """ log.info("Picking user: %s (%s) (%s)" % (name, email, id)) from qubell.api.private.user import User if email: user = User.get(self._router, organization=self, email=email) ...
[ "def", "get_user", "(", "self", ",", "id", "=", "None", ",", "name", "=", "None", ",", "email", "=", "None", ")", ":", "log", ".", "info", "(", "\"Picking user: %s (%s) (%s)\"", "%", "(", "name", ",", "email", ",", "id", ")", ")", "from", "qubell", ...
Get user object by email or id.
[ "Get", "user", "object", "by", "email", "or", "id", "." ]
4586ea11d5103c2ff9607d3ed922b5a0991b8845
https://github.com/qubell/contrib-python-qubell-client/blob/4586ea11d5103c2ff9607d3ed922b5a0991b8845/qubell/api/private/organization.py#L513-L522
train
qubell/contrib-python-qubell-client
qubell/api/private/organization.py
Organization.invite
def invite(self, email, roles=None): """ Send invitation to email with a list of roles :param email: :param roles: None or "ALL" or list of role_names :return: """ if roles is None: role_ids = [self.roles['Guest'].roleId] elif roles == "ALL": ...
python
def invite(self, email, roles=None): """ Send invitation to email with a list of roles :param email: :param roles: None or "ALL" or list of role_names :return: """ if roles is None: role_ids = [self.roles['Guest'].roleId] elif roles == "ALL": ...
[ "def", "invite", "(", "self", ",", "email", ",", "roles", "=", "None", ")", ":", "if", "roles", "is", "None", ":", "role_ids", "=", "[", "self", ".", "roles", "[", "'Guest'", "]", ".", "roleId", "]", "elif", "roles", "==", "\"ALL\"", ":", "role_ids...
Send invitation to email with a list of roles :param email: :param roles: None or "ALL" or list of role_names :return:
[ "Send", "invitation", "to", "email", "with", "a", "list", "of", "roles", ":", "param", "email", ":", ":", "param", "roles", ":", "None", "or", "ALL", "or", "list", "of", "role_names", ":", "return", ":" ]
4586ea11d5103c2ff9607d3ed922b5a0991b8845
https://github.com/qubell/contrib-python-qubell-client/blob/4586ea11d5103c2ff9607d3ed922b5a0991b8845/qubell/api/private/organization.py#L528-L547
train
qubell/contrib-python-qubell-client
qubell/api/private/organization.py
Organization.init
def init(self, access_key=None, secret_key=None): """ Mimics wizard's environment preparation """ if not access_key and not secret_key: self._router.post_init(org_id=self.organizationId, data='{"initCloudAccount": true}') else: self._router.post_init(org_i...
python
def init(self, access_key=None, secret_key=None): """ Mimics wizard's environment preparation """ if not access_key and not secret_key: self._router.post_init(org_id=self.organizationId, data='{"initCloudAccount": true}') else: self._router.post_init(org_i...
[ "def", "init", "(", "self", ",", "access_key", "=", "None", ",", "secret_key", "=", "None", ")", ":", "if", "not", "access_key", "and", "not", "secret_key", ":", "self", ".", "_router", ".", "post_init", "(", "org_id", "=", "self", ".", "organizationId",...
Mimics wizard's environment preparation
[ "Mimics", "wizard", "s", "environment", "preparation" ]
4586ea11d5103c2ff9607d3ed922b5a0991b8845
https://github.com/qubell/contrib-python-qubell-client/blob/4586ea11d5103c2ff9607d3ed922b5a0991b8845/qubell/api/private/organization.py#L549-L558
train
qubell/contrib-python-qubell-client
qubell/api/private/organization.py
Organization.set_applications_from_meta
def set_applications_from_meta(self, metadata, exclude=None): """ Parses meta and update or create each application :param str metadata: path or url to meta.yml :param list[str] exclude: List of application names, to exclude from meta. This might be need...
python
def set_applications_from_meta(self, metadata, exclude=None): """ Parses meta and update or create each application :param str metadata: path or url to meta.yml :param list[str] exclude: List of application names, to exclude from meta. This might be need...
[ "def", "set_applications_from_meta", "(", "self", ",", "metadata", ",", "exclude", "=", "None", ")", ":", "if", "not", "exclude", ":", "exclude", "=", "[", "]", "if", "metadata", ".", "startswith", "(", "'http'", ")", ":", "meta", "=", "yaml", ".", "sa...
Parses meta and update or create each application :param str metadata: path or url to meta.yml :param list[str] exclude: List of application names, to exclude from meta. This might be need when you use meta as list of dependencies
[ "Parses", "meta", "and", "update", "or", "create", "each", "application", ":", "param", "str", "metadata", ":", "path", "or", "url", "to", "meta", ".", "yml", ":", "param", "list", "[", "str", "]", "exclude", ":", "List", "of", "application", "names", ...
4586ea11d5103c2ff9607d3ed922b5a0991b8845
https://github.com/qubell/contrib-python-qubell-client/blob/4586ea11d5103c2ff9607d3ed922b5a0991b8845/qubell/api/private/organization.py#L560-L581
train
qubell/contrib-python-qubell-client
qubell/api/private/organization.py
Organization.upload_applications
def upload_applications(self, metadata, category=None): """ Mimics get starter-kit and wizard functionality to create components Note: may create component duplicates, not idempotent :type metadata: str :type category: Category :param metadata: url to meta.yml :pa...
python
def upload_applications(self, metadata, category=None): """ Mimics get starter-kit and wizard functionality to create components Note: may create component duplicates, not idempotent :type metadata: str :type category: Category :param metadata: url to meta.yml :pa...
[ "def", "upload_applications", "(", "self", ",", "metadata", ",", "category", "=", "None", ")", ":", "upload_json", "=", "self", ".", "_router", ".", "get_upload", "(", "params", "=", "dict", "(", "metadataUrl", "=", "metadata", ")", ")", ".", "json", "("...
Mimics get starter-kit and wizard functionality to create components Note: may create component duplicates, not idempotent :type metadata: str :type category: Category :param metadata: url to meta.yml :param category: category
[ "Mimics", "get", "starter", "-", "kit", "and", "wizard", "functionality", "to", "create", "components", "Note", ":", "may", "create", "component", "duplicates", "not", "idempotent", ":", "type", "metadata", ":", "str", ":", "type", "category", ":", "Category",...
4586ea11d5103c2ff9607d3ed922b5a0991b8845
https://github.com/qubell/contrib-python-qubell-client/blob/4586ea11d5103c2ff9607d3ed922b5a0991b8845/qubell/api/private/organization.py#L583-L597
train
Karaage-Cluster/python-tldap
tldap/django/middleware.py
TransactionMiddleware.process_response
def process_response(self, request, response): """Commits and leaves transaction management.""" if tldap.transaction.is_managed(): tldap.transaction.commit() tldap.transaction.leave_transaction_management() return response
python
def process_response(self, request, response): """Commits and leaves transaction management.""" if tldap.transaction.is_managed(): tldap.transaction.commit() tldap.transaction.leave_transaction_management() return response
[ "def", "process_response", "(", "self", ",", "request", ",", "response", ")", ":", "if", "tldap", ".", "transaction", ".", "is_managed", "(", ")", ":", "tldap", ".", "transaction", ".", "commit", "(", ")", "tldap", ".", "transaction", ".", "leave_transacti...
Commits and leaves transaction management.
[ "Commits", "and", "leaves", "transaction", "management", "." ]
61f1af74a3648cb6491e7eeb1ee2eb395d67bf59
https://github.com/Karaage-Cluster/python-tldap/blob/61f1af74a3648cb6491e7eeb1ee2eb395d67bf59/tldap/django/middleware.py#L40-L45
train
MatterMiners/cobald
cobald/monitor/format_line.py
line_protocol
def line_protocol(name, tags: dict = None, fields: dict = None, timestamp: float = None) -> str: """ Format a report as per InfluxDB line protocol :param name: name of the report :param tags: tags identifying the specific report :param fields: measurements of the report :param timestamp: when t...
python
def line_protocol(name, tags: dict = None, fields: dict = None, timestamp: float = None) -> str: """ Format a report as per InfluxDB line protocol :param name: name of the report :param tags: tags identifying the specific report :param fields: measurements of the report :param timestamp: when t...
[ "def", "line_protocol", "(", "name", ",", "tags", ":", "dict", "=", "None", ",", "fields", ":", "dict", "=", "None", ",", "timestamp", ":", "float", "=", "None", ")", "->", "str", ":", "output_str", "=", "name", "if", "tags", ":", "output_str", "+=",...
Format a report as per InfluxDB line protocol :param name: name of the report :param tags: tags identifying the specific report :param fields: measurements of the report :param timestamp: when the measurement was taken, in **seconds** since the epoch
[ "Format", "a", "report", "as", "per", "InfluxDB", "line", "protocol" ]
264138de4382d1c9b53fabcbc6660e10b33a914d
https://github.com/MatterMiners/cobald/blob/264138de4382d1c9b53fabcbc6660e10b33a914d/cobald/monitor/format_line.py#L8-L26
train
developersociety/django-glitter
glitter/page.py
GlitterBlock.block_type
def block_type(self): """ This gets display on the block header. """ return capfirst(force_text( self.content_block.content_type.model_class()._meta.verbose_name ))
python
def block_type(self): """ This gets display on the block header. """ return capfirst(force_text( self.content_block.content_type.model_class()._meta.verbose_name ))
[ "def", "block_type", "(", "self", ")", ":", "return", "capfirst", "(", "force_text", "(", "self", ".", "content_block", ".", "content_type", ".", "model_class", "(", ")", ".", "_meta", ".", "verbose_name", ")", ")" ]
This gets display on the block header.
[ "This", "gets", "display", "on", "the", "block", "header", "." ]
2c0280ec83afee80deee94ee3934fc54239c2e87
https://github.com/developersociety/django-glitter/blob/2c0280ec83afee80deee94ee3934fc54239c2e87/glitter/page.py#L67-L71
train
developersociety/django-glitter
glitter/page.py
GlitterColumn.get_default_blocks
def get_default_blocks(self, top=False): """ Return a list of column default block tuples (URL, verbose name). Used for quick add block buttons. """ default_blocks = [] for block_model, block_name in self.glitter_page.default_blocks: block = apps.get_model(b...
python
def get_default_blocks(self, top=False): """ Return a list of column default block tuples (URL, verbose name). Used for quick add block buttons. """ default_blocks = [] for block_model, block_name in self.glitter_page.default_blocks: block = apps.get_model(b...
[ "def", "get_default_blocks", "(", "self", ",", "top", "=", "False", ")", ":", "default_blocks", "=", "[", "]", "for", "block_model", ",", "block_name", "in", "self", ".", "glitter_page", ".", "default_blocks", ":", "block", "=", "apps", ".", "get_model", "...
Return a list of column default block tuples (URL, verbose name). Used for quick add block buttons.
[ "Return", "a", "list", "of", "column", "default", "block", "tuples", "(", "URL", "verbose", "name", ")", "." ]
2c0280ec83afee80deee94ee3934fc54239c2e87
https://github.com/developersociety/django-glitter/blob/2c0280ec83afee80deee94ee3934fc54239c2e87/glitter/page.py#L150-L174
train
developersociety/django-glitter
glitter/page.py
GlitterColumn.add_block_widget
def add_block_widget(self, top=False): """ Return a select widget for blocks which can be added to this column. """ widget = AddBlockSelect(attrs={ 'class': 'glitter-add-block-select', }, choices=self.add_block_options(top=top)) return widget.render(name='', ...
python
def add_block_widget(self, top=False): """ Return a select widget for blocks which can be added to this column. """ widget = AddBlockSelect(attrs={ 'class': 'glitter-add-block-select', }, choices=self.add_block_options(top=top)) return widget.render(name='', ...
[ "def", "add_block_widget", "(", "self", ",", "top", "=", "False", ")", ":", "widget", "=", "AddBlockSelect", "(", "attrs", "=", "{", "'class'", ":", "'glitter-add-block-select'", ",", "}", ",", "choices", "=", "self", ".", "add_block_options", "(", "top", ...
Return a select widget for blocks which can be added to this column.
[ "Return", "a", "select", "widget", "for", "blocks", "which", "can", "be", "added", "to", "this", "column", "." ]
2c0280ec83afee80deee94ee3934fc54239c2e87
https://github.com/developersociety/django-glitter/blob/2c0280ec83afee80deee94ee3934fc54239c2e87/glitter/page.py#L176-L184
train
developersociety/django-glitter
glitter/page.py
GlitterColumn.add_block_options
def add_block_options(self, top): """ Return a list of URLs and titles for blocks which can be added to this column. All available blocks are grouped by block category. """ from .blockadmin import blocks block_choices = [] # Group all block by category ...
python
def add_block_options(self, top): """ Return a list of URLs and titles for blocks which can be added to this column. All available blocks are grouped by block category. """ from .blockadmin import blocks block_choices = [] # Group all block by category ...
[ "def", "add_block_options", "(", "self", ",", "top", ")", ":", "from", ".", "blockadmin", "import", "blocks", "block_choices", "=", "[", "]", "# Group all block by category", "for", "category", "in", "sorted", "(", "blocks", ".", "site", ".", "block_list", ")"...
Return a list of URLs and titles for blocks which can be added to this column. All available blocks are grouped by block category.
[ "Return", "a", "list", "of", "URLs", "and", "titles", "for", "blocks", "which", "can", "be", "added", "to", "this", "column", "." ]
2c0280ec83afee80deee94ee3934fc54239c2e87
https://github.com/developersociety/django-glitter/blob/2c0280ec83afee80deee94ee3934fc54239c2e87/glitter/page.py#L186-L219
train
developersociety/django-glitter
glitter/page.py
Glitter.default_blocks
def default_blocks(self): """ Return a list of default block tuples (appname.ModelName, verbose name). Next to the dropdown list of block types, a small number of common blocks which are frequently used can be added immediately to a column with one click. This method defines the...
python
def default_blocks(self): """ Return a list of default block tuples (appname.ModelName, verbose name). Next to the dropdown list of block types, a small number of common blocks which are frequently used can be added immediately to a column with one click. This method defines the...
[ "def", "default_blocks", "(", "self", ")", ":", "# Use the block list provided by settings if it's defined", "block_list", "=", "getattr", "(", "settings", ",", "'GLITTER_DEFAULT_BLOCKS'", ",", "None", ")", "if", "block_list", "is", "not", "None", ":", "return", "bloc...
Return a list of default block tuples (appname.ModelName, verbose name). Next to the dropdown list of block types, a small number of common blocks which are frequently used can be added immediately to a column with one click. This method defines the list of default blocks.
[ "Return", "a", "list", "of", "default", "block", "tuples", "(", "appname", ".", "ModelName", "verbose", "name", ")", "." ]
2c0280ec83afee80deee94ee3934fc54239c2e87
https://github.com/developersociety/django-glitter/blob/2c0280ec83afee80deee94ee3934fc54239c2e87/glitter/page.py#L324-L352
train
developersociety/django-glitter
glitter/page.py
Glitter.has_add_permission
def has_add_permission(self): """ Returns a boolean if the current user has permission to add another object of the same type which is being viewed/edited. """ has_permission = False if self.user is not None: # We don't check for the object level permission -...
python
def has_add_permission(self): """ Returns a boolean if the current user has permission to add another object of the same type which is being viewed/edited. """ has_permission = False if self.user is not None: # We don't check for the object level permission -...
[ "def", "has_add_permission", "(", "self", ")", ":", "has_permission", "=", "False", "if", "self", ".", "user", "is", "not", "None", ":", "# We don't check for the object level permission - as the add permission doesn't make", "# sense on a per object level here.", "has_permissi...
Returns a boolean if the current user has permission to add another object of the same type which is being viewed/edited.
[ "Returns", "a", "boolean", "if", "the", "current", "user", "has", "permission", "to", "add", "another", "object", "of", "the", "same", "type", "which", "is", "being", "viewed", "/", "edited", "." ]
2c0280ec83afee80deee94ee3934fc54239c2e87
https://github.com/developersociety/django-glitter/blob/2c0280ec83afee80deee94ee3934fc54239c2e87/glitter/page.py#L354-L368
train
developersociety/django-glitter
glitter/page.py
Glitter.has_change_permission
def has_change_permission(self): """ Returns a boolean if the current user has permission to change the current object being viewed/edited. """ has_permission = False if self.user is not None: # We check for the object level permission here, even though by de...
python
def has_change_permission(self): """ Returns a boolean if the current user has permission to change the current object being viewed/edited. """ has_permission = False if self.user is not None: # We check for the object level permission here, even though by de...
[ "def", "has_change_permission", "(", "self", ")", ":", "has_permission", "=", "False", "if", "self", ".", "user", "is", "not", "None", ":", "# We check for the object level permission here, even though by default the Django", "# admin doesn't. If the Django ModelAdmin is extended...
Returns a boolean if the current user has permission to change the current object being viewed/edited.
[ "Returns", "a", "boolean", "if", "the", "current", "user", "has", "permission", "to", "change", "the", "current", "object", "being", "viewed", "/", "edited", "." ]
2c0280ec83afee80deee94ee3934fc54239c2e87
https://github.com/developersociety/django-glitter/blob/2c0280ec83afee80deee94ee3934fc54239c2e87/glitter/page.py#L370-L387
train
developersociety/django-glitter
glitter/blocks/video/models.py
Video.get_embed_url
def get_embed_url(self): """ Get correct embed url for Youtube or Vimeo. """ embed_url = None youtube_embed_url = 'https://www.youtube.com/embed/{}' vimeo_embed_url = 'https://player.vimeo.com/video/{}' # Get video ID from url. if re.match(YOUTUBE_URL_RE, self.url): ...
python
def get_embed_url(self): """ Get correct embed url for Youtube or Vimeo. """ embed_url = None youtube_embed_url = 'https://www.youtube.com/embed/{}' vimeo_embed_url = 'https://player.vimeo.com/video/{}' # Get video ID from url. if re.match(YOUTUBE_URL_RE, self.url): ...
[ "def", "get_embed_url", "(", "self", ")", ":", "embed_url", "=", "None", "youtube_embed_url", "=", "'https://www.youtube.com/embed/{}'", "vimeo_embed_url", "=", "'https://player.vimeo.com/video/{}'", "# Get video ID from url.", "if", "re", ".", "match", "(", "YOUTUBE_URL_RE...
Get correct embed url for Youtube or Vimeo.
[ "Get", "correct", "embed", "url", "for", "Youtube", "or", "Vimeo", "." ]
2c0280ec83afee80deee94ee3934fc54239c2e87
https://github.com/developersociety/django-glitter/blob/2c0280ec83afee80deee94ee3934fc54239c2e87/glitter/blocks/video/models.py#L22-L33
train
developersociety/django-glitter
glitter/blocks/video/models.py
Video.save
def save(self, force_insert=False, force_update=False, using=None, update_fields=None): """ Set html field with correct iframe. """ if self.url: iframe_html = '<iframe src="{}" frameborder="0" title="{}" allowfullscreen></iframe>' self.html = iframe_html.format( s...
python
def save(self, force_insert=False, force_update=False, using=None, update_fields=None): """ Set html field with correct iframe. """ if self.url: iframe_html = '<iframe src="{}" frameborder="0" title="{}" allowfullscreen></iframe>' self.html = iframe_html.format( s...
[ "def", "save", "(", "self", ",", "force_insert", "=", "False", ",", "force_update", "=", "False", ",", "using", "=", "None", ",", "update_fields", "=", "None", ")", ":", "if", "self", ".", "url", ":", "iframe_html", "=", "'<iframe src=\"{}\" frameborder=\"0\...
Set html field with correct iframe.
[ "Set", "html", "field", "with", "correct", "iframe", "." ]
2c0280ec83afee80deee94ee3934fc54239c2e87
https://github.com/developersociety/django-glitter/blob/2c0280ec83afee80deee94ee3934fc54239c2e87/glitter/blocks/video/models.py#L35-L43
train
bgruening/galaxy_ie_helpers
galaxy_ie_helpers/__init__.py
_get_ip
def _get_ip(): """Get IP address for the docker host """ cmd_netstat = ['netstat', '-nr'] p1 = subprocess.Popen(cmd_netstat, stdout=subprocess.PIPE) cmd_grep = ['grep', '^0\.0\.0\.0'] p2 = subprocess.Popen(cmd_grep, stdin=p1.stdout, stdout=subprocess.PIPE) cmd_awk = ['awk', '{ print $2 }'] ...
python
def _get_ip(): """Get IP address for the docker host """ cmd_netstat = ['netstat', '-nr'] p1 = subprocess.Popen(cmd_netstat, stdout=subprocess.PIPE) cmd_grep = ['grep', '^0\.0\.0\.0'] p2 = subprocess.Popen(cmd_grep, stdin=p1.stdout, stdout=subprocess.PIPE) cmd_awk = ['awk', '{ print $2 }'] ...
[ "def", "_get_ip", "(", ")", ":", "cmd_netstat", "=", "[", "'netstat'", ",", "'-nr'", "]", "p1", "=", "subprocess", ".", "Popen", "(", "cmd_netstat", ",", "stdout", "=", "subprocess", ".", "PIPE", ")", "cmd_grep", "=", "[", "'grep'", ",", "'^0\\.0\\.0\\.0...
Get IP address for the docker host
[ "Get", "IP", "address", "for", "the", "docker", "host" ]
22d0f77d9e35297e0e6ca4136d5057409699d137
https://github.com/bgruening/galaxy_ie_helpers/blob/22d0f77d9e35297e0e6ca4136d5057409699d137/galaxy_ie_helpers/__init__.py#L18-L29
train
bgruening/galaxy_ie_helpers
galaxy_ie_helpers/__init__.py
get_galaxy_connection
def get_galaxy_connection(history_id=None, obj=True): """ Given access to the configuration dict that galaxy passed us, we try and connect to galaxy's API. First we try connecting to galaxy directly, using an IP address given us by docker (since the galaxy host is the default gateway for doc...
python
def get_galaxy_connection(history_id=None, obj=True): """ Given access to the configuration dict that galaxy passed us, we try and connect to galaxy's API. First we try connecting to galaxy directly, using an IP address given us by docker (since the galaxy host is the default gateway for doc...
[ "def", "get_galaxy_connection", "(", "history_id", "=", "None", ",", "obj", "=", "True", ")", ":", "history_id", "=", "history_id", "or", "os", ".", "environ", "[", "'HISTORY_ID'", "]", "key", "=", "os", ".", "environ", "[", "'API_KEY'", "]", "### Customis...
Given access to the configuration dict that galaxy passed us, we try and connect to galaxy's API. First we try connecting to galaxy directly, using an IP address given us by docker (since the galaxy host is the default gateway for docker). Using additional information collected by galaxy like th...
[ "Given", "access", "to", "the", "configuration", "dict", "that", "galaxy", "passed", "us", "we", "try", "and", "connect", "to", "galaxy", "s", "API", ".", "First", "we", "try", "connecting", "to", "galaxy", "directly", "using", "an", "IP", "address", "give...
22d0f77d9e35297e0e6ca4136d5057409699d137
https://github.com/bgruening/galaxy_ie_helpers/blob/22d0f77d9e35297e0e6ca4136d5057409699d137/galaxy_ie_helpers/__init__.py#L50-L99
train
bgruening/galaxy_ie_helpers
galaxy_ie_helpers/__init__.py
put
def put(filenames, file_type='auto', history_id=None): """ Given filename[s] of any file accessible to the docker instance, this function will upload that file[s] to galaxy using the current history. Does not return anything. """ history_id = history_id or os.environ['HISTORY_ID'] ...
python
def put(filenames, file_type='auto', history_id=None): """ Given filename[s] of any file accessible to the docker instance, this function will upload that file[s] to galaxy using the current history. Does not return anything. """ history_id = history_id or os.environ['HISTORY_ID'] ...
[ "def", "put", "(", "filenames", ",", "file_type", "=", "'auto'", ",", "history_id", "=", "None", ")", ":", "history_id", "=", "history_id", "or", "os", ".", "environ", "[", "'HISTORY_ID'", "]", "gi", "=", "get_galaxy_connection", "(", "history_id", "=", "h...
Given filename[s] of any file accessible to the docker instance, this function will upload that file[s] to galaxy using the current history. Does not return anything.
[ "Given", "filename", "[", "s", "]", "of", "any", "file", "accessible", "to", "the", "docker", "instance", "this", "function", "will", "upload", "that", "file", "[", "s", "]", "to", "galaxy", "using", "the", "current", "history", ".", "Does", "not", "retu...
22d0f77d9e35297e0e6ca4136d5057409699d137
https://github.com/bgruening/galaxy_ie_helpers/blob/22d0f77d9e35297e0e6ca4136d5057409699d137/galaxy_ie_helpers/__init__.py#L102-L113
train
bgruening/galaxy_ie_helpers
galaxy_ie_helpers/__init__.py
get
def get(datasets_identifiers, identifier_type='hid', history_id=None): """ Given the history_id that is displayed to the user, this function will download the file[s] from the history and stores them under /import/ Return value[s] are the path[s] to the dataset[s] stored under /import/ "...
python
def get(datasets_identifiers, identifier_type='hid', history_id=None): """ Given the history_id that is displayed to the user, this function will download the file[s] from the history and stores them under /import/ Return value[s] are the path[s] to the dataset[s] stored under /import/ "...
[ "def", "get", "(", "datasets_identifiers", ",", "identifier_type", "=", "'hid'", ",", "history_id", "=", "None", ")", ":", "history_id", "=", "history_id", "or", "os", ".", "environ", "[", "'HISTORY_ID'", "]", "# The object version of bioblend is to slow in retrieving...
Given the history_id that is displayed to the user, this function will download the file[s] from the history and stores them under /import/ Return value[s] are the path[s] to the dataset[s] stored under /import/
[ "Given", "the", "history_id", "that", "is", "displayed", "to", "the", "user", "this", "function", "will", "download", "the", "file", "[", "s", "]", "from", "the", "history", "and", "stores", "them", "under", "/", "import", "/", "Return", "value", "[", "s...
22d0f77d9e35297e0e6ca4136d5057409699d137
https://github.com/bgruening/galaxy_ie_helpers/blob/22d0f77d9e35297e0e6ca4136d5057409699d137/galaxy_ie_helpers/__init__.py#L116-L143
train
bgruening/galaxy_ie_helpers
galaxy_ie_helpers/__init__.py
get_user_history
def get_user_history (history_id=None): """ Get all visible dataset infos of user history. Return a list of dict of each dataset. """ history_id = history_id or os.environ['HISTORY_ID'] gi = get_galaxy_connection(history_id=history_id, obj=False) hc = HistoryClient(gi) history = h...
python
def get_user_history (history_id=None): """ Get all visible dataset infos of user history. Return a list of dict of each dataset. """ history_id = history_id or os.environ['HISTORY_ID'] gi = get_galaxy_connection(history_id=history_id, obj=False) hc = HistoryClient(gi) history = h...
[ "def", "get_user_history", "(", "history_id", "=", "None", ")", ":", "history_id", "=", "history_id", "or", "os", ".", "environ", "[", "'HISTORY_ID'", "]", "gi", "=", "get_galaxy_connection", "(", "history_id", "=", "history_id", ",", "obj", "=", "False", ")...
Get all visible dataset infos of user history. Return a list of dict of each dataset.
[ "Get", "all", "visible", "dataset", "infos", "of", "user", "history", ".", "Return", "a", "list", "of", "dict", "of", "each", "dataset", "." ]
22d0f77d9e35297e0e6ca4136d5057409699d137
https://github.com/bgruening/galaxy_ie_helpers/blob/22d0f77d9e35297e0e6ca4136d5057409699d137/galaxy_ie_helpers/__init__.py#L145-L154
train
jamescooke/flake8-aaa
src/flake8_aaa/block.py
Block.build_act
def build_act(cls: Type[_Block], node: ast.stmt, test_func_node: ast.FunctionDef) -> _Block: """ Act block is a single node - either the act node itself, or the node that wraps the act node. """ add_node_parents(test_func_node) # Walk up the parent nodes of the parent nod...
python
def build_act(cls: Type[_Block], node: ast.stmt, test_func_node: ast.FunctionDef) -> _Block: """ Act block is a single node - either the act node itself, or the node that wraps the act node. """ add_node_parents(test_func_node) # Walk up the parent nodes of the parent nod...
[ "def", "build_act", "(", "cls", ":", "Type", "[", "_Block", "]", ",", "node", ":", "ast", ".", "stmt", ",", "test_func_node", ":", "ast", ".", "FunctionDef", ")", "->", "_Block", ":", "add_node_parents", "(", "test_func_node", ")", "# Walk up the parent node...
Act block is a single node - either the act node itself, or the node that wraps the act node.
[ "Act", "block", "is", "a", "single", "node", "-", "either", "the", "act", "node", "itself", "or", "the", "node", "that", "wraps", "the", "act", "node", "." ]
29938b96845fe32ced4358ba66af3b3be2a37794
https://github.com/jamescooke/flake8-aaa/blob/29938b96845fe32ced4358ba66af3b3be2a37794/src/flake8_aaa/block.py#L29-L39
train
jamescooke/flake8-aaa
src/flake8_aaa/block.py
Block.build_arrange
def build_arrange(cls: Type[_Block], nodes: List[ast.stmt], max_line_number: int) -> _Block: """ Arrange block is all non-pass and non-docstring nodes before the Act block start. """ return cls(filter_arrange_nodes(nodes, max_line_number), LineType.arrange)
python
def build_arrange(cls: Type[_Block], nodes: List[ast.stmt], max_line_number: int) -> _Block: """ Arrange block is all non-pass and non-docstring nodes before the Act block start. """ return cls(filter_arrange_nodes(nodes, max_line_number), LineType.arrange)
[ "def", "build_arrange", "(", "cls", ":", "Type", "[", "_Block", "]", ",", "nodes", ":", "List", "[", "ast", ".", "stmt", "]", ",", "max_line_number", ":", "int", ")", "->", "_Block", ":", "return", "cls", "(", "filter_arrange_nodes", "(", "nodes", ",",...
Arrange block is all non-pass and non-docstring nodes before the Act block start.
[ "Arrange", "block", "is", "all", "non", "-", "pass", "and", "non", "-", "docstring", "nodes", "before", "the", "Act", "block", "start", "." ]
29938b96845fe32ced4358ba66af3b3be2a37794
https://github.com/jamescooke/flake8-aaa/blob/29938b96845fe32ced4358ba66af3b3be2a37794/src/flake8_aaa/block.py#L42-L47
train
jamescooke/flake8-aaa
src/flake8_aaa/block.py
Block.build_assert
def build_assert(cls: Type[_Block], nodes: List[ast.stmt], min_line_number: int) -> _Block: """ Assert block is all nodes that are after the Act node. Note: The filtering is *still* running off the line number of the Act node, when instead it should be using the last lin...
python
def build_assert(cls: Type[_Block], nodes: List[ast.stmt], min_line_number: int) -> _Block: """ Assert block is all nodes that are after the Act node. Note: The filtering is *still* running off the line number of the Act node, when instead it should be using the last lin...
[ "def", "build_assert", "(", "cls", ":", "Type", "[", "_Block", "]", ",", "nodes", ":", "List", "[", "ast", ".", "stmt", "]", ",", "min_line_number", ":", "int", ")", "->", "_Block", ":", "return", "cls", "(", "filter_assert_nodes", "(", "nodes", ",", ...
Assert block is all nodes that are after the Act node. Note: The filtering is *still* running off the line number of the Act node, when instead it should be using the last line of the Act block.
[ "Assert", "block", "is", "all", "nodes", "that", "are", "after", "the", "Act", "node", "." ]
29938b96845fe32ced4358ba66af3b3be2a37794
https://github.com/jamescooke/flake8-aaa/blob/29938b96845fe32ced4358ba66af3b3be2a37794/src/flake8_aaa/block.py#L50-L59
train
jamescooke/flake8-aaa
src/flake8_aaa/block.py
Block.get_span
def get_span(self, first_line_no: int) -> Tuple[int, int]: """ Raises: EmptyBlock: when block has no nodes """ if not self.nodes: raise EmptyBlock('span requested from {} block with no nodes'.format(self.line_type)) return ( get_first_token(sel...
python
def get_span(self, first_line_no: int) -> Tuple[int, int]: """ Raises: EmptyBlock: when block has no nodes """ if not self.nodes: raise EmptyBlock('span requested from {} block with no nodes'.format(self.line_type)) return ( get_first_token(sel...
[ "def", "get_span", "(", "self", ",", "first_line_no", ":", "int", ")", "->", "Tuple", "[", "int", ",", "int", "]", ":", "if", "not", "self", ".", "nodes", ":", "raise", "EmptyBlock", "(", "'span requested from {} block with no nodes'", ".", "format", "(", ...
Raises: EmptyBlock: when block has no nodes
[ "Raises", ":", "EmptyBlock", ":", "when", "block", "has", "no", "nodes" ]
29938b96845fe32ced4358ba66af3b3be2a37794
https://github.com/jamescooke/flake8-aaa/blob/29938b96845fe32ced4358ba66af3b3be2a37794/src/flake8_aaa/block.py#L61-L71
train
josiah-wolf-oberholtzer/uqbar
uqbar/cli/CLIAggregator.py
CLIAggregator.cli_aliases
def cli_aliases(self): r"""Developer script aliases. """ scripting_groups = [] aliases = {} for cli_class in self.cli_classes: instance = cli_class() if getattr(instance, "alias", None): scripting_group = getattr(instance, "scripting_group"...
python
def cli_aliases(self): r"""Developer script aliases. """ scripting_groups = [] aliases = {} for cli_class in self.cli_classes: instance = cli_class() if getattr(instance, "alias", None): scripting_group = getattr(instance, "scripting_group"...
[ "def", "cli_aliases", "(", "self", ")", ":", "scripting_groups", "=", "[", "]", "aliases", "=", "{", "}", "for", "cli_class", "in", "self", ".", "cli_classes", ":", "instance", "=", "cli_class", "(", ")", "if", "getattr", "(", "instance", ",", "\"alias\"...
r"""Developer script aliases.
[ "r", "Developer", "script", "aliases", "." ]
eca7fefebbbee1e2ae13bf5d6baa838be66b1db6
https://github.com/josiah-wolf-oberholtzer/uqbar/blob/eca7fefebbbee1e2ae13bf5d6baa838be66b1db6/uqbar/cli/CLIAggregator.py#L160-L213
train
josiah-wolf-oberholtzer/uqbar
uqbar/cli/CLIAggregator.py
CLIAggregator.cli_program_names
def cli_program_names(self): r"""Developer script program names. """ program_names = {} for cli_class in self.cli_classes: instance = cli_class() program_names[instance.program_name] = cli_class return program_names
python
def cli_program_names(self): r"""Developer script program names. """ program_names = {} for cli_class in self.cli_classes: instance = cli_class() program_names[instance.program_name] = cli_class return program_names
[ "def", "cli_program_names", "(", "self", ")", ":", "program_names", "=", "{", "}", "for", "cli_class", "in", "self", ".", "cli_classes", ":", "instance", "=", "cli_class", "(", ")", "program_names", "[", "instance", ".", "program_name", "]", "=", "cli_class"...
r"""Developer script program names.
[ "r", "Developer", "script", "program", "names", "." ]
eca7fefebbbee1e2ae13bf5d6baa838be66b1db6
https://github.com/josiah-wolf-oberholtzer/uqbar/blob/eca7fefebbbee1e2ae13bf5d6baa838be66b1db6/uqbar/cli/CLIAggregator.py#L222-L229
train
xenadevel/PyXenaManager
xenamanager/xena_statistics_view.py
XenaStats.get_flat_stats
def get_flat_stats(self): """ :return: statistics as flat table {port/strea,/tpld name {group_stat name: value}} """ flat_stats = OrderedDict() for obj, port_stats in self.statistics.items(): flat_obj_stats = OrderedDict() for group_name, group_values in p...
python
def get_flat_stats(self): """ :return: statistics as flat table {port/strea,/tpld name {group_stat name: value}} """ flat_stats = OrderedDict() for obj, port_stats in self.statistics.items(): flat_obj_stats = OrderedDict() for group_name, group_values in p...
[ "def", "get_flat_stats", "(", "self", ")", ":", "flat_stats", "=", "OrderedDict", "(", ")", "for", "obj", ",", "port_stats", "in", "self", ".", "statistics", ".", "items", "(", ")", ":", "flat_obj_stats", "=", "OrderedDict", "(", ")", "for", "group_name", ...
:return: statistics as flat table {port/strea,/tpld name {group_stat name: value}}
[ ":", "return", ":", "statistics", "as", "flat", "table", "{", "port", "/", "strea", "/", "tpld", "name", "{", "group_stat", "name", ":", "value", "}}" ]
384ca265f73044b8a8b471f5dd7a6103fc54f4df
https://github.com/xenadevel/PyXenaManager/blob/384ca265f73044b8a8b471f5dd7a6103fc54f4df/xenamanager/xena_statistics_view.py#L27-L39
train
xenadevel/PyXenaManager
xenamanager/xena_statistics_view.py
XenaPortsStats.read_stats
def read_stats(self): """ Read current ports statistics from chassis. :return: dictionary {port name {group name, {stat name: stat value}}} """ self.statistics = TgnObjectsDict() for port in self.session.ports.values(): self.statistics[port] = port.read_port_stats()...
python
def read_stats(self): """ Read current ports statistics from chassis. :return: dictionary {port name {group name, {stat name: stat value}}} """ self.statistics = TgnObjectsDict() for port in self.session.ports.values(): self.statistics[port] = port.read_port_stats()...
[ "def", "read_stats", "(", "self", ")", ":", "self", ".", "statistics", "=", "TgnObjectsDict", "(", ")", "for", "port", "in", "self", ".", "session", ".", "ports", ".", "values", "(", ")", ":", "self", ".", "statistics", "[", "port", "]", "=", "port",...
Read current ports statistics from chassis. :return: dictionary {port name {group name, {stat name: stat value}}}
[ "Read", "current", "ports", "statistics", "from", "chassis", "." ]
384ca265f73044b8a8b471f5dd7a6103fc54f4df
https://github.com/xenadevel/PyXenaManager/blob/384ca265f73044b8a8b471f5dd7a6103fc54f4df/xenamanager/xena_statistics_view.py#L58-L67
train
xenadevel/PyXenaManager
xenamanager/xena_statistics_view.py
XenaStreamsStats.read_stats
def read_stats(self): """ Read current statistics from chassis. :return: dictionary {stream: {tx: {stat name: stat value}} rx: {tpld: {stat group {stat name: value}}}} """ self.tx_statistics = TgnObjectsDict() for port in self.session.ports.values(): for stream in p...
python
def read_stats(self): """ Read current statistics from chassis. :return: dictionary {stream: {tx: {stat name: stat value}} rx: {tpld: {stat group {stat name: value}}}} """ self.tx_statistics = TgnObjectsDict() for port in self.session.ports.values(): for stream in p...
[ "def", "read_stats", "(", "self", ")", ":", "self", ".", "tx_statistics", "=", "TgnObjectsDict", "(", ")", "for", "port", "in", "self", ".", "session", ".", "ports", ".", "values", "(", ")", ":", "for", "stream", "in", "port", ".", "streams", ".", "v...
Read current statistics from chassis. :return: dictionary {stream: {tx: {stat name: stat value}} rx: {tpld: {stat group {stat name: value}}}}
[ "Read", "current", "statistics", "from", "chassis", "." ]
384ca265f73044b8a8b471f5dd7a6103fc54f4df
https://github.com/xenadevel/PyXenaManager/blob/384ca265f73044b8a8b471f5dd7a6103fc54f4df/xenamanager/xena_statistics_view.py#L90-L112
train
xenadevel/PyXenaManager
xenamanager/xena_statistics_view.py
XenaTpldsStats.read_stats
def read_stats(self): """ Read current statistics from chassis. :return: dictionary {tpld full index {group name {stat name: stat value}}} """ self.statistics = TgnObjectsDict() for port in self.session.ports.values(): for tpld in port.tplds.values(): ...
python
def read_stats(self): """ Read current statistics from chassis. :return: dictionary {tpld full index {group name {stat name: stat value}}} """ self.statistics = TgnObjectsDict() for port in self.session.ports.values(): for tpld in port.tplds.values(): ...
[ "def", "read_stats", "(", "self", ")", ":", "self", ".", "statistics", "=", "TgnObjectsDict", "(", ")", "for", "port", "in", "self", ".", "session", ".", "ports", ".", "values", "(", ")", ":", "for", "tpld", "in", "port", ".", "tplds", ".", "values",...
Read current statistics from chassis. :return: dictionary {tpld full index {group name {stat name: stat value}}}
[ "Read", "current", "statistics", "from", "chassis", "." ]
384ca265f73044b8a8b471f5dd7a6103fc54f4df
https://github.com/xenadevel/PyXenaManager/blob/384ca265f73044b8a8b471f5dd7a6103fc54f4df/xenamanager/xena_statistics_view.py#L134-L144
train
quizl/quizler
quizler/utils.py
get_user_sets
def get_user_sets(client_id, user_id): """Find all user sets.""" data = api_call('get', 'users/{}/sets'.format(user_id), client_id=client_id) return [WordSet.from_dict(wordset) for wordset in data]
python
def get_user_sets(client_id, user_id): """Find all user sets.""" data = api_call('get', 'users/{}/sets'.format(user_id), client_id=client_id) return [WordSet.from_dict(wordset) for wordset in data]
[ "def", "get_user_sets", "(", "client_id", ",", "user_id", ")", ":", "data", "=", "api_call", "(", "'get'", ",", "'users/{}/sets'", ".", "format", "(", "user_id", ")", ",", "client_id", "=", "client_id", ")", "return", "[", "WordSet", ".", "from_dict", "(",...
Find all user sets.
[ "Find", "all", "user", "sets", "." ]
44b3fd91f7074e7013ffde8147455f45ebdccc46
https://github.com/quizl/quizler/blob/44b3fd91f7074e7013ffde8147455f45ebdccc46/quizler/utils.py#L10-L13
train
quizl/quizler
quizler/utils.py
print_user_sets
def print_user_sets(wordsets, print_terms): """Print all user sets by title. If 'print_terms', also prints all terms of all user sets. :param wordsets: List of WordSet. :param print_terms: If True, also prints all terms of all user sets. """ if not wordsets: print('No sets found') else: ...
python
def print_user_sets(wordsets, print_terms): """Print all user sets by title. If 'print_terms', also prints all terms of all user sets. :param wordsets: List of WordSet. :param print_terms: If True, also prints all terms of all user sets. """ if not wordsets: print('No sets found') else: ...
[ "def", "print_user_sets", "(", "wordsets", ",", "print_terms", ")", ":", "if", "not", "wordsets", ":", "print", "(", "'No sets found'", ")", "else", ":", "print", "(", "'Found sets: {}'", ".", "format", "(", "len", "(", "wordsets", ")", ")", ")", "for", ...
Print all user sets by title. If 'print_terms', also prints all terms of all user sets. :param wordsets: List of WordSet. :param print_terms: If True, also prints all terms of all user sets.
[ "Print", "all", "user", "sets", "by", "title", ".", "If", "print_terms", "also", "prints", "all", "terms", "of", "all", "user", "sets", ".", ":", "param", "wordsets", ":", "List", "of", "WordSet", ".", ":", "param", "print_terms", ":", "If", "True", "a...
44b3fd91f7074e7013ffde8147455f45ebdccc46
https://github.com/quizl/quizler/blob/44b3fd91f7074e7013ffde8147455f45ebdccc46/quizler/utils.py#L16-L29
train
quizl/quizler
quizler/utils.py
get_common_terms
def get_common_terms(*api_envs): """Get all term duplicates across all user word sets as a list of (title of first word set, title of second word set, set of terms) tuples.""" common_terms = [] # pylint: disable=no-value-for-parameter wordsets = get_user_sets(*api_envs) # pylint: enable=no-value...
python
def get_common_terms(*api_envs): """Get all term duplicates across all user word sets as a list of (title of first word set, title of second word set, set of terms) tuples.""" common_terms = [] # pylint: disable=no-value-for-parameter wordsets = get_user_sets(*api_envs) # pylint: enable=no-value...
[ "def", "get_common_terms", "(", "*", "api_envs", ")", ":", "common_terms", "=", "[", "]", "# pylint: disable=no-value-for-parameter", "wordsets", "=", "get_user_sets", "(", "*", "api_envs", ")", "# pylint: enable=no-value-for-parameter", "for", "wordset1", ",", "wordset...
Get all term duplicates across all user word sets as a list of (title of first word set, title of second word set, set of terms) tuples.
[ "Get", "all", "term", "duplicates", "across", "all", "user", "word", "sets", "as", "a", "list", "of", "(", "title", "of", "first", "word", "set", "title", "of", "second", "word", "set", "set", "of", "terms", ")", "tuples", "." ]
44b3fd91f7074e7013ffde8147455f45ebdccc46
https://github.com/quizl/quizler/blob/44b3fd91f7074e7013ffde8147455f45ebdccc46/quizler/utils.py#L32-L44
train
quizl/quizler
quizler/utils.py
print_common_terms
def print_common_terms(common_terms): """Print common terms for each pair of word sets. :param common_terms: Output of get_common_terms(). """ if not common_terms: print('No duplicates') else: for set_pair in common_terms: set1, set2, terms = set_pair print('{...
python
def print_common_terms(common_terms): """Print common terms for each pair of word sets. :param common_terms: Output of get_common_terms(). """ if not common_terms: print('No duplicates') else: for set_pair in common_terms: set1, set2, terms = set_pair print('{...
[ "def", "print_common_terms", "(", "common_terms", ")", ":", "if", "not", "common_terms", ":", "print", "(", "'No duplicates'", ")", "else", ":", "for", "set_pair", "in", "common_terms", ":", "set1", ",", "set2", ",", "terms", "=", "set_pair", "print", "(", ...
Print common terms for each pair of word sets. :param common_terms: Output of get_common_terms().
[ "Print", "common", "terms", "for", "each", "pair", "of", "word", "sets", ".", ":", "param", "common_terms", ":", "Output", "of", "get_common_terms", "()", "." ]
44b3fd91f7074e7013ffde8147455f45ebdccc46
https://github.com/quizl/quizler/blob/44b3fd91f7074e7013ffde8147455f45ebdccc46/quizler/utils.py#L47-L58
train
quizl/quizler
quizler/utils.py
delete_term
def delete_term(set_id, term_id, access_token): """Delete the given term.""" api_call('delete', 'sets/{}/terms/{}'.format(set_id, term_id), access_token=access_token)
python
def delete_term(set_id, term_id, access_token): """Delete the given term.""" api_call('delete', 'sets/{}/terms/{}'.format(set_id, term_id), access_token=access_token)
[ "def", "delete_term", "(", "set_id", ",", "term_id", ",", "access_token", ")", ":", "api_call", "(", "'delete'", ",", "'sets/{}/terms/{}'", ".", "format", "(", "set_id", ",", "term_id", ")", ",", "access_token", "=", "access_token", ")" ]
Delete the given term.
[ "Delete", "the", "given", "term", "." ]
44b3fd91f7074e7013ffde8147455f45ebdccc46
https://github.com/quizl/quizler/blob/44b3fd91f7074e7013ffde8147455f45ebdccc46/quizler/utils.py#L61-L63
train
quizl/quizler
quizler/utils.py
add_term
def add_term(set_id, term, access_token): """Add the given term to the given set. :param term: Instance of Term. """ api_call('post', 'sets/{}/terms'.format(set_id), term.to_dict(), access_token=access_token)
python
def add_term(set_id, term, access_token): """Add the given term to the given set. :param term: Instance of Term. """ api_call('post', 'sets/{}/terms'.format(set_id), term.to_dict(), access_token=access_token)
[ "def", "add_term", "(", "set_id", ",", "term", ",", "access_token", ")", ":", "api_call", "(", "'post'", ",", "'sets/{}/terms'", ".", "format", "(", "set_id", ")", ",", "term", ".", "to_dict", "(", ")", ",", "access_token", "=", "access_token", ")" ]
Add the given term to the given set. :param term: Instance of Term.
[ "Add", "the", "given", "term", "to", "the", "given", "set", ".", ":", "param", "term", ":", "Instance", "of", "Term", "." ]
44b3fd91f7074e7013ffde8147455f45ebdccc46
https://github.com/quizl/quizler/blob/44b3fd91f7074e7013ffde8147455f45ebdccc46/quizler/utils.py#L66-L70
train
quizl/quizler
quizler/utils.py
reset_term_stats
def reset_term_stats(set_id, term_id, client_id, user_id, access_token): """Reset the stats of a term by deleting and re-creating it.""" found_sets = [user_set for user_set in get_user_sets(client_id, user_id) if user_set.set_id == set_id] if len(found_sets) != 1: raise ValueError(...
python
def reset_term_stats(set_id, term_id, client_id, user_id, access_token): """Reset the stats of a term by deleting and re-creating it.""" found_sets = [user_set for user_set in get_user_sets(client_id, user_id) if user_set.set_id == set_id] if len(found_sets) != 1: raise ValueError(...
[ "def", "reset_term_stats", "(", "set_id", ",", "term_id", ",", "client_id", ",", "user_id", ",", "access_token", ")", ":", "found_sets", "=", "[", "user_set", "for", "user_set", "in", "get_user_sets", "(", "client_id", ",", "user_id", ")", "if", "user_set", ...
Reset the stats of a term by deleting and re-creating it.
[ "Reset", "the", "stats", "of", "a", "term", "by", "deleting", "and", "re", "-", "creating", "it", "." ]
44b3fd91f7074e7013ffde8147455f45ebdccc46
https://github.com/quizl/quizler/blob/44b3fd91f7074e7013ffde8147455f45ebdccc46/quizler/utils.py#L73-L94
train
davidblaisonneau-orange/foreman
foreman/hosts.py
Hosts.createController
def createController(self, key, attributes, ipmi, printer=False): """ Function createController Create a controller node @param key: The host name or ID @param attributes:The payload of the host creation @param printer: - False for no creation progression message ...
python
def createController(self, key, attributes, ipmi, printer=False): """ Function createController Create a controller node @param key: The host name or ID @param attributes:The payload of the host creation @param printer: - False for no creation progression message ...
[ "def", "createController", "(", "self", ",", "key", ",", "attributes", ",", "ipmi", ",", "printer", "=", "False", ")", ":", "if", "key", "not", "in", "self", ":", "self", ".", "printer", "=", "printer", "self", ".", "async", "=", "False", "# Create the...
Function createController Create a controller node @param key: The host name or ID @param attributes:The payload of the host creation @param printer: - False for no creation progression message - True to get creation progression printed on STDOUT ...
[ "Function", "createController", "Create", "a", "controller", "node" ]
acb8fd8d74657cfac3b25c82e9c6028b93eb6c92
https://github.com/davidblaisonneau-orange/foreman/blob/acb8fd8d74657cfac3b25c82e9c6028b93eb6c92/foreman/hosts.py#L50-L77
train
davidblaisonneau-orange/foreman
foreman/hosts.py
Hosts.waitPuppetCatalogToBeApplied
def waitPuppetCatalogToBeApplied(self, key, sleepTime=5): """ Function waitPuppetCatalogToBeApplied Wait for puppet catalog to be applied @param key: The host name or ID @return RETURN: None """ # Wait for puppet catalog to be applied loop_stop = False wh...
python
def waitPuppetCatalogToBeApplied(self, key, sleepTime=5): """ Function waitPuppetCatalogToBeApplied Wait for puppet catalog to be applied @param key: The host name or ID @return RETURN: None """ # Wait for puppet catalog to be applied loop_stop = False wh...
[ "def", "waitPuppetCatalogToBeApplied", "(", "self", ",", "key", ",", "sleepTime", "=", "5", ")", ":", "# Wait for puppet catalog to be applied", "loop_stop", "=", "False", "while", "not", "loop_stop", ":", "status", "=", "self", "[", "key", "]", ".", "getStatus"...
Function waitPuppetCatalogToBeApplied Wait for puppet catalog to be applied @param key: The host name or ID @return RETURN: None
[ "Function", "waitPuppetCatalogToBeApplied", "Wait", "for", "puppet", "catalog", "to", "be", "applied" ]
acb8fd8d74657cfac3b25c82e9c6028b93eb6c92
https://github.com/davidblaisonneau-orange/foreman/blob/acb8fd8d74657cfac3b25c82e9c6028b93eb6c92/foreman/hosts.py#L79-L105
train
davidblaisonneau-orange/foreman
foreman/hosts.py
Hosts.createVM
def createVM(self, key, attributes, printer=False): """ Function createVM Create a Virtual Machine The creation of a VM with libVirt is a bit complexe. We first create the element in foreman, the ask to start before the result of the creation. To do so, we make async cal...
python
def createVM(self, key, attributes, printer=False): """ Function createVM Create a Virtual Machine The creation of a VM with libVirt is a bit complexe. We first create the element in foreman, the ask to start before the result of the creation. To do so, we make async cal...
[ "def", "createVM", "(", "self", ",", "key", ",", "attributes", ",", "printer", "=", "False", ")", ":", "self", ".", "printer", "=", "printer", "self", ".", "async", "=", "False", "# Create the VM in foreman", "# NOTA: with 1.8 it will return 422 'Failed to login via...
Function createVM Create a Virtual Machine The creation of a VM with libVirt is a bit complexe. We first create the element in foreman, the ask to start before the result of the creation. To do so, we make async calls to the API and check the results @param key: The hos...
[ "Function", "createVM", "Create", "a", "Virtual", "Machine" ]
acb8fd8d74657cfac3b25c82e9c6028b93eb6c92
https://github.com/davidblaisonneau-orange/foreman/blob/acb8fd8d74657cfac3b25c82e9c6028b93eb6c92/foreman/hosts.py#L107-L174
train
qubell/contrib-python-qubell-client
qubell/api/private/user.py
User.get
def get(router, organization, email): """ :rtype: User """ log.info("Getting user: %s" % email) resp = router.get_users(org_id=organization.id).json() ids = [x['id'] for x in resp if x['email'] == email] if len(ids): user = User(organization, ids[0]).i...
python
def get(router, organization, email): """ :rtype: User """ log.info("Getting user: %s" % email) resp = router.get_users(org_id=organization.id).json() ids = [x['id'] for x in resp if x['email'] == email] if len(ids): user = User(organization, ids[0]).i...
[ "def", "get", "(", "router", ",", "organization", ",", "email", ")", ":", "log", ".", "info", "(", "\"Getting user: %s\"", "%", "email", ")", "resp", "=", "router", ".", "get_users", "(", "org_id", "=", "organization", ".", "id", ")", ".", "json", "(",...
:rtype: User
[ ":", "rtype", ":", "User" ]
4586ea11d5103c2ff9607d3ed922b5a0991b8845
https://github.com/qubell/contrib-python-qubell-client/blob/4586ea11d5103c2ff9607d3ed922b5a0991b8845/qubell/api/private/user.py#L37-L48
train
MatterMiners/cobald
cobald/daemon/config/mapping.py
Translator.construct
def construct(self, mapping: dict, **kwargs): """ Construct an object from a mapping :param mapping: the constructor definition, with ``__type__`` name and keyword arguments :param kwargs: additional keyword arguments to pass to the constructor """ assert '__type__' not ...
python
def construct(self, mapping: dict, **kwargs): """ Construct an object from a mapping :param mapping: the constructor definition, with ``__type__`` name and keyword arguments :param kwargs: additional keyword arguments to pass to the constructor """ assert '__type__' not ...
[ "def", "construct", "(", "self", ",", "mapping", ":", "dict", ",", "*", "*", "kwargs", ")", ":", "assert", "'__type__'", "not", "in", "kwargs", "and", "'__args__'", "not", "in", "kwargs", "mapping", "=", "{", "*", "*", "mapping", ",", "*", "*", "kwar...
Construct an object from a mapping :param mapping: the constructor definition, with ``__type__`` name and keyword arguments :param kwargs: additional keyword arguments to pass to the constructor
[ "Construct", "an", "object", "from", "a", "mapping" ]
264138de4382d1c9b53fabcbc6660e10b33a914d
https://github.com/MatterMiners/cobald/blob/264138de4382d1c9b53fabcbc6660e10b33a914d/cobald/daemon/config/mapping.py#L55-L67
train
MatterMiners/cobald
cobald/daemon/config/mapping.py
Translator.load_name
def load_name(absolute_name: str): """Load an object based on an absolute, dotted name""" path = absolute_name.split('.') try: __import__(absolute_name) except ImportError: try: obj = sys.modules[path[0]] except KeyError: ...
python
def load_name(absolute_name: str): """Load an object based on an absolute, dotted name""" path = absolute_name.split('.') try: __import__(absolute_name) except ImportError: try: obj = sys.modules[path[0]] except KeyError: ...
[ "def", "load_name", "(", "absolute_name", ":", "str", ")", ":", "path", "=", "absolute_name", ".", "split", "(", "'.'", ")", "try", ":", "__import__", "(", "absolute_name", ")", "except", "ImportError", ":", "try", ":", "obj", "=", "sys", ".", "modules",...
Load an object based on an absolute, dotted name
[ "Load", "an", "object", "based", "on", "an", "absolute", "dotted", "name" ]
264138de4382d1c9b53fabcbc6660e10b33a914d
https://github.com/MatterMiners/cobald/blob/264138de4382d1c9b53fabcbc6660e10b33a914d/cobald/daemon/config/mapping.py#L70-L88
train
qubell/contrib-python-qubell-client
qubell/api/private/manifest.py
Manifest.patch
def patch(self, path, value=None): """ Set specified value to yaml path. Example: patch('application/components/child/configuration/__locator.application-id','777') Will change child app ID to 777 """ # noinspection PyShadowingNames def pathGet(dictionary, path): ...
python
def patch(self, path, value=None): """ Set specified value to yaml path. Example: patch('application/components/child/configuration/__locator.application-id','777') Will change child app ID to 777 """ # noinspection PyShadowingNames def pathGet(dictionary, path): ...
[ "def", "patch", "(", "self", ",", "path", ",", "value", "=", "None", ")", ":", "# noinspection PyShadowingNames", "def", "pathGet", "(", "dictionary", ",", "path", ")", ":", "for", "item", "in", "path", ".", "split", "(", "\"/\"", ")", ":", "dictionary",...
Set specified value to yaml path. Example: patch('application/components/child/configuration/__locator.application-id','777') Will change child app ID to 777
[ "Set", "specified", "value", "to", "yaml", "path", ".", "Example", ":", "patch", "(", "application", "/", "components", "/", "child", "/", "configuration", "/", "__locator", ".", "application", "-", "id", "777", ")", "Will", "change", "child", "app", "ID",...
4586ea11d5103c2ff9607d3ed922b5a0991b8845
https://github.com/qubell/contrib-python-qubell-client/blob/4586ea11d5103c2ff9607d3ed922b5a0991b8845/qubell/api/private/manifest.py#L63-L95
train
MatterMiners/cobald
cobald/daemon/runners/trio_runner.py
TrioRunner._await_all
async def _await_all(self): """Async component of _run""" delay = 0.0 # we run a top-level nursery that automatically reaps/cancels for us async with trio.open_nursery() as nursery: while self.running.is_set(): await self._start_payloads(nursery=nursery) ...
python
async def _await_all(self): """Async component of _run""" delay = 0.0 # we run a top-level nursery that automatically reaps/cancels for us async with trio.open_nursery() as nursery: while self.running.is_set(): await self._start_payloads(nursery=nursery) ...
[ "async", "def", "_await_all", "(", "self", ")", ":", "delay", "=", "0.0", "# we run a top-level nursery that automatically reaps/cancels for us", "async", "with", "trio", ".", "open_nursery", "(", ")", "as", "nursery", ":", "while", "self", ".", "running", ".", "i...
Async component of _run
[ "Async", "component", "of", "_run" ]
264138de4382d1c9b53fabcbc6660e10b33a914d
https://github.com/MatterMiners/cobald/blob/264138de4382d1c9b53fabcbc6660e10b33a914d/cobald/daemon/runners/trio_runner.py#L28-L38
train
MatterMiners/cobald
cobald/daemon/runners/trio_runner.py
TrioRunner._start_payloads
async def _start_payloads(self, nursery): """Start all queued payloads""" with self._lock: for coroutine in self._payloads: nursery.start_soon(coroutine) self._payloads.clear() await trio.sleep(0)
python
async def _start_payloads(self, nursery): """Start all queued payloads""" with self._lock: for coroutine in self._payloads: nursery.start_soon(coroutine) self._payloads.clear() await trio.sleep(0)
[ "async", "def", "_start_payloads", "(", "self", ",", "nursery", ")", ":", "with", "self", ".", "_lock", ":", "for", "coroutine", "in", "self", ".", "_payloads", ":", "nursery", ".", "start_soon", "(", "coroutine", ")", "self", ".", "_payloads", ".", "cle...
Start all queued payloads
[ "Start", "all", "queued", "payloads" ]
264138de4382d1c9b53fabcbc6660e10b33a914d
https://github.com/MatterMiners/cobald/blob/264138de4382d1c9b53fabcbc6660e10b33a914d/cobald/daemon/runners/trio_runner.py#L40-L46
train
frostming/atoml
atoml/decoder.py
contains_list
def contains_list(longer, shorter): """Check if longer list starts with shorter list""" if len(longer) <= len(shorter): return False for a, b in zip(shorter, longer): if a != b: return False return True
python
def contains_list(longer, shorter): """Check if longer list starts with shorter list""" if len(longer) <= len(shorter): return False for a, b in zip(shorter, longer): if a != b: return False return True
[ "def", "contains_list", "(", "longer", ",", "shorter", ")", ":", "if", "len", "(", "longer", ")", "<=", "len", "(", "shorter", ")", ":", "return", "False", "for", "a", ",", "b", "in", "zip", "(", "shorter", ",", "longer", ")", ":", "if", "a", "!=...
Check if longer list starts with shorter list
[ "Check", "if", "longer", "list", "starts", "with", "shorter", "list" ]
85414ef77777366887a819a05b496d5279296cd2
https://github.com/frostming/atoml/blob/85414ef77777366887a819a05b496d5279296cd2/atoml/decoder.py#L28-L35
train
frostming/atoml
atoml/decoder.py
load
def load(f, dict_=dict): """Load and parse toml from a file object An additional argument `dict_` is used to specify the output type """ if not f.read: raise ValueError('The first parameter needs to be a file object, ', '%r is passed' % type(f)) return loads(f.read()...
python
def load(f, dict_=dict): """Load and parse toml from a file object An additional argument `dict_` is used to specify the output type """ if not f.read: raise ValueError('The first parameter needs to be a file object, ', '%r is passed' % type(f)) return loads(f.read()...
[ "def", "load", "(", "f", ",", "dict_", "=", "dict", ")", ":", "if", "not", "f", ".", "read", ":", "raise", "ValueError", "(", "'The first parameter needs to be a file object, '", ",", "'%r is passed'", "%", "type", "(", "f", ")", ")", "return", "loads", "(...
Load and parse toml from a file object An additional argument `dict_` is used to specify the output type
[ "Load", "and", "parse", "toml", "from", "a", "file", "object", "An", "additional", "argument", "dict_", "is", "used", "to", "specify", "the", "output", "type" ]
85414ef77777366887a819a05b496d5279296cd2
https://github.com/frostming/atoml/blob/85414ef77777366887a819a05b496d5279296cd2/atoml/decoder.py#L466-L473
train
frostming/atoml
atoml/decoder.py
loads
def loads(content, dict_=dict): """Parse a toml string An additional argument `dict_` is used to specify the output type """ if not isinstance(content, basestring): raise ValueError('The first parameter needs to be a string object, ', '%r is passed' % type(content)) ...
python
def loads(content, dict_=dict): """Parse a toml string An additional argument `dict_` is used to specify the output type """ if not isinstance(content, basestring): raise ValueError('The first parameter needs to be a string object, ', '%r is passed' % type(content)) ...
[ "def", "loads", "(", "content", ",", "dict_", "=", "dict", ")", ":", "if", "not", "isinstance", "(", "content", ",", "basestring", ")", ":", "raise", "ValueError", "(", "'The first parameter needs to be a string object, '", ",", "'%r is passed'", "%", "type", "(...
Parse a toml string An additional argument `dict_` is used to specify the output type
[ "Parse", "a", "toml", "string", "An", "additional", "argument", "dict_", "is", "used", "to", "specify", "the", "output", "type" ]
85414ef77777366887a819a05b496d5279296cd2
https://github.com/frostming/atoml/blob/85414ef77777366887a819a05b496d5279296cd2/atoml/decoder.py#L476-L485
train
frostming/atoml
atoml/decoder.py
Converter.convert
def convert(self, line=None, is_end=True): """Read the line content and return the converted value :param line: the line to feed to converter :param is_end: if set to True, will raise an error if the line has something remaining. """ if line is not None: self...
python
def convert(self, line=None, is_end=True): """Read the line content and return the converted value :param line: the line to feed to converter :param is_end: if set to True, will raise an error if the line has something remaining. """ if line is not None: self...
[ "def", "convert", "(", "self", ",", "line", "=", "None", ",", "is_end", "=", "True", ")", ":", "if", "line", "is", "not", "None", ":", "self", ".", "line", "=", "line", "if", "not", "self", ".", "line", ":", "raise", "TomlDecodeError", "(", "self",...
Read the line content and return the converted value :param line: the line to feed to converter :param is_end: if set to True, will raise an error if the line has something remaining.
[ "Read", "the", "line", "content", "and", "return", "the", "converted", "value" ]
85414ef77777366887a819a05b496d5279296cd2
https://github.com/frostming/atoml/blob/85414ef77777366887a819a05b496d5279296cd2/atoml/decoder.py#L130-L157
train