Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
9 changes: 5 additions & 4 deletions datacube/drivers/postgis/_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from collections.abc import Callable
from datetime import date, datetime, timezone
from decimal import Decimal
from functools import cached_property
from typing import Any, TypeAlias

from sqlalchemy import and_, cast, func
Expand All @@ -26,7 +27,7 @@
from datacube.drivers.postgis._schema import Dataset, search_field_index_map
from datacube.model import Range
from datacube.model.fields import Expression, Field
from datacube.utils import cached_property, get_doc_offset
from datacube.utils import get_doc_offset
from datacube.utils.dates import tz_as_utc

DatasetJoinArgs = tuple[FromClause] | tuple[FromClause, ColumnExpressionArgument]
Expand Down Expand Up @@ -84,8 +85,8 @@ def dataset_join_args(self) -> DatasetJoinArgs:
return (
self.search_index_table,
and_(
Dataset.id == self.search_index_table.dataset_ref,
self.search_index_table.search_key == self.name,
Dataset.id == self.search_index_table.dataset_ref, # type: ignore[attr-defined]
self.search_index_table.search_key == self.name, # type: ignore[attr-defined]
),
)
else:
Expand All @@ -102,7 +103,7 @@ def alchemy_expression(self) -> ColumnExpressionArgument:
@property
def search_alchemy_expression(self) -> ColumnExpressionArgument:
if self.indexed:
return self.search_index_table.search_val
return self.search_index_table.search_val # type: ignore[attr-defined]
else:
return self.alchemy_expression

Expand Down
3 changes: 2 additions & 1 deletion datacube/index/abstract/_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import logging
from abc import ABC, abstractmethod
from collections.abc import Iterable, Mapping, Sequence
from functools import cached_property
from urllib.parse import ParseResult, urlparse

from deprecat import deprecat
Expand All @@ -13,7 +14,7 @@
from datacube.cfg import ODCEnvironment, ODCOptionHandler
from datacube.migration import ODC2DeprecationWarning
from datacube.model import Field, MetadataType
from datacube.utils import cached_property, report_to_user
from datacube.utils import report_to_user
from datacube.utils.generic import thread_local_cache

from ._datasets import AbstractDatasetResource
Expand Down
2 changes: 1 addition & 1 deletion datacube/index/abstract/_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
# Copyright (c) 2015-2025 ODC Contributors
# SPDX-License-Identifier: Apache-2.0
from collections.abc import Iterable, Sequence
from functools import cached_property
from typing import NamedTuple
from uuid import UUID

from deprecat import deprecat

from datacube.migration import ODC2DeprecationWarning
from datacube.model import Dataset, Product
from datacube.utils import cached_property
from datacube.utils.documents import JsonDict


Expand Down
2 changes: 1 addition & 1 deletion datacube/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from collections import OrderedDict
from collections.abc import Generator, Iterable, Iterator, Mapping, Sequence
from datetime import datetime
from functools import cached_property
Copy link
Contributor

Choose a reason for hiding this comment

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

One of the cached properties in this file is assigned to in test_virtual.py:86, and another one in test_virtual.py:240. Is that supported by the functools cached_property, or could those two places be fixed easily so they populate the cached_property in some other way?

Copy link
Contributor

Choose a reason for hiding this comment

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

Another question is if get_by_name_unsafe.cache_clear() & friends are related to cached_property and needs to be updated in some way when replacing the implementation?

from pathlib import Path
from typing import Any
from urllib.parse import urlparse
Expand All @@ -23,7 +24,6 @@

from datacube.utils import (
DocReader,
cached_property,
parse_time,
schema_validated,
uri_to_local_path,
Expand Down
3 changes: 1 addition & 2 deletions datacube/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
unsqueeze_data_array,
unsqueeze_dataset,
)
from .py import cached_property, ignore_exceptions_if, import_function
from .py import ignore_exceptions_if, import_function
from .serialise import jsonify_document
from .uris import get_part_from_uri, is_url, is_vsipath, mk_part_uri, uri_to_local_path

Expand All @@ -41,7 +41,6 @@
"NoDatesSafeLoader",
"SimpleDocNav",
"_readable_offset",
"cached_property",
"check_write_path",
"gen_password",
"get_doc_offset",
Expand Down
Loading