Skip to content

Commit 4b686ef

Browse files
committed
Fixed type hints
1 parent e943672 commit 4b686ef

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

src/vaskify/detect.py

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,14 @@ def accumulation_error(
260260
return output
261261

262262
@staticmethod
263-
def _calculate_hb(x1, x2, pu, pa, pc, percentiles): # type: ignore
263+
def _calculate_hb(
264+
x1: pd.Series, # type: ignore[type-arg]
265+
x2: pd.Series, # type: ignore[type-arg]
266+
pu: float,
267+
pa: float,
268+
pc: float,
269+
percentiles: tuple[float, float],
270+
) -> pd.DataFrame:
264271
"""Calculate HB method."""
265272
rat = x1 / x2
266273
med_ratio = rat.median()
@@ -312,7 +319,7 @@ def hb(
312319
strata_var: String variable for stratification. Default is blank ("").
313320
pu: Parameter that adjusts for different level of the variables. Default value 0.5.
314321
pa: Parameter that adjusts for small differences between the median and the 1st or 3rd quartile. Default value 0.05.
315-
pc: Parameter that controls the width of the confidence interval. Default value 4.
322+
pc: Parameter that controls the width of the confidence interval. Default value 20.
316323
percentiles: Tuple for percentile values to use.
317324
flag: String variable name to use to indicate outliers.
318325
output_format: String for format to return. Can be 'wide','long','outliers'.
@@ -365,12 +372,26 @@ def hb(
365372
limits = (
366373
valid_rows.groupby(strata_var)
367374
.apply(
368-
lambda group: self._calculate_hb(group[time1], group[time0], pu, pa, pc, percentiles), # type: ignore
375+
lambda group: self._calculate_hb(
376+
group[time1],
377+
group[time0],
378+
pu,
379+
pa,
380+
pc,
381+
percentiles,
382+
),
369383
)
370384
.reset_index(level=strata_var, drop=True)
371385
)
372386
else:
373-
limits = self._calculate_hb(valid_rows[time1], valid_rows[time0], pu, pa, pc, percentiles) # type: ignore
387+
limits = self._calculate_hb(
388+
valid_rows[time1],
389+
valid_rows[time0],
390+
pu,
391+
pa,
392+
pc,
393+
percentiles,
394+
)
374395

375396
# Merge the limits back into the valid_rows
376397
valid_rows = valid_rows.merge(

0 commit comments

Comments
 (0)