本文整理汇总了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)
示例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
)
示例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)
示例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)