diff --git a/ch01python/101Classes.ipynb.py b/ch01python/101Classes.ipynb.py index 32be9d51..53f2ee89 100644 --- a/ch01python/101Classes.ipynb.py +++ b/ch01python/101Classes.ipynb.py @@ -24,7 +24,7 @@ # It can be defined like: # %% -class Room(object): +class Room: pass diff --git a/ch02data/110Capstone.ipynb.py b/ch02data/110Capstone.ipynb.py index fbe90f1f..74f041a1 100644 --- a/ch02data/110Capstone.ipynb.py +++ b/ch02data/110Capstone.ipynb.py @@ -44,7 +44,7 @@ from .map import Map -class Greengraph(object): +class Greengraph: def __init__(self, start, end): self.start = start self.end = end @@ -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?" diff --git a/ch03tests/08DiffusionExample.ipynb.py b/ch03tests/08DiffusionExample.ipynb.py index 5626bc64..06567f83 100644 --- a/ch03tests/08DiffusionExample.ipynb.py +++ b/ch03tests/08DiffusionExample.ipynb.py @@ -69,7 +69,7 @@ -class MonteCarlo(object): +class MonteCarlo: """ A simple Monte Carlo implementation """ def __init__(self, energy, density, temperature=1, itermax=1000): diff --git a/ch04packaging/025TextFiles.ipynb.py b/ch04packaging/025TextFiles.ipynb.py index 745f896e..65191432 100644 --- a/ch04packaging/025TextFiles.ipynb.py +++ b/ch04packaging/025TextFiles.ipynb.py @@ -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 = [] @@ -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 @@ -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 @@ -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 diff --git a/ch05construction/03comments.ipynb.py b/ch05construction/03comments.ipynb.py index 4e7b29b9..5e7d9585 100644 --- a/ch05construction/03comments.ipynb.py +++ b/ch05construction/03comments.ipynb.py @@ -103,7 +103,7 @@ def move(self): # %% x.clear() # Code crashes here sometimes -class Agent(object): +class Agent: pass # TODO: Implement pretty-printer method diff --git a/ch05construction/05refactoring.ipynb.py b/ch05construction/05refactoring.ipynb.py index 051dda20..a3df02fa 100644 --- a/ch05construction/05refactoring.ipynb.py +++ b/ch05construction/05refactoring.ipynb.py @@ -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 @@ -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 @@ -508,10 +508,10 @@ def predate(predator, prey): # # %% -class One(object): +class One: pass -class Two(object): +class Two: def __init__(): self.child = One() @@ -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() diff --git a/ch05construction/06objects.ipynb.py b/ch05construction/06objects.ipynb.py index f98d4f26..bd4d1987 100644 --- a/ch05construction/06objects.ipynb.py +++ b/ch05construction/06objects.ipynb.py @@ -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] diff --git a/ch05construction/08objects.ipynb.py b/ch05construction/08objects.ipynb.py index 200d37b2..9709f2d4 100644 --- a/ch05construction/08objects.ipynb.py +++ b/ch05construction/08objects.ipynb.py @@ -187,7 +187,7 @@ def __init__(self): # # %% -class Person(object): +class Person: def __init__(self): self._first = "Graham" self._second = "Chapman" @@ -217,7 +217,7 @@ def name(self): # # %% -class Person(object): +class Person: def __init__(self): self._name = "Graham Chapman" @@ -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 diff --git a/ch05construction/09patterns.ipynb.py b/ch05construction/09patterns.ipynb.py index 1e4b1ae7..f5e026e2 100644 --- a/ch05construction/09patterns.ipynb.py +++ b/ch05construction/09patterns.ipynb.py @@ -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) diff --git a/ch05construction/species.py b/ch05construction/species.py index 4a12d4cd..903c6a12 100644 --- a/ch05construction/species.py +++ b/ch05construction/species.py @@ -1,2 +1,2 @@ -class Species(object): +class Species: pass diff --git a/ch07dry/025Iterators.ipynb.py b/ch07dry/025Iterators.ipynb.py index 26d7fae7..b2d9e49f 100644 --- a/ch07dry/025Iterators.ipynb.py +++ b/ch07dry/025Iterators.ipynb.py @@ -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] diff --git a/ch07dry/049Operators.ipynb.py b/ch07dry/049Operators.ipynb.py index 7988ba41..58a859dc 100644 --- a/ch07dry/049Operators.ipynb.py +++ b/ch07dry/049Operators.ipynb.py @@ -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 diff --git a/ch98rubrics/Assessment1.md b/ch98rubrics/Assessment1.md index a7c25d86..fd3cf67b 100644 --- a/ch98rubrics/Assessment1.md +++ b/ch98rubrics/Assessment1.md @@ -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 @@ -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?"