Skip to content

Commit 486e0b2

Browse files
committed
Clean-up lint messages
1 parent dfba1a9 commit 486e0b2

File tree

5 files changed

+11
-12
lines changed

5 files changed

+11
-12
lines changed

dbldatagen/column_generation_spec.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ def setBaseColumnDatatypes(self, columnDatatypes):
480480
assert type(columnDatatypes) is list, " `column_datatypes` parameter must be list"
481481
ensure(len(columnDatatypes) == len(self.baseColumns),
482482
"number of base column datatypes must match number of base columns")
483-
self._baseColumnDatatypes = [].append(columnDatatypes)
483+
self._baseColumnDatatypes = columnDatatypes
484484

485485
def _setupTemporaryColumns(self):
486486
""" Set up any temporary columns needed for test data generation.

dbldatagen/text_generators.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def __str__(self):
7777
return f"TextGenerator(randomSeed={self._randomSeed})"
7878

7979
def __eq__(self, other):
80-
return type(self) == type(other) and self._randomSeed == other._randomSeed
80+
return isinstance(self, type(other)) and self._randomSeed == other._randomSeed
8181

8282
def withRandomSeed(self, seed):
8383
""" Set the random seed for the text generator
@@ -260,7 +260,7 @@ def __init__(self, template, escapeSpecialChars=False, extendedWordList=None):
260260
assert v is not None and isinstance(v, tuple) and len(v) == 2, "value must be tuple of length 2"
261261
mapping_length, mappings = v
262262
assert isinstance(mapping_length, int), "mapping length must be of type int"
263-
assert isinstance(mappings, (list, np.ndarray)),\
263+
assert isinstance(mappings, (list, np.ndarray)), \
264264
"mappings are lists or numpy arrays"
265265
assert mapping_length == 0 or len(mappings) == mapping_length, "mappings must match mapping_length"
266266

@@ -277,7 +277,7 @@ def __init__(self, template, escapeSpecialChars=False, extendedWordList=None):
277277
assert v is not None and isinstance(v, tuple) and len(v) == 2, "value must be tuple of length 2"
278278
mapping_length, mappings = v
279279
assert isinstance(mapping_length, int), "mapping length must be of type int"
280-
assert mappings is None or isinstance(mappings, (list, np.ndarray)),\
280+
assert mappings is None or isinstance(mappings, (list, np.ndarray)), \
281281
"mappings are lists or numpy arrays"
282282

283283
# for escaped mappings, the mapping can be None in which case the mapping is to the number itself

tests/test_basic_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,5 +530,5 @@ def test_library_version(self):
530530
lib_version = dg.__version__
531531

532532
assert lib_version is not None
533-
assert type(lib_version) == str, "__version__ is expected to be a string"
533+
assert isinstance(lib_version, str), "__version__ is expected to be a string"
534534
assert len(lib_version.strip()) > 0, "__version__ is expected to be non-empty"

tests/test_columnGenerationSpec.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,40 +59,40 @@ def test_prefix(self):
5959
dt = StringType()
6060
cd = dg.ColumnGenerationSpec(name="test", colType=StringType(), prefix="test_")
6161
assert cd.prefix == "test_"
62-
assert type(cd.datatype) == type(dt)
62+
assert isinstance(cd.datatype, type(dt))
6363

6464
def test_suffix(self):
6565
dt = StringType()
6666
cd = dg.ColumnGenerationSpec(name="test", colType=StringType(), suffix="_test")
6767
assert cd.suffix == "_test"
68-
assert type(cd.datatype) == type(dt)
68+
assert isinstance(cd.datatype, type(dt))
6969

7070
def test_baseColumn(self):
7171
dt = StringType()
7272
cd = dg.ColumnGenerationSpec(name="test", colType=StringType(), baseColumn='test0')
7373
assert cd.baseColumn == 'test0', "baseColumn should be as expected"
7474
assert cd.baseColumns == ['test0']
75-
assert type(cd.datatype) == type(dt)
75+
assert isinstance(cd.datatype, type(dt))
7676

7777
def test_baseColumnMultiple(self):
7878
dt = StringType()
7979
cd = dg.ColumnGenerationSpec(name="test", colType=StringType(), baseColumn=['test0', 'test_1'])
8080
assert cd.baseColumn == ['test0', 'test_1'], "baseColumn should be as expected"
8181
assert cd.baseColumns == ['test0', 'test_1']
82-
assert type(cd.datatype) == type(dt)
82+
assert isinstance(cd.datatype, type(dt))
8383

8484
def test_baseColumnMultiple2(self):
8585
dt = StringType()
8686
cd = dg.ColumnGenerationSpec(name="test", colType=StringType(), baseColumn='test0,test_1')
8787
assert cd.baseColumn == 'test0,test_1', "baseColumn should be as expected"
8888
assert cd.baseColumns == ['test0', 'test_1']
89-
assert type(cd.datatype) == type(dt)
89+
assert isinstance(cd.datatype, type(dt))
9090

9191
def test_expr(self):
9292
dt = StringType()
9393
cd = dg.ColumnGenerationSpec(name="test", colType=StringType(), baseColumn='test0,test_1', expr="concat(1,2)")
9494
assert cd.expr == 'concat(1,2)'
95-
assert type(cd.datatype) == type(dt)
95+
assert isinstance(cd.datatype, type(dt))
9696

9797
def test_default_random_attribute(self):
9898
dt = StringType()

tests/test_quick_tests.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,6 @@ def test_from_dict(self):
767767
assert new_gen.rowCount == 1000
768768
assert new_gen.partitions == 2
769769

770-
771770
def test_version_info(self):
772771
# test access to version info without explicit import
773772
print("Data generator version", dg.__version__)

0 commit comments

Comments
 (0)