Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: replaced capturing regex terms with non capturing in datagraph t… #162

Merged
merged 3 commits into from
Jan 15, 2025

Conversation

JoshuaSiraj
Copy link
Collaborator

@JoshuaSiraj JoshuaSiraj commented Jan 8, 2025

…o deter warning

Summary by CodeRabbit

  • Refactor
    • Replaced regex patterns with lambda functions for edge type checks in data parsing.
    • Improved clarity and maintainability of query handling logic while preserving core functionality.

@JoshuaSiraj JoshuaSiraj linked an issue Jan 8, 2025 that may be closed by this pull request
Copy link
Contributor

coderabbitai bot commented Jan 8, 2025

Walkthrough

The pull request involves significant modifications to the parser method within the DataGraph class in the datagraph.py module. The changes replace the use of regular expressions for edge type checks with lambda functions that evaluate conditions based on the edge_type column. Additionally, the graph_query method's signature has been updated to accept a callable for edge conditions, enhancing the clarity and maintainability of the query handling logic.

Changes

File Change Summary
src/imgtools/modules/datagraph.py Replaced regex patterns in parser method with lambda functions for edge type checks; updated graph_query method to accept a Callable for edge conditions.

Poem

🐰 In the land of code, where edges play,
Lambdas hop in, keeping regex at bay.
Queries refined, with clarity bright,
A rabbit's delight in the code's new light!
Hooray for the changes, let’s dance and cheer,
For a smoother journey, the path is now clear! 🥕

Finishing Touches

  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🔭 Outside diff range comments (1)
src/imgtools/modules/datagraph.py (1)

Add unit tests for graph query regex patterns

The regex patterns in datagraph.py are critical for determining valid edge relationships between modalities, but currently lack test coverage. These patterns need dedicated unit tests to verify:

  • Edge type combinations (0, 1, 2, etc.)
  • Modality relationship validation (CT/MR, RTSTRUCT, RTDOSE, etc.)
  • Error cases and edge conditions

Example test cases should cover:

  • Basic edge type matching
  • Complex combinations with multiple look-ahead assertions
  • CT/MR agnostic functionality
  • Invalid pattern handling
🔗 Analysis chain

Line range hint 343-447: Consider adding unit tests for regex patterns.

The regex patterns are critical for the query functionality. Consider adding unit tests to verify their behavior.

Would you like me to generate comprehensive unit tests for these regex patterns?

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for existing test files that might contain regex pattern tests

# Look for test files
echo "Searching for test files..."
fd -e py "test.*datagraph" 

# Look for regex pattern tests in test files
echo "Searching for regex pattern tests..."
rg -A 5 "(?:(?:(?=.*0)|(?=.*5)(?=.*6))|(?:(?=.*1)(?=.*2)))" 

Length of output: 497


Script:

#!/bin/bash
# Search for test files and their contents
echo "=== Finding test files ==="
fd -e py "test.*" -x echo "=== File: {}" \; -x cat "{}"

echo -e "\n=== Searching for pattern/regex related tests ==="
rg -i "test.*pattern|test.*regex|test.*graph_query" -A 5

echo -e "\n=== Searching for graph_query method tests ==="
rg "def test.*graph" -A 5

Length of output: 51194


Script:

#!/bin/bash
# Search for datagraph test files and graph_query tests
echo "=== Searching for datagraph test files ==="
fd -t f -e py "datagraph"

echo -e "\n=== Searching for graph_query tests ==="
rg -l "def test.*graph_query|test.*datagraph"

echo -e "\n=== Looking for graph_query method usage ==="
rg "graph_query" -A 5 -B 5

Length of output: 3715

🧹 Nitpick comments (2)
src/imgtools/modules/datagraph.py (2)

Line range hint 343-447: Consider adding regex pattern documentation.

While the regex patterns are working correctly, they are complex and could benefit from detailed documentation explaining each pattern's purpose and components.

Add comments above each regex pattern explaining its components. For example:

+ # Pattern explanation:
+ # (?:(?:(?=.*0)|(?=.*5)(?=.*6))|(?:(?=.*1)(?=.*2)))
+ # - (?:...) - non-capturing group
+ # - (?=.*0) - lookahead for edge type 0
+ # - | - OR operator
+ # - (?=.*5)(?=.*6) - lookahead for both edge types 5 and 6
+ # - | - OR operator
+ # - (?=.*1)(?=.*2) - lookahead for both edge types 1 and 2

Line range hint 343-447: Consider extracting regex patterns to constants.

The regex patterns are complex and used in multiple places. Consider extracting them to named constants at the class level for better maintainability.

 class DataGraph:
+    # Regex patterns for different query combinations
+    REGEX_CT_RTSTRUCT_RTDOSE = '(?:(?:(?=.*0)|(?=.*5)(?=.*6))|(?:(?=.*1)(?=.*2)))'
+    REGEX_RTDOSE_CT = '(?:(?=.*1)|(?:(?:(?=.*0)|(?=.*5)(?=.*6))(?=.*2)))'
+    REGEX_RTSTRUCT_CT = '(?:(?=.*2)|(?:(?:(?=.*0)|(?=.*5)(?=.*6))(?=.*1)))'
+    REGEX_CT_MR_RTSTRUCT_RTDOSE = '(?:(?=.*1)|(?=.*0)|(?=.*5)(?=.*6))(?=.*2)'
+    REGEX_CT_MR_RTSTRUCT_RTDOSE_PT = '(?:(?=.*1)|(?=.*0)|(?=.*5)(?=.*6))(?=.*2)(?=.*3)(?=.*4)'
+    REGEX_CT_MR_RTDOSE_PT = '(?=.*4)(?:(?=.*1)|(?:(?=.*2)(?:(?=.*0)|(?=.*5)(?=.*6))))'

     def parser(self, query_string: str) -> pd.DataFrame:
         # ...
-        regex_term = '(?:(?:(?=.*0)|(?=.*5)(?=.*6))|(?:(?=.*1)(?=.*2)))'
+        regex_term = self.REGEX_CT_RTSTRUCT_RTDOSE
         # ...
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cb71fa1 and 775ce52.

📒 Files selected for processing (1)
  • src/imgtools/modules/datagraph.py (4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: Unit-Tests (macos-14, py312)
  • GitHub Check: Unit-Tests (macos-14, py311)
  • GitHub Check: Unit-Tests (macos-14, py310)
  • GitHub Check: Unit-Tests (macos-latest, py311)
  • GitHub Check: Unit-Tests (macos-latest, py310)
  • GitHub Check: Unit-Tests (ubuntu-latest, py312)
  • GitHub Check: Unit-Tests (ubuntu-latest, py311)
  • GitHub Check: Unit-Tests (ubuntu-latest, py310)
🔇 Additional comments (6)
src/imgtools/modules/datagraph.py (6)

343-343: LGTM! Non-capturing groups improve performance.

The regex pattern has been correctly updated to use non-capturing groups (?:) for the CT-RTSTRUCT and CT-RTDOSE case.


350-350: LGTM! Non-capturing groups improve performance.

The regex pattern has been correctly updated to use non-capturing groups (?:) for the RTDOSE->CT case.


354-354: LGTM! Non-capturing groups improve performance.

The regex pattern has been correctly updated to use non-capturing groups (?:) for the RTSTRUCT->CT case.


417-417: LGTM! Non-capturing groups improve performance.

The regex pattern has been correctly updated to use non-capturing groups (?:) for the CT/MR,RTSTRUCT,RTDOSE case.


427-427: LGTM! Non-capturing groups improve performance.

The regex pattern has been correctly updated to use non-capturing groups (?:) for the CT/MR,RTSTRUCT,RTDOSE,PT case.


447-447: LGTM! Non-capturing groups improve performance.

The regex pattern has been correctly updated to use non-capturing groups (?:) for the CT/MR,RTDOSE,PT case.

@JoshuaSiraj
Copy link
Collaborator Author

Might be better to replace all regex with conditional statements.

So instead of:

regex_term = '(?:(?=.*1)|(?=.*0)|(?=.*5)(?=.*6))(?=.*2)'
relevant_study_id = self.df_new.loc[
            self.df_new.edge_type.str.contains(f'(?:{regex_term})', regex=True),
            'study_x',
        ].unique()

Use conditional statements:

valid_condition = (
    (self.df_new['edge_type'].str.contains('1') | 
     self.df_new['edge_type'].str.contains('0') | 
     (self.df_new['edge_type'].str.contains('5') & self.df_new['edge_type'].str.contains('6'))) & 
    self.df_new['edge_type'].str.contains('2')
)
relevant_study_id = self.df_new.loc[valid_condition, 'study_x'].unique()

Copy link

codecov bot commented Jan 8, 2025

Codecov Report

Attention: Patch coverage is 46.15385% with 7 lines in your changes missing coverage. Please review.

Project coverage is 44.25%. Comparing base (0dff0f4) to head (b8c7700).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
src/imgtools/modules/datagraph.py 46.15% 7 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #162   +/-   ##
=======================================
  Coverage   44.25%   44.25%           
=======================================
  Files          47       47           
  Lines        3606     3606           
=======================================
  Hits         1596     1596           
  Misses       2010     2010           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jjjermiah
Copy link
Contributor

Might be better to replace all regex with conditional statements.

So instead of:

regex_term = '(?:(?=.*1)|(?=.*0)|(?=.*5)(?=.*6))(?=.*2)'
relevant_study_id = self.df_new.loc[
            self.df_new.edge_type.str.contains(f'(?:{regex_term})', regex=True),
            'study_x',
        ].unique()

Use conditional statements:

valid_condition = (
    (self.df_new['edge_type'].str.contains('1') | 
     self.df_new['edge_type'].str.contains('0') | 
     (self.df_new['edge_type'].str.contains('5') & self.df_new['edge_type'].str.contains('6'))) & 
    self.df_new['edge_type'].str.contains('2')
)
relevant_study_id = self.df_new.loc[valid_condition, 'study_x'].unique()

Id be okay with the conditional statements if you can implement it

@JoshuaSiraj
Copy link
Collaborator Author

Might be better to replace all regex with conditional statements.
So instead of:

regex_term = '(?:(?=.*1)|(?=.*0)|(?=.*5)(?=.*6))(?=.*2)'
relevant_study_id = self.df_new.loc[
            self.df_new.edge_type.str.contains(f'(?:{regex_term})', regex=True),
            'study_x',
        ].unique()

Use conditional statements:

valid_condition = (
    (self.df_new['edge_type'].str.contains('1') | 
     self.df_new['edge_type'].str.contains('0') | 
     (self.df_new['edge_type'].str.contains('5') & self.df_new['edge_type'].str.contains('6'))) & 
    self.df_new['edge_type'].str.contains('2')
)
relevant_study_id = self.df_new.loc[valid_condition, 'study_x'].unique()

Id be okay with the conditional statements if you can implement it

Did a rough implementation that passes tests. Will clean up and push

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🔭 Outside diff range comments (1)
src/imgtools/modules/datagraph.py (1)

Line range hint 342-472: Convert lambda functions to regular functions for better maintainability.

The current implementation uses multiple lambda functions for edge conditions, which makes the code harder to read and maintain. Converting these to regular functions would improve readability, allow for documentation, and make debugging easier.

Here's a suggested refactoring approach:

+def _check_rtstruct_rtdose_connection(edge_type: str) -> bool:
+    """Check if there's a connection between RTSTRUCT and RTDOSE."""
+    return '0' in edge_type or ('5' in edge_type and '6' in edge_type)
+
+def _check_edge_condition_rtstruct_rtdose(row: pd.Series) -> bool:
+    """Check edge condition for RTSTRUCT-RTDOSE connection."""
+    return (
+        _check_rtstruct_rtdose_connection(row['edge_type']) or
+        ('1' in row['edge_type'] and '2' in row['edge_type'])
+    )
+
+def _check_edge_condition_ct_rtdose(row: pd.Series) -> bool:
+    """Check edge condition for CT-RTDOSE connection."""
+    return (
+        '1' in row['edge_type'] or (
+            _check_rtstruct_rtdose_connection(row['edge_type']) and 
+            '2' in row['edge_type']
+        )
+    )
+
+def _check_edge_condition_ct_rtstruct(row: pd.Series) -> bool:
+    """Check edge condition for CT-RTSTRUCT connection."""
+    return (
+        '2' in row['edge_type'] or (
+            _check_rtstruct_rtdose_connection(row['edge_type']) and 
+            '1' in row['edge_type']
+        )
+    )
+
+def _check_edge_condition_ct_rtstruct_rtdose(row: pd.Series) -> bool:
+    """Check edge condition for CT-RTSTRUCT-RTDOSE connection."""
+    return (
+        '2' in row['edge_type'] and
+        ('1' in row['edge_type'] or _check_rtstruct_rtdose_connection(row['edge_type']))
+    )
+
+def _check_edge_condition_ct_rtstruct_rtdose_pt(row: pd.Series) -> bool:
+    """Check edge condition for CT-RTSTRUCT-RTDOSE-PT connection."""
+    return (
+        ('1' in row['edge_type'] or _check_rtstruct_rtdose_connection(row['edge_type'])) and
+        '2' in row['edge_type'] and
+        '3' in row['edge_type'] and
+        '4' in row['edge_type']
+    )

-                edge_condition = lambda row: (
-                    ('0' in row['edge_type'] or ('5' in row['edge_type'] and '6' in row['edge_type'])) or
-                    ('1' in row['edge_type'] and '2' in row['edge_type'])
-                )
+                edge_condition = _check_edge_condition_rtstruct_rtdose

# Apply similar changes for other edge conditions

This refactoring:

  1. Improves code readability with descriptive function names
  2. Allows for documentation through docstrings
  3. Makes the code easier to test and debug
  4. Follows Python style guidelines
  5. Reduces code duplication through helper functions
🧰 Tools
🪛 Ruff (0.8.2)

343-346: Do not assign a lambda expression, use a def

Rewrite edge_condition as a def

(E731)


353-358: Do not assign a lambda expression, use a def

Rewrite edge_condition as a def

(E731)


362-367: Do not assign a lambda expression, use a def

Rewrite edge_condition as a def

(E731)

🧹 Nitpick comments (1)
src/imgtools/modules/datagraph.py (1)

Line range hint 508-512: Update method documentation to reflect the new parameter type.

The method signature has been updated to use edge_condition: Callable instead of regex_term: str, but the docstring still references the old parameter. Please update the documentation to reflect this change.

        """
        Based on the regex forms the final dataframe. You can
        query the edge table based on the regex to get the
        subgraph in which the queried edges will be present.

        Parameters
        ----------
-       regex_term: str
-           To search the string in edge_type column of self.df_new which is aggregate of all the edges in a single study
+       edge_condition: Callable
+           A function that takes a row from self.df_new and returns a boolean indicating whether the edge conditions are met
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 775ce52 and b8c7700.

⛔ Files ignored due to path filters (1)
  • pixi.lock is excluded by !**/*.lock
📒 Files selected for processing (1)
  • src/imgtools/modules/datagraph.py (8 hunks)
🧰 Additional context used
🪛 Ruff (0.8.2)
src/imgtools/modules/datagraph.py

343-346: Do not assign a lambda expression, use a def

Rewrite edge_condition as a def

(E731)


353-358: Do not assign a lambda expression, use a def

Rewrite edge_condition as a def

(E731)


362-367: Do not assign a lambda expression, use a def

Rewrite edge_condition as a def

(E731)


430-433: Do not assign a lambda expression, use a def

Rewrite edge_condition as a def

(E731)


443-448: Do not assign a lambda expression, use a def

Rewrite edge_condition as a def

(E731)


458-458: Do not assign a lambda expression, use a def

Rewrite edge_condition as a def

(E731)


468-472: Do not assign a lambda expression, use a def

Rewrite edge_condition as a def

(E731)

⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: Unit-Tests (macos-14, py312)
  • GitHub Check: Unit-Tests (macos-14, py311)
  • GitHub Check: Unit-Tests (macos-14, py310)
  • GitHub Check: Unit-Tests (macos-latest, py311)
  • GitHub Check: Unit-Tests (macos-latest, py310)
  • GitHub Check: Unit-Tests (ubuntu-latest, py312)
  • GitHub Check: Unit-Tests (ubuntu-latest, py311)
  • GitHub Check: Unit-Tests (ubuntu-latest, py310)
🔇 Additional comments (1)
src/imgtools/modules/datagraph.py (1)

3-3: LGTM! Type hint addition is appropriate.

The addition of Callable to the imports aligns well with the refactoring from regex patterns to callable edge conditions.

@jjjermiah
Copy link
Contributor

@JoshuaSiraj is this ready?

@JoshuaSiraj
Copy link
Collaborator Author

JoshuaSiraj commented Jan 14, 2025

@JoshuaSiraj is this ready?

Yeah, have a ook through please

@JoshuaSiraj
Copy link
Collaborator Author

@JoshuaSiraj is this ready?

Yeah, have a ook through please

Actually I forgot to fix string doc. One sec

@JoshuaSiraj
Copy link
Collaborator Author

@JoshuaSiraj is this ready?

Yeah, have a ook through please

Actually I forgot to fix string doc. One sec

@jjjermiah Good now

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🔭 Outside diff range comments (1)
src/imgtools/modules/datagraph.py (1)

Line range hint 342-472: Replace lambda expressions with proper function definitions.

The current implementation uses multiple lambda expressions for edge conditions, which violates Python style guidelines and reduces code readability. Consider refactoring these into proper function definitions.

Here's a suggested refactoring pattern:

-edge_condition = lambda row: (
-    ('0' in row['edge_type'] or ('5' in row['edge_type'] and '6' in row['edge_type'])) or
-    ('1' in row['edge_type'] and '2' in row['edge_type'])
-)

+def check_rtstruct_rtdose_condition(row: pd.Series) -> bool:
+    """Check if the row contains valid RTSTRUCT-RTDOSE edge combinations.
+    
+    Valid combinations are:
+    1. Direct connection (edge type 0)
+    2. Connection via RTPLAN (edge types 5 and 6)
+    3. Connection via CT (edge types 1 and 2)
+    """
+    has_direct = '0' in row['edge_type']
+    has_plan_path = '5' in row['edge_type'] and '6' in row['edge_type']
+    has_ct_path = '1' in row['edge_type'] and '2' in row['edge_type']
+    return has_direct or has_plan_path or has_ct_path

Benefits:

  • Improved readability with descriptive function names
  • Documentation through docstrings
  • Type hints for better IDE support
  • Easier to test individual conditions
  • Follows Python style guidelines
🧰 Tools
🪛 Ruff (0.8.2)

343-346: Do not assign a lambda expression, use a def

Rewrite edge_condition as a def

(E731)


353-358: Do not assign a lambda expression, use a def

Rewrite edge_condition as a def

(E731)


362-367: Do not assign a lambda expression, use a def

Rewrite edge_condition as a def

(E731)

🧹 Nitpick comments (1)
src/imgtools/modules/datagraph.py (1)

Line range hint 342-472: Consider introducing an EdgeConditionFactory for better organization.

The edge conditions could be better organized using a factory pattern or similar structural pattern to:

  • Centralize all edge condition definitions
  • Make conditions more reusable
  • Simplify testing
  • Improve maintainability

Example approach:

from dataclasses import dataclass
from typing import Callable, Dict

@dataclass
class EdgeConditionFactory:
    """Factory for creating edge condition checkers."""
    
    @staticmethod
    def create_condition(condition_type: str) -> Callable[[pd.Series], bool]:
        conditions: Dict[str, Callable] = {
            'RTSTRUCT_RTDOSE': check_rtstruct_rtdose_condition,
            'CT_RTDOSE': check_ct_rtdose_condition,
            # ... other conditions
        }
        return conditions[condition_type]

This would allow you to:

  1. Centralize all edge conditions in one place
  2. Easily add new conditions
  3. Reuse conditions across different queries
  4. Simplify testing by focusing on individual conditions
🧰 Tools
🪛 Ruff (0.8.2)

343-346: Do not assign a lambda expression, use a def

Rewrite edge_condition as a def

(E731)


353-358: Do not assign a lambda expression, use a def

Rewrite edge_condition as a def

(E731)


362-367: Do not assign a lambda expression, use a def

Rewrite edge_condition as a def

(E731)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b8c7700 and 4db5a57.

📒 Files selected for processing (1)
  • src/imgtools/modules/datagraph.py (9 hunks)
🧰 Additional context used
🪛 Ruff (0.8.2)
src/imgtools/modules/datagraph.py

343-346: Do not assign a lambda expression, use a def

Rewrite edge_condition as a def

(E731)


353-358: Do not assign a lambda expression, use a def

Rewrite edge_condition as a def

(E731)


362-367: Do not assign a lambda expression, use a def

Rewrite edge_condition as a def

(E731)


430-433: Do not assign a lambda expression, use a def

Rewrite edge_condition as a def

(E731)


443-448: Do not assign a lambda expression, use a def

Rewrite edge_condition as a def

(E731)


458-458: Do not assign a lambda expression, use a def

Rewrite edge_condition as a def

(E731)


468-472: Do not assign a lambda expression, use a def

Rewrite edge_condition as a def

(E731)

⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: Unit-Tests (macos-14, py312)
  • GitHub Check: Unit-Tests (macos-14, py311)
  • GitHub Check: Unit-Tests (macos-14, py310)
  • GitHub Check: Unit-Tests (macos-latest, py311)
  • GitHub Check: Unit-Tests (macos-latest, py310)
  • GitHub Check: Unit-Tests (ubuntu-latest, py312)
  • GitHub Check: Unit-Tests (ubuntu-latest, py311)
  • GitHub Check: Unit-Tests (ubuntu-latest, py310)
🔇 Additional comments (2)
src/imgtools/modules/datagraph.py (2)

3-3: LGTM! Type annotation addition is appropriate.

The addition of Callable to the imports supports the refactoring from regex patterns to callable functions.


Line range hint 508-524: LGTM! Method signature change is well-documented.

The change from regex_term to edge_condition is appropriate and maintains good documentation:

  • Type hint correctly specifies Callable
  • Docstring updated to reflect the parameter change
  • Change aligns with the overall refactoring strategy

@jjjermiah jjjermiah merged commit 3237b21 into main Jan 15, 2025
14 of 15 checks passed
@jjjermiah jjjermiah deleted the JoshuaSirah/fix-datagraph-module-warning branch January 15, 2025 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fix: datagraph module warning
2 participants