type-related fixes and improvements

This commit is contained in:
Jan Petykiewicz 2020-11-09 22:04:04 -08:00
commit 09a5e4a2db
5 changed files with 17 additions and 16 deletions

View file

@ -70,7 +70,7 @@ def write(pattern: Pattern,
"""
#TODO consider supporting DXF arcs?
if disambiguate_func is None:
disambiguate_func = disambiguate_pattern_names
disambiguate_func = lambda pats: disambiguate_pattern_names(pats)
assert(disambiguate_func is not None)
if not modify_originals:
@ -349,7 +349,7 @@ def _mlayer2dxf(layer: layer_t) -> str:
raise PatternError(f'Unknown layer type: {layer} ({type(layer)})')
def disambiguate_pattern_names(patterns: Sequence[Pattern],
def disambiguate_pattern_names(patterns: Iterable[Pattern],
max_name_length: int = 32,
suffix_length: int = 6,
dup_warn_filter: Callable[[str], bool] = None, # If returns False, don't warn about this name

View file

@ -674,7 +674,7 @@ def annotations_to_properties(annotations: annotations_t) -> List[fatrec.Propert
for key, values in annotations.items():
vals = [AString(v) if isinstance(v, str) else v
for v in values]
properties.append(fatrec.Property(key, vals, is_standard=False))
properties.append(fatrec.Property(key, vals, is_standard=False)) # type: ignore
return properties