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

rjfarmer / gfModParser / 14782932876

01 May 2025 08:27PM UTC coverage: 77.383% (-1.1%) from 78.481%
14782932876

push

github

rjfarmer
Remove need for subprocess

544 of 703 relevant lines covered (77.38%)

0.77 hits per line

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

67.39
/gfModParser/utils.py
1
# SPDX-License-Identifier: GPL-2.0+
2

3
import numpy as np
1✔
4
from packaging.version import Version
1✔
5

6
try:
1✔
7
    import pyquadp as pyq
1✔
8

9
    PYQ_IMPORTED = True
×
10
except ImportError:
1✔
11
    PYQ_IMPORTED = False
1✔
12

13

14
"""
1✔
15
Map gfortran version to Mod file version
16
"""
17

18

19
def gfortran_mod_map(version):
1✔
20
    if version < Version("4.8.1"):
×
21
        return 9
×
22
    elif version < Version("4.9.2"):
×
23
        return 10
×
24
    elif version < Version("5.1.0"):
×
25
        return 12
×
26
    elif version < Version("8.0.0"):
×
27
        return 14
×
28
    elif version < Version("15.0.0"):
×
29
        return 15
×
30
    elif version.major == 15:
×
31
        return 16
×
32
    else:
33
        raise ValueError(f"Unknown gfortran version {version}")
×
34

35

36
def string_clean(string):
1✔
37
    if string is None:
1✔
38
        return
1✔
39
    if string.startswith("'") or string.startswith('"'):
1✔
40
        string = string[1:]
1✔
41
    if string.endswith("'") or string.endswith('"'):
1✔
42
        string = string[:-1]
1✔
43

44
    return string
1✔
45

46

47
def hextofloat(s, kind=4):
1✔
48
    # Given hex like parameter '0.12decde@9' returns 5065465344.0
49
    man, exp = s.split("@")
1✔
50
    exp = int(exp)
1✔
51
    decimal = man.index(".")
1✔
52
    negative = man[0] == "-"
1✔
53
    man = man[decimal + 1 :]
1✔
54
    man = man.ljust(exp, "0")
1✔
55
    man = man[:exp] + "." + man[exp:]
1✔
56
    man = man + "P0"
1✔
57
    if negative:
1✔
58
        man = "-" + man
1✔
59
    if PYQ_IMPORTED and kind == 16:
1✔
60
        return pyq.qfloat.fromhex(man)
×
61
    elif kind == 8:
1✔
62
        return np.double.fromhex(man)
1✔
63
    else:
64
        return float.fromhex(man)
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