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_documentation_string stringlengths 1 47.2k | 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... | 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: | 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... | 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: | 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... | 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: | 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((... | 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: | 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... | Adds a group
@type groupname: bytes
@type statements: str | 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("... | Adds a host with given ip and mac in a group named groupname
@type ip: str
@type mac: str
@type groupname: str | 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" %... | Change the group of a host given the name of the host.
@type name: str
@type group: str | 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')
... | Generic query implementation that is used
by the resources. | 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.... | Fetches the resource from the server.
:param id: Resource identifier
:param api: sevenbridges Api instance.
:return: Resource object. | 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... | Deletes the resource on the server. | 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... | Refreshes the resource with the data from the server. | 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)] | Converts a single dictionary or list of dictionaries into converted list of dictionaries. | 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... | Converts a single dictionary into converted dictionary or list of dictionaries into converted
list of dictionaries. Used while passing dictionaries to another converter. | 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... | Core method of the converter. Converts a single dictionary into another dictionary. | 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')
... | Pauses the execution if rate limit is breached.
:param api: Api instance.
:param response: requests.Response object | 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... | 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. | 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... | 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. | 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.
... | 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... | 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... | 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... | 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),... | Fetches information about single volume object - usually file
:param location: object location
:return: | 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['... | Fetches information about a single volume member
:param username: Member name
:param api: Api instance
:return: Member object | 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... | 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.
:... | 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... | 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... | 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... | Retrieve imports in bulk
:param imports: Imports to be retrieved.
:param api: Api instance.
:return: List of ImportBulkRecord objects. | 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 = ... | Submit imports in bulk
:param imports: Imports to be retrieved.
:param api: Api instance.
:return: List of ImportBulkRecord objects. | 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... | Creates a MUC room on the XMPP server. | 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(... | Updates a MUC room on the XMPP server. | 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(... | Deletes a MUC room from the XMPP server. | 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... | Retrieves basic data of a MUC room from the XMPP server.
:return: dict containing name, description and password of the room | 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
... | Checks if a MUC room exists on the server. | 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] | Generates a valid JID node identifier from a string | 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')) | Generates a v alid JID based on the room name.
:param append_date: appends the given date to the JID | 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',... | Creates/Updates an XMPP room config form | 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... | Connects to the XMPP server and executes custom code
:param connected_callback: function to execute after connecting
:return: return value of the callback | 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... | 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 | 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()
... | Deletes chat logs | 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_... | Saves modification to the api server. | 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... | Create team within a division
:param name: Team name.
:param division: Parent division.
:param api: Api instance.
:return: Team object. | 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... | Fetch team members for current team.
:param offset: Pagination offset.
:param limit: Pagination limit.
:return: Collection object. | 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__,
... | Add member to team
:param user: User object or user's username
:return: Added user. | 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:... | 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. | 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... | 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: | 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... | Add a member (team) to a project.
:param team: Team object or team identifier.
:param permissions: Permissions dictionary.
:return: Member object. | 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,... | Add a member to the project using member email.
:param email: Member email.
:param permissions: Permissions dictionary.
:return: Member object. | 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... | Remove member from the project.
:param user: User to be removed. | 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... | Retrieves files in this project.
:param offset: Pagination offset.
:param limit: Pagination limit.
:return: Collection object. | 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) | Adds files to this project.
:param files: List of files or a Collection object. | 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}
... | Retrieves apps in this project.
:param offset: Pagination offset.
:param limit: Pagination limit.
:return: Collection object. | 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... | Retrieves tasks in this project.
:param status: Optional task status.
:param offset: Pagination offset.
:param limit: Pagination limit.
:return: Collection object. | 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... | 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. | 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... | 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. | 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... | 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.
:... | 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... | Valiates a PayPal business string.
It can either be an email address or a paypal business account ID. | 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... | 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: | 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... | Partitions the file into chunks and submits them into group of 4
for download on the api download pool. | 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... | Partitions the file and saves the part information in memory. | 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. ... | Pauses the download.
:raises SbgError: If upload is not in RUNNING state. | 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... | Stops the download.
:raises SbgError: If download is not in PAUSED or RUNNING state. | 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... | Resumes the download.
:raises SbgError: If download is not in RUNNING state. | 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
... | Starts the download.
:raises SbgError: If download is not in PREPARING state. | 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... | Runs the thread! Should not be used use start() method instead. | 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... | Fetches file size by reading the Content-Length header
for the resource.
:return: File size. | 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... | Runs the livesync export | 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... | Runs the initial export.
This process is expected to take a very long time.
:param events: iterable of all events in this indico instance | 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... | 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 | 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) | Checks if a user is a chat admin | 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 '... | Maps item to appropriate sevebridges object.
:param item: Input/Output value.
:param api: Api instance.
:return: Mapped object. | 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... | Executes the wrapped function and reloads the object
with data returned from the server. | 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):
... | 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. | 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... | Retry decorator used during file upload and download. | 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... | Executes the wrapped function and inspects the response object
for specific errors. | 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... | Fetches all available items.
:return: Collection object. | 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.') | Fetches next result set.
:return: Collection object. | 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.') | Fetches next result set.
:return: VolumeCollection object. | 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... | Create and return a serializable Report object, retrieved from cache if possible | 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()
... | Set date range defaults if no dates are passed | 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':... | Build the report by performing queries to Piwik | 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... | Build the list of information entries for contributions of the event | 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) | Remove callback previously registered. | 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:... | Update input attr in self.
Return list of attributes with changed values. | 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 ... | Sends feedback to sevenbridges.
:param type: FeedbackType wither IDEA, PROBLEM or THOUGHT.
:param text: Feedback text.
:param referrer: Feedback referrer.
:param api: Api instance. | 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 =... | 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. | 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... | 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. | 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
} | Add scenes belonging to group. | 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,
... | Sync color state with light. | 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) | Recall scene to group. | 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... | Retrieves current user information.
:param api: Api instance.
:return: User object. | 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.
... | 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. | 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... | 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: ... | 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... | 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. | 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) | New event for light.
Check that state is part of event.
Signal that light has updated state. | 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
... | CIE xy color space coordinates as array [x, y] of real values (0..1). | 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... | Serializes project to id string
:param project: object to serialize
:return: string id | 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... | Serializes task to id string
:param task: object to serialize
:return: string id | 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... | Serializes app to id string
:param app: object to serialize
:return: string id | 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... | Serializes file to id string
:param file_: object to serialize
:return: string id | 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... | Serializes user to id string
:param user: object to serialize
:return: string id | 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... | Serializes billing_group to id string
:param billing_group: object to serialize
:return: string id | 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):
... | Serializes volume to id string
:param volume: object to serialize
:return: string id | 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):
... | Serializes marker to string
:param marker: object to serialize
:return: string id | https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/meta/transformer.py#L134-L147 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.