Skip to content
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

Duplication in detecting a list, tuple, set or iterable data type #32

Closed
quandyfactory opened this issue Jan 7, 2015 · 1 comment
Closed

Comments

@quandyfactory
Copy link
Owner

Line 69 in get_xml_type() reads:

if type(val).__name__ in ('list', 'set', 'tuple') or isinstance(val, collections.Iterable):

This is redundant. List, set and tuple types are also instances of collections.Iterable. So the line can be changed to:

if isinstance(val, collections.Iterable):

Same with line 127 in convert():

if type(obj) in (list, set, tuple) or isinstance(obj, collections.Iterable):

It can be changed to:

if isinstance(obj, collections.Iterable):

Same with line 158 in convert_dict():

elif type(val) in (list, set, tuple) or isinstance(val, collections.Iterable):

It can be changed to:

elif isinstance(val, collections.Iterable):

Same with line 193 in convert_list():

elif type(item) in (list, set, tuple) or isinstance(item, collections.Iterable):

It can be changed to:

elif isinstance(item, collections.Iterable):
@quandyfactory
Copy link
Owner Author

Fixed in version 1.6.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant