From bd0f46bbcdcd6233c9d37f0ea000699e4f980a0f Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 14:42:11 +0000 Subject: [PATCH] style: format code with Black and PHP CS Fixer This commit fixes the style issues introduced in 09c5b71 according to the output from Black and PHP CS Fixer. Details: None --- services/mmc/plugins/pkgs/__init__.py | 32 ++++++++++++++++++++------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/services/mmc/plugins/pkgs/__init__.py b/services/mmc/plugins/pkgs/__init__.py index 05ffb92ca8..940e2155f3 100644 --- a/services/mmc/plugins/pkgs/__init__.py +++ b/services/mmc/plugins/pkgs/__init__.py @@ -384,7 +384,6 @@ def prepare_shared_folder(): os.mkdir(packages_input_dir_sharing_global, 0o755) - def create_directories_sharing(path): """ Create directories for the given path if they do not exist. @@ -404,6 +403,7 @@ def create_directories_sharing(path): except OSError as e: logging.getLogger().error(f"Error creating directories: {e}") + def get_share_from_descriptor(package_descriptor): """ Prepare the system for the package server by creating the sharing folder if it does not exist. @@ -415,21 +415,37 @@ def get_share_from_descriptor(package_descriptor): Returns: str: The path to the sharing folder. """ - packages_input_dir_sharing = os.path.join("/", "var", "lib", "pulse2", "packages", "sharing") + packages_input_dir_sharing = os.path.join( + "/", "var", "lib", "pulse2", "packages", "sharing" + ) # Check if 'localisation_server' is in the package descriptor and is not empty - if "localisation_server" not in package_descriptor or not package_descriptor["localisation_server"]: - logging.getLogger().warning("keys localisation_server missing or not defined, using global sharing by default") - sharing = os.path.join(packages_input_dir_sharing, "global", package_descriptor["id"]) + if ( + "localisation_server" not in package_descriptor + or not package_descriptor["localisation_server"] + ): + logging.getLogger().warning( + "keys localisation_server missing or not defined, using global sharing by default" + ) + sharing = os.path.join( + packages_input_dir_sharing, "global", package_descriptor["id"] + ) else: - logging.getLogger().debug(f"local package {os.path.join(packages_input_dir_sharing, package_descriptor['localisation_server'], package_descriptor['id'])}") - sharing = os.path.join(packages_input_dir_sharing, package_descriptor["localisation_server"], package_descriptor["id"]) + logging.getLogger().debug( + f"local package {os.path.join(packages_input_dir_sharing, package_descriptor['localisation_server'], package_descriptor['id'])}" + ) + sharing = os.path.join( + packages_input_dir_sharing, + package_descriptor["localisation_server"], + package_descriptor["id"], + ) # Create the directories for the sharing path create_directories_sharing(os.path.dirname(sharing)) return sharing + def test_ln(pathdirpackage): """ This function tests a path to know if this is a symlink or not. @@ -1866,7 +1882,7 @@ def create_msg_xmpp_quick_deploy(folder, create=False): def save_xmpp_json(folder, json_content): logger = logging.getLogger() logger.debug("JSON content: %s" % json_content) - json_content = json_content.replace('\\', '\\\\') + json_content = json_content.replace("\\", "\\\\") structpackage = json.loads(json_content) qdeploy_generate(folder) keysupp = [