Skip to content

Commit f42fd6c

Browse files
syntronadeas31
andauthored
use keyword arguments if possible (FKA100 - flake8-force-keyword-arguments) (#394)
Co-authored-by: Adeel Asghar <adeel.asghar@liu.se>
1 parent 646728e commit f42fd6c

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

OMPython/ModelicaSystem.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,10 @@ def parse_simflags(simflags: str) -> dict[str, Optional[str | dict[str, Any] | n
262262
263263
The return data can be used as input for self.args_set().
264264
"""
265-
warnings.warn("The argument 'simflags' is depreciated and will be removed in future versions; "
266-
"please use 'simargs' instead", DeprecationWarning, stacklevel=2)
265+
warnings.warn(message="The argument 'simflags' is depreciated and will be removed in future versions; "
266+
"please use 'simargs' instead",
267+
category=DeprecationWarning,
268+
stacklevel=2)
267269

268270
simargs: dict[str, Optional[str | dict[str, Any] | numbers.Number]] = {}
269271

@@ -559,7 +561,7 @@ def buildModel(self, variableFilter: Optional[str] = None):
559561

560562
def sendExpression(self, expr: str, parsed: bool = True) -> Any:
561563
try:
562-
retval = self._session.sendExpression(expr, parsed)
564+
retval = self._session.sendExpression(command=expr, parsed=parsed)
563565
except OMCSessionException as ex:
564566
raise ModelicaSystemError(f"Error executing {repr(expr)}: {ex}") from ex
565567

@@ -1620,9 +1622,9 @@ def _createCSVData(self, csvfile: Optional[OMCPath] = None) -> OMCPath:
16201622
for signal_name, signal_values in inputs.items():
16211623
signal = np.array(signal_values)
16221624
interpolated_inputs[signal_name] = np.interp(
1623-
all_times,
1624-
signal[:, 0], # times
1625-
signal[:, 1], # values
1625+
x=all_times,
1626+
xp=signal[:, 0], # times
1627+
fp=signal[:, 1], # values
16261628
)
16271629

16281630
# Write CSV file

OMPython/OMCSession.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -818,8 +818,10 @@ def run_model_executable(cmd_run_data: OMCSessionRunData) -> int:
818818
return returncode
819819

820820
def execute(self, command: str):
821-
warnings.warn("This function is depreciated and will be removed in future versions; "
822-
"please use sendExpression() instead", DeprecationWarning, stacklevel=2)
821+
warnings.warn(message="This function is depreciated and will be removed in future versions; "
822+
"please use sendExpression() instead",
823+
category=DeprecationWarning,
824+
stacklevel=2)
823825

824826
return self.sendExpression(command, parsed=False)
825827

0 commit comments

Comments
 (0)