oopnet.reader package

Subpackages

Submodules

oopnet.reader.decorators module

class oopnet.reader.decorators.ReaderDecorator(sectionname=None, functionname=None, priority=None, readerfunction=None)

Bases: object

Class for saving the reader function properties in a proper way with the decorators.

functionname: Optional[str] = None
priority: Optional[int] = None
readerfunction: Optional[Callable] = None
sectionname: Optional[str] = None
oopnet.reader.decorators.make_registering_decorator_factory(foreign_decorator_factory)
Parameters:

foreign_decorator_factory

Returns:

oopnet.reader.decorators.section_reader(*args, **kw)

Synchronization decorator.

Used to decorate factory functions and classes for the EPANET input file reader.The title marks the section in the input file and the priority is used for ordering the different factories.

Parameters:
  • title – section title

  • priority – reading priority

Returns:

section reader

oopnet.reader.module_reader module

oopnet.reader.module_reader.list_section_reader_callables(modules)

Lists all callables decorated with the section_reader decorator from a list of modules.

Parameters:

modules – list of modules to be checked for callables decorated with section_reader.

Return type:

list[Type[Callable]]

Returns:

List of callables decorated with section_reader.

oopnet.reader.module_reader.pred(c)

Checks if a class or function is decorated with section_reader.

Parameters:

c (Type[Callable]) – callable to be checked

Return type:

bool

Returns:

Returns True if the class or function is decorated with section_reader and False otherwise.

oopnet.reader.read module

oopnet.reader.read.filesplitter(content)

Reads an EPANET input file and splits the content into blocks.

Parameters:

content (list[str]) – EPANET input file content as str

Return type:

dict[str, list]

Returns:

blocks

oopnet.reader.read.read(network, filename=None, content=None)

Function reads an EPANET input file and returns a network object.

Parameters:
  • filename (Optional[str]) – filename of the EPANET input file

  • content (Optional[str]) – EPANET input file content as string

Return type:

Network

Returns:

network object

Module contents