Skip to content

Commit

Permalink
Fix camel case and flake errors in levelup (#2444)
Browse files Browse the repository at this point in the history
  • Loading branch information
friscoMad authored and sebastienvercammen committed Jan 18, 2018
1 parent 1e5853d commit 7a7c3ff
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions tools/levelup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
sys.path.append('.')
from pogom.schedulers import KeyScheduler # noqa: E402
from pogom.account import (check_login, setup_api, pokestop_spinnable,
spin_pokestop, TooManyLoginAttempts, LoginSequenceFail) # noqa: E402
spin_pokestop, TooManyLoginAttempts) # noqa: E402
from pogom.utils import get_args, gmaps_reverse_geolocate # noqa: E402
from pogom.apiRequests import (get_map_objects as gmo, AccountBannedException) # noqa: E402
from pogom.apiRequests import (get_map_objects as gmo,
AccountBannedException) # noqa: E402
from runserver import (set_log_and_verbosity, startup_db,
extract_coordinates) # noqa: E402
from pogom.proxy import initialize_proxies # noqa: E402
Expand All @@ -30,9 +31,9 @@ def put(self, something):
class ErrorType(Enum):
generic = 1
captcha = 2
noStops = 3
no_stops = 3
banned = 4
loginError = 5
login_error = 5


def get_location_forts(api, account, location):
Expand All @@ -46,7 +47,7 @@ def get_location_forts(api, account, location):
for i, cell in enumerate(cells):
forts += cell.forts
if not forts:
return (ErrorType.noStops, None)
return (ErrorType.no_stops, None)
return (None, forts)


Expand Down Expand Up @@ -92,9 +93,9 @@ def level_up_account(args, location, accounts, errors):
log.info('Account %s, level %d.', account['username'],
account['level'])
except TooManyLoginAttempts:
errors[ErrorType.loginError].append(account)
errors[ErrorType.login_error].append(account)
except AccountBannedException:
errors[ErrorType.banned].append(account)
errors[ErrorType.banned].append(account)
except Exception as e:
if error_count < 2:
log.exception('Exception in worker: %s. retrying.', e)
Expand Down

0 comments on commit 7a7c3ff

Please sign in to comment.