zentropi

Copyright 2017 Harshad Sharma

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 zentropi.Events(callback=None)[source]
class Zentropian:
self.events = Events(callback=self._trigger_frame_handler)

zen.emit(‘event-name’, data={}, internal=False)

@zen.on_event(‘event-name’, parse=True) def handle_event_name(event):

pass
class zentropi.Field(default: typing.Any = None, *, name: typing.Union[str, NoneType] = None) → None[source]

A Field allows us to store data with extra information associated with it.

Example

>>> from zentropi import Field
>>> test_field = Field(42, name='the_answer')
>>> test_field.default
42
>>> test_field.value
42
>>> test_field.name
'the_answer'
>>> test_field.kind
'Field'
>>> test_field.describe()
{'kind': 'Field', 'name': 'the_answer', 'value': 42}
clean(value: typing.Any) → typing.Any[source]

Override: Convert types or clean up text; return cleaned value.

validate(value: typing.Any) → bool[source]

Override: Return True if given value is valid, this should only accept cleaned values and return False if the value is not valid. Alternatively, raise an exception.

class zentropi.KINDS[source]

An enumeration.