-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: use typed namedtuples for the
get_list
page result (#251)
This is a nice refactor that remove some magic from the `get_list` methods. The `get_list` function returns a named tuple that always has the following structure `(result, meta)`. Since this is a tuple, we can unpack it without using the named attributes, and remove the `results_list_attribute_name` attributes used to access the data inside the tuple. - Use predefined `NamedTuples` classes instead of dynamic (magic) `namedtuples` for the `get_list` `PageResult`. This will greatly improve the library typing definition. - Remove unused functions and attributes after the refactor. This cleans up and simplify the code. * refactor: simplify client _get_all implementation * refactor: rewrite Meta.parse_meta method * refactor: simplify GetEntityByNameMixin * refactor: don't use dynamic page results namedtuple * refactor: simplify ImagesClient.get_by_name_and_architecture * refactor: remove unused results_list_attribute_name attr * add comment about page result tuple unpacking
- Loading branch information
Showing
21 changed files
with
204 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.