Skip to content

Commit 77e8ef2

Browse files
authored
Merge pull request #546 from boriel/refact/refactorize_code
Refact/refactorize code
2 parents 7266f1e + 4f24bdc commit 77e8ef2

2 files changed

Lines changed: 1 addition & 21 deletions

File tree

src/symbols/block.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def __eq__(self, other):
4343
def __hash__(self):
4444
return id(self)
4545

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

4949
def append(self, *args):

src/symbols/symbol_.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
# the GNU General License
1010
# ----------------------------------------------------------------------
1111

12-
import re
1312
from collections import Counter
1413

1514
from typing import Optional
@@ -78,25 +77,6 @@ def t(self):
7877

7978
return self._t
8079

81-
def copy_attr(self, other):
82-
""" Copies all other attributes (not methods)
83-
from the other object to this instance.
84-
"""
85-
if not isinstance(other, Symbol):
86-
return # Nothing done if not a Symbol object
87-
88-
tmp = re.compile('__.*__')
89-
for attr in (x for x in dir(other) if not tmp.match(x)):
90-
if (
91-
hasattr(self.__class__, attr) and
92-
str(type(getattr(self.__class__, attr)) in ('property', 'function', 'instancemethod'))
93-
):
94-
continue
95-
96-
val = getattr(other, attr)
97-
if isinstance(val, str) or str(val)[0] != '<': # Not a value
98-
setattr(self, attr, val)
99-
10080
@property
10181
def is_needed(self) -> bool:
10282
return len(self.required_by) > 0

0 commit comments

Comments
 (0)