More unicode changes. Adding print_function to all files. Updating various reads & writes to files.

This commit is contained in:
Gareth J. Greenaway 2018-01-12 16:33:56 -08:00
parent 553669f94f
commit a773ff90e5
No known key found for this signature in database
GPG Key ID: 10B62F8A7CAD7A41
13 changed files with 16 additions and 14 deletions

View File

@ -17,7 +17,7 @@
'''
# Import Python libs
from __future__ import absolute_import, unicode_literals
from __future__ import absolute_import, unicode_literals, print_function
import logging
import xml.dom.minidom

View File

@ -16,7 +16,7 @@ Utils for the NAPALM modules and proxy.
'''
# Import Python libs
from __future__ import absolute_import, unicode_literals
from __future__ import absolute_import, unicode_literals, print_function
import traceback
import logging
import importlib

View File

@ -13,7 +13,7 @@
http://code.activestate.com/recipes/440554/
'''
from __future__ import absolute_import, unicode_literals
from __future__ import absolute_import, unicode_literals, print_function
# Import python libs
import os

View File

@ -4,7 +4,7 @@ Define some generic socket functions for network modules
'''
# Import python libs
from __future__ import absolute_import, unicode_literals
from __future__ import absolute_import, unicode_literals, print_function
import itertools
import os
import re
@ -1271,6 +1271,7 @@ def active_tcp():
if os.path.isfile(statf):
with salt.utils.files.fopen(statf, 'rb') as fp_:
for line in fp_:
line = salt.utils.stringutils.to_unicode(line)
if line.strip().startswith('sl'):
continue
ret.update(_parse_tcp_line(line))
@ -1306,6 +1307,7 @@ def _remotes_on(port, which_end):
proc_available = True
with salt.utils.files.fopen(statf, 'r') as fp_:
for line in fp_:
line = salt.utils.stringutils.to_unicode(line)
if line.strip().startswith('sl'):
continue
iret = _parse_tcp_line(line)

View File

@ -21,7 +21,7 @@
'''
# Import python libs
from __future__ import absolute_import, unicode_literals
from __future__ import absolute_import, unicode_literals, print_function
from collections import Callable
# Import 3rd-party libs

View File

@ -5,7 +5,7 @@ Neutron class
# Import python libs
from __future__ import absolute_import, with_statement, unicode_literals
from __future__ import absolute_import, with_statement, unicode_literals, print_function
import logging
# Import third party libs

View File

@ -4,7 +4,7 @@ Nova class
'''
# Import Python libs
from __future__ import absolute_import, with_statement, unicode_literals
from __future__ import absolute_import, with_statement, unicode_literals, print_function
import inspect
import logging
import time
@ -775,7 +775,7 @@ class SaltNova(object):
nt_ks = self.compute_conn
if pubfile:
with salt.utils.files.fopen(pubfile, 'r') as fp_:
pubkey = fp_.read()
pubkey = salt.utils.stringutils.to_unicode(fp_.read())
if not pubkey:
return False
nt_ks.keypairs.create(name, public_key=pubkey)

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# Import Python libs
from __future__ import absolute_import, unicode_literals
from __future__ import absolute_import, unicode_literals, print_function
# pylint: disable=import-error
try:

View File

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from __future__ import absolute_import, unicode_literals, print_function
try:
import pyrax

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from __future__ import absolute_import, unicode_literals, print_function
# Import Python libs
import logging

View File

@ -4,7 +4,7 @@ Swift utility class
===================
Author: Anthony Stanton <anthony.stanton@gmail.com>
'''
from __future__ import absolute_import, unicode_literals
from __future__ import absolute_import, unicode_literals, print_function
# Import python libs
import logging

View File

@ -21,7 +21,7 @@ Rob Speer's changes are as follows:
- added a __getstate__ and __setstate__ so it can be pickled
- added __getitem__
'''
from __future__ import absolute_import, unicode_literals
from __future__ import absolute_import, unicode_literals, print_function
import collections
SLICE_ALL = slice(None)

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Import Python libs
from __future__ import absolute_import, unicode_literals
from __future__ import absolute_import, unicode_literals, print_function
import logging
import socket