GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — snowflake-connector-python/sfbinaryformat.py at master · byule/snowflake-connector-python Expand file tree/ Copy pathsfbinaryformat.pyMore file actions 44 lines (35 loc) · 1.13 KB / Copy pathsfbinaryformat.pyFile metadata and controls44 lines (35 loc) · 1.13 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 #!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (c) 2012-2019 Snowflake Computing Inc. All right reserved. # from base64 import (b16encode, standard_b64encode, b16decode) from .errors import InternalError # Converts a Snowflake binary value into a "bytes" object. binary_to_python = b16decode def binary_to_snowflake(binary_value): """ Encodes a "bytes" object for passing to Snowflake. """ result = b16encode(binary_value) if isinstance(binary_value, bytearray): return bytearray(result) return result class SnowflakeBinaryFormat(object): """ Formats binary values ("bytes" objects) in hex or base64. """ def __init__(self, name): name = name.upper() if name == u'HEX': self._encode = b16encode elif name == u'BASE64': self._encode = standard_b64encode else: raise InternalError( u'Unrecognized binary format {}'.format(name)) def format(self, binary_value): """ Formats a "bytes" object, returning a string. """ return self._encode(binary_value).decode('ascii') |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |