mathmaker.lib.document.content package

Subpackages

Submodules

mathmaker.lib.document.content.component module

class mathmaker.lib.document.content.component.structure[source]

Bases: object

dbg_info(msg, *numbers, letters='abcdefghijklmnopqrstuvwxyz')[source]

Create log message to record including self.nb* and a, b, c… values.

Parameters:
  • msg (str) – the msg to join to the values’ list
  • numbers (numbers) – the values of the numbers a, b, c etc.
Return type:

str

h(**kwargs)[source]
js_a(**kwargs)[source]

Return the object as a list of user quickly writable strings.

The elements of this list will be used in embedded javascript of pdf files to compare to user’s answer. Most of the time, only one answer is possible (like answer of ‘7×8 = ?’ is equal to ‘56’) but sometimes it is useful to have several different answers to accept, like for fractions of a figure: ‘6/12’ should lead to also accept, at least, ‘3/6’, ‘2/4’ and ‘1/2’.

Must be reimplemented in each question.

nb_list
q_wordings_collection
setup(arg, **kwargs)[source]
watch(rules, *numbers, letters='abcdefghijklmnopqrstuvwxyz')[source]

Check the quality of numbers created, according to the rules.

If something is wrong, it will be logged.

Possible rules: no negative: will check if there’s any negative when only positive

numbers were expected
decimals distribution: will check if there are only integers when one
decimal number at least was expected.
<letter> isnt deci: check this letter does not contain a decimal
when division by a decimal is not allowed
<letter> isnt 1: check this letter is different from 1
under any circumstances
Parameters:
  • rules (str) – a string containing rules separated by ‘; ‘. See above for possible rules
  • numbers (numbers) – the values of the numbers a, b, c etc.
  • letters (str) – the names of the variables, in order of appearance. Default is the normal alphabet, low case.

Module contents

All possible questions.