cpython: 35447332ab19 (original) (raw)

Mercurial > cpython

changeset 103402:35447332ab19

Issue #28038: Remove Tools/parser/com2ann.py and its unit test. Development is moving to https://github.com/ilevkivskyi/com2ann [#28038]

Guido van Rossum guido@dropbox.com
date Fri, 09 Sep 2016 09:06:11 -0700
parents 801634d3c105
children 57afe873e5bf
files Lib/test/test_tools/test_com2ann.py Tools/parser/com2ann.py
diffstat 2 files changed, 0 insertions(+), 568 deletions(-)[+] [-] Lib/test/test_tools/test_com2ann.py 260 Tools/parser/com2ann.py 308

line wrap: on

line diff

deleted file mode 100644 --- a/Lib/test/test_tools/test_com2ann.py +++ /dev/null @@ -1,260 +0,0 @@ -"""Tests for the com2ann.py script in the Tools/parser directory.""" - -import unittest -import test.support -import os -import re - -from test.test_tools import basepath, toolsdir, skip_if_missing - -skip_if_missing() - -parser_path = os.path.join(toolsdir, "parser") - -with test.support.DirsOnSysPath(parser_path):

- -class BaseTestCase(unittest.TestCase): -

- -class SimpleTestCase(BaseTestCase):

-

-

-

-

-

-

-

-

- -class BigTestCase(BaseTestCase):

-

- -crazy_code = """[](#l1.92) -# -- coding: utf-8 -- # this should not be spoiled -''' -Docstring here -''' - -import testmod -x = 5 #type : int # this one is OK -ttt \

-with foo(x==1) as f: #type: str

- -for i, j in my_inter(x=1): # type: ignore

- -x = y = z = 1 # type: int -x, y, z = [], [], [] # type: (List[int], List[int], List[str]) -class C: - -

-

- -

-lst[...] = \

-...)) # type: int # comment .. - -y = ... # type: int # comment ... -z = ... -#type: int - - -#DONE placement of annotation after target rather than before = - -TD.x[1] \

- -TD.y[1] =5 == 5# type: bool # one more here -F[G(x == y, - -# hm... -

-x = None#type:int #comment : None""" - -big_result = """[](#l1.149) -# -- coding: utf-8 -- # this should not be spoiled -''' -Docstring here -''' - -import testmod -x: int = 5 # this one is OK -ttt: Tuple[float, float, float] \

-with foo(x==1) as f: #type: str

- -for i, j in my_inter(x=1): # type: ignore

- -x = y = z = 1 # type: int -x, y, z = [], [], [] # type: (List[int], List[int], List[str]) -class C: - -

-

- -

-lst[...]: int = \

-...)) # comment .. - -y: int = ... # comment ... -z = ... -#type: int - - -#DONE placement of annotation after target rather than before = - -TD.x[1]: bool \

- -TD.y[1]: bool =5 == 5 # one more here -F[G(x == y, - -# hm... -

-x: int = None #comment : None""" - -big_result_ne = """[](#l1.206) -# -- coding: utf-8 -- # this should not be spoiled -''' -Docstring here -''' - -import testmod -x: int = 5 # this one is OK -ttt: Tuple[float, float, float] \

-with foo(x==1) as f: #type: str

- -for i, j in my_inter(x=1): # type: ignore

- -x = y = z = 1 # type: int -x, y, z = [], [], [] # type: (List[int], List[int], List[str]) -class C: - -

-

- -

-lst[...]: int \

- -y: int # comment ... -z = ... -#type: int - - -#DONE placement of annotation after target rather than before = - -TD.x[1]: bool \

- -TD.y[1]: bool =5 == 5 # one more here -F[G(x == y, - -# hm... -

-x: int #comment : None""" - -if name == 'main':

deleted file mode 100644 --- a/Tools/parser/com2ann.py +++ /dev/null @@ -1,308 +0,0 @@ -"""Helper module to tranlate 3.5 type comments to 3.6 variable annotations.""" -import re -import os -import ast -import argparse -import tokenize -from collections import defaultdict -from textwrap import dedent -from io import BytesIO - -all = ['com2ann', 'TYPE_COM'] - -TYPE_COM = re.compile(r'\s*#\stype\s:.$', flags=re.DOTALL) -TRAIL_OR_COM = re.compile(r'\s$|\s*#.*$', flags=re.DOTALL) - - -class _Data:

- - -def skip_blank(d, lno):

- - -def find_start(d, lcom):

- - -def check_target(stmt):

- - -def find_eq(d, lstart):

- - -def find_val(d, poseq):

- - -def find_targ(d, poseq):

- - -def trim(new_lines, string, ltarg, poseq, lcom, ccom):

-

-

-

- - -def _com2ann(d, drop_None, drop_Ellipsis):

-

-

-

-

-

- - -def com2ann(code, *, drop_None=False, drop_Ellipsis=False, silent=False):

-

-

-

-

-

-

-

-

-

-

-

-

- - -def translate_file(infile, outfile, dnone, dell, silent):

- - -if name == 'main': -

-