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


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


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)
>>> time.sleep(5)
>>> bool(a)

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


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


Next topic

abstractions Package

This Page