hanyuu Package

hanyuu Package

config Module

hanyuu.config.get(*args, **kwargs)[source]

See ConfigParser.RawConfigParser

hanyuu.config.getfloat(*args, **kwargs)[source]

See ConfigParser.RawConfigParser

hanyuu.config.getint(*args, **kwargs)[source]

See ConfigParser.RawConfigParser

hanyuu.config.has_option(*args, **kwargs)[source]

See ConfigParser.RawConfigParser

hanyuu.config.has_section(*args, **kwargs)[source]

See ConfigParser.RawConfigParser

hanyuu.config.items(*args, **kwargs)[source]

See ConfigParser.RawConfigParser

hanyuu.config.load_configuration(filepaths)[source]

Creates a new ConfigParser.SafeConfigParser and tries parsing all filepaths given.

filepaths should be a list of filenames.

Returns nothing, instead assigns itself to the global variable configuration and abstracts itself by calling create_abstractions()

hanyuu.config.options(*args, **kwargs)[source]

See ConfigParser.RawConfigParser

hanyuu.config.reload_configuration()[source]

Creates a new ConfigParser.SafeConfigParser and passes it the same filenames as given in the last call to load_configuration().

This effectively ‘reloads’ the configuration files.

hanyuu.config.sections(*args, **kwargs)[source]

See ConfigParser.RawConfigParser

utils Module

class hanyuu.utils.Switch(initial, timeout=15)[source]

Bases: object

A timed switch. Evaluates truthy if the time has expired, else falsy.

Example usage:
>>> import time
>>> a = Switch(5)
>>> bool(a)
False
>>> time.sleep(5)
>>> bool(a)
True
reset(timeout=15)[source]
hanyuu.utils.fix_encoding(metadata)[source]

This function tries to guess the correct encoding of metadata

Currently this checks for the following encodings in order:
UTF-8, strict mode SJIS, replace mode UTF-8, replace mode

Note

This function also calls an unconditional metadata.strip() before returning the new string.

Parameters:metadata (bytes) – A sequence in an unknown encoding.
Returns unicode:
 An unicode string.

Project Versions

Table Of Contents

Previous topic

hanyuu

Next topic

abstractions Package

This Page