def run(self) -> Iterator[_Flake8Error]:
    if (not self.lines):
        return
    visitor = self.visitor()
    visitor.visit(self.tree)
    if (not visitor.should_type_check):
        return
    if ((not self.options.mypy_config) and ('MYPYPATH' not in os.environ)):
        os.environ['MYPYPATH'] = ':'.join(calculate_mypypath())
    with TemporaryDirectory(prefix='flake8mypy_') as d:
        file = NamedTemporaryFile('w', encoding='utf8', prefix='tmpmypy_', suffix='.py', dir=d, delete=False)
        try:
            self.filename = file.name
            for line in self.lines:
                file.write(line)
            file.close()
            (yield from self._run())
        finally:
            os.remove(file.name)
def run(self) -> Iterator[_Flake8Error]:
    if (not self.lines):
        return
    visitor = self.visitor()
    visitor.visit(self.tree)
    if (not visitor.should_type_check):
        return
    if ((not self.options.mypy_config) and ('MYPYPATH' not in os.environ)):
        os.environ['MYPYPATH'] = ':'.join(calculate_mypypath())
    with TemporaryDirectory(prefix='flake8mypy_') as d:
        file = NamedTemporaryFile('w', encoding='utf8', prefix='tmpmypy_', suffix='.py', dir=d, delete=False)
        try:
            self.filename = file.name
            for line in self.lines:
                file.write(line)
            file.close()
            (yield from self._run())
        finally:
            os.remove(file.name)