Skip to main content

A light library to use Guzi in python application

Project description

python-guzi

A library to use Guzi in Python applications

Run tests

python -m unittest

Usage

Class User contains every Guzi relative information a user would need : - guzi wallet - guza waller - total accumulated - balance

For now, a Guzi (and a Guza) is just a string, an identifier defining what it is. So it has no dedicated class. Maybe it will, but for now, nope.

Example of use :

from datetime import date
from guzi.models import User

# Create users
user1 = User("unique_id1", birthdate=date(1989, 11, 28))
user2 = User("unique_id2", birthdate=date(1998, 9, 5))

# create their Guzis (it's like having a new day)
for i in range(1, 10):
    user1.create_daily_guzis(date(2020, 4, i))

# Then make them spend between each other
user1.spend_to(user2, 3)
user1.spend_to(user2, 2)

Class Company contains every Guzi relative information a company would need : - guza_wallet

A Company has also an engaged strategy. An engaged User can be a paid employee or some kind of shareholder. When a User is engaged to a Company for a number of times (for example User1 engaged 4 times), it means that 4 of the Guzis the Company will get paid with will go to this User.

An engaged User is different of a founder User : founder User only get paid when all engaged Users have been fully paid. Founder only get the profit.

For example, an employee in the company would be engaged and would get his or her salary every month. He or she could aslo be part of the founders and then, if the company earns more than necessary to pay salaries, the bonus (the profit) would go to this salaried too.

Usage:

from datetime import date
from guzi.models import User, Company, DefaultEngagedStrategy

# Create users
user1 = User("unique_id1", birthdate=date(1989, 11, 28))
user2 = User("unique_id2", birthdate=date(1998, 9, 5))

# Create company
founders = [user1, user2]
company = Company("unique_id", founders)

# Create users Guzas
for i in range(1, 10):
    user1.create_daily_guzis(date(2020, 4, i))
    user2.create_daily_guzis(date(2020, 4, i))

# Users can give Guzas to the company
user1.give_guzas_to(company, 3)
user2.give_guzas_to(company, 9)

# Then company can spend those Guzas, for example to buy something to user1
# who could sell something usefull for the company
company.spend_to(user1, 6)
user1.check_balance()
assert(len(user1.total_accumulated) == 6-3)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python-guzi-0.1.2.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_guzi-0.1.2-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file python-guzi-0.1.2.tar.gz.

File metadata

  • Download URL: python-guzi-0.1.2.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.6

File hashes

Hashes for python-guzi-0.1.2.tar.gz
Algorithm Hash digest
SHA256 4d4deb68c515f76b1f4555cb62185c4239d62e83a925ec4ec5c22a1c9bda7821
MD5 7cd1cbf988c2cfd75006186bb3a19d34
BLAKE2b-256 da962e484707c23e5c069de69cfbb8e04562937d83b17996c531b6c4d4ab8886

See more details on using hashes here.

File details

Details for the file python_guzi-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: python_guzi-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.6

File hashes

Hashes for python_guzi-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 02c892f0512f4be11bf040a064c4a0938758a45492b8d7117848c14ebcd71042
MD5 565ae9ef8e8c6f571f639416b1536e20
BLAKE2b-256 d4ca3561c37cb823ec240013470ec42c9d9863fa69c3fba7faadd67d2de772c1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page