fractional-indexing-0.1.1
توضیحات
Provides functions for generating ordering strings
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | fractional-indexing-0.1.1 |
| نام | fractional-indexing |
| نسخه کتابخانه | 0.1.1 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | - |
| ایمیل نویسنده | - |
| آدرس صفحه اصلی | https://github.com/httpie/fractional-indexing-python |
| آدرس اینترنتی | https://pypi.org/project/fractional-indexing/ |
| مجوز | CC0 1.0 Universal |
# Fractional Indexing
> This is a Python port of the original JavaScript implementation by [@rocicorp](https://github.com/rocicorp):
> https://github.com/rocicorp/fractional-indexing
---
This is based on [Implementing Fractional Indexing
](https://observablehq.com/@dgreensp/implementing-fractional-indexing) by [David Greenspan
](https://github.com/dgreensp).
Fractional indexing is a technique to create an ordering that can be used for [Realtime Editing of Ordered Sequences](https://www.figma.com/blog/realtime-editing-of-ordered-sequences/).
This implementation includes variable-length integers, and the prepend/append optimization described in David's article.
This should be byte-for-byte compatible with [rocicorp/fractional-indexing](https://github.com/rocicorp/fractional-indexing) (JavaScript) and [rocicorp/fracdex](https://github.com/rocicorp/fracdex) (Go).
## Installation
```bash
$ pip install fractional-indexing
```
## Usage
```python
from fractional_indexing import generate_key_between
first = generate_key_between(None, None)
assert first == 'a0'
# Insert after 1st
second = generate_key_between(first, None)
assert second == 'a1'
# Insert after 2nd
third = generate_key_between(second, None)
assert third == 'a2'
# Insert before 1st
zeroth = generate_key_between(None, first)
assert zeroth == 'Zz'
# Insert in between 2nd and 3rd. Midpoint
second_and_half = generate_key_between(second, third)
assert second_and_half == 'a1V'
```
نیازمندی
| مقدار | نام |
|---|---|
| - | setuptools |
نحوه نصب
نصب پکیج whl fractional-indexing-0.1.1:
pip install fractional-indexing-0.1.1.whl
نصب پکیج tar.gz fractional-indexing-0.1.1:
pip install fractional-indexing-0.1.1.tar.gz