Skip to content

Commit d34e0f2

Browse files
Lint fixes for F, E, W, G and RSE errors (#310)
1 parent 7159f48 commit d34e0f2

File tree

80 files changed

+120
-111
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+120
-111
lines changed

src/conductor/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.1.10"
1+
__version__ = "1.1.10"

src/conductor/client/automator/task_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import importlib
33
import logging
44
import os
5-
from multiprocessing import Process, freeze_support, Queue, set_start_method, get_context
5+
from multiprocessing import Process, freeze_support, Queue, set_start_method
66
from sys import platform
77
from typing import List, Optional
88

src/conductor/client/automator/task_runner.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def run(self) -> None:
6060
while True:
6161
try:
6262
self.run_once()
63-
except Exception as e:
63+
except Exception:
6464
pass
6565

6666
def run_once(self) -> None:
@@ -229,14 +229,13 @@ def __set_worker_properties(self) -> None:
229229
if polling_interval:
230230
try:
231231
self.worker.poll_interval = float(polling_interval)
232-
except Exception as e:
232+
except Exception:
233233
logger.error(f'error reading and parsing the polling interval value {polling_interval}')
234234
self.worker.poll_interval = self.worker.get_polling_interval_in_seconds()
235235

236236
if polling_interval:
237237
try:
238238
self.worker.poll_interval = float(polling_interval)
239-
polling_interval_initialized = True
240239
except Exception as e:
241240
logger.error("Exception in reading polling interval from environment variable: {0}.".format(str(e)))
242241

src/conductor/client/automator/utils.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def convert_from_dict(cls: type, data: dict) -> object:
4444
if data is None:
4545
return data
4646

47-
if type(data) == cls:
47+
if isinstance(data, cls):
4848
return data
4949

5050
if dataclasses.is_dataclass(cls):
@@ -54,7 +54,7 @@ def convert_from_dict(cls: type, data: dict) -> object:
5454
if not ((str(typ).startswith('dict[') or
5555
str(typ).startswith('typing.Dict[') or
5656
str(typ).startswith('requests.structures.CaseInsensitiveDict[') or
57-
typ == dict or str(typ).startswith('OrderedDict['))):
57+
typ is dict or str(typ).startswith('OrderedDict['))):
5858
data = {}
5959

6060
members = inspect.signature(cls.__init__).parameters
@@ -82,7 +82,7 @@ def convert_from_dict(cls: type, data: dict) -> object:
8282
elif (str(typ).startswith('dict[') or
8383
str(typ).startswith('typing.Dict[') or
8484
str(typ).startswith('requests.structures.CaseInsensitiveDict[') or
85-
typ == dict or str(typ).startswith('OrderedDict[')):
85+
typ is dict or str(typ).startswith('OrderedDict[')):
8686

8787
values = {}
8888
generic_type = object
@@ -92,7 +92,7 @@ def convert_from_dict(cls: type, data: dict) -> object:
9292
v = data[member][k]
9393
values[k] = get_value(generic_type, v)
9494
kwargs[member] = values
95-
elif typ == inspect.Parameter.empty:
95+
elif typ is inspect.Parameter.empty:
9696
if inspect.Parameter.VAR_KEYWORD == members[member].kind:
9797
if type(data) in dict_types:
9898
kwargs.update(data)
@@ -117,7 +117,7 @@ def get_value(typ: type, val: object) -> object:
117117
values.append(converted)
118118
return values
119119
elif str(typ).startswith('dict[') or str(typ).startswith(
120-
'typing.Dict[') or str(typ).startswith('requests.structures.CaseInsensitiveDict[') or typ == dict:
120+
'typing.Dict[') or str(typ).startswith('requests.structures.CaseInsensitiveDict[') or typ is dict:
121121
values = {}
122122
for k in val:
123123
v = val[k]

src/conductor/client/helpers/helper.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def __deserialize(self, data, klass):
7171
if data is None:
7272
return None
7373

74-
if type(klass) == str:
74+
if isinstance(klass, str):
7575
if klass.startswith('list['):
7676
sub_kls = re.match(r'list\[(.*)\]', klass).group(1)
7777
return [self.__deserialize(sub_data, sub_kls)
@@ -90,11 +90,11 @@ def __deserialize(self, data, klass):
9090

9191
if klass in self.PRIMITIVE_TYPES:
9292
return self.__deserialize_primitive(data, klass)
93-
elif klass == object:
93+
elif klass is object:
9494
return self.__deserialize_object(data)
95-
elif klass == datetime.date:
95+
elif klass is datetime.date:
9696
return self.__deserialize_date(data)
97-
elif klass == datetime.datetime:
97+
elif klass is datetime.datetime:
9898
return self.__deserialize_datatime(data)
9999
else:
100100
return self.__deserialize_model(data, klass)
@@ -108,7 +108,7 @@ def __deserialize_primitive(self, data, klass):
108108
:return: int, long, float, str, bool.
109109
"""
110110
try:
111-
if klass == str and type(data) == bytes:
111+
if isinstance(klass, str) and isinstance(data, bytes):
112112
return self.__deserialize_bytes_to_str(data)
113113
return klass(data)
114114
except UnicodeEncodeError:

src/conductor/client/metadata_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,4 @@ def set_workflow_tags(self, tags: List[MetadataTag], workflow_name: str):
6464
pass
6565

6666
def delete_workflow_tag(self, tag: MetadataTag, workflow_name: str):
67-
pass
67+
pass

src/conductor/client/orkes/orkes_schema_client.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
from typing import List, Optional
1+
from typing import List
22

33
from conductor.client.configuration.configuration import Configuration
44
from conductor.client.http.models.schema_def import SchemaDef
5-
from conductor.client.http.rest import ApiException
65
from conductor.client.orkes.orkes_base_client import OrkesBaseClient
76
from conductor.client.schema_client import SchemaClient
87

@@ -24,4 +23,4 @@ def delete_schema(self, schema_name: str, version: int) -> None:
2423
self.schemaApi.delete_schema_by_name_and_version(name=schema_name, version=version)
2524

2625
def delete_schema_by_name(self, schema_name: str) -> None:
27-
self.schemaApi.delete_schema_by_name(name=schema_name)
26+
self.schemaApi.delete_schema_by_name(name=schema_name)

src/conductor/client/orkes/orkes_service_registry_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,4 @@ def get_queue_sizes_for_all_tasks(self) -> dict:
6767
def is_circuit_breaker_open(self, name: str) -> bool:
6868
"""Check if circuit breaker is open for a service"""
6969
status = self.get_circuit_breaker_status(name)
70-
return status.current_state and status.current_state.upper() == "OPEN"
70+
return status.current_state and status.current_state.upper() == "OPEN"

src/conductor/client/orkes/orkes_workflow_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,4 +213,4 @@ def update_state(self, workflow_id: str, update_requesst: WorkflowStateUpdate,
213213
if wait_for_seconds is not None:
214214
kwargs['wait_for_seconds'] = wait_for_seconds
215215

216-
return self.workflowResourceApi.update_workflow_and_task_state(update_requesst=update_requesst, workflow_id=workflow_id, **kwargs)
216+
return self.workflowResourceApi.update_workflow_and_task_state(update_requesst=update_requesst, workflow_id=workflow_id, **kwargs)

src/conductor/client/orkes_clients.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ def get_prompt_client(self) -> PromptClient:
5454
return OrkesPromptClient(self.configuration)
5555

5656
def get_schema_client(self) -> SchemaClient:
57-
return OrkesSchemaClient(self.configuration)
57+
return OrkesSchemaClient(self.configuration)

0 commit comments

Comments
 (0)