mirror of
https://github.com/Ai-hack-MAGNUM-OPUS/backend.git
synced 2024-11-24 17:23:44 +03:00
25 lines
576 B
Python
25 lines
576 B
Python
import os
|
|
|
|
from checker.services.generators import generate_charset
|
|
|
|
|
|
def process_paragraphs(text):
|
|
paragraphs = {}
|
|
c = 0
|
|
for line in text:
|
|
ind = line[:2]
|
|
if len(ind) == 2 and ind[1] == ".":
|
|
try:
|
|
ind = int(ind[0])
|
|
c = ind
|
|
paragraphs[c] = ""
|
|
except ValueError:
|
|
print()
|
|
if c:
|
|
paragraphs[c] += line
|
|
return paragraphs
|
|
|
|
|
|
def media_upload_path(instance, filename):
|
|
return os.path.join(f"uploads/{generate_charset(7)}/", filename)
|