Compare commits

...

3 Commits

Author SHA1 Message Date
justuser31
9f09fd67f4 up 2024-04-28 21:37:34 +03:00
justuser31
6b80c415ff Добавление парсинга ftl 2024-04-28 21:14:47 +03:00
justuser31
5c6917e40e Тесты парсера 2024-04-28 21:02:09 +03:00
2 changed files with 25 additions and 0 deletions

17
reworked/parse.py Normal file
View File

@ -0,0 +1,17 @@
from requests import get
from yaml import load, SafeLoader
def parse_yml(url = 'https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/Resources/Prototypes/Recipes/Reactions/medicine.yml'):
yml = load(get(url).content.decode('utf-8'), Loader=SafeLoader)
return yml
def parse_ftl(url = 'https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/Resources/Locale/ru-RU/reagents/meta/medicine.ftl'):
raw = get(url).content.decode('utf-8')
locales = {}
for i in raw.splitlines():
if 'name' in i:
splitted = i.split()
name = splitted[0][13:]
locale = splitted[2]
locales[name] = locale
return locales

8
reworked/reag__.py Normal file
View File

@ -0,0 +1,8 @@
class reag__:
def __init__(category = '-', comps, out):
# medicine
self.category = category
# {'инапровалин': 1, 'углерод': 1}
self.comps = comps
# 2
self.out = out