Mercurial > libervia-backend
diff libervia/backend/core/constants.py @ 4270:0d7bb4df2343
Reformatted code base using black.
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 19 Jun 2024 18:44:57 +0200 |
parents | 9fc3d28bc3f6 |
children |
line wrap: on
line diff
--- a/libervia/backend/core/constants.py Tue Jun 18 12:06:45 2024 +0200 +++ b/libervia/backend/core/constants.py Wed Jun 19 18:44:57 2024 +0200 @@ -46,9 +46,7 @@ APP_NAME_ALT = "Libervia" APP_NAME_FILE = "libervia" APP_NAME_FULL = f"{APP_NAME} ({APP_COMPONENT})" - APP_VERSION = ( - backend.__version__ - ) + APP_VERSION = backend.__version__ APP_RELEASE_NAME = "La Ruche" APP_URL = "https://libervia.org" @@ -117,8 +115,8 @@ ## Roster jids selection ## PUBLIC = "PUBLIC" ALL = ( - "ALL" - ) # ALL means all known contacts, while PUBLIC means everybody, known or not + "ALL" # ALL means all known contacts, while PUBLIC means everybody, known or not + ) GROUP = "GROUP" JID = "JID" @@ -226,9 +224,7 @@ PI_IMPORT_NAME = "import_name" PI_MAIN = "main" PI_HANDLER = "handler" - PI_TYPE = ( - "type" - ) # FIXME: should be types, and should handle single unicode type or tuple of types (e.g. "blog" and "import") + PI_TYPE = "type" # FIXME: should be types, and should handle single unicode type or tuple of types (e.g. "blog" and "import") PI_MODES = "modes" PI_PROTOCOLS = "protocols" PI_DEPENDENCIES = "dependencies" @@ -405,14 +401,13 @@ KEY_ATTACHMENTS_PREVIEW = "preview" KEY_ATTACHMENTS_RESIZE = "resize" - ## Common extra keys/values ## KEY_ORDER_BY = "order_by" KEY_USE_CACHE = "use_cache" KEY_DECRYPT = "decrypt" - ORDER_BY_CREATION = 'creation' - ORDER_BY_MODIFICATION = 'modification' + ORDER_BY_CREATION = "creation" + ORDER_BY_MODIFICATION = "modification" # internationalisation DEFAULT_LOCALE = "en_GB" @@ -432,9 +427,7 @@ EXIT_CONFLICT = 19 # an item already exists EXIT_USER_CANCELLED = 20 # user cancelled action EXIT_INTERNAL_ERROR = 111 # unexpected error - EXIT_FILE_NOT_EXE = ( - 126 - ) # a file to be executed was found, but it was not an executable utility (cf. man 1 exit) + EXIT_FILE_NOT_EXE = 126 # a file to be executed was found, but it was not an executable utility (cf. man 1 exit) EXIT_CMD_NOT_FOUND = 127 # a utility to be executed was not found (cf. man 1 exit) EXIT_CMD_ERROR = 127 # a utility to be executed returned an error exit code EXIT_SIGNAL_INT = 128 # a command was interrupted by a signal (cf. man 1 exit) @@ -492,8 +485,9 @@ # we don't want the very verbose jnius log when we are in DEBUG level import logging - logging.getLogger('jnius').setLevel(logging.WARNING) - logging.getLogger('jnius.reflect').setLevel(logging.WARNING) + + logging.getLogger("jnius").setLevel(logging.WARNING) + logging.getLogger("jnius.reflect").setLevel(logging.WARNING) Environment = autoclass("android.os.Environment") @@ -518,9 +512,10 @@ ] else: import os + # we use parent of "sat" module dir as last config path, this is useful for # per instance configurations (e.g. a dev instance and a main instance) - root_dir = dirname(dirname(backend.__file__)) + '/' + root_dir = dirname(dirname(backend.__file__)) + "/" Const.CONFIG_PATHS = ( # /etc/_sat.conf is used for system-related settings (e.g. when media_dir # is set by the distribution and has not reason to change, or in a Docker @@ -541,10 +536,10 @@ # on recent versions of Flatpak, FLATPAK_ID is set at run time # it seems that this is not the case on older versions, # but FLATPAK_SANDBOX_DIR seems set then - if os.getenv('FLATPAK_ID') or os.getenv('FLATPAK_SANDBOX_DIR'): + if os.getenv("FLATPAK_ID") or os.getenv("FLATPAK_SANDBOX_DIR"): # for Flatpak, the conf can't be set in /etc or $HOME, so we have # to add /app - Const.CONFIG_PATHS.append('/app/') + Const.CONFIG_PATHS.append("/app/") ## Configuration ## Const.DEFAULT_CONFIG = { @@ -564,4 +559,3 @@ realpath(expanduser(path) + "sat.conf") for path in Const.CONFIG_PATHS ] -