Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12231

Python autocomplete doesn't work with inheritance

$
0
0

So i'm trying to implement inheritance in python with a class that has some abstracts methods.

I created my class following this doc, and added some abstract methods.

from abc import ABC, abstractmethodclass RemoteClient(ABC):    def __init__(self) -> None:        super().__init__()    @classmethod    @abstractmethod    def get_file_content(self):        pass

Then i create my child class :

class LocalRemoteClient(RemoteClient):    def __init__(self, local_path) -> None:        super().__init__()        self.local_path=local_path    def get_file_content(self, path_from_root):        fp = self.get_path(path_from_root)        with open(fp, "r") as f:            content = base64.b64encode(f.buffer.read()).decode()            return content

Here, when implementing 'get_file_content', i have absolutely no type hinting, autocompletes, etc...

I m using vscode, and a .venv environnement.

I have the followings extensions in vscode : Python, Pylance, Python debugger.

What can i do to get helps from IDE with these inheritance cases ? Btw autocompletion and everything works fine with everything else.


Viewing all articles
Browse latest Browse all 12231

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>