Skip to content

Commit

Permalink
New distribution [0.3.4]
Browse files Browse the repository at this point in the history
 * polished code insertion allocation
  • Loading branch information
JarryShaw committed Nov 8, 2019
1 parent a70c9c6 commit afd54fc
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 7 deletions.
33 changes: 31 additions & 2 deletions poseur.py
Expand Up @@ -31,7 +31,7 @@
del multiprocessing

# version string
__version__ = '0.3.3'
__version__ = '0.3.4'

# from configparser
BOOLEAN_STATES = {'1': True, '0': False,
Expand Down Expand Up @@ -501,6 +501,33 @@ def find_poseur(node, root=0):
return -1


def check_suffix(string):
"""Strip comments from string.
Args:
- `string` -- `str`, buffer string
Returns:
- `str` -- prefix comments
- `str` -- suffix strings
"""
prefix = ''
suffix = ''

lines = iter(string.splitlines(True))
for line in lines:
if line.strip().startswith('#'):
prefix += line
continue
suffix += line
break

for line in lines:
suffix += line
return prefix, suffix


def process_module(node):
"""Walk top nodes of the AST module.
Expand All @@ -524,7 +551,9 @@ def process_module(node):
if index < postmt:
prefix += walk(child)
else:
suffix += walk(child)
bufpre, bufsuf = check_suffix(walk(child))
prefix += bufpre
suffix += bufsuf

if postmt >= 0:
POSEUR_LINESEP = os.getenv('POSEUR_LINESEP', os.linesep)
Expand Down
2 changes: 1 addition & 1 deletion scripts/setup.pypi.py
Expand Up @@ -15,7 +15,7 @@
long_desc = file.read()

# version string
__version__ = '0.3.3'
__version__ = '0.3.4'

# set-up script for pip distribution
setup(
Expand Down
2 changes: 1 addition & 1 deletion scripts/setup.pypitest.py
Expand Up @@ -15,7 +15,7 @@
long_desc = file.read()

# version string
__version__ = '0.3.3'
__version__ = '0.3.4'

# set-up script for pip distribution
setup(
Expand Down
2 changes: 1 addition & 1 deletion share/poseur.1
@@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH POSEUR 1 "October 29, 2019" "v0.3.3" ""
.TH POSEUR 1 "November 08, 2019" "v0.3.4" ""
.SH NAME
poseur \- back-port compiler for Python 3.8 positional-only parameter syntax
.
Expand Down
4 changes: 2 additions & 2 deletions share/poseur.rst
Expand Up @@ -6,8 +6,8 @@ poseur
back-port compiler for Python 3.8 positional-only parameter syntax
------------------------------------------------------------------

:Version: v0.3.3
:Date: October 29, 2019
:Version: v0.3.4
:Date: November 08, 2019
:Manual section: 1
:Author:
Jarry Shaw, a newbie programmer, is the author, owner and maintainer
Expand Down

0 comments on commit afd54fc

Please sign in to comment.