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

Solution #1629

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Solution #1629

wants to merge 2 commits into from

Conversation

sessd
Copy link

@sessd sessd commented Dec 10, 2024

No description provided.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Thank you for your hard work on this Pull Request! 😊 While your code meets most of the task requirements, there are a few critical issues that need to be addressed before we can approve it:

  1. Key Handling: The code assumes that keys like wife and husband will always correspond to valid names in the Person.people dictionary. This can lead to KeyError exceptions if the assumption is incorrect. Please ensure that the input data is validated or handle these exceptions appropriately.

  2. Class Variable Usage: The people dictionary is currently defined as a class variable, which means it is shared across all instances of the Person class. If this shared behavior is not intended, consider using an instance variable instead to avoid potential issues.

  3. Variable Naming: The variable name peoples is misleading as it suggests a plural form. Renaming it to something like person_data would better reflect its purpose and improve code readability.

Addressing these issues will enhance the robustness and clarity of your code. Keep up the great work, and I look forward to your revised submission! 🚀

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

🔄 Fix the issues, commit the changes, and then re-request my review using the Re-request review button in the Reviewers tab.

@@ -1,8 +1,21 @@
class Person:
# write your code here
pass
people = {}

Choose a reason for hiding this comment

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

The people dictionary is defined as a class variable. This means it will be shared across all instances of the Person class. If this is not the intended behavior, consider using an instance variable instead.

app/main.py Outdated


def create_person_list(people: list) -> list:
# write your code here
pass
for peoples in people:

Choose a reason for hiding this comment

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

The variable name peoples is misleading as it suggests a plural form. Consider renaming it to person_data or something similar to better reflect its purpose.

app/main.py Outdated
pass
for peoples in people:
Person(peoples["name"], peoples["age"])
for peoples in people:

Choose a reason for hiding this comment

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

Similar to line 11, the variable name peoples is misleading. Consider renaming it to person_data or something similar.

app/main.py Outdated
for peoples in people:
result_people = Person.people[peoples["name"]]
if "wife" in peoples and peoples["wife"] is not None:
result_people.wife = Person.people[peoples["wife"]]

Choose a reason for hiding this comment

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

The code assumes that the wife key in the dictionary corresponds to a valid name in the Person.people dictionary. Ensure that the input data is validated or handle potential KeyError exceptions.

app/main.py Outdated
result_people.wife = Person.people[peoples["wife"]]

if "husband" in peoples and peoples["husband"] is not None:
result_people.husband = Person.people[peoples["husband"]]

Choose a reason for hiding this comment

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

Similar to line 16, ensure that the husband key corresponds to a valid name in the Person.people dictionary to avoid KeyError exceptions.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Great job on making improvements to your code! 🎉 While there are still some critical issues to address, such as handling potential KeyError exceptions for wife and husband keys and considering the use of instance variables instead of class variables for people, your efforts are commendable. The decision to approve is made to help you move forward with your learning journey. Please review the comments and ensure these issues are addressed in future iterations to enhance the robustness and functionality of your code. Keep up the good work and continue learning from these experiences! 💪

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

Comment on lines +15 to +16
if "wife" in result and result["wife"] is not None:
result_people.wife = Person.people[result["wife"]]

Choose a reason for hiding this comment

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

The code assumes that the wife key will always correspond to a valid name in the Person.people dictionary. This can lead to a KeyError if the name is not found. Consider adding a check to ensure the name exists in the dictionary before accessing it.

Comment on lines +19 to +20
if result["husband"] in Person.people:
result_people.husband = Person.people[result["husband"]]

Choose a reason for hiding this comment

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

While there is a check for the husband key in the Person.people dictionary, the code still assumes that the key will always correspond to a valid name. Ensure that the input data is validated or handle potential KeyError exceptions appropriately.

@@ -1,8 +1,22 @@
class Person:
# write your code here
pass
people = {}

Choose a reason for hiding this comment

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

The people dictionary is defined as a class variable, which means it is shared across all instances of the Person class. If this shared behavior is not intended, consider using an instance variable instead to avoid potential issues.

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