Skip to content

Commit b149e19

Browse files
committed
Fixed bug in unitconversions._All._import_all() where self.__all__ wasn't always changed from None to an empty list before appending things to it.
1 parent 4581953 commit b149e19

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

labscript_utils/unitconversions/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,15 @@ class _All(object):
2626

2727
def __getitem__(self, ix):
2828
if self.__all__ is None:
29-
self.__all__ = []
3029
self._import_all()
3130
return self.__all__[ix]
3231

3332
def _import_all(self):
3433
"""imports all unit conversion classes in module within this subpackage into
3534
this module's globals. This is used only for backward compatibility with unit
3635
conversion classes that were not specified with a fully qualified name"""
36+
if self.__all__ is None:
37+
self.__all__ = []
3738
for filename in os.listdir(os.path.split(__file__)[0]):
3839
if filename.endswith('.py') and filename != '__init__.py':
3940
module = filename[:-3]

0 commit comments

Comments
 (0)