mirror of
https://github.com/vladmandic/automatic
synced 2026-09-20 01:31:13 +02:00
add generate models preview
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
generic helper methods
|
||||
"""
|
||||
|
||||
import string
|
||||
import logging
|
||||
|
||||
log_format = '%(asctime)s %(levelname)s: %(message)s'
|
||||
@@ -19,6 +20,14 @@ def set_logfile(logfile):
|
||||
log.info({ 'log file': logfile })
|
||||
|
||||
|
||||
def safestring(text: str):
|
||||
lines = []
|
||||
for line in text.splitlines():
|
||||
lines.append(line.translate(str.maketrans('', '', string.punctuation)).strip())
|
||||
res = ', '.join(lines)
|
||||
return res[:1000]
|
||||
|
||||
|
||||
class Map(dict):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(Map, self).__init__(*args, **kwargs)
|
||||
|
||||
Reference in New Issue
Block a user