Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
src/sage/databases/conway.py: update for conway-polynomials-0.7
  • Loading branch information
orlitzky committed Nov 24, 2023
commit 90decf7b49ee48c1dc2247cdd6e0021d5c121e38
22 changes: 7 additions & 15 deletions src/sage/databases/conway.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
r"""
Frank Luebeck's tables of Conway polynomials over finite fields
Frank Lübeck's tables of Conway polynomials over finite fields
"""
# ****************************************************************************
#
Expand All @@ -15,13 +15,9 @@
# https://www.gnu.org/licenses/
# ****************************************************************************
from collections.abc import Mapping
import pickle

from sage.features.databases import DatabaseConwayPolynomials

_conwaydict = None


class DictInMapping(Mapping):
def __init__(self, dict):
"""
Expand Down Expand Up @@ -95,14 +91,10 @@ def __init__(self):

sage: c = ConwayPolynomials()
sage: c
Frank Luebeck's database of Conway polynomials
Frank Lübeck's database of Conway polynomials
"""
global _conwaydict
if _conwaydict is None:
_CONWAYDATA = DatabaseConwayPolynomials().absolute_filename()
with open(_CONWAYDATA, 'rb') as f:
_conwaydict = pickle.load(f)
self._store = _conwaydict
import conway_polynomials
self._store = conway_polynomials.database()

def __repr__(self):
"""
Expand All @@ -112,9 +104,9 @@ def __repr__(self):

sage: c = ConwayPolynomials()
sage: c.__repr__()
"Frank Luebeck's database of Conway polynomials"
"Frank Lübeck's database of Conway polynomials"
"""
return "Frank Luebeck's database of Conway polynomials"
return "Frank Lübeck's database of Conway polynomials"

def __getitem__(self, key):
"""
Expand Down Expand Up @@ -152,7 +144,7 @@ def __len__(self):

sage: c = ConwayPolynomials()
sage: len(c)
35352
35357
"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh? What happened there?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was asking myself the same question.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inflation.

The old package came with preprocessed data that would have been harder to diff against the upstream list for changes. I think it was just a tiny bit out-of-date. Here's the diff:

103a104
> [2,110,[1,1,1,0,0,0,1,0,0,0,1,1,0,1,1,0,0,1,0,0,1,0,0,0,0,1,1,0,1,1,0,0,0,1,0,1,1,1,0,1,0,0,1,1,0,0,0,0,1,0,0,0,0,0,1,1,1,1,1,1,0,0,1,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1]],
219a221
> [3,52,[2,0,1,1,1,2,0,1,2,0,0,0,1,0,2,0,2,2,2,1,2,0,2,1,0,0,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1]],
222a225,226
> [3,56,[2,2,0,0,0,1,0,2,0,0,0,0,2,1,1,0,0,1,2,2,2,2,0,2,2,1,2,2,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1]],
> [3,57,[1,1,2,2,2,2,1,0,1,1,0,2,1,0,2,2,2,1,0,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1]],
229a234
> [3,72,[2,2,0,2,1,1,1,2,1,0,2,1,2,1,0,1,0,2,1,1,0,2,1,2,1,2,0,2,0,1,1,1,2,2,1,0,2,2,1,1,0,0,1,2,0,1,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1]],

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Does upstream update the list "often"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea. There's no change history on the site, but the new package ships the upstream file unmodified so at least we can git diff it in the future.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shipping upstream file unmodified sounds very good to me. I think it is ready.

try:
return self._len
Expand Down