<commit_before>import AVFoundation
import ImageIO
import GPUImage

final class CameraServiceImpl: CameraService {
    
    // MARK: - Private types and properties
    
    private struct Error: Swift.Error {}
    
    private var cameraOutput: GPUImageStillCamera?
    private var output: AVCaptureStillImageOutput?
    private var backCamera: AVCaptureDevice?
    private var frontCamera: AVCaptureDevice?
    private var activeCamera: AVCaptureDevice?

    // MARK: - Init
    
    init() {
        let videoDevices = AVCaptureDevice.devices(withMediaType: AVMediaTypeVideo) as? [AVCaptureDevice]
        
        backCamera = videoDevices?.filter({ $0.position == .back }).first
        frontCamera = videoDevices?.filter({ $0.position == .front }).first
    }
    
    deinit {
        NotificationCenter.default.removeObserver(self)
    }
    
    func getImageOutput(completion: @escaping (GPUImageOutput?) -> ()) {
        
        if let cameraOutput = cameraOutput {
            completion(cameraOutput)
        
        } else {
            
            let mediaType = AVMediaTypeVideo
            
            switch AVCaptureDevice.authorizationStatus(forMediaType: mediaType) {
                
            case .authorized:
                setUpCameraOutput()
                completion(cameraOutput)
                
            case .notDetermined:
                AVCaptureDevice.requestAccess(forMediaType: mediaType) { [weak self] granted in
                    if granted {
                        self?.setUpCameraOutput()
                        completion(self?.cameraOutput)
                    } else {
                        completion(nil)
                    }
                }

            case .restricted, .denied:<commit_msg>AI-4353: get rid of useless code<commit_after>import AVFoundation
import ImageIO
import GPUImage

final class CameraServiceImpl: CameraService {
    
    // MARK: - Private types and properties
    
    private struct Error: Swift.Error {}
    
    private var cameraOutput: GPUImageStillCamera?
    private var output: AVCaptureStillImageOutput?
    private var backCamera: AVCaptureDevice?
    private var frontCamera: AVCaptureDevice?
    private var activeCamera: AVCaptureDevice?

    // MARK: - Init
    
    init() {
        let videoDevices = AVCaptureDevice.devices(withMediaType: AVMediaTypeVideo) as? [AVCaptureDevice]
        
        backCamera = videoDevices?.filter({ $0.position == .back }).first
        frontCamera = videoDevices?.filter({ $0.position == .front }).first
    }
    
    func getImageOutput(completion: @escaping (GPUImageOutput?) -> ()) {
        
        if let cameraOutput = cameraOutput {
            completion(cameraOutput)
        
        } else {
            
            let mediaType = AVMediaTypeVideo
            
            switch AVCaptureDevice.authorizationStatus(forMediaType: mediaType) {
                
            case .authorized:
                setUpCameraOutput()
                completion(cameraOutput)
                
            case .notDetermined:
                AVCaptureDevice.requestAccess(forMediaType: mediaType) { [weak self] granted in
                    if granted {
                        self?.setUpCameraOutput()
                        completion(self?.cameraOutput)
                    } else {
                        completion(nil)
                    }
                }

            case .restricted, .denied:
{'fraction_non_alphanumeric': 0.07343162763804567, 'fraction_numerical': 0.0023128071697022263, 'mean_word_length': 1.7416798732171157, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '5450959', 'n_tokens_mistral': 859, 'n_tokens_neox': 835, 'n_words': 196}