Skip to content

Commit 8ab1566

Browse files
committed
Address warnings
1 parent 5761383 commit 8ab1566

File tree

7 files changed

+16
-23
lines changed

7 files changed

+16
-23
lines changed

Diff for: 2017/Day 08.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"\n",
6363
"\n",
6464
"def read_program(lines):\n",
65-
" return [Instruction.from_line(l) for l in lines if l.strip()]\n",
65+
" return [Instruction.from_line(line) for line in lines if line.strip()]\n",
6666
"\n",
6767
"\n",
6868
"def largest_register_value(program):\n",

Diff for: 2017/Day 10.ipynb

+6-13
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,8 @@
66
"metadata": {},
77
"outputs": [],
88
"source": [
9-
"from knothash import knot_hash_rounds, knot_hash"
10-
]
11-
},
12-
{
13-
"cell_type": "code",
14-
"execution_count": 2,
15-
"metadata": {},
16-
"outputs": [],
17-
"source": [
9+
"from knothash import knot_hash_rounds, knot_hash\n",
10+
"\n",
1811
"assert knot_hash_rounds([3, 4, 1, 5], 5, 1)[:2] == [3, 4]\n",
1912
"\n",
2013
"tests = {\n",
@@ -29,19 +22,19 @@
2922
},
3023
{
3124
"cell_type": "code",
32-
"execution_count": 3,
25+
"execution_count": 2,
3326
"metadata": {},
3427
"outputs": [],
3528
"source": [
3629
"import aocd\n",
3730
"\n",
3831
"data = aocd.get_data(day=10, year=2017)\n",
39-
"lengths = [int(l) for l in data.split(\",\")]"
32+
"lengths = [int(length) for length in data.split(\",\")]"
4033
]
4134
},
4235
{
4336
"cell_type": "code",
44-
"execution_count": 4,
37+
"execution_count": 3,
4538
"metadata": {
4639
"scrolled": true
4740
},
@@ -61,7 +54,7 @@
6154
},
6255
{
6356
"cell_type": "code",
64-
"execution_count": 5,
57+
"execution_count": 4,
6558
"metadata": {},
6659
"outputs": [
6760
{

Diff for: 2017/Day 13.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"\n",
3535
"\n",
3636
"def read_firewall(lines):\n",
37-
" return [Scanner.from_line(l) for l in lines if l.strip()]"
37+
" return [Scanner.from_line(line) for line in lines if line.strip()]"
3838
]
3939
},
4040
{

Diff for: 2017/Day 15.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
"import aocd\n",
8585
"\n",
8686
"data = aocd.get_data(day=15, year=2017)\n",
87-
"start_a, start_b = (int(l.rpartition(\" \")[-1]) for l in data.splitlines())"
87+
"start_a, start_b = (int(line.rpartition(\" \")[-1]) for line in data.splitlines())"
8888
]
8989
},
9090
{

Diff for: 2017/Day 16.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
" line = list(dancers)\n",
3030
"\n",
3131
" seen = []\n",
32-
" for i in range(repeats):\n",
32+
" for _ in range(repeats):\n",
3333
" for move in moves:\n",
3434
" move, instr = move[0], move[1:].split(\"/\")\n",
3535
" if move != \"p\":\n",

Diff for: 2017/Day 20.ipynb

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
"\n",
9393
"\n",
9494
"def read_particles(lines):\n",
95-
" return [Particle.from_line(i, l) for i, l in enumerate(lines)]\n",
95+
" return [Particle.from_line(i, line) for i, line in enumerate(lines)]\n",
9696
"\n",
9797
"\n",
9898
"def find_closest(particles):\n",
@@ -109,7 +109,7 @@
109109
" collisions[time] |= {p1, p2}\n",
110110
"\n",
111111
" eliminated = None\n",
112-
" for time, collided in sorted(collisions.items()):\n",
112+
" for _, collided in sorted(collisions.items()):\n",
113113
" if not eliminated:\n",
114114
" eliminated = set(collided)\n",
115115
" else:\n",

Diff for: 2017/Day 21.ipynb

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
" format(i, \"04b\").translate({48: 46, 49: 35}): bytes([i << 4])\n",
3434
" for i in range(16)\n",
3535
"}\n",
36-
"for l in range(3, 1, -1):\n",
37-
" for pattern in product(\".#\", repeat=l):\n",
36+
"for length in range(3, 1, -1):\n",
37+
" for pattern in product(\".#\", repeat=length):\n",
3838
" pattern = \"\".join(pattern)\n",
3939
" _hash_to_bytes[pattern] = _hash_to_bytes[pattern.ljust(4, \".\")]\n",
4040
"\n",
@@ -101,8 +101,8 @@
101101
" (3, 3),\n",
102102
" b\"\".join(\n",
103103
" [\n",
104-
" _hash_to_bytes[l.strip()]\n",
105-
" for l in \"\"\"\\\n",
104+
" _hash_to_bytes[line.strip()]\n",
105+
" for line in \"\"\"\\\n",
106106
" .#.\n",
107107
" ..#\n",
108108
" ###\"\"\".splitlines()\n",

0 commit comments

Comments
 (0)