Fix read_adi_parallel record parsing and chunk_size calculation#4
Draft
Fix read_adi_parallel record parsing and chunk_size calculation#4
Conversation
…tests Co-authored-by: JS2IIU-MH <146515386+JS2IIU-MH@users.noreply.github.com>
Co-authored-by: JS2IIU-MH <146515386+JS2IIU-MH@users.noreply.github.com>
Co-authored-by: JS2IIU-MH <146515386+JS2IIU-MH@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix bugs and improve file handling in adiftools.py
Fix read_adi_parallel record parsing and chunk_size calculation
Feb 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
read_adi_parallel()and_process_chunk()had three critical bugs: (1) chunk_size could be zero when num_processes exceeded record count, (2) multi-line ADIF records were silently dropped, and (3) field extraction regex failed on type indicators like<FREQ:9:N>.Changes
adiftools.py
read_adi_parallel(): Changed from line-based to record-based parsing
<EOR>delimiter instead of chunking by line countmax(1, num_records // actual_processes)to prevent zero divisionmin(num_processes, num_records)when records < processes_process_chunk(): Updated field extraction and record handling
r'<(.*?):(\d+)>([^<]*)'tor'<([^:>]+):([^:>]+)(?::[^>]*)?>([^<]*)'to capture optional type indicatorsmodule_check.py
Wrapped print statement in
if __name__ == '__main__':guard to eliminate import-time side effect.Example
Before, this would fail with
range() arg 3 must not be zero:And multi-line records were silently dropped:
Now both cases work correctly.
Original prompt
Summary of changes to implement in repository JS2IIU-MH/adiftools-dev:
Objective:
Details and implementation requirements:
Files to change:
adiftools/adiftools.py changes:
module_check.py changes:
if name == 'main':
from setuptools import find_packages
print(find_packages(include=['adiftools', 'adiftools.*'], exclude=['test/']))
Tests to add (in tests/test_parallel_and_module_check.py or similar):
This pull request was created from Copilot chat.
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.