# Path: ship/utils/dbfread/memo.py
# class BinaryMemo(VFPMemo):
#     pass


import sys
import datetime
import struct
from decimal import Decimal
from .memo import BinaryMemo
            return False
        elif data in b'? ':
            return None
        else:
            # Todo: return something? (But that would be misleading!)
            message = 'Illegal value for logical field: {!r}'
            raise ValueError(message.format(data))

    def _parse_memo_index(self, data):
        if len(data) == 4:
            return struct.unpack('<I', data)[0]
        else:
            try:
                return int(data)
            except ValueError:
                if data.strip(b' \x00') == b'':
                    return 0
                else:
                    raise ValueError(
                        'Memo index is not an integer: {!r}'.format(data))

    def parseM(self, field, data):
        """Parse memo field (M, G, B or P)

        Returns memo index (an integer), which can be used to look up
        the corresponding memo in the memo file.
        """
        memo = self.get_memo(self._parse_memo_index(data))
        # Visual FoxPro allows binary data in memo fields.
        # These should not be decoded as string.

# Path: ship/utils/dbfread/memo.py
# class BinaryMemo(VFPMemo):
#     pass


# Path: ship/utils/dbfread/field_parser.py
import sys
import datetime
import struct
from decimal import Decimal
from .memo import BinaryMemo

            return False
        elif data in b'? ':
            return None
        else:
            # Todo: return something? (But that would be misleading!)
            message = 'Illegal value for logical field: {!r}'
            raise ValueError(message.format(data))

    def _parse_memo_index(self, data):
        if len(data) == 4:
            return struct.unpack('<I', data)[0]
        else:
            try:
                return int(data)
            except ValueError:
                if data.strip(b' \x00') == b'':
                    return 0
                else:
                    raise ValueError(
                        'Memo index is not an integer: {!r}'.format(data))

    def parseM(self, field, data):
        """Parse memo field (M, G, B or P)

        Returns memo index (an integer), which can be used to look up
        the corresponding memo in the memo file.
        """
        memo = self.get_memo(self._parse_memo_index(data))
        # Visual FoxPro allows binary data in memo fields.
        # These should not be decoded as string.

        if isinstance(memo, BinaryMemo):