Passed
Push — main ( 7535b2...286971 )
by Sat CFDI
05:34
created

satcfdi.utils.StrEnum.__format__()   A

Complexity

Conditions 1

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nop 2
dl 0
loc 2
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1 1
import enum
2 1
from collections.abc import Sequence, Mapping
3
4 1
from lxml import etree
5
6 1
parser = etree.XMLParser(
7
    no_network=True,
8
    remove_comments=True,
9
    remove_blank_text=True,
10
    huge_tree=True,
11
    collect_ids=False,
12
    remove_pis=True,
13
    recover=True
14
)
15
16
17 1
class ScalarMap(dict):
18 1
    pass
19
20
21 1
def iterate(item):
22 1
    if isinstance(item, str | bytes | ScalarMap):
23 1
        yield item
24 1
        return
25 1
    if isinstance(item, Mapping):
26 1
        yield from item.values()
27 1
        return
28 1
    if isinstance(item, Sequence):
29 1
        yield from item
30 1
        return
31 1
    if item is None:
32 1
        return
33 1
    yield item
34
35
36
# class StrEnum(str, enum.Enum):  # Compatible with Python 3.10
37
#     def __str__(self):
38
#         return self.value
39
#
40
#     def __format__(self, format_spec):
41
#         return self.value.__format__(format_spec)
42
#
43
#     @classmethod
44
#     def get(cls, key, default=None):
45
#         return cls._member_map_.get(key, default)
46