Locally import Contract to resolve pylint

in `Function.interface_signature_str`
pull/1730/head
webthethird 2 years ago
parent 289bd49c3e
commit 5a25c81a52
  1. 6
      slither/core/declarations/function.py

@ -1011,8 +1011,10 @@ class Function(SourceMapping, metaclass=ABCMeta): # pylint: disable=too-many-pu
Return the function interface as a str (contains the return values) Return the function interface as a str (contains the return values)
Returns None if the function is private or internal, or is a constructor/fallback/receive Returns None if the function is private or internal, or is a constructor/fallback/receive
""" """
from slither.core.declarations.contract import Contract
if self._interface_signature_str is None: if self._interface_signature_str is None:
name, parameters, returnVars = self.signature name, parameters, return_vars = self.signature
visibility = self.visibility visibility = self.visibility
if ( if (
visibility in ["private", "internal"] visibility in ["private", "internal"]
@ -1033,7 +1035,7 @@ class Function(SourceMapping, metaclass=ABCMeta): # pylint: disable=too-many-pu
self._interface_signature_str = ( self._interface_signature_str = (
name + "(" + ",".join(parameters) + ") external" + payable + pure + view name + "(" + ",".join(parameters) + ") external" + payable + pure + view
) )
if len(returnVars) > 0: if len(return_vars) > 0:
self._interface_signature_str += " returns (" + ",".join(returns) + ")" self._interface_signature_str += " returns (" + ",".join(returns) + ")"
return self._interface_signature_str return self._interface_signature_str

Loading…
Cancel
Save