Created
March 31, 2018 01:58
-
-
Save kunwon1/07171aa3c7dac84725e18e49333d6c10 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def parse_modes(modes): | |
modestring = modes.pop(0) | |
modifier = None | |
retval = [] | |
for char in modestring: | |
if char in ['+','-']: | |
modifier = char | |
elif char in ['b','q','e','I','o','v']: | |
retval.append('%s%s %s' % | |
(modifier, char, modes.pop(0))) | |
elif char in ['l','k','j','f']: | |
if modifier == '+': | |
retval.append('%s%s %s' % | |
(modifier, char, modes.pop(0))) | |
else: | |
retval.append('%s%s' % (modifier, char)) | |
else: | |
retval.append('%s%s' % (modifier, char)) | |
return retval |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment