semvec/pypi-packages huggingface dataset:
pyilchimp 0.1.1
Wrapper library for Mailchimp's 3.0 API
License: MIT
Keywords: API RESTful wrapper Mailchimp EDM

pyilchimp
=========

Python wrapper for Mailchimp’s 3.0+ API

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

Install via pip:

::

    pip install pyilchimp

Usage
-----

Basic example
~~~~~~~~~~~~~

First connect to an account:

::

    from pyilchimp.mailchimp_manager import MailchimpManager

    mc = MailchimpManager(api_key='1qaz2wsx3edc4rfv5tgb667yhn', server='us1')

Now we can make requests:

::

    campaigns = mc.campaigns.all()

    recent_campaigns = mc.campaigns.all(filters={'sort_dir': 'DESC', 'count': 20})

Managers and resources
~~~~~~~~~~~~~~~~~~~~~~

If you’ve ever used Django’s ORM, Pyilchimp is structured in a similar
way. Resources have managers which can find and return objects, such as
a CampaignManager finding and returning campaigns. The name of the
manager is the lower case pluralised form of each resource and provides
a ``.get()`` and ``.all()`` method. ``get()`` can return a single
instance when provided an id, while ``all()`` will return all objects
matching a provided filter, or the last 10 by default.

Mailchimp actions
~~~~~~~~~~~~~~~~~

Mailchimp provides actions that do not fit into standard RESTful API
guidelines. Making use of these actions map to methods with the same
name for each resource.

::

    campaign = mc.campaigns.get('123123123c')
    campaign.pause()
feature-aggregation 0.3
Aggregate local features into global features
License: MIT

Local feature aggregation
=========================

This is a library that implements methods to aggregate local features
(mainly for multimedia) into a single global feature that can be used
easily with any classifier.

Dependencies
------------

The library depends on **scikit-learn** and all the feature aggregation
methods extend the scikit-learn BaseEstimator class.

Example
-------

.. code:: python

    import numpy as np
    from feature_aggregation import BagOfWords, FisherVectors

    X = np.random.rand(1000, 2)
    bow = BagOfWords(10)
    fv = FisherVectors(10)

    bow.fit(X)
    fv.fit(X)

    G1 = bow.transform(np.random.rand(10, 100, 2))
    G2 = fv.transform([
        np.random.rand(int(np.random.rand()*100), 2) for _ in range(10)
    ])

A more complex example using OpenCV to extract dense SIFT and then
transform them using Bag Of Words and train an SVM with chi square
additive kernel.

.. code:: python

    import numpy as np
    import cv2
    from sklearn.datasets import fetch_olivetti_faces
    from sklearn.kernel_approximation import AdditiveChi2Sampler
    from sklearn.metrics import classification_report
    from sklearn.pipeline import Pipeline
    from sklearn.svm import LinearSVC

    from feature_aggregation import BagOfWords

    def sift(*args, **kwargs):
        try:
            return cv2.xfeatures2d.SIFT_create(*args, **kwargs)
        except:
            return cv2.SIFT()

    def dsift(img, step=5):
        keypoints = [
            cv2.KeyPoint(x, y, step)
            for y in range(0, img.shape[0], step)
            for x in range(0, img.shape[1], step)
        ]
        features = sift().compute(img, keypoints)[1]
        features /= features.sum(axis=1).reshape(-1, 1)
        return features

    # Generate dense SIFT features
    faces = fetch_olivetti_faces()
    features = [
        dsift((x.reshape(64, 64, 1)*255).astype(np.uint8))
        for x in faces.data
    ]

    # Aggregate those features with bag of words using online training
    bow = BagOfWords(100)
    for i in range(2):
        for j in range(0, len(features), 10):
            bow.partial_fit(features[j:j+10])
    faces_bow = bow.transform(features)

    # Split in training and test set
    train = np.arange(len(features))
    np.random.shuffle(train)
    test = train[200:]
    train = train[:200]

    # Train and evaluate
    svm = Pipeline([("chi2", AdditiveChi2Sampler()), ("svm", LinearSVC(C=10))])
    svm.fit(faces_bow[train], faces.target[train])
    print(classification_report(faces.target[test], svm.predict(faces_bow[test])))
marbaloo_sqlalchemy 0.1.0
SQLAlchemy support for cherrypy.
License: MIT
Keywords: sqlalchemy cherrypy marbaloo marbaloo_sqlalchemy

Cherrypy Mako Template
======================

`sqlalchemy <http://www.sqlalchemy.org//>`_ support for cherrypy.

Installation
------------
::

    pip install marbaloo_sqlalchemy

Usage
-----

::

    # app.py
    import marbaloo_sqlalchemy
    import cherrypy
    import os
    from your_models import messages_model
    marbaloo_sqlalchemy.Plugin(cherrypy.engine).subscribe()
    cherrypy.tools.db = marbaloo_sqlalchemy.Tool()


    class Root(object):

        @cherrypy.expose
        def index(self):
            db_session1 = cherrypy.request.db['db1']
            db_session2 = cherrypy.request.db['db2']

            query = messages_model.insert().values(message='TESTMessage')
            db_session1.get_bind().execute(query)
            db_session1.commit()

            query = messages_model.insert().values(message='TESTMessage')
            db_session2.get_bind().execute(query)
            db_session2.commit()

    config = {
        'global': {
            'marbaloo_sqlalchemy_db': {
                'db1': {
                    'engine': {
                        'name_or_url': 'sqlite:///test1.db',
                        'echo': True,
                    },
                    'session': {
                        'expire_on_commit': True,
                        'autoflush': True,
                        'autocommit': False
                    }
                },
                'db2': {
                    'engine': {
                        'name_or_url': 'sqlite:///test2.db',
                        'echo': True,
                    },
                    'session': {
                        'expire_on_commit': True,
                        'autoflush': True,
                        'autocommit': False
                    }
                },
            }
        },
        '/': {
            'tools.db.on': True
        }
    }
    cherrypy.quickstart(Root(), '/', config)
marbaloo_schedule 0.1.0
Schedule support for cherrypy.
License: MIT
Keywords: schedule cherrypy marbaloo marbaloo_schedule

Marbaloo Schedule
=================

`Schedule <https://github.com/dbader/schedule>`_ support for cherrypy.


Installation
------------
::

    pip install marbaloo_schedule

Usage
-----

::

    # app.py
    import cherrypy
    import marbaloo_schedule

    schedule_plugin = marbaloo_schedule.Plugin(cherrypy.engine)
    schedule_plugin.subscribe()
    cherrypy.tools.schedule = marbaloo_schedule.Tool()


    class Root(object):
        job_started = False

        def do_jobs(self):
            import schedule
            # request level jobs
            # e.g: send emails
            # if my_job_completed:
            #     schedule.CancelJob
            pass

        @cherrypy.expose
        def index(self):
            schedule = cherrypy.request.schedule
            if self.job_started is False:
                schedule.every(5).seconds.do(self.do_jobs)
                return 'jobs started :)'
            else:
                return 'jobs already started!'

    config = {
        '/': {
            'tools.schedule.on': True
        }
    }
    cherrypy.quickstart(Root(), '/', config)

And for server level jobs something like this:

::


    import cherrypy
    import marbaloo_schedule

    schedule_plugin = marbaloo_schedule.Plugin(cherrypy.engine)
    schedule_plugin.subscribe()


    class Root:
        pass

    cherrypy.tree.mount(Root(), '/', {})
    cherrypy.engine.signals.subscribe()
    cherrypy.engine.start()


    def do_server_jobs():
        # server level jobs
        print('Job is Done')
    schedule_plugin.schedule.every(5).seconds.do(do_server_jobs)

    cherrypy.engine.block()

P.S: For stop jobs anywhere, use `schedule tags <https://schedule.readthedocs.io/en/stable/faq.html#clear-job-by-tag>`_.