X Tutup
Skip to content

Sourcery refactored main branch#1

Open
sourcery-ai[bot] wants to merge 1 commit intomainfrom
sourcery/main
Open

Sourcery refactored main branch#1
sourcery-ai[bot] wants to merge 1 commit intomainfrom
sourcery/main

Conversation

@sourcery-ai
Copy link
Copy Markdown

@sourcery-ai sourcery-ai bot commented Apr 23, 2023

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

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

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from edson-github April 23, 2023 08:37
Comment on lines -11 to +16
fptr = open(os.environ['OUTPUT_PATH'], 'w')
with open(os.environ['OUTPUT_PATH'], 'w') as fptr:
s = input()

s = input()
result = solve(s)

result = solve(s)

fptr.write(result + '\n')

fptr.close()
fptr.write(result + '\n')
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 11-19 refactored with the following changes:

if string[i:].startswith(sub_string):
count += 1
return count
return sum(bool(string[i:].startswith(sub_string)) for i in range(len(string)))
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 count_substring refactored with the following changes:

# sort
arr.sort()

arr = sorted(dict.fromkeys(arr))
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 8-12 refactored with the following changes:

This removes the following comments ( why? ):

# sort
# remove duplicates

Comment on lines -4 to +6
scores_stats = []

for _ in range(0,int(input())):
scores_stats.append([input(), float(input())])

scores_stats = [[input(), float(input())] for _ in range(int(input()))]
# Make a unique list of score, sort it and get the lowest second score
second_lowest = sorted(list(set([score for name, score in scores_stats])))[1]
second_lowest = sorted(list({score for name, score in scores_stats}))[1]
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 4-10 refactored with the following changes:


for mushroom in mushrooms:
i += 1
for i, mushroom in enumerate(mushrooms, start=1):
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 before_refactor refactored with the following changes:

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.

0 participants

X Tutup