Skip to content

Instantly share code, notes, and snippets.

@kirankotari
Last active April 6, 2021 16:13
Show Gist options
  • Save kirankotari/6b1916ff49b43e4881f023294ab87787 to your computer and use it in GitHub Desktop.
Save kirankotari/6b1916ff49b43e4881f023294ab87787 to your computer and use it in GitHub Desktop.
NSO Pyang Python3 support changes
# If you want to use Python 3 alonge with old NSO version which contains pyang issue to support python3 here are few steps
# 1. we are convering the python syntax to support Python2 and Python3
# a. PEP 3113
# b. importing StringIO
# 2. we are not planning to correct any ned's, we request to collect latest neds to support python3
File: NSO-<version>/lib/pyang/pyang/plugins/html.py
# Existing:
from cStringIO import StringIO
# Updates:
if sys.version_info.major == 3:
from io import StringIO
else:
from cStringIO import StringIO
# Existing:
def wrap_link(ctx,(stmt, module),stmt_arg,link_name=None):
# Updates:
def wrap_link(ctx,stmt_module,stmt_arg,link_name=None):
stmt, module = stmt_module
File: NSO-<version>/lib/pyang/pyang/plugins/rest_doc.py
# Existing:
import StringIO
# Updates:
import io as StringIO
File: NSO-<version>/lib/pyang/pyang/plugins/tailf.py
# Existing:
def change_prefix(tokname, s)
# Updates:
def change_prefix(tokname_s)
tokname, s = tokname_s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment