<commit_before># Copyright 2017 Codas Lab
#
# 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 unittest
import warnings
import skvideo.io
import os
import time
import numpy as np
import wget
from decode import video_decoder as vd

""" Do not delete these comments.
Data for test_video.mp4 is saved in test_video_data.npy.

You do not want to write tests using an skvideo function because if it breaks
or changes in functionality, you will waste time trying to figure out whether
the issue was video_decoder.py, skvideo, or the test(s).
"""


class TestVideoDecoder(unittest.TestCase):

    def setUp(self):
        data_dir = 'test/test_data/'

        self.vid_path = data_dir + 'test_video.mp4'
        self.correct_data = np.load(data_dir + 'test_video_data.npy')
        self.nframes = self.correct_data.shape[0]
        self.width = self.correct_data.shape[2]
        self.height = self.correct_data.shape[1]
        self.nchannels = self.correct_data.shape[3]

        self.timing_start = time.time()

    def tearDown(self):
        elapsed = time.time() - self.timing_start
        print('\n{} ({:.5f} sec)'.format(self.id(), elapsed))
<commit_msg>removed import<commit_after># Copyright 2017 Codas Lab
#
# 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 unittest
import warnings
import skvideo.io
import os
import time
import numpy as np
from decode import video_decoder as vd

""" Do not delete these comments.
Data for test_video.mp4 is saved in test_video_data.npy.

You do not want to write tests using an skvideo function because if it breaks
or changes in functionality, you will waste time trying to figure out whether
the issue was video_decoder.py, skvideo, or the test(s).
"""


class TestVideoDecoder(unittest.TestCase):

    def setUp(self):
        data_dir = 'test/test_data/'

        self.vid_path = data_dir + 'test_video.mp4'
        self.correct_data = np.load(data_dir + 'test_video_data.npy')
        self.nframes = self.correct_data.shape[0]
        self.width = self.correct_data.shape[2]
        self.height = self.correct_data.shape[1]
        self.nchannels = self.correct_data.shape[3]

        self.timing_start = time.time()

    def tearDown(self):
        elapsed = time.time() - self.timing_start
        print('\n{} ({:.5f} sec)'.format(self.id(), elapsed))

{'fraction_non_alphanumeric': 0.12720439433362243, 'fraction_numerical': 0.008673026886383347, 'mean_word_length': 3.8055555555555554, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3810739', 'n_tokens_mistral': 990, 'n_tokens_neox': 950, 'n_words': 367}