Skip to content

Issue 150 #151

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

Draft
wants to merge 7 commits into
base: trunk
Choose a base branch
from
Draft

Issue 150 #151

wants to merge 7 commits into from

Conversation

bandophahita
Copy link
Contributor

addresses #150

Copy link
Member

@perrygoy perrygoy left a comment

Choose a reason for hiding this comment

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

I think i like the separation to the is_silent checker-function, that feels pretty good and allows for more customization than my suggestion of putting the logic in get_additive_description. Nice idea! 👍

@@ -49,6 +49,7 @@ def Silently(duck: T) -> T:
)
"""
if settings.UNABRIDGED_NARRATION:
duck._silenced = False # type: ignore[attr-defined]
Copy link
Member

Choose a reason for hiding this comment

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

issue: I don't think this is necessary, and may actually cause a problem if the narration is only temporarily unabridged (like Loudly's implementation (which i just realized we never actually implemented—i'll get on that soon!)).

Copy link
Contributor

Choose a reason for hiding this comment

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

In that case wouldn't Loudly purposefully set False?
My thinking here is by setting the attribute at all, it marks the object as having been wrapped in Silently which is similar but distinct from whether or not it was actually made to be silent (e.g. UNABRIDGED was on vs off).
I just wasn't sure if that was something we might want.

Comment on lines 103 to 107
def is_silent(duck: Performable | Resolvable | Answerable) -> bool:
"""Check if a duck has been silenced."""
if isinstance(duck, Silenced):
return duck._silenced
return False
Copy link
Member

Choose a reason for hiding this comment

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

suggestion: I think this might belong in speech_tools.py instead of here. What do you think?

It just doesn't feel right to import is_silent from an Action file.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree. Speech tools didn't feel right either. Maybe we need a functions module? I hesitate to make something like "utils".

Copy link
Contributor

Choose a reason for hiding this comment

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

speech_tools, it is.



@runtime_checkable
class Silenced(Protocol):
Copy link
Member

Choose a reason for hiding this comment

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

question: Do we want to keep the -able postfix we've got for most of these? Unspeakable sounds kinda fun. :P

Copy link
Contributor

Choose a reason for hiding this comment

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

I thought about that too. I second guessed the use of Silenceable due to possible confusion between the distinction of "having been wrapped in Silently" vs is_silent.
Am I over thinking it or is there possibly another term that would describe without confusion?

Copy link
Contributor

Choose a reason for hiding this comment

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

The more I think about it.. I like the -able since it also helps drive the point that wrapped classes aren't strictly silent without knowing what UNABRIDGED_NARRATION was set to.


t = Either(mock_action1, Silently(mock_action2)).or_(
mock_action3, Silently(mock_action4)
)
Copy link
Member

Choose a reason for hiding this comment

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

nitpick: The nitpickiest of nitpicks, can you add a blank line after this one to separate the Act and Assert steps?

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

Successfully merging this pull request may close these issues.

3 participants