Skip to content

Commit fdb9b90

Browse files
committed
update pre-commit
re-run autofixers. Mostly whitespace requirements-txt fixer is not useful on generated files
1 parent d3c9a2a commit fdb9b90

File tree

16 files changed

+57
-59
lines changed

16 files changed

+57
-59
lines changed

.pre-commit-config.yaml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
repos:
22
- repo: https://github.com/asottile/reorder_python_imports
3-
rev: v1.3.5
3+
rev: v2.6.0
44
hooks:
55
- id: reorder-python-imports
6-
language_version: python3
76
- repo: https://github.com/ambv/black
8-
rev: 18.9b0
7+
rev: "21.12b0"
98
hooks:
109
- id: black
10+
- repo: https://github.com/PyCQA/flake8
11+
rev: "4.0.1"
12+
hooks:
13+
- id: flake8
1114
- repo: https://github.com/pre-commit/pre-commit-hooks
12-
rev: v2.1.0
15+
rev: v4.1.0
1316
hooks:
1417
- id: end-of-file-fixer
1518
- id: check-json
1619
- id: check-yaml
1720
exclude: ^helm-chart/nbviewer/templates/
1821
- id: check-case-conflict
1922
- id: check-executables-have-shebangs
20-
- id: requirements-txt-fixer
21-
- id: flake8

helm-chart/nbviewer/requirements.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
dependencies:
22
- name: memcached
3-
repository: https://kubernetes-charts.storage.googleapis.com
4-
version: 3.2.2
5-
digest: sha256:b0f92f7e3f8bfeb286cf8566d86c9c795a2712d7c690bdf66eb037dbae7b9036
6-
generated: "2020-03-03T10:17:51.050357+01:00"
3+
repository: https://charts.helm.sh/stable
4+
version: 3.2.3
5+
digest: sha256:b2795a847595ae51ef43c7818c6ed17d0ae66265f4613393581238418c184fb4
6+
generated: "2022-01-28T11:34:43.737858+01:00"

helm-chart/nbviewer/values.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
image: "jupyter/nbviewer"
22
imagePullPolicy: null
33

4-
service: {}
54
nodeSelector: null
65

76
pdbMinAvailable: 2

nbviewer/cache.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ async def incr(self, key):
114114

115115
class AsyncMemcache(object):
116116
"""Wrap pylibmc.Client to run in a background thread
117-
117+
118118
via concurrent.futures.ThreadPoolExecutor
119119
"""
120120

@@ -157,7 +157,7 @@ async def incr(self, *args, **kwargs):
157157

158158
class AsyncMultipartMemcache(AsyncMemcache):
159159
"""subclass of AsyncMemcache that splits large files into multiple chunks
160-
160+
161161
because memcached limits record size to 1MB
162162
"""
163163

nbviewer/client.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,18 @@
2828

2929
class NBViewerAsyncHTTPClient(object):
3030
"""Subclass of AsyncHTTPClient with bonus logging and caching!
31-
31+
3232
If upstream servers support 304 cache replies with the following headers:
33-
33+
3434
- ETag : If-None-Match
3535
- Last-Modified : If-Modified-Since
36-
36+
3737
Upstream requests are still made every time,
3838
but resources and rate limits may be saved by 304 responses.
39-
39+
4040
If upstream responds with 304 or an error and a cached response is available,
4141
use the cached response.
42-
42+
4343
Responses are cached as long as possible.
4444
"""
4545

nbviewer/log.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
def log_request(handler):
1414
"""log a bit more information about each request than tornado's default
15-
15+
1616
- move static file get success to debug-level (reduces noise)
1717
- get proxied IP instead of proxy IP
1818
- log referer for redirect and failed requests

nbviewer/providers/__init__.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@
1717

1818
def provider_handlers(providers, **handler_kwargs):
1919
"""Load tornado URL handlers from an ordered list of dotted-notation modules
20-
which contain a `default_handlers` function
20+
which contain a `default_handlers` function
2121
22-
`default_handlers` should accept a list of handlers and returns an
23-
augmented list of handlers: this allows the addition of, for
24-
example, custom URLs which should be intercepted before being
25-
handed to the basic `url` handler
22+
`default_handlers` should accept a list of handlers and returns an
23+
augmented list of handlers: this allows the addition of, for
24+
example, custom URLs which should be intercepted before being
25+
handed to the basic `url` handler
2626
27-
`handler_kwargs` is a dict of dicts: first dict is `handler_names`, which
28-
specifies the handler_classes to load for the providers, the second
29-
is `handler_settings` (see comments in `format_handlers` in nbviewer/handlers.py)
27+
`handler_kwargs` is a dict of dicts: first dict is `handler_names`, which
28+
specifies the handler_classes to load for the providers, the second
29+
is `handler_settings` (see comments in `format_handlers` in nbviewer/handlers.py)
3030
"""
3131
handler_names = handler_kwargs["handler_names"]
3232
handler_settings = handler_kwargs["handler_settings"]
@@ -45,23 +45,23 @@ def provider_handlers(providers, **handler_kwargs):
4545

4646
def provider_uri_rewrites(providers):
4747
"""Load (regex, template) tuples from an ordered list of dotted-notation
48-
modules which contain a `uri_rewrites` function
48+
modules which contain a `uri_rewrites` function
4949
50-
`uri_rewrites` should accept a list of rewrites and returns an
51-
augmented list of rewrites: this allows the addition of, for
52-
example, the greedy behavior of the `gist` and `github` providers
50+
`uri_rewrites` should accept a list of rewrites and returns an
51+
augmented list of rewrites: this allows the addition of, for
52+
example, the greedy behavior of the `gist` and `github` providers
5353
"""
5454
return _load_provider_feature("uri_rewrites", providers)
5555

5656

5757
def _load_provider_feature(feature, providers, **handler_names):
5858
"""Load the named feature from an ordered list of dotted-notation modules
59-
which each implements the feature.
59+
which each implements the feature.
6060
61-
The feature will be passed a list of feature implementations and must
62-
return that list, suitably modified.
61+
The feature will be passed a list of feature implementations and must
62+
return that list, suitably modified.
6363
64-
`handler_names` is the same as the `handler_names` attribute of the NBViewer class
64+
`handler_names` is the same as the `handler_names` attribute of the NBViewer class
6565
"""
6666

6767
# Ex: provider = 'nbviewer.providers.url'

nbviewer/providers/base.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ def get_page_links(self, response):
330330

331331
def client_error_message(self, exc, url, body, msg=None):
332332
"""Turn the tornado HTTP error into something useful
333-
333+
334334
Returns error code
335335
"""
336336
str_exc = str(exc)
@@ -466,8 +466,7 @@ def cache_headers(self):
466466

467467
@property
468468
def cache_key(self):
469-
"""Use checksum for cache key because cache has size limit on keys
470-
"""
469+
"""Use checksum for cache key because cache has size limit on keys"""
471470

472471
if self._cache_key is None:
473472
to_hash = utf8(getattr(self.request, self._cache_key_attr))
@@ -635,12 +634,12 @@ def filter_formats(self, nb, raw):
635634
# empty methods to be implemented by subclasses to make GET requests more modular
636635
def get_notebook_data(self, **kwargs):
637636
"""
638-
Pass as kwargs variables needed to define those variables which will be necessary for
639-
the provider to find the notebook. (E.g. path for LocalHandler, user and repo for GitHub.)
637+
Pass as kwargs variables needed to define those variables which will be necessary for
638+
the provider to find the notebook. (E.g. path for LocalHandler, user and repo for GitHub.)
640639
Return variables the provider needs to find and load the notebook. Then run custom logic
641640
in GET or pass the output of get_notebook_data immediately to deliver_notebook.
642641
643-
First part of any provider's GET method.
642+
First part of any provider's GET method.
644643
645644
Custom logic, if applicable, is middle part of any provider's GET method, and usually
646645
is implemented or overwritten in subclasses, while get_notebook_data and deliver_notebook

nbviewer/providers/gist/handlers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,8 @@ async def get_notebook_data(self, gist_id, filename, many_files_gist, file):
255255
# Only called by file_get
256256
async def deliver_notebook(self, user, gist_id, filename, gist, file, content):
257257
"""
258-
user, gist_id, filename, gist, file, are the same values as those
259-
passed into file_get, whereas content is returned from
258+
user, gist_id, filename, gist, file, are the same values as those
259+
passed into file_get, whereas content is returned from
260260
get_notebook_data using user, gist_id, filename, gist, and file.
261261
"""
262262
# Enable a binder navbar icon if a binder base URL is configured

nbviewer/providers/github/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def _log_rate_limit(self, future):
105105

106106
def github_api_request(self, path, **kwargs):
107107
"""Make a GitHub API request to URL
108-
108+
109109
URL is constructed from url and params, if specified.
110110
**kwargs are passed to client.fetch unmodified.
111111
"""
@@ -165,7 +165,7 @@ def get_tags(self, user, repo, **kwargs):
165165
def extract_tree_entry(self, path, tree_response):
166166
"""extract a single tree entry from
167167
a tree response using for a path
168-
168+
169169
raises 404 if not found
170170
171171
Useful for finding the blob url for a given path.

0 commit comments

Comments
 (0)