From af70d2ad4dd1938ba04c93168f9ea8afffc3167c Mon Sep 17 00:00:00 2001 From: Robert Date: Wed, 11 Dec 2024 10:13:27 -0500 Subject: [PATCH] Switch to using cached_property from functools aways from Django's now deprecated implementation --- mibios/glamr/models.py | 3 ++- mibios/glamr/views.py | 3 ++- mibios/ncbi_taxonomy/models.py | 3 ++- mibios/omics/managers.py | 3 +-- mibios/omics/tracking.py | 2 +- mibios/tables.py | 2 +- mibios/umrad/fields.py | 2 +- 7 files changed, 10 insertions(+), 8 deletions(-) diff --git a/mibios/glamr/models.py b/mibios/glamr/models.py index bc888386..1f1be3a0 100644 --- a/mibios/glamr/models.py +++ b/mibios/glamr/models.py @@ -1,6 +1,8 @@ """ GLAMR-specific modeling """ +from functools import cached_property + from django.conf import settings from django.contrib.auth.models import Group from django.contrib.contenttypes.fields import GenericForeignKey, \ @@ -15,7 +17,6 @@ from django.db.models import Index from django.urls import reverse from django.utils.dateparse import parse_datetime, parse_date, parse_time -from django.utils.functional import cached_property from mibios import __version__ as mibios_version from mibios.omics.models import AbstractDataset, AbstractSample diff --git a/mibios/glamr/views.py b/mibios/glamr/views.py index 8f7d8cbf..a011f14c 100644 --- a/mibios/glamr/views.py +++ b/mibios/glamr/views.py @@ -1,3 +1,4 @@ +from functools import cached_property from itertools import groupby from logging import getLogger import pprint @@ -15,7 +16,7 @@ from django.db.models import Count, Exists, Field, OuterRef, Prefetch, URLField from django.http import Http404, HttpResponse from django.urls import reverse -from django.utils.functional import cached_property, classproperty +from django.utils.functional import classproperty from django.utils.html import format_html from django.views.decorators.cache import cache_control, cache_page from django.views.generic import DetailView diff --git a/mibios/ncbi_taxonomy/models.py b/mibios/ncbi_taxonomy/models.py index aa5c1226..4475cc1e 100644 --- a/mibios/ncbi_taxonomy/models.py +++ b/mibios/ncbi_taxonomy/models.py @@ -1,5 +1,6 @@ +from functools import cached_property + from django.db import models -from django.utils.functional import cached_property from mibios.umrad.model_utils import ch_opt, fk_opt, fk_req, opt from mibios.umrad.model_utils import Model as UmradModel diff --git a/mibios/omics/managers.py b/mibios/omics/managers.py index 4713f04c..8bd24fc4 100644 --- a/mibios/omics/managers.py +++ b/mibios/omics/managers.py @@ -4,7 +4,7 @@ from collections import defaultdict from contextlib import ExitStack from datetime import date -from functools import partial +from functools import cached_property, partial from itertools import groupby, islice from logging import getLogger import os @@ -18,7 +18,6 @@ from django.conf import settings from django.core.exceptions import ValidationError from django.db.transaction import atomic, set_rollback -from django.utils.functional import cached_property from django.utils.module_loading import import_string from mibios import __version__ as version diff --git a/mibios/omics/tracking.py b/mibios/omics/tracking.py index f5b92da2..b62d65ab 100644 --- a/mibios/omics/tracking.py +++ b/mibios/omics/tracking.py @@ -1,10 +1,10 @@ from enum import Enum +from functools import cached_property from importlib import import_module import inspect import sys from django.db.transaction import atomic -from django.utils.functional import cached_property from .models import SampleTracking diff --git a/mibios/tables.py b/mibios/tables.py index 6e12e985..873d8a24 100644 --- a/mibios/tables.py +++ b/mibios/tables.py @@ -1,8 +1,8 @@ +from functools import cached_property import re from django.db.models import DecimalField from django.urls import reverse -from django.utils.functional import cached_property from django.utils.html import format_html import django_tables2 as tables diff --git a/mibios/umrad/fields.py b/mibios/umrad/fields.py index 774ea87f..26950d2c 100644 --- a/mibios/umrad/fields.py +++ b/mibios/umrad/fields.py @@ -1,8 +1,8 @@ +from functools import cached_property from pathlib import Path from django.core.exceptions import ValidationError from django.db.models import Field, CharField -from django.utils.functional import cached_property def path_exists_validator(value):