option_parser.add_option( "-e", "--end", help="Generate turn definitions for interval ending at END seconds. " "Defaults to 3600.", default="3600") (options, args) = option_parser.parse_args() if options.connections_file is None: LOGGER.fatal("Missing CONNECTIONS_FILE.\n" + option_parser.format_help()) exit() if options.turn_definitions_file is None: LOGGER.fatal("Missing TURN_DEFINITIONS_FILE.\n" + option_parser.format_help()) exit() connections_file = open(options.connections_file, "r") turn_definitions_file = open(options.turn_definitions_file, "w") connections = connections.from_stream(connections_file) turn_definitions = turndefinitions.from_connections(connections) turn_definitions_xml = turndefinitions.to_xml(turn_definitions, options.begin, options.end) turn_definitions_file.write(turn_definitions_xml) connections_file.close() turn_definitions_file.close()
option_parser.add_option( "-t", "--turn-definitions-file", dest="turn_definitions_file", help="Write the resulting turn definitions to TURN_DEFINITIONS_FILE. " "Mandatory.", metavar="TURN_DEFINITIONS_FILE") (options, args) = option_parser.parse_args() if options.connections_file is None: LOGGER.fatal("Missing CONNECTIONS_FILE.\n" + option_parser.format_help()) exit() if options.turn_definitions_file is None: LOGGER.fatal("Missing TURN_DEFINITIONS_FILE.\n" + option_parser.format_help()) exit() connections_file = open(options.connections_file, "r") turn_definitions_file = open(options.turn_definitions_file, "w") connections = connections.from_stream(connections_file) turn_definitions = turndefinitions.from_connections(connections) turn_definitions_xml = turndefinitions.to_xml(turn_definitions) turn_definitions_file.write(turn_definitions_xml) connections_file.close() turn_definitions_file.close()
help="Read connections defined in CONNECTIONS_FILE. Mandatory.", metavar="CONNECTIONS_FILE") option_parser.add_option("-t", "--turn-definitions-file", dest="turn_definitions_file", help="Write the resulting turn definitions to TURN_DEFINITIONS_FILE. " "Mandatory.", metavar="TURN_DEFINITIONS_FILE") (options, args) = option_parser.parse_args() if options.connections_file is None: LOGGER.fatal("Missing CONNECTIONS_FILE.\n" + option_parser.format_help()) exit() if options.turn_definitions_file is None: LOGGER.fatal("Missing TURN_DEFINITIONS_FILE.\n" + option_parser.format_help()) exit() connections_file = open(options.connections_file, "r") turn_definitions_file = open(options.turn_definitions_file, "w") connections = connections.from_stream(connections_file) turn_definitions = turndefinitions.from_connections(connections) turn_definitions_xml = turndefinitions.to_xml(turn_definitions) turn_definitions_file.write(turn_definitions_xml) connections_file.close() turn_definitions_file.close()
default="0") option_parser.add_option("-e", "--end", help="Generate turn definitions for interval ending at END seconds. " "Defaults to 3600.", default="3600") (options, args) = option_parser.parse_args() if options.connections_file is None: LOGGER.fatal("Missing CONNECTIONS_FILE.\n" + option_parser.format_help()) exit() if options.turn_definitions_file is None: LOGGER.fatal("Missing TURN_DEFINITIONS_FILE.\n" + option_parser.format_help()) exit() connections_file = open(options.connections_file, "r") turn_definitions_file = open(options.turn_definitions_file, "w") connections = connections.from_stream(connections_file) turn_definitions = turndefinitions.from_connections(connections) turn_definitions_xml = turndefinitions.to_xml(turn_definitions, options.begin, options.end) turn_definitions_file.write(turn_definitions_xml) connections_file.close() turn_definitions_file.close()