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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e6875af4b9fc058b28a5fbeaabe6162fc0cab8b714709b9d9bc589ea8c6dcf24
|
|
| MD5 |
7718d20a17f9bc1935a5ef81d66a2012
|
|
| BLAKE2b-256 |
05987f91a2e5638f6277dc287e8005924b5867b134bc625fd54eb53a40483664
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
744ec01693666e6cf0f692d2cc48237ae8198623e8a5a04f44d50263c6460094
|
|
| MD5 |
7862fb33a3c17fe7a2e3bbeb7ff79ce2
|
|
| BLAKE2b-256 |
3f3c1883f9655a70aac522c1902742636c8bf08458eca306a7d77521eff0e19c
|