Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/symbols/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def __eq__(self, other):
def __hash__(self):
return id(self)

def pop(self, pos: int) -> Symbol:
def pop(self, pos: int = -1) -> Symbol:
return self.children.pop(pos)

def append(self, *args):
Expand Down
20 changes: 0 additions & 20 deletions src/symbols/symbol_.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
# the GNU General License
# ----------------------------------------------------------------------

import re
from collections import Counter

from typing import Optional
Expand Down Expand Up @@ -78,25 +77,6 @@ def t(self):

return self._t

def copy_attr(self, other):
""" Copies all other attributes (not methods)
from the other object to this instance.
"""
if not isinstance(other, Symbol):
return # Nothing done if not a Symbol object

tmp = re.compile('__.*__')
for attr in (x for x in dir(other) if not tmp.match(x)):
if (
hasattr(self.__class__, attr) and
str(type(getattr(self.__class__, attr)) in ('property', 'function', 'instancemethod'))
):
continue

val = getattr(other, attr)
if isinstance(val, str) or str(val)[0] != '<': # Not a value
setattr(self, attr, val)

@property
def is_needed(self) -> bool:
return len(self.required_by) > 0
Expand Down