Skip to content

Commit

Permalink
I guess __getattr__ still works better than subclassing Any
Browse files Browse the repository at this point in the history
  • Loading branch information
Daverball committed May 24, 2024
1 parent 7285618 commit 932e1fd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion stubs/reportlab/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ reportlab.graphics.barcode.eanbc.isEanString

# Error: is not present at runtime
# ================================
# PropertySet can have arbitrary attributes, so we add a __getattr_
# These can have arbitrary attributes, so we add a __getattr__
reportlab.lib.abag.ABag.__getattr__
reportlab.lib.styles.PropertySet.__getattr__

# Only exists on renderPM backend
Expand Down
6 changes: 4 additions & 2 deletions stubs/reportlab/reportlab/lib/abag.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ from typing_extensions import Self

__version__: Final[str]

# NOTE: just holds an arbitrary collection of attributes, so we subclass Any
class ABag(Any):
class ABag:
def __init__(self, **attr: Any) -> None: ...
def clone(self, **attr: Any) -> Self: ...
# ABag can have arbitrary attributes
def __getattr__(self, name: str) -> Any: ...
def __setattr__(self, name: str, value: Any) -> None: ...

0 comments on commit 932e1fd

Please sign in to comment.