Coding style fixes (PEP8)

Fixed various coding style stuff detected by flake8.
Added .pre-commit-config.yaml:
With command pre_commit install a hook for flake8 will be
installed.
This commit is contained in:
Georg Richter
2022-08-07 16:47:26 +02:00
parent 3fe0ee06ec
commit cdd42743cc
44 changed files with 1372 additions and 1145 deletions

View File

@ -1,15 +1,17 @@
#!/usr/bin/env python3 -O
# -*- coding: utf-8 -*-
import pyperf, os
import pyperf
import os
from benchmarks.benchmark.do_1 import do1
from benchmarks.benchmark.fetch import *
from benchmarks.benchmark.fetch import str_fetchloop, str_fetchall,\
num_fetchloop, num_fetchall
from benchmarks.benchmark.select_1 import select_1
from benchmarks.benchmark.select_param import select_param
from benchmarks.benchmark.select_10_cols_from_seq_1_to_10000 import select_10_cols_from_seq_1_to_10000
from benchmarks.benchmark.select_10_cols_from_seq_1_to_10000\
import select_10_cols_from_seq_1_to_10000
from benchmarks.benchmark.select_1_mysql_user import select_1_mysql_user
from benchmarks.benchmark.bulk import bulk
@ -19,20 +21,26 @@ def run_test(tests, conn, paramstyle):
for test in tests:
runner.bench_time_func(test['label'], test['method'], conn, paramstyle)
def test_suite(paramstyle):
is_mysql= int(os.environ.get('TEST_MYSQL', '1'))
ts= [
{'label': '100 rows * 3 col utf8 string using fetchone', 'method': str_fetchloop},
{'label': '100 rows * 3 col utf8 string using fetchall', 'method': str_fetchall},
{'label': '1000 rows * 5 numeric col using fetchone', 'method': num_fetchloop},
{'label': '1000 rows * 5 numeric col using fetchall', 'method': num_fetchall},
is_mysql = int(os.environ.get('TEST_MYSQL', '1'))
ts = [
{'label': '100 rows * 3 col utf8 string using fetchone',
'method': str_fetchloop},
{'label': '100 rows * 3 col utf8 string using fetchall',
'method': str_fetchall},
{'label': '1000 rows * 5 numeric col using fetchone',
'method': num_fetchloop},
{'label': '1000 rows * 5 numeric col using fetchall',
'method': num_fetchall},
{'label': 'select 1', 'method': select_1},
{'label': 'select ? - param 1', 'method': select_param},
{'label': 'bulk: insert/update/delete', 'method': bulk},
]
if is_mysql == 1:
ts.append({'label': 'select 1 mysql user', 'method': select_1_mysql_user})
ts.append({'label': 'select 1 mysql user',
'method': select_1_mysql_user})
ts.append({'label': 'do 1', 'method': do1})
ts.append({'label': 'Select <10 cols of 100 chars> from_seq_1_to_100000', 'method':
select_10_cols_from_seq_1_to_10000})
return ts
ts.append({'label': 'Select <10 colx100 chars> from_seq_1_to_100000',
'method': select_10_cols_from_seq_1_to_10000})
return ts