Skip to content

Instantly share code, notes, and snippets.

@kassens
Last active March 22, 2016 17:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kassens/6449143a9d1adb31b1a9 to your computer and use it in GitHub Desktop.
Save kassens/6449143a9d1adb31b1a9 to your computer and use it in GitHub Desktop.
from __future__ import print_function
import sys
import re
import fileinput
in_graphql = False
for line in fileinput.input(inplace=1):
if '`' in line and not re.search('`.*`', line):
in_graphql = not in_graphql
if in_graphql:
line = re.sub(',$', '', line)
sys.stdout.write(line)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment