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
from datetime import datetime
from os import getenv
from flask import Flask, redirect, render_template, request, url_for
from pynyaata.bridge import search_all
from pynyaata.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(),
],
)
from pynyaata2.bridge import search_all
from pynyaata2.translations import current_lang, i18n
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 typing import List
from pynyaata.bridge.animeultime import AnimeUltime
from pynyaata.bridge.nyaa import EraiRaws, Nyaa
from pynyaata.bridge.yggtorrent import YggAnimation, YggTorrent
from pynyaata.types import Bridge, RemoteFile
from pynyaata2.bridge.animeultime import AnimeUltime
from pynyaata2.bridge.nyaa import EraiRaws, Nyaa
from pynyaata2.bridge.yggtorrent import YggAnimation, YggTorrent
from pynyaata2.types import Bridge, RemoteFile
BRIDGES: List[Bridge] = [

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@ from datetime import datetime, timedelta
from os import getenv
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))

View File

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

View File

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

View File

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

View File

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

View File

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