Creates an instance of the mutation pruner plugin
502447
def build_mutation_pruner_plugin() -> LaserPlugin:
        
        from mythril.laser.ethereum.plugins.implementations.mutation_pruner import (
            MutationPruner,
        )

        return MutationPruner()
75955
def create(self, name, plugin_name, plugin_version,
               cluster_template_id=None, default_image_id=None,
               is_transient=None, description=None, cluster_configs=None,
               node_groups=None, user_keypair_id=None,
               anti_affinity=None, net_id=None, count=None,
               use_autoconfig=None, shares=None,
               is_public=None, is_protected=None):
        """"""

        data = {
            'name': name,
            'plugin_name': plugin_name,
            'plugin_version': plugin_version,
        }

        return self._do_create(data, cluster_template_id, default_image_id,
                               is_transient, description, cluster_configs,
                               node_groups, user_keypair_id, anti_affinity,
                               net_id, count, use_autoconfig, shares,
                               is_public, is_protected, api_ver=2)
505521
def create(doc=None, error_text=None, exception_handlers=empty.dict, extend=Type, chain=True, auto_instance=True,
           accept_context=False):
    """"""
    extend = extend if type(extend) == type else type(extend)

    def new_type_handler(function):
        class NewType(extend):
            __slots__ = ()
            _accept_context = accept_context

            if chain and extend != Type:
                if error_text or exception_handlers:
                    if not accept_context:
                        def __call__(self, value):
                            try:
                                value = super(NewType, self).__call__(value)
                                return function(value)
                            except Exception as exception:
                                for take_exception, rewrite in exception_handlers.items():
                                    if isinstance(exception, take_exception):
                                        if isinstance(rewrite, str):
                                            raise ValueError(rewrite)
                                        else:
                                            raise rewrite(value)
                                if error_text:
                                    raise ValueError(error_text)
                                raise exception
                    else:
                        if extend._accept_context:
                            def __call__(self, value, context):
                                try:
                                    value = super(NewType, self).__call__(value, context)
                                    return function(value, context)
                                except Exception as exception:
                                    for take_exception, rewrite in exception_handlers.items():
                                        if isinstance(exception, take_exception):
                                            if isinstance(rewrite, str):
                                                raise ValueError(rewrite)
                                            else:
                                                raise rewrite(value)
                                    if error_text:
                                        raise ValueError(error_text)
                                    raise exception
                        else:
                            def __call__(self, value, context):
                                try:
                                    value = super(NewType, self).__call__(value)
                                    return function(value, context)
                                except Exception as exception:
                                    for take_exception, rewrite in exception_handlers.items():
                                        if isinstance(exception, take_exception):
                                            if isinstance(rewrite, str):
                                                raise ValueError(rewrite)
                                            else:
                                                raise rewrite(value)
                                    if error_text:
                                        raise ValueError(error_text)
                                    raise exception
                else:
                    if not accept_context:
                        def __call__(self, value):
                            value = super(NewType, self).__call__(value)
                            return function(value)
                    else:
                        if extend._accept_context:
                            def __call__(self, value, context):
                                value = super(NewType, self).__call__(value, context)
                                return function(value, context)
                        else:
                            def __call__(self, value, context):
                                value = super(NewType, self).__call__(value)
                                return function(value, context)
            else:
                if not accept_context:
                    if error_text or exception_handlers:
                        def __call__(self, value):
                            try:
                                return function(value)
                            except Exception as exception:
                                for take_exception, rewrite in exception_handlers.items():
                                    if isinstance(exception, take_exception):
                                        if isinstance(rewrite, str):
                                            raise ValueError(rewrite)
                                        else:
                                            raise rewrite(value)
                                if error_text:
                                    raise ValueError(error_text)
                                raise exception
                    else:
                        def __call__(self, value):
                            return function(value)
                else:
                    if error_text or exception_handlers:
                        def __call__(self, value, context):
                            try:
                                return function(value, context)
                            except Exception as exception:
                                for take_exception, rewrite in exception_handlers.items():
                                    if isinstance(exception, take_exception):
                                        if isinstance(rewrite, str):
                                            raise ValueError(rewrite)
                                        else:
                                            raise rewrite(value)
                                if error_text:
                                    raise ValueError(error_text)
                                raise exception
                    else:
                        def __call__(self, value, context):
                            return function(value, context)

        NewType.__doc__ = function.__doc__ if doc is None else doc
        if auto_instance and not (introspect.arguments(NewType.__init__, -1) or
                                  introspect.takes_kwargs(NewType.__init__) or
                                  introspect.takes_args(NewType.__init__)):
            return NewType()
        return NewType

    return new_type_handler
639125
function findOneOrCreatePlugin(schema) {
    schema.statics.findOneOrCreate = function findOneOrCreate(condition, doc, callback) {
        var self = this;

        self.findOne(condition, function(err, result ) {
            if (result) {
                callback(err, result);
            } else {
                self.create(doc, function(err, result) {
                    callback(err, result);
                });
            }
        });
    };
}
342286
def setup
      ensure_not_in_dest

      plugin_manager.conscientious_require

      self.converters = instantiate_subclasses(Bunto::Converter)
      self.generators = instantiate_subclasses(Bunto::Generator)
    end
426421
public static function create()
	{
		switch (func_num_args()) {
			case 0:
				return new ExtensionRange();
			case 1:
				return new ExtensionRange(func_get_arg(0));
			case 2:
				return new ExtensionRange(func_get_arg(0), func_get_arg(1));
			case 3:
				return new ExtensionRange(func_get_arg(0), func_get_arg(1), func_get_arg(2));
			case 4:
				return new ExtensionRange(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3));
			case 5:
				return new ExtensionRange(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4));
			case 6:
				return new ExtensionRange(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5));
			case 7:
				return new ExtensionRange(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5), func_get_arg(6));
			case 8:
				return new ExtensionRange(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5), func_get_arg(6), func_get_arg(7));
			default:
				throw new \InvalidArgumentException('More than 8 arguments supplied, please be reasonable.');
		}
	}
1188953
function pluginEventingBehaviour (api) {
    var eventHandlers = {};

    var onCustomEvent = function() {
      var args = Array.prototype.slice.call(arguments);
      api.emit(args.shift(), args);
    };

    api.on = function (name, callback, context) {
      if (!eventHandlers.hasOwnProperty(name)) {
        eventHandlers[name] = [];
      }

      eventHandlers[name].push([callback, context]);
      return api;
    };

    api.off = function (name, callback, context) {
      if (!eventHandlers.hasOwnProperty(name) ||
          eventHandlers[name].length === 0) {
        return;
      }

      $.filter(eventHandlers[name], function(listener) {
        return listener[0] === callback &&
                listener[1] === context;
      });

      return api;
    };

    api.once = function (name, callback, context) {
      var fn = function () {
        api.off(name, fn);
        return callback.apply(context, arguments);
      };

      api.on(name, fn);
      return api;
    };

    api.emit = function (name, args) {
      $.callAsync(function() {
        if (!eventHandlers.hasOwnProperty(name) && eventHandlers[name].length) {
          return;
        }

        $.forEach(eventHandlers[name], function(handler) {
          handler[0].apply(handler[1], args);
        });
      });

      return api;
    };

    var onReady = function onReady (readyCallback) {
      if (api._.on) {
        // If the plugin supports custom events we'll use them
        api._.on(-1, {
          customEvent: curryCallAsync(onCustomEvent)
        });
      }

      // Only the main plugin has an initialise method
      if (api._.initialise) {
        api.on('ready', curryCallAsync(readyCallback));
        api._.initialise();
      }
      else {
        readyCallback.call(api);
      }
    };

    return function (completion) {
      onReady(function(err) {
        if (err) {
          OTPlugin.error('Error while starting up plugin ' + api.uuid + ': ' + err);
          completion(err);
          return;
        }

        OTPlugin.debug('Plugin ' + api.id + ' is loaded');
        completion(void 0, api);
      });
    };
  }
396684
async def mutation_resolver(self, mutation_name, args, fields):
        

        try:
            # make sure we can identify the mutation
            mutation_summary = [mutation for mutation in \
                                            self._external_service_data['mutations'] \
                                            if mutation['name'] == mutation_name][0]
        # if we couldn't get the first entry in the list
        except KeyError as e:
            # make sure the error is reported
            raise ValueError("Could not execute mutation named: " + mutation_name)


        # the function to use for running the mutation depends on its schronicity
        # event_function = self.event_broker.ask \
        #                     if mutation_summary['isAsync'] else self.event_broker.send
        event_function = self.event_broker.ask

        # send the event and wait for a response
        value =  await event_function(
            action_type=mutation_summary['event'],
            payload=args
        )
        try:
            # return a dictionary with the values we asked for
            return json.loads(value)

        # if the result was not valid json
        except json.decoder.JSONDecodeError:
            # just throw the value
            raise RuntimeError(value)
1154229
function Mutant(obj) {
    var triggered,
        i = 0;
        mutations = {};

    if (!obj.addEventListener) {
        obj = EventTarget(obj);
    }
    
    function trigger() {
        i++;
        
        if (triggered) return;
        
        triggered = setTimeout(function() {
            var evt = new MutationEvent(mutations, i);

            triggered = null;
            mutations = {};
            i = 0;

            obj.dispatchEvent(evt);
        }, 0);
    }
    
    return new Proxy(obj, {
        deleteProperty: function(target, property) {
            if (property in target) {
                if (!(property in mutations)) {
                    mutations[property] = target[property];
                }
                
                delete target[property];
                trigger();
            }
            
            return true;
        },
        defineProperty: function(target, property, descriptor) {
            var value = target[property];
            
            Object.defineProperty(target, property, descriptor);

            if (!(property in mutations)) {
                if (target[property] !== value) {
                    mutations[property] = value;
                    trigger();
                }
            }
        },
        set: function(target, property, value, receiver) {
            if (value !== target[property]) {
                if (!(property in mutations)) {
                    mutations[property] = target[property];
                }
                
                target[property] = value;
                trigger();
            }
        }
    });
}
504884
function Plugin(regexp, replacer, id) {
    // return value should be a callable function
    // with strictly defined options passed by markdown-it
    var self = function(md, options) {
        self.options = options;
        self.init(md);
    };

    // initialize plugin object
    self.__proto__ = Plugin.prototype;

    // clone regexp with all the flags
    var flags = (regexp.global ? 'g' : '') + (regexp.multiline ? 'm' : '') + (regexp.ignoreCase ? 'i' : '');

    self.regexp = RegExp('^' + regexp.source, flags);

    // copy init options
    self.replacer = replacer;

    // this plugin can be inserted multiple times,
    // so we're generating unique name for it
    self.id = id ? id : 'regexp-' + counter;
    counter++;

    return self;
}
851634
function setupBodyMutationObserver() {
    function addImageLoadListners(mutation) {
      function addImageLoadListener(element) {
        if (false === element.complete) {
          log('Attach listeners to ' + element.src)
          element.addEventListener('load', imageLoaded, false)
          element.addEventListener('error', imageError, false)
          elements.push(element)
        }
      }

      if (mutation.type === 'attributes' && mutation.attributeName === 'src') {
        addImageLoadListener(mutation.target)
      } else if (mutation.type === 'childList') {
        Array.prototype.forEach.call(
          mutation.target.querySelectorAll('img'),
          addImageLoadListener
        )
      }
    }

    function removeFromArray(element) {
      elements.splice(elements.indexOf(element), 1)
    }

    function removeImageLoadListener(element) {
      log('Remove listeners from ' + element.src)
      element.removeEventListener('load', imageLoaded, false)
      element.removeEventListener('error', imageError, false)
      removeFromArray(element)
    }

    function imageEventTriggered(event, type, typeDesc) {
      removeImageLoadListener(event.target)
      sendSize(type, typeDesc + ': ' + event.target.src, undefined, undefined)
    }

    function imageLoaded(event) {
      imageEventTriggered(event, 'imageLoad', 'Image loaded')
    }

    function imageError(event) {
      imageEventTriggered(event, 'imageLoadFailed', 'Image load failed')
    }

    function mutationObserved(mutations) {
      sendSize(
        'mutationObserver',
        'mutationObserver: ' + mutations[0].target + ' ' + mutations[0].type
      )

      // Deal with WebKit / Blink asyncing image loading when tags are injected into the page
      mutations.forEach(addImageLoadListners)
    }

    function createMutationObserver() {
      var target = document.querySelector('body'),
        config = {
          attributes: true,
          attributeOldValue: false,
          characterData: true,
          characterDataOldValue: false,
          childList: true,
          subtree: true
        }

      observer = new MutationObserver(mutationObserved)

      log('Create body MutationObserver')
      observer.observe(target, config)

      return observer
    }

    var elements = [],
      MutationObserver =
        window.MutationObserver || window.WebKitMutationObserver,
      observer = createMutationObserver()

    return {
      disconnect: function() {
        if ('disconnect' in observer) {
          log('Disconnect body MutationObserver')
          observer.disconnect()
          elements.forEach(removeImageLoadListener)
        }
      }
    }
  }
161122
function createVersion(config) {
  if (!(config && (typeof config.root === 'string'
      || config.root === null || config.root === undefined))) {
    throw new Error('"config.root" is required and must be a string');
  }
  var root = config.root;
  if (root === null || root === undefined) {
    root = defaultRoot;
  }

  return createRfr(function(idFromRoot) {
    if (typeof idFromRoot !== 'string') {
      throw new Error('A string is required for the argument of ' +
      'a user created RFR version.');
    }
    return require(normalizeId(idFromRoot, this.root));
  }, root);
}
1138786
def mutate(self, mutation, timeout=None, metadata=None, credentials=None):
        """"""
        return self.stub.Mutate(mutation, timeout=timeout, metadata=metadata,
                                credentials=credentials)
623118
public function create()
	{
		$out	= $this->template;																	//  local copy of set template
		$out	= $this->loadNestedTemplates( $out );												//  search for nested templates and load them
		
		foreach( $this->plugins as $plugin )
			if( $plugin->type == 'pre' )
				$out	= $plugin->work( $out );

 		$out	= preg_replace( '/<%--.*--%>/sU', '', $out );										//  remove template engine style comments
 		if( self::$removeComments )																	//  HTML comments should be removed
			$out	= preg_replace( '/<!--.+-->/sU', '', $out );									//  find and remove all HTML comments 
 		if( self::$removeOptional )																	//  optional parts should be removed
			$out	= preg_replace( '/<%\?--.+--%>/sU', '', $out );									//  find and remove optional parts
		else																						//  otherwise
			$out	= preg_replace( '/<%\?--(.+)--%>/sU', '\\1', $out );							//  find, remove markup but keep content

		foreach( $this->elements as $label => $element )											//  iterate over all registered element containers
		{
			$tmp = '';																				//  
			if( is_object( $element ) )																//  element is an object
			{
				if( !( $element instanceof $this->className ) )										//  object is not an template of this template engine
					continue;																		//  skip this one
				$element = $element->create();														//  render template before concat
			}
			$tmp	.= $element;
			$out	= preg_replace( '/<%(\?)?' . preg_quote( $label, '/' ) . '%>/', $tmp, $out );	//  find placeholder and set in content
 		}
		$out = preg_replace( '/<%\?.*%>/U', '', $out );    											//  remove left over optional placeholders
#        $out = preg_replace( '/\n\s+\n/', "\n", $out );												//  remove double line breaks

		foreach( $this->plugins as $plugin )
			if( $plugin->type == 'post' )
				$out	= $plugin->work( $out );

		$tags = array();																			//  create container for left over placeholders
		if( preg_match_all( '/<%.*%>/U', $out, $tags ) === 0 )										//  no more placeholders left over
		    return $out; 																			//  return final result

		$tags	= array_shift( $tags );																//  
		foreach( $tags as $key => $value )
			$tags[$key]	= preg_replace( '@(<%\??)|%>@', "", $value );
		if( $this->fileName )
			throw new Exception_Template( Exception_Template::FILE_LABELS_MISSING, $this->fileName, $tags );
		throw new Exception_Template( Exception_Template::LABELS_MISSING, NULL, $tags );
	}
570075
private function createClientPluginNode()
    {
        $treeBuilder = new TreeBuilder('plugins');
        // Keep compatibility with symfony/config < 4.2
        if (!method_exists($treeBuilder, 'getRootNode')) {
            $node = $treeBuilder->root('plugins');
        } else {
            $node = $treeBuilder->getRootNode();
        }

        /** @var ArrayNodeDefinition $pluginList */
        $pluginList = $node
            ->info('A list of plugin service ids and client specific plugin definitions. The order is important.')
            ->prototype('array')
        ;
        $pluginList
            // support having just a service id in the list
            ->beforeNormalization()
                ->always(function ($plugin) {
                    if (is_string($plugin)) {
                        return [
                            'reference' => [
                                'enabled' => true,
                                'id' => $plugin,
                            ],
                        ];
                    }

                    return $plugin;
                })
            ->end()

            ->validate()
                ->always(function ($plugins) {
                    foreach ($plugins as $name => $definition) {
                        if ('authentication' === $name) {
                            if (!count($definition)) {
                                unset($plugins['authentication']);
                            }
                        } elseif (!$definition['enabled']) {
                            unset($plugins[$name]);
                        }
                    }

                    return $plugins;
                })
            ->end()
        ;
        $this->addSharedPluginNodes($pluginList, true);

        $pluginList
            ->children()
                ->arrayNode('reference')
                    ->canBeEnabled()
                    ->info('Reference to a plugin service')
                    ->children()
                        ->scalarNode('id')
                            ->info('Service id of a plugin')
                            ->isRequired()
                            ->cannotBeEmpty()
                        ->end()
                    ->end()
                ->end()
                ->arrayNode('add_host')
                    ->canBeEnabled()
                    ->addDefaultsIfNotSet()
                    ->info('Set scheme, host and port in the request URI.')
                    ->children()
                        ->scalarNode('host')
                            ->info('Host name including protocol and optionally the port number, e.g. https://api.local:8000')
                            ->isRequired()
                            ->cannotBeEmpty()
                        ->end()
                        ->scalarNode('replace')
                            ->info('Whether to replace the host if request already specifies one')
                            ->defaultValue(false)
                        ->end()
                    ->end()
                ->end()
                ->arrayNode('add_path')
                    ->canBeEnabled()
                    ->addDefaultsIfNotSet()
                    ->info('Add a base path to the request.')
                    ->children()
                        ->scalarNode('path')
                            ->info('Path to be added, e.g. /api/v1')
                            ->isRequired()
                            ->cannotBeEmpty()
                        ->end()
                    ->end()
                ->end()
                ->arrayNode('base_uri')
                    ->canBeEnabled()
                    ->addDefaultsIfNotSet()
                    ->info('Set a base URI to the request.')
                    ->children()
                        ->scalarNode('uri')
                            ->info('Base Uri including protocol, optionally the port number and prepend path, e.g. https://api.local:8000/api')
                            ->isRequired()
                            ->cannotBeEmpty()
                        ->end()
                        ->scalarNode('replace')
                            ->info('Whether to replace the host if request already specifies one')
                            ->defaultValue(false)
                        ->end()
                    ->end()
                ->end()
                ->arrayNode('content_type')
                    ->canBeEnabled()
                    ->info('Detect the content type of a request body and set the Content-Type header if it is not already set.')
                    ->children()
                        ->booleanNode('skip_detection')
                            ->info('Whether to skip detection when request body is larger than size_limit')
                            ->defaultFalse()
                        ->end()
                        ->scalarNode('size_limit')
                            ->info('Skip content type detection if request body is larger than size_limit bytes')
                        ->end()
                    ->end()
                ->end()
                ->arrayNode('header_append')
                    ->canBeEnabled()
                    ->info('Append headers to the request. If the header already exists the value will be appended to the current value.')
                    ->fixXmlConfig('header')
                    ->children()
                        ->arrayNode('headers')
                            ->info('Keys are the header names, values the header values')
                            ->normalizeKeys(false)
                            ->useAttributeAsKey('name')
                            ->prototype('scalar')->end()
                        ->end()
                    ->end()
                ->end()
                ->arrayNode('header_defaults')
                    ->canBeEnabled()
                    ->info('Set header to default value if it does not exist.')
                    ->fixXmlConfig('header')
                    ->children()
                        ->arrayNode('headers')
                            ->info('Keys are the header names, values the header values')
                            ->normalizeKeys(false)
                            ->useAttributeAsKey('name')
                            ->prototype('scalar')->end()
                        ->end()
                    ->end()
                ->end()
                ->arrayNode('header_set')
                    ->canBeEnabled()
                    ->info('Set headers to requests. If the header does not exist it wil be set, if the header already exists it will be replaced.')
                    ->fixXmlConfig('header')
                    ->children()
                        ->arrayNode('headers')
                            ->info('Keys are the header names, values the header values')
                            ->normalizeKeys(false)
                            ->useAttributeAsKey('name')
                            ->prototype('scalar')->end()
                        ->end()
                    ->end()
                ->end()
                ->arrayNode('header_remove')
                    ->canBeEnabled()
                    ->info('Remove headers from requests.')
                    ->fixXmlConfig('header')
                    ->children()
                        ->arrayNode('headers')
                            ->info('List of header names to remove')
                            ->prototype('scalar')->end()
                        ->end()
                    ->end()
                ->end()
                ->arrayNode('query_defaults')
                    ->canBeEnabled()
                    ->info('Sets query parameters to default value if they are not present in the request.')
                    ->fixXmlConfig('parameter')
                    ->children()
                        ->arrayNode('parameters')
                            ->info('List of query parameters. Names and values must not be url encoded as the plugin will encode them.')
                            ->normalizeKeys(false)
                            ->useAttributeAsKey('name')
                            ->prototype('scalar')->end()
                        ->end()
                    ->end()
                ->end()
            ->end()
        ->end();

        return $node;
    }
586426
public static function createInstance(): self
    {
        return new static(
            [
                new Factory\Argument(new PrettyPrinter()),
                new Factory\Class_(),
                new Factory\Constant(new PrettyPrinter()),
                new Factory\DocBlock(DocBlockFactory::createInstance()),
                new Factory\File(NodesFactory::createInstance()),
                new Factory\Function_(),
                new Factory\Interface_(),
                new Factory\Method(),
                new Factory\Property(new PrettyPrinter()),
                new Factory\Trait_(),
            ]
        );
    }
890004
function() {
		var C = gui.Class.extend.apply(this, arguments);
		C.$plugins = gui.Object.copy(this.$plugins);
		return C;
		/*
		 * Mutating plugins deprecated!
		 *
		var args = [],
			def, br = gui.Class.breakdown(arguments);
		["name", "protos", "recurring", "statics"].forEach(function(key) {
			if ((def = br[key])) {
				args.push(def);
			}
		}, this);
		var C = gui.Class.extend.apply(this, args);
		C.$plugins = gui.Object.copy(this.$plugins);
		var b = gui.Class.breakdown(arguments);
		gui.Object.each(C.$plugins, function(prefix, plugin) {
			var def = b.protos[prefix];
			switch (gui.Type.of(def)) {
				case "object":
					var mutant = plugin.extend(def);
					C.plugin(prefix, mutant, true);
					break;
				case "undefined":
					break;
				default:
					throw new TypeError(
						C + ": Bad definition for " + prefix + ': ' + def
					);
			}
		}, this);
		return C;
		*/
	}