From 0d5771fd578e6fd8a675ee7f34431c27aaf47bd2 Mon Sep 17 00:00:00 2001 From: "Waylon S. Walker" Date: Fri, 28 Apr 2023 21:13:46 -0500 Subject: [PATCH] one models for testing --- examples/models.py | 94 ------------------------------------------ examples/person.py | 2 +- examples/person_cli.py | 2 +- 3 files changed, 2 insertions(+), 96 deletions(-) delete mode 100644 examples/models.py diff --git a/examples/models.py b/examples/models.py deleted file mode 100644 index 86e0422..0000000 --- a/examples/models.py +++ /dev/null @@ -1,94 +0,0 @@ -"""Models defines a set of classes for representing people and their hair. - -Classes: - -* `Alpha`: A class for representing an alpha value. -* `Color`: A class for representing a color. -* `Hair`: A class for representing hair. -* `Person`: A class for representing a person. - -""" - -from typing import Optional - -from pydantic import BaseModel, Field - - -class Alpha(BaseModel): - - """A class for representing an alpha value.""" - - a: int = Field( - ..., - description="The alpha value.", - ) - - -class Color(BaseModel): - - """A class for representing a color.""" - - r: int = Field( - ..., - description="The red component of the color.", - ) - g: int = Field( - ..., - description="The green component of the color.", - ) - b: int = Field( - ..., - description="The blue component of the color.", - ) - alpha: Alpha = Field( - ..., - description="The alpha value of the color.", - ) - - -class Hair(BaseModel): - - """A class for representing hair.""" - - color: Color = Field( - ..., - description="The color of the hair.", - ) - length: int = Field( - ..., - description="The length of the hair.", - ) - - -class Person(BaseModel): - - """A class for representing a person.""" - - name: str = Field( - ..., - description="The name of the person.", - ) - other_name: Optional[str] = Field( - None, - description="An optional other name for the person.", - ) - age: int = Field( - ..., - description="The age of the person.", - ) - email: Optional[str] = Field( - None, - description="An optional email address for the person.", - ) - pet: str = Field( - "dog", - description="The person's pet.", - ) - address: str = Field( - "123 Main St", - description="Where the person calls home.", - ) - hair: Hair = Field( - ..., - description="The person's hair.", - ) diff --git a/examples/person.py b/examples/person.py index b832223..62a60b4 100644 --- a/examples/person.py +++ b/examples/person.py @@ -6,8 +6,8 @@ SPDX-License-Identifier: MIT """ from pyannotate_runtime import collect_types -from examples.models import Person from pydantic_typer import expand_pydantic_args +from tests.models import Person @expand_pydantic_args() diff --git a/examples/person_cli.py b/examples/person_cli.py index e27c85c..af3faad 100644 --- a/examples/person_cli.py +++ b/examples/person_cli.py @@ -6,8 +6,8 @@ SPDX-License-Identifier: MIT """ import typer -from examples.models import Person from pydantic_typer import expand_pydantic_args +from tests.models import Person app = typer.Typer( name="pydantic_typer",