Skip to content

Commit

Permalink
🐍 Remove is_python_2 func and uses
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinHock committed Mar 30, 2020
1 parent 7046220 commit 0e1dd3f
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 15 deletions.
6 changes: 0 additions & 6 deletions detect_secrets/plugins/common/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
import re
import string

from detect_secrets.util import is_python_2


def is_found_with_aho_corasick(secret, automaton):
"""
Expand All @@ -22,10 +20,6 @@ def is_found_with_aho_corasick(secret, automaton):
if not automaton:
return False

if is_python_2(): # pragma: no cover
# Due to pyahocorasick
secret = secret.encode('utf-8')

try:
# .lower() to make everything case-insensitive
next(automaton.iter(string=secret.lower()))
Expand Down
5 changes: 0 additions & 5 deletions detect_secrets/util.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import hashlib
import os
import subprocess
import sys


def is_python_2():
return sys.version_info[0] < 3


def build_automaton(word_list):
Expand Down
4 changes: 0 additions & 4 deletions tests/plugins/keyword_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

from detect_secrets.core.potential_secret import PotentialSecret
from detect_secrets.plugins.keyword import KeywordDetector
from detect_secrets.util import is_python_2
from testing.mocks import mock_file_object


Expand Down Expand Up @@ -203,9 +202,6 @@ def test_analyze_standard_positives_with_automaton(self, file_content):
automaton = ahocorasick.Automaton()

word = 'thisone'
if is_python_2(): # pragma: no cover
# Due to pyahocorasick
word = word.encode('utf-8')
automaton.add_word(word, word)

automaton.make_automaton()
Expand Down

0 comments on commit 0e1dd3f

Please sign in to comment.