Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit edf7c37

Browse files
pre-commit-ci[bot]cclauss
andauthored
[pre-commit.ci] pre-commit autoupdate (#12623)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/astral-sh/ruff-pre-commit: v0.9.10 → v0.11.0](astral-sh/ruff-pre-commit@v0.9.10...v0.11.0) - [github.com/abravalheri/validate-pyproject: v0.23 → v0.24](abravalheri/validate-pyproject@v0.23...v0.24) * Fix ruff issues --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Christian Clauss <cclauss@me.com>
1 parent 7ce998b commit edf7c37

File tree

15 files changed

+26
-28
lines changed

15 files changed

+26
-28
lines changed

‎.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ repos:
1616
- id: auto-walrus
1717

1818
- repo: https://github.com/astral-sh/ruff-pre-commit
19-
rev: v0.9.10
19+
rev: v0.11.0
2020
hooks:
2121
- id: ruff
2222
- id: ruff-format
@@ -42,7 +42,7 @@ repos:
4242
pass_filenames: false
4343

4444
- repo: https://github.com/abravalheri/validate-pyproject
45-
rev: v0.23
45+
rev: v0.24
4646
hooks:
4747
- id: validate-pyproject
4848

‎conversions/prefix_conversions_string.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class SIUnit(Enum):
5353
yocto = -24
5454

5555
@classmethod
56-
def get_positive(cls: type[T]) -> dict:
56+
def get_positive(cls) -> dict:
5757
"""
5858
Returns a dictionary with only the elements of this enum
5959
that has a positive value
@@ -68,7 +68,7 @@ def get_positive(cls: type[T]) -> dict:
6868
return {unit.name: unit.value for unit in cls if unit.value > 0}
6969

7070
@classmethod
71-
def get_negative(cls: type[T]) -> dict:
71+
def get_negative(cls) -> dict:
7272
"""
7373
Returns a dictionary with only the elements of this enum
7474
that has a negative value

‎data_structures/arrays/sudoku_solver.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def parse_grid(grid):
5454
return False if a contradiction is detected.
5555
"""
5656
## To start, every square can be any digit; then assign values from the grid.
57-
values = {s: digitsforsinsquares}
57+
values = dict.fromkeys(squares, digits)
5858
for s, d in grid_values(grid).items():
5959
if d in digits and not assign(values, s, d):
6060
return False ## (Fail if we can't assign d to square s.)
@@ -203,7 +203,7 @@ def random_puzzle(assignments=17):
203203
Note the resulting puzzle is not guaranteed to be solvable, but empirically
204204
about 99.8% of them are solvable. Some have multiple solutions.
205205
"""
206-
values = {s: digitsforsinsquares}
206+
values = dict.fromkeys(squares, digits)
207207
for s in shuffled(squares):
208208
if not assign(values, s, random.choice(values[s])):
209209
break

‎graphics/digital_differential_analyzer_line.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def digital_differential_analyzer_line(
2929
for _ in range(steps):
3030
x += x_increment
3131
y += y_increment
32-
coordinates.append((int(round(x)), int(round(y))))
32+
coordinates.append((round(x), round(y)))
3333
return coordinates
3434

3535

‎graphs/minimum_spanning_tree_prims2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,8 @@ def prims_algo(
239239
13
240240
"""
241241
# prim's algorithm for minimum spanning tree
242-
dist: dict[T, int] = {node: maxsizefornodeingraph.connections}
243-
parent: dict[T, T | None] = {node: Nonefornodeingraph.connections}
242+
dist: dict[T, int] = dict.fromkeys(graph.connections, maxsize)
243+
parent: dict[T, T | None] = dict.fromkeys(graph.connections)
244244

245245
priority_queue: MinPriorityQueue[T] = MinPriorityQueue()
246246
for node, weight in dist.items():

‎hashes/enigma_machine.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ def rotator():
1515
gear_one.append(i)
1616
del gear_one[0]
1717
gear_one_pos += 1
18-
if gear_one_pos % int(len(alphabets)) == 0:
18+
if gear_one_pos % len(alphabets) == 0:
1919
i = gear_two[0]
2020
gear_two.append(i)
2121
del gear_two[0]
2222
gear_two_pos += 1
23-
if gear_two_pos % int(len(alphabets)) == 0:
23+
if gear_two_pos % len(alphabets) == 0:
2424
i = gear_three[0]
2525
gear_three.append(i)
2626
del gear_three[0]

‎linear_algebra/src/test_linear_algebra.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def test_component_matrix(self) -> None:
181181
test for Matrix method component()
182182
"""
183183
a = Matrix([[1, 2, 3], [2, 4, 5], [6, 7, 8]], 3, 3)
184-
assert a.component(2, 1) == 7, 0.01
184+
assert a.component(2, 1) == 7, "0.01"
185185

186186
def test__add__matrix(self) -> None:
187187
"""

‎maths/primelib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def is_prime(number: int) -> bool:
7676
if number <= 1:
7777
status = False
7878

79-
for divisor in range(2, int(round(sqrt(number))) + 1):
79+
for divisor in range(2, round(sqrt(number)) + 1):
8080
# if 'number' divisible by 'divisor' then sets 'status'
8181
# of false and break up the loop.
8282
if number % divisor == 0:

‎other/davis_putnam_logemann_loveland.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def __init__(self, literals: list[str]) -> None:
3636
Represent the literals and an assignment in a clause."
3737
"""
3838
# Assign all literals to None initially
39-
self.literals: dict[str, bool | None] = {literal: Noneforliteralinliterals}
39+
self.literals: dict[str, bool | None] = dict.fromkeys(literals)
4040

4141
def __str__(self) -> str:
4242
"""

‎other/quine.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/python3
2-
# ruff: noqa
2+
# ruff: noqa: PLC3002
33
"""
44
Quine:
55

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /