Skip to content

Commit

Permalink
docs: fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey committed Oct 24, 2024
1 parent 8a4eddf commit e7d15a2
Show file tree
Hide file tree
Showing 7 changed files with 126 additions and 11 deletions.
84 changes: 82 additions & 2 deletions docs/methoddocs/ape.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,86 @@
# ape

```{eval-rst}
.. automodule:: ape
:members:
.. attribute:: ape.accounts
Manage accounts.
See the `AccountManager <../methoddocs/managers.html#ape.managers.accounts.AccountManager>`__ for more info.
```

```{eval-rst}
.. attribute:: ape.chain
Manage the blockchain.
See the `ChainManager <../methoddocs/managers.html#ape.managers.chain.ChainManager>`__ for more info.
```

```{eval-rst}
.. attribute:: ape.networks
Manage networks.
See the `NetworkManager <../methoddocs/managers.html#ape.managers.networks.NetworkManager>`__ for more info.
```

```{eval-rst}
.. attribute:: ape.project
Access the local project.
See the `ProjectManager <../methoddocs/managers.html#ape.managers.project.ProjectManager>`__ for more info.
```

```{eval-rst}
.. attribute:: ape.config
Access the local project config.
See the `ConfigManager <../methoddocs/managers.html#ape.managers.config.ConfigManager>`__ for more info.
```

```{eval-rst}
.. function:: ape.Project(path)
Instantiate other projects.
See the `ProjectManager <../methoddocs/managers.html#ape.managers.project.ProjectManager>`__ for more info.
:path: The path to the project.
```

```{eval-rst}
.. function:: ape.Contract(address, contract_type)
Instantiate contract-classes at a given address.
See the `ContractInstance <../methoddocs/contracts.html#ape.contracts.base.ContractInstance>`__ for more info.
:address: The address of the instance.
:contract_type: Optionally provide the ABI or contract type data.
```

```{eval-rst}
.. function:: ape.convert(value, to_type)
Conversion utility.
See the `ConversionManager <../methoddocs/managers.html#ape.managers.converters.ConversionManager>`__ for more info.
:value: The value to convert.
:to_type: The destination type.
Example usage::
result = ape.convert("1 ETH", int)
```

```{eval-rst}
.. attribute:: ape.compilers
Access compiler classes.
See the `CompilerManager <../methoddocs/managers.html#ape.managers.compilers.CompilerManager>`__ for more info.
```

```{eval-rst}
.. function:: ape.reverts(expected_message, dev_message)
Catch contract-revert exceptions.
Mimics ``pytest.raises``.
:expected_message: The expected revert message (optional).
:dev_message: The expected dev-message (optional).
```
41 changes: 38 additions & 3 deletions docs/methoddocs/types.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,44 @@
:show-inheritance:
```

## Miscellaneous
## Events

```{eval-rst}
.. automodule:: ape.types
:members: BlockID, BaseContractLog, ContractLog, MockContractLog
.. automodule:: ape.types.events
:members: ContractLog, ContractLogContainer, MockContractLog, LogFilter
```

## VM

```{eval-rst}
.. automodule:: ape.types.vm
:members: BlockID, SnapshotID
```

## Gas

```{eval-rst}
.. automodule:: ape.types.gas
:members: GasLimit, AutoGasLimit
```

## Trace

```{eval-rst}
.. automodule:: ape.types.trace
:members: GasReport, ControlFlow, SourceTraceback
```

## Units

```{eval-rst}
.. automodule:: ape.types.units
:members: CurrencyValueComparable, CurrencyValue
```

## Basic

```{eval-rst}
.. automodule:: ape.types.basic
:members: HexInt
```
2 changes: 1 addition & 1 deletion src/ape/api/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ def _plugin_configs(self) -> dict:
self.__pydantic_extra__ = self.__pydantic_extra__ or {}
return self.__pydantic_extra__

def __repr__(self):
def __repr__(self) -> str:
return "<ape-config.yaml>"

def __str__(self) -> str:
Expand Down
2 changes: 1 addition & 1 deletion src/ape/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ def __enter__(self):
def __exit__(self, exc_type, exc_val, exc_tb):
return False

def __str__(self):
def __str__(self) -> str:
if self._seconds in [None, ""]:
return ""

Expand Down
2 changes: 1 addition & 1 deletion src/ape/plugins/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ def is_available(self) -> bool:

return self.module_name in _get_available_plugins()

def __str__(self):
def __str__(self) -> str:
"""
A string like ``trezor==0.4.0``.
"""
Expand Down
4 changes: 2 additions & 2 deletions src/ape/utils/basemodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def __get__(self, obj, owner):
return self.fn(owner)


class manager_access:
class manager_access(property):
_cache = None

def __init__(self, fn):
Expand Down Expand Up @@ -206,7 +206,7 @@ def plugin_manager(cls) -> "PluginManager":
plugins = import_module("ape.managers.plugins")
return plugins.PluginManager()

@manager_access
@classproperty
def Project(cls) -> type["ProjectManager"]:
"""
The ``Project`` factory class for creating
Expand Down
2 changes: 1 addition & 1 deletion src/ape_pm/dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def uri(self) -> str:

return _uri

def __repr__(self):
def __repr__(self) -> str:
cls_name = getattr(type(self), "__name__", GithubDependency.__name__)
return f"<{cls_name} github={self.github}>"

Expand Down

0 comments on commit e7d15a2

Please sign in to comment.