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

Make example import absolute #2402

Merged
merged 2 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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

Check warning on line 1 in mesa/examples/basic/boid_flockers/app.py

View check run for this annotation

Codecov / codecov/patch

mesa/examples/basic/boid_flockers/app.py#L1

Added line #L1 was not covered by tests
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

Check warning on line 1 in mesa/examples/basic/boltzmann_wealth_model/app.py

View check run for this annotation

Codecov / codecov/patch

mesa/examples/basic/boltzmann_wealth_model/app.py#L1

Added line #L1 was not covered by tests
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

Check warning on line 8 in mesa/examples/basic/conways_game_of_life/app.py

View check run for this annotation

Codecov / codecov/patch

mesa/examples/basic/conways_game_of_life/app.py#L8

Added line #L8 was not covered by tests

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

Check warning on line 3 in mesa/examples/basic/schelling/app.py

View check run for this annotation

Codecov / codecov/patch

mesa/examples/basic/schelling/app.py#L3

Added line #L3 was not covered by tests
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 (

Check warning on line 7 in mesa/examples/basic/virus_on_network/app.py

View check run for this annotation

Codecov / codecov/patch

mesa/examples/basic/virus_on_network/app.py#L7

Added line #L7 was not covered by tests
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
Loading