aboutsummaryrefslogtreecommitdiffstats
path: root/src/bbss
diff options
context:
space:
mode:
authoralyx <alyx@aleteoryx.me>2023-12-24 02:25:26 -0500
committeralyx <alyx@aleteoryx.me>2023-12-24 02:25:26 -0500
commit48f62aba8db8efe3a109837cda52d04b1b9aad5b (patch)
tree7e1c810c48ff6707de7aa044d9ec87e15ae11178 /src/bbss
parente21e42e832e4ac633a9d48f6e30c34a9011008bc (diff)
downloadbbss.py-48f62aba8db8efe3a109837cda52d04b1b9aad5b.tar.gz
bbss.py-48f62aba8db8efe3a109837cda52d04b1b9aad5b.tar.bz2
bbss.py-48f62aba8db8efe3a109837cda52d04b1b9aad5b.zip
Fixed import cycle, began on docs.
Diffstat (limited to 'src/bbss')
-rw-r--r--src/bbss/__init__.py2
-rw-r--r--src/bbss/buttons.py2
-rw-r--r--src/bbss/friends.py10
-rw-r--r--src/bbss/site.py16
-rw-r--r--src/bbss/sizes.py4
5 files changed, 18 insertions, 16 deletions
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