Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync SecurityAndAnalysis class with API spec #3158

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Updated class according to API spec
  • Loading branch information
EnricoMi committed Jan 9, 2025
commit 41115022fc2865f98f9a1ac7f05c594283ec27e3
35 changes: 33 additions & 2 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[dict[str, Any]] = 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) -> dict[str, Any]:
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,7 +113,7 @@ 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 _useAttributes(self, attributes: dict[str, Any]) -> None:
def make_attribute(attribute_name: str) -> None:
if attribute_name in attributes:
setattr(
Expand All @@ -123,3 +130,27 @@ def make_attribute(attribute_name: str) -> None:
make_attribute("secret_scanning_non_provider_patterns")
make_attribute("secret_scanning_push_protection")
make_attribute("secret_scanning_validity_checks")
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._makeDictAttribute(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"],
)