Back to all reviewers

Follow naming conventions

boto/boto3
Based on 7 comments
Python

Use consistent and appropriate naming conventions based on the context in Python code: 1. **Classes**: Use `CamelCase` for class names ```python class ResourceMeta(object):

Naming Conventions Python

Reviewer Prompt

Use consistent and appropriate naming conventions based on the context in Python code:

  1. Classes: Use CamelCase for class names
    class ResourceMeta(object):
        # Class implementation
    
  2. Variables and methods: Use snake_case for variables, functions, and methods
    self._resource_sub_path = self._resource_name.lower()
    
  3. Constants: Use UPPER_CASE for constants
    STRING = 'S'
    NUMBER = 'N'
    
  4. 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
    
  5. 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
    
  6. Acronyms: Properly capitalize acronyms in names
    class TestIAMAccessKey(unittest.TestCase):  # Not TestiamAccessKey
    
  7. 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'
    
  8. 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.

7
Comments Analyzed
Python
Primary Language
Naming Conventions
Category

Source Discussions