Skip to content

Commit 14d51ca

Browse files
committed
fix types
1 parent 7dbffaf commit 14d51ca

File tree

12 files changed

+148
-4
lines changed

12 files changed

+148
-4
lines changed

schema_salad/ref_resolver.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from .flatten import flatten
1616

1717
import requests
18-
from cachecontrol import CacheControl
18+
from cachecontrol.wrapper import CacheControl
1919
from cachecontrol.caches import FileCache
2020
import ruamel.yaml as yaml
2121

@@ -80,7 +80,7 @@ class Loader(object):
8080

8181
def __init__(self, ctx, schemagraph=None, foreign_properties=None,
8282
idx=None, cache=None, session=None):
83-
# type: (Loader.ContextType, rdflib.Graph, Set[unicode], Dict[unicode, Union[List, Dict[unicode, Any], unicode]], Dict[unicode, Any]) -> None
83+
# type: (Loader.ContextType, rdflib.Graph, Set[unicode], Dict[unicode, Union[List, Dict[unicode, Any], unicode]], Dict[unicode, Any], requests.sessions.Session) -> None
8484
normalize = lambda url: urlparse.urlsplit(url).geturl()
8585
if idx is not None:
8686
self.idx = idx
@@ -103,6 +103,7 @@ def __init__(self, ctx, schemagraph=None, foreign_properties=None,
103103
else:
104104
self.cache = {}
105105

106+
self.session = None # type: requests.sessions.Session
106107
if session is not None:
107108
self.session = session
108109
else:
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Stubs for cachecontrol (Python 2)
2+
#
3+
# NOTE: This dynamically typed stub was automatically generated by stubgen.
4+
5+
from typing import Any
6+
from .wrapper import CacheControl as CacheControl
7+
#from .adapter import CacheControlAdapter as CacheControlAdapter
8+
#from .controller import CacheController as CacheController
9+
10+
__email__ = ... # type: Any

typeshed/2.7/cachecontrol/adapter.pyi

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Stubs for cachecontrol.adapter (Python 2)
2+
#
3+
# NOTE: This dynamically typed stub was automatically generated by stubgen.
4+
5+
from typing import Any
6+
from requests.adapters import HTTPAdapter
7+
from .controller import CacheController as CacheController
8+
from .cache import DictCache as DictCache
9+
from .filewrapper import CallbackFileWrapper as CallbackFileWrapper
10+
11+
class CacheControlAdapter(HTTPAdapter):
12+
invalidating_methods = ... # type: Any
13+
cache = ... # type: Any
14+
heuristic = ... # type: Any
15+
controller = ... # type: Any
16+
def __init__(self, cache=None, cache_etags=True, controller_class=None, serializer=None, heuristic=None, *args, **kw): ...
17+
def send(self, request, **kw): ...
18+
def build_response(self, request, response, from_cache=False): ...
19+
def close(self): ...

typeshed/2.7/cachecontrol/cache.pyi

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Stubs for cachecontrol.cache (Python 2)
2+
#
3+
# NOTE: This dynamically typed stub was automatically generated by stubgen.
4+
5+
from typing import Any
6+
7+
class BaseCache:
8+
def get(self, key): ...
9+
def set(self, key, value): ...
10+
def delete(self, key): ...
11+
def close(self): ...
12+
13+
class DictCache(BaseCache):
14+
lock = ... # type: Any
15+
data = ... # type: Any
16+
def __init__(self, init_dict=None): ...
17+
def get(self, key): ...
18+
def set(self, key, value): ...
19+
def delete(self, key): ...
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Stubs for cachecontrol.caches (Python 2)
2+
#
3+
# NOTE: This dynamically typed stub was automatically generated by stubgen.
4+
5+
from typing import Any
6+
from .file_cache import FileCache as FileCache
7+
#from .redis_cache import RedisCache as RedisCache
8+
9+
notice = ... # type: Any
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Stubs for cachecontrol.caches.file_cache (Python 2)
2+
#
3+
# NOTE: This dynamically typed stub was automatically generated by stubgen.
4+
5+
from typing import Any, Callable
6+
from ..cache import BaseCache as BaseCache
7+
from ..controller import CacheController as CacheController
8+
9+
class FileCache(BaseCache):
10+
directory = ... # type: str
11+
forever = ... # type: bool
12+
filemode = ... # type: str
13+
dirmode = ... # type: str
14+
lock_class = ... # type: Callable
15+
def __init__(self, directory: str, forever=False, filemode=384, dirmode=448, use_dir_lock=None, lock_class=None) -> None: ...
16+
@staticmethod
17+
def encode(x): ...
18+
def get(self, key): ...
19+
def set(self, key, value): ...
20+
def delete(self, key): ...
21+
22+
def url_to_file_path(url, filecache): ...

typeshed/2.7/cachecontrol/compat.pyi

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Stubs for cachecontrol.compat (Python 2)
2+
#
3+
# NOTE: This dynamically typed stub was automatically generated by stubgen.
4+
5+
from typing import Any
6+
7+
text_type = ... # type: Any
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Stubs for cachecontrol.controller (Python 2)
2+
#
3+
# NOTE: This dynamically typed stub was automatically generated by stubgen.
4+
5+
from typing import Any
6+
#from .cache import DictCache as DictCache
7+
#from .serialize import Serializer as Serializer
8+
9+
logger = ... # type: Any
10+
URI = ... # type: Any
11+
12+
def parse_uri(uri): ...
13+
14+
class CacheController:
15+
cache = ... # type: Any
16+
cache_etags = ... # type: Any
17+
serializer = ... # type: Any
18+
def __init__(self, cache=None, cache_etags=True, serializer=None): ...
19+
@classmethod
20+
def cache_url(cls, uri): ...
21+
def parse_cache_control(self, headers): ...
22+
def cached_request(self, request): ...
23+
def conditional_headers(self, request): ...
24+
def cache_response(self, request, response, body=None): ...
25+
def update_cached_response(self, request, response): ...
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Stubs for cachecontrol.filewrapper (Python 2)
2+
#
3+
# NOTE: This dynamically typed stub was automatically generated by stubgen.
4+
5+
class CallbackFileWrapper:
6+
def __init__(self, fp, callback): ...
7+
def __getattr__(self, name): ...
8+
def read(self, amt=None): ...
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Stubs for cachecontrol.serialize (Python 2)
2+
#
3+
# NOTE: This dynamically typed stub was automatically generated by stubgen.
4+
5+
from .compat import HTTPResponse as HTTPResponse, pickle as pickle, text_type as text_type
6+
7+
class Serializer:
8+
def dumps(self, request, response, body=None): ...
9+
def loads(self, request, data): ...
10+
def prepare_response(self, request, cached): ...

typeshed/2.7/cachecontrol/wrapper.pyi

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Stubs for cachecontrol.wrapper (Python 2)
2+
#
3+
# NOTE: This dynamically typed stub was automatically generated by stubgen.
4+
5+
from typing import Union
6+
from .adapter import CacheControlAdapter as CacheControlAdapter
7+
from .cache import DictCache, BaseCache
8+
import requests
9+
10+
def CacheControl(sess: requests.sessions.Session,
11+
cache: Union[DictCache, BaseCache] = None,
12+
cache_etags: bool = True,
13+
serializer=None,
14+
heuristic=None) -> requests.sessions.Session: ...

typeshed/2.7/requests/sessions.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Stubs for requests.sessions (Python 3)
22

3-
from typing import Any, Union, MutableMapping
3+
from typing import Any, AnyStr, Union, MutableMapping
44
from . import auth
55
from . import compat
66
from . import cookies
@@ -76,7 +76,7 @@ class Session(SessionRedirectMixin):
7676
cookies=..., files=..., auth=..., timeout=..., allow_redirects=...,
7777
proxies=..., hooks=..., stream=..., verify=..., cert=...,
7878
json=...) -> Response: ...
79-
def get(self, url: str, **kwargs) -> Response: ...
79+
def get(self, url: AnyStr, **kwargs) -> Response: ...
8080
def options(self, url: str, **kwargs) -> Response: ...
8181
def head(self, url: str, **kwargs) -> Response: ...
8282
def post(self, url: str, data=..., json=..., **kwargs) -> Response: ...

0 commit comments

Comments
 (0)