Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Address various reviews!
  • Loading branch information
AlexWaygood committed May 12, 2023
commit 6c7ecb9d8ac77e1a013a53ebed0422e603f17e61
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,10 @@ updates:
update-types:
- "version-update:semver-minor"
- "version-update:semver-patch"
- package-ecosystem: "pip"
directory: "/Tools/clinic/"
schedule:
interval: "monthly"
labels:
- "skip issue"
- "skip news"
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Run mypy on Tools/clinic
# Workflow to run mypy on select parts of the CPython repo
name: mypy

on:
push:
Expand All @@ -7,7 +8,7 @@ on:
pull_request:
paths:
- "Tools/clinic/**"
- ".github/workflows/mypy-clinic.yml"
- ".github/workflows/mypy.yml"
workflow_dispatch:

permissions:
Expand All @@ -24,6 +25,7 @@ concurrency:

jobs:
mypy:
name: Run mypy on Tools/clinic/
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
Expand All @@ -33,5 +35,5 @@ jobs:
python-version: "3.11"
Comment thread
AlexWaygood marked this conversation as resolved.
Outdated
cache: pip
cache-dependency-path: .github/workflows/mypy-clinic.yml
Comment thread
AlexWaygood marked this conversation as resolved.
Outdated
- run: pip install mypy==1.3.0
- run: pip install -r Tools/clinic/requirements-dev.txt
- run: mypy --config-file Tools/clinic/mypy.ini
5 changes: 3 additions & 2 deletions Tools/clinic/clinic.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import abc
import ast
import builtins as bltns
import collections
import contextlib
import copy
Expand All @@ -28,7 +29,7 @@

from collections.abc import Callable
from types import *
Comment thread
hugovk marked this conversation as resolved.
from typing import Any, NamedTuple, Type
from typing import Any, NamedTuple

# TODO:
#
Expand Down Expand Up @@ -2588,7 +2589,7 @@ class CConverter(metaclass=CConverterAutoRegister):

# If not None, default must be isinstance() of this type.
# (You can also specify a tuple of types.)
default_type: Type[Any] | tuple[Type[Any], ...] | None = None
default_type: bltns.type[Any] | tuple[bltns.type[Any], ...] | None = None

# "default" converted into a C value, as a string.
# Or None if there is no default.
Expand Down
1 change: 1 addition & 0 deletions Tools/clinic/mypy.ini
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I usually put my mypy config in a pyproject.toml file these days, but a mypy.ini file feels like it makes more "sense" unless we're planning on adding other linters/formatters to check clinic.py in the future

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[mypy]
python_version = 3.10 # make sure clinic can still be run on Python 3.10
pretty = True
enable_error_code = ignore-without-code
disallow_any_generics = True
Expand Down
2 changes: 2 additions & 0 deletions Tools/clinic/requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Requirements file for external linters and checks we run on Tools/clinic/ in CI
mypy==1.3.0
Comment thread
AlexWaygood marked this conversation as resolved.
Outdated