Move to pynyaata2

This commit is contained in:
Michel Roux 2023-06-04 17:53:29 +02:00
parent 30c05d9eac
commit 1a40f32425
35 changed files with 460 additions and 671 deletions

1010
poetry.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +0,0 @@
from pynyaata import run
run()

View File

@ -1,28 +1,10 @@
import asyncio import asyncio
from datetime import datetime from datetime import datetime
from os import getenv
from flask import Flask, redirect, render_template, request, url_for from flask import Flask, redirect, render_template, request, url_for
from pynyaata.bridge import search_all from pynyaata2.bridge import search_all
from pynyaata.translations import current_lang, i18n from pynyaata2.translations import current_lang, i18n
from sentry_sdk import init
from sentry_sdk.integrations.asyncio import AsyncioIntegration
from sentry_sdk.integrations.flask import FlaskIntegration
from sentry_sdk.integrations.redis import RedisIntegration
SENTRY_DNS = getenv("SENTRY_DSN")
if SENTRY_DNS:
init(
SENTRY_DNS,
integrations=[
AsyncioIntegration(),
FlaskIntegration(),
RedisIntegration(),
],
)
app = Flask(__name__) app = Flask(__name__)

3
pynyaata2/__main__.py Normal file
View File

@ -0,0 +1,3 @@
from pynyaata2 import run
run()

View File

@ -1,10 +1,10 @@
from asyncio import create_task, gather from asyncio import create_task, gather
from typing import List from typing import List
from pynyaata.bridge.animeultime import AnimeUltime from pynyaata2.bridge.animeultime import AnimeUltime
from pynyaata.bridge.nyaa import EraiRaws, Nyaa from pynyaata2.bridge.nyaa import EraiRaws, Nyaa
from pynyaata.bridge.yggtorrent import YggAnimation, YggTorrent from pynyaata2.bridge.yggtorrent import YggAnimation, YggTorrent
from pynyaata.types import Bridge, RemoteFile from pynyaata2.types import Bridge, RemoteFile
BRIDGES: List[Bridge] = [ BRIDGES: List[Bridge] = [

View File

@ -4,9 +4,9 @@ from typing import List
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
from pydantic import HttpUrl, parse_obj_as from pydantic import HttpUrl, parse_obj_as
from pynyaata.cache import cache_data from pynyaata2.cache import cache_data
from pynyaata.filters import filter_data from pynyaata2.filters import filter_data
from pynyaata.types import Bridge, Color, RemoteFile, async_wrap from pynyaata2.types import Bridge, Color, RemoteFile, async_wrap
import requests import requests

View File

@ -6,9 +6,9 @@ from urllib import parse
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
from pydantic import HttpUrl, parse_obj_as from pydantic import HttpUrl, parse_obj_as
from pynyaata.cache import cache_data from pynyaata2.cache import cache_data
from pynyaata.filters import filter_data from pynyaata2.filters import filter_data
from pynyaata.types import Bridge, Color, RemoteFile, async_wrap from pynyaata2.types import Bridge, Color, RemoteFile, async_wrap
import requests import requests

View File

@ -5,16 +5,16 @@ from urllib import parse
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
from pydantic import HttpUrl, parse_obj_as from pydantic import HttpUrl, parse_obj_as
from pynyaata.cache import cache_data from pynyaata2.cache import cache_data
from pynyaata.filters import filter_data from pynyaata2.filters import filter_data
from pynyaata.session import requests from pynyaata2.session import requests
from pynyaata.types import Bridge, Color, RemoteFile, async_wrap from pynyaata2.types import Bridge, Color, RemoteFile, async_wrap
from requests import HTTPError from requests import HTTPError
YGG_IP = getenv("YGG_IP") YGG_IP = getenv("YGG_IP")
YGG_DOMAIN = "www6.yggtorrent.lol" YGG_DOMAIN = "www3.yggtorrent.do"
class YggTorrent(Bridge): class YggTorrent(Bridge):

View File

@ -3,8 +3,8 @@ from logging import error
from os import getenv from os import getenv
from typing import Optional from typing import Optional
from pynyaata.cache.simple import SimpleCache from pynyaata2.cache.simple import SimpleCache
from pynyaata.types import Bridge, Cache from pynyaata2.types import Bridge, Cache
from redis import RedisError from redis import RedisError
@ -15,7 +15,7 @@ client: Cache = SimpleCache()
if REDIS_URL: if REDIS_URL:
try: try:
from pynyaata.cache.redis import RedisCache from pynyaata2.cache.redis import RedisCache
client = RedisCache() client = RedisCache()
except RedisError as e: except RedisError as e:

View File

@ -2,7 +2,7 @@ from json import dumps, loads
from os import getenv from os import getenv
from typing import List, Optional from typing import List, Optional
from pynyaata.types import Cache, RemoteFile from pynyaata2.types import Cache, RemoteFile
from redis import ConnectionError, Redis from redis import ConnectionError, Redis

View File

@ -2,7 +2,7 @@ from datetime import datetime, timedelta
from os import getenv from os import getenv
from typing import Dict, List, Optional, Tuple from typing import Dict, List, Optional, Tuple
from pynyaata.types import Cache, RemoteFile from pynyaata2.types import Cache, RemoteFile
CACHE_TIMEOUT = int(getenv("CACHE_TIMEOUT", 60 * 60)) CACHE_TIMEOUT = int(getenv("CACHE_TIMEOUT", 60 * 60))

View File

@ -2,7 +2,7 @@ from functools import wraps
from os import getenv from os import getenv
from typing import List from typing import List
from pynyaata.types import Color, RemoteFile from pynyaata2.types import Color, RemoteFile
def duplicate(remotes: List[RemoteFile]) -> List[RemoteFile]: def duplicate(remotes: List[RemoteFile]) -> List[RemoteFile]:

View File

Before

Width:  |  Height:  |  Size: 434 KiB

After

Width:  |  Height:  |  Size: 434 KiB

View File

@ -1,5 +1,5 @@
[tool.poetry] [tool.poetry]
name = "pynyaata" name = "pynyaata2"
version = "2.0.0" version = "2.0.0"
description = "π 😼た, Xéfir's personal anime torrent search engine" description = "π 😼た, Xéfir's personal anime torrent search engine"
authors = ["Xéfir Destiny"] authors = ["Xéfir Destiny"]
@ -14,30 +14,29 @@ pynyaata = 'pynyaata:run'
[tool.poetry.dependencies] [tool.poetry.dependencies]
python = "^3.7" python = "^3.8.1"
beautifulsoup4 = "^4.12.0" beautifulsoup4 = "^4.12.2"
charset-normalizer = "^3.1.0" charset-normalizer = "^3.1.0"
flask = "^2.2.3" flask = "^2.3.2"
pydantic = "^1.10.7" pydantic = "^1.10.8"
redis = "^4.5.3" redis = "^4.5.5"
requests = "^2.28.2" requests = "^2.31.0"
sentry-sdk = {extras = ["flask"], version = "^1.17.0"}
[tool.poetry.group.dev.dependencies] [tool.poetry.group.dev.dependencies]
black = "^23.1.0" black = "^23.3.0"
flake8-alphabetize = "^0.0.19" flake8-alphabetize = "^0.0.21"
flake8-black = "^0.3.6" flake8-black = "^0.3.6"
mypy = "^1.1.1" mypy = "^1.3.0"
pytest = "^7.2.2" pytest = "^7.3.1"
pytest-asyncio = "^0.21.0" pytest-asyncio = "^0.21.0"
requests-mock = "^1.10.0" requests-mock = "^1.10.0"
types-beautifulsoup4 = "^4.12.0.0" types-beautifulsoup4 = "^4.12.0.5"
types-redis = "^4.5.2.0" types-redis = "^4.5.5.2"
types-requests = "^2.28.11.16" types-requests = "^2.31.0.1"
djlint = "^1.9.3" djlint = "^1.30.2"
flake8 = "^3.9.2" flake8 = "^6.0.0"
pydantic-factories = "^1.15.0" pydantic-factories = "^1.17.3"
[build-system] [build-system]

View File

@ -1,8 +1,8 @@
# flake8: noqa: E501 # flake8: noqa: E501
from datetime import datetime, timedelta from datetime import datetime, timedelta
from pynyaata.bridge.animeultime import AnimeUltime from pynyaata2.bridge.animeultime import AnimeUltime
from pynyaata.types import RemoteFile from pynyaata2.types import RemoteFile
from pytest import mark from pytest import mark
import requests import requests

View File

@ -1,8 +1,8 @@
# flake8: noqa: E501 # flake8: noqa: E501
from typing import List from typing import List
from pynyaata.bridge.nyaa import Nyaa, EraiRaws from pynyaata2.bridge.nyaa import Nyaa, EraiRaws
from pynyaata.types import Color, RemoteFile from pynyaata2.types import Color, RemoteFile
from pytest import mark from pytest import mark
import requests import requests

View File

@ -1,7 +1,7 @@
from pydantic_factories import ModelFactory from pydantic_factories import ModelFactory
from pynyaata.cache import client from pynyaata2.cache import client
from pynyaata.types import RemoteFile from pynyaata2.types import RemoteFile
class RemoteFileFactory(ModelFactory[RemoteFile]): class RemoteFileFactory(ModelFactory[RemoteFile]):

View File

@ -1,7 +1,7 @@
from pydantic_factories import ModelFactory from pydantic_factories import ModelFactory
from pynyaata.filters import blacklist, danger, duplicate, inactive, trusted from pynyaata2.filters import blacklist, danger, duplicate, inactive, trusted
from pynyaata.types import Color, RemoteFile from pynyaata2.types import Color, RemoteFile
from pytest import MonkeyPatch from pytest import MonkeyPatch