Source code for supriya

    import pyximport  # type: ignore

    del pyximport
except ImportError:

import appdirs  # type: ignore
import configparser  # noqa
import pathlib  # noqa

output_path = pathlib.Path(appdirs.user_cache_dir("supriya", "supriya"))
if not output_path.exists():
        output_path.mkdir(parents=True, exist_ok=True)
    except IOError:

config = configparser.ConfigParser()
config.read_dict({"core": {"editor": "vim", "scsynth": "scsynth"}})
config_path = pathlib.Path(appdirs.user_config_dir("supriya", "supriya"))
config_path = config_path / "supriya.cfg"
if not config_path.exists():
        config_path.parent.mkdir(parents=True, exist_ok=True)
        with"w") as file_pointer:
            config.write(file_pointer, True)
    except IOError:
with as file_pointer:

del appdirs
del configparser
del pathlib

[docs]def import_structured_package(path, namespace, remove=True, verbose=False): import importlib import inspect import pathlib import traceback package_path = pathlib.Path(path).resolve().absolute() if not package_path.is_dir(): package_path = package_path.parent() # Determine the package import path root_path = package_path while (root_path.parent / "").exists(): root_path = root_path.parent relative_path = package_path.relative_to(root_path) package_import_path = ".".join((,) + if verbose: print(package_import_path) # Find importable modules and import their nominative object for module_path in sorted(package_path.iterdir()): if verbose: print(" {}".format(module_path)) if module_path.is_dir(): if verbose: print(" Skipping...") continue else: if module_path.suffix not in (".py", ".pyx"): if verbose: print(" Skipping...") continue module_name = module_path.with_suffix("").name if module_name == "__init__": if verbose: print(" Skipping...") continue module_import_path = package_import_path + "." + module_name if verbose: print(" Importing {}:{}".format(module_import_path, module_name)) module = importlib.import_module(module_import_path) try: namespace[module_name] = getattr(module, module_name) except AttributeError: if verbose: print("Failed:", module_path) traceback.print_exc() # Delete this function from the namespace this_name = inspect.currentframe().f_code.co_name if remove and this_name in namespace: del (namespace[this_name])
from supriya._version import __version__, __version_info__ # noqa from supriya.enums import AddAction, CalculationRate # noqa from supriya import utils # noqa from supriya.midi import Device # noqa from import Application, Mixer # noqa from supriya.nonrealtime import Session # noqa from supriya.realtime import ( # noqa Buffer, BufferGroup, Bus, BusGroup, Group, Server, Synth, ) from supriya.soundfiles import HeaderFormat, SampleFormat, SoundFile # noqa from supriya.synthdefs import ( # noqa DoneAction, Envelope, EnvelopeShape, Parameter, ParameterRate, Range, SynthDef, SynthDefBuilder, SynthDefFactory, ) from supriya.system import Assets, Bindable, Binding, bind # noqa from supriya.soundfiles import Say # noqa from import graph, play, render # noqa from supriya import assets # noqa