-
Notifications
You must be signed in to change notification settings - Fork 1
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 #3
base: master
Are you sure you want to change the base?
Conversation
d42e6c6
to
e401778
Compare
copy_ops = [] | ||
for self_var, other_var in zip(self.variables, other.variables): | ||
copy_ops.append(tf.assign(other_var, self_var)) | ||
return copy_ops | ||
return [ | ||
tf.assign(other_var, self_var) | ||
for self_var, other_var in zip(self.variables, other.variables) | ||
] |
There was a problem hiding this comment.
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 (
list-comprehension
) - Inline variable that is immediately returned (
inline-immediately-returned-variable
)
average_moves = sum([len(game.moves) | ||
for game in games]) / self.config.batch_size | ||
average_moves = sum(len(game.moves) for game in games) / self.config.batch_size |
There was a problem hiding this comment.
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 (
comprehension-to-generator
)
if self.result: | ||
self.policy_player_score = float(policy_player_turn) | ||
else: | ||
self.policy_player_score = 0.5 | ||
self.policy_player_score = float(policy_player_turn) if self.result else 0.5 |
There was a problem hiding this comment.
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 (
assign-if-exp
)
return max([int(run) for run in runs]) | ||
return max(int(run) for run in runs) |
There was a problem hiding this comment.
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 (
comprehension-to-generator
)
Sourcery Code Quality Report (beta)✅ Merging this PR will increase code quality in the affected files by 0.01 out of 10.
Here are some functions in these files that still need a tune-up:
Please see our documentation here for details on how these metrics are calculated. We are actively working on this report - lots more documentation and extra metrics to come! Let us know what you think of it by mentioning @sourcery-ai in a comment. |
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: