semvec/pypi-packages huggingface dataset:
queuepool 1.3.2
A multithread-safe resource pool based on synchronized queue
Requires Python: >= 3.7

queuepool - A multithread-safe resource pool based on synchronized queue
========================================================================

The main problem with psycopg2.pool (https://github.com/psycopg/psycopg2/blob/master/lib/pool.py), for example, is that the pool raises an exception (instead of blocking) when there are no more connections in the pool, and you either have to match the number of connections to the number of workers, or implement retry logic. Also, it doesn't implement connection recycling (on timeout or usage count), and therefore, doesn't fully address issue with stale connections and suited less (scales worse) for large production installations.

This implementation is based on synchronized queue (https://docs.python.org/3/library/queue.html), and thus multithred safe. This is a streamlined port from Java version that was implemented about ten years ago and that has since then been running in heavy production evironment of one of our financial clients.

This implementation features: 

* A pool of generic resources that can be extended for specific resources like psycopg2 connections. Psycopg2 connection pool implementation is provided.
* On-demand lazy resource opening.
* Idle and open timeout recycling. Requires user code to execute `pool.recycle()` method periodically (or start recycler thread by `pool.startRecycler()`), for example, once a minute. If this method isn’t executed periodically, then the recycling is performed only when the resource are either taken or returned back to the pool, and therefore, the pool can accumulate a number of idle connections that exceed the idle or open timeouts.
* Usage count recycling.
* Recycling on exception.
* Recycling on a resource status.
* Context manager allows to use the pool with "with" context manager so that the resources could be returned safely to the pool.
* LIFO queue helps the pool keep number of open resources to the minimum. 

This pool can be utilized successfully in large production installations as it tries to keep the number of open resources to the minimum, yet providing sufficient number of “hot” (open) resources to avoid open/close cost.

License
-------

OSI Approved 3 clause BSD License

Prerequisites
-------------

* Python 3.7+ (with queue)
* For psycopg2 connections: psycopg2 2.8.2+

Installation
------------

If prerequisites are met, you can install `queuepool` like any other Python package, using pip to download it from PyPI:

    $ pip install queuepool

or using `setup.py` if you have downloaded the source package locally:

    $ python setup.py build
    $ sudo python setup.py install
site-map-parser 0.3.9
Script/Library to read and parse sitemap.xml data
Requires Python: >=3.6

# Site Map Parser

Script and library which reads urls and converts to objects, allows exporting as CSV or JSON.

Handle sitemaps according to: https://www.sitemaps.org/protocol.html
   
## Installation

```
pip install site-map-parser
```

## Usage

### Script usage

```
smapper $url > /tmp/data.csv
```

Logs written to ~/sitemap_run.log

#### Arguments

| Argument | Options| Default  |  Information| 
| ----------- | ----------- | ----------- | -----------| 
| -h | N/A | N/A | Outputs argument data |
| url | e.g. `http://www.example.com` - `http://www.example.com/other_sitemap.xml` | N/A | Required - sitemap data to retrieve |
| -l, --log | `CRITICAL` or `ERROR` or `WARNING` or `INFO` or `DEBUG` | `INFO` | logs to sitemapper_run.log in install folder |
| -e, --exporter | `csv` or `json` | `csv` | Export format of the data |

### Library Usage

```python
from sitemapparser import SiteMapParser

sm = SiteMapParser('http://www.example.com')    # reads /sitemap.xml
if sm.has_sitemaps():
    sitemaps = sm.get_sitemaps() # returns iterator of sitemapper.Sitemap instances
else:
    urls = sm.get_urls()         # returns iterator of sitemapper.Url instances
```

#### Exporting

Two exporters are available: csv and json

##### CSV Exporter

```python
from sitemapparser.exporters import CSVExporter

# sm set as per earlier library usage example

csv_exporter = CSVExporter(sm)
if sm.has_sitemaps():
    print(csv_exporter.export_sitemaps())
elif sm.has_urls():
    print(csv_exporter.export_urls())
```

##### JSON Exporter

```python
from sitemapparser.exporters import JSONExporter

# sm set as per earlier library usage example

json_exporter = JSONExporter(sm)
if sm.has_sitemaps():
    print(json_exporter.export_sitemaps())
elif sm.has_urls():
    print(json_exporter.export_urls())
```