diff options
| author | 2012-02-03 14:45:32 +0100 | |
|---|---|---|
| committer | 2012-02-03 14:46:54 +0100 | |
| commit | f01bc94a33d8644da65b5fa895c222e9ee057b50 (patch) | |
| tree | 3bfc837901a54f97a30f1d24431d8322906de192 /github3/core/resources | |
| parent | Pypi environment by setuptools (diff) | |
| download | python-github3-f01bc94a33d8644da65b5fa895c222e9ee057b50.tar.xz python-github3-f01bc94a33d8644da65b5fa895c222e9ee057b50.zip | |
Fix imports to new environment
Absolute imports as PEP8 tells
Diffstat (limited to '')
| -rw-r--r-- | github3/core/resources/user/__init__.py | 2 | ||||
| -rw-r--r-- | github3/core/resources/user/emails.py | 8 | ||||
| -rw-r--r-- | pygithub3/core/resources/__init__.py (renamed from github3/core/resources/__init__.py) | 10 | ||||
| -rw-r--r-- | pygithub3/core/resources/users/followers.py (renamed from github3/core/resources/user/followers.py) | 0 | ||||
| -rw-r--r-- | pygithub3/core/resources/users/keys.py (renamed from github3/core/resources/user/keys.py) | 0 | ||||
| -rw-r--r-- | pygithub3/core/resources/users/user.py (renamed from github3/core/resources/user/user.py) | 4 |
6 files changed, 11 insertions, 13 deletions
diff --git a/github3/core/resources/user/__init__.py b/github3/core/resources/user/__init__.py deleted file mode 100644 index 8248571..0000000 --- a/github3/core/resources/user/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -from core.resources import Resource -from user import * diff --git a/github3/core/resources/user/emails.py b/github3/core/resources/user/emails.py deleted file mode 100644 index 83644db..0000000 --- a/github3/core/resources/user/emails.py +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env python -# -*- encoding: utf-8 -*- - -from core.uris import Manager -from models.base import Model - -class List(Manager): - pass diff --git a/github3/core/resources/__init__.py b/pygithub3/core/resources/__init__.py index c5dee18..bca9607 100644 --- a/github3/core/resources/__init__.py +++ b/pygithub3/core/resources/__init__.py @@ -3,6 +3,9 @@ import re +ABS_IMPORT_PREFIX = 'pygithub3.core.resources' + + class UriNotFound(Exception): pass @@ -41,6 +44,7 @@ class Resource(object): class Factory(object): """ """ + import_pattern = re.compile(r'^(\w+\.)+\w+$') def __init__(self, **kwargs): @@ -59,11 +63,13 @@ class Factory(object): """ """ from importlib import import_module + def wrapper(self, resource_path): module_chunk, s, uri_chunk = resource_path.rpartition('.') try: # TODO: CamelCase and under_score support, now only Class Name - module = import_module('core.resources.%s' % module_chunk) + module = import_module('%s.%s' + % (ABS_IMPORT_PREFIX, module_chunk)) uri = getattr(module, uri_chunk.capitalize()) except ImportError: raise UriNotFound("'%s' module does not exists" % module_chunk) @@ -78,4 +84,4 @@ class Factory(object): def __call__(self, resource_class=''): resource = resource_class(self.args) assert isinstance(resource, Resource) - return resource + return resource diff --git a/github3/core/resources/user/followers.py b/pygithub3/core/resources/users/followers.py index e69de29..e69de29 100644 --- a/github3/core/resources/user/followers.py +++ b/pygithub3/core/resources/users/followers.py diff --git a/github3/core/resources/user/keys.py b/pygithub3/core/resources/users/keys.py index e69de29..e69de29 100644 --- a/github3/core/resources/user/keys.py +++ b/pygithub3/core/resources/users/keys.py diff --git a/github3/core/resources/user/user.py b/pygithub3/core/resources/users/user.py index 4308f01..1399ff8 100644 --- a/github3/core/resources/user/user.py +++ b/pygithub3/core/resources/users/user.py @@ -2,10 +2,11 @@ # -*- encoding: utf-8 -*- from . import Resource -from models.user import User +from pygithub3.models.users import User __all__ = ('Get', 'Update') + class Get(Resource): model = User @@ -19,5 +20,6 @@ class Get(Resource): else: return 'user' + class Update(Resource): pass |
