src/lingpy/evaluate/acd.py
changed.
src/lingpy/__init__.py
changed.
Other files ignored by Codecov
setup.py
has changed.
188 | 188 | def get_scores(one, other): |
|
189 | 189 | scores = [] |
|
190 | 190 | multiple_items = [] |
|
191 | - | for k,v in wordlist.get_etymdict(ref=one).items(): |
|
191 | + | for k, v in wordlist.get_etymdict(ref=one).items(): |
|
192 | 192 | _idxs = [val for val in v if val != 0] |
|
193 | 193 | # now we need to get the position in the index |
|
194 | - | poss,idxs = [],[] |
|
194 | + | poss, idxs = [], [] |
|
195 | 195 | for val in _idxs: |
|
196 | 196 | if len(val) > 1: |
|
197 | 197 | multiple_items += [len(val)] |
201 | 201 | idxs += [idx for x in new_pos] |
|
202 | 202 | poss += new_pos |
|
203 | 203 | if len(idxs) > 1: |
|
204 | - | other_idxs = [wordlist[idx,other][pos] for pos,idx in zip(poss,idxs)] |
|
204 | + | other_idxs = [wordlist[idx, other][pos] for pos, idx in zip(poss, idxs)] |
|
205 | 205 | for idx in other_idxs: |
|
206 | 206 | scores += [other_idxs.count(idx) / len(idxs)] |
|
207 | 207 | else: |
607 | 607 | ||
608 | 608 | Always tests by identity. |
|
609 | 609 | """ |
|
610 | - | my_lineage = set([id(node) for node in [self] + self.ancestors()]) |
|
610 | + | my_lineage = set([str(node) for node in [self] + self.ancestors()]) |
|
611 | 611 | curr = other |
|
612 | 612 | while curr is not None: |
|
613 | - | if id(curr) in my_lineage: |
|
613 | + | if str(curr) in my_lineage: |
|
614 | 614 | return curr |
|
615 | 615 | curr = curr._parent |
|
616 | 616 | return None |
722 | 722 | if self is other: |
|
723 | 723 | return 0 |
|
724 | 724 | #otherwise, check the list of ancestors |
|
725 | - | my_ancestors = dict.fromkeys(map(id, [self] + self.ancestors())) |
|
725 | + | my_ancestors = dict.fromkeys(map(str, [self] + self.ancestors())) |
|
726 | 726 | count = 0 |
|
727 | 727 | while other is not None: |
|
728 | - | if id(other) in my_ancestors: |
|
728 | + | if str(other) in my_ancestors: |
|
729 | 729 | #need to figure out how many steps there were back from self |
|
730 | 730 | curr = self |
|
731 | 731 | while not(curr is None or curr is other): |
1188 | 1188 | shared_params = [n for (n,v) in self.params.items() |
|
1189 | 1189 | if v is not None |
|
1190 | 1190 | and child.params.get(n) is not None |
|
1191 | - | and n is not "length"] |
|
1191 | + | and n != "length"] |
|
1192 | 1192 | length = self.Length + child.Length |
|
1193 | 1193 | if length: |
|
1194 | 1194 | params = dict([(n, |
1238 | 1238 | """"The number of edges beyond 'parent' in the direction of 'self', |
|
1239 | 1239 | unrooted""" |
|
1240 | 1240 | neighbours = self._getNeighboursExcept(parent) |
|
1241 | - | key = (id(parent), id(self)) |
|
1241 | + | key = (str(parent), str(self)) |
|
1242 | 1242 | if key not in cache: |
|
1243 | 1243 | cache[key] = 1 + sum([child._edgecount(self, cache) |
|
1244 | 1244 | for child in neighbours]) |
1555 | 1555 | #otherwise, find self's ancestors and find the first ancestor of |
|
1556 | 1556 | #other that is in the list |
|
1557 | 1557 | self_anc = self.ancestors() |
|
1558 | - | self_anc_dict = dict([(id(n),n) for n in self_anc]) |
|
1559 | - | self_anc_dict[id(self)] = self |
|
1558 | + | self_anc_dict = dict([(str(n),n) for n in self_anc]) |
|
1559 | + | self_anc_dict[str(self)] = self |
|
1560 | 1560 | ||
1561 | 1561 | count = 0 |
|
1562 | 1562 | while other is not None: |
|
1563 | - | if id(other) in self_anc_dict: |
|
1563 | + | if str(other) in self_anc_dict: |
|
1564 | 1564 | #found the first shared ancestor -- need to sum other branch |
|
1565 | 1565 | curr = self |
|
1566 | 1566 | while curr is not other: |
2041 | 2041 | NameLoaded = nameLoaded and (name is not None), |
|
2042 | 2042 | Params = params, |
|
2043 | 2043 | ) |
|
2044 | - | self._known_edges[id(node)] = node |
|
2044 | + | self._known_edges[str(node)] = node |
|
2045 | 2045 | return node |
|
2046 | 2046 | ||
2047 | 2047 |
20 | 20 | """ |
|
21 | 21 | ||
22 | 22 | __author__ = "Johann-Mattis List, and Robert Forkel (with contributions by Simon J. Greenhill, Tiago Tresoldi, Gereon Kaiping, Steven Moran, Taraka Rama, Johannes Dellert, Frank Nagel, and Peter Bouda, and Taraka Rama)" |
|
23 | - | __date__ = "2021-03-22" |
|
24 | - | __version__ = "2.6.8.dev0" |
|
23 | + | __date__ = "2021-06-07" |
|
24 | + | __version__ = "2.6.8" |
|
25 | 25 | ||
26 | 26 | # We exempt this module from QA, because it only provides import shortcuts. |
|
27 | 27 | # flake8: noqa |
454 | 454 | ||
455 | 455 | # modify matrix and traceback |
|
456 | 456 | traceback[0][0] = 1 |
|
457 | - | for i in range(1,M+1): |
|
457 | + | for i in range(1, M+1): |
|
458 | 458 | traceback[0][i] = 2 |
|
459 | - | for i in range(1,N+1): |
|
459 | + | for i in range(1, N+1): |
|
460 | 460 | traceback[i][0] = 3 |
|
461 | 461 | ||
462 | 462 | # start the loop |
|
463 | - | for i in range(1,N+1): |
|
464 | - | for j in range(1,M+1): |
|
463 | + | for i in range(1, N+1): |
|
464 | + | for j in range(1, M+1): |
|
465 | 465 | ||
466 | 466 | # calculate costs for gapA |
|
467 | 467 | if j == M: |
Files | Coverage |
---|---|
src/lingpy | 87.60% |
tests | 98.86% |
Project Totals (123 files) | 89.26% |