Skip to content

Commit

Permalink
fix(pylint): remove all pylint comments
Browse files Browse the repository at this point in the history
since we are not using pylint anymore, we can remove
all of it's comments from the code
  • Loading branch information
fruch committed Feb 8, 2024
1 parent 627f6dc commit aca9056
Show file tree
Hide file tree
Showing 281 changed files with 1,590 additions and 1,847 deletions.
4 changes: 2 additions & 2 deletions add_new_dc_test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import warnings

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

from longevity_test import LongevityTest
from sdcm.cluster import BaseNode
Expand All @@ -16,7 +16,7 @@ class TestAddNewDc(LongevityTest):
https://docs.scylladb.com/operating-scylla/procedures/cluster-management/add-dc-to-existing-dc/
"""

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

self.log.info("Starting add new DC test...")
assert self.params.get('n_db_nodes').endswith(" 0"), "n_db_nodes must be a list and last dc must equal 0"
Expand Down
3 changes: 1 addition & 2 deletions artifacts_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
}


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

Expand Down Expand Up @@ -298,7 +298,6 @@ def run_pre_create_schema(self, replication_factor=1):
scylla_encryption_options=scylla_encryption_options,
compaction=compaction_strategy, sstable_size=sstable_size)

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

self.run_pre_create_schema()
Expand Down
2 changes: 1 addition & 1 deletion big_cluster_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# Copyright (c) 2016 ScyllaDB

# TODO: this test seem to totally unused, hence disabling all pylint checks
# pylint: disable=all


import logging

Expand Down
6 changes: 2 additions & 4 deletions cdc_replication_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from textwrap import dedent

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

from sdcm import cluster
from sdcm.gemini_thread import GeminiStressThread
Expand Down Expand Up @@ -129,7 +129,7 @@ def test_replication_longevity(self) -> None:
self.start_replicator(Mode.DELTA)

self.consistency_ok = True
# pylint: disable=unexpected-keyword-arg

self.db_cluster.nemesis.append(CategoricalMonkey(
tester_obj=self, termination_event=self.db_cluster.nemesis_termination_event,
dist={
Expand Down Expand Up @@ -222,8 +222,6 @@ def test_replication_longevity(self) -> None:
# or try to reproduce based on the logs in a smaller test.
self.fail('Consistency check failed.')

# pylint: disable=too-many-statements,too-many-branches,too-many-locals

def test_replication(self, is_gemini_test: bool, mode: Mode) -> None:
assert is_gemini_test or (mode == Mode.DELTA), "cassandra-stress doesn't work with preimage/postimage modes"

Expand Down
4 changes: 2 additions & 2 deletions cluster_configuration_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ def test_change_seed_address_to_hostname(self):
addresses = {}
seeds = []
for node in self.db_cluster.nodes:
if hasattr(node._instance, 'public_dns_name'): # pylint: disable=protected-access
addresses[node.private_ip_address] = node._instance.public_dns_name # pylint: disable=protected-access
if hasattr(node._instance, 'public_dns_name'):
addresses[node.private_ip_address] = node._instance.public_dns_name
if node.is_seed:
seeds.append(node.private_ip_address)
else:
Expand Down
2 changes: 1 addition & 1 deletion cql_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def test_cql_example(self):
node = self.db_cluster.nodes[0]
with self.db_cluster.cql_connection_patient(node) as session:
self.create_keyspace(keyspace_name='ks', replication_factor=1)
# pylint: disable=no-member

session.execute("""
CREATE TABLE ks.test1 (
k int,
Expand Down
2 changes: 1 addition & 1 deletion destroy_data_then_repair_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

class CorruptThenRepair(ClusterTester):

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

Expand Down
2 changes: 1 addition & 1 deletion docker/alternator-dns/dns_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def livenodes_update():
# If we're successful, replace livenodes by the new list
livenodes = a
print(livenodes)
except Exception: # pylint: disable=broad-except # noqa: BLE001
except Exception: # noqa: BLE001
# TODO: contacting this ip was unsuccessful, maybe we should
# remove it from the list of live nodes.
pass
Expand Down
16 changes: 8 additions & 8 deletions functional_tests/scylla_operator/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,17 @@
# TODO: add support for multiDC setups

@pytest.hookimpl(tryfirst=True, hookwrapper=True)
def pytest_runtest_makereport(item, call): # pylint: disable=unused-argument
def pytest_runtest_makereport(item, call):
# Populate test result to test function instance
outcome = yield
rep = outcome.get_result()
if rep.skipped:
item._test_result = ('SKIPPED', rep.longrepr[2]) # pylint: disable=protected-access
TESTER.update_test_status(item.nodeid, *item._test_result) # pylint: disable=protected-access
item._test_result = ('SKIPPED', rep.longrepr[2])
TESTER.update_test_status(item.nodeid, *item._test_result)
elif rep.passed:
item._test_result = ('SUCCESS', None) # pylint: disable=protected-access
item._test_result = ('SUCCESS', None)
elif not rep.passed:
item._test_result = ('FAILED', str(rep.longrepr)) # pylint: disable=protected-access
item._test_result = ('FAILED', str(rep.longrepr))


@pytest.fixture(autouse=True, name="harvest_test_results")
Expand All @@ -61,14 +61,14 @@ def fixture_harvest_test_results(request, tester: ScyllaOperatorFunctionalCluste
def publish_test_result():
tester.update_test_status(
request.node.nodeid,
*request.node._test_result) # pylint: disable=protected-access
*request.node._test_result)

request.addfinalizer(publish_test_result)


@pytest.fixture(autouse=True, scope='package', name="tester")
def fixture_tester() -> ScyllaOperatorFunctionalClusterTester:
global TESTER # pylint: disable=global-statement # noqa: PLW0603
global TESTER # noqa: PLW0603
os.chdir(sct_abs_path())
tester_inst = ScyllaOperatorFunctionalClusterTester()
TESTER = tester_inst # putting tester global, so we can report skipped test (one with mark.skip)
Expand Down Expand Up @@ -173,7 +173,7 @@ def _bring_cluster_back_to_original_state(
db_cluster.restart_scylla()
db_cluster.wait_for_nodes_up_and_normal(
nodes=db_cluster.nodes, verification_node=db_cluster.nodes[0])
except Exception as exc: # pylint: disable=broad-except # noqa: BLE001
except Exception as exc: # noqa: BLE001
tester.healthy_flag = False
pytest.fail("Failed to bring cluster nodes back to original state due to :\n" +
"".join(traceback.format_exception(type(exc), exc, exc.__traceback__)))
Expand Down
6 changes: 3 additions & 3 deletions functional_tests/scylla_operator/libs/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def scylla_services_names(db_cluster: ScyllaPodCluster) -> list:
if name not in ('NAME', f"{scylla_cluster_name}-client")]


def wait_for_resource_absence(db_cluster: ScyllaPodCluster, # pylint: disable=too-many-arguments
def wait_for_resource_absence(db_cluster: ScyllaPodCluster,
resource_type: str, resource_name: str,
namespace: str = SCYLLA_NAMESPACE,
step: int = 2, timeout: int = 60) -> None:
Expand Down Expand Up @@ -195,7 +195,7 @@ def verify_resharding_on_k8s(db_cluster: ScyllaPodCluster, cpus: str | int | flo
# One resharding with 100Gb+ may take about 3-4 minutes. So, set 5 minutes timeout per node.
for node, liveness_probe_failures, resharding_start, resharding_finish in nodes_data:
assert wait_for(
func=lambda: list(resharding_start), # pylint: disable=cell-var-from-loop
func=lambda: list(resharding_start),
step=1, timeout=600, throw_exc=False,
text=f"Waiting for the start of resharding on the '{node.name}' node.",
), f"Start of resharding hasn't been detected on the '{node.name}' node."
Expand All @@ -204,7 +204,7 @@ def verify_resharding_on_k8s(db_cluster: ScyllaPodCluster, cpus: str | int | flo

# Wait for the end of resharding
assert wait_for(
func=lambda: list(resharding_finish), # pylint: disable=cell-var-from-loop
func=lambda: list(resharding_finish),
step=3, timeout=600, throw_exc=False,
text=f"Waiting for the finish of resharding on the '{node.name}' node.",
), f"Finish of the resharding hasn't been detected on the '{node.name}' node."
Expand Down
13 changes: 6 additions & 7 deletions functional_tests/scylla_operator/test_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import path
import pytest
import yaml
from cassandra.cluster import ( # pylint: disable=no-name-in-module
from cassandra.cluster import (
EXEC_PROFILE_DEFAULT,
Cluster,
ExecutionProfile,
Expand Down Expand Up @@ -93,7 +93,7 @@ def test_single_operator_image_tag_is_everywhere(db_cluster):


@pytest.mark.required_operator("v1.11.0")
def test_deploy_quasi_multidc_db_cluster(db_cluster: ScyllaPodCluster): # pylint: disable=too-many-locals,too-many-statements,too-many-branches
def test_deploy_quasi_multidc_db_cluster(db_cluster: ScyllaPodCluster):
"""
Deploy 2 'ScyllaCluster' K8S objects in 2 different namespaces in the single K8S cluster
and combine them into a single DB cluster.
Expand Down Expand Up @@ -315,7 +315,7 @@ def wait_for_cleanup_logs(log_follower_name, log_follower, db_cluster):
time.sleep(4)
db_cluster.nodes[0].run_cqlsh(cmd=f"DROP KEYSPACE IF EXISTS {current_ks_name}", timeout=60)
time.sleep(4)
except Exception as exc: # pylint: disable=broad-except # noqa: BLE001
except Exception as exc: # noqa: BLE001
# NOTE: we don't care if some of the queries fail.
# At first, there are redundant ones and, at second, they are utilitary.
log.warning("Utilitary CQL query has failed: %s", exc)
Expand Down Expand Up @@ -638,7 +638,7 @@ def change_cluster_spec() -> None:
# NOTE: increase the value only when the sysctl spec update is successful
# to avoid false negative results in further assertions
expected_aio_max_nr_value += 1
except Exception as error: # pylint: disable=broad-except # noqa: BLE001
except Exception as error: # noqa: BLE001
str_error = str(error)
log.debug("Change /spec/sysctls value to %d failed. Error: %s",
expected_aio_max_nr_value, str_error)
Expand Down Expand Up @@ -848,7 +848,7 @@ def test_rolling_config_change_internode_compression(db_cluster, scylla_yaml):


@pytest.mark.restart_is_used
def test_scylla_yaml_override(db_cluster, scylla_yaml): # pylint: disable=too-many-branches
def test_scylla_yaml_override(db_cluster, scylla_yaml):
"""
Test of applying scylla.yaml via configmap
- update parameter that exists in scylla.yaml
Expand Down Expand Up @@ -950,7 +950,6 @@ def test_default_dns_policy(db_cluster: ScyllaPodCluster):
@pytest.mark.required_operator("v1.8.0")
@pytest.mark.requires_tls
def test_operator_managed_tls(db_cluster: ScyllaPodCluster, tmp_path: path.Path):
# pylint: disable=too-many-locals

cluster_name = db_cluster.k8s_cluster.k8s_scylla_cluster_name

Expand Down Expand Up @@ -982,7 +981,7 @@ def test_operator_managed_tls(db_cluster: ScyllaPodCluster, tmp_path: path.Path)
cluster = Cluster(contact_points=[db_cluster.nodes[0].cql_address], port=db_cluster.nodes[0].CQL_SSL_PORT,
execution_profiles={EXEC_PROFILE_DEFAULT: execution_profile})
ssl_context = ssl.SSLContext(protocol=ssl.PROTOCOL_SSLv23)
ssl_context.verify_mode = ssl.VerifyMode.CERT_REQUIRED # pylint: disable=no-member
ssl_context.verify_mode = ssl.VerifyMode.CERT_REQUIRED

ssl_context.load_verify_locations(cadata=ca_filename.read_text())
ssl_context.load_cert_chain(keyfile=key_filename, certfile=crt_filename)
Expand Down
2 changes: 1 addition & 1 deletion grow_cluster_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def test_grow_x_to_y(self):
self.grow_cluster(cluster_target_size=self._cluster_target_size,
stress_cmd=self.get_stress_cmd())

def test_grow_3_to_4_large_partition(self): # pylint: disable=invalid-name
def test_grow_3_to_4_large_partition(self):
"""
Shorter version of the cluster growth test.
Expand Down
2 changes: 1 addition & 1 deletion ics_space_amplification_goal_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def _set_enforce_min_threshold_true(self):
node.stop_scylla_server()
node.start_scylla_server()

def test_ics_space_amplification_goal(self): # pylint: disable=too-many-locals
def test_ics_space_amplification_goal(self):
"""
(1) writing new data. wait for compactions to finish.
(2) over-writing existing data.
Expand Down
1 change: 0 additions & 1 deletion longevity_alternator_ttl_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ def test_disable_enable_ttl_scan(self):
4. Wait for TTL-scan intervals to run
5. Run a background read stress while data is being expired.
"""
# pylint: disable=too-many-locals,too-many-branches,too-many-statements

self.db_cluster.add_nemesis(nemesis=self.get_nemesis_class(),
tester_obj=self)
Expand Down
2 changes: 1 addition & 1 deletion longevity_large_partition_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def pre_create_large_partitions_schema(self, compaction_strategy=CompactionStrat
node = self.db_cluster.nodes[0]
create_table_query = create_scylla_bench_table_query(compaction_strategy=compaction_strategy)
with self.db_cluster.cql_connection_patient(node) as session:
# pylint: disable=no-member

session.execute("""
CREATE KEYSPACE IF NOT EXISTS scylla_bench WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': 3}
""")
Expand Down
20 changes: 9 additions & 11 deletions longevity_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

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

from sdcm.cluster import MAX_TIME_WAIT_FOR_NEW_NODE_UP
from sdcm.sct_events import Severity
Expand All @@ -40,7 +40,7 @@ class LongevityTest(ClusterTester, loader_utils.LoaderUtilsMixin):
Test a Scylla cluster stability over a time period.
"""

def __init__(self, *args, **kwargs): # pylint: disable=too-many-statements,too-many-locals,too-many-branches
def __init__(self, *args, **kwargs):
super().__init__(*args)

# This ignores large_data warning messages "Writing large collection" for large collections to prevent
Expand Down Expand Up @@ -116,7 +116,6 @@ def test_custom_time(self):
"""
Run cassandra-stress with params defined in data_dir/scylla.yaml
"""
# pylint: disable=too-many-locals,too-many-branches,too-many-statements

self.db_cluster.add_nemesis(nemesis=self.get_nemesis_class(),
tester_obj=self)
Expand Down Expand Up @@ -177,7 +176,7 @@ def test_custom_time(self):
profile_dst = os.path.join('/tmp', os.path.basename(cs_profile))
with open(cs_profile, encoding="utf-8") as pconf:
cont = pconf.readlines()
user_profile_table_count = self.params.get( # pylint: disable=invalid-name
user_profile_table_count = self.params.get(
'user_profile_table_count')
for _ in range(user_profile_table_count):
for cmd in [line.lstrip('#').strip() for line in cont if line.find('cassandra-stress') > 0]:
Expand Down Expand Up @@ -288,7 +287,7 @@ def test_user_batch_custom_time(self):
assert os.path.exists(cs_profile), f'File not found: {cs_profile}'
self.log.debug(f'Run stress test with user profile {cs_profile}, duration {cs_duration}')

user_profile_table_count = self.params.get('user_profile_table_count') # pylint: disable=invalid-name
user_profile_table_count = self.params.get('user_profile_table_count')

for _ in range(user_profile_table_count):
stress_params_list += self.create_templated_user_stress_params(next(templated_table_counter),
Expand All @@ -306,7 +305,6 @@ def _run_user_stress_in_batches(self, batch_size, stress_params_list, duration):
:param stress_params_list: the list of all stress commands
:return:
"""
# pylint: disable=too-many-locals

def chunks(_list, chunk_size):
"""Yield successive n-sized chunks from _list."""
Expand Down Expand Up @@ -409,8 +407,8 @@ def _pre_create_schema(self, keyspace_num=1, scylla_encryption_options=None):
compaction=compaction_strategy, sstable_size=sstable_size)

def _pre_create_templated_user_schema(self, batch_start=None, batch_end=None):
# pylint: disable=too-many-locals
user_profile_table_count = self.params.get( # pylint: disable=invalid-name

user_profile_table_count = self.params.get(
'user_profile_table_count') or 0
cs_user_profiles = self.params.get('cs_user_profiles')
# read user-profile
Expand Down Expand Up @@ -468,7 +466,7 @@ def get_email_data(self):
try:
grafana_dataset = self.monitors.get_grafana_screenshot_and_snapshot(
self.start_time) if self.monitors else {}
except Exception as error: # pylint: disable=broad-except
except Exception as error:
self.log.exception("Error in gathering Grafana screenshots and snapshots. Error:\n%s",
error, exc_info=error)

Expand All @@ -484,8 +482,8 @@ def get_email_data(self):
"scylla_ami_id": self.params.get("ami_id_db_scylla") or "-", })
return email_data

def create_templated_user_stress_params(self, idx, cs_profile): # pylint: disable=invalid-name
# pylint: disable=too-many-locals
def create_templated_user_stress_params(self, idx, cs_profile):

params_list = []
cs_duration = self.params.get('cs_duration')

Expand Down
1 change: 0 additions & 1 deletion longevity_tombstone_gc_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ def test_switch_tombstone_gc_modes(self):
Run a major compaction.
Verify no tombstones.
"""
# pylint: disable=too-many-locals,too-many-statements

self.create_tables_for_scylla_bench()
self.db_node = self.db_cluster.nodes[0]
Expand Down
Loading

0 comments on commit aca9056

Please sign in to comment.