Skip to content

Commit 955cb49

Browse files
authored
Fix black/click CI problem (#45)
This follows our other changes that moved to Black 22.1 and Flake8 4
1 parent 4ec4096 commit 955cb49

File tree

8 files changed

+36
-40
lines changed

8 files changed

+36
-40
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,12 @@ jobs:
1414
with:
1515
python-version: 3.9
1616

17-
- name: Install PyLint
17+
- name: Install Linting Tools
1818
run: |
1919
python -m pip install --upgrade pip
20-
pip install "pylint==2.6.0"
21-
22-
- name: Install Black
23-
run: |
24-
pip install "black==19.3b0"
25-
26-
- name: Install Flake8
27-
run: |
28-
pip install "flake8==3.8.4"
20+
pip install --user pylint==2.6.0
21+
pip install --user black~=22.1 click==8.0.4
22+
pip install --user flake8~=4.0
2923
3024
- name: Install Partition Manager
3125
run: |

.github/workflows/release.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@ jobs:
1515
release:
1616
name: release
1717
runs-on: ubuntu-latest
18-
18+
1919
steps:
2020
- name: Setup Go
2121
uses: actions/setup-go@v2
2222
with:
2323
go-version: 1.17
24-
24+
2525
- name: Setup python
2626
uses: actions/setup-python@v2
2727
with:
2828
python-version: '3.x'
2929
architecture: 'x64'
30-
30+
3131
- name: Install packages
3232
run: |
3333
sudo apt-get update
@@ -47,7 +47,7 @@ jobs:
4747
- name: Install nFPM
4848
run: |
4949
go install github.com/goreleaser/nfpm/v2/cmd/[email protected]
50-
50+
5151
- name: Build partition-manager
5252
run: |
5353
mkdir install
@@ -58,7 +58,7 @@ jobs:
5858
SEMVER=${{ steps.get_version.outputs.version }}
5959
mkdir nfpm-pkg
6060
nfpm package -p deb --target "nfpm-pkg/"
61-
61+
6262
- name: "Publish release"
6363
uses: "marvinpinto/action-automatic-releases@latest"
6464
with:

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ repos:
99
- id: requirements-txt-fixer
1010
- id: trailing-whitespace
1111
- repo: https://github.com/psf/black
12-
rev: 19.3b0
12+
rev: "22.1.0"
1313
hooks:
1414
- id: black
1515
- repo: https://gitlab.com/pycqa/flake8
16-
rev: 3.8.4
16+
rev: "4.0.0"
1717
hooks:
1818
- id: flake8
1919
- repo: https://github.com/PyCQA/pylint

nfpm.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ version_metadata: git
66
maintainer: Let's Encrypt <[email protected]>
77
license: MPL
88
depends:
9-
- python3-yaml
9+
- python3-yaml
1010
disable_globbing: false
1111

1212
contents:

partitionmanager/migrate.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ def _override_config_to_map_data(conf):
2929

3030

3131
def _get_map_data_from_config(conf, table):
32-
""" Helper to return a partition map for the table, either directly or
33-
from a configuration override. """
32+
"""Helper to return a partition map for the table, either directly or
33+
from a configuration override."""
3434
if not conf.assume_partitioned_on:
3535
problems = pm_tap.get_table_compatibility_problems(conf.dbcmd, table)
3636
if problems:
@@ -123,7 +123,7 @@ def _plan_partitions_for_time_offsets(
123123

124124

125125
def _suffix(lines, *, indent="", mid_suffix="", final_suffix=""):
126-
""" Helper that suffixes each line with either mid- or final- suffix """
126+
"""Helper that suffixes each line with either mid- or final- suffix"""
127127
for line, is_final in partitionmanager.tools.iter_show_end(lines):
128128
if is_final:
129129
yield indent + line + final_suffix
@@ -132,22 +132,22 @@ def _suffix(lines, *, indent="", mid_suffix="", final_suffix=""):
132132

133133

134134
def _trigger_column_copies(cols):
135-
""" Helper that returns lines copying each column for a trigger. """
135+
"""Helper that returns lines copying each column for a trigger."""
136136
for c in cols:
137137
yield f"`{c}` = NEW.`{c}`"
138138

139139

140140
def _make_trigger_name(name):
141-
""" Helper that enforces the trigger must be <= 64 chars """
141+
"""Helper that enforces the trigger must be <= 64 chars"""
142142
return name[:64]
143143

144144

145145
def _generate_sql_copy_commands(
146146
existing_table, map_data, columns, new_table, alter_commands_iter
147147
):
148-
""" Generate a series of SQL commands to start a copy of the existing_table
148+
"""Generate a series of SQL commands to start a copy of the existing_table
149149
to a new_table, applying the supplied alterations before starting the
150-
triggers. """
150+
triggers."""
151151
log = logging.getLogger(
152152
f"_generate_sql_copy_commands:{existing_table.name} to {new_table.name}"
153153
)

partitionmanager/table_append_partition.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def _parse_partition_map(rows):
161161

162162

163163
def get_columns(database, table):
164-
""" Gather the columns list via the database command tool. """
164+
"""Gather the columns list via the database command tool."""
165165
if not isinstance(table, partitionmanager.types.Table) or not isinstance(
166166
table.name, partitionmanager.types.SqlInput
167167
):
@@ -171,8 +171,8 @@ def get_columns(database, table):
171171

172172

173173
def _parse_columns(table, rows):
174-
""" Read the columns description and return a list of the columns, where
175-
each entry is a dict containing Field and Type. """
174+
"""Read the columns description and return a list of the columns, where
175+
each entry is a dict containing Field and Type."""
176176
log = logging.getLogger("parse_columns")
177177
if not rows:
178178
raise partitionmanager.types.TableInformationException("No column information")
@@ -363,7 +363,7 @@ def _calculate_start_time(last_changed_time, evaluation_time, allowed_lifespan):
363363
def _get_rate_partitions_with_implicit_timestamps(
364364
table, filled_partitions, current_position, evaluation_time, active_partition
365365
):
366-
""" Return a list of PositionPartitions for use in rate calculations.
366+
"""Return a list of PositionPartitions for use in rate calculations.
367367
368368
The partitions are set with implicit timestamps.
369369
"""
@@ -413,7 +413,7 @@ def _get_rate_partitions_with_implicit_timestamps(
413413
def _get_rate_partitions_with_queried_timestamps(
414414
database, table, partition_list, current_position, evaluation_time, active_partition
415415
):
416-
""" Return a list of PositionPartitions for use in rate calculations.
416+
"""Return a list of PositionPartitions for use in rate calculations.
417417
418418
The partitions' timestamps are explicitly queried.
419419
"""
@@ -493,9 +493,11 @@ def _plan_partition_changes(
493493
"""
494494
log = logging.getLogger(f"plan_partition_changes:{table.name}")
495495

496-
filled_partitions, active_partition, empty_partitions = _split_partitions_around_position(
497-
partition_list, current_position
498-
)
496+
(
497+
filled_partitions,
498+
active_partition,
499+
empty_partitions,
500+
) = _split_partitions_around_position(partition_list, current_position)
499501
if not empty_partitions:
500502
log.error(
501503
f"Partition {active_partition.name} requires manual ALTER "

partitionmanager/table_append_partition_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -767,8 +767,8 @@ def test_plan_partition_changes(self):
767767
)
768768

769769
def test_plan_partition_changes_misprediction(self):
770-
""" We have to handle the case where the partition list doesn't cleanly
771-
match reality. """
770+
"""We have to handle the case where the partition list doesn't cleanly
771+
match reality."""
772772
self.maxDiff = None
773773
planned = _plan_partition_changes(
774774
MockDatabase(),
@@ -1084,7 +1084,7 @@ def testgenerate_sql_reorganize_partition_commands_out_of_order(self):
10841084
)
10851085

10861086
def test_plan_andgenerate_sql_reorganize_partition_commands_with_future_partition(
1087-
self
1087+
self,
10881088
):
10891089
planned = _plan_partition_changes(
10901090
MockDatabase(),

partitionmanager/types.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def db_name(self):
170170

171171

172172
def is_partition_type(obj):
173-
""" True if the object inherits from a _Partition. """
173+
"""True if the object inherits from a _Partition."""
174174
return isinstance(obj, _Partition)
175175

176176

@@ -248,7 +248,7 @@ def __str__(self):
248248

249249

250250
class Position:
251-
""" An internal class that represents a position as an ordered list of
251+
"""An internal class that represents a position as an ordered list of
252252
identifiers, matching the table's partition-by statement.
253253
"""
254254

@@ -462,7 +462,7 @@ def set_important(self):
462462
"""Indicate this is an important partition. Used in the
463463
_plan_partition_changes as a marker that there's a significant
464464
change in this partition that should be committed even if the
465-
overall map isn't changing much. """
465+
overall map isn't changing much."""
466466
self._important = True
467467
return self
468468

@@ -582,7 +582,7 @@ def __str__(self):
582582

583583

584584
class MismatchedIdException(Exception):
585-
""" Raised if the partition map doesn't use the primary key as its range id."""
585+
"""Raised if the partition map doesn't use the primary key as its range id."""
586586

587587

588588
class TruncatedDatabaseResultException(Exception):

0 commit comments

Comments
 (0)