<commit_before>import unittest.mock

from stencila.schema.interpreter import Interpreter, DocumentCompiler, ParameterParser, execute_compilation, \
    compile_article, DocumentCompilationResult, SKIP_OUTPUT_SEMAPHORE
from stencila.schema.code_parsing import CodeChunkParseResult, CodeChunkExecution, CodeChunkParser
from stencila.schema.types import CodeExpression, CodeChunk, Article


def execute_code_chunk(text: str) -> CodeChunk:
    cc = CodeChunk(text)
    cce = CodeChunkExecution(
        cc, CodeChunkParser().parse(cc)
    )
    Interpreter().execute([cce], {})
    return cc
<commit_msg>chore(Py): Fix unused imports in tests<commit_after>import unittest.mock

from stencila.schema.code_parsing import CodeChunkExecution, CodeChunkParser
from stencila.schema.interpreter import Interpreter, execute_compilation, compile_article, DocumentCompilationResult, \
    SKIP_OUTPUT_SEMAPHORE
from stencila.schema.types import CodeExpression, CodeChunk, Article


def execute_code_chunk(text: str) -> CodeChunk:
    cc = CodeChunk(text)
    cce = CodeChunkExecution(
        cc, CodeChunkParser().parse(cc)
    )
    Interpreter().execute([cce], {})
    return cc

{'fraction_non_alphanumeric': 0.0839041095890411, 'fraction_numerical': 0.0, 'mean_word_length': 5.458563535911602, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3923495', 'n_tokens_mistral': 337, 'n_tokens_neox': 342, 'n_words': 76}