Skip to content

2022 (Sourcery refactored)#161

Closed
sourcery-ai[bot] wants to merge 1 commit into
2022from
sourcery/2022
Closed

2022 (Sourcery refactored)#161
sourcery-ai[bot] wants to merge 1 commit into
2022from
sourcery/2022

Conversation

@sourcery-ai

@sourcery-ai sourcery-ai Bot commented Dec 9, 2022

Copy link
Copy Markdown
Contributor

Pull Request #160 refactored by Sourcery.

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

NOTE: As code is pushed to the original Pull Request, Sourcery will
re-run and update (force-push) this Pull Request with new refactorings as
necessary. If Sourcery finds no refactorings at any point, this Pull Request
will be closed automatically.

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 2022 branch, then run:

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

Help us improve this pull request!

@sourcery-ai
sourcery-ai Bot requested a review from Stegallo December 9, 2022 12:39
Comment thread y_2022/day8.py
Comment on lines -24 to +38
# visible from Top
visible_Top = True
for j in range(0, i[0]):
if self.__grid[(j, i[1])] >= self.__grid[(i)]:
visible_Top = False

# visible from Left
visible_Left = True
for j in range(0, i[1]):
if self.__grid[(i[0], j)] >= self.__grid[(i)]:
visible_Left = False

# visible from Bottom
visible_Bottom = True
for j in range(i[0] + 1, self.max_h):
if self.__grid[(j, i[1])] >= self.__grid[(i)]:
visible_Bottom = False

# visible from Right
visible_Right = True
for j in range(i[1] + 1, self.max_w):
if self.__grid[(i[0], j)] >= self.__grid[(i)]:
visible_Right = False

is_visible = visible_Top or visible_Left or visible_Bottom or visible_Right
return is_visible
visible_Top = all(
self.__grid[(j, i[1])] < self.__grid[(i)] for j in range(i[0])
)
visible_Left = all(
self.__grid[(i[0], j)] < self.__grid[(i)] for j in range(i[1])
)
visible_Bottom = all(
self.__grid[(j, i[1])] < self.__grid[(i)]
for j in range(i[0] + 1, self.max_h)
)
visible_Right = all(
self.__grid[(i[0], j)] < self.__grid[(i)]
for j in range(i[1] + 1, self.max_w)
)
return visible_Top or visible_Left or visible_Bottom or visible_Right

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Function Day.is_visible refactored with the following changes:

This removes the following comments ( why? ):

# visible from Left
# visible from Bottom
# visible from Right
# visible from Top

Comment thread y_2022/day8.py
Comment on lines -88 to +77
t = 0
for i in self.__grid:
if self.is_visible(i):
t += 1
return t
return sum(bool(self.is_visible(i)) for i in self.__grid)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Function Day._calculate_1 refactored with the following changes:

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

Base: 92.15% // Head: 92.09% // Decreases project coverage by -0.06% ⚠️

Coverage data is based on head (b50945a) compared to base (be793c1).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             2022     #161      +/-   ##
==========================================
- Coverage   92.15%   92.09%   -0.07%     
==========================================
  Files          55       55              
  Lines        2066     2049      -17     
==========================================
- Hits         1904     1887      -17     
  Misses        162      162              
Impacted Files Coverage Δ
y_2022/day8.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@Stegallo Stegallo closed this Nov 3, 2023
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.

2 participants