当前位置: 首页>>代码示例>>Python>>正文


Python location.Location方法代码示例

本文整理汇总了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) 
开发者ID:mathben,项目名称:python_clang_parser,代码行数:23,代码来源:statement.py

示例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 
开发者ID:mathben,项目名称:python_clang_parser,代码行数:19,代码来源:ast_object.py

示例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 
开发者ID:Xustyx,项目名称:RouteSimulator,代码行数:25,代码来源:path.py

示例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) 
开发者ID:mathben,项目名称:python_clang_parser,代码行数:29,代码来源:statement.py

示例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() 
开发者ID:brandenk514,项目名称:hal,代码行数:38,代码来源:app.py

示例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() 
开发者ID:brandenk514,项目名称:hal,代码行数:9,代码来源:weather.py

示例7: as_direction

# 需要导入模块: import location [as 别名]
# 或者: from location import Location [as 别名]
def as_direction(dct):
    return Direction(Location(dct['latitude'],dct['longitude']), dct['speed']) 
开发者ID:Xustyx,项目名称:RouteSimulator,代码行数:4,代码来源:simpleroute.py

示例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 
开发者ID:Xustyx,项目名称:RouteSimulator,代码行数:16,代码来源:routeparser.py


注:本文中的location.Location方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。