Current collected state Current
Observed since 20 Oct, 17:11 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
π Expand abbreviations π
abbrev: Expand abbreviations πExpand a Sequence or Mapping of string abbreviations.
Handy when the user has a choice of commands with long names.
import abbrev
a = ['one', 'two', 'three']
assert abbrev(a, 'one') == 'one'
assert abbrev(a, 'o') == 'one'
assert abbrev(a, 'tw') == 'two'
abbrev(a, 'four') # Raises a KeyError: no such key
abbrev(a, 't') # Raises a KeyError: ambiguous key ('two' or 'three'?)
import abbrev
d = {'one': 100, 'two': 200, 'three': 300}
assert abbrev(d, 'one') == 100
assert abbrev(d, 'o') == 100
assert abbrev(d, 'tw') == 200
import abbrev
d = {'one': 100, 'two': 200, 'three': 300}
abbreviator = abbrev(d)
assert abbreviator('one') == my_abbrevs('o') == 100
assert abbreviator('tw') == 200
multi=Trueimport abbrev
a = ['one', 'two, 'three'}
multi = abbrev(a, multi=True) # Make an abbreviator
assert multi('t') == abbrev(d, 't', multi=True) == ('two', three')
assert multi('o') == abbrev(d, 'o', multi=True) == ('one', )
multi('four') # Still raises a key error
unique=Falseimport abbrev
d = {'one': 100, 'two': 200, 'three': 300}
assert abbrev(d, 't', unique=False) == (200, 300)
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 1.4.0 | 9 May 2026 | 1 |
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 17:11 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:8055b9d9364fba9b55430f64abe5be6682e73b2fae5f00681f491f2706f85196