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

timcera / pyslice / 12340932278

15 Dec 2024 05:42PM CUT coverage: 45.447%. Remained the same
12340932278

Pull #4

github

web-flow
Merge d90cfa984 into 2ffee6f33
Pull Request #4: build(deps): bump actions/setup-python from 4 to 5

529 of 1164 relevant lines covered (45.45%)

2.27 hits per line

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

30.77
/src/pyslice/pyslice_lib/PySPG/Executor.py
1
import os
5✔
2
import os.path
5✔
3
import sys
5✔
4

5
from .ParamParser import ParamParser
5✔
6

7
#
8
#
9
# :::~ Author: Claudio Juan Tessone <tessonec@imedea.uib.es> (c) 2002-2005
10
#
11
# Distributed According to GNU Generic Purpose License (GPL)
12
# Please visit www.gnu.org
13
#
14

15

16
class Executor:
5✔
17
    #
18
    # :::~ This variable specifies how many VARIABLEs will be kept off
19
    #      the directory heirarchy (NOTE THAT MUST HAVE A MINUS SIGN)
20
    #
21

22
    def __init__(self, lsLines):
5✔
23
        self.parser = ParamParser(lsLines)
×
24
        self.limit = -1
×
25

26
    #
27
    # :::~ This variable specifies that your prigram will understand correctly
28
    #      the print command inside the input of your program
29
    #
30
    def run(self, exename, outname="out.dat", inname="in.dat"):
5✔
31
        """
32
        runs the program 'exename', that receives its input from
33
        'inname'. Outputs in file 'outname'. This is done for the current
34
        value of parameters
35
        """
36

37
        cwd = os.path.abspath(os.path.curdir)
×
38

39
        way2 = self.parser.directory_tree(self.limit)
×
40

41
        try:
×
42
            if not os.path.isdir(way2):
×
43
                os.makedirs(way2)
×
44
        except Exception:
×
45
            print(f"Error!! creating directory: '{way2}'")
×
46
            sys.exit(1)
×
47

48
        os.chdir(way2)
×
49

50
        with open(inname, "w") as fparam:
×
51
            fparam.write(str(self.parser))
×
52
        open(outname, "a").write(f"{self.parser.output_tree(self.limit)}        ")
×
53

54
        os.system(f"{exename} >> {outname} ")
×
55

56
        os.chdir(cwd)
×
57

58
    def doit(self, command, inname="in.dat", outfile="out.dat"):
5✔
59
        """
60
        runs systematically command (which is a OS command or executable). In the correspondig directory
61
        inname is the input file for the command
62
        while outfile is the output file name
63
        """
64
        for _ in self.parser:
×
65
            self.run(command, outfile, inname)
×
66

67

68
#
69
#
70
#
71
#
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

© 2025 Coveralls, Inc