Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor fixs #42

Merged
merged 7 commits into from
Jul 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion esak/character.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class Character:
"""

def __init__(self, **kwargs):
"""Intialize a new Character."""
"""Initialize a new Character."""
for k, v in kwargs.items():
setattr(self, k, v)

Expand Down
2 changes: 1 addition & 1 deletion esak/comic.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class Comic:
"""

def __init__(self, **kwargs):
"""Intialize a new comic."""
"""Initialize a new comic."""
for k, v in kwargs.items():
setattr(self, k, v)

Expand Down
2 changes: 1 addition & 1 deletion esak/creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class Creator:
"""

def __init__(self, **kwargs):
"""Intialize a new Creator."""
"""Initialize a new Creator."""
for k, v in kwargs.items():
setattr(self, k, v)

Expand Down
2 changes: 1 addition & 1 deletion esak/dates.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Dates:
"""

def __init__(self, on_sale=None, foc=None, unlimited=None, **kwargs):
"""Intialize a new date."""
"""Initialize a new date."""
self.on_sale = on_sale
self.foc = foc
self.unlimited = unlimited
Expand Down
2 changes: 1 addition & 1 deletion esak/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class Events:
"""

def __init__(self, **kwargs) -> None:
"""Intialize a new event."""
"""Initialize a new event."""
for k, v in kwargs.items():
setattr(self, k, v)

Expand Down
2 changes: 1 addition & 1 deletion esak/prices.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Prices:
"""

def __init__(self, print=None, digital=None, **kwargs):
"""Intialize a new price."""
"""Initialize a new price."""
self.print = print
self.digital = digital
self.unknown = kwargs
Expand Down
2 changes: 1 addition & 1 deletion esak/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class Series:
"""

def __init__(self, **kwargs):
"""Intialize a new series."""
"""Initialize a new series."""
for k, v in kwargs.items():
setattr(self, k, v)

Expand Down
17 changes: 7 additions & 10 deletions esak/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ class Session:
The public_key for authentication with Marvel
private_key: str
The private_key used for authentication with Marvel
SqliteCache: optional, SqliteCache
SqliteCache to use
sqlite_cache.SqliteCache: optional, sqlite_cache.SqliteCache
sqlite_cache.SqliteCache to use

Returns
-------
Expand All @@ -52,7 +52,7 @@ def __init__(
private_key: str,
cache: sqlite_cache.SqliteCache | None = None,
):
"""Intialize a new Session."""
"""Initialize a new Session."""
self.header = {
"User-Agent": f"esak/{__version__} ({platform.system()}; {platform.release()})"
}
Expand All @@ -61,12 +61,13 @@ def __init__(
self.cache = cache
self.api_url = "http://gateway.marvel.com:80/v1/public/{}"

def _create_cached_params(self, params: dict[str, Any]) -> str:
@staticmethod
def _create_cached_params(params: dict[str, Any]) -> str:
# Generate part of cache key before hash, apikey and timestamp added
cache_params = ""
if params:
orderedParams = OrderedDict(sorted(params.items(), key=lambda t: t[0]))
cache_params = f"?{urllib.parse.urlencode(orderedParams)}"
ordered_params = OrderedDict(sorted(params.items(), key=lambda t: t[0]))
cache_params = f"?{urllib.parse.urlencode(ordered_params)}"
return cache_params

def _create_auth_hash(self, now_string: str) -> str:
Expand Down Expand Up @@ -539,8 +540,6 @@ def creators_list(self, params: dict[str, Any] | None = None) -> cr.CreatorsList

Parameters
----------
_id: int
The creator id.
params: dict, optional
Parameters to add to the request.

Expand Down Expand Up @@ -676,8 +675,6 @@ def characters_list(self, params: dict[str, Any] | None = None) -> ch.Characters

Parameters
----------
_id: int
The character id.
params: dict, optional
Parameters to add to the request.

Expand Down
2 changes: 1 addition & 1 deletion esak/sqlite_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class SqliteCache:
"""

def __init__(self, db_name: str = "esak_cache.db", expire: int | None = None) -> None:
"""Intialize a new SqliteCache."""
"""Initialize a new SqliteCache."""
self.expire = expire
self.con = sqlite3.connect(db_name)
self.cur = self.con.cursor()
Expand Down
2 changes: 1 addition & 1 deletion esak/stories.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class Stories:
"""

def __init__(self, **kwargs) -> None:
"""Intialize a new story."""
"""Initialize a new story."""
for k, v in kwargs.items():
setattr(self, k, v)

Expand Down
2 changes: 1 addition & 1 deletion esak/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Summary:
"""

def __init__(self, id=None, name=None, resource_uri=None, type=None, role=None, **kwargs):
"""Intialize a new Summary."""
"""Initialize a new Summary."""
self.id = id
self.name = name
self.resource_uri = resource_uri
Expand Down
2 changes: 1 addition & 1 deletion esak/text_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class TextObject:
"""

def __init__(self, **kwargs):
"""Intialize a new TextObjects."""
"""Initialize a new TextObjects."""
for k, v in kwargs.items():
setattr(self, k, v)

Expand Down
2 changes: 1 addition & 1 deletion esak/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def __init__(
detail=None,
**kwargs,
):
"""Intialize a new url."""
"""Initialize a new url."""
self.digital_purchase_date = digital_purchase_date
self.foc_date = foc_date
self.onsale_date = onsale_date
Expand Down
Loading