pockets

0.9.1 · maintenance · verified Tue Apr 14

The Pockets library is a collection of Python helper functions that streamline common development tasks. It provides utilities for logging, collections, datetime manipulation, object inspection, string operations, and iterators. The current version is 0.9.1, last updated in November 2019, suggesting a maintenance or slow release cadence.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates common string manipulation utilities like `camel` and `uncamel`, object resolution using `resolve`, and advanced iterator functionality with `iterpeek`.

from pockets import camel, uncamel, resolve, iterpeek

# String utilities
camel_case_str = camel("xml_http_request", upper_segments=[1])
print(f"Camel case: {camel_case_str}")

underscore_str = uncamel("XmlHTTPRequest")
print(f"Underscore case: {underscore_str}")

# Object resolution
list_class = resolve("builtins.list")
print(f"Resolved object: {list_class}")

# Iterator peeking
p = iterpeek(["a", "b", "c", "d", "e"])
print(f"Peek next: {p.peek()}")
print(f"Next item: {next(p)}")
print(f"Peek 3 items: {p.peek(3)}")

view raw JSON →