Fix renderer deduplicate_callseq duplicates slips
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "breakshaft"
|
||||
version = "0.1.6.post3"
|
||||
version = "0.1.6.post4"
|
||||
description = "Library for in-time codegen for type conversion"
|
||||
authors = [
|
||||
{ name = "nikto_b", email = "niktob560@yandex.ru" }
|
||||
|
||||
@@ -88,9 +88,11 @@ class ConversionArgRenderData:
|
||||
|
||||
def deduplicate_callseq(conversion_models: list[ConversionRenderData]) -> list[ConversionRenderData]:
|
||||
deduplicated_conv_models: list[ConversionRenderData] = []
|
||||
deduplicated_hashes = set()
|
||||
for conv_model in conversion_models:
|
||||
if conv_model not in deduplicated_conv_models:
|
||||
if hash((conv_model.inj_hash, conv_model.funchash)) not in deduplicated_hashes:
|
||||
deduplicated_conv_models.append(conv_model)
|
||||
deduplicated_hashes.add(hash((conv_model.inj_hash, conv_model.funchash)))
|
||||
continue
|
||||
|
||||
argnames = list(map(lambda x: x[1], conv_model.funcargs))
|
||||
@@ -105,6 +107,7 @@ def deduplicate_callseq(conversion_models: list[ConversionRenderData]) -> list[C
|
||||
break
|
||||
if argument_changed:
|
||||
deduplicated_conv_models.append(conv_model)
|
||||
deduplicated_hashes.add(hash((conv_model.inj_hash, conv_model.funchash)))
|
||||
return deduplicated_conv_models
|
||||
|
||||
|
||||
|
||||
@@ -134,9 +134,21 @@ def is_basic_type_annot(type_annot) -> bool:
|
||||
|
||||
|
||||
def universal_qualname(any: Any) -> str:
|
||||
ret = ''
|
||||
if hasattr(any, '__qualname__'):
|
||||
return any.__qualname__
|
||||
if hasattr(any, '__name__'):
|
||||
return any.__name__
|
||||
ret = any.__qualname__
|
||||
elif hasattr(any, '__name__'):
|
||||
ret = any.__name__
|
||||
else:
|
||||
ret = str(any)
|
||||
|
||||
return str(any)
|
||||
ret = (ret
|
||||
.replace('.', '_')
|
||||
.replace('[', '_of_')
|
||||
.replace(']', '_of_')
|
||||
.replace(',', '_and_')
|
||||
.replace(' ', '_')
|
||||
.replace('\'', '')
|
||||
.replace('<', '')
|
||||
.replace('>', ''))
|
||||
return ret
|
||||
|
||||
Reference in New Issue
Block a user