Skip to content

Commit f2824a9

Browse files
committed
Parse sqlite bool
1 parent 545cfc5 commit f2824a9

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

pathtraits/access.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,11 @@ def get_dict(self, path):
3737
res = {}
3838
for cur_data in reversed(dirs_data):
3939
for k, v in cur_data.items():
40-
if v and k != "path":
41-
res[k] = v
40+
if not (v and k != "path"):
41+
continue
42+
if k.endswith("_BOOL"):
43+
v = v == 1
44+
res[k] = v
4245
return res
4346

4447

test/test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ def test_example(self):
2323
source = pathtraits.access.get_dict(db, "test/example/EU/de.txt")
2424
target = {
2525
"description_TEXT": "Germany data",
26-
"has_sidecar_meta_file_BOOL": 1,
27-
"is_example_BOOL": 1,
26+
"has_sidecar_meta_file_BOOL": True,
27+
"is_example_BOOL": True,
2828
"score_TEXT": "zero",
2929
"score_REAL": 3.5,
3030
}

0 commit comments

Comments
 (0)