Skip to main content

Sets

Set operations over files where each line is an element.

pip3 install -U sets-operation-over-files

$ sets 'set_a | set_b' -s
a
b
c
d
e
f
g
h
i
j

Usage

An expression supports | (union), & (intersection), - (difference), ^ (symmetric difference), and/or, and parentheses:

$ sets 'set_a & set_b'

File names can be quoted to allow spaces and special characters: sets "'my list.txt' | other". Output keeps the left operand's line order; -s sorts it.

How it works

The expression is parsed into an AST instead of string-replaced. Identifiers and quoted strings are rewritten to file reads — set_a & set_b becomes s('set_a') & s('set_b') — then evaluated with only the s function exposed and builtins disabled.

A whitelist guard rejects any node outside set-expression syntax (Attribute, Lambda, Subscript, ...), so the expression cannot run arbitrary code. Files are read into an order-preserving set (OrderedSet), so results keep the left operand's line order across runs.

Download files

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

Source Distribution

sets_operation_over_files-0.1.3.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

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

sets_operation_over_files-0.1.3-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file sets_operation_over_files-0.1.3.tar.gz.

File metadata

  • Download URL: sets_operation_over_files-0.1.3.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","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 sets_operation_over_files-0.1.3.tar.gz
Algorithm Hash digest
SHA256 e6875af4b9fc058b28a5fbeaabe6162fc0cab8b714709b9d9bc589ea8c6dcf24
MD5 7718d20a17f9bc1935a5ef81d66a2012
BLAKE2b-256 05987f91a2e5638f6277dc287e8005924b5867b134bc625fd54eb53a40483664

See more details on using hashes here.

File details

Details for the file sets_operation_over_files-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: sets_operation_over_files-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","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 sets_operation_over_files-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 744ec01693666e6cf0f692d2cc48237ae8198623e8a5a04f44d50263c6460094
MD5 7862fb33a3c17fe7a2e3bbeb7ff79ce2
BLAKE2b-256 3f3c1883f9655a70aac522c1902742636c8bf08458eca306a7d77521eff0e19c

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 files

0.1.1

1 file

0.1

1 file

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