File: utils2.py

package info (click to toggle)
python-pyepics 3.4.1%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,080 kB
  • sloc: python: 11,184; makefile: 106; javascript: 104; sh: 1
file content (28 lines) | stat: -rw-r--r-- 533 bytes parent folder | download
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
#!/usr/bin/env python
"""
String Utils for Python 2
"""
import sys
if sys.version_info[0] != 2:
    raise ImportError(" Python version 2 required")

NULLCHAR_2 = '\x00'
NULLCHAR =  '\x00'
STR2BYTES =  str
BYTES2STR = str

def strjoin(sep, seq):
    "join string sequence with a separator"
    return sep.join(seq)

def is_string(s):
    return isinstance(s, basestring)

is_string_or_bytes = is_string

ascii_string = str
# def ascii_string(s):
#     if isinstance(s, unicode):
#         return str(s)
#     else:
#         return s