Miscellaneous utility scripts and Python objects for agile development.
Project description
snippyts
Miscellaneous utility scripts and Python objects for agile development.
Table of objects
| No. | Name | Description | Date added | Date reviewed |
|---|---|---|---|---|
| 1 | snippyts.__init__.batched |
Partitions an input collection iterable into chunks of size batch_size. The number of chunks is unknown at the time of calling is determined by the length of iterable. |
September 22nd, 2024 | September 22nd, 2024 |
| 2 | snippyts.__init__.flatten |
Given a collection of lists, concatenates all elements into a single list. More formally, given a collection holding n iterables with m elements each, this function will return a single list holding all n * m elements. |
September 22nd, 2024 | September 22nd, 2024 |
| 3 | create_python_simple_package.sh |
BASH script to initialize a local Python package as a local git repository with a virtual environment, project files, and standard folder structure. It takes user input into account for parameterization from the command line. | September 22nd, 2024 | September 23rd, 2024 |
| 4 | snippyts.__init__.to_txt |
Function that expects two string parameters as arguments and writes the first string as the content of a file at the location denoted by the second string (which is assumed to denote a POSIX path). | September 23rd, 2024 | September 23rd, 2024 |
| 5 | snippyts.__init__.from_txt |
Function that can be directed to a local raw text file by its POSIX path and returns the content of that file as a string. | September 23rd, 2024 | September 23rd, 2024 |
| 6 | snippyts.__init__.to_json |
Function that expects two parameters as arguments, a Python dictionary and a string, and writes the former as the content of a file at the location denoted by the latter (which is assumed to denote a POSIX path). | September 24th, 2024 | September 24th, 2024 |
| 7 | snippyts.__init__.from_json |
Function that can be directed to a local JSON file by its POSIX path and returns the content of that file as a Python dictionary. | September 24th, 2024 | September 24th, 2024 |
| 8 | snippyts.__init__.to_pickle |
Function that can be directed to a local raw text file by its POSIX path and returns the content of that file as a Python dictionary. | October 3rd, 2024 | October 3rd, 2024 |
| 9 | snippyts.__init__.from_pickle |
Function that can be directed to a local Python-pickle file by its POSIX path and returns a copy of the artifact persisted in that file. | October 3rd, 2024 | October 3rd, 2024 |
| 10 | snippyts.trie.Trie |
A class implementing a trie data structure. | October 3rd, 2024 | October 3rd, 2024 |
| 11 | snippyts.vocabulary_tools.ExactStringMatcher |
A wrapper around flashtext2 providing a unified application interface shared with FuzzySet. |
October 12th, 2024 | October 26th, 2024 |
| 12 | snippyts.vocabulary_tools.FuzzyStringMatcher |
A wrapper around FuzzySet providing a unified application interface shared with flashtext2. |
October 13th, 2024 | October 26th, 2024 |
| 13 | snippyts.__init__.to_csv |
Function that expects two parameters as arguments, a list of lists (or, more geneally, an Iterable contaning other Iterables which is expected to represent a CSV-structured matrix) and a string, and writes the former as the content of a file at the location denoted by the latter (which is assumed to denote a POSIX path). | October 26th, 2024 | October 26th, 2024 |
| 14 | snippyts.__init__.from_csv |
Function that can be directed to a local CSV file by its POSIX path and returns the content of that file as a list of lists (or, more geneally, an Iterable contaning other Iterables which is expected to represent a CSV-structured matrix). | October 26th, 2024 | October 26th, 2024 |
| 15 | snippyts.__init__.tryline |
Wraps a try-raise block into a single statement. It is intended to flatten try-catch. It attempts to call the specified Python-callable object with the provided arguments and keyword arguments. If the call is successful, it silently returns the output of the call. If it fails, it raises an exception of the type provided as the second argument. |
February 28th, 2025 | February 28th, 2025 |
| 16 | snippyts.__init__.is_url |
Determines whether a given string is a valid URL. It uses urllib.parse.urlparse, a function that splits a URL into six components: scheme, network location, path, parameters, query, and fragment. |
February 28th, 2025 | February 28th, 2025 |
| 17 | snippyts.__init__.gtml |
Gets the HTML content of the document at the specified location URL. Named gtml as a shorthand for "get HTML". |
February 28th, 2025 | February 28th, 2025 |
| 18 | snippyts.preprocessing.KBinsEncoder |
Discretizes the data into n_bins using scikit-learn's KBinsDiscretizer class, and then replaces every input value with the value at the bin-th quantile, ensuring that the output vector- only has n_bins unique element but- has the same dimensionality as the original input vector. |
February 28th, 2025 | February 28th, 2025 |
Running tests
Using pytest
Change into the project's home folder (first line below) and run pytest (second line). After moving into that directory, the working folder should contain two subfolders, src (in turn the parent of subfolder snippyts) and tests:
cd snippyts ;
pytest tests ;
Running the module as a package
cd snippyts ;
python -m src.snippyts.__init__
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 snippyts-0.2.1.tar.gz.
File metadata
- Download URL: snippyts-0.2.1.tar.gz
- Upload date:
- Size: 14.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b912ed95ab65a830169922aab5945fd8c4b791a34784b4cd3717ea198aef5073
|
|
| MD5 |
c4511aa491df4d3fbad77f6341e2666d
|
|
| BLAKE2b-256 |
8f849f3135c3872eda6da6e5b3e26c05137a56a2a28d43a4ad99c3a565830a2a
|
File details
Details for the file snippyts-0.2.1-py3-none-any.whl.
File metadata
- Download URL: snippyts-0.2.1-py3-none-any.whl
- Upload date:
- Size: 13.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e298ad6f7cad99bffcfb200fa389050b516ed9340b50fbaee83c392bb15d393f
|
|
| MD5 |
918d28bac137feb76d834842adce4a89
|
|
| BLAKE2b-256 |
4f9ea12796114a5cae325accf32ca2db093c48e6b8b89a1b0634c67a34b3c8da
|