Skip to content

Commit 984a61b

Browse files
committed
Fixed linting issues
Signed-off-by: Saif Ul Islam <[email protected]>
1 parent 1230d67 commit 984a61b

File tree

3 files changed

+29
-23
lines changed

3 files changed

+29
-23
lines changed

src/mapillary/interface.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# Local
2121
from mapillary.models.geojson import GeoJSON
2222
from mapillary.utils.auth import auth, set_token
23-
from mapillary.utils.verify import international_dateline_check, bbox_validity_check
23+
2424
# Exception classes
2525
from mapillary.models.exceptions import InvalidOptionError
2626

src/mapillary/models/exceptions.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@
1616
# Package imports
1717
import typing
1818

19+
20+
class MapillaryException(Exception):
21+
"""Base class for exceptions in this module"""
22+
23+
pass
24+
25+
1926
class InvalidBBoxError(MapillaryException):
2027
"""
2128
Raised when an invalid coordinates for bounding box are entered
@@ -24,23 +31,15 @@ class InvalidBBoxError(MapillaryException):
2431
:var message: The error message returned
2532
:type message: str
2633
"""
34+
2735
def __init__(self, message: str):
2836
self.message = message
2937

3038
def __str__(self):
31-
return (
32-
f'InvalidBBoxError: "{self.message}" '
33-
)
39+
return f'InvalidBBoxError: "{self.message}" '
3440

3541
def __repr__(self):
36-
return (
37-
f'InvalidBBoxError: = "{self.message}" '
38-
)
39-
40-
class MapillaryException(Exception):
41-
"""Base class for exceptions in this module"""
42-
43-
pass
42+
return f'InvalidBBoxError: = "{self.message}" '
4443

4544

4645
class InvalidTokenError(MapillaryException):

src/mapillary/utils/verify.py

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,45 +16,52 @@
1616
"""
1717

1818
# Local Imports
19-
from mapillary.models.exceptions import InvalidBBoxError, InvalidKwargError, InvalidOptionError
19+
from mapillary.models.exceptions import (
20+
InvalidBBoxError,
21+
InvalidKwargError,
22+
InvalidOptionError,
23+
)
2024
from mapillary.config.api.entities import Entities
2125
from mapillary.models.client import Client
2226

2327
# Package Imports
2428
import requests
2529
import re
2630

31+
2732
def international_dateline_check(bbox):
28-
if bbox['west']>0 and bbox['east']<0:
33+
if bbox["west"] > 0 and bbox["east"] < 0:
2934
return True
3035
return False
3136

37+
3238
def bbox_validity_check(bbox):
3339
# longitude check
34-
if bbox['west'] < 180 or bbox['east'] > 180:
40+
if bbox["west"] < 180 or bbox["east"] > 180:
3541
raise InvalidBBoxError(message="Input values exceed their permitted limits")
3642
# lattitude check
37-
elif bbox['north'] > 90 or bbox['south'] < 90:
43+
elif bbox["north"] > 90 or bbox["south"] < 90:
3844
raise InvalidBBoxError(message="Input values exceed their permitted limits")
3945
# longitude validity check
40-
elif bbox['west']>bbox['east'] :
46+
elif bbox["west"] > bbox["east"]:
4147
# extra check for international dateline
4248
# it could either be an error or cross an internaitonal dateline
4349
# hence if it is passing the dateline, return True
4450
if international_dateline_check(bbox):
45-
new_east = bbox['east'] + 360
46-
bbox['east'] = new_east
51+
new_east = bbox["east"] + 360
52+
bbox["east"] = new_east
4753
return bbox
4854
raise InvalidBBoxError(message="Invalid values")
4955
# lattitude validitiy check
50-
elif bbox['north']<bbox['south']:
56+
elif bbox["north"] < bbox["south"]:
5157
raise InvalidBBoxError(message="Invalid values")
52-
elif bbox['north']==bbox['south'] and bbox['west']==bbox['east']:
53-
# checking for equal values to avoid flat box
58+
elif bbox["north"] == bbox["south"] and bbox["west"] == bbox["east"]:
59+
# checking for equal values to avoid flat box
5460
raise InvalidBBoxError(message="Invalid values")
5561

5662
return True
57-
63+
64+
5865
def kwarg_check(kwargs: dict, options: list, callback: str) -> bool:
5966
"""
6067
Checks for keyword arguments amongst the kwarg argument to fall into the options list

0 commit comments

Comments
 (0)