
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
BumBag is a collection of Python utility functions:
bumbag
is available on PyPI for Python 3.8+:
pip install bumbag
Measure elapsed wall-clock time and compute total elapsed time with stopwatch
:
>>> import bumbag
>>> import time
>>> with bumbag.stopwatch(1) as sw1:
... time.sleep(1)
...
2023-01-01 12:00:00 -> 2023-01-01 12:00:01 = 1.00124s - 1
>>> with bumbag.stopwatch(2) as sw2:
... time.sleep(1)
...
2023-01-01 12:01:00 -> 2023-01-01 12:01:01 = 1.00168s - 2
>>> sw1 + sw2
2.00291s - total elapsed time
Easily flatten
an irregular list:
>>> import bumbag
>>> irregular_list = [
... ["one", 2],
... 3,
... [(4, "five")],
... [[["six"]]],
... "seven",
... [],
... ]
>>> list(bumbag.flatten(irregular_list, 8, [9, ("ten",)]))
['one', 2, 3, 4, 'five', 'six', 'seven', 8, 9, 'ten']
Use highlight_string_differences
to see differences between two strings easily:
>>> import bumbag
>>> print(bumbag.highlight_string_differences("hello", "hall"))
hello
| |
hall
Quickly compare two Python sets with two_set_summary
:
>>> import bumbag
>>> x = {"a", "c", "b", "g", "h"}
>>> y = {"c", "d", "e", "f", "g"}
>>> summary = bumbag.two_set_summary(x, y)
>>> print(summary["report"])
x (n=5): {'a', 'b', 'c', ...}
y (n=5): {'c', 'd', 'e', ...}
x | y (n=8): {'a', 'b', 'c', ...}
x & y (n=2): {'c', 'g'}
x - y (n=3): {'a', 'b', 'h'}
y - x (n=3): {'d', 'e', 'f'}
x ^ y (n=6): {'a', 'b', 'd', ...}
jaccard = 0.25
overlap = 0.4
dice = 0.4
disjoint?: False
x == y: False
x <= y: False
x < y: False
y <= x: False
y < x: False
Your contribution is greatly appreciated! See the following links to help you get started:
bumbag
was created by the BumBag Developers.
It is licensed under the terms of the BSD 3-Clause license.
FAQs
A package for Python utility functions.
We found that bumbag demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.