Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import inspect
import io
import json
import os
from abc import ABC, abstractmethod
from enum import Enum
from typing import Dict, Any, List
from appdirs import unicode
from src.gui.preferences import Ui_Dialog
from src.preferences import configuration
try:
to_unicode = unicode
except NameError:
to_unicode = str
class _JsonLoader:
JSON_SETTINGS: Dict = None
instance: '_JsonLoader' = None
def __init__(self):
if _JsonLoader.JSON_SETTINGS is None:
settings_json = configuration.get_paths().settings_json
if not os.path.isfile(settings_json):
with io.open(settings_json, 'w', encoding='utf8') as outfile:
str_ = json.dumps({}, indent=4, separators=(',', ': '), ensure_ascii=False)
outfile.write(to_unicode(str_))
with open(settings_json) as df:
import io
import json
import sys
from enum import Enum
from os import path, getenv
from pathlib import Path
from typing import List, Dict
from PyQt5.QtCore import QObject, QTranslator
from appdirs import unicode
try:
to_unicode = unicode
except NameError:
to_unicode = str
from tmpv import DIRECTORY_PROGRAM, APPLICATION_NAME, APPLICATION_VERSION, SYSTEM_LOCALE
class _Settings(Enum):
"""Tuple: (json_key, default value)"""
VERSION = ("version", APPLICATION_VERSION)
AUTHOR = ("author", "author")
LANGUAGE = ("language", SYSTEM_LOCALE)
COMMENT_TYPES_ACTIVE = (
"comment_types_active", ["Spelling", "Punctuation", "Translation", "Phrasing", "Timing", "Typeset", "Note"])
COMMENT_TYPES_INACTIVE = ("comment_types_inactive", [])
AUTOSAVE_INTERVAL_SECONDS = ("autosave_interval_seconds", 90)
import sys
from os import path, getenv
from pathlib import Path
from appdirs import unicode
from src import constants
try:
to_unicode = unicode
except NameError:
to_unicode = str
class Paths:
# todo rework
FILE_SETTINGS = "settings.json"
FILE_INPUT_CONF = "input.conf"
FILE_MPV_CONF = "mpv.conf"
DIR_CFG = "cfg"
DIR_AUTO_SAVE = "autosave"
def __init__(self):
from tmpv import APPLICATION_NAME, DIRECTORY_PROGRAM