cleanup code
This commit is contained in:
parent
0d04f61e1f
commit
e4b229886e
667
zk/base.py
667
zk/base.py
File diff suppressed because it is too large
Load Diff
@ -3,6 +3,10 @@ class ZKError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class ZKErrorConnection(ZKError):
|
||||
pass
|
||||
|
||||
|
||||
class ZKErrorResponse(ZKError):
|
||||
pass
|
||||
|
||||
|
@ -1,7 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from struct import pack #, unpack
|
||||
import codecs
|
||||
|
||||
|
||||
class Finger(object):
|
||||
|
||||
def __init__(self, uid, fid, valid, template):
|
||||
self.size = len(template) # template only
|
||||
self.uid = int(uid)
|
||||
@ -16,6 +19,7 @@ class Finger(object):
|
||||
|
||||
def repack_only(self): #only template
|
||||
return pack("H%is" % (self.size), self.size, self.template)
|
||||
|
||||
@staticmethod
|
||||
def json_unpack(json):
|
||||
return Finger(
|
||||
@ -24,6 +28,7 @@ class Finger(object):
|
||||
valid=json['valid'],
|
||||
template=codecs.decode(json['template'],'hex')
|
||||
)
|
||||
|
||||
def json_pack(self): #packs for json
|
||||
return {
|
||||
"size": self.size,
|
||||
@ -44,3 +49,4 @@ class Finger(object):
|
||||
|
||||
def dump(self):
|
||||
return "<Finger> [uid:{:>3}, fid:{}, size:{:>4} v:{} t:{}]".format(self.uid, self.fid, self.size, self.valid, codecs.encode(self.template, 'hex'))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user