<commit_before>open class PlaybackFactory {
    fileprivate var options: Options

    public init(options: Options = [:]) {
        self.options = options
    }

    open func createPlayback() -> Playback {
        let availablePlayback = Loader.shared.playbacks.first { playback in canPlay(playback) }
        guard let playback = availablePlayback, playback.type == .playback else {
            return NoOpPlayback(options: options)
        }
        return playback.init(options: options)
    }

    fileprivate func canPlay(_ type: Playback.Type) -> Bool {
        return type.canPlay(options)
    }
}<commit_msg>refact: simplify PlaybackFactory<commit_after>open class PlaybackFactory {
    fileprivate var options: Options

    public init(options: Options = [:]) {
        self.options = options
    }

    open func createPlayback() -> Playback {
        let playback = Loader.shared.playbacks.first(where: canPlay) ?? NoOpPlayback.self
        return playback.init(options: options)
    }

    fileprivate func canPlay(_ type: Playback.Type) -> Bool {
        return type.canPlay(options)
    }
}
{'fraction_non_alphanumeric': 0.09592760180995476, 'fraction_numerical': 0.0, 'mean_word_length': 2.867132867132867, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '3866083', 'n_tokens_mistral': 317, 'n_tokens_neox': 300, 'n_words': 77}