Skip to content

Commit 2d23e88

Browse files
[INF] Update code_check github actions black version (#848)
* Updated black version in github code-checks action to match pre-commit hooks version * Updated Chanelog * Updated black version in yml file * formatted files with newer black version
1 parent 3ba01e4 commit 2d23e88

12 files changed

+67
-22
lines changed

.github/workflows/code-checks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
uses: actions/setup-python@v2
1616

1717
- name: Install black
18-
run: python -m pip install black==19.10b0
18+
run: python -m pip install black==21.7b0
1919

2020
- name: Run black
2121
run: black --config pyproject.toml --check .

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## [Unreleased]
44
- [INF] Update pre-commit hooks and remove mutable references. Issue #844. @loganthomas
55
- [INF] Add GitHub Release pointer to auto-release script. Issue #818. @loganthomas
6+
- [INF] Updated black version in github actions code-checks to match pre-commit hooks. @nvamsikrishna05
67

78
## [v0.21.0] - 2021-07-16
89

environment-dev.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ channels:
55
dependencies:
66
- python>=3.6, <3.9
77
- biopython
8-
- black=19.10b0
8+
- black=21.7b0
99
- bumpversion
1010
- cairo
1111
- conda

janitor/functions.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,8 @@ def get_dupes(
473473

474474

475475
def As_Categorical(
476-
categories: Optional[List] = None, order: Optional[str] = None,
476+
categories: Optional[List] = None,
477+
order: Optional[str] = None,
477478
) -> NamedTuple:
478479
"""
479480
Helper function for `encode_categorical`. It makes creating the
@@ -3145,7 +3146,9 @@ def currency_column_to_numeric(
31453146
@pf.register_dataframe_method
31463147
@deprecated_alias(search_cols="search_column_names")
31473148
def select_columns(
3148-
df: pd.DataFrame, *args, invert: bool = False,
3149+
df: pd.DataFrame,
3150+
*args,
3151+
invert: bool = False,
31493152
) -> pd.DataFrame:
31503153
"""
31513154
Method-chainable selection of columns.

janitor/utils.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,11 @@ def _computations_complete(
781781
# still thinking on how to improve speed of groupby apply
782782
else:
783783
df = df.groupby(by).apply(
784-
_base_complete, columns, all_strings, any_nulls, dict_present,
784+
_base_complete,
785+
columns,
786+
all_strings,
787+
any_nulls,
788+
dict_present,
785789
)
786790
df = df.drop(columns=by)
787791

@@ -829,7 +833,8 @@ def _base_complete(
829833

830834

831835
def _create_indexer_for_complete(
832-
df_index: pd.Index, columns: List[Union[List, Dict, str]],
836+
df_index: pd.Index,
837+
columns: List[Union[List, Dict, str]],
833838
) -> pd.DataFrame:
834839
"""
835840
This creates the index that will be used
@@ -1128,7 +1133,10 @@ def _data_checks_pivot_longer(
11281133
check("values_to", values_to, [str])
11291134

11301135
if (values_to in df.columns) and not any(
1131-
(".value" in names_to, isinstance(names_pattern, (list, tuple)),)
1136+
(
1137+
".value" in names_to,
1138+
isinstance(names_pattern, (list, tuple)),
1139+
)
11321140
):
11331141
# copied from pandas' melt source code
11341142
# with a minor tweak

tests/functions/test_complete.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,8 @@ def test_complete_groupby():
689689
)
690690

691691
result = df.complete(
692-
columns=[{"year": lambda x: range(x.min(), x.max() + 1)}], by="state",
692+
columns=[{"year": lambda x: range(x.min(), x.max() + 1)}],
693+
by="state",
693694
)
694695

695696
expected = pd.DataFrame(

tests/functions/test_convert_excel_date.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def test_convert_excel_date():
2222

2323
@pytest.mark.functions
2424
def test_convert_excel_date_with_string_data():
25-
""" Raises ValueError if values of column are not numeric """
25+
"""Raises ValueError if values of column are not numeric"""
2626
df = pd.read_excel(
2727
Path(pytest.EXAMPLES_DIR) / "notebooks" / "dirty_data.xlsx",
2828
engine="openpyxl",

tests/functions/test_encode_categorical.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def test_categories_ndim_gt_1_in_kwargs(df_categorical):
141141

142142
def test_categories_null_in_categories(df_categorical):
143143
"""
144-
Raise ValueError if there are nulls in the `categories`.
144+
Raise ValueError if there are nulls in the `categories`.
145145
"""
146146
with pytest.raises(ValueError):
147147
df_categorical.encode_categorical(col1=([None, 2, 3], None))
@@ -419,7 +419,9 @@ def test_various(df_in, df_out, kwargs):
419419
# **kwargs,
420420
# )
421421
# assert_frame_equal(result, df_out)
422-
result = df_in.encode_categorical(**kwargs,)
422+
result = df_in.encode_categorical(
423+
**kwargs,
424+
)
423425
# directly comparing columns is safe -
424426
# if the columns have differing categories
425427
# (especially for ordered True) it will fail.

tests/functions/test_pivot_longer.py

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,9 @@ def test_pivot_index_only_and_sort_by_appearance(df_checks_output):
379379
def test_pivot_index_only():
380380
"""Test output if only `index` is passed."""
381381
result = df_checks.pivot_longer(
382-
index="region", names_to="year", values_to="num_nests",
382+
index="region",
383+
names_to="year",
384+
values_to="num_nests",
383385
)
384386

385387
df_out = pd.DataFrame(
@@ -1251,7 +1253,12 @@ def test_multiple_values_sep(
12511253
paired_columns_pattern,
12521254
)
12531255
def test_extract_column_names_pattern(
1254-
df_in, df_out, index, names_to, names_pattern, sort_by_appearance,
1256+
df_in,
1257+
df_out,
1258+
index,
1259+
names_to,
1260+
names_pattern,
1261+
sort_by_appearance,
12551262
):
12561263
"""
12571264
Test output if `.value` is in the `names_to`
@@ -1595,7 +1602,12 @@ def test_extract_column_names_pattern(
15951602
paired_columns_sep,
15961603
)
15971604
def test_extract_column_names_sep(
1598-
df_in, df_out, index, names_to, names_sep, sort_by_appearance,
1605+
df_in,
1606+
df_out,
1607+
index,
1608+
names_to,
1609+
names_sep,
1610+
sort_by_appearance,
15991611
):
16001612
"""
16011613
Test output if `.value` is in the `names_to` argument
@@ -1830,7 +1842,12 @@ def test_paired_columns_no_index_pattern(
18301842
names_single_value,
18311843
)
18321844
def test_single_value(
1833-
df_in, df_out, index, names_pattern, ignore_index, sort_by_appearance,
1845+
df_in,
1846+
df_out,
1847+
index,
1848+
names_pattern,
1849+
ignore_index,
1850+
sort_by_appearance,
18341851
):
18351852
"""Test function where names_to is a string and == `.value`."""
18361853
result = df_in.pivot_longer(
@@ -1951,7 +1968,9 @@ def test_group_present():
19511968
)
19521969

19531970
result = df_in.pivot_longer(
1954-
index="id", names_to=[".value", "group"], names_pattern="(.)(.)",
1971+
index="id",
1972+
names_to=[".value", "group"],
1973+
names_pattern="(.)(.)",
19551974
)
19561975

19571976
assert_frame_equal(result, df_out)

tests/functions/test_pivot_wider.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,9 @@ def test_names_sort_wrong_type(df_checks_output):
246246
"""Raise TypeError if the wrong type is provided for `names_sort`."""
247247
with pytest.raises(TypeError):
248248
df_checks_output.pivot_wider(
249-
index="name", names_from=["estimate", "variable"], names_sort=2,
249+
index="name",
250+
names_from=["estimate", "variable"],
251+
names_sort=2,
250252
)
251253

252254

@@ -359,7 +361,9 @@ def test_pivot_long_wide_long():
359361
result = df_in.pivot_wider(index=["a", "b"], names_from="name")
360362

361363
result = result.pivot_longer(
362-
index=["a", "b"], names_to=("name", ".value"), names_sep="_",
364+
index=["a", "b"],
365+
names_to=("name", ".value"),
366+
names_sep="_",
363367
)
364368
assert_frame_equal(result, df_in)
365369

@@ -447,7 +451,9 @@ def test_flatten_levels_false():
447451
)
448452

449453
assert_frame_equal(
450-
result, expected_output, check_dtype=False,
454+
result,
455+
expected_output,
456+
check_dtype=False,
451457
)
452458

453459

tests/functions/test_process_text.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,9 @@ def test_str_cat(no_nulls_df):
126126
"""Test outcome for Pandas ``.str.cat()`` method."""
127127

128128
result = no_nulls_df.process_text(
129-
column_name="text", string_function="cat", others=["A", "B", "C", "D"],
129+
column_name="text",
130+
string_function="cat",
131+
others=["A", "B", "C", "D"],
130132
)
131133

132134
expected = no_nulls_df.assign(
@@ -143,7 +145,8 @@ def test_str_cat_result_is_a_string(no_nulls_df):
143145
"""
144146

145147
result = no_nulls_df.process_text(
146-
column_name="text", string_function="cat",
148+
column_name="text",
149+
string_function="cat",
147150
)
148151

149152
expected = no_nulls_df.assign(text=no_nulls_df["text"].str.cat())

tests/functions/test_update_where.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,7 @@ def test_not_boolean_conditions(df):
4545
"""Raise Error if `conditions` is not a boolean type."""
4646
with pytest.raises(ValueError):
4747
df.update_where(
48-
conditions=(df.a + 5), target_column_name="c", target_val=10,
48+
conditions=(df.a + 5),
49+
target_column_name="c",
50+
target_val=10,
4951
)

0 commit comments

Comments
 (0)