Skip to content

Commit 1572f2f

Browse files
Adds enclosing ranges to function and class definitions (#132)
Co-authored-by: Varun Gandhi <[email protected]>
1 parent f5e9aee commit 1572f2f

File tree

53 files changed

+568
-611
lines changed

Some content is hidden

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

53 files changed

+568
-611
lines changed

packages/pyright-scip/snapshots/input/builtin_imports/builtin_imports.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# format-options: showDocs
2+
13
import re
24
from typing import Callable, Optional
35

packages/pyright-scip/snapshots/input/class_nohint/class_nohint.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# format-options: showDocs
2+
13
class Example:
24
# Note, only y has a type hint
35
y: int
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# format-options: showRanges
2+
def class_decorator(cls):
3+
def wrapper(*args, **kwargs):
4+
return cls(*args, **kwargs)
5+
return wrapper
6+
7+
@class_decorator
8+
class Test:
9+
def __init__(self, x: float):
10+
self.x = x
11+
12+
def test(self) -> float:
13+
return self.x
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# format-options: showRanges
2+
class Test():
3+
pass
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# format-options: showRanges
2+
def decorator(func):
3+
def wrapper(*args, **kwargs):
4+
return func(*args, **kwargs)
5+
return wrapper
6+
7+
@decorator
8+
def func(x: float) -> float:
9+
test = x
10+
11+
return test
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# format-options: showRanges
2+
def simple(x):
3+
return x

packages/pyright-scip/snapshots/input/unique/field_docstring.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# format-options: showDocs
2+
13
class ClassWithField:
24

35
a: int
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# format-options: showDocs
2+
13
class ClassWithInferredField:
24
def __init__(self, b: int):
35
self.b = b

packages/pyright-scip/snapshots/input/unique/module_docstring.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# format-options: showDocs
2+
13
"""
24
This is a docstring for this module
35
"""
Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,13 @@
11
# < definition scip-python python snapshot-util 0.1 actual/__init__:
2-
#documentation (module) actual
32

43
import aliased
54
# ^^^^^^^ reference snapshot-util 0.1 aliased/__init__:
65
import aliased as A
76
# ^^^^^^^ reference snapshot-util 0.1 aliased/__init__:
87
# ^ reference local 0
9-
# documentation ```python
10-
# > (module) A
11-
# > ```
128

139
print(A.SOME_CONSTANT)
1410
#^^^^ reference python-stdlib 3.11 builtins/print().
15-
#external documentation ```python
16-
# > (function) def print(
17-
# > *values: object,
18-
# > sep: str | None = " ",
19-
# > end: str | None = "\n",
20-
# > file: SupportsWrite[str] | None = No...
21-
# > flush: Literal[False] = False
22-
# > ) -> None
23-
# > ```
2411
# ^ reference local 0
2512
# ^^^^^^^^^^^^^ reference snapshot-util 0.1 aliased/SOME_CONSTANT.
2613

0 commit comments

Comments
 (0)