pyblock/pybitblock/pblogo.py
GaltRanch cdfb258e95 Harden file handling, exception specificity, and API key management
- Replace open() without context managers with `with` statements across all modified files
- Change bare `except:` to `except Exception:` for safer exception handling
- Move Whale Alert API key from hardcoded to environment variable
- Use raw strings for ASCII art to prevent escape sequence issues
- Simplify image file handling in nodeconnection.py
- Convert unsafe shell subprocess calls to list-based format

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 11:52:26 -03:00

71 lines
2.2 KiB
Python

#Developer: Curly60e
#PyBLOCK its a clock of the Bitcoin blockchain.
import os
import json
from cfonts import render, say
def blogo():
if os.path.isfile('config/pyblocksettinconfig/gs.conf') or os.path.isfile('config/pyblocksettings.conf'): # Check if the file 'bclock.conf' is in the same folder
with open("config/pyblocksettings.conf", "r") as f:
settingsv = json.load(f) # Load the file 'bclock.conf'
settings = settingsv # Copy the variable pathv to 'path'
else:
settings = {"gradient":"", "design":"block", "colorA":"green", "colorB":"yellow"}
with open("config/pyblocksettings.conf", "w") as f:
json.dump(settings, f, indent=2)
if settings["gradient"] == "grd":
output = render('PyBLOCK', gradient=[settings['colorA'], settings['colorB']], align='left', font=settings['design'])
else:
output = render('PyBLOCK', colors=[settings['colorA'], settings['colorB']], align='left', font=settings['design'])
print(output)
def tick():
print("""\033[1;32;40m
@
@
@
@@
@@
@@@
@@@ @@.
@@@@@@@
@@@@@@@@
@@@@
@@@@
@ @@@@
@@@@@@@@
@@@@@@@@
@@@
@@@
@@
@@
@
@
\033[0;37;40m""")
def canceled():
print(r"""
) ( (
( ( ( /( ( )\ ) )\ )
)\ )\ )\()) )\ ( (()/( ( (()/(
(((_)((((_)( ((_)\ (((_) )\ /(_)) )\ /(_))
)\___ )\ _ )\ _((_) )\___ ((_) (_)) ((_)(_))_
((/ __|(_)_\(_)| \| |((/ __|| __|| | | __|| \
| (__ / _ \ | .` | | (__ | _| | |__ | _| | |) |
\___|/_/ \_\ |_|\_| \___||___||____||___||___/
""")