-
-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implemented a Factory design pattern for graph creators
- Loading branch information
Showing
9 changed files
with
68 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Shake&Tune: 3D printer analysis tools | ||
# | ||
# Copyright (C) 2024 Félix Boisselier <[email protected]> (Frix_x on Discord) | ||
# Licensed under the GNU General Public License v3.0 (GPL-3.0) | ||
# | ||
# File: graph_creator_factory.py | ||
# Description: Contains a factory class to create the different graph creators. | ||
|
||
|
||
from ..shaketune_config import ShakeTuneConfig | ||
from .graph_creator import GraphCreator | ||
|
||
|
||
class GraphCreatorFactory: | ||
@staticmethod | ||
def create_graph_creator(graph_type: str, config: ShakeTuneConfig) -> GraphCreator: | ||
creator_class = GraphCreator.registry.get(graph_type, None) | ||
if not creator_class: | ||
raise NotImplementedError(f'Graph creator for {graph_type} not implemented!') | ||
return creator_class(config) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters