yunhuni.cti.busnetcli.utils module¶
Some helper functions
-
yunhuni.cti.busnetcli.utils.b2s_recode(bs, source_encoding=None, target_encoding=None)¶ -
参数: 返回: 转换结果字符串
返回类型:
-
yunhuni.cti.busnetcli.utils.s2b_recode(s, source_encoding=None, target_encoding=None)¶ -
参数: 返回: 转换结果字符串
返回类型:
-
yunhuni.cti.busnetcli.utils.to_bytes(s, encoding='utf-8')¶ Convert to bytes string.
参数: - s – String to convert.
- encoding (str) – Encoding codec.
返回: bytes string, it’s bytes or str in Python 2.x, bytes in Python 3.x.
返回类型: - In Python 2, convert s to bytes if it’s unicode.
- In Python 2, return original s if it’s not unicode.
- In Python 2, it equals to
to_str(). - In Python 3, convert s to bytes if it’s unicode or str.
- In Python 3, return original s if it’s neither unicode nor str.
-
yunhuni.cti.busnetcli.utils.to_str(s, encoding='utf-8')¶ Convert to str string.
参数: - s – String to convert.
- encoding (str) – Decoding codec.
返回: str string, it’s bytes in Python 2.x, unicode or str in Python 3.x.
返回类型: - In Python 2, convert s to str if it’s unicode.
- In Python 2, return original s if it’s not unicode.
- In Python 2, it equals to
to_bytes(). - In Python 3, convert s to str if it’s bytes.
- In Python 3, return original s if it’s not bytes.
- In Python 3, it equals to
to_unicode().
-
yunhuni.cti.busnetcli.utils.to_unicode(s, encoding='utf-8')¶ Convert to unicode string.
参数: - s – String to convert.
- encoding (str) – Encoding codec.
返回: unicode string, it’s unicode in Python 2.x, str or unicode in Python 3.x.
返回类型: unicode
- In Python 2, convert s to unicode if it’s str or bytes.
- In Python 2, return original s if it’s neither str or bytes.
- In Python 3, convert s to str or unicode if it’s bytes.
- In Python 3, return original s if it’s not bytes.
- In Python 3, it equals to
to_str().
-
class
yunhuni.cti.busnetcli.utils.LoggerMixin¶ 基类:
objectMixin Class provide a
loggerproperty-
classmethod
get_logger()¶ logger instance.
返回类型: logging.Logger logger name format is ModuleName.ClassName
-
logger¶ logger instance.
返回类型: logging.Logger logger name format is ModuleName.ClassName
-
classmethod