當前位置: 首頁>>代碼示例>>Python>>正文


Python Transform.to_division方法代碼示例

本文整理匯總了Python中sevenbridges.meta.transformer.Transform.to_division方法的典型用法代碼示例。如果您正苦於以下問題:Python Transform.to_division方法的具體用法?Python Transform.to_division怎麽用?Python Transform.to_division使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在sevenbridges.meta.transformer.Transform的用法示例。


在下文中一共展示了Transform.to_division方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: add_member_division

# 需要導入模塊: from sevenbridges.meta.transformer import Transform [as 別名]
# 或者: from sevenbridges.meta.transformer.Transform import to_division [as 別名]
    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,代碼行數:28,代碼來源:project.py

示例2: query

# 需要導入模塊: from sevenbridges.meta.transformer import Transform [as 別名]
# 或者: from sevenbridges.meta.transformer.Transform import to_division [as 別名]
 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,代碼行數:9,代碼來源:team.py

示例3: create

# 需要導入模塊: from sevenbridges.meta.transformer import Transform [as 別名]
# 或者: from sevenbridges.meta.transformer.Transform import to_division [as 別名]
    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 else cls._API
        data = {
            'name': name,
            'division': division
        }

        extra = {
            'resource': cls.__name__,
            'query': data
        }
        logger.info('Creating team', extra=extra)
        created_team = api.post(cls._URL['query'], data=data).json()
        return Team(api=api, **created_team)
開發者ID:sbg,項目名稱:sevenbridges-python,代碼行數:25,代碼來源:team.py

示例4: test_transform_divisions

# 需要導入模塊: from sevenbridges.meta.transformer import Transform [as 別名]
# 或者: from sevenbridges.meta.transformer.Transform import to_division [as 別名]
def test_transform_divisions(division):
    Transform.to_division(division)
開發者ID:sbg,項目名稱:sevenbridges-python,代碼行數:4,代碼來源:test_transformer.py


注:本文中的sevenbridges.meta.transformer.Transform.to_division方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。