<commit_before>import {Bucket} from './../common/Bucket';
import {Path} from './../common/Path';
import {IBucketObject} from './../common/IBucketObject';
import {File} from './../common/File';
import {Folder} from './../common/Folder';
import {IFolderContents} from './../common/IFolderContents';
import {IUploadConfig} from './../common/IUploadConfig';
import {IBackend} from './../common/IBackend';
import {AmazonS3Backend} from './../common/AmazonS3Backend';

export class BucketController {
  /**
   * Dependencies we want passed to the constructor.
   * @see http://docs.angularjs.org/guide/di
   */
  public static $inject = [
    '$rootScope'
  ];

  /**
   * Backend name. Passed in as component binding.
   */
  public backendName: string;

  /**
   * Bucket name. Passed in as a component binding.
   */
  public bucketName: string;

  /**
   * AWS region. Passed in as a component binding.
   */
  public awsRegion: string;

  /**
   * AWS Access Key ID. Passed in as a component binding.
   */
  public awsAccessKeyId: string;

  /**
   * AWS Secret Access Key. Passed in as a component binding.
   */
  public awsSecretAccessKey: string;

  /**
   * AWS bucket prefix for a folder. Passed in as a component binding.
   */
  public awsBucketPrefix: string;

  /**
   * Flag used to indicate a background operation is running.
   */
  public working: boolean;

  /**
   * Error encountered running background operation.
   */
  public error: Error;

  /**
   * Bucket.
   */
  public bucket: Bucket;

  /**
   * Current working folder.
   */
  public currentFolder: Folder;

  /**
   * Folder objects in the current working path.
   */
  public folders: Folder[];

  /**
   * File objects in the current working path.
   */
  public files: File[];

  /**
   * Settings for uploading files.
   */
  public uploadConfig: IUploadConfig;

  /**
   * Used to specify the name of new folders.
   */
  public folderName: string;

  /**
   * Backend.
   */
  private backend: IBackend;

  /**
   * Create an instance of the controller.
   */
  constructor(private $rootScope: ng.IScope) {
    if(this.awsBucketPrefix === undefined){
      this.awsBucketPrefix = '/';
    }
    this.working = false;
    this.error = null;
    this.bucket = null;
    this.currentFolder = new Folder(new Path(this.awsBucketPrefix));
    this.folders = [];
    this.files = [];
    this.uploadConfig = null;
    this.folderName = '';
  }

  /**
   * Initialize the controller.
   */
  $onInit() {
    // create the backend
    if (this.backendName === 's3') {
      this.backend = new AmazonS3Backend(
        this.awsRegion,
        this.awsAccessKeyId,
        this.awsSecretAccessKey);
    } else {
      throw new Error(`Unknown backend: ${this.backendName}`);
    }

    // initial load
    this.loadContents();<commit_msg>Fix style warnings<commit_after>import {Bucket} from './../common/Bucket';
import {Path} from './../common/Path';
import {IBucketObject} from './../common/IBucketObject';
import {File} from './../common/File';
import {Folder} from './../common/Folder';
import {IFolderContents} from './../common/IFolderContents';
import {IUploadConfig} from './../common/IUploadConfig';
import {IBackend} from './../common/IBackend';
import {AmazonS3Backend} from './../common/AmazonS3Backend';

export class BucketController {
  /**
   * Dependencies we want passed to the constructor.
   * @see http://docs.angularjs.org/guide/di
   */
  public static $inject = [
    '$rootScope'
  ];

  /**
   * Backend name. Passed in as component binding.
   */
  public backendName: string;

  /**
   * Bucket name. Passed in as a component binding.
   */
  public bucketName: string;

  /**
   * AWS region. Passed in as a component binding.
   */
  public awsRegion: string;

  /**
   * AWS Access Key ID. Passed in as a component binding.
   */
  public awsAccessKeyId: string;

  /**
   * AWS Secret Access Key. Passed in as a component binding.
   */
  public awsSecretAccessKey: string;

  /**
   * AWS bucket prefix for a folder. Passed in as a component binding.
   */
  public awsBucketPrefix: string;

  /**
   * Flag used to indicate a background operation is running.
   */
  public working: boolean;

  /**
   * Error encountered running background operation.
   */
  public error: Error;

  /**
   * Bucket.
   */
  public bucket: Bucket;

  /**
   * Current working folder.
   */
  public currentFolder: Folder;

  /**
   * Folder objects in the current working path.
   */
  public folders: Folder[];

  /**
   * File objects in the current working path.
   */
  public files: File[];

  /**
   * Settings for uploading files.
   */
  public uploadConfig: IUploadConfig;

  /**
   * Used to specify the name of new folders.
   */
  public folderName: string;

  /**
   * Backend.
   */
  private backend: IBackend;

  /**
   * Create an instance of the controller.
   */
  constructor(private $rootScope: ng.IScope) {
    if (this.awsBucketPrefix === undefined) {
      this.awsBucketPrefix = '/';
    }
    this.working = false;
    this.error = null;
    this.bucket = null;
    this.currentFolder = new Folder(new Path(this.awsBucketPrefix));
    this.folders = [];
    this.files = [];
    this.uploadConfig = null;
    this.folderName = '';
  }

  /**
   * Initialize the controller.
   */
  $onInit() {
    // create the backend
    if (this.backendName === 's3') {
      this.backend = new AmazonS3Backend(
        this.awsRegion,
        this.awsAccessKeyId,
        this.awsSecretAccessKey);
    } else {
      throw new Error(`Unknown backend: ${this.backendName}`);
    }

    // initial load
    this.loadContents();
{'fraction_non_alphanumeric': 0.13709820635766293, 'fraction_numerical': 0.0014207068016338128, 'mean_word_length': 2.539912005028284, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1339122', 'n_tokens_mistral': 1724, 'n_tokens_neox': 1705, 'n_words': 500}