This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Purpose

A small library for generating a human readable string value from a number with an arbitrary base. The number is represented by five elements:

  • a sign

    -1, 1, or 0 as appropriate

  • an integer part

    a list of non-negative ints, where each element is less than the base value

  • a non repeating fractional part

    a list of non-negative ints, where each element is less than the base value

  • a repeating fractional part

    a list of non-negative ints, where each element is less than the base value

  • a base

    the base of the number, must be an integer greater than 1.

Usage

>>> from justbases_string import *
>>> xformer = String(DisplayConfig(), 2)
>>> xformer.xform(-1, [1, 0, 1], [], [1, 0], 0)
'-101.(10)_2'
>>> xformer.xform(0, [], [0, 0], [], 0)
'0_2'

An exception is raised if the parts of the number do not conform to the necessary constraints:

>>> xformer.xform(1, [2], [0, 0], [], 0)
Traceback (most recent call last):
...

>>> xformer.xform(1, [-1], [0, 0], [], 0)
Traceback (most recent call last):
...

There are numerous options for configuring the string result:

>>> digits_config = DigitsConfig(use_letters=False)
>>> xformer = String(DisplayConfig(digits_config=digits_config), 1024)
>>> xformer.xform(1, [2], [2, 4, 256], [], 0)
'2.2~4~256_1024'

>>> digits_config = DigitsConfig(use_caps=True)
>>> xformer = String(DisplayConfig(digits_config=digits_config), 16)
>>> xformer.xform(1, [], [0, 13], [], 0)
'0.0D_16'

The final argument is the relation of the value being displayed to the value it represents:

>>> xformer.xform(1, [2], [2, 4, 256], [], Fraction(1, 3))
'< 2.2~4~256_1024'
Release History

Release History

0.1

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
justbases-string-0.1.tar.gz (14.3 kB) Copy SHA256 Checksum SHA256 Source Sep 2, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting