Skip to content
This repository was archived by the owner on Mar 8, 2020. It is now read-only.

Commit e1ae01d

Browse files
author
Juanjo Alvarez
committed
Remove brackets from comments in the same line
Signed-off-by: Juanjo Alvarez <[email protected]>
1 parent 6629fad commit e1ae01d

File tree

2 files changed

+8
-119
lines changed

2 files changed

+8
-119
lines changed

.gitignore

Lines changed: 2 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -1,111 +1,2 @@
1-
# Byte-compiled / optimized / DLL files
2-
__pycache__/
3-
*.py[cod]
4-
*$py.class
5-
6-
# C extensions
7-
*.so
8-
9-
# Distribution / packaging
10-
.Python
11-
env/
12-
build/
13-
develop-eggs/
14-
dist/
15-
downloads/
16-
eggs/
17-
.eggs/
18-
lib/
19-
lib64/
20-
parts/
21-
sdist/
22-
var/
23-
*.egg-info/
24-
.installed.cfg
25-
*.egg
26-
27-
# PyInstaller
28-
# Usually these files are written by a python script from a template
29-
# before PyInstaller builds the exe, so as to inject date/other infos into it.
30-
*.manifest
31-
*.spec
32-
33-
# Installer logs
34-
pip-log.txt
35-
pip-delete-this-directory.txt
36-
37-
# Unit test / coverage reports
38-
htmlcov/
39-
.tox/
40-
.coverage
41-
.coverage.*
42-
.cache
43-
nosetests.xml
44-
coverage.xml
45-
*,cover
46-
.hypothesis/
47-
48-
# Translations
49-
*.mo
50-
*.pot
51-
52-
# Django stuff:
53-
*.log
54-
local_settings.py
55-
56-
# Flask stuff:
57-
instance/
58-
.webassets-cache
59-
60-
# Scrapy stuff:
61-
.scrapy
62-
63-
# Sphinx documentation
64-
docs/_build/
65-
66-
# PyBuilder
67-
target/
68-
69-
# IPython Notebook
70-
.ipynb_checkpoints
71-
72-
# pyenv
73-
.python-version
74-
75-
# celery beat schedule file
76-
celerybeat-schedule
77-
78-
# dotenv
79-
.env
80-
81-
# virtualenv
82-
venv/
83-
ENV/
84-
85-
# Spyder project settings
86-
.spyderproject
87-
88-
# Rope project settings
89-
.ropeproject
90-
91-
.idea/*
92-
93-
test/nimcache/*
94-
test/sendmsg
95-
96-
# pycharm
97-
.idea/*
98-
99-
# virtualenv
100-
36env/*
101-
install.sh
102-
mypy/*
103-
104-
Dockerfile
105-
106-
.sdk/*
107-
driver/main
108-
main
109-
.local/*
110-
111-
.mypy_cache
1+
.sdk
2+
build

native/python_package/python_driver/astimprove.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -245,19 +245,17 @@ def _create_nooplines_list(startline: int, noops_previous: List[str]) -> List[No
245245
# finishing newline
246246
noops_sameline: List[Token] = [i for i in self.sameline_remainder_noops(node) if i]
247247

248-
joined_sameline = []
249-
for tok in noops_sameline:
250-
if tok.value.lstrip().startswith('\n'):
251-
joined_sameline.append(tok.value.lstrip()[1:])
252-
else:
253-
joined_sameline.append(tok.value)
248+
def new_noopline(s: str) -> Dict[str, str]:
249+
return {"ast_type": "NoopSameLine", "s": s}
250+
251+
noop_lines = [new_noopline(i.value.strip()) for i in noops_sameline]
254252

255253
if noops_sameline:
256254
node['noops_sameline'] = {
257255
"ast_type": "SameLineNoops",
258256
"lineno": node.get("lineno", 0),
259257
"col_offset": noops_sameline[0].start.col,
260-
"noop_line": joined_sameline,
258+
"noop_line": noop_lines,
261259
"end_lineno": node.get("lineno", 0),
262260
"end_col_offset": max(noops_sameline[-1].end.col, 1)
263261
}
@@ -464,7 +462,7 @@ def visit(self, node: Node, root: bool=False) -> VisitResult:
464462
visit_result["col_offset"] = max(visit_result.get("col_offset", 1) + 1, 1)
465463

466464
if "end_col_offset" in visit_result:
467-
visit_result["end_col_offset"] = max(visit_result["end_col_offset"], 1)
465+
visit_result["end_col_offset"] = max(visit_result["end_col_offset"] + 1, 1)
468466

469467
visit_result.pop('_fields', None)
470468
visit_result.pop('_attributes', None)

0 commit comments

Comments
 (0)