[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:
parent
d60caa3897
commit
8083c8010e
4 changed files with 34 additions and 34 deletions
|
|
@ -67,10 +67,10 @@ def main():
|
|||
config = get_config()
|
||||
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
|
||||
)
|
||||
lst_repo_organization = [
|
||||
repo_list = [
|
||||
git_tool.get_transformed_repo_info_from_url(
|
||||
a.get("url"),
|
||||
repo_path=config.dir,
|
||||
|
|
@ -80,25 +80,25 @@ def main():
|
|||
revision=a.get("revision"),
|
||||
clone_depth=a.get("clone_depth"),
|
||||
)
|
||||
for a in lst_repo
|
||||
for a in repos
|
||||
]
|
||||
|
||||
# Update origin to new repo
|
||||
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
|
||||
)
|
||||
else:
|
||||
dct_remote = {}
|
||||
dct_project = {}
|
||||
remotes = {}
|
||||
projects = {}
|
||||
kwargs = {}
|
||||
if config.default_branch:
|
||||
kwargs["default_branch"] = config.default_branch
|
||||
git_tool.generate_repo_manifest(
|
||||
lst_repo_organization,
|
||||
repo_list,
|
||||
output=f"{config.dir}{config.manifest}",
|
||||
remotes_config=dct_remote,
|
||||
projects_config=dct_project,
|
||||
remotes_config=remotes,
|
||||
projects_config=projects,
|
||||
keep_original=config.keep_origin,
|
||||
**kwargs,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ def main():
|
|||
|
||||
filter_group = config.group if config.group else None
|
||||
|
||||
lst_whitelist = []
|
||||
whitelist = []
|
||||
if config.from_backup_path or config.from_backup_name:
|
||||
# script/database/get_repo_from_backup.py
|
||||
# --backup_name bpir_prod_5_dec_2025_2026-02-04_14h27m54s.zip
|
||||
|
|
@ -92,7 +92,7 @@ def main():
|
|||
)
|
||||
for line in output:
|
||||
repo_name = line[index_to_remove:].strip()
|
||||
lst_whitelist.append(repo_name)
|
||||
whitelist.append(repo_name)
|
||||
|
||||
if 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:
|
||||
repo_name = line[index_to_remove:].strip()
|
||||
lst_whitelist.append(repo_name)
|
||||
whitelist.append(repo_name)
|
||||
|
||||
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:
|
||||
lst_add_repo = []
|
||||
extra_repos = []
|
||||
|
||||
git_tool.generate_generate_config(
|
||||
filter_group=filter_group,
|
||||
extra_path=config.extra_addons_path,
|
||||
ignore_odoo_path=config.ignore_odoo_path,
|
||||
add_repos=lst_add_repo,
|
||||
whitelist=lst_whitelist,
|
||||
add_repos=extra_repos,
|
||||
whitelist=whitelist,
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@ from script.git.git_tool import (
|
|||
DEFAULT_REMOTE_URL,
|
||||
DEFAULT_WEBSITE,
|
||||
EL_GITHUB_TOKEN,
|
||||
SOURCE_REPO_ADDONS_FILE,
|
||||
GitTool,
|
||||
RepoAttrs,
|
||||
SOURCE_REPO_ADDONS_FILE,
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -282,11 +282,11 @@ class TestGetManifestXmlInfo(unittest.TestCase):
|
|||
f.write(xml_content)
|
||||
f.flush()
|
||||
try:
|
||||
dct_remote, dct_project, default_remote = (
|
||||
gt.get_manifest_xml_info(filename=f.name)
|
||||
remotes, projects, default_remote = gt.get_manifest_xml_info(
|
||||
filename=f.name
|
||||
)
|
||||
self.assertIn("OCA", dct_remote)
|
||||
self.assertIn("server-tools.git", dct_project)
|
||||
self.assertIn("OCA", remotes)
|
||||
self.assertIn("server-tools.git", projects)
|
||||
self.assertEqual(default_remote["@remote"], "OCA")
|
||||
finally:
|
||||
os.unlink(f.name)
|
||||
|
|
@ -302,11 +302,11 @@ class TestGetManifestXmlInfo(unittest.TestCase):
|
|||
f.write(xml_content)
|
||||
f.flush()
|
||||
try:
|
||||
dct_remote, dct_project, default_remote = (
|
||||
gt.get_manifest_xml_info(filename=f.name)
|
||||
remotes, projects, default_remote = gt.get_manifest_xml_info(
|
||||
filename=f.name
|
||||
)
|
||||
self.assertEqual(dct_remote, {})
|
||||
self.assertEqual(dct_project, {})
|
||||
self.assertEqual(remotes, {})
|
||||
self.assertEqual(projects, {})
|
||||
self.assertIsNone(default_remote)
|
||||
finally:
|
||||
os.unlink(f.name)
|
||||
|
|
|
|||
|
|
@ -49,11 +49,11 @@ class TestFillHelpInfo(unittest.TestCase):
|
|||
"command": "Command:",
|
||||
"back": "Back",
|
||||
}.get(k, k)
|
||||
lst_choice = [
|
||||
choices = [
|
||||
{"prompt_description": "Option A"},
|
||||
{"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("[2] Option B", result)
|
||||
self.assertIn("[0] Back", result)
|
||||
|
|
@ -65,13 +65,13 @@ class TestFillHelpInfo(unittest.TestCase):
|
|||
"back": "Back",
|
||||
"my_key": "Translated Description",
|
||||
}.get(k, k)
|
||||
lst_choice = [
|
||||
choices = [
|
||||
{
|
||||
"prompt_description": "fallback",
|
||||
"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)
|
||||
|
||||
@patch("script.todo.todo.t")
|
||||
|
|
@ -120,12 +120,12 @@ class TestGetOdooVersion(unittest.TestCase):
|
|||
"script.todo.version_manager.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")
|
||||
# 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("odoo16.0_python3.10.18", names)
|
||||
|
||||
|
|
@ -156,9 +156,9 @@ class TestGetOdooVersion(unittest.TestCase):
|
|||
"script.todo.version_manager.ODOO_VERSION_FILE",
|
||||
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)
|
||||
|
||||
def test_no_version_data_raises(self):
|
||||
|
|
|
|||
Loading…
Reference in a new issue