Skip to content

Commit

Permalink
Sync SecurityAndAnalysis class with API spec (#3158)
Browse files Browse the repository at this point in the history
Adds the following attributes:
- secret_scanning_ai_detection
  • Loading branch information
EnricoMi authored Jan 9, 2025
1 parent 365f989 commit 65546ab
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 33 deletions.
51 changes: 33 additions & 18 deletions github/SecurityAndAnalysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
# #
################################################################################

from typing import Any, Dict
from __future__ import annotations

from typing import Any

import github.SecurityAndAnalysisFeature
from github.GithubObject import Attribute, NonCompletableGithubObject, NotSet
Expand All @@ -60,6 +62,7 @@ def _initAttributes(self) -> None:
github.SecurityAndAnalysisFeature.SecurityAndAnalysisFeature
] = NotSet
self._secret_scanning: Attribute[github.SecurityAndAnalysisFeature.SecurityAndAnalysisFeature] = NotSet
self._secret_scanning_ai_detection: Attribute[str] = NotSet
self._secret_scanning_non_provider_patterns: Attribute[
github.SecurityAndAnalysisFeature.SecurityAndAnalysisFeature
] = NotSet
Expand Down Expand Up @@ -94,6 +97,10 @@ def dependabot_security_updates(self) -> github.SecurityAndAnalysisFeature.Secur
def secret_scanning(self) -> github.SecurityAndAnalysisFeature.SecurityAndAnalysisFeature:
return self._secret_scanning.value

@property
def secret_scanning_ai_detection(self) -> str:
return self._secret_scanning_ai_detection.value

@property
def secret_scanning_non_provider_patterns(self) -> github.SecurityAndAnalysisFeature.SecurityAndAnalysisFeature:
return self._secret_scanning_non_provider_patterns.value
Expand All @@ -106,20 +113,28 @@ def secret_scanning_push_protection(self) -> github.SecurityAndAnalysisFeature.S
def secret_scanning_validity_checks(self) -> github.SecurityAndAnalysisFeature.SecurityAndAnalysisFeature:
return self._secret_scanning_validity_checks.value

def _useAttributes(self, attributes: Dict[str, Any]) -> None:
def make_attribute(attribute_name: str) -> None:
if attribute_name in attributes:
setattr(
self,
f"_{attribute_name}",
self._makeClassAttribute(
github.SecurityAndAnalysisFeature.SecurityAndAnalysisFeature, attributes[attribute_name]
),
)

make_attribute("advanced_security")
make_attribute("dependabot_security_updates")
make_attribute("secret_scanning")
make_attribute("secret_scanning_non_provider_patterns")
make_attribute("secret_scanning_push_protection")
make_attribute("secret_scanning_validity_checks")
def _useAttributes(self, attributes: dict[str, Any]) -> None:
if "advanced_security" in attributes: # pragma no branch
self._advanced_security = self._makeClassAttribute(
github.SecurityAndAnalysisFeature.SecurityAndAnalysisFeature, attributes["advanced_security"]
)
if "dependabot_security_updates" in attributes: # pragma no branch
self._dependabot_security_updates = self._makeClassAttribute(
github.SecurityAndAnalysisFeature.SecurityAndAnalysisFeature, attributes["dependabot_security_updates"]
)
if "secret_scanning" in attributes: # pragma no branch
self._secret_scanning = self._makeClassAttribute(
github.SecurityAndAnalysisFeature.SecurityAndAnalysisFeature, attributes["secret_scanning"]
)
if "secret_scanning_ai_detection" in attributes: # pragma no branch
self._secret_scanning_ai_detection = self._makeStringAttribute(attributes["secret_scanning_ai_detection"])
if "secret_scanning_non_provider_patterns" in attributes: # pragma no branch
self._secret_scanning_non_provider_patterns = self._makeClassAttribute(
github.SecurityAndAnalysisFeature.SecurityAndAnalysisFeature,
attributes["secret_scanning_non_provider_patterns"],
)
if "secret_scanning_push_protection" in attributes: # pragma no branch
self._secret_scanning_push_protection = self._makeClassAttribute(
github.SecurityAndAnalysisFeature.SecurityAndAnalysisFeature,
attributes["secret_scanning_push_protection"],
)
Loading

0 comments on commit 65546ab

Please sign in to comment.