semvec/pypi-packages huggingface dataset:
clean-html-for-llm 1.3.2
A library for cleaning HTML content by removing specified tags and attributes.
License: MIT
Requires Python: >=3.7
Keywords: html cleaning, html cleaning for llm, html denoise for llm, html denoising for llm, html cleaning for language model, html denoise for language model, html denoising for language model, html cleaning for nlp, html denoise for nlp, html denoising for nlp

# clean_html_for_llm

This library provides a method to clean HTML content by removing specified tags and attributes while keeping specified attributes. It is particularly useful for preprocessing HTML data to remove noisy tags, making it easier for language models (LLMs) to understand the HTML and generate accurate responses.
This is helpful if you are querying LLMs with your HTML data.
![PyPI Version](https://img.shields.io/pypi/v/clean-html-for-llm)
![License](https://img.shields.io/badge/License-MIT-blue.svg)



## Installation

You can install the `clean_html_for_llm` library using pip:

```bash
pip install clean-html-for-llm
```

## Usage

```python
from clean_html_for_llm import clean_html

html_content = '<div id="main" style="color:red">Hello <script>alert("World")</script></div>'
cleaned_html = clean_html(html_content, tags_to_remove=['script'], attributes_to_keep=['id'])
print(cleaned_html)
# Output: '<div id="main">Hello </div>'
```

The `clean_html` function takes the following arguments:

- `html_to_clean` (str): The HTML content to clean.
- `tags_to_remove` (List[str]): List of tags to remove from the HTML content. Default is `['style', 'svg', 'script']`.
- `attributes_to_keep` (List[str]): List of attributes to keep in the HTML tags. Default is `['id', 'href']`.

You can customize the tags and attributes to remove or keep based on your requirements.

## Examples

### Example 1:

```python
html_content = '<div id="content" class="main">This is a <span style="font-size: 18px;">paragraph</span>.</div>'
cleaned_html = clean_html(html_content)
print(cleaned_html)
# Output: '<div id="content">This is a <span>paragraph</span>.</div>'
```

### Example 2:

```python
html_content = '<p class="content">Click <a href="https://example.com">here</a> for more information.</p>'
cleaned_html = clean_html(html_content, tags_to_remove=['a'], attributes_to_keep=['class'])
print(cleaned_html)
# Output: '<p class="content">Click </p>'
```

## License

This library is released under the MIT License. See [LICENSE](LICENSE) for details.
pytest-node-dependency 1.4.0
pytest plugin for controlling execution flow
License: MIT
Keywords: pyest-node-dependency

------

[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/license/mit)
![PyPI](https://img.shields.io/pypi/v/pytest-node-dependency)
![PyPI - Downloads](https://img.shields.io/pypi/dm/pytest-node-dependency)

What?
------
pytest-node-dependency is a pytest plugin that allows you to define dependencies between tests and reorder their execution based on those dependencies. This plugin ensures that tests with dependencies run after their required prerequisites have completed successfully.

A unique feature of the plugin is that if you set a test to depend on another one, the plugin will check if the test being depended upon failed. If that's the case, it will mark the current test as 'expected to fail' (xfail).

How to install?
----------
```
pip install pytest-node-dependency
```

How to use?
-----------------------------------------------------
To set up a test dependency, decorate the test function with the `depends` mark and provide a list of dependencies via the `on` keyword argument to the decorator. Dependencies can be specified by name only when in the same file as the test being decorated or by the pytest node path for tests in other files/classes.

```
import pytest


def test_second(request):
    print("second")
    assert request.session.items[1].name == 'test_second'


@pytest.mark.depends(on=["test_plugin.py::test_second"])
def test_last(request):
    print("last")
    assert request.session.items[2].name == 'test_last'


def test_first(request):
    print("first")
    assert request.session.items[0].name == 'test_first'
```

Xdist adoption:
---------------
The way xdist plugin works is by utilizing multiple cores and spreads the tests among them.
The problem with the plugin is that if you wish to use reordering, you probably want to set some dependency among the tests,
However, the xdist plugin will break it.

For that, you should set the group for the tests. The group means that a gateway worker will collect the tests, and will 
place all the grouped tests in a single gateway worker. 
This will lead creation of serial testing among parallel exectuion.

```
import pytest

@pytest.mark.depends(xdist_group='a')
def test_second(request):
    print("second")
    assert request.session.items[1].name == 'test_second'


@pytest.mark.depends(on=["test_plugin.py::test_second"], xdist_group='a')
def test_last(request):
    print("last")
    assert request.session.items[2].name == 'test_last'


def test_first(request):
    print("first")
    assert request.session.items[0].name == 'test_first'
```


Limitations and known issues:
-----------------------------------------------------
* All the tests without dependency (both dependent-on) will run first, then, all tests with connections will run
(e.g. the list of items will be as described)
* Currently, automated xfail is enabled, it should be configurable.