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

Checking if there are more than one MIG docx files for a message_format #37

Merged
merged 10 commits into from
Apr 16, 2024

Conversation

hamidhajiparvaneh
Copy link
Contributor

it takes latest file based on timestamp in .DOCX filename

@@ -37,6 +39,42 @@ def find_file_to_format(message_formats: list[EdifactFormat], input_dir: Path) -
raise click.Abort()


def get_latest_file(file_list):
Copy link
Contributor

Choose a reason for hiding this comment

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

Kannst du hier Type hints adden?

src/migmose/parsing.py Outdated Show resolved Hide resolved
src/migmose/parsing.py Outdated Show resolved Hide resolved
Tests to find multiple docx files with the same message_format.
"""
message_formats = [EdifactFormat.IFTSTA]
input_dir = Path("unittests/test_data/")
Copy link
Contributor

Choose a reason for hiding this comment

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

I am surprised that this path is working :D

hamidhajiparvaneh and others added 6 commits April 15, 2024 09:22
Co-authored-by: kevin <68426071+hf-krechan@users.noreply.github.com>
Co-authored-by: kevin <68426071+hf-krechan@users.noreply.github.com>
latest_date: datetime | None = None

for file_path in file_list:
date, path = extract_date(file_path)
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

@hf-kklein hf-kklein left a comment

Choose a reason for hiding this comment

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

lgtm

match = re.search(r"(\d{8})\.docx$", file_path.name)
if match:
# Return the date as a datetime object for comparison and the path for use
return datetime.strptime(match.group(1), "%Y%m%d"), file_path
Copy link
Contributor

Choose a reason for hiding this comment

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

das datetime hat keine zeitzone 😶 aber es ist egal, weil alle keine zeitzone haben :)

Copy link
Contributor

@DeltaDaniel DeltaDaniel left a comment

Choose a reason for hiding this comment

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

LGTM. Danke! :-)

@hamidhajiparvaneh hamidhajiparvaneh enabled auto-merge (squash) April 16, 2024 10:42
@hamidhajiparvaneh hamidhajiparvaneh merged commit 9f9dc6d into main Apr 16, 2024
14 checks passed
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.

4 participants