Skip to content

Commit

Permalink
[red-knot] Typeshed sync: use copy instead of symlink
Browse files Browse the repository at this point in the history
  • Loading branch information
sharkdp committed Jan 9, 2025
1 parent f706c3f commit f460e0f
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 4 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/sync_typeshed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,19 @@ jobs:
cp -r typeshed/stdlib ruff/crates/red_knot_vendored/vendor/typeshed/stdlib
rm -rf ruff/crates/red_knot_vendored/vendor/typeshed/stdlib/@tests
git -C typeshed rev-parse HEAD > ruff/crates/red_knot_vendored/vendor/typeshed/source_commit.txt
# Patch the typeshed stubs to include `knot_extensions`
ln -s ../../../knot_extensions/knot_extensions.pyi ruff/crates/red_knot_vendored/vendor/typeshed/stdlib/
echo "# Patch applied for red_knot:" >> ruff/crates/red_knot_vendored/vendor/typeshed/stdlib/VERSIONS
echo "knot_extensions: 3.0-" >> ruff/crates/red_knot_vendored/vendor/typeshed/stdlib/VERSIONS
local source="crates/red_knot_vendored/knot_extensions/knot_extensions.pyi"
local target="crates/red_knot_vendored/vendor/typeshed/stdlib/knot_extensions.pyi"
(
echo "# WARNING: This file is generated by the typeshed sync workflow. Do not edit it manually."
echo "# Edit the source file at '$source' instead and then copy it over to this file."
) > "ruff/$target"
cat "ruff/$source" >> "ruff/$target"
(
echo "# Patch applied for red_knot:"
echo "knot_extensions: 3.0-"
) >> ruff/crates/red_knot_vendored/vendor/typeshed/stdlib/VERSIONS
- name: Commit the changes
id: commit
if: ${{ steps.sync.outcome == 'success' }}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# WARNING: This file is generated by the typeshed sync workflow. Do not edit it manually.
# Edit the source file at 'crates/red_knot_vendored/knot_extensions/knot_extensions.pyi' instead.
from typing import _SpecialForm, Any, LiteralString

# Special operations
def static_assert(condition: object, msg: LiteralString | None = None) -> None: ...

# Types
Unknown = object()

# Special forms
Not: _SpecialForm
Intersection: _SpecialForm
TypeOf: _SpecialForm

# Predicates on types
#
# Ideally, these would be annotated using `TypeForm`, but that has not been
# standardized yet (https://peps.python.org/pep-0747).
def is_equivalent_to(type_a: Any, type_b: Any) -> bool: ...
def is_subtype_of(type_derived: Any, typ_ebase: Any) -> bool: ...
def is_assignable_to(type_target: Any, type_source: Any) -> bool: ...
def is_disjoint_from(type_a: Any, type_b: Any) -> bool: ...
def is_fully_static(type: Any) -> bool: ...
def is_singleton(type: Any) -> bool: ...
def is_single_valued(type: Any) -> bool: ...

0 comments on commit f460e0f

Please sign in to comment.