From e085b314e459e63d13c7807ca148fb301d91f3b3 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 17 Jun 2024 18:01:39 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .../meteorologia/precipitacao_inea/tasks.py | 6 ++-- .../src/data/process/process_ppi.py | 24 +++++++-------- .../radar/precipitacao/src/predict_rain.py | 6 ++-- .../br_rj_riodejaneiro_diretorios/flows.py | 8 +++-- .../rj_smtr/br_rj_riodejaneiro_rdo/tasks.py | 6 ++-- .../br_rj_riodejaneiro_recursos/flows.py | 8 +++-- .../rj_smtr/projeto_subsidio_sppo/tasks.py | 29 ++++++++++++------- pipelines/utils/georeference/tasks.py | 14 +++++---- 8 files changed, 57 insertions(+), 44 deletions(-) diff --git a/pipelines/rj_cor/meteorologia/precipitacao_inea/tasks.py b/pipelines/rj_cor/meteorologia/precipitacao_inea/tasks.py index acc66e445..57473ffbe 100644 --- a/pipelines/rj_cor/meteorologia/precipitacao_inea/tasks.py +++ b/pipelines/rj_cor/meteorologia/precipitacao_inea/tasks.py @@ -131,9 +131,9 @@ def treat_data( ].copy() # Replace all values bigger than 10000 on "altura_agua" to nan - dfr_fluviometric.loc[ - dfr_fluviometric["altura_agua"] > 10000, "altura_agua" - ] = np.nan + dfr_fluviometric.loc[dfr_fluviometric["altura_agua"] > 10000, "altura_agua"] = ( + np.nan + ) fluviometric_cols_order = [ "id_estacao", diff --git a/pipelines/rj_cor/meteorologia/radar/precipitacao/src/data/process/process_ppi.py b/pipelines/rj_cor/meteorologia/radar/precipitacao/src/data/process/process_ppi.py index bbea38e22..06d2d2e74 100644 --- a/pipelines/rj_cor/meteorologia/radar/precipitacao/src/data/process/process_ppi.py +++ b/pipelines/rj_cor/meteorologia/radar/precipitacao/src/data/process/process_ppi.py @@ -316,18 +316,18 @@ def process_ppi( : hdf[primary_key]["where"].attrs["nbins"], el_index, ] = rhohv_data_array - full_startazA_matrix[ - indices_dict[primary_key]["indices"], :, el_index - ] = startazA.reshape(startazA.shape[0], 1) - full_stopazA_matrix[ - indices_dict[primary_key]["indices"], :, el_index - ] = stopazA.reshape(stopazA.shape[0], 1) - full_startazT_matrix[ - indices_dict[primary_key]["indices"], :, el_index - ] = startazT.reshape(startazT.shape[0], 1) - full_stopazT_matrix[ - indices_dict[primary_key]["indices"], :, el_index - ] = stopazT.reshape(stopazT.shape[0], 1) + full_startazA_matrix[indices_dict[primary_key]["indices"], :, el_index] = ( + startazA.reshape(startazA.shape[0], 1) + ) + full_stopazA_matrix[indices_dict[primary_key]["indices"], :, el_index] = ( + stopazA.reshape(stopazA.shape[0], 1) + ) + full_startazT_matrix[indices_dict[primary_key]["indices"], :, el_index] = ( + startazT.reshape(startazT.shape[0], 1) + ) + full_stopazT_matrix[indices_dict[primary_key]["indices"], :, el_index] = ( + stopazT.reshape(stopazT.shape[0], 1) + ) full_elevation_matrix[:, :, el_index] = hdf[primary_key]["where"].attrs[ "elangle" diff --git a/pipelines/rj_cor/meteorologia/radar/precipitacao/src/predict_rain.py b/pipelines/rj_cor/meteorologia/radar/precipitacao/src/predict_rain.py index 1234b7cff..20f91e422 100644 --- a/pipelines/rj_cor/meteorologia/radar/precipitacao/src/predict_rain.py +++ b/pipelines/rj_cor/meteorologia/radar/precipitacao/src/predict_rain.py @@ -114,9 +114,9 @@ def run_model_prediction( ) assert new_radar_data.nrays == NRAYS, f"nrays should be {NRAYS}." - radar_data_dict[ - f"{specs_dict['process_type']}-{specs_dict['feature']}" - ] = new_radar_data + radar_data_dict[f"{specs_dict['process_type']}-{specs_dict['feature']}"] = ( + new_radar_data + ) radar_data_hdfs.append(radar_data_dict) diff --git a/pipelines/rj_smtr/br_rj_riodejaneiro_diretorios/flows.py b/pipelines/rj_smtr/br_rj_riodejaneiro_diretorios/flows.py index cc1648a41..0f92cc5bf 100644 --- a/pipelines/rj_smtr/br_rj_riodejaneiro_diretorios/flows.py +++ b/pipelines/rj_smtr/br_rj_riodejaneiro_diretorios/flows.py @@ -61,9 +61,11 @@ LABELS = get_current_flow_labels() table_params = task( - lambda tables, exclude: [t for t in tables if t["table_id"] not in exclude] - if exclude is not None - else tables, + lambda tables, exclude: ( + [t for t in tables if t["table_id"] not in exclude] + if exclude is not None + else tables + ), checkpoint=False, name="get_tables_to_run", )(tables=constants.DIRETORIO_MATERIALIZACAO_TABLE_PARAMS.value, exclude=exclude) diff --git a/pipelines/rj_smtr/br_rj_riodejaneiro_rdo/tasks.py b/pipelines/rj_smtr/br_rj_riodejaneiro_rdo/tasks.py index af27523c0..c762bf520 100644 --- a/pipelines/rj_smtr/br_rj_riodejaneiro_rdo/tasks.py +++ b/pipelines/rj_smtr/br_rj_riodejaneiro_rdo/tasks.py @@ -120,9 +120,9 @@ def download_and_save_local_from_ftp(file_info: dict): ) # Set general local path to save file (bucket_modes: raw or staging) - file_info[ - "local_path" - ] = f"""{base_path}/{table_id}/{file_info["partitions"]}/{file_info['filename']}.{{file_ext}}""" + file_info["local_path"] = ( + f"""{base_path}/{table_id}/{file_info["partitions"]}/{file_info['filename']}.{{file_ext}}""" + ) # Get raw data file_info["raw_path"] = file_info["local_path"].format( bucket_mode="raw", file_ext="txt" diff --git a/pipelines/rj_smtr/br_rj_riodejaneiro_recursos/flows.py b/pipelines/rj_smtr/br_rj_riodejaneiro_recursos/flows.py index 78769da39..933221309 100644 --- a/pipelines/rj_smtr/br_rj_riodejaneiro_recursos/flows.py +++ b/pipelines/rj_smtr/br_rj_riodejaneiro_recursos/flows.py @@ -106,9 +106,11 @@ ] table_params = task( - lambda tables, exclude: [t for t in tables if t["table_id"] not in exclude] - if exclude is not None - else tables, + lambda tables, exclude: ( + [t for t in tables if t["table_id"] not in exclude] + if exclude is not None + else tables + ), checkpoint=False, name="get_tables_to_run", )(tables=constants.SUBSIDIO_SPPO_RECURSOS_TABLE_IDS.value, exclude=exclude) diff --git a/pipelines/rj_smtr/projeto_subsidio_sppo/tasks.py b/pipelines/rj_smtr/projeto_subsidio_sppo/tasks.py index a796bcfaf..096d9a47b 100644 --- a/pipelines/rj_smtr/projeto_subsidio_sppo/tasks.py +++ b/pipelines/rj_smtr/projeto_subsidio_sppo/tasks.py @@ -63,9 +63,9 @@ def subsidio_data_quality_check( if mode == "pos": request_params["end_timestamp"] = f"""{params["end_date"]} 00:00:00""" - request_params[ - "dataset_id" - ] = smtr_constants.SUBSIDIO_SPPO_DASHBOARD_DATASET_ID.value + request_params["dataset_id"] = ( + smtr_constants.SUBSIDIO_SPPO_DASHBOARD_DATASET_ID.value + ) checks_list = ( smtr_constants.SUBSIDIO_SPPO_DATA_CHECKS_PRE_LIST.value @@ -139,14 +139,21 @@ def subsidio_data_quality_check( if not test_check: at_code_owners = [ - f' - <@{constants.OWNERS_DISCORD_MENTIONS.value[code_owner]["user_id"]}>\n' - if constants.OWNERS_DISCORD_MENTIONS.value[code_owner]["type"] == "user" - else f' - <@!{constants.OWNERS_DISCORD_MENTIONS.value[code_owner]["user_id"]}>\n' - if constants.OWNERS_DISCORD_MENTIONS.value[code_owner]["type"] - == "user_nickname" - else f' - <#{constants.OWNERS_DISCORD_MENTIONS.value[code_owner]["user_id"]}>\n' - if constants.OWNERS_DISCORD_MENTIONS.value[code_owner]["type"] == "channel" - else f' - <@&{constants.OWNERS_DISCORD_MENTIONS.value[code_owner]["user_id"]}>\n' + ( + f' - <@{constants.OWNERS_DISCORD_MENTIONS.value[code_owner]["user_id"]}>\n' + if constants.OWNERS_DISCORD_MENTIONS.value[code_owner]["type"] == "user" + else ( + f' - <@!{constants.OWNERS_DISCORD_MENTIONS.value[code_owner]["user_id"]}>\n' + if constants.OWNERS_DISCORD_MENTIONS.value[code_owner]["type"] + == "user_nickname" + else ( + f' - <#{constants.OWNERS_DISCORD_MENTIONS.value[code_owner]["user_id"]}>\n' + if constants.OWNERS_DISCORD_MENTIONS.value[code_owner]["type"] + == "channel" + else f' - <@&{constants.OWNERS_DISCORD_MENTIONS.value[code_owner]["user_id"]}>\n' + ) + ) + ) for code_owner in code_owners ] diff --git a/pipelines/utils/georeference/tasks.py b/pipelines/utils/georeference/tasks.py index 61b9bd1b0..9e6aac32b 100644 --- a/pipelines/utils/georeference/tasks.py +++ b/pipelines/utils/georeference/tasks.py @@ -115,12 +115,14 @@ def georeference_dataframe( locations.append(location) geolocated_addresses = [ - { - "latitude": location.latitude, - "longitude": location.longitude, - } - if location is not None - else {"latitude": None, "longitude": None} + ( + { + "latitude": location.latitude, + "longitude": location.longitude, + } + if location is not None + else {"latitude": None, "longitude": None} + ) for location in locations ]