Skip to content

Commit

Permalink
Update the docs for BaseField initializer
Browse files Browse the repository at this point in the history
  • Loading branch information
daveraja committed May 8, 2024
1 parent f498bd3 commit c7b0602
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion clorm/orm/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1359,7 +1359,8 @@ class DateField(StringField):
value when none has been specified.
index (bool): Determine if this field should be indexed by default in a
``FactBase```. Defaults to ``False``.
``FactBase```. Defaults to ``False``. WARNING: this parameter will be deprecated in
a future version of Clorm. Indexing should be explicitly set in the FactBase object.
"""

Expand All @@ -1370,6 +1371,21 @@ def __init__(
default_factory: Callable[[], Any] = MISSING,
index: Any = MISSING,
) -> None:
"""Initialize a field instance.
Args:
default: A default value to be used when instantiating a ``Predicate`` object and no
value has been specified.
default_factory: A unary function (ie. a function with no arguments) for generating a
value when none has been specified.
index (bool): Determine if this field should be indexed by default in a
``FactBase```. Defaults to ``False``. WARNING: this parameter will be deprecated in
a future version of Clorm. Indexing should be explicitly set in the FactBase object.
"""
self._index = index if index is not MISSING else False
if default is not MISSING and default_factory is not MISSING:
raise ValueError("can not specify both default and default_factory")
Expand Down

0 comments on commit c7b0602

Please sign in to comment.