How to use the changelog.gerrit.GerritUser function in changelog

To help you get started, we’ve selected a few changelog examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lineageos-infra / updater / changelog / gerrit.py View on Github external
self.subject = obj['subject']
        self.status = obj['status']
        self.created = parse_gerrit_datetime(obj['created'])
        self.updated = parse_gerrit_datetime(obj['updated'])
        self.submitted = parse_gerrit_datetime(obj.get('submitted', None))
        self.number = obj['_number']
        self.url = self._url + '/' + str(self.number)
        self.owner = GerritUser(url, obj['owner'])
        self.labels = {}
        for lbl in obj['labels']:
            self.labels[lbl] = {}
            for k, v in obj['labels'][lbl].items():
                if k in ('blocking', 'value', 'default_value'):
                    self.labels[lbl][k] = v
                elif k in ('approved', 'rejected', 'recommended', 'disliked'):
                    self.labels[lbl][k] = GerritUser(url, v)
                else:
                    print("Unknown label: %s" % k)
github lineageos-infra / updater / changelog / gerrit.py View on Github external
def __init__(self, url, obj):
        super(GerritUser, self).__init__(url)
        self.id = obj['_account_id']
        try:
            self.username = obj.get('username', obj['name'])
        except KeyError:
            self.username = 'unknown'
        try:
            self.name = obj.get('name', obj['username'])
        except KeyError:
            self.name = 'Anonymous Coward'
        try:
            self.email = obj['email']
        except KeyError:
            self.email = 'unknown'
        self.avatars = {}
        for i in obj['avatars']:
            self.avatars[i['height']] = i['url']
github lineageos-infra / updater / changelog / gerrit.py View on Github external
def default(self, obj):
        try:
            if isinstance(obj, GerritUser):
                return {'id': obj.id, 'name': obj.name, 'username': obj.username, 'avatars': obj.avatars}
        except TypeError:
            pass
        return JSONEncoder.default(self, obj)
github lineageos-infra / updater / changelog / gerrit.py View on Github external
def __init__(self, url, obj):
        super(GerritChange, self).__init__(url)
        self._id = obj['id']
        self.project = obj['project']
        self.branch = obj['branch']
        self.change_id = obj['change_id']
        self.subject = obj['subject']
        self.status = obj['status']
        self.created = parse_gerrit_datetime(obj['created'])
        self.updated = parse_gerrit_datetime(obj['updated'])
        self.submitted = parse_gerrit_datetime(obj.get('submitted', None))
        self.number = obj['_number']
        self.url = self._url + '/' + str(self.number)
        self.owner = GerritUser(url, obj['owner'])
        self.labels = {}
        for lbl in obj['labels']:
            self.labels[lbl] = {}
            for k, v in obj['labels'][lbl].items():
                if k in ('blocking', 'value', 'default_value'):
                    self.labels[lbl][k] = v
                elif k in ('approved', 'rejected', 'recommended', 'disliked'):
                    self.labels[lbl][k] = GerritUser(url, v)
                else:
                    print("Unknown label: %s" % k)