def __new__(cls, code, tu):
        """Constructs a new parsed C code.

        :param str code: The original C code.
        :param clang.TranslationUnit tu: The underlying translation unit.
        """
        c_code = Text.__new__(cls, code)
        return c_code
    def __new__(cls, yara_rules):
        """Constructs new parsed YARA rules.

        :param str yara_rules: Text representation of the YARA rules.
        """
        return Text.__new__(cls, yara_rules)
Esempio n. 3
0
    def __new__(cls, config):
        """Constructs a new parsed config.

        :param str config: Text representation of the config.
        """
        return Text.__new__(cls, config)
Esempio n. 4
0
 def output(self):
     """Output from the tool (:class:`.Text`)."""
     return Text(self._output)
 def test_contains_returns_false_if_regexp_is_not_found(self):
     text = Text('')
     self.assertFalse(text.contains(r'test'))
 def test_contains_returns_true_if_regexp_is_found(self):
     text = Text("""
         // ...
         void func() {}
     """)
     self.assertTrue(text.contains(r'void .*() {}'))