def __init__(self): """ constructor creates an ArgumentParser object to implement main interface puts resulting args in self.args also creates an empty instance of ShipDict for merging incoming data """ parser = ArgumentParser() parser.add_argument("-v", "--verbose", dest='verbose', default=False, action='store_true', help="Verbose mode") parser.add_argument("-s", "--ship", dest='ship_name', default=None, action='store', help="Restrict to ships by that name") parser.add_argument("-z", "--gzip", dest='gzip', default=False, action='store_true', help="Store kml output in gzip (KMZ) format") parser.add_argument("json_filenames", nargs='*') self.args = parser.parse_args() # the windows command line is a little lazy with filename expansion json_filenames = [] for json_filename in self.args.json_filenames: if '*' not in json_filename: json_filenames.append(json_filename) else: json_filenames.extend(glob.glob(json_filename)) self.args.json_filenames = json_filenames self.ship_dict = ShipDict() self.gpx = GPX() self.gpxx_color = [ "Black", "DarkRed", "DarkGreen", "DarkYellow", "DarkBlue", "DarkMagenta", "DarkCyan", "LightGray", "DarkGray", "Red", "Green", "Yellow", "Blue", "Magenta", "Cyan", "White" ]
def __init__(self): """ constructor creates an ArgumentParser object to implement main interface puts resulting args in self.args also creates an empty instance of ShipDict for merging incoming data """ parser = ArgumentParser() parser.add_argument("-v", "--verbose", dest='verbose', default=False, action='store_true', help="Verbose mode") parser.add_argument("-s", "--ship", dest='ship_name', default=None, action='store', help="Restrict to ships by that name") parser.add_argument("-z", "--gzip", dest='gzip', default=False, action='store_true', help="Store kml output in gzip (KMZ) format") parser.add_argument("json_filenames", nargs='*') self.args = parser.parse_args() # the windows command line is a little lazy with filename expansion json_filenames = [] for json_filename in self.args.json_filenames: if '*' not in json_filename: json_filenames.append(json_filename) else: json_filenames.extend(glob.glob(json_filename)) self.args.json_filenames = json_filenames self.ship_dict = ShipDict() # file manager if self.args.gzip: self.fm = file_manager.GzipFileManager() else: self.fm = file_manager.TextFileManager()