Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
171 commits
Select commit Hold shift + click to select a range
d3d727a
Add SneakyBox to search boxes
rvisser7 Mar 11, 2026
0bc76de
Add multi-label search to search_wrapper
rvisser7 Mar 11, 2026
823e39e
Add search box for unit signature rank
rvisser7 Mar 15, 2026
3decfe8
First pass at adding code snippet tests to abstract groups
rvisser7 Mar 15, 2026
5792383
Add Oscar to sidebar code languages for abstract groups
rvisser7 Mar 16, 2026
5101877
Small change to unit_signature_rank search box label
rvisser7 Mar 16, 2026
6e9c06c
Add Oscar abstract group code snippets and refactor top code snippet …
rvisser7 Mar 17, 2026
f00304f
Further fixes to abstract group code snippets
rvisser7 Mar 17, 2026
afb06b1
Add more support for sage commands using the gap interface
rvisser7 Mar 17, 2026
8ca508b
Add abstract group code snippet tests for sage and oscar
rvisser7 Mar 18, 2026
14a5d28
Small updates and corrections to groups code snippets
rvisser7 Mar 18, 2026
3f6360c
Update sage and oscar code snippet abstract group tests
rvisser7 Mar 18, 2026
3307e42
More improved group code snippets
rvisser7 Mar 18, 2026
8264e61
Add GAP snippet test command
havarddj Mar 18, 2026
d6e728b
Refactor construction of Lie snippet code, and add more Oscar and sag…
rvisser7 Mar 19, 2026
f64f7d6
Add code snippets for transitive groups, and various refactoring
rvisser7 Mar 20, 2026
e91f604
Bug fixes for transitive group code snippets
rvisser7 Mar 20, 2026
b133c2c
Add Gap code snippets for Galois groups, and small bug fix to Chevall…
rvisser7 Mar 20, 2026
ac794e8
Add new log snippet test files for abstract groups
rvisser7 Mar 20, 2026
a847735
Various bug fixes, fixed Oscar matrix code and Lie rep code
rvisser7 Mar 21, 2026
562d7b2
Various further bug fixes and updates to groups code snippets
rvisser7 Mar 21, 2026
fe0dbd4
Some final bug fixes and cleanup
rvisser7 Mar 21, 2026
f5c6028
Merge branch 'main' into abstract_groups
rvisser7 Mar 21, 2026
b7f2bb1
Add some more Lie type supported families for Oscar and Sage
rvisser7 Mar 21, 2026
9492e88
Merge branch 'main' into abstract_groups
rvisser7 Mar 22, 2026
b32a23a
adding test for the trace hash
assaferan Mar 27, 2026
911ce93
adding test for the trace hash
assaferan Mar 27, 2026
dcba1b2
Change warning to info in character code to avoid polluting the flasklog
roed314 Mar 30, 2026
0281342
Merge pull request #6938 from rvisser7/unit_signature_rank
jwj61 Mar 30, 2026
593bf78
Add link to beta in timeout message
roed314 Apr 1, 2026
760831d
Remove print
roed314 Apr 1, 2026
e9f36a3
Use netloc rather than BETA
roed314 Apr 1, 2026
f42eb24
Fix issue #6951. Adds transitivity to Galois group pages
jwj61 Apr 2, 2026
f8c6236
Merge pull request #6950 from roed314/dirchar_warning
jenpaulhus Apr 3, 2026
9ffa780
Merge pull request #6954 from roed314/beta_link
jenpaulhus Apr 3, 2026
6b6593d
Merge pull request #6955 from jwj61/transitivity
roed314 Apr 3, 2026
dfe42d6
Fix API error when _format specified twice
roed314 Apr 3, 2026
29e97d8
adding test for jump box for Eisenstein series
assaferan Apr 3, 2026
c0f5a0f
Merge pull request #6956 from roed314/apiformat
jenpaulhus Apr 3, 2026
9097abc
fixing handling of bad inputs for Eisenstein series
assaferan Apr 3, 2026
cd08428
adding a test for E4
assaferan Apr 3, 2026
22166ad
adding test for level 2 Eisenstein series
assaferan Apr 3, 2026
faf5455
added test for some trivial character Eisenstein series
assaferan Apr 3, 2026
4144a42
added a test for Eisenstein series with non trivial characters
assaferan Apr 3, 2026
2df1add
added test for trace table in space page
assaferan Apr 3, 2026
e5e7293
Merge pull request #6942 from rvisser7/abstract_groups
roed314 Apr 3, 2026
d568bc6
autopep8 action fixes
roed314 Apr 3, 2026
8d3820b
Merge pull request #6957 from LMFDB/autopep8-patches
roed314 Apr 3, 2026
80c769f
adding test for empty spaces
assaferan Apr 3, 2026
b3af105
Add max ramified prime to searches
jwj61 Apr 6, 2026
3de6e59
Fix aut group knowl
jwj61 Apr 8, 2026
f8edd0d
Working on shrinking mf_hecke_cc
roed314 Apr 9, 2026
a6f662f
Initial version of mf_hecke_cc auxiliary dataset page (not yet functi…
roed314 Apr 9, 2026
49439a5
Implements multi-label search functionality in number_field and searc…
rvisser7 Apr 10, 2026
53a422f
Add 'handle_multi_jump_search' function and update search array handling
rvisser7 Apr 10, 2026
7306887
Add tests for multi-label search
rvisser7 Apr 10, 2026
9571a66
Change "labels_knowl" to "label_knowl"
rvisser7 Apr 10, 2026
f8c122c
Merge branch 'main' into new_jump_box
rvisser7 Apr 10, 2026
5684ba3
Add support for biquadratic fields in number field jump box search
rvisser7 Apr 10, 2026
d6e899d
Add support for cubic fields in number field label parsing
rvisser7 Apr 11, 2026
dadb174
Working on mf_hecke_cc dataset page
roed314 Apr 11, 2026
7579f46
Correct number field multi-label jump test
rvisser7 Apr 11, 2026
af1edea
Some light edits to the multi-entry jump box search parsing
rvisser7 Apr 11, 2026
2332fac
Small typo fix in number field import
rvisser7 Apr 11, 2026
98e9e09
Small bug fixes
rvisser7 Apr 11, 2026
07093d2
Further refactoring of nf_string_to_label to support cubics and biqua…
rvisser7 Apr 11, 2026
0a12372
Keep order in unknown
jwj61 Apr 11, 2026
d300adb
Merge pull request #6961 from jwj61/main
roed314 Apr 11, 2026
ef3f52e
Merge pull request #6962 from jwj61/autgroupknowl
roed314 Apr 11, 2026
d5546ee
autopep8 action fixes
roed314 Apr 11, 2026
3a684bf
Merge pull request #6967 from LMFDB/autopep8-patches
roed314 Apr 11, 2026
835567c
First pass at adding function nf_string_to_min_poly, to support more …
rvisser7 Apr 11, 2026
3879b6f
Added time_limit (with timer) to multi_entry_jump_search
rvisser7 Apr 11, 2026
6874f3b
Some minor extra comments added
rvisser7 Apr 11, 2026
4dfa224
Fix some typos in parse_labels function
rvisser7 Apr 11, 2026
f1bbfdc
Add split_top_level_commas function for parsing jump box input
rvisser7 Apr 11, 2026
8dbe81f
Moved split_top_level_commas function for jump box input parsing and …
rvisser7 Apr 11, 2026
255215f
Small change to parse_labels function
rvisser7 Apr 11, 2026
bcf1d9e
Small whitespace edit in number_field.py
rvisser7 Apr 11, 2026
3074823
Update multi_entry_jump_search docstring to clarify default values fo…
rvisser7 Apr 11, 2026
f9344c5
Add tests for cubic and biquadratic field labels in nf_string_to_label
rvisser7 Apr 11, 2026
c173361
Add tests for recursive nested surds and multi-generator labels in nf…
rvisser7 Apr 12, 2026
92c8dd0
Add tests for symbol support in nf_string_to_min_poly and nf_string_t…
rvisser7 Apr 12, 2026
2d2a983
Some further comment changes and edits to nf_string_to_label
rvisser7 Apr 12, 2026
390ce22
Working on switching to mf_hecke_cc as auxiliary dataset
roed314 Apr 14, 2026
8306a71
Fixing some bugs
roed314 Apr 14, 2026
2972319
Some mf_hecke_cc tweaks
roed314 Apr 14, 2026
9ac8a82
Some fixes
roed314 Apr 14, 2026
b484ba1
Add tests
roed314 Apr 14, 2026
6a098c9
Try using external link tester
roed314 Apr 14, 2026
a8c1bad
Use explicit link to beta
roed314 Apr 14, 2026
46ec0b5
displaying Sato-Tate groups for Eisenstein series correctly (as finit…
assaferan Apr 17, 2026
b968cf3
modifying display of Sato-Tate groups on search results to work also …
assaferan Apr 17, 2026
8d5a551
adding test for empty Eisenstein spaces
assaferan Apr 17, 2026
cd7ea27
added test for Eisenstein series not in DB
assaferan Apr 17, 2026
5596840
fix oldspace decomposition
BarinderBanwait Apr 17, 2026
443059a
added tests for character validation and for decomposition
assaferan Apr 17, 2026
4be2a27
merging
assaferan Apr 17, 2026
132d854
fixing latex in decomposition also for Gamma1 spaces
assaferan Apr 17, 2026
7657866
add some tests
BarinderBanwait Apr 17, 2026
9c4d9f5
Working on test failures
roed314 Apr 18, 2026
92ad605
1000 embeddings
roed314 Apr 18, 2026
d95fe69
Merge pull request #6968 from roed314/mf_hecke_cc
roed314 Apr 18, 2026
7285fd0
autopep8 action fixes
roed314 Apr 18, 2026
e6805c6
Set download name in mf_hecke_cc
roed314 Apr 19, 2026
c2b6109
Merge pull request #6970 from LMFDB/autopep8-patches
roed314 Apr 19, 2026
9f8a1ba
Add test for download mf_hecke_cc by label
roed314 Apr 19, 2026
955c4c4
Merge pull request #6971 from roed314/mf_hecke_cc
roed314 Apr 19, 2026
1820151
Add cookie for beta access
roed314 Apr 20, 2026
ff6aa33
Merge pull request #6974 from roed314/mf_hecke_cc
roed314 Apr 20, 2026
8d0776f
fixing rst syntax in completeness
fchapoton Apr 21, 2026
264cacd
Update _nf_string_to_qqbar to support exponentiation and nth-roots
rvisser7 Apr 22, 2026
e18d21c
Update nf_string_to_label to support fast parsing of quadratic fields
rvisser7 Apr 22, 2026
b3da38c
Update tests for number fields
rvisser7 Apr 22, 2026
76e8ad8
Small updates to nf_string_to_label
rvisser7 Apr 22, 2026
cc424a8
First pass at adding support for more cases in field_pretty function
rvisser7 Apr 22, 2026
b566e6a
Fix field_pretty function for imprimitive quartic fields
rvisser7 Apr 22, 2026
d8889eb
Improvements to field_pretty function for imprimitive quartics and mu…
rvisser7 Apr 22, 2026
198c619
Further improvements to field_pretty function
rvisser7 Apr 22, 2026
120bf05
added visuals for the dessin d'enfants
ReymondAkpanya Apr 23, 2026
f4a3c1f
Refined pretty latex code for imprimitive quartic fields. Added some…
rvisser7 Apr 23, 2026
877e219
Further improvements to multi-quadratic pretty labels
rvisser7 Apr 23, 2026
5e0646b
Add some multiquadratic pretty label tests
rvisser7 Apr 23, 2026
9f6506a
Improve pretty labels for pure cubic fields
rvisser7 Apr 23, 2026
7a60514
Small correction to Cardano's formula
rvisser7 Apr 23, 2026
67d0393
Various bug fixes and removed printing statements
rvisser7 Apr 23, 2026
1e2bf0b
Update Development.md and fix #6902
havarddj Apr 24, 2026
6e403cf
Merge pull request #6981 from havarddj/bmf-label-in-search-column
edgarcosta Apr 24, 2026
3754ef3
Merge pull request #6976 from fchapoton/fixin_rst_completeness
edgarcosta Apr 24, 2026
3960faa
Add sort option by minimal discriminant
roed314 Apr 11, 2026
8c81718
Merge pull request #6965 from roed314/disc_sort
edgarcosta Apr 24, 2026
5ca73f6
added reference
ReymondAkpanya Apr 26, 2026
44afaba
Merge pull request #6978 from ReymondAkpanya/main
AndrewVSutherland Apr 26, 2026
9118d7f
autopep8 action fixes
AndrewVSutherland Apr 26, 2026
cb76975
Merge pull request #6983 from LMFDB/autopep8-patches
roed314 Apr 26, 2026
56e0499
Merge pull request #6977 from rvisser7/biquadratic
jwj61 Apr 29, 2026
d5c1aca
autopep8 action fixes
jwj61 Apr 29, 2026
3c09a5f
Merge pull request #6984 from LMFDB/autopep8-patches
jwj61 Apr 29, 2026
6e9be6f
Some further fixes to field_pretty; now has real cyclotomic case prio…
rvisser7 May 1, 2026
b4488b1
Update test cases for latexed pretty number field labels
rvisser7 May 1, 2026
655ada0
adding tests for decomposition
assaferan May 4, 2026
76d375a
Updated jump box time limit to 20 seconds, small edits to time limit …
rvisser7 May 5, 2026
5b5a2dc
Small update to timeout warning message
rvisser7 May 5, 2026
a9cb255
Fix issue #6988
jwj61 May 7, 2026
e4a96d7
Merge pull request #6989 from jwj61/Janko
roed314 May 7, 2026
54c88d6
Merge pull request #6980 from rvisser7/new_field_pretty
roed314 May 7, 2026
f86c016
autopep8 action fixes
roed314 May 7, 2026
7d95a7b
Merge pull request #6990 from LMFDB/autopep8-patches
roed314 May 7, 2026
f34166d
Correct transitive group id for degree 16 multiquadratic fields
rvisser7 May 7, 2026
ec81ec5
Merge branch 'LMFDB:main' into new_jump_box
rvisser7 May 7, 2026
2208bb2
Fix Sage commment type for HCF eigenvalue Sage download
rvisser7 May 7, 2026
57d314a
Merge pull request #6993 from rvisser7/galois
roed314 May 8, 2026
f6e4f02
Merge pull request #6994 from rvisser7/hmf
roed314 May 8, 2026
7f27451
Merge pull request #6964 from rvisser7/new_jump_box
roed314 May 8, 2026
ccad26b
autopep8 action fixes
roed314 May 8, 2026
210e5dc
Merge pull request #6997 from LMFDB/autopep8-patches
roed314 May 8, 2026
9723815
Fix bug with latex names for cubic fields
rvisser7 May 8, 2026
4d39104
Merge pull request #6998 from rvisser7/new_field_pretty
roed314 May 8, 2026
4a037db
Fix download for p-adic families search results (#6829)
roed314 May 14, 2026
1eb5ce4
Merge pull request #7006 from roed-math/claude/gracious-shirley-e47168
roed314 May 14, 2026
e3240f1
Limit rows shown on /data/ pages, report total when truncated
roed314 May 14, 2026
9f84376
Merge pull request #7007 from roed-math/claude/elated-johnson-b07d43
roed314 May 14, 2026
d734ca3
merging tests for decomposition
assaferan May 15, 2026
072875a
fixing merge
assaferan May 15, 2026
d29030b
fixing decomposition tests
assaferan May 15, 2026
770b182
fixed decomposition test for Eisenstein
assaferan May 15, 2026
998ec60
added test for dimension tables
assaferan May 15, 2026
ced20ea
merging changes from main
assaferan May 15, 2026
5a352b3
removing tests that are not yet working
assaferan May 15, 2026
a00588e
adding test for character parity
assaferan May 15, 2026
3a4c465
Merge branch 'alpha' into eisenstein
assaferan May 15, 2026
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
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,9 @@ LMFDBinventory.log
LMFDBtransactions_inv.log

scripts/groups/Make-images/images/*.png
scripts/groups/Make-images/images/eqguts.tex
scripts/groups/Make-images/prettyindex
scripts/groups/Make-images/imagereloader

smf_lmfdb
__pycache__
create_input_data.py
scripts/groups/Make-images/images/eqguts.tex
scripts/groups/Make-images/prettyindex
scripts/groups/Make-images/imagereloader
133 changes: 40 additions & 93 deletions Development.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ Structural Conventions

Below, we describe several of the structural conventions used in the LMFDB. Note
that we also have styling conventions for the content of individual pages. These
styling conventions are described in
[StyleGuide.md](https://github.com/LMFDB/lmfdb/blob/main/StyleGuide.md).
styling conventions are described in [StyleGuide.md](./StyleGuide.md).

Pages in the LMFDB
------------------
Expand Down Expand Up @@ -206,11 +205,11 @@ should be
Here and throughout this document, we say "should" instead of "must", with
the understanding that some compromises will be inevitable.

Here are some principles:
Here are some conventions the LMFDB uses:

1. If X is the URL of an object, then L/X is the URL of its standard
L-function. According to the Langlands program, other L-functions
associated to X have the form L(s, X, rho). Examples include
associated to X may be written on the the form L(s, X, rho). Examples include

- L(s, f, sym^2)
- L(s, f, spin)
Expand Down Expand Up @@ -261,8 +260,7 @@ Here are some principles:
should be considered permanent:

- `/ArtinRepresentation/\<dim>/\<conductor>/\<label>`
- `/Character/Dirichlet/\<modulus>/\<number>`
- `/Character/Hecke/\<number_field>/\<modulus>/\<number>`
- `/Character/Dirichlet/\<modulus>/\<label>`
- `/EllipticCurve/Q/\<label>`
- `/GaloisGroup/\<label>`
- `/padicField/\<label>`
Expand Down Expand Up @@ -356,9 +354,9 @@ Testing

- A code coverage diagnostic can be obtained via
```
./test.sh html
./test.sh coverage
```
it produces beautiful coverage scores in `lmfdb/cover/index.html`
which produces coverage scores saved in `lmfdb/htmlcov`.

Code Snippets
-------------
Expand Down Expand Up @@ -413,105 +411,54 @@ The tag `langs` here is optional, and if omitted, all (available) languages in t

Part of the code snippet testing system is a pair of code actions to generate evaluation log files automatically. The first one runs when a change to a `code*.yaml` file is pulled to the main branch, and if so, regenerates the evaluation files. If the output is different from the previous evaluation files, it will make a pull request, allowing you to manually check that the output is as expected. The logic is in `.github/workflows/snippet_generate.yml`.

Additionally, there's a second CI which runs twice a month and checks that the evaluations are consistent - it can also be run on demand. This ensures that if and when SageMath (or another CAS) deprecates a function, we'll know without having to wait for someone to update the yaml files, rerun the code or submit a bug report. If this action generates a different output than what's stored in the evaluation files, it will error, and upload the diff as an artifact. This is in `.github/workflows/snippet_test.yml`. Furthermore, it will create/update an issue (see https://github.com/LMFDB/lmfdb/issues/6810 for example) which keeps track of all the evaluation errors.
Additionally, there's a second CI action which runs twice a month and checks that the evaluations are consistent - it can also be run on demand. This ensures that if and when SageMath (or another CAS) deprecates a function, we'll know without having to wait for someone to update the yaml files, rerun the code or submit a bug report. If this action generates a different output than what's stored in the evaluation files, it will error, and upload the diff as an artifact. This is in `.github/workflows/snippet_test.yml`. Furthermore, it will create/update an issue (see https://github.com/LMFDB/lmfdb/issues/6810 for example) which keeps track of all the evaluation errors.


Pro Tip: Debugging
-------------------

Just add
Adding
```
import pdb; pdb.set_trace()
```
somewhere (e.g. protected inside a sensible if) this magic
line and you will end up inside the interactive python
debugger. there, you can check for the local variables with dir()
you can execute python code (e.g. to introspect objects)
and use "pp <var name>" to pretty print variables and
to continue executing code use the "n" command.
When you get lost, the command "bt" shows you exactly where you
are and "up" helps you to get on step up on the stack.
Of course, "help `<command>`" will tell you more...
somewhere in a python file (e.g. protected inside a sensible if) will pause the execution of the program;
this puts you inside an interactive python debugger, where you can:

Git Tips
=========

global .gitignore
-----------------

Please configure Git to have a global .gitignore for all your projects.
It should contain all the files which are not project specific, but happen
on your machine. E.g. temporary files ending in `...~` or `.DS_store`.
- check for the local variables with `dir()`,
- you can execute arbitrary python code (e.g. to inspect objects),
- use `pp <var name>` to pretty print variables,
- continue executing code using the `n` command.

[copy paste ready instructions on github](https://help.github.com/articles/ignoring-files#global-gitignore)
If you get lost, the command `bt` shows you exactly where you
are, and `up` helps you to get on step up on the stack.
Of course, `help <command>` will tell you more.

.gitconfig
----------

In your home directory, in the file ~/.gitconfig
Git Tips
=========

```
Contributing to the LMFDB requires some familiarity with git, a popular version control system which LMFDB uses. The LMFDB code base is hosted on Github, which is a common hosting service owned by Microsoft.
- [Official git tutorial](https://git-scm.com/docs/gittutorial) and [Github's git guide](https://github.com/git-guides)
- Use a global .gitignore file to exclude temporary files like `.DS_store` or `main.py~`; [copy-paste ready instructions on github](https://help.github.com/articles/ignoring-files#global-gitignore).
- Configure your global .gitconfig for shortcuts or global configuration options; for example:
```
[alias]
st=status
aliases=!git config --get-regexp 'alias.*' | colrm 1 6 | sed 's/[ ]/ = /'
ci=commit
br=branch
co=checkout
df=diff
who=shortlog -s --
ll = log --oneline --graph --decorate -25
lla = log --oneline --graph --decorate --all -25
wdiff=diff --word-diff=color
st=status
aliases=!git config --get-regexp 'alias.*' | colrm 1 6 | sed 's/[ ]/ = /'
ci=commit
br=branch
co=checkout
df=diff
who=shortlog -s --
ll = log --oneline --graph --decorate -25
lla = log --oneline --graph --decorate --all -25
wdiff=diff --word-diff=color
[color]
ui = auto
branch = auto
diff = auto
interactive = auto
status = auto
```

List-table should always be like
--------------------------------

```
<table class="ntdata">
<thead><tr><td>...</td></tr></thead>

<tbody>
<tr class="odd"> <td>...</td></tr>
<tr class="even"><td>...</td></tr>
<tr class="odd"> <td>...</td></tr>
...
</tbody>
</table>
```

... we might also switch to CSS3's nth-element selector and forget about this.


Properties
----------

The table on the right renders Strings formatted in the following datastructure:

```
prop = [ ( '<description>', [ '<value 1>', '<value 2>', ...] ), ... ]
```

or

```
prop = [ ( '<description>', '<value>'), ('<description>', '<value>'), ... ]
```

you can mix list or non-list.


LaTeX Macros
------------

Latex macros are documented in a knowl that will appear when you start editing one.

ui = auto
branch = auto
diff = auto
interactive = auto
status = auto
```

Server Hook
-----------
Expand Down
24 changes: 22 additions & 2 deletions lmfdb/api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,8 @@ def apierror(msg, flash_extras=[], code=404, table=True):
next_req = dict(request.args)
next_req["_offset"] = offset
url_args = next_req.copy()
# Remove _format so that we don't specify that keyword twice
url_args.pop("_format", None)
query = url_for(".api_query", table=table, **next_req)
offset += len(data)
next_req["_offset"] = offset
Expand Down Expand Up @@ -368,7 +370,7 @@ def apierror(msg, flash_extras=[], code=404, table=True):


# This function is used to show the data associated to a given homepage, which could possibly be from multiple tables.
def datapage(labels, tables, title, bread, label_cols=None, sorts=None):
def datapage(labels, tables, title, bread, label_cols=None, sorts=None, limit=100):
"""
INPUT:

Expand All @@ -378,8 +380,15 @@ def datapage(labels, tables, title, bread, label_cols=None, sorts=None):
- ``bread`` -- bread for the page
- ``label_cols`` -- a list of column names of the same length; defaults to using ``label`` everywhere
- ``sorts`` -- lists for sorting each table; defaults to None
- ``limit`` -- maximum number of rows displayed from each table; if more rows match, the total count is reported instead of listing them all
"""
format = request.args.get("_format", "html")
try:
limit_arg = request.args.get("_limit")
if limit_arg is not None:
limit = max(0, min(10000, int(limit_arg)))
except (TypeError, ValueError):
pass
if not isinstance(tables, list):
tables = [tables]
if not isinstance(labels, list):
Expand All @@ -400,6 +409,7 @@ def apierror(msg, flash_extras=[], code=404, table=False):
else:
return abort(code, msg % tuple(flash_extras))
data = []
totals = []
search_schema = {}
extra_schema = {}
for label, table, col, sort in zip(labels, tables, label_cols, sorts):
Expand All @@ -409,7 +419,15 @@ def apierror(msg, flash_extras=[], code=404, table=False):
q = {col: label}
coll = db[table]
try:
data.append(list(coll.search(q, projection=3, sort=sort)))
# Fetch limit+1 rows to cheaply detect truncation; only call count() if we actually exceeded the limit.
rows = list(coll.search(q, projection=3, sort=sort, limit=limit + 1))
if len(rows) > limit:
total = coll.count(q)
rows = rows[:limit]
else:
total = len(rows)
data.append(rows)
totals.append(total)
except QueryCanceledError:
return apierror("Query %s exceeded time limit.", [q], code=500, table=table)
except KeyError as err:
Expand All @@ -429,6 +447,8 @@ def apierror(msg, flash_extras=[], code=404, table=False):
"label_cols": label_cols,
"timestamp": utc_now_naive().isoformat(),
"data": data,
"totals": totals,
"limit": limit,
}
if format.lower() == "json":
return current_app.response_class(json.dumps(data, indent=2), mimetype='application/json')
Expand Down
9 changes: 6 additions & 3 deletions lmfdb/api/templates/apidata.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,18 @@
</div>

<ul class="api-entries">
{% for table, recs, label, label_col in zip(tables, data, labels, label_cols) %}
{% for table, recs, label, label_col, total in zip(tables, data, labels, label_cols, totals) %}
<li>
{% if (recs|length) == 0 %}
{% if total == 0 %}
{{ label_col }} {{ label }} does not appear in <a href="{{ url_for('API.api_query', table=table) }}">{{ table }}</a>
{% elif (recs|length) == 1 %}
{% elif total == 1 %}
<a href="{{ url_for('API.api_query_id', table=table, id=recs[0].get('id')) }}">{{ table }}</a> &bull; {% include "apischema.html" %} </br/>
<code>{{ pretty(recs[0], id=False) }}</code>
{% else %}
<a href="{{ url_for('API.api_query', table=table) }}">{{ table }}</a> &bull; {% include "apischema.html" %} </br/>
{% if (recs|length) < total %}
Showing the first {{ recs|length }} of {{ total }} matching records in this table.
{% endif %}
<ul>
{% for entry in recs %}
<li>
Expand Down
54 changes: 45 additions & 9 deletions lmfdb/belyi/templates/belyi_galmap.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
.toggle {margin-top:5px; margin-left:20px;}
div.properties-body table tr td.label { vertical-align: top ; }
#content > h2.subhead { color:{{color.black}};}
#dessin-box svg { width: 100%; height: auto; display: block; }
</style>

<script>
Expand All @@ -14,6 +15,22 @@
$('.plane_eqn').css("display", "none");
$('.'+eqnstyle).css("display", "inline");
}

var _activeDessinRow = null;
function viewEmbedding(idx) {
var $box = $('#dessin-box');
if (_activeDessinRow === idx) {
$box.hide();
_activeDessinRow = null;
return false;
}
$('.dessin-svg-item').hide();
$('#dessin-svg-' + idx).show();
$box.show();
$box[0].scrollIntoView({behavior: 'smooth', block: 'nearest'});
_activeDessinRow = idx;
return false;
}
</script>

<h2>{{ KNOWL('belyi.base_field', title='Base field')}}</h2>
Expand Down Expand Up @@ -107,20 +124,39 @@ <h2>{{ KNOWL('nf.embedding', title="Embeddings") }}</h2>
<tr>
<td>Embedding $\nu \mapsto \nu_i \in \mathbb{C}$</td>
<td>{{ KNOWL('belyi.permutation_triple', title="Permutation triple") }}</td>
{% if data.dessin_svgs %}<td>Dessin</td>{% endif %}
</tr>
</thead>
<tbody>
{% for g in data.embeddings_and_triples %}
<td>${{g['embedding']}}$</td>
<td>${{g['triple']}}$</td>
</tr>
<!-- TODO: uncomment this when embedded map pages are reactivated
<td><a href="{{g['triple_link']}}">${{g['embedding']}}$</a></td>
<td><a href="{{g['triple_link']}}">${{g['triple']}}$</a></td>
</tr>
-->
<tr>
<td>${{g['embedding']}}$</td>
<td>${{g['triple']}}$</td>
{% if data.dessin_svgs %}
<td><a href="#" onclick="return viewEmbedding({{ loop.index0 }});">View Embedding</a></td>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
</table>

{% if data.dessin_svgs %}
<div id="dessin-box" class="knowl-output" style="display:none; max-width:440px;">
<div class="knowl"><div><div class="knowl-content">
<strong>Dessin d&rsquo;enfant</strong>
{% for g in data.embeddings_and_triples %}
{% set svg_idx = loop.index0 if loop.index0 < data.dessin_svgs|length else 0 %}
<div id="dessin-svg-{{ loop.index0 }}" class="dessin-svg-item" style="display:none;">
{{ data.dessin_svgs[svg_idx]|safe }}
</div>
{% endfor %}
<p style="font-size:0.85em; margin-top:0.75em;">
The drawing routine is based on a C program by Gunnar Brinkmann, described in:<br>
G. Brinkmann, <em>Drawing maps on oriented surfaces</em>, 2025.
Preprint: <a href="https://arxiv.org/abs/2505.01480">arXiv:2505.01480</a>.
</p>
</div></div></div>
</div>
{% endif %}

{% endblock %}
Loading
Loading