# HG changeset patch # User Laurent Peuch # Date 1576733629 -3600 # Node ID b1ef9690f3572dd12715f55f482610c25effded4 # Parent 5318da3497e80c5e15172e13326abd59c08f1130 [mypy] type __select__ everywhere diff -r 5318da3497e8 -r b1ef9690f357 cubicweb/appobject.py --- a/cubicweb/appobject.py Thu Dec 19 06:32:16 2019 +0100 +++ b/cubicweb/appobject.py Thu Dec 19 06:33:49 2019 +0100 @@ -29,11 +29,12 @@ """ +from typing import Union from logging import getLogger from logilab.common.logging_ext import set_log_methods -from logilab.common.registry import RegistrableObject, yes +from logilab.common.registry import RegistrableObject, yes, Predicate # the base class for all appobjects ############################################ @@ -74,7 +75,7 @@ such as `AnyEntity`, `EntityView`, `AnyRsetView`, `Action`... """ - __select__ = yes() + __select__: Union[None, str, Predicate] = yes() @classmethod def __registered__(cls, registry): diff -r 5318da3497e8 -r b1ef9690f357 cubicweb/view.py --- a/cubicweb/view.py Thu Dec 19 06:32:16 2019 +0100 +++ b/cubicweb/view.py Thu Dec 19 06:33:49 2019 +0100 @@ -22,11 +22,12 @@ import re from io import BytesIO +from typing import Union from warnings import warn from functools import partial from inspect import getframeinfo, stack -from logilab.common.registry import yes +from logilab.common.registry import yes, Predicate from logilab.mtconverter import xml_escape from rql import nodes @@ -358,7 +359,7 @@ class EntityView(View): """base class for views applying on an entity (i.e. uniform result set)""" - __select__ = non_final_entity() + __select__: Union[None, str, Predicate] = non_final_entity() category = _('entityview') def call(self, **kwargs): @@ -390,7 +391,7 @@ """base class for views which doesn't need a particular result set to be displayed (so they can always be displayed!) """ - __select__ = none_rset() + __select__: Union[None, str, Predicate] = none_rset() category = _('startupview') @@ -407,7 +408,7 @@ """base class for entity views which may also be applied to None result set (usually a default rql is provided by the view class) """ - __select__ = none_rset() | non_final_entity() + __select__: Union[None, str, Predicate] = none_rset() | non_final_entity() default_rql = None @@ -441,7 +442,7 @@ class AnyRsetView(View): """base class for views applying on any non empty result sets""" - __select__ = nonempty_rset() + __select__: Union[None, str, Predicate] = nonempty_rset() category = _('anyrsetview') @@ -541,7 +542,7 @@ class Component(ReloadableMixIn, View): """base class for components""" __registry__ = 'components' - __select__ = yes() + __select__: Union[None, str, Predicate] = yes() # XXX huummm, much probably useless (should be...) htmlclass = 'mainRelated'