Skip to content

Commit 2a69e62

Browse files
authored
Merge pull request #204 from cloudfoundry-community/dependabot/pip/flake8-6.1.0
Bump flake8 from 5.0.4 to 6.1.0
2 parents 439ec9e + daf073b commit 2a69e62

File tree

5 files changed

+14
-11
lines changed

5 files changed

+14
-11
lines changed

dev-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
black==23.12.1
2-
flake8==5.0.4
2+
flake8==6.1.0
33
setuptools; python_version >= '3.12'

main/cloudfoundry_client/errors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def __init__(self, status_code: HTTPStatus, body, request_id=None):
1414

1515
def __str__(self):
1616
error_message = self.status_code.name
17-
if type(self.body) == str:
17+
if isinstance(self.body, str):
1818
error_message += f" = {self.body}"
1919
else:
2020
error_message += f" = {json.dumps(self.body)}"

main/cloudfoundry_client/main/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def build_client_from_configuration(previous_configuration: dict = None) -> Clou
110110
client.init_with_token(configuration["refresh_token"])
111111
return client
112112
except Exception as ex:
113-
if type(ex) == ConnectionError:
113+
if isinstance(ex, ConnectionError):
114114
raise
115115
else:
116116
_logger.exception("Could not restore configuration. Cleaning and recreating")

main/cloudfoundry_client/operations/push/validation/manifest.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@ def _convert_positive(manifest: dict, field: str):
9090
def _convert_boolean(manifest: dict, field: str):
9191
if field in manifest:
9292
field_value = manifest[field]
93-
manifest[field] = field_value if type(field_value) == bool else field_value.lower() == "true"
93+
manifest[field] = field_value if isinstance(field_value, bool) else field_value.lower() == "true"
9494

9595
@staticmethod
9696
def _validate_routes(manifest: dict):
9797
for route in manifest.get("routes", []):
98-
if type(route) != dict or "route" not in route:
98+
if not (isinstance(route, dict)) or "route" not in route:
9999
raise AssertionError("routes attribute must be a list of object containing a route attribute")
100100

101101
@staticmethod
@@ -125,11 +125,14 @@ def _absolute_path(manifest_directory: str, manifest: dict):
125125
def _convert_environment(app_manifest: dict):
126126
environment = app_manifest.get("env")
127127
if environment is not None:
128-
if type(environment) != dict:
128+
if not (isinstance(environment, dict)):
129129
raise AssertionError("'env' entry must be a dictionary")
130130
app_manifest["env"] = {
131-
key: json.dumps(value) for key, value in environment.items() if value is not None and type(value) != str
131+
key: json.dumps(value) for key, value in environment.items()
132+
if value is not None and not (isinstance(value, str))
133+
}
134+
app_manifest["env"].update({
135+
key: value for key, value in environment.items()
136+
if value is not None and isinstance(value, str)
132137
}
133-
app_manifest["env"].update(
134-
{key: value for key, value in environment.items() if value is not None and type(value) == str}
135138
)

main/cloudfoundry_client/v2/apps.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,11 @@ def _wait_for_instances_in_state(
195195
sleep(check_time)
196196
sum_waiting += check_time
197197

198-
def _safe_get_instances(self, application_guid: str) -> JsonObject:
198+
def _safe_get_instances(self, application_guid: str) -> Dict[str, JsonObject]:
199199
try:
200200
return self.get_instances(application_guid)
201201
except InvalidStatusCode as ex:
202-
if ex.status_code == HTTPStatus.BAD_REQUEST and type(ex.body) == dict:
202+
if ex.status_code == HTTPStatus.BAD_REQUEST and isinstance(ex.body, dict):
203203
code = ex.body.get("code", -1)
204204
# 170002: staging not finished
205205
# 220001: instances error

0 commit comments

Comments
 (0)