We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Focusing on just the Ellipse,
In theory the interiour_color should be handled within the __init__ of the new code below.
interiour_color
__init__
In practice it gives a test error.
from .._utils import deprecate_with_replacement class Ellipse(MarkupAnnotation): def __init__( self, rect: Union[RectangleObject, Tuple[float, float, float, float]], *, interior_color: Optional[str] = None, **kwargs: Any, ): if kwargs.get("interiour_color"): interior_color = kwargs["interiour_color"] deprecate_with_replacement("interiour_color", "interior_color", "6.0.0") super().__init__(**kwargs) self.update( { NameObject("/Type"): NameObject("/Annot"), NameObject("/Subtype"): NameObject("/Circle"), NameObject("/Rect"): RectangleObject(rect), } ) if interior_color: self[NameObject("/IC")] = ArrayObject( [FloatObject(n) for n in hex_to_rgb(interior_color)] )
> > =================================== FAILURES =================================== > ________________________ test_annotation_builder_circle ________________________ > [gw3] linux -- Python 3.7.17 /opt/hostedtoolcache/Python/3.7.17/x64/bin/python > > pdf_file_path = PosixPath('/tmp/pytest-of-runner/pytest-0/popen-gw3/pypdf-data0/a08eb014-95d8-43ff-ba17-8e9de9eb08b6.pdf') > > def test_annotation_builder_circle(pdf_file_path): > # Arrange > pdf_path = RESOURCE_ROOT / "crazyones.pdf" > reader = PdfReader(pdf_path) > page = reader.pages[0] > writer = PdfWriter() > writer.add_page(page) > > # Act > with pytest.warns(DeprecationWarning): > circle_annotation = AnnotationBuilder.ellipse( > > rect=(50, 550, 200, 650), interiour_color="ff0000" > ) > > tests/test_generic.py:947: > > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > pypdf/generic/__init__.py:362: in ellipse > return Ellipse(rect=rect, interiour_color=interiour_color) > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > > self = {}, rect = (50, 550, 200, 650), interior_color = 'ff0000' > kwargs = {'interiour_color': 'ff0000'} > > def __init__( > self, > rect: Union[RectangleObject, Tuple[float, float, float, float]], > *, > interior_color: Optional[str] = None, > **kwargs: Any, > ): > if kwargs.get("interiour_color"): > interior_color = kwargs["interiour_color"] > deprecate_with_replacement("interiour_color", "interior_color", "6.0.0") > > super().__init__(**kwargs) > E TypeError: __init__() got an unexpected keyword argument 'interiour_color' > > pypdf/annotations/_markup_annotations.py:267: TypeError
The text was updated successfully, but these errors were encountered:
Needed deletion of the deprecated key.
interior_color = kwargs["interiour_color"] del kwargs["interiour_color"]
Sorry, something went wrong.
This is not fixed and thus should not be closed.
Successfully merging a pull request may close this issue.
Explanation
Focusing on just the Ellipse,
In theory the
interiour_color
should be handled within the__init__
of the new code below.In practice it gives a test error.
Code Example
The text was updated successfully, but these errors were encountered: