Skip to content

Commit

Permalink
style: reformat & remove unnecessary imports
Browse files Browse the repository at this point in the history
  • Loading branch information
Melkor333 committed May 2, 2024
1 parent e85067e commit 777e51a
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 26 deletions.
17 changes: 3 additions & 14 deletions pyaptly/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import collections
import logging

from frozendict import frozendict

from . import state_reader, util

lg = logging.getLogger(__name__)
Expand Down Expand Up @@ -334,27 +332,18 @@ def __hash__(self):

def __eq__(self, other):
"""Compare the class."""
return (
self._eq_base(other)
and self.identifier == other.identifier
)
return self._eq_base(other) and self.identifier == other.identifier

def execute(self):
"""Mark command as executed"""
if self._finished: # pragma: no cover
return self._finished
if not Command.pretend_mode:
lg.debug(
"Running dummy Command with provides %s",
self._provides
)
lg.debug("Running dummy Command with provides %s", self._provides)

self._finished = True
else: # pragma: no cover
lg.info(
"Pretending to run dummy Command with provides: %s",
self._provides
)
lg.info("Pretending to run dummy Command with provides: %s", self._provides)

return self._finished

Expand Down
1 change: 0 additions & 1 deletion pyaptly/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
publish,
repo,
snapshot,
state_reader,
)

_logging_setup = False
Expand Down
1 change: 1 addition & 0 deletions pyaptly/mirror.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def add_gpg_keys(mirror_config):
raise
state_reader.state_reader().gpg_keys.cache_clear()


def mirror(cfg, args):
"""Create mirror commands, orders and executes them.
Expand Down
1 change: 0 additions & 1 deletion pyaptly/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ def repo_cmd_create(cfg, repo_name, repo_config):
)
)


cmd = command.Command(repo_cmd + options + endpoint_args)
cmd.provide("repo", repo_name)
return cmd
9 changes: 2 additions & 7 deletions pyaptly/snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,7 @@ def dependents_of_snapshot(snapshot_name):
:rtype: generator
"""
for dependent in state_reader.state_reader().snapshot_map().get(
snapshot_name, []
):
for dependent in state_reader.state_reader().snapshot_map().get(snapshot_name, []):
yield dependent
# TODO I fixed a bug, but there is no test. We do not test recursive dependants
yield from dependents_of_snapshot(dependent)
Expand Down Expand Up @@ -315,10 +313,7 @@ def cmd_snapshot_create(

snapshot_name = date_tools.expand_timestamped_name(snapshot_name, snapshot_config)

if (
snapshot_name in state_reader.state_reader().snapshots()
and not ignore_existing
):
if snapshot_name in state_reader.state_reader().snapshots() and not ignore_existing:
return []

default_aptly_cmd = ["aptly", "snapshot", "create"]
Expand Down
4 changes: 1 addition & 3 deletions pyaptly/tests/test_graph.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Testing dependency graphs."""

import random
from functools import partial
from typing import Union

from hypothesis import given, settings
Expand Down Expand Up @@ -107,9 +106,8 @@ def run_graph(tree):
random.shuffle(index)
cmd: Union[command.Command, command.DummyCommand]
for i in index:

if tree[2][i]:
cmd = command.DummyCommand('dummy %s' % i)
cmd = command.DummyCommand("dummy %s" % i)
else:
cmd = command.Command([str(i)])
for provides in tree[0][i]:
Expand Down

0 comments on commit 777e51a

Please sign in to comment.