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

georgia-tech-db / eva / #758

04 Sep 2023 08:37PM UTC coverage: 0.0% (-78.3%) from 78.333%
#758

push

circle-ci

hershd23
Increased underline length in at line 75 in text_summarization.rst
	modified:   docs/source/benchmarks/text_summarization.rst

0 of 11303 relevant lines covered (0.0%)

0.0 hits per line

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

0.0
/evadb/configuration/configuration_manager.py
1
# coding=utf-8
2
# Copyright 2018-2023 EvaDB
3
#
4
# Licensed under the Apache License, Version 2.0 (the "License");
5
# you may not use this file except in compliance with the License.
6
# You may obtain a copy of the License at
7
#
8
#     http://www.apache.org/licenses/LICENSE-2.0
9
#
10
# Unless required by applicable law or agreed to in writing, software
11
# distributed under the License is distributed on an "AS IS" BASIS,
12
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
# See the License for the specific language governing permissions and
14
# limitations under the License.
15
from pathlib import Path
×
16
from typing import Any
×
17

18
from evadb.configuration.bootstrap_environment import bootstrap_environment
×
19
from evadb.configuration.constants import EvaDB_DATABASE_DIR, EvaDB_INSTALLATION_DIR
×
20
from evadb.utils.logging_manager import logger
×
21

22

23
class ConfigurationManager(object):
×
24
    def __init__(self, evadb_dir: str = None) -> None:
×
25
        self._evadb_dir = evadb_dir or EvaDB_DATABASE_DIR
×
26
        self._config_obj = self._create_if_not_exists()
×
27

28
    def _create_if_not_exists(self):
×
29
        config_obj = bootstrap_environment(
×
30
            evadb_dir=Path(self._evadb_dir),
31
            evadb_installation_dir=Path(EvaDB_INSTALLATION_DIR),
32
        )
33
        return config_obj
×
34

35
    def _get(self, category: str, key: str) -> Any:
×
36
        """Retrieve a configuration value based on the category and key.
37

38
        Args:
39
            category (str): The category of the configuration.
40
            key (str): The key of the configuration within the category.
41

42
        Returns:
43
            Any: The retrieved configuration value.
44

45
        Raises:
46
            ValueError: If the YAML file is invalid or cannot be loaded.
47
        """
48
        config_obj = self._config_obj
×
49

50
        # Get value from the user-provided config file
51
        value = config_obj.get(category, {}).get(key)
×
52

53
        # cannot find the value, report invalid category, key combination
54
        if value is None:
×
55
            logger.exception(f"Invalid category and key combination {category}:{key}")
56

57
        return value
×
58

59
    def _update(self, category: str, key: str, value: str):
×
60
        config_obj = self._config_obj
×
61

62
        if category not in config_obj:
×
63
            config_obj[category] = {}
×
64

65
        config_obj[category][key] = value
×
66

67
    def get_value(self, category: str, key: str) -> Any:
×
68
        return self._get(category, key)
×
69

70
    def update_value(self, category, key, value) -> None:
×
71
        self._update(category, key, value)
×
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