[PATCH 04 of 24 yams V2] [mypy] add type declaration for RichString
Laurent Peuch
cortex at worlddomination.be
Wed Mar 4 15:17:40 CET 2020
# HG changeset patch
# User Laurent Peuch <cortex at worlddomination.be>
# Date 1579006065 -3600
# Tue Jan 14 13:47:45 2020 +0100
# Node ID 6401553004303a68f2f362aa958dc4beaf3d521f
# Parent e6984be837f1bd4f7923d1436bf3b08bc15f77e8
# Available At https://hg.logilab.org/users/lpeuch/yams
# hg pull https://hg.logilab.org/users/lpeuch/yams -r 640155300430
# EXP-Topic type_annotations
[mypy] add type declaration for RichString
diff --git a/yams/buildobjs.py b/yams/buildobjs.py
--- a/yams/buildobjs.py
+++ b/yams/buildobjs.py
@@ -377,8 +377,15 @@ class Interval(AbstractTypedAttribute):
# provides a RichString factory for convenience
-def RichString(default_format='text/plain', format_constraints=None, required=False, maxsize=None,
- formula=MARKER, vocabulary=None, unique=None, override=False, **kwargs):
+def RichString(default_format: str = 'text/plain',
+ format_constraints=None,
+ required: bool = False,
+ maxsize: Optional[int] = None,
+ formula=MARKER,
+ vocabulary: Optional[List[str]] = None,
+ unique: Optional[bool] = None,
+ override: bool = False,
+ **kwargs):
"""RichString is a convenience attribute type for attribute containing text
in a format that should be specified in another attribute.
More information about the cubicweb-devel
mailing list