高级类型:UniqList和ImmutableDict
nicetypes的Python项目详细描述
#python3:immutabledict和uniqlist的高级类型
>fronicetypeinimpimpimpimpimpimpimtabledict
froniceintimtabledict=immutabledict({“foo”:1,“bar”:从nicetypentimpimpimpimpimpimpimtabledict
frofrofrofrofront/>front/>2})
打印(冻结的dict)
不可变的dict({'foo':1,'bar':2})
frozen\u dict[“foo”]=3
tracebackback(最近一次调用最后一次):
file”<;stdin>;“,第1行,in<;module>;
typeerror:'immutabledict'对象不支持项分配
``
`` python
从nicetypes导入uniqlist
unql=uniqlist([1,2,2,2,3,
print(unql)
uniqlist([1,2,2,3])
unql.append(4)
unql.append(4)
print(unql)
uniqlist([1,2,3,3,4]
uniqlist([1,2,3,3,4])
````
usinge niceetypes
这个模块是开发的uniqlist.append(4)
prinprint(unql)
prinprint(unql)
在fedora 25机器上使用python3.5.3,但理论上它应该在**任何带有python3解释器的系统上运行**。如果在您的平台上不起作用,请毫不犹豫地报告任何问题。但是,此模块不打算在python2上工作。
Linux用户应该使用他们的包管理器。或者,您可以遵循[官方站点文档](https://pip.pypa.io/en/stable/installing/)。然后,确保安装了virtualenv。大多数linux发行版都提供了一个virtualenvwrapper包,使virtualenvs易于使用。否则,您可能会阅读[本文档](https://virtualenv.pypa.io/en/stable/)。
`` bash
mkvirtualenv-p python3 foobar
应该通过前面的命令自动完成workon foobar
pip install nicetypes
使用
pip install-u nicetypes
```
首先,抓住皮普。然后,使用管理员权限直接在系统上安装nicetypes,而不是将其安装在一个独立的virtualenv中。
``bash
sudo pip3 install nicetypes
然后您可以直接从github下载源代码。但是,您应该明白,如果选择此方法,您将需要独自处理更新和系统集成。
确保安装了以下软件包:
-python3,
-git,
-virtualenv.
2。克隆此GitHub存储库并输入存储库。
3。创建python3 virtualenv并激活它。
4.用“pip install-r dev requirements.txt `
<35<35<35<
别忘了[pep20](https://www.python.org/dev/peps/pep-0020/<35
`````
`>pylint--rcfile=.pylintrc src src src/nicettypes
```
<
<
35j.单元测试
确保所有代码都包含在单元测试中。使用[给定时间然后](https://github.com/cucumber/cucucumber/wiki/given-when-then)结构来增加测试的可读性。避免为断言导入外部库,而是使用unittest方法。运行测试并使用以下命令检查覆盖率:
```
py.test--verbose--cov=src--cov fail under=100
````
连续集成
此模块使用[travis管道](https://travis-ci.org/tvuillemin/nicetypes)进行连续集成。在github上推送git分支时,它执行以下操作:
1。检查样式指南,
2。运行单元测试并检查覆盖率,
3。如果是标记的发布,部署到pypi。
erol](https://github.com/brouberol)
-[guillaume bouchard](https://github.com/guibou)
许可证
此模块在麻省理工学院许可证下获得许可证-有关详细信息,请参阅许可证文件。
froniceintimtabledict=immutabledict({“foo”:1,“bar”:从nicetypentimpimpimpimpimpimpimtabledict
frofrofrofrofront/>front/>2})
打印(冻结的dict)
不可变的dict({'foo':1,'bar':2})
frozen\u dict[“foo”]=3
tracebackback(最近一次调用最后一次):
file”<;stdin>;“,第1行,in<;module>;
typeerror:'immutabledict'对象不支持项分配
``
`` python
从nicetypes导入uniqlist
unql=uniqlist([1,2,2,2,3,
print(unql)
uniqlist([1,2,2,3])
unql.append(4)
unql.append(4)
print(unql)
uniqlist([1,2,3,3,4]
uniqlist([1,2,3,3,4])
````
usinge niceetypes
这个模块是开发的uniqlist.append(4)
prinprint(unql)
prinprint(unql)
在fedora 25机器上使用python3.5.3,但理论上它应该在**任何带有python3解释器的系统上运行**。如果在您的平台上不起作用,请毫不犹豫地报告任何问题。但是,此模块不打算在python2上工作。
Linux用户应该使用他们的包管理器。或者,您可以遵循[官方站点文档](https://pip.pypa.io/en/stable/installing/)。然后,确保安装了virtualenv。大多数linux发行版都提供了一个virtualenvwrapper包,使virtualenvs易于使用。否则,您可能会阅读[本文档](https://virtualenv.pypa.io/en/stable/)。
`` bash
mkvirtualenv-p python3 foobar
应该通过前面的命令自动完成workon foobar
pip install nicetypes
使用
pip install-u nicetypes
```
首先,抓住皮普。然后,使用管理员权限直接在系统上安装nicetypes,而不是将其安装在一个独立的virtualenv中。
``bash
sudo pip3 install nicetypes
然后您可以直接从github下载源代码。但是,您应该明白,如果选择此方法,您将需要独自处理更新和系统集成。
确保安装了以下软件包:
-python3,
-git,
-virtualenv.
2。克隆此GitHub存储库并输入存储库。
3。创建python3 virtualenv并激活它。
4.用“pip install-r dev requirements.txt `
<35<35<35<
别忘了[pep20](https://www.python.org/dev/peps/pep-0020/<35
`````
`>pylint--rcfile=.pylintrc src src src/nicettypes
```
<
<
35j.单元测试
确保所有代码都包含在单元测试中。使用[给定时间然后](https://github.com/cucumber/cucucumber/wiki/given-when-then)结构来增加测试的可读性。避免为断言导入外部库,而是使用unittest方法。运行测试并使用以下命令检查覆盖率:
```
py.test--verbose--cov=src--cov fail under=100
````
连续集成
此模块使用[travis管道](https://travis-ci.org/tvuillemin/nicetypes)进行连续集成。在github上推送git分支时,它执行以下操作:
1。检查样式指南,
2。运行单元测试并检查覆盖率,
3。如果是标记的发布,部署到pypi。
erol](https://github.com/brouberol)
-[guillaume bouchard](https://github.com/guibou)
许可证
此模块在麻省理工学院许可证下获得许可证-有关详细信息,请参阅许可证文件。