当前位置: 首页>>代码示例>>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;未经允许,请勿转载。