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

Beakerboy / vbaProject-Compiler / 4309316396

pending completion
4309316396

push

github

GitHub
Update test_fullFile.pyt (#83)

82 of 82 new or added lines in 6 files covered. (100.0%)

342 of 346 relevant lines covered (98.84%)

2.97 hits per line

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

95.12
/vbaProjectCompiler/Models/Entities/doc_module.py
1
from ms_ovba_compression.ms_ovba import MsOvba
3✔
2
from vbaProjectCompiler.Models.Entities.module_base import ModuleBase
3✔
3

4

5
class DocModule(ModuleBase):
3✔
6
    """
7
    A Document Module is a module record that is associated with a worksheet or
8
    workbook.
9
    """
10
    def __init__(self, name):
3✔
11
        self.docTlibVer = 0
3✔
12
        super(DocModule, self).__init__(name)
3✔
13
        self.type = "Document"
3✔
14

15
        # GUIDs
16
        self._guid = []
3✔
17

18
    def toProjectModuleString(self):
3✔
19
        return ("Document=" + self.modName.value + "/&H"
3✔
20
                + self.docTlibVer.to_bytes(4, "big").hex())
21

22
    def set_guid(self, guid):
3✔
23
        if isinstance(guid, list):
3✔
24
            self._guid = guid
×
25
        else:
26
            self._guid = [guid]
3✔
27

28
    def add_guid(self, guid):
3✔
29
        self._guid += guid
×
30

31
    def normalize_file(self):
3✔
32
        f = open(self._file_path, "r")
3✔
33
        new_f = open(self._file_path + ".new", "a+", newline='\r\n')
3✔
34
        for i in range(5):
3✔
35
            line = f.readline()
3✔
36

37
        new_f.write(line)
3✔
38
        guid_string = '"0'
3✔
39
        for guid in self._guid:
3✔
40
            guid_string += '{' + str(guid).upper() + '}"'
3✔
41
        txt = self._attr("Base", guid_string)
3✔
42
        new_f.writelines([txt])
3✔
43
        while line := f.readline():
3✔
44
            new_f.writelines([line])
3✔
45
        new_f.writelines([self._attr("TemplateDerived", "False")])
3✔
46
        new_f.writelines([self._attr("Customizable", "True")])
3✔
47
        new_f.close()
3✔
48

49
    def write_file(self):
3✔
50
        bin_f = open(self._file_path + ".bin", "wb")
3✔
51
        bin_f.write(self._cache)
3✔
52
        with open(self._file_path + ".new", mode="rb") as new_f:
3✔
53
            contents = new_f.read()
3✔
54
        ms_ovba = MsOvba()
3✔
55
        compressed = ms_ovba.compress(contents)
3✔
56
        bin_f.write(compressed)
3✔
57
        bin_f.close()
3✔
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