mirror of
				https://github.com/RGBCube/GitHubWrapper
				synced 2025-10-31 14:02:46 +00:00 
			
		
		
		
	Small fixes
This commit is contained in:
		
							parent
							
								
									db9f385801
								
							
						
					
					
						commit
						dddc0d410a
					
				
					 3 changed files with 36 additions and 16 deletions
				
			
		|  | @ -26,7 +26,7 @@ from .cache import ObjectCache | |||
| from .http import http | ||||
| from .objects import Gist, Issue, Organization, Repository, User, File | ||||
| 
 | ||||
| __all__: Tuple[str, ...] = ('GHClient',) | ||||
| __all__: Tuple[str, ...] = ('GHClient', 'Client') | ||||
| 
 | ||||
| T = TypeVar('T') | ||||
| P = ParamSpec('P') | ||||
|  | @ -40,9 +40,6 @@ class GHClient: | |||
|     username: Optional[:class:`str`] | ||||
|         An optional username to be provided along with a token to make authenticated API calls. | ||||
|         If you provide a username, the token must be provided as well. | ||||
|     token: Optional[:class:`str`] | ||||
|         An optional token to be provided along with a username to make authenticated API calls. | ||||
|         If you provide a token, the username must be provided as well. | ||||
|     user_cache_size: Optional[:class:`int`] | ||||
|         Determines the maximum number of User objects that will be cached in memory. | ||||
|         Defaults to 30, must be between 30 and 0 inclusive. | ||||
|  | @ -141,7 +138,7 @@ class GHClient: | |||
| 
 | ||||
|         return self.http.session._rates  # type: ignore | ||||
| 
 | ||||
|     async def update_auth(self, username: str, token: str) -> None: | ||||
|     async def update_auth(self, *, username: str, token: str) -> None: | ||||
|         """Allows you to input auth information after instantiating the client. | ||||
| 
 | ||||
|         Parameters | ||||
|  | @ -374,3 +371,8 @@ class GHClient: | |||
|     async def latency(self) -> float: | ||||
|         """:class:`float`: Returns the latency of the client.""" | ||||
|         return await self.http.latency() | ||||
| 
 | ||||
| 
 | ||||
| class Client(GHClient): | ||||
|     pass | ||||
| 
 | ||||
|  |  | |||
|  | @ -7,22 +7,26 @@ from aiohttp import ClientResponse | |||
| 
 | ||||
| __all__: Tuple[str, ...] = ( | ||||
|     'APIError', | ||||
|     'HTTPException', | ||||
|     'AlreadyStarted', | ||||
|     'ClientException', | ||||
|     'ResourceNotFound', | ||||
|     'Ratelimited', | ||||
|     'WillExceedRatelimit', | ||||
|     'NoAuthProvided', | ||||
|     'ClientResponse', | ||||
|     'GistNotFound', | ||||
|     'HTTPException', | ||||
|     'InvalidAuthCombination', | ||||
|     'InvalidToken', | ||||
|     'LoginFailure', | ||||
|     'NotStarted', | ||||
|     'AlreadyStarted', | ||||
|     'UserNotFound', | ||||
|     'RepositoryNotFound', | ||||
|     'IssueNotFound', | ||||
|     'LoginFailure', | ||||
|     'MissingPermissions', | ||||
|     'NoAuthProvided', | ||||
|     'NotStarted', | ||||
|     'OrganizationNotFound', | ||||
|     'Ratelimited', | ||||
|     'RepositoryAlreadyExists', | ||||
|     'RepositoryNotFound', | ||||
|     'ResourceAlreadyExists', | ||||
|     'ResourceNotFound', | ||||
|     'UserNotFound', | ||||
|     'WillExceedRatelimit', | ||||
| ) | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
|  | @ -256,10 +256,12 @@ class Repository(APIObject): | |||
| 
 | ||||
|     @property | ||||
|     def open_issues(self) -> int: | ||||
|         """:class:`int`: The number of open issues on the repository.""" | ||||
|         return self._response.get('open_issues') | ||||
| 
 | ||||
|     @property | ||||
|     def forks(self) -> int: | ||||
|         """:class:`int`: The number of forks of the repository.""" | ||||
|         return self._response.get('forks') | ||||
| 
 | ||||
|     @property | ||||
|  | @ -275,7 +277,15 @@ class Repository(APIObject): | |||
|         )  # type: ignore | ||||
| 
 | ||||
|     async def add_file(self, filename: str, message: str, content: str, branch: Optional[str] = None) -> None: | ||||
|         """Adds a file to the repository.""" | ||||
|         """Adds a file to the repository. | ||||
| 
 | ||||
|         Parameters | ||||
|         ---------- | ||||
|         filename: :class:`str` The name of the file. | ||||
|         message: :class:`str` The commit message. | ||||
|         content: :class:`str` The content of the file. | ||||
|         branch: :class:`str` The branch to add the file to, defaults to the default branch. | ||||
|         """ | ||||
| 
 | ||||
|         if branch is None: | ||||
|             branch = self.default_branch | ||||
|  | @ -450,6 +460,10 @@ class Gist(APIObject): | |||
|         """TODO: document this.""" | ||||
|         return self._response | ||||
| 
 | ||||
|     async def delete(self): | ||||
|         """Delete the gist.""" | ||||
|         await self._http.delete_gist(self.id) | ||||
| 
 | ||||
| 
 | ||||
| # === Organization stuff ===# | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 VarMonke
						VarMonke