Skip to content

Commit

Permalink
chore: reorder imports
Browse files Browse the repository at this point in the history
  • Loading branch information
gjedlicska committed Nov 27, 2023
1 parent 4dc1481 commit bf3ab7d
Show file tree
Hide file tree
Showing 31 changed files with 109 additions and 125 deletions.
16 changes: 8 additions & 8 deletions src/speckle_automate/automation_context.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
"""This module provides an abstraction layer above the Speckle Automate runtime."""
import time
from dataclasses import dataclass, field
from pathlib import Path
import time
from typing import Any, Dict, List, Optional, Tuple, Union

import httpx
from gql import gql
from specklepy.api import operations
from specklepy.api.client import SpeckleClient
from specklepy.core.api.models import Branch
from specklepy.objects import Base
from specklepy.transports.memory import MemoryTransport
from specklepy.transports.server import ServerTransport
from specklepy.logging.exceptions import SpeckleException

from speckle_automate.schema import (
AutomateBase,
Expand All @@ -22,6 +15,13 @@
ObjectResultLevel,
ResultCase,
)
from specklepy.api import operations
from specklepy.api.client import SpeckleClient
from specklepy.core.api.models import Branch
from specklepy.logging.exceptions import SpeckleException
from specklepy.objects import Base
from specklepy.transports.memory import MemoryTransport
from specklepy.transports.server import ServerTransport


@dataclass
Expand Down
3 changes: 2 additions & 1 deletion src/speckle_automate/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
import secrets
import string

from specklepy.api.client import SpeckleClient
from gql import gql

from specklepy.api.client import SpeckleClient


def register_new_automation(
speckle_client: SpeckleClient,
Expand Down
5 changes: 2 additions & 3 deletions src/specklepy/api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from specklepy.api.credentials import Account, get_account_from_token
from specklepy.api.resources import (
user,
active_user,
branch,
commit,
Expand All @@ -14,12 +13,12 @@
server,
stream,
subscriptions,
user,
)
from specklepy.core.api.client import SpeckleClient as CoreSpeckleClient
from specklepy.logging import metrics
from specklepy.logging.exceptions import SpeckleException, SpeckleWarning

from specklepy.core.api.client import SpeckleClient as CoreSpeckleClient


class SpeckleClient(CoreSpeckleClient):
"""
Expand Down
15 changes: 7 additions & 8 deletions src/specklepy/api/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,19 @@
from pydantic import BaseModel, Field # pylint: disable=no-name-in-module

from specklepy.api.models import ServerInfo
from specklepy.core.helpers import speckle_path_provider
from specklepy.logging import metrics
from specklepy.logging.exceptions import SpeckleException
from specklepy.transports.sqlite import SQLiteTransport

# following imports seem to be unnecessary, but they need to stay
# to not break the scripts using these functions as non-core
from specklepy.core.api.credentials import StreamWrapper # deprecated
from specklepy.core.api.credentials import Account, UserInfo
from specklepy.core.api.credentials import (
Account,
UserInfo,
StreamWrapper, # deprecated
get_local_accounts as core_get_local_accounts,
get_account_from_token as core_get_account_from_token,
)
from specklepy.core.api.credentials import get_local_accounts as core_get_local_accounts
from specklepy.core.helpers import speckle_path_provider
from specklepy.logging import metrics
from specklepy.logging.exceptions import SpeckleException
from specklepy.transports.sqlite import SQLiteTransport


def get_local_accounts(base_path: Optional[str] = None) -> List[Account]:
Expand Down
52 changes: 26 additions & 26 deletions src/specklepy/api/host_applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,40 @@
# following imports seem to be unnecessary, but they need to stay
# to not break the scripts using these functions as non-core
from specklepy.core.api.host_applications import (
HostApplication,
HostAppVersion,
get_host_app_from_string,
_app_name_host_app_mapping,
RHINO,
GRASSHOPPER,
REVIT,
DYNAMO,
UNITY,
GSA,
CIVIL,
ARCGIS,
ARCHICAD,
AUTOCAD,
MICROSTATION,
OPENROADS,
OPENRAIL,
OPENBUILDINGS,
ETABS,
SAP2000,
BLENDER,
CIVIL,
CSIBRIDGE,
SAFE,
TEKLASTRUCTURES,
DXF,
DYNAMO,
ETABS,
EXCEL,
UNREAL,
GRASSHOPPER,
GSA,
MICROSTATION,
NET,
OPENBUILDINGS,
OPENRAIL,
OPENROADS,
OTHER,
POWERBI,
BLENDER,
PYTHON,
QGIS,
ARCGIS,
REVIT,
RHINO,
SAFE,
SAP2000,
SKETCHUP,
ARCHICAD,
TEKLASTRUCTURES,
TOPSOLID,
PYTHON,
NET,
OTHER,
UNITY,
UNREAL,
HostApplication,
HostAppVersion,
_app_name_host_app_mapping,
get_host_app_from_string,
)

if __name__ == "__main__":
Expand Down
14 changes: 7 additions & 7 deletions src/specklepy/api/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@
# following imports seem to be unnecessary, but they need to stay
# to not break the scripts using these functions as non-core
from specklepy.core.api.models import (
Activity,
ActivityCollection,
Branch,
Branches,
Collaborator,
Commit,
Commits,
LimitedUser,
Object,
Branch,
Branches,
PendingStreamCollaborator,
ServerInfo,
Stream,
Streams,
User,
LimitedUser,
PendingStreamCollaborator,
Activity,
ActivityCollection,
ServerInfo,
)
11 changes: 4 additions & 7 deletions src/specklepy/api/operations.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
from typing import List, Optional

from specklepy.core.api.operations import deserialize as core_deserialize
from specklepy.core.api.operations import receive as _untracked_receive
from specklepy.core.api.operations import send as core_send
from specklepy.core.api.operations import serialize as core_serialize
from specklepy.logging import metrics
from specklepy.logging.exceptions import SpeckleException
from specklepy.objects.base import Base
from specklepy.serialization.base_object_serializer import BaseObjectSerializer
from specklepy.transports.abstract_transport import AbstractTransport
from specklepy.transports.sqlite import SQLiteTransport

from specklepy.core.api.operations import (
send as core_send,
receive as _untracked_receive,
serialize as core_serialize,
deserialize as core_deserialize,
)


def send(
base: Base,
Expand Down
8 changes: 4 additions & 4 deletions src/specklepy/api/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
from graphql import DocumentNode

from specklepy.api.credentials import Account

# following imports seem to be unnecessary, but they need to stay
# to not break the scripts using these functions as non-core
from specklepy.core.api.resource import ResourceBase as CoreResourceBase
from specklepy.logging.exceptions import (
GraphQLException,
SpeckleException,
Expand All @@ -14,10 +18,6 @@
from specklepy.serialization.base_object_serializer import BaseObjectSerializer
from specklepy.transports.sqlite import SQLiteTransport

# following imports seem to be unnecessary, but they need to stay
# to not break the scripts using these functions as non-core
from specklepy.core.api.resource import ResourceBase as CoreResourceBase


class ResourceBase(CoreResourceBase):
def __init__(
Expand Down
3 changes: 1 addition & 2 deletions src/specklepy/api/resources/active_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@

from specklepy.api.models import ActivityCollection, PendingStreamCollaborator, User
from specklepy.api.resource import ResourceBase
from specklepy.core.api.resources.active_user import Resource as CoreResource
from specklepy.logging import metrics
from specklepy.logging.exceptions import SpeckleException

from specklepy.core.api.resources.active_user import Resource as CoreResource


class Resource(CoreResource):
"""API Access class for users"""
Expand Down
3 changes: 1 addition & 2 deletions src/specklepy/api/resources/branch.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@

from specklepy.api.models import Branch
from specklepy.api.resource import ResourceBase
from specklepy.logging import metrics

from specklepy.core.api.resources.branch import Resource as CoreResource
from specklepy.logging import metrics


class Resource(CoreResource):
Expand Down
3 changes: 1 addition & 2 deletions src/specklepy/api/resources/commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@

from specklepy.api.models import Commit
from specklepy.api.resource import ResourceBase
from specklepy.logging import metrics

from specklepy.core.api.resources.commit import Resource as CoreResource
from specklepy.logging import metrics
from specklepy.logging.exceptions import SpeckleException


Expand Down
6 changes: 2 additions & 4 deletions src/specklepy/api/resources/object.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
from gql import gql

from specklepy.api.resource import ResourceBase
from specklepy.objects.base import Base

from specklepy.logging import metrics

from specklepy.core.api.resources.object import Resource as CoreResource
from specklepy.logging import metrics
from specklepy.objects.base import Base


class Resource(CoreResource):
Expand Down
3 changes: 1 addition & 2 deletions src/specklepy/api/resources/other_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@

from specklepy.api.models import ActivityCollection, LimitedUser
from specklepy.api.resource import ResourceBase
from specklepy.core.api.resources.other_user import Resource as CoreResource
from specklepy.logging import metrics
from specklepy.logging.exceptions import SpeckleException

from specklepy.core.api.resources.other_user import Resource as CoreResource


class Resource(CoreResource):
"""API Access class for other users, that are not the currently active user."""
Expand Down
3 changes: 1 addition & 2 deletions src/specklepy/api/resources/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@

from specklepy.api.models import ServerInfo
from specklepy.api.resource import ResourceBase
from specklepy.core.api.resources.server import Resource as CoreResource
from specklepy.logging import metrics
from specklepy.logging.exceptions import GraphQLException

from specklepy.core.api.resources.server import Resource as CoreResource


class Resource(CoreResource):
"""API Access class for the server"""
Expand Down
3 changes: 1 addition & 2 deletions src/specklepy/api/resources/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@

from specklepy.api.models import ActivityCollection, PendingStreamCollaborator, Stream
from specklepy.api.resource import ResourceBase
from specklepy.core.api.resources.stream import Resource as CoreResource
from specklepy.logging import metrics
from specklepy.logging.exceptions import SpeckleException, UnsupportedException

from specklepy.core.api.resources.stream import Resource as CoreResource


class Resource(CoreResource):
"""API Access class for streams"""
Expand Down
5 changes: 2 additions & 3 deletions src/specklepy/api/resources/subscriptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@

from specklepy.api.resource import ResourceBase
from specklepy.api.resources.stream import Stream
from specklepy.logging.exceptions import SpeckleException

from specklepy.logging import metrics
from specklepy.core.api.resources.subscriptions import Resource as CoreResource
from specklepy.logging import metrics
from specklepy.logging.exceptions import SpeckleException


def check_wsclient(function):
Expand Down
6 changes: 2 additions & 4 deletions src/specklepy/api/resources/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@

from specklepy.api.models import ActivityCollection, PendingStreamCollaborator, User
from specklepy.api.resource import ResourceBase

from specklepy.logging.exceptions import SpeckleException

from specklepy.logging import metrics
from specklepy.core.api.resources.user import Resource as CoreResource
from specklepy.logging import metrics
from specklepy.logging.exceptions import SpeckleException

DEPRECATION_VERSION = "2.9.0"
DEPRECATION_TEXT = (
Expand Down
5 changes: 2 additions & 3 deletions src/specklepy/api/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@
get_account_from_token,
get_local_accounts,
)
from specklepy.core.api.wrapper import StreamWrapper as CoreStreamWrapper
from specklepy.logging import metrics
from specklepy.logging.exceptions import SpeckleException, SpeckleWarning
from specklepy.transports.server.server import ServerTransport

from specklepy.logging import metrics
from specklepy.core.api.wrapper import StreamWrapper as CoreStreamWrapper


class StreamWrapper(CoreStreamWrapper):
"""
Expand Down
2 changes: 1 addition & 1 deletion src/specklepy/core/api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from specklepy.core.api import resources
from specklepy.core.api.credentials import Account, get_account_from_token
from specklepy.core.api.resources import (
user,
active_user,
branch,
commit,
Expand All @@ -20,6 +19,7 @@
server,
stream,
subscriptions,
user,
)
from specklepy.logging import metrics
from specklepy.logging.exceptions import SpeckleException, SpeckleWarning
Expand Down
1 change: 0 additions & 1 deletion src/specklepy/core/api/resources/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
User,
)
from specklepy.core.api.resource import ResourceBase

from specklepy.logging.exceptions import SpeckleException

NAME = "user"
Expand Down
1 change: 1 addition & 0 deletions src/specklepy/core/api/wrapper.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from urllib.parse import unquote, urlparse
from warnings import warn

from gql import gql

from specklepy.core.api.client import SpeckleClient
Expand Down
Loading

0 comments on commit bf3ab7d

Please sign in to comment.