forked from copitux/python-github3
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrepos.py
More file actions
141 lines (79 loc) · 2.96 KB
/
repos.py
File metadata and controls
141 lines (79 loc) · 2.96 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# -*- encoding: utf-8 -*-
from pygithub3.core.compat import OrderedDict
from .base import Resource
from .users import User
from .orgs import Org
class Repo(Resource):
_dates = ('created_at', 'updated_at', 'pushed_at')
_maps = {'owner': User, 'organization': Org, 'parent': 'self',
'source': 'self'}
def __str__(self):
return '<Repo (%s)>' % getattr(self, 'name', '')
class Author(Resource):
_dates = ('date')
def __str__(self):
return '<Author (%s)>' % getattr(self, 'name', '')
class Committer(Resource):
_dates = ('date')
def __str__(self):
return '<Committer (%s)>' % getattr(self, 'name', '')
class Commit(Resource):
_maps = {'author': Author, 'committer': Committer}
#_maps.update({'tree': GitCommit})
def __str__(self):
return '<Commit (%s)>' % getattr(self, 'author', '')
class Stats(Resource):
pass
class File(Resource):
def __str__(self):
return '<File (%s)>' % getattr(self, 'filename', '')
class GitCommit(Resource):
_maps = {'author': User, 'committer': User, 'commit': Commit,
'stats': Stats}
_collection_maps = {'parents': 'self', 'files': File}
def __str__(self):
return '<GitCommit (%s)>' % getattr(self, 'sha', '')
class Comment(Resource):
_dates = ('created_at', 'updated_at')
_maps = {'user': User}
def __str__(self):
return '<Comment (%s)>' % getattr(self, 'user', '')
class Diff(Resource):
_maps = {'base_commit': Commit}
_collection_maps = {'commits': Commit, 'files': File}
def __str__(self):
return '<Diff (%s)>' % getattr(self, 'status', '')
class Tag(Resource):
_maps = {'commit': GitCommit}
def __str__(self):
return '<Tag (%s)>' % getattr(self, 'name', '')
class Branch(Resource):
_maps = {'commit': GitCommit}
def __str__(self):
return '<Branch (%s)>' % getattr(self, 'name', '')
class Download(Resource):
def __str__(self):
return '<Download (%s)>' % getattr(self, 'name', '')
def ball_to_upload(self):
return OrderedDict({
'key': self.path, 'acl': self.acl, 'success_action_status': '201',
'Filename': self.name, 'AWSAccessKeyId': self.accesskeyid,
'Policy': self.policy, 'Signature': self.signature,
'Content-Type': self.mime_type})
class Hook(Resource):
_dates = ('created_at', 'pushed_at')
def __str__(self):
return '<Hook (%s)>' % getattr(self, 'name', '')
class Status(Resource):
_dates = ('created_at', 'updated_at')
_maps = {'creator': User}
def __str__(self):
return '<Status (%s)>' % getattr(self, 'state', '')
class Release(Resource):
_dates = ('created_at', 'published_at')
def __str__(self):
return '<Release (%s)>' % getattr(self, 'name', '')
class Content(Resource):
_dates = ('created_at', 'published_at')
def __str__(self):
return '<Content (%s)>' % getattr(self, 'name', '')