Misc script fixes
This commit is contained in:
parent
3ba3c3a80e
commit
8557d923a0
1 changed files with 8 additions and 8 deletions
|
@ -1,6 +1,7 @@
|
||||||
#!/usr/bin/env nix-shell
|
#!/usr/bin/env nix-shell
|
||||||
#! nix-shell -i python3 --pure
|
#! nix-shell -i python3 --pure
|
||||||
#! nix-shell -p python3 python3Packages.coloredlogs python3Packages.progressbar2
|
#! nix-shell -p python3 python3Packages.coloredlogs python3Packages.progressbar2
|
||||||
|
# vim: filetype=python
|
||||||
|
|
||||||
# Handles sync-conflict files
|
# Handles sync-conflict files
|
||||||
|
|
||||||
|
@ -9,7 +10,6 @@ import logging
|
||||||
import os
|
import os
|
||||||
import pickle
|
import pickle
|
||||||
import re
|
import re
|
||||||
import sys
|
|
||||||
import zlib
|
import zlib
|
||||||
|
|
||||||
import coloredlogs
|
import coloredlogs
|
||||||
|
@ -58,7 +58,7 @@ class Table:
|
||||||
|
|
||||||
class Database:
|
class Database:
|
||||||
VERSION = 1
|
VERSION = 1
|
||||||
CONFLICT_PATTERN = re.compile("\.sync-conflict-\d{8}-\d{6}-\w{7}")
|
CONFLICT_PATTERN = re.compile(r"\.sync-conflict-\d{8}-\d{6}-\w{7}")
|
||||||
|
|
||||||
def __init__(self, directory):
|
def __init__(self, directory):
|
||||||
self.version = Database.VERSION
|
self.version = Database.VERSION
|
||||||
|
@ -470,12 +470,12 @@ if __name__ == "__main__":
|
||||||
assert isinstance(database, Database)
|
assert isinstance(database, Database)
|
||||||
except BaseException as e:
|
except BaseException as e:
|
||||||
raise ValueError("Not a database file")
|
raise ValueError("Not a database file")
|
||||||
assert (
|
assert database.version <= Database.VERSION, (
|
||||||
database.version <= Database.VERSION
|
"Version of the loaded database is too recent"
|
||||||
), "Version of the loaded database is too recent"
|
)
|
||||||
assert (
|
assert database.directory == args.directory, (
|
||||||
database.directory == args.directory
|
"Directory of the loaded database doesn't match"
|
||||||
), "Directory of the loaded database doesn't match"
|
)
|
||||||
|
|
||||||
if database is None:
|
if database is None:
|
||||||
database = Database(args.directory)
|
database = Database(args.directory)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue