Skip to content

Commit

Permalink
Make example import absolute (projectmesa#2402)
Browse files Browse the repository at this point in the history
  • Loading branch information
quaquel authored Oct 23, 2024
1 parent 44276fb commit d7171c8
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 19 deletions.
3 changes: 1 addition & 2 deletions mesa/examples/basic/boid_flockers/app.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from mesa.examples.basic.boid_flockers.model import BoidFlockers
from mesa.visualization import Slider, SolaraViz, make_space_matplotlib

from .model import BoidFlockers


def boid_draw(agent):
if not agent.neighbors: # Only for the first Frame
Expand Down
3 changes: 1 addition & 2 deletions mesa/examples/basic/boid_flockers/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
import numpy as np

import mesa

from .agents import Boid
from mesa.examples.basic.boid_flockers.agents import Boid


class BoidFlockers(mesa.Model):
Expand Down
3 changes: 1 addition & 2 deletions mesa/examples/basic/boltzmann_wealth_model/app.py
Original file line number Diff line number Diff line change
@@ -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 .model import BoltzmannWealthModel


def agent_portrayal(agent):
size = 10
Expand Down
3 changes: 1 addition & 2 deletions mesa/examples/basic/boltzmann_wealth_model/model.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import mesa

from .agents import MoneyAgent
from mesa.examples.basic.boltzmann_wealth_model.agents import MoneyAgent


class BoltzmannWealthModel(mesa.Model):
Expand Down
3 changes: 2 additions & 1 deletion mesa/examples/basic/conways_game_of_life/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions mesa/examples/basic/conways_game_of_life/model.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from mesa import Model
from mesa.examples.basic.conways_game_of_life.agents import Cell
from mesa.space import SingleGrid

from .agents import Cell


class ConwaysGameOfLife(Model):
"""Represents the 2-dimensional array of cells in Conway's Game of Life."""
Expand Down
3 changes: 1 addition & 2 deletions mesa/examples/basic/schelling/app.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import solara

from mesa.examples.basic.schelling.model import Schelling
from mesa.visualization import (
Slider,
SolaraViz,
make_plot_measure,
make_space_matplotlib,
)

from .model import Schelling


def get_happy_agents(model):
"""Display a text count of how many happy agents there are."""
Expand Down
3 changes: 1 addition & 2 deletions mesa/examples/basic/schelling/model.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import mesa
from mesa import Model

from .agents import SchellingAgent
from mesa.examples.basic.schelling.agents import SchellingAgent


class Schelling(Model):
Expand Down
7 changes: 5 additions & 2 deletions mesa/examples/basic/virus_on_network/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 .model import State, VirusOnNetwork, number_infected


def agent_portrayal(graph):
def get_agent(node):
Expand Down
3 changes: 1 addition & 2 deletions mesa/examples/basic/virus_on_network/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,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):
Expand Down

0 comments on commit d7171c8

Please sign in to comment.