zmc
2023-10-12 ed135d79df12a2466b52dae1a82326941211dcc9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
U
O±d¢ûã @sÂdZddddddddd    g    Zd
Zd d lZd d lZd d lZzd d lmZWn ek
rfd d l    mZYnXd d l
Z ddl m ZddlmZmZmZmZddl mZddlmZmZmZmZmZmZmZddlmZddlmZm Z m!Z!ddl m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(ddl)m*Z*m+Z+d d l,Z,d d l-Z-d d l.Z.dddddddddd ej/d œ Z0dud!d"„Z1e+d#ƒdvd d$œd%d„ƒZ2e+d#ƒd&d„ƒZ3d'd(„Z4e+d#ƒe.j5d)d„ƒƒZ6dwd+d,„Z7d-d.„Z8d/d0„Z9d1d2„Z:d3d4„Z;d5d6„Z<dxd8d9„Z=e=ƒdyd<d=„ƒZ>dzd d$œd>d?„Z?e*e?d#d@d d d d:d;e j@d d d d d d;f d d$œdAd„ƒZAdBdC„ZBdDdE„ZCdFdG„ZDdHdI„ZEGdJdK„dKƒZFe+d#ƒd{dNd    „ƒZGe+d#ƒd|dOd„ƒZHGdPdQ„dQƒZIGdRdS„dSƒZJGdTdU„dUƒZKGdVdW„dWƒZLGdXdY„dYeLƒZMGdZd[„d[eLƒZNGd\d]„d]ƒZOGd^d_„d_ƒZPd`da„ZQe$e%e&e'gZRdbdc„ZSddde„ZTd d d eAfdfdg„ZUd}dhdi„ZVe*eVd#d@d~djd„ƒZWe=ƒdkdl„ƒZXd d d eAfdmdn„ZYddodp„ZZe*eZd#d@d€dqd„ƒZ[e\eAdreAƒZ]ej^eYe]dsZ_ej^eUe]dsZ`ddtd„Zad S)‚zXArray printing function
 
$Id: arrayprint.py,v 1.9 2005/09/13 13:58:44 teoliphant Exp $
 
Ú array2stringÚ    array_strÚ
array_reprÚset_string_functionÚset_printoptionsÚget_printoptionsÚ printoptionsÚformat_float_positionalÚformat_float_scientificZrestructuredtextéN)Ú    get_identé)Ú numerictypes)ÚabsoluteÚisinfÚisfiniteÚisnat)Ú
multiarray)ÚarrayÚdragon4_positionalÚdragon4_scientificÚdatetime_as_stringÚ datetime_dataÚndarrayÚset_legacy_print_mode)Úany)Ú concatenateÚasarrayÚerrstate)ÚlonglongÚintcÚint_Úfloat_Úcomplex_Úbool_Úflexible)Úarray_function_dispatchÚ
set_moduleéièÚmaxprecéFéKÚnanÚinfú-) Ú    edgeitemsÚ    thresholdÚ    floatmodeÚ    precisionÚsuppressÚ    linewidthÚnanstrÚinfstrÚsignÚ    formatterÚlegacyc 
Cs<dd„tƒ ¡Dƒ} |dk    r(t|ƒ| d<ddddg} |    | dgkr^td    d
 d d „| Dƒ¡ƒ‚|d krntdƒ‚|
dkr‚tj| d<n<|
dkr”d| d<n*|
dkr¦d| d<n|
dkr°ntjddd|dk    rìt    |t
j ƒsÚt dƒ‚t  |¡rìtdƒ‚|dk    r8zt |¡| d<Wn.t k
r6} zt dƒ| ‚W5d} ~ XYnX| S)zm
    Make a dictionary out of the non-None arguments, plus conversion of
    *legacy* and sanity checks.
    cSsi|]\}}|dk    r||“qS©N©)Ú.0ÚkÚvr:r:úLd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\numpy/core/arrayprint.pyÚ
<dictcomp>Hsz&_make_options_dict.<locals>.<dictcomp>Nr2ÚfixedÚuniquer(Ú maxprec_equalz floatmode option must be one of ú, css|]}d |¡VqdS)z"{}"N©Úformat)r;Úmr:r:r>Ú    <genexpr>Psz%_make_options_dict.<locals>.<genexpr>)Nr-ú+ú z+sign option must be one of ' ', '+', or '-'Fr8ú1.13éqú1.21éyzGlegacy printing option can currently only be '1.13', '1.21', or `False`r'©Ú
stacklevelzthreshold must be numericzIthreshold must be non-NAN, try sys.maxsize for untruncated representationr1zprecision must be an integer)ÚlocalsÚitemsÚboolÚ
ValueErrorÚjoinÚsysÚmaxsizeÚwarningsÚwarnÚ
isinstanceÚnumbersÚNumberÚ    TypeErrorÚnpÚisnanÚoperatorÚindex)r1r/r.r3r2r4r5r6r7r0r8ÚoptionsÚmodesÚer:r:r>Ú_make_options_dict@sB  ÿ 
 
þ 
 
rdÚnumpy©r8c
 Cs|t||||||||||    |
ƒ } || d<t | ¡tddkrLtdƒdtd<n,tddkrbtdƒntdtjkrxtdƒdS)    a
    Set printing options.
 
    These options determine the way floating point numbers, arrays and
    other NumPy objects are displayed.
 
    Parameters
    ----------
    precision : int or None, optional
        Number of digits of precision for floating point output (default 8).
        May be None if `floatmode` is not `fixed`, to print as many digits as
        necessary to uniquely specify the value.
    threshold : int, optional
        Total number of array elements which trigger summarization
        rather than full repr (default 1000).
        To always use the full repr without summarization, pass `sys.maxsize`.
    edgeitems : int, optional
        Number of array items in summary at beginning and end of
        each dimension (default 3).
    linewidth : int, optional
        The number of characters per line for the purpose of inserting
        line breaks (default 75).
    suppress : bool, optional
        If True, always print floating point numbers using fixed point
        notation, in which case numbers equal to zero in the current precision
        will print as zero.  If False, then scientific notation is used when
        absolute value of the smallest number is < 1e-4 or the ratio of the
        maximum absolute value to the minimum is > 1e3. The default is False.
    nanstr : str, optional
        String representation of floating point not-a-number (default nan).
    infstr : str, optional
        String representation of floating point infinity (default inf).
    sign : string, either '-', '+', or ' ', optional
        Controls printing of the sign of floating-point types. If '+', always
        print the sign of positive values. If ' ', always prints a space
        (whitespace character) in the sign position of positive values.  If
        '-', omit the sign character of positive values. (default '-')
    formatter : dict of callables, optional
        If not None, the keys should indicate the type(s) that the respective
        formatting function applies to.  Callables should return a string.
        Types that are not specified (by their corresponding keys) are handled
        by the default formatters.  Individual types for which a formatter
        can be set are:
 
        - 'bool'
        - 'int'
        - 'timedelta' : a `numpy.timedelta64`
        - 'datetime' : a `numpy.datetime64`
        - 'float'
        - 'longfloat' : 128-bit floats
        - 'complexfloat'
        - 'longcomplexfloat' : composed of two 128-bit floats
        - 'numpystr' : types `numpy.string_` and `numpy.unicode_`
        - 'object' : `np.object_` arrays
 
        Other keys that can be used to set a group of types at once are:
 
        - 'all' : sets all types
        - 'int_kind' : sets 'int'
        - 'float_kind' : sets 'float' and 'longfloat'
        - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat'
        - 'str_kind' : sets 'numpystr'
    floatmode : str, optional
        Controls the interpretation of the `precision` option for
        floating-point types. Can take the following values
        (default maxprec_equal):
 
        * 'fixed': Always print exactly `precision` fractional digits,
                even if this would print more or fewer digits than
                necessary to specify the value uniquely.
        * 'unique': Print the minimum number of fractional digits necessary
                to represent each value uniquely. Different elements may
                have a different number of digits. The value of the
                `precision` option is ignored.
        * 'maxprec': Print at most `precision` fractional digits, but if
                an element can be uniquely represented with fewer digits
                only print it with that many.
        * 'maxprec_equal': Print at most `precision` fractional digits,
                but if every element in the array can be uniquely
                represented with an equal number of fewer digits, use that
                many digits for all elements.
    legacy : string or `False`, optional
        If set to the string `'1.13'` enables 1.13 legacy printing mode. This
        approximates numpy 1.13 print output by including a space in the sign
        position of floats and different behavior for 0d arrays. This also
        enables 1.21 legacy printing mode (described below).
 
        If set to the string `'1.21'` enables 1.21 legacy printing mode. This
        approximates numpy 1.21 print output of complex structured dtypes
        by not inserting spaces after commas that separate fields and after
        colons.
 
        If set to `False`, disables legacy mode.
 
        Unrecognized strings will be ignored with a warning for forward
        compatibility.
 
        .. versionadded:: 1.14.0
        .. versionchanged:: 1.22.0
 
    See Also
    --------
    get_printoptions, printoptions, set_string_function, array2string
 
    Notes
    -----
    `formatter` is always reset with a call to `set_printoptions`.
 
    Use `printoptions` as a context manager to set the values temporarily.
 
    Examples
    --------
    Floating point precision can be set:
 
    >>> np.set_printoptions(precision=4)
    >>> np.array([1.123456789])
    [1.1235]
 
    Long arrays can be summarised:
 
    >>> np.set_printoptions(threshold=5)
    >>> np.arange(10)
    array([0, 1, 2, ..., 7, 8, 9])
 
    Small results can be suppressed:
 
    >>> eps = np.finfo(float).eps
    >>> x = np.arange(4.)
    >>> x**2 - (x + eps)**2
    array([-4.9304e-32, -4.4409e-16,  0.0000e+00,  0.0000e+00])
    >>> np.set_printoptions(suppress=True)
    >>> x**2 - (x + eps)**2
    array([-0., -0.,  0.,  0.])
 
    A custom formatter can be used to display array elements as desired:
 
    >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)})
    >>> x = np.arange(3)
    >>> x
    array([int: 0, int: -1, int: -2])
    >>> np.set_printoptions()  # formatter gets reset
    >>> x
    array([0, 1, 2])
 
    To put back the default options, you can use:
 
    >>> np.set_printoptions(edgeitems=3, infstr='inf',
    ... linewidth=75, nanstr='nan', precision=8,
    ... suppress=False, threshold=1000, formatter=None)
 
    Also to temporarily override options, use `printoptions` as a context manager:
 
    >>> with np.printoptions(precision=2, suppress=True, threshold=5):
    ...     np.linspace(0, 10, 10)
    array([ 0.  ,  1.11,  2.22, ...,  7.78,  8.89, 10.  ])
 
    r7r8rKr-r6rMr
N)rdÚ_format_optionsÚupdaterrUrV) r1r/r.r3r2r4r5r7r6r0r8Úoptr:r:r>rts&"
þ
 
 
cCs*t ¡}ddddtjdi|d|d<|S)a.
    Return the current print options.
 
    Returns
    -------
    print_opts : dict
        Dictionary of current print options with keys
 
          - precision : int
          - threshold : int
          - edgeitems : int
          - linewidth : int
          - suppress : bool
          - nanstr : str
          - infstr : str
          - formatter : dict of callables
          - sign : str
 
        For a full description of these options, see `set_printoptions`.
 
    See Also
    --------
    set_printoptions, printoptions, set_string_function
 
    rKrJrMrLFr8)rgÚcopyrUrV)Úoptsr:r:r>r'sÿþcCstdS)z'Return the legacy print mode as an int.r8)rgr:r:r:r>Ú_get_legacy_print_modeIsrlc    os6t ¡}ztj||Žt ¡VW5tjf|ŽXdS)aƒContext manager for setting print options.
 
    Set print options for the scope of the `with` block, and restore the old
    options at the end. See `set_printoptions` for the full description of
    available options.
 
    Examples
    --------
 
    >>> from numpy.testing import assert_equal
    >>> with np.printoptions(precision=2):
    ...     np.array([2.0]) / 3
    array([0.67])
 
    The `as`-clause of the `with`-statement gives the current print options:
 
    >>> with np.printoptions(precision=2) as opts:
    ...      assert_equal(opts, np.get_printoptions())
 
    See Also
    --------
    set_printoptions, get_printoptions
 
    N)r]rr)ÚargsÚkwargsrkr:r:r>rNs
 r:c    Csˆt|ƒ}||jkr||S|j|d|krjtt|||tjd|…ƒt|||tj| d…ƒf|dSt|||tjdd…ƒSdS)z·
    Keep only the N-D corners (leading and trailing edges) of an array.
 
    Should be passed a base-class ndarray, since it makes no guarantees about
    preserving subclasses.
    éN)Úaxis)ÚlenÚndimÚshaperÚ_leading_trailingr]Z    index_exp)Úar.r`rpr:r:r>rtqs
þýrtcCs t|ƒtkrd}nd}| |¡S)z@ Object arrays containing lists should be printed unambiguously z
list({!r})z{!r})ÚtypeÚlistrE)ÚoÚfmtr:r:r>Ú_object_format…s rzcCst|ƒSr9)Úrepr©Úxr:r:r>Ú repr_formatsr~cCst|ƒSr9)Ústrr|r:r:r>Ú
str_formatsr€c s˜‡fdd„‡fdd„‡‡‡‡‡‡fdd„‡‡‡‡‡‡fdd„‡‡‡‡‡‡fdd„‡‡‡‡‡‡fdd„‡‡fdd„‡fd    d„d
d„d d„d d„d œ }dd„}    ˆdk    r”‡fdd„ˆ ¡Dƒ}
d|
krà| ¡D]} |    ˆdƒ|| <qÊd|
krdD]} |    ˆdƒ|| <qîd|
kr*dD]} |    ˆdƒ|| <qd|
krPdD]} |    ˆdƒ|| <q8d|
krj|    ˆdƒ|d<| ¡D] } | |
krr|    ˆ| ƒ|| <qr|S)NcstˆƒSr9)Ú
BoolFormatr:©Údatar:r>Ú<lambda>™óz!_get_formatdict.<locals>.<lambda>cstˆƒSr9)Ú IntegerFormatr:r‚r:r>r„šr…cstˆˆˆˆˆˆdS©Nrf©ÚFloatingFormatr:©rƒr0r8r1r6r2r:r>r„›sÿcstˆˆˆˆˆˆdSr‡rˆr:rŠr:r>r„sÿcstˆˆˆˆˆˆdSr‡©ÚComplexFloatingFormatr:rŠr:r>r„ŸsÿcstˆˆˆˆˆˆdSr‡r‹r:rŠr:r>r„¡sÿcs tˆˆdSr‡)ÚDatetimeFormatr:)rƒr8r:r>r„£r…cstˆƒSr9)ÚTimedeltaFormatr:r‚r:r>r„¤r…cSstSr9)rzr:r:r:r>r„¥r…cSstSr9)r€r:r:r:r>r„¦r…cSstSr9)r~r:r:r:r>r„§r…) rRÚintÚfloatÚ    longfloatÚ complexfloatÚlongcomplexfloatÚdatetimeÚ    timedeltaÚobjectÚvoidÚnumpystrcs ‡fdd„S)NcsˆSr9r:r:r|r:r>r„¬r…z3_get_formatdict.<locals>.indirect.<locals>.<lambda>r:r|r:r|r>Úindirect«sz!_get_formatdict.<locals>.indirectcsg|]}ˆ|dk    r|‘qSr9r:)r;r<)r7r:r>Ú
<listcomp>¯s z#_get_formatdict.<locals>.<listcomp>ÚallZint_kind)rZ
float_kind)rr‘Z complex_kind)r’r“Zstr_kindr˜)Úkeys) rƒr1r0r2r6r8r7rnÚ
formatdictr™ZfkeysÚkeyr:)rƒr0r7r8r1r6r2r>Ú_get_formatdict“sB
 
 
ñ
 
 
 
 
 
rŸcKsX|j}|j}t|f|Ž}|dkr*|dƒSt|tjƒr@|dƒSt|tjƒrnt|tjƒrb|dƒS|dƒSnæt|tjƒrœt|tj    ƒr|dƒS|dƒSn¸t|tj
ƒrÊt|tj ƒr¾|dƒS|d    ƒSnŠt|tj tj fƒræ|dƒSt|tjƒrþ|d
ƒSt|tjƒr|d ƒSt|tjƒrJ|jdk    r>tj|f|ŽS|d ƒSn
|dƒSdS) z;
    find the right formatting function for the dtype_
    Nr˜rRr•rr‘rr“r’r”r–r—)ÚdtypervrŸÚ
issubclassÚ_ntr#ÚintegerZ timedelta64Zfloatingr‘ZcomplexfloatingZ
clongfloatZunicode_Zstring_Z
datetime64Zobject_r—ÚnamesÚStructuredVoidFormatÚ    from_data)rƒraZdtype_Zdtypeobjrr:r:r>Ú_get_format_functionÄs< 
 
 
 
 
 
 
 
  r§ú...cs‡fdd„}|S)a 
    Like the python 3.2 reprlib.recursive_repr, but forwards *args and **kwargs
 
    Decorates a function such that if it calls itself with the same first
    argument, it returns `fillvalue` instead of recursing.
 
    Largely copied from reprlib.recursive_repr
    cs$tƒ‰t ˆ¡‡‡‡fdd„ƒ}|S)Nc    sJt|ƒtƒf}|ˆkrˆSˆ |¡zˆ|f|ž|ŽW¢Sˆ |¡XdSr9)Úidr ÚaddÚdiscard)Úselfrmrnrž)ÚfÚ    fillvalueÚ repr_runningr:r>Úwrapperús
z>_recursive_guard.<locals>.decorating_function.<locals>.wrapper)ÚsetÚ    functoolsÚwraps)r­r°©r®)r­r¯r>Údecorating_function÷s
z-_recursive_guard.<locals>.decorating_functionr:)r®rµr:r´r>Ú_recursive_guardís
r¶rIÚc    
Cs‚t|ƒ}|jdkr|}|j|dkr8d}t||dƒ}nd}t|f|Ž}d}|dt|ƒ7}t|||d|||d||dƒ}|S)    Nr:r/r¨r.r·rIr3r8)rrsÚsizertr§rqÚ _formatArray)    ruraÚ    separatorÚprefixrƒÚsummary_insertÚformat_functionÚnext_line_prefixÚlstr:r:r>Ú _array2string s$
  þrÀc Cs|fSr9r:)ruÚmax_line_widthr1Úsuppress_smallrºr»Ústyler7r/r.r6r0Úsuffixr8r:r:r>Ú_array2string_dispatcher(srÅ)Úmodulec  CsÂt|||    ||dd|
|| | ƒ }t ¡}| |¡|ddkrl|tjkrHt}|jdkr†|jj    dkr†|| 
¡ƒSn|tjk    r†t j dt dd|ddkr¦|dt| ƒ8<|jd    kr´d
St||||ƒS) a
    Return a string representation of an array.
 
    Parameters
    ----------
    a : ndarray
        Input array.
    max_line_width : int, optional
        Inserts newlines if text is longer than `max_line_width`.
        Defaults to ``numpy.get_printoptions()['linewidth']``.
    precision : int or None, optional
        Floating point precision.
        Defaults to ``numpy.get_printoptions()['precision']``.
    suppress_small : bool, optional
        Represent numbers "very close" to zero as zero; default is False.
        Very close is defined by precision: if the precision is 8, e.g.,
        numbers smaller (in absolute value) than 5e-9 are represented as
        zero.
        Defaults to ``numpy.get_printoptions()['suppress']``.
    separator : str, optional
        Inserted between elements.
    prefix : str, optional
    suffix : str, optional
        The length of the prefix and suffix strings are used to respectively
        align and wrap the output. An array is typically printed as::
 
          prefix + array2string(a) + suffix
 
        The output is left-padded by the length of the prefix string, and
        wrapping is forced at the column ``max_line_width - len(suffix)``.
        It should be noted that the content of prefix and suffix strings are
        not included in the output.
    style : _NoValue, optional
        Has no effect, do not use.
 
        .. deprecated:: 1.14.0
    formatter : dict of callables, optional
        If not None, the keys should indicate the type(s) that the respective
        formatting function applies to.  Callables should return a string.
        Types that are not specified (by their corresponding keys) are handled
        by the default formatters.  Individual types for which a formatter
        can be set are:
 
        - 'bool'
        - 'int'
        - 'timedelta' : a `numpy.timedelta64`
        - 'datetime' : a `numpy.datetime64`
        - 'float'
        - 'longfloat' : 128-bit floats
        - 'complexfloat'
        - 'longcomplexfloat' : composed of two 128-bit floats
        - 'void' : type `numpy.void`
        - 'numpystr' : types `numpy.string_` and `numpy.unicode_`
 
        Other keys that can be used to set a group of types at once are:
 
        - 'all' : sets all types
        - 'int_kind' : sets 'int'
        - 'float_kind' : sets 'float' and 'longfloat'
        - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat'
        - 'str_kind' : sets 'numpystr'
    threshold : int, optional
        Total number of array elements which trigger summarization
        rather than full repr.
        Defaults to ``numpy.get_printoptions()['threshold']``.
    edgeitems : int, optional
        Number of array items in summary at beginning and end of
        each dimension.
        Defaults to ``numpy.get_printoptions()['edgeitems']``.
    sign : string, either '-', '+', or ' ', optional
        Controls printing of the sign of floating-point types. If '+', always
        print the sign of positive values. If ' ', always prints a space
        (whitespace character) in the sign position of positive values.  If
        '-', omit the sign character of positive values.
        Defaults to ``numpy.get_printoptions()['sign']``.
    floatmode : str, optional
        Controls the interpretation of the `precision` option for
        floating-point types.
        Defaults to ``numpy.get_printoptions()['floatmode']``.
        Can take the following values:
 
        - 'fixed': Always print exactly `precision` fractional digits,
          even if this would print more or fewer digits than
          necessary to specify the value uniquely.
        - 'unique': Print the minimum number of fractional digits necessary
          to represent each value uniquely. Different elements may
          have a different number of digits.  The value of the
          `precision` option is ignored.
        - 'maxprec': Print at most `precision` fractional digits, but if
          an element can be uniquely represented with fewer digits
          only print it with that many.
        - 'maxprec_equal': Print at most `precision` fractional digits,
          but if every element in the array can be uniquely
          represented with an equal number of fewer digits, use that
          many digits for all elements.
    legacy : string or `False`, optional
        If set to the string `'1.13'` enables 1.13 legacy printing mode. This
        approximates numpy 1.13 print output by including a space in the sign
        position of floats and different behavior for 0d arrays. If set to
        `False`, disables legacy mode. Unrecognized strings will be ignored
        with a warning for forward compatibility.
 
        .. versionadded:: 1.14.0
 
    Returns
    -------
    array_str : str
        String representation of the array.
 
    Raises
    ------
    TypeError
        if a callable in `formatter` does not return a string.
 
    See Also
    --------
    array_str, array_repr, set_printoptions, get_printoptions
 
    Notes
    -----
    If a formatter is specified for a certain type, the `precision` keyword is
    ignored for that type.
 
    This is a very flexible function; `array_repr` and `array_str` are using
    `array2string` internally so keywords with the same name should work
    identically in all three functions.
 
    Examples
    --------
    >>> x = np.array([1e-16,1,2,3])
    >>> np.array2string(x, precision=2, separator=',',
    ...                       suppress_small=True)
    '[0.,1.,2.,3.]'
 
    >>> x  = np.arange(3.)
    >>> np.array2string(x, formatter={'float_kind':lambda x: "%.2f" % x})
    '[0.00 1.00 2.00]'
 
    >>> x  = np.arange(3)
    >>> np.array2string(x, formatter={'int':lambda x: hex(x)})
    '[0x0 0x1 0x2]'
 
    Nr8rKr:zT'style' argument is deprecated and no longer functional except in 1.13 'legacy' moder'rNr3r
z[])rdrgrjrhr]Ú_NoValuer{rsr r¤ÚitemrWrXÚDeprecationWarningrqr¸rÀ)rurÁr1rÂrºr»rÃr7r/r.r6r0rÄr8Ú    overridesrar:r:r>r1s8þ
 
 
þ 
cCsXt|ƒt|ƒ|k}|dkr0t|ƒt|ƒkr0d}|rH|| ¡d7}|}||7}||fS)NrKFÚ
)rqÚrstrip)ÚsÚlineÚwordÚ
line_widthr¾r8Z
needs_wrapr:r:r>Ú _extendLineãsrÑc
Csè| ¡}t|ƒdks|dkr.t||||||ƒStdd„|Dƒƒ}t|ƒ||kr‚t|ƒt|ƒkr‚|| ¡d7}||d}|}nt|ƒd}||d7}|dd…D]}|| ¡d7}||}q¦|t|d    ƒ}    ||    d7}||fS)
zS
    Extends line with nicely formatted (possibly multi-line) string ``word``.
    r rKcss|]}t|ƒVqdSr9©rq)r;rÏr:r:r>rGùsz%_extendLine_pretty.<locals>.<genexpr>rËr
rINéÿÿÿÿ)Ú
splitlinesrqrÑÚmaxrÌ)
rÍrÎrÏrÐr¾r8ÚwordsZmax_word_lengthÚindentZ suffix_lengthr:r:r>Ú_extendLine_prettyñs$ÿ   
 rØcs6‡‡‡‡‡‡‡fdd„‰zˆd||dW¢Sd‰XdS)zgformatArray is designed for two modes of operation:
 
    1. Full output
 
    2. Summarized output
 
    cs¤t|ƒ}ˆj|}|dkr&ˆˆ|ƒS|d}ˆdkr<|}n |tdƒ}ˆj|}ˆo`dˆ|k}|rpˆ}    ˆ}
nd}    |}
d} |dkr¸ˆdkr |tˆ ¡ƒ} n|ttˆ ¡ƒtdƒƒ} |} t|    ƒD]4}ˆ||f||ƒ}t| | || |ˆƒ\} } | ˆ7} qÆ|r4t| | ˆ| |ˆƒ\} } ˆdkr,| d7} n| ˆ7} t|
dd    ƒD]8}ˆ|| f||ƒ}t| | || |ˆƒ\} } | ˆ7} q@ˆdkrˆ|} ˆ|d
||ƒ}t| | || |ˆƒ\} } | | 7} nÐd} ˆ ¡d |d}t|    ƒD](}ˆ||f||ƒ}| |||7} qØ|r4ˆdkr$| |ˆd 7} n| |ˆ|7} t|
dd    ƒD]*}ˆ|| f||ƒ}| |||7} q@ˆ|d
||ƒ}| ||7} d | t|ƒd…d} | S)z¼
        By using this local function, we don't need to recurse with all the
        arguments. Since this function is not created recursively, the cost is
        not significant
        r
rIrKú]ror·r rCrÓ)rÓrËz, 
ú[N)rqrrrsrÌrÕÚrangerØrÑ)r`Úhanging_indentÚ
curr_widthrpZ    axes_leftZnext_hanging_indentZ
next_widthZa_lenZ show_summaryZ leading_itemsZtrailing_itemsrÍZ
elem_widthrÎÚirÏZline_sepÚnested©ruÚ
edge_itemsr½r8Úrecurserrºr¼r:r>râsª
 
 
 ÿ
ÿ
 
ÿ 
ÿ
 
ÿ z_formatArray.<locals>.recurserNr:)r`rÜrÝr:)rur½rÐr¾rºrár¼r8r:ràr>r¹ s    bþ
r¹cCs&|dkr dS|dkr"td |¡ƒ‚|S)NrÓr
z{} must be >= 0)rSrE)r}Únamer:r:r>Ú_none_or_positive_arg‚s
räc@s0eZdZdZd ddœdd„Zdd„Zd    d
„ZdS) r‰z' Formatter for subtypes of np.floating FNrfcCsŒt|tƒr|rdnd}||_|jdkr<|jdkr<|dkr<d}||_|dkrRd|_n||_t|jdƒ|_||_||_d|_    d|_
|  |¡dS)    NrHr-rKr:rIrAr1F) rYrRÚ_legacyrsr0r1rärÂr6Ú
exp_formatZlarge_exponentÚ
fillFormat)r¬rƒr1r0rÂr6r8r:r:r>Ú__init__‹s 
 
zFloatingFormat.__init__c    s|t|ƒ}t||dkƒ}t|ƒdkrzt |¡}t |¡}tdd.|dksjˆjsp|dksj||dkrpdˆ_W5QRXt|ƒdkr®dˆ_    dˆ_
dˆ_ d    ˆ_ dˆ_ dˆ_n¼ˆjršd
\‰‰ˆjd ks҈jd krÚd \‰‰‡‡‡fdd„|Dƒ}tdd„|DƒŽ\}}}    tdd„|DƒŽ\}
} tdd„|    Dƒƒdˆ_ dˆ_ tdd„| Dƒƒˆ_ˆjˆ_ˆˆ_ ˆjd krrdˆ_    ntdd„|
Dƒƒˆ_    ˆj dˆjˆ_
nÐd
\‰‰ˆjd kr¶d \‰‰‡‡‡fdd„|Dƒ}tdd„|DƒŽ\}
} ˆjd krdtdd„|
Dƒƒˆ_    ntdd„|
Dƒƒˆ_    tdd„| Dƒƒˆ_
d    ˆ_ ˆˆ_ ˆjdkr^ˆj
ˆ_ˆ_dˆ_ n dˆ_ dˆ_ˆjd kr ˆjdkr tt |¡ƒs ˆj    d7_    |j|jkr ˆjd kpÌt|t|ƒdkƒ} ttd!ƒ} ttd"ƒ| }ˆj
d}tˆj    | |||ƒˆ_    dS)#Nr
Úignore)Zoverg„×—Ag-Cëâ6?g@@TÚ.rÓ)rêTr@rK)r<Fc3s(|] }t|ˆjˆˆˆjdkdVqdS)rH)r1rAÚtrimr6N)rr1r6©r;r}©r¬rërAr:r>rGÀs þÿz,FloatingFormat.fillFormat.<locals>.<genexpr>css|]}| d¡VqdS)rcN)Ú    partition©r;rÍr:r:r>rGÃscss|]}| d¡VqdS©rêN©Úsplitrïr:r:r>rGÄscss|]}t|ƒVqdSr9rÒrïr:r:r>rGÅsr r<css|]}t|ƒVqdSr9rÒrïr:r:r>rGÈsr'css|]}t|ƒVqdSr9rÒrïr:r:r>rGÑsroc    3s*|]"}t|ˆjdˆˆˆjdkdVqdS)TrH)r1Ú
fractionalrArër6N)rr1r6rìrír:r>rGØsüýcss|]}| d¡VqdSrðrñrïr:r:r>rGÝscss|]}t| d¡ƒVqdS)z-+N)rqÚlstriprïr:r:r>rGßscss|]}t|ƒVqdSr9rÒrïr:r:r>rGáscss|]}t|ƒVqdSr9rÒrïr:r:r>rGâs)r@rBrIr-r4r5)rrrqr]rÕÚminrrÂræÚpad_leftÚ    pad_rightrëÚexp_sizerAÚ
min_digitsr0råÚzipr1r6rZsignbitr¸rrg)r¬rƒZ finite_valsZ abs_non_zeroZmax_valZmin_valÚstrsZ    frac_strsÚ_Zexp_strsZint_partZ    frac_partZneginfZnanlenZinflenÚoffsetr:rír>rç¦s€  
 
 ÿ
ÿ 
þ  ü     
zFloatingFormat.fillFormatc Csüt |¡sœtdd‚t |¡r@|jdkr.dnd}|td}n*|dkrLdn|jdkrZdnd}|td}d    |j|jd
t|ƒ|W5QR£SQRX|j    rÌt
||j |j |j |j|jdk|j|jd St||j |j |j d |j|jdk|j|jd     SdS)Nré)ÚinvalidrHr·r4r
r-r5rIr )r1rùrArër6röÚ
exp_digitsT)r1rùrArórër6rör÷)r]rrr^r6rgrör÷rqrærr1rùrArërør)r¬r}r6Úretr:r:r>Ú__call__ús8
 
 2ù    øzFloatingFormat.__call__)F)Ú__name__Ú
__module__Ú __qualname__Ú__doc__rèrçrr:r:r:r>r‰‰s ÿ Tr‰Tr<c
Cs`t|dƒ}t|dƒ}t|dƒ}t|dƒ}|dkrH|dkrH||krHtdƒ‚t||||||||dS)aì
 
    Format a floating-point scalar as a decimal string in scientific notation.
 
    Provides control over rounding, trimming and padding. Uses and assumes
    IEEE unbiased rounding. Uses the "Dragon4" algorithm.
 
    Parameters
    ----------
    x : python float or numpy floating scalar
        Value to format.
    precision : non-negative integer or None, optional
        Maximum number of digits to print. May be None if `unique` is
        `True`, but must be an integer if unique is `False`.
    unique : boolean, optional
        If `True`, use a digit-generation strategy which gives the shortest
        representation which uniquely identifies the floating-point number from
        other values of the same type, by judicious rounding. If `precision`
        is given fewer digits than necessary can be printed. If `min_digits`
        is given more can be printed, in which cases the last digit is rounded
        with unbiased rounding.
        If `False`, digits are generated as if printing an infinite-precision
        value and stopping after `precision` digits, rounding the remaining
        value with unbiased rounding
    trim : one of 'k', '.', '0', '-', optional
        Controls post-processing trimming of trailing digits, as follows:
 
        * 'k' : keep trailing zeros, keep decimal point (no trimming)
        * '.' : trim all trailing zeros, leave decimal point
        * '0' : trim all but the zero before the decimal point. Insert the
          zero if it is missing.
        * '-' : trim trailing zeros and any trailing decimal point
    sign : boolean, optional
        Whether to show the sign for positive values.
    pad_left : non-negative integer, optional
        Pad the left side of the string with whitespace until at least that
        many characters are to the left of the decimal point.
    exp_digits : non-negative integer, optional
        Pad the exponent with zeros until it contains at least this many digits.
        If omitted, the exponent will be at least 2 digits.
    min_digits : non-negative integer or None, optional
        Minimum number of digits to print. This only has an effect for
        `unique=True`. In that case more digits than necessary to uniquely
        identify the value may be printed and rounded unbiased.
 
        -- versionadded:: 1.21.0
        
    Returns
    -------
    rep : string
        The string representation of the floating point value
 
    See Also
    --------
    format_float_positional
 
    Examples
    --------
    >>> np.format_float_scientific(np.float32(np.pi))
    '3.1415927e+00'
    >>> s = np.float32(1.23e24)
    >>> np.format_float_scientific(s, unique=False, precision=15)
    '1.230000071797338e+24'
    >>> np.format_float_scientific(s, exp_digits=4)
    '1.23e+0024'
    r1rörÿrùr
ú2min_digits must be less than or equal to precision)r1rArër6rörÿrù)rärSr)r}r1rArër6rörÿrùr:r:r>r    sE
 
 
 
þc         Csvt|dƒ}t|dƒ}t|dƒ}t|dƒ}|s<|dkr<tdƒ‚|dkr\|dkr\||kr\tdƒ‚t|||||||||d    S)    a’
    Format a floating-point scalar as a decimal string in positional notation.
 
    Provides control over rounding, trimming and padding. Uses and assumes
    IEEE unbiased rounding. Uses the "Dragon4" algorithm.
 
    Parameters
    ----------
    x : python float or numpy floating scalar
        Value to format.
    precision : non-negative integer or None, optional
        Maximum number of digits to print. May be None if `unique` is
        `True`, but must be an integer if unique is `False`.
    unique : boolean, optional
        If `True`, use a digit-generation strategy which gives the shortest
        representation which uniquely identifies the floating-point number from
        other values of the same type, by judicious rounding. If `precision`
        is given fewer digits than necessary can be printed, or if `min_digits`
        is given more can be printed, in which cases the last digit is rounded
        with unbiased rounding.
        If `False`, digits are generated as if printing an infinite-precision
        value and stopping after `precision` digits, rounding the remaining
        value with unbiased rounding
    fractional : boolean, optional
        If `True`, the cutoffs of `precision` and `min_digits` refer to the
        total number of digits after the decimal point, including leading
        zeros.
        If `False`, `precision` and `min_digits` refer to the total number of
        significant digits, before or after the decimal point, ignoring leading
        zeros.
    trim : one of 'k', '.', '0', '-', optional
        Controls post-processing trimming of trailing digits, as follows:
 
        * 'k' : keep trailing zeros, keep decimal point (no trimming)
        * '.' : trim all trailing zeros, leave decimal point
        * '0' : trim all but the zero before the decimal point. Insert the
          zero if it is missing.
        * '-' : trim trailing zeros and any trailing decimal point
    sign : boolean, optional
        Whether to show the sign for positive values.
    pad_left : non-negative integer, optional
        Pad the left side of the string with whitespace until at least that
        many characters are to the left of the decimal point.
    pad_right : non-negative integer, optional
        Pad the right side of the string with whitespace until at least that
        many characters are to the right of the decimal point.
    min_digits : non-negative integer or None, optional
        Minimum number of digits to print. Only has an effect if `unique=True`
        in which case additional digits past those necessary to uniquely
        identify the value may be printed, rounding the last additional digit.
        
        -- versionadded:: 1.21.0
 
    Returns
    -------
    rep : string
        The string representation of the floating point value
 
    See Also
    --------
    format_float_scientific
 
    Examples
    --------
    >>> np.format_float_positional(np.float32(np.pi))
    '3.1415927'
    >>> np.format_float_positional(np.float16(np.pi))
    '3.14'
    >>> np.format_float_positional(np.float16(0.3))
    '0.3'
    >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10)
    '0.3000488281'
    r1rör÷rùr
z4precision must be greater than 0 if fractional=Falser)r1rArórër6rör÷rù)rärSr)    r}r1rArórër6rör÷rùr:r:r>rjs M
 
 
 
 ýc@seZdZdd„Zdd„ZdS)r†cCsF|jdkr2tttt |¡ƒƒttt |¡ƒƒƒ}nd}d |¡|_dS)Nr
z%{}d)r¸rÕrqrr]rõrE)r¬rƒÚ max_str_lenr:r:r>rèÇs 
ÿzIntegerFormat.__init__cCs
|j|Sr9rD©r¬r}r:r:r>rÏszIntegerFormat.__call__N©rrrrèrr:r:r:r>r†Æsr†c@seZdZdd„Zdd„ZdS)rcKs|jdkrdnd|_dS)Nr:z TrueÚTrue)rsÚtruestr)r¬rƒrnr:r:r>rèÔszBoolFormat.__init__cCs|r
|jSdS)NÚFalse)r rr:r:r>rÙszBoolFormat.__call__Nr    r:r:r:r>rÓsrc@s(eZdZdZd    ddœdd„Zdd„ZdS)
rŒz. Formatter for subtypes of np.complexfloating FNrfc    Csbt|tƒr|rdnd}|}}|dkr.d}d}t|j|||||d|_t|j|||d|d|_dS)NrHr-rKrBr()r6r8)rYrRr‰ÚrealÚ real_formatÚimagÚ imag_format)    r¬r}r1r0rÂr6r8Zfloatmode_realZfloatmode_imagr:r:r>rèßs,
 þþzComplexFloatingFormat.__init__cCsH| |j¡}| |j¡}t| ¡ƒ}|d|…d||d…}||S)NÚj)rr rrrqrÌ)r¬r}ÚrrÞÚspr:r:r>rós
   zComplexFloatingFormat.__call__)F)rrrrrèrr:r:r:r>rŒÝs ÿÿ rŒc@s$eZdZdd„Zdd„Zdd„ZdS)Ú_TimelikeFormatcCs~|t|ƒ}t|ƒdkrFtt| t |¡¡ƒt| t |¡¡ƒƒ}nd}t|ƒ|jkrbt|dƒ}d |¡|_d     |¡|_
dS)Nr
éz%{}sz'NaT') rrqrÕÚ_format_non_natr]rõr¸rEÚ_formatÚrjustÚ_nat)r¬rƒZnon_natrr:r:r>rèÿs ÿ
 z_TimelikeFormat.__init__cCst‚dSr9)ÚNotImplementedErrorrr:r:r>r sz_TimelikeFormat._format_non_natcCs"t|ƒr|jS|j| |¡SdSr9)rrrrrr:r:r>rsz_TimelikeFormat.__call__N)rrrrèrrr:r:r:r>rþsrcs2eZdZd
‡fdd„    Z‡fdd„Zdd    „Z‡ZS) rNÚ    same_kindFcs\|dkr(|jjdkr$t|jƒd}nd}|dkr4d}||_||_||_||_tƒ |¡dS)NÚMr
rÍZnaive)    r ÚkindrÚtimezoneÚunitÚcastingr8Úsuperrè)r¬r}rrr r8©Ú    __class__r:r>rès zDatetimeFormat.__init__cs |jdkr| |¡Stƒ |¡S)NrK)r8rr!rrr"r:r>r,s
 
zDatetimeFormat.__call__cCsdt||j|j|jdS)Nú'%s')rrr )rrrr rr:r:r>r1s
ýzDatetimeFormat._format_non_nat)NNrF)rrrrèrrÚ __classcell__r:r:r"r>rs
ÿ rc@seZdZdd„ZdS)rŽcCst| d¡ƒS)NÚi8)rZastyperr:r:r>r9szTimedeltaFormat._format_non_natN)rrrrr:r:r:r>rŽ8srŽc@seZdZdd„Zdd„ZdS)ÚSubArrayFormatcCs
||_dSr9©r½)r¬r½r:r:r>rè>szSubArrayFormat.__init__csJ|jdkr*dd ‡fdd„|Dƒ¡dSdd ‡fdd„|Dƒ¡dS)Nr rÚrCc3s|]}ˆ |¡VqdSr9r(©r;ru©r¬r:r>rGCsz*SubArrayFormat.__call__.<locals>.<genexpr>rÙc3s|]}ˆ |¡VqdSr9)rr)r*r:r>rGDs)rrrT)r¬Úarrr:r*r>rAs
 zSubArrayFormat.__call__Nr    r:r:r:r>r'=sr'c@s,eZdZdZdd„Zedd„ƒZdd„ZdS)    r¥zô
    Formatter for structured np.void objects.
 
    This does not work on structured alias types like np.dtype(('i4', 'i2,i2')),
    as alias scalars lose their field information, and the implementation
    relies upon np.void.__getitem__.
    cCs
||_dSr9)Úformat_functions)r¬r,r:r:r>rèOszStructuredVoidFormat.__init__cKsLg}|jjD]6}t||f|Ž}|j|jdkr8t|ƒ}| |¡q ||ƒS)z¢
        This is a second way to initialize StructuredVoidFormat, using the raw data
        as input. Added to avoid changing the signature of __init__.
        r:)r r¤r§rsr'Úappend)Úclsrƒrar,Ú
field_namer½r:r:r>r¦Rs  zStructuredVoidFormat.from_datacCsDdd„t||jƒDƒ}t|ƒdkr0d |d¡Sd d |¡¡SdS)NcSsg|]\}}||ƒ‘qSr:r:)r;Úfieldr½r:r:r>ršasÿz1StructuredVoidFormat.__call__.<locals>.<listcomp>r z({},)r
z({})rC)rúr,rqrErT)r¬r}Z
str_fieldsr:r:r>r`s 
þ zStructuredVoidFormat.__call__N)rrrrrèÚ classmethodr¦rr:r:r:r>r¥Gs
 
r¥cCstjt|ƒftŽ|ƒS)z½
    Implements the repr for structured-void scalars. It is called from the
    scalartypes.c.src code, and is placed here because it uses the elementwise
    formatters defined above.
    )r¥r¦rrgr|r:r:r>Ú_void_scalar_reprksr2cCs<t |¡}tddkr$|jtkr$dS|jdk    r2dS|jtkS)a
    Determine if the given dtype is implied by the representation of its values.
 
    Parameters
    ----------
    dtype : dtype
        Data type
 
    Returns
    -------
    implied : bool
        True if the dtype is implied by the representation of its values.
 
    Examples
    --------
    >>> np.core.arrayprint.dtype_is_implied(int)
    True
    >>> np.array([1, 2, 3], int)
    array([1, 2, 3])
    >>> np.core.arrayprint.dtype_is_implied(np.int8)
    False
    >>> np.array([1, 2, 3], np.int8)
    array([1, 2, 3], dtype=int8)
    r8rKFN)r]r rgrvr#r¤Ú _typelessdata)r r:r:r>Údtype_is_impliedws 
 
r4cCsnt|ƒjtjjkrt|ƒS|jdk    r,t|ƒSt|jtƒrDdt|ƒS|j    }|rj|d 
¡rb|  ¡sjt|ƒ}|S)zñ
    Convert a dtype to a short form which evaluates to the same dtype.
 
    The intent is roughly that the following holds
 
    >>> from numpy import *
    >>> dt = np.int64([1, 2]).dtype
    >>> assert eval(dtype_short_repr(dt)) == dt
    Nr$r
) rvÚ__repr__r]r r{r¤rr¡r$rãÚisalphaÚisalnum)r Útypenamer:r:r>Údtype_short_repr›s
 
  r9c    Csd|dkrtd}t|ƒtk    r(t|ƒj}nd}t|jƒo>|jdk}|d}|rPdnd}tdd    kr€|jd
kr€|jjs€t    | 
¡ƒ}    n<|jdks”|jd kr¬|||||d ||d }    ndt    |jƒf}    ||    |}
|rÐ|
Sd  t |jƒ¡} t |
ƒ|
 d¡d} d} tdd    kr.t|jjtƒrXddt |dƒ} n*| t | ƒd|krXddt |dƒ} |
| | S)zEInternal version of array_repr() that allows overriding array2string.Nr3rr
ú(ú)ú,r8rKr:)r
rC)rÄz [], shape=%sz    dtype={})rËr rI)rgrvrrr4r r¸rsr¤r{rÈrEr9rqÚrfindr¡r$)r+rÁr1rÂrÚ
class_nameZ    skipdtyper»rÄr¿Zarr_strZ    dtype_strZ last_line_lenZspacerr:r:r>Ú_array_repr_implementation·sB    ÿÿ
ÿ r?cCs|fSr9r:©r+rÁr1rÂr:r:r>Ú_array_repr_dispatcheræsrAcCst||||ƒS)a 
    Return the string representation of an array.
 
    Parameters
    ----------
    arr : ndarray
        Input array.
    max_line_width : int, optional
        Inserts newlines if text is longer than `max_line_width`.
        Defaults to ``numpy.get_printoptions()['linewidth']``.
    precision : int, optional
        Floating point precision.
        Defaults to ``numpy.get_printoptions()['precision']``.
    suppress_small : bool, optional
        Represent numbers "very close" to zero as zero; default is False.
        Very close is defined by precision: if the precision is 8, e.g.,
        numbers smaller (in absolute value) than 5e-9 are represented as
        zero.
        Defaults to ``numpy.get_printoptions()['suppress']``.
 
    Returns
    -------
    string : str
      The string representation of an array.
 
    See Also
    --------
    array_str, array2string, set_printoptions
 
    Examples
    --------
    >>> np.array_repr(np.array([1,2]))
    'array([1, 2])'
    >>> np.array_repr(np.ma.array([0.]))
    'MaskedArray([0.])'
    >>> np.array_repr(np.array([], np.int32))
    'array([], dtype=int32)'
 
    >>> x = np.array([1e-6, 4e-7, 2, 3])
    >>> np.array_repr(x, precision=6, suppress_small=True)
    'array([0.000001,  0.      ,  2.      ,  3.      ])'
 
    )r?r@r:r:r>rës -ÿcCst|tƒrt|ƒSt|ƒSr9)rYÚbytesr{r)r=r:r:r>Ú_guarded_repr_or_strs
rCcCsXtddkr*|jdkr*|jjs*t| ¡ƒS|jdkrFttj     |d¡ƒS|||||ddƒS)zDInternal version of array_str() that allows overriding array2string.r8rKr:rIr·)
rgrsr r¤rrÈrCr]rÚ __getitem__)rurÁr1rÂrr:r:r>Ú_array_str_implementation#s ÿÿ 
rEcCs|fSr9r:©rurÁr1rÂr:r:r>Ú_array_str_dispatcher7srGcCst||||ƒS)aa
    Return a string representation of the data in an array.
 
    The data in the array is returned as a single string.  This function is
    similar to `array_repr`, the difference being that `array_repr` also
    returns information on the kind of array and its data type.
 
    Parameters
    ----------
    a : ndarray
        Input array.
    max_line_width : int, optional
        Inserts newlines if text is longer than `max_line_width`.
        Defaults to ``numpy.get_printoptions()['linewidth']``.
    precision : int, optional
        Floating point precision.
        Defaults to ``numpy.get_printoptions()['precision']``.
    suppress_small : bool, optional
        Represent numbers "very close" to zero as zero; default is False.
        Very close is defined by precision: if the precision is 8, e.g.,
        numbers smaller (in absolute value) than 5e-9 are represented as
        zero.
        Defaults to ``numpy.get_printoptions()['suppress']``.
 
    See Also
    --------
    array2string, array_repr, set_printoptions
 
    Examples
    --------
    >>> np.array_str(np.arange(3))
    '[0 1 2]'
 
    )rErFr:r:r>r<s $ÿÚ __wrapped__)rcCs6|dkr&|rt td¡St td¡Sn t ||¡SdS)aù
    Set a Python function to be used when pretty printing arrays.
 
    Parameters
    ----------
    f : function or None
        Function to be used to pretty print arrays. The function should expect
        a single array argument and return a string of the representation of
        the array. If None, the function is reset to the default NumPy function
        to print arrays.
    repr : bool, optional
        If True (default), the function for pretty printing (``__repr__``)
        is set, if False the function that returns the default string
        representation (``__str__``) is set.
 
    See Also
    --------
    set_printoptions, get_printoptions
 
    Examples
    --------
    >>> def pprint(arr):
    ...     return 'HA! - What are you going to do now?'
    ...
    >>> np.set_string_function(pprint)
    >>> a = np.arange(10)
    >>> a
    HA! - What are you going to do now?
    >>> _ = a
    >>> # [0 1 2 3 4 5 6 7 8 9]
 
    We can reset the function to the default:
 
    >>> np.set_string_function(None)
    >>> a
    array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
 
    `repr` affects either pretty printing or normal string representation.
    Note that ``__repr__`` is still affected by setting ``__str__``
    because the width of each array element in the returned string becomes
    equal to the length of the result of ``__str__()``.
 
    >>> x = np.arange(4)
    >>> np.set_string_function(lambda x:'random', repr=False)
    >>> x.__str__()
    'random'
    >>> x.__repr__()
    'array([0, 1, 2, 3])'
 
    Nr r
)rrÚ_default_array_reprÚ_default_array_str)r­r{r:r:r>rls
3 ) NNNNNNNNNNN)
NNNNNNNNNN)r:)r¨)rIr·) NNNNNNNNNNNN)NTr<FNNN)NTTr<FNNN)NNN)NNN)NNN)NNN)T)brÚ__all__Z __docformat__r²rZrUÚ_threadr Ú ImportErrorÚ _dummy_threadrer]r·r r¢ZumathrrrrrrrrrrrrZ fromnumericrÚnumericrrrrrr r!r"r#r$rÊr%r&r_rWÚ
contextlibrVrgrdrrrlÚcontextmanagerrrtrzr~r€rŸr§r¶rÀrÅrÇrrÑrØr¹rär‰r    rr†rrŒrrrŽr'r¥r2r3r4r9r?rArrCrErGrÚgetattrZ_array2string_implÚpartialrJrIrr:r:r:r>Ú<module>s\þ  $ $óþ
4þþ3
! !
1)
 üû     
ýü2vþ Oþ [ 
! 
$     $þ
0ÿ
 
 0
þ
ÿ
 
 ( ÿÿ