Skip to content
This repository was archived by the owner on Dec 17, 2019. It is now read-only.

Commit 75c252e

Browse files
committed
Nampespaces 💘 me
1 parent 9cd4e39 commit 75c252e

File tree

12 files changed

+40
-55
lines changed

12 files changed

+40
-55
lines changed

pygithub3/requests/base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/usr/bin/env python
21
# -*- encoding: utf-8 -*-
32

43
import re

pygithub3/requests/events/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- encoding: utf-8 -*-
22

3-
from pygithub3.requests.base import Request, ValidationError
3+
from pygithub3.requests.base import Request
44
from pygithub3.resources.events import Event
55

66

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
#!/usr/bin/env python
21
# -*- encoding: utf-8 -*-
32

43
from . import Request
5-
from pygithub3.resources.events import NetworkEvent
4+
from pygithub3.resources.events import Network
65

76

87
class List(Request):
98

109
uri = 'networks/{user}/{repo}/events'
11-
resource = NetworkEvent
10+
resource = Network

pygithub3/requests/events/orgs.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
#!/usr/bin/env python
21
# -*- encoding: utf-8 -*-
32

43
from . import Request
5-
from pygithub3.resources.events import OrgEvent
4+
from pygithub3.resources.events import Org
65

76

87
class List(Request):
98

109
uri = 'orgs/{org}/events'
11-
resource = OrgEvent
10+
resource = Org

pygithub3/requests/events/repos.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
#!/usr/bin/env python
21
# -*- encoding: utf-8 -*-
32

43
from . import Request
5-
from pygithub3.resources.events import RepoEvent
4+
from pygithub3.resources.events import Repo
65

76

87
class List(Request):
98

109
uri = 'repos/{user}/{repo}/events'
11-
resource = RepoEvent
10+
resource = Repo

pygithub3/requests/events/users.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,34 @@
1-
#!/usr/bin/env python
21
# -*- encoding: utf-8 -*-
32

43
from . import Request
5-
from pygithub3.resources.events import UserEvent, OrgEvent
4+
from pygithub3.resources.events import User, Org
65

76

87
class List_received(Request):
98

109
uri = 'users/{user}/received_events'
11-
resource = UserEvent
10+
resource = User
1211

1312

1413
class List_received_public(Request):
1514

1615
uri = 'users/{user}/received_events/public'
17-
resource = UserEvent
16+
resource = User
1817

1918

2019
class List_performed(Request):
2120

2221
uri = 'users/{user}/events'
23-
resource = UserEvent
22+
resource = User
2423

2524

2625
class List_performed_public(Request):
2726

2827
uri = 'users/{user}/events/public'
29-
resource = UserEvent
28+
resource = User
3029

3130

3231
class List_org_events(Request):
3332

3433
uri = 'users/{user}/events/orgs/{org}'
35-
resource = OrgEvent
34+
resource = Org

pygithub3/resources/events.py

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,49 @@
1-
#!/usr/bin/env python
21
# -*- encoding: utf-8 -*-
32

4-
from .base import Resource
5-
from .users import User
6-
from .repos import Repo
7-
from .orgs import Org
3+
from pygithub3.resources.base import Resource
4+
from pygithub3.resources import users, repos, orgs
85

96

107
class Event(Resource):
118

129
_dates = ('created_at', )
13-
_maps = {'actor': User, 'repo': Repo, 'org': Org}
10+
_maps = {'actor': users.User, 'repo': repos.Repo, 'org': orgs.Org}
1411

1512
def __str__(self):
16-
return '<Event (%s)>' % getattr(self, 'type', '')
13+
return '<(%s)>' % getattr(self, 'type', '')
1714

1815

19-
class RepoEvent(Resource):
16+
class Repo(Resource):
2017

2118
_dates = ('created_at', )
22-
_maps = {'actor': User, 'repo': Repo, 'org': Org}
19+
_maps = {'actor': users.User, 'repo': repos.Repo, 'org': orgs.Org}
2320

2421
def __str__(self):
25-
return '<Event (%s)>' % getattr(self, 'type', '')
22+
return '<(%s)>' % getattr(self, 'type', '')
2623

2724

28-
class NetworkEvent(Resource):
25+
class Network(Resource):
2926

3027
_dates = ('created_at', )
31-
_maps = {'actor': User, 'repo': Repo, 'org': Org}
28+
_maps = {'actor': users.User, 'repo': repos.Repo, 'org': orgs.Org}
3229

3330
def __str__(self):
34-
return '<Event (%s)>' % getattr(self, 'type', '')
31+
return '<(%s)>' % getattr(self, 'type', '')
3532

3633

37-
class OrgEvent(Resource):
34+
class Org(Resource):
3835

3936
_dates = ('created_at', )
40-
_maps = {'actor': User, 'repo': Repo, 'org': Org}
37+
_maps = {'actor': users.User, 'repo': repos.Repo, 'org': orgs.Org}
4138

4239
def __str__(self):
43-
return '<Event (%s)>' % getattr(self, 'type', '')
40+
return '<(%s)>' % getattr(self, 'type', '')
4441

4542

46-
class UserEvent(Resource):
43+
class User(Resource):
4744

4845
_dates = ('created_at', )
49-
_maps = {'actor': User, 'repo': Repo, 'org': Org}
46+
_maps = {'actor': users.User, 'repo': repos.Repo, 'org': orgs.Org}
5047

5148
def __str__(self):
52-
return '<Event (%s)>' % getattr(self, 'type', '')
49+
return '<(%s)>' % getattr(self, 'type', '')

pygithub3/services/events/__init__.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
# -*- encoding: utf-8 -*-
22

33
from pygithub3.services.base import Service
4-
from .. issues import Events as IssueEvents
5-
from . networks import NetworkEvents
6-
from . orgs import OrgEvents
7-
from . repos import RepoEvents
8-
from . users import UserEvents
4+
from pygithub3.services import issues
5+
from pygithub3.services.events import networks, orgs, repos, users
96

107

118
class Events(Service):
@@ -17,11 +14,11 @@ class Events(Service):
1714
"""
1815

1916
def __init__(self, **config):
20-
self._issues = IssueEvents(**config)
21-
self._networks = NetworkEvents(**config)
22-
self._orgs = OrgEvents(**config)
23-
self._repos = RepoEvents(**config)
24-
self._users = UserEvents(**config)
17+
self._issues = issues.events.Events(**config)
18+
self._networks = networks.Network(**config)
19+
self._orgs = orgs.Org(**config)
20+
self._repos = repos.Repo(**config)
21+
self._users = users.User(**config)
2522
super(Events, self).__init__(**config)
2623

2724
@property

pygithub3/services/events/networks.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
#!/usr/bin/env python
21
# -*- encoding: utf-8 -*-
32

43
from pygithub3.services.base import Service
54

65

7-
class NetworkEvents(Service):
6+
class Network(Service):
87
""" Consume a Repo's public `Network Events API
98
<http://developer.github.com/v3/events>`_
109

pygithub3/services/events/orgs.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
#!/usr/bin/env python
21
# -*- encoding: utf-8 -*-
32

43
from pygithub3.services.base import Service
54

65

7-
class OrgEvents(Service):
6+
class Org(Service):
87
""" Consume a `Org Events API
98
<http://developer.github.com/v3/events>`_
109

0 commit comments

Comments
 (0)