chore: reorder imports

This commit is contained in:
Gergő Jedlicska
2023-11-27 12:22:33 +01:00
parent 4dc148181e
commit bf3ab7da4c
31 changed files with 119 additions and 135 deletions
+8 -8
View File
@@ -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,
@@ -22,6 +15,13 @@ from speckle_automate.schema import (
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
+2 -1
View File
@@ -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,
+2 -3
View File
@@ -5,7 +5,6 @@ from gql.transport.websockets import WebsocketsTransport
from specklepy.api.credentials import Account, get_account_from_token
from specklepy.api.resources import (
user,
active_user,
branch,
commit,
@@ -14,12 +13,12 @@ from specklepy.api.resources import (
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):
"""
+9 -10
View File
@@ -4,21 +4,20 @@ from typing import List, Optional
from pydantic import BaseModel, Field # pylint: disable=no-name-in-module
from specklepy.api.models import ServerInfo
# 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 (
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
# 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 (
Account,
UserInfo,
StreamWrapper, # deprecated
get_local_accounts as core_get_local_accounts,
get_account_from_token as core_get_account_from_token,
)
def get_local_accounts(base_path: Optional[str] = None) -> List[Account]:
"""Gets all the accounts present in this environment
+31 -31
View File
@@ -5,40 +5,40 @@ from unicodedata import name
# 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 (
ARCGIS,
ARCHICAD,
AUTOCAD,
BLENDER,
CIVIL,
CSIBRIDGE,
DXF,
DYNAMO,
ETABS,
EXCEL,
GRASSHOPPER,
GSA,
MICROSTATION,
NET,
OPENBUILDINGS,
OPENRAIL,
OPENROADS,
OTHER,
POWERBI,
PYTHON,
QGIS,
REVIT,
RHINO,
SAFE,
SAP2000,
SKETCHUP,
TEKLASTRUCTURES,
TOPSOLID,
UNITY,
UNREAL,
HostApplication,
HostAppVersion,
get_host_app_from_string,
_app_name_host_app_mapping,
RHINO,
GRASSHOPPER,
REVIT,
DYNAMO,
UNITY,
GSA,
CIVIL,
AUTOCAD,
MICROSTATION,
OPENROADS,
OPENRAIL,
OPENBUILDINGS,
ETABS,
SAP2000,
CSIBRIDGE,
SAFE,
TEKLASTRUCTURES,
DXF,
EXCEL,
UNREAL,
POWERBI,
BLENDER,
QGIS,
ARCGIS,
SKETCHUP,
ARCHICAD,
TOPSOLID,
PYTHON,
NET,
OTHER,
get_host_app_from_string,
)
if __name__ == "__main__":
+7 -7
View File
@@ -6,18 +6,18 @@ from pydantic import BaseModel, Field
# 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,
)
+4 -7
View File
@@ -1,5 +1,9 @@
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
@@ -7,13 +11,6 @@ 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,
+4 -4
View File
@@ -6,6 +6,10 @@ from gql.transport.exceptions import TransportQueryError
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,
@@ -14,10 +18,6 @@ from specklepy.logging.exceptions import (
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__(
+1 -2
View File
@@ -5,11 +5,10 @@ from gql import gql
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"""
+1 -2
View File
@@ -4,9 +4,8 @@ from gql import gql
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):
+1 -2
View File
@@ -4,9 +4,8 @@ from gql import gql
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
+2 -4
View File
@@ -3,11 +3,9 @@ from typing import Dict, List
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):
+1 -2
View File
@@ -5,11 +5,10 @@ from gql import gql
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."""
+1 -2
View File
@@ -5,11 +5,10 @@ from gql import gql
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"""
+1 -2
View File
@@ -6,11 +6,10 @@ from gql import gql
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"""
+2 -3
View File
@@ -6,10 +6,9 @@ from graphql import DocumentNode
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):
+2 -4
View File
@@ -6,11 +6,9 @@ from gql import gql
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 = (
+2 -3
View File
@@ -7,12 +7,11 @@ from specklepy.api.credentials import (
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):
"""
+1 -1
View File
@@ -11,7 +11,6 @@ from gql.transport.websockets import WebsocketsTransport
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,
@@ -20,6 +19,7 @@ from specklepy.core.api.resources import (
server,
stream,
subscriptions,
user,
)
from specklepy.logging import metrics
from specklepy.logging.exceptions import SpeckleException, SpeckleWarning
-1
View File
@@ -10,7 +10,6 @@ from specklepy.core.api.models import (
User,
)
from specklepy.core.api.resource import ResourceBase
from specklepy.logging.exceptions import SpeckleException
NAME = "user"
+1
View File
@@ -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
+1
View File
@@ -1,4 +1,5 @@
from typing import Optional
from specklepy.objects import Base
+4 -11
View File
@@ -1,21 +1,14 @@
"""Builtin Speckle object kit."""
from specklepy.objects.GIS.layers import (
VectorLayer,
RasterLayer,
)
from specklepy.objects.GIS.CRS import CRS
from specklepy.objects.GIS.geometry import (
GisPolygonGeometry,
GisPolygonElement,
GisLineElement,
GisPointElement,
GisPolygonElement,
GisPolygonGeometry,
GisRasterElement,
)
from specklepy.objects.GIS.CRS import (
CRS,
)
from specklepy.objects.GIS.layers import RasterLayer, VectorLayer
__all__ = [
"VectorLayer",
+13 -11
View File
@@ -1,16 +1,18 @@
from typing import Optional, Union, List
from specklepy.objects.geometry import (
Point,
Line,
Polyline,
Circle,
Arc,
Polycurve,
Mesh,
)
from specklepy.objects import Base
from typing import List, Optional, Union
from deprecated import deprecated
from specklepy.objects import Base
from specklepy.objects.geometry import (
Arc,
Circle,
Line,
Mesh,
Point,
Polycurve,
Polyline,
)
class GisPolygonGeometry(
Base, speckle_type="Objects.GIS.PolygonGeometry", detachable={"displayValue"}
+5 -4
View File
@@ -1,10 +1,11 @@
from typing import Any, Dict, List, Union, Optional
from specklepy.objects.base import Base
from specklepy.objects.other import Collection
from typing import Any, Dict, List, Optional, Union
from specklepy.objects.GIS.CRS import CRS
from deprecated import deprecated
from specklepy.objects.base import Base
from specklepy.objects.GIS.CRS import CRS
from specklepy.objects.other import Collection
@deprecated(version="2.15", reason="Use VectorLayer or RasterLayer instead")
class Layer(Base, detachable={"features"}):
@@ -11,7 +11,9 @@ from typing import (
Tuple,
TypeVar,
)
from attrs import define
from specklepy.objects.base import Base
ROOT: str = "__Root"
+2 -1
View File
@@ -1,7 +1,8 @@
from typing import Any, List, Optional
from deprecated import deprecated
from specklepy.objects.geometry import Point, Vector, Plane, Polyline
from specklepy.objects.geometry import Plane, Point, Polyline, Vector
from .base import Base
+1 -1
View File
@@ -6,7 +6,7 @@ from specklepy.objects.structural.analysis import (
ModelSettings,
ModelUnits,
)
from specklepy.objects.structural.axis import AxisType, Axis
from specklepy.objects.structural.axis import Axis, AxisType
from specklepy.objects.structural.geometry import (
Element1D,
Element2D,
+1 -1
View File
@@ -1,5 +1,5 @@
from typing import Optional
from enum import Enum
from typing import Optional
from specklepy.objects.base import Base
from specklepy.objects.geometry import Plane
@@ -5,12 +5,6 @@ from typing import Dict
import pytest
from gql import gql
from speckle_automate.schema import AutomateBase
from speckle_automate.helpers import register_new_automation, crypto_random_string
from specklepy.api import operations
from specklepy.api.client import SpeckleClient
from specklepy.objects.base import Base
from specklepy.transports.server import ServerTransport
from speckle_automate import (
AutomationContext,
@@ -18,6 +12,12 @@ from speckle_automate import (
AutomationStatus,
run_function,
)
from speckle_automate.helpers import crypto_random_string, register_new_automation
from speckle_automate.schema import AutomateBase
from specklepy.api import operations
from specklepy.api.client import SpeckleClient
from specklepy.objects.base import Base
from specklepy.transports.server import ServerTransport
@pytest.fixture
+1 -1
View File
@@ -3,9 +3,9 @@ Provides uniform and consistent path helpers for `specklepy`
"""
import os
import sys
from importlib import import_module, invalidate_caches
from pathlib import Path
from typing import Optional
from importlib import import_module, invalidate_caches
_user_data_env_var = "SPECKLE_USERDATA_PATH"