Ejemplo n.º 1
0
def codeGenerator(*args):
    global codegenArgs
    if args:
        codegenArgs = list(args)
    else:
        codegenArgs = [defaultCodeGenSource]
    display(PixieDustCodeGenPluginMeta)
Ejemplo n.º 2
0
 def run(self):
     # forever
     while not self._stop_event.is_set():
         # read line from Node's stdout
         line = self.ps.stdout.readline()
         # see if it parses as JSON
         obj = None
         try:
             if line:
                 obj = json.loads(line)
                 # if it does and is a pixiedust object
                 if obj and isinstance(obj, dict) and obj['_pixiedust']:
                     if obj['type'] == 'display':
                         pdf = pandas.DataFrame(obj['data'])
                         ShellAccess.pdf = pdf
                         display(pdf)
                     elif obj['type'] == 'print':
                         print(json.dumps(obj['data']))
                     elif obj['type'] == 'store':
                         print('!!! Warning: store is now deprecated - Node.js global variables are automatically propagated to Python !!!')
                         variable = 'pdf'
                         if 'variable' in obj:
                             variable = obj['variable']
                         ShellAccess[variable] = pandas.DataFrame(obj['data'])
                     elif obj['type'] == 'html':
                         IPython.display.display(IPython.display.HTML(obj['data']))
                     elif obj['type'] == 'image':
                         IPython.display.display(IPython.display.HTML('<img src="{0}" />'.format(obj['data'])))
                     elif obj['type'] == 'variable':
                         ShellAccess[obj['key']] = obj['value']
                         if self.vw:
                             self.vw.setCache(obj['key'], obj['value'])
                     elif obj['type'] == 'numpy':
                         loc = obj['data']
                         key = os.path.splitext(os.path.basename(loc))[0]
                         #print(key , "has been overriden")
                         v = np.load(loc)
                         ShellAccess[key] = v
                         if self.vw:
                             np_hash = str(v.data.tobytes()) + str(v.shape)
                             self.vw.setCache(key, np_hash)
                     elif obj['type'] == 'done':
                         global doneNode
                         global doneLock
                         doneLock.acquire_write()
                         doneNode = True
                         doneLock.release_write()
                 else:
                     print(line)
         except Exception as e:
             # output the original line when we don't have JSON
             test_line = line.strip().replace(' ', '')
             if len(test_line) > 0:
                 print(line.strip())
Ejemplo n.º 3
0
    def run(self):

        # forever
        while not self._stop_event.is_set():
            # read line from Node's stdout
            line = self.ps.stdout.readline()

            # see if it parses as JSON
            obj = None
            try:
                if line:
                    obj = json.loads(line)
            except Exception as e:
                # output the original line when we don't have JSON
                line = line.strip()
                if len(line) > 0:
                    print(line)

            try:
                # if it does and is a pixiedust object
                if obj and obj['_pixiedust']:
                    if obj['type'] == 'display':
                        pdf = pandas.DataFrame(obj['data'])
                        ShellAccess.pdf = pdf
                        display(pdf)
                    elif obj['type'] == 'print':
                        print(json.dumps(obj['data']))
                    elif obj['type'] == 'store':
                        print(
                            '!!! Warning: store is now deprecated - Node.js global variables are automatically propagated to Python !!!'
                        )
                        variable = 'pdf'
                        if 'variable' in obj:
                            variable = obj['variable']
                        ShellAccess[variable] = pandas.DataFrame(obj['data'])
                    elif obj['type'] == 'html':
                        IPython.display.display(
                            IPython.display.HTML(obj['data']))
                    elif obj['type'] == 'image':
                        IPython.display.display(
                            IPython.display.HTML('<img src="{0}" />'.format(
                                obj['data'])))
                    elif obj['type'] == 'variable':
                        ShellAccess[obj['key']] = obj['value']

            except Exception as e:
                print(line)
                print(e)
def configure():
    display("fp_configure_training")
def displayMapResults():
    display("fp_map_results")
def conversationFlightPredict():
    display(PixieDustConvFlightPredictPluginMeta)
def flightPredict(depAir="BOS"):
    global initialAirport
    initialAirport = depAir
    display(PixieDustFlightPredictPluginMeta)
Ejemplo n.º 8
0
def twitterDemo():
    display(PixieDustTwitterDemoPluginMeta)
Ejemplo n.º 9
0
def simpleSearch(*args):
  global sssArgs
  if args:
    sssArgs = list(args)
  display(PixieDustSimpleSearchPluginMeta)
Ejemplo n.º 10
0
def startCourse():
    display(PixieDustLearningPluginMeta)
Ejemplo n.º 11
0
def twitterDemo():
  display(PixieDustTwitterDemoPluginMeta)
Ejemplo n.º 12
0
def simpleSearch(*args):
    global sssArgs
    if args:
        sssArgs = list(args)
    display(PixieDustSimpleSearchPluginMeta)
def configure():
  display("fp_configure_training")
def displayMapResults():
  display("fp_map_results")
def flightPredict(depAir="BOS"):
  global initialAirport
  initialAirport = depAir
  display(PixieDustFlightPredictPluginMeta)
Ejemplo n.º 16
0
def startCourse():
    display(PixieDustLearningPluginMeta)