You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
685 B
31 lines
685 B
#
|
|
# This file is part of pysmi software.
|
|
#
|
|
# Copyright (c) 2015-2019, Ilya Etingof <etingof@gmail.com>
|
|
# License: http://snmplabs.com/pysmi/license.html
|
|
#
|
|
import sys
|
|
|
|
if sys.version_info[0] > 2:
|
|
def encode(s):
|
|
if isinstance(s, str):
|
|
s = s.encode('utf-8', 'ignore')
|
|
return s
|
|
|
|
|
|
def decode(s):
|
|
if isinstance(s, bytes):
|
|
s = s.decode('utf-8', 'ignore')
|
|
return s
|
|
else:
|
|
def encode(s):
|
|
if isinstance(s, unicode):
|
|
s = s.encode('utf-8', 'ignore')
|
|
return s
|
|
|
|
|
|
def decode(s):
|
|
if isinstance(s, str):
|
|
s = s.decode('utf-8', 'ignore')
|
|
return s
|