Skip to content

Commit

Permalink
ruff bittensor/config.py
Browse files Browse the repository at this point in the history
  • Loading branch information
µ committed Sep 3, 2024
1 parent 4460e08 commit 8c7d191
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions bittensor/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def __init__(
## Make a dict with keys as args and values as argparse.SUPPRESS
defaults_as_suppress = {key: argparse.SUPPRESS for key in all_default_args}

def local_set_defaults(local_parser:argparse.ArgumentParser):
def local_set_defaults(local_parser: argparse.ArgumentParser):
## Set the defaults to argparse.SUPPRESS, should remove them from the namespace
local_parser.set_defaults(**defaults_as_suppress)
local_parser._defaults.clear() # Needed for quirk of argparse
Expand All @@ -173,7 +173,11 @@ def local_set_defaults(local_parser:argparse.ArgumentParser):
}

@staticmethod
def apply_to_parser_recursive(parser:argparse.ArgumentParser, callback:Callable[[argparse.ArgumentParser],None], depth:int=0):
def apply_to_parser_recursive(
parser: argparse.ArgumentParser,
callback: Callable[[argparse.ArgumentParser], None],
depth: int = 0,
):
"""
Recursively apply callback() to parser and its subparsers.
"""
Expand All @@ -187,7 +191,7 @@ def apply_to_parser_recursive(parser:argparse.ArgumentParser, callback:Callable[
config.apply_to_parser_recursive(cmd_parser, callback, depth=depth + 1)

@staticmethod
def add_args(parser:argparse.ArgumentParser):
def add_args(parser: argparse.ArgumentParser):
"""
Add standard arguments to argument parser.
"""
Expand Down

0 comments on commit 8c7d191

Please sign in to comment.