Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
for path in Path('/').recursedir(pattern):
if path.is_dir():
dirs.add(path)
else:
files.add(path)
# Don't include directories whose files are included
non_empty_dirs = set([Path('/')])
for p in files | dirs:
path = Path('/')
for c in p.components[1:]:
path = path / c
non_empty_dirs.add(path)
# Builds the final list
return [File(p) for p in itertools.chain(dirs - non_empty_dirs, files)]
for path in Path('/').recursedir(pattern):
if path.is_dir():
dirs.add(path)
else:
files.add(path)
# Don't include directories whose files are included
non_empty_dirs = set([Path('/')])
for p in files | dirs:
path = Path('/')
for c in p.components[1:]:
path = path / c
non_empty_dirs.add(path)
# Builds the final list
return [File(p) for p in itertools.chain(dirs - non_empty_dirs, files)]
import warnings
from reprozip import __version__ as reprozip_version
from reprozip import _pytracer
from reprozip.common import File, InputOutputFile, load_config, save_config, \
FILE_READ, FILE_WRITE, FILE_LINK
from reprozip.tracer.linux_pkgs import magic_dirs, system_dirs, \
identify_packages
from reprozip.utils import PY3, izip, iteritems, itervalues, \
unicode_, flatten, UniqueNames, hsize, normalize_path, find_all_links
logger = logging.getLogger('reprozip')
class TracedFile(File):
"""Override of `~reprozip.common.File` that reads stats from filesystem.
It also memorizes how files are used, to select files that are only read,
and accurately guess input and output files.
"""
# read
# +------+
# | |
# read v + write
# (init) +------------------> ONLY_READ +-------> READ_THEN_WRITTEN
# | ^ +
# | | |
# +-------> WRITTEN +--+ +---------+
# write ^ | read, write
# | |
# +---------+
from rpaths import Path
import sqlite3
import sys
from reprozip import __version__ as reprozip_version
from reprozip import _pytracer
from reprozip.common import File, InputOutputFile, load_config, save_config, \
FILE_READ, FILE_WRITE, FILE_LINK
from reprozip.tracer.linux_pkgs import magic_dirs, system_dirs, \
identify_packages
from reprozip.utils import PY3, izip, iteritems, itervalues, \
unicode_, flatten, UniqueNames, hsize, normalize_path, find_all_links, \
tty_prompt
class TracedFile(File):
"""Override of `~reprozip.common.File` that reads stats from filesystem.
It also memorizes how files are used, to select files that are only read,
and accurately guess input and output files.
"""
# read
# +------+
# | |
# read v + write
# (init) +------------------> ONLY_READ +-------> READ_THEN_WRITTEN
# | ^ +
# | | |
# +-------> WRITTEN +--+ +---------+
# write ^ | read, write
# | |
# +---------+