Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch to add EthPM types back #64

Merged
merged 3 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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`.