From e7db1d8a95e3c9844246d60b465476101ace215f Mon Sep 17 00:00:00 2001 From: Jan Kwakkel Date: Wed, 23 Oct 2024 17:33:45 +0200 Subject: [PATCH 1/2] make import absolute --- mesa/examples/basic/boid_flockers/app.py | 2 +- mesa/examples/basic/boid_flockers/model.py | 2 +- mesa/examples/basic/boltzmann_wealth_model/app.py | 2 +- mesa/examples/basic/boltzmann_wealth_model/model.py | 2 +- mesa/examples/basic/conways_game_of_life/app.py | 3 ++- mesa/examples/basic/conways_game_of_life/model.py | 2 +- mesa/examples/basic/schelling/app.py | 2 +- mesa/examples/basic/schelling/model.py | 2 +- mesa/examples/basic/virus_on_network/app.py | 2 +- mesa/examples/basic/virus_on_network/model.py | 2 +- 10 files changed, 11 insertions(+), 10 deletions(-) diff --git a/mesa/examples/basic/boid_flockers/app.py b/mesa/examples/basic/boid_flockers/app.py index 02fde323285..20cd4b84db9 100644 --- a/mesa/examples/basic/boid_flockers/app.py +++ b/mesa/examples/basic/boid_flockers/app.py @@ -1,6 +1,6 @@ from mesa.visualization import Slider, SolaraViz, make_space_matplotlib -from .model import BoidFlockers +from mesa.examples.basic.boid_flockers.model import BoidFlockers def boid_draw(agent): diff --git a/mesa/examples/basic/boid_flockers/model.py b/mesa/examples/basic/boid_flockers/model.py index 2bc59216d67..11e3fe5d6be 100644 --- a/mesa/examples/basic/boid_flockers/model.py +++ b/mesa/examples/basic/boid_flockers/model.py @@ -8,7 +8,7 @@ import mesa -from .agents import Boid +from mesa.examples.basic.boid_flockers.agents import Boid class BoidFlockers(mesa.Model): diff --git a/mesa/examples/basic/boltzmann_wealth_model/app.py b/mesa/examples/basic/boltzmann_wealth_model/app.py index ebbb1ab3f1a..ee432368e56 100644 --- a/mesa/examples/basic/boltzmann_wealth_model/app.py +++ b/mesa/examples/basic/boltzmann_wealth_model/app.py @@ -4,7 +4,7 @@ make_space_matplotlib, ) -from .model import BoltzmannWealthModel +from mesa.examples.basic.boltzmann_wealth_model.model import BoltzmannWealthModel def agent_portrayal(agent): diff --git a/mesa/examples/basic/boltzmann_wealth_model/model.py b/mesa/examples/basic/boltzmann_wealth_model/model.py index a8e96a79ea3..cd92286906d 100644 --- a/mesa/examples/basic/boltzmann_wealth_model/model.py +++ b/mesa/examples/basic/boltzmann_wealth_model/model.py @@ -1,6 +1,6 @@ import mesa -from .agents import MoneyAgent +from mesa.examples.basic.boltzmann_wealth_model.agents import MoneyAgent class BoltzmannWealthModel(mesa.Model): diff --git a/mesa/examples/basic/conways_game_of_life/app.py b/mesa/examples/basic/conways_game_of_life/app.py index bff865a8d12..d7838efa453 100644 --- a/mesa/examples/basic/conways_game_of_life/app.py +++ b/mesa/examples/basic/conways_game_of_life/app.py @@ -4,7 +4,8 @@ import numpy as np import pandas as pd import streamlit as st -from model import ConwaysGameOfLife + +from mesa.examples.basic.conways_game_of_life.model import ConwaysGameOfLife model = st.title("Conway's Game of Life") num_ticks = st.slider("Select number of Steps", min_value=1, max_value=100, value=50) diff --git a/mesa/examples/basic/conways_game_of_life/model.py b/mesa/examples/basic/conways_game_of_life/model.py index cc3fa996409..9706596407f 100644 --- a/mesa/examples/basic/conways_game_of_life/model.py +++ b/mesa/examples/basic/conways_game_of_life/model.py @@ -1,7 +1,7 @@ from mesa import Model from mesa.space import SingleGrid -from .agents import Cell +from mesa.examples.basic.conways_game_of_life.agents import Cell class ConwaysGameOfLife(Model): diff --git a/mesa/examples/basic/schelling/app.py b/mesa/examples/basic/schelling/app.py index 51989203593..4ded7932463 100644 --- a/mesa/examples/basic/schelling/app.py +++ b/mesa/examples/basic/schelling/app.py @@ -7,7 +7,7 @@ make_space_matplotlib, ) -from .model import Schelling +from mesa.examples.basic.schelling.model import Schelling def get_happy_agents(model): diff --git a/mesa/examples/basic/schelling/model.py b/mesa/examples/basic/schelling/model.py index fba0de7d4ac..73c2edf8ab9 100644 --- a/mesa/examples/basic/schelling/model.py +++ b/mesa/examples/basic/schelling/model.py @@ -1,7 +1,7 @@ import mesa from mesa import Model -from .agents import SchellingAgent +from mesa.examples.basic.schelling.agents import SchellingAgent class Schelling(Model): diff --git a/mesa/examples/basic/virus_on_network/app.py b/mesa/examples/basic/virus_on_network/app.py index 0e85e8ac4fc..8d5125af5a3 100644 --- a/mesa/examples/basic/virus_on_network/app.py +++ b/mesa/examples/basic/virus_on_network/app.py @@ -6,7 +6,7 @@ from mesa.visualization import Slider, SolaraViz, make_space_matplotlib -from .model import State, VirusOnNetwork, number_infected +from mesa.examples.basic.virus_on_network.model import State, VirusOnNetwork, number_infected def agent_portrayal(graph): diff --git a/mesa/examples/basic/virus_on_network/model.py b/mesa/examples/basic/virus_on_network/model.py index 04e457e8bf3..3593ba21882 100644 --- a/mesa/examples/basic/virus_on_network/model.py +++ b/mesa/examples/basic/virus_on_network/model.py @@ -5,7 +5,7 @@ import mesa from mesa import Model -from .agents import State, VirusAgent +from mesa.examples.basic.virus_on_network.agents import (State, VirusAgent) def number_state(model, state): From a48965c758e27f8a497cd9d4973ce31dd83020a1 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 23 Oct 2024 15:35:17 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- mesa/examples/basic/boid_flockers/app.py | 3 +-- mesa/examples/basic/boid_flockers/model.py | 1 - mesa/examples/basic/boltzmann_wealth_model/app.py | 3 +-- mesa/examples/basic/boltzmann_wealth_model/model.py | 1 - mesa/examples/basic/conways_game_of_life/model.py | 3 +-- mesa/examples/basic/schelling/app.py | 3 +-- mesa/examples/basic/schelling/model.py | 1 - mesa/examples/basic/virus_on_network/app.py | 7 +++++-- mesa/examples/basic/virus_on_network/model.py | 3 +-- 9 files changed, 10 insertions(+), 15 deletions(-) diff --git a/mesa/examples/basic/boid_flockers/app.py b/mesa/examples/basic/boid_flockers/app.py index 20cd4b84db9..482d582b8ba 100644 --- a/mesa/examples/basic/boid_flockers/app.py +++ b/mesa/examples/basic/boid_flockers/app.py @@ -1,6 +1,5 @@ -from mesa.visualization import Slider, SolaraViz, make_space_matplotlib - from mesa.examples.basic.boid_flockers.model import BoidFlockers +from mesa.visualization import Slider, SolaraViz, make_space_matplotlib def boid_draw(agent): diff --git a/mesa/examples/basic/boid_flockers/model.py b/mesa/examples/basic/boid_flockers/model.py index 11e3fe5d6be..a05caab1880 100644 --- a/mesa/examples/basic/boid_flockers/model.py +++ b/mesa/examples/basic/boid_flockers/model.py @@ -7,7 +7,6 @@ import numpy as np import mesa - from mesa.examples.basic.boid_flockers.agents import Boid diff --git a/mesa/examples/basic/boltzmann_wealth_model/app.py b/mesa/examples/basic/boltzmann_wealth_model/app.py index ee432368e56..7e3f41e64de 100644 --- a/mesa/examples/basic/boltzmann_wealth_model/app.py +++ b/mesa/examples/basic/boltzmann_wealth_model/app.py @@ -1,11 +1,10 @@ +from mesa.examples.basic.boltzmann_wealth_model.model import BoltzmannWealthModel from mesa.visualization import ( SolaraViz, make_plot_measure, make_space_matplotlib, ) -from mesa.examples.basic.boltzmann_wealth_model.model import BoltzmannWealthModel - def agent_portrayal(agent): size = 10 diff --git a/mesa/examples/basic/boltzmann_wealth_model/model.py b/mesa/examples/basic/boltzmann_wealth_model/model.py index cd92286906d..03ef5a21634 100644 --- a/mesa/examples/basic/boltzmann_wealth_model/model.py +++ b/mesa/examples/basic/boltzmann_wealth_model/model.py @@ -1,5 +1,4 @@ import mesa - from mesa.examples.basic.boltzmann_wealth_model.agents import MoneyAgent diff --git a/mesa/examples/basic/conways_game_of_life/model.py b/mesa/examples/basic/conways_game_of_life/model.py index 9706596407f..6e81f690763 100644 --- a/mesa/examples/basic/conways_game_of_life/model.py +++ b/mesa/examples/basic/conways_game_of_life/model.py @@ -1,7 +1,6 @@ from mesa import Model -from mesa.space import SingleGrid - from mesa.examples.basic.conways_game_of_life.agents import Cell +from mesa.space import SingleGrid class ConwaysGameOfLife(Model): diff --git a/mesa/examples/basic/schelling/app.py b/mesa/examples/basic/schelling/app.py index 4ded7932463..72ae6ddc1ec 100644 --- a/mesa/examples/basic/schelling/app.py +++ b/mesa/examples/basic/schelling/app.py @@ -1,5 +1,6 @@ import solara +from mesa.examples.basic.schelling.model import Schelling from mesa.visualization import ( Slider, SolaraViz, @@ -7,8 +8,6 @@ make_space_matplotlib, ) -from mesa.examples.basic.schelling.model import Schelling - def get_happy_agents(model): """Display a text count of how many happy agents there are.""" diff --git a/mesa/examples/basic/schelling/model.py b/mesa/examples/basic/schelling/model.py index 73c2edf8ab9..aa390f14e96 100644 --- a/mesa/examples/basic/schelling/model.py +++ b/mesa/examples/basic/schelling/model.py @@ -1,6 +1,5 @@ import mesa from mesa import Model - from mesa.examples.basic.schelling.agents import SchellingAgent diff --git a/mesa/examples/basic/virus_on_network/app.py b/mesa/examples/basic/virus_on_network/app.py index 8d5125af5a3..0183d256790 100644 --- a/mesa/examples/basic/virus_on_network/app.py +++ b/mesa/examples/basic/virus_on_network/app.py @@ -4,10 +4,13 @@ from matplotlib.figure import Figure from matplotlib.ticker import MaxNLocator +from mesa.examples.basic.virus_on_network.model import ( + State, + VirusOnNetwork, + number_infected, +) from mesa.visualization import Slider, SolaraViz, make_space_matplotlib -from mesa.examples.basic.virus_on_network.model import State, VirusOnNetwork, number_infected - def agent_portrayal(graph): def get_agent(node): diff --git a/mesa/examples/basic/virus_on_network/model.py b/mesa/examples/basic/virus_on_network/model.py index 3593ba21882..73419958617 100644 --- a/mesa/examples/basic/virus_on_network/model.py +++ b/mesa/examples/basic/virus_on_network/model.py @@ -4,8 +4,7 @@ import mesa from mesa import Model - -from mesa.examples.basic.virus_on_network.agents import (State, VirusAgent) +from mesa.examples.basic.virus_on_network.agents import State, VirusAgent def number_state(model, state):