Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def scan(self):
f1 = File("/tmp/1", "text/plain")
f1._pii.add(PiiTypes.BIRTH_DATE)
f2 = File("/tmp/2", "application/pdf")
f2._pii.add(PiiTypes.UNSUPPORTED)
self._files.append(f1)
self._files.append(f2)
def scan(self):
f1 = File("/tmp/1", "text/plain")
f1._pii.add(PiiTypes.BIRTH_DATE)
f2 = File("/tmp/2", "application/pdf")
f2._pii.add(PiiTypes.UNSUPPORTED)
self._files.append(f1)
self._files.append(f2)
def __init__(self, name, mime_type):
super(File, self).__init__(name, (), ())
self._mime_type = mime_type
mime_type = magic.from_file(self._path, mime=True)
self._files.append(File(self._path, mime_type))
logging.debug(
"\t- full path: %s, mime_type: %s"
% (os.path.abspath(self._path), mime_type)
)
else:
for root, subdirs, files in os.walk(self._path):
for filename in files:
file_path = os.path.join(root, filename)
mime_type = magic.from_file(file_path, mime=True)
logging.debug(
"\t- full path: %s, mime_type: %s" % (file_path, mime_type)
)
self._files.append(File(file_path, mime_type))
context = {
"tokenizer": Tokenizer(),
"regex": RegexScanner(),
"ner": NERScanner(),
}
for f in self._files:
f.scan(context)
def scan(self):
logging.debug("Scanning %s" % self._path)
if os.path.isfile(self._path):
mime_type = magic.from_file(self._path, mime=True)
self._files.append(File(self._path, mime_type))
logging.debug(
"\t- full path: %s, mime_type: %s"
% (os.path.abspath(self._path), mime_type)
)
else:
for root, subdirs, files in os.walk(self._path):
for filename in files:
file_path = os.path.join(root, filename)
mime_type = magic.from_file(file_path, mime=True)
logging.debug(
"\t- full path: %s, mime_type: %s" % (file_path, mime_type)
)
self._files.append(File(file_path, mime_type))
context = {