Skip to main content

Convert building floor numbering to start from 0 — because arrays start at zero

Project description

level-zero

Convert building floor numbering to start from 0 — because arrays start at zero.

Supports US, UK, European, Japanese, Chinese, and Indian floor systems.

Installation

pip install level-zero

Usage

from level_zero import convert, FloorSystem, Building

# Quick conversions
convert("3", FloorSystem.US, FloorSystem.ZERO)        # "2"
convert("G", FloorSystem.UK, FloorSystem.ZERO)         # "0"
convert("5F", FloorSystem.JAPAN, FloorSystem.ZERO)      # "4"
convert("2", FloorSystem.ZERO, FloorSystem.US)          # "3"

# Shorthand helpers
from level_zero.converter import us_to_zero, zero_to_us
us_to_zero(3)    # 2
zero_to_us(0)    # 1

# Full building conversion table
b = Building(name="Empire State", system=FloorSystem.US, total_floors=102, basements=2)
print(b.mapping_table())
print(b.to_zero("13"))   # handles skipped floors
print(b.from_zero("0"))  # "1"

CLI

level-zero convert 3 --from us --to zero
level-zero convert G --from uk --to us
level-zero building --name "Tokyo Tower" --system japan --floors 20 --basements 3
level-zero systems

Why?

Because elevator[0] should be the ground floor.

License

MIT

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

level_zero-0.1.0.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

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

level_zero-0.1.0-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file level_zero-0.1.0.tar.gz.

File metadata

  • Download URL: level_zero-0.1.0.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for level_zero-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ea9f155136fc129ee96bd62885a298bb915d40097a0144991602a36b85f33dab
MD5 3975ddfaf197715e53c56368e8868536
BLAKE2b-256 8dc96c64f6ca18336274be4dd186b590f77ec416be72aaffcccbe7522f6e855e

See more details on using hashes here.

File details

Details for the file level_zero-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: level_zero-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for level_zero-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9901e01e347ca41ff3136064126b833460d2a702d4fd432b2bfc0114f41470e5
MD5 3da65f78ef05d356a9694383e4ebdf8a
BLAKE2b-256 d45c319192cbe49e87553ff55f79977b9ae8d2eb9dd856da935baa951cb16e2a

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