Skip to main content

A python module for modeling and converting salary/income information

Project description

Wage calculator module

Module for salary calculations and conversions

Installation

Use the following command to install the wage module from PyPi with pip:

pip install wage

Or to install the latest version of the repository with pip:

pip install git+https://github.com/miliarch/wage.git

Or you can clone this repository to your system:

git clone https://github.com/miliarch/wage.git

Usage - Salary object

Import the Salary class:

>>> from salary import Salary

Create a new salary object - in this example, base the salary on $15 per hour:

>>> s = Salary(15, 'hour')

Access properties (hourly, daily, etc.) as needed:

>>> s.hourly.decimal
Decimal('15')
>>> s.hourly.dollars
'$15.00'
>>> s.hours_in_year
2080

Help and examples

Help on class Salary in module salary.salary:

class Salary(builtins.object)
 |  Salary(*args, **kwargs)
 |
 |  Class for calculation and conversion of salary by time period
 |
 |  Methods defined here:
 |
 |  __init__(self, *args, **kwargs)
 |      Salary initialization
 |
 |      Arguments:
 |          args[0]: required: salary amount (float)
 |          args[1]: required: salary amount period (string)
 |                   valid options: [hour|day|week|fortnight|month|quarter|semester|year]
 |
 |      Keyword arguments:
 |          kwargs['hours']: custom hours in year (int) (default: 2080)
 |          kwargs['days']: custom days in year (int) (default: 260)
 |          kwargs['weeks']: custom weeks in year (int) (default: 52)
 |          kwargs['fortnights']: custom fortnights in year (int) (default: 26)
 |          kwargs['months']: custom months in year (int) (default: 12)
 |          kwargs['quarters']: custom quarters in year (int) (default: 4)
 |          kwargs['semesters']: custom semesters in year (int) (default: 2)
 |
 |      Examples:
 |          Salary(15, 'hour')
 |          Salary(31200, 'year')
 |          Salary(15, 'hour', hours=1040, days=130, weeks=26)
 |
 |  __repr__(self)
 |      Return repr(self).
 |
 |  __str__(self)
 |      Return str(self).
 |
 |  per_period(self, amount, period, operation=<built-in function truediv>)
 |      Calculate amount per given period using operation callback function
 |
 |      Parameters:
 |          amount: required: the amount to base calculation on (Decimal)
 |          period: required: the period to use for the calculation (str)
 |          operation: optional: which operator to use against (amount, period) (function)
 |
 |  ----------------------------------------------------------------------
 |  Readonly properties defined here:
 |
 |  daily
 |
 |  fortnightly
 |
 |  hourly
 |
 |  monthly
 |
 |  quarterly
 |
 |  semesterly
 |
 |  weekly
 |
 |  yearly
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __dict__
 |      dictionary for instance variables (if defined)
 |
 |  __weakref__
 |      list of weak references to the object (if defined)

Usage - command line interface

The command line interface is mainly for demonstration purposes. If you find it helpful, feel free to use it.

The wage entrypoint uses a similar convention to passing arguments in during a new Salary object instantiation.

Examples:

$ wage 15 hour
Hourly         : $15.00
Daily          : $120.00
Weekly         : $600.00
Fortnightly    : $1,200.00
Monthly        : $2,600.00
Quarterly      : $7,800.00
Semesterly     : $15,600.00
Yearly         : $31,200.00
$ wage 15 hour hours=1500
Hourly         : $15.00
Daily          : $86.54
Weekly         : $432.69
Fortnightly    : $865.38
Monthly        : $1,875.00
Quarterly      : $5,625.00
Semesterly     : $11,250.00
Yearly         : $22,500.00

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

wage-0.6.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

wage-0.6-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file wage-0.6.tar.gz.

File metadata

  • Download URL: wage-0.6.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for wage-0.6.tar.gz
Algorithm Hash digest
SHA256 945c0759d3e95f9831eb38d7330f308663d8099ba9043a2b512b91f31f05b65c
MD5 dae0761bc848366e13a9db5107cc365d
BLAKE2b-256 3cb15a3742055706dbccc3925cda78e3d1bcfcd5e7cadbb8a7a9ff306e259c45

See more details on using hashes here.

File details

Details for the file wage-0.6-py3-none-any.whl.

File metadata

  • Download URL: wage-0.6-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for wage-0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 23a0cec0452ced09118a71ca35f7e73f7eb7d5ef0d017db01c032abe9a0b9818
MD5 3cc3fb7d041066be1f9ddb9c285691b8
BLAKE2b-256 9c5d9934a690b0d673f9bad3607adf1646f7dfd7a3385363f033c413cfbf14ed

See more details on using hashes here.

Supported by

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