mathmaker.lib.document.frames package

Submodules

mathmaker.lib.document.frames.exercise module

class mathmaker.lib.document.frames.exercise.Exercise(**options)[source]

Bases: object

questions_list
setup(**options)[source]
to_str(ex_or_answers)[source]
class mathmaker.lib.document.frames.exercise.Q_info(id, kind, subkind, nb_source, options, order)

Bases: tuple

id

Alias for field number 0

kind

Alias for field number 1

nb_source

Alias for field number 3

options

Alias for field number 4

order

Alias for field number 5

subkind

Alias for field number 2

mathmaker.lib.document.frames.exercise.auto_adjust_nb_sources(nb_sources: list, q_i: <function namedtuple at 0x7f270d10d510>)[source]

Automatically adjust nb_sources for certains questions.

Parameters:
  • nb_sources – the provided numbers sources
  • q_i – the Q_info object (namedtuple), whose fields are ‘id,kind,subkind,nb_source,options’
mathmaker.lib.document.frames.exercise.build_mixed_q_list(q_dict, shuffle=True)[source]
mathmaker.lib.document.frames.exercise.build_q_dict(q_list)[source]
mathmaker.lib.document.frames.exercise.get_common_nb_from_pairs_pair(pair)[source]

Return the common number found in a pair of pairs.

Parameters:pair (a tuple or a list (of two elements)) – the pair of pairs
Return type:number
mathmaker.lib.document.frames.exercise.get_nb_sources_from_question_info(q_i)[source]
mathmaker.lib.document.frames.exercise.increase_alternation(l, sort_key)[source]
mathmaker.lib.document.frames.exercise.merge_pair_to_tuple(n_tuple, pair, common_nb)[source]

Add one number from the pair to the n_tuple.

It is assumed n_tuple and pair both contain common_nb. If n_tuple has more than 2 elements, it is also assumed that the first one is common_nb. If it has 2 elements, then it might need to get reordered. :param n_tuple: a tuple of 2 or more elements :type n_tuple: tuple :param pair: a tuple of 2 elements. One of them (at least) is common_nb, and will be removed, the other one will be added to n_tuple :type pair: tuple :param common_nb: the number contained in both n_tuple and pair :type common_nb: a number :rtype: tuple

mathmaker.lib.document.frames.exercise.numbering_device(numbering_kind='disabled')[source]

This generator provides “limitless” new items for numbering questions.

Possible values of the argument are: - ‘disabled’: an empty string will be returned - ‘numeric’: an integer is returned (until the maximal value is reached, but let’s consider there won’t be that long exercises!) - ‘alphabetic’: a letter is returned (once the alphabet is over, as a security, the letter is returned doubled, tripled, etc., thought it is not expected to need more than 26 questions in the same exercise.)

mathmaker.lib.document.frames.exercise.preprocess_variant(q_i)[source]

Preprocess question’s variant (if necessary)

Parameters:q_i (Q_info (named tuple)) – the Q_info object, whose fields are ‘id,kind,subkind,nb_source,options,order’

mathmaker.lib.document.frames.question module

class mathmaker.lib.document.frames.question.Question(q_kind, **options)[source]

Bases: object

answer_to_str()[source]
hint_to_str()[source]
text_to_str()[source]
to_str(ex_or_answers)[source]

mathmaker.lib.document.frames.sheet module

class mathmaker.lib.document.frames.sheet.Sheet(theme, subtheme, sheet_name, **options)[source]

Bases: object

answers_title_to_str(variant='default')[source]
sheet_header_to_str()[source]
sheet_text_to_str()[source]
sheet_title_to_str(variant='default')[source]
texts_to_str(ex_or_answers, n_of_first_ex)[source]

Module contents

class mathmaker.lib.document.frames.Sheet(theme, subtheme, sheet_name, **options)[source]

Bases: object

answers_title_to_str(variant='default')[source]
sheet_header_to_str()[source]
sheet_text_to_str()[source]
sheet_title_to_str(variant='default')[source]
texts_to_str(ex_or_answers, n_of_first_ex)[source]
class mathmaker.lib.document.frames.Exercise(**options)[source]

Bases: object

questions_list
setup(**options)[source]
to_str(ex_or_answers)[source]
class mathmaker.lib.document.frames.Question(q_kind, **options)[source]

Bases: object

answer_to_str()[source]
hint_to_str()[source]
text_to_str()[source]
to_str(ex_or_answers)[source]
mathmaker.lib.document.frames.get_nb_sources_from_question_info(q_i)[source]