• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

SDXorg / excels2vensim / 20426891872

22 Dec 2025 08:56AM UTC coverage: 50.769% (-6.4%) from 57.179%
20426891872

push

github

web-flow
Bump actions/setup-python from 5 to 6 (#23)

Bumps [actions/setup-python](https://github.com/actions/setup-python) from 5 to 6.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

396 of 780 relevant lines covered (50.77%)

0.51 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

91.67
/excels2vensim/cli/parser.py
1
"""
2
cmdline parser
3
"""
4
from pathlib import Path
1✔
5
from argparse import ArgumentParser
1✔
6

7
from excels2vensim import __version__
1✔
8

9

10
parser = ArgumentParser(
1✔
11
    description="Easy generate Vensim GET XLS/DIRECT equations with "
12
                "cellrange names.",
13
    prog="excels2vensim")
14

15

16
#########################
17
# functions and actions #
18
#########################
19

20

21
def check_file(string):
1✔
22
    """
23
    Checks that subscripts file ends with .mdl or .json and that exists.
24

25
    """
26
    file_path = Path(string)
1✔
27
    if not file_path.suffix.lower() in [".json", ".mdl"]:
1✔
28
        parser.error(
1✔
29
            f"when parsing '{string}'"
30
            "\nThe subscript file name must be Vensim model (.mdl)"
31
            " or JSON (.json) file...")
32

33
    if not file_path.is_file():
1✔
34
        parser.error(
1✔
35
            f"when parsing '{string}'"
36
            "\nThe model/subscripts file does not exist...")
37

38
    return file_path
×
39

40

41
def check_config(string):
1✔
42
    """
43
    Checks that config file ends with .json and that exists.
44

45
    """
46
    file_path = Path(string)
1✔
47
    if not file_path.suffix.lower() == ".json":
1✔
48
        parser.error(
1✔
49
            f"when parsing '{string}'"
50
            "\nThe config file name must be a JSON (.json) file...")
51

52
    if not file_path.is_file():
1✔
53
        parser.error(
1✔
54
            f"when parsing '{string}'"
55
            "\nThe config file does not exist...")
56

57
    return file_path
×
58

59

60
###########
61
# options #
62
###########
63

64
parser.add_argument(
1✔
65
    "-v", "--version",
66
    action="version", version=f"excels2vensim {__version__}")
67

68
parser.add_argument(
1✔
69
    "-o", "--output-file", dest="output_file",
70
    type=str, metavar="FILE", default=None,
71
    help="output file to save the vensim equations (.txt recommended), "
72
         " if not given the output will be printed in the command line")
73

74
parser.add_argument(
1✔
75
    "-g", "--gui", dest="gui",
76
    action="store_true", default=False,
77
    help="start the GUI")
78

79

80
########################
81
# Positional arguments #
82
########################
83

84
parser.add_argument("subscript_file", metavar="subscript_file",
1✔
85
                    type=check_file, default=None, nargs="?",
86
                    help="Vensim, Xmile or PySD model file")
87

88
parser.add_argument("config_file", metavar="FILE",
1✔
89
                    type=check_config, nargs="*", default=None,
90
                    help="configuration json file")
91

92

93
#########
94
# Usage #
95
#########
96

97
parser.usage = parser.format_usage().replace(
1✔
98
    "usage: excels2vensim", "python -m excels2vensim")
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc