-
Notifications
You must be signed in to change notification settings - Fork 49
Closed
Description
Bug Report
Current Behavior
Calling repr() on a FirewallResourceLabelSelector instance throws an AttributeError because the class inherits from BaseDomain (and thus comes with BaseDomain.__repr__), but does not have an __api_properties__ field.
Input Code
$ uv run --with hcloud==2.5.0 python
Python 3.13.1 (main, Dec 19 2024, 14:32:25) [Clang 18.1.8 ] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import hcloud
>>> selector = hcloud.firewalls.FirewallResourceLabelSelector("answer=42")
>>> selector
Traceback (most recent call last):
File "<python-input-2>", line 1, in <module>
selector
File "/home/scy/.cache/uv/archive-v0/0e_aaDu7yChGLL8FNzh-C/lib/python3.13/site-packages/hcloud/core/domain.py", line 18, in __repr__
kwargs = [f"{key}={getattr(self, key)!r}" for key in self.__api_properties__] # type: ignore[var-annotated]
^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'FirewallResourceLabelSelector' object has no attribute '__api_properties__'
>>> Expected behavior/code
Something like FirewallResourceLabelSelector(selector="answer=42").
Environment
- Python Version: 3.13.1
- Hcloud-Python Version: 2.5.0
Possible Solution
- Implement
__api_properties__on the class. - Introduce some static analysis to catch issues like these.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels