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

Update __process_response to Set next_url as None for Absent Values in atlas_probes.py #97

Conversation

mohamedawnallah
Copy link
Member

Description

In atlas_probes.py, update __process_response to set next_url as None instead of an empty string (str()) to better indicate the absence of a next_url value in the crawler pipeline.

Motivation and Context

This change aligns with Python conventions by using None to signify the lack of a value. It improves readability and maintains compatibility since both None and an empty string evaluate to False.

How Has This Been Tested?

The script atlas_probes.py was run to ensure seamless functionality after the modification. Testing confirmed the script operates without issues with this update.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

…d in `atlas_probes.py` crawler pipeline.
@mohamedawnallah mohamedawnallah force-pushed the make-next_url-None-instead-of-str()-if-no-urls branch from 8286682 to 49bc6aa Compare December 21, 2023 01:53
@m-appel
Copy link
Member

m-appel commented Dec 21, 2023

This is a bit of a philosophical discussion about what is better. Is there like a PEP or something that recommends the use of None? Personally, I like to keep return variables with the same type, although I can understand the argument that absence of a value should be None... I'm just saying this since this pattern will appear a lot on this codebase :)

If you want to assign None, we can also just delete the next_url = line entirely, since next_url = data['next'] will be None already.

@mohamedawnallah
Copy link
Member Author

@m-appel, as far as I know, PEP 8 doesn't insist on using None for absent values. I might be biased as I used it frequently before. Let's stick with the convention established in the codebase 👍.

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