<commit_before>use std::old_io;
use std::iter;
use std::fmt;

use common;
use name::Name;
use attribute::Attribute;
use escape::escape_str;
use common::XmlVersion;
use namespace::{NamespaceStack, NamespaceIterable, UriMapping};

use writer::config::EmitterConfig;

pub enum EmitterErrorKind {
    IoError,
    DocumentStartAlreadyEmitted,
    UnexpectedEvent,
    InvalidWhitespaceEvent
}

pub struct EmitterError {
    kind: EmitterErrorKind,
    message: &'static str,
    cause: Option<old_io::IoError>
}

impl fmt::Show for EmitterError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        try!(write!(f, "Emitter error: {:?}", self.message));
        if self.cause.is_some() {
            write!(f, "; caused by: {:?}", *self.cause.as_ref().unwrap())
        } else {
            Ok(())
        }
    }
}

pub fn error(kind: EmitterErrorKind, message: &'static str) -> EmitterError {
    EmitterError {
        kind: kind,
        message: message,
        cause: None
    }
}

#[inline]
fn io_error(err: old_io::IoError) -> EmitterError {
    EmitterError { kind: EmitterErrorKind::IoError, message: "Input/output error", cause: Some(err) }
}
<commit_msg>Show was renamed to Debug<commit_after>use std::old_io;
use std::iter;
use std::fmt;

use common;
use name::Name;
use attribute::Attribute;
use escape::escape_str;
use common::XmlVersion;
use namespace::{NamespaceStack, NamespaceIterable, UriMapping};

use writer::config::EmitterConfig;

pub enum EmitterErrorKind {
    IoError,
    DocumentStartAlreadyEmitted,
    UnexpectedEvent,
    InvalidWhitespaceEvent
}

pub struct EmitterError {
    kind: EmitterErrorKind,
    message: &'static str,
    cause: Option<old_io::IoError>
}

impl fmt::Debug for EmitterError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        try!(write!(f, "Emitter error: {:?}", self.message));
        if self.cause.is_some() {
            write!(f, "; caused by: {:?}", *self.cause.as_ref().unwrap())
        } else {
            Ok(())
        }
    }
}

pub fn error(kind: EmitterErrorKind, message: &'static str) -> EmitterError {
    EmitterError {
        kind: kind,
        message: message,
        cause: None
    }
}

#[inline]
fn io_error(err: old_io::IoError) -> EmitterError {
    EmitterError { kind: EmitterErrorKind::IoError, message: "Input/output error", cause: Some(err) }
}

{'fraction_non_alphanumeric': 0.14110688635403465, 'fraction_numerical': 0.0, 'mean_word_length': 3.5104761904761905, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4294558', 'n_tokens_mistral': 793, 'n_tokens_neox': 768, 'n_words': 182}