[Piglit] [PATCH 2/5] framework/status.py: Add a __hash__ method to Status class

Timothy Arceri t_arceri at yahoo.com.au
Mon Jul 6 14:46:18 PDT 2015


Reviewed-by: Timothy Arceri <t_arceri at yahoo.com.au>

On Thu, 2015-07-02 at 16:46 -0700, Dylan Baker wrote:
> This is necessary in Python 3 to put a Status in a dictionary or set,
> but is optional in python 2. It doesn't do any harm implementing it now,
> and will easy the python 3 transition
> 
> Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
> ---
>  framework/status.py | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/framework/status.py b/framework/status.py
> index ec873d8..98a9e3d 100644
> --- a/framework/status.py
> +++ b/framework/status.py
> @@ -196,6 +196,9 @@ class Status(object):
>      def __int__(self):
>          return self.value
>  
> +    def __hash__(self):
> +        return hash(self.name)
> +
>  
>  class NoChangeStatus(Status):
>      """ Special sublcass of status that overides rich comparison methods


More information about the Piglit mailing list