MCPcopy
hub / github.com/hylang/hy / replace

Method replace

hy/models.py:42–54  ·  view source on GitHub ↗
(self, other, recursive=False)

Source from the content-addressed store, hash-verified

40 properties = ["_start_line", "_end_line", "_start_column", "_end_column"]
41
42 def replace(self, other, recursive=False):
43 if isinstance(other, Object):
44 for attr in self.properties:
45 if not hasattr(self, attr) and hasattr(other, attr):
46 setattr(self, attr, getattr(other, attr))
47 else:
48 raise TypeError(
49 "Can't replace a non Hy object '{}' with a Hy object '{}'".format(
50 repr(other), repr(self)
51 )
52 )
53
54 return self
55
56 @property
57 def start_line(self):

Callers 15

_module_filter_nameFunction · 0.45
hy_exc_filterFunction · 0.45
wrapperFunction · 0.45
local_macro_nameFunction · 0.45
rename_functionFunction · 0.45
compile_expressionMethod · 0.45
as_modelFunction · 0.45
replace_hy_objFunction · 0.45
repr_indentFunction · 0.45
strip_digit_separatorsFunction · 0.45
__new__Method · 0.45
replaceMethod · 0.45

Calls

no outgoing calls

Tested by 4

test_byte_compileFunction · 0.36
test_tracebacksFunction · 0.36
make_expressionFunction · 0.36