GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Xython/auto-contract: Python - design by static contracts. 面向静态合同编程.

BranchesTags
Open more actions menu

Latest commit

 

History

5 Commits
5 Commits

Folders and files

NameName
Last commit message
Last commit date
.idea
.idea
 
 
contract
contract
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
ShowCaseClassContract.py
ShowCaseClassContract.py
 
 
ShowCaseClassContract.pyi
ShowCaseClassContract.pyi
 
 
ShowProtocolType.py
ShowProtocolType.py
 
 
another_contract_example.py
another_contract_example.py
 
 
another_contract_example.pyi
another_contract_example.pyi
 
 
my_contract_decls.py
my_contract_decls.py
 
 
setup.py
setup.py
 
 

Repository files navigation

auto-contract

Python - design by static contracts. 面向静态合同编程.

创建简便、可扩展的静态合同, 能够静态描述诸多编译期所能确定的合同关系:

项目实现了static contract generator, 使用case class合同作为案例.

满足case class协议的类型, 其构造方法的参数以及参数类型和类型成员声明对等.

@contract(Case)
class T:
    a: int
    b: int

在IDE/mypy等checker, 中可以发现T的构造方法的signature是(self: T, a: int, b: int).

安装

python setup.py install

使用

contract gen -c <定义contracts的python文件路径> -i <需要实施合同的python文件>

例子:

进入项目根目录, 为了处理ShowCaseClassContract.py:

contract gen -c contracts.py -i ShowCaseClassContract.py

About

Python - design by static contracts. 面向静态合同编程.

Resources

Readme
MIT license
Activity
Custom properties

Stars

2 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.