semvec/pypi-packages huggingface dataset:
lotery-drawer 1.0.1
A simple, proven and non-falsifiable lottery draw tool
Requires Python: >=3.6

# lotery-drawer
Lotery-drawer is a simple, proven and non-falsifiable lottery draw tool.

This tool can be used to draw a lotery in a provable way.
The draw is random but will always return the same result when given the same lotery datas.

## Documentation

### Installation

  * Python >=3.6 is required to run this program
  * Install the package by running : **pip install lotery-drawer --user**

### Usage

You can simply print on the console the result of the lotery :
  * Create your own lotery data json, and place it into the **config** directory for exemple.
  * Call the main file with your json path : **python3 main.py "config/dataLotery.json"**
  * Then the console will output the result


You can also directly interface your program with the library :
```python3
from lotery_drawer import Drawer

drawer = Drawer()
result = drawer.draw(dataLotery)
```

Here an example of the lotery data json :
```json
{
  "endTimestamp": 1589289392,
  "prizes": [
    {"name":  "1000 HXRO", "nb":  1},
    {"name":  "500 HXRO", "nb":  1},
    {"name":  "200 HXRO", "nb":  5},
    {"name":  "100 HXRO", "nb":  10}
  ],
  "tickets": {
    "player_a": 10,
    "player_b": 20,
    "player_c": 30,
    "player_d": 40,
    "player_e": 150
  }
}
```
  * **endTimestamp**: The end date of the lotery. It is only used to generate a seed for random functions
  * **prizes**: A list of the prizes of the lotery. Each prize can have one or more winning tickets (**nb**) and have a name (**name**)
  * **tickets**: A dict of the tickets at the end of the lotery. Each element of the dict is a player, the number associated is the number of tickets in his possession.

The tool will draw as winning tickets as there is prizes, and return an array containing the usernames and the prizes won.
Note that if a ticket is won, it is removed from the tickets list for the next prizes.

Here an exemple of the result when using the file **config/dataLotery.json** in the repository :
```json
[
  {"prizeName": "1000 HXRO", "username": "player_e"}, 
  {"prizeName": "500 HXRO", "username": "player_a"}, 
  {"prizeName": "200 HXRO", "username": "player_e"}, 
  {"prizeName": "200 HXRO", "username": "player_e"}, 
  {"prizeName": "200 HXRO", "username": "player_e"}, 
  {"prizeName": "200 HXRO", "username": "player_e"}, 
  {"prizeName": "200 HXRO", "username": "player_d"}, 
  {"prizeName": "100 HXRO", "username": "player_d"}, 
  {"prizeName": "100 HXRO", "username": "player_e"}, 
  {"prizeName": "100 HXRO", "username": "player_d"}, 
  {"prizeName": "100 HXRO", "username": "player_d"}, 
  {"prizeName": "100 HXRO", "username": "player_b"}, 
  {"prizeName": "100 HXRO", "username": "player_e"}, 
  {"prizeName": "100 HXRO", "username": "player_e"}, 
  {"prizeName": "100 HXRO", "username": "player_c"}, 
  {"prizeName": "100 HXRO", "username": "player_c"}, 
  {"prizeName": "100 HXRO", "username": "player_d"}
 ]
```
iglu-client 0.2.0
A python client for retrieving Iglu schemas and validating self-describing JSON
Requires Python: >=3.6

# Python client for Iglu [![Travis-CI Build Status](https://travis-ci.com/jbwyme/iglu-python-client.svg?branch=master&status=passed)](https://travis-ci.com/github/jbwyme/iglu-python-client)



A Python client and resolver for **[Iglu schema repositories][iglu-wiki]**

# Installation
`pip install iglu_client`

# Usage

```py
import json
import jsonschema

from iglu_client import SchemaResolver, SelfDescribingJson

resolver_conf = """
{
    "schema": "iglu:com.snowplowanalytics.iglu/resolver-config/jsonschema/1-0-2",
    "data": {
        "cacheSize": 500,
        "repositories": [
            {
                "name": "My Private Repo",
                "priority": 0,
                "vendorPrefixes": ["com.mycompany"],
                "connection": {"http": {"uri": "http://myprivaterepo.com", "apikey": "api-key"}}
            },
            {
                "name": "Iglu Central",
                "priority": 1,
                "vendorPrefixes": ["com.snowplowanalytics.snowplow"],
                "connection": {"http": {"uri": "http://iglucentral.com"}}
            }
        ]
    }
}
"""
resolver = SchemaResolver.parse(resolver_conf)

# Retrieve a schema
schema = resolver.lookup_schema("iglu:com.snowplowanalytics.snowplow/link_click/jsonschema/1-0-0")
print("schema: %s" % schema)


# Validate a self-describing JSON
event = """
{
    "schema": "iglu:com.snowplowanalytics.snowplow/link_click/jsonschema/1-0-0",
    "data": {
        "targetUrl": "https://mixpanel.com"
    }
}
"""
data = SelfDescribingJson.parse(event)
try:
    data.validate(resolver) # will throw an exception if the event is invalid
    print("event is valid")
except jsonschema.exceptions.ValidationError as e:
    print("event is invalid")

if data.valid(resolver): # will return True or False
    print("event is valid")
else:
    print("event is invalid")

```