Skip to content

Commit b673128

Browse files
committed
chore: precommit fix
1 parent 6602b14 commit b673128

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

splunktaucclib/rest_handler/handler.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,19 +107,23 @@ def basic_name_validation(name: str):
107107
prohibited_chars = ["*", "\\", "[", "]", "(", ")", "?", ":"]
108108
prohibited_names = ["default", ".", ".."]
109109
max_chars = 1024
110-
val_err_msg = (f'{prohibited_names}, string started with "_" and string including any one '
111-
f'of {prohibited_chars} are reserved value which cannot be used for field Name"')
110+
val_err_msg = (
111+
f'{prohibited_names}, string started with "_" and string including any one '
112+
f'of {prohibited_chars} are reserved value which cannot be used for field Name"'
113+
)
112114

113-
if (
114-
tmp_name.startswith("_") or any(tmp_name == el for el in prohibited_names)
115+
if tmp_name.startswith("_") or any(
116+
tmp_name == el for el in prohibited_names
115117
):
116118
raise RestError(400, val_err_msg)
117119

118120
if any(pc in prohibited_chars for pc in tmp_name):
119121
raise RestError(400, val_err_msg)
120122

121123
if len(tmp_name) >= max_chars:
122-
raise RestError(400, f"Field Name must be less than {max_chars} characters")
124+
raise RestError(
125+
400, f"Field Name must be less than {max_chars} characters"
126+
)
123127

124128
@wraps(meth)
125129
def wrapper(self, name, data):
@@ -215,7 +219,7 @@ def all(self, decrypt=False, **query):
215219
response = self._client.get(
216220
self.path_segment(self._endpoint.internal_endpoint),
217221
output_mode="json",
218-
**query
222+
**query,
219223
)
220224
return self._format_all_response(response, decrypt)
221225

@@ -403,7 +407,7 @@ def _load_credentials(self, name, data):
403407
self._endpoint.internal_endpoint,
404408
name=name,
405409
),
406-
**masked
410+
**masked,
407411
)
408412

409413
def _encrypt_raw_credentials(self, data):

tests/integration/test_rest_handler_handler.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,10 @@ def test_403_api_call():
115115
def test_basic_name_validation(value):
116116
prohibited_chars = ["*", "\\", "[", "]", "(", ")", "?", ":"]
117117
prohibited_names = ["default", ".", ".."]
118-
expected_msg = (f'{prohibited_names}, string started with "_" and string including any one '
119-
f'of {prohibited_chars} are reserved value which cannot be used for field Name"')
118+
expected_msg = (
119+
f'{prohibited_names}, string started with "_" and string including any one '
120+
f'of {prohibited_chars} are reserved value which cannot be used for field Name"'
121+
)
120122

121123
response = requests.post(
122124
f"https://{host}:{management_port}/servicesNS/-/demo/demo_demo",

0 commit comments

Comments
 (0)