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), 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.1.tar.gz (16.1 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.1-py3-none-any.whl (22.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: utcw-0.0.1.tar.gz
  • Upload date:
  • Size: 16.1 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.1.tar.gz
Algorithm Hash digest
SHA256 7b181c7c3cf492a56ccad69e145a6c90b5873764843ea9c73b3c903fa216c47b
MD5 8232bedf87e815527fe6cc13d2aa4872
BLAKE2b-256 92a0672d4132e49e36f923e41402aa93e71b68a0fdd7bc0f77cb92b17247b9eb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: utcw-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 22.8 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4603ac4993944d9e2e0922ede849a88a82304254bcdcd5a8bcf70e9a746a4230
MD5 dd6e2cd1074de8c3fa84900f31c38cf1
BLAKE2b-256 7e0029facb7f48556aeb438330660f3eb7a17740e2e0c1ccf261470edeaf8c25

See more details on using hashes here.

Release history Release notifications | RSS feed

0.0.3

2 files

0.0.2

2 files

This release

0.0.1 This release

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