Source code for inspirehep.testlib.api.base_resource

# -*- coding: utf-8 -*-
#
# This file is part of INSPIRE.
# Copyright (C) 2018 CERN.
#
# INSPIRE is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# INSPIRE is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with INSPIRE. If not, see <http://www.gnu.org/licenses/>.
#
# In applying this license, CERN does not waive the privileges and immunities
# granted to it by virtue of its status as an Intergovernmental Organization
# or submit itself to any jurisdiction.

"""Base resource class and utils."""

from __future__ import absolute_import, division, print_function


[docs]class BaseResource(object): def __repr__(self): classname = self.__class__.__name__ args = ', '.join( '%s=%r' % item for item in self.__dict__.items() if not item[0].startswith('_') ) return '{classname}({args})'.format(classname=classname, args=args) def __eq__(self, other): for this_prop, other_prop in zip(dir(self), dir(other)): if this_prop != other_prop: return False return len(dir(self)) == len(dir(other))