steprate


Namesteprate JSON
Version 0.0.0 PyPI version JSON
download
home_page
Summary计算阶梯扣率或阶梯分成的一组方法
upload_time2022-12-13 07:21:56
maintainer
docs_urlNone
author
requires_python
license
keywords 阶梯扣率 阶梯分成 扣除 阶梯 扣率 分成 step rate
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # StepRate

Step Rate Compute

计算阶梯扣率或阶梯分成的一组方法

[Github地址](https://github.com/samjoeyang/steprate "Github")

> 为学习如何打包成pypi包编写的简易代码,仅供参考

## 参数

`amount` 待计算的金额
`rate` 阶梯扣率设定
`deduction` 扣除数

## 设定阶梯扣率的格式

数组的阶梯扣率,最后一个元素必须是包含有`-1`的`tuple`

```python
rate = [
        (10000,10),
        (20000,15),
        (30000,20),
        (40000,25),
        (50000,30),
        (-1,50),
    ]
```

## 计算类型

### 全量计算

`type=1`或者`type='full'`,返回值是一个数字

### 全量阶梯

`type=2`或者`type='stepfull'`,返回值是一个数字

### 溢出阶梯

`type=1`或者`type='stepover'`,返回值是一个数组,可以计算合计费用

### 设定计算类型的例子

```python
obj = steprate()
obj.type = 1
obj.type='full'
```

### 例子

```python
    rate = [
        (10000,10),
        (20000,15),
        (30000,20),
        (40000,25),
        (50000,30),
        (-1,50),
    ]
    
    obj = steprate()
    obj.compute(70001, rate, 10000,'stepover')
    rst = obj.result
    
    print(rst)
    
    # 计算结果 15000.5

    print(obj.results)

    # 计算结果 [1000.0, 1500.0, 2000.0, 2500.0, 3000.0, 5000.5]

```


            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "steprate",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "\u9636\u68af\u6263\u7387,\u9636\u68af\u5206\u6210,\u6263\u9664,\u9636\u68af,\u6263\u7387,\u5206\u6210,step,rate",
    "author": "",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/0c/d7/ea59b49dc68eeec7986556ca2216f7ea7bf163ff759ef0ad32a049aee042/steprate-0.0.0.tar.gz",
    "platform": null,
    "description": "# StepRate\n\nStep Rate Compute\n\n\u8ba1\u7b97\u9636\u68af\u6263\u7387\u6216\u9636\u68af\u5206\u6210\u7684\u4e00\u7ec4\u65b9\u6cd5\n\n[Github\u5730\u5740](https://github.com/samjoeyang/steprate \"Github\")\n\n> \u4e3a\u5b66\u4e60\u5982\u4f55\u6253\u5305\u6210pypi\u5305\u7f16\u5199\u7684\u7b80\u6613\u4ee3\u7801\uff0c\u4ec5\u4f9b\u53c2\u8003\n\n## \u53c2\u6570\n\n`amount` \u5f85\u8ba1\u7b97\u7684\u91d1\u989d\n`rate` \u9636\u68af\u6263\u7387\u8bbe\u5b9a\n`deduction` \u6263\u9664\u6570\n\n## \u8bbe\u5b9a\u9636\u68af\u6263\u7387\u7684\u683c\u5f0f\n\n\u6570\u7ec4\u7684\u9636\u68af\u6263\u7387\uff0c\u6700\u540e\u4e00\u4e2a\u5143\u7d20\u5fc5\u987b\u662f\u5305\u542b\u6709`-1`\u7684`tuple`\n\n```python\nrate = [\n        (10000,10),\n        (20000,15),\n        (30000,20),\n        (40000,25),\n        (50000,30),\n        (-1,50),\n    ]\n```\n\n## \u8ba1\u7b97\u7c7b\u578b\n\n### \u5168\u91cf\u8ba1\u7b97\n\n`type=1`\u6216\u8005`type='full'`\uff0c\u8fd4\u56de\u503c\u662f\u4e00\u4e2a\u6570\u5b57\n\n### \u5168\u91cf\u9636\u68af\n\n`type=2`\u6216\u8005`type='stepfull'`\uff0c\u8fd4\u56de\u503c\u662f\u4e00\u4e2a\u6570\u5b57\n\n### \u6ea2\u51fa\u9636\u68af\n\n`type=1`\u6216\u8005`type='stepover'`\uff0c\u8fd4\u56de\u503c\u662f\u4e00\u4e2a\u6570\u7ec4\uff0c\u53ef\u4ee5\u8ba1\u7b97\u5408\u8ba1\u8d39\u7528\n\n### \u8bbe\u5b9a\u8ba1\u7b97\u7c7b\u578b\u7684\u4f8b\u5b50\n\n```python\nobj = steprate()\nobj.type = 1\nobj.type='full'\n```\n\n### \u4f8b\u5b50\n\n```python\n    rate = [\n        (10000,10),\n        (20000,15),\n        (30000,20),\n        (40000,25),\n        (50000,30),\n        (-1,50),\n    ]\n    \n    obj = steprate()\n    obj.compute(70001, rate, 10000,'stepover')\n    rst = obj.result\n    \n    print(rst)\n    \n    # \u8ba1\u7b97\u7ed3\u679c 15000.5\n\n    print(obj.results)\n\n    # \u8ba1\u7b97\u7ed3\u679c [1000.0, 1500.0, 2000.0, 2500.0, 3000.0, 5000.5]\n\n```\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "\u8ba1\u7b97\u9636\u68af\u6263\u7387\u6216\u9636\u68af\u5206\u6210\u7684\u4e00\u7ec4\u65b9\u6cd5",
    "version": "0.0.0",
    "split_keywords": [
        "\u9636\u68af\u6263\u7387",
        "\u9636\u68af\u5206\u6210",
        "\u6263\u9664",
        "\u9636\u68af",
        "\u6263\u7387",
        "\u5206\u6210",
        "step",
        "rate"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "f0472a6fe5345ac00ff30f594361e45b",
                "sha256": "6ec6047f42ed325f7c0928b93b0623b1fad109a82fde51700e5cb9a6abe10820"
            },
            "downloads": -1,
            "filename": "steprate-0.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f0472a6fe5345ac00ff30f594361e45b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 2825,
            "upload_time": "2022-12-13T07:21:54",
            "upload_time_iso_8601": "2022-12-13T07:21:54.223186Z",
            "url": "https://files.pythonhosted.org/packages/ab/3c/015a06818b2e3744b889032dcae2a0083ede23b8c1acaf3175850dda56fc/steprate-0.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "ac55554462e938d8f48be81906df3c3b",
                "sha256": "73adbdc883b608fb66fa9807393094cb0bc9662cf1ce51e8ec0c5ed67e294123"
            },
            "downloads": -1,
            "filename": "steprate-0.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "ac55554462e938d8f48be81906df3c3b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 3681,
            "upload_time": "2022-12-13T07:21:56",
            "upload_time_iso_8601": "2022-12-13T07:21:56.655891Z",
            "url": "https://files.pythonhosted.org/packages/0c/d7/ea59b49dc68eeec7986556ca2216f7ea7bf163ff759ef0ad32a049aee042/steprate-0.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-13 07:21:56",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "steprate"
}
        
Elapsed time: 0.05107s