Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions gittensor/cli/miner_commands/post.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from rich.console import Console
from rich.table import Table

from gittensor.cli.issue_commands.helpers import load_config
from gittensor.constants import BASE_GITHUB_API_URL

console = Console()
Expand Down Expand Up @@ -229,16 +230,7 @@ def _validate_pat_locally(pat: str) -> bool:

def _load_config_value(key: str):
"""Load a value from ~/.gittensor/config.json, or None."""
from pathlib import Path

config_file = Path.home() / '.gittensor' / 'config.json'
if not config_file.exists():
return None
try:
config = json.loads(config_file.read_text())
return config.get(key)
except (json.JSONDecodeError, OSError):
return None
return load_config().get(key)


NETWORK_MAP = {
Expand Down
12 changes: 3 additions & 9 deletions gittensor/validator/utils/issue_competitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,16 @@

"""Utility functions for Issue Bounties sub-mechanism."""

import os
from typing import Optional

import bittensor as bt

from gittensor.constants import CONTRACT_ADDRESS
from gittensor.cli.issue_commands.helpers import get_contract_address as _get_contract_address


def get_contract_address() -> Optional[str]:
"""
Get contract address. Override via CONTRACT_ADDRESS env var for dev/testing.

Returns:
Contract address string (env var override or constants.py default)
"""
return os.environ.get('CONTRACT_ADDRESS') or CONTRACT_ADDRESS
"""Get contract address. CLI arg > env var > constants.py default."""
return _get_contract_address()


def get_miner_coldkey(hotkey: str, subtensor: bt.Subtensor, netuid: int) -> Optional[str]:
Expand Down