aboutsummaryrefslogtreecommitdiffstats
path: root/pygithub3/resources/repos.py
blob: 609ede46e37d4d651b201166c5c1ae15e3c7f227 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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', '')