Thanks to visit codestin.com
Credit goes to github.com

Skip to content

mishka-scan/python_sno

 
 

Repository files navigation

Python Sno implementation

A python implementation of the Sno ID format.

This project is experimental - be careful!

This project is a fork of python_xid, with modifications to make it a sno rather than an xid implementation.

Installation

Currently this package is not available on pypi, however, you can install it from git, e.g.

pip install -e git+https://github.com/mishka-scan/python_sno.git@master

Usage

from sno import Sno

>>> Sno.new()
<Sno '7f48ri5q25rum222'>

>>> str(Sno.new())
'7f48ri5q25rum222'

>>> Sno.from_string('7f48ri5q25rum222').datetime
datetime.datetime(2021, 10, 11, 15, 45, 43, 152000)

See the Sno class in sno.py for all interface methods.

Special notes on this implementation

Tick-tocking

The tick-tocking bit is always 0 in this implementation

Partitions

The partition is set to be the process id (via os.getpid())

TODO:

  • Investigate supporting tick-tocking from Sno (currently this bit is always 0)
  • Support setting the partition

Licenses

All source code is licensed under the MIT License.

About

Python Xid Implementation

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%