Fix pre-commit warnings

pull/2358/head
Telmo Santos 2021-01-07 10:49:46 +01:00 committed by Juliette Blanc
parent 4336961850
commit 323f7bee50
2 changed files with 9 additions and 9 deletions

View File

@ -52,10 +52,10 @@ class IrModuleModule(models.Model):
field_name: Odoo field name to store the analysis field_name: Odoo field name to store the analysis
""" """
return { return {
".py": {"code": "python_code_qty",}, ".py": {"code": "python_code_qty"},
".xml": {"code": "xml_code_qty",}, ".xml": {"code": "xml_code_qty"},
".js": {"code": "js_code_qty",}, ".js": {"code": "js_code_qty"},
".css": {"code": "css_code_qty",}, ".css": {"code": "css_code_qty"},
} }
@api.model @api.model
@ -145,8 +145,8 @@ class IrModuleModule(models.Model):
# Update the module with the datas # Update the module with the datas
values = {} values = {}
for file_ext, analyses in analysed_datas.items(): for _, analyses in analysed_datas.items():
for k, v in analyses.items(): for _, v in analyses.items():
values[v["field"]] = v["value"] values[v["field"]] = v["value"]
module.write(values) module.write(values)
@ -156,7 +156,7 @@ class IrModuleModule(models.Model):
self, path, file_extensions, exclude_directories, exclude_files self, path, file_extensions, exclude_directories, exclude_files
): ):
res = [] res = []
for root, dirs, files in os.walk(path, followlinks=True): for root, _, files in os.walk(path, followlinks=True):
if set(Path(root).parts) & set(exclude_directories): if set(Path(root).parts) & set(exclude_directories):
continue continue
for name in files: for name in files:
@ -170,7 +170,7 @@ class IrModuleModule(models.Model):
@api.model @api.model
def _get_analyse_data_dict(self): def _get_analyse_data_dict(self):
res_dict = self._get_analyse_settings().copy() res_dict = self._get_analyse_settings().copy()
for file_ext, analyse_dict in res_dict.items(): for _, analyse_dict in res_dict.items():
for analyse_type, v in analyse_dict.items(): for analyse_type, v in analyse_dict.items():
analyse_dict[analyse_type] = {"field": v, "value": 0} analyse_dict[analyse_type] = {"field": v, "value": 0}
return res_dict return res_dict

View File

@ -2,7 +2,7 @@
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) # @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models from odoo import fields, models
from odoo.tools.safe_eval import safe_eval from odoo.tools.safe_eval import safe_eval