Skip to content

Rendu Timothée#29

Open
TimoMet wants to merge 5 commits intobcalou:mainfrom
TimoMet:main
Open

Rendu Timothée#29
TimoMet wants to merge 5 commits intobcalou:mainfrom
TimoMet:main

Conversation

@TimoMet
Copy link
Copy Markdown

@TimoMet TimoMet commented Nov 15, 2023

No description provided.

@TimoMet TimoMet changed the title Rendu Rendu Timothée Nov 15, 2023
@The17thDoctor
Copy link
Copy Markdown

J'aime bien

@TimoMet TimoMet marked this pull request as draft November 15, 2023 14:34
@TimoMet TimoMet marked this pull request as ready for review November 15, 2023 14:35
@TimoMet TimoMet marked this pull request as draft November 15, 2023 14:36
@TimoMet TimoMet marked this pull request as ready for review November 15, 2023 14:36
Copy link
Copy Markdown
Owner

@bcalou bcalou left a comment

Choose a reason for hiding this comment

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

Bien, pas de problème majeur à part le fichier main

Comment on lines 4 to +10
def main() -> None:
print("Hello world")
user_input = input("Please enter a date in the format YYYY-MM-dd: ")

if is_valid_date(user_input):
print("The date is valid.")
else:
print("Error: The date is not valid.")
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

L'éxécution du fichier principal doit afficher le jour correspondant à la date, pas seulement la validité de la date

Comment on lines +1 to +9
days: list[str] = [
'Sunday',
'Monday',
'Tuesday',
'Wednesday',
'Thursday',
'Friday',
'Saturday'
]
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Conseil : utiliser un tuple (immutable) et DAYS en majuscule (constante)

doomsday/date.py Outdated
from datetime import datetime


def is_valid_date(date_str) -> bool:
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Typage des paramètres

"""
Returns the weekday for the given date in the format YYYY-MM-dd.
"""
year, month, day = (int(i) for i in date.split('-'))
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Bien !

return year % 400 == 0 or (year % 100 != 0 and year % 4 == 0)


def get_anchor_year(year):
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Typage

Comment on lines +47 to +50
difference_multiple_of_7: int = century_year % 7
# multiple of 7 equals or greater than century year
if difference_multiple_of_7 != 0:
difference_multiple_of_7 = 7 - difference_multiple_of_7
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Peut être simplifié


def get_anchor_year(year):
"""Calculates the anchor day index for the given year."""
century_year: int = year % 100
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Quel rapport ici avec le siècle ? (nommage de la variable trompeur)

"""
year, month, day = (int(i) for i in date.split('-'))

anchor_day_index = get_anchor_year(year)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Attention aux termes précis. Le nom de la fonction donne l'impression que c'est une année que l'on va récupérer

Comment on lines +26 to +27
difference = day - doomsday_month[month - 1]
weekday_index = (anchor_day_index + difference) % 7
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Pas simple à comprendre sans commentaire

@bcalou
Copy link
Copy Markdown
Owner

bcalou commented Nov 24, 2023

Quelques erreurs de formattage pycodestyle.
Code fonctionnel et bien structuré par ailleurs.

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.

3 participants