scylla-cqlsh 6.0.30__cp314-cp314-musllinux_1_2_aarch64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- copyutil.cpython-314-aarch64-linux-musl.so +0 -0
- cqlsh/__init__.py +1 -0
- cqlsh/__main__.py +11 -0
- cqlsh/cqlsh.py +2751 -0
- cqlshlib/__init__.py +90 -0
- cqlshlib/_version.py +34 -0
- cqlshlib/authproviderhandling.py +176 -0
- cqlshlib/copyutil.py +2762 -0
- cqlshlib/cql3handling.py +1670 -0
- cqlshlib/cqlhandling.py +333 -0
- cqlshlib/cqlshhandling.py +314 -0
- cqlshlib/displaying.py +128 -0
- cqlshlib/formatting.py +601 -0
- cqlshlib/helptopics.py +190 -0
- cqlshlib/pylexotron.py +562 -0
- cqlshlib/saferscanner.py +91 -0
- cqlshlib/sslhandling.py +109 -0
- cqlshlib/tracing.py +90 -0
- cqlshlib/util.py +183 -0
- cqlshlib/wcwidth.py +379 -0
- scylla_cqlsh-6.0.30.dist-info/METADATA +108 -0
- scylla_cqlsh-6.0.30.dist-info/RECORD +26 -0
- scylla_cqlsh-6.0.30.dist-info/WHEEL +5 -0
- scylla_cqlsh-6.0.30.dist-info/entry_points.txt +2 -0
- scylla_cqlsh-6.0.30.dist-info/licenses/LICENSE.txt +204 -0
- scylla_cqlsh-6.0.30.dist-info/top_level.txt +3 -0
cqlshlib/wcwidth.py
ADDED
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
|
2
|
+
# or more contributor license agreements. See the NOTICE file
|
|
3
|
+
# distributed with this work for additional information
|
|
4
|
+
# regarding copyright ownership. The ASF licenses this file
|
|
5
|
+
# to you under the Apache License, Version 2.0 (the
|
|
6
|
+
# "License"); you may not use this file except in compliance
|
|
7
|
+
# with the License. You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
|
|
17
|
+
# adapted from http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c
|
|
18
|
+
# -thepaul
|
|
19
|
+
|
|
20
|
+
# This is an implementation of wcwidth() and wcswidth() (defined in
|
|
21
|
+
# IEEE Std 1002.1-2001) for Unicode.
|
|
22
|
+
#
|
|
23
|
+
# http://www.opengroup.org/onlinepubs/007904975/functions/wcwidth.html
|
|
24
|
+
# http://www.opengroup.org/onlinepubs/007904975/functions/wcswidth.html
|
|
25
|
+
#
|
|
26
|
+
# In fixed-width output devices, Latin characters all occupy a single
|
|
27
|
+
# "cell" position of equal width, whereas ideographic CJK characters
|
|
28
|
+
# occupy two such cells. Interoperability between terminal-line
|
|
29
|
+
# applications and (teletype-style) character terminals using the
|
|
30
|
+
# UTF-8 encoding requires agreement on which character should advance
|
|
31
|
+
# the cursor by how many cell positions. No established formal
|
|
32
|
+
# standards exist at present on which Unicode character shall occupy
|
|
33
|
+
# how many cell positions on character terminals. These routines are
|
|
34
|
+
# a first attempt of defining such behavior based on simple rules
|
|
35
|
+
# applied to data provided by the Unicode Consortium.
|
|
36
|
+
#
|
|
37
|
+
# For some graphical characters, the Unicode standard explicitly
|
|
38
|
+
# defines a character-cell width via the definition of the East Asian
|
|
39
|
+
# FullWidth (F), Wide (W), Half-width (H), and Narrow (Na) classes.
|
|
40
|
+
# In all these cases, there is no ambiguity about which width a
|
|
41
|
+
# terminal shall use. For characters in the East Asian Ambiguous (A)
|
|
42
|
+
# class, the width choice depends purely on a preference of backward
|
|
43
|
+
# compatibility with either historic CJK or Western practice.
|
|
44
|
+
# Choosing single-width for these characters is easy to justify as
|
|
45
|
+
# the appropriate long-term solution, as the CJK practice of
|
|
46
|
+
# displaying these characters as double-width comes from historic
|
|
47
|
+
# implementation simplicity (8-bit encoded characters were displayed
|
|
48
|
+
# single-width and 16-bit ones double-width, even for Greek,
|
|
49
|
+
# Cyrillic, etc.) and not any typographic considerations.
|
|
50
|
+
#
|
|
51
|
+
# Much less clear is the choice of width for the Not East Asian
|
|
52
|
+
# (Neutral) class. Existing practice does not dictate a width for any
|
|
53
|
+
# of these characters. It would nevertheless make sense
|
|
54
|
+
# typographically to allocate two character cells to characters such
|
|
55
|
+
# as for instance EM SPACE or VOLUME INTEGRAL, which cannot be
|
|
56
|
+
# represented adequately with a single-width glyph. The following
|
|
57
|
+
# routines at present merely assign a single-cell width to all
|
|
58
|
+
# neutral characters, in the interest of simplicity. This is not
|
|
59
|
+
# entirely satisfactory and should be reconsidered before
|
|
60
|
+
# establishing a formal standard in this area. At the moment, the
|
|
61
|
+
# decision which Not East Asian (Neutral) characters should be
|
|
62
|
+
# represented by double-width glyphs cannot yet be answered by
|
|
63
|
+
# applying a simple rule from the Unicode database content. Setting
|
|
64
|
+
# up a proper standard for the behavior of UTF-8 character terminals
|
|
65
|
+
# will require a careful analysis not only of each Unicode character,
|
|
66
|
+
# but also of each presentation form, something the author of these
|
|
67
|
+
# routines has avoided to do so far.
|
|
68
|
+
#
|
|
69
|
+
# http://www.unicode.org/unicode/reports/tr11/
|
|
70
|
+
#
|
|
71
|
+
# Markus Kuhn -- 2007-05-26 (Unicode 5.0)
|
|
72
|
+
#
|
|
73
|
+
# Permission to use, copy, modify, and distribute this software
|
|
74
|
+
# for any purpose and without fee is hereby granted. The author
|
|
75
|
+
# disclaims all warranties with regard to this software.
|
|
76
|
+
#
|
|
77
|
+
# Latest C version: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c
|
|
78
|
+
|
|
79
|
+
# auxiliary function for binary search in interval table
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def bisearch(ucs, table):
|
|
83
|
+
min = 0
|
|
84
|
+
max = len(table) - 1
|
|
85
|
+
if ucs < table[0][0] or ucs > table[max][1]:
|
|
86
|
+
return 0
|
|
87
|
+
while max >= min:
|
|
88
|
+
mid = int((min + max) / 2)
|
|
89
|
+
if ucs > table[mid][1]:
|
|
90
|
+
min = mid + 1
|
|
91
|
+
elif ucs < table[mid][0]:
|
|
92
|
+
max = mid - 1
|
|
93
|
+
else:
|
|
94
|
+
return 1
|
|
95
|
+
return 0
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
# The following two functions define the column width of an ISO 10646
|
|
99
|
+
# character as follows:
|
|
100
|
+
#
|
|
101
|
+
# - The null character (U+0000) has a column width of 0.
|
|
102
|
+
#
|
|
103
|
+
# - Other C0/C1 control characters and DEL will lead to a return
|
|
104
|
+
# value of -1.
|
|
105
|
+
#
|
|
106
|
+
# - Non-spacing and enclosing combining characters (general
|
|
107
|
+
# category code Mn or Me in the Unicode database) have a
|
|
108
|
+
# column width of 0.
|
|
109
|
+
#
|
|
110
|
+
# - SOFT HYPHEN (U+00AD) has a column width of 1.
|
|
111
|
+
#
|
|
112
|
+
# - Other format characters (general category code Cf in the Unicode
|
|
113
|
+
# database) and ZERO WIDTH SPACE (U+200B) have a column width of 0.
|
|
114
|
+
#
|
|
115
|
+
# - Hangul Jamo medial vowels and final consonants (U+1160-U+11FF)
|
|
116
|
+
# have a column width of 0.
|
|
117
|
+
#
|
|
118
|
+
# - Spacing characters in the East Asian Wide (W) or East Asian
|
|
119
|
+
# Full-width (F) category as defined in Unicode Technical
|
|
120
|
+
# Report #11 have a column width of 2.
|
|
121
|
+
#
|
|
122
|
+
# - All remaining characters (including all printable
|
|
123
|
+
# ISO 8859-1 and WGL4 characters, Unicode control characters,
|
|
124
|
+
# etc.) have a column width of 1.
|
|
125
|
+
#
|
|
126
|
+
# This implementation assumes that wchar_t characters are encoded
|
|
127
|
+
# in ISO 10646.
|
|
128
|
+
|
|
129
|
+
# sorted list of non-overlapping intervals of non-spacing characters
|
|
130
|
+
# generated by "uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B c"
|
|
131
|
+
combining = (
|
|
132
|
+
(0x0300, 0x036F), (0x0483, 0x0486), (0x0488, 0x0489),
|
|
133
|
+
(0x0591, 0x05BD), (0x05BF, 0x05BF), (0x05C1, 0x05C2),
|
|
134
|
+
(0x05C4, 0x05C5), (0x05C7, 0x05C7), (0x0600, 0x0603),
|
|
135
|
+
(0x0610, 0x0615), (0x064B, 0x065E), (0x0670, 0x0670),
|
|
136
|
+
(0x06D6, 0x06E4), (0x06E7, 0x06E8), (0x06EA, 0x06ED),
|
|
137
|
+
(0x070F, 0x070F), (0x0711, 0x0711), (0x0730, 0x074A),
|
|
138
|
+
(0x07A6, 0x07B0), (0x07EB, 0x07F3), (0x0901, 0x0902),
|
|
139
|
+
(0x093C, 0x093C), (0x0941, 0x0948), (0x094D, 0x094D),
|
|
140
|
+
(0x0951, 0x0954), (0x0962, 0x0963), (0x0981, 0x0981),
|
|
141
|
+
(0x09BC, 0x09BC), (0x09C1, 0x09C4), (0x09CD, 0x09CD),
|
|
142
|
+
(0x09E2, 0x09E3), (0x0A01, 0x0A02), (0x0A3C, 0x0A3C),
|
|
143
|
+
(0x0A41, 0x0A42), (0x0A47, 0x0A48), (0x0A4B, 0x0A4D),
|
|
144
|
+
(0x0A70, 0x0A71), (0x0A81, 0x0A82), (0x0ABC, 0x0ABC),
|
|
145
|
+
(0x0AC1, 0x0AC5), (0x0AC7, 0x0AC8), (0x0ACD, 0x0ACD),
|
|
146
|
+
(0x0AE2, 0x0AE3), (0x0B01, 0x0B01), (0x0B3C, 0x0B3C),
|
|
147
|
+
(0x0B3F, 0x0B3F), (0x0B41, 0x0B43), (0x0B4D, 0x0B4D),
|
|
148
|
+
(0x0B56, 0x0B56), (0x0B82, 0x0B82), (0x0BC0, 0x0BC0),
|
|
149
|
+
(0x0BCD, 0x0BCD), (0x0C3E, 0x0C40), (0x0C46, 0x0C48),
|
|
150
|
+
(0x0C4A, 0x0C4D), (0x0C55, 0x0C56), (0x0CBC, 0x0CBC),
|
|
151
|
+
(0x0CBF, 0x0CBF), (0x0CC6, 0x0CC6), (0x0CCC, 0x0CCD),
|
|
152
|
+
(0x0CE2, 0x0CE3), (0x0D41, 0x0D43), (0x0D4D, 0x0D4D),
|
|
153
|
+
(0x0DCA, 0x0DCA), (0x0DD2, 0x0DD4), (0x0DD6, 0x0DD6),
|
|
154
|
+
(0x0E31, 0x0E31), (0x0E34, 0x0E3A), (0x0E47, 0x0E4E),
|
|
155
|
+
(0x0EB1, 0x0EB1), (0x0EB4, 0x0EB9), (0x0EBB, 0x0EBC),
|
|
156
|
+
(0x0EC8, 0x0ECD), (0x0F18, 0x0F19), (0x0F35, 0x0F35),
|
|
157
|
+
(0x0F37, 0x0F37), (0x0F39, 0x0F39), (0x0F71, 0x0F7E),
|
|
158
|
+
(0x0F80, 0x0F84), (0x0F86, 0x0F87), (0x0F90, 0x0F97),
|
|
159
|
+
(0x0F99, 0x0FBC), (0x0FC6, 0x0FC6), (0x102D, 0x1030),
|
|
160
|
+
(0x1032, 0x1032), (0x1036, 0x1037), (0x1039, 0x1039),
|
|
161
|
+
(0x1058, 0x1059), (0x1160, 0x11FF), (0x135F, 0x135F),
|
|
162
|
+
(0x1712, 0x1714), (0x1732, 0x1734), (0x1752, 0x1753),
|
|
163
|
+
(0x1772, 0x1773), (0x17B4, 0x17B5), (0x17B7, 0x17BD),
|
|
164
|
+
(0x17C6, 0x17C6), (0x17C9, 0x17D3), (0x17DD, 0x17DD),
|
|
165
|
+
(0x180B, 0x180D), (0x18A9, 0x18A9), (0x1920, 0x1922),
|
|
166
|
+
(0x1927, 0x1928), (0x1932, 0x1932), (0x1939, 0x193B),
|
|
167
|
+
(0x1A17, 0x1A18), (0x1B00, 0x1B03), (0x1B34, 0x1B34),
|
|
168
|
+
(0x1B36, 0x1B3A), (0x1B3C, 0x1B3C), (0x1B42, 0x1B42),
|
|
169
|
+
(0x1B6B, 0x1B73), (0x1DC0, 0x1DCA), (0x1DFE, 0x1DFF),
|
|
170
|
+
(0x200B, 0x200F), (0x202A, 0x202E), (0x2060, 0x2063),
|
|
171
|
+
(0x206A, 0x206F), (0x20D0, 0x20EF), (0x302A, 0x302F),
|
|
172
|
+
(0x3099, 0x309A), (0xA806, 0xA806), (0xA80B, 0xA80B),
|
|
173
|
+
(0xA825, 0xA826), (0xFB1E, 0xFB1E), (0xFE00, 0xFE0F),
|
|
174
|
+
(0xFE20, 0xFE23), (0xFEFF, 0xFEFF), (0xFFF9, 0xFFFB),
|
|
175
|
+
(0x10A01, 0x10A03), (0x10A05, 0x10A06), (0x10A0C, 0x10A0F),
|
|
176
|
+
(0x10A38, 0x10A3A), (0x10A3F, 0x10A3F), (0x1D167, 0x1D169),
|
|
177
|
+
(0x1D173, 0x1D182), (0x1D185, 0x1D18B), (0x1D1AA, 0x1D1AD),
|
|
178
|
+
(0x1D242, 0x1D244), (0xE0001, 0xE0001), (0xE0020, 0xE007F),
|
|
179
|
+
(0xE0100, 0xE01EF)
|
|
180
|
+
)
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
# sorted list of non-overlapping intervals of East Asian Ambiguous
|
|
184
|
+
# characters, generated by "uniset +WIDTH-A -cat=Me -cat=Mn -cat=Cf c"
|
|
185
|
+
ambiguous = (
|
|
186
|
+
(0x00A1, 0x00A1), (0x00A4, 0x00A4), (0x00A7, 0x00A8),
|
|
187
|
+
(0x00AA, 0x00AA), (0x00AE, 0x00AE), (0x00B0, 0x00B4),
|
|
188
|
+
(0x00B6, 0x00BA), (0x00BC, 0x00BF), (0x00C6, 0x00C6),
|
|
189
|
+
(0x00D0, 0x00D0), (0x00D7, 0x00D8), (0x00DE, 0x00E1),
|
|
190
|
+
(0x00E6, 0x00E6), (0x00E8, 0x00EA), (0x00EC, 0x00ED),
|
|
191
|
+
(0x00F0, 0x00F0), (0x00F2, 0x00F3), (0x00F7, 0x00FA),
|
|
192
|
+
(0x00FC, 0x00FC), (0x00FE, 0x00FE), (0x0101, 0x0101),
|
|
193
|
+
(0x0111, 0x0111), (0x0113, 0x0113), (0x011B, 0x011B),
|
|
194
|
+
(0x0126, 0x0127), (0x012B, 0x012B), (0x0131, 0x0133),
|
|
195
|
+
(0x0138, 0x0138), (0x013F, 0x0142), (0x0144, 0x0144),
|
|
196
|
+
(0x0148, 0x014B), (0x014D, 0x014D), (0x0152, 0x0153),
|
|
197
|
+
(0x0166, 0x0167), (0x016B, 0x016B), (0x01CE, 0x01CE),
|
|
198
|
+
(0x01D0, 0x01D0), (0x01D2, 0x01D2), (0x01D4, 0x01D4),
|
|
199
|
+
(0x01D6, 0x01D6), (0x01D8, 0x01D8), (0x01DA, 0x01DA),
|
|
200
|
+
(0x01DC, 0x01DC), (0x0251, 0x0251), (0x0261, 0x0261),
|
|
201
|
+
(0x02C4, 0x02C4), (0x02C7, 0x02C7), (0x02C9, 0x02CB),
|
|
202
|
+
(0x02CD, 0x02CD), (0x02D0, 0x02D0), (0x02D8, 0x02DB),
|
|
203
|
+
(0x02DD, 0x02DD), (0x02DF, 0x02DF), (0x0391, 0x03A1),
|
|
204
|
+
(0x03A3, 0x03A9), (0x03B1, 0x03C1), (0x03C3, 0x03C9),
|
|
205
|
+
(0x0401, 0x0401), (0x0410, 0x044F), (0x0451, 0x0451),
|
|
206
|
+
(0x2010, 0x2010), (0x2013, 0x2016), (0x2018, 0x2019),
|
|
207
|
+
(0x201C, 0x201D), (0x2020, 0x2022), (0x2024, 0x2027),
|
|
208
|
+
(0x2030, 0x2030), (0x2032, 0x2033), (0x2035, 0x2035),
|
|
209
|
+
(0x203B, 0x203B), (0x203E, 0x203E), (0x2074, 0x2074),
|
|
210
|
+
(0x207F, 0x207F), (0x2081, 0x2084), (0x20AC, 0x20AC),
|
|
211
|
+
(0x2103, 0x2103), (0x2105, 0x2105), (0x2109, 0x2109),
|
|
212
|
+
(0x2113, 0x2113), (0x2116, 0x2116), (0x2121, 0x2122),
|
|
213
|
+
(0x2126, 0x2126), (0x212B, 0x212B), (0x2153, 0x2154),
|
|
214
|
+
(0x215B, 0x215E), (0x2160, 0x216B), (0x2170, 0x2179),
|
|
215
|
+
(0x2190, 0x2199), (0x21B8, 0x21B9), (0x21D2, 0x21D2),
|
|
216
|
+
(0x21D4, 0x21D4), (0x21E7, 0x21E7), (0x2200, 0x2200),
|
|
217
|
+
(0x2202, 0x2203), (0x2207, 0x2208), (0x220B, 0x220B),
|
|
218
|
+
(0x220F, 0x220F), (0x2211, 0x2211), (0x2215, 0x2215),
|
|
219
|
+
(0x221A, 0x221A), (0x221D, 0x2220), (0x2223, 0x2223),
|
|
220
|
+
(0x2225, 0x2225), (0x2227, 0x222C), (0x222E, 0x222E),
|
|
221
|
+
(0x2234, 0x2237), (0x223C, 0x223D), (0x2248, 0x2248),
|
|
222
|
+
(0x224C, 0x224C), (0x2252, 0x2252), (0x2260, 0x2261),
|
|
223
|
+
(0x2264, 0x2267), (0x226A, 0x226B), (0x226E, 0x226F),
|
|
224
|
+
(0x2282, 0x2283), (0x2286, 0x2287), (0x2295, 0x2295),
|
|
225
|
+
(0x2299, 0x2299), (0x22A5, 0x22A5), (0x22BF, 0x22BF),
|
|
226
|
+
(0x2312, 0x2312), (0x2460, 0x24E9), (0x24EB, 0x254B),
|
|
227
|
+
(0x2550, 0x2573), (0x2580, 0x258F), (0x2592, 0x2595),
|
|
228
|
+
(0x25A0, 0x25A1), (0x25A3, 0x25A9), (0x25B2, 0x25B3),
|
|
229
|
+
(0x25B6, 0x25B7), (0x25BC, 0x25BD), (0x25C0, 0x25C1),
|
|
230
|
+
(0x25C6, 0x25C8), (0x25CB, 0x25CB), (0x25CE, 0x25D1),
|
|
231
|
+
(0x25E2, 0x25E5), (0x25EF, 0x25EF), (0x2605, 0x2606),
|
|
232
|
+
(0x2609, 0x2609), (0x260E, 0x260F), (0x2614, 0x2615),
|
|
233
|
+
(0x261C, 0x261C), (0x261E, 0x261E), (0x2640, 0x2640),
|
|
234
|
+
(0x2642, 0x2642), (0x2660, 0x2661), (0x2663, 0x2665),
|
|
235
|
+
(0x2667, 0x266A), (0x266C, 0x266D), (0x266F, 0x266F),
|
|
236
|
+
(0x273D, 0x273D), (0x2776, 0x277F), (0xE000, 0xF8FF),
|
|
237
|
+
(0xFFFD, 0xFFFD), (0xF0000, 0xFFFFD), (0x100000, 0x10FFFD)
|
|
238
|
+
)
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
def mk_wcwidth(ucs):
|
|
242
|
+
# test for 8-bit control characters
|
|
243
|
+
if ucs == 0:
|
|
244
|
+
return 0
|
|
245
|
+
if ucs < 32 or (ucs >= 0x7f and ucs < 0xa0):
|
|
246
|
+
return -1
|
|
247
|
+
|
|
248
|
+
# binary search in table of non-spacing characters
|
|
249
|
+
if bisearch(ucs, combining):
|
|
250
|
+
return 0
|
|
251
|
+
|
|
252
|
+
# if we arrive here, ucs is not a combining or C0/C1 control character
|
|
253
|
+
|
|
254
|
+
return 1 + int(
|
|
255
|
+
ucs >= 0x1100
|
|
256
|
+
and (ucs <= 0x115f # Hangul Jamo init. consonants
|
|
257
|
+
or ucs == 0x2329 or ucs == 0x232a
|
|
258
|
+
or (ucs >= 0x2e80 and ucs <= 0xa4cf
|
|
259
|
+
and ucs != 0x303f) # CJK ... Yi
|
|
260
|
+
or (ucs >= 0xac00 and ucs <= 0xd7a3) # Hangul Syllables
|
|
261
|
+
or (ucs >= 0xf900 and ucs <= 0xfaff) # CJK Compatibility Ideographs
|
|
262
|
+
or (ucs >= 0xfe10 and ucs <= 0xfe19) # Vertical forms
|
|
263
|
+
or (ucs >= 0xfe30 and ucs <= 0xfe6f) # CJK Compatibility Forms
|
|
264
|
+
or (ucs >= 0xff00 and ucs <= 0xff60) # Fullwidth Forms
|
|
265
|
+
or (ucs >= 0xffe0 and ucs <= 0xffe6)
|
|
266
|
+
or (ucs >= 0x20000 and ucs <= 0x2fffd)
|
|
267
|
+
or (ucs >= 0x30000 and ucs <= 0x3fffd))
|
|
268
|
+
)
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
def mk_wcswidth(pwcs):
|
|
272
|
+
width = 0
|
|
273
|
+
for c in pwcs:
|
|
274
|
+
w = mk_wcwidth(c)
|
|
275
|
+
if w < 0:
|
|
276
|
+
return -1
|
|
277
|
+
else:
|
|
278
|
+
width += w
|
|
279
|
+
|
|
280
|
+
return width
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
# The following functions are the same as mk_wcwidth() and
|
|
284
|
+
# mk_wcswidth(), except that spacing characters in the East Asian
|
|
285
|
+
# Ambiguous (A) category as defined in Unicode Technical Report #11
|
|
286
|
+
# have a column width of 2. This variant might be useful for users of
|
|
287
|
+
# CJK legacy encodings who want to migrate to UCS without changing
|
|
288
|
+
# the traditional terminal character-width behaviour. It is not
|
|
289
|
+
# otherwise recommended for general use.
|
|
290
|
+
def mk_wcwidth_cjk(ucs):
|
|
291
|
+
# binary search in table of non-spacing characters
|
|
292
|
+
if bisearch(ucs, ambiguous):
|
|
293
|
+
return 2
|
|
294
|
+
|
|
295
|
+
return mk_wcwidth(ucs)
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
def mk_wcswidth_cjk(pwcs):
|
|
299
|
+
width = 0
|
|
300
|
+
|
|
301
|
+
for c in pwcs:
|
|
302
|
+
w = mk_wcwidth_cjk(c)
|
|
303
|
+
if w < 0:
|
|
304
|
+
return -1
|
|
305
|
+
width += w
|
|
306
|
+
|
|
307
|
+
return width
|
|
308
|
+
|
|
309
|
+
# python-y versions, dealing with unicode objects
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
def wcwidth(c):
|
|
313
|
+
return mk_wcwidth(ord(c))
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
def wcswidth(s):
|
|
317
|
+
return mk_wcswidth(list(map(ord, s)))
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
def wcwidth_cjk(c):
|
|
321
|
+
return mk_wcwidth_cjk(ord(c))
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
def wcswidth_cjk(s):
|
|
325
|
+
return mk_wcswidth_cjk(list(map(ord, s)))
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
if __name__ == "__main__":
|
|
329
|
+
samples = (
|
|
330
|
+
('MUSIC SHARP SIGN', 1),
|
|
331
|
+
('FULLWIDTH POUND SIGN', 2),
|
|
332
|
+
('FULLWIDTH LATIN CAPITAL LETTER P', 2),
|
|
333
|
+
('CJK RADICAL BOLT OF CLOTH', 2),
|
|
334
|
+
('LATIN SMALL LETTER A', 1),
|
|
335
|
+
('LATIN SMALL LETTER AE', 1),
|
|
336
|
+
('SPACE', 1),
|
|
337
|
+
('NO-BREAK SPACE', 1),
|
|
338
|
+
('CJK COMPATIBILITY IDEOGRAPH-F920', 2),
|
|
339
|
+
('MALAYALAM VOWEL SIGN UU', 0),
|
|
340
|
+
('ZERO WIDTH SPACE', 0),
|
|
341
|
+
('ZERO WIDTH NO-BREAK SPACE', 0),
|
|
342
|
+
('COMBINING PALATALIZED HOOK BELOW', 0),
|
|
343
|
+
('COMBINING GRAVE ACCENT', 0),
|
|
344
|
+
)
|
|
345
|
+
nonprinting = '\r\n\t\a\b\f\v\x7f'
|
|
346
|
+
|
|
347
|
+
import unicodedata
|
|
348
|
+
|
|
349
|
+
for name, printwidth in samples:
|
|
350
|
+
uchr = unicodedata.lookup(name)
|
|
351
|
+
calculatedwidth = wcwidth(uchr)
|
|
352
|
+
assert calculatedwidth == printwidth, \
|
|
353
|
+
'width for %r should be %d, but is %d?' % (uchr, printwidth, calculatedwidth)
|
|
354
|
+
|
|
355
|
+
for c in nonprinting:
|
|
356
|
+
calculatedwidth = wcwidth(c)
|
|
357
|
+
assert calculatedwidth < 0, \
|
|
358
|
+
'%r is a control character, but wcwidth gives %d' % (c, calculatedwidth)
|
|
359
|
+
|
|
360
|
+
assert wcwidth('\0') == 0 # special case
|
|
361
|
+
|
|
362
|
+
# depending on how python is compiled, code points above U+FFFF may not be
|
|
363
|
+
# treated as single characters, so ord() won't work. test a few of these
|
|
364
|
+
# manually.
|
|
365
|
+
|
|
366
|
+
assert mk_wcwidth(0xe01ef) == 0
|
|
367
|
+
assert mk_wcwidth(0x10ffff) == 1
|
|
368
|
+
assert mk_wcwidth(0x3fffd) == 2
|
|
369
|
+
|
|
370
|
+
teststr = 'B\0ig br\u00f8wn moose\ub143\u200b'
|
|
371
|
+
calculatedwidth = wcswidth(teststr)
|
|
372
|
+
assert calculatedwidth == 17, 'expected 17, got %d' % calculatedwidth
|
|
373
|
+
|
|
374
|
+
calculatedwidth = wcswidth_cjk(teststr)
|
|
375
|
+
assert calculatedwidth == 18, 'expected 18, got %d' % calculatedwidth
|
|
376
|
+
|
|
377
|
+
assert wcswidth('foobar\u200b\a') < 0
|
|
378
|
+
|
|
379
|
+
print('tests pass.')
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: scylla-cqlsh
|
|
3
|
+
Version: 6.0.30
|
|
4
|
+
Summary: cqlsh is a Python-based command-line client for running CQL commands on a scylla cluster.
|
|
5
|
+
Home-page: https://github.com/scylladb/scylla-cqlsh
|
|
6
|
+
Author: Israel Fruchter
|
|
7
|
+
Author-email: fruch@scylladb.com
|
|
8
|
+
License: Apache
|
|
9
|
+
Project-URL: Changelog, https://github.com/scylladb/scylla-cqlsh#changelog
|
|
10
|
+
Project-URL: Documentation, https://cassandra.apache.org/doc/latest/tools/cqlsh.html
|
|
11
|
+
Keywords: cql,scylladb,cassandra,cqlsh
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Topic :: Database :: Front-Ends
|
|
15
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Requires-Python: >=3.6
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE.txt
|
|
20
|
+
Requires-Dist: scylla-driver>=3.25.10
|
|
21
|
+
Requires-Dist: lz4
|
|
22
|
+
Dynamic: classifier
|
|
23
|
+
Dynamic: license
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
Dynamic: requires-dist
|
|
26
|
+
|
|
27
|
+
# scylla-cqlsh
|
|
28
|
+
|
|
29
|
+
Command line tool to connect to [scylladb](http://www.scylladb.com) (or Apache Cassandra)
|
|
30
|
+
|
|
31
|
+
A fork of the cqlsh tool from https://github.com/apache/cassandra
|
|
32
|
+
|
|
33
|
+

|
|
34
|
+

|
|
35
|
+

|
|
36
|
+
|
|
37
|
+
# Quickstart
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pip install scylla-cqlsh
|
|
41
|
+
|
|
42
|
+
cqlsh ${SCYLLA_HOST} -e 'SELECT * FROM system.local'
|
|
43
|
+
|
|
44
|
+
# or just using it interactively
|
|
45
|
+
cqlsh ${SCYLLA_HOST}
|
|
46
|
+
|
|
47
|
+
# running with docker image interactively
|
|
48
|
+
docker run -it scylladb/scylla-cqlsh ${SCYLLA_HOST}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
# Contributing
|
|
54
|
+
|
|
55
|
+
Feel free to open a PR/issues with suggestion and improvement
|
|
56
|
+
Try covering you suggested change with a test, and the instruction
|
|
57
|
+
for running tests are below
|
|
58
|
+
|
|
59
|
+
## Testing
|
|
60
|
+
|
|
61
|
+
Dependent
|
|
62
|
+
* python 2.7/3.x (recommend virtualenv)
|
|
63
|
+
* minimum java8
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
pip install -e .
|
|
67
|
+
pip install -r pylib/requirements.txt
|
|
68
|
+
|
|
69
|
+
# run scylla with docker
|
|
70
|
+
docker run -d scylladb/scylla:latest --cluster-name test
|
|
71
|
+
|
|
72
|
+
export DOCKER_ID=$(docker run -d scylladb/scylla:latest --cluster-name test)
|
|
73
|
+
export CQL_TEST_HOST=$(docker inspect --format='{{ .NetworkSettings.IPAddress }}' ${DOCKER_ID})
|
|
74
|
+
while ! nc -z ${CQL_TEST_HOST} 9042; do
|
|
75
|
+
sleep 0.1 # wait for 1/10 of the second before check again
|
|
76
|
+
done
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
# run scylla with CCM
|
|
80
|
+
ccm create cqlsh_cluster -n 1 --scylla --version unstable/master:latest
|
|
81
|
+
ccm start
|
|
82
|
+
|
|
83
|
+
pytest
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Build from source
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
pip install build
|
|
90
|
+
# optionally can disable the usage of cython
|
|
91
|
+
# export CQLSH_NO_CYTHON=true
|
|
92
|
+
python -m build -w
|
|
93
|
+
...
|
|
94
|
+
Successfully built scylla_cqlsh-6.0.24.dev0+gb09bc79361.d20240910-py3-none-any.whl
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Creation of the repo
|
|
98
|
+
|
|
99
|
+
A reference on how this we forked out of cassandra repo
|
|
100
|
+
So we can repeat the process if we want to bring change back it
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
git clone -b trunk --single-branch git@github.com:apache/cassandra.git
|
|
104
|
+
sudo apt-get install git-filter-repo
|
|
105
|
+
cd cassandra
|
|
106
|
+
|
|
107
|
+
git filter-repo --path bin/cqlsh --path bin/cqlsh.py --path pylib/
|
|
108
|
+
```
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
copyutil.cpython-314-aarch64-linux-musl.so,sha256=JYTJK9JtTxEaejz3tESppPOQad7xR53dgxNrB2IQJUI,7506464
|
|
2
|
+
cqlsh/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
3
|
+
cqlsh/__main__.py,sha256=-IR7kYVwXf9uq9OBeVlAB5I386E1N9iEhrjn3sCw-74,220
|
|
4
|
+
cqlsh/cqlsh.py,sha256=cmqGD3jWoz6aeR0LdvcWzezO7bimp6icGHBl9DtTjIk,113178
|
|
5
|
+
cqlshlib/__init__.py,sha256=IhAMRujMv3XMvwQcYhUyXvJtWYuHpI-WfnIookmRago,3184
|
|
6
|
+
cqlshlib/_version.py,sha256=h1A84iVWad_nUgWTkZxKbUJbA6dMwZ4BSnVHNmBQIn0,714
|
|
7
|
+
cqlshlib/authproviderhandling.py,sha256=p4r_sk64AC5eiv__n-gjwQk2Ni_CcK6lyAWSKEcgINs,7078
|
|
8
|
+
cqlshlib/copyutil.py,sha256=ui7F3V6AtLVjSGNSIGykRPoyjtwQZwUpGjnmJ4BzbmQ,113646
|
|
9
|
+
cqlshlib/cql3handling.py,sha256=1jCmmWk_f8XtJhTOug8uftxhuMzGP3RDYVJtOAE5cXE,59297
|
|
10
|
+
cqlshlib/cqlhandling.py,sha256=J-zzfU8sj0GbX-5vh5uV1gmFAYD_WOBsnVgd9PMaHoc,13103
|
|
11
|
+
cqlshlib/cqlshhandling.py,sha256=BUu9wi7H1Xgil9lci-48TCPQ1xwe2-OTNXsW7jiewlM,10510
|
|
12
|
+
cqlshlib/displaying.py,sha256=bsA7T4BwQHgtH4jzCJeU3JrpgMT5k0xZ7EA2AnhYG7g,3977
|
|
13
|
+
cqlshlib/formatting.py,sha256=NBHxsrXS3X8qcGewn98iTP7ys3JQUvWGf9iIWk-ErL0,23032
|
|
14
|
+
cqlshlib/helptopics.py,sha256=bBPtNHn2ySgO9K4nFBpJw2gcibryIdRh7dm3b9TUubQ,4524
|
|
15
|
+
cqlshlib/pylexotron.py,sha256=QY3nZ-fP-yGFIixMV33IgMlKV8A51AxnNYya0PGZc6I,19273
|
|
16
|
+
cqlshlib/saferscanner.py,sha256=T4eSYVWuZf4piTS9PgHjFhuY6g1fOb4VVa1Bu4Y1v_I,3539
|
|
17
|
+
cqlshlib/sslhandling.py,sha256=TtEib4N-BuL2KZJiGYijc9DQviYp2lzYlwLj4RLp0oQ,4649
|
|
18
|
+
cqlshlib/tracing.py,sha256=ct7siXwNMINjGVXn9qr5h7XhDDM6Bi1uLljPUtcve-A,3403
|
|
19
|
+
cqlshlib/util.py,sha256=qWQmq9v28vZwZ4apzK0-UQOYPIW3TMk-Jq9I69LbW0k,5057
|
|
20
|
+
cqlshlib/wcwidth.py,sha256=PsbF7OaDlLItaiV6niu8F_OOgVYLJo0Ypb5-cOJV3QY,15865
|
|
21
|
+
scylla_cqlsh-6.0.30.dist-info/METADATA,sha256=7RQsyRYkkz-xHJpDCC1uZpHNA6tNs9gkg_MUF4GyRPI,3057
|
|
22
|
+
scylla_cqlsh-6.0.30.dist-info/WHEEL,sha256=YkrrUEsfsMGYhv0j9OET9fyyb_PAeJ2gXOscdwOjcyo,113
|
|
23
|
+
scylla_cqlsh-6.0.30.dist-info/entry_points.txt,sha256=oE4unqgR3WwNkCJDGlMG1HYtCE3nEZZ4d9CIl-JSZyQ,46
|
|
24
|
+
scylla_cqlsh-6.0.30.dist-info/top_level.txt,sha256=PVG-5w7PDG3FoAJH6Rq2I8C0y4cKa2KOW75GxjHkmQ4,24
|
|
25
|
+
scylla_cqlsh-6.0.30.dist-info/RECORD,,
|
|
26
|
+
scylla_cqlsh-6.0.30.dist-info/licenses/LICENSE.txt,sha256=JAuKOf39K9OzU5wC40RmM0iE_ISwVrV_BunaNTI-zZc,11360
|