<commit_before>
import copy_reg
import imp
import os
import re
import sys
import types

from importlib import import_module
from pkgutil import find_loader
from os.path import abspath, join, exists
from seisflows.tools import unix
from seisflows.tools.code import Struct, loadjson, loadobj, savejson, saveobj, loadpy
from seisflows.tools.msg import WarningOverwrite, ImportError1, ImportError2, ImportError3, ImportError4

# SeisFlows consists of interacting 'system', 'preprocess', 'solver', 'postprocess', 'optimize', and 'workflow' objects. Each corresponds simultaneously to a module in the SeisFlows source code, a class that is instantiated and made accessible via sys.modules, and parameter in a global dictionary. Once in memory, these objects can be thought of as comprising the complete 'state' of a SeisFlows session

# The following list is one of the few hardwired aspects of the whole SeisFlows package. Any changes may result in circular imports or other problems

names = []
names += ['system']
names += ['optimize']
names += ['preprocess']
names += ['solver']
names += ['postprocess']
names += ['workflow']


def config():
    """ Instantiates SeisFlows objects and makes them globally accessible by
      registering them in sys.modules
   """
    # check if objects exist on disk
    if exists(_full(_path())):
        print WarningOverwrite
        sys.exit()
<commit_msg>changed import order to allow optimize class to depend on other seisflows classes<commit_after>
import copy_reg
import imp
import os
import re
import sys
import types

from importlib import import_module
from pkgutil import find_loader
from os.path import abspath, join, exists
from seisflows.tools import unix
from seisflows.tools.code import Struct, loadjson, loadobj, loadyaml, savejson, saveobj
from seisflows.tools.msg import WarningOverwrite, ImportError1, ImportError2, ImportError3, ImportError4

# SeisFlows consists of interacting 'system', 'preprocess', 'solver', 'postprocess', 'optimize', and 'workflow' objects. Each corresponds simultaneously to a module in the SeisFlows source code, a class that is instantiated and made accessible via sys.modules, and a parameter in a global dictionary. Once in memory, these objects can be thought of as comprising the complete 'state' of a SeisFlows session

# The following list is one of the few hardwired aspects of the whole SeisFlows package. Any changes may result in circular imports or other problems

names = []
names += ['system']
names += ['preprocess']
names += ['solver']
names += ['postprocess']
names += ['optimize']
names += ['workflow']


def config():
    """ Instantiates SeisFlows objects and makes them globally accessible by
      registering them in sys.modules
   """
    # check if objects exist on disk
    if exists(_full(_path())):
        print WarningOverwrite
        sys.exit()

{'fraction_non_alphanumeric': 0.07563025210084033, 'fraction_numerical': 0.0028011204481792717, 'mean_word_length': 4.854508196721311, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2182265', 'n_tokens_mistral': 770, 'n_tokens_neox': 750, 'n_words': 351}