gensaschema._config module

Schema config management

Schema config management.

Copyright

Copyright 2010 - 2019 André Malo or his licensors, as applicable

License

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class gensaschema._config.Config(tables, schemas, lines=None)

Schema config container

IVariables
tableslist

Table list

_linessequence

Original config lines (or None)

__dict__ = mappingproxy({'__module__': 'gensaschema._config', '__doc__': '\n Schema config container\n\n :IVariables:\n `tables` : ``list``\n Table list\n\n `_lines` : sequence\n Original config lines (or ``None``)\n ', '_CONFIG_TPL': <gensaschema._template.Template object>, '__init__': <function Config.__init__>, 'from_file': <classmethod object>, 'from_lines': <classmethod object>, 'from_parser': <classmethod object>, 'dump': <function Config.dump>, '__dict__': <attribute '__dict__' of 'Config' objects>, '__weakref__': <attribute '__weakref__' of 'Config' objects>})
__init__(tables, schemas, lines=None)

Initialization

Parameters
tableslist

Table list

schemasdict

(Alien) Schema mapping

linessequence

Original config lines. If omitted or None, the config lines are not available.

__module__ = 'gensaschema._config'
__weakref__

list of weak references to the object (if defined)

dump(fp)

Dump config to a file

Parameters
fpfile

Stream to dump to

classmethod from_file(name_or_file)

Construct from config file

Parameters
name_or_filestr or file

Config filename or file pointer

Return

New Config instance

Rtype

Config

Exceptions
  • IOError : Error reading the file (except for ENOENT, which treats the file as empty)

classmethod from_lines(lines)

Create from config lines

Parameters
linessequence

List of config lines

Return

New Config instance

Rtype

Config

classmethod from_parser(parser, lines=None)

Construct from config parser

Parameters
parserConfigParser.RawConfigParser

Configparser instance

linessequence

Original config lines

Return

New Config instance

Rtype

Config