Skip to main content

Package of modules that encapsulate the if else multi-condition judgment

Project description

ProjectName

ProjectName and Description

Contributors Forks Stargazers Issues MIT License


Logo

"优雅的if-else替换"

优化并美观你的if-else
探索本项目的文档 »

查看Demo · 报告Bug · 提出新特性

目录

文件目录说明

conditionevaluatortool 
├── /conditionevaluator/
│  ├── __init__.py
│  ├── conditionevaluator.py
├── /test/
│  ├── __init__.py
│  ├── test.py
├── README.md
└── setup.py

上手指南

环境要求
  1. Python 3.7.0
安装依赖包
  1. pip install conditionevaluator
使用步骤
1.在需要做多条件判断的函数中引入装饰器
import conditionevaluator


@conditionevaluator
def doorType(door):
    """
    条件1
    :param door: 门类型  2  --> 双开门
    :return: bool
    """
    return "门类型错误"
2.其他函数调用
@doorType.register(1)
def params_door_type_1(door):
    """
    条件1
    :param door:
    :return: False
    """
    count = 1
    return count


@doorType.register(2)
def params_door_type_2(door):
    """
    条件2
    :param door:
    :return: True
    """
    count = 2
    return count
3.测试
if __name__ == '__main__':
    print(params_door_type_2(1))

# 结果输出
>>> 2

使用到的框架

暂无

版本控制

该项目使用Git进行版本管理。您可以在repository参看当前可用版本。

作者

cywhat

blog

鸣谢

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

conditionevaluator-1.0.1.tar.gz (4.1 kB view details)

Uploaded Source

File details

Details for the file conditionevaluator-1.0.1.tar.gz.

File metadata

  • Download URL: conditionevaluator-1.0.1.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.0

File hashes

Hashes for conditionevaluator-1.0.1.tar.gz
Algorithm Hash digest
SHA256 4ffd59b24fdae40f67dd2bbe653363952614542408af6a8d4a442c9874b43d7e
MD5 f99f34f12c9c962afab276122e5d5ef4
BLAKE2b-256 1ea2f1b303dc1841b3dac56c0fde85377e98ec0a7d8c5bd9df72821dc5522543

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page