Skip to main content

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

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!

append(name=None, count=0) - Element append function.

  • name receives name of the element.
  • count receives the count of current element.
> seq = 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!

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 = 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!

delete(index=0) - Deletes the single element by index.

  • index receives the remove index.
> seq = 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!

clip(indexes=[-1, 0]) - Deletes the multiple elements in array range.

  • _indexes* receives the min and max index in list for cliping.
> seq = 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!

get() - Return list of the elements in sequence.

scan(index=0) - Return single element from sequence array.

  • index receives the element index.
> seq = Sequence([["Autumn", 1], ["Spring", 2]])
> print(seq.scan(1))

["Spring", 2]

[!CAUTION] Don't use any data type except integer in index attribute!

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!

scan_cbn(count=0) - Return list of the elements with define count.

> seq = Sequence([["Autumn", 1], ["Spring", 2]])
> print(seq.scan_cbn(2))

["Spring", 2]

[!CAUTION] Don't use any data type except integer in count attribute!

scan_nbc(name=None) - Return list of the elements with define name.

How scan_cbn, but with name.

get_bwc(count=0) - Get matrix of elements (blocks) with define count.

> seq = 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!

get_bwn(name=None) - Get matrix of elements (blocks) with define name.

How get_bwc, but with name.

to_list() - Converts the sequence to array with order and count.

> seq = Sequence([["Winter", 1], ["Spring", 2], ["Autumn", 1]])
> print(seq.to_list())

["Winter", "Spring", "Spring", "Autumn"]

len(sequence) - Return count of the elements in sequence.

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.

from dtseqlib import Sequence

You can use the Sequence() class in your project. Example of project below.

seq = 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dtseqlib-1.0.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dtseqlib-1.0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file dtseqlib-1.0.tar.gz.

File metadata

  • Download URL: dtseqlib-1.0.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.1

File hashes

Hashes for dtseqlib-1.0.tar.gz
Algorithm Hash digest
SHA256 c1aef4112e5d88005bfb82d86d28be7ad9e9bbde18c1b40edd84ed1c23b2f778
MD5 18f58266c9425427e088befc2ce270c2
BLAKE2b-256 05a9fc6131d9f2ddffd2e3643498901f66f5082ca36500a6565ce1f72c888349

See more details on using hashes here.

File details

Details for the file dtseqlib-1.0-py3-none-any.whl.

File metadata

  • Download URL: dtseqlib-1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.1

File hashes

Hashes for dtseqlib-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8b14c25d0ad5dbe20c18818a0207c89cdeb3c519d5b371ccfe971a93aa48e81d
MD5 9c34fa46d2150d4956f077f38749bfd3
BLAKE2b-256 db3e7fdafe2333841ba042fce2c0580c0d50d6870d20897173b2d61274be0fee

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page