Guesses a TypeString from the given path
968691
def detect(self, path):
        '''
        
        '''
        typestring = UNKNOWN
        for detector in self.detectors:
            if typestring != UNKNOWN and not detector.can_improve(typestring):
                continue
            if not detector.can_detect(path):
                continue
            detected = detector.detect(path)
            if detected:
                typestring = detected
        return typestring
933344
function(path) {
      return path.lastIndexOf('.') != -1 ? 
        path.slice(path.lastIndexOf('.') + 1, path.length) :
          null
    }
91936
def type(self):
        """"""
        if isinstance(self.value, numbers.Number):
            return "number"
        if isinstance(self.value, basestring):
            return "string"
        return "unknown"
908166
def _typecheck_fsnative(path):
    

    if not isinstance(path, fsnative_type):
        return False

    if PY3 or is_win:
        if u"\x00" in path:
            return False

        if is_unix:
            try:
                path.encode(_encoding, "surrogateescape")
            except UnicodeEncodeError:
                return False
    elif b"\x00" in path:
        return False

    return True
842482
function (path) {
        var name = _gpfPathName(path),
            pos = name.lastIndexOf(".");
        if (pos === _GPF_NOT_FOUND) {
            return name;
        }
        return name.substring(_GPF_START, pos);
    }
993322
def path_type(path, target):
    
    if os.path.isfile(path) and target == "file":
        return True
    elif os.path.isdir(path) and target == "directory":
        return True
    else:
        print("Error: Path given is not a {}: {}".format(target, path))
    return False
1142076
private static String getTrimmedPath(String path) {
        String result = path;
        if (result.endsWith("/")) {
            result = result.substring(0, result.length() - 1);
        }
        return result;
    }
1127974
def lookup_path_direct(namespace, path, type)
      result = namespace.root? && validate(@registry.at(path), type)
      return result if result

      if path =~ /\A(#{separators_match})/
        return validate(@registry.at(namespace.path + path), type)
      end

      separators.each do |sep|
        result = validate(@registry.at(namespace.path + sep + path), type)
        return result if result
      end

      nil
    end
1046078
private static Path speculativeFastParsePath(String path) {
        String s = ConfigImplUtil.unicodeTrim(path);
        if (s.isEmpty())
            return null;
        if (hasUnsafeChars(s))
            return null;
        if (s.startsWith(".") || s.endsWith(".") || s.contains(".."))
            return null; // let the full parser throw the error

        PathBuilder pb = new PathBuilder();
        appendPathString(pb, s);
        return pb.result();
    }
937218
def guess(filename, fallback='application/octet-stream'):
    
    guessed, encoding = mimetypes.guess_type(filename, strict=False)
    if guessed is None:
        return fallback, encoding
    return guessed, encoding
301068
function matches (path) {
      if (type(ignores) === TYPES.STRING) {
        return path.search(ignores) > -1;
      } else if (type(ignores) === TYPES.REGEXP) {
        return ignores.test(path);
      } else {
        return ignores.some(function (ignore) {
          return type(ignore) === TYPES.STRING ? (path.search(ignore) > -1) : ignore.test(path);
        });
      }
    }
772677
function underlineTypeVars(typeInfo, valuesByPath) {
    //  Note: Sorting these keys lexicographically is not "correct", but it
    //  does the right thing for indexes less than 10.
    var paths = Z.map (JSON.parse, sortedKeys (valuesByPath));
    return underline (
      typeInfo,
      K (K (_)),
      function(index) {
        return function(f) {
          return function(t) {
            return function(propPath) {
              var indexedPropPath = Z.concat ([index], propPath);
              return function(s) {
                if (paths.some (isPrefix (indexedPropPath))) {
                  var key = JSON.stringify (indexedPropPath);
                  if (!(hasOwnProperty.call (valuesByPath, key))) return s;
                  if (!(isEmpty (valuesByPath[key]))) return f (s);
                }
                return _ (s);
              };
            };
          };
        };
      }
    );
  }
1357285
def guess_path_encoding(file_path, default=DEFAULT_ENCODING):
    """"""
    with io.open(file_path, 'rb') as fh:
        return guess_file_encoding(fh, default=default)
653972
def path(string):
        
        if not os.path.exists(string):
            msg = "Path %s not found!" % string
            raise ArgumentTypeError(msg)
        return string
550054
def _get_path_for_type(type_):
    """"""
    if type_.lower() in CORE_TYPES:
        return Path('index.html#%s' % type_.lower())
    elif '.' in type_:
        namespace, name = type_.split('.')
        return Path('types', namespace, _get_file_name(name))
    else:
        return Path('types',  _get_file_name(type_))
643216
def load_path(self, path):
        
        logger.debug("load_path(path=%s)" % path)
        if os.path.isfile(path):
            configtype = self.guess_type(path)
            logger.debug("Detected config type: %s" % self._type_to_str(configtype))
            if configtype in self.TYPES:
                logger.debug("Opening config for reading")
                with open(path, 'r') as f:
                    data = f.read()
                datadict = self.TYPES[configtype]().reverse(data)
                return self.load_data(datadict)
            else:
                raise ValueError("Unsupported config type")
        else:
            logger.warn("load_path couldn't find the path: %s" % path)
1156226
function(fsPath, strict) {
		if (!_.isString(fsPath)) {
			throw new TypeError('path must be of type string');
		}
		return fsPath === module.exports.reformatPath(fsPath, strict);
	}