Skip to content

Commit

Permalink
Check if lint allows nbs with metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
itepifanio committed Apr 7, 2023
1 parent 3e6b8a4 commit a83ff73
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 8 deletions.
2 changes: 1 addition & 1 deletion mydeck/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
Card = collections.namedtuple("Card", ["rank", "suit"])

# %% ../nbs/05_deck.ipynb 9
#| code-fold: true
# | code-fold: true
class FrenchDeck:
ranks = [n for n in range(1, 14)]
suits = "spades diamonds clubs hearts".split()
Expand Down
6 changes: 4 additions & 2 deletions mydeck/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
from mydeck.core import Card

# %% ../nbs/06_hand.ipynb 3
#| code-fold: true
# | code-fold: true
class Hand:
def __init__(
self, max_cards: Optional[int] = None # Max amount of cards it can be hold
# Max amount of cards it can be hold
self,
max_cards: Optional[int] = None,
):
self._max_cards = max_cards
self.cards: List[Card] = []
Expand Down
43 changes: 38 additions & 5 deletions nbs/06_hand.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,24 @@
"execution_count": null,
"id": "8cabce32",
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"Card(rank=1, suit='spades')"
]
},
"execution_count": null,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#| exec_doc\n",
"#| code-fold: false\n",
"card = Card(rank=1, suit=\"spades\")\n",
"\n",
"hand.draw(card)\n",
"hand.draw(card) # type: ignore\n",
"hand"
]
},
Expand All @@ -160,7 +171,18 @@
"execution_count": null,
"id": "45aa3d73",
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"[Card(rank=1, suit='spades')]"
]
},
"execution_count": null,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#| exec_doc\n",
"[card for card in hand]"
Expand All @@ -171,10 +193,21 @@
"execution_count": null,
"id": "1b8584bd",
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"0"
]
},
"execution_count": null,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#| exec_doc\n",
"hand.discard()\n",
"hand.discard() # type: ignore\n",
"len(hand)"
]
},
Expand Down

0 comments on commit a83ff73

Please sign in to comment.