Skip to content

Commit

Permalink
Merge branch 'main' into patch-2
Browse files Browse the repository at this point in the history
  • Loading branch information
cclauss authored Feb 9, 2024
2 parents cf680a6 + 059137a commit 6557c5a
Show file tree
Hide file tree
Showing 224 changed files with 5,799 additions and 4,284 deletions.
40 changes: 40 additions & 0 deletions .codiumai.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#.codiumai.toml
[tests]

## Testing framework to use - this can affect the content of the generated tests
## as well as the test run command.
## Possible values are:
## Python: Pytest, Unittest
framework = "Pytest"

## A hint to the test generator about whether to use mocks or not. Possible values are true or false.
# use_mocks = false

## How many tests should be generated by default. Fewer tests is faster.
## Does not apply at the moment to extend-suite tests.
num_desired_tests = 20

## A multiline string, delimited with triple-quotes (""") serving as an extra instruction
## that the AI model will take into consideration.
## This will appear as "General instructions" in the
## configuration section in the tests panel.
# plan_instructions = """
# Each line should have a comment explaining it.
# Each comment should start with the comment number (1., 2. etc.)
# """

## A multiline string, delimited with triple-quotes (""") serving as an example test that represents
## what you would like the generated tests to look like in terms of style, setup, etc.
# example_test = """
# describe("something", () => {
# it("says 'bar'", () => {
# // given
#
# // when
# const res = something.say();
#
# // Then
# expect(res).to.equal("bar");
# });
# });
# """
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/sweep-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ body:
Unit Tests: Write unit tests for <FILE>. Test each function in the file. Make sure to test edge cases.
Bugs: The bug might be in <FILE>. Here are the logs: ...
Features: the new endpoint should use the ... class from <FILE> because it contains ... logic.
Refactors: We are migrating this function to ... version because ...
Refactors: We are migrating this function to ... version because ...
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

version: 2
updates:
# Enable version updates for npm
# Enable version updates for pip
- package-ecosystem: 'pip'
directory: '/'
# Check the npm registry for updates once a week (Monday)
Expand All @@ -15,4 +15,4 @@ updates:
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: 'daily'
interval: 'daily'
6 changes: 3 additions & 3 deletions .github/workflows/deploy-github-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: actions/checkout@v4.1.1
- uses: actions/setup-python@v5.0.0
with:
python-version: '3.7'

Expand All @@ -38,4 +38,4 @@ jobs:
# The GH actions bot is used by default if you didn't specify the two fields.
# You can swap them out with your own user credentials.
user_name: github-actions[bot]
user_email: 41898282+github-actions[bot]@users.noreply.github.com
user_email: 41898282+github-actions[bot]@users.noreply.github.com
2 changes: 1 addition & 1 deletion .github/workflows/first-interaction.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
If this is a bug report, please include relevant logs to help us debug the problem.
pr-message: |
Hello! Thank you for your contribution.
If you are fixing a bug, please reference the issue number in the description.
If you are implementing a feature request, please check with the maintainers that the feature will be accepted first.
2 changes: 1 addition & 1 deletion .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
types: [published]

workflow_dispatch: # This line allows manual triggering

#push:
# branches:
# - master
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/stale_bot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Mark and close stale PRs
uses: actions/stale@v5
uses: actions/stale@v9
with:
stale-pr-message: "This PR is stale because it has been 60 days with no activity. This PR will be automatically closed within 7 days if there is no further activity."
close-pr-message: "This PR was closed because it has been stalled for some time with no activity."
Expand Down
23 changes: 13 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,20 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install pytest pytest-cov coverage cached-property
python setup.py clean build install
- name: Run test
run: pytest

- name: Generate coverage report
pip install pytest pytest-cov pytest-sugar coverage cached-property
- name: Install Whoosh
run: |
pip install -e .
- name: Run tests
run: |
pip install pytest
pip install pytest-cov
pytest --cov=./ --cov-report=xml
pytest --cov=./ --cov-report=xml --cov-report=html
- name: Upload HTML coverage report
uses: actions/upload-artifact@v4
with:
name: "HTML Coverage ${{ matrix.python-version }}"
path: "htmlcov"
retention-days: 7

- name: Upload Coverage to Codecov
uses: codecov/[email protected]
with:
Expand Down
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,10 @@ eggs/
*.egg-info/
/test.py
/.vscode/settings.json
/.coverage
/whoosh-reloaded.code-workspace
/.vscode/launch.json
*.coverage.DESKTOP-*
/coverage.xml
/lcov.info
/.codiumai.local.toml
24 changes: 24 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-ast
- id: check-builtin-literals
- id: check-merge-conflict
- id: check-toml
- id: check-yaml
- id: detect-private-key
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.2.1
hooks:
- id: ruff
- id: ruff-format

- repo: https://github.com/ikamensh/flynt/
rev: '1.0.1'
hooks:
- id: flynt
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ sphinx:
python:
install:
# - requirements: requirements.txt
- requirements: docs/requirements.txt
- requirements: docs/requirements.txt
1 change: 1 addition & 0 deletions .sonarcloud.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sonar.python.version=3.8, 3.9, 3.10, 3.11, 3.12
64 changes: 42 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
[![CodeFactor](https://www.codefactor.io/repository/github/sygil-dev/whoosh-reloaded/badge/main)](https://www.codefactor.io/repository/github/sygil-dev/whoosh-reloaded/overview/main)
[![codecov](https://codecov.io/gh/Sygil-Dev/whoosh-reloaded/graph/badge.svg?token=O3Z2DFB8UA)](https://codecov.io/gh/Sygil-Dev/whoosh-reloaded)
[![Documentation Status](https://readthedocs.org/projects/whoosh-reloaded/badge/?version=latest)](https://whoosh-reloaded.readthedocs.io/en/latest/?badge=latest)
[![codecov](https://codecov.io/gh/Sygil-Dev/whoosh-reloaded/branch/master/graph/badge.svg)](https://codecov.io/gh/Sygil-Dev/whoosh-reloaded)
[![PyPI version](https://badge.fury.io/py/Whoosh-Reloaded.svg)](https://badge.fury.io/py/Whoosh-Reloaded) [![Downloads](https://pepy.tech/badge/whoosh-reloaded)](https://pepy.tech/project/whoosh-reloaded) [![License](https://img.shields.io/pypi/l/Whoosh-Reloaded)](https://pypi.org/project/Whoosh-Reloaded/) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/Whoosh-Reloaded)](https://pypi.org/project/Whoosh-Reloaded/) [![PyPI - Wheel](https://img.shields.io/pypi/wheel/Whoosh-Reloaded)](https://pypi.org/project/Whoosh-Reloaded/) [![PyPI - Format](https://img.shields.io/pypi/format/Whoosh-Reloaded)](https://pypi.org/project/Whoosh-Reloaded/) [![PyPI - Status](https://img.shields.io/pypi/status/Whoosh-Reloaded)](https://pypi.org/project/Whoosh-Reloaded/)

[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=Sygil-Dev_whoosh-reloaded&metric=ncloc)](https://sonarcloud.io/summary/new_code?id=Sygil-Dev_whoosh-reloaded)
[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=Sygil-Dev_whoosh-reloaded&metric=code_smells)](https://sonarcloud.io/summary/new_code?id=Sygil-Dev_whoosh-reloaded)
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=Sygil-Dev_whoosh-reloaded&metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=Sygil-Dev_whoosh-reloaded)
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=Sygil-Dev_whoosh-reloaded&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=Sygil-Dev_whoosh-reloaded)
[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=Sygil-Dev_whoosh-reloaded&metric=bugs)](https://sonarcloud.io/summary/new_code?id=Sygil-Dev_whoosh-reloaded)
[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=Sygil-Dev_whoosh-reloaded&metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=Sygil-Dev_whoosh-reloaded)
[![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=Sygil-Dev_whoosh-reloaded&metric=duplicated_lines_density)](https://sonarcloud.io/summary/new_code?id=Sygil-Dev_whoosh-reloaded)
[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=Sygil-Dev_whoosh-reloaded&metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=Sygil-Dev_whoosh-reloaded)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=Sygil-Dev_whoosh-reloaded&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=Sygil-Dev_whoosh-reloaded)
[![Technical Debt](https://sonarcloud.io/api/project_badges/measure?project=Sygil-Dev_whoosh-reloaded&metric=sqale_index)](https://sonarcloud.io/summary/new_code?id=Sygil-Dev_whoosh-reloaded)


--------------------------------------

> **Notice:** This repository (**whoosh-reloaded**) is a fork and continuation of the Whoosh project. The original Whoosh project is no longer maintained.
> **Notice:** This repository (**whoosh-reloaded**) is a fork and continuation of the Whoosh project.

>This fork **is actively maintained** by the Sygil-Dev Organization.
> This fork **is actively maintained** by the Sygil-Dev Organization.
--------------------------------------

Expand All @@ -23,25 +35,25 @@ works can be extended or replaced to meet your needs exactly.
Some of Whoosh's features include:

* Pythonic API.
* Pure-Python. No compilation or binary packages needed, no mysterious crashes.
* Pure-Python. No compilation or binary packages are needed, no mysterious crashes.
* Fielded indexing and search.
* Fast indexing and retrieval -- faster than any other pure-Python, scoring,
full-text search solution I know of.
* Pluggable scoring algorithm (including BM25F), text analysis, storage,
posting format, etc.
* Powerful query language.
* Pure Python spell-checker (as far as I know, the only one).
* Pure Python spell-checker (as far as I know, the only one).

Whoosh might be useful in the following circumstances:

* Anywhere a pure-Python solution is desirable to avoid having to build/compile
native libraries (or force users to build/compile them).
* As a research platform (at least for programmers that find Python easier to
read and work with than Java ;)
* As a research platform (at least for programmers who find Python easier to
read and work with Java ;)
* When an easy-to-use Pythonic interface is more important to you than raw
speed.
speed.

Whoosh was created by Matt Chaput and is maintained currently by the Sygil-Dev Organization. It was originally created for use in the online help system of Side Effects Software's 3D animation software Houdini. Side Effects Software Inc. graciously agreed to open-source the code.
Whoosh was created by Matt Chaput and is maintained currently by the Sygil-Dev Organization. It was created for use in the online help system of Side Effects Software's 3D animation software Houdini. Side Effects Software Inc. graciously agreed to open-source the code.

This software is licensed under the terms of the simplified BSD (A.K.A. "two
clause" or "FreeBSD") license. See LICENSE.txt for information.
Expand All @@ -52,15 +64,10 @@ Installing Whoosh
If you have ``setuptools`` or ``pip`` installed, you can use ``easy_install``
or ``pip`` to download and install Whoosh automatically::

# install the old version from Pypi
$ easy_install Whoosh

or

# install the old version from PyPI
$ pip install Whoosh


# Install the development version from Github.

# Install the development version from GitHub.
$ pip install git+https://github.com/Sygil-Dev/whoosh-reloaded.git

Getting the source.
Expand All @@ -70,14 +77,23 @@ You can check out the latest version of the source code on GitHub using git:

$ git clone https://github.com/Sygil-Dev/whoosh-reloaded.git

Contributing
============
We use pre-commit to format the code and run some checks before committing to avoid common mistakes. To install it, run the following commands:

```bash
$ pip install pre-commit
$ pre-commit install
```

Learning more
=============

* Online Documentation:
*   [Github Pages](https://sygil-dev.github.io/whoosh-reloaded/)
*   [Read the Docs](https://whoosh-reloaded.readthedocs.io/en/latest/)

*   [GitHub Pages](https://sygil-dev.github.io/whoosh-reloaded/)

*   [Read the Docs](https://whoosh-reloaded.readthedocs.io/en/latest/)

* Read the old online documentation at https://docs.red-dove.com/whoosh-reloaded/ (Search work properly).

Expand All @@ -90,4 +106,8 @@ Maintainers
===========

* [Sygil-Dev Organization](https://github.com/Sygil-Dev)
* [ZeroCool940711](https://github.com/ZeroCool940711)
* [ZeroCool940711](https://github.com/ZeroCool940711)

Discord Server
==============
- [Sygil-Dev - Resources](https://discord.gg/H5mftKP5S9)
5 changes: 3 additions & 2 deletions benchmark/dictionary.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os.path, gzip
import gzip
import os

from whoosh import analysis, fields
from whoosh.support.bench import Bench, Spec
Expand Down Expand Up @@ -28,7 +29,7 @@ def documents(self):

def whoosh_schema(self):
ana = analysis.StemmingAnalyzer()
# ana = analysis.StandardAnalyzer()

schema = fields.Schema(
head=fields.ID(stored=True), body=fields.TEXT(analyzer=ana, stored=True)
)
Expand Down
21 changes: 10 additions & 11 deletions benchmark/enron.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from __future__ import division
import os.path, tarfile
import os.path
import tarfile
from email import message_from_string
from marshal import dump, load
from zlib import compress, decompress
Expand All @@ -10,11 +10,10 @@
pass

from whoosh import analysis, fields
from whoosh.compat import urlretrieve, next
from whoosh.compat import next, urlretrieve
from whoosh.support.bench import Bench, Spec
from whoosh.util import now


# Benchmark class


Expand Down Expand Up @@ -45,10 +44,10 @@ class Enron(Spec):
# the messages in an easier-to-digest format

def download_archive(self, archive):
print("Downloading Enron email archive to %r..." % archive)
print(f"Downloading Enron email archive to {archive}...")
t = now()
urlretrieve(self.enron_archive_url, archive)
print("Downloaded in ", now() - t, "seconds")
print(f"Downloaded in {now() - t} seconds")

@staticmethod
def get_texts(archive):
Expand Down Expand Up @@ -84,10 +83,10 @@ def get_messages(archive, headers=True):
yield d

def cache_messages(self, archive, cache):
print("Caching messages in %s..." % cache)
print(f"Caching messages in {cache}...")

if not os.path.exists(archive):
raise Exception("Archive file %r does not exist" % archive)
raise FileNotFoundError(f"Archive file {archive} does not exist")

t = now()
f = open(cache, "wb")
Expand All @@ -98,7 +97,7 @@ def cache_messages(self, archive, cache):
if not c % 1000:
print(c)
f.close()
print("Cached messages in ", now() - t, "seconds")
print(f"Cached messages in {now() - t} seconds")

def setup(self):
archive = os.path.abspath(
Expand All @@ -118,7 +117,7 @@ def setup(self):

def documents(self):
if not os.path.exists(self.cache_filename):
raise Exception("Message cache does not exist, use --setup")
raise FileNotFoundError("Message cache does not exist, use --setup")

f = open(self.cache_filename, "rb")
try:
Expand Down Expand Up @@ -176,7 +175,7 @@ def process_document_whoosh(self, d):
d["filepos"] = self.filepos
if self.options.storebody:
mf = self.main_field
d["_stored_%s" % mf] = compress(d[mf], 9)
d[f"_stored_{mf}"] = compress(d[mf], 9)

def process_result_whoosh(self, d):
mf = self.main_field
Expand Down
Loading

0 comments on commit 6557c5a

Please sign in to comment.