semvec/pypi-packages huggingface dataset:
django-simple-redirects 2.1.0
django.contrib.redirects without django.contrib.sites
License: MIT
Requires Python: >=3.8

=======================
django-simple-redirects
=======================

.. image:: https://github.com/feinheit/django-simple-redirects/actions/workflows/tests.yml/badge.svg
    :target: https://github.com/feinheit/django-simple-redirects/
    :alt: CI Status

``django.contrib.redirects`` without a ``django.contrib.sites`` dependency.

Usage:
======

- Add ``simple_redirects`` to ``INSTALLED_APPS``
- Run ``./manage.py migrate``
- Add ``simple_redirects.middleware.RedirectFallbackMiddleware`` to
  ``MIDDLEWARE``
cosmian-lib-sgx 0.2.1
Python library for code providers using Cosmian Secure Computation
License: MIT

# Cosmian lib SGX

## Overview

Python library for code providers using [Cosmian Secure Computation](https://cosmian.com/secure-computation/).

## Example

A simple structure of the code should look like:

```console
$ tree .
.
├── secret_mod.py
└── run.py
```

where `run.py` is called the entrypoint and is the only file which can't be encrypted.

The goal of the entrypoint is to manage the I/O of you program whereas other module can hide the Python code you want to keep secret.

Here is an example of a statistical mean code where:

- Code Provider hides the whole module `secret_mod` which is decrypted in the SGX enclave
- Data Providers send bytes of an arbitrary long integer in big-endian as data input for the Code Provider
- Result Consumers receive bytes of the statistical mean of all input datas represented as IEEE 754 binary64

```python
"""run module."""

from io import BytesIO
import struct
from typing import Iterator

from cosmian_lib_sgx import Enclave


def convert_input(datas: Iterator[BytesIO]) -> Iterator[int]:
    """Transform input data bytes to integer."""
    for data in datas:  # type: BytesIO
        yield int.from_bytes(data.read(), byteorder="big")


def main() -> int:
    """Entrypoint of your code."""
    with Enclave() as enclave:
        # import your ciphered module normally
        import secret_mod

        # convert input data bytes sent by Data Providers
        datas: Iterator[int] = convert_input(enclave.read())

        # apply function of your module on datas
        output: float = secret_mod.custom_mean(datas)

        # convert output result
        result: bytes = struct.pack("d", output)

        # write result for Result Consumers
        enclave.write(result)

    return 0


if __name__ == "__main__":
    main()
```

```python
"""secret_mod module."""

from typing import Iterator


def custom_mean(input_datas: Iterator[int]) -> float:
    """Statistical mean of input datas."""
    n: int = 0
    mean: float = 0.0

    for x in input_datas:  # type: int
        n += 1
        mean += (x - mean) / n
    
    return mean if n > 0 else float("nan")
```
AutomaticDemuxer 1.34
Automatically Demux tracks from media-files
License: MIT
Keywords: AutomaticDemuxer

# Automatic Demuxer

Package to demux media-files into single file formats to be used elsewhere.

*Video tracks are only supported currently*

Developed by Jessie Wilson (2022)

## Install

`pip install AutomaticDemuxer`

**If using Linux you must also install MediaInfo**

`sudo apt install mediainfo`

## Uninstall

`pip uninstall AutomaticDemuxer`

## Examples of How To Use

**Video: Example with callback**

```python
from automatic_demuxer import AutoDemuxer


def callback_func(x):
    """
    AutoDemuxer will return a dictionary with keys 'output' and 'percent'
    "output" will always display the ffmpeg command line output
    "percent" will return None if there is no track duration OR when the job hasn't fully started/is finished
    "job_pid" will return a pathlike/string of the full path of the output filename
    """
    print(x["output"])
    print(x["percent"])
    print(x["job_pid"])

    # check if x["percent"] is not none before using output
    if x["percent"]:
        print(f"do something with {str(x['percent'])}")


demux = AutoDemuxer()
demux.video_demux(file_input=r"fileinput.mkv", callback=callback_func)
```

\
**Video: Example without callback**

When not using callback the FFMPEG output is automatically printed to console in the format of a string.
This does not include percentage.

```python
from automatic_demuxer import AutoDemuxer

demux = AutoDemuxer()
demux.video_demux(file_input=r"fileinput.mkv")
```

\
**Video: Return status**

```python
from automatic_demuxer import AutoDemuxer

demux = AutoDemuxer()
demux.video_demux(file_input=r"fileinput.mkv")

# To print the return code
print(demux.status["return_code"])

# To print the output file name
print(demux.status["output_filename"])

# To print a completed status (completed internally by checking the output path name and getting a return code of 0)
# This will return "Ok" or "Error"
print(demux.status["status"])
```

## Video Parameters

`file_input` String or Pathlike path to input file.

`ffmpeg_path` String or Pathlike path to ffmpeg.\
*Optional: Will raise an error if not found on path or defined*

`track_number` Track number based off of ffmpeg stream selection or mediainfo's 'Stream identifier'.\
*Optional: Defaults to 0*

`suffix` String to define the output ending suffix.\
*Optional: Defaults to "\_out\_"*

`insert_delay` Bool to insert delay string into filename output if delay is detected.\
*Optional: Defaults to True*

`video_output_extension` The output extension in the form of a string. e.g. "mkv" or ".mkv"\
*Optional: Defaults to "mkv"*

`callback` Log callback progress to a variable instead of printing to console\
*Optional: Defaults to None*

`fallback_ext` Extension in the form of a string. e.g. "mkv" or "mp4". Default is "mkv", if changed the program will
fall back to what ever extension is selected\
*Optional: Defaults to "mkv"*