Generate unique identifiers only using emojis
Project description
IDoji
What if you could combine the magical fun of emojis and the unique uniqueness power of UUIDs.
What if you had a format to label objects, so powerful and elegant, that you enjoy sending those over your favorite messenger.
What if you had a small python package, providing you all of that and much more.
Welcome to IDoji.
Installation
Installation can be done via pip
pip3 install idoji
Usage
IDoji can be used as a superior alternative to UUIDs. Common functionality provided by UUIDs can be found in IDojis, as well as facilities to mix both types or convert between them.
Instantiate them
It is possible to instantiate a completely random IDoji as well as using values
of the type str
, int
or even UUID
.
>>> from idoji import IDoji
>>> idoj = IDoji()
>>> print(idoj)
๐ฆ๐ฆ๐๐
-๐ฅฝ๐ฆ-๐๐ฆฉ-๐ฅณ๐ฅฑ-๐ง๐ฅ-๐คญ๐ฆ๐ฆฒ๐
It is also possible to use existing UUIDs in several forms.
>>> from uuid import uuid4
>>> uuidval = uuid4()
>>> print(uuidval)
e4f4d80c-01f4-4504-b18b-6061bb619aa3
>>> idoj_from_uuid = IDoji(uuidval)
>>> print(idoj_from_uuid)
๐ฆณ๐ง๐ฆง๐-๐๐ง-๐
๐-๐ฆ๐ฅ-๐ค๐ค-๐ฆ๐ค๐ฅจ๐ฅฑ
>>> repr(idoj_from_uuid)
"IDoji('e4f4d80c-01f4-4504-b18b-6061bb619aa3')"
>>> idoj_from_uuid_str = IDoji("e4f4d80c-01f4-4504-b18b-6061bb619aa3")
>>> print(idoj_from_uuid_str)
๐ฆณ๐ง๐ฆง๐-๐๐ง-๐
๐-๐ฆ๐ฅ-๐ค๐ค-๐ฆ๐ค๐ฅจ๐ฅฑ
And of course, if you get an IDoji string from somewhere, you can use that to instantiate an object as well.
>>> idoj = IDoji("๐ฆณ๐ง๐ฆง๐-๐๐ง-๐
๐-๐ฆ๐ฅ-๐ค๐ค-๐ฆ๐ค๐ฅจ๐ฅฑ")
>>> print(idoj)
๐ฆณ๐ง๐ฆง๐-๐๐ง-๐
๐-๐ฆ๐ฅ-๐ค๐ค-๐ฆ๐ค๐ฅจ๐ฅฑ
>>> repr(idoj)
"IDoji('e4f4d80c-01f4-4504-b18b-6061bb619aa3')"
Compare them
IDojis can be compared against each other as well as UUIDs.
Comparison against IDoji objects as well as their string representation is available.
>>> idoj = IDoji()
>>> idoj_same = IDoji(idoj.uuid)
>>> idoj_diff = IDoji()
>>> print("{} -- {} -- {}".format(idoj, idoj_same, idoj_diff))
๐คช๐ฆ๐คณ๐ฅ-๐ฆ๐ฅ-๐๐ฆฃ-๐ฆ๐ถ-๐จ๐ฏ-๐ฆน๐ฆฃ๐๐ฅ -- ๐คช๐ฆ๐คณ๐ฅ-๐ฆ๐ฅ-๐๐ฆฃ-๐ฆ๐ถ-๐จ๐ฏ-๐ฆน๐ฆฃ๐๐ฅ -- ๐ฆช๐ค๐ฆ๐ฆต-๐ค๐ง-๐๐ฅ-๐ฅ๐ฅง-๐ฆ๐ฆน-๐ฅช๐๐งก๐ฆ
>>> idoj == idoj_same
True
>>> idoj == idoj_diff
False
>>> idoj == "๐คช๐ฆ๐คณ๐ฅ-๐ฆ๐ฅ-๐๐ฆฃ-๐ฆ๐ถ-๐จ๐ฏ-๐ฆน๐ฆฃ๐๐ฅ"
True
>>> idoj == "๐ฆช๐ค๐ฆ๐ฆต-๐ค๐ง-๐๐ฅ-๐ฅ๐ฅง-๐ฆ๐ฆน-๐ฅช๐๐งก๐ฆ"
False
Also comparison against UUIDs and their string representation is possible as well.
>>> uuidval = uuid4()
>>> print(uuidval)
627adf41-739a-4b5a-b727-d8add4124884
>>> idoj_from_uuid = IDoji(uuidval)
>>> idoj_from_uuid == uuidval
True
>>> idoj_from_uuid == "627adf41-739a-4b5a-b727-d8add4124884"
True
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.