Проверка шаблона шины для iOS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

generateModelFields.py 589B

10 months ago
12345678910111213141516171819
  1. from generation.fieldFormat import *
  2. def generateModelFields(c):
  3. fileName = f"{c.dir}/templates/model-field"
  4. lines = c.readFile(fileName)
  5. fmtPlain = lines[0]
  6. fmtRecent = lines[1]
  7. fields = []
  8. for key in c.structure.model.fields:
  9. values = c.structure.model.fields[key]
  10. fmt = fieldFormat(fmtPlain, fmtRecent, key, c.structure)
  11. ln = fmt \
  12. .replace("%NAME%", key) \
  13. .replace("%TYPE%", values[0]) \
  14. .replace("%DEFAULT%", values[1])
  15. fields.append(ln)
  16. c.modelFields = "\n".join(fields)