Skip to content

Commit 0447f4a

Browse files
🎨 [pre-commit.ci] Auto format from pre-commit.com hooks
1 parent 999c196 commit 0447f4a

36 files changed

+1763
-2198
lines changed

‎docs/conf.py

+5-7
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'UPDATE.md']
8181

8282
# The name of the Pygments (syntax highlighting) style to use.
83-
pygments_style = "sphinx"
83+
pygments_style = 'sphinx'
8484

8585
# If true, `todo` and `todoList` produce output, else they produce nothing.
8686
todo_include_todos = False
@@ -90,22 +90,22 @@
9090

9191
# The theme to use for HTML and HTML Help pages. See the documentation for
9292
# a list of builtin themes.
93-
html_theme = "furo"
93+
html_theme = 'furo'
9494

9595
# Theme options are theme-specific and customize the look and feel of a theme
9696
# further. For a list of options available for each theme, see the
9797
# documentation.
9898
#
9999
html_theme_options = {
100-
"sidebar_hide_name": True,
100+
'sidebar_hide_name': True,
101101
}
102102

103103
# Add any paths that contain custom static files (such as style sheets) here,
104104
# relative to this directory. They are copied after the builtin static files,
105105
# so a file named "default.css" will overwrite the builtin "default.css".
106106
html_static_path = ['_static']
107107

108-
html_logo = "_static/images/papermill.png"
108+
html_logo = '_static/images/papermill.png'
109109

110110
# -- Options for HTMLHelp output ------------------------------------------
111111

@@ -132,9 +132,7 @@
132132
# Grouping the document tree into LaTeX files. List of tuples
133133
# (source start file, target name, title,
134134
# author, documentclass [howto, manual, or own class]).
135-
latex_documents = [
136-
(master_doc, 'papermill.tex', 'papermill Documentation', 'nteract team', 'manual')
137-
]
135+
latex_documents = [(master_doc, 'papermill.tex', 'papermill Documentation', 'nteract team', 'manual')]
138136

139137

140138
# -- Options for manual page output ---------------------------------------

‎papermill/__init__.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
from .version import version as __version__
2-
31
from .exceptions import PapermillException, PapermillExecutionError
42
from .execute import execute_notebook
53
from .inspection import inspect_notebook
4+
from .version import version as __version__

‎papermill/__main__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
from papermill.cli import papermill
22

3-
if __name__ == "__main__":
3+
if __name__ == '__main__':
44
papermill()

‎papermill/abs.py

+16-28
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
"""Utilities for working with Azure blob storage"""
2-
import re
32
import io
3+
import re
44

5-
from azure.storage.blob import BlobServiceClient
65
from azure.identity import EnvironmentCredential
6+
from azure.storage.blob import BlobServiceClient
77

88

99
class AzureBlobStore:
@@ -20,7 +20,7 @@ class AzureBlobStore:
2020

2121
def _blob_service_client(self, account_name, sas_token=None):
2222
blob_service_client = BlobServiceClient(
23-
account_url=f"{account_name}.blob.core.windows.net",
23+
account_url=f'{account_name}.blob.core.windows.net',
2424
credential=sas_token or EnvironmentCredential(),
2525
)
2626

@@ -32,50 +32,38 @@ def _split_url(self, url):
3232
see: https://docs.microsoft.com/en-us/azure/storage/common/storage-dotnet-shared-access-signature-part-1 # noqa: E501
3333
abs://myaccount.blob.core.windows.net/sascontainer/sasblob.txt?sastoken
3434
"""
35-
match = re.match(
36-
r"abs://(.*)\.blob\.core\.windows\.net\/(.*?)\/([^\?]*)\??(.*)$", url
37-
)
35+
match = re.match(r'abs://(.*)\.blob\.core\.windows\.net\/(.*?)\/([^\?]*)\??(.*)$', url)
3836
if not match:
3937
raise Exception(f"Invalid azure blob url '{url}'")
4038
else:
4139
params = {
42-
"account": match.group(1),
43-
"container": match.group(2),
44-
"blob": match.group(3),
45-
"sas_token": match.group(4),
40+
'account': match.group(1),
41+
'container': match.group(2),
42+
'blob': match.group(3),
43+
'sas_token': match.group(4),
4644
}
4745
return params
4846

4947
def read(self, url):
5048
"""Read storage at a given url"""
5149
params = self._split_url(url)
5250
output_stream = io.BytesIO()
53-
blob_service_client = self._blob_service_client(
54-
params["account"], params["sas_token"]
55-
)
56-
blob_client = blob_service_client.get_blob_client(
57-
params["container"], params["blob"]
58-
)
51+
blob_service_client = self._blob_service_client(params['account'], params['sas_token'])
52+
blob_client = blob_service_client.get_blob_client(params['container'], params['blob'])
5953
blob_client.download_blob().readinto(output_stream)
6054
output_stream.seek(0)
61-
return [line.decode("utf-8") for line in output_stream]
55+
return [line.decode('utf-8') for line in output_stream]
6256

6357
def listdir(self, url):
6458
"""Returns a list of the files under the specified path"""
6559
params = self._split_url(url)
66-
blob_service_client = self._blob_service_client(
67-
params["account"], params["sas_token"]
68-
)
69-
container_client = blob_service_client.get_container_client(params["container"])
70-
return list(container_client.list_blobs(params["blob"]))
60+
blob_service_client = self._blob_service_client(params['account'], params['sas_token'])
61+
container_client = blob_service_client.get_container_client(params['container'])
62+
return list(container_client.list_blobs(params['blob']))
7163

7264
def write(self, buf, url):
7365
"""Write buffer to storage at a given url"""
7466
params = self._split_url(url)
75-
blob_service_client = self._blob_service_client(
76-
params["account"], params["sas_token"]
77-
)
78-
blob_client = blob_service_client.get_blob_client(
79-
params["container"], params["blob"]
80-
)
67+
blob_service_client = self._blob_service_client(params['account'], params['sas_token'])
68+
blob_client = blob_service_client.get_blob_client(params['container'], params['blob'])
8169
blob_client.upload_blob(data=buf, overwrite=True)

‎papermill/adl.py

+3-8
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def __init__(self):
2121

2222
@classmethod
2323
def _split_url(cls, url):
24-
match = re.match(r"adl://(.*)\.azuredatalakestore\.net\/(.*)$", url)
24+
match = re.match(r'adl://(.*)\.azuredatalakestore\.net\/(.*)$', url)
2525
if not match:
2626
raise Exception(f"Invalid ADL url '{url}'")
2727
else:
@@ -39,12 +39,7 @@ def listdir(self, url):
3939
"""Returns a list of the files under the specified path"""
4040
(store_name, path) = self._split_url(url)
4141
adapter = self._create_adapter(store_name)
42-
return [
43-
"adl://{store_name}.azuredatalakestore.net/{path_to_child}".format(
44-
store_name=store_name, path_to_child=path_to_child
45-
)
46-
for path_to_child in adapter.ls(path)
47-
]
42+
return [f'adl://{store_name}.azuredatalakestore.net/{path_to_child}' for path_to_child in adapter.ls(path)]
4843

4944
def read(self, url):
5045
"""Read storage at a given url"""
@@ -60,5 +55,5 @@ def write(self, buf, url):
6055
"""Write buffer to storage at a given url"""
6156
(store_name, path) = self._split_url(url)
6257
adapter = self._create_adapter(store_name)
63-
with adapter.open(path, "wb") as f:
58+
with adapter.open(path, 'wb') as f:
6459
f.write(buf.encode())

0 commit comments

Comments
 (0)