From 56883023d38761ebdd7455e1bf65b2f579978ff2 Mon Sep 17 00:00:00 2001 From: Keith Brown Date: Thu, 19 Oct 2017 09:02:48 -0400 Subject: [PATCH] Back out the changes that were accidentally committed to master in 64264b7 --- xtuml/load.py | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/xtuml/load.py b/xtuml/load.py index 2b67bf9..7e79f40 100644 --- a/xtuml/load.py +++ b/xtuml/load.py @@ -202,8 +202,6 @@ class ModelLoader(object): lexer = None statements = None - quietInsertMismatch = False - def __init__(self): self.statements = list() self.parser = yacc.yacc(debuglog=logger, @@ -213,9 +211,6 @@ def __init__(self): outputdir=os.path.dirname(__file__), tabmodule='xtuml.__xtuml_parsetab') - def dontWarnInsertMismatch(self): - self.quietInsertMismatch = True - def input(self, data, name=''): ''' Parse *data* directly from a string. The *name* is used when reporting @@ -301,7 +296,7 @@ def _populate_matching_class(metamodel, kind, names, values): return metamodel.define_class(kind, attributes) @staticmethod - def _populate_instance_with_positional_arguments(metamodel, stmt, quietInsertMismatchWarning): + def _populate_instance_with_positional_arguments(metamodel, stmt): ''' Populate a *metamodel* with an instance previously encountered from input that was defined using positional arguments. @@ -312,9 +307,8 @@ def _populate_instance_with_positional_arguments(metamodel, stmt, quietInsertMis names, stmt.values) metaclass = metamodel.find_metaclass(stmt.kind) - if not quietInsertMismatchWarning: - if len(metaclass.attributes) != len(stmt.values): - logger.warn('%s:%d:schema mismatch' % (stmt.filename, stmt.lineno)) + if len(metaclass.attributes) != len(stmt.values): + logger.warn('%s:%d:schema mismatch' % (stmt.filename, stmt.lineno)) inst = metamodel.new(stmt.kind) for attr, value in zip(metaclass.attributes, stmt.values): @@ -332,7 +326,7 @@ def _populate_instance_with_positional_arguments(metamodel, stmt, quietInsertMis return inst @staticmethod - def _populate_instance_with_named_arguments(metamodel, stmt, quietInsertMismatchWarning): + def _populate_instance_with_named_arguments(metamodel, stmt): ''' Populate a *metamodel* with an instance previously encountered from input that was defined using named arguments. @@ -346,9 +340,8 @@ def _populate_instance_with_named_arguments(metamodel, stmt, quietInsertMismatch schema_unames = [name.upper() for name in metaclass.attribute_names] inst_unames = [name.upper() for name in stmt.names] - if not quietInsertMismatchWarning: - if set(inst_unames) - set(schema_unames): - logger.warn('%s:%d:schema mismatch' % (stmt.filename, stmt.lineno)) + if set(inst_unames) - set(schema_unames): + logger.warn('%s:%d:schema mismatch' % (stmt.filename, stmt.lineno)) inst = metamodel.new(stmt.kind) for name, ty in metaclass.attributes: @@ -383,7 +376,7 @@ def populate_instances(self, metamodel): else: fn = self._populate_instance_with_positional_arguments - fn(metamodel, stmt, self.quietInsertMismatch) + fn(metamodel, stmt) def populate_connections(self, metamodel): '''