Skip to content

Commit e439193

Browse files
committed
switched back from "Enum" to simple variables
1 parent a2360fa commit e439193

File tree

2 files changed

+9
-18
lines changed

2 files changed

+9
-18
lines changed

setup.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
from setuptools import setup
2-
import sys
32

43

54
setup(
65
name="sqlitefts",
7-
version="0.1",
6+
version="0.2",
87
packages=["sqlitefts"],
98
description='A Python binding of SQLite Full Text Search Tokenizer',
109
url='https://github.com/hideaki-t/igo-python/',
@@ -24,5 +23,4 @@
2423
author_email='[email protected]',
2524
license='MIT',
2625
keywords=['SQLite', 'Full-text search', 'FTS'],
27-
install_requires=['enum34'] if sys.version_info < (3, 4) else []
2826
)

sqlitefts/sqlite_tokenizer.py

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,8 @@
99
from ctypes import POINTER, CFUNCTYPE
1010
import struct
1111

12-
try:
13-
from enum import Enum
14-
except:
15-
pass
16-
17-
18-
class SQLiteResultCodes(Enum):
19-
SQLITE_OK = 0
20-
SQLITE_DONE = 101
12+
SQLITE_OK = 0
13+
SQLITE_DONE = 101
2114

2215

2316
class sqlite3_tokenizer_module(ctypes.Structure):
@@ -74,11 +67,11 @@ def xcreate(argc, argv, ppTokenizer):
7467
tkn.t = tokenizer
7568
tokenizers[ctypes.addressof(tkn)] = tkn
7669
ppTokenizer[0] = ctypes.pointer(tkn)
77-
return SQLiteResultCodes.SQLITE_OK.value
70+
return SQLITE_OK
7871

7972
def xdestroy(pTokenizer):
8073
del(tokenizers[ctypes.addressof(pTokenizer[0])])
81-
return SQLiteResultCodes.SQLITE_OK.value
74+
return SQLITE_OK
8275

8376
def xopen(pTokenizer, pInput, nInput, ppCursor):
8477
cur = sqlite3_tokenizer_cursor()
@@ -88,7 +81,7 @@ def xopen(pTokenizer, pInput, nInput, ppCursor):
8881
cur.offset = 0
8982
cursors[ctypes.addressof(cur)] = cur
9083
ppCursor[0] = ctypes.pointer(cur)
91-
return SQLiteResultCodes.SQLITE_OK.value
84+
return SQLITE_OK
9285

9386
def xnext(pCursor, ppToken, pnBytes,
9487
piStartOffset, piEndOffset, piPosition):
@@ -109,12 +102,12 @@ def xnext(pCursor, ppToken, pnBytes,
109102
piPosition[0] = cur.pos
110103
cur.pos += 1
111104
except StopIteration:
112-
return SQLiteResultCodes.SQLITE_DONE.value
113-
return SQLiteResultCodes.SQLITE_OK.value
105+
return SQLITE_DONE
106+
return SQLITE_OK
114107

115108
def xclose(pCursor):
116109
del(cursors[ctypes.addressof(pCursor[0])])
117-
return SQLiteResultCodes.SQLITE_OK.value
110+
return SQLITE_OK
118111

119112
tokenizer_module = sqlite3_tokenizer_module(
120113
0,

0 commit comments

Comments
 (0)