Skip to content

Commit 92ed26b

Browse files
committed
style: address linting issues
1 parent 15e2a02 commit 92ed26b

7 files changed

Lines changed: 25 additions & 20 deletions

File tree

‎src/dve/core_engine/backends/base/reader.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from dve.core_engine.backends.exceptions import (
1212
CriticalMessageBearingError,
1313
MessageBearingError,
14-
ReaderLacksEntityTypeSupport
14+
ReaderLacksEntityTypeSupport,
1515
)
1616
from dve.core_engine.backends.types import EntityName, EntityType
1717
from dve.core_engine.configuration.v1 import (

‎src/dve/core_engine/backends/base/rules.py‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -426,11 +426,11 @@ def process_node(node: HierarchyNode) -> bool:
426426
msg_writer.write_queue.put(_messages)
427427

428428
self.cache_entity(node.entity_name, entities)
429-
429+
430430
_orph_count = len(_messages)
431-
431+
432432
self.logger.info(
433-
f"Found {_orph_count} orphan records between {node.entity_name} and {node.parent_entity}"
433+
f"Found {_orph_count} orphan records between {node.entity_name} and {node.parent_entity}" # pylint: disable=C0301
434434
)
435435

436436
return _orph_count > 0
@@ -499,13 +499,13 @@ def process_node(node: HierarchyNode) -> bool:
499499
]
500500
msg_writer.write_queue.put(_messages)
501501
self.cache_entity(node.parent_entity, entities)
502-
502+
503503
_no_valid_child_records: int = len(_messages)
504504

505505
self.logger.info(
506-
f"Found {_no_valid_child_records} records with no valid children in {node.parent_entity}."
507-
)
508-
506+
f"Found {_no_valid_child_records} records with no valid children in {node.parent_entity}." # pylint: disable=C0301
507+
)
508+
509509
return _no_valid_child_records > 0
510510

511511
entity_issues_found: dict[EntityName, bool] = {}

‎src/dve/core_engine/backends/exceptions.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def __init__(self, *args: object, messages: Messages) -> None:
3232
self.messages = messages
3333
"""The messages to be returned as part of the error."""
3434

35+
3536
class CriticalMessageBearingError(BackendError):
3637
"""
3738
A backend error that comes with a pre-created message.
@@ -44,6 +45,7 @@ def __init__(self, *args: object, message: FeedbackMessage) -> None:
4445
self.message = message
4546
"""The message to be returned as part of the error."""
4647

48+
4749
class UnableToParseCSVError(CriticalMessageBearingError):
4850
"""An error raised when unable to parse a CSV file"""
4951

@@ -60,7 +62,8 @@ def __init__(
6062
failure_type="submission",
6163
is_informational=False,
6264
error_type="csv read",
63-
error_message=error_message or "Unable to parse the CSV file. Please check the structure of your CSV.", # pylint: disable=C0301
65+
error_message=error_message
66+
or "Unable to parse the CSV file. Please check the structure of your CSV.", # pylint: disable=C0301
6467
error_code=error_code or "MalformedCSV",
6568
)
6669
)

‎src/dve/core_engine/backends/implementations/duckdb/readers/csv.py‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ def read_to_relation( # pylint: disable=unused-argument
123123
raise UnableToParseCSVError(
124124
entity_name="csv_structure",
125125
error_code=self.ft_error_code,
126-
error_message=self.ft_error_message or "Unable to parse CSV file. Structure is likely malformed.", # pylint: disable=C0301
126+
error_message=self.ft_error_message
127+
or "Unable to parse CSV file. Structure is likely malformed.", # pylint: disable=C0301
127128
) from exc
128129

129130
if self.null_empty_strings:
@@ -183,7 +184,8 @@ def read_to_relation( # pylint: disable=unused-argument
183184
raise UnableToParseCSVError(
184185
entity_name="csv_structure",
185186
error_code=self.ft_error_code,
186-
error_message=self.ft_error_message or "Unable to parse CSV file. Structure is likely malformed.", # pylint: disable=C0301
187+
error_message=self.ft_error_message
188+
or "Unable to parse CSV file. Structure is likely malformed.", # pylint: disable=C0301
187189
) from exc
188190

189191
if self.null_empty_strings:
@@ -200,7 +202,8 @@ def read_to_relation( # pylint: disable=unused-argument
200202
raise UnableToParseCSVError(
201203
entity_name="csv_structure",
202204
error_code=self.ft_error_code,
203-
error_message=self.ft_error_message or "Found zero records after loading CSV. File is likely malformed.", # pylint: disable=C0301
205+
error_message=self.ft_error_message
206+
or "Found zero records after loading CSV. File is likely malformed.", # pylint: disable=C0301
204207
)
205208

206209
return entity

‎src/dve/core_engine/backends/implementations/spark/rules.py‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -365,17 +365,16 @@ def identify_orphans(
365365

366366
target_df: DataFrame = entities[config.target_name]
367367
match_name = f"matched_{uuid4().hex}"
368-
target_df = target_df.select(
369-
"*",
370-
sf.lit(1).alias(match_name)
371-
).alias(config.target_name)
368+
target_df = target_df.select("*", sf.lit(1).alias(match_name)).alias(config.target_name)
372369

373370
orphaned_df: DataFrame = (
374371
source_df.join(target_df, on=sf.expr(config.join_condition), how="left")
375372
.groupBy(f"{config.entity_name}.{config.id}")
376373
.agg(
377-
sf.first(f"{config.entity_name}.{RECORD_INDEX_COLUMN_NAME}").alias(RECORD_INDEX_COLUMN_NAME), # pylint: disable=C0301
378-
(sf.coalesce(sf.count(match_name), sf.lit(0)) == sf.lit(0)).alias("IsOrphaned")
374+
sf.first(f"{config.entity_name}.{RECORD_INDEX_COLUMN_NAME}").alias(
375+
RECORD_INDEX_COLUMN_NAME
376+
), # pylint: disable=C0301
377+
(sf.coalesce(sf.count(match_name), sf.lit(0)) == sf.lit(0)).alias("IsOrphaned"),
379378
)
380379
.filter(sf.col("IsOrphaned"))
381380
.select(RECORD_INDEX_COLUMN_NAME)

‎src/dve/core_engine/backends/readers/utilities.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def raise_message_bearing_error_on_header_differences(
6666
reporting_field="csv_header",
6767
error_code=field_check_error_code,
6868
error_message=field_check_error_message,
69-
)
69+
),
7070
)
7171

7272

‎src/dve/pipeline/pipeline.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ def apply_business_rules( # pylint: disable=R0914,R0915
765765
fh.joinuri(
766766
self.processed_files_path, submission_info.submission_id, "temp_business_rules"
767767
),
768-
recursive=True
768+
recursive=True,
769769
)
770770

771771
self.check_mandatory_entities_have_records(

0 commit comments

Comments
 (0)