semvec/pypi-packages huggingface dataset:
sautils 0.4.1
Various SQLAlchemy utilities
License: BSD

Various SQLAlchemy utilities which are a little specific to be proposed to
main SQLAlchemy distribution.

Currently the following features are supported:

  - insert_from_select(table, select) -- adapted from corresponding SQLAlchemy
    example (all copyrights goes to @zzzeek)

  - upsert_from_select(table, select) -- upsert via insert from select with left
    join on target table

  - upsert(table, **values) -- upsert of values

  - sqltype(name) -- shortcut for defining ad-hoc types
pluck 0.2
Plucks values from an iterable.
License: BSD

pluck: Quickly pluck "fields" from a list of values
===================================================

.. image:: https://travis-ci.org/nvie/pluck.png
   :target: https://travis-ci.org/nvie/pluck


pluck is the simplest way of plucking "fields" from an iterable of values.
"Fields" are either ``item.field`` or ``item[field]``.  Pluck tries both,
in that order.  If nothing is found, and no default value is specified, it
throws an exception.


Usage
=====

The package consists of one module consisting of two functions::

   from pluck import pluck, ipluck

``ipluck`` is just the iterable version of ``pluck``.  Use it like this::

   pluck(iterable, key)

or::

   pluck(iterable, *keys)


Examples
========

A simple example first.  Say you have a list of datetimes::

   >>> from pluck import pluck
   >>> dates = [
   ...     datetime(2012, 10, 22, 12, 00),
   ...     datetime(2012, 10, 22, 15, 14),
   ...     datetime(2012, 10, 22, 21, 44),
   ... ]
   >>> pluck(dates, 'day')
   [22, 22, 22]
   >>> pluck(dates, 'hour')
   [12, 15, 21]

It also works on dictionary-like access (``__getitem__``)::

    >>> objects = [
    ...      {'id': 282, 'name': 'Alice', 'age': 30, 'sex': 'female'},
    ...      {'id': 217, 'name': 'Bob', 'age': 56},
    ...      {'id': 328, 'name': 'Charlie', 'age': 56, 'sex': 'male'},
    ... ]
    >>> pluck(objects, 'name')
    ['Alice', 'Bob', 'Charlie']
    >>> pluck(objects, 'age')
    [30, 56, 56]

You can also combine these into a single pluck::

   >>> pluck(objects, 'name', 'age')
   [('Alice', 30), ('Bob', 56), ('Charlie', 56)]


Defaults
========

You can specify default values, too.  By default, ``pluck`` will throw an
exception when a "field" does not exist::

   >>> pluck(objects, 'sex')
   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
     File "pluck.py", line 104, in pluck
         return list(ipluck(iterable, *keys, **kwargs))
     File "pluck.py", line 49, in getter
         raise ValueError('Item %r has no attr or key for %r' % (item, key))
     ValueError: Item {'age': 56, 'id': 217, 'name': 'Bob'} has no attr or key for 'sex'

To instead fill these places with a default value, use this::

   >>> pluck(objects, 'sex', default='unknown')
   ['female', 'unknown', 'male']

When you specify multiple keys, you need to use the ``defaults`` (plural!)
keyword argument instead::

   >>> pluck(objects, 'name', 'sex', defaults={'sex': 'unknown'})
   [('Alice', 'female'), ('Bob', 'unknown'), ('Charlie', 'male')]


Iterator, rather?
=================

Use ``ipluck`` if you'd rather wanna have an iterator::

    >>> from pluck import ipluck
    >>> ipluck(large_stream_of_items, 'name')
    <itertools.imap object at 0x10c7515d0>

``pluck`` is equivalent to ``list(ipluck(...))``.


History
=======

0.2 (2012-10-22)
------------------
   - Add Python 3 compatibility
   - Improve documentation

0.1 (2012-10-22)
------------------
   - Initial release.
qiita 0.1.1
Qiita api wrapper for Python
License: BSD

Qiita
=====

Python wrapper for Qiita API v1.

.. image:: https://secure.travis-ci.org/heavenshell/py-qiita.png

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

::

  $ virtualenv --distribute qiita_sample
  $ source qiita_sample/bin/activate
  $ cd qiita_sample
  $ pip install qiita

Qiita depends on `Requests <http://docs.python-requests.org/en/latest/index.html>`_.


Usage
-----

Get user's items
~~~~~~~~~~~~~~~~

::

  # -*- coding: utf-8 -*-
  from qiita import Items

  client = Items()
  items = client.user_items('heavenshell')


Get tag's items
~~~~~~~~~~~~~~~

::

  # -*- coding: utf-8 -*-
  from qiita import Tags

  client = Tags()
  items = client.tag_items('python')

Get a specified item with comments and raw markdown content
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

::

  # -*- coding: utf-8 -*-
  from qiita import Items

  client = Items()
  item_uuid = '1234567890abcdefg'
  items = client.item(item_uuid)


Authenticated requests
----------------------

Login with "username & password" or "token"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

::

  # -*- coding: utf-8 -*-
  from qiita import Client

  client = Client(url_name='heavenshell', password='mysecret')
  token = client.token # => contains token
  # or
  client = Client(token='myauthtoken')

Get my items
~~~~~~~~~~~~

::

  # -*- coding: utf-8 -*-
  from qiita import Items

  client = Client(token='myauthtoken')
  items = client.user_item()

Post/Update/Delete an item
~~~~~~~~~~~~~~~~~~~~~~~~~~

::

  # -*- coding: utf-8 -*-
  from qiita import Items

  client = Client(token='myauthtoken')
  params = {
    'title': 'Hello',
    'body': 'markdown text',
    'tags': [{name: 'python', versions: ['2.6', '2.7']}],
    'private': False
  }
  # post
  item = client.post_item(params)

  # update
  params['title'] = 'modified'
  client.update_item(item['uuid'], params)

  # delete
  client.delete_item(item['uuid'])

Stock/Unstock item
~~~~~~~~~~~~~~~~~~

::

  # -*- coding: utf-8 -*-
  from qiita import Items

  client = Items(token='myauthtoken')
  item_uuid = '1489e2b291fed74713b2'
  # Stock
  client.stock_item(item_uuid)

  # Unstock
  client.unstock_item(item_uuid)

Contributing
------------
1. Fork it
2. Create your feature branch (git checkout -b my-new-feature)
3. Commit your changes (git commit -am 'Add some feature')
4. Push to the branch (git push origin my-new-feature)
5. Create new Pull Request