Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
Field(json_schema_extra={"additionalProperties": False}),
],
)
"""A mapping from language to the most commonly used or recognized name in that language."""
CommonNames.__doc__ = """A mapping from language to the most commonly used or recognized name in that language."""


class NameVariant(str, DocumentedEnum):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
),
],
)
"""
OpeningHours.__doc__ = """
Time span or time spans during which something is open or active, specified in the OpenStreetMap
opening hours specification: https://wiki.openstreetmap.org/wiki/Key:opening_hours/specification.
"""
Original file line number Diff line number Diff line change
Expand Up @@ -24,71 +24,71 @@
)

uint8 = NewType("uint8", Annotated[int, Field(ge=0, le=255)]) # type: ignore [type-arg]
"""
uint8.__doc__ = """
Portable 8-bit unsigned integer.

This is an `int` at runtime, but using `uint8` for Pydantic model fields instead of `int` makes them
portable across different serialization and validation platforms.
"""

uint16 = NewType("uint16", Annotated[int, Field(ge=0, le=65535)]) # type: ignore[type-arg]
"""
uint16.__doc__ = """
Portable 16-bit unsigned integer.

This is an `int` at runtime, but using `uint16` for Pydantic model fields instead of `int` makes
them portable across different serialization and validation platforms.
"""

uint32 = NewType("uint32", Annotated[int, Field(ge=0, le=4294967295)]) # type: ignore[type-arg]
"""
uint32.__doc__ = """
Portable 32-bit unsigned integer.

This is an `int` at runtime, but using `uint32` for Pydantic model fields instead of `int` makes
them portable across different serialization and validation platforms.
"""

int8 = NewType("int8", Annotated[int, Field(ge=-128, le=127)]) # type: ignore[type-arg]
"""
int8.__doc__ = """
Portable 8-bit signed integer.

This is an `int` at runtime, but using `int8` for Pydantic model fields instead of `int` makes them
portable across different serialization and validation platforms.
"""

int16 = NewType("int16", Annotated[int, Field(ge=-32768, le=32767)]) # type: ignore[type-arg]
"""
int16.__doc__ = """
Portable 16-bit signed integer.

This is an `int` at runtime, but using `int16` for Pydantic model fields instead of `int` makes them
portable across different serialization and validation platforms.
"""

int32 = NewType("int32", Annotated[int, Field(ge=-(2**31), le=2**31 - 1)]) # type: ignore[type-arg]
"""
int32.__doc__ = """
Portable 32-bit signed integer.

This is an `int` at runtime, but using `int32` for Pydantic model fields instead of `int` makes them
portable across different serialization and validation platforms.
"""

int64 = NewType("int64", Annotated[int, Field(ge=-(2**63), le=2**63 - 1)]) # type: ignore[type-arg]
"""
int64.__doc__ = """
Portable 64-bit signed integer.

This is an `int` at runtime, but using `int64` for Pydantic model fields instead of `int` makes them
portable across different serialization and validation platforms.
"""

float32 = NewType("float32", float) # type: ignore[type-arg]
"""
float32.__doc__ = """
Portable IEEE 32-bit floating point number.

This is a `float` at runtime, but using `float32` for Pydantic model fields instead of `float` makes
them portable across different serialization and validation platforms.
"""

float64 = NewType("float64", float) # type: ignore[type-arg]
"""
float64.__doc__ = """
Portable IEEE 64-bit floating point number.

This is a `float` at runtime, but using `float64` for Pydantic model fields instead of `float` makes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
),
],
)
"""
Id.__doc__ = """
A unique identifier.
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
Field(description="An ISO 3166-1 alpha-2 country code"),
],
) # type: ignore [type-arg]
"""
CountryCodeAlpha2.__doc__ = """
An ISO-3166-1 alpha-2 country code.
"""

Expand All @@ -49,7 +49,7 @@
),
],
) # type: ignore [type-arg]
"""
HexColor.__doc__ = """
A color represented as an #RRGGBB or #RGB hexadecimal string.

For example:
Expand All @@ -67,7 +67,7 @@
Field(description="A JSON Pointer (as described in RFC-6901)"),
],
) # type: ignore [type-arg]
"""
JsonPointer.__doc__ = """
A JSON Pointer

As described in `the JSON Pointer specification, RFC-6901`_.
Expand All @@ -91,7 +91,7 @@
),
],
) # type: ignore [type-arg]
"""
LanguageTag.__doc__ = """
A BCP-47 language tag.

As described in `Tags for Identifying Languages, BCP-47`_.
Expand All @@ -114,7 +114,7 @@
Field(description="A string that contains no whitespace characters"),
],
) # type: ignore [type-arg]
"""
NoWhitespaceString.__doc__ = """
A string that contains no whitespace characters.
"""

Expand All @@ -124,7 +124,7 @@
str, PhoneNumberConstraint(), Field(description="An international phone number")
],
) # type: ignore [type-arg]
"""
PhoneNumber.__doc__ = """
An international phone number.
"""

Expand All @@ -136,12 +136,12 @@
Field(description="An ISO 3166-2 principal subdivision code"),
],
) # type: ignore [type-arg]
"""
RegionCode.__doc__ = """
An ISO 3166-2 principal subdivision code.
"""

SnakeCaseString = NewType("SnakeCaseString", Annotated[str, SnakeCaseConstraint()])
"""
SnakeCaseString.__doc__ = """
A string that looks like a snake case identifier, like a Python variable name (*e.g.*, `foo_bar`).
"""

Expand All @@ -155,7 +155,7 @@
),
],
) # type: ignore [type-arg]
"""
StrippedString.__doc__ = """
A string without leading or trailing whitespace.
"""

Expand All @@ -167,7 +167,7 @@
Field(description="A wikidata ID, as found on https://www.wikidata.org/"),
],
) # type: ignore [type-arg]
"""
WikidataId.__doc__ = """
A wikidata ID, as found on https://www.wikidata.org/.

- `"Q42"`
Expand Down
Loading