本文整理汇总了Python中msgpack_numpy.patch函数的典型用法代码示例。如果您正苦于以下问题:Python patch函数的具体用法?Python patch怎么用?Python patch使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了patch函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: supernova
#!/usr/bin/env python -i
# Provide a function to return the SNs index for a SQL query.
#
import numpy as np
import sqlite3 as sq3
import msgpack as msg
import msgpack_numpy as mn
mn.patch()
class supernova(object):
"""Attributes can be added"""
def selectsn(sndb,sqlstr):
con = sq3.connect(sndb)
cur = con.cursor()
cur.execute(sqlstr)
SN_Array = []
names = []
for row in cur:
SN = supernova()
SN.filename = row[0]
SN.name = row[1]
SN.redshift = row[2]
SN.minwave = row[3]
# spectra = msg.unpackb(row[5])
# SN.spectrum = spectra
SN_Array.append(SN)
示例2: dumps
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: serialize.py
# Author: Yuxin Wu <[email protected]>
import msgpack
import msgpack_numpy
msgpack_numpy.patch()
__all__ = ['loads', 'dumps']
def dumps(obj):
"""
Serialize an object.
Returns:
str
"""
return msgpack.dumps(obj, use_bin_type=True)
def loads(buf):
"""
Args:
buf (str): serialized object.
"""
return msgpack.loads(buf)
示例3:
import sys
from datetime import datetime
from datetime import date
import pdb
import colorama
colorama.init(strip=False)
import msgpack
import msgpack_numpy
import simplejson
import XTSMobjectify
import DataBomb
import InfiniteFileStream
msgpack_numpy.patch()#This patch actually changes the behavior of "msgpack"
#specifically, it changes how, "encoding='utf-8'" functions when unpacking
import XTSM_Server_Objects
import file_locations
import numpy
from enthought.traits.api import HasTraits
from enthought.traits.api import Int as TraitedInt
from enthought.traits.api import Str as TraitedStr
import collections
DEBUG = True
NUM_RETAINED_XTSM=10
示例4: Copyright
Copyright (C) 2012-2013 iSolver Software Solutions
Distributed under the terms of the GNU General Public License (GPL version 3 or any later version).
.. moduleauthor:: Sol Simpson <[email protected]> + contributors, please see credits section of documentation.
.. fileauthor:: Sol Simpson <[email protected]>
"""
from __future__ import division
from builtins import range
from builtins import object
from psychopy.iohub import Computer
import msgpack
try:
import msgpack_numpy as m
m.patch()
except Exception:
pass
import struct
from weakref import proxy
from psychopy.iohub.util import NumPyRingBuffer as RingBuffer
from psychopy.iohub import print2err, printExceptionDetailsToStdErr
getTime=Computer.getTime
MAX_PACKET_SIZE=64*1024
from gevent import sleep, Greenlet
class SocketConnection(object):
def __init__(self,local_host=None,local_port=None,remote_host=None,remote_port=None,rcvBufferLength=1492, broadcast=False, blocking=0, timeout=0):
self._local_port= local_port