semvec/pypi-packages huggingface dataset:
django-dynamic-db-router 0.3.0
Simply route complex django queries to multiple databases.
License: MIT

.. image:: https://travis-ci.org/ambitioninc/django-dynamic-db-router.png
   :target: https://travis-ci.org/ambitioninc/django-dynamic-db-router

.. image:: https://coveralls.io/repos/ambitioninc/django-dynamic-db-router/badge.png?branch=develop
    :target: https://coveralls.io/r/ambitioninc/django-dynamic-db-router?branch=develop

.. image:: https://pypip.in/v/django-dynamic-db-router/badge.png
    :target: https://pypi.python.org/pypi/django-dynamic-db-router/
    :alt: Latest PyPI version


Django Dynamic DB Router
========================

Working with multiple databases within django is supported, but the
syntax requires peppering ``.using('my_database')`` throughout all
queries that need to be routed to different databases. This is
especially painful when trying to use libraries that were written
without multiple database support in mind. With this library, running
complex queries across different databases is as simple as:

.. code-block:: python

    from dynamic_db_router import in_database

    with in_database('non-default-db'):
        result = run_complex_query()

To set up you django project to be able to use this router, simply
``pip install django-dynamic-db-router`` and add
``DATABASE_ROUTERS=['dynamic_db_router.DynamicDbRouter']`` to your
Django settings.

Django Dynamic DB Router includes a number of additional features,
such as:

- Using ``in_database`` as a function decorator.
- Read and write protection controls.
- Load database configurations dynamically for the lifetime of the
  context manager.

For more information, and complete API documentation, see the docs,
linked below.


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

To install the latest release, type::

    pip install django-dynamic-db-router

To install the latest code directly from source, type::

    pip install git+git://github.com/ambitioninc/django-dynamic-db-router.git

Documentation
=============

Full documentation is available at http://django-dynamic-db-router.readthedocs.org

License
=======
MIT License (see LICENSE)
pathinby 0.1
Generate a hierarchy of the contents of a directory, Possibly outputting to a file
License: MIT

PathinBy
========
What is PathinBy
----------------

PathinBy is a tiny tool (used as a command line app or a Python module),
that converts your directory structure into a nice formatted tree to use in your blog posts or other illustrations.

*You need Python 2.7+ or Python 3.x to run this module*

How to use
^^^^^^^^^^
Imagine you have a directory structure like this:

.. image:: http://i.imgur.com/BlW8YHn.png
   :height: 263 px
   :width: 614 px

**As a Python module**
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code::

  >>> import pathinby
  >>> tree = pathinby.create_path('Cats')
  >>> print ('\n'.join(tree))


Here we've passed the directory name as an argument, there are also other arguments you can use to customize the behavior of the module, you can change those "|" and "-\|" and specify an output file. Check function documentation in the source code for more details of the usage.

*create_path()* returns an array to give more freedom of use in different situations.

This gives the output:

.. code::

  |-Big
  | |-Simba.bcat
  |-Sylvester.cat
  |-Tom.cat

|

**As a commend line tool**
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. code::

  $ pathinby -s Cats

This will traverse the "Cats" directory and print the contents tree to the terminal window, so running this command prints out the same directory tree like above.

the directory name can be a full or a relative path, like we did here.

By default, pathinby will do its work on the current directory if no directory is specified, in this case we specified "Cats".

The *s* option means "*show*", prints the output to the terminal.

Other option is

  -o {path to file} -> writes the output to the specified file

Use **pathinby -h** anytime for help on using the command.
checkrunner 0.0.2
A simple check runner for Python
License: MIT

python-checkrunner
==================
A very simple check runner for Python. I use this in projects where I need to run a suite of checks before performing some action (usually on invocation). In this way, the checks are kept together in one class, and no special logic is needed to run them all individually.

Supports Python 2 and 3 (tested on 2.7 and 3.4).

Usage
-----
Create a sub-class of CheckRunner and declare your checks::

    from checkrunner import CheckRunner

    class MyChecks(CheckRunner):
        @staticmethod
        def check_that_passes():
            return True, 'this check passed!'

        @staticmethod
        def check_that_fails():
            return False, 'this check failed!'

    print(MyChecks.run())
    # (False, ['this check failed!'])

    print(MyChecks.run(return_passed=True))
    # (False, ['this check passed!', 'this check failed!'])


When all checks pass it will return True with an empty list (unless you set return_passed)::

    from checkrunner import CheckRunner

    class MyChecks(CheckRunner):
        @staticmethod
        def check_that_passes():
            return True, 'this check passed!'

    print(MyChecks.run())
    # (True, [])


You can pass keyword arguments to the checks (they will be sent to each and every check)::

    from checkrunner import CheckRunner

    class MyChecks(CheckRunner):
        @staticmethod
        def check_foo(foo=None):
            if foo:
                return True, foo
            else:
                return False, foo

    print(MyChecks.run(foo='bar', return_passed=True))
    # (True, ['bar'])

Class methods also work::

    from checkrunner import CheckRunner


    class MyChecks(CheckRunner):
        foo = 'bar'

        @classmethod
        def check_class(cls):
            return True, cls.foo

    print(MyChecks.run(return_passed=True))
    # (True, ['bar'])

You can also return whatever you like in the second parameter, it does not have to be a string.


Testing
-------
Testing uses vagrant, tox and pytest. If you already have Vagrant, running the tests yourself is as simple as::

    $ vagrant up
    $ vagrant ssh
    (dev) vagrant@debian-8:~$ cd ~/src
    (dev) vagrant@debian-8:~/src$ tox