mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 19:01:15 +00:00
Improve documentation generation
This commit is contained in:
@@ -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