Skip to content

Conversation

kujiy
Copy link
Contributor

@kujiy kujiy commented Apr 27, 2022

AttrDict has to_dict() but AttrList does not have to_list().

AttrList does not work for PyDantic as a data type. It's good if anyone can convert AttrList to list easily.

Thanks,

@cla-checker-service
Copy link

cla-checker-service bot commented Apr 27, 2022

💚 CLA has been signed

@kujiy
Copy link
Contributor Author

kujiy commented Apr 27, 2022

I signed the CLA. Please proceed the review, thanks

self._l_, self._obj_wrapper = state

def to_list(self):
return [x for x in self.__iter__()]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest doing it analogically with AttrDict.

This will get the original value.

def to_list(self): return self._l_ 
@miguelgrinberg miguelgrinberg merged commit b059c0a into elastic:main Apr 24, 2024
@miguelgrinberg miguelgrinberg added the backport 8.x Backport to 8.x label Apr 29, 2024
github-actions bot pushed a commit that referenced this pull request Apr 29, 2024
* Add AttrList.to_list() * simplify to_list() implementation * code formatting --------- Co-authored-by: Miguel Grinberg <miguel.grinberg@gmail.com> (cherry picked from commit b059c0a)
miguelgrinberg added a commit that referenced this pull request Apr 29, 2024
* Add AttrList.to_list() * simplify to_list() implementation * code formatting --------- Co-authored-by: Miguel Grinberg <miguel.grinberg@gmail.com> (cherry picked from commit b059c0a)
miguelgrinberg pushed a commit that referenced this pull request Apr 29, 2024
* Add AttrList.to_list() * simplify to_list() implementation * code formatting --------- Co-authored-by: Miguel Grinberg <miguel.grinberg@gmail.com> (cherry picked from commit b059c0a) Co-authored-by: Kujiy <kujiy@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 8.x Backport to 8.x
3 participants