import tensorflow

#
# 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 os
import h5py
import numpy as np

import tensorflow
if int(tensorflow.__version__.split(".")[0]) == 2:
    import tensorflow.compat.v1 as tf
else:
    import tensorflow as tf

from datetime import datetime, timedelta

def input_iterator(data_root, subject_id, train=False):
    fnames = [name.split('.')[0] for name in os.listdir(os.path.join(data_root, subject_id)) if not name.startswith('.')]
    fnames.sort()
    for i in range(len(fnames) - 1):
        assert datetime.strptime(fnames[i+1], "%Y-%m-%d").date() - datetime.strptime(fnames[i], "%Y-%m-%d").date() == timedelta(days=1)
