<commit_before>import asyncio
from pyodbc import OperationalError


class Cursor:
    def __init__(self, pyodbc_cursor, connection):
        self._conn = connection
        self._impl = pyodbc_cursor
        self._loop = connection.loop

    def _run_operation(self, func, *args, **kwargs):
        if not self._conn:
            raise OperationalError('Cursor is closed.')
        future = self._conn._execute(func, *args, **kwargs)
        return future

    @asyncio.coroutine
    def close(self):
        resp = yield from self._conn._execute(self._impl.close)
        self._conn = None
        return resp

    @property
    def connection(self):
        return self._conn

    @property
    def rowcount(self):
        return self._impl.rowcount

    @property
    def description(self):
        return self._impl.description

    @property
    def closed(self):
        return self._conn is None

    @property
    def arraysize(self):
        return self._impl.arraysize

    @arraysize.setter
    def arraysize(self, size):
        self._impl.arraysize = size

    def execute(self, sql, *params):
        fut = self._conn._execute(self._impl.execute, sql, *params)
        return fut

    def executemany(self, sql, *params):
        fut = self._run_operation(self._impl.executemany, sql, *params)
        return fut

    @asyncio.coroutine
    def setinputsizes(self, *args, **kwargs):
        return None

    @asyncio.coroutine
    def setoutputsize(self, *args, **kwargs):
        return None

    def fetchone(self):
        fut = self._run_operation(self._impl.fetchone)
        return fut

    def fetchall(self):
        fut = self._run_operation(self._impl.fetchall)
        return fut

    def fetchmany(self, size):
        fut = self._run_operation(self._impl.fetchmany, size)
        return fut

    def nextset(self):<commit_msg>use proper method to execute and close coroutines<commit_after>import asyncio
from pyodbc import OperationalError


class Cursor:
    def __init__(self, pyodbc_cursor, connection):
        self._conn = connection
        self._impl = pyodbc_cursor
        self._loop = connection.loop

    def _run_operation(self, func, *args, **kwargs):
        if not self._conn:
            raise OperationalError('Cursor is closed.')
        future = self._conn._execute(func, *args, **kwargs)
        return future

    @asyncio.coroutine
    def close(self):
        resp = yield from self._run_operation(self._impl.close)
        self._conn = None
        return resp

    @property
    def connection(self):
        return self._conn

    @property
    def rowcount(self):
        return self._impl.rowcount

    @property
    def description(self):
        return self._impl.description

    @property
    def closed(self):
        return self._conn is None

    @property
    def arraysize(self):
        return self._impl.arraysize

    @arraysize.setter
    def arraysize(self, size):
        self._impl.arraysize = size

    def execute(self, sql, *params):
        fut = self._run_operation(self._impl.execute, sql, *params)
        return fut

    def executemany(self, sql, *params):
        fut = self._run_operation(self._impl.executemany, sql, *params)
        return fut

    @asyncio.coroutine
    def setinputsizes(self, *args, **kwargs):
        return None

    @asyncio.coroutine
    def setoutputsize(self, *args, **kwargs):
        return None

    def fetchone(self):
        fut = self._run_operation(self._impl.fetchone)
        return fut

    def fetchall(self):
        fut = self._run_operation(self._impl.fetchall)
        return fut

    def fetchmany(self, size):
        fut = self._run_operation(self._impl.fetchmany, size)
        return fut

    def nextset(self):
{'fraction_non_alphanumeric': 0.09353287012292892, 'fraction_numerical': 0.0, 'mean_word_length': 2.4465930018416207, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '183888', 'n_tokens_mistral': 1108, 'n_tokens_neox': 1085, 'n_words': 278}