Skip to content
This repository was archived by the owner on Nov 21, 2019. It is now read-only.
This repository is currently being migrated. It's locked while the migration is in progress.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions BUILD/build_api_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# ex: set tabstop=4
# Please do not change the two lines above. See PEP 8, PEP 263.
'''generates all of the examples from the test/ddt JSON files'''
from __future__ import print_function
from builtins import object
__author__ = 'Jim Olsen ([email protected])'
__version__ = '2.1.4'

Expand Down Expand Up @@ -43,7 +45,7 @@
handler = pytan.handler.Handler(**api_info)
platform_version = handler.get_server_version()
is6_5 = handler.session.platform_is_6_5()
print "Platform Version: {}".format(platform_version)
print("Platform Version: {}".format(platform_version))

BASIC_PY_CODE = script_definitions.BASIC_PY_CODE.format(**api_info)

Expand Down Expand Up @@ -91,7 +93,7 @@ def clean_up_output_dirs(self):

for i in output_dirs:
if os.path.isdir(i):
print "Deleting and re-making old output dir: {}".format(i)
print("Deleting and re-making old output dir: {}".format(i))
shutil.rmtree(i)
os.makedirs(i)

Expand Down Expand Up @@ -233,7 +235,7 @@ def write_py_file(self, name, out, desc):
filename = self.build_py_filename(name)
filepath = os.path.join(self.pytan_example_out_dir, filename)
buildsupport.write_file(filepath, out)
os.chmod(filepath, 0755)
os.chmod(filepath, 0o755)
self.py_examples.append({'filename': filename, 'desc': desc})

def write_soap_file(self, name, out):
Expand Down Expand Up @@ -289,7 +291,7 @@ def make_soap_example(self, name, desc, response_objects):
def build_args_str(self, args_name, args):
args_template = '{}["{}"] = {}'.format
args_str_list = [
args_template(args_name, k, pprint.pformat(v)) for k, v in args.iteritems()
args_template(args_name, k, pprint.pformat(v)) for k, v in args.items()
]
args_str = '\n'.join(args_str_list)
return args_str
Expand All @@ -309,10 +311,10 @@ def process_ddt(self, ddt_file):
ddt_tests = buildsupport.json_read(ddt)
self.ddt_examples = []

for name, info in sorted(ddt_tests.items(), key=lambda x: x[1]['priority']):
for name, info in sorted(list(ddt_tests.items()), key=lambda x: x[1]['priority']):
only_65 = info.get('6_5_only', False)
if only_65 and not is6_5:
print "Skipping {} - not valid for 6.2 platform".format(name)
print("Skipping {} - not valid for 6.2 platform".format(name))
continue

if 'invalid' in name and 'deploy' in name:
Expand Down Expand Up @@ -417,7 +419,7 @@ def main(self, skip_files=[], all_json_files=None, clean=True):

# all_json_files = all_json_files[0:1]
for x in all_json_files:
print "Now processing ddt file: {}".format(x)
print("Now processing ddt file: {}".format(x))
self.process_ddt(x)

self.make_pytan_api_index()
Expand Down
13 changes: 7 additions & 6 deletions BUILD/build_bin_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# ex: set tabstop=4
# Please do not change the two lines above. See PEP 8, PEP 263.
'''Build the markdown docs for the bin/ scripts'''
from __future__ import print_function
__author__ = 'Jim Olsen ([email protected])'
__version__ = '2.1.4'

Expand Down Expand Up @@ -37,7 +38,7 @@

main_output_dir = script_definitions.staticdoc_source
# main_output_dir = '/tmp'
print "Output dir is: {}".format(main_output_dir)
print("Output dir is: {}".format(main_output_dir))

only_run = []
skips = []
Expand All @@ -52,12 +53,12 @@

buildsupport.clean_up(ini_output_dir, '*')

print "Re-building INI Files"
print("Re-building INI Files")

section_template = string.Template(script_definitions.bin_doc_ini_section)
ini_template = string.Template(script_definitions.bin_doc_ini)

for script_name, script_def in script_definitions.scripts.iteritems():
for script_name, script_def in script_definitions.scripts.items():
if script_name in skips:
buildsupport.spew("Skipping examples for {script_name}".format(**script_def), verbose)
continue
Expand Down Expand Up @@ -120,7 +121,7 @@

for x in ini_files:
os.chdir(parent_dir)
print "Running MDTest against {}".format(x)
print("Running MDTest against {}".format(x))
mdtest_args = {}
mdtest_args['filehandle'] = open(x, 'r')
mdtest_args['outdir'] = md_output_dir
Expand All @@ -131,7 +132,7 @@
toctemplate = " * **[{script_name}]({script_name}.html)**: {docstring}".format
tocitems = [
toctemplate(**script_def)
for script_name, script_def in sorted(script_definitions.scripts.iteritems())
for script_name, script_def in sorted(script_definitions.scripts.items())
if script_def['script_name'] not in script_examples.example_skips
]

Expand All @@ -141,7 +142,7 @@
index_out = script_definitions.bin_doc_index.format(tocitems=tocitems)
buildsupport.write_file(index_file, index_out)

print "Running MDTest against {}".format(index_file)
print("Running MDTest against {}".format(index_file))
mdtest_args = {}
mdtest_args['filehandle'] = open(index_file, 'r')
mdtest_args['outdir'] = md_output_dir
Expand Down
2 changes: 1 addition & 1 deletion BUILD/build_bin_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
buildsupport.clean_up(output_bin, '*.py')
buildsupport.clean_up(output_winbin, '*.bat')

for script_name, script_def in script_definitions.scripts.iteritems():
for script_name, script_def in script_definitions.scripts.items():
script_def.update(script_definitions.general_subs)
script_def.update(script_definitions.script_templates)
buildsupport.create_script(
Expand Down
27 changes: 15 additions & 12 deletions BUILD/build_validation_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
# ex: set tabstop=4
# Please do not change the two lines above. See PEP 8, PEP 263.
'''generates all of the examples from the test/ddt JSON files'''
from __future__ import print_function
from future import standard_library
standard_library.install_aliases()
__author__ = 'Jim Olsen ([email protected])'
__version__ = '2.1.4'

import os
import sys
import StringIO
import io
import unittest
import tempfile
import platform
Expand Down Expand Up @@ -58,19 +61,19 @@

handler = pytan.Handler(**api_info)
platform_version = handler.get_server_version()
print "Determined platform version: {}".format(platform_version)
print "Determined OS version: {}".format(os_version)
print "Determined Python version: {}".format(python_version_full)
print("Determined platform version: {}".format(platform_version))
print("Determined OS version: {}".format(os_version))
print("Determined Python version: {}".format(python_version_full))

buildsupport.clean_up(TEST_OUT, '*')

loader = unittest.TestLoader()
suite = loader.loadTestsFromModule(test_pytan_valid_server_tests)

print "Capturing stderr and stdout and launching unittests for test_pytan_valid_server_tests"
print("Capturing stderr and stdout and launching unittests for test_pytan_valid_server_tests")

val_stdout = StringIO.StringIO()
val_stderr = StringIO.StringIO()
val_stdout = io.StringIO()
val_stderr = io.StringIO()

sys.stdout = val_stdout
sys.stderr = val_stderr
Expand All @@ -82,9 +85,9 @@
sys.stderr = sys.__stderr__
val_stdout_val = val_stdout.getvalue()
val_stderr_val = val_stderr.getvalue()
print "Exception occurred!!"
print "stdout:\n{}".format(val_stdout_val)
print "stderr:\n{}".format(val_stderr_val)
print("Exception occurred!!")
print("stdout:\n{}".format(val_stdout_val))
print("stderr:\n{}".format(val_stderr_val))
raise

sys.stdout = sys.__stdout__
Expand All @@ -96,8 +99,8 @@
# print "stderr:\n{}".format(val_stderr_val)

if val_stderr_val:
print val_stderr_val
print "STDERR output from test!"
print(val_stderr_val)
print("STDERR output from test!")

dir_base = 'valid_pytan_tests'
rst_dir = os.path.join(script_definitions.doc_source, dir_base)
Expand Down
Empty file added __init__py
Empty file.
1 change: 1 addition & 0 deletions bin/approve_saved_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import os
import sys
import re
sys.dont_write_bytecode = True

my_file = os.path.abspath(sys.argv[0])
Expand Down
1 change: 1 addition & 0 deletions bin/ask_manual.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import os
import sys
import re
sys.dont_write_bytecode = True

my_file = os.path.abspath(sys.argv[0])
Expand Down
1 change: 1 addition & 0 deletions bin/ask_parsed.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import os
import sys
import re
sys.dont_write_bytecode = True

my_file = os.path.abspath(sys.argv[0])
Expand Down
1 change: 1 addition & 0 deletions bin/ask_saved.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import os
import sys
import re
sys.dont_write_bytecode = True

my_file = os.path.abspath(sys.argv[0])
Expand Down
1 change: 1 addition & 0 deletions bin/close_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import os
import sys
import argparse
import re
sys.dont_write_bytecode = True

my_file = os.path.abspath(sys.argv[0])
Expand Down
1 change: 1 addition & 0 deletions bin/create_action_from_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import os
import sys
import re
sys.dont_write_bytecode = True

my_file = os.path.abspath(sys.argv[0])
Expand Down
1 change: 1 addition & 0 deletions bin/create_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import os
import sys
import re
sys.dont_write_bytecode = True

my_file = os.path.abspath(sys.argv[0])
Expand Down
1 change: 1 addition & 0 deletions bin/create_group_from_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import os
import sys
import re
sys.dont_write_bytecode = True

my_file = os.path.abspath(sys.argv[0])
Expand Down
1 change: 1 addition & 0 deletions bin/create_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import os
import sys
import re
sys.dont_write_bytecode = True

my_file = os.path.abspath(sys.argv[0])
Expand Down
1 change: 1 addition & 0 deletions bin/create_package_from_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import os
import sys
import re
sys.dont_write_bytecode = True

my_file = os.path.abspath(sys.argv[0])
Expand Down
1 change: 1 addition & 0 deletions bin/create_question_from_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import os
import sys
import re
sys.dont_write_bytecode = True

my_file = os.path.abspath(sys.argv[0])
Expand Down
1 change: 1 addition & 0 deletions bin/create_saved_question_from_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import os
import sys
import re
sys.dont_write_bytecode = True

my_file = os.path.abspath(sys.argv[0])
Expand Down
1 change: 1 addition & 0 deletions bin/create_sensor_from_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import os
import sys
import re
sys.dont_write_bytecode = True

my_file = os.path.abspath(sys.argv[0])
Expand Down
1 change: 1 addition & 0 deletions bin/create_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import os
import sys
import re
sys.dont_write_bytecode = True

my_file = os.path.abspath(sys.argv[0])
Expand Down
1 change: 1 addition & 0 deletions bin/create_user_from_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import os
import sys
import re
sys.dont_write_bytecode = True

my_file = os.path.abspath(sys.argv[0])
Expand Down
1 change: 1 addition & 0 deletions bin/create_whitelisted_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import os
import sys
import re
sys.dont_write_bytecode = True

my_file = os.path.abspath(sys.argv[0])
Expand Down
1 change: 1 addition & 0 deletions bin/create_whitelisted_url_from_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import os
import sys
import re
sys.dont_write_bytecode = True

my_file = os.path.abspath(sys.argv[0])
Expand Down
1 change: 1 addition & 0 deletions bin/delete_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import os
import sys
import re
sys.dont_write_bytecode = True

my_file = os.path.abspath(sys.argv[0])
Expand Down
1 change: 1 addition & 0 deletions bin/delete_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import os
import sys
import re
sys.dont_write_bytecode = True

my_file = os.path.abspath(sys.argv[0])
Expand Down
1 change: 1 addition & 0 deletions bin/delete_saved_question.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import os
import sys
import re
sys.dont_write_bytecode = True

my_file = os.path.abspath(sys.argv[0])
Expand Down
1 change: 1 addition & 0 deletions bin/delete_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import os
import sys
import re
sys.dont_write_bytecode = True

my_file = os.path.abspath(sys.argv[0])
Expand Down
1 change: 1 addition & 0 deletions bin/delete_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import os
import sys
import re
sys.dont_write_bytecode = True

my_file = os.path.abspath(sys.argv[0])
Expand Down
1 change: 1 addition & 0 deletions bin/delete_whitelisted_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import os
import sys
import re
sys.dont_write_bytecode = True

my_file = os.path.abspath(sys.argv[0])
Expand Down
1 change: 1 addition & 0 deletions bin/deploy_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import os
import sys
import re
sys.dont_write_bytecode = True

my_file = os.path.abspath(sys.argv[0])
Expand Down
Loading