Проверка шаблона шины для 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 621B

11 months ago
10 months ago
11 months ago
10 months ago
11 months ago
1234567891011121314151617181920
  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. fmtMany = lines[2]
  8. fields = []
  9. for key in c.structure.model.fields:
  10. values = c.structure.model.fields[key]
  11. fmt = fieldFormat(fmtMany, fmtPlain, fmtRecent, key, c.structure)
  12. ln = fmt \
  13. .replace("%NAME%", key) \
  14. .replace("%TYPE%", values[0]) \
  15. .replace("%DEFAULT%", values[1])
  16. fields.append(ln)
  17. c.modelFields = "\n".join(fields)