Spaces:
Configuration error
Configuration error
Download tests/unit/test_import_utils.py from flyingdarkdev/README: direct link, hf CLI and curl.
- Browser
- Download file 467 Bytes
-
https://huggingface.co/spaces/flyingdarkdev/README/resolve/main/tests/unit/test_import_utils.py
- Command line
-
hf download hf://spaces/flyingdarkdev/README/tests/unit/test_import_utils.py
-
curl -L -o test_import_utils.py https://huggingface.co/spaces/flyingdarkdev/README/resolve/main/tests/unit/test_import_utils.py
467 Bytes
| from abc import abstractmethod | |
| from dataclasses import dataclass | |
| from openhands.utils.import_utils import get_impl | |
| class Shape: | |
| def get_area(self): | |
| """Get the area of this shape""" | |
| class Square(Shape): | |
| length: float | |
| def get_area(self): | |
| return self.length**2 | |
| def test_get_impl(): | |
| ShapeImpl = get_impl(Shape, f'{Shape.__module__}.Square') | |
| shape = ShapeImpl(5) | |
| assert shape.get_area() == 25 | |