-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #139
- Loading branch information
Showing
12 changed files
with
325 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
templates_path = ["_templates"] | ||
source_suffix = ".rst" | ||
master_doc = "index" | ||
project = u"pyexample" | ||
copyright = u"2015, rtfd" | ||
author = u"rtfd" | ||
version = "0.1" | ||
release = "0.1" | ||
language = None | ||
exclude_patterns = ["_build"] | ||
pygments_style = "sphinx" | ||
todo_include_todos = False | ||
html_theme = "alabaster" | ||
html_static_path = ["_static"] | ||
htmlhelp_basename = "pyexampledoc" | ||
extensions = ["sphinx.ext.autodoc", "autoapi.extension"] | ||
autoapi_type = "python" | ||
autoapi_dirs = ["example"] | ||
autoapi_file_pattern = "*.py" |
41 changes: 41 additions & 0 deletions
41
tests/python/pyannotationcommentsexample/example/example.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# -*- coding: utf-8 -*- | ||
"""Example module | ||
This is a description | ||
""" | ||
from typing import ClassVar, Dict, Iterable, List, Union | ||
|
||
max_rating = 10 # type: int | ||
|
||
ratings = [0, 1, 2, 3, 4, 5] # type: List[int] | ||
|
||
rating_names = {0: "zero", 1: "one"} # type: Dict[int, str] | ||
|
||
# TODO: Currently unsupported by astroid (#665) | ||
def f( | ||
start, # type: int | ||
end, # type: int | ||
): # type: (...) -> Iterable[int] | ||
i = start | ||
while i < end: | ||
yield i | ||
i += 1 | ||
|
||
|
||
mixed_list = [1, "two", 3] # type: List[Union[str, int]] | ||
|
||
|
||
def f2(not_yet_a): | ||
# type: (A) -> int | ||
pass | ||
|
||
|
||
class A: | ||
is_an_a = True # type: ClassVar[bool] | ||
|
||
def __init__(self): | ||
self.instance_var = True # type: bool | ||
"""This is an instance_var.""" | ||
|
||
|
||
global_a = A() # type: A |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
.. pyexample documentation master file, created by | ||
sphinx-quickstart on Fri May 29 13:34:37 2015. | ||
You can adapt this file completely to your liking, but it should at least | ||
contain the root `toctree` directive. | ||
Welcome to pyexample's documentation! | ||
===================================== | ||
|
||
.. toctree:: | ||
|
||
autoapi/index | ||
|
||
Contents: | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
|
||
|
||
Indices and tables | ||
================== | ||
|
||
* :ref:`genindex` | ||
* :ref:`modindex` | ||
* :ref:`search` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
templates_path = ["_templates"] | ||
source_suffix = ".rst" | ||
master_doc = "index" | ||
project = u"pyexample" | ||
copyright = u"2015, rtfd" | ||
author = u"rtfd" | ||
version = "0.1" | ||
release = "0.1" | ||
language = None | ||
exclude_patterns = ["_build"] | ||
pygments_style = "sphinx" | ||
todo_include_todos = False | ||
html_theme = "alabaster" | ||
html_static_path = ["_static"] | ||
htmlhelp_basename = "pyexampledoc" | ||
extensions = ["sphinx.ext.autodoc", "autoapi.extension"] | ||
autoapi_type = "python" | ||
autoapi_dirs = ["example"] | ||
autoapi_file_pattern = "*.py" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# -*- coding: utf-8 -*- | ||
"""Example module | ||
This is a description | ||
""" | ||
from typing import ClassVar, Dict, Iterable, List, Union | ||
|
||
max_rating: int = 10 | ||
|
||
is_valid: bool | ||
if max_rating > 100: | ||
is_valid = False | ||
else: | ||
is_valid = True | ||
|
||
ratings: List[int] = [0, 1, 2, 3, 4, 5] | ||
|
||
rating_names: Dict[int, str] = {0: "zero", 1: "one"} | ||
|
||
|
||
def f(start: int, end: int) -> Iterable[int]: | ||
i = start | ||
while i < end: | ||
yield i | ||
i += 1 | ||
|
||
|
||
mixed_list: List[Union[str, int]] = [1, "two", 3] | ||
|
||
|
||
def f2(not_yet_a: "A") -> int: | ||
... | ||
|
||
|
||
class A: | ||
is_an_a: ClassVar[bool] = True | ||
not_assigned_to: ClassVar[str] | ||
|
||
def __init__(self): | ||
self.instance_var: bool = True | ||
"""This is an instance_var.""" | ||
|
||
|
||
global_a: A = A() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
.. pyexample documentation master file, created by | ||
sphinx-quickstart on Fri May 29 13:34:37 2015. | ||
You can adapt this file completely to your liking, but it should at least | ||
contain the root `toctree` directive. | ||
Welcome to pyexample's documentation! | ||
===================================== | ||
|
||
.. toctree:: | ||
|
||
autoapi/index | ||
|
||
Contents: | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
|
||
|
||
Indices and tables | ||
================== | ||
|
||
* :ref:`genindex` | ||
* :ref:`modindex` | ||
* :ref:`search` | ||
|
Oops, something went wrong.