Skip to content

Commit 3048360

Browse files
committed
fix C0301: Line too long
1 parent 275dfb3 commit 3048360

File tree

1 file changed

+25
-18
lines changed

1 file changed

+25
-18
lines changed

dspace_rest_client/client.py

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@
33
# and described in the LICENSE.txt file in the root of this project
44

55
"""
6-
DSpace REST API client library. Intended to make interacting with DSpace in Python 3 easier, particularly
7-
when creating, updating, retrieving and deleting DSpace Objects.
8-
This client library is a work in progress and currently only implements the most basic functionality.
9-
It was originally created to assist with a migration of container structure, items and bistreams from a non-DSpace
10-
system to a new DSpace 7 repository.
6+
DSpace REST API client library. Intended to make interacting with DSpace in Python 3 easier,
7+
particularly when creating, updating, retrieving and deleting DSpace Objects.
8+
This client library is a work in progress and currently only implements the most basic
9+
functionality.
10+
It was originally created to assist with a migration of container structure, items and bistreams
11+
from a non-DSpace system to a new DSpace 7 repository.
1112
12-
It needs a lot of expansion: resource policies and permissions, validation of prepared objects and responses,
13-
better abstracting and handling of HAL-like API responses, plus just all the other endpoints and operations implemented.
13+
It needs a lot of expansion: resource policies and permissions, validation of prepared objects
14+
and responses, better abstracting and handling of HAL-like API responses, plus just all the other
15+
endpoints and operations implemented.
1416
1517
@author Kim Shepherd <[email protected]>
1618
"""
@@ -48,11 +50,12 @@ def parse_json(response):
4850

4951
class DSpaceClient:
5052
"""
51-
Main class of the API client itself. This client uses request sessions to connect and authenticate to
52-
the REST API, maintain XSRF tokens, and all GET, POST, PUT, PATCH operations.
53-
Low-level api_get, api_post, api_put, api_delete, api_patch functions are defined to handle the requests and do
54-
retries / XSRF refreshes where necessary.
55-
Higher level get, create, update, partial_update (patch) functions are implemented for each DSO type
53+
Main class of the API client itself. This client uses request sessions to connect and
54+
authenticate to the REST API, maintain XSRF tokens, and all GET, POST, PUT, PATCH operations.
55+
Low-level api_get, api_post, api_put, api_delete, api_patch functions are defined to
56+
handle the requests and do retries / XSRF refreshes where necessary.
57+
Higher level get, create, update, partial_update (patch) functions are implemented
58+
for each DSO type
5659
"""
5760
# Set up basic environment, variables
5861
session = None
@@ -87,11 +90,13 @@ class PatchOperation:
8790

8891
def paginated(embed_name, item_constructor, embedding=lambda x: x):
8992
"""
90-
@param embed_name: The key under '_embedded' in the JSON response that contains the resources to be paginated.
91-
(e.g. 'collections', 'objects', 'items', etc.)
93+
@param embed_name: The key under '_embedded' in the JSON response that contains the
94+
resources to be paginated. (e.g. 'collections', 'objects', 'items', etc.)
9295
@param item_constructor: A callable that takes a resource dictionary and returns an item.
93-
@param embedding: Optional post-fetch processing lambda (default: identity function) for each resource
94-
@return: A decorator that, when applied to a method, follows pagination and yields each resource
96+
@param embedding: Optional post-fetch processing lambda (default: identity function)
97+
for each resource
98+
@return: A decorator that, when applied to a method, follows pagination and yields
99+
each resource
95100
"""
96101
def decorator(fun):
97102
@functools.wraps(fun)
@@ -120,9 +125,11 @@ def do_paginate(url, params):
120125
def __init__(self, api_endpoint=API_ENDPOINT, username=USERNAME, password=PASSWORD, solr_endpoint=SOLR_ENDPOINT,
121126
solr_auth=SOLR_AUTH, fake_user_agent=False):
122127
"""
123-
Accept optional API endpoint, username, password arguments using the OS environment variables as defaults
128+
Accept optional API endpoint, username, password arguments using the OS environment
129+
variables as defaults
124130
:param api_endpoint: base path to DSpace REST API, eg. http://localhost:8080/server/api
125-
:param username: username with appropriate privileges to perform operations on REST API
131+
:param username: username with appropriate privileges to perform operations on
132+
REST API
126133
:param password: password for the above username
127134
"""
128135
self.session = requests.Session()

0 commit comments

Comments
 (0)