# HG changeset patch # User cropgeeks # Date 1488461137 18000 # Node ID 4a0f069c98e098d6cbb33226561583bec2a156ed # Parent c8c40cbe2945c341ecffec5c9065d63ec2d21015 Uploaded diff -r c8c40cbe2945 -r 4a0f069c98e0 flapjack.py --- a/flapjack.py Thu Mar 02 08:16:25 2017 -0500 +++ b/flapjack.py Thu Mar 02 08:25:37 2017 -0500 @@ -5,27 +5,25 @@ class FlapjackFormat(Binary): file_ext = "flapjack" - def sniff(self, filename): +# def sniff(self, filename): # The first 16 bytes of any SQLite3 database file is 'SQLite format 3\0', and the file is binary. For details # about the format, see http://www.sqlite.org/fileformat.html - try: - header = open(filename, 'rb').read(16) - if header == b'SQLite format 3\0': - fj_table_names = ["objects", "project"] - conn = sqlite.connect(filename) - c = conn.cursor() - tables_query = "SELECT name FROM sqlite_master WHERE type='table' ORDER BY name" - result = c.execute(tables_query).fetchall() - result = [_[0] for _ in result] - for table_name in fj_table_names: - if table_name not in result: - return False - return True - return False - except: - return False - -Binary.register_sniffable_binary_format( "flapjack", "flapjack", FlapjackFormat) +# try: +# header = open(filename, 'rb').read(16) +# if header == b'SQLite format 3\0': +# fj_table_names = ["objects", "project"] +# conn = sqlite.connect(filename) +# c = conn.cursor() +# tables_query = "SELECT name FROM sqlite_master WHERE type='table' ORDER BY name" +# result = c.execute(tables_query).fetchall() +# result = [_[0] for _ in result] +# for table_name in fj_table_names: +# if table_name not in result: +# return False +# return True +# return False +# except: +# return False class FlapjackMapFormat(Tabular): file_ext = "fjmap"