[PATCH 03 of 23 yams] [mypy] partially type AbstractTypedAttribute.__init__ declaration

Laurent Peuch cortex at worlddomination.be
Fri Feb 14 15:59:53 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 0c21474c8200d5a8eb99e2a3aac5d48ac6ee85cc
# Parent  a136e5120bc9a64cbbaa1d85707ceba3cf47351b
# Available At https://hg.logilab.org/users/lpeuch/yams
#              hg pull https://hg.logilab.org/users/lpeuch/yams -r 0c21474c8200
[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, List
 from warnings import warn
 from copy import copy
 
@@ -234,8 +235,12 @@ 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: Optional[List[str]] = None,
+                 unique: Optional[bool] = None,
+                 override: bool = False,
+                 **kwargs):
         # Store metadata
         if metadata is None:
             metadata = {}



More information about the cubicweb-devel mailing list