Skip to content

Sourcery refactored master branch#1

Open
sourcery-ai[bot] wants to merge 1 commit intomasterfrom
sourcery/master
Open

Sourcery refactored master branch#1
sourcery-ai[bot] wants to merge 1 commit intomasterfrom
sourcery/master

Conversation

@sourcery-ai
Copy link

@sourcery-ai sourcery-ai bot commented Nov 18, 2023

Branch master refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

To manually merge these changes, make sure you're on the master branch, then run:

git fetch origin sourcery/master
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from maconard November 18, 2023 02:29
Comment on lines -183 to +199
self.as_set = 1 << self.id
self.as_set = 1 << self.id
global _PRP_SET_ALL
_PRP_SET_ALL |= self.as_set
self.piece = rot.piece
self.rotation = rot
self.piece_id = self.piece.id
self.name = name
self.contact = pt
self.piece = rot.piece
self.rotation = rot
self.piece_id = self.piece.id
self.name = name
self.contact = pt
_PIECE_ROTATION_POINTS.append(self)

dy, dx = pt

self.tiles: list[Tile] = []
self.adjacent: set[Tile] = set()
self.corners: set[Tile] = set()

for y, x in rot.tiles:
self.tiles.append((y - dy, x - dx))

self.tiles.extend((y - dy, x - dx) for y, x in rot.tiles)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function _PieceRotationPoint.__init__ refactored with the following changes:

Comment on lines -225 to +223
def _create_piece(name: str, shape: list[list[int]]) -> Piece:
def _create_piece(name: str, shape: list[list[int]]) -> Piece:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function _create_piece refactored with the following changes:

Comment on lines -421 to +419
_PRP_REL_COORDS: set[Tile] = set()
for _pt in _PRP_WITH_REL_COORD:
_PRP_REL_COORDS.add(_pt)
_PRP_REL_COORDS: set[Tile] = set(_PRP_WITH_REL_COORD)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 421-423 refactored with the following changes:

Comment on lines -667 to +663
if isinstance(value, Move):
return self.is_equal(value)
else:
return False
return self.is_equal(value) if isinstance(value, Move) else False
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Move.__eq__ refactored with the following changes:

Comment on lines -717 to +712
self._state: list[_BoardState] = []
self._tiles = np.zeros((20, 20), dtype=np.uint8)
self._n_players = n_players
self._state: list[_BoardState] = []
self._tiles = np.zeros((20, 20), dtype=np.uint8)
self._n_players = n_players
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Board.__init__ refactored with the following changes:

}

def __init__(self, name: str="TileWeight", weight_map: str='wall_crawl', custom_weights: list[int | float]=None):
def __init__(self, name: str="TileWeight", weight_map: str='wall_crawl', custom_weights: list[int | float]=None):
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function TileWeightEngine.__init__ refactored with the following changes:

def get_matches_by_engine(self, engine: int) -> list[MatchData]:
filtered_matches = [x for x in self.match_data if engine in x.engines]
return filtered_matches
return [x for x in self.match_data if engine in x.engines]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function TournamentResults.get_matches_by_engine refactored with the following changes:

Comment on lines -138 to +137
if sort_dir != 'asc' and sort_dir != 'desc':
if sort_dir not in ['asc', 'desc']:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function TournamentResults.get_engine_rankings_display refactored with the following changes:

Comment on lines -187 to +190
if (len(engines) < 1):
if not engines:
raise Exception("Number of engines must be greater than 0")
if move_seconds <= 0:
raise Exception("Must allow greater than 0 seconds per move")

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Tournament.__init__ refactored with the following changes:

Comment on lines -230 to +233

self.move_seconds = move_seconds if move_seconds is not None else self._seconds
if self.move_seconds <= 0:
raise Exception("Must allow greater than 0 seconds per move")

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Tournament.play refactored with the following changes:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants