Skip to content

Commit

Permalink
Define default value inside function
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesbvll committed Apr 12, 2024
1 parent 02b3816 commit 8c67a94
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/py/flwr/cli/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import os
import zipfile
from pathlib import Path
from typing import Annotated
from typing import Annotated, Optional

import jwt
import pathspec
Expand All @@ -27,11 +27,14 @@

def build(
directory: Annotated[
Path, typer.Option(help="The to bundle into a FAB")
] = Path.cwd(),
Optional[Path], typer.Option(help="The to bundle into a FAB")
] = None,
signed: Annotated[bool, typer.Option(help="Flag to sign the FAB")] = False,
) -> None:
"""Build a Flower project."""
if directory is None:
directory = Path.cwd()

directory = directory.resolve()
if not directory.is_dir():
typer.echo(f"The path {directory} is not a valid directory.")
Expand All @@ -44,7 +47,7 @@ def build(
fab_filename = f"{directory.name}.fab"
list_file_content = ""

with zipfile.ZipFile(fab_filename, "w") as fab_file:
with zipfile.ZipFile(fab_filename) as fab_file:
for root, dirs, files in os.walk(directory, topdown=True):
# Filter directories and files based on .gitignore
dirs[:] = [d for d in dirs if not ignore_spec.match_file(Path(root) / d)]
Expand Down

0 comments on commit 8c67a94

Please sign in to comment.