Skip to content

Commit

Permalink
remove licence, cut docstrings <= 120, ruff, optimize imports
Browse files Browse the repository at this point in the history
  • Loading branch information
roman-opentensor committed Jan 23, 2025
1 parent 9d2d8ce commit e75a0fc
Show file tree
Hide file tree
Showing 59 changed files with 430 additions and 932 deletions.
17 changes: 0 additions & 17 deletions bittensor/__init__.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
# The MIT License (MIT)
# Copyright © 2024 Opentensor Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the “Software”), to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
# and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of
# the Software.
#
# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
# THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.

import warnings

from .core.settings import __version__, version_split, DEFAULTS, DEFAULT_NETWORK
Expand Down
17 changes: 0 additions & 17 deletions bittensor/__main__.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
# The MIT License (MIT)
# Copyright © 2024 Opentensor Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the “Software”), to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
# and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of
# the Software.
#
# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
# THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.

import os
import subprocess
import sys
Expand Down
151 changes: 90 additions & 61 deletions bittensor/core/axon.py

Large diffs are not rendered by default.

20 changes: 2 additions & 18 deletions bittensor/core/chain_data/axon_info.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
# The MIT License (MIT)
# Copyright © 2024 Opentensor Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the “Software”), to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
# and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of
# the Software.
#
# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
# THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.

"""
This module defines the `AxonInfo` class, a data structure used to represent information about an axon endpoint
in the bittensor network.
Expand Down Expand Up @@ -105,7 +88,8 @@ def from_string(cls, json_string: str) -> "AxonInfo":
json_string (str): The JSON string representation of the AxonInfo object.
Returns:
AxonInfo: An instance of AxonInfo created from the JSON string. If decoding fails, returns a default `AxonInfo` object with default values.
AxonInfo: An instance of AxonInfo created from the JSON string. If decoding fails, returns a default
`AxonInfo` object with default values.
Raises:
json.JSONDecodeError: If there is an error in decoding the JSON string.
Expand Down
6 changes: 4 additions & 2 deletions bittensor/core/chain_data/neuron_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,10 @@ def from_weights_bonds_and_neuron_lite(
Args:
neuron_lite (NeuronInfoLite): A lite version of the neuron containing basic attributes.
weights_as_dict (dict[int, list[tuple[int, int]]]): A dictionary where the key is the UID and the value is a list of weight tuples associated with the neuron.
bonds_as_dict (dict[int, list[tuple[int, int]]]): A dictionary where the key is the UID and the value is a list of bond tuples associated with the neuron.
weights_as_dict (dict[int, list[tuple[int, int]]]): A dictionary where the key is the UID and the value is
a list of weight tuples associated with the neuron.
bonds_as_dict (dict[int, list[tuple[int, int]]]): A dictionary where the key is the UID and the value is a
list of bond tuples associated with the neuron.
Returns:
NeuronInfo: An instance of NeuronInfo populated with the provided weights and bonds.
Expand Down
6 changes: 4 additions & 2 deletions bittensor/core/chain_data/subnet_hyperparameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,15 @@ def from_vec_u8(cls, vec_u8: bytes) -> Optional["SubnetHyperparameters"]:
"""
Create a `SubnetHyperparameters` instance from a vector of bytes.
This method decodes the given vector of bytes using the `bt_decode` module and creates a new instance of `SubnetHyperparameters` with the decoded values.
This method decodes the given vector of bytes using the `bt_decode` module and creates a new instance of
`SubnetHyperparameters` with the decoded values.
Args:
vec_u8 (bytes): A vector of bytes to decode into `SubnetHyperparameters`.
Returns:
Optional[SubnetHyperparameters]: An instance of `SubnetHyperparameters` if decoding is successful, None otherwise.
Optional[SubnetHyperparameters]: An instance of `SubnetHyperparameters` if decoding is successful, None
otherwise.
"""
decoded = bt_decode.SubnetHyperparameters.decode(vec_u8)
return SubnetHyperparameters(
Expand Down
20 changes: 2 additions & 18 deletions bittensor/core/config.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
# The MIT License (MIT)
# Copyright © 2024 Opentensor Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the “Software”), to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
# and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of
# the Software.
#
# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
# THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.

"""Implementation of the config class, which manages the configuration of different Bittensor modules."""

import argparse
Expand Down Expand Up @@ -42,7 +25,8 @@ class Config(DefaultMunch):
parser (argparse.ArgumentParser): Command line parser object.
strict (bool): If ``true``, the command line arguments are strictly parsed.
args (list of str): Command line arguments.
default (Optional[Any]): Default value for the Config. Defaults to ``None``. This default will be returned for attributes that are undefined.
default (Optional[Any]): Default value for the Config. Defaults to ``None``. This default will be returned for
attributes that are undefined.
Returns:
config (bittensor.core.config.Config): Nested config object created from parser arguments.
Expand Down
Loading

0 comments on commit e75a0fc

Please sign in to comment.