gensaschema._template module
Simple template abstraction
Simple template abstraction.
- Copyright
Copyright 2010 - 2022 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)[source]
Template container
- _template
Template string
- Type
str
- __dict__ = mappingproxy({'__module__': 'gensaschema._template', '__doc__': '\n Template container\n\n Attributes:\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>, '__annotations__': {}})
- __init__(template, dedent=True, rstrip=True)[source]
Initialization
- Parameters
template (
str
) – Template stringdedent (
bool
) – Dedent automatically?rstrip (
bool
) – rstrip the template automatically?
- __module__ = 'gensaschema._template'
- __weakref__
list of weak references to the object (if defined)
- expand(*args, **kwargs)[source]
Expand the template
Either args or kwargs may be given, but not both. If nothing is given, nothing will be expanded.
- Parameters
args (
tuple
) – Positional parameters to expandkwargs (
dict
) – Keyword arguments to expand
- Returns
The expanded string
- Return type
str
- Raises
- TypeError – Both args and kwargs given