mirror of https://github.com/citusdata/citus.git
Fix issues reported by flake8
parent
188cc7d2ae
commit
9f41ea2157
|
@ -6,7 +6,7 @@ import subprocess
|
|||
import sys
|
||||
|
||||
import utils
|
||||
from utils import USER, cd
|
||||
from utils import USER
|
||||
|
||||
|
||||
def initialize_temp_dir(temp_dir):
|
||||
|
@ -70,8 +70,11 @@ def add_settings(abs_data_path, settings):
|
|||
|
||||
def create_role(pg_path, node_ports, user_name):
|
||||
def create(port):
|
||||
command = "SET citus.enable_ddl_propagation TO OFF; SELECT worker_create_or_alter_role('{}', 'CREATE ROLE {} WITH LOGIN CREATEROLE CREATEDB;', NULL)".format(
|
||||
user_name, user_name
|
||||
command = (
|
||||
"SET citus.enable_ddl_propagation TO OFF;"
|
||||
+ "SELECT worker_create_or_alter_role('{}', 'CREATE ROLE {} WITH LOGIN CREATEROLE CREATEDB;', NULL)".format(
|
||||
user_name, user_name
|
||||
)
|
||||
)
|
||||
utils.psql(pg_path, port, command)
|
||||
command = "SET citus.enable_ddl_propagation TO OFF; GRANT CREATE ON DATABASE postgres to {}".format(
|
||||
|
|
|
@ -75,7 +75,7 @@ def find_free_port():
|
|||
port = next_port
|
||||
next_port += 1
|
||||
return port
|
||||
except:
|
||||
except Exception:
|
||||
next_port += 1
|
||||
# we couldn't find a port
|
||||
raise Exception("Couldn't find a port to use")
|
||||
|
|
|
@ -63,7 +63,7 @@ test_files_to_skip = [
|
|||
test_files_to_run_without_schedule = ["single_node_enterprise"]
|
||||
|
||||
if not (test_file_name or test_file_path):
|
||||
print(f"FATAL: No test given.")
|
||||
print("FATAL: No test given.")
|
||||
sys.exit(2)
|
||||
|
||||
|
||||
|
@ -77,7 +77,7 @@ if test_file_path:
|
|||
test_file_extension = pathlib.Path(test_file_path).suffix
|
||||
test_file_name = pathlib.Path(test_file_path).stem
|
||||
|
||||
if not test_file_extension in ".spec.sql":
|
||||
if test_file_extension not in ".spec.sql":
|
||||
print(
|
||||
"ERROR: Unrecognized test extension. Valid extensions are: .sql and .spec"
|
||||
)
|
||||
|
@ -142,7 +142,7 @@ tmp_schedule_path = os.path.join(
|
|||
if test_file_name not in test_files_to_run_without_schedule:
|
||||
shutil.copy2(os.path.join(regress_dir, test_schedule), tmp_schedule_path)
|
||||
with open(tmp_schedule_path, "a") as myfile:
|
||||
for i in range(args["repeat"]):
|
||||
for _ in range(args["repeat"]):
|
||||
myfile.write(test_schedule_line)
|
||||
|
||||
# find suitable make recipe
|
||||
|
|
|
@ -94,7 +94,7 @@ def remove_citus(tar_path):
|
|||
|
||||
def remove_tar_files(tar_path):
|
||||
ps = subprocess.Popen(("tar", "tf", tar_path), stdout=subprocess.PIPE)
|
||||
output = subprocess.check_output(("xargs", "rm", "-v"), stdin=ps.stdout)
|
||||
subprocess.check_output(("xargs", "rm", "-v"), stdin=ps.stdout)
|
||||
ps.wait()
|
||||
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ import struct
|
|||
import threading
|
||||
import time
|
||||
import traceback
|
||||
from collections import defaultdict
|
||||
from itertools import count
|
||||
|
||||
import structs
|
||||
|
|
|
@ -8,7 +8,6 @@ from construct import (
|
|||
Computed,
|
||||
CString,
|
||||
Enum,
|
||||
FixedSized,
|
||||
GreedyBytes,
|
||||
GreedyRange,
|
||||
Int8ub,
|
||||
|
@ -16,10 +15,7 @@ from construct import (
|
|||
Int16ub,
|
||||
Int32sb,
|
||||
Int32ub,
|
||||
Pointer,
|
||||
Probe,
|
||||
RestreamData,
|
||||
Seek,
|
||||
Struct,
|
||||
Switch,
|
||||
this,
|
||||
|
@ -179,7 +175,7 @@ class Query(FrontendMessage):
|
|||
'COPY public.copy_test_XXXXXX (key, value) FROM STDIN WITH (FORMAT BINARY))'
|
||||
"""
|
||||
result = content
|
||||
pattern = re.compile("public\.[a-z_]+(?P<shardid>[0-9]+)")
|
||||
pattern = re.compile(r"public\.[a-z_]+(?P<shardid>[0-9]+)")
|
||||
for match in pattern.finditer(content):
|
||||
span = match.span("shardid")
|
||||
replacement = "X" * (span[1] - span[0])
|
||||
|
@ -211,9 +207,9 @@ class Query(FrontendMessage):
|
|||
"""
|
||||
|
||||
pattern = re.compile(
|
||||
"assign_distributed_transaction_id\s*\(" # a method call
|
||||
"\s*[0-9]+\s*," # an integer first parameter
|
||||
"\s*(?P<transaction_id>[0-9]+)" # an integer second parameter
|
||||
r"assign_distributed_transaction_id\s*\(" # a method call
|
||||
r"\s*[0-9]+\s*," # an integer first parameter
|
||||
r"\s*(?P<transaction_id>[0-9]+)" # an integer second parameter
|
||||
)
|
||||
result = content
|
||||
for match in pattern.finditer(content):
|
||||
|
|
Loading…
Reference in New Issue