Typing: Fix python3 format string/byte output issues

This commit is contained in:
Mike Auty
2019-11-27 11:30:14 +00:00
committed by ikelos
parent c187067fbf
commit 31ddbaaa2e
4 changed files with 7 additions and 6 deletions
@@ -46,8 +46,9 @@ class SymbolBannerCache(interfaces.automagic.AutomagicInterface):
for path in banners[banner]:
url = urllib.parse.urlparse(path)
if url.scheme == 'file' and not os.path.exists(urllib.request.url2pathname(url.path)):
vollog.log(constants.LOGLEVEL_VV,
"Removing cached path {} for banner {}: file does not exist".format(path, banner))
vollog.log(
constants.LOGLEVEL_VV, "Removing cached path {} for banner {}: file does not exist".format(
path, str(banner, 'latin-1')))
banners[banner].remove(path)
# This is probably excessive, but it's here if we need it
# if url.scheme == 'jar':
@@ -272,7 +272,7 @@ class TranslationLayerRequirement(interfaces.configuration.ConstructableRequirem
if value is not None:
vollog.log(constants.LOGLEVEL_V,
"TypeError - Translation Layer Requirement only accepts string labels: {}".format(value))
"TypeError - Translation Layer Requirement only accepts string labels: {}".format(repr(value)))
return {config_path: self}
# TODO: check that the space in the context lives up to the requirements for arch/os etc
@@ -328,7 +328,7 @@ class SymbolTableRequirement(interfaces.configuration.ConstructableRequirementIn
value = self.config_value(context, config_path, None)
if not isinstance(value, str):
vollog.log(constants.LOGLEVEL_V,
"TypeError - SymbolTableRequirement only accepts string labels: {}".format(value))
"TypeError - SymbolTableRequirement only accepts string labels: {}".format(repr(value)))
return {config_path: self}
if value not in context.symbol_space:
# This is an expected situation, so return False rather than raise
@@ -439,7 +439,7 @@ class SimpleTypeRequirement(RequirementInterface):
vollog.log(
constants.LOGLEVEL_V,
"TypeError - {} requirements only accept {} type: {}".format(self.name, self.instance_type.__name__,
value))
repr(value)))
return {config_path: self}
return {}
@@ -398,7 +398,7 @@ class PoolScanner(plugins.PluginInterface):
constraint_lookup = {} # type: Dict[bytes, PoolConstraint]
for constraint in pool_constraints:
if constraint.tag in constraint_lookup:
raise ValueError("Constraint tag is used for more than one constraint: {}".format(constraint.tag))
raise ValueError("Constraint tag is used for more than one constraint: {}".format(repr(constraint.tag)))
constraint_lookup[constraint.tag] = constraint
module = cls._get_pool_header_module(context, layer_name, symbol_table)