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

Laurent Peuch cortex at worlddomination.be
Wed Mar 4 15:17:39 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 e6984be837f1bd4f7923d1436bf3b08bc15f77e8
# Parent  fadce0cbddeb3c003361d439be6a901e592d1042
# Available At https://hg.logilab.org/users/lpeuch/yams
#              hg pull https://hg.logilab.org/users/lpeuch/yams -r e6984be837f1
# EXP-Topic type_annotations
[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