• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python transformer.Transform类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中sevenbridges.meta.transformer.Transform的典型用法代码示例。如果您正苦于以下问题:Python Transform类的具体用法?Python Transform怎么用?Python Transform使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Transform类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: create_folder

    def create_folder(cls, name, parent=None, project=None,
                      api=None):
        """Create a new folder
        :param name: Folder name
        :param parent: Parent folder
        :param project: Project to create folder in
        :param api: Api instance
        :return: New folder
        """
        api = api or cls._API

        data = {
            'name': name,
            'type': cls.FOLDER_TYPE
        }

        if not parent and not project:
            raise SbgError('Parent or project must be provided')

        if parent and project:
            raise SbgError(
                'Providing both "parent" and "project" is not allowed'
            )

        if parent:
            data['parent'] = Transform.to_file(file_=parent)

        if project:
            data['project'] = Transform.to_project(project=project)

        response = api.post(url=cls._URL['create_folder'], data=data).json()
        return cls(api=api, **response)
开发者ID:sbg,项目名称:sevenbridges-python,代码行数:32,代码来源:file.py


示例2: upload

    def upload(cls, path, project=None, parent=None, file_name=None,
               overwrite=False, retry=5, timeout=10,
               part_size=PartSize.UPLOAD_MINIMUM_PART_SIZE, wait=True,
               api=None):
        """
        Uploads a file using multipart upload and returns an upload handle
        if the wait parameter is set to False. If wait is set to True it
        will block until the upload is completed.

        :param path: File path on local disc.
        :param project: Project identifier
        :param parent: Parent folder identifier
        :param file_name: Optional file name.
        :param overwrite: If true will overwrite the file on the server.
        :param retry:  Number of retries if error occurs during upload.
        :param timeout:  Timeout for http requests.
        :param part_size:  Part size in bytes.
        :param wait:  If true will wait for upload to complete.
        :param api: Api instance.
        """

        api = api or cls._API
        extra = {'resource': cls.__name__, 'query': {
            'path': path,
            'project': project,
            'file_name': file_name,
            'overwrite': overwrite,
            'retry': retry,
            'timeout': timeout,
            'part_size': part_size,
            'wait': wait,
        }}
        logger.info('Uploading file', extra=extra)

        if not project and not parent:
            raise SbgError('A project or parent identifier is required.')

        if project and parent:
            raise SbgError(
                'Project and parent identifiers are mutually exclusive.'
            )

        if project:
            project = Transform.to_project(project)

        if parent:
            parent = Transform.to_file(parent)

        upload = Upload(
            file_path=path, project=project, parent=parent,
            file_name=file_name, overwrite=overwrite, retry_count=retry,
            timeout=timeout, part_size=part_size, api=api
        )
        if wait:
            upload.start()
            upload.wait()
            return upload
        else:
            return upload
开发者ID:sbg,项目名称:sevenbridges-python,代码行数:59,代码来源:file.py


示例3: submit_export

    def submit_export(cls, file, volume, location, properties=None,
                      overwrite=False, copy_only=False, api=None):

        """
        Submit new export job.
        :param file: File to be exported.
        :param volume: Volume identifier.
        :param location: Volume location.
        :param properties: Properties dictionary.
        :param overwrite: If true it will overwrite file if exists
        :param copy_only: If true files are kept on SevenBridges bucket.
        :param api: Api Instance.
        :return: Export object.
        """
        data = {}
        params = {}

        volume = Transform.to_volume(volume)
        file = Transform.to_file(file)
        destination = {
            'volume': volume,
            'location': location
        }
        source = {
            'file': file
        }
        if properties:
            data['properties'] = properties

        data['source'] = source
        data['destination'] = destination
        data['overwrite'] = overwrite

        extra = {
            'resource': cls.__name__,
            'query': data
        }
        logger.info('Submitting export', extra=extra)

        api = api if api else cls._API
        if copy_only:
            params['copy_only'] = True
            _export = api.post(
                cls._URL['query'], data=data, params=params).json()
        else:
            _export = api.post(
                cls._URL['query'], data=data).json()

        return Export(api=api, **_export)
开发者ID:sbg,项目名称:sevenbridges-python,代码行数:49,代码来源:storage_export.py


示例4: create

    def create(cls, name, billing_group, description=None, tags=None,
               api=None):
        """
        Create a project.
        :param name:  Project name.
        :param billing_group: Project billing group.
        :param description:  Project description.
        :param tags: Project tags.
        :param api: Api instance.
        :return:
        """
        api = api if api else cls._API

        billing_group = Transform.to_billing_group(billing_group)
        if name is None:
            raise SbgError('Project name is required!')

        data = {
            'name': name,
            'billing_group': billing_group,
        }
        if description:
            data['description'] = description
        if tags:
            data['tags'] = tags

        project_data = api.post(url=cls._URL['query'],
                                data=data).json()
        return Project(api=api, **project_data)
开发者ID:SenadI,项目名称:sevenbridges-python,代码行数:29,代码来源:project.py


示例5: query

 def query(cls, division, offset=None, limit=None, api=None):
     division = Transform.to_division(division)
     api = api if api else cls._API
     return super(Team, cls)._query(
         url=cls._URL['query'], division=division, offset=offset,
         limit=limit, fields='_all', api=api
     )
开发者ID:sbg,项目名称:sevenbridges-python,代码行数:7,代码来源:team.py


示例6: add_member

    def add_member(self, user, permissions):
        """
        Add a member to the project.
        :param user:  Member username
        :param permissions: Permissions dictionary.
        :return: Member object.
        """
        user = Transform.to_user(user)
        data = {'username': user, 'type': 'USER'}
        if isinstance(permissions, dict):
            data.update({
                'permissions': permissions
            })

        extra = {
            'resource': self.__class__.__name__,
            'query': {
                'id': self.id,
                'data': data,
            }
        }
        logger.info('Adding member using username', extra=extra)
        response = self._api.post(
            url=self._URL['members_query'].format(id=self.id), data=data)
        member_data = response.json()
        return Member(api=self._api, **member_data)
开发者ID:sbg,项目名称:sevenbridges-python,代码行数:26,代码来源:project.py


示例7: add_member_division

    def add_member_division(self, division, permissions):
        """
        Add a member (team) to a project.
        :param division: Division object or division identifier.
        :param permissions: Permissions dictionary.
        :return: Member object.
        """
        division = Transform.to_division(division)
        data = {'id': division, 'type': 'DIVISION'}
        if isinstance(permissions, dict):
            data.update({
                'permissions': permissions
            })

        extra = {
            'resource': self.__class__.__name__,
            'query': {
                'id': self.id,
                'data': data,
            }
        }
        logger.info('Adding team member using division id', extra=extra)
        response = self._api.post(
            url=self._URL['members_query'].format(id=self.id), data=data)
        member_data = response.json()
        return Member(api=self._api, **member_data)
开发者ID:sbg,项目名称:sevenbridges-python,代码行数:26,代码来源:project.py


示例8: add_member_team

    def add_member_team(self, team, permissions):
        """
        Add a member (team) to a volume.
        :param team: Team object or team identifier.
        :param permissions: Permissions dictionary.
        :return: Member object.
        """
        team = Transform.to_team(team)
        data = {'id': team, 'type': 'TEAM'}

        if 'execute' in permissions:
            permissions.pop('execute')

        if isinstance(permissions, dict):
            data.update({
                'permissions': permissions
            })

        extra = {
            'resource': self.__class__.__name__,
            'query': {
                'id': self.id,
                'data': data,
            }
        }
        logger.info('Adding volume team member using team id', extra=extra)
        response = self._api.post(
            url=self._URL['members_query'].format(id=self.id), data=data)
        member_data = response.json()
        return Member(api=self._api, **member_data)
开发者ID:sbg,项目名称:sevenbridges-python,代码行数:30,代码来源:volume.py


示例9: 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 private: Whether the marker is private or public.
        :param api: Api instance.
        :return: Marker object.
        """
        api = api if api else cls._API

        file = Transform.to_file(file)
        data = {
            'file': file,
            'name': name,
            'position': position,
            'chromosome': chromosome,
            'private': private
        }

        extra = {
            'resource': cls.__name__,
            'query': data
        }
        logger.info('Creating marker', extra=extra)
        marker_data = api.post(url=cls._URL['query'], data=data).json()
        return Marker(api=api, **marker_data)
开发者ID:sbg,项目名称:sevenbridges-python,代码行数:29,代码来源:marker.py


示例10: remove_member

 def remove_member(self, user):
     """
     Remove member from the project.
     :param user: User to be removed.
     """
     member = Transform.to_user(user)
     self._api.delete(url=self._URL['members_get'].format(
         id=self.id,
         member=member))
开发者ID:SenadI,项目名称:sevenbridges-python,代码行数:9,代码来源:project.py


示例11: bulk_submit

    def bulk_submit(cls, exports, copy_only=False, api=None):
        """
        Create exports in bulk.
        :param exports: Exports to be submitted in bulk.
        :param copy_only: If true files are kept on SevenBridges bucket.
        :param api: Api instance.
        :return: list of ExportBulkRecord objects.
        """
        if not exports:
            raise SbgError('Exports are required')

        api = api or cls._API

        items = []
        for export in exports:
            file_ = Transform.to_file(export.get('file'))
            volume = Transform.to_volume(export.get('volume'))
            location = Transform.to_location(export.get('location'))
            properties = export.get('properties', {})
            overwrite = export.get('overwrite', False)

            item = {
                'source': {
                    'file': file_
                },
                'destination': {
                    'volume': volume,
                    'location': location
                },
                'properties': properties,
                'overwrite': overwrite
            }

            items.append(item)

        data = {'items': items}
        params = {'copy_only': copy_only}

        response = api.post(
            url=cls._URL['bulk_create'], params=params, data=data
        )
        return ExportBulkRecord.parse_records(response=response, api=api)
开发者ID:sbg,项目名称:sevenbridges-python,代码行数:42,代码来源:storage_export.py


示例12: get_file_delete_job

    def get_file_delete_job(cls, id, api=None):
        """
        :param id: Async job identifier
        :param api: Api instance
        :return:
        """
        id = Transform.to_async_job(id)

        api = api if api else cls._API
        async_job = api.get(
            url=cls._URL['get_file_delete_job'].format(id=id)
        ).json()
        return AsyncJob(api=api, **async_job)
开发者ID:sbg,项目名称:sevenbridges-python,代码行数:13,代码来源:async_jobs.py


示例13: bulk_get

    def bulk_get(cls, exports, api=None):
        """
        Retrieve exports in bulk.
        :param exports: Exports to be retrieved.
        :param api: Api instance.
        :return: list of ExportBulkRecord objects.
        """
        api = api or cls._API
        export_ids = [Transform.to_export(export) for export in exports]
        data = {'export_ids': export_ids}

        response = api.post(url=cls._URL['bulk_get'], data=data)
        return ExportBulkRecord.parse_records(response=response, api=api)
开发者ID:sbg,项目名称:sevenbridges-python,代码行数:13,代码来源:storage_export.py


示例14: bulk_delete

    def bulk_delete(cls, files, api=None):
        """
        Delete files with specified ids in bulk
        :param files: Files to be deleted.
        :param api: Api instance.
        :return: List of FileBulkRecord objects.
        """
        api = api or cls._API
        file_ids = [Transform.to_file(file_) for file_ in files]
        data = {'file_ids': file_ids}

        logger.info('Deleting files in bulk.')
        response = api.post(url=cls._URL['bulk_delete'], data=data)
        return FileBulkRecord.parse_records(response=response, api=api)
开发者ID:sbg,项目名称:sevenbridges-python,代码行数:14,代码来源:file.py


示例15: remove_member

    def remove_member(self, member, api=None):
        """Remove member from a dataset
        :param member: Member username
        :param api: Api instance
        :return: None
        """
        api = api or self._API
        username = Transform.to_member(member)

        api.delete(
            url=self._URL['member'].format(
                id=self.id,
                username=username
            )
        )
开发者ID:sbg,项目名称:sevenbridges-python,代码行数:15,代码来源:dataset.py


示例16: 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._URL:
         extra = {'resource': cls.__name__, 'query': {'id': id}}
         logger.info('Fetching {} resource'.format(cls), extra=extra)
         resource = api.get(url=cls._URL['get'].format(id=id)).json()
         return cls(api=api, **resource)
     else:
         raise SbgError('Unable to fetch resource!')
开发者ID:sbg,项目名称:sevenbridges-python,代码行数:16,代码来源:resource.py


示例17: copy

 def copy(self, project, name=None):
     """
     Copies the current file.
     :param project: Destination project.
     :param name: Destination file name.
     :return: Copied File object.
     """
     project = Transform.to_project(project)
     data = {
         'project': project
     }
     if name:
         data['name'] = name
     new_file = self._api.post(url=self._URL['copy'].format(id=self.id),
                               data=data).json()
     return File(api=self._api, **new_file)
开发者ID:SenadI,项目名称:sevenbridges-python,代码行数:16,代码来源:file.py


示例18: 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.
        """
        api = api if api else cls._API

        file = Transform.to_file(file)
        return super(Marker, cls)._query(
            url=cls._URL['query'], offset=offset, limit=limit,
            file=file, fields='_all', api=api
        )
开发者ID:sbg,项目名称:sevenbridges-python,代码行数:16,代码来源:marker.py


示例19: 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,
             'user': user,
         }
     }
     logger.info('Removing member', extra=extra)
     self._api.delete(
         url=self._URL['member'].format(id=self.id, username=username)
     )
开发者ID:sbg,项目名称:sevenbridges-python,代码行数:17,代码来源:project.py


示例20: query

 def query(cls, project=None, visibility=None, offset=None, limit=None,
           api=None):
     """
     Query (List) apps.
     :param visibility:
     :param project:
     :param offset: Pagination offset.
     :param limit: Pagination limit.
     :param api: Api instance.
     :return: collection object
     """
     if project:
         project = Transform.to_project(project)
     api = api or cls._API
     return super(App, cls)._query(url=cls._URL['query'], project=project,
                                   visibility=visibility,
                                   offset=offset, limit=limit, api=api)
开发者ID:SenadI,项目名称:sevenbridges-python,代码行数:17,代码来源:app.py



注:本文中的sevenbridges.meta.transformer.Transform类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python sextante.runalg函数代码示例发布时间:2022-05-27
下一篇:
Python setuptools_scm.get_version函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap