mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-17 02:49:12 +00:00
Fix Ruff UP006 (deprecated annotation symbols)
This commit is contained in:
@@ -44,7 +44,7 @@ router = APIRouter(route_class=LoggingRoute)
|
||||
|
||||
|
||||
@router.get("/bcf/3.0/projects", tags=["projects_get"])
|
||||
def projects_get(current_user: User = Depends(get_current_active_user)) -> List[ProjectGET]:
|
||||
def projects_get(current_user: User = Depends(get_current_active_user)) -> list[ProjectGET]:
|
||||
projects_response = bcf_db.get_projects(current_user)
|
||||
bcf_db.debug(
|
||||
endpoint="projects_get",
|
||||
@@ -90,7 +90,7 @@ def project_extensions_get(project_id: UUID, current_user: User = Depends(get_cu
|
||||
|
||||
|
||||
@router.get("/bcf/3.0/projects/{project_id}/topics", tags=["topics_get"])
|
||||
def topics_get(project_id: str, current_user: User = Depends(get_current_active_user)) -> List[TopicGET]:
|
||||
def topics_get(project_id: str, current_user: User = Depends(get_current_active_user)) -> list[TopicGET]:
|
||||
topics_response = bcf_db.get_topics(project_id, current_user)
|
||||
bcf_db.debug(
|
||||
endpoint="topics_get",
|
||||
@@ -198,7 +198,7 @@ def bim_snippet_put(
|
||||
@router.get("/bcf/3.0/projects/{project_id}/files_information", tags=["files_information_get"])
|
||||
def files_information_get(
|
||||
project_id: UUID, current_user: User = Depends(get_current_active_user)
|
||||
) -> List[ProjectFileInformation]:
|
||||
) -> list[ProjectFileInformation]:
|
||||
files_information_response = bcf_db.get_files_information(project_id, current_user)
|
||||
bcf_db.debug(
|
||||
endpoint="files_information_get",
|
||||
@@ -210,7 +210,7 @@ def files_information_get(
|
||||
|
||||
# Implemented
|
||||
@router.get("/bcf/3.0/projects/{project_id}/topics/{topic_id}/files", tags=["files_get"])
|
||||
def files_get(project_id: UUID, topic_id: UUID, current_user: User = Depends(get_current_active_user)) -> List[FileGET]:
|
||||
def files_get(project_id: UUID, topic_id: UUID, current_user: User = Depends(get_current_active_user)) -> list[FileGET]:
|
||||
files_response = bcf_db.get_files(project_id, topic_id, current_user)
|
||||
bcf_db.debug(
|
||||
endpoint="files_get",
|
||||
@@ -223,8 +223,8 @@ def files_get(project_id: UUID, topic_id: UUID, current_user: User = Depends(get
|
||||
# request body file = FilePUT
|
||||
@router.put("/bcf/3.0/projects/{project_id}/topics/{topic_id}/files", tags=["files_put"], status_code=200)
|
||||
def files_put(
|
||||
project_id: UUID, topic_id: UUID, files: List[FilePUT], current_user: User = Depends(get_current_active_user)
|
||||
) -> List[FileGET]:
|
||||
project_id: UUID, topic_id: UUID, files: list[FilePUT], current_user: User = Depends(get_current_active_user)
|
||||
) -> list[FileGET]:
|
||||
files_response = bcf_db.put_files(project_id, topic_id, files, current_user)
|
||||
bcf_db.debug(
|
||||
endpoint="files_put",
|
||||
@@ -247,7 +247,7 @@ def files_put(
|
||||
@router.get("/bcf/3.0/projects/{project_id}/topics/{topic_id}/comments", tags=["comments_get"])
|
||||
def comments_get(
|
||||
project_id: UUID, topic_id: UUID, current_user: User = Depends(get_current_active_user)
|
||||
) -> List[CommentGET]:
|
||||
) -> list[CommentGET]:
|
||||
comments_response = bcf_db.get_comments(project_id, topic_id, current_user)
|
||||
bcf_db.debug(
|
||||
endpoint="comments_get",
|
||||
@@ -331,7 +331,7 @@ def comment_delete(
|
||||
@router.get("/bcf/3.0/projects/{project_id}/topics/{topic_id}/viewpoints", tags=["viewpoints_get"])
|
||||
def viewpoints_get(
|
||||
project_id: UUID, topic_id: UUID, current_user: User = Depends(get_current_active_user)
|
||||
) -> List[ViewpointGET]:
|
||||
) -> list[ViewpointGET]:
|
||||
viewpoints_response = bcf_db.get_viewpoints(project_id, topic_id, current_user)
|
||||
bcf_db.debug(
|
||||
endpoint="viewpoints_get",
|
||||
@@ -495,7 +495,7 @@ def viewpoint_delete(
|
||||
@router.get("/bcf/3.0/projects/{project_id}/topics/{topic_id}/related_topics", tags=["related_topics_get"])
|
||||
def related_topics_get(
|
||||
project_id: UUID, topic_id: UUID, current_user: User = Depends(get_current_active_user)
|
||||
) -> List[RelatedTopicGET]:
|
||||
) -> list[RelatedTopicGET]:
|
||||
related_topics_response = bcf_db.get_related_topics(project_id, topic_id, current_user)
|
||||
bcf_db.debug(
|
||||
endpoint="related_topics_get",
|
||||
@@ -512,9 +512,9 @@ def related_topics_get(
|
||||
def related_topics_put(
|
||||
project_id: UUID,
|
||||
topic_id: UUID,
|
||||
related_topics: List[RelatedTopicPUT],
|
||||
related_topics: list[RelatedTopicPUT],
|
||||
current_user: User = Depends(get_current_active_user),
|
||||
) -> List[RelatedTopicGET]:
|
||||
) -> list[RelatedTopicGET]:
|
||||
related_topics_response = bcf_db.put_related_topics(project_id, topic_id, related_topics, current_user)
|
||||
bcf_db.debug(
|
||||
endpoint="related_topics_put",
|
||||
@@ -539,7 +539,7 @@ def related_topics_put(
|
||||
)
|
||||
def topic_document_references_get(
|
||||
project_id: UUID, topic_id: UUID, current_user: User = Depends(get_current_active_user)
|
||||
) -> List[DocumentReferenceGET]:
|
||||
) -> list[DocumentReferenceGET]:
|
||||
topic_document_references_response = bcf_db.get_topic_document_references(project_id, topic_id, current_user)
|
||||
bcf_db.debug(
|
||||
endpoint="topic_document_references_get",
|
||||
@@ -608,7 +608,7 @@ def topic_document_references_put(
|
||||
|
||||
|
||||
@router.get("/bcf/3.0/projects/{project_id}/documents", tags=["documents_get"])
|
||||
def documents_get(project_id: UUID, current_user: User = Depends(get_current_active_user)) -> List[DocumentGET]:
|
||||
def documents_get(project_id: UUID, current_user: User = Depends(get_current_active_user)) -> list[DocumentGET]:
|
||||
documents_response = bcf_db.get_documents(project_id, current_user)
|
||||
bcf_db.debug(
|
||||
endpoint="documents_get",
|
||||
@@ -649,7 +649,7 @@ def document_get(
|
||||
|
||||
# ...
|
||||
@router.get("/bcf/3.0/projects/{project_id}/topics/events", tags=["topics_events_get"])
|
||||
def topics_events_get(project_id: UUID, current_user: User = Depends(get_current_active_user)) -> List[TopicEventGET]:
|
||||
def topics_events_get(project_id: UUID, current_user: User = Depends(get_current_active_user)) -> list[TopicEventGET]:
|
||||
topic_events_response = bcf_db.get_topics_events(project_id, current_user)
|
||||
bcf_db.debug(
|
||||
endpoint="topics_events_get",
|
||||
@@ -662,7 +662,7 @@ def topics_events_get(project_id: UUID, current_user: User = Depends(get_current
|
||||
@router.get("/bcf/3.0/projects/{project_id}/topics/{topic_id}/events", tags=["topic_events_get"])
|
||||
def topic_events_get(
|
||||
project_id: UUID, topic_id: UUID, current_user: User = Depends(get_current_active_user)
|
||||
) -> List[TopicEventGET]:
|
||||
) -> list[TopicEventGET]:
|
||||
topic_events_response = bcf_db.get_topic_events(project_id, topic_id, current_user)
|
||||
bcf_db.debug(
|
||||
endpoint="topic_events_get",
|
||||
@@ -681,7 +681,7 @@ def topic_events_get(
|
||||
@router.get("/bcf/3.0/projects/{project_id}/topics/comments/events", tags=["comments_events_get"])
|
||||
def comments_events_get(
|
||||
project_id: UUID, current_user: User = Depends(get_current_active_user)
|
||||
) -> List[CommentEventGET]:
|
||||
) -> list[CommentEventGET]:
|
||||
comments_events_response = bcf_db.get_comments_events(project_id, current_user)
|
||||
bcf_db.debug(
|
||||
endpoint="comments_events_get",
|
||||
@@ -696,7 +696,7 @@ def comments_events_get(
|
||||
)
|
||||
def comment_events_get(
|
||||
project_id: UUID, topic_id: UUID, comment_id: UUID, current_user: User = Depends(get_current_active_user)
|
||||
) -> List[CommentEventGET]:
|
||||
) -> list[CommentEventGET]:
|
||||
comment_events_response = bcf_db.get_comment_events(project_id, topic_id, comment_id, current_user)
|
||||
bcf_db.debug(
|
||||
endpoint="comment_events_get",
|
||||
|
||||
@@ -415,8 +415,8 @@ def upload_cancellation(upload_session: str, current_user: User = Depends(get_cu
|
||||
|
||||
@router.post("/documents/1.0/document-versions", tags=[""])
|
||||
def document_versions_post(
|
||||
document_ids: List[UUID], current_user: User = Depends(get_current_active_user)
|
||||
) -> List[DocumentVersion]:
|
||||
document_ids: list[UUID], current_user: User = Depends(get_current_active_user)
|
||||
) -> list[DocumentVersion]:
|
||||
|
||||
document_versions = list()
|
||||
for document_id in document_ids:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from pydantic import BaseModel
|
||||
from typing import List, Optional
|
||||
from typing import Optional
|
||||
from enum import Enum
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ class Component(BaseModel):
|
||||
|
||||
class Coloring(BaseModel):
|
||||
color: Optional[str] = None
|
||||
components: Optional[List[Component]] = None
|
||||
components: Optional[list[Component]] = None
|
||||
|
||||
|
||||
class ViewSetupHints(BaseModel):
|
||||
@@ -83,5 +83,5 @@ class ViewSetupHints(BaseModel):
|
||||
|
||||
class Visibility(BaseModel):
|
||||
default_visibility: Optional[bool] = False
|
||||
exceptions: Optional[List[Component]] = None
|
||||
exceptions: Optional[list[Component]] = None
|
||||
view_setup_hints: Optional[ViewSetupHints] = None
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from pydantic import BaseModel
|
||||
from typing import List, Optional
|
||||
from typing import Optional
|
||||
from models.bcf_common import BimSnippet, BitmapType, Location, Direction, SnapshotType, Component
|
||||
from models.bcf_common import Coloring, OrthogonalCamera, Visibility, PerspectiveCamera, Line, ClippingPlane
|
||||
|
||||
@@ -12,11 +12,11 @@ class TopicPOST(BaseModel):
|
||||
guid: Optional[str] = None
|
||||
topic_type: Optional[str] = None
|
||||
topic_status: Optional[str] = None
|
||||
reference_links: Optional[List[str]] = None
|
||||
reference_links: Optional[list[str]] = None
|
||||
title: str
|
||||
priority: Optional[str] = None
|
||||
index: Optional[int] = None
|
||||
labels: Optional[List[str]] = None
|
||||
labels: Optional[list[str]] = None
|
||||
assigned_to: Optional[str] = None
|
||||
stage: Optional[str] = None
|
||||
description: Optional[str] = None
|
||||
@@ -27,11 +27,11 @@ class TopicPOST(BaseModel):
|
||||
class TopicPUT(BaseModel):
|
||||
topic_type: Optional[str] = None
|
||||
topic_status: Optional[str] = None
|
||||
reference_links: Optional[List[str]] = None
|
||||
reference_links: Optional[list[str]] = None
|
||||
title: str
|
||||
priority: Optional[str] = None
|
||||
index: Optional[int] = None
|
||||
labels: Optional[List[str]] = None
|
||||
labels: Optional[list[str]] = None
|
||||
assigned_to: Optional[str] = None
|
||||
stage: Optional[str] = None
|
||||
description: Optional[str] = None
|
||||
@@ -74,8 +74,8 @@ class SnapshotPOST(BaseModel):
|
||||
|
||||
|
||||
class Components(BaseModel):
|
||||
selection: Optional[List[Component]] = None
|
||||
coloring: Optional[List[Coloring]] = None
|
||||
selection: Optional[list[Component]] = None
|
||||
coloring: Optional[list[Coloring]] = None
|
||||
visibility: Optional[Visibility] = None
|
||||
|
||||
|
||||
@@ -84,9 +84,9 @@ class ViewpointPOST(BaseModel):
|
||||
index: Optional[int] = None
|
||||
orthogonal_camera: Optional[OrthogonalCamera] = None
|
||||
perspective_camera: Optional[PerspectiveCamera] = None
|
||||
lines: Optional[List[Line]] = None
|
||||
clipping_planes: Optional[List[ClippingPlane]] = None
|
||||
bitmaps: Optional[List[BitmapPOST]] = None
|
||||
lines: Optional[list[Line]] = None
|
||||
clipping_planes: Optional[list[ClippingPlane]] = None
|
||||
bitmaps: Optional[list[BitmapPOST]] = None
|
||||
snapshot: Optional[SnapshotPOST] = None
|
||||
components: Optional[Components] = None
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ class ProjectAction(Enum):
|
||||
|
||||
|
||||
class ProjectGETAuthorization(BaseModel):
|
||||
project_actions: Optional[List[ProjectAction]] = None
|
||||
project_actions: Optional[list[ProjectAction]] = None
|
||||
|
||||
|
||||
class ProjectGET(BaseModel):
|
||||
@@ -34,22 +34,22 @@ class CommentAction(Enum):
|
||||
|
||||
|
||||
class ExtensionsGET(BaseModel):
|
||||
topic_type: List[str]
|
||||
custom_information: List[str]
|
||||
topic_status: List[str]
|
||||
topic_label: List[str]
|
||||
snippet_type: List[str]
|
||||
priority: List[str]
|
||||
users: List[str]
|
||||
stage: List[str]
|
||||
project_actions: Optional[List[str]] = None
|
||||
topic_actions: Optional[List[str]] = None
|
||||
comment_actions: Optional[List[str]] = None
|
||||
topic_type: list[str]
|
||||
custom_information: list[str]
|
||||
topic_status: list[str]
|
||||
topic_label: list[str]
|
||||
snippet_type: list[str]
|
||||
priority: list[str]
|
||||
users: list[str]
|
||||
stage: list[str]
|
||||
project_actions: Optional[list[str]] = None
|
||||
topic_actions: Optional[list[str]] = None
|
||||
comment_actions: Optional[list[str]] = None
|
||||
|
||||
|
||||
class TopicGETAuthorization(BaseModel):
|
||||
topic_actions: Optional[List[TopicAction]] = None
|
||||
topic_status: Optional[List[str]] = None
|
||||
topic_actions: Optional[list[TopicAction]] = None
|
||||
topic_status: Optional[list[str]] = None
|
||||
|
||||
|
||||
class TopicGET(BaseModel):
|
||||
@@ -57,11 +57,11 @@ class TopicGET(BaseModel):
|
||||
server_assigned_id: str
|
||||
topic_type: Optional[str] = None
|
||||
topic_status: Optional[str] = None
|
||||
reference_links: Optional[List[str]] = None
|
||||
reference_links: Optional[list[str]] = None
|
||||
title: str
|
||||
priority: Optional[str] = None
|
||||
index: Optional[int] = None
|
||||
labels: Optional[List[str]] = None
|
||||
labels: Optional[list[str]] = None
|
||||
creation_date: str
|
||||
creation_author: str
|
||||
modified_date: Optional[str] = None
|
||||
@@ -88,12 +88,12 @@ class FileGET(BaseModel):
|
||||
|
||||
|
||||
class ProjectFileInformation(BaseModel):
|
||||
display_information: Optional[List[ProjectFileDisplayInformation]] = None
|
||||
display_information: Optional[list[ProjectFileDisplayInformation]] = None
|
||||
file: Optional[FileGET] = None
|
||||
|
||||
|
||||
class CommentGETAuthorization(BaseModel):
|
||||
comment_actions: Optional[List[CommentAction]] = None
|
||||
comment_actions: Optional[list[CommentAction]] = None
|
||||
|
||||
|
||||
class CommentGET(BaseModel):
|
||||
@@ -127,7 +127,7 @@ class ViewpointAction(Enum):
|
||||
|
||||
|
||||
class ViewpointGETAuthorization(BaseModel):
|
||||
viewpoint_actions: Optional[List[ViewpointAction]] = None
|
||||
viewpoint_actions: Optional[list[ViewpointAction]] = None
|
||||
|
||||
|
||||
class ViewpointGET(BaseModel):
|
||||
@@ -135,19 +135,19 @@ class ViewpointGET(BaseModel):
|
||||
guid: str
|
||||
orthogonal_camera: Optional[OrthogonalCamera] = None
|
||||
perspective_camera: Optional[PerspectiveCamera] = None
|
||||
lines: Optional[List[Line]] = None
|
||||
clipping_planes: Optional[List[ClippingPlane]] = None
|
||||
bitmaps: Optional[List[BitmapGET]] = None
|
||||
lines: Optional[list[Line]] = None
|
||||
clipping_planes: Optional[list[ClippingPlane]] = None
|
||||
bitmaps: Optional[list[BitmapGET]] = None
|
||||
snapshot: Optional[SnapshotGET] = None
|
||||
authorization: Optional[ViewpointGETAuthorization] = None
|
||||
|
||||
|
||||
class ColoringGET(BaseModel):
|
||||
coloring: Optional[List[Coloring]] = None
|
||||
coloring: Optional[list[Coloring]] = None
|
||||
|
||||
|
||||
class SelectionGET(BaseModel):
|
||||
selection: Optional[List[Component]] = None
|
||||
selection: Optional[list[Component]] = None
|
||||
|
||||
|
||||
class VisibilityGET(BaseModel):
|
||||
@@ -176,7 +176,7 @@ class TopicEventGET(BaseModel):
|
||||
author: str
|
||||
|
||||
|
||||
# actions: Optional[List[EventAction]] = Field(None, min_items=1)
|
||||
# actions: Optional[list[EventAction]] = Field(None, min_items=1)
|
||||
|
||||
|
||||
class CommentEventGET(BaseModel):
|
||||
@@ -186,7 +186,7 @@ class CommentEventGET(BaseModel):
|
||||
author: str
|
||||
|
||||
|
||||
# actions: Optional[List[EventAction]] = Field(None, min_items=1)
|
||||
# actions: Optional[list[EventAction]] = Field(None, min_items=1)
|
||||
|
||||
|
||||
# ---- maybe not necessary now
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from pydantic import BaseModel, Field, constr
|
||||
from typing import List, Optional
|
||||
from typing import Optional
|
||||
|
||||
|
||||
# This file contains models used in both requests and responses during upload and download of documents.
|
||||
@@ -80,7 +80,7 @@ class Document(BaseModel):
|
||||
example="908e1cd4-2e09-11ee-be56-0242ac120003",
|
||||
)
|
||||
file_description: FileDescription
|
||||
parts: Optional[List[str]]
|
||||
parts: Optional[list[str]]
|
||||
|
||||
|
||||
class DocumentVersion(Document):
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import List, Optional
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel
|
||||
from models.documents_common import Document, DocumentVersion
|
||||
|
||||
@@ -10,7 +10,7 @@ from models.documents_common import Document, DocumentVersion
|
||||
|
||||
|
||||
class DocumentQuery(BaseModel):
|
||||
document_ids: List[str]
|
||||
document_ids: list[str]
|
||||
|
||||
|
||||
class DocumentUpload(Document):
|
||||
@@ -19,8 +19,8 @@ class DocumentUpload(Document):
|
||||
|
||||
|
||||
class MetadataForDocumentsSaved(BaseModel):
|
||||
documents: Optional[List[str]]
|
||||
documents: Optional[list[str]]
|
||||
|
||||
|
||||
class DocumentQueryResult(BaseModel):
|
||||
versions: List[DocumentVersion]
|
||||
versions: list[DocumentVersion]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from pydantic import BaseModel, Field
|
||||
from typing import List, Optional
|
||||
from typing import Optional
|
||||
|
||||
from models.documents_common import CallbackLink, Document
|
||||
from models.documents_request import FileToUpload, DocumentMetadataEntry
|
||||
@@ -24,23 +24,23 @@ class DataForUploadDocuments(BaseModel):
|
||||
"and folder the user was on. If the client provides the `server_context` in subsequent calls then "
|
||||
"the CDE will attemp to load the UI at the same place."
|
||||
)
|
||||
documents: List[FileToUpload]
|
||||
documents: list[FileToUpload]
|
||||
callback: Optional[CallbackLink]
|
||||
current_user: Optional[User]
|
||||
projects: List[ProjectOnly]
|
||||
projects: list[ProjectOnly]
|
||||
|
||||
|
||||
# ---- DOWNLOAD MODELS ----
|
||||
|
||||
|
||||
class DocumentMetadataEntries(BaseModel):
|
||||
metadata: List[DocumentMetadataEntry] = Field(description="An array of metadata entries")
|
||||
metadata: list[DocumentMetadataEntry] = Field(description="An array of metadata entries")
|
||||
|
||||
|
||||
class Project(BaseModel):
|
||||
project_id: str
|
||||
name: str
|
||||
documents: Optional[List[Document]] = Field(
|
||||
documents: Optional[list[Document]] = Field(
|
||||
description="An array containing all the documents selected by the user"
|
||||
)
|
||||
|
||||
@@ -51,7 +51,7 @@ class DataForDocumentSelection(BaseModel):
|
||||
"and folder the user was on. If the client provides the `server_context` in subsequent calls then "
|
||||
"the CDE will attemp to load the UI at the same place."
|
||||
)
|
||||
projects: List[Project]
|
||||
projects: list[Project]
|
||||
callback: Optional[CallbackLink]
|
||||
current_user: Optional[User]
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from pydantic import BaseModel, Field, constr
|
||||
from typing import List, Optional
|
||||
from typing import Optional
|
||||
from enum import Enum
|
||||
|
||||
from models.documents_common import CallbackLink
|
||||
@@ -32,7 +32,7 @@ class UploadDocuments(BaseModel):
|
||||
"and folder the user was on. If the client provides the `server_context` in subsequent calls then "
|
||||
"the CDE will attemp to load the UI at the same place."
|
||||
)
|
||||
files: List[FileToUpload]
|
||||
files: list[FileToUpload]
|
||||
|
||||
|
||||
class UploadFileDetail(BaseModel):
|
||||
@@ -44,7 +44,7 @@ class UploadFileDetail(BaseModel):
|
||||
|
||||
|
||||
class UploadFileDetails(BaseModel):
|
||||
files: List[UploadFileDetail]
|
||||
files: list[UploadFileDetail]
|
||||
|
||||
|
||||
# ---- DOWNLOAD MODELS ----
|
||||
@@ -57,7 +57,7 @@ class SelectDocuments(BaseModel):
|
||||
"and folder the user was on. If the client provides the `server_context` in subsequent calls then "
|
||||
"the CDE will attemp to load the UI at the same place."
|
||||
)
|
||||
supported_file_extensions: Optional[List[str]] = Field(
|
||||
supported_file_extensions: Optional[list[str]] = Field(
|
||||
description="The client may optionally provide an array of accepted file extensions that should be opened "
|
||||
"during this flow. The CDE server UI should make an attempt to only show files matching these "
|
||||
"extensions to the user for the download selection or help the user in selecting the desired "
|
||||
@@ -80,5 +80,5 @@ class DataType(Enum):
|
||||
|
||||
class DocumentMetadataEntry(BaseModel):
|
||||
name: constr(min_length=1) = Field(description="The name of the metadata property")
|
||||
value: List[constr(min_length=1)] = Field(description="The value of the metadata property, can be a list")
|
||||
value: list[constr(min_length=1)] = Field(description="The value of the metadata property, can be a list")
|
||||
data_type: DataType = Field(description="The data type of the items in the value array")
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from pydantic import BaseModel, Field, constr
|
||||
from typing import List, Optional
|
||||
from typing import Optional
|
||||
from enum import Enum
|
||||
|
||||
from models.documents_common import DocumentVersion, LinkData
|
||||
@@ -33,7 +33,7 @@ class HeaderValue(BaseModel):
|
||||
|
||||
|
||||
class Headers(BaseModel):
|
||||
values: List[HeaderValue]
|
||||
values: list[HeaderValue]
|
||||
|
||||
|
||||
class MultipartFormData(BaseModel):
|
||||
@@ -65,7 +65,7 @@ class DocumentToUpload(BaseModel):
|
||||
description="A client-provided identifier that allows matching the specification with the correct file on the "
|
||||
"user's machine"
|
||||
)
|
||||
upload_file_parts: List[UploadFilePartInstruction] = Field(
|
||||
upload_file_parts: list[UploadFilePartInstruction] = Field(
|
||||
description="An array of request specifications detailing how to split the file to parts and upload each part "
|
||||
"to the CDE"
|
||||
# min_length=1,
|
||||
@@ -80,7 +80,7 @@ class DocumentsToUpload(BaseModel):
|
||||
"and folder the user was on. If the client provides the `server_context` in subsequent calls then "
|
||||
"the CDE will attemp to load the UI at the same place."
|
||||
)
|
||||
documents_to_upload: Optional[List[DocumentToUpload]]
|
||||
documents_to_upload: Optional[list[DocumentToUpload]]
|
||||
|
||||
|
||||
# ---- DOWNLOAD MODELS ----
|
||||
@@ -95,7 +95,7 @@ class DocumentDiscoverySessionInitialization(BaseModel):
|
||||
|
||||
|
||||
class DocumentsMarkedAsSelected(BaseModel):
|
||||
documents: Optional[List[str]]
|
||||
documents: Optional[list[str]]
|
||||
|
||||
|
||||
class SelectedDocuments(BaseModel):
|
||||
@@ -104,7 +104,7 @@ class SelectedDocuments(BaseModel):
|
||||
"and folder the user was on. If the client provides the `server_context` in subsequent calls then "
|
||||
"the CDE will attemp to load the UI at the same place."
|
||||
)
|
||||
documents: List[DocumentVersion] = Field(description="An array containing all the documents selected by the user")
|
||||
documents: list[DocumentVersion] = Field(description="An array containing all the documents selected by the user")
|
||||
|
||||
|
||||
class DocumentMetadata(BaseModel):
|
||||
@@ -124,4 +124,4 @@ class DocumentMetadata(BaseModel):
|
||||
|
||||
|
||||
class DocumentVersions(BaseModel):
|
||||
documents: List[DocumentVersion]
|
||||
documents: list[DocumentVersion]
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
from __future__ import annotations
|
||||
from pydantic import BaseModel
|
||||
from typing import List
|
||||
|
||||
|
||||
class Token(BaseModel):
|
||||
@@ -10,7 +9,7 @@ class Token(BaseModel):
|
||||
|
||||
class TokenData(BaseModel):
|
||||
username: str | None = None
|
||||
scopes: List[str] = []
|
||||
scopes: list[str] = []
|
||||
expires: str | None = None
|
||||
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@ from models.request import *
|
||||
class BCFDB(MyDB):
|
||||
|
||||
# implemented
|
||||
def get_projects(self, current_user: User) -> List[ProjectGET]:
|
||||
def get_projects_work(tx) -> List[ProjectGET]:
|
||||
def get_projects(self, current_user: User) -> list[ProjectGET]:
|
||||
def get_projects_work(tx) -> list[ProjectGET]:
|
||||
cypher = """
|
||||
MATCH (u:User)-[r1:HAS_ACTIONS_ON]->(p:Project)
|
||||
WHERE u.username = $username
|
||||
@@ -103,8 +103,8 @@ class BCFDB(MyDB):
|
||||
|
||||
# implemented
|
||||
# returns a collection
|
||||
def get_topics(self, project_id: str, current_user: User) -> List[TopicGET]:
|
||||
def get_topics_work(tx) -> List[TopicGET]:
|
||||
def get_topics(self, project_id: str, current_user: User) -> list[TopicGET]:
|
||||
def get_topics_work(tx) -> list[TopicGET]:
|
||||
cypher = """
|
||||
MATCH (u:User)-[r1:HAS_ACTIONS_ON]->(p:Project)-[r2:HAS]->(t:Topic)
|
||||
WHERE u.username = $username
|
||||
@@ -296,8 +296,8 @@ class BCFDB(MyDB):
|
||||
|
||||
# implemented
|
||||
# returns a collection
|
||||
def get_files_information(self, project_id: UUID, current_user: User) -> List[ProjectFileInformation]:
|
||||
def get_files_information_work(tx) -> List[ProjectFileInformation]:
|
||||
def get_files_information(self, project_id: UUID, current_user: User) -> list[ProjectFileInformation]:
|
||||
def get_files_information_work(tx) -> list[ProjectFileInformation]:
|
||||
cypher = """
|
||||
MATCH (u:User)-[r1:HAS_ACTIONS_ON]->(p:Project)-[r2:CONTAINS]->(d:Document)
|
||||
WHERE u.username = $username
|
||||
@@ -363,7 +363,7 @@ class BCFDB(MyDB):
|
||||
# clients can retrieve metadata and the binary content of the file.
|
||||
#
|
||||
# class ProjectFileInformation(BaseModel):
|
||||
# display_information: Optional[List[ProjectFileDisplayInformation]] = None
|
||||
# display_information: Optional[list[ProjectFileDisplayInformation]] = None
|
||||
# file: Optional[FileGET] = None
|
||||
#
|
||||
# class ProjectFileDisplayInformation(BaseModel):
|
||||
@@ -383,8 +383,8 @@ class BCFDB(MyDB):
|
||||
|
||||
# implemented
|
||||
# returns a collection
|
||||
def get_files(self, project_id: UUID, topic_id: UUID, current_user: User) -> List[FileGET]:
|
||||
def get_files_work(tx) -> List[FileGET]:
|
||||
def get_files(self, project_id: UUID, topic_id: UUID, current_user: User) -> list[FileGET]:
|
||||
def get_files_work(tx) -> list[FileGET]:
|
||||
cypher = """
|
||||
MATCH (u:User)-[r1:HAS_ACTIONS_ON]->(p:Project)-[r2:HAS]->(t:Topic)-[r3:REFERS_TO]->(f:Document:Model)
|
||||
WHERE u.username = $username
|
||||
@@ -405,7 +405,7 @@ class BCFDB(MyDB):
|
||||
return session.execute_read(get_files_work)
|
||||
|
||||
# implemented
|
||||
def put_files(self, project_id: UUID, topic_id: UUID, files: List[FilePUT], current_user: User) -> List[FileGET]:
|
||||
def put_files(self, project_id: UUID, topic_id: UUID, files: list[FilePUT], current_user: User) -> list[FileGET]:
|
||||
def put_files_work(tx) -> bool:
|
||||
cypher_delete_references = """
|
||||
MATCH (u:User)-[r1:HAS_ACTIONS_ON]->(p:Project)-[r2:HAS]->(t:Topic)-[r3:REFERS_TO]->(f:Document:Model)
|
||||
@@ -458,8 +458,8 @@ class BCFDB(MyDB):
|
||||
return self.get_files(project_id, topic_id, current_user)
|
||||
|
||||
# implemented
|
||||
def get_comments(self, project_id: UUID, topic_id: UUID, current_user: User) -> List[CommentGET]:
|
||||
def get_comments_work(tx) -> List[CommentGET]:
|
||||
def get_comments(self, project_id: UUID, topic_id: UUID, current_user: User) -> list[CommentGET]:
|
||||
def get_comments_work(tx) -> list[CommentGET]:
|
||||
cypher = """
|
||||
MATCH (u:User)-[r1:HAS_ACTIONS_ON]->(p:Project)-[r2:HAS]->(t:Topic)-[r3:HAS]->(c:Comment)
|
||||
WHERE u.username = $username
|
||||
@@ -970,8 +970,8 @@ class BCFDB(MyDB):
|
||||
|
||||
# implemented
|
||||
# returns a collection
|
||||
def get_viewpoints(self, project_id: UUID, topic_id: UUID, current_user: User) -> List[ViewpointGET]:
|
||||
def get_viewpoints_work(tx) -> List[ViewpointGET]:
|
||||
def get_viewpoints(self, project_id: UUID, topic_id: UUID, current_user: User) -> list[ViewpointGET]:
|
||||
def get_viewpoints_work(tx) -> list[ViewpointGET]:
|
||||
cypher = """
|
||||
MATCH (u:User)-[r1:HAS_ACTIONS_ON]->(p:Project)-[r2:HAS]->(t:Topic)-[r3:HAS]->(v:Viewpoint)
|
||||
WHERE u.username = $username
|
||||
@@ -1053,8 +1053,8 @@ class BCFDB(MyDB):
|
||||
|
||||
def get_viewpoint_lines(
|
||||
self, project_id: UUID, topic_id: UUID, viewpoint_id: UUID, current_user: User
|
||||
) -> List[Line]:
|
||||
def get_viewpoint_lines_work(tx) -> List[Line]:
|
||||
) -> list[Line]:
|
||||
def get_viewpoint_lines_work(tx) -> list[Line]:
|
||||
cypher = """
|
||||
MATCH (u:User)-[r1:HAS_ACTIONS_ON]->(p:Project)-[r2:HAS]->(t:Topic)-[r3:HAS]->(v:Viewpoint)-[r4:HAS]->(l:Line)
|
||||
WHERE u.username = $username
|
||||
@@ -1084,8 +1084,8 @@ class BCFDB(MyDB):
|
||||
|
||||
def get_viewpoint_clipping_planes(
|
||||
self, project_id: UUID, topic_id: UUID, viewpoint_id: UUID, current_user: User
|
||||
) -> List[ClippingPlane]:
|
||||
def get_viewpoint_clipping_planes_work(tx) -> List[ClippingPlane]:
|
||||
) -> list[ClippingPlane]:
|
||||
def get_viewpoint_clipping_planes_work(tx) -> list[ClippingPlane]:
|
||||
cypher = """
|
||||
MATCH (u:User)-[r1:HAS_ACTIONS_ON]->(p:Project)-[r2:HAS]->(t:Topic)-[r3:HAS]->(v:Viewpoint)-[r4:HAS]->(cp:ClippingPlane)
|
||||
WHERE u.username = $username
|
||||
@@ -1114,8 +1114,8 @@ class BCFDB(MyDB):
|
||||
|
||||
def get_viewpoint_bitmaps(
|
||||
self, project_id: UUID, topic_id: UUID, viewpoint_id: UUID, current_user: User
|
||||
) -> List[BitmapGET]:
|
||||
def get_viewpoint_bitmaps_work(tx) -> List[BitmapGET]:
|
||||
) -> list[BitmapGET]:
|
||||
def get_viewpoint_bitmaps_work(tx) -> list[BitmapGET]:
|
||||
cypher = """
|
||||
MATCH (u:User)-[r1:HAS_ACTIONS_ON]->(p:Project)-[r2:HAS]->(t:Topic)-[r3:HAS]->(v:Viewpoint)-[r4:HAS]->(b:Bitmap)
|
||||
WHERE u.username = $username
|
||||
@@ -1361,8 +1361,8 @@ class BCFDB(MyDB):
|
||||
|
||||
# implemented
|
||||
# returns a collection
|
||||
def get_related_topics(self, project_id: UUID, topic_id: UUID, current_user: User) -> List[TopicGET]:
|
||||
def get_related_topics_work(tx) -> List[TopicGET]:
|
||||
def get_related_topics(self, project_id: UUID, topic_id: UUID, current_user: User) -> list[TopicGET]:
|
||||
def get_related_topics_work(tx) -> list[TopicGET]:
|
||||
cypher = """
|
||||
MATCH (u:User)-[r1:HAS_ACTIONS_ON]->(p:Project)-[r2:HAS]->(t1:Topic)-[r3:RELATED_TO]->(t2:Topic)
|
||||
WHERE u.username = $username
|
||||
@@ -1384,8 +1384,8 @@ class BCFDB(MyDB):
|
||||
return session.execute_read(get_related_topics_work)
|
||||
|
||||
def put_related_topics(
|
||||
self, project_id: UUID, topic_id: UUID, related_topics: List[RelatedTopicPUT], current_user: User
|
||||
) -> List[TopicGET]:
|
||||
self, project_id: UUID, topic_id: UUID, related_topics: list[RelatedTopicPUT], current_user: User
|
||||
) -> list[TopicGET]:
|
||||
def put_related_topics_work(tx) -> bool:
|
||||
for related_topic in related_topics:
|
||||
cypher = """
|
||||
@@ -1415,8 +1415,8 @@ class BCFDB(MyDB):
|
||||
# returns a collection
|
||||
def get_topic_document_references(
|
||||
self, project_id: UUID, topic_id: UUID, current_user: User
|
||||
) -> List[DocumentReferenceGET]:
|
||||
def get_topic_document_references_work(tx) -> List[DocumentReferenceGET]:
|
||||
) -> list[DocumentReferenceGET]:
|
||||
def get_topic_document_references_work(tx) -> list[DocumentReferenceGET]:
|
||||
cypher = """
|
||||
MATCH (u:User)-[r1:HAS_ACTIONS_ON]->(p:Project)-[r2:HAS]->(t:Topic)-[r3:REFERS_TO]->(d:Document)
|
||||
WHERE u.username = $username
|
||||
@@ -1441,7 +1441,7 @@ class BCFDB(MyDB):
|
||||
|
||||
def post_topic_document_reference(
|
||||
self, project_id: UUID, topic_id: UUID, document_reference: DocumentReferencePOST, current_user: User
|
||||
) -> List[DocumentReferenceGET]:
|
||||
) -> list[DocumentReferenceGET]:
|
||||
def post_topic_document_reference_work(tx) -> bool:
|
||||
if document_reference.guid is None:
|
||||
document_reference.guid = uuid4()
|
||||
@@ -1494,7 +1494,7 @@ class BCFDB(MyDB):
|
||||
reference_id: UUID,
|
||||
document_reference: DocumentReferencePUT,
|
||||
current_user: User,
|
||||
) -> List[DocumentReferenceGET]:
|
||||
) -> list[DocumentReferenceGET]:
|
||||
document_reference.guid = reference_id
|
||||
document_reference_post = DocumentReferencePOST(document_reference)
|
||||
topic_document_references_response = self.post_topic_document_reference(
|
||||
|
||||
Reference in New Issue
Block a user