Skip to content

Commit

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

Feature/split reloaded anime and manga
  • Loading branch information
tomerghelber committed Oct 8, 2014
2 parents 3edbb6f + 98bdc25 commit 7f55017
Show file tree
Hide file tree
Showing 76 changed files with 2,365 additions and 4,224 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ 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: 1 addition & 3 deletions pymal/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
__authors__ = ""
__copyright__ = "(c) 2014, pymal"
__authors__ = "pymal-developers"
__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,14 +5,15 @@

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(ReloadedSet.ReloadedSetSingletonFactory):
class AccountAnimes(ReloadedSetSingletonFactory):
"""
A slow loading of an account anime list.
Expand All @@ -30,6 +31,7 @@ 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 @@ -59,10 +61,8 @@ def __init__(self, account):
'plantowatch': self.__plan_to_watch,
}

self._is_loaded = False

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

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

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

@property
@decorators.load
@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,13 +4,14 @@
__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(ReloadedSet.ReloadedSetSingletonFactory):
class AccountFriends(ReloadedSetSingletonFactory):
"""
A slow load of friend list.
Expand All @@ -22,23 +23,22 @@ 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(ReloadedSet.ReloadedSetSingletonFactory):
class AccountMangas(ReloadedSetSingletonFactory):
"""
A slow loading of an account anime list.
Expand All @@ -30,6 +30,8 @@ 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 @@ -59,10 +61,8 @@ def __init__(self, account):
'plantoread': self.__plan_to_read,
}

self._is_loaded = False

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

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

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

@property
@decorators.load
@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: 4 additions & 1 deletion pymal/account_objects/my_anime.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,11 @@ 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, account):
def __init__(self, mal_id: int, my_mal_id: int, 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: 4 additions & 1 deletion pymal/account_objects/my_manga.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,11 @@ 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, account):
def __init__(self, mal_id: int, my_mal_id: int, 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 7f55017

Please sign in to comment.