semvec/pypi-packages huggingface dataset:
buffered-pipe 0.1.0
Buffered pipe through shared memory.
License: MIT
Requires Python: >=3.7.0


# buffered_pipe
Buffered pipe through shared memory.

## core features
- `Pipe`: alias for `Generic_Pipe`
- `Generic_Pipe`: free-length data, bytes or picklable
- `Static_Pipe`: fixed length data, only bytes supported

## install
--------------------
```shell
pip install buffered-pipe
```

## usage
--------------------

- Generic_Pipe
```python
import multiprocessing
import threading

from buffered_pipe import Generic_Pipe


def foo(barrier, pipe_send):
    pipe_send.register()
    barrier.wait()
    pipe_send.send("Hello, world!")


def bar(barrier, pipe_recv):
    pipe_recv.register()
    barrier.wait()
    print(pipe_recv.recv())


if __name__ == "__main__":
    barrier = multiprocessing.Barrier(3)
    pipe_recv, pipe_send = Generic_Pipe(
        buffer_size=2048, duplex=False
    )
    P = multiprocessing.Process(target=foo, args=(barrier, pipe_send))
    T = threading.Thread(target=bar, args=(barrier, pipe_recv))
    P.start()
    T.start()
    barrier.wait()
    P.join()
    T.join()
```

- Static_Pipe
```python
import multiprocessing
import threading

from buffered_pipe import Static_Pipe


def foo(barrier, pipe_send):
    pipe_send.register()
    barrier.wait()
    ret_string = "Hello, world!"
    ret_string = ret_string + " " * (32 - len(ret_string))
    ret_string = ret_string.encode()
    pipe_send.send(ret_string)


def bar(barrier, pipe_recv):
    pipe_recv.register()
    barrier.wait()
    ret_string = pipe_recv.recv()
    print(ret_string.decode())


if __name__ == "__main__":
    barrier = multiprocessing.Barrier(3)
    pipe_recv, pipe_send = Static_Pipe(object_size=32, object_count=16, duplex=False)
    P = multiprocessing.Process(target=foo, args=(barrier, pipe_send))
    T = threading.Thread(target=bar, args=(barrier, pipe_recv))
    P.start()
    T.start()
    barrier.wait()
    P.join()
    T.join()
```

- When you create a `process` or `thread`, call `register` of `Pipe`
- The `buffer_size` of `Generic_Pipe` is in `bytes`.
- The `object_size` of `Static_Pipe` is in `bytes`.
- `object_count` in `Static_Pipe` is the maximum number of objects placed in the buffer.
- `duplex` is equivalent to `multiprocessing.Pipe`.


## tests
--------------
```shell
> benchmark_result.txt
for f in benchmarks/*.py; do python3 "$f" &>> benchmark_result.txt; done
> test_result.txt
for f in tests/*.py; do python3 "$f" &>> test_result.txt; done
```
auto-files-identifier 0.0.3
Automatic File Identifier
License: MIT
Keywords: extensions signatures filehandling file identification

# Automatic File Identifier

A simple program written to identify a file using the extension or using file signatures.  
Failing to do either, implies that the file might be a text file with no signature or extension.

It is not intended to be a final solution that finds everything about a file.  
i.e. the purpose is to provide mimes for popular identifiable formats.

It is to be integrated with another project called Advanced Pattern Finder.

## Installing

```shell
pip install auto-files-identifier
```

Or, clone the repository at https://github.com/supratikchatterjee16/afi, and

```shell
pip install .
```

## Using

There is a signature downloader, which is tailored to download and store information found on [File Signatures](https://filesignatures.net/).  
This creates a python file named signatures.py, which needs to be in the same folder as the program.  
The program imports this and makes use of it.


```python
import afi
list_mime_tuples = afi.identify(path_to_resource)#can be a folder or file path

# The above gives you a list of tuples which contain the mimes for each identified file
# It identifies using both extension and signatures
```

However, there is a second way of making use of it as well.

```shell
afi /path/to/file/or/folder
```

## Author

Supratik Chatterjee

## Issues

There are some(quite a lot I suspect) popular file extensions and signatures missing.  
I believe there are way more than 650 extensions.

Should one find something missing, kindly do let me know.

## Downloading

```bash
mkdir afi
cd ./afi
git init
git remote add origin https://github.com/supratikchatterjee16/afi.git
git pull origin master
pip install .
```