Prompt
Use consistent and appropriate naming conventions based on the context in Python code:
- Classes: Use
CamelCasefor class namesclass ResourceMeta(object): # Class implementation - Variables and methods: Use
snake_casefor variables, functions, and methodsself._resource_sub_path = self._resource_name.lower() - Constants: Use
UPPER_CASEfor constantsSTRING = 'S' NUMBER = 'N' - Private members: Use leading underscore for internal/private attributes and methods, but avoid redundant underscores when scope already provides privacy
# Good - private method def _method_returns_resource_list(resource): # Implementation # Avoid unnecessary underscores for local variables def setUp(self): patch_global_session = mock.patch('boto3.DEFAULT_SESSION') # No leading underscore needed - File naming: Follow established patterns for file naming
# For test files, use test_<module_name>.py test_table.py # Not test_batch_write.py if testing the table module - Acronyms: Properly capitalize acronyms in names
class TestIAMAccessKey(unittest.TestCase): # Not TestiamAccessKey - References and paths: Use snake_case for references and lowercase-hyphenated for URL paths
# For references ref.name = 'frob' # Not 'Frob' # For URL paths self._resource_sub_path = 'service-resource' # Not 'ServiceResource' - Type mappings: Use appropriate Python type names
# Map external types to Python types 'double': 'float', 'character': 'string', 'long': 'integer'
Consistent naming makes code more readable, maintainable, and reduces cognitive load for developers working with the codebase.