Repository navigation
improve python3 support - #287
Conversation
|
"This branch is out-of-date with the base branch" Should I hit the 'update branch' button, or do you want to do that locally? |
| param_re = re.compile(r"\((%s)%s*\)$" % (seg_symbol, segments), flags=re.UNICODE) | ||
|
|
||
| JSON = Union[Dict[Any, Any], List[Any], Text, int, long, float, bool, None] | ||
| JSON = Union[Dict[Any, Any], List[Any], Text, int, int, float, bool, None] |
| _logger = logging.getLogger("cwltool") | ||
|
|
||
| JSON = Union[Dict[Text, Any], List[Any], Text, int, long, float, bool, None] | ||
| JSON = Union[Dict[Text, Any], List[Any], Text, int, int, float, bool, None] |
There was a problem hiding this comment.
| @@ -1,12 +1,11 @@ | |||
| import cStringIO | |||
There was a problem hiding this comment.
ah yes. clearly this is not covered by the test suite :)
There was a problem hiding this comment.
well, it is not required to run the code, only to validate the types. But there are many more type violations due to missing imports in the code... so what should we do?
There was a problem hiding this comment.
The lines I commented on are the only type violations I'm aware of.
There was a problem hiding this comment.
pycharm finds a lot, but that is mostly things like typing.List and typing.Union, which are probably imported by default by mypy.
There was a problem hiding this comment.
it looks impossible to make that type annotation work properly with Python3, the stringio stuff works quite different now.
| key = int(m.group(0)[1:-1]) | ||
| except ValueError as v: | ||
| raise WorkflowException(unicode(v)) | ||
| raise WorkflowException(u(v)) |
There was a problem hiding this comment.
cwltool/expression.py: note: In function "next_seg":
cwltool/expression.py:130: error: Argument 1 to "u" has incompatible type "ValueError"; expected "str"
There was a problem hiding this comment.
where did you find these errors?
There was a problem hiding this comment.
| raise WorkflowException( | ||
| u"Error collecting output for parameter '%s':\n%s" | ||
| % (shortname(port["id"]), indent(unicode(e)))) | ||
| % (shortname(port["id"]), indent(u(e)))) |
There was a problem hiding this comment.
cwltool/draft2tool.py: note: In member "collect_output_ports" of class "CommandLineTool":
cwltool/draft2tool.py:410: error: Argument 1 to "u" has incompatible type "Exception"; expected "str"
| stdout_buf = BytesIO() | ||
| stderr_buf = BytesIO() | ||
|
|
||
| completed = [] # type: List[Union[cStringIO.InputType, cStringIO.OutputType]] |
There was a problem hiding this comment.
I'd try completed = [] # type: List[BytesIO] here ...
There was a problem hiding this comment.
yep, but that is python3 only.
There was a problem hiding this comment.
I updated schema_salad and cwltool for mypy 0.470 (the project was renamed from mypy-lang). With that in place type: List[BytesIO] works for me. If you'll merge in from master then I think we'll be done with this PR.
|
and add 3.4 & 3.6 to `.travis.yml' to turn those tests on |
| stdout_buf = BytesIO() | ||
| stderr_buf = BytesIO() | ||
|
|
||
| completed = [] # type: List[Union[cStringIO.InputType, cStringIO.OutputType]] |
There was a problem hiding this comment.
I updated schema_salad and cwltool for mypy 0.470 (the project was renamed from mypy-lang). With that in place type: List[BytesIO] works for me. If you'll merge in from master then I think we'll be done with this PR.
No description provided.