-
Notifications
You must be signed in to change notification settings - Fork 129
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
Linting #255
Linting #255
Conversation
2 similar comments
Codecov Report
@@ Coverage Diff @@
## master #255 +/- ##
==========================================
+ Coverage 79.49% 80.29% +0.79%
==========================================
Files 28 28
Lines 3468 3466 -2
Branches 651 651
==========================================
+ Hits 2757 2783 +26
+ Misses 526 493 -33
- Partials 185 190 +5
Continue to review full report at Codecov.
|
This looks OK to me, I have a few... 'meh... why?' moments, but nothing that I'm like 'nonononono'. |
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.
Looks good to me. Thank you for another great contribution!
@@ -44,42 +44,45 @@ def _assert_img_equal(self, blessed_image_name, drawn_image): | |||
"and/or amount of channels. Blessed %s, drawn %s" | |||
% (str(blessed_img.array.shape), str(drawn_image.array.shape))) | |||
|
|||
# compare images; cmp_array will be an array of booleans in case of equal shapes (and a pure boolean otherwise) | |||
# compare images; |
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.
should be ":" instead of ";"?
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.
Sure.
@@ -270,8 +270,9 @@ class TropicalRainForest(Biome, Jungle): | |||
|
|||
def biome_name_to_index(biome_name): | |||
names = sorted(_BiomeMetaclass.biomes.keys()) | |||
for i in range(len(names)): | |||
if names[i] == biome_name: | |||
|
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.
maybe we do not need this new extra line
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.
Sure.
@@ -426,7 +431,7 @@ def draw_satellite(world, target): | |||
all_b.append(b) | |||
|
|||
# Making sure there is at least one valid tile to be smoothed before we attempt to average the values | |||
if len(all_r) > 0: | |||
if all_r: |
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.
are these equivalent?
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.
hmm, maybe not cf. https://stackoverflow.com/questions/43121340
# depending on the distance from the next land | ||
# possible TODO: make this a parameter | ||
factors = [0.0, 0.3, 0.5, 0.7, 0.9] | ||
|
||
next_land = next_land_dynamic(world.layers['ocean'].data) | ||
|
||
sea_depth = sea_level - world.layers['elevation'].data | ||
result = sea_level - world.layers['elevation'].data |
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.
I do not like the name result much here
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.
sea_depth is the name of the function and pylint rightfully complains that this redefines a name from the outer scope. Personally I use result
a lot as a variable name, but I'm open to anything that is not sea_depth
. Alternatively the function needs a new name.
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.
depth_of_sea (in the very french way of saying sea_depth)
|
||
# Humidity | ||
if len(p_world.humidity.rows) > 0: | ||
if p_world.humidity.rows: |
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.
is this equivalent?
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.
cf. above
"This looks OK to me, I have a few... 'meh... why?' moments, but nothing that I'm like 'nonononono'." The answer to "why?" is almost certainly "because pylint said so" and in most cases likely "because the line was too long". I'm agnostic about all of this as witnessed by the three "whitespace" commits at the end of every of my PRs :) |
I usually set my columns to 120 (from 80) and adjust linting accordingly... |
Me too, I use 120 columns and that settings is suggested here (arguably very difficult to find) |
Some improvements to the looks of the code.