Skip to content

Commit

Permalink
Update ml training code for split line start:end (#542)
Browse files Browse the repository at this point in the history
* update code for split line start:end

* fix

* OSError fix

* Exception overlap fix

* test: actions/setup-python@v5

* actions
  • Loading branch information
babenek authored Apr 26, 2024
1 parent 456e91a commit fa6051a
Show file tree
Hide file tree
Showing 17 changed files with 15 additions and 11,484 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ jobs:
steps:

- name: Checkout CredData
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: Samsung/CredData

Expand Down Expand Up @@ -383,7 +383,7 @@ jobs:
run: python -m pip install --upgrade pip

- name: Checkout current CredSweeper
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
path: CredSweeper.head
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ jobs:
if: ${{ always() && steps.setup_credsweeper.conclusion == 'success' }}
run: pylint --py-version=3.10 --errors-only credsweeper

- name: Analysing the code with pylint and minimum Python version 3.10
- name: Analysing the code with pylint and minimum Python version 3.11
if: ${{ always() && steps.setup_credsweeper.conclusion == 'success' }}
run: pylint --py-version=3.11 --errors-only credsweeper

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
os: [ ubuntu-latest, windows-latest, macos-13 ]
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
Expand Down
2 changes: 1 addition & 1 deletion credsweeper/logger/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@ def init_logging(log_level: str, file_path: Optional[str] = None) -> None:
logging.config.dictConfig(logging_config)
for module in logging_config["ignore"]:
logging.getLogger(module).setLevel(logging.ERROR)
except (IOError, OSError):
except OSError:
logging.basicConfig(level=logging.WARNING)
2 changes: 1 addition & 1 deletion credsweeper/validations/github_token_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def verify(cls, line_data_list: List[LineData]) -> KeyValidationOption:
"https://api.github.com",
headers={"Authorization": f"token {line_data_list[0].value}"},
)
except (requests.exceptions.ConnectionError, Exception) as exc:
except Exception as exc:
logger.error(f"Cannot validate {line_data_list[0].value} token using API\n{exc}")
return KeyValidationOption.UNDECIDED

Expand Down
2 changes: 1 addition & 1 deletion credsweeper/validations/google_api_key_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def verify(cls, line_data_list: List[LineData]) -> KeyValidationOption:
# validate the "key", so we will know if it's real or not.
r = requests.get(
f"https://maps.googleapis.com/maps/api/place/findplacefromtext/json?key={line_data_list[0].value}")
except (requests.exceptions.ConnectionError, Exception) as exc:
except Exception as exc:
logger.error(f"Cannot validate {line_data_list[0].value} token using API\n{exc}")
return KeyValidationOption.UNDECIDED

Expand Down
2 changes: 1 addition & 1 deletion credsweeper/validations/slack_token_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def verify(cls, line_data_list: List[LineData]) -> KeyValidationOption:
try:
headers = {"Content-type": "application/json", "Authorization": f"Bearer {line_data_list[0].value}"}
r = requests.post("https://slack.com/api/auth.test/", headers=headers)
except (requests.exceptions.ConnectionError, Exception) as exc:
except Exception as exc:
logger.error(f"Cannot validate {line_data_list[0].value} token using API\n{exc}")
return KeyValidationOption.UNDECIDED

Expand Down
2 changes: 1 addition & 1 deletion credsweeper/validations/square_access_token_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def verify(cls, line_data_list: List[LineData]) -> KeyValidationOption:
"https://connect.squareup.com/v2/payments",
headers={"Authorization": f"Bearer {line_data_list[0].value}"},
)
except (requests.exceptions.ConnectionError, Exception) as exc:
except Exception as exc:
logger.error(f"Cannot validate {line_data_list[0].value} token using API\n{exc}")
return KeyValidationOption.UNDECIDED

Expand Down
2 changes: 1 addition & 1 deletion credsweeper/validations/square_client_id_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def verify(cls, line_data_list: List[LineData]) -> KeyValidationOption:
try:
r = requests.get(f"https://squareup.com/oauth2/authorize?client_id={line_data_list[0].value}",
allow_redirects=False)
except (requests.exceptions.ConnectionError, Exception) as exc:
except Exception as exc:
logger.error(f"Cannot validate {line_data_list[0].value} token using API\n{exc}")
return KeyValidationOption.UNDECIDED

Expand Down
2 changes: 1 addition & 1 deletion credsweeper/validations/stripe_api_key_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def verify(cls, line_data_list: List[LineData]) -> KeyValidationOption:
"""
try:
r = requests.get("https://api.stripe.com/v1/charges", auth=(line_data_list[0].value, ""))
except (requests.exceptions.ConnectionError, Exception) as exc:
except Exception as exc:
logger.error(f"Cannot validate {line_data_list[0].value} token using API\n{exc}")
return KeyValidationOption.UNDECIDED
# According to documentation, authentication with wrong credentials return 401
Expand Down
30 changes: 0 additions & 30 deletions experiment/augmentation/README.md

This file was deleted.

Empty file.
Loading

0 comments on commit fa6051a

Please sign in to comment.