[PATCH 8 of 9 yams] [mypy] partially type AbstractTypedAttribute.__init__ declaration

Laurent Peuch cortex at worlddomination.be
Tue Jan 14 14:18:23 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 ba2356e331e41bce9f8698c0c2b90e580b6b1a07
# Parent  f4f9bea0e38c5522498d7b4ba59562185335bcf1
# Available At https://hg.logilab.org/users/lpeuch/yams
#              hg pull https://hg.logilab.org/users/lpeuch/yams -r ba2356e331e4
[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
 
@@ -221,8 +222,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