Skip to content
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 Starbot ⭐ refactored NicolasFlandrois/Stardate #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

SourceryAI
Copy link

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/Stardate main
git merge --ff-only FETCH_HEAD
git reset HEAD^

Comment on lines -24 to -35
def ask_integer(message: str, range, error_message: str = ""):
def ask_integer(self, range, error_message: str = ""):
"""
This function's purpose is to ask and verify an Integer.
"""
var = None
while True:
try:
var = int(input(message))
var = int(input(self))
if var in range:
return var
raise

Copy link
Author

Choose a reason for hiding this comment

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

Function Compute.ask_integer refactored with the following changes:

Comment on lines -42 to +47
def leapyr(year: int):
def leapyr(self):
""""
This function defines if the year is
a Leap year (366 days)
or a Normal year (365 days).
Then it will to the variable n the value of 366 or 365, accordingly.
"""
if year % 400 == 0 or (year % 4 == 0 and year % 100 != 0):
n = 366
# print("The year is a Leap year.\n")

else:
n = 365
# print("The year is a normal year.\n")

return n
return 366 if self % 400 == 0 or self % 4 == 0 and self % 100 != 0 else 365
Copy link
Author

Choose a reason for hiding this comment

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

Function Compute.leapyr refactored with the following changes:

This removes the following comments ( why? ):

# print("The year is a Leap year.\n")
# print("The year is a normal year.\n")

Comment on lines -64 to +54
def sdconvert(t):
def sdconvert(self):
Copy link
Author

Choose a reason for hiding this comment

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

Function Compute.sdconvert refactored with the following changes:

Comment on lines -78 to +80
def sdtranslate(sd):
def sdtranslate(self):
Copy link
Author

Choose a reason for hiding this comment

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

Function Compute.sdtranslate refactored with the following changes:

def menu(convert, translate):
def menu(self, translate):
Copy link
Author

Choose a reason for hiding this comment

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

Function View.menu refactored with the following changes:

Comment on lines -73 to +76
dlist = []
dlist.append(Compute.ask_integer("Earth Year? (YYYY format) ",
range(-10000000, 10000000)))
dlist = [
Compute.ask_integer(
"Earth Year? (YYYY format) ", range(-10000000, 10000000)
)
]
Copy link
Author

Choose a reason for hiding this comment

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

Function View.ask_date refactored with the following changes:

Comment on lines -101 to +106
def show_date(earthdate):
def show_date(self):
"""
Displays a date object, in a User Experience readable format.
"""
return earthdate()[1]
return self()[1]
Copy link
Author

Choose a reason for hiding this comment

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

Function View.show_date refactored with the following changes:

Comment on lines -107 to +113
def show_stardate(stardate, date):
def show_stardate(self, date):
"""
Displays Date's Stardate.
"""
print("Earthdate : ", date)
print("\nStardate : ", stardate)
print("\nStardate : ", self)
Copy link
Author

Choose a reason for hiding this comment

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

Function View.show_stardate 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.

1 participant