Skip to content

Commit

Permalink
Merge pull request #49 from common-workflow-language/mypy3
Browse files Browse the repository at this point in the history
Add py3 typesheds & testing
  • Loading branch information
mr-c committed Feb 8, 2018
2 parents 9cca425 + 15d6a67 commit f962c94
Show file tree
Hide file tree
Showing 165 changed files with 4,772 additions and 53 deletions.
15 changes: 13 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -147,17 +147,28 @@ list-author-emails:
@echo 'name, E-Mail Address'
@git log --format='%aN,%aE' | sort -u | grep -v 'root'

mypy: ${PYSOURCES}
mypy2: ${PYSOURCES}
rm -Rf typeshed/2.7/ruamel/yaml
ln -s $(shell python -c 'from __future__ import print_function; import ruamel.yaml; import os.path; print(os.path.dirname(ruamel.yaml.__file__))') \
typeshed/2.7/ruamel/yaml
rm -Rf typeshed/2.7/schema_salad
ln -s $(shell python -c 'from __future__ import print_function; import schema_salad; import os.path; print(os.path.dirname(schema_salad.__file__))') \
typeshed/2.7/schema_salad
MYPYPATH=typeshed/2.7 mypy --py2 --disallow-untyped-calls \
MYPYPATH=typeshed/2.7:typeshed/2and3 mypy --py2 --disallow-untyped-calls \
--warn-redundant-casts --warn-unused-ignores \
${MODULE}

mypy3: ${PYSOURCES}
rm -Rf typeshed/2and3/ruamel/yaml
ln -s $(shell python3 -c 'from __future__ import print_function; import ruamel.yaml; import os.path; print(os.path.dirname(ruamel.yaml.__file__))') \
typeshed/2and3/ruamel/yaml
rm -Rf typeshed/2and3/schema_salad
ln -s $(shell python3 -c 'from __future__ import print_function; import schema_salad; import os.path; print(os.path.dirname(schema_salad.__file__))') \
typeshed/2and3/schema_salad
MYPYPATH=$$MYPYPATH:typeshed/3:typeshed/2and3 mypy --disallow-untyped-calls \
--warn-redundant-casts \
${MODULE}

release: FORCE
./release-test.sh
. testenv2/bin/activate && \
Expand Down
2 changes: 1 addition & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[mypy-ruamel.*]
ignore_errors = True
ignore_errors = True
19 changes: 13 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
[tox]
#envlist = py35-lint,py34-lint,py33-lint,py27-lint,py35-unit,py34-unit,py33-unit,py27-unit
envlist = py27-lint, py27-unit, py35-mypy
envlist = py27-lint, py27-unit, py35-mypy{2,3}
skipsdist = True

[travis]
os =
linux: py{27,35}-{lint,unit}, py35-mypy
linux: py{27,35}-{lint,unit}, py35-mypy{2,3}
osx: py{27}-{lint,unit}
python =
2.7: py27
3.5: py35-mypy
3.5: py35-mypy{2,3}

[testenv]
deps = -rrequirements.txt

[testenv:py35-mypy]
commands = make mypy
[testenv:py35-mypy2]
commands = make mypy2
whitelist_externals = make
deps =
mypy==0.520
mypy==0.560
-rrequirements.txt

[testenv:py35-mypy3]
commands = make mypy3
whitelist_externals = make
deps =
mypy==0.560
-rrequirements.txt

[testenv:py35-lint]
Expand Down
44 changes: 0 additions & 44 deletions typeshed/2.7/junit_xml.pyi

This file was deleted.

10 changes: 10 additions & 0 deletions typeshed/2and3/avro/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Stubs for avro (Python 2)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.

# Names in __all__ with no definition:
# datafile
# io
# ipc
# protocol
# schema
117 changes: 117 additions & 0 deletions typeshed/2and3/avro/schema.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# Stubs for avro.schema (Python 2)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.

from typing import Any, Union, Dict, List, Text

PRIMITIVE_TYPES = ... # type: Any
NAMED_TYPES = ... # type: Any
VALID_TYPES = ... # type: Any
SCHEMA_RESERVED_PROPS = ... # type: Any
FIELD_RESERVED_PROPS = ... # type: Any
VALID_FIELD_SORT_ORDERS = ... # type: Any

class AvroException(Exception): ...
class SchemaParseException(AvroException): ...

class Schema:
type = ... # type: Any
def __init__(self, type, other_props=None): ...
props = ... # type: Any
other_props = ... # type: Any
def get_prop(self, key): ...
def set_prop(self, key, value): ...
def to_json(self, names): ...

class Name:
def __init__(self, name_attr, space_attr, default_space): ...
def __eq__(self, other): ...
fullname = ... # type: Any
def get_space(self): ...

class Names:
names = ... # type: Any
default_namespace = ... # type: Any
def __init__(self, default_namespace: Union[str, Text] = None) -> None: ...
def has_name(self, name_attr: Union[str, Text], space_attr: Union[str, Text]) -> bool: ...
def get_name(self, name_attr: Union[str, Text], space_attr: Union[str, Text]) -> Schema: ...
def prune_namespace(self, properties): ...
def add_name(self, name_attr, space_attr, new_schema): ...

class NamedSchema(Schema):
def __init__(self, type, name, namespace=None, names=None, other_props=None): ...
def name_ref(self, names): ...
name = ... # type: Any
namespace = ... # type: Any
fullname = ... # type: Any

class Field:
type = ... # type: Any
name = ... # type: Any
def __init__(self, type, name, has_default, default=None, order=None, names=None, doc=None, other_props=None): ...
default = ... # type: Any
has_default = ... # type: Any
order = ... # type: Any
doc = ... # type: Any
props = ... # type: Any
other_props = ... # type: Any
def get_prop(self, key): ...
def set_prop(self, key, value): ...
def to_json(self, names=None): ...
def __eq__(self, that): ...

class PrimitiveSchema(Schema):
fullname = ... # type: Any
def __init__(self, type, other_props=None): ...
def to_json(self, names=None): ...
def __eq__(self, that): ...

class FixedSchema(NamedSchema):
def __init__(self, name, namespace, size, names=None, other_props=None): ...
size = ... # type: Any
def to_json(self, names=None): ...
def __eq__(self, that): ...

class EnumSchema(NamedSchema):
def __init__(self, name, namespace, symbols, names=None, doc=None, other_props=None): ...
symbols = ... # type: Any
doc = ... # type: Any
def to_json(self, names=None): ...
def __eq__(self, that): ...

class ArraySchema(Schema):
def __init__(self, items, names=None, other_props=None): ...
items = ... # type: Any
def to_json(self, names=None): ...
def __eq__(self, that): ...

class MapSchema(Schema):
def __init__(self, values, names=None, other_props=None): ...
values = ... # type: Any
def to_json(self, names=None): ...
def __eq__(self, that): ...

class UnionSchema(Schema):
def __init__(self, schemas, names=None): ...
schemas = ... # type: Any
def to_json(self, names=None): ...
def __eq__(self, that): ...

class ErrorUnionSchema(UnionSchema):
def __init__(self, schemas, names=None): ...
def to_json(self, names=None): ...

class RecordSchema(NamedSchema):
@staticmethod
def make_field_objects(field_data, names): ...
def __init__(self, name, namespace, fields, names=None, schema_type='', doc=None, other_props=None): ...
fields = ... # type: Any
doc = ... # type: Any
@property
def fields_dict(self): ...
def to_json(self, names=None): ...
def __eq__(self, that): ...

def get_other_props(all_props, reserved_props): ...
def make_avsc_object(json_data: Union[Dict, List, str], names: Names) -> Schema: ...
def parse(json_string): ...
10 changes: 10 additions & 0 deletions typeshed/2and3/cachecontrol/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Stubs for cachecontrol (Python 2)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.

from typing import Any
from .wrapper import CacheControl as CacheControl
#from .adapter import CacheControlAdapter as CacheControlAdapter
#from .controller import CacheController as CacheController

__email__ = ... # type: Any
19 changes: 19 additions & 0 deletions typeshed/2and3/cachecontrol/adapter.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Stubs for cachecontrol.adapter (Python 2)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.

from typing import Any
from requests.adapters import HTTPAdapter
from .controller import CacheController as CacheController
from .cache import DictCache as DictCache
from .filewrapper import CallbackFileWrapper as CallbackFileWrapper

class CacheControlAdapter(HTTPAdapter):
invalidating_methods = ... # type: Any
cache = ... # type: Any
heuristic = ... # type: Any
controller = ... # type: Any
def __init__(self, cache=None, cache_etags=True, controller_class=None, serializer=None, heuristic=None, *args, **kw): ...
def send(self, request, **kw): ...
def build_response(self, request, response, from_cache=False): ...
def close(self): ...
19 changes: 19 additions & 0 deletions typeshed/2and3/cachecontrol/cache.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Stubs for cachecontrol.cache (Python 2)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.

from typing import Any

class BaseCache:
def get(self, key): ...
def set(self, key, value): ...
def delete(self, key): ...
def close(self): ...

class DictCache(BaseCache):
lock = ... # type: Any
data = ... # type: Any
def __init__(self, init_dict=None): ...
def get(self, key): ...
def set(self, key, value): ...
def delete(self, key): ...
9 changes: 9 additions & 0 deletions typeshed/2and3/cachecontrol/caches/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Stubs for cachecontrol.caches (Python 2)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.

from typing import Any
from .file_cache import FileCache as FileCache
#from .redis_cache import RedisCache as RedisCache

notice = ... # type: Any
22 changes: 22 additions & 0 deletions typeshed/2and3/cachecontrol/caches/file_cache.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Stubs for cachecontrol.caches.file_cache (Python 2)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.

from typing import Any, Callable
from ..cache import BaseCache as BaseCache
from ..controller import CacheController as CacheController

class FileCache(BaseCache):
directory = ... # type: str
forever = ... # type: bool
filemode = ... # type: str
dirmode = ... # type: str
lock_class = ... # type: Callable
def __init__(self, directory: str, forever=False, filemode=384, dirmode=448, use_dir_lock=None, lock_class=None) -> None: ...
@staticmethod
def encode(x): ...
def get(self, key): ...
def set(self, key, value): ...
def delete(self, key): ...

def url_to_file_path(url, filecache): ...
7 changes: 7 additions & 0 deletions typeshed/2and3/cachecontrol/compat.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Stubs for cachecontrol.compat (Python 2)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.

from typing import Any

text_type = ... # type: Any
25 changes: 25 additions & 0 deletions typeshed/2and3/cachecontrol/controller.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Stubs for cachecontrol.controller (Python 2)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.

from typing import Any
#from .cache import DictCache as DictCache
#from .serialize import Serializer as Serializer

logger = ... # type: Any
URI = ... # type: Any

def parse_uri(uri): ...

class CacheController:
cache = ... # type: Any
cache_etags = ... # type: Any
serializer = ... # type: Any
def __init__(self, cache=None, cache_etags=True, serializer=None): ...
@classmethod
def cache_url(cls, uri): ...
def parse_cache_control(self, headers): ...
def cached_request(self, request): ...
def conditional_headers(self, request): ...
def cache_response(self, request, response, body=None): ...
def update_cached_response(self, request, response): ...
8 changes: 8 additions & 0 deletions typeshed/2and3/cachecontrol/filewrapper.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Stubs for cachecontrol.filewrapper (Python 2)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.

class CallbackFileWrapper:
def __init__(self, fp, callback): ...
def __getattr__(self, name): ...
def read(self, amt=None): ...
10 changes: 10 additions & 0 deletions typeshed/2and3/cachecontrol/serialize.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Stubs for cachecontrol.serialize (Python 2)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.

from .compat import HTTPResponse as HTTPResponse, pickle as pickle, text_type as text_type

class Serializer:
def dumps(self, request, response, body=None): ...
def loads(self, request, data): ...
def prepare_response(self, request, cached): ...
Loading

0 comments on commit f962c94

Please sign in to comment.