Skip to content

Commit

Permalink
chore(style): Black style
Browse files Browse the repository at this point in the history
  • Loading branch information
JuanjoSalvador committed Jul 18, 2024
1 parent f4b4e27 commit a68eee0
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2017 Juanjo Salvador
Copyright 2024 Juanjo Salvador

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
1 change: 1 addition & 0 deletions nyaapy/anime_site.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from nyaapy import torrent
from nyaapy.parser import parse_nyaa, parse_single, parse_nyaa_rss


class AnimeTorrentSite:
SITE = torrent.TorrentSite.NYAASI
URL = "https://nyaa.si"
Expand Down
3 changes: 2 additions & 1 deletion nyaapy/magnet.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import urllib
from urllib.parse import urlencode


def magnet_builder(info_hash, title):
"""
Generates a magnet link using the info_hash and title of a given file.
Expand All @@ -19,4 +20,4 @@ def magnet_builder(info_hash, title):
for tracker in known_trackers:
magnet_link += f"&{urlencode({'tr': tracker})}"

return magnet_link
return magnet_link
2 changes: 1 addition & 1 deletion nyaapy/nyaasi/nyaa.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

class Nyaa(AnimeTorrentSite):
SITE = TorrentSite.NYAASI
URL = "https://nyaa.si"
URL = "https://nyaa.si"
3 changes: 2 additions & 1 deletion nyaapy/nyaasi/sukebei.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from nyaapy.anime_site import AnimeTorrentSite
from nyaapy.torrent import TorrentSite


class SukebeiNyaa(AnimeTorrentSite):
SITE = TorrentSite.SUKEBEINYAASI
URL = "https://sukebei.nyaa.si"
URL = "https://sukebei.nyaa.si"
1 change: 1 addition & 0 deletions nyaapy/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from nyaapy.magnet import magnet_builder
from nyaapy.torrent import TorrentSite


def nyaa_categories(b):
c = b.replace("?c=", "")
cats = c.split("_")
Expand Down
6 changes: 4 additions & 2 deletions nyaapy/torrent.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,20 @@ def json_to_class(data):
else:
return Torrent(data)


# This deals with converting the dict to an object
class Torrent(object):
def __init__(self, my_dict):
for key in my_dict:
setattr(self, key, my_dict[key])


class TorrentSite(Enum):
"""
Contains torrent sites
"""

NYAASI = "https://nyaa.si"
SUKEBEINYAASI = "https://sukebei.nyaa.si"
NYAALAND = "https://nyaa.land"

NYAALAND = "https://nyaa.land"
5 changes: 3 additions & 2 deletions tests/integration/test_nyaasi.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from nyaapy.nyaasi.nyaa import Nyaa
from nyaapy.torrent import Torrent


def test_nyaa_last_uploads():
request = Nyaa.last_uploads(number_of_results=10)
torrent = request[0]
Expand All @@ -17,7 +18,7 @@ def test_nyaa_search():


def test_nyaa_get_single():
request = Nyaa.get(view_id='1847113')
request = Nyaa.get(view_id="1847113")

assert isinstance(request, Torrent) == True

Expand All @@ -27,4 +28,4 @@ def test_nyaa_get_from_user():
torrent = request[0]

assert isinstance(torrent, Torrent) == True
assert len(request) <= 75
assert len(request) <= 75

0 comments on commit a68eee0

Please sign in to comment.