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


Python label.Label類代碼示例

本文整理匯總了Python中trello.label.Label的典型用法代碼示例。如果您正苦於以下問題:Python Label類的具體用法?Python Label怎麽用?Python Label使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: fetch

    def fetch(self, eager=True):
        """
        Fetch all attributes for this card
        :param eager: If eager is true comments and checklists will be fetched immediately, otherwise on demand
        """
        json_obj = self.client.fetch_json(
            '/cards/' + self.id,
            query_params={'badges': False})
        self.id = json_obj['id']
        self.name = json_obj['name'].encode('utf-8')
        self.desc = json_obj.get('desc', '')
        self.closed = json_obj['closed']
        self.url = json_obj['url']
        self.shortUrl = json_obj['shortUrl']
        self.idMembers = json_obj['idMembers']
        self.idShort = json_obj['idShort']
        self.idList = json_obj['idList']
        self.idBoard = json_obj['idBoard']
        self.idLabels = json_obj['idLabels']
        self.labels = Label.from_json_list(self.board, json_obj['labels'])
        self.badges = json_obj['badges']
        self.pos = json_obj.get('pos', None)
        if json_obj.get('due', ''):
            self.due = json_obj.get('due', '')
        else:
            self.due = ''
        self.checked = json_obj['checkItemStates']
        self.dateLastActivity = dateparser.parse(json_obj['dateLastActivity'])

        self._checklists = self.fetch_checklists() if eager else None
        self._comments = self.fetch_comments() if eager else None
        self._attachments = self.fetch_attachments() if eager else None
開發者ID:nureineide,項目名稱:py-trello,代碼行數:32,代碼來源:card.py

示例2: get_labels

    def get_labels(self, fields='all', limit=50):
        """Get label

        :rtype: list of Label
        """
        json_obj = self.client.fetch_json(
              '/boards/' + self.id + '/labels',
              query_params={'fields': fields, 'limit': limit})
        return Label.from_json_list(self, json_obj)
開發者ID:zironycho,項目名稱:py-trello,代碼行數:9,代碼來源:board.py

示例3: get_label

    def get_label(self, label_id, board_id):
        '''Get Label

        Requires the parent board id the label is on

        :rtype: Label
        '''
        board = self.get_board(board_id)
        label_json = self.fetch_json('/labels/' + label_id)
        return Label.from_json(board, label_json)
開發者ID:SkoZombie,項目名稱:py-trello,代碼行數:10,代碼來源:trelloclient.py

示例4: add_label

    def add_label(self, name, color):
        """Add a label to this board

        :name: name of the label
        :color: the color, either green, yellow, orange
            red, purple, blue, sky, lime, pink, or black
        :return: the label
        :rtype: Label
        """
        obj = self.client.fetch_json(
            '/labels',
            http_method='POST',
            post_args={'name': name, 'idBoard': self.id, 'color': color},)
        return Label.from_json(board=self, json_obj=obj)
開發者ID:zironycho,項目名稱:py-trello,代碼行數:14,代碼來源:board.py

示例5: from_json

    def from_json(cls, parent, json_obj):
        """
        Deserialize the card json object to a Card object

        :trello_list: the list object that the card belongs to
        :json_obj: json object
        """
        if 'id' not in json_obj:
            raise Exception("key 'id' is not in json_obj")
        card = cls(parent,
                   json_obj['id'],
                   name=json_obj['name'].encode('utf-8'))
        card.desc = json_obj.get('desc', '')
        card.closed = json_obj['closed']
        card.url = json_obj['url']
        card.member_ids = json_obj['idMembers']
        card.idLabels = json_obj['idLabels']
        card.idList = json_obj['idList']
        card.labels = Label.from_json_list(card.board, json_obj['labels'])
        return card
開發者ID:genericmoniker,項目名稱:py-trello,代碼行數:20,代碼來源:card.py

示例6: from_json

    def from_json(cls, parent, json_obj):
        """
        Deserialize the card json object to a Card object

        :parent: the list object that the card belongs to
        :json_obj: json object

        :rtype: Card
        """
        if 'id' not in json_obj:
            raise Exception("key 'id' is not in json_obj")
        card = cls(parent,
                   json_obj['id'],
                   name=json_obj['name'])
        card._json_obj = json_obj
        card.desc = json_obj.get('desc', '')
        card.due = json_obj.get('due', '')
        card.is_due_complete = json_obj['dueComplete']
        card.closed = json_obj['closed']
        card.url = json_obj['url']
        card.pos = json_obj['pos']
        card.shortUrl = json_obj['shortUrl']
        card.idMembers = json_obj['idMembers']
        card.member_ids = json_obj['idMembers']
        card.idLabels = json_obj['idLabels']
        card.idBoard = json_obj['idBoard']
        card.idList = json_obj['idList']
        card.idShort = json_obj['idShort']
        card.badges = json_obj['badges']
        card.customFields = card.fetch_custom_fields(json_obj=json_obj)
        card._labels = Label.from_json_list(card.board, json_obj['labels'])
        card.dateLastActivity = dateparser.parse(json_obj['dateLastActivity'])
        if "attachments" in json_obj:
            card._attachments = []
            for attachment_json in json_obj["attachments"]:
                card._attachments.append(attachment_json)
        if 'actions' in json_obj:
            card.actions = json_obj['actions']
        return card
開發者ID:sarumont,項目名稱:py-trello,代碼行數:39,代碼來源:card.py


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