跳转到主要内容

生成票据宇宙的工具集

项目描述

Ticket Universe

CircleCI

用于在Python 3.x中生成唯一票据代码的命令行界面和库。

安装

Ticket Universe可以通过pip安装

pip install ticket-universe

用法

Ticket Universe可以用作库和命令行界面。

命令行界面

ticket universe cli提供了一种生成宇宙并将其写入stdout的方法。

usage: ticket-universe [-h] [--offset OFFSET] [--limit LIMIT]
                       [POSITION [POSITION ...]]

example: ticket-universe fixed:LTFY- alpha numeric numeric numeric

positional arguments:
  POSITION         alpha | alpha:safe_latin | numeric | range:min:max |
                   fixed:{} | binary

optional arguments:
  -h, --help       show this help message and exit
  --offset OFFSET
  --limit LIMIT

from ticket_universe.position import FixedPosition, AlphaPosition, NumericPosition, RangedPosition
from ticket_universe.universe import Universe


standard_universe = Universe([
    FixedPosition('LTFY-'),
    AlphaPosition(),
    NumericPosition(),
    NumericPosition()
])

# ['LTFY-A00', ..., 'LTFY-Z99']
print([t for t in standard_universe])


# Alternate charsets for alpha positions
charset_universe = Universe([AlphaPosition('safe_latin'), AlphaPosition('safe_latin')])
tickets = [t for t in charset_universe]
print('O' in tickets, 'I' in tickets, 'L' in tickets) # False, False, False


# Limited, generate only a part of the universe
limited_universe = Universe([RangedPosition(0, 999)])
print(len([t for t in limited_universe.generate(limit=10, offset=2])) #8

项目详情


下载文件

下载适用于您平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源分布

ticket_universe-0.4.tar.gz (4.6 kB 查看哈希值)

上传时间:

构建分布

ticket_universe-0.4-py3-none-any.whl (7.8 kB 查看哈希值)

上传时间: Python 3

支持者