From 48f62aba8db8efe3a109837cda52d04b1b9aad5b Mon Sep 17 00:00:00 2001 From: alyx Date: Sun, 24 Dec 2023 02:25:26 -0500 Subject: Fixed import cycle, began on docs. --- src/bbss/__init__.py | 2 ++ src/bbss/buttons.py | 2 +- src/bbss/friends.py | 10 +++++----- src/bbss/site.py | 16 ++++++++-------- src/bbss/sizes.py | 4 ++-- 5 files changed, 18 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/bbss/__init__.py b/src/bbss/__init__.py index 98e45f5..79b2d1d 100644 --- a/src/bbss/__init__.py +++ b/src/bbss/__init__.py @@ -1,2 +1,4 @@ __all__ = ["lists", "buttons", "friends", "site", "sizes", "DEFAULT_PATHS"] DEFAULT_PATHS = ["/BBSS", "/.well-known/BBSS", "/badges", "/buttons", ""] + +from . import lists, buttons, friends, site, sizes diff --git a/src/bbss/buttons.py b/src/bbss/buttons.py index 77ddcf4..1def010 100644 --- a/src/bbss/buttons.py +++ b/src/bbss/buttons.py @@ -1,4 +1,4 @@ -from .lists import BaseListFile, ListFileEntry, parse_listfile +from bbss.lists import BaseListFile, ListFileEntry, parse_listfile from dataclasses import dataclass from typing import Optional, Self from collections.abc import Sequence diff --git a/src/bbss/friends.py b/src/bbss/friends.py index d0aa884..6afdfcd 100644 --- a/src/bbss/friends.py +++ b/src/bbss/friends.py @@ -1,6 +1,6 @@ -from .lists import BaseListFile, ListFileEntry, parse_listfile -from .site import Site -from . import DEFAULT_PATHS +from bbss.lists import BaseListFile, ListFileEntry, parse_listfile +import bbss.site as site +from bbss import DEFAULT_PATHS from dataclasses import dataclass from typing import cast, Optional from collections.abc import Sequence @@ -41,8 +41,8 @@ class FriendListFileEntry(ListFileEntry): return True return False - def get(self) -> Site: - return Site(self.domain, self.path, scheme = self.scheme) + def get(self) -> "site.Site": + return site.Site(self.domain, self.path, scheme = self.scheme) class FriendListFile(BaseListFile[FriendListFileEntry]): def __init__(self, contents: str): diff --git a/src/bbss/site.py b/src/bbss/site.py index 7e8871f..134ee8b 100644 --- a/src/bbss/site.py +++ b/src/bbss/site.py @@ -1,6 +1,6 @@ -from .sizes import SizeListFile -from .friends import FriendListFile -from . import DEFAULT_PATHS +from bbss.sizes import SizeListFile +import bbss.friends as friends +from bbss import DEFAULT_PATHS from typing import Optional from collections.abc import Sequence import requests @@ -25,17 +25,17 @@ class Site: if path is not None: if not check_path(path): - raise Exception("Oh noes there's nothing.") + raise Exception("No BBSS data found at user-supplied location!") else: - self.using_default = False + self.default_path = False else: for potential in DEFAULT_PATHS: if check_path(potential): path = potential - self.using_default = True + self.default_path = True break else: - raise Exception("Oh noes there's nothing(no path specified).") + raise Exception("No BBSS data found at default locations!") self.root = base + path @@ -46,6 +46,6 @@ class Site: self.has_sizes_txt = False self.sizes = SizeListFile("88x31", self.root) - self.friends = FriendListFile.from_url(self.root + "/friends.txt") + self.friends = friends.FriendListFile.from_url(self.root + "/friends.txt") __all__ = ["Site"] diff --git a/src/bbss/sizes.py b/src/bbss/sizes.py index 0451458..f71a94c 100644 --- a/src/bbss/sizes.py +++ b/src/bbss/sizes.py @@ -1,5 +1,5 @@ -from .lists import BaseListFile, ListFileEntry, parse_listfile -from .buttons import ButtonListFile +from bbss.lists import BaseListFile, ListFileEntry, parse_listfile +from bbss.buttons import ButtonListFile from dataclasses import dataclass from typing import Optional, Self from collections.abc import Sequence -- cgit v1.2.3-54-g00ecf