semvec/pypi-packages huggingface dataset:
django-sa 0.1
Utility to convert a python script into a standalone django script
License: MIT
Keywords: django_sa,Django standalone

=============================
django-sa
=============================

Utility to convert a python script into a standalone django script.
For Python2/Python3 and Django 1.7+

Installation
----------

Install::

    pip install django-sa

Implementation Notes with Short Examples
----------

What happens when you try to run a script with django code in it?::

    python backup.py

.. code-block:: python

    Traceback (most recent call last):
    File "backup.py", line 6, in <module>
    ↓
    ↓
    ↓
    django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

django-sa way::

+ The script needs to be run from the project root directory
+ This uses the default django settings file which is in project_dir/settings.py

.. code-block:: python

    from django_sa import setup_django
    setup_django(__file__)

    from community.models import Bot
    bot = Bot.objects.get(pk=101)
    bot.backup(async=True)

Using a different django settings file:

.. code-block:: python

    from django_sa import setup_django
    setup_django(__file__, 'my_project.settings.production')

    from community.models import Bot
    bot = Bot.objects.get(pk=101)
    bot.backup(async=True)




* Version 0.1.

0.1 (2017-09-23)
++++++++++++++++++

* First release on PyPI.
targzstream 1.1
An extension to tarfile to allow adding files to a tarfile, without the need to write to disk first.  It also allows data to be compressed as it is added to the tarfile, for large files or data that might be generated on the fly.  Note that the output file object must support "seek()", hence the output must be an uncompressed tar file.  Currently, only GZip is supported for compression.
License: MIT
Keywords: tarfile,gzip,streaming

targzstream
===========

Version: 1.1

Summary
-------

This module provides an extension to the standard tarfile.TarFile class
which provides the ability to add files to a TarFile that are compressed
on-the-fly.  It will only work on an uncompressed output tarfile, since after
the data is written it will overwrite the header for the file with the
correct size data.

Limitations
-----------

- The object to which the tarfile is being written must support "seek()", so
  this cannot work over a socket, nor presumably with a compressed tarfile.
  *Note: re-compressing contents is not very useful.*

- The "close_gz_file" method will be called when calling "close" on the
  file stream.
  *Note: close_gz_file() and close_file() are interchangeable.*

- The constructor does not support reading, use the `open()` class method or
  use the base class `tarfile.TarFile` constructor.


Example Usage
-------------

.. code:: python

    #!/usr/bin/env python3
    import os, sys, shutil

    import targzstream

    # USAGE:  ./foo.py TARFILE INPUT [ INPUT2 ... ]
    #  Eg: ./foo.py myoutput.tar *.cpp *.h

    with targzstream.TarFile(sys.argv[1], mode='w') as tarball:
        for fname in sys.argv[2:]:
            st = os.stat(fname)
            with tarball.add_gz_file(name=fname + '.gz', mtime=st.st_mtime,
                                     uid=st.st_uid, gid=st.st_gid, mode=st.st_mode) as fout:
                # Copy the data.
                with open(fname, 'rb') as fin:
                    shutil.copyfileobj(fin, fout)
    # The end.

TODO
----

- Have *add_gz_file* handle the result of an *os.stat*.  Eg:

  .. code:: python

    with tarball.gz_file(name=fname + '.gz', stat=os.stat(fname)) as obj:
        with open(fname, 'rb') as fin:
            shutil.copyfileobj(fin, obj)

- Wrap *add_gz_file* and *close_gz_file* as a context manager.

  *Done.*

- Allow streaming uncompressed files, too.

  *Done.*
aiophue 0.0.2
Control Philips Hue using AsyncIO
License: MIT

# AioPhue

A port of [Phue](https://github.com/studioimaginaire/phue) to AsyncIO using 
AioHTTP to communicate with the bridge.

## Examples

AioPhue's API is similar to the one of the original library, but uses 
coroutines where possible / necessary.

```python 
from aiophue import AioBridge

b = await AioBridge.get_bridge("BRIDGE IP")
lights = await b.get_light_objects()
for light in lights:
    if await light.is_reachable():
        await light.turn_on()
```
akitchensyncio 0.1.1
Utility functions for asyncio which Stephan wished where in the stdlib but aren't.
License: MIT
Requires Python: ~=3.5
Keywords: asyncio

akitchensyncio
==============

Utility functions for asyncio which Stephan wished where in the stdlib
but aren't.

Requires a Python version which supports the ``async`` syntax (Python
3.5 or higher).

Installation
============

To install akitchensyncio, simply:

.. code:: bash

    $ pip install akitchensyncio

Function ``wrap_future(f)``
---------------------------

Takes a callable ``f`` which returns an awaitable, and returns a
callable which wraps the awaitable in ``asyncio.ensure_future``.

Can also be used as a decorator, especially with coroutine functions:

.. code:: python

    @wrap_future
    async def foo(arg1, arg2):
        ...

This is especially useful in combination with ``functools.lru_cache``.
Suppose you have a coroutine function which does an asynchronous query,
and you decide you want to introduce some caching. Just add two
decorators as follows.

.. code:: python

    @functools.lru_cache(100)
    @wrap_future
    async def do_some_query(arg1, arg2):
        ...

Function ``transform_future(f, awaitable)``
-------------------------------------------

Apply a function to the result of an awaitable, return a future which
delivers the result.

As an example, suppose you have a way to query addresses given names.
The API takes a bunch of names rather than a single one to reduce
overhead. However, to your callers you would like to hand out futures
representing results for individual names.

Essentially you want to turn a "future resulting in a dict" into a "dict
containing futures". Kind of the opposite of ``async.gather``.

.. code:: python

    from operator import itemgetter

    def query_addresses(names):
       fut = do_bunched_address_query(names)
       # fut is a single future which resolves
       # into a dict mapping names to addresses.
       return {name: transform_future(itemgetter(name), fut) for name in names}

Function ``iawait(awaitable)``
------------------------------

"Interactive await" -- Run default eventloop until awaitable has
completed. Mainly useful for interactive experimentation.

Then remove the "i" from ``iawait`` to get code which you can use in an
``async def`` function.

An alternative is to put this in your ``~/.pythonrc.py``:

.. code:: python

    def iawait(x):
        import asyncio
        loop = asyncio.get_event_loop()
        return loop.run_until_complete(x)

This will only import ``asyncio`` on first use of ``iawait``, so it
won't slow down your startup in general.
azure-cli-taskhelp 0.1.7
Microsoft Azure Command-Line Tools Taskhelp Command Module
License: MIT

Microsoft Azure CLI 'taskhelp' Command Module
=============================================

This package is for the 'taskhelp' module.
i.e. 'az taskhelp'




.. :changelog:

Release History
===============
0.1.7 (2017-09-22)
++++++++++++++++++
* minor fixes

0.1.6 (2017-08-28)
++++++++++++++++++
* minor fixes

0.1.5 (2017-07-07)
++++++++++++++++++
* minor fixes

0.1.4 (2017-06-21)
++++++++++++++++++
* No changes.

0.1.3 (2017-06-13)
++++++++++++++++++
* Minor fixes.

0.1.2 (2017-04-28)
+++++++++++++++++++++

* New packaging system.

0.1.1b4 (2017-04-03)
+++++++++++++++++++++

* Fix taskhelp module's code style (#2639)

0.1.1b3 (2017-02-22)
+++++++++++++++++++++

* Documentation updates.

0.1.1b2 (2017-01-30)
+++++++++++++++++++++

* Support Python 3.6.

0.1.1b1 (2017-01-17)
+++++++++++++++++++++

* Add help text for installing the module.

0.1.0b11 (2016-12-12)
+++++++++++++++++++++

* Preview release.