summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruvok2025-01-19 18:31:44 +0100
committeruvok2025-01-19 18:31:44 +0100
commita67f49812cd4de5fce5752eee76152924abd0197 (patch)
tree9b2f49448dbbac03ae346a4f2200253d4b9f275a
parent66bc030cb0294b9d08dc2c5ced262a5a830e1d8e (diff)
Format code
-rw-r--r--hello-fusepy.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/hello-fusepy.py b/hello-fusepy.py
index 2c2d430..7b8cfb5 100644
--- a/hello-fusepy.py
+++ b/hello-fusepy.py
@@ -17,6 +17,7 @@ from fuse import (
)
import urllib.parse
+
class APIChoice(enum.Enum):
ACTIVITYPUB = "ActivityPub"
MASTODON = "Mastodon"
@@ -33,6 +34,7 @@ class Status(object):
self.content = content
self.published = published
+
class StatusProvider:
def load_statuses(self) -> list[Status]:
raise NotImplementedError
@@ -40,6 +42,7 @@ class StatusProvider:
def _fallback_not_found(self):
return [Status("not-found", "User not found\n", "1970-01-01T00:00:00Z")]
+
class ActivityPubStatusProvider(StatusProvider):
def __init__(self, server: str, user: str):
self.server = server
@@ -63,6 +66,7 @@ class ActivityPubStatusProvider(StatusProvider):
if s["type"] == "Create"
]
+
class MastodonStatusProvider(StatusProvider):
def __init__(self, server: str, user: str):
self.server = server
@@ -79,7 +83,9 @@ class MastodonStatusProvider(StatusProvider):
user = res.json()
self.userid = user["id"]
- url = api_url_m_status_template.format(server=self.server, uid=urllib.parse.quote(self.userid))
+ url = api_url_m_status_template.format(
+ server=self.server, uid=urllib.parse.quote(self.userid)
+ )
res = requests.get(url)
if res.status_code == 404:
return self._fallback_not_found()
@@ -93,6 +99,7 @@ class MastodonStatusProvider(StatusProvider):
for s in statuses
]
+
class HelloWorld(Operations, LoggingMixIn):
def __init__(self, api: APIChoice, server: str, user: str):
self.statuses: list[Status] = []
@@ -179,6 +186,7 @@ def parse_arguments():
return args
+
def main(args):
try:
FUSE(
@@ -193,6 +201,6 @@ def main(args):
if __name__ == "__main__":
- #logging.basicConfig(level=logging.DEBUG)
+ logging.basicConfig(level=logging.DEBUG)
args = parse_arguments()
main(args)