black formatting

This commit is contained in:
2018-07-21 15:41:48 +02:00
parent 5f9ea6f0b7
commit b18c4dcd18
8 changed files with 475 additions and 266 deletions

View File

@@ -3,6 +3,7 @@ import sys
import sqlite3
import logging
def get_file_path(file_name):
return os.path.join(os.path.dirname(os.path.realpath(__file__)), file_name)
@@ -29,11 +30,12 @@ def strstr(haystack, needle):
print(domain) // Display : @example.com
"""
pos = haystack.find(needle)
if pos < 0: # not found
if pos < 0: # not found
return None
return haystack[pos:]
def create_connection(db_filename):
db_path = get_file_path(db_filename)
logging.debug("Try to connect to {}".format(db_path))
@@ -45,8 +47,9 @@ def create_connection(db_filename):
return None
def count_object(conn, table_name):
query = "SELECT count(*) FROM " + table_name
cursor = conn.cursor()
cursor.execute(query)
return cursor.fetchone()[0]
return cursor.fetchone()[0]