semvec/pypi-packages huggingface dataset:
django-swapfield 0.1.1
Django field with automatic values swap
License: MIT
Keywords: Django,field,integer,swap

|Build Status|
django-swapfield
================

| Easy! When you use django-swapfield if the value is saved in other
  record, values are swapped! You can configure what
| conditions must be repeated in both records to make the change.

How to
======

| ~~~~ {.sourceCode .bash}
| $ pip install django-swapfield
| $ # Define a SwapIntegerField in your model with unique\_for\_fields
  param (fields coincidence to can swap values)
| $ # That SwapIntegerField can’t be a part of unique\_together or
  unique restriction.
| ~~~~

Uses e.g.
=========

-  Uniform number in sport team.
-  Race number in an athletic competition.
-  Any scenario when you want to swap values without reordering.

example
=======

| ~~~~ {.sourceCode .bash}
| from swapfield.fields import SwapIntegerField

| class Player(models.Model):
| name = models.CharField(max\_length=30)
| team = models.ForeignKey(Team)
| number = SwapIntegerField(unique\_for\_fields=[‘team’])
| # can swap “number” if “team” has the same value
| ~~~~

Available fields
================

-  SwapIntegerField

Method
======

-  Current status allow swap values if not exists
   unique/unique\_together restriction. First, get the registry (if
   exists)
   what contains the new value to assign it the old value from registry
   what currently is saving. When current registry is
   saved, replace the other registry with old value.
-  In next versions, other method will be used when exists
   unique/unique\_together restriction.

to-do list
==========

-  [ ] Two or more django-swapfield in the same object.
-  [ ] Alternative method when exists unique/unique\_together
   restriction
-  [ ] Friendly validation error with Django Admin (no Fatal error)
-  [ ] Abstract django-swap-field
-  [ ] SwapCharField
-  [x] Tests for functionality
-  [ ] Tests for migrations
-  [ ] Config setting to choose swap value when a new record (not
   edited) get a value that exists in database: choose the
   max value +1 or the first available.

.. |Build Status| image:: https://travis-ci.org/SRJ9/django-swapfield.svg?branch=master
   :target: https://travis-ci.org/SRJ9/django-swapfield
Flask-request-params 0.3.0
Flask-request-params provides Rails-like interface to HTTP Request Parameters for Flask.
License: MIT
Keywords: flask

=====================
Flask-request-params
=====================

.. image:: https://travis-ci.org/bluele/Flask-request-params.svg?branch=master
    :target: https://travis-ci.org/bluele/Flask-request-params


Flask-request-params provides Rails-like interface to HTTP Request Parameters for Flask.

Supports mixed parameters(GET, POST, POST-JSON), `Rails Strong_Parameters <https://github.com/rails/strong_parameters>`_.

Documents are `here <http://flask-request-params.readthedocs.org/en/latest/>`_.


Installation
------------
To install Flask-request-params, simply::

    pip install flask-request-params


Or alternatively, you can download the repository and install manually by doing::

    git clone git@github.com:bluele/flask-request-params.git
    cd flask-request-params
    python setup.py install



Examples
--------

See `examples <https://github.com/bluele/Flask-request-params/tree/master/examples>`_ for more code.

**Client code**

::

    # support hash type
    $ curl -X POST http://localhost:5000/echo/user -d 'user[name]=john&user[password]=pass'
    {
      "path": "user",
      "user": {
        "name": "john",
        "password": "pass"
      }
    }

    # support array type
    $ curl -X POST http://localhost:5000/echo/lang -d 'languages[]=python&languages[]=golang'
    {
      "path": "lang",
      "languages": [
        "python",
        "golang"
      ]
    }

    # support strong_parameters
    $ curl -X POST http://localhost:5000/user -d 'user[name]=bluele&user[password]=password'
    {
      "name": "bluele",
      "password": "password"
    }


**Server code**

::

    from flask import Flask, request, render_template, jsonify
    from flask_request_params import bind_request_params


    app = Flask(__name__)
    app.secret_key = 'secret'
    # bind rails like params to request.params
    app.before_request(bind_request_params)

    # just return request.params
    @app.route('/echo/<path>', methods=['GET', 'POST'])
    def echo(path):
        return jsonify(request.params)

    @app.route('/user', methods=['POST'])
    def create_user():
        user = request.params.require('user').permit('name', 'password')
        # do something
        return jsonify(user)

    # serve at localhost:5000
    app.run(debug=True)
libxd 0.0.1
Personal Python package for some useful functions
License: MIT
Keywords: libxd

# libxd

## 函数列表

### 1. 给出文件路径获得去掉了扩展名的文件名

```python
from libxd.io import FileUtils

path = '/path/to/index.html'
FileUtils.file_name(path)  # result is index
```
pock 0.0.6
A python mocking framework.
License: MIT

Pock
====

.. image:: https://travis-ci.org/atbentley/pock.svg?branch=master
  :target:  https://travis-ci.org/atbentley/pock

.. image:: https://coveralls.io/repos/github/atbentley/pock/badge.svg?branch=master
  :target: https://coveralls.io/github/atbentley/pock?branch=master

Pock is a mocking framework for Python that makes creating complex test behaviour a breeze. See the `documentation <http://pock.bentley.codes>`_ for more information.

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

.. code-block::

  pip install pock


Usage
-----

Create a mock and add some basic behaviour:

.. code-block:: python

  from pock import mock, when, verify

  my_mock = mock()

  when(my_mock).greet('Andrew').then_return('Hi, Andrew')
  my_mock.greet('Andrew')  # 'Hi, Andrew'
  verify(my_mock).greet('Andrew')


Testing
-------

.. code-block::

  pip install plank
  plank install_requirements
  plank tests


License
-------

MIT