From 2bc5e60af346bc32cc8defdb34e53c3044f36683 Mon Sep 17 00:00:00 2001 From: Alex Mykyta Date: Wed, 11 Oct 2023 22:28:41 -0700 Subject: [PATCH] Add missing schema docs --- docs/for-devs/cfg_schema.rst | 5 +++++ src/peakrdl/config/schema.py | 24 ++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/docs/for-devs/cfg_schema.rst b/docs/for-devs/cfg_schema.rst index 749fc92..a12a60d 100644 --- a/docs/for-devs/cfg_schema.rst +++ b/docs/for-devs/cfg_schema.rst @@ -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 ^^^^^ @@ -123,3 +124,7 @@ Paths Python Objects ^^^^^^^^^^^^^^ .. autoclass:: peakrdl.config.schema.PythonObjectImport + +Misc +^^^^ +.. autoclass:: peakrdl.config.schema.Choice diff --git a/src/peakrdl/config/schema.py b/src/peakrdl/config/schema.py index 54a0e12..639f313 100644 --- a/src/peakrdl/config/schema.py +++ b/src/peakrdl/config/schema.py @@ -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