<commit_before>module Social
  module Network
    module Graph
      module Vk
        class User < Social::Network::Graph::Vk::Base
          
          FIELDS = 'uid,first_name,last_name,nickname,domain,sex,birthdate,city,country,timezone,photo,photo_medium,photo_big,has_mobile,rate,contacts,education'
          
          def get_info(uids)
            
            params = { "method" => 'getProfiles', "fields" => FIELDS, :uids => Array.wrap(uids).join(",")}
            results = send(:process, params)

            results = results.map { |result|
              result['birthday'] = result['bdate']
              result
            }
            
            return results unless block_given?
            yield(results) if block_given?
          end
          
          def get_friends(uid)
            params = { "method" => 'friends.get', :uid => uid, "fields" => FIELDS}
            result = send(:process_secure, params)

            return result unless block_given?
            yield(result) if block_given?
          end
          
          def balance(uid)
            params = { "method" => 'secure.getBalance', :uid => uid }
            result = send(:process_secure, params)
            result = ((result / 100).to_f.round(2) * root.rate)
            
            return result unless block_given?
            yield(result) if block_given?
          end
          
          def charge_off_balance(uid, balance)
            amount = (((balance).floor / root.rate).to_f.round(2) * 100).round
            params = { "method" => 'secure.withdrawVotes', :uid => uid, :votes => amount }
            result = send(:process_secure, params)
            
            return result unless block_given?
            yield(result) if block_given?
          end

          def get_friends_profiles(uid)
            
            friend_uids = get_friends_uids(uid)
            friend_profiles = friend_uids.map { |uid| get_info(uid) }.flatten.compact
            
            return friend_profiles unless block_given?
            yield(friend_profiles) if block_given?
          end
          
          alias :get_friends_uids :get_friends
          alias :get_friends_info :get_friends_profiles
          
        end
      end
    end
  end
end<commit_msg>add exceptions<commit_after>module Social
  module Network
    module Graph
      module Vk
        class User < Social::Network::Graph::Vk::Base
          
          FIELDS = 'uid,first_name,last_name,nickname,domain,sex,birthdate,city,country,timezone,photo,photo_medium,photo_big,has_mobile,rate,contacts,education'
          
          def get_info(uids)
            uids = Array.wrap(uids)
            throw 'Not give uid for friends request' if uids.empty?
            
            params = { "method" => 'getProfiles', "fields" => FIELDS, :uids => uids.join(",")}
            results = send(:process, params)

            results = results.map { |result|
              result['birthday'] = result['bdate']
              result
            }
            
            return results unless block_given?
            yield(results) if block_given?
          end
          
          def get_friends(uid)
            throw 'Not give uid for friends request' unless uid

            params = { "method" => 'friends.get', :uid => uid, "fields" => FIELDS}
            result = send(:process_secure, params)

            return result unless block_given?
            yield(result) if block_given?
          end
          
          def balance(uid)
            throw 'Not give uid for balance request' unless uid

            params = { "method" => 'secure.getBalance', :uid => uid }
            result = send(:process_secure, params)
            result = ((result / 100).to_f.round(2) * root.rate)
            
            return result unless block_given?
            yield(result) if block_given?
          end
          
          def charge_off_balance(uid, balance)
            amount = (((balance).floor / root.rate.to_f).round(2) * 100).round
            params = { "method" => 'secure.withdrawVotes', :uid => uid, :votes => amount }
            result = send(:process_secure, params)
            
            return result unless block_given?
            yield(result) if block_given?
          end

          def get_friends_profiles(uid)
            
            friend_uids = get_friends_uids(uid)
            friend_profiles = friend_uids.map { |uid| get_info(uid) }.flatten.compact
            
            return friend_profiles unless block_given?
            yield(friend_profiles) if block_given?
          end
          
          alias :get_friends_uids :get_friends
          alias :get_friends_info :get_friends_profiles
          
        end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.09434755200672411, 'fraction_numerical': 0.0033620508510191216, 'mean_word_length': 1.7122507122507122, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 25, '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': '7641301', 'n_tokens_mistral': 1347, 'n_tokens_neox': 1284, 'n_words': 297}