Transform print statement to print function

Partial implement: blueprint py33-support

Change-Id: Ieed61447746bc5f598dcdfa89362aaa93f7c0dec
This commit is contained in:
Kui Shi
2013-10-20 16:11:17 +08:00
parent d07ec04e19
commit 6ae8c07d5c

View File

@@ -12,6 +12,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from __future__ import print_function
import json
import os
@@ -72,9 +73,9 @@ def print_list(objs, fields, field_labels=None, formatters={}, sortby=None):
row.append(data)
pt.add_row(row)
if sortby is None:
print pt.get_string()
print(pt.get_string())
else:
print pt.get_string(sortby=field_labels[sortby])
print(pt.get_string(sortby=field_labels[sortby]))
def print_dict(d, formatters={}):
@@ -87,7 +88,7 @@ def print_dict(d, formatters={}):
pt.add_row([field, formatters[field](d[field])])
else:
pt.add_row([field, d[field]])
print pt.get_string(sortby='Property')
print(pt.get_string(sortby='Property'))
def find_resource(manager, name_or_id):
@@ -141,7 +142,7 @@ def import_versioned_module(version, submodule=None):
def exit(msg=''):
if msg:
print >> sys.stderr, msg
print(msg, file=sys.stderr)
sys.exit(1)