Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cython
Commits
5c848acb
Commit
5c848acb
authored
Jul 28, 2015
by
Tzer-jen Wei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
can handle conflicting types now
parent
46441912
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
Cython/Tests/TestJediTyper.py
Cython/Tests/TestJediTyper.py
+2
-2
Tools/jedi-typer.py
Tools/jedi-typer.py
+4
-2
No files found.
Cython/Tests/TestJediTyper.py
View file @
5c848acb
...
...
@@ -84,7 +84,7 @@ class TestJediTyper(TransformTest):
self
.
assertFalse
(
types
)
self
.
assertEqual
({
'a'
:
set
([
'int'
]),
'i'
:
set
([
'int'
])},
variables
)
def
_
test_conflicting_types_in_function
(
self
):
def
test_conflicting_types_in_function
(
self
):
code
=
'''
\
def func(a, b):
print(a)
...
...
@@ -99,7 +99,7 @@ class TestJediTyper(TransformTest):
self
.
assertIn
((
'func'
,
(
1
,
0
)),
types
)
variables
=
types
.
pop
((
'func'
,
(
1
,
0
)))
self
.
assertFalse
(
types
)
self
.
assertEqual
({
'a'
:
set
([
'
int'
,
'str'
]),
'i
'
:
set
([
'int'
])},
variables
)
self
.
assertEqual
({
'a'
:
set
([
'
float'
,
'int'
,
'str'
]),
'b
'
:
set
([
'int'
])},
variables
)
def
_test_typing_function_char_loop
(
self
):
code
=
'''
\
...
...
Tools/jedi-typer.py
View file @
5c848acb
...
...
@@ -46,7 +46,9 @@ def analyse(source_path=None, code=None):
except
KeyError
:
names
=
scoped_names
[
key
]
=
defaultdict
(
set
)
for
name_type
in
evaluator
.
find_types
(
scope
,
statement
.
name
,
search_global
=
True
):
position
=
statement
.
start_pos
if
statement
.
name
in
names
else
None
for
name_type
in
evaluator
.
find_types
(
scope
,
statement
.
name
,
position
=
position
,
search_global
=
True
):
if
isinstance
(
name_type
,
Instance
):
if
isinstance
(
name_type
.
base
,
Class
):
type_name
=
'object'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment