Skip to content

Commit 268a65c

Browse files
pehalavponomaryov
authored andcommitted
improvement(treewide): Remove pylint disables
(cherry picked from commit 5c55c7c)
1 parent 908746e commit 268a65c

File tree

298 files changed

+1327
-1603
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

298 files changed

+1327
-1603
lines changed

.github/scripts/search_commits.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def get_parser():
2424
return parser.parse_args()
2525

2626

27-
def main(): # pylint: disable=too-many-locals # noqa: PLR0914
27+
def main(): # noqa: PLR0914
2828
args = get_parser()
2929
github = Github(github_token)
3030
repo = github.get_repo(args.repository, lazy=False)
@@ -44,7 +44,7 @@ def main(): # pylint: disable=too-many-locals # noqa: PLR0914
4444
}
4545
response = requests.get(search_url, headers=headers, params=params)
4646
prs = response.json().get("items", [])
47-
for pr in prs: # pylint: disable=invalid-name
47+
for pr in prs:
4848
match = re.findall(r'Parent PR: #(\d+)', pr["body"])
4949
if match:
5050
pr_number = int(match[0])

add_new_dc_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from typing import Tuple, List
33

44
from cassandra import ConsistencyLevel
5-
from cassandra.query import SimpleStatement # pylint: disable=no-name-in-module
5+
from cassandra.query import SimpleStatement
66

77
from longevity_test import LongevityTest
88
from sdcm.cluster import BaseNode
@@ -19,7 +19,7 @@ class TestAddNewDc(LongevityTest):
1919
https://docs.scylladb.com/operating-scylla/procedures/cluster-management/add-dc-to-existing-dc/
2020
"""
2121

22-
def test_add_new_dc(self) -> None: # pylint: disable=too-many-locals
22+
def test_add_new_dc(self) -> None:
2323

2424
self.log.info("Starting add new DC test...")
2525
assert self.params.get('n_db_nodes').endswith(" 0"), "n_db_nodes must be a list and last dc must equal 0"

argus/client/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class ArgusClient:
2222
schema_version: str | None = None
2323

2424
class Routes():
25-
# pylint: disable=too-few-public-methods
25+
2626
SUBMIT = "/testrun/$type/submit"
2727
GET = "/testrun/$type/$id/get"
2828
HEARTBEAT = "/testrun/$type/$id/heartbeat"

artifacts_test.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
}
4747

4848

49-
class ArtifactsTest(ClusterTester): # pylint: disable=too-many-public-methods
49+
class ArtifactsTest(ClusterTester):
5050
REPO_TABLE = "housekeeping.repo"
5151
CHECK_VERSION_TABLE = "housekeeping.checkversion"
5252

@@ -316,7 +316,6 @@ def run_pre_create_schema(self, replication_factor=1):
316316
scylla_encryption_options=scylla_encryption_options,
317317
compaction=compaction_strategy, sstable_size=sstable_size)
318318

319-
# pylint: disable=too-many-statements,too-many-branches
320319
def test_scylla_service(self):
321320

322321
self.run_pre_create_schema()
@@ -343,7 +342,7 @@ def test_scylla_service(self):
343342
)
344343
except SkipTest as exc:
345344
self.log.info("Skipping IOTuneValidation due to %s", exc.args)
346-
except Exception: # pylint: disable=broad-except # noqa: BLE001
345+
except Exception: # noqa: BLE001
347346
self.log.error("IOTuneValidator failed", exc_info=True)
348347
TestFrameworkEvent(source={self.__class__.__name__},
349348
message="Error during IOTune params validation.",

big_cluster_test.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
#
1414
# Copyright (c) 2016 ScyllaDB
1515

16-
# TODO: this test seem to totally unused, hence disabling all pylint checks
17-
# pylint: disable=all
16+
# TODO: this test seem to totally unused
1817

1918
import logging
2019

cdc_replication_test.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from typing import Optional, Tuple
2424

2525
from cassandra import ConsistencyLevel
26-
from cassandra.query import SimpleStatement # pylint: disable=no-name-in-module
26+
from cassandra.query import SimpleStatement
2727

2828
from sdcm import cluster
2929
from sdcm.tester import ClusterTester
@@ -132,7 +132,6 @@ def test_replication_longevity(self) -> None:
132132
self.start_replicator(Mode.DELTA)
133133

134134
self.consistency_ok = True
135-
# pylint: disable=unexpected-keyword-arg
136135
self.db_cluster.nemesis.append(CategoricalMonkey(
137136
tester_obj=self, termination_event=self.db_cluster.nemesis_termination_event,
138137
dist={
@@ -225,8 +224,6 @@ def test_replication_longevity(self) -> None:
225224
# or try to reproduce based on the logs in a smaller test.
226225
self.fail('Consistency check failed.')
227226

228-
# pylint: disable=too-many-statements,too-many-branches,too-many-locals
229-
230227
def test_replication(self, is_gemini_test: bool, mode: Mode) -> None:
231228
assert is_gemini_test or (mode == Mode.DELTA), "cassandra-stress doesn't work with preimage/postimage modes"
232229

cql_test.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ def test_cql_example(self):
3131
node = self.db_cluster.nodes[0]
3232
with self.db_cluster.cql_connection_patient(node) as session:
3333
self.create_keyspace(keyspace_name='ks', replication_factor=1)
34-
# pylint: disable=no-member
3534
session.execute("""
3635
CREATE TABLE ks.test1 (
3736
k int,

destroy_data_then_repair_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
class CorruptThenRepair(ClusterTester):
2121

22-
def test_destroy_data_then_repair_test_nodes(self): # pylint: disable=invalid-name
22+
def test_destroy_data_then_repair_test_nodes(self):
2323
# populates 100GB
2424
write_queue = self.populate_data_parallel(100, blocking=False)
2525

docker/alternator-dns/dns_server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def livenodes_update():
3434
# If we're successful, replace livenodes by the new list
3535
livenodes = a
3636
print(livenodes)
37-
except Exception: # pylint: disable=broad-except # noqa: BLE001
37+
except Exception: # noqa: BLE001
3838
# TODO: contacting this ip was unsuccessful, maybe we should
3939
# remove it from the list of live nodes.
4040
pass

functional_tests/scylla_operator/conftest.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,17 @@
4343
# TODO: add support for multiDC setups
4444

4545
@pytest.hookimpl(tryfirst=True, hookwrapper=True)
46-
def pytest_runtest_makereport(item, call): # pylint: disable=unused-argument
46+
def pytest_runtest_makereport(item, call):
4747
# Populate test result to test function instance
4848
outcome = yield
4949
rep = outcome.get_result()
5050
if rep.skipped:
51-
item._test_result = ('SKIPPED', rep.longrepr[2]) # pylint: disable=protected-access
52-
TESTER.update_test_status(item.nodeid, *item._test_result) # pylint: disable=protected-access
51+
item._test_result = ('SKIPPED', rep.longrepr[2])
52+
TESTER.update_test_status(item.nodeid, *item._test_result)
5353
elif rep.passed:
54-
item._test_result = ('SUCCESS', None) # pylint: disable=protected-access
54+
item._test_result = ('SUCCESS', None)
5555
elif not rep.passed:
56-
item._test_result = ('FAILED', str(rep.longrepr)) # pylint: disable=protected-access
56+
item._test_result = ('FAILED', str(rep.longrepr))
5757

5858

5959
@pytest.fixture(autouse=True, name="harvest_test_results")
@@ -63,14 +63,14 @@ def fixture_harvest_test_results(request, tester: ScyllaOperatorFunctionalCluste
6363
def publish_test_result():
6464
tester.update_test_status(
6565
request.node.nodeid,
66-
*request.node._test_result) # pylint: disable=protected-access
66+
*request.node._test_result)
6767

6868
request.addfinalizer(publish_test_result)
6969

7070

7171
@pytest.fixture(autouse=True, scope='package', name="tester")
7272
def fixture_tester() -> ScyllaOperatorFunctionalClusterTester:
73-
global TESTER # pylint: disable=global-statement # noqa: PLW0603
73+
global TESTER # noqa: PLW0603
7474
os.chdir(sct_abs_path())
7575
tester_inst = ScyllaOperatorFunctionalClusterTester()
7676
TESTER = tester_inst # putting tester global, so we can report skipped test (one with mark.skip)
@@ -175,7 +175,7 @@ def _bring_cluster_back_to_original_state(
175175
db_cluster.restart_scylla()
176176
db_cluster.wait_for_nodes_up_and_normal(
177177
nodes=db_cluster.nodes, verification_node=db_cluster.nodes[0])
178-
except Exception as exc: # pylint: disable=broad-except # noqa: BLE001
178+
except Exception as exc: # noqa: BLE001
179179
tester.healthy_flag = False
180180
pytest.fail("Failed to bring cluster nodes back to original state due to :\n" +
181181
"".join(traceback.format_exception(type(exc), exc, exc.__traceback__)))

functional_tests/scylla_operator/libs/helpers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def scylla_services_names(db_cluster: ScyllaPodCluster) -> list:
100100
if name not in ('NAME', f"{scylla_cluster_name}-client")]
101101

102102

103-
def wait_for_resource_absence(db_cluster: ScyllaPodCluster, # pylint: disable=too-many-arguments
103+
def wait_for_resource_absence(db_cluster: ScyllaPodCluster,
104104
resource_type: str, resource_name: str,
105105
namespace: str = SCYLLA_NAMESPACE,
106106
step: int = 2, timeout: int = 60) -> None:
@@ -198,7 +198,7 @@ def verify_resharding_on_k8s(db_cluster: ScyllaPodCluster, cpus: Union[str, int,
198198
# One resharding with 100Gb+ may take about 3-4 minutes. So, set 5 minutes timeout per node.
199199
for node, liveness_probe_failures, resharding_start, resharding_finish in nodes_data:
200200
assert wait_for(
201-
func=lambda: list(resharding_start), # pylint: disable=cell-var-from-loop
201+
func=lambda: list(resharding_start),
202202
step=1, timeout=600, throw_exc=False,
203203
text=f"Waiting for the start of resharding on the '{node.name}' node.",
204204
), f"Start of resharding hasn't been detected on the '{node.name}' node."
@@ -207,7 +207,7 @@ def verify_resharding_on_k8s(db_cluster: ScyllaPodCluster, cpus: Union[str, int,
207207

208208
# Wait for the end of resharding
209209
assert wait_for(
210-
func=lambda: list(resharding_finish), # pylint: disable=cell-var-from-loop
210+
func=lambda: list(resharding_finish),
211211
step=3, timeout=600, throw_exc=False,
212212
text=f"Waiting for the finish of resharding on the '{node.name}' node.",
213213
), f"Finish of the resharding hasn't been detected on the '{node.name}' node."

functional_tests/scylla_operator/test_functional.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#
1414
# Copyright (c) 2021 ScyllaDB
1515

16-
# pylint: disable=too-many-lines
1716
import logging
1817
import os
1918
import random
@@ -26,7 +25,7 @@
2625

2726
import pytest
2827
import yaml
29-
from cassandra.cluster import ( # pylint: disable=no-name-in-module
28+
from cassandra.cluster import (
3029
Cluster,
3130
ExecutionProfile,
3231
EXEC_PROFILE_DEFAULT,
@@ -95,7 +94,7 @@ def test_single_operator_image_tag_is_everywhere(db_cluster):
9594

9695

9796
@pytest.mark.required_operator("v1.11.0")
98-
def test_deploy_quasi_multidc_db_cluster(db_cluster: ScyllaPodCluster): # pylint: disable=too-many-locals,too-many-statements,too-many-branches # noqa: PLR0914
97+
def test_deploy_quasi_multidc_db_cluster(db_cluster: ScyllaPodCluster): # noqa: PLR0914
9998
"""
10099
Deploy 2 'ScyllaCluster' K8S objects in 2 different namespaces in the single K8S cluster
101100
and combine them into a single DB cluster.
@@ -322,7 +321,7 @@ def wait_for_cleanup_logs(log_follower_name, log_follower, db_cluster):
322321
time.sleep(4)
323322
db_cluster.nodes[0].run_cqlsh(cmd=f"DROP KEYSPACE IF EXISTS {current_ks_name}", timeout=60)
324323
time.sleep(4)
325-
except Exception as exc: # pylint: disable=broad-except # noqa: BLE001
324+
except Exception as exc: # noqa: BLE001
326325
# NOTE: we don't care if some of the queries fail.
327326
# At first, there are redundant ones and, at second, they are utilitary.
328327
log.warning("Utilitary CQL query has failed: %s", exc)
@@ -647,7 +646,7 @@ def change_cluster_spec() -> None:
647646
# NOTE: increase the value only when the sysctl spec update is successful
648647
# to avoid false negative results in further assertions
649648
expected_aio_max_nr_value += 1
650-
except Exception as error: # pylint: disable=broad-except # noqa: BLE001
649+
except Exception as error: # noqa: BLE001
651650
str_error = str(error)
652651
log.debug("Change /spec/sysctls value to %d failed. Error: %s",
653652
expected_aio_max_nr_value, str_error)
@@ -853,7 +852,7 @@ def test_rolling_config_change_internode_compression(db_cluster, scylla_yaml):
853852

854853

855854
@pytest.mark.restart_is_used
856-
def test_scylla_yaml_override(db_cluster, scylla_yaml): # pylint: disable=too-many-branches
855+
def test_scylla_yaml_override(db_cluster, scylla_yaml):
857856
"""
858857
Test of applying scylla.yaml via configmap
859858
- update parameter that exists in scylla.yaml
@@ -958,7 +957,6 @@ def test_default_dns_policy(db_cluster: ScyllaPodCluster):
958957
@pytest.mark.required_operator("v1.8.0")
959958
@pytest.mark.requires_tls_and_sni
960959
def test_operator_managed_tls(db_cluster: ScyllaPodCluster, tmp_path: path.Path):
961-
# pylint: disable=too-many-locals
962960

963961
cluster_name = db_cluster.k8s_cluster.k8s_scylla_cluster_name
964962

@@ -990,7 +988,7 @@ def test_operator_managed_tls(db_cluster: ScyllaPodCluster, tmp_path: path.Path)
990988
cluster = Cluster(contact_points=[db_cluster.nodes[0].cql_address], port=db_cluster.nodes[0].CQL_SSL_PORT,
991989
execution_profiles={EXEC_PROFILE_DEFAULT: execution_profile})
992990
ssl_context = ssl.SSLContext(protocol=ssl.PROTOCOL_SSLv23)
993-
ssl_context.verify_mode = ssl.VerifyMode.CERT_REQUIRED # pylint: disable=no-member
991+
ssl_context.verify_mode = ssl.VerifyMode.CERT_REQUIRED
994992

995993
ssl_context.load_verify_locations(cadata=ca_filename.read_text())
996994
ssl_context.load_cert_chain(keyfile=key_filename, certfile=crt_filename)

grow_cluster_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def test_grow_x_to_y(self):
122122
self.grow_cluster(cluster_target_size=self._cluster_target_size,
123123
stress_cmd=self.get_stress_cmd())
124124

125-
def test_grow_3_to_4_large_partition(self): # pylint: disable=invalid-name
125+
def test_grow_3_to_4_large_partition(self):
126126
"""
127127
Shorter version of the cluster growth test.
128128

ics_space_amplification_goal_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def _set_enforce_min_threshold_true(self):
135135
node.stop_scylla_server()
136136
node.start_scylla_server()
137137

138-
def test_ics_space_amplification_goal(self): # pylint: disable=too-many-locals # noqa: PLR0914
138+
def test_ics_space_amplification_goal(self): # noqa: PLR0914
139139
"""
140140
(1) writing new data. wait for compactions to finish.
141141
(2) over-writing existing data.

longevity_alternator_ttl_test.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ def test_disable_enable_ttl_scan(self):
100100
4. Wait for TTL-scan intervals to run
101101
5. Run a background read stress while data is being expired.
102102
"""
103-
# pylint: disable=too-many-locals,too-many-branches,too-many-statements
104103

105104
self.db_cluster.add_nemesis(nemesis=self.get_nemesis_class(),
106105
tester_obj=self)

longevity_large_partition_test.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ def pre_create_large_partitions_schema(self, compaction_strategy=CompactionStrat
1414
node = self.db_cluster.nodes[0]
1515
create_table_query = create_scylla_bench_table_query(compaction_strategy=compaction_strategy)
1616
with self.db_cluster.cql_connection_patient(node) as session:
17-
# pylint: disable=no-member
1817
session.execute("""
1918
CREATE KEYSPACE IF NOT EXISTS scylla_bench WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': 3}
2019
""")

longevity_test.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
import yaml
2525
from cassandra import AlreadyExists, InvalidRequest
26-
from cassandra.query import SimpleStatement # pylint: disable=no-name-in-module
26+
from cassandra.query import SimpleStatement
2727

2828
from sdcm import sct_abs_path
2929
from sdcm.sct_events.group_common_events import \
@@ -126,7 +126,6 @@ def test_custom_time(self): # noqa: PLR0914
126126
"""
127127
Run cassandra-stress with params defined in data_dir/scylla.yaml
128128
"""
129-
# pylint: disable=too-many-locals,too-many-branches,too-many-statements
130129

131130
self.db_cluster.add_nemesis(nemesis=self.get_nemesis_class(),
132131
tester_obj=self)
@@ -206,7 +205,7 @@ def is_target_reached(current: list[int], target: list[int]) -> bool:
206205
profile_dst = os.path.join('/tmp', os.path.basename(cs_profile))
207206
with open(cs_profile, encoding="utf-8") as pconf:
208207
cont = pconf.readlines()
209-
user_profile_table_count = self.params.get( # pylint: disable=invalid-name
208+
user_profile_table_count = self.params.get(
210209
'user_profile_table_count')
211210
for _ in range(user_profile_table_count):
212211
for cmd in [line.lstrip('#').strip() for line in cont if line.find('cassandra-stress') > 0]:
@@ -338,7 +337,6 @@ def _run_user_stress_in_batches(self, batch_size, stress_params_list, duration):
338337
:param stress_params_list: the list of all stress commands
339338
:return:
340339
"""
341-
# pylint: disable=too-many-locals
342340

343341
def chunks(_list, chunk_size):
344342
"""Yield successive n-sized chunks from _list."""
@@ -442,8 +440,7 @@ def _pre_create_schema(self, keyspace_num=1, scylla_encryption_options=None):
442440
compaction=compaction_strategy, sstable_size=sstable_size)
443441

444442
def _pre_create_templated_user_schema(self, batch_start=None, batch_end=None):
445-
# pylint: disable=too-many-locals
446-
user_profile_table_count = self.params.get( # pylint: disable=invalid-name
443+
user_profile_table_count = self.params.get(
447444
'user_profile_table_count') or 0
448445
cs_user_profiles = self.params.get('cs_user_profiles')
449446
# read user-profile
@@ -509,8 +506,7 @@ def get_email_data(self):
509506
})
510507
return email_data
511508

512-
def create_templated_user_stress_params(self, idx, cs_profile) -> List[Dict]: # pylint: disable=invalid-name
513-
# pylint: disable=too-many-locals
509+
def create_templated_user_stress_params(self, idx, cs_profile) -> List[Dict]:
514510
params_list = []
515511
cs_duration = self.params.get('cs_duration')
516512

longevity_tombstone_gc_test.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ def test_switch_tombstone_gc_modes(self):
6464
Run a major compaction.
6565
Verify no tombstones.
6666
"""
67-
# pylint: disable=too-many-locals,too-many-statements
6867

6968
self.create_tables_for_scylla_bench()
7069
self.db_node = self.db_cluster.nodes[0]

0 commit comments

Comments
 (0)