本文整理汇总了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)
开发者ID:luminosa42,项目名称:astr596,代码行数:31,代码来源:selectsn.py
示例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)
开发者ID:j50888,项目名称:tensorpack,代码行数:28,代码来源:serialize.py
示例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
开发者ID:gemelkelabs,项目名称:timing_system_software,代码行数:30,代码来源:experiment_synchronization.py
示例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
开发者ID:balajisriram,项目名称:psychopy,代码行数:30,代码来源:net.py
示例5: setUp
开发者ID:lebedov,项目名称:msgpack-numpy,代码行数:2,代码来源:tests.py
注:本文中的msgpack_numpy.patch函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论