Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce decorator/decorated function coupling in _util._disallow_empty_tables() #11

Open
ChrisKeefe opened this issue May 21, 2020 · 0 comments

Comments

@ChrisKeefe
Copy link
Collaborator

Improvement Description
Reduce coupling by grabbing View type annotations from wrapped function signatures and using appropriate transformers instead of hard-coding acceptable view_types in the decorator.

Current Behavior
At present, _disallow_empty_tables is tightly coupled to the table view types specified by the functions it wraps. If a new view type is used for tables in a function, the decorator will need to be refactored to explicitly allow that view type.

Proposed Behavior
Introspect view type annotations in wrapped function signatures. Use get_transformer() to get a transformer to biom.Table. If none exists, fail on invalid view type/missing transformer. Else, transform to biom.Table and check is_empty() as currently.

Questions

  1. Should error messages here be developer-facing (e.g. no transformer exists from View type to biom.Table) or user facing as currently implemented?

Comments
Unless we see an increase in the number of possible table View types, this 'improvement' might just be over-engineering.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant