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

Cannot detect whether a sequence from the oeis is dead without warning #36795

Closed
2 tasks done
mantepse opened this issue Dec 1, 2023 · 0 comments · Fixed by #36811
Closed
2 tasks done

Cannot detect whether a sequence from the oeis is dead without warning #36795

mantepse opened this issue Dec 1, 2023 · 0 comments · Fixed by #36811

Comments

@mantepse
Copy link
Collaborator

mantepse commented Dec 1, 2023

Steps To Reproduce

In a fresh session,

sage: s = oeis(17)
sage: s.is_dead()
/home/martin/sage/src/sage/databases/oeis.py:1153: RuntimeWarning: This sequence is dead: "A000017: Erroneous version of A032522."
  warn('This sequence is dead: "{}: {}"'.format(self.id(), self.name()), RuntimeWarning)
True

Expected Behavior

It should just return the result, without triggering the warning.

Actual Behavior

A warning is triggered, which is annoying when processing many sequences.

Additional Information

The reason is that OEISSequence._field issues a warning when the sequence is dead, and this cannot be bypassed.

I see two possible solutions:

  • have a keyword warn for _field(self, warn=True) and, in is_dead, do "dead" in self._field('K', warn=False)[0].
  • check the raw_entry in is_dead directly, e.g., ["dead" in l[11:] for l in s.raw_entry().splitlines() if l[1] == "K"]

Environment

irrelevant.

Checklist

  • I have searched the existing issues for a bug report that matches the one I want to file, without success.
  • I have read the documentation and troubleshoot guide
vbraun pushed a commit to vbraun/sage that referenced this issue Dec 24, 2023
…function

    
Fixes sagemath#36795
fixed warning in OEISSequence.is_dead() function in OEISSequence

added a parameter warn=True in _field function
and changed self.is_dead(warn_only=True) to self.is_dead(warn_only=warn)
inside the _field function,
changed the self._field('K') to self._field('K', warn=False)
so the warning is not triggered
    
URL: sagemath#36811
Reported by: Aman Moon
Reviewer(s): Martin Rubey
vbraun pushed a commit to vbraun/sage that referenced this issue Dec 26, 2023
…function

    
Fixes sagemath#36795
fixed warning in OEISSequence.is_dead() function in OEISSequence

added a parameter warn=True in _field function
and changed self.is_dead(warn_only=True) to self.is_dead(warn_only=warn)
inside the _field function,
changed the self._field('K') to self._field('K', warn=False)
so the warning is not triggered
    
URL: sagemath#36811
Reported by: Aman Moon
Reviewer(s): Martin Rubey
@mkoeppe mkoeppe added this to the sage-10.3 milestone Dec 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants