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

fitbenchmarking / fitbenchmarking / 10160681898

30 Jul 2024 10:27AM UTC coverage: 91.152% (-0.3%) from 91.48%
10160681898

push

github

7a6cac
web-flow
Added more detail to algorithm check docs (#1299)

4986 of 5470 relevant lines covered (91.15%)

0.91 hits per line

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

96.0
/fitbenchmarking/utils/misc.py
1
"""
1✔
2
Miscellaneous functions and utilities used in fitting benchmarking.
3
"""
4

5

6
import glob
1✔
7
import os
1✔
8

9
from fitbenchmarking.utils.exceptions import NoDataError
1✔
10
from fitbenchmarking.utils.log import get_logger
1✔
11

12
LOGGER = get_logger()
1✔
13

14

15
def get_problem_files(data_dir):
1✔
16
    """
17
    Gets all the problem definition files from the specified problem
18
    set directory.
19

20
    :param data_dir: directory containing the problems
21
    :type data_dir: str
22

23
    :return: array containing of paths to the problems
24
             e.g. In NIST we would have
25
             [low_difficulty/file1.txt, ..., ...]
26
    :rtype: list of str
27
    """
28

29
    test_data = glob.glob(data_dir + '/*.*')
1✔
30
    if test_data == []:
1✔
31
        raise NoDataError(f'"{data_dir}" not recognised as a dataset. '
×
32
                          'Check that it contains problem files '
33
                          'and try again.')
34
    problems = [os.path.join(data_dir, data)
1✔
35
                for data in test_data
36
                if not data.endswith('META.txt')]
37
    problems.sort()
1✔
38
    for problem in problems:
1✔
39
        LOGGER.debug(problem)
1✔
40

41
    return problems
1✔
42

43

44
def get_css(options, working_directory):
1✔
45
    """
46
    Returns the path of the local css folder
47

48
    :param working_directory: location of current directory
49
    :type working_directory: string
50

51
    :return: A dictionary containing relative links to the local css directory
52
    :rtype: dict of strings
53
    """
54
    local_css_dir = os.path.join(options.results_dir, "css")
1✔
55
    css_path = os.path.relpath(local_css_dir, working_directory)
1✔
56
    css_dict = {
1✔
57
        'custom': os.path.join(css_path, 'custom_style.css'),
58
        'dropdown': os.path.join(css_path, 'dropdown_style.css'),
59
        'main': os.path.join(css_path, 'main_style.css'),
60
        'table': os.path.join(css_path, 'table_style.css')
61
    }
62

63
    return css_dict
1✔
64

65

66
def get_js(options, working_directory):
1✔
67
    """
68
    Returns the path of the local js folder
69

70
    :param working_directory: location of current directory
71
    :type working_directory: string
72

73
    :return: A dictionary containing relative links to the local js directory
74
    :rtype: dict of strings
75
    """
76
    local_js_dir = os.path.join(options.results_dir, "js")
1✔
77
    js_path = os.path.relpath(local_js_dir, working_directory)
1✔
78
    js_dict = {
1✔
79
        'dropdown': os.path.join(js_path, 'dropdown.js'),
80
        'mathjax': os.path.join(js_path, 'tex-mml-chtml.js'),
81
        'table': os.path.join(js_path, 'table.js'),
82
        'plotly': os.path.join(js_path, 'plotly.js')
83
    }
84

85
    return js_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

© 2025 Coveralls, Inc