Skip to content

Commit

Permalink
Trac #26046: py3: fixing oeis
Browse files Browse the repository at this point in the history
URL: https://trac.sagemath.org/26046
Reported by: chapoton
Ticket author(s): Frédéric Chapoton
Reviewer(s): Travis Scrimshaw
  • Loading branch information
Release Manager authored and vbraun committed Aug 25, 2018
2 parents 72a244e + bf817f4 commit 50c5e77
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/sage/databases/oeis.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def _urls(html_string):
"""
urls = []
from HTMLParser import HTMLParser
from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):
def handle_starttag(self, tag, attrs):
Expand Down Expand Up @@ -369,7 +369,7 @@ def __call__(self, query, max_results=3, first_result=0):
sage: oeis()
Traceback (most recent call last):
...
TypeError: __call__() takes at least 2 arguments (1 given)
TypeError: __call__() ...
"""
if isinstance(query, str):
if re.match('^A[0-9]{6}$', query):
Expand Down Expand Up @@ -662,7 +662,7 @@ def __init__(self, entry):
self._fields = defaultdict(list)
for line in entry.splitlines():
self._fields[line[1]].append(line[11:])
if 'dead' in self.keywords():
if 'dead' in self.keywords():
from warnings import warn
warn('This sequence is dead: "{}: {}"'.format(self.id(), self.name()), RuntimeWarning)

Expand Down Expand Up @@ -1795,8 +1795,8 @@ class FancyTuple(tuple):
"""
def __repr__(self):
r"""
Prints the tuple with one value per line, each line begins with the
index of the value in ``self``.
Print the tuple with one value per line, where each line
begins with the index of the value in ``self``.
EXAMPLES::
Expand All @@ -1814,15 +1814,15 @@ def __repr__(self):
def __getslice__(self, i, j):
r"""
The slice of a FancyTuple remains a FancyTuple.
EXAMPLES::
sage: from sage.databases.oeis import FancyTuple
sage: t = FancyTuple(['zero', 'one', 'two', 'three', 4])
sage: t[-2:]
0: three
1: 4
TESTS::
sage: t = ('é', 'è', 'à', 'ç')
Expand All @@ -1834,4 +1834,5 @@ def __getslice__(self, i, j):
"""
return FancyTuple(tuple(self).__getslice__(i, j))


oeis = OEIS()

0 comments on commit 50c5e77

Please sign in to comment.