Skip to content

Commit 478f7fb

Browse files
committed
Blacking code, fix pre-commit config
1 parent eadcc87 commit 478f7fb

50 files changed

Lines changed: 2772 additions & 1275 deletions

Some content is hidden

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

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ repos:
33
rev: stable
44
hooks:
55
- id: black
6-
default_language_version:
6+
default_language_version:
77
python: python3.6

.pyproject.toml

Lines changed: 0 additions & 16 deletions
This file was deleted.

Pipfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ url = "https://pypi.org/simple"
44
verify_ssl = true
55

66
[dev-packages]
7+
black = "*"
78

89
[packages]
910
future = "==0.17.1"
@@ -36,3 +37,6 @@ PyYAML = "==5.1.2"
3637

3738
[requires]
3839
python_version = "3.6"
40+
41+
[pipenv]
42+
allow_prereleases = true

Pipfile.lock

Lines changed: 40 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tg_bot/__init__.py

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,28 @@
77

88
# enable logging
99
logging.basicConfig(
10-
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
11-
level=logging.DEBUG)
10+
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=logging.DEBUG
11+
)
1212

1313
LOGGER = logging.getLogger(__name__)
1414

1515
# if version < 3.6, stop bot.
1616
if sys.version_info[0] < 3 or sys.version_info[1] < 6:
17-
LOGGER.error("You MUST have a python version of at least 3.6! Multiple features depend on this. Bot quitting.")
17+
LOGGER.error(
18+
"You MUST have a python version of at least 3.6! Multiple features depend on this. Bot quitting."
19+
)
1820
quit(1)
1921

20-
ENV = bool(os.environ.get('ENV', False))
22+
ENV = bool(os.environ.get("ENV", False))
2123

2224
if ENV:
23-
TOKEN = os.environ.get('TOKEN', None)
25+
TOKEN = os.environ.get("TOKEN", None)
2426
try:
25-
OWNER_ID = int(os.environ.get('OWNER_ID', None))
27+
OWNER_ID = int(os.environ.get("OWNER_ID", None))
2628
except ValueError:
2729
raise Exception("Your OWNER_ID env variable is not a valid integer.")
2830

29-
MESSAGE_DUMP = os.environ.get('MESSAGE_DUMP', None)
31+
MESSAGE_DUMP = os.environ.get("MESSAGE_DUMP", None)
3032
OWNER_USERNAME = os.environ.get("OWNER_USERNAME", None)
3133

3234
try:
@@ -40,29 +42,36 @@
4042
raise Exception("Your support users list does not contain valid integers.")
4143

4244
try:
43-
WHITELIST_USERS = set(int(x) for x in os.environ.get("WHITELIST_USERS", "").split())
45+
WHITELIST_USERS = set(
46+
int(x) for x in os.environ.get("WHITELIST_USERS", "").split()
47+
)
4448
except ValueError:
4549
raise Exception("Your whitelisted users list does not contain valid integers.")
4650

47-
WEBHOOK = bool(os.environ.get('WEBHOOK', False))
48-
URL = os.environ.get('URL', "") # Does not contain token
49-
PORT = int(os.environ.get('PORT', 5000))
51+
WEBHOOK = bool(os.environ.get("WEBHOOK", False))
52+
URL = os.environ.get("URL", "") # Does not contain token
53+
PORT = int(os.environ.get("PORT", 5000))
5054
CERT_PATH = os.environ.get("CERT_PATH")
5155

52-
DB_URI = os.environ.get('DATABASE_URL')
53-
DONATION_LINK = os.environ.get('DONATION_LINK')
54-
LOAD = os.environ.get("LOAD", "").split(",") if "," in os.environ.get("LOAD", "") else os.environ.get("LOAD", "").split()
56+
DB_URI = os.environ.get("DATABASE_URL")
57+
DONATION_LINK = os.environ.get("DONATION_LINK")
58+
LOAD = (
59+
os.environ.get("LOAD", "").split(",")
60+
if "," in os.environ.get("LOAD", "")
61+
else os.environ.get("LOAD", "").split()
62+
)
5563
NO_LOAD = os.environ.get("NO_LOAD", "translation").split(",")
56-
DEL_CMDS = bool(os.environ.get('DEL_CMDS', False))
57-
STRICT_GBAN = bool(os.environ.get('STRICT_GBAN', False))
58-
WORKERS = int(os.environ.get('WORKERS', 8))
59-
BAN_STICKER = os.environ.get('BAN_STICKER', 'CAADAgADOwADPPEcAXkko5EB3YGYAg')
60-
ALLOW_EXCL = os.environ.get('ALLOW_EXCL', False)
61-
DEFAULT_CHAT_ID = os.environ.get('DEFAULT_CHAT_ID', None)
64+
DEL_CMDS = bool(os.environ.get("DEL_CMDS", False))
65+
STRICT_GBAN = bool(os.environ.get("STRICT_GBAN", False))
66+
WORKERS = int(os.environ.get("WORKERS", 8))
67+
BAN_STICKER = os.environ.get("BAN_STICKER", "CAADAgADOwADPPEcAXkko5EB3YGYAg")
68+
ALLOW_EXCL = os.environ.get("ALLOW_EXCL", False)
69+
DEFAULT_CHAT_ID = os.environ.get("DEFAULT_CHAT_ID", None)
6270
VERSION = __version__
6371

6472
else:
6573
from tg_bot.config import Development as Config
74+
6675
TOKEN = Config.API_KEY
6776
try:
6877
OWNER_ID = int(Config.OWNER_ID)
@@ -117,7 +126,10 @@
117126
SUPPORT_USERS = list(SUPPORT_USERS)
118127

119128
# Load at end to ensure all prev variables have been set
120-
from tg_bot.modules.helper_funcs.handlers import CustomCommandHandler, CustomRegexHandler
129+
from tg_bot.modules.helper_funcs.handlers import (
130+
CustomCommandHandler,
131+
CustomRegexHandler,
132+
)
121133

122134
# make sure the regex handler can take extra kwargs
123135
tg.RegexHandler = CustomRegexHandler

0 commit comments

Comments
 (0)