Skip to content

Commit fef7336

Browse files
committed
Fix Ruff E721 failures
1 parent 4238c23 commit fef7336

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

tiledb/dataframe_.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,7 @@ def from_values(cls, array_like, varlen_types=()):
110110
def from_dtype(cls, dtype, varlen_types=()):
111111
from pandas.api import types as pd_types
112112

113-
if (type(dtype) == str and dtype == "ascii") or (
114-
type(dtype) == np.dtype and str(dtype) == "ascii"
115-
):
113+
if isinstance(dtype, str) and dtype == "ascii":
116114
return cls("ascii", var=True)
117115

118116
dtype = pd_types.pandas_dtype(dtype)

tiledb/highlevel.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,13 +279,13 @@ def _schema_like_numpy(
279279
# for object arrays, we use the dtype of the first element
280280
# consistency check should be done later, if needed
281281
el0 = array.flat[0]
282-
if type(el0) is bytes:
282+
if isinstance(el0, bytes):
283283
el_dtype = np.dtype("S")
284284
var = True
285-
elif type(el0) is str:
285+
elif isinstance(el0, str):
286286
el_dtype = np.dtype("U")
287287
var = True
288-
elif type(el0) == np.ndarray:
288+
elif isinstance(el0, np.ndarray):
289289
if len(el0.shape) != 1:
290290
raise TypeError(
291291
"Unsupported sub-array type for Attribute: {} "

tiledb/tests/test_pandas_dataframe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ def test_dataframe_index_to_sparse_dims(self):
438438

439439
# also ensure that string columns are converted to bytes
440440
# b/c only TILEDB_ASCII supported for string dimension
441-
if type(df[col][0]) is str:
441+
if isinstance(df[col][0], str):
442442
df[col] = [x.encode("UTF-8") for x in df[col]]
443443

444444
new_df = df.drop_duplicates(subset=col)

0 commit comments

Comments
 (0)