Skip to content

Commit f01bc94

Browse files
committed
Fix imports to new environment
Absolute imports as PEP8 tells
1 parent 1f377bc commit f01bc94

File tree

22 files changed

+51
-27
lines changed

22 files changed

+51
-27
lines changed

github3/core/resources/user/__init__.py

Lines changed: 0 additions & 2 deletions
This file was deleted.

github3/core/resources/user/emails.py

Lines changed: 0 additions & 8 deletions
This file was deleted.

github3/tests/__init__.py

Whitespace-only changes.

pygithub3/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env python
2+
# -*- encoding: utf-8 -*-
3+
4+
__title__ = 'pygithub3'
5+
__version__ = '0.1'
6+
__author__ = 'David Medina'
7+
__license__ = 'ISC'
8+
__copyright__ = 'Copyright 2012 David Medina'
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
# -*- encoding: utf-8 -*-
33

44
import requests
5-
from errors import GithubError
65

6+
from .errors import GithubError
77

88
VALID_REQUEST_ARGS = set((
99
'params', 'data', 'headers', 'cookies', 'files', 'auth', 'timeout',
@@ -65,7 +65,7 @@ def __parse_kwargs(func):
6565
def wrapper(self, verb, resource, **kwargs):
6666
diffs = kwargs.viewkeys() - VALID_REQUEST_ARGS
6767
new_params = kwargs.get('params') or {}
68-
new_params.update({key:kwargs[key] for key in diffs})
68+
new_params.update({key: kwargs[key] for key in diffs})
6969
kwargs['params'] = new_params
7070
return func(self, verb, resource, **kwargs)
7171
return wrapper
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33

44
import re
55

6+
ABS_IMPORT_PREFIX = 'pygithub3.core.resources'
7+
8+
69
class UriNotFound(Exception):
710
pass
811

@@ -41,6 +44,7 @@ def __str__(self):
4144

4245
class Factory(object):
4346
""" """
47+
4448
import_pattern = re.compile(r'^(\w+\.)+\w+$')
4549

4650
def __init__(self, **kwargs):
@@ -59,11 +63,13 @@ def __dispatch(func):
5963
""" """
6064

6165
from importlib import import_module
66+
6267
def wrapper(self, resource_path):
6368
module_chunk, s, uri_chunk = resource_path.rpartition('.')
6469
try:
6570
# TODO: CamelCase and under_score support, now only Class Name
66-
module = import_module('core.resources.%s' % module_chunk)
71+
module = import_module('%s.%s'
72+
% (ABS_IMPORT_PREFIX, module_chunk))
6773
uri = getattr(module, uri_chunk.capitalize())
6874
except ImportError:
6975
raise UriNotFound("'%s' module does not exists" % module_chunk)
@@ -78,4 +84,4 @@ def wrapper(self, resource_path):
7884
def __call__(self, resource_class=''):
7985
resource = resource_class(self.args)
8086
assert isinstance(resource, Resource)
81-
return resource
87+
return resource
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# -*- encoding: utf-8 -*-
2+
3+
from pygithub3.core.resources import Resource
4+
from user import *
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env python
2+
# -*- encoding: utf-8 -*-
3+
4+
from . import Resource
5+
#from pygithub3.models.
6+
7+
8+
class List(Resource):
9+
pass

0 commit comments

Comments
 (0)