Move to f-strings
Used: $ flynt -a -tc . vppcfg Execution time: 0.216s Files checked: 24 Files modified: 13 Character count reduction: 632 (0.36%) Per expression type: Old style (`%`) expressions attempted: 209/211 (99.1%) No `.format(...)` calls attempted. No concatenations attempted. F-string expressions created: 205 Ran an integration test before and after. No diffs.
This commit is contained in:
@ -87,17 +87,17 @@ class Validator(object):
|
||||
validators[IPInterfaceWithPrefixLength.tag] = IPInterfaceWithPrefixLength
|
||||
if self.schema:
|
||||
fn = self.schema
|
||||
self.logger.debug("Validating against --schema %s" % fn)
|
||||
self.logger.debug(f"Validating against --schema {fn}")
|
||||
elif hasattr(sys, "_MEIPASS"):
|
||||
## See vppcfg.spec data_files that includes schema.yaml into the bundle
|
||||
self.logger.debug("Validating against built-in schema")
|
||||
fn = os.path.join(sys._MEIPASS, "schema.yaml")
|
||||
else:
|
||||
fn = "./schema.yaml"
|
||||
self.logger.debug("Validating against fallthrough default schema %s" % fn)
|
||||
self.logger.debug(f"Validating against fallthrough default schema {fn}")
|
||||
|
||||
if not os.path.isfile(fn):
|
||||
self.logger.error("Cannot file schema file: %s" % fn)
|
||||
self.logger.error(f"Cannot file schema file: {fn}")
|
||||
return False, ret_msgs
|
||||
|
||||
try:
|
||||
@ -109,7 +109,7 @@ class Validator(object):
|
||||
ret_rv = False
|
||||
for result in e.results:
|
||||
for error in result.errors:
|
||||
ret_msgs.extend(['yamale: %s' % error])
|
||||
ret_msgs.extend([f'yamale: {error}'])
|
||||
return ret_rv, ret_msgs
|
||||
|
||||
self.logger.debug("Validating Semantics...")
|
||||
|
Reference in New Issue
Block a user