Skip to content

Sourcery refactored master branch#1

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

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

Conversation

@sourcery-ai
Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot commented Feb 19, 2020

Branch master refactored by Sourcery.

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

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

  git fetch origin master-sourcery
  git cherry-pick FETCH_HEAD
  git reset HEAD^

See our documentation for configuring or disabling Sourcery.

@sourcery-ai sourcery-ai Bot force-pushed the master-sourcery branch 2 times, most recently from e5ff2ce to d020a29 Compare February 20, 2020 17:31
@sourcery-ai sourcery-ai Bot changed the title Sourcery refactor of whole repo - master branch Sourcery refactored master branch Feb 20, 2020
@sourcery-ai sourcery-ai Bot force-pushed the master-sourcery branch 3 times, most recently from 112b4ed to 9e56be5 Compare February 25, 2020 15:36
@sourcery-ai sourcery-ai Bot force-pushed the master-sourcery branch from 9e56be5 to a17e0cd Compare March 16, 2020 10:56
Copy link
Copy Markdown
Author

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Sourcery recommends the following changes

@sourcery-ai sourcery-ai Bot force-pushed the master-sourcery branch from a17e0cd to 92a5859 Compare March 19, 2020 20:18
Comment thread consts.py
@@ -50,10 +50,7 @@
DISK_FOUR_COUNTS = np.zeros([HEIGHT, WIDTH], int)
for row in range(HEIGHT):
for column in range(WIDTH):
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Lines 53-56 refactored with the following changes:

  • Convert for loop into list comprehension

Comment thread network.py
@@ -106,10 +106,10 @@ def variables(self):
self.scope + '/')

def assign(self, other):
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function BaseNetwork.assign refactored with the following changes:

  • Convert for loop into list comprehension
  • Inline variable that is only used once

Comment thread policy_training.py
@@ -141,8 +141,7 @@ def train_games(self, opponent, games):

def process_results(self, opponent, games, step, summary):
win_rate = np.mean([game.policy_player_score for game in games])
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function PolicyTraining.process_results refactored with the following changes:

  • Replace unneeded comprehension with generator

Comment thread policy_training.py
@@ -263,10 +262,7 @@ def move(self, move, policy_player_turn=False):
self.positions.append(self.position)
if self.position.gameover():
self.result = self.position.result
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function Game.move refactored with the following changes:

  • Replace if statement with if expression

Comment thread util.py
@@ -10,7 +10,7 @@ def find_previous_run(dir):
if os.path.isdir(dir):
runs = [child[4:] for child in os.listdir(dir) if child[:4] == 'run_']
if runs:
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function run_directory.find_previous_run refactored with the following changes:

  • Replace unneeded comprehension with generator

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.

1 participant