Sequence data type.
Project description
Description
This library adds the new data format: sequence. Sequences has 2 attributes: Name, Count. Name - Name of the sequence element. Count - Count of elements. Sequence presented in matrix format. One element of the sequence looks how:
[name = "Apple", count = 2].
Methods
sequence.init(seq=None) - Class constructor.
- seq receives the matrix in the form below.
[[_first element_], [_second element_], ..., [_n element_]]
[!CAUTION] Don't use any data type except integer in count attribute!
sequence.append(name=None, count=0) - Element append function.
- name receives name of the element.
- count receives the count of current element.
> seq = dtseqlib.Sequence([["Autumn", 1]])
> seq.append("Element", 2)
> print(seq.get())
[["Autumn", 1], ["Element", 2]]
[!CAUTION] Don't use any data type except integer in count attribute!
sequence.insert(name=None, count=0, index=0) - Inserts the element by index.
- name receives name of the element.
- count receives the count of current element.
- index receives the insert index.
> seq = dtseqlib.Sequence([["Autumn", 1]])
> seq.insert("Element", 2)
> seq.insert("Spring", 5, 2)
> print(seq.get())
[["Element", 2], ["Autumn", 1], ["Spring", 5]]
[!CAUTION] Don't use any data type except integer in count and index attributes!
sequence.delete(index=0) - Deletes the single element by index.
- index receives the remove index.
> seq = dtseqlib.Sequence([["Autumn", 1], ["Spring", 2]])
> seq.delete(1)
> print(seq.get())
[["Autumn", 1]]
[!CAUTION] Don't use any data type except integer in index attribute!
sequence.clip(indexes=[-1, 0]) - Deletes the multiple elements in array range.
- _indexes* receives the min and max index in list for cliping.
> seq = dtseqlib.Sequence([["Autumn", 1], ["Spring", 2]])
> seq.clip([0, 1])
> print(seq.get())
[]
[!CAUTION] Don't use any data type except integer in every element in indexes attribute! Use only from min to max sort!
sequence.get() - Return list of the elements in sequence.
sequence.scan(index=0) - Return single element from sequence array.
- index receives the element index.
> seq = dtseqlib.Sequence([["Autumn", 1], ["Spring", 2]])
> print(seq.scan(1))
["Spring", 2]
[!CAUTION] Don't use any data type except integer in index attribute!
sequence.multiple_scan(indexes=[-1, 0]) - Return multiple elements from sequence array by range.
How clip, but instead of deleting.
[!CAUTION] Don't use any data type except integer in every element in indexes attribute! Use only from min to max sort!
sequence.scan_cbn(count=0) - Return list of the elements with define count.
> seq = dtseqlib.Sequence([["Autumn", 1], ["Spring", 2]])
> print(seq.scan_cbn(2))
["Spring", 2]
[!CAUTION] Don't use any data type except integer in count attribute!
sequence.scan_nbc(name=None) - Return list of the elements with define name.
How scan_cbn, but with name.
sequence.get_bwc(count=0) - Get matrix of elements (blocks) with define count.
> seq = dtseqlib.Sequence([["Winter", 1], ["Spring", 2], ["Autumn", 1]])
> print(seq.bwc(1))
[["Winter", 1], ["Autumn", 1]]
[!CAUTION] Don't use any data type except integer in count attribute!
sequence.get_bwn(name=None) - Get matrix of elements (blocks) with define name.
How get_bwc, but with name.
sequence.to_list() - Converts the sequence to array with order and count.
> seq = dtseqlib.Sequence([["Winter", 1], ["Spring", 2], ["Autumn", 1]])
> print(seq.to_list())
["Winter", "Spring", "Spring", "Autumn"]
len(sequence) - Return count of the elements in sequence.
to_sequence(list) - Return sequence from the list.
> list = [7, 7, 7, 9, 1, 1]
> print(dtseqlib.to_sequence(list))
[[7, 3], [9, 1], [1, 2]]
[!WARNING] This opinion was added in 1.1 version, you get an error in the older versions.
Usage
You can free use this library in your projects for different reasons.
MIT LICENSE.
Downloading
[!WARNING] Library only availble on Python 3.x.
You can install this library by running the following command in your terminal:
pip install dtseqlib
You can use the library after installing.
import dtseqlib
You can use the Sequence() class in your project. Example of project below.
seq = dtseqlib.Sequence([["Spring", 2], ["Winter", 5]])
seq.append("King", 4)
print(seq.get())
Outro
This is my first Python library, and I'm still learning. I will continue updating this project and adding new features.
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.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dtseqlib-1.1.tar.gz.
File metadata
- Download URL: dtseqlib-1.1.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c936266a2e0b6c205f796a3644cda01279ebc06d8fcb3d019775fbff7e298c9
|
|
| MD5 |
cbc8f3d618b5d8fb8910af48d359e68e
|
|
| BLAKE2b-256 |
4d630b7010d110f3f9ee0ce2afbce112cbfc45673926c80968c4729a710d97b7
|
File details
Details for the file dtseqlib-1.1-py3-none-any.whl.
File metadata
- Download URL: dtseqlib-1.1-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
88d616eadedadbd14c09dd795d77df08d48db90bdc444047720bb37cf28fc9a1
|
|
| MD5 |
da993d38bb9814a5e9a637d0238af844
|
|
| BLAKE2b-256 |
bef070077e6e3675902bd6fe4b7a62311959eed55289803b66d3e53d8612999b
|