Skip to content

Commit

Permalink
Fix some code smells in OAuth
Browse files Browse the repository at this point in the history
Use 'startswith' or 'endswith' methods instead of string slicing in condition expressions.

skip-release
  • Loading branch information
Taapat authored Aug 23, 2023
1 parent 32d4a52 commit 0e804f6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/OAuth.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ def get_key(x):
if len(line) < 30 or line[0] == '#' or '=' not in line:
continue
line = line.split('=', 1)
if line[1][:1] == '"' or line[1][:1] == "'":
if line[1].startswith() == '"' or line[1].startswith() == "'":
line[1] = line[1][1:]
if line[1][-1:] == '"' or line[1][-1:] == "'":
if line[1].endswith() == '"' or line[1].endswith() == "'":
line[1] = line[1][:-1]
if line[1][:4] == 'GET_':
if line[1].startswith() == 'GET_':
line[1] = get_key(line[1][4:])
if 'API_KEY' in line[0]:
API_KEY = line[1]
Expand Down

0 comments on commit 0e804f6

Please sign in to comment.