fundus icon indicating copy to clipboard operation
fundus copied to clipboard

Makes article properties over writable by parser

Open MaxDall opened this issue 2 years ago • 0 comments

This PR adds functionality to write over properties like lang defined in the article class. We do so by replacing the former property logic with a custom one. The new implementation now caches the values as well so it now works like cached_property but instead of cached_property it can be overwritten.

I.e. to overwrite the lang attribute of Article use the following in your desired parser.

from fundus.parser import ..., overwrite_attribute

    ...

    @overwrite_attribute
    def lang(self) -> str:
        return "This a new language value"

closes #328

MaxDall avatar Dec 10 '23 13:12 MaxDall