From 9f7ec6460ac4a40163c3fd53efb0201dab21825e Mon Sep 17 00:00:00 2001 From: Vincent Jacques Date: Thu, 3 May 2012 21:59:04 +0100 Subject: [PATCH] Dependencies => restore testAuthenticatedUserDetails! --- CodeGenerator/templates/GithubObject.py | 4 ++++ GenerateCode.py | 8 +++++++ .../description.000.human_readable.json | 6 +++--- .../description.001.normalized.json | 12 +++++------ ReferenceOfClasses.md | 6 +++--- github/GithubObjects/AuthenticatedUser.py | 8 +++++++ github/GithubObjects/Branch.py | 1 + github/GithubObjects/Commit.py | 3 +++ github/GithubObjects/CommitComment.py | 1 + github/GithubObjects/Event.py | 3 +++ github/GithubObjects/Gist.py | 3 +++ github/GithubObjects/GistComment.py | 1 + github/GithubObjects/GitCommit.py | 1 + github/GithubObjects/Issue.py | 5 +++++ github/GithubObjects/IssueComment.py | 1 + github/GithubObjects/IssueEvent.py | 1 + github/GithubObjects/Milestone.py | 2 ++ github/GithubObjects/NamedUser.py | 5 +++++ github/GithubObjects/Organization.py | 4 ++++ github/GithubObjects/PullRequest.py | 4 ++++ github/GithubObjects/PullRequestComment.py | 1 + github/GithubObjects/Repository.py | 21 +++++++++++++++++++ github/GithubObjects/Tag.py | 1 + github/GithubObjects/Team.py | 2 ++ 24 files changed, 92 insertions(+), 12 deletions(-) diff --git a/CodeGenerator/templates/GithubObject.py b/CodeGenerator/templates/GithubObject.py index 522a61bf..31a38e39 100644 --- a/CodeGenerator/templates/GithubObject.py +++ b/CodeGenerator/templates/GithubObject.py @@ -1,3 +1,7 @@ +{% for dependency in class.dependencies %} +import {{ dependency }} +{% endfor %} + class {{ class.name }}( object ): def __init__( self, github, attributes, lazy ): self.__github = github diff --git a/GenerateCode.py b/GenerateCode.py index c4d552f4..7ea5e030 100644 --- a/GenerateCode.py +++ b/GenerateCode.py @@ -1,6 +1,7 @@ #!/bin/env python import json +import itertools import django.conf import django.template @@ -14,6 +15,13 @@ django.conf.settings.configure( description = json.load( open( "JsonDescriptionOfGithubApiV3/description.001.normalized.json" ) ) +for class_ in description[ "classes" ]: + dependencies = set() + for thing in itertools.chain( class_[ "methods" ], class_[ "attributes" ] ): + if not thing[ "type" ][ "simple" ]: + dependencies.add( thing[ "type" ][ "name" ] ) + class_[ "dependencies" ] = list( dependencies ) + githubObjectTemplate = django.template.loader.get_template( "GithubObject.py" ) for class_ in description[ "classes" ]: with open( "github/GithubObjects/" + class_[ "name" ] + ".py", "w" ) as f: diff --git a/JsonDescriptionOfGithubApiV3/description.000.human_readable.json b/JsonDescriptionOfGithubApiV3/description.000.human_readable.json index 988afba2..034a1470 100644 --- a/JsonDescriptionOfGithubApiV3/description.000.human_readable.json +++ b/JsonDescriptionOfGithubApiV3/description.000.human_readable.json @@ -249,10 +249,10 @@ { "name": "Commit", "attributes": [ - { "name": "files", "type": "dict", "@todo": "dict of what?" }, - { "name": "parents", "type": "list", "@todo": "list of what?" }, + { "name": "files", "type": "@todo" }, + { "name": "parents", "type": "@todo" }, { "name": "sha", "type": "string" }, - { "name": "stats", "type": "dict", "@todo": "dict of what?" }, + { "name": "stats", "type": "@todo" }, { "name": "url", "type": "string" }, { "name": "author", "type": "NamedUser" }, { "name": "committer", "type": "NamedUser" }, diff --git a/JsonDescriptionOfGithubApiV3/description.001.normalized.json b/JsonDescriptionOfGithubApiV3/description.001.normalized.json index 62ac175d..83266ce4 100644 --- a/JsonDescriptionOfGithubApiV3/description.001.normalized.json +++ b/JsonDescriptionOfGithubApiV3/description.001.normalized.json @@ -1344,17 +1344,17 @@ }, { "type": { - "simple": false, + "simple": true, "cardinality": "scalar", - "name": "dict" + "name": "@todo" }, "name": "files" }, { "type": { - "simple": false, + "simple": true, "cardinality": "scalar", - "name": "list" + "name": "@todo" }, "name": "parents" }, @@ -1368,9 +1368,9 @@ }, { "type": { - "simple": false, + "simple": true, "cardinality": "scalar", - "name": "dict" + "name": "@todo" }, "name": "stats" }, diff --git a/ReferenceOfClasses.md b/ReferenceOfClasses.md index a23a0129..1f092c2c 100644 --- a/ReferenceOfClasses.md +++ b/ReferenceOfClasses.md @@ -190,10 +190,10 @@ Attributes * `author`: `NamedUser` * `commit`: `GitCommit` * `committer`: `NamedUser` -* `files`: `dict` -* `parents`: `list` +* `files` +* `parents` * `sha`: string -* `stats`: `dict` +* `stats` * `url`: string Comments diff --git a/github/GithubObjects/AuthenticatedUser.py b/github/GithubObjects/AuthenticatedUser.py index 0aef9b2a..6363af11 100644 --- a/github/GithubObjects/AuthenticatedUser.py +++ b/github/GithubObjects/AuthenticatedUser.py @@ -1,6 +1,14 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import Gist +import Repository +import NamedUser +import Organization +import UserKey +import Issue +import Event +import Authorization class AuthenticatedUser( object ): def __init__( self, github, attributes, lazy ): diff --git a/github/GithubObjects/Branch.py b/github/GithubObjects/Branch.py index 87eadfa8..a2571c74 100644 --- a/github/GithubObjects/Branch.py +++ b/github/GithubObjects/Branch.py @@ -1,6 +1,7 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import Commit class Branch( object ): def __init__( self, github, attributes, lazy ): diff --git a/github/GithubObjects/Commit.py b/github/GithubObjects/Commit.py index c16948b2..d31e2183 100644 --- a/github/GithubObjects/Commit.py +++ b/github/GithubObjects/Commit.py @@ -1,6 +1,9 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import NamedUser +import GitCommit +import CommitComment class Commit( object ): def __init__( self, github, attributes, lazy ): diff --git a/github/GithubObjects/CommitComment.py b/github/GithubObjects/CommitComment.py index 9cf5fbb8..a37f41b2 100644 --- a/github/GithubObjects/CommitComment.py +++ b/github/GithubObjects/CommitComment.py @@ -1,6 +1,7 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import NamedUser class CommitComment( object ): def __init__( self, github, attributes, lazy ): diff --git a/github/GithubObjects/Event.py b/github/GithubObjects/Event.py index b6e87f9c..8a8cdbf4 100644 --- a/github/GithubObjects/Event.py +++ b/github/GithubObjects/Event.py @@ -1,6 +1,9 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import Organization +import Repository +import NamedUser class Event( object ): def __init__( self, github, attributes, lazy ): diff --git a/github/GithubObjects/Gist.py b/github/GithubObjects/Gist.py index b8579430..a1117f5a 100644 --- a/github/GithubObjects/Gist.py +++ b/github/GithubObjects/Gist.py @@ -1,6 +1,9 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import NamedUser +import Gist +import GistComment class Gist( object ): def __init__( self, github, attributes, lazy ): diff --git a/github/GithubObjects/GistComment.py b/github/GithubObjects/GistComment.py index aa139931..b311e439 100644 --- a/github/GithubObjects/GistComment.py +++ b/github/GithubObjects/GistComment.py @@ -1,6 +1,7 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import NamedUser class GistComment( object ): def __init__( self, github, attributes, lazy ): diff --git a/github/GithubObjects/GitCommit.py b/github/GithubObjects/GitCommit.py index 206c8e77..cd646462 100644 --- a/github/GithubObjects/GitCommit.py +++ b/github/GithubObjects/GitCommit.py @@ -1,6 +1,7 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import GitTree class GitCommit( object ): def __init__( self, github, attributes, lazy ): diff --git a/github/GithubObjects/Issue.py b/github/GithubObjects/Issue.py index 58475006..1e20cb32 100644 --- a/github/GithubObjects/Issue.py +++ b/github/GithubObjects/Issue.py @@ -1,6 +1,11 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import IssueComment +import IssueEvent +import NamedUser +import Milestone +import Label class Issue( object ): def __init__( self, github, attributes, lazy ): diff --git a/github/GithubObjects/IssueComment.py b/github/GithubObjects/IssueComment.py index fb169b03..fc3a7a27 100644 --- a/github/GithubObjects/IssueComment.py +++ b/github/GithubObjects/IssueComment.py @@ -1,6 +1,7 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import NamedUser class IssueComment( object ): def __init__( self, github, attributes, lazy ): diff --git a/github/GithubObjects/IssueEvent.py b/github/GithubObjects/IssueEvent.py index eec67f2c..68cff8c8 100644 --- a/github/GithubObjects/IssueEvent.py +++ b/github/GithubObjects/IssueEvent.py @@ -1,6 +1,7 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import NamedUser class IssueEvent( object ): def __init__( self, github, attributes, lazy ): diff --git a/github/GithubObjects/Milestone.py b/github/GithubObjects/Milestone.py index 703ea9f5..f355b6ed 100644 --- a/github/GithubObjects/Milestone.py +++ b/github/GithubObjects/Milestone.py @@ -1,6 +1,8 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import NamedUser +import Label class Milestone( object ): def __init__( self, github, attributes, lazy ): diff --git a/github/GithubObjects/NamedUser.py b/github/GithubObjects/NamedUser.py index e352ee20..12f3fa12 100644 --- a/github/GithubObjects/NamedUser.py +++ b/github/GithubObjects/NamedUser.py @@ -1,6 +1,11 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import Organization +import Gist +import Event +import Repository +import NamedUser class NamedUser( object ): def __init__( self, github, attributes, lazy ): diff --git a/github/GithubObjects/Organization.py b/github/GithubObjects/Organization.py index b27acf31..98aa7d0a 100644 --- a/github/GithubObjects/Organization.py +++ b/github/GithubObjects/Organization.py @@ -1,6 +1,10 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import Team +import Event +import Repository +import NamedUser class Organization( object ): def __init__( self, github, attributes, lazy ): diff --git a/github/GithubObjects/PullRequest.py b/github/GithubObjects/PullRequest.py index 1ea0b603..015e9e33 100644 --- a/github/GithubObjects/PullRequest.py +++ b/github/GithubObjects/PullRequest.py @@ -1,6 +1,10 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import Commit +import NamedUser +import PullRequestComment +import PullRequestFile class PullRequest( object ): def __init__( self, github, attributes, lazy ): diff --git a/github/GithubObjects/PullRequestComment.py b/github/GithubObjects/PullRequestComment.py index 3f8b5a15..a016463f 100644 --- a/github/GithubObjects/PullRequestComment.py +++ b/github/GithubObjects/PullRequestComment.py @@ -1,6 +1,7 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import NamedUser class PullRequestComment( object ): def __init__( self, github, attributes, lazy ): diff --git a/github/GithubObjects/Repository.py b/github/GithubObjects/Repository.py index 92927a93..bccc421b 100644 --- a/github/GithubObjects/Repository.py +++ b/github/GithubObjects/Repository.py @@ -1,6 +1,27 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import GitCommit +import Team +import PullRequest +import GitBlob +import Repository +import IssueEvent +import Milestone +import RepositoryKey +import GitTag +import CommitComment +import Hook +import Tag +import Branch +import GitRef +import Download +import Commit +import NamedUser +import Issue +import Event +import GitTree +import Label class Repository( object ): def __init__( self, github, attributes, lazy ): diff --git a/github/GithubObjects/Tag.py b/github/GithubObjects/Tag.py index da600966..c9a82da1 100644 --- a/github/GithubObjects/Tag.py +++ b/github/GithubObjects/Tag.py @@ -1,6 +1,7 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import Commit class Tag( object ): def __init__( self, github, attributes, lazy ): diff --git a/github/GithubObjects/Team.py b/github/GithubObjects/Team.py index e6d2c076..0022c37c 100644 --- a/github/GithubObjects/Team.py +++ b/github/GithubObjects/Team.py @@ -1,6 +1,8 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +import Repository +import NamedUser class Team( object ): def __init__( self, github, attributes, lazy ):