本文整理汇总了Python中location.Location方法的典型用法代码示例。如果您正苦于以下问题:Python location.Location方法的具体用法?Python location.Location怎么用?Python location.Location使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类location
的用法示例。
在下文中一共展示了location.Location方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _fill_end
# 需要导入模块: import location [as 别名]
# 或者: from location import Location [as 别名]
def _fill_end(self, cursor, stack_parent=None):
if self.is_block_stmt() or self.is_root():
if stack_parent[-1].kind is clang.cindex.CursorKind.IF_STMT:
# get end_stmt of his parent "if" for "else if" stmt
self.end_stmt = stack_parent[-1].end_stmt
else:
# create new end_stmt
end_location = Location(cursor.extent.end)
self.end_stmt = FakeStatement("end " + self.name, begin_stmt=self, location=end_location)
self.begin_stmt = self
self.end_stmt.end_stmt = self.end_stmt
else:
# non-block, end and begin will ref in same stmt
self.begin_stmt = self
self.end_stmt = self
if not self.is_root():
# TODO optimise this stack_parent
# add stmt on stack, ignore if root, because already in stack
if self.is_block_stmt():
stack_parent.append(self)
示例2: __init__
# 需要导入模块: import location [as 别名]
# 或者: from location import Location [as 别名]
def __init__(self, cursor, filename=None, store_variable=True):
super(ASTObject, self).__init__()
# cursor information
self.name = cursor.spelling
self.spelling = cursor.spelling
self.name_tmpl = cursor.displayname
self.location = Location(cursor.location)
self._kind_id = cursor.kind.value
self.mangled_name = cursor.mangled_name
self._access_specifier = cursor.access_specifier.value
self.type = cursor.type.spelling
self._kind_type_id = cursor.type.kind.value
self.file_name = filename if filename else self.location.file.name
self.variable = ASTObject.get_variables(cursor) if store_variable else []
self.count_variable = len(self.variable)
self.keywords = None
示例3: __doPath
# 需要导入模块: import location [as 别名]
# 或者: from location import Location [as 别名]
def __doPath(self):
locations = []
locations.append(self.start)
if self.end is not None:
d = self.start.distance(self.end)
nSteps = int(d / self.speed)
# print(d)
# print(nSteps)
if nSteps > 0:
dStepLon = (self.end.longitude - self.start.longitude) / nSteps
dStepLat = (self.end.latitude - self.start.latitude) / nSteps
for x in xrange(int(nSteps) - 1):
rLon = (x + 1) * dStepLon + self.start.longitude
rLat = (x + 1) * dStepLat + self.start.latitude
nLocation = Location(rLat,rLon)
locations.append(nLocation)
self.locations = locations
示例4: __init__
# 需要导入模块: import location [as 别名]
# 或者: from location import Location [as 别名]
def __init__(self, *args, **kwargs):
super(ParentStatement, self).__init__()
self.description = ""
self.before_stmt = {}
self.next_stmt = {}
self.begin_stmt = None
self.end_stmt = None
self.dom_next_stmt = set()
self.dom_parent_stmt = None
self.post_dom_next_stmt = set()
self.post_dom_parent_stmt = None
self._is_condition = False
self.method_obj = None
self.name = ""
self.location = Location(None)
self.result_has_from_recursive = None
self.order_id = -1
self.operator_variable = None
self.stmt_child = []
self.control = control.ControlDependency(self)
示例5: __init__
# 需要导入模块: import location [as 别名]
# 或者: from location import Location [as 别名]
def __init__(self):
self.computer = computer.Computer()
self.ai = naturalLanguage.NaturalLanguage()
self.speech = googlespeech.GoogleSpeech()
self.weather = weather.Weather()
self.location = location.Location()
self.formatter = f.Formatter()
self.phrase = self.computer.say_hello()
self.start_up = True
self.prob_threshold = .90
# Set up the window
self.window = tkinter.Tk()
self.frame = tkinter.Frame(self.window, bg="black", height=50)
self.window.minsize(width=300, height=500)
self.window.maxsize(width=300, height=500)
# canvas for computer image
self.canvas = tkinter.Canvas(self.window, bg="black", height=350, bd=0)
self.canvas.create_oval(100, 125, 200, 225, fill="red")
phrase = tkinter.StringVar()
phrase.set(self.phrase)
self.text = tkinter.Label(self.frame, bg="black", fg="green", height=5, textvariable=phrase, wraplength=300)
# add widgets
self.listen_button = tkinter.Button(self.frame, text="Press to speak to HAL", bg="black",
command=self.listening)
# pack into the frame
self.text.pack(side="top", fill="both")
self.listen_button.pack(side="bottom", fill='x')
self.canvas.pack(side="top", fill="both", expand=True)
self.frame.pack(side="bottom", fill="both")
self.get_username()
self.window.mainloop()
示例6: __init__
# 需要导入模块: import location [as 别名]
# 或者: from location import Location [as 别名]
def __init__(self):
"""
Constructs a weather object with the disclaimer from Dark Sky
"""
self.disclaimer = "Powered by Dark Sky - https://darksky.net/poweredby/"
self.location = location.Location()
self.formatter = f.Formatter()
示例7: as_direction
# 需要导入模块: import location [as 别名]
# 或者: from location import Location [as 别名]
def as_direction(dct):
return Direction(Location(dct['latitude'],dct['longitude']), dct['speed'])
示例8: getDirection
# 需要导入模块: import location [as 别名]
# 或者: from location import Location [as 别名]
def getDirection(self, placemark):
speed = self.__getSpeed(placemark)
latitude = self.__getLatitude(placemark)
longitude = self.__getLongitude(placemark)
# name = self.__getName(placemark)
# print(name)
# print(speed)
# print(latitude)
# print(longitude)
direction = Direction(Location(latitude, longitude), speed)
return direction