diff --git a/cohost/models/block.py b/cohost/models/block.py index f599ec6..fedb41f 100644 --- a/cohost/models/block.py +++ b/cohost/models/block.py @@ -1,8 +1,6 @@ - -from fileinput import filename import requests + from cohost.network import fetch, generate_login_cookies -import os class Block: diff --git a/cohost/models/notification.py b/cohost/models/notification.py index 472db20..137fb25 100644 --- a/cohost/models/notification.py +++ b/cohost/models/notification.py @@ -51,9 +51,9 @@ def __str__(self) -> str: def buildFromNotifList(notificationsApiResp: dict, user): - from cohost.models.user import User - from cohost.models.post import Post from cohost.models.comment import Comment as CommentModel + from cohost.models.post import Post + from cohost.models.user import User u = user # type: User user = u # this whole shitshow is to get intellisense working without circular imports # I Love Python diff --git a/cohost/models/project.py b/cohost/models/project.py index b446dc6..55c4e60 100644 --- a/cohost/models/project.py +++ b/cohost/models/project.py @@ -1,6 +1,7 @@ -from cohost.network import fetchTrpc, fetch, generate_login_cookies +from cohost.models.block import AttachmentBlock from cohost.models.post import Post -from cohost.models.block import Block, AttachmentBlock +from cohost.network import fetch, generate_login_cookies + # from cohost.models.user import User diff --git a/cohost/models/user.py b/cohost/models/user.py index e566153..5e5a47c 100644 --- a/cohost/models/user.py +++ b/cohost/models/user.py @@ -1,10 +1,9 @@ -from distutils.command.build import build -from re import U +import base64 +from hashlib import pbkdf2_hmac + +from cohost.models.notification import buildFromNotifList from cohost.models.project import EditableProject from cohost.network import fetch, fetchTrpc, generate_login_cookies -from cohost.models.notification import buildFromNotifList -from hashlib import pbkdf2_hmac -import base64 class User: @@ -126,7 +125,7 @@ def getProject(self, handle: str) -> EditableProject: return None def resolveSecondaryProject(self, projectData): - from cohost.models.project import Project, EditableProject + from cohost.models.project import EditableProject, Project editableProjects = self.editedProjects for project in editableProjects: if project.projectId == projectData['projectId']: diff --git a/cohost/network.py b/cohost/network.py index b985ba4..3a84ca5 100644 --- a/cohost/network.py +++ b/cohost/network.py @@ -1,8 +1,8 @@ -from distutils.log import debug -import requests import logging import time +import requests + l = logging.getLogger(__name__) l.setLevel(logging.DEBUG) API_BASE = "https://cohost.org/api/v1" diff --git a/example.py b/example.py index edf54cf..a183a67 100644 --- a/example.py +++ b/example.py @@ -1,9 +1,9 @@ -from cohost.models.user import User -from cohost.models.post import Post -from cohost.models.block import AttachmentBlock, MarkdownBlock -from cohost.models.project import Project, EditableProject import os -import json + +from cohost.models.block import AttachmentBlock, MarkdownBlock +from cohost.models.user import User + + def main(): cookie = os.environ.get('COHOST_COOKIE') if cookie is None: diff --git a/setup.py b/setup.py index 97f9f9f..92959c7 100755 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 - import os -from setuptools import setup, find_packages + +from setuptools import find_packages, setup # get key package details from py_pkg/__version__.py about = {} # type: ignore