mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-21 14:23:53 +00:00
Fix Ruff UP033 (lru-cache-with-maxsize-none)
https://docs.astral.sh/ruff/rules/lru-cache-with-maxsize-none/
This commit is contained in:
@@ -37,7 +37,7 @@ from bonsai.bim.module.drawing.data import DecoratorData, DrawingsData
|
|||||||
from bonsai.bim.module.drawing.shaders import add_verts_sequence, add_offsets
|
from bonsai.bim.module.drawing.shaders import add_verts_sequence, add_offsets
|
||||||
from bonsai.bim.module.drawing.helper import format_distance
|
from bonsai.bim.module.drawing.helper import format_distance
|
||||||
from timeit import default_timer as timer
|
from timeit import default_timer as timer
|
||||||
from functools import lru_cache
|
from functools import cache
|
||||||
from typing import Optional, Iterator, Type, Union
|
from typing import Optional, Iterator, Type, Union
|
||||||
|
|
||||||
UNSPECIAL_ELEMENT_COLOR = (0.2, 0.2, 0.2, 1) # GREY
|
UNSPECIAL_ELEMENT_COLOR = (0.2, 0.2, 0.2, 1) # GREY
|
||||||
@@ -495,7 +495,7 @@ class BaseDecorator:
|
|||||||
|
|
||||||
self.draw_label(context, text=text, line_no=line_number_start, multiline=True, **draw_label_kwargs)
|
self.draw_label(context, text=text, line_no=line_number_start, multiline=True, **draw_label_kwargs)
|
||||||
|
|
||||||
@lru_cache(maxsize=None)
|
@cache
|
||||||
def format_value(self, context, value, custom_unit=None):
|
def format_value(self, context, value, custom_unit=None):
|
||||||
drawing_pset_data = DrawingsData.data["active_drawing_pset_data"]
|
drawing_pset_data = DrawingsData.data["active_drawing_pset_data"]
|
||||||
precision = drawing_pset_data.get("MetricPrecision", None)
|
precision = drawing_pset_data.get("MetricPrecision", None)
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
import datetime
|
import datetime
|
||||||
import ifcopenshell.util.date
|
import ifcopenshell.util.date
|
||||||
from math import floor
|
from math import floor
|
||||||
from functools import lru_cache
|
from functools import cache
|
||||||
from typing import Union, Literal, Optional, Iterator
|
from typing import Union, Literal, Optional, Iterator
|
||||||
|
|
||||||
|
|
||||||
@@ -170,7 +170,7 @@ def get_recent_working_day(start, duration_type: DURATION_TYPE, calendar: ifcope
|
|||||||
return start
|
return start
|
||||||
|
|
||||||
|
|
||||||
@lru_cache(maxsize=None)
|
@cache
|
||||||
def is_working_day(day, calendar: ifcopenshell.entity_instance) -> bool:
|
def is_working_day(day, calendar: ifcopenshell.entity_instance) -> bool:
|
||||||
is_working_day = False
|
is_working_day = False
|
||||||
for work_time in calendar.WorkingTimes or []:
|
for work_time in calendar.WorkingTimes or []:
|
||||||
@@ -186,7 +186,7 @@ def is_working_day(day, calendar: ifcopenshell.entity_instance) -> bool:
|
|||||||
return is_working_day
|
return is_working_day
|
||||||
|
|
||||||
|
|
||||||
@lru_cache(maxsize=None)
|
@cache
|
||||||
def is_calendar_applicable(day, calendar: ifcopenshell.entity_instance) -> bool:
|
def is_calendar_applicable(day, calendar: ifcopenshell.entity_instance) -> bool:
|
||||||
if not calendar or not calendar.WorkingTimes:
|
if not calendar or not calendar.WorkingTimes:
|
||||||
return False
|
return False
|
||||||
|
|||||||
Reference in New Issue
Block a user