misc: apply double-quote-string-fixer (#79788)

This commit is contained in:
Valentin Deniaud 2023-08-16 10:31:39 +02:00
parent 362bd38754
commit 4627cf8207
4 changed files with 18 additions and 18 deletions

View File

@ -47,16 +47,16 @@ def get_version():
setup(
name="wcs-olap",
name='wcs-olap',
version=get_version(),
license="AGPLv3+",
description="Export w.c.s. data to an OLAP cube",
license='AGPLv3+',
description='Export w.c.s. data to an OLAP cube',
long_description=open('README.rst').read(),
url="http://dev.entrouvert.org/projects/publik-bi/",
url='http://dev.entrouvert.org/projects/publik-bi/',
author="Entr'ouvert",
author_email="authentic@listes.entrouvert.com",
maintainer="Benjamin Dauvergne",
maintainer_email="bdauvergne@entrouvert.com",
author_email='authentic@listes.entrouvert.com',
maintainer='Benjamin Dauvergne',
maintainer_email='bdauvergne@entrouvert.com',
packages=find_packages(),
include_package_data=True,
install_requires=['requests', 'psycopg2', 'isodate', 'six', 'cached-property'],

View File

@ -216,7 +216,7 @@ def test_requests_exception(wcs, postgres_db, tmpdir, olap_cmd, caplog):
def test_requests_not_ok(wcs, postgres_db, tmpdir, olap_cmd, caplog):
@httmock.urlmatch()
def return_401(url, request):
return {'status_code': 401, 'content': {"err": 1, "err_desc": "invalid signature"}}
return {'status_code': 401, 'content': {'err': 1, 'err_desc': 'invalid signature'}}
with httmock.HTTMock(return_401):
assert olap_cmd(no_log_errors=False) != 0

View File

@ -91,7 +91,7 @@ def main2():
)
parser.add_argument('--no-log-errors', dest='no_log_errors', action='store_true', default=False)
parser.add_argument('--fake', action='store_true', default=False)
group.add_argument("-a", "--all", help="synchronize all wcs", action='store_true', default=False)
group.add_argument('-a', '--all', help='synchronize all wcs', action='store_true', default=False)
group.add_argument('--url', help='url of the w.c.s. instance', required=False, default=None)
args, rest = parser.parse_known_args()
feed = args.feed
@ -110,7 +110,7 @@ def main2():
urls = [url]
if config.has_section(args.url):
defaults = dict(config.items(args.url))
parser.add_argument("-h", "--help", action="help", help="show this help message and exit")
parser.add_argument('-h', '--help', action='help', help='show this help message and exit')
parser.add_argument('--orig', help='origin of the request for signatures')
parser.add_argument('--slug', action='append', default=[])
parser.add_argument('--key', help='HMAC key for signatures')

View File

@ -278,7 +278,7 @@ class WcsOlapFeeder:
'name': 'percent',
'label': 'pourcentage des demandes',
'type': 'percent',
"expression": 'case (select count({fact_table}.id) from {table_expression} '
'expression': 'case (select count({fact_table}.id) from {table_expression} '
'where {where_conditions}) when 0 then null else '
'count({fact_table}.id) * 100. / (select '
'count({fact_table}.id) from {table_expression} where '
@ -391,8 +391,8 @@ class WcsOlapFeeder:
"""
# drop foreign key constraints first
self.ex(
"SELECT table_name, constraint_name FROM "
"information_schema.key_column_usage "
'SELECT table_name, constraint_name FROM '
'information_schema.key_column_usage '
"WHERE table_schema = %s AND constraint_name LIKE '%%_fkey'",
vars=[schema],
)
@ -405,9 +405,9 @@ class WcsOlapFeeder:
)
# remove others
self.ex(
"SELECT table_name, constraint_name FROM "
"information_schema.key_column_usage "
"WHERE table_schema = %s",
'SELECT table_name, constraint_name FROM '
'information_schema.key_column_usage '
'WHERE table_schema = %s',
vars=[schema],
)
for table_name, constraint_name in self.cur.fetchall():
@ -418,14 +418,14 @@ class WcsOlapFeeder:
% (quote(schema), quote(table_name), quote(constraint_name))
)
# then drop indexes
self.ex("SELECT tablename, indexname FROM pg_indexes WHERE schemaname = %s", vars=[schema])
self.ex('SELECT tablename, indexname FROM pg_indexes WHERE schemaname = %s', vars=[schema])
for table_name, index_name in self.cur.fetchall():
with ignore_undefined_object_or_table():
self.ex('DROP INDEX %s.%s CASCADE' % (quote(schema), quote(index_name)))
# finally drop tables, cascade will have no effect
self.ex(
"SELECT tablename FROM pg_tables WHERE schemaname = %s ORDER BY tablename DESC", vars=[schema]
'SELECT tablename FROM pg_tables WHERE schemaname = %s ORDER BY tablename DESC', vars=[schema]
)
for table in self.cur.fetchall():
tablename = '%s.%s' % (quote(schema), quote(table[0]))