Repository navigation
Fix inaccurate references and examples in core docstrings - #3818
Merged
Merged
Conversation
AshNicolus
marked this pull request as ready for review
August 25, 2026 14:14
|
Performance benchmarks:
|
|
Performance benchmarks:
|
quaquel
approved these changes
Aug 26, 2026
Contributor
|
The API reference corrections are valid, but the signal examples still fail as executable doctests:
|
This was referenced Aug 26, 2026
EwoutH
pushed a commit
that referenced
this pull request
Oct 28, 2026
(cherry picked from commit 3b7bfdc)
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.
Four docstring inaccuracies in core modules, all verified against the code:
mesa/experimental/mesa_signals/signal_types.py: the ObservableSignals.CHANGED
and ListSignals.INSERTED examples accessed s.new and m.kwargs, which do not
exist on the Message dataclass (its payload lives in additional_kwargs).
Running the examples raised AttributeError. Fixed to s.additional_kwargs["new"]
and m.additional_kwargs["new"], which run and print the documented output.
mesa/agent.py: Agent.init_subclass was documented as "Called when
DatasetTrackedAgent is subclassed." DatasetTrackedAgent does not exist anywhere
in the codebase. Updated to describe what the method actually does (gives each
Agent subclass its own dataset set).
mesa/discrete_space/grid.py: the cells_with_capacity docstring referred to the
property as available_cells, which is not a real attribute. Corrected to
cells_with_capacity.
mesa/discrete_space/cell.py: Cell.get_neighborhood is annotated as and returns
a CellCollection, but the docstring described the return as "a list". Corrected
to CellCollection.
Docstrings only, no behavior change. Verified locally: full suite passes (739
tests), ruff check and format clean, and both corrected signal examples now run
and produce the documented output.