def wa_code_callback(): code = "" while len(code) != 6: code = input( "\n>> 6-Digit Verification Code (empty string to resend): ") code = code.strip() code = re.sub(r"-\s*", "", code) if code == "": return None return code
def push(self, code): try: if code.strip() == "setup": pprint.pprint(self.scope.setup) else: if " " in code: self.scope.write(code) else: resp = self.scope.ask(code) print resp except pyvisa.errors.VisaIOError, err: print err
def execute(self,code,format=None,width=None,height=None,units=None): # Some Python versions don't like trailing blank lines so remove all surrounding # whitepace code = code.strip() # Execute in top scope exec_(code,None,self.top()) # Return according to format code if format in ('png','svg'): if Images.engine=='matplotlib': filename = Images.filename(format) pylab.savefig(filename) return filename return ""
def execute(self, code, format=None, width=None, height=None, units=None): # Some Python versions don't like trailing blank lines so remove all surrounding # whitepace code = code.strip() # Execute in top scope exec_(code, None, self.top()) # Return according to format code if format in ('png', 'svg'): if Images.engine == 'matplotlib': filename = Images.filename(format) pylab.savefig(filename) return filename return ""
def execute(self, code, id="", format=None, width=None, height=None, units=None): # Some Python versions don't like trailing blank lines so remove all # surrounding whitepace code = code.strip() # Execute in top scope exec_(code, None, self.top()) # Return according to format code if format in ('png', 'svg'): if not os.path.exists('out'): os.makedirs('out') filename = os.path.join('out', '%s.%s' % (id, format)) if IMAGE_PACKAGE == 'matplotlib': pylab.savefig(filename) elif IMAGE_PACKAGE is None: raise Exception('No image rendering package is configured') else: raise Exception('Image rendering package not handled\n package: %s' % IMAGE_PACKAGE) return filename else: return ""
def firstPass(): # searches file for jump labels and enters them into the symbol table # also removes out comments & empty lines infile = open(root + ".asm") outfile = open(root + ".tmp", "w") lineNumber = 0 for line in infile: sline = code.strip(line) if sline != "": if sline[0] == "(": label = sline[1:-1] table[label] = lineNumber sline = "" else: lineNumber += 1 outfile.write(sline + "\n") infile.close() outfile.close()