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

askomics / flaskomics / 4132887853

pending completion
4132887853

push

github-actions

GitHub
Add 'anonymous_query' mode (#384)

357 of 357 new or added lines in 16 files covered. (100.0%)

6166 of 7374 relevant lines covered (83.62%)

0.84 hits per line

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

82.61
/askomics/libaskomics/Start.py
1
"""Contain the Start classe
2
"""
3
import os
1✔
4

5
from askomics.libaskomics.Database import Database
1✔
6
from askomics.libaskomics.Params import Params
1✔
7

8

9
class Start(Params):
1✔
10

11
    """Initialize the data directory and the database
12

13
    Attributes
14
    ----------
15
    data_directory : str
16
        Path to the data directory
17
    database_path : str
18
        Path to the database file
19
    """
20

21
    def __init__(self, app, session):
1✔
22
        """Get data directory and database paths from the askomics settings
23

24
        Parameters
25
        ----------
26
        app :
27
            flask app
28
        session :
29
            flask session
30
        """
31
        Params.__init__(self, app, session)
1✔
32

33
        self.data_directory = self.settings.get('askomics', 'data_directory')
1✔
34
        self.database_path = self.settings.get('askomics', 'database_path')
1✔
35

36
    def start(self):
1✔
37
        """Create the data diretory and initialize the database file
38
        """
39
        self.create_data_directory()
1✔
40
        self.create_database()
1✔
41
        self.create_anonymous()
1✔
42

43
    def create_data_directory(self):
1✔
44
        """Create the data directory if it not exists
45
        """
46
        if not os.path.isdir(self.data_directory):
1✔
47
            os.makedirs(self.data_directory)
×
48

49
    def create_database(self):
1✔
50
        """Initialize the database file
51
        """
52
        database = Database(self.app, self.session)
1✔
53
        database.init_database()
1✔
54

55
    def create_anonymous(self):
1✔
56
        """Create anonymous data folder if required
57
        """
58
        if self.settings.get('askomics', 'anonymous_query', fallback=False):
1✔
59
            data_path = "{}/{}_{}/results".format(
×
60
                self.data_directory,
61
                "0",
62
                "anonymous"
63
            )
64
            if not os.path.isdir(data_path):
×
65
                os.makedirs(data_path)
×
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