<commit_before>module Vetinari
  # The UserList class holds information about users a Thaum is able to see
  # in channels.
  class UserContainer
    # TODO: Alle methoden in @mutex packen
    attr_reader :users

    def initialize
      @users = Set.new
      @mutex = Mutex.new
    end

    def add(user)
      @mutex.synchronize do
        @users << user
      end
    end

    # TODO
    def remove(user)
      @mutex.synchronize do
        @users.delete(user)
      end
    end

    # Find a User given the nick.
    def [](user_or_nick)
      case user_or_nick
      when User
        user_or_nick if @users.include?(user_or_nick)
      when String
        @users.find do |u|
          u.nick.downcase == user_or_nick.downcase
        end
      end
    end

    def has_user?(user)
      self[user] ? true : false<commit_msg>Synchronized UserContainer methods.<commit_after>module Vetinari
  # The UserList class holds information about users a Thaum is able to see
  # in channels.
  class UserContainer
    attr_reader :users

    def initialize
      @users = Set.new
      @mutex = Mutex.new
    end

    def add(user)
      @mutex.synchronize do
        @users << user
      end
    end

    # TODO
    def remove(user)
      @mutex.synchronize do
        @users.delete(user)
      end
    end

    # Find a User given the nick.
    def [](user_or_nick)
      @mutex.synchronize
        case user_or_nick
        when User
          user_or_nick if @users.include?(user_or_nick)
        when String
          @users.find do |u|
            u.nick.downcase == user_or_nick.downcase
          end
        end
      end
    end

    def has_user?(user)
      @mutex.synchronize
        self[user] ? true : false
      end
{'fraction_non_alphanumeric': 0.06940427993059572, 'fraction_numerical': 0.0, 'mean_word_length': 1.8689883913764511, 'pattern_counts': {'":': 0, '<': 7, '<?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': '2205434', 'n_tokens_mistral': 548, 'n_tokens_neox': 539, 'n_words': 159}