Skip to content

Commit

Permalink
Merge pull request #2278 from opentensor/fear/roman/moce-extrinsics
Browse files Browse the repository at this point in the history
Move extrinsics, update `deprecated.py` module.
  • Loading branch information
roman-opentensor authored Aug 30, 2024
2 parents c7c6838 + 08da14f commit 9f439c6
Show file tree
Hide file tree
Showing 12 changed files with 20 additions and 20 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
22 changes: 11 additions & 11 deletions bittensor/core/subtensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,31 +48,31 @@
custom_rpc_type_registry,
)
from bittensor.core.config import Config
from bittensor.core.metagraph import Metagraph
from bittensor.core.types import AxonServeCallParams, PrometheusServeCallParams
from bittensor.utils import torch, format_error_message
from bittensor.utils import u16_normalized_float, networking
from bittensor.utils.balance import Balance
from bittensor.utils.btlogging import logging
from bittensor.utils.deprecated.extrinsics.commit_weights import (
from bittensor.core.extrinsics.commit_weights import (
commit_weights_extrinsic,
reveal_weights_extrinsic,
)
from bittensor.utils.deprecated.extrinsics.prometheus import (
from bittensor.core.extrinsics.prometheus import (
prometheus_extrinsic,
)
from bittensor.utils.deprecated.extrinsics.serving import (
from bittensor.core.extrinsics.serving import (
serve_extrinsic,
serve_axon_extrinsic,
publish_metadata,
get_metadata,
)
from bittensor.utils.deprecated.extrinsics.set_weights import (
from bittensor.core.extrinsics.set_weights import (
set_weights_extrinsic,
)
from bittensor.utils.deprecated.extrinsics.transfer import (
from bittensor.core.extrinsics.transfer import (
transfer_extrinsic,
)
from bittensor.core.metagraph import Metagraph
from bittensor.core.types import AxonServeCallParams, PrometheusServeCallParams
from bittensor.utils import torch, format_error_message
from bittensor.utils import u16_normalized_float, networking
from bittensor.utils.balance import Balance
from bittensor.utils.btlogging import logging
from bittensor.utils.weight_utils import generate_weight_hash

KEY_NONCE: Dict[str, int] = {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,6 @@
mock_subpackage = importlib.import_module("bittensor.utils.mock")
sys.modules["bittensor.mock"] = mock_subpackage

# Makes the `bittensor.utils.deprecated.extrinsics` subpackage available as `bittensor.extrinsics` for backwards compatibility.
extrinsics_subpackage = importlib.import_module("bittensor.utils.deprecated.extrinsics")
# Makes the `bittensor.core.extrinsics` subpackage available as `bittensor.extrinsics` for backwards compatibility.
extrinsics_subpackage = importlib.import_module("bittensor.core.extrinsics")
sys.modules["bittensor.extrinsics"] = extrinsics_subpackage
2 changes: 1 addition & 1 deletion tests/unit_tests/extrinsics/test_prometheus.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import pytest
from bittensor_wallet import Wallet

from bittensor.utils.deprecated.extrinsics.prometheus import (
from bittensor.core.extrinsics.prometheus import (
prometheus_extrinsic,
)
from bittensor.core.subtensor import Subtensor
Expand Down
8 changes: 4 additions & 4 deletions tests/unit_tests/extrinsics/test_serving.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from bittensor_wallet import Wallet

from bittensor.core.axon import Axon
from bittensor.utils.deprecated.extrinsics.serving import (
from bittensor.core.extrinsics.serving import (
serve_extrinsic,
publish_metadata,
serve_axon_extrinsic,
Expand Down Expand Up @@ -120,7 +120,7 @@ def test_serve_extrinsic_happy_path(
# Arrange
mock_subtensor.do_serve_axon.return_value = (True, "")
with patch(
"bittensor.utils.deprecated.extrinsics.serving.Confirm.ask",
"bittensor.core.extrinsics.serving.Confirm.ask",
return_value=True,
):
# Act
Expand Down Expand Up @@ -180,7 +180,7 @@ def test_serve_extrinsic_edge_cases(
# Arrange
mock_subtensor.do_serve_axon.return_value = (True, "")
with patch(
"bittensor.utils.deprecated.extrinsics.serving.Confirm.ask",
"bittensor.core.extrinsics.serving.Confirm.ask",
return_value=True,
):
# Act
Expand Down Expand Up @@ -240,7 +240,7 @@ def test_serve_extrinsic_error_cases(
# Arrange
mock_subtensor.do_serve_axon.return_value = (False, "Error serving axon")
with patch(
"bittensor.utils.deprecated.extrinsics.serving.Confirm.ask",
"bittensor.core.extrinsics.serving.Confirm.ask",
return_value=True,
):
# Act
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/extrinsics/test_set_weights.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from bittensor.core.subtensor import Subtensor
from bittensor_wallet import Wallet
from bittensor.utils.deprecated.extrinsics.set_weights import (
from bittensor.core.extrinsics.set_weights import (
set_weights_extrinsic,
)

Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/test_deprecated.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_mock_import():
def test_extrinsics_import():
"""Tests that `bittensor.extrinsics` can be imported and is the same as `bittensor.utils.deprecated.extrinsics`."""
import bittensor.extrinsics as redirected_extrinsics
import bittensor.utils.deprecated.extrinsics as real_extrinsics
import bittensor.core.extrinsics as real_extrinsics

assert "bittensor.extrinsics" in sys.modules
assert redirected_extrinsics is real_extrinsics
Expand Down

0 comments on commit 9f439c6

Please sign in to comment.