repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
CygnusNetworks/pypureomapi
pypureomapi.py
Omapi.add_host
def add_host(self, ip, mac): """Create a host object with given ip address and and mac address. @type ip: str @type mac: str @raises ValueError: @raises OmapiError: @raises socket.error: """ msg = OmapiMessage.open(b"host") msg.message.append((b"create", struct.pack("!I", 1))) msg.message.append((b...
python
def add_host(self, ip, mac): """Create a host object with given ip address and and mac address. @type ip: str @type mac: str @raises ValueError: @raises OmapiError: @raises socket.error: """ msg = OmapiMessage.open(b"host") msg.message.append((b"create", struct.pack("!I", 1))) msg.message.append((b...
[ "def", "add_host", "(", "self", ",", "ip", ",", "mac", ")", ":", "msg", "=", "OmapiMessage", ".", "open", "(", "b\"host\"", ")", "msg", ".", "message", ".", "append", "(", "(", "b\"create\"", ",", "struct", ".", "pack", "(", "\"!I\"", ",", "1", ")"...
Create a host object with given ip address and and mac address. @type ip: str @type mac: str @raises ValueError: @raises OmapiError: @raises socket.error:
[ "Create", "a", "host", "object", "with", "given", "ip", "address", "and", "and", "mac", "address", "." ]
train
https://github.com/CygnusNetworks/pypureomapi/blob/ff4459678ec023fd56e64ce518a86860efec26bf/pypureomapi.py#L1240-L1257
CygnusNetworks/pypureomapi
pypureomapi.py
Omapi.add_host_supersede_name
def add_host_supersede_name(self, ip, mac, name): # pylint:disable=E0213 """Add a host with a fixed-address and override its hostname with the given name. @type self: Omapi @type ip: str @type mac: str @type name: str @raises ValueError: @raises OmapiError: @raises socket.error: """ msg = OmapiMess...
python
def add_host_supersede_name(self, ip, mac, name): # pylint:disable=E0213 """Add a host with a fixed-address and override its hostname with the given name. @type self: Omapi @type ip: str @type mac: str @type name: str @raises ValueError: @raises OmapiError: @raises socket.error: """ msg = OmapiMess...
[ "def", "add_host_supersede_name", "(", "self", ",", "ip", ",", "mac", ",", "name", ")", ":", "# pylint:disable=E0213", "msg", "=", "OmapiMessage", ".", "open", "(", "b\"host\"", ")", "msg", ".", "message", ".", "append", "(", "(", "b\"create\"", ",", "stru...
Add a host with a fixed-address and override its hostname with the given name. @type self: Omapi @type ip: str @type mac: str @type name: str @raises ValueError: @raises OmapiError: @raises socket.error:
[ "Add", "a", "host", "with", "a", "fixed", "-", "address", "and", "override", "its", "hostname", "with", "the", "given", "name", "." ]
train
https://github.com/CygnusNetworks/pypureomapi/blob/ff4459678ec023fd56e64ce518a86860efec26bf/pypureomapi.py#L1259-L1279
CygnusNetworks/pypureomapi
pypureomapi.py
Omapi.add_host_supersede
def add_host_supersede(self, ip, mac, name, hostname=None, router=None, domain=None): # pylint:disable=too-many-arguments """Create a host object with given ip, mac, name, hostname, router and domain. hostname, router and domain are optional arguments. @type ip: str @type mac: str @type name: str @type ho...
python
def add_host_supersede(self, ip, mac, name, hostname=None, router=None, domain=None): # pylint:disable=too-many-arguments """Create a host object with given ip, mac, name, hostname, router and domain. hostname, router and domain are optional arguments. @type ip: str @type mac: str @type name: str @type ho...
[ "def", "add_host_supersede", "(", "self", ",", "ip", ",", "mac", ",", "name", ",", "hostname", "=", "None", ",", "router", "=", "None", ",", "domain", "=", "None", ")", ":", "# pylint:disable=too-many-arguments", "stmts", "=", "[", "]", "msg", "=", "Omap...
Create a host object with given ip, mac, name, hostname, router and domain. hostname, router and domain are optional arguments. @type ip: str @type mac: str @type name: str @type hostname: str @type router: str @type domain: str @raises OmapiError: @raises socket.error:
[ "Create", "a", "host", "object", "with", "given", "ip", "mac", "name", "hostname", "router", "and", "domain", ".", "hostname", "router", "and", "domain", "are", "optional", "arguments", "." ]
train
https://github.com/CygnusNetworks/pypureomapi/blob/ff4459678ec023fd56e64ce518a86860efec26bf/pypureomapi.py#L1297-L1330
CygnusNetworks/pypureomapi
pypureomapi.py
Omapi.del_host
def del_host(self, mac): """Delete a host object with with given mac address. @type mac: str @raises ValueError: @raises OmapiError: @raises OmapiErrorNotFound: if no lease object with the given mac address could be found @raises socket.error: """ msg = OmapiMessage.open(b"host") msg.obj.append((...
python
def del_host(self, mac): """Delete a host object with with given mac address. @type mac: str @raises ValueError: @raises OmapiError: @raises OmapiErrorNotFound: if no lease object with the given mac address could be found @raises socket.error: """ msg = OmapiMessage.open(b"host") msg.obj.append((...
[ "def", "del_host", "(", "self", ",", "mac", ")", ":", "msg", "=", "OmapiMessage", ".", "open", "(", "b\"host\"", ")", "msg", ".", "obj", ".", "append", "(", "(", "b\"hardware-address\"", ",", "pack_mac", "(", "mac", ")", ")", ")", "msg", ".", "obj", ...
Delete a host object with with given mac address. @type mac: str @raises ValueError: @raises OmapiError: @raises OmapiErrorNotFound: if no lease object with the given mac address could be found @raises socket.error:
[ "Delete", "a", "host", "object", "with", "with", "given", "mac", "address", "." ]
train
https://github.com/CygnusNetworks/pypureomapi/blob/ff4459678ec023fd56e64ce518a86860efec26bf/pypureomapi.py#L1332-L1352
CygnusNetworks/pypureomapi
pypureomapi.py
Omapi.add_group
def add_group(self, groupname, statements): """ Adds a group @type groupname: bytes @type statements: str """ msg = OmapiMessage.open(b"group") msg.message.append(("create", struct.pack("!I", 1))) msg.obj.append(("name", groupname)) msg.obj.append(("statements", statements)) response = self.query_se...
python
def add_group(self, groupname, statements): """ Adds a group @type groupname: bytes @type statements: str """ msg = OmapiMessage.open(b"group") msg.message.append(("create", struct.pack("!I", 1))) msg.obj.append(("name", groupname)) msg.obj.append(("statements", statements)) response = self.query_se...
[ "def", "add_group", "(", "self", ",", "groupname", ",", "statements", ")", ":", "msg", "=", "OmapiMessage", ".", "open", "(", "b\"group\"", ")", "msg", ".", "message", ".", "append", "(", "(", "\"create\"", ",", "struct", ".", "pack", "(", "\"!I\"", ",...
Adds a group @type groupname: bytes @type statements: str
[ "Adds", "a", "group" ]
train
https://github.com/CygnusNetworks/pypureomapi/blob/ff4459678ec023fd56e64ce518a86860efec26bf/pypureomapi.py#L1354-L1366
CygnusNetworks/pypureomapi
pypureomapi.py
Omapi.add_host_with_group
def add_host_with_group(self, ip, mac, groupname): """ Adds a host with given ip and mac in a group named groupname @type ip: str @type mac: str @type groupname: str """ msg = OmapiMessage.open(b"host") msg.message.append(("create", struct.pack("!I", 1))) msg.message.append(("exclusive", struct.pack("...
python
def add_host_with_group(self, ip, mac, groupname): """ Adds a host with given ip and mac in a group named groupname @type ip: str @type mac: str @type groupname: str """ msg = OmapiMessage.open(b"host") msg.message.append(("create", struct.pack("!I", 1))) msg.message.append(("exclusive", struct.pack("...
[ "def", "add_host_with_group", "(", "self", ",", "ip", ",", "mac", ",", "groupname", ")", ":", "msg", "=", "OmapiMessage", ".", "open", "(", "b\"host\"", ")", "msg", ".", "message", ".", "append", "(", "(", "\"create\"", ",", "struct", ".", "pack", "(",...
Adds a host with given ip and mac in a group named groupname @type ip: str @type mac: str @type groupname: str
[ "Adds", "a", "host", "with", "given", "ip", "and", "mac", "in", "a", "group", "named", "groupname" ]
train
https://github.com/CygnusNetworks/pypureomapi/blob/ff4459678ec023fd56e64ce518a86860efec26bf/pypureomapi.py#L1368-L1384
CygnusNetworks/pypureomapi
pypureomapi.py
Omapi.change_group
def change_group(self, name, group): """Change the group of a host given the name of the host. @type name: str @type group: str """ m1 = OmapiMessage.open(b"host") m1.update_object(dict(name=name)) r1 = self.query_server(m1) if r1.opcode != OMAPI_OP_UPDATE: raise OmapiError("opening host %s failed" %...
python
def change_group(self, name, group): """Change the group of a host given the name of the host. @type name: str @type group: str """ m1 = OmapiMessage.open(b"host") m1.update_object(dict(name=name)) r1 = self.query_server(m1) if r1.opcode != OMAPI_OP_UPDATE: raise OmapiError("opening host %s failed" %...
[ "def", "change_group", "(", "self", ",", "name", ",", "group", ")", ":", "m1", "=", "OmapiMessage", ".", "open", "(", "b\"host\"", ")", "m1", ".", "update_object", "(", "dict", "(", "name", "=", "name", ")", ")", "r1", "=", "self", ".", "query_server...
Change the group of a host given the name of the host. @type name: str @type group: str
[ "Change", "the", "group", "of", "a", "host", "given", "the", "name", "of", "the", "host", "." ]
train
https://github.com/CygnusNetworks/pypureomapi/blob/ff4459678ec023fd56e64ce518a86860efec26bf/pypureomapi.py#L1386-L1400
sbg/sevenbridges-python
sevenbridges/meta/resource.py
Resource._query
def _query(cls, **kwargs): """ Generic query implementation that is used by the resources. """ from sevenbridges.models.link import Link from sevenbridges.meta.collection import Collection api = kwargs.pop('api', cls._API) url = kwargs.pop('url') ...
python
def _query(cls, **kwargs): """ Generic query implementation that is used by the resources. """ from sevenbridges.models.link import Link from sevenbridges.meta.collection import Collection api = kwargs.pop('api', cls._API) url = kwargs.pop('url') ...
[ "def", "_query", "(", "cls", ",", "*", "*", "kwargs", ")", ":", "from", "sevenbridges", ".", "models", ".", "link", "import", "Link", "from", "sevenbridges", ".", "meta", ".", "collection", "import", "Collection", "api", "=", "kwargs", ".", "pop", "(", ...
Generic query implementation that is used by the resources.
[ "Generic", "query", "implementation", "that", "is", "used", "by", "the", "resources", "." ]
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/meta/resource.py#L118-L140
sbg/sevenbridges-python
sevenbridges/meta/resource.py
Resource.get
def get(cls, id, api=None): """ Fetches the resource from the server. :param id: Resource identifier :param api: sevenbridges Api instance. :return: Resource object. """ id = Transform.to_resource(id) api = api if api else cls._API if 'get' in cls....
python
def get(cls, id, api=None): """ Fetches the resource from the server. :param id: Resource identifier :param api: sevenbridges Api instance. :return: Resource object. """ id = Transform.to_resource(id) api = api if api else cls._API if 'get' in cls....
[ "def", "get", "(", "cls", ",", "id", ",", "api", "=", "None", ")", ":", "id", "=", "Transform", ".", "to_resource", "(", "id", ")", "api", "=", "api", "if", "api", "else", "cls", ".", "_API", "if", "'get'", "in", "cls", ".", "_URL", ":", "extra...
Fetches the resource from the server. :param id: Resource identifier :param api: sevenbridges Api instance. :return: Resource object.
[ "Fetches", "the", "resource", "from", "the", "server", ".", ":", "param", "id", ":", "Resource", "identifier", ":", "param", "api", ":", "sevenbridges", "Api", "instance", ".", ":", "return", ":", "Resource", "object", "." ]
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/meta/resource.py#L143-L158
sbg/sevenbridges-python
sevenbridges/meta/resource.py
Resource.delete
def delete(self): """ Deletes the resource on the server. """ if 'delete' in self._URL: extra = {'resource': self.__class__.__name__, 'query': { 'id': self.id}} logger.info("Deleting {} resource.".format(self), extra=extra) self._api.de...
python
def delete(self): """ Deletes the resource on the server. """ if 'delete' in self._URL: extra = {'resource': self.__class__.__name__, 'query': { 'id': self.id}} logger.info("Deleting {} resource.".format(self), extra=extra) self._api.de...
[ "def", "delete", "(", "self", ")", ":", "if", "'delete'", "in", "self", ".", "_URL", ":", "extra", "=", "{", "'resource'", ":", "self", ".", "__class__", ".", "__name__", ",", "'query'", ":", "{", "'id'", ":", "self", ".", "id", "}", "}", "logger",...
Deletes the resource on the server.
[ "Deletes", "the", "resource", "on", "the", "server", "." ]
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/meta/resource.py#L160-L170
sbg/sevenbridges-python
sevenbridges/meta/resource.py
Resource.reload
def reload(self): """ Refreshes the resource with the data from the server. """ try: if hasattr(self, 'href'): data = self._api.get(self.href, append_base=False).json() resource = self.__class__(api=self._api, **data) elif hasattr(s...
python
def reload(self): """ Refreshes the resource with the data from the server. """ try: if hasattr(self, 'href'): data = self._api.get(self.href, append_base=False).json() resource = self.__class__(api=self._api, **data) elif hasattr(s...
[ "def", "reload", "(", "self", ")", ":", "try", ":", "if", "hasattr", "(", "self", ",", "'href'", ")", ":", "data", "=", "self", ".", "_api", ".", "get", "(", "self", ".", "href", ",", "append_base", "=", "False", ")", ".", "json", "(", ")", "re...
Refreshes the resource with the data from the server.
[ "Refreshes", "the", "resource", "with", "the", "data", "from", "the", "server", "." ]
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/meta/resource.py#L172-L198
indico/indico-plugins
importer/indico_importer/converter.py
RecordConverter.convert
def convert(cls, record): """ Converts a single dictionary or list of dictionaries into converted list of dictionaries. """ if isinstance(record, list): return [cls._convert(r) for r in record] else: return [cls._convert(record)]
python
def convert(cls, record): """ Converts a single dictionary or list of dictionaries into converted list of dictionaries. """ if isinstance(record, list): return [cls._convert(r) for r in record] else: return [cls._convert(record)]
[ "def", "convert", "(", "cls", ",", "record", ")", ":", "if", "isinstance", "(", "record", ",", "list", ")", ":", "return", "[", "cls", ".", "_convert", "(", "r", ")", "for", "r", "in", "record", "]", "else", ":", "return", "[", "cls", ".", "_conv...
Converts a single dictionary or list of dictionaries into converted list of dictionaries.
[ "Converts", "a", "single", "dictionary", "or", "list", "of", "dictionaries", "into", "converted", "list", "of", "dictionaries", "." ]
train
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/importer/indico_importer/converter.py#L55-L62
indico/indico-plugins
importer/indico_importer/converter.py
RecordConverter._convert_internal
def _convert_internal(cls, record): """ Converts a single dictionary into converted dictionary or list of dictionaries into converted list of dictionaries. Used while passing dictionaries to another converter. """ if isinstance(record, list): return [cls._convert(r) f...
python
def _convert_internal(cls, record): """ Converts a single dictionary into converted dictionary or list of dictionaries into converted list of dictionaries. Used while passing dictionaries to another converter. """ if isinstance(record, list): return [cls._convert(r) f...
[ "def", "_convert_internal", "(", "cls", ",", "record", ")", ":", "if", "isinstance", "(", "record", ",", "list", ")", ":", "return", "[", "cls", ".", "_convert", "(", "r", ")", "for", "r", "in", "record", "]", "else", ":", "return", "cls", ".", "_c...
Converts a single dictionary into converted dictionary or list of dictionaries into converted list of dictionaries. Used while passing dictionaries to another converter.
[ "Converts", "a", "single", "dictionary", "into", "converted", "dictionary", "or", "list", "of", "dictionaries", "into", "converted", "list", "of", "dictionaries", ".", "Used", "while", "passing", "dictionaries", "to", "another", "converter", "." ]
train
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/importer/indico_importer/converter.py#L65-L73
indico/indico-plugins
importer/indico_importer/converter.py
RecordConverter._convert
def _convert(cls, record): """ Core method of the converter. Converts a single dictionary into another dictionary. """ if not record: return {} converted_dict = {} for field in cls.conversion: key = field[0] if len(field) >= 2 and fiel...
python
def _convert(cls, record): """ Core method of the converter. Converts a single dictionary into another dictionary. """ if not record: return {} converted_dict = {} for field in cls.conversion: key = field[0] if len(field) >= 2 and fiel...
[ "def", "_convert", "(", "cls", ",", "record", ")", ":", "if", "not", "record", ":", "return", "{", "}", "converted_dict", "=", "{", "}", "for", "field", "in", "cls", ".", "conversion", ":", "key", "=", "field", "[", "0", "]", "if", "len", "(", "f...
Core method of the converter. Converts a single dictionary into another dictionary.
[ "Core", "method", "of", "the", "converter", ".", "Converts", "a", "single", "dictionary", "into", "another", "dictionary", "." ]
train
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/importer/indico_importer/converter.py#L76-L112
sbg/sevenbridges-python
sevenbridges/http/error_handlers.py
rate_limit_sleeper
def rate_limit_sleeper(api, response): """ Pauses the execution if rate limit is breached. :param api: Api instance. :param response: requests.Response object """ while response.status_code == 429: headers = response.headers remaining_time = headers.get('X-RateLimit-Reset') ...
python
def rate_limit_sleeper(api, response): """ Pauses the execution if rate limit is breached. :param api: Api instance. :param response: requests.Response object """ while response.status_code == 429: headers = response.headers remaining_time = headers.get('X-RateLimit-Reset') ...
[ "def", "rate_limit_sleeper", "(", "api", ",", "response", ")", ":", "while", "response", ".", "status_code", "==", "429", ":", "headers", "=", "response", ".", "headers", "remaining_time", "=", "headers", ".", "get", "(", "'X-RateLimit-Reset'", ")", "sleep", ...
Pauses the execution if rate limit is breached. :param api: Api instance. :param response: requests.Response object
[ "Pauses", "the", "execution", "if", "rate", "limit", "is", "breached", ".", ":", "param", "api", ":", "Api", "instance", ".", ":", "param", "response", ":", "requests", ".", "Response", "object" ]
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/http/error_handlers.py#L15-L29
sbg/sevenbridges-python
sevenbridges/http/error_handlers.py
maintenance_sleeper
def maintenance_sleeper(api, response, sleep=300): """ Pauses the execution if sevenbridges api is under maintenance. :param api: Api instance. :param response: requests.Response object. :param sleep: Time to sleep in between the requests. """ while response.status_code == 503: logge...
python
def maintenance_sleeper(api, response, sleep=300): """ Pauses the execution if sevenbridges api is under maintenance. :param api: Api instance. :param response: requests.Response object. :param sleep: Time to sleep in between the requests. """ while response.status_code == 503: logge...
[ "def", "maintenance_sleeper", "(", "api", ",", "response", ",", "sleep", "=", "300", ")", ":", "while", "response", ".", "status_code", "==", "503", ":", "logger", ".", "info", "(", "'Service unavailable: Response=[%s]'", ",", "six", ".", "text_type", "(", "...
Pauses the execution if sevenbridges api is under maintenance. :param api: Api instance. :param response: requests.Response object. :param sleep: Time to sleep in between the requests.
[ "Pauses", "the", "execution", "if", "sevenbridges", "api", "is", "under", "maintenance", ".", ":", "param", "api", ":", "Api", "instance", ".", ":", "param", "response", ":", "requests", ".", "Response", "object", ".", ":", "param", "sleep", ":", "Time", ...
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/http/error_handlers.py#L33-L54
sbg/sevenbridges-python
sevenbridges/http/error_handlers.py
general_error_sleeper
def general_error_sleeper(api, response, sleep=300): """ Pauses the execution if response status code is > 500. :param api: Api instance. :param response: requests.Response object :param sleep: Time to sleep in between the requests. """ while response.status_code >= 500: logger.warn...
python
def general_error_sleeper(api, response, sleep=300): """ Pauses the execution if response status code is > 500. :param api: Api instance. :param response: requests.Response object :param sleep: Time to sleep in between the requests. """ while response.status_code >= 500: logger.warn...
[ "def", "general_error_sleeper", "(", "api", ",", "response", ",", "sleep", "=", "300", ")", ":", "while", "response", ".", "status_code", ">=", "500", ":", "logger", ".", "warning", "(", "'Caught [%s] status code! Waiting for [%s]s'", ",", "response", ".", "stat...
Pauses the execution if response status code is > 500. :param api: Api instance. :param response: requests.Response object :param sleep: Time to sleep in between the requests.
[ "Pauses", "the", "execution", "if", "response", "status", "code", "is", ">", "500", ".", ":", "param", "api", ":", "Api", "instance", ".", ":", "param", "response", ":", "requests", ".", "Response", "object", ":", "param", "sleep", ":", "Time", "to", "...
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/http/error_handlers.py#L58-L71
sbg/sevenbridges-python
sevenbridges/models/volume.py
Volume.create_google_volume
def create_google_volume(cls, name, bucket, client_email, private_key, access_mode, description=None, prefix=None, properties=None, api=None): """ Create s3 volume. :param name: Volume name. :param bucket: Referenced bucket. ...
python
def create_google_volume(cls, name, bucket, client_email, private_key, access_mode, description=None, prefix=None, properties=None, api=None): """ Create s3 volume. :param name: Volume name. :param bucket: Referenced bucket. ...
[ "def", "create_google_volume", "(", "cls", ",", "name", ",", "bucket", ",", "client_email", ",", "private_key", ",", "access_mode", ",", "description", "=", "None", ",", "prefix", "=", "None", ",", "properties", "=", "None", ",", "api", "=", "None", ")", ...
Create s3 volume. :param name: Volume name. :param bucket: Referenced bucket. :param client_email: Google client email. :param private_key: Google client private key. :param access_mode: Access Mode. :param description: Volume description. :param prefix: Volume pr...
[ "Create", "s3", "volume", ".", ":", "param", "name", ":", "Volume", "name", ".", ":", "param", "bucket", ":", "Referenced", "bucket", ".", ":", "param", "client_email", ":", "Google", "client", "email", ".", ":", "param", "private_key", ":", "Google", "c...
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/volume.py#L122-L164
sbg/sevenbridges-python
sevenbridges/models/volume.py
Volume.create_oss_volume
def create_oss_volume(cls, name, bucket, endpoint, access_key_id, secret_access_key, access_mode, description=None, prefix=None, properties=None, api=None): """ Create oss volume. :param name: Volume name. :param bucket: Referenced buck...
python
def create_oss_volume(cls, name, bucket, endpoint, access_key_id, secret_access_key, access_mode, description=None, prefix=None, properties=None, api=None): """ Create oss volume. :param name: Volume name. :param bucket: Referenced buck...
[ "def", "create_oss_volume", "(", "cls", ",", "name", ",", "bucket", ",", "endpoint", ",", "access_key_id", ",", "secret_access_key", ",", "access_mode", ",", "description", "=", "None", ",", "prefix", "=", "None", ",", "properties", "=", "None", ",", "api", ...
Create oss volume. :param name: Volume name. :param bucket: Referenced bucket. :param access_key_id: Access key identifier. :param secret_access_key: Secret access key. :param access_mode: Access Mode. :param endpoint: Volume Endpoint. :param description: Volume d...
[ "Create", "oss", "volume", ".", ":", "param", "name", ":", "Volume", "name", ".", ":", "param", "bucket", ":", "Referenced", "bucket", ".", ":", "param", "access_key_id", ":", "Access", "key", "identifier", ".", ":", "param", "secret_access_key", ":", "Sec...
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/volume.py#L167-L212
sbg/sevenbridges-python
sevenbridges/models/volume.py
Volume.get_volume_object_info
def get_volume_object_info(self, location): """ Fetches information about single volume object - usually file :param location: object location :return: """ param = {'location': location} data = self._api.get(url=self._URL['object'].format( id=self.id),...
python
def get_volume_object_info(self, location): """ Fetches information about single volume object - usually file :param location: object location :return: """ param = {'location': location} data = self._api.get(url=self._URL['object'].format( id=self.id),...
[ "def", "get_volume_object_info", "(", "self", ",", "location", ")", ":", "param", "=", "{", "'location'", ":", "location", "}", "data", "=", "self", ".", "_api", ".", "get", "(", "url", "=", "self", ".", "_URL", "[", "'object'", "]", ".", "format", "...
Fetches information about single volume object - usually file :param location: object location :return:
[ "Fetches", "information", "about", "single", "volume", "object", "-", "usually", "file", ":", "param", "location", ":", "object", "location", ":", "return", ":" ]
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/volume.py#L263-L272
sbg/sevenbridges-python
sevenbridges/models/volume.py
Volume.get_member
def get_member(self, username, api=None): """ Fetches information about a single volume member :param username: Member name :param api: Api instance :return: Member object """ api = api if api else self._API response = api.get( url=self._URL['...
python
def get_member(self, username, api=None): """ Fetches information about a single volume member :param username: Member name :param api: Api instance :return: Member object """ api = api if api else self._API response = api.get( url=self._URL['...
[ "def", "get_member", "(", "self", ",", "username", ",", "api", "=", "None", ")", ":", "api", "=", "api", "if", "api", "else", "self", ".", "_API", "response", "=", "api", ".", "get", "(", "url", "=", "self", ".", "_URL", "[", "'member'", "]", "."...
Fetches information about a single volume member :param username: Member name :param api: Api instance :return: Member object
[ "Fetches", "information", "about", "a", "single", "volume", "member", ":", "param", "username", ":", "Member", "name", ":", "param", "api", ":", "Api", "instance", ":", "return", ":", "Member", "object" ]
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/volume.py#L414-L427
sbg/sevenbridges-python
sevenbridges/models/storage_import.py
Import.submit_import
def submit_import(cls, volume, location, project=None, name=None, overwrite=False, properties=None, parent=None, preserve_folder_structure=True, api=None): """ Submits new import job. :param volume: Volume identifier. :param location: Volume lo...
python
def submit_import(cls, volume, location, project=None, name=None, overwrite=False, properties=None, parent=None, preserve_folder_structure=True, api=None): """ Submits new import job. :param volume: Volume identifier. :param location: Volume lo...
[ "def", "submit_import", "(", "cls", ",", "volume", ",", "location", ",", "project", "=", "None", ",", "name", "=", "None", ",", "overwrite", "=", "False", ",", "properties", "=", "None", ",", "parent", "=", "None", ",", "preserve_folder_structure", "=", ...
Submits new import job. :param volume: Volume identifier. :param location: Volume location. :param project: Project identifier. :param name: Optional file name. :param overwrite: If true it will overwrite file if exists. :param properties: Properties dictionary. :...
[ "Submits", "new", "import", "job", ".", ":", "param", "volume", ":", "Volume", "identifier", ".", ":", "param", "location", ":", "Volume", "location", ".", ":", "param", "project", ":", "Project", "identifier", ".", ":", "param", "name", ":", "Optional", ...
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/storage_import.py#L69-L134
sbg/sevenbridges-python
sevenbridges/models/storage_import.py
Import.query
def query(cls, project=None, volume=None, state=None, offset=None, limit=None, api=None): """ Query (List) imports. :param project: Optional project identifier. :param volume: Optional volume identifier. :param state: Optional import sate. :param offset: Pag...
python
def query(cls, project=None, volume=None, state=None, offset=None, limit=None, api=None): """ Query (List) imports. :param project: Optional project identifier. :param volume: Optional volume identifier. :param state: Optional import sate. :param offset: Pag...
[ "def", "query", "(", "cls", ",", "project", "=", "None", ",", "volume", "=", "None", ",", "state", "=", "None", ",", "offset", "=", "None", ",", "limit", "=", "None", ",", "api", "=", "None", ")", ":", "api", "=", "api", "or", "cls", ".", "_API...
Query (List) imports. :param project: Optional project identifier. :param volume: Optional volume identifier. :param state: Optional import sate. :param offset: Pagination offset. :param limit: Pagination limit. :param api: Api instance. :return: Collection object...
[ "Query", "(", "List", ")", "imports", ".", ":", "param", "project", ":", "Optional", "project", "identifier", ".", ":", "param", "volume", ":", "Optional", "volume", "identifier", ".", ":", "param", "state", ":", "Optional", "import", "sate", ".", ":", "...
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/storage_import.py#L137-L159
sbg/sevenbridges-python
sevenbridges/models/storage_import.py
Import.bulk_get
def bulk_get(cls, imports, api=None): """ Retrieve imports in bulk :param imports: Imports to be retrieved. :param api: Api instance. :return: List of ImportBulkRecord objects. """ api = api or cls._API import_ids = [Transform.to_import(import_) for import...
python
def bulk_get(cls, imports, api=None): """ Retrieve imports in bulk :param imports: Imports to be retrieved. :param api: Api instance. :return: List of ImportBulkRecord objects. """ api = api or cls._API import_ids = [Transform.to_import(import_) for import...
[ "def", "bulk_get", "(", "cls", ",", "imports", ",", "api", "=", "None", ")", ":", "api", "=", "api", "or", "cls", ".", "_API", "import_ids", "=", "[", "Transform", ".", "to_import", "(", "import_", ")", "for", "import_", "in", "imports", "]", "data",...
Retrieve imports in bulk :param imports: Imports to be retrieved. :param api: Api instance. :return: List of ImportBulkRecord objects.
[ "Retrieve", "imports", "in", "bulk", ":", "param", "imports", ":", "Imports", "to", "be", "retrieved", ".", ":", "param", "api", ":", "Api", "instance", ".", ":", "return", ":", "List", "of", "ImportBulkRecord", "objects", "." ]
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/storage_import.py#L162-L174
sbg/sevenbridges-python
sevenbridges/models/storage_import.py
Import.bulk_submit
def bulk_submit(cls, imports, api=None): """ Submit imports in bulk :param imports: Imports to be retrieved. :param api: Api instance. :return: List of ImportBulkRecord objects. """ if not imports: raise SbgError('Imports are required') api = ...
python
def bulk_submit(cls, imports, api=None): """ Submit imports in bulk :param imports: Imports to be retrieved. :param api: Api instance. :return: List of ImportBulkRecord objects. """ if not imports: raise SbgError('Imports are required') api = ...
[ "def", "bulk_submit", "(", "cls", ",", "imports", ",", "api", "=", "None", ")", ":", "if", "not", "imports", ":", "raise", "SbgError", "(", "'Imports are required'", ")", "api", "=", "api", "or", "cls", ".", "_API", "items", "=", "[", "]", "for", "im...
Submit imports in bulk :param imports: Imports to be retrieved. :param api: Api instance. :return: List of ImportBulkRecord objects.
[ "Submit", "imports", "in", "bulk", ":", "param", "imports", ":", "Imports", "to", "be", "retrieved", ".", ":", "param", "api", ":", "Api", "instance", ".", ":", "return", ":", "List", "of", "ImportBulkRecord", "objects", "." ]
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/storage_import.py#L177-L216
indico/indico-plugins
chat/indico_chat/xmpp.py
create_room
def create_room(room): """Creates a MUC room on the XMPP server.""" if room.custom_server: return def _create_room(xmpp): muc = xmpp.plugin['xep_0045'] muc.joinMUC(room.jid, xmpp.requested_jid.user) muc.configureRoom(room.jid, _set_form_values(xmpp, room)) current_plug...
python
def create_room(room): """Creates a MUC room on the XMPP server.""" if room.custom_server: return def _create_room(xmpp): muc = xmpp.plugin['xep_0045'] muc.joinMUC(room.jid, xmpp.requested_jid.user) muc.configureRoom(room.jid, _set_form_values(xmpp, room)) current_plug...
[ "def", "create_room", "(", "room", ")", ":", "if", "room", ".", "custom_server", ":", "return", "def", "_create_room", "(", "xmpp", ")", ":", "muc", "=", "xmpp", ".", "plugin", "[", "'xep_0045'", "]", "muc", ".", "joinMUC", "(", "room", ".", "jid", "...
Creates a MUC room on the XMPP server.
[ "Creates", "a", "MUC", "room", "on", "the", "XMPP", "server", "." ]
train
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/chat/indico_chat/xmpp.py#L44-L56
indico/indico-plugins
chat/indico_chat/xmpp.py
update_room
def update_room(room): """Updates a MUC room on the XMPP server.""" if room.custom_server: return def _update_room(xmpp): muc = xmpp.plugin['xep_0045'] muc.joinMUC(room.jid, xmpp.requested_jid.user) muc.configureRoom(room.jid, _set_form_values(xmpp, room, muc.getRoomConfig(...
python
def update_room(room): """Updates a MUC room on the XMPP server.""" if room.custom_server: return def _update_room(xmpp): muc = xmpp.plugin['xep_0045'] muc.joinMUC(room.jid, xmpp.requested_jid.user) muc.configureRoom(room.jid, _set_form_values(xmpp, room, muc.getRoomConfig(...
[ "def", "update_room", "(", "room", ")", ":", "if", "room", ".", "custom_server", ":", "return", "def", "_update_room", "(", "xmpp", ")", ":", "muc", "=", "xmpp", ".", "plugin", "[", "'xep_0045'", "]", "muc", ".", "joinMUC", "(", "room", ".", "jid", "...
Updates a MUC room on the XMPP server.
[ "Updates", "a", "MUC", "room", "on", "the", "XMPP", "server", "." ]
train
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/chat/indico_chat/xmpp.py#L59-L71
indico/indico-plugins
chat/indico_chat/xmpp.py
delete_room
def delete_room(room, reason=''): """Deletes a MUC room from the XMPP server.""" if room.custom_server: return def _delete_room(xmpp): muc = xmpp.plugin['xep_0045'] muc.destroy(room.jid, reason=reason) current_plugin.logger.info('Deleting room %s', room.jid) _execute_xmpp(...
python
def delete_room(room, reason=''): """Deletes a MUC room from the XMPP server.""" if room.custom_server: return def _delete_room(xmpp): muc = xmpp.plugin['xep_0045'] muc.destroy(room.jid, reason=reason) current_plugin.logger.info('Deleting room %s', room.jid) _execute_xmpp(...
[ "def", "delete_room", "(", "room", ",", "reason", "=", "''", ")", ":", "if", "room", ".", "custom_server", ":", "return", "def", "_delete_room", "(", "xmpp", ")", ":", "muc", "=", "xmpp", ".", "plugin", "[", "'xep_0045'", "]", "muc", ".", "destroy", ...
Deletes a MUC room from the XMPP server.
[ "Deletes", "a", "MUC", "room", "from", "the", "XMPP", "server", "." ]
train
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/chat/indico_chat/xmpp.py#L74-L86
indico/indico-plugins
chat/indico_chat/xmpp.py
get_room_config
def get_room_config(jid): """Retrieves basic data of a MUC room from the XMPP server. :return: dict containing name, description and password of the room """ mapping = { 'name': 'muc#roomconfig_roomname', 'description': 'muc#roomconfig_roomdesc', 'password': 'muc#roomconfig_roo...
python
def get_room_config(jid): """Retrieves basic data of a MUC room from the XMPP server. :return: dict containing name, description and password of the room """ mapping = { 'name': 'muc#roomconfig_roomname', 'description': 'muc#roomconfig_roomdesc', 'password': 'muc#roomconfig_roo...
[ "def", "get_room_config", "(", "jid", ")", ":", "mapping", "=", "{", "'name'", ":", "'muc#roomconfig_roomname'", ",", "'description'", ":", "'muc#roomconfig_roomdesc'", ",", "'password'", ":", "'muc#roomconfig_roomsecret'", "}", "def", "_get_room_config", "(", "xmpp",...
Retrieves basic data of a MUC room from the XMPP server. :return: dict containing name, description and password of the room
[ "Retrieves", "basic", "data", "of", "a", "MUC", "room", "from", "the", "XMPP", "server", "." ]
train
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/chat/indico_chat/xmpp.py#L89-L110
indico/indico-plugins
chat/indico_chat/xmpp.py
room_exists
def room_exists(jid): """Checks if a MUC room exists on the server.""" def _room_exists(xmpp): disco = xmpp.plugin['xep_0030'] try: disco.get_info(jid) except IqError as e: if e.condition == 'item-not-found': return False raise ...
python
def room_exists(jid): """Checks if a MUC room exists on the server.""" def _room_exists(xmpp): disco = xmpp.plugin['xep_0030'] try: disco.get_info(jid) except IqError as e: if e.condition == 'item-not-found': return False raise ...
[ "def", "room_exists", "(", "jid", ")", ":", "def", "_room_exists", "(", "xmpp", ")", ":", "disco", "=", "xmpp", ".", "plugin", "[", "'xep_0030'", "]", "try", ":", "disco", ".", "get_info", "(", "jid", ")", "except", "IqError", "as", "e", ":", "if", ...
Checks if a MUC room exists on the server.
[ "Checks", "if", "a", "MUC", "room", "exists", "on", "the", "server", "." ]
train
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/chat/indico_chat/xmpp.py#L113-L127
indico/indico-plugins
chat/indico_chat/xmpp.py
sanitize_jid
def sanitize_jid(s): """Generates a valid JID node identifier from a string""" jid = unicode_to_ascii(s).lower() jid = WHITESPACE.sub('-', jid) jid = INVALID_JID_CHARS.sub('', jid) return jid.strip()[:256]
python
def sanitize_jid(s): """Generates a valid JID node identifier from a string""" jid = unicode_to_ascii(s).lower() jid = WHITESPACE.sub('-', jid) jid = INVALID_JID_CHARS.sub('', jid) return jid.strip()[:256]
[ "def", "sanitize_jid", "(", "s", ")", ":", "jid", "=", "unicode_to_ascii", "(", "s", ")", ".", "lower", "(", ")", "jid", "=", "WHITESPACE", ".", "sub", "(", "'-'", ",", "jid", ")", "jid", "=", "INVALID_JID_CHARS", ".", "sub", "(", "''", ",", "jid",...
Generates a valid JID node identifier from a string
[ "Generates", "a", "valid", "JID", "node", "identifier", "from", "a", "string" ]
train
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/chat/indico_chat/xmpp.py#L130-L135
indico/indico-plugins
chat/indico_chat/xmpp.py
generate_jid
def generate_jid(name, append_date=None): """Generates a v alid JID based on the room name. :param append_date: appends the given date to the JID """ if not append_date: return sanitize_jid(name) return '{}-{}'.format(sanitize_jid(name), append_date.strftime('%Y-%m-%d'))
python
def generate_jid(name, append_date=None): """Generates a v alid JID based on the room name. :param append_date: appends the given date to the JID """ if not append_date: return sanitize_jid(name) return '{}-{}'.format(sanitize_jid(name), append_date.strftime('%Y-%m-%d'))
[ "def", "generate_jid", "(", "name", ",", "append_date", "=", "None", ")", ":", "if", "not", "append_date", ":", "return", "sanitize_jid", "(", "name", ")", "return", "'{}-{}'", ".", "format", "(", "sanitize_jid", "(", "name", ")", ",", "append_date", ".", ...
Generates a v alid JID based on the room name. :param append_date: appends the given date to the JID
[ "Generates", "a", "v", "alid", "JID", "based", "on", "the", "room", "name", "." ]
train
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/chat/indico_chat/xmpp.py#L138-L145
indico/indico-plugins
chat/indico_chat/xmpp.py
_set_form_values
def _set_form_values(xmpp, room, form=None): """Creates/Updates an XMPP room config form""" if form is None: form = xmpp.plugin['xep_0004'].make_form(ftype='submit') form.add_field('FORM_TYPE', value='http://jabber.org/protocol/muc#roomconfig') form.add_field('muc#roomconfig_publicroom',...
python
def _set_form_values(xmpp, room, form=None): """Creates/Updates an XMPP room config form""" if form is None: form = xmpp.plugin['xep_0004'].make_form(ftype='submit') form.add_field('FORM_TYPE', value='http://jabber.org/protocol/muc#roomconfig') form.add_field('muc#roomconfig_publicroom',...
[ "def", "_set_form_values", "(", "xmpp", ",", "room", ",", "form", "=", "None", ")", ":", "if", "form", "is", "None", ":", "form", "=", "xmpp", ".", "plugin", "[", "'xep_0004'", "]", ".", "make_form", "(", "ftype", "=", "'submit'", ")", "form", ".", ...
Creates/Updates an XMPP room config form
[ "Creates", "/", "Updates", "an", "XMPP", "room", "config", "form" ]
train
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/chat/indico_chat/xmpp.py#L148-L173
indico/indico-plugins
chat/indico_chat/xmpp.py
_execute_xmpp
def _execute_xmpp(connected_callback): """Connects to the XMPP server and executes custom code :param connected_callback: function to execute after connecting :return: return value of the callback """ from indico_chat.plugin import ChatPlugin check_config() jid = ChatPlugin.settings.get('b...
python
def _execute_xmpp(connected_callback): """Connects to the XMPP server and executes custom code :param connected_callback: function to execute after connecting :return: return value of the callback """ from indico_chat.plugin import ChatPlugin check_config() jid = ChatPlugin.settings.get('b...
[ "def", "_execute_xmpp", "(", "connected_callback", ")", ":", "from", "indico_chat", ".", "plugin", "import", "ChatPlugin", "check_config", "(", ")", "jid", "=", "ChatPlugin", ".", "settings", ".", "get", "(", "'bot_jid'", ")", "password", "=", "ChatPlugin", "....
Connects to the XMPP server and executes custom code :param connected_callback: function to execute after connecting :return: return value of the callback
[ "Connects", "to", "the", "XMPP", "server", "and", "executes", "custom", "code" ]
train
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/chat/indico_chat/xmpp.py#L176-L227
indico/indico-plugins
chat/indico_chat/xmpp.py
retrieve_logs
def retrieve_logs(room, start_date=None, end_date=None): """Retrieves chat logs :param room: the `Chatroom` :param start_date: the earliest date to get logs for :param end_date: the latest date to get logs for :return: logs in html format """ from indico_chat.plugin import ChatPlugin b...
python
def retrieve_logs(room, start_date=None, end_date=None): """Retrieves chat logs :param room: the `Chatroom` :param start_date: the earliest date to get logs for :param end_date: the latest date to get logs for :return: logs in html format """ from indico_chat.plugin import ChatPlugin b...
[ "def", "retrieve_logs", "(", "room", ",", "start_date", "=", "None", ",", "end_date", "=", "None", ")", ":", "from", "indico_chat", ".", "plugin", "import", "ChatPlugin", "base_url", "=", "ChatPlugin", ".", "settings", ".", "get", "(", "'log_url'", ")", "i...
Retrieves chat logs :param room: the `Chatroom` :param start_date: the earliest date to get logs for :param end_date: the latest date to get logs for :return: logs in html format
[ "Retrieves", "chat", "logs" ]
train
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/chat/indico_chat/xmpp.py#L230-L258
indico/indico-plugins
chat/indico_chat/xmpp.py
delete_logs
def delete_logs(room): """Deletes chat logs""" from indico_chat.plugin import ChatPlugin base_url = ChatPlugin.settings.get('log_url') if not base_url or room.custom_server: return try: response = requests.get(posixpath.join(base_url, 'delete'), params={'cr': room.jid}).json() ...
python
def delete_logs(room): """Deletes chat logs""" from indico_chat.plugin import ChatPlugin base_url = ChatPlugin.settings.get('log_url') if not base_url or room.custom_server: return try: response = requests.get(posixpath.join(base_url, 'delete'), params={'cr': room.jid}).json() ...
[ "def", "delete_logs", "(", "room", ")", ":", "from", "indico_chat", ".", "plugin", "import", "ChatPlugin", "base_url", "=", "ChatPlugin", ".", "settings", ".", "get", "(", "'log_url'", ")", "if", "not", "base_url", "or", "room", ".", "custom_server", ":", ...
Deletes chat logs
[ "Deletes", "chat", "logs" ]
train
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/chat/indico_chat/xmpp.py#L261-L275
sbg/sevenbridges-python
sevenbridges/models/member.py
Member.save
def save(self, inplace=True): """ Saves modification to the api server. """ data = self._modified_data() data = data['permissions'] if bool(data): url = six.text_type(self.href) + self._URL['permissions'] extra = {'resource': self.__class__.__name_...
python
def save(self, inplace=True): """ Saves modification to the api server. """ data = self._modified_data() data = data['permissions'] if bool(data): url = six.text_type(self.href) + self._URL['permissions'] extra = {'resource': self.__class__.__name_...
[ "def", "save", "(", "self", ",", "inplace", "=", "True", ")", ":", "data", "=", "self", ".", "_modified_data", "(", ")", "data", "=", "data", "[", "'permissions'", "]", "if", "bool", "(", "data", ")", ":", "url", "=", "six", ".", "text_type", "(", ...
Saves modification to the api server.
[ "Saves", "modification", "to", "the", "api", "server", "." ]
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/member.py#L49-L61
sbg/sevenbridges-python
sevenbridges/models/team.py
Team.create
def create(cls, name, division, api=None): """ Create team within a division :param name: Team name. :param division: Parent division. :param api: Api instance. :return: Team object. """ division = Transform.to_division(division) api = api if api...
python
def create(cls, name, division, api=None): """ Create team within a division :param name: Team name. :param division: Parent division. :param api: Api instance. :return: Team object. """ division = Transform.to_division(division) api = api if api...
[ "def", "create", "(", "cls", ",", "name", ",", "division", ",", "api", "=", "None", ")", ":", "division", "=", "Transform", ".", "to_division", "(", "division", ")", "api", "=", "api", "if", "api", "else", "cls", ".", "_API", "data", "=", "{", "'na...
Create team within a division :param name: Team name. :param division: Parent division. :param api: Api instance. :return: Team object.
[ "Create", "team", "within", "a", "division", ":", "param", "name", ":", "Team", "name", ".", ":", "param", "division", ":", "Parent", "division", ".", ":", "param", "api", ":", "Api", "instance", ".", ":", "return", ":", "Team", "object", "." ]
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/team.py#L55-L77
sbg/sevenbridges-python
sevenbridges/models/team.py
Team.get_members
def get_members(self, offset=None, limit=None): """ Fetch team members for current team. :param offset: Pagination offset. :param limit: Pagination limit. :return: Collection object. """ extra = { 'resource': self.__class__.__name__, 'query...
python
def get_members(self, offset=None, limit=None): """ Fetch team members for current team. :param offset: Pagination offset. :param limit: Pagination limit. :return: Collection object. """ extra = { 'resource': self.__class__.__name__, 'query...
[ "def", "get_members", "(", "self", ",", "offset", "=", "None", ",", "limit", "=", "None", ")", ":", "extra", "=", "{", "'resource'", ":", "self", ".", "__class__", ".", "__name__", ",", "'query'", ":", "{", "'id'", ":", "self", ".", "id", "}", "}",...
Fetch team members for current team. :param offset: Pagination offset. :param limit: Pagination limit. :return: Collection object.
[ "Fetch", "team", "members", "for", "current", "team", ".", ":", "param", "offset", ":", "Pagination", "offset", ".", ":", "param", "limit", ":", "Pagination", "limit", ".", ":", "return", ":", "Collection", "object", "." ]
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/team.py#L103-L126
sbg/sevenbridges-python
sevenbridges/models/team.py
Team.add_member
def add_member(self, user): """ Add member to team :param user: User object or user's username :return: Added user. """ user = Transform.to_user(user) data = { 'id': user } extra = { 'resource': self.__class__.__name__, ...
python
def add_member(self, user): """ Add member to team :param user: User object or user's username :return: Added user. """ user = Transform.to_user(user) data = { 'id': user } extra = { 'resource': self.__class__.__name__, ...
[ "def", "add_member", "(", "self", ",", "user", ")", ":", "user", "=", "Transform", ".", "to_user", "(", "user", ")", "data", "=", "{", "'id'", ":", "user", "}", "extra", "=", "{", "'resource'", ":", "self", ".", "__class__", ".", "__name__", ",", "...
Add member to team :param user: User object or user's username :return: Added user.
[ "Add", "member", "to", "team", ":", "param", "user", ":", "User", "object", "or", "user", "s", "username", ":", "return", ":", "Added", "user", "." ]
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/team.py#L128-L149
sbg/sevenbridges-python
sevenbridges/models/project.py
Project.query
def query(cls, owner=None, name=None, offset=None, limit=None, api=None): """ Query (List) projects :param owner: Owner username. :param name: Project name :param offset: Pagination offset. :param limit: Pagination limit. :param api: Api instance. :return:...
python
def query(cls, owner=None, name=None, offset=None, limit=None, api=None): """ Query (List) projects :param owner: Owner username. :param name: Project name :param offset: Pagination offset. :param limit: Pagination limit. :param api: Api instance. :return:...
[ "def", "query", "(", "cls", ",", "owner", "=", "None", ",", "name", "=", "None", ",", "offset", "=", "None", ",", "limit", "=", "None", ",", "api", "=", "None", ")", ":", "api", "=", "api", "if", "api", "else", "cls", ".", "_API", "query_params",...
Query (List) projects :param owner: Owner username. :param name: Project name :param offset: Pagination offset. :param limit: Pagination limit. :param api: Api instance. :return: Collection object.
[ "Query", "(", "List", ")", "projects", ":", "param", "owner", ":", "Owner", "username", ".", ":", "param", "name", ":", "Project", "name", ":", "param", "offset", ":", "Pagination", "offset", ".", ":", "param", "limit", ":", "Pagination", "limit", ".", ...
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/project.py#L59-L80
sbg/sevenbridges-python
sevenbridges/models/project.py
Project.create
def create(cls, name, billing_group=None, description=None, tags=None, settings=None, api=None): """ Create a project. :param name: Project name. :param billing_group: Project billing group. :param description: Project description. :param tags: Project ta...
python
def create(cls, name, billing_group=None, description=None, tags=None, settings=None, api=None): """ Create a project. :param name: Project name. :param billing_group: Project billing group. :param description: Project description. :param tags: Project ta...
[ "def", "create", "(", "cls", ",", "name", ",", "billing_group", "=", "None", ",", "description", "=", "None", ",", "tags", "=", "None", ",", "settings", "=", "None", ",", "api", "=", "None", ")", ":", "api", "=", "api", "if", "api", "else", "cls", ...
Create a project. :param name: Project name. :param billing_group: Project billing group. :param description: Project description. :param tags: Project tags. :param settings: Project settings. :param api: Api instance. :return:
[ "Create", "a", "project", ".", ":", "param", "name", ":", "Project", "name", ".", ":", "param", "billing_group", ":", "Project", "billing", "group", ".", ":", "param", "description", ":", "Project", "description", ".", ":", "param", "tags", ":", "Project",...
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/project.py#L83-L121
sbg/sevenbridges-python
sevenbridges/models/project.py
Project.add_member_team
def add_member_team(self, team, permissions): """ Add a member (team) to a project. :param team: Team object or team identifier. :param permissions: Permissions dictionary. :return: Member object. """ team = Transform.to_team(team) data = {'id': team, 'typ...
python
def add_member_team(self, team, permissions): """ Add a member (team) to a project. :param team: Team object or team identifier. :param permissions: Permissions dictionary. :return: Member object. """ team = Transform.to_team(team) data = {'id': team, 'typ...
[ "def", "add_member_team", "(", "self", ",", "team", ",", "permissions", ")", ":", "team", "=", "Transform", ".", "to_team", "(", "team", ")", "data", "=", "{", "'id'", ":", "team", ",", "'type'", ":", "'TEAM'", "}", "if", "isinstance", "(", "permission...
Add a member (team) to a project. :param team: Team object or team identifier. :param permissions: Permissions dictionary. :return: Member object.
[ "Add", "a", "member", "(", "team", ")", "to", "a", "project", ".", ":", "param", "team", ":", "Team", "object", "or", "team", "identifier", ".", ":", "param", "permissions", ":", "Permissions", "dictionary", ".", ":", "return", ":", "Member", "object", ...
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/project.py#L197-L222
sbg/sevenbridges-python
sevenbridges/models/project.py
Project.add_member_email
def add_member_email(self, email, permissions=None): """ Add a member to the project using member email. :param email: Member email. :param permissions: Permissions dictionary. :return: Member object. """ data = {'email': email} if isinstance(permissions,...
python
def add_member_email(self, email, permissions=None): """ Add a member to the project using member email. :param email: Member email. :param permissions: Permissions dictionary. :return: Member object. """ data = {'email': email} if isinstance(permissions,...
[ "def", "add_member_email", "(", "self", ",", "email", ",", "permissions", "=", "None", ")", ":", "data", "=", "{", "'email'", ":", "email", "}", "if", "isinstance", "(", "permissions", ",", "dict", ")", ":", "data", ".", "update", "(", "{", "'permissio...
Add a member to the project using member email. :param email: Member email. :param permissions: Permissions dictionary. :return: Member object.
[ "Add", "a", "member", "to", "the", "project", "using", "member", "email", ".", ":", "param", "email", ":", "Member", "email", ".", ":", "param", "permissions", ":", "Permissions", "dictionary", ".", ":", "return", ":", "Member", "object", "." ]
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/project.py#L251-L276
sbg/sevenbridges-python
sevenbridges/models/project.py
Project.remove_member
def remove_member(self, user): """ Remove member from the project. :param user: User to be removed. """ username = Transform.to_user(user) extra = { 'resource': self.__class__.__name__, 'query': { 'id': self.id, 'use...
python
def remove_member(self, user): """ Remove member from the project. :param user: User to be removed. """ username = Transform.to_user(user) extra = { 'resource': self.__class__.__name__, 'query': { 'id': self.id, 'use...
[ "def", "remove_member", "(", "self", ",", "user", ")", ":", "username", "=", "Transform", ".", "to_user", "(", "user", ")", "extra", "=", "{", "'resource'", ":", "self", ".", "__class__", ".", "__name__", ",", "'query'", ":", "{", "'id'", ":", "self", ...
Remove member from the project. :param user: User to be removed.
[ "Remove", "member", "from", "the", "project", ".", ":", "param", "user", ":", "User", "to", "be", "removed", "." ]
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/project.py#L293-L309
sbg/sevenbridges-python
sevenbridges/models/project.py
Project.get_files
def get_files(self, offset=None, limit=None): """ Retrieves files in this project. :param offset: Pagination offset. :param limit: Pagination limit. :return: Collection object. """ params = {'project': self.id, 'offset': offset, 'limit': limit} return self...
python
def get_files(self, offset=None, limit=None): """ Retrieves files in this project. :param offset: Pagination offset. :param limit: Pagination limit. :return: Collection object. """ params = {'project': self.id, 'offset': offset, 'limit': limit} return self...
[ "def", "get_files", "(", "self", ",", "offset", "=", "None", ",", "limit", "=", "None", ")", ":", "params", "=", "{", "'project'", ":", "self", ".", "id", ",", "'offset'", ":", "offset", ",", "'limit'", ":", "limit", "}", "return", "self", ".", "_a...
Retrieves files in this project. :param offset: Pagination offset. :param limit: Pagination limit. :return: Collection object.
[ "Retrieves", "files", "in", "this", "project", ".", ":", "param", "offset", ":", "Pagination", "offset", ".", ":", "param", "limit", ":", "Pagination", "limit", ".", ":", "return", ":", "Collection", "object", "." ]
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/project.py#L311-L319
sbg/sevenbridges-python
sevenbridges/models/project.py
Project.add_files
def add_files(self, files): """ Adds files to this project. :param files: List of files or a Collection object. """ for file in files: file.copy(project=self.id)
python
def add_files(self, files): """ Adds files to this project. :param files: List of files or a Collection object. """ for file in files: file.copy(project=self.id)
[ "def", "add_files", "(", "self", ",", "files", ")", ":", "for", "file", "in", "files", ":", "file", ".", "copy", "(", "project", "=", "self", ".", "id", ")" ]
Adds files to this project. :param files: List of files or a Collection object.
[ "Adds", "files", "to", "this", "project", ".", ":", "param", "files", ":", "List", "of", "files", "or", "a", "Collection", "object", "." ]
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/project.py#L321-L327
sbg/sevenbridges-python
sevenbridges/models/project.py
Project.get_apps
def get_apps(self, offset=None, limit=None): """ Retrieves apps in this project. :param offset: Pagination offset. :param limit: Pagination limit. :return: Collection object. """ params = {'project': self.id, 'offset': offset, 'limit': limit} ...
python
def get_apps(self, offset=None, limit=None): """ Retrieves apps in this project. :param offset: Pagination offset. :param limit: Pagination limit. :return: Collection object. """ params = {'project': self.id, 'offset': offset, 'limit': limit} ...
[ "def", "get_apps", "(", "self", ",", "offset", "=", "None", ",", "limit", "=", "None", ")", ":", "params", "=", "{", "'project'", ":", "self", ".", "id", ",", "'offset'", ":", "offset", ",", "'limit'", ":", "limit", "}", "return", "self", ".", "_ap...
Retrieves apps in this project. :param offset: Pagination offset. :param limit: Pagination limit. :return: Collection object.
[ "Retrieves", "apps", "in", "this", "project", ".", ":", "param", "offset", ":", "Pagination", "offset", ".", ":", "param", "limit", ":", "Pagination", "limit", ".", ":", "return", ":", "Collection", "object", "." ]
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/project.py#L329-L338
sbg/sevenbridges-python
sevenbridges/models/project.py
Project.get_tasks
def get_tasks(self, status=None, offset=None, limit=None): """ Retrieves tasks in this project. :param status: Optional task status. :param offset: Pagination offset. :param limit: Pagination limit. :return: Collection object. """ params = {'project': sel...
python
def get_tasks(self, status=None, offset=None, limit=None): """ Retrieves tasks in this project. :param status: Optional task status. :param offset: Pagination offset. :param limit: Pagination limit. :return: Collection object. """ params = {'project': sel...
[ "def", "get_tasks", "(", "self", ",", "status", "=", "None", ",", "offset", "=", "None", ",", "limit", "=", "None", ")", ":", "params", "=", "{", "'project'", ":", "self", ".", "id", ",", "'offset'", ":", "offset", ",", "'limit'", ":", "limit", "}"...
Retrieves tasks in this project. :param status: Optional task status. :param offset: Pagination offset. :param limit: Pagination limit. :return: Collection object.
[ "Retrieves", "tasks", "in", "this", "project", ".", ":", "param", "status", ":", "Optional", "task", "status", ".", ":", "param", "offset", ":", "Pagination", "offset", ".", ":", "param", "limit", ":", "Pagination", "limit", ".", ":", "return", ":", "Col...
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/project.py#L340-L351
sbg/sevenbridges-python
sevenbridges/models/project.py
Project.get_imports
def get_imports(self, volume=None, state=None, offset=None, limit=None): """ Fetches imports for this project. :param volume: Optional volume identifier. :param state: Optional state. :param offset: Pagination offset. :param limit: Pagination limit. :return: Colle...
python
def get_imports(self, volume=None, state=None, offset=None, limit=None): """ Fetches imports for this project. :param volume: Optional volume identifier. :param state: Optional state. :param offset: Pagination offset. :param limit: Pagination limit. :return: Colle...
[ "def", "get_imports", "(", "self", ",", "volume", "=", "None", ",", "state", "=", "None", ",", "offset", "=", "None", ",", "limit", "=", "None", ")", ":", "return", "self", ".", "_api", ".", "imports", ".", "query", "(", "project", "=", "self", "."...
Fetches imports for this project. :param volume: Optional volume identifier. :param state: Optional state. :param offset: Pagination offset. :param limit: Pagination limit. :return: Collection object.
[ "Fetches", "imports", "for", "this", "project", ".", ":", "param", "volume", ":", "Optional", "volume", "identifier", ".", ":", "param", "state", ":", "Optional", "state", ".", ":", "param", "offset", ":", "Pagination", "offset", ".", ":", "param", "limit"...
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/project.py#L353-L363
sbg/sevenbridges-python
sevenbridges/models/project.py
Project.get_exports
def get_exports(self, volume=None, state=None, offset=None, limit=None): """ Fetches exports for this volume. :param volume: Optional volume identifier. :param state: Optional state. :param offset: Pagination offset. :param limit: Pagination limit. :return: Collec...
python
def get_exports(self, volume=None, state=None, offset=None, limit=None): """ Fetches exports for this volume. :param volume: Optional volume identifier. :param state: Optional state. :param offset: Pagination offset. :param limit: Pagination limit. :return: Collec...
[ "def", "get_exports", "(", "self", ",", "volume", "=", "None", ",", "state", "=", "None", ",", "offset", "=", "None", ",", "limit", "=", "None", ")", ":", "return", "self", ".", "_api", ".", "exports", ".", "query", "(", "project", "=", "self", "."...
Fetches exports for this volume. :param volume: Optional volume identifier. :param state: Optional state. :param offset: Pagination offset. :param limit: Pagination limit. :return: Collection object.
[ "Fetches", "exports", "for", "this", "volume", ".", ":", "param", "volume", ":", "Optional", "volume", "identifier", ".", ":", "param", "state", ":", "Optional", "state", ".", ":", "param", "offset", ":", "Pagination", "offset", ".", ":", "param", "limit",...
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/project.py#L365-L375
sbg/sevenbridges-python
sevenbridges/models/project.py
Project.create_task
def create_task(self, name, app, revision=None, batch_input=None, batch_by=None, inputs=None, description=None, run=False, disable_batch=False, interruptible=True, execution_settings=None): """ Creates a task for this project. :param n...
python
def create_task(self, name, app, revision=None, batch_input=None, batch_by=None, inputs=None, description=None, run=False, disable_batch=False, interruptible=True, execution_settings=None): """ Creates a task for this project. :param n...
[ "def", "create_task", "(", "self", ",", "name", ",", "app", ",", "revision", "=", "None", ",", "batch_input", "=", "None", ",", "batch_by", "=", "None", ",", "inputs", "=", "None", ",", "description", "=", "None", ",", "run", "=", "False", ",", "disa...
Creates a task for this project. :param name: Task name. :param app: CWL app identifier. :param revision: CWL app revision. :param batch_input: Batch input. :param batch_by: Batch criteria. :param inputs: Input map. :param description: Task description. :...
[ "Creates", "a", "task", "for", "this", "project", "." ]
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/project.py#L377-L402
indico/indico-plugins
payment_paypal/indico_payment_paypal/util.py
validate_business
def validate_business(form, field): """Valiates a PayPal business string. It can either be an email address or a paypal business account ID. """ if not is_valid_mail(field.data, multi=False) and not re.match(r'^[a-zA-Z0-9]{13}$', field.data): raise ValidationError(_('Invalid email address / pay...
python
def validate_business(form, field): """Valiates a PayPal business string. It can either be an email address or a paypal business account ID. """ if not is_valid_mail(field.data, multi=False) and not re.match(r'^[a-zA-Z0-9]{13}$', field.data): raise ValidationError(_('Invalid email address / pay...
[ "def", "validate_business", "(", "form", ",", "field", ")", ":", "if", "not", "is_valid_mail", "(", "field", ".", "data", ",", "multi", "=", "False", ")", "and", "not", "re", ".", "match", "(", "r'^[a-zA-Z0-9]{13}$'", ",", "field", ".", "data", ")", ":...
Valiates a PayPal business string. It can either be an email address or a paypal business account ID.
[ "Valiates", "a", "PayPal", "business", "string", "." ]
train
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/payment_paypal/indico_payment_paypal/util.py#L28-L34
sbg/sevenbridges-python
sevenbridges/transfer/download.py
_download_part
def _download_part(path, session, url, retry, timeout, start_byte, end_byte): """ Downloads a single part. :param path: File path. :param session: Requests session. :param url: Url of the resource. :param retry: Number of times to retry on error. :param timeout: Session timeout. :param s...
python
def _download_part(path, session, url, retry, timeout, start_byte, end_byte): """ Downloads a single part. :param path: File path. :param session: Requests session. :param url: Url of the resource. :param retry: Number of times to retry on error. :param timeout: Session timeout. :param s...
[ "def", "_download_part", "(", "path", ",", "session", ",", "url", ",", "retry", ",", "timeout", ",", "start_byte", ",", "end_byte", ")", ":", "try", ":", "fp", "=", "os", ".", "open", "(", "path", ",", "os", ".", "O_CREAT", "|", "os", ".", "O_WRONL...
Downloads a single part. :param path: File path. :param session: Requests session. :param url: Url of the resource. :param retry: Number of times to retry on error. :param timeout: Session timeout. :param start_byte: Start byte of the part. :param end_byte: End byte of the part. :return:
[ "Downloads", "a", "single", "part", ".", ":", "param", "path", ":", "File", "path", ".", ":", "param", "session", ":", "Requests", "session", ".", ":", "param", "url", ":", "Url", "of", "the", "resource", ".", ":", "param", "retry", ":", "Number", "o...
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/transfer/download.py#L17-L67
sbg/sevenbridges-python
sevenbridges/transfer/download.py
DPartedFile.submit
def submit(self): """ Partitions the file into chunks and submits them into group of 4 for download on the api download pool. """ futures = [] while self.submitted < 4 and not self.done(): part = self.parts.pop(0) futures.append( se...
python
def submit(self): """ Partitions the file into chunks and submits them into group of 4 for download on the api download pool. """ futures = [] while self.submitted < 4 and not self.done(): part = self.parts.pop(0) futures.append( se...
[ "def", "submit", "(", "self", ")", ":", "futures", "=", "[", "]", "while", "self", ".", "submitted", "<", "4", "and", "not", "self", ".", "done", "(", ")", ":", "part", "=", "self", ".", "parts", ".", "pop", "(", "0", ")", "futures", ".", "appe...
Partitions the file into chunks and submits them into group of 4 for download on the api download pool.
[ "Partitions", "the", "file", "into", "chunks", "and", "submits", "them", "into", "group", "of", "4", "for", "download", "on", "the", "api", "download", "pool", "." ]
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/transfer/download.py#L112-L128
sbg/sevenbridges-python
sevenbridges/transfer/download.py
DPartedFile.get_parts
def get_parts(self): """ Partitions the file and saves the part information in memory. """ parts = [] start_b = 0 end_byte = start_b + PartSize.DOWNLOAD_MINIMUM_PART_SIZE - 1 for i in range(self.total): parts.append([start_b, end_byte]) sta...
python
def get_parts(self): """ Partitions the file and saves the part information in memory. """ parts = [] start_b = 0 end_byte = start_b + PartSize.DOWNLOAD_MINIMUM_PART_SIZE - 1 for i in range(self.total): parts.append([start_b, end_byte]) sta...
[ "def", "get_parts", "(", "self", ")", ":", "parts", "=", "[", "]", "start_b", "=", "0", "end_byte", "=", "start_b", "+", "PartSize", ".", "DOWNLOAD_MINIMUM_PART_SIZE", "-", "1", "for", "i", "in", "range", "(", "self", ".", "total", ")", ":", "parts", ...
Partitions the file and saves the part information in memory.
[ "Partitions", "the", "file", "and", "saves", "the", "part", "information", "in", "memory", "." ]
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/transfer/download.py#L142-L153
sbg/sevenbridges-python
sevenbridges/transfer/download.py
Download.pause
def pause(self): """ Pauses the download. :raises SbgError: If upload is not in RUNNING state. """ if self._status == TransferState.RUNNING: self._running.clear() self._status = TransferState.PAUSED else: raise SbgError('Can not pause. ...
python
def pause(self): """ Pauses the download. :raises SbgError: If upload is not in RUNNING state. """ if self._status == TransferState.RUNNING: self._running.clear() self._status = TransferState.PAUSED else: raise SbgError('Can not pause. ...
[ "def", "pause", "(", "self", ")", ":", "if", "self", ".", "_status", "==", "TransferState", ".", "RUNNING", ":", "self", ".", "_running", ".", "clear", "(", ")", "self", ".", "_status", "=", "TransferState", ".", "PAUSED", "else", ":", "raise", "SbgErr...
Pauses the download. :raises SbgError: If upload is not in RUNNING state.
[ "Pauses", "the", "download", ".", ":", "raises", "SbgError", ":", "If", "upload", "is", "not", "in", "RUNNING", "state", "." ]
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/transfer/download.py#L261-L270
sbg/sevenbridges-python
sevenbridges/transfer/download.py
Download.stop
def stop(self): """ Stops the download. :raises SbgError: If download is not in PAUSED or RUNNING state. """ if self.status in (TransferState.PAUSED, TransferState.RUNNING): self._stop_signal = True self.join() self._status = TransferState.STOP...
python
def stop(self): """ Stops the download. :raises SbgError: If download is not in PAUSED or RUNNING state. """ if self.status in (TransferState.PAUSED, TransferState.RUNNING): self._stop_signal = True self.join() self._status = TransferState.STOP...
[ "def", "stop", "(", "self", ")", ":", "if", "self", ".", "status", "in", "(", "TransferState", ".", "PAUSED", ",", "TransferState", ".", "RUNNING", ")", ":", "self", ".", "_stop_signal", "=", "True", "self", ".", "join", "(", ")", "self", ".", "_stat...
Stops the download. :raises SbgError: If download is not in PAUSED or RUNNING state.
[ "Stops", "the", "download", ".", ":", "raises", "SbgError", ":", "If", "download", "is", "not", "in", "PAUSED", "or", "RUNNING", "state", "." ]
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/transfer/download.py#L272-L286
sbg/sevenbridges-python
sevenbridges/transfer/download.py
Download.resume
def resume(self): """ Resumes the download. :raises SbgError: If download is not in RUNNING state. """ if self._status != TransferState.PAUSED: self._running.set() self._status = TransferState.RUNNING else: raise SbgError('Can not pause...
python
def resume(self): """ Resumes the download. :raises SbgError: If download is not in RUNNING state. """ if self._status != TransferState.PAUSED: self._running.set() self._status = TransferState.RUNNING else: raise SbgError('Can not pause...
[ "def", "resume", "(", "self", ")", ":", "if", "self", ".", "_status", "!=", "TransferState", ".", "PAUSED", ":", "self", ".", "_running", ".", "set", "(", ")", "self", ".", "_status", "=", "TransferState", ".", "RUNNING", "else", ":", "raise", "SbgErro...
Resumes the download. :raises SbgError: If download is not in RUNNING state.
[ "Resumes", "the", "download", ".", ":", "raises", "SbgError", ":", "If", "download", "is", "not", "in", "RUNNING", "state", "." ]
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/transfer/download.py#L288-L297
sbg/sevenbridges-python
sevenbridges/transfer/download.py
Download.start
def start(self): """ Starts the download. :raises SbgError: If download is not in PREPARING state. """ if self._status == TransferState.PREPARING: self._running.set() super(Download, self).start() self._status = TransferState.RUNNING ...
python
def start(self): """ Starts the download. :raises SbgError: If download is not in PREPARING state. """ if self._status == TransferState.PREPARING: self._running.set() super(Download, self).start() self._status = TransferState.RUNNING ...
[ "def", "start", "(", "self", ")", ":", "if", "self", ".", "_status", "==", "TransferState", ".", "PREPARING", ":", "self", ".", "_running", ".", "set", "(", ")", "super", "(", "Download", ",", "self", ")", ".", "start", "(", ")", "self", ".", "_sta...
Starts the download. :raises SbgError: If download is not in PREPARING state.
[ "Starts", "the", "download", ".", ":", "raises", "SbgError", ":", "If", "download", "is", "not", "in", "PREPARING", "state", "." ]
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/transfer/download.py#L305-L318
sbg/sevenbridges-python
sevenbridges/transfer/download.py
Download.run
def run(self): """ Runs the thread! Should not be used use start() method instead. """ self._running.set() self._status = TransferState.RUNNING self._time_started = time.time() parted_file = DPartedFile(self._temp_file, self._ses...
python
def run(self): """ Runs the thread! Should not be used use start() method instead. """ self._running.set() self._status = TransferState.RUNNING self._time_started = time.time() parted_file = DPartedFile(self._temp_file, self._ses...
[ "def", "run", "(", "self", ")", ":", "self", ".", "_running", ".", "set", "(", ")", "self", ".", "_status", "=", "TransferState", ".", "RUNNING", "self", ".", "_time_started", "=", "time", ".", "time", "(", ")", "parted_file", "=", "DPartedFile", "(", ...
Runs the thread! Should not be used use start() method instead.
[ "Runs", "the", "thread!", "Should", "not", "be", "used", "use", "start", "()", "method", "instead", "." ]
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/transfer/download.py#L320-L363
sbg/sevenbridges-python
sevenbridges/transfer/download.py
Download._get_file_size
def _get_file_size(self): """ Fetches file size by reading the Content-Length header for the resource. :return: File size. """ file_size = retry(self._retry_count)(_get_content_length)( self._session, self.url, self._timeout ) file_size = int(f...
python
def _get_file_size(self): """ Fetches file size by reading the Content-Length header for the resource. :return: File size. """ file_size = retry(self._retry_count)(_get_content_length)( self._session, self.url, self._timeout ) file_size = int(f...
[ "def", "_get_file_size", "(", "self", ")", ":", "file_size", "=", "retry", "(", "self", ".", "_retry_count", ")", "(", "_get_content_length", ")", "(", "self", ".", "_session", ",", "self", ".", "url", ",", "self", ".", "_timeout", ")", "file_size", "=",...
Fetches file size by reading the Content-Length header for the resource. :return: File size.
[ "Fetches", "file", "size", "by", "reading", "the", "Content", "-", "Length", "header", "for", "the", "resource", ".", ":", "return", ":", "File", "size", "." ]
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/transfer/download.py#L365-L378
indico/indico-plugins
livesync/indico_livesync/base.py
LiveSyncBackendBase.run
def run(self): """Runs the livesync export""" if self.uploader is None: # pragma: no cover raise NotImplementedError records = self.fetch_records() uploader = self.uploader(self) LiveSyncPlugin.logger.info('Uploading %d records', len(records)) uploader.run(r...
python
def run(self): """Runs the livesync export""" if self.uploader is None: # pragma: no cover raise NotImplementedError records = self.fetch_records() uploader = self.uploader(self) LiveSyncPlugin.logger.info('Uploading %d records', len(records)) uploader.run(r...
[ "def", "run", "(", "self", ")", ":", "if", "self", ".", "uploader", "is", "None", ":", "# pragma: no cover", "raise", "NotImplementedError", "records", "=", "self", ".", "fetch_records", "(", ")", "uploader", "=", "self", ".", "uploader", "(", "self", ")",...
Runs the livesync export
[ "Runs", "the", "livesync", "export" ]
train
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/livesync/indico_livesync/base.py#L91-L100
indico/indico-plugins
livesync/indico_livesync/base.py
LiveSyncBackendBase.run_initial_export
def run_initial_export(self, events): """Runs the initial export. This process is expected to take a very long time. :param events: iterable of all events in this indico instance """ if self.uploader is None: # pragma: no cover raise NotImplementedError up...
python
def run_initial_export(self, events): """Runs the initial export. This process is expected to take a very long time. :param events: iterable of all events in this indico instance """ if self.uploader is None: # pragma: no cover raise NotImplementedError up...
[ "def", "run_initial_export", "(", "self", ",", "events", ")", ":", "if", "self", ".", "uploader", "is", "None", ":", "# pragma: no cover", "raise", "NotImplementedError", "uploader", "=", "self", ".", "uploader", "(", "self", ")", "uploader", ".", "run_initial...
Runs the initial export. This process is expected to take a very long time. :param events: iterable of all events in this indico instance
[ "Runs", "the", "initial", "export", "." ]
train
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/livesync/indico_livesync/base.py#L102-L113
indico/indico-plugins
chat/indico_chat/util.py
check_config
def check_config(quiet=False): """Checks if all required config options are set :param quiet: if True, return the result as a bool, otherwise raise `IndicoError` if any setting is missing """ from indico_chat.plugin import ChatPlugin settings = ChatPlugin.settings.get_all() mi...
python
def check_config(quiet=False): """Checks if all required config options are set :param quiet: if True, return the result as a bool, otherwise raise `IndicoError` if any setting is missing """ from indico_chat.plugin import ChatPlugin settings = ChatPlugin.settings.get_all() mi...
[ "def", "check_config", "(", "quiet", "=", "False", ")", ":", "from", "indico_chat", ".", "plugin", "import", "ChatPlugin", "settings", "=", "ChatPlugin", ".", "settings", ".", "get_all", "(", ")", "missing", "=", "not", "all", "(", "settings", "[", "x", ...
Checks if all required config options are set :param quiet: if True, return the result as a bool, otherwise raise `IndicoError` if any setting is missing
[ "Checks", "if", "all", "required", "config", "options", "are", "set" ]
train
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/chat/indico_chat/util.py#L24-L35
indico/indico-plugins
chat/indico_chat/util.py
is_chat_admin
def is_chat_admin(user): """Checks if a user is a chat admin""" from indico_chat.plugin import ChatPlugin return ChatPlugin.settings.acls.contains_user('admins', user)
python
def is_chat_admin(user): """Checks if a user is a chat admin""" from indico_chat.plugin import ChatPlugin return ChatPlugin.settings.acls.contains_user('admins', user)
[ "def", "is_chat_admin", "(", "user", ")", ":", "from", "indico_chat", ".", "plugin", "import", "ChatPlugin", "return", "ChatPlugin", ".", "settings", ".", "acls", ".", "contains_user", "(", "'admins'", ",", "user", ")" ]
Checks if a user is a chat admin
[ "Checks", "if", "a", "user", "is", "a", "chat", "admin" ]
train
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/chat/indico_chat/util.py#L38-L41
sbg/sevenbridges-python
sevenbridges/models/compound/tasks/__init__.py
map_input_output
def map_input_output(item, api): """ Maps item to appropriate sevebridges object. :param item: Input/Output value. :param api: Api instance. :return: Mapped object. """ if isinstance(item, list): return [map_input_output(it, api) for it in item] elif isinstance(item, dict) and '...
python
def map_input_output(item, api): """ Maps item to appropriate sevebridges object. :param item: Input/Output value. :param api: Api instance. :return: Mapped object. """ if isinstance(item, list): return [map_input_output(it, api) for it in item] elif isinstance(item, dict) and '...
[ "def", "map_input_output", "(", "item", ",", "api", ")", ":", "if", "isinstance", "(", "item", ",", "list", ")", ":", "return", "[", "map_input_output", "(", "it", ",", "api", ")", "for", "it", "in", "item", "]", "elif", "isinstance", "(", "item", ",...
Maps item to appropriate sevebridges object. :param item: Input/Output value. :param api: Api instance. :return: Mapped object.
[ "Maps", "item", "to", "appropriate", "sevebridges", "object", ".", ":", "param", "item", ":", "Input", "/", "Output", "value", ".", ":", "param", "api", ":", "Api", "instance", ".", ":", "return", ":", "Mapped", "object", "." ]
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/compound/tasks/__init__.py#L4-L19
sbg/sevenbridges-python
sevenbridges/decorators.py
inplace_reload
def inplace_reload(method): """ Executes the wrapped function and reloads the object with data returned from the server. """ # noinspection PyProtectedMember def wrapped(obj, *args, **kwargs): in_place = True if kwargs.get('inplace') in (True, None) else False api_object = metho...
python
def inplace_reload(method): """ Executes the wrapped function and reloads the object with data returned from the server. """ # noinspection PyProtectedMember def wrapped(obj, *args, **kwargs): in_place = True if kwargs.get('inplace') in (True, None) else False api_object = metho...
[ "def", "inplace_reload", "(", "method", ")", ":", "# noinspection PyProtectedMember", "def", "wrapped", "(", "obj", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "in_place", "=", "True", "if", "kwargs", ".", "get", "(", "'inplace'", ")", "in", "("...
Executes the wrapped function and reloads the object with data returned from the server.
[ "Executes", "the", "wrapped", "function", "and", "reloads", "the", "object", "with", "data", "returned", "from", "the", "server", "." ]
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/decorators.py#L24-L44
sbg/sevenbridges-python
sevenbridges/decorators.py
retry_on_excs
def retry_on_excs(excs, retry_count=3, delay=5): """Retry decorator used to retry callables on for specific exceptions. :param excs: Exceptions tuple. :param retry_count: Retry count. :param delay: Delay in seconds between retries. :return: Wrapped function object. """ def wrapper(f): ...
python
def retry_on_excs(excs, retry_count=3, delay=5): """Retry decorator used to retry callables on for specific exceptions. :param excs: Exceptions tuple. :param retry_count: Retry count. :param delay: Delay in seconds between retries. :return: Wrapped function object. """ def wrapper(f): ...
[ "def", "retry_on_excs", "(", "excs", ",", "retry_count", "=", "3", ",", "delay", "=", "5", ")", ":", "def", "wrapper", "(", "f", ")", ":", "@", "functools", ".", "wraps", "(", "f", ")", "def", "deco", "(", "*", "args", ",", "*", "*", "kwargs", ...
Retry decorator used to retry callables on for specific exceptions. :param excs: Exceptions tuple. :param retry_count: Retry count. :param delay: Delay in seconds between retries. :return: Wrapped function object.
[ "Retry", "decorator", "used", "to", "retry", "callables", "on", "for", "specific", "exceptions", "." ]
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/decorators.py#L47-L78
sbg/sevenbridges-python
sevenbridges/decorators.py
retry
def retry(retry_count): """ Retry decorator used during file upload and download. """ def func(f): @functools.wraps(f) def wrapper(*args, **kwargs): for backoff in range(retry_count): try: return f(*args, **kwargs) except E...
python
def retry(retry_count): """ Retry decorator used during file upload and download. """ def func(f): @functools.wraps(f) def wrapper(*args, **kwargs): for backoff in range(retry_count): try: return f(*args, **kwargs) except E...
[ "def", "retry", "(", "retry_count", ")", ":", "def", "func", "(", "f", ")", ":", "@", "functools", ".", "wraps", "(", "f", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "for", "backoff", "in", "range", "(", "retry_co...
Retry decorator used during file upload and download.
[ "Retry", "decorator", "used", "during", "file", "upload", "and", "download", "." ]
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/decorators.py#L81-L101
sbg/sevenbridges-python
sevenbridges/decorators.py
check_for_error
def check_for_error(func): """ Executes the wrapped function and inspects the response object for specific errors. """ @functools.wraps(func) def wrapper(*args, **kwargs): try: response = func(*args, **kwargs) status_code = response.status_code if sta...
python
def check_for_error(func): """ Executes the wrapped function and inspects the response object for specific errors. """ @functools.wraps(func) def wrapper(*args, **kwargs): try: response = func(*args, **kwargs) status_code = response.status_code if sta...
[ "def", "check_for_error", "(", "func", ")", ":", "@", "functools", ".", "wraps", "(", "func", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "try", ":", "response", "=", "func", "(", "*", "args", ",", "*", "*", "kwarg...
Executes the wrapped function and inspects the response object for specific errors.
[ "Executes", "the", "wrapped", "function", "and", "inspects", "the", "response", "object", "for", "specific", "errors", "." ]
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/decorators.py#L104-L154
sbg/sevenbridges-python
sevenbridges/meta/collection.py
Collection.all
def all(self): """ Fetches all available items. :return: Collection object. """ page = self._load(self.href) while True: try: for item in page._items: yield item page = page.next_page() except Pag...
python
def all(self): """ Fetches all available items. :return: Collection object. """ page = self._load(self.href) while True: try: for item in page._items: yield item page = page.next_page() except Pag...
[ "def", "all", "(", "self", ")", ":", "page", "=", "self", ".", "_load", "(", "self", ".", "href", ")", "while", "True", ":", "try", ":", "for", "item", "in", "page", ".", "_items", ":", "yield", "item", "page", "=", "page", ".", "next_page", "(",...
Fetches all available items. :return: Collection object.
[ "Fetches", "all", "available", "items", ".", ":", "return", ":", "Collection", "object", "." ]
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/meta/collection.py#L31-L43
sbg/sevenbridges-python
sevenbridges/meta/collection.py
Collection.next_page
def next_page(self): """ Fetches next result set. :return: Collection object. """ for link in self.links: if link.rel.lower() == 'next': return self._load(link.href) raise PaginationError('No more entries.')
python
def next_page(self): """ Fetches next result set. :return: Collection object. """ for link in self.links: if link.rel.lower() == 'next': return self._load(link.href) raise PaginationError('No more entries.')
[ "def", "next_page", "(", "self", ")", ":", "for", "link", "in", "self", ".", "links", ":", "if", "link", ".", "rel", ".", "lower", "(", ")", "==", "'next'", ":", "return", "self", ".", "_load", "(", "link", ".", "href", ")", "raise", "PaginationErr...
Fetches next result set. :return: Collection object.
[ "Fetches", "next", "result", "set", ".", ":", "return", ":", "Collection", "object", "." ]
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/meta/collection.py#L61-L69
sbg/sevenbridges-python
sevenbridges/meta/collection.py
VolumeCollection.next_page
def next_page(self): """ Fetches next result set. :return: VolumeCollection object. """ for link in self.links: if link.next: return self._load(link.next) raise PaginationError('No more entries.')
python
def next_page(self): """ Fetches next result set. :return: VolumeCollection object. """ for link in self.links: if link.next: return self._load(link.next) raise PaginationError('No more entries.')
[ "def", "next_page", "(", "self", ")", ":", "for", "link", "in", "self", ".", "links", ":", "if", "link", ".", "next", ":", "return", "self", ".", "_load", "(", "link", ".", "next", ")", "raise", "PaginationError", "(", "'No more entries.'", ")" ]
Fetches next result set. :return: VolumeCollection object.
[ "Fetches", "next", "result", "set", ".", ":", "return", ":", "VolumeCollection", "object", "." ]
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/meta/collection.py#L99-L107
indico/indico-plugins
piwik/indico_piwik/reports.py
ReportBase.get
def get(cls, *args, **kwargs): """Create and return a serializable Report object, retrieved from cache if possible""" from indico_piwik.plugin import PiwikPlugin if not PiwikPlugin.settings.get('cache_enabled'): return cls(*args, **kwargs).to_serializable() cache = Generic...
python
def get(cls, *args, **kwargs): """Create and return a serializable Report object, retrieved from cache if possible""" from indico_piwik.plugin import PiwikPlugin if not PiwikPlugin.settings.get('cache_enabled'): return cls(*args, **kwargs).to_serializable() cache = Generic...
[ "def", "get", "(", "cls", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "from", "indico_piwik", ".", "plugin", "import", "PiwikPlugin", "if", "not", "PiwikPlugin", ".", "settings", ".", "get", "(", "'cache_enabled'", ")", ":", "return", "cls", "...
Create and return a serializable Report object, retrieved from cache if possible
[ "Create", "and", "return", "a", "serializable", "Report", "object", "retrieved", "from", "cache", "if", "possible" ]
train
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/piwik/indico_piwik/reports.py#L59-L74
indico/indico-plugins
piwik/indico_piwik/reports.py
ReportBase._init_date_range
def _init_date_range(self, start_date=None, end_date=None): """Set date range defaults if no dates are passed""" self.end_date = end_date self.start_date = start_date if self.end_date is None: today = now_utc().date() end_date = self.event.end_dt.date() ...
python
def _init_date_range(self, start_date=None, end_date=None): """Set date range defaults if no dates are passed""" self.end_date = end_date self.start_date = start_date if self.end_date is None: today = now_utc().date() end_date = self.event.end_dt.date() ...
[ "def", "_init_date_range", "(", "self", ",", "start_date", "=", "None", ",", "end_date", "=", "None", ")", ":", "self", ".", "end_date", "=", "end_date", "self", ".", "start_date", "=", "start_date", "if", "self", ".", "end_date", "is", "None", ":", "tod...
Set date range defaults if no dates are passed
[ "Set", "date", "range", "defaults", "if", "no", "dates", "are", "passed" ]
train
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/piwik/indico_piwik/reports.py#L80-L89
indico/indico-plugins
piwik/indico_piwik/reports.py
ReportGeneral._build_report
def _build_report(self): """Build the report by performing queries to Piwik""" self.metrics = {} queries = {'visits': PiwikQueryReportEventMetricVisits(**self.params), 'unique_visits': PiwikQueryReportEventMetricUniqueVisits(**self.params), 'visit_duration':...
python
def _build_report(self): """Build the report by performing queries to Piwik""" self.metrics = {} queries = {'visits': PiwikQueryReportEventMetricVisits(**self.params), 'unique_visits': PiwikQueryReportEventMetricUniqueVisits(**self.params), 'visit_duration':...
[ "def", "_build_report", "(", "self", ")", ":", "self", ".", "metrics", "=", "{", "}", "queries", "=", "{", "'visits'", ":", "PiwikQueryReportEventMetricVisits", "(", "*", "*", "self", ".", "params", ")", ",", "'unique_visits'", ":", "PiwikQueryReportEventMetri...
Build the report by performing queries to Piwik
[ "Build", "the", "report", "by", "performing", "queries", "to", "Piwik" ]
train
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/piwik/indico_piwik/reports.py#L116-L128
indico/indico-plugins
piwik/indico_piwik/reports.py
ReportGeneral._fetch_contribution_info
def _fetch_contribution_info(self): """Build the list of information entries for contributions of the event""" self.contributions = {} query = (Contribution.query .with_parent(self.event) .options(joinedload('legacy_mapping'), joinedloa...
python
def _fetch_contribution_info(self): """Build the list of information entries for contributions of the event""" self.contributions = {} query = (Contribution.query .with_parent(self.event) .options(joinedload('legacy_mapping'), joinedloa...
[ "def", "_fetch_contribution_info", "(", "self", ")", ":", "self", ".", "contributions", "=", "{", "}", "query", "=", "(", "Contribution", ".", "query", ".", "with_parent", "(", "self", ".", "event", ")", ".", "options", "(", "joinedload", "(", "'legacy_map...
Build the list of information entries for contributions of the event
[ "Build", "the", "list", "of", "information", "entries", "for", "contributions", "of", "the", "event" ]
train
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/piwik/indico_piwik/reports.py#L130-L144
Kane610/deconz
pydeconz/deconzdevice.py
DeconzDevice.remove_callback
def remove_callback(self, callback): """Remove callback previously registered.""" if callback in self._async_callbacks: self._async_callbacks.remove(callback)
python
def remove_callback(self, callback): """Remove callback previously registered.""" if callback in self._async_callbacks: self._async_callbacks.remove(callback)
[ "def", "remove_callback", "(", "self", ",", "callback", ")", ":", "if", "callback", "in", "self", ".", "_async_callbacks", ":", "self", ".", "_async_callbacks", ".", "remove", "(", "callback", ")" ]
Remove callback previously registered.
[ "Remove", "callback", "previously", "registered", "." ]
train
https://github.com/Kane610/deconz/blob/8a9498dbbc8c168d4a081173ad6c3b1e17fffdf6/pydeconz/deconzdevice.py#L37-L40
Kane610/deconz
pydeconz/deconzdevice.py
DeconzDevice.update_attr
def update_attr(self, attr): """Update input attr in self. Return list of attributes with changed values. """ changed_attr = [] for key, value in attr.items(): if value is None: continue if getattr(self, "_{0}".format(key), None) != value:...
python
def update_attr(self, attr): """Update input attr in self. Return list of attributes with changed values. """ changed_attr = [] for key, value in attr.items(): if value is None: continue if getattr(self, "_{0}".format(key), None) != value:...
[ "def", "update_attr", "(", "self", ",", "attr", ")", ":", "changed_attr", "=", "[", "]", "for", "key", ",", "value", "in", "attr", ".", "items", "(", ")", ":", "if", "value", "is", "None", ":", "continue", "if", "getattr", "(", "self", ",", "\"_{0}...
Update input attr in self. Return list of attributes with changed values.
[ "Update", "input", "attr", "in", "self", "." ]
train
https://github.com/Kane610/deconz/blob/8a9498dbbc8c168d4a081173ad6c3b1e17fffdf6/pydeconz/deconzdevice.py#L42-L55
sbg/sevenbridges-python
sevenbridges/models/actions.py
Actions.send_feedback
def send_feedback(cls, type=FeedbackType.IDEA, referrer=None, text=None, api=None): """ Sends feedback to sevenbridges. :param type: FeedbackType wither IDEA, PROBLEM or THOUGHT. :param text: Feedback text. :param referrer: Feedback referrer. :param ...
python
def send_feedback(cls, type=FeedbackType.IDEA, referrer=None, text=None, api=None): """ Sends feedback to sevenbridges. :param type: FeedbackType wither IDEA, PROBLEM or THOUGHT. :param text: Feedback text. :param referrer: Feedback referrer. :param ...
[ "def", "send_feedback", "(", "cls", ",", "type", "=", "FeedbackType", ".", "IDEA", ",", "referrer", "=", "None", ",", "text", "=", "None", ",", "api", "=", "None", ")", ":", "api", "=", "api", "if", "api", "else", "cls", ".", "_API", "data", "=", ...
Sends feedback to sevenbridges. :param type: FeedbackType wither IDEA, PROBLEM or THOUGHT. :param text: Feedback text. :param referrer: Feedback referrer. :param api: Api instance.
[ "Sends", "feedback", "to", "sevenbridges", ".", ":", "param", "type", ":", "FeedbackType", "wither", "IDEA", "PROBLEM", "or", "THOUGHT", ".", ":", "param", "text", ":", "Feedback", "text", ".", ":", "param", "referrer", ":", "Feedback", "referrer", ".", ":...
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/actions.py#L23-L44
sbg/sevenbridges-python
sevenbridges/models/actions.py
Actions.bulk_copy_files
def bulk_copy_files(cls, files, destination_project, api=None): """ Bulk copy of files. :param files: List containing files to be copied. :param destination_project: Destination project. :param api: Api instance. :return: MultiStatus copy result. """ api =...
python
def bulk_copy_files(cls, files, destination_project, api=None): """ Bulk copy of files. :param files: List containing files to be copied. :param destination_project: Destination project. :param api: Api instance. :return: MultiStatus copy result. """ api =...
[ "def", "bulk_copy_files", "(", "cls", ",", "files", ",", "destination_project", ",", "api", "=", "None", ")", ":", "api", "=", "api", "if", "api", "else", "cls", ".", "_API", "files", "=", "[", "Transform", ".", "to_file", "(", "file", ")", "for", "f...
Bulk copy of files. :param files: List containing files to be copied. :param destination_project: Destination project. :param api: Api instance. :return: MultiStatus copy result.
[ "Bulk", "copy", "of", "files", ".", ":", "param", "files", ":", "List", "containing", "files", "to", "be", "copied", ".", ":", "param", "destination_project", ":", "Destination", "project", ".", ":", "param", "api", ":", "Api", "instance", ".", ":", "ret...
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/actions.py#L47-L66
Kane610/deconz
pydeconz/group.py
DeconzGroup.async_set_state
async def async_set_state(self, data): """Set state of light group. { "on": true, "bri": 180, "hue": 43680, "sat": 255, "transitiontime": 10 } Also update local values of group since websockets doesn't. """ fie...
python
async def async_set_state(self, data): """Set state of light group. { "on": true, "bri": 180, "hue": 43680, "sat": 255, "transitiontime": 10 } Also update local values of group since websockets doesn't. """ fie...
[ "async", "def", "async_set_state", "(", "self", ",", "data", ")", ":", "field", "=", "self", ".", "deconz_id", "+", "'/action'", "await", "self", ".", "_async_set_state_callback", "(", "field", ",", "data", ")", "self", ".", "async_update", "(", "{", "'sta...
Set state of light group. { "on": true, "bri": 180, "hue": 43680, "sat": 255, "transitiontime": 10 } Also update local values of group since websockets doesn't.
[ "Set", "state", "of", "light", "group", "." ]
train
https://github.com/Kane610/deconz/blob/8a9498dbbc8c168d4a081173ad6c3b1e17fffdf6/pydeconz/group.py#L46-L61
Kane610/deconz
pydeconz/group.py
DeconzGroup.async_add_scenes
def async_add_scenes(self, scenes, async_set_state_callback): """Add scenes belonging to group.""" self._scenes = { scene['id']: DeconzScene(self, scene, async_set_state_callback) for scene in scenes if scene['id'] not in self._scenes }
python
def async_add_scenes(self, scenes, async_set_state_callback): """Add scenes belonging to group.""" self._scenes = { scene['id']: DeconzScene(self, scene, async_set_state_callback) for scene in scenes if scene['id'] not in self._scenes }
[ "def", "async_add_scenes", "(", "self", ",", "scenes", ",", "async_set_state_callback", ")", ":", "self", ".", "_scenes", "=", "{", "scene", "[", "'id'", "]", ":", "DeconzScene", "(", "self", ",", "scene", ",", "async_set_state_callback", ")", "for", "scene"...
Add scenes belonging to group.
[ "Add", "scenes", "belonging", "to", "group", "." ]
train
https://github.com/Kane610/deconz/blob/8a9498dbbc8c168d4a081173ad6c3b1e17fffdf6/pydeconz/group.py#L132-L138
Kane610/deconz
pydeconz/group.py
DeconzGroup.update_color_state
def update_color_state(self, light): """Sync color state with light.""" x, y = light.xy or (None, None) self.async_update({ 'state': { 'bri': light.brightness, 'hue': light.hue, 'sat': light.sat, 'ct': light.ct, ...
python
def update_color_state(self, light): """Sync color state with light.""" x, y = light.xy or (None, None) self.async_update({ 'state': { 'bri': light.brightness, 'hue': light.hue, 'sat': light.sat, 'ct': light.ct, ...
[ "def", "update_color_state", "(", "self", ",", "light", ")", ":", "x", ",", "y", "=", "light", ".", "xy", "or", "(", "None", ",", "None", ")", "self", ".", "async_update", "(", "{", "'state'", ":", "{", "'bri'", ":", "light", ".", "brightness", ","...
Sync color state with light.
[ "Sync", "color", "state", "with", "light", "." ]
train
https://github.com/Kane610/deconz/blob/8a9498dbbc8c168d4a081173ad6c3b1e17fffdf6/pydeconz/group.py#L140-L153
Kane610/deconz
pydeconz/group.py
DeconzScene.async_set_state
async def async_set_state(self, data): """Recall scene to group.""" field = self._deconz_id + '/recall' await self._async_set_state_callback(field, data)
python
async def async_set_state(self, data): """Recall scene to group.""" field = self._deconz_id + '/recall' await self._async_set_state_callback(field, data)
[ "async", "def", "async_set_state", "(", "self", ",", "data", ")", ":", "field", "=", "self", ".", "_deconz_id", "+", "'/recall'", "await", "self", ".", "_async_set_state_callback", "(", "field", ",", "data", ")" ]
Recall scene to group.
[ "Recall", "scene", "to", "group", "." ]
train
https://github.com/Kane610/deconz/blob/8a9498dbbc8c168d4a081173ad6c3b1e17fffdf6/pydeconz/group.py#L175-L178
sbg/sevenbridges-python
sevenbridges/models/user.py
User.me
def me(cls, api=None): """ Retrieves current user information. :param api: Api instance. :return: User object. """ api = api if api else cls._API extra = { 'resource': cls.__name__, 'query': {} } logger.info('Fetching user i...
python
def me(cls, api=None): """ Retrieves current user information. :param api: Api instance. :return: User object. """ api = api if api else cls._API extra = { 'resource': cls.__name__, 'query': {} } logger.info('Fetching user i...
[ "def", "me", "(", "cls", ",", "api", "=", "None", ")", ":", "api", "=", "api", "if", "api", "else", "cls", ".", "_API", "extra", "=", "{", "'resource'", ":", "cls", ".", "__name__", ",", "'query'", ":", "{", "}", "}", "logger", ".", "info", "("...
Retrieves current user information. :param api: Api instance. :return: User object.
[ "Retrieves", "current", "user", "information", ".", ":", "param", "api", ":", "Api", "instance", ".", ":", "return", ":", "User", "object", "." ]
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/user.py#L49-L62
sbg/sevenbridges-python
sevenbridges/models/marker.py
Marker.query
def query(cls, file, offset=None, limit=None, api=None): """ Queries genome markers on a file. :param file: Genome file - Usually bam file. :param offset: Pagination offset. :param limit: Pagination limit. :param api: Api instance. :return: Collection object. ...
python
def query(cls, file, offset=None, limit=None, api=None): """ Queries genome markers on a file. :param file: Genome file - Usually bam file. :param offset: Pagination offset. :param limit: Pagination limit. :param api: Api instance. :return: Collection object. ...
[ "def", "query", "(", "cls", ",", "file", ",", "offset", "=", "None", ",", "limit", "=", "None", ",", "api", "=", "None", ")", ":", "api", "=", "api", "if", "api", "else", "cls", ".", "_API", "file", "=", "Transform", ".", "to_file", "(", "file", ...
Queries genome markers on a file. :param file: Genome file - Usually bam file. :param offset: Pagination offset. :param limit: Pagination limit. :param api: Api instance. :return: Collection object.
[ "Queries", "genome", "markers", "on", "a", "file", ".", ":", "param", "file", ":", "Genome", "file", "-", "Usually", "bam", "file", ".", ":", "param", "offset", ":", "Pagination", "offset", ".", ":", "param", "limit", ":", "Pagination", "limit", ".", "...
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/marker.py#L47-L62
sbg/sevenbridges-python
sevenbridges/models/marker.py
Marker.create
def create(cls, file, name, position, chromosome, private=True, api=None): """ Create a marker on a file. :param file: File object or identifier. :param name: Marker name. :param position: Marker position object. :param chromosome: Chromosome number. :param privat...
python
def create(cls, file, name, position, chromosome, private=True, api=None): """ Create a marker on a file. :param file: File object or identifier. :param name: Marker name. :param position: Marker position object. :param chromosome: Chromosome number. :param privat...
[ "def", "create", "(", "cls", ",", "file", ",", "name", ",", "position", ",", "chromosome", ",", "private", "=", "True", ",", "api", "=", "None", ")", ":", "api", "=", "api", "if", "api", "else", "cls", ".", "_API", "file", "=", "Transform", ".", ...
Create a marker on a file. :param file: File object or identifier. :param name: Marker name. :param position: Marker position object. :param chromosome: Chromosome number. :param private: Whether the marker is private or public. :param api: Api instance. :return: ...
[ "Create", "a", "marker", "on", "a", "file", ".", ":", "param", "file", ":", "File", "object", "or", "identifier", ".", ":", "param", "name", ":", "Marker", "name", ".", ":", "param", "position", ":", "Marker", "position", "object", ".", ":", "param", ...
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/marker.py#L65-L93
sbg/sevenbridges-python
sevenbridges/models/marker.py
Marker.save
def save(self, inplace=True): """ Saves all modification to the marker on the server. :param inplace Apply edits on the current instance or get a new one. :return: Marker instance. """ modified_data = self._modified_data() if bool(modified_data): extra...
python
def save(self, inplace=True): """ Saves all modification to the marker on the server. :param inplace Apply edits on the current instance or get a new one. :return: Marker instance. """ modified_data = self._modified_data() if bool(modified_data): extra...
[ "def", "save", "(", "self", ",", "inplace", "=", "True", ")", ":", "modified_data", "=", "self", ".", "_modified_data", "(", ")", "if", "bool", "(", "modified_data", ")", ":", "extra", "=", "{", "'resource'", ":", "self", ".", "__class__", ".", "__name...
Saves all modification to the marker on the server. :param inplace Apply edits on the current instance or get a new one. :return: Marker instance.
[ "Saves", "all", "modification", "to", "the", "marker", "on", "the", "server", ".", ":", "param", "inplace", "Apply", "edits", "on", "the", "current", "instance", "or", "get", "a", "new", "one", ".", ":", "return", ":", "Marker", "instance", "." ]
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/marker.py#L96-L117
Kane610/deconz
pydeconz/light.py
DeconzLightBase.async_update
def async_update(self, event): """New event for light. Check that state is part of event. Signal that light has updated state. """ self.update_attr(event.get('state', {})) super().async_update(event)
python
def async_update(self, event): """New event for light. Check that state is part of event. Signal that light has updated state. """ self.update_attr(event.get('state', {})) super().async_update(event)
[ "def", "async_update", "(", "self", ",", "event", ")", ":", "self", ".", "update_attr", "(", "event", ".", "get", "(", "'state'", ",", "{", "}", ")", ")", "super", "(", ")", ".", "async_update", "(", "event", ")" ]
New event for light. Check that state is part of event. Signal that light has updated state.
[ "New", "event", "for", "light", "." ]
train
https://github.com/Kane610/deconz/blob/8a9498dbbc8c168d4a081173ad6c3b1e17fffdf6/pydeconz/light.py#L25-L32
Kane610/deconz
pydeconz/light.py
DeconzLightBase.xy
def xy(self): """CIE xy color space coordinates as array [x, y] of real values (0..1).""" if self._xy != (None, None): self._x, self._y = self._xy if self._x is not None and self._y is not None: x = self._x if self._x > 1: x = self._x / 65555 ...
python
def xy(self): """CIE xy color space coordinates as array [x, y] of real values (0..1).""" if self._xy != (None, None): self._x, self._y = self._xy if self._x is not None and self._y is not None: x = self._x if self._x > 1: x = self._x / 65555 ...
[ "def", "xy", "(", "self", ")", ":", "if", "self", ".", "_xy", "!=", "(", "None", ",", "None", ")", ":", "self", ".", "_x", ",", "self", ".", "_y", "=", "self", ".", "_xy", "if", "self", ".", "_x", "is", "not", "None", "and", "self", ".", "_...
CIE xy color space coordinates as array [x, y] of real values (0..1).
[ "CIE", "xy", "color", "space", "coordinates", "as", "array", "[", "x", "y", "]", "of", "real", "values", "(", "0", "..", "1", ")", "." ]
train
https://github.com/Kane610/deconz/blob/8a9498dbbc8c168d4a081173ad6c3b1e17fffdf6/pydeconz/light.py#L74-L88
sbg/sevenbridges-python
sevenbridges/meta/transformer.py
Transform.to_project
def to_project(project): """Serializes project to id string :param project: object to serialize :return: string id """ from sevenbridges.models.project import Project if not project: raise SbgError('Project is required!') elif isinstance(project, Proje...
python
def to_project(project): """Serializes project to id string :param project: object to serialize :return: string id """ from sevenbridges.models.project import Project if not project: raise SbgError('Project is required!') elif isinstance(project, Proje...
[ "def", "to_project", "(", "project", ")", ":", "from", "sevenbridges", ".", "models", ".", "project", "import", "Project", "if", "not", "project", ":", "raise", "SbgError", "(", "'Project is required!'", ")", "elif", "isinstance", "(", "project", ",", "Project...
Serializes project to id string :param project: object to serialize :return: string id
[ "Serializes", "project", "to", "id", "string", ":", "param", "project", ":", "object", "to", "serialize", ":", "return", ":", "string", "id" ]
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/meta/transformer.py#L22-L35
sbg/sevenbridges-python
sevenbridges/meta/transformer.py
Transform.to_task
def to_task(task): """Serializes task to id string :param task: object to serialize :return: string id """ from sevenbridges.models.task import Task if not task: raise SbgError('Task is required!') elif isinstance(task, Task): return task.i...
python
def to_task(task): """Serializes task to id string :param task: object to serialize :return: string id """ from sevenbridges.models.task import Task if not task: raise SbgError('Task is required!') elif isinstance(task, Task): return task.i...
[ "def", "to_task", "(", "task", ")", ":", "from", "sevenbridges", ".", "models", ".", "task", "import", "Task", "if", "not", "task", ":", "raise", "SbgError", "(", "'Task is required!'", ")", "elif", "isinstance", "(", "task", ",", "Task", ")", ":", "retu...
Serializes task to id string :param task: object to serialize :return: string id
[ "Serializes", "task", "to", "id", "string", ":", "param", "task", ":", "object", "to", "serialize", ":", "return", ":", "string", "id" ]
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/meta/transformer.py#L38-L51
sbg/sevenbridges-python
sevenbridges/meta/transformer.py
Transform.to_app
def to_app(app): """Serializes app to id string :param app: object to serialize :return: string id """ from sevenbridges.models.app import App if not app: raise SbgError('App is required!') elif isinstance(app, App): return app.id e...
python
def to_app(app): """Serializes app to id string :param app: object to serialize :return: string id """ from sevenbridges.models.app import App if not app: raise SbgError('App is required!') elif isinstance(app, App): return app.id e...
[ "def", "to_app", "(", "app", ")", ":", "from", "sevenbridges", ".", "models", ".", "app", "import", "App", "if", "not", "app", ":", "raise", "SbgError", "(", "'App is required!'", ")", "elif", "isinstance", "(", "app", ",", "App", ")", ":", "return", "...
Serializes app to id string :param app: object to serialize :return: string id
[ "Serializes", "app", "to", "id", "string", ":", "param", "app", ":", "object", "to", "serialize", ":", "return", ":", "string", "id" ]
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/meta/transformer.py#L54-L67
sbg/sevenbridges-python
sevenbridges/meta/transformer.py
Transform.to_file
def to_file(file_): """Serializes file to id string :param file_: object to serialize :return: string id """ from sevenbridges.models.file import File if not file_: raise SbgError('File is required!') elif isinstance(file_, File): return fi...
python
def to_file(file_): """Serializes file to id string :param file_: object to serialize :return: string id """ from sevenbridges.models.file import File if not file_: raise SbgError('File is required!') elif isinstance(file_, File): return fi...
[ "def", "to_file", "(", "file_", ")", ":", "from", "sevenbridges", ".", "models", ".", "file", "import", "File", "if", "not", "file_", ":", "raise", "SbgError", "(", "'File is required!'", ")", "elif", "isinstance", "(", "file_", ",", "File", ")", ":", "r...
Serializes file to id string :param file_: object to serialize :return: string id
[ "Serializes", "file", "to", "id", "string", ":", "param", "file_", ":", "object", "to", "serialize", ":", "return", ":", "string", "id" ]
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/meta/transformer.py#L70-L83
sbg/sevenbridges-python
sevenbridges/meta/transformer.py
Transform.to_user
def to_user(user): """Serializes user to id string :param user: object to serialize :return: string id """ from sevenbridges.models.user import User if not user: raise SbgError('User is required!') elif isinstance(user, User): return user.u...
python
def to_user(user): """Serializes user to id string :param user: object to serialize :return: string id """ from sevenbridges.models.user import User if not user: raise SbgError('User is required!') elif isinstance(user, User): return user.u...
[ "def", "to_user", "(", "user", ")", ":", "from", "sevenbridges", ".", "models", ".", "user", "import", "User", "if", "not", "user", ":", "raise", "SbgError", "(", "'User is required!'", ")", "elif", "isinstance", "(", "user", ",", "User", ")", ":", "retu...
Serializes user to id string :param user: object to serialize :return: string id
[ "Serializes", "user", "to", "id", "string", ":", "param", "user", ":", "object", "to", "serialize", ":", "return", ":", "string", "id" ]
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/meta/transformer.py#L86-L99
sbg/sevenbridges-python
sevenbridges/meta/transformer.py
Transform.to_billing_group
def to_billing_group(billing_group): """Serializes billing_group to id string :param billing_group: object to serialize :return: string id """ from sevenbridges.models.billing_group import BillingGroup if not billing_group: raise SbgError('Billing group is req...
python
def to_billing_group(billing_group): """Serializes billing_group to id string :param billing_group: object to serialize :return: string id """ from sevenbridges.models.billing_group import BillingGroup if not billing_group: raise SbgError('Billing group is req...
[ "def", "to_billing_group", "(", "billing_group", ")", ":", "from", "sevenbridges", ".", "models", ".", "billing_group", "import", "BillingGroup", "if", "not", "billing_group", ":", "raise", "SbgError", "(", "'Billing group is required!'", ")", "elif", "isinstance", ...
Serializes billing_group to id string :param billing_group: object to serialize :return: string id
[ "Serializes", "billing_group", "to", "id", "string", ":", "param", "billing_group", ":", "object", "to", "serialize", ":", "return", ":", "string", "id" ]
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/meta/transformer.py#L102-L115
sbg/sevenbridges-python
sevenbridges/meta/transformer.py
Transform.to_volume
def to_volume(volume): """Serializes volume to id string :param volume: object to serialize :return: string id """ from sevenbridges.models.volume import Volume if not volume: raise SbgError('Volume is required!') elif isinstance(volume, Volume): ...
python
def to_volume(volume): """Serializes volume to id string :param volume: object to serialize :return: string id """ from sevenbridges.models.volume import Volume if not volume: raise SbgError('Volume is required!') elif isinstance(volume, Volume): ...
[ "def", "to_volume", "(", "volume", ")", ":", "from", "sevenbridges", ".", "models", ".", "volume", "import", "Volume", "if", "not", "volume", ":", "raise", "SbgError", "(", "'Volume is required!'", ")", "elif", "isinstance", "(", "volume", ",", "Volume", ")"...
Serializes volume to id string :param volume: object to serialize :return: string id
[ "Serializes", "volume", "to", "id", "string", ":", "param", "volume", ":", "object", "to", "serialize", ":", "return", ":", "string", "id" ]
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/meta/transformer.py#L118-L131
sbg/sevenbridges-python
sevenbridges/meta/transformer.py
Transform.to_marker
def to_marker(marker): """Serializes marker to string :param marker: object to serialize :return: string id """ from sevenbridges.models.marker import Marker if not marker: raise SbgError('Marker is required!') elif isinstance(marker, Marker): ...
python
def to_marker(marker): """Serializes marker to string :param marker: object to serialize :return: string id """ from sevenbridges.models.marker import Marker if not marker: raise SbgError('Marker is required!') elif isinstance(marker, Marker): ...
[ "def", "to_marker", "(", "marker", ")", ":", "from", "sevenbridges", ".", "models", ".", "marker", "import", "Marker", "if", "not", "marker", ":", "raise", "SbgError", "(", "'Marker is required!'", ")", "elif", "isinstance", "(", "marker", ",", "Marker", ")"...
Serializes marker to string :param marker: object to serialize :return: string id
[ "Serializes", "marker", "to", "string", ":", "param", "marker", ":", "object", "to", "serialize", ":", "return", ":", "string", "id" ]
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/meta/transformer.py#L134-L147