mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 09:48:32 +00:00
Fix Ruff UP006 (deprecated annotation symbols)
This commit is contained in:
@@ -70,7 +70,6 @@ select = [
|
||||
ignore = [
|
||||
"FA100", # Conflicts with Blender using annotations for props definitions.
|
||||
# Maybe will enable later:
|
||||
"UP006", # deprecated symbols
|
||||
"UP007", # Optional to X | Y
|
||||
"UP015", # Unnecessary mode argument
|
||||
"UP028", # yield for -> yield from
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
import sys
|
||||
from dataclasses import dataclass, field, fields
|
||||
from typing import List, NamedTuple, Optional
|
||||
from typing import Optional
|
||||
|
||||
|
||||
DATACLASS_KWARGS = {} if sys.version_info < (3, 10) else {"slots": True, "kw_only": True}
|
||||
@@ -27,7 +27,7 @@ class ExtensionsPriorities:
|
||||
class Meta:
|
||||
global_type = False
|
||||
|
||||
priority: List[str] = field(
|
||||
priority: list[str] = field(
|
||||
default_factory=list,
|
||||
metadata={
|
||||
"name": "Priority",
|
||||
@@ -44,7 +44,7 @@ class ExtensionsSnippetTypes:
|
||||
class Meta:
|
||||
global_type = False
|
||||
|
||||
snippet_type: List[str] = field(
|
||||
snippet_type: list[str] = field(
|
||||
default_factory=list,
|
||||
metadata={
|
||||
"name": "SnippetType",
|
||||
@@ -61,7 +61,7 @@ class ExtensionsStages:
|
||||
class Meta:
|
||||
global_type = False
|
||||
|
||||
stage: List[str] = field(
|
||||
stage: list[str] = field(
|
||||
default_factory=list,
|
||||
metadata={
|
||||
"name": "Stage",
|
||||
@@ -78,7 +78,7 @@ class ExtensionsTopicLabels:
|
||||
class Meta:
|
||||
global_type = False
|
||||
|
||||
topic_label: List[str] = field(
|
||||
topic_label: list[str] = field(
|
||||
default_factory=list,
|
||||
metadata={
|
||||
"name": "TopicLabel",
|
||||
@@ -95,7 +95,7 @@ class ExtensionsTopicStatuses:
|
||||
class Meta:
|
||||
global_type = False
|
||||
|
||||
topic_status: List[str] = field(
|
||||
topic_status: list[str] = field(
|
||||
default_factory=list,
|
||||
metadata={
|
||||
"name": "TopicStatus",
|
||||
@@ -112,7 +112,7 @@ class ExtensionsTopicTypes:
|
||||
class Meta:
|
||||
global_type = False
|
||||
|
||||
topic_type: List[str] = field(
|
||||
topic_type: list[str] = field(
|
||||
default_factory=list,
|
||||
metadata={
|
||||
"name": "TopicType",
|
||||
@@ -129,7 +129,7 @@ class ExtensionsUsers:
|
||||
class Meta:
|
||||
global_type = False
|
||||
|
||||
user: List[str] = field(
|
||||
user: list[str] = field(
|
||||
default_factory=list,
|
||||
metadata={
|
||||
"name": "UserIdType",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import sys
|
||||
from dataclasses import dataclass, field
|
||||
from typing import List, Optional
|
||||
from typing import Optional
|
||||
|
||||
from xsdata.models.datatype import XmlDateTime
|
||||
|
||||
@@ -263,7 +263,7 @@ class Comment:
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
class Header:
|
||||
file: List[HeaderFile] = field(
|
||||
file: list[HeaderFile] = field(
|
||||
default_factory=list,
|
||||
metadata={
|
||||
"name": "File",
|
||||
@@ -276,7 +276,7 @@ class Header:
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
class Topic:
|
||||
reference_link: List[str] = field(
|
||||
reference_link: list[str] = field(
|
||||
default_factory=list,
|
||||
metadata={
|
||||
"name": "ReferenceLink",
|
||||
@@ -308,7 +308,7 @@ class Topic:
|
||||
"namespace": "",
|
||||
},
|
||||
)
|
||||
labels: List[str] = field(
|
||||
labels: list[str] = field(
|
||||
default_factory=list,
|
||||
metadata={
|
||||
"name": "Labels",
|
||||
@@ -388,7 +388,7 @@ class Topic:
|
||||
"namespace": "",
|
||||
},
|
||||
)
|
||||
document_reference: List[TopicDocumentReference] = field(
|
||||
document_reference: list[TopicDocumentReference] = field(
|
||||
default_factory=list,
|
||||
metadata={
|
||||
"name": "DocumentReference",
|
||||
@@ -396,7 +396,7 @@ class Topic:
|
||||
"namespace": "",
|
||||
},
|
||||
)
|
||||
related_topic: List[TopicRelatedTopic] = field(
|
||||
related_topic: list[TopicRelatedTopic] = field(
|
||||
default_factory=list,
|
||||
metadata={
|
||||
"name": "RelatedTopic",
|
||||
@@ -446,7 +446,7 @@ class Markup:
|
||||
"required": True,
|
||||
}
|
||||
)
|
||||
comment: List[Comment] = field(
|
||||
comment: list[Comment] = field(
|
||||
default_factory=list,
|
||||
metadata={
|
||||
"name": "Comment",
|
||||
@@ -454,7 +454,7 @@ class Markup:
|
||||
"namespace": "",
|
||||
},
|
||||
)
|
||||
viewpoints: List[ViewPoint] = field(
|
||||
viewpoints: list[ViewPoint] = field(
|
||||
default_factory=list,
|
||||
metadata={
|
||||
"name": "Viewpoints",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import sys
|
||||
from dataclasses import dataclass, field
|
||||
from enum import Enum
|
||||
from typing import List, Optional
|
||||
from typing import Optional
|
||||
|
||||
DATACLASS_KWARGS = {} if sys.version_info < (3, 10) else {"slots": True, "kw_only": True}
|
||||
|
||||
@@ -136,7 +136,7 @@ class ComponentColoringColor:
|
||||
class Meta:
|
||||
global_type = False
|
||||
|
||||
component: List[Component] = field(
|
||||
component: list[Component] = field(
|
||||
default_factory=list,
|
||||
metadata={
|
||||
"name": "Component",
|
||||
@@ -156,7 +156,7 @@ class ComponentColoringColor:
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
class ComponentSelection:
|
||||
component: List[Component] = field(
|
||||
component: list[Component] = field(
|
||||
default_factory=list,
|
||||
metadata={
|
||||
"name": "Component",
|
||||
@@ -171,7 +171,7 @@ class ComponentVisibilityExceptions:
|
||||
class Meta:
|
||||
global_type = False
|
||||
|
||||
component: List[Component] = field(
|
||||
component: list[Component] = field(
|
||||
default_factory=list,
|
||||
metadata={
|
||||
"name": "Component",
|
||||
@@ -335,7 +335,7 @@ class VisualizationInfoBitmap:
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
class ComponentColoring:
|
||||
color: List[ComponentColoringColor] = field(
|
||||
color: list[ComponentColoringColor] = field(
|
||||
default_factory=list,
|
||||
metadata={
|
||||
"name": "Color",
|
||||
@@ -368,7 +368,7 @@ class VisualizationInfoClippingPlanes:
|
||||
class Meta:
|
||||
global_type = False
|
||||
|
||||
clipping_plane: List[ClippingPlane] = field(
|
||||
clipping_plane: list[ClippingPlane] = field(
|
||||
default_factory=list,
|
||||
metadata={
|
||||
"name": "ClippingPlane",
|
||||
@@ -382,7 +382,7 @@ class VisualizationInfoLines:
|
||||
class Meta:
|
||||
global_type = False
|
||||
|
||||
line: List[Line] = field(
|
||||
line: list[Line] = field(
|
||||
default_factory=list,
|
||||
metadata={
|
||||
"name": "Line",
|
||||
@@ -465,7 +465,7 @@ class VisualizationInfo:
|
||||
"type": "Element",
|
||||
},
|
||||
)
|
||||
bitmap: List[VisualizationInfoBitmap] = field(
|
||||
bitmap: list[VisualizationInfoBitmap] = field(
|
||||
default_factory=list,
|
||||
metadata={
|
||||
"name": "Bitmap",
|
||||
|
||||
+19
-19
@@ -25,7 +25,7 @@ import urllib.parse
|
||||
import uuid
|
||||
import webbrowser
|
||||
from re import A
|
||||
from typing import Any, Optional, Tuple
|
||||
from typing import Any, Optional
|
||||
|
||||
import requests
|
||||
|
||||
@@ -174,7 +174,7 @@ class BcfClient:
|
||||
except requests.exceptions.HTTPError as e:
|
||||
print(f"message: {response.reason}' '{response.status_code}' '{ e }")
|
||||
|
||||
def post(self, endpoint: str, data: Any = None, params: Any = None) -> Tuple[int, str]:
|
||||
def post(self, endpoint: str, data: Any = None, params: Any = None) -> tuple[int, str]:
|
||||
headers = {
|
||||
"Authorization": f"Bearer {self.foundation_client.get_access_token()}",
|
||||
"Content-type": "application/json",
|
||||
@@ -192,7 +192,7 @@ class BcfClient:
|
||||
print(f"message: {response.reason}' '{response.status_code}, {errh}")
|
||||
return response.status_code, response.reason
|
||||
|
||||
def put(self, endpoint: str, data: Any = None, params: Any = None) -> Tuple[int, str]:
|
||||
def put(self, endpoint: str, data: Any = None, params: Any = None) -> tuple[int, str]:
|
||||
headers = {
|
||||
"Authorization": f"Bearer {self.foundation_client.get_access_token()}",
|
||||
"Content-type": "application/json",
|
||||
@@ -210,7 +210,7 @@ class BcfClient:
|
||||
print(f"message: {response.reason}' '{response.status_code}, {errh}")
|
||||
return response.status_code, response.reason
|
||||
|
||||
def delete(self, endpoint: str, params: Any = None) -> Tuple[int, str]:
|
||||
def delete(self, endpoint: str, params: Any = None) -> tuple[int, str]:
|
||||
headers = {
|
||||
"Authorization": f"Bearer {self.foundation_client.get_access_token()}",
|
||||
"Content-type": "application/json",
|
||||
@@ -237,7 +237,7 @@ class BcfClient:
|
||||
},
|
||||
)
|
||||
|
||||
def update_project(self, project_id: str = "", data: Any = None) -> Tuple[int, str]:
|
||||
def update_project(self, project_id: str = "", data: Any = None) -> tuple[int, str]:
|
||||
url = f"{self.baseurl}/projects/{project_id}"
|
||||
headers = {"Authorization": f"Bearer {self.foundation_client.get_access_token()}"}
|
||||
resp = requests.put(url, headers=headers, data=data)
|
||||
@@ -276,16 +276,16 @@ class BcfClient:
|
||||
},
|
||||
)
|
||||
|
||||
def create_topic(self, project_id: str = "", data: Any = None) -> Tuple[int, str]:
|
||||
def create_topic(self, project_id: str = "", data: Any = None) -> tuple[int, str]:
|
||||
return self.post(f"/projects/{project_id}/topics", data=data)
|
||||
|
||||
def update_topic(self, project_id: str = "", topic_id: str = "", data: Any = None) -> Tuple[int, str]:
|
||||
def update_topic(self, project_id: str = "", topic_id: str = "", data: Any = None) -> tuple[int, str]:
|
||||
return self.put(f"/projects/{project_id}/topics/{topic_id}", data=data)
|
||||
|
||||
def delete_topic(self, project_id: str = "", topic_id: str = "") -> Tuple[int, str]:
|
||||
def delete_topic(self, project_id: str = "", topic_id: str = "") -> tuple[int, str]:
|
||||
return self.delete(f"/projects/{project_id}/topics/{topic_id}")
|
||||
|
||||
def get_snippet(self, project_id: str = "", topic_id: str = "") -> Tuple[int, str]:
|
||||
def get_snippet(self, project_id: str = "", topic_id: str = "") -> tuple[int, str]:
|
||||
headers = {
|
||||
"Authorization": f"Bearer {self.foundation_client.get_access_token()}",
|
||||
"Content-type": "application/octet-stream",
|
||||
@@ -332,7 +332,7 @@ class BcfClient:
|
||||
topic_id: str = "",
|
||||
data: Any = None,
|
||||
params: Any = None,
|
||||
) -> Tuple[int, str]:
|
||||
) -> tuple[int, str]:
|
||||
return self.put(
|
||||
f"/projects/{project_id}/topics/{topic_id}/files",
|
||||
data=data,
|
||||
@@ -347,7 +347,7 @@ class BcfClient:
|
||||
topic_id: str = "",
|
||||
data: Any = None,
|
||||
params: Any = None,
|
||||
) -> Tuple[int, str]:
|
||||
) -> tuple[int, str]:
|
||||
return self.post(
|
||||
f"/projects/{project_id}/topics/{topic_id}/comments",
|
||||
data=data,
|
||||
@@ -363,7 +363,7 @@ class BcfClient:
|
||||
},
|
||||
)
|
||||
|
||||
def delete_comment(self, project_id: str = "", topic_id: str = "", comment_id: str = "") -> Tuple[int, str]:
|
||||
def delete_comment(self, project_id: str = "", topic_id: str = "", comment_id: str = "") -> tuple[int, str]:
|
||||
return self.delete(f"/projects/{project_id}/topics/{topic_id}/comments/{comment_id}")
|
||||
|
||||
def update_comment(
|
||||
@@ -372,7 +372,7 @@ class BcfClient:
|
||||
topic_id: str = "",
|
||||
comment_id: str = "",
|
||||
data: Any = None,
|
||||
) -> Tuple[int, str]:
|
||||
) -> tuple[int, str]:
|
||||
return self.put(
|
||||
f"/projects/{project_id}/topics/{topic_id}/comments/{comment_id}",
|
||||
data=data,
|
||||
@@ -387,7 +387,7 @@ class BcfClient:
|
||||
},
|
||||
)
|
||||
|
||||
def create_viewpoints(self, project_id: str = "", topic_id: str = "", data: Any = None) -> Tuple[int, str]:
|
||||
def create_viewpoints(self, project_id: str = "", topic_id: str = "", data: Any = None) -> tuple[int, str]:
|
||||
return self.post(
|
||||
f"/projects/{project_id}/topics/{topic_id}/viewpoints",
|
||||
data=data,
|
||||
@@ -408,7 +408,7 @@ class BcfClient:
|
||||
project_id: str = "",
|
||||
topic_id: str = "",
|
||||
viewpoint_id: str = "",
|
||||
) -> Tuple[int, str]:
|
||||
) -> tuple[int, str]:
|
||||
return self.delete(
|
||||
f"/projects/{project_id}/topics/{topic_id}/viewpoints/{viewpoint_id}",
|
||||
)
|
||||
@@ -478,7 +478,7 @@ class BcfClient:
|
||||
project_id: str = "",
|
||||
topic_id: str = "",
|
||||
data: Any = None,
|
||||
) -> Tuple[int, str]:
|
||||
) -> tuple[int, str]:
|
||||
return self.put(
|
||||
f"/projects/{project_id}/topics/{topic_id}/related_topics",
|
||||
data=data,
|
||||
@@ -498,7 +498,7 @@ class BcfClient:
|
||||
project_id: str = "",
|
||||
topic_id: str = "",
|
||||
data: Any = None,
|
||||
) -> Tuple[int, str]:
|
||||
) -> tuple[int, str]:
|
||||
return self.post(
|
||||
f"/projects/{project_id}/topics/{topic_id}/document_references",
|
||||
data=data,
|
||||
@@ -510,7 +510,7 @@ class BcfClient:
|
||||
topic_id: str = "",
|
||||
document_reference_id: str = "",
|
||||
data: Any = None,
|
||||
) -> Tuple[int, str]:
|
||||
) -> tuple[int, str]:
|
||||
return self.put(
|
||||
f"/projects/{project_id}/topics/{topic_id}/document_references/{document_reference_id}",
|
||||
data=data,
|
||||
@@ -543,7 +543,7 @@ class BcfClient:
|
||||
|
||||
return response.status_code
|
||||
|
||||
def get_document(self, project_id: str = "", topic_id: str = "", document_id: str = "") -> Tuple[int, str]:
|
||||
def get_document(self, project_id: str = "", topic_id: str = "", document_id: str = "") -> tuple[int, str]:
|
||||
headers = {
|
||||
"Authorization": f"Bearer {self.foundation_client.get_access_token()}",
|
||||
"Content-type": "application/octet-stream",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import sys
|
||||
from dataclasses import dataclass, field
|
||||
from typing import List, Optional
|
||||
from typing import Optional
|
||||
|
||||
DATACLASS_KWARGS = {} if sys.version_info < (3, 10) else {"slots": True, "kw_only": True}
|
||||
|
||||
@@ -42,7 +42,7 @@ class DocumentInfoDocuments:
|
||||
class Meta:
|
||||
global_type = False
|
||||
|
||||
document: List[Document] = field(
|
||||
document: list[Document] = field(
|
||||
default_factory=list,
|
||||
metadata={
|
||||
"name": "Document",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import sys
|
||||
from dataclasses import dataclass, field
|
||||
from typing import List, Optional
|
||||
from typing import Optional
|
||||
|
||||
DATACLASS_KWARGS = {} if sys.version_info < (3, 10) else {"slots": True, "kw_only": True}
|
||||
|
||||
@@ -10,7 +10,7 @@ class ExtensionsPriorities:
|
||||
class Meta:
|
||||
global_type = False
|
||||
|
||||
priority: List[str] = field(
|
||||
priority: list[str] = field(
|
||||
default_factory=list,
|
||||
metadata={
|
||||
"name": "Priority",
|
||||
@@ -27,7 +27,7 @@ class ExtensionsSnippetTypes:
|
||||
class Meta:
|
||||
global_type = False
|
||||
|
||||
snippet_type: List[str] = field(
|
||||
snippet_type: list[str] = field(
|
||||
default_factory=list,
|
||||
metadata={
|
||||
"name": "SnippetType",
|
||||
@@ -44,7 +44,7 @@ class ExtensionsStages:
|
||||
class Meta:
|
||||
global_type = False
|
||||
|
||||
stage: List[str] = field(
|
||||
stage: list[str] = field(
|
||||
default_factory=list,
|
||||
metadata={
|
||||
"name": "Stage",
|
||||
@@ -61,7 +61,7 @@ class ExtensionsTopicLabels:
|
||||
class Meta:
|
||||
global_type = False
|
||||
|
||||
topic_label: List[str] = field(
|
||||
topic_label: list[str] = field(
|
||||
default_factory=list,
|
||||
metadata={
|
||||
"name": "TopicLabel",
|
||||
@@ -78,7 +78,7 @@ class ExtensionsTopicStatuses:
|
||||
class Meta:
|
||||
global_type = False
|
||||
|
||||
topic_status: List[str] = field(
|
||||
topic_status: list[str] = field(
|
||||
default_factory=list,
|
||||
metadata={
|
||||
"name": "TopicStatus",
|
||||
@@ -95,7 +95,7 @@ class ExtensionsTopicTypes:
|
||||
class Meta:
|
||||
global_type = False
|
||||
|
||||
topic_type: List[str] = field(
|
||||
topic_type: list[str] = field(
|
||||
default_factory=list,
|
||||
metadata={
|
||||
"name": "TopicType",
|
||||
@@ -112,7 +112,7 @@ class ExtensionsUsers:
|
||||
class Meta:
|
||||
global_type = False
|
||||
|
||||
user: List[str] = field(
|
||||
user: list[str] = field(
|
||||
default_factory=list,
|
||||
metadata={
|
||||
"name": "User",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import sys
|
||||
from dataclasses import dataclass, field
|
||||
from typing import List, Optional
|
||||
from typing import Optional
|
||||
|
||||
from xsdata.models.datatype import XmlDateTime
|
||||
|
||||
@@ -165,7 +165,7 @@ class TopicLabels:
|
||||
class Meta:
|
||||
global_type = False
|
||||
|
||||
label: List[str] = field(
|
||||
label: list[str] = field(
|
||||
default_factory=list,
|
||||
metadata={
|
||||
"name": "Label",
|
||||
@@ -182,7 +182,7 @@ class TopicReferenceLinks:
|
||||
class Meta:
|
||||
global_type = False
|
||||
|
||||
reference_link: List[str] = field(
|
||||
reference_link: list[str] = field(
|
||||
default_factory=list,
|
||||
metadata={
|
||||
"name": "ReferenceLink",
|
||||
@@ -320,7 +320,7 @@ class HeaderFiles:
|
||||
class Meta:
|
||||
global_type = False
|
||||
|
||||
file: List[File] = field(
|
||||
file: list[File] = field(
|
||||
default_factory=list,
|
||||
metadata={
|
||||
"name": "File",
|
||||
@@ -335,7 +335,7 @@ class TopicDocumentReferences:
|
||||
class Meta:
|
||||
global_type = False
|
||||
|
||||
document_reference: List[DocumentReference] = field(
|
||||
document_reference: list[DocumentReference] = field(
|
||||
default_factory=list,
|
||||
metadata={
|
||||
"name": "DocumentReference",
|
||||
@@ -350,7 +350,7 @@ class TopicRelatedTopics:
|
||||
class Meta:
|
||||
global_type = False
|
||||
|
||||
related_topic: List[TopicRelatedTopicsRelatedTopic] = field(
|
||||
related_topic: list[TopicRelatedTopicsRelatedTopic] = field(
|
||||
default_factory=list,
|
||||
metadata={
|
||||
"name": "RelatedTopic",
|
||||
@@ -365,7 +365,7 @@ class TopicViewpoints:
|
||||
class Meta:
|
||||
global_type = False
|
||||
|
||||
view_point: List[ViewPoint] = field(
|
||||
view_point: list[ViewPoint] = field(
|
||||
default_factory=list,
|
||||
metadata={
|
||||
"name": "ViewPoint",
|
||||
@@ -392,7 +392,7 @@ class TopicComments:
|
||||
class Meta:
|
||||
global_type = False
|
||||
|
||||
comment: List[Comment] = field(
|
||||
comment: list[Comment] = field(
|
||||
default_factory=list,
|
||||
metadata={
|
||||
"name": "Comment",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import sys
|
||||
from dataclasses import dataclass, field
|
||||
from enum import Enum
|
||||
from typing import List, Optional
|
||||
from typing import Optional
|
||||
|
||||
|
||||
DATACLASS_KWARGS = {} if sys.version_info < (3, 10) else {"slots": True, "kw_only": True}
|
||||
@@ -189,7 +189,7 @@ class ComponentColoringColorComponents:
|
||||
class Meta:
|
||||
global_type = False
|
||||
|
||||
component: List[Component] = field(
|
||||
component: list[Component] = field(
|
||||
default_factory=list,
|
||||
metadata={
|
||||
"name": "Component",
|
||||
@@ -201,7 +201,7 @@ class ComponentColoringColorComponents:
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
class ComponentSelection:
|
||||
component: List[Component] = field(
|
||||
component: list[Component] = field(
|
||||
default_factory=list,
|
||||
metadata={
|
||||
"name": "Component",
|
||||
@@ -215,7 +215,7 @@ class ComponentVisibilityExceptions:
|
||||
class Meta:
|
||||
global_type = False
|
||||
|
||||
component: List[Component] = field(
|
||||
component: list[Component] = field(
|
||||
default_factory=list,
|
||||
metadata={
|
||||
"name": "Component",
|
||||
@@ -400,7 +400,7 @@ class VisualizationInfoBitmaps:
|
||||
class Meta:
|
||||
global_type = False
|
||||
|
||||
bitmap: List[Bitmap] = field(
|
||||
bitmap: list[Bitmap] = field(
|
||||
default_factory=list,
|
||||
metadata={
|
||||
"name": "Bitmap",
|
||||
@@ -414,7 +414,7 @@ class VisualizationInfoClippingPlanes:
|
||||
class Meta:
|
||||
global_type = False
|
||||
|
||||
clipping_plane: List[ClippingPlane] = field(
|
||||
clipping_plane: list[ClippingPlane] = field(
|
||||
default_factory=list,
|
||||
metadata={
|
||||
"name": "ClippingPlane",
|
||||
@@ -428,7 +428,7 @@ class VisualizationInfoLines:
|
||||
class Meta:
|
||||
global_type = False
|
||||
|
||||
line: List[Line] = field(
|
||||
line: list[Line] = field(
|
||||
default_factory=list,
|
||||
metadata={
|
||||
"name": "Line",
|
||||
@@ -439,7 +439,7 @@ class VisualizationInfoLines:
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
class ComponentColoring:
|
||||
color: List[ComponentColoringColor] = field(
|
||||
color: list[ComponentColoringColor] = field(
|
||||
default_factory=list,
|
||||
metadata={
|
||||
"name": "Color",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""XML Parser and Serializer factories."""
|
||||
|
||||
from typing import Optional, Protocol, Type, TypeVar
|
||||
from typing import Optional, Protocol, TypeVar
|
||||
|
||||
from xsdata.formats.dataclass.context import XmlContext
|
||||
from xsdata.formats.dataclass.parsers import XmlParser
|
||||
@@ -29,7 +29,7 @@ T = TypeVar("T")
|
||||
class AbstractXmlParserSerializer(Protocol):
|
||||
"""XML Parser and serializer wrapper."""
|
||||
|
||||
def parse(self, xml: bytes, clazz: Type[T]) -> T:
|
||||
def parse(self, xml: bytes, clazz: type[T]) -> T:
|
||||
"""
|
||||
Parse an XML file to an object.
|
||||
|
||||
@@ -61,7 +61,7 @@ class XmlParserSerializer:
|
||||
self.parser = build_xml_parser(self.context)
|
||||
self.serializer = build_serializer(self.context)
|
||||
|
||||
def parse(self, xml: bytes, clazz: Type[T]) -> T:
|
||||
def parse(self, xml: bytes, clazz: type[T]) -> T:
|
||||
"""
|
||||
Parse an XML file to an object.
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ import bonsai.tool as tool
|
||||
from ifcopenshell.file import UndoSystemError
|
||||
from pathlib import Path
|
||||
from bonsai.tool.brick import BrickStore
|
||||
from typing import Set, Union, Optional, TypedDict, Callable, NotRequired, Literal
|
||||
from typing import Union, Optional, TypedDict, Callable, NotRequired, Literal
|
||||
|
||||
|
||||
IFC_CONNECTED_TYPE = Union[bpy.types.Material, bpy.types.Object]
|
||||
@@ -69,7 +69,7 @@ class IfcStore:
|
||||
cache_path: Optional[str] = None
|
||||
id_map: dict[int, IFC_CONNECTED_TYPE] = {}
|
||||
guid_map: dict[str, IFC_CONNECTED_TYPE] = {}
|
||||
edited_objs: Set[bpy.types.Object] = set()
|
||||
edited_objs: set[bpy.types.Object] = set()
|
||||
pset_template_path: str = ""
|
||||
pset_template_file: Optional[ifcopenshell.file] = None
|
||||
classification_path: str = ""
|
||||
|
||||
@@ -38,7 +38,7 @@ import ifcopenshell.util.shape
|
||||
import bonsai.tool as tool
|
||||
from bonsai.bim.ifc import IfcStore, IFC_CONNECTED_TYPE
|
||||
from bonsai.tool.loader import OBJECT_DATA_TYPE
|
||||
from typing import Dict, Union, Optional, Any, Literal, Iterable
|
||||
from typing import Union, Optional, Any, Literal, Iterable
|
||||
from ifcopenshell.util.shape import MatrixType
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ class MaterialCreator:
|
||||
obj: bpy.types.Object
|
||||
|
||||
def __init__(self, ifc_import_settings: IfcImportSettings, ifc_importer: IfcImporter):
|
||||
self.styles: Dict[int, bpy.types.Material] = {}
|
||||
self.styles: dict[int, bpy.types.Material] = {}
|
||||
self.parsed_meshes: set[str] = set()
|
||||
self.ifc_import_settings = ifc_import_settings
|
||||
self.ifc_importer = ifc_importer
|
||||
|
||||
@@ -38,7 +38,7 @@ from bonsai.bim.module.drawing.shaders import add_verts_sequence, add_offsets
|
||||
from bonsai.bim.module.drawing.helper import format_distance
|
||||
from timeit import default_timer as timer
|
||||
from functools import cache
|
||||
from typing import Optional, Iterator, Type, Union
|
||||
from typing import Optional, Iterator, Union
|
||||
|
||||
UNSPECIAL_ELEMENT_COLOR = (0.2, 0.2, 0.2, 1) # GREY
|
||||
|
||||
@@ -1895,7 +1895,7 @@ class CutDecorator:
|
||||
|
||||
|
||||
class DecorationsHandler:
|
||||
decorators_classes: list[Type[BaseDecorator]] = [
|
||||
decorators_classes: list[type[BaseDecorator]] = [
|
||||
DimensionDecorator,
|
||||
AngleDecorator,
|
||||
GridDecorator,
|
||||
|
||||
@@ -49,7 +49,7 @@ import bonsai.bim.export_ifc
|
||||
from bpy_extras.io_utils import ImportHelper
|
||||
from bonsai.bim.module.drawing.decoration import CutDecorator
|
||||
from bonsai.bim.module.drawing.data import DecoratorData
|
||||
from typing import NamedTuple, List, Union, Optional, Literal, TYPE_CHECKING, Any, TypedDict
|
||||
from typing import NamedTuple, Union, Optional, Literal, TYPE_CHECKING, Any, TypedDict
|
||||
from lxml import etree
|
||||
from math import radians
|
||||
from mathutils import Vector, Color, Matrix
|
||||
@@ -83,8 +83,8 @@ class profile:
|
||||
|
||||
|
||||
class LineworkContexts(NamedTuple):
|
||||
body: List[List[int]]
|
||||
annotation: List[List[int]]
|
||||
body: list[list[int]]
|
||||
annotation: list[list[int]]
|
||||
|
||||
|
||||
class AddAnnotationType(bpy.types.Operator, tool.Ifc.Operator):
|
||||
|
||||
@@ -42,7 +42,7 @@ from mathutils import Vector, Euler
|
||||
from math import radians
|
||||
from pathlib import Path
|
||||
from collections import namedtuple
|
||||
from typing import List, Iterable, Union, TYPE_CHECKING
|
||||
from typing import Iterable, Union, TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from bonsai.bim.prop import MultipleFileSelect
|
||||
@@ -1219,7 +1219,7 @@ class ClippingPlaneCutWithCappings(bpy.types.Operator):
|
||||
|
||||
return {"FINISHED"}
|
||||
|
||||
def get_cutting_plane_data(self, cutting_planes: List[bpy.types.Object]) -> List[CuttingPlaneData]:
|
||||
def get_cutting_plane_data(self, cutting_planes: list[bpy.types.Object]) -> list[CuttingPlaneData]:
|
||||
cutting_planes_data = []
|
||||
|
||||
for obj in cutting_planes:
|
||||
@@ -1230,7 +1230,7 @@ class ClippingPlaneCutWithCappings(bpy.types.Operator):
|
||||
return cutting_planes_data
|
||||
|
||||
# NOTE: unused, will be used later for cutting boxes support
|
||||
def get_box_cutting_plane_data(self, obj: bpy.types.Object) -> List[CuttingPlaneData]:
|
||||
def get_box_cutting_plane_data(self, obj: bpy.types.Object) -> list[CuttingPlaneData]:
|
||||
matrix_world = obj.matrix_world
|
||||
rotation = matrix_world.to_quaternion() # avoid scale for normals
|
||||
cutting_planes_data = []
|
||||
|
||||
@@ -63,7 +63,6 @@ from typing import (
|
||||
Optional,
|
||||
Literal,
|
||||
Iterator,
|
||||
List,
|
||||
TYPE_CHECKING,
|
||||
get_args,
|
||||
Generator,
|
||||
@@ -1927,7 +1926,7 @@ class Geometry(bonsai.core.tool.Geometry):
|
||||
return new_item
|
||||
|
||||
@classmethod
|
||||
def split_by_loose_parts(cls, obj: bpy.types.Object) -> List[bpy.types.Mesh]:
|
||||
def split_by_loose_parts(cls, obj: bpy.types.Object) -> list[bpy.types.Mesh]:
|
||||
# Before .copy() since it also copies the selection.
|
||||
selection = tool.Blender.get_objects_selection(bpy.context)
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ from dataclasses import dataclass, field
|
||||
from lark import Lark, Transformer
|
||||
from math import degrees, radians, sin, cos, tan
|
||||
from mathutils import Vector, Matrix
|
||||
from typing import Optional, Union, Literal, List
|
||||
from typing import Optional, Union, Literal
|
||||
|
||||
|
||||
class Polyline(bonsai.core.tool.Polyline):
|
||||
@@ -41,7 +41,7 @@ class Polyline(bonsai.core.tool.Polyline):
|
||||
_Y: str = ""
|
||||
_Z: str = ""
|
||||
_AREA: str = "0"
|
||||
input_options: List[str] = field(default_factory=list)
|
||||
input_options: list[str] = field(default_factory=list)
|
||||
|
||||
def set_value(self, attribute_name, value):
|
||||
value = str(value)
|
||||
@@ -94,7 +94,7 @@ class Polyline(bonsai.core.tool.Polyline):
|
||||
input_type: "Polyline.InputType" = None
|
||||
|
||||
@classmethod
|
||||
def create_input_ui(cls, input_options: List[str] = []) -> PolylineUI:
|
||||
def create_input_ui(cls, input_options: list[str] = []) -> PolylineUI:
|
||||
return cls.PolylineUI(input_options=input_options)
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -42,7 +42,7 @@ import numpy as np
|
||||
from math import pi
|
||||
from mathutils import Vector, Matrix
|
||||
from shapely import Polygon
|
||||
from typing import Generator, Optional, Union, Literal, List, Any, Iterable, TYPE_CHECKING
|
||||
from typing import Generator, Optional, Union, Literal, Any, Iterable, TYPE_CHECKING
|
||||
from collections import defaultdict
|
||||
from natsort import natsorted
|
||||
|
||||
@@ -1267,7 +1267,7 @@ class Spatial(bonsai.core.tool.Spatial):
|
||||
return None
|
||||
|
||||
@classmethod
|
||||
def get_selected_containers(cls) -> List[ifcopenshell.entity_instance]:
|
||||
def get_selected_containers(cls) -> list[ifcopenshell.entity_instance]:
|
||||
results = []
|
||||
for obj in tool.Blender.get_selected_objects():
|
||||
if (element := tool.Ifc.get_entity(obj)) and tool.Root.is_spatial_element(element):
|
||||
|
||||
@@ -18,7 +18,7 @@ import os
|
||||
import re
|
||||
from pathlib import Path
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Dict, List, Optional
|
||||
from typing import Optional
|
||||
|
||||
bl_info = {
|
||||
"name": "Bonsai Translations",
|
||||
@@ -70,9 +70,9 @@ def rearrange_files_for_po_import(po_dir_path: Path, temp_directory: tempfile.Te
|
||||
class Message:
|
||||
msgid: str
|
||||
msgctxt: str | None
|
||||
sources: Optional[List[str]] = field(default_factory=list)
|
||||
sources: Optional[list[str]] = field(default_factory=list)
|
||||
# mapping languages to translated strings
|
||||
translations: Optional[Dict[str, str]] = field(default_factory=dict)
|
||||
translations: Optional[dict[str, str]] = field(default_factory=dict)
|
||||
|
||||
|
||||
def bonsai_strings_parse(addon_directory: Optional[Path] = None, po_directory: Optional[Path] = None):
|
||||
@@ -98,7 +98,7 @@ def bonsai_strings_parse(addon_directory: Optional[Path] = None, po_directory: O
|
||||
r'\b_\("(.*?)"\)', # gettext called with `_`
|
||||
]
|
||||
regexes = [re.compile(pattern) for pattern in patterns]
|
||||
matched_dict: Dict[str, Message] = dict()
|
||||
matched_dict: dict[str, Message] = dict()
|
||||
|
||||
# NOTE: currently there is no special handling same message with different contexts
|
||||
for root, dirs, files in os.walk(directory):
|
||||
@@ -151,7 +151,7 @@ def bonsai_strings_parse(addon_directory: Optional[Path] = None, po_directory: O
|
||||
|
||||
|
||||
def update_translations_from_po(po_directory: Path, translations_module: Path):
|
||||
translation_data: Dict[str, Message] = dict()
|
||||
translation_data: dict[str, Message] = dict()
|
||||
|
||||
def process_po_entry(language: str, current_chunk: list[str]) -> None:
|
||||
sources = []
|
||||
|
||||
@@ -3,14 +3,14 @@ import ifcopenshell
|
||||
import ifcopenshell.util.element
|
||||
import ifcopenshell.geom
|
||||
import multiprocessing
|
||||
from typing import NamedTuple, List
|
||||
from typing import NamedTuple
|
||||
|
||||
# python standalone_drawer.py model.ifc guid_of_drawing guids,of,bad,elements output.svg
|
||||
|
||||
|
||||
class LineworkContexts(NamedTuple):
|
||||
body: List[List[int]]
|
||||
annotation: List[List[int]]
|
||||
body: list[list[int]]
|
||||
annotation: list[list[int]]
|
||||
|
||||
|
||||
class Drawer:
|
||||
|
||||
@@ -20,7 +20,7 @@ import sys
|
||||
import json
|
||||
import pytest
|
||||
import bonsai.core.tool
|
||||
from typing import Any, Optional, Type, Union, TypedDict, Literal
|
||||
from typing import Any, Optional, TypedDict, Literal
|
||||
from typing_extensions import Self
|
||||
|
||||
|
||||
@@ -277,9 +277,9 @@ class Prophecy:
|
||||
- Ensure all predicted calls actually happened.
|
||||
"""
|
||||
|
||||
subject: Type
|
||||
subject: type
|
||||
|
||||
def __init__(self, cls: Type):
|
||||
def __init__(self, cls: type):
|
||||
self.subject = cls
|
||||
self.predictions: list[Prediction] = []
|
||||
self.calls: list[Call] = []
|
||||
|
||||
+9
-10
@@ -22,7 +22,6 @@ import os
|
||||
import subprocess
|
||||
from copy import deepcopy
|
||||
from pathlib import Path
|
||||
from typing import Dict, List
|
||||
|
||||
import ifcopenshell as ios
|
||||
|
||||
@@ -96,7 +95,7 @@ class Ifc2CA:
|
||||
self,
|
||||
load_group: ios.entity_instance | None = None,
|
||||
element: ios.entity_instance | None = None,
|
||||
load_group_ids: List[int] | None = None,
|
||||
load_group_ids: list[int] | None = None,
|
||||
):
|
||||
if load_group is not None:
|
||||
actions = [
|
||||
@@ -455,7 +454,7 @@ class Ifc2CA:
|
||||
data["appliedCondition"] = self.parse_applied_condition(connection.AppliedCondition, data["geometry_type"])
|
||||
return data
|
||||
|
||||
def parse_element_connections(self, element: Dict, connections: List[Dict]):
|
||||
def parse_element_connections(self, element: dict, connections: list[dict]):
|
||||
ifc_element = self.file.by_id(element["id"])
|
||||
connection_ids = [c["id"] for c in connections]
|
||||
rels = [rel for rel in ifc_element.ConnectedBy if rel.RelatedStructuralConnection.id() in connection_ids]
|
||||
@@ -506,9 +505,9 @@ class Ifc2CA:
|
||||
|
||||
def parse_element_loads(
|
||||
self,
|
||||
element: Dict,
|
||||
load_group_ids: List[int],
|
||||
load_cases: List[ios.entity_instance],
|
||||
element: dict,
|
||||
load_group_ids: list[int],
|
||||
load_cases: list[ios.entity_instance],
|
||||
):
|
||||
ifc_element = self.file.by_id(element["id"])
|
||||
actions = self.get_actions(element=ifc_element, load_group_ids=load_group_ids)
|
||||
@@ -574,10 +573,10 @@ class Ifc2CA:
|
||||
|
||||
def add_action_loads(
|
||||
self,
|
||||
element: Dict,
|
||||
element: dict,
|
||||
action: ios.entity_instance,
|
||||
data: Dict,
|
||||
load_cases: List[ios.entity_instance],
|
||||
data: dict,
|
||||
load_cases: list[ios.entity_instance],
|
||||
):
|
||||
load_group = self.get_load_group(action)
|
||||
load_group_coeff = 1.0 if load_group.Coefficient is None else load_group.Coefficient
|
||||
@@ -695,7 +694,7 @@ class Ifc2CA:
|
||||
for key, load in element["loads"]["loadsLC"].items():
|
||||
element["loads"]["loadsCOMB"][key][iComb] = round(comb_factors.dot(load), 4)
|
||||
|
||||
def get_combination_factors(self, load_combination, load_case_ids: List[int]):
|
||||
def get_combination_factors(self, load_combination, load_case_ids: list[int]):
|
||||
comb_coeff = 1.0 if load_combination.Coefficient is None else load_combination.Coefficient
|
||||
comb_factors = np.array([0.0 for _ in load_case_ids])
|
||||
for assignment in self.get_combination_assignments(load_combination):
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
import itertools
|
||||
import json
|
||||
from pathlib import Path
|
||||
from typing import Dict
|
||||
|
||||
import numpy as np
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
@@ -30,7 +29,7 @@ includeZeroLength1DSprings = False
|
||||
|
||||
|
||||
class CommandFileConstructor:
|
||||
def __init__(self, data: Dict):
|
||||
def __init__(self, data: dict):
|
||||
self.data = data
|
||||
self.env = Environment(loader=FileSystemLoader(Path(__file__).parent / "templates"))
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
import datetime
|
||||
from datetime import timedelta, date
|
||||
from typing import List
|
||||
import ifcopenshell
|
||||
import ifcopenshell.api
|
||||
import ifcopenshell.util.date
|
||||
@@ -26,7 +25,7 @@ import xml.etree.ElementTree as ET
|
||||
|
||||
|
||||
class MSP2Ifc:
|
||||
def __init__(self, optionalColumns: List[str] = []):
|
||||
def __init__(self, optionalColumns: list[str] = []):
|
||||
self.xml = None
|
||||
self.file = None
|
||||
self.ns = None
|
||||
|
||||
@@ -18,8 +18,6 @@
|
||||
|
||||
from fractions import Fraction
|
||||
from math import pi
|
||||
from typing import Any
|
||||
from typing import Dict
|
||||
from typing import Literal
|
||||
from typing import Optional
|
||||
from typing import Union
|
||||
@@ -506,7 +504,7 @@ def get_property_unit(
|
||||
|
||||
def get_property_table_unit(
|
||||
prop: ifcopenshell.entity_instance, ifc_file: Union[ifcopenshell.file, None], use_cache: bool = False
|
||||
) -> Dict[str, Union[ifcopenshell.entity_instance, None]]:
|
||||
) -> dict[str, Union[ifcopenshell.entity_instance, None]]:
|
||||
"""
|
||||
Gets the unit definition of a property table
|
||||
|
||||
|
||||
@@ -20,8 +20,6 @@ import ifcopenshell
|
||||
import ifcopenshell.util.element
|
||||
import ifcopenshell.util.unit
|
||||
from logging import Logger
|
||||
from collections import defaultdict
|
||||
from typing import List, Dict, Tuple, Optional
|
||||
|
||||
|
||||
class Patcher:
|
||||
@@ -97,7 +95,7 @@ class Patcher:
|
||||
f"Fraction: {fraction:.4f}"
|
||||
)
|
||||
|
||||
def get_element_quantities(self, element: ifcopenshell.entity_instance) -> Dict[str, float]:
|
||||
def get_element_quantities(self, element: ifcopenshell.entity_instance) -> dict[str, float]:
|
||||
"""Get width quantities for an element."""
|
||||
qtos = [
|
||||
v
|
||||
@@ -116,10 +114,10 @@ class Patcher:
|
||||
|
||||
def calculate_constituent_widths(
|
||||
self,
|
||||
constituents: List[ifcopenshell.entity_instance],
|
||||
constituents: list[ifcopenshell.entity_instance],
|
||||
elements: set[ifcopenshell.entity_instance],
|
||||
unit_scale: float,
|
||||
) -> Tuple[Dict[ifcopenshell.entity_instance, float], float]:
|
||||
) -> tuple[dict[ifcopenshell.entity_instance, float], float]:
|
||||
"""Calculate the widths of constituents based on associated quantities."""
|
||||
if not elements:
|
||||
return {}, 0.0
|
||||
|
||||
@@ -38,7 +38,7 @@ from .facet import (
|
||||
Cardinality,
|
||||
FacetFailure,
|
||||
)
|
||||
from typing import List, Optional, Union, overload, Literal
|
||||
from typing import Optional, Union
|
||||
|
||||
cwd = os.path.dirname(os.path.realpath(__file__))
|
||||
schema = None
|
||||
@@ -98,7 +98,7 @@ class Ids:
|
||||
self.filepath: Optional[str] = None
|
||||
self.filename: Optional[str] = None
|
||||
|
||||
self.specifications: List[Specification] = []
|
||||
self.specifications: list[Specification] = []
|
||||
self.info = {}
|
||||
self.info["title"] = title or "Untitled"
|
||||
if copyright:
|
||||
@@ -187,8 +187,8 @@ class Specification:
|
||||
instructions=None,
|
||||
):
|
||||
self.name = name or "Unnamed"
|
||||
self.applicability: List[Facet] = []
|
||||
self.requirements: List[Facet] = []
|
||||
self.applicability: list[Facet] = []
|
||||
self.requirements: list[Facet] = []
|
||||
self.minOccurs: Union[int, str] = minOccurs
|
||||
self.maxOccurs: Union[int, str] = maxOccurs
|
||||
self.ifcVersion = ifcVersion
|
||||
|
||||
@@ -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