Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
reverse = kw.get('reverse')
if os.getcwd() != trgt.workdir:
# the tests are calling _pydeps directoy
os.chdir(trgt.workdir)
dep_graph = py2depgraph.py2dep(trgt, **kw)
if kw.get('show_deps'):
cli.verbose("DEPS:")
pprint.pprint(dep_graph)
dotsrc = depgraph_to_dotsrc(trgt, dep_graph, **kw)
if not nodot:
if kw.get('show_dot'):
cli.verbose("DOTSRC:")
print(dotsrc)
if not no_output:
svg = dot.call_graphviz_dot(dotsrc, fmt)
if fmt == 'svg':
svg = svg.replace(b'', b'<style>.edge>path:hover{stroke-width:8}</style>')
with open(output, 'wb') as fp:
cli.verbose("Writing output to:", output)
fp.write(svg)
if show_svg:
dot.display_svg(kw, output)
self.find_import_cycles()
self.calculate_bacon()
if self.args['show_raw_deps']:
print(self)
self.exclude_noise()
self.exclude_bacon(self.args['max_bacon'])
self.only_filter(self.args.get('only'))
excluded = [v for v in list(self.sources.values()) if v.excluded]
# print "EXCLUDED:", excluded
self.skip_count = len(excluded)
cli.verbose(1, "skipping", self.skip_count, "modules")
for module in excluded:
# print 'exclude:', module.name
cli.verbose(2, " ", module.name)
self.remove_excluded()
if not self.args['show_deps']:
cli.verbose(3, self)
exclude=self._exclude(name),
)
self.add_source(src)
for iname, path in list(imports.items()):
# if iname.endswith('.py'):
# iname = iname[:-3]
src = Source(
name=iname,
path=path,
args=args,
exclude=self._exclude(iname)
)
self.add_source(src)
self.module_count = len(self.sources)
cli.verbose(1, "there are", self.module_count, "total modules")
self.connect_generations()
if self.args['show_cycles']:
self.find_import_cycles()
self.calculate_bacon()
if self.args['show_raw_deps']:
print(self)
self.exclude_noise()
self.exclude_bacon(self.args['max_bacon'])
self.only_filter(self.args.get('only'))
excluded = [v for v in list(self.sources.values()) if v.excluded]
# print "EXCLUDED:", excluded
self.skip_count = len(excluded)
cli.verbose(1, "skipping", self.skip_count, "modules")