gensaschema._template module

Simple template abstraction

Simple template abstraction.

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._template.Template(template, dedent=True, rstrip=True)

Template container

IVariables
_templatestr

Template string

__dict__ = mappingproxy({'__module__': 'gensaschema._template', '__doc__': '\n Template container\n\n :IVariables:\n `_template` : ``str``\n Template string\n ', '__init__': <function Template.__init__>, 'expand': <function Template.expand>, '__dict__': <attribute '__dict__' of 'Template' objects>, '__weakref__': <attribute '__weakref__' of 'Template' objects>})
__init__(template, dedent=True, rstrip=True)

Initialization

Parameters
templatestr

Template string

dedentbool

Dedent automatically?

rstripbool

rstrip the template automatically?

__module__ = 'gensaschema._template'
__weakref__

list of weak references to the object (if defined)

expand(*args, **kwargs)

Expand the template

Either args or kwargs may be given, but not both. If nothing is given, nothing will be expanded.

Parameters
argstuple

Positional parameters to expand

kwargsdict

Keyword arguments to expand

Return

The expanded string

Rtype

str

Exceptions
  • TypeError : Both args and kwargs given