Skip to content

Commit 975caa6

Browse files
committed
update fst module docs
1 parent a15834c commit 975caa6

File tree

8 files changed

+254
-181
lines changed

8 files changed

+254
-181
lines changed

pyformlang/cfg/cfg.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ def union(self, other: "CFG") -> "CFG":
445445
"""Makes the union of two CFGs.
446446
447447
Equivalent to:
448-
>> cfg0 | cfg1
448+
>>> cfg0 | cfg1
449449
450450
Parameters
451451
----------
@@ -486,7 +486,7 @@ def concatenate(self, other: "CFG") -> "CFG":
486486
"""Makes the concatenation of two CFGs.
487487
488488
Equivalent to:
489-
>> cfg0 + cfg1
489+
>>> cfg0 + cfg1
490490
491491
Parameters
492492
----------
@@ -564,7 +564,7 @@ def reverse(self) -> "CFG":
564564
"""Reverses the current CFG.
565565
566566
Equivalent to:
567-
>> ~cfg
567+
>>> ~cfg
568568
569569
Returns
570570
-------
@@ -651,7 +651,7 @@ def intersection(self, other: DeterministicFiniteAutomaton) -> "CFG":
651651
"""Gets the intersection of the CFG with the given automaton.
652652
653653
Equivalent to:
654-
>> cfg & dfa
654+
>>> cfg & dfa
655655
656656
Parameters
657657
----------
@@ -765,9 +765,6 @@ def _get_all_bodies(production: Production,
765765
def __and__(self, other: DeterministicFiniteAutomaton) -> "CFG":
766766
"""Gets the intersection of the CFG with the given automaton.
767767
768-
Equivalent to:
769-
>> cfg & dfa
770-
771768
Parameters
772769
----------
773770
other:

pyformlang/fcfg/feature_structure.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def add_content_path(self,
9595
------
9696
ContentAlreadyExistsError
9797
When the feature already exists.
98-
PathDoesNotExistsError
98+
PathDoesNotExistError
9999
When the path does not exist.
100100
"""
101101
to_modify = self.get_feature_by_path(path)
@@ -127,7 +127,7 @@ def get_feature_by_path(self, path: List[str] = None) -> "FeatureStructure":
127127
return self
128128
current = self.get_dereferenced()
129129
if path[0] not in current.content:
130-
raise PathDoesNotExistError()
130+
raise PathDoesNotExistError
131131
return current.content[path[0]].get_feature_by_path(path[1:])
132132

133133
def unify(self, other: "FeatureStructure") -> None:
@@ -159,7 +159,7 @@ def unify(self, other: "FeatureStructure") -> None:
159159
elif other_dereferenced.value is None:
160160
other_dereferenced.pointer = current_dereferenced
161161
else:
162-
raise FeatureStructuresNotCompatibleError()
162+
raise FeatureStructuresNotCompatibleError
163163
else:
164164
other_dereferenced.pointer = current_dereferenced
165165
for feature in other_dereferenced.content:
@@ -316,14 +316,14 @@ def _preprocess_conditions(conditions: str,
316316
elif current == "[":
317317
end_bracket = _find_closing_bracket(conditions, pos)
318318
if end_bracket == -1:
319-
raise ParsingError()
319+
raise ParsingError
320320
current_value = _preprocess_conditions(
321321
conditions, pos + 1, end_bracket)
322322
pos = end_bracket + 1
323323
elif current == "(":
324324
end_bracket = _find_closing_bracket(conditions, pos, "(", ")")
325325
if end_bracket == -1:
326-
raise ParsingError()
326+
raise ParsingError
327327
reference = conditions[pos+1: end_bracket]
328328
pos = end_bracket + 1
329329
elif current == ",":

pyformlang/finite_automaton/epsilon_nfa.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ def from_networkx(cls, graph: MultiDiGraph) -> "EpsilonNFA":
234234
"""Imports a networkx graph into an finite state automaton.
235235
236236
The imported graph requires to have the good format, i.e. to come
237-
from the function to_networkx.
237+
from the function `to_networkx`.
238238
239239
Parameters
240240
----------
@@ -543,7 +543,7 @@ def reverse(self) -> "EpsilonNFA":
543543
"""Computes the reversed Epsilon NFA.
544544
545545
Equivalent to:
546-
>> ~automaton
546+
>>> ~automaton
547547
548548
Returns
549549
-------

pyformlang/finite_automaton/finite_automaton.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ def from_networkx(cls, graph: MultiDiGraph) -> "FiniteAutomaton":
480480
"""Import a networkx graph into an finite state automaton.
481481
482482
The imported graph requires to have the good format, i.e. to come
483-
from the function to_networkx.
483+
from the function `to_networkx`.
484484
485485
Returns
486486
-------

0 commit comments

Comments
 (0)