proxy.py (13714:35636064b7a1) | proxy.py (13716:950f9a2ffb78) |
---|---|
1# Copyright (c) 2018 ARM Limited 2# All rights reserved. 3# 4# The license below extends only to copyright in the software and shall 5# not be construed as granting a license to any other intellectual 6# property including but not limited to intellectual property relating 7# to a hardware implementation of the functionality of the software 8# licensed hereunder. You may use the software subject to the license --- 36 unchanged lines hidden (view full) --- 45# 46##################################################################### 47 48from __future__ import print_function 49from __future__ import absolute_import 50 51import copy 52 | 1# Copyright (c) 2018 ARM Limited 2# All rights reserved. 3# 4# The license below extends only to copyright in the software and shall 5# not be construed as granting a license to any other intellectual 6# property including but not limited to intellectual property relating 7# to a hardware implementation of the functionality of the software 8# licensed hereunder. You may use the software subject to the license --- 36 unchanged lines hidden (view full) --- 45# 46##################################################################### 47 48from __future__ import print_function 49from __future__ import absolute_import 50 51import copy 52 |
53from . import params | |
54 55class BaseProxy(object): 56 def __init__(self, search_self, search_up): 57 self._search_self = search_self 58 self._search_up = search_up 59 self._multipliers = [] 60 61 def __str__(self): --- 168 unchanged lines hidden (view full) --- 230class AllProxy(BaseProxy): 231 def find(self, obj): 232 return obj.find_all(self._pdesc.ptype) 233 234 def path(self): 235 return 'all' 236 237def isproxy(obj): | 53 54class BaseProxy(object): 55 def __init__(self, search_self, search_up): 56 self._search_self = search_self 57 self._search_up = search_up 58 self._multipliers = [] 59 60 def __str__(self): --- 168 unchanged lines hidden (view full) --- 229class AllProxy(BaseProxy): 230 def find(self, obj): 231 return obj.find_all(self._pdesc.ptype) 232 233 def path(self): 234 return 'all' 235 236def isproxy(obj): |
237 from . import params |
|
238 if isinstance(obj, (BaseProxy, params.EthernetAddr)): 239 return True 240 elif isinstance(obj, (list, tuple)): 241 for v in obj: 242 if isproxy(v): 243 return True 244 return False 245 --- 13 unchanged lines hidden (view full) --- 259 return AttrProxy(self.search_self, self.search_up, attr) 260 261# global objects for handling proxies 262Parent = ProxyFactory(search_self = False, search_up = True) 263Self = ProxyFactory(search_self = True, search_up = False) 264 265# limit exports on 'from proxy import *' 266__all__ = ['Parent', 'Self'] | 238 if isinstance(obj, (BaseProxy, params.EthernetAddr)): 239 return True 240 elif isinstance(obj, (list, tuple)): 241 for v in obj: 242 if isproxy(v): 243 return True 244 return False 245 --- 13 unchanged lines hidden (view full) --- 259 return AttrProxy(self.search_self, self.search_up, attr) 260 261# global objects for handling proxies 262Parent = ProxyFactory(search_self = False, search_up = True) 263Self = ProxyFactory(search_self = True, search_up = False) 264 265# limit exports on 'from proxy import *' 266__all__ = ['Parent', 'Self'] |
267 268# see comment on imports at end of __init__.py. 269import params # for EthernetAddr | |