Skip to content

Remove ExcludeOpts #1605

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

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions starknet_py/net/schemas/rpc/contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from marshmallow import EXCLUDE
from marshmallow import Schema as MarshmallowSchema
from marshmallow import SchemaOpts, ValidationError, fields, post_load
from marshmallow import ValidationError, fields, post_load

from starknet_py.abi.v0.schemas import ContractAbiEntrySchema
from starknet_py.net.client_models import (
Expand All @@ -22,7 +22,7 @@
from starknet_py.net.executable_models import CasmClass
from starknet_py.net.schemas.common import Felt, NumberAsHex
from starknet_py.net.schemas.rpc.executables_api import HintSchema
from starknet_py.utils.schema import ExcludeOpts, Schema
from starknet_py.utils.schema import Schema


class SyncStatusSchema(Schema):
Expand Down Expand Up @@ -183,10 +183,7 @@ def make_dataclass(self, data, **kwargs) -> CasmClassEntryPointsByType:
return CasmClassEntryPointsByType(**data)


# TODO(#1564): `CasmClassSchema` should inherit from `Schema` and shouldn't overwrite `OPTION_CLASS`
# once issue is resolved.
class CasmClassSchema(MarshmallowSchema):
OPTIONS_CLASS = ExcludeOpts
prime = NumberAsHex(data_key="prime", required=True)
bytecode = fields.List(Felt(), data_key="bytecode", required=True)
bytecode_segment_lengths = fields.List(
Expand Down
8 changes: 0 additions & 8 deletions starknet_py/utils/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,5 @@ def __init__(self, meta, **kwargs):
)


# TODO(#1564): `ExcludeOpts` should be removed once issue is resolved.
class ExcludeOpts(SchemaOpts):

def __init__(self, meta, **kwargs):
SchemaOpts.__init__(self, meta, **kwargs)
self.unknown = EXCLUDE


class Schema(MarshmallowSchema):
OPTIONS_CLASS = UnknownOpts
Loading