Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
Signed-off-by: 陈俊仁 <chen.junren@outlook.com>
  • Loading branch information
Chen-Junren committed Apr 27, 2024
1 parent 1f5f3b3 commit 9765186
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Weather.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import warnings as wr


_print = print
wr.filterwarnings("ignore")
locale.setlocale(locale.LC_ALL, "chinese")
if not os.path.exists("./log"):
Expand All @@ -42,6 +43,19 @@
)


def print(*args: any, **kwargs: any) -> any:
"""
Print only if DEBUG is True.
:param args: argument
:param kwargs: arguments
:return: print
"""
debug = read_settings()['debug']
if debug:
_print(*args, **kwargs)
return print


def read_settings(filename="./src/settings.txt"):
"""
Reads settings from a file and returns them as a dictionary.
Expand Down

0 comments on commit 9765186

Please sign in to comment.