File: _util.py

package info (click to toggle)
python-redis 6.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 9,432 kB
  • sloc: python: 60,318; sh: 179; makefile: 128
file content (7 lines) | stat: -rw-r--r-- 219 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
def to_string(s, encoding: str = "utf-8"):
    if isinstance(s, str):
        return s
    elif isinstance(s, bytes):
        return s.decode(encoding, "ignore")
    else:
        return s  # Not a string we care about