Skip to content

Commit

Permalink
Fix Cairo data types docs (#1551)
Browse files Browse the repository at this point in the history
* Fix Cairo data types docs

* Remove `TypeIdentifier` from data types docs
  • Loading branch information
franciszekjob authored Jan 13, 2025
1 parent 2478a6c commit 9edf725
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 13 deletions.
28 changes: 27 additions & 1 deletion docs/api/data_types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ Module containing representations of Cairo types. Mostly used to generate proper
.. autoclass:: FeltType
:exclude-members: __init__, __new__

.. autoclass:: BoolType
:exclude-members: __init__, __new__

.. autoclass:: TupleType
:exclude-members: __init__, __new__
:members: types
Expand All @@ -25,4 +28,27 @@ Module containing representations of Cairo types. Mostly used to generate proper

.. autoclass:: StructType
:exclude-members: __init__, __new__
:members: types
:members: name, types

.. autoclass:: EnumType
:exclude-members: __init__, __new__
:members: name, variants

.. autoclass:: OptionType
:exclude-members: __init__, __new__
:members: type

.. autoclass:: UintType
:exclude-members: __init__, __new__
:members: bits

.. autoclass:: UnitType
:exclude-members: __init__, __new__

.. autoclass:: EventType
:exclude-members: __init__, __new__
:members: name, types, keys

.. autoclass:: NonZeroType
:exclude-members: __init__, __new__
:members: type
24 changes: 12 additions & 12 deletions starknet_py/cairo/data_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class TupleType(CairoType):
Type representation of Cairo tuples without named fields.
"""

types: List[CairoType] #: types of every tuple element.
types: List[CairoType] #: Types of every tuple element.


@dataclass
Expand All @@ -41,7 +41,7 @@ class NamedTupleType(CairoType):
Type representation of Cairo tuples with named fields.
"""

types: OrderedDict[str, CairoType] #: types of every tuple member.
types: OrderedDict[str, CairoType] #: Types of every tuple member.


@dataclass
Expand All @@ -50,7 +50,7 @@ class ArrayType(CairoType):
Type representation of Cairo arrays.
"""

inner_type: CairoType #: type of element inside array.
inner_type: CairoType #: Type of element inside array.


@dataclass
Expand All @@ -70,8 +70,8 @@ class EnumType(CairoType):
Type representation of Cairo enums.
"""

name: str
variants: OrderedDict[str, CairoType]
name: str #: Enum name.
variants: OrderedDict[str, CairoType] #: Enum variants.


@dataclass
Expand All @@ -80,7 +80,7 @@ class OptionType(CairoType):
Type representation of Cairo options.
"""

type: CairoType
type: CairoType #: Typed of element wrapped in the Option.


@dataclass
Expand All @@ -89,7 +89,7 @@ class UintType(CairoType):
Type representation of Cairo unsigned integers.
"""

bits: int
bits: int #: Number of bits in the integer.

def check_range(self, value: int):
"""
Expand All @@ -103,7 +103,7 @@ class TypeIdentifier(CairoType):
Type representation of Cairo identifiers.
"""

name: str
name: str #: Identifier name.


@dataclass
Expand All @@ -119,9 +119,9 @@ class EventType(CairoType):
Type representation of Cairo Event.
"""

name: str
types: OrderedDict[str, CairoType]
keys: List[str]
name: str #: Event name.
types: OrderedDict[str, CairoType] #: Types of every event member.
keys: List[str] #: Keys of every event member.


@dataclass
Expand All @@ -130,4 +130,4 @@ class NonZeroType(CairoType):
Type representation of Cairo NonZero.
"""

type: CairoType
type: CairoType #: Type of element wrapped in NonZero.

0 comments on commit 9edf725

Please sign in to comment.