Merge some simple classes' type stubs back to source (#2576)

Co-authored-by: Enrico Minack <github@enrico.minack.dev>
This commit is contained in:
Trim21
2023-07-08 12:14:34 +02:00
committed by GitHub
co-authored by Enrico Minack
parent f087cad3cb
commit 61f9ae6c4b
45 changed files with 412 additions and 989 deletions
+13 -15
View File
@@ -26,7 +26,12 @@
# #
################################################################################
import github.GithubObject
from __future__ import annotations
from typing import Any
from github.GithubObject import NotSet, Opt, is_defined, is_optional
class InputFileContent:
@@ -34,24 +39,17 @@ class InputFileContent:
This class represents InputFileContents
"""
def __init__(self, content, new_name=github.GithubObject.NotSet):
"""
:param content: string
:param new_name: string
"""
def __init__(self, content: str, new_name: Opt[str] = NotSet):
assert isinstance(content, str), content
assert new_name is github.GithubObject.NotSet or isinstance(
new_name, str
), new_name
self.__newName = new_name
self.__content = content
assert is_optional(new_name, str), new_name
self.__newName: Opt[str] = new_name
self.__content: str = content
@property
def _identity(self):
identity = {
def _identity(self) -> dict[str, str]:
identity: dict[str, Any] = {
"content": self.__content,
}
if self.__newName is not github.GithubObject.NotSet:
if is_defined(self.__newName):
identity["filename"] = self.__newName
return identity