Redundant isinstance() check

This commit is contained in:
Kovid Goyal 2016-04-11 15:42:57 +05:30
parent cfbec65804
commit fdfed12489

View File

@ -37,15 +37,14 @@ class StyleDeclaration(object):
def __iter__(self): def __iter__(self):
dec = self.css_declaration dec = self.css_declaration
for p in all_properties(dec): for p in all_properties(dec):
if isinstance(p, Property): n = normalizers.get(p.name)
n = normalizers.get(p.name) if n is None:
if n is None: yield p, None
yield p, None else:
else: if p not in self.expanded_properties:
if p not in self.expanded_properties: self.expanded_properties[p] = [Property(k, v, p.literalpriority) for k, v in n(p.name, p.propertyValue).iteritems()]
self.expanded_properties[p] = [Property(k, v, p.literalpriority) for k, v in n(p.name, p.propertyValue).iteritems()] for ep in self.expanded_properties[p]:
for ep in self.expanded_properties[p]: yield ep, p
yield ep, p
def expand_property(self, parent_prop): def expand_property(self, parent_prop):
props = self.expanded_properties.pop(parent_prop, None) props = self.expanded_properties.pop(parent_prop, None)