Skip to main content

Stroke handling helper library for Plover

Project description

Plover Stroke

Helper class for working with steno strokes.

Usage:

# Setup:

from plover_stroke import BaseStroke

class Stroke(BaseStroke):
     pass

Stroke.setup(
    # System keys.
    '''
    #
    S- T- K- P- W- H- R-
    A- O-
    *
    -E -U
    -F -R -P -B -L -G -T -S -D -Z
    '''.split(),
    # Implicit hyphen keys (optional, automatically
    # deduced from system keys if not passed).
    'A- O- * -E -U'.split(),
    # Number bar key and numbers keys (optional).
    '#', {
    'S-': '1-',
    'T-': '2-',
    'P-': '3-',
    'H-': '4-',
    'A-': '5-',
    'O-': '0-',
    '-F': '-6',
    '-P': '-7',
    '-L': '-8',
    '-T': '-9',
    })

# Creating strokes:

Stroke(56)
# => KPW
Stroke(('-F', 'S-', '-S', 'A-', '*')) 
# => SA*FS
Stroke('R-')
# => R
Stroke('L-')
# => invalid, raise a ValueError

# Methods:

s = Stroke('STK')

s.keys()
# => ['S-', 'T-', 'K-']
s.isnumber()
# => False
int(s)
# => 14
s == 0b00000000000000000001110
# => True

# Strokes can be compared:
sorted(map(Stroke, 'AOE ST-PB *Z # R-R'.split()))
# => [#, ST-PB, R-R, AOE, *Z]

# Generating a range of strokes:
list(Stroke.xrange('ST', 'TP'))
# => [ST, 12, K, #K, SK, #SK, TK, #TK, STK, #STK, P, 3, SP, 13]

# Generating list of possible suffix strokes:
list(Stroke('-T').xsuffixes())
# => [-TS, -TD, -TSD, -TZ, -TSZ, -TDZ, -TSDZ]

Release history

0.3.3

  • fix python_requires package metadata

0.3.2

  • first public release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

plover_stroke-0.3.3.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

plover_stroke-0.3.3-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file plover_stroke-0.3.3.tar.gz.

File metadata

  • Download URL: plover_stroke-0.3.3.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.3

File hashes

Hashes for plover_stroke-0.3.3.tar.gz
Algorithm Hash digest
SHA256 7911709f508a86c773d33e233da70b67e86f940f9ee3703c2417d2840439e0ca
MD5 ce1c7e5c8fcac97b16805ae893f53cf6
BLAKE2b-256 44cb11fa003fc940a38c13c03f43735aa24cbceef845f01af70764a98d58fb0e

See more details on using hashes here.

File details

Details for the file plover_stroke-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: plover_stroke-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.3

File hashes

Hashes for plover_stroke-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 50a17fd79a0ad51ecd0e5b6621643ce2a1efcd96246c593e73815a954dc8c7e4
MD5 4b55a10243f7d53c40a22b1df527c817
BLAKE2b-256 a9d5b6afdf0b3e6f3b5c146f8522b663aca0e7c81406c39b454fcb1c2da5b550

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page