From 3f8741afae765ca199cc86204323b6103ff68a70 Mon Sep 17 00:00:00 2001 From: UriKH Date: Thu, 16 Apr 2026 00:11:51 +0300 Subject: [PATCH 1/2] Update system parameters --- README.md | 9 +++++---- dreamer/system/system.py | 17 +++++++++-------- examples/main_example.py | 4 ++-- tests/test_system_logger_integration.py | 2 +- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 7be4e12..381680a 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,7 @@ There are a few important configurations you might want to change: ### Run A classic run would look something like this: + ```python from dreamer import System, config, log from dreamer import analysis, search, extraction, loading @@ -68,10 +69,10 @@ from dreamer import analysis, search, extraction, loading config.configure(...) my_system = System( - if_srcs=[loading.pFq(log(2), 2, 1, -1)], # Set up the loading stage - provide inspiration functions - extractor=extraction.extractor.ShardExtractorMod, # Choose an extraction module - analyzers=[analysis.AnalyzerModV1], # Choose an analysis module(s) - searcher=search.SearcherModV1 # Choose the search module + function_sources=[loading.pFq(log(2), 2, 1, -1)], # Set up the loading stage - provide inspiration functions + extractor=extraction.extractor.ShardExtractorMod, # Choose an extraction module + analyzers=[analysis.AnalyzerModV1], # Choose an analysis module(s) + searcher=search.SearcherModV1 # Choose the search module ) my_system.run(constants=[log(2)]) diff --git a/dreamer/system/system.py b/dreamer/system/system.py index 642a8b3..c2c0dc4 100644 --- a/dreamer/system/system.py +++ b/dreamer/system/system.py @@ -30,27 +30,28 @@ class System: """ def __init__(self, - if_srcs: List[DBModScheme | str | Formatter], - extractor: Optional[Type[ExtractionModScheme]], + * + function_sources: List[DBModScheme | str | Formatter], + extractor: Optional[Type[ExtractionModScheme]] = None, analyzers: List[Type[AnalyzerModScheme] | partial[AnalyzerModScheme] | str | Searchable], searcher: Type[SearcherModScheme] | partial[SearcherModScheme]): """ Constructing a system runnable instance for a given combination of modules. - :param if_srcs: A list of DBModScheme instances used as sources. + :param function_sources: A list of DBModScheme instances used as sources. :param extractor: An optional ExtractionModScheme type used to extract shards from the CMFs. If extractor not provided, analysis will try to read from the default searchables directory. :param analyzers: A list of AnalyzerModScheme types used for prioritization + preparation before the search :param searcher: A SearcherModScheme type used to deepen the search done by the analyzers """ - if not isinstance(if_srcs, list): + if not isinstance(function_sources, list): raise ValueError('Inspiration Functions must be contained in a list') - self.if_srcs = if_srcs + self.func_srcs = function_sources self.extractor = extractor self.analyzers = analyzers self.searcher = searcher - if not self.if_srcs and self.extractor: + if not self.func_srcs and self.extractor: raise ValueError('Could not preform extraction if no sourced to extract from where provided') def run(self, constants: Optional[List[str | Constant] | str | Constant] = None): @@ -165,14 +166,14 @@ def __loading_stage(self, constants: List[Constant]) -> Dict[Constant, List[CMFD :param constants: A list of all constants relevant to this run :return: A mapping from a constant to the list of its CMFs (matching the inspiration functions) """ - if not self.if_srcs: + if not self.func_srcs: return dict() Logger('Loading CMFs ...', Logger.Levels.info).log() modules = [] cmf_data = defaultdict(set) - for db in self.if_srcs: + for db in self.func_srcs: if isinstance(db, DBModScheme): modules.append(db) elif isinstance(db, str): diff --git a/examples/main_example.py b/examples/main_example.py index 769a511..447c397 100644 --- a/examples/main_example.py +++ b/examples/main_example.py @@ -43,8 +43,8 @@ def trajectory_compute_func_analysis(d): ) System( - if_srcs=[pFq(log(2), 2, 1, -1)], + function_sources=[pFq(log(2), 2, 1, -1)], extractor=extraction.extractor.ShardExtractorMod, analyzers=[analysis.AnalyzerModV1], - searcher=search.SearcherModV1 + searcher=search.GeneticSearchMod ).run(constants=[log(2)]) diff --git a/tests/test_system_logger_integration.py b/tests/test_system_logger_integration.py index 0accbb1..5dfa239 100644 --- a/tests/test_system_logger_integration.py +++ b/tests/test_system_logger_integration.py @@ -22,7 +22,7 @@ def test_system_run_calls_logger_start_run_once_per_run(monkeypatch, tmp_path): monkeypatch.setattr(system_mod.extraction_config, "PATH_TO_SEARCHABLES", str(searchables_dir)) system = System( - if_srcs=[], + function_sources=[], extractor=None, analyzers=[], searcher=cast(type[SearcherModScheme], _DummySearcher), From 3f25c7a0cd7776e852e8870ff346573d021d923a Mon Sep 17 00:00:00 2001 From: UriKH Date: Thu, 16 Apr 2026 00:20:39 +0300 Subject: [PATCH 2/2] forgot a comma :) --- dreamer/system/system.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dreamer/system/system.py b/dreamer/system/system.py index c2c0dc4..3aa4311 100644 --- a/dreamer/system/system.py +++ b/dreamer/system/system.py @@ -30,7 +30,7 @@ class System: """ def __init__(self, - * + *, function_sources: List[DBModScheme | str | Formatter], extractor: Optional[Type[ExtractionModScheme]] = None, analyzers: List[Type[AnalyzerModScheme] | partial[AnalyzerModScheme] | str | Searchable],