diff options
author | 2012-02-12 17:53:07 +0100 | |
---|---|---|
committer | 2012-02-12 18:37:02 +0100 | |
commit | 3371f0aabc61dfc8549f0752ccc83aef06df61e8 (patch) | |
tree | 1fa6291a13ca8f3acdf2eed459be2ea08b7602d0 /pygithub3/resources/repos.py | |
parent | Support to map `self` in resources. (diff) | |
download | python-github3-3371f0aabc61dfc8549f0752ccc83aef06df61e8.tar.xz python-github3-3371f0aabc61dfc8549f0752ccc83aef06df61e8.zip |
Repos service initialized
+service.repos.repo
Diffstat (limited to 'pygithub3/resources/repos.py')
-rw-r--r-- | pygithub3/resources/repos.py | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/pygithub3/resources/repos.py b/pygithub3/resources/repos.py new file mode 100644 index 0000000..609ede4 --- /dev/null +++ b/pygithub3/resources/repos.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python +# -*- encoding: utf-8 -*- + +from .base import Resource +from .users import User +from .orgs import Org + +__all__ = ('Repo', ) + + +class Repo(Resource): + + _dates = ('created_at', 'pushed_at') + _maps = {'owner': User, 'organization': Org, 'parent': 'self', + 'source': 'self'} + + def __str__(self): + return '<Repo (%s)>' % getattr(self, 'name', '') + + +class Team(Resource): + + def __str__(self): + return '<Team (%s)>' % getattr(self, 'name', '') + + +class Commit(Resource): + + def __str__(self): + return '<Commit (%s:%s)>' % ( + getattr(self, 'sha', ''), + getattr(self, 'message', '')) + + +class Tag(Resource): + + _maps = {'commit': Commit} + + def __str__(self): + return '<Tag (%s)>' % getattr(self, 'name', '') + + +class Branch(Resource): + + _maps = {'commit': Commit} + + def __str__(self): + return '<Branch (%s)>' % getattr(self, 'name', '') |