<commit_before># -*- Python -*-


# Given a source file, generate a test name.
# i.e. "common_runtime/direct_session_test.cc" becomes
#      "common_runtime_direct_session_test"
def src_to_test_name(src):
  return src.replace("/", "_").split(".")[0]


# Return the options to use for a C++ library or binary build.
# Uses the ":optmode" config_setting to pick the options.
load(
    "//tensorflow/core:platform/default/build_config_root.bzl",
    "tf_cuda_tests_tags",
    "tf_sycl_tests_tags",
    "tf_additional_xla_deps_py",)
load("@local_config_cuda//cuda:build_defs.bzl", "if_cuda", "cuda_default_copts")

load(
    "//third_party/mkl:build_defs.bzl",
    "if_mkl",)


# List of proto files for android builds
def tf_android_core_proto_sources(core_proto_sources_relative):
  return [
      "//tensorflow/core:" + p for p in core_proto_sources_relative
  ]


# Returns the list of pb.h and proto.h headers that are generated for
# tf_android_core_proto_sources().
def tf_android_core_proto_headers(core_proto_sources_relative):
  return ([
      "//tensorflow/core/" + p.replace(".proto", ".pb.h")
      for p in core_proto_sources_relative
  ] + [
      "//tensorflow/core/" + p.replace(".proto", ".proto.h")
      for p in core_proto_sources_relative
  ])


# Sanitize a dependency so that it works correctly from code that includes
# TensorFlow as a submodule.
def clean_dep(dep):
  return str(Label(dep))


def if_android_x86(a):
  return select({
      clean_dep("//tensorflow:android_x86"): a,
      clean_dep("//tensorflow:android_x86_64"): a,
      "//conditions:default": [],
  })


def if_android_arm(a):
  return select({
      clean_dep("//tensorflow:android_arm"): a,
      "//conditions:default": [],
  })


def if_android_arm64(a):
  return select({
      clean_dep("//tensorflow:android_arm64"): a,
      "//conditions:default": [],
  })


def if_not_android(a):
  return select({
      clean_dep("//tensorflow:android"): [],
      "//conditions:default": a,
  })


def if_android(a):
  return select({
      clean_dep("//tensorflow:android"): a,
      "//conditions:default": [],
  })


def if_ios(a):
  return select({
      clean_dep("//tensorflow:ios"): a,
      "//conditions:default": [],
  })


def if_mobile(a):
  return select({
      clean_dep("//tensorflow:android"): a,
      clean_dep("//tensorflow:ios"): a,
      "//conditions:default": [],
  })


def if_not_mobile(a):
  return select({
      clean_dep("//tensorflow:android"): [],
      clean_dep("//tensorflow:ios"): [],
      "//conditions:default": a,
  })


def if_not_windows(a):
  return select({
      clean_dep("//tensorflow:windows"): [],
      "//conditions:default": a,
  })


def if_x86(a):
  return select({
      clean_dep("//tensorflow:linux_x86_64"): a,
      clean_dep("//tensorflow:windows"): a,
      "//conditions:default": [],
  })

def if_darwin(a):
  return select({
      "//tensorflow:darwin": a,
      "//conditions:default": [],
  })

# LINT.IfChange
def tf_copts():
  return ([
      "-DEIGEN_AVOID_STL_ARRAY",
      "-Iexternal/gemmlowp",
      "-Wno-sign-compare",
      "-fno-exceptions",
  ] + if_cuda(["-DGOOGLE_CUDA=1"]) + if_mkl(["-DINTEL_MKL=1"]) + if_android_arm(
      ["-mfpu=neon"]) + if_x86(["-msse3"]) + select({
          clean_dep("//tensorflow:android"): [
              "-std=c++11",
              "-DTF_LEAN_BINARY",
              "-O2",
          ],
          clean_dep("//tensorflow:darwin"): [],
          clean_dep("//tensorflow:windows"): [
              "/DLANG_CXX11",
              "/D__VERSION__=\\\"MSVC\\\"",
              "/DPLATFORM_WINDOWS",
              "/DTF_COMPILE_LIBRARY",
              "/DEIGEN_HAS_C99_MATH",
              "/DTENSORFLOW_USE_EIGEN_THREADPOOL",<commit_msg>add `clean_dep` to the call<commit_after># -*- Python -*-


# Given a source file, generate a test name.
# i.e. "common_runtime/direct_session_test.cc" becomes
#      "common_runtime_direct_session_test"
def src_to_test_name(src):
  return src.replace("/", "_").split(".")[0]


# Return the options to use for a C++ library or binary build.
# Uses the ":optmode" config_setting to pick the options.
load(
    "//tensorflow/core:platform/default/build_config_root.bzl",
    "tf_cuda_tests_tags",
    "tf_sycl_tests_tags",
    "tf_additional_xla_deps_py",)
load("@local_config_cuda//cuda:build_defs.bzl", "if_cuda", "cuda_default_copts")

load(
    "//third_party/mkl:build_defs.bzl",
    "if_mkl",)


# List of proto files for android builds
def tf_android_core_proto_sources(core_proto_sources_relative):
  return [
      "//tensorflow/core:" + p for p in core_proto_sources_relative
  ]


# Returns the list of pb.h and proto.h headers that are generated for
# tf_android_core_proto_sources().
def tf_android_core_proto_headers(core_proto_sources_relative):
  return ([
      "//tensorflow/core/" + p.replace(".proto", ".pb.h")
      for p in core_proto_sources_relative
  ] + [
      "//tensorflow/core/" + p.replace(".proto", ".proto.h")
      for p in core_proto_sources_relative
  ])


# Sanitize a dependency so that it works correctly from code that includes
# TensorFlow as a submodule.
def clean_dep(dep):
  return str(Label(dep))


def if_android_x86(a):
  return select({
      clean_dep("//tensorflow:android_x86"): a,
      clean_dep("//tensorflow:android_x86_64"): a,
      "//conditions:default": [],
  })


def if_android_arm(a):
  return select({
      clean_dep("//tensorflow:android_arm"): a,
      "//conditions:default": [],
  })


def if_android_arm64(a):
  return select({
      clean_dep("//tensorflow:android_arm64"): a,
      "//conditions:default": [],
  })


def if_not_android(a):
  return select({
      clean_dep("//tensorflow:android"): [],
      "//conditions:default": a,
  })


def if_android(a):
  return select({
      clean_dep("//tensorflow:android"): a,
      "//conditions:default": [],
  })


def if_ios(a):
  return select({
      clean_dep("//tensorflow:ios"): a,
      "//conditions:default": [],
  })


def if_mobile(a):
  return select({
      clean_dep("//tensorflow:android"): a,
      clean_dep("//tensorflow:ios"): a,
      "//conditions:default": [],
  })


def if_not_mobile(a):
  return select({
      clean_dep("//tensorflow:android"): [],
      clean_dep("//tensorflow:ios"): [],
      "//conditions:default": a,
  })


def if_not_windows(a):
  return select({
      clean_dep("//tensorflow:windows"): [],
      "//conditions:default": a,
  })


def if_x86(a):
  return select({
      clean_dep("//tensorflow:linux_x86_64"): a,
      clean_dep("//tensorflow:windows"): a,
      "//conditions:default": [],
  })

def if_darwin(a):
  return select({
      clean_dep("//tensorflow:darwin"): a,
      "//conditions:default": [],
  })

# LINT.IfChange
def tf_copts():
  return ([
      "-DEIGEN_AVOID_STL_ARRAY",
      "-Iexternal/gemmlowp",
      "-Wno-sign-compare",
      "-fno-exceptions",
  ] + if_cuda(["-DGOOGLE_CUDA=1"]) + if_mkl(["-DINTEL_MKL=1"]) + if_android_arm(
      ["-mfpu=neon"]) + if_x86(["-msse3"]) + select({
          clean_dep("//tensorflow:android"): [
              "-std=c++11",
              "-DTF_LEAN_BINARY",
              "-O2",
          ],
          clean_dep("//tensorflow:darwin"): [],
          clean_dep("//tensorflow:windows"): [
              "/DLANG_CXX11",
              "/D__VERSION__=\\\"MSVC\\\"",
              "/DPLATFORM_WINDOWS",
              "/DTF_COMPILE_LIBRARY",
              "/DEIGEN_HAS_C99_MATH",
              "/DTENSORFLOW_USE_EIGEN_THREADPOOL",
{'fraction_non_alphanumeric': 0.1697180275290659, 'fraction_numerical': 0.008285447013229988, 'mean_word_length': 3.0345013477088947, 'pattern_counts': {'":': 25, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '7118200', 'n_tokens_mistral': 2678, 'n_tokens_neox': 2628, 'n_words': 455}