semvec/pypi-packages huggingface dataset:
runlog 0.1.1
Managable detaied per-run logs for recurring jobs.
License: MIT

# Runlog

Managable detaied per-run logs for recurring jobs.

"Why did X happen the last time the Foo job ran for user Bar?"

"Job Y blew up when it ran yesterday. Where and why did it fail?"

Runlog provides a Python standard library logging-based, Redis-backed
way to store and access logs for the last N interesting runs of a job.
It's very simple to add detailed logging to code that runs inside
your recurring jobs without cluttering up your normal log files with
noisy, interleaving output.

It is very easy to add this logging to your code. An unambitious,
CLI allows you to list jobs, list previous and ongoing runs and to output
their logs. (Pipe them to your favorite unix utilities and enjoy.)

## Logging a Job

Job logging is done with normal log calls and a job-logging context
manager.

```python
import logging
from runlog import RunLogger

rl = RunLogger(redis_config={'host': 'localhost'},
               max_logs=10)

rl.debug("You will never see this.")

with rl.runlog('recurring-job-32') as logger:
    logger.setLevel(logging.DEBUG)
    rl.debug("You will see this in the log of a run of this job.")

rl.error("You don't see this either.")
```

Caveat: you will actually see all log messages if you add handlers
to the root logger. But if that is the case you are drinking from
the firehose and it's probably what you want to happen anyway.

## Finding The Output

Assuming you have a `.runlog.conf` that looks like this

```ini
[runlog]
max-logs: 10

[runlog-redis]
host: localhost
```

... you can find the logs for your job like this:

```bash
$ runlog list-jobs
recurring-job-32

$ runlog list-runs recurring-job-32
recurring-job-32 2014-04-16-04:35:23.562999
recurring-job-32 2014-04-15-04:33:11.463847
...

$ runlog logs recurring-job-32 2014-04-15-04:33:11.463847 2014-04-16-04:35:23.562999 
[ ... LOGS OF THE TWO RUNS SPECIFIED ... ]
```

Coming soon: range queries over log messages.

## Handling Errors

If something blows up inside the job-loggging context manager,
the traceback will be added to the log for the current run and
the exception will be re-raise. Errors will not be swallowed.

## Throwing Away Boring Logs

If your job turns out of be a no-op or is in some other way boring
to you, you can raise a `CancelLog` and just forget the whole thing.

```
with rl.runlog('job-127') as logger:
     things_processed = run_job(127)
     if things_processed == []:
         raise CancelLog()  # This run is forgotten.
```

CancelLog will be swallowed, but only _inside_ the context manager.

## Managing Data

Set up a dedicated Redis instance. Cap the memory. Throw away logs
that are not interesting. Look at data growth and adjust `max_logs`
or be more picky about which jobs you log. Archive really interesting
things and/or some random samples into some kind of cold storage.
kmeans 1.0.2
python wrapper for basic c implementation of kmeans
License: MIT

kmeans
===================
.. image:: https://travis-ci.org/numberoverzero/kmeans.png?branch=master
   :target: https://travis-ci.org/numberoverzero/kmeans

python wrapper for a basic c implementation of the k-means algorithm.

**Please review the limitations before using in any capacity where strict
accuracy is required.  There is no overflow detection, and negatives are not
supported.  tuple values cannot exceed 255.**

Installation
===================
::

    pip install kmeans

Usage
===================
::

    import kmeans
    means = kmeans.kmeans(points, k)

``points`` should be a list of tuples of the form ``(data, weight)`` where
``data`` is a list with length 3.

For example, finding four mean colors for a group of pixels::

    pixels = [
        [(15, 20, 25), 1],  # [(r,g,b), count]
        [(17, 31, 92), 5],
        # ... Lots more ...
    ]

    centers = kmeans.kmeans(pixels, 4)

In this case, the weights passed in may be the frequency of the pixels occuring
in an image, or some preference to pull the means towards a color.

Limitations
===================

All values must be **non-negative** **integers**, with the following
restrictions::

    r, g, b        [0, 255]        (uint8_t)
    count          [0, 4294967295] (uint32_t)
    maximum points 4294967296      (uint32_t)
    maximum means  256             (uint8_t)
    max iterations 65536           (uint16_t)
    max tolerance  65536           (uint16_t)


Inspiration
===================

http://charlesleifer.com/blog/using-python-to-generate-awesome-linux-desktop-themes/

I wanted to apply the implementation there to images much larger than 200x200.
Running a 4k x 3k image was approaching 60 seconds on a nice computer, so I
decided to rewrite the kmeans implementation in c.

Contributors
===================

* chinatsu_ - 32bit compatibility

.. _chinatsu: https://github.com/chinatsu
django-ajax-redirection 1.0.0
Useful wrappers/middleware for django
License: MIT

# Ajax redirection middleware for Django

[![Build Status](https://travis-ci.org/hysoftware/django-ajax-redirection.svg)](https://travis-ci.org/hysoftware/django-ajax-redirection)
[![Code Health](https://landscape.io/github/hysoftware/django-ajax-redirection/master/landscape.svg?style=flat)](https://landscape.io/github/hysoftware/django-ajax-redirection/master)

## What this?
This is a collection of useful middlware for Django with Ajax.
For example, [AngularJS](https://angularjs.org/) has URL routing subsystem,
which uses AJAX. In addition, it supports history push state. This mean, when
you access the website with ```https://example.com/#/login```, the addressbar
shows ```https://example.com/login```. However, accessing
```https://example.com/login```, you will get 404, because the HTTP request
is sent to ```https://example.com/login```, not ```https://example.com/#/login```.
To avoid this problem, we should redirect the route to
```https://example.com/#/login```, when accessing ```https://example.com/login```.

This module provides middleware to avoid the problem.

## How to use
### Middleware
1. Add ```dj_ajax_redirect.middleware.AjaxRedirectionMiddleware```
to ```MIDDLEWARE_CLASSES``` on your setting.

## Disable redirection
### Middleware
Just add a new item named "DISABLE_REDIRECT", of which type is list. i.e. just like this:

~~~~
DISABLE_REDIRECT = [
    r"^path_to_disable_redirect/disable$"
]
~~~~

Note that static files are already added to disable list. Therefore, you don't need to add
static urls.

In addition, *the strings are treated as regexp-s*.