From b1a79aa01b4137b97caff0c8eeaccd08519f3b13 Mon Sep 17 00:00:00 2001 From: Saran Tunyasuvunakool Date: Fri, 23 Sep 2022 16:58:09 -0700 Subject: [PATCH] Replace internal-only imports and comments that aren't valid externally. PiperOrigin-RevId: 476492651 Change-Id: I310a21a73a65da3a5939f5cb8a1c8a67c8595863 --- introspect/ast_nodes_test.py | 2 +- introspect/codegen/generate_enums.py | 8 ++++---- introspect/codegen/generate_functions.py | 18 +++++++++--------- introspect/enums_test.py | 2 +- introspect/functions_test.py | 6 +++--- introspect/type_parsing.py | 2 +- introspect/type_parsing_test.py | 4 ++-- test/benchmark/run_ablation.py | 8 +------- 8 files changed, 22 insertions(+), 28 deletions(-) diff --git a/introspect/ast_nodes_test.py b/introspect/ast_nodes_test.py index 787dd8db..c45f5197 100644 --- a/introspect/ast_nodes_test.py +++ b/introspect/ast_nodes_test.py @@ -16,7 +16,7 @@ from absl.testing import absltest -from google3.third_party.mujoco.introspect import ast_nodes +from . import ast_nodes class AstNodesTest(absltest.TestCase): diff --git a/introspect/codegen/generate_enums.py b/introspect/codegen/generate_enums.py index e5744383..20f7d54f 100644 --- a/introspect/codegen/generate_enums.py +++ b/introspect/codegen/generate_enums.py @@ -15,7 +15,7 @@ """Generates enums.py. The JSON input can be generated via: - clang -Xclang -ast-dump=json -fsyntax-only -fparse-all-comments mujoco.h + clang -Xclang -ast-dump=json -fsyntax-only -fparse-all-comments -x c mujoco.h """ import json @@ -24,8 +24,8 @@ from typing import Any, Mapping, Sequence from absl import app from absl import flags -from google3.third_party.mujoco.introspect import ast_nodes -from google3.third_party.mujoco.introspect.codegen import formatter +from introspect import ast_nodes +from . import formatter FLAGS = flags.FLAGS flags.DEFINE_string( @@ -116,7 +116,7 @@ DO NOT EDIT. THIS FILE IS AUTOMATICALLY GENERATED. from typing import Mapping -from google3.third_party.mujoco.introspect.ast_nodes import EnumDecl +from .ast_nodes import EnumDecl ENUMS: Mapping[str, EnumDecl] = {enums_str} '''.strip()) # `print` adds a trailing newline diff --git a/introspect/codegen/generate_functions.py b/introspect/codegen/generate_functions.py index 4e843c31..6cdf1589 100644 --- a/introspect/codegen/generate_functions.py +++ b/introspect/codegen/generate_functions.py @@ -15,7 +15,7 @@ """Generates functions.py. The JSON input can be generated via: - clang -Xclang -ast-dump=json -fsyntax-only -fparse-all-comments mujoco.h + clang -Xclang -ast-dump=json -fsyntax-only -fparse-all-comments -x c mujoco.h """ import json @@ -24,9 +24,9 @@ from typing import Any, Mapping, Sequence from absl import app from absl import flags -from google3.third_party.mujoco.introspect import ast_nodes -from google3.third_party.mujoco.introspect import type_parsing -from google3.third_party.mujoco.introspect.codegen import formatter +from introspect import ast_nodes +from introspect import type_parsing +from . import formatter FLAGS = flags.FLAGS flags.DEFINE_string('header_path', None, 'Path to the original mujoco.h') @@ -145,11 +145,11 @@ DO NOT EDIT. THIS FILE IS AUTOMATICALLY GENERATED. from typing import Mapping -from google3.third_party.mujoco.introspect.ast_nodes import ArrayType -from google3.third_party.mujoco.introspect.ast_nodes import FunctionDecl -from google3.third_party.mujoco.introspect.ast_nodes import FunctionParameterDecl -from google3.third_party.mujoco.introspect.ast_nodes import PointerType -from google3.third_party.mujoco.introspect.ast_nodes import ValueType +from .ast_nodes import ArrayType +from .ast_nodes import FunctionDecl +from .ast_nodes import FunctionParameterDecl +from .ast_nodes import PointerType +from .ast_nodes import ValueType FUNCTIONS: Mapping[str, FunctionDecl] = {functions_str} '''.strip()) # `print` adds a trailing newline diff --git a/introspect/enums_test.py b/introspect/enums_test.py index 99cebf1b..2f017281 100644 --- a/introspect/enums_test.py +++ b/introspect/enums_test.py @@ -16,7 +16,7 @@ from absl.testing import absltest -from google3.third_party.mujoco.introspect import enums +from . import enums class EnumsTest(absltest.TestCase): diff --git a/introspect/functions_test.py b/introspect/functions_test.py index 0f521c04..2e3985b9 100644 --- a/introspect/functions_test.py +++ b/introspect/functions_test.py @@ -16,9 +16,9 @@ from absl.testing import absltest -from google3.third_party.mujoco.introspect import ast_nodes -from google3.third_party.mujoco.introspect import functions -from google3.third_party.mujoco.introspect import type_parsing +from . import ast_nodes +from . import functions +from . import type_parsing class FunctionsTest(absltest.TestCase): diff --git a/introspect/type_parsing.py b/introspect/type_parsing.py index 0906e2a9..612708fb 100644 --- a/introspect/type_parsing.py +++ b/introspect/type_parsing.py @@ -18,7 +18,7 @@ import collections import re from typing import Mapping, MutableSequence, Optional, Sequence, Tuple, Union -from google3.third_party.mujoco.introspect import ast_nodes +from . import ast_nodes ARRAY_EXTENTS_PATTERN = re.compile(r'(\[[^\]]+\]\s*)+\Z') ARRAY_N_PATTERN = re.compile(r'\[([^\]]+)\]') diff --git a/introspect/type_parsing_test.py b/introspect/type_parsing_test.py index 815fa20b..c7d0bdc2 100644 --- a/introspect/type_parsing_test.py +++ b/introspect/type_parsing_test.py @@ -16,8 +16,8 @@ from absl.testing import absltest -from google3.third_party.mujoco.introspect import ast_nodes -from google3.third_party.mujoco.introspect import type_parsing +from . import ast_nodes +from . import type_parsing class TypeParsingTest(absltest.TestCase): diff --git a/test/benchmark/run_ablation.py b/test/benchmark/run_ablation.py index 4b37aa70..d229869c 100755 --- a/test/benchmark/run_ablation.py +++ b/test/benchmark/run_ablation.py @@ -13,13 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""A script for running step_benchmark_test for a variety of build settings. - -This is not meant to be run in google3, but in the git repository's root. - -This will be used for release 2.1.1, and adapted for future use when more -decisions about the build need to be made. -""" +"""A script for running step_benchmark_test for a variety of build settings.""" import argparse import os