Skip to content

Commit bfeb6cb

Browse files
style: format with black and isort
1 parent 5bac98b commit bfeb6cb

4 files changed

Lines changed: 28 additions & 30 deletions

File tree

hrflow/utils/evaluation/__init__.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,17 @@
66
from openpyxl import load_workbook
77
from openpyxl.workbook.workbook import Workbook
88

9+
from ..storing import get_all_jobs, get_all_profiles
10+
from .job import TEMPLATE_URL as JOB_TEMPLATE_URL
11+
from .job import fill_work_sheet as fill_job_work_sheet
12+
from .job import parsing_evaluator as job_parsing_evaluator
13+
from .profile import TEMPLATE_URL as PROFILE_TEMPLATE_URL
914
from .profile import fill_work_sheet as fill_profile_work_sheet
1015
from .profile import parsing_evaluator as profile_parsing_evaluator
11-
from .profile import TEMPLATE_URL as PROFILE_TEMPLATE_URL
12-
13-
from .job import parsing_evaluator as job_parsing_evaluator
14-
from .job import fill_work_sheet as fill_job_work_sheet
15-
from .job import TEMPLATE_URL as JOB_TEMPLATE_URL
16-
17-
from ..storing import get_all_profiles, get_all_jobs
1816

1917
STATISTICS_SHEET_NAME = "1. Statistics"
2018

19+
2120
def load_workbook_from_url(url: str) -> Workbook:
2221
"""
2322
Load an excel file from a url
@@ -33,6 +32,7 @@ def load_workbook_from_url(url: str) -> Workbook:
3332
file = urllib.request.urlopen(url).read()
3433
return load_workbook(filename=BytesIO(file))
3534

35+
3636
def prepare_report_path(path: str) -> str:
3737
"""
3838
Prepare the report path
@@ -47,6 +47,7 @@ def prepare_report_path(path: str) -> str:
4747
return f"{path}.xlsx"
4848
return path
4949

50+
5051
def generate_parsing_evaluation_report(
5152
client: "Hrflow", # noqa: F821
5253
report_path: str,
@@ -56,12 +57,12 @@ def generate_parsing_evaluation_report(
5657
):
5758
"""
5859
Generate a parsing evaluation report
59-
60-
If you want to generate a parsing evaluation report for jobs, you must
60+
61+
If you want to generate a parsing evaluation report for jobs, you must
6162
provide the board_key.
6263
If you want to generate a parsing evaluation report for profiles, you must
6364
provide the source_key.
64-
65+
6566
board_key and source_key are optional string, you must provide only one of them.
6667
6768
Args:
@@ -81,12 +82,12 @@ def generate_parsing_evaluation_report(
8182
show_progress: <bool>
8283
Show the progress bar
8384
"""
84-
85+
8586
if not source_key and not board_key:
8687
raise ValueError("You must provide either source_key or board_key")
8788
if source_key and board_key:
8889
raise ValueError("You must provide only one of source_key or board_key")
89-
90+
9091
if source_key:
9192
profile_list = get_all_profiles(client, source_key, show_progress)
9293
evaluation_list = profile_parsing_evaluator(profile_list, show_progress)
@@ -105,4 +106,4 @@ def generate_parsing_evaluation_report(
105106

106107
report_path = prepare_report_path(report_path)
107108
work_book.save(report_path)
108-
work_book.close()
109+
work_book.close()

hrflow/utils/evaluation/job.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class RangeFloatEvaluation(BaseModel):
111111
@staticmethod
112112
def from_job(job: t.Dict[str, t.Any]) -> "RangeFloatEvaluation":
113113
count = len(job.get("ranges_float", []))
114-
114+
115115
name = 0
116116
value_min = 0
117117
value_max = 0
@@ -121,16 +121,16 @@ def from_job(job: t.Dict[str, t.Any]) -> "RangeFloatEvaluation":
121121
value_min += 1 if range_float.get("value_min") else 0
122122
value_max += 1 if range_float.get("value_max") else 0
123123
unit += 1 if range_float.get("unit") else 0
124-
124+
125125
if count > 0:
126126
name /= count
127127
value_min /= count
128128
value_max /= count
129129
unit /= count
130-
130+
131131
score = name + value_min + value_max + unit
132132
score /= 4
133-
133+
134134
return RangeFloatEvaluation(
135135
score=score,
136136
count=count,
@@ -151,23 +151,23 @@ class RangeDateEvaluation(BaseModel):
151151
@staticmethod
152152
def from_job(job: t.Dict[str, t.Any]) -> "RangeDateEvaluation":
153153
count = len(job.get("ranges_date", []))
154-
154+
155155
name = 0
156156
value_min = 0
157157
value_max = 0
158158
for range_date in job.get("ranges_dates", []):
159159
name += 1 if range_date.get("name") else 0
160160
value_min += 1 if range_date.get("value_min") else 0
161161
value_max += 1 if range_date.get("value_max") else 0
162-
162+
163163
if count > 0:
164164
name /= count
165165
value_min /= count
166166
value_max /= count
167-
167+
168168
score = name + value_min + value_max
169169
score /= 3
170-
170+
171171
return RangeDateEvaluation(
172172
score=score,
173173
count=count,
@@ -245,7 +245,6 @@ def parsing_evaluator(
245245
return [JobEvaluation.from_job(job) for job in job_list]
246246

247247

248-
249248
def fill_metadata(
250249
work_sheet: Worksheet,
251250
job_eval_list: t.List[JobEvaluation],
@@ -270,6 +269,7 @@ def fill_metadata(
270269
if job_eval.url:
271270
work_sheet[f"{URL_COLUMN_ID}{row_id}"].hyperlink = job_eval.url
272271

272+
273273
def fill_overview(
274274
work_sheet: Worksheet,
275275
job_eval_list: t.List[JobEvaluation],
@@ -292,7 +292,7 @@ def fill_overview(
292292
for row_id, job_eval in enumerate(job_eval_list, START_ROW_ID):
293293
for column_id, field in zip(colum_id_list, OVERVIEW_FIELD_LIST):
294294
work_sheet[f"{column_id}{row_id}"].value = getattr(job_eval.overview, field)
295-
295+
296296

297297
def fill_range_float(
298298
work_sheet: Worksheet,
@@ -371,9 +371,7 @@ def fill_other(
371371
job_eval_list = tqdm(job_eval_list, desc="Filling other scores")
372372
for row_id, job_eval in enumerate(job_eval_list, START_ROW_ID):
373373
for column_id, field in zip(colum_id_list, OTHER_FIELD_LIST):
374-
work_sheet[f"{column_id}{row_id}"].value = getattr(
375-
job_eval.other, field
376-
)
374+
work_sheet[f"{column_id}{row_id}"].value = getattr(job_eval.other, field)
377375

378376

379377
def fill_work_sheet(
@@ -396,4 +394,4 @@ def fill_work_sheet(
396394
fill_overview(work_sheet, job_eval_list, show_progress)
397395
fill_range_float(work_sheet, job_eval_list, show_progress)
398396
fill_range_date(work_sheet, job_eval_list, show_progress)
399-
fill_other(work_sheet, job_eval_list, show_progress)
397+
fill_other(work_sheet, job_eval_list, show_progress)

hrflow/utils/evaluation/profile.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,6 @@ def parsing_evaluator(
343343
return [ProfileEvaluation.from_profile(profile) for profile in profile_list]
344344

345345

346-
347346
def fill_metadata(
348347
work_sheet: Worksheet,
349348
profile_eval_list: t.List[ProfileEvaluation],
@@ -494,4 +493,4 @@ def fill_work_sheet(
494493
fill_info(work_sheet, profile_eval_list, show_progress)
495494
fill_experience(work_sheet, profile_eval_list, show_progress)
496495
fill_education(work_sheet, profile_eval_list, show_progress)
497-
fill_other(work_sheet, profile_eval_list, show_progress)
496+
fill_other(work_sheet, profile_eval_list, show_progress)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "hrflow"
3-
version = "4.0.1"
3+
version = "4.1.0"
44
description = "Python hrflow.ai API package"
55
authors = ["HrFlow.ai <contact@hrflow.ai>"]
66
license = "MIT"

0 commit comments

Comments
 (0)