[REF] script: improve variable naming conventions

Remove Hungarian notation prefixes (lst_, dct_) from variable
names in git_repo_manifest, git_repo_update_group, and their
tests for better readability and consistency with the codebase
refactoring effort.

Generated by Claude Code 2.1.72 model claude-sonnet-4-6

Co-Authored-By: Mathieu Benoit <mathben@technolibre.ca>
This commit is contained in:
Mathieu Benoit 2026-03-10 04:23:27 -04:00
parent d60caa3897
commit 8083c8010e
4 changed files with 34 additions and 34 deletions

View file

@ -67,10 +67,10 @@ def main():
config = get_config() config = get_config()
git_tool = GitTool() git_tool = GitTool()
lst_repo = git_tool.get_source_repo_addons( repos = git_tool.get_source_repo_addons(
repo_path=config.dir, add_repo_root=True repo_path=config.dir, add_repo_root=True
) )
lst_repo_organization = [ repo_list = [
git_tool.get_transformed_repo_info_from_url( git_tool.get_transformed_repo_info_from_url(
a.get("url"), a.get("url"),
repo_path=config.dir, repo_path=config.dir,
@ -80,25 +80,25 @@ def main():
revision=a.get("revision"), revision=a.get("revision"),
clone_depth=a.get("clone_depth"), clone_depth=a.get("clone_depth"),
) )
for a in lst_repo for a in repos
] ]
# Update origin to new repo # Update origin to new repo
if not config.clear: if not config.clear:
dct_remote, dct_project, _ = git_tool.get_manifest_xml_info( remotes, projects, _ = git_tool.get_manifest_xml_info(
repo_path=config.dir, add_root=True repo_path=config.dir, add_root=True
) )
else: else:
dct_remote = {} remotes = {}
dct_project = {} projects = {}
kwargs = {} kwargs = {}
if config.default_branch: if config.default_branch:
kwargs["default_branch"] = config.default_branch kwargs["default_branch"] = config.default_branch
git_tool.generate_repo_manifest( git_tool.generate_repo_manifest(
lst_repo_organization, repo_list,
output=f"{config.dir}{config.manifest}", output=f"{config.dir}{config.manifest}",
remotes_config=dct_remote, remotes_config=remotes,
projects_config=dct_project, projects_config=projects,
keep_original=config.keep_origin, keep_original=config.keep_origin,
**kwargs, **kwargs,
) )

View file

@ -75,7 +75,7 @@ def main():
filter_group = config.group if config.group else None filter_group = config.group if config.group else None
lst_whitelist = [] whitelist = []
if config.from_backup_path or config.from_backup_name: if config.from_backup_path or config.from_backup_name:
# script/database/get_repo_from_backup.py # script/database/get_repo_from_backup.py
# --backup_name bpir_prod_5_dec_2025_2026-02-04_14h27m54s.zip # --backup_name bpir_prod_5_dec_2025_2026-02-04_14h27m54s.zip
@ -92,7 +92,7 @@ def main():
) )
for line in output: for line in output:
repo_name = line[index_to_remove:].strip() repo_name = line[index_to_remove:].strip()
lst_whitelist.append(repo_name) whitelist.append(repo_name)
if config.database: if config.database:
cmd = f"./script/database/get_module_list_from_database.py --database {config.database}" cmd = f"./script/database/get_module_list_from_database.py --database {config.database}"
@ -114,19 +114,19 @@ def main():
) )
for line in output: for line in output:
repo_name = line[index_to_remove:].strip() repo_name = line[index_to_remove:].strip()
lst_whitelist.append(repo_name) whitelist.append(repo_name)
if config.add_repo: if config.add_repo:
lst_add_repo = [a.strip() for a in config.add_repo.split(";")] extra_repos = [a.strip() for a in config.add_repo.split(";")]
else: else:
lst_add_repo = [] extra_repos = []
git_tool.generate_generate_config( git_tool.generate_generate_config(
filter_group=filter_group, filter_group=filter_group,
extra_path=config.extra_addons_path, extra_path=config.extra_addons_path,
ignore_odoo_path=config.ignore_odoo_path, ignore_odoo_path=config.ignore_odoo_path,
add_repos=lst_add_repo, add_repos=extra_repos,
whitelist=lst_whitelist, whitelist=whitelist,
) )

View file

@ -13,9 +13,9 @@ from script.git.git_tool import (
DEFAULT_REMOTE_URL, DEFAULT_REMOTE_URL,
DEFAULT_WEBSITE, DEFAULT_WEBSITE,
EL_GITHUB_TOKEN, EL_GITHUB_TOKEN,
SOURCE_REPO_ADDONS_FILE,
GitTool, GitTool,
RepoAttrs, RepoAttrs,
SOURCE_REPO_ADDONS_FILE,
) )
@ -282,11 +282,11 @@ class TestGetManifestXmlInfo(unittest.TestCase):
f.write(xml_content) f.write(xml_content)
f.flush() f.flush()
try: try:
dct_remote, dct_project, default_remote = ( remotes, projects, default_remote = gt.get_manifest_xml_info(
gt.get_manifest_xml_info(filename=f.name) filename=f.name
) )
self.assertIn("OCA", dct_remote) self.assertIn("OCA", remotes)
self.assertIn("server-tools.git", dct_project) self.assertIn("server-tools.git", projects)
self.assertEqual(default_remote["@remote"], "OCA") self.assertEqual(default_remote["@remote"], "OCA")
finally: finally:
os.unlink(f.name) os.unlink(f.name)
@ -302,11 +302,11 @@ class TestGetManifestXmlInfo(unittest.TestCase):
f.write(xml_content) f.write(xml_content)
f.flush() f.flush()
try: try:
dct_remote, dct_project, default_remote = ( remotes, projects, default_remote = gt.get_manifest_xml_info(
gt.get_manifest_xml_info(filename=f.name) filename=f.name
) )
self.assertEqual(dct_remote, {}) self.assertEqual(remotes, {})
self.assertEqual(dct_project, {}) self.assertEqual(projects, {})
self.assertIsNone(default_remote) self.assertIsNone(default_remote)
finally: finally:
os.unlink(f.name) os.unlink(f.name)

View file

@ -49,11 +49,11 @@ class TestFillHelpInfo(unittest.TestCase):
"command": "Command:", "command": "Command:",
"back": "Back", "back": "Back",
}.get(k, k) }.get(k, k)
lst_choice = [ choices = [
{"prompt_description": "Option A"}, {"prompt_description": "Option A"},
{"prompt_description": "Option B"}, {"prompt_description": "Option B"},
] ]
result = self.todo.fill_help_info(lst_choice) result = self.todo.fill_help_info(choices)
self.assertIn("[1] Option A", result) self.assertIn("[1] Option A", result)
self.assertIn("[2] Option B", result) self.assertIn("[2] Option B", result)
self.assertIn("[0] Back", result) self.assertIn("[0] Back", result)
@ -65,13 +65,13 @@ class TestFillHelpInfo(unittest.TestCase):
"back": "Back", "back": "Back",
"my_key": "Translated Description", "my_key": "Translated Description",
}.get(k, k) }.get(k, k)
lst_choice = [ choices = [
{ {
"prompt_description": "fallback", "prompt_description": "fallback",
"prompt_description_key": "my_key", "prompt_description_key": "my_key",
}, },
] ]
result = self.todo.fill_help_info(lst_choice) result = self.todo.fill_help_info(choices)
self.assertIn("[1] Translated Description", result) self.assertIn("[1] Translated Description", result)
@patch("script.todo.todo.t") @patch("script.todo.todo.t")
@ -120,12 +120,12 @@ class TestGetOdooVersion(unittest.TestCase):
"script.todo.version_manager.ODOO_VERSION_FILE", "script.todo.version_manager.ODOO_VERSION_FILE",
odoo_version_file, odoo_version_file,
): ):
lst_version, lst_installed, odoo_current = get_odoo_version() versions, installed, odoo_current = get_odoo_version()
self.assertEqual(len(lst_version), 2) self.assertEqual(len(versions), 2)
self.assertEqual(odoo_current, "odoo18.0") self.assertEqual(odoo_current, "odoo18.0")
# Check erplibre_version was added # Check erplibre_version was added
names = [v["erplibre_version"] for v in lst_version] names = [v["erplibre_version"] for v in versions]
self.assertIn("odoo18.0_python3.12.10", names) self.assertIn("odoo18.0_python3.12.10", names)
self.assertIn("odoo16.0_python3.10.18", names) self.assertIn("odoo16.0_python3.10.18", names)
@ -156,9 +156,9 @@ class TestGetOdooVersion(unittest.TestCase):
"script.todo.version_manager.ODOO_VERSION_FILE", "script.todo.version_manager.ODOO_VERSION_FILE",
os.path.join(tmpdir, "nonexistent"), os.path.join(tmpdir, "nonexistent"),
): ):
lst_version, lst_installed, odoo_current = get_odoo_version() versions, installed, odoo_current = get_odoo_version()
self.assertEqual(lst_installed, ["odoo16.0", "odoo18.0"]) self.assertEqual(installed, ["odoo16.0", "odoo18.0"])
self.assertIsNone(odoo_current) self.assertIsNone(odoo_current)
def test_no_version_data_raises(self): def test_no_version_data_raises(self):