-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
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
Rework Article
class
#559
Rework Article
class
#559
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the rework. This looks really good 👍
|
||
def __getattribute__(self, item: str): | ||
if (attribute := object.__getattribute__(self, item)) and hasattr(attribute, "__get__"): | ||
return attribute.__get__(self, type(self)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When does this case come into play? I tried playing around a bit, but didn't find a setting where it is used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Every unvalidated attribute, more precise, every attribute that is added as AttributeView
rather than a property is accessed this way.
You can see this in action in the test_extraction_view_getter
test case.
Overhaul of Article Class with Enhanced Data Management
Overview
This PR presents a comprehensive overhaul of the Article class to improve data handling and maintainability.
Key Changes
Introduction of Data Views: The refactor emphasizes maintaining raw extraction data as the primary source while providing structured
Views
for data access. This approach facilitates easier benchmarking and evaluation.Implementation of Custom Attribute Handling: Custom
__getattribute__
and__setattr__
methods replicate Descriptor-like behavior, ensuring controlled attribute access without relying on class attributes.Read-Only Attributes: Initially, all extraction data is read-only to enhance security and stability. This simplifies data integrity management, with provisions for future writable features.
This PR serves as preparation for the upcoming CC-NEWS benchmark!