mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-02 11:51:10 +00:00
Merge some simple classes' type stubs back to source (#2576)
Co-authored-by: Enrico Minack <github@enrico.minack.dev>
This commit is contained in:
+13
-15
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user