Skip to content

Commit 6b03ea5

Browse files
authored
fix utf8 header in documentation (#8)
1 parent 71777ff commit 6b03ea5

File tree

13 files changed

+6
-24
lines changed

13 files changed

+6
-24
lines changed

README.md

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
31
<p align="center">
42
<img src="https://ucloud-sdk.dl.ufileos.com/logos%2Flogo-mini.png" />
53
</p>

docs/core.rst

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
31
Core
42
====
53

docs/helpers.rst

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
31
Helpers
42
=======
53

docs/index.rst

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
31
UCloud SDK Python 2
42
===================
53

docs/quick_start.rst

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
31
QuickStart
42
==========
53

docs/services.rst

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
31
UCloud SDK Services
42
===================
53

docs/usage.rst

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
31
Usage
42
=====
53

examples/two-tier/README.md

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
31
# UCloud SDK Two-Tier Example
42

53
## What is the goal

examples/uhost/README.md

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
31
# UCloud SDK UHost Example
42

53
## What is the goal

scripts/migrate/_migrate.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ class Config:
2525

2626

2727
class Migrate(object):
28-
UTF8_HEADER = '# -*- coding: utf-8 -*-\n\n'
29-
3028
default_plugins_classes = {
3129
"py3to2": SDK3to2Transformer,
3230
"doc": DocTransformer,
@@ -79,7 +77,7 @@ def run(self, source_path: str, output_path: str):
7977
# convert destination code
8078
output_code = source_code
8179
for plugin in plugins:
82-
output_code = self.UTF8_HEADER + plugin.convert(source_code)
80+
output_code = plugin.convert(source_code)
8381

8482
# output to file
8583
os.makedirs(os.path.dirname(result_path), exist_ok=True)

scripts/migrate/_plugin_py3to2.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55

66
class SDK3to2Transformer(ast.NodeTransformer):
7+
UTF8_HEADER = '# -*- coding: utf-8 -*-\n\n'
8+
79
def visit_Import(self, node):
810
is_typing = [alias for alias in node.names if alias.name == 'typing']
911
return None if is_typing else node
@@ -56,4 +58,4 @@ def visit_ClassDef(self, node):
5658
def convert(self, source: str) -> str:
5759
ast_node = ast.parse(source)
5860
ast_node = self.visit(ast_node)
59-
return astor.to_source(ast_node)
61+
return self.UTF8_HEADER + astor.to_source(ast_node)

tests/test_testing/test_utest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66

77
@pytest.mark.skipif(env.is_ut(), reason=env.get_skip_reason())
8-
def test_acc_pre_check(client):
8+
def test_acc_pre_check(self, client):
99
assert str(client)
1010
assert client.config.to_dict()
1111
assert client.credential.to_dict()

ucloud/core/utils/compat.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
else:
1111
import types
1212

13-
str = unicode
13+
str = unicode # noqa: F821
1414
string_types = types.StringTypes
1515
from collections import Callable

0 commit comments

Comments
 (0)