<commit_before>import sys
import time
try:
    import exceptions
except ImportError: # Python 3
    import builtins as exceptions

from robot import utils

from objecttoreturn import ObjectToReturn


class ExampleLibrary:

    def print_(self, msg, stream='stdout'):
        """Print given message to selected stream (stdout or stderr)"""
        out_stream = getattr(sys, stream)
        out_stream.write(msg)

    def print_n_times(self, msg, count, delay=0):
        """Print given message n times"""
        for i in range(int(count)):
            print msg
            self._sleep(delay)

    def print_many(self, *msgs):
        """Print given messages"""
        for msg in msgs:
            print msg,
        print

    def print_to_stdout_and_stderr(self, msg):
        sys.stdout.write('stdout: ' + msg)
        sys.stderr.write('stderr: ' + msg)

    def print_to_python_and_java_streams(self):
        import ExampleJavaLibrary
        print '*INFO* First message to Python'
        getattr(ExampleJavaLibrary(), 'print')('*INFO* Second message to Java')
        print '*INFO* Last message to Python'

    def single_line_doc(self):
        """One line keyword documentation."""
        pass

    def multi_line_doc(self):
        """Only the first line of a multi line keyword doc should be logged.

        Thus for example this text here should not be there
        and neither should this.
        """
        pass

    def exception(self, name, msg=""):
        """Raise exception with given name and message"""
        exception = getattr(exceptions, name)
        raise exception, msg

    def external_exception(self, name, msg):
        ObjectToReturn('failure').exception(name, msg)

    def return_string_from_library(self,string='This is a string from Library'):
        return string

    def return_list_from_library(self, *args):
        return list(args)<commit_msg>[python3] atest: ExampleLibrary: Made .print_() and .exception() Python 3 compatible.<commit_after>import sys
import time
try:
    import exceptions
except ImportError: # Python 3
    import builtins as exceptions

from robot import utils

from objecttoreturn import ObjectToReturn


class ExampleLibrary:

    def print_(self, msg, stream='stdout'):
        """Print given message to selected stream (stdout or stderr)"""
        out_stream = getattr(sys, stream)
        out_stream.write(unicode(msg))

    def print_n_times(self, msg, count, delay=0):
        """Print given message n times"""
        for i in range(int(count)):
            print msg
            self._sleep(delay)

    def print_many(self, *msgs):
        """Print given messages"""
        for msg in msgs:
            print msg,
        print

    def print_to_stdout_and_stderr(self, msg):
        sys.stdout.write('stdout: ' + msg)
        sys.stderr.write('stderr: ' + msg)

    def print_to_python_and_java_streams(self):
        import ExampleJavaLibrary
        print '*INFO* First message to Python'
        getattr(ExampleJavaLibrary(), 'print')('*INFO* Second message to Java')
        print '*INFO* Last message to Python'

    def single_line_doc(self):
        """One line keyword documentation."""
        pass

    def multi_line_doc(self):
        """Only the first line of a multi line keyword doc should be logged.

        Thus for example this text here should not be there
        and neither should this.
        """
        pass

    def exception(self, name, msg=""):
        """Raise exception with given name and message"""
        exception = getattr(exceptions, name)
        if msg is None:
            raise exception
        raise exception, msg

    def external_exception(self, name, msg):
        ObjectToReturn('failure').exception(name, msg)

    def return_string_from_library(self,string='This is a string from Library'):
        return string

    def return_list_from_library(self, *args):
        return list(args)
{'fraction_non_alphanumeric': 0.09278613306143257, 'fraction_numerical': 0.0015294417537598777, 'mean_word_length': 2.691439322671684, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6336789', 'n_tokens_mistral': 1073, 'n_tokens_neox': 1038, 'n_words': 364}