input
stringlengths 11
7.65k
| target
stringlengths 22
8.26k
|
---|---|
def emit(self, level, message):
raise NotImplementedError('Please implement an emit method') | def setTail(self, pt):
self.pt = pt
self.Tail.Eq(pt)
self.Head.setPoint(self.pt.x + self.x, self.pt.y + self.y) |
def emit(self, level, message):
raise NotImplementedError('Please implement an emit method') | def _get_selected_path(self):
"""
Helper function to get the selected path
@return Gtk.TreePath : returns exactly one path for the selected object
or None
"""
selection = self.get_selection()
if selection:
model, selected_paths = self.get_selection().get_selected_rows()
if selected_paths:
return selected_paths[0]
return None |
def emit(self, level, message):
raise NotImplementedError('Please implement an emit method') | def getHead(self):
return self.Head |
def emit(self, level, message):
raise NotImplementedError('Please implement an emit method') | def select_backend(self, backend_id=None):
"""
Selects the backend corresponding to backend_id.
If backend_id is none, refreshes the current configuration panel.
@param backend_id: the id of the backend to select
"""
selection = self.get_selection()
if backend_id in self.backendid_to_iter:
backend_iter = self.backendid_to_iter[backend_id]
if selection:
selection.select_iter(backend_iter)
else:
if self._get_selected_path():
# We just reselect the currently selected entry
self.on_select_row()
else:
# If nothing is selected, we select the first entry
if selection:
selection.select_path("0")
self.dialog.on_backend_selected(self.get_selected_backend_id()) |
def emit(self, level, message):
raise NotImplementedError('Please implement an emit method') | def getTail(self):
return self.Tail |
def emit(self, level, message):
raise NotImplementedError('Please implement an emit method') | def drawMe(self, g):
self.g = g
self.g.beginPath()
self.g.moveTo(self.p1.x,self.p1.y)
self.g.lineTo(self.p2.x,self.p2.y)
self.g.stroke() |
def emit(self, level, message):
raise NotImplementedError('Please implement an emit method') | def test(self):
return ("this is pure test to Inherit") |
def emit(self, level, message):
raise NotImplementedError('Please implement an emit method') | def __init__(self, p1, p2):
self.p1 = p1
self.p2 = p2
self.length = math.sqrt(math.pow((self.p2.x - self.p1.x), 2) + math.pow((self.p2.y - self.p1.y), 2)) |
def emit(self, level, message):
raise NotImplementedError('Please implement an emit method') | def drawMe(self, g):
self.g = g
hole = 5
radius = 10
length = self.getR()
# alert(length)
# 儲存先前的繪圖狀態
self.g.save()
self.g.translate(self.p1.x,self.p1.y)
#alert(str(self.p1.x)+","+str(self.p1.y))
#self.g.rotate(-((math.pi/2)-self.getT()))
self.g.rotate(-math.pi*0.5 + self.getT())
#alert(str(self.getT()))
#self.g.rotate(10*math.pi/180)
#this.g.rotate(-(Math.PI/2-this.getT()));
# 必須配合畫在 y 軸上的 Link, 進行座標轉換, 也可以改為畫在 x 軸上...
self.g.beginPath()
self.g.moveTo(0,0)
self.g.arc(0, 0, hole, 0, 2*math.pi, true)
self.g.stroke()
self.g.moveTo(0,length)
self.g.beginPath()
self.g.arc(0,length, hole, 0, 2*math.pi, true)
self.g.stroke()
self.g.moveTo(0,0)
self.g.beginPath()
self.g.arc(0,0, radius, 0, math.pi, true)
self.g.moveTo(0+radius,0)
self.g.lineTo(0+radius,0+length)
self.g.stroke()
self.g.moveTo(0,0+length)
self.g.beginPath()
self.g.arc(0, 0+length, radius, math.pi, 0, true)
self.g.moveTo(0-radius,0+length)
self.g.lineTo(0-radius,0)
self.g.stroke()
self.g.restore() |
def emit(self, level, message):
raise NotImplementedError('Please implement an emit method') | def __init__(self, p1, p2, p3):
self.p1 = p1
self.p2 = p2
self.p3 = p3 |
def emit(self, level, message):
raise NotImplementedError('Please implement an emit method') | def getLenp3(self):
p1 = self.p1
ret = p1.distance(self.p2)
return ret |
def emit(self, level, message):
raise NotImplementedError('Please implement an emit method') | def getLenp1(self):
p2 = self.p2
ret = p2.distance(self.p3)
return ret |
def emit(self, level, message):
raise NotImplementedError('Please implement an emit method') | def getLenp2(self):
p1 = self.p1
ret = p1.distance(self.p3)
return ret |
def emit(self, level, message):
raise NotImplementedError('Please implement an emit method') | def getAp1(self):
ret = math.acos(((self.getLenp2() * self.getLenp2() + self.getLenp3() * self.getLenp3()) - self.getLenp1() * self.getLenp1()) / (2* self.getLenp2() * self.getLenp3()))
return ret |
def emit(self, level, message):
raise NotImplementedError('Please implement an emit method') | def getAp2(self):
ret =math.acos(((self.getLenp1() * self.getLenp1() + self.getLenp3() * self.getLenp3()) - self.getLenp2() * self.getLenp2()) / (2* self.getLenp1() * self.getLenp3()))
return ret |
def emit(self, level, message):
raise NotImplementedError('Please implement an emit method') | def getAp3(self):
ret = math.acos(((self.getLenp1() * self.getLenp1() + self.getLenp2() * self.getLenp2()) - self.getLenp3() * self.getLenp3()) / (2* self.getLenp1() * self.getLenp2()))
return ret |
def emit(self, level, message):
raise NotImplementedError('Please implement an emit method') | def drawMe(self, g):
self.g = g
r = 5
# 繪出三個頂點
self.p1.drawMe(self.g,r)
self.p2.drawMe(self.g,r)
self.p3.drawMe(self.g,r)
line1 = Line(self.p1,self.p2)
line2 = Line(self.p1,self.p3)
line3 = Line(self.p2,self.p3)
# 繪出三邊線
line1.drawMe(self.g)
line2.drawMe(self.g)
line3.drawMe(self.g) |
def emit(self, level, message):
raise NotImplementedError('Please implement an emit method') | def setSSS(self, lenp3, lenp1, lenp2):
self.lenp3 = lenp3
self.lenp1 = lenp1
self.lenp2 = lenp2
self.ap1 = math.acos(((self.lenp2 * self.lenp2 + self.lenp3 * self.lenp3) - self.lenp1 * self.lenp1) / (2* self.lenp2 * self.lenp3))
self.ap2 = math.acos(((self.lenp1 * self.lenp1 + self.lenp3 * self.lenp3) - self.lenp2 * self.lenp2) / (2* self.lenp1 * self.lenp3))
self.ap3 = math.acos(((self.lenp1 * self.lenp1 + self.lenp2 * self.lenp2) - self.lenp3 * self.lenp3) / (2* self.lenp1 * self.lenp2)) |
def emit(self, level, message):
raise NotImplementedError('Please implement an emit method') | def setSAS(self, lenp3, ap2, lenp1):
self.lenp3 = lenp3
self.ap2 = ap2
self.lenp1 = lenp1
self.lenp2 = math.sqrt((self.lenp3 * self.lenp3 + self.lenp1 * self.lenp1) - 2* self.lenp3 * self.lenp1 * math.cos(self.ap2))
#等於 SSS(AB, BC, CA) |
def emit(self, level, message):
raise NotImplementedError('Please implement an emit method') | def setSaSS(self, lenp2, lenp3, lenp1):
self.lenp2 = lenp2
self.lenp3 = lenp3
self.lenp1 = lenp1
if(self.lenp1 > (self.lenp2 + self.lenp3)):
#<CAB 夾角為 180 度, 三點共線且 A 介於 BC 之間
ret = math.pi
else :
# <CAB 夾角為 0, 三點共線且 A 不在 BC 之間
if((self.lenp1 < (self.lenp2 - self.lenp3)) or (self.lenp1 < (self.lenp3 - self.lenp2))):
ret = 0.0
else :
# 透過餘絃定理求出夾角 <CAB
ret = math.acos(((self.lenp2 * self.lenp2 + self.lenp3 * self.lenp3) - self.lenp1 * self.lenp1) / (2 * self.lenp2 * self.lenp3))
return ret |
def emit(self, level, message):
raise NotImplementedError('Please implement an emit method') | def getSSS(self):
temp = []
temp.append( self.getLenp1() )
temp.append( self.getLenp2() )
temp.append( self.getLenp3() )
return temp |
def emit(self, level, message):
raise NotImplementedError('Please implement an emit method') | def getAAA(self):
temp = []
temp.append( self.getAp1() )
temp.append( self.getAp2() )
temp.append( self.getAp3() )
return temp |
def emit(self, level, message):
raise NotImplementedError('Please implement an emit method') | def getASASAS(self):
temp = []
temp.append(self.getAp1())
temp.append(self.getLenp1())
temp.append(self.getAp2())
temp.append(self.getLenp2())
temp.append(self.getAp3())
temp.append(self.getLenp3())
return temp |
def emit(self, level, message):
raise NotImplementedError('Please implement an emit method') | def setPPSS(self, p1, p3, lenp1, lenp3):
temp = []
self.p1 = p1
self.p3 = p3
self.lenp1 = lenp1
self.lenp3 = lenp3
#bp3 is the angle beside p3 point, cp3 is the angle for line23, p2 is the output
line31 = Line(p3, p1)
self.lenp2 = line31.getR()
#self.lenp2 = self.p3.distance(self.p1)
#這裡是求角3
ap3 = math.acos(((self.lenp1 * self.lenp1 + self.lenp2 * self.lenp2) - self.lenp3 * self.lenp3) / (2 * self.lenp1 * self.lenp2))
#ap3 = math.acos(((self.lenp1 * self.lenp1 + self.lenp3 * self.lenp3) - self.lenp2 * self.lenp2) / (2 * self.lenp1 * self.lenp3))
bp3 = line31.getT()
cp3 = bp3 - ap3
temp.append(p3.x + self.lenp1*math.cos(cp3))#p2.x
temp.append(p3.y + self.lenp1*math.sin(cp3))#p2.y
return temp |
def emit(self, level, message):
raise NotImplementedError('Please implement an emit method') | def draw():
global theta
context.clearRect(0, 0, canvas.width, canvas.height)
line1.drawMe(context)
line2.drawMe(context)
line3.drawMe(context)
#triangle1.drawMe(context)
#triangle2.drawMe(context)
theta += dx
p2.x = p1.x + line1.length*math.cos(theta*degree)
p2.y = p1.y - line1.length*math.sin(theta*degree)
p3.x, p3.y = triangle2.setPPSS(p2,p4,link2_len,link3_len)
p1.tag(context) |
def emit(self, level, message):
raise NotImplementedError('Please implement an emit method') | def __init__(self, store):
self.store = store |
def emit(self, level, message):
raise NotImplementedError('Please implement an emit method') | def __init__(self, name):
self._name = name |
def emit(self, level, message):
raise NotImplementedError('Please implement an emit method') | def __init__(self, x, y):
self.x = x
self.y = y |
def emit(self, level, message):
raise NotImplementedError('Please implement an emit method') | def __init__(self, action: str = None) -> None:
super().__init__(prefix, action) |
def emit(self, level, message):
raise NotImplementedError('Please implement an emit method') | def draw(self, context):
pass |
def emit(self, level, message):
raise NotImplementedError('Please implement an emit method') | def conversion_fn():
"""Temporary function."""
pass |
def emit(self, level, message):
raise NotImplementedError('Please implement an emit method') | def _files(self):
return [] |
def emit(self, level, message):
raise NotImplementedError('Please implement an emit method') | def no_op(*args, **kwargs):
pass |
def emit(self, level, message):
raise NotImplementedError('Please implement an emit method') | def open(read_server_info=True):
return |
def emit(self, level, message):
raise NotImplementedError('Please implement an emit method') | def query_vpp_config(self):
NotImplemented |
def emit(self, level, message):
raise NotImplementedError('Please implement an emit method') | def tag(g, p):
None |
def emit(self, level, message):
raise NotImplementedError('Please implement an emit method') | def vsParseFd(self, fd):
raise NotImplementedError() |
def emit(self, level, message):
raise NotImplementedError('Please implement an emit method') | def test_should_encode_false(self):
encoded = cypher_repr(False)
assert encoded == u"false" |