<commit_before>//
//  STNetTask.h
//  STNetTaskQueue
//
//  Created by <NAME> on 29/11/14.
//  Copyright (c) 2014 Sth4Me. All rights reserved.
//

#import <Foundation/Foundation.h>

FOUNDATION_EXPORT NSString *const STNetTaskUnknownError;

#ifdef RACObserve

#define STNetTaskObserve(TASK) \
[RACSignal createSignal:^RACDisposable *(id<RACSubscriber> subscriber) { \
    [[[[RACObserve(TASK, finished) skip:1] ignore:@NO] deliverOnMainThread] subscribeNext:^(id x) { \
        [subscriber sendNext:TASK];\
        [subscriber sendCompleted]; \
    }]; \
    [[[[RACObserve(TASK, cancelled) skip:1] ignore:@NO] deliverOnMainThread] subscribeNext:^(id x) { \
        [subscriber sendError:nil];\
    }]; \
    return nil; \
}]

#endif

@class STNetTask;

@protocol STNetTaskDelegate <NSObject>

/**
 This delegate method will be called when the net task is finished(no matter it's successful or failed).
 If the net task is failed, task.error will be non-nil.
 
 @param task STNetTask The finished net task.
 */
- (void)netTaskDidEnd:(STNetTask *)task;

@end

typedef NS_ENUM(NSUInteger, STNetTaskState) {
    STNetTaskStateCancalled,
    STNetTaskStateFinished,
    STNetTaskStateRetrying
};

typedef void (^STNetTaskSubscriptionBlock)();
<commit_msg>Added __kindof keyword in STNetTaskDelegate-netTaskDidEnd:<commit_after>//
//  STNetTask.h
//  STNetTaskQueue
//
//  Created by <NAME> on 29/11/14.
//  Copyright (c) 2014 Sth4Me. All rights reserved.
//

#import <Foundation/Foundation.h>

FOUNDATION_EXPORT NSString *const STNetTaskUnknownError;

#ifdef RACObserve

#define STNetTaskObserve(TASK) \
[RACSignal createSignal:^RACDisposable *(id<RACSubscriber> subscriber) { \
    [[[[RACObserve(TASK, finished) skip:1] ignore:@NO] deliverOnMainThread] subscribeNext:^(id x) { \
        [subscriber sendNext:TASK];\
        [subscriber sendCompleted]; \
    }]; \
    [[[[RACObserve(TASK, cancelled) skip:1] ignore:@NO] deliverOnMainThread] subscribeNext:^(id x) { \
        [subscriber sendError:nil];\
    }]; \
    return nil; \
}]

#endif

@class STNetTask;

@protocol STNetTaskDelegate <NSObject>

/**
 This delegate method will be called when the net task is finished(no matter it's successful or failed).
 If the net task is failed, task.error will be non-nil.
 
 @param task STNetTask The finished net task.
 */
- (void)netTaskDidEnd:(__kindof STNetTask *)task;

@end

typedef NS_ENUM(NSUInteger, STNetTaskState) {
    STNetTaskStateCancalled,
    STNetTaskStateFinished,
    STNetTaskStateRetrying
};

typedef void (^STNetTaskSubscriptionBlock)();

{'fraction_non_alphanumeric': 0.12372748629600626, 'fraction_numerical': 0.010180109631949883, 'mean_word_length': 4.140845070422535, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '2942454', 'n_tokens_mistral': 902, 'n_tokens_neox': 860, 'n_words': 211}