Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cubicweb
cubicweb
Commits
b1ef9690f357
Commit
2a360248
authored
Dec 19, 2019
by
Laurent Peuch
Browse files
[mypy] type __select__ everywhere
parent
5318da3497e8
Changes
2
Hide whitespace changes
Inline
Side-by-side
cubicweb/appobject.py
View file @
b1ef9690
...
...
@@ -29,11 +29,12 @@ common to all the application objects.
"""
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 @@ class AppObject(RegistrableObject):
such as `AnyEntity`, `EntityView`, `AnyRsetView`, `Action`...
"""
__select__
=
yes
()
__select__
:
Union
[
None
,
str
,
Predicate
]
=
yes
()
@
classmethod
def
__registered__
(
cls
,
registry
):
...
...
cubicweb/view.py
View file @
b1ef9690
...
...
@@ -22,11 +22,12 @@ from cubicweb import _
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 View(AppObject):
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 @@ class StartupView(View):
"""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 @@ class EntityStartupView(EntityView):
"""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 EntityStartupView(EntityView):
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 ReloadableMixIn(object):
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'
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment