<commit_before>// Copyright 2015 <NAME>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// A (possibly updated) copy of of this software is available at
// https://github.com/cdaylward/pathname

#pragma once

#include <string>
#include <vector>
#include <sys/stat.h>


namespace pathname {


const char separator{'/'};


inline std::string trim_leading_slash(const std::string& path) {
  std::size_t pos;
  for (pos = 0; pos != std::string::npos && path[pos] == separator; pos++);
  return path.substr(pos);
}


inline std::string trim_trailing_slash(const std::string& path) {
  std::size_t pos;
  for (pos = path.length() - 1; pos != std::string::npos && path[pos] == separator; pos--);
  return path.substr(0, pos + 1);
}


inline std::string join(const std::string& first, const std::string& second) {
  if (first.empty()) return second;
  if (second.empty()) return first;
  return trim_trailing_slash(first) + separator + trim_leading_slash(second);
}


template<typename ...Path><commit_msg>3rdparty: Update pathname.<commit_after>// Copyright 2015 <NAME>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// A (possibly updated) copy of of this software is available at
// https://github.com/cdaylward/pathname

#pragma once

#include <string>
#include <vector>
#include <sys/stat.h>


namespace pathname {


const char separator{'/'};


inline std::string trim_leading_slash(const std::string& path) {
  std::size_t pos;
  for (pos = 0; path[pos] == separator; pos++);
  return path.substr(pos);
}


inline std::string trim_trailing_slash(const std::string& path) {
  std::size_t pos;
  for (pos = path.length() - 1; path[pos] == separator; pos--);
  return path.substr(0, pos + 1);
}


inline std::string join(const std::string& first, const std::string& second) {
  if (first.empty()) return second;
  if (second.empty()) return first;
  return trim_trailing_slash(first) + separator + trim_leading_slash(second);
}


template<typename ...Path>
{'fraction_non_alphanumeric': 0.13158778113460892, 'fraction_numerical': 0.008392077878482713, 'mean_word_length': 4.033783783783784, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7466361', 'n_tokens_mistral': 908, 'n_tokens_neox': 871, 'n_words': 329}