Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/wcwidth/__init__.py: 100%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

21 statements  

1""" 

2Python 'wcwidth' module. 

3 

4https://github.com/jquast/wcwidth 

5""" 

6 

7# re-export common and outermost functions & definitions, even a few private 

8# ones, some for convenience, others for legacy, only the items in __all__ are 

9# documented as public API 

10 

11# local 

12from ._clip import clip 

13from .align import ljust, rjust, center 

14from ._width import width 

15from .bisearch import bisearch as _bisearch 

16from .grapheme import iter_graphemes, iter_graphemes_reverse, grapheme_boundary_before 

17from .textwrap import SequenceTextWrapper, wrap 

18from ._wcswidth import wcswidth 

19from .hyperlink import Hyperlink, HyperlinkParams 

20from .sgr_state import propagate_sgr 

21from .table_vs16 import VS16_NARROW_TO_WIDE 

22from .table_wide import WIDE_EASTASIAN 

23from .table_zero import ZERO_WIDTH 

24from .text_sizing import TextSizing, TextSizingParams 

25from .table_ambiguous import AMBIGUOUS_EASTASIAN 

26from .escape_sequences import iter_sequences, strip_sequences 

27from .unicode_versions import list_versions 

28 

29# Pre-import the legacy submodule so that sys.modules['wcwidth.wcwidth'] is 

30# populated during package initialization. This matches the 0.6.0 behavior 

31# where ``from .wcwidth import wcwidth`` would have already loaded the 

32# submodule. Without this, a later ``import wcwidth.wcwidth`` triggers 

33# on-disk file discovery which rebinds wcwidth.wcwidth from the function to 

34# the module object. 

35# 

36# NOTE: this sort order is important for legacy import API compatibility before release 0.7.0 

37from . import wcwidth as _wcwidth_module # isort:skip 

38from ._wcwidth import wcwidth, _wcmatch_version, _wcversion_value # isort:skip 

39 

40 

41# The __all__ attribute defines the items exported from statement, 

42# 'from wcwidth import *', but also to say, "This is the public API". 

43__all__ = ('wcwidth', 'wcswidth', 'width', 'iter_sequences', 'iter_graphemes', 

44 'iter_graphemes_reverse', 'grapheme_boundary_before', 

45 'ljust', 'rjust', 'center', 'wrap', 'clip', 'strip_sequences', 

46 'list_versions', 'propagate_sgr', 'Hyperlink', 'HyperlinkParams', 

47 'TextSizing', 'TextSizingParams') 

48 

49# Using 'hatchling', it does not seem to provide the pyproject.toml nicety, "dynamic = ['version']" 

50# like flit_core, maybe there is some better way but for now we have to duplicate it in both places 

51# Prefer the installed distribution version when available (helps test environments) 

52__version__ = '0.7.0' # don't forget to also update pyproject.toml:version