Skip to content

Commit

Permalink
Patch to add EthPM types back (#64)
Browse files Browse the repository at this point in the history
* Revert "remove types related to deprecated EthPM"

This reverts commit 18e27da.

* Revert duplicate `URI` definition.

* Newsfragment for #64
  • Loading branch information
reedsa committed Apr 16, 2024
1 parent 0b12dc0 commit 88b98ba
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 8 deletions.
21 changes: 21 additions & 0 deletions docs/eth_typing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,27 @@ A 32-byte identifier for a node in the Discovery DHT
NodeID = NewType('NodeID', bytes)
EthPM
-----

ContractName
~~~~~~~~~~~~

Any string conforming to the regular expression ``[a-zA-Z][a-zA-Z0-9_]{0,255}``.

.. code-block:: python
ContractName = NewType('ContractName', str)
URI
~~~

Any string that represents a URI.

.. code-block:: python
URI = NewType('URI', str)
EVM
---

Expand Down
10 changes: 8 additions & 2 deletions eth_typing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
from .enums import (
ForkName,
)
from .ethpm import (
URI,
ContractName,
Manifest,
)
from .evm import (
Address,
AnyAddress,
Expand All @@ -46,7 +51,6 @@
ValidationError,
)
from .networks import (
URI,
ChainId,
)

Expand All @@ -72,14 +76,16 @@
"Primitives",
"ForkName",
"ChainId",
"URI",
"ContractName",
"Manifest",
"Address",
"AnyAddress",
"BlockIdentifier",
"BlockNumber",
"ChecksumAddress",
"Hash32",
"HexAddress",
"URI",
"ValidationError",
"MismatchedABI",
)
Expand Down
9 changes: 9 additions & 0 deletions eth_typing/ethpm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from typing import (
Any,
Dict,
NewType,
)

ContractName = NewType("ContractName", str)
Manifest = NewType("Manifest", Dict[str, Any])
URI = NewType("URI", str)
6 changes: 0 additions & 6 deletions eth_typing/networks.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
from enum import (
IntEnum,
)
from typing import (
NewType,
)

URI = NewType("URI", str)
"""Any string that represents a URI."""


class ChainId(IntEnum):
Expand Down
1 change: 1 addition & 0 deletions newsfragments/64.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Put back types used for `EthPM`: `ContractName`, `Manifest`, and `URI`.

0 comments on commit 88b98ba

Please sign in to comment.