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

SDXorg / excels2vensim / 20423887220

26 Aug 2025 03:19PM UTC coverage: 50.769% (-6.4%) from 57.179%
20423887220

push

github

web-flow
Bump lycheeverse/lychee-action from 2.5.0 to 2.6.1 (#22)

Bumps [lycheeverse/lychee-action](https://github.com/lycheeverse/lychee-action) from 2.5.0 to 2.6.1.
- [Release notes](https://github.com/lycheeverse/lychee-action/releases)
- [Commits](https://github.com/lycheeverse/lychee-action/compare/v2.5.0...v2.6.1)

---
updated-dependencies:
- dependency-name: lycheeverse/lychee-action
  dependency-version: 2.6.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

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

90.0
/excels2vensim/utils/subscripts.py
1
"""
2
Subscript manager class.
3
"""
4
import json
1✔
5
from pathlib import Path
1✔
6

7
from .subscript_parser import get_subscripts
1✔
8

9

10
class Subscripts():
1✔
11
    """
12
    Class to save the subscript dictionary.
13
    """
14
    _subscript_dict = {}
1✔
15

16
    @classmethod
1✔
17
    def read(cls, file_name):
1✔
18
        """
19
        Read the subscripts form a .mdl or .json file.
20

21
        Parameters
22
        ----------
23
        file_name: str
24
            Full name of the .json or .mdl file.
25

26
        """
27
        file_name = Path(file_name)
1✔
28
        if file_name.suffix.lower() == ".mdl":
1✔
29
            cls.set(get_subscripts(
1✔
30
                file_name, str(file_name.with_suffix(""))+"_subscripts.json"))
31
        elif file_name.suffix.lower() == ".json":
×
32
            with open(file_name) as file:
×
33
                cls.set(json.load(file))
×
34
        else:
35
            pass
1✔
36

37
    @classmethod
1✔
38
    def get(cls, key):
1✔
39
        """
40
        Get the value of key of _subscript_dict.
41

42
        Parameters
43
        ----------
44
        key: str
45
            Subscript range name to extract the subscripts.
46

47
        """
48
        return cls._subscript_dict[key]
1✔
49

50
    @classmethod
1✔
51
    def get_ranges(cls):
1✔
52
        """
53
        Get the list of keys of _subscript_dict.
54
        """
55
        return list(cls._subscript_dict)
1✔
56

57
    @classmethod
1✔
58
    def set(cls, dict):
1✔
59
        """
60
        Set _subscript_dict to input value.
61

62
        Parameters
63
        ----------
64
        dict: dict
65
            The subscripts dictionary.
66

67
        """
68
        cls.clean()
1✔
69
        cls.update(dict)
1✔
70

71
    @classmethod
1✔
72
    def update(cls, dict):
1✔
73
        """
74
        Update _subscript_dict removing trailing whitespaces from keys
75
        and values.
76

77
        Parameters
78
        ----------
79
        dict: dict
80
            The subscripts dictionary.
81

82
        """
83
        cls._subscript_dict.update({
1✔
84
            key.strip(): [value.strip() for value in values]
85
            for key, values in dict.items()})
86

87
    @classmethod
1✔
88
    def clean(cls):
1✔
89
        """
90
        Cleans the subscript dict.
91
        """
92
        cls._subscript_dict = {}
1✔
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