Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
database = directory / 'trace.sqlite3'
assert database.is_file()
if PY3:
# On PY3, connect() only accepts unicode
conn = sqlite3.connect(str(database))
else:
conn = sqlite3.connect(database.path)
conn.row_factory = sqlite3.Row
# Reads info from database
files, inputs, outputs = get_files(conn)
# Identifies which file comes from which package
if sort_packages:
files, packages = identify_packages(files)
else:
packages = []
# Writes configuration file
config = directory / 'config.yml'
distribution = [distro.id(), distro.version()]
cur = conn.cursor()
if overwrite or not config.exists():
runs = []
# This gets all the top-level processes (p.parent ISNULL) and the first
# executed file for that process (sorting by ids, which are
# chronological)
executions = cur.execute(
'''
SELECT e.name, e.argv, e.envp, e.workingdir, p.exitcode
FROM processes p
def canonicalize_config(packages, other_files, additional_patterns,
sort_packages):
"""Expands ``additional_patterns`` from the configuration file.
"""
if additional_patterns:
add_files = expand_patterns(additional_patterns)
logger.info("Found %d files from expanding additional_patterns...",
len(add_files))
if add_files:
if sort_packages:
add_files, add_packages = identify_packages(add_files)
else:
add_packages = []
other_files, packages = combine_files(add_files, add_packages,
other_files, packages)
return packages, other_files
def canonicalize_config(runs, packages, other_files, additional_patterns,
sort_packages):
add_files = expand_patterns(additional_patterns)
if sort_packages:
add_files, add_packages = identify_packages(add_files)
else:
add_packages = []
other_files, packages = merge_files(add_files, add_packages,
other_files, packages)
return runs, packages, other_files
"""
database = directory / 'trace.sqlite3'
if PY3:
# On PY3, connect() only accepts unicode
conn = sqlite3.connect(str(database))
else:
conn = sqlite3.connect(database.path)
conn.row_factory = sqlite3.Row
# Reads info from database
files, inputs, outputs = get_files(conn)
# Identifies which file comes from which package
if sort_packages:
files, packages = identify_packages(files)
else:
packages = []
# Writes configuration file
config = directory / 'config.yml'
distribution = platform.linux_distribution()[0:2]
cur = conn.cursor()
if overwrite or not config.exists():
runs = []
# This gets all the top-level processes (p.parent ISNULL) and the first
# executed file for that process (sorting by ids, which are
# chronological)
executions = cur.execute(
'''
SELECT e.name, e.argv, e.envp, e.workingdir, p.exitcode
FROM processes p