~ubuntu-branches/ubuntu/wily/pyzmq/wily

« back to all changes in this revision

Viewing changes to zmq/utils/strtypes.py

  • Committer: Package Import Robot
  • Author(s): Julian Taylor
  • Date: 2013-02-24 19:23:15 UTC
  • mfrom: (1.2.1) (9 sid)
  • mto: This revision was merged to the branch mainline in revision 10.
  • Revision ID: package-import@ubuntu.com-20130224192315-qhmwp3m3ymk8r60d
Tags: 2.2.0.1-1
* New upstream release
* relicense debian packaging to LGPL-3
* update watch file to use github directly
  thanks to Bart Martens for the file
* add autopkgtests
* drop obsolete DM-Upload-Allowed
* bump standard to 3.9.4, no changes required

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
* MinRK
6
6
"""
7
7
 
8
 
#
9
 
#    Copyright (c) 2010 Min Ragan-Kelley, Brian Granger
10
 
#
11
 
#    This file is part of pyzmq.
12
 
#
13
 
#    pyzmq is free software; you can redistribute it and/or modify it under
14
 
#    the terms of the Lesser GNU General Public License as published by
15
 
#    the Free Software Foundation; either version 3 of the License, or
16
 
#    (at your option) any later version.
17
 
#
18
 
#    pyzmq is distributed in the hope that it will be useful,
19
 
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
 
#    Lesser GNU General Public License for more details.
22
 
#
23
 
#    You should have received a copy of the Lesser GNU General Public License
24
 
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
25
 
#
 
8
#-----------------------------------------------------------------------------
 
9
#  Copyright (c) 2010-2012 Brian Granger, Min Ragan-Kelley
 
10
#
 
11
#  This file is part of pyzmq
 
12
#
 
13
#  Distributed under the terms of the New BSD License.  The full license is in
 
14
#  the file COPYING.BSD, distributed as part of this software.
 
15
#-----------------------------------------------------------------------------
26
16
 
27
17
import sys
28
18
 
31
21
    bytes = bytes
32
22
    unicode = str
33
23
    basestring = (bytes, unicode)
34
 
    asbytes = lambda s: s.encode('utf8')
 
24
    asbytes = lambda s: s if isinstance(s, bytes) else unicode(s).encode('utf8')
 
25
 
35
26
elif major == 2:
36
27
    unicode = unicode
37
28
    bytes = str
38
29
    basestring = basestring
39
30
    asbytes = str
40
31
 
41
 
__all__ = ['asbytes', 'bytes', 'unicode', 'basestring']
 
32
# give short 'b' alias for asbytes, so that we can use fake b('stuff')
 
33
# to simulate b'stuff'
 
34
b = asbytes
 
35
 
 
36
__all__ = ['asbytes', 'bytes', 'unicode', 'basestring', 'b']