<commit_before>import { IMessage } from '../contracts';
import { IClient } from '../contracts';
import { injectable, inject } from 'inversify';
import { TYPES } from '../ioc/types';
import { commands } from '../static';

import * as opt from 'optimist';

const MaxFileSize: number = 1024 * 1024 * 5; // 5MB

@injectable()
export class StyleImageCommand implements ICommand {

  _command: string = commands.image.style;

  constructor(
    @inject(TYPES.IClient) private _client: IClient,
    @inject(TYPES.IConfig) private _config: IConfig,
    @inject(TYPES.IHttp) private _http: IHttp,
    @inject(TYPES.IFiles) private _filesService: IFiles
  ) { }

  attach(): void {
    this._client
      .getCommandStream(this._command)
      .subscribe(imsg => this.subscription(imsg));
  }

  private subscription(imsg: IMessage) {
    const msg = imsg.Message;

    Promise.resolve().then(async _ => {

      const c = msg.content.trim();

      let argv = this.setupOptions(c.split(' '), imsg);
      let ops = argv.argv

      if (ops.h || !(ops.c && ops.s)) {
        return imsg.send(argv.help(), { code: 'md' });
      }

      const style = await this._http.getFile(ops.s);
      const content = await this._http.getFile(ops.c);

      if (style.size > MaxFileSize || content.size > MaxFileSize) {
        return imsg.send(`Either content or style are bigger than ${MaxFileSize / 106496}MB`);
      }

      const endpoint = this._config.app.api.imageStyle;

      const resultFilename = await this._http.get(`${endpoint}/style`, undefined,
        { content: ops.c, style: ops.s });

      const { data } = await this._http.getFile(`${endpoint}${resultFilename}`);<commit_msg>Removed file size check<commit_after>import { IMessage } from '../contracts';
import { IClient } from '../contracts';
import { injectable, inject } from 'inversify';
import { TYPES } from '../ioc/types';
import { commands } from '../static';

import * as opt from 'optimist';

const MaxFileSize: number = 1024 * 1024 * 5; // 5MB

@injectable()
export class StyleImageCommand implements ICommand {

  _command: string = commands.image.style;

  constructor(
    @inject(TYPES.IClient) private _client: IClient,
    @inject(TYPES.IConfig) private _config: IConfig,
    @inject(TYPES.IHttp) private _http: IHttp,
    @inject(TYPES.IFiles) private _filesService: IFiles
  ) { }

  attach(): void {
    this._client
      .getCommandStream(this._command)
      .subscribe(imsg => this.subscription(imsg));
  }

  private subscription(imsg: IMessage) {
    const msg = imsg.Message;

    Promise.resolve().then(async _ => {

      const c = msg.content.trim();

      let argv = this.setupOptions(c.split(' '), imsg);
      let ops = argv.argv

      if (ops.h || !(ops.c && ops.s)) {
        return imsg.send(argv.help(), { code: 'md' });
      }

      const endpoint = this._config.app.api.imageStyle;

      const resultFilename = await this._http.get(`${endpoint}/style`, undefined,
        { content: ops.c, style: ops.s });

      const { data } = await this._http.getFile(`${endpoint}${resultFilename}`);
{'fraction_non_alphanumeric': 0.14855660071359067, 'fraction_numerical': 0.008433344145313007, 'mean_word_length': 3.1732070365358593, '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': '3380781', 'n_tokens_mistral': 996, 'n_tokens_neox': 967, 'n_words': 237}