#!/usr/bin/python3
"""
Runs logging and visualiserRegistry for available visualisers.
"""
import address_visualisation as AV
from address_visualisation.visualisers import ProfaneStreetsVisualiser, BiggestTownsVisualiser, ExtremeStreetNamesVisualiser, LongestStreetsVisualiser, SquareCountVisualiser, TownWithMostStreetsVisualiser
import logging

logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.DEBUG)

DEFAULT_VISUALISERS = [
	(ProfaneStreetsVisualiser, 'profane_streets'),
	(BiggestTownsVisualiser, 'biggest_towns'),
	(ExtremeStreetNamesVisualiser, 'extreme_street_names'),
	(LongestStreetsVisualiser, 'longest_streets'),
	(SquareCountVisualiser, 'square_count'),
	(TownWithMostStreetsVisualiser, 'town_with_most_streets')
]

visualisers = DEFAULT_VISUALISERS

visreg = AV.VisualiserRegistry('resources/db.xml')
visreg.register_visualiser_set(visualisers)
visreg.run_visualisers('resources/visualisations')

@@ -337,16 +337,27 @@
  logging
+%0Aimport sys
 %0A%0Aloggin
@@ -754,16 +754,476 @@
 ts')%0A%5D%0A%0A
+visualisers = %5B%5D%0Aif len(sys.argv) %3E 1:%0A%09for a in sys.argv%5B1:%5D:%0A%09%09s = a.split('=', 1)%0A%09%09if len(s) != 2:%0A%09%09%09raise Exception('Argument has to be in the form XxxVisualiser=output_name.')%0A%09%09v = globals()%5Bs%5B0%5D%5D%0A%09%09if not issubclass(v, AV.Visualiser):%0A%09%09%09raise Exception('The class name has to be an instance of visualiser.')%0A%09%09if s%5B1%5D.find('/') != -1:%0A%09%09%09raise Exception('The output file name cannot contain a forward slash.')%0A%0A%09%09visualisers.append((v, s%5B1%5D))%0Aelse:%0A%09
 visualis

allow to specify which visualisers are to be run