def get_outline(self, request): contents = request['contents'] translation_unit = self._update_translation_unit(contents) if not translation_unit: return None return outline.get_outline(self.custom_clang_lib, translation_unit, contents)
def process_request(self, line): start_time = time.time() req = json.loads(line) id, data = req['id'], req['args'] method = req['method'] res = {'protocol': 'python_language_service', 'type': 'response', 'id': id} try: if method == 'get_completions': res['result'] = self.get_completions(self.make_script(data)) elif method == 'get_definitions': res['result'] = self.get_definitions(self.make_script(data)) elif method == 'get_references': res['result'] = self.get_references(self.make_script(data)) elif method == 'get_outline': res['result'] = outline.get_outline(self.src, data['contents']) # Allow deferred injection of additional paths elif method == 'add_paths': self.sys_path = self.sys_path + data['paths'] res['result'] = self.sys_path else: res['type'] = 'error-response' res['error'] = 'Unknown method to jediserver.py: %s.' % method # Catch and ignore KeyErrors from jedi # See https://github.com/davidhalter/jedi/issues/590 except KeyError: res['result'] = [] except: res['type'] = 'error-response' res['error'] = traceback.format_exc() self.logger.info('Finished %s request in %.2lf seconds.', method, time.time() - start_time) return res
def process_request(self, line): start_time = time.time() req = json.loads(line) id, data = req['id'], req['args'] method = req['method'] res = {'type': 'response', 'id': id, 'result': {}} try: if method == 'get_completions': res['result']['completions'] = self.get_completions( self.make_script(data)) elif method == 'get_definitions': res['result']['definitions'] = self.get_definitions( self.make_script(data)) elif method == 'get_references': res['result']['references'] = self.get_references( self.make_script(data)) elif method == 'get_outline': res['result']['items'] = outline.get_outline( self.src, data['contents']) else: res['type'] = 'error-response' del res['result'] res['error'] = 'Unknown method to jediserver.py: %s.' % method except: res['type'] = 'error-response' del res['result'] res['error'] = traceback.format_exc() self.logger.info('Finished %s request in %.2lf seconds.', method, time.time() - start_time) return res
def process_request(self, line): start_time = time.time() req = json.loads(line) id, data = req['id'], req['args'] method = req['method'] res = {'type': 'response', 'id': id, 'result': {}} try: if method == 'get_completions': res['result']['completions'] = self.get_completions(self.make_script(data)) elif method == 'get_definitions': res['result']['definitions'] = self.get_definitions(self.make_script(data)) elif method == 'get_references': res['result']['references'] = self.get_references(self.make_script(data)) elif method == 'get_outline': res['result']['items'] = outline.get_outline(self.src, data['contents']) else: del res['result'] res['error'] = 'Unknown method to jediserver.py: %s.' % method except: del res['result'] res['error'] = traceback.format_exc() self.logger.info('Finished %s request in %.2lf seconds.', method, time.time() - start_time) return res
def get_outline(self, request, response): contents = request['contents'] flags = request['flags'] translation_unit = self._update_translation_unit(contents, flags) if not translation_unit: return response['outline'] = outline.get_outline(translation_unit, self.src)
def get_outline(self, request): contents = request['contents'] flags = request['flags'] translation_unit = self._update_translation_unit(contents, flags) if not translation_unit: return None return outline.get_outline(translation_unit, self.src)
def process_request(self, line): start_time = time.time() req = json.loads(line) id, data = req['id'], req['args'] method = req['method'] res = {'type': 'response', 'id': id} try: if method == 'get_completions': res['result'] = self.get_completions(self.make_script(data)) elif method == 'get_definitions': res['result'] = self.get_definitions(self.make_script(data)) elif method == 'get_references': res['result'] = self.get_references(self.make_script(data)) elif method == 'get_outline': res['result'] = outline.get_outline(self.src, data['contents']) # Allow deferred injection of additional paths elif method == 'add_paths': self.sys_path = self.sys_path + data['paths'] res['result'] = self.sys_path else: res['type'] = 'error-response' res['error'] = 'Unknown method to jediserver.py: %s.' % method # Catch and ignore KeyErrors from jedi # See https://github.com/davidhalter/jedi/issues/590 except KeyError: res['result'] = [] except: res['type'] = 'error-response' res['error'] = traceback.format_exc() self.logger.info('Finished %s request in %.2lf seconds.', method, time.time() - start_time) return res
def process_request(self, line): start_time = time.time() req = json.loads(line) id, data = req['id'], req['args'] method = req['method'] res = {'protocol': 'python_language_service', 'type': 'response', 'id': id} try: if method == 'get_completions': res['result'] = self.get_completions(self.make_script(data)) elif method == 'get_definitions': res['result'] = self.get_definitions(self.make_script(data)) elif method == 'get_references': res['result'] = self.get_references(self.make_script(data)) elif method == 'get_outline': res['result'] = outline.get_outline(data['src'], data['contents']) elif method == 'get_hover': res['result'] = self.get_hover(self.make_script(data), data['word']) else: res['type'] = 'error-response' res['error'] = 'Unknown method to jediserver.py: %s.' % method # Catch and ignore KeyErrors from jedi # See https://github.com/davidhalter/jedi/issues/590 except KeyError: res['result'] = [] except Exception: res['type'] = 'error-response' res['error'] = traceback.format_exc() self.logger.info('Finished %s request for %s in %.2lf seconds.', method, data.get('src'), time.time() - start_time) return res
def make_images(self,image): self.angle = (self.angle-self.rotation_speed)%360 self.image = pg.transform.rotozoom(image,self.angle,1) self.rect = self.image.get_rect(center=(50,50)) raw = pg.transform.smoothscale(image,(300,300)) raw = pg.transform.rotozoom(raw,self.angle,1) self.out = get_outline(raw,color=(255,0,0),threshold=100) self.out_rect = self.out.get_rect(center=self.screen_rect.center)
def get_outline(self, request, response): contents = request['contents'] flags = request['flags'] # Note that this does /not/ update the translation unit. # This is intentional, as we do not want to block autocomplete. translation_unit = self._get_translation_unit(contents, flags) if not translation_unit: return response['outline'] = outline.get_outline(translation_unit, self.src)
def process_request(self, line): start_time = time.time() req = json.loads(line) id, data = req['id'], req['args'] method = req['method'] res = {'protocol': 'python_language_service', 'type': 'response', 'id': id} try: if method == 'get_completions': res['result'] = self.get_completions(self.make_script(data)) elif method == 'get_definitions': res['result'] = self.get_definitions(self.make_script(data)) elif method == 'get_references': res['result'] = self.get_references(self.make_script(data)) elif method == 'get_outline': res['result'] = outline.get_outline(data['src'], data['contents']) elif method == 'get_hover': res['result'] = self.get_hover(self.make_script(data), data['word']) elif method == 'get_signature_help': res['result'] = self.get_signature_help(self.make_script(data)) else: res['type'] = 'error-response' res['error'] = 'Unknown method to jediserver.py: %s.' % method # Catch and ignore KeyErrors from jedi # See https://github.com/davidhalter/jedi/issues/590 except KeyError as e: self.logger.warn('Got KeyError exception %s', e) res['result'] = None except Exception: res['type'] = 'error-response' res['error'] = traceback.format_exc() self.logger.info('Finished %s request for %s in %.2lf seconds.', method, data.get('src'), time.time() - start_time) return res
def get_outline(self, request): contents = request['contents'] translation_unit = self._update_translation_unit(contents) if not translation_unit: return None return outline.get_outline(self.custom_clang_lib, translation_unit)
def get_outline(self, request): contents = request['contents'] translation_unit = self._update_translation_unit(contents) if not translation_unit: return None return outline.get_outline(translation_unit, self.src)