Skip to content

Commit 5f9c8e3

Browse files
committed
Rebuild blackjack code base (#97)
Merge pull request #97 from d-Rickyy-b/dev
2 parents 02940ff + 33e9c46 commit 5f9c8e3

File tree

93 files changed

+3313
-1967
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+3313
-1967
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3+
4+
name: Run tests and lint
5+
6+
on:
7+
push:
8+
branches: [ master, dev ]
9+
pull_request:
10+
branches: [ master ]
11+
12+
jobs:
13+
test-and-lint:
14+
15+
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
python-version: [ '3.6', '3.7', '3.8', '3.9' ]
19+
20+
steps:
21+
- uses: actions/checkout@v2
22+
- name: Set up Python ${{ matrix.python-version }}
23+
uses: actions/setup-python@v2
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
- name: Install dependencies
27+
run: |
28+
python -m pip install --upgrade pip
29+
python -m pip install flake8 pytest coveralls
30+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
31+
- name: Lint with flake8
32+
run: |
33+
# stop the build if there are Python syntax errors or undefined names
34+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
35+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
36+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
37+
- name: Test with pytest
38+
run: |
39+
coverage run --omit='*/virtualenv/*,*/site-packages/*' -m pytest
40+
- name: Publish coverage
41+
env:
42+
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
43+
run: |
44+
coveralls

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ celerybeat-schedule
8181
# virtualenv
8282
venv/
8383
ENV/
84+
.venv
8485

8586
# Spyder project settings
8687
.spyderproject

.travis.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
language: python
22
sudo: require
33
python:
4-
- "3.4"
54
- "3.6"
5+
- "3.7"
6+
- "3.8"
67
# command to install dependencies
78
install:
8-
- pip install python-telegram-bot --upgrade
9+
- pip install -r requirements.txt
10+
- pip install coveralls
911

1012
# command to run tests
1113
script:
12-
- pwd
1314
- python -m compileall ./
15+
- coverage run --omit='*/virtualenv/*,*/site-packages/*,*/tests/*' -m unittest discover -s . -v -p "*_test.py"
1416

15-
# pychecker doesn't work as expected for me. Until now i'm going with just syntax checking all the files.
16-
# - pychecker ./*.py
17+
# create coverage for one python version
18+
after_success:
19+
- test $TRAVIS_PYTHON_VERSION == "3.8" && coveralls
1720

1821
notifications:
1922
email: false

README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
1-
[![Build Status](https://travis-ci.org/d-Rickyy-b/Python-BlackJackBot.svg?branch=master)](https://travis-ci.org/d-Rickyy-b/Python-BlackJackBot) [![Code Health](https://landscape.io/github/d-Rickyy-b/Python-BlackJackBot/master/landscape.svg?style=flat)](https://landscape.io/github/d-Rickyy-b/Python-BlackJackBot/master)
1+
[![Build Status](https://travis-ci.com/d-Rickyy-b/Python-BlackJackBot.svg?branch=master)](https://travis-ci.com/d-Rickyy-b/Python-BlackJackBot)
2+
[![Coverage Status](https://coveralls.io/repos/github/d-Rickyy-b/Python-BlackJackBot/badge.svg?branch=rebuild)](https://coveralls.io/github/d-Rickyy-b/Python-BlackJackBot?branch=rebuild)
3+
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/12996d68fc0f436085221ac6b1f525f9)](https://www.codacy.com/manual/d-Rickyy-b/Python-BlackJackBot?utm_source=github.com&utm_medium=referral&utm_content=d-Rickyy-b/Python-BlackJackBot&utm_campaign=Badge_Grade)
24

35
# Python-BlackJackBot
46

57
This is the code for my Telegram Bot with which you can play the game Black Jack. You can find it here: https://telegram.me/BlackJackBot
68

7-
The main file, which needs to be executed is 'main.py'.
8-
You need to put your API-Token in the right place in the main file.
9+
The main file, which needs to be executed is 'main.py'. Please create a copy of the config.sample.py, name it config.py and enter the config data (e.g. bot
10+
token).
911

10-
## Other Software
12+
## Setup
1113

1214
The bot uses the [python-telegram-bot](https://python-telegram-bot.org/) framework to make Telegram API calls. You can install it like that:
1315

14-
``pip install python-telegram-bot``
16+
``pip install -r requirements.txt``
1517

1618
## Database
1719

18-
The bot uses a SQLite database. The database file is in the "database" directory. It is called 'users.db'. The database gets auto-generated, if it doesn't exist. Make sure the program has write access to the database directory.
20+
The bot uses a SQLite database. The database file is in the "database" directory. It is called 'users.db'. The database gets auto-generated, if it doesn't exist. Make sure the program has write access to the database directory.

blackjack/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# -*- coding: utf-8 -*-

blackjack/errors/__init__.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# -*- coding: utf-8 -*-
2+
3+
from .playerbustedexception import PlayerBustedException
4+
from .gamealreadyrunningexception import GameAlreadyRunningException
5+
from .playeralreadyexistingexception import PlayerAlreadyExistingException
6+
from .gamenotrunningexception import GameNotRunningException
7+
from .maxplayersreachedexception import MaxPlayersReachedException
8+
from .notenoughplayersexception import NotEnoughPlayersException
9+
from .nextplayerisdealerexception import NextPlayerIsDealerException
10+
from .insufficientpermissionsexception import InsufficientPermissionsException
11+
from .noplayersleftexception import NoPlayersLeftException
12+
from .playergot21exception import PlayerGot21Exception
13+
14+
__all__ = ['PlayerBustedException', 'GameAlreadyRunningException', 'PlayerAlreadyExistingException', 'MaxPlayersReachedException', 'GameNotRunningException',
15+
'NotEnoughPlayersException', 'NextPlayerIsDealerException', 'InsufficientPermissionsException', 'NoPlayersLeftException', 'PlayerGot21Exception']
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# -*- coding: utf-8 -*-
2+
3+
4+
class GameAlreadyRunningException(Exception):
5+
pass
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# -*- coding: utf-8 -*-
2+
3+
4+
class GameNotRunningException(Exception):
5+
pass
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# -*- coding: utf-8 -*-
2+
3+
4+
class InsufficientPermissionsException(Exception):
5+
pass
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# -*- coding: utf-8 -*-
2+
3+
4+
class MaxPlayersReachedException(Exception):
5+
pass

0 commit comments

Comments
 (0)