def _automataCLI_prepQueryFile(self, queryFile, csharpPatterns): queries = [ { 'pattern': pattern } for pattern in csharpPatterns ] for q in queries: queryFile.write(libLF.toNDJSON(q) + "\n") queryFile.flush()
def test_initFromNDJSON(self): ru = libLF.RegexUsage() ru.initFromNDJSON(libLF.toNDJSON(pythonReObj)) self.assertEqual(pythonReObj['pattern'], ru.pattern) self.assertEqual(pythonReObj['flags'], ru.flags) self.assertEqual(pythonReObj['inputs'], ru.inputs) self.assertEqual(pythonReObj['project'], ru.project) self.assertEqual(pythonReObj['relPath'], ru.relPath) self.assertEqual(pythonReObj['basename'], ru.basename)
def toNDJSON(self): return libLF.toNDJSON(self._toDict())
def toNDJSON(self): # Consistent and in ndjson format return libLF.toNDJSON(self._toDict())
def toNDJSON(self): assert (self.initialized) # Consistent and in ndjson format return libLF.toNDJSON(self._toDict())
def test_toNDJSON(self): ru = libLF.RegexUsage() ru.initFromNDJSON(libLF.toNDJSON(pythonReObj)) obj = json.loads(ru.toNDJSON()) self.assertEqual(obj, pythonReObj)
def test_factory(self): _is = libLF.InternetRegexSource.factory(libLF.toNDJSON(relObj)) self.assertEqual(_is.type, relObj['type']) _is = libLF.InternetRegexSource.factory(libLF.toNDJSON(soObj)) self.assertEqual(_is.type, soObj['type'])