Skip to content

Commit df2714f

Browse files
committed
renamed function hyperedge.str2atom to str_to_atom
1 parent 5e0ffc9 commit df2714f

File tree

3 files changed

+26
-25
lines changed

3 files changed

+26
-25
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- added get_parser to main functions (at hyperbase root).
1414
- improved documentation.
1515
- hedge now accepts ParseResults and can recursively add Hyperedge.text strings.
16+
- renamed function hyperedge.str2atom to str_to_atom.
1617

1718
### Removed
1819
- function patterns.edge_matches_pattern.

src/hyperbase/hyperedge.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
valid_b_argroles: set[str] = {'m', 'a'}
2929

3030

31-
def str2atom(s: str) -> str:
31+
def str_to_atom(s: str) -> str:
3232
"""Converts a string into a valid atom."""
3333
atom = s.lower()
3434

@@ -178,7 +178,7 @@ def hedge(source: str | Hyperedge | list[Any] | tuple[Any] | ParseResult) -> Hyp
178178

179179
def build_atom(text: str, *parts: str) -> Atom:
180180
"""Build an atom from text and other parts."""
181-
atom = str2atom(text)
181+
atom = str_to_atom(text)
182182
parts_str = '/'.join([part for part in parts if part])
183183
if len(parts_str) > 0:
184184
atom = ''.join((atom, '/', parts_str))

tests/test_hyperedge.py

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import unittest
22

3-
from hyperbase.hyperedge import hedge, build_atom, str2atom, split_edge_str
3+
from hyperbase.hyperedge import hedge, build_atom, str_to_atom, split_edge_str
44

55

66
class TestHyperedge(unittest.TestCase):
@@ -71,38 +71,38 @@ def test_replace_atom_part2(self):
7171
def test_replace_atom_part3(self):
7272
self.assertEqual(hedge('(XXX/1/yyy)').replace_atom_part(1, '77'), hedge('(XXX/77/yyy)'))
7373

74-
def test_str2atom1(self):
75-
self.assertEqual(str2atom('abc'), 'abc')
74+
def test_str_to_atom1(self):
75+
self.assertEqual(str_to_atom('abc'), 'abc')
7676

77-
def test_str2atom2(self):
78-
self.assertEqual(str2atom('abc%'), 'abc%25')
77+
def test_str_to_atom2(self):
78+
self.assertEqual(str_to_atom('abc%'), 'abc%25')
7979

80-
def test_str2atom3(self):
81-
self.assertEqual(str2atom('/abc'), '%2fabc')
80+
def test_str_to_atom3(self):
81+
self.assertEqual(str_to_atom('/abc'), '%2fabc')
8282

83-
def test_str2atom4(self):
84-
self.assertEqual(str2atom('a bc'), 'a%20bc')
83+
def test_str_to_atom4(self):
84+
self.assertEqual(str_to_atom('a bc'), 'a%20bc')
8585

86-
def test_str2atom5(self):
87-
self.assertEqual(str2atom('ab(c'), 'ab%28c')
86+
def test_str_to_atom5(self):
87+
self.assertEqual(str_to_atom('ab(c'), 'ab%28c')
8888

89-
def test_str2atom6(self):
90-
self.assertEqual(str2atom('abc)'), 'abc%29')
89+
def test_str_to_atom6(self):
90+
self.assertEqual(str_to_atom('abc)'), 'abc%29')
9191

92-
def test_str2atom7(self):
93-
self.assertEqual(str2atom('.abc'), '%2eabc')
92+
def test_str_to_atom7(self):
93+
self.assertEqual(str_to_atom('.abc'), '%2eabc')
9494

95-
def test_str2atom8(self):
96-
self.assertEqual(str2atom('a*bc'), 'a%2abc')
95+
def test_str_to_atom8(self):
96+
self.assertEqual(str_to_atom('a*bc'), 'a%2abc')
9797

98-
def test_str2atom9(self):
99-
self.assertEqual(str2atom('ab&c'), 'ab%26c')
98+
def test_str_to_atom9(self):
99+
self.assertEqual(str_to_atom('ab&c'), 'ab%26c')
100100

101-
def test_str2atom10(self):
102-
self.assertEqual(str2atom('abc@'), 'abc%40')
101+
def test_str_to_atom10(self):
102+
self.assertEqual(str_to_atom('abc@'), 'abc%40')
103103

104-
def test_str2atom11(self):
105-
self.assertEqual(str2atom('graph brain/(1).'), 'graph%20brain%2f%281%29%2e')
104+
def test_str_to_atom11(self):
105+
self.assertEqual(str_to_atom('graph brain/(1).'), 'graph%20brain%2f%281%29%2e')
106106

107107
def test_split_edge_str1(self):
108108
self.assertEqual(split_edge_str('is hyperbase/1 great/1'), ('is', 'hyperbase/1', 'great/1'))

0 commit comments

Comments
 (0)