py3k - more elegant s2b implementation
This commit is contained in:
@@ -10,15 +10,9 @@ from eventlet import debug, hubs
|
|||||||
# convenience for importers
|
# convenience for importers
|
||||||
main = unittest.main
|
main = unittest.main
|
||||||
|
|
||||||
|
def s2b(s):
|
||||||
if sys.version_info[0]<3:
|
"""portable way to convert string to bytes. In 3.x socket.send and recv require bytes"""
|
||||||
def s2b(string):
|
return s.encode()
|
||||||
return string
|
|
||||||
else:
|
|
||||||
def s2b(string):
|
|
||||||
return bytes(string, 'latin1')
|
|
||||||
|
|
||||||
s2b.__doc__ = """string to bytes. On 2.x no-op on 3.x encodes string in latin1"""
|
|
||||||
|
|
||||||
def skipped(func):
|
def skipped(func):
|
||||||
""" Decorator that marks a function as skipped. Uses nose's SkipTest exception
|
""" Decorator that marks a function as skipped. Uses nose's SkipTest exception
|
||||||
|
Reference in New Issue
Block a user