Skip to content

Commit

Permalink
using walrus operator to simplify logic in GraphCreatorFactory
Browse files Browse the repository at this point in the history
  • Loading branch information
Frix-x committed Nov 23, 2024
1 parent a9a0a3e commit f3c1917
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions shaketune/graph_creators/graph_creator_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
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:
if creator_class := GraphCreator.registry.get(graph_type):
return creator_class(config)
else:
raise NotImplementedError(f'Graph creator for {graph_type} not implemented!')
return creator_class(config)

0 comments on commit f3c1917

Please sign in to comment.