Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
valid = False
if exists:
base, ext = os.path.splitext(self.path.text())
valid = True if ext.lower() == ".bw2package" else False
if not valid:
import_signals.import_failure.emit(
("Invalid extension", "Expecting 'local' import database file to have '.bw2package' extension")
)
self.complete = all([exists, valid])
self.completeChanged.emit()
def isComplete(self):
return self.complete
class ActivityBrowserExtractor(Ecospold2DataExtractor):
"""
- modified from bw2io
- qt and python multiprocessing don't like each other on windows
- need to display progress in gui
"""
@classmethod
def extract(cls, dirpath, db_name, *args, **kwargs):
assert os.path.exists(dirpath), dirpath
if os.path.isdir(dirpath):
filelist = [filename for filename in os.listdir(dirpath)
if os.path.isfile(os.path.join(dirpath, filename))
and filename.split(".")[-1].lower() == "spold"
]
elif os.path.isfile(dirpath):
filelist = [dirpath]
else: