Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions encord/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,9 @@
DatasetUser,
DatasetUserRole,
DatasetUsers,
DicomSeries,
Image,
ImageGroup,
ImageGroupOCR,
Images,
LongPollingStatus,
ReEncodeVideoTask,
Video,
Expand All @@ -90,7 +88,6 @@
ShadowDataState,
)
from encord.orm.labeling_algorithm import (
BoundingBoxFittingParams,
LabelingAlgorithm,
ObjectInterpolationParams,
)
Expand Down
2 changes: 1 addition & 1 deletion encord/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
UpdateCollectionPayload,
)
from encord.orm.collection import ProjectCollection as OrmProjectCollection
from encord.orm.label_row import LabelRowMetadata, label_row_metadata_dto_to_label_row_metadata
from encord.orm.label_row import label_row_metadata_dto_to_label_row_metadata
from encord.storage import StorageItem, StorageItemInaccessible

log = logging.getLogger(__name__)
Expand Down
4 changes: 4 additions & 0 deletions encord/common/bitmask_operations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
)

__all__ = [
"_mask_to_rle",
"_rle_to_mask",
"_rle_to_string",
"_string_to_rle",
"deserialise_bitmask",
"serialise_bitmask",
"transpose_bytearray",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import List, Sequence, Tuple
from typing import List, Tuple

import numpy as np

Expand Down
2 changes: 1 addition & 1 deletion encord/common/range_manager.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Iterable, List, Optional, Set, Union, cast
from typing import Optional, Set, cast

from encord.objects.frames import Frames, Range, Ranges

Expand Down
1 change: 0 additions & 1 deletion encord/filter_preset.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from typing import Iterator, List, Optional, Union
from uuid import UUID

from encord.client import EncordClientProject
from encord.exceptions import (
AuthorisationError,
EncordException,
Expand Down
2 changes: 1 addition & 1 deletion encord/http/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from encord.http.constants import RequestsSettings
from encord.http.constants import RequestsSettings as RequestsSettings
11 changes: 2 additions & 9 deletions encord/http/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,16 @@
from concurrent.futures import ThreadPoolExecutor
from dataclasses import dataclass
from pathlib import Path
from typing import Dict, Iterable, List, Optional, Tuple, Type, Union
from typing import Dict, Iterable, List, Optional, Union

from tqdm import tqdm

from encord.configs import BaseConfig
from encord.exceptions import CloudUploadError, EncordException
from encord.http.querier import Querier, create_new_session
from encord.http.querier import create_new_session
from encord.http.v2.api_client import ApiClient
from encord.http.v2.payloads import Page
from encord.orm.base_dto import BaseDTO
from encord.orm.dataset import (
Audio,
DicomSeries,
Images,
SignedImagesURL,
Video,
)
from encord.orm.storage import StorageItemType, UploadSignedUrl

PROGRESS_BAR_FILE_FACTOR = 100
Expand Down
1 change: 0 additions & 1 deletion encord/issues/issue_client.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from __future__ import annotations

from dataclasses import dataclass
from enum import auto
from typing import List, Literal, Union
from uuid import UUID
Expand Down
1 change: 0 additions & 1 deletion encord/objects/classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from __future__ import annotations

from dataclasses import dataclass
from enum import Enum
from typing import Any, Dict, List, Optional, Sequence, Type

from encord.common.enum import StringEnum
Expand Down
5 changes: 2 additions & 3 deletions encord/objects/classification_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
NoReturn,
Optional,
Sequence,
Set,
Tuple,
Union,
)
Expand All @@ -42,9 +41,9 @@
TextAttribute,
_get_attribute_by_hash,
)
from encord.objects.classification import Classification, OntologyClassificationLevel
from encord.objects.classification import Classification
from encord.objects.constants import DEFAULT_CONFIDENCE, DEFAULT_MANUAL_ANNOTATION
from encord.objects.frames import Frames, Ranges, frames_class_to_frames_list, frames_to_ranges
from encord.objects.frames import Frames, Ranges, frames_class_to_frames_list
from encord.objects.internal_helpers import (
_infer_attribute_from_answer,
_search_child_attributes,
Expand Down
12 changes: 0 additions & 12 deletions encord/objects/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,8 @@
from typing import Any, Dict, List, Union

from encord.common.enum import StringEnum
from encord.objects.attributes import ( # pylint: disable=unused-import
Attribute,
ChecklistAttribute,
RadioAttribute,
TextAttribute,
)

# Following imports need to be here for backwards compatibility
from encord.objects.ontology_element import NestedID # pylint: disable=unused-import
from encord.objects.options import ( # pylint: disable=unused-import
FlatOption,
NestableOption,
Option,
)
Comment on lines 14 to -21
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

These imports were marked with pylint: disable=unused-import and a comment indicating they are for backwards compatibility. Removing them could introduce breaking changes for users who rely on these names being available in the encord.objects.common namespace. Please verify that this change is intentional and will not break the public API. If these are indeed no longer needed, it would be good to mention this breaking change in the release notes.



class PropertyType(StringEnum):
Expand Down
1 change: 0 additions & 1 deletion encord/objects/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from __future__ import annotations

# for backwards compatibility
from encord.common.constants import DATETIME_LONG_STRING_FORMAT

DEFAULT_CONFIDENCE = 1.0
DEFAULT_MANUAL_ANNOTATION = True
Expand Down
3 changes: 1 addition & 2 deletions encord/objects/html_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@

from __future__ import annotations

from dataclasses import dataclass
from typing import Collection, List, Union, cast
from typing import List

from encord.orm.base_dto import BaseDTO

Expand Down
3 changes: 0 additions & 3 deletions encord/objects/ontology_labels_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@
Range,
Ranges,
frames_class_to_frames_list,
frames_to_ranges,
ranges_list_to_ranges,
ranges_to_list,
)
from encord.objects.html_node import HtmlRange
from encord.objects.metadata import DataGroupMetadata, DICOMSeriesMetadata, DICOMSliceMetadata
Expand All @@ -86,7 +84,6 @@
from encord.orm import storage as orm_storage
from encord.orm.label_row import (
AnnotationTaskStatus,
LabelRow,
LabelRowMetadata,
LabelStatus,
WorkflowGraphNode,
Expand Down
3 changes: 1 addition & 2 deletions encord/objects/ontology_object_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
Union,
)

from encord.common.range_manager import RangeManager
from encord.common.time_parser import parse_datetime
from encord.constants.enums import DataType
from encord.exceptions import LabelRowError
Expand All @@ -52,7 +51,7 @@
frames_to_ranges,
ranges_list_to_ranges,
)
from encord.objects.html_node import HtmlRange, HtmlRanges
from encord.objects.html_node import HtmlRanges
from encord.objects.internal_helpers import (
_infer_attribute_from_answer,
_search_child_attributes,
Expand Down
1 change: 0 additions & 1 deletion encord/objects/project.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# Import for backward compatibility
from encord.orm.project import ProjectDataset
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The comment indicates this import of ProjectDataset is for backward compatibility. Removing it could be a breaking change. Please ensure this is intended and won't affect users relying on this import path.

4 changes: 1 addition & 3 deletions encord/objects/skeleton_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@

from __future__ import annotations

from dataclasses import dataclass
from typing import Any, List, Optional, Set, Type
from typing import List, Set

from encord.objects.coordinates import SkeletonCoordinate, SkeletonCoordinates
from encord.orm.skeleton_template import SkeletonTemplate as SkeletonTemplateORM
from encord.orm.skeleton_template import SkeletonTemplateCoordinate


class SkeletonTemplate(SkeletonTemplateORM):
Expand Down
4 changes: 2 additions & 2 deletions encord/orm/analytics.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from datetime import datetime
from enum import Enum, auto
from typing import List, Literal, Optional
from typing import List, Optional
from uuid import UUID

from encord.common.utils import snake_to_camel
from encord.orm.base_dto import BaseDTO
from encord.orm.workflow import BaseWorkflowNode, WorkflowNode, WorkflowStageType
from encord.orm.workflow import BaseWorkflowNode
from encord.utilities.project_user import ProjectUserRole


Expand Down
11 changes: 11 additions & 0 deletions encord/orm/base_dto/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,14 @@
RootModelDTO,
dto_validator,
)

__all__ = [
"BaseDTO",
"BaseDTOInterface",
"BaseDTOWithExtra",
"Field",
"GenericBaseDTO",
"PrivateAttr",
"RootModelDTO",
"dto_validator",
]
4 changes: 2 additions & 2 deletions encord/orm/base_dto/base_dto_pydantic_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

from pydantic import (
BaseModel,
Field,
PrivateAttr,
Field, # noqa: F401 needed for imports elsewhere
PrivateAttr, # noqa: F401 needed for imports elsewhere
ValidationError,
root_validator,
validator,
Expand Down
6 changes: 2 additions & 4 deletions encord/orm/base_dto/base_dto_pydantic_v2.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
from datetime import datetime
from functools import wraps
from typing import Any, Callable, Dict, Literal, Type, TypeVar, get_origin

# TODO: invent some dependency version dependent type checking to get rid of this ignore
from pydantic import ( # type: ignore[attr-defined]
BaseModel,
ConfigDict, # type: ignore[attr-defined]
Extra,
Field,
PrivateAttr,
Field, # noqa: F401 needed for imports elsewhere
PrivateAttr, # noqa: F401 needed for imports elsewhere
RootModel, # type: ignore[attr-defined]
ValidationError,
field_validator,
Expand Down
1 change: 0 additions & 1 deletion encord/orm/base_orm.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import datetime
import json
import logging
from collections import OrderedDict, abc

Expand Down
2 changes: 1 addition & 1 deletion encord/orm/collection.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import uuid
from datetime import datetime
from enum import Enum
from typing import Any, List, Optional, Union
from typing import List, Optional, Union
from uuid import UUID

from encord.orm.base_dto import BaseDTO, Field
Expand Down
2 changes: 1 addition & 1 deletion encord/orm/filter_preset.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import Dict, List, Optional
from uuid import UUID

from encord.orm.base_dto import BaseDTO, Field, dto_validator
from encord.orm.base_dto import BaseDTO, Field


class GetPresetParams(BaseDTO):
Expand Down
3 changes: 1 addition & 2 deletions encord/orm/ontology.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
from __future__ import annotations

from datetime import datetime
from enum import IntEnum
from typing import Dict, Optional

# pylint: disable=unused-import
from encord.objects.ontology_structure import OntologyStructure
from encord.orm.base_dto import BaseDTO, dto_validator
from encord.orm.base_dto import BaseDTO
from encord.orm.formatter import Formatter
from encord.utilities.ontology_user import OntologyUserRole

Expand Down
2 changes: 0 additions & 2 deletions encord/orm/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
from typing import Any, List, Union
from uuid import UUID

from typing_extensions import Annotated

from encord.orm.base_dto import BaseDTO, dto_validator


Expand Down
2 changes: 1 addition & 1 deletion encord/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from datetime import datetime
from math import ceil
from pathlib import Path
from typing import Any, Collection, Dict, Iterable, List, Literal, Optional, Sequence, TextIO, Union
from typing import Any, Collection, Dict, Iterable, List, Optional, Sequence, TextIO, Union
from uuid import UUID

import requests
Expand Down
8 changes: 2 additions & 6 deletions encord/user_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from encord.common.deprecated import deprecated
from encord.common.time_parser import parse_datetime, parse_datetime_optional
from encord.configs import ENCORD_DOMAIN, BearerConfig, SshConfig, UserConfig, get_env_ssh_key
from encord.constants.string_constants import TYPE_DATASET, TYPE_ONTOLOGY, TYPE_PROJECT
from encord.constants.string_constants import TYPE_DATASET, TYPE_PROJECT
from encord.dataset import Dataset
from encord.filter_preset import FilterPreset
from encord.http.constants import DEFAULT_REQUESTS_SETTINGS, RequestsSettings
Expand Down Expand Up @@ -62,12 +62,9 @@
DatasetInfo,
DatasetsWithUserRolesListParams,
DatasetsWithUserRolesListResponse,
DicomDeidentifyTask,
Images,
StorageLocation,
dataset_user_role_str_enum_to_int_enum,
)
from encord.orm.dataset import Dataset as OrmDataset
from encord.orm.deidentification import (
DicomDeIdGetResultLongPollingStatus,
DicomDeIdGetResultParams,
Expand All @@ -79,7 +76,6 @@
)
from encord.orm.group import Group as OrmGroup
from encord.orm.ontology import CreateOrUpdateOntologyPayload
from encord.orm.ontology import Ontology as OrmOntology
from encord.orm.project import (
BenchmarkQaWorkflowSettings,
CvatExportType,
Expand Down Expand Up @@ -108,7 +104,7 @@
Issues,
LocalImport,
)
from encord.utilities.ontology_user import OntologiesFilterParams, OntologyUserRole, OntologyWithUserRole
from encord.utilities.ontology_user import OntologiesFilterParams, OntologyWithUserRole
from encord.utilities.project_user import ProjectUserRole

CVAT_LONG_POLLING_RESPONSE_RETRY_N = 3
Expand Down
2 changes: 0 additions & 2 deletions encord/utilities/coco/exporter.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
try:
import cv2
import pycocotools
import shapely
except ImportError as e:
raise ImportError(
"The 'opencv-python', 'pycocotools' and 'shapely' packages are required for the COCO export. "
Expand Down
1 change: 0 additions & 1 deletion encord/utilities/ontology_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
---
"""

from dataclasses import dataclass
from datetime import datetime
from enum import IntEnum
from typing import Optional, Union
Expand Down
5 changes: 1 addition & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ documentation = "https://python.docs.encord.com/"


[dependency-groups]
dev = [ # 'dev' group is synced by default in uv (no explicit configuration needed)
dev = [# 'dev' group is synced by default in uv (no explicit configuration needed)
"pytest>=7.4.1,<8.0.0",
"pre-commit>=3.5.0,<4.0.0",
"deepdiff>=8.6.1,<9.0.0",
Expand Down Expand Up @@ -80,6 +80,3 @@ select = ["W", "Q", "I", "D417", "RUF022", "F"]

[tool.ruff.lint.pydocstyle]
ignore-var-parameters = true

[tool.ruff.lint.per-file-ignores]
"encord/*" = ["F401", "E402"]
Loading
Loading