utcw
Shared utilities for the two-letter packages.
pip install utcw
utcw holds the common code that several of the two-letter packages (fg, iy,
kw, lh, nh, ow, xl, ya, yf, ys, yw, yx, yz, zr) depend on.
Those packages previously reached for this code through a toolbox that was never
published, which meant they could be installed but not imported. utcw gives that
code a real home on PyPI.
Layout
Modules are grouped by what they operate on:
| module | what's in it |
|---|---|
utcw.pcoll |
order-conserving set operations (intersect, union, setdiff, reorder_as, contains) and an OrderedSet |
utcw.pstr |
string transforms (lower, strip, toascii, to_unicode_or_bust) and to.file |
utcw.pdict |
dict manipulation (rollout) |
utcw.util.ulist |
list helpers (ascertain_list, to_str, all_true) |
utcw.pfile |
filename manipulation (files_of_folder, replace_folder_and_ext) and to.string |
utcw.pgenerator |
generator helpers (last_element) |
utcw.daf |
pandas dataframe helpers — ch (change), check, get, manip, dup_diag |
utcw.parse |
HTML/soup parsing (x_to_soup, open_in_firefox) |
utcw.aw |
adwords dataframe manipulation (add_col, order_words, strip_kw) |
utcw.dacc.es |
elasticsearch query/retrieval helpers |
utcw.util |
var (type predicates), pfunc (signature filtering), uiter (progress-printing iterator wrapper), pobj (object introspection), counter |
Examples
>>> from utcw.pcoll.order_conserving import intersect, setdiff
>>> intersect([1, 2, 3, 4], [3, 1])
[1, 3]
>>> setdiff([1, 2, 3], [2])
[1, 3]
>>> from utcw.pstr.trans import toascii, strip
>>> toascii('café crème')
'cafe creme'
>>> strip(' a b ')
'a b'
>>> from utcw.pdict.manip import rollout
>>> rollout({'a': [{'x': 1}, {'x': 2}], 'b': 'B'}, 'a')
[{'a.x': 1, 'b': 'B'}, {'a.x': 2, 'b': 'B'}]
>>> import pandas as pd
>>> from utcw.daf.get import rows_with_col_values_in
>>> df = pd.DataFrame({'a': [1, 2, 3], 'b': list('xyz')})
>>> rows_with_col_values_in(df, 'a', [1, 3])['b'].tolist()
['x', 'z']
Notes
This is vendored code, extracted as the transitive closure of what the two-letter packages actually reference — not a curated library. It is published so those packages can declare a real dependency instead of an unsatisfiable one. Expect the API to be stable (nothing new depends on it) rather than polished.
Two Python-2-era breakages were repaired during extraction: utcw.pfile.to.string
used the removed file() builtin, and utcw.parse.util.x_to_soup reached it
through a module-level name that no longer resolved.
Metadata
Release files for utcw 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| utcw-0.0.3.tar.gz | 16.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| utcw-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 41.0 kB
Release files / utcw-0.0.3.tar.gz
| Download URL | utcw-0.0.3.tar.gz |
|---|---|
| Size | 16.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
33129ca5af17831492d39faae8ff4d8f44b6aefa5c1fa0ad9400aa9d846774e2
|
|
BLAKE2b-256 checksum How to use checksums |
ded58e3da9fbea54950a9de0a8d15e3af4b4c05006e79790112bf40c0821797c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / utcw-0.0.3-py3-none-any.whl
| Download URL | utcw-0.0.3-py3-none-any.whl |
|---|---|
| Size | 24.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0c4da89808851f6e2e8c396138990ecae14368c06821754bacc87308823d22f1
|
|
BLAKE2b-256 checksum How to use checksums |
54d0321423f8d9b98c8c26ac3acae04e71d39d36e8c7ef77211d5e04d669b9c0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|