comparison roundup/rest.py @ 8193:d06a140eab4d

chore(ruff): replace set(generator) with {set comprehension} The comprehension seems to be the more expected way to express. Not sure if there is a performance difference.
author John Rouillard <rouilj@ieee.org>
date Wed, 11 Dec 2024 13:30:50 -0500
parents b4d7f9358ba6
children 2ecd1a871993
comparison
equal deleted inserted replaced
8192:b4d7f9358ba6 8193:d06a140eab4d
358 if not rule.startswith('rest/'): 358 if not rule.startswith('rest/'):
359 rule = '^rest/' + rule + '$' 359 rule = '^rest/' + rule + '$'
360 360
361 if isinstance(methods, basestring): # convert string to tuple 361 if isinstance(methods, basestring): # convert string to tuple
362 methods = (methods,) 362 methods = (methods,)
363 methods = set(item.upper() for item in methods) 363 methods = {item.upper() for item in methods}
364 364
365 # convert a rule to a compiled regex object 365 # convert a rule to a compiled regex object
366 # so /data/<:class>/<:id> will become 366 # so /data/<:class>/<:id> will become
367 # /data/([charset]+)/([charset]+) 367 # /data/([charset]+)/([charset]+)
368 # and extract the variable names to a list [(class), (id)] 368 # and extract the variable names to a list [(class), (id)]

Roundup Issue Tracker: http://roundup-tracker.org/