本文整理汇总了Python中bicho.common.People.set_name方法的典型用法代码示例。如果您正苦于以下问题:Python People.set_name方法的具体用法?Python People.set_name怎么用?Python People.set_name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bicho.common.People
的用法示例。
在下文中一共展示了People.set_name方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parse_changes
# 需要导入模块: from bicho.common import People [as 别名]
# 或者: from bicho.common.People import set_name [as 别名]
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
示例2: obtainDataPerson
# 需要导入模块: from bicho.common import People [as 别名]
# 或者: from bicho.common.People import set_name [as 别名]
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
示例3: parse_bug
# 需要导入模块: from bicho.common import People [as 别名]
# 或者: from bicho.common.People import set_name [as 别名]
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
示例4: parse_changes
# 需要导入模块: from bicho.common import People [as 别名]
# 或者: from bicho.common.People import set_name [as 别名]
def parse_changes(self, review):
changesList = []
patchSets = review['patchSets']
for activity in patchSets:
# Now, we want all patches
# if "approvals" not in activity.keys():
# continue
patchSetNumber = activity['number']
# Add uploaded event
upload = self._convert_to_datetime(activity['createdOn'])
# share this people build logic
if "username" in activity["uploader"].keys():
by = People(activity["uploader"]['username'])
elif "email" in activity["uploader"].keys():
by = People(activity["uploader"]['email'])
elif "name" in activity["uploader"].keys():
by = People(activity["uploader"]['name'])
else:
by = People(unicode(''))
if "name" in activity["uploader"].keys():
by.set_name(activity["uploader"]["name"])
if "email" in activity["uploader"].keys():
by.set_email(activity["uploader"]["email"])
# print "changed_on:" + entry['updated']
field = unicode('Upload')
new_value = unicode('')
old_value = patchSetNumber
change = Change(field, old_value, new_value, by, upload)
changesList.append(change)
if 'approvals' in activity:
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
示例5: __get_people_from_uri
# 需要导入模块: from bicho.common import People [as 别名]
# 或者: from bicho.common.People import set_name [as 别名]
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
示例6: get_people
# 需要导入模块: from bicho.common import People [as 别名]
# 或者: from bicho.common.People import set_name [as 别名]
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
示例7: _get_person
# 需要导入模块: from bicho.common import People [as 别名]
# 或者: from bicho.common.People import set_name [as 别名]
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
示例8: _get_person
# 需要导入模块: from bicho.common import People [as 别名]
# 或者: from bicho.common.People import set_name [as 别名]
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")
示例9: parse_comments
# 需要导入模块: from bicho.common import People [as 别名]
# 或者: from bicho.common.People import set_name [as 别名]
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
示例10: parse_review
# 需要导入模块: from bicho.common import People [as 别名]
# 或者: from bicho.common.People import set_name [as 别名]
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
示例11: analyze_bug
# 需要导入模块: from bicho.common import People [as 别名]
# 或者: from bicho.common.People import set_name [as 别名]
def analyze_bug(self, entry):
people = People(entry['author_detail']['href'])
people.set_name(entry['author_detail']['name'])
issue = GoogleCodeIssue(entry['id'],
'issue',
entry['title'],
entry['content'],
people,
self._convert_to_datetime(entry['published']))
# Strange how the parser rename this fields
if 'issues_uri' in entry.keys():
people = People(entry['issues_uri'])
people.set_name(entry['issues_username'])
issue.assigned_to = people
issue.status = entry['issues_status']
issue.resolution = entry['issues_state']
issue.priority = entry['issues_label']
# Extended attributes
# issue.labels = str(issue_googlecode["labels"])
issue.star = entry['issues_stars']
issue.ticket_num = entry['issues_id']
issue.mod_date = self._convert_to_datetime(entry['updated'])
issue.closed_date = None
if 'issues_closeddate' in entry.keys():
issue.closed_date = self._convert_to_datetime(entry['issues_closeddate'])
changes_url = Config.url + "/issues/" + issue.ticket_num + "/comments/full"
printdbg("Analyzing issue " + changes_url)
d = feedparser.parse(changes_url)
changes = self.parse_changes(d, issue.ticket_num)
for c in changes:
issue.add_change(c)
return issue
示例12: _parse_journals
# 需要导入模块: from bicho.common import People [as 别名]
# 或者: from bicho.common.People import set_name [as 别名]
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)
示例13: get_issue
# 需要导入模块: from bicho.common import People [as 别名]
# 或者: from bicho.common.People import set_name [as 别名]
def get_issue(self):
issue_id = self.atags["bug_id"]
type = self.atags["bug_severity"]
summary = self.atags["short_desc"]
if len(self.ctags["long_desc"]) > 0:
desc = self.ctags["long_desc"][0]["thetext"]
else:
desc = ""
submitted_by = People(self.atags["reporter"])
submitted_by.set_name(self.atags["reporter_name"])
submitted_by.set_email(self.atags["reporter"])
submitted_on = self._convert_to_datetime(self.atags["creation_ts"])
# FIXME: I miss resolution and priority
issue = BugzillaIssue(issue_id, type, summary, desc, submitted_by,
submitted_on)
issue.set_priority(self.atags["priority"])
issue.set_status(self.atags["bug_status"])
assigned_to = People(self.atags["assigned_to"])
assigned_to.set_name(self.atags["assigned_to_name"])
assigned_to.set_email(self.atags["assigned_to"])
issue.set_assigned(assigned_to)
# FIXME = I miss the number of comment and the work_time (useful in
# bugzillas)
# date must be also a datetime
for rc in self._get_raw_comments():
if rc["bug_when"]:
by = People(rc["who"])
by.set_name(rc["who_name"])
by.set_email(rc["who"])
com = Comment(rc["thetext"], by, self._to_datetime_with_secs(rc["bug_when"]))
issue.add_comment(com)
else:
#FIXME bug_when empty
printdbg("ERROR - Comment")
# FIXME TBD: Attachment is not supported so far
## at = Attachment
#issue.add_attachment()
# FIXME TBD: Relations
# fields in btags: dependson, blocked
# issue.add_relationship() # issue_id, type
issue.set_resolution(self.atags["resolution"])
issue.set_alias(self.atags["alias"])
issue.set_delta_ts(self._to_datetime_with_secs(self.atags["delta_ts"]))
issue.set_reporter_accessible(self.atags["reporter_accessible"])
issue.set_cclist_accessible(self.atags["cclist_accessible"])
issue.set_classification_id(self.atags["classification_id"])
issue.set_classification(self.atags["classification"])
issue.set_product(self.atags["product"])
issue.set_component(self.atags["component"])
issue.set_version(self.atags["version"])
issue.set_rep_platform(self.atags["rep_platform"])
issue.set_op_sys(self.atags["op_sys"])
if self.atags["dup_id"]:
issue.set_dup_id(int(self.atags["dup_id"]))
issue.set_bug_file_loc(self.atags["bug_file_loc"])
issue.set_status_whiteboard(self.atags["status_whiteboard"])
issue.set_target_milestone(self.atags["target_milestone"])
issue.set_votes(self.atags["votes"])
issue.set_everconfirmed(self.atags["everconfirmed"])
issue.set_qa_contact(self.atags["qa_contact"])
issue.set_estimated_time(self.atags["estimated_time"])
issue.set_remaining_time(self.atags["remaining_time"])
issue.set_actual_time(self.atags["actual_time"])
if self.atags["deadline"]:
issue.set_deadline(self._convert_to_datetime(self.atags["deadline"]))
issue.set_keywords(self.btags["keywords"])
# we also store the list of watchers/CC
for w in self.btags["cc"]:
auxp = People(w)
issue.add_watcher(auxp)
issue.set_group(self.btags["group"])
issue.set_flag(self.btags["flag"])
return issue
示例14: analyze_bug
# 需要导入模块: from bicho.common import People [as 别名]
# 或者: from bicho.common.People import set_name [as 别名]
def analyze_bug(self, issue_redmine):
#print(issue_redmine)
#print("*** %s " % issue_redmine["author"]["id"])
try:
people = People(self._get_author_identity(issue_redmine["author"]["id"]))
people.set_name(issue_redmine["author"]["name"])
except KeyError:
people = People("None")
try:
desc = issue_redmine["description"]
except KeyError:
desc = ""
issue = RedmineIssue(issue_redmine["id"],
"ticket",
issue_redmine["subject"],
desc,
people,
self._convert_to_datetime(issue_redmine["created_on"]))
try:
#print("<<< %s " % issue_redmine["assigned_to"]["id"])
people = People(self._get_author_identity(issue_redmine["assigned_to"]["id"]))
people.set_name(issue_redmine["assigned_to"]["name"])
issue.assigned_to = people
except KeyError:
people = People("None")
issue.assigned_to = people
issue.status = issue_redmine["status"]["name"]
issue.priority = issue_redmine["priority"]["id"]
# No information from Redmine for this field. Included in Status
issue.resolution = None
# Extended attributes
try:
issue.category_id = issue_redmine["category"]["id"]
except KeyError:
issue.category_id = None
issue.done_ratio = issue_redmine["done_ratio"]
# if issue_redmine["due_date"] is None:
# issue.due_date = None
# else:
# issue.due_date = self._convert_to_datetime(issue_redmine["due_date"])
#issue.estimated_hours = issue_redmine["estimated_hours"]
try:
issue.fixed_version_id = issue_redmine["fixed_version"]["id"]
except KeyError:
issue.fixed_version_id = None
#issue.lft = issue_redmine["lft"]
#issue.rgt = issue_redmine["rgt"]
#issue.lock_version = issue_redmine["lock_version"]
#issue.parent_id = issue_redmine["parent_id"]
issue.project_id = issue_redmine["project"]["id"]
#issue.root_id = issue_redmine["root_id"]
# if issue_redmine["start_date"] is None:
# issue.start_date = None
# else:
# issue.start_date = self._convert_to_datetime(issue_redmine["start_date"])
try:
issue.start_date = self._convert_to_datetime(issue_redmine["start_date"])
except:
issue.start_date = None
issue.tracker_id = issue_redmine["tracker"]["id"]
# if issue_redmine["updated_on"] is None:
# issue.updated_on = None
# else:
# issue.updated_on = self._convert_to_datetime(issue_redmine["updated_on"])
try:
issue.updated_on = self._convert_to_datetime(issue_redmine["updated_on"])
except KeyError:
issue.updated_on = None
# Parse journals (comments and changes)
self._parse_journals(issue, issue_redmine["id"])
print("Issue #%s updated on %s" % (issue_redmine["id"], issue.updated_on))
return issue
示例15: getIssue
# 需要导入模块: from bicho.common import People [as 别名]
# 或者: from bicho.common.People import set_name [as 别名]
def getIssue(self, bug):
#Return the parse data bug into issue object
issue_id = bug.key_id
issue_type = bug.bug_type
summary = bug.summary
description = bug.description
status = bug.status
resolution = bug.resolution
assigned_by = People(bug.assignee_username)
assigned_by.set_name(bug.assignee)
assigned_by.set_email(BugsHandler.getUserEmail(bug.assignee_username))
submitted_by = People(bug.reporter_username)
submitted_by.set_name(bug.reporter)
submitted_by.set_email(BugsHandler.getUserEmail(bug.reporter_username))
submitted_on = parse(bug.created).replace(tzinfo=None)
issue = JiraIssue(issue_id, issue_type, summary, description, submitted_by, submitted_on)
issue.set_assigned(assigned_by)
issue.setIssue_key(bug.issue_key)
issue.setTitle(bug.title)
issue.setLink(bug.link)
issue.setEnvironment(bug.environment)
issue.setSecurity(bug.security)
issue.setUpdated(parse(bug.updated).replace(tzinfo=None))
issue.setVersion(bug.version)
issue.setComponent(bug.component)
issue.setVotes(bug.votes)
issue.setProject(bug.project)
issue.setProject_id(bug.project_id)
issue.setProject_key(bug.project_key)
issue.setStatus(status)
issue.setResolution(resolution)
bug_activity_url = bug.link + '?page=com.atlassian.jira.plugin.system.issuetabpanels%3Achangehistory-tabpanel'
printdbg("Bug activity: " + bug_activity_url)
data_activity = urllib.urlopen(bug_activity_url).read()
parser = SoupHtmlParser(data_activity, bug.key_id)
changes = parser.parse_changes()
for c in changes:
issue.add_change(c)
for comment in bug.comments:
comment_by = People(comment.comment_author)
comment_by.set_email(BugsHandler.getUserEmail(comment.comment_author))
comment_on = parse(comment.comment_created).replace(tzinfo=None)
com = Comment(comment.comment, comment_by, comment_on)
issue.add_comment(com)
for attachment in bug.attachments:
url = "/secure/attachment/" + attachment.attachment_id + "/" + attachment.attachment_name
attachment_by = People(attachment.attachment_author)
attachment_by.set_email(BugsHandler.getUserEmail(attachment.attachment_author))
attachment_on = parse(attachment.attachment_created).replace(tzinfo=None)
attach = Attachment(url, attachment_by, attachment_on)
issue.add_attachment(attach)
#FIXME customfield are not stored in db because is the fields has the same in all the bugs
return issue