diff options
author | Munyoki Kilyungi | 2024-03-11 23:58:35 +0300 |
---|---|---|
committer | Munyoki Kilyungi | 2024-03-13 10:25:27 +0300 |
commit | 7e11ddbbdd6ddfa28367c02d0a3a7f3932c369ae (patch) | |
tree | a3f50b605411594ddf970752ffcb24a73f1d306b /gn_auth/auth/authorisation/data | |
parent | a295d21a42a6ae9c463f7661b32df7de11095835 (diff) | |
download | gn-auth-7e11ddbbdd6ddfa28367c02d0a3a7f3932c369ae.tar.gz |
Define Group using a frozen dataclass.
* gn_auth/auth/authorisation/data/genotypes.py: Import
dataclasses.asdict.
(link_genotype_data): Replace dictify with asdict.
* gn_auth/auth/authorisation/data/mrna.py: Import dataclasses.asdict.
(link_mrna_data): Replace dictify with asdict.
* gn_auth/auth/authorisation/data/phenotypes.py: Import
dataclasses.asdict.
(link_phenotype_data): Replace dictify with asdict.
* gn_auth/auth/authorisation/resources/groups/models.py: Import
dataclass.
(Group): Use frozen dataclass.
(Group.dictify): Delete.
(GroupRole.dictify): Replace dictify with asdict.
* gn_auth/auth/authorisation/resources/groups/views.py: Import
dataclasses.asdict. Remove dictify import.
(list_groups): Replace dictify with asdict.
(create_group): Ditto.
* gn_auth/auth/authorisation/resources/views.py:
(resource_users): Replace dictify with asdict.
* gn_auth/auth/authorisation/users/views.py: Import
dataclasses.asdict. Remove dictify import.
(user_details): Replace dictify with asdict.
(user_group): Ditto.
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
Diffstat (limited to 'gn_auth/auth/authorisation/data')
-rw-r--r-- | gn_auth/auth/authorisation/data/genotypes.py | 3 | ||||
-rw-r--r-- | gn_auth/auth/authorisation/data/mrna.py | 3 | ||||
-rw-r--r-- | gn_auth/auth/authorisation/data/phenotypes.py | 3 |
3 files changed, 6 insertions, 3 deletions
diff --git a/gn_auth/auth/authorisation/data/genotypes.py b/gn_auth/auth/authorisation/data/genotypes.py index bfddfc1..e0ffdc8 100644 --- a/gn_auth/auth/authorisation/data/genotypes.py +++ b/gn_auth/auth/authorisation/data/genotypes.py @@ -1,5 +1,6 @@ """Handle linking of Genotype data to the Auth(entic|oris)ation system.""" import uuid +from dataclasses import asdict from typing import Iterable from MySQLdb.cursors import DictCursor @@ -92,6 +93,6 @@ def link_genotype_data( "description": ( f"Successfully linked {len(datasets)} to group " f"'{group.group_name}'."), - "group": dictify(group), + "group": asdict(group), "datasets": datasets } diff --git a/gn_auth/auth/authorisation/data/mrna.py b/gn_auth/auth/authorisation/data/mrna.py index edcd29e..e65fbd0 100644 --- a/gn_auth/auth/authorisation/data/mrna.py +++ b/gn_auth/auth/authorisation/data/mrna.py @@ -1,5 +1,6 @@ """Handle linking of mRNA Assay data to the Auth(entic|oris)ation system.""" import uuid +from dataclasses import asdict from typing import Iterable from MySQLdb.cursors import DictCursor @@ -96,6 +97,6 @@ def link_mrna_data( "description": ( f"Successfully linked {len(datasets)} to group " f"'{group.group_name}'."), - "group": dictify(group), + "group": asdict(group), "datasets": datasets } diff --git a/gn_auth/auth/authorisation/data/phenotypes.py b/gn_auth/auth/authorisation/data/phenotypes.py index 17555ec..3baac75 100644 --- a/gn_auth/auth/authorisation/data/phenotypes.py +++ b/gn_auth/auth/authorisation/data/phenotypes.py @@ -1,5 +1,6 @@ """Handle linking of Phenotype data to the Auth(entic|oris)ation system.""" import uuid +from dataclasses import asdict from typing import Any, Iterable from MySQLdb.cursors import DictCursor @@ -136,6 +137,6 @@ def link_phenotype_data( return { "description": ( f"Successfully linked {len(traits)} traits to group."), - "group": dictify(group), + "group": asdict(group), "traits": params } |