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

Beakerboy / MS-OVBA / 24349534171

13 Apr 2026 02:41PM UTC coverage: 89.026% (+0.1%) from 88.889%
24349534171

Pull #149

github

web-flow
Merge e2cb0cf1d into 2b8340dfb
Pull Request #149: Update dirStream.py

174 of 256 new or added lines in 7 files covered. (67.97%)

1 existing line in 1 file now uncovered.

1225 of 1376 relevant lines covered (89.03%)

4.44 hits per line

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

83.87
/src/ms_ovba/Models/Fields/project_reference.py
1
from __future__ import annotations
5✔
2
from typing import TypeVar
5✔
3

4

5
T = TypeVar('T', bound='ProjectReference')
5✔
6

7

8
class ProjectReference():
5✔
9
    """
10
    2.1.1.12
11
    Specifies the identifier of a VBA project.
12

13
    ProjectReference = "*\" ProjectKind ProjectPath
14
    ProjectKind = %x41-44
15
    ProjectPath = *(%x01-FF}
16
    """
17
    def __init__(self: T, project_path: str, embedded: bool = True) -> None:
5✔
18
        self._project_path = project_path
5✔
19
        self._embedded = embedded
5✔
20

21
    # Dunder Methods
22
    def __str__(self: T) -> str:
5✔
23
        return self._header() + \
5✔
24
            str(self._project_path)
25

26
    def __len__(self: T) -> int:
5✔
27
        return len(str(self))
5✔
28

29
    def relative(self: T) -> ProjectReference:
5✔
30
        """
31
        Strip off the path and just return the file.
32
        """
33
        # Find last '\'
34
        pos = self._project_path.rfind('\\')
5✔
35

36
        rel_path = self._project_path[pos + 1:]
5✔
37
        return ProjectReference(rel_path, self._embedded)
5✔
38

39
    def _header(self: T) -> str:
5✔
40
        project_kind = 0x41
5✔
41
        if not self._is_windows_path(self._project_path):
5✔
42
            project_kind += 1
5✔
43
        if self._embedded:
5✔
44
            project_kind += 2
5✔
45
        return "*\\" + \
5✔
46
            chr(project_kind)
47

48
    def _is_windows_path(self: T, path: str) -> bool:
5✔
49
        return path[0] != '/'
5✔
50

51
    @staticmethod
5✔
52
    def unpack(byte_data: bytes, codepage: str) -> ProjectReference:
5✔
NEW
53
        if byte_data[:2] != b'*\\':
×
NEW
54
            raise ValueError("Incorrect ProjectReference Header")
×
NEW
55
        embedded = byte_data[3] == b'A' or byte_data[3] == b'B'
×
NEW
56
        project_path = byte_data[3:].decode(codepage)
×
57
        # Inspect path to verify that it matched the project_kind character
NEW
58
        return ProjectReference(project_path, embedded)
×
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