<commit_before># PyEventEmitter

Python events library.

# How to use

The library provides an EventEmitter class.
This class let you bind listeners to events and trigger events.

```python
import py_event_emitter.events as events

em = events.EventEmitter()

def hello(who):
    print('Hello {}'.format(who))

em.on('hello', hello)
em.emit('hello', who='World')  # prints Hello World
```

You can also use `on` decorator :

```python
import py_event_emitter.events as events

em = events.EventEmitter()

@events.on(emitter=em, event='hello')
def hello(who):
    print('Hello {}'.format(who))

em.emit('hello', who='World')  # prints Hello World
```

Using `once` instead of `on` may be usefull if you want your listener to be called once :

```python
import py_event_emitter.events as events

em = events.EventEmitter()

def hello(who):
    print('Hello {}'.format(who))

em.once('hello', hello)
em.emit('hello', who='World')  # prints Hello World
em.emit('hello', who='World')  # nothing happens
```
<commit_msg>add installation section to README.md<commit_after># PyEventEmitter

Python events library.

# Installation

    $ pip install PyEventEmitter

# How to use

The library provides an EventEmitter class.
This class let you bind listeners to events and trigger events.

```python
import py_event_emitter.events as events

em = events.EventEmitter()

def hello(who):
    print('Hello {}'.format(who))

em.on('hello', hello)
em.emit('hello', who='World')  # prints Hello World
```

You can also use `on` decorator :

```python
import py_event_emitter.events as events

em = events.EventEmitter()

@events.on(emitter=em, event='hello')
def hello(who):
    print('Hello {}'.format(who))

em.emit('hello', who='World')  # prints Hello World
```

Using `once` instead of `on` may be usefull if you want your listener to be called once :

```python
import py_event_emitter.events as events

em = events.EventEmitter()

def hello(who):
    print('Hello {}'.format(who))

em.once('hello', hello)
em.emit('hello', who='World')  # prints Hello World
em.emit('hello', who='World')  # nothing happens
```

{'fraction_non_alphanumeric': 0.14034253092293053, 'fraction_numerical': 0.0, 'mean_word_length': 4.841666666666667, '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': '4566351', 'n_tokens_mistral': 684, 'n_tokens_neox': 663, 'n_words': 220}