@@ -24,7 +24,7 @@ def __init__(
2424 self .config = config
2525 self .name = config ["name" ]
2626 self ._player_unique_id = uuid .uuid4 ()
27- """Unique ID that doesn't clash even accross multiple games. Used for git tags."""
27+ """Unique ID that doesn't clash even across multiple games. Used for git tags."""
2828 self .environment = environment
2929 self .game_context = game_context
3030 self .logger = get_logger (
@@ -51,9 +51,7 @@ def post_run_hook(self, *, round: int) -> None:
5151 """Should be called after we called the run method."""
5252 self ._commit ()
5353 self ._metadata ["diff" ][round ] = self ._get_round_diff (round )
54- self ._metadata ["incremental_diff" ][round ] = self ._get_round_diff (
55- round , incremental = True
56- )
54+ self ._metadata ["incremental_diff" ][round ] = self ._get_round_diff (round , incremental = True )
5755
5856 @abstractmethod
5957 def run (self ) -> None :
@@ -76,23 +74,15 @@ def push(self) -> None:
7674 "git push origin --tags" ,
7775 ]:
7876 assert_zero_exit_code (self .environment .execute (cmd ), logger = self .logger )
79- self .logger .info (
80- f"Pushed { self .name } commit history to remote repository (branch { self ._branch_name } )"
81- )
77+ self .logger .info (f"Pushed { self .name } commit history to remote repository (branch { self ._branch_name } )" )
8278
83- def reset_and_apply_patch (
84- self , patch : str , * , base_commit : str = "" , filter_patch : bool = True
85- ) -> None :
86- """Clean all uncommited changes. If base_commit is provided, reset to that commit.
79+ def reset_and_apply_patch (self , patch : str , * , base_commit : str = "" , filter_patch : bool = True ) -> None :
80+ """Clean all uncommitted changes. If base_commit is provided, reset to that commit.
8781 Then apply the patch to the codebase.
8882 """
8983 # Need to clean before we copy over the patch (else it's gonna be removed by git clean)
9084 self .logger .debug (
91- assert_zero_exit_code (
92- self .environment .execute (
93- f"git reset --hard { base_commit } && git clean -fd"
94- )
95- )
85+ assert_zero_exit_code (self .environment .execute (f"git reset --hard { base_commit } && git clean -fd" ))
9686 )
9787
9888 patch = filter_git_diff (patch ) if filter_patch else patch
@@ -112,19 +102,15 @@ def reset_and_apply_patch(
112102 commands = ["git status" , "git apply tmp_patch.txt" , "rm -f tmp_patch.txt" ]
113103 for cmd in commands :
114104 self .logger .debug (f"Executing command: { cmd } " )
115- out = assert_zero_exit_code (
116- self .environment .execute (cmd ), logger = self .logger
117- )
105+ out = assert_zero_exit_code (self .environment .execute (cmd ), logger = self .logger )
118106 self .logger .debug (out )
119107
120108 # --- Helper methods ---
121109
122110 def _tag_round (self , round : int ) -> None :
123111 """Git tag the codebase at the given round."""
124112 assert_zero_exit_code (
125- self .environment .execute (
126- f"git tag -a { self ._get_round_tag_name (round )} -m 'Round { round } Update'"
127- ),
113+ self .environment .execute (f"git tag -a { self ._get_round_tag_name (round )} -m 'Round { round } Update'" ),
128114 logger = self .logger ,
129115 )
130116
@@ -161,9 +147,7 @@ def _get_round_diff(self, round: int, *, incremental: bool = False) -> str:
161147 previous_round_tag = self ._get_round_tag_name (0 )
162148 current_round_tag = self ._get_round_tag_name (round )
163149 out = assert_zero_exit_code (
164- self .environment .execute (
165- f"git diff { previous_round_tag } ..{ current_round_tag } "
166- ),
150+ self .environment .execute (f"git diff { previous_round_tag } ..{ current_round_tag } " ),
167151 logger = self .logger ,
168152 )
169153 return out ["output" ]
0 commit comments