fabricatio 0.2.7.dev4__cp312-cp312-win_amd64.whl → 0.2.8__cp312-cp312-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. fabricatio/__init__.py +4 -11
  2. fabricatio/actions/article.py +226 -92
  3. fabricatio/actions/article_rag.py +86 -21
  4. fabricatio/actions/output.py +71 -3
  5. fabricatio/actions/rag.py +3 -3
  6. fabricatio/actions/rules.py +39 -0
  7. fabricatio/capabilities/advanced_judge.py +23 -0
  8. fabricatio/capabilities/censor.py +90 -0
  9. fabricatio/capabilities/check.py +195 -0
  10. fabricatio/capabilities/correct.py +160 -96
  11. fabricatio/capabilities/propose.py +20 -4
  12. fabricatio/capabilities/rag.py +5 -4
  13. fabricatio/capabilities/rating.py +68 -23
  14. fabricatio/capabilities/review.py +21 -190
  15. fabricatio/capabilities/task.py +9 -10
  16. fabricatio/config.py +11 -3
  17. fabricatio/fs/curd.py +4 -0
  18. fabricatio/models/action.py +24 -10
  19. fabricatio/models/adv_kwargs_types.py +25 -0
  20. fabricatio/models/extra/__init__.py +1 -0
  21. fabricatio/models/extra/advanced_judge.py +32 -0
  22. fabricatio/models/extra/article_base.py +324 -89
  23. fabricatio/models/extra/article_essence.py +49 -176
  24. fabricatio/models/extra/article_main.py +48 -127
  25. fabricatio/models/extra/article_outline.py +12 -152
  26. fabricatio/models/extra/article_proposal.py +29 -13
  27. fabricatio/models/extra/patches.py +7 -0
  28. fabricatio/models/extra/problem.py +153 -0
  29. fabricatio/models/extra/rule.py +65 -0
  30. fabricatio/models/generic.py +360 -88
  31. fabricatio/models/kwargs_types.py +23 -17
  32. fabricatio/models/role.py +4 -1
  33. fabricatio/models/task.py +1 -1
  34. fabricatio/models/tool.py +149 -14
  35. fabricatio/models/usages.py +61 -47
  36. fabricatio/models/utils.py +0 -46
  37. fabricatio/parser.py +7 -8
  38. fabricatio/rust.cp312-win_amd64.pyd +0 -0
  39. fabricatio/{_rust.pyi → rust.pyi} +50 -0
  40. fabricatio/{_rust_instances.py → rust_instances.py} +1 -1
  41. fabricatio/utils.py +54 -0
  42. fabricatio-0.2.8.data/scripts/tdown.exe +0 -0
  43. {fabricatio-0.2.7.dev4.dist-info → fabricatio-0.2.8.dist-info}/METADATA +2 -1
  44. fabricatio-0.2.8.dist-info/RECORD +58 -0
  45. fabricatio/_rust.cp312-win_amd64.pyd +0 -0
  46. fabricatio-0.2.7.dev4.data/scripts/tdown.exe +0 -0
  47. fabricatio-0.2.7.dev4.dist-info/RECORD +0 -47
  48. {fabricatio-0.2.7.dev4.dist-info → fabricatio-0.2.8.dist-info}/WHEEL +0 -0
  49. {fabricatio-0.2.7.dev4.dist-info → fabricatio-0.2.8.dist-info}/licenses/LICENSE +0 -0
@@ -1,226 +1,99 @@
1
1
  """ArticleEssence: Semantic fingerprint of academic paper for structured analysis."""
2
2
 
3
- from typing import List
3
+ from typing import List, Self
4
4
 
5
- from fabricatio.models.generic import Display, PrepareVectorization, ProposedAble
6
- from pydantic import BaseModel, Field
5
+ from fabricatio.models.generic import Display, PersistentAble, ProposedAble, Vectorizable
6
+ from pydantic import BaseModel
7
7
 
8
8
 
9
9
  class Equation(BaseModel):
10
- """Mathematical formalism specification for research contributions.
11
-
12
- Encodes equations with dual representation: semantic meaning and typeset-ready notation.
13
- """
10
+ """Mathematical formalism specification for research contributions."""
14
11
 
15
12
  description: str
16
- """Equation significance structured in three elements:
17
- 1. Physical/conceptual meaning of the equation.
18
- 2. Role in technical workflow (e.g., derivation, optimization, or analysis).
19
- 3. Relationship to the paper's core contribution (e.g., theoretical foundation, empirical validation).
20
- Example: "Defines constrained search space dimensionality reduction. Used in architecture optimization phase (Section 3.2). Enables 40% parameter reduction."
13
+ """Structured significance including:
14
+ 1. Conceptual meaning
15
+ 2. Technical workflow role
16
+ 3. Contribution relationship
21
17
  """
22
18
 
23
19
  latex_code: str
24
- """LaTeX representation following academic typesetting standards:
25
- - Must use equation environment (e.g., `equation`, `align`).
26
- - Multiline equations must align at '=' using `&`.
27
- - Include unit annotations where applicable.
28
- Example: "\\begin{equation} \\mathcal{L}_{NAS} = \\alpha \\|\\theta\\|_2 + \\beta H(p) \\end{equation}"
29
- """
20
+ """Typeset-ready notation."""
30
21
 
31
22
 
32
23
  class Figure(BaseModel):
33
- """Visual component specification for technical communication.
34
-
35
- Combines graphical assets with structured academic captioning.Extracted from the article provided
36
- """
24
+ """Visual component with academic captioning."""
37
25
 
38
26
  description: str
39
- """Figure interpretation guide containing:
40
- 1. Key visual elements mapping (e.g., axes, legends, annotations).
41
- 2. Data representation methodology (e.g., visualization type, statistical measures).
42
- 3. Connection to research findings (e.g., supports hypothesis, demonstrates performance).
43
- Example: "Architecture search space topology (left) vs. convergence curves (right). Demonstrates NAS efficiency gains through constrained search."
27
+ """Interpretation guide covering:
28
+ 1. Visual element mapping
29
+ 2. Data representation method
30
+ 3. Research connection
44
31
  """
45
32
 
46
33
  figure_caption: str
47
- """Complete caption following Nature-style guidelines:
48
- 1. Brief overview statement (首句总结).
49
- 2. Technical detail layer (e.g., data sources, experimental conditions).
50
- 3. Result implication (e.g., key insights, implications for future work).
51
- Example: "Figure 3: Differentiable NAS framework. (a) Search space topology with constrained dimensions. (b) Training convergence across language pairs. Dashed lines indicate baseline methods."
34
+ """Nature-style caption containing:
35
+ 1. Overview statement
36
+ 2. Technical details
37
+ 3. Result implications
52
38
  """
53
39
 
54
40
  figure_serial_number: int
55
- """The Image serial number extracted from the Markdown article provided, the path usually in the form of `![](images/1.jpg)`, in this case the serial number is `1`"""
56
-
57
-
58
- class Algorithm(BaseModel):
59
- """Algorithm specification for research contributions."""
60
-
61
- title: str
62
- """Algorithm title with technical focus descriptor (e.g., 'Gradient Descent Optimization').
63
-
64
- Tip: Do not attempt to translate the original element titles when generating JSON.
65
- """
66
-
67
- description: str
68
- """Algorithm description with technical focus descriptor:
69
- - Includes input/output specifications.
70
- - Describes key steps and their purpose.
71
- - Explains its role in the research workflow.
72
- Example: "Proposed algorithm for neural architecture search. Inputs include search space constraints and training data. Outputs optimized architecture."
73
- """
74
-
75
-
76
- class Table(BaseModel):
77
- """Table specification for research contributions."""
78
-
79
- title: str
80
- """Table title with technical focus descriptor (e.g., 'Comparison of Model Performance Metrics').
81
-
82
- Tip: Do not attempt to translate the original element titles when generating JSON.
83
- """
84
-
85
- description: str
86
- """Table description with technical focus descriptor:
87
- - Includes data source and structure.
88
- - Explains key columns/rows and their significance.
89
- - Connects to research findings or hypotheses.
90
- Example: "Performance metrics for different architectures. Columns represent accuracy, F1-score, and inference time. Highlights efficiency gains of proposed method."
91
- """
41
+ """Image serial number extracted from Markdown path"""
92
42
 
93
43
 
94
44
  class Highlightings(BaseModel):
95
- """Technical showcase aggregator for research artifacts.
96
-
97
- Curates core scientific components with machine-parseable annotations.
98
- """
45
+ """Technical component aggregator."""
99
46
 
100
47
  highlighted_equations: List[Equation]
101
- """3-5 pivotal equations representing theoretical contributions:
102
- - Each equation must be wrapped in $$ for display math.
103
- - Contain at least one novel operator/symbol.
104
- - Be referenced in Methods/Results sections.
105
- Example: Equation describing proposed loss function.
106
- """
107
-
108
- highlighted_algorithms: List[Algorithm]
109
- """1-2 key algorithms demonstrating methodological contributions:
110
- - Include pseudocode or step-by-step descriptions.
111
- - Highlight innovation in computational approach.
112
- Example: Algorithm for constrained search space exploration.
113
-
114
- Tip: Do not attempt to translate the original element titles when generating JSON.
115
- """
48
+ """Equations that highlight the article's core contributions"""
116
49
 
117
50
  highlighted_figures: List[Figure]
118
- """4-6 key figures demonstrating:
119
- 1. Framework overview (1 required).
120
- 2. Quantitative results (2-3 required).
121
- 3. Ablation studies (1 optional).
122
- Each must appear in Results/Discussion chapters.
123
- Example: Figure showing architecture topology and convergence curves.
51
+ """key figures requiring:
52
+ 1. Framework overview
53
+ 2. Quantitative results
124
54
  """
125
55
 
126
- highlighted_tables: List[Table]
127
- """2-3 key tables summarizing:
128
- - Comparative analysis of methods.
129
- - Empirical results supporting claims.
130
- Example: Table comparing model performance across datasets.
131
-
132
- Tip: Do not attempt to translate the original element titles when generating JSON.
133
- """
134
56
 
57
+ class ArticleEssence(ProposedAble, Display, PersistentAble, Vectorizable):
58
+ """Structured representation of a scientific article's core elements in its original language."""
135
59
 
136
- class ArticleEssence(ProposedAble, Display, PrepareVectorization):
137
- """Semantic fingerprint of academic paper for structured analysis.
60
+ language: str
61
+ """Language of the original article."""
138
62
 
139
- Encodes research artifacts with dual human-machine interpretability.
140
- """
141
-
142
- title: str = Field(...)
143
- """Exact title of the original article without any modification.
144
- Must be preserved precisely from the source material without:
145
- - Translation
146
- - Paraphrasing
147
- - Adding/removing words
148
- - Altering style or formatting
149
- """
63
+ title: str
64
+ """Exact title of the original article."""
150
65
 
151
66
  authors: List[str]
152
- """Original author names exactly as they appear in the source document. No translation or paraphrasing.
153
- Extract complete list without any modifications or formatting changes."""
67
+ """Original author full names as they appear in the source document."""
154
68
 
155
69
  keywords: List[str]
156
- """Original keywords exactly as they appear in the source document. No translation or paraphrasing.
157
- Extract the complete set without modifying format or terminology."""
70
+ """Original keywords as they appear in the source document."""
158
71
 
159
72
  publication_year: int
160
- """Publication timestamp in ISO 8601 (YYYY format)."""
73
+ """Publication year in ISO 8601 (YYYY format)."""
161
74
 
162
75
  highlightings: Highlightings
163
- """Technical highlight reel containing:
164
- - Core equations (Theory)
165
- - Key algorithms (Implementation)
166
- - Critical figures (Results)
167
- - Benchmark tables (Evaluation)"""
168
-
169
- domain: List[str]
170
- """Domain tags for research focus."""
171
-
172
- abstract: str = Field(...)
173
- """Three-paragraph structured abstract:
174
- Paragraph 1: Problem & Motivation (2-3 sentences)
175
- Paragraph 2: Methodology & Innovations (3-4 sentences)
176
- Paragraph 3: Results & Impact (2-3 sentences)
177
- Total length: 150-250 words"""
76
+ """Technical highlights including equations, algorithms, figures, and tables."""
77
+
78
+ abstract: str
79
+ """Abstract text in the original language."""
178
80
 
179
81
  core_contributions: List[str]
180
- """3-5 technical contributions using CRediT taxonomy verbs.
181
- Each item starts with action verb.
182
- Example:
183
- - 'Developed constrained NAS framework'
184
- - 'Established cross-lingual transfer metrics'"""
82
+ """Technical contributions using CRediT taxonomy verbs."""
185
83
 
186
84
  technical_novelty: List[str]
187
- """Patent-style claims with technical specificity.
188
- Format: 'A [system/method] comprising [novel components]...'
189
- Example:
190
- 'A neural architecture search system comprising:
191
- a differentiable constrained search space;
192
- multi-lingual transferability predictors...'"""
85
+ """Patent-style claims with technical specificity."""
193
86
 
194
87
  research_problems: List[str]
195
- """Problem statements as how/why questions.
196
- Example:
197
- - 'How to reduce NAS computational overhead while maintaining search diversity?'
198
- - 'Why do existing architectures fail in low-resource cross-lingual transfer?'"""
88
+ """Problem statements as how/why questions."""
199
89
 
200
90
  limitations: List[str]
201
- """Technical limitations analysis containing:
202
- 1. Constraint source (data/method/theory)
203
- 2. Impact quantification
204
- 3. Mitigation pathway
205
- Example:
206
- 'Methodology constraint: Single-objective optimization (affects 5% edge cases),
207
- mitigated through future multi-task extension'"""
208
-
209
- future_work: List[str]
210
- """Research roadmap items with 3 horizons:
211
- 1. Immediate extensions (1 year)
212
- 2. Mid-term directions (2-3 years)
213
- 3. Long-term vision (5+ years)
214
- Example:
215
- 'Short-term: Adapt framework for vision transformers (ongoing with CVPR submission)'"""
216
-
217
- impact_analysis: List[str]
218
- """Bibliometric impact projections:
219
- - Expected citation counts (next 3 years)
220
- - Target application domains
221
- - Standard adoption potential
222
- Example:
223
- 'Predicted 150+ citations via integration into MMEngine (Alibaba OpenMMLab)'"""
224
-
225
- def _prepare_vectorization_inner(self) -> str:
226
- return self.model_dump_json()
91
+ """Technical limitations analysis."""
92
+
93
+ bibtex_cite_key: str
94
+ """Bibtex cite key of the original article."""
95
+
96
+ def update_cite_key(self, new_cite_key: str) -> Self:
97
+ """Update the bibtex_cite_key of the article."""
98
+ self.bibtex_cite_key = new_cite_key
99
+ return self
@@ -1,13 +1,12 @@
1
1
  """ArticleBase and ArticleSubsection classes for managing hierarchical document components."""
2
2
 
3
3
  from itertools import chain
4
- from typing import Generator, List, Self, Tuple
4
+ from typing import Dict, Generator, List, Self, Tuple, override
5
5
 
6
6
  from fabricatio.journal import logger
7
7
  from fabricatio.models.extra.article_base import (
8
8
  ArticleBase,
9
- ArticleMainBase,
10
- ArticleRef,
9
+ ArticleOutlineBase,
11
10
  ChapterBase,
12
11
  SectionBase,
13
12
  SubSectionBase,
@@ -15,8 +14,8 @@ from fabricatio.models.extra.article_base import (
15
14
  from fabricatio.models.extra.article_outline import (
16
15
  ArticleOutline,
17
16
  )
18
- from fabricatio.models.generic import CensoredAble, Display, PersistentAble, WithRef
19
- from fabricatio.models.utils import ok
17
+ from fabricatio.models.generic import CensoredAble, Display, PersistentAble, SequencePatch, WithRef
18
+ from fabricatio.utils import ok
20
19
 
21
20
 
22
21
  class Paragraph(CensoredAble):
@@ -28,26 +27,32 @@ class Paragraph(CensoredAble):
28
27
  writing_aim: List[str]
29
28
  """Specific communicative objectives for this paragraph's content."""
30
29
 
31
- sentences: List[str]
32
- """List of sentences forming the paragraph's content."""
30
+ content: str
31
+ """The actual content of the paragraph, represented as a string."""
33
32
 
34
33
 
35
- class ArticleSubsection(ArticleMainBase, SubSectionBase):
34
+ class ArticleParagraphSequencePatch(SequencePatch[Paragraph]):
35
+ """Patch for `Paragraph` list of `ArticleSubsection`."""
36
+
37
+
38
+ class ArticleSubsection(SubSectionBase):
36
39
  """Atomic argumentative unit with technical specificity."""
37
40
 
38
41
  paragraphs: List[Paragraph]
39
42
  """List of Paragraph objects containing the content of the subsection."""
40
43
 
41
- def resolve_update_error(self, other: Self) -> str:
42
- """Resolve update errors in the article outline."""
43
- if self.title != other.title:
44
- return f"Title `{other.title}` mismatched, expected `{self.title}`. "
44
+ def introspect(self) -> str:
45
+ """Introspects the subsection and returns a message if it has no paragraphs."""
46
+ if len(self.paragraphs) == 0:
47
+ return f"`{self.__class__.__name__}` titled `{self.title}` have no paragraphs, to achieve the goal of `{self.writing_aim}`."
45
48
  return ""
46
49
 
47
- def _update_from_inner(self, other: Self) -> Self:
50
+ def update_from_inner(self, other: Self) -> Self:
48
51
  """Updates the current instance with the attributes of another instance."""
49
52
  logger.debug(f"Updating SubSection {self.title}")
50
- self.paragraphs = other.paragraphs
53
+ super().update_from_inner(other)
54
+ self.paragraphs.clear()
55
+ self.paragraphs.extend(other.paragraphs)
51
56
  return self
52
57
 
53
58
  def to_typst_code(self) -> str:
@@ -56,102 +61,41 @@ class ArticleSubsection(ArticleMainBase, SubSectionBase):
56
61
  Returns:
57
62
  str: Typst code snippet for rendering.
58
63
  """
59
- return f"=== {self.title}\n" + "\n\n".join("".join(p.sentences) for p in self.paragraphs)
64
+ return f"=== {self.title}\n" + "\n\n".join(p.content for p in self.paragraphs)
60
65
 
61
66
 
62
- class ArticleSection(ArticleMainBase, SectionBase[ArticleSubsection]):
67
+ class ArticleSection(SectionBase[ArticleSubsection]):
63
68
  """Atomic argumentative unit with high-level specificity."""
64
69
 
65
- def resolve_update_error(self, other: Self) -> str:
66
- """Resolve update errors in the article outline."""
67
- if (s_len := len(self.subsections)) == 0:
68
- return ""
69
-
70
- if s_len != len(other.subsections):
71
- return f"Subsections length mismatched, expected {len(self.subsections)}, got {len(other.subsections)}"
72
-
73
- sub_sec_err_seq = [
74
- out for s, o in zip(self.subsections, other.subsections, strict=True) if (out := s.resolve_update_error(o))
75
- ]
76
-
77
- if sub_sec_err_seq:
78
- return "\n".join(sub_sec_err_seq)
79
- return ""
80
-
81
- def _update_from_inner(self, other: Self) -> Self:
82
- """Updates the current instance with the attributes of another instance."""
83
- if len(self.subsections) == 0:
84
- self.subsections = other.subsections
85
- return self
86
-
87
- for self_subsec, other_subsec in zip(self.subsections, other.subsections, strict=True):
88
- self_subsec.update_from(other_subsec)
89
- return self
90
-
91
- def to_typst_code(self) -> str:
92
- """Converts the section into a Typst formatted code snippet.
93
-
94
- Returns:
95
- str: The formatted Typst code snippet.
96
- """
97
- return f"== {self.title}\n" + "\n\n".join(subsec.to_typst_code() for subsec in self.subsections)
98
-
99
70
 
100
- class ArticleChapter(ArticleMainBase, ChapterBase[ArticleSection]):
71
+ class ArticleChapter(ChapterBase[ArticleSection]):
101
72
  """Thematic progression implementing research function."""
102
73
 
103
- def resolve_update_error(self, other: Self) -> str:
104
- """Resolve update errors in the article outline."""
105
- if (s_len := len(self.sections)) == 0:
106
- return ""
107
-
108
- if s_len != len(other.sections):
109
- return f"Sections length mismatched, expected {len(self.sections)}, got {len(other.sections)}"
110
- sec_err_seq = [
111
- out for s, o in zip(self.sections, other.sections, strict=True) if (out := s.resolve_update_error(o))
112
- ]
113
- if sec_err_seq:
114
- return "\n".join(sec_err_seq)
115
- return ""
116
74
 
117
- def _update_from_inner(self, other: Self) -> Self:
118
- """Updates the current instance with the attributes of another instance."""
119
- if len(self.sections) == 0:
120
- self.sections = other.sections
121
- return self
122
-
123
- for self_sec, other_sec in zip(self.sections, other.sections, strict=True):
124
- self_sec.update_from(other_sec)
125
- return self
126
-
127
- def to_typst_code(self) -> str:
128
- """Converts the chapter into a Typst formatted code snippet for rendering."""
129
- return f"= {self.title}\n" + "\n\n".join(sec.to_typst_code() for sec in self.sections)
130
-
131
-
132
- class Article(Display, CensoredAble, WithRef[ArticleOutline], PersistentAble, ArticleBase[ArticleChapter]):
75
+ class Article(
76
+ Display,
77
+ CensoredAble,
78
+ WithRef[ArticleOutline],
79
+ PersistentAble,
80
+ ArticleBase[ArticleChapter],
81
+ ):
133
82
  """Represents a complete academic paper specification, incorporating validation constraints.
134
83
 
135
84
  This class integrates display, censorship processing, article structure referencing, and persistence capabilities,
136
85
  aiming to provide a comprehensive model for academic papers.
137
86
  """
138
87
 
139
- abstract: str
140
- """Contains a summary of the academic paper."""
141
-
142
- title: str
143
- """Represents the title of the academic paper."""
88
+ def _as_prompt_inner(self) -> Dict[str, str]:
89
+ return {
90
+ "Original Article Briefing": self.referenced.referenced.referenced,
91
+ "Original Article Proposal": self.referenced.referenced.display(),
92
+ "Original Article Outline": self.referenced.display(),
93
+ "Original Article": self.display(),
94
+ }
144
95
 
145
- language: str
146
- """Written language of the article. SHALL be aligned to the language of the article outline provided."""
147
-
148
- def finalized_dump(self) -> str:
149
- """Exports the article in `typst` format.
150
-
151
- Returns:
152
- str: Strictly formatted outline with typst formatting.
153
- """
154
- return "\n\n".join(c.to_typst_code() for c in self.chapters)
96
+ @override
97
+ def iter_subsections(self) -> Generator[Tuple[ArticleChapter, ArticleSection, ArticleSubsection], None, None]:
98
+ return super().iter_subsections()
155
99
 
156
100
  @classmethod
157
101
  def from_outline(cls, outline: ArticleOutline) -> "Article":
@@ -164,7 +108,7 @@ class Article(Display, CensoredAble, WithRef[ArticleOutline], PersistentAble, Ar
164
108
  Article: The generated article.
165
109
  """
166
110
  # Set the title from the outline
167
- article = Article(**outline.model_dump(include={"title", "abstract"}), chapters=[])
111
+ article = Article(**outline.model_dump(exclude={"chapters"}), chapters=[])
168
112
 
169
113
  for chapter in outline.chapters:
170
114
  # Create a new chapter
@@ -189,48 +133,25 @@ class Article(Display, CensoredAble, WithRef[ArticleOutline], PersistentAble, Ar
189
133
  article.chapters.append(article_chapter)
190
134
  return article
191
135
 
192
- def iter_dfs(self) -> Generator[ArticleMainBase, None, None]:
193
- """Performs a depth-first search (DFS) through the article structure.
194
-
195
- Returns:
196
- Generator[ArticleMainBase]: Each component in the article structure.
197
- """
198
- for chap in self.chapters:
199
- for sec in chap.sections:
200
- yield from sec.subsections
201
- yield sec
202
- yield chap
203
-
204
- def deref(self, ref: ArticleRef) -> ArticleMainBase:
205
- """Resolves a reference to the corresponding section or subsection in the article.
206
-
207
- Args:
208
- ref (ArticleRef): The reference to resolve.
209
-
210
- Returns:
211
- ArticleMainBase: The corresponding section or subsection.
212
- """
213
- return ok(ref.deref(self), f"{ref} not found in {self.title}")
214
-
215
- def gather_dependencies(self, article: ArticleMainBase) -> List[ArticleMainBase]:
136
+ def gather_dependencies(self, article: ArticleOutlineBase) -> List[ArticleOutlineBase]:
216
137
  """Gathers dependencies for all sections and subsections in the article.
217
138
 
218
139
  This method should be called after the article is fully constructed.
219
140
  """
220
- depends = [self.deref(a) for a in article.depend_on]
141
+ depends = [ok(a.deref(self)) for a in article.depend_on]
221
142
 
222
143
  supports = []
223
- for a in self.iter_dfs():
224
- if article in {self.deref(b) for b in a.support_to}:
144
+ for a in self.iter_dfs_rev():
145
+ if article in {ok(b.deref(self)) for b in a.support_to}:
225
146
  supports.append(a)
226
147
 
227
148
  return list(set(depends + supports))
228
149
 
229
- def gather_dependencies_recursive(self, article: ArticleMainBase) -> List[ArticleMainBase]:
150
+ def gather_dependencies_recursive(self, article: ArticleOutlineBase) -> List[ArticleOutlineBase]:
230
151
  """Gathers all dependencies recursively for the given article.
231
152
 
232
153
  Args:
233
- article (ArticleMainBase): The article to gather dependencies for.
154
+ article (ArticleOutlineBase): The article to gather dependencies for.
234
155
 
235
156
  Returns:
236
157
  List[ArticleBase]: A list of all dependencies for the given article.
@@ -269,7 +190,7 @@ class Article(Display, CensoredAble, WithRef[ArticleOutline], PersistentAble, Ar
269
190
 
270
191
  def iter_dfs_with_deps(
271
192
  self, chapter: bool = True, section: bool = True, subsection: bool = True
272
- ) -> Generator[Tuple[ArticleMainBase, List[ArticleMainBase]], None, None]:
193
+ ) -> Generator[Tuple[ArticleOutlineBase, List[ArticleOutlineBase]], None, None]:
273
194
  """Iterates through the article in a depth-first manner, yielding each component and its dependencies.
274
195
 
275
196
  Args:
@@ -283,7 +204,7 @@ class Article(Display, CensoredAble, WithRef[ArticleOutline], PersistentAble, Ar
283
204
  if all((not chapter, not section, not subsection)):
284
205
  raise ValueError("At least one of chapter, section, or subsection must be True.")
285
206
 
286
- for component in self.iter_dfs():
207
+ for component in self.iter_dfs_rev():
287
208
  if not chapter and isinstance(component, ArticleChapter):
288
209
  continue
289
210
  if not section and isinstance(component, ArticleSection):