"""
Copyright 2016 Deepgram

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""

import logging

import numpy

from . import Provider
from ..utils import DisableLogging

logger = logging.getLogger(__name__)

###############################################################################
class ShuffleProvider(Provider): \
	# pylint: disable=too-few-public-methods,abstract-method
	""" Data provider that can shuffle data in-sync with support data sources.

		# Expected behavior

		This extends the list of expected behaviors from the `Provider` base
		class.

		- Because Providers create new Source iterators for each epoch, and
		  because each epoch ends whenever any Source iterator terminates (that
		  is, once the shorted dataset terminates), Providers only shuffle
		  Sources once every epoch, and can do so at the beginning of each
		  epoch. There is no need for Sources to indicate when they would like
		  to be shuffled.
		- There are two possibilities when applying shuffles:

			1. Past shuffles that have been applied to Sources are persistent,
			   affecting the Source's data in a non-reverseable way (as far as
			   the Source is concerned).
			2. Shuffles are temporary, and once the Source iterator is
			   recreated (between epochs), it can be assumed that the data---