Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Adds default reads/writes to burr actions#269

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
elijahbenizzy wants to merge1 commit intomain
base:main
Choose a base branch
Loading
fromadd-default-write-read

Conversation

@elijahbenizzy
Copy link
Contributor

This allows you to specify defaults if your action does not write. In the majority of cases they will be none, but this allows simple (static) arbitrary values. This specifically helps with the branching case -- e.g. where you have two options, and want to null out anything it doesn't write. For instance, an error and a result -- you'll only ever produce one or the other.

This works both in the function and class-based approaches -- in the function-based it is part of the two decorators
(@action/@streaming_action). In the class-based it is part of the class, overriding the default_reads and default_writes property function

[Short description explaining the high-level reason for the pull request]

Changes

How I tested this

Notes

Checklist

  • PR has an informative and human-readable title (this will be pulled into the release notes)
  • Changes are limited to a single goal (no scope creep)
  • Code passed the pre-commit check & code is left cleaner/nicer than when first encountered.
  • Anychange in functionality is tested
  • New functions are documented (with a description, list of inputs, and expected output)
  • Placeholder code is flagged / future TODOs are captured in comments
  • Project documentation has been updated if adding/changing functionality.

@elijahbenizzyelijahbenizzy marked this pull request as draftJuly 16, 2024 18:40
Copy link
ContributorAuthor

@elijahbenizzyelijahbenizzy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Add some tests

@elijahbenizzyelijahbenizzyforce-pushed theadd-default-write-read branch 2 times, most recently fromce6ca20 to7a3e145CompareJuly 16, 2024 22:38
This allows you to specify defaults if your action does not write. Inthe majority of cases they will be none, but this allows simple (static)arbitrary values. This specifically helps with the branching case --e.g. where you have two options, and want to null out anything itdoesn't write. For instance, an error and a result -- you'll only everproduce one or the other.This works both in the function and class-based approaches -- in thefunction-based it is part of the two decorators(@action/@streaming_action). In the class-based it is part of the class,overriding the default_reads and default_writes property functionWe add a bunch of new tests for default (as the code to handle multipleaction types is fairly dispersed, for now), and also make the naming ofthe other tests/content more consistent.Note that this does not currently work with settings defaults toappend/increment operations -- it will produce strange behavior.This is documented in all appropriate signatures.This also does not work (or even make sense) in the case that thefunction writes a default that it also reads. In that case, it willclobber the current value with the write value. To avoid this,we just error out if that is the case beforehand.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

@elijahbenizzy

[8]ページ先頭

©2009-2025 Movatter.jp