Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] authored and jajreidy committed Oct 30, 2024
1 parent 3c1a735 commit 9e5baa1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
5 changes: 3 additions & 2 deletions src/pushsource/_impl/backend/staged/staged_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class TypeHandler(object):
# Decorator for handling specific file directories (e.g. "FILES", "ISOS" etc)
HANDLERS = {}

def __init__(self, type_name, accepts = lambda entry: entry.is_file()):
def __init__(self, type_name, accepts=lambda entry: entry.is_file()):
self.type_name = type_name
self.accepts = accepts

Expand All @@ -33,7 +33,8 @@ def __init__(self, *args, **kwargs):
fn, accepts = TypeHandler.HANDLERS[typename]
bound_fn = partial(fn, self)
self._FILE_TYPES[typename] = partial(
self.__mixin_push_items, delegate=bound_fn, accepts=accepts)
self.__mixin_push_items, delegate=bound_fn, accepts=accepts
)

def __mixin_push_items(self, leafdir, metadata, delegate, accepts):
out = []
Expand Down
15 changes: 7 additions & 8 deletions src/pushsource/_impl/backend/staged/staged_cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,8 @@ def __build_azure_push_item(self, resources, origin, name, dest):

def __process_builds(self, current_dir, leafdir):
yaml_path = os.path.join(current_dir, "resources.yaml")
try:
with open(yaml_path, "rt") as fh:
raw = yaml.safe_load(fh)
except FileNotFoundError:
LOG.warning("No resources.yaml file found at %s (ignored)", yaml_path)
return
with open(yaml_path, "rt") as fh:
raw = yaml.safe_load(fh)
if not raw:
LOG.warning("Resources.yaml file at %s is empty (ignored)", yaml_path)
return
Expand All @@ -134,8 +130,11 @@ def __process_builds(self, current_dir, leafdir):
)
return out

@handles_type("CLOUD_IMAGES",
accepts=lambda entry: entry.is_dir() and os.path.exists(os.path.join(entry.path, "resources.yaml")))
@handles_type(
"CLOUD_IMAGES",
accepts=lambda entry: entry.is_dir()
and os.path.exists(os.path.join(entry.path, "resources.yaml")),
)
def __cloud_push_item(self, leafdir, metadata, entry):
out = self.__process_builds(entry.path, leafdir)

Expand Down

0 comments on commit 9e5baa1

Please sign in to comment.