object-mapper
object-mapper copied to clipboard
ObjectMapper is a class for automatic object mapping in Python
Update to the collections module import to support newer versions of python where the `MutableMapping` module has changed. Tested with Python 3.6, 3.8, 3.9, and 3.10 - all tests pass...
type check validation more flexible to allow for inherited/abstract classes
support non-default __init__ parameters on the to_object
Hello! I've been looking for a library like this one and I think it can be pretty useful. I want to use it to convert an object that is mapped...
It seems that the project has been abandoned. But this project is the only object mapper I can see in the Python world. I hope someone from the project sees...
`@dataclass` is a pretty good feature and unfortunatelly is not supported. https://github.com/marazt/object-mapper/blob/9d62e9bf00cd78afdaccd6e950a6bb4a1dd1cc06/mapper/object_mapper.py#L171 Example ``` class ObjectMapperTest(unittest.TestCase): """ Unit tests for the `ObjectMapper` module. """ @dataclass class FromTestDataClass: a: int b:...
Added support for python version 3.3 and higher, added support for classes with different meta class parents, and support for dataclasses
Hi. Can anyone post example how to use mapping with nested objects? Thanks.
The following the case fails: ``` from unittest import TestCase from mapper.object_mapper import ObjectMapper class MyMetaClass(type): pass class MyFromClass(metaclass=MyMetaClass): pass class MyToClass: pass class Test(TestCase): def test_mapping_class_with_custom_metaclass(self): mapper = ObjectMapper()...
Added an example for nested objects mapping.