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


Python common.People類代碼示例

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


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

示例1: obtainDataPerson

 def obtainDataPerson(self, obj):
     person = People(obj.name)
     if hasattr(obj, 'displayName'):
         person.set_name(obj.displayName)
     if hasattr(obj, 'emailAddress'):
         person.set_email(obj.emailAddress)
     return person
開發者ID:hjmacho,項目名稱:Bicho,代碼行數:7,代碼來源:atljira.py

示例2: parse_changes

    def parse_changes(self):
        soup = BeautifulSoup(self.html)
        self.remove_comments(soup)
        remove_tags = ['a', 'span', 'i']
        changes = []
        tables = soup.findAll('table')

        # We look for the first table with 5 cols
        table = None
        for table in tables:
            if len(table.tr.findAll('th', recursive=False)) == 5:
                try:
                    for i in table.findAll(remove_tags):
                        i.replaceWith(i.text)
                except:
                    printerr("error removing HTML tags")
                break

        if table is None:
            return changes

        rows = list(table.findAll('tr'))
        for row in rows[1:]:
            cols = list(row.findAll('td'))
            if len(cols) == 5:
                person_email = cols[0].contents[0].strip()
                person_email = unicode(person_email.replace('@', '@'))
                date = self._to_datetime_with_secs(cols[1].contents[0].strip())
                # when the field contains an Attachment, the list has more
                #than a field. For example:
                #
                # [u'\n', u'Attachment #12723', u'\n              Flag\n            ']
                #
                if len(cols[2].contents) > 1:
                    aux_c = unicode(" ".join(cols[2].contents))
                    field = unicode(aux_c.replace("\n", "").strip())
                else:
                    field = unicode(cols[2].contents[0].replace("\n", "").strip())
                removed = unicode(cols[3].contents[0].strip())
                added = unicode(cols[4].contents[0].strip())
            else:
                # same as above with the Attachment example
                if len(cols[0].contents) > 1:
                    aux_c = unicode(" ".join(cols[0].contents))
                    field = aux_c.replace("\n", "").strip()
                else:
                    field = cols[0].contents[0].strip()
                removed = cols[1].contents[0].strip()
                added = cols[2].contents[0].strip()

            field, removed, added = self.sanityze_change(field, removed, added)
            by = People(person_email)
            by.set_email(person_email)
            change = Change(field, removed, added, by, date)
            changes.append(change)

        return changes
開發者ID:MetricsGrimoire,項目名稱:Bicho,代碼行數:57,代碼來源:bg.py

示例3: __get_people_from_uri

 def __get_people_from_uri(self, uri):
     # returns People object from uri (person_link)
     try:
         people_lp = self.lp.people[self._get_nickname_from_uri(uri)]
         people_issue = People(people_lp.name)
         people_issue.set_name(people_lp.display_name)
     except Exception:
         # user deleted from Launchpad!
         people_issue = People(self._get_nickname_from_uri(uri))
     return people_issue
開發者ID:yujuanjiang,項目名稱:Bicho,代碼行數:10,代碼來源:lp.py

示例4: _get_person

 def _get_person(self, lpperson):
     """
     Returns Bicho People object from Launchpad person object
     """
     p = People(lpperson.name)
     p.set_name(lpperson.display_name)
     if lpperson.confirmed_email_addresses:
         for m in lpperson.confirmed_email_addresses:
             p.set_email(m.email)
             break
     return p
開發者ID:athanrous,項目名稱:Bicho,代碼行數:11,代碼來源:lp.py

示例5: parse_changes

    def parse_changes(self, review):
        changesList = []
        patchSets = review['patchSets']

        for activity in patchSets:
            if "approvals" not in activity.keys():
                continue

            patchSetNumber = activity['number']

            for entry in activity['approvals']:
                # print "changed_by:" + entry['author']
                if "username" in entry["by"].keys():
                    by = People(entry['by']['username'])
                elif "email" in entry["by"].keys():
                    by = People(entry['by']['email'])
                elif "name" in entry["by"].keys():
                    by = People(entry['by']['name'])
                else:
                    by = People(unicode(''))

                if "name" in entry["by"].keys():
                    by.set_name(entry["by"]["name"])
                if "email" in entry["by"].keys():
                    by.set_email(entry["by"]["email"])
                # print "changed_on:" + entry['updated']
                field = entry['type']
                new_value = entry['value']
                old_value = patchSetNumber
                update = self._convert_to_datetime(entry["grantedOn"])
                change = Change(field, old_value, new_value, by, update)
                changesList.append(change)

        return changesList
開發者ID:drozas,項目名稱:Bicho,代碼行數:34,代碼來源:gerrit.py

示例6: __get_user

    def __get_user(self, username):
        if username in self.users:
            return self.users[username]

        url = "https://api.github.com/users/" + username
        raw_user = self.__fetch_data(url)

        user = People(username)

        if 'name' in raw_user:
            user.name = raw_user['name']
        if 'email' in raw_user:
            user.email = raw_user['email']

        self.users[username] = user

        return user
開發者ID:MetricsGrimoire,項目名稱:Bicho,代碼行數:17,代碼來源:github.py

示例7: parse_comments

    def parse_comments(self, review):
        if "comments" not in review.keys(): return []

        commentsList = []
        comments = review['comments']

        for comment in comments:
            if ("username" not in comment['reviewer'].keys()):
                comment['reviewer']["username"] = comment['reviewer']["name"]
            by = People(comment['reviewer']["username"])
            if ("name" in comment['reviewer'].keys()):
                by.set_name(comment['reviewer']["name"])
            if ("email" in comment['reviewer'].keys()):
                by.set_email(comment['reviewer']["email"])
            com = Comment(comment["message"], by, self._convert_to_datetime(comment["timestamp"]))
            commentsList.append(com)

        return commentsList
開發者ID:drozas,項目名稱:Bicho,代碼行數:18,代碼來源:gerrit.py

示例8: get_identities

    def get_identities(self, phids):
        ids = []
        request = []

        for phid in phids:
            if phid in self.identities:
                ids.append(self.identities[phid])
            else:
                request.append(phid)

        # Request non-cached identities
        result = self.conduit.users(request)

        for r in result:
            identity = People(r['userName'])
            identity.name = r['realName']
            ids.append(identity)
            self.identities[r['phid']] = identity
        return ids
開發者ID:dougdonohoe,項目名稱:Bicho,代碼行數:19,代碼來源:maniphest.py

示例9: get_identity

    def get_identity(self, ph_id):
        if not ph_id:
            return None

        if ph_id in self.identities:
            return self.identities[ph_id]

        result = self.conduit.users([ph_id])

        if result:
            raw_data = result[0]
            identity = People(raw_data['userName'])
            identity.name = raw_data['realName']
        else:
            identity = People(ph_id)

        self.identities[ph_id] = identity

        return identity
開發者ID:dougdonohoe,項目名稱:Bicho,代碼行數:19,代碼來源:maniphest.py

示例10: get_people

    def get_people(self, id):
        people = People(id)
        people.set_name(id)

        for user in self.users:
            if user['id'] == id:
                people.set_name(user["full_name"])
                people.set_email(user["email"])
                break
        return people
開發者ID:acs,項目名稱:Bicho,代碼行數:10,代碼來源:taiga.py

示例11: parse_bug

    def parse_bug(self, issue_allura):
        people = People(issue_allura["reported_by_id"])
        people.set_name(issue_allura["reported_by"])

        issue = AlluraIssue(issue_allura["_id"],
                            "ticket",
                            issue_allura["summary"],
                            issue_allura["description"],
                            people,
                            self._convert_to_datetime(issue_allura["created_date"]))
        people = People(issue_allura["assigned_to_id"])
        people.set_name(issue_allura["assigned_to"])
        issue.assigned_to = people
        issue.status = issue_allura["status"]
        # No information from Allura for this fields
        issue.resolution = None
        issue.priority = None

        # Extended attributes
        issue.labels = str(issue_allura["labels"])
        issue.private = issue_allura["private"]
        issue.ticket_num = issue_allura["ticket_num"]
        issue.discussion_thread_url = issue_allura["discussion_thread_url"]
        issue.related_artifacts = str(issue_allura["related_artifacts"])
        issue.custom_fields = str(issue_allura["custom_fields"])
        issue.mod_date = self._convert_to_datetime(issue_allura["mod_date"])

        return issue
開發者ID:MetricsGrimoire,項目名稱:Bicho,代碼行數:28,代碼來源:allura.py

示例12: _parse_journals

    def _parse_journals(self, issue, issue_id):
        issue_url = self._get_issue_url(issue_id)

        printdbg("Analyzing issue journals " + issue_url)
        f = urllib2.urlopen(issue_url)
        data = json.loads(f.read())
        journals = data["issue"]["journals"]

        for journal in journals:
            try:
                people = People(self._get_author_identity(journal["user"]["id"]))
                people.set_name(journal["user"]["name"])
            except KeyError:
                people = People("None")

            dt = self._convert_to_datetime(journal["created_on"])

            # Comment
            notes = journal.get("notes", None)
            if notes:
                msg = journal["notes"]
                comment = Comment(msg, people, dt)
                issue.add_comment(comment)

            # Changes
            for detail in journal["details"]:
                field = detail["name"]
                old_value = unicode(detail.get("old_value", unicode(None)))
                new_value = unicode(detail.get("new_value", unicode(None)))

                # Change status value
                if field == u"status_id":
                    field = unicode("status")
                    old_value = self.statuses.get(old_value, unicode(None))
                    new_value = self.statuses.get(new_value, unicode(None))

                change = Change(field, old_value, new_value, people, dt)
                issue.add_change(change)
開發者ID:adamlofting,項目名稱:Bicho,代碼行數:38,代碼來源:redmine.py

示例13: get_identity

    def get_identity(self, username):
        if not username:
            return None

        if username in self.identities:
            return self.identities[username]

        result = self.api_client.user(username)
        raw_user = result['user']

        identity = People(username)

        if 'user' in result:
            if 'fullname' in raw_user:
                identity.name = raw_user['fullname']
            elif 'first_name' in raw_user:
                identity.name = '%s %s' % (raw_user['first_name'], raw_user['last_name'])

            if 'email' in raw_user:
                identity.email = raw_user['email']

        self.identities[username] = identity

        return identity
開發者ID:MetricsGrimoire,項目名稱:Bicho,代碼行數:24,代碼來源:reviewboard.py

示例14: parse_review

    def parse_review(self, review):
        if "username" in review["owner"].keys():
            people = People(review['owner']['username'])
        elif "email" in review["owner"].keys():
            people = People(review['owner']['email'])
        elif "name" in review["owner"].keys():
            people = People(review['owner']['name'])
        else:
            people = People(unicode(''))

        if "name" in review["owner"].keys():
            people.set_name(review["owner"]["name"])
        if "email" in review["owner"].keys():
            people.set_email(review["owner"]["email"])

        description = ""
        issue = GerritIssue(review["number"],
                            "review",
                            review["subject"],
                            description,
                            people,
                            self._convert_to_datetime(review["createdOn"])
                            )
#        people =  People(review["assigned_to_id"])
#        people.set_name(review["assigned_to"])
#        issue.assigned_to = people
        issue.status = review["status"]
        # No information from Gerrit for this fields
        issue.assigned_to = None
        issue.resolution = None
        issue.priority = None

        issue.branch = review["branch"]
        issue.url = review["url"]
        issue.change_id = review["id"]
        if "topic" in review.keys():
            issue.related_artifacts = review["topic"]
        else:
            issue.related_artifacts = None
        issue.project = review["project"]
        issue.mod_date = self._convert_to_datetime(review["lastUpdated"])
        issue.open = review["open"]

        return issue
開發者ID:drozas,項目名稱:Bicho,代碼行數:44,代碼來源:gerrit.py

示例15: _get_person

 def _get_person(self, lpperson):
     """
     Returns Bicho People object from Launchpad person object
     """
     try:
         p = People(lpperson.name)
         p.set_name(lpperson.display_name)
         if lpperson.confirmed_email_addresses:
             for m in lpperson.confirmed_email_addresses:
                 p.set_email(m.email)
                 break
     except Exception, e:
         printerr(str(e))
         p = People("unknown")
開發者ID:yujuanjiang,項目名稱:Bicho,代碼行數:14,代碼來源:lp.py


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