<commit_before>require 'phabricator/conduit_client'

module Phabricator
  class Project
    @@cached_projects = {}

    attr_reader :id, :phid
    attr_accessor :name

    def self.populate_all
      response = client.request(:post, 'project.query')

      response['result']['data'].each do |phid, data|
        project = Project.new(data)
        @@cached_projects[project.name] = project
      end
    end

    def self.find_by_name(name)
      # Re-populate if we couldn't find it in the cache (this applies to
      # if the cache is empty as well).
      populate_all unless @@cached_projects[name]

      @@cached_projects[name]
    end

    def initialize(attributes)
      @id = attributes['id']
      @phid = attributes['phid']
      @name = attributes['name']
    end

    def self.create(name, attrs={})
      binding.pry
      response = client.request(:post, 'project.create', {
        name: name }.merge(attrs))
      data = response['result']

      self.new(data)
    end

    private

    def self.client
      @client ||= Phabricator::ConduitClient.instance
    end
  end<commit_msg>Remove stray binding.pry<commit_after>require 'phabricator/conduit_client'

module Phabricator
  class Project
    @@cached_projects = {}

    attr_reader :id, :phid
    attr_accessor :name

    def self.populate_all
      response = client.request(:post, 'project.query')

      response['result']['data'].each do |phid, data|
        project = Project.new(data)
        @@cached_projects[project.name] = project
      end
    end

    def self.find_by_name(name)
      # Re-populate if we couldn't find it in the cache (this applies to
      # if the cache is empty as well).
      populate_all unless @@cached_projects[name]

      @@cached_projects[name]
    end

    def initialize(attributes)
      @id = attributes['id']
      @phid = attributes['phid']
      @name = attributes['name']
    end

    def self.create(name, attrs={})
      response = client.request(:post, 'project.create', {
        name: name }.merge(attrs))
      data = response['result']

      self.new(data)
    end

    private

    def self.client
      @client ||= Phabricator::ConduitClient.instance
    end
  end
{'fraction_non_alphanumeric': 0.11368804001819009, 'fraction_numerical': 0.0, 'mean_word_length': 2.7037037037037037, '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': '784214', 'n_tokens_mistral': 697, 'n_tokens_neox': 665, 'n_words': 166}