Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if res.node is None:
return res
visitor = SourceVisitor(config)
visitor.set_no_lines(res.novermin)
try:
visitor.visit(res.node)
except KeyboardInterrupt:
return res
try:
res.mins = visitor.minimum_versions()
res.text = visitor.output_text()
for m in visitor.modules():
if Backports.is_backport(m):
res.bps.add(m)
except InvalidVersionException as ex:
res.mins = None
res.text = str(ex)
return res
def is_backport(module):
return module in Backports.modules()
" ignore conditional logic that can trigger incompatible results. It's more\n"
" fine grained than lax mode.\n\n"
" Examples:\n"
" Exclude 'foo.bar.baz' module/member: --exclude 'foo.bar.baz'\n"
" Exclude 'foo' kwarg: --exclude 'somemodule.func(foo)'\n"
" Exclude 'bar' codecs error handler: --exclude 'ceh=bar'\n"
" Exclude 'baz' codecs encoding: --exclude 'ce=baz'")
print("\n [--exclude-file ] ...\n"
" Exclude full names like --exclude but from a specified file instead. Each\n"
" line constitutes an exclusion with the same format as with --exclude.")
print("\n [--backport ] ...\n"
" Some features are sometimes backported into packages, in repositories such\n"
" as PyPi, that are widely used but aren't in the standard language. If such a\n"
" backport is specified as being used, the results will reflect that instead."
"\n\n"
" Supported backports:\n{}".format(Backports.str(10)))