[PATCH 04 of 23 yams] [mypy] add type declaration for RichString

Laurent Peuch cortex at worlddomination.be
Fri Feb 14 15:59:54 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 173467b25265bbd4c7eeab7fbd2410bf9e791077
# Parent  0c21474c8200d5a8eb99e2a3aac5d48ac6ee85cc
# Available At https://hg.logilab.org/users/lpeuch/yams
#              hg pull https://hg.logilab.org/users/lpeuch/yams -r 173467b25265
[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