[PATCH 10 of 15 yams V3] [mypy] partially type AbstractTypedAttribute.__init__ declaration

Laurent Peuch cortex at worlddomination.be
Wed Jan 15 20:59:10 CET 2020


# HG changeset patch
# User Laurent Peuch <cortex at worlddomination.be>
# Date 1579005300 -3600
#      Tue Jan 14 13:35:00 2020 +0100
# Node ID 19015dfae04bc1d435037fe4b2af83d80c860a8e
# Parent  3dce73d580f5acb5dfaf31f55e02a704cd2a1e19
# Available At https://hg.logilab.org/users/lpeuch/yams
#              hg pull https://hg.logilab.org/users/lpeuch/yams -r 19015dfae04b
[mypy] partially type AbstractTypedAttribute.__init__ declaration

diff --git a/yams/buildobjs.py b/yams/buildobjs.py
--- a/yams/buildobjs.py
+++ b/yams/buildobjs.py
@@ -19,6 +19,7 @@
 
 __docformat__ = "restructuredtext en"
 
+from typing import Optional
 from warnings import warn
 from copy import copy
 
@@ -232,8 +233,9 @@ class AbstractTypedAttribute(SubjectRela
     subclasses must provide a <etype> attribute to be instantiable
     """
 
-    def __init__(self, metadata=None, required=False, maxsize=None, formula=MARKER,
-                 vocabulary=None, unique=None, override=False, **kwargs):
+    def __init__(self, metadata: Optional[dict] = None, required: bool = False,
+                 maxsize: Optional[int] = None, formula=MARKER,
+                 vocabulary=None, unique=None, override: bool = False, **kwargs):
         # Store metadata
         if metadata is None:
             metadata = {}



More information about the cubicweb-devel mailing list