File: CodeSecurityConfig.py

package info (click to toggle)
pygithub 2.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 33,476 kB
  • sloc: python: 38,409; sh: 7; makefile: 6
file content (217 lines) | stat: -rw-r--r-- 9,907 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
############################ Copyrights and license ############################
#                                                                              #
# Copyright 2025 Bill Napier <napier@pobox.com>                                #
# Copyright 2025 Enrico Minack <github@enrico.minack.dev>                      #
#                                                                              #
# This file is part of PyGithub.                                               #
# http://pygithub.readthedocs.io/                                              #
#                                                                              #
# PyGithub is free software: you can redistribute it and/or modify it under    #
# the terms of the GNU Lesser General Public License as published by the Free  #
# Software Foundation, either version 3 of the License, or (at your option)    #
# any later version.                                                           #
#                                                                              #
# PyGithub 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 Lesser General Public License for more #
# details.                                                                     #
#                                                                              #
# You should have received a copy of the GNU Lesser General Public License     #
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>.             #
#                                                                              #
################################################################################

from __future__ import annotations

from datetime import datetime
from typing import Any

from github.GithubObject import Attribute, NonCompletableGithubObject, NotSet


class CodeSecurityConfig(NonCompletableGithubObject):
    """
    This class represents Configurations for Code Security.

    The reference can be found here
    https://docs.github.com/en/rest/code-security/configurations.

    """

    def _initAttributes(self) -> None:
        self._id: Attribute[int] = NotSet
        self._name: Attribute[str] = NotSet
        self._advanced_security: Attribute[str] = NotSet
        self._code_scanning_default_setup: Attribute[str] = NotSet
        self._created_at: Attribute[datetime] = NotSet
        self._dependabot_alerts: Attribute[str] = NotSet
        self._dependabot_security_updates: Attribute[str] = NotSet
        self._dependency_graph: Attribute[str] = NotSet
        self._dependency_graph_autosubmit_action: Attribute[str] = NotSet
        self._description: Attribute[str] = NotSet
        self._enforcement: Attribute[str] = NotSet
        self._html_url: Attribute[str] = NotSet
        self._private_vulnerability_reporting: Attribute[str] = NotSet
        self._secret_scanning: Attribute[str] = NotSet
        self._secret_scanning_delegated_bypass: Attribute[str] = NotSet
        self._secret_scanning_non_provider_patterns: Attribute[str] = NotSet
        self._secret_scanning_push_protection: Attribute[str] = NotSet
        self._secret_scanning_validity_checks: Attribute[str] = NotSet
        self._target_type: Attribute[str] = NotSet
        self._url: Attribute[str] = NotSet
        self._updated_at: Attribute[datetime] = NotSet

    def __repr__(self) -> str:
        return self.get__repr__(
            {
                "id": self.id,
                "name": self.name,
                "description": self.description,
            }
        )

    @property
    def advanced_security(self) -> str:
        return self._advanced_security.value

    @property
    def code_scanning_default_setup(self) -> str:
        return self._code_scanning_default_setup.value

    @property
    def created_at(self) -> datetime:
        return self._created_at.value

    @property
    def dependabot_alerts(self) -> str:
        return self._dependabot_alerts.value

    @property
    def dependabot_security_updates(self) -> str:
        return self._dependabot_security_updates.value

    @property
    def dependency_graph(self) -> str:
        return self._dependency_graph.value

    @property
    def dependency_graph_autosubmit_action(self) -> str:
        return self._dependency_graph_autosubmit_action.value

    @property
    def description(self) -> str:
        return self._description.value

    @property
    def enforcement(self) -> str:
        return self._enforcement.value

    @property
    def html_url(self) -> str:
        return self._html_url.value

    @property
    def id(self) -> int:
        return self._id.value

    @property
    def name(self) -> str:
        return self._name.value

    @property
    def private_vulnerability_reporting(self) -> str:
        return self._private_vulnerability_reporting.value

    @property
    def secret_scanning(self) -> str:
        return self._secret_scanning.value

    @property
    def secret_scanning_delegated_bypass(self) -> str:
        return self._secret_scanning_delegated_bypass.value

    @property
    def secret_scanning_non_provider_patterns(self) -> str:
        return self._secret_scanning_non_provider_patterns.value

    @property
    def secret_scanning_push_protection(self) -> str:
        return self._secret_scanning_push_protection.value

    @property
    def secret_scanning_validity_checks(self) -> str:
        return self._secret_scanning_validity_checks.value

    @property
    def target_type(self) -> str:
        return self._target_type.value

    @property
    def updated_at(self) -> datetime:
        return self._updated_at.value

    @property
    def url(self) -> str:
        return self._url.value

    def _useAttributes(self, attributes: dict[str, Any]) -> None:
        if "advanced_security" in attributes:  # pragma no branch
            self._advanced_security = self._makeStringAttribute(attributes["advanced_security"])
        if "code_scanning_default_setup" in attributes:  # pragma no branch
            self._code_scanning_default_setup = self._makeStringAttribute(attributes["code_scanning_default_setup"])
        if "created_at" in attributes:  # pragma no branch
            assert attributes["created_at"] is None or isinstance(attributes["created_at"], str), attributes[
                "created_at"
            ]
            self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
        if "dependabot_alerts" in attributes:  # pragma no branch
            self._dependabot_alerts = self._makeStringAttribute(attributes["dependabot_alerts"])
        if "dependabot_security_updates" in attributes:  # pragma no branch
            self._dependabot_security_updates = self._makeStringAttribute(attributes["dependabot_security_updates"])
        if "dependency_graph" in attributes:  # pragma no branch
            self._dependency_graph = self._makeStringAttribute(attributes["dependency_graph"])
        if "dependency_graph_autosubmit_action" in attributes:  # pragma no branch
            self._dependency_graph_autosubmit_action = self._makeStringAttribute(
                attributes["dependency_graph_autosubmit_action"]
            )
        if "description" in attributes:  # pragma no branch
            self._description = self._makeStringAttribute(attributes["description"])
        if "enforcement" in attributes:  # pragma no branch
            self._enforcement = self._makeStringAttribute(attributes["enforcement"])
        if "html_url" in attributes:  # pragma no branch
            self._html_url = self._makeStringAttribute(attributes["html_url"])
        if "id" in attributes:  # pragma no branch
            self._id = self._makeIntAttribute(attributes["id"])
        if "name" in attributes:  # pragma no branch
            self._name = self._makeStringAttribute(attributes["name"])
        if "private_vulnerability_reporting" in attributes:  # pragma no branch
            self._private_vulnerability_reporting = self._makeStringAttribute(
                attributes["private_vulnerability_reporting"]
            )
        if "secret_scanning" in attributes:  # pragma no branch
            self._secret_scanning = self._makeStringAttribute(attributes["secret_scanning"])
        if "secret_scanning_delegated_bypass" in attributes:  # pragma no branch
            self._secret_scanning_delegated_bypass = self._makeStringAttribute(
                attributes["secret_scanning_delegated_bypass"]
            )
        if "secret_scanning_non_provider_patterns" in attributes:  # pragma no branch
            self._secret_scanning_non_provider_patterns = self._makeStringAttribute(
                attributes["secret_scanning_non_provider_patterns"]
            )
        if "secret_scanning_push_protection" in attributes:  # pragma no branch
            self._secret_scanning_push_protection = self._makeStringAttribute(
                attributes["secret_scanning_push_protection"]
            )
        if "secret_scanning_validity_checks" in attributes:  # pragma no branch
            self._secret_scanning_validity_checks = self._makeStringAttribute(
                attributes["secret_scanning_validity_checks"]
            )
        if "target_type" in attributes:  # pragma no branch
            self._target_type = self._makeStringAttribute(attributes["target_type"])
        if "updated_at" in attributes:  # pragma no branch
            assert attributes["updated_at"] is None or isinstance(attributes["updated_at"], str), attributes[
                "updated_at"
            ]
            self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
        if "url" in attributes:  # pragma no branch
            self._url = self._makeStringAttribute(attributes["url"])