X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=test%2Fcsit%2Flibraries%2FHsfJson%2Fhsfod.py;fp=test%2Fcsit%2Flibraries%2FHsfJson%2Fhsfod.py;h=0000000000000000000000000000000000000000;hb=23412e442bc8e1b8f3d27e233829cf106b6ad0b8;hp=8b19a9d3af0cbd77e8e8ba0c4d8543990191697e;hpb=732659be50eedc962e9cf09b09ac15e459523c7a;p=integration.git diff --git a/test/csit/libraries/HsfJson/hsfod.py b/test/csit/libraries/HsfJson/hsfod.py deleted file mode 100644 index 8b19a9d3..00000000 --- a/test/csit/libraries/HsfJson/hsfod.py +++ /dev/null @@ -1,40 +0,0 @@ -"""This module contains single class, to store a sorted dict.""" -# Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved. -# -# This program and the accompanying materials are made available under the -# terms of the Eclipse Public License v1.0 which accompanies this distribution, -# and is available at http://www.eclipse.org/legal/epl-v10.html - -__author__ = "Vratko Polak" -__copyright__ = "Copyright(c) 2015, Cisco Systems, Inc." -__license__ = "Eclipse Public License v1.0" -__email__ = "vrpolak@cisco.com" - -import collections as _collections - - -class Hsfod(_collections.OrderedDict): - """ - Hashable sorted (by key) frozen OrderedDict implementation stub. - - Supports only __init__, __repr__ and __hash__ methods. - Other OrderedDict methods are available, but they may break contract. - """ - - def __init__(self, *args, **kwargs): - """Put arguments to OrderedDict, sort, pass to super, cache values.""" - self_unsorted = _collections.OrderedDict(*args, **kwargs) - items_sorted = sorted(self_unsorted.items(), key=repr) - sup = super(Hsfod, self) # possibly something else than OrderedDict - sup.__init__(items_sorted) - # Repr string is used for sorting, keys are more important than values. - self.__repr = '{' + repr(self.keys()) + ':' + repr(self.values()) + '}' - self.__hash = hash(self.__repr) - - def __repr__(self): - """Return cached repr string.""" - return self.__repr - - def __hash__(self): - """Return cached hash.""" - return self.__hash