Skip to content

Commit

Permalink
Add a few more docstrings & fix rtd build
Browse files Browse the repository at this point in the history
  • Loading branch information
guilledk committed Aug 6, 2024
1 parent bd25128 commit 7ccde7e
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 8 deletions.
14 changes: 10 additions & 4 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@ build:
tools:
python: '3.11'
jobs:
pre_install:
post_create_environment:
# Install poetry
# https://python-poetry.org/docs/#installing-manually
- pip install poetry
- poetry config virtualenvs.create false
- poetry install --with=docs

# Build documentation in the "docs/" directory with Sphinx
post_install:
# Install dependencies with 'docs' dependency group
# https://python-poetry.org/docs/managing-dependencies/#dependency-groups
# VIRTUAL_ENV needs to be set manually for now.
# See https://github.com/readthedocs/readthedocs.org/pull/11152/
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry install --with=snaps --with=docs

sphinx:
configuration: docs/source/conf.py
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = 'py-leap'
copyright = '2023, Guillermo Rodriguez'
copyright = '2023-*, Guillermo Rodriguez'
author = 'Guillermo Rodriguez'
release = 'v0.1a17'
release = 'v0.1a25'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = 'py-leap'
version = '0.1a24'
version = '0.1a25'
packages = [{include = 'leap', from='src'}]
description = ''
authors = ['Guillermo Rodriguez <[email protected]>']
Expand Down
20 changes: 19 additions & 1 deletion src/leap/cleos.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,19 @@ def __init__(
# local abi store methods

def load_abi(self, account: str, abi: dict):
'''Load abi dict into internal store
'''
self._loaded_abis[account] = abi

def load_abi_file(self, account: str, abi_path: str | Path):
'''Load abi file into internal store
'''
with open(abi_path, 'rb') as abi_file:
self.load_abi(account, json_module.load(abi_file))

def get_loaded_abi(self, account: str) -> dict:
'''Return a previously loaded abi
'''
if account not in self._loaded_abis:
raise ValueError(f'ABI for {account} not loaded!')

Expand Down Expand Up @@ -478,6 +484,8 @@ def deploy_contract_from_path(
contract_name: str | None = None,
**kwargs
):
'''Deploy a contract from a filesystem directory
'''
if not contract_name:
contract_name = Path(contract_path).parts[-1]

Expand All @@ -499,6 +507,8 @@ def get_account(
self,
account_name: str
) -> dict:
'''Call /v1/chain/get_account
'''
return self._post(
'/v1/chain/get_account',
json={
Expand Down Expand Up @@ -547,18 +557,24 @@ def get_abi(self, account_name: str) -> dict:
return resp['abi']

def create_snapshot(self, body: dict):
'''Create a snapshot, must have producer_plugin_api enabled
'''
return self._post(
'/v1/producer/create_snapshot',
json=body
)

def schedule_snapshot(self, body: dict):
'''Schedule snapshot creation, must have producer_plugin_api enabled
'''
return self._post(
'/v1/producer/schedule_snapshot',
json=body
)

def get_node_activations(self) -> list[dict]:
'''Get activated protocol features
'''
lower_bound = 0
step = 250
more = True
Expand Down Expand Up @@ -1149,6 +1165,8 @@ async def aget_table(
table: str,
**kwargs
) -> list[dict]:
'''Async get table
'''

done = False
rows = []
Expand Down Expand Up @@ -1190,7 +1208,7 @@ def get_info(self) -> dict[str, str | int]:
return self._get('/v1/chain/get_info')

async def a_get_info(self) -> dict[str, str | int]:
'''Get blockchain statistics.
'''Async get blockchain statistics.
- ``server_version``
- ``head_block_num``
Expand Down

0 comments on commit 7ccde7e

Please sign in to comment.