Пример #1
0
    def search_constant_pool(self, *, path: str, **options):
        """Partially load the class at `path`, yield all matching constants
        from the ConstantPool.

        This is an optimization method that does not load a complete ClassFile,
        nor does it add the results to the ClassLoader cache.

        :param path: Fully-qualified path to a ClassFile.
        :param options: A list of options to pass into `ConstantPool.find()`
        """
        with self.open(f'{path}.class') as source:
            # Skip over the magic, minor, and major version.
            source.read(8)
            pool = ConstantPool()
            pool.unpack(source)
            yield from pool.find(**options)