File deps.py changed (mode: 100755) (index 6483943..bfb0dff) |
... |
... |
class function: |
74 |
74 |
self.importedBy = [] |
self.importedBy = [] |
75 |
75 |
self._exportCounter = 0 |
self._exportCounter = 0 |
76 |
76 |
self._importCounter = 0 |
self._importCounter = 0 |
|
77 |
|
self._selfImportCounter = 0 |
77 |
78 |
self._mod = None |
self._mod = None |
78 |
79 |
def remove(self): |
def remove(self): |
79 |
80 |
for mod in self.importedBy: |
for mod in self.importedBy: |
80 |
81 |
mod.remImport(self) |
mod.remImport(self) |
81 |
82 |
self._mod.remExport(self) |
self._mod.remExport(self) |
82 |
83 |
def addImport(self, mod): |
def addImport(self, mod): |
83 |
|
self._importCounter += 1 |
|
|
84 |
|
if mod == self: |
|
85 |
|
self._selfImportCounter += 1 |
|
86 |
|
else: |
|
87 |
|
self._importCounter += 1 |
84 |
88 |
self.importedBy += [mod] |
self.importedBy += [mod] |
85 |
89 |
def addExport(self, mod): |
def addExport(self, mod): |
86 |
90 |
assert self._mod is None, ("%s: %s & %s" % |
assert self._mod is None, ("%s: %s & %s" % |
|
... |
... |
class function: |
92 |
96 |
def isSystem(self): |
def isSystem(self): |
93 |
97 |
return self._exportCounter == 0 and self._importCounter > 0 |
return self._exportCounter == 0 and self._importCounter > 0 |
94 |
98 |
def isUnused(self): |
def isUnused(self): |
95 |
|
return self._exportCounter > 0 and self._importCounter == 0 |
|
|
99 |
|
return self._exportCounter > 0 \ |
|
100 |
|
and self._importCounter - self._selfImportCounter == 0 |
96 |
101 |
def belongsTo(self, mod): |
def belongsTo(self, mod): |
97 |
102 |
return self._mod == mod |
return self._mod == mod |
98 |
103 |
def getMod(self): |
def getMod(self): |