Skip to content

Commit

Permalink
Extract config to new package (#1401)
Browse files Browse the repository at this point in the history
* integrate openconfig progess

* add type or suppress for argparse

* use for problematic types

* fix type hints

* move test under testcase class

* move tests under testcase class

* add test for btcli with empty arguments on every command

* remove unneeded setup from test

* remove type or suppress from int

* remove to defaults test

* use dot get for prefix check

* move tests to config repo

* fix test by passing argv=[]

* use new package name

* fix name of openconfig package
  • Loading branch information
camfairchild authored Jun 27, 2023
1 parent 7683402 commit 9b35e2d
Show file tree
Hide file tree
Showing 18 changed files with 187 additions and 582 deletions.
4 changes: 2 additions & 2 deletions bittensor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def turn_console_off():


# ---- Config ----
from bittensor._config import config as config
from bittensor_config import config as config

# ---- LOGGING ----
# Duplicate import for ease of use.
Expand Down Expand Up @@ -169,7 +169,7 @@ def turn_console_off():

# ---- Classes -----
from bittensor._cli.cli_impl import CLI as CLI
from bittensor._config.config_impl import Config as Config
from bittensor_config.config_impl import Config as Config
from bittensor._subtensor.chain_data import DelegateInfo as DelegateInfo
from bittensor._wallet.wallet_impl import Wallet as Wallet
from bittensor._keyfile.keyfile_impl import Keyfile as Keyfile
Expand Down
2 changes: 1 addition & 1 deletion bittensor/_axon/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def add_args(cls, parser: argparse.ArgumentParser, prefix: str = None):
"""Accept specific arguments from parser"""
prefix_str = "" if prefix is None else prefix + "."
if prefix is not None:
if not hasattr(bittensor.defaults, prefix):
if bittensor.defaults.get(prefix, d=None) == None:
setattr(bittensor.defaults, prefix, bittensor.Config())
getattr(bittensor.defaults, prefix).axon = bittensor.defaults.axon

Expand Down
9 changes: 0 additions & 9 deletions bittensor/_cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,6 @@ def __create_parser__() -> 'argparse.ArgumentParser':

return parser

@staticmethod
def config(args: List[str]) -> 'bittensor.config':
""" From the argument parser, add config to bittensor.executor and local config
Return: bittensor.config object
"""
parser = cli.__create_parser__()

return parser

@staticmethod
def config(args: List[str]) -> 'bittensor.config':
""" From the argument parser, add config to bittensor.executor and local config
Expand Down
194 changes: 0 additions & 194 deletions bittensor/_config/__init__.py

This file was deleted.

Loading

0 comments on commit 9b35e2d

Please sign in to comment.