Mesa 1.1.1__tar.gz → 1.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of Mesa might be problematic. Click here for more details.

Files changed (179) hide show
  1. {Mesa-1.1.1 → Mesa-1.2.0}/HISTORY.rst +81 -0
  2. {Mesa-1.1.1 → Mesa-1.2.0}/LICENSE +1 -1
  3. {Mesa-1.1.1 → Mesa-1.2.0/Mesa.egg-info}/PKG-INFO +13 -11
  4. {Mesa-1.1.1 → Mesa-1.2.0}/Mesa.egg-info/SOURCES.txt +1 -0
  5. {Mesa-1.1.1 → Mesa-1.2.0}/Mesa.egg-info/requires.txt +1 -1
  6. {Mesa-1.1.1/Mesa.egg-info → Mesa-1.2.0}/PKG-INFO +13 -11
  7. {Mesa-1.1.1 → Mesa-1.2.0}/README.rst +12 -10
  8. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/__init__.py +8 -9
  9. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/agent.py +2 -3
  10. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/batchrunner.py +16 -23
  11. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/datacollection.py +15 -28
  12. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/main.py +4 -4
  13. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/model.py +2 -6
  14. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/space.py +298 -225
  15. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/time.py +25 -24
  16. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/ModularVisualization.py +5 -8
  17. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/TextVisualization.py +0 -3
  18. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/UserParam.py +8 -11
  19. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/__init__.py +0 -1
  20. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/modules/BarChartVisualization.py +7 -8
  21. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/modules/CanvasGridVisualization.py +1 -3
  22. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/modules/ChartVisualization.py +2 -3
  23. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/modules/HexGridVisualization.py +1 -3
  24. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/modules/NetworkVisualization.py +1 -2
  25. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/modules/PieChartVisualization.py +2 -6
  26. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/js/GridDraw.js +5 -9
  27. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/js/HexDraw.js +5 -9
  28. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/js/InteractionHandler.js +0 -2
  29. Mesa-1.2.0/pyproject.toml +46 -0
  30. {Mesa-1.1.1 → Mesa-1.2.0}/setup.py +11 -11
  31. {Mesa-1.1.1 → Mesa-1.2.0}/tests/test_batchrunner.py +3 -4
  32. {Mesa-1.1.1 → Mesa-1.2.0}/tests/test_batchrunnerMP.py +4 -4
  33. {Mesa-1.1.1 → Mesa-1.2.0}/tests/test_datacollector.py +2 -2
  34. {Mesa-1.1.1 → Mesa-1.2.0}/tests/test_examples.py +8 -5
  35. {Mesa-1.1.1 → Mesa-1.2.0}/tests/test_grid.py +89 -36
  36. {Mesa-1.1.1 → Mesa-1.2.0}/tests/test_import_namespace.py +0 -1
  37. {Mesa-1.1.1 → Mesa-1.2.0}/tests/test_lifespan.py +4 -3
  38. {Mesa-1.1.1 → Mesa-1.2.0}/tests/test_main.py +5 -1
  39. {Mesa-1.1.1 → Mesa-1.2.0}/tests/test_scaffold.py +2 -1
  40. {Mesa-1.1.1 → Mesa-1.2.0}/tests/test_space.py +13 -20
  41. {Mesa-1.1.1 → Mesa-1.2.0}/tests/test_time.py +44 -14
  42. {Mesa-1.1.1 → Mesa-1.2.0}/tests/test_tornado.py +4 -2
  43. {Mesa-1.1.1 → Mesa-1.2.0}/tests/test_usersettableparam.py +4 -3
  44. {Mesa-1.1.1 → Mesa-1.2.0}/tests/test_visualization.py +4 -8
  45. {Mesa-1.1.1 → Mesa-1.2.0}/MANIFEST.in +0 -0
  46. {Mesa-1.1.1 → Mesa-1.2.0}/Mesa.egg-info/dependency_links.txt +0 -0
  47. {Mesa-1.1.1 → Mesa-1.2.0}/Mesa.egg-info/entry_points.txt +0 -0
  48. {Mesa-1.1.1 → Mesa-1.2.0}/Mesa.egg-info/not-zip-safe +0 -0
  49. {Mesa-1.1.1 → Mesa-1.2.0}/Mesa.egg-info/top_level.txt +0 -0
  50. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/cookiecutter-mesa/cookiecutter.json +0 -0
  51. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/flat/__init__.py +0 -0
  52. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/flat/visualization.py +0 -0
  53. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/modules/__init__.py +0 -0
  54. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/css/visualization.css +0 -0
  55. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-5.1.3-dist/css/bootstrap-grid.css +0 -0
  56. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-5.1.3-dist/css/bootstrap-grid.css.map +0 -0
  57. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-5.1.3-dist/css/bootstrap-grid.min.css +0 -0
  58. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-5.1.3-dist/css/bootstrap-grid.min.css.map +0 -0
  59. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-5.1.3-dist/css/bootstrap-grid.rtl.css +0 -0
  60. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-5.1.3-dist/css/bootstrap-grid.rtl.css.map +0 -0
  61. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-5.1.3-dist/css/bootstrap-grid.rtl.min.css +0 -0
  62. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-5.1.3-dist/css/bootstrap-grid.rtl.min.css.map +0 -0
  63. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-5.1.3-dist/css/bootstrap-reboot.css +0 -0
  64. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-5.1.3-dist/css/bootstrap-reboot.css.map +0 -0
  65. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-5.1.3-dist/css/bootstrap-reboot.min.css +0 -0
  66. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-5.1.3-dist/css/bootstrap-reboot.min.css.map +0 -0
  67. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-5.1.3-dist/css/bootstrap-reboot.rtl.css +0 -0
  68. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-5.1.3-dist/css/bootstrap-reboot.rtl.css.map +0 -0
  69. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-5.1.3-dist/css/bootstrap-reboot.rtl.min.css +0 -0
  70. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-5.1.3-dist/css/bootstrap-reboot.rtl.min.css.map +0 -0
  71. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-5.1.3-dist/css/bootstrap-utilities.css +0 -0
  72. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-5.1.3-dist/css/bootstrap-utilities.css.map +0 -0
  73. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-5.1.3-dist/css/bootstrap-utilities.min.css +0 -0
  74. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-5.1.3-dist/css/bootstrap-utilities.min.css.map +0 -0
  75. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-5.1.3-dist/css/bootstrap-utilities.rtl.css +0 -0
  76. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-5.1.3-dist/css/bootstrap-utilities.rtl.css.map +0 -0
  77. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-5.1.3-dist/css/bootstrap-utilities.rtl.min.css +0 -0
  78. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-5.1.3-dist/css/bootstrap-utilities.rtl.min.css.map +0 -0
  79. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-5.1.3-dist/css/bootstrap.css +0 -0
  80. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-5.1.3-dist/css/bootstrap.css.map +0 -0
  81. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-5.1.3-dist/css/bootstrap.min.css +0 -0
  82. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-5.1.3-dist/css/bootstrap.min.css.map +0 -0
  83. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-5.1.3-dist/css/bootstrap.rtl.css +0 -0
  84. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-5.1.3-dist/css/bootstrap.rtl.css.map +0 -0
  85. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-5.1.3-dist/css/bootstrap.rtl.min.css +0 -0
  86. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-5.1.3-dist/css/bootstrap.rtl.min.css.map +0 -0
  87. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-5.1.3-dist/js/bootstrap.bundle.js +0 -0
  88. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-5.1.3-dist/js/bootstrap.bundle.js.map +0 -0
  89. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-5.1.3-dist/js/bootstrap.bundle.min.js +0 -0
  90. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-5.1.3-dist/js/bootstrap.bundle.min.js.map +0 -0
  91. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-5.1.3-dist/js/bootstrap.esm.js +0 -0
  92. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-5.1.3-dist/js/bootstrap.esm.js.map +0 -0
  93. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-5.1.3-dist/js/bootstrap.esm.min.js +0 -0
  94. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-5.1.3-dist/js/bootstrap.esm.min.js.map +0 -0
  95. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-5.1.3-dist/js/bootstrap.js +0 -0
  96. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-5.1.3-dist/js/bootstrap.js.map +0 -0
  97. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-5.1.3-dist/js/bootstrap.min.js +0 -0
  98. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-5.1.3-dist/js/bootstrap.min.js.map +0 -0
  99. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/.github/CONTRIBUTING.md +0 -0
  100. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/.github/ISSUE_TEMPLATE.md +0 -0
  101. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  102. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/.gitignore +0 -0
  103. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/.npmignore +0 -0
  104. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/.npmrc +0 -0
  105. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/.nvmrc +0 -0
  106. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/.sass-lint.yml +0 -0
  107. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/.travis.yml +0 -0
  108. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/CHANGELOG.md +0 -0
  109. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/Gruntfile.js +0 -0
  110. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/LICENSE.md +0 -0
  111. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/README.md +0 -0
  112. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/bower.json +0 -0
  113. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/composer.json +0 -0
  114. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/dependencies/css/highlightjs-github-theme.css +0 -0
  115. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/dependencies/js/highlight.min.js +0 -0
  116. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/dependencies/js/jquery.min.js +0 -0
  117. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/dependencies/js/modernizr.js +0 -0
  118. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/dist/bootstrap-slider.js +0 -0
  119. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/dist/bootstrap-slider.min.js +0 -0
  120. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/dist/css/bootstrap-slider.css +0 -0
  121. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/dist/css/bootstrap-slider.min.css +0 -0
  122. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/package.json +0 -0
  123. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/scripts/build-preview.sh +0 -0
  124. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/scripts/release.sh +0 -0
  125. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/scripts/update-gh-pages.sh +0 -0
  126. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/src/js/bootstrap-slider.js +0 -0
  127. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/src/sass/_mixins.scss +0 -0
  128. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/src/sass/_rules.scss +0 -0
  129. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/src/sass/_variables.scss +0 -0
  130. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/src/sass/bootstrap-slider.scss +0 -0
  131. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/test/phantom_bind_polyfill.js +0 -0
  132. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/test/specs/AccessibilitySpec.js +0 -0
  133. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/test/specs/AriaValueTextFormatterSpec.js +0 -0
  134. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/test/specs/AutoRegisterDataProvideSpec.js +0 -0
  135. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/test/specs/ConflictingOptionsSpec.js +0 -0
  136. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/test/specs/DestroyMethodTests.js +0 -0
  137. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/test/specs/DraggingHandlesSpec.js +0 -0
  138. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/test/specs/ElementDataAttributesSpec.js +0 -0
  139. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/test/specs/EventsSpec.js +0 -0
  140. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/test/specs/FocusOptionSpec.js +0 -0
  141. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/test/specs/KeyboardSupportSpec.js +0 -0
  142. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/test/specs/LockToTicksSpec.js +0 -0
  143. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/test/specs/LogarithmicScaleSpec.js +0 -0
  144. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/test/specs/LowAndHighTrackSpec.js +0 -0
  145. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/test/specs/NamespaceSpec.js +0 -0
  146. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/test/specs/OrientationSpec.js +0 -0
  147. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/test/specs/PublicMethodsSpec.js +0 -0
  148. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/test/specs/RangeHighlightsSpec.js +0 -0
  149. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/test/specs/RefreshMethodSpec.js +0 -0
  150. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/test/specs/ResizeSpec.js +0 -0
  151. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/test/specs/RtlOptionsSpec.js +0 -0
  152. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/test/specs/ScrollableBodySpec.js +0 -0
  153. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/test/specs/ScrollableContainerSpec.js +0 -0
  154. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/test/specs/StepReachMaxValueSpec.js +0 -0
  155. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/test/specs/TickClickingBehaviorSpec.js +0 -0
  156. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/test/specs/TickLabelSpec.js +0 -0
  157. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/test/specs/TickMarksSpec.js +0 -0
  158. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/test/specs/TooltipMouseOverOptionSpec.js +0 -0
  159. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/test/specs/TooltipPositionOptionSpec.js +0 -0
  160. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/test/specs/TooltipSplitOptionSpec.js +0 -0
  161. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/test/specs/TouchCapableSpec.js +0 -0
  162. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/test/specs/offMethodSpec.js +0 -0
  163. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/tpl/SpecRunner.tpl +0 -0
  164. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/external/bootstrap-slider-11.0.2/tpl/index.tpl +0 -0
  165. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/js/BarChartModule.js +0 -0
  166. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/js/CanvasHexModule.js +0 -0
  167. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/js/CanvasModule.js +0 -0
  168. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/js/ChartModule.js +0 -0
  169. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/js/NetworkModule_d3.js +0 -0
  170. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/js/PieChartModule.js +0 -0
  171. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/js/TextModule.js +0 -0
  172. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/js/external/chart-3.6.1.min.js +0 -0
  173. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/js/external/d3-7.4.3.min.js +0 -0
  174. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/js/runcontrol.js +0 -0
  175. {Mesa-1.1.1 → Mesa-1.2.0}/mesa/visualization/templates/modular_template.html +0 -0
  176. {Mesa-1.1.1 → Mesa-1.2.0}/setup.cfg +0 -0
  177. {Mesa-1.1.1 → Mesa-1.2.0}/tests/__init__.py +0 -0
  178. {Mesa-1.1.1 → Mesa-1.2.0}/tests/test_batch_run.py +0 -0
  179. {Mesa-1.1.1 → Mesa-1.2.0}/tests/test_model.py +0 -0
@@ -3,6 +3,87 @@
3
3
  Release History
4
4
  ---------------
5
5
 
6
+
7
+ 1.2.0 (2023-03-09) Taylor
8
+ ++++++++++++++++++++++++++
9
+
10
+ **Special notes**
11
+
12
+ New features:
13
+
14
+ * Implement radius for NetworkGrid.get_neighbors #1564
15
+
16
+ Some highlights for the perf improvements:
17
+
18
+ * Use getattr for attribute strings in model data collection #1590 this is a 2x speedup over the relevant line
19
+ * Faster is_integer function for common cases #1597 is for 1.3x speedup for grid access (grid[x, y])
20
+ * Refactor iter/get_cell_list_contents methods #1570 at least 1.3x speedup for iter/get_cell_list_contents
21
+ * Evaluate empties set more lazily #1546 (comment) ~1.3x speedup for place_agent, remove_agent, and move_agent
22
+
23
+ **Improvements**
24
+
25
+ * ci: Add testing on Python 3.11 #1519
26
+ * Remove auto-update GH Actions for Pipfile.lock #1558
27
+ * ruff
28
+ * ruff: Add isort #1594
29
+ * ci: Replace flake8 with Ruff #1587
30
+ * ruff: Add more rules based on Zulip's config #1596
31
+ * perf: faster is_integer function for common cases #1597
32
+ * Remove _reporter_decorator #1591
33
+ * Change index at DataFrame creation in get_agent_vars_dataframe #1586
34
+ * Make Grid class private #1575
35
+ * Make the internal grid and empties_built in Grid class private #1568
36
+ * Simplify code in ContinuousSpace #1536
37
+ * Improve docstrings of ContinuousSpace #1535
38
+ * Simplify accept_tuple_argument decorator in space.py #1531
39
+ * Enhance schedulers to support intra-step removal of agents #1523
40
+ * perf: Refactor iter_cell_list_contents Performance #1527
41
+ * Replace two loops with dictionary comprehension, list- with generator comprehension #1458
42
+ * Make MultiGrid.place_agent faster #1508
43
+ * Update space module-level docstring summary #1518
44
+ * Update NetworkGrid.__init__ docstring #1514
45
+ * Deprecate SingleGrid.position_agent #1512
46
+ * Make swap_pos part of Grid instead of SingleGrid #1507
47
+ * Refactor NetworkGrid docstrings and iter/get_cell_list_contents #1498
48
+ * Hexgrid: use get_neighborhood in iter_neighbors #1504
49
+ * Auto update year for copyright in docs #1503
50
+ * Refactor Grid.move_to_empty #1482
51
+ * Put "Mesa" instead of "it" in README #1490
52
+ * Batchrunner: Remove unnecessary dict transformation, .keys() in len() #1460
53
+ * Add Dependabot configuration for GitHub Actions update check #1480
54
+ * Use list transformation only when shuffled is True #1478
55
+ * Implement swap_pos #1474
56
+ * Clean up DataCollector #1475
57
+
58
+
59
+ **Fixes**
60
+
61
+ * Update resources in README #1605
62
+ * Fix accident from https://github.com/projectmesa/mesa/pull/1488 #1489
63
+ * pre-commit autoupdate #1598, #1576, #1548, #1494
64
+ * Fix docstring of DataCollector #1592
65
+ * Update Pipfile.lock (dependencies) #1495 #1487
66
+ * build(deps):
67
+ * build(deps): bump codecov/codecov-action from 2 to 3 dependencies Pull requests that update a dependency file #1486
68
+ * build(deps): bump actions/upload-artifact from 2 to 3 dependencies Pull requests that update a dependency file #1485
69
+ * build(deps): bump peter-evans/create-pull-request from 3 to 4 dependencies Pull requests that update a dependency file #1484
70
+ * build(deps): bump actions/setup-python from 3 to 4 dependencies Pull requests that update a dependency file #1483
71
+ * Establish reproducibility for NetworkGrid.get_neighbors when radius > 1 #1569
72
+ * Format js code #1554
73
+ * Add some missing const declarations #1549
74
+ * fix tutorial url in examples #1538
75
+ * Update cookiecutter to flat import style. #1525
76
+ * Fix bug in Grid.get_neighborhood #1517
77
+ * Revert changes of #1478 and #1456 #1516
78
+ * Fix return types of some NetworkGrid methods #1505
79
+ * Update year for copyright #1501
80
+ * Add default_value function to NetworkGrid #1497
81
+ * Remove extraneous spaces from docstrings in modules 2 #1496
82
+ * Remove extraneous spaces from docstrings in modules #1493
83
+ * SingleGrid: Remove extraneous attribute declaration (empties) #1491
84
+
85
+
86
+
6
87
  1.1.1 (2022-10-21)
7
88
  ++++++++++++++++++
8
89
 
@@ -1,4 +1,4 @@
1
- Copyright 2021 Core Mesa Team and contributors
1
+ Copyright 2022 Core Mesa Team and contributors
2
2
 
3
3
  Licensed under the Apache License, Version 2.0 (the "License");
4
4
  you may not use this file except in compliance with the License.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: Mesa
3
- Version: 1.1.1
3
+ Version: 1.2.0
4
4
  Summary: Agent-based modeling (ABM) in Python 3+
5
5
  Home-page: https://github.com/projectmesa/mesa
6
6
  Author: Project Mesa Team
@@ -39,7 +39,7 @@ Mesa: Agent-based modeling in Python 3+
39
39
  .. image:: https://img.shields.io/matrix/project-mesa:matrix.org?label=chat&logo=Matrix
40
40
  :target: https://matrix.to/#/#project-mesa:matrix.org
41
41
 
42
- It allows users to quickly create agent-based models using built-in core components (such as spatial grids and agent schedulers) or customized implementations; visualize them using a browser-based interface; and analyze their results using Python's data analysis tools. Its goal is to be the Python 3-based alternative to NetLogo, Repast, or MASON.
42
+ Mesa allows users to quickly create agent-based models using built-in core components (such as spatial grids and agent schedulers) or customized implementations; visualize them using a browser-based interface; and analyze their results using Python's data analysis tools. Its goal is to be the Python 3-based alternative to NetLogo, Repast, or MASON.
43
43
 
44
44
 
45
45
  .. image:: https://raw.githubusercontent.com/projectmesa/mesa/main/docs/images/Mesa_Screenshot.png
@@ -83,19 +83,21 @@ Or any other (development) branch on this repo or your own fork:
83
83
 
84
84
  $ pip install -U -e git+https://github.com/YOUR_FORK/mesa@YOUR_BRANCH#egg=mesa
85
85
 
86
- Take a look at the `examples <https://github.com/projectmesa/mesa/tree/main/examples>`_ folder for sample models demonstrating Mesa features.
86
+ For resources or help on using Mesa, check out the following:
87
87
 
88
- For more help on using Mesa, check out the following resources:
89
-
90
- * `Intro to Mesa Tutorial`_
91
- * `Docs`_
92
- * `Email list for users`_
93
- * `PyPI`_
88
+ * `Intro to Mesa Tutorial`_ (An introductory model, the Boltzmann Wealth Model, for beginners or those new to Mesa.)
89
+ * `Complexity Explorer Tutorial`_ (An advanced-beginner model, SugarScape with Traders, with instructional videos)
90
+ * `Mesa Examples`_ (A repository of seminal ABMs using Mesa and examples of employing specific Mesa Features)
91
+ * `Docs`_ (Mesa's documentation, API and useful snippets)
92
+ * `Discussions`_ (GitHub threaded discussions about Mesa)
93
+ * `Matrix Chat`_ (Chat Forum via Matrix to talk about Mesa)
94
94
 
95
95
  .. _`Intro to Mesa Tutorial` : http://mesa.readthedocs.org/en/main/tutorials/intro_tutorial.html
96
+ .. _`Complexity Explorer Tutorial` : https://www.complexityexplorer.org/courses/172-agent-based-models-with-python-an-introduction-to-mesa
97
+ .. _`Mesa Examples` : https://github.com/projectmesa/mesa-examples/tree/main/examples
96
98
  .. _`Docs` : http://mesa.readthedocs.org/en/main/
97
- .. _`Email list for users` : https://groups.google.com/d/forum/projectmesa
98
- .. _`PyPI` : https://pypi.python.org/pypi/Mesa/
99
+ .. _`Discussions` : https://github.com/projectmesa/mesa/discussions
100
+ .. _`Matrix Chat` : https://matrix.to/#/#project-mesa:matrix.org
99
101
 
100
102
  Running Mesa in Docker
101
103
  ------------------------
@@ -2,6 +2,7 @@ HISTORY.rst
2
2
  LICENSE
3
3
  MANIFEST.in
4
4
  README.rst
5
+ pyproject.toml
5
6
  setup.py
6
7
  Mesa.egg-info/PKG-INFO
7
8
  Mesa.egg-info/SOURCES.txt
@@ -8,8 +8,8 @@ tqdm
8
8
 
9
9
  [dev]
10
10
  black
11
+ ruff
11
12
  coverage
12
- flake8
13
13
  pytest>=4.6
14
14
  pytest-cov
15
15
  sphinx
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: Mesa
3
- Version: 1.1.1
3
+ Version: 1.2.0
4
4
  Summary: Agent-based modeling (ABM) in Python 3+
5
5
  Home-page: https://github.com/projectmesa/mesa
6
6
  Author: Project Mesa Team
@@ -39,7 +39,7 @@ Mesa: Agent-based modeling in Python 3+
39
39
  .. image:: https://img.shields.io/matrix/project-mesa:matrix.org?label=chat&logo=Matrix
40
40
  :target: https://matrix.to/#/#project-mesa:matrix.org
41
41
 
42
- It allows users to quickly create agent-based models using built-in core components (such as spatial grids and agent schedulers) or customized implementations; visualize them using a browser-based interface; and analyze their results using Python's data analysis tools. Its goal is to be the Python 3-based alternative to NetLogo, Repast, or MASON.
42
+ Mesa allows users to quickly create agent-based models using built-in core components (such as spatial grids and agent schedulers) or customized implementations; visualize them using a browser-based interface; and analyze their results using Python's data analysis tools. Its goal is to be the Python 3-based alternative to NetLogo, Repast, or MASON.
43
43
 
44
44
 
45
45
  .. image:: https://raw.githubusercontent.com/projectmesa/mesa/main/docs/images/Mesa_Screenshot.png
@@ -83,19 +83,21 @@ Or any other (development) branch on this repo or your own fork:
83
83
 
84
84
  $ pip install -U -e git+https://github.com/YOUR_FORK/mesa@YOUR_BRANCH#egg=mesa
85
85
 
86
- Take a look at the `examples <https://github.com/projectmesa/mesa/tree/main/examples>`_ folder for sample models demonstrating Mesa features.
86
+ For resources or help on using Mesa, check out the following:
87
87
 
88
- For more help on using Mesa, check out the following resources:
89
-
90
- * `Intro to Mesa Tutorial`_
91
- * `Docs`_
92
- * `Email list for users`_
93
- * `PyPI`_
88
+ * `Intro to Mesa Tutorial`_ (An introductory model, the Boltzmann Wealth Model, for beginners or those new to Mesa.)
89
+ * `Complexity Explorer Tutorial`_ (An advanced-beginner model, SugarScape with Traders, with instructional videos)
90
+ * `Mesa Examples`_ (A repository of seminal ABMs using Mesa and examples of employing specific Mesa Features)
91
+ * `Docs`_ (Mesa's documentation, API and useful snippets)
92
+ * `Discussions`_ (GitHub threaded discussions about Mesa)
93
+ * `Matrix Chat`_ (Chat Forum via Matrix to talk about Mesa)
94
94
 
95
95
  .. _`Intro to Mesa Tutorial` : http://mesa.readthedocs.org/en/main/tutorials/intro_tutorial.html
96
+ .. _`Complexity Explorer Tutorial` : https://www.complexityexplorer.org/courses/172-agent-based-models-with-python-an-introduction-to-mesa
97
+ .. _`Mesa Examples` : https://github.com/projectmesa/mesa-examples/tree/main/examples
96
98
  .. _`Docs` : http://mesa.readthedocs.org/en/main/
97
- .. _`Email list for users` : https://groups.google.com/d/forum/projectmesa
98
- .. _`PyPI` : https://pypi.python.org/pypi/Mesa/
99
+ .. _`Discussions` : https://github.com/projectmesa/mesa/discussions
100
+ .. _`Matrix Chat` : https://matrix.to/#/#project-mesa:matrix.org
99
101
 
100
102
  Running Mesa in Docker
101
103
  ------------------------
@@ -13,7 +13,7 @@ Mesa: Agent-based modeling in Python 3+
13
13
  .. image:: https://img.shields.io/matrix/project-mesa:matrix.org?label=chat&logo=Matrix
14
14
  :target: https://matrix.to/#/#project-mesa:matrix.org
15
15
 
16
- It allows users to quickly create agent-based models using built-in core components (such as spatial grids and agent schedulers) or customized implementations; visualize them using a browser-based interface; and analyze their results using Python's data analysis tools. Its goal is to be the Python 3-based alternative to NetLogo, Repast, or MASON.
16
+ Mesa allows users to quickly create agent-based models using built-in core components (such as spatial grids and agent schedulers) or customized implementations; visualize them using a browser-based interface; and analyze their results using Python's data analysis tools. Its goal is to be the Python 3-based alternative to NetLogo, Repast, or MASON.
17
17
 
18
18
 
19
19
  .. image:: https://raw.githubusercontent.com/projectmesa/mesa/main/docs/images/Mesa_Screenshot.png
@@ -57,19 +57,21 @@ Or any other (development) branch on this repo or your own fork:
57
57
 
58
58
  $ pip install -U -e git+https://github.com/YOUR_FORK/mesa@YOUR_BRANCH#egg=mesa
59
59
 
60
- Take a look at the `examples <https://github.com/projectmesa/mesa/tree/main/examples>`_ folder for sample models demonstrating Mesa features.
60
+ For resources or help on using Mesa, check out the following:
61
61
 
62
- For more help on using Mesa, check out the following resources:
63
-
64
- * `Intro to Mesa Tutorial`_
65
- * `Docs`_
66
- * `Email list for users`_
67
- * `PyPI`_
62
+ * `Intro to Mesa Tutorial`_ (An introductory model, the Boltzmann Wealth Model, for beginners or those new to Mesa.)
63
+ * `Complexity Explorer Tutorial`_ (An advanced-beginner model, SugarScape with Traders, with instructional videos)
64
+ * `Mesa Examples`_ (A repository of seminal ABMs using Mesa and examples of employing specific Mesa Features)
65
+ * `Docs`_ (Mesa's documentation, API and useful snippets)
66
+ * `Discussions`_ (GitHub threaded discussions about Mesa)
67
+ * `Matrix Chat`_ (Chat Forum via Matrix to talk about Mesa)
68
68
 
69
69
  .. _`Intro to Mesa Tutorial` : http://mesa.readthedocs.org/en/main/tutorials/intro_tutorial.html
70
+ .. _`Complexity Explorer Tutorial` : https://www.complexityexplorer.org/courses/172-agent-based-models-with-python-an-introduction-to-mesa
71
+ .. _`Mesa Examples` : https://github.com/projectmesa/mesa-examples/tree/main/examples
70
72
  .. _`Docs` : http://mesa.readthedocs.org/en/main/
71
- .. _`Email list for users` : https://groups.google.com/d/forum/projectmesa
72
- .. _`PyPI` : https://pypi.python.org/pypi/Mesa/
73
+ .. _`Discussions` : https://github.com/projectmesa/mesa/discussions
74
+ .. _`Matrix Chat` : https://matrix.to/#/#project-mesa:matrix.org
73
75
 
74
76
  Running Mesa in Docker
75
77
  ------------------------
@@ -2,18 +2,16 @@
2
2
  Mesa Agent-Based Modeling Framework
3
3
 
4
4
  Core Objects: Model, and Agent.
5
-
6
5
  """
7
6
  import datetime
8
7
 
9
- from mesa.model import Model
10
- from mesa.agent import Agent
11
-
12
- import mesa.time as time
13
- import mesa.space as space
14
8
  import mesa.flat.visualization as visualization
9
+ import mesa.space as space
10
+ import mesa.time as time
11
+ from mesa.agent import Agent
12
+ from mesa.batchrunner import batch_run
15
13
  from mesa.datacollection import DataCollector
16
- from mesa.batchrunner import batch_run # noqa
14
+ from mesa.model import Model
17
15
 
18
16
  __all__ = [
19
17
  "Model",
@@ -26,6 +24,7 @@ __all__ = [
26
24
  ]
27
25
 
28
26
  __title__ = "mesa"
29
- __version__ = "1.1.1"
27
+ __version__ = "1.2.0"
30
28
  __license__ = "Apache 2.0"
31
- __copyright__ = f"Copyright {datetime.date.today().year} Project Mesa Team"
29
+ _this_year = datetime.datetime.now(tz=datetime.timezone.utc).date().year
30
+ __copyright__ = f"Copyright {_this_year} Project Mesa Team"
@@ -2,15 +2,15 @@
2
2
  The agent class for Mesa framework.
3
3
 
4
4
  Core Objects: Agent
5
-
6
5
  """
7
6
  # Mypy; for the `|` operator purpose
8
7
  # Remove this __future__ import once the oldest supported Python is 3.10
9
8
  from __future__ import annotations
10
9
 
10
+ from random import Random
11
+
11
12
  # mypy
12
13
  from typing import TYPE_CHECKING
13
- from random import Random
14
14
 
15
15
  if TYPE_CHECKING:
16
16
  # We ensure that these are not imported during runtime to prevent cyclic
@@ -35,7 +35,6 @@ class Agent:
35
35
 
36
36
  def step(self) -> None:
37
37
  """A single step of the agent."""
38
- pass
39
38
 
40
39
  def advance(self) -> None:
41
40
  pass
@@ -3,7 +3,6 @@ Batchrunner
3
3
  ===========
4
4
 
5
5
  A single class to manage a batch run or parameter sweep of a given model.
6
-
7
6
  """
8
7
  import copy
9
8
  import itertools
@@ -11,7 +10,6 @@ import random
11
10
  from functools import partial
12
11
  from itertools import count, product
13
12
  from multiprocessing import Pool, cpu_count
14
- from warnings import warn
15
13
  from typing import (
16
14
  Any,
17
15
  Dict,
@@ -23,6 +21,7 @@ from typing import (
23
21
  Type,
24
22
  Union,
25
23
  )
24
+ from warnings import warn
26
25
 
27
26
  import pandas as pd
28
27
  from tqdm import tqdm
@@ -284,14 +283,13 @@ class FixedBatchRunner:
284
283
  collected at the level of each agent present in the model at
285
284
  the end of the run.
286
285
  display_progress: Display progress bar with time estimation?
287
-
288
286
  """
289
287
  self.model_cls = model_cls
290
288
  if parameters_list is None:
291
289
  parameters_list = []
292
290
  self.parameters_list = list(parameters_list)
293
291
  self.fixed_parameters = fixed_parameters or {}
294
- self._include_fixed = len(self.fixed_parameters.keys()) > 0
292
+ self._include_fixed = len(self.fixed_parameters) > 0
295
293
  self.iterations = iterations
296
294
  self.max_steps = max_steps
297
295
 
@@ -359,7 +357,7 @@ class FixedBatchRunner:
359
357
  model = self.model_cls(**kwargs)
360
358
  results = self.run_model(model)
361
359
  if param_values is not None:
362
- model_key = tuple(param_values) + (run_count,)
360
+ model_key = (*tuple(param_values), run_count)
363
361
  else:
364
362
  model_key = (run_count,)
365
363
 
@@ -368,7 +366,7 @@ class FixedBatchRunner:
368
366
  if self.agent_reporters:
369
367
  agent_vars = self.collect_agent_vars(model)
370
368
  for agent_id, reports in agent_vars.items():
371
- agent_key = model_key + (agent_id,)
369
+ agent_key = (*model_key, agent_id)
372
370
  self.agent_vars[agent_key] = reports
373
371
  # Collects data from datacollector object in model
374
372
  if results is not None:
@@ -393,7 +391,6 @@ class FixedBatchRunner:
393
391
 
394
392
  If your model runs in a non-standard way, this is the method to modify
395
393
  in your subclass.
396
-
397
394
  """
398
395
  while model.running and model.schedule.steps < self.max_steps:
399
396
  model.step()
@@ -405,19 +402,19 @@ class FixedBatchRunner:
405
402
 
406
403
  def collect_model_vars(self, model):
407
404
  """Run reporters and collect model-level variables."""
408
- model_vars = {}
409
- for var, reporter in self.model_reporters.items():
410
- model_vars[var] = reporter(model)
411
-
405
+ model_vars = {
406
+ var: reporter(model) for var, reporter in self.model_reporters.items()
407
+ }
412
408
  return model_vars
413
409
 
414
410
  def collect_agent_vars(self, model):
415
411
  """Run reporters and collect agent-level variables."""
416
412
  agent_vars = {}
417
413
  for agent in model.schedule._agents.values():
418
- agent_record = {}
419
- for var, reporter in self.agent_reporters.items():
420
- agent_record[var] = getattr(agent, reporter)
414
+ agent_record = {
415
+ var: getattr(agent, reporter)
416
+ for var, reporter in self.agent_reporters.items()
417
+ }
421
418
  agent_vars[agent.unique_id] = agent_record
422
419
  return agent_vars
423
420
 
@@ -469,12 +466,10 @@ class FixedBatchRunner:
469
466
 
470
467
  df = pd.DataFrame(records)
471
468
  rest_cols = set(df.columns) - set(index_cols)
472
- ordered = df[index_cols + list(sorted(rest_cols))]
469
+ ordered = df[index_cols + sorted(rest_cols)]
473
470
  ordered.sort_values(by="Run", inplace=True)
474
471
  if self._include_fixed:
475
- for param in self.fixed_parameters.keys():
476
- val = self.fixed_parameters[param]
477
-
472
+ for param, val in self.fixed_parameters.items():
478
473
  # avoid error when val is an iterable
479
474
  vallist = [val for i in range(ordered.shape[0])]
480
475
  ordered[param] = vallist
@@ -537,7 +532,6 @@ class BatchRunner(FixedBatchRunner):
537
532
  Note that by default, the reporters only collect data at the *end* of the
538
533
  run. To get step by step data, simply have a reporter store the model's
539
534
  entire DataCollector object.
540
-
541
535
  """
542
536
 
543
537
  def __init__(
@@ -580,7 +574,6 @@ class BatchRunner(FixedBatchRunner):
580
574
  collected at the level of each agent present in the model at
581
575
  the end of the run.
582
576
  display_progress: Display progress bar with time estimation?
583
-
584
577
  """
585
578
  warn(
586
579
  "BatchRunner class has been replaced by batch_run function. Please see documentation.",
@@ -720,7 +713,7 @@ class BatchRunnerMP(BatchRunner): # pragma: no cover
720
713
  if self.agent_reporters:
721
714
  agent_vars = self.collect_agent_vars(model)
722
715
  for agent_id, reports in agent_vars.items():
723
- agent_key = model_key + (agent_id,)
716
+ agent_key = (*model_key, agent_id)
724
717
  self.agent_vars[agent_key] = reports
725
718
  if hasattr(model, "datacollector"):
726
719
  if model.datacollector.model_reporters is not None:
@@ -733,9 +726,9 @@ class BatchRunnerMP(BatchRunner): # pragma: no cover
733
726
  ] = model.datacollector.get_agent_vars_dataframe()
734
727
 
735
728
  # Make results consistent
736
- if len(self.datacollector_model_reporters.keys()) == 0:
729
+ if len(self.datacollector_model_reporters) == 0:
737
730
  self.datacollector_model_reporters = None
738
- if len(self.datacollector_agent_reporters.keys()) == 0:
731
+ if len(self.datacollector_agent_reporters) == 0:
739
732
  self.datacollector_agent_reporters = None
740
733
 
741
734
  def run_all(self):
@@ -33,13 +33,13 @@ The default DataCollector here makes several assumptions:
33
33
  * The model has a schedule object called 'schedule'
34
34
  * The schedule has an agent list called agents
35
35
  * For collecting agent-level variables, agents must have a unique_id
36
-
37
36
  """
38
- from functools import partial
39
37
  import itertools
38
+ import types
39
+ from functools import partial
40
40
  from operator import attrgetter
41
+
41
42
  import pandas as pd
42
- import types
43
43
 
44
44
 
45
45
  class DataCollector:
@@ -50,11 +50,8 @@ class DataCollector:
50
50
  functions which actually collect them. When the collect(...) method is
51
51
  called, it collects these attributes and executes these functions one by
52
52
  one and stores the results.
53
-
54
53
  """
55
54
 
56
- model = None
57
-
58
55
  def __init__(self, model_reporters=None, agent_reporters=None, tables=None):
59
56
  """Instantiate a DataCollector with lists of model and agent reporters.
60
57
  Both model_reporters and agent_reporters accept a dictionary mapping a
@@ -87,13 +84,13 @@ class DataCollector:
87
84
  Model reporters can take four types of arguments:
88
85
  lambda like above:
89
86
  {"agent_count": lambda m: m.schedule.get_agent_count() }
90
- method with @property decorators
91
- {"agent_count": schedule.get_agent_count()
92
- class attributes of model
87
+ method of a class/instance:
88
+ {"agent_count": self.get_agent_count} # self here is a class instance
89
+ {"agent_count": Model.get_agent_count} # Model here is a class
90
+ class attributes of a model
93
91
  {"model_attribute": "model_attribute"}
94
92
  functions with parameters that have placed in a list
95
93
  {"Model_Function":[function, [param_1, param_2]]}
96
-
97
94
  """
98
95
  self.model_reporters = {}
99
96
  self.agent_reporters = {}
@@ -122,8 +119,6 @@ class DataCollector:
122
119
  reporter: Attribute string, or function object that returns the
123
120
  variable when given a model instance.
124
121
  """
125
- if type(reporter) is str:
126
- reporter = partial(self._getattr, reporter)
127
122
  self.model_reporters[name] = reporter
128
123
  self.model_vars[name] = []
129
124
 
@@ -134,7 +129,6 @@ class DataCollector:
134
129
  name: Name of the agent-level variable to collect.
135
130
  reporter: Attribute string, or function object that returns the
136
131
  variable when given a model instance.
137
-
138
132
  """
139
133
  if type(reporter) is str:
140
134
  attribute_name = reporter
@@ -148,7 +142,6 @@ class DataCollector:
148
142
  Args:
149
143
  table_name: Name of the new table.
150
144
  table_columns: List of columns to add to the table.
151
-
152
145
  """
153
146
  new_table = {column: [] for column in table_columns}
154
147
  self.tables[table_name] = new_table
@@ -156,7 +149,7 @@ class DataCollector:
156
149
  def _record_agents(self, model):
157
150
  """Record agents data in a mapping of functions and agents."""
158
151
  rep_funcs = self.agent_reporters.values()
159
- if all([hasattr(rep, "attribute_name") for rep in rep_funcs]):
152
+ if all(hasattr(rep, "attribute_name") for rep in rep_funcs):
160
153
  prefix = ["model.schedule.steps", "unique_id"]
161
154
  attributes = [func.attribute_name for func in rep_funcs]
162
155
  get_reports = attrgetter(*prefix + attributes)
@@ -170,25 +163,23 @@ class DataCollector:
170
163
  agent_records = map(get_reports, model.schedule.agents)
171
164
  return agent_records
172
165
 
173
- def _reporter_decorator(self, reporter):
174
- return reporter()
175
-
176
166
  def collect(self, model):
177
167
  """Collect all the data for the given model object."""
178
168
  if self.model_reporters:
179
-
180
169
  for var, reporter in self.model_reporters.items():
181
170
  # Check if Lambda operator
182
171
  if isinstance(reporter, types.LambdaType):
183
172
  self.model_vars[var].append(reporter(model))
184
173
  # Check if model attribute
185
- elif isinstance(reporter, partial):
186
- self.model_vars[var].append(reporter(model))
174
+ elif isinstance(reporter, str):
175
+ self.model_vars[var].append(getattr(model, reporter, None))
187
176
  # Check if function with arguments
188
177
  elif isinstance(reporter, list):
189
178
  self.model_vars[var].append(reporter[0](*reporter[1]))
179
+ # TODO: Check if method of a class, as of now it is assumed
180
+ # implicitly if the other checks fail.
190
181
  else:
191
- self.model_vars[var].append(self._reporter_decorator(reporter))
182
+ self.model_vars[var].append(reporter())
192
183
 
193
184
  if self.agent_reporters:
194
185
  agent_records = self._record_agents(model)
@@ -202,7 +193,6 @@ class DataCollector:
202
193
  row: A dictionary of the form {column_name: value...}
203
194
  ignore_missing: If True, fill any missing columns with Nones;
204
195
  if False, throw an error if any columns are missing
205
-
206
196
  """
207
197
  if table_name not in self.tables:
208
198
  raise Exception("Table does not exist.")
@@ -225,7 +215,6 @@ class DataCollector:
225
215
 
226
216
  The DataFrame has one column for each model variable, and the index is
227
217
  (implicitly) the model tick.
228
-
229
218
  """
230
219
  return pd.DataFrame(self.model_vars)
231
220
 
@@ -234,16 +223,15 @@ class DataCollector:
234
223
 
235
224
  The DataFrame has one column for each variable, with two additional
236
225
  columns for tick and agent_id.
237
-
238
226
  """
239
227
  all_records = itertools.chain.from_iterable(self._agent_records.values())
240
228
  rep_names = list(self.agent_reporters)
241
229
 
242
230
  df = pd.DataFrame.from_records(
243
231
  data=all_records,
244
- columns=["Step", "AgentID"] + rep_names,
232
+ columns=["Step", "AgentID", *rep_names],
233
+ index=["Step", "AgentID"],
245
234
  )
246
- df = df.set_index(["Step", "AgentID"])
247
235
  return df
248
236
 
249
237
  def get_table_dataframe(self, table_name):
@@ -251,7 +239,6 @@ class DataCollector:
251
239
 
252
240
  Args:
253
241
  table_name: The name of the table to convert.
254
-
255
242
  """
256
243
  if table_name not in self.tables:
257
244
  raise Exception("No such table.")
@@ -1,8 +1,9 @@
1
- import sys
2
1
  import os
3
- import click
2
+ import sys
4
3
  from subprocess import call
5
4
 
5
+ import click
6
+
6
7
  PROJECT_PATH = click.Path(
7
8
  exists=True, file_okay=False, dir_okay=True, resolve_path=True
8
9
  )
@@ -14,7 +15,6 @@ COOKIECUTTER_PATH = os.path.join(os.path.dirname(SCRIPTS_DIR), COOKIECUTTER_DIR)
14
15
  @click.group()
15
16
  def cli():
16
17
  "Manage Mesa projects"
17
- pass
18
18
 
19
19
 
20
20
  @cli.command()
@@ -30,7 +30,7 @@ def runserver(project):
30
30
 
31
31
  with open("run.py") as f:
32
32
  code = compile(f.read(), "run.py", "exec")
33
- exec(code, {}, {})
33
+ exec(code, {}, {}) # noqa: S102
34
34
 
35
35
 
36
36
  @click.command()