<commit_before># -*- coding: utf-8 -*-
"""
The class hierachy for exceptions is::

	Error
	 +-- VersionMismatch
	 +-- AddressError
	 +-- EncoderError
	 |    +-- EncoderMissingError
	 |    +-- EncodingError
	 |    +-- DecodingError
	 +-- CommunicationError
	      +-- ProtocolError
	      +-- StatusError
	      +-- ErrorResponse
	           +-- PartialErrorResponse
	      +-- ConnectionError
	      +-- TimeoutError

"""
import multiaddr.exceptions


class Error(Exception):
	"""Base class for all exceptions in this module."""
	pass


class AddressError(Error, multiaddr.exceptions.Error):
	"""Raised when the provided daemon location Multiaddr does not match any
	of the supported patterns."""
	
	def __init__(self, addr):
		self.addr = addr
		Error.__init__(self, "Unsupported Multiaddr pattern: {0}".format(addr))


class VersionMismatch(Error):
	"""Raised when daemon version is not supported by this client version."""

	def __init__(self, current, minimum, maximum):
		self.current = current
		self.minimum = minimum
		self.maximum = maximum

		msg = "Unsupported daemon version '{}' (not in range: {} – {})".format(
			current, minimum, maximum
		)
		Error.__init__(self, msg)


###############
# encoding.py #
###############
class EncoderError(Error):
	"""Base class for all encoding and decoding related errors."""
<commit_msg>Improve compatibility error reporting as per #199<commit_after># -*- coding: utf-8 -*-
"""
The class hierachy for exceptions is::

	Error
	 +-- VersionMismatch
	 +-- AddressError
	 +-- EncoderError
	 |    +-- EncoderMissingError
	 |    +-- EncodingError
	 |    +-- DecodingError
	 +-- CommunicationError
	      +-- ProtocolError
	      +-- StatusError
	      +-- ErrorResponse
	           +-- PartialErrorResponse
	      +-- ConnectionError
	      +-- TimeoutError

"""
import multiaddr.exceptions


class Error(Exception):
	"""Base class for all exceptions in this module."""
	pass


class AddressError(Error, multiaddr.exceptions.Error):
	"""Raised when the provided daemon location Multiaddr does not match any
	of the supported patterns."""
	
	def __init__(self, addr):
		self.addr = addr
		Error.__init__(self, "Unsupported Multiaddr pattern: {0}".format(addr))


class VersionMismatch(Error):
	"""Raised when daemon version is not supported by this client version."""

	def __init__(self, current, minimum, maximum):
		self.current = current
		self.minimum = minimum
		self.maximum = maximum

		msg = "Unsupported daemon version '{}' (not in range: {} ≤ … < {})".format(
			".".join(map(str, current)), ".".join(map(str, minimum)), ".".join(map(str, maximum))
		)
		Error.__init__(self, msg)


###############
# encoding.py #
###############
class EncoderError(Error):
	"""Base class for all encoding and decoding related errors."""

{'fraction_non_alphanumeric': 0.14974802015838734, 'fraction_numerical': 0.0025197984161267097, 'mean_word_length': 3.4251592356687897, 'pattern_counts': {'":': 0, '<': 4, '<?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': '3193437', 'n_tokens_mistral': 863, 'n_tokens_neox': 783, 'n_words': 238}