本文整理汇总了Python中generator.code.DependencyItem.DependencyItem.name方法的典型用法代码示例。如果您正苦于以下问题:Python DependencyItem.name方法的具体用法?Python DependencyItem.name怎么用?Python DependencyItem.name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类generator.code.DependencyItem.DependencyItem
的用法示例。
在下文中一共展示了DependencyItem.name方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: depsItem_from_node
# 需要导入模块: from generator.code.DependencyItem import DependencyItem [as 别名]
# 或者: from generator.code.DependencyItem.DependencyItem import name [as 别名]
def depsItem_from_node(self, node):
scope = node.scope
# some initializations (might get refined later)
depsItem = DependencyItem('', '', '')
depsItem.name = ''
depsItem.attribute = ''
depsItem.requestor = self.id
depsItem.line = node.get("line", -1)
depsItem.isLoadDep = scope.is_load_time
depsItem.needsRecursion = False
depsItem.isCall = False
depsItem.node = node
var_root = treeutil.findVarRoot(node) # various of the tests need the var (dot) root, rather than the head symbol (like 'qx')
# .isCall
if treeutil.isCallOperand(var_root): # it's a function call or new op.
depsItem.isCall = True # interesting when following transitive deps
# .name, .attribute
assembled = (treeutil.assembleVariable(node))[0]
#className, classAttribute = self._splitQxClass(assembled)
className = gs.test_for_libsymbol(assembled, ClassesAll, []) # TODO: no namespaces!?
if not className:
is_lib_class = False
className = assembled
classAttribute = ''
else:
is_lib_class = True
if len(assembled) > len(className):
classAttribute = assembled[len(className)+1:]
else:
classAttribute = ''
# we allow self-references, to be able to track method dependencies within the same class
assembled_parts = assembled.split('.')
if assembled_parts[0] == 'this':
className = self.id
is_lib_class = True
if '.' in assembled:
classAttribute = assembled_parts[1]
elif scope.is_defer and assembled_parts[0] in DEFER_ARGS:
className = self.id
is_lib_class = True
if '.' in assembled:
classAttribute = assembled_parts[1]
if is_lib_class and not classAttribute: # see if we have to provide 'construct'
if treeutil.isNEWoperand(var_root):
classAttribute = 'construct'
depsItem.name = className
depsItem.attribute = classAttribute
# .needsRecursion
# Mark items that need recursive analysis of their dependencies (bug#1455)
if (is_lib_class and
scope.is_load_time and
(treeutil.isCallOperand(var_root) or
treeutil.isNEWoperand(var_root))):
depsItem.needsRecursion = True
return depsItem
示例2: depsItem_from_node
# 需要导入模块: from generator.code.DependencyItem import DependencyItem [as 别名]
# 或者: from generator.code.DependencyItem.DependencyItem import name [as 别名]
def depsItem_from_node(self, node):
scope = node.scope
# some initializations (might get refined later)
depsItem = DependencyItem('', '', '')
depsItem.name = ''
depsItem.attribute = ''
depsItem.requestor = self.id
depsItem.line = node.get("line", -1)
depsItem.isLoadDep = scope.is_load_time
depsItem.needsRecursion = False
depsItem.isCall = False
depsItem.node = node
is_lib_class = False
var_root = treeutil.findVarRoot(node) # various of the tests need the var (dot) root, rather than the head symbol (like 'qx')
# .isCall
if treeutil.isCallOperand(var_root): # it's a function call or new op.
depsItem.isCall = True # interesting when following transitive deps
# .name, .attribute
assembled = (treeutil.assembleVariable(node))[0]
className, classAttribute = self._splitQxClass(assembled)
if not className:
if "." in assembled:
className, classAttribute = assembled.split('.')[:2]
else:
className = assembled
else:
is_lib_class = True
# we allow self-references, to be able to track method dependencies within the same class
if self.is_this(className):
if className.find('.')>-1:
classAttribute = className.split('.')[1]
className = self.id
is_lib_class = True
elif scope.is_defer and className in DEFER_ARGS:
className = self.id
is_lib_class = True
if is_lib_class and not classAttribute: # see if we have to provide 'construct'
if treeutil.isNEWoperand(var_root):
classAttribute = 'construct'
depsItem.name = className
depsItem.attribute = classAttribute
# .needsRecursion
# Mark items that need recursive analysis of their dependencies (bug#1455)
#if self.followCallDeps(var_root, self.id, className, isLoadTime):
#if self.id=='qx.bom.element.Style' and depsItem.attribute=='__detectVendorProperties':
# import pydb; pydb.debugger()
if (is_lib_class and
scope.is_load_time and
(treeutil.isCallOperand(var_root) or
treeutil.isNEWoperand(var_root))):
depsItem.needsRecursion = True
return depsItem
示例3: qualify_deps_item
# 需要导入模块: from generator.code.DependencyItem import DependencyItem [as 别名]
# 或者: from generator.code.DependencyItem.DependencyItem import name [as 别名]
def qualify_deps_item(self, node, isLoadTime, inDefer, depsItem=None):
if not depsItem:
depsItem = DependencyItem('', '', '')
depsItem.name = ''
depsItem.attribute = ''
depsItem.requestor = self.id
depsItem.line = node.get("line", -1)
depsItem.isLoadDep = isLoadTime
depsItem.needsRecursion = False
depsItem.isCall = False
var_root = treeutil.findVarRoot(node) # various of the tests need the var (dot) root, rather than the head symbol (like 'qx')
# .isCall
if var_root.hasParentContext("call/operand"): # it's a function call
depsItem.isCall = True # interesting when following transitive deps
# .name
assembled = (treeutil.assembleVariable(node))[0]
_, className, classAttribute = self._isInterestingReference(assembled, var_root, self.id, inDefer)
# postcond:
# - className != '' must always be true, as we know it is an interesting reference
# - might be a known qooxdoo class, or an unknown class (use 'className in self._classes')
# - if assembled contained ".", classAttribute will contain approx. non-class part
if className:
# we allow self-references, to be able to track method dependencies within the same class
if className == 'this':
className = self.id
elif inDefer and className in DEFER_ARGS:
className = self.id
if not classAttribute: # see if we have to provide 'construct'
if treeutil.isNEWoperand(node):
classAttribute = 'construct'
# Can't do the next; it's catching too many occurrences of 'getInstance' that have
# nothing to do with the singleton 'getInstance' method (just grep in the framework)
#elif classAttribute == 'getInstance': # erase 'getInstance' and introduce 'construct' dependency
# classAttribute = 'construct'
depsItem.name = className
depsItem.attribute = classAttribute
# .needsRecursion
# Mark items that need recursive analysis of their dependencies (bug#1455)
if self.followCallDeps(var_root, self.id, className, isLoadTime):
depsItem.needsRecursion = True
if depsItem.name:
return depsItem
else:
return None