query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Remove a pen from this window.
def _removePen(self,pen): if pen in self._pencils: self._pencils.remove(pen)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __del__(self):\n self._screen._removePen(self)\n del self._turtle", "def remove(self) -> None:\n self.map.remove_brush(self)", "def removePick(self):\n self.pnt = None\n vtkRenWin.delMarker(self.renWin)", "def remove_brush(self, brush: 'Solid') -> None:\n try:\n ...
[ "0.6923281", "0.6495933", "0.62122864", "0.616254", "0.60080194", "0.590251", "0.56725013", "0.56136733", "0.5546344", "0.55072165", "0.5487803", "0.54865557", "0.5449742", "0.5432165", "0.5357028", "0.53393936", "0.53330404", "0.52942204", "0.52776873", "0.5274253", "0.52715...
0.74714136
0
Erase the contents of this Window All Turtles and Pens are eliminated from the Window. Any attempt to use a previously created Turtle or Pen will fail.
def clear(self): self._frame.clear() self._turtles = [] self._gpens = []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear(self):\n self._turtle.clear()", "def clear(self):\n self._turtle.clear()", "def __del__(self):\n self._screen._removePen(self)\n del self._turtle", "def __del__(self):\n self.clear()\n self._screen._removeTurtle(self)\n del self._turtle", "def _des...
[ "0.7524162", "0.7524162", "0.7407025", "0.73629093", "0.72758824", "0.7150235", "0.68685234", "0.67587095", "0.6713669", "0.6578326", "0.6544966", "0.6535955", "0.65174234", "0.6500613", "0.6446637", "0.6438641", "0.6435536", "0.64201194", "0.6414517", "0.63773596", "0.636794...
0.7078368
6
Closes the graphics Window, deleting all assets
def bye(self): self._frame._destroy() self._turtles = [] self._gpens = [] del self._frame
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def finalizeExit(self) -> None:\n base.graphicsEngine.removeAllWindows()\n if self.win is not None:\n print(\"Exiting KarelCraft app, bye!\")\n self.closeWindow(self.win)\n self.win = None\n self.destroy()\n sys.exit()", "def close(self):\n self...
[ "0.75555855", "0.7477226", "0.73451036", "0.7295747", "0.7272597", "0.7269997", "0.7173892", "0.7137351", "0.7103768", "0.7031342", "0.6960648", "0.6939482", "0.69168514", "0.6913677", "0.69004905", "0.689314", "0.6878659", "0.68318313", "0.6830364", "0.68288535", "0.68266654...
0.67374146
27
Plays an OS specific alert sound
def beep(self): self._frame._root.bell()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def playSound():\n\tif os.name == \"posix\":\n\t\tduration = 0.5 # seconds\n\t\tfreq = 80 # Hz\n\t\t#os.system('play -nq -t alsa synth {} sine {}'.format(duration, freq))\n\telif os.name == \"nt\":\n\t\tduration = 500 # milliseconds\n\t\tfreq = 80 # Hz\n\t\t#winsound.Beep(freq, duration)", "def play_startup_...
[ "0.7575998", "0.71356803", "0.6993021", "0.69806135", "0.6903117", "0.6809958", "0.6731711", "0.67272246", "0.67185855", "0.66775733", "0.6588559", "0.65214854", "0.6496222", "0.6477924", "0.6464842", "0.641596", "0.6394175", "0.6379717", "0.63734734", "0.6370575", "0.6352954...
0.55198234
88
Shrinks the window down to an icon, effectively hiding it
def iconify(self): self._frame._root.iconify()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def onMinimize(self, event):\n # if self.IsIconized():\n # self.Hide()\n self.Hide()", "def hide(self):\n self.root.iconify() # self.root.withdraw()", "def show_window(icon, item):\n icon.stop()\n app.after(0, app.deiconify())", "def __minimize_on_click(self):\n ...
[ "0.7197378", "0.6926259", "0.6514841", "0.6401315", "0.63795197", "0.6355315", "0.62768066", "0.6245441", "0.622365", "0.6119201", "0.6098737", "0.60097057", "0.59481025", "0.5944409", "0.58673495", "0.5827085", "0.5737087", "0.5717614", "0.5717614", "0.569668", "0.5652999", ...
0.5634438
27
Expands the window from an icon so that it is visible
def deiconify(self): self._frame._root.deiconify()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def onMinimize(self, event):\n # if self.IsIconized():\n # self.Hide()\n self.Hide()", "def show_window(icon, item):\n icon.stop()\n app.after(0, app.deiconify())", "def iconify(self):\n if self.active:\n self.master.withdraw()\n self.active = False",...
[ "0.71563345", "0.6827041", "0.67579377", "0.6734852", "0.6362016", "0.60919636", "0.6062259", "0.6049304", "0.6033592", "0.6020919", "0.59644955", "0.5946634", "0.59451485", "0.5897082", "0.58830255", "0.58652514", "0.58457947", "0.58319026", "0.57918", "0.5750798", "0.574958...
0.0
-1
Sets the maximum size for this window Any attempt to resize a dimension beyond the maximum size will fail.
def setMaxSize(self,width,height): assert (type(width) == int), "width %s is not an int" % `width` assert (width > 0), "width %s is negative" % `width` assert (type(height) == int), "height %s is not an int" % `height` assert (height > 0), "height %s is negative" % `height` self._frame._root.maxsize(width,height)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_max_size(self, size):\n # The hard Qt limit is 16777215 (which is 2**24 - 1) and will\n # print warnings to the shell if we attemp to set a max size\n # over that amount. This can be attempted when a QtMainWindow\n # has a central widget size equal to max size, and it also has\n...
[ "0.8343203", "0.808209", "0.7743762", "0.7440697", "0.7391813", "0.71794146", "0.7152232", "0.70025915", "0.6995238", "0.69787806", "0.6910393", "0.6805439", "0.67991096", "0.6738618", "0.67204857", "0.66982836", "0.667508", "0.66253215", "0.6608448", "0.6564544", "0.65028757...
0.81691533
1
Sets the minimum size for this window Any attempt to resize a dimension below the minimum size will fail.
def setMinSize(self,width,height): assert (type(width) == int), "width %s is not an int" % `width` assert (width > 0), "width %s is negative" % `width` assert (type(height) == int), "height %s is not an int" % `height` assert (height > 0), "height %s is negative" % `height` self._frame._root.minsize(width,height)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SetMinimumPaneSize(self, minSize):\n self._minimumPaneSize = minSize", "def set_min_size(self, size):\n self.widget.setMinimumSize(*size)", "def set_min_size(self, width: int, height: int):\n self.tk_ref.minsize(width=width, height=height)", "def SetMinSize(self, s):\r\n\r\n s...
[ "0.82620406", "0.8125616", "0.7964996", "0.7790341", "0.7647176", "0.7619907", "0.74496925", "0.7417188", "0.73141354", "0.72229654", "0.70047134", "0.6895434", "0.68838006", "0.6880474", "0.67831236", "0.6776431", "0.67747736", "0.6735547", "0.66872287", "0.66674685", "0.659...
0.81438893
1
Unsupported method for compatibility
def flush(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _platform_compatible():\r\n raise NotImplementedError", "def __call__(self):\n raise NotImplementedError()", "def __call__(self):\n raise NotImplementedError", "def __upgrade(self):", "def support(self):", "def __call__(self):\r\n raise NotImplementedError('override me')", "...
[ "0.7279129", "0.68142307", "0.6761746", "0.6669215", "0.661067", "0.6566959", "0.6410402", "0.62955695", "0.6209175", "0.6209175", "0.6209175", "0.6150251", "0.6138908", "0.6107612", "0.6102898", "0.6102898", "0.60230196", "0.60135454", "0.59595454", "0.59073716", "0.59036094...
0.0
-1
Unsupported method for compatibility
def stroke(self, path, clr): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _platform_compatible():\r\n raise NotImplementedError", "def __call__(self):\n raise NotImplementedError()", "def __call__(self):\n raise NotImplementedError", "def __upgrade(self):", "def support(self):", "def __call__(self):\r\n raise NotImplementedError('override me')", "...
[ "0.7279129", "0.68142307", "0.6761746", "0.6669215", "0.661067", "0.6566959", "0.6410402", "0.62955695", "0.6209175", "0.6209175", "0.6209175", "0.6150251", "0.6138908", "0.6107612", "0.6102898", "0.6102898", "0.60230196", "0.60135454", "0.59595454", "0.59073716", "0.59036094...
0.0
-1
Unsupported method for compatibility
def fill(self, path, clr): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _platform_compatible():\r\n raise NotImplementedError", "def __call__(self):\n raise NotImplementedError()", "def __call__(self):\n raise NotImplementedError", "def __upgrade(self):", "def support(self):", "def __call__(self):\r\n raise NotImplementedError('override me')", "...
[ "0.7279129", "0.68142307", "0.6761746", "0.6669215", "0.661067", "0.6566959", "0.6410402", "0.62955695", "0.6209175", "0.6209175", "0.6209175", "0.6150251", "0.6138908", "0.6107612", "0.6102898", "0.6102898", "0.60230196", "0.60135454", "0.59595454", "0.59073716", "0.59036094...
0.0
-1
Unsupported method for compatibility
def write(self, fname): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _platform_compatible():\r\n raise NotImplementedError", "def __call__(self):\n raise NotImplementedError()", "def __call__(self):\n raise NotImplementedError", "def __upgrade(self):", "def support(self):", "def __call__(self):\r\n raise NotImplementedError('override me')", "...
[ "0.7279129", "0.68142307", "0.6761746", "0.6669215", "0.661067", "0.6566959", "0.6410402", "0.62955695", "0.6209175", "0.6209175", "0.6209175", "0.6150251", "0.6138908", "0.6107612", "0.6102898", "0.6102898", "0.60230196", "0.60135454", "0.59595454", "0.59073716", "0.59036094...
0.0
-1
The heading of this turtle in degrees. Heading is measured counter clockwise from due east.
def heading(self): return float(self._turtle.heading())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def heading(self):\n x, y = self._orient\n result = round(math.atan2(y, x)*180.0/math.pi, 10) % 360.0\n result /= self._degreesPerAU\n return (self._angleOffset + self._angleOrient*result) % self._fullcircle", "def raw_heading(self):\n\n self._heading = math.atan2(self._mag[X],...
[ "0.85323304", "0.7825337", "0.77631426", "0.7465228", "0.7281472", "0.7165995", "0.70578945", "0.6940017", "0.6924136", "0.6804612", "0.6803771", "0.677972", "0.6762503", "0.6762503", "0.67530805", "0.6701139", "0.66272557", "0.65986854", "0.6573453", "0.6512578", "0.65064764...
0.87159824
0
The animation speed of this turtle. The speed is an integer from 0 to 10. Speed = 0 means that no animation takes place. The methods forward/back makes turtle jump and likewise left/right make the turtle turn instantly. Speeds from 1 to 10 enforce increasingly faster animation of line drawing and turtle turning. 1 is the slowest speed while 10 is the fastest (noninstantaneous) speed.
def speed(self): return self._turtle.speed()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def speed(self, speed=None):\n speeds = {'fastest':0, 'fast':10, 'normal':6, 'slow':3, 'slowest':1 }\n if speed is None:\n return self._speed\n if speed in speeds:\n speed = speeds[speed]\n elif 0.5 < speed < 10.5:\n speed = int(round(speed))\n el...
[ "0.7406827", "0.6900128", "0.68084306", "0.674762", "0.6742498", "0.65431887", "0.6535551", "0.651261", "0.64920443", "0.64284843", "0.64099866", "0.64064616", "0.6403609", "0.63961345", "0.63856757", "0.6369697", "0.63394564", "0.6332096", "0.6319833", "0.6256491", "0.625490...
0.7135669
2
The color of this turtle. All subsequent draw commands (forward/back) draw using this color. If the color changes, it only affects future draw commands, not past ones.
def color(self): return self._color
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def color(self):\n assert False, 'Pen does not have a color; use pencolor or fillcolor'", "def get_color(self):\r\n return self.__color", "def color(self):\n return self.__color", "def get_color(self):\n return self.color", "def get_color(self):\r\n if self.color:\r\n ...
[ "0.69709", "0.6779695", "0.6763572", "0.672866", "0.6717508", "0.67131394", "0.67123073", "0.6694104", "0.6650042", "0.6650042", "0.6635534", "0.66264987", "0.66009176", "0.6586705", "0.65372753", "0.65127057", "0.6490231", "0.6490231", "0.6490231", "0.6489274", "0.6463869", ...
0.6654484
9
Indicates whether the turtle's icon is visible. Drawing commands will still work while the turtle icon is hidden. There will just be no indication of the turtle's current location on the screen.
def visible(self): return self._turtle.isvisible()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_visible(self):", "def is_visible(self):\n return self._visible", "def isVisible( self ):\n layer = self.layer()\n if ( layer and not layer.isVisible() ):\n return False\n# \n# if ( self.isIsolateHidden() ):\n# return False\n# \n retu...
[ "0.71561986", "0.6992037", "0.69445086", "0.6929709", "0.689857", "0.6858378", "0.67312574", "0.6723745", "0.6712027", "0.66735023", "0.6668584", "0.66361713", "0.66052437", "0.6484988", "0.648333", "0.648333", "0.64757276", "0.6454804", "0.631289", "0.6297589", "0.62900037",...
0.7854587
1
Indicates whether the turtle is in draw mode. All drawing calls are active if an only if this mode is True
def drawmode(self): return self._turtle.isdown()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isdrawn(self):\n return hasattr(self, 'drawn')", "def setDrawingMode(self):\n pass", "def get_drawing_mode(self) -> int:\n return self._drawing_mode", "def draw(self, canvas) -> bool:\n return False", "def _set_draw_mode(draw_mode):\n#########################################...
[ "0.7248577", "0.6596341", "0.6579881", "0.6529058", "0.65262514", "0.64363253", "0.6411703", "0.6403673", "0.6296374", "0.62232405", "0.6160772", "0.60842884", "0.5986026", "0.5977863", "0.59161794", "0.5741559", "0.5738247", "0.56827796", "0.5679077", "0.56439203", "0.563513...
0.8096658
0
The xcoordinate of this turtle. To change the x coordinate, use one of the drawing methods. This attribute may not be (directly) altered
def x(self): return self._turtle.xcor()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setX(self, x):\n self.position.setX(x)", "def Getxcoord(self):\n return self.x_coord", "def set_x(self, x):\n self.scene.set_x_loc(x)\n self.redraw()", "def get_x(self):\n return self.posX", "def x(self):\n return _libsbml.Point_x(self)", "def set_x(self, x):...
[ "0.76434016", "0.7627431", "0.76259303", "0.75785303", "0.75745726", "0.75719124", "0.7553244", "0.7533228", "0.7502078", "0.75011337", "0.74811924", "0.74758", "0.7464989", "0.7426505", "0.7388529", "0.7332591", "0.73232895", "0.72585595", "0.71786386", "0.71688503", "0.7164...
0.7628367
2
The ycoordinate of this turtle. To change the x coordinate, use one of the drawing methods. This attribute may not be (directly) altered
def y(self): return self._turtle.ycor()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def y(self):\n return _libsbml.Point_y(self)", "def getYCoordinate(self) -> float:\n return self.y_coord", "def setY(self, y):\r\n\t\tself._y=y", "def setY(self, y):\n self.y = y\n pass", "def y_coord(self):\n\n return self.y0 + np.arange(self.ny) * self.dy", "def getY(...
[ "0.77648014", "0.7557941", "0.75414705", "0.7519196", "0.7517687", "0.75156283", "0.74248564", "0.7424172", "0.7424172", "0.7421405", "0.74198735", "0.74136454", "0.73714113", "0.7355722", "0.73076034", "0.7266436", "0.7265773", "0.72609174", "0.7236153", "0.7231107", "0.7228...
0.7376552
13
Deletes this turtle object.
def __del__(self): self.clear() self._screen._removeTurtle(self) del self._turtle
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __del__(self):\n self._screen._removePen(self)\n del self._turtle", "def delete(self):\n self.graph._del(handle=self.handle)", "def remove(self):\n self.node.destroy()", "def delete(self):\n\t\tself.canvas.delete('node_'+self.identifier)\n\t\tself.canvas.tag_unbind('node_'+sel...
[ "0.72901684", "0.69489294", "0.6906722", "0.68213683", "0.68130356", "0.68130356", "0.68130356", "0.68130356", "0.68130356", "0.68130356", "0.68130356", "0.68130356", "0.68130356", "0.68130356", "0.68130356", "0.68130356", "0.68130356", "0.68130356", "0.6793991", "0.6787353", ...
0.79840356
0
Moves the turtle forward by the given amount.
def forward(self,distance): assert (type(distance) in [int, float]), "parameter distance:%s is not a valid number" % `distance` self._turtle.forward(distance)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self, amount):\n newX = self._x + round(amount * math.sin(math.radians(self._rotation)), 2)\n newY = self._y - round(amount * math.cos(math.radians(self._rotation)), 2)\n self.goto(newX, newY)", "def advance(self, amount=1):\n self._current += amount\n self.redraw()...
[ "0.805098", "0.7168281", "0.71475154", "0.7083541", "0.6969918", "0.6827667", "0.682601", "0.6692048", "0.66343707", "0.66327345", "0.6570666", "0.64380103", "0.6395247", "0.6392661", "0.6286539", "0.6284747", "0.6278547", "0.6266692", "0.6242889", "0.6207868", "0.6171793", ...
0.7646355
1
Moves the turtle backward by the given amount.
def backward(self,distance): assert (type(distance) in [int, float]), "parameter distance:%s is not a valid number" % `distance` self._turtle.backward(distance)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backward(self, amount):\n newX = self._x - round(amount * math.sin(math.radians(self._rotation)), 2)\n newY = self._y + round(amount * math.cos(math.radians(self._rotation)), 2)\n self.goto(newX, newY)", "def move_backward(self, distance):\r\n return self.move('back', distance)", ...
[ "0.82581335", "0.73676413", "0.6859591", "0.6773016", "0.67576206", "0.6722952", "0.67022717", "0.6687509", "0.66345984", "0.6610055", "0.65762097", "0.6467502", "0.6444055", "0.6443134", "0.6412966", "0.6340994", "0.63096267", "0.6303683", "0.62736183", "0.62425214", "0.6214...
0.78231084
1
Turns the turtle to the right by the given amount.
def right(self,degrees): assert (type(degrees) in [int, float]), "parameter degrees:%s is not a valid number" % `distance` self._turtle.right(degrees)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def right(self, amount):\n self.setheading(self._rotation + amount)", "def right(self, angle):\r\n self.dir += math.radians(angle)", "def go_right(self):\n self.change_x = 6\n self.direction = \"R\"", "def turn_right(self):\n temp = self.direction[0]\n self.direction...
[ "0.75367314", "0.690994", "0.6860483", "0.6700921", "0.6642686", "0.6610772", "0.6585941", "0.65618926", "0.63780653", "0.63780653", "0.63710123", "0.6350068", "0.63473946", "0.6344162", "0.62829196", "0.6280385", "0.6238296", "0.6236012", "0.62327635", "0.6231904", "0.622983...
0.66845566
4
Turns the turtle to the left by the given amount.
def left(self,degrees): assert (type(degrees) in [int, float]), "parameter degrees:%s is not a valid number" % `distance` self._turtle.left(degrees)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def left(self, amount):\n self.setheading(self._rotation - amount)", "def move_left(self):\n\n if self.xcor() < -230:\n self.setx(-255)\n else:\n new_x = self.xcor() - 40\n self.setx(new_x)", "def go_left(self):\n self.change_x = -6\n self.dir...
[ "0.780476", "0.70262265", "0.69437015", "0.6939617", "0.6917791", "0.6892099", "0.68578196", "0.6803361", "0.6797746", "0.677668", "0.677668", "0.6751713", "0.67103636", "0.6688399", "0.6688173", "0.66532737", "0.6642124", "0.6549695", "0.652959", "0.6492968", "0.64817894", ...
0.69226944
4
Moves the turtle to given position without drawing.
def move(self,x,y): assert (type(x) in [int, float]), "parameter x:%s is not a valid number" % `x` assert (type(y) in [int, float]), "parameter y:%s is not a valid number" % `y` d = self._turtle.isdown() if d: self._turtle.penup() self._turtle.setposition(x,y) if d: self._turtle.pendown()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def goto(x, y):\n turtleTmp.setposition(x, y)", "def repositionTurtle(t, x, y):\n t.up()\n t.goto(x, y)\n t.down()", "def move_turtle(self):\n self.forward(self.move_speed)", "def move_turtle(self, x, y):\n tortuga = self.turtle\n if self.capture_mode:\n tortuga.se...
[ "0.7493656", "0.72473425", "0.7133724", "0.6950032", "0.6805629", "0.6631148", "0.6597516", "0.6596458", "0.6490909", "0.63468707", "0.62488174", "0.6248645", "0.6203357", "0.6185314", "0.6184686", "0.61762464", "0.61565167", "0.60920906", "0.60809743", "0.6067138", "0.602562...
0.6717303
5
Deletes the turtle's drawings from the window. This method does not move the turtle or alter its attributes.
def clear(self): self._turtle.clear()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __del__(self):\n self._screen._removePen(self)\n del self._turtle", "def __del__(self):\n self.clear()\n self._screen._removeTurtle(self)\n del self._turtle", "def _destroy(self):\n root = self._root\n turtle.Turtle._pen = None\n turtle.Turtle._screen...
[ "0.7095369", "0.7073882", "0.67882663", "0.6711661", "0.65692496", "0.6532985", "0.63668907", "0.6328843", "0.62957186", "0.6284367", "0.628283", "0.622739", "0.60716885", "0.6029884", "0.5946259", "0.5937733", "0.58444446", "0.58253604", "0.5806614", "0.57928294", "0.5782546...
0.70327747
2
Deletes the turtle's drawings from the window. This method recenters the turtle and resets all attributes to their default values.
def reset(self): self._turtle.clear() self._turtle.setposition((0,0)) self._turtle.shape('turtle') self.color = 'red' self.heading = 180 self.speed = 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear(self):\n self._turtle.clear()", "def clear(self):\n self._turtle.clear()", "def __del__(self):\n self._screen._removePen(self)\n del self._turtle", "def reset(self):\n TNavigator.reset(self)\n TPen._reset(self)\n self._clear()\n self._drawturt...
[ "0.72609514", "0.72609514", "0.7131574", "0.7130945", "0.7106821", "0.70200294", "0.6937271", "0.69109285", "0.6570212", "0.6568165", "0.6520926", "0.6450158", "0.6344266", "0.6308535", "0.62942463", "0.622969", "0.6226668", "0.617589", "0.6108122", "0.60560745", "0.6039392",...
0.637487
12
Unsupported method for compatibility
def flush(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _platform_compatible():\r\n raise NotImplementedError", "def __call__(self):\n raise NotImplementedError()", "def __call__(self):\n raise NotImplementedError", "def __upgrade(self):", "def support(self):", "def __call__(self):\r\n raise NotImplementedError('override me')", "...
[ "0.7279129", "0.68142307", "0.6761746", "0.6669215", "0.661067", "0.6566959", "0.6410402", "0.62955695", "0.6209175", "0.6209175", "0.6209175", "0.6150251", "0.6138908", "0.6107612", "0.6102898", "0.6102898", "0.60230196", "0.60135454", "0.59595454", "0.59073716", "0.59036094...
0.0
-1
The animation speed of this pen. The speed is an integer from 0 to 10. Speed = 0 means that no animation takes place. The drawLine and drawCircle methods happen instantly with no animation. Speeds from 1 to 10 enforce increasingly faster animation of line drawing. 1 is the slowest speed while 10 is the fastest (noninstantaneous) speed.
def speed(self): return self._turtle.speed()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def speed(self, speed=None):\n speeds = {'fastest':0, 'fast':10, 'normal':6, 'slow':3, 'slowest':1 }\n if speed is None:\n return self._speed\n if speed in speeds:\n speed = speeds[speed]\n elif 0.5 < speed < 10.5:\n speed = int(round(speed))\n el...
[ "0.7604746", "0.7200397", "0.6807912", "0.6662664", "0.65087324", "0.64902276", "0.6479542", "0.64367783", "0.64187455", "0.63251877", "0.62875676", "0.62830615", "0.6264852", "0.62495047", "0.623983", "0.623983", "0.62264585", "0.61983454", "0.6166356", "0.6166356", "0.61339...
0.67962736
3
The fill status of this pen. If the fill status is True, then the pen will fill the insides of any polygon or circle subsequently traced by its drawLine or drawCircle method. If the attribute changes, it only affects future draw commands, not past ones. Switching this attribute between True and False allows the pen to draw both solid and hollow shapes.
def fill(self): return self._turtle.fill()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setFilled(self, fill):\n isFilled = fill\n repaint()", "def GetFillAlpha(self):\n return self._attalpha[\"fill\"]", "def fillcolor(self):\n return self._fillcolor", "def setFill(self, fill):\n self.area_show = fill", "def fill(self):\n return self[\"fill\"]", ...
[ "0.68982977", "0.6480413", "0.64142907", "0.61500674", "0.60670793", "0.60670793", "0.60242504", "0.5965748", "0.593573", "0.59075147", "0.5873632", "0.57370543", "0.57370543", "0.5725248", "0.5699221", "0.553684", "0.55129635", "0.549395", "0.5492293", "0.54508805", "0.54495...
0.6480622
1
Silent, unsupported property requested by a beta tester
def color(self): assert False, 'Pen does not have a color; use pencolor or fillcolor'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_property_no_option():\n\n contents = (\"[Info]\\n\"\n \"vmtype = arm64\")\n\n testutils.deploy_config_raw(contents)\n\n with pytest.raises(prop.PropertyError):\n prop.get_prop('info', 'sdk')\n\n testutils.undeploy()\n\n return 0", "def test_test_property():\n\n ...
[ "0.6675322", "0.6273189", "0.6186023", "0.61577505", "0.6114807", "0.60973996", "0.60565835", "0.6008967", "0.59908164", "0.59744656", "0.5964651", "0.5957363", "0.5925965", "0.59228987", "0.5908135", "0.5854864", "0.5826655", "0.58242005", "0.5764281", "0.57537925", "0.57380...
0.0
-1
The pen color of this pen. The pen color is used for drawing lines and circles. All subsequent draw commands draw using this color. If the color changes, it only affects future draw commands, not past ones. This color is only used for lines and the border of circles. It is not the color used for filling in solid areas (if the ``fill`` attribute is True). See the attribute ``fillcolor`` for solid shapes.
def pencolor(self): return self._pencolor
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def penColor( self ):\n return self._penColor", "def color(self):\n assert False, 'Pen does not have a color; use pencolor or fillcolor'", "def pencolor(self, *args):\n if args:\n color = self._colorstr(args)\n if color == self._pencolor:\n return\n ...
[ "0.81438965", "0.7675859", "0.7551927", "0.6896309", "0.67128396", "0.6509215", "0.64415", "0.64415", "0.64305776", "0.6405034", "0.6389262", "0.6373281", "0.6373281", "0.6361102", "0.6361102", "0.6361102", "0.6358667", "0.63095975", "0.62246627", "0.62037814", "0.6115269", ...
0.7982437
1
The fill color of this turtle. The fill color is used for filling in solid shapes. If the ``fill`` attribute is True, all subsequent draw commands fill their insides using this color. If the color changes, it only affects future draw commands, not past ones. This color is only used for filling in the insides of solid shapes. It is not the color used for the shape border. See the attribute ``pencolor`` for the border color.
def fillcolor(self): return self._fillcolor
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fill_color(self, fill_color=None):\n\n if fill_color is None:\n return self._fill_color\n else:\n self._fill_color = process_color(fill_color)", "def fillcolor(self, *args):\n if args:\n color = self._colorstr(args)\n if color == self._fillcolo...
[ "0.8201772", "0.7598433", "0.7313783", "0.67560655", "0.6748844", "0.6730906", "0.6724899", "0.67112285", "0.6703533", "0.6412003", "0.63272303", "0.6276365", "0.6182439", "0.6151799", "0.6137227", "0.61257184", "0.59977", "0.59752995", "0.59577733", "0.5939774", "0.58236915"...
0.76650685
1
Indicates whether the pen's icon is visible. Drawing commands will still work while the pen icon is hidden. There will just be no indication of the pen's current location on the screen.
def visible(self): return self._turtle.isvisible()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_visible(self):\n return self._visible", "def is_visible(self):\n return self.proto.display_type == DISPLAY_TYPE.Visible.value", "def is_visible(self):\n return self.container['is_visible']", "def is_visible(self):\n return self.rect.x < self.screen_rect.width", "def is_vi...
[ "0.70938164", "0.7088974", "0.7023082", "0.6997821", "0.68921804", "0.6873909", "0.68134916", "0.67763966", "0.66723704", "0.6664352", "0.6607723", "0.660474", "0.660474", "0.6599054", "0.6597098", "0.6593233", "0.6585666", "0.65637505", "0.65612817", "0.65610343", "0.6546338...
0.72434735
0
Represents the pen origin in the draw window. This property is used by the Window to reset the pen. This is a "friend" property and the invariant is not enforced.
def origin(self): return self._origin
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetConnectionPen(self):\r\n\r\n return self._dottedPen", "def penColor( self ):\n return self._penColor", "def pencolor(self):\n return self._pencolor", "def _set_origin(self):\n self += helper.circle(cx=self.__dict__['x'], cy=self.__dict__['y'], r=2, fill=\"black\", strok...
[ "0.6315457", "0.6157232", "0.5957476", "0.5798523", "0.5758914", "0.574672", "0.5725725", "0.57172686", "0.5713631", "0.5709259", "0.5697349", "0.56255484", "0.56203943", "0.5529922", "0.5509871", "0.5480417", "0.5455918", "0.5441902", "0.5405522", "0.5344211", "0.52710193", ...
0.545472
20
The xcoordinate of this pen. To change the x coordinate, use one of the drawing methods. This attribute may not be (directly) altered
def x(self): return self._turtle.xcor()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_x(self, new_x):\r\n self.x = new_x", "def x(self):\n return _libsbml.Point_x(self)", "def get_x(self):\n return self.posX", "def setX(self, *args):\n return _libsbml.Point_setX(self, *args)", "def setX(self, x):\n self.position.setX(x)", "def setX(self, x):\r\n\...
[ "0.76575345", "0.75913805", "0.7514827", "0.7482172", "0.7476596", "0.74066937", "0.73871195", "0.7383479", "0.7373789", "0.7351436", "0.73434395", "0.7271025", "0.72605467", "0.7225597", "0.71805465", "0.71784794", "0.71032804", "0.70959073", "0.69787765", "0.69621176", "0.6...
0.6752364
34
The ycoordinate of this pen. To change the y coordinate, use one of the drawing methods. This attribute may not be (directly) altered
def y(self): return self._turtle.ycor()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def y(self):\n return _libsbml.Point_y(self)", "def set_y(self, new_y):\r\n self.y = new_y", "def setY(self, y):\n self.y = y\n pass", "def setY(self, y):\r\n\t\tself._y=y", "def getY(self):\n return self.__y", "def setY(self, *args):\n return _libsbml.Point_setY...
[ "0.7824647", "0.7789776", "0.77398807", "0.7738483", "0.7698442", "0.7642297", "0.7619385", "0.76075387", "0.76014006", "0.7586667", "0.7569661", "0.7569661", "0.7532064", "0.7500866", "0.74680847", "0.7445015", "0.7398983", "0.73577964", "0.7341188", "0.72738236", "0.7256707...
0.68330735
78
Deletes this pen object.
def __del__(self): self._screen._removePen(self) del self._turtle
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(self):\n # exit contains our clean up code\n self.exit()\n GenericAnimatedProp.GenericAnimatedProp.delete(self)", "def delete(self):\n self.graph._del(handle=self.handle)", "def delete(self):\n del self.shx.atoms[self.index]", "def __del__(self):\n\n # Del...
[ "0.6839339", "0.6739376", "0.66108614", "0.65926075", "0.6585168", "0.6571784", "0.65023196", "0.64651775", "0.6461599", "0.6461599", "0.63839555", "0.63446337", "0.63371813", "0.63204235", "0.63204235", "0.63204235", "0.63204235", "0.63204235", "0.63204235", "0.63204235", "0...
0.71101624
0
Moves the pen to given position without drawing.
def move(self,x,y): assert (type(x) in [int, float]), "parameter x:%s is not a valid number" % `x` assert (type(y) in [int, float]), "parameter y:%s is not a valid number" % `y` fstate = self._turtle.fill() if fstate: # only need to do this if in mid-fill self._turtle.fill(False) self._turtle.penup() self._turtle.setposition(x,y) self._turtle.pendown() if fstate: # only need to do this if in mid-fill self._turtle.fill(True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def penup(self):\n if not self._drawing:\n return\n self.pen(pendown=False)", "def give_space(self):\r\n pen.forward(20)", "def move(self, x, y):\r\n if self.brush_on:\r\n for lx, ly in line(self.pos_x, self.pos_y, x, y):\r\n self.set(lx, ly)\r\n...
[ "0.66753656", "0.64267194", "0.6406833", "0.635348", "0.6280323", "0.62788904", "0.6258426", "0.6257431", "0.6155344", "0.6149044", "0.6132005", "0.6049534", "0.60103166", "0.59875387", "0.5973302", "0.5959287", "0.5955407", "0.5939342", "0.5917403", "0.589879", "0.5859435", ...
0.58909005
20
Draws a line segment (dx,dy) from the current pen position
def drawLine(self, dx, dy): assert (type(dx) in [int, float]), "parameter x:%s is not a valid number" % `dx` assert (type(dy) in [int, float]), "parameter y:%s is not a valid number" % `dy` x = self._turtle.xcor() y = self._turtle.ycor() self._turtle.setposition(x+dx, y+dy)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __draw_line(display, color, ball_pos, dx, dy):\n pygame.draw.line(display, color, ball_pos, (ball_pos[0] + dx, ball_pos[1] + dy), 2)", "def draw_line():\n global y1, y2\n canvas.create_line(x1, y1, x2, y2, width=2, fill=color)\n y1 -= 10\n y2 += 10", "def draw_line(self, x):\n sel...
[ "0.74554735", "0.68954694", "0.6881306", "0.68413955", "0.68105817", "0.67588437", "0.6756782", "0.67204547", "0.6719156", "0.67131805", "0.66987574", "0.6690832", "0.6682115", "0.6653802", "0.66391045", "0.6631516", "0.6622917", "0.6610148", "0.65972066", "0.65874225", "0.65...
0.7574059
0
Draws a line from the current pen position to (x,y)
def drawTo(self, x, y): assert (type(x) in [int, float]), "parameter x:%s is not a valid number" % `x` assert (type(y) in [int, float]), "parameter y:%s is not a valid number" % `y` self._turtle.setposition(x, y)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_line():\n global y1, y2\n canvas.create_line(x1, y1, x2, y2, width=2, fill=color)\n y1 -= 10\n y2 += 10", "def line(self, x, y):\n self.call('line', x, y)", "def draw_line(self, x):\n self.PDF.setStrokeColor(black01)\n self.PDF.setLineWidth(1)\n self.PDF.line(75...
[ "0.7670841", "0.75497407", "0.7464488", "0.7421213", "0.7273697", "0.72548485", "0.7247189", "0.72389364", "0.7186178", "0.7064833", "0.7045982", "0.70430654", "0.7028041", "0.6984681", "0.69775695", "0.69517475", "0.6920274", "0.6900129", "0.68952066", "0.68559307", "0.68300...
0.6691237
29
Draw a circle of radius r centered on the pen.
def drawCircle(self, r): assert (type(r) in [int, float]), "parameter r:%s is not a valid number" % `r` x = self._turtle.xcor() y = self._turtle.ycor() # Move the pen into position fstate = self._turtle.pendown() if fstate: self._turtle.penup() self._turtle.setposition(x, y-r) if fstate: self._turtle.pendown() # Draw the circle and fill if necessary self._turtle.circle(r) self.flush() self._turtle.forward(0) # Return the pen to the position if fstate: self._turtle.penup() self._turtle.setposition(x, y) if fstate: self._turtle.pendown()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drawCircle(x, y, r):\n pen1.up()\n pen1.goto(x,y)\n pen1.down()\n pen1.circle(r)", "def circle(draw, centrex, centrey, radius, color=\"#AAAAAAFF\") -> None:\n # convert cartesian centre to pixel centre\n cx, cy = pixelcoord(centrex, centrey)\n # top left and bottom right coordinates\n ...
[ "0.8421582", "0.78745735", "0.78179467", "0.78179467", "0.7747963", "0.7729969", "0.77170885", "0.76944184", "0.7692904", "0.7636455", "0.7619516", "0.7604409", "0.74545527", "0.7423694", "0.7403186", "0.7349896", "0.73346525", "0.732114", "0.7312092", "0.7307844", "0.729076"...
0.8723447
0
Deletes the pen's drawings from the window. This method does not move the pen or alter its attributes.
def clear(self): self._turtle.clear()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _clear_drawing(self) -> None:\n self.vertices.clear()\n self.edges.clear()\n self.subplot.clear()\n self.selected_element = None\n self.pressed_elements.clear()", "def __del__(self):\n self._screen._removePen(self)\n del self._turtle", "def _removePen(self,p...
[ "0.67064834", "0.66925335", "0.6634227", "0.6408168", "0.63029826", "0.62384754", "0.6211156", "0.618159", "0.61493623", "0.61185306", "0.60864323", "0.59476477", "0.5929833", "0.5870426", "0.5830595", "0.5802855", "0.574537", "0.5735789", "0.5705624", "0.56923753", "0.563894...
0.5612297
23
Deletes the pen's drawings from the window. This method recenters the pen and resets all attributes to their default values.
def reset(self): self._turtle.clear() self._turtle.setposition((0,0)) try: self._turtle.shape('pen.gif') except: self._turtle.shape('classic') self._turtle.color('red') self.speed = 0 #pair = self._turtle.color() self._pencolor = self._turtle.color()[0] self._fillcolor = self._turtle.color()[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _clear_drawing(self) -> None:\n self.vertices.clear()\n self.edges.clear()\n self.subplot.clear()\n self.selected_element = None\n self.pressed_elements.clear()", "def __del__(self):\n self._screen._removePen(self)\n del self._turtle", "def _clear_drawing(se...
[ "0.7000005", "0.68685716", "0.6522826", "0.6467621", "0.64485425", "0.63026386", "0.62595445", "0.62351507", "0.6223138", "0.6192789", "0.6185075", "0.61828935", "0.6163207", "0.61281633", "0.6050944", "0.6014234", "0.6014234", "0.5996016", "0.5904447", "0.58800614", "0.58787...
0.5666995
36
Fills in the current drawing, but retains state. Normally, an object is not filled until you set the state to False. Calling this method executes this fill, without setting the state to False. If fill is False, this method does nothing.
def flush(self): if self.fill: self._turtle.fill(False) self._turtle.fill(True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setFilled(self, fill):\n isFilled = fill\n repaint()", "def fill(self):\n return self._turtle.fill()", "def update_fill(self, event):\r\n\r\n if event.type == 'FILL':\r\n self.update_positions_from_fill(event)\r\n self.update_holdings_from_fill(...
[ "0.76267654", "0.7002292", "0.6535505", "0.6509827", "0.6509827", "0.6482051", "0.64610213", "0.63605654", "0.6331894", "0.6112397", "0.6048987", "0.59302145", "0.58996844", "0.5897555", "0.5853862", "0.57472944", "0.5747061", "0.5738132", "0.5734731", "0.5734146", "0.5732249...
0.70235515
1
hgtStartData is the source data from the NASA JPL topological data
def __init__(self, hgtStartData): self.data = [] for row in hgtStartData: toAdd = [] for height in row: toAdd.append([height, 0]) self.data.append(toAdd) self.maxX = len(hgtStartData[0]) - 1 self.maxY = len(hgtStartData) - 1 self.minFloodHeight = 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _compute_single_source_data(self, start, end):\n single_source_data = {}\n dijkstra = Dijkstra(self.graph_provider)\n single_source_data['start'] = dijkstra.single_source(start)\n single_source_data['end'] = dijkstra.single_source(end)\n\n self._single_source_data = single_so...
[ "0.55448586", "0.54904854", "0.5319753", "0.5157752", "0.515219", "0.5077915", "0.5074858", "0.50618047", "0.49980226", "0.4995144", "0.4934863", "0.4929119", "0.49235275", "0.49122941", "0.49056458", "0.489825", "0.48901126", "0.4874309", "0.4871687", "0.48503634", "0.483276...
0.580808
0
returns the topological height at (x, y)
def getHeight(self, x, y): if x > self.maxX or y > self.maxY or x < 0 or y < 0: return 10000000 # effectively infinity return self.data[y][x][0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def height(self):\n return self.i_node.distance(self.n_node)", "def _height1(self): #works but n^2 time\n return max(self.depth(p) for p in self.positions() if self.is_leaf(p))", "def height(self):\n return self.upper_right.y - self.lower_left.y", "def _height1(self): # w...
[ "0.6800607", "0.65334195", "0.65241534", "0.6479777", "0.6462834", "0.63903254", "0.6358888", "0.6354578", "0.6334228", "0.63333184", "0.62644345", "0.6259376", "0.62438977", "0.62394667", "0.6223324", "0.6222117", "0.62176883", "0.6216847", "0.62075406", "0.6189507", "0.6180...
0.7280083
0
returns the level of water at the point (x, y)
def getWater(self, x, y): if x > self.maxX or y > self.maxY or x < 0 or y < 0: raise Exception("accessed an invalid position in method getWater") return self.data[y][x][1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_water_level(self):\n return self.water_level", "def get_current_water_level(self):\n \n url = f'http://waterservices.usgs.gov/nwis/iv/?format=json&sites={self.site_number}&parameterCd=00060,00065&siteStatus=all'\n\n response = requests.request(\"GET\", url)\n data = jso...
[ "0.7158327", "0.67313606", "0.661933", "0.65803623", "0.65341234", "0.63737684", "0.59729874", "0.5847632", "0.58334917", "0.5827491", "0.58220893", "0.58033043", "0.57986677", "0.5751506", "0.56921387", "0.56882936", "0.5679975", "0.5662248", "0.56592685", "0.56507444", "0.5...
0.74286795
0
This returns the raw internal state. Generally avoid using this if you can
def getAllData(self): return self.data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def state_raw(self):\n return self._state_raw", "def __getstate__(self):\n return self.__dict__", "def __getstate__(self):\n state = self.__dict__.copy()\n self.__cleanState__(state)\n return state", "def _get_state(self):", "def __getstate__(self):\n\n\t\tresult = self._...
[ "0.8229839", "0.7681325", "0.76782733", "0.75114673", "0.7508105", "0.7503525", "0.7435647", "0.74314433", "0.74314433", "0.74314433", "0.74314433", "0.74314433", "0.74314433", "0.74314433", "0.74314433", "0.74314433", "0.74314433", "0.74314433", "0.74314433", "0.74314433", "...
0.0
-1
Return true if if the line drawn through a, b, and c makes a right turn.
def rightTurnFiltered(a, b, c): def isSmall(number): """Function to check if a number is very small.""" return abs(number) < epsilon def floatVectortoFractionVector(vector): return [Fraction.from_float(x) for x in vector] def crossProduct(p1, p2, p3): """Compute the crossProduct of the vectors p2 - p1 and p3 - p1.""" return ( -(p1[1]*p2[0]) + p1[0]*p2[1] + p1[1]*p3[0] - p2[1]*p3[0] - p1[0]*p3[1] + p2[0]*p3[1] ) v1Norm = euclidean_distance(a, b) v2Norm = euclidean_distance(a, c) q = crossProduct(a, b, c) angle = q / (v1Norm * v2Norm) if ( isSmall(v1Norm) or isSmall(v2Norm) or isSmall(angle) ): q = crossProduct( floatVectortoFractionVector(a), floatVectortoFractionVector(b), floatVectortoFractionVector(c) ) return (q > 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_ccw(point_a, point_b, point_c):\r\n return is_on_line(point_a, point_b, point_c) > 0", "def is_right_angle(a, b, c):\n if a == 0 or b == 0 or c == 0:\n return False\n else :\n return (a == b + c) or (b == c + a) or (c == a + b)", "def test_right_turn_true(self):\n point1 =...
[ "0.7412801", "0.7080334", "0.7044733", "0.68451196", "0.6785564", "0.6677456", "0.63376695", "0.63277566", "0.63084525", "0.6250756", "0.62460744", "0.6239518", "0.6237629", "0.6189446", "0.6157471", "0.6096383", "0.6095791", "0.6095791", "0.6009904", "0.5992941", "0.59842193...
0.0
-1
Function to check if a number is very small.
def isSmall(number): return abs(number) < epsilon
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_small(a:int, b:int) -> bool:\n return a <= b", "def dangerouslySmall(c, e):\n return e < -limit and e < (-integerLog10(abs(c))) - 1", "def is_large(a:int, b:int) -> bool:\n return a>=b", "def has_small_digits(n,maxdigit):\n digits = [int(num) for num in str(n)]\n return all([num <= maxd...
[ "0.71358377", "0.70233357", "0.6894309", "0.64070696", "0.6313465", "0.623198", "0.62296844", "0.6060151", "0.605466", "0.6032642", "0.5905205", "0.58516663", "0.58045554", "0.571476", "0.5698064", "0.56735736", "0.5664453", "0.5655646", "0.5649527", "0.5642045", "0.5599978",...
0.81616944
0
Compute the crossProduct of the vectors p2 p1 and p3 p1.
def crossProduct(p1, p2, p3): return ( -(p1[1]*p2[0]) + p1[0]*p2[1] + p1[1]*p3[0] - p2[1]*p3[0] - p1[0]*p3[1] + p2[0]*p3[1] )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cross_product(p0,p1,p2):\n\treturn (((p1[0]-p0[0])*(p2[1]-p0[1]))-((p2[0]-p0[0])*(p1[1]-p0[1])))", "def cross_product(v1, v2):\n return cg3d_vector.CG3dVector(\n v1[1] * v2[2] - v2[1] * v1[2],\n v1[2] * v2[0] - v2[2] * v1[0],\n v1[0] * v2[1] - v2[0] * v1[1]\n )", "def crossProduc...
[ "0.7840646", "0.7627517", "0.7564835", "0.75022256", "0.7371499", "0.716658", "0.7165488", "0.71437544", "0.7071827", "0.69996214", "0.6967165", "0.69446385", "0.6910858", "0.6805146", "0.67996776", "0.67702717", "0.67530876", "0.6737045", "0.6727149", "0.6688273", "0.6610096...
0.92136556
0
Calculate the determinant of the matrix. 1 a[0] a[1] 1 b[0] b[1] 1 c[0] c[1]
def det(a, b, c): d = (b[0]*c[1]-c[0]*b[1])+(c[0]*a[1]-a[0]*c[1])+(a[0]*b[1]-a[1]*b[0]) return d
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def determinant(self):\n if not self.is_square():\n raise(ValueError, \"Cannot calculate determinant of non-square matrix.\")\n if self.h > 2:\n raise(NotImplementedError, \"Calculating determinant not implemented for matrices largerer than 2x2.\")\n\n # TODO - your code here\n if self.h ...
[ "0.83127224", "0.820862", "0.81752694", "0.81515414", "0.8125667", "0.8122804", "0.8108574", "0.8040401", "0.7995659", "0.79841894", "0.79394454", "0.78940946", "0.78786963", "0.7800863", "0.77844036", "0.77780765", "0.7775752", "0.77719444", "0.7747811", "0.7714111", "0.7651...
0.73150444
31
Read SQL table from database and return as dataframe.
def get_db_table(table: str, index_col='id'): # Read url from secret environment variable. Set this in your CI environment. url = os.getenv('DATABASE_URL') if url is None: logging.error("Environment variable DATABASE_URL not set.") return pd.DataFrame() # Create an engine instance. engine = create_engine(url, pool_recycle=3600) # Connect to PostgreSQL server. conn = engine.connect() # Read data from PostgreSQL database table and load into a DataFrame instance. dataFrame = pd.read_sql(f"select * from \"{table}\"", conn, index_col=index_col) # Close the database connection. conn.close() return dataFrame
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data_from_database(query, db_connection):\n\n dataframe = pandas.read_sql(query, con=db_connection)\n print(\"Data from database: \", dataframe.head(5))\n print(\"Size of dataframe from database: \", dataframe.shape)\n\n return dataframe", "def open_data(table):\n engine = create_engine(my...
[ "0.81299627", "0.805204", "0.80501723", "0.80095464", "0.7997728", "0.7991211", "0.79572374", "0.787298", "0.783609", "0.78281873", "0.7788777", "0.77415526", "0.77030283", "0.7697647", "0.7693436", "0.76739347", "0.7665277", "0.76047397", "0.7588384", "0.7585602", "0.7566514...
0.7388874
22
Update employment history for given profile id.
def update_work_history(work_history_list, profile_id): saved_work_history_ids = set() for work_history in work_history_list: work_history_id = work_history.get("id") work_history_instance = None if work_history_id: try: work_history_instance = Employment.objects.get( profile_id=profile_id, id=work_history_id ) except Employment.DoesNotExist: raise ValidationError("Work history {} does not exist".format(work_history_id)) work_history_serializer = EmploymentSerializer(instance=work_history_instance, data=work_history) work_history_serializer.is_valid(raise_exception=True) work_history_serializer.save(profile_id=profile_id) saved_work_history_ids.add(work_history_serializer.instance.id) Employment.objects.filter(profile_id=profile_id).exclude(id__in=saved_work_history_ids).delete()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_profits(self, next_profit):\n self.profit = next_profit\n self.profit_history.append(next_profit)", "def update_profile(profile_id):\n \n profile = mongo.db.profiles\n profile.find_one_and_update({'_id': ObjectId(profile_id)},\n {'$set': {'date': d...
[ "0.5801277", "0.57033116", "0.55727786", "0.5357609", "0.5347083", "0.52954924", "0.529461", "0.5294242", "0.52700007", "0.5151352", "0.5092951", "0.5087638", "0.5076853", "0.5068695", "0.5017037", "0.50102806", "0.50093156", "0.5007281", "0.50012374", "0.5000325", "0.4986342...
0.6740493
0
Update education for given profile id.
def update_education(education_list, profile_id): saved_education_ids = set() for education in education_list: education_id = education.get("id") if education_id is not None: try: education_instance = Education.objects.get(profile_id=profile_id, id=education_id) except Education.DoesNotExist: raise ValidationError("Education {} does not exist".format(education_id)) else: education_instance = None education_serializer = EducationSerializer(instance=education_instance, data=education) education_serializer.is_valid(raise_exception=True) education_serializer.save(profile_id=profile_id) saved_education_ids.add(education_serializer.instance.id) Education.objects.filter(profile_id=profile_id).exclude(id__in=saved_education_ids).delete()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_profile(profile_id):\n \n profile = mongo.db.profiles\n profile.find_one_and_update({'_id': ObjectId(profile_id)},\n {'$set': {'date': datetime.utcnow(),\n 'headline': request.form.get('headline'),\n ...
[ "0.6951867", "0.6946061", "0.645494", "0.6349245", "0.63402873", "0.63243157", "0.6253774", "0.62004584", "0.6143139", "0.61277544", "0.60156894", "0.5982269", "0.59785736", "0.59742916", "0.5897288", "0.5836116", "0.5803204", "0.5785535", "0.5748711", "0.5654298", "0.5577862...
0.67715335
2
Iterate through fields in serializer and set all to required except ignore_fields
def set_fields_to_required(serializer, ignore_fields=None): if ignore_fields is None: ignore_fields = [] for field in serializer.fields.values(): if field.field_name not in ignore_fields: field.required = True field.allow_null = False field.allow_blank = False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_required_fields(self) -> Iterable[fields.Field]:\n for model_field in self.get_fields():\n if model_field.required:\n yield model_field", "def clean_fields(self, instance, exclude=None):\n errors = {}\n exclude = exclude or []\n for name, f in self.pr...
[ "0.64765036", "0.6341806", "0.63284636", "0.6283481", "0.62026083", "0.6162853", "0.6133982", "0.6094568", "0.5909462", "0.5858007", "0.58525836", "0.58163685", "0.5798981", "0.5755898", "0.5753509", "0.5744149", "0.57343006", "0.5726579", "0.57135725", "0.57066965", "0.56978...
0.87516534
0
Update serializer_field_mapping to use fields setting required=True
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) set_fields_to_required(self, ['end_date'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_fields_to_required(serializer, ignore_fields=None):\n if ignore_fields is None:\n ignore_fields = []\n for field in serializer.fields.values():\n if field.field_name not in ignore_fields:\n field.required = True\n field.allow_null = False\n field.allow_b...
[ "0.73499066", "0.59110147", "0.5813631", "0.5798847", "0.57730836", "0.5717525", "0.5697753", "0.56940204", "0.56850916", "0.5684714", "0.5658657", "0.56166375", "0.5562546", "0.5559823", "0.55570066", "0.5553048", "0.5540108", "0.5510436", "0.546832", "0.5458542", "0.5449583...
0.0
-1
Update serializer_field_mapping to use fields setting required=True
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) set_fields_to_required(self, ['field_of_study'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_fields_to_required(serializer, ignore_fields=None):\n if ignore_fields is None:\n ignore_fields = []\n for field in serializer.fields.values():\n if field.field_name not in ignore_fields:\n field.required = True\n field.allow_null = False\n field.allow_b...
[ "0.7349095", "0.59120345", "0.58142334", "0.57975155", "0.5773961", "0.5717595", "0.56959385", "0.5695273", "0.568627", "0.56845975", "0.5660791", "0.5620639", "0.5562065", "0.5561373", "0.5556391", "0.555515", "0.55402875", "0.5511495", "0.546896", "0.5459124", "0.54497963",...
0.0
-1
Getter for the username field
def get_username(self, obj): return obj.user.username
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_username(self):\n return str(getattr(self, self.USERNAME_FIELD))", "def get_username(self):\r\n return self.username", "def get_username(self):\n return self.username", "def username(self) -> undefined.UndefinedOr[str]:", "def get_username(self):\n raise NotImplementedEr...
[ "0.8819286", "0.8542671", "0.84036976", "0.8369547", "0.8357543", "0.8345958", "0.83210427", "0.82775146", "0.8162549", "0.8162549", "0.8135109", "0.8098483", "0.80932707", "0.8029489", "0.8025117", "0.7972525", "0.79250383", "0.7903688", "0.7901838", "0.7901838", "0.7901838"...
0.7931724
16
Update serializer_field_mapping to use fields setting required=True
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) ignore_fields = ( 'about_me', 'romanized_first_name', 'romanized_last_name', 'postal_code', ) set_fields_to_required(self, ignore_fields=ignore_fields)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_fields_to_required(serializer, ignore_fields=None):\n if ignore_fields is None:\n ignore_fields = []\n for field in serializer.fields.values():\n if field.field_name not in ignore_fields:\n field.required = True\n field.allow_null = False\n field.allow_b...
[ "0.7349095", "0.59120345", "0.58142334", "0.57975155", "0.5773961", "0.5717595", "0.56959385", "0.5695273", "0.568627", "0.56845975", "0.5660791", "0.5620639", "0.5562065", "0.5561373", "0.5556391", "0.555515", "0.55402875", "0.5511495", "0.546896", "0.5459124", "0.54497963",...
0.531521
32
Assert that filled_out can't be turned off and that agreed_to_terms_of_service is true
def validate(self, attrs): if 'filled_out' in attrs and not attrs['filled_out']: raise ValidationError("filled_out cannot be set to false") if 'agreed_to_terms_of_service' in attrs and not attrs['agreed_to_terms_of_service']: raise ValidationError("agreed_to_terms_of_service cannot be set to false") # Postal code is only required in United States and Canada country = attrs.get("country", "") postal_code = attrs.get("postal_code", "") if country in ("US", "CA") and not postal_code: raise ValidationError("postal_code may not be blank") return super().validate(attrs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_reject_agreement(self):\n pass", "def test_terminate_agreement(self):\n pass", "def test_dont_cancel_if_advance_payment_not_required(self, mock_tz):\n mock_tz.now.return_value = datetime(\n 2015, 2, 11, 10, tzinfo=dt_timezone.utc\n )\n # set payment_due_da...
[ "0.66434324", "0.6157988", "0.61146647", "0.610798", "0.60404", "0.6012807", "0.6009148", "0.6007099", "0.5963601", "0.5951551", "0.59262794", "0.5911601", "0.59060943", "0.59055305", "0.58505845", "0.58087033", "0.5791745", "0.57821536", "0.5769893", "0.57652164", "0.5752993...
0.54506004
59
Getter for the username field
def get_username(self, obj): return obj.user.username
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_username(self):\n return str(getattr(self, self.USERNAME_FIELD))", "def get_username(self):\r\n return self.username", "def get_username(self):\n return self.username", "def username(self) -> undefined.UndefinedOr[str]:", "def get_username(self):\n raise NotImplementedEr...
[ "0.8819286", "0.8542671", "0.84036976", "0.8369547", "0.8357543", "0.8345958", "0.83210427", "0.82775146", "0.8162549", "0.8162549", "0.8135109", "0.8098483", "0.80932707", "0.8029489", "0.8025117", "0.7972525", "0.79250383", "0.7903688", "0.7901838", "0.7901838", "0.7901838"...
0.7931724
17
Returns an instance for a given Jenkins URL. The returned instance is usually a instance of a PlatformJenkins subclass (this allows to switch to a different Jenkins API.
def get_jenkins(cls, url, template_dir=None): return PlatformJenkinsJavaCLI(template_dir, url)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, baseurl, nodename, jenkins_obj):\n self.name = nodename\n self.jenkins = jenkins_obj\n JenkinsBase.__init__(self, baseurl)", "def fromurl(cls, url: str):\n return cls.parse_obj(requests.get(url).json())", "async def from_url(cls) -> \"AocPrivateLeaderboard\":\n ...
[ "0.5845707", "0.55609673", "0.52667314", "0.51818883", "0.5164338", "0.5137516", "0.5066826", "0.5053414", "0.5036196", "0.49901026", "0.49768355", "0.49687746", "0.4964062", "0.49446085", "0.49446085", "0.48970905", "0.48545104", "0.48198324", "0.48110753", "0.48049742", "0....
0.7511691
0
Returns true if a given view exists.
def view_exists(self, view): with open("/dev/null", "w") as devnull: call = subprocess.Popen(self.cli + [PlatformJenkinsJavaCLI.GET_VIEW, view], stdout=devnull, stderr=devnull) call.wait() return call.returncode == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exists_for_view(self, view_id):\n raise NotImplementedError(\"calling abstract method\")", "def has_debug_view(name=None):\r\n for view in sublime.active_window().views():\r\n if is_debug_view(view):\r\n if name is not None:\r\n if view.name() == name:\r\n ...
[ "0.8074527", "0.70116293", "0.68193936", "0.66889185", "0.660105", "0.6589236", "0.6287463", "0.6287463", "0.6283923", "0.6276442", "0.62659264", "0.6244167", "0.623865", "0.6238351", "0.6232471", "0.6214478", "0.61842877", "0.6141818", "0.61366314", "0.6128516", "0.612039", ...
0.76935965
1
Creates a View, defined by XML in view_xml_filename. If the file exists, it will be update using the provided definition.
def set_view(self, view, view_xml_filename): if self.view_exists(view): command = PlatformJenkinsJavaCLI.UPDATE_VIEW else: command = PlatformJenkinsJavaCLI.CREATE_VIEW with open(view_xml_filename) as view_xml_file: view_xml = view_xml_file.read() call = subprocess.Popen(self.cli + [command, view], stdin=subprocess.PIPE) call.communicate(view_xml) call.wait()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_view(name, fields=''):\n if '/' in name:\n blueprint_name, model_name = name.split('/')\n output_file = 'blueprints/%s/views.py' % blueprint_name\n else:\n model_name = name\n output_file = 'views.py'\n file_exists = os.path.exists(output_file)\n form_data = []\n ...
[ "0.59218645", "0.5722048", "0.5537454", "0.5507403", "0.54620814", "0.54460394", "0.5323818", "0.53216887", "0.5261694", "0.52564645", "0.5204779", "0.5170237", "0.5099098", "0.5052455", "0.50478405", "0.50409013", "0.50351095", "0.50225526", "0.50119054", "0.49706888", "0.49...
0.74085957
0
Returns True if the given job exists.
def job_exists(self, job): with open(os.devnull, 'w') as devnull: result = subprocess.call(self.cli + [PlatformJenkinsJavaCLI.GET_JOB, job.name], stdout=devnull) return result == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def job_exists(self, job_id):\n\n return True if self.get_status(job_id) else False", "def exists(cls, job_id: str, connection: Optional['Redis'] = None) -> bool:\n if not connection:\n connection = resolve_connection()\n job_key = cls.key_for(job_id)\n job_exists = connect...
[ "0.8646111", "0.80569893", "0.69944775", "0.6987492", "0.6604774", "0.654603", "0.6538874", "0.65194386", "0.6514213", "0.6511255", "0.64722615", "0.64207816", "0.6419019", "0.6390656", "0.63874865", "0.63817424", "0.6360946", "0.63050056", "0.63043344", "0.62540364", "0.6230...
0.85490435
1
Deletes a given job from Jenkins.
def delete_job(self, job): subprocess.call(self.cli + [PlatformJenkinsJavaCLI.DELETE_JOB, job.name])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_job(self, job, context=None):\n return self._client.call_method(\n 'UserAndJobState.delete_job',\n [job], self._service_ver, context)", "def delete(job_id):\n job = JobModel.get_one_job(job_id)\n if not job:\n return custom_response({'Error':'Job Not Found'}, ...
[ "0.7612383", "0.75631183", "0.75325656", "0.7520281", "0.74776965", "0.7339835", "0.73373073", "0.73164237", "0.7306595", "0.71888834", "0.70548284", "0.6966155", "0.69645363", "0.69290483", "0.6865273", "0.6846396", "0.682398", "0.6734061", "0.6658749", "0.6615366", "0.65832...
0.87232506
0
Triggers given job, providing a set of parameters to it.
def trigger_job(self, job, parameters=None): parameters = parameters or {} parameter_list = [] for key in parameters: parameter_list.append("-p") parameter_list.append("%s=%s" % (key, parameters[key])) if subprocess.call(self.cli + [PlatformJenkinsJavaCLI.BUILD_JOB, job.name] + parameter_list) != 0: raise PlatformJenkinsException("Triggering job failed: " + job.name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trigger(builder, revision, files=[], dry_run=False, extra_properties=None):\n repo_name = query_repo_name_from_buildername(builder)\n return buildapi.trigger_arbitrary_job(repo_name, builder, revision, files, dry_run,\n extra_properties)", "def trigger_labeling_...
[ "0.6365271", "0.6245668", "0.62099326", "0.61203486", "0.588978", "0.5762087", "0.5737363", "0.56618714", "0.5655177", "0.55685776", "0.5567557", "0.55617213", "0.5506177", "0.5457874", "0.5420332", "0.5409931", "0.53858936", "0.5350611", "0.53456885", "0.5329666", "0.5314936...
0.7157829
0
Enables given job on Jenkins.
def enable_job(self, job): if subprocess.call(self.cli + [PlatformJenkinsJavaCLI.ENABLE_JOB, job.name]) != 0: raise PlatformJenkinsException("Enabling job failed: " + job.name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def EnableJob(self, job_urn, token=None):\n cron_job = aff4.FACTORY.Open(job_urn, mode=\"rw\", aff4_type=\"CronJob\",\n token=token)\n cron_job.Set(cron_job.Schema.DISABLED(0))\n cron_job.Close()", "def disable_job(self, job):\n if subprocess.call(self.cli + [Platf...
[ "0.6508622", "0.640465", "0.6054045", "0.589058", "0.5827825", "0.55788094", "0.5573359", "0.5561993", "0.5552079", "0.5471112", "0.54423046", "0.5440283", "0.543312", "0.5425502", "0.5387053", "0.53846234", "0.5364459", "0.5362083", "0.5344735", "0.53233784", "0.52979136", ...
0.85384786
0
Disables given job on Jenkins.
def disable_job(self, job): if subprocess.call(self.cli + [PlatformJenkinsJavaCLI.DISABLE_JOB, job.name]) != 0: raise PlatformJenkinsException("Disabling job failed: " + job.name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DisableJob(self, job_urn, token=None):\n cron_job = aff4.FACTORY.Open(job_urn, mode=\"rw\", aff4_type=\"CronJob\",\n token=token)\n cron_job.Set(cron_job.Schema.DISABLED(1))\n cron_job.Close()", "def deactivate_job(job_name):\n job = Job.from_name(job_name)\n jo...
[ "0.7047712", "0.66080946", "0.6542796", "0.61389357", "0.61290914", "0.6022472", "0.6003207", "0.596457", "0.59564406", "0.5941506", "0.59358865", "0.59051114", "0.58281994", "0.58168745", "0.5810319", "0.5772574", "0.57711303", "0.57645935", "0.57537967", "0.5739578", "0.572...
0.8205387
0
Create a given job on Jenkins.
def create_job(self, job): call = subprocess.Popen(self.cli + [PlatformJenkinsJavaCLI.CREATE_JOB, job.name], stdin=subprocess.PIPE) out, err = call.communicate(input=platform_ci.jjb.get_job_as_xml(job, self.template_dir)) call.wait() if call.returncode != 0: logging.info(out) logging.error(err) raise PlatformJenkinsException("Creating job failed: " + job.name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(cfg, jobs):\n server = jenkins_utils.server_factory(cfg)\n libjobs.createJobs(server, jobs)", "def create_job(api_instance, job):\n api_response = api_instance.create_namespaced_job(\n body=job, namespace=\"default\", pretty=True\n )\n logger.info(\"Job created with status='%s'\"...
[ "0.7520048", "0.7107826", "0.7052509", "0.70495903", "0.7000261", "0.6887487", "0.68790656", "0.6827953", "0.6707598", "0.66782993", "0.6650939", "0.6482045", "0.6402906", "0.63344806", "0.6322465", "0.62909174", "0.6267784", "0.62481385", "0.6242675", "0.6240722", "0.6237485...
0.82524973
0
Update a given job on Jenkins.
def update_job(self, job): call = subprocess.Popen(self.cli + [PlatformJenkinsJavaCLI.UPDATE_JOB, job.name], stdin=subprocess.PIPE) call.communicate(input=platform_ci.jjb.get_job_as_xml(job, self.template_dir)) call.wait() if call.returncode != 0: raise PlatformJenkinsException("Updating job failed: " + job.name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(cfg, jobs):\n server = jenkins_utils.server_factory(cfg)\n libjobs.updateJobs(server, jobs)", "def update(self, job_name, param_name, value, description=None):\n if job_name in self._jobs:\n getattr(self._jobs[job_name], param_name).update(value, description)\n else:\n ...
[ "0.7519566", "0.7305608", "0.72748035", "0.67824453", "0.67824453", "0.67824453", "0.67824453", "0.65911585", "0.6502356", "0.64618725", "0.6382063", "0.6357814", "0.6337168", "0.6310358", "0.63080525", "0.63080525", "0.63080525", "0.62912005", "0.6251998", "0.61053956", "0.6...
0.8326795
0
Updates a job build description.
def set_build_description(self, job_name, build, description): try: subprocess.check_call(self.cli + [PlatformJenkinsJavaCLI.SET_DESCRIPTION, job_name, build, description]) except subprocess.CalledProcessError: message = "Setting build description failed (job={0}, build={1}, description='{2}')".format(job_name, build, description) raise PlatformJenkinsException(message)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_current_build_description(self, description):\n job_name = os.environ.get(\"JOB_NAME\", None)\n build_id = os.environ.get(\"BUILD_NUMBER\", None)\n if job_name is not None and build_id is not None:\n self.set_build_description(job_name, build_id, description)", "def update...
[ "0.72318727", "0.60756296", "0.60743475", "0.6020576", "0.5999859", "0.59925103", "0.59728664", "0.5708703", "0.5699203", "0.56206816", "0.55843204", "0.55488455", "0.55029446", "0.548009", "0.5469594", "0.5459312", "0.54585123", "0.5456848", "0.5452424", "0.54208547", "0.538...
0.7354544
0
Updates a job build description for the current build. This method is intended to be run in an environment where JOB_NAME and BUILD_NUMBER are set in the environment, such as from within the job build itself. If either of the environment variables is not set, setting the description is not attempted at all.
def set_current_build_description(self, description): job_name = os.environ.get("JOB_NAME", None) build_id = os.environ.get("BUILD_NUMBER", None) if job_name is not None and build_id is not None: self.set_build_description(job_name, build_id, description)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_build_description(self, job_name, build, description):\n try:\n subprocess.check_call(self.cli + [PlatformJenkinsJavaCLI.SET_DESCRIPTION, job_name, build, description])\n except subprocess.CalledProcessError:\n message = \"Setting build description failed (job={0}, build...
[ "0.77581465", "0.58388937", "0.55399406", "0.5432845", "0.5427102", "0.5406418", "0.5297104", "0.524192", "0.5240581", "0.5238138", "0.519109", "0.51833254", "0.5152861", "0.5104744", "0.5102506", "0.50946575", "0.50842863", "0.50842136", "0.5079061", "0.50598854", "0.5059168...
0.8271981
0
DZ Scrape companies descriptions. sync
def scrape_descriptions_sync(): # прочитать Symbols, for symbol in tqdm(symbols) # исользовать urllib get запросы на yahoo и полученное записывать в файл с помощью # добавить tqdm(symbols) myheader = { 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36' } symbols = read_symbols() YAHOO_HTMLS.mkdir(parents=True, exist_ok=True) for symbol in tqdm(symbols): #Example myurl = "https://finance.yahoo.com/quote/AAPL/profile?p=AAPL" myurl = f'https://finance.yahoo.com/quote/{symbol}/profile?p={symbol}' try: req = request.Request(myurl, headers=myheader) response = request.urlopen(req) text = response.read() response.close() except Exception: print("Error occuried during web request!!") print(sys.exc_info()[1]) f = open(YAHOO_HTMLS / f'{symbol}.html', 'wb') f.write(text) f.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scrap_data_companies(self):\n list_job_offers = self.driver.find_elements_by_class_name(\n \"jobContainer\")\n jobs = []\n if len(list_job_offers) == 0:\n print(\"There is nothing to scrap for \", conf.URL_TO_SCRAPE,\n \"that was requested\")\n ...
[ "0.6335587", "0.62796295", "0.6159124", "0.6062749", "0.5804519", "0.579404", "0.57562304", "0.5744922", "0.570986", "0.5648496", "0.5623103", "0.5619176", "0.55752385", "0.5574863", "0.5566009", "0.55634576", "0.55546683", "0.55116194", "0.5485694", "0.5482928", "0.5479279",...
0.62571484
2
Parse a configuration file in INI format.
def __init__(self, inifile, dry_run, output): config = ConfigParser() config.read(inifile) sequence = config['dithersequence'] # Set up the output. self._output = output # Set up the file type and exposure sequence. self._location = sequence['location'] self._filetype = sequence['filetype'] self._date = sequence['date'] self._exposures = [int(e) for e in sequence['exposures'].split()] if 'coordinates' not in config: raise ValueError('no coordinates set for dither!') coords = config['coordinates'] self._dithertype = coords['dithertype'] self._wcs = fits.getdata(coords['wcsfile'], 2) self._wcs = self._wcs[np.argsort(self._wcs['mjd_obs'])] self._central_exposure = int(sequence['centralexposure']) if coords['dithertype'] == 'telescope': fadir = coords['fiberassigndir'] self._ditherfa = fits.getdata(os.path.join( fadir, 'fiberassign-%s.fits' % coords['ditheredtilenum'])) self._unditherfa = fits.getdata(os.path.join( fadir, 'fiberassign-%s.fits' % coords['unditheredtilenum'])) expnum = [int(fn.split('-')[1]) for fn in self._wcs['filename']] centralind = expnum.index(self._central_exposure) self._central_wcs = self._wcs[centralind] # Set the Tile ID for the output metadata. self._tileid = coords['unditheredtilenum'] else: raise ValueError('not implemented') # Extract the list of exposures on disk. self._exposure_files = self._getfilenames() if not dry_run: # Construct fiber output. self._exposure_table = self._buildtable()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_config(self):\n # TODO: parse config file\n pass", "def parse_config():\n config_file = glob.glob('config.ini')\n parser = ConfigParser()\n if config_file:\n parser.read(config_file)\n else:\n cwd = os.path.abspath(os.path.dirname(__file__))\n config_file ...
[ "0.76152253", "0.73512197", "0.7154713", "0.71381843", "0.7083268", "0.7074115", "0.7054041", "0.70176613", "0.6988784", "0.68394864", "0.6800065", "0.6791778", "0.6771396", "0.67589056", "0.67328686", "0.6729735", "0.6721972", "0.67042685", "0.66722804", "0.6669349", "0.6667...
0.0
-1
Return a list of exposures and filenames given an INI configuration. Returns
def _getfilenames(self): # Set up the path and file prefix depending on the filetype. if self._filetype == 'nightwatch': fileprefix = 'qcframe' if self._location == 'nersc': prefix = '/global/project/projectdirs/desi/spectro/nightwatch/kpno' elif self._location == 'kpno': prefix = '/exposures/desi' # not correct path! else: raise ValueError('Unknown location {}'.format(self._location)) elif self._filetype == 'redux': fileprefix = 'sframe' if self._location == 'nersc': prefix = '/global/project/projectdirs/desi/spectro/redux/daily/exposures' elif self._location == 'kpno': prefix = '/exposures/desi' # not correct path! else: raise ValueError('Unknown location {}'.format(self._location)) else: raise ValueError('Unknown file type {}'.format(self._filetype)) # Find the exposures files. exfiles = {} for ex in self._exposures: folder = '{}/{}/{:08d}'.format(prefix, self._date, ex) files = sorted(glob('{}/{}*.fits'.format(folder, fileprefix))) exfiles[ex] = files return exfiles
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _configFiles(self):\n import glob\n ret = [] \n for ext in self.configManager.extensions:\n ret.extend(\n glob.glob(f\"{self.pipelinesDir}/{self.pipeName}/*{ext}\"))\n return ret", "def get_config_files(self):\n flag, i = self.inotify\n\n if flag:\n kwargs = {...
[ "0.6261923", "0.6095658", "0.6020707", "0.60147893", "0.59440166", "0.58393127", "0.5772027", "0.5740705", "0.57304424", "0.56908756", "0.5659648", "0.56340367", "0.5621146", "0.5619135", "0.5599532", "0.5568797", "0.55641794", "0.55604345", "0.5555875", "0.5541721", "0.55283...
0.5931038
5
Loop through the exposure list and construct an observation table.
def _buildtable(self): tabrows = [] for i, (expid, exfiles) in enumerate(self._exposure_files.items()): specflux_b, specflux_r, specflux_z = [], [], [] tab = None if len(exfiles) == 0: continue print(expid) for exfile in exfiles: print(exfile) hdu = fits.open(exfile) # The following tables are present in the redux sframes and the # nightwatch qcframes. wave = hdu['WAVELENGTH'].data # However, in the nightwatch files the wavelength data are a # table of size nfiber x nwavelength. if self._filetype == 'nightwatch': if wave.ndim > 1: wave = wave[0] fluxhead = hdu['FLUX'].header fluxdata = hdu['FLUX'].data ivardata = hdu['IVAR'].data fibermap = hdu['FIBERMAP'].data exptime = fluxhead['EXPTIME'] if not np.all(self._unditherfa['FIBER'] == np.arange(len(self._unditherfa))): raise ValueError('weird fiberassign file format!') fibermap = self._unditherfa[fibermap['FIBER']] target_id = fibermap['TARGETID'] target_ra = fibermap['TARGET_RA'] target_dec = fibermap['TARGET_DEC'] fiber = fibermap['FIBER'] objtype = fibermap['OBJTYPE'] flux_g = fibermap['FLUX_G'] flux_r = fibermap['FLUX_R'] flux_z = fibermap['FLUX_Z'] x, y = [fibermap['FIBERASSIGN_{}'.format(val)] for val in ('X', 'Y')] camera = fluxhead['CAMERA'][0].upper() if getattr(self, '_deltara', None) is not None: dra = self._deltara[i]*np.ones(len(fiber)) ddec = self._deltadec[i]*np.ones(len(fiber)) elif self._dithertype == 'telescope': dithra = self._ditherfa['target_ra'] dithdec = self._ditherfa['target_dec'] udithra = self._unditherfa['target_ra'] udithdec = self._unditherfa['target_dec'] ontarget = ((self._ditherfa['targetid'] == self._unditherfa['targetid']) & (self._ditherfa['objtype'] == 'TGT')) dfiberra = (dithra-udithra)*np.cos(np.radians(udithdec))*60*60 dfiberdec = (dithdec-udithdec)*60*60 if not np.all(self._ditherfa['FIBER'] == np.arange(len(self._ditherfa))): raise ValueError('unexpected shape of dither file') dfiberra[~ontarget] = np.nan dfiberdec[~ontarget] = np.nan dfiberra = dfiberra[fiber] dfiberdec = dfiberdec[fiber] wcs = self.lookup_wcs(fluxhead['MJD-OBS']) centralwcs = self._central_wcs if (~np.isfinite(centralwcs['cenra'][1]) or ~np.isfinite(centralwcs['cendec'][1])): raise ValueError('central pointing ra/dec is NaN!') dtelra = (wcs['cenra'][1]-centralwcs['cenra'][1]) dtelra *= np.cos(np.radians(centralwcs['cendec'][1])) dteldec = wcs['cendec'][1]-centralwcs['cendec'][1] dra = dfiberra + dtelra*60*60 ddec = dfiberdec + dteldec*60*60 if np.all(~np.isfinite(dra)): print('warning: no good telescope offset for %s' % exfile) else: raise ValueError('not implemented') for j, fiber_id in enumerate(fiber): flux = fluxdata[j] ivar = ivardata[j] if not np.any(ivar > 0): specflux = 0 specflux_ivar = 0 else: meanivar = np.mean(ivar[ivar > 0]) mask = ivar > meanivar / 100 specflux = np.trapz(flux*mask, wave) specflux_ivar = 1./np.sum(ivar[mask]**-1) # Schlegel: sum over correct wavelengths, all three # filters, plus 11 pixel median filter to reject # cosmics. # will require being better about reading in # the spectrographs together. tabrows.append((expid, exptime, target_id[j], target_ra[j], target_dec[j], fiber[j], objtype[j], flux_g[j], flux_r[j], flux_z[j], specflux, specflux_ivar, camera, dra[j], ddec[j], x[j], y[j])) tab = Table(rows=tabrows, names=('EXPID', 'EXPTIME', 'TARGETID', 'TARGET_RA', 'TARGET_DEC', 'FIBER', 'OBJTYPE', 'FLUX_G', 'FLUX_R', 'FLUX_Z', 'SPECTROFLUX', 'SPECTROFLUX_IVAR', 'CAMERA', 'DELTA_X_ARCSEC', 'DELTA_Y_ARCSEC', 'XFOCAL', 'YFOCAL'), meta={'EXTNAME' : 'DITHER', 'TILEID' : '{}'.format(self._tileid)}) return tab
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def buildExposureTable(exposures, fields, instruments):\n name = []\n ra = []\n dec= []\n field= []\n inst = []\n airmass = []\n mjd = []\n exptime = []\n epoch = []\n apcorr = []\n index = 0\n for k,e in exposures.items():\n name.append(e.name)\n ra.append(getDegr...
[ "0.70176095", "0.6014823", "0.5961176", "0.5897251", "0.5735278", "0.57064164", "0.5697232", "0.5609351", "0.5595745", "0.5515109", "0.5511498", "0.5509595", "0.5412777", "0.5358326", "0.52642626", "0.5259989", "0.52551216", "0.5245346", "0.5239172", "0.52262944", "0.52035564...
0.7040096
0
Save exposure table to a FITS file.
def save(self, filename=None, overwrite=True): if filename is None: filename = self._output self._exposure_table.write(filename, overwrite=overwrite)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_as_fits(self, filename):", "def write(self, filename, **kwargs):\n self.to_table().write(filename, format='fits', **kwargs)", "def save_fits(df, fname):\n df = df.reset_index()\n outtable = Table.from_pandas(df)\n Path(fname).parent.mkdir(parents=True, exist_ok=True)\n outtable.writ...
[ "0.7418882", "0.73383343", "0.72863376", "0.70334315", "0.6764785", "0.6726204", "0.640871", "0.6325488", "0.63196474", "0.629019", "0.62887764", "0.62156135", "0.61818725", "0.613622", "0.61161315", "0.6057704", "0.6053205", "0.6028134", "0.6027796", "0.59942424", "0.5977483...
0.7322082
2
String representation of the exposure sequence.
def __str__(self): output = ['Tile ID {}'.format(self._tileid)] for ex, files in self._exposure_files.items(): filenames = '- exposure {:08d}\n'.format(ex) for f in files: filenames = '{} + {}\n'.format(filenames, f) output.append(filenames) return '\n'.join(output)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_string(self):\n return self.sequence", "def __str__(self):\n string = 'input dim: {} \\noutput dim: {} \\n'.format(\n self.dim_inputs, self.dim_outputs\n )\n string += 'sequence length: {} \\n'.format(\n self.tensors[0].shape[1]\n )\n key = '...
[ "0.72283626", "0.7040741", "0.67555356", "0.6664315", "0.6626783", "0.6547962", "0.65409464", "0.65346056", "0.6483022", "0.64496106", "0.6439818", "0.633267", "0.6277435", "0.62634873", "0.62428826", "0.6218749", "0.620363", "0.61781204", "0.6177901", "0.61686456", "0.615419...
0.70447665
1
Salt and hashes the password.
def set_password(self, password): self.password = md5crypt(password, gen_salt())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash_password(self, password):\n self.password = pwd_context.encrypt(password)", "def hash_password(self, password):\n salt = hashlib.sha256(os.urandom(60)).hexdigest().encode('ascii')\n pwdhash = hashlib.pbkdf2_hmac('sha256', password.encode('utf-8'), \n ...
[ "0.7726546", "0.76877874", "0.76764584", "0.75947", "0.7566996", "0.7513428", "0.74172544", "0.7408706", "0.7395221", "0.7364182", "0.7327813", "0.73232174", "0.7280142", "0.7258137", "0.72416675", "0.72343624", "0.72303843", "0.72061163", "0.72061163", "0.72061163", "0.72013...
0.6528625
74
Saves the ftp account.
def save(self, **kwargs): owner = str(self.vhost.domain.owner()) if not self.name.startswith(owner + '_'): self.name = owner + '_' + self.name try: super(Account, self).save(**kwargs) except IntegrityError: i = 1 base_name = self.name while True: self.name = base_name + '-' + str(i) try: super(Account, self).save(**kwargs) return except IntegrityError: i += 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_accounts(account):\n account.save_account()", "def save_accounts(account):\n account.save_account()", "def save_click(self):\n acc_name = self.name_entry.get()\n email = self.email_entry.get()\n username = self.user_entry.get()\n password = self.pass_entry.get()\n\n if not acc_nam...
[ "0.6917412", "0.6917412", "0.6715491", "0.6570291", "0.65482265", "0.62740266", "0.625781", "0.6185513", "0.60461766", "0.5973329", "0.5958735", "0.5941549", "0.5865786", "0.5791105", "0.57839775", "0.57787615", "0.5771968", "0.57635415", "0.5741722", "0.5736343", "0.572928",...
0.0
-1
Unicode representation for the ftp account.
def __unicode__(self): return unicode(self.name) + '@' + unicode(self.vhost)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getUniStr(self):\n return(\"%s/%s\"%(self.token.id,self.type))", "def __unicode__(self):\n # TODO: Curently this just stores/returns the file path.\n return unicode(self.path).encode('utf-8')", "def toString(self) -> unicode:\n ...", "def toString(self) -> unicode:\n ...", ...
[ "0.62673855", "0.6021327", "0.5987862", "0.5987862", "0.5913589", "0.5901801", "0.579293", "0.5770792", "0.573807", "0.5736912", "0.567259", "0.56630135", "0.5634768", "0.5624955", "0.56201947", "0.5554798", "0.55528706", "0.55185616", "0.54974395", "0.54740465", "0.546071", ...
0.5576632
15
Returns the correct ressource.
def utilization(user, ressource): if ressource == 'accounts': return Account.objects.filter(vhost__in=list(get_vhosts(user))).count() return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_resource(self):\n from rowgenerators import parse_app_url # Here, to break an import cycle\n\n self._resource = self._downloader.download(self.inner)\n\n\n ru = parse_app_url(self._resource.sys_path,\n downloader=self.downloader,\n sc...
[ "0.6944467", "0.67283875", "0.6657046", "0.66149676", "0.6538225", "0.6410846", "0.6354545", "0.6354545", "0.6349629", "0.6121578", "0.6104746", "0.6100484", "0.6100484", "0.6100484", "0.6100484", "0.6100484", "0.6100484", "0.6100484", "0.6060203", "0.6019287", "0.6013599", ...
0.0
-1
Returns true if the passed pcre regex matches
def match(tgt, opts=None, minion_id=None): if not opts: opts = __opts__ if not minion_id: minion_id = opts.get("id") return bool(re.match(tgt, minion_id))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_regex_match(s, pat):\n\n pat = pat.rstrip()\n m = re.search(Settings._REPAT, pat)\n if m:\n flags_combined = 0\n if m.group('flag'):\n char_to_flag = {\n 'A':re.A, 'I':re.I, 'L':re.L, 'M':re.M, 'S':re.S, 'X':re.X}\n for flag in list(m.group...
[ "0.7702972", "0.7421903", "0.73297775", "0.7058684", "0.69862247", "0.691478", "0.6872504", "0.6859625", "0.68152654", "0.67619383", "0.6750344", "0.6741106", "0.66436803", "0.656683", "0.6558872", "0.65424186", "0.64939934", "0.6461387", "0.6382901", "0.63667697", "0.6366188...
0.0
-1
A single training step
def train_step(x_batch, y_batch): feed_dict = { cnn.x: x_batch, cnn.y_: y_batch, step_time_placeholder : last_step_time, cnn.keep_prob : FLAGS.keep_prob } _, step, summaries, loss, accuracy = sess.run( [train_op, global_step, train_summary_op, cnn.cross_entropy, cnn.accuracy], feed_dict) time_str = datetime.datetime.now().isoformat() print("{}: step {}, loss {:g}, acc {:g}".format(time_str, step, loss, accuracy)) train_summary_writer.add_summary(summaries, step) train_summary_writer.flush()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_step(self):\n pass", "def TrainOneStep(self):\n pass", "def train(self, training_steps=10):", "def train():\n pass", "def training_step(self, **kwargs):\n raise NotImplementedError", "def train(self):\n pass", "def train(self):\n pass", "def train(self)...
[ "0.8901386", "0.88492393", "0.86054355", "0.83921003", "0.8233459", "0.8093186", "0.8093186", "0.8093186", "0.8093186", "0.8093186", "0.79063976", "0.78695196", "0.7857661", "0.7844479", "0.7824819", "0.78059494", "0.7790117", "0.7725741", "0.7722361", "0.7720089", "0.7710154...
0.7098244
62
Evaluates model on a dev set
def dev_step(x_batch, y_batch, writer=None): feed_dict = { cnn.x: x_batch, cnn.y_: y_batch, cnn.keep_prob : 1.0 } step, summaries, loss, accuracy = sess.run( [global_step, dev_summary_op, cnn.cross_entropy, cnn.accuracy], feed_dict) time_str = datetime.datetime.now().isoformat() print("{}: step {}, loss {:g}, acc {:g}".format(time_str, step, loss, accuracy)) if writer: writer.add_summary(summaries, step)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate():\n log.info('Loading dev data...')\n if args.version_2:\n dev_data = SQuAD('dev', version='2.0')\n else:\n dev_data = SQuAD('dev', version='1.1')\n (_, _), (data_file_name, _) \\\n = dev_data._data_file[dev_data._version][dev_data._segment]\n dev_data_path = os.pa...
[ "0.71378905", "0.6952982", "0.6932083", "0.6838927", "0.6826608", "0.68036103", "0.6793033", "0.67818105", "0.67691225", "0.67658705", "0.67651814", "0.6759437", "0.6751383", "0.6677337", "0.6666897", "0.6656296", "0.6651581", "0.65554637", "0.6541575", "0.6536319", "0.650750...
0.0
-1
The constructor for creating variables for each movie instance
def __init__(self, movie_title, movie_storyline, poster_image, trailer_youtube, imdb):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, movie_title, poster_image, trailer_youtube, movie_release_data, genre):\n # initialize instance of class Movie\n self.title = movie_title\n self.poster_image_url = poster_image\n self.trailer_youtube_url = trailer_youtube\n self.movie_release = movie_release_da...
[ "0.7917893", "0.77630234", "0.768874", "0.766575", "0.7634527", "0.75942045", "0.7591259", "0.758567", "0.75574154", "0.75566876", "0.7539566", "0.75183886", "0.7495097", "0.7468395", "0.7448158", "0.74143714", "0.7385076", "0.73837626", "0.7375816", "0.7372074", "0.7233329",...
0.77427244
2
Method for opening the trailer in user's browser using the 'webbrowser' module.
def show_trailer(self):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_browser(self):\n\n webbrowser.open(self.trailer_youtube_url)", "def show_trailer():\n webbrowser.open(self.trailer_url)", "def show_trailer(self):\n webbrowser.open(self.trailer_url)", "def show_trailer(self):\r\n webbrowser.open(self.trailer_youtube_url)", "def show_traile...
[ "0.81188226", "0.79440135", "0.7848126", "0.7815112", "0.77381235", "0.7584801", "0.754971", "0.754971", "0.754971", "0.75377965", "0.7463172", "0.7463172", "0.7463172", "0.7461554", "0.7461554", "0.7461554", "0.7461554", "0.7461554", "0.7461554", "0.7461554", "0.7461554", ...
0.0
-1
Returns source that matches the user provided source_id or display_name.
def ExtractMatchingSourceFromResponse(response, args): for source in response: if ((args.source and source.name.endswith(args.source)) or (args.source_display_name and source.displayName == args.source_display_name)): return source raise core_exceptions.Error( "Source: %s not found." % (args.source if args.source is not None else args.source_display_name))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_source(self, name):\n t = filter( lambda x: x.name==name, self.point_sources+self.extended_sources)\n return t[0] if len(t)==1 else None", "def get_source(source_name):\n if source_name == \"SCHOLAR_CENSUS\":\n from mec_data.source.scholar import ScholarSource\n\n return S...
[ "0.6412398", "0.6283802", "0.62611306", "0.6204275", "0.6198703", "0.6188179", "0.608557", "0.5972765", "0.5959811", "0.59588695", "0.594499", "0.58315796", "0.5799471", "0.57752895", "0.57598245", "0.57466704", "0.5684819", "0.5638011", "0.561176", "0.5592158", "0.55663866",...
0.64637303
0
Set up a template for creating new beamspot finders. Options can be configures via the config dict
def createBeamspotFinder(config=jobConfig, containerName = "VxPrimaryCandidate",suffix=""): import AthenaCommon.CfgMgr as CfgMgr from AthenaCommon.AppMgr import ToolSvc from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() # Extra options that may not be in default jobConfig if not 'MinVertexProb' in config: config['MinVertexProb'] = 0.01 if not 'MaxVtxChi2' in config: config['MaxVtxChi2'] = 100 if not 'FixParK' in config: config['FixParK'] = False if not 'MaxSigmaTr' in config: config['MaxSigmaTr'] = 100. if not 'MaxVtxErrTr' in config: config['MaxVtxErrTr'] = 100. if not 'OutlierChi2Tr' in config: config['OutlierChi2Tr'] = 50. InDetBeamSpotVertex = CfgMgr.InDet__InDetBeamSpotVertex(name= 'InDetBeamSpotVertex_'+containerName+suffix, VertexContainer = containerName, VertexTypes = config['VertexTypes'], MinTracksPerVtx = config['MinTracksPerVtx'], MinVtxNum = config['MinVtxNum'], MaxOutlierLoops = 30, OutlierMaxRejection = 30, OutlierWidthFail= 5.1e-3, # in mm OutlierRhoFail = 0.8, DoHists = doVertexHists, OutputLevel = min(INFO,config['outputlevel']), VertexTreeName = "Vertices_"+containerName+suffix, MinVertexProb = config['MinVertexProb'], MaxVtxChi2 = config['MaxVtxChi2'], MaxSigmaTr = config['MaxSigmaTr'] , MaxVtxErrTr = config['MaxVtxErrTr'] , OutlierChi2Tr = config['OutlierChi2Tr'] ) ToolSvc += InDetBeamSpotVertex # Will be automatically printed as part of InDetBeamSpotFinder printout # print ToolSvc.InDetBeamSpotVertex # from InDetBeamSpotFinder.InDetBeamSpotFinderConf import InDet__InDetBeamSpotDbWriterTool InDetBeamSpotDbWriterTool = CfgMgr.InDet__InDetBeamSpotDbWriterTool(name = 'InDetBeamSpotDbWriterTool_'+containerName+suffix, OutputLevel = min(INFO,config['outputlevel']), TreeName = "COOLBeamspot_"+containerName+suffix, Tag = containerName+suffix ) ToolSvc += InDetBeamSpotDbWriterTool print ToolSvc.InDetBeamSpotDbWriterTool #from InDetBeamSpotFinder.InDetBeamSpotFinderConf import InDet__InDetBeamSpotFinder as InDetBeamSpotFinder topSequence += CfgMgr.InDet__InDetBeamSpotFinder(name = 'InDetBeamSpotFinder_'+containerName+suffix, BeamSpotTool = InDetBeamSpotVertex, BeamSpotWriterTool = InDetBeamSpotDbWriterTool, MaxCount = config['MaxCount'], LumiRange = config['LumiRange'], LumiBlockRanges = config['LumiBlockRanges'], RunRange = config['RunRange'], EventRange = config['EventRange'], #ForceRunNumber = 52280, DoHists = doBeamspotHist, WriteDb = False, UseDefaultValues = True, #WriteFailed = True, Default_SigmaX = 30.0, Default_SigmaY = 30.0, Default_SigmaZ = 500.0, Default_SigmaXY = 0.0, OutputLevel = min(INFO,config['outputlevel']), BeamSpotRootName = "Beamspots_"+containerName+suffix ) try: topSequence.InDetBeamSpotFinder.UseLBFromViewed = config['UseLBFromViewed'] topSequence.InDetBeamSpotFinder.UseLBFromAccepted = config['UseLBFromAccepted'] except: print 'ERROR: You are using an older version of InDetBeamSpotFinder - please update to InDetBeamSpotFinder-01-00-29 or later' print topSequence.InDetBeamSpotFinder
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __setup_template(self):\n template = Template()\n template.add_description(\"Service VPC - used for services\")\n\n template.add_metadata({\n \"Build\": \"development\",\n \"DependsOn\": [],\n \"Environment\": \"ApiDev\",\n \"Revision\": \"develo...
[ "0.54952186", "0.5411151", "0.5359625", "0.53443027", "0.53443027", "0.52677274", "0.52394605", "0.52167094", "0.5214136", "0.5174137", "0.51633024", "0.5150547", "0.51282334", "0.5121639", "0.5080549", "0.5079729", "0.5071006", "0.5065138", "0.506349", "0.5042716", "0.503594...
0.5189562
9
>>> create_grid(4) [['0', '0', '0', '0'], ['0', '0', '0', '0'], ['0', '0', '0', '0'], ['0', '0', '0', '0']]
def create_grid(size): grid = [] for i in range(size): row = ['0']*size grid.append(row) return grid
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_grid(grid):\r\n for i in range(4):\r\n grid.append([0]*4)\r\n return grid", "def create_grid(grid):\r\n for i in range (4):\r\n grid.append ([])\r\n for j in range (4):\r\n grid[i].append (0)", "def create_grid(grid):\r\n inner = [0]*4\r\n for i in rang...
[ "0.89446443", "0.8844845", "0.88298595", "0.8797042", "0.84641975", "0.82472247", "0.8149008", "0.78898084", "0.7839033", "0.7772447", "0.7658475", "0.76574105", "0.76080716", "0.7555471", "0.75466675", "0.74476326", "0.7441377", "0.74026555", "0.7387294", "0.73625684", "0.73...
0.848049
4
Initializes the model trait.
def _model_default(self): return NamingTreeModel()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_model(self):\n pass", "def init_model(self):\n pass", "def initialize(self, model):\n pass", "def __init__(self, **kwargs):\n super(Model, self).__init__(**kwargs)", "def initialize(self) -> None:\n self.model = load(self.path)", "def __init__(self, model...
[ "0.84036934", "0.83105385", "0.8114287", "0.7524097", "0.74544305", "0.7413742", "0.7318616", "0.72427833", "0.719481", "0.719481", "0.71610886", "0.71610886", "0.71610886", "0.71610886", "0.7095571", "0.7049685", "0.69679695", "0.69345516", "0.69345516", "0.69345516", "0.693...
0.0
-1
Make sure that the specified node is visible.
def ensure_visible(self, node): try: components = node.namespace_name.split('/') # Make sure that the tree is expanded down to the context that # contains the node. binding = self.root for atom in components[:-1]: binding = binding.obj.lookup_binding(atom) self.expand(binding) # The context is expanded so we know that the node will be in the # node to Id map. wxid = self._node_to_id_map.get(self.model.get_key(node), None) self.control.EnsureVisible(wxid) # We need 'namespace_name' to make this work. If we don't have it # then we simply cannot do this! except OperationNotSupportedError: binding = None return binding
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ensure_visible(self):\n self.set_visible(True)", "def test_visibility(self):\r\n self.assertFalse(self.net.environment\\\r\n .are_visible(self.net.pos[self.node1],\r\n self.net.pos[self.node2]))\r\n self.assertTrue(self...
[ "0.6804122", "0.6494671", "0.6356905", "0.6340063", "0.63099027", "0.6276163", "0.62759423", "0.61556643", "0.61556643", "0.61108905", "0.6087162", "0.6059026", "0.6036995", "0.6013018", "0.5971871", "0.59257257", "0.58930624", "0.58760315", "0.58694416", "0.58317655", "0.578...
0.7291304
0
Method test the endpoint for getting bucketlist items
def test_get_bucketlist_items(self): email = "test@test.com" _pword = "test" user = User.query.filter_by(email=email).first() bucketlist = BucketList.query.filter_by(user_id=user.id, id=1).first() items_no = len(bucketlist.bucketlist_items) headers = self.authentication_headers(email=email, password=_pword) response = self.client.get( '/api/v1/bucketlist/1/items/', content_type="application/json", headers=headers, follow_redirects=True ) result = json.loads(response.data.decode('utf-8')) self.assertEqual(len(result), items_no)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_bucketlist_items(self):\n resp = self.client.post('/bucketlists',\n data=json.dumps(self.bucketlist),\n content_type=\"application/json\", headers={\n \"Authorization\": self.token\n ...
[ "0.8520477", "0.8132996", "0.7968485", "0.79678524", "0.7939482", "0.791598", "0.76777196", "0.76503426", "0.760791", "0.75708175", "0.7465317", "0.7436615", "0.7426375", "0.74000996", "0.7353851", "0.73192596", "0.73068476", "0.725187", "0.72268575", "0.7211199", "0.71193653...
0.84309566
1
Method test the endpoint for adding bucketlist item
def test_add_bucketlist_items(self): email = "test@test.com" _pword = "test" user = User.query.filter_by(email=email).first() bucketlist = BucketList.query.filter_by(user_id=user.id, name="test bucketlist").first() item_no = BucketListItem.query.filter_by(bucketlist_id=bucketlist.id).count() response = self.add_bucketlist_item(email, _pword, bucketlist.id, "bucketlist item name") result = json.loads(response.data.decode('utf-8')) self.assertEqual(response.status, '201 CREATED') self.assertEqual(result['message'], 'Bucket list item added') new_item_no = BucketListItem.query.filter_by(bucketlist_id=bucketlist.id).count() self.assertLess(item_no, new_item_no)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_bucketlist_item(self):\n resp = self.client.post('/bucketlists',\n data=json.dumps(self.bucketlist),\n content_type=\"application/json\", headers={\n \"Authorization\": self.token\n ...
[ "0.8470567", "0.8040441", "0.76671934", "0.7665731", "0.75571686", "0.7541412", "0.73769414", "0.7354037", "0.735012", "0.73247266", "0.73235244", "0.7313603", "0.7295238", "0.71595377", "0.7149308", "0.7145139", "0.71401936", "0.71109724", "0.7093405", "0.70680696", "0.69463...
0.84557176
1
Method tests that there can not be more than one bucketlist item added with the same name. We will use one of the already existing bucketlist names 'test item'
def test_fail_repeated_buckelist_item(self): user = User.query.filter_by(email="test@test.com").first() bucketlist = BucketList.query.filter_by(user_id=user.id, name="test bucketlist").first() item_no = BucketListItem.query.filter_by(bucketlist_id=bucketlist.id).count() response = self.add_bucketlist_item("test@test.com", "test", bucketlist.id, "test item") result = json.loads(response.data.decode('utf-8')) self.assertEqual(response.status, '409 CONFLICT') self.assertEqual(result['message'], 'Bucketlist Item Exists') new_item_no = BucketListItem.query.filter_by(bucketlist_id=bucketlist.id).count() self.assertEqual(item_no, new_item_no)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_duplicate_bucketlist_item(self):\n resp = self.client.post('/bucketlists',\n data=json.dumps(self.bucketlist),\n content_type=\"application/json\", headers={\n \"Authorization\": self.token\n ...
[ "0.8174513", "0.74510795", "0.74059886", "0.7099884", "0.7079807", "0.6917014", "0.68960243", "0.68957806", "0.6796505", "0.67483217", "0.6740296", "0.66837454", "0.66416943", "0.66326", "0.6624022", "0.65148836", "0.65080565", "0.64689416", "0.64585537", "0.6440524", "0.6424...
0.80040896
1
Method tests the end point for updating a bucket list item using put
def test_put_bucketlist_item(self): data = {"name": "bucketlist item name", "completed": "true"} email = "test@test.com" _pword = "test" user = User.query.filter_by(email=email).first() bucketlist = BucketList.query.filter_by(user_id=user.id, name="test bucketlist").first() item = BucketListItem.query.filter_by(bucketlist_id=bucketlist.id, id=1).first() self.assertNotEqual(item.name, "bucketlist item name") self.assertFalse(item.completed) response = self.put_bucketlist_item(email, _pword, bucketlist.id, 1, data) result = json.loads(response.data.decode('utf-8')) item2 = BucketListItem.query.filter_by(bucketlist_id=bucketlist.id, id=1).first() self.assertEqual(response.status, '201 CREATED') self.assertEqual(item2.name, "bucketlist item name") self.assertTrue(item2.completed)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_edit_bucketlist(self):\n post_data = self.post_a_bucket()\n self.assertEqual(post_data.status_code, 201)\n result_of_put_method = self.client().put(\n '/bucketlists/1',\n headers=dict(Authorization='Bearer '\n + self.token()\n ...
[ "0.8058875", "0.80090237", "0.7962996", "0.7944334", "0.7826577", "0.7747739", "0.7705827", "0.74234086", "0.7353868", "0.72529393", "0.7214844", "0.72071826", "0.7201491", "0.7160625", "0.71453685", "0.7111688", "0.71060103", "0.70663935", "0.69522905", "0.69248813", "0.6919...
0.8477841
0
Method tests the error raised when end point for updating a bucket list item using put contains the wrong id
def test_put_item_wrong_id(self): data = {"name": "bucketlist item name", "completed": "true"} email = "test@test.com" _pword = "test" user = User.query.filter_by(email=email).first() bucketlist = BucketList.query.filter_by(user_id=user.id, name="test bucketlist").first() item = BucketListItem.query.filter_by(bucketlist_id=bucketlist.id, id=0).first() self.assertFalse(item) response = self.put_bucketlist_item(email, _pword, bucketlist.id, 0, data) result = json.loads(response.data.decode('utf-8')) self.assertEqual(response.status, '404 NOT FOUND') self.assertEqual( result['message'], 'Bucketlist Item with ID {} not found in the database. You have requested this URI '\ '[/api/v1/bucketlist/1/items/0] but did you mean /api/v1/bucketlist/<int:bucketlist_id>/items/'\ ' or /api/v1/bucketlist/<int:bucketlist_id> or /api/v1/bucketlist ?'.format(0) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_id_of_bucket_to_be_edited_is_invalid(self):\n with self.client:\n # Get an auth token\n token = self.get_user_token()\n # Update the bucket name\n res = self.client.put(\n '/bucketlists/bucketid',\n headers=dict(Authorization...
[ "0.8020481", "0.7893578", "0.78514856", "0.7821233", "0.769216", "0.74274623", "0.74184465", "0.74172276", "0.7320262", "0.7253771", "0.7236808", "0.7163079", "0.7149734", "0.7134282", "0.7058692", "0.701769", "0.69915277", "0.6915926", "0.691373", "0.6895343", "0.68850976", ...
0.85060626
0