diff options
Diffstat (limited to 'pygithub3/resources/issues.py')
-rw-r--r-- | pygithub3/resources/issues.py | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/pygithub3/resources/issues.py b/pygithub3/resources/issues.py index e864e79..c560faa 100644 --- a/pygithub3/resources/issues.py +++ b/pygithub3/resources/issues.py @@ -1,9 +1,33 @@ #!/usr/bin/env python # -*- encoding: utf-8 -*- +import re + from .base import Resource from .users import User + +class Label(Resource): + @staticmethod + def is_valid_color(color): + valid_color = re.compile(r'[0-9abcdefABCDEF]{6}') + match = valid_color(color) + if match is None: + return False + return match.start() == 0 and match.end() == len(color) + + def __str__(self): + return '<Label (%s)>' % getattr(self, 'name', '') + + +class Milestone(Resource): + _dates = ('created_at', 'due_on') + _maps = {'creator': User} + + def __str__(self): + return '<Milestone (%s)>' % getattr(self, 'title', '') + + class Issue(Resource): _dates = ('created_at', 'updated_at') @@ -28,4 +52,4 @@ class Event(Resource): _maps = {'actor': User, 'issue': Issue} def __str__(self): - return '<Event (%s)>' % (getattr(self, 'commit_id', ''))
\ No newline at end of file + return '<Event (%s)>' % (getattr(self, 'commit_id', '')) |