<commit_before>extern crate serde_yaml;
extern crate serde;
#[macro_use]
extern crate serde_derive;

#[macro_use]
extern crate slog;
extern crate slog_scope;
extern crate slog_html;
extern crate slog_journald;
extern crate slog_stdlog;
extern crate slog_stream;
extern crate slog_term;

extern crate wlc;
#[macro_use]
extern crate fireplace_lib;

use fireplace_lib::callback::IntoCallback;
use fireplace_lib::handlers::*;
use fireplace_lib::handlers::keyboard::KeyHandler;

use std::env;
use std::fs::OpenOptions;
use std::path::PathBuf;
use std::process::Command;

use wlc::{Callback, View};

mod logger;
mod config;
pub use self::config::Config;

fn try_config_locations(paths: &[PathBuf]) -> Config {
    for path in paths {
        if path.exists() {
            return serde_yaml::from_reader(OpenOptions::new()
                    .read(true)
                    .open(path)
                    .unwrap())
                .expect("Malformed config file");
        }
    }
    serde_yaml::from_str("").unwrap()
}

fn main() {

    // Parse configuration
    let mut locations = Vec::new();
    if let Ok(xdg_dir) = env::var("XDG_CONFIG_DIR") {
        locations.push(PathBuf::from(&xdg_dir).join("fireplace").join(".fireplace.yaml"));
        locations.push(PathBuf::from(&xdg_dir).join("fireplace").join("fireplace.yaml"));
        locations.push(PathBuf::from(&xdg_dir).join(".fireplace.yaml"));
        locations.push(PathBuf::from(&xdg_dir).join("fireplace.yaml"));
    }
    if let Some(home_dir) = env::home_dir() {
        locations.push(PathBuf::from(&home_dir).join(".config").join("fireplace").join(".fireplace.yaml"));
        locations.push(PathBuf::from(&home_dir).join(".config").join("fireplace").join("fireplace.yaml"));<commit_msg>Fix default config<commit_after>extern crate serde_yaml;
extern crate serde;
#[macro_use]
extern crate serde_derive;

#[macro_use]
extern crate slog;
extern crate slog_scope;
extern crate slog_html;
extern crate slog_journald;
extern crate slog_stdlog;
extern crate slog_stream;
extern crate slog_term;

extern crate wlc;
#[macro_use]
extern crate fireplace_lib;

use fireplace_lib::callback::IntoCallback;
use fireplace_lib::handlers::*;
use fireplace_lib::handlers::keyboard::KeyHandler;

use std::env;
use std::fs::OpenOptions;
use std::path::PathBuf;
use std::process::Command;

use wlc::{Callback, View};

mod logger;
mod config;
pub use self::config::Config;

fn try_config_locations(paths: &[PathBuf]) -> Config {
    for path in paths {
        if path.exists() {
            return serde_yaml::from_reader(OpenOptions::new()
                    .read(true)
                    .open(path)
                    .unwrap())
                .expect("Malformed config file");
        }
    }
    Config::default()
}

fn main() {

    // Parse configuration
    let mut locations = Vec::new();
    if let Ok(xdg_dir) = env::var("XDG_CONFIG_DIR") {
        locations.push(PathBuf::from(&xdg_dir).join("fireplace").join(".fireplace.yaml"));
        locations.push(PathBuf::from(&xdg_dir).join("fireplace").join("fireplace.yaml"));
        locations.push(PathBuf::from(&xdg_dir).join(".fireplace.yaml"));
        locations.push(PathBuf::from(&xdg_dir).join("fireplace.yaml"));
    }
    if let Some(home_dir) = env::home_dir() {
        locations.push(PathBuf::from(&home_dir).join(".config").join("fireplace").join(".fireplace.yaml"));
        locations.push(PathBuf::from(&home_dir).join(".config").join("fireplace").join("fireplace.yaml"));
{'fraction_non_alphanumeric': 0.1570815450643777, 'fraction_numerical': 0.0, 'mean_word_length': 3.994285714285714, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '6097060', 'n_tokens_mistral': 1143, 'n_tokens_neox': 1089, 'n_words': 209}