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

google / sedpack / 13106747150

08 Jan 2025 11:35AM UTC coverage: 86.728% (-0.1%) from 86.849%
13106747150

push

github

web-flow
Add mypy.ini (#86)

A copy from https://github.com/google/scaaml

Fix https://github.com/google/sedpack/issues/61

---------

Co-authored-by: Karel <karel@star-lab.xyz>
Co-authored-by: wsxrdv <111074929+wsxrdv@users.noreply.github.com>

111 of 133 new or added lines in 14 files covered. (83.46%)

13 existing lines in 5 files now uncovered.

2359 of 2720 relevant lines covered (86.73%)

0.87 hits per line

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

69.39
/src/sedpack/io/flatbuffer/shardfile/Example.py
1
# Copyright 2024 Google LLC
2
#
3
# Licensed under the Apache License, Version 2.0 (the "License");
4
# you may not use this file except in compliance with the License.
5
# You may obtain a copy of the License at
6
#
7
#     https://www.apache.org/licenses/LICENSE-2.0
8
#
9
# Unless required by applicable law or agreed to in writing, software
10
# distributed under the License is distributed on an "AS IS" BASIS,
11
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
# See the License for the specific language governing permissions and
13
# limitations under the License.
14

15
# automatically generated by the FlatBuffers compiler, do not modify
16

17
# namespace: shardfile
18

19
# pylint: skip-file
20

21
import flatbuffers  # type: ignore[import-untyped]
1✔
22
from flatbuffers.builder import Builder
1✔
23
from flatbuffers.compat import import_numpy  # type: ignore[import-untyped]
1✔
24

25
from sedpack.io.flatbuffer.shardfile.Attribute import Attribute
1✔
26

27
np = import_numpy()
1✔
28

29

30
class Example(object):
1✔
31
    __slots__ = ['_tab']
1✔
32

33
    @classmethod
1✔
34
    def GetRootAs(cls, buf: bytes, offset: int = 0) -> "Example":
1✔
35
        n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
×
36
        x = Example()
×
37
        x.Init(buf, n + offset)
×
38
        return x
×
39

40
    # Example
41
    def Init(self, buf: bytes, pos: int) -> None:
1✔
42
        self._tab = flatbuffers.table.Table(buf, pos)
1✔
43

44
    # Example
45
    def Attributes(self, j: int) -> Attribute | None:
1✔
46
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
1✔
47
        if o != 0:
1✔
48
            x = self._tab.Vector(o)
1✔
49
            x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
1✔
50
            x = self._tab.Indirect(x)
1✔
51
            obj = Attribute()
1✔
52
            obj.Init(self._tab.Bytes, x)
1✔
53
            return obj
1✔
54
        return None
×
55

56
    # Example
57
    def AttributesLength(self) -> int:
1✔
NEW
58
        o: int = flatbuffers.number_types.UOffsetTFlags.py_type(
×
59
            self._tab.Offset(4))
60
        if o != 0:
×
NEW
61
            return self._tab.VectorLen(o)  # type: ignore[no-any-return]
×
62
        return 0
×
63

64
    # Example
65
    def AttributesIsNone(self) -> bool:
1✔
NEW
66
        o: int = flatbuffers.number_types.UOffsetTFlags.py_type(
×
67
            self._tab.Offset(4))
UNCOV
68
        return o == 0
×
69

70

71
def ExampleStart(builder: Builder) -> None:  # type: ignore[no-any-unimported]
1✔
72
    builder.StartObject(1)
1✔
73

74

75
def Start(builder: Builder) -> None:  # type: ignore[no-any-unimported]
1✔
76
    ExampleStart(builder)
×
77

78

79
def ExampleAddAttributes(  # type: ignore[no-any-unimported]
1✔
80
        builder: Builder, attributes: int) -> None:
81
    builder.PrependUOffsetTRelativeSlot(
1✔
82
        0, flatbuffers.number_types.UOffsetTFlags.py_type(attributes), 0)
83

84

85
def AddAttributes(  # type: ignore[no-any-unimported]
1✔
86
        builder: Builder, attributes: int) -> None:
UNCOV
87
    ExampleAddAttributes(builder, attributes)
×
88

89

90
def ExampleStartAttributesVector(  # type: ignore[no-any-unimported]
1✔
91
        builder: Builder, numElems: int) -> int:
92
    return builder.StartVector(4, numElems, 4)  # type: ignore[no-any-return]
1✔
93

94

95
def StartAttributesVector(  # type: ignore[no-any-unimported]
1✔
96
        builder: Builder, numElems: int) -> int:
UNCOV
97
    return ExampleStartAttributesVector(builder, numElems)
×
98

99

100
def ExampleEnd(builder: Builder) -> int:  # type: ignore[no-any-unimported]
1✔
101
    return builder.EndObject()  # type: ignore[no-any-return]
1✔
102

103

104
def End(builder: Builder) -> int:  # type: ignore[no-any-unimported]
1✔
105
    return ExampleEnd(builder)
×
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