Code analysis produces an "unused import" diagnostic for TensionState in this code:
[quote]
class TensionStatus(object):
from States import TensionState
def __init__(self):
self.state = self.TensionState.Off
[/quote]
However, this code does not produce the warning:
[quote]
from States import TensionState
class TensionStatus(object):
def __init__(self):
self.state = TensionState.Off
[/quote]
Both run correctly, but the second one adds an unneeded entry in the module's global name table.
In the case of the first example, changing the assignment to:
[quote] self.state = self.__class__.TensionState.Off[/quote]
does not remove the diagnostic. Similarly,
[quote] self.state = self.TensionStatus.TensionState.Off[/quote]
also does not remove the diagnostic.
I apologize, I was not aware of how to use the formatting commands and there is no preview function.
The first example should be:
{{{
class TensionStatus(object):
from States import TensionState
def __init__(self):
self.state = self.TensionState.Off
}}}
and the second should be:
{{{
from States import TensionState
class TensionStatus(object):
def __init__(self):
self.state = TensionState.Off
}}}
How embarrassing.