-
Notifications
You must be signed in to change notification settings - Fork 13
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
ItemAdapter.is_item_class and ItemAdapter.get_field_meta_from_class #54
Conversation
Codecov Report
@@ Coverage Diff @@
## master #54 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 3 3
Lines 248 272 +24
=========================================
+ Hits 248 272 +24
Continue to review full report at Codecov.
|
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.
Looking good!
### function `itemadapter.utils.get_field_meta_from_class(item_class: type, field_name: str) -> types.MappingProxyType` | ||
|
||
Given an item class and a field name, return a | ||
[`MappingProxyType`](https://docs.python.org/3/library/types.html#types.MappingProxyType) | ||
object, which is a read-only mapping with metadata about the given field. If the item class does not | ||
support field metadata, or there is no metadata for the given field, an empty object is returned. | ||
Alias for `itemadapter.adapter.ItemAdapter.get_field_meta_from_class` |
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.
Shall we deprecate (or remove, with the blessing of semantic versioning) this function? (and remove it from the documentation)
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.
I'm not sure about removing, as it's used here. We could deprecate, though.
Co-authored-by: Adrián Chaves <adrian@chaves.io>
Co-authored-by: Adrián Chaves <adrian@chaves.io>
Bringing in the ability to get field meta data for custom item classes. #53 showed us this is not currently possible without editing library code.
Tasks: