Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
forgot an else
Browse files Browse the repository at this point in the history
  • Loading branch information
mantepse committed Sep 30, 2015
1 parent 2f7c727 commit dc390fc
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/sage/databases/findstat.py
Expand Up @@ -458,6 +458,15 @@ def __call__(self, query, function=None, depth=2, max_values=FINDSTAT_MAX_VALUES
Traceback (most recent call last):
...
ValueError: The given arguments, Permutations and 1, cannot be used for a FindStat search.
sage: from sage.databases.findstat import FindStatCollection
sage: findstat(FindStatCollection("Permutations"), lambda pi: pi.length()) # optional -- internet,random
0: (St000018: The [[/Permutations/Inversions|number of inversions]] of a permutation., [], 200)
1: (St000004: The [[/Permutations/Descents-Major|major index]] of a permutation., [Mp00062: inversion-number to major-index bijection], 200)
2: (St000067: The inversion number of the alternating sign matrix., [Mp00063: to alternating sign matrix], 152)
3: (St000246: The [[/Permutations/Inversions|number of non-inversions]] of a permutation., [Mp00064: reverse], 200)
4: (St000008: The major index of the composition., [Mp00062: inversion-number to major-index bijection, Mp00071: descent composition], 200)
"""
try:
depth = int(depth)
Expand Down Expand Up @@ -526,7 +535,9 @@ def __call__(self, query, function=None, depth=2, max_values=FINDSTAT_MAX_VALUES

else:
if callable(function):
if not isinstance(query, FindStatCollection):
if isinstance(query, FindStatCollection):
collection = query
else:
collection = FindStatCollection(query)
first_terms = collection.first_terms(function, max_values=max_values)
data = [([key], [value]) for (key, value) in first_terms]
Expand Down

0 comments on commit dc390fc

Please sign in to comment.