Skip to content

Commit

Permalink
🐛 fix codegen model group bug
Browse files Browse the repository at this point in the history
  • Loading branch information
yanyongyu authored May 22, 2024
1 parent 1e213bc commit 5b4cc75
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion codegen/parser/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ def model_dependencies(self) -> list[ModelSchema]:
def get_dependency_by_model(self, model: ModelSchema) -> "ModelGroup":
"""Get the group that contains the model."""
for group in self.group_dependencies:
if model in group.models:
# do not use `in` operator to avoid __eq__
if id(model) in map(id, group.models):
return group
raise ValueError(f"Model {model.class_name} not found in any group dependency.")

Expand Down
3 changes: 2 additions & 1 deletion githubkit/versions/ghec_v2022_11_28/models/group_0586.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@
from githubkit.typing import Missing
from githubkit.compat import GitHubModel, model_rebuild

from .group_0416 import WebhooksLabel
from .group_0421 import WebhooksIssue
from .group_0400 import EnterpriseWebhooks
from .group_0401 import SimpleInstallation
from .group_0403 import RepositoryWebhooks
from .group_0404 import SimpleUserWebhooks
from .group_0402 import OrganizationSimpleWebhooks
from .group_0421 import WebhooksIssue, WebhooksLabel


class WebhookIssuesUnlabeled(GitHubModel):
Expand Down
3 changes: 2 additions & 1 deletion githubkit/versions/ghec_v2022_11_28/types/group_0586.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@
from typing import Literal
from typing_extensions import TypedDict, NotRequired

from .group_0416 import WebhooksLabelType
from .group_0421 import WebhooksIssueType
from .group_0400 import EnterpriseWebhooksType
from .group_0401 import SimpleInstallationType
from .group_0403 import RepositoryWebhooksType
from .group_0404 import SimpleUserWebhooksType
from .group_0402 import OrganizationSimpleWebhooksType
from .group_0421 import WebhooksIssueType, WebhooksLabelType


class WebhookIssuesUnlabeledType(TypedDict):
Expand Down
3 changes: 2 additions & 1 deletion githubkit/versions/v2022_11_28/models/group_0553.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@
from githubkit.typing import Missing
from githubkit.compat import GitHubModel, model_rebuild

from .group_0383 import WebhooksLabel
from .group_0388 import WebhooksIssue
from .group_0367 import EnterpriseWebhooks
from .group_0368 import SimpleInstallation
from .group_0370 import RepositoryWebhooks
from .group_0371 import SimpleUserWebhooks
from .group_0369 import OrganizationSimpleWebhooks
from .group_0388 import WebhooksIssue, WebhooksLabel


class WebhookIssuesUnlabeled(GitHubModel):
Expand Down
3 changes: 2 additions & 1 deletion githubkit/versions/v2022_11_28/types/group_0553.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@
from typing import Literal
from typing_extensions import TypedDict, NotRequired

from .group_0383 import WebhooksLabelType
from .group_0388 import WebhooksIssueType
from .group_0367 import EnterpriseWebhooksType
from .group_0368 import SimpleInstallationType
from .group_0370 import RepositoryWebhooksType
from .group_0371 import SimpleUserWebhooksType
from .group_0369 import OrganizationSimpleWebhooksType
from .group_0388 import WebhooksIssueType, WebhooksLabelType


class WebhookIssuesUnlabeledType(TypedDict):
Expand Down

0 comments on commit 5b4cc75

Please sign in to comment.