Skip to content

Commit a741f47

Browse files
style: format with black and remove unuse var
1 parent 3ce6c04 commit a741f47

5 files changed

Lines changed: 32 additions & 15 deletions

File tree

hrflow/hrflow/text/tagging.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def post(
7070
output_lang=output_lang,
7171
top_n=top_n,
7272
)
73-
73+
7474
if texts is None and text is not None:
7575
payload["text"] = text
7676
elif text is None and texts is not None:
@@ -79,6 +79,6 @@ def post(
7979
raise ValueError("Either text or texts must be provided.")
8080
else:
8181
raise ValueError("Only one of text or texts must be provided.")
82-
82+
8383
response = self.client.post("text/tagging", json=payload)
8484
return validate_response(response)

tests/test_job.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,15 @@
2020
_var_from_env_get,
2121
)
2222

23+
2324
@pytest.fixture(scope="module")
2425
def hrflow_client():
2526
return Hrflow(
2627
api_secret=_var_from_env_get("HRFLOW_API_KEY"),
2728
api_user=_var_from_env_get("HRFLOW_USER_EMAIL"),
2829
)
2930

31+
3032
def _job_get() -> t.Dict[str, t.Any]:
3133
return dict(
3234
reference=str(uuid4()),

tests/test_profile.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,15 @@
2929
_ASYNC_RETRY_INTERVAL_SECONDS = 5
3030
_ASYNC_TIMEOUT_SECONDS = 60
3131

32+
3233
@pytest.fixture(scope="module")
3334
def hrflow_client():
3435
return Hrflow(
3536
api_secret=_var_from_env_get("HRFLOW_API_KEY"),
3637
api_user=_var_from_env_get("HRFLOW_USER_EMAIL"),
3738
)
3839

40+
3941
def _profile_get() -> t.Dict[str, t.Any]:
4042
return dict(
4143
reference=str(uuid4()),
@@ -330,7 +332,9 @@ def test_profile_parsing_file_quicksilver_async_basic(hrflow_client):
330332
assert _ASYNC_RETRY_INTERVAL_SECONDS > 0
331333
for _ in range(max(0, _ASYNC_TIMEOUT_SECONDS // _ASYNC_RETRY_INTERVAL_SECONDS)):
332334
model = ProfileIndexingResponse.model_validate(
333-
hrflow_client.profile.storing.get(source_key=SOURCE_KEY, reference=reference)
335+
hrflow_client.profile.storing.get(
336+
source_key=SOURCE_KEY, reference=reference
337+
)
334338
)
335339
if model.code == http_codes.ok:
336340
break
@@ -408,7 +412,9 @@ def test_profile_parsing_file_mozart_async_basic(hrflow_client):
408412
assert _ASYNC_RETRY_INTERVAL_SECONDS > 0
409413
for _ in range(max(0, _ASYNC_TIMEOUT_SECONDS // _ASYNC_RETRY_INTERVAL_SECONDS)):
410414
model = ProfileIndexingResponse.model_validate(
411-
hrflow_client.profile.storing.get(source_key=SOURCE_KEY, reference=reference)
415+
hrflow_client.profile.storing.get(
416+
source_key=SOURCE_KEY, reference=reference
417+
)
412418
)
413419
if model.code == http_codes.ok:
414420
break
@@ -514,7 +520,9 @@ def test_profile_asking_basic(hrflow_client):
514520
model = ProfileAskingResponse.model_validate(
515521
hrflow_client.profile.asking.get(
516522
source_key=SOURCE_KEY,
517-
key=_indexed_response_get(hrflow_client, SOURCE_KEY, _profile_get()).data.key,
523+
key=_indexed_response_get(
524+
hrflow_client, SOURCE_KEY, _profile_get()
525+
).data.key,
518526
questions=[
519527
"What is the full name of the profile ?",
520528
],
@@ -539,7 +547,9 @@ def test_profile_asking_multiple_questions(hrflow_client):
539547
hrflow_client.profile.asking.get(
540548
source_key=SOURCE_KEY,
541549
questions=questions,
542-
key=_indexed_response_get(hrflow_client, SOURCE_KEY, _profile_get()).data.key,
550+
key=_indexed_response_get(
551+
hrflow_client, SOURCE_KEY, _profile_get()
552+
).data.key,
543553
)
544554
)
545555
assert model.code == http_codes.ok
@@ -556,7 +566,9 @@ def test_profile_asking_no_question(hrflow_client):
556566
model = ProfileAskingResponse.model_validate(
557567
hrflow_client.profile.asking.get(
558568
source_key=SOURCE_KEY,
559-
key=_indexed_response_get(hrflow_client, SOURCE_KEY, _profile_get()).data.key,
569+
key=_indexed_response_get(
570+
hrflow_client, SOURCE_KEY, _profile_get()
571+
).data.key,
560572
questions=None,
561573
)
562574
)

tests/test_text.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,15 @@
3333
),
3434
]
3535

36+
3637
@pytest.fixture(scope="module")
3738
def hrflow_client():
3839
return Hrflow(
3940
api_secret=_var_from_env_get("HRFLOW_API_KEY"),
4041
api_user=_var_from_env_get("HRFLOW_USER_EMAIL"),
4142
)
4243

44+
4345
@pytest.mark.text
4446
@pytest.mark.embedding
4547
def test_embedding_basic(hrflow_client):
@@ -171,6 +173,7 @@ def test_tagger_rome_family_with_text_param(hrflow_client):
171173
assert model.code == requests.codes.ok
172174
assert isinstance(model.data, TextTaggingDataItem)
173175

176+
174177
@pytest.mark.text
175178
@pytest.mark.tagging
176179
def test_tagger_rome_family_with_texts_param(hrflow_client):
@@ -185,6 +188,7 @@ def test_tagger_rome_family_with_texts_param(hrflow_client):
185188
assert isinstance(model.data, list)
186189
assert len(model.data) == len(TAGGING_TEXTS)
187190

191+
188192
@pytest.mark.text
189193
@pytest.mark.tagging
190194
def test_tagger_rome_family_with_text_and_texts_param(hrflow_client):
@@ -198,9 +202,10 @@ def test_tagger_rome_family_with_text_and_texts_param(hrflow_client):
198202
)
199203
)
200204
pytest.fail("Should have raised a ValueError")
201-
except ValueError as e:
205+
except ValueError:
202206
pass
203-
207+
208+
204209
@pytest.mark.text
205210
@pytest.mark.tagging
206211
def test_tagger_rome_family_without_text_or_texts_param(hrflow_client):
@@ -212,9 +217,10 @@ def test_tagger_rome_family_without_text_or_texts_param(hrflow_client):
212217
)
213218
)
214219
pytest.fail("Should have raised a ValueError")
215-
except ValueError as e:
220+
except ValueError:
216221
pass
217222

223+
218224
def _tagging_test(
219225
hrflow_client: Hrflow,
220226
algorithm_key: TAGGING_ALGORITHM,
@@ -359,9 +365,7 @@ def test_ocr_basic(hrflow_client):
359365
495c951bbae6b/profiles/52e3c23a5f21190c59f53c41b5630ecb5d414f94/parsing/resume.pdf"""
360366
file = _file_get(s3_url, "ocr")
361367
assert file is not None
362-
model = TextOCRResponse.model_validate(
363-
hrflow_client.text.ocr.post(file=file)
364-
)
368+
model = TextOCRResponse.model_validate(hrflow_client.text.ocr.post(file=file))
365369
assert model.code == requests.codes.ok
366370
assert "ocr" in model.message.lower()
367371

tests/utils/schemas.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,7 @@ class TextTaggingDataItem(BaseModel):
101101
@classmethod
102102
def _check(cls, values: t.Dict[str, t.List[t.Any]]) -> t.Dict[str, t.List[t.Any]]:
103103
if isinstance(values, list):
104-
return [cls._check(item) for item in values
105-
]
104+
return [cls._check(item) for item in values]
106105
li = len(values.get("ids"))
107106
lp = len(values.get("predictions"))
108107
lt = len(values.get("tags"))

0 commit comments

Comments
 (0)