Skip to content

Commit

Permalink
Merge pull request #20 from tomerghelber/revert-19-feature/split-relo…
Browse files Browse the repository at this point in the history
…aded-anime-and-manga

Revert "Feature/split reloaded anime and manga"
  • Loading branch information
tomerghelber committed Oct 8, 2014
2 parents 7f55017 + 34800c5 commit cdc0f3a
Show file tree
Hide file tree
Showing 76 changed files with 4,224 additions and 2,365 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ python:
# command to install dependencies
install:
- "pip install -r requirements.txt"
- "pip install -r test_requirements.txt"
# command to run tests
script: nosetests --with-coverage --cover-package=pymal
after_success:
Expand Down
4 changes: 3 additions & 1 deletion pymal/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
__authors__ = "pymal-developers"
__authors__ = ""
__copyright__ = "(c) 2014, pymal"
__license__ = "BSD License"
__contact__ = "Name Of Current Guardian of this file <email@address>"

__all__ = ['account', 'anime', 'manga', 'seasons']

Expand Down
4 changes: 2 additions & 2 deletions pymal/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

import requests
import singleton_factory
from reloaded_set import load

from pymal import global_functions
from pymal.decorators import load
from pymal.consts import HOST_NAME

__all__ = ['Account']
Expand Down Expand Up @@ -207,7 +207,7 @@ def auth_connect(self, url: str, data: str or None=None,
auth=self.__auth_object, session=self.__session).text.strip()

@property
@load()
@load
def image_url(self):
"""
:return: path for the image of the avatar of the account.
Expand Down
22 changes: 11 additions & 11 deletions pymal/account_objects/account_animes.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@

from urllib import request

from reloaded_set import load
from pymal.types.reloaded_set_singleton_factory import ReloadedSetSingletonFactory

from pymal.consts import HOST_NAME
from pymal import decorators
from pymal.types import ReloadedSet

__all__ = ['AccountAnimes']


class AccountAnimes(ReloadedSetSingletonFactory):
class AccountAnimes(ReloadedSet.ReloadedSetSingletonFactory):
"""
A slow loading of an account anime list.
Expand All @@ -31,7 +30,6 @@ def __init__(self, account):
:param account: Which account this anime list is connected to.
:type account: :class:`account.Account`
"""
super().__init__()
self.__account = account
self.__url = self.__URL.format(account.username)

Expand Down Expand Up @@ -61,8 +59,10 @@ def __init__(self, account):
'plantowatch': self.__plan_to_watch,
}

self._is_loaded = False

@property
@load()
@decorators.load
def watching(self) -> frozenset:
"""
:return: The watching list
Expand All @@ -71,7 +71,7 @@ def watching(self) -> frozenset:
return self.__watching

@property
@load()
@decorators.load
def completed(self) -> frozenset:
"""
:return: The completed list
Expand All @@ -80,7 +80,7 @@ def completed(self) -> frozenset:
return self.__completed

@property
@load()
@decorators.load
def on_hold(self) -> frozenset:
"""
:return: The on hold list
Expand All @@ -89,7 +89,7 @@ def on_hold(self) -> frozenset:
return self.__on_hold

@property
@load()
@decorators.load
def dropped(self) -> frozenset:
"""
:return: The dropped list
Expand All @@ -98,7 +98,7 @@ def dropped(self) -> frozenset:
return self.__dropped

@property
@load()
@decorators.load
def plan_to_watch(self) -> frozenset:
"""
:return: The plan to watch list
Expand All @@ -115,7 +115,7 @@ def _values(self) -> frozenset:
return self.watching | self.completed | self.on_hold | self.dropped |\
self.plan_to_watch

def _reload(self):
def reload(self):
"""
reloading data from MAL.
"""
Expand Down
14 changes: 7 additions & 7 deletions pymal/account_objects/account_friends.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@
__contact__ = "Name Of Current Guardian of this file <email@address>"


from reloaded_set import load
from pymal.types.reloaded_set_singleton_factory import ReloadedSetSingletonFactory

from pymal import global_functions
from pymal.types import ReloadedSet
from pymal.decorators import load
from pymal import exceptions


class AccountFriends(ReloadedSetSingletonFactory):
class AccountFriends(ReloadedSet.ReloadedSetSingletonFactory):
"""
A slow load of friend list.
Expand All @@ -23,22 +22,23 @@ def __init__(self, account):
:param account: the account to get the friends.
:type account: :class:`account.Account`
"""
super().__init__()
self.account = account
self.__url = account._main_profile_url + '/friends'

self.__friends = frozenset()

self._is_loaded = False

@property
@load()
@load
def __friends_list(self):
return self.__friends

@property
def _values(self):
return self.__friends_list

def _reload(self):
def reload(self):
"""
:exception FailedToParseError
"""
Expand Down
22 changes: 11 additions & 11 deletions pymal/account_objects/account_mangas.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
__contact__ = "Name Of Current Guardian of this file <email@address>"

from urllib import request
from reloaded_set import load

from pymal.types.reloaded_set_singleton_factory import ReloadedSetSingletonFactory
from pymal.consts import HOST_NAME
from pymal import decorators
from pymal.types import ReloadedSet

__all__ = ['AccountMangas']


class AccountMangas(ReloadedSetSingletonFactory):
class AccountMangas(ReloadedSet.ReloadedSetSingletonFactory):
"""
A slow loading of an account anime list.
Expand All @@ -30,8 +30,6 @@ def __init__(self, account):
:param account: Which account this manga list is connected to.
:type account: :class:`account.Account`
"""
super().__init__()

self.__account = account
self.__url = self.__URL.format(account.username)

Expand Down Expand Up @@ -61,8 +59,10 @@ def __init__(self, account):
'plantoread': self.__plan_to_read,
}

self._is_loaded = False

@property
@load()
@decorators.load
def reading(self) -> frozenset:
"""
:return: The reading list
Expand All @@ -71,7 +71,7 @@ def reading(self) -> frozenset:
return self.__reading

@property
@load()
@decorators.load
def completed(self) -> frozenset:
"""
:return: The completed list
Expand All @@ -80,7 +80,7 @@ def completed(self) -> frozenset:
return self.__completed

@property
@load()
@decorators.load
def on_hold(self) -> frozenset:
"""
:return: The on hold list
Expand All @@ -89,7 +89,7 @@ def on_hold(self) -> frozenset:
return self.__on_hold

@property
@load()
@decorators.load
def dropped(self) -> frozenset:
"""
:return: The dropped list
Expand All @@ -98,7 +98,7 @@ def dropped(self) -> frozenset:
return self.__dropped

@property
@load()
@decorators.load
def plan_to_read(self) -> frozenset:
"""
:return: The plan to read list
Expand All @@ -115,7 +115,7 @@ def _values(self) -> frozenset:
return self.reading | self.completed | self.on_hold | self.dropped |\
self.plan_to_read

def _reload(self):
def reload(self):
"""
reloading data from MAL.
"""
Expand Down
5 changes: 1 addition & 4 deletions pymal/account_objects/my_anime.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,8 @@ class MyAnime(object, metaclass=singleton_factory.SingletonFactory):
__MY_MAL_UPDATE_URL = request.urljoin(
consts.HOST_NAME, 'api/animelist/update/{0:d}.xml')

def __init__(self, mal_id: int, my_mal_id: int, account):
def __init__(self, mal_id: int, my_mal_id, account):
"""
:type mal_id: int or :class:`anime.Anime`
:type my_mal_id: int
:type account: :class:`account.Account`
"""
from pymal import anime
if isinstance(mal_id, anime.Anime):
Expand Down
5 changes: 1 addition & 4 deletions pymal/account_objects/my_manga.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,8 @@ class MyManga(object, metaclass=singleton_factory.SingletonFactory):
__MY_MAL_UPDATE_URL = request.urljoin(
consts.HOST_NAME, 'api/mangalist/update/{0:d}.xml')

def __init__(self, mal_id: int, my_mal_id: int, account):
def __init__(self, mal_id: int, my_mal_id, account):
"""
:type mal_id: int or :class:`manga.Manga`
:type my_mal_id: int
:type account: :class:`account.Account`
"""
from pymal import manga
if isinstance(mal_id, manga.Manga):
Expand Down
Loading

0 comments on commit cdc0f3a

Please sign in to comment.