<commit_before>import fetch from 'isomorphic-fetch';
import Promise from 'promise';

const API_KEY = '<KEY>';
const API_URL = 'http://api.openweathermap.org/data/2.5/weather';

const kelvinToCelsius = (kelvin) => kelvin - 273.15;

const round = (value, decimals = 1) => {
  const x = Math.pow(10, decimals);
  return Math.round(x * value) / x;
};

export const queryWeather = (city) => {
  return fetch(`${API_URL}?q=${city.trim()}&appid=${API_KEY}`)
    .then(response => {
      if (response.status >= 400) {
        return Promise.reject('Invalid response');
      }

      return response.json();
    })
    .then(json => {
      if (json.cod !== 200) {
        return Promise.reject('Invalid response');
      }

      return {
        temperature: round(kelvinToCelsius(json.main.temp), 1),
        humidity: json.main.humidity,
        icon: json.weather[0].id,
        name: json.name,
        country: json.sys.country.toLowerCase()
      }
    });
};
<commit_msg>Update API key<commit_after>import fetch from 'isomorphic-fetch';
import Promise from 'promise';

const API_KEY = '<KEY>';
const API_URL = 'http://api.openweathermap.org/data/2.5/weather';

const kelvinToCelsius = (kelvin) => kelvin - 273.15;

const round = (value, decimals = 1) => {
  const x = Math.pow(10, decimals);
  return Math.round(x * value) / x;
};

export const queryWeather = (city) => {
  return fetch(`${API_URL}?q=${city.trim()}&appid=${API_KEY}`)
    .then(response => {
      if (response.status >= 400) {
        return Promise.reject('Invalid response');
      }

      return response.json();
    })
    .then(json => {
      if (json.cod !== 200) {
        return Promise.reject('Invalid response');
      }

      return {
        temperature: round(kelvinToCelsius(json.main.temp), 1),
        humidity: json.main.humidity,
        icon: json.weather[0].id,
        name: json.name,
        country: json.sys.country.toLowerCase()
      }
    });
};

{'fraction_non_alphanumeric': 0.16743708269132, 'fraction_numerical': 0.01848998459167951, 'mean_word_length': 2.797270955165692, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, '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': '5058382', 'n_tokens_mistral': 685, 'n_tokens_neox': 644, 'n_words': 134}