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

Laurent Peuch cortex at worlddomination.be
Fri Feb 14 16:00:02 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 62038b6f930d268febdff00070dfbf1859f98ea5
# Parent  0215dd0aefdd6580a6ae9e801769206fd281fb45
# Available At https://hg.logilab.org/users/lpeuch/yams
#              hg pull https://hg.logilab.org/users/lpeuch/yams -r 62038b6f930d
[misc] dekwargs ObjectRelation.__init__ a bit

diff --git a/yams/buildobjs.py b/yams/buildobjs.py
--- a/yams/buildobjs.py
+++ b/yams/buildobjs.py
@@ -220,7 +220,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,
@@ -233,12 +233,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