[PATCH 12 of 24 yams V2] [misc] dekwargs ObjectRelation.__init__ a bit

Laurent Peuch cortex at worlddomination.be
Wed Mar 4 15:17:48 CET 2020


# HG changeset patch
# User Laurent Peuch <cortex at worlddomination.be>
# Date 1580225452 -3600
#      Tue Jan 28 16:30:52 2020 +0100
# Node ID e44be58e5f3a7c2a0de32b5be945bbac91286383
# Parent  d78a8746c5d51327527c3626398711ab844c6665
# Available At https://hg.logilab.org/users/lpeuch/yams
#              hg pull https://hg.logilab.org/users/lpeuch/yams -r e44be58e5f3a
# EXP-Topic type_annotations
[misc] dekwargs ObjectRelation.__init__ a bit

diff --git a/yams/buildobjs.py b/yams/buildobjs.py
--- a/yams/buildobjs.py
+++ b/yams/buildobjs.py
@@ -222,7 +222,7 @@ class ObjectRelation(object):
     cardinality = MARKER
     constraints = MARKER
 
-    def __init__(self, etype, **kwargs) -> None:
+    def __init__(self, etype, override: bool = False, **kwargs) -> None:
         if self.__class__.__name__ == 'ObjectRelation':
             warn('[yams 0.29] ObjectRelation is deprecated, '
                  'use RelationDefinition subclass', DeprecationWarning,
@@ -235,12 +235,11 @@ class ObjectRelation(object):
         self.package = PACKAGE
         self.name = '<undefined>'
         self.etype = etype
+        self.override = override
 
         if self.constraints:
             self.constraints = list(self.constraints)
 
-        self.override = kwargs.pop('override', False)
-
         if kwargs.pop('meta', None):
             warn('[yams 0.37.0] meta is deprecated',
                  DeprecationWarning, stacklevel=3)



More information about the cubicweb-devel mailing list