From 46abb2060109e917b150023e258fd7e005c7aa60 Mon Sep 17 00:00:00 2001 From: Carlotta Fabian <73344238+fabinca@users.noreply.github.com> Date: Fri, 21 Oct 2022 15:52:08 +0200 Subject: [PATCH] STYLE fix: pylint "consider-using-in" warning (#49213) * consider-using-in * consider-using-in * remove consider using in from pyproject.toml to add it to pylint * after running pre-commit chacks Co-authored-by: carlotta --- pandas/core/computation/pytables.py | 4 ++-- pandas/core/frame.py | 2 +- pandas/core/indexes/base.py | 2 +- pandas/core/indexes/datetimelike.py | 2 +- pandas/core/indexes/range.py | 6 +++--- pandas/core/nanops.py | 2 +- pandas/core/ops/__init__.py | 2 +- pandas/io/formats/excel.py | 2 +- pandas/io/formats/style.py | 2 +- pandas/io/formats/style_render.py | 4 ++-- pandas/io/html.py | 2 +- pandas/io/json/_json.py | 2 +- pandas/io/parsers/python_parser.py | 12 ++++++------ pandas/io/parsers/readers.py | 2 +- pandas/io/pytables.py | 6 +++--- pandas/io/sas/sas7bdat.py | 5 +---- pandas/io/sql.py | 2 +- pandas/io/stata.py | 2 +- pandas/tests/apply/test_frame_apply.py | 2 +- pandas/tests/apply/test_frame_transform.py | 2 +- pandas/tests/apply/test_str.py | 6 +++--- pandas/tests/frame/methods/test_interpolate.py | 2 +- pandas/tests/indexes/test_setops.py | 2 +- pandas/tests/indexing/multiindex/test_slice.py | 15 +++++++-------- pandas/tests/io/excel/test_readers.py | 2 +- pandas/tests/io/json/test_pandas.py | 2 +- pandas/tests/util/test_assert_series_equal.py | 4 +--- pandas/tseries/frequencies.py | 2 +- pandas/tseries/holiday.py | 4 ++-- pyproject.toml | 1 - setup.py | 2 +- 31 files changed, 50 insertions(+), 57 deletions(-) diff --git a/pandas/core/computation/pytables.py b/pandas/core/computation/pytables.py index f0f3e7f19db505..043f05ca0a38fd 100644 --- a/pandas/core/computation/pytables.py +++ b/pandas/core/computation/pytables.py @@ -211,7 +211,7 @@ def stringify(value): kind = ensure_decoded(self.kind) meta = ensure_decoded(self.meta) - if kind == "datetime64" or kind == "datetime": + if kind in ("datetime64", "datetime"): if isinstance(v, (int, float)): v = stringify(v) v = ensure_decoded(v) @@ -219,7 +219,7 @@ def stringify(value): if v.tz is not None: v = v.tz_convert("UTC") return TermValue(v, v.value, kind) - elif kind == "timedelta64" or kind == "timedelta": + elif kind in ("timedelta64", "timedelta"): if isinstance(v, str): v = Timedelta(v).value else: diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 0737836bf412f0..062cd27b9a3eb3 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -1754,7 +1754,7 @@ def from_dict( # error: Incompatible types in assignment (expression has type # "List[Any]", variable has type "Dict[Any, Any]") data = list(data.values()) # type: ignore[assignment] - elif orient == "columns" or orient == "tight": + elif orient in ("columns", "tight"): if columns is not None: raise ValueError(f"cannot use columns parameter with orient='{orient}'") else: # pragma: no cover diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index 1ae5b97cc09136..c35a0d5229070e 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -4066,7 +4066,7 @@ def _check_indexing_method( "method='nearest' not implemented yet " "for MultiIndex; see GitHub issue 9365" ) - elif method == "pad" or method == "backfill": + elif method in ("pad", "backfill"): if tolerance is not None: raise NotImplementedError( "tolerance not implemented yet for MultiIndex" diff --git a/pandas/core/indexes/datetimelike.py b/pandas/core/indexes/datetimelike.py index dafa5e9680eecf..d80eefb09afbe8 100644 --- a/pandas/core/indexes/datetimelike.py +++ b/pandas/core/indexes/datetimelike.py @@ -663,7 +663,7 @@ def _get_insert_freq(self, loc: int, item): if self.size: if item is NaT: pass - elif (loc == 0 or loc == -len(self)) and item + self.freq == self[0]: + elif loc in (0, -len(self)) and item + self.freq == self[0]: freq = self.freq elif (loc == len(self)) and item - self.freq == self[-1]: freq = self.freq diff --git a/pandas/core/indexes/range.py b/pandas/core/indexes/range.py index 64a8d0d1ed54cb..de50f86756c7ac 100644 --- a/pandas/core/indexes/range.py +++ b/pandas/core/indexes/range.py @@ -833,11 +833,11 @@ def delete(self, loc) -> Index: # type: ignore[override] # In some cases we can retain RangeIndex, see also # DatetimeTimedeltaMixin._get_delete_Freq if is_integer(loc): - if loc == 0 or loc == -len(self): + if loc in (0, -len(self)): return self[1:] - if loc == -1 or loc == len(self) - 1: + if loc in (-1, len(self) - 1): return self[:-1] - if len(self) == 3 and (loc == 1 or loc == -2): + if len(self) == 3 and loc in (1, -2): return self[::2] elif lib.is_list_like(loc): diff --git a/pandas/core/nanops.py b/pandas/core/nanops.py index 36a3281b7b9313..326e6c42511529 100644 --- a/pandas/core/nanops.py +++ b/pandas/core/nanops.py @@ -183,7 +183,7 @@ def _bn_ok_dtype(dtype: DtypeObj, name: str) -> bool: def _has_infs(result) -> bool: if isinstance(result, np.ndarray): - if result.dtype == "f8" or result.dtype == "f4": + if result.dtype in ("f8", "f4"): # Note: outside of an nanops-specific test, we always have # result.ndim == 1, so there is no risk of this ravel making a copy. return lib.has_infs(result.ravel("K")) diff --git a/pandas/core/ops/__init__.py b/pandas/core/ops/__init__.py index d08bc1b6756c46..4007d3cfa46da8 100644 --- a/pandas/core/ops/__init__.py +++ b/pandas/core/ops/__init__.py @@ -397,7 +397,7 @@ def _maybe_align_series_as_frame(frame: DataFrame, series: Series, axis: AxisInt rvalues = series._values if not isinstance(rvalues, np.ndarray): # TODO(EA2D): no need to special-case with 2D EAs - if rvalues.dtype == "datetime64[ns]" or rvalues.dtype == "timedelta64[ns]": + if rvalues.dtype in ("datetime64[ns]", "timedelta64[ns]"): # We can losslessly+cheaply cast to ndarray rvalues = np.asarray(rvalues) else: diff --git a/pandas/io/formats/excel.py b/pandas/io/formats/excel.py index ce7f663dd5703a..466ffe5ac1b495 100644 --- a/pandas/io/formats/excel.py +++ b/pandas/io/formats/excel.py @@ -277,7 +277,7 @@ def _border_style(self, style: str | None, width: str | None, color: str | None) # Return "none" will keep "border" in style dictionary return "none" - if style == "none" or style == "hidden": + if style in ("none", "hidden"): return "none" width_name = self._get_width_name(width) diff --git a/pandas/io/formats/style.py b/pandas/io/formats/style.py index db3c86b734cf44..155465c358b5e5 100644 --- a/pandas/io/formats/style.py +++ b/pandas/io/formats/style.py @@ -4210,7 +4210,7 @@ def css_calc(x, left: float, right: float, align: str, color: str | list | tuple z, align = align(values), "zero" elif isinstance(align, (float, int)): z, align = float(align), "zero" - elif not (align == "left" or align == "right" or align == "zero"): + elif align not in ("left", "right", "zero"): raise ValueError( "`align` should be in {'left', 'right', 'mid', 'mean', 'zero'} or be a " "value defining the center line or a callable that returns a float" diff --git a/pandas/io/formats/style_render.py b/pandas/io/formats/style_render.py index b8ea0374c0288c..6d815b43a9bcdf 100644 --- a/pandas/io/formats/style_render.py +++ b/pandas/io/formats/style_render.py @@ -2228,14 +2228,14 @@ def _parse_latex_css_conversion(styles: CSSList) -> CSSList: """ def font_weight(value, arg): - if value == "bold" or value == "bolder": + if value in ("bold", "bolder"): return "bfseries", f"{arg}" return None def font_style(value, arg): if value == "italic": return "itshape", f"{arg}" - elif value == "oblique": + if value == "oblique": return "slshape", f"{arg}" return None diff --git a/pandas/io/html.py b/pandas/io/html.py index 3cfd450e482572..a08b73d94250bc 100644 --- a/pandas/io/html.py +++ b/pandas/io/html.py @@ -527,7 +527,7 @@ def _expand_colspan_rowspan( # Append the text from this , colspan times text = _remove_whitespace(self._text_getter(td)) - if self.extract_links == "all" or self.extract_links == section: + if self.extract_links in ("all", section): href = self._href_getter(td) text = (text, href) rowspan = int(self._attr_getter(td, "rowspan") or 1) diff --git a/pandas/io/json/_json.py b/pandas/io/json/_json.py index 90c81e06ca06a2..4bf883a7214bf8 100644 --- a/pandas/io/json/_json.py +++ b/pandas/io/json/_json.py @@ -1146,7 +1146,7 @@ def _try_convert_data( pass # don't coerce 0-len data - if len(data) and (data.dtype == "float" or data.dtype == "object"): + if len(data) and data.dtype in ("float", "object"): # coerce ints if we can try: diff --git a/pandas/io/parsers/python_parser.py b/pandas/io/parsers/python_parser.py index c3b196f538463f..daf89319a4520f 100644 --- a/pandas/io/parsers/python_parser.py +++ b/pandas/io/parsers/python_parser.py @@ -788,9 +788,9 @@ def _next_iter_line(self, row_num: int) -> list[Scalar] | None: assert isinstance(line, list) return line except csv.Error as e: - if ( - self.on_bad_lines == self.BadLineHandleMethod.ERROR - or self.on_bad_lines == self.BadLineHandleMethod.WARN + if self.on_bad_lines in ( + self.BadLineHandleMethod.ERROR, + self.BadLineHandleMethod.WARN, ): msg = str(e) @@ -1013,9 +1013,9 @@ def _rows_to_cols(self, content: list[list[Scalar]]) -> list[np.ndarray]: new_l = self.on_bad_lines(l) if new_l is not None: content.append(new_l) - elif ( - self.on_bad_lines == self.BadLineHandleMethod.ERROR - or self.on_bad_lines == self.BadLineHandleMethod.WARN + elif self.on_bad_lines in ( + self.BadLineHandleMethod.ERROR, + self.BadLineHandleMethod.WARN, ): row_num = self.pos - (content_len - i + footers) bad_lines.append((row_num, actual_len)) diff --git a/pandas/io/parsers/readers.py b/pandas/io/parsers/readers.py index c1698c68ce4658..81ffa746931567 100644 --- a/pandas/io/parsers/readers.py +++ b/pandas/io/parsers/readers.py @@ -2229,7 +2229,7 @@ def _merge_with_dialect_properties( # Don't warn if the default parameter was passed in, # even if it conflicts with the dialect (gh-23761). - if provided != parser_default and provided != dialect_val: + if provided not in (parser_default, dialect_val): msg = ( f"Conflicting values for '{param}': '{provided}' was " f"provided, but the dialect specifies '{dialect_val}'. " diff --git a/pandas/io/pytables.py b/pandas/io/pytables.py index a95d1b9d7cce6c..ab3151f01b31f0 100644 --- a/pandas/io/pytables.py +++ b/pandas/io/pytables.py @@ -618,7 +618,7 @@ def __contains__(self, key: str) -> bool: node = self.get_node(key) if node is not None: name = node._v_pathname - if name == key or name[1:] == key: + if key in (name, name[1:]): return True return False @@ -3006,7 +3006,7 @@ def read_index_node( attrs = node._v_attrs factory, kwargs = self._get_index_factory(attrs) - if kind == "date" or kind == "object": + if kind in ("date", "object"): index = factory( _unconvert_index( data, kind, encoding=self.encoding, errors=self.errors @@ -5243,7 +5243,7 @@ def __init__( # see if we have a passed coordinate like with suppress(ValueError): inferred = lib.infer_dtype(where, skipna=False) - if inferred == "integer" or inferred == "boolean": + if inferred in ("integer", "boolean"): where = np.asarray(where) if where.dtype == np.bool_: start, stop = self.start, self.stop diff --git a/pandas/io/sas/sas7bdat.py b/pandas/io/sas/sas7bdat.py index a60c1eb025218a..80efef211ece59 100644 --- a/pandas/io/sas/sas7bdat.py +++ b/pandas/io/sas/sas7bdat.py @@ -431,10 +431,7 @@ def _process_page_metadata(self) -> None: subheader_processor = self._subheader_processors[subheader_index] if subheader_processor is None: - f1 = ( - subheader_compression == const.compressed_subheader_id - or subheader_compression == 0 - ) + f1 = subheader_compression in (const.compressed_subheader_id, 0) f2 = subheader_type == const.compressed_subheader_type if self.compression and f1 and f2: self._current_page_data_subheader_pointers.append( diff --git a/pandas/io/sql.py b/pandas/io/sql.py index 305fc8ba4b040b..783b5f8cd63aeb 100644 --- a/pandas/io/sql.py +++ b/pandas/io/sql.py @@ -1178,7 +1178,7 @@ def _sqlalchemy_type(self, col): Time, ) - if col_type == "datetime64" or col_type == "datetime": + if col_type in ("datetime64", "datetime"): # GH 9086: TIMESTAMP is the suggested type if the column contains # timezone information try: diff --git a/pandas/io/stata.py b/pandas/io/stata.py index 06cba7388b294c..037aeb53398183 100644 --- a/pandas/io/stata.py +++ b/pandas/io/stata.py @@ -2178,7 +2178,7 @@ def _dtype_to_default_stata_fmt( return "%9.0g" elif dtype == np.int32: return "%12.0g" - elif dtype == np.int8 or dtype == np.int16: + elif dtype in (np.int8, np.int16): return "%8.0g" else: # pragma : no cover raise NotImplementedError(f"Data type {dtype} not supported.") diff --git a/pandas/tests/apply/test_frame_apply.py b/pandas/tests/apply/test_frame_apply.py index 3bcb7d964fad11..a7aefc9b1eaa04 100644 --- a/pandas/tests/apply/test_frame_apply.py +++ b/pandas/tests/apply/test_frame_apply.py @@ -1342,7 +1342,7 @@ def test_size_as_str(how, axis): # Just a string attribute arg same as calling df.arg # on the columns result = getattr(df, how)("size", axis=axis) - if axis == 0 or axis == "index": + if axis in (0, "index"): expected = Series(df.shape[0], index=df.columns) else: expected = Series(df.shape[1], index=df.index) diff --git a/pandas/tests/apply/test_frame_transform.py b/pandas/tests/apply/test_frame_transform.py index 2d4deff8ebc4a9..c7a99400ab8e1a 100644 --- a/pandas/tests/apply/test_frame_transform.py +++ b/pandas/tests/apply/test_frame_transform.py @@ -69,7 +69,7 @@ def test_transform_empty_listlike(float_frame, ops, frame_or_series): @pytest.mark.parametrize("box", [dict, Series]) def test_transform_dictlike(axis, float_frame, box): # GH 35964 - if axis == 0 or axis == "index": + if axis in (0, "index"): e = float_frame.columns[0] expected = float_frame[[e]].transform(np.abs) else: diff --git a/pandas/tests/apply/test_str.py b/pandas/tests/apply/test_str.py index 38b2a5459eb1fa..36182c46bfd67d 100644 --- a/pandas/tests/apply/test_str.py +++ b/pandas/tests/apply/test_str.py @@ -236,7 +236,7 @@ def test_agg_cython_table_transform_frame(df, func, expected, axis): # GH 21224 # test transforming functions in # pandas.core.base.SelectionMixin._cython_table (cumprod, cumsum) - if axis == "columns" or axis == 1: + if axis in ("columns", 1): # operating blockwise doesn't let us preserve dtypes expected = expected.astype("float64") @@ -273,7 +273,7 @@ def test_transform_groupby_kernel_frame(request, axis, float_frame, op): # GH 35964 args = [0.0] if op == "fillna" else [] - if axis == 0 or axis == "index": + if axis in (0, "index"): ones = np.ones(float_frame.shape[0]) else: ones = np.ones(float_frame.shape[1]) @@ -286,7 +286,7 @@ def test_transform_groupby_kernel_frame(request, axis, float_frame, op): float_frame["E"] = float_frame["A"].copy() assert len(float_frame._mgr.arrays) > 1 - if axis == 0 or axis == "index": + if axis in (0, "index"): ones = np.ones(float_frame.shape[0]) else: ones = np.ones(float_frame.shape[1]) diff --git a/pandas/tests/frame/methods/test_interpolate.py b/pandas/tests/frame/methods/test_interpolate.py index 7d6cf43c530a76..6543fd8efdf1b7 100644 --- a/pandas/tests/frame/methods/test_interpolate.py +++ b/pandas/tests/frame/methods/test_interpolate.py @@ -383,7 +383,7 @@ def test_interp_string_axis(self, axis_name, axis_number): @pytest.mark.parametrize("method", ["ffill", "bfill", "pad"]) def test_interp_fillna_methods(self, request, axis, method, using_array_manager): # GH 12918 - if using_array_manager and (axis == 1 or axis == "columns"): + if using_array_manager and axis in (1, "columns"): # TODO(ArrayManager) support axis=1 td.mark_array_manager_not_yet_implemented(request) diff --git a/pandas/tests/indexes/test_setops.py b/pandas/tests/indexes/test_setops.py index 4cb8e95f32e6ba..1939a30ad66ce2 100644 --- a/pandas/tests/indexes/test_setops.py +++ b/pandas/tests/indexes/test_setops.py @@ -103,7 +103,7 @@ def test_union_different_types(index_flat, index_flat2, request): # complex objects non-sortable warn = RuntimeWarning - any_uint64 = idx1.dtype == np.uint64 or idx2.dtype == np.uint64 + any_uint64 = np.uint64 in (idx1.dtype, idx2.dtype) idx1_signed = is_signed_integer_dtype(idx1.dtype) idx2_signed = is_signed_integer_dtype(idx2.dtype) diff --git a/pandas/tests/indexing/multiindex/test_slice.py b/pandas/tests/indexing/multiindex/test_slice.py index 91ea1f7cec324d..b059839746eeff 100644 --- a/pandas/tests/indexing/multiindex/test_slice.py +++ b/pandas/tests/indexing/multiindex/test_slice.py @@ -35,7 +35,7 @@ def test_per_axis_per_level_getitem(self): d, ) for a, b, c, d in df.index.values - if (a == "A1" or a == "A2" or a == "A3") and (c == "C1" or c == "C3") + if a in ("A1", "A2", "A3") and c in ("C1", "C3") ] ] tm.assert_frame_equal(result, expected) @@ -49,8 +49,7 @@ def test_per_axis_per_level_getitem(self): d, ) for a, b, c, d in df.index.values - if (a == "A1" or a == "A2" or a == "A3") - and (c == "C1" or c == "C2" or c == "C3") + if a in ("A1", "A2", "A3") and c in ("C1", "C2", "C3") ] ] result = df.loc[(slice("A1", "A3"), slice(None), slice("C1", "C3")), :] @@ -121,7 +120,7 @@ def test_per_axis_per_level_getitem(self): d, ) for a, b, c, d in s.index.values - if (a == "A1" or a == "A2" or a == "A3") and (c == "C1" or c == "C3") + if a in ("A1", "A2", "A3") and c in ("C1", "C3") ] ] tm.assert_series_equal(result, expected) @@ -416,7 +415,7 @@ def test_per_axis_per_level_doc_examples(self): d, ) for a, b, c, d in df.index.values - if (a == "A1" or a == "A2" or a == "A3") and (c == "C1" or c == "C3") + if a in ("A1", "A2", "A3") and c in ("C1", "C3") ] ] tm.assert_frame_equal(result, expected) @@ -433,7 +432,7 @@ def test_per_axis_per_level_doc_examples(self): d, ) for a, b, c, d in df.index.values - if (c == "C1" or c == "C3") + if c in ("C1", "C3") ] ] tm.assert_frame_equal(result, expected) @@ -494,7 +493,7 @@ def test_loc_axis_arguments(self): d, ) for a, b, c, d in df.index.values - if (a == "A1" or a == "A2" or a == "A3") and (c == "C1" or c == "C3") + if a in ("A1", "A2", "A3") and c in ("C1", "C3") ] ] tm.assert_frame_equal(result, expected) @@ -509,7 +508,7 @@ def test_loc_axis_arguments(self): d, ) for a, b, c, d in df.index.values - if (c == "C1" or c == "C3") + if c in ("C1", "C3") ] ] tm.assert_frame_equal(result, expected) diff --git a/pandas/tests/io/excel/test_readers.py b/pandas/tests/io/excel/test_readers.py index 652ae75d480700..16fbf54bbe3940 100644 --- a/pandas/tests/io/excel/test_readers.py +++ b/pandas/tests/io/excel/test_readers.py @@ -1191,7 +1191,7 @@ def test_read_excel_nrows_non_integer_parameter(self, read_ext): ("testmultiindex", "both", [0, 1], [0, 1], None), ("testmultiindex", "mi_column_name", [0, 1], 0, None), ("testskiprows", "skiprows_list", None, None, [0, 2]), - ("testskiprows", "skiprows_list", None, None, lambda x: x == 0 or x == 2), + ("testskiprows", "skiprows_list", None, None, lambda x: x in (0, 2)), ], ) def test_read_excel_nrows_params( diff --git a/pandas/tests/io/json/test_pandas.py b/pandas/tests/io/json/test_pandas.py index ef4a172f07b0a7..749075b8637cf7 100644 --- a/pandas/tests/io/json/test_pandas.py +++ b/pandas/tests/io/json/test_pandas.py @@ -24,7 +24,7 @@ def assert_json_roundtrip_equal(result, expected, orient): - if orient == "records" or orient == "values": + if orient in ("records", "values"): expected = expected.reset_index(drop=True) if orient == "values": expected.columns = range(len(expected.columns)) diff --git a/pandas/tests/util/test_assert_series_equal.py b/pandas/tests/util/test_assert_series_equal.py index 25f5b31eb46646..4665077696b2b2 100644 --- a/pandas/tests/util/test_assert_series_equal.py +++ b/pandas/tests/util/test_assert_series_equal.py @@ -115,9 +115,7 @@ def test_less_precise(data1, data2, dtype, decimals): s1 = Series([data1], dtype=dtype) s2 = Series([data2], dtype=dtype) - if (decimals == 5 or decimals == 10) or ( - decimals >= 3 and abs(data1 - data2) >= 0.0005 - ): + if decimals in (5, 10) or (decimals >= 3 and abs(data1 - data2) >= 0.0005): if is_extension_array_dtype(dtype): msg = "ExtensionArray are different" else: diff --git a/pandas/tseries/frequencies.py b/pandas/tseries/frequencies.py index 97dcd0b011b622..a7fe2da703908e 100644 --- a/pandas/tseries/frequencies.py +++ b/pandas/tseries/frequencies.py @@ -642,7 +642,7 @@ def _is_quarterly(rule: str) -> bool: def _is_monthly(rule: str) -> bool: rule = rule.upper() - return rule == "M" or rule == "BM" + return rule in ("M", "BM") def _is_weekly(rule: str) -> bool: diff --git a/pandas/tseries/holiday.py b/pandas/tseries/holiday.py index a8e55c4c2522f5..cb65fc958414f5 100644 --- a/pandas/tseries/holiday.py +++ b/pandas/tseries/holiday.py @@ -54,9 +54,9 @@ def next_monday_or_tuesday(dt: datetime) -> datetime: (because Monday is already taken by adjacent holiday on the day before) """ dow = dt.weekday() - if dow == 5 or dow == 6: + if dow in (5, 6): return dt + timedelta(2) - elif dow == 0: + if dow == 0: return dt + timedelta(1) return dt diff --git a/pyproject.toml b/pyproject.toml index b8568f1839f42e..be753a7f2e6146 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -114,7 +114,6 @@ disable = [ "consider-merging-isinstance", "consider-using-from-import", "consider-using-get", - "consider-using-in", "consider-using-min-builtin", "consider-using-sys-exit", "consider-using-ternary", diff --git a/setup.py b/setup.py index 0e489c4c9b017c..f0a81779a90b6d 100755 --- a/setup.py +++ b/setup.py @@ -30,7 +30,7 @@ def is_platform_windows(): - return sys.platform == "win32" or sys.platform == "cygwin" + return sys.platform in ("win32", "cygwin") def is_platform_mac():