From 08ad95326826104987896b63e5c9e84561b87363 Mon Sep 17 00:00:00 2001 From: David Hoese Date: Fri, 12 May 2023 15:17:03 -0500 Subject: [PATCH] Reformat and fix YAML and python code This makes pre-commit.ci happy --- etc/SIFT/config/auto_update.yaml | 2 +- etc/SIFT/config/readers/li_l1b_bck_nc_sift.yaml | 2 +- etc/SIFT/config/readers/li_l2_a_nc_sift.yaml | 2 +- etc/SIFT/config/readers/modis_l1b.yaml | 2 +- etc/SIFT/config/readers/seviri_l2_grib.yaml | 2 +- uwsift/util/storage_agent.py | 8 ++++---- uwsift/util/watchdog.py | 6 +++--- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/etc/SIFT/config/auto_update.yaml b/etc/SIFT/config/auto_update.yaml index 181ea955..3914cbc5 100644 --- a/etc/SIFT/config/auto_update.yaml +++ b/etc/SIFT/config/auto_update.yaml @@ -6,4 +6,4 @@ auto_update: interval: 20 data_reading: - merge_with_existing: False # shall be activated only with active auto_update \ No newline at end of file + merge_with_existing: False # shall be activated only with active auto_update diff --git a/etc/SIFT/config/readers/li_l1b_bck_nc_sift.yaml b/etc/SIFT/config/readers/li_l1b_bck_nc_sift.yaml index d5ab1a8b..700412bf 100644 --- a/etc/SIFT/config/readers/li_l1b_bck_nc_sift.yaml +++ b/etc/SIFT/config/readers/li_l1b_bck_nc_sift.yaml @@ -7,4 +7,4 @@ data_reading: '{pflag}_{location_indicator},{data_designator},MTGI{spacecraft_id}+LI-1B-BCK--{subtype}--{component1}-{component2}-{component3}-{purpose}-{format}_{oflag}_{originator}_{processing_time:%Y%m%d%H%M%S}_{facility_or_tool}_{environment}_{start_time:%Y%m%d%H%M%S}_{end_time:%Y%m%d%H%M%S}_{processing_mode}_{special_compression}_{disposition_mode}_{repeat_cycle_in_day:>04d}_{count_in_repeat_cycle:>04d}.nc', ] geometry_definition: SwathDefinition - kind: 'IMAGE' \ No newline at end of file + kind: 'IMAGE' diff --git a/etc/SIFT/config/readers/li_l2_a_nc_sift.yaml b/etc/SIFT/config/readers/li_l2_a_nc_sift.yaml index c15f3f9a..14610017 100644 --- a/etc/SIFT/config/readers/li_l2_a_nc_sift.yaml +++ b/etc/SIFT/config/readers/li_l2_a_nc_sift.yaml @@ -8,4 +8,4 @@ data_reading: ] geometry_definition: AreaDefinition reader_kwargs: - with_area_definition: True \ No newline at end of file + with_area_definition: True diff --git a/etc/SIFT/config/readers/modis_l1b.yaml b/etc/SIFT/config/readers/modis_l1b.yaml index e1799f2c..3d5f9abb 100644 --- a/etc/SIFT/config/readers/modis_l1b.yaml +++ b/etc/SIFT/config/readers/modis_l1b.yaml @@ -1,3 +1,3 @@ data_reading: modis_l1b: - geometry_definition: SwathDefinition \ No newline at end of file + geometry_definition: SwathDefinition diff --git a/etc/SIFT/config/readers/seviri_l2_grib.yaml b/etc/SIFT/config/readers/seviri_l2_grib.yaml index c338e980..77b21bae 100644 --- a/etc/SIFT/config/readers/seviri_l2_grib.yaml +++ b/etc/SIFT/config/readers/seviri_l2_grib.yaml @@ -10,4 +10,4 @@ data_reading: grid: origin: "SE" first_index_x: 1 - first_index_y: 1 \ No newline at end of file + first_index_y: 1 diff --git a/uwsift/util/storage_agent.py b/uwsift/util/storage_agent.py index 05290353..ecfbd74c 100644 --- a/uwsift/util/storage_agent.py +++ b/uwsift/util/storage_agent.py @@ -4,7 +4,7 @@ import random import shlex import string -import subprocess +import subprocess # nosec: B404 import time from datetime import datetime, timedelta from itertools import chain @@ -14,7 +14,7 @@ import appdirs from donfig import Config -from uwsift.util.default_paths import APPLICATION_NAME, APPLICATION_AUTHOR +from uwsift.util.default_paths import APPLICATION_AUTHOR, APPLICATION_NAME LOG = logging.getLogger(__name__) @@ -87,7 +87,7 @@ def _notify(self, level: int, text: str) -> None: cmd = f"{self.notification_cmd}" f" {machine} {process_name} {severity} {text}" try: - subprocess.run(cmd, shell=True, check=True) + subprocess.run(cmd, shell=True, check=True) # nosec: 602 except subprocess.CalledProcessError as err: LOG.error(f"Can't run the notification command: {err}") LOG.log(level, text) @@ -105,7 +105,7 @@ def _check_write_access(self, dir_path: str, attempts: int = 5) -> bool: for _ in range(attempts): # don't use upper and lower case because NTFS/Windows is case insensitive char_set = string.ascii_lowercase + string.digits - random_name = "".join(random.choices(char_set, k=25)) + random_name = "".join(random.choices(char_set, k=25)) # nosec: B311 path = os.path.join(dir_path, random_name) try: diff --git a/uwsift/util/watchdog.py b/uwsift/util/watchdog.py index 322ea72c..16856240 100644 --- a/uwsift/util/watchdog.py +++ b/uwsift/util/watchdog.py @@ -4,7 +4,7 @@ import os import shlex import signal -import subprocess +import subprocess # nosec: B404 from datetime import datetime, timedelta, timezone from socket import gethostname from time import sleep @@ -14,7 +14,7 @@ from donfig import Config from psutil import NoSuchProcess, Process -from uwsift.util.default_paths import APPLICATION_NAME, APPLICATION_AUTHOR +from uwsift.util.default_paths import APPLICATION_AUTHOR, APPLICATION_NAME LOG = logging.getLogger(__name__) @@ -152,7 +152,7 @@ def _notify(self, level: int, text: str): cmd = [self.notification_cmd, machine, process_name, severity, text] try: - subprocess.run(cmd, shell=True, check=True) + subprocess.run(cmd, shell=True, check=True) # nosec: B602 except subprocess.CalledProcessError as err: LOG.error(f"Can't run the notification command: {err}") LOG.log(level, text)