metamorph.config

Module Contents

Classes

Config

Defines the language flow to generate alternative texts.

Functions

is_end(dic)

Returns True if dictionary is an end node.

no_extra(dic)

Returns keys of dictionary that are not 'extra'.

remove_lower(text)

Remove lowercase letters from text.

metamorph.config.is_end(dic)[source]

Returns True if dictionary is an end node.

metamorph.config.no_extra(dic)[source]

Returns keys of dictionary that are not ‘extra’.

metamorph.config.remove_lower(text: str)[source]

Remove lowercase letters from text.

Parameters:

text – Text to remove lowercase letters from.

Returns:

Text without lowercase letters.

Example::
>>> remove_lower("GoogleTranslate")
'GT'
>>> remove_lower({"GoogleTranslate":"XXX"})
{'GT': 'XXX'}
class metamorph.config.Config(file: str = None, start='en', goal='en', translator='GoogleTranslator', proxies=None, api_keys=None, flow=None, color='green', on_color='on_red')[source]

Defines the language flow to generate alternative texts.

get_api_key(translator)[source]

Returns the api key for translator.

load_file(file: str)[source]

Loads a configuration file.

default_extra(direct, k)[source]

Adds default keys to dictionary at direct[k].

fill_missing(direct)[source]

Sets default extras for missing elements in dictionary.

str_diagram(nodes='language', arrows=None)[source]

Prints a diagram of the language flow.

_recursive_get_str_max_length(sub, key)[source]
_recursive_str_diagram(sub, kk, depth=1, lines=None, nodes='language', arrows=None, len_nodes=None, len_arrows=None)[source]