scylla-cqlsh 6.0.24__cp311-cp311-musllinux_1_2_x86_64.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.

Potentially problematic release.


This version of scylla-cqlsh might be problematic. Click here for more details.

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,204 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
203
+
204
+
@@ -0,0 +1,109 @@
1
+ Metadata-Version: 2.2
2
+ Name: scylla-cqlsh
3
+ Version: 6.0.24
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
+ Dynamic: classifier
22
+ Dynamic: license
23
+ Dynamic: requires-dist
24
+
25
+ # scylla-cqlsh
26
+
27
+ Command line tool to connect to [scylladb](http://www.scylladb.com) (or Apache Cassandra)
28
+
29
+ A fork of the cqlsh tool from https://github.com/apache/cassandra
30
+
31
+ ![Libraries.io dependency status for latest release](https://img.shields.io/librariesio/release/pypi/scylla-cqlsh)
32
+ ![GitHub branch checks state](https://img.shields.io/github/checks-status/scylladb/scylla-cqlsh/master)
33
+ ![PyPI](https://img.shields.io/pypi/v/scylla-cqlsh)
34
+
35
+ # Quickstart
36
+
37
+ ```bash
38
+ pip install scylla-cqlsh
39
+
40
+ cqlsh ${SCYLLA_HOST} -e 'SELECT * FROM system.local'
41
+
42
+ # or just using it interactively
43
+ cqlsh ${SCYLLA_HOST}
44
+
45
+ # or using it with scylla-cloud
46
+ cqlsh --cloudconf [path to connection bundle downloaded]
47
+
48
+ # running with docker image interactively
49
+ docker run -it scylladb/scylla-cqlsh ${SCYLLA_HOST}
50
+ ```
51
+
52
+
53
+
54
+ # Contributing
55
+
56
+ Feel free to open a PR/issues with suggestion and improvement
57
+ Try covering you suggested change with a test, and the instruction
58
+ for running tests are below
59
+
60
+ ## Testing
61
+
62
+ Dependent
63
+ * python 2.7/3.x (recommend virtualenv)
64
+ * minimum java8
65
+
66
+ ```bash
67
+ pip install -e .
68
+ pip install -r pylib/requirements.txt
69
+
70
+ # run scylla with docker
71
+ docker run -d scylladb/scylla:latest --cluster-name test
72
+
73
+ export DOCKER_ID=$(docker run -d scylladb/scylla:latest --cluster-name test)
74
+ export CQL_TEST_HOST=$(docker inspect --format='{{ .NetworkSettings.IPAddress }}' ${DOCKER_ID})
75
+ while ! nc -z ${CQL_TEST_HOST} 9042; do
76
+ sleep 0.1 # wait for 1/10 of the second before check again
77
+ done
78
+
79
+
80
+ # run scylla with CCM
81
+ ccm create cqlsh_cluster -n 1 --scylla --version unstable/master:latest
82
+ ccm start
83
+
84
+ pytest
85
+ ```
86
+
87
+ ## Build from source
88
+
89
+ ```bash
90
+ pip install build
91
+ # optionally can disable the usage of cython
92
+ # export CQLSH_NO_CYTHON=true
93
+ python -m build -w
94
+ ...
95
+ Successfully built scylla_cqlsh-6.0.24.dev0+gb09bc79361.d20240910-py3-none-any.whl
96
+ ```
97
+
98
+ ## Creation of the repo
99
+
100
+ A reference on how this we forked out of cassandra repo
101
+ So we can repeat the process if we want to bring change back it
102
+
103
+ ```bash
104
+ git clone -b trunk --single-branch git@github.com:apache/cassandra.git
105
+ sudo apt-get install git-filter-repo
106
+ cd cassandra
107
+
108
+ git filter-repo --path bin/cqlsh --path bin/cqlsh.py --path pylib/
109
+ ```