Advertisement
Guest User

Untitled

a guest
Feb 24th, 2018
358
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. #!/bin/python
  2. import sys
  3. from subprocess import call
  4. from django.core.validators import URLValidator
  5. from django.core.exceptions import ValidationError
  6.  
  7. class MAINW:
  8. argm = ""
  9.  
  10. def __init__(self):
  11. self.core_f()
  12.  
  13. def core_f(self):
  14. try:
  15. subj = str(input('HASH or URL or CMD: '))
  16. except KeyboardInterrupt:
  17. print('\n', 'Exiting...')
  18. exit()
  19. else:
  20. self.wrapper(subj)
  21.  
  22. def wrapper(self, subj):
  23. cycl = True
  24. while cycl == True:
  25. try:
  26. if len(subj) == '40' or len(subj) == '82':
  27. call(['git cherry-pick', '-S', subj])
  28. elif subj == "reset":
  29. call(['git reset --hard HEAD'])
  30. else:
  31. raise BaseException
  32. except BaseException:
  33. print("It isn't an commit hash")
  34. cycl = False
  35. else:
  36. try:
  37. URLValidator(verify_exists=False)('subj')
  38. except ValidationError:
  39. print("It isn't an URL")
  40. cycl = False
  41. finally:
  42. self.core_f()
  43.  
  44. classcall = MAINW()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement