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