bundlewrap / bundlewrap

Consider iterating dictionary PYL-C0201
Anti-pattern
Major
6 months ago2 years old
Consider iterating the dictionary directly instead of calling .keys()
586    def validate_attributes(cls, bundle, item_id, attributes):
587        if attributes.get('delete', False):
588            for attr in attributes.keys():
589                if attr not in ['delete'] + list(BUILTIN_ITEM_ATTRIBUTES.keys()):590                    raise BundleError(_(
591                        "{item} from bundle '{bundle}' cannot have other "
592                        "attributes besides 'delete'"
Consider iterating the dictionary directly instead of calling .keys()
317    def validate_attributes(cls, bundle, item_id, attributes):
318        if attributes.get('delete', False):
319            for attr in attributes.keys():
320                if attr not in ['delete'] + list(BUILTIN_ITEM_ATTRIBUTES.keys()):321                    raise BundleError(_(
322                        "{item} from bundle '{bundle}' cannot have other "
323                        "attributes besides 'delete'"
Consider iterating the dictionary directly instead of calling .keys()
202    def validate_attributes(cls, bundle, item_id, attributes):
203        if attributes.get('delete', False):
204            for attr in attributes.keys():
205                if attr not in ['delete'] + list(BUILTIN_ITEM_ATTRIBUTES.keys()):206                    raise BundleError(_(
207                        "{item} from bundle '{bundle}' cannot have other "
208                        "attributes besides 'delete'"
Consider iterating the dictionary directly instead of calling .keys()
 92    def validate_attributes(cls, bundle, item_id, attributes):
 93        if attributes.get('delete', False):
 94            for attr in attributes.keys():
 95                if attr not in ['delete'] + list(BUILTIN_ITEM_ATTRIBUTES.keys()): 96                    raise BundleError(_(
 97                        "{item} from bundle '{bundle}' cannot have other "
 98                        "attributes besides 'delete'"