From afcbd3d249cbe5f309f0a297dcc422427784fcfd Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Tue, 13 Apr 2021 16:51:05 +0300 Subject: Replace namedtuple with a dataclass --- gn3/db/traits.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'gn3/db') diff --git a/gn3/db/traits.py b/gn3/db/traits.py index 6c6118a..d315eb9 100644 --- a/gn3/db/traits.py +++ b/gn3/db/traits.py @@ -1,10 +1,17 @@ """This contains all the necessary functions that are required to add traits to the published database""" -from collections import namedtuple from typing import Any, Dict, Optional +from dataclasses import dataclass -riset = namedtuple('riset', ['name', 'id']) +@dataclass(frozen=True) +class riset: + """Class for keeping track of riset. A riset is a group e.g. rat HSNIH-Palmer, +BXD + + """ + name: str + r_id: int def get_riset(data_type: str, name: str, conn: Any): -- cgit v1.2.3