Skip to content
Open
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
2 changes: 1 addition & 1 deletion ch01python/101Classes.ipynb.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
# It can be defined like:

# %%
class Room(object):
class Room:
pass


Expand Down
4 changes: 2 additions & 2 deletions ch02data/110Capstone.ipynb.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
from .map import Map


class Greengraph(object):
class Greengraph:
def __init__(self, start, end):
self.start = start
self.end = end
Expand Down Expand Up @@ -99,7 +99,7 @@ def plot_green_between(self, steps):
# cells below might error out on the browser (jupyterlite) version of this notebook
import requests

class Map(object):
class Map:
def __init__(self, latitude, longitude, satellite=True, zoom=10,
sensor=False):
base = "https://mt0.google.com/vt?"
Expand Down
2 changes: 1 addition & 1 deletion ch03tests/08DiffusionExample.ipynb.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@



class MonteCarlo(object):
class MonteCarlo:
""" A simple Monte Carlo implementation """

def __init__(self, energy, density, temperature=1, itermax=1000):
Expand Down
8 changes: 4 additions & 4 deletions ch04packaging/025TextFiles.ipynb.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
from .room import Room
from .person import Person

class Maze(object):
class Maze:
def __init__(self, name):
self.name = name
self.rooms = []
Expand Down Expand Up @@ -92,7 +92,7 @@ def simulate(self, steps):
from .exit import Exit


class Room(object):
class Room:
def __init__(self, name, capacity):
self.name = name
self.capacity = capacity
Expand All @@ -119,7 +119,7 @@ def add_exit(self, name, target):
# %%
# %%writefile mazetool/person.py

class Person(object):
class Person:
def __init__(self, name, room = None):
self.name=name
self.room=room
Expand All @@ -143,7 +143,7 @@ def describe(self):
# %%
# %%writefile mazetool/exit.py

class Exit(object):
class Exit:
def __init__(self, name, target):
self.name = name
self.target = target
Expand Down
2 changes: 1 addition & 1 deletion ch05construction/03comments.ipynb.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def move(self):

# %%
x.clear() # Code crashes here sometimes
class Agent(object):
class Agent:
pass
# TODO: Implement pretty-printer method

Expand Down
12 changes: 6 additions & 6 deletions ch05construction/05refactoring.ipynb.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ def can_see(source, target):
if hawk.can_see(starling):
hawk.hunt(starling)

class Hawk(object):
class Hawk:
def can_see(self, target):
return (self.facing - target.facing) < viewport

Expand All @@ -407,7 +407,7 @@ def can_see(self, target):
if hawk.can_see(starling, viewport):
hawk.hunt(starling)

class Hawk(object):
class Hawk:
def can_see(self, target, viewport):
return (self.facing - target.facing) < viewport

Expand Down Expand Up @@ -508,10 +508,10 @@ def predate(predator, prey):
#

# %%
class One(object):
class One:
pass

class Two(object):
class Two:
def __init__():
self.child = One()

Expand All @@ -527,14 +527,14 @@ def __init__():

# %%
# %%writefile anotherfile.py
class One(object):
class One:
pass


# %%
from anotherfile import One

class Two(object):
class Two:
def __init__():
self.child = One()

Expand Down
2 changes: 1 addition & 1 deletion ch05construction/06objects.ipynb.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ def emigrate_probability(self): pass
#

# %%
class Person(object):
class Person:
def __init__(self, birthday, name):
self.birth_day = birthday[0]
self.birth_month = birthday[1]
Expand Down
6 changes: 3 additions & 3 deletions ch05construction/08objects.ipynb.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def __init__(self):
#

# %%
class Person(object):
class Person:
def __init__(self):
self._first = "Graham"
self._second = "Chapman"
Expand Down Expand Up @@ -217,7 +217,7 @@ def name(self):
#

# %%
class Person(object):
class Person:
def __init__(self):
self._name = "Graham Chapman"

Expand All @@ -235,7 +235,7 @@ def name(self): # an access function
# Another way could be to create a member variable `name` which holds the full name. However, this could lead to inconsistent data. If we create a `get_married` function, then the name of the person won't change!

# %%
class Person(object):
class Person:
def __init__(self, first, second):
self._first = first
self._second = second
Expand Down
2 changes: 1 addition & 1 deletion ch05construction/09patterns.ipynb.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def __init__(self, data):
# Then, our analysis class which contains all methods *except* the numerical methods

# %% pycharm={"name": "#%%\n"}
class SunspotDataAnalyser(object):
class SunspotDataAnalyser:
def __init__(self, frequency_strategy):
self.secs_per_year = (
datetime(2014, 1, 1) - datetime(2013, 1, 1)
Expand Down
2 changes: 1 addition & 1 deletion ch05construction/species.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
class Species(object):
class Species:
pass
2 changes: 1 addition & 1 deletion ch07dry/025Iterators.ipynb.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def __next__(self):
from matplotlib import pyplot as plt


class MyImage(object):
class MyImage:
def __init__(self, pixels):
self.pixels = array(pixels, dtype='uint8')
self.channels = self.pixels.shape[2]
Expand Down
2 changes: 1 addition & 1 deletion ch07dry/049Operators.ipynb.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def __contains__(self, value):
# one is `__call__`, which overrides the `()` operator; this allows us to define classes that *behave like functions*! We call these **callables**.

# %%
class Greeter(object):
class Greeter:
def __init__(self, greeting):
self.greeting = greeting

Expand Down
4 changes: 2 additions & 2 deletions ch98rubrics/Assessment1.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ from StringIO import StringIO
from matplotlib import image as img


class Greengraph(object):
class Greengraph:
def __init__(self, start, end):
self.start=start
self.end=end
Expand All @@ -92,7 +92,7 @@ class Greengraph(object):
self.geolocate(self.end),
steps)]

class Map(object):
class Map:
def __init__(self, lat, long, satellite=True,
zoom=10, size=(400,400), sensor=False):
base="http://maps.googleapis.com/maps/api/staticmap?"
Expand Down
Loading