# Buggy code
def _sample_open(self, values, min_anomaly, max_anomaly):
    # Select a sensible limiting value for non-closed orbits
    # This corresponds to max(r = 3p, r = self.r)
    # We have to wrap nu in [-180, 180) to compare it with the output of
    # the arc cosine, which is in the range [0, 180)
    # Start from -nu_limit
    wrapped_nu = Angle(self.nu).wrap_at(180 * u.deg)
    nu_limit = max(hyp_nu_limit(self.ecc, 3.0), abs(wrapped_nu)).to(u.rad).value

    limits = [
        min_anomaly.to(u.rad).value if min_anomaly is not None else -nu_limit,
        max_anomaly.to(u.rad).value if max_anomaly is not None else nu_limit,
    ] * u.rad  # type: u.Quantity

    # Now we check that none of the provided values
    # is outside of the hyperbolic range
    nu_max = hyp_nu_limit(self.ecc) - 1e-3 * u.rad  # Arbitrary delta
    if not Angle(limits).is_within_bounds(-nu_max, nu_max):
        warn("anomaly outside range, clipping", OrbitSamplingWarning, stacklevel=2)
        limits = limits.clip(-nu_max, nu_max)

    nu_values = np.linspace(*limits, values)
    return nu_values


# Traceback (ModuleNotFoundError)
2021-02-09T22:42:25.5782954Z check run-test: commands[3] | python -m build .
2021-02-09T22:42:28.6022625Z Found existing installation: setuptools 49.2.1
2021-02-09T22:42:28.6436801Z Uninstalling setuptools-49.2.1:
2021-02-09T22:42:28.6526758Z   Successfully uninstalled setuptools-49.2.1
...
2021-02-09T22:42:35.0995738Z Collecting astroquery>=0.3.9
2021-02-09T22:42:35.1074040Z   Downloading astroquery-0.4.1.tar.gz (6.5 MB)
2021-02-09T22:42:35.6701112Z     ERROR: Command errored out with exit status 1:
2021-02-09T22:42:35.6703383Z      command: /tmp/build-env-260ocgnr/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-gcgcam16/astroquery/setup.py'"'"'; __file__='"'"'/tmp/pip-install-gcgcam16/astroquery/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-3h_ptp3t
2021-02-09T22:42:35.6705974Z          cwd: /tmp/pip-install-gcgcam16/astroquery/
2021-02-09T22:42:35.6706521Z     Complete output (3 lines):
2021-02-09T22:42:35.6707238Z     Traceback (most recent call last):
2021-02-09T22:42:35.6707664Z       File "<string>", line 1, in <module>
2021-02-09T22:42:35.6708402Z     ModuleNotFoundError: No module named 'setuptools'

# Fixed code
def _sample_open(self, values, min_anomaly, max_anomaly):
    # Select a sensible limiting value for non-closed orbits
    # This corresponds to max(r = 3p, r = self.r)
    # We have to wrap nu in [-180, 180) to compare it with the output of
    # the arc cosine, which is in the range [0, 180)
    # Start from -nu_limit
    wrapped_nu = Angle(self.nu).wrap_at(180 * u.deg)
    nu_limit = max(hyp_nu_limit(self.ecc, 3.0), abs(wrapped_nu)).to(u.rad).value

    limits = [
        min_anomaly.to(u.rad).value if min_anomaly is not None else -nu_limit,
        max_anomaly.to(u.rad).value if max_anomaly is not None else nu_limit,
    ] * u.rad  # type: u.Quantity

    # Now we check that none of the provided values
    # is outside of the hyperbolic range
    nu_max = hyp_nu_limit(self.ecc) - 1e-3 * u.rad  # Arbitrary delta
    if not Angle(limits).is_within_bounds(-nu_max, nu_max):
        warn("anomaly outside range, clipping", OrbitSamplingWarning, stacklevel=2)
        limits = limits.clip(-nu_max, nu_max)

    nu_values = np.linspace(*limits, values)  # type: ignore
    return nu_values