Skip to content

Fixed bug in unitconversions._All._import_all() #74

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 10, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion labscript_utils/unitconversions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@ class _All(object):

def __getitem__(self, ix):
if self.__all__ is None:
self.__all__ = []
self._import_all()
return self.__all__[ix]

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