Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Sourcery Starbot ⭐ refactored ComputerScientist-01/Advanced-Programming-Practice #16

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

Merged
ComputerScientist-01 merged 1 commit into ComputerScientist-01:main from SourceryAI:main
Jul 8, 2021

Conversation

@SourceryAI
Copy link
Contributor

@SourceryAI SourceryAI commented Jul 8, 2021

Thanks for starring sourcery-ai/sourcery ✨ 🌟 ✨

Here's your pull request refactoring your most popular Python repo.

If you want Sourcery to refactor all your Python repos and incoming pull requests install our bot.

Review changes via command line

To manually merge these changes, make sure you're on the main branch, then run:

git fetch https://github.com/sourcery-ai-bot/Advanced-Programming-Practice main
git merge --ff-only FETCH_HEAD
git reset HEAD^

Comment on lines -3 to +8
tot = 0
print("Enter Marks Obtained in different exams: ")
for i in range(5):
marks.insert(i, input())
#print(marks[i])

for i in range(5):
tot = tot + int(marks[i])
tot = sum(int(marks[i]) for i in range(5))
Copy link
Contributor Author

@SourceryAI SourceryAI Jul 8, 2021

Choose a reason for hiding this comment

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

Lines 3-10 refactored with the following changes:

sum = 0
for digit in str(n):
sum += int(digit)
sum = sum(int(digit) for digit in str(n))
Copy link
Contributor Author

@SourceryAI SourceryAI Jul 8, 2021

Choose a reason for hiding this comment

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

Function sumofDigits refactored with the following changes:

Comment on lines -40 to +47

temp = num;
while(temp):
while(temp):
last_digit = temp % 10;
temp = int(temp / 10);

dec_value += last_digit * base;
base =base* 2;
base *= 2;
Copy link
Contributor Author

@SourceryAI SourceryAI Jul 8, 2021

Choose a reason for hiding this comment

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

Function binaryToDecimal refactored with the following changes:

  • Replace assignment with augmented assignment (aug-assign)

Comment on lines -7 to +9
for x in range(max(num,0)):
print(row)
row=[l+r for l,r in zip(row+y, y+row)]
for _ in range(max(num,0)):
print(row)
row=[l+r for l,r in zip(row+y, y+row)]
Copy link
Contributor Author

@SourceryAI SourceryAI Jul 8, 2021

Choose a reason for hiding this comment

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

Function pascal_triangle refactored with the following changes:

Comment on lines 4 to 17
m = dict()
m = {}
li = ['x','y','z']
s = 11;
for l in li:
val = list()
for i in range(9):
val = []
for _ in range(9):
val.append(s)
s+=1
s =s+1
s +=1
m[l] = val
print(m)
for kin m.keys():
print(m[k][4])
for k, vin m.items():
print(v[4])
Copy link
Contributor Author

@SourceryAI SourceryAI Jul 8, 2021

Choose a reason for hiding this comment

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

Lines 5-17 refactored with the following changes:

Comment on lines -56 to -62
i = 0
for STFORM3 in select:
for i, STFORM3 in enumerate(select):
for j in range(len(STFORM3)):
e = Entry(my_w, width=10, fg='blue')
e.grid(row=i, column=j)
e.insert(END, STFORM3[j])
i = i+1
Copy link
Contributor Author

@SourceryAI SourceryAI Jul 8, 2021

Choose a reason for hiding this comment

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

Function display refactored with the following changes:

cursor.execute("SELECT * FROM user_details")
i=1
for users in cursor:
for i, users in enumerate(cursor, start=1):
Copy link
Contributor Author

@SourceryAI SourceryAI Jul 8, 2021

Choose a reason for hiding this comment

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

Function users_registered refactored with the following changes:

n = random.randint(10,20)
if obj._value+n <= MAX:
for i in range(n):
for _ in range(n):
Copy link
Contributor Author

@SourceryAI SourceryAI Jul 8, 2021

Choose a reason for hiding this comment

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

Function producer_func refactored with the following changes:

n = random.randint(1,20)
if obj._value+n >= 0:
for i in range(n):
for _ in range(n):
Copy link
Contributor Author

@SourceryAI SourceryAI Jul 8, 2021

Choose a reason for hiding this comment

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

Function consumer_func refactored with the following changes:


if __name__ == '__main__':
for i in range(0, 10):
for _ in range(10):
Copy link
Contributor Author

@SourceryAI SourceryAI Jul 8, 2021

Choose a reason for hiding this comment

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

Lines 35-35 refactored with the following changes:

Comment on lines -18 to -19
else:
pass
Copy link
Contributor Author

@SourceryAI SourceryAI Jul 8, 2021

Choose a reason for hiding this comment

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

Lines 18-19 refactored with the following changes:

# We are going to check for both - if one of them - that's expected, means no incoming data, continue as normal
# If we got different error code - something happened
if e.errno !=errno.EAGAINande.errno!=errno.EWOULDBLOCK:
if e.errno notin [errno.EAGAIN, errno.EWOULDBLOCK]:
Copy link
Contributor Author

@SourceryAI SourceryAI Jul 8, 2021

Choose a reason for hiding this comment

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

Lines 79-79 refactored with the following changes:

@ComputerScientist-01 ComputerScientist-01 merged commit 04e2d85 into ComputerScientist-01:main Jul 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /