<commit_before>//
//  MCOFetchFoldersOperation.m
//  mailcore2
//
//  Created by <NAME> on 1/31/13.
//  Copyright (c) 2013 MailCore. All rights reserved.
//

#import "MCOFetchFoldersOperation.h"
#import "NSError+MCO.h"
#import "NSString+MCO.h"
#import "MCOOperation+Internals.h"

#import <Foundation/Foundation.h>
#import <mailcore/MCAsync.h>

using namespace mailcore;

@interface MCOFetchFoldersOperation ()
@property (nonatomic, copy) void (^completionBlock)(NSError *error, NSArray *folder);
@end

@implementation MCOFetchFoldersOperation

- (void)start:(void (^)(NSError *error, NSArray *folder))completionBlock {
    self.completionBlock = completionBlock;
    [self start];
}

- (void)operationCompleted {
    IMAPFetchFoldersOperation *op = dynamic_cast<IMAPFetchFoldersOperation *>(self.operation);
    if (op->error() == ErrorNone) {
        NSMutableArray *nsfolders = [NSMutableArray array];
        Array *folders = op->folders();
        for (int i = 0 ; i < folders->count(); folders++) {
            NSString *folder = [NSString mco_stringWithMCObject:folders->objectAtIndex(i)];
            [nsfolders addObject:folder];
        }
        
        self.completionBlock(nil, nsfolders);
    } else {
        self.completionBlock([NSError mco_errorWithErrorCode:op->error()], nil);
    }
}
@end<commit_msg>Fixed loop.<commit_after>//
//  MCOFetchFoldersOperation.m
//  mailcore2
//
//  Created by <NAME> on 1/31/13.
//  Copyright (c) 2013 MailCore. All rights reserved.
//

#import "MCOFetchFoldersOperation.h"
#import "NSError+MCO.h"
#import "NSString+MCO.h"
#import "MCOOperation+Internals.h"

#import <Foundation/Foundation.h>
#import <mailcore/MCAsync.h>

using namespace mailcore;

@interface MCOFetchFoldersOperation ()
@property (nonatomic, copy) void (^completionBlock)(NSError *error, NSArray *folder);
@end

@implementation MCOFetchFoldersOperation

- (void)start:(void (^)(NSError *error, NSArray *folder))completionBlock {
    self.completionBlock = completionBlock;
    [self start];
}

- (void)operationCompleted {
    IMAPFetchFoldersOperation *op = dynamic_cast<IMAPFetchFoldersOperation *>(self.operation);
    if (op->error() == ErrorNone) {
        NSMutableArray *nsfolders = [NSMutableArray array];
        Array *folders = op->folders();
        for (int i = 0 ; i < folders->count(); i++) {
            NSString *folder = [NSString mco_stringWithMCObject:folders->objectAtIndex(i)];
            [nsfolders addObject:folder];
        }
        
        self.completionBlock(nil, nsfolders);
    } else {
        self.completionBlock([NSError mco_errorWithErrorCode:op->error()], nil);
    }
}
@end
{'fraction_non_alphanumeric': 0.1378132118451025, 'fraction_numerical': 0.008352315869400152, 'mean_word_length': 3.870609981515712, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 21, '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': '7138258', 'n_tokens_mistral': 913, 'n_tokens_neox': 857, 'n_words': 174}