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

space: Document empties property #1888

Merged
merged 2 commits into from
Nov 28, 2023
Merged

space: Document empties property #1888

merged 2 commits into from
Nov 28, 2023

Conversation

EwoutH
Copy link
Member

@EwoutH EwoutH commented Nov 27, 2023

Document the empties property in the Mesa Space module for the different Grids.

I might have overdone it a little, but that's in the spirit of PEP 20:

Explicit is better than implicit.

Only documentation changes, no functional ones.

Document the empties property in the Mesa Space module for the different Grids.

I might have overdone it a little, but that's in the spirit of PEP 20: Explicit is better than implicit.
Copy link

codecov bot commented Nov 27, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (70b2902) 77.10% compared to head (ce7bd30) 77.10%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1888   +/-   ##
=======================================
  Coverage   77.10%   77.10%           
=======================================
  Files          15       15           
  Lines         974      974           
  Branches      214      214           
=======================================
  Hits          751      751           
  Misses        195      195           
  Partials       28       28           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

mesa/space.py Outdated
@@ -526,6 +535,9 @@ class MultiGrid(_Grid):
bottom-left and [width-1, height-1] is the top-right. If a grid is
toroidal, the top and bottom, and left and right, edges wrap to each other.

Unlike SingleGrid, MultiGrid does not inherently track empty cells due to
Copy link
Contributor

Choose a reason for hiding this comment

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

empties are tracked in MultiGrid. MultiGrid inherits from _Grid, which defines the empties property.

In [1]: import mesa
g =
In [2]: g = mesa.space.MultiGrid(5,5,False)

In [3]: g.empties
Out[3]:
{(0, 0),
 (0, 1),
...

Copy link
Member Author

@EwoutH EwoutH Nov 27, 2023

Choose a reason for hiding this comment

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

You're right, will update that (also in HexMulti)

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated!

@rht rht merged commit 0ae1c8c into projectmesa:main Nov 28, 2023
11 checks passed
@rht
Copy link
Contributor

rht commented Nov 28, 2023

Merged, thank you.

@EwoutH EwoutH added the docs Release notes label label Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Release notes label
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants