Skip to content

Commit 6c4aa79

Browse files
Fixed workflow file to use --check for black
1 parent 9c8f91d commit 6c4aa79

File tree

4 files changed

+12
-19
lines changed

4 files changed

+12
-19
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,4 @@ jobs:
5353
5454
- name: Run pylint and black on ./documentcloud and ./tests
5555
run: |
56-
pylint ./documentcloud ./tests; black ./documentcloud ./tests
56+
pylint ./documentcloud ./tests; black --check ./documentcloud ./tests

documentcloud/client.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@
1414

1515
logger = logging.getLogger("documentcloud")
1616

17+
1718
class DocumentCloud(SquareletClient):
1819
"""
1920
The public interface for the DocumentCloud API, now integrated with SquareletClient
2021
"""
22+
2123
def __init__(
2224
self,
2325
username=None,
@@ -29,15 +31,15 @@ def __init__(
2931
rate_limit=True,
3032
rate_limit_sleep=True,
3133
):
32-
# Initialize SquareletClient for authentication and request handling
34+
# Initialize SquareletClient for authentication and request handling
3335
super().__init__(
3436
base_uri=base_uri,
3537
username=username,
3638
password=password,
3739
auth_uri=auth_uri,
3840
timeout=timeout,
3941
rate_limit=rate_limit,
40-
rate_limit_sleep=rate_limit_sleep
42+
rate_limit_sleep=rate_limit_sleep,
4143
)
4244

4345
# Set up logging

documentcloud/documents.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -404,9 +404,7 @@ def upload_directory(self, path, handle_errors=False, extensions=".pdf", **kwarg
404404
path_list = self._collect_files(path, extensions)
405405

406406
logger.info(
407-
"Upload directory on %s: Found %d files to upload",
408-
path,
409-
len(path_list)
407+
"Upload directory on %s: Found %d files to upload", path, len(path_list)
410408
)
411409

412410
# Upload all the files using the bulk API to reduce the number
@@ -444,7 +442,7 @@ def upload_directory(self, path, handle_errors=False, extensions=".pdf", **kwarg
444442
logger.info(
445443
"Error creating the following documents: %s\n%s",
446444
exc,
447-
"\n".join(file_paths)
445+
"\n".join(file_paths),
448446
)
449447
continue
450448
else:
@@ -465,7 +463,7 @@ def upload_directory(self, path, handle_errors=False, extensions=".pdf", **kwarg
465463
logger.info(
466464
"Error uploading the following document: %s %s",
467465
exc,
468-
file_path
466+
file_path,
469467
)
470468
continue
471469
else:
@@ -481,7 +479,7 @@ def upload_directory(self, path, handle_errors=False, extensions=".pdf", **kwarg
481479
logger.info(
482480
"Error creating the following documents: %s\n%s",
483481
exc,
484-
"\n".join(file_paths)
482+
"\n".join(file_paths),
485483
)
486484
continue
487485
else:
@@ -504,11 +502,7 @@ def upload_urls(self, url_list, handle_errors=False, **kwargs):
504502
# Grouper will put None's on the end of the last group
505503
url_group = [url for url in url_group if url is not None]
506504

507-
logger.info(
508-
"Uploading group %d: %s",
509-
i + 1,
510-
"\n".join(url_group)
511-
)
505+
logger.info("Uploading group %d: %s", i + 1, "\n".join(url_group))
512506

513507
# Create the documents
514508
logger.info("Creating the documents...")
@@ -531,7 +525,7 @@ def upload_urls(self, url_list, handle_errors=False, **kwargs):
531525
logger.info(
532526
"Error creating the following documents: %s\n%s",
533527
str(exc),
534-
"\n".join(url_group)
528+
"\n".join(url_group),
535529
)
536530
continue
537531
else:

tests/test_documents.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,7 @@ def test_section(self, document_factory):
158158

159159
class TestDocumentClient:
160160
def test_search(self, client, document):
161-
documents = client.documents.search(
162-
f"document:{document.id} simple"
163-
)
161+
documents = client.documents.search(f"document:{document.id} simple")
164162
assert documents
165163

166164
def test_list(self, client):
@@ -182,7 +180,6 @@ def test_upload_file(self, document_factory):
182180
document = document_factory(pdf)
183181
assert document.status == "success"
184182

185-
186183
def test_upload_file_path(self, document_factory):
187184
document = document_factory("tests/test.pdf")
188185
assert document.status == "success"

0 commit comments

Comments
 (0)