semvec/pypi-packages huggingface dataset:
sine.threads 0.1.7
stoppable and restartable thread simply using an event
License: MIT
Requires Python: >=3.6.0

# Example

```python
from sine.threads import *

def func(stop_event):
	while 1:
		if stop_event.is_set():
			break
		# do your work

thread = StoppableThread(target=func)
thread.start()
# ...
thread.stop(-1) # stop and join forever
# thread.stopped() == True


thread = ReStartableThread(target=func, event_name='stop_event') # can specify the parameter's name
thread.start()
# ...
thread.stop(1) # stop and join for 1 second
# ...
thread.start()
# ...
thread.stop()
thread.join()
# ...
```


# Changelog

## v0.1.7, 2019-2-9
* change to run with python3

## v0.1.6, 2018-10-7

* stop() become stop(timeout=0) to join the thread for convenience
    and return whether it is alive.
* when the event_name is not specified, it is not strict to receive 
    the stop event any more, and it will be added to 'args' 
    so it can be receive by `*args'` or other argument
* add: thread lock


## v0.1.5, 2018-9-11

* fix logic about join(), when directly join() without start() but stop()

## v0.1.4, 2018-6-7

* ReStartableThread support join the old thread instance  
* fix: ReStartableThread.start always creates new instance  
* *improve comment and change to English*  
* *change directory structure and update setup.py*  
* *add tests.py*
sine.event 0.0.2
package description
License: MIT
Requires Python: >=3.6.0

# Class EventManager: 

provide event sending and listening.
use a hashable key to identify an event.

```python
def f(data):
    print data

manager = EventManager()
manager.start() # start listen

manager.addListener(key='evnet_key', listener=f)

manager.sendEvent(key='evnet_key', data={msg:'hello'})


# other methods
manager.removeListener(key='evnet_key', f)
manager.stop() # stop listen
manager.clear() # clear event
```

# Change Log

## v0.0.2, 2018-11-8
* change to run with python3
sine.properties 0.1.1
read/write .properties file in a simple line-oriented format
License: MIT
Requires Python: >=3.6.0

# Brief

read/write .properties file in line-oriented format  
`key=value` per line *through function*.

*the code refers to `java.util.Properties` in Java 1.6.*


# Common Usage

* file I/O:
    ```python
    # input
    properties = load(file)
    # or update existing dictionary
    load(file, properties)
    
    # output
    store(file, properties)
    ```

* custom input:  
    `class LineReader` read in one key-value data. It skips all comment lines,  
    blank lines, leading whitespace, and processes multi-line data.  
    `loadSingle(string)` read each piece of data given above to key-value.  
    ```python
    for line in LineReader(file): # each key-value line has no line seperator
        key, value = loadSingle(line)
        # do something
    ```

* custom output:  
    `storeComments(writable, comments, linesep=os.linesep))`  
    write comment (accept multi-line), can specify the line terminator.  
    `storeSingle(writable, key, value, sep='=', linesep=os.linesep)`  
    write one key-value, can specify the seperator and the line terminator.  
    ```python
    storeComments(file, 'this is a comment')
    storeSingle(file, 'key', 'value')
    ```


# File Format

normally each line is comment line or a key-value pair.

main features:
* seperate key and value by one of `=`, `:`, ` `, `\t`
* ignore whitespaces leading in a line or around `=` or `:`
* comment line begin with `#` or `!`
* escape unicode by `\uxxxx`
* escape special characters by adding `\`

others:
* data line ends with `\` discard the line break

differences with Java:
* store method will not write datetime comment


# Changelog

## v0.1.1, 2019-2-9
* change to run with python3

## v0.1.0, 2018-6-7
* set up.
sine.path 0.1.3
class to join file path in a chain manner
License: MIT
Requires Python: >=3.6.0

# Brief

convenient to join file path in a chain manner:

```python
s = Path('.')
s = s.join('a', 'b').join('..')
# s == 'a'
```

it uses `os.path.join` and always normalizes the path with `os.path.normpath`  
while `os.path.join` join the `'a', '..'` to `'a/..'`


# Change Log

## v0.1.3, 2019-2-9
* change to run with python3

## v0.1.2, 2018-6-7

* *improve comment and change to English*  
* *change directory structure and update setup.py*  
* *add tests.py*