<commit_before>/**
 * <NAME> - http://taewon.de - @hataewon
 * See LICENSE
 */

import Cocoa

extension NeoVimView {

  override public func draggingEntered(_ sender: NSDraggingInfo) -> NSDragOperation {
    return isFile(sender: sender) ? .copy : NSDragOperation()
  }

  override public func draggingUpdated(_ sender: NSDraggingInfo) -> NSDragOperation {
    return isFile(sender: sender) ? .copy : NSDragOperation()
  }

  override public func performDragOperation(_ sender: NSDraggingInfo) -> Bool {
    if !isFile(sender: sender) {
      return false;
    }
    let paths = sender
      .draggingPasteboard()
      .propertyList(forType: NSFilenamesPboardType)
      as? [String]
    let urls = paths?
      .map { URL(fileURLWithPath: $0) }
      ?? []
    self.open(urls: urls)
    return true;
  }

}

fileprivate func isFile(sender: NSDraggingInfo?) -> Bool {
  return (sender?.draggingPasteboard().types?.contains(String(kUTTypeFileURL))) ?? false
}
<commit_msg>Refactor slightly<commit_after>/**
 * <NAME> - http://taewon.de - @hataewon
 * See LICENSE
 */

import Cocoa

extension NeoVimView {

  override public func draggingEntered(_ sender: NSDraggingInfo) -> NSDragOperation {
    return isFile(sender: sender) ? .copy : NSDragOperation()
  }

  override public func draggingUpdated(_ sender: NSDraggingInfo) -> NSDragOperation {
    return isFile(sender: sender) ? .copy : NSDragOperation()
  }

  override public func performDragOperation(_ sender: NSDraggingInfo) -> Bool {
    guard isFile(sender: sender) else {
      return false
    }

    guard let paths = sender.draggingPasteboard().propertyList(forType: NSFilenamesPboardType) as? [String] else {
      return false
    }

    self.open(urls: paths.map { URL(fileURLWithPath: $0) })

    return true
  }
}

fileprivate func isFile(sender: NSDraggingInfo) -> Bool {
  return (sender.draggingPasteboard().types?.contains(String(kUTTypeFileURL))) ?? false
}

{'fraction_non_alphanumeric': 0.11651993785603314, 'fraction_numerical': 0.0010357327809425167, 'mean_word_length': 3.7121951219512197, 'pattern_counts': {'":': 0, '<': 5, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6185147', 'n_tokens_mistral': 634, 'n_tokens_neox': 614, 'n_words': 144}