Esempio n. 1
0
def build_file_graph(file_dict, dir_path):
    """
    Build a hierarchical graph with a given file paths and
    store the root path in 'data/Constants.json' file.
    :param file_dict:
        File dictionary returned by coala.
    :param dir_path:
        Directory that stores the generated webpage code.
    """
    tr = Tree(parse_file_dict(file_dict).keys())
    home_file = get_file(Constants.CONFIGS['home'], dir_path)
    with open(home_file, 'w') as hm:
        hm.write(tr.root.name)

    return tr.extract()
Esempio n. 2
0
def build_file_graph(file_dict, dir_path):
    """
    Build a hierarchical graph with a given file paths and
    store the root path in 'data/Constants.json' file.
    :param file_dict:
        File dictionary returned by coala.
    :param dir_path:
        Directory that stores the generated webpage code.
    """
    tr = Tree(parse_file_dict(file_dict).keys())
    home_file = get_file(Constants.CONFIGS['home'], dir_path)
    with open(home_file, 'w') as hm:
        hm.write(tr.root.name)

    return tr.extract()
Esempio n. 3
0
 def test_graph(self):
     tr = Tree(self.FL)
     testChild = tr.root.child['tests'].child.get('specs', None)
     self.assertTrue(testChild)
Esempio n. 4
0
 def test_extract(self):
     tr = Tree(self.FL)
     result = tr.extract()
     self.assertIn(tr.root.abspath, result.keys())
Esempio n. 5
0
 def test_graph(self):
     tr = Tree(self.FL)
     testChild = tr.root.child.keys()
     self.assertCountEqual(testChild, os.listdir('tests'))
Esempio n. 6
0
 def test_extract(self):
     tr = Tree(self.FL)
     result = tr.extract()
     self.assertIn(tr.root.abspath, result.keys())