Restructure crawling and auth related modules

This commit is contained in:
Joscha 2021-05-23 19:16:42 +02:00
parent bbf9f8f130
commit 2fdf24495b
13 changed files with 29 additions and 33 deletions

View File

@ -1,8 +1,8 @@
from configparser import SectionProxy
from typing import Callable, Dict
from ..authenticator import Authenticator, AuthSection
from ..config import Config
from .authenticator import Authenticator, AuthSection
from .simple import SimpleAuthenticator, SimpleAuthSection
from .tfa import TfaAuthenticator

View File

@ -1,7 +1,7 @@
from abc import ABC, abstractmethod
from typing import Tuple
from .config import Config, Section
from ..config import Config, Section
class AuthLoadException(Exception):

View File

@ -1,9 +1,9 @@
from typing import Optional, Tuple
from ..authenticator import Authenticator, AuthException, AuthSection
from ..config import Config
from ..logging import log
from ..utils import agetpass, ainput
from .authenticator import Authenticator, AuthException, AuthSection
class SimpleAuthSection(AuthSection):

View File

@ -1,9 +1,9 @@
from typing import Tuple
from ..authenticator import Authenticator, AuthException, AuthSection
from ..config import Config
from ..logging import log
from ..utils import ainput
from .authenticator import Authenticator, AuthException, AuthSection
class TfaAuthenticator(Authenticator):

View File

@ -1,11 +1,11 @@
from configparser import SectionProxy
from typing import Callable, Dict
from ..authenticator import Authenticator
from ..auth import Authenticator
from ..config import Config
from ..crawler import Crawler
from .crawler import Crawler, CrawlError # noqa: F401
from .ilias import KitIliasWebCrawler, KitIliasWebCrawlerSection
from .local import LocalCrawler, LocalCrawlerSection
from .local_crawler import LocalCrawler, LocalCrawlerSection
CrawlerConstructor = Callable[[
str, # Name (without the "crawl:" prefix)

View File

@ -6,14 +6,14 @@ from typing import Any, Awaitable, Callable, Dict, List, Optional, Sequence, Tup
from rich.markup import escape
from .authenticator import Authenticator
from .config import Config, Section
from .limiter import Limiter
from .logging import ProgressBar, log
from .output_dir import FileSink, FileSinkToken, OnConflict, OutputDirectory, OutputDirError, Redownload
from .report import MarkConflictError, MarkDuplicateError
from .transformer import Transformer
from .utils import ReusableAsyncContextManager, fmt_path
from ..auth import Authenticator
from ..config import Config, Section
from ..limiter import Limiter
from ..logging import ProgressBar, log
from ..output_dir import FileSink, FileSinkToken, OnConflict, OutputDirectory, OutputDirError, Redownload
from ..report import MarkConflictError, MarkDuplicateError
from ..transformer import Transformer
from ..utils import ReusableAsyncContextManager, fmt_path
class CrawlWarning(Exception):

View File

@ -4,11 +4,11 @@ from typing import Optional
import aiohttp
from .config import Config
from ..config import Config
from ..logging import log
from ..utils import fmt_real_path
from ..version import NAME, VERSION
from .crawler import Crawler, CrawlerSection
from .logging import log
from .utils import fmt_real_path
from .version import NAME, VERSION
class HttpCrawler(Crawler):

View File

@ -6,15 +6,13 @@ import aiohttp
from aiohttp import hdrs
from bs4 import BeautifulSoup, Tag
from PFERD.authenticators import Authenticator
from PFERD.config import Config
from PFERD.crawler import CrawlError, CrawlerSection, CrawlWarning, anoncritical
from PFERD.http_crawler import HttpCrawler
from PFERD.logging import ProgressBar, log
from PFERD.output_dir import FileSink, Redownload
from PFERD.utils import soupify, url_set_query_param
from ...utils import fmt_path
from ...auth import Authenticator
from ...config import Config
from ...logging import ProgressBar, log
from ...output_dir import FileSink, Redownload
from ...utils import fmt_path, soupify, url_set_query_param
from ..crawler import CrawlError, CrawlerSection, CrawlWarning, anoncritical
from ..http_crawler import HttpCrawler
from .file_templates import link_template_plain, link_template_rich
from .kit_ilias_html import IliasElementType, IliasPage, IliasPageElement

View File

@ -5,7 +5,7 @@ from pathlib import Path, PurePath
from typing import Optional
from ..config import Config
from ..crawler import Crawler, CrawlerSection, anoncritical
from .crawler import Crawler, CrawlerSection, anoncritical
class LocalCrawlerSection(CrawlerSection):

View File

@ -2,11 +2,9 @@ from typing import Dict, List, Optional
from rich.markup import escape
from .authenticator import Authenticator
from .authenticators import AUTHENTICATORS
from .auth import AUTHENTICATORS, Authenticator
from .config import Config, ConfigOptionError
from .crawler import Crawler, CrawlError
from .crawlers import CRAWLERS
from .crawl import CRAWLERS, Crawler, CrawlError
from .logging import log