Skip to content

Commit 30b40f3

Browse files
committed
Initial commit
0 parents  commit 30b40f3

File tree

10 files changed

+572
-0
lines changed

10 files changed

+572
-0
lines changed

.devcontainer/Dockerfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.166.1/containers/python-3/.devcontainer/base.Dockerfile
2+
3+
# [Choice] Python version: 3, 3.9, 3.8, 3.7, 3.6
4+
ARG VARIANT="3"
5+
FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}
6+
7+
# [Option] Install Node.js
8+
ARG INSTALL_NODE="true"
9+
ARG NODE_VERSION="lts/*"
10+
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
11+
12+
# [Optional] If your pip requirements rarely change, uncomment this section to add them to the image.
13+
# COPY requirements.txt /tmp/pip-tmp/
14+
# RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \
15+
# && rm -rf /tmp/pip-tmp
16+
17+
# [Optional] Uncomment this section to install additional OS packages.
18+
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
19+
# && apt-get -y install --no-install-recommends <your-package-list-here>
20+
21+
# [Optional] Uncomment this line to install global node packages.
22+
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
23+
24+
USER vscode
25+
ENV PATH="~/.poetry/bin:$PATH" \
26+
POETRY_VIRTUALENVS_IN_PROJECT="true"
27+
28+
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -

.devcontainer/devcontainer.json

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.166.1/containers/python-3
3+
{
4+
"name": "Python 3",
5+
"build": {
6+
"dockerfile": "Dockerfile",
7+
"context": "..",
8+
"args": {
9+
// Update 'VARIANT' to pick a Python version: 3, 3.6, 3.7, 3.8, 3.9
10+
"VARIANT": "3.9",
11+
// Options
12+
"INSTALL_NODE": "false",
13+
"NODE_VERSION": "lts/*"
14+
}
15+
},
16+
17+
// Set *default* container specific settings.json values on container create.
18+
"settings": {
19+
"terminal.integrated.shell.linux": "/bin/bash",
20+
"python.pythonPath": "/usr/local/bin/python",
21+
"python.linting.enabled": true,
22+
"python.linting.pylintEnabled": true,
23+
"python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
24+
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
25+
"python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
26+
"python.linting.banditPath": "/usr/local/py-utils/bin/bandit",
27+
"python.linting.flake8Path": "/usr/local/py-utils/bin/flake8",
28+
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
29+
"python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
30+
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
31+
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint"
32+
},
33+
34+
// Add the IDs of extensions you want installed when the container is created.
35+
"extensions": [
36+
"ms-python.python"
37+
],
38+
39+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
40+
// "forwardPorts": [],
41+
42+
// Use 'postCreateCommand' to run commands after the container is created.
43+
// "postCreateCommand": "pip3 install --user -r requirements.txt",
44+
45+
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
46+
"remoteUser": "vscode"
47+
}

.gitignore

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
pip-wheel-metadata/
24+
share/python-wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
MANIFEST
29+
30+
# PyInstaller
31+
# Usually these files are written by a python script from a template
32+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
33+
*.manifest
34+
*.spec
35+
36+
# Installer logs
37+
pip-log.txt
38+
pip-delete-this-directory.txt
39+
40+
# Unit test / coverage reports
41+
htmlcov/
42+
.tox/
43+
.nox/
44+
.coverage
45+
.coverage.*
46+
.cache
47+
nosetests.xml
48+
coverage.xml
49+
*.cover
50+
*.py,cover
51+
.hypothesis/
52+
.pytest_cache/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
target/
76+
77+
# Jupyter Notebook
78+
.ipynb_checkpoints
79+
80+
# IPython
81+
profile_default/
82+
ipython_config.py
83+
84+
# pyenv
85+
.python-version
86+
87+
# pipenv
88+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
90+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
91+
# install all needed dependencies.
92+
#Pipfile.lock
93+
94+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
95+
__pypackages__/
96+
97+
# Celery stuff
98+
celerybeat-schedule
99+
celerybeat.pid
100+
101+
# SageMath parsed files
102+
*.sage.py
103+
104+
# Environments
105+
.env
106+
.venv
107+
env/
108+
venv/
109+
ENV/
110+
env.bak/
111+
venv.bak/
112+
113+
# Spyder project settings
114+
.spyderproject
115+
.spyproject
116+
117+
# Rope project settings
118+
.ropeproject
119+
120+
# mkdocs documentation
121+
/site
122+
123+
# mypy
124+
.mypy_cache/
125+
.dmypy.json
126+
dmypy.json
127+
128+
# Pyre type checker
129+
.pyre/

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"python.pythonPath": ".venv/bin/python"
3+
}

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 Artisan of Code
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# Conjecture
2+
3+
A pythonic assertion library.
4+
5+
## 🛠 Installing
6+
7+
### Poetry
8+
9+
```
10+
poetry add conjecture
11+
```
12+
13+
### pip
14+
15+
```
16+
pip install conjecture
17+
```
18+
19+
## 🎓 Usage
20+
21+
22+
### Basic
23+
24+
A basic assertion.
25+
26+
```pycon
27+
>>> import conjecture
28+
>>> assert 5 == conjecture.has(lambda v: v < 10)
29+
>>> assert 5 == conjecture.has(lambda v: v > 10)
30+
Traceback (most recent call last):
31+
File "<stdin>", line 1, in <module>
32+
AssertionError
33+
```
34+
35+
### Combined conjectures
36+
37+
Matching all conditions.
38+
39+
```pycon
40+
>>> import conjecture
41+
>>> assert 5 == conjecture.has(lambda v: v <= 5) & conjecture.has(lambda v: v => 5)
42+
>>> assert 6 == conjecture.has(lambda v: v <= 5) & conjecture.has(lambda v: v => 5)
43+
Traceback (most recent call last):
44+
File "<stdin>", line 1, in <module>
45+
AssertionError
46+
>>> assert 5 == conjecture.all_of(
47+
... conjecture.has(lambda v: v <= 5),
48+
... conjecture.has(lambda v: v => 5)
49+
... )
50+
>>> assert 6 == conjecture.all_of(
51+
... conjecture.has(lambda v: v <= 5),
52+
... conjecture.has(lambda v: v => 5)
53+
... )
54+
Traceback (most recent call last):
55+
File "<stdin>", line 1, in <module>
56+
AssertionError
57+
```
58+
59+
Matching any conditions.
60+
61+
```pycon
62+
>>> import conjecture
63+
>>> assert 0 == conjecture.has(lambda v: v == 5) | conjecture.has(lambda v: v == 0)
64+
>>> assert 5 == conjecture.has(lambda v: v == 5) | conjecture.has(lambda v: v == 0)
65+
>>> assert 6 == conjecture.has(lambda v: v == 5) | conjecture.has(lambda v: v == 0)
66+
Traceback (most recent call last):
67+
File "<stdin>", line 1, in <module>
68+
AssertionError
69+
>>> assert 5 == conjecture.any_of(
70+
... conjecture.has(lambda v: v == 5),
71+
... conjecture.has(lambda v: v == 0)
72+
... )
73+
>>> assert 6 == conjecture.any_of(
74+
... conjecture.has(lambda v: v == 5),
75+
... conjecture.has(lambda v: v == 0)
76+
... )
77+
Traceback (most recent call last):
78+
File "<stdin>", line 1, in <module>
79+
AssertionError
80+
```
81+
82+
### Negation
83+
84+
A negative assertion.
85+
86+
```pycon
87+
>>> import conjecture
88+
>>> assert 5 != conjecture.has(lambda v: v == 10)
89+
>>> assert 5 == ~conjecture.has(lambda v: v == 10)
90+
>>> assert 10 == ~conjecture.has(lambda v: v == 10)
91+
Traceback (most recent call last):
92+
File "<stdin>", line 1, in <module>
93+
AssertionError
94+
```
95+
96+
## ⚖️ Licence
97+
98+
This project is licensed under the [MIT licence](http://dan.mit-license.org/).
99+
100+
All documentation and images are licenced under the
101+
[Creative Commons Attribution-ShareAlike 4.0 International License][cc_by_sa].
102+
103+
[cc_by_sa]: https://creativecommons.org/licenses/by-sa/4.0/
104+
105+
## 📝 Meta
106+
107+
This project uses [Semantic Versioning](http://semver.org/).

0 commit comments

Comments
 (0)