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

MITLibraries / transmogrifier / 17778349266

16 Sep 2025 08:35PM UTC coverage: 98.153% (-0.9%) from 99.01%
17778349266

push

github

jonavellecuerdo
[wip]

0 of 15 new or added lines in 1 file covered. (0.0%)

1701 of 1733 relevant lines covered (98.15%)

0.98 hits per line

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

0.0
/transmogrifier/sources/json/mitlibwebsite.py
NEW
1
import logging
×
NEW
2
import hashlib
×
3

NEW
4
from transmogrifier.sources.jsontransformer import JSONTransformer
×
NEW
5
from transmogrifier.sources.transformer import JSON
×
6

NEW
7
logger = logging.getLogger(__name__)
×
8

9

NEW
10
class MITLibWebsite(JSONTransformer):
×
NEW
11
    def get_main_titles(cls, source_record: dict[str, JSON]) -> list[str]:
×
12
        """
13
        Retrieve main title(s) from a JSON record.
14

15
        Must be overridden by source subclasses.
16

17
        Args:
18
            source_record: A JSON object representing a source record.
19
        """
NEW
20
        if source_record["cdx_title"] is None:
×
NEW
21
            return []
×
NEW
22
        return source_record["cdx_title"]
×
23

NEW
24
    @classmethod
×
NEW
25
    def get_source_record_id(cls, source_record: dict[str, JSON]) -> str:
×
26
        """Get or generate a source record ID from a JSON record.
27

28
        Generates an MD5 hash of the 'url' value.
29

30
        Args:
31
            source_record: A JSON object representing a source record.
32
        """
NEW
33
        return hashlib.md5(source_record["url"]).hexdigest()
×
34

NEW
35
    @classmethod
×
NEW
36
    def record_is_deleted(cls, source_record: dict[str, JSON]) -> bool:
×
37
        """
38
        Determine whether record has a status of deleted.
39

40
        May be overridden by source subclasses if needed.
41

42
        Args:
43
            source_record: A JSON object representing a source record.
44
        """
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