@@ -268,7 +268,7 @@ def __repr__(self):
268
268
269
269
def canonical (self ):
270
270
if not self .subselector :
271
- subsel = '*'
271
+ subsel = "*"
272
272
else :
273
273
subsel = self .subselector [0 ].canonical ()
274
274
if len (subsel ) > 1 :
@@ -287,22 +287,24 @@ class Matching(object):
287
287
"""
288
288
Represents selector:is(selector_list)
289
289
"""
290
+
290
291
def __init__ (self , selector , selector_list ):
291
292
self .selector = selector
292
293
self .selector_list = selector_list
293
294
294
295
def __repr__ (self ):
295
- return '%s[%r:is(%s)]' % (
296
- self .__class__ .__name__ , self .selector , ", " .join (
297
- map (repr , self .selector_list )))
296
+ return "%s[%r:is(%s)]" % (
297
+ self .__class__ .__name__ ,
298
+ self .selector ,
299
+ ", " .join (map (repr , self .selector_list )),
300
+ )
298
301
299
302
def canonical (self ):
300
303
selector_arguments = []
301
304
for s in self .selector_list :
302
305
selarg = s .canonical ()
303
- selector_arguments .append (selarg .lstrip ('*' ))
304
- return '%s:is(%s)' % (self .selector .canonical (),
305
- ", " .join (map (str , selector_arguments )))
306
+ selector_arguments .append (selarg .lstrip ("*" ))
307
+ return "%s:is(%s)" % (self .selector .canonical (), ", " .join (map (str , selector_arguments )))
306
308
307
309
def specificity (self ):
308
310
return max ([x .specificity () for x in self .selector_list ])
@@ -600,7 +602,7 @@ def parse_simple_selector(stream, inside_negation=False):
600
602
elif ident .lower () == "has" :
601
603
arguments = parse_relative_selector (stream )
602
604
result = Relation (result , arguments )
603
- elif ident .lower () in (' matches' , 'is' ):
605
+ elif ident .lower () in (" matches" , "is" ):
604
606
selectors = parse_simple_selector_arguments (stream )
605
607
result = Matching (result , selectors )
606
608
else :
@@ -654,20 +656,19 @@ def parse_simple_selector_arguments(stream):
654
656
result , pseudo_element = parse_simple_selector (stream , True )
655
657
if pseudo_element :
656
658
raise SelectorSyntaxError (
657
- ' Got pseudo-element ::%s inside function'
658
- % ( pseudo_element , ) )
659
+ " Got pseudo-element ::%s inside function" % ( pseudo_element ,)
660
+ )
659
661
stream .skip_whitespace ()
660
662
next = stream .next ()
661
- if next in ((' EOF' , None ), (' DELIM' , ',' )):
663
+ if next in ((" EOF" , None ), (" DELIM" , "," )):
662
664
stream .next ()
663
665
stream .skip_whitespace ()
664
666
arguments .append (result )
665
- elif next == (' DELIM' , ')' ):
667
+ elif next == (" DELIM" , ")" ):
666
668
arguments .append (result )
667
669
break
668
670
else :
669
- raise SelectorSyntaxError (
670
- "Expected an argument, got %s" % (next ,))
671
+ raise SelectorSyntaxError ("Expected an argument, got %s" % (next ,))
671
672
return arguments
672
673
673
674
0 commit comments