MCPcopy Create free account
hub / github.com/comaps/comaps / find_features

Function find_features

tools/python/mwm/find_feature.py:10–40  ·  view source on GitHub ↗
(path: str, typ: str, string: str)

Source from the content-addressed store, hash-verified

8
9
10def find_features(path: str, typ: str, string: str) -> List[Feature]:
11 features = []
12 index = int(string) if typ == "id" else None
13 for feature in Mwm(path):
14 found = False
15 if typ == "n":
16 for value in feature.names().values():
17 if string in value:
18 found = True
19 break
20 elif typ in ("t", "et"):
21 for t in feature.types():
22 readable_type_ = readable_type(t)
23 if readable_type_ == string:
24 found = True
25 break
26 elif typ == "t" and string in readable_type_:
27 found = True
28 break
29 elif typ == "m":
30 for f in feature.metadata():
31 if string in f.name:
32 found = True
33 break
34 elif typ == "id" and index == feature.index():
35 found = True
36
37 if found:
38 features.append(feature)
39
40 return features
41
42
43def find_and_print_features(path: str, typ: str, string: str):

Callers 2

compare_feature_numFunction · 0.90
find_and_print_featuresFunction · 0.85

Calls 7

MwmClass · 0.90
readable_typeFunction · 0.90
namesMethod · 0.45
typesMethod · 0.45
metadataMethod · 0.45
indexMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected