black formatting
This commit is contained in:
7
utils.py
7
utils.py
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user