예제 #1
0
    def check_file(self, filename):
        with open(filename) as f:
            metadata = archieml.load(f)
            test = metadata['test']
            expected = json.loads(metadata['result'])

        with open(filename) as f:
            actual = archieml.load(f)
            del actual['test']
            del actual['result']

        self.assertEqual(expected, actual,
                         ('{}\n'
                          'expected: {}\n'
                          'actual  : {}').format(test, expected, actual))
예제 #2
0
def get_extra_context():
    print ">>>>> PARSING NEW STORY"
    call(["node", "scripts/js_parser.js", "out_drive.html"]) # parse the html before loading it into archieML
    with open('./out_parsed.txt') as f:
        data = archieml.load(f)
    data = dict(data)
    return data
예제 #3
0
def get_extra_context():
    call(["node", "node_scripts/js_parser.js",
          "out_drive.html"])  # parse the html before loading it into archieML
    with open('out_parsed.txt') as f:
        data = archieml.load(f)
    data = dict(data)
    return data
예제 #4
0
    def check_file(self, filename):
        with open(filename) as f:
            metadata = archieml.load(f)
            test = metadata['test']
            expected = json.loads(metadata['result'])

        with open(filename) as f:
            actual = archieml.load(f)
            del actual['test']
            del actual['result']

        self.assertEqual(expected, actual, (
            '{}\n'
            'expected: {}\n'
            'actual  : {}'
        ).format(test, expected, actual))
예제 #5
0
def process(infile):
    infile_minus = infile.split('/')[-1]

    with open(infile) as f:
        data = archieml.load(f)
        data2 = json.loads(json.dumps(data))

    return data2
예제 #6
0
    def load(self):
        """
        Parses the downloaded Excel file.
        """
        try:
            with open(self._filename) as f:
                doc = archieml.load(f)
        except IOError:
            raise CopyException('"%s" does not exist. Have you run "fab update_copy"?' % self._filename)

        for section in doc:
            self._copy[section] = Section(section, doc[section])
예제 #7
0
def get_meta():
    path = BAKER_DIR.joinpath("meta.aml")
    with open(path) as f:
        data = archieml.load(f)
    return data