<commit_before>require "filewatcher/exceptions"
require "contracts"
require "filewatcher/mcontracts"
require "filewatcher/static_regex"

module FileWatcher
  module AdvCmds
    include Contracts::Core
    C = Contracts

    Contract.override_failure_callback do |data|
      # Stop Exception Failures
      # puts Contract.failure_msg(data)
    end

    Contract C::And[MContracts::NilArgs, MContracts::Arg_m, MContracts::Arg_t] => C::Any
    def self.sysmgr(args)
      args = args.gsub(StaticRegex::WHITESPACE_OMIT_BRACKET_WHITESPACE_CONTENT, "")
      message = StaticRegex::MESSAGE_ARG_QUOTES_CONTAIN_ANY.match(args)[1].gsub(StaticRegex::FIND_QUOTES, "")
      time = StaticRegex::TIME_ARG_INTEGER.match(args)[1]
      Mylib::sysmgr(message, time.to_i)
    end

    # Contract MContracts::NilArgs => C::Any
    # design: getdir requests no arguments
    def self.getdir(args)
      Mylib::getdir()
    end

    Contract C::And[MContracts::NilArgs, MContracts::Arg_watch_mode, MContracts::Arg_file, MContracts::Arg_t] => C::Any
    def self.filewatch(args)
      command, sub_args = ""
      # extract fn, name, dur from command
      args = args.gsub(StaticRegex::WHITESPACE_OMIT_BRACKET_WHITESPACE_CONTENT, "") 
      watch_mode = StaticRegex::WATCH_MODE_ARG.match(args)[1]

      file_names = StaticRegex::FILENAME_ARG_ANY.match(args)[1]
      file_name = StaticRegex::CONTENT_BETWEEN_QUOTES.match(file_names)[2]

      time = StaticRegex::TIME_ARG_INTEGER.match(args)[1]

      if StaticRegex::ACTION_ARG_ANY.match(args)[1]
        action = StaticRegex::ACTION_ARG_ANY.match(args)[1]
        command, sub_args = action.split(" ", 2)<commit_msg>fixed -a problem in filewatch<commit_after>require "filewatcher/exceptions"
require "contracts"
require "filewatcher/mcontracts"
require "filewatcher/static_regex"

module FileWatcher
  module AdvCmds
    include Contracts::Core
    C = Contracts

    Contract.override_failure_callback do |data|
      # Stop Exception Failures
      # puts Contract.failure_msg(data)
    end

    Contract C::And[MContracts::NilArgs, MContracts::Arg_m, MContracts::Arg_t] => C::Any
    def self.sysmgr(args)
      args = args.gsub(StaticRegex::WHITESPACE_OMIT_BRACKET_WHITESPACE_CONTENT, "")
      message = StaticRegex::MESSAGE_ARG_QUOTES_CONTAIN_ANY.match(args)[1].gsub(StaticRegex::FIND_QUOTES, "")
      time = StaticRegex::TIME_ARG_INTEGER.match(args)[1]
      Mylib::sysmgr(message, time.to_i)
    end

    # Contract MContracts::NilArgs => C::Any
    # design: getdir requests no arguments
    def self.getdir(args)
      Mylib::getdir()
    end

    Contract C::And[MContracts::NilArgs, MContracts::Arg_watch_mode, MContracts::Arg_file, MContracts::Arg_t] => C::Any
    def self.filewatch(args)
      command, sub_args = ""
      # extract fn, name, dur from command
      args = args.gsub(StaticRegex::WHITESPACE_OMIT_BRACKET_WHITESPACE_CONTENT, "") 
      watch_mode = StaticRegex::WATCH_MODE_ARG.match(args)[1]

      file_names = StaticRegex::FILENAME_ARG_ANY.match(args)[1]
      file_name = StaticRegex::CONTENT_BETWEEN_QUOTES.match(file_names)[2]

      time = StaticRegex::TIME_ARG_INTEGER.match(args)[1]

      if StaticRegex::ACTION_ARG_ANY.match(args)
        action = StaticRegex::ACTION_ARG_ANY.match(args)[1]
        command, sub_args = action.split(" ", 2)
{'fraction_non_alphanumeric': 0.11553544494720966, 'fraction_numerical': 0.005128205128205128, 'mean_word_length': 4.453947368421052, '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': '1773485', 'n_tokens_mistral': 1167, 'n_tokens_neox': 1131, 'n_words': 177}