Merge pull request #302 from specklesystems/gergo/objects_init
fix: object initialization
This commit is contained in:
Коммит
62e342b2cb
|
@ -18,7 +18,7 @@ from speckle_automate.schema import (
|
|||
from specklepy.api import operations
|
||||
from specklepy.api.client import SpeckleClient
|
||||
from specklepy.logging.exceptions import SpeckleException
|
||||
from specklepy.objects import Base
|
||||
from specklepy.objects.base import Base
|
||||
from specklepy.transports.memory import MemoryTransport
|
||||
from specklepy.transports.server import ServerTransport
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
from specklepy import objects
|
||||
|
||||
__all__ = ["objects"]
|
|
@ -731,13 +731,13 @@ class Resource(ResourceBase):
|
|||
"stream_id": stream_id,
|
||||
"limit": limit,
|
||||
"action_type": action_type,
|
||||
"before": before.astimezone(timezone.utc).isoformat()
|
||||
if before
|
||||
else before,
|
||||
"before": (
|
||||
before.astimezone(timezone.utc).isoformat() if before else before
|
||||
),
|
||||
"after": after.astimezone(timezone.utc).isoformat() if after else after,
|
||||
"cursor": cursor.astimezone(timezone.utc).isoformat()
|
||||
if cursor
|
||||
else cursor,
|
||||
"cursor": (
|
||||
cursor.astimezone(timezone.utc).isoformat() if cursor else cursor
|
||||
),
|
||||
}
|
||||
except AttributeError as e:
|
||||
raise SpeckleException(
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from typing import Optional
|
||||
|
||||
from specklepy.objects import Base
|
||||
from specklepy.objects.base import Base
|
||||
|
||||
|
||||
class CRS(Base, speckle_type="Objects.GIS.CRS"):
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from typing import List, Optional, Union
|
||||
|
||||
from specklepy.objects import Base
|
||||
from specklepy.objects.base import Base
|
||||
from specklepy.objects.geometry import (
|
||||
Arc,
|
||||
Circle,
|
||||
|
|
|
@ -13,8 +13,8 @@ class Layer(Base, detachable={"features"}):
|
|||
|
||||
def __init__(
|
||||
self,
|
||||
name: str = None,
|
||||
crs: CRS = None,
|
||||
name: Optional[str] = None,
|
||||
crs: Optional[CRS] = None,
|
||||
units: str = "m",
|
||||
features: Optional[List[Base]] = None,
|
||||
layerType: str = "None",
|
||||
|
@ -39,7 +39,6 @@ class VectorLayer(
|
|||
speckle_type="VectorLayer",
|
||||
serialize_ignore={"features"},
|
||||
):
|
||||
|
||||
"""GIS Vector Layer"""
|
||||
|
||||
name: Optional[str] = None
|
||||
|
@ -68,7 +67,6 @@ class RasterLayer(
|
|||
speckle_type="RasterLayer",
|
||||
serialize_ignore={"features"},
|
||||
):
|
||||
|
||||
"""GIS Raster Layer"""
|
||||
|
||||
name: Optional[str] = None
|
||||
|
@ -96,7 +94,6 @@ class VectorLayer( # noqa: F811
|
|||
speckle_type="Objects.GIS.VectorLayer",
|
||||
serialize_ignore={"features"},
|
||||
):
|
||||
|
||||
"""GIS Vector Layer"""
|
||||
|
||||
name: Optional[str] = None
|
||||
|
@ -124,7 +121,6 @@ class RasterLayer( # noqa: F811
|
|||
speckle_type="Objects.GIS.RasterLayer",
|
||||
serialize_ignore={"features"},
|
||||
):
|
||||
|
||||
"""GIS Raster Layer"""
|
||||
|
||||
name: Optional[str] = None
|
||||
|
|
|
@ -1,6 +1,23 @@
|
|||
"""Builtin Speckle object kit."""
|
||||
|
||||
from specklepy.objects import encoding, geometry, other, primitive, structural, units
|
||||
from specklepy.objects import (
|
||||
GIS,
|
||||
encoding,
|
||||
geometry,
|
||||
other,
|
||||
primitive,
|
||||
structural,
|
||||
units,
|
||||
)
|
||||
from specklepy.objects.base import Base
|
||||
|
||||
__all__ = ["Base", "encoding", "geometry", "other", "units", "structural", "primitive"]
|
||||
__all__ = [
|
||||
"Base",
|
||||
"encoding",
|
||||
"geometry",
|
||||
"other",
|
||||
"units",
|
||||
"structural",
|
||||
"primitive",
|
||||
"GIS",
|
||||
]
|
||||
|
|
|
@ -3,7 +3,7 @@ from typing import Any, Callable, Collection, Iterable, Iterator, List, Optional
|
|||
from attrs import define
|
||||
from typing_extensions import Protocol, final
|
||||
|
||||
from specklepy.objects import Base
|
||||
from specklepy.objects.base import Base
|
||||
|
||||
|
||||
class ITraversalRule(Protocol):
|
||||
|
|
|
@ -44,6 +44,14 @@ class TestStream:
|
|||
|
||||
assert isinstance(stream.id, str)
|
||||
|
||||
def test_stream_create_short_name(self, client, stream, updated_stream):
|
||||
new_stream_id = client.stream.create(
|
||||
name="x",
|
||||
description=stream.description,
|
||||
is_public=stream.isPublic,
|
||||
)
|
||||
assert isinstance(new_stream_id, SpeckleException)
|
||||
|
||||
def test_stream_get(self, client, stream):
|
||||
fetched_stream = client.stream.get(stream.id)
|
||||
|
Загрузка…
Ссылка в новой задаче