[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/pythonnet/pythonnet/v3.2.0/src/runtime/InteropConfiguration.cs [Back]  [Original]

namespace Python.Runtime
{
    using System;
    using System.Collections.Generic;
    using System.Linq;

    using Python.Runtime.Mixins;

    public sealed class InteropConfiguration: IDisposable
    {
        internal readonly PythonBaseTypeProviderGroup pythonBaseTypeProviders
            = new();

        /// Enables replacing base types of CLR types as seen from Python
        public IList PythonBaseTypeProviders => this.pythonBaseTypeProviders;

        public static InteropConfiguration MakeDefault()
        {
            return new InteropConfiguration
            {
                PythonBaseTypeProviders =
                {
                    DefaultBaseTypeProvider.Instance,
                    new CollectionMixinsProvider(new Lazy(() => Py.Import("clr._extras.collections"))),
                    new DynamicObjectMixinsProvider(new Lazy(() => Py.Import("clr._extras.dlr"))),
                },
            };
        }

        public void Dispose()
        {
            foreach (var provider in PythonBaseTypeProviders.OfType())
            {
                provider.Dispose();
            }
            PythonBaseTypeProviders.Clear();
        }
    }
}

Web Proxy Viewer  |  New URL  |  Original Page