Skip to content

Commit 049bb8e

Browse files
upd:
- fix package version - add/update docs
1 parent b38da91 commit 049bb8e

File tree

5 files changed

+12
-6
lines changed

5 files changed

+12
-6
lines changed

godice/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
GoDice Python API
33
"""
4-
__version__ = "0.0.1"
4+
__version__ = "0.1.0"
55

66
from .factory import (
77
create,

godice/demo.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
"""
2+
Demo script that connects to the closest dice, sets LED color and listens for position updates
3+
"""
14
import asyncio
25
import bleak
36
import godice

godice/dice.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
"""
2+
Dice API
3+
"""
14
import asyncio
25
import struct
36
import enum
@@ -94,7 +97,7 @@ async def pulse_led(self, pulse_count, on_time_ms, off_time_ms, rgb_tuple):
9497

9598
async def get_color(self):
9699
"""
97-
Read dice color ()
100+
Read dice color
98101
"""
99102
self._color = self._color or await self._fetch_color()
100103
return self._color

godice/factory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class DiceType(enum.Enum):
3333

3434
def create(ble_client: bleak.BleakClient, dice_type: DiceType):
3535
"""
36-
Creates an object representing the specified dice type
36+
Creates Dice API object representing the specified type of a dice
3737
"""
3838
_xyzinterpret_fn = xyz_interpret_map[dice_type]
3939
return dice.Dice(ble_client, _xyzinterpret_fn)

godice/xyzinterpret.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Includes position vectors and functions to translate a coord to a number based on a dice type
2+
Tools needed to translate coords sent by a dice to a resulting number based on a dice type
33
"""
44

55
import math
@@ -192,10 +192,10 @@ def _get_closest_vector(die_table, coord):
192192
:return: the value of the closest vector to the die's vector
193193
"""
194194

195-
def _key2distance(key):
195+
def _distance_as_key(key):
196196
vec = die_table[key]
197197
return math.dist(coord, vec)
198-
return min(die_table.keys(), key=_key2distance)
198+
return min(die_table.keys(), key=_distance_as_key)
199199

200200

201201
def get_rolled_number_d6(xyz):

0 commit comments

Comments
 (0)