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

georgia-tech-db / eva / e6161546-9e33-42e7-a2b6-f8fbe6aa8255

08 Sep 2023 02:22AM UTC coverage: 80.449% (-12.5%) from 92.929%
e6161546-9e33-42e7-a2b6-f8fbe6aa8255

push

circle-ci

jiashenC
fix lint

13 of 13 new or added lines in 8 files covered. (100.0%)

9398 of 11682 relevant lines covered (80.45%)

1.45 hits per line

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

45.83
/evadb/functions/ndarray/open.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
import numpy as np
2✔
16
import pandas as pd
2✔
17

18
from evadb.functions.abstract.abstract_function import AbstractFunction
2✔
19
from evadb.utils.generic_utils import try_to_import_cv2
2✔
20

21

22
class Open(AbstractFunction):
2✔
23
    def setup(self):
2✔
24
        # cache data to avoid expensive open files on disk
25
        self._data_cache = dict()
2✔
26
        try_to_import_cv2()
2✔
27

28
    @property
2✔
29
    def name(self):
2✔
30
        return "Open"
×
31

32
    def forward(self, df: pd.DataFrame) -> pd.DataFrame:
2✔
33
        """
34
        Open image from server-side path.
35

36
        Returns:
37
            (pd.DataFrame): The opened image.
38
        """
39

40
        def _open(row: pd.Series) -> np.ndarray:
×
41
            path_str = row[0]
×
42
            if path_str in self._data_cache:
×
43
                data = self._data_cache[path_str]
×
44
            else:
45
                import cv2
×
46

47
                data = cv2.imread(path_str)
×
48
                assert data is not None, f"Failed to open file {path_str}"
×
49
            self._data_cache[path_str] = data
×
50

51
            return data
×
52

53
        ret = pd.DataFrame()
×
54
        ret["data"] = df.apply(_open, axis=1)
×
55
        return ret
×
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