|
1 | 1 | """
|
2 | 2 | Local copy of the On-Line Encyclopedia of Integer Sequences
|
3 | 3 |
|
4 |
| -The `SloaneEncyclopedia` object provides access to a local copy of the database |
| 4 | +The ``SloaneEncyclopedia`` object provides access to a local copy of the database |
5 | 5 | containing only the sequences and their names. To use this, you must download
|
6 | 6 | and install the database using ``SloaneEncyclopedia.install()``, or
|
7 | 7 | ``SloaneEncyclopedia.install_from_gz()`` if you have already downloaded the
|
|
11 | 11 |
|
12 | 12 | ::
|
13 | 13 |
|
14 |
| - sage: SloaneEncyclopedia[60843] # optional - sloane_database |
| 14 | + sage: SloaneEncyclopedia[60843] # optional - sloane_database |
15 | 15 | [1, 6, 21, 107]
|
16 | 16 |
|
17 | 17 | To get the name of a sequence, type
|
18 | 18 |
|
19 | 19 | ::
|
20 | 20 |
|
21 |
| - sage: SloaneEncyclopedia.sequence_name(1) # optional - sloane_database |
| 21 | + sage: SloaneEncyclopedia.sequence_name(1) # optional - sloane_database |
22 | 22 | 'Number of groups of order n.'
|
23 | 23 |
|
24 | 24 | To search locally for a particular subsequence, type
|
|
33 | 33 |
|
34 | 34 | ::
|
35 | 35 |
|
36 |
| - sage: SloaneEncyclopedia.find([1,2,3,4,5], 100) # optional - sloane_database |
| 36 | + sage: SloaneEncyclopedia.find([1,2,3,4,5], 100) # optional - sloane_database |
37 | 37 | [(15, [1, 2, 3, 4, 5, 7, 7, 8, 9, 11, 11, ...
|
38 | 38 |
|
39 | 39 | Results in either case are of the form [ (number, list) ].
|
@@ -263,7 +263,8 @@ def load(self):
|
263 | 263 | try:
|
264 | 264 | file_seq = bz2.BZ2File(self.__file__, 'r')
|
265 | 265 | except IOError:
|
266 |
| - raise IOError("The Sloane Encyclopedia database must be installed. Use e.g. 'SloaneEncyclopedia.install()' to download and install it.") |
| 266 | + raise IOError("The Sloane Encyclopedia database must be installed." |
| 267 | + " Use e.g. 'SloaneEncyclopedia.install()' to download and install it.") |
267 | 268 |
|
268 | 269 | self.__data__ = {}
|
269 | 270 |
|
@@ -293,7 +294,8 @@ def load(self):
|
293 | 294 | self.__loaded_names__ = True
|
294 | 295 | except KeyError:
|
295 | 296 | # Some sequence in the names file is not in the database
|
296 |
| - raise KeyError("Sloane OEIS sequence and name files do not match. Try reinstalling, e.g. SloaneEncyclopedia.install(overwrite=True).") |
| 297 | + raise KeyError("Sloane OEIS sequence and name files do not match." |
| 298 | + " Try reinstalling, e.g. SloaneEncyclopedia.install(overwrite=True).") |
297 | 299 | except IOError:
|
298 | 300 | # The names database is not installed
|
299 | 301 | self.__loaded_names__ = False
|
@@ -321,7 +323,8 @@ def sequence_name(self, N):
|
321 | 323 | """
|
322 | 324 | self.load()
|
323 | 325 | if not self.__loaded_names__:
|
324 |
| - raise IOError("The Sloane OEIS names file is not installed. Try reinstalling, e.g. SloaneEncyclopedia.install(overwrite=True).") |
| 326 | + raise IOError("The Sloane OEIS names file is not installed." |
| 327 | + " Try reinstalling, e.g. SloaneEncyclopedia.install(overwrite=True).") |
325 | 328 |
|
326 | 329 | if N not in self.__data__: # sequence N does not exist
|
327 | 330 | return ''
|
|
0 commit comments