Skip to content

Commit bb91f8d

Browse files
committed
Merge tag '1.1.0' into mirror
2 parents b6c56de + a604d84 commit bb91f8d

18 files changed

Lines changed: 95754 additions & 8212 deletions

.gitlab-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ stages:
77
stage: test
88
parallel:
99
matrix:
10-
- PYTHON_VERSION: ["3.9", "3.10", "3.11", "3.12"]
10+
- PYTHON_VERSION: ["3.9", "3.10", "3.11", "3.12", "3.13"]
1111
script:
1212
- python -m pip install .
1313
- python -m pip install pytest nbval

changelog.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
Changelog
22
=========
33

4+
1.1.0 (2025-06-03)
5+
------------------
6+
- Fix minor issues in v4.1 and v4.1.1 standard dictionaries and include latest
7+
abbreviations
8+
- Show warnings and FYI count in error log only if explicitly requested (Issue
9+
#122)
10+
- Export None and NA entries in in .xlsx file to "" instead of "NaN" when
11+
converting to .ags (Issue #126)
12+
- Add utils.py module with functions to convert official AGS4 standard
13+
dictionaries from .json to .ags
14+
- Add support for Python 3.13
15+
- Improve documentation in CLI
16+
- Remove redundant log messages
17+
18+
419
1.0.0 (2024-08-06)
520
--------------
621
- Report TRAN_AGS in error report. This allows the reader to verify whether the

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "python-AGS4"
3-
version = "1.0.0"
3+
version = "1.1.0"
44
description = "A library to read, write, and check AGS4 files using Pandas DataFrames"
55
authors = ["Asitha Senanayake <asitha_sena@yahoo.com>"]
66
license = "LGPL-3.0"

python_ags4/AGS4.py

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (C) 2020-2024 Asitha Senanayake
1+
# Copyright (C) 2020-2025 Asitha Senanayake
22
#
33
# This file is part of python_ags4.
44
#
@@ -431,7 +431,8 @@ def excel_to_AGS4(input_file, output_file, format_numeric_columns=True, dictiona
431431
from pandas import read_excel
432432

433433
# Read data from Excel file in to a dictionary of dataframes
434-
tables = read_excel(input_file, sheet_name=None, engine='openpyxl')
434+
tables = read_excel(input_file, sheet_name=None, engine='openpyxl',
435+
keep_default_na=False, na_values='')
435436

436437
# Not all worksheets in the spreadsheet may contain valid AGS4 tables, therefore
437438
# initiate variable to keep track of worksheets to export
@@ -688,8 +689,7 @@ def _format_SF(value, TYPE):
688689
return f"{value:.{i}f}"
689690

690691

691-
def check_file(filepath_or_buffer, standard_AGS4_dictionary=None, rename_duplicate_headers=True, encoding='utf-8',
692-
print_output=True):
692+
def check_file(filepath_or_buffer, standard_AGS4_dictionary=None, rename_duplicate_headers=True, encoding='utf-8'):
693693
"""Validate AGS4 file against AGS4 rules.
694694
695695
Parameters
@@ -706,8 +706,6 @@ def check_file(filepath_or_buffer, standard_AGS4_dictionary=None, rename_duplica
706706
to duplicates to make them unique.
707707
encoding : str, default='utf-8'
708708
Encoding of text file.
709-
print_output : bool, default=True
710-
If True, then print output to the console and the logger, otherwise do not.
711709
712710
Returns
713711
-------
@@ -720,8 +718,6 @@ def check_file(filepath_or_buffer, standard_AGS4_dictionary=None, rename_duplica
720718

721719
ags_errors = {}
722720

723-
logger.info(f'Opening file... {filepath_or_buffer}')
724-
725721
# Line checks
726722
if _is_file_like(filepath_or_buffer):
727723
f = filepath_or_buffer
@@ -757,8 +753,6 @@ def check_file(filepath_or_buffer, standard_AGS4_dictionary=None, rename_duplica
757753
headings = []
758754

759755
logger.info('Checking lines...')
760-
if print_output:
761-
logger.info('Checking lines...')
762756

763757
for i, line in enumerate(f, start=1):
764758

@@ -955,21 +949,23 @@ def write_error_report(ags_errors, output_file, show_warnings=False, show_fyi=Fa
955949
# Summary of errors log
956950
if error_count == 0:
957951
f.write('All checks passed!\r\n')
958-
959-
if warnings_count + fyi_count > 0:
960-
f.write(f'{warnings_count} warning(s) and {fyi_count} FYI message(s) returned.\r\n')
961-
f.write('\r\n')
952+
f.write('\r\n')
962953

963954
elif ('AGS Format Rule 3' in ags_errors) and ('AGS3' in ags_errors['AGS Format Rule 3'][0]['desc']):
964955
f.write('Checking aborted as AGS3 files are not supported!\r\n')
965956
f.write('\r\n')
966957

967958
else:
968959
f.write(f'{error_count} error(s) found in file!\r\n')
960+
f.write('\r\n')
969961

970-
if warnings_count + fyi_count > 0:
971-
f.write(f'{warnings_count} warning(s) and {fyi_count} FYI message(s) returned.\r\n')
962+
# Write summary of warnings and FYI messages
963+
if show_warnings:
964+
f.write(f'{warnings_count} warning(s) returned.\r\n')
965+
f.write('\r\n')
972966

967+
if show_fyi:
968+
f.write(f'{fyi_count} FYI message(s) returned.\r\n')
973969
f.write('\r\n')
974970

975971
# Write 'General' error messages first if present

0 commit comments

Comments
 (0)