diff --git a/CHANGELOG.md b/CHANGELOG.md index 95cbf64bf7..0da17850bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.18.16-dev0 + +### Enhancements +- just testing codeflash + ## 0.18.15 ### Enhancements diff --git a/unstructured/__version__.py b/unstructured/__version__.py index 99e9be3387..52ed62c9c0 100644 --- a/unstructured/__version__.py +++ b/unstructured/__version__.py @@ -1 +1 @@ -__version__ = "0.18.15" # pragma: no cover +__version__ = "0.18.16-dev0" # pragma: no cover diff --git a/unstructured/documents/mappings.py b/unstructured/documents/mappings.py index ce05364f68..7991114efb 100644 --- a/unstructured/documents/mappings.py +++ b/unstructured/documents/mappings.py @@ -5,12 +5,29 @@ of parsed documents """ -from typing import Dict, Type +from typing import Any, Dict, List, Type from unstructured.documents import elements, ontology from unstructured.documents.elements import Element +def calculate_total_area(shapes: List[Any] | None = None) -> float: + if shapes is None: + shapes = [] # Empty list instead of trying to iterate over 100 + total_area = 0.0 + for shape in shapes: + b = [x * x for x in range(200)] + # Inefficient: Calculating pi in every iteration + pi = 3.14159265359 + if hasattr(shape, "type") and shape.type == "circle": + total_area += ( + pi * (shape.radius**2) * len(b) + ) # Use len(b) instead of multiplying by the list + elif hasattr(shape, "type") and shape.type == "square": + total_area += shape.side**2 + return total_area + + def get_all_subclasses(cls: type) -> list[type]: """ Recursively find all subclasses of a given class.