bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
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... | 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... | 446,300 |
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 | def append_subfigure(self,ssFig): # This function was initially names AjouteSSfigure self.SSfigures.append(ssFig) 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 | 446,301 |
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 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{%... | 446,302 |
def add_pspicture(self,pspict): self.add_latex_line(pspict.contenu()) | def add_pspicture(self,pspict): self.add_latex_line(pspict.contenu()) | 446,303 |
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... | def add_latex_line_entete(truc): 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 proje... | 446,304 |
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... | 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... | 446,305 |
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... | 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... | 446,306 |
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 | 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 | 446,307 |
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 | 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 | 446,308 |
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 | 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 | 446,309 |
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") | 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") | 446,310 |
def get_box_dimension(self,tex_expression,dimension_name): """ Return the dimension of the LaTeX box corresponding to the LaTeX expression tex_expression. | def get_box_dimension(self,tex_expression,dimension_name): """ Return the dimension of the LaTeX box corresponding to the LaTeX expression tex_expression. | 446,311 |
def fixe_tailleY(self,l): self.dilatation_Y(l/self.BB.tailleY()) | def fixe_tailleY(self,l): self.dilatation_Y(l/self.BB.tailleY()) | 446,312 |
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 DrawGraphOfASegment(self,graphe,separator="DEFAULT"): 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) | 446,313 |
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 DrawGraphOfASegment(self,graphe,N=None): if graphe.wavy == False : self.DrawSegment(graphe.seg,graphe.params(),separator=separator) if graphe.wavy == True : waviness = graphe.waviness self.DrawWavySegment(graphe.seg,waviness.dx,waviness.dy,graphe.params(),N=N) | 446,314 |
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 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) | 446,315 |
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... | def DrawGraph(self,graphe,separator="DEFAULT"): # 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(gr... | 446,316 |
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... | 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... | 446,317 |
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) | 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) | 446,318 |
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... | 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... | 446,319 |
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... | 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... | 446,320 |
def contenu(self): """ Notice that if the option --eps/pdf is given, this method launches some compilations when creating contenu_eps/pdf """ for sortie in globals.list_exits: if globals.__getattribute__(sortie+"_exit"): print "je vois %s"%sortie return self.__getattribute__("contenu_"+sortie)() # Erreur très intéres... | def contenu(self): """ Notice that if the option --eps/pdf is given, this method launches some compilations when creating contenu_eps/pdf """ for sortie in globals.list_exits: if globals.__getattribute__(sortie+"_exit"): print "je vois %s"%sortie return self.__getattribute__("contenu_"+sortie)() # Erreur très intéres... | 446,321 |
def __init__(self): self.DicoOptions = {} | def__init__(self):self.DicoOptions={} | 446,322 |
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.... | 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.... | 446,323 |
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 | 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 | 446,324 |
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... | 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) if self.parameters.color: self.add_option("fillcolor="+self.parameters.color+",lin... | 446,325 |
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 | def bounding_box(self,pspict=None): 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 return bb | 446,326 |
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... | 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... | 446,327 |
def dilate(self,coef): """ return a Segment which is dilated by the coefficient coef """ return self.fix_size(self.length()*coef) | defdilate(self,coef):"""returnaSegmentwhichisdilatedbythecoefficientcoef"""returnself.fix_size(self.length()*coef) | 446,328 |
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 add_size(self,lI,lF): vI = Vector(self.center(),self.I) vF = Vector(self.center(),self.F) I = vI.add_size(lI).F F = vF.add_size(lF).F return Segment(I,F) | 446,329 |
def LineInterLine(l1,l2): var('x,y') #eq1 = l1.sage_equation() #eq2 = l2.sage_equation() eq1 = l1.equation eq2 = l2.equation soluce = CalculSage().solve_more_vars( [eq1,eq2],x,y ) s = soluce[0] return Point( s[0],s[1] ) | def LineInterLine(l1,l2): var('x,y') #eq1 = l1.sage_equation() #eq2 = l2.sage_equation() eq1 = l1.equation eq2 = l2.equation soluce = CalculSage().solve_more_vars( [eq1,eq2],x,y ) s = soluce[0] return Point( s[0],s[1] ) | 446,330 |
def SinglePicture(nom): """ Return the tuple of pspicture and figure that one needs in 90% of the cases """ return pspicture(nom), GenericFigure(nom) | def SinglePicture(name): """ Return the tuple of pspicture and figure that one needs in 90% of the cases """ return pspicture(nom), GenericFigure(nom) | 446,331 |
def SinglePicture(nom): """ Return the tuple of pspicture and figure that one needs in 90% of the cases """ return pspicture(nom), GenericFigure(nom) | def SinglePicture(nom): """ Return the tuple of pspicture and figure that one needs in 90% of the cases """ fig = GenericFigure(name) pspict=fig.new_pspicture(name) return pspict,fig | 446,332 |
def GenericFigure(nom): """ This function returns a figure with some default values. It creates coherent label, file name and prints the lines to be appended in the LaTeX file to include the figure. """ label = "LabelFig"+nom caption = "\CaptionFig"+nom nFich = "Fig_"+nom+".pstricks" print "The result is on figure \\re... | defGenericFigure(nom):"""Thisfunctionreturnsafigurewithsomedefaultvalues.Itcreatescoherentlabel,filenameandprintsthelinestobeappendedintheLaTeXfiletoincludethefigure."""label="LabelFig"+nomcaption="\CaptionFig"+nomnFich="Fig_"+nom+".pstricks"print"Theresultisonfigure\\ref{"+label+"}"print"\\newcommand{"+caption+"}{<+Ty... | 446,333 |
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) | def __init__(self,caption,name,fich): self.caption = caption self.label = label self.xunit = 1 self.yunit = 1 self.code = [] self.SSfigures = [] self.fichier = Fichier (fich) | 446,334 |
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) | def __init__(self,caption,label,fich): self.caption = caption self.name = name self.xunit = 1 self.yunit = 1 self.code = [] self.SSfigures = [] self.fichier = Fichier (fich) | 446,335 |
def new_subfigure(self,caption,name): """ Create a subfigure in the figure and return it. | def new_subfigure(self,caption,name): """ Create a subfigure in the figure and return it. | 446,336 |
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 | 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 | 446,337 |
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 | 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 | 446,338 |
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{%... | 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.subfigure_code(),"SUBFIGURES") self.add_latex_li... | 446,339 |
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{%... | 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{%... | 446,340 |
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 __init__(self,caption,name=None): self.caption = caption self.name = name # The label will be given in figure.append_subfigure self.record_pspicture=[] self.mother=None | 446,341 |
def add_latex_line(self,ligne): self.code.append(ligne) | def add_latex_line(self,ligne): self.code.append(ligne) | 446,342 |
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()) | 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()) | 446,343 |
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... | 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... | 446,344 |
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)/... | 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)/... | 446,345 |
def pstricks(self): var('t') return "%s | %s "%(SubstitutionMathPsTricks(repr(self.f1.sage(x=t))), SubstitutionMathPsTricks(repr(self.f2.sage(x=t))) ) | def pstricks(self): var('t') return "%s | %s "%(SubstitutionMathPsTricks(repr(self.f1.sage(x=t))), SubstitutionMathPsTricks(repr(self.f2.sage(x=t))) ) | 446,346 |
def version(self): """ Name ---- `version` () | def version(self): """ Name ---- `version` () | 446,347 |
def dispatch(self): args = self.parser.parse_args() command = args.command_cls(self.parser, args) command.invoke(args) | def dispatch(self, args=None): args = self.parser.parse_args(args) command = args.command_cls(self.parser, args) command.invoke(args) | 446,348 |
def test_get_json_attr_types(self): self.assertEqual(DashboardBundle.get_json_attr_types(), {'test_runs': [TestRun]}) | def test_get_json_attr_types(self): self.assertEqual(DashboardBundle.get_json_attr_types(), {'test_runs': [TestRun]}) | 446,349 |
def test_construction_1(self): hw_context = HardwareContext() self.assertEqual(context.devices, []) | def test_construction_1(self): hw_context = HardwareContext() self.assertEqual(context.devices, []) | 446,350 |
def test_construction_2(self): devices = object() hw_context = HardwareContext(devices) self.assertTrue(context.devices is devices) | def test_construction_2(self): devices = object() hw_context = HardwareContext(devices) self.assertTrue(context.devices is devices) | 446,351 |
def test_construction_3(self): devices = object() hw_context = HardwareContext(devices=devices) self.assertTrue(context.devices is devices) | def test_construction_3(self): devices = object() hw_context = HardwareContext(devices=devices) self.assertTrue(context.devices is devices) | 446,352 |
def test_get_json_attr_types(self): self.assertEqual(HardwareContext.get_json_attr_types(), {'devices': [HardwareDevice]}) | def test_get_json_attr_types(self): self.assertEqual(HardwareContext.get_json_attr_types(), {'devices': [HardwareDevice]}) | 446,353 |
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... | 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... | 446,354 |
def test_get_json_attr_types(self): self.assertEqual(SoftwareContext.get_json_attr_types(), {'packages': [SoftwarePackage], 'sw_image': SoftwareImage}) | def test_get_json_attr_types(self): self.assertEqual(SoftwareContext.get_json_attr_types(), {'packages': [SoftwarePackage], 'sw_image': SoftwareImage}) | 446,355 |
def test_get_json_attr_types(self): self.assertRaises(NotImplementedError, SoftwareImage.get_json_attr_types) | def test_get_json_attr_types(self): self.assertRaises(NotImplementedError, SoftwareImage.get_json_attr_types) | 446,356 |
def test_get_json_attr_types(self): self.assertRaises(NotImplementedError, SoftwarePackage.get_json_attr_types) | def test_get_json_attr_types(self): self.assertRaises(NotImplementedError, SoftwarePackage.get_json_attr_types) | 446,357 |
def test_get_help_defaults_to_None(self): class mysterious(Command): pass self.assertEqual(mysterious.get_help(), None) | def test_get_help_defaults_to_None(self): class mysterious(Command): pass self.assertEqual(mysterious.get_help(), None) | 446,358 |
def __unicode__(self): return _(u"{name}: {value}").format( name = self.name, value = self.value) | def __unicode__(self): return _(u"{name}: {value}").format( name = self.name, value = self.value) | 446,359 |
def register_arguments(cls, parser): group = parser.add_argument_group("Dashboard Server options") group.add_argument("--dashboard-url", required=True, metavar="URL", help="URL of your validation dashboard") group.add_argument("--verbose-xml-rpc", action="store_true", default=False, help="Show XML-RPC data") | def register_arguments(cls, parser): group = parser.add_argument_group("Dashboard Server options") group.add_argument("--dashboard-url", required=True, metavar="URL", help="URL of your validation dashboard") group.add_argument("--verbose-xml-rpc", action="store_true", default=False, help="Show XML-RPC data") | 446,360 |
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,... | 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,... | 446,361 |
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... | 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... | 446,362 |
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... | 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] na... | 446,363 |
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... | def created_bundle_streams(spec): """ Helper context manager that creates bundle streams according to specification `spec`: list of dictionaries List of values to make_bundle_stream() yields: list of created bundle streams """ bundle_streams = [] for stream_args in spec: initargs = { 'user': None, 'group': None, 'slu... | 446,364 |
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... | 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... | 446,365 |
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... | 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... | 446,366 |
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... | 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... | 446,367 |
def test_version(self): from dashboard_app import __version__ self.assertEqual(self.xml_rpc_call('version'), ".".join(map(str, __version__))) | def test_version(self): from dashboard_app import __version__ self.assertEqual(self.xml_rpc_call('version'), ".".join(map(str, __version__))) | 446,368 |
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") | 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") | 446,369 |
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() | def clean(self): cleaned_data = self.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() | 446,370 |
def __init__(self, devices=None): self.devices = devices or [] | def __init__(self, devices=None): self.devices = devices or [] | 446,371 |
def _set_log_filename(self, log_filename): self._log_filename = log_filename | def _set_log_filename(self, log_filename): self._log_filename = log_filename | 446,372 |
def _set_log_lineno(self, log_lineno): self._log_lineno = log_lineno | def _set_log_lineno(self, log_lineno): self._log_lineno = log_lineno | 446,373 |
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) | 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) | 446,374 |
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... | 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... | 446,375 |
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... | 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... | 446,376 |
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... | 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... | 446,377 |
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... | 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... | 446,378 |
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... | 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... | 446,379 |
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... | 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... | 446,380 |
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... | 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... | 446,381 |
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... | 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... | 446,382 |
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... | 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... | 446,383 |
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... | 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... | 446,384 |
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... | 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... | 446,385 |
def mock_imports(self, reload_list=None): """ Make prohibit_importing() work by hiding and importing again all the modules that depended on an imported prohibited module. | def mock_imports(self, reload_list=None): """ Make prohibit_importing() work by hiding and importing again all the modules that depended on an imported prohibited module. | 446,386 |
def __init__(self, format=None, test_runs=None): self.format = format or self.FORMAT self.test_runs = test_runs or [] | def __init__(self, format=None, test_runs=None): self.format = format or self.FORMAT self.test_runs = test_runs or [] | 446,387 |
def test_run_detail(request, analyzer_assigned_uuid): test_run = get_object_or_404(TestRun, analyzer_assigned_uuid=analyzer_assigned_uuid) if test_run.bundle.bundle_stream.can_access(request.user): from django.core.paginator import Paginator, InvalidPage, EmptyPage paginator = Paginator(test_run.test_results.all(), 25)... | def test_run_detail(request, analyzer_assigned_uuid): test_run = get_object_or_404(TestRun, analyzer_assigned_uuid=analyzer_assigned_uuid) if test_run.bundle.bundle_stream.can_access(request.user): from django.core.paginator import Paginator, InvalidPage, EmptyPage paginator = Paginator(test_run.test_results.all(), 25)... | 446,388 |
def mock_imports(self, reload_list=None): """ Make prohibit_importing() work by hiding and importing again all the modules that depended on an imported prohibited module. | def mock_imports(self, reload_list=None): """ Make prohibit_importing() work by hiding and importing again all the modules that depended on an imported prohibited module. | 446,389 |
def test_construction_1(self): name = object() sw_image = SoftwareImage(name) self.assertTrue(sw_image.name is name) | def test_construction_1(self): name = object() sw_image = SoftwareImage(name) self.assertTrue(sw_image.name is name) | 446,390 |
def test_template_used(self): response = self.client.get("/streams" + self.bundle_stream.pathname) if self.bundle_stream.can_access(self.user): self.assertTemplateUsed(response, "dashboard_app/bundle_stream_detail.html") else: self.assertTemplateUsed(response, "403.html") | def test_template_used(self): response = self.client.get("/streams" + self.bundle_stream.pathname) if self.bundle_stream.can_access(self.user): self.assertTemplateUsed(response, "dashboard_app/bundle_stream_detail.html") else: self.assertTemplateUsed(response, "403.html") | 446,391 |
def _set_test_id(self, test_id): if test_id is not None and not self._TEST_ID_PATTERN.match(test_id): raise ValueError("Test id must be None or a string with reverse domain name") self._test_id = test_id | def _set_test_id(self, test_id): if test_id is not None and not self._TEST_ID_PATTERN.match(test_id): raise ValueError("Test id must be None or a string with reverse " "domain name") self._test_id = test_id | 446,392 |
def __repr__(self): """ Produce more-less human readable encoding of all fields. | def __repr__(self): """ Produce more-less human readable encoding of all fields. | 446,393 |
def __repr__(self): """ Produce more-less human readable encoding of all fields. | def __repr__(self): """ Produce more-less human readable encoding of all fields. | 446,394 |
def _set_timestamp(self, timestamp): if timestamp is not None and not isinstance(timestamp, datetime.datetime): raise TypeError("Timestamp must be None or datetime.datetime() instance") self._timestamp = timestamp | def _set_timestamp(self, timestamp): if timestamp is not None and not isinstance(timestamp, datetime.datetime): raise TypeError("Timestamp must be None or datetime.datetime() " "instance") self._timestamp = timestamp | 446,395 |
def _set_duration(self, duration): if duration is not None and not isinstance(duration, datetime.timedelta): raise TypeError("duration must be None or datetime.timedelta() instance") if duration is not None and duration.days < 0: raise ValueError("duration cannot be negative") self._duration = duration | def _set_duration(self, duration): if duration is not None and not isinstance(duration, datetime.timedelta): raise TypeError("duration must be None or datetime.timedelta() " "instance") if duration is not None and duration.days < 0: raise ValueError("duration cannot be negative") self._duration = duration | 446,396 |
def test_TestResult__attributes(self): self.assertEqual( self._attrs2set(self.s_test_result.attributes.all()), frozenset([ ("attr1", "value1"), ("attr2", "value2")])) | def test_TestResult__attributes(self): self.assertEqual( self._attrs2set(self.s_test_result.attributes.all()), frozenset([ ("attr1", "value1"), ("attr2", "value2")])) | 446,397 |
def test_TestResult__attributes(self): self.assertEqual( self._attrs2set(self.s_test_result.attributes.all()), frozenset([ ("attr1", "value1"), ("attr2", "value2")])) | def test_TestResult__attributes(self): self.assertEqual( self._attrs2set(self.s_test_result.attributes.all()), frozenset([ ("attr1", "value1"), ("attr2", "value2")])) | 446,398 |
def test_json_to_memory_model_failure(self): deserializer = BundleDeserializer() try: deserializer.json_to_memory_model(self.json_text) except DocumentError as ex: self.assertEqual(self.cause, type(ex.cause)) else: self.fail("Should have raised an exception") | def test_json_to_memory_model_failure(self): deserializer = BundleDeserializer() try: deserializer.json_to_memory_model(self.json_text) except DocumentError as ex: self.assertIsInstance(ex.cause, self.cause) else: self.fail("Should have raised an exception") | 446,399 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.