demberto / demberto/PyFLP

✨ Comprehensive bounds checking for event values

Open
#154 0 comments 0 reactions 1 assignee Claimed by @demberto View on GitHub
enhancement events
Dominant language
Python
Stars
212
Forks
30
PR merge metrics
No merged PRs in 30d

Description

### Problem

Till 2.2.0, non-`DATA` events had a value setter. In 2.2.0, I removed event value lazy evaluation entirely.

Now `value` is an attribute of `EventBase`. Structs as part of list events or child level structs didn't invoke any setters, as they were just dictionaries.

The earlier property setter failed with a `ConstructError` or `struct.Error` which was non descriptive of what really caused it.

### Ideas

Make `EventBase.value` a descriptor again. Instead of doing everything in `EventBase` *ctor*, shift the parsing logic to subclasses.

Make this descriptor take in a validator class. For struct-based events, wrap the parsed Container into a special dictionary descriptor which validates every \_\_setitem\_\_ with the correct construct.

List event values could have their own list descriptor wrapper over the struct dictionary descriptors.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.