Skip to content

Commit

Permalink
Use TypeVar for Schema.schema type
Browse files Browse the repository at this point in the history
  • Loading branch information
cdce8p committed Jun 25, 2024
1 parent 66df7be commit d522368
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions voluptuous/schema_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,10 @@ def Extra(_) -> None:
]
# fmt: on

_SchemableT = typing.TypeVar("_SchemableT", bound=Schemable)

class Schema(object):

class Schema(typing.Generic[_SchemableT]):
"""A validation schema.
The schema is a Python tree-like structure where nodes are pattern
Expand Down Expand Up @@ -192,7 +194,7 @@ class Schema(object):
}

def __init__(
self, schema: Schemable, required: bool = False, extra: int = PREVENT_EXTRA
self, schema: _SchemableT, required: bool = False, extra: int = PREVENT_EXTRA
) -> None:
"""Create a new Schema.
Expand Down

0 comments on commit d522368

Please sign in to comment.