Skip to content

Commit bc4f85b

Browse files
authored
Update noqa syntax (#1734)
1 parent 892bd46 commit bc4f85b

25 files changed

+40
-40
lines changed

docs/samples/python/example_custom_lambda_anonymizer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ def anonymize_faker_lambda(analyzer_results, text_to_anonymize):
4646
analyzer = AnalyzerEngine()
4747
anonymizer = AnonymizerEngine()
4848

49-
text = "The user has the following two emails: email1@contoso.com and email2@contoso.com" # noqa E501
49+
text = "The user has the following two emails: email1@contoso.com and email2@contoso.com" # noqa: E501
5050
analyzer_results = analyzer.analyze(
5151
text=text, entities=["EMAIL_ADDRESS"], language="en"
5252
)
5353
print(f"Original Text: {text}")
5454
print(f"Analyzer result: {analyzer_results}\n")
5555

5656
print(
57-
f"Reverse lambda result: {anonymize_reverse_lambda(analyzer_results, text).text}" # noqa E501
57+
f"Reverse lambda result: {anonymize_reverse_lambda(analyzer_results, text).text}" # noqa: E501
5858
)
5959
print(f"Faker lambda result: {anonymize_faker_lambda(analyzer_results, text).text}")

presidio-analyzer/presidio_analyzer/context_aware_enhancers/lemma_context_aware_enhancer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def enhance_using_context(
6464
accuracy of the context enhancement process
6565
:param recognizers: the list of recognizers
6666
:param context: list of context words
67-
""" # noqa D205 D400
67+
""" # noqa: D205,D400
6868

6969
# create a deep copy of the results object, so we can manipulate it
7070
results = copy.deepcopy(raw_results)
@@ -245,7 +245,7 @@ def _find_index_of_match_token(
245245
word: str,
246246
start: int,
247247
tokens,
248-
tokens_indices: List[int], # noqa ANN001
248+
tokens_indices: List[int], # noqa: ANN001
249249
) -> int:
250250
found = False
251251
# we use the known start index of the original word to find the actual

presidio-analyzer/presidio_analyzer/nlp_engine/ner_model_configuration.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class NerModelConfiguration:
4646
Set of entity names that are likely to have low detection accuracy that should be adjusted.
4747
:param low_confidence_score_multiplier: A multiplier for the score given for low_score_entity_names.
4848
Multiplier to the score given for low_score_entity_names.
49-
""" # noqa E501
49+
""" # noqa: E501
5050

5151
labels_to_ignore: Optional[Collection[str]] = None
5252
aggregation_strategy: Optional[str] = "max"
@@ -113,8 +113,8 @@ def to_dict(self) -> Dict:
113113
"""Return the configuration as a dict."""
114114
return self.__dict__
115115

116-
def __str__(self) -> str: # noqa D105
116+
def __str__(self) -> str: # noqa: D105
117117
return str(self.to_dict())
118118

119-
def __repr__(self) -> str: # noqa D105
119+
def __repr__(self) -> str: # noqa: D105
120120
return str(self)

presidio-analyzer/presidio_analyzer/nlp_engine/nlp_artifacts.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def __init__(
2626
tokens: Doc,
2727
tokens_indices: List[int],
2828
lemmas: List[str],
29-
nlp_engine: "NlpEngine", # noqa F821
29+
nlp_engine: "NlpEngine", # noqa: F821
3030
language: str,
3131
scores: Optional[List[float]] = None,
3232
):
@@ -42,7 +42,7 @@ def __init__(
4242
def set_keywords(
4343
nlp_engine,
4444
lemmas: List[str],
45-
language: str, # noqa ANN001
45+
language: str, # noqa: ANN001
4646
) -> List[str]:
4747
"""
4848
Return keywords fpr text.

presidio-analyzer/presidio_analyzer/nlp_engine/nlp_engine.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def process_batch(
3131
language: str,
3232
batch_size: int = 1,
3333
n_process: int = 1,
34-
**kwargs, # noqa ANN003
34+
**kwargs, # noqa: ANN003
3535
) -> Iterator[Tuple[str, NlpArtifacts]]:
3636
"""Execute the NLP pipeline on a batch of texts.
3737

presidio-analyzer/presidio_analyzer/nlp_engine/transformers_nlp_engine.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def load(self) -> None:
9090
"annotate": "spans",
9191
"stride": self.ner_model_configuration.stride,
9292
"alignment_mode": self.ner_model_configuration.alignment_mode,
93-
"aggregation_strategy": self.ner_model_configuration.aggregation_strategy, # noqa E501
93+
"aggregation_strategy": self.ner_model_configuration.aggregation_strategy, # noqa: E501
9494
"annotate_spans_key": self.entity_key,
9595
},
9696
)

presidio-analyzer/presidio_analyzer/pattern_recognizer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def __init__(
7272
else:
7373
self.deny_list = []
7474

75-
def load(self): # noqa D102
75+
def load(self): # noqa: D102
7676
pass
7777

7878
def analyze(

presidio-analyzer/presidio_analyzer/predefined_recognizers/country_specific/poland/pl_pesel_recognizer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def __init__(
4141
supported_language=supported_language,
4242
)
4343

44-
def validate_result(self, pattern_text: str) -> bool: # noqa D102
44+
def validate_result(self, pattern_text: str) -> bool: # noqa: D102
4545
digits = [int(digit) for digit in pattern_text]
4646
weights = [1, 3, 7, 9, 1, 3, 7, 9, 1, 3]
4747

presidio-analyzer/presidio_analyzer/predefined_recognizers/country_specific/spain/es_nif_recognizer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def __init__(
4646
supported_language=supported_language,
4747
)
4848

49-
def validate_result(self, pattern_text: str) -> bool: # noqa D102
49+
def validate_result(self, pattern_text: str) -> bool: # noqa: D102
5050
pattern_text = EntityRecognizer.sanitize_value(
5151
pattern_text, self.replacement_pairs
5252
)

presidio-analyzer/presidio_analyzer/predefined_recognizers/country_specific/us/aba_routing_recognizer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def __init__(
5858
supported_language=supported_language,
5959
)
6060

61-
def validate_result(self, pattern_text: str) -> bool: # noqa D102
61+
def validate_result(self, pattern_text: str) -> bool: # noqa: D102
6262
sanitized_value = EntityRecognizer.sanitize_value(
6363
pattern_text, self.replacement_pairs
6464
)

0 commit comments

Comments
 (0)