test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Functions | Variables
TreeCrawler Namespace Reference

Classes

class  Color
 
class  mymf
 
class  Package
 
class  SearchHit
 

Functions

def getDependenciesFromPythonFile
 
def getImportTree
 
def packageNameFromFilename
 
def transformIntoGraph
 

Variables

list _stack = []
 

Function Documentation

def TreeCrawler.getDependenciesFromPythonFile (   filename,
  toplevelname,
  path 
)

Definition at line 151 of file TreeCrawler.py.

Referenced by getImportTree().

152 def getDependenciesFromPythonFile(filename,toplevelname,path):
153  modulefinder = mymf(path)
154  modulefinder.run_script(filename)
155  globalDependencyDict = modulefinder._depgraph
156  globalDependencyDict[toplevelname] = globalDependencyDict["__main__"]
157  return globalDependencyDict
158 
def getDependenciesFromPythonFile
Definition: TreeCrawler.py:151
def TreeCrawler.getImportTree (   filename,
  path 
)

Definition at line 159 of file TreeCrawler.py.

References getDependenciesFromPythonFile(), packageNameFromFilename(), and transformIntoGraph().

160 def getImportTree(filename,path):
161  toplevelname = packageNameFromFilename(filename)
162  # get dependencies from given file
163  globalDependencyDict = getDependenciesFromPythonFile(filename,toplevelname,path)
164 
165  # transform this flat structure in a dependency tree
166  dependencyGraph = transformIntoGraph(globalDependencyDict,toplevelname)
167  return dependencyGraph
def transformIntoGraph
Definition: TreeCrawler.py:130
def getDependenciesFromPythonFile
Definition: TreeCrawler.py:151
def packageNameFromFilename
Definition: TreeCrawler.py:29
def getImportTree
Definition: TreeCrawler.py:159
def TreeCrawler.packageNameFromFilename (   name)

Definition at line 29 of file TreeCrawler.py.

References join(), python.rootplot.root2matplotlib.replace(), and split.

Referenced by getImportTree(), and TreeCrawler.Package.search().

29 
30 def packageNameFromFilename(name):
31  return ".".join(name.replace("python/","").replace(".py","").split("/")[-3:])
32 
def packageNameFromFilename
Definition: TreeCrawler.py:29
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
double split
Definition: MVATrainer.cc:139
def TreeCrawler.transformIntoGraph (   depgraph,
  toplevel 
)

Definition at line 130 of file TreeCrawler.py.

Referenced by getImportTree().

131 def transformIntoGraph(depgraph,toplevel):
132  packageDict = {}
133  # create the top level config
134  packageDict[toplevel] = Package(toplevel, top = True)
135 
136  # create package objects
137  for key, value in depgraph.iteritems():
138  if key.count(".") == 2 and key != toplevel:
139  packageDict[key] = Package(key)
140  for name in value.keys():
141  if name.count(".") == 2: packageDict[name] = Package(name)
142  # now create dependencies
143  for key, value in depgraph.iteritems():
144  if key.count(".") == 2 or key == toplevel:
145  package = packageDict[key]
146  package.dependencies = [packageDict[name] for name in value.keys() if name.count(".") == 2]
147 
148  # find and return the top level config
149  return packageDict[toplevel]
150 
def transformIntoGraph
Definition: TreeCrawler.py:130

Variable Documentation

list TreeCrawler._stack = []

Definition at line 45 of file TreeCrawler.py.