Skip to content

Commit 242ecfe

Browse files
committed
black 79
1 parent 0c912d3 commit 242ecfe

4 files changed

Lines changed: 36 additions & 11 deletions

File tree

src/actinia/actinia.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ def __set_url(self):
6969

7070
def __check_version(self):
7171
version_url = f"{self.url}/version"
72-
data = request_and_check("GET", version_url, **{"timeout": self.timeout})
72+
data = request_and_check(
73+
"GET", version_url, **{"timeout": self.timeout}
74+
)
7375

7476
if len(data) > 2:
7577
log.debug(f"{self.url} is working and will be used.")
@@ -89,7 +91,9 @@ def __check_version(self):
8991
self.api_version = "v1"
9092
self.__check_version()
9193
else:
92-
raise Exception(f"Connection to actinia server <{self.url}> failed!")
94+
raise Exception(
95+
f"Connection to actinia server <{self.url}> failed!"
96+
)
9397

9498
def get_version(self):
9599
"""
@@ -98,7 +102,9 @@ def get_version(self):
98102
"""
99103

100104
version_url = f"{self.url}/version"
101-
return request_and_check("GET", version_url, **{"timeout": self.timeout})
105+
return request_and_check(
106+
"GET", version_url, **{"timeout": self.timeout}
107+
)
102108

103109
def __check_auth(self):
104110
url = f"{self.url}/locations"
@@ -145,7 +151,9 @@ def __request_locations(self):
145151
loc_names = request_and_check(
146152
"GET", url, **{"timeout": self.timeout, "auth": (self.__auth)}
147153
)["locations"]
148-
loc = {lname: Location(lname, self, self.__auth) for lname in loc_names}
154+
loc = {
155+
lname: Location(lname, self, self.__auth) for lname in loc_names
156+
}
149157
self.locations = loc
150158

151159
def create_location(self, name, epsgcode):

src/actinia/job.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,10 @@ def poll_until_finished(self, waiting_time=5, quiet=False):
9292
self.poll(quiet=True)
9393
if self.status not in ["accepted", "running"]:
9494
status_accepted_running = False
95-
msg = f"Status of {self.name} job is {self.status}: " f"{self.message}"
95+
msg = (
96+
f"Status of {self.name} job is {self.status}: "
97+
f"{self.message}"
98+
)
9699
if self.status in ["terminated", "error"]:
97100
log.error(msg)
98101
return 1
@@ -102,7 +105,10 @@ def poll_until_finished(self, waiting_time=5, quiet=False):
102105
sleep(waiting_time)
103106
if self.status != status and not quiet:
104107
status = self.status
105-
msg = f"Status of {self.name} job is {self.status}: " f"{self.message}"
108+
msg = (
109+
f"Status of {self.name} job is {self.status}: "
110+
f"{self.message}"
111+
)
106112
log.info(msg)
107113

108114
def terminate(self):

src/actinia/location.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,9 @@ def delete_mapset(self, name):
122122
"""
123123
if self.mapsets is None or len(self.mapsets) == 0:
124124
self.__request_mapsets()
125-
Mapset.delete_mapset_request(name, self.name, self.__actinia, self.__auth)
125+
Mapset.delete_mapset_request(
126+
name, self.name, self.__actinia, self.__auth
127+
)
126128
if name and name in self.mapsets:
127129
del self.mapsets[name]
128130
return self.mapsets
@@ -160,7 +162,9 @@ def validate_process_chain_async(self, pc, name=None):
160162
actiniaResp = self.__validate_process_chain(pc, "async")
161163
orig_name, name = set_job_names(name, "unknown_validation_job")
162164
if actiniaResp.status_code != 200:
163-
raise Exception(f"Error {actiniaResp.status_code}: {actiniaResp.text}")
165+
raise Exception(
166+
f"Error {actiniaResp.status_code}: {actiniaResp.text}"
167+
)
164168
resp = json.loads(actiniaResp.text)
165169
job = Job(orig_name, self.__actinia, self.__auth, resp)
166170
self.__actinia.jobs[name] = job
@@ -177,7 +181,10 @@ def create_processing_export_job(self, pc, name=None):
177181
# set name
178182
orig_name, name = set_job_names(name)
179183
# set endpoint in url
180-
url = f"{self.__actinia.url}/locations/{self.name}/" "processing_async_export"
184+
url = (
185+
f"{self.__actinia.url}/locations/{self.name}/"
186+
"processing_async_export"
187+
)
181188
# make POST request
182189
postkwargs = {
183190
"headers": self.__actinia.headers,

tests/test_utils.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ def test_request_and_check_wrong_url(self):
5151
url = f"{ACTINIA_BASEURL}api/{ACTINIA_VERSION}/version_fail"
5252
err_msg = "The requested URL was not found on the server."
5353
with pytest.raises(Exception) as excinfo:
54-
request_and_check("GET", url, status_code=(200,), **{"auth": ACTINIA_AUTH})
54+
request_and_check(
55+
"GET", url, status_code=(200,), **{"auth": ACTINIA_AUTH}
56+
)
5557
assert err_msg in str(excinfo.value)
5658

5759
def test_request_and_check_wrong_auth(self):
@@ -60,7 +62,9 @@ def test_request_and_check_wrong_auth(self):
6062
err_msg = "Wrong user or password. Please check your inputs."
6163
wrong_auth = ("actinia-gdi", "wrong_pw")
6264
with pytest.raises(Exception) as excinfo:
63-
request_and_check("GET", url, status_code=(200,), **{"auth": wrong_auth})
65+
request_and_check(
66+
"GET", url, status_code=(200,), **{"auth": wrong_auth}
67+
)
6468
assert err_msg in str(excinfo.value)
6569

6670
def test_set_job_names(self):

0 commit comments

Comments
 (0)