<commit_before>
import os
import sys

from .common import ZictBase


def _encode_key(key):
    return key.encode('latin1')

def _decode_key(key):
    return key.decode('latin1')


class LMDB(ZictBase):
    """ Mutable Mapping interface to a LMDB database.

    Keys must be strings, values must be bytes

    Parameters
    ----------
    directory: string

    Examples
    --------
    >>> z = LMDB('/tmp/somedir/')  # doctest: +SKIP
    >>> z['x'] = b'123'  # doctest: +SKIP
    >>> z['x']  # doctest: +SKIP
    b'123'<commit_msg>Changed default lmdb encoding to utf-8<commit_after>
import os
import sys

from .common import ZictBase


def _encode_key(key):
    return key.encode('utf-8')

def _decode_key(key):
    return key.decode('utf-8')


class LMDB(ZictBase):
    """ Mutable Mapping interface to a LMDB database.

    Keys must be strings, values must be bytes

    Parameters
    ----------
    directory: string

    Examples
    --------
    >>> z = LMDB('/tmp/somedir/')  # doctest: +SKIP
    >>> z['x'] = b'123'  # doctest: +SKIP
    >>> z['x']  # doctest: +SKIP
    b'123'
{'fraction_non_alphanumeric': 0.16069788797061524, 'fraction_numerical': 0.015610651974288337, 'mean_word_length': 2.550488599348534, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, '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': '5164270', 'n_tokens_mistral': 404, 'n_tokens_neox': 377, 'n_words': 104}