Skip to content

Commit 6153f97

Browse files
🎨 [pre-commit.ci] Auto format from pre-commit.com hooks
1 parent 09572be commit 6153f97

36 files changed

+1729
-1757
lines changed

‎docs/conf.py

+4-4
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

‎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-16
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

@@ -33,16 +33,16 @@ def _split_url(self, url):
3333
abs://myaccount.blob.core.windows.net/sascontainer/sasblob.txt?sastoken
3434
"""
3535
match = re.match(
36-
r"abs://(.*)\.blob\.core\.windows\.net\/(.*?)\/([^\?]*)\??(.*)$", url
36+
r'abs://(.*)\.blob\.core\.windows\.net\/(.*?)\/([^\?]*)\??(.*)$', url
3737
)
3838
if not match:
3939
raise Exception(f"Invalid azure blob url '{url}'")
4040
else:
4141
params = {
42-
"account": match.group(1),
43-
"container": match.group(2),
44-
"blob": match.group(3),
45-
"sas_token": match.group(4),
42+
'account': match.group(1),
43+
'container': match.group(2),
44+
'blob': match.group(3),
45+
'sas_token': match.group(4),
4646
}
4747
return params
4848

@@ -51,31 +51,31 @@ def read(self, url):
5151
params = self._split_url(url)
5252
output_stream = io.BytesIO()
5353
blob_service_client = self._blob_service_client(
54-
params["account"], params["sas_token"]
54+
params['account'], params['sas_token']
5555
)
5656
blob_client = blob_service_client.get_blob_client(
57-
params["container"], params["blob"]
57+
params['container'], params['blob']
5858
)
5959
blob_client.download_blob().readinto(output_stream)
6060
output_stream.seek(0)
61-
return [line.decode("utf-8") for line in output_stream]
61+
return [line.decode('utf-8') for line in output_stream]
6262

6363
def listdir(self, url):
6464
"""Returns a list of the files under the specified path"""
6565
params = self._split_url(url)
6666
blob_service_client = self._blob_service_client(
67-
params["account"], params["sas_token"]
67+
params['account'], params['sas_token']
6868
)
69-
container_client = blob_service_client.get_container_client(params["container"])
70-
return list(container_client.list_blobs(params["blob"]))
69+
container_client = blob_service_client.get_container_client(params['container'])
70+
return list(container_client.list_blobs(params['blob']))
7171

7272
def write(self, buf, url):
7373
"""Write buffer to storage at a given url"""
7474
params = self._split_url(url)
7575
blob_service_client = self._blob_service_client(
76-
params["account"], params["sas_token"]
76+
params['account'], params['sas_token']
7777
)
7878
blob_client = blob_service_client.get_blob_client(
79-
params["container"], params["blob"]
79+
params['container'], params['blob']
8080
)
8181
blob_client.upload_blob(data=buf, overwrite=True)

‎papermill/adl.py

+3-5
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:
@@ -40,9 +40,7 @@ def listdir(self, url):
4040
(store_name, path) = self._split_url(url)
4141
adapter = self._create_adapter(store_name)
4242
return [
43-
"adl://{store_name}.azuredatalakestore.net/{path_to_child}".format(
44-
store_name=store_name, path_to_child=path_to_child
45-
)
43+
f'adl://{store_name}.azuredatalakestore.net/{path_to_child}'
4644
for path_to_child in adapter.ls(path)
4745
]
4846

@@ -60,5 +58,5 @@ def write(self, buf, url):
6058
"""Write buffer to storage at a given url"""
6159
(store_name, path) = self._split_url(url)
6260
adapter = self._create_adapter(store_name)
63-
with adapter.open(path, "wb") as f:
61+
with adapter.open(path, 'wb') as f:
6462
f.write(buf.encode())

0 commit comments

Comments
 (0)