semvec/pypi-packages huggingface dataset:
django-easy-fixture 0.3.0
easy to create a django fixture
License: MIT
Keywords: fixture,django

django-easy-fixture
===================
.. figure:: https://travis-ci.org/allenling/django-easy-fixture.svg?branch=master

python2.7, python3.5

1.8<= Django <= 1.10

**install: pip install django-easy-fixture**

That is a easy, simple tool to help you to fill your fixture dict with some spam datas

Make your fixture dict to be a completely available django fixture that **you do not have to worry about any unqiue, unqie_together, just pk**

**The pk must be defined by you!**

**Just support all the fields defined by Django, and do not support any customization field.** 

**Maybe** support the customization field in the future.



1. get a fixture dict
---------------------

.. code-block:: python

   # in template.py
   fixtures_template={'auth.User': [{'pk': 1}]}

   # in other.py
   from easy_fixture.easy_fixture import EasyFixture
   from template import fixtures_template

   ef = EasyFixture(fixtures_template)
   fixtures_dict = ef.output()

2. use as a django app command
------------------------------

.. code-block:: python

   # in template.py
   fixtures_template = {'auth.User': [{'pk': 1}]}

   # in your settings.py
   INSTALLED_APPS = ('other apps',
                     'easy_fixture',
                     )
run make_fixture command
 
.. code-block:: python

   python manage.py make_fixture template.fixtures_template > /path/to/fixture.json

Must pass the module path and fixture variable, like module.to.fixture.Variable_name

**do not support old style**

.. code-block:: python

   python manage.py make_fixture template > /path/to/fixture.json

3. use in test
--------------

In your testCase, call EasyFixture.load_into_testcase in your setUpTestData, setUpClass, setUp or anywhere you want to load your fixture data. 

.. code-block:: python

   FIXTURE_DICT = {'auth.User': [{'pk': 1}]}

   class MyTestCase(TestCase):
       
       @classmethod
       def setUpTestData(cls):
           ef = EasyFixture(FIXTURE_DICT)
           ef.load_into_testcase()
           TestCase.setUpTestData()
       
       def tes_what_you_want(self):
           pass


**deprecate**

.. code-block:: python

   from easy_fixture.easy_fixture import FixtureFileGen

   class MyCase(TestCase):
      fixtures = FixtureFileGen(['my.fixture.template.module'])
env_utils 1.2.0
Utility functions to make it easier to work with os.environ
License: MIT

.. image:: https://travis-ci.org/yunojuno/python-env-utils.svg?branch=master
    :target: https://travis-ci.org/yunojuno/python-env-utils

.. image:: https://badge.fury.io/py/env_utils.svg
    :target: https://badge.fury.io/py/env_utils

.. image:: https://codecov.io/gh/yunojuno/python-env-utils/branch/master/graph/badge.svg
    :target: https://codecov.io/gh/yunojuno/python-env-utils

env utils
=========

This library extends the standard library's ``getenv`` function, allowing
you to coerce the return value into a type.

And that's it.

It's been released as a library because every project we have includes the
same requirements - read in environment variables, coerce them into the
correct type.

The problem is that environment variables are always stored as strings, but
Python will evaluate any string (even "") as True if cast to a boolean. This
is almost never the desired behaviour. If you set an environment variable to
"", "0" or "False", you want it to be False.

.. code:: python

    >>> os.environ['foo'] = "0"
    >>> val = os.getenv('foo')
    >>> val
    "0"
    >>> bool(val)
    True

``env_utils.get_env`` will coerce the value into the type you require. The package contains basic helper functions that coerce booleans, integers, decimals, floats, dates, lists and dictionaries.

.. code:: python

    # FOO=0
    >>> env_utils.get_env('FOO')
    "0"
    >>> env_utils.get_bool('FOO')
    False
    >>> env_utils.get_int('FOO')
    0

    # FOO=foo,bar
    >>> env_utils.get_list('FOO', separator=',')
    ['foo', 'bar']

    # FOO='{"foo": true}'
    >>> env_utils.get_dict('FOO')
    {'foo': True}

    # FOO=2016-11-23
    >>> env_utils.get_date('FOO')
    datetime.date(2016, 11, 23)

You can supply any function you like to coerce the value, e.g.:

.. code:: python

    >>> import os
    >>> os.getenv('FOO_NAME')
    'bob'
    >>> class Foo(object):
    ...     def __init__(self, name):
    ...         self.name = name
    >>> coerce = lambda x: Foo(x)
    >>> import env_utils
    >>> foo = env_utils.get_env('FOO_NAME', coerce=coerce)
    >>> foo.name
    >>> 'bob'


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

The library is available at pypi as 'env_utils', and can installed using pip::

    $ pip install env_utils

Tests
-----

The tests can be run using ``tox``:

.. code:: shell

    $ tox
case_class 0.0.8
Scala-like CaseClasses for Python
License: MIT

===============
PythonCaseClass
===============

.. image:: https://travis-ci.org/tkw1536/PythonCaseClass.svg?branch=master
   :alt: Build Status
   :target: https://travis-ci.org/tkw1536/PythonCaseClass

Zero-dependency scala-like case classes for Python 2 + 3.

Features
========

* Simple usage: Just inherit from ``case_class.CaseClass``
* Simple Installation: Zero dependencies
* plays well with inheritance
    * ``CaseClass`` and `AbstractCaseClass`` usable as a Mix-In
    * Case-to-case inheritance forbidden by default
        * use ``AbstractCaseClass`` to allow only subclasses to be instantiated
        * use ``InheritableCaseClass`` to override allow both super and
          subclasses to be instantiated.`
    * also plays well with Multiple Inheritance
      * ``super()`` calls still work as expected
* equality based on arguments
    * calls constructor only once per combination of arguments
    * works with ``==`` operator and ``is`` (referential equality) operator.
* automatic ``repr()`` function
* works in both Python 2 and Python 3!

Install
=======

This package is published on the
`Python Package Index <https://pypi.python.org/pypi/case_class>`_
Installation can be done simply via pip:

.. code:: bash

   pip install case_class

Alternatively, clone this repository and run setup.py:

.. code:: bash

   git clone https://github.com/tkw1536/PythonCaseClass
   python setup.py install

Examples
========

.. code:: python

   # Import the CaseClass module
   from case_class import CaseClass

   # Create a symbol case class
   class Symbol(CaseClass):
       def __init__(self, name):
           self.name = name

   # Create an instance
   x = Symbol("x")
   print(x)  # Symbol('x')

   # And create another one
   also_x = Symbol('x')
   print(x == also_x)  # equality via operator
   print(x is also_x)  # referential equality

Another example can be found in `example.py <example.py>`_.

License + Acknowledgements
==========================

This module and associated documentation is Copyright (c) Tom Wiesing 2016
and licensed under the MIT license, see `license <LICENSE>`_ for details. Small
parts of the code are adapted from the `six <https://pypi.python.org/pypi/six>`_
module, which is Copyright (c) 2010-2015 Benjamin Peterson.