Readability improvements - #282
Open
guzzijones wants to merge 5 commits into
Open
Conversation
Contributor
Author
|
3.10 is missing some of the features i use. I will circle back later and fix those. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Readability-only cleanup pass across the conductor, graph, spec, state-machine
and event layers. These changes make the code easier to follow without
altering any design decision, runtime behavior, or the serialized wire format
that StackStorm persists to Mongo. Specifically:
TypedDict/NamedTupledefinitions instatetypes.py(RouteIdvsRouteDetails/RoutesRegistry,TaskTransition,TaskId,transition-id conventions), and added module/class/method docstrings and
annotations to
events.pyandmachines.pyexplaining the two statemachines and their
current status -> {event name -> new status}tables.TaskTransitionnamed tuple, so the conductor and graph readt.source/t.destination/t.key/t.datainstead oft[0..3].TaskTransitionis atuplesubclass, so positionalaccess, unpacking, sorting and set-dedup are unchanged. Likewise
extract_varsnow returns aContextVarnamed tuple.0used for the root context/route asconstants.ROOT_CONTEXT_INDEX/ROOT_ROUTE_ID, and the implicit retryattempt count as
DEFAULT_RETRY_COUNT.dictionary.first_itemhelper for the single-key-dict spec case,and switched
(errors, ctx)result handling to named unpacking.json_util.deepcopycall site isunchanged, and all shared payloads (context dicts, action dicts, edge
datadicts) remain the same references they were before — preserving thedeliberate no-copy coupling with StackStorm. The changes are allocation
neutral: the spec-rendering paths allocate slightly less (
first_itemavoids materializing
list(dict.items()); a redundant one-element slicewas removed), offsetting the one extra wrapper tuple per graph edge, whose
inner
datadict is never copied. All 865 unit tests pass unchanged.mocktest dependency in favor of the stdlibunittest.mock.