Skip to content

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

Description

@quandyfactory

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):

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions