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

SwissDataScienceCenter / renku-data-services / 11784329519

11 Nov 2024 06:40PM UTC coverage: 86.369% (-4.5%) from 90.823%
11784329519

push

github

olevski
fix: run the /post-init.sh script if present

Co-authored-by: Flora Thiebaut <flora.thiebaut@sdsc.ethz.ch>

1 of 1 new or added line in 1 file covered. (100.0%)

269 existing lines in 26 files now uncovered.

14991 of 17357 relevant lines covered (86.37%)

1.54 hits per line

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

90.32
/components/renku_data_services/utils/sqlalchemy.py
1
"""Utilities for SQLAlchemy."""
2✔
2

3
from pathlib import PurePosixPath
2✔
4
from typing import cast
2✔
5

6
from sqlalchemy import Dialect, types
2✔
7
from ulid import ULID
2✔
8

9

10
class ULIDType(types.TypeDecorator):
2✔
11
    """Wrapper type for ULID <--> str conversion."""
2✔
12

13
    impl = types.String
2✔
14
    cache_ok = True
2✔
15

16
    def process_bind_param(self, value: ULID | None, dialect: Dialect) -> str | None:
2✔
17
        """Transform value for storing in the database."""
18
        if value is None:
2✔
19
            return None
2✔
20
        return str(value)
2✔
21

22
    def process_result_value(self, value: str | None, dialect: Dialect) -> ULID | None:
2✔
23
        """Transform string from database into ULID."""
24
        if value is None:
2✔
25
            return None
2✔
26
        return cast(ULID, ULID.from_str(value))  # cast because mypy doesn't understand ULID type annotations
2✔
27

28

29
class PurePosixPathType(types.TypeDecorator):
2✔
30
    """Wrapper type for Path <--> str conversion."""
2✔
31

32
    impl = types.String
2✔
33
    cache_ok = True
2✔
34

35
    def process_bind_param(self, value: PurePosixPath | str | None, dialect: Dialect) -> str | None:
2✔
36
        """Transform value for storing in the database."""
37
        if value is None:
2✔
UNCOV
38
            return None
×
39
        elif isinstance(value, str):
2✔
UNCOV
40
            return value
×
41
        else:
42
            return value.as_posix()
2✔
43

44
    def process_result_value(self, value: str | None, dialect: Dialect) -> PurePosixPath | None:
2✔
45
        """Transform string from database into PosixPath."""
46
        if value is None:
2✔
UNCOV
47
            return None
×
48
        return PurePosixPath(value)
2✔
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