Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Commit

Permalink
Merge pull request #15 from oliviacrain/olivia/fix/cleanup-imports
Browse files Browse the repository at this point in the history
Remove unused imports and sort used imports
  • Loading branch information
valknight authored Nov 8, 2022
2 parents 1267e33 + 38b9bb0 commit b604a39
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 22 deletions.
4 changes: 1 addition & 3 deletions cohost/models/block.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@

from fileinput import filename
import requests

from cohost.network import fetch, generate_login_cookies
import os


class Block:
Expand Down
4 changes: 2 additions & 2 deletions cohost/models/notification.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions cohost/models/project.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down
11 changes: 5 additions & 6 deletions cohost/models/user.py
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -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']:
Expand Down
4 changes: 2 additions & 2 deletions cohost/network.py
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
10 changes: 5 additions & 5 deletions example.py
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit b604a39

Please sign in to comment.