The default handlers defined for examples.
543669
function exampleHandlers(customHandlers) {
    return (customHandlers || []).concat([
      {
        pattern: /^(\w[\w\.\(\)\[\]'"]*)\s*===?\s*(.*)$/,
        template: 'equality',
        data: function(match) {
          return {
            left: match[1],
            right: match[2]
          };
        }
      },
      {
        pattern: /^(\w[\w\.\(\)\[\]'"]*)\s*!==?\s*(.*)$/,
        template: 'inequality',
        data: function(match) {
          return {
            left: match[1],
            right: match[2]
          };
        }
      },
      {
        pattern: /^instanceof (.*)$/,
        template: 'instanceof',
        data: function(match) {
          return { type: match[1] };
        }
      },
      {
        pattern: /^NaN$/,
        template: 'nan'
      },
      {
        pattern: /^throws$/,
        template: 'throws'
      },
      {
        pattern: /^calls\s+(\w+)\s+(\d+)(?:\s+times?)?$/,
        template: 'calls',
        data: function(match) {
          return {
            callback: match[1],
            count: getCount(match[2])
          };
        }
      },
      {
        pattern: /^calls\s+(\w+)\s+(\d+)\s+times? asynchronously$/,
        template: 'calls_async',
        data: function(match) {
          return {
            callback: match[1],
            count: getCount(match[2])
          };
        }
      },
      {
        pattern: /^=~\s+\/(.*)\/$/,
        template: 'string_proximity',
        data: function(match) {
          return { pattern: match[1] };
        }
      },
      {
        pattern: /^=~\s+\[(.*),?\s*\.\.\.\s*\]$/,
        template: 'array_inclusion',
        data: function(match) {
          return { elements: match[1] };
        }
      },
      {
        pattern: /^one of (.*)$/,
        template: 'array_membership',
        data: function(match) {
          return { values: match[1] };
        }
      },
      {
        pattern: /^=~\s+\[(.*)\]$/,
        template: 'array_proximity',
        data: function(match) {
          return { elements: match[1] };
        }
      },
      {
        pattern: /^\[(.*),?\s*\.\.\.\s*\]$/,
        template: 'array_head',
        data: function(match) {
          return { head: match[1] };
        }
      },
      {
        pattern: /^\[\s*\.\.\.,?\s*(.*)\]$/,
        template: 'array_tail',
        data: function(match) {
          return { tail: match[1] };
        }
      },
      {
        pattern: /\{([\s\S]*),?[\s\n]*\.\.\.[\s\n]*\}/,
        template: 'object_proximity',
        data: function(match) {
          return { properties: match[1] };
        }
      }
    ]);
  }
390662
function(method, args, options) {
            var that = this, methodHandler;

            options = options || {};

            var handler = this.getHandler(method);
            if (!handler) return Q.reject(new Error("No handler found for method: "+method));

            // Is offline
            if (!Offline.isConnected()) {
                methodHandler = handler.fallback;
            }
            methodHandler = methodHandler || handler.execute || this.defaultHandler.execute;

            // No default
            if (!methodHandler) {
                return Q.reject(new Error("No handler found for this method in this backend"));
            }

            return Q(methodHandler(args, options, method)).then(function(results) {
                if (handler.after) {
                    return Q.all([
                        Q(handler.after(args, results, options, method)),
                        Q((that.defaultHandler.after || function() {})(args, results, options, method))
                    ]).then(function() {
                        return Q(results);
                    }, function() {
                        return Q(results);
                    });
                }
                return results;
            });
        }
152994
function defaultClientIDHandler(args, context, info) {
  return get(args, [ 'clientID' ]) ||
    get(context, [ 'clientID' ]) ||
    get(info, [ 'rootValue', 'clientID' ]);
}
167561
function(args, callInstance) {
    handlers.afterFunc({name: callInstance.name}, null, args, callInstance);
  }
495474
def register_handler(self, handler):
        
        self._handlers[handler.namespace] = handler

        handler.registered(self)
217053
public function handleRouter()
	{
		// Load initial/default routes if there're no components or the component wants to merge them
    	if ($this->component === false || $this->component->getMergeDefaultRouting()) {
    		$this->getRouter()->loadRoutes(
    			__APP_CONFIG_ROUTING,
				!$this->getSetting('forcelogin', true),
				$this->getSetting('forcesession', true),
				$this->getSetting('templatebase', true),
				$this->getSetting('templatepath', true)
			);
    	}

		// If there's a component
		if ($this->component !== false) {
			$this->getRouter()->loadRoutes(
				$this->component->hasRouting() ? $this->component->getRoutingPath() : __APP_CONFIG_ROUTING,
				!$this->getSetting('forcelogin'),
				$this->getSetting('forcesession'),
				$this->getSetting('templatebase'),
				$this->getSetting('templatepath')
			);
    	}
    	    	
    	$this->getRouter()->handleRoute(__BASE);
    }
94861
function Handler() {
    if (this.constructor === Handler) {
        throw new Error("Can't instantiate abstract class!");
    }

    /**
     * @var {Object}
     * @protected
     */
    this.__inspector;

    /**
     * @var {Object}
     * @protected
     */
    this.__run;

    /**
     * @var {Object}
     * @protected
     */
    this.__request = null;

    /**
     * @var {Object}
     * @protected
     */
    this.__response = null;
}
799577
protected function defaultHandler()/*# : bool */
    {
        $status = $this->result->getStatus();
        $handler = $this->result->getHandler() ?: $this->getHandler($status);

        if ($handler) {
            $param = ['result' => $this->result];
            $callable = $this->getResolver()->resolve($handler);
            if ($this->trigger(self::EVENT_BEFORE_HANDLER, $param)) {
                call_user_func($callable, $this->result);
                $this->trigger(self::EVENT_AFTER_HANDLER, $param);
            }
        }
        return false;
    }
651911
function callAllEventHandlers(...fns) {
  return (event, ...args) =>
    fns.some(fn => {
      if (fn) {
        fn(event, ...args)
      }
      return (
        event.preventDownshiftDefault ||
        (event.hasOwnProperty('nativeEvent') &&
          event.nativeEvent.preventDownshiftDefault)
      )
    })
}
471068
def params_handler_default(params_handler)
      params_handler[:require] = (self.class.entity_required || route_key(@klass)) unless params_handler.has_key?(:require)
      params_handler[:permit] = self.class.entity_attributes unless params_handler.has_key?(:permit)
      params_handler
    end
1357881
def _create_handler(self, config):
        
        if config is None:
            raise ValueError('No handler config to create handler from.')

        if 'name' not in config:
            raise ValueError('Handler name is required.')

        handler_name = config['name']
        # try to create handler
        module_name = handler_name.rsplit('.', 1)[0]
        class_name = handler_name.rsplit('.', 1)[-1]
        module = import_module(module_name)
        handler_class = getattr(module, class_name)
        instance = handler_class(**config)

        return instance
492694
def _set_defaults(self, log_level=logging.INFO, redirect_stdout=False):
        """"""

        # Remove all previous handlers
        for handler in self.handlers[:]:
            self.removeHandler(handler)

        # Set levels
        self.setLevel(logging.DEBUG)

        # Set up the stdout handler
        self.fh = None
        self.sh = logging.StreamHandler()
        self.sh.emit = colored_formatter
        self.addHandler(self.sh)

        self.sh.setLevel(log_level)

        # warnings.showwarning = self._show_warning

        # Redirects all stdout to the logger
        if redirect_stdout:
            sys.stdout = LoggerStdout(self._print)

        # Catches exceptions
        sys.excepthook = self._catch_exceptions
949298
def do_init(self, handler):
        
        self.waiting = True
        self.exc_info = None
        self.handler = handler
463911
function(handler, options) {
        var active = this.active;
        if(active) {
            this.deactivate();
        }
        this.handler = new handler(this, this.callbacks, options);
        if(active) {
            this.activate();
        }
    }
776072
def handler(self, scheme_name=None):
		
		if scheme_name is None:
			return self.__default_handler_cls
		for handler in self.__handlers_cls:
			if handler.scheme_specification().scheme_name() == scheme_name:
				return handler
1072687
function Handler(level) {
	level = level || Logger.NOTSET;

	if (Logger.getLevelName(level) === '') {
		throw new Error('Argument 1 of Handler.constructor has unsupported'
			+ ' value \'' + level + '\'');
	}

	Filterer.call(this);

	/**
	 * @private
	 * @type {number}
	 */
	this._level = level;

	/**
	 * @private
	 * @type {Object}
	 */
	this._formatter = null;
}
350667
protected function loadDefaultHandlers()
    {
        $filter = $this->htmlCleaner;

        // INT / INTEGER
        $this->handlers[static::INTEGER] = $this->handlers['INT'] = function ($source) {
            // Only use the first integer value
            preg_match('/-?[0-9]+/', (string) $source, $matches);

            return isset($matches[0]) ? (int) $matches[0] : null;
        };

        // UINT
        $this->handlers[static::UINT] = function ($source) {
            // Only use the first integer value
            preg_match('/-?[0-9]+/', (string) $source, $matches);

            return isset($matches[0]) ? abs((int) $matches[0]) : null;
        };

        // FLOAT / DOUBLE
        $this->handlers[static::FLOAT] = $this->handlers['DOUBLE'] = function ($source) {
            // Only use the first floating point value
            preg_match('/-?[0-9]+(\.[0-9]+)?/', (string) $source, $matches);

            return isset($matches[0]) ? (float) $matches[0] : null;
        };

        // BOOLEAN / BOOL
        $this->handlers[static::BOOLEAN] = $this->handlers['BOOL'] = function ($source) {
            return (bool) $source;
        };

        // WORD
        $this->handlers[static::WORD] = function ($source) {
            return (string) preg_replace('/[^A-Z_]/i', '', $source);
        };

        // ALNUM
        $this->handlers[static::ALNUM] = function ($source) {
            return (string) preg_replace('/[^A-Z0-9]/i', '', $source);
        };

        // CMD
        $this->handlers[static::CMD] = function ($source) {
            $result = (string) preg_replace('/[^A-Z0-9_\.-]/i', '', $source);

            return ltrim($result, '.');
        };

        // BASE64
        $this->handlers[static::BASE64] = function ($source) {
            return (string) preg_replace('/[^A-Z0-9\/+=]/i', '', $source);
        };

        // STRING
        $this->handlers[static::STRING] = function ($source) use ($filter) {
            return (string) $filter->remove($filter->decode((string) $source));
        };

        // HTML
        $this->handlers[static::HTML] = function ($source) use ($filter) {
            return (string) $filter->remove((string) $source);
        };

        // ARRAY
        $this->handlers[static::ARRAY_TYPE] = function ($source) {
            return (array) $source;
        };

        // PATH
        $this->handlers[static::PATH] = function ($source) {
            $pattern = '/^[A-Za-z0-9_-]+[A-Za-z0-9_\.-]*([\\\\\/][A-Za-z0-9_-]+[A-Za-z0-9_\.-]*)*$/';
            preg_match($pattern, (string) $source, $matches);

            return isset($matches[0]) ? (string) $matches[0] : null;
        };

        // USERNAME
        $this->handlers[static::USERNAME] = function ($source) {
            return (string) preg_replace('/[\x00-\x1F\x7F<>"\'%&]/', '', $source);
        };

        // EMAIL
        $this->handlers[static::EMAIL] = function ($source) {
            return (string) filter_var($source, FILTER_SANITIZE_EMAIL);
        };

        // HTML
        $this->handlers[static::URL] = function ($source) {
            return (string) filter_var(
                $source,
                FILTER_SANITIZE_URL,
                FILTER_FLAG_QUERY_REQUIRED | FILTER_FLAG_PATH_REQUIRED
            );
        };

        // RAW
        $this->handlers[static::RAW] = function ($source) {
            return $source;
        };

        // UNKNOWN
        $this->defaultHandler = function ($source) use ($filter) {
            // Are we dealing with an array?
            if (is_array($source)) {
                foreach ($source as $key => $value) {
                    // Filter element for XSS and other 'bad' code etc.
                    if (is_string($value)) {
                        $source[$key] = $filter->remove($filter->decode($value));
                    }
                }

                return $source;
            } else {
                // Or a string?
                if (is_string($source) && !empty($source)) {
                    // Filter source for XSS and other 'bad' code etc.
                    return $filter->remove($filter->decode($source));
                } else {
                    // Not an array or string.. return the passed parameter
                    return $source;
                }
            }
        };
    }