textbisect - Binary search in a text file
Description
This Python 3 module provides functionality to search inside sorted text files. The lines of the files need not be all of the same length. The module contains the following functions:
text_bisect_left(a, x, lo=0, hi=None, key=lambda x: x) locates the insertion point for line x in seekable filelike object a consisting of a number of lines; x must be specified without a trailing newline. a must use \n as the newline character and must not perform any line endings translation (use open(..., newline='\n')). The parameters lo and hi, if specified, must be absolute positions within object a, and specify which part of a to search; the default is to search the entire a. The character pointed to by hi (or the last character of the object, if hi is unspecified) must be a newline. key is a function that is used to compare each line of a with x; line endings are removed from the lines of a before comparison. a must be sorted or the result will be undefined. If x compares equal to a line in a, the returned insertion point is the beginning of that line. The initial position of a is discarded. The function returns the insertion point, which is an integer between lo and hi+1, pointing to the beginning of a line; when it exits, a is positioned there.
text_bisect_right() is the same as text_bisect_left(), except that if x compares equal to a line in a, the returned insertion point is the beginning of the next line.
text_bisect() is the same as text_bisect_right().
License
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Metadata
Release files for textbisect 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| textbisect-0.1.0.tar.gz | 16.5 kB | Without provenance | Details for textbisect-0.1.0.tar.gz |
Release files / textbisect-0.1.0.tar.gz
| Download URL | textbisect-0.1.0.tar.gz |
|---|---|
| Size | 16.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
73bf13291176ab9b0db1583c471ae7b8a50f561ea3cd24e5da3060c07c58b362
|
|
BLAKE2b-256 checksum How to use checksums |
a9d9f9e0d39f4abed418444814368a348d2cd06117983a03bf50866e2b4a6cca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for textbisect 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.