Guest User

Untitled

a guest
Jul 19th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. import click
  2. import os
  3.  
  4. ff_name = input()
  5. fs_name = input()
  6. file_reaction = os.fsdecode(ff_name)
  7. file_answers = os.fsdecode(fs_name)
  8. @click.command()
  9. @ click.argument ( file_reaction , type = click . File ( 'rb' ))
  10. @ click.argument ( file_answers , type = click . File ( 'wb' ))
  11. def redox_load():
  12. exep = []
  13.  
  14. with open(file_reaction) as inf, open(file_answers) as elog:
  15. for line in inf:
  16. s = line.strip()
  17. dct = json.loads(s)
  18. try:
  19. Validator.check_half_reaction(dct)
  20. jsn = Parser.wrap_dict(Parser.parse_string(s))
  21. elog.writelines('\n'.join(jsn))
  22. except NonexistentCharge as ne:
  23. exep.append(s + ' ' + ne.message)
  24. except BadResultCharge as bc:
  25. exep.append(s + ' ' + 'BadResultCharge')
  26. e1 = Equilibrium(dct[0], dct[1], K1)
  27. elog.writelines('\n'.join(exep))
  28. if __name__ == "__redox_load__":
  29. redox_load()
Add Comment
Please, Sign In to add comment