style(all-project): fix all linting errors across the project with the current setup
This commit is contained in:
Родитель
2cf9b64221
Коммит
fcc33f8989
|
@ -1,3 +1,5 @@
|
|||
from devtools import debug
|
||||
|
||||
from specklepy.api import operations
|
||||
from specklepy.objects.geometry import Base
|
||||
from specklepy.objects.units import Units
|
||||
|
@ -13,7 +15,6 @@ base = Base()
|
|||
for prop, value in dct.items():
|
||||
base.__setattr__(prop, value)
|
||||
|
||||
from devtools import debug
|
||||
|
||||
debug(base)
|
||||
debug(base.units)
|
||||
|
|
|
@ -1324,6 +1324,21 @@ files = [
|
|||
{file = "types_Deprecated-1.2.9-py3-none-any.whl", hash = "sha256:53d05621e1d75de537f5a57d93508c8df17e37c07ee60b9fb09d39e1b7586c1e"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "types-requests"
|
||||
version = "2.28.11.5"
|
||||
description = "Typing stubs for requests"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
files = [
|
||||
{file = "types-requests-2.28.11.5.tar.gz", hash = "sha256:a7df37cc6fb6187a84097da951f8e21d335448aa2501a6b0a39cbd1d7ca9ee2a"},
|
||||
{file = "types_requests-2.28.11.5-py3-none-any.whl", hash = "sha256:091d4a5a33c1b4f20d8b1b952aa8fa27a6e767c44c3cf65e56580df0b05fd8a9"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
types-urllib3 = "<1.27"
|
||||
|
||||
[[package]]
|
||||
name = "types-ujson"
|
||||
version = "5.6.0.0"
|
||||
|
@ -1336,6 +1351,18 @@ files = [
|
|||
{file = "types_ujson-5.6.0.0-py3-none-any.whl", hash = "sha256:010b221260c24a915c6e713a83f366b91390766850ec110304de5b20c86b4b11"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "types-urllib3"
|
||||
version = "1.26.25.4"
|
||||
description = "Typing stubs for urllib3"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
files = [
|
||||
{file = "types-urllib3-1.26.25.4.tar.gz", hash = "sha256:eec5556428eec862b1ac578fb69aab3877995a99ffec9e5a12cf7fbd0cc9daee"},
|
||||
{file = "types_urllib3-1.26.25.4-py3-none-any.whl", hash = "sha256:ed6b9e8a8be488796f72306889a06a3fc3cb1aa99af02ab8afb50144d7317e49"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "typing-extensions"
|
||||
version = "4.4.0"
|
||||
|
@ -1720,4 +1747,4 @@ testing = ["flake8 (<5)", "func-timeout", "jaraco.functools", "jaraco.itertools"
|
|||
[metadata]
|
||||
lock-version = "2.0"
|
||||
python-versions = ">=3.7.2, <4.0"
|
||||
content-hash = "18bc7c2f98f551538bf1dfca42a0c3c352e98f2c0a7a59619b8fd16bd2c13e39"
|
||||
content-hash = "cf8d8ae156d93c7a12ec96e876570e02de64f8763d14b4a2263cffdf98651c00"
|
||||
|
|
|
@ -35,6 +35,7 @@ commitizen = "^2.38.0"
|
|||
ruff = "^0.0.187"
|
||||
types-deprecated = "^1.2.9"
|
||||
types-ujson = "^5.6.0.0"
|
||||
types-requests = "^2.28.11.5"
|
||||
|
||||
[tool.black]
|
||||
exclude = '''
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from typing import Optional
|
||||
|
||||
from gql import gql
|
||||
|
||||
from specklepy.api.models import Branch
|
||||
|
@ -113,7 +115,11 @@ class Resource(ResourceBase):
|
|||
metrics.track(metrics.BRANCH, self.account, {"name": "get"})
|
||||
query = gql(
|
||||
"""
|
||||
query BranchesGet($stream_id: String!, $branches_limit: Int!, $commits_limit: Int!) {
|
||||
query BranchesGet(
|
||||
$stream_id: String!,
|
||||
$branches_limit: Int!,
|
||||
$commits_limit: Int!
|
||||
) {
|
||||
stream(id: $stream_id) {
|
||||
branches(limit: $branches_limit) {
|
||||
items {
|
||||
|
@ -152,7 +158,11 @@ class Resource(ResourceBase):
|
|||
)
|
||||
|
||||
def update(
|
||||
self, stream_id: str, branch_id: str, name: str = None, description: str = None
|
||||
self,
|
||||
stream_id: str,
|
||||
branch_id: str,
|
||||
name: Optional[str] = None,
|
||||
description: Optional[str] = None,
|
||||
):
|
||||
"""Update a branch
|
||||
|
||||
|
|
|
@ -116,9 +116,13 @@ class Resource(ResourceBase):
|
|||
Arguments:
|
||||
stream_id {str} -- the stream you want to commit to
|
||||
object_id {str} -- the hash of your commit object
|
||||
branch_name {str} -- the name of the branch to commit to (defaults to "main")
|
||||
message {str} -- optional: a message to give more information about the commit
|
||||
source_application{str} -- optional: the application from which the commit was created (defaults to "python")
|
||||
branch_name {str}
|
||||
-- the name of the branch to commit to (defaults to "main")
|
||||
message {str}
|
||||
-- optional: a message to give more information about the commit
|
||||
source_application{str}
|
||||
-- optional: the application from which the commit was created
|
||||
(defaults to "python")
|
||||
parents {List[str]} -- optional: the id of the parent commits
|
||||
|
||||
Returns:
|
||||
|
@ -127,7 +131,8 @@ class Resource(ResourceBase):
|
|||
metrics.track(metrics.COMMIT, self.account, {"name": "create"})
|
||||
query = gql(
|
||||
"""
|
||||
mutation CommitCreate ($commit: CommitCreateInput!){ commitCreate(commit: $commit)}
|
||||
mutation CommitCreate ($commit: CommitCreateInput!)
|
||||
{ commitCreate(commit: $commit)}
|
||||
"""
|
||||
)
|
||||
params = {
|
||||
|
@ -151,7 +156,8 @@ class Resource(ResourceBase):
|
|||
Update a commit
|
||||
|
||||
Arguments:
|
||||
stream_id {str} -- the id of the stream that contains the commit you'd like to update
|
||||
stream_id {str}
|
||||
-- the id of the stream that contains the commit you'd like to update
|
||||
commit_id {str} -- the id of the commit you'd like to update
|
||||
message {str} -- the updated commit message
|
||||
|
||||
|
@ -161,7 +167,8 @@ class Resource(ResourceBase):
|
|||
metrics.track(metrics.COMMIT, self.account, {"name": "update"})
|
||||
query = gql(
|
||||
"""
|
||||
mutation CommitUpdate($commit: CommitUpdateInput!){ commitUpdate(commit: $commit)}
|
||||
mutation CommitUpdate($commit: CommitUpdateInput!)
|
||||
{ commitUpdate(commit: $commit)}
|
||||
"""
|
||||
)
|
||||
params = {
|
||||
|
@ -177,7 +184,8 @@ class Resource(ResourceBase):
|
|||
Delete a commit
|
||||
|
||||
Arguments:
|
||||
stream_id {str} -- the id of the stream that contains the commit you'd like to delete
|
||||
stream_id {str}
|
||||
-- the id of the stream that contains the commit you'd like to delete
|
||||
commit_id {str} -- the id of the commit you'd like to delete
|
||||
|
||||
Returns:
|
||||
|
@ -186,7 +194,8 @@ class Resource(ResourceBase):
|
|||
metrics.track(metrics.COMMIT, self.account, {"name": "delete"})
|
||||
query = gql(
|
||||
"""
|
||||
mutation CommitDelete($commit: CommitDeleteInput!){ commitDelete(commit: $commit)}
|
||||
mutation CommitDelete($commit: CommitDeleteInput!)
|
||||
{ commitDelete(commit: $commit)}
|
||||
"""
|
||||
)
|
||||
params = {"commit": {"streamId": stream_id, "id": commit_id}}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from datetime import datetime, timezone
|
||||
from typing import List
|
||||
from typing import List, Optional
|
||||
|
||||
from deprecated import deprecated
|
||||
from gql import gql
|
||||
|
@ -153,7 +153,8 @@ class Resource(ResourceBase):
|
|||
Arguments:
|
||||
name {str} -- the name of the string
|
||||
description {str} -- a short description of the stream
|
||||
is_public {bool} -- whether or not the stream can be viewed by anyone with the id
|
||||
is_public {bool}
|
||||
-- whether or not the stream can be viewed by anyone with the id
|
||||
|
||||
Returns:
|
||||
id {str} -- the id of the newly created stream
|
||||
|
@ -176,7 +177,11 @@ class Resource(ResourceBase):
|
|||
)
|
||||
|
||||
def update(
|
||||
self, id: str, name: str = None, description: str = None, is_public: bool = None
|
||||
self,
|
||||
id: str,
|
||||
name: Optional[str] = None,
|
||||
description: Optional[str] = None,
|
||||
is_public: Optional[bool] = None,
|
||||
) -> bool:
|
||||
"""Update an existing stream
|
||||
|
||||
|
@ -184,7 +189,8 @@ class Resource(ResourceBase):
|
|||
id {str} -- the id of the stream to be updated
|
||||
name {str} -- the name of the string
|
||||
description {str} -- a short description of the stream
|
||||
is_public {bool} -- whether or not the stream can be viewed by anyone with the id
|
||||
is_public {bool}
|
||||
-- whether or not the stream can be viewed by anyone with the id
|
||||
|
||||
Returns:
|
||||
bool -- whether the stream update was successful
|
||||
|
@ -256,7 +262,12 @@ class Resource(ResourceBase):
|
|||
metrics.track(metrics.STREAM, self.account, {"name": "search"})
|
||||
query = gql(
|
||||
"""
|
||||
query StreamSearch($search_query: String!,$limit: Int!, $branch_limit:Int!, $commit_limit:Int!) {
|
||||
query StreamSearch(
|
||||
$search_query: String!,
|
||||
$limit: Int!,
|
||||
$branch_limit:Int!,
|
||||
$commit_limit:Int!
|
||||
) {
|
||||
streams(query: $search_query, limit: $limit) {
|
||||
items {
|
||||
id
|
||||
|
@ -315,7 +326,8 @@ class Resource(ResourceBase):
|
|||
|
||||
Arguments:
|
||||
stream_id {str} -- the id of the stream to favorite / unfavorite
|
||||
favorited {bool} -- whether to favorite (True) or unfavorite (False) the stream
|
||||
favorited {bool}
|
||||
-- whether to favorite (True) or unfavorite (False) the stream
|
||||
|
||||
Returns:
|
||||
Stream -- the stream with its `id`, `name`, and `favoritedDate`
|
||||
|
@ -378,7 +390,9 @@ class Resource(ResourceBase):
|
|||
|
||||
query = gql(
|
||||
"""
|
||||
mutation StreamGrantPermission($permission_params: StreamGrantPermissionInput !) {
|
||||
mutation StreamGrantPermission(
|
||||
$permission_params: StreamGrantPermissionInput !
|
||||
) {
|
||||
streamGrantPermission(permissionParams: $permission_params)
|
||||
}
|
||||
"""
|
||||
|
@ -411,7 +425,8 @@ class Resource(ResourceBase):
|
|||
stream_id {str} -- the stream id from which to get the pending invites
|
||||
|
||||
Returns:
|
||||
List[PendingStreamCollaborator] -- a list of pending invites for the specified stream
|
||||
List[PendingStreamCollaborator]
|
||||
-- a list of pending invites for the specified stream
|
||||
"""
|
||||
metrics.track(metrics.INVITE, self.account, {"name": "get"})
|
||||
self._check_invites_supported()
|
||||
|
@ -457,10 +472,10 @@ class Resource(ResourceBase):
|
|||
def invite(
|
||||
self,
|
||||
stream_id: str,
|
||||
email: str = None,
|
||||
user_id: str = None,
|
||||
email: Optional[str] = None,
|
||||
user_id: Optional[str] = None,
|
||||
role: str = "stream:contributor", # should default be reviewer?
|
||||
message: str = None,
|
||||
message: Optional[str] = None,
|
||||
):
|
||||
"""Invite someone to a stream using either their email or user id
|
||||
|
||||
|
@ -470,8 +485,10 @@ class Resource(ResourceBase):
|
|||
stream_id {str} -- the id of the stream to invite the user to
|
||||
email {str} -- the email of the user to invite (use this OR `user_id`)
|
||||
user_id {str} -- the id of the user to invite (use this OR `email`)
|
||||
role {str} -- the role to assign to the user (defaults to `stream:contributor`)
|
||||
message {str} -- a message to send along with this invite to the specified user
|
||||
role {str}
|
||||
-- the role to assign to the user (defaults to `stream:contributor`)
|
||||
message {str}
|
||||
-- a message to send along with this invite to the specified user
|
||||
|
||||
Returns:
|
||||
bool -- True if the operation was successful
|
||||
|
@ -512,9 +529,9 @@ class Resource(ResourceBase):
|
|||
def invite_batch(
|
||||
self,
|
||||
stream_id: str,
|
||||
emails: List[str] = None,
|
||||
user_ids: List[None] = None,
|
||||
message: str = None,
|
||||
emails: Optional[List[str]] = None,
|
||||
user_ids: Optional[List[None]] = None,
|
||||
message: Optional[str] = None,
|
||||
) -> bool:
|
||||
"""Invite a batch of users to a specified stream.
|
||||
|
||||
|
@ -522,9 +539,12 @@ class Resource(ResourceBase):
|
|||
|
||||
Arguments:
|
||||
stream_id {str} -- the id of the stream to invite the user to
|
||||
emails {List[str]} -- the email of the user to invite (use this and/or `user_ids`)
|
||||
user_id {List[str]} -- the id of the user to invite (use this and/or `emails`)
|
||||
message {str} -- a message to send along with this invite to the specified user
|
||||
emails {List[str]}
|
||||
-- the email of the user to invite (use this and/or `user_ids`)
|
||||
user_id {List[str]}
|
||||
-- the id of the user to invite (use this and/or `emails`)
|
||||
message {str}
|
||||
-- a message to send along with this invite to the specified user
|
||||
|
||||
Returns:
|
||||
bool -- True if the operation was successful
|
||||
|
@ -604,7 +624,8 @@ class Resource(ResourceBase):
|
|||
Requires Speckle Server version >= 2.6.4
|
||||
|
||||
Arguments:
|
||||
stream_id {str} -- the id of the stream for which the user has a pending invite
|
||||
stream_id {str}
|
||||
-- the id of the stream for which the user has a pending invite
|
||||
token {str} -- the token of the invite to use
|
||||
accept {bool} -- whether or not to accept the invite (defaults to True)
|
||||
|
||||
|
@ -616,7 +637,11 @@ class Resource(ResourceBase):
|
|||
|
||||
query = gql(
|
||||
"""
|
||||
mutation StreamInviteUse($accept: Boolean!, $streamId: String!, $token: String!) {
|
||||
mutation StreamInviteUse(
|
||||
$accept: Boolean!,
|
||||
$streamId: String!,
|
||||
$token: String!
|
||||
) {
|
||||
streamInviteUse(accept: $accept, streamId: $streamId, token: $token)
|
||||
}
|
||||
"""
|
||||
|
@ -657,7 +682,9 @@ class Resource(ResourceBase):
|
|||
)
|
||||
query = gql(
|
||||
"""
|
||||
mutation StreamUpdatePermission($permission_params: StreamUpdatePermissionInput !) {
|
||||
mutation StreamUpdatePermission(
|
||||
$permission_params: StreamUpdatePermissionInput!
|
||||
) {
|
||||
streamUpdatePermission(permissionParams: $permission_params)
|
||||
}
|
||||
"""
|
||||
|
@ -691,7 +718,9 @@ class Resource(ResourceBase):
|
|||
metrics.track(metrics.PERMISSION, self.account, {"name": "revoke"})
|
||||
query = gql(
|
||||
"""
|
||||
mutation StreamRevokePermission($permission_params: StreamRevokePermissionInput !) {
|
||||
mutation StreamRevokePermission(
|
||||
$permission_params: StreamRevokePermissionInput!
|
||||
) {
|
||||
streamRevokePermission(permissionParams: $permission_params)
|
||||
}
|
||||
"""
|
||||
|
@ -709,29 +738,48 @@ class Resource(ResourceBase):
|
|||
def activity(
|
||||
self,
|
||||
stream_id: str,
|
||||
action_type: str = None,
|
||||
action_type: Optional[str] = None,
|
||||
limit: int = 20,
|
||||
before: datetime = None,
|
||||
after: datetime = None,
|
||||
cursor: datetime = None,
|
||||
before: Optional[datetime] = None,
|
||||
after: Optional[datetime] = None,
|
||||
cursor: Optional[datetime] = None,
|
||||
):
|
||||
"""
|
||||
Get the activity from a given stream in an Activity collection. Step into the activity `items` for the list of activity.
|
||||
Get the activity from a given stream in an Activity collection.
|
||||
Step into the activity `items` for the list of activity.
|
||||
|
||||
Note: all timestamps arguments should be `datetime` of any tz as they will be converted to UTC ISO format strings
|
||||
Note: all timestamps arguments should be `datetime` of any tz
|
||||
as they will be converted to UTC ISO format strings
|
||||
|
||||
stream_id {str} -- the id of the stream to get activity from
|
||||
action_type {str} -- filter results to a single action type (eg: `commit_create` or `commit_receive`)
|
||||
action_type {str}
|
||||
-- filter results to a single action type
|
||||
(eg: `commit_create` or `commit_receive`)
|
||||
limit {int} -- max number of Activity items to return
|
||||
before {datetime} -- latest cutoff for activity (ie: return all activity _before_ this time)
|
||||
after {datetime} -- oldest cutoff for activity (ie: return all activity _after_ this time)
|
||||
before {datetime}
|
||||
-- latest cutoff for activity (ie: return all activity _before_ this time)
|
||||
after {datetime}
|
||||
-- oldest cutoff for activity (ie: return all activity _after_ this time)
|
||||
cursor {datetime} -- timestamp cursor for pagination
|
||||
"""
|
||||
query = gql(
|
||||
"""
|
||||
query StreamActivity($stream_id: String!, $action_type: String, $before:DateTime, $after: DateTime, $cursor: DateTime, $limit: Int){
|
||||
query StreamActivity(
|
||||
$stream_id: String!,
|
||||
$action_type: String,
|
||||
$before:DateTime,
|
||||
$after: DateTime,
|
||||
$cursor: DateTime,
|
||||
$limit: Int
|
||||
){
|
||||
stream(id: $stream_id) {
|
||||
activity(actionType: $action_type, before: $before, after: $after, cursor: $cursor, limit: $limit) {
|
||||
activity(
|
||||
actionType: $action_type,
|
||||
before: $before,
|
||||
after: $after,
|
||||
cursor: $cursor,
|
||||
limit: $limit
|
||||
) {
|
||||
totalCount
|
||||
cursor
|
||||
items {
|
||||
|
@ -766,7 +814,7 @@ class Resource(ResourceBase):
|
|||
raise SpeckleException(
|
||||
"Could not get stream activity - `before`, `after`, and `cursor` must"
|
||||
" be in `datetime` format if provided",
|
||||
ValueError,
|
||||
ValueError(),
|
||||
) from e
|
||||
|
||||
return self.make_request(
|
||||
|
|
|
@ -71,7 +71,9 @@ class Resource(ResourceBase):
|
|||
def search(
|
||||
self, search_query: str, limit: int = 25
|
||||
) -> Union[List[User], SpeckleException]:
|
||||
"""Searches for user by name or email. The search query must be at least 3 characters long
|
||||
"""
|
||||
Searches for user by name or email.
|
||||
The search query must be at least 3 characters long
|
||||
|
||||
Arguments:
|
||||
search_query {str} -- a string to search for
|
||||
|
@ -160,24 +162,43 @@ class Resource(ResourceBase):
|
|||
cursor: Optional[datetime] = None,
|
||||
):
|
||||
"""
|
||||
Get the activity from a given stream in an Activity collection. Step into the activity `items` for the list of activity.
|
||||
If no id argument is provided, will return the current authenticated user's activity (as extracted from the authorization header).
|
||||
Get the activity from a given stream in an Activity collection.
|
||||
Step into the activity `items` for the list of activity.
|
||||
If no id argument is provided, will return the current authenticated
|
||||
user's activity (as extracted from the authorization header).
|
||||
|
||||
Note: all timestamps arguments should be `datetime` of any tz as they will be converted to UTC ISO format strings
|
||||
Note: all timestamps arguments should be `datetime` of any tz as
|
||||
they will be converted to UTC ISO format strings
|
||||
|
||||
user_id {str} -- the id of the user to get the activity from
|
||||
action_type {str} -- filter results to a single action type (eg: `commit_create` or `commit_receive`)
|
||||
action_type {str} -- filter results to a single action type
|
||||
(eg: `commit_create` or `commit_receive`)
|
||||
limit {int} -- max number of Activity items to return
|
||||
before {datetime} -- latest cutoff for activity (ie: return all activity _before_ this time)
|
||||
after {datetime} -- oldest cutoff for activity (ie: return all activity _after_ this time)
|
||||
before {datetime}
|
||||
-- latest cutoff for activity (ie: return all activity _before_ this time)
|
||||
after {datetime}
|
||||
-- oldest cutoff for activity (ie: return all activity _after_ this time)
|
||||
cursor {datetime} -- timestamp cursor for pagination
|
||||
"""
|
||||
|
||||
query = gql(
|
||||
"""
|
||||
query UserActivity($user_id: String, $action_type: String, $before:DateTime, $after: DateTime, $cursor: DateTime, $limit: Int){
|
||||
query UserActivity(
|
||||
$user_id: String,
|
||||
$action_type: String,
|
||||
$before:DateTime,
|
||||
$after: DateTime,
|
||||
$cursor: DateTime,
|
||||
$limit: Int
|
||||
){
|
||||
user(id: $user_id) {
|
||||
activity(actionType: $action_type, before: $before, after: $after, cursor: $cursor, limit: $limit) {
|
||||
activity(
|
||||
actionType: $action_type,
|
||||
before: $before,
|
||||
after: $after,
|
||||
cursor: $cursor,
|
||||
limit: $limit
|
||||
) {
|
||||
totalCount
|
||||
cursor
|
||||
items {
|
||||
|
@ -219,7 +240,8 @@ class Resource(ResourceBase):
|
|||
Requires Speckle Server version >= 2.6.4
|
||||
|
||||
Returns:
|
||||
List[PendingStreamCollaborator] -- a list of pending invites for the current user
|
||||
List[PendingStreamCollaborator]
|
||||
-- a list of pending invites for the current user
|
||||
"""
|
||||
metrics.track(metrics.INVITE, self.account, {"name": "get"})
|
||||
self._check_invites_supported()
|
||||
|
@ -266,7 +288,8 @@ class Resource(ResourceBase):
|
|||
token {str} -- the token of the invite to look for (optional)
|
||||
|
||||
Returns:
|
||||
PendingStreamCollaborator -- the invite for the given stream (or None if it isn't found)
|
||||
PendingStreamCollaborator
|
||||
-- the invite for the given stream (or None if it isn't found)
|
||||
"""
|
||||
metrics.track(metrics.INVITE, self.account, {"name": "get"})
|
||||
self._check_invites_supported()
|
||||
|
|
|
@ -60,7 +60,7 @@ def set_host_app(host_app: str, host_app_version: Optional[str] = None):
|
|||
|
||||
def track(
|
||||
action: str,
|
||||
account: Optional["Account"] = None,
|
||||
account,
|
||||
custom_props: Optional[dict] = None,
|
||||
):
|
||||
if not TRACK:
|
||||
|
@ -88,7 +88,7 @@ def track(
|
|||
LOG.debug(f"Error queueing metrics request: {str(ex)}")
|
||||
|
||||
|
||||
def initialise_tracker(account: Optional["Account"] = None):
|
||||
def initialise_tracker(account=None):
|
||||
global METRICS_TRACKER
|
||||
if not METRICS_TRACKER:
|
||||
METRICS_TRACKER = MetricsTracker()
|
||||
|
|
|
@ -4,15 +4,6 @@ from typing import Dict, List, Optional
|
|||
from pydantic import BaseModel
|
||||
from pydantic.config import Extra
|
||||
|
||||
# __________________
|
||||
# | |
|
||||
# | this is v wip |
|
||||
# | pls be careful |
|
||||
# |__________________|
|
||||
# (\__/) ||
|
||||
# (•ㅅ•) ||
|
||||
# / づ
|
||||
|
||||
|
||||
class AbstractTransport(ABC, BaseModel):
|
||||
_name: str = "Abstract"
|
||||
|
@ -28,7 +19,9 @@ class AbstractTransport(ABC, BaseModel):
|
|||
|
||||
@abstractmethod
|
||||
def end_write(self) -> None:
|
||||
"""Optional: signals to the transport that no more items will need to be written."""
|
||||
"""
|
||||
Optional: signals to the transport that no more items will need to be written.
|
||||
"""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
|
@ -49,7 +42,8 @@ class AbstractTransport(ABC, BaseModel):
|
|||
|
||||
Arguments:
|
||||
id {str} -- the hash of the object
|
||||
source_transport {AbstractTransport) -- the transport through which the object can be found
|
||||
source_transport {AbstractTransport)
|
||||
-- the transport through which the object can be found
|
||||
"""
|
||||
pass
|
||||
|
||||
|
@ -61,7 +55,8 @@ class AbstractTransport(ABC, BaseModel):
|
|||
id {str} -- the hash of the object
|
||||
|
||||
Returns:
|
||||
str -- the full string representation of the object (or null if no object is found)
|
||||
str -- the full string representation
|
||||
of the object (or null if no object is found)
|
||||
"""
|
||||
pass
|
||||
|
||||
|
@ -73,7 +68,8 @@ class AbstractTransport(ABC, BaseModel):
|
|||
id_list -- List of object id to be checked
|
||||
|
||||
Returns:
|
||||
Dict[str, bool] -- keys: input ids, values: whether the transport has that object
|
||||
Dict[str, bool] -- keys: input ids, values:
|
||||
whether the transport has that object
|
||||
"""
|
||||
pass
|
||||
|
||||
|
@ -85,7 +81,8 @@ class AbstractTransport(ABC, BaseModel):
|
|||
|
||||
Arguments:
|
||||
id {str} -- the id of the object you want to copy
|
||||
target_transport {AbstractTransport} -- the transport you want to copy the object to
|
||||
target_transport {AbstractTransport}
|
||||
-- the transport you want to copy the object to
|
||||
Returns:
|
||||
str -- the string representation of the root object
|
||||
"""
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
from specklepy.transports.server.server import ServerTransport
|
||||
|
||||
|
||||
__all__ = ["ServerTransport"]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import json
|
||||
from pathlib import Path
|
||||
from typing import Generator, Iterable
|
||||
from typing import Iterable
|
||||
|
||||
import pytest
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче