Closed jschalk closed 5 days ago
This pull request refactors the pidgin translation system by splitting the BridgeUnit class into specialized bridge classes (GroupBridge, AcctBridge, RoadBridge) and updating the PidginUnit class to use these new bridge types. The changes improve code organization and maintainability by separating concerns into distinct classes.
classDiagram
class PidginUnit {
TimeLinePoint event_id
OwnerID face_id
dict[str, BridgeUnit] bridgeunits
GroupBridge groupbridge
AcctBridge acctbridge
RoadBridge roadbridge
str unknown_word
str otx_wall
str inx_wall
+set_groupbridge(GroupBridge)
+get_groupbridge() GroupBridge
+set_group_id(str, str)
+group_id_exists(str, str) bool
+_get_inx_group_id(str) str
+del_group_id(str)
+set_acctbridge(AcctBridge)
+get_acctbridge() AcctBridge
+set_acct_id(str, str)
+acct_id_exists(str, str) bool
+_get_inx_acct_id(str) str
+del_acct_id(str)
+set_roadbridge(RoadBridge)
+get_roadbridge() RoadBridge
+set_road(str, str)
+road_exists(str, str) bool
+_get_inx_road(str) str
+del_road(str)
+set_bridgeunit(BridgeUnit)
+get_bridgeunit(str) BridgeUnit
+is_valid() bool
+set_otx2inx(str, str, str)
+get_dict() dict
+get_json() str
}
class BridgeUnit {
dict otx2inx
str unknown_word
str otx_wall
str inx_wall
dict nub_label
str jaar_type
OwnerID face_id
+set_all_otx2inx(dict, bool)
+set_otx2inx(str, str)
+_get_inx_value(str) str
+reveal_inx(str, bool) str
+_reveal_roadunit_inx(str) RoadUnit
+_get_nub_roadnode(RoadNode) RoadNode
+otx2inx_exists(str, str) bool
+otx_exists(str) bool
+del_otx2inx(str)
+set_nub_label(RoadNode, RoadNode)
+_set_new_nub_label_to_otx_inx(str, str)
+_get_nub_inx_label(RoadNode) RoadNode
+nub_label_exists(RoadNode, RoadNode) bool
+nub_otx_label_exists(RoadNode) bool
+del_nub_label(RoadNode) bool
+_unknown_word_in_otx2inx() bool
+_otx_wall_in_otx_words() bool
+_inx_wall_in_otx_words() bool
+_otx_wall_in_inx_words() bool
+_inx_wall_in_inx_words() bool
+_is_otx_wall_inclusion_correct() bool
+_is_inx_wall_inclusion_correct() bool
+all_otx_parent_roads_exist() bool
+is_valid() bool
+get_dict() dict
+get_json() str
}
class GroupBridge {
+set_otx2inx(str, str)
+otx2inx_exists(str, str) bool
+_get_inx_value(str) str
+del_otx2inx(str)
}
class AcctBridge {
+set_otx2inx(str, str)
+otx2inx_exists(str, str) bool
+_get_inx_value(str) str
+del_otx2inx(str)
}
class RoadBridge {
+set_otx2inx(str, str)
+otx2inx_exists(str, str) bool
+_get_inx_value(str) str
+del_otx2inx(str)
}
PidginUnit --> BridgeUnit
PidginUnit --> GroupBridge
PidginUnit --> AcctBridge
PidginUnit --> RoadBridge
BridgeUnit <|-- GroupBridge
BridgeUnit <|-- AcctBridge
BridgeUnit <|-- RoadBridge
Change | Details | Files |
---|---|---|
Split BridgeUnit into specialized bridge classes with shared core functionality |
|
src/f08_pidgin/bridge_new.py src/f08_pidgin/bridge_old.py |
Updated PidginUnit to use new specialized bridge classes |
|
src/f08_pidgin/pidgin.py |
Added database support for new bridge types |
|
src/f09_brick/brick_models.py src/f09_brick/brick_formats/brick_format_00042_bridge_group_id_v0_0_0.json src/f09_brick/brick_formats/brick_format_00043_bridge_acct_id_v0_0_0.json |
Added comprehensive test coverage for new bridge classes |
|
src/f08_pidgin/test_pidgin/test_bridge_group.py src/f08_pidgin/test_pidgin/test_bridge_acct.py src/f08_pidgin/test_pidgin/test_bridge_road.py src/f08_pidgin/test_pidgin/test_pidginunit_crud_group.py src/f08_pidgin/test_pidgin/test_pidginunit_crud_acct.py src/f08_pidgin/test_pidgin/test_pidginunit_crud_road.py |
Summary by Sourcery
Refactor the translation handling in the pidgin module by introducing new bridge classes for group, account, and road translations. Update the PidginUnit class to utilize these new classes, enhancing modularity and maintainability. Replace the get_create_inx method with reveal_inx for improved clarity. Add comprehensive tests for the new classes and update existing tests to align with the refactored code.
New Features:
Enhancements:
Tests: