This commit is contained in:
Gergő Jedlicska 2023-11-27 12:22:33 +01:00
Родитель 4dc148181e
Коммит bf3ab7da4c
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 868C59E4F75C7534
31 изменённых файлов: 119 добавлений и 135 удалений

Просмотреть файл

@ -1,18 +1,11 @@
"""This module provides an abstraction layer above the Speckle Automate runtime.""" """This module provides an abstraction layer above the Speckle Automate runtime."""
import time
from dataclasses import dataclass, field from dataclasses import dataclass, field
from pathlib import Path from pathlib import Path
import time
from typing import Any, Dict, List, Optional, Tuple, Union from typing import Any, Dict, List, Optional, Tuple, Union
import httpx import httpx
from gql import gql 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 ( from speckle_automate.schema import (
AutomateBase, AutomateBase,
@ -22,6 +15,13 @@ from speckle_automate.schema import (
ObjectResultLevel, ObjectResultLevel,
ResultCase, 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 @dataclass

Просмотреть файл

@ -2,9 +2,10 @@
import secrets import secrets
import string import string
from specklepy.api.client import SpeckleClient
from gql import gql from gql import gql
from specklepy.api.client import SpeckleClient
def register_new_automation( def register_new_automation(
speckle_client: SpeckleClient, speckle_client: SpeckleClient,

Просмотреть файл

@ -5,7 +5,6 @@ from gql.transport.websockets import WebsocketsTransport
from specklepy.api.credentials import Account, get_account_from_token from specklepy.api.credentials import Account, get_account_from_token
from specklepy.api.resources import ( from specklepy.api.resources import (
user,
active_user, active_user,
branch, branch,
commit, commit,
@ -14,12 +13,12 @@ from specklepy.api.resources import (
server, server,
stream, stream,
subscriptions, subscriptions,
user,
) )
from specklepy.core.api.client import SpeckleClient as CoreSpeckleClient
from specklepy.logging import metrics from specklepy.logging import metrics
from specklepy.logging.exceptions import SpeckleException, SpeckleWarning from specklepy.logging.exceptions import SpeckleException, SpeckleWarning
from specklepy.core.api.client import SpeckleClient as CoreSpeckleClient
class SpeckleClient(CoreSpeckleClient): class SpeckleClient(CoreSpeckleClient):
""" """

Просмотреть файл

@ -4,21 +4,20 @@ from typing import List, Optional
from pydantic import BaseModel, Field # pylint: disable=no-name-in-module from pydantic import BaseModel, Field # pylint: disable=no-name-in-module
from specklepy.api.models import ServerInfo 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.core.helpers import speckle_path_provider
from specklepy.logging import metrics from specklepy.logging import metrics
from specklepy.logging.exceptions import SpeckleException from specklepy.logging.exceptions import SpeckleException
from specklepy.transports.sqlite import SQLiteTransport 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]: def get_local_accounts(base_path: Optional[str] = None) -> List[Account]:
"""Gets all the accounts present in this environment """Gets all the accounts present in this environment

Просмотреть файл

@ -5,40 +5,40 @@ from unicodedata import name
# following imports seem to be unnecessary, but they need to stay # following imports seem to be unnecessary, but they need to stay
# to not break the scripts using these functions as non-core # to not break the scripts using these functions as non-core
from specklepy.core.api.host_applications import ( 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, HostApplication,
HostAppVersion, HostAppVersion,
get_host_app_from_string,
_app_name_host_app_mapping, _app_name_host_app_mapping,
RHINO, get_host_app_from_string,
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,
) )
if __name__ == "__main__": if __name__ == "__main__":

Просмотреть файл

@ -6,18 +6,18 @@ from pydantic import BaseModel, Field
# following imports seem to be unnecessary, but they need to stay # following imports seem to be unnecessary, but they need to stay
# to not break the scripts using these functions as non-core # to not break the scripts using these functions as non-core
from specklepy.core.api.models import ( from specklepy.core.api.models import (
Activity,
ActivityCollection,
Branch,
Branches,
Collaborator, Collaborator,
Commit, Commit,
Commits, Commits,
LimitedUser,
Object, Object,
Branch, PendingStreamCollaborator,
Branches, ServerInfo,
Stream, Stream,
Streams, Streams,
User, User,
LimitedUser,
PendingStreamCollaborator,
Activity,
ActivityCollection,
ServerInfo,
) )

Просмотреть файл

@ -1,5 +1,9 @@
from typing import List, Optional 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 import metrics
from specklepy.logging.exceptions import SpeckleException from specklepy.logging.exceptions import SpeckleException
from specklepy.objects.base import Base 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.abstract_transport import AbstractTransport
from specklepy.transports.sqlite import SQLiteTransport 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( def send(
base: Base, base: Base,

Просмотреть файл

@ -6,6 +6,10 @@ from gql.transport.exceptions import TransportQueryError
from graphql import DocumentNode from graphql import DocumentNode
from specklepy.api.credentials import Account 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 ( from specklepy.logging.exceptions import (
GraphQLException, GraphQLException,
SpeckleException, SpeckleException,
@ -14,10 +18,6 @@ from specklepy.logging.exceptions import (
from specklepy.serialization.base_object_serializer import BaseObjectSerializer from specklepy.serialization.base_object_serializer import BaseObjectSerializer
from specklepy.transports.sqlite import SQLiteTransport 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): class ResourceBase(CoreResourceBase):
def __init__( def __init__(

Просмотреть файл

@ -5,11 +5,10 @@ from gql import gql
from specklepy.api.models import ActivityCollection, PendingStreamCollaborator, User from specklepy.api.models import ActivityCollection, PendingStreamCollaborator, User
from specklepy.api.resource import ResourceBase 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 import metrics
from specklepy.logging.exceptions import SpeckleException from specklepy.logging.exceptions import SpeckleException
from specklepy.core.api.resources.active_user import Resource as CoreResource
class Resource(CoreResource): class Resource(CoreResource):
"""API Access class for users""" """API Access class for users"""

Просмотреть файл

@ -4,9 +4,8 @@ from gql import gql
from specklepy.api.models import Branch from specklepy.api.models import Branch
from specklepy.api.resource import ResourceBase from specklepy.api.resource import ResourceBase
from specklepy.logging import metrics
from specklepy.core.api.resources.branch import Resource as CoreResource from specklepy.core.api.resources.branch import Resource as CoreResource
from specklepy.logging import metrics
class Resource(CoreResource): class Resource(CoreResource):

Просмотреть файл

@ -4,9 +4,8 @@ from gql import gql
from specklepy.api.models import Commit from specklepy.api.models import Commit
from specklepy.api.resource import ResourceBase from specklepy.api.resource import ResourceBase
from specklepy.logging import metrics
from specklepy.core.api.resources.commit import Resource as CoreResource from specklepy.core.api.resources.commit import Resource as CoreResource
from specklepy.logging import metrics
from specklepy.logging.exceptions import SpeckleException from specklepy.logging.exceptions import SpeckleException

Просмотреть файл

@ -3,11 +3,9 @@ from typing import Dict, List
from gql import gql from gql import gql
from specklepy.api.resource import ResourceBase 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.core.api.resources.object import Resource as CoreResource
from specklepy.logging import metrics
from specklepy.objects.base import Base
class Resource(CoreResource): class Resource(CoreResource):

Просмотреть файл

@ -5,11 +5,10 @@ from gql import gql
from specklepy.api.models import ActivityCollection, LimitedUser from specklepy.api.models import ActivityCollection, LimitedUser
from specklepy.api.resource import ResourceBase 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 import metrics
from specklepy.logging.exceptions import SpeckleException from specklepy.logging.exceptions import SpeckleException
from specklepy.core.api.resources.other_user import Resource as CoreResource
class Resource(CoreResource): class Resource(CoreResource):
"""API Access class for other users, that are not the currently active user.""" """API Access class for other users, that are not the currently active user."""

Просмотреть файл

@ -5,11 +5,10 @@ from gql import gql
from specklepy.api.models import ServerInfo from specklepy.api.models import ServerInfo
from specklepy.api.resource import ResourceBase from specklepy.api.resource import ResourceBase
from specklepy.core.api.resources.server import Resource as CoreResource
from specklepy.logging import metrics from specklepy.logging import metrics
from specklepy.logging.exceptions import GraphQLException from specklepy.logging.exceptions import GraphQLException
from specklepy.core.api.resources.server import Resource as CoreResource
class Resource(CoreResource): class Resource(CoreResource):
"""API Access class for the server""" """API Access class for the server"""

Просмотреть файл

@ -6,11 +6,10 @@ from gql import gql
from specklepy.api.models import ActivityCollection, PendingStreamCollaborator, Stream from specklepy.api.models import ActivityCollection, PendingStreamCollaborator, Stream
from specklepy.api.resource import ResourceBase from specklepy.api.resource import ResourceBase
from specklepy.core.api.resources.stream import Resource as CoreResource
from specklepy.logging import metrics from specklepy.logging import metrics
from specklepy.logging.exceptions import SpeckleException, UnsupportedException from specklepy.logging.exceptions import SpeckleException, UnsupportedException
from specklepy.core.api.resources.stream import Resource as CoreResource
class Resource(CoreResource): class Resource(CoreResource):
"""API Access class for streams""" """API Access class for streams"""

Просмотреть файл

@ -6,10 +6,9 @@ from graphql import DocumentNode
from specklepy.api.resource import ResourceBase from specklepy.api.resource import ResourceBase
from specklepy.api.resources.stream import Stream 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.core.api.resources.subscriptions import Resource as CoreResource
from specklepy.logging import metrics
from specklepy.logging.exceptions import SpeckleException
def check_wsclient(function): def check_wsclient(function):

Просмотреть файл

@ -6,11 +6,9 @@ from gql import gql
from specklepy.api.models import ActivityCollection, PendingStreamCollaborator, User from specklepy.api.models import ActivityCollection, PendingStreamCollaborator, User
from specklepy.api.resource import ResourceBase 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.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_VERSION = "2.9.0"
DEPRECATION_TEXT = ( DEPRECATION_TEXT = (

Просмотреть файл

@ -7,12 +7,11 @@ from specklepy.api.credentials import (
get_account_from_token, get_account_from_token,
get_local_accounts, 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.logging.exceptions import SpeckleException, SpeckleWarning
from specklepy.transports.server.server import ServerTransport from specklepy.transports.server.server import ServerTransport
from specklepy.logging import metrics
from specklepy.core.api.wrapper import StreamWrapper as CoreStreamWrapper
class StreamWrapper(CoreStreamWrapper): class StreamWrapper(CoreStreamWrapper):
""" """

Просмотреть файл

@ -11,7 +11,6 @@ from gql.transport.websockets import WebsocketsTransport
from specklepy.core.api import resources from specklepy.core.api import resources
from specklepy.core.api.credentials import Account, get_account_from_token from specklepy.core.api.credentials import Account, get_account_from_token
from specklepy.core.api.resources import ( from specklepy.core.api.resources import (
user,
active_user, active_user,
branch, branch,
commit, commit,
@ -20,6 +19,7 @@ from specklepy.core.api.resources import (
server, server,
stream, stream,
subscriptions, subscriptions,
user,
) )
from specklepy.logging import metrics from specklepy.logging import metrics
from specklepy.logging.exceptions import SpeckleException, SpeckleWarning from specklepy.logging.exceptions import SpeckleException, SpeckleWarning

Просмотреть файл

@ -10,7 +10,6 @@ from specklepy.core.api.models import (
User, User,
) )
from specklepy.core.api.resource import ResourceBase from specklepy.core.api.resource import ResourceBase
from specklepy.logging.exceptions import SpeckleException from specklepy.logging.exceptions import SpeckleException
NAME = "user" NAME = "user"

Просмотреть файл

@ -1,5 +1,6 @@
from urllib.parse import unquote, urlparse from urllib.parse import unquote, urlparse
from warnings import warn from warnings import warn
from gql import gql from gql import gql
from specklepy.core.api.client import SpeckleClient from specklepy.core.api.client import SpeckleClient

Просмотреть файл

@ -1,4 +1,5 @@
from typing import Optional from typing import Optional
from specklepy.objects import Base from specklepy.objects import Base

Просмотреть файл

@ -1,21 +1,14 @@
"""Builtin Speckle object kit.""" """Builtin Speckle object kit."""
from specklepy.objects.GIS.layers import ( from specklepy.objects.GIS.CRS import CRS
VectorLayer,
RasterLayer,
)
from specklepy.objects.GIS.geometry import ( from specklepy.objects.GIS.geometry import (
GisPolygonGeometry,
GisPolygonElement,
GisLineElement, GisLineElement,
GisPointElement, GisPointElement,
GisPolygonElement,
GisPolygonGeometry,
GisRasterElement, GisRasterElement,
) )
from specklepy.objects.GIS.layers import RasterLayer, VectorLayer
from specklepy.objects.GIS.CRS import (
CRS,
)
__all__ = [ __all__ = [
"VectorLayer", "VectorLayer",

Просмотреть файл

@ -1,16 +1,18 @@
from typing import Optional, Union, List from typing import List, Optional, Union
from specklepy.objects.geometry import (
Point,
Line,
Polyline,
Circle,
Arc,
Polycurve,
Mesh,
)
from specklepy.objects import Base
from deprecated import deprecated from deprecated import deprecated
from specklepy.objects import Base
from specklepy.objects.geometry import (
Arc,
Circle,
Line,
Mesh,
Point,
Polycurve,
Polyline,
)
class GisPolygonGeometry( class GisPolygonGeometry(
Base, speckle_type="Objects.GIS.PolygonGeometry", detachable={"displayValue"} Base, speckle_type="Objects.GIS.PolygonGeometry", detachable={"displayValue"}

Просмотреть файл

@ -1,10 +1,11 @@
from typing import Any, Dict, List, Union, Optional from typing import Any, Dict, List, Optional, Union
from specklepy.objects.base import Base
from specklepy.objects.other import Collection
from specklepy.objects.GIS.CRS import CRS
from deprecated import deprecated 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") @deprecated(version="2.15", reason="Use VectorLayer or RasterLayer instead")
class Layer(Base, detachable={"features"}): class Layer(Base, detachable={"features"}):

Просмотреть файл

@ -11,7 +11,9 @@ from typing import (
Tuple, Tuple,
TypeVar, TypeVar,
) )
from attrs import define from attrs import define
from specklepy.objects.base import Base from specklepy.objects.base import Base
ROOT: str = "__Root" ROOT: str = "__Root"

Просмотреть файл

@ -1,7 +1,8 @@
from typing import Any, List, Optional from typing import Any, List, Optional
from deprecated import deprecated 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 from .base import Base

Просмотреть файл

@ -6,7 +6,7 @@ from specklepy.objects.structural.analysis import (
ModelSettings, ModelSettings,
ModelUnits, ModelUnits,
) )
from specklepy.objects.structural.axis import AxisType, Axis from specklepy.objects.structural.axis import Axis, AxisType
from specklepy.objects.structural.geometry import ( from specklepy.objects.structural.geometry import (
Element1D, Element1D,
Element2D, Element2D,

Просмотреть файл

@ -1,5 +1,5 @@
from typing import Optional
from enum import Enum from enum import Enum
from typing import Optional
from specklepy.objects.base import Base from specklepy.objects.base import Base
from specklepy.objects.geometry import Plane from specklepy.objects.geometry import Plane

Просмотреть файл

@ -5,12 +5,6 @@ from typing import Dict
import pytest import pytest
from gql import gql 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 ( from speckle_automate import (
AutomationContext, AutomationContext,
@ -18,6 +12,12 @@ from speckle_automate import (
AutomationStatus, AutomationStatus,
run_function, 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 @pytest.fixture

Просмотреть файл

@ -3,9 +3,9 @@ Provides uniform and consistent path helpers for `specklepy`
""" """
import os import os
import sys import sys
from importlib import import_module, invalidate_caches
from pathlib import Path from pathlib import Path
from typing import Optional from typing import Optional
from importlib import import_module, invalidate_caches
_user_data_env_var = "SPECKLE_USERDATA_PATH" _user_data_env_var = "SPECKLE_USERDATA_PATH"