Fix style errors

This commit is contained in:
Matthias 2021-10-06 19:36:28 +02:00
parent 0db5c07314
commit 57ef25789e
4 changed files with 11 additions and 3 deletions

View File

@ -348,6 +348,7 @@ class BacktestResponse(BaseModel):
# TODO: Properly type backtestresult... # TODO: Properly type backtestresult...
backtest_result: Optional[Dict[str, Any]] backtest_result: Optional[Dict[str, Any]]
class SysInfo(BaseModel): class SysInfo(BaseModel):
cpu_pct: float cpu_pct: float
ram_pct: float ram_pct: float

View File

@ -18,7 +18,8 @@ from freqtrade.rpc.api_server.api_schemas import (AvailablePairs, Balances, Blac
OpenTradeSchema, PairHistory, PerformanceEntry, OpenTradeSchema, PairHistory, PerformanceEntry,
Ping, PlotConfig, Profit, ResultMsg, ShowConfig, Ping, PlotConfig, Profit, ResultMsg, ShowConfig,
Stats, StatusMsg, StrategyListResponse, Stats, StatusMsg, StrategyListResponse,
StrategyResponse, SysInfo, Version, WhitelistResponse) StrategyResponse, SysInfo, Version,
WhitelistResponse)
from freqtrade.rpc.api_server.deps import get_config, get_rpc, get_rpc_optional from freqtrade.rpc.api_server.deps import get_config, get_rpc, get_rpc_optional
from freqtrade.rpc.rpc import RPCException from freqtrade.rpc.rpc import RPCException
@ -260,6 +261,7 @@ def list_available_pairs(timeframe: Optional[str] = None, stake_currency: Option
} }
return result return result
@router.get('/sysinfo', response_model=SysInfo, tags=['info']) @router.get('/sysinfo', response_model=SysInfo, tags=['info'])
def sysinfo(): def sysinfo():
return RPC._rpc_sysinfo() return RPC._rpc_sysinfo()

View File

@ -1,13 +1,14 @@
""" """
This module contains class to define a RPC communications This module contains class to define a RPC communications
""" """
import logging, psutil import logging
from abc import abstractmethod from abc import abstractmethod
from datetime import date, datetime, timedelta, timezone from datetime import date, datetime, timedelta, timezone
from math import isnan from math import isnan
from typing import Any, Dict, List, Optional, Tuple, Union from typing import Any, Dict, List, Optional, Tuple, Union
import arrow import arrow
import psutil
from numpy import NAN, inf, int64, mean from numpy import NAN, inf, int64, mean
from pandas import DataFrame from pandas import DataFrame
@ -873,4 +874,7 @@ class RPC:
@staticmethod @staticmethod
def _rpc_sysinfo() -> Dict[str, Any]: def _rpc_sysinfo() -> Dict[str, Any]:
return {"cpu_pct": psutil.cpu_percent(interval=1, percpu=True), "ram_pct": psutil.virtual_memory().percent} return {
"cpu_pct": psutil.cpu_percent(interval=1, percpu=True),
"ram_pct": psutil.virtual_memory().percent
}

View File

@ -341,6 +341,7 @@ class FtRestClient():
""" """
return self._get("sysinfo") return self._get("sysinfo")
def add_arguments(): def add_arguments():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument("command", parser.add_argument("command",