def extract_year_and_platform(dirname): # Given directory path return the year and platform # if found and return as a tuple (year,platform) year = None platform = None # Split full path on OS separator dirs = os.path.abspath(dirname).split(os.sep) # Test for platform platform = dirs[-2] if platform not in platforms.list_platforms(): platform = None year = dirs[-2] else: year = dirs[-3] # Test for year if not year.isdigit or len(year) != 4: year = None return (year,platform)
p.add_option( "--years", action="store", dest="years", default=None, help="examine data for specific year(s); can be a single year, or multiple " "years expressed as either a range (e.g. '2011-2013') or a comma-separated " "list (e.g.'2010,2014'). Default is current year.", ) p.add_option( "--platforms", action="store", dest="platforms", default=None, help="examine data for specific platform(s); can be a single platform, or " "a comma-separated list. Default is all known platforms i.e. %s" % ", ".join(platforms.list_platforms()), ) p.add_option( "--include-subdirs", action="store_true", dest="include_subdirs", default=False, help="also collect and report disk usage information for first level of " "subdirectories in each data directory", ) p.add_option( "--plot", action="store", dest="plot_file", default=None, help="plot a stacked barchart of the usage and output as a PNG to PLOT_FILE",
action="store", dest='years', default=None, help= "examine data for specific year(s); can be a single year, or multiple " "years expressed as either a range (e.g. '2011-2013') or a comma-separated " "list (e.g.'2010,2014'). Default is current year.") p.add_option( "--platforms", action="store", dest='platforms', default=None, help= "examine data for specific platform(s); can be a single platform, or " "a comma-separated list. Default is all known platforms i.e. %s" % ', '.join(platforms.list_platforms())) p.add_option( "--include-subdirs", action='store_true', dest='include_subdirs', default=False, help="also collect and report disk usage information for first level of " "subdirectories in each data directory") p.add_option( "--plot", action='store', dest='plot_file', default=None, help= "plot a stacked barchart of the usage and output as a PNG to PLOT_FILE" )