Skip to content

Commit

Permalink
Feature: add layout transformer & simplify unpacked (#972)
Browse files Browse the repository at this point in the history
* Feature: add layout transformers

The existing recursively_apply implementation is designed for one-off
layout modifications. There are a number of places where we might want
to visit multiple contents in a layout, and transform more than one of
them. This commit contains a new `LayoutTransformer` (and associated
`FunctionalTransformer` which implements a getfunction-like API) to
support this use case.

Classes were used rather than closures in order to cleanly handle the
mutual dependency of the transformer and the generic transformer routines
upon one another.

* Refactor: convert recursively_apply to use new transformer

* Refactor: replace `_packed` with `_pack_layout`

This operates on a single layout. We leverage the existing
recursion mechanism in `recursively_transform` to apply this
to an entire layout.

* Bugfix: Py27 use `super(cls, self)`

* Refactor: remove test for private function

* Refactor: replace class transformer with simple function
  • Loading branch information
agoose77 authored Jul 1, 2021
1 parent d3be0b1 commit 2958396
Show file tree
Hide file tree
Showing 3 changed files with 360 additions and 402 deletions.
Loading

0 comments on commit 2958396

Please sign in to comment.