rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
content += unicode(s, charset) | if charset is not None: content += unicode(s, charset) else: content += unicode(s) | def process_incoming_mail(self, msg): to = self.get_email_address_ident(msg, 'To') reply_to = self.get_email_address_ident(msg, 'In-Reply-To') if not reply_to: print >>sys.stderr, 'This is not a reply (no Reply-To field)' return 1 |
for form in self.document.xpath('/html/body//form//input[@name = "code"]'): return False return True | return not self.document.xpath('/html/body//form//input[@name = "code"]') and \ not self.document.xpath('/html/body//form//input[@name = "userPassword"]') | def is_logged(self): for form in self.document.xpath('/html/body//form//input[@name = "code"]'): return False |
def ICON(self): | def ICON(klass): | def ICON(self): try: import xdg.IconTheme except ImportError: self.logger.debug(u'Python xdg module was not found. Please install it to read icon files.') else: return xdg.IconTheme.getIconPath(self.NAME) |
self.logger.debug(u'Python xdg module was not found. Please install it to read icon files.') | getLogger(klass.NAME).debug(u'Python xdg module was not found. Please install it to read icon files.') | def ICON(self): try: import xdg.IconTheme except ImportError: self.logger.debug(u'Python xdg module was not found. Please install it to read icon files.') else: return xdg.IconTheme.getIconPath(self.NAME) |
return xdg.IconTheme.getIconPath(self.NAME) | return xdg.IconTheme.getIconPath(klass.NAME) | def ICON(self): try: import xdg.IconTheme except ImportError: self.logger.debug(u'Python xdg module was not found. Please install it to read icon files.') else: return xdg.IconTheme.getIconPath(self.NAME) |
self.ui.scrollAreaContent.layout().insertWidget(i, button) | self.ui.scrollAreaContent.layout().insertWidget(pos, button) | def _insert_load_button(self, pos): button = QPushButton(self.tr('More messages...')) self.connect(button, SIGNAL('clicked()'), lambda: self._load_button_pressed(button)) if pos >= 0: self.ui.scrollAreaContent.layout().insertWidget(i, button) else: self.ui.scrollAreaContent.layout().addWidget(button) |
elif u.dis_mode == 32 and not(inst.opr_mode == 64 or REX_W(inst.pfx.rex) == 0): | elif u.dis_mode == 32 or not(inst.opr_mode == 32 and REX_W(inst.pfx.rex) == 0): | def resolve_gpr64(u, inst, gpr_op): """64bit General Purpose Register-Selection.""" if gpr_op in range(OP_rAXr8, OP_rDIr15) : index = (gpr_op - OP_rAXr8) |(REX_B(inst.pfx.rex) << 3) else: index = gpr_op - OP_rAX if inst.opr_mode == 16: return GPR[16][index] elif u.dis_mode == 32 and not(inst.opr_mode == 64 or REX_W(in... |
import pefile | try : import pefile except : print('pefile module not found. see http://code.google.com/p/pefile/') exit() | def __init__(self, source, base_address): BufferHook.__init__(self, source, base_address) import pefile self.pe = pefile.PE(data = source) self.source = self.pe.get_memory_mapped_image() self.base_address = self.pe.OPTIONAL_HEADER.ImageBase self.entry_point = (self.base_address + self.pe.OPTIONAL_HEADER.AddressOfEntryP... |
class PEFileHook(PEStringHook): def __init__(self, source, base_address): PEStringHook.__init__(self, source, base_address) import pefile | class PEFileHook(BufferHook): def __init__(self, source, base_address): BufferHook.__init__(self, source, base_address) try : import pefile except : print('pefile module not found. see http://code.google.com/p/pefile/') exit() | def symbols(self): ret = {} for entry in self.pe.DIRECTORY_ENTRY_IMPORT: for imp in entry.imports: if imp.name: ret[imp.address] = imp.name |
if gpr_op in range(OP_rAXr8, OP_rDIr15) : | if gpr_op in range(OP_rAXr8, OP_rDIr15 + 1) : | def resolve_gpr64(u, inst, gpr_op): """64bit General Purpose Register-Selection.""" if gpr_op in range(OP_rAXr8, OP_rDIr15) : index = (gpr_op - OP_rAXr8) |(REX_B(inst.pfx.rex) << 3) else: index = gpr_op - OP_rAX if inst.opr_mode == 16: return GPR[16][index] elif u.dis_mode == 32 or not(inst.opr_mode == 32 and REX_W(in... |
def __init__(self,graphe,dist,angle,mark): | def __init__(self,graphe,dist,angle,text): | def __init__(self,graphe,dist,angle,mark): self.graphe = graphe self.dist = dist self.angle = angle self.mark = mark |
self.mark = mark | self.text = text | def __init__(self,graphe,dist,angle,mark): self.graphe = graphe self.dist = dist self.angle = angle self.mark = mark |
def mark(self,dist,angle,mark): | def put_mark(self,dist,angle,text): | def mark(self,dist,angle,mark): self.marque = True self.mark = Mark(self,dist,angle,mark) |
self.mark = Mark(self,dist,angle,mark) | self.mark = Mark(self,dist,angle,text) | def mark(self,dist,angle,mark): self.marque = True self.mark = Mark(self,dist,angle,mark) |
bb = BoundingBox(Point(self.x-0.1,self.y-01),Point(self.x+0.1,self.y+01)) | bb = BoundingBox(Point(self.x-0.1,self.y-0.1),Point(self.x+0.1,self.y+0.1)) | def bounding_box(self,pspict): """ return the bounding box of the point including its mark |
dimx,dimy=pspict.get_box_size(self.mark.mark) | central_point = self.mark.central_point() dimx,dimy=pspict.get_box_size(self.mark.text) bb.AddPoint( Point(central_point.x-dimx/2,central_point.y-dimy/2) ) bb.AddPoint( Point(central_point.x+dimx/2,central_point.y+dimy/2) ) return bb | def bounding_box(self,pspict): """ return the bounding box of the point including its mark |
code = ["\documentclass{article}\n","\usepackage{pstricks,pst-eucl,pstricks-add}\n","\usepackage{pst-plot}\n","\usepackage{pst-eps}\n","\pagestyle{empty}\n"] | code = ["\documentclass{article}\n","\usepackage{pstricks,pst-eucl,pstricks-add}\n","\usepackage{pst-plot}\n","\usepackage{pst-eps}\n","\pagestyle{empty}\n\usepackage{calc}\n"] | def latex_code_for_eps(self): code = ["\documentclass{article}\n","\usepackage{pstricks,pst-eucl,pstricks-add}\n","\usepackage{pst-plot}\n","\usepackage{pst-eps}\n","\pagestyle{empty}\n"] # Allows to add some lines, like packages or macro definitions required. This is useful when one add formulas in the picture # that ... |
print code | def latex_code_for_eps(self): code = ["\documentclass{article}\n","\usepackage{pstricks,pst-eucl,pstricks-add}\n","\usepackage{pst-plot}\n","\usepackage{pst-eps}\n","\pagestyle{empty}\n"] # Allows to add some lines, like packages or macro definitions required. This is useful when one add formulas in the picture # that ... | |
def __init__(self,name="CAN_BE_A_PROBLEM_IF_TRY_TO_PRODUCE_EPS"): | def __init__(self,name="CAN_BE_A_PROBLEM_IF_TRY_TO_PRODUCE_EPS_OR_PDF"): | def __init__(self,name="CAN_BE_A_PROBLEM_IF_TRY_TO_PRODUCE_EPS"): r""" A name is required for producing intermediate files. This is the case when one wants to produce eps/pdf files of one wants to make interactions with LaTeX (see pspict.get_counter_value). """ self.name = name # self.name is used in order to name the... |
interCounterName = "counter"+pspicture.NomPointLibre.suivant() interWriteName = "write"+interCounterName | interWriteName = newwriteName() interCounterName = counterName() interCounterId = "counter"+self.name+pspicture.NomPointLibre.suivant() | def get_counter_value(self,counter_name,default_value=0): """ return the value of the (LaTeX) counter <name> at this point of the LaTeX file |
self.add_latex_line(r"\newcounter{%s}"%interCounterName) | self.initialize_newwrite() self.initialize_counter() | def get_counter_value(self,counter_name,default_value=0): """ return the value of the (LaTeX) counter <name> at this point of the LaTeX file |
self.add_latex_line(r"\newwrite\%s"%interWriteName) self.add_latex_line(r"\immediate\openout\%s=%s"%(interWriteName,interWriteFile)) self.add_latex_line(r"\immediate\write\%s{%s:\arabic{%s}:}"%(interWriteName,interCounterName,interCounterName)) self.add_latex_line(r"\immediate\closeout\%s"%interWriteName) | self.add_latex_line(r"\immediate\write\%s{%s:\arabic{%s}:}"%(interWriteName,interCounterId,interCounterName)) | def get_counter_value(self,counter_name,default_value=0): """ return the value of the (LaTeX) counter <name> at this point of the LaTeX file |
text = f.read().split(":") | text = f.read().replace('\n','').split(":") | def get_counter_value(self,counter_name,default_value=0): """ return the value of the (LaTeX) counter <name> at this point of the LaTeX file |
raise LabelNotFound("Warning : the auxiliary file does not contain the searched label. Compile your LaTeX file.") | raise LabelNotFound("Warning : the auxiliary file does not contain the label «%s». Compile your LaTeX file."%interCounterName) | def get_counter_value(self,counter_name,default_value=0): """ return the value of the (LaTeX) counter <name> at this point of the LaTeX file |
interName = dimension_name+pspicture.NomPointLibre.suivant() | suffixe = pspicture.NomPointLibre.suivant() interName = dimension_name+self.name+suffixe | def get_box_dimension(self,tex_expression,dimension_name): """ Return the dimension of the LaTeX box corresponding to the LaTeX expression tex_expression. |
self.TraceRectangle( Rectangle(self.BB.bg,self.BB.hd), "linecolor=cyan") | self.DrawBoundingBox(self.BB) def DrawBoundingBox(self,obj): """Draw the bounding box of an object when it has a method bounding_box. If not, assume that the object is the bounding box to be drawn.""" try : bb = obj.bounding_box(self) except AttributeError : bb = obj self.TraceRectangle( Rectangle(bb.bg,bb.hd), "lineco... | def TraceBB(self): self.TraceRectangle( Rectangle(self.BB.bg,self.BB.hd), "linecolor=cyan") |
self.add_latex_line("\\rput(%s){\\rput(%s;%s){%s}}"%(p.psNom,str(mark.dist),str(mark.angle),str(mark.mark))) | self.add_latex_line("\\rput(%s){\\rput(%s;%s){%s}}"%(p.psNom,str(mark.dist),str(mark.angle),str(mark.text))) | def DrawGraphOfAPoint(self,graphe): p = graphe.point self.BB.AddPoint(p) self.add_latex_line( p.code(graphe.params()) ) if graphe.marque : mark = graphe.mark if p.psNom not in self.listePoint : self.AddPoint(p) #self.add_latex_line("\\rput("+p.psNom+"){\\rput("+str(dist)+";"+str(angle)+"){"+marque+"}}") self.add_latex_... |
self.DrawVector(graphe.vector,graphe.params()).MarkTheVector(mark.dist,mark.angle,mark.mark) | self.DrawVector(graphe.vector,graphe.params()).MarkTheVector(mark.dist,mark.angle,mark.text) | def DrawGraphOfAVector(self,graphe): if graphe.marque == False : self.DrawVector(graphe.vector,graphe.params()) if graphe.marque == True : mark = graphe.mark self.DrawVector(graphe.vector,graphe.params()).MarkTheVector(mark.dist,mark.angle,mark.mark) |
return self.graphe.translate(PolarVector(self.graphe,self.dist,self.angle)) | if pspict: A=pspict.xunit B=pspict.yunit d=self.dist theta=radian(self.angle) xP=d*cos(theta)/A yP=d*sin(theta)/B return self.graphe.translate(Vector(Point(0,0),Point(xP,yP))) else: return self.graphe.translate(PolarVector(self.graphe,self.dist,self.angle)) | def central_point(self,pspict): """ return the central point of the mark, that is the point where the mark arrives |
pspict.DrawGraph(C) | C.mark.graphe=C pspict.record_marks.append(C.mark) | def pstricks_code(self,pspict=None): self.recompute() a=[] C=self.mseg.center() C.marque=self.marque vI=Vector(C,self.mI) vF=Vector(C,self.mF) vI.parameters=self.parameters vF.parameters=self.parameters a.append(vI.pstricks_code()) a.append(vF.pstricks_code()) if self.marque : C.mark=self.mark #C.add_option('PointSymbo... |
ssFig.label=self.label+"ssFig"+str(len(self.self.SSfigures)) | ssFig.label=self.label+suffixe ssFig.pspicture.name=self.label+"pspict"+suffixe | def append_subfigure(self,ssFig): # This function was initially names AjouteSSfigure self.SSfigures.append(ssFig) if not ssFig.label: ssFig.label=self.label+"ssFig"+str(len(self.self.SSfigures)) print r"See also the subfigure \ref{%s}"%ssFig.label |
self.add_latex_line("} % Fermeture de la sous-figure "+str(self.SSfigures.index(f)+1),"SUBFIGURES") | self.add_latex_line("\label{%s}"%f.label,"SUBFIGURES") self.add_latex_line("} % Closing subfigure "+str(self.SSfigures.index(f)+1),"SUBFIGURES") | def conclude(self): if not globals_vars.special_exit() : self.add_latex_line("\psset{xunit="+str(self.xunit)+",yunit="+str(self.yunit)+"}","BEFORE SUBFIGURES") for f in self.SSfigures : self.add_latex_line("\subfigure["+f.caption+"]{%","SUBFIGURES") self.add_latex_line(f.code,"SUBFIGURES") self.add_latex_line("} % ... |
def add_pspicture(self,pspict): self.add_latex_line(pspict.contenu()) | def add_pspicture(self,pspicture): self.pspicture=pspicture self.add_latex_line(pspicture.contenu()) | def add_pspicture(self,pspict): self.add_latex_line(pspict.contenu()) |
truc.add_latex_line("% This file is automatically generated by phystricks") truc.add_latex_line("% see the documentation ") truc.add_latex_line("% http://student.ulb.ac.be/~lclaesse/phystricks-doc.pdf ") truc.add_latex_line("% See the projects phystricks and phystricks-doc at ") truc.add_latex_line("% http://gitori... | position = "ENTETE" truc.add_latex_line("% This file is automatically generated by phystricks",position) truc.add_latex_line("% See the documentation ",position) truc.add_latex_line("% http://student.ulb.ac.be/~lclaesse/phystricks-doc.pdf ",position) truc.add_latex_line("% and the projects phystricks and phystricks-doc... | def add_latex_line_entete(truc): truc.add_latex_line("% This file is automatically generated by phystricks") truc.add_latex_line("% see the documentation ") truc.add_latex_line("% http://student.ulb.ac.be/~lclaesse/phystricks-doc.pdf ") truc.add_latex_line("% See the projects phystricks and phystricks-doc at ") truc... |
add_latex_line_entete(self) self.add_latex_line("%BEFORE_PSPICTURE") self.add_latex_line("%BEGIN_PSPICTURE") self.add_latex_line("\psset{PointSymbol=none,PointName=none,algebraic=true}\n") self.add_latex_line("%GRID") self.add_latex_line("%AXES") self.add_latex_line("%OTHER STUFF") | self.separator_dico = {} print self.dir() self.separator_number = 0 self.new_separator("ENTETE") self.new_separator("BEFORE PSPICTURE") self.new_separator("BEGIN PSPICTURE") self.new_separator("GRID") self.new_separator("AXES") self.new_separator("OTHER STUFF") self.new_separator("DEFAULT") self.new_separator("AFTER PS... | def __init__(self,name="CAN_BE_A_PROBLEM_IF_TRY_TO_PRODUCE_EPS_OR_PDF"): r""" A name is required for producing intermediate files. This is the case when one wants to produce eps/pdf files of one wants to make interactions with LaTeX (see pspict.get_counter_value). """ self.name = name # self.name is used in order to n... |
self.add_latex_line(code,"BEFORE_PSPICTURE") | self.add_latex_line(code,"BEFORE PSPICTURE") | def initialize_newwrite(self): if not self.newwriteDone : code = r""" \makeatletter \@ifundefined{%s} {\newwrite{\%s} \immediate\openout\%s=%s } \makeatother"""%(newwriteName(),newwriteName(),newwriteName(),self.interWriteFile) self.add_latex_line(code,"BEFORE_PSPICTURE") self.newwriteDone = True |
self.add_latex_line(code,"BEFORE_PSPICTURE") | self.add_latex_line(code,"BEFORE PSPICTURE") | def initialize_counter(self): if not self.counterDone: code = r""" \makeatletter \@ifundefined{c@%s} {\newcounter{%s}} \makeatother """%(counterName(),counterName()) # make LaTeX test if the counter exist before to create it. self.add_latex_line(code,"BEFORE_PSPICTURE") self.counterDone = True |
self.add_latex_line(code,"BEFORE_PSPICTURE") | self.add_latex_line(code,"BEFORE PSPICTURE") | def initialize_newlength(self): if not self.newlengthDone : code =r""" \makeatletter \@ifundefined{%s}{\newlength{\%s}} \makeatother """%(newlengthName(),newlengthName()) self.add_latex_line(code,"BEFORE_PSPICTURE") self.newlengthDone = True |
self.add_latex_line(r"\immediate\write\%s{%s:%s:}"%(interWriteName,Id,value),"BEFORE_PSPICTURE") | self.add_latex_line(r"\immediate\write\%s{%s:%s:}"%(interWriteName,Id,value),"BEFORE PSPICTURE") | def add_write_line(self,Id,value): r"""Writes in the standard auxiliary file \newwrite an identifier and a value separated by a «:»""" interWriteName = newwriteName() self.initialize_newwrite() self.add_latex_line(r"\immediate\write\%s{%s:%s:}"%(interWriteName,Id,value),"BEFORE_PSPICTURE") |
self.add_latex_line(r"\setlength{\%s}{\%s{%s}}"%(newlengthName(),dimension_name,tex_expression),"BEFORE_PSPICTURE") | self.add_latex_line(r"\setlength{\%s}{\%s{%s}}"%(newlengthName(),dimension_name,tex_expression),"BEFORE PSPICTURE") | def get_box_dimension(self,tex_expression,dimension_name): """ Return the dimension of the LaTeX box corresponding to the LaTeX expression tex_expression. |
def add_latex_line(self,ligne,position="DEFAULT"): """ Add a line in the pstricks code. The optional argument <position> is the name of a marker like %GRID, %AXES, ... """ try : N = self.pstricks_code.index(position)+1 self.IncrusteLigne(ligne,N) except ValueError : try : position = "%"+position+"\n" N = self.pstricks_... | def fixe_tailleY(self,l): self.dilatation_Y(l/self.BB.tailleY()) | |
def DrawGraphOfASegment(self,graphe,N=None): | def DrawGraphOfASegment(self,graphe,separator="DEFAULT"): | def DrawGraphOfASegment(self,graphe,N=None): if graphe.wavy == False : self.DrawSegment(graphe.seg,graphe.params(),N=N) if graphe.wavy == True : waviness = graphe.waviness self.DrawWavySegment(graphe.seg,waviness.dx,waviness.dy,graphe.params(),N=N) |
self.DrawSegment(graphe.seg,graphe.params(),N=N) | self.DrawSegment(graphe.seg,graphe.params(),separator=separator) | def DrawGraphOfASegment(self,graphe,N=None): if graphe.wavy == False : self.DrawSegment(graphe.seg,graphe.params(),N=N) if graphe.wavy == True : waviness = graphe.waviness self.DrawWavySegment(graphe.seg,waviness.dx,waviness.dy,graphe.params(),N=N) |
self.DrawWavySegment(graphe.seg,waviness.dx,waviness.dy,graphe.params(),N=N) | self.DrawWavySegment(graphe.seg,waviness.dx,waviness.dy,graphe.params(),separator=separator) | def DrawGraphOfASegment(self,graphe,N=None): if graphe.wavy == False : self.DrawSegment(graphe.seg,graphe.params(),N=N) if graphe.wavy == True : waviness = graphe.waviness self.DrawWavySegment(graphe.seg,waviness.dx,waviness.dy,graphe.params(),N=N) |
def DrawGraph(self,graphe,N=None): | def DrawGraph(self,graphe,separator="DEFAULT"): | def DrawGraph(self,graphe,N=None): # If n is not None, it is the number of the line where the code has to be put. This is used by DrawGrid if type(graphe) == GraphOfAFunction : self.DrawGraphOfAFunction(graphe) if type(graphe) == GraphOfAParametricCurve : self.DrawGraphOfAParametricCurve(graphe) if type(graphe) == Grap... |
self.DrawGraphOfASegment(graphe,N=N) | self.DrawGraphOfASegment(graphe,separator=separator) | def DrawGraph(self,graphe,N=None): # If n is not None, it is the number of the line where the code has to be put. This is used by DrawGrid if type(graphe) == GraphOfAFunction : self.DrawGraphOfAFunction(graphe) if type(graphe) == GraphOfAParametricCurve : self.DrawGraphOfAParametricCurve(graphe) if type(graphe) == Grap... |
self.DrawGraph(element,self.pstricks_code.index("%GRID\n")+1) | self.DrawGraph(element,"GRID") | def DrawGrid(self,grid): # The difficulty is that the grid has to be draw first, while most of time it is given last because of the bounding box. self.BB.AddBB(grid.BB) for element in grid.drawing(): self.DrawGraph(element,self.pstricks_code.index("%GRID\n")+1) |
a = ["\psset{xunit="+str(self.xunit)+",yunit="+str(self.yunit)+",LabelSep="+str(self.LabelSep)+"}\n"] self.IncrusteLigne("\\begin{pspicture}%s%s\n"%(self.BB.bg.coordinates(),self.BB.hd.coordinates()),self.pstricks_code.index("%BEGIN_PSPICTURE\n")+1) a.extend(self.pstricks_code) a.append("\end{pspicture}\n") | add_latex_line_entete(self) self.add_latex_line("\psset{xunit="+str(self.xunit)+",yunit="+str(self.yunit)+",LabelSep="+str(self.LabelSep)+"}","BEFORE PSPICTURE") self.add_latex_line("\psset{PointSymbol=none,PointName=none,algebraic=true}\n","BEFORE PSPICTURE") self.IncrusteLigne("\\begin{pspicture}%s%s\n"%(self.BB.bg.c... | def contenu_pstricks(self): """ One has to declare the xunit,yunit before to give the bounding box. The value of LabelSep is the distance between an angle and the lable of the angle. It is by default 1, but if there is a dilatation, the visual effect is bad. """ if self.LabelSep == 1 : self.LabelSep = 2/(self.xunit+sel... |
print "682", self.options.code() a.append("\pscustom["+self.options.code()+"]{") | a.append("\pscustom["+self.params()+"]{") | def pstricks_code(self,pspict): bb=BoundingBox() g = phyFunction(self.f1).graph(self.mx,self.Mx) bb.add_graph(g,pspict) g = phyFunction(self.f2).graph(self.mx,self.Mx) bb.add_graph(g,pspict) if self.parameters.color : # Here we give a default color self.add_option("fillcolor="+self.parameters.color+",linecolor="+self.... |
self.parameters.color="cyan" | self.parameters.color=None | def __init__(self,f,mx,Mx): self.f=EnsurephyFunction(f) GraphOfAnObject.__init__(self,self) self.mx = mx self.Mx = Mx self.add_option("fillstyle=vlines,linestyle=dashed") # Some default values self.parameters.color="cyan" # Default color |
self.add_option("fillcolor="+self.parameters.color+",linecolor="+self.parameters.color+",hatchcolor="+self.parameters.color) a.append("\pscustom["+self.options.code()+"]{") | if self.parameters.color: self.add_option("fillcolor="+self.parameters.color+",linecolor="+self.parameters.color+",hatchcolor="+self.parameters.color) a.append("\pscustom["+self.params()+"]{") | def pstricks_code(self,pspict): A = Point(self.mx,0) B = Point(self.Mx,0) X = self.f.get_point(self.mx) Y = self.f.get_point(self.Mx) a=[] deb = numerical_approx(self.mx) # Avoid "pi" in the pstricks code fin = numerical_approx(self.Mx) self.add_option("fillcolor="+self.parameters.color+",linecolor="+self.parameters.c... |
bb = BoundingBox() bb.AddX(self.xmin(self.llamI,self.llamF)) bb.AddX(self.xmax(self.llamI,self.llamF)) bb.AddY(self.ymin(self.llamI,self.llamF)) bb.AddY(self.ymax(self.llamI,self.llamF)) | xmin=self.xmin(self.llamI,self.llamF) xmax=self.xmax(self.llamI,self.llamF) ymin=self.ymin(self.llamI,self.llamF) ymax=self.ymax(self.llamI,self.llamF) bb = BoundingBox( Point(xmin,ymin),Point(xmax,ymax) ) print "252", bb | def bounding_box(self,pspict=None): bb = BoundingBox() bb.AddX(self.xmin(self.llamI,self.llamF)) bb.AddX(self.xmax(self.llamI,self.llamF)) bb.AddY(self.ymin(self.llamI,self.llamF)) bb.AddY(self.ymax(self.llamI,self.llamF)) return bb |
central_point.parameters.color="red" self.DrawGraph(central_point) | def contenu(self): """ Notice that if the option --eps/pdf is given, this method launches some compilations when creating contenu_eps/pdf """ # Here we are supposed to be sure of the xunit, yunit, so we can compute the BB needed for the points with marks. # For the same reason, all the marks that were asked to be drawn... | |
F = vI.add_size(lF).F | F = vF.add_size(lF).F | def add_size(self,lI,lF): vI = Vector(self.center(),self.I) vF = Vector(self.center(),self.F) I = vI.add_size(lI).F F = vI.add_size(lF).F return Segment(I,F) |
def SinglePicture(nom): | def SinglePicture(name): | def SinglePicture(nom): """ Return the tuple of pspicture and figure that one needs in 90% of the cases """ return pspicture(nom), GenericFigure(nom) |
return pspicture(nom), GenericFigure(nom) | fig = GenericFigure(name) pspict=fig.new_pspicture(name) return pspict,fig | def SinglePicture(nom): """ Return the tuple of pspicture and figure that one needs in 90% of the cases """ return pspicture(nom), GenericFigure(nom) |
def __init__(self,caption,label,fich): | def __init__(self,caption,name,fich): | def __init__(self,caption,label,fich): self.caption = caption self.label = label self.xunit = 1 self.yunit = 1 self.code = [] self.SSfigures = [] self.fichier = Fichier (fich) |
self.label = label | self.name = name | def __init__(self,caption,label,fich): self.caption = caption self.label = label self.xunit = 1 self.yunit = 1 self.code = [] self.SSfigures = [] self.fichier = Fichier (fich) |
ssfig=subfigure(caption,self.label+"ss"+name) | ssfig=subfigure(caption,self.name+"ss"+name) | def new_subfigure(self,caption,name): """ Create a subfigure in the figure and return it. |
if not ssFig.label: ssFig.label=self.label+suffixe ssFig.pspicture.name=self.label+"pspict"+suffixe print r"See also the subfigure \ref{%s}"%ssFig.label | if not ssFig.name: ssFig.name=self.name+suffixe print r"See also the subfigure \ref{%s}"%ssFig.name def new_pspicture(self,name): pspict=pspicture("FIG"+self.name+"PICT"+name) pspict.mother=self self.add_pspicture(pspict) return pspict | def append_subfigure(self,ssFig): # This function was initially named AjouteSSfigure self.SSfigures.append(ssFig) suffixe = "ssFig"+str(len(self.SSfigures)) if not ssFig.label: ssFig.label=self.label+suffixe ssFig.pspicture.name=self.label+"pspict"+suffixe print r"See also the subfigure \ref{%s}"%ssFig.label |
self.add_latex_line(pspict.separator_dico["WRITE_AND_LABEL"],"WRITE_AND_LABEL") pspict.separator_dico["WRITE_AND_LABEL"].latex_code=[] self.add_latex_line(pspict.contenu(),"PSPICTURE") | self.record_pspicture.append(pspict) | def add_pspicture(self,pspict): self.add_latex_line(pspict.separator_dico["WRITE_AND_LABEL"],"WRITE_AND_LABEL") pspict.separator_dico["WRITE_AND_LABEL"].latex_code=[] self.add_latex_line(pspict.contenu(),"PSPICTURE") # Here, what is added depends on --eps |
self.add_latex_line(f.code,"SUBFIGURES") self.add_latex_line("\label{%s}"%f.label,"SUBFIGURES") | self.add_latex_line(f.subfigure_code(),"SUBFIGURES") self.add_latex_line("\label{%s}"%f.name,"SUBFIGURES") | def conclude(self): if not globals_vars.special_exit() : self.add_latex_line("\psset{xunit="+str(self.xunit)+",yunit="+str(self.yunit)+"}","BEFORE SUBFIGURES") for f in self.SSfigures : self.add_latex_line("\subfigure["+f.caption+"]{%","SUBFIGURES") self.add_latex_line(f.code,"SUBFIGURES") self.add_latex_line("\label{%... |
"""%(self.caption,self.label) | """%(self.caption,self.name) | def conclude(self): if not globals_vars.special_exit() : self.add_latex_line("\psset{xunit="+str(self.xunit)+",yunit="+str(self.yunit)+"}","BEFORE SUBFIGURES") for f in self.SSfigures : self.add_latex_line("\subfigure["+f.caption+"]{%","SUBFIGURES") self.add_latex_line(f.code,"SUBFIGURES") self.add_latex_line("\label{%... |
self.code = [] | self.record_pspicture=[] | def __init__(self,caption,name=None): self.caption = caption self.name = name # The label will be given in figure.append_subfigure self.code = [] self.mother=None |
def add_latex_line(self,ligne): self.code.append(ligne) def AjouteCode(self,cod): self.code.extend(cod) | def add_latex_line(self,ligne,separator_name): self.mother.add_latex_line(ligne,separator_name) | def add_latex_line(self,ligne): self.code.append(ligne) |
self.pspicture=pspicture self.add_latex_line(pspicture.contenu()) | self.record_pspicture.append(pspicture) | def add_pspicture(self,pspicture): self.pspicture=pspicture # Serves to give a name to the pspicture when the subfigure is included self.add_latex_line(pspicture.contenu()) |
self.mother.add_latex_line(ligne,separator) | self.mother.add_latex_line(ligne,separator_name) | def add_latex_line(self,ligne,separator_name="DEFAULT"): """ Add a line in the pstricks code. The optional argument <position> is the name of a marker like %GRID, %AXES, ... """ if separator_name==None: separator_name="DEFAULT" if separator_name=="WRITE_AND_LABEL" and self.mother : self.mother.add_latex_line(ligne,sepa... |
print "prop_precision is zero. Something sucks. You probably want to launch me in an infinite loop. I'm going to crash now; please contact my labor union;" | print "prop_precision is zero. Something sucks. You probably want to launch me in an infinite loop. I'm going to crash now; please contact my labour union." | def get_regular_parameter(self,mll,Mll,dl): """ returns a list of values of the parameter such that the corresponding points are equally spaced by dl. Here, we compute the distance using the method arc_length. """ prop_precision = float(dl)/100 # precision of the interval fp = self.derivative() minDll = abs(Mll-mll)/... |
return "%s | %s "%(SubstitutionMathPsTricks(repr(self.f1.sage(x=t))), SubstitutionMathPsTricks(repr(self.f2.sage(x=t))) ) | return "%s | %s "%(SubstitutionMathPsTricks(repr(self.f1.sage(x=t)).replace("pi","3.1415")), SubstitutionMathPsTricks(repr(self.f2.sage(x=t)).replace("pi","3.1415")) ) | def pstricks(self): var('t') return "%s | %s "%(SubstitutionMathPsTricks(repr(self.f1.sage(x=t))), SubstitutionMathPsTricks(repr(self.f2.sage(x=t))) ) |
Returns value | Return value | def version(self): """ Name ---- `version` () |
def dispatch(self): args = self.parser.parse_args() | def dispatch(self, args=None): args = self.parser.parse_args(args) | def dispatch(self): args = self.parser.parse_args() command = args.command_cls(self.parser, args) command.invoke(args) |
class HardwareContextTests(TestCase): | class HardwareContextTests(unittest.TestCase): | def test_get_json_attr_types(self): self.assertEqual(DashboardBundle.get_json_attr_types(), {'test_runs': [TestRun]}) |
self.assertEqual(context.devices, []) | self.assertEqual(hw_context.devices, []) | def test_construction_1(self): hw_context = HardwareContext() self.assertEqual(context.devices, []) |
self.assertTrue(context.devices is devices) | self.assertTrue(hw_context.devices is devices) | def test_construction_2(self): devices = object() hw_context = HardwareContext(devices) self.assertTrue(context.devices is devices) |
self.assertTrue(context.devices is devices) | self.assertTrue(hw_context.devices is devices) | def test_construction_3(self): devices = object() hw_context = HardwareContext(devices=devices) self.assertTrue(context.devices is devices) |
class HardwareDeviceTests(TestCase): | class HardwareDeviceTests(unittest.TestCase): | def test_get_json_attr_types(self): self.assertEqual(HardwareContext.get_json_attr_types(), {'devices': [HardwareDevice]}) |
class SoftwareContextTests(TestCase): | class SoftwareContextTests(unittest.TestCase): | def test_device_types(self): self.assertEqual(HardwareDevice.DEVICE_CPU, "device.cpu") self.assertEqual(HardwareDevice.DEVICE_MEM, "device.mem") self.assertEqual(HardwareDevice.DEVICE_USB, "device.usb") self.assertEqual(HardwareDevice.DEVICE_PCI, "device.pci") self.assertEqual(HardwareDevice.DEVICE_BOARD, "device.board... |
class SoftwareImageTests(TestCase): | class SoftwareImageTests(unittest.TestCase): | def test_get_json_attr_types(self): self.assertEqual(SoftwareContext.get_json_attr_types(), {'packages': [SoftwarePackage], 'sw_image': SoftwareImage}) |
class SoftwarePackageTests(TestCase): | class SoftwarePackageTests(unittest.TestCase): | def test_get_json_attr_types(self): self.assertRaises(NotImplementedError, SoftwareImage.get_json_attr_types) |
class TestCaseTests(TestCase): | class TestCaseTests(unittest.TestCase): | def test_get_json_attr_types(self): self.assertRaises(NotImplementedError, SoftwarePackage.get_json_attr_types) |
verbose_name = _(u"Description."), | verbose_name = _(u"Description"), | def __unicode__(self): return _(u"{name}: {value}").format( name = self.name, value = self.value) |
TestResult.RESULT.PASS: 3, | TestResult.RESULT_PASS: 3, | def test_get_stats(self): test_run = TestRun() for result, count in [ [TestResult.RESULT_PASS, 3], [TestResult.RESULT_FAIL, 5], [TestResult.RESULT_SKIP, 2], [TestResult.RESULT_UNKNOWN, 1]]: for i in range(count): test_run.test_results.append(TestResult(None, result)) stats = test_run.get_stats() self.assertEqual(stats,... |
self.args.BUNDLE_ID, filename) | self.args.SHA1, filename) | def invoke_remote(self): response = self.server.get(self.args.SHA1) if self.args.output is None: filename = response['content_filename'] if os.path.exists(filename) and not self.args.overwrite: print "File {filename!r} already exists".format( filename=filename) print "You may pass --overwrite to write over it" return s... |
specification | specification. | def created_bundle_streams(spec): """ Helper context manager that creates bundle streams according to specification spec is a list of dictionaries with the following keys: user: string indicating user name to create [optional] group: string indicating group name to create [optional] slug: slug-like name [optional] nam... |
spec is a list of dictionaries with the following keys: user: string indicating user name to create [optional] group: string indicating group name to create [optional] slug: slug-like name [optional] name: name of the stream to create [optional] | `spec`: list of dictionaries List of values to make_bundle_stream() | def created_bundle_streams(spec): """ Helper context manager that creates bundle streams according to specification spec is a list of dictionaries with the following keys: user: string indicating user name to create [optional] group: string indicating group name to create [optional] slug: slug-like name [optional] nam... |
yields: list of created bundle streams | yields: list of BundleStream List of created bundle stream objects | def created_bundle_streams(spec): """ Helper context manager that creates bundle streams according to specification spec is a list of dictionaries with the following keys: user: string indicating user name to create [optional] group: string indicating group name to create [optional] slug: slug-like name [optional] nam... |
initargs = { 'user': None, 'group': None, 'slug': stream_args.get('slug', ''), 'name': stream_args.get('name', '')} username = stream_args.get('user') if username: user = User.objects.get_or_create(username=username)[0] initargs['user'] = user groupname = stream_args.get('group') if groupname: group = Group.objects.get... | bundle_streams.append(make_bundle_stream(stream_args)) | def created_bundle_streams(spec): """ Helper context manager that creates bundle streams according to specification spec is a list of dictionaries with the following keys: user: string indicating user name to create [optional] group: string indicating group name to create [optional] slug: slug-like name [optional] nam... |
self._func. len(self._args), len(args))) | self._func, len(self._args), len(args))) | def _fill_args(self, *args, **kwargs): a_out = [] used_kwargs = set() # Walk through all arguments of the original function. Ff the argument # is present in `args' then use it. If we run out of positional # arguments look for keyword arguments with the same name for i, arg_name in enumerate(self._args): # find the argu... |
".".join(map(str, __version__))) | ".".join(map(str, __version__.as_tuple))) | def test_version(self): from dashboard_app import __version__ self.assertEqual(self.xml_rpc_call('version'), ".".join(map(str, __version__))) |
retval = self.xml_rpc_call("ping") self.assertEqual(retval, "pong") | def test_echo(self): self.assertEqual(self.xml_rpc_call("echo", 1), 1) self.assertEqual(self.xml_rpc_call("echo", "string"), "string") self.assertEqual(self.xml_rpc_call("echo", 1.5), 1.5) retval = self.xml_rpc_call("ping") self.assertEqual(retval, "pong") | |
print cleaned_data | def clean(self): cleaned_data = self.cleaned_data print cleaned_data if (cleaned_data.get('user', '') is not None and cleaned_data.get('group') is not None): raise forms.ValidationError('BundleStream cannot have both user ' 'and name set at the same time') return super(BundleStreamAdminForm, self).clean() | |
self.devices = devices or [] | if devices is None: devices = [] self.devices = devices | def __init__(self, devices=None): self.devices = devices or [] |
) | "Log file name") | def _set_log_filename(self, log_filename): self._log_filename = log_filename |
) | "Log file line number") | def _set_log_lineno(self, log_lineno): self._log_lineno = log_lineno |
verbose_name = _(u"Package name")) | verbose_name = _(u"Name")) | def save(self, *args, **kwargs): if self.content: sha1 = hashlib.sha1() for chunk in self.content.chunks(): sha1.update(chunk) self.content_sha1 = sha1.hexdigest() self.content.seek(0) return super(Bundle, self).save(*args, **kwargs) |
scenarios = [ ('bundle_defaults', { | _TEST_RUN_BOILERPLATE = """ "test_id": "some_test_id", "test_results": [], "analyzer_assigned_uuid": "1ab86b36-c23d-11df-a81b-002163936223", "analyzer_assigned_date": "2010-12-31T23:59:59Z", """ scenarios = [ ('empty_bundle', { | def test_deserialize_clears_old_error_on_success(self): BundleDeserializationError.objects.create( bundle = self.bundle, error_message="not important").save() mock = self.mocker.patch(self.bundle) expect(mock._do_deserialize()) self.mocker.replay() self.bundle.deserialize() # note we cannot check for self.bundle.deseri... |
('bundle_format', { 'json_text': '{"format": "text"}', | ('bundle_parsing', { 'json_text': """ { "format": "Dashboard Bundle Format 1.0", "test_runs": [] } """, | def test_deserialize_clears_old_error_on_success(self): BundleDeserializationError.objects.create( bundle = self.bundle, error_message="not important").save() mock = self.mocker.patch(self.bundle) expect(mock._do_deserialize()) self.mocker.replay() self.bundle.deserialize() # note we cannot check for self.bundle.deseri... |
selectors.bundle.format, "text"), ] }), ('bundle_test_runs', { 'json_text': '{"test_runs": []}', 'selectors': { 'bundle': lambda bundle: bundle }, 'validators': [ | selectors.bundle.format, "Dashboard Bundle Format 1.0"), | def test_deserialize_clears_old_error_on_success(self): BundleDeserializationError.objects.create( bundle = self.bundle, error_message="not important").save() mock = self.mocker.patch(self.bundle) expect(mock._do_deserialize()) self.mocker.replay() self.bundle.deserialize() # note we cannot check for self.bundle.deseri... |
('test_run_defaults', { | ('test_run_parsing', { | def test_deserialize_clears_old_error_on_success(self): BundleDeserializationError.objects.create( bundle = self.bundle, error_message="not important").save() mock = self.mocker.patch(self.bundle) expect(mock._do_deserialize()) self.mocker.replay() self.bundle.deserialize() # note we cannot check for self.bundle.deseri... |
selectors.test_run.analyzer_assigned_uuid, None), lambda self, selectors: self.assertEqual( selectors.test_run.analyzer_assigned_date, None), lambda self, selectors: self.assertEqual( selectors.test_run.time_check_performed, False), lambda self, selectors: self.assertEqual( selectors.test_run.attributes, {}), lambda se... | selectors.test_run.test_id, "some_test_id"), | def test_deserialize_clears_old_error_on_success(self): BundleDeserializationError.objects.create( bundle = self.bundle, error_message="not important").save() mock = self.mocker.patch(self.bundle) expect(mock._do_deserialize()) self.mocker.replay() self.bundle.deserialize() # note we cannot check for self.bundle.deseri... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.