Skip to content

Commit

Permalink
Add missing schema docs
Browse files Browse the repository at this point in the history
  • Loading branch information
amykyta3 committed Oct 12, 2023
1 parent d776341 commit 2bc5e60
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docs/for-devs/cfg_schema.rst
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ Base Datatypes
.. autoclass:: peakrdl.config.schema.DateTime
.. autoclass:: peakrdl.config.schema.Date
.. autoclass:: peakrdl.config.schema.Time
.. autoclass:: peakrdl.config.schema.AnyType

Paths
^^^^^
Expand All @@ -123,3 +124,7 @@ Paths
Python Objects
^^^^^^^^^^^^^^
.. autoclass:: peakrdl.config.schema.PythonObjectImport

Misc
^^^^
.. autoclass:: peakrdl.config.schema.Choice
24 changes: 24 additions & 0 deletions src/peakrdl/config/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,51 @@ def extract(self, data: Any, path: str, err_ctx: str) -> Any:
return data

class String(_SimpleType):
"""
Matches a string.
"""
TYPE = str

class Integer(_SimpleType):
"""
Matches an integer.
"""
TYPE = int

class Float(_SimpleType):
"""
Matches a float.
"""
TYPE = float

class Boolean(_SimpleType):
"""
Matches a boolean.
"""
TYPE = bool

class DateTime(_SimpleType):
"""
Matches a date + time.
"""
TYPE = datetime.datetime # type: ignore

class Date(_SimpleType):
"""
Matches a date.
"""
TYPE = datetime.date # type: ignore

class Time(_SimpleType):
"""
Matches a time.
"""
TYPE = datetime.time

class AnyType(Schema):
"""
Wildcard. Matches any type.
"""
def extract(self, data: Any, path: str, err_ctx: str) -> Any:
return data

Expand Down

0 comments on commit 2bc5e60

Please sign in to comment.