<commit_before>/*
 * Copyright 2000-2014 JetBrains s.r.o.
 *
 * 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.
 */
package git4idea.test;

import com.intellij.mock.MockVirtualFileSystem;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.fileTypes.FileTypes;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileSystem;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

/**
 * VirtualFile implementation for tests based on {@link java.io.File}.
 * Not reusing {@link com.intellij.mock.MockVirtualFile}, because the latter holds everything in memory, which is fast, but requires
 * synchronization with the real file system.
 */
public class MockVirtualFile extends VirtualFile {

  private static final VirtualFileSystem ourFileSystem = new MockVirtualFileSystem();

  private final String myPath;

  @NotNull
  static VirtualFile fromPath(@NotNull String absolutePath) {
    return new MockVirtualFile(FileUtil.toSystemIndependentName(absolutePath));
  }

  @NotNull
  static VirtualFile fromPath(@NotNull String relativePath, @NotNull Project project) {
    try {
      return fromPath(new File(project.getBaseDir().getPath() + "/" + relativePath).getCanonicalPath());
    }
    catch (IOException e) {
      throw new RuntimeException(e);
    }
  }

  @NotNull
  static VirtualFile fromPath(@NotNull String relativePath, @NotNull String basePath) {
    try {
      return fromPath(new File(basePath + "/" + relativePath).getCanonicalPath());
    }
    catch (IOException e) {
      throw new RuntimeException(e);
    }
  }

  public MockVirtualFile(@NotNull String path) {
    myPath = FileUtil.toSystemIndependentName(path);
  }

  @NotNull
  @Override<commit_msg>[git tests] remove unused methods<commit_after>/*
 * Copyright 2000-2014 JetBrains s.r.o.
 *
 * 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.
 */
package git4idea.test;

import com.intellij.mock.MockVirtualFileSystem;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.fileTypes.FileTypes;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileSystem;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.io.File;
import java.io.InputStream;
import java.io.OutputStream;

/**
 * VirtualFile implementation for tests based on {@link java.io.File}.
 * Not reusing {@link com.intellij.mock.MockVirtualFile}, because the latter holds everything in memory, which is fast, but requires
 * synchronization with the real file system.
 */
public class MockVirtualFile extends VirtualFile {

  private static final VirtualFileSystem ourFileSystem = new MockVirtualFileSystem();

  private final String myPath;

  public MockVirtualFile(@NotNull String path) {
    myPath = FileUtil.toSystemIndependentName(path);
  }

  @NotNull
  @Override
{'fraction_non_alphanumeric': 0.08829915560916768, 'fraction_numerical': 0.006272617611580217, 'mean_word_length': 4.513297872340425, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '4040931', 'n_tokens_mistral': 1173, 'n_tokens_neox': 1133, 'n_words': 378}