Skip to main content

Development Status :: 3 - Alpha
Copyright (c) 2023 MinWoo Park

util-function

Util-Func Pypi Version Contributor Covenant Python Version Code convention

The Python package utilfunction wraps and distributes useful functions in an easy-to-use way. We have collected functions that are simpler in function than many distributed Python packages or whose category is ambiguous.

For personal purposes, I am curating repetitive functions and planning to categorize and distribute them along with documentation in the future. I recommend not using them until major version 1.

Installation

pip install utilfunction
$ pip install git+https://github.com/dsdanielpark/util-function.git

Features

path_finder.py - function: find_all
Find the path of a file or folder.

from utilfunction import find_all

nii_file_list = find_all('./home', 'file', 'mask.nii.gz')

astyper.py - function: col_converter
Restores a column whose array is stored as a string type back to an array type.

from utilfunction import col_convert

df_has_converted_col = col_convert(df, "embedding_arrays")

beep.py - function: beep
Make beep

from utilfunction import beep

beep()

sec=10
feq=800
beep(sec, feq)

bib2md.py - function: bib2md
Convert bib file to markdown file

from utilfunction import bib2md

bib_path = './sample_data/attention_based.bib'
save_path = './sample_data/attention_based.md'
title_key = 'title'

bib2md(bib_path, title_key, save_path)

pq.py - function: df_to_pq
pd.DataFrame object to parquet object

from utilfunction import df_to_pq

example_df = pd.DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6]})
output_folder = 'output'
output_file_name = 'example.parquet'
df_to_pq(example_df, output_folder, output_file_name)

pq.py - function: gen_hex
Generating random hex

from utilfunction import gen_hex

gen_hex(8)

How to Contribute

Please create a pull request for any function that is useful and simple to reuse. Create a function, and write a tutorial with the same name as the function in the doc folder. Any snippet that you are comfortable with and use often will do. However, some contents may be revised and adjusted later for convenience.

  1. Create a Python file containing functions in utilfunction folder. You must include formatting and doc strings in your function.
  2. Write brief explanations and examples in the doc folder
  3. Write a one-line code example in README.md
  4. Make a Pull Request

Please refer to the find_all function in path_finder.py.


  • Styled with black black .
  • Lnted with pylint pylint --rcfile=setup.cfg util-function/
  • Type-checked with mypy mypy util-function/
  • Pass the pytest unit tests pytest

Notice

  • This repo goes through a simple QA process, there are no major refactoring plans, and it's not a planned project, so it's in alpha.
  • If there is a reference, please list it at the top of each Python file.
  • Coverage of Python versions is subject to change. However, the code formatting is changed to black during the QA process.

Metadata

Release files for utilfunction 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for utilfunction 1.0.2
File Size Uploaded Provenance Actions
utilfunction-1.0.2.tar.gz 10.8 kB Without provenance Details for utilfunction-1.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for utilfunction 1.0.2
File Interpreter ABI Platform Actions
utilfunction-1.0.2-py3-none-any.whl Python 3 none any Details for utilfunction-1.0.2-py3-none-any.whl

Total release size: 21.7 kB

Release files / utilfunction-1.0.2.tar.gz

Download URL utilfunction-1.0.2.tar.gz
Size 10.8 kB
Tags Source
SHA-256 checksum
How to use checksums
56f3df2b9f91eb1382feb361d66015c6f620cb9ca61f21ad5ab5edd6e0de18ba
BLAKE2b-256 checksum
How to use checksums
028c6f748d4bdcbdf739aea7fb56b004906e42fdb0ffdcef183ab3819c9228de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.12

Release files / utilfunction-1.0.2-py3-none-any.whl

Download URL utilfunction-1.0.2-py3-none-any.whl
Size 10.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2b39240f221d9de4dd23963ae2391cf6dcd446f301fe6136482342c09942e019
BLAKE2b-256 checksum
How to use checksums
17e005d0574f2aaa64f2f8456d8006d4409be1a13b67474ca6c4a58f5e774699
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.12

Security for utilfunction 1.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page