Warning

This document is for an old release of Galaxy. You can alternatively view this page in the latest release if it exists or view the top of the latest release's documentation.

Source code for galaxy.schema.types

from datetime import datetime

from pydantic.datetime_parse import parse_datetime
from typing_extensions import Literal

# Relative URLs cannot be validated with AnyUrl, they need a scheme.
# Making them an alias of `str` for now
RelativeUrl = str

# TODO: we may want to add a custom validator for this and for RelativeUrl
AbsoluteOrRelativeUrl = RelativeUrl

LatestLiteral = Literal["latest"]


[docs]class OffsetNaiveDatetime(datetime): @classmethod def __get_validators__(cls): yield cls.validate
[docs] @classmethod def validate(cls, v): v = parse_datetime(v) return v.replace(tzinfo=None) - v.utcoffset() if v.tzinfo else v