-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wip-NXPY-239: fix tests cases on python (Sourcery refactored) #272
wip-NXPY-239: fix tests cases on python (Sourcery refactored) #272
Conversation
Sourcery AI seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
Sourcery Code Quality Report✅ Merging this PR will increase code quality in the affected files by 0.08%.
Here are some functions in these files that still need a tune-up:
Legend and ExplanationThe emojis denote the absolute quality of the code:
The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request. Please see our documentation here for details on how these metrics are calculated. We are actively working on this report - lots more documentation and extra metrics to come! Help us improve this quality report! |
Codecov ReportBase: 96.30% // Head: 96.30% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## wip-NXPY-239-Fix-tests-cases-on-Python #272 +/- ##
==========================================================================
- Coverage 96.30% 96.30% -0.01%
==========================================================================
Files 26 26
Lines 1624 1622 -2
==========================================================================
- Hits 1564 1562 -2
Misses 60 60
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
c7e1ed5
to
22ce714
Compare
e58750d
to
957d6c4
Compare
22ce714
to
9b1f45e
Compare
957d6c4
to
d07f75c
Compare
9b1f45e
to
dd4ca0d
Compare
d07f75c
to
ffad8ac
Compare
dd4ca0d
to
4c4f84f
Compare
ffad8ac
to
f843bf2
Compare
4c4f84f
to
dde5bcc
Compare
f843bf2
to
8df80c1
Compare
dde5bcc
to
0d35141
Compare
8df80c1
to
7fd7d4c
Compare
0d35141
to
0eeedce
Compare
7fd7d4c
to
0f3f655
Compare
0eeedce
to
d21ee43
Compare
0f3f655
to
03a4a92
Compare
d21ee43
to
cab8070
Compare
03a4a92
to
30af321
Compare
cab8070
to
847af55
Compare
30af321
to
c2b3582
Compare
847af55
to
c128aa2
Compare
c2b3582
to
0cb20d3
Compare
c128aa2
to
631b5b5
Compare
0cb20d3
to
28454f8
Compare
631b5b5
to
b8960ef
Compare
28454f8
to
ea11e7f
Compare
384cde0
to
cd5cd8d
Compare
bb4dc60
to
3490dd9
Compare
cd5cd8d
to
7c428aa
Compare
3490dd9
to
643ff73
Compare
7c428aa
to
4d8086d
Compare
operation.params = {"document": WORKSPACE_ROOT + "/Document"} | ||
operation.params = {"document": f"{WORKSPACE_ROOT}/Document"} | ||
operation.input_obj = batch.get(0) | ||
operation.execute(void_op=True) | ||
|
||
operation = server.operations.new("Blob.Get") | ||
operation.input_obj = WORKSPACE_ROOT + "/Document" | ||
operation.input_obj = f"{WORKSPACE_ROOT}/Document" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function test_digester
refactored with the following changes:
- Use f-string instead of string concatenation [×2] (
use-fstring-for-concatenation
)
params={"document": WORKSPACE_ROOT + "/Document"}, | ||
params={"document": f"{WORKSPACE_ROOT}/Document"}, | ||
) | ||
doc = server.documents.get(path=WORKSPACE_ROOT + "/Document") | ||
|
||
doc = server.documents.get(path=f"{WORKSPACE_ROOT}/Document") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function test_execute
refactored with the following changes:
- Use f-string instead of string concatenation [×2] (
use-fstring-for-concatenation
)
operation.params = {"document": WORKSPACE_ROOT + "/Document"} | ||
operation.params = {"document": f"{WORKSPACE_ROOT}/Document"} | ||
operation.input_obj = batch.get(0) | ||
operation.execute() | ||
doc = server.documents.get(path=WORKSPACE_ROOT + "/Document") | ||
doc = server.documents.get(path=f"{WORKSPACE_ROOT}/Document") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function test_operation
refactored with the following changes:
- Use f-string instead of string concatenation [×2] (
use-fstring-for-concatenation
)
operation.params = {"document": WORKSPACE_ROOT + "/Document"} | ||
operation.params = {"document": f"{WORKSPACE_ROOT}/Document"} | ||
operation.input_obj = batch.get(0) | ||
operation.execute(void_op=True) | ||
|
||
operation = server.operations.new("Document.Fetch") | ||
operation.params = {"value": WORKSPACE_ROOT + "/Document"} | ||
operation.params = {"value": f"{WORKSPACE_ROOT}/Document"} | ||
info = operation.execute() | ||
digest = info["properties"]["file:content"]["digest"] | ||
|
||
operation = server.operations.new("Blob.Get") | ||
operation.input_obj = WORKSPACE_ROOT + "/Document" | ||
operation.input_obj = f"{WORKSPACE_ROOT}/Document" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function test_upload
refactored with the following changes:
- Use f-string instead of string concatenation [×3] (
use-fstring-for-concatenation
)
operation.params = {"document": WORKSPACE_ROOT + "/Document"} | ||
operation.params = {"document": f"{WORKSPACE_ROOT}/Document"} | ||
operation.input_obj = batch.get(0) | ||
operation.execute(void_op=True) | ||
|
||
operation = server.operations.new("Document.Fetch") | ||
operation.params = {"value": WORKSPACE_ROOT + "/Document"} | ||
operation.params = {"value": f"{WORKSPACE_ROOT}/Document"} | ||
info = operation.execute() | ||
digest = info["properties"]["file:content"]["digest"] | ||
|
||
operation = server.operations.new("Blob.Get") | ||
operation.input_obj = WORKSPACE_ROOT + "/Document" | ||
operation.input_obj = f"{WORKSPACE_ROOT}/Document" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function test_upload_several_callbacks
refactored with the following changes:
- Use f-string instead of string concatenation [×3] (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "site/automation" | ||
self.url = f"{nuxeo_url}site/automation" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseAutomation.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "small%20file.txt" | ||
self.url = f"{nuxeo_url}small%20file.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseChunkedContents.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "small%20file.txt" | ||
self.url = f"{nuxeo_url}small%20file.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseChunkedJsonContents.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "small%20file.txt" | ||
self.url = f"{nuxeo_url}small%20file.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseChunkedJsonContentsTooLong.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "json/cmis" | ||
self.url = f"{nuxeo_url}json/cmis" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseCmis.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "nothing" | ||
self.url = f"{nuxeo_url}nothing" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseEmpty.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "big%20file.txt" | ||
self.url = f"{nuxeo_url}big%20file.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseTextError.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "small%20file.txt" | ||
self.url = f"{nuxeo_url}small%20file.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseTextOk.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "big%20file.txt" | ||
self.url = f"{nuxeo_url}big%20file.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseTextTooLong.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
assert len(aces) in (2, 3) | ||
assert len(aces) in {2, 3} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function test_fetch_acls
refactored with the following changes:
- Use set when checking membership of a collection of literals (
collection-into-set
)
file_out = filename + ".dl" | ||
file_out = f"{filename}.dl" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function download_file
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
643ff73
to
63746e7
Compare
4d8086d
to
13d9867
Compare
"User-Agent": app_name + "/" + version, | ||
"User-Agent": f"{app_name}/{version}", | ||
"Accept": "application/json, */*", | ||
} | ||
|
||
self.schemas = kwargs.get("schemas", "*") | ||
self.repository = kwargs.pop("repository", "default") | ||
self._session = requests.sessions.Session() | ||
self._session.hooks["response"] = [log_response] | ||
cookies = kwargs.pop("cookies", None) | ||
if cookies: | ||
if cookies := kwargs.pop("cookies", None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function NuxeoClient.__init__
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
) - Use f-string instead of string concatenation [×2] (
use-fstring-for-concatenation
)
data.update(params) | ||
data |= params | ||
|
||
url = self.api_path + "/search/lang/NXQL/execute" | ||
url = f"{self.api_path}/search/lang/NXQL/execute" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function NuxeoClient.query
refactored with the following changes:
- Merge dictionary updates via the union operator (
dict-assign-update-to-union
) - Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
kwargs.update(self.client_kwargs) | ||
kwargs |= self.client_kwargs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function NuxeoClient.request
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
) - Merge dictionary updates via the union operator (
dict-assign-update-to-union
) - Swap if/else branches of if expression to remove negation (
swap-if-expression
)
error_data.update(response.json()) | ||
error_data |= response.json() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function NuxeoClient._handle_error
refactored with the following changes:
- Merge dictionary updates via the union operator (
dict-assign-update-to-union
)
nuxeo/documents.py
Outdated
if "Internal Server Error" or "is not registered or unavailable" in e.message: | ||
raise UnavailableBogusConvertor(e.message, \ | ||
options["converter"] if options["converter"] else "") | ||
elif "is not registered" in e.message: | ||
raise NotRegisteredConvertor(options) | ||
elif ( | ||
"is not available" in e.message | ||
or "UnsupportedOperationException" in e.message | ||
): | ||
raise UnavailableConvertor(options) | ||
""" | ||
elif "Internal Server Error" in e.message: | ||
raise UnavailableBogusConvertor(e.message, \ | ||
options["converter"] if options["converter"] else "") | ||
""" | ||
raise e | ||
raise UnavailableBogusConvertor(e.message, options["converter"] or "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function API.convert
refactored with the following changes:
- Remove redundant conditional (
remove-redundant-if
) - Remove unreachable code (
remove-unreachable-code
) - Simplify if expression by using or (
or-if-exp-identity
)
params={"document": WORKSPACE_ROOT + "/Document"}, | ||
params={"document": f"{WORKSPACE_ROOT}/Document"}, | ||
) | ||
doc = server.documents.get(path=WORKSPACE_ROOT + "/Document") | ||
|
||
doc = server.documents.get(path=f"{WORKSPACE_ROOT}/Document") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function test_execute
refactored with the following changes:
- Use f-string instead of string concatenation [×2] (
use-fstring-for-concatenation
)
operation.params = {"document": WORKSPACE_ROOT + "/Document"} | ||
operation.params = {"document": f"{WORKSPACE_ROOT}/Document"} | ||
operation.input_obj = batch.get(0) | ||
operation.execute() | ||
doc = server.documents.get(path=WORKSPACE_ROOT + "/Document") | ||
doc = server.documents.get(path=f"{WORKSPACE_ROOT}/Document") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function test_operation
refactored with the following changes:
- Use f-string instead of string concatenation [×2] (
use-fstring-for-concatenation
)
operation.params = {"document": WORKSPACE_ROOT + "/Document"} | ||
operation.params = {"document": f"{WORKSPACE_ROOT}/Document"} | ||
operation.input_obj = batch.get(0) | ||
operation.execute(void_op=True) | ||
|
||
operation = server.operations.new("Document.Fetch") | ||
operation.params = {"value": WORKSPACE_ROOT + "/Document"} | ||
operation.params = {"value": f"{WORKSPACE_ROOT}/Document"} | ||
info = operation.execute() | ||
digest = info["properties"]["file:content"]["digest"] | ||
|
||
operation = server.operations.new("Blob.Get") | ||
operation.input_obj = WORKSPACE_ROOT + "/Document" | ||
operation.input_obj = f"{WORKSPACE_ROOT}/Document" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function test_upload
refactored with the following changes:
- Use f-string instead of string concatenation [×3] (
use-fstring-for-concatenation
)
operation.params = {"document": WORKSPACE_ROOT + "/Document"} | ||
operation.params = {"document": f"{WORKSPACE_ROOT}/Document"} | ||
operation.input_obj = batch.get(0) | ||
operation.execute(void_op=True) | ||
|
||
operation = server.operations.new("Document.Fetch") | ||
operation.params = {"value": WORKSPACE_ROOT + "/Document"} | ||
operation.params = {"value": f"{WORKSPACE_ROOT}/Document"} | ||
info = operation.execute() | ||
digest = info["properties"]["file:content"]["digest"] | ||
|
||
operation = server.operations.new("Blob.Get") | ||
operation.input_obj = WORKSPACE_ROOT + "/Document" | ||
operation.input_obj = f"{WORKSPACE_ROOT}/Document" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function test_upload_several_callbacks
refactored with the following changes:
- Use f-string instead of string concatenation [×3] (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "site/automation" | ||
self.url = f"{nuxeo_url}site/automation" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseAutomation.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "small%20file.txt" | ||
self.url = f"{nuxeo_url}small%20file.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseChunkedContents.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "small%20file.txt" | ||
self.url = f"{nuxeo_url}small%20file.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseChunkedJsonContents.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "small%20file.txt" | ||
self.url = f"{nuxeo_url}small%20file.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseChunkedJsonContentsTooLong.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "json/cmis" | ||
self.url = f"{nuxeo_url}json/cmis" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseCmis.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "nothing" | ||
self.url = f"{nuxeo_url}nothing" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseEmpty.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "big%20file.txt" | ||
self.url = f"{nuxeo_url}big%20file.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseTextError.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "small%20file.txt" | ||
self.url = f"{nuxeo_url}small%20file.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseTextOk.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "big%20file.txt" | ||
self.url = f"{nuxeo_url}big%20file.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseTextTooLong.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
assert len(aces) in (2, 3) | ||
assert len(aces) in {2, 3} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function test_fetch_acls
refactored with the following changes:
- Use set when checking membership of a collection of literals (
collection-into-set
)
file_out = filename + ".dl" | ||
file_out = f"{filename}.dl" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function download_file
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
63746e7
to
78ac896
Compare
13d9867
to
2996f4f
Compare
"User-Agent": app_name + "/" + version, | ||
"User-Agent": f"{app_name}/{version}", | ||
"Accept": "application/json, */*", | ||
} | ||
|
||
self.schemas = kwargs.get("schemas", "*") | ||
self.repository = kwargs.pop("repository", "default") | ||
self._session = requests.sessions.Session() | ||
self._session.hooks["response"] = [log_response] | ||
cookies = kwargs.pop("cookies", None) | ||
if cookies: | ||
if cookies := kwargs.pop("cookies", None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function NuxeoClient.__init__
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
) - Use f-string instead of string concatenation [×2] (
use-fstring-for-concatenation
)
data.update(params) | ||
data |= params | ||
|
||
url = self.api_path + "/search/lang/NXQL/execute" | ||
url = f"{self.api_path}/search/lang/NXQL/execute" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function NuxeoClient.query
refactored with the following changes:
- Merge dictionary updates via the union operator (
dict-assign-update-to-union
) - Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
kwargs.update(self.client_kwargs) | ||
kwargs |= self.client_kwargs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function NuxeoClient.request
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
) - Merge dictionary updates via the union operator (
dict-assign-update-to-union
) - Swap if/else branches of if expression to remove negation (
swap-if-expression
)
error_data.update(response.json()) | ||
error_data |= response.json() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function NuxeoClient._handle_error
refactored with the following changes:
- Merge dictionary updates via the union operator (
dict-assign-update-to-union
)
nuxeo/documents.py
Outdated
if "Internal Server Error" or "is not registered or unavailable" in e.message: | ||
raise UnavailableBogusConvertor(options) | ||
elif "is not registered" in e.message: | ||
raise NotRegisteredConvertor(options) | ||
elif ( | ||
"is not available" in e.message | ||
or "UnsupportedOperationException" in e.message | ||
): | ||
raise UnavailableConvertor(options) | ||
""" | ||
elif "Internal Server Error" in e.message: | ||
raise UnavailableBogusConvertor(e.message, \ | ||
options["converter"] if options["converter"] else "") | ||
""" | ||
raise e | ||
raise UnavailableBogusConvertor(options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function API.convert
refactored with the following changes:
- Remove redundant conditional (
remove-redundant-if
) - Remove unreachable code (
remove-unreachable-code
)
operation.params = {"document": WORKSPACE_ROOT + "/Document"} | ||
operation.params = {"document": f"{WORKSPACE_ROOT}/Document"} | ||
operation.input_obj = batch.get(0) | ||
operation.execute(void_op=True) | ||
|
||
operation = server.operations.new("Blob.Get") | ||
operation.input_obj = WORKSPACE_ROOT + "/Document" | ||
operation.input_obj = f"{WORKSPACE_ROOT}/Document" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function test_digester
refactored with the following changes:
- Use f-string instead of string concatenation [×2] (
use-fstring-for-concatenation
)
params={"document": WORKSPACE_ROOT + "/Document"}, | ||
params={"document": f"{WORKSPACE_ROOT}/Document"}, | ||
) | ||
doc = server.documents.get(path=WORKSPACE_ROOT + "/Document") | ||
|
||
doc = server.documents.get(path=f"{WORKSPACE_ROOT}/Document") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function test_execute
refactored with the following changes:
- Use f-string instead of string concatenation [×2] (
use-fstring-for-concatenation
)
operation.params = {"document": WORKSPACE_ROOT + "/Document"} | ||
operation.params = {"document": f"{WORKSPACE_ROOT}/Document"} | ||
operation.input_obj = batch.get(0) | ||
operation.execute() | ||
doc = server.documents.get(path=WORKSPACE_ROOT + "/Document") | ||
doc = server.documents.get(path=f"{WORKSPACE_ROOT}/Document") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function test_operation
refactored with the following changes:
- Use f-string instead of string concatenation [×2] (
use-fstring-for-concatenation
)
operation.params = {"document": WORKSPACE_ROOT + "/Document"} | ||
operation.params = {"document": f"{WORKSPACE_ROOT}/Document"} | ||
operation.input_obj = batch.get(0) | ||
operation.execute(void_op=True) | ||
|
||
operation = server.operations.new("Document.Fetch") | ||
operation.params = {"value": WORKSPACE_ROOT + "/Document"} | ||
operation.params = {"value": f"{WORKSPACE_ROOT}/Document"} | ||
info = operation.execute() | ||
digest = info["properties"]["file:content"]["digest"] | ||
|
||
operation = server.operations.new("Blob.Get") | ||
operation.input_obj = WORKSPACE_ROOT + "/Document" | ||
operation.input_obj = f"{WORKSPACE_ROOT}/Document" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function test_upload
refactored with the following changes:
- Use f-string instead of string concatenation [×3] (
use-fstring-for-concatenation
)
operation.params = {"document": WORKSPACE_ROOT + "/Document"} | ||
operation.params = {"document": f"{WORKSPACE_ROOT}/Document"} | ||
operation.input_obj = batch.get(0) | ||
operation.execute(void_op=True) | ||
|
||
operation = server.operations.new("Document.Fetch") | ||
operation.params = {"value": WORKSPACE_ROOT + "/Document"} | ||
operation.params = {"value": f"{WORKSPACE_ROOT}/Document"} | ||
info = operation.execute() | ||
digest = info["properties"]["file:content"]["digest"] | ||
|
||
operation = server.operations.new("Blob.Get") | ||
operation.input_obj = WORKSPACE_ROOT + "/Document" | ||
operation.input_obj = f"{WORKSPACE_ROOT}/Document" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function test_upload_several_callbacks
refactored with the following changes:
- Use f-string instead of string concatenation [×3] (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "site/automation" | ||
self.url = f"{nuxeo_url}site/automation" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseAutomation.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "small%20file.txt" | ||
self.url = f"{nuxeo_url}small%20file.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseChunkedContents.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "small%20file.txt" | ||
self.url = f"{nuxeo_url}small%20file.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseChunkedJsonContents.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "small%20file.txt" | ||
self.url = f"{nuxeo_url}small%20file.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseChunkedJsonContentsTooLong.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "json/cmis" | ||
self.url = f"{nuxeo_url}json/cmis" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseCmis.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "big%20file.txt" | ||
self.url = f"{nuxeo_url}big%20file.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseTextError.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "small%20file.txt" | ||
self.url = f"{nuxeo_url}small%20file.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseTextOk.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "big%20file.txt" | ||
self.url = f"{nuxeo_url}big%20file.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseTextTooLong.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
assert len(aces) in (2, 3) | ||
assert len(aces) in {2, 3} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function test_fetch_acls
refactored with the following changes:
- Use set when checking membership of a collection of literals (
collection-into-set
)
file_out = filename + ".dl" | ||
file_out = f"{filename}.dl" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function download_file
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
78ac896
to
621fd2d
Compare
2996f4f
to
c4a176d
Compare
"User-Agent": app_name + "/" + version, | ||
"User-Agent": f"{app_name}/{version}", | ||
"Accept": "application/json, */*", | ||
} | ||
|
||
self.schemas = kwargs.get("schemas", "*") | ||
self.repository = kwargs.pop("repository", "default") | ||
self._session = requests.sessions.Session() | ||
self._session.hooks["response"] = [log_response] | ||
cookies = kwargs.pop("cookies", None) | ||
if cookies: | ||
if cookies := kwargs.pop("cookies", None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function NuxeoClient.__init__
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
) - Use f-string instead of string concatenation [×2] (
use-fstring-for-concatenation
)
data.update(params) | ||
data |= params | ||
|
||
url = self.api_path + "/search/lang/NXQL/execute" | ||
url = f"{self.api_path}/search/lang/NXQL/execute" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function NuxeoClient.query
refactored with the following changes:
- Merge dictionary updates via the union operator (
dict-assign-update-to-union
) - Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
kwargs.update(self.client_kwargs) | ||
kwargs |= self.client_kwargs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function NuxeoClient.request
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
) - Merge dictionary updates via the union operator (
dict-assign-update-to-union
) - Swap if/else branches of if expression to remove negation (
swap-if-expression
)
error_data.update(response.json()) | ||
error_data |= response.json() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function NuxeoClient._handle_error
refactored with the following changes:
- Merge dictionary updates via the union operator (
dict-assign-update-to-union
)
input_obj = "doc:" + uid | ||
input_obj = f"doc:{uid}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function API.trash
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
operation.params = {"document": WORKSPACE_ROOT + "/Document"} | ||
operation.params = {"document": f"{WORKSPACE_ROOT}/Document"} | ||
operation.input_obj = batch.get(0) | ||
operation.execute(void_op=True) | ||
|
||
operation = server.operations.new("Document.Fetch") | ||
operation.params = {"value": WORKSPACE_ROOT + "/Document"} | ||
operation.params = {"value": f"{WORKSPACE_ROOT}/Document"} | ||
info = operation.execute() | ||
digest = info["properties"]["file:content"]["digest"] | ||
|
||
operation = server.operations.new("Blob.Get") | ||
operation.input_obj = WORKSPACE_ROOT + "/Document" | ||
operation.input_obj = f"{WORKSPACE_ROOT}/Document" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function test_upload
refactored with the following changes:
- Use f-string instead of string concatenation [×3] (
use-fstring-for-concatenation
)
operation.params = {"document": WORKSPACE_ROOT + "/Document"} | ||
operation.params = {"document": f"{WORKSPACE_ROOT}/Document"} | ||
operation.input_obj = batch.get(0) | ||
operation.execute(void_op=True) | ||
|
||
operation = server.operations.new("Document.Fetch") | ||
operation.params = {"value": WORKSPACE_ROOT + "/Document"} | ||
operation.params = {"value": f"{WORKSPACE_ROOT}/Document"} | ||
info = operation.execute() | ||
digest = info["properties"]["file:content"]["digest"] | ||
|
||
operation = server.operations.new("Blob.Get") | ||
operation.input_obj = WORKSPACE_ROOT + "/Document" | ||
operation.input_obj = f"{WORKSPACE_ROOT}/Document" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function test_upload_several_callbacks
refactored with the following changes:
- Use f-string instead of string concatenation [×3] (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "site/automation" | ||
self.url = f"{nuxeo_url}site/automation" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseAutomation.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "small%20file.txt" | ||
self.url = f"{nuxeo_url}small%20file.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseChunkedContents.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "small%20file.txt" | ||
self.url = f"{nuxeo_url}small%20file.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseChunkedJsonContents.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "small%20file.txt" | ||
self.url = f"{nuxeo_url}small%20file.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseChunkedJsonContentsTooLong.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "json/cmis" | ||
self.url = f"{nuxeo_url}json/cmis" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseCmis.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "nothing" | ||
self.url = f"{nuxeo_url}nothing" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseEmpty.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "nothing" | ||
self.url = f"{nuxeo_url}nothing" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseError409.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "700.3%20MiB.iso" | ||
self.url = f"{nuxeo_url}700.3%20MiB.iso" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseIso.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "big%20file.txt" | ||
self.url = f"{nuxeo_url}big%20file.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseTextError.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "small%20file.txt" | ||
self.url = f"{nuxeo_url}small%20file.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseTextOk.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "big%20file.txt" | ||
self.url = f"{nuxeo_url}big%20file.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseTextTooLong.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
assert len(aces) in (2, 3) | ||
assert len(aces) in {2, 3} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function test_fetch_acls
refactored with the following changes:
- Use set when checking membership of a collection of literals (
collection-into-set
)
file_out = filename + ".dl" | ||
file_out = f"{filename}.dl" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function download_file
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
621fd2d
to
8dd3fd2
Compare
c4a176d
to
0c1e9ea
Compare
"User-Agent": app_name + "/" + version, | ||
"User-Agent": f"{app_name}/{version}", | ||
"Accept": "application/json, */*", | ||
} | ||
|
||
self.schemas = kwargs.get("schemas", "*") | ||
self.repository = kwargs.pop("repository", "default") | ||
self._session = requests.sessions.Session() | ||
self._session.hooks["response"] = [log_response] | ||
cookies = kwargs.pop("cookies", None) | ||
if cookies: | ||
if cookies := kwargs.pop("cookies", None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function NuxeoClient.__init__
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
) - Use f-string instead of string concatenation [×2] (
use-fstring-for-concatenation
)
data.update(params) | ||
data |= params | ||
|
||
url = self.api_path + "/search/lang/NXQL/execute" | ||
url = f"{self.api_path}/search/lang/NXQL/execute" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function NuxeoClient.query
refactored with the following changes:
- Merge dictionary updates via the union operator (
dict-assign-update-to-union
) - Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
kwargs.update(self.client_kwargs) | ||
kwargs |= self.client_kwargs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function NuxeoClient.request
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
) - Merge dictionary updates via the union operator (
dict-assign-update-to-union
) - Swap if/else branches of if expression to remove negation (
swap-if-expression
)
error_data.update(response.json()) | ||
error_data |= response.json() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function NuxeoClient._handle_error
refactored with the following changes:
- Merge dictionary updates via the union operator (
dict-assign-update-to-union
)
input_obj = "doc:" + uid | ||
input_obj = f"doc:{uid}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function API.trash
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
operation.params = {"document": WORKSPACE_ROOT + "/Document"} | ||
operation.params = {"document": f"{WORKSPACE_ROOT}/Document"} | ||
operation.input_obj = batch.get(0) | ||
operation.execute(void_op=True) | ||
|
||
operation = server.operations.new("Document.Fetch") | ||
operation.params = {"value": WORKSPACE_ROOT + "/Document"} | ||
operation.params = {"value": f"{WORKSPACE_ROOT}/Document"} | ||
info = operation.execute() | ||
digest = info["properties"]["file:content"]["digest"] | ||
|
||
operation = server.operations.new("Blob.Get") | ||
operation.input_obj = WORKSPACE_ROOT + "/Document" | ||
operation.input_obj = f"{WORKSPACE_ROOT}/Document" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function test_upload
refactored with the following changes:
- Use f-string instead of string concatenation [×3] (
use-fstring-for-concatenation
)
operation.params = {"document": WORKSPACE_ROOT + "/Document"} | ||
operation.params = {"document": f"{WORKSPACE_ROOT}/Document"} | ||
operation.input_obj = batch.get(0) | ||
operation.execute(void_op=True) | ||
|
||
operation = server.operations.new("Document.Fetch") | ||
operation.params = {"value": WORKSPACE_ROOT + "/Document"} | ||
operation.params = {"value": f"{WORKSPACE_ROOT}/Document"} | ||
info = operation.execute() | ||
digest = info["properties"]["file:content"]["digest"] | ||
|
||
operation = server.operations.new("Blob.Get") | ||
operation.input_obj = WORKSPACE_ROOT + "/Document" | ||
operation.input_obj = f"{WORKSPACE_ROOT}/Document" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function test_upload_several_callbacks
refactored with the following changes:
- Use f-string instead of string concatenation [×3] (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "site/automation" | ||
self.url = f"{nuxeo_url}site/automation" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseAutomation.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "small%20file.txt" | ||
self.url = f"{nuxeo_url}small%20file.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseChunkedContents.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "small%20file.txt" | ||
self.url = f"{nuxeo_url}small%20file.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseChunkedJsonContents.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "small%20file.txt" | ||
self.url = f"{nuxeo_url}small%20file.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseChunkedJsonContentsTooLong.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "json/cmis" | ||
self.url = f"{nuxeo_url}json/cmis" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseCmis.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "nothing" | ||
self.url = f"{nuxeo_url}nothing" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseEmpty.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "nothing" | ||
self.url = f"{nuxeo_url}nothing" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseError409.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "700.3%20MiB.iso" | ||
self.url = f"{nuxeo_url}700.3%20MiB.iso" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseIso.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "big%20file.txt" | ||
self.url = f"{nuxeo_url}big%20file.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseTextError.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "small%20file.txt" | ||
self.url = f"{nuxeo_url}small%20file.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseTextOk.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "big%20file.txt" | ||
self.url = f"{nuxeo_url}big%20file.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseTextTooLong.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
assert len(aces) in (2, 3) | ||
assert len(aces) in {2, 3} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function test_fetch_acls
refactored with the following changes:
- Use set when checking membership of a collection of literals (
collection-into-set
)
file_out = filename + ".dl" | ||
file_out = f"{filename}.dl" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function download_file
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
8dd3fd2
to
1866b4d
Compare
0c1e9ea
to
28fb109
Compare
"User-Agent": app_name + "/" + version, | ||
"User-Agent": f"{app_name}/{version}", | ||
"Accept": "application/json, */*", | ||
} | ||
|
||
self.schemas = kwargs.get("schemas", "*") | ||
self.repository = kwargs.pop("repository", "default") | ||
self._session = requests.sessions.Session() | ||
self._session.hooks["response"] = [log_response] | ||
cookies = kwargs.pop("cookies", None) | ||
if cookies: | ||
if cookies := kwargs.pop("cookies", None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function NuxeoClient.__init__
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
) - Use f-string instead of string concatenation [×2] (
use-fstring-for-concatenation
)
data.update(params) | ||
data |= params | ||
|
||
url = self.api_path + "/search/lang/NXQL/execute" | ||
url = f"{self.api_path}/search/lang/NXQL/execute" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function NuxeoClient.query
refactored with the following changes:
- Merge dictionary updates via the union operator (
dict-assign-update-to-union
) - Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
kwargs.update(self.client_kwargs) | ||
kwargs |= self.client_kwargs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function NuxeoClient.request
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
) - Merge dictionary updates via the union operator (
dict-assign-update-to-union
) - Swap if/else branches of if expression to remove negation (
swap-if-expression
)
error_data.update(response.json()) | ||
error_data |= response.json() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function NuxeoClient._handle_error
refactored with the following changes:
- Merge dictionary updates via the union operator (
dict-assign-update-to-union
)
input_obj = "doc:" + uid | ||
input_obj = f"doc:{uid}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function API.trash
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
operation.params = {"document": WORKSPACE_ROOT + "/Document"} | ||
operation.params = {"document": f"{WORKSPACE_ROOT}/Document"} | ||
operation.input_obj = batch.get(0) | ||
operation.execute(void_op=True) | ||
|
||
operation = server.operations.new("Document.Fetch") | ||
operation.params = {"value": WORKSPACE_ROOT + "/Document"} | ||
operation.params = {"value": f"{WORKSPACE_ROOT}/Document"} | ||
info = operation.execute() | ||
digest = info["properties"]["file:content"]["digest"] | ||
|
||
operation = server.operations.new("Blob.Get") | ||
operation.input_obj = WORKSPACE_ROOT + "/Document" | ||
operation.input_obj = f"{WORKSPACE_ROOT}/Document" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function test_upload
refactored with the following changes:
- Use f-string instead of string concatenation [×3] (
use-fstring-for-concatenation
)
operation.params = {"document": WORKSPACE_ROOT + "/Document"} | ||
operation.params = {"document": f"{WORKSPACE_ROOT}/Document"} | ||
operation.input_obj = batch.get(0) | ||
operation.execute(void_op=True) | ||
|
||
operation = server.operations.new("Document.Fetch") | ||
operation.params = {"value": WORKSPACE_ROOT + "/Document"} | ||
operation.params = {"value": f"{WORKSPACE_ROOT}/Document"} | ||
info = operation.execute() | ||
digest = info["properties"]["file:content"]["digest"] | ||
|
||
operation = server.operations.new("Blob.Get") | ||
operation.input_obj = WORKSPACE_ROOT + "/Document" | ||
operation.input_obj = f"{WORKSPACE_ROOT}/Document" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function test_upload_several_callbacks
refactored with the following changes:
- Use f-string instead of string concatenation [×3] (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "site/automation" | ||
self.url = f"{nuxeo_url}site/automation" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseAutomation.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "small%20file.txt" | ||
self.url = f"{nuxeo_url}small%20file.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseChunkedContents.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "small%20file.txt" | ||
self.url = f"{nuxeo_url}small%20file.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseChunkedJsonContents.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "small%20file.txt" | ||
self.url = f"{nuxeo_url}small%20file.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseChunkedJsonContentsTooLong.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "json/cmis" | ||
self.url = f"{nuxeo_url}json/cmis" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseCmis.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "nothing" | ||
self.url = f"{nuxeo_url}nothing" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseEmpty.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "nothing" | ||
self.url = f"{nuxeo_url}nothing" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseError409.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "700.3%20MiB.iso" | ||
self.url = f"{nuxeo_url}700.3%20MiB.iso" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseIso.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "big%20file.txt" | ||
self.url = f"{nuxeo_url}big%20file.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseTextError.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "small%20file.txt" | ||
self.url = f"{nuxeo_url}small%20file.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseTextOk.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
self.url = nuxeo_url + "big%20file.txt" | ||
self.url = f"{nuxeo_url}big%20file.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ResponseTextTooLong.__init__
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
assert len(aces) in (2, 3) | ||
assert len(aces) in {2, 3} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function test_fetch_acls
refactored with the following changes:
- Use set when checking membership of a collection of literals (
collection-into-set
)
file_out = filename + ".dl" | ||
file_out = f"{filename}.dl" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function download_file
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
Pull Request #271 refactored by Sourcery.
If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.
NOTE: As code is pushed to the original Pull Request, Sourcery will
re-run and update (force-push) this Pull Request with new refactorings as
necessary. If Sourcery finds no refactorings at any point, this Pull Request
will be closed automatically.
See our documentation here.
Run Sourcery locally
Reduce the feedback loop during development by using the Sourcery editor plugin:
Review changes via command line
To manually merge these changes, make sure you're on the
wip-NXPY-239-Fix-tests-cases-on-Python
branch, then run:Help us improve this pull request!