From e532b395df1f4f0c3e4435fea3f538decad37afb Mon Sep 17 00:00:00 2001 From: "shimoda.m@nds-tyo.co.jp" Date: Thu, 21 Jul 2022 20:00:35 +0900 Subject: [PATCH] =?UTF-8?q?style:=20Flake8=E3=81=AB=E3=82=88=E3=82=8B?= =?UTF-8?q?=E3=83=AA=E3=83=B3=E3=83=88=E4=B8=8D=E6=AD=A3=E3=81=AE=E8=A7=A3?= =?UTF-8?q?=E6=B6=88=E3=80=82=E3=83=95=E3=82=A9=E3=83=BC=E3=83=9E=E3=83=83?= =?UTF-8?q?=E3=83=88=E6=96=87=E5=AD=97=E5=88=97=E3=81=AF=E5=A4=89=E6=95=B0?= =?UTF-8?q?=E3=81=8C=E5=9F=8B=E3=82=81=E8=BE=BC=E3=81=BE=E3=82=8C=E3=81=A6?= =?UTF-8?q?=E3=81=84=E3=81=AA=E3=81=8F=E3=81=A6=E3=82=82=E3=82=A8=E3=83=A9?= =?UTF-8?q?=E3=83=BC=E3=81=AB=E3=81=97=E3=81=AA=E3=81=84=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=80=81=E3=83=81=E3=82=A7=E3=83=83=E3=82=AF=E3=82=92=E7=84=A1?= =?UTF-8?q?=E8=A6=96=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ecs/crm-datafetch/.vscode/recommend_settings.json | 2 +- ecs/crm-datafetch/src/conv.py | 2 -- ecs/crm-datafetch/src/fetch.py | 10 ++++++++-- ecs/crm-datafetch/src/process.py | 2 +- ecs/crm-datafetch/src/upd.py | 6 ++++-- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/ecs/crm-datafetch/.vscode/recommend_settings.json b/ecs/crm-datafetch/.vscode/recommend_settings.json index 72dacf55..66a8f2b5 100644 --- a/ecs/crm-datafetch/.vscode/recommend_settings.json +++ b/ecs/crm-datafetch/.vscode/recommend_settings.json @@ -10,7 +10,7 @@ "python.linting.enabled": true, "python.linting.pylintEnabled": false, "python.linting.flake8Enabled": true, - "python.linting.flake8Args": ["--max-line-length=150"], + "python.linting.flake8Args": ["--max-line-length=150", "--ignore=F541"], "python.formatting.provider": "autopep8", "python.formatting.autopep8Args": ["--max-line-length", "150"] } diff --git a/ecs/crm-datafetch/src/conv.py b/ecs/crm-datafetch/src/conv.py index cfcc6a8a..2a4d3be8 100644 --- a/ecs/crm-datafetch/src/conv.py +++ b/ecs/crm-datafetch/src/conv.py @@ -1,5 +1,3 @@ -from datetime import datetime - from src.constants import CONV_JP_NAME from src.converter.converter import CSVStringConverter from src.error.exceptions import DataConvertException diff --git a/ecs/crm-datafetch/src/fetch.py b/ecs/crm-datafetch/src/fetch.py index 893aaadc..baa0219f 100644 --- a/ecs/crm-datafetch/src/fetch.py +++ b/ecs/crm-datafetch/src/fetch.py @@ -81,7 +81,10 @@ def fetch_crm_data(target_object, last_fetch_datetime): return sf_object_jsons -@retry(wait=wait_exponential(multiplier=CRM_GET_RECORD_COUNT_RETRY_INTERVAL, min=CRM_GET_RECORD_COUNT_RETRY_MIN_INTERVAL, max=CRM_GET_RECORD_COUNT_RETRY_MAX_INTERVAL), stop=stop_after_attempt(CRM_GET_RECORD_COUNT_MAX_RETRY_ATTEMPT)) +@retry( + wait=wait_exponential(multiplier=CRM_GET_RECORD_COUNT_RETRY_INTERVAL, + min=CRM_GET_RECORD_COUNT_RETRY_MIN_INTERVAL, max=CRM_GET_RECORD_COUNT_RETRY_MAX_INTERVAL), + stop=stop_after_attempt(CRM_GET_RECORD_COUNT_MAX_RETRY_ATTEMPT)) def fetch_sf_count_retry(object_name, last_update_datetime_from, last_update_datetime_to): try: global count_contime_counter, count_readtime_counter, count_counter @@ -110,7 +113,10 @@ def fetch_sf_count_retry(object_name, last_update_datetime_from, last_update_dat raise e -@retry(wait=wait_exponential(multiplier=CRM_FETCH_RECORD_RETRY_INTERVAL, min=CRM_FETCH_RECORD_RETRY_MIN_INTERVAL, max=CRM_FETCH_RECORD_RETRY_MAX_INTERVAL), stop=stop_after_attempt(CRM_FETCH_RECORD_MAX_RETRY_ATTEMPT)) +@retry( + wait=wait_exponential(multiplier=CRM_FETCH_RECORD_RETRY_INTERVAL, + min=CRM_FETCH_RECORD_RETRY_MIN_INTERVAL, max=CRM_FETCH_RECORD_RETRY_MAX_INTERVAL), + stop=stop_after_attempt(CRM_FETCH_RECORD_MAX_RETRY_ATTEMPT)) def fetch_sf_data_retry(columns, object_name, last_update_datetime_from, last_update_datetime_to): try: global data_contime_counter, data_readtime_counter, data_counter diff --git a/ecs/crm-datafetch/src/process.py b/ecs/crm-datafetch/src/process.py index add1e98d..e914a4d4 100644 --- a/ecs/crm-datafetch/src/process.py +++ b/ecs/crm-datafetch/src/process.py @@ -80,7 +80,7 @@ def main() -> None: # 9. CSV変換処理を呼び出す logger.info( f'I-CTRL-12 [{target_object.object_name}] CSV変換処理呼び出し') - csv_object = convert_crm_csvdata(target_object, sf_object_jsons) + csv_object = convert_crm_csvdata(target_object, sf_object_jsons) # 10. CSVバックアップ処理を呼び出す logger.info( diff --git a/ecs/crm-datafetch/src/upd.py b/ecs/crm-datafetch/src/upd.py index d69bddcc..d6a8ef03 100644 --- a/ecs/crm-datafetch/src/upd.py +++ b/ecs/crm-datafetch/src/upd.py @@ -12,7 +12,7 @@ def updload_last_fetch_datetime(target_object, last_fetch_datetime): f'I-UPD-01 [{target_object.object_name}] の前回取得日時ファイルの更新処理を開始します') try: - if target_object.is_update_last_fetch_datetime == False: + if target_object.is_update_last_fetch_datetime is False: # ② オブジェクト情報.is_update_last_fetch_datetimeがfalseの場合、以降の処理をスキップする logger.info( f'I-UPD-02 [{target_object.object_name}] の前回取得日時ファイルの更新処理をスキップします') @@ -33,7 +33,9 @@ def updload_last_fetch_datetime(target_object, last_fetch_datetime): except Exception as e: raise FileUploadException( - 'E-UPD-01', UPD_JP_NAME, f'[{target_object.object_name}] 前回処理日時ファイルのアップロードに失敗しました ファイル名:[{target_object.last_fetch_datetime_file_name}] エラー内容:[{e}]') + 'E-UPD-01', + UPD_JP_NAME, + f'[{target_object.object_name}] 前回処理日時ファイルのアップロードに失敗しました ファイル名:[{target_object.last_fetch_datetime_file_name}] エラー内容:[{e}]') # ④ 前回取得日時ファイル更新処理の終了ログを出力する logger.info(