Skip to content

Commit

Permalink
property new checker
Browse files Browse the repository at this point in the history
  • Loading branch information
Carreau committed Oct 29, 2024
1 parent 8eea973 commit 0683bf0
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions lib/python/pyflyby/_autoimp.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ class _UseChecker:
An object that can check whether it was used.
"""

used: bool = False
_used: bool = False
name: str
source: str
lineno: int
Expand All @@ -355,9 +355,19 @@ def __init__(self, name: str, source: str, lineno: int):
self.name = name
self.source = source # generally an Import
self.lineno = lineno
logger.debug("Create _UseChecker : %r", self)

@property
def used(self) -> bool:
return self._used

@used.setter
def used(self, value: bool):
self._used = value
logger.debug("set used for %r to %r", self, value)

def __repr__(self):
return f"<{type(self).__name__}: name:{self.name} source:{self.source!r} lineno:{self.lineno} used:{self.used}>"
return f"<{type(self).__name__}: name:{self.name!r} source:{self.source!r} lineno:{self.lineno} used:{self.used}>"


class _MissingImportFinder:
Expand Down

0 comments on commit 0683bf0

Please sign in to comment.