ms1450 / CommandConnectorCompatibilityCalculator

Compares a customer list of Camera Models with the Verkada HCL to provide compatible cameras.
2 stars 1 forks source link

Gone Global! #2

Closed ian-young closed 3 months ago

ian-young commented 3 months ago

Gone Global

Description

This PR refactors the camera compatibility script to include type annotations, improve function definitions, and update functionality for better clarity and maintainability. The following changes have been implemented:

  1. Type Annotations Added:

    • Added type hints to function signatures for better readability and to support type checking.
    • Updated CompatibleModel class and all relevant functions with appropriate types.
  2. Refactored find_matching_camera Function:

    • Updated to accept a list of CompatibleModel objects directly, improving clarity and functionality.
  3. New tabulate_data Function:

    • Introduced tabulate_data function to handle data tabulation and printing, separating concerns for better modularity.
  4. Updated identify_model_column Function:

    • Improved the identify_model_column function to use a set for column_values to avoid duplicate processing.
    • Enhanced comments and cleaned up the logic for clarity.
  5. Improved Documentation:

    • Updated docstrings to reflect the new type annotations and provide clear explanations of the function parameters and return types.
  6. Code Formatting:

    • Made minor adjustments to align with PEP 8 and improve code readability.

Changes

Example Usage

The refactored functions now include type hints, making it easier to understand the expected inputs and outputs. For instance, the identify_model_column function now requires both the raw customer data and the list of Verkada camera models to determine the best matching column index.

Type of change

How Has This Been Tested?

The changes have been tested with CSV outputs using the following steps:

  1. Ran the script using the CSV found in the repository.
  2. Checked output printed in terminal was formatted properly.
  3. Checked the output saved to the file matched the original output.

Test Configuration:

Checklist