Skip to content

Commit fbe4d2c

Browse files
committed
update
1 parent e13e497 commit fbe4d2c

File tree

10 files changed

+26
-70
lines changed

10 files changed

+26
-70
lines changed

gazelle/python/file_parser_test.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,6 @@ func TestParseImportStatements(t *testing.T) {
132132
LineNumber: 2,
133133
From: "foo",
134134
},
135-
{
136-
Name: ".abc",
137-
LineNumber: 3,
138-
Filepath: "",
139-
From: "",
140-
},
141135
},
142136
},
143137
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# gazelle:python_generation_mode package

gazelle/python/testdata/resolve_deps_relative_imports/BUILD.out

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
load("@rules_python//python:defs.bzl", "py_binary")
22

3+
# gazelle:python_generation_mode package
4+
35
py_binary(
46
name = "resolve_deps_relative_imports_bin",
57
srcs = ["__main__.py"],

gazelle/python/testdata/resolve_deps_relative_imports/__main__.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,3 @@
1-
# Copyright 2023 The Bazel Authors. All rights reserved.
2-
#
3-
# Licensed under the Apache License, Version 2.0 (the "License");
4-
# you may not use this file except in compliance with the License.
5-
# You may obtain a copy of the License at
6-
#
7-
# http://www.apache.org/licenses/LICENSE-2.0
8-
#
9-
# Unless required by applicable law or agreed to in writing, software
10-
# distributed under the License is distributed on an "AS IS" BASIS,
11-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
# See the License for the specific language governing permissions and
13-
# limitations under the License.
14-
151
from package1.module1 import function1
162
from package2.module3 import function3
173

gazelle/python/testdata/resolve_deps_relative_imports/package2/BUILD.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ py_library(
88
"module4.py",
99
],
1010
visibility = ["//:__subpackages__"],
11-
deps = ["//package2/subpackage1"],
11+
deps = ["//package2/library"],
1212
)
Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
1-
# Copyright 2023 The Bazel Authors. All rights reserved.
2-
#
3-
# Licensed under the Apache License, Version 2.0 (the "License");
4-
# you may not use this file except in compliance with the License.
5-
# You may obtain a copy of the License at
6-
#
7-
# http://www.apache.org/licenses/LICENSE-2.0
8-
#
9-
# Unless required by applicable law or agreed to in writing, software
10-
# distributed under the License is distributed on an "AS IS" BASIS,
11-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
# See the License for the specific language governing permissions and
13-
# limitations under the License.
14-
15-
16-
class Class1:
17-
def method1(self):
18-
return "method1"
1+
from .library import add as _add
2+
from .library import divide as _divide
3+
from .library import multiply as _multiply
4+
from .library import subtract as _subtract
5+
6+
7+
def add(a, b):
8+
return _add(a, b)
9+
10+
11+
def divide(a, b):
12+
return _divide(a, b)
13+
14+
15+
def multiply(a, b):
16+
return _multiply(a, b)
17+
18+
19+
def subtract(a, b):
20+
return _subtract(a, b)

gazelle/python/testdata/resolve_deps_relative_imports/package2/module3.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@
1313
# limitations under the License.
1414

1515

16-
from . import Class1
17-
from .subpackage1.module5 import function5
16+
from .library import function5
1817

1918

2019
def function3():
21-
c1 = Class1()
22-
return "function3 " + c1.method1() + " " + function5()
20+
return "function3 " + function5()

gazelle/python/testdata/resolve_deps_relative_imports/package2/subpackage1/BUILD.in

Whitespace-only changes.

gazelle/python/testdata/resolve_deps_relative_imports/package2/subpackage1/BUILD.out

Lines changed: 0 additions & 8 deletions
This file was deleted.

gazelle/python/testdata/resolve_deps_relative_imports/package2/subpackage1/module5.py

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)