<commit_before>module Wordpressto
  require "xmlrpc/client"
  require 'uri'
  require 'mime/types'
  
  class WordpressBlog
    attr_accessor :url, :username, :password, :blog_id

    def initialize(options = { })
      @username = options[:username] if options[:username]
      @password = options[:password] if options[:password]
      @blog_id = options[:blog_id] || 1
      @url = options[:url] if options[:url]
    end
    
    def posts
      @post_collection ||= WordpressPostCollection.new(:conn => self)
    end
    
    def attachments
      @attachments ||= WordpressAttachmentCollection.new(:conn => self)
    end
    
    def get_recent_posts(limit = 10)
      call('metaWeblog.getRecentPosts', blog_id, username, password, limit)
    end

    def get_post(qid)
      call('metaWeblog.getPost', qid, username, password)
    end
    
    def edit_post(qid, attributes, published = nil)
      cargs = ['metaWeblog.editPost', qid, username, password, attributes]
      cargs << published if published
      call(*cargs)
    end
    
    def new_post(attributes, published = nil)
      cargs = ['metaWeblog.newPost', blog_id, username, password, attributes]
      cargs << published if published
      call(*cargs)
    end
    
    def upload_file(name, mimetype, bits, overwrite = false)
      call('wp.uploadFile', blog_id, username, password, 
           { :name => name, :type => mimetype, :bits => XMLRPC::Base64.new(bits), :overwrite => overwrite })
    end

    private 
    
    def call(*args)
      xmlrpc.call(*args)
    end
    
    def xmlrpc
      @xclient ||= XMLRPC::Client.new2(url)
    end
    
  end
  
<commit_msg>fixed edit_post and new_post with published = false<commit_after>module Wordpressto
  require "xmlrpc/client"
  require 'uri'
  require 'mime/types'
  
  class WordpressBlog
    attr_accessor :url, :username, :password, :blog_id

    def initialize(options = { })
      @username = options[:username] if options[:username]
      @password = options[:password] if options[:password]
      @blog_id = options[:blog_id] || 1
      @url = options[:url] if options[:url]
    end
    
    def posts
      @post_collection ||= WordpressPostCollection.new(:conn => self)
    end
    
    def attachments
      @attachments ||= WordpressAttachmentCollection.new(:conn => self)
    end
    
    def get_recent_posts(limit = 10)
      call('metaWeblog.getRecentPosts', blog_id, username, password, limit)
    end

    def get_post(qid)
      call('metaWeblog.getPost', qid, username, password)
    end
    
    def edit_post(qid, attributes, published = nil)
      cargs = ['metaWeblog.editPost', qid, username, password, attributes]
      cargs << published unless published.nil?
      call(*cargs)
    end
    
    def new_post(attributes, published = nil)
      cargs = ['metaWeblog.newPost', blog_id, username, password, attributes]
      cargs << published unless published.nil?
      call(*cargs)
    end
    
    def upload_file(name, mimetype, bits, overwrite = false)
      call('wp.uploadFile', blog_id, username, password, 
           { :name => name, :type => mimetype, :bits => XMLRPC::Base64.new(bits), :overwrite => overwrite })
    end

    private 
    
    def call(*args)
      xmlrpc.call(*args)
    end
    
    def xmlrpc
      @xclient ||= XMLRPC::Client.new2(url)
    end
    
  end
  

{'fraction_non_alphanumeric': 0.11400359066427289, 'fraction_numerical': 0.003590664272890485, 'mean_word_length': 2.842528735632184, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, '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': '6494685', 'n_tokens_mistral': 1062, 'n_tokens_neox': 1025, 'n_words': 254}