From 6f5686cee2bc6fb1027468f09cfc229b587204c4 Mon Sep 17 00:00:00 2001 From: Lie Ryan Date: Fri, 25 Nov 2022 18:59:31 +1100 Subject: [PATCH] Remove redundant call to _decode_data() In Python 3, ast always returns `str` here, and `_decode_data()` is basically no-op. --- rope/base/pyobjects.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/rope/base/pyobjects.py b/rope/base/pyobjects.py index f0929e9cc..820fc2d1b 100644 --- a/rope/base/pyobjects.py +++ b/rope/base/pyobjects.py @@ -1,4 +1,5 @@ -from rope.base.fscommands import _decode_data +from typing import Optional + from rope.base import ast, exceptions, utils @@ -224,13 +225,14 @@ def get_module(self): current_object = current_object.parent return current_object - def get_doc(self): + def get_doc(self) -> Optional[str]: if len(self.get_ast().body) > 0: expr = self.get_ast().body[0] if isinstance(expr, ast.Expr) and isinstance(expr.value, ast.Str): docstring = expr.value.s - coding = self.get_module().coding - return _decode_data(docstring, coding) + assert isinstance(docstring, str) + return docstring + return None def _get_defined_objects(self): if self.defineds is None: