-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
53 changed files
with
8,218 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.ipynb merge=nbdev-merge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Generated by nbdev_install_hooks | ||
# | ||
# If you need to disable this instrumentation do: | ||
# git config --local --unset include.path | ||
# | ||
# To restore: | ||
# git config --local include.path ../.gitconfig | ||
# | ||
[merge "nbdev-merge"] | ||
name = resolve conflicts with nbdev_fix | ||
driver = nbdev_merge %O %A %B %P |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,33 @@ | ||
# nbdev_demo | ||
demo of setting up a nbdev enviorment | ||
|
||
|
||
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! --> | ||
|
||
This file will become your README and also the index of your | ||
documentation. | ||
|
||
## Install | ||
|
||
``` sh | ||
pip install nbdev-demo | ||
``` | ||
|
||
## How to use | ||
|
||
This library provides a | ||
`` [`Card`](https://Deufel.github.io/nbdev_demo/card.html#card) `` class | ||
you can use to display, and compare playing cards: | ||
|
||
``` python | ||
Card(suit=1,rank=4) | ||
``` | ||
|
||
4♦️ | ||
|
||
Suits are numbered according to this list: | ||
|
||
``` python | ||
suits | ||
``` | ||
|
||
['♣️', '♦️', '♥️', '♠️'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/.quarto/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,237 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "raw", | ||
"metadata": {}, | ||
"source": [ | ||
"---\n", | ||
"description: A simple API for creating and using playing cards\n", | ||
"output-file: card.html\n", | ||
"title: card\n", | ||
"\n", | ||
"---\n", | ||
"\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"language": "python" | ||
}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"['♣️', '♦️', '♥️', '♠️']" | ||
] | ||
}, | ||
"execution_count": null, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"suits" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"for example the suit ar index ```0```:" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"language": "python" | ||
}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"'♣️'" | ||
] | ||
}, | ||
"execution_count": null, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"suits[0]" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"language": "python" | ||
}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"[None, 'A', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K']" | ||
] | ||
}, | ||
"execution_count": null, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"ranks" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"for exampel the rank at index ```1``` (note no rank at index 1 so that 2 - 10 match)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"language": "python" | ||
}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"'A'" | ||
] | ||
}, | ||
"execution_count": null, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"ranks[1]" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"has_sd": true, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/markdown": [ | ||
"---\n", | ||
"\n", | ||
"[source](https://github.com/Deufel/nbdev_demo/blob/master/nbdev_demo/card.py#L11){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n", | ||
"\n", | ||
"### Card\n", | ||
"\n", | ||
"> Card (suit:int, rank:int)\n", | ||
"\n", | ||
"*A playing card*\n", | ||
"\n", | ||
"| | **Type** | **Details** |\n", | ||
"| -- | -------- | ----------- |\n", | ||
"| suit | int | An index into `suits` |\n", | ||
"| rank | int | an index into `ranks` |" | ||
], | ||
"text/plain": [ | ||
"---\n", | ||
"\n", | ||
"[source](https://github.com/Deufel/nbdev_demo/blob/master/nbdev_demo/card.py#L11){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n", | ||
"\n", | ||
"### Card\n", | ||
"\n", | ||
"> Card (suit:int, rank:int)\n", | ||
"\n", | ||
"*A playing card*\n", | ||
"\n", | ||
"| | **Type** | **Details** |\n", | ||
"| -- | -------- | ----------- |\n", | ||
"| suit | int | An index into `suits` |\n", | ||
"| rank | int | an index into `ranks` |" | ||
] | ||
}, | ||
"execution_count": 1, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"#| echo: false\n", | ||
"#| output: asis\n", | ||
"show_doc(Card)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"language": "python" | ||
}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"3♦️" | ||
] | ||
}, | ||
"execution_count": null, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"c = Card(suit=1, rank=3)\n", | ||
"c" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Comparison opperators\n", | ||
"\n", | ||
"equality, less than, and greater than should work on rank and suit indicies" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"language": "python" | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"test_eq(Card(suit=1, rank=3), Card(suit=1, rank=3))\n", | ||
"test_ne(Card(suit=1, rank=12), Card(suit=3, rank=12))\n", | ||
"test_ne(Card(suit=1, rank=3), Card(suit=3, rank=3))\n", | ||
"\n", | ||
"assert Card(suit=1, rank=3) < Card(suit=2, rank=3)\n", | ||
"\n", | ||
"assert Card(suit=3, rank=3) > Card(suit=2, rank=3)\n", | ||
"assert not Card(suit=1, rank=3) > Card(suit=2, rank=3)" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "python3", | ||
"language": "python", | ||
"name": "python3" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 4 | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.