Skip to content
Snippets Groups Projects
Commit f8b05ee4 authored by Andreas Klöckner's avatar Andreas Klöckner
Browse files

Py3 fixes for stats

parent ac3bf583
No related branches found
No related tags found
No related merge requests found
......@@ -22,7 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
"""
import six # noqa
import six
import loopy as lp
import warnings
......@@ -35,17 +35,20 @@ class TypeToOpCountMap:
def __init__(self, init_dict=None):
if init_dict is None:
self.dict = {}
else:
self.dict = init_dict
init_dict = {}
self.dict = init_dict
def __add__(self, other):
return TypeToOpCountMap(dict(self.dict.items() + other.dict.items()
+ [(k, self.dict[k] + other.dict[k])
for k in set(self.dict) & set(other.dict)]))
result = self.dict.copy()
for k, v in six.iteritems(other.dict):
result[k] = self.dict.get(k, 0) + v
return TypeToOpCountMap(result)
def __radd__(self, other):
if (other != 0):
if other != 0:
raise ValueError("TypeToOpCountMap: Attempted to add TypeToOpCountMap "
"to {} {}. TypeToOpCountMap may only be added to "
"0 and other TypeToOpCountMap objects."
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment