Skip to content

Instantly share code, notes, and snippets.

@dplepage
Last active August 29, 2015 14:04
Show Gist options
  • Save dplepage/64346ac0a338e9c914a9 to your computer and use it in GitHub Desktop.
Save dplepage/64346ac0a338e9c914a9 to your computer and use it in GitHub Desktop.
byte_aware_dfy = GraphDispatcher([dictify])
byte_aware_udfy = GraphDispatcher([undictify])
@byte_aware_dfy.when(Bytes)
def df_bytes(dispgraph, value, **kwargs):
return value.decode('utf-8')
@byte_aware_udfy.when(Bytes)
def udf_bytes(dispgraph, value, **kwargs):
return value.encode('utf-8')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment