Skip to main content

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.

Download files

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

Source Distribution

utcw-0.0.3.tar.gz (16.9 kB view details)

Uploaded Source

Built Distribution

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

utcw-0.0.3-py3-none-any.whl (24.1 kB view details)

Uploaded Python 3

File details

Details for the file utcw-0.0.3.tar.gz.

File metadata

  • Download URL: utcw-0.0.3.tar.gz
  • Upload date:
  • Size: 16.9 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for utcw-0.0.3.tar.gz
Algorithm Hash digest
SHA256 33129ca5af17831492d39faae8ff4d8f44b6aefa5c1fa0ad9400aa9d846774e2
MD5 9eb62df0ad744f83449309f031f34f57
BLAKE2b-256 ded58e3da9fbea54950a9de0a8d15e3af4b4c05006e79790112bf40c0821797c

See more details on using hashes here.

File details

Details for the file utcw-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: utcw-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 24.1 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for utcw-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0c4da89808851f6e2e8c396138990ecae14368c06821754bacc87308823d22f1
MD5 dcce787b210d24a6979384fddb4784cc
BLAKE2b-256 54d0321423f8d9b98c8c26ac3acae04e71d39d36e8c7ef77211d5e04d669b9c0

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 files

0.0.2

2 files

0.0.1

2 files

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