-
Notifications
You must be signed in to change notification settings - Fork 1
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
Skip unused files #13
Conversation
Walkthrough
Changes
Possibly related issues
Poem
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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 as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #13 +/- ##
==========================================
- Coverage 80.61% 79.35% -1.26%
==========================================
Files 8 8
Lines 294 281 -13
==========================================
- Hits 237 223 -14
- Misses 57 58 +1 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- gtfs_parser/gtfs.py (4 hunks)
- tests/test_gtfs.py (1 hunks)
Additional Context Used
GitHub Check Runs (1)
codecov/patch failure (3)
gtfs_parser/gtfs.py: [warning] 65-65: gtfs_parser/gtfs.py#L65
Added line #L65 was not covered by tests
gtfs_parser/gtfs.py: [warning] 73-75: gtfs_parser/gtfs.py#L73-L75
Added lines #L73 - L75 were not covered by tests
gtfs_parser/gtfs.py: [warning] 77-77: gtfs_parser/gtfs.py#L77
Added line #L77 was not covered by tests
Additional comments not posted (3)
tests/test_gtfs.py (1)
23-23
: テストケースが更新されたGTFS
クラス構造と一致していることを確認してください。Verification successful
テストケースが更新された
GTFS
クラス構造と一致していることが確認されました。tests/test_gtfs.py
ファイルには、GTFS
クラスのすべてのデータフレームに対する適切なアサーションが含まれています。
agency
routes
stop_times
stops
trips
feed_info
shapes
calendar
calendar_dates
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that all necessary assertions are present in the test cases. # Test: Search for assertions in the test_gtfs function. Expect: Assertions for all data frames in the GTFS class. rg --type python $'assert isinstance(gtfs.$$$, pd.DataFrame)' tests/test_gtfs.pyLength of output: 112
Script:
#!/bin/bash # Description: Re-verify that all necessary assertions are present in the test cases. # Test: Search for assertions in the test_gtfs function. Expect: Assertions for all data frames in the GTFS class. rg 'assert isinstance(gtfs.$$$, pd.DataFrame)' tests/test_gtfs.pyLength of output: 67
Script:
#!/bin/bash # Description: Re-verify that all necessary assertions are present in the test cases using a broader search pattern. # Test: Search for assertions in the test_gtfs function using a broader pattern. Expect: Assertions for all data frames in the GTFS class. rg 'assert isinstance(gtfs.' tests/test_gtfs.pyLength of output: 141
Script:
#!/bin/bash # Description: Re-verify that all necessary assertions are present in the test cases using a corrected regex pattern. # Test: Search for assertions in the test_gtfs function using a corrected pattern. Expect: Assertions for all data frames in the GTFS class. rg 'assert isinstance\(gtfs\.' tests/test_gtfs.pyLength of output: 507
gtfs_parser/gtfs.py (2)
5-5
: インポートステートメントが正しく更新されています。
31-32
:GTFS
クラスの変更を承認しますが、既存の機能に影響を与えないことを確認してください。Verification successful
GTFSクラスへの変更が既存の機能に悪影響を与えていないことが確認されました。コードベース内で削除されたコンポーネントへの参照は見つかりませんでした。
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the impact of changes to the GTFS class on existing functionality. # Test: Search for usage of removed data frames in the codebase. Expect: No occurrences. rg --type python $'gtfs.$$$' gtfs_parser/Length of output: 73
Script:
#!/bin/bash # Description: Verify the impact of changes to the GTFS class on existing functionality by searching for references to potentially removed methods or attributes. # Correct file type and search for any GTFS class usage that might have been removed. rg --type py 'GTFS\.\w+' -g 'gtfs_parser/*.py'Length of output: 48
used_tables = {field.name for field in fields(GTFS)} | ||
if os.path.isdir(path): | ||
table_files = glob.glob(os.path.join(gtfs_path, "*.txt")) | ||
for table_file in table_files: | ||
table_name = os.path.splitext(os.path.basename(table_file))[0] | ||
with open(table_file, encoding="utf-8_sig") as f: | ||
tables[table_name] = load_df(f, table_name) | ||
else: | ||
if not os.path.isfile(path): | ||
raise FileNotFoundError(f"zip file not found. ({path})") | ||
if table_name in used_tables: | ||
with open(table_file, encoding="utf-8_sig") as f: | ||
tables[table_name] = load_df(f, table_name) | ||
|
||
elif os.path.isfile(path): | ||
with zipfile.ZipFile(path) as z: | ||
for file_name in z.namelist(): | ||
if ( | ||
file_name.endswith(".txt") | ||
and os.path.basename(file_name) == file_name | ||
): | ||
table_name = os.path.splitext(os.path.basename(file_name))[0] | ||
with z.open(file_name) as f: | ||
tables[table_name] = load_df(f, table_name) | ||
if table_name in used_tables: | ||
with z.open(file_name) as f: | ||
tables[table_name] = load_df(f, table_name) | ||
else: | ||
raise FileNotFoundError(f"zip file not found. ({path})") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GTFSFactory
関数の変更を承認しますが、新しいロジックに対するテストカバレッジを追加することをお勧めします。
テストコードを生成するか、このタスクを追跡するGitHubの問題を開きますか?
LGTM |
I suggest not loading unused files to avoid extra errors and performance loss.
Close Issues
Description(変更内容)
Manual Testing(手動テスト)
Please test reading GTFS of Nanto city
Remarks
test_parser.py
failed because of bugs in read_routes().This failure is not related to this PR.
I fixed them by PR #11