Back to Groups
Development

Python: data operations engineer

Python 3.11 standard library. Validate imports, join reference data, and prepare review exports without losing invalid rows. Review names and integration points before use.

workflowspythonpython-developerautomationcode
LM
Lea Moreau
0likes12snippets

Try it here

Loading snippet…

Your typing stays in this tab. Nothing is saved or sent.
Snippets (12)
;py-batches
Consume an iterator in bounded batches
from collections.abc import Iterable, Iterator from itertools import islice from typing import TypeV
;py-utc-parse
Normalize an aware ISO timestamp to UTC
from datetime import datetime, timezone def parse_utc_timestamp(value: str) -> datetime: parsed
;py-worker-config
Immutable validated worker configuration
from dataclasses import dataclass from math import isfinite @dataclass(frozen=True, slots=True) cla
;py-csv-rows
Validate CSV headers and row widths
import csv from collections.abc import Iterator from typing import TextIO def csv_rows(stream: Text
;py-measure
Measure a block with a monotonic clock
from contextlib import contextmanager from time import perf_counter from collections.abc import Iter
;py-cli
Argument parser with bounded batch size
import argparse def batch_size(raw: str) -> int: try: value = int(raw) except Value
;py-deadline
Await an operation with a finite deadline
import asyncio from collections.abc import Awaitable, Callable from math import isfinite from typing
;py-json-lines
Parse object-only JSON Lines with line limits
import json from math import isfinite from collections.abc import Iterable, Iterator from typing imp
;py-review-csv
Build a CSV for manual spreadsheet review
import csv import io def review_csv(headers: list[str], rows: list[list[str]]) -> str: if not 1
;py-inventory-row
Validate an inventory import row
import re def inventory_row(row: dict[str, str]) -> dict[str, str | int]: if set(row) != {"sku"
;py-reference-join
Join reference rows without multiplying records
def left_join_reference( rows: list[dict], references: list[dict], key: str, ) -> list[t
;py-money-column
Parse exact decimal columns without float rounding
from decimal import Decimal import re def decimal_column(raw: str) -> Decimal: if not isinstanc