if not is_done(data_dir):
print("Trying to build a dictionary in {}".format(data_dir))
if os.path.isdir(data_dir):
shutil.rmtree(data_dir)
os.makedirs(data_dir, 0o755)
After Change
def __init__(self, data_dir=None, *args, **kwargs):
if data_dir is None:
data_dir = paths.USR_PATH
data_dir = Path(data_dir)
if self.dict_name is None:
self.dict_name = args[0] if args else kwargs.get("dictionary_name", "dictionary")
data_dir = data_dir / self.dict_name