Skip to content

Commit

Permalink
55 convert mutable default to field with default factory (#56)
Browse files Browse the repository at this point in the history
* remove test coverage display

* remove test coverage display

---------

Co-authored-by: Thomas Schmelzer <[email protected]>
  • Loading branch information
tschm and Thomas Schmelzer authored May 7, 2023
1 parent d46d90b commit fbf8466
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
python-version: [ '3.10' ]
python-version: [ '3.10', '3.11' ]

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
Expand Down
4 changes: 0 additions & 4 deletions book/docs/reports.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@

{{ '[Lines of code]({url}/artifacts/lines/lines.txt)'.format(url=book_url) }}

## Coverage

{{ '[Test coverage]({url}/artifacts/tests/html-coverage/index.html)'.format(url=book_url) }}

## Test report

{{ '[Report]({url}/artifacts/tests/html-report/report.html)'.format(url=book_url) }}
4 changes: 2 additions & 2 deletions cvx/simulator/portfolio.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from dataclasses import dataclass
from dataclasses import dataclass, field
import pandas as pd

from cvx.simulator.trading_costs import LinearCostModel, TradingCostModel
Expand Down Expand Up @@ -59,7 +59,7 @@ class _EquityPortfolio:
stocks: pd.DataFrame
trading_cost_model: TradingCostModel
initial_cash: float = 1e6
_state: _State = _State()
_state: _State = field(default_factory=_State)

def __post_init__(self):
self._state.position = self.stocks.loc[self.index[0]]
Expand Down

0 comments on commit fbf8466

Please sign in to comment.