-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Result #2329
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
base: master
Are you sure you want to change the base?
Result #2329
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Summary
Great job on implementing the core functionality, as the Person class and spouse-linking logic work correctly. However, this submission requires changes to meet specific project guidelines. Please refactor your code to use a list comprehension for creating Person instances instead of a for loop [CHECKLIST ITEM #3]. Additionally, when checking for spouse data, you must use the dict.get() method for both 'wife' and 'husband' keys instead of checking for key existence with in [CHECKLIST ITEM #4]. These changes are important for adhering to the required implementation patterns.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Important
Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.
Tip
If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.
Caution
Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.
Footnotes
app/main.py
Outdated
| for person_data in people: | ||
| Person(person_data["name"], person_data["age"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This violates checklist item #3: 'When creating a list of instances from a collection (such as a list of dictionaries), it is recommended to use list comprehension rather than traditional for loops.' The Person instances should be created using a list comprehension.
app/main.py
Outdated
| for person_data in people: | ||
| person_obj = Person.people[person_data["name"]] | ||
|
|
||
| if "wife" in person_data and person_data["wife"] is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This violates checklist item #4: 'When accessing values in a dictionary, it is better to use the dict.get() method instead of explicitly checking for the presence of a key.' This condition can be simplified by using person_data.get('wife').
app/main.py
Outdated
| wife_obj = Person.people[wife_name] | ||
| person_obj.wife = wife_obj | ||
|
|
||
| if "husband" in person_data and person_data["husband"] is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This violates checklist item #4: 'When accessing values in a dictionary, it is better to use the dict.get() method...'. Similar to the check for 'wife', you should use the .get() method to check for a husband.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, the pull request review was unsuccessful for the following reasons:
Warning
No changes were made in the pull request since the last review. Please make sure that you have added files to the pull request and committed the changes.
[CODE: NCM]
If the issue is within your control, please address it.
The next review attempt will automatically launch in about 1 hour.
If you believe this is an error or need assistance, please contact the support team.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Summary
Thanks for the update. The core logic for creating Person instances and linking them is correct. However, this submission requires changes because the specific implementation requirements from the previous review have not yet been applied.
Please address the following two checklist items:
- The
forloop used to create the initial list ofPersoninstances must be refactored into a list comprehension. [CHECKLIST ITEM #3] - When checking for a spouse, you must use the
dict.get()method (e.g.,person_data.get("wife")) instead of checking for key existence withif "wife" in person_data. [CHECKLIST ITEM #4]
Once these requirements are met, your solution will be ready for approval.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Important
Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.
Tip
If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.
Caution
Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.
Footnotes
app/main.py
Outdated
| for person_data in people: | ||
| Person(person_data["name"], person_data["age"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This violates checklist item #3: 'When creating a list of instances from a collection (such as a list of dictionaries), it is recommended to use list comprehension rather than traditional for loops.' Please refactor this loop into a list comprehension to create the Person instances.
app/main.py
Outdated
| for person_data in people: | ||
| person_obj = Person.people[person_data["name"]] | ||
|
|
||
| if "wife" in person_data and person_data["wife"] is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This violates checklist item #4: 'When accessing values in a dictionary, it is better to use the dict.get() method instead of explicitly checking for the presence of a key.' This check should be updated to use person_data.get("wife").
app/main.py
Outdated
| wife_obj = Person.people[wife_name] | ||
| person_obj.wife = wife_obj | ||
|
|
||
| if "husband" in person_data and person_data["husband"] is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to the check for a wife, this violates checklist item #4. Please use person_data.get("husband") to check for this key.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Summary
Excellent work on this update! I'm happy to approve your solution. You've done a fantastic job of refactoring the code to incorporate the feedback from the last review. Using a list comprehension to create the Person instances and dict.get() to safely handle the spouse attributes makes the code much cleaner and more robust. The implementation now perfectly meets all the requirements. Well done!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
No description provided.