Skip to content

Commit

Permalink
Move iter_active_tagging_scripts() generator near over iter_*() methods
Browse files Browse the repository at this point in the history
  • Loading branch information
zas committed May 27, 2024
1 parent 9548b75 commit b1f3272
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions picard/script/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,17 @@ def save_tagging_scripts_to_config(scripts, config=None):
config.setting['list_of_scripts'] = [(s.pos, s.name, s.enabled, s.content) for s in scripts]


def iter_active_tagging_scripts(config=None):
"""Returns an iterator over the enabled and not empty tagging scripts."""
if config is None:
config = get_config()
if not config.setting['enable_tagger_scripts']:
return
for script in iter_tagging_scripts_from_config(config=config):
if script.enabled and script.content:
yield script


class ScriptFunctionDocError(Exception):
pass

Expand Down Expand Up @@ -136,17 +147,6 @@ def script_function_documentation_all(fmt='markdown', pre='',
return "\n".join(doc_elements)


def iter_active_tagging_scripts(config=None):
"""Returns an iterator over the enabled and not empty tagging scripts."""
if config is None:
config = get_config()
if not config.setting['enable_tagger_scripts']:
return
for script in iter_tagging_scripts_from_config(config=config):
if script.enabled and script.content:
yield script


def get_file_naming_script(settings):
"""Retrieve the file naming script.
Expand Down

0 comments on commit b1f3272

Please sign in to comment.