class Folder:
def copy_files_with(self, extension: str, to_location: Folder):
pass
def __eq__(self, other):
if isinstance(other, Folder):
return (self._parent, self._subdirectory) == (other._parent, other._subdirectory)
return NotImplemented
def __hash__(self):
return hash((self._parent, self._subdirectory))
I'm using Visual Studio code with PyLint
and it returns an error with the copy_files_with
method.
line 20, in Folder
def copy_files_with(self, extension: str, to_location: Folder)
I removed all the unnecessary code, but line 20 is where the method copy_files_with
is located.
I don't understand why, the __eq__
method can see the Folder
class in the isinstance
call. I want the to_location
to be a Folder
, and I want to specify that in the type hint, how do I do this?