<commit_before># -*- coding: utf-8 -*-

require "mikutwitter/basic"
require "lazy"

module MikuTwitter::Utils

  attr_accessor :twitter_host, :base_path

  EXCLUDE_OPTIONS = [:cache].freeze

  def initialize(*a, &b)
    @twitter_host = 'api.twitter.com'
    @base_path = "http://#{@twitter_host}/1.1".freeze
    super(*a, &b)
  end

  # 連想配列を受け取って、QueryStringを生成して返す
  # ==== Args
  # [args] QueryStringのHash
  # ==== Return
  # URLの?以降のクエリ文字列（"?"含む）。無い場合は空の文字列
  def get_args(args)
    filtered = lazy{ args.select{|k, v| not EXCLUDE_OPTIONS.include? k } }
    if not(args.empty? or filtered.empty?)
      "?" + filtered.map{|pair| "#{URI.encode_www_form_component(pair[0].to_s).to_s}=#{URI.encode_www_form_component(pair[1].to_s).to_s}"}.join('&')
    else
      '' end end
 # !> loading in progress, circular require considered harmful - /home/toshi/Documents/hobby/scripts/mikutter/trunk/core/lib/oauth/client/helper.rb
end
<commit_msg>GETメソッドのAPI（検索など）に特定の文字列が入っていると失敗する問題 refs #552<commit_after># -*- coding: utf-8 -*-

require "mikutwitter/basic"
require "lazy"
require "cgi"

module MikuTwitter::Utils

  attr_accessor :twitter_host, :base_path

  EXCLUDE_OPTIONS = [:cache].freeze

  def initialize(*a, &b)
    @twitter_host = 'api.twitter.com'
    @base_path = "http://#{@twitter_host}/1.1".freeze
    super(*a, &b)
  end

  # 連想配列を受け取って、QueryStringを生成して返す
  # ==== Args
  # [args] QueryStringのHash
  # ==== Return
  # URLの?以降のクエリ文字列（"?"含む）。無い場合は空の文字列
  def get_args(args)
    filtered = lazy{ args.select{|k, v| not EXCLUDE_OPTIONS.include? k } }
    if not(args.empty? or filtered.empty?)
      "?" + filtered.map{|pair| "#{CGI.escape(pair[0].to_s).to_s}=#{CGI.escape(pair[1].to_s).to_s}"}.join('&')
    else
      '' end end
 # !> loading in progress, circular require considered harmful - /home/toshi/Documents/hobby/scripts/mikutter/trunk/core/lib/oauth/client/helper.rb
end

class << CGI
  alias __escape_aoVit97__ escape
  def escape(*args)
    __escape_aoVit97__(*args).gsub(/[*:]/){|m| "%" + m.unpack("H2") }
  end
end

{'fraction_non_alphanumeric': 0.17124631992149167, 'fraction_numerical': 0.008832188420019628, 'mean_word_length': 4.1360201511335015, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4865805', 'n_tokens_mistral': 872, 'n_tokens_neox': 854, 'n_words': 129}