Skip to content

Commit 324f4cc

Browse files
authored
Merge branch 'master' into django-todo-list
2 parents 97c49f1 + 569fd13 commit 324f4cc

File tree

26 files changed

+78
-90
lines changed

26 files changed

+78
-90
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ version: 2
66
jobs:
77
build:
88
docker:
9-
- image: circleci/python:3.8
9+
- image: circleci/python:3.10
1010

1111
working_directory: ~/repo
1212

mandelbrot-set-python/01_scatter_plot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def complex_matrix(xmin, xmax, ymin, ymax, pixel_density):
1313
def is_stable(c, num_iterations):
1414
z = 0
1515
for _ in range(num_iterations):
16-
z = z ** 2 + c
16+
z = z**2 + c
1717
return abs(z) <= 2
1818

1919

mandelbrot-set-python/02_bw_plot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def complex_matrix(xmin, xmax, ymin, ymax, pixel_density):
1313
def is_stable(c, num_iterations):
1414
z = 0
1515
for _ in range(num_iterations):
16-
z = z ** 2 + c
16+
z = z**2 + c
1717
return abs(z) <= 2
1818

1919

mandelbrot-set-python/mandelbrot_01.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class MandelbrotSet:
1010
def __contains__(self, c: complex) -> bool:
1111
z = 0
1212
for _ in range(self.max_iterations):
13-
z = z ** 2 + c
13+
z = z**2 + c
1414
if abs(z) > 2:
1515
return False
1616
return True

mandelbrot-set-python/mandelbrot_02.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def stability(self, c: complex) -> float:
1616
def escape_count(self, c: complex) -> int:
1717
z = 0
1818
for iteration in range(self.max_iterations):
19-
z = z ** 2 + c
19+
z = z**2 + c
2020
if abs(z) > 2:
2121
return iteration
2222
return self.max_iterations

mandelbrot-set-python/mandelbrot_03.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def stability(self, c: complex, smooth=False, clamp=True) -> float:
2020
def escape_count(self, c: complex, smooth=False) -> int | float:
2121
z = 0
2222
for iteration in range(self.max_iterations):
23-
z = z ** 2 + c
23+
z = z**2 + c
2424
if abs(z) > self.escape_radius:
2525
if smooth:
2626
return iteration + 1 - log(log(abs(z))) / log(2)

primer-on-python-decorators/examples.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def wrapper_decorator(*args, **kwargs):
107107
@timer
108108
def waste_some_time(num_times):
109109
for _ in range(num_times):
110-
sum([i ** 2 for i in range(10000)])
110+
sum([i**2 for i in range(10000)])
111111

112112

113113
# Debugging Code
@@ -178,7 +178,7 @@ def radius(self, value):
178178
@property
179179
def area(self):
180180
"""Calculate area inside circle"""
181-
return self.pi() * self.radius ** 2
181+
return self.pi() * self.radius**2
182182

183183
def cylinder_volume(self, height):
184184
"""Calculate volume of cylinder with circle as base"""
@@ -204,7 +204,7 @@ def __init__(self, max_num):
204204
@timer
205205
def waste_time(self, num_times):
206206
for _ in range(num_times):
207-
sum([i ** 2 for i in range(self.max_num)])
207+
sum([i**2 for i in range(self.max_num)])
208208

209209

210210
# Nesting Decorators
@@ -240,4 +240,4 @@ def fibonacci_lru(num):
240240
# Adding Information About Units
241241
@set_unit("cm^3")
242242
def volume(radius, height):
243-
return math.pi * radius ** 2 * height
243+
return math.pi * radius**2 * height

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.black]
22
line-length = 79
3-
target-version = ["py36"]
3+
target-version = ["py310"]
44
exclude = '''
55
/(
66
\.git

python-scipy-cluster-optimize/minimize_scalar.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99

1010

1111
def objective_function(x):
12-
return 3 * x ** 4 - 2 * x + 1
12+
return 3 * x**4 - 2 * x + 1
1313

1414

1515
res = minimize_scalar(objective_function)
1616
print(res)
1717

1818

1919
def objective_function(x):
20-
return x ** 4 - x ** 2
20+
return x**4 - x**2
2121

2222

2323
res = minimize_scalar(objective_function, method="brent")

python-sockets-tutorial/app-client.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def create_request(action, value):
2727

2828
def start_connection(host, port, request):
2929
addr = (host, port)
30-
print("starting connection to", addr)
30+
print(f"Starting connection to {addr}")
3131
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
3232
sock.setblocking(False)
3333
sock.connect_ex(addr)
@@ -37,7 +37,7 @@ def start_connection(host, port, request):
3737

3838

3939
if len(sys.argv) != 5:
40-
print("usage:", sys.argv[0], "<host> <port> <action> <value>")
40+
print(f"Usage: {sys.argv[0]} <host> <port> <action> <value>")
4141
sys.exit(1)
4242

4343
host, port = sys.argv[1], int(sys.argv[2])
@@ -54,14 +54,14 @@ def start_connection(host, port, request):
5454
message.process_events(mask)
5555
except Exception:
5656
print(
57-
"main: error: exception for",
58-
f"{message.addr}:\n{traceback.format_exc()}",
57+
f"Main: Error: Exception for {message.addr}:\n"
58+
f"{traceback.format_exc()}"
5959
)
6060
message.close()
6161
# Check for a socket being monitored to continue.
6262
if not sel.get_map():
6363
break
6464
except KeyboardInterrupt:
65-
print("caught keyboard interrupt, exiting")
65+
print("Caught keyboard interrupt, exiting")
6666
finally:
6767
sel.close()

0 commit comments

Comments
 (0)