Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sourcery refactored master branch #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

sourcery-ai[bot]
Copy link

@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
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
@@ -50,10 +50,7 @@
DISK_FOUR_COUNTS = np.zeros([HEIGHT, WIDTH], int)
for row in range(HEIGHT):
for column in range(WIDTH):
Copy link
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

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

def assign(self, other):
Copy link
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

@@ -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
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

@@ -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
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

@@ -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
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