<commit_before>'use babel';

import { Emitter, CompositeDisposable } from 'atom';
import path from 'path';
import { $, View } from 'atom-space-pen-views';
import { getIconHandler, checkTarget, recursiveViewDestroy } from '../helpers';
import FileView from './file-view';

class DirectoryView extends View {

  static content() {
    return this.li({
      class: 'directory entry list-nested-item collapsed',
      is: 'tree-view-directory',
    }, () => {
      this.div({
        class: 'header list-item',
        outlet: 'header',
        is: 'tree-view-directory',
      }, () => this.span({
        class: 'name icon',
        outlet: 'name',
      }));
      this.ol({
        class: 'entries list-tree',
        outlet: 'entries',
      });
    });
  }

  initialize(directory) {
    // super.initialize(directory);

    this.emitter = new Emitter();
    this.subscriptions = new CompositeDisposable();
    this.subsDrags = new CompositeDisposable();

    this.item = directory;
    this.name.text(this.item.name);
    this.name.attr('data-name', this.item.name);
    this.name.attr('data-path', this.item.remote);

    const addIconToElement = getIconHandler();
    if (addIconToElement) {
      const element = this.name[0] || this.name;
      const pathIco = this.item && this.item.local;
      this.iconDisposable = addIconToElement(element, pathIco, { isDirectory: true });
    } else {
      this.name.addClass(this.item.type && this.item.type === 'l' ? 'icon-file-symlink-directory' : 'icon-file-directory');
    }

    if (this.item.isExpanded || this.item.isRoot) { this.expand(); }

    if (this.item.isRoot) {
      this.addClass('project-root');
      this.header.addClass('project-root-header');
      this.name.addClass('icon-server').removeClass('icon-file-directory');
    }

    // Trigger repaint
    this.triggers();

    this.repaint();

    // Events
    this.events();

    if (atom.config.get('Remote-FTP.tree.enableDragAndDrop')) {
      this.dragEventsActivate();
    }
  }

  triggers() {
    this.subscriptions.add(
      this.item.onChangeSelect(() => {<commit_msg>Fix Cannot create icon-node for empty path #690<commit_after>'use babel';

import { Emitter, CompositeDisposable } from 'atom';
import path from 'path';
import { $, View } from 'atom-space-pen-views';
import { getIconHandler, checkTarget, recursiveViewDestroy } from '../helpers';
import FileView from './file-view';

class DirectoryView extends View {

  static content() {
    return this.li({
      class: 'directory entry list-nested-item collapsed',
      is: 'tree-view-directory',
    }, () => {
      this.div({
        class: 'header list-item',
        outlet: 'header',
        is: 'tree-view-directory',
      }, () => this.span({
        class: 'name icon',
        outlet: 'name',
      }));
      this.ol({
        class: 'entries list-tree',
        outlet: 'entries',
      });
    });
  }

  initialize(directory) {
    // super.initialize(directory);

    this.emitter = new Emitter();
    this.subscriptions = new CompositeDisposable();
    this.subsDrags = new CompositeDisposable();

    this.item = directory;
    this.name.text(this.item.name);
    this.name.attr('data-name', this.item.name);
    this.name.attr('data-path', this.item.remote);

    const addIconToElement = getIconHandler();
    if (addIconToElement) {
      const element = this.name[0] || this.name;
      const pathIco = this.item && this.item.local;

      if (typeof pathIco === 'undefined') return;

      this.iconDisposable = addIconToElement(element, pathIco, { isDirectory: true });
    } else {
      this.name.addClass(this.item.type && this.item.type === 'l' ? 'icon-file-symlink-directory' : 'icon-file-directory');
    }

    if (this.item.isExpanded || this.item.isRoot) { this.expand(); }

    if (this.item.isRoot) {
      this.addClass('project-root');
      this.header.addClass('project-root-header');
      this.name.addClass('icon-server').removeClass('icon-file-directory');
    }

    // Trigger repaint
    this.triggers();

    this.repaint();

    // Events
    this.events();

    if (atom.config.get('Remote-FTP.tree.enableDragAndDrop')) {
      this.dragEventsActivate();
    }
  }

  triggers() {
    this.subscriptions.add(
      this.item.onChangeSelect(() => {
{'fraction_non_alphanumeric': 0.16184701492537312, 'fraction_numerical': 0.0011660447761194029, 'mean_word_length': 2.805678793256433, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '895723', 'n_tokens_mistral': 1370, 'n_tokens_neox': 1328, 'n_words': 259}