Exemplo n.º 1
0
class PullRequest(BaseObject):

    properties = ['html_url', 'state', 'title', 'user', 'merged']

    def __init__(self, **kwargs):
        super(PullRequest, self).__init__(**kwargs)
        if not self.title:
            self.title = "[No Title]"
        if not self.user:
            self.user = GithubUser()
        if not self.merged:
            self.merged = False

    def load(self, object_dict):
        for prop in ["title", "html_url", "state", "merged"]:
            default = getattr(self, prop)
            setattr(self, prop, object_dict.get(prop, default))

        gh_user = object_dict.get('user', None)
        self.user = GithubUser()
        if gh_user:
            self.user.load(gh_user)
Exemplo n.º 2
0
class PullRequest(BaseObject):

    properties = ["html_url", "state", "title", "user", "merged"]

    def __init__(self, **kwargs):
        super(PullRequest, self).__init__(**kwargs)
        if not self.title:
            self.title = "[No Title]"
        if not self.user:
            self.user = GithubUser()
        if not self.merged:
            self.merged = False

    def load(self, object_dict):
        for prop in ["title", "html_url", "state", "merged"]:
            default = getattr(self, prop)
            setattr(self, prop, object_dict.get(prop, default))

        gh_user = object_dict.get("user", None)
        self.user = GithubUser()
        if gh_user:
            self.user.load(gh_user)
Exemplo n.º 3
0
class PullRequestEvent(BaseObject):

    properties = ["action", "number", "pull_request", "sender"]

    def __init__(self, **kwargs):
        super(PullRequestEvent, self).__init__(**kwargs)
        self.action = "<No Action Specified>"
        self.pull_request = PullRequest()
        self.sender = GithubUser()

    def load(self, object_dict):
        self.action = object_dict.get("action", self.action)
        self.number = object_dict.get("number", self.number)

        gh_pr = object_dict.get("pull_request", None)
        self.pull_request = PullRequest()
        if gh_pr:
            self.pull_request.load(gh_pr)

        gh_user = object_dict.get("sender", None)
        self.sender = GithubUser()
        if gh_user:
            self.sender.load(gh_user)
Exemplo n.º 4
0
class PullRequestEvent(BaseObject):

    properties = ['action', 'number', 'pull_request', 'sender']

    def __init__(self, **kwargs):
        super(PullRequestEvent, self).__init__(**kwargs)
        self.action = "<No Action Specified>"
        self.pull_request = PullRequest()
        self.sender = GithubUser()

    def load(self, object_dict):
        self.action = object_dict.get('action', self.action)
        self.number = object_dict.get('number', self.number)

        gh_pr = object_dict.get('pull_request', None)
        self.pull_request = PullRequest()
        if gh_pr:
            self.pull_request.load(gh_pr)

        gh_user = object_dict.get('sender', None)
        self.sender = GithubUser()
        if gh_user:
            self.sender.load(gh_user)
Exemplo n.º 5
0
class GithubIssue(BaseObject):

    properties = ["title", "html_url", "assignee", "state", "labels", "user"]

    def __init__(self, **kwargs):
        super(GithubIssue, self).__init__(**kwargs)
        if not self.title:
            self.title = "No Title"
        if not self.assignee:
            self.assignee = GithubUser()
        if not self.labels:
            self.labels = []
        if not self.user:
            self.user = GithubUser()

    def load(self, object_dict):
        for prop in ["title", "html_url", "state"]:
            default = getattr(self, prop)
            setattr(self, prop, object_dict.get(prop, default))

        gh_assignee = object_dict.get("assignee", None)
        self.assignee = GithubUser()
        if gh_assignee:
            self.assignee.load(gh_assignee)

        gh_labels = object_dict.get("labels", [])
        self.labels = []
        for label in gh_labels:
            t_label = GithubIssueLabel()
            t_label.load(label)
            self.labels.append(t_label)

        gh_user = object_dict.get("user", None)
        self.user = GithubUser()
        if gh_user:
            self.user.load(gh_user)
Exemplo n.º 6
0
class GithubIssue(BaseObject):

    properties = ['title', 'html_url', 'assignee', 'state', 'labels', 'user']

    def __init__(self, **kwargs):
        super(GithubIssue, self).__init__(**kwargs)
        if not self.title:
            self.title = "No Title"
        if not self.assignee:
            self.assignee = GithubUser()
        if not self.labels:
            self.labels = []
        if not self.user:
            self.user = GithubUser()

    def load(self, object_dict):
        for prop in ["title", "html_url", "state"]:
            default = getattr(self, prop)
            setattr(self, prop, object_dict.get(prop, default))

        gh_assignee = object_dict.get('assignee', None)
        self.assignee = GithubUser()
        if gh_assignee:
            self.assignee.load(gh_assignee)

        gh_labels = object_dict.get('labels', [])
        self.labels = []
        for label in gh_labels:
            t_label = GithubIssueLabel()
            t_label.load(label)
            self.labels.append(t_label)

        gh_user = object_dict.get('user', None)
        self.user = GithubUser()
        if gh_user:
            self.user.load(gh_user)
Exemplo n.º 7
0
class GithubIssueEvent(BaseObject):

    properties = [
        'action',
        'issue',
        'sender'
    ]

    def __init__(self, **kwargs):
        super(GithubIssueEvent, self).__init__(**kwargs)
        self.action = "<No Action Specified>"

    def load(self, object_dict):
        self.action = object_dict.get('action', self.action)

        gh_issue = object_dict.get('issue', None)
        self.issue = GithubIssue()
        if gh_issue:
            self.issue.load(gh_issue)

        gh_user = object_dict.get('sender', None)
        self.sender = GithubUser()
        if gh_user:
            self.sender.load(gh_user)