<commit_before>//
//  CenterAlignedCollectionViewFlowLayout.swift
//  CenterAlignedCollectionViewFlowLayout
//
//  Created by <NAME> on 17/12/2558 BE.
//  Copyright © 2558 <NAME>. All rights reserved.
//

import UIKit

public class CenterAlignedCollectionViewFlowLayout: UICollectionViewFlowLayout {
  public override func layoutAttributesForElementsInRect(rect: CGRect) -> [UICollectionViewLayoutAttributes]? {
    guard let attributes = super.layoutAttributesForElementsInRect(rect) else {
      return nil
    }
    
    // We will do centering alignment only on the Cell layout attributes
    let cellAttributes = attributes.filter({ (layout: UICollectionViewLayoutAttributes) -> Bool in
      return layout.representedElementCategory == .Cell<commit_msg>Copy attributes instead of using passed in values<commit_after>//
//  CenterAlignedCollectionViewFlowLayout.swift
//  CenterAlignedCollectionViewFlowLayout
//
//  Created by <NAME> on 17/12/2558 BE.
//  Copyright © 2558 <NAME>. All rights reserved.
//

import UIKit

public class CenterAlignedCollectionViewFlowLayout: UICollectionViewFlowLayout {
  public override func layoutAttributesForElementsInRect(rect: CGRect) -> [UICollectionViewLayoutAttributes]? {
    guard let oldAttributes = super.layoutAttributesForElementsInRect(rect) else {
      return nil
    }
    
    var attributes = [UICollectionViewLayoutAttributes]()
    for attr in oldAttributes{
      if let attribute = attr.copy() as? UICollectionViewLayoutAttributes{
          attributes.append(attribute)
      }
    }

    
    // We will do centering alignment only on the Cell layout attributes
    let cellAttributes = attributes.filter({ (layout: UICollectionViewLayoutAttributes) -> Bool in
      return layout.representedElementCategory == .Cell
{'fraction_non_alphanumeric': 0.07696629213483146, 'fraction_numerical': 0.01348314606741573, 'mean_word_length': 4.117816091954023, 'pattern_counts': {'":': 0, '<': 7, '<?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': '3821741', 'n_tokens_mistral': 475, 'n_tokens_neox': 460, 'n_words': 132}