Whitespace changes to make new black linter happy

Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
This commit is contained in:
Jussi Kukkonen 2023-02-01 16:33:03 +02:00
parent c86134134d
commit b67b8c8ad3
9 changed files with 5 additions and 9 deletions

View file

@ -78,6 +78,7 @@ def _in(days: float) -> datetime:
BIN_SIZE = NUMBER_OF_PREFIXES // NUMBER_OF_BINS # ... 8, where each bin is
# responsible for a range of 8 prefixes, i.e. 00-07, 08-0f, ..., f8-ff.
# Helpers
# -------
def _bin_name(low: int, high: int) -> str:

View file

@ -100,7 +100,6 @@ def test_generic_read(self) -> None:
(Timestamp.type, Timestamp),
(Targets.type, Targets),
]:
# Load JSON-formatted metdata of each supported type from file
# and from out-of-band read JSON string
path = os.path.join(self.repo_dir, "metadata", metadata + ".json")
@ -613,7 +612,6 @@ def test_targets_key_api_with_succinct_roles(self) -> None:
targets.revoke_key(key.keyid)
def test_length_and_hash_validation(self) -> None:
# Test metadata files' hash and length verification.
# Use timestamp to get a MetaFile object and snapshot
# for untrusted metadata file to verify.

View file

@ -27,6 +27,7 @@
logger = logging.getLogger(__name__)
# pylint: disable=too-many-public-methods
class TestTrustedMetadataSet(unittest.TestCase):
"""Tests for all public API of the TrustedMetadataSet class."""
@ -459,6 +460,7 @@ def meta_modifier(snapshot: Snapshot) -> None:
def test_update_targets_expired_new_target(self) -> None:
self._update_all_besides_targets()
# new_delegated_target has expired
def target_expired_modifier(target: Targets) -> None:
target.expires = datetime(1970, 1, 1)

View file

@ -247,7 +247,6 @@ def test_non_root_rotations(self, md_version: MdVersion) -> None:
self.setup_subtest()
roles = ["timestamp", "snapshot", "targets"]
for role in roles:
# clear role keys, signers
self.sim.root.roles[role].keyids.clear()
self.sim.signers[role].clear()

View file

@ -698,7 +698,6 @@ def test_snapshot_rollback_with_local_snapshot_hash_mismatch(self) -> None:
@patch.object(builtins, "open", wraps=builtins.open)
def test_load_metadata_from_cache(self, wrapped_open: MagicMock) -> None:
# Add new delegated targets
spec_version = ".".join(SPECIFICATION_VERSION)
targets = Targets(1, spec_version, self.sim.safe_expiry, {}, None)

View file

@ -46,6 +46,7 @@
# DataSet is only here so type hints can be used.
DataSet = Dict[str, Any]
# Test runner decorator: Runs the test as a set of N SubTests,
# (where N is number of items in dataset), feeding the actual test
# function one test case at a time
@ -187,7 +188,6 @@ def __init__(
popen_cwd: str = ".",
extra_cmd_args: Optional[List[str]] = None,
):
self.server = server
self.__logger = log
# Stores popped messages from the queue.

View file

@ -927,7 +927,6 @@ def __init__(
hashes: Optional[Dict[str, str]] = None,
unrecognized_fields: Optional[Dict[str, Any]] = None,
):
if version <= 0:
raise ValueError(f"Metafile version must be > 0, got {version}")
if length is not None:
@ -1601,7 +1600,6 @@ def __init__(
path: str,
unrecognized_fields: Optional[Dict[str, Any]] = None,
):
self._validate_length(length)
self._validate_hashes(hashes)

View file

@ -22,6 +22,7 @@
# Globals
logger = logging.getLogger(__name__)
# Classes
class RequestsFetcher(FetcherInterface):
"""An implementation of ``FetcherInterface`` based on the requests library.

View file

@ -428,7 +428,6 @@ def _preorder_depth_first_walk(
len(visited_role_names) <= self.config.max_delegations
and len(delegations_to_visit) > 0
):
# Pop the role name from the top of the stack.
role_name, parent_role = delegations_to_visit.pop(-1)
@ -458,7 +457,6 @@ def _preorder_depth_first_walk(
child_name,
terminating,
) in targets.delegations.get_roles_for_target(target_filepath):
logger.debug("Adding child role %s", child_name)
child_roles_to_visit.append((child_name, role_name))
if terminating: