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), 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.2.tar.gz (16.7 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.2-py3-none-any.whl (23.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: utcw-0.0.2.tar.gz
  • Upload date:
  • Size: 16.7 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.2.tar.gz
Algorithm Hash digest
SHA256 648ba314e1bd74cc341db81046e30ce0a0fdc3b893cbe6bb708c2eb300c6a33d
MD5 d0969055cbcf341ecfd9f55979848e56
BLAKE2b-256 4eb9a4d3b6f31f6a55ebc81d78ad3a69db72cfddf677ec3e61d715c849213143

See more details on using hashes here.

File details

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

File metadata

  • Download URL: utcw-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 23.7 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 780a47e08e944ac34f9443a46f7a0d2c7541d6353919014484fca800f3e7b283
MD5 7318517ddec09b99e02ea3a438672185
BLAKE2b-256 71d593960ba1f56ea761ae20890ee6e6fa7ed010f62b75f04a8902abfc5ebeb3

See more details on using hashes here.

Release history Release notifications | RSS feed

0.0.3

2 files

This release

0.0.2 This release

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