rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
self.body.append('\\begin{center}\n')
self.out.append('\\begin{center}\n')
def visit_image(self, node): if self.centerfigs: self.body.append('\\begin{center}\n') attrs = node.attributes # Add image URI to dependency list, assuming that it's # referring to a local file. self.settings.record_dependencies.add(attrs['uri']) pre = [] # in reverse order post = [] include_grap...
self.body.extend( pre )
self.out.extend( pre )
def visit_image(self, node): if self.centerfigs: self.body.append('\\begin{center}\n') attrs = node.attributes # Add image URI to dependency list, assuming that it's # referring to a local file. self.settings.record_dependencies.add(attrs['uri']) pre = [] # in reverse order post = [] include_grap...
self.body.append( '\\includegraphics%s{%s}' % (
self.out.append( '\\includegraphics%s{%s}' % (
def visit_image(self, node): if self.centerfigs: self.body.append('\\begin{center}\n') attrs = node.attributes # Add image URI to dependency list, assuming that it's # referring to a local file. self.settings.record_dependencies.add(attrs['uri']) pre = [] # in reverse order post = [] include_grap...
self.body.extend( post )
self.out.extend( post )
def visit_image(self, node): if self.centerfigs: self.body.append('\\begin{center}\n') attrs = node.attributes # Add image URI to dependency list, assuming that it's # referring to a local file. self.settings.record_dependencies.add(attrs['uri']) pre = [] # in reverse order post = [] include_grap...
self.body.append('\\end{center}\n') def visit_Text (self, node): self.body.append(self.encode(node.astext()))
self.out.append('\\end{center}\n')
def depart_image(self, node): if self.centerfigs: self.body.append('\\end{center}\n')
self.body.append (self.begin_frametag())
self.out.append (self.begin_frametag())
def visit_section (self, node): if has_sub_sections (node): temp = self.section_level + 1 if temp > self.frame_level: self.frame_level = temp else: self.body.append (self.begin_frametag()) LaTeXTranslator.visit_section (self, node)
self.body.append (self.end_frametag())
self.out.append (self.end_frametag())
def depart_section (self, node): # Remove counter for potential subsections: LaTeXTranslator.depart_section (self, node) if (self.section_level == self.frame_level):#0 self.body.append (self.end_frametag())
self.body.append ('\\frametitle{%s}\n\n' % \
self.out.append ('\\frametitle{%s}\n\n' % \
def visit_title (self, node): if node.astext() == 'dummy': raise nodes.SkipNode if (self.section_level == self.frame_level+1):#1 self.body.append ('\\frametitle{%s}\n\n' % \ self.encode(node.astext())) raise nodes.SkipNode else: LaTeXTranslator.visit_title (self, node)
self.body.append ('\\setbeamerfont{quote}{parent={}}\n')
self.out.append ('\\setbeamerfont{quote}{parent={}}\n')
def visit_literal_block (self, node): # FIX: the purpose of this method is unclear, but it causes parsed # literals in docutils 0.6 to lose indenting. Thus we've solve the # problem be just getting rid of it. [PMA 20091020] # TODO: replace leading tabs like in codeblocks? if (node_has_class (node, 'code-block') and sel...
self.body.append ( '\\setbeamerfont{quote}{parent=quotation}\n' )
self.out.append ( '\\setbeamerfont{quote}{parent=quotation}\n' )
def depart_literal_block (self, node): # FIX: see `visit_literal_block` if (node_has_class (node, 'code-block') and self.cb_use_pygments): self.visit_codeblock (node) else: LaTeXTranslator.depart_literal_block (self, node) self.body.append ( '\\setbeamerfont{quote}{parent=quotation}\n' )
self.body.append ('\n' + hilite_code + '\n')
self.out.append ('\n' + hilite_code + '\n')
def visit_codeblock (self, node): # was langauge argument defined on node? lang = node.get ('language', None) # otherwise, was it defined in node classes? if (lang is None): lang = node_lang_class (node) # otherwise, use commandline argument or default if lang is None: lang = self.cb_default_lang # replace tabs if req...
self.body.append( '\\begin{list}{}{}\n' )
self.out.append( '\\begin{list}{}{}\n' )
def visit_bullet_list (self, node): # NOTE: required by the loss of 'topic_classes' in docutils 0.6 # TODO: so what replaces it? if (hasattr (self, 'topic_classes') and ('contents' in self.topic_classes)): if self.use_latex_toc: raise nodes.SkipNode self.body.append( '\\begin{list}{}{}\n' ) else: begin_str = '\\begin{i...
self.body.append (begin_str)
self.out.append (begin_str)
def visit_bullet_list (self, node): # NOTE: required by the loss of 'topic_classes' in docutils 0.6 # TODO: so what replaces it? if (hasattr (self, 'topic_classes') and ('contents' in self.topic_classes)): if self.use_latex_toc: raise nodes.SkipNode self.body.append( '\\begin{list}{}{}\n' ) else: begin_str = '\\begin{i...
self.body.append( '\\end{list}\n' )
self.out.append( '\\end{list}\n' )
def depart_bullet_list (self, node): # NOTE: see `visit_bullet_list` if (hasattr (self, 'topic_classes') and ('contents' in self.topic_classes)): self.body.append( '\\end{list}\n' ) else: self.body.append( '\\end{itemize}\n' )
self.body.append( '\\end{itemize}\n' )
self.out.append( '\\end{itemize}\n' )
def depart_bullet_list (self, node): # NOTE: see `visit_bullet_list` if (hasattr (self, 'topic_classes') and ('contents' in self.topic_classes)): self.body.append( '\\end{list}\n' ) else: self.body.append( '\\end{itemize}\n' )
self.body.append( '\\begin{list}{}{}\n' )
self.out.append( '\\begin{list}{}{}\n' )
def visit_enumerated_list (self, node): #LaTeXTranslator has a very complicated #visit_enumerated_list that throws out much of what latex #does to handle them for us. I am going back to relying #on latex. if ('contents' in getattr (self, 'topic_classes', [])): if self.use_latex_toc: raise nodes.SkipNode self.body.appe...
self.body.append(begin_str)
self.out.append(begin_str)
def visit_enumerated_list (self, node): #LaTeXTranslator has a very complicated #visit_enumerated_list that throws out much of what latex #does to handle them for us. I am going back to relying #on latex. if ('contents' in getattr (self, 'topic_classes', [])): if self.use_latex_toc: raise nodes.SkipNode self.body.appe...
self.body.append('\\addtocounter{enumi}{%d}\n' \
self.out.append('\\addtocounter{enumi}{%d}\n' \
def visit_enumerated_list (self, node): #LaTeXTranslator has a very complicated #visit_enumerated_list that throws out much of what latex #does to handle them for us. I am going back to relying #on latex. if ('contents' in getattr (self, 'topic_classes', [])): if self.use_latex_toc: raise nodes.SkipNode self.body.appe...
self.body.append ('\\end{list}\n')
self.out.append ('\\end{list}\n')
def depart_enumerated_list (self, node): if ('contents' in getattr (self, 'topic_classes', [])): self.body.append ('\\end{list}\n') else: self.body.append ('\\end{enumerate}\n' )
self.body.append ('\\end{enumerate}\n' ) def astext (self): if self.pdfinfo is not None and self.pdfauthor: self.pdfinfo.append ('pdfauthor={%s}' % self.pdfauthor) if self.pdfinfo: pdfinfo = '\\hypersetup{\n' + ',\n'.join (self.pdfinfo) + '\n}\n' else: pdfinfo = '' head = '\\title{%s}\n' % self.title if self.auth_sta...
self.out.append ('\\end{enumerate}\n' )
def depart_enumerated_list (self, node): if ('contents' in getattr (self, 'topic_classes', [])): self.body.append ('\\end{list}\n') else: self.body.append ('\\end{enumerate}\n' )
self.body.append ('\\begin{columns}[T]\n')
self.out.append ('\\begin{columns}[T]\n')
def visit_columnset (self, node): assert not self.in_columnset, \ "already in column set, which cannot be nested" self.in_columnset = True self.body.append ('\\begin{columns}[T]\n')
self.body.append ('\\end{columns}\n')
self.out.append ('\\end{columns}\n')
def depart_columnset (self, node): assert self.in_columnset, "not in column set" self.in_columnset = False self.body.append ('\\end{columns}\n')
self.body.append ('\\column{%.2f\\textwidth}\n' % node.width)
self.out.append ('\\column{%.2f\\textwidth}\n' % node.width)
def visit_column (self, node): assert not self.in_column, "already in column, which cannot be nested" self.in_column = True self.body.append ('\\column{%.2f\\textwidth}\n' % node.width)
self.body.append ('\n')
self.out.append ('\n')
def depart_column (self, node): self.in_column = False self.body.append ('\n')
self.body.append ('\\note{\n')
self.out.append ('\\note{\n')
def visit_beamer_note (self, node): assert not self.in_note, "already in note, which cannot be nested" self.in_note = True self.body.append ('\\note{\n')
self.body.append ('}\n')
self.out.append ('}\n')
def depart_beamer_note (self, node): self.in_note = False self.body.append ('}\n')
settings_defaults = BEAMER_DEFAULTS
settings_default_overrides = BEAMER_DEFAULT_OVERRIDES
def depart_container (self, node): if (node_has_class (node, 'r2b-simplecolumns')): self.depart_columnset (node) elif (node_has_class (node, 'r2b-note')): self.depart_beamer_note (node) else: # currently the LaTeXTranslator does nothing, but just in case LaTeXTranslator.depart_container (self, node)
atts['style'] = 'counter-reset: item %d;' % (node['start'] - 1)
atts['style'] = 'counter-reset: item %d;' % ( node['start'] - 1) classes = node.setdefault('classes', [])
def visit_enumerated_list(self, node): atts = {} if 'start' in node: atts['style'] = 'counter-reset: item %d;' % (node['start'] - 1) if 'enumtype' in node: atts['class'] = node['enumtype'] # @@@ To do: prefix, suffix. self.context.append((self.compact_simple, self.compact_p)) self.compact_p = False if self.is_compactab...
atts['class'] = node['enumtype']
classes.append(node['enumtype']) if self.is_compactable(node) and not self.compact_simple: classes.append('simple')
def visit_enumerated_list(self, node): atts = {} if 'start' in node: atts['style'] = 'counter-reset: item %d;' % (node['start'] - 1) if 'enumtype' in node: atts['class'] = node['enumtype'] # @@@ To do: prefix, suffix. self.context.append((self.compact_simple, self.compact_p)) self.compact_p = False if self.is_compactab...
if self.is_compactable(node) and not self.compact_simple: atts['class'] = ' '.join(node.get('classes', []) + ['simple'])
def visit_enumerated_list(self, node): atts = {} if 'start' in node: atts['style'] = 'counter-reset: item %d;' % (node['start'] - 1) if 'enumtype' in node: atts['class'] = node['enumtype'] # @@@ To do: prefix, suffix. self.context.append((self.compact_simple, self.compact_p)) self.compact_p = False if self.is_compactab...
self.set_class_on_child(node, 'first', 0) option = node.parent if (option.parent.index(option) == len(option.parent) - 1): self.set_class_on_child(node, 'last', -1)
def visit_description(self, node): self.body.append(self.starttag(node, 'dd', '')) self.set_class_on_child(node, 'first', 0) option = node.parent if (option.parent.index(option) == len(option.parent) - 1): self.set_class_on_child(node, 'last', -1)
sys.exit(result)
if result.errors or result.failures: sys.exit(result) else: sys.exit()
def suite(): path, script = os.path.split(sys.argv[0]) suite = package_unittest.loadTestModules(DocutilsTestSupport.testroot, 'test_', packages=1) sys.stdout.flush() return suite
textlines = [line + '~'*(not line.lstrip()) for line in text.split('\n')] text = '\\\\\n'.join(textlines)
lines = [line + '~'*(not line.lstrip()) for line in lines[:-1]] + lines[-1:] text = '\\\\\n'.join(lines)
def encode(self, text): """Return text with 'problematic' characters escaped.
assert ( not (settings.stylesheet and settings.stylesheet_path),
assert not (settings.stylesheet and settings.stylesheet_path), (
def get_stylesheet_list(settings): """ Retrieve list of stylesheet references from the settings object. """ assert ( not (settings.stylesheet and settings.stylesheet_path), 'stylesheet and stylesheet_path are mutually exclusive.') if settings.stylesheet_path: sheets = settings.stylesheet_path.split(",") elif settings.s...
supported = ('html', 'html4css1', 'xhtml')
supported = ('odt', )
def get_level(self): return self.level
if current_element is None: parent = SubElement(parent, 'text:p', attrib={ 'text:style-name': self.rststyle(style_name), })
def create_custom_headfoot(self, parent, text, style_name, automatic_styles): current_element = None field_iter = self.split_field_specifiers_iter(text) for item in field_iter: if item[0] == ODFTranslator.code_field: if item[1] not in ('p', 'P', 't1', 't2', 't3', 't4', 'd1', 'd2', 'd3', 'd4', 'd5', 's', 't', 'a'): msg ...
parent = SubElement(parent, 'text:p', attrib={ 'text:style-name': self.rststyle(style_name), })
def create_custom_headfoot(self, parent, text, style_name, automatic_styles): current_element = None field_iter = self.split_field_specifiers_iter(text) for item in field_iter: if item[0] == ODFTranslator.code_field: if item[1] not in ('p', 'P', 't1', 't2', 't3', 't4', 'd1', 'd2', 'd3', 'd4', 'd5', 's', 't', 'a'): msg ...
'text:style-name': self.rststyle(style_name),
def make_field_element(self, parent, text, style_name, automatic_styles): if text == 'p': el1 = SubElement(parent, 'text:page-number', attrib={ 'text:style-name': self.rststyle(style_name), 'text:select-page': 'current', }) elif text == 'P': el1 = SubElement(parent, 'text:page-count', attrib={ 'text:style-name': self.r...
self.depart_inline(node) self.verbatim = False self.out.append('$') def visit_math_block(self, node):
self.visit_inline(node)
def depart_math(self, node): self.requirements['amsmath'] = r'\usepackage{amsmath}' if node['classes']: self.depart_inline(node) self.verbatim = False self.out.append('$')
atts['src'] = node['uri']
uri = node['uri'] issvg = uri.lower().endswith('.svg') if issvg: atts['data'] = uri atts['type'] = 'image/svg+xml' else: atts['src'] = uri
def visit_image(self, node): atts = {} atts['src'] = node['uri'] if 'width' in node: atts['width'] = node['width'] if 'height' in node: atts['height'] = node['height'] if 'scale' in node: if Image and not ('width' in node and 'height' in node): try: im = Image.open(str(atts['src'])) except (IOError, # Source image can'...
im = Image.open(str(atts['src']))
im = Image.open(str(uri))
def visit_image(self, node): atts = {} atts['src'] = node['uri'] if 'width' in node: atts['width'] = node['width'] if 'height' in node: atts['height'] = node['height'] if 'scale' in node: if Image and not ('width' in node and 'height' in node): try: im = Image.open(str(atts['src'])) except (IOError, # Source image can'...
atts['alt'] = node.get('alt', atts['src'])
atts['alt'] = node.get('alt', uri)
def visit_image(self, node): atts = {} atts['src'] = node['uri'] if 'width' in node: atts['width'] = node['width'] if 'height' in node: atts['height'] = node['height'] if 'scale' in node: if Image and not ('width' in node and 'height' in node): try: im = Image.open(str(atts['src'])) except (IOError, # Source image can'...
self.body.append(self.emptytag(node, 'img', suffix, **atts))
if issvg: self.body.append(self.starttag(node, 'object', suffix, **atts) + atts['alt'] + '</object>' + suffix) else: self.body.append(self.emptytag(node, 'img', suffix, **atts))
def visit_image(self, node): atts = {} atts['src'] = node['uri'] if 'width' in node: atts['width'] = node['width'] if 'height' in node: atts['height'] = node['height'] if 'scale' in node: if Image and not ('width' in node and 'height' in node): try: im = Image.open(str(atts['src'])) except (IOError, # Source image can'...
_REGMAP = { 'es' : idaapi.R_es, 'cs' : idaapi.R_cs, 'ss' : idaapi.R_ss, 'ds' : idaapi.R_ds, 'fs' : idaapi.R_fs, 'gs' : idaapi.R_gs }
def SetFlags(ea, flags): """ Set new value of flags This function should not used be used directly if possible. It changes properties of a program byte and if misused, may lead to very-very strange results. @param ea: adress @param flags: new flags value """ return idaapi.setFlags(ea, flags)
if reg in _REGMAP: return idaapi.splitSRarea1(ea, _REGMAP[reg], value, tag)
reg = idaapi.str2reg(reg); if reg >= 0: return idaapi.splitSRarea1(ea, reg, value, tag)
def SetRegEx(ea, reg, value, tag): """ Set value of a segment register. @param ea: linear address @param reg: name of a register, like "cs", "ds", "es", etc. @param value: new value of the segment register. @param tag: of SR_... constants @note: IDA keeps tracks of all the points where segment register change their v...
@return: the value of the segment register or 0xFFFF on error
@return: the value of the segment register or -1 on error
def GetReg(ea, reg): """ Get value of segment register at the specified address @param ea: linear address @param reg: name of segment register @return: the value of the segment register or 0xFFFF on error @note: The segment registers in 32bit program usually contain selectors, so to get paragraph pointed by the segm...
if reg in _REGMAP: return idaapi.getSR(ea, _REGMAP[reg]) & 0xFFFF
reg = idaapi.str2reg(reg); if reg >= 0: return idaapi.getSR(ea, reg)
def GetReg(ea, reg): """ Get value of segment register at the specified address @param ea: linear address @param reg: name of segment register @return: the value of the segment register or 0xFFFF on error @note: The segment registers in 32bit program usually contain selectors, so to get paragraph pointed by the segm...
return False
return -1
def GetReg(ea, reg): """ Get value of segment register at the specified address @param ea: linear address @param reg: name of segment register @return: the value of the segment register or 0xFFFF on error @note: The segment registers in 32bit program usually contain selectors, so to get paragraph pointed by the segm...
if seg and reg in _REGMAP: return idaapi.SetDefaultRegisterValue(seg, _REGMAP[reg], value)
reg = idaapi.str2reg(reg); if seg and reg >= 0: return idaapi.SetDefaultRegisterValue(seg, reg, value)
def SetSegDefReg(ea, reg, value): """ Set default segment register value for a segment @param ea: any address in the segment if no segment is present at the specified address then all segments will be affected @param reg: name of segment register @param value: default value of the segment register. -1-undefined. """ s...
return idaapi.choose_func(title)
return idaapi.choose_func(title, idaapi.BADADDR)
def ChooseFunction(title): """ Ask the user to select a function Arguments: @param title: title of the dialog box @return: -1 - user refused to select a function otherwise returns the selected function start address """ return idaapi.choose_func(title)
if func and _IDC_SetAttr(func, _FUNCATTRMAP, attr, value):
if func: _IDC_SetAttr(func, _FUNCATTRMAP, attr, value)
def SetFunctionAttr(ea, attr, value): """ Set a function attribute @param ea: any address belonging to the function @param attr: one of FUNCATTR_... constants @param value: new value of the attribute @return: 1-ok, 0-failed """ func = idaapi.get_func(ea) if func and _IDC_SetAttr(func, _FUNCATTRMAP, attr, value): ret...
if chunk and _IDC_SetAttr(chunk, _FUNCATTRMAP, attr, value):
if chunk: _IDC_SetAttr(chunk, _FUNCATTRMAP, attr, value)
def SetFchunkAttr(ea, attr, value): """ Set a function chunk attribute @param ea: any address in the chunk @param attr: only FUNCATTR_START, FUNCATTR_END, FUNCATTR_OWNER @param value: desired value @return: 0 if failed, 1 if success """ if attr in [ FUNCATTR_START, FUNCATTR_END, FUNCATTR_OWNER ]: chunk = idaapi.get_f...
for ref in DataRefsTo(ScreenEA(), 1):
for ref in DataRefsTo(ScreenEA()):
def DataRefsTo(ea): """ Get a list of data references to 'ea' @param ea: Target address @return: list of references (may be empty list) Example:: for ref in DataRefsTo(ScreenEA(), 1): print ref """ return refs(ea, idaapi.get_first_dref_to, idaapi.get_next_dref_to)
for ref in DataRefsFrom(ScreenEA(), 1):
for ref in DataRefsFrom(ScreenEA()):
def DataRefsFrom(ea): """ Get a list of data references from 'ea' @param ea: Target address @return: list of references (may be empty list) Example:: for ref in DataRefsFrom(ScreenEA(), 1): print ref """ return refs(ea, idaapi.get_first_dref_from, idaapi.get_next_dref_from)
return idaapi.cvar.database_idb
idb_path = idaapi.cvar.database_idb + '\x00' return idb_path[ : idb_path.find('\x00') ]
def GetIdbPath(): """ Get IDB full path This function returns full path of the current IDB database """ return idaapi.cvar.database_idb
The attributes are: ea - string ea type - string type (ASCSTR_xxxxx) str() - returns the actual string
def GetInputFileMD5(): """ Return the MD5 hash of the input binary file @return: MD5 string or None on error """ return idc.GetInputMD5()
STR_C = 0x0001 STR_PASCAL = 0x0002 STR_LEN2 = 0x0004 STR_UNICODE = 0x0008 STR_LEN4 = 0x0010 STR_ULEN2 = 0x0020 STR_ULEN4 = 0x0040
STR_C = 0x0001 """C-style ASCII string""" STR_PASCAL = 0x0002 """Pascal-style ASCII string (length byte)""" STR_LEN2 = 0x0004 """Pascal-style, length is 2 bytes""" STR_UNICODE = 0x0008 """Unicode string""" STR_LEN4 = 0x0010 """Pascal-style, length is 4 bytes""" STR_ULEN2 = 0x0020 """Pascal-style Unicode,...
def __str__(self): return idc.GetString(self.ea, self.length, self.type)
def __init__(self, default_setup=True):
def __init__(self, default_setup = True): """ Initializes the Strings enumeration helper class @param default_setup: Set to True to use default setup (C strings, min len 5, ...) """ self.size = 0
def __init__(self, default_setup=True): if default_setup: self.setup() self._si = idaapi.string_info_t() self.size = 0
self.size = 0
def __init__(self, default_setup=True): if default_setup: self.setup() self._si = idaapi.string_info_t() self.size = 0
if not ea1: ea1 = idaapi.cvar.inf.minEA if not ea2: ea2 = idaapi.cvar.inf.maxEA
if ea1 is None: ea1 = idaapi.cvar.inf.minEA if ea2 is None: ea2 = idaapi.cvar.inf.maxEA
def refresh(self, ea1=None, ea2=None): """Refreshes the strings list""" if not ea1: ea1 = idaapi.cvar.inf.minEA if not ea2: ea2 = idaapi.cvar.inf.maxEA idaapi.refresh_strlist(ea1, ea2) self.size = idaapi.get_strlist_qty()
def setup(self, strtypes=STR_C, minlen=5, only_7bit=True, ignore_instructions=False, ea1=None, ea2=None, display_only_existing_strings=False): if not ea1: ea1 = idaapi.cvar.inf.minEA if not ea2: ea2 = idaapi.cvar.inf.maxEA
def setup(self, strtypes = STR_C, minlen = 5, only_7bit = True, ignore_instructions = False, ea1 = None, ea2 = None, display_only_existing_strings = False): if ea1 is None: ea1 = idaapi.cvar.inf.minEA if ea2 is None: ea2 = idaapi.cvar.inf.maxEA
def setup(self, strtypes=STR_C, minlen=5, only_7bit=True, ignore_instructions=False, ea1=None, ea2=None, display_only_existing_strings=False): if not ea1: ea1 = idaapi.cvar.inf.minEA if not ea2: ea2 = idaapi.cvar.inf.maxEA t = idaapi.strwinsetup_t() t.strtypes = strtypes t.minlen = minlen t.only_7bit = only_7bit t.ea1 ...
print "%08x: %s (ord
if not name: print "%08x: ord else: print "%08x: %s (ord
def imp_cb(ea, name, ord): print "%08x: %s (ord#%d)" % (ea, name, ord) # True -> Continue enumeration # False -> Stop enumeration return True
FUNC_STATICDEF= idaapi.FUNC_STATICDEF
FUNC_STATIC = idaapi.FUNC_STATICDEF
def GetFunctionFlags(ea): """ Retrieve function flags @param ea: any address belonging to the function @return: -1 - function doesn't exist otherwise returns the flags """ func = idaapi.get_func(ea) if not func: return -1 else: return func.flags
return expr
return self.expr
def __str__(self): return expr
self.panel.print_figure(fileName)
self.plot_panel.print_figure(fileName)
def OnMenuFileSave(self, evt): """ Handles File->Save menu events. """ fileName = wx.FileSelector('Save Plot', default_extension='png', wildcard=('Portable Network Graphics (*.png)|*.png|' + 'Encapsulated Postscript (*.eps)|*.eps|All files (*.*)|*.*'), parent=self, flags=wx.SAVE|wx.OVERWRITE_PROMPT)
roi = int(self.roi_select.GetValue())
roi = int(self.roi_selector.GetValue())
def OnSaveClick(self, e): try: roi = int(self.roi_select.GetValue()) except ValueError: # FIXME: come up with a better dummy value roi = 0
img = axes.imshow(z, cmap=getattr(matplotlib.cm, colormap), origin='lower', aspect='equal', interpolation='nearest', extent=extent) cb = fig.colorbar(img, cax=None, orientation='vertical')
if self.img: self.img.set_data(z) self.cb.set_array(z) self.cb.autoscale() self.img.changed() else: self.img = axes.imshow(z, cmap=getattr(matplotlib.cm, colormap), origin='lower', aspect='equal', interpolation='nearest', extent=extent) self.cb = fig.colorbar(self.img, cax=None, orientation='vertical')
def plot(self, x_name, y_name, z_name, normalize=True, colormap="hot", roi_number=0, columns=None):
self.Io = defaults.samp_mode.Io
self.Io = defaults.trans_mode.samp_mode.Io
def __init__(self, Io=None, It=None): if Io is None: self.Io = defaults.samp_mode.Io else: self.Io = Io
self.It = defaults.samp_mode.It
self.It = defaults.trans_mode.samp_mode.It
def __init__(self, Io=None, It=None): if Io is None: self.Io = defaults.samp_mode.Io else: self.Io = Io
self.Io = defaults.ref_mode.Io
self.Io = defaults.trans_mode.ref_mode.Io
def __init__(self, Io=None, It=None): if Io is None: self.Io = defaults.ref_mode.Io else: self.Io = Io
self.It = defaults.ref_mode.It
self.It = defaults.trans_mode.ref_mode.It
def __init__(self, Io=None, It=None): if Io is None: self.Io = defaults.ref_mode.Io else: self.Io = Io
print rois
def __parse_rois(self, columns): roi_re = re.compile(r"corr_roi\d+_(\d+)") rois = dict()
if '__' not in name: funcs.append(name)
funcs.append(name)
def extract_funcs(fname): funcs = [ ] for name in _funcs.findall(open(fname).read()): if '__' not in name: funcs.append(name) return funcs
os.path.remove('a.out')
os.remove('a.out')
def print_as_ver(): if os.path.exists('a.out'): print print "WARNING: a file named a.out exists, and getting the version of the 'as' assembler writes to that filename, so I'm not attempting to get the version of 'as'." return try: res = subprocess.Popen(['as', '-version'], stdin=open(os.devnull), stderr=subprocess.PIPE...
def _setup(test_suite): setup(name=PKG, version=verstr, description='Python wrappers for the Crypto++ library', long_description=long_description, author='Zooko O\'Whielacronx', author_email='zooko@zooko.com', url='http://allmydata.org/trac/' + PKG, license='GNU GPL', packages=find_packages(), include_package_data=True...
setup(name=PKG, version=verstr, description='Python wrappers for a few algorithms from the Crypto++ library', long_description=long_description, author='Zooko O\'Whielacronx', author_email='zooko@zooko.com', url='http://tahoe-lafs.org/trac/' + PKG, license='GNU GPL', packages=find_packages(), include_package_data=True,...
def _setup(test_suite): setup(name=PKG, version=verstr, description='Python wrappers for the Crypto++ library', long_description=long_description, author='Zooko O\'Whielacronx', author_email='zooko@zooko.com', url='http://allmydata.org/trac/' + PKG, license='GNU GPL', packages=find_packages(), include_package_data=True...
def print_cmd_ver(cmdlist):
def print_cmd_ver(cmdlist, label=None):
def print_cmd_ver(cmdlist): try: res = subprocess.Popen(cmdlist, stdin=open(os.devnull), stdout=subprocess.PIPE).communicate()[0] print print cmdlist[0] + ': ' + res.replace("\n", " ") except EnvironmentError, le: sys.stderr.write("Got exception invoking '%s': %s\n" % (cmdlist[0], le,)) pass
print cmdlist[0] + ': ' + res.replace("\n", " ")
print label + ': ' + res.replace("\n", " ")
def print_cmd_ver(cmdlist): try: res = subprocess.Popen(cmdlist, stdin=open(os.devnull), stdout=subprocess.PIPE).communicate()[0] print print cmdlist[0] + ': ' + res.replace("\n", " ") except EnvironmentError, le: sys.stderr.write("Got exception invoking '%s': %s\n" % (cmdlist[0], le,)) pass
print cmdlist[0] + ': ' + res.replace("\n", " ")
print 'as: ' + res.replace("\n", " ")
def print_as_ver(): if os.path.exists('a.out'): print print "WARNING: a file named a.out exists, and getting the version of the 'as' assembler writes to that filename, so I'm not attempting to get the version of 'as'." return try: res = subprocess.Popen(['as', '-version'], stdin=open(os.devnull), stderr=subprocess.PIPE...
sys.stderr.write("Got exception invoking '%s': %s\n" % (cmdlist[0], le,))
sys.stderr.write("Got exception invoking '%s': %s\n" % ('as', le,))
def print_as_ver(): if os.path.exists('a.out'): print print "WARNING: a file named a.out exists, and getting the version of the 'as' assembler writes to that filename, so I'm not attempting to get the version of 'as'." return try: res = subprocess.Popen(['as', '-version'], stdin=open(os.devnull), stderr=subprocess.PIPE...
print_cmd_ver(['darcs', '--exact-version'])
print_cmd_ver(['darcs', '--exact-version'], label='darcs-exact-version')
def print_py_pkg_ver(pkgname): try: import pkg_resources out = str(pkg_resources.require(pkgname)) print print pkgname + ': ' + out.replace("\n", " ") except (ImportError, EnvironmentError), le: sys.stderr.write("Got exception using 'pkg_resources' to get the version of %s: %s\n" % (pkgname, le,)) pass except pkg_resou...
res = subprocess.Popen(cmdlist, stdin=open(os.devnull),
res = subprocess.Popen(['as', '-version'], stdin=open(os.devnull),
def print_as_ver(): if os.path.exists('a.out'): print print "WARNING: a file named a.out exists, and getting the version of the 'as' assembler writes to that filename, so I'm not attempting to get the version of 'as'." return try: res = subprocess.Popen(cmdlist, stdin=open(os.devnull), stderr=subprocess.PIPE).communica...
print "Bad data: %s" % data return
print "Bad data: %s" % data return try: float(data[2]) except ValueError: print "Bad data: %s" % data return
def logToDatabase(self, data): data = data.split(':') if len(data) is not 3: print "Bad data: %s" % data return value = self.decodePIDValue(data[1], data[2]) if value is not None: print "PID: %s, add %s to db for VIN:%s" % (data[1], value, data[0]) self.insert(data[0],data[1],value) else: print "Error decoding PID, fai...
if value:
if value is not None:
def logToDatabase(self, data): data = data.split(':') if len(data) is not 3: print "Bad data: %s" % data return value = self.decodePIDValue(data[1], data[2]) if value: print "PID: %s, add %s to db for VIN:%s" % (data[1], value, data[0]) self.insert(data[0],data[1],value) else: print "Error decoding PID, fail!"
int(data[2])
int(data[2], 16)
def logToDatabase(self, data): isInt, isFloat = True, True data = data.split(':') if len(data) is not 3: print "Bad data: %s" % data return try: float(data[2]) except ValueError: isFloat = False try: int(data[2]) except: isInt = False if not isInt and not isFloat: print "Bad data: %s" % data return value = self.decodeP...
self.transport.write("connectionMade\r\n")
print "connection established" self.transport.write("connectionMade\r\n")
def connectionMade(self): self.transport.write("connectionMade\r\n")
print line,
print "received: ",line
def lineReceived(self, line): print line, #self.transport.write("server:" + line) self.factory.dsp.logToDatabase(line)
print line
def system(cmd): print cmd os.system(cmd)
if not os.path.isdir(addon):
if os.path.isdir(addon): print "Existing " + addon else:
def system(cmd): print cmd os.system(cmd)
['j_id234_SUBMIT', '1'], ['javax.faces.ViewState', fl.getLastJsfState()], ['j_id234:j_id235:j_id237:0:j_id238', 'j_id234:j_id235:j_id237:0:j_id238']],
['javax.faces.ViewState', fl.getLastJsfState()], ['documentActionSubviewUpperListForm:documentActionSubviewUpperListTable:0:documentActionSubviewUpperListLink', 'documentActionSubviewUpperListForm:documentActionSubviewUpperListTable:0:documentActionSubviewUpperListLink'], ['documentActionSubviewUpperListForm', 'documen...
def createWorkspace(self, title, description): fl = self.fl
['j_id198:selectDocTypePanelOpenedState', ''], ['j_id198_SUBMIT', '1'], ['javax.faces.ViewState', fl.getLastJsfState()], ['j_id198:j_id204:1:j_id208:0:j_id210:0:j_id214', 'j_id198:j_id204:1:j_id208:0:j_id210:0:j_id214']],
['javax.faces.ViewState', fl.getLastJsfState()], ['selectDocumentTypeForCreationForm', 'selectDocumentTypeForCreationForm'], ['selectDocumentTypeForCreationForm:selectDocumentTypeForCreationTable:0:selectDocumentTypeForCreationCategory:0:selectDocumentTypeForCreationCategoryTable:3:selectDocumentTypeForCreationCategory...
def createFolder(self, title, description): fl = self.fl fl.post(fl.server_url + "/view_documents.faces", params=[ # TODO: NXBT-77 navigate to create folder form ['j_id198:selectDocTypePanelOpenedState', ''], ['j_id198_SUBMIT', '1'], ['javax.faces.ViewState', fl.getLastJsfState()], ['j_id198:j_id204:1:j_id208:0:j_id210...
['j_id198:selectDocTypePanelOpenedState', ''], ['j_id198_SUBMIT', '1'], ['javax.faces.ViewState', fl.getLastJsfState()], ['j_id198:j_id204:0:j_id208:0:j_id210:1:j_id214', 'j_id198:j_id204:0:j_id208:0:j_id210:1:j_id214']],
['javax.faces.ViewState', fl.getLastJsfState()], ['selectDocumentTypeForCreationForm:selectDocumentTypeForCreationTable:1:selectDocumentTypeForCreationCategory:0:selectDocumentTypeForCreationCategoryTable:2:selectDocumentTypeForCreationCategoryTitleLink', 'selectDocumentTypeForCreationForm:selectDocumentTypeForCreation...
def createFile(self, title, description, file_path=None): fl = self.fl fl.post(fl.server_url + "/view_documents.faces", params=[ # TODO: NXBT-77 navigate to create file form ['j_id198:selectDocTypePanelOpenedState', ''], ['j_id198_SUBMIT', '1'], ['javax.faces.ViewState', fl.getLastJsfState()], ['j_id198:j_id204:0:j_id2...
['CHILDREN_DOCUMENT_LIST:dataTable:0:document_checkbox_select', 'on'], ['CHILDREN_DOCUMENT_LIST:j_id348:1:j_id350', 'Supprimer'],
['CHILDREN_DOCUMENT_LIST:nxl_document_listing:nxw_listing_selection_box_with_current_document', 'on'], ['CHILDREN_DOCUMENT_LIST:clipboardActionsTable:1:clipboardActionsButton', 'Supprimer'],
def deleteItem(self, title): fl = self.fl folder_uid = self.getDocUid() state = fl.getLastJsfState() self.selectItem(title) # TODO: NXBT-77 delete action fl.post(fl.server_url + "/view_documents.faces", params=[ ['CHILDREN_DOCUMENT_LIST', 'CHILDREN_DOCUMENT_LIST'], ['CHILDREN_DOCUMENT_LIST:dataTable:0:document_checkbox...
for line in os.popen("mvn help:effective-pom"):
for line in os.popen("mvn -N help:effective-pom"):
def system(cmd): print cmd os.system(cmd)
print "iframe: " + iframe
def dashboardNew(self): """open social dashboard""" fl = self.fl server_url = fl.server_url fl.post(server_url + "/view_documents.faces", params=[ ['userServicesForm:simpleSearchKeywordsInput', ''], ['userServicesForm:userServicesActionsTable:0:userServicesActionCommandLink', 'userServicesForm:userServicesActionsTable:...
['documentActionSubviewUpperListForm:documentActionSubviewUpperListTable:0:documentActionSubviewUpperListLink', 'documentActionSubviewUpperListForm:documentActionSubviewUpperListTable:0:documentActionSubviewUpperListLink'], ['documentActionSubviewUpperListForm', 'documentActionSubviewUpperListForm']],
['documentActionSubviewUpperListForm_SUBMIT', '1'], ['documentActionSubviewUpperListForm:documentActionSubviewUpperListTable:0:documentActionSubviewUpperListLink', 'documentActionSubviewUpperListForm:documentActionSubviewUpperListTable:0:documentActionSubviewUpperListLink']],
def createWorkspace(self, title, description): fl = self.fl
['javax.faces.ViewState', fl.getLastJsfState()], ['selectDocumentTypeForCreationForm', 'selectDocumentTypeForCreationForm'], ['selectDocumentTypeForCreationForm:selectDocumentTypeForCreationTable:0:selectDocumentTypeForCreationCategory:0:selectDocumentTypeForCreationCategoryTable:3:selectDocumentTypeForCreationCategory...
['selectDocumentTypeForCreationForm_SUBMIT', '1'], ['javax.faces.ViewState', fl.getLastJsfState()], ['selectDocumentTypeForCreationForm:selectDocumentTypeForCreationTable:1:selectDocumentTypeForCreationCategory:0:selectDocumentTypeForCreationCategoryTable:0:selectDocumentTypeForCreationCategoryTitleLink', 'selectDocume...
def createFolder(self, title, description): fl = self.fl fl.post(fl.server_url + "/view_documents.faces", params=[ ['javax.faces.ViewState', fl.getLastJsfState()], ['selectDocumentTypeForCreationForm', 'selectDocumentTypeForCreationForm'], ['selectDocumentTypeForCreationForm:selectDocumentTypeForCreationTable:0:selectD...
['javax.faces.ViewState', fl.getLastJsfState()], ['selectDocumentTypeForCreationForm:selectDocumentTypeForCreationTable:1:selectDocumentTypeForCreationCategory:0:selectDocumentTypeForCreationCategoryTable:2:selectDocumentTypeForCreationCategoryTitleLink', 'selectDocumentTypeForCreationForm:selectDocumentTypeForCreation...
['selectDocumentTypeForCreationForm_SUBMIT', '1'], ['javax.faces.ViewState', fl.getLastJsfState()], ['selectDocumentTypeForCreationForm:selectDocumentTypeForCreationTable:0:selectDocumentTypeForCreationCategory:0:selectDocumentTypeForCreationCategoryTable:1:selectDocumentTypeForCreationCategoryTitleLink', 'selectDocume...
def createFile(self, title, description, file_path=None): fl = self.fl fl.post(fl.server_url + "/view_documents.faces", params=[ ['javax.faces.ViewState', fl.getLastJsfState()], ['selectDocumentTypeForCreationForm:selectDocumentTypeForCreationTable:1:selectDocumentTypeForCreationCategory:0:selectDocumentTypeForCreation...
['CHILDREN_DOCUMENT_LIST', 'CHILDREN_DOCUMENT_LIST'],
def deleteItem(self, title): fl = self.fl folder_uid = self.getDocUid() state = fl.getLastJsfState() self.selectItem(title) fl.post(fl.server_url + "/view_documents.faces", params=[ ['CHILDREN_DOCUMENT_LIST', 'CHILDREN_DOCUMENT_LIST'], ['CHILDREN_DOCUMENT_LIST:nxl_document_listing:nxw_listing_selection_box_with_current...
['CHILDREN_DOCUMENT_LIST:clipboardActionsTable:1:clipboardActionsButton', 'Supprimer'], ['CHILDREN_DOCUMENT_LIST_SUBMIT', '1'], ['javax.faces.ViewState', state]],
['javax.faces.ViewState', state], ['CHILDREN_DOCUMENT_LIST:clipboardActionsTable:1:clipboardActionsButton', 'Delete'], ['CHILDREN_DOCUMENT_LIST_SUBMIT', '1']],
def deleteItem(self, title): fl = self.fl folder_uid = self.getDocUid() state = fl.getLastJsfState() self.selectItem(title) fl.post(fl.server_url + "/view_documents.faces", params=[ ['CHILDREN_DOCUMENT_LIST', 'CHILDREN_DOCUMENT_LIST'], ['CHILDREN_DOCUMENT_LIST:nxl_document_listing:nxw_listing_selection_box_with_current...
self._parse_request()
self.read_request_line() except MaxSizeExceeded: self.simple_response("414 Request-URI Too Long", "The Request-URI sent with the request exceeds the maximum " "allowed bytes.") return try: self.read_request_headers()
def parse_request(self): """Parse the next HTTP request start-line and message-headers.""" self.rfile = SizeCheckWrapper(self.conn.rfile, self.server.max_request_header_size) try: self._parse_request() except MaxSizeExceeded: self.simple_response("413 Request Entity Too Large", "The headers sent with the request exceed...