ensure that specifications array is determinate w.r.t route matching
544214
def ensure_sane_wildcard
      idx = specifications.length
      while (idx -= 1) >= 0
        if specifications[idx] == '*'
          raise ArgumentError, "Can only specify one wildcard '*' in between resource specifications"
        elsif specifications[idx].is_a?(Specification)
          break
        end
      end
      true
    end
612363
function validateArray(path, driver, arrayName) {
  const arr = driver[arrayName];
  if (!Array.isArray(arr)) {
    console.error(`${path} missing ${arrayName} array`);
    process.exit(1);
  }
}
1202955
function processRouteContext (instance) {
  try {
    const route = instance.$route
    if (route) {
      const { path, query, params } = route
      const value = { path, query, params }
      if (route.fullPath) value.fullPath = route.fullPath
      if (route.hash) value.hash = route.hash
      if (route.name) value.name = route.name
      if (route.meta) value.meta = route.meta
      return [{
        key: '$route',
        value: {
          _custom: {
            type: 'router',
            abstract: true,
            value
          }
        }
      }]
    }
  } catch (e) {
    // Invalid $router
  }
  return []
}
1182799
def match_interface
      str = config_get('route_map', 'match_interface', @get_args)
      intf = str.empty? ? default_match_interface : str.split
      # Normalize by downcasing
      intf.map!(&:downcase)
    end
611161
def match(self, command_context=None, **command_env):
		
		spec = self.specification()
		if command_context is None and spec is None:
			return True
		elif command_context is not None and spec is not None:
			return command_context == spec
		return False
45552
def get_working_if():
    """"""
    try:
        # return the interface associated with the route with smallest
        # mask (route by default if it exists)
        iface = min(conf.route.routes, key=lambda x: x[1])[3]
    except ValueError:
        # no route
        iface = scapy.consts.LOOPBACK_INTERFACE
    if iface.is_invalid():
        # Backup mode: try them all
        for iface in six.itervalues(IFACES):
            if not iface.is_invalid():
                return iface
        return None
    return iface
21363
def _validate(self):
        

        v_mod = utils.import_string('.'.join([
            'pyswagger',
            'scanner',
            'v' + self.version.replace('.', '_'),
            'validate'
        ]))

        if not v_mod:
            # there is no validation module
            # for this version of spec
            return []

        s = Scanner(self)
        v = v_mod.Validate()

        s.scan(route=[v], root=self.__raw)
        return v.errs
111043
function (route, data) {
            var count = 0,
                i = 0,
                defaults = {};
            // look at default values, if they match ...
            for (var name in route.defaults) {
                if (route.defaults[name] === data[name]) {
                    // mark as matched
                    defaults[name] = 1;
                    count++;
                }
            }
            for (; i < route.names.length; i++) {
                if (!data.hasOwnProperty(route.names[i])) {
                    return -1;
                }
                if (!defaults[route.names[i]]) {
                    count++;
                }

            }

            return count;
        }
538894
def check(self, spec, data):
        '''
        '''
        path_eval = self.path_eval
        for keypath, specvalue in spec.items():
            if keypath.startswith('$'):
                optext = keypath
                checkable = data
                args = (optext, specvalue, checkable)
                generator = self.dispatch_operator(*args)
            else:
                try:
                    checkable = path_eval(data, keypath)
                except self.InvalidPath:
                    # The spec referenced an item or attribute that
                    # doesn't exist. Fail!
                    return False
                generator = self.dispatch_literal(specvalue, checkable)
            for result in generator:
                if not result:
                    return False
        return True
473248
def match_route(self, reqpath):
        ''''''
        route_dicts = [routes for _, routes in self.api.http.routes.items()][0]
        routes = [route for route, _ in route_dicts.items()]
        #no prameters in path
        if reqpath in routes:
            return reqpath
        for route in routes:
            #replace params in route with regex
            if re.match(re.sub(r'/{[^{}]+}', '/\w+', route) + '$', reqpath):
                return route
        return reqpath
1208030
def ensure_traj(traj):
    

    """
    if is_float_matrix(traj) or is_bool_matrix(traj):
        return traj
    elif is_float_vector(traj):
        return traj[:,None]
    else:
        try:
            arr = np.array(traj)
            arr = ensure_dtype_float(arr)
            if is_float_matrix(arr):
                return arr
            if is_float_vector(arr):
                return arr[:,None]
            else:
                raise TypeError('Argument traj cannot be cast into a two-dimensional array. Check type.')
        except:
            raise TypeError('Argument traj is not a trajectory - only float-arrays or list of float-arrays are allowed. Types is %s' % type(traj))
248295
function pattern(toMatch) {
  var regexps = getQMarkPaths(toMatch, [])

  //reassign array to compiled regular expressions
  regexps.forEach(function(aPath, ix) {
    regexps[ix] = compile(aPath, true).regexp //'true' tells regexp compiler to math till end => '$'
  })


  if (regexps.length === 1) { //fast case
    var reg = regexps[0]
    return reg.test.bind(reg)
  } else { //test each potential path
    return function (testAgainst) {
      for (var i = 0; i < regexps.length; i++) {
        if (regexps[i].test(testAgainst)) return true
      }

      return false
    }
  }
}
1048955
def _match_modes(self, remote_path, l_st):
        """"""
        self.sftp.chmod(remote_path, S_IMODE(l_st.st_mode))
        self.sftp.utime(remote_path, (l_st.st_atime, l_st.st_mtime))

        if self.chown:
            self.sftp.chown(remote_path, l_st.st_uid, l_st.st_gid)
745044
def match(env)
      routes[env[Rack::REQUEST_METHOD]]
        .lazy # Lazy to avoid unnecessary calls to #match.
        .map { |r| r.match(env) }
        .find { |r| !r.nil? }
    end
106406
protected function matchRoute(array $url_array) : array
    {
        // If the routes haven't already been set up, process them.
        if (!isset($this->route_definitions)) {
            $this->loadRoutes();
        }
        $url = '/' . implode('/', $url_array);
        $matches = $this->doRouteMatching($url);
        if (false === $matches) {
            throw new \Exception('Unable to route url ' . $url);
        }
        $route_name = array_shift($matches);
        FW()->log->debug('URL matched route ' . $route_name);
        $route_config = $this->route_definitions[$route_name];
        $return = (isset($route_config['defaults'])) ? $route_config['defaults'] : [];
        foreach ($matches as $name => $match) {
            if (!is_numeric($name)) { // If the key is a number, it is an artifact of the regex process, ignore it
                $return[$name] = $match;
            }
        }
        return $return;
    }
519261
function validateSpec (spec) {
  if (spec === undefined) {
    return new Error('spec cannot be undefined')
  }

  const isSimpleSpec = isString(spec) || isString(spec.files)
  const isArraySpec = (Array.isArray(spec.files) && spec.files.every(isString))

  if (isArraySpec) {
    if (spec.base === undefined) {
      return new Error('spec.base cannot be undefined if spec.files is an array')
    }
  } else {
    if (!isSimpleSpec) {
      return new Error('spec.files cannot be undefined property')
    }
  }

  return undefined
}
201502
def match(self, version):
        """"""
        return all(spec.match(version) for spec in self.specs)