first attempts parsing yaml from messg body
This commit is contained in:
@@ -11,12 +11,51 @@ from rowers.tasks import (
|
||||
from rowers.models import GraphImage
|
||||
|
||||
import numpy as np
|
||||
import yaml
|
||||
import argparse
|
||||
import yamllint
|
||||
from subprocess import call
|
||||
|
||||
try:
|
||||
from cStringIO import StringIO
|
||||
except:
|
||||
from StringIO import StringIO
|
||||
|
||||
from rowers.utils import (
|
||||
geo_distance,serialize_list,deserialize_list,uniqify,
|
||||
str2bool,range_to_color_hex,absolute
|
||||
)
|
||||
|
||||
#Configuration for argument parsing
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("path", help='File/Directory path to be examined', type=str)
|
||||
args = (parser.parse_args())
|
||||
|
||||
#The main loop
|
||||
|
||||
#Verify file is in YAML, if so save as dict then end
|
||||
#ignore = set([])
|
||||
#with open(args.path, "r") as f:
|
||||
# try:
|
||||
# yml = (yaml.load(f))
|
||||
# print yml
|
||||
# #If not yaml run through yamllint
|
||||
# except yaml.YAMLError as exc:
|
||||
# call(["yamllint","-f","parsable",args.path])
|
||||
|
||||
def upload_options(body):
|
||||
uploadoptions = {}
|
||||
# ok, a temp solution - write to temp file
|
||||
with open('temp.txt','w') as f:
|
||||
f.write(body)
|
||||
with open('temp.txt','r') as f:
|
||||
try:
|
||||
yml = (yaml.load(f))
|
||||
print yml
|
||||
except yaml.YAMLError as exc:
|
||||
call(["yamllint","-f","parsable",'temp.txt'])
|
||||
|
||||
return uploadoptions
|
||||
|
||||
def make_plot(r,w,f1,f2,plottype,title,imagename='',plotnr=0):
|
||||
if imagename == '':
|
||||
|
||||
Reference in New Issue
Block a user