Skip to content

Commit

Permalink
Merge pull request #63 from enthought/fix/clean-up-nameerrors
Browse files Browse the repository at this point in the history
BUG: Clean up NameErrors.
  • Loading branch information
rkern committed Oct 4, 2018
2 parents a8920ce + a44d529 commit 2f3b7ff
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
5 changes: 3 additions & 2 deletions scimath/physical_quantities/units.py
Expand Up @@ -12,6 +12,7 @@
#from traitsui.api import View, Item, Group

from .dimensions import Dimensions, Dim
from .util import dict_add, dict_sub, dict_mul, format_expansion, unicode_powers


class Unit(HasTraits):
Expand Down Expand Up @@ -249,7 +250,7 @@ class DerivedUnit(MultiplicativeUnit):
def get_symbol(self):
return format_expansion(dict((key.symbol, power)
for key, power in self.derivation.items()),
mul=" ", pow_func=unicode_power, div=True)
mul=" ", pow_func=unicode_powers, div=True)

@cached_property
def get_expression(self):
Expand All @@ -258,7 +259,7 @@ def get_expression(self):

@cached_property
def get_dimensions(self):
dim = dimensionless
dim = Dimensions({})
for key, power in self.derivation.items():
dim *= key.dimensions**power
return dim
Expand Down
2 changes: 1 addition & 1 deletion scimath/units/quantity.py
Expand Up @@ -135,7 +135,7 @@ def __init__(self, data, units=None, name='', **traits):
family_name = self.family_name.lower()
self.family_name = \
um.get_family_name(family_name) or \
em.get_family_name(name.lower())
um.get_family_name(name.lower())

# If units were passed in, but don't match the guessed family_name,
# punt.
Expand Down
4 changes: 4 additions & 0 deletions scimath/units/unit_db.py
Expand Up @@ -108,6 +108,7 @@ def get_family_format_from_file(self, filename=None):
# manager).

is_data = False
column_names = []

if not filename:
filename = os.path.join(get_path(self), 'data',
Expand Down Expand Up @@ -160,6 +161,7 @@ def get_unit_families_from_file(self, filename=None):
'unit_families.txt')

is_data = False
converters = []
fh = open(filename)

logger.debug('Loading default unit info from %s...' % filename)
Expand Down Expand Up @@ -201,6 +203,8 @@ def get_family_ranges_from_file(self, filename=None):
# manager).

is_data = False
column_names = []
system_names = []

if not filename:
filename = os.path.join(get_path(self), 'data',
Expand Down
2 changes: 1 addition & 1 deletion scimath/units/unit_manager.py
Expand Up @@ -228,7 +228,7 @@ def get_unit_system(self, system=None):
def add_system(self, system):
""" Adds unit system(s) to the unit_manager's list of systems
"""
self.unit_systems.append(us)
self.unit_systems.append(system)

def add_member(self, member_name, family):
""" Adds a member to the unit_members dict used to lookup unit aliases
Expand Down

0 comments on commit 2f3b7ff

Please sign in to comment.