mirror of
https://github.com/romanz/amodem.git
synced 2026-03-25 11:51:02 +08:00
util: move ASSUAN serialization to break circular import
This commit is contained in:
@@ -229,3 +229,11 @@ def which(cmd):
|
||||
raise OSError('Cannot find {!r} in $PATH'.format(cmd))
|
||||
log.debug('which %r => %r', cmd, full_path)
|
||||
return full_path
|
||||
|
||||
|
||||
def assuan_serialize(data):
|
||||
"""Serialize data according to ASSUAN protocol (for GPG daemon communication)."""
|
||||
for c in [b'%', b'\n', b'\r']:
|
||||
escaped = '%{:02X}'.format(ord(c)).encode('ascii')
|
||||
data = data.replace(c, escaped)
|
||||
return data
|
||||
|
||||
Reference in New Issue
Block a user