7
7
from pathlib import Path
8
8
from typing import Dict , List , MutableMapping , Optional
9
9
10
+ from bumpversion .config import DEFAULTS as DEFAULT_CONFIG
10
11
from bumpversion .config .models import FileChange
11
12
from bumpversion .exceptions import VersionNotFoundError
12
13
from bumpversion .ui import get_indented_logger
@@ -129,7 +130,7 @@ def write_file_contents(self, contents: str) -> None:
129
130
f .write (contents )
130
131
131
132
def _contains_change_pattern (
132
- self , search_expression : re .Pattern , raw_search_expression : str , version : Version , context : MutableMapping
133
+ self , search_expression : re .Pattern , raw_search_expression : str , version : Version
133
134
) -> bool :
134
135
"""
135
136
Does the file contain the change pattern?
@@ -138,7 +139,6 @@ def _contains_change_pattern(
138
139
search_expression: The compiled search expression
139
140
raw_search_expression: The raw search expression
140
141
version: The version to check, in case it's not the same as the original
141
- context: The context to use
142
142
143
143
Raises:
144
144
VersionNotFoundError: if the version number isn't present in this file.
@@ -155,7 +155,7 @@ def _contains_change_pattern(
155
155
# match instead. This is probably the case if environment variables are used.
156
156
157
157
# check whether `search` isn't customized
158
- search_pattern_is_default = self .file_change .search == self . version_config . search
158
+ search_pattern_is_default = self .file_change .search == DEFAULT_CONFIG [ " search" ]
159
159
160
160
if search_pattern_is_default and contains_pattern (re .compile (re .escape (version .original )), file_contents ):
161
161
# The original version is present, and we're not looking for something
@@ -195,7 +195,7 @@ def make_file_change(
195
195
search_for , raw_search_pattern = self .file_change .get_search_pattern (context )
196
196
replace_with = self .version_config .replace .format (** context )
197
197
198
- if not self ._contains_change_pattern (search_for , raw_search_pattern , current_version , context ):
198
+ if not self ._contains_change_pattern (search_for , raw_search_pattern , current_version ):
199
199
logger .dedent ()
200
200
return
201
201
0 commit comments