Skip to content

Commit

Permalink
Merge branch 'projectmesa:main' into experimental_propertygrid
Browse files Browse the repository at this point in the history
  • Loading branch information
haleelsada authored Mar 9, 2024
2 parents 32680d0 + de24299 commit cae3481
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 45 deletions.
8 changes: 3 additions & 5 deletions mesa/space.py
Original file line number Diff line number Diff line change
Expand Up @@ -763,16 +763,14 @@ class _PropertyGrid(_Grid):
Attributes:
properties (dict): A dictionary mapping property layer names to PropertyLayer instances.
empty_mask: Returns a boolean mask indicating empty cells on the grid.
empty_mask (np.ndarray): A boolean array indicating empty cells on the grid.
Methods:
add_property_layer(property_layer): Adds a new property layer to the grid.
remove_property_layer(property_name): Removes a property layer from the grid by its name.
get_neighborhood_mask(pos, moore, include_center, radius): Generates a boolean mask of the neighborhood.
select_cells_by_properties(conditions, mask, return_list): Selects cells based on multiple property conditions,
optionally with a mask, returning either a list of coordinates or a mask.
select_extreme_value_cells(property_name, mode, mask, return_list): Selects cells with extreme values of a property,
optionally with a mask, returning either a list of coordinates or a mask.
select_cells(conditions, extreme_values, masks, only_empty, return_list): Selects cells based on multiple conditions,
extreme values, masks, with an option to select only empty cells, returning either a list of coordinates or a mask.
Mask Usage:
Several methods in this class accept a mask as an input, which is a NumPy ndarray of boolean values. This mask
Expand Down
82 changes: 42 additions & 40 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ dynamic = ["version"]

[project.optional-dependencies]
dev = [
"ruff~=0.1.1", # Update periodically
"ruff~=0.1.1", # Update periodically
"coverage",
"pytest >= 4.6",
"pytest-cov",
Expand All @@ -62,7 +62,7 @@ docs = [
"pydata_sphinx_theme",
"seaborn",
"myst-nb",
"myst-parser", # Markdown in Sphinx
"myst-parser", # Markdown in Sphinx
]

[project.urls]
Expand All @@ -80,30 +80,36 @@ path = "mesa/__init__.py"

[tool.ruff]
# See https://github.com/charliermarsh/ruff#rules for error code definitions.
# Hardcode to Python 3.9.
# Reminder to update mesa-examples if the value below is changed.
target-version = "py39"
extend-exclude = ["docs", "build"]

[tool.ruff.lint]
select = [
# "ANN", # annotations TODO
"B", # bugbear
"C4", # comprehensions
"DTZ", # naive datetime
"E", # style errors
"F", # flakes
"I", # import sorting
"ISC", # string concatenation
"N", # naming
"PGH", # pygrep-hooks
"PIE", # miscellaneous
"PLC", # pylint convention
"PLE", # pylint error
# "PLR", # pylint refactor TODO
"PLW", # pylint warning
"Q", # quotes
"RUF", # Ruff
"S", # security
"SIM", # simplify
"T10", # debugger
"UP", # upgrade
"W", # style warnings
"YTT", # sys.version
# "ANN", # annotations TODO
"B", # bugbear
"C4", # comprehensions
"DTZ", # naive datetime
"E", # style errors
"F", # flakes
"I", # import sorting
"ISC", # string concatenation
"N", # naming
"PGH", # pygrep-hooks
"PIE", # miscellaneous
"PLC", # pylint convention
"PLE", # pylint error
# "PLR", # pylint refactor TODO
"PLW", # pylint warning
"Q", # quotes
"RUF", # Ruff
"S", # security
"SIM", # simplify
"T10", # debugger
"UP", # upgrade
"W", # style warnings
"YTT", # sys.version
]
# Ignore list taken from https://github.com/psf/black/blob/master/.flake8
# E203 Whitespace before ':'
Expand All @@ -114,19 +120,15 @@ select = [
# checks for it.
# See https://github.com/charliermarsh/ruff/issues/1842#issuecomment-1381210185
extend-ignore = [
"E501",
"S101", # Use of `assert` detected
"B017", # `assertRaises(Exception)` should be considered evil TODO
"PGH004", # Use specific rule codes when using `noqa` TODO
"B905", # `zip()` without an explicit `strict=` parameter
"N802", # Function name should be lowercase
"N999", # Invalid module name. We should revisit this in the future, TODO
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar` TODO
"S310", # Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
"S603", # `subprocess` call: check for execution of untrusted input
"ISC001", # ruff format asks to disable this feature
"E501",
"S101", # Use of `assert` detected
"B017", # `assertRaises(Exception)` should be considered evil TODO
"PGH004", # Use specific rule codes when using `noqa` TODO
"B905", # `zip()` without an explicit `strict=` parameter
"N802", # Function name should be lowercase
"N999", # Invalid module name. We should revisit this in the future, TODO
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar` TODO
"S310", # Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
"S603", # `subprocess` call: check for execution of untrusted input
"ISC001", # ruff format asks to disable this feature
]
extend-exclude = ["docs", "build"]
# Hardcode to Python 3.9.
# Reminder to update mesa-examples if the value below is changed.
target-version = "py39"

0 comments on commit cae3481

Please sign in to comment.