Skip to content

Commit 345ca1a

Browse files
rename DiceShell->Shell since a subject is clear from containing package ns - godice.Shell
1 parent b763a8a commit 345ca1a

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ async def main():
5555
# Python context manager (async with) is used for convenient connection handling
5656
# Device stays connected during `async with` block execution and auto-disconnected on block finish
5757
# Otherwise, dice.connect/dice.disconnect can be used instead
58-
async with godice.create(client, godice.DiceShell.D6) as dice:
58+
async with godice.create(client, godice.Shell.D6) as dice:
5959
print("Connected")
6060
blue_rgb = (0, 0, 255)
6161
yellow_rgb = (255, 255, 0)

godice/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from .factory import (
77
create,
88
set_shell,
9-
DiceShell
9+
Shell
1010
)
1111
from .dice import (
1212
StabilityDescriptor,

godice/demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ async def main():
2222
# Python context manager (async with) is used for convenient connection handling
2323
# Device stays connected during `async with` block execution and auto-disconnected on block finish
2424
# Otherwise, dice.connect/dice.disconnect can be used instead
25-
async with godice.create(client, godice.DiceShell.D6) as dice:
25+
async with godice.create(client, godice.Shell.D6) as dice:
2626
print(f"Connected to {dev.name}")
2727

2828
blue_rgb = (0, 0, 255)

godice/factory.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from . import xyzinterpret
99

1010

11-
class DiceShell(enum.Enum):
11+
class Shell(enum.Enum):
1212
"""
1313
Available shells a dice may be wrapped into
1414
"""
@@ -21,33 +21,33 @@ class DiceShell(enum.Enum):
2121
D12 = 6
2222

2323
xyz_interpret_map = {
24-
DiceShell.D6: xyzinterpret.get_rolled_number_d6,
25-
DiceShell.D10: xyzinterpret.get_rolled_number_d10,
26-
DiceShell.D10X: xyzinterpret.get_rolled_number_d10x,
27-
DiceShell.D20: xyzinterpret.get_rolled_number_d20,
28-
DiceShell.D4: xyzinterpret.get_rolled_number_d4,
29-
DiceShell.D8: xyzinterpret.get_rolled_number_d8,
30-
DiceShell.D12: xyzinterpret.get_rolled_number_d12,
24+
Shell.D6: xyzinterpret.get_rolled_number_d6,
25+
Shell.D10: xyzinterpret.get_rolled_number_d10,
26+
Shell.D10X: xyzinterpret.get_rolled_number_d10x,
27+
Shell.D20: xyzinterpret.get_rolled_number_d20,
28+
Shell.D4: xyzinterpret.get_rolled_number_d4,
29+
Shell.D8: xyzinterpret.get_rolled_number_d8,
30+
Shell.D12: xyzinterpret.get_rolled_number_d12,
3131
}
3232

3333

34-
def create(ble_client: bleak.BleakClient, dice_shell: DiceShell):
34+
def create(ble_client: bleak.BleakClient, dice_shell: Shell):
3535
"""
3636
Creates Dice API object representing the specified type of a dice
3737
:param ble_client: BleakClient
38-
:param dice_shell: DiceShell
38+
:param dice_shell: Shell
3939
"""
4040
_dice = dice.Dice(ble_client)
4141
set_shell(_dice, dice_shell)
4242
return _dice
4343

4444

45-
def set_shell(_dice: dice.Dice, dice_shell: DiceShell):
45+
def set_shell(_dice: dice.Dice, dice_shell: Shell):
4646
"""
4747
Change a dice shell.
4848
Should be called in order to receive correct number notifications corresponding to a newly set shell
4949
:param dice: a Dice object to change a shell for
50-
:param dice_shell: DiceShell
50+
:param dice_shell: Shell
5151
"""
5252
_xyzinterpret_fn = xyz_interpret_map[dice_shell]
5353
_dice._xyz_interpret_fn = _xyzinterpret_fn

0 commit comments

Comments
 (0)