From 7be764f6857520168b9f8daab7d672e30211a0e4 Mon Sep 17 00:00:00 2001 From: Daniel Brauer Date: Sat, 23 Nov 2024 22:26:37 -0500 Subject: [PATCH] dataclass changed to namedtuple Signed-off-by: Daniel Brauer --- cartography/intel/github/repos.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/cartography/intel/github/repos.py b/cartography/intel/github/repos.py index c381aadbd..1ea0c67f4 100644 --- a/cartography/intel/github/repos.py +++ b/cartography/intel/github/repos.py @@ -1,6 +1,6 @@ import configparser import logging -from dataclasses import dataclass +from collections import namedtuple from string import Template from typing import Any from typing import Dict @@ -20,16 +20,17 @@ logger = logging.getLogger(__name__) -@dataclass(frozen=False) -class UserAffiliationAndRepoPermission: - """ - Representation of a user's permission level and affiliation to a GitHub repo. See: - - Permission: https://docs.github.com/en/graphql/reference/enums#repositorypermission - - Affiliation: https://docs.github.com/en/graphql/reference/enums#collaboratoraffiliation - """ - user: Dict - permission: str # WRITE, MAINTAIN, ADMIN, etc - affiliation: str # OUTSIDE, DIRECT +# Representation of a user's permission level and affiliation to a GitHub repo. See: +# - Permission: https://docs.github.com/en/graphql/reference/enums#repositorypermission +# - Affiliation: https://docs.github.com/en/graphql/reference/enums#collaboratoraffiliation +UserAffiliationAndRepoPermission = namedtuple( + 'UserAffiliationAndRepoPermission', + [ + 'user', # Dict + 'permission', # 'WRITE', 'MAINTAIN', 'ADMIN', etc + 'affiliation', # 'OUTSIDE', 'DIRECT' + ], +) GITHUB_ORG_REPOS_PAGINATED_GRAPHQL = """