<commit_before>use libc::{c_uint, c_char, c_uchar};
use std::fmt::{Show, Error, Formatter};
use connection::{mpd_connection, MpdConnection, FromConn};
use error::MpdResult;
use std::str::FromStr;

bitflags! {
    #[deriving(Encodable)]
    #[repr(C)]
    flags MpdEvent: c_uint {
        const DATABASE = 0x1,
        const PLAYLIST = 0x2,
        const QUEUE = 0x4,
        const PLAYER = 0x8,
        const MIXER = 0x10,
        const OUTPUT = 0x20,
        const OPTIONS = 0x40,
        const UPDATE = 0x80,
        const STICKER = 0x100,
        const SUBSCRIPTION = 0x200,
        const MESSAGE = 0x400,
    }
}

impl Show for MpdEvent {
    fn fmt(&self, f: &mut Formatter) -> Result<(), Error> {
        try!(f.write(b"MpdEvent("));
        let name = unsafe { mpd_idle_name(*self) };
        try!(if name.is_null() {
            self.bits.fmt(f)
        } else {
            unsafe { String::from_raw_buf(name).fmt(f) }
        })
        try!(f.write(b")"));
        Ok(())
    }
}

impl FromStr for MpdEvent {
    fn from_str(s: &str) -> Option<MpdEvent> {
        let ev = s.with_c_str(|s| unsafe { mpd_idle_name_parse(s) });
        if ev.is_empty() {
            None
        } else {
            Some(ev)
        }<commit_msg>fix typo<commit_after>use libc::{c_uint, c_char, c_uchar};
use std::fmt::{Show, Error, Formatter};
use connection::{mpd_connection, MpdConnection, FromConn};
use error::MpdResult;
use std::str::FromStr;

bitflags! {
    #[deriving(Encodable)]
    #[repr(C)]
    flags MpdEvent: c_uint {
        const DATABASE = 0x1,
        const PLAYLIST = 0x2,
        const QUEUE = 0x4,
        const PLAYER = 0x8,
        const MIXER = 0x10,
        const OUTPUT = 0x20,
        const OPTIONS = 0x40,
        const UPDATE = 0x80,
        const STICKER = 0x100,
        const SUBSCRIPTION = 0x200,
        const MESSAGE = 0x400,
    }
}

impl Show for MpdEvent {
    fn fmt(&self, f: &mut Formatter) -> Result<(), Error> {
        try!(f.write(b"MpdEvent("));
        let name = unsafe { mpd_idle_name(*self) };
        try!(if name.is_null() {
            self.bits.fmt(f)
        } else {
            unsafe { String::from_raw_buf(name).fmt(f) }
        });
        try!(f.write(b")"));
        Ok(())
    }
}

impl FromStr for MpdEvent {
    fn from_str(s: &str) -> Option<MpdEvent> {
        let ev = s.with_c_str(|s| unsafe { mpd_idle_name_parse(s) });
        if ev.is_empty() {
            None
        } else {
            Some(ev)
        }
{'fraction_non_alphanumeric': 0.1401453957996769, 'fraction_numerical': 0.025848142164781908, 'mean_word_length': 2.0885286783042396, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, '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': '3769154', 'n_tokens_mistral': 945, 'n_tokens_neox': 897, 'n_words': 195}