From b5cd61f6465cb3715b289345ae3ff455b799f613 Mon Sep 17 00:00:00 2001 From: Etienne Delclaux Date: Tue, 23 Apr 2024 14:11:37 +0200 Subject: [PATCH] lint: run linter --- backend/gn_module_zh/forms.py | 6 +++--- backend/gn_module_zh/hierarchy.py | 16 ++++++++++------ .../migrations/01cb1aaa2062_init_zh.py | 1 + .../migrations/22b14fc3abe0_set_srid.py | 1 + .../migrations/26d6515219fe_add_indexes.py | 1 + .../510677623a13_declare_permisision.py | 1 + .../migrations/643743e807f6_add_atlas_view.py | 1 + .../migrations/b4e1775f1e7c_sample_data.py | 1 + backend/gn_module_zh/model/cards.py | 2 +- backend/gn_module_zh/model/zh.py | 8 +++++--- frontend/app/services/zh-data.service.ts | 14 +++++++------- .../zh-forms/tabs/tab1/zh-form-tab1.component.ts | 12 ++++++------ .../zh-forms/tabs/tab3/zh-form-tab3.component.ts | 8 ++++---- .../zh-forms/tabs/tab5/zh-form-tab5.component.ts | 4 ++-- .../zh-forms/tabs/tab6/zh-form-tab6.component.ts | 4 ++-- 15 files changed, 46 insertions(+), 34 deletions(-) diff --git a/backend/gn_module_zh/forms.py b/backend/gn_module_zh/forms.py index 52f97f29..85d2b21e 100644 --- a/backend/gn_module_zh/forms.py +++ b/backend/gn_module_zh/forms.py @@ -844,9 +844,9 @@ def update_zh_tab6(data): TZH.update_author: data["update_author"], TZH.update_date: data["update_date"], TZH.is_other_inventory: is_other_inventory, - TZH.remark_is_other_inventory: data["remark_is_other_inventory"] - if is_other_inventory - else None, + TZH.remark_is_other_inventory: ( + data["remark_is_other_inventory"] if is_other_inventory else None + ), } ) DB.session.flush() diff --git a/backend/gn_module_zh/hierarchy.py b/backend/gn_module_zh/hierarchy.py index 0cfa91c7..0733de30 100644 --- a/backend/gn_module_zh/hierarchy.py +++ b/backend/gn_module_zh/hierarchy.py @@ -934,9 +934,11 @@ def __str__(self): "qualification": self.__get_qualif_mnemo(), "knowledge": self.__get_knowledge_mnemo(), "name": self.__get_rule_name(), - "note": Hierarchy.get_str_note(self.note, self.denominator) - if self.active - else "Non paramétrée", + "note": ( + Hierarchy.get_str_note(self.note, self.denominator) + if self.active + else "Non paramétrée" + ), } @@ -973,9 +975,11 @@ def get_note(value): filter( None, [ - (float(item["note"].split("/")[0])) - if item["note"] is not None - else None + ( + (float(item["note"].split("/")[0])) + if item["note"] is not None + else None + ) for item in value if item["active"] ], diff --git a/backend/gn_module_zh/migrations/01cb1aaa2062_init_zh.py b/backend/gn_module_zh/migrations/01cb1aaa2062_init_zh.py index 93e26c91..dc88a0b6 100644 --- a/backend/gn_module_zh/migrations/01cb1aaa2062_init_zh.py +++ b/backend/gn_module_zh/migrations/01cb1aaa2062_init_zh.py @@ -5,6 +5,7 @@ Create Date: 2023-03-27 11:54:34.602380 """ + import importlib from alembic import op diff --git a/backend/gn_module_zh/migrations/22b14fc3abe0_set_srid.py b/backend/gn_module_zh/migrations/22b14fc3abe0_set_srid.py index 2f71367e..1ca7dcdf 100644 --- a/backend/gn_module_zh/migrations/22b14fc3abe0_set_srid.py +++ b/backend/gn_module_zh/migrations/22b14fc3abe0_set_srid.py @@ -5,6 +5,7 @@ Create Date: 2023-04-19 14:58:14.295664 """ + from alembic import op import sqlalchemy as sa diff --git a/backend/gn_module_zh/migrations/26d6515219fe_add_indexes.py b/backend/gn_module_zh/migrations/26d6515219fe_add_indexes.py index a3728a02..bbaf43a8 100644 --- a/backend/gn_module_zh/migrations/26d6515219fe_add_indexes.py +++ b/backend/gn_module_zh/migrations/26d6515219fe_add_indexes.py @@ -5,6 +5,7 @@ Create Date: 2023-06-05 12:07:39.416188 """ + from alembic import op import sqlalchemy as sa diff --git a/backend/gn_module_zh/migrations/510677623a13_declare_permisision.py b/backend/gn_module_zh/migrations/510677623a13_declare_permisision.py index e4deb880..c9cf52e0 100644 --- a/backend/gn_module_zh/migrations/510677623a13_declare_permisision.py +++ b/backend/gn_module_zh/migrations/510677623a13_declare_permisision.py @@ -5,6 +5,7 @@ Create Date: 2023-05-25 15:33:36.262722 """ + from alembic import op import sqlalchemy as sa diff --git a/backend/gn_module_zh/migrations/643743e807f6_add_atlas_view.py b/backend/gn_module_zh/migrations/643743e807f6_add_atlas_view.py index e5f3555c..572acc99 100644 --- a/backend/gn_module_zh/migrations/643743e807f6_add_atlas_view.py +++ b/backend/gn_module_zh/migrations/643743e807f6_add_atlas_view.py @@ -5,6 +5,7 @@ Create Date: 2023-06-05 12:20:36.897280 """ + from alembic import op import sqlalchemy as sa diff --git a/backend/gn_module_zh/migrations/b4e1775f1e7c_sample_data.py b/backend/gn_module_zh/migrations/b4e1775f1e7c_sample_data.py index 4a64c82e..fa35508d 100644 --- a/backend/gn_module_zh/migrations/b4e1775f1e7c_sample_data.py +++ b/backend/gn_module_zh/migrations/b4e1775f1e7c_sample_data.py @@ -5,6 +5,7 @@ Create Date: 2023-03-27 13:32:22.741263 """ + import importlib from alembic import op diff --git a/backend/gn_module_zh/model/cards.py b/backend/gn_module_zh/model/cards.py index 6b2e1347..6c976c9e 100644 --- a/backend/gn_module_zh/model/cards.py +++ b/backend/gn_module_zh/model/cards.py @@ -1092,7 +1092,7 @@ def __set_localisation(self): self.info.localisation = Localisation( self.id_zh, self.properties["geo_info"]["regions"], - self.properties["geo_info"]["departments"] + self.properties["geo_info"]["departments"], # self.ref_geo_config ) diff --git a/backend/gn_module_zh/model/zh.py b/backend/gn_module_zh/model/zh.py index 6efaba8e..404759a3 100644 --- a/backend/gn_module_zh/model/zh.py +++ b/backend/gn_module_zh/model/zh.py @@ -165,9 +165,11 @@ def get_instruments(self): "instruments": [ { "id_instrument": instrument.id_instrument, - "instrument_date": instrument.instrument_date.date().strftime("%d/%m/%Y") - if instrument.instrument_date - else None, + "instrument_date": ( + instrument.instrument_date.date().strftime("%d/%m/%Y") + if instrument.instrument_date + else None + ), } for instrument in ZH.get_data_by_id(TInstruments, self.zh.id_zh) ] diff --git a/frontend/app/services/zh-data.service.ts b/frontend/app/services/zh-data.service.ts index d08fd57d..bcca0ad7 100644 --- a/frontend/app/services/zh-data.service.ts +++ b/frontend/app/services/zh-data.service.ts @@ -16,7 +16,7 @@ export class ZhDataService { constructor( private _api: HttpClient, - public config: ConfigService, + public config: ConfigService ) {} setCurrentZh(zh: any) { @@ -47,7 +47,7 @@ export class ZhDataService { autocompletBib(search_title: string) { return this._api.get( - `${this.config.API_ENDPOINT}/zones_humides/references/autocomplete?search_title=${search_title}`, + `${this.config.API_ENDPOINT}/zones_humides/references/autocomplete?search_title=${search_title}` ); } @@ -57,7 +57,7 @@ export class ZhDataService { getHabitatByCorine(corineId: string) { return this._api.get( - `${this.config.API_ENDPOINT}/zones_humides/forms/cahierhab/${corineId}`, + `${this.config.API_ENDPOINT}/zones_humides/forms/cahierhab/${corineId}` ); } @@ -72,7 +72,7 @@ export class ZhDataService { map((municipalities: any) => { municipalities.map((item) => (item.disabled = false)); return municipalities; - }), + }) ); } @@ -82,7 +82,7 @@ export class ZhDataService { getZhDetails(zhId: number) { return this._api.get( - `${this.config.API_ENDPOINT}/zones_humides/${zhId}/complete_card`, + `${this.config.API_ENDPOINT}/zones_humides/${zhId}/complete_card` ); } @@ -107,7 +107,7 @@ export class ZhDataService { postMainPicture(zhId: number, mediaId: number) { return this._api.patch( `${this.config.API_ENDPOINT}/zones_humides/${zhId}/main_pict/${mediaId}`, - {}, + {} ); } @@ -117,7 +117,7 @@ export class ZhDataService { getHierZh(zhId: string) { return this._api.get( - `${this.config.API_ENDPOINT}/zones_humides/${zhId}/hierarchy`, + `${this.config.API_ENDPOINT}/zones_humides/${zhId}/hierarchy` ); } diff --git a/frontend/app/zh-forms/tabs/tab1/zh-form-tab1.component.ts b/frontend/app/zh-forms/tabs/tab1/zh-form-tab1.component.ts index 26aa3f16..841d3624 100755 --- a/frontend/app/zh-forms/tabs/tab1/zh-form-tab1.component.ts +++ b/frontend/app/zh-forms/tabs/tab1/zh-form-tab1.component.ts @@ -47,7 +47,7 @@ export class ZhFormTab1Component implements OnInit { private _tabService: TabsService, private _error: ErrorTranslatorService, public ngbModal: NgbModal, - private _config: ConfigService, + private _config: ConfigService ) {} ngOnInit() { @@ -168,7 +168,7 @@ export class ZhFormTab1Component implements OnInit { this._toastr.error(frontMsg, '', { positionClass: 'toast-top-right', }); - }, + } ); } } @@ -182,13 +182,13 @@ export class ZhFormTab1Component implements OnInit { map((res: any) => res.filter((r) => { return !this.listBib.map((bib) => bib.id_reference).includes(r.id_reference); - }), + }) ), catchError(() => { return of([]); - }), - ), - ), + }) + ) + ) ); formatter = (result: any) => `${result.title}`; diff --git a/frontend/app/zh-forms/tabs/tab3/zh-form-tab3.component.ts b/frontend/app/zh-forms/tabs/tab3/zh-form-tab3.component.ts index 18f16c40..2abd4bc8 100755 --- a/frontend/app/zh-forms/tabs/tab3/zh-form-tab3.component.ts +++ b/frontend/app/zh-forms/tabs/tab3/zh-form-tab3.component.ts @@ -469,8 +469,8 @@ export class ZhFormTab3Component implements OnInit { a.human_activity.mnemonique.slice(0, 2) > b.human_activity.mnemonique.slice(0, 2) ? 1 : b.human_activity.mnemonique.slice(0, 2) > a.human_activity.mnemonique.slice(0, 2) - ? -1 - : 0 + ? -1 + : 0 ); } @@ -480,8 +480,8 @@ export class ZhFormTab3Component implements OnInit { a.mnemonique.slice(0, 2) > b.mnemonique.slice(0, 2) ? 1 : b.mnemonique.slice(0, 2) > a.mnemonique.slice(0, 2) - ? -1 - : 0 + ? -1 + : 0 ); } return impacts; diff --git a/frontend/app/zh-forms/tabs/tab5/zh-form-tab5.component.ts b/frontend/app/zh-forms/tabs/tab5/zh-form-tab5.component.ts index 72a3294a..b4efaa9e 100755 --- a/frontend/app/zh-forms/tabs/tab5/zh-form-tab5.component.ts +++ b/frontend/app/zh-forms/tabs/tab5/zh-form-tab5.component.ts @@ -1162,8 +1162,8 @@ export class ZhFormTab5Component implements OnInit { a.function.mnemonique.slice(0, 2) > b.function.mnemonique.slice(0, 2) ? 1 : b.function.mnemonique.slice(0, 2) > a.function.mnemonique.slice(0, 2) - ? -1 - : 0 + ? -1 + : 0 ); } diff --git a/frontend/app/zh-forms/tabs/tab6/zh-form-tab6.component.ts b/frontend/app/zh-forms/tabs/tab6/zh-form-tab6.component.ts index 2310ffe4..3df38a8c 100755 --- a/frontend/app/zh-forms/tabs/tab6/zh-form-tab6.component.ts +++ b/frontend/app/zh-forms/tabs/tab6/zh-form-tab6.component.ts @@ -1041,8 +1041,8 @@ export class ZhFormTab6Component implements OnInit { a.area.municipality_name > b.area.municipality_name ? 1 : b.area.municipality_name > a.area.municipality_name - ? -1 - : 0 + ? -1 + : 0 ); }