Skip to content

Commit 5faae7b

Browse files
authored
🚨 make linter happy
1 parent 82219d5 commit 5faae7b

109 files changed

Lines changed: 145 additions & 105 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/pyright.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,24 @@ jobs:
4545
uses: jakebailey/pyright-action@v2
4646
with:
4747
pylance-version: latest-release
48+
extra-args: githubkit
49+
50+
lint-codegen:
51+
name: Codegen Lint
52+
runs-on: ubuntu-latest
53+
54+
steps:
55+
- uses: actions/checkout@v4
56+
57+
- name: Setup Python environment
58+
uses: ./.github/actions/setup-python
59+
60+
- run: |
61+
echo "$(dirname $(uv python find))" >> $GITHUB_PATH
62+
shell: bash
63+
64+
- name: Run Pyright
65+
uses: jakebailey/pyright-action@v2
66+
with:
67+
working-directory: ./codegen
68+
pylance-version: latest-release

codegen/pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,9 @@ target-version = "py310"
44

55
[tool.ruff.lint]
66
ignore = ["TID"]
7+
8+
# pyright config for ci check
9+
[tool.pyright]
10+
extends = "../pyproject.toml"
11+
12+
executionEnvironments = [{ root = ".", pythonVersion = "3.10" }]

codegen/templates/webhooks/event.py.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ action_types: dict[str, type[GitHubModel]] = {
4444
{% for webhook in webhooks %}
4545
"{{ webhook.action }}": {{ webhook.event_schema.get_type_string() }},
4646
{% endfor %}
47-
}
47+
} # pyright: ignore[reportAssignmentType]
4848
{% else %}
4949
action_types = {{ (webhooks | first).event_schema.get_type_string() }}
5050
{% endif %}

githubkit/compat.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,21 @@ class ExtraGitHubModel(BaseModel):
9797
class Config:
9898
extra = Extra.allow
9999

100+
@overload
101+
def type_validate_python(type_: type[T], data: Any) -> T: ...
102+
103+
@overload
104+
def type_validate_python(type_: Any, data: Any) -> Any: ...
105+
100106
def type_validate_python(type_: type[T], data: Any) -> T:
101107
return parse_obj_as(type_, data)
102108

109+
@overload
110+
def type_validate_json(type_: type[T], data: Any) -> T: ...
111+
112+
@overload
113+
def type_validate_json(type_: Any, data: Any) -> Any: ...
114+
103115
def type_validate_json(type_: type[T], data: Any) -> T:
104116
return parse_raw_as(type_, data)
105117

githubkit/versions/ghec_v2022_11_28/webhooks/branch_protection_configuration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
action_types: dict[str, type[GitHubModel]] = {
3333
"disabled": WebhookBranchProtectionConfigurationDisabled,
3434
"enabled": WebhookBranchProtectionConfigurationEnabled,
35-
}
35+
} # pyright: ignore[reportAssignmentType]
3636

3737
branch_protection_configuration_action_types = action_types
3838

githubkit/versions/ghec_v2022_11_28/webhooks/branch_protection_rule.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"created": WebhookBranchProtectionRuleCreated,
3636
"deleted": WebhookBranchProtectionRuleDeleted,
3737
"edited": WebhookBranchProtectionRuleEdited,
38-
}
38+
} # pyright: ignore[reportAssignmentType]
3939

4040
branch_protection_rule_action_types = action_types
4141

githubkit/versions/ghec_v2022_11_28/webhooks/check_run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"created": WebhookCheckRunCreated,
3939
"requested_action": WebhookCheckRunRequestedAction,
4040
"rerequested": WebhookCheckRunRerequested,
41-
}
41+
} # pyright: ignore[reportAssignmentType]
4242

4343
check_run_action_types = action_types
4444

githubkit/versions/ghec_v2022_11_28/webhooks/check_suite.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"completed": WebhookCheckSuiteCompleted,
3636
"requested": WebhookCheckSuiteRequested,
3737
"rerequested": WebhookCheckSuiteRerequested,
38-
}
38+
} # pyright: ignore[reportAssignmentType]
3939

4040
check_suite_action_types = action_types
4141

githubkit/versions/ghec_v2022_11_28/webhooks/code_scanning_alert.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"fixed": WebhookCodeScanningAlertFixed,
4545
"reopened": WebhookCodeScanningAlertReopened,
4646
"reopened_by_user": WebhookCodeScanningAlertReopenedByUser,
47-
}
47+
} # pyright: ignore[reportAssignmentType]
4848

4949
code_scanning_alert_action_types = action_types
5050

githubkit/versions/ghec_v2022_11_28/webhooks/custom_property.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"deleted": WebhookCustomPropertyDeleted,
3939
"promote_to_enterprise": WebhookCustomPropertyPromotedToEnterprise,
4040
"updated": WebhookCustomPropertyUpdated,
41-
}
41+
} # pyright: ignore[reportAssignmentType]
4242

4343
custom_property_action_types = action_types
4444

0 commit comments

Comments
 (0)