jschalk / jaar

Cross-cultural communication engine built on customizable economic systems. Produces personalized agendas, calendars, finance reports for users.
0 stars 1 forks source link

175 enable documentation process #349

Closed jschalk closed 1 month ago

jschalk commented 1 month ago

Summary by Sourcery

Enable explicit label mapping in the BridgeUnit class and refactor its handling of delimiters. Add extensive tests to ensure the correctness of the new and existing functionalities.

New Features:

Enhancements:

Tests:

sourcery-ai[bot] commented 1 month ago

Reviewer's Guide by Sourcery

This pull request implements changes to the BridgeUnit class and related functionality in the filter module. The changes include refactoring existing methods, adding new methods for handling explicit label maps, and improving the overall structure and functionality of the BridgeUnit class. Additionally, new test files have been added to cover the new and modified functionality.

Updated class diagram for the BridgeUnit class

classDiagram
    class BridgeUnit {
        -atom_arg: str
        -src_to_dst: dict
        -unknown_word: str
        -src_road_delimiter: str
        -dst_road_delimiter: str
        -explicit_label_map: dict
        -_calc_atom_python_type: str
        +set_atom_arg(x_atom_arg: str)
        +set_all_src_to_dst(x_src_to_dst: dict, raise_exception_if_invalid: bool)
        +set_src_to_dst(src_word: str, dst_word: str)
        +_get_dst_value(src_word: str): str
        +get_create_dst(src_word: str, missing_add: bool): str
        +_get_create_roadunit_dst(src_road): RoadUnit
        +_get_explicit_roadnode(x_roadNode: RoadNode): RoadNode
        +src_to_dst_exists(src_word: str, dst_word: str): bool
        +src_exists(src_word: str): bool
        +del_src_to_dst(src_word: str)
        +set_explicit_label_map(src_label: RoadNode, dst_label: RoadNode)
        +_get_explicit_dst_label(src_label: RoadNode): RoadNode
        +explicit_label_map_exists(src_label: RoadNode, dst_label: RoadNode): bool
        +explicit_src_label_exists(src_label: RoadNode): bool
        +del_explicit_label_map(src_label: RoadNode)
        +_unknown_word_in_src_to_dst(): bool
        +_src_road_delimiter_in_src_words(): bool
        +_dst_road_delimiter_in_src_words(): bool
        +_src_road_delimiter_in_dst_words(): bool
        +_dst_road_delimiter_in_dst_words(): bool
        +_is_src_delimiter_inclusion_correct(): bool
        +_is_dst_delimiter_inclusion_correct(): bool
        +all_src_parent_roads_exist(): bool
        +is_valid(): bool
        +get_dict(): dict
        +get_json(): str
    }

File-Level Changes

Change Details Files
Refactored and enhanced BridgeUnit class
  • Added explicit_label_map attribute and related methods
  • Improved get_create_dst method to handle different scenarios
  • Added methods for converting BridgeUnit to dict and JSON formats
  • Implemented new validation methods for src and dst delimiter inclusion
src/f09_filter/bridge.py
src/f09_filter/test/test_birdgeunit_.py
Added new test files for BridgeUnit functionality
  • Created tests for get_create_dst method
  • Added tests for dict and JSON conversion methods
  • Implemented tests for delimiter-related functionality
src/f09_filter/test/test_birdgeunit_get_create_dst.py
src/f09_filter/test/test_birdgeunit_dict.py
src/f09_filter/test/test_birdgeunit_delimiter.py
Updated dict_tool functions
  • Modified str_in_all_dict_keys and str_in_all_dict_values to use 'all' instead of 'not any'
  • Updated str_in_all_dict function for consistency
src/f00_instrument/dict_tool.py

Possibly linked issues


Tips and commands #### Interacting with Sourcery - **Trigger a new review:** Comment `@sourcery-ai review` on the pull request. - **Continue discussions:** Reply directly to Sourcery's review comments. - **Generate a GitHub issue from a review comment:** Ask Sourcery to create an issue from a review comment by replying to it. - **Generate a pull request title:** Write `@sourcery-ai` anywhere in the pull request title to generate a title at any time. - **Generate a pull request summary:** Write `@sourcery-ai summary` anywhere in the pull request body to generate a PR summary at any time. You can also use this command to specify where the summary should be inserted. #### Customizing Your Experience Access your [dashboard](https://app.sourcery.ai) to: - Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others. - Change the review language. - Add, remove or edit custom review instructions. - Adjust other review settings. #### Getting Help - [Contact our support team](mailto:support@sourcery.ai) for questions or feedback. - Visit our [documentation](https://docs.sourcery.ai) for detailed guides and information. - Keep in touch with the Sourcery team by following us on [X/Twitter](https://x.com/SourceryAI), [LinkedIn](https://www.linkedin.com/company/sourcery-ai/) or [GitHub](https://github.com/sourcery-ai).