idsortingalgorithm¶
This module contains the following classes:
IDSortingAlgorithm
, enumerating and implementing the available algorithms to sort a list of XMLid
attributes.
Warning
This module is likely to be refactored in a future version
-
class
aeneas.idsortingalgorithm.
IDSortingAlgorithm
(algorithm, rconf=None, logger=None)[source]¶ Enumeration of the available algorithms to sort a list of XML
id
attributes.Parameters: - algorithm (
IDSortingAlgorithm
) – the id sorting algorithm to be used - rconf (
RuntimeConfiguration
) – a runtime configuration - logger (
Logger
) – the logger object
Raises: ValueError: if the value of
algorithm
is not allowed-
ALLOWED_VALUES
= ['lexicographic', 'numeric', 'unsorted']¶ List of all the allowed values
-
LEXICOGRAPHIC
= 'lexicographic'¶ Lexicographic sorting (e.g.,
f020
beforef10
beforef2
)
-
NUMERIC
= 'numeric'¶ Numeric sorting, ignoring any non-digit characters or leading zeroes (e.g.,
f2
(=2
) beforef10
(=10
) beforef020
(=20
))
-
UNSORTED
= 'unsorted'¶ Do not sort and return the list of identifiers, in their original order (e.g.,
f2
beforef020
beforef10
, assuming this was their order in the XML DOM)
- algorithm (