Skip to content

Commit

Permalink
mypy: some improvements in type annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
manu-chroma committed Jun 27, 2017
1 parent f051f49 commit 65e583c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion schema_salad/makedoc.py
Expand Up @@ -21,7 +21,7 @@
_logger = logging.getLogger("salad")


def has_types(items): # type: (Any) -> List[basestring]
def has_types(items): # type: (Any) -> List[Text]
r = [] # type: List
if isinstance(items, dict):
if items["type"] == "https://w3id.org/cwl/salad#record":
Expand Down
2 changes: 0 additions & 2 deletions schema_salad/tests/test_errors.py
Expand Up @@ -2,7 +2,6 @@
from __future__ import print_function
from .util import get_data
import unittest
from typing import cast
from schema_salad.schema import load_schema, load_and_validate
from schema_salad.validate import ValidationException
from avro.schema import Names
Expand All @@ -12,7 +11,6 @@ class TestErrors(unittest.TestCase):
def test_errors(self):
document_loader, avsc_names, schema_metadata, metaschema_loader = load_schema(
get_data(u"tests/test_schema/CommonWorkflowLanguage.yml"))
avsc_names = cast(Names, avsc_names)

for t in ("test_schema/test1.cwl",
"test_schema/test2.cwl",
Expand Down
6 changes: 3 additions & 3 deletions schema_salad/tests/test_fetch.py
Expand Up @@ -9,7 +9,7 @@
import ruamel.yaml as yaml
import json
import os

from typing import Text
from six.moves import urllib

class TestFetcher(unittest.TestCase):
Expand All @@ -18,15 +18,15 @@ class TestFetcher(schema_salad.ref_resolver.Fetcher):
def __init__(self, a, b):
pass

def fetch_text(self, url): # type: (unicode) -> unicode
def fetch_text(self, url): # type: (Text) -> Text
if url == "keep:abc+123/foo.txt":
return "hello: keepfoo"
if url.endswith("foo.txt"):
return "hello: foo"
else:
raise RuntimeError("Not foo.txt")

def check_exists(self, url): # type: (unicode) -> bool
def check_exists(self, url): # type: (Text) -> bool
if url.endswith("foo.txt"):
return True
else:
Expand Down

0 comments on commit 65e583c

Please sign in to comment.