1919assert issubclass (BuildTargetEnum , Enum ) # nosec
2020
2121__all__ : tuple [str , ...] = (
22- "LogLevel" ,
2322 "BootModeEnum" ,
2423 "BuildTargetEnum" ,
24+ "LogLevel" ,
2525)
2626
2727
7676
7777
7878class ConstrainedStr (str ):
79+ """Emulates pydantic's v1 constrained types
80+
81+ DEPRECATED: Use instead Annotated[str, StringConstraints(...)]
82+ """
83+
7984 pattern : str | Pattern [str ] | None = None
8085 min_length : int | None = None
8186 max_length : int | None = None
@@ -102,6 +107,11 @@ def __get_pydantic_core_schema__(cls, _source_type, _handler):
102107
103108
104109class IDStr (ConstrainedStr ):
110+ """Non-empty bounded string used as identifier
111+
112+ DEPRECATED: Use instead Annotated[str, StringConstraints(strip_whitespace=True, min_length=1, max_length=100)]
113+ """
114+
105115 strip_whitespace = True
106116 min_length = 1
107117 max_length = 100
@@ -126,18 +136,29 @@ def concatenate(*args: "IDStr", link_char: str = " ") -> "IDStr":
126136
127137
128138class ShortTruncatedStr (ConstrainedStr ):
129- # NOTE: Use to input e.g. titles or display names
130- # A truncated string:
131- # - Strips whitespaces and truncate strings that exceed the specified characters limit (curtail_length).
132- # - Ensures that the **input** data length to the API is controlled and prevents exceeding large inputs silently, i.e. without raising errors.
133- # SEE https://github.com/ITISFoundation/osparc-simcore/pull/5989#discussion_r1650506583
139+ """A truncated string used to input e.g. titles or display names
140+
141+ - Strips whitespaces and truncate strings that exceed the specified characters limit (curtail_length).
142+ - Ensures that the **input** data length to the API is controlled and prevents exceeding large inputs silently,
143+ i.e. without raising errors.
144+
145+ SEE https://github.com/ITISFoundation/osparc-simcore/pull/5989#discussion_r1650506583
146+
147+ DEPRECATED: Use instead Annotated[str, StringConstraints(strip_whitespace=True), trim_string_before(max_length=600)]
148+ """
149+
134150 strip_whitespace = True
135151 curtail_length = 600
136152
137153
138154class LongTruncatedStr (ConstrainedStr ):
139- # NOTE: Use to input e.g. descriptions or summaries
140- # Analogous to ShortTruncatedStr
155+ """Use to input e.g. descriptions or summaries
156+
157+ Analogous to ShortTruncatedStr
158+
159+ DEPRECATED: Use instead Annotated[str, StringConstraints(strip_whitespace=True), trim_string_before(max_length=65536)]
160+ """
161+
141162 strip_whitespace = True
142163 curtail_length = 65536 # same as github descripton
143164
0 commit comments