diff options
Diffstat (limited to 'grc/core/Element.pyi')
-rw-r--r-- | grc/core/Element.pyi | 35 |
1 files changed, 11 insertions, 24 deletions
diff --git a/grc/core/Element.pyi b/grc/core/Element.pyi index c81180a33e..2a2aed401c 100644 --- a/grc/core/Element.pyi +++ b/grc/core/Element.pyi @@ -1,4 +1,4 @@ -# Copyright 2008, 2009, 2015, 2016 Free Software Foundation, Inc. +# Copyright 2016 Free Software Foundation, Inc. # This file is part of GNU Radio # # GNU Radio Companion is free software; you can redistribute it and/or @@ -15,40 +15,27 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA +from typing import Union + from . import Platform, FlowGraph, Block -def lazy_property(func): - return func +lazy_property = property # fixme: descriptors don't seems to be supported class Element(object): - def __init__(self, parent=None): - ... + def __init__(self, parent: Union[None, 'Element'] = None): ... - @property - def parent(self): - ... + @lazy_property + def parent(self) -> 'Element': ... - def get_parent_by_type(self, cls): - parent = self.parent - if parent is None: - return None - elif isinstance(parent, cls): - return parent - else: - return parent.get_parent_by_type(cls) + def get_parent_by_type(self, cls) -> Union[None, 'Element']: ... @lazy_property - def parent_platform(self): -> Platform.Platform - ... + def parent_platform(self) -> Platform.Platform: ... @lazy_property - def parent_flowgraph(self): -> FlowGraph.FlowGraph - ... + def parent_flowgraph(self) -> FlowGraph.FlowGraph: ... @lazy_property - def parent_block(self): -> Block.Block - ... - - + def parent_block(self) -> Block.Block: ... |