Skip to content

Commit

Permalink
Docstrings update
Browse files Browse the repository at this point in the history
  • Loading branch information
thewhaleking committed Jan 9, 2025
1 parent dc60e03 commit d897b70
Showing 1 changed file with 21 additions and 42 deletions.
63 changes: 21 additions & 42 deletions bittensor/utils/substrate_utils/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,16 @@ def create_from_data(
"""
Create a StorageKey instance providing raw storage key bytes
Parameters
----------
data: bytes representation of the storage key
runtime_config: RuntimeConfigurationObject
metadata: GenericMetadataVersioned
value_scale_type: type string of to decode result data
pallet: name of pallet
storage_function: name of storage function
Returns
-------
StorageKey
Args:
data: bytes representation of the storage key
runtime_config: RuntimeConfigurationObject
metadata: GenericMetadataVersioned
value_scale_type: type string of to decode result data
pallet: name of pallet
storage_function: name of storage function
Returns:
StorageKey
"""
if not value_scale_type and pallet and storage_function:
metadata_pallet = metadata.get_metadata_pallet(pallet)
Expand Down Expand Up @@ -107,17 +105,15 @@ def create_from_storage_function(
"""
Create a StorageKey instance providing storage function details
Parameters
----------
pallet: name of pallet
storage_function: name of storage function
params: Optional list of parameters in case of a Mapped storage function
runtime_config: RuntimeConfigurationObject
metadata: GenericMetadataVersioned
Returns
-------
StorageKey
Args:
pallet: name of pallet
storage_function: name of storage function
params: Optional list of parameters in case of a Mapped storage function
runtime_config: RuntimeConfigurationObject
metadata: GenericMetadataVersioned
Returns:
StorageKey
"""
storage_key_obj = cls(
pallet=pallet,
Expand Down Expand Up @@ -149,9 +145,7 @@ def to_hex(self) -> str:
"""
Returns a Hex-string representation of current StorageKey data
Returns
-------
str
Returns:
Hex string
"""
if self.data:
Expand All @@ -160,10 +154,6 @@ def to_hex(self) -> str:
def generate(self) -> bytes:
"""
Generate a storage key for current specified pallet/function/params
Returns
-------
bytes
"""

# Search storage call in metadata
Expand Down Expand Up @@ -206,7 +196,7 @@ def generate(self) -> bytes:
self.params_encoded.append(param_obj.encode(param))

for idx, param in enumerate(self.params_encoded):
# Get hasher assiociated with param
# Get hasher associated with param
try:
param_hasher = hashers[idx]
except IndexError:
Expand Down Expand Up @@ -251,17 +241,6 @@ def generate(self) -> bytes:
return self.data

def decode_scale_value(self, data: Optional[ScaleBytes] = None) -> ScaleType:
"""
Parameters
----------
data
Returns
-------
"""

result_found = False

if data is not None:
Expand Down

0 comments on commit d897b70

Please sign in to comment.