<commit_before>//
//  DTStorage.h
//  DTModelStorage
//
//  Created by <NAME> on 15.12.13.
//  Copyright (c) 2013 <NAME>. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#import "DTStorageUpdate.h"
#import "DTStorageUpdating.h"

#pragma clang assume_nonnull begin

/**
 `DTStorage` protocol is used to define common interface for storage classes.
 */
@protocol DTStorageProtocol <NSObject>

/**
 Array of sections, conforming to `DTSection` protocol. Depending on data storage used, section objects may be different.
 
 @return NSArray of <DTSection> objects.
 */

- (NSArray*)sections;

/**
 Returns item at concrete indexPath. This method is used for perfomance reasons. For example, when DTCoreDataStorage is used, calling objects method will fetch all the objects from fetchRequest, but we want to fetch only one.
 
 @param indexPath indexPath of desired item
 
 @return item at desired indexPath
 */
- (nullable id)objectAtIndexPath:(NSIndexPath *)indexPath;

/**
 Delegate property used to transfer current data storage changes.
 */
@property (nonatomic, weak, nullable) id <DTStorageUpdating> delegate;

@optional

///-----------------------------------------------------------
/// @name Setting and getting supplementary models
///-----------------------------------------------------------

/**
 Getter method for header model for current section.
 
 @param index Number of section.
 
 @return Header model for section at index.
 */
- (nullable id)headerModelForSectionIndex:(NSInteger)index;

/**
 Getter method for footer model for current section.
 
 @param index Number of section.
 
 @return Footer model for section at index.
 */
- (nullable id)footerModelForSectionIndex:(NSInteger)index;

/**
 Set supplementary header kind. For example, for UICollectionViewFlowLayout it would be UICollectionElementKindSectionHeader
 
 @param headerKind supplementary kind
 */
- (void)setSupplementaryHeaderKind:(NSString *)headerKind;

/**
 Set supplementary footer kind. For example, for UICollectionViewFlowLayout it would be UICollectionElementKindSectionFooter
 
 @param footerKind supplementary kind
 */
- (void)setSupplementaryFooterKind:(NSString *)footerKind;

/**
 Storage class may implement this method to define supplementary models for section.
 
 @param kind Kind of supplementary model
 
 @sectionNumber number of section 
 
 @return supplementary model for given kind for given section
 */

- (nullable id)supplementaryModelOfKind:(NSString *)kind
                        forSectionIndex:(NSUInteger)sectionNumber;

///-----------------------------------------------------------
/// @name Searching
///-----------------------------------------------------------

/**
 Method to create filtered data storage, based on current data storage and passed searchString and searchScope.
 
 @param searchString String, used to search in data storage
 
 @param searchScope Search scope for current search.
 
 @return searching data storage.
 */

- (instancetype)searchingStorageForSearchString:(NSString *)searchString
                                  inSearchScope:(NSUInteger)searchScope;

@end

#pragma clang assume_nonnull end

<commit_msg>improve backwards compatibility for nullability annotations<commit_after>//
//  DTStorage.h
//  DTModelStorage
//
//  Created by <NAME> on 15.12.13.
//  Copyright (c) 2013 <NAME>. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#import "DTStorageUpdate.h"
#import "DTStorageUpdating.h"

#if __has_feature(nullability) // Xcode 6.3+
#pragma clang assume_nonnull begin
#else
#define nullable
#define __nullable
#endif

/**
 `DTStorage` protocol is used to define common interface for storage classes.
 */
@protocol DTStorageProtocol <NSObject>

/**
 Array of sections, conforming to `DTSection` protocol. Depending on data storage used, section objects may be different.
 
 @return NSArray of <DTSection> objects.
 */

- (NSArray*)sections;

/**
 Returns item at concrete indexPath. This method is used for perfomance reasons. For example, when DTCoreDataStorage is used, calling objects method will fetch all the objects from fetchRequest, but we want to fetch only one.
 
 @param indexPath indexPath of desired item
 
 @return item at desired indexPath
 */
- (nullable id)objectAtIndexPath:(NSIndexPath *)indexPath;

/**
 Delegate property used to transfer current data storage changes.
 */
@property (nonatomic, weak, nullable) id <DTStorageUpdating> delegate;

@optional

///-----------------------------------------------------------
/// @name Setting and getting supplementary models
///-----------------------------------------------------------

/**
 Getter method for header model for current section.
 
 @param index Number of section.
 
 @return Header model for section at index.
 */
- (nullable id)headerModelForSectionIndex:(NSInteger)index;

/**
 Getter method for footer model for current section.
 
 @param index Number of section.
 
 @return Footer model for section at index.
 */
- (nullable id)footerModelForSectionIndex:(NSInteger)index;

/**
 Set supplementary header kind. For example, for UICollectionViewFlowLayout it would be UICollectionElementKindSectionHeader
 
 @param headerKind supplementary kind
 */
- (void)setSupplementaryHeaderKind:(NSString *)headerKind;

/**
 Set supplementary footer kind. For example, for UICollectionViewFlowLayout it would be UICollectionElementKindSectionFooter
 
 @param footerKind supplementary kind
 */
- (void)setSupplementaryFooterKind:(NSString *)footerKind;

/**
 Storage class may implement this method to define supplementary models for section.
 
 @param kind Kind of supplementary model
 
 @sectionNumber number of section 
 
 @return supplementary model for given kind for given section
 */

- (nullable id)supplementaryModelOfKind:(NSString *)kind
                        forSectionIndex:(NSUInteger)sectionNumber;

///-----------------------------------------------------------
/// @name Searching
///-----------------------------------------------------------

/**
 Method to create filtered data storage, based on current data storage and passed searchString and searchScope.
 
 @param searchString String, used to search in data storage
 
 @param searchScope Search scope for current search.
 
 @return searching data storage.
 */

- (instancetype)searchingStorageForSearchString:(NSString *)searchString
                                  inSearchScope:(NSUInteger)searchScope;

@end

#if __has_feature(nullability)
#pragma clang assume_nonnull end
#endif

{'fraction_non_alphanumeric': 0.12757777001048584, 'fraction_numerical': 0.002563206338110218, 'mean_word_length': 3.150870406189555, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4109890', 'n_tokens_mistral': 2148, 'n_tokens_neox': 1992, 'n_words': 928}