Skip to content

Commit

Permalink
fix ValueEnum hashing
Browse files Browse the repository at this point in the history
  • Loading branch information
shyamd committed Jun 29, 2021
1 parent 89da5f6 commit bfce30b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions emmet-core/emmet/core/utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import datetime
from enum import Enum
from itertools import groupby
from typing import Iterator, List
from typing import Any, Iterator, List

import bson
import numpy as np
Expand Down Expand Up @@ -143,7 +143,12 @@ def __eq__(self, o: object) -> bool:
"""Special Equals to enable converting strings back to the enum"""
if isinstance(o, str):
return super().__eq__(self.__class__(o))
return super().__eq__(o)
elif isinstance(o, self.__class__):
return super().__eq__(o)
return False

def __hash__(self) -> Any:
return super().__hash__()


class DocEnum(ValueEnum):
Expand Down

0 comments on commit bfce30b

Please sign in to comment.