mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 10:51:14 +00:00
Improve documentation generation
This commit is contained in:
+126
-64
@@ -42,12 +42,12 @@ Following
|
||||
* `has_in_following( user )`: `bool`
|
||||
*
|
||||
|
||||
Organizations
|
||||
-------------
|
||||
Orgs
|
||||
----
|
||||
* `get_orgs()` : list of `Organization`
|
||||
|
||||
Repositories
|
||||
------------
|
||||
Repos
|
||||
-----
|
||||
* `get_repos()`: list of `Repository`: see [API](http://developer.github.com/v3/repos/#list-your-repositories) for `type` parameter
|
||||
* `get_repo( name )`: `Repository`
|
||||
* `create_repo( ... )`: `Repository`: see [API](http://developer.github.com/v3/repos/#create) for parameters
|
||||
@@ -56,9 +56,12 @@ Repositories
|
||||
Watched
|
||||
-------
|
||||
* `get_watched()`: list of `Repository`
|
||||
* `has_in_watched( repo )`: `bool`
|
||||
* `add_to_watched( repo )`
|
||||
*
|
||||
* `remove_from_watched( repo )`
|
||||
*
|
||||
* `has_in_watched( repo )`: `bool`
|
||||
*
|
||||
|
||||
Class `Branch`
|
||||
==============
|
||||
@@ -67,6 +70,9 @@ Class `Branch`
|
||||
Class `Commit`
|
||||
==============
|
||||
* Attributes: see [API](http://developer.github.com/v3/repos/commits/#get-a-single-commit)
|
||||
|
||||
Comments
|
||||
--------
|
||||
* `get_comments()`: list of `CommitComment`
|
||||
* `create_comment( ... )`: `CommitComment`: see [API](http://developer.github.com/v3/repos/commits/#create-a-commit-comment) for parameters
|
||||
|
||||
@@ -106,14 +112,23 @@ Class `Issue`
|
||||
=============
|
||||
* Attributes: see [API](http://developer.github.com/v3/issues/#get-a-single-issue)
|
||||
* `edit( ... )`: see [API](http://developer.github.com/v3/issues/#edit-an-issue) for parameters
|
||||
|
||||
Labels
|
||||
------
|
||||
* `get_labels()`: list of `Label`
|
||||
* `add_to_labels( label, ... )`
|
||||
*
|
||||
* `set_labels( label, ... )`
|
||||
*
|
||||
* `delete_labels()`
|
||||
* `remove_from_labels( label )`
|
||||
*
|
||||
|
||||
Comments
|
||||
--------
|
||||
* `get_comments()`: list of `IssueComment`
|
||||
* `create_comment( ... )`: `IssueComment`: see [API](http://developer.github.com/v3/issues/comments/#create-a-comment) for parameters
|
||||
* `get_comment( id )`: `IssueComment`
|
||||
* `create_comment( ... )`: `IssueComment`: see [API](http://developer.github.com/v3/issues/comments/#create-a-comment) for parameters
|
||||
|
||||
Class `IssueComment`
|
||||
====================
|
||||
@@ -138,45 +153,56 @@ Class `NamedUser`
|
||||
=================
|
||||
* Attributes: see [API](http://developer.github.com/v3/users/#get-a-single-user)
|
||||
|
||||
Repositories
|
||||
------------
|
||||
* `get_repos()`: list of `Repository`: see [API](http://developer.github.com/v3/repos/#list-user-repositories) for `type` parameter
|
||||
* `get_repo( name )`: `Repository`
|
||||
|
||||
Watching
|
||||
--------
|
||||
* `get_watched()`: list of `Repository`
|
||||
|
||||
Organizations
|
||||
-------------
|
||||
* `get_orgs()` : list of `Organization`
|
||||
Followers
|
||||
---------
|
||||
* `get_followers()` : list of `NamedUser`
|
||||
|
||||
Following
|
||||
---------
|
||||
* `get_followers()` : list of `NamedUser`
|
||||
* `get_following()` : list of `NamedUser`
|
||||
|
||||
Orgs
|
||||
----
|
||||
* `get_orgs()` : list of `Organization`
|
||||
|
||||
Repos
|
||||
-----
|
||||
* `get_repos()`: list of `Repository`: see [API](http://developer.github.com/v3/repos/#list-user-repositories) for `type` parameter
|
||||
* `get_repo( name )`: `Repository`
|
||||
|
||||
Watched
|
||||
-------
|
||||
* `get_watched()`: list of `Repository`
|
||||
|
||||
Class `Organization`
|
||||
====================
|
||||
* Attributes: see [API](http://developer.github.com/v3/orgs/#get)
|
||||
* `edit( ... )`: see [API](http://developer.github.com/v3/orgs/#edit) for parameters
|
||||
|
||||
Repositories
|
||||
------------
|
||||
* `get_repos()`: list of `Repository`: see [API](http://developer.github.com/v3/repos/#list-organization-repositories) for `type` parameter
|
||||
* `get_repo( name )`: `Repository`
|
||||
* `create_repo( ... )`: `Repository`: see [API](http://developer.github.com/v3/repos/#create) for parameters
|
||||
* `create_fork( repo )`: `Repository`
|
||||
Public members
|
||||
--------------
|
||||
* `get_public_members()`: list of `NamedUser`
|
||||
* `add_to_public_members( user )`
|
||||
*
|
||||
* `remove_from_public_members( user )`
|
||||
*
|
||||
* `has_in_public_members( user )`: `bool`
|
||||
*
|
||||
|
||||
Members
|
||||
-------
|
||||
* `get_members()`: list of `NamedUser`
|
||||
* `has_in_members( user )`: `bool`
|
||||
* `remove_from_members( user )`
|
||||
* `get_public_members()`: list of `NamedUser`
|
||||
* `has_in_public_members( user )`: `bool`
|
||||
* `add_to_public_members( user )`
|
||||
* `remove_from_public_members( user )`
|
||||
*
|
||||
* `has_in_members( user )`: `bool`
|
||||
*
|
||||
|
||||
Repos
|
||||
-----
|
||||
* `get_repos()`: list of `Repository`: see [API](http://developer.github.com/v3/repos/#list-organization-repositories) for `type` parameter
|
||||
* `get_repo( name )`: `Repository`
|
||||
* `create_repo( ... )`: `Repository`: see [API](http://developer.github.com/v3/repos/#create) for parameters
|
||||
* `create_fork( repo )`: `Repository`
|
||||
|
||||
Teams
|
||||
-----
|
||||
@@ -192,67 +218,97 @@ Class `Repository`
|
||||
Collaborators
|
||||
-------------
|
||||
* `get_collaborators()`: list of `NamedUser`
|
||||
* `has_in_collaborators( user )`: `bool`
|
||||
* `add_to_collaborators( user )`
|
||||
*
|
||||
* `remove_from_collaborators( user )`
|
||||
*
|
||||
* `has_in_collaborators( user )`: `bool`
|
||||
*
|
||||
|
||||
Contributors
|
||||
------------
|
||||
* `get_contributors()`: list of `NamedUser`
|
||||
|
||||
Watching
|
||||
Watchers
|
||||
--------
|
||||
* `get_watchers()`: list of `NamedUser`
|
||||
|
||||
Forks
|
||||
-----
|
||||
* `get_forks()`: list of `Repository`
|
||||
|
||||
Git objects
|
||||
-----------
|
||||
Git refs
|
||||
--------
|
||||
* `get_git_refs()`: list of `GitRef`
|
||||
* `get_git_ref( ref )`: `GitRef`
|
||||
* `create_git_ref( ... )`: `GitRef`: see [API](http://developer.github.com/v3/git/refs/#create-a-reference) for parameters
|
||||
* `get_git_blob( sha )`: `GitBlob`
|
||||
* `create_git_blob( ... )`: `GitBlob`: see [API](http://developer.github.com/v3/git/blobs/#create-a-blob) for parameters
|
||||
|
||||
Git commits
|
||||
-----------
|
||||
* `get_git_commit( sha )`: `GitCommit`
|
||||
* `create_git_commit( ... )`: `GitCommit`: see [API](http://developer.github.com/v3/git/commits/#create-a-commit) for parameters
|
||||
|
||||
Git trees
|
||||
---------
|
||||
* `get_git_tree( sha )`: `GitTree`
|
||||
* `create_git_tree( ... )`: `GitTree`: see [API](http://developer.github.com/v3/git/trees/#create-a-tree) for parameters
|
||||
|
||||
Git blobs
|
||||
---------
|
||||
* `get_git_blob( sha )`: `GitBlob`
|
||||
* `create_git_blob( ... )`: `GitBlob`: see [API](http://developer.github.com/v3/git/blobs/#create-a-blob) for parameters
|
||||
|
||||
Git tags
|
||||
--------
|
||||
* `get_git_tag( sha )`: `GitTag`
|
||||
* `create_git_tag( ... )`: `GitTag`: see [API](http://developer.github.com/v3/git/tags/#create-a-tag-object) for parameters
|
||||
|
||||
Tags, branches, commits
|
||||
-----------------------
|
||||
* `get_tags()`: list of `Tag`
|
||||
* `get_branches()`: list of `Branch`
|
||||
* `get_commits( ... )`: list of `Commit`: see [API](http://developer.github.com/v3/repos/commits/#list-commits-on-a-repository) for parameters
|
||||
* `get_commit( sha )`: `Commit`
|
||||
* `get_comments()`: list of `CommitComment`
|
||||
* `get_comment( id )`: `CommitComment`
|
||||
|
||||
Teams
|
||||
-----
|
||||
* `get_teams()`: list of `Team`
|
||||
|
||||
Issues and milestones
|
||||
---------------------
|
||||
Labels
|
||||
------
|
||||
* `get_labels()`: list of `Label`
|
||||
* `create_label( ... )`: `Label`: see [API](http://developer.github.com/v3/issues/labels/#create-a-label) for parameters
|
||||
* `get_label( id )`: `Label`
|
||||
* `get_issues( ... )`: list of `Issue`: see [API](http://developer.github.com/v3/issues/#list-issues-for-a-repository) for parameters
|
||||
* `create_issue( ... )`: `Issue`: see [API](http://developer.github.com/v3/issues/#create-an-issue) for parameters
|
||||
* `get_issue( id )`: `Issue`
|
||||
|
||||
Milestones
|
||||
----------
|
||||
* `get_milestones( ... )`: list of `Milestone`: see [API](http://developer.github.com/v3/issues/milestones/#list-milestones-for-a-repository) for parameters
|
||||
* `create_milestone( ... )`: `Milestone`: see [API](http://developer.github.com/v3/issues/milestones/#create-a-milestone) for parameters
|
||||
* `get_milestone( number )`: `Milestone`
|
||||
|
||||
Issues
|
||||
------
|
||||
* `get_issues( ... )`: list of `Issue`: see [API](http://developer.github.com/v3/issues/#list-issues-for-a-repository) for parameters
|
||||
* `create_issue( ... )`: `Issue`: see [API](http://developer.github.com/v3/issues/#create-an-issue) for parameters
|
||||
* `get_issue( id )`: `Issue`
|
||||
|
||||
Downloads
|
||||
---------
|
||||
`Repository.get_downloads()` list of `Download`
|
||||
`Repository.create_download( ... )`: `Download`: see [API](http://developer.github.com/v3/repos/downloads/#create-a-new-download-part-1-create-the-resource)
|
||||
`Repository.get_download( id )`: `Download`
|
||||
|
||||
Comments
|
||||
--------
|
||||
* `get_comments()`: list of `CommitComment`
|
||||
* `get_comment( id )`: `CommitComment`
|
||||
|
||||
Commits
|
||||
-------
|
||||
* `get_commits( ... )`: list of `Commit`: see [API](http://developer.github.com/v3/repos/commits/#list-commits-on-a-repository) for parameters
|
||||
* `get_commit( sha )`: `Commit`
|
||||
|
||||
Tags
|
||||
----
|
||||
* `get_tags()`: list of `Tag`
|
||||
|
||||
Branches
|
||||
--------
|
||||
* `get_branches()`: list of `Branch`
|
||||
|
||||
Forks
|
||||
-----
|
||||
* `get_forks()`: list of `Repository`
|
||||
|
||||
Teams
|
||||
-----
|
||||
* `get_teams()`: list of `Team`
|
||||
|
||||
Class `Tag`
|
||||
===========
|
||||
* Attributes: see [API](http://developer.github.com/v3/repos/#list-tags)
|
||||
@@ -266,13 +322,19 @@ Class `Team`
|
||||
Members
|
||||
-------
|
||||
* `get_members()`: list of `NamedUser`
|
||||
* `has_in_members( user )`: `bool`
|
||||
* `add_to_members( user )`
|
||||
*
|
||||
* `remove_from_members( user )`
|
||||
*
|
||||
* `has_in_members( user )`: `bool`
|
||||
*
|
||||
|
||||
Repositories
|
||||
------------
|
||||
Repos
|
||||
-----
|
||||
* `get_repos()`: list of `Repository`
|
||||
* `has_in_repos( user )`: `bool`
|
||||
* `add_to_repos( user )`
|
||||
* `remove_from_repos( user )`
|
||||
* `add_to_repos( repo )`
|
||||
*
|
||||
* `remove_from_repos( repo )`
|
||||
*
|
||||
* `has_in_repos( repo )`: `bool`
|
||||
*
|
||||
|
||||
@@ -107,6 +107,7 @@ def GithubObject( className, *attributePolicies ):
|
||||
def _autoDocument( cls ):
|
||||
doc = "Class `" + cls.__name__ + "`\n"
|
||||
doc += "=" * ( len( cls.__name__ ) + 8 ) + "\n"
|
||||
doc += "* Attributes: see [API]()\n"
|
||||
for attributePolicy in cls.__attributePolicies:
|
||||
doc += attributePolicy.autoDocument()
|
||||
doc += "\n"
|
||||
|
||||
@@ -76,6 +76,7 @@ Organization = GithubObject(
|
||||
"disk_usage", "collaborators", "billing_email", "plan", "private_gists",
|
||||
"total_private_repos", "owned_private_repos",
|
||||
),
|
||||
Editable( [], [ "billing_email", "blog", "company", "email", "location", "name" ] ),
|
||||
ExternalListOfObjects( "public_members", "public_member", NamedUser,
|
||||
ListGetable( [], [] ),
|
||||
ElementAddable(),
|
||||
@@ -87,7 +88,6 @@ Organization = GithubObject(
|
||||
ElementRemovable(),
|
||||
ElementHasable()
|
||||
),
|
||||
Editable( [], [ "billing_email", "blog", "company", "email", "location", "name" ] ),
|
||||
)
|
||||
|
||||
AuthenticatedUser._addAttributePolicy(
|
||||
@@ -304,6 +304,8 @@ Repository = GithubObject(
|
||||
"mirror_url", "updated_at", "id",
|
||||
),
|
||||
InternalObjectAttribute( "owner", NamedUser ),
|
||||
Editable( [ "name" ], [ "description", "homepage", "public", "has_issues", "has_wiki", "has_downloads" ] ),
|
||||
ExternalSimpleAttribute( "languages" ),
|
||||
ExternalListOfObjects( "collaborators", "collaborator", NamedUser,
|
||||
ListGetable( [], [] ),
|
||||
ElementAddable(),
|
||||
@@ -316,7 +318,6 @@ Repository = GithubObject(
|
||||
ExternalListOfObjects( "watchers", "watcher", NamedUser,
|
||||
ListGetable( [], [] )
|
||||
),
|
||||
Editable( [ "name" ], [ "description", "homepage", "public", "has_issues", "has_wiki", "has_downloads" ] ),
|
||||
ExternalListOfObjects( "git/refs", "git_ref", GitRef,
|
||||
ListGetable( [], [], __modifyAttributesForObjectsReferingRepo ),
|
||||
ElementGetable( [ "ref" ], [], __modifyAttributesForObjectsReferingRepo ),
|
||||
@@ -353,7 +354,6 @@ Repository = GithubObject(
|
||||
ElementGetable( [ "number" ], [], __modifyAttributesForObjectsReferingRepo ),
|
||||
ElementCreatable( [ "title" ], [ "body", "assignee", "milestone", "labels", ], __modifyAttributesForObjectsReferingRepo )
|
||||
),
|
||||
ExternalSimpleAttribute( "languages" ),
|
||||
ExternalListOfObjects( "downloads", "download", Download,
|
||||
ListGetable( [], [], __modifyAttributesForObjectsReferingRepo ),
|
||||
ElementGetable( [ "id" ], [], __modifyAttributesForObjectsReferingRepo ),
|
||||
@@ -384,7 +384,7 @@ Repository._addAttributePolicy(
|
||||
|
||||
__repoElementCreatable = ElementCreatable( [ "name" ], [ "description", "homepage", "private", "has_issues", "has_wiki", "has_downloads", "team_id", ] )
|
||||
__repoElementGetable = ElementGetable( [ "name" ], [], { "owner" : lambda user: user } )
|
||||
__repoListGetable = ListGetable( [], [] )
|
||||
__repoListGetable = ListGetable( [], [ "type" ] )
|
||||
AuthenticatedUser._addAttributePolicy(
|
||||
ExternalListOfObjects( "repos", "repo", Repository,
|
||||
__repoListGetable,
|
||||
|
||||
@@ -215,9 +215,9 @@ class ListDeletable( ListCapacity ):
|
||||
def ExternalListOfObjects( attributeName, singularName, type, *capacities ):
|
||||
for capacity in capacities:
|
||||
capacity.setList( attributeName, singularName, ObjectTypePolicy( type ) )
|
||||
return SeveralAttributePolicies( capacities, attributeName )
|
||||
return SeveralAttributePolicies( capacities, attributeName.capitalize().replace( "_", " " ).replace( "/", " " ) )
|
||||
|
||||
def ExternalListOfSimpleTypes( attributeName, singularName, *capacities ):
|
||||
for capacity in capacities:
|
||||
capacity.setList( attributeName, singularName, SimpleTypePolicy() )
|
||||
return SeveralAttributePolicies( capacities, attributeName )
|
||||
return SeveralAttributePolicies( capacities, attributeName.capitalize().replace( "_", " " ).replace( "/", " " ) )
|
||||
|
||||
Reference in New Issue
Block a user