def fromfile(filename): """Constructs a simpleCSS object from a given CSS file :param filename: The name as a string of the CSS file :returns: a simpleCSS object representing the file """ css = cssfile.fromfile(filename) return fromcssfile(css)
def write_compact(arguments): """Read in file and output it in compacted form""" css = cssfile.fromfile(arguments['<file>'], arguments['--multi-props']) clique = simplecssbuilder.cliquefromcssfile(css) filename = get_output_file() if filename is not None: fout = open(filename, 'w') clique.write_compact(fout) fout.close() else: clique.write_compact(sys.stdout)
def fromfile(filename, make_clique_css=False): """Constructs a simpleCSS object from a given CSS file :param filename: The name as a string of the CSS file :param make_clique_css: Whether to return a cliqueCSS as well as simpleCSS :returns: a simpleCSS object representing the file or a pair (simpleCSS, cliqueCSS) """ css = cssfile.fromfile(filename) return fromcssfile(css, make_clique_css)
def build_mode(output_stats): """Reads a file and outputs simpleCSS Model""" start_time = default_timer() css = cssfile.fromfile(arguments['<file>'], arguments['--multi-props']) mid_time = default_timer() simple_css = simplecssbuilder.fromcssfile(css) end_time = default_timer() if output_stats: print "CSS read in", (mid_time - start_time), "s." print "Simple CSS built in", (end_time - mid_time), "s." print "Number of dependencies is", len(simple_css.getEdgeSet()) else: print str(simple_css)
def write_size(arguments): """Read in file and output calculated size""" css = cssfile.fromfile(arguments['<file>'], arguments['--multi-props']) clique = simplecssbuilder.cliquefromcssfile(css) print "Calculated file size is", clique.size(), "bytes"
def refactor_file(arguments): css = cssfile.fromfile(arguments['<file>'], arguments['--multi-props']) model = refactor(css) _do_model_output(model)