From de15420765d5a1299ccfff3248aeb0142789a92c Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Mon, 10 Jul 2023 14:58:56 +0800 Subject: [PATCH] Allow class name to have a leading underscore --- scripts/in_container/verify_providers.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/in_container/verify_providers.py b/scripts/in_container/verify_providers.py index 3f547b008797b..d5bff21582643 100755 --- a/scripts/in_container/verify_providers.py +++ b/scripts/in_container/verify_providers.py @@ -545,6 +545,10 @@ def is_camel_case_with_acronyms(s: str): :param s: string to check :return: true if the name looks cool as Class name. """ + if s and s[0] == "_": # Leading underscores are fine. + s = s[1:] + if not s: + return True return s != s.lower() and s != s.upper() and "_" not in s and s[0].upper() == s[0] @@ -567,7 +571,8 @@ def check_if_classes_are_properly_named( if not is_camel_case_with_acronyms(class_name): console.print( f"[red]The class {class_full_name} is wrongly named. The " - f"class name should be CamelCaseWithACRONYMS ![/]" + f"class name should be CamelCaseWithACRONYMS optionally " + f"with a single leading underscore[/]" ) error_encountered = True if not class_name.endswith(class_suffix):