mirror of
https://github.com/TECHNOFAB11/bumpver.git
synced 2025-12-12 14:30:09 +01:00
fmt lint etc. pp.
This commit is contained in:
parent
75563672b4
commit
31f9d51bf3
7 changed files with 32 additions and 16 deletions
|
|
@ -15,14 +15,15 @@ import logging
|
|||
import subprocess as sp
|
||||
|
||||
import click
|
||||
import pycalver2.version as v2version
|
||||
|
||||
import pycalver.cli as v1cli
|
||||
import pycalver2.cli as v2cli
|
||||
import pycalver.version as v1version
|
||||
import pycalver2.version as v2version
|
||||
from pycalver import vcs
|
||||
from pycalver import config
|
||||
|
||||
# import pycalver2.cli as v2cli
|
||||
|
||||
_VERBOSE = 0
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,9 @@ def iter_file_paths(
|
|||
|
||||
|
||||
def rewrite_lines(
|
||||
pattern_strs: typ.List[str], new_vinfo: version.VersionInfo, old_lines: typ.List[str]
|
||||
pattern_strs: typ.List[str],
|
||||
new_vinfo : version.VersionInfo,
|
||||
old_lines : typ.List[str],
|
||||
) -> typ.List[str]:
|
||||
"""Replace occurances of pattern_strs in old_lines with new_vinfo.
|
||||
|
||||
|
|
@ -112,7 +114,9 @@ def rewrite_lines(
|
|||
|
||||
|
||||
def rfd_from_content(
|
||||
pattern_strs: typ.List[str], new_vinfo: version.VersionInfo, content: str
|
||||
pattern_strs: typ.List[str],
|
||||
new_vinfo : version.VersionInfo,
|
||||
content : str,
|
||||
) -> RewrittenFileData:
|
||||
r"""Rewrite pattern occurrences with version string.
|
||||
|
||||
|
|
@ -137,7 +141,8 @@ def rfd_from_content(
|
|||
|
||||
|
||||
def iter_rewritten(
|
||||
file_patterns: config.PatternsByGlob, new_vinfo: version.VersionInfo
|
||||
file_patterns: config.PatternsByGlob,
|
||||
new_vinfo : version.VersionInfo,
|
||||
) -> typ.Iterable[RewrittenFileData]:
|
||||
r'''Iterate over files with version string replaced.
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import logging
|
|||
|
||||
import pycalver2.rewrite as v2rewrite
|
||||
import pycalver2.version as v2version
|
||||
|
||||
from pycalver import config
|
||||
|
||||
logger = logging.getLogger("pycalver2.cli")
|
||||
|
|
|
|||
|
|
@ -9,17 +9,20 @@ import io
|
|||
import typing as typ
|
||||
import logging
|
||||
|
||||
from pycalver2 import version
|
||||
from pycalver2 import patterns
|
||||
|
||||
from pycalver import parse
|
||||
from pycalver import config
|
||||
from pycalver import rewrite as v1rewrite
|
||||
from pycalver2 import version
|
||||
from pycalver2 import patterns
|
||||
|
||||
logger = logging.getLogger("pycalver2.rewrite")
|
||||
|
||||
|
||||
def rewrite_lines(
|
||||
pattern_strs: typ.List[str], new_vinfo: version.VersionInfo, old_lines: typ.List[str]
|
||||
pattern_strs: typ.List[str],
|
||||
new_vinfo : version.VersionInfo,
|
||||
old_lines : typ.List[str],
|
||||
) -> typ.List[str]:
|
||||
"""TODO reenable doctest"""
|
||||
pass
|
||||
|
|
@ -38,8 +41,10 @@ def rewrite_lines(
|
|||
new_lines = old_lines[:]
|
||||
found_patterns = set()
|
||||
|
||||
re_patterns = [patterns.compile_pattern(p) for p in pattern_strs]
|
||||
for match in parse.iter_matches(old_lines, re_patterns):
|
||||
# re_patterns = [patterns.compile_pattern(p) for p in pattern_strs]
|
||||
# matches = parse.iter_matches(old_lines, re_patterns)
|
||||
matches = parse.iter_matches(old_lines, pattern_strs)
|
||||
for match in matches:
|
||||
found_patterns.add(match.pattern)
|
||||
replacement = version.format_version(new_vinfo, match.pattern)
|
||||
span_l, span_r = match.span
|
||||
|
|
@ -58,7 +63,9 @@ def rewrite_lines(
|
|||
|
||||
|
||||
def rfd_from_content(
|
||||
pattern_strs: typ.List[str], new_vinfo: version.VersionInfo, content: str
|
||||
pattern_strs: typ.List[str],
|
||||
new_vinfo : version.VersionInfo,
|
||||
content : str,
|
||||
) -> v1rewrite.RewrittenFileData:
|
||||
"""TODO reenable doctest"""
|
||||
pass
|
||||
|
|
@ -86,7 +93,8 @@ def rfd_from_content(
|
|||
|
||||
|
||||
def iter_rewritten(
|
||||
file_patterns: config.PatternsByGlob, new_vinfo: version.VersionInfo
|
||||
file_patterns: config.PatternsByGlob,
|
||||
new_vinfo : version.VersionInfo,
|
||||
) -> typ.Iterable[v1rewrite.RewrittenFileData]:
|
||||
"""TODO reenable doctest"""
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@ import subprocess as sp
|
|||
|
||||
import pytest
|
||||
import pathlib2 as pl
|
||||
import pycalver2.patterns as patterns
|
||||
from click.testing import CliRunner
|
||||
|
||||
import pycalver.config as config
|
||||
import pycalver2.patterns as patterns
|
||||
from pycalver.__main__ import cli
|
||||
|
||||
SETUP_CFG_FIXTURE = """
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
import re
|
||||
|
||||
import pytest
|
||||
import pycalver2.patterns as v2patterns
|
||||
|
||||
import pycalver.patterns as v1patterns
|
||||
import pycalver2.patterns as v2patterns
|
||||
|
||||
# TODO (mb 2020-09-06): test for v2patterns
|
||||
|
||||
|
|
|
|||
|
|
@ -3,11 +3,12 @@
|
|||
import copy
|
||||
from test import util
|
||||
|
||||
from pycalver2 import rewrite as v2rewrite
|
||||
from pycalver2 import version as v2version
|
||||
|
||||
from pycalver import config
|
||||
from pycalver import rewrite as v1rewrite
|
||||
from pycalver import version as v1version
|
||||
from pycalver2 import rewrite as v2rewrite
|
||||
from pycalver2 import version as v2version
|
||||
|
||||
REWRITE_FIXTURE = """
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue